stageflow 0.44.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/evalGate.js +1 -0
- package/dist/cli/evalCommand.d.ts +1 -1
- package/dist/cli/evalCommand.js +39 -2
- package/dist/cli/hostClient.d.ts +6 -0
- package/dist/cli/hostClient.js +4 -0
- package/dist/config/loadEval.d.ts +3 -1
- package/dist/config/loadEval.js +75 -7
- package/dist/config/validateEval.js +17 -1
- package/dist/evals/calibration.d.ts +21 -0
- package/dist/evals/calibration.js +69 -0
- package/dist/evals/calibrationSuggest.d.ts +29 -0
- package/dist/evals/calibrationSuggest.js +72 -0
- package/dist/evals/calibrator.d.ts +46 -0
- package/dist/evals/calibrator.js +148 -0
- package/dist/evals/compare.d.ts +1 -1
- package/dist/evals/compare.js +3 -0
- package/dist/evals/constants.d.ts +4 -2
- package/dist/evals/constants.js +4 -0
- package/dist/evals/engine/FakeEngine.d.ts +1 -0
- package/dist/evals/engine/FakeEngine.js +7 -2
- package/dist/evals/engine/promptfoo/PromptfooEngine.js +2 -1
- package/dist/evals/engine/promptfoo/generate.d.ts +2 -0
- package/dist/evals/engine/promptfoo/generate.js +33 -16
- package/dist/evals/engine/promptfoo/judgeProviders.js +2 -1
- package/dist/evals/engine/promptfoo/normalize.d.ts +4 -1
- package/dist/evals/engine/promptfoo/normalize.js +16 -3
- package/dist/evals/engine/promptfoo/rubricPrompt.d.ts +2 -0
- package/dist/evals/engine/promptfoo/rubricPrompt.js +10 -2
- package/dist/evals/errors.d.ts +7 -0
- package/dist/evals/errors.js +10 -0
- package/dist/evals/judgeProviders.d.ts +6 -0
- package/dist/evals/judgeProviders.js +14 -0
- package/dist/evals/judged.d.ts +7 -0
- package/dist/evals/judged.js +7 -0
- package/dist/evals/manager.d.ts +14 -8
- package/dist/evals/manager.js +63 -10
- package/dist/evals/plan.d.ts +2 -0
- package/dist/evals/plan.js +5 -4
- package/dist/evals/planInternalAgent.d.ts +1 -1
- package/dist/evals/planInternalAgent.js +2 -6
- package/dist/evals/read/api.d.ts +6 -0
- package/dist/evals/read/api.js +5 -1
- package/dist/evals/read/labelQueue.d.ts +45 -0
- package/dist/evals/read/labelQueue.js +83 -0
- package/dist/evals/stats.d.ts +40 -0
- package/dist/evals/stats.js +69 -0
- package/dist/evals/storeTypes.d.ts +42 -0
- package/dist/evals/types.d.ts +13 -0
- package/dist/evals/votes.d.ts +10 -0
- package/dist/evals/votes.js +60 -0
- package/dist/mcp/evalTools.js +39 -0
- package/dist/operatorAgent/profiles/guideConfirm.js +1 -1
- package/dist/operatorAgent/profiles/stageflowGuide.d.ts +1 -1
- package/dist/operatorAgent/profiles/stageflowGuide.js +8 -7
- package/dist/package-meta.d.ts +1 -1
- package/dist/package-meta.js +1 -1
- package/dist/runstore/port.d.ts +13 -1
- package/dist/runstore/sqlite/SqliteRunStore.d.ts +10 -1
- package/dist/runstore/sqlite/SqliteRunStore.js +25 -0
- package/dist/runstore/sqlite/calibrationStore.d.ts +10 -0
- package/dist/runstore/sqlite/calibrationStore.js +106 -0
- package/dist/runstore/sqlite/evalStore.d.ts +5 -0
- package/dist/runstore/sqlite/evalStore.js +7 -0
- package/dist/runstore/sqlite/migrations/018-eval-grader-labels.d.ts +11 -0
- package/dist/runstore/sqlite/migrations/018-eval-grader-labels.js +43 -0
- package/dist/runstore/sqlite/migrations/index.js +2 -0
- package/dist/server/evalRoutes.js +213 -3
- package/dist/toolkit/meta.js +2 -0
- package/dist/ui/assets/{MarkdownText-S5C_vemc.js → MarkdownText-BS2BBbCx.js} +1 -1
- package/dist/ui/assets/adapters-DPD-cAsy.js +17 -0
- package/dist/ui/assets/chat-BD1-VTT6.js +2 -0
- package/dist/ui/assets/chat-DXnQv9st.css +2 -0
- package/dist/ui/assets/main-AX5XNLtX.js +278 -0
- package/dist/ui/assets/{main-Del1GeLf.css → main-CFX0_n8J.css} +1 -1
- package/dist/ui/chat.html +3 -3
- package/dist/ui/index.html +3 -3
- package/package.json +1 -1
- package/skills/stageflow/references/control-surface.md +1 -1
- package/skills/stageflow/references/evals.md +1 -0
- package/dist/ui/assets/adapters-C0l4ruiR.js +0 -17
- package/dist/ui/assets/chat-CjnsmvqR.js +0 -2
- package/dist/ui/assets/chat-DFDd4UjS.css +0 -2
- package/dist/ui/assets/main-_yXVqcW9.js +0 -277
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-iVoFAvQ_.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var i=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&te(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&te(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function te(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,te(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),a=n(((e,t)=>{t.exports=i()})),o=n((t=>{var n=e();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,t.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},t.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},t.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},t.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},t.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},t.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},t.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},t.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},t.requestFormReset=function(e){a.d.r(e)},t.unstable_batchedUpdates=function(e,t){return e(t)},t.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},t.useFormStatus=function(){return c.H.useHostTransitionStatus()},t.version=`19.2.8`})),s=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=o()})),c=n((t=>{var n=a(),r=e(),i=s();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=a;break}if(c===r){s=!0,r=i,n=a;break}c=c.sibling}if(!s){for(c=a.child;c;){if(c===n){s=!0,n=a,r=i;break}if(c===r){s=!0,r=a,n=i;break}c=c.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),te=Symbol.iterator;function ne(e){return typeof e!=`object`||!e?null:(e=te&&e[te]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,A=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M={pending:!1,data:null,method:null,action:null},oe=[],se=-1;function ce(e){return{current:e}}function N(e){0>se||(e.current=oe[se],oe[se]=null,se--)}function P(e,t){se++,oe[se]=e.current,e.current=t}var le=ce(null),ue=ce(null),de=ce(null),fe=ce(null);function pe(e,t){switch(P(de,t),P(ue,e),P(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}N(le),P(le,e)}function me(){N(le),N(ue),N(de)}function he(e){e.memoizedState!==null&&P(fe,e);var t=le.current,n=Hd(t,e.type);t!==n&&(P(ue,e),P(le,n))}function ge(e){ue.current===e&&(N(le),N(ue)),fe.current===e&&(N(fe),Qf._currentValue=M)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=n.unstable_scheduleCallback,Ee=n.unstable_cancelCallback,De=n.unstable_shouldYield,Oe=n.unstable_requestPaint,ke=n.unstable_now,Ae=n.unstable_getCurrentPriorityLevel,je=n.unstable_ImmediatePriority,Me=n.unstable_UserBlockingPriority,Ne=n.unstable_NormalPriority,Pe=n.unstable_LowPriority,Fe=n.unstable_IdlePriority,Ie=n.log,Le=n.unstable_setDisableYieldValue,Re=null,ze=null;function Be(e){if(typeof Ie==`function`&&Le(e),ze&&typeof ze.setStrictMode==`function`)try{ze.setStrictMode(Re,e)}catch{}}var Ve=Math.clz32?Math.clz32:We,He=Math.log,Ue=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(He(e)/Ue|0)|0}var Ge=256,Ke=262144,qe=4194304;function Je(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ye(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Je(n))):i=Je(o):i=Je(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Je(n))):i=Je(o)):i=Je(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ze(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qe(){var e=qe;return qe<<=1,!(qe&62914560)&&(qe=4194304),e}function $e(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function et(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ve(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&nt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function nt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ve(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ve(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function it(e,t){var n=t&-t;return n=n&42?1:at(n),(n&(e.suspendedLanes|t))===0?n:0}function at(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ot(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function st(){var e=j.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function ct(e,t){var n=j.p;try{return j.p=e,t()}finally{j.p=n}}var lt=Math.random().toString(36).slice(2),ut=`__reactFiber$`+lt,dt=`__reactProps$`+lt,ft=`__reactContainer$`+lt,pt=`__reactEvents$`+lt,mt=`__reactListeners$`+lt,ht=`__reactHandles$`+lt,gt=`__reactResources$`+lt,_t=`__reactMarker$`+lt;function vt(e){delete e[ut],delete e[dt],delete e[pt],delete e[mt],delete e[ht]}function yt(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ft]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[ut])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function bt(e){if(e=e[ut]||e[ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function xt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function St(e){var t=e[gt];return t||=e[gt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ct(e){e[_t]=!0}var wt=new Set,Tt={};function Et(e,t){Dt(e,t),Dt(e+`Capture`,t)}function Dt(e,t){for(Tt[e]=t,e=0;e<t.length;e++)wt.add(t[e])}var Ot=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),kt={},At={};function jt(e){return we.call(At,e)?!0:we.call(kt,e)?!1:Ot.test(e)?At[e]=!0:(kt[e]=!0,!1)}function Mt(e,t,n){if(jt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Nt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Pt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ft(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function It(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Lt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rt(e){if(!e._valueTracker){var t=It(e)?`checked`:`value`;e._valueTracker=Lt(e,t,``+e[t])}}function zt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=It(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Bt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Vt=/[\n"\\]/g;function Ht(e){return e.replace(Vt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ut(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ft(t)):e.value!==``+Ft(t)&&(e.value=``+Ft(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Gt(e,o,Ft(n)):Gt(e,o,Ft(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ft(s):e.removeAttribute(`name`)}function Wt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Rt(e);return}n=n==null?``:``+Ft(n),t=t==null?n:``+Ft(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Rt(e)}function Gt(e,t,n){t===`number`&&Bt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Kt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Ft(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function qt(e,t,n){if(t!=null&&(t=``+Ft(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ft(n)}function Jt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(ae(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=Ft(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Rt(e)}function Yt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Xt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Zt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Xt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Qt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Zt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Zt(e,a,t[a])}function $t(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var en=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),tn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function nn(e){return tn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function rn(){}var an=null;function on(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sn=null,cn=null;function ln(e){var t=bt(e);if(t&&(e=t.stateNode)){var n=e[dt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ut(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ht(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[dt]||null;if(!i)throw Error(o(90));Ut(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&zt(r)}break a;case`textarea`:qt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Kt(e,!!n.multiple,t,!1)}}}var un=!1;function dn(e,t,n){if(un)return e(t,n);un=!0;try{return e(t)}finally{if(un=!1,(sn!==null||cn!==null)&&(vu(),sn&&(t=sn,e=cn,cn=sn=null,ln(t),e)))for(t=0;t<e.length;t++)ln(e[t])}}function fn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[dt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var pn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),mn=!1;if(pn)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){mn=!0}}),window.addEventListener(`test`,hn,hn),window.removeEventListener(`test`,hn,hn)}catch{mn=!1}var gn=null,_n=null,vn=null;function yn(){if(vn)return vn;var e,t=_n,n=t.length,r,i=`value`in gn?gn.value:gn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return vn=i.slice(e,1<r?1-r:void 0)}function bn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function xn(){return!0}function Sn(){return!1}function Cn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?xn:Sn,this.isPropagationStopped=Sn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=xn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=xn)},persist:function(){},isPersistent:xn}),t}var wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tn=Cn(wn),En=h({},wn,{view:0,detail:0}),Dn=Cn(En),On,kn,An,jn=h({},En,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:I,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==An&&(An&&e.type===`mousemove`?(On=e.screenX-An.screenX,kn=e.screenY-An.screenY):kn=On=0,An=e),On)},movementY:function(e){return`movementY`in e?e.movementY:kn}}),Mn=Cn(jn),Nn=Cn(h({},jn,{dataTransfer:0})),Pn=Cn(h({},En,{relatedTarget:0})),Fn=Cn(h({},wn,{animationName:0,elapsedTime:0,pseudoElement:0})),In=Cn(h({},wn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Ln=Cn(h({},wn,{data:0})),Rn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},zn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Bn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function F(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Bn[e])?!!t[e]:!1}function I(){return F}var Vn=Cn(h({},En,{key:function(e){if(e.key){var t=Rn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=bn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?zn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:I,charCode:function(e){return e.type===`keypress`?bn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?bn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Hn=Cn(h({},jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Un=Cn(h({},En,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:I})),Wn=Cn(h({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Gn=Cn(h({},jn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Kn=Cn(h({},wn,{newState:0,oldState:0})),qn=[9,13,27,32],Jn=pn&&`CompositionEvent`in window,Yn=null;pn&&`documentMode`in document&&(Yn=document.documentMode);var Xn=pn&&`TextEvent`in window&&!Yn,Zn=pn&&(!Jn||Yn&&8<Yn&&11>=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=yn(),vn=_n=gn=null,nr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Zn&&t.locale!==`ko`?null:t.data;default:return null}}var ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ar[e.type]:t===`textarea`}function sr(e,t,n,r){sn?cn?cn.push(r):cn=[r]:sn=r,t=Td(t,`onChange`),0<t.length&&(n=new Tn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var cr=null,lr=null;function ur(e){vd(e,0)}function dr(e){if(zt(xt(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(pn){var mr;if(pn){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}mr=hr}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function _r(){cr&&(cr.detachEvent(`onpropertychange`,vr),lr=cr=null)}function vr(e){if(e.propertyName===`value`&&dr(lr)){var t=[];sr(t,lr,e,on(e)),dn(ur,t)}}function yr(e,t,n){e===`focusin`?(_r(),cr=t,lr=n,cr.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function xr(e,t){if(e===`click`)return dr(t)}function Sr(e,t){if(e===`input`||e===`change`)return dr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(e,t){if(wr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!we.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Bt(e.document)}return t}function Ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var jr=pn&&`documentMode`in document&&11>=document.documentMode,Mr=null,Nr=null,Pr=null,Fr=!1;function Ir(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fr||Mr==null||Mr!==Bt(r)||(r=Mr,`selectionStart`in r&&Ar(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pr&&Tr(Pr,r)||(Pr=r,r=Td(Nr,`onSelect`),0<r.length&&(t=new Tn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Mr)))}function Lr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Rr={animationend:Lr(`Animation`,`AnimationEnd`),animationiteration:Lr(`Animation`,`AnimationIteration`),animationstart:Lr(`Animation`,`AnimationStart`),transitionrun:Lr(`Transition`,`TransitionRun`),transitionstart:Lr(`Transition`,`TransitionStart`),transitioncancel:Lr(`Transition`,`TransitionCancel`),transitionend:Lr(`Transition`,`TransitionEnd`)},zr={},Br={};pn&&(Br=document.createElement(`div`).style,`AnimationEvent`in window||(delete Rr.animationend.animation,delete Rr.animationiteration.animation,delete Rr.animationstart.animation),`TransitionEvent`in window||delete Rr.transitionend.transition);function L(e){if(zr[e])return zr[e];if(!Rr[e])return e;var t=Rr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Br)return zr[e]=t[n];return e}var Vr=L(`animationend`),R=L(`animationiteration`),Hr=L(`animationstart`),Ur=L(`transitionrun`),z=L(`transitionstart`),Wr=L(`transitioncancel`),Gr=L(`transitionend`),Kr=new Map,qr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),Et(t,[e])}var Yr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Xr=[],B=0,Zr=0;function Qr(){for(var e=B,t=Zr=B=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ni(n,i,a)}}function $r(e,t,n,r){Xr[B++]=e,Xr[B++]=t,Xr[B++]=n,Xr[B++]=r,Zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ei(e,t,n,r){return $r(e,t,n,r),ri(e)}function ti(e,t){return $r(e,null,null,t),ri(e)}function ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ve(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ri(e){if(50<Q)throw Q=0,uu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ii={};function ai(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function oi(e,t,n,r){return new ai(e,t,n,r)}function si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ci(e,t){var n=e.alternate;return n===null?(n=oi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function li(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ui(e,t,n,r,i,a){var s=0;if(r=e,typeof e==`function`)si(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,le.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=oi(31,n,t,i),e.elementType=k,e.lanes=a,e;case y:return di(n.children,i,a,t);case b:s=8,i|=24;break;case x:return e=oi(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=oi(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=oi(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=oi(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function di(e,t,n,r){return e=oi(7,e,r,t),e.lanes=n,e}function fi(e,t,n){return e=oi(6,e,null,t),e.lanes=n,e}function pi(e){var t=oi(18,null,null,0);return t.stateNode=e,t}function mi(e,t,n){return t=oi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var hi=new WeakMap;function gi(e,t){if(typeof e==`object`&&e){var n=hi.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},hi.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var _i=[],vi=0,yi=null,bi=0,xi=[],Si=0,Ci=null,wi=1,Ti=``;function Ei(e,t){_i[vi++]=bi,_i[vi++]=yi,yi=e,bi=t}function Di(e,t,n){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,Ci=e;var r=wi;e=Ti;var i=32-Ve(r)-1;r&=~(1<<i),n+=1;var a=32-Ve(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,wi=1<<32-Ve(t)+i|n<<i|r,Ti=a+e}else wi=1<<a|n<<i|r,Ti=e}function Oi(e){e.return!==null&&(Ei(e,1),Di(e,1,0))}function ki(e){for(;e===yi;)yi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null;for(;e===Ci;)Ci=xi[--Si],xi[Si]=null,Ti=xi[--Si],xi[Si]=null,wi=xi[--Si],xi[Si]=null}function Ai(e,t){xi[Si++]=wi,xi[Si++]=Ti,xi[Si++]=Ci,wi=t.id,Ti=t.overflow,Ci=e}var ji=null,Mi=null,V=!1,Ni=null,Pi=!1,Fi=Error(o(519));function Ii(e){throw Hi(gi(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Fi}function Li(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ut]=e,t[dt]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Wt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Jt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=rn),t=!0):t=!1,t||Ii(e,!0)}function Ri(e){for(ji=e.return;ji;)switch(ji.tag){case 5:case 31:case 13:Pi=!1;return;case 27:case 3:Pi=!0;return;default:ji=ji.return}}function zi(e){if(e!==ji)return!1;if(!V)return Ri(e),V=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&Mi&&Ii(e),Ri(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Mi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Mi=uf(e)}else t===27?(t=Mi,Zd(e.type)?(e=lf,lf=null,Mi=e):Mi=t):Mi=ji?cf(e.stateNode.nextSibling):null;return!0}function Bi(){Mi=ji=null,V=!1}function Vi(){var e=Ni;return e!==null&&(Xl===null?Xl=e:Xl.push.apply(Xl,e),Ni=null),e}function Hi(e){Ni===null?Ni=[e]:Ni.push(e)}var Ui=ce(null),Wi=null,Gi=null;function Ki(e,t,n){P(Ui,t._currentValue),t._currentValue=n}function qi(e){e._currentValue=Ui.current,N(Ui)}function Ji(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Yi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Ji(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ji(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Xi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;wr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===fe.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&Yi(t,e,n,r),t.flags|=262144}function Zi(e){for(e=e.firstContext;e!==null;){if(!wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function H(e){Wi=e,Gi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function U(e){return $i(Wi,e)}function Qi(e,t){return Wi===null&&H(e),$i(e,t)}function $i(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Gi===null){if(e===null)throw Error(o(308));Gi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Gi=Gi.next=t;return n}var ea=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ta=n.unstable_scheduleCallback,na=n.unstable_NormalPriority,ra={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ia(){return{controller:new ea,data:new Map,refCount:0}}function aa(e){e.refCount--,e.refCount===0&&ta(na,function(){e.controller.abort()})}var oa=null,sa=0,ca=0,la=null;function ua(e,t){if(oa===null){var n=oa=[];sa=0,ca=ud(),la={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return sa++,t.then(da,da),t}function da(){if(--sa===0&&oa!==null){la!==null&&(la.status=`fulfilled`);var e=oa;oa=null,ca=0,la=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var pa=A.S;A.S=function(e,t){$l=ke(),typeof t==`object`&&t&&typeof t.then==`function`&&ua(e,t),pa!==null&&pa(e,t)};var ma=ce(null);function ha(){var e=ma.current;return e===null?Ll.pooledCache:e}function ga(e,t){t===null?P(ma,ma.current):P(ma,t.pool)}function _a(){var e=ha();return e===null?null:{parent:ra._currentValue,pool:e}}var va=Error(o(460)),ya=Error(o(474)),ba=Error(o(542)),xa={then:function(){}};function Sa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ca(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(rn,rn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e;default:if(typeof t.status==`string`)t.then(rn,rn);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e}throw Ta=t,va}}function wa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ta=e,va):e}}var Ta=null;function Ea(){if(Ta===null)throw Error(o(459));var e=Ta;return Ta=null,e}function Da(e){if(e===va||e===ba)throw Error(o(483))}var Oa=null,ka=0;function Aa(e){var t=ka;return ka+=1,Oa===null&&(Oa=[]),Ca(Oa,e,t)}function ja(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ma(e,t){throw t.$$typeof===g?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Na(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ci(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=fi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&wa(a)===t.type)?(t=i(t,n.props),ja(t,n),t.return=e,t):(t=ui(n.type,n.key,n.props,null,e.mode,r),ja(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=mi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=di(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=fi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ui(t.type,t.key,t.props,null,e.mode,n),ja(n,t),n.return=e,n;case v:return t=mi(t,e.mode,n),t.return=e,t;case O:return t=wa(t),f(e,t,n)}if(ae(t)||ne(t))return t=di(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Aa(t),n);if(t.$$typeof===C)return f(e,Qi(e,t),n);Ma(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=wa(n),p(e,t,n,r)}if(ae(n)||ne(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Aa(n),r);if(n.$$typeof===C)return p(e,t,Qi(e,n),r);Ma(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=wa(r),m(e,t,n,r,i)}if(ae(r)||ne(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Aa(r),i);if(r.$$typeof===C)return m(e,t,n,Qi(t,r),i);Ma(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),V&&Ei(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return V&&Ei(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),V&&Ei(i,h),l}function g(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),V&&Ei(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return V&&Ei(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),V&&Ei(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&wa(l)===r.type){n(e,r.sibling),c=i(r,a.props),ja(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=di(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ui(a.type,a.key,a.props,null,e.mode,c),ja(c,a),c.return=e,e=c)}return s(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(a,e.mode,c),c.return=e,e=c}return s(e);case O:return a=wa(a),b(e,r,a,c)}if(ae(a))return h(e,r,a,c);if(ne(a)){if(l=ne(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Aa(a),c);if(a.$$typeof===C)return b(e,r,Qi(e,a),c);Ma(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=fi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=b(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,J&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Va(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}function Ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ua=!1;function Wa(){if(Ua){var e=la;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;Ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(X&f)===f:(r&f)===f){f!==0&&f===ca&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ia=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Wl|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ka(n[e],t)}var Ja=ce(null),Ya=ce(0);function Xa(e,t){e=Hl,P(Ya,e),P(Ja,t),Hl=e|t.baseLanes}function Za(){P(Ya,Hl),P(Ja,Ja.current)}function Qa(){Hl=Ya.current,N(Ja),N(Ya)}var $a=ce(null),eo=null;function to(e){var t=e.alternate;P(oo,oo.current&1),P($a,e),eo===null&&(t===null||Ja.current!==null||t.memoizedState!==null)&&(eo=e)}function no(e){P(oo,oo.current),P($a,e),eo===null&&(eo=e)}function ro(e){e.tag===22?(P(oo,oo.current),P($a,e),eo===null&&(eo=e)):io(e)}function io(){P(oo,oo.current),P($a,$a.current)}function ao(e){N($a),eo===e&&(eo=null),N(oo)}var oo=ce(0);function so(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var co=0,W=null,G=null,lo=null,uo=!1,fo=!1,po=!1,mo=0,ho=0,go=null,_o=0;function vo(){throw Error(o(321))}function yo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wr(e[n],t[n]))return!1;return!0}function bo(e,t,n,r,i,a){return co=a,W=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Fs:Is,po=!1,a=n(r,i),po=!1,fo&&(a=So(t,n,r,i)),xo(e),a}function xo(e){A.H=Ps;var t=G!==null&&G.next!==null;if(co=0,lo=G=W=null,uo=!1,ho=0,go=null,t)throw Error(o(300));e===null||$s||(e=e.dependencies,e!==null&&Zi(e)&&($s=!0))}function So(e,t,n,r){W=e;var i=0;do{if(fo&&(go=null),ho=0,fo=!1,25<=i)throw Error(o(301));if(i+=1,lo=G=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}A.H=Ls,a=t(n,r)}while(fo);return a}function Co(){var e=A.H,t=e.useState()[0];return t=typeof t.then==`function`?Ao(t):t,e=e.useState()[0],(G===null?null:G.memoizedState)!==e&&(W.flags|=1024),t}function wo(){var e=mo!==0;return mo=0,e}function To(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Eo(e){if(uo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}uo=!1}co=0,lo=G=W=null,fo=!1,ho=mo=0,go=null}function Do(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lo===null?W.memoizedState=lo=e:lo=lo.next=e,lo}function Oo(){if(G===null){var e=W.alternate;e=e===null?null:e.memoizedState}else e=G.next;var t=lo===null?W.memoizedState:lo.next;if(t!==null)lo=t,G=e;else{if(e===null)throw W.alternate===null?Error(o(467)):Error(o(310));G=e,e={memoizedState:G.memoizedState,baseState:G.baseState,baseQueue:G.baseQueue,queue:G.queue,next:null},lo===null?W.memoizedState=lo=e:lo=lo.next=e}return lo}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ao(e){var t=ho;return ho+=1,go===null&&(go=[]),e=Ca(go,e,t),t=W,(lo===null?t.memoizedState:lo.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Fs:Is),e}function jo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Ao(e);if(e.$$typeof===C)return U(e)}throw Error(o(438,String(e)))}function Mo(e){var t=null,n=W.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=W.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ko(),W.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){return Fo(Oo(),G,e)}function Fo(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(co&f)===f:(X&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ca&&(d=!0);else if((co&p)===p){u=u.next,p===ca&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,W.lanes|=p,Wl|=p;f=u.action,po&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,W.lanes|=f,Wl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!wr(a,e.memoizedState)&&($s=!0,d&&(n=la,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Io(e){var t=Oo(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);wr(a,t.memoizedState)||($s=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Lo(e,t,n){var r=W,i=Oo(),a=V;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!wr((G||i).memoizedState,n);if(s&&(i.memoizedState=n,$s=!0),i=i.queue,os(Bo.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||lo!==null&&lo.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},zo.bind(null,r,i,n,t),null),Ll===null)throw Error(o(349));a||co&127||Ro(r,t,n)}return n}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=W.updateQueue,t===null?(t=ko(),W.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function Ho(e){var t=ti(e,2);t!==null&&pu(t,e,2)}function Uo(e){var t=Do();if(typeof e==`function`){var n=e;if(e=n(),po){Be(!0);try{n()}finally{Be(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t}function Wo(e,t,n,r){return e.baseState=n,Fo(e,G,typeof r==`function`?r:No)}function K(e,t,n,r,i){if(js(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};A.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Go(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=A.T,o={};A.T=o;try{var s=n(i,r),c=A.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),A.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){qo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){q(e,t,n)},function(n){return qo(e,t,n)}):q(e,t,n)}function q(e,t,n){t.status=`fulfilled`,t.value=n,Jo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(e,t){if(V){var n=Ll.formState;if(n!==null){a:{var r=W;if(V){if(Mi){b:{for(var i=Mi,a=Pi;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Mi=cf(i.nextSibling),r=i.data===`F!`;break a}}Ii(r)}r=!1}r&&(t=n[0])}}return n=Do(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:t},n.queue=r,n=Os.bind(null,W,r),r.dispatch=n,r=Uo(!1),a=As.bind(null,W,!1,r.queue),r=Do(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=K.bind(null,W,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zo(e){return Qo(Oo(),G,e)}function Qo(e,t,n){if(t=Fo(e,t,Yo)[0],e=Po(No)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Ao(t)}catch(e){throw e===va?ba:e}else r=t;t=Oo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(W.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=Oo(),n=G;if(n!==null)return Qo(t,n,e);Oo(),t=t.memoizedState,n=Oo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=W.updateQueue,t===null&&(t=ko(),W.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return Oo().memoizedState}function rs(e,t,n,r){var i=Do();W.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=Oo();r=r===void 0?null:r;var a=i.memoizedState.inst;G!==null&&r!==null&&yo(r,G.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(W.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function os(e,t){is(2048,8,e,t)}function ss(e){W.flags|=4;var t=W.updateQueue;if(t===null)t=ko(),W.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cs(e){var t=Oo().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(J&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&yo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&yo(t,r[1]))return r[0];if(r=e(),po){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||co&1073741824&&!(X&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),W.lanes|=e,Wl|=e,n)}function _s(e,t,n,r){return wr(n,t)?n:Ja.current===null?!(co&42)||co&1073741824&&!(X&261930)?($s=!0,e.memoizedState=n):(e=fu(),W.lanes|=e,Wl|=e,t):(e=gs(e,n,r),wr(e,t)||($s=!0),e)}function vs(e,t,n,r,i){var a=j.p;j.p=a!==0&&8>a?a:8;var o=A.T,s={};A.T=s,As(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,fa(c,r),du(e)):ks(e,t,r,du(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=xs(e).queue;vs(e,i,t,M,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:M,baseState:M,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:M},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},du())}function Cs(){return U(Qf)}function ws(){return Oo().memoizedState}function Ts(){return Oo().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=za(n);var r=Ba(t,e,n);r!==null&&(pu(r,t,n),Va(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=ei(e,t,n,r),n!==null&&(pu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,du())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,wr(s,o))return $r(e,t,i,0),Ll===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return pu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(o(479))}else t=ei(e,n,r,2),t!==null&&pu(t,e,2)}function js(e){var t=e.alternate;return e===W||t!==null&&t===W}function Ms(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}var Ps={readContext:U,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Ps.useEffectEvent=vo;var Fs={readContext:U,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:U,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){Be(!0);try{n(t)}finally{Be(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,W,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=Os.bind(null,W,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=vs.bind(null,W,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=W,i=Do();if(V){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ll===null)throw Error(o(349));X&127||Ro(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,as(Bo.bind(null,r,a,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},zo.bind(null,r,a,n,t),null),n},useId:function(){var e=Do(),t=Ll.identifierPrefix;if(V){var n=Ti,r=wi;n=(r&~(1<<32-Ve(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=_o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Cs,useFormState:Xo,useActionState:Xo,useOptimistic:function(e){var t=Do();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=As.bind(null,W,!0,n),n.dispatch=t,[e,t]},useMemoCache:Mo,useCacheRefresh:function(){return Do().memoizedState=Es.bind(null,W)},useEffectEvent:function(e){var t=Do(),n={impl:e};return t.memoizedState=n,function(){if(J&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Is={readContext:U,use:jo,useCallback:ms,useContext:U,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Po,useRef:ns,useState:function(){return Po(No)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(Oo(),G.memoizedState,e,t)},useTransition:function(){var e=Po(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:ws,useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Wo(Oo(),G,e,t)},useMemoCache:Mo,useCacheRefresh:Ts};Is.useEffectEvent=cs;var Ls={readContext:U,use:jo,useCallback:ms,useContext:U,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Io,useRef:ns,useState:function(){return Io(No)},useDebugValue:ps,useDeferredValue:function(e,t){var n=Oo();return G===null?gs(n,e,t):_s(n,G.memoizedState,e,t)},useTransition:function(){var e=Io(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:ws,useHostTransitionStatus:Cs,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=Oo();return G===null?(n.baseState=e,[e,n.queue.dispatch]):Wo(n,G,e,t)},useMemoCache:Mo,useCacheRefresh:Ts};Ls.useEffectEvent=cs;function Rs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var zs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=za(r);i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(pu(t,e,r),Va(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=za(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(pu(t,e,r),Va(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=za(n);r.tag=2,t!=null&&(r.callback=t),t=Ba(e,r,n),t!==null&&(pu(t,e,n),Va(t,e,n))}};function Bs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Tr(n,r)||!Tr(i,a):!0}function Vs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&zs.enqueueReplaceState(t,t.state,null)}function Hs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Us(e){Yr(e)}function Ws(e){console.error(e)}function Gs(e){Yr(e)}function Ks(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){return n=za(n),n.tag=3,n.payload={element:null},n.callback=function(){Ks(e,t)},n}function Ys(e){return e=za(e),e.tag=3,e}function Xs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){qs(t,n,r),typeof i!=`function`&&(nu===null?nu=new Set([this]):nu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Xi(t,n,i,!0),n=$a.current,n!==null){switch(n.tag){case 31:case 13:return eo===null?Tu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,i)),!1;case 22:return n.flags|=65536,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,i)),!1}throw Error(o(435,n.tag))}return Wu(e,r,i),Tu(),!1}if(V)return t=$a.current,t===null?(r!==Fi&&(t=Error(o(423),{cause:r}),Hi(gi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=gi(r,n),i=Js(e.stateNode,r,i),Ha(e,i),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Fi&&(e=Error(o(422),{cause:r}),Hi(gi(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=gi(a,n),Yl===null?Yl=[a]:Yl.push(a),Ul!==4&&(Ul=2),t===null)return!0;r=gi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Js(n.stateNode,r,e),Ha(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(nu===null||!nu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Ys(i),Xs(i,e,n,r),Ha(n,i),!1}n=n.return}while(n!==null);return!1}var Qs=Error(o(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?Fa(t,null,n,r):Pa(t,e.child,n,r)}function tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return H(t),r=bo(e,t,n,o,a,i),s=wo(),e!==null&&!$s?(To(e,t,i),Tc(e,t,i)):(V&&s&&Oi(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=ui(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ci(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref){if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}}return dc(e,t,n,r,i)}function ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ga(t,a===null?null:a.cachePool),a===null?Za():Xa(t,a),ro(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ga(t,null),Za(),io(t)):(ga(t,a.cachePool),Xa(t,a),io(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=ha();return a=a===null?null:{parent:ra._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ga(t,null),Za(),ro(t),e!==null&&Xi(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return Pa(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,ao(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(V){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if(no(t),(e=Mi)?(e=rf(e,Pi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,ji=t,Mi=null)):e=null,e===null)throw Ii(t);return t.lanes=536870912,null}return sc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(no(t),i){if(t.flags&256)t.flags&=-257,t=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558))}else if($s||Xi(e,t,n,!1),i=(n&e.childLanes)!==0,$s||i){if(r=Ll,r!==null&&(s=it(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,ti(e,s),pu(r,e,s),Qs;Tu(),t=cc(e,t,n)}else e=a.treeContext,Mi=cf(s.nextSibling),ji=t,V=!0,Ni=null,Pi=!1,e!==null&&Ai(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ci(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,r,i){return H(t),n=bo(e,t,n,r,void 0,i),r=wo(),e!==null&&!$s?(To(e,t,i),Tc(e,t,i)):(V&&r&&Oi(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return H(t),t.updateQueue=null,n=So(t,r,n,i),xo(e),r=wo(),e!==null&&!$s?(To(e,t,a),Tc(e,t,a)):(V&&r&&Oi(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(H(t),t.stateNode===null){var a=ii,o=n.contextType;typeof o==`object`&&o&&(a=U(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},La(t),o=n.contextType,a.context=typeof o==`object`&&o?U(o):ii,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&zs.enqueueReplaceState(a,a.state,null),Ga(t,r,a,i),Wa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Hs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ii,typeof u==`object`&&u&&(o=U(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Vs(t,a,r,o),Ia=!1;var f=t.memoizedState;a.state=f,Ga(t,r,a,i),Wa(),l=t.memoizedState,s||f!==l||Ia?(typeof d==`function`&&(Rs(t,n,d,r),l=t.memoizedState),(c=Ia||Bs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ra(e,t),o=t.memoizedProps,u=Hs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ii,typeof l==`object`&&l&&(c=U(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Vs(t,a,r,c),Ia=!1,f=t.memoizedState,a.state=f,Ga(t,r,a,i),Wa();var p=t.memoizedState;o!==d||f!==p||Ia||e!==null&&e.dependencies!==null&&Zi(e.dependencies)?(typeof s==`function`&&(Rs(t,n,s,r),p=t.memoizedState),(u=Ia||Bs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Zi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,uc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Pa(t,e.child,null,i),t.child=Pa(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Bi(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:_a()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ql),e}function vc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:!!(oo.current&2)),s&&(i=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(V){if(i?to(t):io(t),(e=Mi)?(e=rf(e,Pi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:Ti},retryLane:536870912,hydrationErrors:null},n=pi(e),n.return=t,t.child=n,ji=t,Mi=null)):e=null,e===null)throw Ii(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(io(t),i=t.mode,c=bc({mode:`hidden`,children:c},i),r=di(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(null,r)):(to(t),yc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(to(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState===null?(io(t),c=r.fallback,i=t.mode,r=bc({mode:`visible`,children:r.children},i),c=di(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Pa(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,t=ac(null,r)):(io(t),t.child=e.child,t.flags|=128,t=null);else if(to(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(o(419)),r.stack=``,r.digest=s,Hi({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||Xi(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Ll,s!==null&&(r=it(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ti(e,r),pu(s,e,r),Qs;af(c)||Tu(),t=xc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Mi=cf(c.nextSibling),ji=t,V=!0,Ni=null,Pi=!1,e!==null&&Ai(t,e),t=yc(t,r.children),t.flags|=4096);return t}return i?(io(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ci(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=di(c,i,n,null),c.flags|=2):c=ci(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(i=c.cachePool,i===null?i=_a():(l=ra._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(e.child,r)):(to(t),n=e.child,e=n.sibling,n=ci(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=oi(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return Pa(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ji(e.return,t,n)}function Cc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function wc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=oo.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,P(oo,o),ec(e,t,r,n),r=V?bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&so(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Cc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&so(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Xi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=ci(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ci(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Zi(e)))}function Dc(e,t,n){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),Ki(t,ra,e.memoizedState.cache),Bi();break;case 27:case 5:he(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:Ki(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,no(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(to(t),e=Tc(e,t,n),e===null?null:e.sibling):vc(e,t,n):(to(t),t.flags|=128,null);to(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Xi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(oo,oo.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Ki(t,ra,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}}else $s=!1,V&&t.flags&1048576&&Di(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=wa(t.elementType),t.type=e,typeof e==`function`)si(e)?(r=Hs(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=tc(null,t,e,r,n);break a}if(i===D){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=ie(e)||e,Error(o(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Hs(r,t.pendingProps),pc(e,t,r,i,n);case 3:a:{if(pe(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Ra(e,t),Ga(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ki(t,ra,r),r!==a.cache&&Yi(t,[ra],n,!0),Wa(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=mc(e,t,r,n);break a}if(r!==i){i=gi(Error(o(424)),t),Hi(i),t=mc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Mi=cf(e.firstChild),ji=t,V=!0,Ni=null,Pi=!0,n=Fa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Bi(),r===i){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:V||(n=t.type,e=t.pendingProps,r=Bd(de.current).createElement(n),r[ut]=t,r[dt]=e,Pd(r,n,e),Ct(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return he(t),e===null&&V&&(r=t.stateNode=ff(t.type,t.pendingProps,de.current),ji=t,Pi=!0,i=Mi,Zd(t.type)?(lf=i,Mi=cf(r.firstChild)):Mi=i),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&V&&((i=r=Mi)&&(r=tf(r,t.type,t.pendingProps,Pi),r===null?i=!1:(t.stateNode=r,ji=t,Mi=cf(r.firstChild),Pi=!1,i=!0)),i||Ii(t)),he(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,Ud(i,a)?r=null:s!==null&&Ud(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=bo(e,t,Co,null,null,n),Qf._currentValue=i),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&V&&((e=n=Mi)&&(n=nf(n,t.pendingProps,Pi),n===null?e=!1:(t.stateNode=n,ji=t,Mi=null,e=!0)),e||Ii(t)),null;case 13:return vc(e,t,n);case 4:return pe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pa(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ki(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,H(t),i=U(i),r=r(i),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return H(t),r=U(ra),e===null?(i=ha(),i===null&&(i=Ll,a=ia(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},La(t),Ki(t,ra,i)):((e.lanes&n)!==0&&(Ra(e,t),Ga(t,null,null,n),Wa()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Ki(t,ra,r),r!==i.cache&&Yi(t,[ra],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Ki(t,ra,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function kc(e){e.flags|=4}function Ac(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Su())e.flags|=8192;else throw Ta=xa,ya}}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(Su())e.flags|=8192;else throw Ta=xa,ya}}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Qe(),e.lanes|=t,Jl|=t)}function Nc(e,t){if(!V)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Pc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fc(e,t,n){var r=t.pendingProps;switch(ki(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),qi(ra),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(zi(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Vi())),Pc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(kc(t),a===null?(Pc(t),Ac(t,i,null,r,n)):(Pc(t),jc(t,a))):a?a===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,a)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,i,e,r,n)),null;case 27:if(ge(t),n=de.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Pc(t),null}e=le.current,zi(t)?Li(t,e):(e=ff(i,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(ge(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Pc(t),null}if(a=le.current,zi(t))Li(t,a);else{var s=Bd(de.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[ut]=t,a[dt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=de.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ji,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ii(t,!0)}else e=Bd(e).createTextNode(r),e[ut]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[ut]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(o(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[ut]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),i=!1}else i=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return me(),e===null&&xd(t.stateNode.containerInfo),Pc(t),null;case 10:return qi(t.type),Pc(t),null;case 19:if(N(oo),r=t.memoizedState,r===null)return Pc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Nc(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=so(e),a!==null){for(t.flags|=128,Nc(r,!1),e=a.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return P(oo,oo.current&1|2),V&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>eu&&(t.flags|=128,i=!0,Nc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=so(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!V)return Pc(t),null}else 2*ke()-r.renderingStartTime>eu&&n!==536870912&&(t.flags|=128,i=!0,Nc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=oo.current,P(oo,i?n&1|2:n&1),V&&Ei(t,r.treeForkCount),e);case 22:case 23:return ao(t),Qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&N(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(ra),Pc(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Ic(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(ra),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(o(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(oo),null;case 4:return me(),null;case 10:return qi(t.type),null;case 22:case 23:return ao(t),Qa(),e!==null&&N(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(ra),null;case 25:return null;default:return null}}function Lc(e,t){switch(ki(t),t.tag){case 3:qi(ra),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:N(oo);break;case 10:qi(t.type);break;case 22:case 23:ao(t),Qa(),e!==null&&N(ma);break;case 24:qi(ra)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){Uu(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[dt]=t}catch(t){Uu(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=rn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ut]=e,t[dt]=n}catch(t){Uu(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Rd=sp,e=kr(e),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==a||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===a&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Hs(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Rc(5,n);break;case 1:if(vl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=Hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(vl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{qa(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?bl(e,n,!!(n.subtreeFlags&8772)):vl(e,n),Zc=i,Qc=a}break;case 30:break;default:vl(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(ze&&typeof ze.onCommitFiberUnmount==`function`)try{ze.onCommitFiberUnmount(Re,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=al,i=ol;Zd(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),pf(n.stateNode),al=r,ol=i;break;case 5:Qc||Uc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null){if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}}break;case 18:al!==null&&(ol?(e=al,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),sl(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(o(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(o(160));cl(a,s,i),al=null,ol=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=ml;if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[_t]||a[ut]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Pd(a,r,n),a[ut]=e,Ct(a),r=a;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;case`meta`:if(s=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;default:throw Error(o(468,r))}a[ut]=e,Ct(a),r=a}e.stateNode=r}else Hf(i,e.type,e.stateNode)}else e.stateNode=If(i,r,e.memoizedProps)}else a===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){i=e.stateNode;try{Yt(i,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Gc(e,i,n===null?i:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,i=ml,ml=gf(t.containerInfo),pl(t,e),ml=i,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=gf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ql=ke()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||i,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Zc||Qc||yl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)s=a.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var i=n.stateNode;Yc(e,qc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Yt(a,``),n.flags&=-33),Yc(e,qc(e),a);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(o(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),yl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),yl(t);break;case 27:pf(t.stateNode);case 26:case 5:Uc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:bl(i,a,n),Rc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ka(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Hc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&aa(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e)));break;case 12:if(i&2048){Cl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Uu(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Tl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Gf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=ml;ml=gf(e.stateNode.containerInfo),Ol(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&zc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function Pl(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:aa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Fl={getCacheForType:function(e){var t=U(ra),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return U(ra).controller.signal}},Il=typeof WeakMap==`function`?WeakMap:Map,J=0,Ll=null,Y=null,X=0,Z=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=null,Xl=null,Zl=!1,Ql=0,$l=0,eu=1/0,tu=null,nu=null,ru=0,iu=null,au=null,ou=0,su=0,cu=null,lu=null,Q=0,uu=null;function du(){return J&2&&X!==0?X&-X:A.T===null?st():ud()}function fu(){if(ql===0){if(!(X&536870912)||V){var e=Ke;Ke<<=1,!(Ke&3932160)&&(Ke=262144),ql=e}else ql=536870912}return e=$a.current,e!==null&&(e.flags|=32),ql}function pu(e,t,n){(e===Ll&&(Z===2||Z===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,X,ql,!1)),et(e,n),(!(J&2)||e!==Ll)&&(e===Ll&&(!(J&2)&&(Gl|=n),Ul===4&&_u(e,X,ql,!1)),nd(e))}function mu(e,t,n){if(J&6)throw Error(o(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Xe(e,t),i=r?Ou(e,t):Eu(e,t,!0),a=r;do{if(i===0){Bl&&!r&&_u(e,t,0,!1);break}if(n=e.current.alternate,a&&!gu(n)){i=Eu(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=Yl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,s).flags|=256),s=Eu(c,s,!1),s!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=a,Gl|=a,i=4;break a}a=Xl,Xl=i,a!==null&&(Xl===null?Xl=a:Xl.push.apply(Xl,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){bu(e,0),_u(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:_u(r,t,ql,!zl);break a;case 2:Xl=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=Ql+300-ke(),10<i)){if(_u(r,t,ql,!zl),Ye(r,0,!0)!==0)break a;ou=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,a,`Throttled`,-0,0),i);break a}hu(r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,a,null,-0,0)}break}while(1);nd(e)}function hu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:rn},kl(t,a,d);var m=(a&62914560)===a?Ql-ke():(a&4194048)===a?$l-ke():0;if(m=qf(d,m),m!==null){ou=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!wr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _u(e,t,n,r){t&=~Kl,t&=~Gl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ve(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&nt(e,n,t)}function vu(){return J&6?!0:(rd(0,!1),!1)}function yu(){if(Y!==null){if(Z===0)var e=Y.return;else e=Y,Gi=Wi=null,Eo(e),Oa=null,ka=0,e=Y;for(;e!==null;)Lc(e.alternate,e),e=e.return;Y=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ou=0,yu(),Ll=e,Y=n=ci(e.current,null),X=t,Z=0,Rl=null,zl=!1,Bl=Xe(e,t),Vl=!1,Jl=ql=Kl=Gl=Wl=Ul=0,Xl=Yl=null,Zl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ve(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,Qr(),n}function xu(e,t){W=null,A.H=Ps,t===va||t===ba?(t=Ea(),Z=3):t===ya?(t=Ea(),Z=4):Z=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,Y===null&&(Ul=1,Ks(e,gi(t,e.current)))}function Su(){var e=$a.current;return e===null?!0:(X&4194048)===X?eo===null:(X&62914560)===X||X&536870912?e===eo:!1}function Cu(){var e=A.H;return A.H=Ps,e===null?Ps:e}function wu(){var e=A.A;return A.A=Fl,e}function Tu(){Ul=4,zl||(X&4194048)!==X&&$a.current!==null||(Bl=!0),!(Wl&134217727)&&!(Gl&134217727)||Ll===null||_u(Ll,X,ql,!1)}function Eu(e,t,n){var r=J;J|=2;var i=Cu(),a=wu();(Ll!==e||X!==t)&&(tu=null,bu(e,t)),t=!1;var o=Ul;a:do try{if(Z!==0&&Y!==null){var s=Y,c=Rl;switch(Z){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:$a.current===null&&(t=!0);var l=Z;if(Z=0,Rl=null,Mu(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Z,Z=0,Rl=null,Mu(e,s,c,l)}}Du(),o=Ul;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Gi=Wi=null,J=r,A.H=i,A.A=a,Y===null&&(Ll=null,X=0,Qr()),o}function Du(){for(;Y!==null;)Au(Y)}function Ou(e,t){var n=J;J|=2;var r=Cu(),i=wu();Ll!==e||X!==t?(tu=null,eu=ke()+500,bu(e,t)):Bl=Xe(e,t);a:do try{if(Z!==0&&Y!==null){t=Y;var a=Rl;b:switch(Z){case 1:Z=0,Rl=null,Mu(e,t,a,1);break;case 2:case 9:if(Sa(a)){Z=0,Rl=null,ju(t);break}t=function(){Z!==2&&Z!==9||Ll!==e||(Z=7),nd(e)},a.then(t,t);break a;case 3:Z=7;break a;case 4:Z=5;break a;case 7:Sa(a)?(Z=0,Rl=null,ju(t)):(Z=0,Rl=null,Mu(e,t,a,7));break;case 5:var s=null;switch(Y.tag){case 26:s=Y.memoizedState;case 5:case 27:var c=Y;if(s?Wf(s):c.stateNode.complete){Z=0,Rl=null;var l=c.sibling;if(l!==null)Y=l;else{var u=c.return;u===null?Y=null:(Y=u,Nu(u))}break b}}Z=0,Rl=null,Mu(e,t,a,5);break;case 6:Z=0,Rl=null,Mu(e,t,a,6);break;case 8:yu(),Ul=6;break a;default:throw Error(o(462))}}ku();break}catch(t){xu(e,t)}while(1);return Gi=Wi=null,A.H=r,A.A=i,J=n,Y===null?(Ll=null,X=0,Qr(),Ul):0}function ku(){for(;Y!==null&&!De();)Au(Y)}function Au(e){var t=Oc(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Y=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,X);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,X);break;case 5:Eo(t);default:Lc(n,t),t=Y=li(t,Hl),t=Oc(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Y=t}function Mu(e,t,n,r){Gi=Wi=null,Eo(t),Oa=null,ka=0;var i=t.return;try{if(Zs(e,i,t,n,X)){Ul=1,Ks(e,gi(n,e.current)),Y=null;return}}catch(t){if(i!==null)throw Y=i,t;Ul=1,Ks(e,gi(n,e.current)),Y=null;return}t.flags&32768?(V||r===1?e=!0:Bl||X&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=$a.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,zl);return}e=t.return;var n=Fc(t.alternate,t,Hl);if(n!==null){Y=n;return}if(t=t.sibling,t!==null){Y=t;return}Y=t=e}while(t!==null);Ul===0&&(Ul=5)}function Pu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,Y=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Y=e;return}Y=e=n}while(e!==null);Ul=6,Y=null}function Fu(e,t,n,r,i,a,s,c,l){e.cancelPendingCommit=null;do Bu();while(ru!==0);if(J&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(a=t.lanes|t.childLanes,a|=Zr,tt(e,n,a,s,c,l),e===Ll&&(Y=Ll=null,X=0),au=t,iu=e,ou=n,su=a,cu=i,lu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(Ne,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=A.T,A.T=null,i=j.p,j.p=2,s=J,J|=4;try{nl(e,t,n)}finally{J=s,j.p=i,A.T=r}}ru=1,Iu(),Lu(),Ru()}}function Iu(){if(ru===1){ru=0;var e=iu,t=au,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=J;J|=4;try{hl(t,e);var a=zd,o=kr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Or(s.ownerDocument.documentElement,s)){if(c!==null&&Ar(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Dr(s,h),v=Dr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{J=i,j.p=r,A.T=n}}e.current=t,ru=2}}function Lu(){if(ru===2){ru=0;var e=iu,t=au,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=J;J|=4;try{rl(e,t.alternate,t)}finally{J=i,j.p=r,A.T=n}}ru=3}}function Ru(){if(ru===4||ru===3){ru=0,Oe();var e=iu,t=au,n=ou,r=lu;t.subtreeFlags&10256||t.flags&10256?ru=5:(ru=0,au=iu=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(nu=null),ot(n),t=t.stateNode,ze&&typeof ze.onCommitFiberRoot==`function`)try{ze.onCommitFiberRoot(Re,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=A.T,i=j.p,j.p=2,A.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{A.T=t,j.p=i}}ou&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?Q++:(Q=0,uu=e):Q=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,aa(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(ru!==5)return!1;var e=iu,t=su;su=0;var n=ot(ou),r=A.T,i=j.p;try{j.p=32>n?32:n,A.T=null,n=cu,cu=null;var a=iu,s=ou;if(ru=0,au=iu=null,ou=0,J&6)throw Error(o(331));var c=J;if(J|=4,Ml(a.current),wl(a,a.current,s,n),J=c,rd(0,!1),ze&&typeof ze.onPostCommitFiberRoot==`function`)try{ze.onPostCommitFiberRoot(Re,a)}catch{}return!0}finally{j.p=i,A.T=r,zu(e,t)}}function Hu(e,t,n){t=gi(n,t),t=Js(e.stateNode,t,2),e=Ba(e,t,2),e!==null&&(et(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(nu===null||!nu.has(r))){e=gi(n,e),n=Ys(2),r=Ba(t,n,2),r!==null&&(Xs(n,r,t,e),et(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(X&n)===n&&(Ul===4||Ul===3&&(X&62914560)===X&&300>ke()-Ql?!(J&2)&&bu(e,0):Kl|=n,Jl===X&&(Jl=0)),nd(e)}function Ku(e,t){t===0&&(t=Qe()),e=ti(e,t),e!==null&&(et(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return Te(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ve(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=X,a=Ye(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Xe(r,a)||(n=!0,cd(r,a))}r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=ke(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}ru!==0&&ru!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ve(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ze(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=X,n=Ye(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Z===2||Z===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ee(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Xe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ee(r),ot(n)){case 2:case 8:n=Me;break;case 32:n=Ne;break;case 268435456:n=Fe;break;default:n=Ne}return r=sd.bind(null,e),n=Te(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ee(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(ru!==0&&ru!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=X;return r=Ye(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,ke()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){J&6?Te(je,id):ad()})}function ud(){if(td===0){var e=ca;e===0&&(e=Ge,Ge<<=1,!(Ge&261888)&&(Ge=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:nn(``+e)}function fd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[dt]||null).action),o=r.submitter;o&&(t=(t=o[dt]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Tn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<qr.length;md++){var hd=qr[md];Jr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Jr(Vr,`onAnimationEnd`),Jr(R,`onAnimationIteration`),Jr(Hr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Ur,`onTransitionRun`),Jr(z,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),Dt(`onMouseEnter`,[`mouseout`,`mouseover`]),Dt(`onMouseLeave`,[`mouseout`,`mouseover`]),Dt(`onPointerEnter`,[`pointerout`,`pointerover`]),Dt(`onPointerLeave`,[`pointerout`,`pointerover`]),Et(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Et(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Et(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Et(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Et(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Et(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[pt];n===void 0&&(n=t[pt]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,wt.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!mn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=yt(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}dn(function(){var r=a,i=on(n),o=[];a:{var s=Kr.get(e);if(s!==void 0){var c=Tn,u=e;switch(e){case`keypress`:if(bn(n)===0)break a;case`keydown`:case`keyup`:c=Vn;break;case`focusin`:u=`focus`,c=Pn;break;case`focusout`:u=`blur`,c=Pn;break;case`beforeblur`:case`afterblur`:c=Pn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Mn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Nn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Un;break;case Vr:case R:case Hr:c=Fn;break;case Gr:c=Wn;break;case`scroll`:case`scrollend`:c=Dn;break;case`wheel`:c=Gn;break;case`copy`:case`cut`:case`paste`:c=In;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Hn;break;case`toggle`:case`beforetoggle`:c=Kn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=fn(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==an&&(u=n.relatedTarget||n.fromElement)&&(yt(u)||u[ft]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?yt(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=Mn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Hn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:xt(c),h=u==null?s:xt(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,yt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Ed,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&Dd(o,s,c,d,!1),u!==null&&f!==null&&Dd(o,f,u,d,!0)}}a:{if(s=r?xt(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=fr;else if(or(s)){if(pr)v=Sr;else{v=br;var y=yr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&$t(r.elementType)&&(v=fr):v=xr;if(v&&=v(e,r)){sr(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Gt(s,`number`,s.value)}switch(y=r?xt(r):window,e){case`focusin`:(or(y)||y.contentEditable===`true`)&&(Mr=y,Nr=r,Pr=null);break;case`focusout`:Pr=Nr=Mr=null;break;case`mousedown`:Fr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Fr=!1,Ir(o,n,i);break;case`selectionchange`:if(jr)break;case`keydown`:case`keyup`:Ir(o,n,i)}var b;if(Jn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else nr?er(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Zn&&n.locale!==`ko`&&(nr||x!==`onCompositionStart`?x===`onCompositionEnd`&&nr&&(b=yn()):(gn=i,_n=`value`in gn?gn.value:gn.textContent,nr=!0)),y=Td(r,x),0<y.length&&(x=new Ln(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=tr(n),b!==null&&(x.data=b)))),(b=Xn?rr(e,n):ir(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new Ln(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),pd(o,e,r,n,i)}vd(o,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=fn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=fn(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=fn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=fn(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
|
|
9
|
+
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Yt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Yt(e,``+r);break;case`className`:Nt(e,`class`,r);break;case`tabIndex`:Nt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Nt(e,n,r);break;case`style`:Qt(e,r,a);break;case`data`:if(t!==`object`){Nt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=nn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=nn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=rn);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=nn(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Mt(e,`popover`,r);break;case`xlinkActuate`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Pt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Pt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Pt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Pt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Mt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=en.get(n)||n,Mt(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:Qt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Yt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Yt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=rn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Tt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[dt]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Mt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Md(e,t,a,s,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:Md(e,t,r,d,n,null)}}Wt(e,a,c,l,u,s,i,!1);return;case`select`:for(i in $(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&Kt(e,!!r,n,!0):Kt(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:Md(e,t,s,c,n,null)}Jt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Md(e,t,u,r,n,null)}return;default:if($t(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Ut(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Md(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:s=a;default:a!==l&&Md(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Kt(e,!!n,n?[]:``,!1):Kt(e,!!n,t,!0)):Kt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&Md(e,t,s,i,r,a)}qt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if($t(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[_t]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),vt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[_t])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=j.d;j.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=bt(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Ht(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ht(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ht(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ht(n.imageSizes)+`"]`)):i+=`[href="`+Ht(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ht(r)+`"][href="`+Ht(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=St(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);Ct(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=St(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=St(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=de.current)?gf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=St(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=St(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(jf(e)))&&!a._p&&(s.instance=a,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=St(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Af(e){return`href="`+Ht(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),Ct(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Ht(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ht(n.href)+`"]`);if(r)return t.instance=r,Ct(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ct(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,Ct(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),Ct(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,Ct(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Ct(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[_t]||a[ut]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:M,_currentValue2:M,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=$e(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$e(0),this.hiddenUpdates=$e(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=oi(3,null,null,t),e.current=a,a.stateNode=e,t=ia(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},La(a),e}function tp(e){return e?(e=ii,e):ii}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=za(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ba(e,r,t),n!==null&&(pu(n,e,t),Va(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=ti(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=at(t);var n=ti(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=2,up(e,t,n,r)}finally{j.p=a,A.T=i}}function lp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=8,up(e,t,n,r)}finally{j.p=a,A.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=bt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Je(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ve(o);s.entanglements[1]|=c,o&=~c}nd(a),!(J&6)&&(eu=ke()+500,rd(0,!1))}}break;case 31:case 13:s=ti(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=on(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=yt(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ae()){case je:return 2;case Me:return 8;case Ne:case Pe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=bt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=yt(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,ct(e.priority,function(){op(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,ct(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);an=r,n.target.dispatchEvent(r),an=null}else return t=bt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,t){e.blockedOn===t&&(e.blockedOn=null,hp||(hp=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=bt(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[dt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[dt]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[ft]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=st();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=r.version;if(Lp!==`19.2.8`)throw Error(o(527,Lp,`19.2.8`));j.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Re=zp.inject(Rp),ze=zp}catch{}}t.createRoot=function(e,t){if(!c(e))throw Error(o(299));var n=!1,r=``,i=Us,a=Ws,s=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,a,s,Pp),e[ft]=t.current,xd(e),new Fp(t)}})),l=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=c()})),u=t(e(),1),d={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},f=u.createContext&&u.createContext(d),p=[`attr`,`size`,`title`];function m(e,t){if(e==null)return{};var n,r,i=h(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function h(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g.apply(null,arguments)}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e){var t=x(e,`string`);return typeof t==`symbol`?t:t+``}function x(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function S(e){return e&&e.map((e,t)=>u.createElement(e.tag,v({key:t},e.attr),S(e.child)))}function C(e){return t=>u.createElement(w,g({attr:v({},e.attr)},t),S(e.child))}function w(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=m(e,p),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),u.createElement(`svg`,g({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:v(v({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&u.createElement(`title`,null,i),e.children)};return f===void 0?t(d):u.createElement(f.Consumer,null,e=>t(e))}function T(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`},child:[]}]})(e)}function E(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M18 6 6 18`},child:[]},{tag:`path`,attr:{d:`m6 6 12 12`},child:[]}]})(e)}function D(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`},child:[]}]})(e)}function O(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M7 11v4a2 2 0 0 0 2 2h4`},child:[]},{tag:`rect`,attr:{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`},child:[]}]})(e)}function k(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`},child:[]},{tag:`path`,attr:{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`},child:[]},{tag:`path`,attr:{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`},child:[]}]})(e)}function ee(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`},child:[]},{tag:`path`,attr:{d:`m14 7 3 3`},child:[]},{tag:`path`,attr:{d:`M5 6v4`},child:[]},{tag:`path`,attr:{d:`M19 14v4`},child:[]},{tag:`path`,attr:{d:`M10 2v2`},child:[]},{tag:`path`,attr:{d:`M7 8H3`},child:[]},{tag:`path`,attr:{d:`M21 16h-4`},child:[]},{tag:`path`,attr:{d:`M11 3H9`},child:[]}]})(e)}function te(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`},child:[]},{tag:`circle`,attr:{cx:`9`,cy:`7`,r:`4`},child:[]},{tag:`polyline`,attr:{points:`16 11 18 13 22 9`},child:[]}]})(e)}function ne(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`17 8 12 3 7 8`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`12`,y1:`3`,y2:`15`},child:[]}]})(e)}function re(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`},child:[]},{tag:`line`,attr:{x1:`8`,x2:`8`,y1:`2`,y2:`5`},child:[]},{tag:`line`,attr:{x1:`2`,x2:`5`,y1:`8`,y2:`8`},child:[]},{tag:`line`,attr:{x1:`16`,x2:`16`,y1:`19`,y2:`22`},child:[]},{tag:`line`,attr:{x1:`19`,x2:`22`,y1:`16`,y2:`16`},child:[]}]})(e)}function ie(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{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`},child:[]},{tag:`path`,attr:{d:`M12 9v4`},child:[]},{tag:`path`,attr:{d:`M12 17h.01`},child:[]}]})(e)}function ae(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`22 17 13.5 8.5 8.5 13.5 2 7`},child:[]},{tag:`polyline`,attr:{points:`16 17 22 17 22 11`},child:[]}]})(e)}function A(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 6h18`},child:[]},{tag:`path`,attr:{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`},child:[]},{tag:`path`,attr:{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`},child:[]},{tag:`line`,attr:{x1:`10`,x2:`10`,y1:`11`,y2:`17`},child:[]},{tag:`line`,attr:{x1:`14`,x2:`14`,y1:`11`,y2:`17`},child:[]}]})(e)}function j(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`4 17 10 11 4 5`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`20`,y1:`19`,y2:`19`},child:[]}]})(e)}function M(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`},child:[]},{tag:`circle`,attr:{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`},child:[]}]})(e)}function oe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`},child:[]}]})(e)}function se(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`},child:[]},{tag:`path`,attr:{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`},child:[]}]})(e)}function ce(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`},child:[]},{tag:`path`,attr:{d:`M20 3v4`},child:[]},{tag:`path`,attr:{d:`M22 5h-4`},child:[]},{tag:`path`,attr:{d:`M4 17v2`},child:[]},{tag:`path`,attr:{d:`M5 18H3`},child:[]}]})(e)}function N(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`21`,x2:`14`,y1:`4`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`10`,x2:`3`,y1:`4`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`21`,x2:`12`,y1:`12`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`8`,x2:`3`,y1:`12`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`21`,x2:`16`,y1:`20`,y2:`20`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`3`,y1:`20`,y2:`20`},child:[]},{tag:`line`,attr:{x1:`14`,x2:`14`,y1:`2`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`8`,x2:`8`,y1:`10`,y2:`14`},child:[]},{tag:`line`,attr:{x1:`16`,x2:`16`,y1:`18`,y2:`22`},child:[]}]})(e)}function P(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`},child:[]}]})(e)}function le(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`},child:[]},{tag:`path`,attr:{d:`m9 12 2 2 4-4`},child:[]}]})(e)}function ue(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function de(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`},child:[]},{tag:`rect`,attr:{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`},child:[]}]})(e)}function fe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`},child:[]},{tag:`path`,attr:{d:`m21.854 2.147-10.94 10.939`},child:[]}]})(e)}function pe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`path`,attr:{d:`m21 21-4.3-4.3`},child:[]}]})(e)}function me(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 7V5a2 2 0 0 1 2-2h2`},child:[]},{tag:`path`,attr:{d:`M17 3h2a2 2 0 0 1 2 2v2`},child:[]},{tag:`path`,attr:{d:`M21 17v2a2 2 0 0 1-2 2h-2`},child:[]},{tag:`path`,attr:{d:`M7 21H5a2 2 0 0 1-2-2v-2`},child:[]}]})(e)}function he(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`},child:[]},{tag:`path`,attr:{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`},child:[]},{tag:`path`,attr:{d:`M7 3v4a1 1 0 0 0 1 1h7`},child:[]}]})(e)}function ge(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M21 9H3`},child:[]},{tag:`path`,attr:{d:`M21 15H3`},child:[]}]})(e)}function _e(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`},child:[]},{tag:`path`,attr:{d:`M21 3v5h-5`},child:[]}]})(e)}function ve(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`},child:[]},{tag:`path`,attr:{d:`M3 3v5h5`},child:[]}]})(e)}function ye(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 4a2 2 0 0 1 2-2`},child:[]},{tag:`path`,attr:{d:`M16 10a2 2 0 0 1-2-2`},child:[]},{tag:`path`,attr:{d:`M20 2a2 2 0 0 1 2 2`},child:[]},{tag:`path`,attr:{d:`M22 8a2 2 0 0 1-2 2`},child:[]},{tag:`path`,attr:{d:`m3 7 3 3 3-3`},child:[]},{tag:`path`,attr:{d:`M6 10V5a3 3 0 0 1 3-3h1`},child:[]},{tag:`rect`,attr:{x:`2`,y:`14`,width:`8`,height:`8`,rx:`2`},child:[]}]})(e)}function be(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`},child:[]},{tag:`path`,attr:{d:`M21 3v5h-5`},child:[]},{tag:`path`,attr:{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`},child:[]},{tag:`path`,attr:{d:`M8 16H3v5`},child:[]}]})(e)}function xe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`},child:[]},{tag:`path`,attr:{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`2`},child:[]},{tag:`path`,attr:{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`},child:[]},{tag:`path`,attr:{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`},child:[]}]})(e)}function Se(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M18.36 6.64A9 9 0 0 1 20.77 15`},child:[]},{tag:`path`,attr:{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`},child:[]},{tag:`path`,attr:{d:`M12 2v4`},child:[]},{tag:`path`,attr:{d:`m2 2 20 20`},child:[]}]})(e)}function Ce(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 12h14`},child:[]},{tag:`path`,attr:{d:`M12 5v14`},child:[]}]})(e)}function we(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 22v-5`},child:[]},{tag:`path`,attr:{d:`M9 8V2`},child:[]},{tag:`path`,attr:{d:`M15 8V2`},child:[]},{tag:`path`,attr:{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`},child:[]}]})(e)}function Te(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`6 3 20 12 6 21 6 3`},child:[]}]})(e)}function Ee(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z`},child:[]}]})(e)}function De(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{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`},child:[]},{tag:`path`,attr:{d:`m15 5 4 4`},child:[]}]})(e)}function Oe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`},child:[]}]})(e)}function ke(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M3 15h18`},child:[]},{tag:`path`,attr:{d:`m15 8-3 3-3-3`},child:[]}]})(e)}function Ae(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`},child:[]},{tag:`path`,attr:{d:`M12 22V12`},child:[]},{tag:`path`,attr:{d:`m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7`},child:[]},{tag:`path`,attr:{d:`m7.5 4.27 9 5.15`},child:[]}]})(e)}function je(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m15 9-6 6`},child:[]},{tag:`path`,attr:{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`},child:[]},{tag:`path`,attr:{d:`m9 9 6 6`},child:[]}]})(e)}function Me(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 4.1 12 6`},child:[]},{tag:`path`,attr:{d:`m5.1 8-2.9-.8`},child:[]},{tag:`path`,attr:{d:`m6 12-1.9 2`},child:[]},{tag:`path`,attr:{d:`M7.2 2.2 8 5.1`},child:[]},{tag:`path`,attr:{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`},child:[]}]})(e)}function Ne(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`},child:[]}]})(e)}function Pe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`},child:[]},{tag:`line`,attr:{x1:`8`,x2:`16`,y1:`21`,y2:`21`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`12`,y1:`17`,y2:`21`},child:[]}]})(e)}function Fe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 12h14`},child:[]}]})(e)}function Ie(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`},child:[]},{tag:`path`,attr:{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`},child:[]}]})(e)}function Le(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]}]})(e)}function Re(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]},{tag:`path`,attr:{d:`M13 8H7`},child:[]},{tag:`path`,attr:{d:`M17 12H7`},child:[]}]})(e)}function ze(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]},{tag:`path`,attr:{d:`M12 7v6`},child:[]},{tag:`path`,attr:{d:`M9 10h6`},child:[]}]})(e)}function Be(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`},child:[]}]})(e)}function Ve(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`4`,x2:`20`,y1:`12`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`4`,x2:`20`,y1:`6`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`4`,x2:`20`,y1:`18`,y2:`18`},child:[]}]})(e)}function He(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M8 3H5a2 2 0 0 0-2 2v3`},child:[]},{tag:`path`,attr:{d:`M21 8V5a2 2 0 0 0-2-2h-3`},child:[]},{tag:`path`,attr:{d:`M3 16v3a2 2 0 0 0 2 2h3`},child:[]},{tag:`path`,attr:{d:`M16 21h3a2 2 0 0 0 2-2v-3`},child:[]}]})(e)}function Ue(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`15 3 21 3 21 9`},child:[]},{tag:`polyline`,attr:{points:`9 21 3 21 3 15`},child:[]},{tag:`line`,attr:{x1:`21`,x2:`14`,y1:`3`,y2:`10`},child:[]},{tag:`line`,attr:{x1:`3`,x2:`10`,y1:`21`,y2:`14`},child:[]}]})(e)}function We(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`},child:[]},{tag:`path`,attr:{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`},child:[]}]})(e)}function Ge(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M7 11V7a5 5 0 0 1 10 0v4`},child:[]}]})(e)}function Ke(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 2v4`},child:[]},{tag:`path`,attr:{d:`m16.2 7.8 2.9-2.9`},child:[]},{tag:`path`,attr:{d:`M18 12h4`},child:[]},{tag:`path`,attr:{d:`m16.2 16.2 2.9 2.9`},child:[]},{tag:`path`,attr:{d:`M12 18v4`},child:[]},{tag:`path`,attr:{d:`m4.9 19.1 2.9-2.9`},child:[]},{tag:`path`,attr:{d:`M2 12h4`},child:[]},{tag:`path`,attr:{d:`m4.9 4.9 2.9 2.9`},child:[]}]})(e)}function qe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 12a9 9 0 1 1-6.219-8.56`},child:[]}]})(e)}function Je(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 12h.01`},child:[]},{tag:`path`,attr:{d:`M3 18h.01`},child:[]},{tag:`path`,attr:{d:`M3 6h.01`},child:[]},{tag:`path`,attr:{d:`M8 12h13`},child:[]},{tag:`path`,attr:{d:`M8 18h13`},child:[]},{tag:`path`,attr:{d:`M8 6h13`},child:[]}]})(e)}function Ye(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m3 17 2 2 4-4`},child:[]},{tag:`path`,attr:{d:`m3 7 2 2 4-4`},child:[]},{tag:`path`,attr:{d:`M13 6h8`},child:[]},{tag:`path`,attr:{d:`M13 12h8`},child:[]},{tag:`path`,attr:{d:`M13 18h8`},child:[]}]})(e)}function Xe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9 17H7A5 5 0 0 1 7 7h2`},child:[]},{tag:`path`,attr:{d:`M15 7h2a5 5 0 1 1 0 10h-2`},child:[]},{tag:`line`,attr:{x1:`8`,x2:`16`,y1:`12`,y2:`12`},child:[]}]})(e)}function Ze(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`},child:[]},{tag:`path`,attr:{d:`M9 18h6`},child:[]},{tag:`path`,attr:{d:`M10 22h4`},child:[]}]})(e)}function Qe(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`},child:[]},{tag:`rect`,attr:{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`},child:[]},{tag:`path`,attr:{d:`M14 4h7`},child:[]},{tag:`path`,attr:{d:`M14 9h7`},child:[]},{tag:`path`,attr:{d:`M14 15h7`},child:[]},{tag:`path`,attr:{d:`M14 20h7`},child:[]}]})(e)}function $e(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`},child:[]},{tag:`rect`,attr:{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`},child:[]},{tag:`rect`,attr:{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`},child:[]},{tag:`rect`,attr:{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`},child:[]}]})(e)}function et(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`},child:[]},{tag:`rect`,attr:{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`},child:[]},{tag:`rect`,attr:{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`},child:[]},{tag:`rect`,attr:{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`},child:[]}]})(e)}function tt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z`},child:[]},{tag:`path`,attr:{d:`m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65`},child:[]},{tag:`path`,attr:{d:`m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65`},child:[]}]})(e)}function nt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`},child:[]},{tag:`path`,attr:{d:`m21 2-9.6 9.6`},child:[]},{tag:`circle`,attr:{cx:`7.5`,cy:`15.5`,r:`5.5`},child:[]}]})(e)}function rt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`},child:[]},{tag:`circle`,attr:{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`},child:[]}]})(e)}function it(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`M12 16v-4`},child:[]},{tag:`path`,attr:{d:`M12 8h.01`},child:[]}]})(e)}function at(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`22 12 16 12 14 15 10 15 8 12 2 12`},child:[]},{tag:`path`,attr:{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`},child:[]}]})(e)}function ot(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`},child:[]},{tag:`path`,attr:{d:`M3 3v5h5`},child:[]},{tag:`path`,attr:{d:`M12 7v5l4 2`},child:[]}]})(e)}function st(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`4`,x2:`20`,y1:`9`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`4`,x2:`20`,y1:`15`,y2:`15`},child:[]},{tag:`line`,attr:{x1:`10`,x2:`8`,y1:`3`,y2:`21`},child:[]},{tag:`line`,attr:{x1:`16`,x2:`14`,y1:`3`,y2:`21`},child:[]}]})(e)}function ct(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`},child:[]},{tag:`path`,attr:{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`},child:[]},{tag:`path`,attr:{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`},child:[]},{tag:`path`,attr:{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`},child:[]}]})(e)}function lt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9`},child:[]},{tag:`path`,attr:{d:`m18 15 4-4`},child:[]},{tag:`path`,attr:{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`},child:[]}]})(e)}function ut(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`9`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`9`,cy:`5`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`9`,cy:`19`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`15`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`15`,cy:`5`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`15`,cy:`19`,r:`1`},child:[]}]})(e)}function dt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`},child:[]},{tag:`path`,attr:{d:`M2 12h20`},child:[]}]})(e)}function ft(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`},child:[]},{tag:`path`,attr:{d:`M9 18c-4.51 2-5-2-7-2`},child:[]}]})(e)}function pt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`18`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`6`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`6`,r:`3`},child:[]},{tag:`path`,attr:{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`},child:[]},{tag:`path`,attr:{d:`M12 12v3`},child:[]}]})(e)}function mt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`5`,cy:`6`,r:`3`},child:[]},{tag:`path`,attr:{d:`M12 6h5a2 2 0 0 1 2 2v7`},child:[]},{tag:`path`,attr:{d:`m15 9-3-3 3-3`},child:[]},{tag:`circle`,attr:{cx:`19`,cy:`18`,r:`3`},child:[]},{tag:`path`,attr:{d:`M12 18H7a2 2 0 0 1-2-2V9`},child:[]},{tag:`path`,attr:{d:`m9 15 3 3-3 3`},child:[]}]})(e)}function ht(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`6`,x2:`6`,y1:`3`,y2:`15`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`6`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`18`,r:`3`},child:[]},{tag:`path`,attr:{d:`M18 9a9 9 0 0 1-9 9`},child:[]}]})(e)}function gt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m12 14 4-4`},child:[]},{tag:`path`,attr:{d:`M3.34 19a10 10 0 1 1 17.32 0`},child:[]}]})(e)}function _t(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`},child:[]}]})(e)}function vt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{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`},child:[]}]})(e)}function yt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2`},child:[]},{tag:`path`,attr:{d:`M8.5 2h7`},child:[]},{tag:`path`,attr:{d:`M7 16h10`},child:[]}]})(e)}function bt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z`},child:[]},{tag:`line`,attr:{x1:`4`,x2:`4`,y1:`22`,y2:`15`},child:[]}]})(e)}function xt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`},child:[]},{tag:`path`,attr:{d:`M14 13.12c0 2.38 0 6.38-1 8.88`},child:[]},{tag:`path`,attr:{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`},child:[]},{tag:`path`,attr:{d:`M2 12a10 10 0 0 1 18-6`},child:[]},{tag:`path`,attr:{d:`M2 16h.01`},child:[]},{tag:`path`,attr:{d:`M21.8 16c.2-2 .131-5.354 0-6`},child:[]},{tag:`path`,attr:{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`},child:[]},{tag:`path`,attr:{d:`M8.65 22c.21-.66.45-1.32.57-2`},child:[]},{tag:`path`,attr:{d:`M9 6.8a6 6 0 0 1 9 5.2v2`},child:[]}]})(e)}function St(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`},child:[]},{tag:`path`,attr:{d:`M14 2v4a2 2 0 0 0 2 2h4`},child:[]}]})(e)}function Ct(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`},child:[]},{tag:`path`,attr:{d:`M14 2v4a2 2 0 0 0 2 2h4`},child:[]},{tag:`path`,attr:{d:`M10 9H8`},child:[]},{tag:`path`,attr:{d:`M16 13H8`},child:[]},{tag:`path`,attr:{d:`M16 17H8`},child:[]}]})(e)}function wt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 2v4a2 2 0 0 0 2 2h4`},child:[]},{tag:`path`,attr:{d:`M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3`},child:[]},{tag:`path`,attr:{d:`m9 18-1.5-1.5`},child:[]},{tag:`circle`,attr:{cx:`5`,cy:`14`,r:`3`},child:[]}]})(e)}function Tt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`},child:[]},{tag:`path`,attr:{d:`M14 2v4a2 2 0 0 0 2 2h4`},child:[]},{tag:`path`,attr:{d:`M9 15h6`},child:[]},{tag:`path`,attr:{d:`M12 18v-6`},child:[]}]})(e)}function Et(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 12.5 8 15l2 2.5`},child:[]},{tag:`path`,attr:{d:`m14 12.5 2 2.5-2 2.5`},child:[]},{tag:`path`,attr:{d:`M14 2v4a2 2 0 0 0 2 2h4`},child:[]},{tag:`path`,attr:{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`},child:[]}]})(e)}function Dt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function Ot(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`},child:[]},{tag:`path`,attr:{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`},child:[]},{tag:`path`,attr:{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`},child:[]},{tag:`path`,attr:{d:`m2 2 20 20`},child:[]}]})(e)}function kt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 3h6v6`},child:[]},{tag:`path`,attr:{d:`M10 14 21 3`},child:[]},{tag:`path`,attr:{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`},child:[]}]})(e)}function At(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`19`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`5`,cy:`12`,r:`1`},child:[]}]})(e)}function jt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`5`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`19`,r:`1`},child:[]}]})(e)}function Mt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`7 10 12 15 17 10`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`12`,y1:`15`,y2:`3`},child:[]}]})(e)}function Nt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`ellipse`,attr:{cx:`12`,cy:`5`,rx:`9`,ry:`3`},child:[]},{tag:`path`,attr:{d:`M3 5V19A9 3 0 0 0 21 19V5`},child:[]},{tag:`path`,attr:{d:`M3 12A9 3 0 0 0 21 12`},child:[]}]})(e)}function Pt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`22`,x2:`18`,y1:`12`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`6`,x2:`2`,y1:`12`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`12`,y1:`6`,y2:`2`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`12`,y1:`22`,y2:`18`},child:[]}]})(e)}function Ft(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`},child:[]},{tag:`rect`,attr:{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`},child:[]},{tag:`path`,attr:{d:`M15 2v2`},child:[]},{tag:`path`,attr:{d:`M15 20v2`},child:[]},{tag:`path`,attr:{d:`M2 15h2`},child:[]},{tag:`path`,attr:{d:`M2 9h2`},child:[]},{tag:`path`,attr:{d:`M20 15h2`},child:[]},{tag:`path`,attr:{d:`M20 9h2`},child:[]},{tag:`path`,attr:{d:`M9 2v2`},child:[]},{tag:`path`,attr:{d:`M9 20v2`},child:[]}]})(e)}function It(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`15 10 20 15 15 20`},child:[]},{tag:`path`,attr:{d:`M4 4v7a4 4 0 0 0 4 4h12`},child:[]}]})(e)}function Lt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`},child:[]}]})(e)}function Rt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]}]})(e)}function zt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z`},child:[]},{tag:`path`,attr:{d:`M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z`},child:[]},{tag:`path`,attr:{d:`M12 2v2`},child:[]},{tag:`path`,attr:{d:`M12 22v-2`},child:[]},{tag:`path`,attr:{d:`m17 20.66-1-1.73`},child:[]},{tag:`path`,attr:{d:`M11 10.27 7 3.34`},child:[]},{tag:`path`,attr:{d:`m20.66 17-1.73-1`},child:[]},{tag:`path`,attr:{d:`m3.34 7 1.73 1`},child:[]},{tag:`path`,attr:{d:`M14 12h8`},child:[]},{tag:`path`,attr:{d:`M2 12h2`},child:[]},{tag:`path`,attr:{d:`m20.66 7-1.73 1`},child:[]},{tag:`path`,attr:{d:`m3.34 17 1.73-1`},child:[]},{tag:`path`,attr:{d:`m17 3.34-1 1.73`},child:[]},{tag:`path`,attr:{d:`m11 13.73-4 6.93`},child:[]}]})(e)}function Bt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`16 18 22 12 16 6`},child:[]},{tag:`polyline`,attr:{points:`8 6 2 12 8 18`},child:[]}]})(e)}function Vt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`12 6 12 12 16 14`},child:[]}]})(e)}function Ht(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`},child:[]},{tag:`path`,attr:{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`},child:[]},{tag:`path`,attr:{d:`M12 11h4`},child:[]},{tag:`path`,attr:{d:`M12 16h4`},child:[]},{tag:`path`,attr:{d:`M8 11h.01`},child:[]},{tag:`path`,attr:{d:`M8 16h.01`},child:[]}]})(e)}function Ut(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]}]})(e)}function Wt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`m15 9-6 6`},child:[]},{tag:`path`,attr:{d:`m9 9 6 6`},child:[]}]})(e)}function Gt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`9`,x2:`15`,y1:`15`,y2:`9`},child:[]}]})(e)}function Kt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`M8 12h8`},child:[]},{tag:`path`,attr:{d:`M12 8v8`},child:[]}]})(e)}function qt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`},child:[]},{tag:`path`,attr:{d:`M12 17h.01`},child:[]}]})(e)}function Jt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`1`},child:[]}]})(e)}function Yt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10.1 2.182a10 10 0 0 1 3.8 0`},child:[]},{tag:`path`,attr:{d:`M13.9 21.818a10 10 0 0 1-3.8 0`},child:[]},{tag:`path`,attr:{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`},child:[]},{tag:`path`,attr:{d:`M2.182 13.9a10 10 0 0 1 0-3.8`},child:[]},{tag:`path`,attr:{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`},child:[]},{tag:`path`,attr:{d:`M21.818 10.1a10 10 0 0 1 0 3.8`},child:[]},{tag:`path`,attr:{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`},child:[]},{tag:`path`,attr:{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`},child:[]}]})(e)}function Xt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`m9 12 2 2 4-4`},child:[]}]})(e)}function Zt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`12`,y1:`8`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`},child:[]}]})(e)}function Qt(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m7 15 5 5 5-5`},child:[]},{tag:`path`,attr:{d:`m7 9 5-5 5 5`},child:[]}]})(e)}function $t(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m18 15-6-6-6 6`},child:[]}]})(e)}function en(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m9 18 6-6-6-6`},child:[]}]})(e)}function tn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m15 18-6-6 6-6`},child:[]}]})(e)}function nn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m6 9 6 6 6-6`},child:[]}]})(e)}function rn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 6 9 17l-5-5`},child:[]}]})(e)}function an(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`},child:[]},{tag:`path`,attr:{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`},child:[]},{tag:`path`,attr:{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`},child:[]},{tag:`path`,attr:{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`},child:[]},{tag:`path`,attr:{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`},child:[]},{tag:`path`,attr:{d:`M3.477 10.896a4 4 0 0 1 .585-.396`},child:[]},{tag:`path`,attr:{d:`M19.938 10.5a4 4 0 0 1 .585.396`},child:[]},{tag:`path`,attr:{d:`M6 18a4 4 0 0 1-1.967-.516`},child:[]},{tag:`path`,attr:{d:`M19.967 17.484A4 4 0 0 1 18 18`},child:[]}]})(e)}function on(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`},child:[]},{tag:`path`,attr:{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`},child:[]}]})(e)}function sn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 8V4H8`},child:[]},{tag:`rect`,attr:{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M2 14h2`},child:[]},{tag:`path`,attr:{d:`M20 14h2`},child:[]},{tag:`path`,attr:{d:`M15 13v2`},child:[]},{tag:`path`,attr:{d:`M9 13v2`},child:[]}]})(e)}function cn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 7v14`},child:[]},{tag:`path`,attr:{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`},child:[]}]})(e)}function ln(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`},child:[]},{tag:`path`,attr:{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`},child:[]}]})(e)}function un(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`m4.9 4.9 14.2 14.2`},child:[]}]})(e)}function dn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m5 12 7-7 7 7`},child:[]},{tag:`path`,attr:{d:`M12 19V5`},child:[]}]})(e)}function fn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M7 7h10v10`},child:[]},{tag:`path`,attr:{d:`M7 17 17 7`},child:[]}]})(e)}function pn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m21 16-4 4-4-4`},child:[]},{tag:`path`,attr:{d:`M17 20V4`},child:[]},{tag:`path`,attr:{d:`m3 8 4-4 4 4`},child:[]},{tag:`path`,attr:{d:`M7 4v16`},child:[]}]})(e)}function mn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 12h14`},child:[]},{tag:`path`,attr:{d:`m12 5 7 7-7 7`},child:[]}]})(e)}function hn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m12 19-7-7 7-7`},child:[]},{tag:`path`,attr:{d:`M19 12H5`},child:[]}]})(e)}function gn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 5v14`},child:[]},{tag:`path`,attr:{d:`m19 12-7 7-7-7`},child:[]}]})(e)}function _n(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`},child:[]},{tag:`path`,attr:{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`},child:[]},{tag:`path`,attr:{d:`M10 12h4`},child:[]}]})(e)}function vn(e){return C({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M15 12H3`},child:[]},{tag:`path`,attr:{d:`M17 18H3`},child:[]},{tag:`path`,attr:{d:`M21 6H3`},child:[]}]})(e)}var yn=`modulepreload`,bn=function(e){return`/`+e},xn={},Sn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=bn(t,n),t=s(t),t in xn)return;xn[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:yn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Cn=null;function wn(e,t){e.currentIndex=0,e.wipContextDeps=null,e.wipCommitCallbacks=[];let n=Cn;Cn=e;try{if(t(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{Cn=n}}function Tn(){if(!Cn)throw Error(`No resource fiber available`);return Cn}function En(){return Cn}var Dn=typeof process<`u`&&!1,On=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],committedLog:[],unsettledCount:0,rollbackCallbacks:[]}),kn=e=>{e.committedVersion=e.version;for(let t of e.changelog)t.logged=!1,t.settled||(t.settled=!0,e.unsettledCount--),e.committedLog.push(t);e.changelog.length=0,e.unsettledCount===0&&(e.committedLog.length=0),e.rollbackCallbacks.length=0},An=(e,t)=>{let n=e.version>t;if(e.version=t,n){for(let t=0;t<e.rollbackCallbacks.length;t++)e.rollbackCallbacks[t]();if(e.rollbackCallbacks.length=0,t<=e.committedVersion){let n=[];for(;e.committedVersion-n.length>t;){let t=e.committedLog.pop();if(t===void 0){if(Dn)throw Error(`tap: committed history is shorter than the replay base.`);break}Pn(t.fiber,t.cell),t.cell.workInProgress=t.prevState,n.push({record:t,prevState:t.prevState,eagerState:t.eagerState,hasEagerState:t.hasEagerState})}if(n.length>0){let t=e.committedVersion;Nn(e,()=>{for(let t=n.length-1;t>=0;t--){let r=n[t];r.record.prevState=r.prevState,r.record.eagerState=r.eagerState,r.record.hasEagerState=r.hasEagerState,e.committedLog.push(r.record)}e.committedVersion=t})}e.committedVersion=t;for(let t of e.changelog)t.logged=!1;e.changelog.length=0}else{for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop().logged=!1;for(let t=0;t<e.changelog.length;t++)jn(e.changelog[t]);kn(e)}}},jn=e=>{Pn(e.fiber,e.cell),e.queued||(e.queued=!0,(e.cell.queue??=[]).push(e))},Mn=(e,t)=>{e.wipCommitCallbacks.push(t)},Nn=(e,t)=>{e.rollbackCallbacks.push(t)},Pn=(e,t)=>{t.isDirty||(t.isDirty=!0,e.markDirty?.(),Nn(e.root,()=>{if(t.queue!==null){for(let e of t.queue)e.queued=!1;t.queue=null}t.workInProgress=t.current,t.isDirty=!1}))},Fn=Symbol.for(`react.memo_cache_sentinel`),In=e=>Array(e).fill(Fn),Ln=(e,t)=>{let n=e.memoCache,r=n.workInProgress;if(r===null){let t=n.current;r=t===null?[]:t.map(e=>e.slice()),n.workInProgress=r,Nn(e.root,()=>{n.workInProgress=null,n.refreshedIndices=null})}let i=n.index++,a=r[i];return n.refreshedIndices?.has(i)&&!e.isRefreshing&&(n.refreshedIndices.delete(i),a=n.current?.[i]?.slice()??In(t),r[i]=a),a===void 0||e.isRefreshing?(a=In(t),r[i]=a,e.isRefreshing&&(n.refreshedIndices??=new Set).add(i)):Dn&&a.length!==t&&console.error(`Expected a constant size argument for each invocation of c(). The previous cache was allocated with size ${a.length} but size ${t} was requested.`),a},Rn=e=>Ln(Tn(),e),zn=u.default.__COMPILER_RUNTIME?.c??(e=>(0,u.useMemo)(()=>{let t=In(e);return t[Fn]=!0,t},[])),Bn=()=>En()!==null,F=e=>Bn()?Rn(e):zn(e),I=r(),Vn=(e,...t)=>Object.assign(Object.create(null),e,...t),Hn=()=>{throw Error(`Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.`)},Un=()=>{throw Error(`Hook order changed between renders`)},Wn=e=>({type:e,setup:void 0,setupDeps:void 0,cleanup:void 0,deps:null,generation:0});function Gn(e,t,n){let r=Tn(),i=r.currentIndex++,a=r.cells[i],o=a===void 0?Wn(n):a.type===n?a:Un();if(a===void 0&&(r.isFirstRender||Hn(),r.cells[i]=o,n===`insertion`?(r.insertionCells??=[]).push(o):r.effectCells.push(o)),o.deps!==null&&!!t!=!!o.deps)throw Error(`useEffect called with and without dependencies across re-renders`);let s=r.isRefreshing;Mn(r,()=>{o.setup=e,o.setupDeps=t,s&&(o.deps=null),o.generation++})}function Kn(e,t){Gn(e,t,`effect`)}function qn(e){let t=Tn(),n=t.currentIndex++,r=t.cells[n];if(r===void 0){t.isFirstRender||Hn();let r={current:e};return t.cells[n]={type:`ref`,ref:r},r}return r.type===`ref`?r.ref:Un()}var Jn=Symbol(`tap.Context.defaultValue`),Yn=e=>e,Xn=new Map,Zn=new Set,Qn=()=>new Map(Xn),$n=(e,t)=>{let n=Xn;Xn=e;try{return t()}finally{Xn=n}},er=(e,t)=>{e[Jn]=t},tr=e=>typeof e==`object`&&!!e&&Jn in e,nr=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Symbol.for(`react.context`),rr=e=>tr(e)||nr(e),ir=e=>{if(!tr(e)){if(nr(e)){er(e,e._currentValue??e._currentValue2);return}throw Error("A tap resource's `use()` only accepts a tap context.")}},ar=(e,t,n)=>{if(typeof e!=`object`||!e)throw Error(`useContextProvider only accepts a React context.`);ir(e);let r=e,i=Tn(),a=qn(void 0),o=a.current===void 0||!Object.is(a.current.value,t);Kn(()=>{a.current={value:t}},[t]);let s=Xn.get(r),c=s!==void 0||Xn.has(r);Xn.set(r,{value:t,source:i});try{return or(r,o,n)}finally{c?Xn.set(r,s):Xn.delete(r)}},or=(e,t,n)=>{let r=Zn.has(e);t?Zn.add(e):Zn.delete(e);try{return n()}finally{r?Zn.add(e):Zn.delete(e)}},sr=e=>{ir(e);let t=e,n=cr(t,e),r=Tn();return(r.wipContextDeps??=new Map).set(t,n.source),n.value},cr=(e,t)=>Xn.get(e)??{value:Yn(t)[Jn],source:null},lr=(e,t,n,r)=>{if(!r)return n;let i=n;for(let[n,a]of r)a!==t&&a!==e&&(i??=new Map).set(n,a);return i},ur=(e,t=e.wipContextDeps)=>{let n=En();!n||!t||(n.wipContextDeps=lr(n,e,n.wipContextDeps,t))},dr=()=>Zn.size>0,fr=e=>{if(!e.contextDeps||!dr())return!1;for(let t of Zn.keys())if(e.contextDeps.has(t))return!0;return!1},pr=(e,t,n)=>{if(e.isNeverMounted)throw Error(`Resource updated before mount`);let r=!1,i=!0;e.root.unsettledCount++,e.root.dispatchUpdate(()=>r?i:(r=!0,n&&e.root.changelog.length===0&&!t.cell.isDirty&&!t.hasEagerState&&(t.prevState=t.cell.workInProgress,t.eagerState=n(t.cell.workInProgress,t.action),t.hasEagerState=!0,i=!Object.is(t.cell.current,t.eagerState),!i&&!t.settled&&(t.settled=!0,e.root.unsettledCount--)),i),()=>(r=!0,i=!0,jn(t),t.logged||(t.logged=!0,e.root.changelog.push(t)),!0))},mr=(e,t,n,r,i)=>{let a=r?r(n):n;Dn&&e.devStrictMode&&r&&r(n);let o={type:`reducer`,workInProgress:a,current:a,isDirty:!1,queue:null,renderQueue:null,reducer:t,dispatch:n=>{let r=En();if(r!==null){if(r!==e)throw Error(`Cannot update a resource while rendering a different resource.`);(e.renderPendingCells??=new Set).add(o),(o.renderQueue??=[]).push(n)}else pr(e,{fiber:e,cell:o,action:n,hasEagerState:!1,eagerState:void 0,prevState:o.current,settled:!1,queued:!1,logged:!1},i?t:void 0)}};return o};function hr(e,t,n,r){let i=Tn(),a=i.currentIndex++,o=i.cells[a],s=(()=>{if(o!==void 0)return o.type===`reducer`?o:Un();i.isFirstRender||Hn();let s=mr(i,e,t,n,r);return i.cells[a]=s,s})(),c=s.queue;if(c!==null){let t=e===s.reducer;for(let n=0;n<c.length;n++){let r=c[n];!r.hasEagerState||!t||!Object.is(r.prevState,s.workInProgress)?(r.prevState=s.workInProgress,r.eagerState=e(s.workInProgress,r.action),r.hasEagerState=!0,Dn&&i.devStrictMode&&(r.eagerState=e(s.workInProgress,r.action))):Dn&&i.devStrictMode&&e(s.workInProgress,r.action),r.queued=!1,s.workInProgress=r.eagerState}s.queue=null}if(s.reducer=e,s.renderQueue!==null){let t=s.workInProgress;for(let n of s.renderQueue)t=e(t,n);s.renderQueue=null,i.renderPendingCells?.delete(s),Object.is(t,s.workInProgress)||(Pn(i,s),s.workInProgress=t)}return s.isDirty&&Mn(i,()=>{s.current=s.workInProgress,s.isDirty=!1}),[s.workInProgress,s.dispatch]}function gr(e,t,n){return hr(e,t,n,!1)}var _r=(e,t)=>typeof t==`function`?t(e):t,vr=e=>e===void 0?void 0:typeof e==`function`?e():e;function yr(e){return hr(_r,e,vr,!0)}var br=(e,t)=>{Dn&&e.length!==t.length&&console.error(`The final argument passed to a hook changed size between renders. The order and size of this array must remain constant.
|
|
10
|
+
|
|
11
|
+
Previous: [${e.join(`, `)}]\nIncoming: [${t.join(`, `)}]`);for(let n=0;n<e.length&&n<t.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0},xr=(e,t)=>{Mn(e,()=>{t.current=t.wip,t.currentDeps=t.wipDeps,t.wipIsRefreshing=!1,t.isDirty=!1})},Sr=(e,t)=>{let n=Tn(),r=n.currentIndex++,i=n.cells[r];if(i===void 0){n.isFirstRender||Hn();let a=e();return Dn&&n.devStrictMode&&e(),i={type:`memo`,current:a,currentDeps:t,wip:a,wipDeps:t,wipIsRefreshing:!1,isDirty:!1},n.cells[r]=i,a}i.type!==`memo`&&Un();let a=i;if(a.wipIsRefreshing&&!n.isRefreshing&&(a.wip=a.current,a.wipDeps=a.currentDeps,a.wipIsRefreshing=!1,a.isDirty=!1),!n.isRefreshing&&br(a.wipDeps,t))return a.isDirty&&xr(n,a),a.wip;let o=e();return Dn&&n.devStrictMode&&e(),a.wip=o,a.wipDeps=t,a.wipIsRefreshing=n.isRefreshing,a.isDirty||(a.isDirty=!0,Nn(n.root,()=>{a.wip=a.current,a.wipDeps=a.currentDeps,a.wipIsRefreshing=!1,a.isDirty=!1})),xr(n,a),o},Cr=(e,t)=>Sr(()=>e,t);function wr(e,t){Gn(e,t,`insertion`)}function Tr(e){let t=Tn(),n=qn(e);return n.current!==e&&Mn(t,()=>{n.current=e}),qn(((...e)=>{if(Dn&&En())throw Error(`useEffectEvent cannot be called during render`);return n.current(...e)})).current}var Er=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Dr=()=>{},Or=e=>{let t=e;switch(typeof t.status==`string`?t.status!==`fulfilled`&&t.status!==`rejected`&&e.then(Dr,Dr):(t.status=`pending`,e.then(e=>{t.status===`pending`&&(t.status=`fulfilled`,t.value=e)},e=>{t.status===`pending`&&(t.status=`rejected`,t.reason=e)})),t.status){case`fulfilled`:return t.value;case`rejected`:throw t.reason;default:throw e}},kr=e=>Er(e)?Or(e):sr(e),Ar=!1,jr=(e,t,n=t)=>{let r=Tn().isNeverMounted,i=r?n():t();Dn&&!Ar&&(!r||n===t)&&(Object.is(i,t())||(Ar=!0,console.error(`The result of getSnapshot should be cached to avoid an infinite loop`)));let[,a]=gr(e=>e+1,0),o=qn(0),s=Tr(()=>{try{if(Object.is(i,t()))return o.current=0,!1}catch{}return!0});return Kn(()=>e(()=>{s()&&a()}),[e]),Kn(()=>{if(s()){if(++o.current>50)throw o.current=0,Error(`Maximum update depth exceeded. The result of getSnapshot should be cached to avoid an infinite loop.`);a()}},[e,i,t]),i},Mr=(e,t)=>{},Nr=0,Pr=()=>{let e=qn(null);return e.current??=`:tap${Nr++}:`,e.current},Fr=(e,t,n)=>{let r=()=>{if(!e)return;let n=t();if(typeof e==`function`){let t=e(n);return typeof t==`function`?t:()=>e(null)}return e.current=n,()=>{e.current=null}};n==null?Kn(r):Kn(r,[...n,e])},Ir=u.default;function Lr(e){let t=(0,u.useRef)(e);return(0,u.useInsertionEffect)(()=>{t.current=e}),(0,u.useCallback)(((...e)=>t.current(...e)),[])}var Rr=Ir.useEffectEvent??Lr,zr=()=>En()!==null,Br=u.default,L=e=>zr()?yr(e):Br.useState(e),Vr=(e,t,n)=>zr()?gr(e,t,n):Br.useReducer(e,t,n),R=e=>zr()?qn(e):Br.useRef(e),Hr=(e,t)=>zr()?Sr(e,t):Br.useMemo(e,t),Ur=(e,t)=>zr()?Cr(e,t):Br.useCallback(e,t),z=(e,t)=>zr()?Kn(e,t):Br.useEffect(e,t),Wr=(e,t)=>zr()?Kn(e,t):Br.useLayoutEffect(e,t),Gr=e=>zr()?Tr(e):Rr(e),Kr=(e,t,n)=>zr()?jr(e,t,n):Br.useSyncExternalStore(e,t,n),qr=(e,t)=>zr()?void 0:Br.useDebugValue(e,t),Jr=(e,t)=>zr()?wr(e,t):Br.useInsertionEffect(e,t),Yr=()=>zr()?Pr():Br.useId(),Xr=(e,t,n)=>zr()?Fr(e,t,n):Br.useImperativeHandle(e,t,n),B=e=>Br.forwardRef(e),Zr=(e,t)=>Br.memo(e,t),Qr=Br.Fragment,$r=(...e)=>Br.createElement(...e),ei=(...e)=>Br.cloneElement(...e),ti=e=>Br.isValidElement(e);Br.Children,Br.Suspense;var ni=e=>{let t=Br.createContext(e);return er(t,e),t},ri=e=>zr()&&rr(e)?kr(e):Br.use(e),ii=e=>zr()&&rr(e)?kr(e):Br.useContext(e),ai=(e,t)=>{if(e.length!==0){if(e.length===1)throw e[0];for(let t of e)console.error(t);throw AggregateError(e,t)}},oi=50,si={schedulers:new Set,isScheduled:!1},ci=null,li=[],ui=class{_isDirty=!1;_task;constructor(e){this._task=e}get isDirty(){return this._isDirty}markDirty(){if(ci&&(ci.get(this)??0)>=oi)throw Error(`Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside useEffect.`);this._isDirty=!0,si.schedulers.add(this),pi()}runTask(){ci?.set(this,(ci.get(this)??0)+1),this._isDirty=!1,this._task()}settle(){this._isDirty=!1}},di=[];new ui(()=>{let e=di.splice(0),t=[];for(let n of e)try{n()}catch(e){t.push(e)}ai(t,`Errors occurred while running scheduled tasks`)});var fi=e=>{if(ci!==null){li.push(e);return}e()},pi=()=>{si.isScheduled||(si.isScheduled=!0,hi())},mi=()=>{let e=ci;ci=new Map;let t=[];try{for(let e of si.schedulers)if(si.schedulers.delete(e),e.isDirty)try{e.runTask()}catch(e){t.push(e)}}finally{if(ci=e,si.schedulers.clear(),si.isScheduled=!1,ci===null)for(;li.length>0;)try{li.shift()()}catch(e){t.push(e)}}ai(t,`Errors occurred during flushSync`)},hi=(()=>{if(typeof MessageChannel<`u`){let e=null,t;return()=>{if(!e){let n=new MessageChannel;n.port1.onmessage=()=>{e?.unref?.(),mi()},e=n.port1,t=n.port2}e.ref?.(),t.postMessage(null)}}return()=>setTimeout(mi,0)})(),gi=e=>{if(ci!==null)return Dn&&console.warn(`flushTapSync was called from inside a render or commit. The flush is deferred until the current pass completes.`),e();let t=si;si={schedulers:new Set,isScheduled:!0};try{let t=e();return mi(),t}finally{let e=si.schedulers;if(si=t,e.size>0){for(let t of e)si.schedulers.add(t);pi()}}};function _i(e){if(e.length===0)return;let t;for(let n=0;n<e.length;n++)try{e[n]()}catch(e){(t??=[]).push(e)}t!==void 0&&ai(t,`Errors during commit`)}function vi(e){let t=e.setup,n=e.setupDeps,r=e.generation,i;try{let e=t();if(e!==void 0&&typeof e!=`function`)throw Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof e}`);i=e}finally{e.generation===r?(e.cleanup=i,e.deps=n):i?.()}}var yi=e=>e.setup===void 0?!1:e.deps===null||e.setupDeps===void 0||!br(e.deps,e.setupDeps);function bi(e,t){let n;for(let t of e)yi(t)&&(n??=[]).push(t);if(n===void 0)return t;for(let e of n)if(e.deps=null,e.cleanup!==void 0)try{e.cleanup()}catch(e){(t??=[]).push(e)}finally{e.cleanup=void 0}for(let e of n)try{vi(e)}catch(e){(t??=[]).push(e)}return t}function xi(e,t=!0){let n;e.insertionCells!==null&&t&&(n=bi(e.insertionCells,n)),n=bi(e.effectCells,n),n!==void 0&&ai(n,`Errors during commit`)}function Si(e){let t;for(let n of e)if(n.deps=null,n.cleanup)try{n.cleanup?.()}catch(e){(t??=[]).push(e)}finally{n.cleanup=void 0}t!==void 0&&ai(t,`Errors during cleanup`)}var Ci={useState:yr,useReducer:gr,useRef:qn,useMemo:Sr,useCallback:Cr,useEffect:Kn,useLayoutEffect:Kn,useInsertionEffect:wr,useEffectEvent:Tr,useContext:sr,use:kr,useSyncExternalStore:jr,useDebugValue:Mr,useId:Pr,useImperativeHandle:Fr,useMemoCache:Rn},wi=u.default,Ti=wi.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE??wi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ei=Ti==null?null:`H`in Ti?{get current(){return Ti.H},set current(e){Ti.H=e}}:`ReactCurrentDispatcher`in Ti?{get current(){return Ti.ReactCurrentDispatcher.current},set current(e){Ti.ReactCurrentDispatcher.current=e}}:null;function Di(e){if(!Ei)return e();let t=Ei.current;Ei.current=Ci;try{return e()}finally{Ei.current=t}}function Oi(e,t,n=void 0,r){return{hook:e,root:t,markDirty:n,devStrictMode:r,cells:[],effectCells:[],insertionCells:null,hostCells:null,contextDeps:null,wipContextDeps:null,wipCommitCallbacks:null,memoCache:{current:null,workInProgress:null,refreshedIndices:null,index:0},renderPendingCells:null,currentIndex:0,isRefreshing:!1,isFirstRender:!0,isMounted:!1,isReleased:!1,isNeverMounted:!0}}function ki(e){e.wipCommitCallbacks=null,e.wipContextDeps=null,e.memoCache.workInProgress=null,e.memoCache.refreshedIndices=null}function Ai(e,t,n){try{t?(e.isReleased=!0,e.insertionCells!==null&&Si(e.insertionCells)):e.isMounted&&(e.isMounted=!1,Si(e.effectCells))}catch(e){(n??=[]).push(e)}if(e.hostCells!==null){for(let r of e.hostCells)if(r.fiber!==null&&(n=Ai(r.fiber,t,n)),r.fibers!==null)for(let{fiber:e}of r.fibers.values())n=Ai(e,t,n)}return n}function ji(e,t=!0){let n;t&&(n=Ai(e,!0,n)),n=Ai(e,!1,n),n!==void 0&&ai(n,`Errors during cleanup`)}function Mi(e){let t;for(let n of e)n.isReleased&&(t=Ai(n,!0,t));for(let n of e)t=Ai(n,!1,t);t!==void 0&&ai(t,`Errors during cleanup`)}function V(e,t){if(e.renderPendingCells!==null){for(let t of e.renderPendingCells)t.renderQueue=null;e.renderPendingCells.clear()}let n=0,r,i=e.isRefreshing;e.isRefreshing=i||(En()?.isRefreshing??!1);try{do{if(++n>25)throw Error(`Too many re-renders. tap limits the number of renders to prevent an infinite loop.`);e.memoCache.index=0,wn(e,()=>{r=Di(()=>e.hook(...t))})}while((e.renderPendingCells?.size??0)>0)}catch(t){throw ki(e),t}finally{e.isRefreshing=i}return ur(e),r}function Ni(e){let t=e.wipCommitCallbacks;e.wipCommitCallbacks=null;let n=Dn&&!e.isMounted&&e.devStrictMode===`root`;e.isMounted=!0,e.isNeverMounted=!1,t!==null&&(e.contextDeps=e.wipContextDeps,kn(e.root),e.memoCache.workInProgress!==null&&(e.memoCache.current=e.memoCache.workInProgress,e.memoCache.workInProgress=null,e.memoCache.refreshedIndices=null),_i(t)),n&&(xi(e,t!==null),ji(e,!1),e.isMounted=!0),xi(e,!n&&t!==null)}var Pi=()=>{let e=Tn();return e.devStrictMode?e.isFirstRender?`child`:`root`:null},Fi=()=>`child`,Ii=()=>null,Li=()=>{if(!Dn)return Ii;let e=R(0);return L(()=>e.current++),e.current===2?Fi:Ii},Ri=()=>En()?Pi:Li(),zi=e=>{let t=Tn(),n=t.currentIndex++,r=t.cells[n],i;if(r===void 0){t.isFirstRender||Hn();let r=e instanceof Map;i={type:`host`,fiber:r?null:e,fibers:r?e:null},t.cells[n]=i,(t.hostCells??=[]).push(i)}else r.type!==`host`&&Un(),i=r;return i.fibers===null&&i.fiber!==e&&Mn(t,()=>{i.fiber=e}),i},Bi=(e,t)=>{if(!(e instanceof Map))return t(e);for(let{fiber:n}of e.values())t(n)},Vi=e=>{e.isReleased=!1},Hi=e=>{e.isReleased=!0,e.isMounted||queueMicrotask(()=>{e.isReleased&&ji(e,!0)})},Ui=e=>{Jr(()=>(Bi(e,Vi),()=>Bi(e,Hi)),[e]),z(()=>()=>{Mi(e instanceof Map?Array.from(e.values(),({fiber:e})=>e):[e])},[e])},Wi=e=>En()?zi(e):(Ui(e),null),Gi=()=>{let e=R(0),t=e.current,n=Tn();return{version:t,markDirty:Hr(()=>()=>{e.current++,n.markDirty?.()},[n]),root:n.root}},Ki=()=>{let[e]=L(()=>On((e,t)=>{let i=!1;r(t=>(i=!e(),i?t:t+1)),i||n(()=>e()&&t())})),[t,n]=Vr((t,n)=>(An(e,t),t+ +!!n()),0),[,r]=L(0);return An(e,t),{root:e,version:t,markDirty:void 0}},qi=()=>{let e=Ri(),{root:t,version:n,markDirty:r}=En()?Gi():Ki();return{version:n,createFiber:Ur((n,i,a)=>Oi(n,t,a?()=>{a(),r?.()}:r,e()),[])}},Ji=e=>e(),Yi=e=>{let t=[];for(let n of e)try{n()}catch(e){t.push(e)}ai(t,`Errors occurred while notifying Tap root subscribers`)},Xi=(e,t,n)=>{let r=new ui(()=>s.handleUpdate()),i=[],a=On((e,t)=>{i.length===0&&!e()||(i.push(t),r.markDirty())}),o=Oi(Ji,a,void 0,t),s={scheduler:r,queue:i,fiber:o,subscribers:new Set,pendingHostRender:!1,isMounted:!1,hasRendered:!1,committedRender:e,context:new Map,value:void 0,applyQueue:()=>{An(a,a.committedVersion);for(let e of i)Dn&&o.devStrictMode&&e(),e();return An(a,a.committedVersion+a.changelog.length),i.length},publish:(e,t)=>{r.isDirty||a.committedVersion!==t||s.value===e||(s.value=e,fi(()=>Yi(s.subscribers)))},finishFlush:(e,t,n)=>{kn(a),i.splice(0,n),s.pendingHostRender=!1,i.length===0&&r.settle(),s.isMounted&&Ni(o),s.publish(e,t)},handleUpdate:()=>{let e=s.applyQueue(),t;try{Dn&&o.devStrictMode&&$n(s.context,()=>V(o,[s.committedRender])),t=$n(s.context,()=>V(o,[s.committedRender]))}catch(e){if(An(a,a.committedVersion),Er(e)){let t=()=>{s.isMounted&&r.markDirty()};e.then(t,t);return}if(s.isMounted){s.pendingHostRender=!0,n(e=>e+1);return}throw e}if(r.isDirty)throw Error(`Scheduler is dirty, this should never happen`);s.finishFlush(t,a.version,e)}};return s},Zi=e=>{let[,t]=L(0),n=Ri(),r=R(null),i=r.current??=Xi(e,n(),t),a=Qn(),o=i.scheduler.isDirty||i.pendingHostRender?i.applyQueue():0,s=$n(a,()=>V(i.fiber,[e])),c={render:e,context:a,value:s,drained:o,wip:i.fiber.wipCommitCallbacks,version:i.fiber.root.version,processed:!1};return i.hasRendered||(i.hasRendered=!0,i.committedRender=e,i.context=a,i.value=s),z(()=>(i.isMounted=!0,()=>{i.isMounted=!1}),[i]),Wi(i.fiber),z(()=>{if(c.processed){i.fiber.isMounted||(Ni(i.fiber),i.queue.length&&!i.scheduler.isDirty&&i.scheduler.markDirty());return}if(c.processed=!0,i.committedRender=c.render,i.context=c.context,i.fiber.wipCommitCallbacks!==c.wip){i.scheduler.isDirty||i.handleUpdate();return}if(c.drained>0&&i.fiber.root.version===c.version){i.finishFlush(c.value,c.version,c.drained);return}Ni(i.fiber),i.publish(c.value,c.version)}),Hr(()=>({getValue:()=>i.value,subscribe:e=>(i.subscribers.add(e),()=>i.subscribers.delete(e))}),[i])};function H(e){return(...t)=>({hook:e,args:t})}function U(e,t,n){return typeof t==`function`?(...n)=>U(e,t(...n)):n?{...t,key:e,deps:n}:{...t,key:e}}var Qi=(e,t)=>({fiber:e,key:t,currentDeps:null,current:null,wipDeps:null,wip:null});function $i(e){let{version:t,createFiber:n}=qi(),r=R(null),i=r.current??=Qi(n(e.hook,e.key),e.key),a=Hr(()=>i.fiber.hook===e.hook&&i.key===e.key&&!i.fiber.isReleased?i.fiber:n(e.hook,e.key),[i,e.hook,e.key,n]);i.wipDeps=i.currentDeps,i.wip=i.current;let o=[a,t,e.args];(En()?.isRefreshing||fr(a)||i.currentDeps===null||!br(i.currentDeps,o))&&(i.wipDeps=o,i.wip={value:V(a,e.args)});let s=i.wip,c=Wi(a);return z(()=>{if(i.currentDeps=i.wipDeps,i.current=i.wip,i.fiber=a,i.key=e.key,Ni(a),c!==null)return()=>{c.fiber!==a&&ji(a,!0)}},[i,c,a,e.key,s]),s.value}var ea=(e,t,n)=>{let r=R(null),i=r.current??={currentDeps:null,current:null},a=!n&&i.currentDeps&&br(i.currentDeps,t)?i.current:e();return z(()=>{i.currentDeps=t,i.current=a}),a},ta=(e,t)=>{let n=e.get(t);n&&(n.isDirty=!0)},na=(e,t)=>!e.isDirty&&!fr(e.fiber)&&t!==void 0&&e.committedDeps!==void 0&&br(e.committedDeps,t),ra=e=>{if(!dr())return!1;for(let{fiber:t}of e.values())if(fr(t))return!0;return!1};function ia(e){let[t]=L(()=>new Map),{version:n,createFiber:r}=qi(),i=En()?.isRefreshing??!1,a=ra(t),o=!1,s=ea(()=>{let n=new Set,a=[],s=0;for(let c=0;c<e.length;c++){let l=e[c],u=l.key;if(u===void 0)throw Error(`useResources did not provide a key for array at index ${c}`);if(n.has(u))throw Error(`Duplicate key ${u} in useResources`);n.add(u);let d=t.get(u);if(!d){let e=r(l.hook,l.key,()=>ta(t,u));d={fiber:e,next:{value:V(e,l.args),deps:l.deps},isDirty:!1,committedDeps:void 0,committedValue:void 0},s++,t.set(u,d)}else if(d.fiber.hook!==l.hook){let e=r(l.hook,l.key,()=>ta(t,u)),n=V(e,l.args);d.next={value:n,deps:l.deps,remount:e},o=!0}else if(!i&&na(d,l.deps))typeof d.next==`object`&&ki(d.fiber),d.fiber.contextDeps&&ur(d.fiber,d.fiber.contextDeps),d.next=`skip`;else{let e=V(d.fiber,l.args);d.next={value:e,deps:l.deps}}a.push(typeof d.next==`object`?d.next.value:d.committedValue)}if(t.size>a.length-s)for(let e of t.keys())n.has(e)||(t.get(e).next=`delete`,o=!0);return a},[e,t,r,n],i||a);return Wi(t),z(()=>{if(o){let e=[];for(let[n,r]of t.entries()){let i=r.next;i===`delete`?(e.push(r.fiber),t.delete(n)):i!==`skip`&&i.remount&&(e.push(r.fiber),r.fiber=i.remount)}for(let t of e)t.isReleased=!0;Mi(e)}for(let e of t.values()){let t=e.next;t===`skip`?!e.fiber.isNeverMounted&&!e.fiber.isMounted&&Ni(e.fiber):t!==`delete`&&(Ni(e.fiber),e.committedDeps=t.deps,e.committedValue=t.value,e.isDirty=!1,e.next=`skip`)}},[s,t,o]),i?s.slice():s}var aa=e=>e(),oa=e=>{let{createFiber:t}=qi(),[n]=L(()=>t(aa,void 0)),r=V(n,[e]);Wi(n);let i=!1,a=()=>{i&&n.isMounted||(i=!0,Ni(n))};return z(a),{value:r,effects:a}},sa=H(()=>{let e=F(4),[t,n]=L(ca),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(e,t)=>(n(n=>{let r=Vn(n.renderers);return r[e]=[...r[e]??[],t],{...n,renderers:r}}),()=>{n(n=>{let r=Vn(n.renderers),i=r[e]?.filter(e=>e!==t)??[];return i.length>0?r[e]=i:delete r[e],{...n,renderers:r}})}),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>(n(t=>({...t,fallbacks:[...t.fallbacks,e]})),()=>{n(t=>({...t,fallbacks:t.fallbacks.filter(t=>t!==e)}))}),e[1]=a):a=e[1];let o=a,s;return e[2]===t?s=e[3]:(s={getState:()=>t,setDataUI:i,setFallbackDataUI:o},e[2]=t,e[3]=s),s});function ca(){return{renderers:Vn(),fallbacks:[]}}var la=(e,t,n)=>{let r=e=>{console.error(`[assistant-ui] ${n} listener threw an error`,e)};for(let n of e)try{let e=n(typeof t==`function`?t():t);e!==null&&(typeof e==`object`||typeof e==`function`)&&`then`in e&&typeof e.then==`function`&&Promise.resolve(e).catch(r)}catch(e){r(e)}},ua=e=>e,da=new Set([`$$typeof`,`nodeType`,`then`,`__v_raw`,`__v_isRef`,`__v_isReactive`,`__v_isReadonly`,`__v_isShallow`,`__v_skip`]),fa=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!=`symbol`){if(e===`toJSON`)return()=>t;if(!da.has(e))return!1}},pa=class{getOwnPropertyDescriptor(e,t){let n=this.get(e,t);if(n!==void 0)return{value:n,writable:!1,enumerable:!0,configurable:!0}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}},ma=Symbol(`assistant-ui.store.clientId`),ha=Symbol(`assistant-ui.store.instanceTag`),ga=(e,t)=>{let n=new Proxy((()=>{}),{apply:()=>(t(),n),get:(n,r)=>r===`source`?e.source:r===`query`?e.query:r===`name`?e.name:r===ma?ba(t()):t()[r],has:(e,n)=>n===`source`||n===`query`||n===`name`||n===ma||n in t(),ownKeys:()=>Reflect.ownKeys(t()),getOwnPropertyDescriptor:(e,n)=>{if(!(typeof n==`symbol`||!(n in t())))return{value:t()[n],writable:!1,enumerable:!0,configurable:!0}}});return n},_a=(e,t)=>{let n=()=>{throw Error(e)};return new Proxy((()=>{}),{apply:n,get:(e,r)=>{if(r===`source`||r===`query`)return null;if(r===`name`)return t;if(r===ma)return n();let i=fa(r,`AssistantClientAccessor`);return i===!1?n():i},has:(e,t)=>t===`source`||t===`query`||t===`name`,ownKeys:()=>[],getOwnPropertyDescriptor:()=>void 0})},va=e=>e?.source!=null,ya=e=>e?.source===null,ba=e=>e[ma]??e,xa=e=>e[ha]??ba(e),Sa=e=>e===`optional`||e===`subscribe`||e===`on`||e===`__proto__`||typeof e==`symbol`,Ca=e=>{let t=[];for(let n in e)Sa(n)||t.push(n);return t},wa=class extends pa{#e;constructor(e){super(),this.#e=e}get(e,t){let n=fa(t,`OptionalAssistantClient`);if(n!==!1)return n;if(Sa(t))return;let r=this.#e[t];return va(r)?r:void 0}ownKeys(){return Ca(this.#e)}has(e,t){return!Sa(t)&&t in this.#e}},Ta=e=>new Proxy({},new wa(e)),Ea=()=>()=>{},Da=`You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.`,Oa=class extends pa{#e;#t;#n;#r;constructor(e,t,n){super(),this.#e=e,this.#t=t,this.#n=n}get(e,t){if(t===`subscribe`||t===`on`)return Ea;if(t===`optional`)return this.#r??=Ta(this.#n());let n=fa(t,this.#e);return n===!1?_a(this.#t(String(t)),String(t)):n}ownKeys(){return[`subscribe`,`on`,`optional`]}getOwnPropertyDescriptor(e,t){if(t!==`optional`)return super.getOwnPropertyDescriptor(e,t);let n=this.get(e,t);if(n!==void 0)return{value:n,writable:!1,enumerable:!1,configurable:!0}}has(e,t){return t===`subscribe`||t===`on`||t===`optional`}},ka=((e,t)=>{let n=new Proxy({},new Oa(e,t,()=>n));return n})(`DefaultAssistantClient`,()=>Da),Aa=()=>new Proxy({},{get(e,t){let n=fa(t,`AssistantClient`);return n===!1?_a(`The current scope does not have a "${String(t)}" property.`,String(t)):n}}),ja=ni(ka),Ma=()=>{},Na=new WeakMap,Pa=e=>Na.get(e)??Ma,Fa=(e,t)=>{Na.set(e,t)},Ia=()=>ii(ja),La=(e,t)=>ar(ja,e,t),Ra=Symbol(`assistant-ui.transform-scopes`);function za(e,t){let n=e;if(n[Ra])throw Error(`transformScopes is already attached to this resource`);n[Ra]=t}function Ba(e){return e[Ra]}var Va=e=>typeof e==`string`?{scope:e.split(`.`)[0],event:e}:{scope:e.scope,event:e.event},Ha=Symbol(`assistant-ui.store.clientIndex`),Ua=e=>e[Ha],Wa=ni([]),Ga=()=>ri(Wa),Ka=(e,t)=>{let n=F(3),r=Ga(),i;return n[0]!==e||n[1]!==r?(i=[...r,e],n[0]=e,n[1]=r,n[2]=i):i=n[2],ar(Wa,i,t)},qa=Symbol(`assistant-ui.store.getValue`),Ja=e=>{let t=e[qa];if(!t)throw Error(`Client scope contains a non-client resource. Ensure your Derived get() returns a client created with useClientResource(), not a plain resource.`);return t.getState?.()},Ya=new Map;function Xa(e){let t=Ya.get(e);return t||(t=function(...t){if(!this||typeof this!=`object`)throw Error(`Method "${String(e)}" called without proper context. This may indicate the function was called incorrectly.`);let n=this[qa];if(!n)throw Error(`Method "${String(e)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);let r=n[e];if(!r)throw Error(`Method "${String(e)}" is not implemented.`);if(typeof r!=`function`)throw Error(`"${String(e)}" is not a function.`);return r(...t)},Ya.set(e,t)),t}var Za=class extends pa{boundFns;cachedReceiver;outputRef;tagRef;index;self;constructor(e,t,n){super(),this.outputRef=e,this.tagRef=t,this.index=n}get(e,t,n){if(t===qa)return this.outputRef.current;if(t===Ha)return this.index;if(t===ma)return this.self;if(t===ha)return this.tagRef.current;let r=fa(t,`ClientProxy`);if(r!==!1)return r;let i=this.outputRef.current[t];if(typeof i==`function`){if(n===void 0)return i;(!this.boundFns||this.cachedReceiver!==n)&&(this.boundFns=new Map,this.cachedReceiver=n);let e=this.boundFns.get(t);return e||(e=Xa(t).bind(n),this.boundFns.set(t,e)),e}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(e,t){return t===qa||t===Ha||t===ma||t===ha||t in this.outputRef.current}},Qa=e=>{let t=R(null),n=R(null),r=Hr(()=>({}),[e.hook,e.key]),i=Ga().length,a=Hr(()=>{let e=new Za(t,n,i),r=new Proxy({},e);return e.self=r,r},[i]),o=Ka(a,function(){return $i(e)});return t.current||(t.current=o,n.current=r),z(()=>{t.current=o,n.current=r}),{methods:a,state:o.getState?.(),key:e.key}},$a=H(Qa),eo=0,to=0,no=e=>{eo++,to++;try{return e()}finally{to--,eo++}},ro=e=>{let t,n=new Map,r=-1,i=t=>{if(to===0)return Ja(e[t]());if(r!==eo)n.clear(),r=eo;else if(n.has(t))return n.get(t);let i=Ja(e[t]());return n.set(t,i),i};class a extends pa{get(t,n){let r=fa(n,`OptionalAssistantState`);if(r!==!1)return r;let a=n;if(!Sa(a)&&va(e[a]))return i(a)}ownKeys(){return Ca(e)}has(t,n){return!Sa(n)&&n in e}}class o extends pa{get(e,n){let r=fa(n,`AssistantState`);if(r!==!1)return r;if(n===`optional`)return t??=new Proxy({},new a);let o=n;if(!Sa(o))return i(o)}ownKeys(){return[...Ca(e),`optional`]}has(t,n){return n===`optional`||!Sa(n)&&n in e}}return new Proxy({},new o)},io=new WeakMap,ao=e=>{let t=io.get(e);return t||(t=ro(e),io.set(e,t)),t},oo=ni(null),so=Symbol(`aui.scope-effect-unapplied`),co=(e,t)=>ar(oo,e,t),W=()=>{let e=ri(oo);if(!e)throw Error(`AssistantTapContext is not available`);return e},G=()=>W().clientRef,lo=(e,t,n)=>{let r=F(8),{clientRef:i}=W(),a;r[0]!==i||r[1]!==t||r[2]!==e?(a=()=>{let n=i.current;if(n===null)throw Error(`useAssistantScopeEffect ran before the client was committed. This is likely an internal bug in assistant-ui.`);let r=()=>{let t=i.current?.[e];return t!==void 0&&va(t)?xa(t):void 0},a=so,o,s=e=>{if(o?.(),o=void 0,a=so,e!==void 0){let e=t();o=typeof e==`function`?e:void 0}a=e};s(r());let c=n.subscribe(()=>{let e=r();e!==a&&s(e)});return()=>{c(),o?.()}},r[0]=i,r[1]=t,r[2]=e,r[3]=a):a=r[3];let o;r[4]!==i||r[5]!==n||r[6]!==e?(o=[i,e,...n],r[4]=i,r[5]=n,r[6]=e,r[7]=o):o=r[7],z(a,o)},uo=()=>{let e=F(3),{emit:t}=W(),n=Ga(),r;return e[0]!==n||e[1]!==t?(r=(e,r)=>{t(e,r,n)},e[0]=n,e[1]=t,e[2]=r):r=e[2],Gr(r)},fo=ni(void 0),po=(e,t)=>{let n=ri(fo);return ar(fo,e??n,t)},mo=(e,t)=>{if(Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&Object.is(e[n],t[n]))},ho=Symbol(`assistant-ui.derived-hook`),go=e=>{e[ho]=!0},_o=e=>e[ho]===!0,vo=e=>{console.error(`NotificationManager: event listener error`,e)},yo=(e,t,n)=>{try{let r=e(t,n);r!==null&&(typeof r==`object`||typeof r==`function`)&&typeof r.then==`function`&&Promise.resolve(r).catch(vo)}catch(e){vo(e)}},bo=()=>{let e=new Map,t=new Set,n=new Set;return{on(n,r){let i=r;if(n===`*`)return t.add(i),()=>t.delete(i);let a=e.get(n);return a||(a=new Set,e.set(n,a)),a.add(i),()=>{a.delete(i),a.size===0&&e.get(n)===a&&e.delete(n)}},emit(n,r,i){!e.has(n)&&t.size===0||queueMicrotask(()=>{let a=e.get(n);if(a)for(let e of a)yo(e,r,i);if(t.size>0){let e={event:n,payload:r};for(let n of t)yo(n,e,i)}})},subscribe(e){return n.add(e),()=>n.delete(e)},notifySubscribers(){no(()=>{for(let e of n)try{e()}catch(e){console.error(`NotificationManager: subscriber callback error`,e)}})}}},xo=()=>L(bo)[0],So=()=>{let[e]=L(()=>({controller:new AbortController,generation:0}));return Jr(()=>{let t=++e.generation;return()=>queueMicrotask(()=>{e.generation===t&&e.controller.abort()})},[e]),e.controller.signal},Co=e=>{let t=Hr(()=>({}),[]);return t.v!==void 0&&mo(t.v,e)?t.v:(t.v=e,e)},wo=e=>{let t=F(2),n=R(void 0),r;return t[0]===e?r=t[1]:(r=t=>{let r=e(t);return n.current!==void 0&&mo(n.current,r)?n.current:(n.current=r,r)},t[0]=e,t[1]=r),r},To=(()=>{try{return!1}catch{return!1}})(),Eo=(e,t)=>{let n={...e},r=new Set,i=!0;for(;i;){i=!1;for(let e of Object.values(n)){if(r.has(e.hook))continue;r.add(e.hook);let a=Ba(e.hook);if(a){a(n,t),i=!0;break}}}return n},Do=e=>_o(e.hook),Oo=e=>{if(!Do(e))return{source:`root`,query:{}};let t=e.args[0];return{source:t.source,query:t.query??{}}},ko=Symbol.for(`aui.event-receiver-ref`),Ao=(e,t)=>{let n=e===ka?Aa():e,r=Object.create(n);Object.assign(r,t);let i;return Object.defineProperty(r,"optional",{get:()=>i??=Ta(r),enumerable:!1}),r},jo=({notifications:e,clientRef:t})=>Hr(()=>({subscribe:e.subscribe,on:function(n,r){if(!this)throw Error(`const { on } = useAui() is not supported. Use aui.on() instead.`);let{scope:i,event:a}=Va(n),o=n[ko];if(i!==`*`&&!o&&ya(this[i]))throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);let s=e.on(a,(e,n)=>{if(i===`*`)return r(e);let a=((o??t).current??this)[i];if(!va(a))return;let s=ba(a);if(s===n[Ua(s)])return r(e)});if(i!==`*`){if(o){if(t.parent===ka)return s}else if(ya(t.parent[i]))return s}let c=t.parent.on(n,r);return()=>{s(),c()}}}),[e,t]),Mo=e=>{let t=F(5),n;t[0]===e?n=t[1]:(n=Oo(e),t[0]=e,t[1]=n);let{source:r,query:i}=n,a=Co(i),o;return t[2]!==r||t[3]!==a?(o={source:r,query:a},t[2]=r,t[3]=a,t[4]=o):o=t[4],Co(o)},No=(e,t)=>{let n=F(3),r;return n[0]!==t||n[1]!==e?(r=t?e:$a(e),n[0]=t,n[1]=e,n[2]=r):r=n[2],$i(r)},Po=H((e,t)=>{let n=Ia(),r=Do(t),i=No(t,r),a=r?i:i.methods,o=Mo(t),s=Hr(()=>ga({name:e,...o},()=>a),[e,o,a]);return n[e]=s,s}),Fo=e=>{let t=F(2),n;return t[0]===e?n=t[1]:(n=e.map(Go),t[0]=e,t[1]=n),ia(n)},Io=(e,t)=>{let n=Co(t),r=Hr(()=>({}),[]);return r.deps!==n&&(r.deps=n,r.client=e),r.client},Lo=({parent:e,entries:t,clientRef:n,notifications:r})=>{let i=Ao(e,jo({notifications:r,clientRef:n}));return{client:Io(i,[e,...co(Hr(()=>({clientRef:n,emit:r.emit}),[n,r.emit]),function(){return La(i,function(){return Fo(t)})})])}},Ro=({parent:e,entries:t,destroySignal:n})=>{let r=R({parent:e,current:null}).current,{value:i,effects:a}=oa(function(){let i=xo(),{client:a}=po(n,function(){return Lo({parent:e,entries:t,clientRef:r,notifications:i})});return z(()=>e.subscribe(i.notifySubscribers),[e,i]),z(()=>i.notifySubscribers()),a});return Jr(()=>{r.parent=e,r.current=i},[i,e,r]),{client:i,effects:a}},zo=({parent:e,entries:t,destroySignal:n})=>{let r=R({parent:e,current:null}).current,{value:i,effects:a}=oa(function(){let i=xo(),a=Zi(function(){return po(n,function(){return Lo({parent:e,entries:t,clientRef:r,notifications:i})})}),o=Kr(a.subscribe,()=>a.getValue().client,()=>a.getValue().client);return z(()=>{let t=()=>gi(()=>{r.current=a.getValue().client,i.notifySubscribers()}),n=a.subscribe(t),o=e.subscribe(t);return()=>{n(),o()}},[a,e,i]),o});return Jr(()=>{r.parent=e,r.current=i},[i,e,r]),{client:i,effects:a}},Bo=(e,t,n,r)=>{let{get:i}=r.args[0],a=Kr(e.subscribe,()=>i(e),()=>i(e)),o=Mo(r),s=Hr(()=>ga({name:n,...o},()=>a),[n,o,a]);return t[n]=s,s},Vo=(e,t)=>{if(To){let[e]=L(()=>t.map(([e])=>e).join(`,`)),n=t.find(([,e])=>!Do(e));if(n)throw Error(`Scope "${n[0]}" is a root scope but this useAui mounted derived-only; remount with a new key to change scope kinds.`);let r=t.map(([e])=>e).join(`,`);if(r!==e)throw Error(`A derived-only config mounted scopes [${e}] but now has [${r}]; remount with a new key to change the scope set.`)}let n=R({parent:e,current:null}).current,r=Ao(e,{subscribe:e.subscribe,on:function(t,r){if(!this)throw Error(`const { on } = useAui() is not supported. Use aui.on() instead.`);let{scope:i,event:a}=Va(t);if(i===`*`)return e.on(t,r);let o=t[ko];if(!o&&ya(this[i]))throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);return e.on({scope:i,event:a,[ko]:o??n},r)}}),i=Io(r,[e,...t.map(([t,n])=>Bo(e,r,t,n))]);return Jr(()=>{n.parent=e,n.current=i},[i,e,n]),i},Ho=(e,t)=>{let n=F(8),r;n[0]!==t||n[1]!==e?(r=Object.entries(Eo(t,e)),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i=r,a;n[3]===i?a=n[4]:(a=()=>i.length===0||i.some(Ko),n[3]=i,n[4]=a);let[o]=L(a),s;return n[5]!==i||n[6]!==o?(s={entries:i,rooted:o},n[5]=i,n[6]=o,n[7]=s):s=n[7],s},Uo=(e,t,n,r)=>{let{entries:i,rooted:a}=Ho(e,t);return a?n({parent:e,entries:i,destroySignal:r}):{client:Vo(e,i)}},Wo=(e,t,n)=>Uo(e,t,Ro,n);function K(e){let t=Ia();if(e){let{client:n,effects:r}=Uo(t,e,zo,So());return r&&Fa(n,r),n}return t}function Go(e){let[t,n]=e;return U(t,Po(t,n))}function Ko(e){let[,t]=e;return!Do(t)}var q=e=>{let t=F(6),n=K(),r;t[0]===n?r=t[1]:(r=ao(n),t[0]=n,t[1]=r);let i=r,a,o;t[2]!==i||t[3]!==e?(a=()=>e(i),o=()=>e(i),t[2]=i,t[3]=e,t[4]=a,t[5]=o):(a=t[4],o=t[5]);let s=Kr(n.subscribe,a,o);if(typeof s==`object`&&s&&(s===i||s===i.optional))throw Error(`You tried to return the entire AssistantState. This is not supported due to technical limitations.`);return qr(s),s},qo=e=>{let t=F(3),{get:n}=e,r=K(),i;return t[0]!==r||t[1]!==n?(i=()=>n(r),t[0]=r,t[1]=n,t[2]=i):i=t[2],q(i)};go(qo);var Jo=H(qo),Yo=e=>{if(e.key===void 0)throw Error(`useClientLookup: Element has no key`);return e.key};function Xo(e){let t=F(12),n;t[0]===e?n=t[1]:(n=e.map($o),t[0]=e,t[1]=n);let r=ia(n),i;t[2]===e?i=t[3]:(i=e.reduce(Qo,Object.create(null)),t[2]=e,t[3]=i);let a=i,o;t[4]===r?o=t[5]:(o=r.map(Zo),t[4]=r,t[5]=o);let s=o,c;t[6]!==a||t[7]!==r?(c=e=>{if(`index`in e){if(e.index<0||e.index>=r.length)throw Error(`useClientLookup: index ${e.index} out of bounds (length: ${r.length}) (ignore if recovered)`);return r[e.index].methods}let t=a[e.key];if(t===void 0)throw Error(`useClientLookup: key "${e.key}" not found (ignore if recovered)`);return r[t].methods},t[6]=a,t[7]=r,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l={state:s,get:c},t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Zo(e){return e.state}function Qo(e,t,n){return e[Yo(t)]=n,e}function $o(e){return U(Yo(e),$a(e),e.deps)}var es=(e,t=0)=>t===0?Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)<=1||e.scrollHeight<=e.clientHeight:e.scrollHeight-t-e.scrollTop-e.clientHeight<=1||e.scrollHeight-t<=e.clientHeight,ts=(e,t=0)=>t===0?e.scrollHeight>e.clientHeight+1:e.scrollHeight-t>e.clientHeight+1,ns=(e,t)=>e.scrollTop>t.scrollTop&&e.scrollHeight===t.scrollHeight,rs=Symbol(`skip-update`),is=(e,...t)=>{let n=[];for(let r of e)try{r(...t)}catch(e){n.push(e)}if(n.length===1)throw n[0];if(n.length>1){for(let e of n)console.error(e);throw AggregateError(n)}},as=e=>{is(e)},os=(e,t)=>{try{e()}catch(e){console.error(`[assistant-ui] Subscription rollback cleanup threw`,e)}throw t},ss=(e,t)=>e===void 0||t===void 0?e===t:mo(e,t),cs=class{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){is(this._subscribers)}},ls=class extends cs{_state;constructor(e){super(),this._state=e,this.subscribe=this.subscribe.bind(this),this.getState=this.getState.bind(this),this.getServerSnapshot=()=>e}getState(){return this._state}getServerSnapshot;setState(e){Object.is(e,this._state)||(this._state=e,this._notifySubscribers())}},us=class{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(e,t){if(t){la(this._subscriptions,e,t);return}is(this._subscriptions,e)}_updateConnection(){if(this._subscriptions.size>0){if(this._connection)return;this._connection=this._connect()}else{let e=this._connection;this._connection=void 0,e?.()}}subscribe(e){this._subscriptions.add(e);try{this._updateConnection()}catch(t){throw this._subscriptions.delete(e),t}return()=>{this._subscriptions.delete(e),this._updateConnection()}}},ds=class extends us{get path(){return this.binding.path}binding;constructor(e){super(),this.binding=e;let t=e.getState();if(t===rs)throw Error(`Entry not available in the store`);this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return e===rs||ss(e,this._previousState)?!1:(this._previousState=e,!0)}_connect(){let e=this.binding.subscribe(()=>{this._syncState()&&this.notifySubscribers()});try{return this._syncState(),e}catch(t){throw os(e,t)}}},fs=class extends us{get path(){return this.binding.path}binding;constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==rs&&(this._previousState===void 0||!ss(e,this._previousState))&&(this._previousState=e),this._previousStateDirty=!1}if(this._previousState===void 0)throw Error(`Entry not available in the store`);return this._previousState};_connect(){let e=this.binding.subscribe(()=>{this._previousStateDirty=!0,this.notifySubscribers()});return this._previousStateDirty=!0,e}},ps=class extends us{get path(){return this.binding.path}binding;constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=()=>{let r=this.binding.getState();if(r===t)return;t=r;let i=n;n=void 0;try{i?.()}finally{n=r?.subscribe(e),e()}},i;try{i=this.outerSubscribe(r)}catch(e){throw os(()=>n?.(),e)}return()=>as([()=>i(),()=>n?.()])}},ms=class extends us{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=`Runtime event "${this.config.event}"`,t=t=>{this.notifySubscribers(t,e)},n=this.config.binding.getState(),r=n?.unstable_on(this.config.event,t),i=()=>{let e=this.config.binding.getState();if(e===n)return;n=e;let i=r;r=void 0;try{i?.()}finally{r=e?.unstable_on(this.config.event,t),this.config.notifyOnRebind&&t({})}},a;try{a=this.outerSubscribe(i)}catch(e){throw os(()=>r?.(),e)}return()=>as([()=>a(),()=>r?.()])}},hs=e=>{if(!e.overwrite)return e;let{overwrite:t,...n}=e;return n},gs=e=>{let t=Array.from(e).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)),n=Vn();return t.reduce((e,t)=>{let r=t.priority??0;if(t.system&&(e.system?e.system+=`\n\n${t.system}`:e.system=t.system),t.tools)for(let[i,a]of Object.entries(t.tools)){let t=e.tools!==void 0&&Object.hasOwn(e.tools,i)?e.tools[i]:void 0;if(t&&t!==a){let o=n[i];if(o===r){if(!a.overwrite)throw Error(`You tried to define a tool with the name ${i}, but it already exists.`);e.tools[i]=hs(a);continue}let s=o>r?t:a,c=o>r?a:t;e.tools[i]=hs({...c,...s}),n[i]=Math.max(o,r);continue}e.tools||=Vn(),e.tools[i]=hs(a),Object.hasOwn(n,i)||(n[i]=r)}return t.config&&(e.config={...t.config,...e.config}),t.callSettings&&(e.callSettings={...t.callSettings,...e.callSettings}),t.unstable_composerMetadata&&(e.unstable_composerMetadata={...t.unstable_composerMetadata,...e.unstable_composerMetadata}),e},{})},_s=class{_providers=new Map;_providerUnsubscribes=new Map;getModelContext(){return gs(new Set(this._providers.values()))}registerModelContextProvider(e){let t=Symbol();this._providers.set(t,e);let n;try{n=e.subscribe?.(()=>{this.notifySubscribers()})}catch(e){this._providers.delete(t);try{this.notifySubscribers()}catch(e){console.error(e)}throw e}this._providerUnsubscribes.set(t,n),this.notifySubscribers();let r=!1;return()=>{if(r)return;r=!0,this._providers.delete(t);let e=this._providerUnsubscribes.get(t);this._providerUnsubscribes.delete(t);let n=!1,i,a=e=>{try{e()}catch(e){n?console.error(e):(n=!0,i=e)}};if(e&&a(e),a(()=>this.notifySubscribers()),n)throw i}}_subscribers=new Set;notifySubscribers(){is(this._subscribers)}subscribe(e){return this._subscribers.add(e),()=>{this._subscribers.delete(e)}}},vs=(e,t)=>e.length===t.length&&e.every((e,n)=>Object.is(e,t[n])),ys=(e,t)=>{let[n]=L(()=>({pending:void 0}));z(()=>{let r=n.pending;n.pending=void 0;let i;return r!==void 0&&vs(r.deps,t)?i=r:(r?.cleanup?.(),i={deps:t,cleanup:e()}),()=>{n.pending=i,queueMicrotask(()=>{n.pending===i&&(n.pending=void 0,i.cleanup?.())})}},t)},bs=[],xs={modelName:void 0,toolNames:bs},Ss=(e,t)=>e===t||mo(e,t),Cs=(e,t)=>{let n=e.getModelContext(),r=n.config?.modelName,i=n.tools?Object.keys(n.tools).sort():bs,a=i.length?i:bs;return r===t.modelName&&Ss(a,t.toolNames)?t:{modelName:r,toolNames:a}},ws=H(()=>{let e=F(11),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=new _s,e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Cs(n,xs),e[1]=r):r=e[1];let[i,a]=L(r),o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(a(e=>Cs(n,e)),n.subscribe(()=>{a(e=>Cs(n,e))})),s=[n],e[2]=o,e[3]=s):(o=e[2],s=e[3]),z(o,s);let c;e[4]===i?c=e[5]:(c=()=>Cs(n,i),e[4]=i,e[5]=c);let l,u,d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>n.getModelContext(),u=e=>n.subscribe(e),d=e=>n.registerModelContextProvider(e),e[6]=l,e[7]=u,e[8]=d):(l=e[6],u=e[7],d=e[8]);let f;return e[9]===c?f=e[10]:(f={getState:c,getModelContext:l,subscribe:u,register:d},e[9]=c,e[10]=f),f}),Ts=(e,t)=>{if(t.status?.type!==`running`&&t.status?.type!==`requires-action`){let n=e.complete;return typeof n==`function`?n({args:t.args,result:t.result}):n??null}let n=e.running;return typeof n==`function`?n({args:t.args}):n??null},Es=e=>e.display===void 0?e.type===`human`:e.display===`standalone`,Ds=e=>function(t){return Ts(e,t)},Os=e=>{let t=F(16),{toolkit:n,mcpApp:r}=e,i;t[0]===r?i=t[1]:(i=r?[U(`mcpApp`,r)]:[],t[0]=r,t[1]=i);let a=ia(i)[0],[o,s]=L(As),c;t[2]!==a||t[3]!==o?(c={toolUIs:o,mcpApp:a},t[2]=a,t[3]=o,t[4]=c):c=t[4];let l=c,u=G(),d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(e,t,n)=>{let r={render:t,renderText:n?.renderText,standalone:n?.standalone??!1};return s(t=>{let n=Vn(t);return n[e]=[...n[e]??[],r],n}),()=>{s(t=>{let n=t[e]?.filter(e=>e!==r)??[],i=Vn(t);return n.length>0?(i[e]=n,i):(delete i[e],i)})}},t[5]=d):d=t[5];let f=d,p,m;t[6]===n?(p=t[7],m=t[8]):(p=()=>{if(!n)return;let e=[];for(let[t,r]of Object.entries(n)){let n=`render`in r?r.render:void 0,i=`renderText`in r?r.renderText:void 0,a=n??(i?Ds(i):void 0);a&&e.push(f(t,a,{standalone:Es(r),renderText:i}))}return()=>as(e)},m=[n,f],t[6]=n,t[7]=p,t[8]=m),z(p,m);let h;t[9]!==u||t[10]!==n?(h=()=>{if(!n)return;let e=Object.entries(n).reduce(js,Vn());return u.current.modelContext().register({getModelContext:()=>({tools:e})})},t[9]=u,t[10]=n,t[11]=h):h=t[11];let g;t[12]===n?g=t[13]:(g=[n],t[12]=n,t[13]=g),lo(`modelContext`,h,g);let _;return t[14]===l?_=t[15]:(_={getState:()=>l,setToolUI:f},t[14]=l,t[15]=_),_},ks=H(Os);za(Os,(e,t)=>{!e.modelContext&&t.modelContext.source===null&&(e.modelContext=ws())});function As(){return Vn()}function js(e,t){let[n,r]=t;if(r.type===`mcp`)return e;let{display:i,render:a,renderText:o,...s}=r;return e[n]=s,e}var Ms=e=>Kr(e.subscribe,e.getState,e.getServerSnapshot),Ns=Symbol.for(`assistant-ui.silent-runtime-action`),Ps=e=>typeof e==`object`&&!!e&&Ns in e,Fs=(e,t)=>{let n=t();return n.catch(t=>{Ps(t)||console.error(`[assistant-ui] ${e} failed:`,t)}),n},Is=H(e=>{let t=F(9),{runtime:n}=e,r=Ms(n),i;t[0]===r?i=t[1]:(i=()=>r,t[0]=r,t[1]=i);let a,o;t[2]===n?(a=t[3],o=t[4]):(a=()=>Fs(`attachment remove`,n.remove),o=()=>n,t[2]=n,t[3]=a,t[4]=o);let s;return t[5]!==i||t[6]!==a||t[7]!==o?(s={getState:i,remove:a,__internal_getRuntime:o},t[5]=i,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}),Ls=H(e=>{let t=F(5),{runtime:n,index:r}=e,i;t[0]!==r||t[1]!==n?(i=n.getAttachmentByIndex(r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=Is({runtime:a}),t[3]=a,t[4]=o),$i(o)}),Rs=H(({item:e,onMove:t,onRemove:n})=>({getState:()=>e,steer:()=>t({lane:`steer`,insertAfter:null}),move:t,remove:n})),zs=H(e=>{let t=F(65),{threadIdRef:n,messageIdRef:r,runtime:i,isSuggestion:a}=e,o=Ms(i),s=uo(),c=R(!1),l,u;t[0]!==s||t[1]!==r||t[2]!==i||t[3]!==n?(l=()=>{let e=[],t=i.unstable_on(`send`,e=>{let t=c.current;c.current=!1,s(`composer.send`,{threadId:n.current,...r&&{messageId:r.current},chars:e.chars,attachments:e.attachments,...t?{suggestion:!0}:void 0})});e.push(t);let a=i.unstable_on(`attachmentAdd`,e=>{s(`composer.attachmentAdd`,{threadId:n.current,...r&&{messageId:r.current},...e.contentType?{contentType:e.contentType}:void 0})});return e.push(a),e.push(i.unstable_on(`attachmentAddError`,e=>{s(`composer.attachmentAddError`,{threadId:n.current,...r&&{messageId:r.current},...e.attachmentId&&{attachmentId:e.attachmentId},reason:e.reason,message:e.message,...e.contentType?{contentType:e.contentType}:void 0})})),()=>as(e)},u=[i,s,n,r],t[0]=s,t[1]=r,t[2]=i,t[3]=n,t[4]=l,t[5]=u):(l=t[4],u=t[5]),z(l,u);let d;if(t[6]!==i||t[7]!==o.attachments){let e;t[9]===i?e=t[10]:(e=(e,t)=>U(e.id,Ls({runtime:i,index:t}),[i,t]),t[9]=i,t[10]=e),d=o.attachments.map(e),t[6]=i,t[7]=o.attachments,t[8]=d}else d=t[8];let f=Xo(d),p=o.queue,m;if(t[11]!==p||t[12]!==i){let e;t[14]===i?e=t[15]:(e=e=>U(e.id,Rs({item:e,onMove:t=>i.moveQueueItem(e.id,t),onRemove:()=>i.removeQueueItem(e.id)})),t[14]=i,t[15]=e),m=p.map(e),t[11]=p,t[12]=i,t[13]=m}else m=t[13];let h=Xo(m),g=o.type??`thread`,_;t[16]!==f.state||t[17]!==p||t[18]!==o.attachmentAccept||t[19]!==o.canCancel||t[20]!==o.canSend||t[21]!==o.dictation||t[22]!==o.inTransit||t[23]!==o.isEditing||t[24]!==o.isEmpty||t[25]!==o.quote||t[26]!==o.role||t[27]!==o.runConfig||t[28]!==o.submission||t[29]!==o.text||t[30]!==g?(_={text:o.text,role:o.role,attachments:f.state,runConfig:o.runConfig,isEditing:o.isEditing,canCancel:o.canCancel,canSend:o.canSend,attachmentAccept:o.attachmentAccept,isEmpty:o.isEmpty,type:g,dictation:o.dictation,quote:o.quote,queue:p,submission:o.submission,inTransit:o.inTransit},t[16]=f.state,t[17]=p,t[18]=o.attachmentAccept,t[19]=o.canCancel,t[20]=o.canSend,t[21]=o.dictation,t[22]=o.inTransit,t[23]=o.isEditing,t[24]=o.isEmpty,t[25]=o.quote,t[26]=o.role,t[27]=o.runConfig,t[28]=o.submission,t[29]=o.text,t[30]=g,t[31]=_):_=t[31];let v=_,y;t[32]===v?y=t[33]:(y=()=>v,t[32]=v,t[33]=y);let b;t[34]!==a||t[35]!==i?(b=e=>{let t=i.getState();c.current=t.canSend&&(a?.(t.text)??!1),i.send(e)},t[34]=a,t[35]=i,t[36]=b):b=t[36];let x;t[37]!==s||t[38]!==r||t[39]!==i||t[40]!==n?(x=()=>{!r&&i.getState().canCancel&&s(`composer.cancel`,{threadId:n.current}),i.cancel()},t[37]=s,t[38]=r,t[39]=i,t[40]=n,t[41]=x):x=t[41];let S=i.beginEdit??Bs,C;t[42]===f?C=t[43]:(C=e=>`id`in e?f.get({key:e.id}):f.get(e),t[42]=f,t[43]=C);let w;t[44]===h?w=t[45]:(w=e=>`id`in e?h.get({key:e.id}):h.get(e),t[44]=h,t[45]=w);let T;t[46]===i?T=t[47]:(T=()=>i,t[46]=i,t[47]=T);let E;return t[48]!==i.addAttachment||t[49]!==i.clearAttachments||t[50]!==i.reset||t[51]!==i.setQuote||t[52]!==i.setRole||t[53]!==i.setRunConfig||t[54]!==i.setText||t[55]!==i.startDictation||t[56]!==i.stopDictation||t[57]!==S||t[58]!==C||t[59]!==w||t[60]!==T||t[61]!==y||t[62]!==b||t[63]!==x?(E={getState:y,setText:i.setText,setRole:i.setRole,setRunConfig:i.setRunConfig,addAttachment:i.addAttachment,reset:i.reset,clearAttachments:i.clearAttachments,send:b,cancel:x,beginEdit:S,startDictation:i.startDictation,stopDictation:i.stopDictation,setQuote:i.setQuote,attachment:C,queueItem:w,__internal_getRuntime:T},t[48]=i.addAttachment,t[49]=i.clearAttachments,t[50]=i.reset,t[51]=i.setQuote,t[52]=i.setRole,t[53]=i.setRunConfig,t[54]=i.setText,t[55]=i.startDictation,t[56]=i.stopDictation,t[57]=S,t[58]=C,t[59]=w,t[60]=T,t[61]=y,t[62]=b,t[63]=x,t[64]=E):E=t[64],E});function Bs(){throw Error(`beginEdit is not supported in this runtime`)}var Vs=e=>({get current(){return e()}}),Hs=new WeakMap,Us=e=>{let t=Hs.get(e);if(t)return t;let n=new Map,r=e.map(e=>{let t=e.type===`tool-call`?e.toolCallId:`id`in e?e.id:void 0;if(!t)return;let r=`${e.type}:${t}`;return n.set(r,(n.get(r)??0)+1),r}),i=e.map((e,t)=>{let i=r[t];return i&&n.get(i)===1?i:`${e.type}@${t}`});return Hs.set(e,i),i},Ws=H(e=>{let t=F(17),{runtime:n}=e,r=Ms(n),i;t[0]===r?i=t[1]:(i=()=>r,t[0]=r,t[1]=i);let a,o,s;t[2]===n?(a=t[3],o=t[4],s=t[5]):(a=e=>n.addToolResult(e),o=e=>n.resumeToolCall(e),s=e=>n.respondToToolApproval(e),t[2]=n,t[3]=a,t[4]=o,t[5]=s);let c;t[6]===n.unstable_recordInteraction?c=t[7]:(c=n.unstable_recordInteraction&&{unstable_recordInteraction:e=>n.unstable_recordInteraction(e)},t[6]=n.unstable_recordInteraction,t[7]=c);let l;t[8]===n?l=t[9]:(l=()=>n,t[8]=n,t[9]=l);let u;return t[10]!==i||t[11]!==a||t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u={getState:i,addToolResult:a,resumeToolCall:o,respondToToolApproval:s,...c,__internal_getRuntime:l},t[10]=i,t[11]=a,t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}),Gs=H(e=>{let t=F(5),{runtime:n,index:r}=e,i;t[0]!==r||t[1]!==n?(i=n.getAttachmentByIndex(r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=Is({runtime:a}),t[3]=a,t[4]=o),$i(o)}),Ks=H(e=>{let t=F(5),{runtime:n,index:r}=e,i;t[0]!==r||t[1]!==n?(i=n.getMessagePartByIndex(r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=Ws({runtime:a}),t[3]=a,t[4]=o),$i(o)}),qs=H(e=>{let t=F(78),{runtime:n,threadIdRef:r,threadId:i,isLast:a}=e,o=Ms(n),s=uo(),[c,l]=L(!1),[u,d]=L(!1),f;t[0]===n?f=t[1]:(f=Vs(()=>n.getState().id),t[0]=n,t[1]=f);let p=f,m=R(o.status),h;t[2]!==s||t[3]!==n||t[4]!==i?(h=e=>{s(e,{threadId:i,messageId:n.getState().id})},t[2]=s,t[3]=n,t[4]=i,t[5]=h):h=t[5];let g=h,_,v;t[6]!==s||t[7]!==o.id||t[8]!==o.status||t[9]!==i?(_=()=>{let e=o.status,t=m.current;m.current=e,e?.type===`incomplete`&&e.reason===`error`&&(t?.type!==`incomplete`||t.reason!==`error`)&&s(`message.error`,{threadId:i,messageId:o.id,reason:`error`})},v=[o.status,o.id,s,i],t[6]=s,t[7]=o.id,t[8]=o.status,t[9]=i,t[10]=_,t[11]=v):(_=t[10],v=t[11]),z(_,v);let y;t[12]!==p||t[13]!==n.composer||t[14]!==r?(y=zs({runtime:n.composer,threadIdRef:r,messageIdRef:p}),t[12]=p,t[13]=n.composer,t[14]=r,t[15]=y):y=t[15];let b=Qa(y),x;if(t[16]!==n||t[17]!==o.content){let e;t[19]===n?e=t[20]:(e=(e,t)=>U(e,Ks({runtime:n,index:t}),[n,t]),t[19]=n,t[20]=e),x=Us(o.content).map(e),t[16]=n,t[17]=o.content,t[18]=x}else x=t[18];let S=Xo(x),C;t[21]===o.attachments?C=t[22]:(C=o.attachments??[],t[21]=o.attachments,t[22]=C);let w;if(t[23]!==n||t[24]!==C){let e;t[26]===n?e=t[27]:(e=(e,t)=>U(e.id,Gs({runtime:n,index:t}),[n,t]),t[26]=n,t[27]=e),w=C.map(e),t[23]=n,t[24]=C,t[25]=w}else w=t[25];let T=Xo(w),E=o,D;t[28]===a?D=t[29]:(D=a===!1?{isLast:a}:{},t[28]=a,t[29]=D);let O;t[30]!==b.state||t[31]!==c||t[32]!==u||t[33]!==S.state||t[34]!==D||t[35]!==E?(O={...E,...D,parts:S.state,composer:b.state,isCopied:c,isHovering:u},t[30]=b.state,t[31]=c,t[32]=u,t[33]=S.state,t[34]=D,t[35]=E,t[36]=O):O=t[36];let k=O,ee;t[37]===k?ee=t[38]:(ee=()=>k,t[37]=k,t[38]=ee);let te;t[39]===b.methods?te=t[40]:(te=()=>b.methods,t[39]=b.methods,t[40]=te);let ne;t[41]===n?ne=t[42]:(ne=()=>n.delete(),t[41]=n,t[42]=ne);let re,ie;t[43]!==g||t[44]!==n?(re=e=>(g(`message.reload`),n.reload(e)),ie=()=>(g(`message.speak`),n.speak()),t[43]=g,t[44]=n,t[45]=re,t[46]=ie):(re=t[45],ie=t[46]);let ae,A;t[47]===n?(ae=t[48],A=t[49]):(ae=()=>n.stopSpeaking(),A=e=>n.submitFeedback(e),t[47]=n,t[48]=ae,t[49]=A);let j;t[50]!==g||t[51]!==n?(j=e=>(g(`message.branchSwitched`),n.switchToBranch(e)),t[50]=g,t[51]=n,t[52]=j):j=t[52];let M;t[53]===n?M=t[54]:(M=()=>n.unstable_getCopyText(),t[53]=n,t[54]=M);let oe;t[55]!==S||t[56]!==o.content?(oe=e=>{if(`index`in e)return S.get({index:e.index});{let t=o.content.findIndex(t=>t.type===`tool-call`&&t.toolCallId===e.toolCallId);return S.get({index:t})}},t[55]=S,t[56]=o.content,t[57]=oe):oe=t[57];let se;t[58]===T?se=t[59]:(se=e=>`id`in e?T.get({key:e.id}):T.get(e),t[58]=T,t[59]=se);let ce;t[60]===g?ce=t[61]:(ce=e=>{e&&g(`message.copied`),l(e)},t[60]=g,t[61]=ce);let N;t[62]===n?N=t[63]:(N=()=>n,t[62]=n,t[63]=N);let P;return t[64]!==ee||t[65]!==te||t[66]!==ne||t[67]!==re||t[68]!==ie||t[69]!==ae||t[70]!==A||t[71]!==j||t[72]!==M||t[73]!==oe||t[74]!==se||t[75]!==ce||t[76]!==N?(P={getState:ee,composer:te,delete:ne,reload:re,speak:ie,stopSpeaking:ae,submitFeedback:A,switchToBranch:j,getCopyText:M,part:oe,attachment:se,setIsCopied:ce,setIsHovering:d,__internal_getRuntime:N},t[64]=ee,t[65]=te,t[66]=ne,t[67]=re,t[68]=ie,t[69]=ae,t[70]=A,t[71]=j,t[72]=M,t[73]=oe,t[74]=se,t[75]=ce,t[76]=N,t[77]=P):P=t[77],P}),Js=e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
12
|
+
|
|
13
|
+
`),Ys=Object.freeze({type:`complete`}),Xs=Object.freeze({type:`running`}),Zs=Object.freeze({cancelled:Object.freeze({type:`incomplete`,reason:`cancelled`}),length:Object.freeze({type:`incomplete`,reason:`length`}),"content-filter":Object.freeze({type:`incomplete`,reason:`content-filter`}),other:Object.freeze({type:`incomplete`,reason:`other`}),error:Object.freeze({type:`incomplete`,reason:`error`})}),Qs=e=>{let t=e.status;if(!t||typeof t!=`object`)return;let{type:n}=t;if(n===`running`)return Xs;if(n===`complete`)return Ys;if(n!==`incomplete`)return;let{reason:r}=t;return Zs[r===`cancelled`||r===`length`||r===`content-filter`||r===`other`||r===`error`?r:`other`]},$s=e=>e.interrupt!=null||e.approval!=null&&e.approval.approved===void 0&&e.approval.resolution===void 0,ec=(e,t,n)=>{if(e.role!==`assistant`)return Ys;if(n.type===`tool-call`)return n.result===void 0||n.isPreliminary||$s(n)?e.status:Ys;if(e.status.type===`running`){let e=Qs(n);if(e)return e}let r=t===Math.max(0,e.content.length-1);return e.status.type===`requires-action`?Ys:r?e.status:Ys},tc=H(e=>{let t=F(7),{type:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i={},t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o={isEditing:!1,isEmpty:!0,text:``,attachmentAccept:`*`,attachments:r,role:`user`,runConfig:i,canCancel:!1,canSend:!1,type:n,dictation:void 0,quote:void 0,queue:a,submission:void 0,inTransit:void 0},t[3]=n,t[4]=o);let s=o,c;return t[5]===s?c=t[6]:(c={getState:()=>s,setText:nc,setRole:rc,setRunConfig:ic,addAttachment:ac,clearAttachments:oc,attachment:sc,reset:cc,send:lc,cancel:uc,startDictation:dc,stopDictation:fc,beginEdit:pc,setQuote:mc,queueItem:hc},t[5]=s,t[6]=c),c});function nc(){throw Error(`Not supported`)}function rc(){throw Error(`Not supported`)}function ic(){throw Error(`Not supported`)}function ac(){throw Error(`Not supported`)}function oc(){throw Error(`Not supported`)}function sc(){throw Error(`Not supported`)}function cc(){throw Error(`Not supported`)}function lc(){throw Error(`Not supported`)}function uc(){throw Error(`Not supported`)}function dc(){throw Error(`Not supported`)}function fc(){throw Error(`Not supported`)}function pc(){throw Error(`Not supported`)}function mc(){throw Error(`Not supported`)}function hc(){throw Error(`Not supported`)}var gc=H(e=>{let t=F(8),{part:n,isMessageRunning:r}=e,i;t[0]!==r||t[1]!==n?(i=r?Qs(n)??Ys:Ys,t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;t[3]!==n||t[4]!==i?(a={...n,status:i},t[3]=n,t[4]=i,t[5]=a):a=t[5];let o=a,s;return t[6]===o?s=t[7]:(s={getState:()=>o,addToolResult:yc,resumeToolCall:bc,respondToToolApproval:xc,unstable_recordInteraction:Sc},t[6]=o,t[7]=s),s}),_c=H(({attachment:e})=>({getState:()=>e,remove:()=>{throw Error(`Not supported`)}})),vc=H(e=>{let t=F(38),{message:n,index:r,isLast:i,branchNumber:a,branchCount:o,submission:s}=e,c=i===void 0||i,l=a===void 0?1:a,u=o===void 0?1:o,[d,f]=L(!1),[p,m]=L(!1),h=n.role===`assistant`&&n.status.type===`running`,g,_;if(t[0]!==h||t[1]!==n.content){let e=Us(n.content);g=Xo,_=n.content.map((t,n)=>U(e[n],gc({part:t,isMessageRunning:h}),[t,h])),t[0]=h,t[1]=n.content,t[2]=g,t[3]=_}else g=t[2],_=t[3];let v=g(_),y;t[4]!==n.attachments||t[5]!==s?.attachments?(y=s?.attachments??n.attachments??[],t[4]=n.attachments,t[5]=s?.attachments,t[6]=y):y=t[6];let b;t[7]===y?b=t[8]:(b=y.map(Cc),t[7]=y,t[8]=b);let x=Xo(b),S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=tc({type:`edit`}),t[9]=S):S=t[9];let C=Qa(S),w=C.state,T;t[10]!==u||t[11]!==l||t[12]!==w||t[13]!==r||t[14]!==d||t[15]!==p||t[16]!==c||t[17]!==n||t[18]!==v.state||t[19]!==s?(T={...n,parts:v.state,composer:w,parentId:null,index:r,isLast:c,branchNumber:l,branchCount:u,speech:void 0,isCopied:d,isHovering:p,submission:s},t[10]=u,t[11]=l,t[12]=w,t[13]=r,t[14]=d,t[15]=p,t[16]=c,t[17]=n,t[18]=v.state,t[19]=s,t[20]=T):T=t[20];let E=T,D;t[21]===E?D=t[22]:(D=()=>E,t[21]=E,t[22]=D);let O;t[23]===C.methods?O=t[24]:(O=()=>C.methods,t[23]=C.methods,t[24]=O);let k;t[25]!==n.content||t[26]!==v?(k=e=>`index`in e?v.get({index:e.index}):v.get({index:n.content.findIndex(t=>t.type===`tool-call`&&t.toolCallId===e.toolCallId)}),t[25]=n.content,t[26]=v,t[27]=k):k=t[27];let ee;t[28]===x?ee=t[29]:(ee=e=>`id`in e?x.get({key:e.id}):x.get(e),t[28]=x,t[29]=ee);let te;t[30]===n?te=t[31]:(te=()=>Js(n),t[30]=n,t[31]=te);let ne;return t[32]!==D||t[33]!==O||t[34]!==k||t[35]!==ee||t[36]!==te?(ne={getState:D,composer:O,part:k,attachment:ee,delete:wc,reload:Tc,speak:Ec,stopSpeaking:Dc,submitFeedback:Oc,switchToBranch:kc,getCopyText:te,setIsCopied:f,setIsHovering:m},t[32]=D,t[33]=O,t[34]=k,t[35]=ee,t[36]=te,t[37]=ne):ne=t[37],ne});function yc(){throw Error(`Not supported`)}function bc(){throw Error(`Not supported`)}function xc(){throw Error(`Not supported`)}async function Sc(){}function Cc(e){return U(e.id,_c({attachment:e}),[e])}function wc(){throw Error(`Not supported in ThreadMessageProvider`)}function Tc(){throw Error(`Not supported in ThreadMessageProvider`)}function Ec(){throw Error(`Not supported in ThreadMessageProvider`)}function Dc(){throw Error(`Not supported in ThreadMessageProvider`)}function Oc(){throw Error(`Not supported in ThreadMessageProvider`)}function kc(){throw Error(`Not supported in ThreadMessageProvider`)}var Ac=((e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i-->0;)r+=e[Math.random()*e.length|0];return r})(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,7);function jc(e){let t=e.match(/^data:([^;,]*)(?:;[^;,]+)*;base64,(.*)$/i);return t?{mimeType:t[1].toLowerCase()||`text/plain`,data:t[2]}:null}function Mc(e){return/^data:([^;,]+)(?:[;,])/i.exec(e)?.[1]?.toLowerCase()}var Nc={entries:32,payloadLength:16384,logLength:65536},Pc=64,Fc=e=>{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Ic=(e,t,n)=>{if(e===null)return!0;switch(typeof e){case`string`:case`boolean`:return!0;case`number`:return Number.isFinite(e);case`object`:break;default:return!1}if(n>Pc||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(e=>Ic(e,t,n+1)):Fc(e)&&Object.values(e).every(e=>Ic(e,t,n+1));return t.delete(e),r},Lc=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Rc=e=>e===`action`||e===`human-response`;function zc(e,t=Date.now()){let{type:n,payload:r}=e;if(!Rc(n))throw Error(`Unknown tool interaction type: ${String(n)}`);if(!Ic(r,new Set,0))throw Error(`A tool interaction payload must be plain JSON.`);if(n===`action`&&!Lc(r))throw Error(`An action interaction payload must be a JSON object.`);let i=JSON.stringify(r);if(i.length>Nc.payloadLength)throw Error(`A tool interaction payload is limited to ${Nc.payloadLength} characters of JSON.`);return{type:n,occurredAt:t,payload:JSON.parse(i)}}function Bc(e,t){let n=[...e?.entries??[],t],r=e?.omitted??0;for(;n.length>1&&(n.length>Nc.entries||JSON.stringify(n).length>Nc.logLength);)n.shift(),r+=1;return r>0?{entries:n,omitted:r}:{entries:n}}var Vc=e=>{if(!Lc(e))return;let{type:t,occurredAt:n,payload:r}=e;if(Rc(t)&&!(typeof n!=`number`||!Number.isFinite(n))&&Ic(r,new Set,0))return t===`action`?Lc(r)?{type:t,occurredAt:n,payload:r}:void 0:{type:t,occurredAt:n,payload:r}};function Hc(e){if(!Lc(e))return;let{entries:t,omitted:n}=e,r=Array.isArray(t)?t.flatMap(e=>{let t=Vc(e);return t?[t]:[]}):[],i=typeof n==`number`&&Number.isInteger(n)&&n>0?n:0;for(;r.length>1&&(r.length>Nc.entries||JSON.stringify(r).length>Nc.logLength);)r.shift(),i+=1;if(r.length!==0||i!==0)return i>0?{entries:r,omitted:i}:{entries:r}}async function*Uc(){let e=this.getReader(),t=!0;try{for(;;){let n;try{n=await e.read()}catch(e){throw t=!1,e}if(n.done){t=!1;break}let{value:r}=n;yield r}}finally{try{t&&await e.cancel()}finally{e.releaseLock()}}}function Wc(e){return e[Symbol.asyncIterator]??=Uc,e}var Gc=/[0-9a-fA-F]/;function Kc(e){let t=[`ROOT`],n=-1,r=null,i=0,a=[],o;function s(){o!==void 0&&(a.push(JSON.parse(`"${o}"`)),o=void 0)}function c(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`),s();break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`),s();break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`),s();break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`),s();break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`),s()}}function l(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop(),o=a.pop()}}function u(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`),o=(Number(o)+1).toString();break;case`]`:n=r,t.pop(),o=a.pop()}}for(let s=0;s<e.length;s++){let d=e[s];switch(t[t.length-1]){case`ROOT`:c(d,s,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(d){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`),o=``;break;case`}`:n=s,t.pop(),o=a.pop()}break;case`INSIDE_OBJECT_AFTER_COMMA`:d===`"`&&(t.pop(),t.push(`INSIDE_OBJECT_KEY`),o=``);break;case`INSIDE_OBJECT_KEY`:switch(d){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`),o+=d;break;default:o+=d}break;case`INSIDE_OBJECT_AFTER_KEY`:d===`:`&&(t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`));break;case`INSIDE_OBJECT_BEFORE_VALUE`:c(d,s,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:l(d,s);break;case`INSIDE_STRING`:switch(d){case`"`:t.pop(),n=s,o=a.pop();break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=s}break;case`INSIDE_ARRAY_START`:switch(d){case`]`:n=s,t.pop(),o=a.pop();break;default:o=`0`,c(d,s,`INSIDE_ARRAY_AFTER_VALUE`)}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(d){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`),o=(Number(o)+1).toString();break;case`]`:n=s,t.pop(),o=a.pop();break;default:n=s}break;case`INSIDE_ARRAY_AFTER_COMMA`:c(d,s,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:{t.pop();let e=t[t.length-1];d===`u`?(t.push(`INSIDE_STRING_UNICODE_ESCAPE`),i=0):e===`INSIDE_STRING`&&(n=s),e===`INSIDE_OBJECT_KEY`&&(o+=d);break}case`INSIDE_STRING_UNICODE_ESCAPE`:{let e=t[t.length-2];if(!Gc.test(d)){t.pop(),s--;break}i++,i===4&&(t.pop(),e===`INSIDE_STRING`&&(n=s)),e===`INSIDE_OBJECT_KEY`&&(o+=d);break}case`INSIDE_NUMBER`:switch(d){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=s;break;case`e`:case`E`:case`-`:case`+`:case`.`:break;case`,`:t.pop(),o=a.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&u(d,s),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&l(d,s);break;case`}`:t.pop(),o=a.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&l(d,s);break;case`]`:t.pop(),o=a.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&u(d,s);break;default:t.pop(),o=a.pop()}break;case`INSIDE_LITERAL`:{let i=e.substring(r,s+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?l(d,s):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&u(d,s)):n=s;break}}}let d=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:d+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:d+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:d+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?d+=`true`.slice(t.length):`false`.startsWith(t)?d+=`false`.slice(t.length):`null`.startsWith(t)&&(d+=`null`.slice(t.length))}}return[d,a]}var qc=t(n(((e,t)=>{var n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o}))(),1),Jc=Symbol(`aui.parse-partial-json-object.meta`),Yc=e=>{if(e.length===0)return{[Jc]:{state:`partial`,partialPath:[]}};try{let t=qc.default.parse(e);if(typeof t!=`object`||!t)throw Error(`argsText is expected to be an object`);return t[Jc]={state:`complete`,partialPath:[]},t}catch{try{let[t,n]=Kc(e),r=qc.default.parse(t);if(typeof r!=`object`||!r)throw Error(`argsText is expected to be an object`);return r[Jc]={state:`partial`,partialPath:n},r}catch{return}}},Xc=((e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i-->0;)r+=e[Math.random()*e.length|0];return r})(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,7),Zc=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});if(!e||!t)throw Error(`Failed to create promise`);return{promise:n,resolve:e,reject:t}},Qc=()=>{let e=[],t=!1,n=!1,r=!1,i,a,o=0,s,c,l=()=>(a=void 0,c??=Promise.all(e.splice(0).map(async e=>{try{await e.reader.cancel().catch(()=>void 0),await e.pipeTask}finally{e.reader.releaseLock()}})).then(()=>void 0),c),u=e=>{n||r||(r=!0,console.error(e),l(),i.error(e),s?.reject(e),s=void 0)},d=a=>{a.promise||=a.reader.read().then(({done:c,value:l})=>{a.promise=void 0,!(n||r)&&(c?(e.splice(e.indexOf(a),1),a.reader.releaseLock(),t&&e.length===0&&o===0&&i.close()):i.enqueue(l),s?.resolve(),s=void 0)}).catch(u)},f=new ReadableStream({start(e){i=e},pull(){return s=Zc(),e.forEach(e=>{d(e)}),s.promise},async cancel(){n=!0;let e=l();s?.resolve(),s=void 0,await e}}),p=c=>{if(e.length>0&&(a=void 0),!a){let c=[];a=c,o++,Promise.resolve().then(()=>{if(o--,a===c&&(a=void 0),!(n||r)){for(let e of c)i.enqueue(e);t&&e.length===0&&o===0&&i.close(),s?.resolve(),s=void 0}}).catch(u)}a.push(c)};return{readable:f,isSealed(){return t},isCancelled(){return n},isErrored(){return r},seal(){t||n||r||(t=!0,e.length===0&&o===0&&i.close())},addStream:(i,o)=>{let s=o?.catch(()=>void 0);if(n||r){i.cancel().catch(()=>void 0);return}if(t)throw i.cancel().catch(()=>void 0),Error(`Cannot add streams after the run callback has settled.`);a=void 0;let c={reader:i.getReader(),pipeTask:s};e.push(c),d(c)},enqueue(e){if(!(n||r)){if(t)throw Error(`Cannot add streams after the run callback has settled.`);p(e)}}}},$c=(e,t)=>new ReadableStream({start(n){return e.start?.(t(n))},pull(n){return e.pull?.(t(n))},cancel(t){return e.cancel?.(t)}}),el=(e,t)=>{let n;return[$c({start(e){n=e},cancel(e){return t?.(n,e)}},e),n]},tl=e=>e instanceof TypeError,nl=(e,t,n)=>{try{e.enqueue(t)}catch(e){if(!tl(e))throw e;n?.(e)}},rl=e=>{try{e.close()}catch(e){if(!tl(e))throw e}},il=class{_controller;_strict;_isClosed=!1;_warnedDropped=!1;constructor(e,t={}){this._controller=e,this._strict=t.strict??!0}append(e){let t={type:`text-delta`,path:[],textDelta:e};if(this._isClosed){if(this._strict)throw TypeError(`Cannot append to a closed TextStreamController`);return nl(this._controller,t,this._warnDroppedAfterClose),this}return nl(this._controller,t),this}_warnDroppedAfterClose=e=>{this._warnedDropped||(this._warnedDropped=!0,console.error(`Dropped text delta for closed stream: ${String(e)}`))};close(){this._isClosed||(this._isClosed=!0,nl(this._controller,{type:`part-finish`,path:[]}),rl(this._controller))}},al=(e,t={})=>$c(e,e=>new il(e,t)),ol=(e={})=>el(t=>new il(t,e)),sl=Symbol.for(`aui.tool-response`),cl=`<no result>`,ll=class e{get[sl](){return!0}artifact;result;isError;isPreliminary;modelContent;messages;constructor(e){e.artifact!==void 0&&(this.artifact=e.artifact);let t=e.result;this.result=t===void 0?cl:t,this.isError=e.isError??!1,e.isPreliminary&&(this.isPreliminary=!0),e.modelContent!==void 0&&(this.modelContent=e.modelContent),e.messages!==void 0&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&sl in e}static toResponse(t){return t instanceof e?t:new e({result:t===void 0?cl:t})}},ul=class{_isClosed=!1;_mergeTask;_controller;constructor(e,t={}){this._controller=e;let n=al({start:e=>{this._argsTextController=e}},t),r=!1;this._mergeTask=n.pipeTo(new WritableStream({write:e=>{switch(e.type){case`text-delta`:r=!0,nl(this._controller,e);break;case`part-finish`:r||nl(this._controller,{type:`text-delta`,textDelta:`{}`,path:[]}),nl(this._controller,{type:`tool-call-args-text-finish`,path:[]});break;default:throw Error(`Unexpected chunk type: ${e.type}`)}}}))}get argsText(){return this._argsTextController}_argsTextController;async setResponse(e){if(this._isClosed)return;let t=e.result;nl(this._controller,{type:`result`,path:[],...e.artifact===void 0?{}:{artifact:e.artifact},result:t===void 0?cl:t,isError:e.isError??!1,...e.isPreliminary?{isPreliminary:!0}:{},...e.modelContent===void 0?{}:{modelContent:e.modelContent},...e.messages===void 0?{}:{messages:e.messages}}),e.isPreliminary?this._argsTextController.close():await this.close()}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,nl(this._controller,{type:`part-finish`,path:[]}),rl(this._controller))}},dl=(e={})=>el(t=>new ul(t,e)),fl=class{value=-1;up(){return++this.value}},pl=class extends TransformStream{constructor(e){super({transform(t,n){n.enqueue({...t,path:[e,...t.path]})}})}};TransformStream;var ml=class extends TransformStream{constructor(e){let t=new fl,n=new Map;super({transform(r,i){r.type===`part-start`&&r.path.length===0&&n.set(t.up(),e.up());let[a,...o]=r.path;if(a===void 0){i.enqueue(r);return}let s=n.get(a);if(s===void 0)throw Error(`Path not found`);i.enqueue({...r,path:[s,...o]})}})}},hl=class e{_state;_parentId;constructor(e,t={}){this._state=e||{strict:t.strict??!0,merger:Qc(),contentCounter:new fl}}get __internal_isClosed(){return this._state.merger.isSealed()||this._state.merger.isCancelled()||this._state.merger.isErrored()}get __internal_isCancelled(){return this._state.merger.isCancelled()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addTransformedStream(e,t){if(e.locked)throw TypeError(`Cannot merge a stream that is already locked to a reader.`);let n=e.pipeTo(t.writable).catch(async e=>{throw await t.writable.abort(e).catch(()=>void 0),e});this._state.merger.addStream(t.readable,n)}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:`part-start`,part:e,path:[]}),this._addTransformedStream(t,new pl(this._state.contentCounter.value))}merge(e){this._addTransformedStream(e,new ml(this._state.contentCounter))}appendText(e){(this._state.append?.kind!==`text`||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:`text`,parentId:this._parentId,controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e,t){(t!==void 0||this._state.append?.kind!==`reasoning`||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:`reasoning`,parentId:this._parentId,controller:this.addReasoningPart(t)}),(t===void 0||e.length!==0)&&this._state.append.controller.append(e)}addTextPart(){let[e,t]=ol({strict:this._state.strict});return this._addPart(this._withParentIdOption({type:`text`}),e),t}addReasoningPart(e){let[t,n]=ol({strict:this._state.strict});return this._addPart(this._withParentIdOption({type:`reasoning`,...e}),t),n}addToolCallPart(e){let t=typeof e==`string`?{toolName:e}:e,n=t.toolName,r=t.toolCallId??Xc(),[i,a]=dl({strict:this._state.strict});return this._addPart({type:`tool-call`,toolName:n,toolCallId:r,...this._parentId&&{parentId:this._parentId}},i),t.argsText!==void 0&&(a.argsText.append(t.argsText),a.argsText.close()),t.args!==void 0&&(a.argsText.append(JSON.stringify(t.args)),a.argsText.close()),t.response!==void 0&&a.setResponse(t.response),a}_finishedPartStream(){return new ReadableStream({start(e){e.enqueue({type:`part-finish`,path:[]}),e.close()}})}_withParentIdOption(e){return this._parentId?{...e,parentId:this._parentId}:e}appendSource(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendFile(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendData(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}enqueue(e){this._state.merger.enqueue(e),e.type===`part-start`&&e.path.length===0&&this._state.contentCounter.up()}withParentId(t){let n=new e(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function gl(e,t={}){let n=new hl(void 0,t);return(async()=>{try{await e(n)}catch(e){n.__internal_isClosed?n.__internal_isCancelled||console.error(e):n.enqueue({type:`error`,path:[],error:String(e)})}finally{n.__internal_isClosed||n.close()}})(),n.__internal_getReadable()}function _l(e={}){let{resolve:t,promise:n}=Zc(),r;return[gl(e=>(r=e,r.__internal_subscribeToClose(t),n),e),r]}var vl=class extends TransformStream{constructor(e,t,n){let[r,i]=_l({strict:e.strict}),a=new AbortController,o;super({start(t){o=r.pipeTo(new WritableStream({write(e){t.enqueue(e)},abort(e){t.error(e)},close(){t.terminate()}}),{signal:a.signal}).catch(e=>{t.error(e)});try{return e.start?.(i)}catch(e){throw a.abort(e),e}},transform(t){return e.transform?.(t,i)},async flush(){await e.flush?.(i),i.close(),await o}},t,n);let s=super.readable.getReader(),c=!1;Object.defineProperty(this,"readable",{value:new ReadableStream({start(e){s.closed.catch(t=>{a.abort(t),e.error(t),s.releaseLock()})},async pull(e){let t=await s.read();c||(t.done?(e.close(),s.releaseLock()):e.enqueue(t.value))},async cancel(e){c=!0;let t=s.cancel(e);a.abort(e);try{await t}finally{await o,s.releaseLock()}}},{highWaterMark:0}),writable:!1})}},yl=(e,t,n)=>{if(e.startsWith(`data-`))return{type:`data`,name:e.substring(5),data:t,...typeof n==`string`&&{id:n}}},bl=(e,t,n)=>{let{role:r,id:i,createdAt:a,attachments:o,status:s,metadata:c}=e,l={id:i??t,createdAt:a??new Date},u=typeof e.content==`string`?[{type:`text`,text:e.content}]:e.content,d=({image:e,...t})=>typeof e==`string`?jc(e)?.mimeType.startsWith(`image/`)||/^(https:\/\/|blob:)/i.test(e)?{...t,image:e}:(console.warn(`Invalid image data format detected`),null):null;if(r!==`user`&&o?.length)throw Error(`attachments are only supported for user messages`);if(r!==`assistant`&&s)throw Error(`status is only supported for assistant messages`);if(r!==`assistant`&&c?.steps)throw Error(`metadata.steps is only supported for assistant messages`);switch(r){case`assistant`:return{...l,role:r,content:u.map(e=>{let t=e.type;switch(t){case`text`:return e.text?.trim()?e:null;case`reasoning`:return!e.text?.trim()&&!e.unstable_summary?.trim()?null:e;case`file`:case`source`:return e;case`image`:return d(e);case`data`:return e;case`generative-ui`:return e;case`tool-call`:{let{parentId:t,messages:n,unstable_interactions:r,...i}=e,a=Hc(r),o={...i,toolCallId:e.toolCallId||`tool-${Ac()}`,...t!==void 0&&{parentId:t},...n!==void 0&&{messages:n},...a!==void 0&&{unstable_interactions:a}};return e.args?{...o,args:e.args,argsText:e.argsText??JSON.stringify(e.args)}:{...o,args:Yc(e.argsText??``)??{},argsText:e.argsText??``}}case`audio`:throw Error(`Unsupported assistant message part type: ${t}`);default:{let n=t,r=yl(n,e.data,e.id);if(r)return r;throw Error(`Unsupported assistant message part type: ${n}`)}}}).filter(e=>!!e),status:s??n,metadata:{unstable_state:c?.unstable_state??null,unstable_annotations:c?.unstable_annotations??[],unstable_data:c?.unstable_data??[],custom:c?.custom??{},steps:c?.steps??[],...c?.timing&&{timing:c.timing},...c?.submittedFeedback&&{submittedFeedback:c.submittedFeedback},...c?.isOptimistic&&{isOptimistic:!0},...c?.modality&&{modality:c.modality}}};case`user`:return{...l,role:r,content:u.map(e=>{let t=e.type;switch(t){case`text`:case`image`:case`audio`:case`file`:case`data`:return e;case`reasoning`:case`source`:case`generative-ui`:case`tool-call`:throw Error(`Unsupported user message part type: ${t}`);default:{let n=t,r=yl(n,e.data,e.id);if(r)return r;throw Error(`Unsupported user message part type: ${n}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>yl(e.type,e.data,`id`in e?e.id:void 0)??e)})),metadata:{custom:c?.custom??{},...c?.isOptimistic&&{isOptimistic:!0},...c?.modality&&{modality:c.modality}}};case`system`:if(u.length!==1||u[0].type!==`text`)throw Error(`System messages must have exactly one text message part.`);return{...l,role:r,content:u,metadata:{custom:c?.custom??{}}};default:throw Error(`Unknown message role: ${r}`)}},xl=e=>bl({role:e.role,content:e.role===`system`||e.text?[{type:`text`,text:e.text}]:[],attachments:[],metadata:{custom:{...e.quote?{quote:e.quote}:{}}}},e.id,{type:`complete`,reason:`unknown`}),Sl=e=>{let t=Hr(()=>({}),[]),n=t.state,r=[];e.suggestions.forEach(e=>{let t=n?.suggestions[r.length];r.push(t&&mo(t,e)?t:e)});let i=n&&mo(r,n.suggestions)?n:{suggestions:r};return t.state=i,i},Cl=H(e=>({getState:()=>e})),wl=e=>{let t=F(9),n=Sl(e),r;t[0]===n.suggestions?r=t[1]:(r=n.suggestions.map(El),t[0]=n.suggestions,t[1]=r);let i=Xo(r),a;t[2]===n?a=t[3]:(a=()=>n,t[2]=n,t[3]=a);let o;t[4]===i?o=t[5]:(o=e=>{let{index:t}=e;return i.get({index:t})},t[4]=i,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s={getState:a,suggestion:o},t[6]=a,t[7]=o,t[8]=s):s=t[8],s},Tl=H(e=>{let t=F(4),n;t[0]===e?n=t[1]:(n=e.map(Dl),t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r={suggestions:n},t[2]=n,t[3]=r),wl(r)});function El(e,t){return U(t,Cl(e),[e])}function Dl(e){return{title:e.title??e.prompt,label:e.label??``,prompt:e.prompt}}var Ol=e=>`reason`in e?e.reason:void 0,kl=e=>`error`in e?e.error:void 0,Al=32,jl=new WeakMap,Ml=e=>jl.get(e)??e.id,Nl=(e,t,n)=>`status`in e&&e.status?ec(e,t,n):Ys,Pl=()=>{let e=[],t=new Map;return n=>{let r=[],i=new Map,a=!0,o=(e,n,s,c)=>{if(!(s>Al))for(let[l,u]of e.entries())for(let[e,d]of u.content.entries()){if(d.type!==`tool-call`||d.messages===void 0)continue;let f=d.messages,p=Nl(u,e,d),m=Ol(p),h=kl(p),g=`${c}${l}.${e}`,_=t.get(g),v=_?.part===d&&_.statusType===p.type&&_.statusReason===m&&Object.is(_.statusError,h)&&_.messages===f&&_.task.messageId===u.id&&_.task.parentTaskId===n&&_.task.depth===s?_.task:{id:d.toolCallId,toolName:d.toolName,args:d.args,result:d.result,...d.isError===void 0?void 0:{isError:d.isError},status:p,timing:d.timing,messageId:u.id,parentTaskId:n,depth:s,messages:f};v!==_?.task&&(a=!1,jl.set(v,g)),r.push(v),i.set(g,{task:v,part:d,statusType:p.type,statusReason:m,statusError:h,messages:f}),o(f,v.id,s+1,`${g}.`)}};o(n,null,0,``);let s=a&&r.length===e.length&&r.every((t,n)=>t===e[n])?e:r;return e=s,t=i,s}},Fl=H(({task:e})=>({getState:()=>e})),Il=H(e=>{let t=F(8),{runtime:n,id:r,threadIdRef:i,threadId:a,isLast:o}=e,s;t[0]!==r||t[1]!==n?(s=n.getMessageById(r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s,l;return t[3]!==o||t[4]!==c||t[5]!==a||t[6]!==i?(l=qs({runtime:c,threadIdRef:i,threadId:a,isLast:o}),t[3]=o,t[4]=c,t[5]=a,t[6]=i,t[7]=l):l=t[7],$i(l)}),J=H(e=>{let t=F(116),{runtime:n}=e,r=Ms(n),i=uo(),a,o;t[0]!==i||t[1]!==n?(a=()=>{let e=[];for(let t of[`runStart`,`runEnd`,`initialize`,`modelContextUpdate`]){let r=n.unstable_on(t,()=>{let e=n.getState()?.threadId||`unknown`;i(`thread.${t}`,{threadId:e})});e.push(r)}return e.push(n.unstable_on(`historyWriteError`,e=>{let t=n.getState()?.threadId||`unknown`;i(`thread.historyWriteError`,{threadId:t,operation:e.operation,messageIds:e.messageIds,message:e.message})}),n.unstable_on(`toolApprovalAnswered`,e=>{let t=n.getState()?.threadId||`unknown`;i(`thread.toolApprovalAnswered`,{threadId:t,...e})})),()=>as(e)},o=[n,i],t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]),z(a,o);let s;t[4]===n?s=t[5]:(s=Vs(()=>n.getState().threadId),t[4]=n,t[5]=s);let c=s,l;t[6]!==i||t[7]!==n?(l=e=>{i(e,{threadId:n.getState().threadId})},t[6]=i,t[7]=n,t[8]=l):l=t[8];let u=l,d;t[9]===n?d=t[10]:(d=e=>n.getState().suggestions.some(t=>t.prompt===e),t[9]=n,t[10]=d);let f=d,p;t[11]!==f||t[12]!==n.composer||t[13]!==c?(p=zs({runtime:n.composer,threadIdRef:c,isSuggestion:f}),t[11]=f,t[12]=n.composer,t[13]=c,t[14]=p):p=t[14];let m=Qa(p),h;t[15]===r.suggestions?h=t[16]:(h=Tl(r.suggestions),t[15]=r.suggestions,t[16]=h);let g=Qa(h),_;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=Pl(),t[17]=_):_=t[17];let v=_,y;t[18]===r.messages?y=t[19]:(y=v(r.messages),t[18]=r.messages,t[19]=y);let b=y,x;t[20]===b?x=t[21]:(x=b.map(Ll),t[20]=b,t[21]=x);let S=Xo(x),C=m.state.submission,w=m.state.inTransit,T;t[22]===w?T=t[23]:(T=w??[],t[22]=w,t[23]=T);let E;t[24]===C?E=t[25]:(E=C?[C]:[],t[24]=C,t[25]=E);let D;t[26]!==T||t[27]!==E?(D=[...T,...E],t[26]=T,t[27]=E,t[28]=D):D=t[28];let O=D,k;t[29]===O?k=t[30]:(k=O.map(xl),t[29]=O,t[30]=k);let ee=k,te=r.messages.length-1,ne;if(t[31]!==te||t[32]!==O||t[33]!==ee||t[34]!==n||t[35]!==r.messages||t[36]!==r.threadId||t[37]!==c){let e;t[39]!==te||t[40]!==O.length||t[41]!==n||t[42]!==r.threadId||t[43]!==c?(e=(e,t)=>{let i=t===te&&O.length>0?!1:void 0;return U(e.id,Il({runtime:n,id:e.id,threadIdRef:c,threadId:r.threadId,isLast:i}),[n,e.id,c,r.threadId,i])},t[39]=te,t[40]=O.length,t[41]=n,t[42]=r.threadId,t[43]=c,t[44]=e):e=t[44];let i=r.messages.map(e),a;t[45]!==O||t[46]!==ee||t[47]!==r.messages.length?(a=O.map((e,t)=>U(e.id,vc({message:ee[t],submission:e,index:r.messages.length+t,isLast:t===O.length-1}),[ee[t],e,r.messages.length,t,O.length])),t[45]=O,t[46]=ee,t[47]=r.messages.length,t[48]=a):a=t[48],ne=[...i,...a],t[31]=te,t[32]=O,t[33]=ee,t[34]=n,t[35]=r.messages,t[36]=r.threadId,t[37]=c,t[38]=ne}else ne=t[38];let re=Xo(ne),ie=re.state.length===0&&!r.isLoading,ae;t[49]!==m.state||t[50]!==re.state||t[51]!==r.capabilities||t[52]!==r.extras||t[53]!==r.hasEarlier||t[54]!==r.isDisabled||t[55]!==r.isLoading||t[56]!==r.isLoadingEarlier||t[57]!==r.isRunning||t[58]!==r.speech||t[59]!==r.state||t[60]!==r.suggestions||t[61]!==r.voice||t[62]!==ie||t[63]!==b?(ae={isEmpty:ie,isDisabled:r.isDisabled,isLoading:r.isLoading,hasEarlier:r.hasEarlier,isLoadingEarlier:r.isLoadingEarlier,isRunning:r.isRunning,capabilities:r.capabilities,state:r.state,suggestions:r.suggestions,extras:r.extras,speech:r.speech,voice:r.voice,composer:m.state,messages:re.state,tasks:b},t[49]=m.state,t[50]=re.state,t[51]=r.capabilities,t[52]=r.extras,t[53]=r.hasEarlier,t[54]=r.isDisabled,t[55]=r.isLoading,t[56]=r.isLoadingEarlier,t[57]=r.isRunning,t[58]=r.speech,t[59]=r.state,t[60]=r.suggestions,t[61]=r.voice,t[62]=ie,t[63]=b,t[64]=ae):ae=t[64];let A=ae,j;t[65]===A?j=t[66]:(j=()=>A,t[65]=A,t[66]=j);let M;t[67]===m.methods?M=t[68]:(M=()=>m.methods,t[67]=m.methods,t[68]=M);let oe;t[69]===g?oe=t[70]:(oe=()=>g.methods,t[69]=g,t[70]=oe);let se;t[71]!==S||t[72]!==b?(se=e=>{if(`id`in e){let t=b.find(t=>t.id===e.id);return S.get({key:t?Ml(t):e.id})}return S.get(e)},t[71]=S,t[72]=b,t[73]=se):se=t[73];let ce;t[74]!==i||t[75]!==f||t[76]!==n?(ce=e=>{let t=typeof e==`string`?{content:[{type:`text`,text:e}]}:e;if((t.role??`user`)===`user`){let e=t.content.map(Y).join(``);i(`composer.send`,{threadId:n.getState().threadId,chars:e.length,attachments:t.attachments?.length??0,...f(e)?{suggestion:!0}:void 0})}n.append(e)},t[74]=i,t[75]=f,t[76]=n,t[77]=ce):ce=t[77];let N;t[78]!==u||t[79]!==n||t[80]!==r.isRunning?(N=()=>{r.isRunning&&u(`thread.cancelRun`),n.cancelRun()},t[78]=u,t[79]=n,t[80]=r.isRunning,t[81]=N):N=t[81];let P;t[82]===n?P=t[83]:(P=()=>n.loadEarlier(),t[82]=n,t[83]=P);let le;t[84]!==u||t[85]!==n?(le=()=>{n.connectVoice(),u(`thread.voiceStarted`)},t[84]=u,t[85]=n,t[86]=le):le=t[86];let ue;t[87]===re?ue=t[88]:(ue=e=>`id`in e?re.get({key:e.id}):re.get(e),t[87]=re,t[88]=ue);let de;t[89]===n?de=t[90]:(de=()=>n,t[89]=n,t[90]=de);let fe;return t[91]!==n.deleteMessage||t[92]!==n.disconnectVoice||t[93]!==n.export||t[94]!==n.getModelContext||t[95]!==n.getVoiceVolume||t[96]!==n.import||t[97]!==n.importExternalState||t[98]!==n.muteVoice||t[99]!==n.reset||t[100]!==n.resumeRun||t[101]!==n.startRun||t[102]!==n.stopSpeaking||t[103]!==n.subscribeVoiceVolume||t[104]!==n.unmuteVoice||t[105]!==j||t[106]!==M||t[107]!==oe||t[108]!==se||t[109]!==ce||t[110]!==N||t[111]!==P||t[112]!==le||t[113]!==ue||t[114]!==de?(fe={getState:j,composer:M,suggestions:oe,task:se,append:ce,deleteMessage:n.deleteMessage,startRun:n.startRun,resumeRun:n.resumeRun,importExternalState:n.importExternalState,cancelRun:N,loadEarlier:P,getModelContext:n.getModelContext,export:n.export,import:n.import,reset:n.reset,stopSpeaking:n.stopSpeaking,connectVoice:le,disconnectVoice:n.disconnectVoice,getVoiceVolume:n.getVoiceVolume,subscribeVoiceVolume:n.subscribeVoiceVolume,muteVoice:n.muteVoice,unmuteVoice:n.unmuteVoice,message:ue,__internal_getRuntime:de},t[91]=n.deleteMessage,t[92]=n.disconnectVoice,t[93]=n.export,t[94]=n.getModelContext,t[95]=n.getVoiceVolume,t[96]=n.import,t[97]=n.importExternalState,t[98]=n.muteVoice,t[99]=n.reset,t[100]=n.resumeRun,t[101]=n.startRun,t[102]=n.stopSpeaking,t[103]=n.subscribeVoiceVolume,t[104]=n.unmuteVoice,t[105]=j,t[106]=M,t[107]=oe,t[108]=se,t[109]=ce,t[110]=N,t[111]=P,t[112]=le,t[113]=ue,t[114]=de,t[115]=fe):fe=t[115],fe});function Ll(e){return U(Ml(e),Fl({task:e}),[e])}function Y(e){return e.type===`text`?e.text:``}var X=e=>{let t=F(4),n=uo(),r=R(e),i,a;t[0]!==n||t[1]!==e?(i=()=>{let t=r.current;t!==e&&(r.current=e,n(`threads.selectionChanged`,{threadId:e,previousThreadId:t}))},a=[e,n],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),z(i,a)},Z=(e,t,n)=>{let r=F(8),i=n===void 0?t:n,a=uo(),o=t&&i,s;r[0]!==o||r[1]!==e?(s={isMain:o,threadId:e},r[0]=o,r[1]=e,r[2]=s):s=r[2];let c=R(s),l,u;r[3]!==a||r[4]!==t||r[5]!==e?(l=()=>{let n=c.current;(n.isMain!==t||n.threadId!==e)&&(c.current={isMain:t,threadId:e},a(t?`threadListItem.switchedTo`:`threadListItem.switchedAway`,{threadId:e}))},u=[t,e,a],r[3]=a,r[4]=t,r[5]=e,r[6]=l,r[7]=u):(l=r[6],u=r[7]),z(l,u)},Rl=(e,t)=>Fs(`thread list ${e}`,t),zl=H(e=>{let t=F(27),{runtime:n,mainThreadIsRunning:r}=e,i=r!==void 0&&r,a=Ms(n),o;bb0:{let e=a.isRunning||a.isMain&&i;if(e===a.isRunning){o=a;break bb0}let n;t[0]!==e||t[1]!==a?(n={...a,isRunning:e},t[0]=e,t[1]=a,t[2]=n):n=t[2],o=n}let s=o;Z(a.id,a.isMain);let c;t[3]===s?c=t[4]:(c=()=>s,t[3]=s,t[4]=c);let l,u,d,f,p,m,h;t[5]===n?(l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12]):(u=e=>Rl(`switch`,()=>n.switchTo(e)),d=e=>Rl(`rename`,()=>n.rename(e)),f=e=>Rl(`update custom metadata`,()=>n.updateCustom(e)),p=()=>Rl(`archive`,()=>n.archive()),m=()=>Rl(`unarchive`,()=>n.unarchive()),h=()=>Rl(`delete`,()=>n.delete()),l=e=>Rl(`generate title`,()=>n.generateTitle(e)),t[5]=n,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h);let g;t[13]===n?g=t[14]:(g=()=>n,t[13]=n,t[14]=g);let _;return t[15]!==n.detach||t[16]!==n.initialize||t[17]!==l||t[18]!==g||t[19]!==c||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(_={getState:c,switchTo:u,rename:d,updateCustom:f,archive:p,unarchive:m,delete:h,generateTitle:l,initialize:n.initialize,detach:n.detach,__internal_getRuntime:g},t[15]=n.detach,t[16]=n.initialize,t[17]=l,t[18]=g,t[19]=c,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=_):_=t[26],_}),Bl=100,Vl=(e,t)=>{let[n]=L(()=>({committed:void 0,unmounted:!1,waiters:new Set,delayed:new WeakMap}));return z(()=>{if(n.committed={state:e},!Object.is(e,t()))return;let r=[...n.waiters];n.waiters.clear();for(let e of r)e()}),z(()=>(n.unmounted=!1,()=>{n.unmounted=!0,n.committed=void 0;let e=[...n.waiters];n.waiters.clear();for(let t of e)t()}),[n]),Ur(e=>{let r=n.delayed.get(e);if(r)return r;let i=e.then(e=>new Promise(r=>{let i=n.committed;if(n.unmounted||i!==void 0&&Object.is(i.state,t())){r(e);return}let a=()=>{clearTimeout(o),n.waiters.delete(a),r(e)},o=setTimeout(a,Bl);n.waiters.add(a)}));return n.delayed.set(e,i),i},[n,t])},Hl=H(e=>{let t=F(6),{runtime:n,id:r,mainThreadIsRunning:i}=e,a;t[0]!==r||t[1]!==n?(a=n.getItemById(r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;return t[3]!==i||t[4]!==o?(s=zl({runtime:o,mainThreadIsRunning:i}),t[3]=i,t[4]=o,t[5]=s):s=t[5],$i(s)}),Ul=H(e=>{let t=F(53),{runtime:n,__internal_assistantRuntime:r}=e,i=Ms(n),a=Vl(i,n.getState);X(i.mainThreadId);let o=uo(),s,c;t[0]!==o||t[1]!==n?(s=()=>n.unstable_subscribeThreadEvents(e=>{let{threadId:t,type:r}=e;t!==n.getState().mainThreadId&&o(`thread.${r}`,{threadId:t})}),c=[n,o],t[0]=o,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),z(s,c);let l;t[4]===n.main?l=t[5]:(l=J({runtime:n.main}),t[4]=n.main,t[5]=l);let u=Qa(l),d;t[6]!==u.state||t[7]!==n||t[8]!==i.threadItems?(d=Object.keys(i.threadItems).map(e=>U(e,Hl({runtime:n,id:e,mainThreadIsRunning:u.state.isRunning}),[n,e,u.state.isRunning])),t[6]=u.state,t[7]=n,t[8]=i.threadItems,t[9]=d):d=t[9];let f=Xo(d),p=i.newThreadId??null,m;t[10]!==u.state||t[11]!==i.archivedThreadIds||t[12]!==i.hasMore||t[13]!==i.isLoading||t[14]!==i.isLoadingMore||t[15]!==i.loadError||t[16]!==i.mainThreadId||t[17]!==i.threadIds||t[18]!==p||t[19]!==f.state?(m={mainThreadId:i.mainThreadId,newThreadId:p,isLoading:i.isLoading,loadError:i.loadError,isLoadingMore:i.isLoadingMore,hasMore:i.hasMore,threadIds:i.threadIds,archivedThreadIds:i.archivedThreadIds,threadItems:f.state,main:u.state},t[10]=u.state,t[11]=i.archivedThreadIds,t[12]=i.hasMore,t[13]=i.isLoading,t[14]=i.isLoadingMore,t[15]=i.loadError,t[16]=i.mainThreadId,t[17]=i.threadIds,t[18]=p,t[19]=f.state,t[20]=m):m=t[20];let h=m,g;t[21]===h?g=t[22]:(g=()=>h,t[21]=h,t[22]=g);let _;t[23]===u.methods?_=t[24]:(_=()=>u.methods,t[23]=u.methods,t[24]=_);let v;t[25]!==h||t[26]!==f?(v=e=>{if(e===`main`)return f.get({key:h.mainThreadId});if(`id`in e)return f.get({key:e.id});let{index:t,archived:n}=e,r=n!==void 0&&n?h.archivedThreadIds[t]:h.threadIds[t];return f.get({key:r})},t[25]=h,t[26]=f,t[27]=v):v=t[27];let y,b;t[28]===n?(y=t[29],b=t[30]):(y=(e,t)=>Rl(`switch`,()=>n.switchToThread(e,t)),b=()=>Rl(`create`,()=>n.switchToNewThread()),t[28]=n,t[29]=y,t[30]=b);let x,S;t[31]!==a||t[32]!==n?(x=()=>a(n.getLoadThreadsPromise()),S=()=>a(n.reload()),t[31]=a,t[32]=n,t[33]=x,t[34]=S):(x=t[33],S=t[34]);let C;t[35]===n?C=t[36]:(C=()=>n.reloadMainThread(),t[35]=n,t[36]=C);let w;t[37]!==a||t[38]!==n?(w=()=>a(n.loadMore()),t[37]=a,t[38]=n,t[39]=w):w=t[39];let T;t[40]===r?T=t[41]:(T=()=>r,t[40]=r,t[41]=T);let E;return t[42]!==y||t[43]!==b||t[44]!==x||t[45]!==S||t[46]!==C||t[47]!==w||t[48]!==T||t[49]!==g||t[50]!==_||t[51]!==v?(E={getState:g,thread:_,item:v,switchToThread:y,switchToNewThread:b,getLoadThreadsPromise:x,reload:S,reloadMainThread:C,loadMore:w,__internal_getAssistantRuntime:T},t[42]=y,t[43]=b,t[44]=x,t[45]=S,t[46]=C,t[47]=w,t[48]=T,t[49]=g,t[50]=_,t[51]=v,t[52]=E):E=t[52],E}),Wl=(e,t)=>{e.thread??=Jo({source:`threads`,query:{type:`main`},get:e=>e.threads.thread(`main`)}),e.threadListItem??=Jo({source:`threads`,query:{type:`main`},get:e=>e.threads.item(`main`)}),e.composer??=Jo({source:`thread`,query:{},get:e=>e.threads.thread(`main`).composer()}),!e.modelContext&&t.modelContext.source===null&&(e.modelContext=ws()),!e.suggestions&&t.suggestions.source===null&&(e.suggestions=Jo({source:`thread`,query:{},get:e=>e.thread.suggestions()}))},Gl=e=>{let t=F(7),n=G(),r;t[0]!==n||t[1]!==e?(r=()=>e.registerModelContextProvider(n.current.modelContext()),t[0]=n,t[1]=e,t[2]=r):r=t[2];let i;t[3]===e?i=t[4]:(i=[e],t[3]=e,t[4]=i),lo(`modelContext`,r,i);let a;return t[5]===e?a=t[6]:(a=Ul({runtime:e.threads,__internal_assistantRuntime:e}),t[5]=e,t[6]=a),$i(a)},Kl=H(Gl);za(Gl,(e,t)=>{Wl(e,t),!e.tools&&t.tools.source===null&&(e.tools=ks({})),!e.dataRenderers&&t.dataRenderers.source===null&&(e.dataRenderers=sa())});var ql=ua({}),Jl=({effects:e})=>{"use no memo";return Wr(e),null},Yl=B(function(e,t){"use no memo";let{config:n,children:r}=e,i=`extends`in e,a=`value`in e,o=Ia();if(To){if(i&&a)throw Error("AuiProvider: pass either `extends` or `value`, not both.");if(i&&e.extends===void 0)throw Error("AuiProvider: `extends` must be a client or null, not undefined.");if(i&&!n)throw Error("AuiProvider: `extends` requires a `config`.");if(a&&n)throw Error("AuiProvider: pass either `value` or `config`, not both.");if(!a&&!n)throw Error("AuiProvider: a `config` is required.");if(!i&&!a&&o!==ka)throw Error(`A parent AuiProvider exists — pass extends={aui} to inherit it or extends={null} to isolate.`)}let s=i?e.extends??ka:a?e.value??ka:o,c=So(),{client:l,effects:u}=Wo(s,n??ql,c);return Xr(t,()=>l,[l]),(0,I.jsx)(fo.Provider,{value:c,children:(0,I.jsxs)(ja.Provider,{value:l,children:[(0,I.jsx)(Jl,{effects:Pa(s)}),u&&(0,I.jsx)(Jl,{effects:u}),r]})})}),Xl=e=>{let t=K(),n=R(!1),r=n.current?null:e(t);return q(()=>n.current?e(t):r),()=>(n.current=!0,e(t))},Zl=Object.freeze({});function Ql(e){let t=F(3),{getItemState:n,children:r}=e,i=Xl(n),a;return t[0]!==r||t[1]!==i?(a=r(i),t[0]=r,t[1]=i,t[2]=a):a=t[2],$l(a)}var $l=e=>{let t=typeof e==`object`&&e&&`type`in e?e:null,n=t?.type,r=t?.key;return Hr(()=>t,[n,r,typeof t?.props==`object`&&t.props!=null&&Object.entries(t.props).length===0?Zl:t?.props])??e},eu=(e,t)=>{let n=F(11),r=K(),i=Gr(t),a;n[0]===e?a=n[1]:(a=Va(e),n[0]=e,n[1]=a);let{scope:o,event:s}=a,c;n[2]!==r||n[3]!==i||n[4]!==s||n[5]!==o?(c=()=>r.on({scope:o,event:s},i),n[2]=r,n[3]=i,n[4]=s,n[5]=o,n[6]=c):c=n[6];let l;n[7]!==r||n[8]!==s||n[9]!==o?(l=[r,o,s],n[7]=r,n[8]=s,n[9]=o,n[10]=l):l=n[10],z(c,l)},tu=e=>e._core?.RenderComponent,nu=({runtime:e,aui:t,config:n,children:r})=>{"use no memo";let i=tu(e),a=ua({...n,threads:Kl(e)});return(0,I.jsxs)(Yl,{extends:t,config:a,children:[i&&(0,I.jsx)(i,{}),r]})},ru=Zr(e=>{let t=F(5),{runtime:n,aui:r,config:i,children:a}=e,o=r===void 0?null:r,s;return t[0]!==o||t[1]!==a||t[2]!==i||t[3]!==n?(s=(0,I.jsx)(nu,{runtime:n,aui:o,config:i,children:a}),t[0]=o,t[1]=a,t[2]=i,t[3]=n,t[4]=s):s=t[4],s}),iu=ni(null),au=(e,t)=>ar(iu,e,t),ou=()=>ii(iu),su={},cu=e=>{let t=Co(e??su);return e==null?null:t},lu=e=>{let t=F(6),{adapters:n,children:r}=e,i=ii(iu),a;t[0]!==n||t[1]!==i?(a={...i,...n},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o=a,s;return t[3]!==r||t[4]!==o?(s=(0,I.jsx)(iu.Provider,{value:o,children:r}),t[3]=r,t[4]=o,t[5]=s):s=t[5],s};function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uu(e,t=0){return t>100?!1:e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?!Number.isNaN(e)&&Number.isFinite(e):Array.isArray(e)?e.every(e=>uu(e,t+1)):Q(e)?Object.entries(e).every(([e,n])=>typeof e==`string`&&uu(n,t+1)):!1}var du=e=>{if(e instanceof Date&&!Number.isNaN(e.getTime()))return e;if(typeof e!=`string`&&typeof e!=`number`)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},fu=e=>e===`system`||e===`user`||e===`assistant`,pu={running:()=>!0,"requires-action":e=>typeof e.reason==`string`,complete:e=>typeof e.reason==`string`,incomplete:e=>(e.reason===void 0||typeof e.reason==`string`)&&(e.error===void 0||uu(e.error))},mu=e=>Q(e)&&typeof e.type==`string`&&Object.hasOwn(pu,e.type)&&pu[e.type](e)===!0,hu=e=>{if(Q(e)){if(e.messageId!==void 0&&typeof e.messageId!=`string`){let{messageId:t,...n}=e;return hu(n)}if(e.usage!==void 0&&!Q(e.usage)){let{usage:t,...n}=e;return n}return e}},gu=e=>Array.isArray(e)?e.map(hu).filter(e=>e!==void 0):[],_u=(e,t)=>{let n={text:e=>typeof e.text==`string`,reasoning:e=>typeof e.text==`string`||typeof e.unstable_summary==`string`,image:e=>typeof e.image==`string`,file:e=>typeof e.data==`string`&&typeof e.mimeType==`string`,audio:e=>Q(e.audio)&&typeof e.audio.data==`string`&&typeof e.audio.format==`string`,data:e=>typeof e.name==`string`,source:e=>typeof e.id==`string`&&(e.sourceType===`url`?typeof e.url==`string`:e.sourceType===`document`&&typeof e.title==`string`&&typeof e.mediaType==`string`),"generative-ui":e=>Q(e.spec),"tool-call":e=>typeof e.toolCallId==`string`&&typeof e.toolName==`string`&&Q(e.args)&&typeof e.argsText==`string`,...e};return e=>Q(e)&&typeof e.type==`string`&&(Object.hasOwn(n,e.type)?n[e.type](e):t(e.type))};_u({},()=>!0);var vu=_u({reasoning:e=>(e.text===void 0||typeof e.text==`string`)&&(e.unstable_summary===void 0||typeof e.unstable_summary==`string`)&&(typeof e.text==`string`||typeof e.unstable_summary==`string`),"tool-call":e=>typeof e.toolCallId==`string`&&typeof e.toolName==`string`&&(e.args===void 0||Q(e.args))&&(e.argsText===void 0||typeof e.argsText==`string`)&&(e.args!==void 0||e.argsText!==void 0)},e=>e.startsWith(`data-`)),yu={user:{text:!0,image:!0,file:!0,data:!0,audio:!0},assistant:{text:!0,reasoning:!0,"tool-call":!0,source:!0,file:!0,image:!0,data:!0,"generative-ui":!0}},bu=(e,t)=>vu(t)&&(e===`system`?t.type===`text`:Object.hasOwn(yu.assistant,t.type)||Object.hasOwn(yu.user,t.type)?Object.hasOwn(yu[e],t.type):!0),xu=(e,t)=>!Q(e)||typeof e.id!=`string`||typeof e.type!=`string`||typeof e.name!=`string`||!Q(e.status)||e.status.type!==`complete`||!Array.isArray(e.content)?null:{...e,content:e.content.filter(t)},Su={toResponse(e,t){return new Response(Su.toByteStream(e,t),{headers:t.headers??{}})},fromResponse(e,t){return Su.fromByteStream(e.body,t)},toByteStream(e,t){return e.pipeThrough(t)},fromByteStream(e,t){return e.pipeThrough(t)}},Cu=new Set([`__proto__`,`constructor`,`prototype`]);function wu(e){if(Cu.has(e))throw Error(`Unsafe gorp path segment: ${e}`)}var Tu=class{_state;_strict;_logged=new Set;_warnedClamp=!1;constructor(e=null,t={}){this._state=e,this._strict=t.strict??!0}get state(){return this._state}logOnce(e,t){this._logged.has(e)||this._logged.size>=20||(this._logged.add(e),t())}append(e){this._state=e.reduce((e,t)=>{if(this._strict)return this.apply(e,t);try{return this.apply(e,t)}catch(n){return this.logOnce(`skip:${String(n)}`,()=>console.error(`Skipped unappliable gorp operation: ${String(n)}`,t)),e}},this._state)}apply(e,t){let n=t.type;switch(n){case`set`:return this.updatePath(e,t.path,()=>t.value);case`append-text`:return this.updatePath(e,t.path,e=>{if(typeof e!=`string`)throw Error(`Expected string at path [${t.path.join(`, `)}]`);return e+t.value});default:throw Error(`Invalid operation type: ${n}`)}}updatePath(e,t,n){if(t.length===0)return n(e);let r=[],i=e;for(let e=0;e<t.length;e++){if(i??={},typeof i!=`object`)throw Error(`Invalid path: [${t.slice(e).join(`, `)}]`);let n=t[e];if(wu(n),Array.isArray(i)){let a=Number(n);if(!Number.isInteger(a)||String(a)!==String(n))throw Error(`Expected array index at [${t.slice(e).join(`, `)}]`);if(a<0)throw Error(`Insert array index out of bounds`);if(a>i.length){if(this._strict)throw Error(`Insert array index out of bounds`);this._warnedClamp||(this._warnedClamp=!0,console.warn(`Clamped out-of-bounds gorp array index ${a} to ${i.length}`)),a=i.length}r.push({kind:`array`,state:i,key:a}),i=Object.hasOwn(i,a)?i[a]:void 0}else{let e=i;r.push({kind:`object`,state:e,key:n}),i=Object.hasOwn(e,n)?e[n]:void 0}}let a=n(i);for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.kind===`array`){let e=[...t.state];e[t.key]=a,a=e}else{let e={...t.state};e[t.key]=a,a=e}}return a}},Eu=class{_streamStartTime;_firstTokenTime;_totalChunks=0;_toolCallIds=new Set;constructor(){this._streamStartTime=Date.now()}recordChunk(){this._totalChunks++}recordFirstToken(){this._firstTokenTime===void 0&&(this._firstTokenTime=Date.now())}recordToolCallStart(e){this._toolCallIds.add(e)}getTiming(e,t){let n=Date.now()-this._streamStartTime,r=e&&e>0?e:t?Math.ceil(t.length/4):void 0,i=r&&n>0?r/n*1e3:void 0;return{streamStartTime:this._streamStartTime,...this._firstTokenTime===void 0?void 0:{firstTokenTime:this._firstTokenTime-this._streamStartTime},totalStreamTime:n,...r===void 0?void 0:{tokenCount:r},...i===void 0?void 0:{tokensPerSecond:i},totalChunks:this._totalChunks,toolCallCount:this._toolCallIds.size}}},Du=(e,t)=>({...e,parts:t,get content(){return this.parts}}),Ou=(e,t)=>Du(e,[...e.parts,t]),ku=({unstable_state:e=null}={})=>({role:`assistant`,status:{type:`running`},parts:[],get content(){return this.parts},metadata:{unstable_state:e,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}}),Au=16,ju=(e,t,n,r)=>{let i=t.path.length===1?e.parts[t.path[0]]:void 0;if(i===void 0)return n(`no-part:${t.type}`,`Dropped ${t.type} chunk: no part at path [${t.path.join(`, `)}]`),e;let a=t.path[0],o=r(i);return o===i?e:Du(e,[...e.parts.slice(0,a),o,...e.parts.slice(a+1)])},Mu=(e,t,n)=>{let r=t.part;if(r.type===`text`||r.type===`reasoning`)return Ou(e,{type:r.type,text:``,status:{type:`running`},...r.type===`reasoning`&&r.unstable_summary!==void 0?{unstable_summary:r.unstable_summary}:void 0,...r.type===`reasoning`?{timing:{startedAt:Date.now()}}:void 0,...r.parentId&&{parentId:r.parentId}});if(r.type===`tool-call`)return Ou(e,{type:`tool-call`,state:`partial-call`,status:{type:`running`,isArgsComplete:!1},toolCallId:r.toolCallId,toolName:r.toolName,argsText:``,args:{},timing:{startedAt:Date.now()},...r.parentId&&{parentId:r.parentId}});if(r.type===`source`)return Ou(e,{type:`source`,sourceType:r.sourceType,id:r.id,url:r.url,...r.title?{title:r.title}:void 0,...r.parentId&&{parentId:r.parentId}});if(r.type===`file`)return Ou(e,{type:`file`,mimeType:r.mimeType,data:r.data,...r.parentId&&{parentId:r.parentId}});if(r.type===`data`)return Ou(e,{type:`data`,name:r.name,data:r.data,...r.parentId&&{parentId:r.parentId}});{let t=String(r.type);return n(`unsupported-part-start:${t}`,`Unsupported part-start type ${t}: inserting an empty reasoning part to preserve part indices`),Ou(e,{type:`reasoning`,text:``,status:{type:`running`}})}},Nu=(e,t,n)=>ju(e,t,n,e=>e.type===`tool-call`?e.state===`partial-call`?{...e,state:`call`,status:e.status.type===`running`?{type:`running`,isArgsComplete:!0}:e.status}:e:(n(`wrong-part:tool-call-args-text-finish`,`Dropped tool-call-args-text-finish chunk: part is not a tool-call`),e)),Pu=(e,t,n)=>ju(e,t,n,e=>e.type===`tool-call`&&e.isPreliminary?e:e.type===`reasoning`&&e.timing!==void 0?{...e,status:{type:`complete`,reason:`unknown`},timing:{...e.timing,completedAt:e.timing.completedAt??Date.now()}}:{...e,status:{type:`complete`,reason:`unknown`}}),Fu=(e,t,n)=>ju(e,t,n,e=>{if(e.type===`text`||e.type===`reasoning`)return{...e,text:e.text+t.textDelta};if(e.type===`tool-call`){let n=e.argsText+t.textDelta,r=Yc(n)??e.args;return{...e,argsText:n,args:r}}return n(`wrong-part:text-delta`,`Dropped text-delta chunk: part is neither text nor tool-call`),e}),Iu=(e,t,n)=>ju(e,t,n,e=>{if(e.type===`tool-call`){let n=t.isPreliminary===!0,r=e.status.type===`running`?e.status:{type:`running`,isArgsComplete:e.state!==`partial-call`};if(n)return e.state===`result`?e:{...e,state:e.state===`partial-call`?`partial-call`:`call`,...t.artifact===void 0?{}:{artifact:t.artifact},result:t.result,isError:t.isError??!1,isPreliminary:!0,...t.modelContent===void 0?{}:{modelContent:t.modelContent},...t.messages===void 0?{}:{messages:t.messages},status:r};let{isPreliminary:i,...a}=e;return{...a,state:`result`,...e.timing===void 0?{}:{timing:{...e.timing,completedAt:e.timing.completedAt??Date.now()}},...t.artifact===void 0?{}:{artifact:t.artifact},result:t.result,isError:t.isError??!1,...t.modelContent===void 0?{}:{modelContent:t.modelContent},...t.messages===void 0?{}:{messages:t.messages},status:{type:`complete`,reason:`stop`}}}return n(`wrong-part:result`,`Dropped result chunk: part is not a tool-call`),e}),Lu=(e,t)=>{if(e.status?.type===`incomplete`&&e.status?.reason===`error`)return e;let n=Ru(t);return{...e,status:n}},Ru=e=>e.finishReason===`tool-calls`?{type:`requires-action`,reason:`tool-calls`}:e.finishReason===`stop`||e.finishReason===`unknown`?{type:`complete`,reason:e.finishReason}:{type:`incomplete`,reason:e.finishReason},zu=(e,t)=>({...e,metadata:{...e.metadata,unstable_annotations:[...e.metadata.unstable_annotations,...t.annotations]}}),Bu=(e,t)=>({...e,metadata:{...e.metadata,unstable_data:[...e.metadata.unstable_data,...t.data]}}),Vu=(e,t)=>({...e,metadata:{...e.metadata,steps:[...e.metadata.steps,{state:`started`,messageId:t.messageId}]}}),Hu=(e,t)=>{let n=e.metadata.steps.slice(),r=n.length-1;return n.length>0&&n[r]?.state===`started`?n[r]={...n[r],state:`finished`,finishReason:t.finishReason,usage:t.usage,isContinued:t.isContinued}:n.push({state:`finished`,messageId:Xc(),finishReason:t.finishReason,usage:t.usage,isContinued:t.isContinued}),{...e,metadata:{...e.metadata,steps:n}}},Uu=(e,t)=>{let n=t.severity===`critical`||t.severity===`warning`||t.severity===`info`?t.severity:void 0;return{...e,status:{type:`incomplete`,reason:`error`,error:{code:t.code??`unknown`,message:t.error??`unknown error`,...n!==void 0&&{severity:n}}}}},Wu=(e,t,n)=>(n.append(t.operations),{...e,metadata:{...e.metadata,unstable_state:n.state}}),Gu=e=>{let t=0;for(let n of e.metadata.steps)n.state===`finished`&&n.usage&&(t+=n.usage.outputTokens);return t},Ku=(e,t,n=0)=>{let r=n>0?n:Gu(t);if(r>0)return e.getTiming(r);let i=``;for(let e of t.parts)(e.type===`text`||e.type===`reasoning`)&&(i+=e.text);return e.getTiming(void 0,i||void 0)},qu=e=>{let t=!1;return()=>{t||(t=!0,queueMicrotask(()=>{t=!1,e()}))}},Ju=class extends TransformStream{constructor({initialMessage:e,throttle:t,onError:n,strict:r=!0}={}){let i=e??ku(),a,o,s=new Eu,c=new Set,l=(e,t)=>{c.has(e)||c.size>=Au||(c.add(e),console.warn(t))},u,d=t?qu(()=>{u?.enqueue(i)}):()=>{u?.enqueue(i)};super({start(e){u=e},transform(e){s.recordChunk();let t=e.type;switch(t){case`part-start`:i=Mu(i,e,l),e.part.type===`tool-call`&&s.recordToolCallStart(e.part.toolCallId);break;case`tool-call-args-text-finish`:i=Nu(i,e,l);break;case`part-finish`:i=Pu(i,e,l);break;case`text-delta`:{let t=Fu(i,e,l);t!==i&&s.recordFirstToken(),i=t;break}case`result`:i=Iu(i,e,l);break;case`message-finish`:o=e.usage?.outputTokens,i=Lu(i,e);break;case`annotations`:i=zu(i,e);break;case`data`:i=Bu(i,e);break;case`step-start`:i=Vu(i,e);break;case`step-finish`:i=Hu(i,e);break;case`error`:i=Uu(i,e),n?.(e.error);break;case`update-state`:a??=new Tu(i.metadata.unstable_state,{strict:r}),i=Wu(i,e,a);break;default:throw Error(`Unsupported chunk type: ${t}`)}i.status.type!==`running`&&(i={...i,metadata:{...i.metadata,timing:Ku(s,i,o)}}),d()},flush(e){if(i.status?.type===`running`){let t=i.parts?.some(e=>e.type===`tool-call`&&(e.state===`call`||e.state===`partial-call`)&&(e.result===void 0||e.isPreliminary))??!1;i=Lu(i,{type:`message-finish`,path:[],finishReason:t?`tool-calls`:`unknown`,usage:{inputTokens:0,outputTokens:0}}),i={...i,metadata:{...i.metadata,timing:Ku(s,i,o)}},e.enqueue(i)}}})}},Yu=class e{readable;constructor(e){this.readable=e}static fromAssistantStream(t){return new e(t.pipeThrough(new Ju))}async unstable_result(){let e;for await(let t of this)e=t;return e||{role:`assistant`,status:{type:`complete`,reason:`unknown`},parts:[],content:[],metadata:{unstable_state:null,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}}}[Symbol.asyncIterator](){return Wc(this.readable)[Symbol.asyncIterator]()}tee(){let[t,n]=this.readable.tee();return[new e(t),new e(n)]}},Xu=class extends TransformStream{constructor(e){super();let t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},Zu=class extends Xu{constructor(){super(e=>{let t=new vl({transform(e,t){t.appendText(e)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}},Qu=100,$u=(e,t,n)=>{if(e===t)return!0;if(n>Qu||e==null||t==null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((e,r)=>$u(e,t[r],n+1));if(Array.isArray(t)||!Q(e)||!Q(t))return!1;let r=Object.keys(e),i=Object.keys(t);return r.length===i.length&&r.every(r=>Object.hasOwn(t,r)&&$u(e[r],t[r],n+1))},ed=(e,t)=>!uu(e)||!uu(t)?!1:$u(e,t,0);function td(e){let t=e.metadata;if(!t||typeof t!=`object`)return;let n=t.custom;if(!n||typeof n!=`object`)return;let r=n.interactables;return Array.isArray(r)?r:void 0}function nd(e){return`update_${e.replace(/[^a-zA-Z0-9_-]/g,`_`)}`}var rd=e=>{if(!Q(e))return;let t=e.id;return typeof t==`string`||typeof t==`number`?t:void 0};function id(e,t,n=[]){if(!Q(e)||!Q(t))return t;let r={...e,...t},[i,...a]=n;return i!==void 0&&Object.hasOwn(t,i)&&(r[i]=id(e[i],t[i],a)),r}function ad(e,t,n,r){let i=Array.isArray(t.set)?[...t.set]:[...e];if(t.clear===!0&&(i=[]),Array.isArray(t.remove)&&t.remove.length>0){let e=new Set(t.remove);i=i.filter(t=>{let n=rd(t);return n===void 0?!e.has(t):!e.has(n)})}let a=t.update;if(Array.isArray(a)&&a.length>0){let e=new Map;for(let t of a){let n=rd(t);n!==void 0&&!Number.isNaN(n)&&!e.has(n)&&e.set(n,t)}let t=r?.[0]===`update`?{patch:a[Number(r[1])],rest:r.slice(2)}:void 0;i=i.map(n=>{let r=rd(n);if(r===void 0||!Q(n))return n;let i=e.get(r);return i?t&&i===t.patch?id(n,i,t.rest):{...n,...i}:n})}if(Array.isArray(t.add)&&t.add.length>0){let e=n?t.add.map(e=>{if(!Q(e)||e.id!==void 0)return e;let t=n();return t===void 0?e:{...e,id:t}}):t.add;i=[...i,...e]}return i}function od(e,t,n){if(!Q(e)||!Q(t))return t;let r=Q(n?.arrayBaseline)?n.arrayBaseline:e,i=n?.partialPath,a=Object.entries(e);for(let[o,s]of Object.entries(t)){let t=r[o],c=i?.[0]===o?i.slice(1):void 0;if(Array.isArray(t)&&Q(s)){let e=n?.idFactory&&(n.idKeyedFields===void 0||n.idKeyedFields.has(o))?()=>n.idFactory?.(o):void 0;a.push([o,ad(t,s,e,c)])}else c?a.push([o,id(e[o],s,c)]):a.push([o,s])}return Object.fromEntries(a)}function sd(e,t){if(!Q(e)||!Q(t))return;for(let n of Object.keys(e))if(!Object.hasOwn(t,n))return;let n=[];for(let[r,i]of Object.entries(t))(!Object.hasOwn(e,r)||!ed(e[r],i))&&n.push([r,i]);let r=n.length;if(r!==0&&r!==Object.keys(t).length)return Object.fromEntries(n)}var cd=e=>{if(!e||typeof e!=`object`)return;let t=e;return t.type===`tool-call`?t:void 0},ld=(e,t)=>{if(!e.args||typeof e.args!=`object`)return!1;let n=Q(e.result)?e.result:void 0;if(n?.success===!1)return!1;if(typeof n?.id==`string`)return n.id===t;let r=e.args.id;return r===t||r===void 0},ud=e=>{let t=Q(e)?e.addedItemIds:void 0;if(!Q(t))return;let n=new Map;for(let[e,r]of Object.entries(t)){if(!Array.isArray(r))continue;let t=r.filter(e=>typeof e==`string`);t.length>0&&n.set(e,t)}if(n.size!==0)return e=>n.get(e)?.shift()},dd=new WeakMap;function fd(e,t,n){let r=dd.get(e);r||(r=new Map,dd.set(e,r));let i=r.get(n);i||(i=new Map,r.set(n,i));let a=i.get(t);if(a)return a;let o=nd(n),s=[],c=()=>s[s.length-1];for(let r of e){if(r.role===`user`){let e=td(r)?.find(e=>e.id===t);if(!e)continue;if(e.partial){let t=c();t&&s.push({state:od(t.state,e.state),origin:`user-edit`})}else s.push({state:e.state,origin:`user-edit`});continue}if(r.role===`assistant`)for(let e of r.content??[]){let r=cd(e);if(r){if(r.toolCallId===t&&r.toolName===n)r.args&&typeof r.args==`object`&&s.push({state:r.args,origin:`create`,toolCallId:t});else if(r.toolName===o&&ld(r,t)){let e=c();if(e){let{id:t,...n}=r.args,i=ud(r.result);s.push({state:i?od(e.state,n,{idFactory:i}):od(e.state,n),origin:`update`,toolCallId:r.toolCallId})}}}}}return i.set(t,s),s}function pd(e,t,n){let r=fd(e,t,n),i=r[r.length-1];return i?{state:i.state}:void 0}function md(e,t){if(!e)return;let{interactables:n,...r}=e,i={...r};if(Array.isArray(n)){let e=[];for(let r of n){let n=pd(t,r.id,r.name);if(!n){e.push({id:r.id,name:r.name,state:r.state});continue}if(ed(r.state,n.state))continue;let i=sd(n.state,r.state);e.push(i?{id:r.id,name:r.name,state:i,partial:!0}:{id:r.id,name:r.name,state:r.state})}e.length&&(i.interactables=e)}return Object.keys(i).length?i:void 0}var hd=Symbol(`innerMessage`),gd=e=>e.type===`tool-call`&&e.result===void 0,_d=e=>e.type===`tool-call`&&$s(e),vd=Symbol(`autoStatus`),$=Object.freeze(Object.assign({type:`running`},{[vd]:!0})),yd=Object.freeze(Object.assign({type:`complete`,reason:`unknown`},{[vd]:!0})),bd=Object.freeze(Object.assign({type:`incomplete`,reason:`cancelled`},{[vd]:!0})),xd=Object.freeze(Object.assign({type:`requires-action`,reason:`tool-calls`},{[vd]:!0})),Sd=Object.freeze(Object.assign({type:`requires-action`,reason:`interrupt`},{[vd]:!0})),Cd=(e,t,n,r,i,a,o)=>e&&i!=null?Object.assign({type:`incomplete`,reason:`error`,error:i},{[vd]:!0}):e&&t?$:n?Sd:o&&!a?$:r?xd:a?bd:yd,wd=e=>Cd(!1,!1,typeof e!=`string`&&e.some(_d),typeof e!=`string`&&e.some(gd)),Td=e=>{let t=F(6),{index:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({attachment:Jo({source:`message`,query:{type:`index`,index:n},get:e=>e.message.attachment({index:n})})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},Ed=e=>{let t=F(6),{index:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({attachment:Jo({source:`composer`,query:{type:`index`,index:n},get:e=>e.composer.attachment({index:n})})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},Dd=e=>{let t=F(6),{runtime:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({threadListItem:zl({runtime:n})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},Od=e=>{let t=F(6),{index:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({message:Jo({source:`thread`,query:{type:`index`,index:n},get:e=>e.thread.message({index:n})}),composer:Jo({source:`message`,query:{},get:e=>e.thread.message({index:n}).composer()})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},kd=e=>{let t=F(6),{index:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({part:Jo({source:`message`,query:{type:`index`,index:n},get:e=>e.message.part({index:n})})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},Ad=H(e=>{let t=F(7),{text:n,isRunning:r}=e,i;t[0]===r?i=t[1]:(i=r?{type:`running`}:{type:`complete`},t[0]=r,t[1]=i);let a;t[2]!==i||t[3]!==n?(a={type:`text`,text:n,status:i},t[2]=i,t[3]=n,t[4]=a):a=t[4];let o=a,s;return t[5]===o?s=t[6]:(s={getState:()=>o,addToolResult:Md,resumeToolCall:Nd,respondToToolApproval:Pd,unstable_recordInteraction:Fd},t[5]=o,t[6]=s),s}),jd=e=>{let t=F(7),{text:n,isRunning:r,children:i}=e,a=r!==void 0&&r,o=K(),s;t[0]!==a||t[1]!==n?(s=ua({part:Ad({text:n,isRunning:a})}),t[0]=a,t[1]=n,t[2]=s):s=t[2];let c=s,l;return t[3]!==o||t[4]!==i||t[5]!==c?(l=(0,I.jsx)(Yl,{extends:o,config:c,children:i}),t[3]=o,t[4]=i,t[5]=c,t[6]=l):l=t[6],l};function Md(){throw Error(`Not supported`)}function Nd(){throw Error(`Not supported`)}function Pd(){throw Error(`Not supported`)}async function Fd(){throw Error(`Not supported`)}var Id=e=>{for(let t of e)if(t?.status.type===`running`)return Xs;return e.at(-1)?.status??Ys},Ld=(e,t)=>{let n={running:0,complete:0,incomplete:0,requiresAction:0},r=Ys,i=!1,a,o,s=!0;for(let c of t){let t=e[c]?.timing;switch(t&&(a=Math.min(a??t.startedAt,t.startedAt),t.completedAt===void 0?s=!1:o=Math.max(o??t.completedAt,t.completedAt)),r=e[c]?.status??Ys,r.type){case`running`:n.running++,i=!0;break;case`complete`:n.complete++;break;case`incomplete`:n.incomplete++;break;case`requires-action`:n.requiresAction++}}let c=a===void 0?void 0:!i&&s&&o!==void 0?{startedAt:a,completedAt:o}:{startedAt:a};return{status:i?Xs:r,counts:n,...c&&{timing:c}}},Rd=H(e=>{let t=F(11),{parts:n,getMessagePart:r}=e,[i,a]=L(!0),o;t[0]===n?o=t[1]:(o=Id(n),t[0]=n,t[1]=o);let s=o,c;t[2]!==i||t[3]!==n||t[4]!==s?(c={parts:n,collapsed:i,status:s},t[2]=i,t[3]=n,t[4]=s,t[5]=c):c=t[5];let l=c,u;t[6]===l?u=t[7]:(u=()=>l,t[6]=l,t[7]=u);let d;return t[8]!==r||t[9]!==u?(d={getState:u,setCollapsed:a,part:r},t[8]=r,t[9]=u,t[10]=d):d=t[10],d}),zd=ni(null),Bd=e=>{let t=F(13),{startIndex:n,endIndex:r,children:i}=e,a=q(Vd).slice(n,r+1),o;t[0]!==r||t[1]!==n?(o=e=>Us(e.message.parts).slice(n,r+1),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=q(wo(o)),c;t[3]!==s||t[4]!==n?(c={partKeys:s,startIndex:n},t[3]=s,t[4]=n,t[5]=c):c=t[5];let l=c,u=K(),d=ua({chainOfThought:Rd({parts:a,getMessagePart:e=>{let{index:t}=e;if(t<0||t>=a.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${a.length-1})`);return u.message.part({index:n+t})}})}),f;t[6]!==i||t[7]!==d||t[8]!==u?(f=(0,I.jsx)(Yl,{extends:u,config:d,children:i}),t[6]=i,t[7]=d,t[8]=u,t[9]=f):f=t[9];let p;return t[10]!==l||t[11]!==f?(p=(0,I.jsx)(zd.Provider,{value:l,children:f}),t[10]=l,t[11]=f,t[12]=p):p=t[12],p};function Vd(e){return e.message.parts}var Hd=e=>{let t=F(7),{index:n,archived:r,children:i}=e,a=K(),o;t[0]!==r||t[1]!==n?(o=ua({threadListItem:Jo({source:`threads`,query:{type:`index`,index:n,archived:r},get:e=>e.threads.item({index:n,archived:r})})}),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=o,c;return t[3]!==a||t[4]!==i||t[5]!==s?(c=(0,I.jsx)(Yl,{extends:a,config:s,children:i}),t[3]=a,t[4]=i,t[5]=s,t[6]=c):c=t[6],c},Ud=e=>{let t=F(6),{index:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({suggestion:Jo({source:`suggestions`,query:{index:n},get:e=>e.suggestions.suggestion({index:n})})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},Wd=e=>{let t=F(6),{index:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({queueItem:Jo({source:`composer`,query:{type:`index`,index:n},get:e=>e.composer.queueItem({index:n})})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},Gd=[`critical`,`warning`,`info`],Kd=[`inline`,`toast`,`silent`,`dev-only`],qd=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return!(typeof t.code!=`string`||typeof t.message!=`string`||`severity`in t&&t.severity!==void 0&&(typeof t.severity!=`string`||!Gd.includes(t.severity))||`display`in t&&t.display!==void 0&&(typeof t.display!=`string`||!Kd.includes(t.display)))},Jd=Symbol.for(`assistant-ui.message-not-sent`),Yd=class extends Error{[Jd]=!0;constructor(e=`The message was not sent.`){super(e),this.name=`MessageNotSentError`}},Xd=e=>typeof e==`object`&&!!e&&Jd in e,Zd=e=>{if(qd(e))return e;if(e instanceof Error)return{code:`unknown`,message:e.message};if(typeof e==`string`)return{code:`unknown`,message:e};try{return{code:`unknown`,message:`[${typeof e}] ${String(e)}`}}catch{return{code:`unknown`,message:`[${typeof e}]`}}},Qd=(e,t)=>{Promise.resolve(t).catch(t=>{Xd(t)||console.error(`[assistant-ui] ${e} failed`,t)})},$d=class{get path(){return this._core.path}_core;constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}},ef=class extends $d{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error(`Composer is not available`);return e.removeAttachment(this.getState().id)}},tf=class extends ef{get source(){return`thread-composer`}},nf=class extends ef{get source(){return`edit-composer`}},rf=class extends $d{get source(){return`message`}remove(){throw Error(`Message attachments cannot be removed`)}},af=Object.freeze([]),of=Object.freeze({}),sf=e=>Object.freeze({type:`thread`,isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??af,text:e?.text??``,role:e?.role??`user`,runConfig:e?.runConfig??of,attachmentAccept:e?.attachmentAccept??``,dictation:e?.dictation,quote:e?.quote,queue:e?.queue??af,submission:e?.submission,inTransit:e?.inTransit??af,value:e?.text??``}),cf=e=>Object.freeze({type:`edit`,isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,text:e?.text??``,role:e?.role??`user`,attachments:e?.attachments??af,runConfig:e?.runConfig??of,attachmentAccept:e?.attachmentAccept??``,dictation:e?.dictation,quote:e?.quote,queue:e?.queue??af,submission:e?.submission,inTransit:e?.inTransit??af,parentId:e?.parentId??null,sourceId:e?.sourceId??null,value:e?.text??``}),lf=class{get path(){return this._core.path}_core;constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.steerQueueItem=this.steerQueueItem.bind(this),this.moveQueueItem=this.moveQueueItem.bind(this),this.removeQueueItem=this.removeQueueItem.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);return e.clearAttachments()}send(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.send(e)}cancel(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.cancel()}steerQueueItem(e){this.moveQueueItem(e,{lane:`steer`,insertAfter:null})}moveQueueItem(e,t){let n=this._core.getState();if(!n)throw Error(`Composer is not available`);n.moveQueueItem(e,t)}removeQueueItem(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.removeQueueItem(e)}setRole(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new ms({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},uf=class extends lf{get path(){return this._core.path}get type(){return`thread`}_getState;constructor(e){let t=new fs({path:e.path,getState:()=>sf(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new tf(new ds({path:{...this.path,attachmentSource:`thread-composer`,attachmentSelector:{type:`index`,index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:`thread-composer`}:rs},subscribe:e=>this._core.subscribe(e)}),this._core)}},df=class extends lf{get path(){return this._core.path}get type(){return`edit`}_getState;_beginEdit;constructor(e,t){let n=new fs({path:e.path,getState:()=>cf(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new nf(new ds({path:{...this.path,attachmentSource:`edit-composer`,attachmentSelector:{type:`index`,index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:`edit-composer`}:rs},subscribe:e=>this._core.subscribe(e)}),this._core)}},ff=`ui://`,pf=e=>!!e?.startsWith(ff),mf=e=>e.display===`text`||e.display!==`questions`&&e.allowFreeform===!0,hf={"allow-once":!0,"allow-always":!0,"reject-once":!1,"reject-always":!1},gf=(e,t)=>{let n=e.questions??[];if(n.length===0)throw Error(`Tool approval "${e.id}" has display "questions" but declares no questions`);let r=new Set;for(let t of n){if(r.has(t.id))throw Error(`Tool approval "${e.id}" declares question "${t.id}" more than once`);r.add(t.id)}for(let n of Object.keys(t))if(!r.has(n))throw Error(`Tool approval "${e.id}" has no question with id "${n}"`);for(let r of n){let n=Object.hasOwn(t,r.id)?t[r.id]:void 0,i=n?.optionIds??[],a=n?.text;if(!Array.isArray(i)||a!==void 0&&typeof a!=`string`)throw Error(`Question "${r.id}" takes optionIds as an array and text as a string`);if(i.length===0&&(a===void 0||a.trim()===``))throw Error(`Tool approval "${e.id}" is missing an answer to question "${r.id}"`);if(i.length>1&&!r.multiple)throw Error(`Question "${r.id}" takes one option, not ${i.length}`);if(new Set(i).size!==i.length)throw Error(`Question "${r.id}" lists an option more than once`);for(let e of i)if(!r.options?.some(t=>t.id===e))throw Error(`Question "${r.id}" has no option with id "${e}"`);if(a!==void 0&&(r.options?.length??0)>0&&!r.allowFreeform)throw Error(`Question "${r.id}" does not accept a typed answer; it must declare allowFreeform`)}},_f=(e,t)=>{let n=t.reason;if(`answers`in t){if(`approved`in t||`optionId`in t||`text`in t)throw Error(`Tool approval "${e.id}" takes its answers alone, without approved, optionId or text`);return gf(e,t.answers),{approvalId:e.id,approved:!0,answers:t.answers,...n!=null&&{reason:n}}}if(`approved`in t&&t.approved===!1&&!(`optionId`in t)&&t.text===void 0)return{approvalId:e.id,approved:!1,...n!=null&&{reason:n}};throw Error(`Tool approval "${e.id}" asks questions; respond with answers, or with approved: false to dismiss it`)},vf=(e,t)=>{if(e.display===`questions`)return _f(e,t);if(`answers`in t)throw Error(`Tool approval "${e.id}" asks no questions; answers only resolve a display "questions" request`);let n=t.text;if(n!==void 0&&!mf(e))throw Error(`Tool approval "${e.id}" does not accept a free-form answer; the request must declare display "text" or allowFreeform`);let r,i;if(`optionId`in t){let n=e.options?.find(e=>e.id===t.optionId);if(!n)throw Error(`Tool approval has no option with id "${t.optionId}"`);if(`approved`in t)r=t.approved;else{if(!Object.hasOwn(hf,n.kind))throw Error(`Tool approval option "${n.id}" has a custom kind "${n.kind}"; respond with an explicit approved value instead`);r=hf[n.kind]}i=n.id}else if(`approved`in t)r=t.approved;else{if(e.display!==`text`&&e.display!==`select`)throw Error(`Tool approval "${e.id}" is a decision, not a question; respond with an explicit approved value, optionally alongside the answer`);r=!0}return{approvalId:e.id,approved:r,...i!==void 0&&{optionId:i},...n!==void 0&&{text:n},...t.reason!=null&&{reason:t.reason}}},yf=class{get path(){return this.contentBinding.path}contentBinding;messageApi;threadApi;constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.respondToToolApproval=this.respondToToolApproval.bind(this),this.unstable_recordInteraction=this.unstable_recordInteraction.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to add tool result to non-tool message part`);if(!this.messageApi)throw Error(`Message API is not available. This is likely a bug in assistant-ui.`);if(!this.threadApi)throw Error(`Thread API is not available`);let n=this.messageApi.getState();if(!n)throw Error(`Message is not available`);let r=t.toolName,i=t.toolCallId,a=ll.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:a.result,isError:a.isError,...a.artifact!==void 0&&{artifact:a.artifact},...a.modelContent!==void 0&&{modelContent:a.modelContent}})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to resume tool call on non-tool message part`);if(!this.threadApi)throw Error(`Thread API is not available`);let n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e}),this.unstable_recordInteraction({type:`human-response`,payload:e}).catch(()=>{})}respondToToolApproval(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to respond to tool approval on non-tool message part`);if(!t.approval||t.approval.approved!==void 0||t.approval.resolution!==void 0)throw Error(`Tool call has no pending approval`);if(!this.threadApi)throw Error(`Thread API is not available`);return this.threadApi.getState().respondToToolApproval(vf(t.approval,e))}async unstable_recordInteraction(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to record interaction on non-tool message part`);if(!this.messageApi)throw Error(`Message API is not available. This is likely a bug in assistant-ui.`);if(!this.threadApi)throw Error(`Thread API is not available`);let n=this.messageApi.getState();if(!n)throw Error(`Message is not available`);let r=this.threadApi.getState();if(!r.unstable_recordToolInteraction)throw Error(`Runtime does not support recording tool interactions.`);await r.unstable_recordToolInteraction({messageId:n.id,toolCallId:t.toolCallId,interaction:zc(e)})}subscribe(e){return this.contentBinding.subscribe(e)}},bf=(e,t)=>{let n=e.content[t];if(!n)return rs;let r=ec(e,t,n);return Object.freeze({...n,[hd]:n[hd],status:r})},xf=class{get path(){return this._core.path}_core;_threadBinding;constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new df(new ps({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:`edit`},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.delete=this.delete.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}delete(){let e=this._core.getState();return this._threadBinding.getState().deleteMessage(e.id)}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,r=t??n,{runConfig:i=r.runConfig}=e,a=this._core.getState();if(a.role!==`assistant`)throw Error(`Can only reload assistant messages`);Qd(`Message reload`,this._threadBinding.getState().startRun({parentId:a.parentId,sourceId:a.id,runConfig:i}))}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState();if(this._threadBinding.getState().speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error(`Message is not being spoken`)}submitFeedback({type:e,comment:t}){let n=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:n.id,type:e,...t===void 0?void 0:{comment:t}})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error(`May not specify both branchId and position`);if(!t&&!e)throw Error(`Must specify either branchId or position`);let r=this._threadBinding.getState().getBranches(n.id),i=t;if(e===`previous`?i=r[n.branchNumber-2]:e===`next`&&(i=r[n.branchNumber]),!i)throw Error(`Branch not found`);this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return Js(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error(`Message part index must be >= 0`);return new yf(new ds({path:{...this.path,ref:`${this.path.ref}.content[${e}]`,messagePartSelector:{type:`index`,index:e}},getState:()=>bf(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new yf(new ds({path:{...this.path,ref:`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:`toolCallId`,toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>t.type===`tool-call`&&t.toolCallId===e);return n===-1?rs:bf(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new rf(new ds({path:{...this.path,ref:`${this.path.ref}.attachments[${e}]`,attachmentSource:`message`,attachmentSelector:{type:`index`,index:e}},getState:()=>{let t=this.getState().attachments?.[e];return t?{...t,source:`message`}:rs},subscribe:e=>this._core.subscribe(e)}))}},Sf=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),Cf=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),wf=(e,t)=>typeof t==`string`?{createdAt:new Date,parentId:e.at(-1)?.id??null,sourceId:null,runConfig:{},role:`user`,content:[{type:`text`,text:t}],attachments:[],metadata:{custom:{}}}:{createdAt:t.createdAt??new Date,parentId:t.parentId===void 0?e.at(-1)?.id??null:t.parentId,sourceId:t.sourceId??null,role:t.role??`user`,content:t.content,attachments:t.attachments??[],metadata:t.metadata??{custom:{}},runConfig:t.runConfig??{},startRun:t.startRun},Tf=e=>{if(e.isRunning!==void 0)return e.isRunning;let t=e.messages.at(-1);return t?.role===`assistant`&&t.status.type===`running`},Ef=(e,t)=>Object.freeze({threadId:t.id,metadata:t,capabilities:e.capabilities,isDisabled:e.isDisabled,isLoading:e.isLoading,hasEarlier:e.hasEarlier??!1,isLoadingEarlier:e.isLoadingEarlier??!1,isRunning:Tf(e),messages:e.messages,state:e.state,suggestions:e.suggestions,extras:e.extras,speech:e.speech,voice:e.voice}),Df=class{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;_stateBinding;constructor(e,t){let n=new ds({path:e.path,getState:()=>Ef(e.getState(),t.getState()),subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>as([r,i])}});this._stateBinding=n,this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new uf(new ps({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:`thread`},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.deleteMessage=this.deleteMessage.bind(this),this.resumeRun=this.resumeRun.bind(this),this.loadEarlier=this.loadEarlier.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.unstable_notifySessionReset=this.unstable_notifySessionReset.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.connectVoice=this.connectVoice.bind(this),this.disconnectVoice=this.disconnectVoice.bind(this),this.muteVoice=this.muteVoice.bind(this),this.unmuteVoice=this.unmuteVoice.bind(this),this.getVoiceVolume=this.getVoiceVolume.bind(this),this.subscribeVoiceVolume=this.subscribeVoiceVolume.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){Qd(`Message append`,this._threadBinding.getState().append(wf(this._threadBinding.getState().messages,e)))}deleteMessage(e){return this._threadBinding.getState().deleteMessage(e)}subscribe(e){return this._stateBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}startRun(e){return this._threadBinding.getState().startRun(Cf(e))}resumeRun(e){return this._threadBinding.getState().resumeRun(Sf(e))}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}loadEarlier(){return this._threadBinding.getState().loadEarlier?.()??Promise.resolve()}unstable_notifySessionReset(){this._threadBinding.getState().unstable_notifySessionReset()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}connectVoice(){this._threadBinding.getState().connectVoice()}disconnectVoice(){this._threadBinding.getState().disconnectVoice()}getVoiceVolume(){return this._threadBinding.getState().getVoiceVolume()}subscribeVoiceVolume(e){return this._threadBinding.getState().subscribeVoiceVolume(e)}muteVoice(){this._threadBinding.getState().muteVoice()}unmuteVoice(){this._threadBinding.getState().unmuteVoice()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error(`Message index must be >= 0`);return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:`index`,index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:`messageId`,messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new xf(new ds({path:e,getState:()=>{let{message:e,parentId:n,index:r}=t()??{},{messages:i,speech:a}=this._threadBinding.getState();if(!e||n===void 0||r===void 0)return rs;let o=this._threadBinding.getState().getBranches(e.id);return{...e,[hd]:e[hd],index:r,isLast:i.at(-1)?.id===e.id,parentId:n,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:a?.messageId===e.id?a:void 0}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new ms({event:e,binding:this._threadBinding,notifyOnRebind:e===`modelContextUpdate`}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},Of=(e,t)=>({attachments:[],attachmentAccept:`*`,async addAttachment(){throw e},async removeAttachment(){throw e},isEditing:t,canCancel:!1,canSend:!1,isEmpty:!0,text:``,setText(){throw e},role:`user`,setRole(){throw e},runConfig:{},setRunConfig(){throw e},async reset(){},async clearAttachments(){},send(){throw e},cancel(){},queue:[],moveQueueItem(){},removeQueueItem(){},dictation:void 0,startDictation(){throw e},stopDictation(){},quote:void 0,setQuote(){throw e},subscribe(){return()=>{}},unstable_on(){return()=>{}}}),kf=class extends cs{switchToBranch(){throw this.error}append(){throw this.error}deleteMessage(){throw this.error}startRun(){throw this.error}resumeRun(){throw this.error}cancelRun(){throw this.error}unstable_notifySessionReset(){throw this.error}addToolResult(){throw this.error}resumeToolCall(){throw this.error}respondToToolApproval(){throw this.error}async unstable_recordToolInteraction(e){throw this.error}speak(){throw this.error}stopSpeaking(){throw this.error}connectVoice(){throw this.error}disconnectVoice(){throw this.error}muteVoice(){throw this.error}unmuteVoice(){throw this.error}submitFeedback(){throw this.error}exportExternalState(){throw this.error}importExternalState(){throw this.error}beginEdit(){throw this.error}import(){throw this.error}reset(){throw this.error}getModelContext(){return{}}getEditComposer(){}getVoiceVolume=()=>0;subscribeVoiceVolume=()=>()=>{};speech=void 0;voice=void 0;capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,delete:!1,reload:!1,refetchThread:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1,answerToolCall:!1};isDisabled=!1;isSendDisabled=!1;state=null;suggestions=[];extras=void 0;unstable_on(){return()=>{}}},Af=new WeakMap,jf=e=>{let t=Af.get(e);return t||(t=new AbortController,Af.set(e,t)),t.signal},Mf=new WeakMap,Nf=e=>{let t=Mf.get(e);return t||(t=new AbortController,Mf.set(e,t)),t},Pf=e=>Nf(e).signal,Ff=e=>{let t=Af.get(e);t?.signal.aborted||(Af.delete(e),t?.abort())},If=e=>{if(e.voice)try{e.disconnectVoice()}catch(e){console.error(`[assistant-ui] Voice cleanup threw while discarding a thread runtime`,e)}},Lf=e=>{If(e),Ff(e)},Rf=e=>{let t=Af.get(e)??new AbortController;Af.set(e,t),t.abort(),Nf(e).abort(),If(e)},zf=class{get path(){return this._core.path}_core;_threadListBinding;constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.updateCustom=this.updateCustom.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(e){let t=this._core.getState();return this._threadListBinding.switchToThread(t.id,e)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}updateCustom(e){let t=this._core.getState();if(!this._threadListBinding.updateCustom)throw Error(`Thread list runtime does not support updating custom metadata`);return this._threadListBinding.updateCustom(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(e){let t=this._core.getState();return this._threadListBinding.generateTitle(t.id,e)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),a=i.isMain,o=i.id;(n!==a||r!==o)&&(n=a,r=o,!(e===`switchedTo`&&!a)&&(e===`switchedAway`&&a||la([t],{},`Thread list item "${e}"`)))})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}},Bf=Promise.resolve(),Vf=()=>{},Hf=e=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,loadError:e.loadError,isLoadingMore:e.isLoadingMore??!1,hasMore:e.hasMore??!1,threadItems:e.threadItems}),Uf=(e,t)=>{if(t===void 0)return rs;let n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,lastMessageAt:n.lastMessageAt,custom:n.custom,isMain:n.id===e.mainThreadId,isRunning:e.unstable_isThreadRunning?.(n.id)??!1}:rs},Wf=class{_getState;_stateBinding;_core;_runtimeFactory;constructor(e,t=Df){this._core=e,this._runtimeFactory=t;let n=new fs({path:{},getState:()=>Hf(e),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._stateBinding=n,this._mainThreadListItemRuntime=new zf(new ds({path:{ref:`threadItems[main]`,threadSelector:{type:`main`}},getState:()=>Uf(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new ps({path:{ref:`threads.main`,threadSelector:{type:`main`}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.unstable_subscribeThreadEvents=this.unstable_subscribeThreadEvents.bind(this),this.getLoadThreadsPromise=this.getLoadThreadsPromise.bind(this),this.reload=this.reload.bind(this),this.reloadMainThread=this.reloadMainThread.bind(this),this.loadMore=this.loadMore.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e,t){return this._core.switchToThread(e,t)}switchToNewThread(){return this._core.switchToNewThread()}unstable_subscribeThreadEvents(e){return this._core.unstable_subscribeThreadEvents?.(e)??Vf}getLoadThreadsPromise(){return this._core.getLoadThreadsPromise()}reload(){return this._core.reload?.()??Bf}reloadMainThread(){return this._core.reloadMainThread?.()??Bf}loadMore(){return this._core.loadMore?.()??Bf}getState(){return this._getState()}subscribe(e){return this._stateBinding.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}_createItemStateBinding(e){return new ds({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:`threadId`,threadId:e}},getState:()=>Uf(this._core,e),subscribe:e=>this._core.subscribe(e)})}getById(e){return new this._runtimeFactory(new ps({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:`threadId`,threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this._createItemStateBinding(e))}getItemByIndex(e){return new zf(new ds({path:{ref:`threadItems[${e}]`,threadSelector:{type:`index`,index:e}},getState:()=>Uf(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new zf(new ds({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:`archiveIndex`,index:e}},getState:()=>Uf(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new zf(this._createItemStateBinding(e),this._core)}},Gf=class{threads;_thread;_core;constructor(e){this._core=e,this.threads=new Wf(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.registerModelContextProvider=this.registerModelContextProvider.bind(this)}get thread(){return this._thread}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}},Kf=class{_contextProvider=new _s;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}},qf={fromArray:e=>{let t=e.map(e=>bl(e,e.id??Ac(),wd(e.content)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}},fromBranchableArray:(e,t)=>({...t?.headId===void 0?void 0:{headId:t.headId},messages:e.map(({message:e,parentId:t})=>{if(!e.id)throw Error(`ExportedMessageRepository.fromBranchableArray: Each message must have an 'id' field set.`);return{parentId:t,message:bl(e,e.id,wd(e.content))}})})},Jf=e=>{let t=e;for(;t.next;)t=t.next;return`current`in t?t:null},Yf=(e,t)=>{let n=new Set(e.map(e=>e.message.id)),r=new Set,i=new Map,a=[];for(let o of e){let{parentId:e}=o;if(e!==null&&n.has(e)&&!r.has(e)&&!t(e)){let t=i.get(e);t?t.push(o):i.set(e,[o]);continue}for(let e=a.push(o)-1;e<a.length;e++){let{id:t}=a[e].message;if(r.has(t))continue;r.add(t);let n=i.get(t);n&&(i.delete(t),a.push(...n))}}for(let e of i.values())a.push(...e);return a},Xf=e=>{let t=new Set(e.messages.map(e=>e.message.id)),n=new Map,r=[];for(let{message:i,parentId:a}of e.messages){if(a===null)continue;let e=n.get(a);e?e.push(i.id):n.set(a,[i.id]),t.has(a)||r.push(i.id)}let i=new Set;for(let e=0;e<r.length;e++){let t=r[e];if(!i.has(t)){i.add(t);for(let e of n.get(t)??[])r.push(e)}}let a=e.headId!=null&&!t.has(e.headId);if(i.size===0&&!a)return{repository:e,droppedIds:[]};let o=[],s=new Set,c=e.messages.filter(({message:e,parentId:t})=>i.has(e.id)?(o.push(e.id),!1):(t!==null&&s.add(t),!0)),{headId:l}=e;if(l!=null&&(a||i.has(l))){l=null;for(let{message:e}of c)s.has(e.id)||(l=e.id)}return{repository:{...e,messages:c,...l!==void 0&&{headId:l}},droppedIds:o}},Zf=class{_value=null;func;constructor(e){this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},Qf=class{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){let n=[{message:e,level:t}];for(;n.length>0;){let e=n.pop();e.message.level=e.level;for(let t of e.message.children){let r=this.messages.get(t);r&&n.push({message:r,level:e.level+1})}}}selectPathTo(e){for(let t=e;t;t=t.prev)(t.prev??this.root).next=t}performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;if(n!==`relink`||r!==i){if(n===`relink`){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error(`MessageRepository(performOp/relink): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.`)}if(n!==`link`&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(t===void 0)throw Error(`MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.`);r.next=t}if(n!==`cut`){i.children=[...i.children,t.current.id],t.prev=e,Jf(t)===this.head?this.selectPathTo(t):i.next===null&&(i.next=t,this.head===i&&(this.head=Jf(t)));let n=e?e.level+1:0;this.updateLevels(t,n)}}}_messages=new Zf(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}get canonicalHeadId(){let e=this.head;for(;e?.current.metadata?.isOptimistic;)e=e.prev;return e?.current.id??null}getMessages(e){if(e===void 0||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.`);let n=Array(t.level+1);for(let e=t;e;e=e.prev)n[e.level]=e.current;return n}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(r===void 0)throw Error(`MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.`);if(n){this.performOp(r,n,`relink`),n.current=t,this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,`link`),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.`);return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error(`MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.`);let r=t===void 0?n.prev:t===null?null:this.messages.get(t);if(r===void 0)throw Error(`MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.`);for(let e=r;e;e=e.prev)if(e===n)throw Error(`MessageRepository(deleteMessage): Replacement is the deleted message or one of its descendants. This is likely an internal bug in assistant-ui.`);for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.`);this.performOp(r,t,`relink`)}this.performOp(null,n,`cut`),this.messages.delete(e),this.head===n&&(this.head=Jf(r??this.root)),this._messages.dirty()}hasChildren(e){return(this.messages.get(e)?.children.length??0)>0}getBranches(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.`);let{children:n}=t.prev??this.root;return n}evictOffBranchOptimisticMessages(e,t){if(!e)return;let n=new Set;for(let e=t;e;e=e.prev)n.add(e.current.id);let r=[];for(let t=e;t&&!n.has(t.current.id);t=t.prev)t.current.metadata?.isOptimistic&&r.push(t.current.id);for(let e of r)this.messages.has(e)&&this.deleteMessage(e)}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.`);let n=this.head;this.selectPathTo(t),this.head=Jf(t),this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}resetHead(e){if(e===null){this.clear();return}let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.`);let n=this.head;if(t.children.length>0){let e=[...t.children];for(;e.length>0;){let t=e.pop(),n=this.messages.get(t);if(n){for(let t of n.children)e.push(t);this.messages.delete(t)}}t.children=[],t.next=null}this.head=t,this.selectPathTo(t),this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[],t=[...this.root.children].reverse();for(;t.length>0;){let n=this.messages.get(t.pop());if(!n)continue;for(let e=n.children.length-1;e>=0;e--)t.push(n.children[e]);if(n.current.metadata?.isOptimistic)continue;let r=n.prev;for(;r&&r.current.metadata?.isOptimistic;)r=r.prev;e.push({message:n.current,parentId:r?.current.id??null})}return{headId:this.canonicalHeadId,messages:e}}import({headId:e,messages:t}){let n=Yf(t,e=>this.messages.has(e));for(let{message:e,parentId:t}of n)this.addOrUpdateMessage(t,e);this.resetHead(e??n.at(-1)?.message.id??null)}},$f=Object.freeze([]),ep=e=>{if(e?.reason!==void 0)return e.reason;let t=Error(`The attachment read was aborted`);return t.name=`AbortError`,t},tp=e=>{if(e?.aborted)throw ep(e)},np=(e,t)=>new Promise((n,r)=>{let i=new FileReader,a=()=>{i.abort(),r(ep(t))};i.onload=()=>{t?.removeEventListener(`abort`,a),n(i.result)},i.onerror=e=>{t?.removeEventListener(`abort`,a),r(e)},t?.addEventListener(`abort`,a,{once:!0});try{e(i)}catch(e){t?.removeEventListener(`abort`,a),r(e)}}),rp=e=>e.replaceAll(`&`,`&`).replaceAll(`"`,`"`).replaceAll(`<`,`<`).replaceAll(`>`,`>`),ip=class{accept=`text/plain,text/html,text/markdown,text/csv,text/xml,text/json,application/json,text/css`;async add(e){return{id:Ac(),type:`document`,name:e.file.name,contentType:e.file.type,file:e.file,status:{type:`requires-action`,reason:`composer-send`}}}async send(e,t){return{...e,status:{type:`complete`},content:[{type:`text`,text:`<attachment name="${rp(e.name)}">\n${await ap(e.file,t)}\n</attachment>`}]}}async remove(){}},ap=async(e,t)=>{let n=t?.signal;if(tp(n),typeof FileReader>`u`){let t=await e.text();return tp(n),t}return np(t=>t.readAsText(e),n)};function op(e,t){if(t===`*`)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase()),r=e.name.toLowerCase(),i=e.type.split(`;`,1)[0].trim().toLowerCase();for(let e of n){if(e.startsWith(`.`)&&r.endsWith(e)||e.includes(`/`)&&e===i)return!0;if(e.endsWith(`/*`)){let t=e.split(`/`)[0];if(i.startsWith(`${t}/`))return!0}}return!1}function sp(e){let t=Ac();return e.type===`image`?{id:t,type:`image`,name:e.filename??`image`,content:[e],status:{type:`complete`}}:e.type===`file`?{id:t,type:`document`,name:e.filename??`document`,contentType:e.mimeType,content:[e],status:{type:`complete`}}:e.type===`audio`?{id:t,type:`audio`,name:`audio.${e.audio.format}`,contentType:`audio/${e.audio.format}`,content:[e],status:{type:`complete`}}:{id:t,type:`data`,name:e.name,content:[e],status:{type:`complete`}}}function cp(e){let t=[];for(let n of e)n.type!==`text`&&t.push(sp(n));return t}var lp=e=>`content`in e&&!(`lastModified`in e),up=e=>e.status.type===`complete`,dp=class{operations=new Set;uploading=new Map;start(){let e={cancelled:!1,attachmentIds:new Set};return this.operations.add(e),e}accept(e,t){if(e.cancelled)return!1;e.attachmentIds.add(t.id);let n=this.uploading.get(t.id);return n?.operation!==e&&(n||t.status.type===`running`)&&this.uploading.set(t.id,{operation:e,waiters:n?.waiters??new Set}),t.status.type!==`running`&&this.settle(t.id,e),!0}finish(e){this.operations.delete(e);for(let t of e.attachmentIds)this.settle(t,e)}isCancelled(e){return e.cancelled}cancel(e){for(let t of[...this.operations])t.attachmentIds.has(e)&&(t.cancelled=!0,this.operations.delete(t));this.settle(e)}cancelAll(){for(let e of this.operations)e.cancelled=!0;this.operations.clear();for(let e of[...this.uploading.keys()])this.settle(e)}whenSendable(e){let t=this.uploading.get(e);if(t)return new Promise(e=>t.waiters.add(e))}settle(e,t){let n=this.uploading.get(e);if(n&&!(t&&n.operation!==t)){this.uploading.delete(e);for(let e of n.waiters)e()}}},fp=async(e,t)=>{if(Symbol.asyncIterator in e){for await(let n of e)if(!t(n))break}else t(await e)},pp=class{entries=new WeakMap;removed=new WeakSet;markRemoved(e){this.removed.add(e)}unmarkRemoved(e){this.removed.delete(e)}isRemoved(e){return this.removed.has(e)}async send(e,t,n){if(up(e))return e;let r=this.entries.get(e)??{};if(r.result)return r.result;if(!t)throw Error(`Attachments are not supported`);this.entries.set(e,r);let i=await t.send(e,n?{signal:n}:void 0);return r.result=i,i}transfer(e,t){let n=this.entries.get(e);return n&&this.entries.set(t,n),t}},mp=class extends cs{isEditing=!0;enrichWithComposerMetadata(e,t){return t?{...e,metadata:{...e.metadata,custom:{...e.metadata?.custom,...t}}}:e}get attachmentAccept(){return this.getAttachmentAdapter()?.accept??`*`}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text=``;get text(){return this._text}_role=`user`;get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){this._text!==e&&(this._text=e,this._rebaseDictation(e),this._notifySubscribers())}_rebaseDictation(e){if(!this._dictation)return;this._dictationBaseText=e,this._currentInterimText=``;let{status:t,inputDisabled:n}=this._dictation;this._dictation=n?{status:t,inputDisabled:n}:{status:t}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_submission;_submissionSend;_inTransit=[];_inTransitSubmissions=[];_sendGeneration=0;_attachmentAddOperations=new dp;_attachmentSends=new pp;get submission(){return this._submission}get inTransit(){return this._inTransitSubmissions}get isSubmitting(){return this._submission!==void 0}get detachesDraftOnSend(){return!0}threadMessageIds(e){}settleInTransit(){if(this._inTransit.length===0)return;let e=new Set,t=this._inTransit.filter(({submission:t,known:n})=>{let r=this.threadMessageIds(t.role)?.find(t=>!n.has(t)&&!e.has(t));return r===void 0||(e.add(r),!1)});t.length!==this._inTransit.length&&(this._setInTransit(t.map(t=>({...t,known:new Set([...t.known,...e])}))),this._notifySubscribers())}_setInTransit(e){this._inTransit=e,this._inTransitSubmissions=e.map(e=>e.submission)}_leaveTransit(e){let t=this._inTransit.filter(t=>t.submission!==e);return t.length!==this._inTransit.length&&(this._setInTransit(t),!0)}_cancelAttachmentAdd(e){this._attachmentAddOperations.cancel(e)}_cancelAllAttachmentAdds(){this._attachmentAddOperations.cancelAll()}_emptyTextAndAttachments(){this._attachments=[],this._text=``,this._rebaseDictation(``),this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>!up(e));await Promise.all(t.map(async t=>e.remove(t)))}}async reset(){this._cancelAllAttachmentAdds(),this._sendGeneration++;let e=this._discardSubmission();if(this._attachments.length===0&&this._text===``&&this._role===`user`&&Object.keys(this._runConfig).length===0&&this._quote===void 0){await e;return}this._role=`user`,this._runConfig={},this._quote=void 0;let t=this._onClearAttachments();this._emptyTextAndAttachments(),await Promise.all([t,e])}async clearAttachments(){if(this._cancelAllAttachmentAdds(),this.isSubmitting)for(let e of this._attachments)this._attachmentSends.markRemoved(e);let e=this._onClearAttachments();this.setAttachments([]),await e}async send(e){if(!this.canSend||this.isSubmitting)return;if(this._dictationSession){let e=this._activeDictationSessionId;try{this._dictationSession.cancel()}catch(e){console.error(`[assistant-ui] Dictation session cancel threw`,e)}finally{this._cleanupDictation({sessionId:e})}}let t=this.attachments.filter(e=>!this._attachmentSends.isRemoved(e));if(!this.text.trim()&&t.length===0)return;let n={id:Ac(),role:this.role,text:this.text,quote:this._quote,attachments:t},r={options:e,runConfig:this.runConfig},i=t.filter(up),a=i.length===t.length;if(a||(this._submission=n,this._submissionSend={...r,controller:new AbortController}),this.detachesDraftOnSend){let e=new Set(t);this._attachments=this._attachments.filter(t=>!e.has(t)),this._text=``,this._rebaseDictation(``),this._quote=void 0}let o=++this._sendGeneration;if(this._notifySubscribers(),a){this._dispatch(o,n,i,r,!1);return}await this._prepareSubmission(o)}async _prepareSubmission(e){let t=this.getAttachmentAdapter(),n=(this._submission?.attachments??[]).flatMap(e=>{let t=this._attachmentAddOperations.whenSendable(e.id);return t?[t]:[]});if(n.length>0){if(await Promise.all(n),e!==this._sendGeneration)return;this._refreshSubmissionAttachments()}let r=this._submission,i=this._submissionSend;if(!r||!i)return;let a=r.attachments.filter(e=>!this._attachmentSends.isRemoved(e));for(let e of a)this._cancelAttachmentAdd(e.id);let o=await Promise.allSettled(a.map(e=>this._attachmentSends.send(e,t,i.controller.signal)));if(e!==this._sendGeneration)return;let s=o.find(e=>e.status===`rejected`);if(s){this._returnSubmissionToDraft(a,o,s.reason);return}let c=o.flatMap((e,t)=>this._attachmentSends.isRemoved(a[t])||e.status===`rejected`?[]:[e.value]);this._dispatch(e,r,c,i,!0)}_dispatch(e,t,n,r,i){let a={createdAt:new Date,role:t.role,content:t.text?[{type:`text`,text:t.text}]:[],attachments:n,runConfig:r.runConfig,metadata:{custom:{...t.quote?{quote:t.quote}:{}}}},o={...t,attachments:n},s=this.queue.length;if(i){if(this._submission=void 0,this._submissionSend=void 0,!this.detachesDraftOnSend){let e=new Map(n.map(e=>[e.id,e]));this._attachments=this._attachments.map(t=>e.get(t.id)??t)}let e=this.threadMessageIds(t.role);e&&this._setInTransit([...this._inTransit,{submission:o,known:new Set(e)}])}let c;try{c=this.handleSend(a,r.options)}catch(t){console.error(`[assistant-ui] Failed to send the message`,t),this._leaveTransit(o),e===this._sendGeneration?this._returnToDraft(o):this._notifySubscribers();return}c&&c.catch(t=>{let n=this._leaveTransit(o);e===this._sendGeneration&&Xd(t)?this._returnToDraft(o):n&&this._notifySubscribers()}),this._notifyEventSubscribers(`send`,{chars:t.text.length,attachments:n.length}),i&&(this.queue.length>s&&this._leaveTransit(o),this._notifySubscribers(),this.settleInTransit())}_refreshSubmissionAttachments(){let e=this._submission;if(!e)return;let t=e.attachments.filter(e=>!this._attachmentSends.isRemoved(e));t.length!==e.attachments.length&&(this._submission={...e,attachments:t})}_returnSubmissionToDraft(e,t,n){let r=this._submission;if(!r)return;let i=new Map;t.forEach((t,n)=>{t.status===`rejected`&&i.set(e[n].id,t.reason)});let a=r.attachments.map(e=>{if(!i.has(e.id)||up(e))return e;let t=i.get(e.id);return this._attachmentSends.transfer(e,{...e,status:{type:`incomplete`,reason:`error`,message:t instanceof Error?t.message:String(t)}})});this._endSubmission(),this._returnToDraft({...r,attachments:a}),console.error(`[assistant-ui] Failed to send attachments`,n)}_endSubmission(){this._sendGeneration++,this._submission=void 0,this._submissionSend=void 0}__internal_dispose(){this._cancelAllAttachmentAdds(),this._submission&&(this._submissionSend?.controller.abort(),this._endSubmission(),this._notifySubscribers())}cancelSubmission(){let e=this._submission;e&&(this._submissionSend?.controller.abort(),this._endSubmission(),this._returnToDraft(e))}_returnToDraft(e){if(this.detachesDraftOnSend){let t=e.attachments.filter(e=>!this._attachmentSends.isRemoved(e));this._attachments=[...t,...this._attachments];let n=[e.text,this._text].filter(Boolean).join(`
|
|
14
|
+
`);this._text=n,this._rebaseDictation(n),this._quote=this._quote??e.quote}else{let t=new Map(e.attachments.map(e=>[e.id,e]));this._attachments=this._attachments.map(e=>t.get(e.id)??e)}this._notifySubscribers()}async _discardSubmission(){let e=this._submission;if(!e)return;this._submissionSend?.controller.abort(),this._endSubmission(),this._notifySubscribers();let t=this.getAttachmentAdapter();if(!t)return;let n=new Set(this._attachments.map(e=>e.id));await Promise.all(e.attachments.filter(e=>!up(e)&&!n.has(e.id)).map(async e=>t.remove(e)))}restoreDraft(e){return this._text.trim()||this._quote!==void 0||this._attachments.length>0?!1:(this._text=e.text,this._rebaseDictation(e.text),this._quote=e.quote,this._attachments=e.attachments??[],this._notifySubscribers(),!0)}retractDraft(e){let t=e.attachments===void 0?this._attachments.length===0:this._attachments===e.attachments;this._text!==e.text||this._quote!==e.quote||!t||(this._text=``,this._rebaseDictation(``),this._quote=void 0,this._attachments=[],this._notifySubscribers())}cancel(){this.isSubmitting&&!this.detachesDraftOnSend&&(this._submissionSend?.controller.abort(),this._endSubmission(),this._notifySubscribers()),this.handleCancel()}get queue(){return $f}moveQueueItem(e,t){}removeQueueItem(e){}async addAttachment(e){if(lp(e)){let t=this.getAttachmentAdapter();if(t&&!op({name:e.name,type:e.contentType??``},t.accept)){let n=`File type ${e.contentType||`unknown`} is not accepted. Accepted types: ${t.accept}`,r=Error(n);throw this._safeEmitAttachmentAddError(`not-accepted`,n,void 0,r,e.contentType),r}let n={id:e.id??Ac(),type:e.type??`document`,name:e.name,contentType:e.contentType,content:e.content,status:{type:`complete`}};this._attachments=[...this._attachments,n],this._notifySubscribers(),this._notifyEventSubscribers(`attachmentAdd`,{...n.contentType?{contentType:n.contentType}:void 0});return}let t=this.getAttachmentAdapter();if(!t){let t=`Attachments are not supported`,n=Error(t);throw this._safeEmitAttachmentAddError(`no-adapter`,t,void 0,n,e.type),n}if(!op({name:e.name,type:e.type},t.accept)){let n=`File type ${e.type||`unknown`} is not accepted. Accepted types: ${t.accept}`,r=Error(n);throw this._safeEmitAttachmentAddError(`not-accepted`,n,void 0,r,e.type),r}let n=this._attachmentAddOperations.start(),r=e=>{if(!this._attachmentAddOperations.accept(n,e))return!1;let t=this._submission,r=t?.attachments.some(t=>t.id===e.id)??!1;t&&r&&(this._submission={...t,attachments:t.attachments.map(t=>t.id===e.id?this._attachmentSends.transfer(t,e):t)});let i=this._attachments.findIndex(t=>t.id===e.id);return i===-1?r||(this._attachments=[...this._attachments,e]):this._attachments=[...this._attachments.slice(0,i),e,...this._attachments.slice(i+1)],this._notifySubscribers(),!0},i;try{await fp(t.add({file:e}),e=>(i=e,r(e)))}catch(t){if(this._attachmentAddOperations.isCancelled(n))return;throw i&&r({...i,status:{type:`incomplete`,reason:`error`,message:t instanceof Error?t.message:String(t)}}),this._safeEmitAttachmentAddError(`adapter-error`,t instanceof Error?t.message:String(t),i?.id,t instanceof Error?t:void 0,i?.contentType||e.type),t}finally{this._attachmentAddOperations.finish(n)}this._attachmentAddOperations.isCancelled(n)||(i?.status.type===`incomplete`&&i.status.reason===`error`?this._safeEmitAttachmentAddError(`adapter-error`,i.status.message??`Attachment upload did not complete successfully.`,i.id,void 0,i.contentType||e.type):this._notifyEventSubscribers(`attachmentAdd`,{...i?.contentType?{contentType:i.contentType}:e.type?{contentType:e.type}:void 0}))}_safeEmitAttachmentAddError(e,t,n,r,i){try{this._notifyEventSubscribers(`attachmentAddError`,{reason:e,message:t,...n!==void 0&&{attachmentId:n},...r!==void 0&&{error:r},...i?{contentType:i}:void 0})}catch(e){console.error(`[assistant-ui] attachmentAddError subscriber threw:`,e)}}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(t===-1){await this._removeSubmittedAttachment(e);return}let n=this._attachments[t];if(this._cancelAttachmentAdd(e),this._attachmentSends.markRemoved(n),!up(n)){let t=this.getAttachmentAdapter();if(!t)throw Error(`Attachments are not supported`);try{await t.remove(n)}catch(t){let n=t instanceof Error?t.message:String(t);throw this._attachments=this._attachments.map(t=>t.id===e&&!up(t)?this._attachmentSends.transfer(t,{...t,status:{type:`incomplete`,reason:`error`,message:n}}):t),this._notifySubscribers(),t}}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}async _removeSubmittedAttachment(e){let t=this._submission?.attachments.find(t=>t.id===e);if(!t)throw Error(`Attachment not found`);if(this._cancelAttachmentAdd(e),this._attachmentSends.markRemoved(t),!up(t)){let n=this.getAttachmentAdapter();if(!n)throw Error(`Attachments are not supported`);try{await n.remove(t)}catch(t){throw this._failSubmittedRemoval(e,t),t}}let n=this._submission;n&&(this._submission={...n,attachments:n.attachments.filter(t=>t.id!==e)},this._notifySubscribers())}_failSubmittedRemoval(e,t){let n=this._submission;if(!n)return;let r=t instanceof Error?t.message:String(t);this._submission={...n,attachments:n.attachments.map(t=>{if(t.id!==e||up(t))return t;let n=this._attachmentSends.transfer(t,{...t,status:{type:`incomplete`,reason:`error`,message:r}});return this._attachmentSends.markRemoved(n),n})},this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText=``;_currentInterimText=``;_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error(`Dictation adapter not configured`);let t=this._dictationSession!==void 0;if(this._dictationSession){let e=this._dictationSession;this._cleanupDictation({notify:!1}),this._stopDictationSession(e)}let n=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText=``;let r;try{r=e.listen()}catch(e){if(t)try{this._notifySubscribers()}catch(e){console.error(`[assistant-ui] Dictation replacement rollback notification threw`,e)}throw e}this._dictationSession=r;let i=++this._dictationSessionIdCounter;this._activeDictationSessionId=i,this._dictation={status:r.status,inputDisabled:n};try{this._notifySubscribers()}catch(e){console.error(`[assistant-ui] Dictation start notification threw`,e)}if(!this._isActiveSession(i,r))return;let a=[],o=()=>{for(let e of a.splice(0))try{e()}catch(e){console.error(`[assistant-ui] Dictation cleanup threw`,e)}},s=e=>(a.push(e),this._isActiveSession(i,r)?!0:(o(),!1));try{if(!s(r.onSpeech(e=>{if(!this._isActiveSession(i,r))return;let t=e.isFinal!==!1,n=this._dictationBaseText&&!this._dictationBaseText.endsWith(` `)&&e.transcript?` `:``;if(t){if(this._dictationBaseText=this._dictationBaseText+n+e.transcript,this._currentInterimText=``,this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=n+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&={...this._dictation,transcript:e.transcript},this._notifySubscribers()}))||!s(r.onSpeechStart(()=>{this._isActiveSession(i,r)&&(this._dictation={status:{type:`running`},inputDisabled:n,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())}))||!s(r.onSpeechEnd(()=>{this._cleanupDictation({sessionId:i})})))return;let e=setInterval(()=>{this._isActiveSession(i,r)&&r.status.type===`ended`&&this._cleanupDictation({sessionId:i})},100);if(!s(()=>clearInterval(e)))return;this._dictationUnsubscribes.push(...a.splice(0))}catch(e){if(o(),this._isActiveSession(i,r))try{r.cancel()}catch(e){console.error(`[assistant-ui] Dictation session cancel threw`,e)}finally{this._cleanupDictation({sessionId:i})}throw e}}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;this._stopDictationSession(e,()=>this._cleanupDictation({sessionId:t}))}_stopDictationSession(e,t=()=>{}){let n;try{n=e.stop()}catch(e){console.error(`[assistant-ui] Dictation session stop threw`,e),t();return}n.then(t,e=>{console.error(`[assistant-ui] Dictation session stop rejected`,e),t()})}_cleanupDictation(e){if(e?.sessionId!==void 0&&e.sessionId!==this._activeDictationSessionId||this._isCleaningDictation)return;this._isCleaningDictation=!0;let t=e=>{try{e()}catch(e){console.error(`[assistant-ui] Dictation cleanup threw`,e)}};try{let n=this._dictationUnsubscribes;this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText=``,this._currentInterimText=``;for(let e of n)t(e);e?.notify!==!1&&t(()=>this._notifySubscribers())}finally{this._isCleaningDictation=!1}}_eventSubscribers=new Map;_notifyEventSubscribers(e,t){let n=this._eventSubscribers.get(e);n&&la(n,t,`Composer runtime "${e}"`)}unstable_on(e,t){let n=t,r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(n),()=>{this._eventSubscribers.get(e)?.delete(n)}}},hp=e=>e.capabilities?.cancel?Tf(e):!1,gp=class extends mp{get canCancel(){return this.isSubmitting||hp(this.runtime)}get canSend(){if(this.isEmpty||this.runtime.isSendDisabled||this.isSubmitting)return!1;let e=this.runtime.voice;return!e||e.canSendText&&this.role===`user`&&this.attachments.length===0}cancel(){if(!this.isSubmitting){super.cancel();return}this.cancelSubmission(),hp(this.runtime)&&super.cancel()}threadMessageIds(e){return this.runtime.messages.filter(t=>t.role===e).map(e=>e.id)}_queueCache;get queue(){let e=this.runtime.getSteerQueueItems?.()??$f,t=this.runtime.getQueueItems?.()??$f,n=this._queueCache;if(n&&n.steer===e&&n.queue===t)return n.flat;let r=e.length===0?t:t.length===0?e:[...e,...t];return this._queueCache={steer:e,queue:t,flat:r},r}moveQueueItem(e,t){this.runtime.moveQueueItem?.(e,t)}removeQueueItem(e){this.runtime.removeQueueItem?.(e)}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}runtime;constructor(e){super(),this.runtime=e,this.connect()}connect(){let e=!1,t=this.runtime.isSendDisabled,n=this.runtime.voice?.canSendText,r=this.queue;return this.runtime.subscribe(()=>{this.settleInTransit();let i=!1,a=this.canCancel;e!==a&&(e=a,i=!0),t!==this.runtime.isSendDisabled&&(t=this.runtime.isSendDisabled,i=!0);let o=this.runtime.voice?.canSendText;n!==o&&(n=o,i=!0),r!==this.queue&&(r=this.queue,i=!0),i&&this._notifySubscribers()})}async handleSend(e,t){return this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null,startRun:t?.startRun,steer:t?.steer})}async handleCancel(){this.runtime.cancelRun()}},_p=class extends mp{get canCancel(){return!0}get detachesDraftOnSend(){return!1}get canSend(){return!this.isEmpty&&!this.runtime.voice&&!this.isSubmitting}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_nonTextPassthrough;_parentId;_sourceId;runtime;endEditCallback;_ended=!1;constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e;let i=e.voice!==void 0,a=e.subscribe(()=>{let t=e.voice!==void 0;t!==i&&(i=t,this._notifySubscribers())});this.endEditCallback=()=>{a(),t()},this._parentId=n,this._sourceId=r.id,this.setText(Js(r)),this.setRole(r.role);let o;r.role===`user`?(o=[...r.attachments??[],...cp(r.content)],this._nonTextPassthrough=[]):(o=r.attachments??[],this._nonTextPassthrough=r.content.filter(e=>e.type!==`text`)),this.setAttachments(o),this.setRunConfig({...e.composer.runConfig})}get parentId(){return this._parentId}get sourceId(){return this._sourceId}async handleSend(e,t){let n=this._nonTextPassthrough.length>0?[...e.content,...this._nonTextPassthrough]:e.content,r=this.runtime.append({...e,content:n,parentId:this._parentId,sourceId:this._sourceId,startRun:t?.startRun});return this.handleCancel(),r}handleCancel(){this._ended||(this._ended=!0,this.reset().catch(e=>{console.error(`[assistant-ui] Failed to clear cancelled edit`,e)}),this.endEditCallback(),this._notifySubscribers())}},vp=class extends cs{_isInitialized=!1;repository=new Qf;_voiceMessages=[];_voiceGeneration=0;_cachedMergedMessages=null;_cachedVoiceGeneration=-1;_cachedMergedBase=null;_markVoiceMessagesDirty(){this._voiceGeneration++,this._cachedMergedMessages=null}_getBaseMessages(){return this.repository.getMessages()}_commitVoiceMessage(e){}_onMessageMetadataChanged(e,t){}_dropVoiceMessage(e,t){let n=this._voiceMessages.findIndex(t=>t.id===e);n!==-1&&(this._voiceMessages.splice(n,1),this._markVoiceMessagesDirty(),t&&this._notifySubscribers())}get messages(){if(this._voiceMessages.length===0)return this._getBaseMessages();let e=this._getBaseMessages();if(this._cachedVoiceGeneration!==this._voiceGeneration||this._cachedMergedBase!==e){let t=new Set(e.map(e=>e.id));this._cachedMergedMessages=[...e,...this._voiceMessages.filter(e=>!t.has(e.id))],this._cachedVoiceGeneration=this._voiceGeneration,this._cachedMergedBase=e}return this._cachedMergedMessages}get state(){let e;for(let t of this.messages)t.role===`assistant`&&(e=t);return e?.metadata.unstable_state??null}composer=new gp(this);_contextProvider;constructor(e){super(),this._contextProvider=e,Pf(this).addEventListener(`abort`,()=>{this.composer.__internal_dispose();for(let e of this._editComposers.values())e.__internal_dispose()})}getModelContext(){return this._contextProvider.getModelContext()}enrichAppendMetadata(e,t=e.parentId){if(e.role!==`user`)return e;let n=this.messages,r=t===null?-1:n.findIndex(e=>e.id===t),i=md(this.getModelContext().unstable_composerMetadata,n.slice(0,r+1));return i?{...e,metadata:{...e.metadata,custom:{...e.metadata?.custom,...i}}}:e}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}_isVoiceMessage(e){return e!==null&&this._voiceMessages.some(t=>t.id===e)}_resolveAppendParent(e){return this._isVoiceMessage(e)?this._getBaseMessages().at(-1)?.id??null:e}beginEdit(e){if(this.voice)throw Error(`Cannot edit a message while a voice session is connected`);if(this._isVoiceMessage(e))throw Error(`Voice transcript messages cannot be edited`);if(this._editComposers.has(e))throw Error(`Edit already in progress`);this._editComposers.set(e,new _p(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{let t=this.repository.getMessages(),n=this._voiceMessages.findIndex(t=>t.id===e);return n===-1?void 0:{parentId:n>0?this._voiceMessages[n-1].id:t.at(-1)?.id??null,message:this._voiceMessages[n],index:t.length+n}}}getBranches(e){return this._voiceMessages.some(t=>t.id===e)?[]:this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifyEventSubscribers(e,t){let n=this._eventSubscribers.get(e);n&&la(n,t,`Thread runtime "${e}"`)}_notifyToolApprovalAnswered(e,t,n,r){this._notifyEventSubscribers(`toolApprovalAnswered`,{messageId:e,toolCallId:t,toolName:n,approved:r})}submitFeedback({messageId:e,type:t,comment:n}){let r=this.adapters?.feedback,i=this.getMessageById(e);if(!i)throw Error(`Message not found: ${e}`);let{message:a,parentId:o}=i,s=n?.trim(),c={type:t,...s?{comment:s}:void 0};if(r?.submit({message:a,...c}),a.role===`assistant`){let t={...a,metadata:{...a.metadata,submittedFeedback:c}},n=this._voiceMessages.findIndex(t=>t.id===e);n===-1?(this.repository.addOrUpdateMessage(o,t),this._onMessageMetadataChanged(a,t)):(this._voiceMessages[n]=t,this._currentAssistantMsg===a&&(this._currentAssistantMsg=t),this._markVoiceMessagesDirty())}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error(`Speech adapter not configured`);let n=this.getMessageById(e);if(!n)throw Error(`Message not found: ${e}`);let{message:r}=n,i=this._stopSpeaking,a;try{i?.(),a=t.speak(Js(r))}catch(e){if(i&&!this._stopSpeaking)try{this._notifySubscribers()}catch(e){console.error(`[assistant-ui] Speech rollback notification threw`,e)}throw e}let o,s=()=>{this._stopSpeaking=void 0,this.speech=void 0;let e=o;o=void 0,e?.()},c=()=>{if(this._stopSpeaking===c)try{s()}finally{a.cancel()}},l=()=>{this._stopSpeaking===c&&(a.status.type===`ended`?is([s,()=>this._notifySubscribers()]):(this.speech={messageId:e,status:a.status},this._notifySubscribers()))};this._stopSpeaking=c;try{if(o=a.subscribe(l),this._stopSpeaking!==c){o();return}l()}catch(e){if(this._stopSpeaking===c)try{is([c,()=>this._notifySubscribers()])}catch(e){console.error(`[assistant-ui] Speech rollback cleanup threw`,e)}throw e}}stopSpeaking(){if(!this._stopSpeaking)throw Error(`No message is being spoken`);is([this._stopSpeaking,()=>this._notifySubscribers()])}_voiceSession;_voiceUnsubs=[];voice;_voiceVolume=0;_voiceVolumeSubscribers=new Set;getVoiceVolume=()=>this._voiceVolume;subscribeVoiceVolume=e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e));_onVoiceConnected(){}_onVoiceDisconnected(){}_toVoiceSessionState(e,t,n){return{status:t,isMuted:e.isMuted,mode:n,canSendText:t.type===`running`&&e.sendText!==void 0}}_isRunActive(){if(this.isRunning)return!0;let e=this._getBaseMessages().at(-1);return e?.role===`assistant`&&(e.status.type===`running`||e.status.type===`requires-action`)}_getVoiceCommitBarrier(){if(!this.isLoading)return;let e=jf(this);return(async()=>{for(;this.isLoading&&!e.aborted;)await new Promise(t=>{let n=()=>{r(),e.removeEventListener(`abort`,n),t()},r=this.subscribe(n);e.addEventListener(`abort`,n)})})()}connectVoice(){let e=this.adapters?.voice;if(!e)throw Error(`Voice adapter not configured`);if(this._isRunActive())throw Error(`Cannot start a voice session while a run is in progress or paused on a pending tool action`);let t=this._voiceSession!==void 0;try{this._disconnectVoice(!1)}catch(e){console.error(`[assistant-ui] Voice cleanup threw before reconnect`,e)}let n;try{n=e.connect({})}catch(e){throw t&&this._voiceSession===void 0&&this._onVoiceDisconnected(),e}this._voiceSession=n;let r=[];this._voiceUnsubs=r;let i=()=>{if(this._voiceSession===n&&this._voiceUnsubs===r)return!1;try{is(r.splice(0))}catch(e){console.error(`[assistant-ui] Detached voice setup cleanup threw`,e)}return!0};try{let e=`listening`;if(this.voice=this._toVoiceSessionState(n,n.status,e),this._voiceVolume=0,this._notifySubscribers(),i()||(r.push(n.onStatusChange(t=>{if(this._voiceSession===n){if(t.type===`ended`){this._voiceSession=void 0,this.voice=void 0;try{this._finishVoiceAssistantMessage(!1),this._onVoiceDisconnected(),this._notifySubscribers()}finally{i()}}else this.voice=this._toVoiceSessionState(n,t,e),this._notifySubscribers()}})),i())||(r.push(n.onModeChange(t=>{this._voiceSession===n&&(e=t,this.voice&&(this.voice={...this.voice,mode:t},this._notifySubscribers()))})),i())||(r.push(n.onVolumeChange(e=>{this._voiceSession===n&&(this._voiceVolume=e,la(this._voiceVolumeSubscribers,void 0,`Voice volume`))})),i()))return;r.push(n.onTranscript(e=>{this._voiceSession===n&&this._handleVoiceTranscript(e)})),i()||this._onVoiceConnected()}catch(e){if(this._voiceSession===n&&this._voiceUnsubs===r){try{this._disconnectVoice(!1)}catch(e){console.error(`[assistant-ui] Voice rollback cleanup threw`,e)}t&&this._voiceSession===void 0&&this._onVoiceDisconnected()}else i();throw e}}_currentAssistantMsg=null;_observeVoiceCommit(e){new Promise(t=>t(e())).catch(e=>{console.error(`[assistant-ui] Voice message commit failed`,e)})}_handleVoiceTranscript(e){if(this.ensureInitialized(),e.role===`user`)this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&this._observeVoiceCommit(()=>this._commitVoiceUserMessage({id:Ac(),role:`user`,content:[{type:`text`,text:e.text}],metadata:{modality:`voice`,custom:{}},createdAt:new Date,attachments:[]}));else{let t=e.isFinal?{type:`complete`,reason:`stop`}:{type:`running`};if(!this._currentAssistantMsg)this._currentAssistantMsg={id:Ac(),role:`assistant`,content:[{type:`text`,text:e.text}],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],modality:`voice`,custom:{}},status:t,createdAt:new Date},this._voiceMessages.push(this._currentAssistantMsg);else{let n=this._voiceMessages.indexOf(this._currentAssistantMsg);if(n===-1)return;let r={...this._currentAssistantMsg,content:[{type:`text`,text:e.text}],status:t};this._voiceMessages[n]=r,this._currentAssistantMsg=r}if(e.isFinal){let e=this._currentAssistantMsg;this._observeVoiceCommit(()=>this._commitVoiceMessage(e)),this._currentAssistantMsg=null}this._markVoiceMessagesDirty(),this._notifySubscribers()}}_commitVoiceUserMessage(e){this._voiceMessages.push(e);try{return this._commitVoiceMessage(e)}finally{this._markVoiceMessagesDirty(),this._notifySubscribers()}}async _appendToVoiceSession(e){let t=this._voiceSession;if(!this.voice?.canSendText||!t?.sendText)throw Error(`Cannot send a text message while a voice session is connected`);let n=e.content.filter(e=>e.type===`text`);if(e.role!==`user`||e.sourceId!=null||e.parentId!==this._resolveAppendParent(this.messages.at(-1)?.id??null)||e.attachments?.length||n.length!==e.content.length||!n.some(e=>e.text.trim()))throw Error(`Only a plain text user message can be sent while a voice session is connected`);let r=this.enrichAppendMetadata(e);this.ensureInitialized();let i=jf(this);try{await t.sendText(Js(e))}catch(e){if(i.aborted)return;let t=new Yd;throw t.cause=e,t}if(!i.aborted){if(this._voiceSession!==t)throw new Yd(`The voice session ended before the typed message was recorded`);this._finishVoiceAssistantMessage(!1),this._currentAssistantMsg=null,await this._commitVoiceUserMessage({id:Ac(),role:`user`,content:n,metadata:{custom:{...r.metadata?.custom}},createdAt:e.createdAt,attachments:[]})}}_finishVoiceAssistantMessage(e=!0){let t=this._voiceMessages.at(-1);if(t?.role===`assistant`&&t.status.type===`running`){let n=this._voiceMessages.length-1;this._voiceMessages[n]={...t,status:{type:`complete`,reason:`stop`}},this._observeVoiceCommit(()=>this._commitVoiceMessage(this._voiceMessages[n])),this._currentAssistantMsg=null,this._markVoiceMessagesDirty(),e&&this._notifySubscribers()}}disconnectVoice(){this._disconnectVoice(!0)}_disconnectVoice(e){this._finishVoiceAssistantMessage(!1),this._currentAssistantMsg=null;let t=this._voiceUnsubs.splice(0);this._voiceUnsubs=[];let n=this._voiceSession;this._voiceSession=void 0,this.voice=void 0,this._voiceVolume=0;let r=this.speech&&this._isVoiceMessage(this.speech.messageId)?this._stopSpeaking:void 0;this._voiceMessages=[],this._markVoiceMessagesDirty();try{is([...t,...r?[r]:[],...n?[()=>n.disconnect()]:[],()=>la(this._voiceVolumeSubscribers,void 0,`Voice volume`),()=>this._notifySubscribers()])}finally{e&&n&&this._voiceSession===void 0&&this._onVoiceDisconnected()}}muteVoice(){if(!this._voiceSession)throw Error(`No active voice session`);this._voiceSession.mute(),this.voice={...this.voice,isMuted:!0},this._notifySubscribers()}unmuteVoice(){if(!this._voiceSession)throw Error(`No active voice session`);this._voiceSession.unmute(),this.voice={...this.voice,isMuted:!1},this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers(`initialize`,{}))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(qf.fromArray(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){let n=t;if(e===`modelContextUpdate`)return this._contextProvider.subscribe?.(()=>la([n],{},`Thread runtime "${e}"`))??(()=>{});let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(n),e===`initialize`&&this._isInitialized&&queueMicrotask(()=>{r.has(n)&&la([n],{},`Thread runtime "${e}"`)}),()=>{this._eventSubscribers.get(e)?.delete(n)}}},yp=ni(!1),bp=e=>ar(yp,!0,e),xp=e=>e.status?.type!==`running`,Sp=async(e,t)=>{let n=Yu.fromAssistantStream(e);for await(let e of n){let n=e.parts.filter(e=>e.type===`text`)[0]?.text;n?.trim()&&await t(n)}},Cp=(e,t)=>{let n=()=>void t.generateTitle({automatic:!0}).catch(e=>{Ps(e)||console.error(`[assistant-ui] Thread title generation failed`,e)}),r=()=>e.getState().messages.some(xp);if(r())return n(),()=>{};let i=e.subscribe(()=>{r()&&(i(),n())});return i},wp=({threadId:e,generation:t,runtimeHook:n,publish:r,itemRuntime:i})=>{let a=bp(n),o=a?.thread?.__internal_threadBinding,s=Ur(()=>{o&&r(e,o.getState(),t)},[e,t,o,r]),c=R(!1);c.current||s(),z(()=>{if(o)return c.current=!0,s(),o.outerSubscribe(s)},[o,s]);let l=R(void 0),u=R(!1),d=R(i.getState().status===`new`),f=R(void 0),p=R(!1),m=Gr(()=>{if(u.current||i.getState().status!==`new`&&!d.current)return;u.current=!0,d.current=!1;let e=i.initialize();l.current=e,e.then(()=>{p.current&&(f.current?.(),f.current=Cp(a.thread,i))},()=>{l.current===e&&(l.current=void 0,u.current=!1)})}),h=Gr(()=>(m(),l.current));return z(()=>{if(!o)return;let e=o.getState(),t=e.__internal_setGetInitializePromise;typeof t==`function`&&t.call(e,h)},[o]),z(()=>{if(!a?.threads?.main)return;u.current=!1,p.current=!0;let e=a.threads.main.unstable_on(`initialize`,m);return()=>{p.current=!1,e(),f.current?.(),f.current=void 0}},[a]),a},Tp=H(({threadId:e,generation:t,parentList:n,runtimeHook:r,parentClient:i,adapters:a,publish:o,destroySignal:s})=>{let c=Hr(()=>new zf(new ds({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:`threadId`,threadId:e}},getState:()=>{let t=n.getItemById(e);return t?{id:t.id,remoteId:t.remoteId,externalId:t.externalId,title:t.title,lastMessageAt:t.lastMessageAt,custom:t.custom,status:t.status,isMain:t.id===n.mainThreadId,isRunning:n.unstable_isThreadRunning?.(t.id)??!1}:rs},subscribe:e=>n.subscribe(e)}),n),[n,e]),{client:l}=Wo(i,{threadListItem:zl({runtime:c})});return po(s,function(){return La(l,function(){return au(a,function(){return wp({threadId:e,generation:t,runtimeHook:r,publish:o,itemRuntime:c})})})})}),Ep=[`runStart`,`runEnd`,`initialize`,`modelContextUpdate`],Dp=e=>{let t=F(3),{detectorRef:n}=e,r,i;return t[0]===n?(r=t[1],i=t[2]):(r=()=>{n.current=!0},i=[n],t[0]=n,t[1]=r,t[2]=i),Wr(r,i),null},Op=class extends cs{runtimeHook;adapterStore=new ls({defaultAdapters:null,threadAdapters:new Map});hostStore=new ls({threads:[],hookEpoch:0});pendingThreadAdapters=new Map;instances=new Map;nextGeneration=0;parent;constructor(e,t){super(),this.parent=t,this.runtimeHook=e}_whenRuntimeAttached(e){return new Promise((t,n)=>{let r=()=>{let r=this.instances.get(e);if(!r)i(),n(Error(`Thread was deleted before runtime was started`));else if(!r.runtime||r.publishedGeneration!==r.generation)return;else i(),t(r.runtime)},i=this.subscribe(r);r()})}startThreadRuntime(e){if(!this.instances.has(e)){let t=this.nextGeneration++;this.instances.set(e,{generation:t,isRunning:!1,destroy:new AbortController}),this._syncHostThreads()}return this._whenRuntimeAttached(e)}__internal_restartThreadRuntime(e){let t=this.instances.get(e);if(!t)return this.startThreadRuntime(e);try{t.unsubscribeRunning?.()}finally{t.unsubscribeRunning=void 0,t.runtime&&Lf(t.runtime),t.destroy.abort(),t.destroy=new AbortController,t.generation=this.nextGeneration++,this._syncHostThreads(),this._notifySubscribers()}return this._whenRuntimeAttached(e)}getThreadRuntimeCore(e){let t=this.instances.get(e);if(t)return t.runtime}__internal_isThreadRunning(e){return this.instances.get(e)?.isRunning??!1}runningSubscribers=new Set;__internal_subscribeRunningChanged(e){return this.runningSubscribers.add(e),()=>this.runningSubscribers.delete(e)}threadEventSubscribers=new Set;__internal_subscribeThreadEvents(e){return this.threadEventSubscribers.add(e),()=>this.threadEventSubscribers.delete(e)}_publish=(e,t,n)=>{this._publishThreadRuntime(e,t,n)};_publishThreadRuntime(e,t,n){let r=this.instances.get(e);if(!r||r.generation!==n)return;let i=r.runtime,a=r.publishedGeneration;r.runtime=t,r.publishedGeneration=n;try{i!==t&&this._trackRunning(e,r)}finally{try{this._notifySubscribers(),i!==void 0&&i!==t&&is(this.replacedSubscribers)}finally{a===n&&i!==void 0&&i!==t&&Rf(i)}}}replacedSubscribers=new Set;__internal_subscribeRuntimeReplaced(e){return this.replacedSubscribers.add(e),()=>this.replacedSubscribers.delete(e)}_trackRunning(e,t){let n=t.unsubscribeRunning;t.unsubscribeRunning=void 0;try{n?.()}finally{let n=t.runtime;if(!n)this._setRunning(t,!1);else{let r=Tf(n);t.isRunning!==r&&(t.isRunning=r,queueMicrotask(()=>is(this.runningSubscribers)));let i=[n.subscribe(()=>{this._setRunning(t,Tf(n))}),...Ep.map(t=>n.unstable_on(t,()=>{la(this.threadEventSubscribers,{threadId:e,type:t},`Thread event "${t}"`)}))];t.unsubscribeRunning=()=>as(i)}}}_setRunning(e,t){e.isRunning!==t&&(e.isRunning=t,is(this.runningSubscribers))}stopThreadRuntime(e){let t=this.instances.get(e);try{t?.unsubscribeRunning?.()}finally{t?.runtime&&Rf(t.runtime),t?.destroy.abort(),this.instances.delete(e),this.pendingThreadAdapters.delete(e),this._syncHostThreads(),this._notifySubscribers()}}setRuntimeHook(e){if(this.runtimeHook===e)return;this.runtimeHook=e;let t=this.hostStore.getState();this.hostStore.setState({...t,hookEpoch:t.hookEpoch+1})}__internal_setDefaultAdapters(e){let t=this.adapterStore.getState();t.defaultAdapters!==e&&this.adapterStore.setState({...t,defaultAdapters:e})}__internal_setThreadAdapters(e,t){let n=this.adapterStore.getState(),r=new Map(n.threadAdapters);t===null?r.delete(e):r.set(e,t),this.adapterStore.setState({...n,threadAdapters:r})}__internal_dispose(){for(let e of[...this.instances.keys()])try{this.stopThreadRuntime(e)}catch(e){console.error(`[assistant-ui] Thread runtime cleanup threw while stopping a thread`,e)}}_syncHostThreads(){let e=this.hostStore.getState();this.hostStore.setState({...e,threads:Array.from(this.instances.entries()).map(([e,{generation:t,destroy:n}])=>({id:e,generation:t,destroySignal:n.signal}))})}_threadElements(e,{threads:t,hookEpoch:n},r){let i=this.runtimeHook;return t.map(({id:t,generation:a,destroySignal:o})=>{let s=this.pendingThreadAdapters.has(t)?this.pendingThreadAdapters.get(t):r.threadAdapters.get(t)??r.defaultAdapters;return U(`${t}:${a}:${n}`,Tp({threadId:t,generation:a,parentList:this.parent,runtimeHook:i,parentClient:e,adapters:s,publish:this._publish,destroySignal:o}))})}__internal_useHost(e){let t=Ms(this.hostStore),n=Ms(this.adapterStore);return ia(this._threadElements(e,t,n))}__internal_RenderThreadRuntimes=({provider:e})=>(Ms(this.hostStore),Array.from(this.instances.entries()).map(([t,{generation:n}])=>(0,I.jsx)(this._OuterActiveThreadProvider,{threadId:t,provider:e},`${t}:${n}`)));__internal_Host=({parentClient:e})=>{let t=Ms(this.hostStore),n=Ms(this.adapterStore),r=this._threadElements(e,t,n),{effects:i}=oa(function(){return ia(r)});return Wr(i),null};_OuterActiveThreadProvider=Zr(({threadId:e,provider:t})=>{let n=Hr(()=>new Wf(this.parent).getItemById(e),[e]),r=R(!1);return z(()=>{},[t]),(0,I.jsx)(Dd,{runtime:n,children:(0,I.jsx)(t,{children:(0,I.jsx)(this._AdapterSink,{threadId:e,detectorRef:r})})})});_AdapterSink=({threadId:e,detectorRef:t})=>{let n=ou();return this.pendingThreadAdapters.set(e,n),Wr(()=>(this.__internal_setThreadAdapters(e,n),()=>{this.pendingThreadAdapters.get(e)===n&&this.pendingThreadAdapters.delete(e),this.__internal_setThreadAdapters(e,null)}),[e,n]),(0,I.jsx)(Dp,{detectorRef:t})}};function kp(e,t,n,...r){if(!n)return;let i=n=>{try{console.error(`[${e}] ${t} callback threw an error`,n)}catch{}};try{let e=n(...r);if(e!==null&&(typeof e==`object`||typeof e==`function`)&&`then`in e&&typeof e.then==`function`)return Promise.resolve(e).then(()=>void 0,e=>i(e))}catch(e){i(e)}}var Ap=(e,t,n)=>n.reduce((e,n)=>n?.(e,t)??e,e),jp=class extends cs{_pendingTransforms=[];_completedOptimistics=[];_nextTransformOrder=0;_epoch=0;_baseValue;_cachedValue;constructor(e){super(),this._baseValue=e,this._cachedValue=e}_updateState(){let e=[...this._pendingTransforms.map(e=>({order:e.order,apply:t=>Ap(t,e.task,[e.loading,e.optimistic])})),...this._completedOptimistics.map(({order:e,optimistic:t})=>({order:e,apply:t}))].sort((e,t)=>e.order-t.order);this._cachedValue=e.reduce((e,t)=>t.apply(e),this._baseValue),this._notifySubscribers()}get baseValue(){return this._baseValue}get value(){return this._cachedValue}update(e){this._baseValue=e,this._updateState()}reset(e){this._epoch++,this._pendingTransforms.length=0,this._completedOptimistics.length=0,this._baseValue=e,this._cachedValue=e,this._notifySubscribers()}async optimisticUpdate(e){let t=this._epoch,n=this._nextTransformOrder++,r=e.execute(),i={...e,order:n,task:r};try{this._pendingTransforms.push(i),this._updateState();let n=await r;if(t!==this._epoch)return n;this._baseValue=Ap(this._baseValue,n,[e.optimistic,e.then]);for(let t of this._completedOptimistics)(e.then||t.order>i.order)&&(this._baseValue=t.optimistic(this._baseValue));return e.optimistic&&(this._completedOptimistics.push({order:i.order,optimistic:e.optimistic}),this._completedOptimistics.sort((e,t)=>e.order-t.order)),n}finally{let e=this._pendingTransforms.indexOf(i);e>-1&&this._pendingTransforms.splice(e,1),this._pendingTransforms.length===0&&(this._completedOptimistics.length=0),this._updateState()}}},Mp=Error("This is the empty thread, a placeholder for the main thread. You cannot perform any actions on this thread instance. This error is probably because you tried to call a thread method in your render function. Call the method inside a `useEffect` hook instead."),Np=new class extends kf{get error(){return Mp}messages=[];composer=Of(Mp,!0);isLoading=!0;getMessageById(){}getBranches(){return[]}export(){return{messages:[]}}subscribe(){return()=>{}}waitForUpdate(){return Promise.reject(Mp)}};function Pp(e){return e}var Fp=`__LOCALID_`,Ip=e=>e||void 0,Lp=(e,t)=>{let n=[...t.threadIds],r=[...t.archivedThreadIds],i=Vn(t.threadIdMap),a=Vn(t.threadData),o=new Set([...n,...r]);for(let t of e){switch(t.status){case`regular`:case`archived`:break;default:{let e=t.status;throw Error(`Unsupported state: ${e}`)}}let e=i[t.remoteId],s=e===void 0?void 0:a[e],c=s?.id??t.remoteId,l=e??Pp(c),u=s!==void 0&&s.status!==`new`?s.initializeTask:void 0;o.has(c)?s!==void 0&&s.status!==t.status&&(t.status===`regular`?(r=r.filter(e=>e!==c),n.push(c)):(n=n.filter(e=>e!==c),r.push(c))):(o.add(c),t.status===`regular`?n.push(c):r.push(c)),i[c]=l,i[t.remoteId]=l,a[l]={...s?.localOrigin===!0?{localOrigin:!0}:{},id:c,remoteId:t.remoteId,externalId:t.externalId,status:t.status,title:t.title,lastMessageAt:t.lastMessageAt,custom:t.custom,initializeTask:u??Promise.resolve({remoteId:t.remoteId,externalId:t.externalId})}}return{threadIds:n,archivedThreadIds:r,threadIdMap:i,threadData:a}},Rp=()=>({isLoading:!0,loadError:void 0,isLoadingMore:!1,cursor:void 0,newThreadId:void 0,threadIds:[],archivedThreadIds:[],threadIdMap:Vn(),threadData:Vn()}),zp=(e,t)=>{let n=`${Fp}${t??Ac()}`;for(;e.threadIdMap[n];)n=`${Fp}${Ac()}`;let r=Pp(n);return{id:n,state:{...e,newThreadId:n,threadIdMap:Vn(e.threadIdMap,{[n]:r}),threadData:Vn(e.threadData,{[r]:{status:`new`,id:n,remoteId:void 0,externalId:void 0,title:void 0,custom:void 0,localOrigin:!0}})}}},Bp=(e,t,n)=>{let r=new Set(e.threadIds),i=new Set(e.archivedThreadIds),a=[],o=[],s=(e,t)=>e.has(t.id)||t.remoteId!==void 0&&e.has(t.remoteId);for(let t of Object.values(e.threadData)){let e=n.get(t.id);(e===void 0||e===`new`)&&(e!==void 0||t.localOrigin===!0)&&(t.status===`regular`&&!s(r,t)?(a.push(t),r.add(t.id)):t.status===`archived`&&!s(i,t)&&(o.push(t),i.add(t.id)))}if(a.length===0&&o.length===0)return e;let c=(e,t)=>{let n=e.indexOf(t.id);if(n!==-1)return n;let r=t.remoteId===void 0?-1:e.indexOf(t.remoteId);return r===-1?2**53-1:r};return a.sort((e,n)=>c(t.threadIds,e)-c(t.threadIds,n)),o.sort((e,n)=>c(t.archivedThreadIds,e)-c(t.archivedThreadIds,n)),{...e,threadIds:[...a.map(e=>e.id),...e.threadIds],archivedThreadIds:[...o.map(e=>e.id),...e.archivedThreadIds]}},Vp=e=>new Map(Object.values(e.threadData).map(e=>[e.id,e.status])),Hp=(e,t)=>{let n=Object.hasOwn(e.threadIdMap,t)?e.threadIdMap[t]:void 0;if(n!==void 0)return Object.hasOwn(e.threadData,n)?e.threadData[n]:void 0},Up=(e,t,n,r,i)=>{let a=Pp(t),o=Object.hasOwn(e.threadData,a)?e.threadData[a]:void 0;if(!o)return{state:e,removedMappingId:void 0,survivorMappingId:a};let s=Object.hasOwn(e.threadIdMap,n)?e.threadIdMap[n]:void 0,c=s!==void 0&&s!==a&&Object.hasOwn(e.threadData,s)?e.threadData[s]:void 0,l=s!==void 0&&c!==void 0?{mappingId:s,data:c}:void 0,u=i!==void 0&&Object.hasOwn(e.threadIdMap,i)?e.threadIdMap[i]:void 0,d=l!==void 0&&u===l.mappingId?l.mappingId:a,f=l===void 0?void 0:d===a?l.mappingId:a,p=r??l?.data.externalId,m=Vn(e.threadData);f!==void 0&&delete m[f];let h={...o,id:d,initializeTask:Promise.resolve({remoteId:n,externalId:p}),remoteId:n,externalId:p};m[d]={...l?.data,...h,title:o.title??l?.data.title,lastMessageAt:(`lastMessageAt`in o?o.lastMessageAt:void 0)??(l&&`lastMessageAt`in l.data?l.data.lastMessageAt:void 0),custom:o.custom??l?.data.custom};let g=Vn(e.threadIdMap);if(f!==void 0)for(let[e,t]of Object.entries(g))t===f&&(g[e]=d);g[t]=d,g[n]=d;let _=e=>l===void 0?e:e.filter(e=>e!==l.data.id).map(e=>e===o.id?d:e);return{state:{...e,threadIds:_(e.threadIds),archivedThreadIds:_(e.archivedThreadIds),threadIdMap:g,threadData:m},removedMappingId:f,survivorMappingId:d}},Wp=(e,t,n,r)=>{let i=Hp(e,t);if(!i)return e;let{id:a,status:o}=i;if(o===n)return e;let s;if(n!==`deleted`){if(i.status===`new`){if(r===void 0)return e;s={...i,initializeTask:r,status:n}}else s={...i,status:n}}let c={...e};switch(o){case`new`:c.newThreadId=void 0;break;case`regular`:c.threadIds=c.threadIds.filter(e=>e!==a);break;case`archived`:c.archivedThreadIds=c.archivedThreadIds.filter(e=>e!==a);break;default:throw Error(`Unsupported state: ${o}`)}switch(n){case`regular`:c.threadIds=[a,...c.threadIds];break;case`archived`:c.archivedThreadIds=[a,...c.archivedThreadIds];break;case`deleted`:{let n=e.threadIdMap[t],r=Vn(c.threadData);delete r[n],c.threadData=r;let i=Vn(c.threadIdMap);for(let[e,t]of Object.entries(i))t===n&&delete i[e];c.threadIdMap=i;break}default:throw Error(`Unsupported state: ${n}`)}return s!==void 0&&(c.threadData={...c.threadData,[a]:s}),c},Gp=(e,t,n)=>Wp(e,t,n,void 0),Kp=(e,t,n)=>Wp(e,t,`regular`,n),qp=class extends Error{[Ns]=!0;constructor(){super(`Thread list adapter changed while an operation was pending.`),this.name=`ThreadListAdapterChangedError`}};function Jp(e,t){let n=e.get(t);return n===void 0&&(n={generations:new Set,pendingClaim:null,inFlightClaims:new Set,manualTitle:void 0,latestExplicit:null,nextOrder:0},e.set(t,n)),n}function Yp(e,t,n){n.generations.size===0&&n.pendingClaim===null&&n.inFlightClaims.size===0&&n.manualTitle===void 0&&e.get(t)===n&&e.delete(t)}function Xp(e,t){return!t.superseded&&(e.latestExplicit?.order??0)<=t.order}function Zp(e,t){return(e.latestExplicit?.order??0)<t.order}function Qp(e,t,n){let r=Jp(e,t),i,a=new Promise(e=>{i=e}),o={title:n,order:++r.nextOrder,settled:a,settle:i};r.pendingClaim=o,r.inFlightClaims.add(o);for(let e of r.generations)e.order<o.order&&(e.claim=o);return o}function $p(e,t,n,r){n.settle(r);let i=e.get(t);i!==void 0&&(i.inFlightClaims.delete(n),i.pendingClaim===n&&(i.pendingClaim=null,r&&(i.manualTitle=n.title)),Yp(e,t,i))}function em(e,t,n){let r=n.manualTitle;if(r!==void 0)return n.manualTitle=void 0,Yp(e,t,n),r}function tm(e,t){e.delete(t)}function nm(e,t,n){let r=Jp(e,t);if(n&&r.pendingClaim===null&&em(e,t,r)!==void 0)return null;let i,a=new Promise(e=>{i=e}),o={automatic:n,order:++r.nextOrder,claim:n?r.pendingClaim:null,beforeGenerationClaims:n?[]:[...r.inFlightClaims],superseded:!1,persisted:a,settlePersisted:i};if(!n){r.pendingClaim=null,r.manualTitle=void 0,r.latestExplicit=o;for(let e of r.generations)e.automatic&&(e.superseded=!0)}return r.generations.add(o),o}async function rm({states:e,threadId:t,automatic:n,generate:r,rename:i,applyTitle:a}){let o=Jp(e,t),s=nm(e,t,n);if(s===null)return;let c,l=s.order,u=async e=>{let t=await e.settled;if(s.claim===e)return t||(s.claim=null,o.pendingClaim===e&&(o.pendingClaim=null)),t},d=()=>n&&em(e,t,o)!==void 0,f=async()=>{if(c!==void 0)for(;;){let e=s.claim;if(e!==null&&e.order>l&&Zp(o,e)){await u(e)===!0&&(c=e.title,l=e.order,await i(e.title));continue}let t=o.latestExplicit;if(t===null||t.order<=l)return;let n=await t.persisted;if(o.latestExplicit===t){if(l=t.order,n===void 0||n===c)return;c=n,await i(n)}}},p=async()=>{if(s.beforeGenerationClaims.length>0&&await Promise.all(s.beforeGenerationClaims.map(e=>e.settled)),s.claim!==null){let e=await u(s.claim);if(e===!0){s.superseded=!0;return}if(e===!1&&d())return}if(!Xp(o,s))return;let e=!1,t;for(await r(async n=>{e=!0,t=n,n!==void 0&&(c=n);let r=s.claim;if(r!==null){if(await u(r)!==!1)return;if(d()){s.superseded=!0;return}}Xp(o,s)&&await a(t)});;){let n=s.claim;if(n===null)return;let r=await u(n);if(r!==void 0){if(r===!1){if(d())return;e&&Xp(o,s)&&await a(t);return}if(!Zp(o,n))return;if(await i(n.title),c=n.title,l=n.order,s.claim===n){if(!Xp(o,s))return;await a(n.title),s.superseded=!0;return}}}};try{await p(),await f()}finally{s.settlePersisted(c),o.generations.delete(s),Yp(e,t,o)}}var im=(e,t)=>Error(`Thread "${e}" not found while ${t}.`),am=(e,t,n)=>Error(`Thread "${e}" has status "${t}", so it cannot ${n}.`),om=Rp(),sm=class extends cs{_options;_hookManager;_runtimeAdapters;_loadThreadsPromise;_loadMorePromise;_loadGeneration=0;_adapterGeneration=0;_replaceListOnNextLoad=!1;_staleThreadIdsOnReplace;_switchGeneration=0;_switchTask;_titleStates=new Map;_mainThreadId;_state=new jp(om);_useAdaptersProvider=({children:e})=>{let t=this._options.adapter.unstable_useAdapters;return t===void 0?e:(0,I.jsx)(this._SynthesizedAdapters,{useAdapters:t,children:e})};_SynthesizedAdapters=({useAdapters:e,children:t})=>{let n=cu(e());return n==null?t:(0,I.jsx)(lu,{adapters:n,children:t})};resolveProvider(e){return e.unstable_Provider===void 0?e.unstable_useAdapters===void 0?Qr:this._useAdaptersProvider:e.unstable_Provider}get threadItems(){return this._state.value.threadData}getLoadThreadsPromise(){if(!this._loadThreadsPromise){let e=this._loadGeneration,t=!1,n=Vp(this._state.baseValue);this._loadThreadsPromise=this._state.optimisticUpdate({execute:()=>this._options.adapter.list(),loading:t=>e===this._loadGeneration?{...t,isLoading:!0,loadError:void 0}:t,then:(r,i)=>{if(e!==this._loadGeneration)return r;if(this._replaceListOnNextLoad)return this._replaceListOnNextLoad=!1,t=!0,this._replaceWithThreads({...r,loadError:void 0},i.threads,Ip(i.nextCursor));let a=Lp(i.threads,{threadIds:[],archivedThreadIds:[],threadIdMap:{...r.threadIdMap},threadData:{...r.threadData}});return Bp({...r,isLoading:!1,loadError:void 0,cursor:Ip(i.nextCursor),threadIds:a.threadIds,archivedThreadIds:a.archivedThreadIds,threadIdMap:a.threadIdMap,threadData:a.threadData},r,n)}}).catch(n=>{if(e===this._loadGeneration){if(console.error(`[assistant-ui] thread list load failed:`,n),this._loadThreadsPromise=void 0,!this._replaceListOnNextLoad){this._state.update({...this._state.baseValue,isLoading:!1,loadError:n});return}this._replaceListOnNextLoad=!1,t=!0,this._state.update(this._replaceWithThreads({...this._state.baseValue,loadError:n},[],void 0))}}).then(()=>{if(!t)return;let e=this._options.threadId;e!==void 0&&this.getItemById(e)?.id!==this._mainThreadId&&this._switchToThreadFromProp(e).catch(()=>{})})}return this._loadThreadsPromise}loadMore(){if(this._loadMorePromise)return this._loadMorePromise;let e=this._state.value;if(e.cursor===void 0||e.isLoading)return Promise.resolve();let t=this._loadGeneration,n=this._options.adapter,r=e.cursor,i=this._state.optimisticUpdate({execute:()=>n.list({after:r}),loading:e=>t===this._loadGeneration?{...e,isLoadingMore:!0}:e,then:(e,r)=>{if(t!==this._loadGeneration||n!==this._options.adapter)return e;let i=Lp(r.threads,{threadIds:[...e.threadIds],archivedThreadIds:[...e.archivedThreadIds],threadIdMap:{...e.threadIdMap},threadData:{...e.threadData}});return{...e,isLoadingMore:!1,cursor:Ip(r.nextCursor),threadIds:i.threadIds,archivedThreadIds:i.archivedThreadIds,threadIdMap:i.threadIdMap,threadData:i.threadData}}}).catch(e=>{t===this._loadGeneration&&console.error(`[assistant-ui] thread list loadMore failed:`,e)}).then(()=>{this._loadMorePromise===i&&(this._loadMorePromise=void 0)});return this._loadMorePromise=i,i}constructor(e,t,n){super(),this._state.subscribe(()=>{this._notifySubscribers(),this._notifyThreadIdChange()}),this._runtimeAdapters={modelContext:t},this._hookManager=new Op(e.runtimeHook,this),this._hookManager.__internal_setDefaultAdapters(this._runtimeAdapters),this._hookManager.__internal_subscribeRunningChanged(()=>this._notifySubscribers()),this._hookManager.__internal_subscribeRuntimeReplaced(()=>{queueMicrotask(()=>this._notifySubscribers())}),this.providerStore=new ls(this.resolveProvider(e.adapter)),this.__internal_setOptions(e),this._startSwitchToNewThread(!0,n)}_initialThreadLoaded=!1;providerStore;__internal_setOptions(e){if(this._options===e)return;let t=this._options!==void 0&&this._options.adapter!==e.adapter,n=this._initialThreadLoaded&&this._options!==void 0&&this._options.threadId!==e.threadId;this._options=e,this.providerStore.setState(this.resolveProvider(e.adapter)),this._hookManager.setRuntimeHook(e.runtimeHook),t&&(this._loadGeneration++,this._adapterGeneration++,this._switchGeneration++,this._switchTask=void 0,this._loadThreadsPromise=void 0,this._loadMorePromise=void 0,this._replaceListOnNextLoad=!0,this._staleThreadIdsOnReplace=new Set(Object.values(this._state.baseValue.threadData).filter(e=>e.status!==`new`).map(e=>e.id)),this._state.update({...this._state.baseValue,cursor:void 0,loadError:void 0}),this._titleStates.clear()),n&&this._switchToThreadFromProp(e.threadId).catch(()=>{})}_requireAdapterGeneration(e){if(e!==this._adapterGeneration)throw new qp}_requireAdapterSettled(){if(this._replaceListOnNextLoad)throw new qp}_replaceWithThreads(e,t,n){let r=[];if(e.newThreadId){let t=Object.hasOwn(e.threadIdMap,e.newThreadId)?e.threadIdMap[e.newThreadId]:void 0,n=t&&Object.hasOwn(e.threadData,t)?e.threadData[t]:void 0;n?.status===`new`&&r.push(n)}let i=this._staleThreadIdsOnReplace;if(i)for(let t of Object.values(e.threadData))i.has(t.id)||(t.status===`new`||t.remoteId!==void 0)&&r.push(t);this._staleThreadIdsOnReplace=void 0;let a={threadIds:[],archivedThreadIds:[],threadIdMap:Vn(),threadData:Vn()};for(let e of r){let t=Pp(e.id);Object.hasOwn(a.threadData,t)||(a.threadIdMap[e.id]=t,e.remoteId!==void 0&&(a.threadIdMap[e.remoteId]=t),a.threadData[t]=e)}let{threadIds:o,archivedThreadIds:s,threadIdMap:c,threadData:l}=Lp(t,a);for(let e of r){if(e.remoteId===void 0)continue;let t=Pp(e.id),n=Object.hasOwn(l,t)?l[t]:void 0;n!==void 0&&(n.status===`regular`&&!o.includes(n.id)?o.push(n.id):n.status===`archived`&&!s.includes(n.id)&&s.push(n.id))}let u={...e,isLoading:!1,cursor:n,threadIds:o,archivedThreadIds:s,threadIdMap:c,threadData:l,newThreadId:e.newThreadId!==void 0&&!Object.hasOwn(c,e.newThreadId)?void 0:e.newThreadId};if(Hp(u,this._mainThreadId)===void 0){let e=u.newThreadId;if(e!==void 0)this._mainThreadId=e;else{let e=zp(u);this._mainThreadId=e.id,u=e.state}this._options.threadId===void 0?this._notifyThreadIdChange():this._lastNotifiedThreadId=void 0}let d=new Set(Object.values(u.threadData).map(e=>e.id));for(let t of Object.values(e.threadData))if(!d.has(t.id))try{this._hookManager.stopThreadRuntime(t.id)}catch(e){console.error(`[assistant-ui] Thread runtime cleanup threw while stopping a thread`,e)}return this._hookManager.startThreadRuntime(this._mainThreadId).then(()=>this._notifySubscribers(),()=>void 0),u}__internal_load(){if(this.getLoadThreadsPromise(),this._initialThreadLoaded)return;this._initialThreadLoaded=!0;let e=this._options.threadId??this._options.initialThreadId;e!==void 0&&(this._options.threadId===void 0?this.switchToThread(e):this._switchToThreadFromProp(e)).catch(()=>{})}async reloadMainThread(){let e=this._mainThreadId;if(e===void 0||this.getItemById(e)?.status===`new`)return;let t=this._hookManager.getThreadRuntimeCore(e);try{t?.unstable_refetchThread?await t.unstable_refetchThread():await this._hookManager.__internal_restartThreadRuntime(e)}catch(t){if(e!==this._mainThreadId)return;throw t}e===this._mainThreadId&&this._notifySubscribers()}reload(){return this._loadGeneration++,this._loadThreadsPromise=void 0,this._loadMorePromise=void 0,this._state.update({...this._state.baseValue,cursor:void 0}),this.getLoadThreadsPromise()}get isLoading(){return this._state.value.isLoading}get loadError(){return this._state.value.loadError}get isLoadingMore(){return this._state.value.isLoadingMore}get hasMore(){return this._state.value.cursor!==void 0}get threadIds(){return this._state.value.threadIds}get archivedThreadIds(){return this._state.value.archivedThreadIds}get newThreadId(){return this._state.value.newThreadId}get mainThreadId(){return this._mainThreadId}get _mainThreadRemoteId(){if(this._mainThreadId!==void 0)return Hp(this._state.value,this._mainThreadId)?.remoteId}_lastNotifiedThreadId=void 0;_notifyThreadIdChange(e=!0){let t=this._mainThreadRemoteId;this._lastNotifiedThreadId!==t&&(this._lastNotifiedThreadId=t,e&&kp(`assistant-ui`,`onThreadIdChange`,this._options.onThreadIdChange,t))}getMainThreadRuntimeCore(){return this._hookManager.getThreadRuntimeCore(this._mainThreadId)||Np}getThreadRuntimeCore(e){let t=this.getItemById(e);if(!t)throw im(e,`getting its runtime`);let n=this._hookManager.getThreadRuntimeCore(t.id);if(!n)throw Error(`Runtime for thread "${e}" not found while getting its runtime.`);return n}unstable_isThreadRunning(e){let t=this.getItemById(e);return t?this._hookManager.__internal_isThreadRunning(t.id):!1}unstable_subscribeThreadEvents(e){return this._hookManager.__internal_subscribeThreadEvents(e)}getItemById(e){return Hp(this._state.value,e)}switchToThread(e,t){return this._startSwitchToThread(e,t,!0)}_startSwitchToThread(e,t,n){let r=++this._switchGeneration,i=this._switchToThread(e,t,r,n);return this._switchTask=i,i}async _switchToThread(e,t,n,r){if(this._replaceListOnNextLoad&&e!==this._state.value.newThreadId)throw new qp;let i=this.getItemById(e);if(!i){let t=await this._options.adapter.fetch(e);if(n!==this._switchGeneration)return;let r=this._state.value,a=Pp(t.remoteId),o={...r.threadData,[a]:{id:a,initializeTask:Promise.resolve({remoteId:t.remoteId,externalId:t.externalId}),remoteId:t.remoteId,externalId:t.externalId,status:t.status,title:t.title,lastMessageAt:t.lastMessageAt,custom:t.custom}},s={...r.threadIdMap,[t.remoteId]:a},c=t.remoteId,l=t.status===`regular`?r.threadIds.includes(c):r.archivedThreadIds.includes(c),u=r.threadIds.filter(e=>e!==c),d=r.archivedThreadIds.filter(e=>e!==c),f=t.status===`regular`?l?r.threadIds:[...u,c]:u,p=t.status===`archived`?l?r.archivedThreadIds:[...d,c]:d;this._state.update({...r,threadIds:f,archivedThreadIds:p,threadIdMap:s,threadData:o}),i=this.getItemById(e)}if(!i)throw im(e,`switching to it`);if(this._mainThreadId===i.id)return;let a=this._hookManager.startThreadRuntime(i.id);if(this.mainThreadId===void 0?a.then(()=>this._notifySubscribers(),()=>void 0):await a,n!==this._switchGeneration)return;let o=this.getItemById(i.id);o?.id===i.id&&(o.status===`archived`&&t?.unarchive!==!1&&(await o.initializeTask,n!==this._switchGeneration||(o=this.getItemById(i.id),o?.id!==i.id)||o.status===`archived`&&(await this.unarchive(o.id),n!==this._switchGeneration||(o=this.getItemById(i.id),o?.id!==i.id)))||(this._mainThreadId=o.id,this._notifySubscribers(),this._notifyThreadIdChange(r)))}switchToNewThread(){return this._startSwitchToNewThread(!0)}_switchToThreadFromProp(e){return e===void 0?Rl(`create`,()=>this._startSwitchToNewThread(!1)):Rl(`switch`,()=>this._startSwitchToThread(e,void 0,!1))}_startSwitchToNewThread(e,t){let n=++this._switchGeneration,r=this._switchToNewThread(n,e,t);return this._switchTask=r,r}async _switchToNewThread(e,t,n){for(;this._state.baseValue.newThreadId!==void 0&&this._state.value.newThreadId===void 0;)if(await this._state.waitForUpdate(),e!==this._switchGeneration)return;let r=this._state.baseValue,i=this._state.value.newThreadId;if(i===void 0){let e=zp(r,n);i=e.id,this._state.update(e.state)}return this._switchToThread(i,void 0,e,t)}initialize=async e=>{let t=this._options.adapter,n=this._adapterGeneration;if(this._state.value.newThreadId!==e){this._requireAdapterSettled();let t=this.getItemById(e);if(!t)throw im(e,`initializing it`);if(t.status===`new`)throw am(e,t.status,`be initialized here`);let{remoteId:r,externalId:i}=await t.initializeTask;return this._requireAdapterGeneration(n),{remoteId:r,externalId:i}}this._requireAdapterGeneration(n);let r=t.initialize(e),i,{remoteId:a,externalId:o}=await this._state.optimisticUpdate({execute:()=>r,optimistic:t=>Kp(t,e,r),then:(t,{remoteId:r,externalId:a})=>{if(n!==this._adapterGeneration)return t;let o=Up(t,e,r,a,e);return i=o.removedMappingId,i===this._mainThreadId&&(this._mainThreadId=o.survivorMappingId),o.state}});return this._requireAdapterGeneration(n),i!==void 0&&this._hookManager.stopThreadRuntime(i),{remoteId:a,externalId:o}};generateTitle=async(e,t)=>{this._requireAdapterSettled();let n=this._options.adapter,r=this._adapterGeneration,i=this.getItemById(e);if(!i)throw im(e,`generating its title`);if(i.status===`new`)throw am(e,i.status,`generate a title`);let{remoteId:a}=await i.initializeTask;this._requireAdapterGeneration(r);let o=this._hookManager.getThreadRuntimeCore(i.id);if(!o)return;let s=o.messages.filter(xp);await rm({states:this._titleStates,threadId:i.id,automatic:t?.automatic===!0,generate:async e=>{let t=await n.generateTitle(a,s);this._requireAdapterGeneration(r),await Sp(t,e)},rename:async e=>{this._requireAdapterGeneration(r),await n.rename(a,e)},applyTitle:async e=>{await this._state.optimisticUpdate({execute:async()=>{},optimistic:t=>{if(r!==this._adapterGeneration)return t;let n=Hp(t,i.id);return n?{...t,threadData:{...t.threadData,[n.id]:{...n,title:e}}}:t}})}})};async rename(e,t){this._requireAdapterSettled();let n=this._options.adapter,r=this._adapterGeneration,i=this.getItemById(e);if(!i)throw im(e,`renaming it`);if(i.status===`new`)throw am(e,i.status,`be renamed`);let a=Qp(this._titleStates,i.id,t);try{let o=await this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await i.initializeTask;return this._requireAdapterGeneration(r),n.rename(e,t)},optimistic:n=>{let r=Hp(n,e);return r?{...n,threadData:{...n.threadData,[r.id]:{...r,title:t}}}:n}});return $p(this._titleStates,i.id,a,!0),o}catch(e){throw $p(this._titleStates,i.id,a,!1),e}}async updateCustom(e,t){this._requireAdapterSettled();let n=this._options.adapter,r=this._adapterGeneration,i=this.getItemById(e);if(!i)throw im(e,`updating its custom metadata`);if(i.status===`new`)throw am(e,i.status,`update custom metadata`);if(!n.updateCustom)throw Error(`Remote thread list adapter does not support updating custom metadata`);return this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await i.initializeTask;if(this._requireAdapterGeneration(r),!n.updateCustom)throw Error(`Remote thread list adapter does not support updating custom metadata`);return n.updateCustom(e,t)},optimistic:n=>{let r=Hp(n,e);return r?{...n,threadData:{...n.threadData,[r.id]:{...r,custom:t}}}:n}})}async _ensureThreadIsNotMain(e){if(e===this.newThreadId)throw Error(`Cannot ensure new thread is not main`);let t;for(;e===this._mainThreadId;){if(e===this.newThreadId)throw Error(`Cannot ensure new thread is not main`);let n=this._switchTask,r=!n||n===t;r&&(n=this.switchToNewThread()),t=n;try{await n}catch(e){if(r&&this._switchTask===n)throw e}}}async archive(e){this._requireAdapterSettled();let t=this._options.adapter,n=this._adapterGeneration,r=this.getItemById(e);if(!r)throw im(e,`archiving it`);if(r.status!==`regular`)throw am(e,r.status,`be archived`);return await this._ensureThreadIsNotMain(r.id),this._requireAdapterGeneration(n),this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await r.initializeTask;return this._requireAdapterGeneration(n),t.archive(e)},optimistic:e=>Gp(e,r.id,`archived`)})}async unarchive(e){this._requireAdapterSettled();let t=this._options.adapter,n=this._adapterGeneration,r=this.getItemById(e);if(!r)throw im(e,`unarchiving it`);if(r.status!==`archived`)throw am(e,r.status,`be unarchived`);return this._state.optimisticUpdate({execute:async()=>{try{let{remoteId:e}=await r.initializeTask;return this._requireAdapterGeneration(n),await t.unarchive(e)}catch(e){throw n===this._adapterGeneration&&await this._ensureThreadIsNotMain(r.id),e}},optimistic:e=>Gp(e,r.id,`regular`)})}async delete(e){this._requireAdapterSettled();let t=this._options.adapter,n=this._adapterGeneration,r=this.getItemById(e);if(!r)throw im(e,`deleting it`);if(r.status!==`regular`&&r.status!==`archived`)throw am(e,r.status,`be deleted`);await this._ensureThreadIsNotMain(r.id),this._requireAdapterGeneration(n);let i=await this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await r.initializeTask;return this._requireAdapterGeneration(n),await t.delete(e)},optimistic:e=>Gp(e,r.id,`deleted`)});return this._hookManager.stopThreadRuntime(r.id),tm(this._titleStates,r.id),i}__internal_dispose(){this._hookManager.__internal_dispose()}async detach(e){let t=this._adapterGeneration,n=this.getItemById(e);if(!n)throw im(e,`detaching it`);if(n.status!==`regular`&&n.status!==`archived`)throw am(e,n.status,`be detached`);await this._ensureThreadIsNotMain(n.id),this._requireAdapterGeneration(t),this._hookManager.stopThreadRuntime(n.id)}boundIdsStore=new ls([]);__internal_RenderComponent=()=>{let e=Yr();z(()=>(this.boundIdsStore.setState([...this.boundIdsStore.getState(),e]),()=>{this.boundIdsStore.setState(this.boundIdsStore.getState().filter(t=>t!==e))}),[e]);let t=Ms(this.boundIdsStore),n=Ms(this.providerStore),r=K();return(t.length===0||t[0]===e)&&(0,I.jsxs)(lu,{adapters:this._runtimeAdapters,children:[(0,I.jsx)(this._hookManager.__internal_RenderThreadRuntimes,{provider:n}),(0,I.jsx)(this._hookManager.__internal_Host,{parentClient:r})]})}},cm=()=>()=>{},lm=()=>Kr(cm,um,dm);function um(){return!1}function dm(){return typeof document>`u`}var fm=class extends Kf{threads;constructor(e,t){super(),this.threads=new sm(e,this._contextProvider,t)}get RenderComponent(){return this.threads.__internal_RenderComponent}},pm=e=>{let t=Yr(),n=lm(),[r]=L(()=>new fm(e,n?t:void 0)),[i]=L(()=>({generation:0}));Jr(()=>{let e=++i.generation;return()=>queueMicrotask(()=>{i.generation===e&&r.threads.__internal_dispose()})},[r,i]),z(()=>{r.threads.__internal_setOptions(e),r.threads.__internal_load()},[r,e]),z(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>{r.threads.loadError!==void 0&&r.threads.reload()},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`online`,e),document.removeEventListener(`visibilitychange`,t)}},[r]);let[a]=L(()=>new Gf(r));return a},mm=e=>{let[t]=L(()=>new ls(e.runtimeHook));Wr(()=>{t.setState(e.runtimeHook)},[t,e.runtimeHook]);let n=R(e.initialThreadId),[r]=L(()=>function(){return Ms({subscribe:t.subscribe,getState:t.getState,getServerSnapshot:t.getState})()}),i=Gr(t=>e.onThreadIdChange?.(t)),a=Hr(()=>({adapter:e.adapter,allowNesting:e.allowNesting,threadId:e.threadId,initialThreadId:n.current,runtimeHook:r,onThreadIdChange:i}),[e.adapter,e.allowNesting,e.threadId,r]);if(K().threadListItem.source!==null){if(!a.allowNesting)throw Error(`useRemoteThreadListRuntime cannot be nested inside another RemoteThreadListRuntime. Set allowNesting: true to allow nesting (the inner runtime will become a no-op).`);return e.runtimeHook()}return pm(a)},hm=e=>{let t=e.type;switch(t){case`text`:return{type:`text`,...e.id===void 0?void 0:{id:e.id},text:e.text,...e.providerMetadata===void 0?void 0:{providerMetadata:e.providerMetadata},...e.parentId===void 0?void 0:{parentId:e.parentId}};case`image`:return{type:`image`,...e.id===void 0?void 0:{id:e.id},image:e.image,...e.filename==null?void 0:{filename:e.filename},...e.providerMetadata===void 0?void 0:{providerMetadata:e.providerMetadata}};case`file`:return{type:`file`,...e.id===void 0?void 0:{id:e.id},data:e.data,mimeType:e.mimeType,...e.filename==null?void 0:{filename:e.filename},...e.sourceType==null?void 0:{sourceType:e.sourceType},...e.providerMetadata==null?void 0:{providerMetadata:e.providerMetadata},...e.parentId===void 0?void 0:{parentId:e.parentId}};case`audio`:return{type:`audio`,audio:{data:e.audio.data,format:e.audio.format}};case`data`:return uu(e.data)||console.warn(`attachment data is not JSON! ${JSON.stringify(e)}`),{type:`data`,...e.id===void 0?void 0:{id:e.id},name:e.name,data:e.data};default:throw Error(`Attachment part type not supported by aui/v0: ${t}`)}},gm=e=>{if(e.role===`user`&&e.attachments.length!==0)return e.attachments.map(({id:e,type:t,name:n,contentType:r,status:i,content:a})=>({id:e,type:t,name:n,status:i,...r==null?void 0:{contentType:r},content:a.map(hm)}))},_m=e=>{if(e!==void 0)try{let t=JSON.stringify(e);return t===void 0?void 0:JSON.parse(t)}catch{return}},vm=(e,t=0)=>{if(t>100||e===void 0||typeof e==`function`)return!1;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||!e||typeof e.toJSON==`function`)return!0;if((e instanceof Map||e instanceof Set)&&e.size>0)return!1;if(Array.isArray(e)){if(Reflect.ownKeys(e).length!==e.length+1)return!1;for(let n=0;n<e.length;n++)if(!Object.hasOwn(e,n)||!vm(e[n],t+1))return!1;return!0}return Reflect.ownKeys(e).every(n=>typeof n==`string`&&Object.getOwnPropertyDescriptor(e,n)?.enumerable===!0&&vm(e[n],t+1))},ym=e=>{try{return!vm(e)}catch{return!0}};function bm(e){let t=e.status?.type===`running`?{type:`incomplete`,reason:`cancelled`}:e.status,n=gm(e);return{role:e.role,content:e.content.map(e=>{let t=e.type;switch(t){case`text`:return{type:`text`,...e.id===void 0?void 0:{id:e.id},text:e.text,...e.providerMetadata===void 0?void 0:{providerMetadata:e.providerMetadata},...e.parentId===void 0?void 0:{parentId:e.parentId}};case`reasoning`:return{type:`reasoning`,...e.id===void 0?void 0:{id:e.id},text:e.text,...e.unstable_summary===void 0?void 0:{unstable_summary:e.unstable_summary},...e.timing===void 0?void 0:{timing:e.timing},...e.providerMetadata===void 0?void 0:{providerMetadata:e.providerMetadata},...e.parentId===void 0?void 0:{parentId:e.parentId}};case`source`:return e.sourceType===`url`?{type:`source`,sourceType:`url`,id:e.id,url:e.url,...e.title==null?void 0:{title:e.title},...e.providerMetadata==null?void 0:{providerMetadata:e.providerMetadata},...e.parentId===void 0?void 0:{parentId:e.parentId}}:{type:`source`,sourceType:`document`,id:e.id,title:e.title,mediaType:e.mediaType,...e.filename==null?void 0:{filename:e.filename},...e.providerMetadata==null?void 0:{providerMetadata:e.providerMetadata},...e.parentId===void 0?void 0:{parentId:e.parentId}};case`tool-call`:{let t=_m(e.result);e.result!==void 0&&(t===void 0||ym(e.result))&&console.warn(t===void 0?`tool-call result for ${e.toolCallId} cannot be serialized as JSON; omitted`:`tool-call result for ${e.toolCallId} loses data in JSON; persisted as its JSON form`);let n=_m(e.artifact);e.artifact!==void 0&&n===void 0&&console.warn(`tool-call artifact is not JSON for ${e.toolCallId}`);let r=Hc(e.unstable_interactions);return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,...JSON.stringify(e.args)===e.argsText?{args:e.args}:{argsText:e.argsText},...t===void 0?void 0:{result:t},...n===void 0?void 0:{artifact:n},...e.modelContent===void 0?void 0:{modelContent:e.modelContent},...e.providerMetadata===void 0?void 0:{providerMetadata:e.providerMetadata},...e.isPreliminary?{isPreliminary:!0}:void 0,...e.isError?{isError:!0}:void 0,...e.interrupt===void 0?void 0:{interrupt:{type:e.interrupt.type,payload:e.interrupt.payload}},...e.timing===void 0?void 0:{timing:e.timing},...e.mcp===void 0?void 0:{mcp:e.mcp},...e.approval?{approval:e.approval}:void 0,...e.parentId===void 0?void 0:{parentId:e.parentId},...e.messages===void 0?void 0:{messages:e.messages.map(Tm)},...r===void 0?void 0:{unstable_interactions:r}}}case`image`:return{type:`image`,...e.id===void 0?void 0:{id:e.id},image:e.image,...e.filename==null?void 0:{filename:e.filename},...e.providerMetadata==null?void 0:{providerMetadata:e.providerMetadata}};case`file`:return{type:`file`,...e.id===void 0?void 0:{id:e.id},data:e.data,mimeType:e.mimeType,...e.filename==null?void 0:{filename:e.filename},...e.sourceType?{sourceType:e.sourceType}:void 0,...e.providerMetadata==null?void 0:{providerMetadata:e.providerMetadata},...e.parentId===void 0?void 0:{parentId:e.parentId}};case`data`:return uu(e.data)||console.warn(`data part is not JSON! ${JSON.stringify(e)}`),{type:`data`,...e.id===void 0?void 0:{id:e.id},name:e.name,data:e.data};case`audio`:return{type:`audio`,audio:{data:e.audio.data,format:e.audio.format}};case`generative-ui`:return{type:`generative-ui`,spec:e.spec,...e.id===void 0?void 0:{id:e.id},...e.parentId===void 0?void 0:{parentId:e.parentId}};default:throw Error(`Message part type not supported by aui/v0: ${t}`)}}),metadata:e.metadata,...t?{status:t}:void 0,...n?{attachments:n}:void 0}}var xm=(e,t,n)=>t.flatMap(t=>{if(!bu(e,t))return[];if(t.type!==`tool-call`||t.messages===void 0)return[t];let{messages:r,...i}=t;return!Array.isArray(r)||n>=100?[i]:[{...i,messages:r.flatMap(e=>{let t=Cm(e,n+1);return t?[t]:[]})}]}),Sm=e=>e.flatMap(e=>{let t=xu(e,e=>bu(`user`,e));return t?[t]:[]}),Cm=(e,t)=>{if(!Q(e)||!fu(e.role)||!Array.isArray(e.content))return null;let{role:n}=e,r=xm(n,e.content,t);if(n===`system`&&r.length!==1)return null;let{attachments:i,createdAt:a,status:o,metadata:s,...c}=e,l=du(a),u=Q(s)?n===`assistant`?{...s,steps:gu(s.steps)}:{...s,steps:void 0}:s;return{...c,...l?{createdAt:a}:void 0,...n===`assistant`&&mu(o)?{status:o}:void 0,...s===void 0?void 0:{metadata:u},content:r,...n===`user`&&Array.isArray(i)?{attachments:Sm(i)}:void 0}};function wm(e){try{let t=Cm(e.content,0);if(!t)throw Error(`stored row is not an aui/v0 message`);return{parentId:e.parent_id,message:Em({...t,id:e.id,createdAt:e.created_at},e.id)}}catch(t){return console.warn(`aui/v0: dropping unreadable message ${e.id}`,t),null}}var Tm=e=>({...bm(e),id:e.id,createdAt:e.createdAt.toISOString()}),Em=(e,t)=>bl({...e,content:e.content.map((n,r)=>n.type!==`tool-call`||n.messages===void 0?n:{...n,messages:n.messages.map((i,a)=>Em({...i,createdAt:i.createdAt===void 0?e.createdAt:new Date(i.createdAt)},i.id??`${t}-${n.toolCallId}-${r}-${a}`))})},t,{type:`complete`,reason:`unknown`}),Dm=class extends Error{constructor(e){super(e),this.name=`CloudResponseError`}},Om=(e,t)=>new Dm(`Invalid Assistant Cloud response for "${e}": expected ${t}`),km=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw Om(t,`an object`);return e},Am=(e,t)=>{if(!Array.isArray(e))throw Om(t,`an array`);return e},jm=(e,t)=>{if(typeof e!=`string`)throw Om(t,`a string`);return e},Mm=(e,t)=>{if(typeof e!=`number`||!Number.isFinite(e))throw Om(t,`a number`);return e},Nm=(e,t)=>e===null?null:Mm(e,t),Pm=(e,t,n)=>{let r=jm(e,t);if(!n.includes(r))throw Om(t,`one of ${n.map(e=>`"${e}"`).join(`, `)}`);return r},Fm=(e,t)=>e===null?null:jm(e,t),Im=(e,t)=>{if(typeof e!=`boolean`)throw Om(t,`a boolean`);return e},Lm=(e,t)=>{if(!Number.isInteger(e))throw Om(t,`an integer`);return e},Rm=(e,t)=>{if(typeof e!=`string`)throw Om(t,`a canonical ISO timestamp`);let n=new Date(e);if(Number.isNaN(n.getTime())||n.toISOString()!==e)throw Om(t,`a canonical ISO timestamp`);return n},zm=(e,t)=>km(e,t),Bm=3e4,Vm=async(e,t)=>{let n=new AbortController,r=!1,i=setTimeout(()=>{r=!0,n.abort()},Bm);try{return await t(n.signal)}catch(t){throw r?Error(`Assistant Cloud ${e} timed out after ${Bm}ms`,{cause:t}):t}finally{clearTimeout(i)}},Hm=e=>{try{let t=e.split(`.`)[1];if(!t)throw Error(`Invalid JWT format`);let n=t.replace(/-/g,`+`).replace(/_/g,`/`);for(;n.length%4!=0;)n+=`=`;let r=atob(n),i=JSON.parse(r).exp;if(!i||typeof i!=`number`)throw Error(`JWT does not contain a valid "exp" field`);return i*1e3}catch(e){throw Error(`Unable to determine the token expiry: ${e}`)}},Um=(e,t)=>{let n=jm(e,t);if(n.length===0)throw new Dm(`Invalid Assistant Cloud response for "${t}": expected a non-empty string`);return n},Wm=(e,t)=>{let n=km(e,t);return{token:Um(n.token,`${t}.token`),expires_at:Um(n.expires_at,`${t}.expires_at`)}},Gm=async(e,t)=>{let n;try{n=await e.json()}catch{throw new Dm(`Invalid Assistant Cloud response for "${t}": expected valid JSON`)}let r=km(n,t);return{data:r,accessToken:Um(r.access_token,`${t}.access_token`)}},Km=class{strategy=`jwt`;cachedToken=null;tokenExpiry=null;tokenRequest=null;#e;constructor(e){this.#e=e}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>3e4)return{Authorization:`Bearer ${this.cachedToken}`};this.tokenRequest||=this.fetchAuthHeaders();let t=this.tokenRequest;try{return await t}finally{this.tokenRequest===t&&(this.tokenRequest=null)}}async fetchAuthHeaders(){let e=await this.#e();if(!e)return!1;let t=Hm(e);return this.cachedToken=e,this.tokenExpiry=t,{Authorization:`Bearer ${e}`}}readAuthHeaders(e){let t=e.get(`Authorization`);if(!t)return;let[n,r]=t.split(` `);if(n!==`Bearer`||!r)throw Error(`Invalid auth header received`);let i=Hm(r);this.cachedToken=r,this.tokenExpiry=i}},qm=class{strategy=`api-key`;#e;#t;#n;constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n}async getAuthHeaders(){return{Authorization:`Bearer ${this.#e}`,"Aui-User-Id":this.#t,"Aui-Workspace-Id":this.#n}}readAuthHeaders(){}},Jm=`aui:refresh_token`,Ym=e=>`${Jm}:${e}`,Xm=e=>{try{e.removeItem(Jm)}catch{}},Zm=()=>{if(!(`localStorage`in globalThis))return null;try{return globalThis.localStorage}catch{return null}},Qm=e=>{let t=Zm();if(t)try{let n=Ym(e),r=t.getItem(n);if(r)return Xm(t),JSON.parse(r);let i=t.getItem(Jm);if(!i)return;let a;try{a=JSON.parse(i)}catch{Xm(t);return}return t.setItem(n,i),Xm(t),a}catch{return}},$m=e=>!e||!e.endsWith(`/`)?e:e.slice(0,-1),eh=(e,t)=>{let n=Zm();if(n)try{n.setItem(Ym(e),JSON.stringify(t))}catch{}},th=e=>{let t=Zm();if(t)try{t.removeItem(Ym(e))}catch{}},nh=new WeakMap,rh=()=>`navigator`in globalThis?globalThis.navigator?.locks??null:null,ih=e=>`assistant-cloud:anonymous-auth:${e}`,ah=(e,t)=>{let n=Zm();if(!n)return t();let r=nh.get(n);r||(r=new Map,nh.set(n,r));let i=r.get(e);if(i)return i;let a=rh(),o=(a?a.request(ih(e),t):t()).finally(()=>{r.get(e)===o&&r.delete(e)});return r.set(e,o),o},oh=class{strategy=`anon`;baseUrl;jwtStrategy;constructor(e){this.baseUrl=e;let t=async()=>{let e=Date.now(),t=Qm(this.baseUrl);if(t){if(new Date(t.expires_at).getTime()-e>3e4){let e=await Vm(`refresh token request`,async e=>{let n=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({refresh_token:t.token}),signal:e});if(n.ok){let{data:e,accessToken:t}=await Gm(n,`refresh auth token response`);return e.refresh_token!=null&&eh(this.baseUrl,Wm(e.refresh_token,`refresh auth token response.refresh_token`)),t}if(n.status===429||n.status>=500)throw Error(`Assistant Cloud token refresh failed with status ${n.status}`);return null});if(e!==null)return e}else th(this.baseUrl)}return Vm(`anonymous token request`,async e=>{let t=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:`POST`,signal:e});if(!t.ok)return null;let{data:n,accessToken:r}=await Gm(t,`anonymous auth token response`);return eh(this.baseUrl,Wm(n.refresh_token,`anonymous auth token response.refresh_token`)),r})};this.jwtStrategy=new Km(()=>ah(this.baseUrl,t))}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},sh=`0.2.5`,ch=class extends Error{status;code;details;constructor(e,t,n,r){super(e),this.status=t,n!==void 0&&(this.code=n),r!==void 0&&(this.details=r),this.name=`CloudAPIError`}},lh=/^[\x21-\x7e]+$/,uh=class{_auth;_baseUrl;registerSdk;sdkHeader;constructor(e){let t=new Map;if(this.registerSdk=e=>{let n=e.name.trim(),r=e.version.trim();!lh.test(n)||!lh.test(r)||t.set(`${n}/${r}`,{name:n,version:r})},this.sdkHeader=()=>[`assistant-cloud/${sh}`,...Array.from(t.values(),({name:e,version:t})=>`${e}/${t}`)].join(` `),`authToken`in e)this._baseUrl=$m(e.baseUrl),this._auth=new Km(e.authToken);else if(`apiKey`in e)this._baseUrl=$m(e.baseUrl??`https://backend.assistant-api.com`),this._auth=new qm(e.apiKey,e.userId,e.workspaceId);else if(`anonymous`in e)this._baseUrl=$m(e.baseUrl),this._auth=new oh(this._baseUrl);else throw Error(`Invalid configuration: Must provide authToken, apiKey, or anonymous configuration`)}async initializeAuth(){return!!await this._auth.getAuthHeaders()}async makeRawRequest(e,t={}){let n=await this._auth.getAuthHeaders();if(!n)throw Error(`Authorization failed`);let r={...n,...t.headers,"Content-Type":`application/json`,"Aui-Sdk":this.sdkHeader()},i=new URLSearchParams;if(t.query)for(let[e,n]of Object.entries(t.query))n!==!1&&(n===!0?i.set(e,`true`):i.set(e,n.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=i.toString();let o=await fetch(a,{method:t.method??`GET`,headers:r,body:t.body?JSON.stringify(t.body):null,...t.keepalive?{keepalive:!0}:{}});if(this._auth.readAuthHeaders(o.headers),!o.ok){let e=await o.text(),t,n,r;try{let i=JSON.parse(e);if(typeof i==`object`&&i&&!Array.isArray(i)){let e=i;typeof e.message==`string`&&e.message.length>0&&(t=e.message),typeof e.error==`string`&&(n=e.error,r={...e},delete r.error)}}catch{}throw new ch(t??`Request failed with status ${o.status}, ${e}`,o.status,n,r)}return o}async makeRequest(e,t={}){let n=await this.makeRawRequest(e,t);if(n.status===204||n.headers.get(`content-length`)===`0`)return;let r=await n.text();if(r.trim()!==``)return JSON.parse(r)}},dh=20,fh=50,ph=2e3,mh=[250,1e3],hh=new WeakMap,gh=e=>{hh.get(e)?.()},_h=class{buffer=[];timer;flushing;retryTimer;resolveRetryDelay;bestEffortRequested=!1;generation=0;cloud;isEnabled;listening=!1;constructor(e,t){this.cloud=e,this.isEnabled=t,hh.set(this,()=>this.clearPending())}track(e){if(this.isEnabled()){if(this.listen(),this.buffer.push(vh(e)),this.buffer.length>=dh){this.flush(!0);return}this.scheduleFlush()}}listen(){this.listening||typeof window>`u`||typeof document>`u`||(this.listening=!0,window.addEventListener(`pagehide`,this.flushBestEffort),document.addEventListener(`visibilitychange`,this.onVisibilityChange))}unlisten(){this.listening&&(this.listening=!1,window.removeEventListener(`pagehide`,this.flushBestEffort),document.removeEventListener(`visibilitychange`,this.onVisibilityChange))}dispose(){this.unlisten(),this.clearFlushTimer(),this.flushBestEffort()}clearPending(){this.generation++,this.buffer=[],this.clearFlushTimer(),this.interruptRetryDelay(),this.unlisten()}onVisibilityChange=()=>{document.visibilityState===`hidden`&&this.flushBestEffort()};flushBestEffort=()=>(this.flushing&&(this.bestEffortRequested=!0,this.interruptRetryDelay()),this.flush(!1));flush=async e=>{if(!this.isEnabled()){this.clearPending();return}if(this.flushing)return this.flushing;this.clearFlushTimer();let t=this.flushPending(e);return this.flushing=t,t.then(()=>{this.flushing===t&&(this.flushing=void 0,this.bestEffortRequested=!1,this.buffer.length===0?(this.clearFlushTimer(),this.unlisten()):this.flush(!0))}),t};async flushPending(e){for(;this.buffer.length>0;){if(!this.isEnabled()){this.buffer=[];return}let t=this.buffer.splice(0,fh),n=this.generation;for(let r=0;;r++)try{if(await this.cloud.makeRequest(`/events`,{method:`POST`,body:{events:t},keepalive:!0}),n!==this.generation)return;break}catch{if(n!==this.generation)return;let t=e&&!this.bestEffortRequested?mh[r]:void 0;if(t===void 0)break;if(await this.waitForRetry(t),n!==this.generation)return;if(!this.isEnabled())return this.clearPending();if(this.bestEffortRequested)break}}}waitForRetry(e){return new Promise(t=>{let n=()=>{this.retryTimer=void 0,this.resolveRetryDelay=void 0,t()};this.resolveRetryDelay=n,this.retryTimer=setTimeout(n,e)})}interruptRetryDelay(){this.retryTimer!==void 0&&clearTimeout(this.retryTimer),this.resolveRetryDelay?.()}scheduleFlush(){this.timer===void 0&&(this.timer=setTimeout(()=>{this.timer=void 0,this.flush(!0)},ph))}clearFlushTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}},vh=e=>{let t=xh(e.props);return{kind:e.kind,...yh(e.thread_id)?{thread_id:e.thread_id}:{},...yh(e.message_id)?{message_id:e.message_id}:{},...yh(e.run_id)?{run_id:e.run_id}:{},...bh(e.value)?{value:e.value}:{},...t?{props:t}:{}}},yh=e=>e&&e.length<=48?e:void 0,bh=e=>e!==void 0&&Number.isInteger(e)&&e>=0,xh=e=>{if(!e)return;let t=Object.entries(e);if(t.some(([,e])=>typeof e==`string`&&e.length>256||typeof e==`number`&&!Number.isFinite(e)||typeof e!=`string`&&typeof e!=`number`&&typeof e!=`boolean`))return;let n=Object.fromEntries(t);return new TextEncoder().encode(JSON.stringify(n)).byteLength<=1024?n:void 0},Sh=[`numeric`,`categorical`,`boolean`],Ch=class{cloud;constructor(e){this.cloud=e}async create(e){let t=km(await this.cloud.makeRequest(`/scores`,{method:`POST`,body:e}),`score response`);return{score_id:jm(t.score_id,`score response.score_id`),name:jm(t.name,`score response.name`),data_type:Pm(t.data_type,`score response.data_type`,Sh),value:Nm(t.value,`score response.value`),string_value:Fm(t.string_value,`score response.string_value`)}}},wh=class{cloud;constructor(e){this.cloud=e}async create(){return{token:jm(km(await this.cloud.makeRequest(`/auth/tokens`,{method:`POST`}),`auth token response`).token,`token`)}}},Th=[`positive`,`negative`],Eh=(e,t)=>{let n=km(e,t);return{id:jm(n.id,`${t}.id`),parent_id:Fm(n.parent_id,`${t}.parent_id`),height:Lm(n.height,`${t}.height`),created_at:Rm(n.created_at,`${t}.created_at`),updated_at:Rm(n.updated_at,`${t}.updated_at`),format:jm(n.format,`${t}.format`),content:zm(n.content,`${t}.content`),external_id:Fm(n.external_id??null,`${t}.external_id`)}},Dh=class{cloud;constructor(e){this.cloud=e}async list(e,t){return{messages:Am(km(await this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:t}),`thread message list response`).messages,`messages`).map((e,t)=>Eh(e,`messages[${t}]`))}}async create(e,t){return{message_id:jm(km(await this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:`POST`,body:{parent_id:t.parent_id,format:t.format,content:t.content,...t.external_id===void 0?void 0:{external_id:t.external_id},...t.parent_external_id===void 0?void 0:{parent_external_id:t.parent_external_id}}}),`thread message create response`).message_id,`message_id`)}}async update(e,t,n){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages/${encodeURIComponent(t)}`,{method:`PUT`,body:n})}async feedback(e,t,n){let r=n.comment?.trim(),i=km(await this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages/${encodeURIComponent(t)}/feedback`,{method:`POST`,body:{type:n.type,...r?{comment:r}:void 0}}),`thread message feedback response`);return{feedback_id:jm(i.feedback_id,`feedback_id`),type:Pm(i.type,`type`,Th),...`comment`in i?{comment:Fm(i.comment,`comment`)}:void 0}}},Oh=(e,t)=>{let n=km(e,t);return{title:Fm(n.title,`${t}.title`)??``,last_message_at:Rm(n.last_message_at,`${t}.last_message_at`),metadata:n.metadata,external_id:Fm(n.external_id,`${t}.external_id`),id:jm(n.id,`${t}.id`),project_id:jm(n.project_id,`${t}.project_id`),created_at:Rm(n.created_at,`${t}.created_at`),updated_at:Rm(n.updated_at,`${t}.updated_at`),workspace_id:jm(n.workspace_id,`${t}.workspace_id`),is_archived:Im(n.is_archived,`${t}.is_archived`)}},kh=class{messages;cloud;constructor(e){this.cloud=e,this.messages=new Dh(e)}async list(e){let t=e?.is_archived===void 0?e:{...e,is_archived:String(e.is_archived)};return{threads:Am(km(await this.cloud.makeRequest(`/threads`,{query:t}),`thread list response`).threads,`threads`).map((e,t)=>Oh(e,`threads[${t}]`))}}async get(e){return Oh(km(await this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`),`thread response`).thread,`thread`)}async create(e){return{thread_id:jm(km(await this.cloud.makeRequest(`/threads`,{method:`POST`,body:e}),`thread create response`).thread_id,`thread_id`)}}async update(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:`PUT`,body:t})}async claim(e){return{moved:Lm(km(await this.cloud.makeRequest(`/threads/claim`,{method:`POST`,body:e}),`thread claim response`).moved,`moved`)}}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:`DELETE`})}},Ah=class{cloud;constructor(e){this.cloud=e}async list(e,t){return{messages:Am(km(await this.cloud.makeRequest(`/projects/threads/${encodeURIComponent(e)}/messages`,{query:t}),`project thread message list response`).messages,`messages`).map((e,t)=>Eh(e,`messages[${t}]`))}}},jh=class{messages;cloud;constructor(e){this.cloud=e,this.messages=new Ah(e)}async list(e){return{threads:Am(km(await this.cloud.makeRequest(`/projects/threads`,{query:{...e,...e?.is_archived===void 0?{}:{is_archived:String(e.is_archived)}}}),`project thread list response`).threads,`threads`).map((e,t)=>Oh(e,`threads[${t}]`))}}},Mh=class{threads;constructor(e){this.threads=new jh(e)}},Nh=class{cloud;constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:`${this.cloud._baseUrl}/v1/runs/stream`,protocol:`ui-message-stream`,headers:async()=>{let e=await this.cloud._auth.getAuthHeaders();if(!e)throw Error(`Authorization failed`);return{...e,Accept:`text/plain`,"Aui-Sdk":this.cloud.sdkHeader()}},body:async t=>{let n=t?.threadId;if(n===void 0)throw Error(`Assistant Cloud runs need a thread; the thread list adapter has not assigned a remote id to this thread yet.`);return{assistant_id:e,response_format:`vercel-ai-data-stream/v1`,thread_id:n}}}}async stream(e){let t=await this.cloud.makeRawRequest(`/runs/stream`,{method:`POST`,headers:{Accept:`text/plain`},body:e});if(!t.body)throw new Dm(`Invalid Assistant Cloud response for "run stream": expected a response body`);let n=t.headers.get(`content-type`);if(n?.split(`;`,1)[0]?.trim().toLowerCase()!==`text/plain`)throw await t.body.cancel().catch(()=>void 0),new Dm(`Invalid Assistant Cloud response for "run stream": expected a "text/plain" content type, received ${n?`"${n}"`:`no Content-Type header`}`);return Su.fromResponse(t,new Zu)}async report(e){return{run_id:jm(km(await this.cloud.makeRequest(`/runs`,{method:`POST`,body:e}),`run report response`).run_id,`run_id`)}}},Ph=class{cloud;constructor(e){this.cloud=e}async pdfToImages(e){let t=km(await this.cloud.makeRequest(`/files/pdf-to-images`,{method:`POST`,body:e}),`PDF conversion response`);return{success:Im(t.success,`PDF conversion response.success`),urls:Am(t.urls,`PDF conversion response.urls`).map((e,t)=>jm(e,`PDF conversion response.urls[${t}]`)),message:jm(t.message,`PDF conversion response.message`)}}async generatePresignedUploadUrl(e){let t=km(await this.cloud.makeRequest(`/files/attachments/generate-presigned-upload-url`,{method:`POST`,body:e}),`presigned upload response`);return{success:Im(t.success,`presigned upload response.success`),signedUrl:jm(t.signedUrl,`presigned upload response.signedUrl`),expiresAt:jm(t.expiresAt,`presigned upload response.expiresAt`),publicUrl:jm(t.publicUrl,`presigned upload response.publicUrl`),...`key`in t?{key:jm(t.key,`presigned upload response.key`)}:{}}}async generatePresignedDownloadUrl(e){let t=km(await this.cloud.makeRequest(`/files/attachments/generate-presigned-download-url`,{method:`POST`,body:e}),`presigned download response`);return{signedUrl:jm(t.signedUrl,`presigned download response.signedUrl`),expiresAt:jm(t.expiresAt,`presigned download response.expiresAt`),key:jm(t.key,`presigned download response.key`)}}},Fh=class{threads;projects;auth;runs;files;events;scores;telemetry;registerSdk;constructor(e){let t=new uh(e);this.registerSdk=t.registerSdk;let n=e.telemetry,r=n===!1?{enabled:!1}:n===!0||n===void 0?{enabled:!0}:{...n,enabled:n.enabled!==!1};this.telemetry=new Proxy(r,{set:(e,t,n)=>{let r=Reflect.set(e,t,n);return(t===`enabled`||t===`events`)&&(e.enabled===!1||e.events===!1)&&gh(this.events),r}}),this.threads=new kh(t),this.projects=new Mh(t),this.auth={tokens:new wh(t)},this.runs=new Nh(t),this.files=new Ph(t),this.events=new _h(t,()=>this.telemetry.enabled!==!1&&this.telemetry.events!==!1),this.scores=new Ch(t)}},Ih=256;function Lh(e,t,n){e.delete(t),e.set(t,n),e.size>Ih&&e.delete(e.keys().next().value)}function Rh(e,t){e.delete(t),e.add(t),e.size>Ih&&e.delete(e.values().next().value)}var zh=(e,t)=>({thread_id:e,...t===void 0?void 0:{message_id:t}}),Bh=class{runStartedAt=new Map;runEndedAt=new Map;shownErrors=new Set;shownSuggestions=new Set;getCloud;resolveIds;constructor(e,t=zh){this.getCloud=typeof e==`function`?e:()=>e,this.resolveIds=t}runStarted(e){this.runStartedAt.set(e,Date.now()),this.shownErrors.delete(e)}runEnded(e){this.runStartedAt.delete(e),Lh(this.runEndedAt,e,Date.now())}runStopped(e){let t=this.runStartedAt.get(e);if(t===void 0)return;let n=Date.now();this.runStartedAt.delete(e),Lh(this.runEndedAt,e,n),this.track(`run_stopped`,e,void 0,{value:Math.max(0,n-t)})}messageSent(e,t){let n=this.runEndedAt.get(e);this.track(`message_sent`,e,t.messageId,{props:{chars:t.chars,attachments:t.attachments},...n===void 0?void 0:{value:Math.max(0,Date.now()-n)}},{awaitThread:!0})}messageEdited(e,t){this.track(`message_edited`,e,t.messageId,{props:{chars:t.chars}})}messageRegenerated(e,t){this.track(`message_regenerated`,e,t)}errorShown(e,t){this.shownErrors.has(e)||(Rh(this.shownErrors,e),this.track(`error_shown`,e,t.messageId,{props:{reason:t.reason}}))}suggestionsShown(e,t){this.shownSuggestions.has(e)||(Rh(this.shownSuggestions,e),this.track(`suggestions_shown`,e,void 0,{value:t}))}suggestionClicked(e){this.track(`suggestion_clicked`,e)}attachmentAdded(e,t){this.track(`attachment_added`,e,t.messageId,{...t.contentType?{props:{type:t.contentType}}:void 0})}attachmentFailed(e,t){this.track(`attachment_failed`,e,t.messageId,{...t.contentType?{props:{type:t.contentType}}:void 0})}voiceStarted(e){this.track(`voice_started`,e)}speechStarted(e,t){this.track(`speech_started`,e,t)}branchSwitched(e,t){this.track(`branch_switched`,e,t)}messageCopied(e,t){this.track(`message_copied`,e,t)}toolApproved(e,t,n,r){this.track(`tool_approved`,e,t,{props:{toolCallId:n,toolName:r}})}toolRejected(e,t,n,r){this.track(`tool_rejected`,e,t,{props:{toolCallId:n,toolName:r}})}threadSwitched(e){this.track(`thread_switched`,e)}track(e,t,n,r={},i={awaitThread:!1}){Promise.resolve().then(()=>this.resolveIds(t,n,i)).then(t=>{t&&(e===`thread_switched`&&!t.thread_id||this.getCloud().events.track({kind:e,...r,...t}))}).catch(()=>{})}},Vh=200,Hh=class{idMapping=new Map;getCloud;constructor(e){this.getCloud=typeof e==`function`?e:()=>e}async append(e,t,n,r,i){let a=this.getCloud(),o=this.idMapping.get(t);if(o instanceof Promise){await o;return}let s=(async()=>{let t=n?this.idMapping.get(n):void 0,o=n?await t??n:null,{message_id:s}=await a.threads.messages.create(e,{parent_id:o,format:r,content:i});return s})();this.idMapping.set(t,s);try{let e=await s;this.idMapping.get(t)===s&&this.idMapping.set(t,e)}catch(e){throw this.idMapping.get(t)===s&&this.idMapping.delete(t),e}}async update(e,t,n,r){let i=this.getCloud(),a=await this.getRemoteId(t);if(!a){console.warn(`Skipping update for message ${t}: no remote id is mapped.`);return}await i.threads.messages.update(e,a,{content:r})}isPersisted(e){return this.idMapping.has(e)}async getRemoteId(e){let t=this.idMapping.get(e);if(t)return t}getResolvedRemoteId(e){let t=this.idMapping.get(e);return typeof t==`string`?t:void 0}record(e,t){this.idMapping.set(e,t)}async load(e,t){let n=this.idMapping,r=this.getCloud(),i=[],a=new Set,o;for(;;){let n=await r.threads.messages.list(e,{...t?{format:t}:void 0,limit:Vh,...o?{after:o}:void 0}),s=n.messages.at(-1);if(!s)break;let c=n.messages.filter(e=>!a.has(e.id));if(c.length===0)break;for(let e of c)a.add(e.id);if(i.push(...c),n.messages.length<Vh)break;o=s.id}if(this.idMapping===n)for(let e of i){let t=n.get(e.id);t===void 0?n.set(e.id,e.id):t instanceof Promise&&t.catch(()=>{let r=n.get(e.id);(r===void 0||r===t)&&n.set(e.id,e.id)})}return i}reset(){this.idMapping=new Map}},Uh=5e4,Wh=/^[A-Za-z0-9+/]+={0,2}$/;function Gh(e,t=`completed`){if(e.isError)return{status:`error`};if(e.isAbort)return{status:`incomplete`,outcome:`aborted`};if(e.isDisconnect)return{status:`incomplete`,outcome:`disconnected`};switch(e.finishReason){case`length`:return{status:`incomplete`,outcome:`length`};case`content-filter`:case`content_filter`:return{status:`incomplete`,outcome:`content_filter`};case`cancelled`:return{status:`incomplete`,outcome:`aborted`};case`error`:return{status:`error`};default:return{status:e.finishReason===void 0?t:`completed`}}}var Kh=64,qh=2048;function Jh(e){if(e==null)return{};let t=typeof e==`object`?e:void 0,n=typeof e==`string`?e:typeof t?.message==`string`?t.message:void 0,r=typeof t?.code==`string`?t.code:typeof t?.name==`string`&&t.name!==`Error`?t.name:void 0;return{...n?{error:n.slice(0,qh)}:void 0,...r?{errorCode:r.slice(0,Kh)}:void 0}}function Yh(e){return e.length<=Uh?e:e.slice(0,Uh)}function Xh(e){if(e!=null)try{return Yh(JSON.stringify(e))}catch{return}}var Zh=e=>(e.length*3/4/1024).toFixed(1),Qh=e=>{if(typeof e!=`string`)return!1;let t=e.slice(0,200);return t.length>0&&t.length%4==0&&Wh.test(t)};function $h(e){if(!e||typeof e!=`object`)return e;let t=e;if((t.type===`image`||t.type===`audio`)&&Qh(t.data))return{...t,data:`[${String(t.type)}: ${Zh(t.data)}KB]`};if(t.type===`resource`&&t.resource&&typeof t.resource==`object`){let e=t.resource;if(Qh(e.blob))return{...t,resource:{...e,blob:`[resource: ${Zh(e.blob)}KB]`}}}return e}function eg(e){if(e!=null){try{let t=typeof e==`string`?JSON.parse(e):e;if(Array.isArray(t))return Yh(JSON.stringify(t.map($h)));if(typeof t==`object`){let e=t.content;if(Array.isArray(e))return Yh(JSON.stringify({...t,content:e.map($h)}))}}catch{}return Xh(e)}}function tg(e){let{toolName:t,toolCallId:n,args:r,argsText:i,result:a,toolSource:o}=e,s={tool_name:t,tool_call_id:n},c=i==null?Xh(r):Yh(i);c!==void 0&&(s.tool_args=c);let l=o===`mcp`?eg(a):Xh(a);return l!==void 0&&(s.tool_result=l),o&&(s.tool_source=o),s}function ng(e){if(!e)return;if(typeof e.modelId==`string`)return e.modelId;let t=e.custom;if(typeof t?.modelId==`string`)return t.modelId;let n=e.steps;if(Array.isArray(n))for(let e of n){if(!e||typeof e!=`object`)continue;let t=e.response;if(!t||typeof t!=`object`)continue;let n=t.modelId;if(typeof n==`string`)return n}}function rg(e,t){if(!t)return;let n=ug(t);n&&(n.inputTokens!==void 0&&(e.input_tokens=n.inputTokens),n.outputTokens!==void 0&&(e.output_tokens=n.outputTokens),n.reasoningTokens!==void 0&&(e.reasoning_tokens=n.reasoningTokens),n.cachedInputTokens!==void 0&&(e.cached_input_tokens=n.cachedInputTokens))}function ig(e){let t={},n=e.usage?ug(e.usage):void 0;return n?.inputTokens!==void 0&&(t.input_tokens=n.inputTokens),n?.outputTokens!==void 0&&(t.output_tokens=n.outputTokens),n?.reasoningTokens!==void 0&&(t.reasoning_tokens=n.reasoningTokens),n?.cachedInputTokens!==void 0&&(t.cached_input_tokens=n.cachedInputTokens),e.toolCalls!==void 0&&(t.tool_calls=e.toolCalls),e.startMs!==void 0&&(t.start_ms=e.startMs),e.endMs!==void 0&&(t.end_ms=e.endMs),e.finishReason!==void 0&&(t.finish_reason=e.finishReason.slice(0,32)),e.input!==void 0&&(t.input=Yh(e.input)),t}function ag(e){if(!e)return;let t=[],n=new Set;for(let r of e){let e=r.trim().slice(0,64).trim();if(!(!e||n.has(e))&&(n.add(e),t.push(e),t.length===20))break}return t.length>0?t:void 0}function og(e){if(!(e===void 0||!Number.isFinite(e)))return Math.max(0,Math.round(e))}function sg(e){if(!(e===void 0||!Number.isFinite(e)||e<0))return e}function cg(e,t){if(!t)return;let n={},r=sg(t.input);r!==void 0&&(n.input=r);let i=sg(t.inputCachedTokens);i!==void 0&&(n.input_cached_tokens=i);let a=sg(t.output);a!==void 0&&(n.output=a);let o=sg(t.total);o!==void 0&&(n.total=o),Object.keys(n).length>0&&(e.cost_details=n)}function lg(e){let t={thread_id:e.threadId,status:e.status},n=e.traceId?.toLowerCase();n&&/^[0-9a-f]{32}$/.test(n)&&(t.trace_id=n);let r=e.rootSpanId?.toLowerCase();r&&/^[0-9a-f]{16}$/.test(r)&&(t.root_span_id=r),e.outcome!==void 0&&(t.outcome_type=e.outcome),e.errorCode!==void 0&&(t.error_code=e.errorCode),e.error!==void 0&&(t.error=e.error),e.messageId!==void 0&&(t.message_id=e.messageId),e.modelId!==void 0&&(t.model_id=e.modelId),e.provider!==void 0&&(t.provider=e.provider,t.provider_type=e.provider),rg(t,e.usage),e.steps===void 0?e.totalSteps!==void 0&&(t.total_steps=e.totalSteps):(t.steps=e.steps.map(ig),t.total_steps=e.steps.length),e.toolCalls!==void 0&&(t.tool_calls=e.toolCalls);let i=og(e.durationMs);i!==void 0&&(t.duration_ms=i);let a=og(e.firstTokenMs);a!==void 0&&(t.first_token_ms=a);let o=sg(e.costUsd);o!==void 0&&(t.cost_usd=o),cg(t,e.costDetails),e.outputText!==void 0&&(t.output_text=Yh(e.outputText)),e.attributes!==void 0&&(t.attributes=e.attributes),e.metadata!==void 0&&(t.metadata=e.metadata),e.telemetry?.environment!==void 0&&(t.environment=e.telemetry.environment),e.telemetry?.release!==void 0&&(t.release=e.telemetry.release);let s=ag(e.telemetry?.tags);return s!==void 0&&(t.tags=s),t}function ug(e){let t=e.inputTokens??e.promptTokens,n=e.outputTokens??e.completionTokens,r=e.reasoningTokens??e.outputTokenDetails?.reasoningTokens,i=e.cachedInputTokens??e.inputTokenDetails?.cacheReadTokens;if(t!=null||n!=null||r!=null||i!=null)return{...t==null?void 0:{inputTokens:t},...n==null?void 0:{outputTokens:n},...r==null?void 0:{reasoningTokens:r},...i==null?void 0:{cachedInputTokens:i}}}var dg=class{reported=new Set;getCloud;constructor(e){this.getCloud=typeof e==`function`?e:()=>e}async report(e,t){let n;try{let r=this.getCloud();if(!r.telemetry.enabled||t!==void 0&&this.reported.has(t))return;let i=lg({...e,telemetry:r.telemetry}),{beforeReport:a}=r.telemetry,o=a?a(i):i;if(!o)return;t!==void 0&&(this.reported.add(t),n=t),await r.runs.report(o)}catch(e){n!==void 0&&fg(e)&&this.reported.delete(n);return}}},fg=e=>e instanceof ch&&e.status===429,pg=(e,t)=>({append:async(n,r)=>{let i=t.getId(r.message),a=t.encode(r);return e.append(n,i,r.parentId,t.format,a)},update:e.update?async(n,r,i)=>{let a=t.encode(r);return e.update(n,i,t.format,a)}:void 0,load:async n=>({messages:(await e.load(n,t.format)).filter(e=>e.format===t.format).map(e=>t.decode({id:e.id,parent_id:e.parent_id,format:e.format,content:e.content})).reverse()}),isPersisted:t=>e.isPersisted(t)});function mg(e){return typeof e==`object`&&!!e}function hg(e){return mg(e)&&typeof e.type==`string`}function gg(e){if(typeof e.toolCallId!=`string`)return;let t=e.type.startsWith(`tool-`);if(!t&&e.type!==`dynamic-tool`)return;let n=t?e.type.slice(5):typeof e.toolName==`string`?e.toolName:void 0;if(n)return tg({toolName:n,toolCallId:e.toolCallId,args:e.input??e.args,result:e.output??e.result,toolSource:t?`frontend`:`mcp`})}function _g(e,t){let n=mg(t?.samplingCalls)?t.samplingCalls:void 0;if(n)for(let t of e){let e=n[t.tool_call_id];Array.isArray(e)&&e.length>0&&(t.sampling_calls=e)}}function vg(e){let t=e?.steps;return Array.isArray(t)?t.map(e=>mg(e)&&mg(e.usage)?e.usage:void 0):[]}function yg(e){let t={};for(let n of e)n.inputTokens!=null&&(t.inputTokens=(t.inputTokens??0)+n.inputTokens),n.outputTokens!=null&&(t.outputTokens=(t.outputTokens??0)+n.outputTokens),n.reasoningTokens!=null&&(t.reasoningTokens=(t.reasoningTokens??0)+n.reasoningTokens),n.cachedInputTokens!=null&&(t.cachedInputTokens=(t.cachedInputTokens??0)+n.cachedInputTokens);return t}function bg(e){let t=mg(e?.usage)?ug(e.usage):void 0;if(t)return t;let n=vg(e).flatMap(e=>{let t=e?ug(e):void 0;return t?[t]:[]});return n.length>0?yg(n):void 0}function xg(e){let t=[],n=[],r=[],i=[],a;for(let o of e){if(o.role!==`assistant`)continue;a=o;let e=mg(o.metadata)?o.metadata:void 0,s=vg(e),c=[],l,u=-1;for(let e of o.parts){if(!hg(e))continue;if(e.type===`step-start`){u+=1;let e=s[u];l=e?{usage:e}:{},r.push(l);continue}if(e.type===`text`&&typeof e.text==`string`&&e.text){t.push(e.text);continue}let i=gg(e);i&&(n.push(i),c.push(i),l&&(l.toolCalls=[...l.toolCalls??[],i],l.finishReason=`tool-calls`))}_g(c,e);let d=bg(e);d&&i.push(d)}if(!a)return null;let o=mg(a.metadata)?a.metadata:void 0,s=i.length>0?yg(i):void 0,c=ng(o),l=t.length>0||n.length>0;return{...a.id===void 0?void 0:{assistantMessageId:a.id},status:l?`completed`:`incomplete`,...n.length>0?{toolCalls:n}:void 0,...r.length>0?{steps:r,totalSteps:r.length}:void 0,...t.length>0?{outputText:Yh(t.join(``))}:void 0,...s?{usage:s}:void 0,...c?{modelId:c}:void 0,...o?{metadata:o}:void 0}}var Sg=new WeakMap,Cg=new WeakMap,wg=e=>{let t=Cg.get(e);return t||(t={settled:new Set,reported:new Set},Cg.set(e,t)),t},Tg=e=>e.role===`assistant`&&(e.status.type===`complete`||e.status.type===`incomplete`),Eg=(e,t)=>{let n=Hc(t);if(!e)return n;if(!n)return e;let r=Math.max(e.omitted??0,n.omitted??0),i={entries:e.entries,...r?{omitted:r}:void 0};for(let e of n.entries)i.entries.some(t=>t.type===e.type&&t.occurredAt===e.occurredAt&&ed(t.payload,e.payload))||(i=Bc(i,e));return i},Dg=new Set([401,403,408,429]),Og=new Set([402,404]),kg=e=>e instanceof ch&&e.status>=400&&e.status<500&&!Dg.has(e.status),Ag=class{cloudRef;getAui;runReporter;copiedThreads=new Map;copyQueues=new Map;constructor(e,t){this.cloudRef=e,this.getAui=t,this.runReporter=new dg(()=>this.cloudRef.current)}get aui(){return this.getAui()}getCloud(){return this.cloudRef.current}ownsThread(e){let t=this.aui.threadListItem;if(!t.source)return!1;let{id:n,remoteId:r}=t.getState();return n===e||r===e}getPersistence(e=this.aui.threadListItem){let t=ba(e);return Sg.has(t)||Sg.set(t,new Hh(()=>this.cloudRef.current)),Sg.get(t)}get _persistence(){return this.getPersistence()}async resolveEngagementEventIds(e,t,n){let r=this.getThreadListItem(e);if(!r)return;let i=r.getState().remoteId;!i&&n?.awaitThread&&(i=await r.initialize().then(e=>e.remoteId).catch(()=>void 0));let a=t?this.getPersistence(r).getResolvedRemoteId(t):void 0;return{...i?{thread_id:i}:void 0,...a?{message_id:a}:void 0}}feedback={submit:({message:e,type:t,comment:n})=>{(async()=>{let r=this.tryGetKeyedThreadListItem(),i=r?.getState().remoteId;if(!r||!i){console.warn(`[assistant-ui] Skipping feedback for message ${e.id}: the thread has no remote id.`);return}let a=await this.getPersistence(r).getRemoteId(e.id);if(!a){console.warn(`[assistant-ui] Skipping feedback for message ${e.id}: no cloud message id is mapped.`);return}await this.cloudRef.current.threads.messages.feedback(i,a,{type:t,...n?{comment:n}:void 0})})().catch(e=>{console.error(`[assistant-ui] Cloud feedback submission failed:`,e)})}};tryGetKeyedThreadListItem(){let e=this.aui.threadListItem;if(!e.source)return;let t=e.getState().id;if(t!==void 0)return this.aui.threads.getState().threadItems.some(e=>e.id===t||e.remoteId===t)?this.aui.threads.item({id:t}):e}getThreadListItem(e){let t=this.aui.threadListItem;if(t.source){let n=t.getState();if(n.id===e||n.remoteId===e)return t}let n=this.aui.threads.getState().threadItems.find(t=>t.id===e||t.remoteId===e);return n?this.aui.threads.item({id:n.id}):void 0}withFormat(e){let t=this,n,r=()=>{let e=t.tryGetKeyedThreadListItem();return e&&(n=e),n},i=()=>n??r(),a=n=>pg(t.getPersistence(n),e);return{pin(){r()},async append(e){let t=i();if(!t)throw Error(`Cannot persist cloud history without a thread list item.`);let n=t.getState().remoteId??(await t.initialize()).remoteId;await a(t).append(n,e)},async update(e,t){let n=i(),r=n?.getState().remoteId;!r||!n||await a(n).update?.(r,e,t)},async delete(){throw Error(`Assistant Cloud does not support deleting thread messages yet.`)},reportTelemetry(n,r){let a=n.map(t=>e.encode(t));t._reportRunTelemetry(e.format,a,r,i(),Ng(Mg(n,e),r?.message?Pg(r.message,`aui/v0`):void 0))},async load(){let e=r(),n=t.aui.threadListItem,i=n.source?n.getState().remoteId:void 0;return i?a(e??n).load(i):{messages:[]}}}}async append({parentId:e,message:t}){let{remoteId:n}=await this.aui.threadListItem.initialize(),r=this._persistence;await this._writeMessage(r,n,t,i=>r.append(n,t.id,e,`aui/v0`,i))}async update(e){let t=this._persistence;if(!t.isPersisted(e.message.id))return this.append(e);let{message:n}=e,r=this.aui.threadListItem.getState().remoteId;r&&await this._writeMessage(t,r,n,e=>t.update(r,n.id,`aui/v0`,e))}get unstable_copy(){let e=this.cloudRef.current?.telemetry;return e?.enabled===!1||e?.messages===!1?void 0:this.copy}copy=async(e,t)=>{let n=this.cloudRef.current;if(t.length===0)return;let r=this.tryGetKeyedThreadListItem();if(!r)throw Error(`Cannot copy cloud history without a thread list item.`);let i=(await r.initialize()).remoteId,a=this.getPersistence(r),o=(this.copyQueues.get(i)??Promise.resolve()).catch(()=>void 0).then(()=>this.copyBranch(n,i,a,e,t));this.copyQueues.set(i,o);try{await o}finally{this.copyQueues.get(i)===o&&this.copyQueues.delete(i)}};async copyBranch(e,t,n,r,i){let a=this.copiedThreads.get(t);a||(a=(async()=>{let r={stored:new Set,refused:new Set,closed:!1,interactions:new Map},i=new Set,a;for(;;){let o=await e.threads.messages.list(t,{limit:200,...a?{after:a}:void 0}),s=o.messages.filter(e=>!i.has(e.id));for(let e of s){if(i.add(e.id),!e.external_id||e.format!==`aui/v0`)continue;r.stored.add(e.external_id),n.record(e.external_id,e.id);let t=wm(e);for(let e of t?.message.content??[]){if(e.type!==`tool-call`)continue;let t=Eg(r.interactions.get(e.toolCallId),e.unstable_interactions);t&&r.interactions.set(e.toolCallId,t)}}let c=o.messages.at(-1);if(s.length===0||o.messages.length<200||!c)break;a=c.id}return r})(),this.copiedThreads.set(t,a));let o;try{o=await a}catch(e){throw this.copiedThreads.get(t)===a&&this.copiedThreads.delete(t),e}if(o.closed)return;let s=r.filter(e=>e.id.length>0&&e.id.length<=255),c=new Set(i),l=0,u;for(let r=0;r<s.length;r++)if(c.has(s[r].id))for(;l<=r;l++){let i=s[l];if(l!==r&&(o.stored.has(i.id)||o.refused.has(i.id))){o.stored.has(i.id)&&(u=i.id);continue}let a=bm(i),c={...a,content:a.content.map(e=>{if(e.type!==`tool-call`)return e;let t=Eg(o.interactions.get(e.toolCallId),e.unstable_interactions);return{...e,...t?{unstable_interactions:t}:void 0}})},d;try{({message_id:d}=await e.threads.messages.create(t,{parent_id:null,format:`aui/v0`,content:c,external_id:i.id,...u?{parent_external_id:u}:void 0}))}catch(e){if(!kg(e))throw e;if(Og.has(e.status)||o.stored.size===0&&o.refused.size>0){o.closed=!0,console.warn(`[assistant-ui] The cloud refused copies to thread ${t}; the dashboard shows the conversation as far as it was copied.`,e);return}o.refused.add(i.id),console.warn(`[assistant-ui] The cloud refused the copy of message ${i.id}; the dashboard shows the conversation without it.`,e);continue}o.stored.add(i.id),o.refused.delete(i.id),u=i.id,n.record(i.id,d);for(let e of c.content)e.type===`tool-call`&&e.unstable_interactions&&o.interactions.set(e.toolCallId,e.unstable_interactions)}}async _writeMessage(e,t,n,r){let i=bm(n),a=wg(e),o=Tg(n)&&!a.settled.has(n.id);if(await r(i),!o||(a.settled.add(n.id),a.reported.has(n.id))||!this.cloudRef.current.telemetry.enabled)return;let s=Bg(`aui/v0`,i);s&&(a.reported.add(n.id),this._sendReport(t,s,void 0,void 0,Pg(n,`aui/v0`),e))}async delete(){throw Error(`Assistant Cloud does not support deleting thread messages yet.`)}async load(){let e=this.aui.threadListItem.getState().remoteId;if(!e)return{messages:[]};let t=this._persistence,n=(await t.load(e,`aui/v0`)).filter(e=>e.format===`aui/v0`).reverse(),r=[],i=new Set,{settled:a}=wg(t);for(let e of n){let t=wm(e);t&&(t.parentId&&!i.has(t.parentId)||(i.add(t.message.id),Tg(t.message)&&a.add(t.message.id),r.push(t)))}return{messages:r}}_reportRunTelemetry(e,t,n,r,i){let a=r??this.aui.threadListItem,o=a.getState().remoteId;if(!o)return;let s=Vg(e,t)??(i?.status===void 0?void 0:{status:`incomplete`});s&&this._sendReport(o,s,n?.durationMs,n?.stepTimestamps,i,this.getPersistence(a))}_sendReport(e,t,n,r,i,a=this._persistence){let o=jg(t.steps,r),s=i?.localMessageId?a.getResolvedRemoteId(i.localMessageId):void 0;this.runReporter.report({threadId:e,status:i?.status??t.status,outcome:i?.outcomeType,error:i?.error,errorCode:i?.errorCode,messageId:s,traceId:i?.traceId,modelId:t.modelId,provider:i?.provider,usage:t.usage,steps:o,totalSteps:t.totalSteps,toolCalls:t.toolCalls,durationMs:n,firstTokenMs:i?.firstTokenMs,outputText:t.outputText,metadata:t.metadata})}};function jg(e,t){if(!t)return e;if(!e)return t.map(({start_ms:e,end_ms:t})=>({startMs:e,endMs:t}));let n=Math.min(e.length,t.length);return e.map((e,r)=>({...e,...r<n?{startMs:t[r].start_ms,endMs:t[r].end_ms}:void 0}))}function Mg(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n],i=Pg(r.message,t.format,t.getId(r.message));if(i)return i}}function Ng(e,t){if(!t)return e;let{localMessageId:n,...r}=t;return{...e,...r}}function Pg(e,t,n){if(!Fg(e)||e.role!==`assistant`)return;let r=Fg(e.status)?e.status:void 0,i=Fg(e.metadata)?e.metadata:void 0,a=Fg(i?.custom)?i.custom:void 0,o=(Fg(i?.timing)?i.timing:void 0)?.firstTokenTime,s=typeof o==`number`&&Number.isFinite(o)?Math.round(o):void 0,c=r?.type===`incomplete`?typeof r.reason==`string`?r.reason:void 0:typeof i?.finishReason==`string`?i.finishReason:void 0,l=r?.type===`incomplete`&&r.reason===`error`,u=Gh({finishReason:c,isError:l}),d=u.outcome,f=u.status===`error`?`error`:r?.type===`incomplete`?`incomplete`:c===void 0?void 0:u.status,p=l?Jh(r.error):{},m=n??(typeof e.id==`string`?e.id:void 0),h=t===`aui/v0`?a?.traceId:t===`ai-sdk/v6`?i?.traceId:void 0,g=typeof a?.provider==`string`?a.provider:typeof i?.provider==`string`?i.provider:void 0;return{...m?{localMessageId:m}:void 0,...f===void 0?void 0:{status:f},...d?{outcomeType:d}:void 0,...p,...s!=null&&s>=0?{firstTokenMs:s}:void 0,...typeof h==`string`?{traceId:h}:void 0,...g===void 0?void 0:{provider:g}}}function Fg(e){return typeof e==`object`&&!!e}var Ig=[`inputTokens`,`outputTokens`,`reasoningTokens`,`cachedInputTokens`,`promptTokens`,`completionTokens`],Lg=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0,Rg=e=>{if(!Fg(e)||Array.isArray(e))return;let t={};for(let n of Ig){let r=Lg(e[n]);r!==void 0&&(t[n]=r)}let n=Fg(e.inputTokenDetails)&&!Array.isArray(e.inputTokenDetails)?Lg(e.inputTokenDetails.cacheReadTokens):void 0;n!==void 0&&(t.inputTokenDetails={cacheReadTokens:n});let r=Fg(e.outputTokenDetails)&&!Array.isArray(e.outputTokenDetails)?Lg(e.outputTokenDetails.reasoningTokens):void 0;return r!==void 0&&(t.outputTokenDetails={reasoningTokens:r}),Object.keys(t).length>0?t:void 0},zg=e=>gu(e).map(e=>{let t=Rg(e.usage);return t?{usage:t}:{}});function Bg(e,t){switch(e){case`aui/v0`:return Hg(t);case`ai-sdk/v6`:return xg([t]);default:return null}}function Vg(e,t){if(e===`ai-sdk/v6`)return xg(t);for(let n=t.length-1;n>=0;n--){let r=Bg(e,t[n]);if(r)return r}return null}function Hg(e){let t=e;if(t.role!==`assistant`||t.status!==void 0&&!mu(t.status))return null;let n=Fg(t.status)&&typeof t.status.type==`string`?t.status.type:void 0;if(n===`running`||n===`requires-action`)return null;let r=t.content?.filter(e=>e.type===`tool-call`&&e.toolName&&e.toolCallId).map(e=>tg({toolName:e.toolName,toolCallId:e.toolCallId,args:e.args,result:e.result,argsText:e.argsText})),i=t.content?.filter(e=>e.type===`text`&&e.text),a=i&&i.length>0?Yh(i.map(e=>e.text).join(``)):void 0,o=zg(t.metadata?.steps),s,c,l,u;if(o&&o.length>0){let e=0,t=0,n=0,r=0,i=!1,a=!1,d=!1,f=!1;for(let s of o){if(!s.usage)continue;let o=ug(s.usage);o&&(o.inputTokens!=null&&(e+=o.inputTokens,i=!0),o.outputTokens!=null&&(t+=o.outputTokens,a=!0),o.reasoningTokens!=null&&(n+=o.reasoningTokens,d=!0),o.cachedInputTokens!=null&&(r+=o.cachedInputTokens,f=!0))}s=i?e:void 0,c=a?t:void 0,l=d?n:void 0,u=f?r:void 0}let d=n===`incomplete`?`incomplete`:`completed`,f=t.metadata?.custom,p=ng(t.metadata),m=o.length>0?o:void 0;return{status:d,...r&&r.length>0?{toolCalls:r}:void 0,...o?.length?{totalSteps:o.length}:void 0,...s!=null||c!=null||l!=null||u!=null?{usage:{...s==null?void 0:{inputTokens:s},...c==null?void 0:{outputTokens:c},...l==null?void 0:{reasoningTokens:l},...u==null?void 0:{cachedInputTokens:u}}}:void 0,...a==null?void 0:{outputText:a},...f?{metadata:f}:void 0,...m?{steps:m}:void 0,...p?{modelId:p}:void 0}}function Ug(e){let t=K(),n=R(t);z(()=>{n.current=t});let[r]=L(()=>new Ag(e,()=>n.current));return Xg(r,t),r}var Wg=new WeakMap,Gg=(e,t)=>{let n;for(let r of e.mounted.keys()){if(t!==void 0&&r.ownsThread(t))return r;n??=r}return n??e.lastMounted},Kg=e=>{let t={mounted:new Map,lastMounted:e,reporter:new Bh(()=>Gg(t).getCloud(),(e,n,r)=>Gg(t,e).resolveEngagementEventIds(e,n,r)),host:void 0,dispose:void 0};return t},qg=(e,t)=>{let n=()=>{let{mainThreadId:n}=e.threads.getState(),{isEmpty:r,suggestions:i}=e.thread.getState();!r||i.length===0||t.suggestionsShown(n,i.length)},r=[e.on({scope:`*`,event:`threads.selectionChanged`},e=>{t.threadSwitched(e.threadId)}),e.on({scope:`*`,event:`composer.send`},e=>{e.messageId?t.messageEdited(e.threadId,{messageId:e.messageId,chars:e.chars}):t.messageSent(e.threadId,{chars:e.chars,attachments:e.attachments}),e.suggestion&&t.suggestionClicked(e.threadId)}),e.on({scope:`*`,event:`composer.attachmentAdd`},e=>{t.attachmentAdded(e.threadId,{messageId:e.messageId,contentType:e.contentType})}),e.on({scope:`*`,event:`composer.attachmentAddError`},e=>{t.attachmentFailed(e.threadId,{messageId:e.messageId,contentType:e.contentType})}),e.on({scope:`*`,event:`composer.cancel`},e=>{t.runStopped(e.threadId)}),e.on({scope:`*`,event:`thread.runStart`},e=>{t.runStarted(e.threadId)}),e.on({scope:`*`,event:`thread.runEnd`},e=>{t.runEnded(e.threadId)}),e.on({scope:`*`,event:`thread.cancelRun`},e=>{t.runStopped(e.threadId)}),e.on({scope:`*`,event:`thread.voiceStarted`},e=>{t.voiceStarted(e.threadId)}),e.on({scope:`*`,event:`message.reload`},e=>{t.messageRegenerated(e.threadId,e.messageId)}),e.on({scope:`*`,event:`message.branchSwitched`},e=>{t.branchSwitched(e.threadId,e.messageId)}),e.on({scope:`*`,event:`message.copied`},e=>{t.messageCopied(e.threadId,e.messageId)}),e.on({scope:`*`,event:`thread.toolApprovalAnswered`},e=>{e.approved?t.toolApproved(e.threadId,e.messageId,e.toolCallId,e.toolName):t.toolRejected(e.threadId,e.messageId,e.toolCallId,e.toolName)}),e.on({scope:`*`,event:`message.speak`},e=>{t.speechStarted(e.threadId,e.messageId)}),e.on({scope:`*`,event:`message.error`},e=>{t.errorShown(e.threadId,{messageId:e.messageId,reason:e.reason})}),e.subscribe(n)];return n(),()=>as(r)},Jg=(e,t)=>{e.host=t,e.dispose=qg(t,e.reporter)},Yg=e=>{let t=e.dispose;e.host=void 0,e.dispose=void 0,t?.()},Xg=(e,t)=>{let n=F(4),r,i;n[0]!==e||n[1]!==t?(r=()=>{let n=ba(t.threads),r=Wg.get(n);r||(r=Kg(e),Wg.set(n,r));let i=r;return i.mounted.set(e,t),i.lastMounted=e,i.host===void 0&&Jg(i,t),()=>{if(i.mounted.delete(e),i.host!==t)return;Yg(i);let n=i.mounted.values().next();n.done||Jg(i,n.value)}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),z(r,i)};function Zg(e,t){return t||Mc(e)||`application/octet-stream`}var Qg=`application/octet-stream`,$g=e=>e.startsWith(`image/`)?`image`:e.startsWith(`text/`)?`document`:`file`,e_=class{accept=`*`;getCloud;constructor(e){this.getCloud=typeof e==`function`?e:()=>e}uploadedUrls=new Map;activeUploads=new Map;async*add({file:e}){let t=Ac(),n=$g(e.type),r=e.type||Qg,i={id:t,type:n,name:e.name,contentType:r,file:e,status:{type:`running`,reason:`uploading`,progress:0}},a=new AbortController,o={cancelled:!1,controller:a};this.activeUploads.set(t,o);try{if(yield i,o.cancelled)return;let{signedUrl:n,publicUrl:s}=await this.getCloud().files.generatePresignedUploadUrl({filename:e.name});if(o.cancelled)return;let c=await fetch(n,{method:`PUT`,body:e,headers:{"Content-Type":r},mode:`cors`,signal:a.signal});if(o.cancelled)return;if(!c.ok)throw Error(`Failed to upload file: ${c.status} ${c.statusText}`);this.uploadedUrls.set(t,s),i={...i,status:{type:`requires-action`,reason:`composer-send`}},yield i}catch(e){if(o.cancelled)return;console.error(`[assistant-ui] Failed to upload attachment:`,e),i={...i,status:{type:`incomplete`,reason:`error`,message:e instanceof Error?e.message:String(e)}},yield i}finally{this.activeUploads.get(t)===o&&this.activeUploads.delete(t)}}async remove(e){let t=this.activeUploads.get(e.id);t&&(t.cancelled=!0,t.controller.abort(),this.activeUploads.delete(e.id)),this.uploadedUrls.delete(e.id)}async send(e){let t=this.uploadedUrls.get(e.id);if(!t)throw Error(`Attachment not uploaded`);this.uploadedUrls.delete(e.id);let n;return n=e.type===`image`?[{type:`image`,image:t,filename:e.name}]:[{type:`file`,data:t,mimeType:Zg(t,e.contentType),filename:e.name}],{...e,status:{type:`complete`},content:n}}},t_=class{list(){return Promise.resolve({threads:[]})}rename(){return Promise.resolve()}updateCustom(){return Promise.resolve()}archive(){return Promise.resolve()}unarchive(){return Promise.resolve()}delete(){return Promise.resolve()}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){return Promise.resolve(new ReadableStream({start(e){e.close()}}))}fetch(e){return Promise.reject(Error(`Thread "${e}" not found in in-memory thread list.`))}},n_={name:`@assistant-ui/core`,version:`0.3.24`},r_=e=>Q(e)?e:void 0,i_=typeof process<`u`?{}.NEXT_PUBLIC_ASSISTANT_BASE_URL:void 0,a_=i_?new Fh({baseUrl:i_,anonymous:!0}):void 0,o_=e=>{let t=Ug(e),[n]=L(()=>new e_(()=>e.current));return Hr(()=>({history:t,attachments:n,feedback:t.feedback}),[t,n])},s_=20,c_=e=>{let t={activeCursor:e,archivedCursor:void 0,activeExhausted:!1,archivedExhausted:!1};if(!e||!e.startsWith(`{`))return t;try{let n=JSON.parse(e);return Q(n)?{activeCursor:typeof n.a==`string`?n.a:void 0,archivedCursor:typeof n.r==`string`?n.r:void 0,activeExhausted:n.ae===!0,archivedExhausted:n.re===!0}:t}catch{return t}},l_=e=>{let t=typeof e==`function`?e:()=>e,n=function(){return o_({get current(){return t().cloud??a_}})},r=t().cloud??a_;if(!r){let e=new t_;return e.initialize=async e=>({remoteId:e,externalId:(await t().create?.(e))?.externalId}),e}r.registerSdk?.(n_);let i=t().sdk;return i&&r.registerSdk?.(i),{list:async({after:e}={})=>{let{activeCursor:t,archivedCursor:n,activeExhausted:i,archivedExhausted:a}=c_(e),[{threads:o},{threads:s}]=await Promise.all([i?Promise.resolve({threads:[]}):r.threads.list({limit:s_,...t?{after:t}:{}}),a?Promise.resolve({threads:[]}):r.threads.list({is_archived:!0,limit:s_,...n?{after:n}:{}})]),c=!i&&o.length===s_?o.at(-1)?.id:void 0,l=!a&&s.length===s_?s.at(-1)?.id:void 0;return{threads:[...o,...s].map(e=>({status:e.is_archived?`archived`:`regular`,remoteId:e.id,title:e.title,lastMessageAt:e.last_message_at?new Date(e.last_message_at):void 0,externalId:e.external_id??void 0,custom:r_(e.metadata)})),nextCursor:c||l?JSON.stringify({a:c,r:l,...c===void 0?{ae:!0}:{},...l===void 0?{re:!0}:{}}):void 0}},initialize:async e=>{let n=await(t().create?.(e)??Promise.resolve()),i=n?n.externalId:void 0,{thread_id:a}=await r.threads.create({last_message_at:new Date,external_id:i,...i!==void 0&&t().upsert?{upsert:!0}:{}});return{externalId:i,remoteId:a}},rename:async(e,t)=>r.threads.update(e,{title:t}),updateCustom:async(e,t)=>r.threads.update(e,{metadata:t??null}),archive:async e=>r.threads.update(e,{is_archived:!0}),unarchive:async e=>r.threads.update(e,{is_archived:!1}),delete:async e=>(await t().delete?.(e),r.threads.delete(e)),generateTitle:async(e,t)=>{let n=t.map(e=>({...e,content:e.content.filter(e=>e.type===`text`||e.type===`tool-call`)}));return r.runs.stream({thread_id:e,assistant_id:`system/thread_title`,messages:n})},fetch:async e=>{let t=await r.threads.get(e);return{status:t.is_archived?`archived`:`regular`,remoteId:t.id,title:t.title,lastMessageAt:t.last_message_at?new Date(t.last_message_at):void 0,externalId:t.external_id??void 0,custom:r_(t.metadata)}},unstable_useAdapters:n}},u_=e=>{let t=R(e);Jr(()=>{t.current=e},[e]);let[n]=L(()=>({get current(){return t.current.cloud??a_}})),[r]=L(()=>function(){return o_(n)}),i=e.cloud??a_,a=()=>{let n=()=>e,a=l_(()=>({...n(),cloud:i}));return n=()=>t.current,a.unstable_useAdapters===void 0?a:{...a,unstable_useAdapters:r}},[o,s]=L(()=>({cloud:i,adapter:a()}));if(o.cloud!==i){let e={cloud:i,adapter:a()};return s(e),e.adapter}return o.adapter},d_=e=>{let t=F(6),{id:n,children:r}=e,i=K(),a;t[0]===n?a=t[1]:(a=ua({message:Jo({source:`thread`,query:{type:`id`,id:n},get:e=>e.thread.message({id:n})}),composer:Jo({source:`message`,query:{},get:e=>e.thread.message({id:n}).composer()})}),t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==r||t[4]!==o?(s=(0,I.jsx)(Yl,{extends:i,config:o,children:r}),t[2]=i,t[3]=r,t[4]=o,t[5]=s):s=t[5],s},f_=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,p_=()=>null,m_=new WeakMap,h_=(e,t)=>{let n=m_.get(e);return n||(n=new Set(e.map(e=>e.id)),m_.set(e,n)),n.has(t)},g_=(e,t,n)=>{switch(t){case`user`:return n?e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message:e.UserMessage??e.Message;case`assistant`:return n?e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message:e.AssistantMessage??e.Message;case`system`:return n?e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message??p_:e.SystemMessage??e.Message??p_;default:throw Error(`Unknown message role: ${t}`)}},__=e=>{let t=F(6),{components:n}=e,r=q(C_),i=q(w_),a;t[0]!==n||t[1]!==i||t[2]!==r?(a=g_(n,r,i),t[0]=n,t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s;return t[4]===o?s=t[5]:(s=(0,I.jsx)(o,{}),t[4]=o,t[5]=s),s},v_=Zr(e=>{let t=F(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,I.jsx)(__,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,I.jsx)(Od,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&f_(e.components,t.components));v_.displayName=`ThreadPrimitive.MessageByIndex`;var y_=Zr(e=>{let t=F(7),{messageId:n,components:r}=e,i;if(t[0]===n?i=t[1]:(i=e=>h_(e.thread.messages,n),t[0]=n,t[1]=i),!q(i))return null;let a;t[2]===r?a=t[3]:(a=(0,I.jsx)(__,{components:r}),t[2]=r,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,I.jsx)(d_,{id:n,children:a}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o},(e,t)=>e.messageId===t.messageId&&f_(e.components,t.components));y_.displayName=`ThreadPrimitive.Unstable_MessageById`;var b_=({children:e})=>{let t=q(wo(e=>e.thread.messages.map(e=>e.id)));return Hr(()=>t.length===0?null:t.map((t,n)=>(0,I.jsx)(Od,{index:n,children:(0,I.jsx)(Ql,{getItemState:e=>e.thread.message({index:n}).getState(),children:t=>e({get message(){return t()}})})},t)),[t,e])},x_=e=>{let t=F(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,I.jsx)(b_,{children:()=>(0,I.jsx)(__,{components:n})}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,I.jsx)(b_,{children:r}),t[2]=r,t[3]=i),i};x_.displayName=`ThreadPrimitive.Messages`;var S_=Zr(x_,(e,t)=>e.children||t.children?e.children===t.children:f_(e.components,t.components));function C_(e){return e.message.role}function w_(e){return e.message.composer.isEditing}var T_=e=>{let t=e.message.metadata;if(!(!t||typeof t!=`object`))return t.custom?.quote},E_=class extends Error{componentName;constructor(e,t=`Component "${e}" is not in the generative-ui allowlist.`){super(t),this.name=`GenerativeUIRenderError`,this.componentName=e}},D_=e=>typeof e==`object`&&!!e&&!Array.isArray(e),O_=e=>e==null?[]:Array.isArray(e)?e:[e],k_=64,A_=(e,t,n,r,i=0)=>{if(i>k_)return`${r}`,null;if(e==null)return null;if(typeof e==`string`||typeof e==`number`)return e;if(Array.isArray(e))return e.map((e,a)=>A_(e,t,n,`${r}/${a}`,i+1));if(!D_(e)||!(`component`in e)||typeof e.component!=`string`)return`${r}`,null;let{component:a,props:o,children:s,key:c}=e,l=Object.hasOwn(t,a)?t[a]:void 0;if(!l){if(n)return(0,I.jsx)(n,{component:a,props:o},c??r);throw new E_(a)}return $r(l,{...o??{},key:c??r},...O_(s).map((e,a)=>A_(e,t,n,`${r}/${a}`,i+1)))},j_=e=>{let t=F(11),{spec:n,components:r,Fallback:i}=e,a=n?.root,o;t[0]===a?o=t[1]:(o=O_(a),t[0]=a,t[1]=o);let s=o,c;if(t[2]!==i||t[3]!==r||t[4]!==s){let e;t[6]!==i||t[7]!==r?(e=(e,t)=>A_(e,r,i,`${t}`),t[6]=i,t[7]=r,t[8]=e):e=t[8],c=s.map(e),t[2]=i,t[3]=r,t[4]=s,t[5]=c}else c=t[5];let l;return t[9]===c?l=t[10]:(l=(0,I.jsx)(I.Fragment,{children:c}),t[9]=c,t[10]=l),l};j_.displayName=`GenerativeUIRender`;var M_=e=>{let t=F(4),{components:n,spec:r,Fallback:i}=e,a=q(N_),o=r??a;if(!o)return null;let s;return t[0]!==i||t[1]!==n||t[2]!==o?(s=(0,I.jsx)(j_,{spec:o,components:n,Fallback:i}),t[0]=i,t[1]=n,t[2]=o,t[3]=s):s=t[3],s};M_.displayName=`MessagePrimitive.GenerativeUI`;function N_(e){let t=e.part;return t?.type===`generative-ui`?t.spec:void 0}var P_=e=>{let t=-1;return{startGroup:e=>{t===-1&&(t=e)},endGroup:(n,r)=>{t!==-1&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{t!==-1&&r.push({type:e,startIndex:t,endIndex:n})}}},F_=(e,t,n)=>{let r=[];if(t){let t=P_(`chainOfThoughtGroup`);for(let n=0;n<e.length;n++){let i=e[n];i===`tool-call`||i===`reasoning`?t.startGroup(n):(t.endGroup(n-1,r),r.push({type:`single`,index:n}))}t.finalize(e.length-1,r)}else{let t=P_(`toolGroup`),n=P_(`reasoningGroup`);for(let i=0;i<e.length;i++){let a=e[i];a===`tool-call`?(n.endGroup(i-1,r),t.startGroup(i)):a===`reasoning`?(t.endGroup(i-1,r),n.startGroup(i)):(t.endGroup(i-1,r),n.endGroup(i-1,r),r.push({type:`single`,index:i}))}t.finalize(e.length-1,r),n.finalize(e.length-1,r)}if(n){let e=new Set;for(let t of r){if(t.type===`single`)continue;let r=n[t.startIndex];r?.includes(`:`)&&!e.has(r)&&(e.add(r),t.idKey=`id:${r}`)}}return r},I_=e=>{let t=F(10),n=q(wo(ov)),r=q(wo(sv)),i;bb0:{if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0];let n;t[1]===r?n=t[2]:(n={ranges:e,partIds:r},t[1]=r,t[2]=n),i=n;break bb0}let a;t[3]!==n||t[4]!==r||t[5]!==e?(a=F_(n,e,r),t[3]=n,t[4]=r,t[5]=e,t[6]=a):a=t[6];let o;t[7]!==r||t[8]!==a?(o={ranges:a,partIds:r},t[7]=r,t[8]=a,t[9]=o):o=t[9],i=o}return i},L_=e=>{let t=F(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.toolName?(i=e=>e.tools.toolUIs[r.toolName]?.[0]?.render??n,t[3]=n,t[4]=r.toolName,t[5]=i):i=t[5];let a=q(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,I.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},R_=(e,t,n)=>e.renderers[t]?.[0]||(e.fallbacks[0]??n),z_=e=>{let t=F(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.name?(i=e=>R_(e.dataRenderers,r.name,n),t[3]=n,t[4]=r.name,t[5]=i):i=t[5];let a=q(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,I.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},B_={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},V_=e=>{let t=F(54),{components:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?{}:n,t[0]=n,t[1]=r);let{Text:i,Reasoning:a,Image:o,Source:s,File:c,Unstable_Audio:l,tools:u,data:d,generativeUI:f}=r,p=i===void 0?B_.Text:i,m=a===void 0?B_.Reasoning:a,h=o===void 0?B_.Image:o,g=s===void 0?B_.Source:s,_=c===void 0?B_.File:c,v=l===void 0?B_.Unstable_Audio:l,y;t[2]===u?y=t[3]:(y=u===void 0?{}:u,t[2]=u,t[3]=y);let b=y,x=K(),S=q(cv),C=S.type;if(C===`tool-call`){let e=x.part.addToolResult,n=x.part.resumeToolCall,r=x.part.respondToToolApproval,i=x.part.unstable_recordInteraction;if(`Override`in b){let a;t[4]===i?a=t[5]:(a=i&&{unstable_recordInteraction:i},t[4]=i,t[5]=a);let o;return t[6]!==e||t[7]!==S||t[8]!==r||t[9]!==n||t[10]!==a||t[11]!==b.Override?(o=(0,I.jsx)(b.Override,{...S,addResult:e,resume:n,respondToApproval:r,...a}),t[6]=e,t[7]=S,t[8]=r,t[9]=n,t[10]=a,t[11]=b.Override,t[12]=o):o=t[12],o}let a;t[13]!==S.toolName||t[14]!==b.Fallback||t[15]!==b.by_name?(a=(b.by_name&&Object.hasOwn(b.by_name,S.toolName)?b.by_name[S.toolName]:void 0)??b.Fallback,t[13]=S.toolName,t[14]=b.Fallback,t[15]=b.by_name,t[16]=a):a=t[16];let o=a,s;t[17]===i?s=t[18]:(s=i&&{unstable_recordInteraction:i},t[17]=i,t[18]=s);let c;return t[19]!==o||t[20]!==e||t[21]!==S||t[22]!==r||t[23]!==n||t[24]!==s?(c=(0,I.jsx)(L_,{...S,Fallback:o,addResult:e,resume:n,respondToApproval:r,...s}),t[19]=o,t[20]=e,t[21]=S,t[22]=r,t[23]=n,t[24]=s,t[25]=c):c=t[25],c}if(S.status?.type===`requires-action`)throw Error(`Encountered unexpected requires-action status`);switch(C){case`text`:{let e;return t[26]!==p||t[27]!==S?(e=(0,I.jsx)(p,{...S}),t[26]=p,t[27]=S,t[28]=e):e=t[28],e}case`reasoning`:{let e;return t[29]!==m||t[30]!==S?(e=(0,I.jsx)(m,{...S}),t[29]=m,t[30]=S,t[31]=e):e=t[31],e}case`source`:{let e;return t[32]!==g||t[33]!==S?(e=(0,I.jsx)(g,{...S}),t[32]=g,t[33]=S,t[34]=e):e=t[34],e}case`image`:{let e;return t[35]!==h||t[36]!==S?(e=(0,I.jsx)(h,{...S}),t[35]=h,t[36]=S,t[37]=e):e=t[37],e}case`file`:{let e;return t[38]!==_||t[39]!==S?(e=(0,I.jsx)(_,{...S}),t[38]=_,t[39]=S,t[40]=e):e=t[40],e}case`audio`:{let e;return t[41]!==v||t[42]!==S?(e=(0,I.jsx)(v,{...S}),t[41]=v,t[42]=S,t[43]=e):e=t[43],e}case`data`:{let e;t[44]!==d||t[45]!==S.name?(e=(d?.by_name&&Object.hasOwn(d.by_name,S.name)?d.by_name[S.name]:void 0)??d?.Fallback,t[44]=d,t[45]=S.name,t[46]=e):e=t[46];let n=e,r;return t[47]!==n||t[48]!==S?(r=(0,I.jsx)(z_,{...S,Fallback:n}),t[47]=n,t[48]=S,t[49]=r):r=t[49],r}case`generative-ui`:{if(!f?.components)return null;let e=S,n;return t[50]!==f.Fallback||t[51]!==f.components||t[52]!==e.spec?(n=(0,I.jsx)(j_,{spec:e.spec,components:f.components,Fallback:f.Fallback}),t[50]=f.Fallback,t[51]=f.components,t[52]=e.spec,t[53]=n):n=t[53],n}default:return console.warn(`Unknown message part type: ${C}`),null}},H_=Zr(e=>{let t=F(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,I.jsx)(V_,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,I.jsx)(kd,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.generativeUI===t.components?.generativeUI&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);H_.displayName=`MessagePrimitive.PartByIndex`;var U_=e=>{let t=F(6),{status:n,component:r}=e,i=n.type===`running`,a;t[0]!==r||t[1]!==n?(a=(0,I.jsx)(r,{type:`text`,text:``,status:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,I.jsx)(jd,{text:``,isRunning:i,children:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o},W_=Object.freeze({type:`complete`}),G_=Object.freeze({type:`running`}),K_=Zr(e=>{let t=F(6),{components:n}=e,r=q(lv);if(n?.Empty){let e;return t[0]!==n.Empty||t[1]!==r?(e=(0,I.jsx)(n.Empty,{status:r}),t[0]=n.Empty,t[1]=r,t[2]=e):e=t[2],e}if(r.type!==`running`)return null;let i=n?.Text??B_.Text,a;return t[3]!==r||t[4]!==i?(a=(0,I.jsx)(U_,{status:r,component:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),q_=Zr(e=>{let t=F(4),{components:n,enabled:r}=e,i;if(t[0]===r?i=t[1]:(i=e=>{if(!r||e.message.parts.length===0)return!1;let t=e.message.parts[e.message.parts.length-1];return t?.type!==`text`&&t?.type!==`reasoning`},t[0]=r,t[1]=i),!q(i))return null;let a;return t[2]===n?a=t[3]:(a=(0,I.jsx)(K_,{components:n}),t[2]=n,t[3]=a),a},(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),J_=Zr(e=>{let t=F(4),{Quote:n}=e,r=q(T_);if(!r)return null;let i;return t[0]!==n||t[1]!==r.messageId||t[2]!==r.text?(i=(0,I.jsx)(n,{text:r.text,messageId:r.messageId}),t[0]=n,t[1]=r.messageId,t[2]=r.text,t[3]=i):i=t[3],i});function Y_(e,t){return(e.toolUIs[t.toolName]?.[0]?.render??null)||(pf(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}var X_=()=>{let e=F(9),t=K(),n=q(uv),r=q(dv),i=t.part.unstable_recordInteraction;if(!r||n.type!==`tool-call`)return null;let a;e[0]===i?a=e[1]:(a=i&&{unstable_recordInteraction:i},e[0]=i,e[1]=a);let o;return e[2]!==r||e[3]!==t.part.addToolResult||e[4]!==t.part.respondToToolApproval||e[5]!==t.part.resumeToolCall||e[6]!==n||e[7]!==a?(o=(0,I.jsx)(r,{...n,addResult:t.part.addToolResult,resume:t.part.resumeToolCall,respondToApproval:t.part.respondToToolApproval,...a}),e[2]=r,e[3]=t.part.addToolResult,e[4]=t.part.respondToToolApproval,e[5]=t.part.resumeToolCall,e[6]=n,e[7]=a,e[8]=o):o=e[8],o},Z_=()=>{let e=F(3),t=q(fv),n=q(pv);if(!n||t.type!==`data`)return null;let r=t,i;return e[0]!==n||e[1]!==r?(i=(0,I.jsx)(n,{...r}),e[0]=n,e[1]=r,e[2]=i):i=e[2],i},Q_=()=>{let e=F(2),t=q(mv);if(t===`tool-call`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(X_,{}),e[0]=t):t=e[0],t}if(t===`data`){let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,I.jsx)(Z_,{}),e[1]=t):t=e[1],t}return null},$_=Object.freeze({type:`text`,text:``,status:G_}),ev=({children:e})=>{let t=K(),n=q(e=>e.dataRenderers);return(0,I.jsx)(Ql,{getItemState:e=>e.part.getState(),children:r=>e({get part(){let e=r();if(e.type===`tool-call`){let n=Y_(t.tools.getState(),e)!==null,r=t.part;return{...e,toolUI:n?(0,I.jsx)(X_,{}):null,addResult:r.addToolResult,resume:r.resumeToolCall,respondToApproval:r.respondToToolApproval,...r.unstable_recordInteraction&&{unstable_recordInteraction:r.unstable_recordInteraction}}}if(e.type===`data`){let t=R_(n,e.name,void 0)!==void 0;return{...e,dataRendererUI:t?(0,I.jsx)(Z_,{}):null}}return e}})})},tv=e=>{let t=F(5),{index:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,I.jsx)(ev,{children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,I.jsx)(kd,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},nv=e=>{let t=F(11),{children:n}=e,r=q(wo(hv)),i=r.length,a=q(gv),o=i===0&&a;if(i===0){if(!o)return null;let e;t[0]===n?e=t[1]:(e=n({part:$_}),t[0]=n,t[1]=e);let r;return t[2]===e?r=t[3]:(r=(0,I.jsx)(jd,{text:``,isRunning:!0,children:e}),t[2]=e,t[3]=r),r}let s;if(t[4]!==n||t[5]!==r){let e;t[7]===n?e=t[8]:(e=(e,t)=>(0,I.jsx)(tv,{index:t,children:e=>n(e)??(0,I.jsx)(Q_,{})},e),t[7]=n,t[8]=e),s=r.map(e),t[4]=n,t[5]=r,t[6]=s}else s=t[6];let c;return t[9]===s?c=t[10]:(c=(0,I.jsx)(I.Fragment,{children:s}),t[9]=s,t[10]=c),c},rv=e=>{let t=F(5),{components:n,unstable_showEmptyOnNonTextEnd:r,children:i}=e,a=r===void 0||r;if(i){let e;return t[0]===i?e=t[1]:(e=(0,I.jsx)(nv,{children:i}),t[0]=i,t[1]=e),e}let o;return t[2]!==n||t[3]!==a?(o=(0,I.jsx)(iv,{components:n,unstable_showEmptyOnNonTextEnd:a}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o};rv.displayName=`MessagePrimitive.Parts`;var iv=e=>{let t=F(18),{components:n,unstable_showEmptyOnNonTextEnd:r}=e,i=q(_v),{ranges:a,partIds:o}=I_(!!n?.ChainOfThought),s;bb0:{if(i===0){let e;t[0]===n?e=t[1]:(e=(0,I.jsx)(K_,{components:n}),t[0]=n,t[1]=e),s=e;break bb0}let e;if(t[2]!==n||t[3]!==a||t[4]!==o){let r;t[6]!==n||t[7]!==o?(r=e=>{if(e.type===`single`)return(0,I.jsx)(H_,{index:e.index,components:n},o[e.index]);let t=JSON.stringify([e.type,e.idKey??e.startIndex]);if(e.type===`chainOfThoughtGroup`){let r=n?.ChainOfThought;return r?(0,I.jsx)(Bd,{startIndex:e.startIndex,endIndex:e.endIndex,children:(0,I.jsx)(r,{})},t):null}if(e.type===`toolGroup`){let r=n?.ToolGroup??B_.ToolGroup;return(0,I.jsx)(r,{startIndex:e.startIndex,endIndex:e.endIndex,children:Array.from({length:e.endIndex-e.startIndex+1},(t,r)=>{let i=e.startIndex+r;return(0,I.jsx)(H_,{index:i,components:n},o[i])})},t)}{let r=n?.ReasoningGroup??B_.ReasoningGroup;return(0,I.jsx)(r,{startIndex:e.startIndex,endIndex:e.endIndex,children:Array.from({length:e.endIndex-e.startIndex+1},(t,r)=>{let i=e.startIndex+r;return(0,I.jsx)(H_,{index:i,components:n},o[i])})},t)}},t[6]=n,t[7]=o,t[8]=r):r=t[8],e=a.map(r),t[2]=n,t[3]=a,t[4]=o,t[5]=e}else e=t[5];s=e}let c=s,l;t[9]===n?l=t[10]:(l=n?.Quote&&(0,I.jsx)(J_,{Quote:n.Quote}),t[9]=n,t[10]=l);let u;t[11]!==n||t[12]!==r?(u=(0,I.jsx)(q_,{components:n,enabled:r}),t[11]=n,t[12]=r,t[13]=u):u=t[13];let d;return t[14]!==c||t[15]!==l||t[16]!==u?(d=(0,I.jsxs)(I.Fragment,{children:[l,c,u]}),t[14]=c,t[15]=l,t[16]=u,t[17]=d):d=t[17],d};function av(e){return e.type}function ov(e){return e.message.parts.map(av)}function sv(e){return Us(e.message.parts)}function cv(e){return e.part}function lv(e){return e.message.status??W_}function uv(e){return e.part}function dv(e){return e.part.type===`tool-call`?Y_(e.tools,e.part):null}function fv(e){return e.part}function pv(e){return e.part.type===`data`?R_(e.dataRenderers,e.part.name,void 0)??null:null}function mv(e){return e.part.type}function hv(e){return Us(e.message.parts)}function gv(e){return(e.message.status?.type??`complete`)===`running`}function _v(e){return e.message.parts.length}var vv=Symbol.for(`@assistant-ui/groupBy.memoKey`),yv=e=>{let t=e.nextChildIdx++;return e.nodeKey===``?String(t):`${e.nodeKey}.${t}`},bv=(e,t)=>{if(!(t===void 0||e.claimed.has(t)))return e.claimed.add(t),`id:${t}`},xv=(e,t)=>{let n={key:``,nodeKey:``,indices:[],children:[],nextChildIdx:0,claimed:new Set},r=[n],i=()=>{let e=r.pop(),n=r[r.length-1],i=t?.[e.indices[0]];n.children.push({type:`group`,key:e.key,nodeKey:e.nodeKey,idKey:bv(n,i?.includes(`:`)?i:void 0),indices:e.indices,children:e.children})};for(let n=0;n<e.length;n++){let a=e[n],o=0;for(;o<r.length-1&&o<a.length&&r[o+1].key===a[o];)o++;for(;r.length-1>o;)i();for(;r.length-1<a.length;){let e=r[r.length-1];r.push({key:a[r.length-1],nodeKey:yv(e),indices:[],children:[],nextChildIdx:0,claimed:new Set})}let s=r[r.length-1];s.children.push({type:`part`,index:n,nodeKey:yv(s),idKey:bv(s,t?.[n])});for(let e=1;e<r.length;e++)r[e].indices.push(n)}for(;r.length>1;)i();return n.children},Sv=(e,t,n)=>{if(!n)return!1;switch(e){case`never`:return!1;case`always`:return!0;case`empty`:return t.length===0;case`no-text`:{let e=t[t.length-1];return e===void 0||e.type!==`text`&&e.type!==`reasoning`}}},Cv=()=>{throw Error("MessagePrimitive.GroupedParts: rendered `children` under a leaf part. `children` is only meaningful for `group-…` cases — add a matching case for the part type or return `null` to use registered UIs.")},wv=(e,t,n)=>{if(e.type===`part`)return(0,I.jsx)(tv,{index:e.index,children:({part:e})=>n({part:e,children:(0,I.jsx)(Cv,{})})??(0,I.jsx)(Q_,{})},e.idKey?`part-${e.idKey}`:`part-${e.index}`);let{status:r,counts:i,timing:a}=Ld(t,e.indices),o={type:e.key,status:r,counts:i,indices:e.indices,...a&&{timing:a}};return(0,I.jsx)(Qr,{children:n({part:o,children:(0,I.jsx)(I.Fragment,{children:e.children.map(e=>wv(e,t,n))})})},JSON.stringify([e.key,e.idKey??e.nodeKey]))},Tv=({groupBy:e,indicator:t=`no-text`,children:n})=>{let r=q(wo(e=>e.message.parts)),i=q(e=>e.tools.toolUIs),a=q(e=>t!==`never`&&e.message.status?.type===`running`),o=Hr(()=>{let t={toolUIs:i};return xv(r.map(n=>e(n,t)??[]),Us(r))},[r,e[vv]??e,i]);return(0,I.jsxs)(I.Fragment,{children:[o.map(e=>wv(e,r,n)),Sv(t,r,a)&&n({part:{type:`indicator`},children:(0,I.jsx)(Cv,{})})]})};Tv.displayName=`MessagePrimitive.GroupedParts`;var Ev=new WeakMap,Dv=e=>Ev.get(e);Object.freeze([]);var Ov=e=>e.length===1?{type:`part`,index:e[0],nodeKey:`0`,idKey:void 0}:{type:`group`,key:`group-row`,nodeKey:`0`,idKey:void 0,indices:e,children:e.map((e,t)=>({type:`part`,index:e,nodeKey:`0.${t}`,idKey:void 0}))},kv=e=>{let t=F(7),{row:n,children:r}=e,i=q(wo(Nv));if(n.indices.some(e=>e>=i.length))return null;let a;if(t[0]!==r||t[1]!==i||t[2]!==n){let e=Dv(n)??Ov(n.indices),o;t[4]!==r||t[5]!==n?(o=e=>r({type:`part`,row:n,part:e.part,children:e.children}),t[4]=r,t[5]=n,t[6]=o):o=t[6],a=wv(e,i,o),t[0]=r,t[1]=i,t[2]=n,t[3]=a}else a=t[3];return a},Av=({row:e,children:t})=>(0,I.jsx)(Ql,{getItemState:e=>e.message.getState(),children:n=>t({type:`message`,row:e,get message(){return n()}})}),jv=({row:e,children:t})=>(0,I.jsx)(Ql,{getItemState:e=>e.message.getState(),children:n=>t({type:`turn-end`,row:e,get message(){return n()}})}),Mv=Zr(e=>{let t=F(8),{row:n,children:r}=e,i;if(t[0]===n.messageId?i=t[1]:(i=e=>h_(e.thread.messages,n.messageId),t[0]=n.messageId,t[1]=i),!q(i))return null;let a;t[2]!==r||t[3]!==n?(a=n.type===`message`?(0,I.jsx)(Av,{row:n,children:r}):n.type===`part`?(0,I.jsx)(kv,{row:n,children:r}):(0,I.jsx)(jv,{row:n,children:r}),t[2]=r,t[3]=n,t[4]=a):a=t[4];let o;return t[5]!==n.messageId||t[6]!==a?(o=(0,I.jsx)(d_,{id:n.messageId,children:a}),t[5]=n.messageId,t[6]=a,t[7]=o):o=t[7],o},(e,t)=>e.row===t.row&&e.children===t.children);Mv.displayName=`ThreadPrimitive.Row`;function Nv(e){return e.message.parts}var Pv=Zr(e=>{let t=F(5),{children:n}=e,r=q(T_);if(!r)return null;let i;t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,I.jsx)(I.Fragment,{children:i}),t[3]=i,t[4]=a),a});Pv.displayName=`MessagePrimitive.Quote`;var Fv=(e,t)=>{switch(t.type){case`image`:return e?.Image??e?.Attachment;case`document`:return e?.Document??e?.Attachment;case`file`:return e?.File??e?.Attachment;default:return e?.Attachment}},Iv=e=>{let t=F(5),{components:n}=e,r=q(Bv);if(!r)return null;let i;t[0]!==r||t[1]!==n?(i=Fv(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i;if(!a)return null;let o;return t[3]===a?o=t[4]:(o=(0,I.jsx)(a,{}),t[3]=a,t[4]=o),o},Lv=Zr(e=>{let t=F(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,I.jsx)(Iv,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,I.jsx)(Td,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);Lv.displayName=`MessagePrimitive.AttachmentByIndex`;var Rv=({children:e})=>{let t=q(wo(e=>e.message.role===`user`?(e.message.submission?.attachments??e.message.attachments??[]).map(e=>e.id):[]));return Hr(()=>t.map((t,n)=>(0,I.jsx)(Td,{index:n,children:(0,I.jsx)(Ql,{getItemState:e=>e.message.attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},t)),[t,e])},zv=e=>{let t=F(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,I.jsx)(Rv,{children:e=>{let{attachment:t}=e,r=Fv(n,t);return r?(0,I.jsx)(r,{}):null}}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,I.jsx)(Rv,{children:r}),t[2]=r,t[3]=i),i};zv.displayName=`MessagePrimitive.Attachments`;function Bv(e){return e.attachment}var Vv=(e,t)=>{switch(t.type){case`image`:return e?.Image??e?.Attachment;case`document`:return e?.Document??e?.Attachment;case`file`:return e?.File??e?.Attachment;default:return e?.Attachment}},Hv=e=>{let t=F(5),{components:n}=e,r=q(Kv);if(!r)return null;let i;t[0]!==r||t[1]!==n?(i=Vv(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i;if(!a)return null;let o;return t[3]===a?o=t[4]:(o=(0,I.jsx)(a,{}),t[3]=a,t[4]=o),o},Uv=Zr(e=>{let t=F(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,I.jsx)(Hv,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,I.jsx)(Ed,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);Uv.displayName=`ComposerPrimitive.AttachmentByIndex`;var Wv=({children:e})=>{let t=q(wo(e=>e.composer.attachments.map(e=>e.id)));return Hr(()=>t.map((t,n)=>(0,I.jsx)(Ed,{index:n,children:(0,I.jsx)(Ql,{getItemState:e=>e.composer.attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},t)),[t,e])},Gv=e=>{let t=F(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,I.jsx)(Wv,{children:e=>{let{attachment:t}=e,r=Vv(n,t);return r?(0,I.jsx)(r,{}):null}}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,I.jsx)(Wv,{children:r}),t[2]=r,t[3]=i),i};Gv.displayName=`ComposerPrimitive.Attachments`;function Kv(e){return e.attachment}var qv=Zr(({children:e})=>{let t=q(wo(e=>e.composer.queue.map(e=>e.id)));return Hr(()=>t.map((t,n)=>(0,I.jsx)(Wd,{index:n,children:(0,I.jsx)(Ql,{getItemState:e=>e.composer.queueItem({index:n}).getState(),children:t=>e({get queueItem(){return t()}})})},t)),[t,e])});qv.displayName=`ComposerPrimitive.Queue`;var Jv=Zr(e=>{let t=F(6),{index:n,archived:r,components:i}=e,a=r!==void 0&&r,o=i.ThreadListItem,s;t[0]===o?s=t[1]:(s=(0,I.jsx)(o,{}),t[0]=o,t[1]=s);let c;return t[2]!==a||t[3]!==n||t[4]!==s?(c=(0,I.jsx)(Hd,{index:n,archived:a,children:s}),t[2]=a,t[3]=n,t[4]=s,t[5]=c):c=t[5],c},(e,t)=>e.index===t.index&&e.archived===t.archived&&e.components.ThreadListItem===t.components.ThreadListItem);Jv.displayName=`ThreadListPrimitive.ItemByIndex`;var Yv=({archived:e,children:t})=>{let n=q(wo(t=>e?t.threads.archivedThreadIds:t.threads.threadIds));return Hr(()=>n.map((n,r)=>(0,I.jsx)(Hd,{index:r,archived:e,children:(0,I.jsx)(Ql,{getItemState:t=>t.threads.item({index:r,archived:e}).getState(),children:e=>t({get threadListItem(){return e()}})})},n)),[n,e,t])},Xv=e=>{let t=F(8),{archived:n,components:r,children:i}=e,a=n!==void 0&&n;if(r){let e=r.ThreadListItem,n;t[0]===e?n=t[1]:(n=()=>(0,I.jsx)(e,{}),t[0]=e,t[1]=n);let i;return t[2]!==a||t[3]!==n?(i=(0,I.jsx)(Yv,{archived:a,children:n}),t[2]=a,t[3]=n,t[4]=i):i=t[4],i}let o;return t[5]!==a||t[6]!==i?(o=(0,I.jsx)(Yv,{archived:a,children:i}),t[5]=a,t[6]=i,t[7]=o):o=t[7],o};Xv.displayName=`ThreadListPrimitive.Items`;var Zv=e=>{let{children:t}=e;return q(Qv)?t:null};Zv.displayName=`MessagePartPrimitive.InProgress`;function Qv(e){return e.part.status.type===`running`}var $v=e=>{let t=F(2),{fallback:n}=e,r=q(ey)||n,i;return t[0]===r?i=t[1]:(i=(0,I.jsx)(I.Fragment,{children:r}),t[0]=r,t[1]=i),i};$v.displayName=`ThreadListItemPrimitive.Title`;function ey(e){return e.threadListItem.title}var ty=e=>{let t=new Map;return e.map(e=>{let n=JSON.stringify([e.title,e.label,e.prompt]),r=t.get(n)??0;return t.set(n,r+1),r===0?n:`${n}:${r}`})},ny=e=>{let t=F(2),{components:n}=e,r=n.Suggestion,i;return t[0]===r?i=t[1]:(i=(0,I.jsx)(r,{}),t[0]=r,t[1]=i),i},ry=Zr(e=>{let t=F(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,I.jsx)(ny,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,I.jsx)(Ud,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);ry.displayName=`ThreadPrimitive.SuggestionByIndex`;var iy=({children:e})=>{let t=q(wo(e=>ty(e.suggestions.suggestions)));return Hr(()=>t.length===0?null:t.map((t,n)=>(0,I.jsx)(Ud,{index:n,children:(0,I.jsx)(Ql,{getItemState:e=>e.suggestions.suggestion({index:n}).getState(),children:t=>e({get suggestion(){return t()}})})},t)),[t,e])},ay=e=>{let t=F(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,I.jsx)(iy,{children:()=>(0,I.jsx)(ny,{components:n})}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,I.jsx)(iy,{children:r}),t[2]=r,t[3]=i),i};ay.displayName=`ThreadPrimitive.Suggestions`;var oy=Zr(ay,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion),sy=e=>{let t=F(3),n;return t[0]!==e.dictation||t[1]!==e.editing?(n=t=>{if(e.editing===!0&&!t.composer.isEditing||e.editing===!1&&t.composer.isEditing)return!1;let n=t.composer.dictation!=null;return!(e.dictation===!0&&!n||e.dictation===!1&&n)},t[0]=e.dictation,t[1]=e.editing,t[2]=n):n=t[2],q(n)},cy=e=>{let t=F(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),sy(r)?n:null};cy.displayName=`ComposerPrimitive.If`;var ly=e=>!e.composer.canSend||e.thread.isRunning&&!e.thread.capabilities.queue&&e.thread.voice===void 0,uy=e=>!e.composer.canCancel,dy=e=>e.voice===void 0?e.isRunning?e.capabilities.queue?`queued`:`blocked`:`now`:e.voice.canSendText?`now`:`blocked`,fy=(e,t)=>e.thread.isDisabled||t&&dy(e.thread)===`blocked`,py=e=>{if(e.message.status?.type!==`incomplete`||e.message.status.reason!==`error`)return;let t=e.message.status.error;return typeof t==`string`?t:typeof t==`object`&&t&&`message`in t&&typeof t.message==`string`?t.message:t??`An error occurred`},my=e=>!e.threads.hasMore||e.threads.isLoading||e.threads.isLoadingMore,hy=()=>{let e=F(5),t=K(),n=q(ly),r;e[0]===t?r=e[1]:(r=e=>{t.composer.send(e)},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={send:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a},gy=()=>{let e=F(5),t=K(),n=q(uy),r;e[0]===t?r=e[1]:(r=()=>{t.composer.cancel()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==i||e[3]!==n?(a={cancel:i,disabled:n},e[2]=i,e[3]=n,e[4]=a):a=e[4],a},_y=()=>{let e=F(5),t=K(),n=q(vy),r;e[0]===t?r=e[1]:(r=()=>{t.composer.startDictation()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={startDictation:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function vy(e){return e.composer.dictation!=null||!e.thread.capabilities.dictation||!e.composer.isEditing}var yy=()=>{let e=F(5),t=K(),n=q(by),r;e[0]===t?r=e[1]:(r=e=>t.composer.addAttachment(e),e[0]=t,e[1]=r);let i=r,a;return e[2]!==i||e[3]!==n?(a={addAttachment:i,disabled:n},e[2]=i,e[3]=n,e[4]=a):a=e[4],a};function by(e){return!e.composer.isEditing}var xy=e=>{let t=F(10),{prompt:n,send:r,clearComposer:i}=e,a=i===void 0||i,o=K(),s=r??!1,c;t[0]===s?c=t[1]:(c=e=>fy(e,s),t[0]=s,t[1]=c);let l=q(c),u;t[2]!==o||t[3]!==a||t[4]!==n||t[5]!==s?(u=()=>{if(s){let e=dy(o.thread.getState());if(e===`blocked`)return;o.thread.append({content:[{type:`text`,text:n}],runConfig:o.composer.getState().runConfig}),a&&e===`now`&&o.composer.setText(``)}else if(a)o.composer.setText(n);else{let e=o.composer.getState().text;o.composer.setText([e,n].filter(Sy).join(` `))}},t[2]=o,t[3]=a,t[4]=n,t[5]=s,t[6]=u):u=t[6];let d=u,f;return t[7]!==l||t[8]!==d?(f={trigger:d,disabled:l},t[7]=l,t[8]=d,t[9]=f):f=t[9],f};function Sy(e){return e.trim()}var Cy=()=>{let e=F(4),t=K(),n;e[0]===t?n=e[1]:(n=()=>{t.threadListItem.archive()},e[0]=t,e[1]=n);let r=n,i;return e[2]===r?i=e[3]:(i={archive:r},e[2]=r,e[3]=i),i},wy=()=>{let e=F(4),t=K(),n;e[0]===t?n=e[1]:(n=()=>{t.threadListItem.delete()},e[0]=t,e[1]=n);let r=n,i;return e[2]===r?i=e[3]:(i={delete:r},e[2]=r,e[3]=i),i},Ty=()=>{let e=F(4),t=K(),n;e[0]===t?n=e[1]:(n=()=>{t.threadListItem.unarchive()},e[0]=t,e[1]=n);let r=n,i;return e[2]===r?i=e[3]:(i={unarchive:r},e[2]=r,e[3]=i),i},Ey=()=>{let e=F(4),t=K(),n;e[0]===t?n=e[1]:(n=()=>{t.threadListItem.switchTo()},e[0]=t,e[1]=n);let r=n,i;return e[2]===r?i=e[3]:(i={switchTo:r},e[2]=r,e[3]=i),i},Dy=()=>{let e=F(4),t=K(),n;e[0]===t?n=e[1]:(n=()=>{t.threads.switchToNewThread()},e[0]=t,e[1]=n);let r=n,i;return e[2]===r?i=e[3]:(i={switchToNewThread:r},e[2]=r,e[3]=i),i},Oy=()=>{let e=F(5),t=K(),n=q(my),r;e[0]===t?r=e[1]:(r=()=>{t.threads.loadMore()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={loadMore:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a},ky=()=>q(py),Ay=async(e,t)=>{let{signal:n,onUpdate:r}=t;if(Symbol.asyncIterator in e)for await(let t of e){if(n.aborted)break;r(t)}else{let t=await e;if(n.aborted)return;r(t)}},jy=e=>{let t=[...e.content,...(e.attachments??[]).flatMap(e=>(e.content??[]).filter(e=>e.type!==`text`))],n=[];for(let e of t)e.type===`file`||e.type===`text`?n.push(e):e.type===`image`&&n.push({type:`file`,data:e.image,mimeType:`image/*`,...e.filename!==void 0&&{filename:e.filename}});return n},My=e=>{let t={queue:$f,steer:$f},n=new Map,r=new Set,i=!1,a=!1,o=!1,s=!1,c=e=>e,l=0,u=0,d=!1,f=0,p=()=>{la(r,void 0,`Message queue`)},m=e=>{t=e,D.items=e.queue,D.steerItems=e.steer,p()},h=(e,t)=>({id:e,prompt:Js(t),parts:jy(t)}),g=(e,r,i=0)=>{o=!0,n.set(r.id,r.message),m({...t,[e]:[...t[e].slice(0,i),r.item,...t[e].slice(i)]})},_=e=>{if(t.steer.some(t=>t.id===e))return`steer`;if(t.queue.some(t=>t.id===e))return`queue`},v=()=>{if(i||o||s)return;let r=t.steer.length>0?`steer`:`queue`,l=t[r][0];if(!l)return;let u=n.get(l.id);if(!u)return;i=!0,n.delete(l.id),a=!0,m({...t,[r]:t[r].slice(1)}),a=!1;let d={id:l.id,item:l,message:u},p=f;try{e.run(c(u),{steer:!1})}catch(e){throw f===p&&(i=!1,g(r,d)),e}},y=(t,n=`steer`,r=0)=>{o=!1,l+=Math.max(u,1),u=0;let a=(e=!1)=>{if(e)return;let a=l;l=Math.max(a-1,0),u=+(a>0),i=a>0,g(n,t,r)};d=!0;try{e.cancel()}catch(e){throw a(),e}finally{d=!1}i=!0;let s=f;try{e.run(c(t.message),{steer:!0})}catch(e){throw a(f!==s),e}},b=(e,r)=>{o=!1;let i=Ac();n.set(i,r),m({...t,[e]:[...t[e],h(i,r)]}),v()},x=e=>{b(`queue`,e)},S=t=>{if(i&&!a&&e.cancel){let e=Ac();y({id:e,item:h(e,t),message:t});return}b(`steer`,t)},C=(r,o)=>{let s=_(r);if(!s)throw Error(`Unknown queue item "${r}".`);let c=o.lane??s,l=t[s].findIndex(e=>e.id===r),u=t[s][l],d=(c===s?t[s]:t[c]).filter(e=>e.id!==r),f=e=>{if(e===r)throw Error(`Queue item "${r}" cannot anchor itself.`);let t=d.findIndex(t=>t.id===e);if(t===-1)throw Error(`Unknown anchor "${e}" in lane "${c}".`);return t},{insertAfter:p,insertBefore:h}=o,g;if(p===void 0&&h===void 0)g=c===s?t[s].findIndex(e=>e.id===r):d.length;else if(p!==void 0&&h!==void 0){let e=p===null?-1:f(p);if((h===null?d.length:f(h))!==e+1)throw Error(`insertAfter "${p}" and insertBefore "${h}" are not adjacent in lane "${c}".`);g=e+1}else g=p===void 0?h===null?d.length:f(h):p===null?0:f(p)+1;if(p===void 0&&h===void 0&&c===`steer`&&s!==`steer`&&i&&!a&&e.cancel){let e=n.get(r);n.delete(r),m({queue:t.queue.filter(e=>e.id!==r),steer:t.steer}),y({id:r,item:u,message:e},s,l);return}let b=[...d.slice(0,g),u,...d.slice(g)],x={...t,[c]:b};c!==s&&(x[s]=t[s].filter(e=>e.id!==r)),m(x),v()},w=(e,r)=>{let i=_(e);if(!i)throw Error(`Unknown queue item "${e}".`);n.set(e,r),m({...t,[i]:t[i].map(t=>t.id===e?h(e,r):t)})},T=e=>{n.delete(e)&&m({queue:t.queue.filter(t=>t.id!==e),steer:t.steer.filter(t=>t.id!==e)})},E=()=>{d||a||i&&u===0&&(o=!0,u=1)},D={items:t.queue,steerItems:t.steer,enqueue:x,steer:S,move:C,edit:w,remove:T,__internal_setDispatchTransform:e=>{c=e},__internal_notifyCancelled:E};return{adapter:D,hold:()=>{s=!0},release:()=>{s=!1,v()},notifyBusy:()=>{o=!1,l+=u,u=0,i=!0,f++},notifyIdle:()=>{if(l>0){l--;return}u>0&&u--,i=!1,v()},notifyCancelled:E,clear:()=>{n.clear(),m({queue:$f,steer:$f})},subscribe:e=>(r.add(e),()=>{r.delete(e)})}},Ny=(e,t)=>e.status?.type!==`requires-action`||e.status.reason!==`tool-calls`||e.content.some(e=>e.type===`tool-call`&&e.result===void 0&&e.approval!==void 0&&e.approval.approved===void 0&&e.approval.resolution===void 0)?!1:t===void 0?e.content.every(e=>e.type!==`tool-call`||e.result!==void 0||e.approval!==void 0):e.content.every(e=>e.type!==`tool-call`||e.result!==void 0||e.approval!==void 0||!t.includes(e.toolName)),Py=class extends Error{name=`AbortError`;detach;constructor(e,t){super(t),this.detach=e}},Fy=e=>e.role!==`assistant`||e.status.type!==`requires-action`||e.status.reason!==`interrupt`||e.content.some(e=>e.type===`tool-call`&&e.result===void 0&&e.interrupt!=null)?e:{...e,status:Cd(!1,!1,!1,e.content.some(e=>e.type===`tool-call`&&e.result===void 0))},Iy=e=>{let t=!1,n=e.content.map(e=>e.type!==`tool-call`||e.approval===void 0||e.approval.approved!==void 0||e.approval.resolution!==void 0?e:(t=!0,{...e,approval:{...e.approval,resolution:`cancelled`}})),r=e.status.type===`running`||e.status.type===`requires-action`;return!t&&!r?e:{...e,content:n,status:r?{type:`incomplete`,reason:`cancelled`}:e.status}},Ly=e=>{let t=new Set(e.messages.map(e=>e.parentId));return{...e,messages:e.messages.map(e=>({...e,message:e.message.role===`assistant`&&t.has(e.message.id)?Iy(e.message):Fy(e.message)}))}},Ry=e=>{if(e.role!==`assistant`)return e;let t=!1,n=e.content.map(e=>{if(e.type!==`tool-call`)return e;let n=e.messages?.map(Ry),r=n?.some((t,n)=>t!==e.messages?.[n]);if(e.unstable_interactions===void 0&&r!==!0)return e;t=!0;let{unstable_interactions:i,...a}=e;return r?{...a,messages:n}:a});return t?{...e,content:n}:e},zy=class extends vp{capabilities={switchToBranch:!0,switchBranchDuringRun:!0,edit:!0,delete:!1,reload:!0,refetchThread:!1,cancel:!0,unstable_copy:!0,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1,answerToolCall:!0};abortController=null;_queue=null;_queueRunInFlight=null;_activeRun=null;_runGeneration=0;_messageReplacements=new WeakMap;_historyWrites=new Map;async _writeHistory(e,t,n){try{await n()}catch(n){throw console.error(`[assistant-ui] local thread history write failed:`,n),this._notifyEventSubscribers(`historyWriteError`,{operation:e,messageIds:t,message:n instanceof Error?n.message:String(n),error:n}),n}}_deletedMessages=new Map;_chainHistoryWrite(e,t){let n=this._deletedMessages.get(e);if(n)return n.suppressed?.push(t),Promise.resolve();let r=this._historyWrites.get(e),i;if(r)i=r.then(t,t);else try{i=Promise.resolve(t())}catch(e){i=Promise.reject(e)}let a=i.then(()=>{},()=>{});return this._historyWrites.set(e,a),a.then(()=>{this._historyWrites.get(e)===a&&this._historyWrites.delete(e)}),i}_persistMessageUpdate(e){let t=this._options.adapters.history;if(!t)return;let n;try{n=this.repository.getMessage(e)}catch{return}let{parentId:r,message:i}=n;i.role===`assistant`&&i.status.type!==`running`&&(this._unwrittenMessages.has(i.id)&&!t.update&&i.status.type===`requires-action`||this._persistSettled(r,i)?.catch(()=>{}))}_roundtripsInFlight=new Map;_followedDuringRun=new Set;_unwrittenMessages=new Set;_persistSettled(e,t){let n=this._options.adapters.history;if(!n)return;let r=this._unwrittenMessages.delete(t.id)?`append`:`update`,i=r===`append`?n.append:n.update;if(!i)return;let a={parentId:e,message:t,runConfig:this._lastRunConfig};return this._chainHistoryWrite(t.id,()=>this._writeHistory(r,[t.id],()=>i.call(n,a)))}_cancelPause(e){if(e===null)return;let t;try{t=this.repository.getMessage(e)}catch{return}if(t.message.role!==`assistant`)return;if(this._roundtripsInFlight.has(e)){this._followedDuringRun.add(e);let n=Iy(t.message),r=this._options.adapters.history;if(r&&!r.update&&this._roundtripsInFlight.get(e)?.resumedFromPause&&!this._unwrittenMessages.has(e)){let i={parentId:t.parentId,message:n,runConfig:this._lastRunConfig};return this._chainHistoryWrite(e,()=>this._writeHistory(`append`,[e],()=>r.append(i)))}return this._persistSettled(t.parentId,n)}let n=Iy(t.message);if(n!==t.message)return this.repository.addOrUpdateMessage(t.parentId,n),this._persistSettled(t.parentId,n)}_resumeIfReady(e){let t=this.getMessageById(e);return t?.message.role!==`assistant`||this.repository.hasChildren(e)||this._followedDuringRun.has(e)||!Ny(t.message,this._options.unstable_humanToolNames)?!1:(this._runLoop(t.parentId,t.message,this._lastRunConfig).catch(()=>{}),!0)}isDisabled=!1;isSendDisabled=!1;_isLoading=!1;get isLoading(){return this._isLoading}_suggestions=[];_suggestionsController=null;get suggestions(){return this._suggestions}get adapters(){return this._options.adapters}constructor(e,t){super(e),this.__internal_setOptions(t)}_options;_lastRunConfig={};_getThreadId;__internal_setGetThreadId(e){this._getThreadId=e}_getInitializePromise;__internal_setGetInitializePromise(e){this._getInitializePromise=e}get extras(){}__internal_setOptions(e){if(this._options===e)return;let t=this._options?.adapters.history;if(this._options=e,!e.adapters.voice&&this.voice)try{this.disconnectVoice()}catch(e){console.error(`[assistant-ui] Voice cleanup threw after the adapter changed`,e)}let n=!1;e.adapters.suggestion||(this._suggestionsController?.abort(),this._suggestionsController=null,this._suggestions.length>0&&(this._suggestions=[],n=!0));let r=e.adapters?.speech!==void 0;this.capabilities.speech!==r&&(this.capabilities.speech=r,n=!0);let i=e.adapters?.dictation!==void 0;this.capabilities.dictation!==i&&(this.capabilities.dictation=i,n=!0);let a=e.adapters?.voice!==void 0;this.capabilities.voice!==a&&(this.capabilities.voice=a,n=!0);let o=e.adapters?.attachments!==void 0;this.capabilities.attachments!==o&&(this.capabilities.attachments=o,n=!0);let s=e.adapters?.feedback!==void 0;this.capabilities.feedback!==s&&(this.capabilities.feedback=s,n=!0);let c=e.adapters?.history?.delete!==void 0;this.capabilities.delete!==c&&(this.capabilities.delete=c,n=!0);let l=e.unstable_enableMessageQueue===!0;l&&!this._queue?(this._queue=My({run:e=>{let t={};this._queueRunInFlight=t;let n=this._runGeneration;this._runAppend({...e,parentId:this._resolveAppendParent(this.messages.at(-1)?.id??null)}).finally(()=>{this._queueRunInFlight===t&&(this._queueRunInFlight=null,this._runGeneration===n&&this._queue?.notifyIdle())}).catch(()=>{})}}),this.voice&&this._queue.hold(),this._queue.subscribe(()=>this._notifySubscribers())):!l&&this._queue&&(this._queue=null),this.capabilities.queue!==l&&(this.capabilities.queue=l,n=!0),n&&this._notifySubscribers(),this._loadRequested&&!this._loadPromise&&!t&&e.adapters.history&&this.messages.length===0&&this.__internal_load().catch(e=>{console.error(`[assistant-ui] local thread history load failed:`,e)})}_loadPromise;_loadRequested=!1;__internal_load(){if(this._loadRequested=!0,this._loadPromise)return this._loadPromise;if(!this.adapters.history)return Promise.resolve();let e=this.adapters.history.load();return this._isLoading=!0,this._loadPromise=e.then(e=>{if(!e)return;let{repository:t,droppedIds:n}=Xf(e);n.length>0&&console.warn(`[assistant-ui] Skipped history messages with missing parents:`,n),e.headId!=null&&!e.messages.some(t=>t.message.id===e.headId)&&console.warn(`[assistant-ui] History head is not among the loaded messages:`,e.headId),this.repository.import(Ly(t)),t.messages.length>0&&this.ensureInitialized(),this._notifySubscribers();let r=this.adapters.history?.resume?.bind(this.adapters.history);e.unstable_resume&&r&&this.startRun({parentId:this.repository.headId,sourceId:this.repository.headId,runConfig:this._lastRunConfig},r).catch(()=>{})}).finally(()=>{this._isLoading=!1,this._notifySubscribers()}),this._notifySubscribers(),this._loadPromise}_getHistoryLoadBarrier(){if(!(!this._isLoading||!this._loadPromise))return this._loadPromise.catch(()=>{})}async append(e){if(e={...e,parentId:this._resolveAppendParent(e.parentId)},this.voice)return this._appendToVoiceSession(e);if(this._isVoiceMessage(e.sourceId))throw Error(`Voice transcript messages cannot be edited`);let t=e.parentId===(this.messages.at(-1)?.id??null),n=e.startRun??e.role===`user`;if(this._queue&&n&&t){e.steer??this._queueRunInFlight!==null?this._queue.adapter.steer(e):this._queue.adapter.enqueue(e);return}return this._queue&&!t&&(this._options.unstable_queueClearOnRewind??!0)&&this._queue.clear(),this._runAppend(e)}_commitVoiceMessage(e){let t=jf(this),n=n=>{if(t.aborted){this._dropVoiceMessage(e.id,n);return}let r=this.repository.headId;this.repository.addOrUpdateMessage(r,e);let i=this._cancelPause(r);this.repository.resetHead(e.id);let a=this._options.adapters.history,o=a?this._chainHistoryWrite(e.id,()=>this._writeHistory(`append`,[e.id],()=>a.append({parentId:r,message:e}))):void 0;return o?.catch(()=>{}),this._dropVoiceMessage(e.id,!1),n&&this._notifySubscribers(),i?Promise.all([i,o]).then(()=>{}):o},r=this._getVoiceCommitBarrier();return r?r.then(()=>n(!0)):n(!1)}_onVoiceConnected(){this._queue?.hold()}_onVoiceDisconnected(){this._queue?.release()}getQueueItems(){return this._queue?.adapter.items??$f}getSteerQueueItems(){return this._queue?.adapter.steerItems??$f}moveQueueItem(e,t){this._queue?.adapter.move(e,t)}removeQueueItem(e){this._queue?.adapter.remove(e)}_rollbackAppend(e){try{this.repository.deleteMessage(e)}catch{return}this._notifySubscribers()}_pendingAppends=0;_isRunActive(){return this._pendingAppends>0||super._isRunActive()}async _runAppend(e){this._pendingAppends+=1;try{await this._runAppendInner(e)}finally{--this._pendingAppends}}async _runAppendInner(e){let t=jf(this),n=this._getHistoryLoadBarrier();if(n){let r=e.parentId===(this.messages.at(-1)?.id??null);if(await n,t.aborted)return;r&&(e={...e,parentId:this._resolveAppendParent(this.messages.at(-1)?.id??null)})}let r=this.enrichAppendMetadata(e);this.ensureInitialized();let i=bl(r,Ac(),{type:`complete`,reason:`unknown`});this.repository.addOrUpdateMessage(r.parentId,i),this._notifySubscribers();try{let e=this._getInitializePromise?.();e&&await e}catch(e){if(this._rollbackAppend(i.id),t.aborted)return;r.parentId!==null&&this._resumeIfReady(r.parentId);let n=new Yd;throw n.cause=e,n}if(t.aborted){this._rollbackAppend(i.id);return}let a=this._cancelPause(r.parentId),o=this._options.adapters.history,s=o?this._chainHistoryWrite(i.id,()=>this._writeHistory(`append`,[i.id],()=>o.append({parentId:r.parentId,message:i,...r.runConfig!==void 0&&{runConfig:r.runConfig}}))):void 0,c=a?Promise.all([a,s]).then(()=>{}):s;if(c?.catch(()=>{}),r.startRun??r.role===`user`){let[e,t]=await Promise.allSettled([this.startRun({parentId:i.id,sourceId:r.sourceId,runConfig:r.runConfig??{}}),c]);if(e.status===`rejected`)throw e.reason;if(t.status===`rejected`)throw t.reason}else this.repository.switchToBranch(i.id),this._notifySubscribers(),await c}async deleteMessage(e){let t=this._options.adapters.history;if(!t?.delete)throw Error(`Runtime does not support deleting messages.`);let n=this.repository.getMessages(),r=n.findIndex(t=>t.id===e);if(r===-1)throw Error(`Message not found.`);let i=this._deletedMessages.get(e);if(i?.suppressed&&i.deletion)return i.deletion;let a=t.delete.bind(t),o=e=>this._writeHistory(`delete`,e.map(e=>e.message.id),()=>a(e)),s=n[r],c=[{parentId:n[r-1]?.id??null,message:s}],l=this._historyWrites.get(e),u={suppressed:[]};return this._deletedMessages.set(e,u),u.deletion=(async()=>{try{await o(c)}catch(t){let n=u.suppressed??[];if(u.suppressed=null,this._deletedMessages.get(e)===u){this._deletedMessages.delete(e);for(let t of n)this._chainHistoryWrite(e,t).catch(()=>{})}throw t}u.suppressed=null,l?.then(()=>this._deletedMessages.get(e)===u?o(c):void 0).catch(()=>{}),this.repository.deleteMessage(e),this._notifySubscribers()})(),u.deletion}resumeRun({stream:e,...t}){if(!e)throw Error(`You must pass a stream parameter to resume runs.`);return this.startRun(t,e)}exportExternalState(){throw Error(`Runtime does not support exporting external states.`)}import(e){this._roundtripsInFlight.clear(),this._followedDuringRun.clear(),this._unwrittenMessages.clear(),this._deletedMessages.clear(),super.import(Ly(e))}importExternalState(){throw Error(`Runtime does not support importing external states.`)}unstable_notifySessionReset(){throw Error(`Runtime does not support resetting sessions.`)}async startRun({parentId:e,sourceId:t,runConfig:n},r){if(this.ensureInitialized(),this.voice)throw Error(`Cannot start a run while a voice session is connected`);if(this._isVoiceMessage(t))throw Error(`Voice transcript messages cannot be reloaded`);let i=this._cancelPause(e),a=Ac(),o={id:a,role:`assistant`,status:{type:`running`},content:[],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],custom:{}},createdAt:new Date};this._unwrittenMessages.add(a);let s=this._runLoop(e,o,n,r);if(!i)return s;let[c,l]=await Promise.allSettled([s,i]);if(c.status===`rejected`)throw c.reason;if(l.status===`rejected`)throw l.reason}async _runLoop(e,t,n,r){if(this.voice)throw Error(`Cannot start a run while a voice session is connected`);this._notifyEventSubscribers(`runStart`,{});let i={cancelled:!1,resumedFromPause:t.status.type===`requires-action`};this._activeRun=i,this._runGeneration++;let a=!1;try{this._queue?.notifyBusy(),this._suggestions=[],this._suggestionsController?.abort(),this._suggestionsController=null,this._notifySubscribers();do{if(t=await this.performRoundtrip(e,t,n,i,r),r=void 0,this._activeRun!==i)break;let a=this._messageReplacements.get(t);for(;a;)t=a.message,a=this._messageReplacements.get(t);if(this.getMessageById(t.id)?.message!==t)break}while(Ny(t,this._options.unstable_humanToolNames)&&!this.repository.hasChildren(t.id))}finally{this._notifyEventSubscribers(`runEnd`,{}),a=this._activeRun===i,a&&(this._activeRun=null),(a||i.cancelled)&&queueMicrotask(()=>this._queue?.notifyIdle())}if(a&&this.adapters.suggestion&&t.status?.type!==`requires-action`){this._suggestionsController=new AbortController;let e=this._suggestionsController.signal,t=this.adapters.suggestion;(async()=>{try{await Ay(t.generate({messages:this.messages,signal:e}),{signal:e,onUpdate:e=>{this._suggestions=e,this._notifySubscribers()}})}catch{}})()}}async performRoundtrip(e,t,n,r,i){let a=(e?this.repository.getMessages(e):[]).map(e=>Ry(e.role===`assistant`&&(e.status.type===`running`||this._roundtripsInFlight.has(e.id))?Iy(e):e));this.abortController?.abort();let o=new AbortController;this.abortController=o;let s=t.content,c=t.metadata?.unstable_annotations,l=t.metadata?.unstable_data,u=t.metadata?.steps,d=t.metadata?.custom,f=new Set,p=!0;try{this.repository.getMessage(t.id)}catch{p=!1}let m=()=>{if(!p)return this._activeRun===r;try{let e=t,n=this._messageReplacements.get(e);for(;n;)n.toolCallId!==void 0&&f.add(n.toolCallId),e=n.message,n=this._messageReplacements.get(e);return this.repository.getMessage(t.id).message===e&&(t=e,!0)}catch{return!1}},h=e=>{let n=new Map;for(let e of t.content)e.type===`tool-call`&&e.unstable_interactions!==void 0&&n.set(e.toolCallId,e.unstable_interactions);let r=e.map(e=>{if(e.type!==`tool-call`||e.unstable_interactions!==void 0)return e;let t=n.get(e.toolCallId);return t===void 0?e:{...e,unstable_interactions:t}});if(f.size===0)return r;let i=new Map;for(let e of t.content){if(e.type!==`tool-call`||!f.has(e.toolCallId))continue;let t=i.get(e.toolCallId)??[];t.push(e),i.set(e.toolCallId,t)}let a=new Map;return r.map(e=>{if(e.type!==`tool-call`)return e;let t=a.get(e.toolCallId)??0;if(a.set(e.toolCallId,t+1),e.result!==void 0&&e.isPreliminary!==!0)return e;let n=i.get(e.toolCallId)?.[t];if(!n||n.result===void 0||n.isPreliminary===!0)return e;let{isPreliminary:r,artifact:o,modelContent:s,...c}=e;return{...c,result:n.result,isError:n.isError,...n.artifact!==void 0&&{artifact:n.artifact},...n.modelContent!==void 0&&{modelContent:n.modelContent}}})},g=n=>{if(!m())return;let r=n.metadata?.steps,i=r?[...u??[],...r]:void 0,a=n.metadata?.unstable_annotations,o=n.metadata?.unstable_data,f=a?[...c??[],...a]:void 0,g=o?[...l??[],...o]:void 0,_=n.content?h([...s,...n.content]):void 0;t={...t,..._?{content:_}:void 0,status:n.status??t.status,...n.metadata?{metadata:{...t.metadata,...n.metadata.unstable_state===void 0?void 0:{unstable_state:n.metadata.unstable_state},...f?{unstable_annotations:f}:void 0,...g?{unstable_data:g}:void 0,...i?{steps:i}:void 0,...n.metadata?.timing?{timing:n.metadata.timing}:void 0,...n.metadata?.custom?{custom:{...d??{},...n.metadata.custom}}:void 0}}:void 0},this.repository.addOrUpdateMessage(e,t),p=!0,this._notifySubscribers()},_=this._options.maxSteps??2;this._roundtripsInFlight.set(t.id,{controller:o,resumedFromPause:r.resumedFromPause});try{if((t.metadata?.steps?.length??0)>=_)return g({status:{type:`incomplete`,reason:`tool-calls`}}),t;let s=!p;g({status:{type:`running`}}),s&&(this.repository.switchToBranch(t.id),this._notifySubscribers()),this._lastRunConfig=n??{};let{unstable_composerMetadata:c,...l}=this.getModelContext();i??=this.adapters.chatModel.run.bind(this.adapters.chatModel);let u=o.signal,d=()=>u.aborted&&(t.status.type===`running`||t.status.type===`requires-action`&&(this._activeRun!==r||Ny(t,this._options.unstable_humanToolNames))),f=this._getThreadId?.(),h=i({messages:a,runConfig:this._lastRunConfig,abortSignal:u,context:l,unstable_assistantMessageId:t.id,unstable_threadId:f,unstable_parentId:e,unstable_getMessage(){return m(),Ry(t)}});if(Symbol.asyncIterator in h)for await(let e of h){if(u.aborted){d()&&g({status:{type:`incomplete`,reason:`cancelled`}});break}g(e)}else g(await h);d()?g({status:{type:`incomplete`,reason:`cancelled`}}):t.status.type===`running`&&g({status:{type:`complete`,reason:`unknown`}})}catch(e){if(e instanceof Py)g({status:{type:`incomplete`,reason:`cancelled`}});else if(e instanceof Error&&e.name===`AbortError`)g({status:{type:`incomplete`,reason:`cancelled`}});else throw g({status:{type:`incomplete`,reason:`error`,error:Zd(e)}}),e}finally{this.abortController===o&&(this.abortController=null);let n=this._roundtripsInFlight.get(t.id)?.controller===o;n&&this._roundtripsInFlight.delete(t.id);let i=this._options.adapters.history,a=m(),s=!1,c,l=n&&this._followedDuringRun.delete(t.id);if(l){let e=this.getMessageById(t.id);if(e?.message.role===`assistant`){let n=Iy(e.message);n!==e.message&&(this.repository.addOrUpdateMessage(e.parentId,n),s=!0,a?t=n:c=this._persistSettled(e.parentId,n))}}if(n&&!a&&!c){let e=this.getMessageById(t.id);e?.message.role===`assistant`&&(e.message.status.type===`complete`||e.message.status.type===`incomplete`)&&this._unwrittenMessages.has(t.id)&&(c=this._persistSettled(e.parentId,e.message))}let u=t.status.type===`complete`||t.status.type===`incomplete`,d=t.status.type===`requires-action`&&!Ny(t,this._options.unstable_humanToolNames);if(a&&(u||d&&i?.update)){if(u&&r.resumedFromPause&&!l&&!this._unwrittenMessages.has(t.id)&&i&&!i.update){let n={parentId:e,message:t,runConfig:this._lastRunConfig};c=this._chainHistoryWrite(t.id,()=>this._writeHistory(`append`,[t.id],()=>i.append(n)))}else c=this._persistSettled(e,t)}s&&this._notifySubscribers(),c&&await c}return t}detach(){Ff(this),this._queue=null;let e=new Py(!0);this.abortController?.abort(e),this.abortController=null,this._suggestionsController?.abort(),this._suggestionsController=null}cancelRun(){this._queue&&(this._options.unstable_queueClearOnCancel??!0?this._queue.clear():(this._queue.notifyCancelled(),this._activeRun&&(this._activeRun.cancelled=!0)));let e=new Py(!1);this.abortController?.abort(e),this.abortController=null,this._suggestionsController?.abort(),this._suggestionsController=null}_onMessageMetadataChanged(e,t){this._messageReplacements.set(e,{message:t}),this._persistMessageUpdate(t.id)}addToolResult({messageId:e,toolCallId:t,result:n,isError:r,artifact:i,modelContent:a}){if(this.voice)throw Error(`Cannot add a tool result while a voice session is connected`);let o=this.repository.getMessage(e),{parentId:s}=o,{message:c}=o;if(c.role!==`assistant`)throw Error(`Tried to add tool result to non-assistant message`);let l=!1,u=!1,d=c.content.map(e=>{if(e.type!==`tool-call`||e.toolCallId!==t)return e;u=!0,(e.result===void 0||e.isPreliminary===!0)&&(l=!0);let{isPreliminary:o,...s}=e;return{...s,result:n,isError:r,...i!==void 0&&{artifact:i},...a!==void 0&&{modelContent:a}}});if(!u)throw Error(`Tried to add tool result to non-existing tool call`);let f=c;c={...c,content:d},f.status.type===`running`&&this._messageReplacements.set(f,{message:c,toolCallId:t}),this.repository.addOrUpdateMessage(s,c),this._notifySubscribers(),l&&(this._resumeIfReady(e)||this._persistMessageUpdate(e))}resumeToolCall(e){throw Error(`Local runtime does not support resuming tool calls. For human-in-the-loop tools, list the tool in unstable_humanToolNames and complete the call with addToolResult.`)}async unstable_recordToolInteraction({messageId:e,toolCallId:t,interaction:n}){let r;try{r=this.repository.getMessage(e)}catch{throw Error(`Tried to record a tool interaction on a non-existing message`)}let{parentId:i,message:a}=r;if(a.role!==`assistant`)throw Error(`Tried to record a tool interaction on a non-assistant message`);let o=a.content.findIndex(e=>e.type===`tool-call`&&e.toolCallId===t);if(o===-1)throw Error(`Tried to record a tool interaction on a non-existing tool call`);let s=a.content[o];if(s.type!==`tool-call`)throw Error(`Tried to record a tool interaction on a non-existing tool call`);let c={...a,content:a.content.map((e,t)=>t===o?{...e,unstable_interactions:Bc(s.unstable_interactions,n)}:e)};a.status.type===`running`&&this._messageReplacements.set(a,{message:c}),this.repository.addOrUpdateMessage(i,c),this._notifySubscribers(),this._persistMessageUpdate(c.id)}respondToToolApproval({approvalId:e,approved:t,optionId:n,text:r,answers:i,reason:a}){if(this.voice)throw Error(`Cannot respond to a tool approval while a voice session is connected`);let o=this.repository.getMessages().findLast(t=>t.role===`assistant`&&t.content.some(t=>t.type===`tool-call`&&t.approval?.id===e));if(!o)throw Error(`Tried to respond to a non-existing tool approval`);if(this.abortController!==null)throw Error(`Tried to respond to a tool approval while a run is in progress`);if(o.status?.type!==`requires-action`)throw Error(`Tried to respond to a tool approval on a message whose status is not requires-action`);if(this.repository.hasChildren(o.id))throw Error(`Tried to respond to a tool approval on a message that later messages follow`);if(this._followedDuringRun.has(o.id))throw Error(`Tried to respond to a tool approval that was cancelled or expired`);let s=o.content.find(t=>t.type===`tool-call`&&t.approval?.id===e);if(s?.type!==`tool-call`||!s.approval)throw Error(`Tried to respond to a non-existing tool approval`);if(s.approval.resolution!==void 0)throw Error(`Tried to respond to a tool approval that was cancelled or expired`);if(s.approval.approved!==void 0)throw Error(`Tried to respond to an already decided tool approval`);let c=s.approval,l=o.content.map(e=>{if(e!==s)return e;let o={...c,approved:t,...n!=null&&{optionId:n},...r!=null&&{text:r},...i!=null&&{answers:i},...a!=null&&{reason:a}};return t?{...e,approval:o}:{...e,approval:o,result:{error:a||`Tool approval denied`},isError:!0}});o={...o,content:l};let{parentId:u}=this.repository.getMessage(o.id);this.repository.addOrUpdateMessage(u,o),this._notifySubscribers(),this._notifyToolApprovalAnswered(o.id,s.toolCallId,s.toolName,t);let d=this.getMessageById(o.id);return this.repository.headId===o.id&&d?.message.role===`assistant`&&Ny(d.message,this._options.unstable_humanToolNames)?this._runLoop(d.parentId,d.message,this._lastRunConfig).catch(()=>{}):this._persistMessageUpdate(o.id),Promise.resolve()}},By=Object.freeze([]),Vy=`__DEFAULT_ID__`,Hy=Object.freeze({[Vy]:{id:Vy,remoteId:void 0,externalId:void 0,status:`regular`,title:void 0}}),Uy=class extends cs{_mainThread;constructor(e){super(),this._mainThread=e()}get isLoading(){return!1}getMainThreadRuntimeCore(){return this._mainThread}get newThreadId(){}get threadIds(){return By}get archivedThreadIds(){return By}get mainThreadId(){return Vy}get threadItems(){return Hy}getThreadRuntimeCore(){throw Error(`Method not implemented.`)}getLoadThreadsPromise(){return Promise.resolve()}getItemById(e){if(e===this.mainThreadId)return{status:`regular`,id:this.mainThreadId,remoteId:this.mainThreadId,externalId:void 0,title:void 0,isMain:!0};throw Error(`Method not implemented`)}async switchToThread(){throw Error(`Method not implemented.`)}switchToNewThread(){throw Error(`Method not implemented.`)}rename(){throw Error(`Method not implemented.`)}archive(){throw Error(`Method not implemented.`)}detach(){throw Error(`Method not implemented.`)}unarchive(){throw Error(`Method not implemented.`)}delete(){throw Error(`Method not implemented.`)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error(`Method not implemented.`)}},Wy=class extends Kf{threads;Provider=void 0;_options;constructor(e,t){super(),this._options=e,this.threads=new Uy(()=>new zy(this._contextProvider,this._options)),t&&this.threads.getMainThreadRuntimeCore().import(qf.fromArray(t))}},Gy=()=>()=>{},Ky=(e,t,n)=>{let r=F(40),i,a;r[0]===t?(i=r[1],a=r[2]):({initialMessages:i,...a}=t,r[0]=t,r[1]=i,r[2]=a);let o=ou()??{},s,c;r[3]===o?(s=r[4],c=r[5]):({modelContext:s,...c}=o,r[3]=o,r[4]=s,r[5]=c);let l;r[6]!==e||r[7]!==a.adapters||r[8]!==c?(l={...c,...a.adapters,chatModel:e},r[6]=e,r[7]=a.adapters,r[8]=c,r[9]=l):l=r[9];let u;r[10]!==a||r[11]!==l?(u={...a,adapters:l},r[10]=a,r[11]=l,r[12]=u):u=r[12];let d=u,f;r[13]!==i||r[14]!==n||r[15]!==d?(f=()=>{let e=n===void 0?i:i?.map((e,t)=>({...e,id:e.id??`${n}-message-${t}`,content:typeof e.content==`string`?e.content:e.content.map((e,r)=>e.type===`tool-call`&&!e.toolCallId?{...e,toolCallId:`${n}-tool-${t}-${r}`}:e)}));return new Wy(d,e)},r[13]=i,r[14]=n,r[15]=d,r[16]=f):f=r[16];let[p]=L(f),m=K(),h=R(void 0),g;r[17]!==m||r[18]!==p.threads?(g=()=>{p.threads.getMainThreadRuntimeCore().__internal_setGetThreadId(()=>m.threadListItem.__internal_getRuntime?.().getState().remoteId)},r[17]=m,r[18]=p.threads,r[19]=g):g=r[19];let _;r[20]!==m||r[21]!==p?(_=[m,p],r[20]=m,r[21]=p,r[22]=_):_=r[22],z(g,_);let v;r[23]===p.threads?v=r[24]:(v=()=>()=>{p.threads.getMainThreadRuntimeCore().detach()},r[23]=p.threads,r[24]=v);let y;r[25]===p?y=r[26]:(y=[p],r[25]=p,r[26]=y),ys(v,y);let b;r[27]!==d||r[28]!==p.threads?(b=()=>{p.threads.getMainThreadRuntimeCore().__internal_setOptions(d)},r[27]=d,r[28]=p.threads,r[29]=b):b=r[29],z(b);let x;r[30]===p.threads?x=r[31]:(x=()=>{let e=p.threads.getMainThreadRuntimeCore().__internal_load();h.current!==e&&(h.current=e,e.catch(Yy))},r[30]=p.threads,r[31]=x);let S;r[32]===p?S=r[33]:(S=[p],r[32]=p,r[33]=S),z(x,S);let C,w;r[34]!==s||r[35]!==p?(C=()=>{if(s)return p.registerModelContextProvider(s)},w=[s,p],r[34]=s,r[35]=p,r[36]=C,r[37]=w):(C=r[36],w=r[37]),z(C,w);let T;r[38]===p?T=r[39]:(T=()=>new Gf(p),r[38]=p,r[39]=T);let[E]=L(T);return E},qy=e=>{let{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:a,unstable_enableMessageQueue:o,unstable_queueClearOnRewind:s,unstable_queueClearOnCancel:c,...l}=e;return{localRuntimeOptions:{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:a,unstable_enableMessageQueue:o,unstable_queueClearOnRewind:s,unstable_queueClearOnCancel:c},otherOptions:l}},Jy=(e,{cloud:t,...n}={})=>{let r=Yr(),i=n.initialMessages?.some(e=>e.id===void 0||typeof e.content!=`string`&&e.content.some(e=>e.type===`tool-call`&&!e.toolCallId))??!1,a=Kr(Gy,()=>!1,()=>i);return mm({runtimeHook:function(){return Ky(e,n,a?r:void 0)},adapter:u_({cloud:t}),allowNesting:!0})};function Yy(e){console.error(`[assistant-ui] local thread history load failed:`,e)}function Xy(e,t){function n(n){let r=ii(e);if(!n?.optional&&!r)throw Error(`This component must be used within ${t}.`);return r}return n}function Zy(e,t){function n(n){let r=e(n);return r?r[t]:null}function r(e){let t=!1,r;typeof e==`function`?r=e:e&&typeof e==`object`&&(t=!!e.optional,r=e.selector);let i=n({optional:t});return i?r?i(r):i():null}return{[t]:r,[`${t}Store`]:n}}var Qy=ni(null),{useThreadViewport:$y,useThreadViewportStore:eb}=Zy(Xy(Qy,`ThreadPrimitive.Viewport`),`useThreadViewport`),tb=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},nb=(e=>e?tb(e):tb),rb=e=>e;function ib(e,t=rb){let n=u.useSyncExternalStore(e.subscribe,u.useCallback(()=>t(e.getState()),[e,t]),u.useCallback(()=>t(e.getInitialState()),[e,t]));return u.useDebugValue(n),n}var ab=e=>{let t=nb(e),n=e=>ib(t,e);return Object.assign(n,t),n},ob=(e=>e?ab(e):ab),sb=e=>{let t=new Map,n=()=>{let n=0;for(let e of t.values())n+=e;e(n)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:r=>{t.get(e)!==r&&(t.set(e,r),n())},unregister:()=>{t.delete(e),n()}}}}},cb=(e={})=>{let t=new Set,n=sb(e=>{a.setState({height:{...a.getState().height,viewport:e}})}),r=sb(e=>{a.setState({height:{...a.getState().height,inset:e}})}),i=(e,t)=>(a.setState({element:{...a.getState().element,[e]:t}}),()=>{a.getState().element[e]===t&&a.setState({element:{...a.getState().element,[e]:null}})}),a=ob(()=>({isAtBottom:!0,scrollToBottom:({behavior:e=`auto`}={})=>{la(t,()=>({behavior:e}),`Thread viewport`)},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??`bottom`,topAnchorMessageClamp:{tallerThan:e.topAnchorMessageClamp?.tallerThan??`10em`,visibleHeight:e.topAnchorMessageClamp?.visibleHeight??`6em`},height:{viewport:0,inset:0},element:{viewport:null,anchor:null,target:null},targetConfig:null,topAnchorTurn:null,registerViewport:n.register,registerContentInset:r.register,registerViewportElement:e=>i(`viewport`,e),registerAnchorElement:e=>i(`anchor`,e),registerAnchorTargetElement:(e,t)=>(a.setState({element:{...a.getState().element,target:e},targetConfig:e&&t?t:null}),()=>{a.getState().element.target===e&&a.setState({element:{...a.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:e=>{a.setState({topAnchorTurn:e})}}));return a},lb=e=>e,ub=e=>{let t=F(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={optional:!0},t[0]=n):n=t[0];let r=eb(n),i;t[1]===e?i=t[2]:(i=()=>cb(e),t[1]=e,t[2]=i);let[a]=L(i),o,s;t[3]!==r||t[4]!==a?(o=()=>r?.getState().onScrollToBottom(e=>{a.getState().scrollToBottom(e)}),s=[r,a],t[3]=r,t[4]=a,t[5]=o,t[6]=s):(o=t[5],s=t[6]),z(o,s);let c,l;return t[7]!==r||t[8]!==a?(c=()=>{if(r)return a.subscribe(e=>{r.getState().isAtBottom!==e.isAtBottom&&lb(r).setState({isAtBottom:e.isAtBottom})})},l=[a,r],t[7]=r,t[8]=a,t[9]=c,t[10]=l):(c=t[9],l=t[10]),z(c,l),a},db=e=>{let t=F(7),{children:n,options:r}=e,i;t[0]===r?i=t[1]:(i=r===void 0?{}:r,t[0]=r,t[1]=i);let a=ub(i),o;t[2]===a?o=t[3]:(o=()=>({useThreadViewport:a}),t[2]=a,t[3]=o);let[s]=L(o),c;return t[4]!==n||t[5]!==s?(c=(0,I.jsx)(Qy.Provider,{value:s,children:n}),t[4]=n,t[5]=s,t[6]=c):c=t[6],c},fb=()=>{let e=F(3),t=K(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{},r=[t],e[0]=t,e[1]=n,e[2]=r),z(n,r),null},pb=Zr(e=>{let t=F(8),{children:n,aui:r,config:i,runtime:a}=e,o=r??null,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,I.jsx)(fb,{}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,I.jsx)(db,{children:n}),t[1]=n,t[2]=c);let l;return t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==c?(l=(0,I.jsxs)(ru,{runtime:a,aui:o,config:i,children:[s,c]}),t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l):l=t[7],l}),mb=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,hb={serialize(e){let t=e.id===e.label?``:`{name=${e.id}}`;return`:${e.type}[${e.label}]${t}`},parse(e){let t=[],n=0;for(let r of e.matchAll(mb)){r.index>n&&t.push({kind:`text`,text:e.slice(n,r.index)});let i=r[2];t.push({kind:`mention`,type:r[1],label:i,id:r[3]??i}),n=r.index+r[0].length}return n<e.length&&t.push({kind:`text`,text:e.slice(n)}),t}},gb=t(s(),1),_b=Object.defineProperty,vb=(e,t)=>_b(e,`name`,{value:t,configurable:!0});function yb(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}vb(yb,`setRef`);function bb(...e){return t=>{let n=!1,r=e.map(e=>{let r=yb(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():yb(e[t],null)}}}}vb(bb,`composeRefs`);function xb(...e){return u.useCallback(bb(...e),e)}vb(xb,`useComposedRefs`);var Sb=Object.defineProperty,Cb=(e,t)=>Sb(e,`name`,{value:t,configurable:!0});function wb(e){let t=u.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Nb(r)&&typeof Rb==`function`&&(r=Rb(r._payload)),u.Children.forEach(r,e=>{if(jb(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Nb(n)&&typeof Rb==`function`&&(n=Rb(n._payload)),a=Ob(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=u.cloneElement(a,void 0,s):!o&&u.Children.count(r)===1&&u.isValidElement(r)&&(a=r);let c=a?Ab(a):void 0,l=xb(n,c);if(!a){if(r||r===0)throw Error(o?Lb(e):Ib(e));return r}let d=kb(i,a.props??{});return a.type!==u.Fragment&&(d.ref=n?l:c),u.cloneElement(a,d)});return t.displayName=`${e}.Slot`,t}Cb(wb,`createSlot`);var Tb=wb(`Slot`),Eb=Symbol.for(`radix.slottable`);function Db(e){let t=Cb(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Eb,t}Cb(Db,`createSlottable`);var Ob=Cb((e,t)=>{if(`child`in e.props){let t=e.props.child;return u.isValidElement(t)?u.cloneElement(t,void 0,e.props.children(t.props.children)):null}return u.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function kb(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=Fb(a,i))}return{...e,...n}}Cb(kb,`mergeProps`);function Ab(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Cb(Ab,`getElementRef`);function jb(e){return u.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Eb}Cb(jb,`isSlottable`);var Mb=Symbol.for(`react.lazy`);function Nb(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Mb&&`_payload`in e&&Pb(e._payload)}Cb(Nb,`isLazyComponent`);function Pb(e){return typeof e==`object`&&!!e&&`then`in e}Cb(Pb,`isPromiseLike`);function Fb(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Cb(Fb,`concatAriaDescribedby`);var Ib=Cb(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Lb=Cb(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Rb=u.use,zb=Object.defineProperty,Bb=(e,t)=>zb(e,`name`,{value:t,configurable:!0}),Vb=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=wb(`Primitive.${t}`),r=u.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,I.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Hb(e,t){e&&gb.flushSync(()=>e.dispatchEvent(t))}Bb(Hb,`dispatchDiscreteCustomEvent`);var Ub=Object.defineProperty,Wb=(e,t)=>Ub(e,`name`,{value:t,configurable:!0});function Gb(e,t){let n=u.createContext(t);n.displayName=e+`Context`;let r=Wb(e=>{let{children:t,...r}=e,i=u.useMemo(()=>r,Object.values(r));return(0,I.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=u.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Wb(i,`useContext`),[r,i]}Wb(Gb,`createContext`);function Kb(e,t=[]){let n=[];function r(t,r){let i=u.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Wb(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=u.useMemo(()=>o,Object.values(o));return(0,I.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,d=u.useContext(l);if(d)return d;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Wb(s,`useContext`),[o,s]}Wb(r,`createContext`);let i=Wb(()=>{let t=n.map(e=>u.createContext(e));return Wb(function(n){let r=n?.[e]||t;return u.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,qb(i,...t)]}Wb(Kb,`createContextScope`);function qb(...e){let t=e[0];if(e.length===1)return t;let n=Wb(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Wb(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Wb(qb,`composeContextScopes`);var Jb=Object.defineProperty,Yb=(e,t)=>Jb(e,`name`,{value:t,configurable:!0});function Xb(e){let t=e+`CollectionProvider`,[n,r]=Kb(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Yb(e=>{let{scope:t,children:n}=e,r=u.useRef(null),a=u.useRef(new Map).current;return(0,I.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=wb(s),l=u.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=xb(t,a(s,n).collectionRef);return(0,I.jsx)(c,{ref:i,children:r})});l.displayName=s;let d=e+`CollectionItemSlot`,f=`data-radix-collection-item`,p=wb(d),m=u.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=u.useRef(null),s=xb(t,o),c=a(d,n);return u.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,I.jsx)(p,{[f]:``,ref:s,children:r})});m.displayName=d;function h(t){let n=a(e+`CollectionConsumer`,t);return u.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return Yb(h,`useCollection`),[{Provider:o,Slot:l,ItemSlot:m},h,r]}Yb(Xb,`createCollection`);var Zb=new WeakMap,Qb=class e extends Map{static{Yb(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],Zb.set(this,!0)}set(e,t){return Zb.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=tx(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=$b(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=$b(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return $b(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function $b(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=ex(e,t);return n===-1?void 0:e[n]}Yb($b,`at`);function ex(e,t){let n=e.length,r=tx(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Yb(ex,`toSafeIndex`);function tx(e){return e!==e||e===0?0:Math.trunc(e)}Yb(tx,`toSafeInteger`);function nx(e){let t=e+`CollectionProvider`,[n,r]=Kb(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Qb,setItemMap:Yb(()=>void 0,`setItemMap`)}),o=Yb(({state:e,...t})=>e?(0,I.jsx)(c,{...t,state:e}):(0,I.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=Yb(e=>{let t=g();return(0,I.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=Yb(e=>{let{scope:t,children:n,state:r}=e,a=u.useRef(null),[o,s]=u.useState(null),c=xb(a,s),[l,d]=r;return u.useEffect(()=>{if(!o)return;let e=ox(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,I.jsx)(i,{scope:t,itemMap:l,setItemMap:d,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,d=wb(l),f=u.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=xb(t,a(l,n).collectionRef);return(0,I.jsx)(d,{ref:i,children:r})});f.displayName=l;let p=e+`CollectionItemSlot`,m=wb(p),h=u.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=u.useRef(null),[s,c]=u.useState(null),l=xb(t,o,c),{setItemMap:d}=a(p,n),f=u.useRef(i);rx(f.current,i)||(f.current=i);let h=f.current;return u.useEffect(()=>{let e=h;return d(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(ax):(t.set(s,{...e,element:s}),t.toSorted(ax)):t),()=>{d(e=>!s||!e.has(s)?e:(e.delete(s),new Qb(e)))}},[s,h,d]),(0,I.jsx)(m,{"data-radix-collection-item":``,ref:l,children:r})});h.displayName=p;function g(){return u.useState(new Qb)}Yb(g,`useInitCollection`);function _(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return Yb(_,`useCollection`),[{Provider:o,Slot:f,ItemSlot:h},{createCollectionScope:r,useCollection:_,useInitCollection:g}]}Yb(nx,`createCollection`);function rx(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}Yb(rx,`shallowEqual`);function ix(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Yb(ix,`isElementPreceding`);function ax(e,t){return!e[1].element||!t[1].element?0:ix(e[1].element,t[1].element)?-1:1}Yb(ax,`sortByDocumentPosition`);function ox(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}Yb(ox,`getChildListObserver`);var sx=Object.defineProperty,cx=(e,t)=>sx(e,`name`,{value:t,configurable:!0}),lx=!!(typeof window<`u`&&window.document&&window.document.createElement);function ux(e,t,{checkForDefaultPrevented:n=!0}={}){return cx(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}cx(ux,`composeEventHandlers`);function dx(e){if(!lx)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}cx(dx,`getOwnerWindow`);function fx(e){if(!lx)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}cx(fx,`getOwnerDocument`);function px(e,t=!1){let{activeElement:n}=fx(e);if(!n?.nodeName)return null;if(mx(n)&&n.contentDocument)return px(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=fx(n).getElementById(e);if(t)return t}}return n}cx(px,`getActiveElement`);function mx(e){return e.tagName===`IFRAME`}cx(mx,`isFrame`);var hx=Object.defineProperty,gx=(e,t)=>hx(e,`name`,{value:t,configurable:!0});function _x(e){let t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>((...e)=>t.current?.(...e)),[])}gx(_x,`useCallbackRef`);var vx=Object.defineProperty,yx=(e,t)=>vx(e,`name`,{value:t,configurable:!0}),bx={LTR:`ltr`,RTL:`rtl`},xx=u.createContext(void 0);function Sx(e){let t=u.useContext(xx);return e||t||bx.LTR}yx(Sx,`useDirection`);var Cx=Object.defineProperty,wx=(e,t)=>Cx(e,`name`,{value:t,configurable:!0});function Tx(e,t=globalThis?.document){let n=_x(e);u.useEffect(()=>{let e=wx(e=>{e.key===`Escape`&&n(e)},`handleKeyDown`);return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}wx(Tx,`useEscapeKeydown`);var Ex=Vb;Ex.dispatchDiscreteCustomEvent=Hb,Ex.Root=Vb;var Dx=Object.defineProperty,Ox=(e,t)=>{let n={};for(var r in e)Dx(n,r,{get:e[r],enumerable:!0});return t||Dx(n,Symbol.toStringTag,{value:`Module`}),n},kx=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`];function Ax(e,t){return ei(e,void 0,t===void 0?e.props.children:t)}function jx(e,t,n){return(0,I.jsx)(Tb,{...n,children:Ax(e,t)})}function Mx(e){let t=B((t,n)=>{let r=F(17),i,a,o,s;r[0]===t?(i=r[1],a=r[2],o=r[3],s=r[4]):({render:o,asChild:i,children:a,...s}=t,r[0]=t,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c=e;if(o&&ti(o)){let e=s,t;r[5]!==a||r[6]!==o?(t=Ax(o,a),r[5]=a,r[6]=o,r[7]=t):t=r[7];let i;return r[8]!==n||r[9]!==e||r[10]!==t?(i=(0,I.jsx)(c,{...e,asChild:!0,ref:n,children:t}),r[8]=n,r[9]=e,r[10]=t,r[11]=i):i=r[11],i}let l=s,u;return r[12]!==i||r[13]!==a||r[14]!==n||r[15]!==l?(u=(0,I.jsx)(c,{...l,asChild:i,ref:n,children:a}),r[12]=i,r[13]=a,r[14]=n,r[15]=l,r[16]=u):u=r[16],u});return t.displayName=typeof e==`string`?e:e.displayName??e.name??`Component`,t}function Nx(e){let t=Ex[e],n=Mx(t);return n.displayName=`Primitive.${e}`,n}var Px=kx.reduce((e,t)=>(e[t]=Nx(t),e),{}),Fx=(e,t,n=[])=>{let r=B((e,r)=>{let i=F(6),a={},o={};Object.keys(e).forEach(t=>{n.includes(t)?a[t]=e[t]:o[t]=e[t]});let s=t(a)??void 0,c=Px,l=o.disabled||!s,u=ux(o.onClick,s),d;return i[0]!==r||i[1]!==o||i[2]!==c.button||i[3]!==l||i[4]!==u?(d=(0,I.jsx)(c.button,{type:`button`,...o,ref:r,disabled:l,onClick:u}),i[0]=r,i[1]=o,i[2]=c.button,i[3]=l,i[4]=u,i[5]=d):d=i[5],d});return r.displayName=e,r},Ix=ni(null),Lx=()=>ii(Ix),Rx=e=>{let t=F(8),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=R(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[1]=a):a=t[1];let o=R(a),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=Array.from(i.current.entries());e.sort(zx),o.current=e.map(Bx)},t[2]=s):s=t[2];let c=s,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{let n=t?.priority??0;return i.current.set(e,n),c(),()=>{i.current.delete(e),c()}},t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p={register:u,getPlugins:f},t[5]=p):p=t[5];let m=p,h;return t[6]===n?h=t[7]:(h=(0,I.jsx)(Ix.Provider,{value:m,children:n}),t[6]=n,t[7]=h),h};function zx(e,t){return t[1]-e[1]}function Bx(e){let[t]=e;return t}var Vx=ni(null),Hx=ni(null),Ux=()=>{let e=ii(Vx);if(!e)throw Error(`useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},Wx=()=>ii(Vx),Gx=()=>{let e=ii(Hx);if(!e)throw Error(`useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},Kx=()=>{let e=Ux();return Kr(e.subscribe,e.getTriggers,e.getTriggers)},qx=new Map,Jx=()=>()=>{},Yx=()=>qx,Xx=()=>{let e=Wx();return Kr(e?e.subscribe:Jx,e?e.getTriggers:Yx,e?e.getTriggers:Yx)},Zx=()=>null,Qx=()=>{let e=Wx();return Kr(e?e.subscribeAria:Jx,e?e.getActiveAria:Zx,e?e.getActiveAria:Zx)};function $x(){let e=F(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=new Set,e[0]=t):t=e[0];let n=R(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{for(let e of n.current)e()},e[1]=r):r=e[1];let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>(n.current.add(e),()=>{n.current.delete(e)}),e[2]=a):a=e[2];let o=a,s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={notify:i,subscribe:o},e[3]=s):s=e[3],s}var eS=e=>{let t=F(21),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=R(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,t[1]=a):a=t[1];let o=R(a),{notify:s,subscribe:c}=$x(),l;t[2]===s?l=t[3]:(l=e=>{let{char:t}=e;if(i.current.has(t))return nS;let n=new Map(i.current);n.set(t,e),i.current=n,s();for(let t of o.current)t.added(e);return()=>{let e=new Map(i.current);e.delete(t),i.current=e,s();for(let e of o.current)e.removed(t)}},t[2]=s,t[3]=l);let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>i.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>(o.current.add(e),()=>{o.current.delete(e)}),t[5]=p):p=t[5];let m=p,h=R(null),g=R(null),{notify:_,subscribe:v}=$x(),y;t[6]===_?y=t[7]:(y=(e,t)=>{if(t===null){if(g.current!==e)return;h.current=null,g.current=null,_();return}let n=h.current;(g.current!==e||n===null||n.popoverId!==t.popoverId||n.highlightedItemId!==t.highlightedItemId)&&(h.current=t,g.current=e,_())},t[6]=_,t[7]=y);let b=y,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>h.current,t[8]=x):x=t[8];let S=x,C;t[9]!==u||t[10]!==c||t[11]!==v?(C={register:u,getTriggers:f,subscribe:c,subscribeLifecycle:m,getActiveAria:S,subscribeAria:v},t[9]=u,t[10]=c,t[11]=v,t[12]=C):C=t[12];let w=C,T;t[13]===b?T=t[14]:(T={setActiveAria:b},t[13]=b,t[14]=T);let E=T,D;t[15]!==E||t[16]!==n?(D=(0,I.jsx)(Hx.Provider,{value:E,children:n}),t[15]=E,t[16]=n,t[17]=D):D=t[17];let O;return t[18]!==D||t[19]!==w?(O=(0,I.jsx)(Vx.Provider,{value:w,children:D}),t[18]=D,t[19]=w,t[20]=O):O=t[20],O},tS=e=>{let t=F(4),{children:n}=e;if(Lx()){let e;return t[0]===n?e=t[1]:(e=(0,I.jsx)(eS,{children:n}),t[0]=n,t[1]=e),e}let r;return t[2]===n?r=t[3]:(r=(0,I.jsx)(Rx,{children:(0,I.jsx)(eS,{children:n})}),t[2]=n,t[3]=r),r};tS.displayName=`ComposerPrimitive.TriggerPopoverRoot`;function nS(){}var rS=/\s/u;function iS(e,t,n,r){if(r===null)return null;let{query:i,offset:a,endOffset:o}=r;return a<0||a+t.length>n||!e.startsWith(t,a)||o<a+t.length||o>e.length?null:{query:i,offset:a,endOffset:o}}function aS(e,t,n,r){if(r)return iS(e,t,n,r(e,t,n));let i=e.slice(0,n);for(let e=i.length-1;e>=0;e--){let r=i[e];if(rS.test(r))return null;if(i.startsWith(t,e)){if(e>0&&!rS.test(i[e-1]))continue;return{query:i.slice(e+t.length),offset:e,endOffset:n}}}return null}var oS=H(e=>{let t=F(8),{text:n,triggerChar:r,matcher:i}=e,[a,o]=L(n.length),s=Math.min(a,n.length),c;t[0]!==i||t[1]!==s||t[2]!==n||t[3]!==r?(c=aS(n,r,s,i),t[0]=i,t[1]=s,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l=c,u=l?.query??``,d;return t[5]!==u||t[6]!==l?(d={trigger:l,query:u,setCursorPosition:o},t[5]=u,t[6]=l,t[7]=d):d=t[7],d});function sS(e){return`type`in e}var cS=H(e=>{let t=F(22),{navigableList:n,isSearchMode:r,activeCategoryId:i,query:a,popoverId:o,open:s,selectItem:c,selectCategory:l,goBack:u,close:d}=e,[f,p]=L(0),m;t[0]!==i||t[1]!==r||t[2]!==n?(m={navigableList:n,isSearchMode:r,activeCategoryId:i},t[0]=i,t[1]=r,t[2]=n,t[3]=m):m=t[3];let[h,g]=L(m);(h.navigableList!==n||h.isSearchMode!==r||h.activeCategoryId!==i)&&(g({navigableList:n,isSearchMode:r,activeCategoryId:i}),p(0));let _;t[4]!==f||t[5]!==n.length?(_=e=>{e<0||e>=n.length||e!==f&&p(e)},t[4]=f,t[5]=n.length,t[6]=_):_=t[6];let v=Gr(_),y;t[7]!==i||t[8]!==d||t[9]!==u||t[10]!==f||t[11]!==n||t[12]!==s||t[13]!==a||t[14]!==l||t[15]!==c?(y=e=>{if(!s)return!1;switch(e.key){case`ArrowDown`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e<t-1?e+1:0}),!0;case`ArrowUp`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e>0?e-1:t-1}),!0;case`Enter`:case`Tab`:{if(e.shiftKey)return!1;e.preventDefault();let t=n[f];return t&&(sS(t)?c(t):l(t.id)),!0}case`Escape`:return e.preventDefault(),d(),!0;case`Backspace`:return i&&a===``?(e.preventDefault(),u(),!0):!1;default:return!1}},t[7]=i,t[8]=d,t[9]=u,t[10]=f,t[11]=n,t[12]=s,t[13]=a,t[14]=l,t[15]=c,t[16]=y):y=t[16];let b=Gr(y),x=n[f],S=s&&x?`${o}-option-${x.id}`:void 0,C;return t[17]!==b||t[18]!==v||t[19]!==f||t[20]!==S?(C={highlightedIndex:f,highlightedItemId:S,highlightIndex:v,handleKeyDown:b},t[17]=b,t[18]=v,t[19]=f,t[20]=S,t[21]=C):C=t[21],C});function lS(e,t){return!t||e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}var uS=H(e=>{let t=F(35),{adapter:n,query:r,open:i}=e,[a,o]=L(null),[s,c]=L(i);s!==i&&(c(i),i||o(null));let l;bb0:{if(!i||!n){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],l=e;break bb0}let e;t[1]===n?e=t[2]:(e=n.categories(),t[1]=n,t[2]=e),l=e}let u=l,d=i?a:null,f;bb1:{if(!d||!n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[3]=e):e=t[3],f=e;break bb1}let e;t[4]!==n||t[5]!==d?(e=n.categoryItems(d),t[4]=n,t[5]=d,t[6]=e):e=t[6],f=e}let p=f,m;bb2:{if(!i||!n||d){m=null;break bb2}if(!r&&u.length>0){m=null;break bb2}if(n.search){let e;t[7]!==n||t[8]!==r?(e=n.search(r),t[7]=n,t[8]=r,t[9]=e):e=t[9],m=e;break bb2}let e;if(t[10]!==n||t[11]!==u||t[12]!==r){e=[];let i=r.toLowerCase();for(let t of u)for(let r of n.categoryItems(t.id))lS(r,i)&&e.push(r);t[10]=n,t[11]=u,t[12]=r,t[13]=e}else e=t[13];m=e}let h=m,g=h!==null,_;bb3:{if(g){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[14]=e):e=t[14],_=e;break bb3}if(!r){_=u;break bb3}let e;if(t[15]!==u||t[16]!==r){let n=r.toLowerCase();e=u.filter(e=>e.label.toLowerCase().includes(n)),t[15]=u,t[16]=r,t[17]=e}else e=t[17];_=e}let v=_,y;bb4:{if(g){let e;t[18]===h?e=t[19]:(e=h??[],t[18]=h,t[19]=e),y=e;break bb4}if(!r){y=p;break bb4}let e;if(t[20]!==p||t[21]!==r){let n=r.toLowerCase();e=p.filter(e=>lS(e,n)),t[20]=p,t[21]=r,t[22]=e}else e=t[22];y=e}let b=y,x;bb5:{if(g){let e;t[23]===h?e=t[24]:(e=h??[],t[23]=h,t[24]=e),x=e;break bb5}if(d){x=b;break bb5}x=v}let S=x,C;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{o(e)},t[25]=C):C=t[25];let w=Gr(C),T;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{o(null)},t[26]=T):T=t[26];let E=Gr(T),D;return t[27]!==d||t[28]!==v||t[29]!==b||t[30]!==E||t[31]!==g||t[32]!==S||t[33]!==w?(D={categories:v,items:b,isSearchMode:g,activeCategoryId:d,navigableList:S,selectCategory:w,goBack:E},t[27]=d,t[28]=v,t[29]=b,t[30]=E,t[31]=g,t[32]=S,t[33]=w,t[34]=D):D=t[34],D}),dS=H(e=>{let t=F(15),{behavior:n,trigger:r,aui:i,setCursorPosition:a,onSelected:o}=e,s=R(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>(s.current=e,()=>{s.current===e&&(s.current=null)}),t[0]=c):c=t[0];let l=Gr(c),u;t[1]!==i||t[2]!==n||t[3]!==o||t[4]!==a||t[5]!==r?(u=e=>{if(!r||!n)return;if(s.current?.(e)){o();return}let t=i.composer.getState().text,c=t.slice(0,r.offset),l=t.slice(r.endOffset),u=()=>{let t=n.formatter.serialize(e);i.composer.setText(c+t+(l.startsWith(` `)?l:` ${l}`)),a(c.length+t.length+1)};n.kind===`directive`?(u(),n.onInserted?.(e)):(n.removeOnExecute?(i.composer.setText(c+(l.startsWith(` `)?l.slice(1):l)),a(c.length)):u(),n.onExecute(e)),o()},t[1]=i,t[2]=n,t[3]=o,t[4]=a,t[5]=r,t[6]=u):u=t[6];let d=Gr(u),f;t[7]!==o||t[8]!==a||t[9]!==r?(f=()=>{o(),r&&a(r.offset)},t[7]=o,t[8]=a,t[9]=r,t[10]=f):f=t[10];let p=Gr(f),m;return t[11]!==p||t[12]!==l||t[13]!==d?(m={selectItem:d,close:p,registerSelectItemOverride:l},t[11]=p,t[12]=l,t[13]=d,t[14]=m):m=t[14],m}),fS=H(e=>{let t=F(47),{adapter:n,text:r,triggerChar:i,matcher:a,behavior:o,aui:s,popoverId:c,isLoading:l}=e,u;t[0]!==a||t[1]!==r||t[2]!==i?(u=oS({text:r,triggerChar:i,matcher:a}),t[0]=a,t[1]=r,t[2]=i,t[3]=u):u=t[3];let d=$i(u),f=d.trigger!==null&&n!==void 0&&o!==void 0,p;t[4]!==n||t[5]!==d.query||t[6]!==f?(p=uS({adapter:n,query:d.query,open:f}),t[4]=n,t[5]=d.query,t[6]=f,t[7]=p):p=t[7];let m=$i(p),h;t[8]===m?h=t[9]:(h=()=>{m.goBack()},t[8]=m,t[9]=h);let g=Gr(h),_;t[10]!==s||t[11]!==o||t[12]!==d.setCursorPosition||t[13]!==d.trigger||t[14]!==g||t[15]!==i?(_=dS({behavior:o,trigger:d.trigger,aui:s,triggerChar:i,setCursorPosition:d.setCursorPosition,onSelected:g}),t[10]=s,t[11]=o,t[12]=d.setCursorPosition,t[13]=d.trigger,t[14]=g,t[15]=i,t[16]=_):_=t[16];let v=$i(_),y;t[17]!==d.query||t[18]!==m.activeCategoryId||t[19]!==m.goBack||t[20]!==m.isSearchMode||t[21]!==m.navigableList||t[22]!==m.selectCategory||t[23]!==f||t[24]!==c||t[25]!==v.close||t[26]!==v.selectItem?(y=cS({navigableList:m.navigableList,isSearchMode:m.isSearchMode,activeCategoryId:m.activeCategoryId,query:d.query,popoverId:c,open:f,selectItem:v.selectItem,selectCategory:m.selectCategory,goBack:m.goBack,close:v.close}),t[17]=d.query,t[18]=m.activeCategoryId,t[19]=m.goBack,t[20]=m.isSearchMode,t[21]=m.navigableList,t[22]=m.selectCategory,t[23]=f,t[24]=c,t[25]=v.close,t[26]=v.selectItem,t[27]=y):y=t[27];let b=$i(y),x;return t[28]!==d.query||t[29]!==d.setCursorPosition||t[30]!==l||t[31]!==b.handleKeyDown||t[32]!==b.highlightIndex||t[33]!==b.highlightedIndex||t[34]!==b.highlightedItemId||t[35]!==m.activeCategoryId||t[36]!==m.categories||t[37]!==m.goBack||t[38]!==m.isSearchMode||t[39]!==m.items||t[40]!==m.selectCategory||t[41]!==f||t[42]!==c||t[43]!==v.close||t[44]!==v.registerSelectItemOverride||t[45]!==v.selectItem?(x={open:f,query:d.query,activeCategoryId:m.activeCategoryId,categories:m.categories,items:m.items,highlightedIndex:b.highlightedIndex,isSearchMode:m.isSearchMode,isLoading:l,popoverId:c,highlightedItemId:b.highlightedItemId,selectCategory:m.selectCategory,goBack:m.goBack,selectItem:v.selectItem,close:v.close,highlightIndex:b.highlightIndex,handleKeyDown:b.handleKeyDown,setCursorPosition:d.setCursorPosition,registerSelectItemOverride:v.registerSelectItemOverride},t[28]=d.query,t[29]=d.setCursorPosition,t[30]=l,t[31]=b.handleKeyDown,t[32]=b.highlightIndex,t[33]=b.highlightedIndex,t[34]=b.highlightedItemId,t[35]=m.activeCategoryId,t[36]=m.categories,t[37]=m.goBack,t[38]=m.isSearchMode,t[39]=m.items,t[40]=m.selectCategory,t[41]=f,t[42]=c,t[43]=v.close,t[44]=v.registerSelectItemOverride,t[45]=v.selectItem,t[46]=x):x=t[46],x}),pS=ni(null),mS=()=>{let e=ii(pS);if(!e)throw Error(`useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover`);return e},hS=()=>ii(pS),gS=ni(null),_S=()=>{let e=ii(gS);if(!e)throw Error(`TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover`);return e},vS=B((e,t)=>{let n=F(70),r,i,a,o,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],l=n[7]):({char:a,matcher:s,adapter:r,isLoading:l,"aria-label":i,children:o,...c}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=l);let u=l!==void 0&&l,d=K(),f=q(yS),p=Yr(),m=R(s),h;n[8]===s?h=n[9]:(h=()=>{m.current=s},n[8]=s,n[9]=h),z(h);let g;n[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>(e,t,n)=>m.current(e,t,n),n[10]=g):g=n[10];let[_]=L(g),v=s!==void 0,y=R(null),[b,x]=L(null),S=R(0),C;n[11]===a?C=n[12]:(C=e=>(S.current+=1,y.current=e,x(e),()=>{S.current=Math.max(0,S.current-1),y.current===e&&(y.current=null,x(null))}),n[11]=a,n[12]=C);let w=C,T;n[13]===w?T=n[14]:(T={register:w},n[13]=w,n[14]=T);let E=T,D=b??void 0,O;n[15]!==r||n[16]!==d||n[17]!==a||n[18]!==u||n[19]!==s||n[20]!==p||n[21]!==D||n[22]!==f?(O=fS({adapter:r,text:f,triggerChar:a,matcher:s,behavior:D,aui:d,popoverId:p,isLoading:u}),n[15]=r,n[16]=d,n[17]=a,n[18]=u,n[19]=s,n[20]=p,n[21]=D,n[22]=f,n[23]=O):O=n[23];let k=$i(O),ee;n[24]===k?ee=n[25]:(ee=()=>k,n[24]=k,n[25]=ee);let te=Gr(ee),ne=Ux(),re;n[26]!==b||n[27]!==a||n[28]!==te||n[29]!==v||n[30]!==_||n[31]!==ne?(re=()=>ne.register({char:a,...v?{matcher:_}:{},...b?{behavior:b}:{},resource:te()}),n[26]=b,n[27]=a,n[28]=te,n[29]=v,n[30]=_,n[31]=ne,n[32]=re):re=n[32];let ie;n[33]!==b||n[34]!==a||n[35]!==v||n[36]!==_||n[37]!==ne?(ie=[ne,a,v,_,b],n[33]=b,n[34]=a,n[35]=v,n[36]=_,n[37]=ne,n[38]=ie):ie=n[38],z(re,ie);let ae=Lx(),A;n[39]!==te||n[40]!==ae?(A=()=>{if(ae)return ae.register(te())},n[39]=te,n[40]=ae,n[41]=A):A=n[41];let j;n[42]===ae?j=n[43]:(j=[ae],n[42]=ae,n[43]=j),z(A,j);let M=b!==null&&k.open,oe=Gx(),se,ce;n[44]!==oe||n[45]!==a||n[46]!==M?(se=()=>{if(M)return()=>{oe.setActiveAria(a,null)}},ce=[oe,a,M],n[44]=oe,n[45]=a,n[46]=M,n[47]=se,n[48]=ce):(se=n[47],ce=n[48]),z(se,ce);let N,P;n[49]!==oe||n[50]!==a||n[51]!==M||n[52]!==p||n[53]!==k.highlightedItemId?(N=()=>{M&&oe.setActiveAria(a,{popoverId:p,highlightedItemId:k.highlightedItemId})},P=[oe,a,p,M,k.highlightedItemId],n[49]=oe,n[50]=a,n[51]=M,n[52]=p,n[53]=k.highlightedItemId,n[54]=N,n[55]=P):(N=n[54],P=n[55]),z(N,P);let le;n[56]!==i||n[57]!==o||n[58]!==t||n[59]!==M||n[60]!==p||n[61]!==c||n[62]!==k.highlightedItemId?(le=M?(0,I.jsx)(Px.div,{role:`listbox`,id:p,"aria-label":i??`Suggestions`,"aria-activedescendant":k.highlightedItemId,"data-state":`open`,...c,ref:t,children:o}):o,n[56]=i,n[57]=o,n[58]=t,n[59]=M,n[60]=p,n[61]=c,n[62]=k.highlightedItemId,n[63]=le):le=n[63];let ue;n[64]!==k||n[65]!==le?(ue=(0,I.jsx)(pS.Provider,{value:k,children:le}),n[64]=k,n[65]=le,n[66]=ue):ue=n[66];let de;return n[67]!==E||n[68]!==ue?(de=(0,I.jsx)(gS.Provider,{value:E,children:ue}),n[67]=E,n[68]=ue,n[69]=de):de=n[69],de});vS.displayName=`ComposerPrimitive.TriggerPopover`;function yS(e){return e.composer.text}var bS=()=>{let e=F(2),{disabled:t,send:n}=hy(),r;return e[0]===n?r=e[1]:(r=()=>n(),e[0]=n,e[1]=r),t?null:r},xS=Fx(`ComposerPrimitive.Send`,bS),SS=ni(null),CS=()=>ii(SS),wS=`[contenteditable]:not([contenteditable='false'])`,TS=`textarea:not(:disabled), ${wS}`,ES=[`a`,`audio[controls]`,`button`,`details`,`embed`,`iframe`,`input`,`label`,`select`,`summary`,`textarea`,`video[controls]`,wS,`[tabindex]`].join(`, `),DS=B((e,t)=>{let n=F(24),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({onSubmit:a,onMouseDown:i,compact:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=bS(),[c,l]=L(!1),u;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={setMultiline:l},n[5]=u):u=n[5];let d=u,f;n[6]===r?f=n[7]:(f=e=>r?e.composer.attachments.length===0&&e.composer.quote==null&&e.composer.queue.length===0&&e.composer.dictation==null&&!e.composer.text.includes(`
|
|
15
|
+
`):!1,n[6]=r,n[7]=f);let p=q(f)&&!c,m;n[8]===s?m=n[9]:(m=e=>{e.preventDefault(),s&&s()},n[8]=s,n[9]=m);let h=m,g=OS,_=r?d:null,v=p?``:void 0,y;n[10]!==h||n[11]!==a?(y=ux(a,h),n[10]=h,n[11]=a,n[12]=y):y=n[12];let b;n[13]===i?b=n[14]:(b=ux(i,g),n[13]=i,n[14]=b);let x;n[15]!==t||n[16]!==o||n[17]!==v||n[18]!==y||n[19]!==b?(x=(0,I.jsx)(Px.form,{...o,"data-compact":v,ref:t,onSubmit:y,onMouseDown:b}),n[15]=t,n[16]=o,n[17]=v,n[18]=y,n[19]=b,n[20]=x):x=n[20];let S;return n[21]!==_||n[22]!==x?(S=(0,I.jsx)(SS.Provider,{value:_,children:x}),n[21]=_,n[22]=x,n[23]=S):S=n[23],S});DS.displayName=`ComposerPrimitive.Root`;function OS(e){if(e.button!==0)return;let t=e.target;if(!(t instanceof Element)||!e.currentTarget.contains(t))return;let n=t.closest(ES);if(n&&e.currentTarget.contains(n))return;let r=e.currentTarget.querySelector(TS);r&&(e.preventDefault(),r.focus())}var kS=e=>{let t=F(4),n=_x(e),r=$y(AS),i,a;t[0]!==n||t[1]!==r?(i=()=>r(n),a=[r,n],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),z(i,a)};function AS(e){return e.onScrollToBottom}var jS=()=>!1,MS=()=>{},NS=e=>{let t=F(4),n;t[0]===e?n=t[1]:(n=t=>{if(typeof window>`u`||e===null||!window.matchMedia)return MS;let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},t[0]=e,t[1]=n);let r=n,i;return t[2]===e?i=t[3]:(i=()=>typeof window>`u`||e===null||!window.matchMedia?!1:window.matchMedia(e).matches,t[2]=e,t[3]=i),Kr(r,i,jS)},PS=e=>e.isComposing||e.keyCode===229;function FS(){return q(IS)}function IS(e){return e.composer.isEditing?e.composer.text:``}function LS(e){return!!q(RS)||!!e}function RS(e){return e.thread.isDisabled||e.composer.dictation?.inputDisabled}function zS(){let e=F(4),t=Qx();if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={},e[0]=t):t=e[0],t}let n;return e[1]!==t.highlightedItemId||e[2]!==t.popoverId?(n={"aria-controls":t.popoverId,"aria-expanded":!0,"aria-haspopup":`listbox`,"aria-activedescendant":t.highlightedItemId},e[1]=t.highlightedItemId,e[2]=t.popoverId,e[3]=n):n=e[3],n}function BS(){return BS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},BS.apply(null,arguments)}function VS(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var HS=u.useLayoutEffect,US=function(e){var t=u.useRef(e);return HS(function(){t.current=e}),t},WS=function(e,t){if(typeof e==`function`){e(t);return}e.current=t},GS=function(e,t){var n=u.useRef();return u.useCallback(function(r){e.current=r,n.current&&WS(n.current,null),n.current=t,t&&WS(t,r)},[t])},KS={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`},qS=function(e){Object.keys(KS).forEach(function(t){e.style.setProperty(t,KS[t],`important`)})},JS=null,YS=function(e,t){var n=e.scrollHeight;return t.sizingStyle.boxSizing===`border-box`?n+t.borderSize:n-t.paddingSize};function XS(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),JS||(JS=document.createElement(`textarea`),JS.setAttribute(`tabindex`,`-1`),JS.setAttribute(`aria-hidden`,`true`),qS(JS)),JS.parentNode===null&&document.body.appendChild(JS);var i=e.paddingSize,a=e.borderSize,o=e.sizingStyle,s=o.boxSizing;Object.keys(o).forEach(function(e){var t=e;JS.style[t]=o[t]}),qS(JS),JS.value=t;var c=YS(JS,e);JS.value=t,c=YS(JS,e),JS.value=`x`;var l=JS.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);var d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}var ZS=function(){},QS=function(e,t){return e.reduce(function(e,n){return e[n]=t[n],e},{})},$S=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],eC=!!document.documentElement.currentStyle,tC=function(e){var t=window.getComputedStyle(e);if(t===null)return null;var n=QS($S,t),r=n.boxSizing;return r===``?null:(eC&&r===`border-box`&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+`px`),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})};function nC(e,t,n){var r=US(n);u.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var rC=function(e,t){nC(document.body,`reset`,function(n){e.current.form===n.target&&t(n)})},iC=function(e){nC(window,`resize`,e)},aC=function(e){nC(document.fonts,`loadingdone`,e)},oC=[`cacheMeasurements`,`maxRows`,`minRows`,`onChange`,`onHeightChange`],sC=u.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,i=e.minRows,a=e.onChange,o=a===void 0?ZS:a,s=e.onHeightChange,c=s===void 0?ZS:s,l=VS(e,oC),d=l.value!==void 0,f=u.useRef(null),p=GS(f,t),m=u.useRef(0),h=u.useRef(),g=function(){var e=f.current,t=n&&h.current?h.current:tC(e);if(t){h.current=t;var a=XS(t,e.value||e.placeholder||`x`,i,r),o=a[0],s=a[1];m.current!==o&&(m.current=o,e.style.setProperty(`height`,o+`px`,`important`),c(o,{rowHeight:s}))}};return u.useLayoutEffect(g),rC(f,function(){if(!d){var e=f.current.value;requestAnimationFrame(function(){var t=f.current;t&&e!==t.value&&g()})}}),iC(g),aC(g),u.createElement(`textarea`,BS({},l,{onChange:function(e){d||g(),o(e)},ref:p}))}),cC=`(pointer: coarse) and (not (any-pointer: fine))`,lC=B(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:i,onKeyDown:a,onPaste:o,onSelect:s,submitOnEnter:c,submitMode:l,cancelOnEscape:u=!0,unstable_focusOnRunStart:d=!0,unstable_focusOnScrollToBottom:f=!0,unstable_focusOnThreadSwitched:p=!0,unstable_insertNewlineOnTouchEnter:m=!1,addAttachmentOnPaste:h=!0,onHeightChange:g,..._},v)=>{let y=K(),b=Lx(),x=CS(),S=l??(c===!1?`none`:`enter`),C=NS(m?cC:null),w=m&&C&&S===`enter`?`none`:S,T=FS(),E=LS(r),D=R(null),O=xb(v,D),k=R(!1);Tx(e=>{if(!D.current?.contains(e.target)||PS(e))return;if(b){for(let t of b.getPlugins())if(t.handleKeyDown(e))return}if(!u)return;let t=y.composer;t.getState().canCancel&&(t.cancel(),e.preventDefault())});let ee=e=>{if(!E&&!PS(e.nativeEvent)){if(b){for(let t of b.getPlugins())if(t.handleKeyDown(e))return}if(e.key===`Enter`){let t=y.thread.getState(),n=t.capabilities.queue;if(e.shiftKey&&(e.ctrlKey||e.metaKey)&&n&&S!==`none`&&y.composer.getState().canSend){e.preventDefault(),y.composer.send({steer:!0});return}if(e.shiftKey||t.isRunning&&!n&&t.voice===void 0)return;let r=!1;w===`ctrlEnter`?r=e.ctrlKey||e.metaKey:w===`enter`&&(r=!0),r&&(e.preventDefault(),D.current?.closest(`form`)?.requestSubmit())}}},te=async e=>{if(!h)return;let t=y.thread.getState().capabilities,n=Array.from(e.clipboardData?.files||[]);t.attachments&&n.length>0&&(e.preventDefault(),await Promise.all(n.map(async e=>{try{await y.composer.addAttachment(e)}catch{}})))},ne=(e,t)=>{if(g?.(e,t),!x)return;let n=D.current;if(!n||n.value===``)return;let r=getComputedStyle(n),i=r.boxSizing===`border-box`?e-parseFloat(r.paddingTop)-parseFloat(r.paddingBottom)-parseFloat(r.borderTopWidth)-parseFloat(r.borderBottomWidth):e;Math.round(i/t.rowHeight)>1&&x.setMultiline(!0)},re=e&&!E,ie=Ur(()=>{let e=D.current;!e||!re||(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[re]);z(()=>ie(),[ie]),kS(()=>{y.composer.getState().type===`thread`&&f&&ie()}),z(()=>{if(!(y.composer.getState().type!==`thread`||!d))return y.on(`thread.runStart`,ie)},[d,ie,y]),z(()=>{if(!(y.composer.getState().type!==`thread`||!p))return y.on(`threads.selectionChanged`,ie)},[p,ie,y]),z(()=>{T===``&&x?.setMultiline(!1)},[T,x]);let ae=zS(),A={name:`input`,value:T,..._,...ae,ref:O,disabled:E,onChange:ux(i,e=>{if(!y.composer.getState().isEditing)return;let t=e.nativeEvent.isComposing===!0;k.current&&!t&&(k.current=!1);let n=t||k.current;if(gi(()=>{y.composer.setText(e.target.value)}),n)return;let r=e.target.selectionStart??e.target.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(r)}),onKeyDown:ux(a,ee),onCompositionStart:ux(_.onCompositionStart,()=>{k.current=!0}),onCompositionEnd:ux(_.onCompositionEnd,e=>{if(k.current=!1,!y.composer.getState().isEditing)return;let t=e.target;gi(()=>{y.composer.setText(t.value)});let n=t.selectionStart??t.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(n)}),onSelect:ux(s,e=>{if(k.current)return;let t=e.target,n=t.selectionStart??t.value.length;if(b)for(let e of b.getPlugins())e.setCursorPosition(n)}),onPaste:ux(o,te),...x?{onHeightChange:ne}:g===void 0?{}:{onHeightChange:g}};if(n&&ti(n))return jx(n,_.children,A);let j=t?Tb:sC;return(0,I.jsx)(j,{...A})});lC.displayName=`ComposerPrimitive.Input`;var uC=Fx(`ComposerPrimitive.Cancel`,()=>{let{disabled:e,cancel:t}=gy();return e?null:t}),dC=Fx(`ComposerPrimitive.AddAttachment`,e=>{let t=F(6),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{multiple:r}=n,i=r===void 0||r,{disabled:a,addAttachment:o}=yy(),s=K(),c;return t[2]!==o||t[3]!==s.composer||t[4]!==i?(c=()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=i,e.hidden=!0;let t=s.composer.getState().attachmentAccept;t!==`*`&&(e.accept=t),document.body.appendChild(e),e.onchange=async t=>{let n=t.target.files;if(!n)return;let r=Array.from(n,async e=>{try{await o(e)}catch{}});document.body.removeChild(e),await Promise.all(r)},e.oncancel=()=>{(!e.files||e.files.length===0)&&document.body.removeChild(e)},e.click()},t[2]=o,t[3]=s.composer,t[4]=i,t[5]=c):c=t[5],a?null:c},[`multiple`]),fC=B(({disabled:e,asChild:t=!1,render:n,children:r,...i},a)=>{let[o,s]=L(!1),c=K();z(()=>{e&&s(!1)},[e]);let l=Ur(t=>{if(t.dataTransfer.types.includes(`Files`)){if(t.preventDefault(),e||!c.thread.getState().capabilities.attachments){t.dataTransfer.dropEffect=`none`;return}s(!0)}},[e,c]),u=Ur(t=>{if(t.dataTransfer.types.includes(`Files`)){if(t.preventDefault(),e||!c.thread.getState().capabilities.attachments){t.dataTransfer.dropEffect=`none`;return}o||s(!0)}},[e,o,c]),d=Ur(t=>{if(e)return;t.preventDefault();let n=t.relatedTarget;n&&t.currentTarget.contains(n)||s(!1)},[e]),f=Ur(async t=>{if(s(!1),!t.dataTransfer.types.includes(`Files`)||(t.preventDefault(),e))return;let n=Array.from(t.dataTransfer.files);!c.thread.getState().capabilities.attachments||n.length===0||await Promise.all(n.map(async e=>{try{await c.composer.addAttachment(e)}catch{}}))},[e,c]),p={...o&&!e?{"data-dragging":`true`}:null,...i,onDragEnterCapture:ux(i.onDragEnterCapture,l),onDragOverCapture:ux(i.onDragOverCapture,u),onDragLeaveCapture:ux(i.onDragLeaveCapture,d),onDropCapture:ux(i.onDropCapture,f),ref:a};if(n&&ti(n))return jx(n,r,p);let m=t?Tb:`div`;return(0,I.jsx)(m,{...p,children:r})});fC.displayName=`ComposerPrimitive.AttachmentDropzone`;var pC=Fx(`ComposerPrimitive.Dictate`,()=>{let{disabled:e,startDictation:t}=_y();return e?null:t}),mC=Fx(`ComposerPrimitive.StopDictation`,()=>{let e=F(2),t=K(),n=q(hC),r;return e[0]===t.composer?r=e[1]:(r=()=>{t.composer.stopDictation()},e[0]=t.composer,e[1]=r),n?r:null});function hC(e){return e.composer.dictation!=null}var gC=B((e,t)=>{let n=F(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=q(_C);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,I.jsx)(Px.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});gC.displayName=`ComposerPrimitive.DictationTranscript`;function _C(e){return e.composer.dictation?.transcript}var vC=B((e,t)=>{let n=F(3);if(!q(xC))return null;let r;return n[0]!==t||n[1]!==e?(r=(0,I.jsx)(Px.div,{...e,ref:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],r});vC.displayName=`ComposerPrimitive.Quote`;var yC=B((e,t)=>{let n=F(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=q(SC);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,I.jsx)(Px.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});yC.displayName=`ComposerPrimitive.QuoteText`;var bC=B((e,t)=>{let n=F(12),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=K(),o;n[3]===a?o=n[4]:(o=()=>{a.composer.setQuote(void 0)},n[3]=a,n[4]=o);let s=o,c;n[5]!==s||n[6]!==r?(c=ux(r,s),n[5]=s,n[6]=r,n[7]=c):c=n[7];let l;return n[8]!==t||n[9]!==i||n[10]!==c?(l=(0,I.jsx)(Px.button,{type:`button`,...i,ref:t,onClick:c}),n[8]=t,n[9]=i,n[10]=c,n[11]=l):l=n[11],l});bC.displayName=`ComposerPrimitive.QuoteDismiss`;function xC(e){return e.composer.quote}function SC(e){return e.composer.quote?.text}var CC=B((e,t)=>{let n=F(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{categories:o,activeCategoryId:s,isSearchMode:c,open:l}=mS();if(!l||s||c)return null;let u=r??`Categories`,d;n[4]!==o||n[5]!==i?(d=i(o),n[4]=o,n[5]=i,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,I.jsx)(Px.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});CC.displayName=`ComposerPrimitive.TriggerPopoverCategories`;var wC=B((e,t)=>{let n=F(30),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({categoryId:r,onClick:i,onMouseMove:a,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let{selectCategory:s,highlightIndex:c,categories:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:f,popoverId:p}=mS(),m;n[5]!==r||n[6]!==s?(m=()=>{s(r)},n[5]=r,n[6]=s,n[7]=m):m=n[7];let h=m,g;if(n[8]!==l||n[9]!==r){let e;n[11]===r?e=n[12]:(e=e=>e.id===r,n[11]=r,n[12]=e),g=l.findIndex(e),n[8]=l,n[9]=r,n[10]=g}else g=n[10];let _=g,v=!d&&!f&&_===u,y;n[13]!==_||n[14]!==c?(y=()=>{c(_)},n[13]=_,n[14]=c,n[15]=y):y=n[15];let b=y,x=`${p}-option-${r}`,S=v?``:void 0,C;n[16]!==h||n[17]!==i?(C=ux(i,h),n[16]=h,n[17]=i,n[18]=C):C=n[18];let w;n[19]!==b||n[20]!==a?(w=ux(a,b),n[19]=b,n[20]=a,n[21]=w):w=n[21];let T;return n[22]!==t||n[23]!==v||n[24]!==o||n[25]!==x||n[26]!==S||n[27]!==C||n[28]!==w?(T=(0,I.jsx)(Px.button,{type:`button`,role:`option`,id:x,"aria-selected":v,"data-highlighted":S,...o,ref:t,onClick:C,onMouseMove:w}),n[22]=t,n[23]=v,n[24]=o,n[25]=x,n[26]=S,n[27]=C,n[28]=w,n[29]=T):T=n[29],T});wC.displayName=`ComposerPrimitive.TriggerPopoverCategoryItem`;var TC=B((e,t)=>{let n=F(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{items:o,activeCategoryId:s,isSearchMode:c,open:l}=mS();if(!l||!s&&!c)return null;let u=r??`Items`,d;n[4]!==i||n[5]!==o?(d=i(o),n[4]=i,n[5]=o,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,I.jsx)(Px.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});TC.displayName=`ComposerPrimitive.TriggerPopoverItems`;var EC=B((e,t)=>{let n=F(30),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({item:i,index:r,onClick:a,onMouseMove:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let{selectItem:c,highlightIndex:l,items:u,highlightedIndex:d,activeCategoryId:f,isSearchMode:p,popoverId:m}=mS(),h;n[6]!==i||n[7]!==c?(h=()=>{c(i)},n[6]=i,n[7]=c,n[8]=h):h=n[8];let g=h,_;n[9]!==r||n[10]!==i.id||n[11]!==u?(_=r??u.findIndex(e=>e.id===i.id),n[9]=r,n[10]=i.id,n[11]=u,n[12]=_):_=n[12];let v=_,y=(p||f!==null)&&v===d,b;n[13]!==l||n[14]!==v?(b=()=>{l(v)},n[13]=l,n[14]=v,n[15]=b):b=n[15];let x=b,S=`${m}-option-${i.id}`,C=y?``:void 0,w;n[16]!==g||n[17]!==a?(w=ux(a,g),n[16]=g,n[17]=a,n[18]=w):w=n[18];let T;n[19]!==x||n[20]!==o?(T=ux(o,x),n[19]=x,n[20]=o,n[21]=T):T=n[21];let E;return n[22]!==t||n[23]!==y||n[24]!==s||n[25]!==S||n[26]!==C||n[27]!==w||n[28]!==T?(E=(0,I.jsx)(Px.button,{type:`button`,role:`option`,id:S,"aria-selected":y,"data-highlighted":C,...s,ref:t,onClick:w,onMouseMove:T}),n[22]=t,n[23]=y,n[24]=s,n[25]=S,n[26]=C,n[27]=w,n[28]=T,n[29]=E):E=n[29],E});EC.displayName=`ComposerPrimitive.TriggerPopoverItem`;var DC=B((e,t)=>{let n=F(10),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{activeCategoryId:a,isSearchMode:o,goBack:s,open:c}=mS();if(!c||!a||o)return null;let l;n[3]!==s||n[4]!==r?(l=ux(r,s),n[3]=s,n[4]=r,n[5]=l):l=n[5];let u;return n[6]!==t||n[7]!==i||n[8]!==l?(u=(0,I.jsx)(Px.button,{type:`button`,...i,ref:t,onClick:l}),n[6]=t,n[7]=i,n[8]=l,n[9]=u):u=n[9],u});DC.displayName=`ComposerPrimitive.TriggerPopoverBack`;var OC=e=>{let t=F(8),{formatter:n,onExecute:r,removeOnExecute:i}=e,{register:a}=_S(),o=R(r),s,c;t[0]===r?(s=t[1],c=t[2]):(s=()=>{o.current=r},c=[r],t[0]=r,t[1]=s,t[2]=c),Jr(s,c);let l,u;return t[3]!==n||t[4]!==a||t[5]!==i?(l=()=>{let e={kind:`action`,formatter:n??hb,onExecute:e=>o.current(e),...i===void 0?{}:{removeOnExecute:i}};return a(e)},u=[a,n,i],t[3]=n,t[4]=a,t[5]=i,t[6]=l,t[7]=u):(l=t[6],u=t[7]),z(l,u),null};OC.displayName=`ComposerPrimitive.TriggerPopoverAction`;var kC=e=>{let t=F(7),{formatter:n,onInserted:r}=e,{register:i}=_S(),a=R(r),o,s;t[0]===r?(o=t[1],s=t[2]):(o=()=>{a.current=r},s=[r],t[0]=r,t[1]=o,t[2]=s),Jr(o,s);let c,l;return t[3]!==n||t[4]!==i?(c=()=>i({kind:`directive`,formatter:n??hb,onInserted:e=>a.current?.(e)}),l=[i,n],t[3]=n,t[4]=i,t[5]=c,t[6]=l):(c=t[5],l=t[6]),z(c,l),null};kC.displayName=`ComposerPrimitive.TriggerPopoverDirective`;var AC=Object.assign(vS,{Directive:kC,Action:OC}),jC=Ox({AddAttachment:()=>dC,AttachmentByIndex:()=>Uv,AttachmentDropzone:()=>fC,Attachments:()=>Gv,Cancel:()=>uC,Dictate:()=>pC,DictationTranscript:()=>gC,If:()=>cy,Input:()=>lC,Queue:()=>qv,Quote:()=>vC,QuoteDismiss:()=>bC,QuoteText:()=>yC,Root:()=>DS,Send:()=>xS,StopDictation:()=>mC,TriggerPopover:()=>AC,TriggerPopoverBack:()=>DC,TriggerPopoverCategories:()=>CC,TriggerPopoverCategoryItem:()=>wC,TriggerPopoverItem:()=>EC,TriggerPopoverItems:()=>TC,TriggerPopoverRoot:()=>tS,Unstable_TriggerPopover:()=>AC,Unstable_TriggerPopoverBack:()=>DC,Unstable_TriggerPopoverCategories:()=>CC,Unstable_TriggerPopoverCategoryItem:()=>wC,Unstable_TriggerPopoverItem:()=>EC,Unstable_TriggerPopoverItems:()=>TC,Unstable_TriggerPopoverRoot:()=>tS,unstable_useTriggerPopoverRootContext:()=>Ux,unstable_useTriggerPopoverRootContextOptional:()=>Wx,unstable_useTriggerPopoverScopeContext:()=>mS,unstable_useTriggerPopoverScopeContextOptional:()=>hS,unstable_useTriggerPopoverTriggers:()=>Kx,unstable_useTriggerPopoverTriggersOptional:()=>Xx}),MC=Object.freeze({type:`complete`}),NC=Object.freeze({type:`text`,text:``,status:MC}),PC=()=>q(FC);function FC(e){return e.part.type!==`text`&&e.part.type!==`reasoning`?NC:e.part}var IC=ni(null),LC=e=>({useSmoothStatus:ob(()=>e)}),RC=e=>{let t=F(6),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={optional:!0},t[0]=r):r=t[0];let i=BC(r),a=K(),o;t[1]===a.part?o=t[2]:(o=()=>LC(a.part.getState().status),t[1]=a.part,t[2]=o);let[s]=L(o);if(i)return n;let c;return t[3]!==n||t[4]!==s?(c=(0,I.jsx)(IC.Provider,{value:s,children:n}),t[3]=n,t[4]=s,t[5]=c):c=t[5],c},zC=e=>{let t=B((t,n)=>{let r=F(3),i=t,a;return r[0]!==n||r[1]!==i?(a=(0,I.jsx)(RC,{children:(0,I.jsx)(e,{...i,ref:n})}),r[0]=n,r[1]=i,r[2]=a):a=r[2],a});return t.displayName=e.displayName,t};function BC(e){let t=ii(IC);if(!e?.optional&&!t)throw Error(`This component must be used within a SmoothContextProvider.`);return t}var{useSmoothStatus:VC,useSmoothStatusStore:HC}=Zy(BC,`useSmoothStatus`),UC=250,WC=5,GC=class{animationFrameId=null;lastUpdateTime=0;lastCommitTime=-1/0;targetText=``;drainMs=UC;maxCharIntervalMs=WC;maxCharsPerFrame=1/0;minCommitMs=0;currentText;setText;constructor(e,t){this.currentText=e,this.setText=t}start(){this.animationFrameId===null&&(this.lastUpdateTime=performance.now(),this.animate())}stop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=performance.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(this.maxCharIntervalMs,this.drainMs/n),i=Math.min(n,this.maxCharsPerFrame),a=0;for(;t>=r&&a<i;)a++,t-=r;a===i&&i===this.maxCharsPerFrame&&(t=0),this.animationFrameId=a===n?null:requestAnimationFrame(this.animate),a!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+a),this.lastUpdateTime=e-t,(a===n||e-this.lastCommitTime>=this.minCommitMs)&&(this.lastCommitTime=e,this.setText(this.currentText)))}},KC=Object.freeze({type:`running`}),qC=(e,t)=>e!==void 0&&e>0?e:t,JC=(e,t=!1)=>{let{text:n}=e,r=NS(`(prefers-reduced-motion: reduce)`),i=typeof t==`object`&&t?t:void 0,a=t!==!1&&t!==null&&!r,o=qC(i?.drainMs,UC),s=qC(i?.maxCharIntervalMs,WC),c=qC(i?.maxCharsPerFrame,1/0),l=qC(i?.minCommitMs,0),[u,d]=L(e.status.type===`running`?``:n),f=K(),p=q(()=>f.part),[m,h]=L(p);(p!==m||!n.startsWith(u))&&(h(p),d(e.status.type===`running`?``:n));let g=HC({optional:!0}),_=_x(t=>{if(d(t),g){let n=u!==t||e.status.type===`running`?KC:e.status;lb(g).setState(n,!0)}});z(()=>{if(g){let t=a&&(u!==n||e.status.type===`running`)?KC:e.status;lb(g).setState(t,!0)}},[g,a,n,u,e.status]);let[v]=L(()=>new GC(u,_));z(()=>{v.drainMs=o,v.maxCharIntervalMs=s,v.maxCharsPerFrame=c,v.minCommitMs=l},[v,o,s,c,l]);let y=R(p);return z(()=>{if(!a){v.stop();return}let t=y.current!==p;if(y.current=p,t||!n.startsWith(v.targetText)){e.status.type===`running`?(v.currentText=``,v.targetText=n,v.lastCommitTime=-1/0,v.start()):(v.currentText=n,v.targetText=n,v.stop(),_(n));return}if(v.targetText=n,e.status.type!==`running`){if(v.currentText===``){v.currentText=n,v.stop(),_(n);return}v.start();return}v.start()},[v,a,n,e.status.type,p,_]),z(()=>()=>{v.stop()},[v]),Hr(()=>a?{...e,text:u,status:n===u?e.status:KC}:e,[a,u,e,n])},YC=Object.freeze({type:`complete`}),XC=Object.freeze({type:`image`,image:``,status:YC}),ZC=()=>q(QC);function QC(e){return e.part.type===`image`?e.part:XC}var $C=B(({smooth:e=!0,component:t=Px.span,render:n,...r},i)=>{let{text:a,status:o}=JC(PC(),e),s={"data-status":o.type,...r,ref:i};return n&&ti(n)?jx(n,a,s):(0,I.jsx)(t,{...s,children:a})});$C.displayName=`MessagePartPrimitive.Text`;var ew=B((e,t)=>{let n=F(4),{image:r}=ZC(),i;return n[0]!==t||n[1]!==r||n[2]!==e?(i=(0,I.jsx)(Px.img,{src:r,...e,ref:t}),n[0]=t,n[1]=r,n[2]=e,n[3]=i):i=n[3],i});ew.displayName=`MessagePartPrimitive.Image`;var tw=e=>{let t=F(2),n=R(void 0),r;return t[0]===e?r=t[1]:(r=t=>{n.current&&=(n.current(),void 0),t&&(n.current=e(t))},t[0]=e,t[1]=r),r},nw=(e,t)=>{let n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return 1/0;let r=Number(n[1]),i=n[2];return i===`px`?r:i===`em`?r*(parseFloat(getComputedStyle(t).fontSize)||16):i===`rem`?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):1/0},rw=e=>e.dataset.messageId,iw=()=>{let e=document.createElement(`div`);return e.dataset.auiTopAnchorReserve=``,e.style.height=`0px`,e.style.flexShrink=`0`,e.style.pointerEvents=`none`,e.setAttribute(`aria-hidden`,`true`),e},aw=(e,t)=>{let n=`${t}px`;return e.style.height!==n&&(e.style.height=n,!0)},ow=e=>{let t=window.devicePixelRatio||1;return Math.round(e*t)/t},sw=()=>{let e=F(4),t=K(),n;e[0]===t.message?n=e[1]:(n=()=>t.message,e[0]=t.message,e[1]=n);let r=q(n),i;return e[2]===r?i=e[3]:(i=e=>{let t=!0,n=()=>{r.setIsHovering(!0)},i=()=>{r.setIsHovering(!1)};return e.addEventListener(`mouseenter`,n),e.addEventListener(`mouseleave`,i),e.matches(`:hover`)&&queueMicrotask(()=>{t&&r.setIsHovering(!0)}),()=>{t=!1,e.removeEventListener(`mouseenter`,n),e.removeEventListener(`mouseleave`,i),r.setIsHovering(!1)}},e[2]=r,e[3]=i),tw(i)},cw=()=>{let e=F(2),t=$y(hw),n;return e[0]===t?n=e[1]:(n=e=>e.message.role===`user`&&e.message.index>0&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role===`assistant`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),q(n)},lw=()=>{let e=F(2),t=$y(gw),n;return e[0]===t?n=e[1]:(n=e=>e.message.isLast&&e.message.role===`assistant`&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role===`user`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),q(n)},uw=(e,t)=>{let n=F(3),r;return n[0]!==e||n[1]!==t?(r=n=>{if(e)return t.getState().registerAnchorElement(n)},n[0]=e,n[1]=t,n[2]=r):r=n[2],tw(r)},dw=e=>{let t=F(3),{active:n,threadViewportStore:r}=e,i;return t[0]!==n||t[1]!==r?(i=e=>{if(!n)return;let t=r.getState(),i=t.topAnchorMessageClamp;return t.registerAnchorTargetElement(e,{tallerThan:nw(i.tallerThan,e),visibleHeight:nw(i.visibleHeight,e)})},t[0]=n,t[1]=r,t[2]=i):i=t[2],tw(i)},fw=e=>{let t=F(7),n,r;t[0]===e?(n=t[1],r=t[2]):({forwardedRef:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=sw(),a=xb(n,i),o=q(_w),s;return t[3]!==o||t[4]!==r||t[5]!==a?(s=(0,I.jsx)(Px.div,{...r,ref:a,"data-message-id":o}),t[3]=o,t[4]=r,t[5]=a,t[6]=s):s=t[6],s},pw=e=>{let t=F(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({forwardedRef:n,threadViewportStore:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=sw(),o=cw(),s=lw(),c=uw(o,i),l;t[4]!==s||t[5]!==i?(l={active:s,threadViewportStore:i},t[4]=s,t[5]=i,t[6]=l):l=t[6];let u=dw(l),d=xb(n,a,c,u),f=q(vw),p=o?``:void 0,m=s?``:void 0,h;return t[7]!==f||t[8]!==r||t[9]!==d||t[10]!==p||t[11]!==m?(h=(0,I.jsx)(Px.div,{...r,ref:d,"data-message-id":f,"data-aui-top-anchor-user":p,"data-aui-top-anchor-target":m}),t[7]=f,t[8]=r,t[9]=d,t[10]=p,t[11]=m,t[12]=h):h=t[12],h},mw=B((e,t)=>{let n=F(7),r=eb();if(r.getState().turnAnchor===`top`){let i;return n[0]!==t||n[1]!==e||n[2]!==r?(i=(0,I.jsx)(pw,{...e,forwardedRef:t,threadViewportStore:r}),n[0]=t,n[1]=e,n[2]=r,n[3]=i):i=n[3],i}let i;return n[4]!==t||n[5]!==e?(i=(0,I.jsx)(fw,{...e,forwardedRef:t}),n[4]=t,n[5]=e,n[6]=i):i=n[6],i});mw.displayName=`MessagePrimitive.Root`;function hw(e){return e.topAnchorTurn?.anchorId}function gw(e){return e.topAnchorTurn?.targetId}function _w(e){return e.message.id}function vw(e){return e.message.id}var yw={...B_,Text:()=>(0,I.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,I.jsx)($C,{}),(0,I.jsx)(Zv,{children:(0,I.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Image:()=>(0,I.jsx)(ew,{})},bw=e=>{let t=F(10);if(`children`in e){let n;return t[0]===e.children?n=t[1]:(n=(0,I.jsx)(rv,{children:e.children}),t[0]=e.children,t[1]=n),n}let n,r;t[2]===e?(n=t[3],r=t[4]):({components:n,...r}=e,t[2]=e,t[3]=n,t[4]=r);let i;t[5]===n?i=t[6]:(i=n?{...n,Text:n.Text??yw.Text,Image:n.Image??yw.Image}:yw,t[5]=n,t[6]=i);let a=i,o;return t[7]!==r||t[8]!==a?(o=(0,I.jsx)(rv,{components:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o};bw.displayName=`MessagePrimitive.Parts`;var xw=e=>{let t=F(12),n;return t[0]!==e.assistant||t[1]!==e.copied||t[2]!==e.hasAttachments||t[3]!==e.hasBranches||t[4]!==e.hasContent||t[5]!==e.last||t[6]!==e.lastOrHover||t[7]!==e.speaking||t[8]!==e.submittedFeedback||t[9]!==e.system||t[10]!==e.user?(n=t=>{let{role:n,attachments:r,parts:i,branchCount:a,isLast:o,speech:s,isCopied:c,isHovering:l}=t.message;return!(e.hasBranches===!0&&a<2||e.user===!0&&n!==`user`||e.user===!1&&n===`user`||e.assistant===!0&&n!==`assistant`||e.assistant===!1&&n===`assistant`||e.system===!0&&n!==`system`||e.system===!1&&n===`system`||e.lastOrHover===!0&&!l&&!o||e.last!==void 0&&e.last!==o||e.copied===!0&&!c||e.copied===!1&&c||e.speaking===!0&&s==null||e.speaking===!1&&s!=null||e.hasAttachments===!0&&(n!==`user`||!r?.length)||e.hasAttachments===!1&&n===`user`&&r?.length||e.hasContent===!0&&i.length===0||e.hasContent===!1&&i.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)},t[0]=e.assistant,t[1]=e.copied,t[2]=e.hasAttachments,t[3]=e.hasBranches,t[4]=e.hasContent,t[5]=e.last,t[6]=e.lastOrHover,t[7]=e.speaking,t[8]=e.submittedFeedback,t[9]=e.system,t[10]=e.user,t[11]=n):n=t[11],q(n)},Sw=e=>{let t=F(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),xw(r)?n:null};Sw.displayName=`MessagePrimitive.If`;var Cw=e=>{let{children:t}=e;return ky()===void 0?null:t};Cw.displayName=`MessagePrimitive.Error`;var ww=e=>{let t=new Map;for(let n=0;n<e.length;n++){let r=e[n]?.parentId??n,i=t.get(r)??[];i.push(n),t.set(r,i)}let n=[];for(let[e,r]of t){let t=typeof e==`string`?e:void 0;n.push({groupKey:t,indices:r})}return n},Tw=e=>{let t=F(9),n=q(Iw),r;bb0:{if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],r=e;break bb0}let i;t[1]!==e||t[2]!==n?(i=e(n),t[1]=e,t[2]=n,t[3]=i):i=t[3],r=i}let i=r,a;t[4]===n?a=t[5]:(a=Us(n),t[4]=n,t[5]=a);let o;return t[6]!==i||t[7]!==a?(o={groups:i,partKeys:a},t[6]=i,t[7]=a,t[8]=o):o=t[8],o},Ew=e=>{let t=F(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.toolName?(i=e=>e.tools.toolUIs[r.toolName]?.[0]?.render??n,t[3]=n,t[4]=r.toolName,t[5]=i):i=t[5];let a=q(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,I.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},Dw=e=>{let t=F(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.name?(i=e=>e.dataRenderers.renderers[r.name]?.[0]||(e.dataRenderers.fallbacks[0]??n),t[3]=n,t[4]=r.name,t[5]=i):i=t[5];let a=q(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,I.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},Ow={Text:()=>(0,I.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,I.jsx)($C,{}),(0,I.jsx)(Zv,{children:(0,I.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>(0,I.jsx)(ew,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},kw=e=>{let t=F(50),{components:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?{}:n,t[0]=n,t[1]=r);let{Text:i,Reasoning:a,Image:o,Source:s,File:c,Unstable_Audio:l,tools:u,data:d}=r,f=i===void 0?Ow.Text:i,p=a===void 0?Ow.Reasoning:a,m=o===void 0?Ow.Image:o,h=s===void 0?Ow.Source:s,g=c===void 0?Ow.File:c,_=l===void 0?Ow.Unstable_Audio:l,v;t[2]===u?v=t[3]:(v=u===void 0?{}:u,t[2]=u,t[3]=v);let y=v,b=K(),x=q(Lw),S=x.type;if(S===`tool-call`){let e=b.part.addToolResult,n=b.part.resumeToolCall,r=b.part.respondToToolApproval,i=b.part.unstable_recordInteraction;if(`Override`in y){let a;t[4]===i?a=t[5]:(a=i&&{unstable_recordInteraction:i},t[4]=i,t[5]=a);let o;return t[6]!==e||t[7]!==x||t[8]!==r||t[9]!==n||t[10]!==a||t[11]!==y.Override?(o=(0,I.jsx)(y.Override,{...x,addResult:e,resume:n,respondToApproval:r,...a}),t[6]=e,t[7]=x,t[8]=r,t[9]=n,t[10]=a,t[11]=y.Override,t[12]=o):o=t[12],o}let a;t[13]!==x.toolName||t[14]!==y.Fallback||t[15]!==y.by_name?(a=(y.by_name&&Object.hasOwn(y.by_name,x.toolName)?y.by_name[x.toolName]:void 0)??y.Fallback,t[13]=x.toolName,t[14]=y.Fallback,t[15]=y.by_name,t[16]=a):a=t[16];let o=a,s;t[17]===i?s=t[18]:(s=i&&{unstable_recordInteraction:i},t[17]=i,t[18]=s);let c;return t[19]!==o||t[20]!==e||t[21]!==x||t[22]!==r||t[23]!==n||t[24]!==s?(c=(0,I.jsx)(Ew,{...x,Fallback:o,addResult:e,resume:n,respondToApproval:r,...s}),t[19]=o,t[20]=e,t[21]=x,t[22]=r,t[23]=n,t[24]=s,t[25]=c):c=t[25],c}if(x.status?.type===`requires-action`)throw Error(`Encountered unexpected requires-action status`);switch(S){case`text`:{let e;return t[26]!==f||t[27]!==x?(e=(0,I.jsx)(f,{...x}),t[26]=f,t[27]=x,t[28]=e):e=t[28],e}case`reasoning`:{let e;return t[29]!==p||t[30]!==x?(e=(0,I.jsx)(p,{...x}),t[29]=p,t[30]=x,t[31]=e):e=t[31],e}case`source`:{let e;return t[32]!==h||t[33]!==x?(e=(0,I.jsx)(h,{...x}),t[32]=h,t[33]=x,t[34]=e):e=t[34],e}case`image`:{let e;return t[35]!==m||t[36]!==x?(e=(0,I.jsx)(m,{...x}),t[35]=m,t[36]=x,t[37]=e):e=t[37],e}case`file`:{let e;return t[38]!==g||t[39]!==x?(e=(0,I.jsx)(g,{...x}),t[38]=g,t[39]=x,t[40]=e):e=t[40],e}case`audio`:{let e;return t[41]!==_||t[42]!==x?(e=(0,I.jsx)(_,{...x}),t[41]=_,t[42]=x,t[43]=e):e=t[43],e}case`data`:{let e;t[44]!==d||t[45]!==x.name?(e=(d?.by_name&&Object.hasOwn(d.by_name,x.name)?d.by_name[x.name]:void 0)??d?.Fallback,t[44]=d,t[45]=x.name,t[46]=e):e=t[46];let n=e,r;return t[47]!==n||t[48]!==x?(r=(0,I.jsx)(Dw,{...x,Fallback:n}),t[47]=n,t[48]=x,t[49]=r):r=t[49],r}default:return console.warn(`Unknown message part type: ${S}`),null}},Aw=Zr(e=>{let t=F(5),{partIndex:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,I.jsx)(kw,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,I.jsx)(kd,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),jw=e=>{let t=F(6),{status:n,component:r}=e,i=n.type===`running`,a;t[0]!==r||t[1]!==n?(a=(0,I.jsx)(r,{type:`text`,text:``,status:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,I.jsx)(jd,{text:``,isRunning:i,children:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o},Mw=Object.freeze({type:`complete`}),Nw=Zr(e=>{let t=F(6),{components:n}=e,r=q(Rw);if(n?.Empty){let e;return t[0]!==n.Empty||t[1]!==r?(e=(0,I.jsx)(n.Empty,{status:r}),t[0]=n.Empty,t[1]=r,t[2]=e):e=t[2],e}let i=n?.Text??Ow.Text,a;return t[3]!==r||t[4]!==i?(a=(0,I.jsx)(jw,{status:r,component:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),Pw=e=>{let t=F(11),{groupingFunction:n,components:r}=e,i=q(zw),{groups:a,partKeys:o}=Tw(n),s;bb0:{if(i===0){let e;t[0]===r?e=t[1]:(e=(0,I.jsx)(Nw,{components:r}),t[0]=r,t[1]=e),s=e;break bb0}let e;if(t[2]!==r||t[3]!==a||t[4]!==o){let n;t[6]!==r||t[7]!==o?(n=(e,t)=>{let n=r?.Group??Ow.Group,i=o[e.indices[0]];return(0,I.jsx)(n,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,I.jsx)(Aw,{partIndex:e,components:r},o[e]))},JSON.stringify([`group`,e.groupKey??null,i?.includes(`:`)?`id:${i}`:t]))},t[6]=r,t[7]=o,t[8]=n):n=t[8],e=a.map(n),t[2]=r,t[3]=a,t[4]=o,t[5]=e}else e=t[5];s=e}let c=s,l;return t[9]===c?l=t[10]:(l=(0,I.jsx)(I.Fragment,{children:c}),t[9]=c,t[10]=l),l};Pw.displayName=`MessagePrimitive.Unstable_PartsGrouped`;var Fw=e=>{let t=F(6),n,r;t[0]===e?(n=t[1],r=t[2]):({components:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,I.jsx)(Pw,{...r,components:n,groupingFunction:ww}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i};Fw.displayName=`MessagePrimitive.Unstable_PartsGroupedByParentId`;function Iw(e){return e.message.parts}function Lw(e){return e.part}function Rw(e){return e.message.status??Mw}function zw(e){return e.message.parts.length}var Bw=Ox({AttachmentByIndex:()=>Lv,Attachments:()=>zv,Content:()=>bw,Error:()=>Cw,GenerativeUI:()=>M_,GroupedParts:()=>Tv,If:()=>Sw,PartByIndex:()=>H_,Parts:()=>bw,Quote:()=>Pv,Root:()=>mw,Unstable_PartsGrouped:()=>Pw,Unstable_PartsGroupedByParentId:()=>Fw}),Vw=e=>{let t=F(2),n=_x(e),r;return t[0]===n?r=t[1]:(r=e=>{let t=new ResizeObserver(()=>{n()}),r=new MutationObserver(e=>{e.some(Hw)&&n()});return t.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),r.disconnect()}},t[0]=n,t[1]=r),tw(r)};function Hw(e){return e.type!==`attributes`||e.attributeName!==`style`}var Uw=new Set([`Enter`,` `]),Ww=[`textarea`,`select`,`[contenteditable]:not([contenteditable='false'])`,`input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']):not([type='image']):not([type='range']):not([type='file']):not([type='color'])`].join(`, `),Gw=`[data-message-id]`,Kw=(e,t)=>e.getBoundingClientRect().top-t.getBoundingClientRect().top,qw=e=>{let t=e.querySelector(Gw),n=t?.dataset.messageId;return t&&n?{id:n,offset:Kw(t,e)}:null},Jw=e=>{let{top:t,bottom:n}=e.getBoundingClientRect(),r=null;for(let i of e.querySelectorAll(Gw)){let e=i.getBoundingClientRect();if(e.bottom<=t)continue;if(e.top>=n)break;let a=i.dataset.messageId;if(a){if(e.top>=t)return{id:a,offset:e.top-t};r??={id:a,offset:e.top-t}}}return r},Yw=(e,t)=>{for(let n of e.querySelectorAll(Gw))if(n.dataset.messageId===t)return n;return null},Xw=(e,t,n)=>{let r=Yw(e,t.id);if(!r)return!1;let i=Kw(r,e)-t.offset;return n.current=e.scrollTop+i,Math.abs(i)>=1&&e.scrollTo({top:n.current,behavior:`instant`}),n.current=e.scrollTop,!0},Zw=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{let i=K(),a=R(null),o=q(e=>e.thread.messages.length>0),s=q(e=>e.thread.messages[0]?.id),c=q(e=>e.threadListItem.id),l=q(e=>e.thread.isRunning),u=R(!1),d=R(null),f=eb();e===void 0&&(e=f.getState().turnAnchor!==`top`);let p=R(0),m=R(0),h=R(0),g=R(0),_=R(null),v=R(null),y=R(0),b=R(null),x=R(e),S=R(e);Wr(()=>{let t=S.current;if(S.current=e,t||!e)return;let n=a.current;x.current=n!==null&&es(n)},[e]);let C=Ur(e=>{let t=a.current;t&&(x.current=!0,b.current=e,v.current=null,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),w=Ur(()=>{d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)},[]),T=Ur(e=>{b.current=e,w(),d.current=requestAnimationFrame(()=>{d.current=null,C(e)})},[w,C]);Wr(()=>()=>w(),[w]);let E=Ur(()=>{let e=f.getState();return e.turnAnchor===`top`&&e.element.viewport===a.current&&e.element.anchor!==null},[f]),D=()=>{let t=a.current;if(!t)return;v.current&&Math.abs(t.scrollTop-y.current)>=1&&(v.current=null);let n=f.getState().isAtBottom,r=es(t);if(!(!r&&p.current<t.scrollTop)){let i=ns({scrollTop:p.current,scrollHeight:m.current},t);r?(ts(t)&&(b.current=null),e&&(x.current=!0)):i&&(w(),b.current=null,x.current=!1),(r||b.current===null)&&r!==n&&lb(f).setState({isAtBottom:r})}p.current=t.scrollTop,m.current=t.scrollHeight,_.current=qw(t)},O=Vw(()=>{let t=a.current;if(!t)return;let{scrollHeight:n,clientHeight:r}=t;if(n===h.current&&r===g.current)return;h.current=n,g.current=r;let i=b.current;i&&E()?b.current=null:i?C(i):e&&!(l&&E())&&x.current?C(`instant`):v.current&&!Xw(t,v.current,y)&&(v.current=null),D()}),k=tw(e=>{let t=()=>{w(),b.current=null},n=e=>{Uw.has(e.key)&&(e.target?.closest?.(Ww)||t())},r=()=>{v.current=null},i=[`pointerdown`,`wheel`,`touchstart`,`keydown`];e.addEventListener(`scroll`,D),e.addEventListener(`pointerdown`,t),e.addEventListener(`keydown`,n);for(let t of i)e.addEventListener(t,r,{passive:!0});return()=>{e.removeEventListener(`scroll`,D),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`keydown`,n);for(let t of i)e.removeEventListener(t,r)}}),ee=R({threadId:c,firstMessageId:s});return Wr(()=>{let t=ee.current;if(ee.current={threadId:c,firstMessageId:s},t.threadId!==c){v.current=null;return}let n=a.current,r=t.firstMessageId;if(!n||r===void 0||r===s||e&&x.current||b.current!==null||!i.thread.getState().messages.some((e,t)=>t>0&&e.id===r))return;let o=_.current;if(o?.id===r&&Xw(n,o,y))v.current=Jw(n)??o;else{let e=n.scrollHeight-(m.current-p.current);Math.abs(n.scrollTop-e)>=1&&n.scrollTo({top:e,behavior:`instant`})}p.current=n.scrollTop,m.current=n.scrollHeight},[i,e,s,c]),Wr(()=>{if(n){if(!o){u.current=!1;return}u.current||(u.current=!0,b.current===null&&T(`instant`))}},[o,T,n]),kS(({behavior:e})=>{C(e)}),eu(`thread.runStart`,()=>{v.current=null,t&&f.getState().turnAnchor!==`top`&&T(`auto`)}),eu(`threads.selectionChanged`,()=>{r&&T(`instant`)}),xb(O,k,a)},Qw=ni(void 0),$w=new WeakMap,eT=B((e,t)=>{let n=F(9),r=K(),i=R(null),a=xb(t,i),o;n[0]===e?o=n[1]:(o=t=>{t.key===`Escape`&&i.current&&$w.set(t.nativeEvent,i.current),e.onKeyDown?.(t)},n[0]=e,n[1]=o);let s=o,c,l;n[2]===r?(c=n[3],l=n[4]):(c=()=>{let e=e=>{if(e.key!==`Escape`||PS(e)||e.defaultPrevented||r.thread.source===null)return;let t=$w.get(e)??e.composedPath().find(tT);if(!(t&&t!==i.current)&&r.thread.getState().speech!=null){e.preventDefault();try{r.thread.stopSpeaking()}catch(e){let t=e;if(!(t instanceof Error)||t.message!==`No message is being spoken`)throw t}}};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},l=[r],n[2]=r,n[3]=c,n[4]=l),z(c,l);let u;return n[5]!==a||n[6]!==s||n[7]!==e?(u=(0,I.jsx)(Qw.Provider,{value:i,children:(0,I.jsx)(Px.div,{...e,"data-aui-thread-root":``,ref:a,onKeyDown:s})}),n[5]=a,n[6]=s,n[7]=e,n[8]=u):u=n[8],u});eT.displayName=`ThreadPrimitive.Root`;function tT(e){return e instanceof Element&&e.hasAttribute(`data-aui-thread-root`)}var nT=e=>{let{children:t}=e;return q(rT)?t:null};nT.displayName=`ThreadPrimitive.Empty`;function rT(e){return e.thread.isEmpty}var iT=e=>{let t=F(4),n;return t[0]!==e.disabled||t[1]!==e.empty||t[2]!==e.running?(n=t=>!(e.empty===!0&&!t.thread.isEmpty||e.empty===!1&&t.thread.isEmpty||e.running===!0&&!t.thread.isRunning||e.running===!1&&t.thread.isRunning||e.disabled===!0&&!t.thread.isDisabled||e.disabled===!1&&t.thread.isDisabled),t[0]=e.disabled,t[1]=e.empty,t[2]=e.running,t[3]=n):n=t[3],q(n)},aT=e=>{let t=F(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),iT(r)?n:null};aT.displayName=`ThreadPrimitive.If`;var oT=(e,t)=>{let n=F(3),r;return n[0]!==t||n[1]!==e?(r=n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},a=new ResizeObserver(i);return a.observe(n),i(),()=>{a.disconnect(),r.unregister()}},n[0]=t,n[1]=e,n[2]=r):r=n[2],tw(r)},sT=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},cT=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:sT(e)-sT(t)},lT=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{let i=cT(t,e),a=t.offsetHeight;return i+Math.max(0,a-(a<=n?a:r))},uT=({scrollHeight:e,...t})=>{let{viewport:n}=t,r=lT(t)+n.clientHeight;return Math.max(0,r-e)},dT=({viewport:e,reserve:t,...n})=>uT({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),fT=e=>{let t=new ResizeObserver(e),n=new MutationObserver(e),r=null,i=null,a=null,o=()=>{t.disconnect(),n.disconnect(),r=null,i=null,a=null};return{target:(e,s,c)=>{(r!==e||i!==s||a!==c)&&(o(),t.observe(e),t.observe(s),t.observe(c),n.observe(c,{childList:!0,subtree:!0,characterData:!0}),r=e,i=s,a=c)},disconnect:o}},pT=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},mT=e=>{let t=null,n,r=null,i=0,a=null,o=!1,s=null,c=()=>{a=null,s=null},l=()=>s!==null&&Math.abs(i-s)<=1,u=()=>{let e=r;if(!e)return;let t=e.scrollTop,n=Math.max(0,e.scrollHeight-e.clientHeight);t<i&&i>n+1&&Math.abs(t-n)<=1&&l()&&!o&&(a??=i,p.schedule()),i=t},d=e=>{r!==e&&(r&&r.removeEventListener(`scroll`,u),r=e,o=!1,c(),e&&(e.addEventListener(`scroll`,u,{passive:!0}),i=e.scrollTop))};function f(){let r=e.getState(),{viewport:i,anchor:l,target:u}=r.element,f=r.targetConfig;if(d(r.turnAnchor===`top`?i:null),r.turnAnchor!==`top`||!i){m.disconnect(),c(),t&&(aw(t,0),t.remove());return}if(!l&&!u&&!f&&r.topAnchorTurn){m.disconnect(),c(),t?.parentElement&&t.parentElement.lastElementChild!==t&&t.parentElement.append(t);return}if(!l||!u||!f){m.disconnect(),c(),t&&(aw(t,0),t.remove());return}if(t??=iw(),(t.parentElement!==u.parentElement||t.previousElementSibling!==u)&&u.after(t),m.target(i,l,u),aw(t,dT({viewport:i,anchor:l,reserve:t,...f}))){p.schedule();return}let h=rw(l),g=ow(lT({viewport:i,anchor:l,...f}));if(h===void 0||h!==n)a=null,o=!1,Math.abs(i.scrollTop-g)>1&&i.scrollTo({top:g,behavior:`smooth`}),h!==void 0&&(n=h);else if(a!==null&&s!==null){let e=ow(a+(g-s));a=null,o=!0,Math.abs(i.scrollTop-e)>1&&i.scrollTo({top:e,behavior:`instant`})}s=g}let p=pT(f),m=fT(p.schedule);p.schedule();let h=e.subscribe(p.schedule);return()=>{p.cancel(),h(),m.disconnect(),d(null),t?.remove()}},hT=e=>{let t=F(4),n=eb(),r,i;t[0]!==e||t[1]!==n?(r=()=>{if(e)return mT(n)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),Wr(r,i)},gT=(e,t)=>{if(!e)return!1;let n=t.findIndex(t=>t.id===e.targetId);return n<1?!1:t[n-1]?.id===e.anchorId&&t.slice(n+1).every(e=>e.role===`user`)},_T=({isRunning:e,messages:t})=>{if(!e)return null;let n=t.at(-1),r=t.at(-2);return r?.role!==`user`||n?.role!==`assistant`?null:{anchorId:r.id,targetId:n.id}},vT=e=>_T(e)?.anchorId,yT=e=>_T(e)?.targetId,bT=()=>oT($y(TT),ET),xT=()=>tw($y(DT)),ST=e=>{let t=F(19),n=eb(),r;t[0]===e?r=t[1]:(r=t=>{if(e)return vT(t.thread)},t[0]=e,t[1]=r);let i=q(r),a;t[2]===e?a=t[3]:(a=t=>{if(e)return yT(t.thread)},t[2]=e,t[3]=a);let o=q(a),s=$y(OT),c;bb0:{if(!i||!o){c=null;break bb0}let e;t[4]!==i||t[5]!==o?(e={anchorId:i,targetId:o},t[4]=i,t[5]=o,t[6]=e):e=t[6],c=e}let l=c,u;t[7]!==e||t[8]!==s?(u=t=>e&&!!s&&gT(s,t.thread.messages),t[7]=e,t[8]=s,t[9]=u):u=t[9];let d=q(u),f,p;t[10]!==n||t[11]!==s||t[12]!==d?(f=()=>{!s||d||n.getState().setTopAnchorTurn(null)},p=[n,s,d],t[10]=n,t[11]=s,t[12]=d,t[13]=f,t[14]=p):(f=t[13],p=t[14]),Wr(f,p);let m,h;t[15]!==l||t[16]!==n?(m=()=>{if(!l)return;let e=n.getState(),t=e.topAnchorTurn;(t?.anchorId!==l.anchorId||t.targetId!==l.targetId)&&e.setTopAnchorTurn(l)},h=[l,n],t[15]=l,t[16]=n,t[17]=m,t[18]=h):(m=t[17],h=t[18]),Wr(m,h)},CT=B((e,t)=>{let n=F(18),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c,children:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l;n[7]!==r||n[8]!==o||n[9]!==s||n[10]!==c?(l={autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c},n[7]=r,n[8]=o,n[9]=s,n[10]=c,n[11]=l):l=n[11];let u=Zw(l),d=bT(),f=xT(),p=eb(),m;n[12]===p?m=n[13]:(m=p.getState(),n[12]=p,n[13]=m);let h=m.turnAnchor===`top`;ST(h),hT(h);let g=xb(t,u,d,f),_;return n[14]!==i||n[15]!==g||n[16]!==a?(_=(0,I.jsx)(Px.div,{...a,ref:g,children:i}),n[14]=i,n[15]=g,n[16]=a,n[17]=_):_=n[17],_});CT.displayName=`ThreadPrimitive.ViewportScrollable`;var wT=B((e,t)=>{let n=F(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({turnAnchor:a,topAnchorMessageClamp:i,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]!==i||n[5]!==a?(o={turnAnchor:a,topAnchorMessageClamp:i},n[4]=i,n[5]=a,n[6]=o):o=n[6];let s;n[7]!==r||n[8]!==t?(s=(0,I.jsx)(CT,{...r,ref:t}),n[7]=r,n[8]=t,n[9]=s):s=n[9];let c;return n[10]!==o||n[11]!==s?(c=(0,I.jsx)(db,{options:o,children:s}),n[10]=o,n[11]=s,n[12]=c):c=n[12],c});wT.displayName=`ThreadPrimitive.Viewport`;function TT(e){return e.registerViewport}function ET(e){return e.clientHeight}function DT(e){return e.registerViewportElement}function OT(e){return e.topAnchorTurn}var kT=B((e,t)=>{let n=F(3),r=xb(t,oT($y(AT),jT)),i;return n[0]!==e||n[1]!==r?(i=(0,I.jsx)(Px.div,{...e,ref:r}),n[0]=e,n[1]=r,n[2]=i):i=n[2],i});kT.displayName=`ThreadPrimitive.ViewportFooter`;function AT(e){return e.registerContentInset}function jT(e){let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t}var MT=Fx(`ThreadPrimitive.ScrollToBottom`,e=>{let t=F(5),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{behavior:r}=n,i=$y(NT),a=eb(),o;return t[2]!==r||t[3]!==a?(o=()=>{a.getState().scrollToBottom({behavior:r})},t[2]=r,t[3]=a,t[4]=o):o=t[4],i?null:o},[`behavior`]);function NT(e){return e.isAtBottom}var PT=Fx(`ThreadPrimitive.LoadEarlier`,()=>{let e=F(2),t=K(),n=q(FT),r;return e[0]===t.thread?r=e[1]:(r=()=>{t.thread.loadEarlier()},e[0]=t.thread,e[1]=r),n?r:null});function FT(e){return e.thread.hasEarlier}var IT=Fx(`ThreadPrimitive.Suggestion`,e=>{let t=F(4),{prompt:n,send:r,clearComposer:i,autoSend:a}=e,o=r??a??!1,s;t[0]!==i||t[1]!==n||t[2]!==o?(s={prompt:n,send:o,clearComposer:i},t[0]=i,t[1]=n,t[2]=o,t[3]=s):s=t[3];let{disabled:c,trigger:l}=xy(s);return c?null:l},[`prompt`,`send`,`clearComposer`,`autoSend`,`method`]),LT=Ox({Empty:()=>nT,If:()=>aT,LoadEarlier:()=>PT,MessageByIndex:()=>v_,Messages:()=>S_,Root:()=>eT,Row:()=>Mv,ScrollToBottom:()=>MT,Suggestion:()=>IT,SuggestionByIndex:()=>ry,Suggestions:()=>oy,Unstable_MessageById:()=>y_,Viewport:()=>wT,ViewportFooter:()=>kT,ViewportProvider:()=>db}),RT=B((e,t)=>{let n=F(15),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({onClick:i,disabled:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=q(zT),{switchToNewThread:s}=Dy(),c;n[4]===o?c=n[5]:(c=o?{"data-active":`true`,"aria-current":`true`}:null,n[4]=o,n[5]=c);let l;n[6]!==i||n[7]!==s?(l=ux(i,s),n[6]=i,n[7]=s,n[8]=l):l=n[8];let u;return n[9]!==r||n[10]!==t||n[11]!==a||n[12]!==c||n[13]!==l?(u=(0,I.jsx)(Px.button,{type:`button`,...c,...a,ref:t,disabled:r,onClick:l}),n[9]=r,n[10]=t,n[11]=a,n[12]=c,n[13]=l,n[14]=u):u=n[14],u});RT.displayName=`ThreadListPrimitive.New`;function zT(e){return e.threads.newThreadId===e.threads.mainThreadId}var BT=Fx(`ThreadListPrimitive.LoadMore`,()=>{let{loadMore:e,disabled:t}=Oy();return t?null:e}),[VT,HT]=Xb(`ThreadList`),UT=VT,WT=ni(null),GT=WT.Provider,KT=()=>ii(WT),qT=B((e,t)=>{let n=F(3),r;return n[0]!==e||n[1]!==t?(r=(0,I.jsx)(UT.Provider,{scope:void 0,children:(0,I.jsx)(UT.Slot,{scope:void 0,children:(0,I.jsx)(Px.div,{...e,ref:t})})}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});qT.displayName=`ThreadListPrimitive.Root`;var JT=Ox({ItemByIndex:()=>Jv,Items:()=>Xv,LoadMore:()=>BT,New:()=>RT,Root:()=>qT}),YT=B((e,t)=>{let n=q(e=>e.threads.mainThreadId===e.threadListItem.id),r=R(null),i=R(null),a=Hr(()=>({triggerRef:r,moreRef:i}),[]),o=HT(void 0),s=Sx(),c=e=>{if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=s===`rtl`?`ArrowLeft`:`ArrowRight`,n=s===`rtl`?`ArrowRight`:`ArrowLeft`,a=r.current,c=i.current;if(a&&e.target===a){if(e.key===`ArrowDown`||e.key===`ArrowUp`){let t=o().map(e=>e.ref.current).filter(e=>e!==null),n=t[t.indexOf(a)+(e.key===`ArrowDown`?1:-1)];n&&(n.focus(),e.preventDefault())}else e.key===t&&c&&(c.focus(),e.preventDefault())}else c&&e.target===c&&e.key===n&&(a?.focus(),e.preventDefault())};return(0,I.jsx)(GT,{value:a,children:(0,I.jsx)(Px.div,{...n?{"data-active":`true`,"aria-current":`true`}:null,...e,onKeyDown:ux(e.onKeyDown,c),ref:t})})});YT.displayName=`ThreadListItemPrimitive.Root`;var XT=Fx(`ThreadListItemPrimitive.Archive`,()=>{let{archive:e}=Cy();return e}),ZT=Fx(`ThreadListItemPrimitive.Unarchive`,()=>{let{unarchive:e}=Ty();return e}),QT=Fx(`ThreadListItemPrimitive.Delete`,()=>{let{delete:e}=wy();return e}),$T=Fx(`ThreadListItemPrimitive.Trigger`,()=>{let{switchTo:e}=Ey();return e}),eE=B((e,t)=>{let n=F(3),r=xb(t,KT()?.triggerRef),i;return n[0]!==e||n[1]!==r?(i=(0,I.jsx)(UT.ItemSlot,{scope:void 0,children:(0,I.jsx)($T,{...e,ref:r})}),n[0]=e,n[1]=r,n[2]=i):i=n[2],i});eE.displayName=`ThreadListItemPrimitive.Trigger`;var tE=Ox({Archive:()=>XT,Delete:()=>QT,Root:()=>YT,Title:()=>$v,Trigger:()=>eE,Unarchive:()=>ZT}),nE=`web_chat.unavailable`;function rE(e,t){switch(e){case`web_chat.rate_limited`:return t&&t>0?`You're sending messages too quickly. Please wait a moment and try again.`:`You're sending messages too quickly. Please try again shortly.`;case`web_chat.message_too_long`:return`That message is too long. Please shorten it and try again.`;case`web_chat.busy`:return`The assistant is still replying. Please wait for it to finish.`;case`web_chat.limit_reached`:return`This conversation has reached its limit. Start a new one.`;case`guide.message_too_long`:return`That message is too long. Please shorten it and try again.`;case`guide.busy`:return`Stageflow is still replying. Please wait for it to finish.`;case`guide.not_found`:return`This conversation is no longer available. Start a new chat.`;case`guide.invalid`:return`That message couldn't be sent.`;case`guide.attachment`:return`Those files couldn't be attached. Use up to 5 text files, 256 KB each.`;case`guide.unavailable`:return`Stageflow isn't available right now.`;case nE:return`This chat isn't available right now.`;default:return`Something went wrong. Please try again.`}}function iE(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`delta`:return typeof t.text==`string`?{type:`delta`,text:t.text}:null;case`waiting`:return{type:`waiting`};case`done`:{let e=t.message;return!e||typeof e.id!=`string`||typeof e.text!=`string`?null:{type:`done`,message:{id:e.id,role:`assistant`,text:e.text,createdAt:typeof e.createdAt==`string`?e.createdAt:new Date().toISOString()}}}case`error`:return{type:`error`,code:typeof t.code==`string`?t.code:`web_chat.failed`,message:typeof t.message==`string`?t.message:``,...typeof t.retryAfterSec==`number`&&Number.isFinite(t.retryAfterSec)?{retryAfterSec:t.retryAfterSec}:{}};default:return null}}async function*aE(e,t=iE){let n=e.getReader(),r=new TextDecoder,i=``,a=e=>{let n=e.trim();if(!n)return null;try{return t(JSON.parse(n))}catch{return null}};try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,{stream:!0});let o=i.indexOf(`
|
|
16
|
+
`);for(;o>=0;){let e=a(i.slice(0,o));i=i.slice(o+1),e&&(yield e),o=i.indexOf(`
|
|
17
|
+
`)}}i+=r.decode();let e=a(i);e&&(yield e)}finally{n.releaseLock()}}var oE=class extends Error{code;status;retryAfterSec;constructor(e,t,n,r){super(n),this.code=e,this.status=t,this.retryAfterSec=r,this.name=`ChatApiError`}};async function sE(e){let t={};try{t=await e.json()}catch{}let n=typeof t.code==`string`?t.code:e.status===404?nE:`web_chat.failed`,r=typeof t.retryAfterSec==`number`?t.retryAfterSec:Number(e.headers.get(`retry-after`))||void 0;return new oE(n,e.status,typeof t.message==`string`?t.message:``,r)}function cE({apiBase:e,slug:t,visitorId:n,fetchImpl:r}){let i=`${e}/${encodeURIComponent(t)}`,a=(e,t={})=>(r??fetch)(`${i}${e}`,{...t,headers:{"x-visitor-id":n,...t.body?{"content-type":`application/json`}:{},...t.headers}});async function o(e,t){let n=await a(e,t);if(!n.ok)throw await sE(n);return await n.json()}return{info:async()=>{let e=await o(``);return{name:e.agent.name,greeting:e.agent.greeting??null}},listThreads:async()=>(await o(`/threads`)).threads,createThread:async()=>(await o(`/threads`,{method:`POST`,body:`{}`})).thread,getThread:e=>o(`/threads/${encodeURIComponent(e)}`),async*sendMessage(e,t,n){let r=await a(`/threads/${encodeURIComponent(e)}/messages`,{method:`POST`,body:JSON.stringify({text:t}),...n?{signal:n}:{}});if(!r.ok)throw await sE(r);if(!r.body)throw new oE(`web_chat.failed`,r.status,``);yield*aE(r.body)}}}function lE(e,t,n){return{code:e,message:t,...n===void 0?{}:{retryAfterSec:n},friendly:rE(e,n)}}function uE(e){return{async list(){return{threads:(await e.listThreads()).map(e=>({status:`regular`,remoteId:e.id,title:e.title||void 0,lastMessageAt:new Date(e.updatedAt)}))}},async initialize(){return{remoteId:(await e.createThread()).id}},async fetch(t){let{thread:n}=await e.getThread(t);return{status:`regular`,remoteId:n.id,title:n.title||void 0,lastMessageAt:new Date(n.updatedAt)}},async rename(){},async archive(){},async unarchive(){},async delete(){},async generateTitle(e,t){let n=t.find(e=>e.role===`user`)?.content.map(e=>e.type===`text`?e.text:``).join(` `)??``;return gl(e=>{e.appendText(dE(n))})}}}function dE(e){let t=e.replace(/\s+/g,` `).trim();return t?t.length>48?`${t.slice(0,47).trimEnd()}…`:t:`New chat`}function fE(e){return e.map(e=>({id:e.id,role:e.role,content:[{type:`text`,text:e.text}],createdAt:new Date(e.createdAt),...e.role===`assistant`?{status:{type:`complete`,reason:`stop`}}:{}}))}function pE(e){return([...e.messages].reverse().find(e=>e.role===`user`)?.content??[]).map(e=>e.type===`text`?e.text:``).join(``).trim()}function mE(e,t){return{async*run(n){let r=pE(n);if(!r)return;let i=``,a=()=>[{type:`text`,text:i}];try{let o=await t();for await(let t of e.sendMessage(o,r,n.abortSignal))if(t.type===`delta`)i+=t.text,yield{content:a(),metadata:{custom:{waiting:!1}}};else if(t.type===`waiting`)yield{content:a(),metadata:{custom:{waiting:!0}}};else if(t.type===`done`){yield{content:[{type:`text`,text:t.message.text}],status:{type:`complete`,reason:`stop`},metadata:{custom:{waiting:!1}}};return}else{yield hE(i,lE(t.code,t.message,t.retryAfterSec));return}i?yield{content:a(),status:{type:`complete`,reason:`stop`},metadata:{custom:{waiting:!1}}}:yield hE(i,lE(`web_chat.failed`,``))}catch(e){if(n.abortSignal.aborted)return;let t=e instanceof oE?lE(e.code,e.message,e.retryAfterSec):lE(`web_chat.failed`,``);yield hE(i,t)}}}}function hE(e,t){return{content:[{type:`text`,text:e}],status:{type:`incomplete`,reason:`error`,error:t},metadata:{custom:{waiting:!1}}}}export{sn as $,ce as $n,ot as $t,qf as A,ke as An,kt as At,F as B,ye as Bn,yt as Bt,Ox as C,Ie as Cn,It as Ct,mm as D,Me as Dn,Mt as Dt,Jy as E,Ne as En,Nt as Et,Cd as F,we as Fn,Tt as Ft,hn as G,me as Gn,mt as Gt,vn as H,_e as Hn,vt as Ht,_s as I,Ce as In,wt as It,pn as J,de as Jn,dt as Jt,mn as K,pe as Kn,pt as Kt,q as L,Se as Ln,Ct as Lt,Kf as M,De as Mn,Ot as Mt,Gf as N,Ee as Nn,St as Nt,gp as O,je as On,At as Ot,Df as P,Te as Pn,Et as Pt,cn as Q,N as Qn,st as Qt,K as R,xe as Rn,xt as Rt,Px as S,Re as Sn,Lt as St,qy as T,Pe as Tn,Pt as Tt,_n as U,ge as Un,gt as Ut,Sn as V,ve as Vn,_t as Vt,gn as W,he as Wn,ht as Wt,un as X,P as Xn,lt as Xt,fn as Y,ue as Yn,ut as Yt,ln as Z,le as Zn,ct as Zt,zC as _,Ue as _n,s as _r,Ht as _t,oE as a,et as an,ae as ar,en as at,Lx as b,Le as bn,zt as bt,iE as c,Ze as cn,ne as cr,Ut as ct,tE as d,Ye as dn,k as dr,Yt as dt,at as en,oe as er,on as et,JT as f,Ke as fn,O as fr,Jt as ft,VC as g,He as gn,l as gr,Wt as gt,JC as h,We as hn,T as hr,Gt as ht,fE as i,tt as in,A as ir,tn as it,Qf as j,Oe as jn,Dt as jt,ip as k,Ae as kn,jt as kt,nE as l,Xe as ln,te as lr,Zt as lt,Bw as m,Ge as mn,E as mr,Kt as mt,uE as n,nt as nn,M as nr,rn as nt,cE as o,$e as on,ie as or,$t as ot,LT as p,qe as pn,D as pr,qt as pt,dn as q,fe as qn,ft as qt,lE as r,rt as rn,j as rr,nn as rt,aE as s,Qe as sn,re as sr,Qt as st,mE as t,it as tn,se as tr,an as tt,rE as u,Je as un,ee as ur,Xt as ut,PC as v,Ve as vn,Vt as vt,pb as w,Fe as wn,Ft as wt,Fx as x,ze as xn,Rt as xt,jC as y,Be as yn,Bt as yt,B as z,be as zn,bt as zt};
|