orbitchat 3.10.8 → 3.11.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/bin/orbitchat.js +4 -0
- package/dist/assets/ChartRenderer-6ita77oC.js +97 -0
- package/dist/assets/{MermaidRenderer-BNgxU_bM.js → MermaidRenderer-B_R73JsW.js} +60 -60
- package/dist/assets/MusicRenderer-CPyadT-W.js +18 -0
- package/dist/assets/SVGRenderer-Cchy5MKU.js +6 -0
- package/dist/assets/architectureDiagram-3BPJPVTR-Bz1EN93N.js +36 -0
- package/dist/assets/{blockDiagram-GPEHLZMM-C_xOdSW3.js → blockDiagram-GPEHLZMM-CHYDm_Lr.js} +2 -2
- package/dist/assets/{c4Diagram-AAUBKEIU-CfvQYM_q.js → c4Diagram-AAUBKEIU-B_6S0PMo.js} +4 -4
- package/dist/assets/channel-CWHSY5eE.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-DeY8TrNw.js → chunk-2J33WTMH-BV3EfJJt.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-DIj3bLrU.js → chunk-4BX2VUAB-BcKFg9ac.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-I4-oEJEd.js → chunk-55IACEB6-CxpA0yYo.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-DCx2l0Oh.js → chunk-727SXJPM-C6ztUlOi.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-D4KlRvHF.js → chunk-AQP2D5EJ-D0QacfL_.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-CqHLqk3L.js → chunk-FMBD7UC4-BpZP0Y5U.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-CHJjdC0m.js → chunk-ND2GUHAM-CIMv0vkh.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-slcsUOxD.js → chunk-QZHKN3VN-BLoQ7vNo.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-BwRqrNXe.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-BwRqrNXe.js +1 -0
- package/dist/assets/cose-bilkent-S5V4N54A-mbAzpJrA.js +1 -0
- package/dist/assets/dagre-BM42HDAG-BQ7-MHMw.js +4 -0
- package/dist/assets/diagram-2AECGRRQ-C0ZixFtN.js +43 -0
- package/dist/assets/diagram-5GNKFQAL-DBgq4hcl.js +10 -0
- package/dist/assets/{diagram-KO2AKTUF-7mueA6fZ.js → diagram-KO2AKTUF-CqwtJ8Ej.js} +2 -2
- package/dist/assets/diagram-LMA3HP47-D6J87aBh.js +24 -0
- package/dist/assets/diagram-OG6HWLK6-Bf54QS67.js +24 -0
- package/dist/assets/{erDiagram-TEJ5UH35-hortthG_.js → erDiagram-TEJ5UH35-qNkhON0R.js} +13 -13
- package/dist/assets/{flowDiagram-I6XJVG4X-DgvKpDc5.js → flowDiagram-I6XJVG4X-BwQGcinJ.js} +2 -2
- package/dist/assets/{ganttDiagram-6RSMTGT7-DR5xWqhT.js → ganttDiagram-6RSMTGT7-B-WPdey_.js} +2 -2
- package/dist/assets/gitGraphDiagram-PVQCEYII-DFG0aAjb.js +106 -0
- package/dist/assets/graphExportUtils-DrqBjeAI.js +1 -0
- package/dist/assets/index-DWeVNozJ.js +379 -0
- package/dist/assets/index-UF7Fwxkp.css +1 -0
- package/dist/assets/infoDiagram-5YYISTIA-C02VmOAb.js +2 -0
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-8YrFferA.js → ishikawaDiagram-YF4QCWOH-Btfoip0T.js} +2 -2
- package/dist/assets/{journeyDiagram-JHISSGLW-Bix7jj_6.js → journeyDiagram-JHISSGLW-MVzNSI30.js} +4 -4
- package/dist/assets/{kanban-definition-UN3LZRKU-CJP7JJpX.js → kanban-definition-UN3LZRKU-BnLLL1jo.js} +9 -9
- package/dist/assets/{mindmap-definition-RKZ34NQL-Dk78wf-k.js → mindmap-definition-RKZ34NQL-tn7nCqb-.js} +2 -2
- package/dist/assets/pieDiagram-4H26LBE5-CHgnNebB.js +30 -0
- package/dist/assets/{quadrantDiagram-W4KKPZXB-DhA3Ltj3.js → quadrantDiagram-W4KKPZXB-Bm7UohUT.js} +2 -2
- package/dist/assets/{requirementDiagram-4Y6WPE33-BwRKT1Ti.js → requirementDiagram-4Y6WPE33-BP-byfJK.js} +2 -2
- package/dist/assets/sankeyDiagram-5OEKKPKP-CxvcmFYi.js +40 -0
- package/dist/assets/{sequenceDiagram-3UESZ5HK-IjZb9M7w.js → sequenceDiagram-3UESZ5HK-BFEVEsXC.js} +14 -14
- package/dist/assets/stateDiagram-AJRCARHV-DEYpacKC.js +1 -0
- package/dist/assets/stateDiagram-v2-BHNVJYJU-BBm-kMbL.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-ZZ8vXqsw.js → timeline-definition-PNZ67QCA-IXjMR4fY.js} +2 -2
- package/dist/assets/{vendor-auth-CF3lY_Q5.js → vendor-auth-BWxE55Ta.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-Dqi0_zje.js → vennDiagram-CIIHVFJN-DznHQ1BW.js} +2 -2
- package/dist/assets/{wardleyDiagram-YWT4CUSO-D7_vAxp3.js → wardleyDiagram-YWT4CUSO-BV1onbUZ.js} +2 -2
- package/dist/assets/{xychartDiagram-2RQKCTM6-BgFNWh3u.js → xychartDiagram-2RQKCTM6-45qjdQfn.js} +2 -2
- package/dist/index.html +3 -3
- package/package.json +5 -3
- package/dist/assets/ChartRenderer-DmEe5ux0.js +0 -105
- package/dist/assets/MusicRenderer-fgx5dq-k.js +0 -18
- package/dist/assets/SVGRenderer-CZNFFAA_.js +0 -6
- package/dist/assets/architectureDiagram-3BPJPVTR-Bfi6eFLn.js +0 -36
- package/dist/assets/channel-zLwrxaPB.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-CDbYhIhU.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-CDbYhIhU.js +0 -1
- package/dist/assets/cose-bilkent-S5V4N54A-HnZrIUzr.js +0 -1
- package/dist/assets/dagre-BM42HDAG-Cl88doFf.js +0 -4
- package/dist/assets/diagram-2AECGRRQ-2lPidS0l.js +0 -43
- package/dist/assets/diagram-5GNKFQAL-_tROgYB3.js +0 -10
- package/dist/assets/diagram-LMA3HP47-BxKOasa5.js +0 -24
- package/dist/assets/diagram-OG6HWLK6-Bwf3i6eI.js +0 -24
- package/dist/assets/gitGraphDiagram-PVQCEYII-RJLy0nV8.js +0 -106
- package/dist/assets/index-DnyY0OCY.js +0 -366
- package/dist/assets/index-DqIwGcah.css +0 -1
- package/dist/assets/infoDiagram-5YYISTIA-CdzF2MjL.js +0 -2
- package/dist/assets/pieDiagram-4H26LBE5-DkAjb9PV.js +0 -30
- package/dist/assets/sankeyDiagram-5OEKKPKP-Cq7Z3xZr.js +0 -40
- package/dist/assets/stateDiagram-AJRCARHV-CbH0JxsR.js +0 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-CzKw24Ws.js +0 -1
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MermaidRenderer-BNgxU_bM.js","assets/vendor-markdown-BRX1CUPf.js","assets/vendor-syntax-DG6Vo7Ci.js","assets/purify.es-D6gMnemd.js","assets/isPrototype-DezZrpQP.js","assets/SVGRenderer-CZNFFAA_.js","assets/ChartRenderer-DmEe5ux0.js","assets/band-CquvqAHh.js","assets/init-Dmth1JHB.js","assets/ordinal-DILIJJjt.js","assets/linear-BGneeY6s.js","assets/defaultLocale-DX6XiGOO.js","assets/time-DJ0lCX4i.js","assets/vendor-react-BAJBiXxk.js","assets/vendor-auth-CF3lY_Q5.js","assets/MusicRenderer-fgx5dq-k.js","assets/papaparse.min-BWA-Odol.js","assets/docx-preview-CMb3nQfR.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var hx=Object.defineProperty;var px=(r,l,i)=>l in r?hx(r,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[l]=i;var xa=(r,l,i)=>px(r,typeof l!="symbol"?l+"":l,i);import{a as gx,r as g,j as u,k as pd,R as Rn,M as xx,b as rp,d as bx,e as yx}from"./vendor-markdown-BRX1CUPf.js";import{r as Pp}from"./vendor-react-BAJBiXxk.js";import{_ as Un,h as vx}from"./vendor-syntax-DG6Vo7Ci.js";import{u as gd,a as xd,b as wx,P as Sx,M as kx,A as _x}from"./vendor-auth-CF3lY_Q5.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();var Zu={exports:{}},li={},Ku={exports:{}},Ju={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* scheduler.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var sp;function Ax(){return sp||(sp=1,(function(r){function l(E,Y){var B=E.length;E.push(Y);e:for(;0<B;){var re=B-1>>>1,ce=E[re];if(0<d(ce,Y))E[re]=Y,E[B]=ce,B=re;else break e}}function i(E){return E.length===0?null:E[0]}function c(E){if(E.length===0)return null;var Y=E[0],B=E.pop();if(B!==Y){E[0]=B;e:for(var re=0,ce=E.length,ge=ce>>>1;re<ge;){var pe=2*(re+1)-1,G=E[pe],me=pe+1,de=E[me];if(0>d(G,B))me<ce&&0>d(de,G)?(E[re]=de,E[me]=B,re=me):(E[re]=G,E[pe]=B,re=pe);else if(me<ce&&0>d(de,B))E[re]=de,E[me]=B,re=me;else break e}}return Y}function d(E,Y){var B=E.sortIndex-Y.sortIndex;return B!==0?B:E.id-Y.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,p=h.now();r.unstable_now=function(){return h.now()-p}}var x=[],v=[],b=1,w=null,k=3,S=!1,_=!1,A=!1,D=!1,O=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function z(E){for(var Y=i(v);Y!==null;){if(Y.callback===null)c(v);else if(Y.startTime<=E)c(v),Y.sortIndex=Y.expirationTime,l(x,Y);else break;Y=i(v)}}function H(E){if(A=!1,z(E),!_)if(i(x)!==null)_=!0,K||(K=!0,ue());else{var Y=i(v);Y!==null&&oe(H,Y.startTime-E)}}var K=!1,j=-1,q=5,V=-1;function I(){return D?!0:!(r.unstable_now()-V<q)}function P(){if(D=!1,K){var E=r.unstable_now();V=E;var Y=!0;try{e:{_=!1,A&&(A=!1,ee(j),j=-1),S=!0;var B=k;try{t:{for(z(E),w=i(x);w!==null&&!(w.expirationTime>E&&I());){var re=w.callback;if(typeof re=="function"){w.callback=null,k=w.priorityLevel;var ce=re(w.expirationTime<=E);if(E=r.unstable_now(),typeof ce=="function"){w.callback=ce,z(E),Y=!0;break t}w===i(x)&&c(x),z(E)}else c(x);w=i(x)}if(w!==null)Y=!0;else{var ge=i(v);ge!==null&&oe(H,ge.startTime-E),Y=!1}}break e}finally{w=null,k=B,S=!1}Y=void 0}}finally{Y?ue():K=!1}}}var ue;if(typeof U=="function")ue=function(){U(P)};else if(typeof MessageChannel<"u"){var _e=new MessageChannel,te=_e.port2;_e.port1.onmessage=P,ue=function(){te.postMessage(null)}}else ue=function(){O(P,0)};function oe(E,Y){j=O(function(){E(r.unstable_now())},Y)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(E){E.callback=null},r.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"):q=0<E?Math.floor(1e3/E):5},r.unstable_getCurrentPriorityLevel=function(){return k},r.unstable_next=function(E){switch(k){case 1:case 2:case 3:var Y=3;break;default:Y=k}var B=k;k=Y;try{return E()}finally{k=B}},r.unstable_requestPaint=function(){D=!0},r.unstable_runWithPriority=function(E,Y){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var B=k;k=E;try{return Y()}finally{k=B}},r.unstable_scheduleCallback=function(E,Y,B){var re=r.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?re+B:re):B=re,E){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=B+ce,E={id:b++,callback:Y,priorityLevel:E,startTime:B,expirationTime:ce,sortIndex:-1},B>re?(E.sortIndex=B,l(v,E),i(x)===null&&E===i(v)&&(A?(ee(j),j=-1):A=!0,oe(H,B-re))):(E.sortIndex=ce,l(x,E),_||S||(_=!0,K||(K=!0,ue()))),E},r.unstable_shouldYield=I,r.unstable_wrapCallback=function(E){var Y=k;return function(){var B=k;k=Y;try{return E.apply(this,arguments)}finally{k=B}}}})(Ju)),Ju}var ip;function Cx(){return ip||(ip=1,Ku.exports=Ax()),Ku.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-dom-client.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var op;function jx(){if(op)return li;op=1;var r=Cx(),l=gx(),i=Pp();function c(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}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 d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(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 p(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 x(e){if(f(e)!==e)throw Error(c(188))}function v(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(c(188));return t!==e?null:e}for(var a=e,n=t;;){var s=a.return;if(s===null)break;var o=s.alternate;if(o===null){if(n=s.return,n!==null){a=n;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===a)return x(s),e;if(o===n)return x(s),t;o=o.sibling}throw Error(c(188))}if(a.return!==n.return)a=s,n=o;else{for(var m=!1,y=s.child;y;){if(y===a){m=!0,a=s,n=o;break}if(y===n){m=!0,n=s,a=o;break}y=y.sibling}if(!m){for(y=o.child;y;){if(y===a){m=!0,a=o,n=s;break}if(y===n){m=!0,n=o,a=s;break}y=y.sibling}if(!m)throw Error(c(189))}}if(a.alternate!==n)throw Error(c(190))}if(a.tag!==3)throw Error(c(188));return a.stateNode.current===a?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,k=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),U=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function ue(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var _e=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_e?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case O:return"Profiler";case D:return"StrictMode";case H:return"Suspense";case K:return"SuspenseList";case V:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case U:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case j:return t=e.displayName||null,t!==null?t:te(e.type)||"Memo";case q:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var oe=Array.isArray,E=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},re=[],ce=-1;function ge(e){return{current:e}}function pe(e){0>ce||(e.current=re[ce],re[ce]=null,ce--)}function G(e,t){ce++,re[ce]=e.current,e.current=t}var me=ge(null),de=ge(null),fe=ge(null),ye=ge(null);function ae(e,t){switch(G(fe,t),G(de,e),G(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Nh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Nh(t),e=Th(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}pe(me),G(me,e)}function ie(){pe(me),pe(de),pe(fe)}function xe(e){e.memoizedState!==null&&G(ye,e);var t=me.current,a=Th(t,e.type);t!==a&&(G(de,e),G(me,a))}function Ne(e){de.current===e&&(pe(me),pe(de)),ye.current===e&&(pe(ye),ei._currentValue=B)}var ve,Te;function Le(e){if(ve===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||"",Te=-1<a.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+ve+e+Te}var qe=!1;function Be(e,t){if(!e||qe)return"";qe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch(F){var $=F}Reflect.construct(e,[],Z)}else{try{Z.call()}catch(F){$=F}e.call(Z.prototype)}}else{try{throw Error()}catch(F){$=F}(Z=e())&&typeof Z.catch=="function"&&Z.catch(function(){})}}catch(F){if(F&&$&&typeof F.stack=="string")return[F.stack,$.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=n.DetermineComponentFrameRoot(),m=o[0],y=o[1];if(m&&y){var C=m.split(`
|
|
21
|
-
`),R=y.split(`
|
|
22
|
-
`);for(s=n=0;n<C.length&&!C[n].includes("DetermineComponentFrameRoot");)n++;for(;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;if(n===C.length||s===R.length)for(n=C.length-1,s=R.length-1;1<=n&&0<=s&&C[n]!==R[s];)s--;for(;1<=n&&0<=s;n--,s--)if(C[n]!==R[s]){if(n!==1||s!==1)do if(n--,s--,0>s||C[n]!==R[s]){var X=`
|
|
23
|
-
`+C[n].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=n&&0<=s);break}}}finally{qe=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Le(a):""}function Ge(e,t){switch(e.tag){case 26:case 27:case 5:return Le(e.type);case 16:return Le("Lazy");case 13:return e.child!==t&&t!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return Be(e.type,!1);case 11:return Be(e.type.render,!1);case 1:return Be(e.type,!0);case 31:return Le("Activity");default:return""}}function He(e){try{var t="",a=null;do t+=Ge(e,a),a=e,e=e.return;while(e);return t}catch(n){return`
|
|
24
|
-
Error generating stack: `+n.message+`
|
|
25
|
-
`+n.stack}}var vt=Object.prototype.hasOwnProperty,st=r.unstable_scheduleCallback,se=r.unstable_cancelCallback,Ee=r.unstable_shouldYield,zt=r.unstable_requestPaint,we=r.unstable_now,Xt=r.unstable_getCurrentPriorityLevel,sn=r.unstable_ImmediatePriority,Dt=r.unstable_UserBlockingPriority,Ft=r.unstable_NormalPriority,Hl=r.unstable_LowPriority,ya=r.unstable_IdlePriority,wn=r.log,On=r.unstable_setDisableYieldValue,Lt=null,_t=null;function ia(e){if(typeof wn=="function"&&On(e),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(Lt,e)}catch{}}var Re=Math.clz32?Math.clz32:Me,oa=Math.log,za=Math.LN2;function Me(e){return e>>>=0,e===0?32:31-(oa(e)/za|0)|0}var Qe=256,it=262144,be=4194304;function It(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 Rt(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var s=0,o=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var y=n&134217727;return y!==0?(n=y&~o,n!==0?s=It(n):(m&=y,m!==0?s=It(m):a||(a=y&~e,a!==0&&(s=It(a))))):(y=n&~o,y!==0?s=It(y):m!==0?s=It(m):a||(a=n&~e,a!==0&&(s=It(a)))),s===0?0:t!==0&&t!==s&&(t&o)===0&&(o=s&-s,a=t&-t,o>=a||o===32&&(a&4194048)!==0)?t:s}function on(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function da(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 sl(){var e=be;return be<<=1,(be&62914560)===0&&(be=4194304),e}function il(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Ga(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ca(e,t,a,n,s,o){var m=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var y=e.entanglements,C=e.expirationTimes,R=e.hiddenUpdates;for(a=m&~a;0<a;){var X=31-Re(a),Z=1<<X;y[X]=0,C[X]=-1;var $=R[X];if($!==null)for(R[X]=null,X=0;X<$.length;X++){var F=$[X];F!==null&&(F.lane&=-536870913)}a&=~Z}n!==0&&Fl(e,n,0),o!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=o&~(m&~t))}function Fl(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-Re(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|a&261930}function Il(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var n=31-Re(a),s=1<<n;s&t|e[n]&t&&(e[n]|=t),a&=~s}}function $n(e,t){var a=t&-t;return a=(a&42)!==0?1:cn(a),(a&(e.suspendedLanes|t))!==0?0:a}function cn(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 qn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function un(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:Ph(e.type))}function fa(e,t){var a=Y.p;try{return Y.p=e,t()}finally{Y.p=a}}var Kt=Math.random().toString(36).slice(2),jt="__reactFiber$"+Kt,Ut="__reactProps$"+Kt,va="__reactContainer$"+Kt,Gl="__reactEvents$"+Kt,Gt="__reactListeners$"+Kt,Vl="__reactHandles$"+Kt,Sn="__reactResources$"+Kt,kn="__reactMarker$"+Kt;function Va(e){delete e[jt],delete e[Ut],delete e[Gl],delete e[Gt],delete e[Vl]}function Yt(e){var t=e[jt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[va]||a[jt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Uh(e);e!==null;){if(a=e[jt])return a;e=Uh(e)}return t}e=a,a=e.parentNode}return null}function wa(e){if(e=e[jt]||e[va]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Bn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function _n(e){var t=e[Sn];return t||(t=e[Sn]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ot(e){e[kn]=!0}var Xl=new Set,ol={};function Sa(e,t){Xa(e,t),Xa(e+"Capture",t)}function Xa(e,t){for(ol[e]=t,e=0;e<t.length;e++)Xl.add(t[e])}var W=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]*$"),$e={},he={};function Ze(e){return vt.call(he,e)?!0:vt.call($e,e)?!1:W.test(e)?he[e]=!0:($e[e]=!0,!1)}function Jt(e,t,a){if(Ze(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Ot(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Pt(e,t,a,n){if(n===null)e.removeAttribute(a);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+n)}}function ka(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mi(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yl(e,t,a){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(m){a=""+m,o.call(this,m)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(m){a=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xr(e){if(!e._valueTracker){var t=mi(e)?"checked":"value";e._valueTracker=Yl(e,t,""+e[t])}}function br(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=mi(e)?e.checked?"true":"false":e.value),e=n,e!==a?(t.setValue(e),!0):!1}function yr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Jo=/[\n"\\]/g;function ma(e){return e.replace(Jo,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ds(e,t,a,n,s,o,m,y){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ka(t)):e.value!==""+ka(t)&&(e.value=""+ka(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?dn(e,m,ka(t)):a!=null?dn(e,m,ka(a)):n!=null&&e.removeAttribute("value"),s==null&&o!=null&&(e.defaultChecked=!!o),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+ka(y):e.removeAttribute("name")}function fs(e,t,a,n,s,o,m,y){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||a!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){xr(e);return}a=a!=null?""+ka(a):"",t=t!=null?""+ka(t):a,y||t===e.value||(e.value=t),e.defaultValue=t}n=n??s,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=y?e.checked:!!n,e.defaultChecked=!!n,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),xr(e)}function dn(e,t,a){t==="number"&&yr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function cl(e,t,a,n){if(e=e.options,t){t={};for(var s=0;s<a.length;s++)t["$"+a[s]]=!0;for(a=0;a<e.length;a++)s=t.hasOwnProperty("$"+e[a].value),e[a].selected!==s&&(e[a].selected=s),s&&n&&(e[a].defaultSelected=!0)}else{for(a=""+ka(a),t=null,s=0;s<e.length;s++){if(e[s].value===a){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function ms(e,t,a){if(t!=null&&(t=""+ka(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+ka(a):""}function fn(e,t,a,n){if(t==null){if(n!=null){if(a!=null)throw Error(c(92));if(oe(n)){if(1<n.length)throw Error(c(93));n=n[0]}a=n}a==null&&(a=""),t=a}a=ka(t),e.defaultValue=a,n=e.textContent,n===a&&n!==""&&n!==null&&(e.value=n),xr(e)}function ul(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var hi=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 hs(e,t,a){var n=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,a):typeof a!="number"||a===0||hi.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function dl(e,t,a){if(t!=null&&typeof t!="object")throw Error(c(62));if(e=e.style,a!=null){for(var n in a)!a.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var s in t)n=t[s],t.hasOwnProperty(s)&&a[s]!==n&&hs(e,s,n)}else for(var o in t)t.hasOwnProperty(o)&&hs(e,o,t[o])}function Ql(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 ha=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"]]),vr=/^[\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 fl(e){return vr.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ya(){}var wt=null;function wr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mn=null,Qa=null;function ps(e){var t=wa(e);if(t&&(e=t.stateNode)){var a=e[Ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(ds(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+ma(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var s=n[Ut]||null;if(!s)throw Error(c(90));ds(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<a.length;t++)n=a[t],n.form===e.form&&br(n)}break e;case"textarea":ms(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&cl(e,!!a.multiple,t,!1)}}}var ml=!1;function Sr(e,t,a){if(ml)return e(t,a);ml=!0;try{var n=e(t);return n}finally{if(ml=!1,(mn!==null||Qa!==null)&&(Wi(),mn&&(t=mn,e=Qa,Qa=mn=null,ps(t),e)))for(t=0;t<e.length;t++)ps(e[t])}}function An(e,t){var a=e.stateNode;if(a===null)return null;var n=a[Ut]||null;if(n===null)return null;a=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(c(231,t,typeof a));return a}var Da=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zl=!1;if(Da)try{var Cn={};Object.defineProperty(Cn,"passive",{get:function(){Zl=!0}}),window.addEventListener("test",Cn,Cn),window.removeEventListener("test",Cn,Cn)}catch{Zl=!1}var La=null,kr=null,Kl=null;function Jl(){if(Kl)return Kl;var e,t=kr,a=t.length,n,s="value"in La?La.value:La.textContent,o=s.length;for(e=0;e<a&&t[e]===s[e];e++);var m=a-e;for(n=1;n<=m&&t[a-n]===s[o-n];n++);return Kl=s.slice(e,1<n?1-n:void 0)}function _r(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 Ar(){return!0}function pi(){return!1}function ua(e){function t(a,n,s,o,m){this._reactName=a,this._targetInst=s,this.type=n,this.nativeEvent=o,this.target=m,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(a=e[y],this[y]=a?a(o):o[y]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Ar:pi,this.isPropagationStopped=pi,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ar)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ar)},persist:function(){},isPersistent:Ar}),t}var Hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pl=ua(Hn),jn=w({},Hn,{view:0,detail:0}),gs=ua(jn),xs,bs,Wl,Cr=w({},jn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hn,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!==Wl&&(Wl&&e.type==="mousemove"?(xs=e.screenX-Wl.screenX,bs=e.screenY-Wl.screenY):bs=xs=0,Wl=e),xs)},movementY:function(e){return"movementY"in e?e.movementY:bs}}),ys=ua(Cr),zd=w({},Cr,{dataTransfer:0}),vs=ua(zd),Fn=w({},jn,{relatedTarget:0}),ws=ua(Fn),Po=w({},Hn,{animationName:0,elapsedTime:0,pseudoElement:0}),gi=ua(Po),N=w({},Hn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),le=ua(N),Ce=w({},Hn,{data:0}),Oe=ua(Ce),lt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Wt={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"},dt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tt(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=dt[e])?!!t[e]:!1}function hn(){return tt}var Ra=w({},jn,{key:function(e){if(e.key){var t=lt[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=_r(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Wt[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hn,charCode:function(e){return e.type==="keypress"?_r(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?_r(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),jr=ua(Ra),Nr=w({},Cr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hl=ua(Nr),xi=w({},jn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hn}),pa=ua(xi),Za=w({},Hn,{propertyName:0,elapsedTime:0,pseudoElement:0}),pn=ua(Za),ea=w({},Cr,{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}),Wo=ua(ea),ec=w({},Hn,{newState:0,oldState:0}),tc=ua(ec),Ua=[9,13,27,32],Ka=Da&&"CompositionEvent"in window,Qt=null;Da&&"documentMode"in document&&(Qt=document.documentMode);var er=Da&&"TextEvent"in window&&!Qt,Dd=Da&&(!Ka||Qt&&8<Qt&&11>=Qt),Ld=" ",Rd=!1;function Ud(e,t){switch(e){case"keyup":return Ua.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Od(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tr=!1;function $g(e,t){switch(e){case"compositionend":return Od(t);case"keypress":return t.which!==32?null:(Rd=!0,Ld);case"textInput":return e=t.data,e===Ld&&Rd?null:e;default:return null}}function qg(e,t){if(Tr)return e==="compositionend"||!Ka&&Ud(e,t)?(e=Jl(),Kl=kr=La=null,Tr=!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 Dd&&t.locale!=="ko"?null:t.data;default:return null}}var Bg={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 $d(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Bg[e.type]:t==="textarea"}function qd(e,t,a,n){mn?Qa?Qa.push(n):Qa=[n]:mn=n,t=so(t,"onChange"),0<t.length&&(a=new Pl("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var Ss=null,ks=null;function Hg(e){Sh(e,0)}function bi(e){var t=Bn(e);if(br(t))return e}function Bd(e,t){if(e==="change")return t}var Hd=!1;if(Da){var ac;if(Da){var nc="oninput"in document;if(!nc){var Fd=document.createElement("div");Fd.setAttribute("oninput","return;"),nc=typeof Fd.oninput=="function"}ac=nc}else ac=!1;Hd=ac&&(!document.documentMode||9<document.documentMode)}function Id(){Ss&&(Ss.detachEvent("onpropertychange",Gd),ks=Ss=null)}function Gd(e){if(e.propertyName==="value"&&bi(ks)){var t=[];qd(t,ks,e,wr(e)),Sr(Hg,t)}}function Fg(e,t,a){e==="focusin"?(Id(),Ss=t,ks=a,Ss.attachEvent("onpropertychange",Gd)):e==="focusout"&&Id()}function Ig(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bi(ks)}function Gg(e,t){if(e==="click")return bi(t)}function Vg(e,t){if(e==="input"||e==="change")return bi(t)}function Xg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Oa=typeof Object.is=="function"?Object.is:Xg;function _s(e,t){if(Oa(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++){var s=a[n];if(!vt.call(t,s)||!Oa(e[s],t[s]))return!1}return!0}function Vd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xd(e,t){var a=Vd(e);e=0;for(var n;a;){if(a.nodeType===3){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Vd(a)}}function Yd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=yr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=yr(e.document)}return t}function lc(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 Yg=Da&&"documentMode"in document&&11>=document.documentMode,Er=null,rc=null,As=null,sc=!1;function Zd(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;sc||Er==null||Er!==yr(n)||(n=Er,"selectionStart"in n&&lc(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),As&&_s(As,n)||(As=n,n=so(rc,"onSelect"),0<n.length&&(t=new Pl("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=Er)))}function tr(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Mr={animationend:tr("Animation","AnimationEnd"),animationiteration:tr("Animation","AnimationIteration"),animationstart:tr("Animation","AnimationStart"),transitionrun:tr("Transition","TransitionRun"),transitionstart:tr("Transition","TransitionStart"),transitioncancel:tr("Transition","TransitionCancel"),transitionend:tr("Transition","TransitionEnd")},ic={},Kd={};Da&&(Kd=document.createElement("div").style,"AnimationEvent"in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),"TransitionEvent"in window||delete Mr.transitionend.transition);function ar(e){if(ic[e])return ic[e];if(!Mr[e])return e;var t=Mr[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Kd)return ic[e]=t[a];return e}var Jd=ar("animationend"),Pd=ar("animationiteration"),Wd=ar("animationstart"),Qg=ar("transitionrun"),Zg=ar("transitionstart"),Kg=ar("transitioncancel"),ef=ar("transitionend"),tf=new Map,oc="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(" ");oc.push("scrollEnd");function gn(e,t){tf.set(e,t),Sa(t,[e])}var yi=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!==null&&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)},Ja=[],zr=0,cc=0;function vi(){for(var e=zr,t=cc=zr=0;t<e;){var a=Ja[t];Ja[t++]=null;var n=Ja[t];Ja[t++]=null;var s=Ja[t];Ja[t++]=null;var o=Ja[t];if(Ja[t++]=null,n!==null&&s!==null){var m=n.pending;m===null?s.next=s:(s.next=m.next,m.next=s),n.pending=s}o!==0&&af(a,s,o)}}function wi(e,t,a,n){Ja[zr++]=e,Ja[zr++]=t,Ja[zr++]=a,Ja[zr++]=n,cc|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function uc(e,t,a,n){return wi(e,t,a,n),Si(e)}function nr(e,t){return wi(e,null,null,t),Si(e)}function af(e,t,a){e.lanes|=a;var n=e.alternate;n!==null&&(n.lanes|=a);for(var s=!1,o=e.return;o!==null;)o.childLanes|=a,n=o.alternate,n!==null&&(n.childLanes|=a),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(s=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,s&&t!==null&&(s=31-Re(a),e=o.hiddenUpdates,n=e[s],n===null?e[s]=[t]:n.push(t),t.lane=a|536870912),o):null}function Si(e){if(50<Ys)throw Ys=0,yu=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Dr={};function Jg(e,t,a,n){this.tag=e,this.key=a,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $a(e,t,a,n){return new Jg(e,t,a,n)}function dc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function In(e,t){var a=e.alternate;return a===null?(a=$a(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function nf(e,t){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ki(e,t,a,n,s,o){var m=0;if(n=e,typeof e=="function")dc(e)&&(m=1);else if(typeof e=="string")m=ax(e,a,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case V:return e=$a(31,a,t,s),e.elementType=V,e.lanes=o,e;case A:return lr(a.children,s,o,t);case D:m=8,s|=24;break;case O:return e=$a(12,a,t,s|2),e.elementType=O,e.lanes=o,e;case H:return e=$a(13,a,t,s),e.elementType=H,e.lanes=o,e;case K:return e=$a(19,a,t,s),e.elementType=K,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case U:m=10;break e;case ee:m=9;break e;case z:m=11;break e;case j:m=14;break e;case q:m=16,n=null;break e}m=29,a=Error(c(130,e===null?"null":typeof e,"")),n=null}return t=$a(m,a,t,s),t.elementType=e,t.type=n,t.lanes=o,t}function lr(e,t,a,n){return e=$a(7,e,n,t),e.lanes=a,e}function fc(e,t,a){return e=$a(6,e,null,t),e.lanes=a,e}function lf(e){var t=$a(18,null,null,0);return t.stateNode=e,t}function mc(e,t,a){return t=$a(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var rf=new WeakMap;function Pa(e,t){if(typeof e=="object"&&e!==null){var a=rf.get(e);return a!==void 0?a:(t={value:e,source:t,stack:He(t)},rf.set(e,t),t)}return{value:e,source:t,stack:He(t)}}var Lr=[],Rr=0,_i=null,Cs=0,Wa=[],en=0,pl=null,Nn=1,Tn="";function Gn(e,t){Lr[Rr++]=Cs,Lr[Rr++]=_i,_i=e,Cs=t}function sf(e,t,a){Wa[en++]=Nn,Wa[en++]=Tn,Wa[en++]=pl,pl=e;var n=Nn;e=Tn;var s=32-Re(n)-1;n&=~(1<<s),a+=1;var o=32-Re(t)+s;if(30<o){var m=s-s%5;o=(n&(1<<m)-1).toString(32),n>>=m,s-=m,Nn=1<<32-Re(t)+s|a<<s|n,Tn=o+e}else Nn=1<<o|a<<s|n,Tn=e}function hc(e){e.return!==null&&(Gn(e,1),sf(e,1,0))}function pc(e){for(;e===_i;)_i=Lr[--Rr],Lr[Rr]=null,Cs=Lr[--Rr],Lr[Rr]=null;for(;e===pl;)pl=Wa[--en],Wa[en]=null,Tn=Wa[--en],Wa[en]=null,Nn=Wa[--en],Wa[en]=null}function of(e,t){Wa[en++]=Nn,Wa[en++]=Tn,Wa[en++]=pl,Nn=t.id,Tn=t.overflow,pl=e}var ta=null,bt=null,et=!1,gl=null,tn=!1,gc=Error(c(519));function xl(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw js(Pa(t,e)),gc}function cf(e){var t=e.stateNode,a=e.type,n=e.memoizedProps;switch(t[jt]=e,t[Ut]=n,a){case"dialog":Je("cancel",t),Je("close",t);break;case"iframe":case"object":case"embed":Je("load",t);break;case"video":case"audio":for(a=0;a<Zs.length;a++)Je(Zs[a],t);break;case"source":Je("error",t);break;case"img":case"image":case"link":Je("error",t),Je("load",t);break;case"details":Je("toggle",t);break;case"input":Je("invalid",t),fs(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":Je("invalid",t);break;case"textarea":Je("invalid",t),fn(t,n.value,n.defaultValue,n.children)}a=n.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||n.suppressHydrationWarning===!0||Ch(t.textContent,a)?(n.popover!=null&&(Je("beforetoggle",t),Je("toggle",t)),n.onScroll!=null&&Je("scroll",t),n.onScrollEnd!=null&&Je("scrollend",t),n.onClick!=null&&(t.onclick=Ya),t=!0):t=!1,t||xl(e,!0)}function uf(e){for(ta=e.return;ta;)switch(ta.tag){case 5:case 31:case 13:tn=!1;return;case 27:case 3:tn=!0;return;default:ta=ta.return}}function Ur(e){if(e!==ta)return!1;if(!et)return uf(e),et=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Lu(e.type,e.memoizedProps)),a=!a),a&&bt&&xl(e),uf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));bt=Rh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));bt=Rh(e)}else t===27?(t=bt,Ml(e.type)?(e=qu,qu=null,bt=e):bt=t):bt=ta?nn(e.stateNode.nextSibling):null;return!0}function rr(){bt=ta=null,et=!1}function xc(){var e=gl;return e!==null&&(ja===null?ja=e:ja.push.apply(ja,e),gl=null),e}function js(e){gl===null?gl=[e]:gl.push(e)}var bc=ge(null),sr=null,Vn=null;function bl(e,t,a){G(bc,t._currentValue),t._currentValue=a}function Xn(e){e._currentValue=bc.current,pe(bc)}function yc(e,t,a){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===a)break;e=e.return}}function vc(e,t,a,n){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){var m=s.child;o=o.firstContext;e:for(;o!==null;){var y=o;o=s;for(var C=0;C<t.length;C++)if(y.context===t[C]){o.lanes|=a,y=o.alternate,y!==null&&(y.lanes|=a),yc(o.return,a,e),n||(m=null);break e}o=y.next}}else if(s.tag===18){if(m=s.return,m===null)throw Error(c(341));m.lanes|=a,o=m.alternate,o!==null&&(o.lanes|=a),yc(m,a,e),m=null}else m=s.child;if(m!==null)m.return=s;else for(m=s;m!==null;){if(m===e){m=null;break}if(s=m.sibling,s!==null){s.return=m.return,m=s;break}m=m.return}s=m}}function Or(e,t,a,n){e=null;for(var s=t,o=!1;s!==null;){if(!o){if((s.flags&524288)!==0)o=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var m=s.alternate;if(m===null)throw Error(c(387));if(m=m.memoizedProps,m!==null){var y=s.type;Oa(s.pendingProps.value,m.value)||(e!==null?e.push(y):e=[y])}}else if(s===ye.current){if(m=s.alternate,m===null)throw Error(c(387));m.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(ei):e=[ei])}s=s.return}e!==null&&vc(t,e,a,n),t.flags|=262144}function Ai(e){for(e=e.firstContext;e!==null;){if(!Oa(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ir(e){sr=e,Vn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function aa(e){return df(sr,e)}function Ci(e,t){return sr===null&&ir(e),df(e,t)}function df(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Vn===null){if(e===null)throw Error(c(308));Vn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vn=Vn.next=t;return a}var Pg=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},Wg=r.unstable_scheduleCallback,e0=r.unstable_NormalPriority,$t={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wc(){return{controller:new Pg,data:new Map,refCount:0}}function Ns(e){e.refCount--,e.refCount===0&&Wg(e0,function(){e.controller.abort()})}var Ts=null,Sc=0,$r=0,qr=null;function t0(e,t){if(Ts===null){var a=Ts=[];Sc=0,$r=Au(),qr={status:"pending",value:void 0,then:function(n){a.push(n)}}}return Sc++,t.then(ff,ff),t}function ff(){if(--Sc===0&&Ts!==null){qr!==null&&(qr.status="fulfilled");var e=Ts;Ts=null,$r=0,qr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function a0(e,t){var a=[],n={status:"pending",value:null,reason:null,then:function(s){a.push(s)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var s=0;s<a.length;s++)(0,a[s])(t)},function(s){for(n.status="rejected",n.reason=s,s=0;s<a.length;s++)(0,a[s])(void 0)}),n}var mf=E.S;E.S=function(e,t){Km=we(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&t0(e,t),mf!==null&&mf(e,t)};var or=ge(null);function kc(){var e=or.current;return e!==null?e:pt.pooledCache}function ji(e,t){t===null?G(or,or.current):G(or,t.pool)}function hf(){var e=kc();return e===null?null:{parent:$t._currentValue,pool:e}}var Br=Error(c(460)),_c=Error(c(474)),Ni=Error(c(542)),Ti={then:function(){}};function pf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function gf(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Ya,Ya),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,bf(e),e;default:if(typeof t.status=="string")t.then(Ya,Ya);else{if(e=pt,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=n}},function(n){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,bf(e),e}throw ur=t,Br}}function cr(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ur=a,Br):a}}var ur=null;function xf(){if(ur===null)throw Error(c(459));var e=ur;return ur=null,e}function bf(e){if(e===Br||e===Ni)throw Error(c(483))}var Hr=null,Es=0;function Ei(e){var t=Es;return Es+=1,Hr===null&&(Hr=[]),gf(Hr,e,t)}function Ms(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Mi(e,t){throw t.$$typeof===k?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yf(e){function t(M,T){if(e){var L=M.deletions;L===null?(M.deletions=[T],M.flags|=16):L.push(T)}}function a(M,T){if(!e)return null;for(;T!==null;)t(M,T),T=T.sibling;return null}function n(M){for(var T=new Map;M!==null;)M.key!==null?T.set(M.key,M):T.set(M.index,M),M=M.sibling;return T}function s(M,T){return M=In(M,T),M.index=0,M.sibling=null,M}function o(M,T,L){return M.index=L,e?(L=M.alternate,L!==null?(L=L.index,L<T?(M.flags|=67108866,T):L):(M.flags|=67108866,T)):(M.flags|=1048576,T)}function m(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function y(M,T,L,Q){return T===null||T.tag!==6?(T=fc(L,M.mode,Q),T.return=M,T):(T=s(T,L),T.return=M,T)}function C(M,T,L,Q){var je=L.type;return je===A?X(M,T,L.props.children,Q,L.key):T!==null&&(T.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===q&&cr(je)===T.type)?(T=s(T,L.props),Ms(T,L),T.return=M,T):(T=ki(L.type,L.key,L.props,null,M.mode,Q),Ms(T,L),T.return=M,T)}function R(M,T,L,Q){return T===null||T.tag!==4||T.stateNode.containerInfo!==L.containerInfo||T.stateNode.implementation!==L.implementation?(T=mc(L,M.mode,Q),T.return=M,T):(T=s(T,L.children||[]),T.return=M,T)}function X(M,T,L,Q,je){return T===null||T.tag!==7?(T=lr(L,M.mode,Q,je),T.return=M,T):(T=s(T,L),T.return=M,T)}function Z(M,T,L){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=fc(""+T,M.mode,L),T.return=M,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return L=ki(T.type,T.key,T.props,null,M.mode,L),Ms(L,T),L.return=M,L;case _:return T=mc(T,M.mode,L),T.return=M,T;case q:return T=cr(T),Z(M,T,L)}if(oe(T)||ue(T))return T=lr(T,M.mode,L,null),T.return=M,T;if(typeof T.then=="function")return Z(M,Ei(T),L);if(T.$$typeof===U)return Z(M,Ci(M,T),L);Mi(M,T)}return null}function $(M,T,L,Q){var je=T!==null?T.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return je!==null?null:y(M,T,""+L,Q);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case S:return L.key===je?C(M,T,L,Q):null;case _:return L.key===je?R(M,T,L,Q):null;case q:return L=cr(L),$(M,T,L,Q)}if(oe(L)||ue(L))return je!==null?null:X(M,T,L,Q,null);if(typeof L.then=="function")return $(M,T,Ei(L),Q);if(L.$$typeof===U)return $(M,T,Ci(M,L),Q);Mi(M,L)}return null}function F(M,T,L,Q,je){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return M=M.get(L)||null,y(T,M,""+Q,je);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case S:return M=M.get(Q.key===null?L:Q.key)||null,C(T,M,Q,je);case _:return M=M.get(Q.key===null?L:Q.key)||null,R(T,M,Q,je);case q:return Q=cr(Q),F(M,T,L,Q,je)}if(oe(Q)||ue(Q))return M=M.get(L)||null,X(T,M,Q,je,null);if(typeof Q.then=="function")return F(M,T,L,Ei(Q),je);if(Q.$$typeof===U)return F(M,T,L,Ci(T,Q),je);Mi(T,Q)}return null}function ke(M,T,L,Q){for(var je=null,at=null,Ae=T,Xe=T=0,We=null;Ae!==null&&Xe<L.length;Xe++){Ae.index>Xe?(We=Ae,Ae=null):We=Ae.sibling;var nt=$(M,Ae,L[Xe],Q);if(nt===null){Ae===null&&(Ae=We);break}e&&Ae&&nt.alternate===null&&t(M,Ae),T=o(nt,T,Xe),at===null?je=nt:at.sibling=nt,at=nt,Ae=We}if(Xe===L.length)return a(M,Ae),et&&Gn(M,Xe),je;if(Ae===null){for(;Xe<L.length;Xe++)Ae=Z(M,L[Xe],Q),Ae!==null&&(T=o(Ae,T,Xe),at===null?je=Ae:at.sibling=Ae,at=Ae);return et&&Gn(M,Xe),je}for(Ae=n(Ae);Xe<L.length;Xe++)We=F(Ae,M,Xe,L[Xe],Q),We!==null&&(e&&We.alternate!==null&&Ae.delete(We.key===null?Xe:We.key),T=o(We,T,Xe),at===null?je=We:at.sibling=We,at=We);return e&&Ae.forEach(function(Ul){return t(M,Ul)}),et&&Gn(M,Xe),je}function Ue(M,T,L,Q){if(L==null)throw Error(c(151));for(var je=null,at=null,Ae=T,Xe=T=0,We=null,nt=L.next();Ae!==null&&!nt.done;Xe++,nt=L.next()){Ae.index>Xe?(We=Ae,Ae=null):We=Ae.sibling;var Ul=$(M,Ae,nt.value,Q);if(Ul===null){Ae===null&&(Ae=We);break}e&&Ae&&Ul.alternate===null&&t(M,Ae),T=o(Ul,T,Xe),at===null?je=Ul:at.sibling=Ul,at=Ul,Ae=We}if(nt.done)return a(M,Ae),et&&Gn(M,Xe),je;if(Ae===null){for(;!nt.done;Xe++,nt=L.next())nt=Z(M,nt.value,Q),nt!==null&&(T=o(nt,T,Xe),at===null?je=nt:at.sibling=nt,at=nt);return et&&Gn(M,Xe),je}for(Ae=n(Ae);!nt.done;Xe++,nt=L.next())nt=F(Ae,M,Xe,nt.value,Q),nt!==null&&(e&&nt.alternate!==null&&Ae.delete(nt.key===null?Xe:nt.key),T=o(nt,T,Xe),at===null?je=nt:at.sibling=nt,at=nt);return e&&Ae.forEach(function(mx){return t(M,mx)}),et&&Gn(M,Xe),je}function ht(M,T,L,Q){if(typeof L=="object"&&L!==null&&L.type===A&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case S:e:{for(var je=L.key;T!==null;){if(T.key===je){if(je=L.type,je===A){if(T.tag===7){a(M,T.sibling),Q=s(T,L.props.children),Q.return=M,M=Q;break e}}else if(T.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===q&&cr(je)===T.type){a(M,T.sibling),Q=s(T,L.props),Ms(Q,L),Q.return=M,M=Q;break e}a(M,T);break}else t(M,T);T=T.sibling}L.type===A?(Q=lr(L.props.children,M.mode,Q,L.key),Q.return=M,M=Q):(Q=ki(L.type,L.key,L.props,null,M.mode,Q),Ms(Q,L),Q.return=M,M=Q)}return m(M);case _:e:{for(je=L.key;T!==null;){if(T.key===je)if(T.tag===4&&T.stateNode.containerInfo===L.containerInfo&&T.stateNode.implementation===L.implementation){a(M,T.sibling),Q=s(T,L.children||[]),Q.return=M,M=Q;break e}else{a(M,T);break}else t(M,T);T=T.sibling}Q=mc(L,M.mode,Q),Q.return=M,M=Q}return m(M);case q:return L=cr(L),ht(M,T,L,Q)}if(oe(L))return ke(M,T,L,Q);if(ue(L)){if(je=ue(L),typeof je!="function")throw Error(c(150));return L=je.call(L),Ue(M,T,L,Q)}if(typeof L.then=="function")return ht(M,T,Ei(L),Q);if(L.$$typeof===U)return ht(M,T,Ci(M,L),Q);Mi(M,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,T!==null&&T.tag===6?(a(M,T.sibling),Q=s(T,L),Q.return=M,M=Q):(a(M,T),Q=fc(L,M.mode,Q),Q.return=M,M=Q),m(M)):a(M,T)}return function(M,T,L,Q){try{Es=0;var je=ht(M,T,L,Q);return Hr=null,je}catch(Ae){if(Ae===Br||Ae===Ni)throw Ae;var at=$a(29,Ae,null,M.mode);return at.lanes=Q,at.return=M,at}finally{}}}var dr=yf(!0),vf=yf(!1),yl=!1;function Ac(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cc(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 vl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wl(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(rt&2)!==0){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,t=Si(e),af(e,null,a),t}return wi(e,n,t,a),Si(e)}function zs(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Il(e,a)}}function jc(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var s=null,o=null;if(a=a.firstBaseUpdate,a!==null){do{var m={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};o===null?s=o=m:o=o.next=m,a=a.next}while(a!==null);o===null?s=o=t:o=o.next=t}else s=o=t;a={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Nc=!1;function Ds(){if(Nc){var e=qr;if(e!==null)throw e}}function Ls(e,t,a,n){Nc=!1;var s=e.updateQueue;yl=!1;var o=s.firstBaseUpdate,m=s.lastBaseUpdate,y=s.shared.pending;if(y!==null){s.shared.pending=null;var C=y,R=C.next;C.next=null,m===null?o=R:m.next=R,m=C;var X=e.alternate;X!==null&&(X=X.updateQueue,y=X.lastBaseUpdate,y!==m&&(y===null?X.firstBaseUpdate=R:y.next=R,X.lastBaseUpdate=C))}if(o!==null){var Z=s.baseState;m=0,X=R=C=null,y=o;do{var $=y.lane&-536870913,F=$!==y.lane;if(F?(Pe&$)===$:(n&$)===$){$!==0&&$===$r&&(Nc=!0),X!==null&&(X=X.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var ke=e,Ue=y;$=t;var ht=a;switch(Ue.tag){case 1:if(ke=Ue.payload,typeof ke=="function"){Z=ke.call(ht,Z,$);break e}Z=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Ue.payload,$=typeof ke=="function"?ke.call(ht,Z,$):ke,$==null)break e;Z=w({},Z,$);break e;case 2:yl=!0}}$=y.callback,$!==null&&(e.flags|=64,F&&(e.flags|=8192),F=s.callbacks,F===null?s.callbacks=[$]:F.push($))}else F={lane:$,tag:y.tag,payload:y.payload,callback:y.callback,next:null},X===null?(R=X=F,C=Z):X=X.next=F,m|=$;if(y=y.next,y===null){if(y=s.shared.pending,y===null)break;F=y,y=F.next,F.next=null,s.lastBaseUpdate=F,s.shared.pending=null}}while(!0);X===null&&(C=Z),s.baseState=C,s.firstBaseUpdate=R,s.lastBaseUpdate=X,o===null&&(s.shared.lanes=0),Cl|=m,e.lanes=m,e.memoizedState=Z}}function wf(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Sf(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)wf(a[e],t)}var Fr=ge(null),zi=ge(0);function kf(e,t){e=tl,G(zi,e),G(Fr,t),tl=e|t.baseLanes}function Tc(){G(zi,tl),G(Fr,Fr.current)}function Ec(){tl=zi.current,pe(Fr),pe(zi)}var qa=ge(null),an=null;function Sl(e){var t=e.alternate;G(Nt,Nt.current&1),G(qa,e),an===null&&(t===null||Fr.current!==null||t.memoizedState!==null)&&(an=e)}function Mc(e){G(Nt,Nt.current),G(qa,e),an===null&&(an=e)}function _f(e){e.tag===22?(G(Nt,Nt.current),G(qa,e),an===null&&(an=e)):kl()}function kl(){G(Nt,Nt.current),G(qa,qa.current)}function Ba(e){pe(qa),an===e&&(an=null),pe(Nt)}var Nt=ge(0);function Di(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ou(a)||$u(a)))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)!==0)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 Yn=0,Ve=null,ft=null,qt=null,Li=!1,Ir=!1,fr=!1,Ri=0,Rs=0,Gr=null,n0=0;function At(){throw Error(c(321))}function zc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Oa(e[a],t[a]))return!1;return!0}function Dc(e,t,a,n,s,o){return Yn=o,Ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?im:Qc,fr=!1,o=a(n,s),fr=!1,Ir&&(o=Cf(t,a,n,s)),Af(e),o}function Af(e){E.H=$s;var t=ft!==null&&ft.next!==null;if(Yn=0,qt=ft=Ve=null,Li=!1,Rs=0,Gr=null,t)throw Error(c(300));e===null||Bt||(e=e.dependencies,e!==null&&Ai(e)&&(Bt=!0))}function Cf(e,t,a,n){Ve=e;var s=0;do{if(Ir&&(Gr=null),Rs=0,Ir=!1,25<=s)throw Error(c(301));if(s+=1,qt=ft=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}E.H=om,o=t(a,n)}while(Ir);return o}function l0(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Us(t):t,e=e.useState()[0],(ft!==null?ft.memoizedState:null)!==e&&(Ve.flags|=1024),t}function Lc(){var e=Ri!==0;return Ri=0,e}function Rc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Uc(e){if(Li){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Li=!1}Yn=0,qt=ft=Ve=null,Ir=!1,Rs=Ri=0,Gr=null}function ga(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?Ve.memoizedState=qt=e:qt=qt.next=e,qt}function Tt(){if(ft===null){var e=Ve.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var t=qt===null?Ve.memoizedState:qt.next;if(t!==null)qt=t,ft=e;else{if(e===null)throw Ve.alternate===null?Error(c(467)):Error(c(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},qt===null?Ve.memoizedState=qt=e:qt=qt.next=e}return qt}function Ui(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Us(e){var t=Rs;return Rs+=1,Gr===null&&(Gr=[]),e=gf(Gr,e,t),t=Ve,(qt===null?t.memoizedState:qt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?im:Qc),e}function Oi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Us(e);if(e.$$typeof===U)return aa(e)}throw Error(c(438,String(e)))}function Oc(e){var t=null,a=Ve.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var n=Ve.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Ui(),Ve.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),n=0;n<e;n++)a[n]=I;return t.index++,a}function Qn(e,t){return typeof t=="function"?t(e):t}function $i(e){var t=Tt();return $c(t,ft,e)}function $c(e,t,a){var n=e.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=a;var s=e.baseQueue,o=n.pending;if(o!==null){if(s!==null){var m=s.next;s.next=o.next,o.next=m}t.baseQueue=s=o,n.pending=null}if(o=e.baseState,s===null)e.memoizedState=o;else{t=s.next;var y=m=null,C=null,R=t,X=!1;do{var Z=R.lane&-536870913;if(Z!==R.lane?(Pe&Z)===Z:(Yn&Z)===Z){var $=R.revertLane;if($===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),Z===$r&&(X=!0);else if((Yn&$)===$){R=R.next,$===$r&&(X=!0);continue}else Z={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},C===null?(y=C=Z,m=o):C=C.next=Z,Ve.lanes|=$,Cl|=$;Z=R.action,fr&&a(o,Z),o=R.hasEagerState?R.eagerState:a(o,Z)}else $={lane:Z,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},C===null?(y=C=$,m=o):C=C.next=$,Ve.lanes|=Z,Cl|=Z;R=R.next}while(R!==null&&R!==t);if(C===null?m=o:C.next=y,!Oa(o,e.memoizedState)&&(Bt=!0,X&&(a=qr,a!==null)))throw a;e.memoizedState=o,e.baseState=m,e.baseQueue=C,n.lastRenderedState=o}return s===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function qc(e){var t=Tt(),a=t.queue;if(a===null)throw Error(c(311));a.lastRenderedReducer=e;var n=a.dispatch,s=a.pending,o=t.memoizedState;if(s!==null){a.pending=null;var m=s=s.next;do o=e(o,m.action),m=m.next;while(m!==s);Oa(o,t.memoizedState)||(Bt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),a.lastRenderedState=o}return[o,n]}function jf(e,t,a){var n=Ve,s=Tt(),o=et;if(o){if(a===void 0)throw Error(c(407));a=a()}else a=t();var m=!Oa((ft||s).memoizedState,a);if(m&&(s.memoizedState=a,Bt=!0),s=s.queue,Fc(Ef.bind(null,n,s,e),[e]),s.getSnapshot!==t||m||qt!==null&&qt.memoizedState.tag&1){if(n.flags|=2048,Vr(9,{destroy:void 0},Tf.bind(null,n,s,a,t),null),pt===null)throw Error(c(349));o||(Yn&127)!==0||Nf(n,t,a)}return a}function Nf(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Ve.updateQueue,t===null?(t=Ui(),Ve.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Tf(e,t,a,n){t.value=a,t.getSnapshot=n,Mf(t)&&zf(e)}function Ef(e,t,a){return a(function(){Mf(t)&&zf(e)})}function Mf(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Oa(e,a)}catch{return!0}}function zf(e){var t=nr(e,2);t!==null&&Na(t,e,2)}function Bc(e){var t=ga();if(typeof e=="function"){var a=e;if(e=a(),fr){ia(!0);try{a()}finally{ia(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:e},t}function Df(e,t,a,n){return e.baseState=a,$c(e,ft,typeof n=="function"?n:Qn)}function r0(e,t,a,n,s){if(Hi(e))throw Error(c(485));if(e=t.action,e!==null){var o={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){o.listeners.push(m)}};E.T!==null?a(!0):o.isTransition=!1,n(o),a=t.pending,a===null?(o.next=t.pending=o,Lf(t,o)):(o.next=a.next,t.pending=a.next=o)}}function Lf(e,t){var a=t.action,n=t.payload,s=e.state;if(t.isTransition){var o=E.T,m={};E.T=m;try{var y=a(s,n),C=E.S;C!==null&&C(m,y),Rf(e,t,y)}catch(R){Hc(e,t,R)}finally{o!==null&&m.types!==null&&(o.types=m.types),E.T=o}}else try{o=a(s,n),Rf(e,t,o)}catch(R){Hc(e,t,R)}}function Rf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(n){Uf(e,t,n)},function(n){return Hc(e,t,n)}):Uf(e,t,a)}function Uf(e,t,a){t.status="fulfilled",t.value=a,Of(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Lf(e,a)))}function Hc(e,t,a){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=a,Of(t),t=t.next;while(t!==n)}e.action=null}function Of(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function $f(e,t){return t}function qf(e,t){if(et){var a=pt.formState;if(a!==null){e:{var n=Ve;if(et){if(bt){t:{for(var s=bt,o=tn;s.nodeType!==8;){if(!o){s=null;break t}if(s=nn(s.nextSibling),s===null){s=null;break t}}o=s.data,s=o==="F!"||o==="F"?s:null}if(s){bt=nn(s.nextSibling),n=s.data==="F!";break e}}xl(n)}n=!1}n&&(t=a[0])}}return a=ga(),a.memoizedState=a.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$f,lastRenderedState:t},a.queue=n,a=lm.bind(null,Ve,n),n.dispatch=a,n=Bc(!1),o=Yc.bind(null,Ve,!1,n.queue),n=ga(),s={state:t,dispatch:null,action:e,pending:null},n.queue=s,a=r0.bind(null,Ve,s,o,a),s.dispatch=a,n.memoizedState=e,[t,a,!1]}function Bf(e){var t=Tt();return Hf(t,ft,e)}function Hf(e,t,a){if(t=$c(e,t,$f)[0],e=$i(Qn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Us(t)}catch(m){throw m===Br?Ni:m}else n=t;t=Tt();var s=t.queue,o=s.dispatch;return a!==t.memoizedState&&(Ve.flags|=2048,Vr(9,{destroy:void 0},s0.bind(null,s,a),null)),[n,o,e]}function s0(e,t){e.action=t}function Ff(e){var t=Tt(),a=ft;if(a!==null)return Hf(t,a,e);Tt(),t=t.memoizedState,a=Tt();var n=a.queue.dispatch;return a.memoizedState=e,[t,n,!1]}function Vr(e,t,a,n){return e={tag:e,create:a,deps:n,inst:t,next:null},t=Ve.updateQueue,t===null&&(t=Ui(),Ve.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function If(){return Tt().memoizedState}function qi(e,t,a,n){var s=ga();Ve.flags|=e,s.memoizedState=Vr(1|t,{destroy:void 0},a,n===void 0?null:n)}function Bi(e,t,a,n){var s=Tt();n=n===void 0?null:n;var o=s.memoizedState.inst;ft!==null&&n!==null&&zc(n,ft.memoizedState.deps)?s.memoizedState=Vr(t,o,a,n):(Ve.flags|=e,s.memoizedState=Vr(1|t,o,a,n))}function Gf(e,t){qi(8390656,8,e,t)}function Fc(e,t){Bi(2048,8,e,t)}function i0(e){Ve.flags|=4;var t=Ve.updateQueue;if(t===null)t=Ui(),Ve.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Vf(e){var t=Tt().memoizedState;return i0({ref:t,nextImpl:e}),function(){if((rt&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function Xf(e,t){return Bi(4,2,e,t)}function Yf(e,t){return Bi(4,4,e,t)}function Qf(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Zf(e,t,a){a=a!=null?a.concat([e]):null,Bi(4,4,Qf.bind(null,t,e),a)}function Ic(){}function Kf(e,t){var a=Tt();t=t===void 0?null:t;var n=a.memoizedState;return t!==null&&zc(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function Jf(e,t){var a=Tt();t=t===void 0?null:t;var n=a.memoizedState;if(t!==null&&zc(t,n[1]))return n[0];if(n=e(),fr){ia(!0);try{e()}finally{ia(!1)}}return a.memoizedState=[n,t],n}function Gc(e,t,a){return a===void 0||(Yn&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Pm(),Ve.lanes|=e,Cl|=e,a)}function Pf(e,t,a,n){return Oa(a,t)?a:Fr.current!==null?(e=Gc(e,a,n),Oa(e,t)||(Bt=!0),e):(Yn&42)===0||(Yn&1073741824)!==0&&(Pe&261930)===0?(Bt=!0,e.memoizedState=a):(e=Pm(),Ve.lanes|=e,Cl|=e,t)}function Wf(e,t,a,n,s){var o=Y.p;Y.p=o!==0&&8>o?o:8;var m=E.T,y={};E.T=y,Yc(e,!1,t,a);try{var C=s(),R=E.S;if(R!==null&&R(y,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var X=a0(C,n);Os(e,t,X,Ia(e))}else Os(e,t,n,Ia(e))}catch(Z){Os(e,t,{then:function(){},status:"rejected",reason:Z},Ia())}finally{Y.p=o,m!==null&&y.types!==null&&(m.types=y.types),E.T=m}}function o0(){}function Vc(e,t,a,n){if(e.tag!==5)throw Error(c(476));var s=em(e).queue;Wf(e,s,t,B,a===null?o0:function(){return tm(e),a(n)})}function em(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:B},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function tm(e){var t=em(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},Ia())}function Xc(){return aa(ei)}function am(){return Tt().memoizedState}function nm(){return Tt().memoizedState}function c0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ia();e=vl(a);var n=wl(t,e,a);n!==null&&(Na(n,t,a),zs(n,t,a)),t={cache:wc()},e.payload=t;return}t=t.return}}function u0(e,t,a){var n=Ia();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Hi(e)?rm(t,a):(a=uc(e,t,a,n),a!==null&&(Na(a,e,n),sm(a,t,n)))}function lm(e,t,a){var n=Ia();Os(e,t,a,n)}function Os(e,t,a,n){var s={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Hi(e))rm(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var m=t.lastRenderedState,y=o(m,a);if(s.hasEagerState=!0,s.eagerState=y,Oa(y,m))return wi(e,t,s,0),pt===null&&vi(),!1}catch{}finally{}if(a=uc(e,t,s,n),a!==null)return Na(a,e,n),sm(a,t,n),!0}return!1}function Yc(e,t,a,n){if(n={lane:2,revertLane:Au(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Hi(e)){if(t)throw Error(c(479))}else t=uc(e,a,n,2),t!==null&&Na(t,e,2)}function Hi(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function rm(e,t){Ir=Li=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function sm(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Il(e,a)}}var $s={readContext:aa,use:Oi,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};$s.useEffectEvent=At;var im={readContext:aa,use:Oi,useCallback:function(e,t){return ga().memoizedState=[e,t===void 0?null:t],e},useContext:aa,useEffect:Gf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,qi(4194308,4,Qf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return qi(4194308,4,e,t)},useInsertionEffect:function(e,t){qi(4,2,e,t)},useMemo:function(e,t){var a=ga();t=t===void 0?null:t;var n=e();if(fr){ia(!0);try{e()}finally{ia(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=ga();if(a!==void 0){var s=a(t);if(fr){ia(!0);try{a(t)}finally{ia(!1)}}}else s=t;return n.memoizedState=n.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},n.queue=e,e=e.dispatch=u0.bind(null,Ve,e),[n.memoizedState,e]},useRef:function(e){var t=ga();return e={current:e},t.memoizedState=e},useState:function(e){e=Bc(e);var t=e.queue,a=lm.bind(null,Ve,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Ic,useDeferredValue:function(e,t){var a=ga();return Gc(a,e,t)},useTransition:function(){var e=Bc(!1);return e=Wf.bind(null,Ve,e.queue,!0,!1),ga().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Ve,s=ga();if(et){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),pt===null)throw Error(c(349));(Pe&127)!==0||Nf(n,t,a)}s.memoizedState=a;var o={value:a,getSnapshot:t};return s.queue=o,Gf(Ef.bind(null,n,o,e),[e]),n.flags|=2048,Vr(9,{destroy:void 0},Tf.bind(null,n,o,a,t),null),a},useId:function(){var e=ga(),t=pt.identifierPrefix;if(et){var a=Tn,n=Nn;a=(n&~(1<<32-Re(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Ri++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=n0++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Xc,useFormState:qf,useActionState:qf,useOptimistic:function(e){var t=ga();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Yc.bind(null,Ve,!0,a),a.dispatch=t,[e,t]},useMemoCache:Oc,useCacheRefresh:function(){return ga().memoizedState=c0.bind(null,Ve)},useEffectEvent:function(e){var t=ga(),a={impl:e};return t.memoizedState=a,function(){if((rt&2)!==0)throw Error(c(440));return a.impl.apply(void 0,arguments)}}},Qc={readContext:aa,use:Oi,useCallback:Kf,useContext:aa,useEffect:Fc,useImperativeHandle:Zf,useInsertionEffect:Xf,useLayoutEffect:Yf,useMemo:Jf,useReducer:$i,useRef:If,useState:function(){return $i(Qn)},useDebugValue:Ic,useDeferredValue:function(e,t){var a=Tt();return Pf(a,ft.memoizedState,e,t)},useTransition:function(){var e=$i(Qn)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Us(e),t]},useSyncExternalStore:jf,useId:am,useHostTransitionStatus:Xc,useFormState:Bf,useActionState:Bf,useOptimistic:function(e,t){var a=Tt();return Df(a,ft,e,t)},useMemoCache:Oc,useCacheRefresh:nm};Qc.useEffectEvent=Vf;var om={readContext:aa,use:Oi,useCallback:Kf,useContext:aa,useEffect:Fc,useImperativeHandle:Zf,useInsertionEffect:Xf,useLayoutEffect:Yf,useMemo:Jf,useReducer:qc,useRef:If,useState:function(){return qc(Qn)},useDebugValue:Ic,useDeferredValue:function(e,t){var a=Tt();return ft===null?Gc(a,e,t):Pf(a,ft.memoizedState,e,t)},useTransition:function(){var e=qc(Qn)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Us(e),t]},useSyncExternalStore:jf,useId:am,useHostTransitionStatus:Xc,useFormState:Ff,useActionState:Ff,useOptimistic:function(e,t){var a=Tt();return ft!==null?Df(a,ft,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Oc,useCacheRefresh:nm};om.useEffectEvent=Vf;function Zc(e,t,a,n){t=e.memoizedState,a=a(n,t),a=a==null?t:w({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Kc={enqueueSetState:function(e,t,a){e=e._reactInternals;var n=Ia(),s=vl(n);s.payload=t,a!=null&&(s.callback=a),t=wl(e,s,n),t!==null&&(Na(t,e,n),zs(t,e,n))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=Ia(),s=vl(n);s.tag=1,s.payload=t,a!=null&&(s.callback=a),t=wl(e,s,n),t!==null&&(Na(t,e,n),zs(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ia(),n=vl(a);n.tag=2,t!=null&&(n.callback=t),t=wl(e,n,a),t!==null&&(Na(t,e,a),zs(t,e,a))}};function cm(e,t,a,n,s,o,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,m):t.prototype&&t.prototype.isPureReactComponent?!_s(a,n)||!_s(s,o):!0}function um(e,t,a,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&Kc.enqueueReplaceState(t,t.state,null)}function mr(e,t){var a=t;if("ref"in t){a={};for(var n in t)n!=="ref"&&(a[n]=t[n])}if(e=e.defaultProps){a===t&&(a=w({},a));for(var s in e)a[s]===void 0&&(a[s]=e[s])}return a}function dm(e){yi(e)}function fm(e){console.error(e)}function mm(e){yi(e)}function Fi(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function hm(e,t,a){try{var n=e.onCaughtError;n(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Jc(e,t,a){return a=vl(a),a.tag=3,a.payload={element:null},a.callback=function(){Fi(e,t)},a}function pm(e){return e=vl(e),e.tag=3,e}function gm(e,t,a,n){var s=a.type.getDerivedStateFromError;if(typeof s=="function"){var o=n.value;e.payload=function(){return s(o)},e.callback=function(){hm(t,a,n)}}var m=a.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){hm(t,a,n),typeof s!="function"&&(jl===null?jl=new Set([this]):jl.add(this));var y=n.stack;this.componentDidCatch(n.value,{componentStack:y!==null?y:""})})}function d0(e,t,a,n,s){if(a.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=a.alternate,t!==null&&Or(t,a,s,!0),a=qa.current,a!==null){switch(a.tag){case 31:case 13:return an===null?eo():a.alternate===null&&Ct===0&&(Ct=3),a.flags&=-257,a.flags|=65536,a.lanes=s,n===Ti?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([n]):t.add(n),Su(e,n,s)),!1;case 22:return a.flags|=65536,n===Ti?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([n]):a.add(n)),Su(e,n,s)),!1}throw Error(c(435,a.tag))}return Su(e,n,s),eo(),!1}if(et)return t=qa.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,n!==gc&&(e=Error(c(422),{cause:n}),js(Pa(e,a)))):(n!==gc&&(t=Error(c(423),{cause:n}),js(Pa(t,a))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,n=Pa(n,a),s=Jc(e.stateNode,n,s),jc(e,s),Ct!==4&&(Ct=2)),!1;var o=Error(c(520),{cause:n});if(o=Pa(o,a),Xs===null?Xs=[o]:Xs.push(o),Ct!==4&&(Ct=2),t===null)return!0;n=Pa(n,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=s&-s,a.lanes|=e,e=Jc(a.stateNode,n,e),jc(a,e),!1;case 1:if(t=a.type,o=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(jl===null||!jl.has(o))))return a.flags|=65536,s&=-s,a.lanes|=s,s=pm(s),gm(s,e,a,n),jc(a,s),!1}a=a.return}while(a!==null);return!1}var Pc=Error(c(461)),Bt=!1;function na(e,t,a,n){t.child=e===null?vf(t,null,a,n):dr(t,e.child,a,n)}function xm(e,t,a,n,s){a=a.render;var o=t.ref;if("ref"in n){var m={};for(var y in n)y!=="ref"&&(m[y]=n[y])}else m=n;return ir(t),n=Dc(e,t,a,m,o,s),y=Lc(),e!==null&&!Bt?(Rc(e,t,s),Zn(e,t,s)):(et&&y&&hc(t),t.flags|=1,na(e,t,n,s),t.child)}function bm(e,t,a,n,s){if(e===null){var o=a.type;return typeof o=="function"&&!dc(o)&&o.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=o,ym(e,t,o,n,s)):(e=ki(a.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!su(e,s)){var m=o.memoizedProps;if(a=a.compare,a=a!==null?a:_s,a(m,n)&&e.ref===t.ref)return Zn(e,t,s)}return t.flags|=1,e=In(o,n),e.ref=t.ref,e.return=t,t.child=e}function ym(e,t,a,n,s){if(e!==null){var o=e.memoizedProps;if(_s(o,n)&&e.ref===t.ref)if(Bt=!1,t.pendingProps=n=o,su(e,s))(e.flags&131072)!==0&&(Bt=!0);else return t.lanes=e.lanes,Zn(e,t,s)}return Wc(e,t,a,n,s)}function vm(e,t,a,n){var s=n.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|a:a,e!==null){for(n=t.child=e.child,s=0;n!==null;)s=s|n.lanes|n.childLanes,n=n.sibling;n=s&~o}else n=0,t.child=null;return wm(e,t,o,a,n)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ji(t,o!==null?o.cachePool:null),o!==null?kf(t,o):Tc(),_f(t);else return n=t.lanes=536870912,wm(e,t,o!==null?o.baseLanes|a:a,a,n)}else o!==null?(ji(t,o.cachePool),kf(t,o),kl(),t.memoizedState=null):(e!==null&&ji(t,null),Tc(),kl());return na(e,t,s,a),t.child}function qs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function wm(e,t,a,n,s){var o=kc();return o=o===null?null:{parent:$t._currentValue,pool:o},t.memoizedState={baseLanes:a,cachePool:o},e!==null&&ji(t,null),Tc(),_f(t),e!==null&&Or(e,t,n,!0),t.childLanes=s,null}function Ii(e,t){return t=Vi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Sm(e,t,a){return dr(t,e.child,null,a),e=Ii(t,t.pendingProps),e.flags|=2,Ba(t),t.memoizedState=null,e}function f0(e,t,a){var n=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(et){if(n.mode==="hidden")return e=Ii(t,n),t.lanes=536870912,qs(null,e);if(Mc(t),(e=bt)?(e=Lh(e,tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pl!==null?{id:Nn,overflow:Tn}:null,retryLane:536870912,hydrationErrors:null},a=lf(e),a.return=t,t.child=a,ta=t,bt=null)):e=null,e===null)throw xl(t);return t.lanes=536870912,null}return Ii(t,n)}var o=e.memoizedState;if(o!==null){var m=o.dehydrated;if(Mc(t),s)if(t.flags&256)t.flags&=-257,t=Sm(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(Bt||Or(e,t,a,!1),s=(a&e.childLanes)!==0,Bt||s){if(n=pt,n!==null&&(m=$n(n,a),m!==0&&m!==o.retryLane))throw o.retryLane=m,nr(e,m),Na(n,e,m),Pc;eo(),t=Sm(e,t,a)}else e=o.treeContext,bt=nn(m.nextSibling),ta=t,et=!0,gl=null,tn=!1,e!==null&&of(t,e),t=Ii(t,n),t.flags|=4096;return t}return e=In(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Gi(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(c(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Wc(e,t,a,n,s){return ir(t),a=Dc(e,t,a,n,void 0,s),n=Lc(),e!==null&&!Bt?(Rc(e,t,s),Zn(e,t,s)):(et&&n&&hc(t),t.flags|=1,na(e,t,a,s),t.child)}function km(e,t,a,n,s,o){return ir(t),t.updateQueue=null,a=Cf(t,n,a,s),Af(e),n=Lc(),e!==null&&!Bt?(Rc(e,t,o),Zn(e,t,o)):(et&&n&&hc(t),t.flags|=1,na(e,t,a,o),t.child)}function _m(e,t,a,n,s){if(ir(t),t.stateNode===null){var o=Dr,m=a.contextType;typeof m=="object"&&m!==null&&(o=aa(m)),o=new a(n,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Kc,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=n,o.state=t.memoizedState,o.refs={},Ac(t),m=a.contextType,o.context=typeof m=="object"&&m!==null?aa(m):Dr,o.state=t.memoizedState,m=a.getDerivedStateFromProps,typeof m=="function"&&(Zc(t,a,m,n),o.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(m=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),m!==o.state&&Kc.enqueueReplaceState(o,o.state,null),Ls(t,n,o,s),Ds(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){o=t.stateNode;var y=t.memoizedProps,C=mr(a,y);o.props=C;var R=o.context,X=a.contextType;m=Dr,typeof X=="object"&&X!==null&&(m=aa(X));var Z=a.getDerivedStateFromProps;X=typeof Z=="function"||typeof o.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,X||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(y||R!==m)&&um(t,o,n,m),yl=!1;var $=t.memoizedState;o.state=$,Ls(t,n,o,s),Ds(),R=t.memoizedState,y||$!==R||yl?(typeof Z=="function"&&(Zc(t,a,Z,n),R=t.memoizedState),(C=yl||cm(t,a,C,n,$,R,m))?(X||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=R),o.props=n,o.state=R,o.context=m,n=C):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,Cc(e,t),m=t.memoizedProps,X=mr(a,m),o.props=X,Z=t.pendingProps,$=o.context,R=a.contextType,C=Dr,typeof R=="object"&&R!==null&&(C=aa(R)),y=a.getDerivedStateFromProps,(R=typeof y=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(m!==Z||$!==C)&&um(t,o,n,C),yl=!1,$=t.memoizedState,o.state=$,Ls(t,n,o,s),Ds();var F=t.memoizedState;m!==Z||$!==F||yl||e!==null&&e.dependencies!==null&&Ai(e.dependencies)?(typeof y=="function"&&(Zc(t,a,y,n),F=t.memoizedState),(X=yl||cm(t,a,X,n,$,F,C)||e!==null&&e.dependencies!==null&&Ai(e.dependencies))?(R||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,F,C),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,F,C)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=F),o.props=n,o.state=F,o.context=C,n=X):(typeof o.componentDidUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),n=!1)}return o=n,Gi(e,t),n=(t.flags&128)!==0,o||n?(o=t.stateNode,a=n&&typeof a.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&n?(t.child=dr(t,e.child,null,s),t.child=dr(t,null,a,s)):na(e,t,a,s),t.memoizedState=o.state,e=t.child):e=Zn(e,t,s),e}function Am(e,t,a,n){return rr(),t.flags|=256,na(e,t,a,n),t.child}var eu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function tu(e){return{baseLanes:e,cachePool:hf()}}function au(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Fa),e}function Cm(e,t,a){var n=t.pendingProps,s=!1,o=(t.flags&128)!==0,m;if((m=o)||(m=e!==null&&e.memoizedState===null?!1:(Nt.current&2)!==0),m&&(s=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(et){if(s?Sl(t):kl(),(e=bt)?(e=Lh(e,tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pl!==null?{id:Nn,overflow:Tn}:null,retryLane:536870912,hydrationErrors:null},a=lf(e),a.return=t,t.child=a,ta=t,bt=null)):e=null,e===null)throw xl(t);return $u(e)?t.lanes=32:t.lanes=536870912,null}var y=n.children;return n=n.fallback,s?(kl(),s=t.mode,y=Vi({mode:"hidden",children:y},s),n=lr(n,s,a,null),y.return=t,n.return=t,y.sibling=n,t.child=y,n=t.child,n.memoizedState=tu(a),n.childLanes=au(e,m,a),t.memoizedState=eu,qs(null,n)):(Sl(t),nu(t,y))}var C=e.memoizedState;if(C!==null&&(y=C.dehydrated,y!==null)){if(o)t.flags&256?(Sl(t),t.flags&=-257,t=lu(e,t,a)):t.memoizedState!==null?(kl(),t.child=e.child,t.flags|=128,t=null):(kl(),y=n.fallback,s=t.mode,n=Vi({mode:"visible",children:n.children},s),y=lr(y,s,a,null),y.flags|=2,n.return=t,y.return=t,n.sibling=y,t.child=n,dr(t,e.child,null,a),n=t.child,n.memoizedState=tu(a),n.childLanes=au(e,m,a),t.memoizedState=eu,t=qs(null,n));else if(Sl(t),$u(y)){if(m=y.nextSibling&&y.nextSibling.dataset,m)var R=m.dgst;m=R,n=Error(c(419)),n.stack="",n.digest=m,js({value:n,source:null,stack:null}),t=lu(e,t,a)}else if(Bt||Or(e,t,a,!1),m=(a&e.childLanes)!==0,Bt||m){if(m=pt,m!==null&&(n=$n(m,a),n!==0&&n!==C.retryLane))throw C.retryLane=n,nr(e,n),Na(m,e,n),Pc;Ou(y)||eo(),t=lu(e,t,a)}else Ou(y)?(t.flags|=192,t.child=e.child,t=null):(e=C.treeContext,bt=nn(y.nextSibling),ta=t,et=!0,gl=null,tn=!1,e!==null&&of(t,e),t=nu(t,n.children),t.flags|=4096);return t}return s?(kl(),y=n.fallback,s=t.mode,C=e.child,R=C.sibling,n=In(C,{mode:"hidden",children:n.children}),n.subtreeFlags=C.subtreeFlags&65011712,R!==null?y=In(R,y):(y=lr(y,s,a,null),y.flags|=2),y.return=t,n.return=t,n.sibling=y,t.child=n,qs(null,n),n=t.child,y=e.child.memoizedState,y===null?y=tu(a):(s=y.cachePool,s!==null?(C=$t._currentValue,s=s.parent!==C?{parent:C,pool:C}:s):s=hf(),y={baseLanes:y.baseLanes|a,cachePool:s}),n.memoizedState=y,n.childLanes=au(e,m,a),t.memoizedState=eu,qs(e.child,n)):(Sl(t),a=e.child,e=a.sibling,a=In(a,{mode:"visible",children:n.children}),a.return=t,a.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=a,t.memoizedState=null,a)}function nu(e,t){return t=Vi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Vi(e,t){return e=$a(22,e,null,t),e.lanes=0,e}function lu(e,t,a){return dr(t,e.child,null,a),e=nu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jm(e,t,a){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),yc(e.return,t,a)}function ru(e,t,a,n,s,o){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:s,treeForkCount:o}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=n,m.tail=a,m.tailMode=s,m.treeForkCount=o)}function Nm(e,t,a){var n=t.pendingProps,s=n.revealOrder,o=n.tail;n=n.children;var m=Nt.current,y=(m&2)!==0;if(y?(m=m&1|2,t.flags|=128):m&=1,G(Nt,m),na(e,t,n,a),n=et?Cs:0,!y&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jm(e,a,t);else if(e.tag===19)jm(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(a=t.child,s=null;a!==null;)e=a.alternate,e!==null&&Di(e)===null&&(s=a),a=a.sibling;a=s,a===null?(s=t.child,t.child=null):(s=a.sibling,a.sibling=null),ru(t,!1,s,a,o,n);break;case"backwards":case"unstable_legacy-backwards":for(a=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Di(e)===null){t.child=s;break}e=s.sibling,s.sibling=a,a=s,s=e}ru(t,!0,a,null,o,n);break;case"together":ru(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function Zn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Cl|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Or(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,a=In(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=In(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function su(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ai(e)))}function m0(e,t,a){switch(t.tag){case 3:ae(t,t.stateNode.containerInfo),bl(t,$t,e.memoizedState.cache),rr();break;case 27:case 5:xe(t);break;case 4:ae(t,t.stateNode.containerInfo);break;case 10:bl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Mc(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Sl(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Cm(e,t,a):(Sl(t),e=Zn(e,t,a),e!==null?e.sibling:null);Sl(t);break;case 19:var s=(e.flags&128)!==0;if(n=(a&t.childLanes)!==0,n||(Or(e,t,a,!1),n=(a&t.childLanes)!==0),s){if(n)return Nm(e,t,a);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),G(Nt,Nt.current),n)break;return null;case 22:return t.lanes=0,vm(e,t,a,t.pendingProps);case 24:bl(t,$t,e.memoizedState.cache)}return Zn(e,t,a)}function Tm(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Bt=!0;else{if(!su(e,a)&&(t.flags&128)===0)return Bt=!1,m0(e,t,a);Bt=(e.flags&131072)!==0}else Bt=!1,et&&(t.flags&1048576)!==0&&sf(t,Cs,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=cr(t.elementType),t.type=e,typeof e=="function")dc(e)?(n=mr(e,n),t.tag=1,t=_m(null,t,e,n,a)):(t.tag=0,t=Wc(null,t,e,n,a));else{if(e!=null){var s=e.$$typeof;if(s===z){t.tag=11,t=xm(null,t,e,n,a);break e}else if(s===j){t.tag=14,t=bm(null,t,e,n,a);break e}}throw t=te(e)||e,Error(c(306,t,""))}}return t;case 0:return Wc(e,t,t.type,t.pendingProps,a);case 1:return n=t.type,s=mr(n,t.pendingProps),_m(e,t,n,s,a);case 3:e:{if(ae(t,t.stateNode.containerInfo),e===null)throw Error(c(387));n=t.pendingProps;var o=t.memoizedState;s=o.element,Cc(e,t),Ls(t,n,null,a);var m=t.memoizedState;if(n=m.cache,bl(t,$t,n),n!==o.cache&&vc(t,[$t],a,!0),Ds(),n=m.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Am(e,t,n,a);break e}else if(n!==s){s=Pa(Error(c(424)),t),js(s),t=Am(e,t,n,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(bt=nn(e.firstChild),ta=t,et=!0,gl=null,tn=!0,a=vf(t,null,n,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(rr(),n===s){t=Zn(e,t,a);break e}na(e,t,n,a)}t=t.child}return t;case 26:return Gi(e,t),e===null?(a=Bh(t.type,null,t.pendingProps,null))?t.memoizedState=a:et||(a=t.type,e=t.pendingProps,n=io(fe.current).createElement(a),n[jt]=t,n[Ut]=e,la(n,a,e),ot(n),t.stateNode=n):t.memoizedState=Bh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return xe(t),e===null&&et&&(n=t.stateNode=Oh(t.type,t.pendingProps,fe.current),ta=t,tn=!0,s=bt,Ml(t.type)?(qu=s,bt=nn(n.firstChild)):bt=s),na(e,t,t.pendingProps.children,a),Gi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&et&&((s=n=bt)&&(n=I0(n,t.type,t.pendingProps,tn),n!==null?(t.stateNode=n,ta=t,bt=nn(n.firstChild),tn=!1,s=!0):s=!1),s||xl(t)),xe(t),s=t.type,o=t.pendingProps,m=e!==null?e.memoizedProps:null,n=o.children,Lu(s,o)?n=null:m!==null&&Lu(s,m)&&(t.flags|=32),t.memoizedState!==null&&(s=Dc(e,t,l0,null,null,a),ei._currentValue=s),Gi(e,t),na(e,t,n,a),t.child;case 6:return e===null&&et&&((e=a=bt)&&(a=G0(a,t.pendingProps,tn),a!==null?(t.stateNode=a,ta=t,bt=null,e=!0):e=!1),e||xl(t)),null;case 13:return Cm(e,t,a);case 4:return ae(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=dr(t,null,n,a):na(e,t,n,a),t.child;case 11:return xm(e,t,t.type,t.pendingProps,a);case 7:return na(e,t,t.pendingProps,a),t.child;case 8:return na(e,t,t.pendingProps.children,a),t.child;case 12:return na(e,t,t.pendingProps.children,a),t.child;case 10:return n=t.pendingProps,bl(t,t.type,n.value),na(e,t,n.children,a),t.child;case 9:return s=t.type._context,n=t.pendingProps.children,ir(t),s=aa(s),n=n(s),t.flags|=1,na(e,t,n,a),t.child;case 14:return bm(e,t,t.type,t.pendingProps,a);case 15:return ym(e,t,t.type,t.pendingProps,a);case 19:return Nm(e,t,a);case 31:return f0(e,t,a);case 22:return vm(e,t,a,t.pendingProps);case 24:return ir(t),n=aa($t),e===null?(s=kc(),s===null&&(s=pt,o=wc(),s.pooledCache=o,o.refCount++,o!==null&&(s.pooledCacheLanes|=a),s=o),t.memoizedState={parent:n,cache:s},Ac(t),bl(t,$t,s)):((e.lanes&a)!==0&&(Cc(e,t),Ls(t,null,null,a),Ds()),s=e.memoizedState,o=t.memoizedState,s.parent!==n?(s={parent:n,cache:n},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),bl(t,$t,n)):(n=o.cache,bl(t,$t,n),n!==s.cache&&vc(t,[$t],a,!0))),na(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function Kn(e){e.flags|=4}function iu(e,t,a,n,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(ah())e.flags|=8192;else throw ur=Ti,_c}else e.flags&=-16777217}function Em(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Vh(t))if(ah())e.flags|=8192;else throw ur=Ti,_c}function Xi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?sl():536870912,e.lanes|=t,Zr|=t)}function Bs(e,t){if(!et)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function yt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,n=0;if(t)for(var s=e.child;s!==null;)a|=s.lanes|s.childLanes,n|=s.subtreeFlags&65011712,n|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)a|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=a,t}function h0(e,t,a){var n=t.pendingProps;switch(pc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yt(t),null;case 1:return yt(t),null;case 3:return a=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xn($t),ie(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ur(t)?Kn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,xc())),yt(t),null;case 26:var s=t.type,o=t.memoizedState;return e===null?(Kn(t),o!==null?(yt(t),Em(t,o)):(yt(t),iu(t,s,null,n,a))):o?o!==e.memoizedState?(Kn(t),yt(t),Em(t,o)):(yt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&Kn(t),yt(t),iu(t,s,e,n,a)),null;case 27:if(Ne(t),a=fe.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Kn(t);else{if(!n){if(t.stateNode===null)throw Error(c(166));return yt(t),null}e=me.current,Ur(t)?cf(t):(e=Oh(s,n,a),t.stateNode=e,Kn(t))}return yt(t),null;case 5:if(Ne(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Kn(t);else{if(!n){if(t.stateNode===null)throw Error(c(166));return yt(t),null}if(o=me.current,Ur(t))cf(t);else{var m=io(fe.current);switch(o){case 1:o=m.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:o=m.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":o=m.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":o=m.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":o=m.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof n.is=="string"?m.createElement("select",{is:n.is}):m.createElement("select"),n.multiple?o.multiple=!0:n.size&&(o.size=n.size);break;default:o=typeof n.is=="string"?m.createElement(s,{is:n.is}):m.createElement(s)}}o[jt]=t,o[Ut]=n;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)o.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=o;e:switch(la(o,s,n),s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Kn(t)}}return yt(t),iu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Kn(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(c(166));if(e=fe.current,Ur(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,s=ta,s!==null)switch(s.tag){case 27:case 5:n=s.memoizedProps}e[jt]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||Ch(e.nodeValue,a)),e||xl(t,!0)}else e=io(e).createTextNode(n),e[jt]=t,t.stateNode=e}return yt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=Ur(t),a!==null){if(e===null){if(!n)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[jt]=t}else rr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),e=!1}else a=xc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Ba(t),t):(Ba(t),null);if((t.flags&128)!==0)throw Error(c(558))}return yt(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Ur(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(317));s[jt]=t}else rr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),s=!1}else s=xc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Ba(t),t):(Ba(t),null)}return Ba(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,s=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(s=n.alternate.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==s&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Xi(t,t.updateQueue),yt(t),null);case 4:return ie(),e===null&&Tu(t.stateNode.containerInfo),yt(t),null;case 10:return Xn(t.type),yt(t),null;case 19:if(pe(Nt),n=t.memoizedState,n===null)return yt(t),null;if(s=(t.flags&128)!==0,o=n.rendering,o===null)if(s)Bs(n,!1);else{if(Ct!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=Di(e),o!==null){for(t.flags|=128,Bs(n,!1),e=o.updateQueue,t.updateQueue=e,Xi(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)nf(a,e),a=a.sibling;return G(Nt,Nt.current&1|2),et&&Gn(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&we()>Ji&&(t.flags|=128,s=!0,Bs(n,!1),t.lanes=4194304)}else{if(!s)if(e=Di(o),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Xi(t,e),Bs(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!et)return yt(t),null}else 2*we()-n.renderingStartTime>Ji&&a!==536870912&&(t.flags|=128,s=!0,Bs(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(e=n.last,e!==null?e.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=we(),e.sibling=null,a=Nt.current,G(Nt,s?a&1|2:a&1),et&&Gn(t,n.treeForkCount),e):(yt(t),null);case 22:case 23:return Ba(t),Ec(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(yt(t),t.subtreeFlags&6&&(t.flags|=8192)):yt(t),a=t.updateQueue,a!==null&&Xi(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&pe(or),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Xn($t),yt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function p0(e,t){switch(pc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xn($t),ie(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Ba(t),t.alternate===null)throw Error(c(340));rr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ba(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));rr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pe(Nt),null;case 4:return ie(),null;case 10:return Xn(t.type),null;case 22:case 23:return Ba(t),Ec(),e!==null&&pe(or),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xn($t),null;case 25:return null;default:return null}}function Mm(e,t){switch(pc(t),t.tag){case 3:Xn($t),ie();break;case 26:case 27:case 5:Ne(t);break;case 4:ie();break;case 31:t.memoizedState!==null&&Ba(t);break;case 13:Ba(t);break;case 19:pe(Nt);break;case 10:Xn(t.type);break;case 22:case 23:Ba(t),Ec(),e!==null&&pe(or);break;case 24:Xn($t)}}function Hs(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var s=n.next;a=s;do{if((a.tag&e)===e){n=void 0;var o=a.create,m=a.inst;n=o(),m.destroy=n}a=a.next}while(a!==s)}}catch(y){ut(t,t.return,y)}}function _l(e,t,a){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var o=s.next;n=o;do{if((n.tag&e)===e){var m=n.inst,y=m.destroy;if(y!==void 0){m.destroy=void 0,s=t;var C=a,R=y;try{R()}catch(X){ut(s,C,X)}}}n=n.next}while(n!==o)}}catch(X){ut(t,t.return,X)}}function zm(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Sf(t,a)}catch(n){ut(e,e.return,n)}}}function Dm(e,t,a){a.props=mr(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){ut(e,t,n)}}function Fs(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(s){ut(e,t,s)}}function En(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(s){ut(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(s){ut(e,t,s)}else a.current=null}function Lm(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(s){ut(e,e.return,s)}}function ou(e,t,a){try{var n=e.stateNode;O0(n,e.type,a,t),n[Ut]=t}catch(s){ut(e,e.return,s)}}function Rm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ml(e.type)||e.tag===4}function cu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rm(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&&Ml(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function uu(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ya));else if(n!==4&&(n===27&&Ml(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(uu(e,t,a),e=e.sibling;e!==null;)uu(e,t,a),e=e.sibling}function Yi(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&Ml(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Yi(e,t,a),e=e.sibling;e!==null;)Yi(e,t,a),e=e.sibling}function Um(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);la(t,n,a),t[jt]=e,t[Ut]=a}catch(o){ut(e,e.return,o)}}var Jn=!1,Ht=!1,du=!1,Om=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function g0(e,t){if(e=e.containerInfo,zu=po,e=Qd(e),lc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var s=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{a.nodeType,o.nodeType}catch{a=null;break e}var m=0,y=-1,C=-1,R=0,X=0,Z=e,$=null;t:for(;;){for(var F;Z!==a||s!==0&&Z.nodeType!==3||(y=m+s),Z!==o||n!==0&&Z.nodeType!==3||(C=m+n),Z.nodeType===3&&(m+=Z.nodeValue.length),(F=Z.firstChild)!==null;)$=Z,Z=F;for(;;){if(Z===e)break t;if($===a&&++R===s&&(y=m),$===o&&++X===n&&(C=m),(F=Z.nextSibling)!==null)break;Z=$,$=Z.parentNode}Z=F}a=y===-1||C===-1?null:{start:y,end:C}}else a=null}a=a||{start:0,end:0}}else a=null;for(Du={focusedElem:e,selectionRange:a},po=!1,Zt=t;Zt!==null;)if(t=Zt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Zt=e;else for(;Zt!==null;){switch(t=Zt,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)s=e[a],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,a=t,s=o.memoizedProps,o=o.memoizedState,n=a.stateNode;try{var ke=mr(a.type,s);e=n.getSnapshotBeforeUpdate(ke,o),n.__reactInternalSnapshotBeforeUpdate=e}catch(Ue){ut(a,a.return,Ue)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Uu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Uu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(c(163))}if(e=t.sibling,e!==null){e.return=t.return,Zt=e;break}Zt=t.return}}function $m(e,t,a){var n=a.flags;switch(a.tag){case 0:case 11:case 15:Wn(e,a),n&4&&Hs(5,a);break;case 1:if(Wn(e,a),n&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(m){ut(a,a.return,m)}else{var s=mr(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){ut(a,a.return,m)}}n&64&&zm(a),n&512&&Fs(a,a.return);break;case 3:if(Wn(e,a),n&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Sf(e,t)}catch(m){ut(a,a.return,m)}}break;case 27:t===null&&n&4&&Um(a);case 26:case 5:Wn(e,a),t===null&&n&4&&Lm(a),n&512&&Fs(a,a.return);break;case 12:Wn(e,a);break;case 31:Wn(e,a),n&4&&Hm(e,a);break;case 13:Wn(e,a),n&4&&Fm(e,a),n&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=A0.bind(null,a),V0(e,a))));break;case 22:if(n=a.memoizedState!==null||Jn,!n){t=t!==null&&t.memoizedState!==null||Ht,s=Jn;var o=Ht;Jn=n,(Ht=t)&&!o?el(e,a,(a.subtreeFlags&8772)!==0):Wn(e,a),Jn=s,Ht=o}break;case 30:break;default:Wn(e,a)}}function qm(e){var t=e.alternate;t!==null&&(e.alternate=null,qm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Va(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 St=null,_a=!1;function Pn(e,t,a){for(a=a.child;a!==null;)Bm(e,t,a),a=a.sibling}function Bm(e,t,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Lt,a)}catch{}switch(a.tag){case 26:Ht||En(a,t),Pn(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ht||En(a,t);var n=St,s=_a;Ml(a.type)&&(St=a.stateNode,_a=!1),Pn(e,t,a),Js(a.stateNode),St=n,_a=s;break;case 5:Ht||En(a,t);case 6:if(n=St,s=_a,St=null,Pn(e,t,a),St=n,_a=s,St!==null)if(_a)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(a.stateNode)}catch(o){ut(a,t,o)}else try{St.removeChild(a.stateNode)}catch(o){ut(a,t,o)}break;case 18:St!==null&&(_a?(e=St,zh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ns(e)):zh(St,a.stateNode));break;case 4:n=St,s=_a,St=a.stateNode.containerInfo,_a=!0,Pn(e,t,a),St=n,_a=s;break;case 0:case 11:case 14:case 15:_l(2,a,t),Ht||_l(4,a,t),Pn(e,t,a);break;case 1:Ht||(En(a,t),n=a.stateNode,typeof n.componentWillUnmount=="function"&&Dm(a,t,n)),Pn(e,t,a);break;case 21:Pn(e,t,a);break;case 22:Ht=(n=Ht)||a.memoizedState!==null,Pn(e,t,a),Ht=n;break;default:Pn(e,t,a)}}function Hm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ns(e)}catch(a){ut(t,t.return,a)}}}function Fm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ns(e)}catch(a){ut(t,t.return,a)}}function x0(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Om),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Om),t;default:throw Error(c(435,e.tag))}}function Qi(e,t){var a=x0(e);t.forEach(function(n){if(!a.has(n)){a.add(n);var s=C0.bind(null,e,n);n.then(s,s)}})}function Aa(e,t){var a=t.deletions;if(a!==null)for(var n=0;n<a.length;n++){var s=a[n],o=e,m=t,y=m;e:for(;y!==null;){switch(y.tag){case 27:if(Ml(y.type)){St=y.stateNode,_a=!1;break e}break;case 5:St=y.stateNode,_a=!1;break e;case 3:case 4:St=y.stateNode.containerInfo,_a=!0;break e}y=y.return}if(St===null)throw Error(c(160));Bm(o,m,s),St=null,_a=!1,o=s.alternate,o!==null&&(o.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Im(t,e),t=t.sibling}var xn=null;function Im(e,t){var a=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Aa(t,e),Ca(e),n&4&&(_l(3,e,e.return),Hs(3,e),_l(5,e,e.return));break;case 1:Aa(t,e),Ca(e),n&512&&(Ht||a===null||En(a,a.return)),n&64&&Jn&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:var s=xn;if(Aa(t,e),Ca(e),n&512&&(Ht||a===null||En(a,a.return)),n&4){var o=a!==null?a.memoizedState:null;if(n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null){e:{n=e.type,a=e.memoizedProps,s=s.ownerDocument||s;t:switch(n){case"title":o=s.getElementsByTagName("title")[0],(!o||o[kn]||o[jt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=s.createElement(n),s.head.insertBefore(o,s.querySelector("head > title"))),la(o,n,a),o[jt]=e,ot(o),n=o;break e;case"link":var m=Ih("link","href",s).get(n+(a.href||""));if(m){for(var y=0;y<m.length;y++)if(o=m[y],o.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&o.getAttribute("rel")===(a.rel==null?null:a.rel)&&o.getAttribute("title")===(a.title==null?null:a.title)&&o.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){m.splice(y,1);break t}}o=s.createElement(n),la(o,n,a),s.head.appendChild(o);break;case"meta":if(m=Ih("meta","content",s).get(n+(a.content||""))){for(y=0;y<m.length;y++)if(o=m[y],o.getAttribute("content")===(a.content==null?null:""+a.content)&&o.getAttribute("name")===(a.name==null?null:a.name)&&o.getAttribute("property")===(a.property==null?null:a.property)&&o.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&o.getAttribute("charset")===(a.charSet==null?null:a.charSet)){m.splice(y,1);break t}}o=s.createElement(n),la(o,n,a),s.head.appendChild(o);break;default:throw Error(c(468,n))}o[jt]=e,ot(o),n=o}e.stateNode=n}else Gh(s,e.type,e.stateNode);else e.stateNode=Fh(s,n,e.memoizedProps);else o!==n?(o===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):o.count--,n===null?Gh(s,e.type,e.stateNode):Fh(s,n,e.memoizedProps)):n===null&&e.stateNode!==null&&ou(e,e.memoizedProps,a.memoizedProps)}break;case 27:Aa(t,e),Ca(e),n&512&&(Ht||a===null||En(a,a.return)),a!==null&&n&4&&ou(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Aa(t,e),Ca(e),n&512&&(Ht||a===null||En(a,a.return)),e.flags&32){s=e.stateNode;try{ul(s,"")}catch(ke){ut(e,e.return,ke)}}n&4&&e.stateNode!=null&&(s=e.memoizedProps,ou(e,s,a!==null?a.memoizedProps:s)),n&1024&&(du=!0);break;case 6:if(Aa(t,e),Ca(e),n&4){if(e.stateNode===null)throw Error(c(162));n=e.memoizedProps,a=e.stateNode;try{a.nodeValue=n}catch(ke){ut(e,e.return,ke)}}break;case 3:if(uo=null,s=xn,xn=oo(t.containerInfo),Aa(t,e),xn=s,Ca(e),n&4&&a!==null&&a.memoizedState.isDehydrated)try{ns(t.containerInfo)}catch(ke){ut(e,e.return,ke)}du&&(du=!1,Gm(e));break;case 4:n=xn,xn=oo(e.stateNode.containerInfo),Aa(t,e),Ca(e),xn=n;break;case 12:Aa(t,e),Ca(e);break;case 31:Aa(t,e),Ca(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Qi(e,n)));break;case 13:Aa(t,e),Ca(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Ki=we()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Qi(e,n)));break;case 22:s=e.memoizedState!==null;var C=a!==null&&a.memoizedState!==null,R=Jn,X=Ht;if(Jn=R||s,Ht=X||C,Aa(t,e),Ht=X,Jn=R,Ca(e),n&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(a===null||C||Jn||Ht||hr(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){C=a=t;try{if(o=C.stateNode,s)m=o.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{y=C.stateNode;var Z=C.memoizedProps.style,$=Z!=null&&Z.hasOwnProperty("display")?Z.display:null;y.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(ke){ut(C,C.return,ke)}}}else if(t.tag===6){if(a===null){C=t;try{C.stateNode.nodeValue=s?"":C.memoizedProps}catch(ke){ut(C,C.return,ke)}}}else if(t.tag===18){if(a===null){C=t;try{var F=C.stateNode;s?Dh(F,!0):Dh(C.stateNode,!1)}catch(ke){ut(C,C.return,ke)}}}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 e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,Qi(e,a))));break;case 19:Aa(t,e),Ca(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Qi(e,n)));break;case 30:break;case 21:break;default:Aa(t,e),Ca(e)}}function Ca(e){var t=e.flags;if(t&2){try{for(var a,n=e.return;n!==null;){if(Rm(n)){a=n;break}n=n.return}if(a==null)throw Error(c(160));switch(a.tag){case 27:var s=a.stateNode,o=cu(e);Yi(e,o,s);break;case 5:var m=a.stateNode;a.flags&32&&(ul(m,""),a.flags&=-33);var y=cu(e);Yi(e,y,m);break;case 3:case 4:var C=a.stateNode.containerInfo,R=cu(e);uu(e,R,C);break;default:throw Error(c(161))}}catch(X){ut(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Gm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Gm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Wn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)$m(e,t.alternate,t),t=t.sibling}function hr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:_l(4,t,t.return),hr(t);break;case 1:En(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Dm(t,t.return,a),hr(t);break;case 27:Js(t.stateNode);case 26:case 5:En(t,t.return),hr(t);break;case 22:t.memoizedState===null&&hr(t);break;case 30:hr(t);break;default:hr(t)}e=e.sibling}}function el(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,s=e,o=t,m=o.flags;switch(o.tag){case 0:case 11:case 15:el(s,o,a),Hs(4,o);break;case 1:if(el(s,o,a),n=o,s=n.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(R){ut(n,n.return,R)}if(n=o,s=n.updateQueue,s!==null){var y=n.stateNode;try{var C=s.shared.hiddenCallbacks;if(C!==null)for(s.shared.hiddenCallbacks=null,s=0;s<C.length;s++)wf(C[s],y)}catch(R){ut(n,n.return,R)}}a&&m&64&&zm(o),Fs(o,o.return);break;case 27:Um(o);case 26:case 5:el(s,o,a),a&&n===null&&m&4&&Lm(o),Fs(o,o.return);break;case 12:el(s,o,a);break;case 31:el(s,o,a),a&&m&4&&Hm(s,o);break;case 13:el(s,o,a),a&&m&4&&Fm(s,o);break;case 22:o.memoizedState===null&&el(s,o,a),Fs(o,o.return);break;case 30:break;default:el(s,o,a)}t=t.sibling}}function fu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Ns(a))}function mu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ns(e))}function bn(e,t,a,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Vm(e,t,a,n),t=t.sibling}function Vm(e,t,a,n){var s=t.flags;switch(t.tag){case 0:case 11:case 15:bn(e,t,a,n),s&2048&&Hs(9,t);break;case 1:bn(e,t,a,n);break;case 3:bn(e,t,a,n),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ns(e)));break;case 12:if(s&2048){bn(e,t,a,n),e=t.stateNode;try{var o=t.memoizedProps,m=o.id,y=o.onPostCommit;typeof y=="function"&&y(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(C){ut(t,t.return,C)}}else bn(e,t,a,n);break;case 31:bn(e,t,a,n);break;case 13:bn(e,t,a,n);break;case 23:break;case 22:o=t.stateNode,m=t.alternate,t.memoizedState!==null?o._visibility&2?bn(e,t,a,n):Is(e,t):o._visibility&2?bn(e,t,a,n):(o._visibility|=2,Xr(e,t,a,n,(t.subtreeFlags&10256)!==0||!1)),s&2048&&fu(m,t);break;case 24:bn(e,t,a,n),s&2048&&mu(t.alternate,t);break;default:bn(e,t,a,n)}}function Xr(e,t,a,n,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,m=t,y=a,C=n,R=m.flags;switch(m.tag){case 0:case 11:case 15:Xr(o,m,y,C,s),Hs(8,m);break;case 23:break;case 22:var X=m.stateNode;m.memoizedState!==null?X._visibility&2?Xr(o,m,y,C,s):Is(o,m):(X._visibility|=2,Xr(o,m,y,C,s)),s&&R&2048&&fu(m.alternate,m);break;case 24:Xr(o,m,y,C,s),s&&R&2048&&mu(m.alternate,m);break;default:Xr(o,m,y,C,s)}t=t.sibling}}function Is(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,n=t,s=n.flags;switch(n.tag){case 22:Is(a,n),s&2048&&fu(n.alternate,n);break;case 24:Is(a,n),s&2048&&mu(n.alternate,n);break;default:Is(a,n)}t=t.sibling}}var Gs=8192;function Yr(e,t,a){if(e.subtreeFlags&Gs)for(e=e.child;e!==null;)Xm(e,t,a),e=e.sibling}function Xm(e,t,a){switch(e.tag){case 26:Yr(e,t,a),e.flags&Gs&&e.memoizedState!==null&&nx(a,xn,e.memoizedState,e.memoizedProps);break;case 5:Yr(e,t,a);break;case 3:case 4:var n=xn;xn=oo(e.stateNode.containerInfo),Yr(e,t,a),xn=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Gs,Gs=16777216,Yr(e,t,a),Gs=n):Yr(e,t,a));break;default:Yr(e,t,a)}}function Ym(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 Vs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];Zt=n,Zm(n,e)}Ym(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Qm(e),e=e.sibling}function Qm(e){switch(e.tag){case 0:case 11:case 15:Vs(e),e.flags&2048&&_l(9,e,e.return);break;case 3:Vs(e);break;case 12:Vs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Zi(e)):Vs(e);break;default:Vs(e)}}function Zi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];Zt=n,Zm(n,e)}Ym(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:_l(8,t,t.return),Zi(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Zi(t));break;default:Zi(t)}e=e.sibling}}function Zm(e,t){for(;Zt!==null;){var a=Zt;switch(a.tag){case 0:case 11:case 15:_l(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var n=a.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Ns(a.memoizedState.cache)}if(n=a.child,n!==null)n.return=a,Zt=n;else e:for(a=e;Zt!==null;){n=Zt;var s=n.sibling,o=n.return;if(qm(n),n===a){Zt=null;break e}if(s!==null){s.return=o,Zt=s;break e}Zt=o}}}var b0={getCacheForType:function(e){var t=aa($t),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return aa($t).controller.signal}},y0=typeof WeakMap=="function"?WeakMap:Map,rt=0,pt=null,Ke=null,Pe=0,ct=0,Ha=null,Al=!1,Qr=!1,hu=!1,tl=0,Ct=0,Cl=0,pr=0,pu=0,Fa=0,Zr=0,Xs=null,ja=null,gu=!1,Ki=0,Km=0,Ji=1/0,Pi=null,jl=null,Vt=0,Nl=null,Kr=null,al=0,xu=0,bu=null,Jm=null,Ys=0,yu=null;function Ia(){return(rt&2)!==0&&Pe!==0?Pe&-Pe:E.T!==null?Au():un()}function Pm(){if(Fa===0)if((Pe&536870912)===0||et){var e=it;it<<=1,(it&3932160)===0&&(it=262144),Fa=e}else Fa=536870912;return e=qa.current,e!==null&&(e.flags|=32),Fa}function Na(e,t,a){(e===pt&&(ct===2||ct===9)||e.cancelPendingCommit!==null)&&(Jr(e,0),Tl(e,Pe,Fa,!1)),Ga(e,a),((rt&2)===0||e!==pt)&&(e===pt&&((rt&2)===0&&(pr|=a),Ct===4&&Tl(e,Pe,Fa,!1)),Mn(e))}function Wm(e,t,a){if((rt&6)!==0)throw Error(c(327));var n=!a&&(t&127)===0&&(t&e.expiredLanes)===0||on(e,t),s=n?S0(e,t):wu(e,t,!0),o=n;do{if(s===0){Qr&&!n&&Tl(e,t,0,!1);break}else{if(a=e.current.alternate,o&&!v0(a)){s=wu(e,t,!1),o=!1;continue}if(s===2){if(o=t,e.errorRecoveryDisabledLanes&o)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var y=e;s=Xs;var C=y.current.memoizedState.isDehydrated;if(C&&(Jr(y,m).flags|=256),m=wu(y,m,!1),m!==2){if(hu&&!C){y.errorRecoveryDisabledLanes|=o,pr|=o,s=4;break e}o=ja,ja=s,o!==null&&(ja===null?ja=o:ja.push.apply(ja,o))}s=m}if(o=!1,s!==2)continue}}if(s===1){Jr(e,0),Tl(e,t,0,!0);break}e:{switch(n=e,o=s,o){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:Tl(n,t,Fa,!Al);break e;case 2:ja=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(s=Ki+300-we(),10<s)){if(Tl(n,t,Fa,!Al),Rt(n,0,!0)!==0)break e;al=t,n.timeoutHandle=Eh(eh.bind(null,n,a,ja,Pi,gu,t,Fa,pr,Zr,Al,o,"Throttled",-0,0),s);break e}eh(n,a,ja,Pi,gu,t,Fa,pr,Zr,Al,o,null,-0,0)}}break}while(!0);Mn(e)}function eh(e,t,a,n,s,o,m,y,C,R,X,Z,$,F){if(e.timeoutHandle=-1,Z=t.subtreeFlags,Z&8192||(Z&16785408)===16785408){Z={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ya},Xm(t,o,Z);var ke=(o&62914560)===o?Ki-we():(o&4194048)===o?Km-we():0;if(ke=lx(Z,ke),ke!==null){al=o,e.cancelPendingCommit=ke(oh.bind(null,e,t,o,a,n,s,m,y,C,X,Z,null,$,F)),Tl(e,o,m,!R);return}}oh(e,t,o,a,n,s,m,y,C)}function v0(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var n=0;n<a.length;n++){var s=a[n],o=s.getSnapshot;s=s.value;try{if(!Oa(o(),s))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 Tl(e,t,a,n){t&=~pu,t&=~pr,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var s=t;0<s;){var o=31-Re(s),m=1<<o;n[o]=-1,s&=~m}a!==0&&Fl(e,a,t)}function Wi(){return(rt&6)===0?(Qs(0),!1):!0}function vu(){if(Ke!==null){if(ct===0)var e=Ke.return;else e=Ke,Vn=sr=null,Uc(e),Hr=null,Es=0,e=Ke;for(;e!==null;)Mm(e.alternate,e),e=e.return;Ke=null}}function Jr(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,B0(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),al=0,vu(),pt=e,Ke=a=In(e.current,null),Pe=t,ct=0,Ha=null,Al=!1,Qr=on(e,t),hu=!1,Zr=Fa=pu=pr=Cl=Ct=0,ja=Xs=null,gu=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var s=31-Re(n),o=1<<s;t|=e[s],n&=~o}return tl=t,vi(),a}function th(e,t){Ve=null,E.H=$s,t===Br||t===Ni?(t=xf(),ct=3):t===_c?(t=xf(),ct=4):ct=t===Pc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ha=t,Ke===null&&(Ct=1,Fi(e,Pa(t,e.current)))}function ah(){var e=qa.current;return e===null?!0:(Pe&4194048)===Pe?an===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===an:!1}function nh(){var e=E.H;return E.H=$s,e===null?$s:e}function lh(){var e=E.A;return E.A=b0,e}function eo(){Ct=4,Al||(Pe&4194048)!==Pe&&qa.current!==null||(Qr=!0),(Cl&134217727)===0&&(pr&134217727)===0||pt===null||Tl(pt,Pe,Fa,!1)}function wu(e,t,a){var n=rt;rt|=2;var s=nh(),o=lh();(pt!==e||Pe!==t)&&(Pi=null,Jr(e,t)),t=!1;var m=Ct;e:do try{if(ct!==0&&Ke!==null){var y=Ke,C=Ha;switch(ct){case 8:vu(),m=6;break e;case 3:case 2:case 9:case 6:qa.current===null&&(t=!0);var R=ct;if(ct=0,Ha=null,Pr(e,y,C,R),a&&Qr){m=0;break e}break;default:R=ct,ct=0,Ha=null,Pr(e,y,C,R)}}w0(),m=Ct;break}catch(X){th(e,X)}while(!0);return t&&e.shellSuspendCounter++,Vn=sr=null,rt=n,E.H=s,E.A=o,Ke===null&&(pt=null,Pe=0,vi()),m}function w0(){for(;Ke!==null;)rh(Ke)}function S0(e,t){var a=rt;rt|=2;var n=nh(),s=lh();pt!==e||Pe!==t?(Pi=null,Ji=we()+500,Jr(e,t)):Qr=on(e,t);e:do try{if(ct!==0&&Ke!==null){t=Ke;var o=Ha;t:switch(ct){case 1:ct=0,Ha=null,Pr(e,t,o,1);break;case 2:case 9:if(pf(o)){ct=0,Ha=null,sh(t);break}t=function(){ct!==2&&ct!==9||pt!==e||(ct=7),Mn(e)},o.then(t,t);break e;case 3:ct=7;break e;case 4:ct=5;break e;case 7:pf(o)?(ct=0,Ha=null,sh(t)):(ct=0,Ha=null,Pr(e,t,o,7));break;case 5:var m=null;switch(Ke.tag){case 26:m=Ke.memoizedState;case 5:case 27:var y=Ke;if(m?Vh(m):y.stateNode.complete){ct=0,Ha=null;var C=y.sibling;if(C!==null)Ke=C;else{var R=y.return;R!==null?(Ke=R,to(R)):Ke=null}break t}}ct=0,Ha=null,Pr(e,t,o,5);break;case 6:ct=0,Ha=null,Pr(e,t,o,6);break;case 8:vu(),Ct=6;break e;default:throw Error(c(462))}}k0();break}catch(X){th(e,X)}while(!0);return Vn=sr=null,E.H=n,E.A=s,rt=a,Ke!==null?0:(pt=null,Pe=0,vi(),Ct)}function k0(){for(;Ke!==null&&!Ee();)rh(Ke)}function rh(e){var t=Tm(e.alternate,e,tl);e.memoizedProps=e.pendingProps,t===null?to(e):Ke=t}function sh(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=km(a,t,t.pendingProps,t.type,void 0,Pe);break;case 11:t=km(a,t,t.pendingProps,t.type.render,t.ref,Pe);break;case 5:Uc(t);default:Mm(a,t),t=Ke=nf(t,tl),t=Tm(a,t,tl)}e.memoizedProps=e.pendingProps,t===null?to(e):Ke=t}function Pr(e,t,a,n){Vn=sr=null,Uc(t),Hr=null,Es=0;var s=t.return;try{if(d0(e,s,t,a,Pe)){Ct=1,Fi(e,Pa(a,e.current)),Ke=null;return}}catch(o){if(s!==null)throw Ke=s,o;Ct=1,Fi(e,Pa(a,e.current)),Ke=null;return}t.flags&32768?(et||n===1?e=!0:Qr||(Pe&536870912)!==0?e=!1:(Al=e=!0,(n===2||n===9||n===3||n===6)&&(n=qa.current,n!==null&&n.tag===13&&(n.flags|=16384))),ih(t,e)):to(t)}function to(e){var t=e;do{if((t.flags&32768)!==0){ih(t,Al);return}e=t.return;var a=h0(t.alternate,t,tl);if(a!==null){Ke=a;return}if(t=t.sibling,t!==null){Ke=t;return}Ke=t=e}while(t!==null);Ct===0&&(Ct=5)}function ih(e,t){do{var a=p0(e.alternate,e);if(a!==null){a.flags&=32767,Ke=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Ke=e;return}Ke=e=a}while(e!==null);Ct=6,Ke=null}function oh(e,t,a,n,s,o,m,y,C){e.cancelPendingCommit=null;do ao();while(Vt!==0);if((rt&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(o=t.lanes|t.childLanes,o|=cc,ca(e,a,o,m,y,C),e===pt&&(Ke=pt=null,Pe=0),Kr=t,Nl=e,al=a,xu=o,bu=s,Jm=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,j0(Ft,function(){return mh(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null,s=Y.p,Y.p=2,m=rt,rt|=4;try{g0(e,t,a)}finally{rt=m,Y.p=s,E.T=n}}Vt=1,ch(),uh(),dh()}}function ch(){if(Vt===1){Vt=0;var e=Nl,t=Kr,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=E.T,E.T=null;var n=Y.p;Y.p=2;var s=rt;rt|=4;try{Im(t,e);var o=Du,m=Qd(e.containerInfo),y=o.focusedElem,C=o.selectionRange;if(m!==y&&y&&y.ownerDocument&&Yd(y.ownerDocument.documentElement,y)){if(C!==null&&lc(y)){var R=C.start,X=C.end;if(X===void 0&&(X=R),"selectionStart"in y)y.selectionStart=R,y.selectionEnd=Math.min(X,y.value.length);else{var Z=y.ownerDocument||document,$=Z&&Z.defaultView||window;if($.getSelection){var F=$.getSelection(),ke=y.textContent.length,Ue=Math.min(C.start,ke),ht=C.end===void 0?Ue:Math.min(C.end,ke);!F.extend&&Ue>ht&&(m=ht,ht=Ue,Ue=m);var M=Xd(y,Ue),T=Xd(y,ht);if(M&&T&&(F.rangeCount!==1||F.anchorNode!==M.node||F.anchorOffset!==M.offset||F.focusNode!==T.node||F.focusOffset!==T.offset)){var L=Z.createRange();L.setStart(M.node,M.offset),F.removeAllRanges(),Ue>ht?(F.addRange(L),F.extend(T.node,T.offset)):(L.setEnd(T.node,T.offset),F.addRange(L))}}}}for(Z=[],F=y;F=F.parentNode;)F.nodeType===1&&Z.push({element:F,left:F.scrollLeft,top:F.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<Z.length;y++){var Q=Z[y];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}po=!!zu,Du=zu=null}finally{rt=s,Y.p=n,E.T=a}}e.current=t,Vt=2}}function uh(){if(Vt===2){Vt=0;var e=Nl,t=Kr,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=E.T,E.T=null;var n=Y.p;Y.p=2;var s=rt;rt|=4;try{$m(e,t.alternate,t)}finally{rt=s,Y.p=n,E.T=a}}Vt=3}}function dh(){if(Vt===4||Vt===3){Vt=0,zt();var e=Nl,t=Kr,a=al,n=Jm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Vt=5:(Vt=0,Kr=Nl=null,fh(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(jl=null),qn(a),t=t.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(Lt,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=E.T,s=Y.p,Y.p=2,E.T=null;try{for(var o=e.onRecoverableError,m=0;m<n.length;m++){var y=n[m];o(y.value,{componentStack:y.stack})}}finally{E.T=t,Y.p=s}}(al&3)!==0&&ao(),Mn(e),s=e.pendingLanes,(a&261930)!==0&&(s&42)!==0?e===yu?Ys++:(Ys=0,yu=e):Ys=0,Qs(0)}}function fh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ns(t)))}function ao(){return ch(),uh(),dh(),mh()}function mh(){if(Vt!==5)return!1;var e=Nl,t=xu;xu=0;var a=qn(al),n=E.T,s=Y.p;try{Y.p=32>a?32:a,E.T=null,a=bu,bu=null;var o=Nl,m=al;if(Vt=0,Kr=Nl=null,al=0,(rt&6)!==0)throw Error(c(331));var y=rt;if(rt|=4,Qm(o.current),Vm(o,o.current,m,a),rt=y,Qs(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(Lt,o)}catch{}return!0}finally{Y.p=s,E.T=n,fh(e,t)}}function hh(e,t,a){t=Pa(a,t),t=Jc(e.stateNode,t,2),e=wl(e,t,2),e!==null&&(Ga(e,2),Mn(e))}function ut(e,t,a){if(e.tag===3)hh(e,e,a);else for(;t!==null;){if(t.tag===3){hh(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(jl===null||!jl.has(n))){e=Pa(a,e),a=pm(2),n=wl(t,a,2),n!==null&&(gm(a,n,t,e),Ga(n,2),Mn(n));break}}t=t.return}}function Su(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new y0;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(a)||(hu=!0,s.add(a),e=_0.bind(null,e,t,a),t.then(e,e))}function _0(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,pt===e&&(Pe&a)===a&&(Ct===4||Ct===3&&(Pe&62914560)===Pe&&300>we()-Ki?(rt&2)===0&&Jr(e,0):pu|=a,Zr===Pe&&(Zr=0)),Mn(e)}function ph(e,t){t===0&&(t=sl()),e=nr(e,t),e!==null&&(Ga(e,t),Mn(e))}function A0(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),ph(e,a)}function C0(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(a=s.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(c(314))}n!==null&&n.delete(t),ph(e,a)}function j0(e,t){return st(e,t)}var no=null,Wr=null,ku=!1,lo=!1,_u=!1,El=0;function Mn(e){e!==Wr&&e.next===null&&(Wr===null?no=Wr=e:Wr=Wr.next=e),lo=!0,ku||(ku=!0,T0())}function Qs(e,t){if(!_u&&lo){_u=!0;do for(var a=!1,n=no;n!==null;){if(e!==0){var s=n.pendingLanes;if(s===0)var o=0;else{var m=n.suspendedLanes,y=n.pingedLanes;o=(1<<31-Re(42|e)+1)-1,o&=s&~(m&~y),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(a=!0,yh(n,o))}else o=Pe,o=Rt(n,n===pt?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(o&3)===0||on(n,o)||(a=!0,yh(n,o));n=n.next}while(a);_u=!1}}function N0(){gh()}function gh(){lo=ku=!1;var e=0;El!==0&&q0()&&(e=El);for(var t=we(),a=null,n=no;n!==null;){var s=n.next,o=xh(n,t);o===0?(n.next=null,a===null?no=s:a.next=s,s===null&&(Wr=a)):(a=n,(e!==0||(o&3)!==0)&&(lo=!0)),n=s}Vt!==0&&Vt!==5||Qs(e),El!==0&&(El=0)}function xh(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var m=31-Re(o),y=1<<m,C=s[m];C===-1?((y&a)===0||(y&n)!==0)&&(s[m]=da(y,t)):C<=t&&(e.expiredLanes|=y),o&=~y}if(t=pt,a=Pe,a=Rt(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,a===0||e===t&&(ct===2||ct===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&se(n),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||on(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(n!==null&&se(n),qn(a)){case 2:case 8:a=Dt;break;case 32:a=Ft;break;case 268435456:a=ya;break;default:a=Ft}return n=bh.bind(null,e),a=st(a,n),e.callbackPriority=t,e.callbackNode=a,t}return n!==null&&n!==null&&se(n),e.callbackPriority=2,e.callbackNode=null,2}function bh(e,t){if(Vt!==0&&Vt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ao()&&e.callbackNode!==a)return null;var n=Pe;return n=Rt(e,e===pt?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(Wm(e,n,t),xh(e,we()),e.callbackNode!=null&&e.callbackNode===a?bh.bind(null,e):null)}function yh(e,t){if(ao())return null;Wm(e,t,!0)}function T0(){H0(function(){(rt&6)!==0?st(sn,N0):gh()})}function Au(){if(El===0){var e=$r;e===0&&(e=Qe,Qe<<=1,(Qe&261888)===0&&(Qe=256)),El=e}return El}function vh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:fl(""+e)}function wh(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function E0(e,t,a,n,s){if(t==="submit"&&a&&a.stateNode===s){var o=vh((s[Ut]||null).action),m=n.submitter;m&&(t=(t=m[Ut]||null)?vh(t.formAction):m.getAttribute("formAction"),t!==null&&(o=t,m=null));var y=new Pl("action","action",null,n,s);e.push({event:y,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(El!==0){var C=m?wh(s,m):new FormData(s);Vc(a,{pending:!0,data:C,method:s.method,action:o},null,C)}}else typeof o=="function"&&(y.preventDefault(),C=m?wh(s,m):new FormData(s),Vc(a,{pending:!0,data:C,method:s.method,action:o},o,C))},currentTarget:s}]})}}for(var Cu=0;Cu<oc.length;Cu++){var ju=oc[Cu],M0=ju.toLowerCase(),z0=ju[0].toUpperCase()+ju.slice(1);gn(M0,"on"+z0)}gn(Jd,"onAnimationEnd"),gn(Pd,"onAnimationIteration"),gn(Wd,"onAnimationStart"),gn("dblclick","onDoubleClick"),gn("focusin","onFocus"),gn("focusout","onBlur"),gn(Qg,"onTransitionRun"),gn(Zg,"onTransitionStart"),gn(Kg,"onTransitionCancel"),gn(ef,"onTransitionEnd"),Xa("onMouseEnter",["mouseout","mouseover"]),Xa("onMouseLeave",["mouseout","mouseover"]),Xa("onPointerEnter",["pointerout","pointerover"]),Xa("onPointerLeave",["pointerout","pointerover"]),Sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zs="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(" "),D0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zs));function Sh(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var n=e[a],s=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var m=n.length-1;0<=m;m--){var y=n[m],C=y.instance,R=y.currentTarget;if(y=y.listener,C!==o&&s.isPropagationStopped())break e;o=y,s.currentTarget=R;try{o(s)}catch(X){yi(X)}s.currentTarget=null,o=C}else for(m=0;m<n.length;m++){if(y=n[m],C=y.instance,R=y.currentTarget,y=y.listener,C!==o&&s.isPropagationStopped())break e;o=y,s.currentTarget=R;try{o(s)}catch(X){yi(X)}s.currentTarget=null,o=C}}}}function Je(e,t){var a=t[Gl];a===void 0&&(a=t[Gl]=new Set);var n=e+"__bubble";a.has(n)||(kh(t,e,2,!1),a.add(n))}function Nu(e,t,a){var n=0;t&&(n|=4),kh(a,e,n,t)}var ro="_reactListening"+Math.random().toString(36).slice(2);function Tu(e){if(!e[ro]){e[ro]=!0,Xl.forEach(function(a){a!=="selectionchange"&&(D0.has(a)||Nu(a,!1,e),Nu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ro]||(t[ro]=!0,Nu("selectionchange",!1,t))}}function kh(e,t,a,n){switch(Ph(t)){case 2:var s=ix;break;case 8:s=ox;break;default:s=Gu}a=s.bind(null,t,a,e),s=void 0,!Zl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,a,{capture:!0,passive:s}):e.addEventListener(t,a,!0):s!==void 0?e.addEventListener(t,a,{passive:s}):e.addEventListener(t,a,!1)}function Eu(e,t,a,n,s){var o=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var m=n.tag;if(m===3||m===4){var y=n.stateNode.containerInfo;if(y===s)break;if(m===4)for(m=n.return;m!==null;){var C=m.tag;if((C===3||C===4)&&m.stateNode.containerInfo===s)return;m=m.return}for(;y!==null;){if(m=Yt(y),m===null)return;if(C=m.tag,C===5||C===6||C===26||C===27){n=o=m;continue e}y=y.parentNode}}n=n.return}Sr(function(){var R=o,X=wr(a),Z=[];e:{var $=tf.get(e);if($!==void 0){var F=Pl,ke=e;switch(e){case"keypress":if(_r(a)===0)break e;case"keydown":case"keyup":F=jr;break;case"focusin":ke="focus",F=ws;break;case"focusout":ke="blur",F=ws;break;case"beforeblur":case"afterblur":F=ws;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":F=ys;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":F=vs;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":F=pa;break;case Jd:case Pd:case Wd:F=gi;break;case ef:F=pn;break;case"scroll":case"scrollend":F=gs;break;case"wheel":F=Wo;break;case"copy":case"cut":case"paste":F=le;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":F=hl;break;case"toggle":case"beforetoggle":F=tc}var Ue=(t&4)!==0,ht=!Ue&&(e==="scroll"||e==="scrollend"),M=Ue?$!==null?$+"Capture":null:$;Ue=[];for(var T=R,L;T!==null;){var Q=T;if(L=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||L===null||M===null||(Q=An(T,M),Q!=null&&Ue.push(Ks(T,Q,L))),ht)break;T=T.return}0<Ue.length&&($=new F($,ke,null,a,X),Z.push({event:$,listeners:Ue}))}}if((t&7)===0){e:{if($=e==="mouseover"||e==="pointerover",F=e==="mouseout"||e==="pointerout",$&&a!==wt&&(ke=a.relatedTarget||a.fromElement)&&(Yt(ke)||ke[va]))break e;if((F||$)&&($=X.window===X?X:($=X.ownerDocument)?$.defaultView||$.parentWindow:window,F?(ke=a.relatedTarget||a.toElement,F=R,ke=ke?Yt(ke):null,ke!==null&&(ht=f(ke),Ue=ke.tag,ke!==ht||Ue!==5&&Ue!==27&&Ue!==6)&&(ke=null)):(F=null,ke=R),F!==ke)){if(Ue=ys,Q="onMouseLeave",M="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(Ue=hl,Q="onPointerLeave",M="onPointerEnter",T="pointer"),ht=F==null?$:Bn(F),L=ke==null?$:Bn(ke),$=new Ue(Q,T+"leave",F,a,X),$.target=ht,$.relatedTarget=L,Q=null,Yt(X)===R&&(Ue=new Ue(M,T+"enter",ke,a,X),Ue.target=L,Ue.relatedTarget=ht,Q=Ue),ht=Q,F&&ke)t:{for(Ue=L0,M=F,T=ke,L=0,Q=M;Q;Q=Ue(Q))L++;Q=0;for(var je=T;je;je=Ue(je))Q++;for(;0<L-Q;)M=Ue(M),L--;for(;0<Q-L;)T=Ue(T),Q--;for(;L--;){if(M===T||T!==null&&M===T.alternate){Ue=M;break t}M=Ue(M),T=Ue(T)}Ue=null}else Ue=null;F!==null&&_h(Z,$,F,Ue,!1),ke!==null&&ht!==null&&_h(Z,ht,ke,Ue,!0)}}e:{if($=R?Bn(R):window,F=$.nodeName&&$.nodeName.toLowerCase(),F==="select"||F==="input"&&$.type==="file")var at=Bd;else if($d($))if(Hd)at=Vg;else{at=Ig;var Ae=Fg}else F=$.nodeName,!F||F.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?R&&Ql(R.elementType)&&(at=Bd):at=Gg;if(at&&(at=at(e,R))){qd(Z,at,a,X);break e}Ae&&Ae(e,$,R),e==="focusout"&&R&&$.type==="number"&&R.memoizedProps.value!=null&&dn($,"number",$.value)}switch(Ae=R?Bn(R):window,e){case"focusin":($d(Ae)||Ae.contentEditable==="true")&&(Er=Ae,rc=R,As=null);break;case"focusout":As=rc=Er=null;break;case"mousedown":sc=!0;break;case"contextmenu":case"mouseup":case"dragend":sc=!1,Zd(Z,a,X);break;case"selectionchange":if(Yg)break;case"keydown":case"keyup":Zd(Z,a,X)}var Xe;if(Ka)e:{switch(e){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else Tr?Ud(e,a)&&(We="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(We="onCompositionStart");We&&(Dd&&a.locale!=="ko"&&(Tr||We!=="onCompositionStart"?We==="onCompositionEnd"&&Tr&&(Xe=Jl()):(La=X,kr="value"in La?La.value:La.textContent,Tr=!0)),Ae=so(R,We),0<Ae.length&&(We=new Oe(We,e,null,a,X),Z.push({event:We,listeners:Ae}),Xe?We.data=Xe:(Xe=Od(a),Xe!==null&&(We.data=Xe)))),(Xe=er?$g(e,a):qg(e,a))&&(We=so(R,"onBeforeInput"),0<We.length&&(Ae=new Oe("onBeforeInput","beforeinput",null,a,X),Z.push({event:Ae,listeners:We}),Ae.data=Xe)),E0(Z,e,R,a,X)}Sh(Z,t)})}function Ks(e,t,a){return{instance:e,listener:t,currentTarget:a}}function so(e,t){for(var a=t+"Capture",n=[];e!==null;){var s=e,o=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||o===null||(s=An(e,a),s!=null&&n.unshift(Ks(e,s,o)),s=An(e,t),s!=null&&n.push(Ks(e,s,o))),e.tag===3)return n;e=e.return}return[]}function L0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function _h(e,t,a,n,s){for(var o=t._reactName,m=[];a!==null&&a!==n;){var y=a,C=y.alternate,R=y.stateNode;if(y=y.tag,C!==null&&C===n)break;y!==5&&y!==26&&y!==27||R===null||(C=R,s?(R=An(a,o),R!=null&&m.unshift(Ks(a,R,C))):s||(R=An(a,o),R!=null&&m.push(Ks(a,R,C)))),a=a.return}m.length!==0&&e.push({event:t,listeners:m})}var R0=/\r\n?/g,U0=/\u0000|\uFFFD/g;function Ah(e){return(typeof e=="string"?e:""+e).replace(R0,`
|
|
26
|
-
`).replace(U0,"")}function Ch(e,t){return t=Ah(t),Ah(e)===t}function mt(e,t,a,n,s,o){switch(a){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||ul(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&ul(e,""+n);break;case"className":Ot(e,"class",n);break;case"tabIndex":Ot(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Ot(e,a,n);break;case"style":dl(e,n,o);break;case"data":if(t!=="object"){Ot(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=fl(""+n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"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}else typeof o=="function"&&(a==="formAction"?(t!=="input"&&mt(e,t,"name",s.name,s,null),mt(e,t,"formEncType",s.formEncType,s,null),mt(e,t,"formMethod",s.formMethod,s,null),mt(e,t,"formTarget",s.formTarget,s,null)):(mt(e,t,"encType",s.encType,s,null),mt(e,t,"method",s.method,s,null),mt(e,t,"target",s.target,s,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=fl(""+n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=Ya);break;case"onScroll":n!=null&&Je("scroll",e);break;case"onScrollEnd":n!=null&&Je("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(c(61));if(a=n.__html,a!=null){if(s.children!=null)throw Error(c(60));e.innerHTML=a}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=fl(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""+n):e.removeAttribute(a);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":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":Je("beforetoggle",e),Je("toggle",e),Jt(e,"popover",n);break;case"xlinkActuate":Pt(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":Pt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":Pt(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":Pt(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":Pt(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":Pt(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":Pt(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":Pt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":Pt(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Jt(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=ha.get(a)||a,Jt(e,a,n))}}function Mu(e,t,a,n,s,o){switch(a){case"style":dl(e,n,o);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(c(61));if(a=n.__html,a!=null){if(s.children!=null)throw Error(c(60));e.innerHTML=a}}break;case"children":typeof n=="string"?ul(e,n):(typeof n=="number"||typeof n=="bigint")&&ul(e,""+n);break;case"onScroll":n!=null&&Je("scroll",e);break;case"onScrollEnd":n!=null&&Je("scrollend",e);break;case"onClick":n!=null&&(e.onclick=Ya);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ol.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(s=a.endsWith("Capture"),t=a.slice(2,s?a.length-7:void 0),o=e[Ut]||null,o=o!=null?o[a]:null,typeof o=="function"&&e.removeEventListener(t,o,s),typeof n=="function")){typeof o!="function"&&o!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,n,s);break e}a in e?e[a]=n:n===!0?e.setAttribute(a,""):Jt(e,a,n)}}}function la(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",e),Je("load",e);var n=!1,s=!1,o;for(o in a)if(a.hasOwnProperty(o)){var m=a[o];if(m!=null)switch(o){case"src":n=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:mt(e,t,o,m,a,null)}}s&&mt(e,t,"srcSet",a.srcSet,a,null),n&&mt(e,t,"src",a.src,a,null);return;case"input":Je("invalid",e);var y=o=m=s=null,C=null,R=null;for(n in a)if(a.hasOwnProperty(n)){var X=a[n];if(X!=null)switch(n){case"name":s=X;break;case"type":m=X;break;case"checked":C=X;break;case"defaultChecked":R=X;break;case"value":o=X;break;case"defaultValue":y=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(c(137,t));break;default:mt(e,t,n,X,a,null)}}fs(e,o,y,C,R,m,s,!1);return;case"select":Je("invalid",e),n=m=o=null;for(s in a)if(a.hasOwnProperty(s)&&(y=a[s],y!=null))switch(s){case"value":o=y;break;case"defaultValue":m=y;break;case"multiple":n=y;default:mt(e,t,s,y,a,null)}t=o,a=m,e.multiple=!!n,t!=null?cl(e,!!n,t,!1):a!=null&&cl(e,!!n,a,!0);return;case"textarea":Je("invalid",e),o=s=n=null;for(m in a)if(a.hasOwnProperty(m)&&(y=a[m],y!=null))switch(m){case"value":n=y;break;case"defaultValue":s=y;break;case"children":o=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(c(91));break;default:mt(e,t,m,y,a,null)}fn(e,n,s,o);return;case"option":for(C in a)if(a.hasOwnProperty(C)&&(n=a[C],n!=null))switch(C){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:mt(e,t,C,n,a,null)}return;case"dialog":Je("beforetoggle",e),Je("toggle",e),Je("cancel",e),Je("close",e);break;case"iframe":case"object":Je("load",e);break;case"video":case"audio":for(n=0;n<Zs.length;n++)Je(Zs[n],e);break;case"image":Je("error",e),Je("load",e);break;case"details":Je("toggle",e);break;case"embed":case"source":case"link":Je("error",e),Je("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(R in a)if(a.hasOwnProperty(R)&&(n=a[R],n!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:mt(e,t,R,n,a,null)}return;default:if(Ql(t)){for(X in a)a.hasOwnProperty(X)&&(n=a[X],n!==void 0&&Mu(e,t,X,n,a,void 0));return}}for(y in a)a.hasOwnProperty(y)&&(n=a[y],n!=null&&mt(e,t,y,n,a,null))}function O0(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,o=null,m=null,y=null,C=null,R=null,X=null;for(F in a){var Z=a[F];if(a.hasOwnProperty(F)&&Z!=null)switch(F){case"checked":break;case"value":break;case"defaultValue":C=Z;default:n.hasOwnProperty(F)||mt(e,t,F,null,n,Z)}}for(var $ in n){var F=n[$];if(Z=a[$],n.hasOwnProperty($)&&(F!=null||Z!=null))switch($){case"type":o=F;break;case"name":s=F;break;case"checked":R=F;break;case"defaultChecked":X=F;break;case"value":m=F;break;case"defaultValue":y=F;break;case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(c(137,t));break;default:F!==Z&&mt(e,t,$,F,n,Z)}}ds(e,m,y,C,R,X,o,s);return;case"select":F=m=y=$=null;for(o in a)if(C=a[o],a.hasOwnProperty(o)&&C!=null)switch(o){case"value":break;case"multiple":F=C;default:n.hasOwnProperty(o)||mt(e,t,o,null,n,C)}for(s in n)if(o=n[s],C=a[s],n.hasOwnProperty(s)&&(o!=null||C!=null))switch(s){case"value":$=o;break;case"defaultValue":y=o;break;case"multiple":m=o;default:o!==C&&mt(e,t,s,o,n,C)}t=y,a=m,n=F,$!=null?cl(e,!!a,$,!1):!!n!=!!a&&(t!=null?cl(e,!!a,t,!0):cl(e,!!a,a?[]:"",!1));return;case"textarea":F=$=null;for(y in a)if(s=a[y],a.hasOwnProperty(y)&&s!=null&&!n.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:mt(e,t,y,null,n,s)}for(m in n)if(s=n[m],o=a[m],n.hasOwnProperty(m)&&(s!=null||o!=null))switch(m){case"value":$=s;break;case"defaultValue":F=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(c(91));break;default:s!==o&&mt(e,t,m,s,n,o)}ms(e,$,F);return;case"option":for(var ke in a)if($=a[ke],a.hasOwnProperty(ke)&&$!=null&&!n.hasOwnProperty(ke))switch(ke){case"selected":e.selected=!1;break;default:mt(e,t,ke,null,n,$)}for(C in n)if($=n[C],F=a[C],n.hasOwnProperty(C)&&$!==F&&($!=null||F!=null))switch(C){case"selected":e.selected=$&&typeof $!="function"&&typeof $!="symbol";break;default:mt(e,t,C,$,n,F)}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 Ue in a)$=a[Ue],a.hasOwnProperty(Ue)&&$!=null&&!n.hasOwnProperty(Ue)&&mt(e,t,Ue,null,n,$);for(R in n)if($=n[R],F=a[R],n.hasOwnProperty(R)&&$!==F&&($!=null||F!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(c(137,t));break;default:mt(e,t,R,$,n,F)}return;default:if(Ql(t)){for(var ht in a)$=a[ht],a.hasOwnProperty(ht)&&$!==void 0&&!n.hasOwnProperty(ht)&&Mu(e,t,ht,void 0,n,$);for(X in n)$=n[X],F=a[X],!n.hasOwnProperty(X)||$===F||$===void 0&&F===void 0||Mu(e,t,X,$,n,F);return}}for(var M in a)$=a[M],a.hasOwnProperty(M)&&$!=null&&!n.hasOwnProperty(M)&&mt(e,t,M,null,n,$);for(Z in n)$=n[Z],F=a[Z],!n.hasOwnProperty(Z)||$===F||$==null&&F==null||mt(e,t,Z,$,n,F)}function jh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function $0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var s=a[n],o=s.transferSize,m=s.initiatorType,y=s.duration;if(o&&y&&jh(m)){for(m=0,y=s.responseEnd,n+=1;n<a.length;n++){var C=a[n],R=C.startTime;if(R>y)break;var X=C.transferSize,Z=C.initiatorType;X&&jh(Z)&&(C=C.responseEnd,m+=X*(C<y?1:(y-R)/(C-R)))}if(--n,t+=8*(o+m)/(s.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 zu=null,Du=null;function io(e){return e.nodeType===9?e:e.ownerDocument}function Nh(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 Th(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 Lu(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 Ru=null;function q0(){var e=window.event;return e&&e.type==="popstate"?e===Ru?!1:(Ru=e,!0):(Ru=null,!1)}var Eh=typeof setTimeout=="function"?setTimeout:void 0,B0=typeof clearTimeout=="function"?clearTimeout:void 0,Mh=typeof Promise=="function"?Promise:void 0,H0=typeof queueMicrotask=="function"?queueMicrotask:typeof Mh<"u"?function(e){return Mh.resolve(null).then(e).catch(F0)}:Eh;function F0(e){setTimeout(function(){throw e})}function Ml(e){return e==="head"}function zh(e,t){var a=t,n=0;do{var s=a.nextSibling;if(e.removeChild(a),s&&s.nodeType===8)if(a=s.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(s),ns(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")Js(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Js(a);for(var o=a.firstChild;o;){var m=o.nextSibling,y=o.nodeName;o[kn]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&o.rel.toLowerCase()==="stylesheet"||a.removeChild(o),o=m}}else a==="body"&&Js(e.ownerDocument.body);a=s}while(a);ns(t)}function Dh(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function Uu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Uu(a),Va(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function I0(e,t,a,n){for(;e.nodeType===1;){var s=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[kn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=nn(e.nextSibling),e===null)break}return null}function G0(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=nn(e.nextSibling),e===null))return null;return e}function Lh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=nn(e.nextSibling),e===null))return null;return e}function Ou(e){return e.data==="$?"||e.data==="$~"}function $u(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function V0(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function nn(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 qu=null;function Rh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return nn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Uh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Oh(e,t,a){switch(t=io(a),e){case"html":if(e=t.documentElement,!e)throw Error(c(452));return e;case"head":if(e=t.head,!e)throw Error(c(453));return e;case"body":if(e=t.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function Js(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Va(e)}var ln=new Map,$h=new Set;function oo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var nl=Y.d;Y.d={f:X0,r:Y0,D:Q0,C:Z0,L:K0,m:J0,X:W0,S:P0,M:ex};function X0(){var e=nl.f(),t=Wi();return e||t}function Y0(e){var t=wa(e);t!==null&&t.tag===5&&t.type==="form"?tm(t):nl.r(e)}var es=typeof document>"u"?null:document;function qh(e,t,a){var n=es;if(n&&typeof t=="string"&&t){var s=ma(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof a=="string"&&(s+='[crossorigin="'+a+'"]'),$h.has(s)||($h.add(s),e={rel:e,crossOrigin:a,href:t},n.querySelector(s)===null&&(t=n.createElement("link"),la(t,"link",e),ot(t),n.head.appendChild(t)))}}function Q0(e){nl.D(e),qh("dns-prefetch",e,null)}function Z0(e,t){nl.C(e,t),qh("preconnect",e,t)}function K0(e,t,a){nl.L(e,t,a);var n=es;if(n&&e&&t){var s='link[rel="preload"][as="'+ma(t)+'"]';t==="image"&&a&&a.imageSrcSet?(s+='[imagesrcset="'+ma(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(s+='[imagesizes="'+ma(a.imageSizes)+'"]')):s+='[href="'+ma(e)+'"]';var o=s;switch(t){case"style":o=ts(e);break;case"script":o=as(e)}ln.has(o)||(e=w({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ln.set(o,e),n.querySelector(s)!==null||t==="style"&&n.querySelector(Ps(o))||t==="script"&&n.querySelector(Ws(o))||(t=n.createElement("link"),la(t,"link",e),ot(t),n.head.appendChild(t)))}}function J0(e,t){nl.m(e,t);var a=es;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+ma(n)+'"][href="'+ma(e)+'"]',o=s;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=as(e)}if(!ln.has(o)&&(e=w({rel:"modulepreload",href:e},t),ln.set(o,e),a.querySelector(s)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ws(o)))return}n=a.createElement("link"),la(n,"link",e),ot(n),a.head.appendChild(n)}}}function P0(e,t,a){nl.S(e,t,a);var n=es;if(n&&e){var s=_n(n).hoistableStyles,o=ts(e);t=t||"default";var m=s.get(o);if(!m){var y={loading:0,preload:null};if(m=n.querySelector(Ps(o)))y.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ln.get(o))&&Bu(e,a);var C=m=n.createElement("link");ot(C),la(C,"link",e),C._p=new Promise(function(R,X){C.onload=R,C.onerror=X}),C.addEventListener("load",function(){y.loading|=1}),C.addEventListener("error",function(){y.loading|=2}),y.loading|=4,co(m,t,n)}m={type:"stylesheet",instance:m,count:1,state:y},s.set(o,m)}}}function W0(e,t){nl.X(e,t);var a=es;if(a&&e){var n=_n(a).hoistableScripts,s=as(e),o=n.get(s);o||(o=a.querySelector(Ws(s)),o||(e=w({src:e,async:!0},t),(t=ln.get(s))&&Hu(e,t),o=a.createElement("script"),ot(o),la(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(s,o))}}function ex(e,t){nl.M(e,t);var a=es;if(a&&e){var n=_n(a).hoistableScripts,s=as(e),o=n.get(s);o||(o=a.querySelector(Ws(s)),o||(e=w({src:e,async:!0,type:"module"},t),(t=ln.get(s))&&Hu(e,t),o=a.createElement("script"),ot(o),la(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(s,o))}}function Bh(e,t,a,n){var s=(s=fe.current)?oo(s):null;if(!s)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=ts(a.href),a=_n(s).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ts(a.href);var o=_n(s).hoistableStyles,m=o.get(e);if(m||(s=s.ownerDocument||s,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,m),(o=s.querySelector(Ps(e)))&&!o._p&&(m.instance=o,m.state.loading=5),ln.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ln.set(e,a),o||tx(s,e,a,m.state))),t&&n===null)throw Error(c(528,""));return m}if(t&&n!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=as(a),a=_n(s).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function ts(e){return'href="'+ma(e)+'"'}function Ps(e){return'link[rel="stylesheet"]['+e+"]"}function Hh(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function tx(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),la(t,"link",a),ot(t),e.head.appendChild(t))}function as(e){return'[src="'+ma(e)+'"]'}function Ws(e){return"script[async]"+e}function Fh(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+ma(a.href)+'"]');if(n)return t.instance=n,ot(n),n;var s=w({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ot(n),la(n,"style",s),co(n,a.precedence,e),t.instance=n;case"stylesheet":s=ts(a.href);var o=e.querySelector(Ps(s));if(o)return t.state.loading|=4,t.instance=o,ot(o),o;n=Hh(a),(s=ln.get(s))&&Bu(n,s),o=(e.ownerDocument||e).createElement("link"),ot(o);var m=o;return m._p=new Promise(function(y,C){m.onload=y,m.onerror=C}),la(o,"link",n),t.state.loading|=4,co(o,a.precedence,e),t.instance=o;case"script":return o=as(a.src),(s=e.querySelector(Ws(o)))?(t.instance=s,ot(s),s):(n=a,(s=ln.get(o))&&(n=w({},a),Hu(n,s)),e=e.ownerDocument||e,s=e.createElement("script"),ot(s),la(s,"link",n),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,co(n,a.precedence,e));return t.instance}function co(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=n.length?n[n.length-1]:null,o=s,m=0;m<n.length;m++){var y=n[m];if(y.dataset.precedence===t)o=y;else if(o!==s)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Bu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Hu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var uo=null;function Ih(e,t,a){if(uo===null){var n=new Map,s=uo=new Map;s.set(a,n)}else s=uo,n=s.get(a),n||(n=new Map,s.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),s=0;s<a.length;s++){var o=a[s];if(!(o[kn]||o[jt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var m=o.getAttribute(t)||"";m=e+m;var y=n.get(m);y?y.push(o):n.set(m,[o])}}return n}function Gh(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function ax(e,t,a){if(a===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 Vh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function nx(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var s=ts(n.href),o=t.querySelector(Ps(s));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=o,ot(o);return}o=t.ownerDocument||t,n=Hh(n),(s=ln.get(s))&&Bu(n,s),o=o.createElement("link"),ot(o);var m=o;m._p=new Promise(function(y,C){m.onload=y,m.onerror=C}),la(o,"link",n),a.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=fo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Fu=0;function lx(e,t){return e.stylesheets&&e.count===0&&ho(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&ho(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&Fu===0&&(Fu=62500*$0());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ho(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>Fu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(s)}}:null}function fo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ho(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var mo=null;function ho(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,mo=new Map,t.forEach(rx,e),mo=null,fo.call(e))}function rx(e,t){if(!(t.state.loading&4)){var a=mo.get(e);if(a)var n=a.get(null);else{a=new Map,mo.set(e,a);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<s.length;o++){var m=s[o];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(a.set(m.dataset.precedence,m),n=m)}n&&a.set(null,n)}s=t.instance,m=s.getAttribute("data-precedence"),o=a.get(m)||n,o===n&&a.set(null,s),a.set(m,s),this.count++,n=fo.bind(this),s.addEventListener("load",n),s.addEventListener("error",n),o?o.parentNode.insertBefore(s,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var ei={$$typeof:U,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function sx(e,t,a,n,s,o,m,y,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=il(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=il(0),this.hiddenUpdates=il(null),this.identifierPrefix=n,this.onUncaughtError=s,this.onCaughtError=o,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function Xh(e,t,a,n,s,o,m,y,C,R,X,Z){return e=new sx(e,t,a,m,C,R,X,Z,y),t=1,o===!0&&(t|=24),o=$a(3,null,null,t),e.current=o,o.stateNode=e,t=wc(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:n,isDehydrated:a,cache:t},Ac(o),e}function Yh(e){return e?(e=Dr,e):Dr}function Qh(e,t,a,n,s,o){s=Yh(s),n.context===null?n.context=s:n.pendingContext=s,n=vl(t),n.payload={element:a},o=o===void 0?null:o,o!==null&&(n.callback=o),a=wl(e,n,t),a!==null&&(Na(a,e,t),zs(a,e,t))}function Zh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Iu(e,t){Zh(e,t),(e=e.alternate)&&Zh(e,t)}function Kh(e){if(e.tag===13||e.tag===31){var t=nr(e,67108864);t!==null&&Na(t,e,67108864),Iu(e,67108864)}}function Jh(e){if(e.tag===13||e.tag===31){var t=Ia();t=cn(t);var a=nr(e,t);a!==null&&Na(a,e,t),Iu(e,t)}}var po=!0;function ix(e,t,a,n){var s=E.T;E.T=null;var o=Y.p;try{Y.p=2,Gu(e,t,a,n)}finally{Y.p=o,E.T=s}}function ox(e,t,a,n){var s=E.T;E.T=null;var o=Y.p;try{Y.p=8,Gu(e,t,a,n)}finally{Y.p=o,E.T=s}}function Gu(e,t,a,n){if(po){var s=Vu(n);if(s===null)Eu(e,t,n,go,a),Wh(e,n);else if(ux(s,e,t,a,n))n.stopPropagation();else if(Wh(e,n),t&4&&-1<cx.indexOf(e)){for(;s!==null;){var o=wa(s);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var m=It(o.pendingLanes);if(m!==0){var y=o;for(y.pendingLanes|=2,y.entangledLanes|=2;m;){var C=1<<31-Re(m);y.entanglements[1]|=C,m&=~C}Mn(o),(rt&6)===0&&(Ji=we()+500,Qs(0))}}break;case 31:case 13:y=nr(o,2),y!==null&&Na(y,o,2),Wi(),Iu(o,2)}if(o=Vu(n),o===null&&Eu(e,t,n,go,a),o===s)break;s=o}s!==null&&n.stopPropagation()}else Eu(e,t,n,null,a)}}function Vu(e){return e=wr(e),Xu(e)}var go=null;function Xu(e){if(go=null,e=Yt(e),e!==null){var t=f(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===31){if(e=p(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return go=e,null}function Ph(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(Xt()){case sn:return 2;case Dt:return 8;case Ft:case Hl:return 32;case ya:return 268435456;default:return 32}default:return 32}}var Yu=!1,zl=null,Dl=null,Ll=null,ti=new Map,ai=new Map,Rl=[],cx="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 Wh(e,t){switch(e){case"focusin":case"focusout":zl=null;break;case"dragenter":case"dragleave":Dl=null;break;case"mouseover":case"mouseout":Ll=null;break;case"pointerover":case"pointerout":ti.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ai.delete(t.pointerId)}}function ni(e,t,a,n,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:o,targetContainers:[s]},t!==null&&(t=wa(t),t!==null&&Kh(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function ux(e,t,a,n,s){switch(t){case"focusin":return zl=ni(zl,e,t,a,n,s),!0;case"dragenter":return Dl=ni(Dl,e,t,a,n,s),!0;case"mouseover":return Ll=ni(Ll,e,t,a,n,s),!0;case"pointerover":var o=s.pointerId;return ti.set(o,ni(ti.get(o)||null,e,t,a,n,s)),!0;case"gotpointercapture":return o=s.pointerId,ai.set(o,ni(ai.get(o)||null,e,t,a,n,s)),!0}return!1}function ep(e){var t=Yt(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,fa(e.priority,function(){Jh(a)});return}}else if(t===31){if(t=p(a),t!==null){e.blockedOn=t,fa(e.priority,function(){Jh(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function xo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Vu(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);wt=n,a.target.dispatchEvent(n),wt=null}else return t=wa(a),t!==null&&Kh(t),e.blockedOn=a,!1;t.shift()}return!0}function tp(e,t,a){xo(e)&&a.delete(t)}function dx(){Yu=!1,zl!==null&&xo(zl)&&(zl=null),Dl!==null&&xo(Dl)&&(Dl=null),Ll!==null&&xo(Ll)&&(Ll=null),ti.forEach(tp),ai.forEach(tp)}function bo(e,t){e.blockedOn===t&&(e.blockedOn=null,Yu||(Yu=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,dx)))}var yo=null;function ap(e){yo!==e&&(yo=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){yo===e&&(yo=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],s=e[t+2];if(typeof n!="function"){if(Xu(n||a)===null)continue;break}var o=wa(a);o!==null&&(e.splice(t,3),t-=3,Vc(o,{pending:!0,data:s,method:a.method,action:n},n,s))}}))}function ns(e){function t(C){return bo(C,e)}zl!==null&&bo(zl,e),Dl!==null&&bo(Dl,e),Ll!==null&&bo(Ll,e),ti.forEach(t),ai.forEach(t);for(var a=0;a<Rl.length;a++){var n=Rl[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Rl.length&&(a=Rl[0],a.blockedOn===null);)ep(a),a.blockedOn===null&&Rl.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var s=a[n],o=a[n+1],m=s[Ut]||null;if(typeof o=="function")m||ap(a);else if(m){var y=null;if(o&&o.hasAttribute("formAction")){if(s=o,m=o[Ut]||null)y=m.formAction;else if(Xu(s)!==null)continue}else y=m.action;typeof y=="function"?a[n+1]=y:(a.splice(n,3),n-=3),ap(a)}}}function np(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(m){return s=m})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Qu(e){this._internalRoot=e}vo.prototype.render=Qu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var a=t.current,n=Ia();Qh(a,n,e,t,null,null)},vo.prototype.unmount=Qu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qh(e.current,2,null,e,null,null),Wi(),t[va]=null}};function vo(e){this._internalRoot=e}vo.prototype.unstable_scheduleHydration=function(e){if(e){var t=un();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Rl.length&&t!==0&&t<Rl[a].priority;a++);Rl.splice(a,0,e),a===0&&ep(e)}};var lp=l.version;if(lp!=="19.2.7")throw Error(c(527,lp,"19.2.7"));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=v(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var fx={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wo.isDisabled&&wo.supportsFiber)try{Lt=wo.inject(fx),_t=wo}catch{}}return li.createRoot=function(e,t){if(!d(e))throw Error(c(299));var a=!1,n="",s=dm,o=fm,m=mm;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=Xh(e,1,!1,null,null,a,n,null,s,o,m,np),e[va]=t.current,Tu(e),new Qu(t)},li.hydrateRoot=function(e,t,a){if(!d(e))throw Error(c(299));var n=!1,s="",o=dm,m=fm,y=mm,C=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(s=a.identifierPrefix),a.onUncaughtError!==void 0&&(o=a.onUncaughtError),a.onCaughtError!==void 0&&(m=a.onCaughtError),a.onRecoverableError!==void 0&&(y=a.onRecoverableError),a.formState!==void 0&&(C=a.formState)),t=Xh(e,1,!0,t,a??null,n,s,C,o,m,y,np),t.context=Yh(null),a=t.current,n=Ia(),n=cn(n),s=vl(n),s.callback=null,wl(a,s,n),a=n,t.current.lanes=a,Ga(t,a),Mn(t),e[va]=t.current,Tu(e),new vo(t)},li.version="19.2.7",li}var cp;function Nx(){if(cp)return Zu.exports;cp=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(l){console.error(l)}}return r(),Zu.exports=jx(),Zu.exports}var Tx=Nx();const Wp=g.createContext(void 0);function up({children:r}){const[l,i]=g.useState(()=>{const h=localStorage.getItem("chat-theme");if(h){const p=JSON.parse(h);return{mode:p.mode||"dark",highContrast:!!p.highContrast}}return{mode:"dark",highContrast:!1}}),[c,d]=g.useState(!1);g.useEffect(()=>{const h=()=>{let p=!1;l.mode==="dark"?p=!0:l.mode==="light"?p=!1:p=window.matchMedia("(prefers-color-scheme: dark)").matches,d(p);const x=document.documentElement;p?x.classList.add("dark"):x.classList.remove("dark"),l.highContrast?x.classList.add("high-contrast"):x.classList.remove("high-contrast"),x.classList.remove("text-sm","text-lg"),x.classList.add("text-base")};if(h(),l.mode==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>{h()};return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),g.useEffect(()=>{localStorage.setItem("chat-theme",JSON.stringify(l))},[l]);const f=h=>{i(p=>({...p,...h}))};return u.jsx(Wp.Provider,{value:{theme:l,updateTheme:f,isDark:c},children:r})}function cs(){const r=g.useContext(Wp);if(!r)throw new Error("useTheme must be used within ThemeProvider");return r}const eg=g.createContext(void 0),Pu={voiceEnabled:!1,soundEnabled:!1,autoSend:!1};function Ex({children:r}){const[l,i]=g.useState(()=>{const d=localStorage.getItem("chat-settings");if(d)try{const f=JSON.parse(d);return{...Pu,...f,voiceEnabled:!1}}catch{return Pu}return Pu});g.useEffect(()=>{localStorage.setItem("chat-settings",JSON.stringify(l))},[l]);const c=d=>{i(f=>({...f,...d}))};return u.jsx(eg.Provider,{value:{settings:l,updateSettings:c},children:r})}function Vo(){const r=g.useContext(eg);if(!r)throw new Error("useSettings must be used within SettingsProvider");return r}/**
|
|
27
|
-
* @license lucide-react v0.469.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Mx=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tg=(...r)=>r.filter((l,i,c)=>!!l&&l.trim()!==""&&c.indexOf(l)===i).join(" ").trim();/**
|
|
32
|
-
* @license lucide-react v0.469.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/var zx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
37
|
-
* @license lucide-react v0.469.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const Dx=g.forwardRef(({color:r="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:d="",children:f,iconNode:h,...p},x)=>g.createElement("svg",{ref:x,...zx,width:l,height:l,stroke:r,strokeWidth:c?Number(i)*24/Number(l):i,className:tg("lucide",d),...p},[...h.map(([v,b])=>g.createElement(v,b)),...Array.isArray(f)?f:[f]]));/**
|
|
42
|
-
* @license lucide-react v0.469.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const De=(r,l)=>{const i=g.forwardRef(({className:c,...d},f)=>g.createElement(Dx,{ref:f,iconNode:l,className:tg(`lucide-${Mx(r)}`,c),...d}));return i.displayName=`${r}`,i};/**
|
|
47
|
-
* @license lucide-react v0.469.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const sd=De("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
52
|
-
* @license lucide-react v0.469.0 - ISC
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the ISC license.
|
|
55
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const Uo=De("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
57
|
-
* @license lucide-react v0.469.0 - ISC
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the ISC license.
|
|
60
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const fi=De("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
62
|
-
* @license lucide-react v0.469.0 - ISC
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the ISC license.
|
|
65
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const dp=De("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
67
|
-
* @license lucide-react v0.469.0 - ISC
|
|
68
|
-
*
|
|
69
|
-
* This source code is licensed under the ISC license.
|
|
70
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const Oo=De("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
72
|
-
* @license lucide-react v0.469.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const Do=De("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
77
|
-
* @license lucide-react v0.469.0 - ISC
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the ISC license.
|
|
80
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const Lx=De("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
82
|
-
* @license lucide-react v0.469.0 - ISC
|
|
83
|
-
*
|
|
84
|
-
* This source code is licensed under the ISC license.
|
|
85
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const fp=De("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
87
|
-
* @license lucide-react v0.469.0 - ISC
|
|
88
|
-
*
|
|
89
|
-
* This source code is licensed under the ISC license.
|
|
90
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const Rx=De("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
92
|
-
* @license lucide-react v0.469.0 - ISC
|
|
93
|
-
*
|
|
94
|
-
* This source code is licensed under the ISC license.
|
|
95
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const bd=De("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
97
|
-
* @license lucide-react v0.469.0 - ISC
|
|
98
|
-
*
|
|
99
|
-
* This source code is licensed under the ISC license.
|
|
100
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const Ux=De("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
102
|
-
* @license lucide-react v0.469.0 - ISC
|
|
103
|
-
*
|
|
104
|
-
* This source code is licensed under the ISC license.
|
|
105
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const Ox=De("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
|
|
107
|
-
* @license lucide-react v0.469.0 - ISC
|
|
108
|
-
*
|
|
109
|
-
* This source code is licensed under the ISC license.
|
|
110
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const $x=De("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
|
|
112
|
-
* @license lucide-react v0.469.0 - ISC
|
|
113
|
-
*
|
|
114
|
-
* This source code is licensed under the ISC license.
|
|
115
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const qx=De("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
117
|
-
* @license lucide-react v0.469.0 - ISC
|
|
118
|
-
*
|
|
119
|
-
* This source code is licensed under the ISC license.
|
|
120
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const Bx=De("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
122
|
-
* @license lucide-react v0.469.0 - ISC
|
|
123
|
-
*
|
|
124
|
-
* This source code is licensed under the ISC license.
|
|
125
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const Hx=De("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
127
|
-
* @license lucide-react v0.469.0 - ISC
|
|
128
|
-
*
|
|
129
|
-
* This source code is licensed under the ISC license.
|
|
130
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const Lo=De("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
132
|
-
* @license lucide-react v0.469.0 - ISC
|
|
133
|
-
*
|
|
134
|
-
* This source code is licensed under the ISC license.
|
|
135
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const ag=De("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
|
|
137
|
-
* @license lucide-react v0.469.0 - ISC
|
|
138
|
-
*
|
|
139
|
-
* This source code is licensed under the ISC license.
|
|
140
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
-
*/const Fx=De("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
142
|
-
* @license lucide-react v0.469.0 - ISC
|
|
143
|
-
*
|
|
144
|
-
* This source code is licensed under the ISC license.
|
|
145
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/const Ix=De("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
147
|
-
* @license lucide-react v0.469.0 - ISC
|
|
148
|
-
*
|
|
149
|
-
* This source code is licensed under the ISC license.
|
|
150
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const Gx=De("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
152
|
-
* @license lucide-react v0.469.0 - ISC
|
|
153
|
-
*
|
|
154
|
-
* This source code is licensed under the ISC license.
|
|
155
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
-
*/const mp=De("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
157
|
-
* @license lucide-react v0.469.0 - ISC
|
|
158
|
-
*
|
|
159
|
-
* This source code is licensed under the ISC license.
|
|
160
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/const Vx=De("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
162
|
-
* @license lucide-react v0.469.0 - ISC
|
|
163
|
-
*
|
|
164
|
-
* This source code is licensed under the ISC license.
|
|
165
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
-
*/const Xx=De("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
167
|
-
* @license lucide-react v0.469.0 - ISC
|
|
168
|
-
*
|
|
169
|
-
* This source code is licensed under the ISC license.
|
|
170
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
-
*/const Yx=De("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
172
|
-
* @license lucide-react v0.469.0 - ISC
|
|
173
|
-
*
|
|
174
|
-
* This source code is licensed under the ISC license.
|
|
175
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
-
*/const Qx=De("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
177
|
-
* @license lucide-react v0.469.0 - ISC
|
|
178
|
-
*
|
|
179
|
-
* This source code is licensed under the ISC license.
|
|
180
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
-
*/const Zx=De("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
|
|
182
|
-
* @license lucide-react v0.469.0 - ISC
|
|
183
|
-
*
|
|
184
|
-
* This source code is licensed under the ISC license.
|
|
185
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const Kx=De("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
|
|
187
|
-
* @license lucide-react v0.469.0 - ISC
|
|
188
|
-
*
|
|
189
|
-
* This source code is licensed under the ISC license.
|
|
190
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
-
*/const Jx=De("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
|
|
192
|
-
* @license lucide-react v0.469.0 - ISC
|
|
193
|
-
*
|
|
194
|
-
* This source code is licensed under the ISC license.
|
|
195
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
-
*/const Px=De("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
197
|
-
* @license lucide-react v0.469.0 - ISC
|
|
198
|
-
*
|
|
199
|
-
* This source code is licensed under the ISC license.
|
|
200
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
-
*/const Wx=De("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
|
|
202
|
-
* @license lucide-react v0.469.0 - ISC
|
|
203
|
-
*
|
|
204
|
-
* This source code is licensed under the ISC license.
|
|
205
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
-
*/const ng=De("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
|
|
207
|
-
* @license lucide-react v0.469.0 - ISC
|
|
208
|
-
*
|
|
209
|
-
* This source code is licensed under the ISC license.
|
|
210
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
-
*/const eb=De("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
212
|
-
* @license lucide-react v0.469.0 - ISC
|
|
213
|
-
*
|
|
214
|
-
* This source code is licensed under the ISC license.
|
|
215
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
-
*/const tb=De("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
217
|
-
* @license lucide-react v0.469.0 - ISC
|
|
218
|
-
*
|
|
219
|
-
* This source code is licensed under the ISC license.
|
|
220
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
-
*/const ab=De("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/**
|
|
222
|
-
* @license lucide-react v0.469.0 - ISC
|
|
223
|
-
*
|
|
224
|
-
* This source code is licensed under the ISC license.
|
|
225
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
-
*/const nb=De("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
227
|
-
* @license lucide-react v0.469.0 - ISC
|
|
228
|
-
*
|
|
229
|
-
* This source code is licensed under the ISC license.
|
|
230
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
-
*/const lb=De("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
232
|
-
* @license lucide-react v0.469.0 - ISC
|
|
233
|
-
*
|
|
234
|
-
* This source code is licensed under the ISC license.
|
|
235
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
-
*/const yd=De("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
237
|
-
* @license lucide-react v0.469.0 - ISC
|
|
238
|
-
*
|
|
239
|
-
* This source code is licensed under the ISC license.
|
|
240
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
-
*/const hp=De("Settings",[["path",{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",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
242
|
-
* @license lucide-react v0.469.0 - ISC
|
|
243
|
-
*
|
|
244
|
-
* This source code is licensed under the ISC license.
|
|
245
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
-
*/const vd=De("Sparkles",[["path",{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",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
247
|
-
* @license lucide-react v0.469.0 - ISC
|
|
248
|
-
*
|
|
249
|
-
* This source code is licensed under the ISC license.
|
|
250
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
-
*/const rb=De("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
252
|
-
* @license lucide-react v0.469.0 - ISC
|
|
253
|
-
*
|
|
254
|
-
* This source code is licensed under the ISC license.
|
|
255
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
-
*/const sb=De("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
257
|
-
* @license lucide-react v0.469.0 - ISC
|
|
258
|
-
*
|
|
259
|
-
* This source code is licensed under the ISC license.
|
|
260
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
-
*/const lg=De("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
|
|
262
|
-
* @license lucide-react v0.469.0 - ISC
|
|
263
|
-
*
|
|
264
|
-
* This source code is licensed under the ISC license.
|
|
265
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
-
*/const rg=De("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
|
|
267
|
-
* @license lucide-react v0.469.0 - ISC
|
|
268
|
-
*
|
|
269
|
-
* This source code is licensed under the ISC license.
|
|
270
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
-
*/const sg=De("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
272
|
-
* @license lucide-react v0.469.0 - ISC
|
|
273
|
-
*
|
|
274
|
-
* This source code is licensed under the ISC license.
|
|
275
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
-
*/const ib=De("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
|
|
277
|
-
* @license lucide-react v0.469.0 - ISC
|
|
278
|
-
*
|
|
279
|
-
* This source code is licensed under the ISC license.
|
|
280
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
-
*/const wd=De("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
282
|
-
* @license lucide-react v0.469.0 - ISC
|
|
283
|
-
*
|
|
284
|
-
* This source code is licensed under the ISC license.
|
|
285
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
-
*/const ob=De("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
287
|
-
* @license lucide-react v0.469.0 - ISC
|
|
288
|
-
*
|
|
289
|
-
* This source code is licensed under the ISC license.
|
|
290
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
-
*/const $o=De("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
292
|
-
* @license lucide-react v0.469.0 - ISC
|
|
293
|
-
*
|
|
294
|
-
* This source code is licensed under the ISC license.
|
|
295
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
-
*/const cb=De("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
|
|
297
|
-
* @license lucide-react v0.469.0 - ISC
|
|
298
|
-
*
|
|
299
|
-
* This source code is licensed under the ISC license.
|
|
300
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
-
*/const ba=De("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
302
|
-
* @license lucide-react v0.469.0 - ISC
|
|
303
|
-
*
|
|
304
|
-
* This source code is licensed under the ISC license.
|
|
305
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
-
*/const ub=De("Zap",[["path",{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",key:"1xq2db"}]]);/**
|
|
307
|
-
* @license lucide-react v0.469.0 - ISC
|
|
308
|
-
*
|
|
309
|
-
* This source code is licensed under the ISC license.
|
|
310
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
-
*/const db=De("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);pd.__defineMacro("\\ce",function(r){return ig(r.consumeArgs(1)[0],"ce")});pd.__defineMacro("\\pu",function(r){return ig(r.consumeArgs(1)[0],"pu")});pd.__defineMacro("\\tripledash","{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");var ig=function(l,i){for(var c="",d=l.length&&l[l.length-1].loc.start,f=l.length-1;f>=0;f--)l[f].loc.start>d&&(c+=" ",d=l[f].loc.start),c+=l[f].text,d+=l[f].text.length;var h=gt.go(J.go(c,i));return h},J={go:function(l,i){if(!l)return[];i===void 0&&(i="ce");var c="0",d={};d.parenthesisLevel=0,l=l.replace(/\n/g," "),l=l.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),l=l.replace(/[\u2026]/g,"...");for(var f,h=10,p=[];;){f!==l?(h=10,f=l):h--;var x=J.stateMachines[i],v=x.transitions[c]||x.transitions["*"];e:for(var b=0;b<v.length;b++){var w=J.patterns.match_(v[b].pattern,l);if(w){for(var k=v[b].task,S=0;S<k.action_.length;S++){var _;if(x.actions[k.action_[S].type_])_=x.actions[k.action_[S].type_](d,w.match_,k.action_[S].option);else if(J.actions[k.action_[S].type_])_=J.actions[k.action_[S].type_](d,w.match_,k.action_[S].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+k.action_[S].type_+")"];J.concatArray(p,_)}if(c=k.nextState||c,l.length>0){if(k.revisit||(l=w.remainder),!k.toContinue)break e}else return p}}if(h<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(l,i){if(i)if(Array.isArray(i))for(var c=0;c<i.length;c++)l.push(i[c]);else l.push(i)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(l){var i=l.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return i&&i[0]?{match_:i.splice(1),remainder:l.substr(i[0].length)}:null},"(-)(9)^(-9)":function(l){var i=l.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return i&&i[0]?{match_:i.splice(1),remainder:l.substr(i[0].length)}:null},"state of aggregation $":function(l){var i=J.patterns.findObserveGroups(l,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(i&&i.remainder.match(/^($|[\s,;\)\]\}])/))return i;var c=l.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return c?{match_:c[0],remainder:l.substr(c[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(l){return J.patterns.findObserveGroups(l,"^{","","","}")},"^($...$)":function(l){return J.patterns.findObserveGroups(l,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(l){return J.patterns.findObserveGroups(l,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(l){return J.patterns.findObserveGroups(l,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(l){return J.patterns.findObserveGroups(l,"_{","","","}")},"_($...$)":function(l){return J.patterns.findObserveGroups(l,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(l){return J.patterns.findObserveGroups(l,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(l){return J.patterns.findObserveGroups(l,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(l){return J.patterns.findObserveGroups(l,"","{","}","")},"{(...)}":function(l){return J.patterns.findObserveGroups(l,"{","","","}")},"$...$":function(l){return J.patterns.findObserveGroups(l,"","$","$","")},"${(...)}$":function(l){return J.patterns.findObserveGroups(l,"${","","","}$")},"$(...)$":function(l){return J.patterns.findObserveGroups(l,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(l){return J.patterns.findObserveGroups(l,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(l){return J.patterns.findObserveGroups(l,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(l){return J.patterns.findObserveGroups(l,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(l){return J.patterns.findObserveGroups(l,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(l){return J.patterns.findObserveGroups(l,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(l){return J.patterns.findObserveGroups(l,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(l){return J.patterns.findObserveGroups(l,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(l){return J.patterns.findObserveGroups(l,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(l){return J.patterns.findObserveGroups(l,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(l){return J.patterns.findObserveGroups(l,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(l){return J.patterns.findObserveGroups(l,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(l){return J.patterns.findObserveGroups(l,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(l){var i;if(i=l.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/),i)return{match_:i[0],remainder:l.substr(i[0].length)};var c=J.patterns.findObserveGroups(l,"","$","$","");return c&&(i=c.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),i)?{match_:i[0],remainder:l.substr(i[0].length)}:null},amount2:function(l){return this.amount(l)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(l){if(l.match(/^\([a-z]+\)$/))return null;var i=l.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return i?{match_:i[0],remainder:l.substr(i[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(l,i,c,d,f,h,p,x,v,b){var w=function(U,z){if(typeof z=="string")return U.indexOf(z)!==0?null:z;var H=U.match(z);return H?H[0]:null},k=function(U,z,H){for(var K=0;z<U.length;){var j=U.charAt(z),q=w(U.substr(z),H);if(q!==null&&K===0)return{endMatchBegin:z,endMatchEnd:z+q.length};if(j==="{")K++;else if(j==="}"){if(K===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];K--}z++}return K>0,null},S=w(l,i);if(S===null||(l=l.substr(S.length),S=w(l,c),S===null))return null;var _=k(l,S.length,d||f);if(_===null)return null;var A=l.substring(0,d?_.endMatchEnd:_.endMatchBegin);if(h||p){var D=this.findObserveGroups(l.substr(_.endMatchEnd),h,p,x,v);if(D===null)return null;var O=[A,D.match_];return{match_:b?O.join(""):O,remainder:D.remainder}}else return{match_:A,remainder:l.substr(_.endMatchEnd)}},match_:function(l,i){var c=J.patterns.patterns[l];if(c===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+l+")"];if(typeof c=="function")return J.patterns.patterns[l](i);var d=i.match(c);if(d){var f;return d[2]?f=[d[1],d[2]]:d[1]?f=d[1]:f=d[0],{match_:f,remainder:i.substr(d[0].length)}}return null}},actions:{"a=":function(l,i){l.a=(l.a||"")+i},"b=":function(l,i){l.b=(l.b||"")+i},"p=":function(l,i){l.p=(l.p||"")+i},"o=":function(l,i){l.o=(l.o||"")+i},"q=":function(l,i){l.q=(l.q||"")+i},"d=":function(l,i){l.d=(l.d||"")+i},"rm=":function(l,i){l.rm=(l.rm||"")+i},"text=":function(l,i){l.text_=(l.text_||"")+i},insert:function(l,i,c){return{type_:c}},"insert+p1":function(l,i,c){return{type_:c,p1:i}},"insert+p1+p2":function(l,i,c){return{type_:c,p1:i[0],p2:i[1]}},copy:function(l,i){return i},rm:function(l,i){return{type_:"rm",p1:i||""}},text:function(l,i){return J.go(i,"text")},"{text}":function(l,i){var c=["{"];return J.concatArray(c,J.go(i,"text")),c.push("}"),c},"tex-math":function(l,i){return J.go(i,"tex-math")},"tex-math tight":function(l,i){return J.go(i,"tex-math tight")},bond:function(l,i,c){return{type_:"bond",kind_:c||i}},"color0-output":function(l,i){return{type_:"color0",color:i[0]}},ce:function(l,i){return J.go(i)},"1/2":function(l,i){var c=[];i.match(/^[+\-]/)&&(c.push(i.substr(0,1)),i=i.substr(1));var d=i.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return d[1]=d[1].replace(/\$/g,""),c.push({type_:"frac",p1:d[1],p2:d[2]}),d[3]&&(d[3]=d[3].replace(/\$/g,""),c.push({type_:"tex-math",p1:d[3]})),c},"9,9":function(l,i){return J.go(i,"9,9")}},createTransitions:function(l){var i,c,d,f,h={};for(i in l)for(c in l[i])for(d=c.split("|"),l[i][c].stateArray=d,f=0;f<d.length;f++)h[d[f]]=[];for(i in l)for(c in l[i])for(d=l[i][c].stateArray||[],f=0;f<d.length;f++){var p=l[i][c];if(p.action_){p.action_=[].concat(p.action_);for(var x=0;x<p.action_.length;x++)typeof p.action_[x]=="string"&&(p.action_[x]={type_:p.action_[x]})}else p.action_=[];for(var v=i.split("|"),b=0;b<v.length;b++)if(d[f]==="*")for(var w in h)h[w].push({pattern:v[b],task:p});else h[d[f]].push({pattern:v[b],task:p})}return h},stateMachines:{}};J.stateMachines={ce:{transitions:J.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(l,i){var c;if((l.d||"").match(/^[0-9]+$/)){var d=l.d;l.d=void 0,c=this.output(l),l.b=d}else c=this.output(l);return J.actions["o="](l,i),c},"d= kv":function(l,i){l.d=i,l.dType="kv"},"charge or bond":function(l,i){if(l.beginsWithBond){var c=[];return J.concatArray(c,this.output(l)),J.concatArray(c,J.actions.bond(l,i,"-")),c}else l.d=i},"- after o/d":function(l,i,c){var d=J.patterns.match_("orbital",l.o||""),f=J.patterns.match_("one lowercase greek letter $",l.o||""),h=J.patterns.match_("one lowercase latin letter $",l.o||""),p=J.patterns.match_("$one lowercase latin letter$ $",l.o||""),x=i==="-"&&(d&&d.remainder===""||f||h||p);x&&!l.a&&!l.b&&!l.p&&!l.d&&!l.q&&!d&&h&&(l.o="$"+l.o+"$");var v=[];return x?(J.concatArray(v,this.output(l)),v.push({type_:"hyphen"})):(d=J.patterns.match_("digits",l.d||""),c&&d&&d.remainder===""?(J.concatArray(v,J.actions["d="](l,i)),J.concatArray(v,this.output(l))):(J.concatArray(v,this.output(l)),J.concatArray(v,J.actions.bond(l,i,"-")))),v},"a to o":function(l){l.o=l.a,l.a=void 0},"sb=true":function(l){l.sb=!0},"sb=false":function(l){l.sb=!1},"beginsWithBond=true":function(l){l.beginsWithBond=!0},"beginsWithBond=false":function(l){l.beginsWithBond=!1},"parenthesisLevel++":function(l){l.parenthesisLevel++},"parenthesisLevel--":function(l){l.parenthesisLevel--},"state of aggregation":function(l,i){return{type_:"state of aggregation",p1:J.go(i,"o")}},comma:function(l,i){var c=i.replace(/\s*$/,""),d=c!==i;return d&&l.parenthesisLevel===0?{type_:"comma enumeration L",p1:c}:{type_:"comma enumeration M",p1:c}},output:function(l,i,c){var d;if(!l.r)d=[],!l.a&&!l.b&&!l.p&&!l.o&&!l.q&&!l.d&&!c||(l.sb&&d.push({type_:"entitySkip"}),!l.o&&!l.q&&!l.d&&!l.b&&!l.p&&c!==2?(l.o=l.a,l.a=void 0):!l.o&&!l.q&&!l.d&&(l.b||l.p)?(l.o=l.a,l.d=l.b,l.q=l.p,l.a=l.b=l.p=void 0):l.o&&l.dType==="kv"&&J.patterns.match_("d-oxidation$",l.d||"")?l.dType="oxidation":l.o&&l.dType==="kv"&&!l.q&&(l.dType=void 0),d.push({type_:"chemfive",a:J.go(l.a,"a"),b:J.go(l.b,"bd"),p:J.go(l.p,"pq"),o:J.go(l.o,"o"),q:J.go(l.q,"pq"),d:J.go(l.d,l.dType==="oxidation"?"oxidation":"bd"),dType:l.dType}));else{var f;l.rdt==="M"?f=J.go(l.rd,"tex-math"):l.rdt==="T"?f=[{type_:"text",p1:l.rd||""}]:f=J.go(l.rd);var h;l.rqt==="M"?h=J.go(l.rq,"tex-math"):l.rqt==="T"?h=[{type_:"text",p1:l.rq||""}]:h=J.go(l.rq),d={type_:"arrow",r:l.r,rd:f,rq:h}}for(var p in l)p!=="parenthesisLevel"&&p!=="beginsWithBond"&&delete l[p];return d},"oxidation-output":function(l,i){var c=["{"];return J.concatArray(c,J.go(i,"oxidation")),c.push("}"),c},"frac-output":function(l,i){return{type_:"frac-ce",p1:J.go(i[0]),p2:J.go(i[1])}},"overset-output":function(l,i){return{type_:"overset",p1:J.go(i[0]),p2:J.go(i[1])}},"underset-output":function(l,i){return{type_:"underset",p1:J.go(i[0]),p2:J.go(i[1])}},"underbrace-output":function(l,i){return{type_:"underbrace",p1:J.go(i[0]),p2:J.go(i[1])}},"color-output":function(l,i){return{type_:"color",color1:i[0],color2:J.go(i[1])}},"r=":function(l,i){l.r=i},"rdt=":function(l,i){l.rdt=i},"rd=":function(l,i){l.rd=i},"rqt=":function(l,i){l.rqt=i},"rq=":function(l,i){l.rq=i},operator:function(l,i,c){return{type_:"operator",kind_:c||i}}}},a:{transitions:J.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:J.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:J.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(l){if(l.text_){var i={type_:"text",p1:l.text_};for(var c in l)delete l[c];return i}}}},pq:{transitions:J.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(l,i){return{type_:"state of aggregation subscript",p1:J.go(i,"o")}},"color-output":function(l,i){return{type_:"color",color1:i[0],color2:J.go(i[1],"pq")}}}},bd:{transitions:J.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(l,i){return{type_:"color",color1:i[0],color2:J.go(i[1],"bd")}}}},oxidation:{transitions:J.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(l,i){return{type_:"roman numeral",p1:i||""}}}},"tex-math":{transitions:J.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(l){if(l.o){var i={type_:"tex-math",p1:l.o};for(var c in l)delete l[c];return i}}}},"tex-math tight":{transitions:J.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(l,i){l.o=(l.o||"")+"{"+i+"}"},output:function(l){if(l.o){var i={type_:"tex-math",p1:l.o};for(var c in l)delete l[c];return i}}}},"9,9":{transitions:J.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:J.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(l,i){var c=[];return i[0]==="+-"||i[0]==="+/-"?c.push("\\pm "):i[0]&&c.push(i[0]),i[1]&&(J.concatArray(c,J.go(i[1],"pu-9,9")),i[2]&&(i[2].match(/[,.]/)?J.concatArray(c,J.go(i[2],"pu-9,9")):c.push(i[2])),i[3]=i[4]||i[3],i[3]&&(i[3]=i[3].trim(),i[3]==="e"||i[3].substr(0,1)==="*"?c.push({type_:"cdot"}):c.push({type_:"times"}))),i[3]&&c.push("10^{"+i[5]+"}"),c},"number^":function(l,i){var c=[];return i[0]==="+-"||i[0]==="+/-"?c.push("\\pm "):i[0]&&c.push(i[0]),J.concatArray(c,J.go(i[1],"pu-9,9")),c.push("^{"+i[2]+"}"),c},operator:function(l,i,c){return{type_:"operator",kind_:c||i}},space:function(){return{type_:"pu-space-1"}},output:function(l){var i,c=J.patterns.match_("{(...)}",l.d||"");c&&c.remainder===""&&(l.d=c.match_);var d=J.patterns.match_("{(...)}",l.q||"");if(d&&d.remainder===""&&(l.q=d.match_),l.d&&(l.d=l.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),l.d=l.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),l.q){l.q=l.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),l.q=l.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var f={d:J.go(l.d,"pu"),q:J.go(l.q,"pu")};l.o==="//"?i={type_:"pu-frac",p1:f.d,p2:f.q}:(i=f.d,f.d.length>1||f.q.length>1?i.push({type_:" / "}):i.push({type_:"/"}),J.concatArray(i,f.q))}else i=J.go(l.d,"pu-2");for(var h in l)delete l[h];return i}}},"pu-2":{transitions:J.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(l,i){l.rm+="^{"+i+"}"},space:function(){return{type_:"pu-space-2"}},output:function(l){var i=[];if(l.rm){var c=J.patterns.match_("{(...)}",l.rm||"");c&&c.remainder===""?i=J.go(c.match_,"pu"):i={type_:"rm",p1:l.rm}}for(var d in l)delete l[d];return i}}},"pu-9,9":{transitions:J.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(l){var i=[];if(l.text_=l.text_||"",l.text_.length>4){var c=l.text_.length%3;c===0&&(c=3);for(var d=l.text_.length-3;d>0;d-=3)i.push(l.text_.substr(d,3)),i.push({type_:"1000 separator"});i.push(l.text_.substr(0,c)),i.reverse()}else i.push(l.text_);for(var f in l)delete l[f];return i},"output-o":function(l){var i=[];if(l.text_=l.text_||"",l.text_.length>4){for(var c=l.text_.length-3,d=0;d<c;d+=3)i.push(l.text_.substr(d,3)),i.push({type_:"1000 separator"});i.push(l.text_.substr(d))}else i.push(l.text_);for(var f in l)delete l[f];return i}}}};var gt={go:function(l,i){if(!l)return"";for(var c="",d=!1,f=0;f<l.length;f++){var h=l[f];typeof h=="string"?c+=h:(c+=gt._go2(h),h.type_==="1st-level escape"&&(d=!0))}return!i&&!d&&c&&(c="{"+c+"}"),c},_goInner:function(l){return l&>.go(l,!0)},_go2:function(l){var i;switch(l.type_){case"chemfive":i="";var c={a:gt._goInner(l.a),b:gt._goInner(l.b),p:gt._goInner(l.p),o:gt._goInner(l.o),q:gt._goInner(l.q),d:gt._goInner(l.d)};c.a&&(c.a.match(/^[+\-]/)&&(c.a="{"+c.a+"}"),i+=c.a+"\\,"),(c.b||c.p)&&(i+="{\\vphantom{X}}",i+="^{\\hphantom{"+(c.b||"")+"}}_{\\hphantom{"+(c.p||"")+"}}",i+="{\\vphantom{X}}",i+="^{\\smash[t]{\\vphantom{2}}\\mathllap{"+(c.b||"")+"}}",i+="_{\\vphantom{2}\\mathllap{\\smash[t]{"+(c.p||"")+"}}}"),c.o&&(c.o.match(/^[+\-]/)&&(c.o="{"+c.o+"}"),i+=c.o),l.dType==="kv"?((c.d||c.q)&&(i+="{\\vphantom{X}}"),c.d&&(i+="^{"+c.d+"}"),c.q&&(i+="_{\\smash[t]{"+c.q+"}}")):l.dType==="oxidation"?(c.d&&(i+="{\\vphantom{X}}",i+="^{"+c.d+"}"),c.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+c.q+"}}")):(c.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+c.q+"}}"),c.d&&(i+="{\\vphantom{X}}",i+="^{"+c.d+"}"));break;case"rm":i="\\mathrm{"+l.p1+"}";break;case"text":l.p1.match(/[\^_]/)?(l.p1=l.p1.replace(" ","~").replace("-","\\text{-}"),i="\\mathrm{"+l.p1+"}"):i="\\text{"+l.p1+"}";break;case"roman numeral":i="\\mathrm{"+l.p1+"}";break;case"state of aggregation":i="\\mskip2mu "+gt._goInner(l.p1);break;case"state of aggregation subscript":i="\\mskip1mu "+gt._goInner(l.p1);break;case"bond":if(i=gt._getBond(l.kind_),!i)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+l.kind_+")"];break;case"frac":var d="\\frac{"+l.p1+"}{"+l.p2+"}";i="\\mathchoice{\\textstyle"+d+"}{"+d+"}{"+d+"}{"+d+"}";break;case"pu-frac":var f="\\frac{"+gt._goInner(l.p1)+"}{"+gt._goInner(l.p2)+"}";i="\\mathchoice{\\textstyle"+f+"}{"+f+"}{"+f+"}{"+f+"}";break;case"tex-math":i=l.p1+" ";break;case"frac-ce":i="\\frac{"+gt._goInner(l.p1)+"}{"+gt._goInner(l.p2)+"}";break;case"overset":i="\\overset{"+gt._goInner(l.p1)+"}{"+gt._goInner(l.p2)+"}";break;case"underset":i="\\underset{"+gt._goInner(l.p1)+"}{"+gt._goInner(l.p2)+"}";break;case"underbrace":i="\\underbrace{"+gt._goInner(l.p1)+"}_{"+gt._goInner(l.p2)+"}";break;case"color":i="{\\color{"+l.color1+"}{"+gt._goInner(l.color2)+"}}";break;case"color0":i="\\color{"+l.color+"}";break;case"arrow":var h={rd:gt._goInner(l.rd),rq:gt._goInner(l.rq)},p="\\x"+gt._getArrow(l.r);h.rq&&(p+="[{"+h.rq+"}]"),h.rd?p+="{"+h.rd+"}":p+="{}",i=p;break;case"operator":i=gt._getOperator(l.kind_);break;case"1st-level escape":i=l.p1+" ";break;case"space":i=" ";break;case"entitySkip":i="~";break;case"pu-space-1":i="~";break;case"pu-space-2":i="\\mkern3mu ";break;case"1000 separator":i="\\mkern2mu ";break;case"commaDecimal":i="{,}";break;case"comma enumeration L":i="{"+l.p1+"}\\mkern6mu ";break;case"comma enumeration M":i="{"+l.p1+"}\\mkern3mu ";break;case"comma enumeration S":i="{"+l.p1+"}\\mkern1mu ";break;case"hyphen":i="\\text{-}";break;case"addition compound":i="\\,{\\cdot}\\,";break;case"electron dot":i="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":i="{\\times}";break;case"prime":i="\\prime ";break;case"cdot":i="\\cdot ";break;case"tight cdot":i="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":i="\\times ";break;case"circa":i="{\\sim}";break;case"^":i="uparrow";break;case"v":i="downarrow";break;case"ellipsis":i="\\ldots ";break;case"/":i="/";break;case" / ":i="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return i},_getArrow:function(l){switch(l){case"->":return"rightarrow";case"→":return"rightarrow";case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"rightleftarrows";case"<=>":return"rightleftharpoons";case"⇌":return"rightleftharpoons";case"<=>>":return"rightequilibrium";case"<<=>":return"leftequilibrium";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(l){switch(l){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";case"~=":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"~--":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"-~-":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(l){switch(l){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};function fb(r){const l=r.trim().split(`
|
|
312
|
-
`);if(l.length<2)return!1;const i=l[0].trim();if(!i.startsWith("|")||(i.match(/\|/g)||[]).length<2)return!1;const c=l[1].trim();if(!c.startsWith("|")||!/^[\s|:|-]+$/.test(c)||!c.includes("-"))return!1;for(let d=2;d<l.length;d++){const f=l[d].trim();if(f!==""&&!f.startsWith("|"))return!1}return!0}function mb(r){return r.replace(/(^|\n)(```|~~~)\s*\n([\s\S]*?)\n\2(\n|$)/g,(l,i,c,d,f)=>fb(d)?`${i}
|
|
313
|
-
${d.trim()}
|
|
314
|
-
${f}`:l)}function hb(r){const l={};let i=0;return r=r.replace(/\$\$([\s\S]*?)\$\$/g,(c,d)=>{const f=`__DISPLAY_MATH_${i++}__`;return l[f]=`$$${d}$$`,f}),r=r.replace(/\\\[([\s\S]*?)\\\]/g,(c,d)=>{const f=`__DISPLAY_MATH_${i++}__`;return l[f]=`$$${d}$$`,f}),r=r.replace(/\\\(([\s\S]*?)\\\)/g,(c,d)=>{const f=`__INLINE_MATH_${i++}__`;return l[f]=`$${d}$`,f}),r=r.replace(/(^|\n)(```|~~~)([^\n]*)\n([\s\S]*?)\n\2(\n|$)/g,(c,d,f,h,p,x)=>{const v=`__FENCED_CODE_${i++}__`;return l[v]=`${d}${f}${h}
|
|
315
|
-
${p}
|
|
316
|
-
${f}${x}`,v}),r=r.replace(/`([^`]+)`/g,c=>{const d=`__INLINE_CODE_${i++}__`;return l[d]=c,d}),{masked:r,masks:l}}function pb(r){const l={};let i=0;return r=r.replace(new RegExp("(?<!\\$)\\$(?!\\$)([^$\\n]+?)(?<!\\$)\\$(?!\\$)","g"),(c,d)=>{const f=d.trim();if(/^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?(?:\s?[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion)?$/.test(f))return c;const p=`__INLINE_MATH_${i++}__`;return l[p]=`$${d}$`,p}),{masked:r,masks:l}}const pp=/\\(?:iiint|iint|oint|int|sum|prod|lim|frac|sqrt|sin|cos|tan|sec|csc|cot|arcsin|arccos|arctan|ln|log|exp|Delta|nabla|partial)\b/;function gb(r){const l=/(__INLINE_MATH_\d+__|__DISPLAY_MATH_\d+__|__CURRENCY_\d+__)/g,i=/^(__INLINE_MATH_\d+__|__DISPLAY_MATH_\d+__|__CURRENCY_\d+__)$/;return r.split(`
|
|
317
|
-
`).map(c=>pp.test(c)?c.split(l).map(d=>!d||i.test(d)||!pp.test(d)||d.includes("$")?d:d.replace(/\\(?:iiint|iint|oint|int|sum|prod|lim|frac|sqrt|sin|cos|tan|sec|csc|cot|arcsin|arccos|arctan|ln|log|exp|Delta|nabla|partial)\b[^\n]*/g,f=>{const h=f.trimEnd();return h?`$${h}$${f.slice(h.length)}`:f})).join(""):c).join(`
|
|
318
|
-
`)}function xb(r){return r.replace(/\$([^$\n]*?)\s*=\s*\$([^$\n]+)\$\s*([^$\n]*?)\$/g,(l,i,c,d)=>{const f=String(i).trimEnd(),h=String(c).trim(),p=String(d).trim(),x=[h,p].filter(Boolean).join(" ");return`$${f} = ${x}$`})}function bb(r){const l=r.split(`
|
|
319
|
-
`);for(let c=0;c<l.length-1;c++){const d=l[c],f=l[c+1]??"";if(!d||!f)continue;const h=f.trim();if(!(h.startsWith("|")&&h.includes("-")))continue;const x=d.indexOf("|");if(x<=0)continue;const v=d.slice(0,x);if(!v||v.trim()==="")continue;const b=v.trim(),w=b.replace(/\s+/g,""),k=w!==""&&/^[>]+$/.test(w),S=/^[-*+]\s*$/.test(b),_=/^\d+\.\s*$/.test(b);if(k||S||_)continue;const A=d.slice(x);if((A.match(/\|/g)||[]).length<2)continue;const O=v.replace(/\s+$/,""),ee=A.replace(/^\s+/,"");O&&(l.splice(c,1,O,ee),c++)}const i=[];for(let c=0;c<l.length;c++){const d=l[c],f=d.trim(),p=(l[c+1]??"").trim();f.startsWith("|")&&(f.match(/\|/g)||[]).length>=2&&p.startsWith("|")&&/^[\s|:-]+$/.test(p)&&p.includes("-")&&i.length>0&&i[i.length-1].trim()!==""&&i.push(""),i.push(d)}return i.join(`
|
|
320
|
-
`)}const gp=["aligned","align","align*","array","cases","pmatrix","bmatrix","vmatrix","Vmatrix","matrix","smallmatrix","gather","gather*","multline","multline*","split","flalign","flalign*","eqnarray","equation","equation*"];function yb(r,l){let i=0,c=`__${l}_${i}__`;for(;Object.prototype.hasOwnProperty.call(r,c);)i++,c=`__${l}_${i}__`;return c}function vb(r,l){if(!gp.length)return r;const i=gp.join("|"),c=new RegExp(String.raw`\\begin\{(${i})\}([\s\S]*?)\\end\{\1\}`,"g");return r.replace(c,(d,f,h,p,x)=>{const v=x.slice(0,p),b=x.slice(p+d.length),w=/(\$\$|\\\[)\s*$/.test(v),k=/^\s*(\$\$|\\\])/.test(b);if(w&&k)return d;const S=v.lastIndexOf("\\["),_=v.lastIndexOf("\\]");if(S>_&&S!==-1&&/\\]/.test(b))return d;const D=/\$\$/g;let O=0;for(;D.exec(v)!==null;)O++;if(O%2===1&&/\$\$/.test(b))return d;if((v.replace(/\$\$/g,"__DD__").replace(/\\\$/g,"__ES__").match(/\$/g)||[]).length%2===1){const I=b.replace(/\$\$/g,"__DD__").replace(/\\\$/g,"__ES__");if(/^[^$]*\$(?!\$)/.test(I))return d}const j=yb(l,"LATEX_ENV"),q=d.trim();return l[j]=`
|
|
321
|
-
$$
|
|
322
|
-
${q}
|
|
323
|
-
$$
|
|
324
|
-
`,j})}function wb(r,l){for(const[i,c]of Object.entries(l)){const d=new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");r=r.replace(d,()=>c)}return r}const Sb=r=>{if(!r||typeof r!="string")return"";try{let l=r.replace(/\r\n/g,`
|
|
325
|
-
`).replace(/\r/g,`
|
|
326
|
-
`);l=mb(l);const{masked:i,masks:c}=hb(l);l=i,l=l.replace(/<br\s*\/?>/gi,`
|
|
327
|
-
`),l=l.replace(/\\(ne|neq)\$(?=\s*[-+0-9A-Za-z(])/g,"\\$1"),l=xb(l),l=bb(l),l=vb(l,c);const d=new Map;let f=0;const h=String.raw`-?\$\(?\d{1,3}(?:,\d{3})*(?:\.\d+)?\)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?|\$-?\d+(?:\.\d+)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?`,p=new RegExp(String.raw`(${h})(\s?[–-]\s?)(${h})`,"g");l=l.replace(p,(k,S,_,A)=>{const D=`__CURRENCY_${f++}__`,O=`__CURRENCY_${f++}__`;return d.set(D,S),d.set(O,A),`${D}${_}${O}`});const x=new RegExp(String.raw`-?\$\(?\d{1,3}(?:,\d{3})*(?:\.\d+)?\)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?(?!\w)|\$-?\d+(?:\.\d+)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?(?!\w)`,"g");l=l.replace(x,(k,S,_)=>{if(_.substring(S+k.length).match(/^[a-zA-Z]/)&&!k.match(/[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion$/))return k;const D=`__CURRENCY_${f++}__`;return d.set(D,k),D});const{masked:v,masks:b}=pb(l);return l=v,Object.assign(c,b),l=gb(l),[/(?:^|\s)([a-zA-Z0-9]+\s*[\^_]\s*[a-zA-Z0-9{}]+(?:\s*[+\-*/]\s*[a-zA-Z0-9]+\s*[\^_]\s*[a-zA-Z0-9{}]+)*\s*=\s*[^$\n]+)(?:\s|$)/g,/(?:^|\s)(\\frac\{[^}]+\}\{[^}]+\})(?:\s|$)/g,/(?:^|\s)(\\(?:sqrt|int|sum|prod|lim|log|ln|sin|cos|tan|exp)\b[^$\n]{0,50})(?:\s|$)/g,/(?:^|\s)([A-Z][a-z]?(?:\d+)?(?:\([A-Z][a-z]?(?:\d+)?\))?(?:\d+)?(?:[+-]\d*)?)+(?:\s|$)/g].forEach(k=>{l=l.replace(k,(S,_)=>{if(S.includes("$")||S.includes("__INLINE_MATH_")||S.includes("__DISPLAY_MATH_")||S.includes("__CURRENCY_"))return S;const A=String(_??"").trim();if(/^[A-Za-z]$/.test(A))return S;const D=/[\\^_+=<>]|\\b(?:frac|sqrt|sum|int|lim|log|ln|sin|cos|tan|exp)\b/.test(A),O=/\d/.test(A),ee=/[()]/.test(A),U=(A.match(/[A-Z]/g)||[]).length,z=(A.match(/[a-z]/g)||[]).length,H=U>=2,K=O||ee||H&&z>0;return!D&&!K?S:S.replace(_,`$${_}$`)})}),l=l.replace(new RegExp("(?<!\\\\)\\$(?!\\$)([^$\\n]*?)(?<!\\\\)\\$(?!\\$)","g"),(k,S)=>{if(k.includes("__CURRENCY_")||k.includes("__INLINE_MATH_")||k.includes("__DISPLAY_MATH_")||S.trim()==="")return k;const _=/^\d+(?:,\d{3})*(?:\.\d{2})?$/.test(S.trim()),A=/\\/.test(S),D=/[+\-*/=<>^_{}()]/.test(S),O=/[a-zA-Z].*\d|\d.*[a-zA-Z]/.test(S),ee=/\\(?:alpha|beta|gamma|delta|epsilon|theta|lambda|mu|pi|sigma|omega)/.test(S),U=/\\(?:frac|sqrt|sum|int|lim|log|ln|sin|cos|tan|exp)/.test(S),z=/^[A-Za-z]$/.test(S.trim());return!_&&(A||D||O||ee||U||z||S.length>1)?k:`\\$${S}\\$`}),l=l.split(`
|
|
328
|
-
`).map(k=>{const S=k.indexOf("$$");return S===-1||k.trim()==="$$"||k.indexOf("$$",S+2)!==-1?k:k.replace("$$","\\$\\$")}).join(`
|
|
329
|
-
`),d.forEach((k,S)=>{const _=k.replace(/\$/g,"$");l=l.replace(new RegExp(S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),_)}),l=l.replace(/\\$/g,"$"),l=wb(l,c),l=l.trimEnd()+`
|
|
330
|
-
`,l}catch(l){return console.warn("Error preprocessing markdown:",l),r}},kb={'code[class*="language-"]':{color:"#393A34",fontFamily:'"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",fontSize:".9em",lineHeight:"1.2em",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"#393A34",fontFamily:'"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",fontSize:".9em",lineHeight:"1.2em",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",border:"1px solid #dddddd",backgroundColor:"white"},'pre > code[class*="language-"]':{fontSize:"1em"},'pre[class*="language-"]::-moz-selection':{background:"#C1DEF1"},'pre[class*="language-"] ::-moz-selection':{background:"#C1DEF1"},'code[class*="language-"]::-moz-selection':{background:"#C1DEF1"},'code[class*="language-"] ::-moz-selection':{background:"#C1DEF1"},'pre[class*="language-"]::selection':{background:"#C1DEF1"},'pre[class*="language-"] ::selection':{background:"#C1DEF1"},'code[class*="language-"]::selection':{background:"#C1DEF1"},'code[class*="language-"] ::selection':{background:"#C1DEF1"},':not(pre) > code[class*="language-"]':{padding:".2em",paddingTop:"1px",paddingBottom:"1px",background:"#f8f8f8",border:"1px solid #dddddd"},comment:{color:"#008000",fontStyle:"italic"},prolog:{color:"#008000",fontStyle:"italic"},doctype:{color:"#008000",fontStyle:"italic"},cdata:{color:"#008000",fontStyle:"italic"},namespace:{Opacity:".7"},string:{color:"#A31515"},punctuation:{color:"#393A34"},operator:{color:"#393A34"},url:{color:"#36acaa"},symbol:{color:"#36acaa"},number:{color:"#36acaa"},boolean:{color:"#36acaa"},variable:{color:"#36acaa"},constant:{color:"#36acaa"},inserted:{color:"#36acaa"},atrule:{color:"#0000ff"},keyword:{color:"#0000ff"},"attr-value":{color:"#0000ff"},".language-autohotkey .token.selector":{color:"#0000ff"},".language-json .token.boolean":{color:"#0000ff"},".language-json .token.number":{color:"#0000ff"},'code[class*="language-css"]':{color:"#0000ff"},function:{color:"#393A34"},deleted:{color:"#9a050f"},".language-autohotkey .token.tag":{color:"#9a050f"},selector:{color:"#800000"},".language-autohotkey .token.keyword":{color:"#00009f"},important:{color:"#e90",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},"class-name":{color:"#2B91AF"},".language-json .token.property":{color:"#2B91AF"},tag:{color:"#800000"},"attr-name":{color:"#ff0000"},property:{color:"#ff0000"},regex:{color:"#ff0000"},entity:{color:"#ff0000"},"directive.tag.tag":{background:"#ffff00",color:"#393A34"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"#a5a5a5"},".line-numbers .line-numbers-rows > span:before":{color:"#2B91AF"},".line-highlight.line-highlight":{background:"linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0))"}},_b={'pre[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",background:"#1e1e1e"},'code[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'pre[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},':not(pre) > code[class*="language-"]':{padding:".1em .3em",borderRadius:".3em",color:"#db4c69",background:"#1e1e1e"},".namespace":{Opacity:".7"},"doctype.doctype-tag":{color:"#569CD6"},"doctype.name":{color:"#9cdcfe"},comment:{color:"#6a9955"},prolog:{color:"#6a9955"},punctuation:{color:"#d4d4d4"},".language-html .language-css .token.punctuation":{color:"#d4d4d4"},".language-html .language-javascript .token.punctuation":{color:"#d4d4d4"},property:{color:"#9cdcfe"},tag:{color:"#569cd6"},boolean:{color:"#569cd6"},number:{color:"#b5cea8"},constant:{color:"#9cdcfe"},symbol:{color:"#b5cea8"},inserted:{color:"#b5cea8"},unit:{color:"#b5cea8"},selector:{color:"#d7ba7d"},"attr-name":{color:"#9cdcfe"},string:{color:"#ce9178"},char:{color:"#ce9178"},builtin:{color:"#ce9178"},deleted:{color:"#ce9178"},".language-css .token.string.url":{textDecoration:"underline"},operator:{color:"#d4d4d4"},entity:{color:"#569cd6"},"operator.arrow":{color:"#569CD6"},atrule:{color:"#ce9178"},"atrule.rule":{color:"#c586c0"},"atrule.url":{color:"#9cdcfe"},"atrule.url.function":{color:"#dcdcaa"},"atrule.url.punctuation":{color:"#d4d4d4"},keyword:{color:"#569CD6"},"keyword.module":{color:"#c586c0"},"keyword.control-flow":{color:"#c586c0"},function:{color:"#dcdcaa"},"function.maybe-class-name":{color:"#dcdcaa"},regex:{color:"#d16969"},important:{color:"#569cd6"},italic:{fontStyle:"italic"},"class-name":{color:"#4ec9b0"},"maybe-class-name":{color:"#4ec9b0"},console:{color:"#9cdcfe"},parameter:{color:"#9cdcfe"},interpolation:{color:"#9cdcfe"},"punctuation.interpolation-punctuation":{color:"#569cd6"},variable:{color:"#9cdcfe"},"imports.maybe-class-name":{color:"#9cdcfe"},"exports.maybe-class-name":{color:"#9cdcfe"},escape:{color:"#d7ba7d"},"tag.punctuation":{color:"#808080"},cdata:{color:"#808080"},"attr-value":{color:"#ce9178"},"attr-value.punctuation":{color:"#ce9178"},"attr-value.punctuation.attr-equals":{color:"#d4d4d4"},namespace:{color:"#4ec9b0"},'pre[class*="language-javascript"]':{color:"#9cdcfe"},'code[class*="language-javascript"]':{color:"#9cdcfe"},'pre[class*="language-jsx"]':{color:"#9cdcfe"},'code[class*="language-jsx"]':{color:"#9cdcfe"},'pre[class*="language-typescript"]':{color:"#9cdcfe"},'code[class*="language-typescript"]':{color:"#9cdcfe"},'pre[class*="language-tsx"]':{color:"#9cdcfe"},'code[class*="language-tsx"]':{color:"#9cdcfe"},'pre[class*="language-css"]':{color:"#ce9178"},'code[class*="language-css"]':{color:"#ce9178"},'pre[class*="language-html"]':{color:"#d4d4d4"},'code[class*="language-html"]':{color:"#d4d4d4"},".language-regex .token.anchor":{color:"#dcdcaa"},".language-html .token.punctuation":{color:"#808080"},'pre[class*="language-"] > code[class*="language-"]':{position:"relative",zIndex:"1"},".line-highlight.line-highlight":{background:"#f7ebc6",boxShadow:"inset 5px 0 0 #f7d87c",zIndex:"0"}},Ab=g.lazy(()=>Un(()=>import("./MermaidRenderer-BNgxU_bM.js").then(r=>r.au),__vite__mapDeps([0,1,2,3,4])).then(r=>({default:r.MermaidRenderer}))),Cb=g.lazy(()=>Un(()=>import("./SVGRenderer-CZNFFAA_.js"),__vite__mapDeps([5,1,3])).then(r=>({default:r.SVGRenderer}))),jb=g.lazy(()=>Un(()=>import("./ChartRenderer-DmEe5ux0.js"),__vite__mapDeps([6,1,4,7,8,9,10,11,12,13,2,14])).then(r=>({default:r.ChartRenderer}))),Nb=g.lazy(()=>Un(()=>import("./MusicRenderer-fgx5dq-k.js"),__vite__mapDeps([15,2,1])).then(r=>({default:r.MusicRenderer}))),Tb=r=>{var c,d;if(!r)return typeof window<"u"&&((c=window.matchMedia)!=null&&c.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light";const l=r.closest(".markdown-content");if(l){if(l.classList.contains("dark"))return"dark";if(l.classList.contains("light"))return"light"}if(r.closest(".dark"))return"dark";if(r.closest(".light"))return"light";const i=r.closest("[data-theme]");if(i){const f=i.getAttribute("data-theme");if(f==="dark")return"dark";if(f==="light")return"light"}return typeof window<"u"&&((d=window.matchMedia)!=null&&d.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light"},Eb=(r,l)=>{const[i,c]=g.useState("light"),d=g.useRef("light");return g.useEffect(()=>{var v,b,w;if(l||typeof window>"u"||typeof document>"u")return;const f=()=>{const k=Tb(r.current);k!==d.current&&(d.current=k,c(k))};f();const h=((v=window.matchMedia)==null?void 0:v.call(window,"(prefers-color-scheme: dark)"))??null,p=()=>f();h==null||h.addEventListener("change",p);const x=typeof MutationObserver<"u"?new MutationObserver(()=>f()):null;if(x){const k=((w=(b=r.current)==null?void 0:b.closest)==null?void 0:w.call(b,".markdown-content"))??null;k&&x.observe(k,{attributes:!0,attributeFilter:["class","data-theme"]}),document.body&&x.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme"]})}return()=>{h==null||h.removeEventListener("change",p),x==null||x.disconnect()}},[l,r]),l??i},Mb={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"tsx",sh:"bash",shell:"bash",shellsession:"bash",yml:"yaml",yaml:"yaml",py:"python",rb:"ruby",kt:"kotlin",md:"markdown",csharp:"csharp","c#":"csharp","c++":"cpp",tf:"hcl",terraform:"hcl",docker:"dockerfile",dotenv:"env",env:"env",plaintext:"text",text:"text"},zb=r=>{if(!r)return"";const l=r.match(/(?:^|\s)language-([^\s]+)/);if(!l)return"";const c=l[1].toLowerCase().split("{")[0].split("[")[0].split("<")[0].split(":")[0].trim().replace(/[^a-z0-9+#-]+$/g,"");return c?Mb[c]??c:""},Db=r=>Rn.Children.toArray(r).map(l=>typeof l=="string"||typeof l=="number"?String(l):"").join("").replace(/\n$/,""),xp=({code:r})=>{const[l,i]=g.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(r),i(!0),setTimeout(()=>i(!1),2e3)}catch{const d=document.createElement("textarea");d.value=r,d.style.position="fixed",d.style.opacity="0",document.body.appendChild(d),d.select();try{document.execCommand("copy"),i(!0),setTimeout(()=>i(!1),2e3)}catch(f){console.error("Failed to copy code:",f)}document.body.removeChild(d)}};return u.jsxs("button",{className:"code-copy-button",onClick:c,title:l?"Copied!":"Copy code","aria-label":l?"Copied!":"Copy code to clipboard",children:[l?u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M5.5 4.5H3.5C2.94772 4.5 2.5 4.94772 2.5 5.5V12.5C2.5 13.0523 2.94772 13.5 3.5 13.5H10.5C11.0523 13.5 11.5 13.0523 11.5 12.5V10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.5 2.5H12.5C13.0523 2.5 13.5 2.94772 13.5 3.5V9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.5 6.5L13.5 2.5L9.5 2.5V6.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("span",{className:"code-copy-button-text",children:l?"Copied!":"Copy"})]})},Lb=({inline:r,className:l="",children:i,enableGraphs:c=!0,enableMermaid:d=!0,enableSVG:f=!0,enableCharts:h=!0,enableMusic:p=!0,enableSyntaxHighlighting:x=!0,syntaxTheme:v})=>{const b=g.useRef(null),w=Eb(b,v),k=u.jsx("div",{className:"markdown-code-block code-block-container",children:"Loading renderer..."});if(r)return u.jsx("code",{className:l,children:i});const S=zb(l),_=Db(i);if(h&&(S==="chart"||S==="chart-json"||S==="chart-table"))return u.jsx("div",{ref:b,children:u.jsx(g.Suspense,{fallback:k,children:u.jsx(jb,{code:_,language:S})})});if(p&&(S==="abc"||S==="music"))return u.jsx("div",{ref:b,children:u.jsx(g.Suspense,{fallback:k,children:u.jsx(Nb,{code:_})})});if(c){if(S==="mermaid"&&d)return u.jsx("div",{ref:b,children:u.jsx(g.Suspense,{fallback:k,children:u.jsx(Ab,{code:_})})});if(S==="svg"&&f)return u.jsx("div",{ref:b,children:u.jsx(g.Suspense,{fallback:k,children:u.jsx(Cb,{code:_})})})}if(x&&S){const A=w==="light"?kb:_b;return u.jsxs("div",{ref:b,className:"syntax-highlighted-wrapper code-block-container",children:[u.jsx(xp,{code:_}),u.jsx(vx,{language:S,style:A,customStyle:{margin:"12px 0",borderRadius:"6px",fontSize:"0.9em"},showLineNumbers:!1,children:_})]})}return u.jsxs("div",{ref:b,className:`markdown-code-block code-block-container ${l}`.trim(),children:[u.jsx(xp,{code:_}),u.jsx("pre",{style:{margin:0,padding:0,background:"transparent",border:"none"},children:u.jsx("code",{children:_})})]})},bp=new Set(["div","pre","blockquote","ul","ol","table","thead","tbody","tr","td","th","h1","h2","h3","h4","h5","h6","section","article","figure"]),Rb=({children:r,href:l="",className:i="",...c})=>{const d=Rn.Children.toArray(r).map(b=>typeof b=="string"?b:"").join("").trim(),f=/^https?:\/\//i.test(l),h=!!(f&&d&&yp(d)===yp(l)),p=f?Ub(l):null,x=!!(h&&p),v=["markdown-link",x?"markdown-link--card":"markdown-link--inline",i].filter(Boolean).join(" ");return u.jsxs("a",{...c,href:l,target:"_blank",rel:"noopener noreferrer",className:v,children:[u.jsx("span",{className:"markdown-link__content",children:x&&p?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"markdown-link__hostname",children:p.hostname}),p.path&&p.path!=="/"&&u.jsx("span",{className:"markdown-link__path",children:p.path})]}):r}),f&&u.jsx("span",{className:"markdown-link__icon","aria-hidden":"true",children:u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("path",{d:"M8 16L16 8M16 8H9M16 8V15",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})})]})};function yp(r){return r.trim().replace(/\/$/,"")}function Ub(r){try{const l=new URL(r),i=l.hostname.replace(/^www\./i,""),c=`${l.pathname}${l.search}${l.hash}`||"/";return{hostname:i,path:c}}catch{return null}}const rl=({content:r,className:l="",disableMath:i=!1,enableGraphs:c=!0,enableMermaid:d=!0,enableSVG:f=!0,enableCharts:h=!0,enableMusic:p=!0,enableSyntaxHighlighting:x=!0,syntaxTheme:v="dark"})=>{const b=Sb(r);if(!b)return null;const w=i?[rp]:[rp,[bx,{singleDollarTextMath:!0}]],k=[];i||k.push([yx,{throwOnError:!1,errorColor:"#cc0000",strict:!1,trust:!0,macros:{"\\RR":"\\mathbb{R}","\\NN":"\\mathbb{N}","\\ZZ":"\\mathbb{Z}","\\QQ":"\\mathbb{Q}","\\CC":"\\mathbb{C}","\\dx":"\\,dx","\\dy":"\\,dy","\\dt":"\\,dt","\\dz":"\\,dz"}}]);const S={table:({children:_,...A})=>u.jsx("div",{style:{overflowX:"auto",WebkitOverflowScrolling:"touch"},children:u.jsx("table",{...A,children:_})}),a:Rb,code:_=>{const{className:A,children:D,...O}=_,ee=A&&/language-/.test(A),U="inline"in _&&typeof _.inline=="boolean"&&_.inline||!ee,z=ee;return u.jsx(Lb,{inline:U,className:A,enableGraphs:c,enableMermaid:d,enableSVG:f,enableCharts:h,enableMusic:p,enableSyntaxHighlighting:x,syntaxTheme:v,"data-block-code":z?"true":void 0,...O,children:D})},p:({node:_,...A})=>{var U;const O=Rn.Children.toArray(A.children).filter(z=>!(typeof z=="string"&&z.trim()==="")).some(z=>{if(!Rn.isValidElement(z))return!1;const H=z.props;return(H==null?void 0:H["data-block-code"])==="true"?!0:typeof z.type=="string"?bp.has(z.type):!1}),ee=(U=_==null?void 0:_.children)==null?void 0:U.some(z=>{var H;if(z.type==="code")return!0;if(z.type==="element"){if(z.tagName&&bp.has(z.tagName))return!0;if(z.tagName==="code"){const K=(H=z.properties)==null?void 0:H.className;return Array.isArray(K)?K.some(j=>typeof j=="string"&&j.startsWith("language-")):!0}}return!1});return O||ee?u.jsx(u.Fragment,{children:A.children}):u.jsx("p",{...A})}};return u.jsx("div",{className:`markdown-content ${l}`,children:u.jsx(xx,{remarkPlugins:w,rehypePlugins:k,components:S,children:b})})};var Ob={agentMode:{mode:"multi",defaultAdapterId:"simple-chat"},application:{name:"ORBIT Chat",description:"Explore ideas with ORBIT's AI copilots, share context, and build together.",inputPlaceholder:"Message ORBIT...",settingsAboutMsg:"ORBIT Chat",locale:"en-US",favicon:null},seo:{includeSitemap:!1,siteUrl:"http://localhost:5173",exposeAgentNotes:!0},debug:{consoleDebug:!1},features:{enableUpload:!0,enableAudioOutput:!0,enableAudioInput:!0,enableFeedbackButtons:!0,enableConversationThreads:!0,enableAutocomplete:!0},voice:{silenceTimeoutMs:4e3,recognitionLanguage:""},limits:{files:{perConversation:5,maxSizeMB:50,totalFiles:100},conversations:{maxConversations:10,messagesPerConversation:1e3,messagesPerThread:1e3,totalMessages:1e4},messages:{maxLength:1e4}},guestLimits:{files:{perConversation:1,maxSizeMB:5,totalFiles:1},conversations:{maxConversations:2,messagesPerConversation:5,messagesPerThread:2,totalMessages:10},messages:{maxLength:500},rateLimit:{enabled:!0,windowMs:6e4,maxRequests:60,chat:{windowMs:6e4,maxRequests:10}}},auth:{enabled:!0,provider:"auth0"},header:{enabled:!0,logoUrl:"",logoUrlLight:"",logoUrlDark:"",logoHeight:"3.5rem",logoWidth:"auto",bgColor:"",textColor:"",showBorder:!1,navLinks:[{label:"Docs",url:"/"},{label:"About",url:"/about"}]},footer:{enabled:!0,text:"Copyright © 2025 Schmitech Inc.",bgColor:"",textColor:"",showBorder:!1,layout:"stacked",align:"center",topPadding:"large",navLinks:[{label:"Support",url:"/"},{label:"Privacy",url:"/about"}]},adapters:[{id:"simple-chat",name:"Simple AI Chat",apiUrl:"http://localhost:3000",description:"Basic chat interface using the default conversational agent (Similar to ChatGPT - no files).",inputPlaceholder:"Simple chat, ask anything..."},{id:"web-search",name:"Simple AI Chat (Web Search)",apiUrl:"http://localhost:3000",description:"Basic chat interface using the default conversational agent with web search supports.",inputPlaceholder:"Simple chat, ask anything..."},{id:"chat-with-files",name:"Simple AI Chat (Multimodal)",apiUrl:"http://localhost:3000",description:"Extract knowledge from PDF, Images, Word, etc. (Similar to ChatGPT Multimodal)",inputPlaceholder:"Files chat, ask anything..."},{id:"image-generator",name:"AI Image Generator",apiUrl:"http://localhost:3000",description:"Generate images from text descriptions using DALL-E 3 or Imagen 3.",inputPlaceholder:"Describe the image you want to create..."},{id:"video-generator",name:"AI Video Generator",apiUrl:"http://localhost:3000",description:"Generate videos from text descriptions.",inputPlaceholder:"Describe the video you want to create..."},{id:"qa-sql",name:"City FAQ Assistant (SQLite)",apiUrl:"http://localhost:3000",description:"Quick-test QA assistant over the sample city Q&A SQLite database.",inputPlaceholder:"Ask a city services question..."},{id:"qa-vector-chroma",name:"City FAQ Assistant (Chroma)",apiUrl:"http://localhost:3000",description:"Quick-test semantic QA assistant over the sample city Q&A Chroma collection.",inputPlaceholder:"Ask a city services question..."},{id:"hr-db-chatbot",name:"HR System Assistant",apiUrl:"http://localhost:3000",description:"HR database assistant: natural language queries over SQLite HR data via intent templates.",inputPlaceholder:"Ask HR questions..."},{id:"intent-sql-postgres",name:"Customer Orders Assistant",apiUrl:"http://localhost:3000",description:"Customer orders assistant: natural language queries over PostgreSQL customer orders data."},{id:"ecomm-analytics",name:"Business Analytics Assistant",apiUrl:"http://localhost:3000",description:"DuckDB analytics assistant: natural language analytics queries over the analytics demo. This agent is the perfect example of how to use something like OLAP to quickly discover insigths."},{id:"composite-multi-source-explorer",name:"Multi-Source Explorer",apiUrl:"http://localhost:3000",description:"Multi-domain assistant: natural language over HR (SQLite), customer orders (PostgreSQL), and sales analytics (DuckDB)—one chat, retrieval routes each question to the best source.",inputPlaceholder:"Ask about employees, orders, or sales analytics..."},{id:"intent-http-jsonplaceholder",name:"REST API Chat",apiUrl:"http://localhost:3000",description:"Natural language queries over the fake REST API."},{id:"intent-http-paris-opendata",name:"City of Paris Chat",apiUrl:"http://localhost:3000",description:"Paris open data: events and activities (Que Faire à Paris) via natural language."},{id:"intent-mongodb-mflix",name:"Chat With Movies DB",apiUrl:"http://localhost:3000",description:"MFlix movies assistant: query the sample_mflix MongoDB database via intent templates."},{id:"intent-graphql-spacex",name:"GraphQL Chatbot",apiUrl:"http://localhost:3000",description:"SpaceX GraphQL assistant: natural language queries over the SpaceX API.",inputPlaceholder:"Ask SpaceX questions..."},{id:"audio-transcription",name:"Audio Transcription",apiUrl:"http://localhost:3000",description:"Audio Transcription Test.",inputPlaceholder:"Use the microphone for voice..."},{id:"voice-chat",name:"Voice Chat",apiUrl:"http://localhost:3000",description:"Voice chat adapter test.",inputPlaceholder:"Use the microphone for voice..."},{id:"real-time-voice-chat",name:"Real-Time Voice Chat",apiUrl:"http://localhost:3000",description:"Real-time voice chat adapter test (websocket).",inputPlaceholder:"Use the microphone for voice..."},{id:"intent-elasticsearch-log",name:"Log Analysis Assistant",apiUrl:"http://localhost:3000",description:"Analyze app logs, troubleshoot errors, and monitor performance via Elasticsearch."}]};const id="http://localhost:3000",$b="/favicon.svg",qb="/orbit-logo-light.png",Bb="/orbit-logo-dark.png",Hb={agentMode:{mode:"multi",defaultAdapterId:""},application:{name:"ORBIT Chat",description:"Explore ideas with ORBIT's AI copilots, share context, and build together.",inputPlaceholder:"Message ORBIT...",settingsAboutMsg:"ORBIT Chat",locale:"en-US",favicon:""},debug:{consoleDebug:!1},seo:{includeSitemap:!1,siteUrl:"",alternateSiteUrls:[],hostPatterns:[],exposeAgentNotes:!0},features:{enableUpload:!1,enableAudioOutput:!1,enableAudioInput:!1,enableFeedbackButtons:!1,enableConversationThreads:!0,enableAutocomplete:!1},voice:{silenceTimeoutMs:4e3,recognitionLanguage:""},outOfServiceMessage:null,limits:{files:{perConversation:5,maxSizeMB:50,totalFiles:100},conversations:{maxConversations:10,messagesPerConversation:1e3,messagesPerThread:1e3,totalMessages:1e4},messages:{maxLength:1e3}},guestLimits:{files:{perConversation:1,maxSizeMB:10,totalFiles:2},conversations:{maxConversations:1,messagesPerConversation:10,messagesPerThread:10,totalMessages:10},messages:{maxLength:500}},auth:{enabled:!1,provider:"auth0",domain:"",clientId:"",audience:"",tenantId:"",scopes:[]},header:{enabled:!1,logoUrl:"",logoUrlLight:"",logoUrlDark:"",logoHeight:"",logoWidth:"",bgColor:"",textColor:"",showBorder:!0,navLinks:[]},footer:{enabled:!1,text:"",bgColor:"",textColor:"",showBorder:!1,layout:"stacked",align:"center",topPadding:"large",navLinks:[]},startupScripts:[],adapters:[]};function So(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function od(r,l){if(!So(r)||!So(l))return l;const i={...r};return Object.keys(l).forEach(c=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;const d=i[c],f=l[c];So(d)&&So(f)?i[c]=od(d,f):f!==void 0&&(i[c]=f)}),i}function Fb(r){if(typeof r!="string")return null;const l=r.trim();if(!l)return null;const i=l.toLowerCase();return i==="false"||i==="0"||i==="off"||i==="disabled"?null:l}function Ib(r){return r==="single"?"single":"multi"}function Gb(r){const l=r.trim();if(l.startsWith("["))try{const i=JSON.parse(l);return Array.isArray(i)?i.filter(Boolean):[]}catch{return[]}return l.split(/\s+/).filter(Boolean)}function Vb(){const r=Ob||{},l=typeof window<"u"&&window.ORBIT_CHAT_CONFIG||{},i=!!(typeof window<"u"&&window.ORBIT_CHAT_CONFIG);let c=od(Hb,r);return c=od(c,l),(!i||!c.auth.domain)&&(c.auth.domain="dev-3c4dpzhecz4gundm.us.auth0.com"),(!i||!c.auth.clientId)&&(c.auth.clientId="9JSe5xtoi5mLXRuov2K7FHYU10ojCQLH"),!i||c.auth.audience,!i||c.auth.provider,!i||c.auth.tenantId,(!i||c.auth.scopes.length===0)&&(c.auth.scopes=Gb("openid profile email User.Read")),c.outOfServiceMessage=Fb(c.outOfServiceMessage),c.agentMode.mode=Ib(c.agentMode.mode),c.agentMode.defaultAdapterId=typeof c.agentMode.defaultAdapterId=="string"?c.agentMode.defaultAdapterId.trim():"",c}const Se=Vb();function kt(){var l;const r=Se.adapters;if(Array.isArray(r)&&r.length>0){const i=(l=r[0].apiUrl)==null?void 0:l.trim();if(i)return i}return id}function Ta(r){const l=r==null?void 0:r.trim();return l&&l.length>0?l:kt()}function Xb(){const r=Se.adapters;return Array.isArray(r)&&r.length>0?r[0].id:"default-key"}function Yb(){return Se.agentMode.mode}function Xo(){return Yb()==="single"}function Sd(){if(!Xo())return null;const r=Se.agentMode.defaultAdapterId;return r&&Se.adapters.some(i=>{var c;return((c=i==null?void 0:i.id)==null?void 0:c.trim())===r})?r:null}function kd(){return Se.application.name}function _d(){return Se.application.description}function og(){return Se.application.inputPlaceholder}function Qb(r){var d;const l=r==null?void 0:r.trim();if(!l)return null;const i=Se.adapters.find(f=>{var h;return((h=f==null?void 0:f.id)==null?void 0:h.trim())===l});return((d=i==null?void 0:i.name)==null?void 0:d.trim())||null}function Zb(r){var d;const l=r==null?void 0:r.trim();if(!l)return null;const i=Se.adapters.find(f=>{var h;return((h=f==null?void 0:f.id)==null?void 0:h.trim())===l});return((d=i==null?void 0:i.inputPlaceholder)==null?void 0:d.trim())||null}function cg(){return Se.seo.siteUrl.trim()}function Kb(){return Array.isArray(Se.seo.alternateSiteUrls)?Se.seo.alternateSiteUrls.filter(r=>typeof r=="string").map(r=>r.trim()).filter(Boolean):[]}function Jb(){return Array.isArray(Se.seo.hostPatterns)?Se.seo.hostPatterns.filter(r=>typeof r=="string").map(r=>r.trim()).filter(Boolean):[]}function Pb(){return Se.seo.exposeAgentNotes}function Wb(){var l;return((l=Se.application.favicon)==null?void 0:l.trim())||$b}function ey(){return Se.features.enableUpload}function ty(){return Se.features.enableAudioOutput}function ay(){return Se.features.enableAudioInput}function vp(){return Se.features.enableFeedbackButtons}function ny(){return Se.features.enableConversationThreads}function ug(){return Se.features.enableAutocomplete}function ly(){return Math.max(1e3,Se.voice.silenceTimeoutMs)}function ry(){return Se.voice.recognitionLanguage}function sy(){const r=Sd();if(r)return r;const l=Se.adapters;if(Array.isArray(l)&&l.length>0)for(const i of l){const c=typeof(i==null?void 0:i.id)=="string"?i.id.trim():"";if(c)return c}return null}function iy(){return Se.outOfServiceMessage}function Ad(){return Se.auth.enabled}function Ea(){const{enabled:r,provider:l,domain:i,clientId:c,tenantId:d}=Se.auth;return!r||!c?!1:l==="entra"?!!d:!!i}function oy(){return Se.auth.domain}function dg(){return Se.auth.clientId}function cy(){return Se.auth.audience}function Yo(){return Se.auth.provider}function uy(){return Se.auth.tenantId}function Cd(){const r=Se.auth.scopes;return r.length>0?r:["openid","profile","email"]}function cd(){return Se.header.enabled}function dy(){return Se.header.logoUrl}function fy(){var l;return((l=Se.header.logoUrlLight)==null?void 0:l.trim())||qb}function my(){var l;return((l=Se.header.logoUrlDark)==null?void 0:l.trim())||Bb}function hy(){var r;return((r=Se.header.logoHeight)==null?void 0:r.trim())||""}function py(){var r;return((r=Se.header.logoWidth)==null?void 0:r.trim())||""}function gy(){return Se.header.bgColor}function xy(){return Se.header.textColor}function by(){return Se.header.showBorder}function fg(r){if(Array.isArray(r))return r;if(typeof r=="string")try{const l=JSON.parse(r);return Array.isArray(l)?l:[]}catch{return[]}return[]}function mg(){return fg(Se.header.navLinks)}function hg(){return Se.footer.enabled}function yy(){return Se.footer.text}function vy(){return Se.footer.bgColor}function wy(){return Se.footer.textColor}function Sy(){return Se.footer.showBorder}function ky(){return Se.footer.layout==="inline"?"inline":"stacked"}function _y(){return Se.footer.topPadding==="normal"?"normal":"large"}function Ay(){const r=Se.startupScripts;return Array.isArray(r)?r.filter(l=>!!(l&&typeof l=="object")).map(l=>{const i=typeof l.src=="string"?l.src.trim():"",c=typeof l.content=="string"?l.content.trim():"",d=typeof l.id=="string"?l.id.trim():"";return{...l,src:i||void 0,content:c||void 0,id:d||void 0}}).filter(l=>!!(l.src||l.content)):[]}function Cy(){return fg(Se.footer.navLinks)}const jd=()=>Se.debug.consoleDebug,ne=(...r)=>{jd()&&console.log(...r)},Fe=(...r)=>{jd()&&console.warn(...r)},Ie=(...r)=>{jd()&&console.error(...r)},Mt=(...r)=>{console.error(...r)};function wp({audio:r,audioFormat:l="mp3",autoPlay:i=!1,maxSizeMB:c=10}){const d=g.useRef(null),[f,h]=g.useState(!1),[p,x]=g.useState(0),[v,b]=g.useState(0),[w,k]=g.useState(!0),[S,_]=g.useState(null),[A,D]=g.useState(null);g.useEffect(()=>{if(!r)return;let V=null,I=!0;return(async()=>{try{k(!0),_(null),D(null);const _e=r.length*3/4/(1024*1024);if(_e>c)throw new Error(`Audio file too large (${_e.toFixed(1)}MB > ${c}MB limit)`);if(_e>2&&(D(`Large audio file (${_e.toFixed(1)}MB) - may take time to load`),ne("[AudioPlayer] Large audio file detected",{sizeMB:_e.toFixed(2)})),!/^[A-Za-z0-9+/=]+$/.test(r.replace(/\s/g,"")))throw new Error("Invalid base64 audio data");const te=atob(r),oe=new Uint8Array(te.length);for(let B=0;B<te.length;B++)oe[B]=te.charCodeAt(B);const E=l==="mp3"?"audio/mpeg":l==="wav"?"audio/wav":l==="ogg"?"audio/ogg":l==="opus"?"audio/opus":l==="webm"?"audio/webm":`audio/${l}`,Y=new Blob([oe],{type:E});if(V=URL.createObjectURL(Y),!I||!d.current){V&&URL.revokeObjectURL(V);return}d.current.src=V,k(!1),ne("[AudioPlayer] Audio loaded successfully",{format:l,mimeType:E,size:Y.size}),i&&d.current&&d.current.play().catch(B=>{Ie("[AudioPlayer] Auto-play failed:",B)})}catch(ue){Ie("[AudioPlayer] Failed to load audio:",ue),I&&(_("Failed to load audio"),k(!1))}})(),()=>{I=!1,V&&URL.revokeObjectURL(V)}},[r,l,i,c]);const O=()=>{d.current&&x(d.current.duration)},ee=()=>{d.current&&b(d.current.currentTime)},U=()=>h(!0),z=()=>h(!1),H=()=>{h(!1),b(0)},K=()=>{d.current&&(f?d.current.pause():d.current.play().catch(V=>{Ie("[AudioPlayer] Playback failed:",V),_("Playback failed")}))},j=V=>{if(!d.current)return;const I=parseFloat(V.target.value);d.current.currentTime=I,b(I)},q=V=>{if(!isFinite(V))return"0:00";const I=Math.floor(V/60),P=Math.floor(V%60);return`${I}:${P.toString().padStart(2,"0")}`};return S?u.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-700 dark:bg-red-900/20 dark:text-red-400",children:[u.jsx($o,{className:"h-4 w-4"}),u.jsx("span",{children:S})]}):u.jsxs("div",{className:"mt-3 flex flex-col gap-1",children:[A&&u.jsxs("div",{className:"text-xs text-amber-600 dark:text-amber-400 px-1",children:["⚠️ ",A]}),u.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-gray-300 bg-white px-3 py-2 dark:border-[#4a4b54] dark:bg-[#343541]",children:[u.jsx("audio",{ref:d,onLoadedMetadata:O,onTimeUpdate:ee,onPlay:U,onPause:z,onEnded:H}),u.jsx("button",{onClick:K,disabled:w,className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 disabled:opacity-50 dark:bg-[#4a4b54] dark:hover:bg-[#565869]",title:f?"Pause":"Play","aria-label":f?"Pause audio":"Play audio",children:w?u.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}):f?u.jsx(Wx,{className:"h-4 w-4 text-gray-700 dark:text-[#ececf1]"}):u.jsx(eb,{className:"h-4 w-4 text-gray-700 dark:text-[#ececf1]"})}),u.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[u.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:q(v)}),u.jsx("input",{type:"range",min:"0",max:p||0,value:v,onChange:j,disabled:w||!p,className:"flex-1 cursor-pointer accent-gray-600 dark:accent-[#bfc2cd]",style:{background:p?`linear-gradient(to right, rgb(75 85 99) 0%, rgb(75 85 99) ${v/p*100}%, rgb(229 231 235) ${v/p*100}%, rgb(229 231 235) 100%)`:"rgb(229 231 235)"}}),u.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:q(p)})]}),u.jsx($o,{className:"h-4 w-4 text-gray-500 dark:text-[#bfc2cd]"})]})]})}var Qo=Pp();function Sp({image:r,imageUrl:l,imageFormat:i="png",revisedPrompt:c}){const[d,f]=g.useState(!1),[h,p]=g.useState(!1),[x,v]=g.useState(null),b=g.useRef(null);g.useEffect(()=>{if(r||!l)return;let _=!1;return(async()=>{try{const A=typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null,D=await fetch(l,{headers:A?{"X-Adapter-Name":A}:{}});if(!D.ok){console.warn("[ImageDisplay] Server returned",D.status,"for",l);return}if(_)return;const O=await D.arrayBuffer();if(_)return;const ee=new Blob([O],{type:`image/${i}`}),U=URL.createObjectURL(ee);b.current=U,v(U)}catch(A){console.warn("[ImageDisplay] Failed to fetch image from",l,A)}})(),()=>{_=!0,b.current&&(URL.revokeObjectURL(b.current),b.current=null)}},[l,r,i]);const k=(r?`data:image/${i};base64,${r}`:null)??x;g.useEffect(()=>{if(!d)return;const _=A=>{A.key==="Escape"&&f(!1)};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[d]);const S=_=>{if(_.stopPropagation(),!k)return;const A=document.createElement("a");A.href=k,A.download=`generated-image.${i}`,A.click()};return k?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"generated-image-wrapper",style:{marginTop:"0.75rem"},children:[u.jsxs("div",{className:"generated-image-container",style:{position:"relative",display:"inline-block",cursor:"zoom-in",maxWidth:"100%"},onClick:()=>f(!0),title:c||"Generated image — click to enlarge",children:[u.jsx("img",{src:k,alt:c||"Generated image",style:{maxWidth:"100%",maxHeight:"480px",borderRadius:"8px",display:"block",objectFit:"contain"}}),u.jsxs("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[u.jsx("button",{onClick:S,title:"Download image",style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:u.jsx(bd,{size:14})}),u.jsx("button",{onClick:_=>{_.stopPropagation(),f(!0)},title:"View full size",style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:u.jsx(db,{size:14})})]})]}),c&&u.jsxs("div",{style:{marginTop:"8px",maxWidth:"480px"},children:[u.jsxs("button",{type:"button",onClick:()=>p(_=>!_),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:0,background:"transparent",border:"none",cursor:"pointer",fontSize:"0.75rem",fontWeight:500,opacity:.72},"aria-expanded":h,children:[h?u.jsx(Oo,{size:14}):u.jsx(fi,{size:14}),h?"Hide prompt":"Show prompt"]}),h&&u.jsxs("div",{style:{marginTop:"8px",padding:"8px 10px",background:"rgba(128,128,128,0.08)",borderRadius:"6px"},children:[u.jsx("span",{style:{display:"block",fontSize:"0.65rem",fontWeight:600,opacity:.5,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:"Prompt"}),u.jsx("span",{style:{fontSize:"0.8rem",lineHeight:1.45,opacity:.85},children:c})]})]})]}),d&&typeof document<"u"&&Qo.createPortal(u.jsxs("div",{onClick:()=>f(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.85)",zIndex:9999,overflow:"auto",padding:"56px 24px 24px"},children:[u.jsx("button",{onClick:_=>{_.stopPropagation(),f(!1)},style:{position:"fixed",top:"16px",right:"16px",background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"50%",padding:"8px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:u.jsx(ba,{size:20})}),u.jsx("img",{src:k,alt:c||"Generated image",style:{display:"block",width:"auto",height:"auto",maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 80px)",objectFit:"contain",borderRadius:"8px",margin:"0 auto"},onClick:_=>_.stopPropagation()})]}),document.body)]}):null}const Wu=[750,1500,3e3,5e3],jy=new Set([403,404,409,425,429,500,502,503,504]),Ny=r=>new Promise(l=>setTimeout(l,r));function kp({video:r,videoUrl:l,videoFormat:i="mp4",revisedPrompt:c,adapterName:d}){const[f,h]=g.useState(!1),[p,x]=g.useState(!1),[v,b]=g.useState(null),w=g.useRef(null);g.useEffect(()=>{if(r||!l)return;let A=!1;return(async()=>{try{const D=d||(typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null);let O=null;for(let H=0;H<=Wu.length&&(O=await fetch(l,{headers:D?{"X-Adapter-Name":D}:{}}),!(O.ok||!jy.has(O.status)||H===Wu.length));H+=1)if(await Ny(Wu[H]),A)return;if(!(O!=null&&O.ok)){console.warn("[VideoDisplay] Server returned",O.status,"for",l);return}if(A)return;const ee=await O.arrayBuffer();if(A)return;const U=new Blob([ee],{type:`video/${i}`}),z=URL.createObjectURL(U);w.current=z,b(z)}catch(D){console.warn("[VideoDisplay] Failed to fetch video from",l,D)}})(),()=>{A=!0,w.current&&(URL.revokeObjectURL(w.current),w.current=null)}},[l,r,i,d]);const S=(r?`data:video/${i};base64,${r}`:null)??v;g.useEffect(()=>{if(!f)return;const A=D=>{D.key==="Escape"&&h(!1)};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[f]);const _=A=>{if(A.stopPropagation(),!S)return;const D=document.createElement("a");D.href=S,D.download=`generated-video.${i}`,D.click()};return S?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"generated-video-wrapper",style:{marginTop:"0.75rem"},children:[u.jsxs("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%"},children:[u.jsx("video",{src:S,controls:!0,style:{maxWidth:"100%",maxHeight:"480px",borderRadius:"8px",display:"block",backgroundColor:"#000"}}),u.jsxs("div",{style:{position:"absolute",bottom:"48px",right:"8px",display:"flex",gap:"6px"},children:[u.jsx("button",{onClick:_,title:"Download video",style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:u.jsx(bd,{size:14})}),u.jsx("button",{onClick:A=>{A.stopPropagation(),h(!0)},title:"View full size",style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:u.jsx(Ix,{size:14})})]})]}),c&&u.jsxs("div",{style:{marginTop:"8px",maxWidth:"480px"},children:[u.jsxs("button",{type:"button",onClick:()=>x(A=>!A),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:0,background:"transparent",border:"none",cursor:"pointer",fontSize:"0.75rem",fontWeight:500,opacity:.72},"aria-expanded":p,children:[p?u.jsx(Oo,{size:14}):u.jsx(fi,{size:14}),p?"Hide prompt":"Show prompt"]}),p&&u.jsxs("div",{style:{marginTop:"8px",padding:"8px 10px",background:"rgba(128,128,128,0.08)",borderRadius:"6px"},children:[u.jsx("span",{style:{display:"block",fontSize:"0.65rem",fontWeight:600,opacity:.5,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:"Prompt"}),u.jsx("span",{style:{fontSize:"0.8rem",lineHeight:1.45,opacity:.85},children:c})]})]})]}),f&&u.jsxs("div",{onClick:()=>h(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.9)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},children:[u.jsx("button",{onClick:A=>{A.stopPropagation(),h(!1)},style:{position:"fixed",top:"16px",right:"16px",background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"50%",padding:"8px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:u.jsx(ba,{size:20})}),u.jsx("video",{src:S,controls:!0,autoPlay:!0,style:{maxWidth:"92vw",maxHeight:"92vh",borderRadius:"8px"},onClick:A=>A.stopPropagation()})]})]}):null}let qo=null;function pg(r){qo=r}function Zo(){qo=null}async function Nd(){if(!qo)return null;try{return await qo()}catch{return null}}let ud=!1,ci=null;const dd=new Set;function gg(){dd.forEach(r=>r())}function vn(){return ud}function Ty(){return ci}function Ko(r){ud!==r&&(ud=r,!r&&ci!==null&&(ci=null),gg())}function os(r){const l=typeof r=="string"&&r.trim().length>0?r.trim():null;ci!==l&&(ci=l,gg())}function Ey(r){return dd.add(r),()=>{dd.delete(r)}}const _p="orbitchat-guest-user-id";function ko(r){if(typeof r!="string")return null;const l=r.trim();return l.length>0?l:null}function My(r){const l=r.split(".");if(l.length<2)return null;try{const i=l[1].replace(/-/g,"+").replace(/_/g,"/"),c=i.padEnd(Math.ceil(i.length/4)*4,"="),d=atob(c);return JSON.parse(d)}catch{return null}}function zy(){const r=globalThis.crypto;if(r&&typeof r.randomUUID=="function")return`guest:orbitchat:${r.randomUUID()}`;if(!r||typeof r.getRandomValues!="function")throw new Error("Secure random number generation is unavailable");const l=new Uint8Array(16);return r.getRandomValues(l),`guest:orbitchat:${Array.from(l,c=>c.toString(16).padStart(2,"0")).join("")}`}function Dy(){if(typeof window>"u")return"guest:orbitchat:server";const r=window.localStorage.getItem(_p);if(r&&r.trim().length>0)return r;const l=zy();return window.localStorage.setItem(_p,l),l}async function xg(){const r=Ty();if(r)return r;const l=await Nd();if(l){const i=My(l),c=ko(i==null?void 0:i.sub)||ko(i==null?void 0:i.user_id)||ko(i==null?void 0:i.preferred_username)||ko(i==null?void 0:i.email);if(c)return c}return vn()?"authenticated:orbitchat:unknown":Dy()}const Ly={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",md:"text/markdown",csv:"text/csv"},Ap={pdf:"PDF",docx:"Word document",xlsx:"Excel workbook",pptx:"PowerPoint deck",md:"Markdown document",csv:"CSV file"},Ro=/[\uE000-\uF8FF]|\\[eE][0-9a-fA-F]{2,3}|\\[fF][0-8][0-9a-fA-F]{2,3}/,Ry=/((?:p\.)?generated-docx-preview-num-\d+-\d+:before\s*\{[^}]*?)content\s*:\s*"([^"]*)"\s*;([^}]*?\})/g;function Uy(r){var i;return Ro.test(r)?`•${((i=r.match(/(?:\\9|\t|\u00A0| )+$/))==null?void 0:i[0])||"\\9"}`:null}function Cp(r){Array.from(r.querySelectorAll("style")).forEach(c=>{const d=c.textContent;!d||!Ro.test(d)||(c.textContent=d.replace(Ry,(f,h,p,x)=>{const v=Uy(p);if(!v)return f;const b=x.replace(/\s*font-family\s*:\s*[^;{}]+;?/gi,"");return`${h}content: "${v}";${b}`}))}),Array.from(r.querySelectorAll('span[style*="font-family"]')).forEach(c=>{if(!/\b(symbol|wingdings|webdings)\b/i.test(c.style.fontFamily))return;const d=c.textContent||"";Ro.test(d)&&(c.textContent=d.replace(Ro,"•"),c.style.fontFamily="")})}function Oy(r){return(r||"pdf").toLowerCase().replace(/^\./,"")||"pdf"}function $y(r){const l=window.atob(r),i=new Uint8Array(l.length);for(let c=0;c<l.length;c+=1)i[c]=l.charCodeAt(c);return i.buffer}function qy(r){return r==="xlsx"||r==="csv"?u.jsx($x,{className:"h-5 w-5"}):r==="pptx"?u.jsx(ab,{className:"h-5 w-5"}):r==="md"?u.jsx(Ox,{className:"h-5 w-5"}):u.jsx(qx,{className:"h-5 w-5"})}function jp({document:r,documentUrl:l,documentFormat:i="pdf",revisedPrompt:c,adapterName:d}){const f=Oy(i),[h,p]=g.useState(r||l?"loading":"idle"),[x,v]=g.useState(null),[b,w]=g.useState(null),[k,S]=g.useState([]),[_,A]=g.useState(""),[D,O]=g.useState(null),[ee,U]=g.useState([]),[z,H]=g.useState(0),[K,j]=g.useState(!1),[q,V]=g.useState(null),I=g.useRef(null),P=g.useRef(null),ue=g.useRef(null),_e=c||Ap[f]||"Generated document",te=g.useMemo(()=>`generated-document.${f}`,[f]),oe=Ly[f]||"application/octet-stream";g.useEffect(()=>{if(!r&&!l)return;let re=!1;return(async()=>{p("loading"),V(null),S([]),A(""),O(null),U([]),H(0);try{const ge=r?$y(r):await(async()=>{const me=(d==null?void 0:d.trim())||(typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null),de={"X-User-ID":await xg()};me&&(de["X-Adapter-Name"]=me);const fe=await Nd();fe&&(de.Authorization=`Bearer ${fe}`);const ye=await fetch(l,{headers:de});if(!ye.ok)throw new Error(`Server returned ${ye.status}`);return ye.arrayBuffer()})();if(re)return;const pe=new Blob([ge],{type:oe}),G=URL.createObjectURL(pe);if(I.current&&URL.revokeObjectURL(I.current),I.current=G,v(G),w(ge.slice(0)),f==="xlsx"){const{default:me}=await Un(async()=>{const{default:ye}=await import("./index-CZz_ECqk.js");return{default:ye}},[]),fe=(await me(pe))[0];A((fe==null?void 0:fe.sheet)||"First sheet"),S(((fe==null?void 0:fe.data)||[]).slice(0,100).map(ye=>ye.slice(0,30).map(ae=>ae==null?"":String(ae))))}if(f==="md"&&O(new TextDecoder("utf-8").decode(ge)),f==="csv"){const me=new TextDecoder("utf-8").decode(ge),{default:de}=await Un(async()=>{const{default:ye}=await import("./papaparse.min-BWA-Odol.js").then(ae=>ae.p);return{default:ye}},__vite__mapDeps([16,1])),fe=de.parse(me,{skipEmptyLines:!0});H(fe.data.length),U(fe.data.slice(0,25))}p("ready")}catch(ge){if(re)return;console.warn("[DocumentDisplay] Failed to load document from",l,ge),V(ge instanceof Error?ge.message:"Unable to load document"),p("error")}})(),()=>{re=!0,I.current&&(URL.revokeObjectURL(I.current),I.current=null)}},[d,r,l,f,oe]),g.useEffect(()=>{if(h!=="ready"||f!=="docx"||!b||!P.current)return;const re=P.current;re.replaceChildren(),Un(()=>import("./docx-preview-CMb3nQfR.js"),__vite__mapDeps([17,1])).then(async({renderAsync:ce})=>{await ce(b.slice(0),re,void 0,{className:"generated-docx-preview",inWrapper:!1,ignoreWidth:!0,ignoreHeight:!0}),Cp(re)}).catch(ce=>{console.warn("[DocumentDisplay] Failed to render DOCX preview",ce),V("Unable to render document preview")})},[b,f,h]),g.useEffect(()=>{if(!K||f!=="docx"||!b||!ue.current)return;const re=ue.current;re.replaceChildren(),Un(()=>import("./docx-preview-CMb3nQfR.js"),__vite__mapDeps([17,1])).then(async({renderAsync:ce})=>{await ce(b.slice(0),re,void 0,{className:"generated-docx-preview",inWrapper:!1,ignoreWidth:!0,ignoreHeight:!0}),Cp(re)}).catch(ce=>{console.warn("[DocumentDisplay] Failed to render modal DOCX preview",ce)})},[b,f,K]),g.useEffect(()=>{if(!K)return;const re=ce=>{ce.key==="Escape"&&j(!1)};return window.document.addEventListener("keydown",re),()=>window.document.removeEventListener("keydown",re)},[K]);const E=re=>{if(re==null||re.stopPropagation(),!x)return;const ce=window.document.createElement("a");ce.href=x,ce.download=te,ce.click()},Y=h==="ready"&&(f==="pdf"||f==="docx"||f==="xlsx"||f==="md"||f==="csv"),B=Y&&f!=="xlsx"&&f!=="csv";return h==="idle"?null:u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"mt-3 max-w-full overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-[#3b3c49] dark:bg-[#202123]",children:[u.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 px-3 py-2.5 dark:border-[#3b3c49]",children:[u.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-300",children:qy(f)}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"truncate text-sm font-medium text-[#353740] dark:text-[#ececf1]",children:_e}),u.jsxs("p",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:[Ap[f]||`${f.toUpperCase()} document`,h==="loading"?" · Loading preview...":"",h==="error"?` · ${q||"Preview unavailable"}`:""]})]}),B&&u.jsx("button",{type:"button",onClick:()=>j(!0),className:"rounded-md p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-[#bfc2cd] dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:"Open preview","aria-label":"Open preview",children:u.jsx(Ux,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:E,disabled:!x,className:"rounded-md p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-[#bfc2cd] dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:"Download document","aria-label":"Download document",children:u.jsx(bd,{className:"h-4 w-4"})})]}),Y&&u.jsxs("div",{className:"max-h-[460px] overflow-auto bg-gray-50 dark:bg-[#171717]",children:[f==="pdf"&&x&&u.jsx("iframe",{src:x,title:_e,className:"block h-[460px] w-full border-0 bg-white"}),f==="docx"&&u.jsx("div",{ref:P,className:"min-h-[240px] bg-white p-5 text-sm text-[#111827] dark:bg-white dark:text-[#111827]"}),f==="xlsx"&&u.jsxs("div",{className:"p-3",children:[_&&u.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500 dark:text-[#bfc2cd]",children:_}),u.jsx("div",{className:"overflow-auto rounded-md border border-gray-200 bg-white dark:border-[#3b3c49] dark:bg-[#202123]",children:u.jsx("table",{className:"min-w-full border-collapse text-left text-xs",children:u.jsx("tbody",{children:k.length>0?k.map((re,ce)=>u.jsx("tr",{className:ce===0?"bg-gray-50 font-medium dark:bg-white/5":void 0,children:re.map((ge,pe)=>u.jsx("td",{className:"max-w-[220px] truncate border-b border-r border-gray-100 px-2 py-1.5 text-[#353740] dark:border-[#3b3c49] dark:text-[#ececf1]",children:ge},pe))},ce)):u.jsx("tr",{children:u.jsx("td",{className:"px-3 py-4 text-sm text-gray-500 dark:text-[#bfc2cd]",children:"No sheet data found."})})})})})]}),f==="md"&&D!==null&&u.jsx("div",{className:"bg-white p-5 text-sm text-[#111827] dark:bg-[#171717] dark:text-[#ececf1]",children:u.jsx(rl,{content:D,disableMath:!0})}),f==="csv"&&u.jsxs("div",{className:"p-3",children:[z>25&&u.jsxs("p",{className:"mb-2 text-xs text-gray-500 dark:text-[#bfc2cd]",children:["Showing first 25 of ",z," rows — download for the full file."]}),u.jsx("div",{className:"overflow-auto rounded-md border border-gray-200 bg-white dark:border-[#3b3c49] dark:bg-[#202123]",children:u.jsx("table",{className:"min-w-full border-collapse text-left text-xs",children:u.jsx("tbody",{children:ee.length>0?ee.map((re,ce)=>u.jsx("tr",{className:ce===0?"bg-gray-50 font-medium dark:bg-white/5":void 0,children:re.map((ge,pe)=>u.jsx("td",{className:"max-w-[220px] truncate border-b border-r border-gray-100 px-2 py-1.5 text-[#353740] dark:border-[#3b3c49] dark:text-[#ececf1]",children:ge},pe))},ce)):u.jsx("tr",{children:u.jsx("td",{className:"px-3 py-4 text-sm text-gray-500 dark:text-[#bfc2cd]",children:"No data found."})})})})})]})]}),h==="ready"&&!Y&&u.jsx("div",{className:"px-3 py-4 text-sm text-gray-600 dark:text-[#bfc2cd]",children:"Preview is not available for this format. Use download to open it locally."})]}),K&&x&&u.jsxs("div",{onClick:()=>j(!1),className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/85 p-4",children:[u.jsx("button",{onClick:re=>{re.stopPropagation(),j(!1)},className:"fixed right-4 top-4 flex items-center rounded-full border-0 bg-white/15 p-2 text-white",title:"Close preview","aria-label":"Close preview",children:u.jsx(ba,{className:"h-5 w-5"})}),u.jsxs("div",{onClick:re=>re.stopPropagation(),className:"h-[92vh] w-[92vw] overflow-auto rounded-lg bg-white",children:[f==="pdf"&&u.jsx("iframe",{src:x,title:_e,className:"h-full w-full border-0"}),f==="docx"&&u.jsx("div",{ref:ue,className:"min-h-full bg-white p-8 text-[#111827]"}),f==="md"&&D!==null&&u.jsx("div",{className:"min-h-full bg-white p-8 text-sm text-[#111827]",children:u.jsx(rl,{content:D,disableMath:!0})})]})]})]})}const By=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(",");function ui(r,{enabled:l,onEscape:i}){g.useEffect(()=>{if(!l||!r.current)return;const c=r.current,d=document.activeElement,f=Array.from(c.querySelectorAll(By)).filter(v=>v.tabIndex!==-1),h=f[0]||c,p=f[f.length-1]||c;h.focus({preventScroll:!0});const x=v=>{if(v.key==="Escape"){i==null||i();return}if(v.key!=="Tab")return;if(f.length===0){v.preventDefault(),c.focus({preventScroll:!0});return}const b=document.activeElement;if(v.shiftKey){(!b||b===h||!c.contains(b))&&(v.preventDefault(),p.focus({preventScroll:!0}));return}(!b||b===p||!c.contains(b))&&(v.preventDefault(),h.focus({preventScroll:!0}))};return document.addEventListener("keydown",x),()=>{var v;document.removeEventListener("keydown",x),(v=d==null?void 0:d.focus)==null||v.call(d,{preventScroll:!0})}},[l,i,r])}function Bo({isOpen:r,onClose:l,onConfirm:i,title:c,message:d,confirmText:f="Confirm",cancelText:h="Cancel",type:p="danger",isLoading:x=!1}){const v=g.useRef(null);if(ui(v,{enabled:r,onEscape:l}),!r)return null;const b=()=>{x||i()},k=(()=>{switch(p){case"danger":return{icon:"text-red-500",iconBg:"bg-red-100 dark:bg-red-900/20",confirmButton:"bg-red-600 hover:bg-red-700 focus:ring-red-500",border:"border-red-200 dark:border-red-800"};case"warning":return{icon:"text-amber-500",iconBg:"bg-amber-100 dark:bg-amber-900/20",confirmButton:"bg-amber-600 hover:bg-amber-700 focus:ring-amber-500",border:"border-amber-200 dark:border-amber-800"};default:return{icon:"text-blue-500",iconBg:"bg-blue-100 dark:bg-blue-900/20",confirmButton:"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500",border:"border-blue-200 dark:border-blue-800"}}})(),S=u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-black/60 p-4 backdrop-blur-sm animate-fadeIn",children:u.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-title",tabIndex:-1,className:"w-full max-w-md max-h-[calc(100vh-2rem)] overflow-y-auto rounded-2xl bg-white shadow-2xl transform animate-fadeIn dark:bg-[#1a1b1e]",children:[u.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-[#2d2f39]",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`w-10 h-10 rounded-full ${k.iconBg} flex items-center justify-center`,children:u.jsx(wd,{className:`w-5 h-5 ${k.icon}`})}),u.jsx("h2",{id:"confirm-title",className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:c})]}),u.jsx("button",{type:"button",onClick:l,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors","aria-label":"Close",children:u.jsx(ba,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),u.jsx("div",{className:"p-6",children:u.jsx("p",{className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:d})}),u.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200 dark:border-[#2d2f39] bg-gray-50 dark:bg-[#131416] rounded-b-2xl",children:[u.jsx("button",{type:"button",onClick:l,disabled:x,className:"px-4 py-3 md:py-2.5 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:h}),u.jsx("button",{type:"button",onClick:b,disabled:x,className:`px-4 py-3 md:py-2.5 text-white rounded-lg transition-all font-medium shadow-sm hover:shadow-md transform hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-800 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none ${k.confirmButton}`,children:x?u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Clearing..."]}):f})]})]})});return typeof document>"u"?S:Qo.createPortal(S,document.body)}const Hy=["#","*","`","[","]","(",")","{","}","|","<",">"],bg=r=>Hy.some(l=>r.includes(l));function yg(r){if(!r||r.length<1e3)return!1;const l=/^[A-Za-z0-9+/=]+$/,i=r.replace(/\s+/g,"");if(i.length>1e4&&l.test(i)){const c=/\b(the|and|for|are|but|not|you|all|can|function|const|let|var|class|return|import|export|async|await|if|else|while|true|false|null|undefined|http|https|www|error|data|response|request|api|json|xml|html|css|js|py|java|cpp|def|print|console|log)\b/i.test(r),d=bg(r),f=/[-.,;:!?'"()]/.test(r);if(!c&&!d&&!f)return!0}return!!(i.length>5e4&&l.test(i)&&r.replace(/[A-Za-z0-9+/=\s]/g,"").length<10)}const Fy=/(?:\u202F|\u2009|\u200A|\u200B|\u200C|\u200D|\uFEFF)/g;function rs(r){if(!r)return r;let l=r.replace(Fy," ");if(yg(l))return"";const i=/([A-Za-z0-9+/=]{10000,})/g;return l=l.replace(i,c=>{const d=c.replace(/\s+/g,"");if(d.length>1e4&&/^[A-Za-z0-9+/=]+$/.test(d)){const f=/\b(function|const|let|var|class|return|import|export|if|else|while|for|true|false|null|def|print)\b/i.test(c),h=bg(c),p=/[-.,;:!?'"()]/.test(c);if(!f&&!h&&!p)return""}return c}),l}function fd(r,l=5e4){return!r||r.length<=l?r:yg(r)?"":r.substring(0,l)+`
|
|
331
|
-
|
|
332
|
-
... (content truncated due to length)`}const Iy={maxFilesPerConversation:Se.limits.files.perConversation,maxFileSizeMB:Se.limits.files.maxSizeMB,maxTotalFiles:Se.limits.files.totalFiles,maxConversations:Se.limits.conversations.maxConversations,maxMessagesPerConversation:Se.limits.conversations.maxMessagesPerConversation,maxMessagesPerThread:Se.limits.conversations.maxMessagesPerThread,maxTotalMessages:Se.limits.conversations.totalMessages,maxMessageLength:Se.limits.messages.maxLength};function Gy(r){const l=Se.guestLimits;switch(r){case"maxConversations":return l.conversations.maxConversations;case"maxMessagesPerConversation":return l.conversations.messagesPerConversation;case"maxMessagesPerThread":return l.conversations.messagesPerThread;case"maxTotalMessages":return l.conversations.totalMessages;case"maxFilesPerConversation":return l.files.perConversation;case"maxTotalFiles":return l.files.totalFiles;case"maxMessageLength":return l.messages.maxLength;case"maxFileSizeMB":return l.files.maxSizeMB;default:return}}const ze=new Proxy(Iy,{get(r,l){if(Ea()&&!vn()){const i=Gy(l);if(i!==void 0)return i}return r[l]}});function us(){return g.useSyncExternalStore(Ey,vn,vn)}class vg extends Error{constructor(i,c){super(i);xa(this,"status");xa(this,"statusText");this.name="ApiRequestError",this.status=c.status,this.statusText=c.statusText}}async function Et(r={}){const l={"X-User-ID":await xg(),...r},i=await Nd();return i&&(l.Authorization=`Bearer ${i}`),l}function zn(r){return encodeURIComponent(r)}function Vy(r){return!r||r.length===0?"":`?file_ids=${r.map(encodeURIComponent).join(",")}`}async function ri(r){const l=`API request failed: ${r.status} ${r.statusText}`;try{if((r.headers.get("content-type")||"").includes("application/json")){const c=await r.json(),d=typeof c.detail=="string"&&c.detail.trim()||typeof c.error=="string"&&c.error.trim()||typeof c.message=="string"&&c.message.trim();if(d)return`${l}: ${d}`}else{const c=(await r.text()).trim();if(c)return`${l}: ${c}`}}catch{}return l}function Np(r){if(!r.startsWith("data: "))return null;try{const l=JSON.parse(r.substring(6));return l.request_id&&!l.response&&!l.done?{text:"",done:!1,request_id:l.request_id}:{text:l.text||l.content||l.message||l.response||"",done:l.done||!1,request_id:l.request_id,audio:l.audio,audioFormat:l.audio_format||l.audioFormat,audio_chunk:l.audio_chunk,chunk_index:l.chunk_index,image:l.image,image_format:l.image_format,image_revised_prompt:l.image_revised_prompt,image_url:l.image_url,video:l.video,video_format:l.video_format,video_revised_prompt:l.video_revised_prompt,video_url:l.video_url,document:l.document,document_format:l.document_format,document_revised_prompt:l.document_revised_prompt,document_url:l.document_url,assistant_message_id:l.assistant_message_id,threading:l.threading}}catch{return null}}let _o=null;function Xy(){let r=null,l=null;const i=(d,f,h)=>{r=f||null,l=h||null},c=(d,f)=>({async*streamChat(h,p,x,v,b,w,k,S,_,A,D,O,ee){var H,K;const U={messages:[{role:"user",content:h}],stream:p!==!1};x&&x.length>0&&(U.file_ids=x),v&&(U.thread_id=v),b&&(U.audio_input=b),w&&(U.audio_format=w),k&&(U.language=k),S!==void 0&&(U.return_audio=S),_&&(U.tts_voice=_),A&&(U.source_language=A),D&&(U.target_language=D),O&&(U.model=O),ee&&(U.skill=ee);const z=await fetch("/api/v1/chat",{method:"POST",headers:await Et({"Content-Type":"application/json","X-Adapter-Name":d,...f?{"X-Session-ID":f}:{}}),body:JSON.stringify(U)});if(!z.ok)throw new Error(await ri(z));if((H=z.headers.get("content-type"))!=null&&H.includes("text/event-stream")){const j=(K=z.body)==null?void 0:K.getReader(),q=new TextDecoder;let V="";if(!j)throw new Error("Response body is not readable");for(;;){const{done:I,value:P}=await j.read();if(I)break;V+=q.decode(P,{stream:!0});const ue=V.split(`
|
|
333
|
-
`);V=ue.pop()||"";for(const _e of ue){const te=Np(_e);te&&(yield te)}}if(V.trim())for(const I of V.split(`
|
|
334
|
-
`)){const P=Np(I);P&&(yield P)}}else{const j=await z.json();yield{text:j.message||j.response||"",done:!0,audio:j.audio,audioFormat:j.audio_format||j.audioFormat,image:j.image,image_format:j.image_format,image_revised_prompt:j.image_revised_prompt,image_url:j.image_url,video:j.video,video_format:j.video_format,video_revised_prompt:j.video_revised_prompt,video_url:j.video_url,document:j.document,document_format:j.document_format,document_revised_prompt:j.document_revised_prompt,document_url:j.document_url,assistant_message_id:j.assistant_message_id,threading:j.threading}}},async createThread(h,p){const x=await fetch("/api/threads",{method:"POST",headers:await Et({"Content-Type":"application/json","X-Adapter-Name":d,"X-Session-ID":p}),body:JSON.stringify({message_id:h,session_id:p})});if(!x.ok)throw new Error(`Failed to create thread: ${x.statusText}`);return x.json()},async getThreadInfo(h){const p=await fetch(`/api/threads/${zn(h)}`,{headers:await Et({"X-Adapter-Name":d})});if(!p.ok)throw new Error(`Failed to get thread info: ${p.statusText}`);return p.json()},async deleteThread(h){const p=await fetch(`/api/threads/${zn(h)}`,{method:"DELETE",headers:await Et({"X-Adapter-Name":d})});if(!p.ok)throw new Error(`Failed to delete thread: ${p.statusText}`);return p.json()},async submitFeedback(h,p,x){const v=await fetch("/api/feedback",{method:"POST",headers:await Et({"Content-Type":"application/json","X-Adapter-Name":d,"X-Session-ID":p}),body:JSON.stringify({message_id:h,session_id:p,feedback_type:x})});if(!v.ok)throw new Error(`Failed to submit feedback: ${v.statusText}`);return v.json()},async getSessionFeedback(h){const p=await fetch(`/api/feedback/${zn(h)}`,{headers:await Et({"X-Adapter-Name":d})});if(!p.ok)throw new Error(`Failed to get feedback: ${p.statusText}`);return p.json()},async clearConversationHistory(h){const p=h||f;if(!p)throw new Error("No session ID available for clearing conversation history");const x=await fetch(`/api/admin/chat-history/${zn(p)}`,{method:"DELETE",headers:await Et({"X-Adapter-Name":d})});if(!x.ok)throw new Error(`Failed to clear history: ${x.statusText}`);return x.json()},async getConversationHistory(h,p){const x=h||f;if(!x)throw new Error("No session ID available for conversation history");const v=typeof p=="number"&&Number.isFinite(p)&&p>0?`?limit=${Math.floor(p)}`:"",b=await fetch(`/api/admin/chat-history/${zn(x)}${v}`,{headers:await Et({"X-Adapter-Name":d})});if(!b.ok)throw new Error(`Failed to load history: ${b.statusText}`);return b.json()},async deleteConversationWithFiles(h,p){const x=h||f;if(!x)throw new Error("No session ID available for deleting conversation");const v=Vy(p),b=await fetch(`/api/admin/conversations/${zn(x)}${v}`,{method:"DELETE",headers:await Et({"X-Adapter-Name":d})});if(!b.ok)throw new Error(`Failed to delete conversation: ${b.statusText}`);return b.json()},getSessionId:()=>f,async uploadFile(h){const p=new FormData;p.append("file",h);const x=await fetch("/api/files/upload",{method:"POST",headers:await Et({"X-Adapter-Name":d}),body:p});if(!x.ok)throw new Error(`Failed to upload file: ${x.statusText}`);return x.json()},async listFiles(){const h=await fetch("/api/files",{headers:await Et({"X-Adapter-Name":d})});if(!h.ok)throw new Error(`Failed to list files: ${h.statusText}`);const p=await h.json();return Array.isArray(p)?p:p.files||[]},async getFileInfo(h){const p=await fetch(`/api/files/${zn(h)}`,{headers:await Et({"X-Adapter-Name":d})});if(!p.ok)throw new Error(`Failed to get file info: ${p.statusText}`);return p.json()},async queryFile(h,p,x){const v=await fetch(`/api/files/${zn(h)}/query`,{method:"POST",headers:await Et({"Content-Type":"application/json","X-Adapter-Name":d}),body:JSON.stringify({query:p,max_results:x})});if(!v.ok)throw new Error(`Failed to query file: ${v.statusText}`);return v.json()},async deleteFile(h){const p=await fetch(`/api/files/${zn(h)}`,{method:"DELETE",headers:await Et({"X-Adapter-Name":d})});if(!p.ok)throw new Error(`Failed to delete file: ${p.statusText}`);return p.json()},async validateApiKey(){const h=await fetch(`/api/admin/api-keys/${zn(d)}/status`,{headers:await Et({"X-Adapter-Name":d})});if(!h.ok)throw new Error(`Failed to validate API key: ${h.statusText}`);return h.json()},async getAdapterInfo(){const h="/api/admin/adapters/info",p=w=>{if(!w)return 0;const k=Number(w);if(Number.isFinite(k)&&k>0)return Math.min(k*1e3,3e4);const S=Date.parse(w);if(!Number.isNaN(S)){const _=S-Date.now();if(_>0)return Math.min(_,3e4)}return 0},x=w=>new Promise(k=>setTimeout(k,w)),v=async()=>fetch(h,{headers:await Et({"X-Adapter-Name":d})});let b=await v();if(b.status===429){const w=p(b.headers.get("Retry-After"));w>0&&(await x(w),b=await v())}if(!b.ok){const w=await b.text(),k=`${b.status} ${b.statusText}`.trim(),S=b.status===401?`Adapter info request was unauthorized for '${d}'. Verify the adapter exists and you have access.`:`Failed to load adapter info (${k}) for '${d}'.`;throw console.warn("[ProxyApi] Adapter info request failed",{adapter:d,status:b.status,statusText:b.statusText,details:w||void 0}),new vg(S,b)}return b.json()},async stopChat(h,p){const x=await fetch("/api/v1/chat/stop",{method:"POST",headers:await Et({"Content-Type":"application/json","X-Adapter-Name":d}),body:JSON.stringify({session_id:h,request_id:p})});return x.ok?(await x.json()).status==="cancelled":(console.warn(`[ProxyApi] stopChat failed: ${x.status} ${x.statusText}`),!1)},async getAdapterModels(h){const p=await fetch(`/api/admin/adapters/${encodeURIComponent(h)}/models`,{headers:await Et({"X-Adapter-Name":d})});if(!p.ok)throw new Error(await ri(p));return p.json()},async getAllModels(){const h=await fetch("/api/admin/models",{headers:await Et({"X-Adapter-Name":d})});if(!h.ok)throw new Error(await ri(h));return h.json()},async getAdapterSkills(h){const p=await fetch(`/api/admin/adapters/${encodeURIComponent(h)}/skills`,{headers:await Et({"X-Adapter-Name":d})});if(!p.ok)throw new Error(await ri(p));return p.json()},async getAllSkills(){const h=await fetch("/api/admin/skills",{headers:await Et({"X-Adapter-Name":d})});if(!h.ok)throw new Error(await ri(h));return h.json()}});return{configureApi:i,streamChat:async function*(d,f,h,p,x,v,b,w,k,S,_,A,D){if(!l)throw new Error("Adapter name is required");yield*c(l,r).streamChat(d,f,h,p,x,v,b,w,k,S,_,A,D)},stopChat:async(d,f)=>{if(!l)throw new Error("Adapter name is required");return c(l,r).stopChat(d,f)},ApiClient:class{constructor(f){xa(this,"client");const h=f.adapterName||null,p=f.sessionId||null;if(!h)throw new Error("Adapter name is required");this.client=c(h,p)}async*streamChat(...f){yield*this.client.streamChat(...f)}get createThread(){var f;return(f=this.client.createThread)==null?void 0:f.bind(this.client)}get getThreadInfo(){var f;return(f=this.client.getThreadInfo)==null?void 0:f.bind(this.client)}get deleteThread(){var f;return(f=this.client.deleteThread)==null?void 0:f.bind(this.client)}get submitFeedback(){var f;return(f=this.client.submitFeedback)==null?void 0:f.bind(this.client)}get getSessionFeedback(){var f;return(f=this.client.getSessionFeedback)==null?void 0:f.bind(this.client)}get clearConversationHistory(){var f;return(f=this.client.clearConversationHistory)==null?void 0:f.bind(this.client)}get getConversationHistory(){var f;return(f=this.client.getConversationHistory)==null?void 0:f.bind(this.client)}get deleteConversationWithFiles(){var f;return(f=this.client.deleteConversationWithFiles)==null?void 0:f.bind(this.client)}get getSessionId(){var f;return(f=this.client.getSessionId)==null?void 0:f.bind(this.client)}get uploadFile(){var f;return(f=this.client.uploadFile)==null?void 0:f.bind(this.client)}get listFiles(){var f;return(f=this.client.listFiles)==null?void 0:f.bind(this.client)}get getFileInfo(){var f;return(f=this.client.getFileInfo)==null?void 0:f.bind(this.client)}get queryFile(){var f;return(f=this.client.queryFile)==null?void 0:f.bind(this.client)}get deleteFile(){var f;return(f=this.client.deleteFile)==null?void 0:f.bind(this.client)}get validateApiKey(){var f;return(f=this.client.validateApiKey)==null?void 0:f.bind(this.client)}get getAdapterInfo(){var f;return(f=this.client.getAdapterInfo)==null?void 0:f.bind(this.client)}get stopChat(){var f;return(f=this.client.stopChat)==null?void 0:f.bind(this.client)}get getAdapterModels(){var f;return(f=this.client.getAdapterModels)==null?void 0:f.bind(this.client)}get getAllModels(){var f;return(f=this.client.getAllModels)==null?void 0:f.bind(this.client)}get getAdapterSkills(){var f;return(f=this.client.getAdapterSkills)==null?void 0:f.bind(this.client)}get getAllSkills(){var f;return(f=this.client.getAllSkills)==null?void 0:f.bind(this.client)}}}}async function Yy(){return _o||(ne("Loading API via Express proxy"),_o=Xy(),ne("API loaded successfully"),_o)}async function xt(){return await Yy()}class Tp{static async getAdapterSkills(l,i){const c=await xt(),d=new c.ApiClient({apiUrl:"",adapterName:i});return d.getAdapterSkills?(await d.getAdapterSkills(l)).available_skills:[]}static async getAllSkills(l){const i=await xt(),c=new i.ApiClient({apiUrl:"",adapterName:l});return c.getAllSkills?(await c.getAllSkills()).skills:[]}}const Qy=6e4;function wg(r={}){const{adapterName:l,enabled:i=!0,selectionScopeKey:c,supportsThreading:d=!1}=r,f=i&&!!l&&!d,h=c??l??"__default__",[p,x]=g.useState([]),[v,b]=g.useState(!1),[w,k]=g.useState(null),[S,_]=g.useState({}),A=g.useRef(null),D=g.useRef(new Map),O=g.useCallback(async H=>{var q,V;const K=H,j=D.current.get(K);if(j&&j.expiresAt>Date.now()){x(j.skills),k(H);return}A.current&&A.current.abort(),A.current=new AbortController,b(!0);try{const[I,P]=await Promise.all([Tp.getAdapterSkills(H,H),Tp.getAllSkills(H)]);if((q=A.current)!=null&&q.signal.aborted)return;const ue=P.filter(_e=>I.includes(_e.name)&&_e.enabled);D.current.set(K,{skills:ue,expiresAt:Date.now()+Qy}),x(ue),k(H),ne("[useSkills] Loaded",ue.length,"skills for adapter",H)}catch(I){if(I instanceof Error&&I.name==="AbortError")return;Fe("[useSkills] Failed to load skills:",I instanceof Error?I.message:String(I)),x([]),k(H)}finally{(V=A.current)!=null&&V.signal.aborted||b(!1)}},[]);g.useEffect(()=>{if(!f||!l)return;const H=window.setTimeout(()=>{O(l)},0);return()=>{var K;window.clearTimeout(H),(K=A.current)==null||K.abort()}},[f,l,O]);const ee=g.useCallback(H=>{_(K=>{const j=K[h]??null;if(j===H||(j==null?void 0:j.name)===(H==null?void 0:H.name))return K;const q={...K};return H?q[h]=H:delete q[h],q})},[h]),U=g.useCallback(()=>{_(H=>{if(!H[h])return H;const K={...H};return delete K[h],K})},[h]),z=f?S[h]??null:null;return{skills:f&&w===l?p:[],isLoading:f?v||w!==l:!1,selectedSkill:z,selectSkill:ee,clearSkill:U}}const Ep=r=>{let l;const i=new Set,c=(v,b)=>{const w=typeof v=="function"?v(l):v;if(!Object.is(w,l)){const k=l;l=b??(typeof w!="object"||w===null)?w:Object.assign({},l,w),i.forEach(S=>S(l,k))}},d=()=>l,p={setState:c,getState:d,getInitialState:()=>x,subscribe:v=>(i.add(v),()=>i.delete(v))},x=l=r(c,d,p);return p},Zy=(r=>r?Ep(r):Ep),Ky=r=>r;function Jy(r,l=Ky){const i=Rn.useSyncExternalStore(r.subscribe,Rn.useCallback(()=>l(r.getState()),[r,l]),Rn.useCallback(()=>l(r.getInitialState()),[r,l]));return Rn.useDebugValue(i),i}const Mp=r=>{const l=Zy(r),i=c=>Jy(l,c);return Object.assign(i,l),i},Sg=(r=>r?Mp(r):Mp),Ma=Sg(r=>({showLoginPrompt:!1,promptMessage:"",openLoginPrompt:l=>r({showLoginPrompt:!0,promptMessage:l}),closeLoginPrompt:()=>r({showLoginPrompt:!1,promptMessage:""})})),Ao=r=>{const l=r==null?void 0:r.trim();return l||(typeof window<"u"&&window.localStorage?localStorage.getItem("chat-adapter-name"):null)};class di{static async uploadFile(l,i,c,d,f){try{const h=ze.maxFileSizeMB*1024*1024;if(l.size>h)throw new Error(`File size exceeds maximum limit of ${ze.maxFileSizeMB}MB`);if(!(["application/pdf","text/plain","text/markdown","text/csv","application/json","text/html","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","application/vnd.ms-excel.sheet.macroEnabled.12","text/x-python","text/x-python-script","text/x-java-source","text/x-java","text/x-sql","text/javascript","application/javascript","text/typescript","application/typescript","text/x-c++src","text/x-csrc","text/x-c","text/x-go","text/x-rust","text/x-ruby","text/x-php","text/x-shellscript","text/x-sh","text/yaml","text/x-yaml","text/xml","application/xml","text/css","text/x-scss","text/x-sass","text/x-less","image/png","image/jpeg","image/tiff","image/webp","audio/wav","audio/mpeg","audio/mp3","audio/mp4","audio/ogg","audio/flac","audio/webm","audio/x-m4a","audio/aac","text/vtt"].includes(l.type)||/\.(pdf|txt|md|csv|json|html|docx|pptx|xlsx|py|java|sql|js|mjs|ts|tsx|cpp|cxx|cc|c|h|hpp|go|rs|rb|php|sh|bash|zsh|yaml|yml|xml|css|scss|sass|less|png|jpe?g|tiff?|webp|wav|mp3|mp4|ogg|flac|webm|m4a|aac|vtt)$/i.test(l.name)||(l.type==="application/x-zip-compressed"||l.type==="application/zip")&&/\.xlsx$/i.test(l.name)))throw new Error(`File type not supported: ${l.type||"unknown"}`);i&&i({filename:l.name,progress:0,status:"uploading"});const v=await xt(),b=(d==null?void 0:d.trim())||kt(),w=Ao(f);if(!w)throw new Error("Adapter not configured. Please select an adapter from the dropdown.");ne(`Using adapter: ${w}`);const k=new v.ApiClient({apiUrl:b,sessionId:null,adapterName:w});if(!k.uploadFile)throw new Error("File upload is not available.");const S=await k.uploadFile(l);i&&i({filename:l.name,progress:75,status:"processing",fileId:S.file_id});let _;try{_=await this.pollFileStatus(S.file_id,30,2e3,void 0,b,w)}catch(A){const D=A instanceof Error?A.message:String(A);if(D.includes("was deleted"))throw new Error(`File ${S.file_id} was deleted during upload`);Fe(`File status polling failed for ${S.file_id}:`,A);const O=D.includes("processing failed")||D.includes("timeout");_={file_id:S.file_id,filename:S.filename,mime_type:S.mime_type,file_size:S.file_size,processing_status:O?"failed":S.status||"processing",chunk_count:S.chunk_count,error_message:O?D:void 0}}return i&&i({filename:l.name,progress:100,status:_.processing_status==="completed"?"completed":"processing",fileId:S.file_id}),_}catch(h){let p=h instanceof Error?h.message:"Upload failed";throw p.includes("401")&&(p="Authentication failed. Please check your adapter configuration."),i&&i({filename:l.name,progress:0,status:"error",error:p}),new Error(p)}}static async uploadFiles(l,i){const d=[],f=[];for(let h=0;h<l.length;h+=3){const p=l.slice(h,h+3),x=await Promise.allSettled(p.map(async(v,b)=>{const w=h+b;return this.uploadFile(v,k=>{i&&i(w,k)})}));for(let v=0;v<x.length;v++){const b=x[v],w=h+v;b.status==="fulfilled"?d.push(b.value):(Mt(`Failed to upload file ${l[w].name}:`,b.reason),f.push({index:w,file:l[w].name,error:b.reason}))}}if(d.length===0&&f.length>0){const h=f[0].error;throw h instanceof Error?h:new Error(`All ${f.length} file uploads failed`)}return f.length>0&&Fe(`[FileUploadService] ${f.length} of ${l.length} files failed to upload:`,f.map(h=>h.file)),d}static async listFiles(l,i,c){try{const d=await xt(),f=(i==null?void 0:i.trim())||kt(),h=Ao(c);if(!h)throw new Error("Adapter not configured");const p=new d.ApiClient({apiUrl:f,sessionId:null,adapterName:h});if(!p.listFiles)throw new Error("File listing is not available.");const x=await p.listFiles();return(Array.isArray(x)?x:Array.isArray(x.files)?x.files:[]).map(b=>({file_id:b.file_id,filename:b.filename,mime_type:b.mime_type,file_size:b.file_size,upload_timestamp:b.upload_timestamp,processing_status:b.processing_status,chunk_count:b.chunk_count,error_message:b.error_message}))}catch(d){Mt("Failed to list files:",d);const f=d instanceof Error?d.message:"Failed to list files";throw new Error(f)}}static async getFileInfo(l,i,c,d){try{const f=await xt(),h=(c==null?void 0:c.trim())||kt(),p=Ao(d);if(!p)throw new Error("Adapter not configured");const x=new f.ApiClient({apiUrl:h,sessionId:null,adapterName:p});if(!x.getFileInfo)throw new Error("File info retrieval is not available.");const v=await x.getFileInfo(l);return{file_id:v.file_id,filename:v.filename,mime_type:v.mime_type,file_size:v.file_size,upload_timestamp:v.upload_timestamp,processing_status:v.processing_status,chunk_count:v.chunk_count,error_message:v.error_message}}catch(f){if(f instanceof Error&&(f.message.includes("404")||f.message.includes("File not found")))throw new Error(`File ${l} was deleted`);Mt(`Failed to get file info for ${l}:`,f);const h=f instanceof Error?f.message:`Failed to get file info: ${l}`;throw new Error(h)}}static async pollFileStatus(l,i=30,c=2e3,d,f,h){for(let p=0;p<i;p++)try{if(d&&!d())throw new Error("Polling cancelled - component unmounted");const x=await this.getFileInfo(l,void 0,f,h);if(x.processing_status==="completed")return x;if(x.processing_status==="error"||x.processing_status==="failed"){const v=x.error_message;throw new Error(v||`File processing failed for ${l}`)}p<i-1&&await new Promise(v=>setTimeout(v,c))}catch(x){const v=x instanceof Error?x.message:String(x);if(v.includes("404")||v.includes("File not found")||v.includes("was deleted"))throw new Error(`File ${l} was deleted during upload`);if(v.includes("component unmounted")||v.includes("processing failed")||v.includes("processing_status")||v.includes("401")||v.includes("403")||v.includes("500")||v.includes("502")||v.includes("503")||v.includes("Authentication")||v.includes("Adapter not configured"))throw x;if(p<i-1){await new Promise(b=>setTimeout(b,c));continue}throw x}throw new Error(`File processing timeout: ${l} did not complete within ${i*c/1e3} seconds`)}static async deleteFile(l,i,c,d){try{const f=await xt(),h=(c==null?void 0:c.trim())||kt(),p=Ao(d);if(!p)throw new Error("Adapter not configured");const x=new f.ApiClient({apiUrl:h,sessionId:null,adapterName:p});if(!x.deleteFile)throw new Error("File deletion is not available.");return await x.deleteFile(l)}catch(f){if(f instanceof Error&&(f.message.includes("404")||f.message.includes("File not found")||f.message.includes("Not Found")))return ne(`File ${l} was already deleted from server`),{message:"File already deleted",file_id:l};Mt(`Failed to delete file ${l}:`,f);const h=f instanceof Error?f.message:`Failed to delete file: ${l}`;throw new Error(h)}}}class Py{constructor(){xa(this,"audioQueue",[]);xa(this,"isPlaying",!1);xa(this,"currentAudio",null);xa(this,"audioContext",null);xa(this,"isEnabled",!1);xa(this,"onPlaybackStart",null);xa(this,"onPlaybackEnd",null);xa(this,"mimeTypeCache",new Map);xa(this,"onChunkPlayed",null);xa(this,"blobUrls",[]);xa(this,"suppressPlaybackErrors",!1)}async enableAudio(){var l,i;try{if(!this.audioContext){const f=typeof AudioContext<"u"?AudioContext:typeof window<"u"&&window.webkitAudioContext||null;f&&(this.audioContext=new f)}const c=((l=this.audioContext)==null?void 0:l.state)==="suspended"?this.audioContext.resume():Promise.resolve();let d=Promise.resolve();try{const f=this.createSilentWavBlob(),h=URL.createObjectURL(f),p=new Audio;p.setAttribute("playsinline",""),p.setAttribute("webkit-playsinline",""),p.src=h,p.volume=0,d=p.play().then(()=>{p.pause()}).catch(()=>{ne("[AudioStreamManager] HTMLAudioElement silent unlock failed (will retry on next gesture)")}).finally(()=>{URL.revokeObjectURL(h)})}catch{ne("[AudioStreamManager] Could not create silent audio element")}if(await c,this.audioContext&&this.audioContext.state==="running"){const f=this.audioContext.createBuffer(1,1,22050),h=this.audioContext.createBufferSource();h.buffer=f,h.connect(this.audioContext.destination),h.start(0)}return await d,this.isEnabled=!0,ne("[AudioStreamManager] Audio playback enabled",{audioContextState:(i=this.audioContext)==null?void 0:i.state}),!0}catch(c){return Ie("[AudioStreamManager] Failed to enable audio:",c),!1}}createSilentWavBlob(){const h=new ArrayBuffer(844),p=new DataView(h),x=(v,b)=>{for(let w=0;w<b.length;w++)p.setUint8(v+w,b.charCodeAt(w))};return x(0,"RIFF"),p.setUint32(4,836,!0),x(8,"WAVE"),x(12,"fmt "),p.setUint32(16,16,!0),p.setUint16(20,1,!0),p.setUint16(22,1,!0),p.setUint32(24,8e3,!0),p.setUint32(28,8e3*2,!0),p.setUint16(32,2,!0),p.setUint16(34,16,!0),x(36,"data"),p.setUint32(40,800,!0),new Blob([h],{type:"audio/wav"})}disableAudio(){!this.isEnabled&&!this.isPlaying||(this.isEnabled=!1,this.stop(),ne("[AudioStreamManager] Audio playback disabled"))}async ensureAudioContext(){var l;if(!this.audioContext){const i=typeof AudioContext<"u"?AudioContext:typeof window<"u"&&window.webkitAudioContext||null;if(i)try{this.audioContext=new i}catch(c){return Ie("[AudioStreamManager] Failed to create AudioContext:",c),!1}}if(((l=this.audioContext)==null?void 0:l.state)==="suspended")try{await this.audioContext.resume()}catch(i){return ne("[AudioStreamManager] AudioContext resume deferred",i),!1}return!0}resolveMimeType(l){const i=this.mimeTypeCache.get(l);if(i)return i;let c;switch(l){case"mp3":c="audio/mpeg";break;case"wav":c="audio/wav";break;case"webm":c="audio/webm";break;case"ogg":c="audio/ogg";break;case"opus":{const d=typeof document<"u"?document.createElement("audio"):null;d!=null&&d.canPlayType("audio/ogg; codecs=opus")?c="audio/ogg; codecs=opus":d!=null&&d.canPlayType("audio/webm; codecs=opus")?c="audio/webm; codecs=opus":c="audio/mp4";break}default:c=`audio/${l}`}return this.mimeTypeCache.set(l,c),ne(`[AudioStreamManager] Resolved MIME type for "${l}": ${c}`),c}isAudioEnabled(){return this.isEnabled}setOnPlaybackStart(l){this.onPlaybackStart=l}setOnPlaybackEnd(l){this.onPlaybackEnd=l}setOnChunkPlayed(l){this.onChunkPlayed=l}async addChunk(l){if(!this.isEnabled){ne(`[AudioStreamManager] Audio disabled, dropping chunk ${l.chunkIndex}`);return}ne(`[AudioStreamManager] Adding chunk ${l.chunkIndex} to queue`),this.audioQueue.push(l),this.audioQueue.sort((i,c)=>i.chunkIndex-c.chunkIndex),this.isPlaying||this.playNextChunk().catch(i=>{Ie("[AudioStreamManager] Playback chain error:",i)})}async playNextChunk(){var i,c;if(this.audioQueue.length===0){this.isPlaying=!1,ne("[AudioStreamManager] Queue empty, playback complete"),this.onPlaybackEnd&&this.onPlaybackEnd();return}if(!this.isEnabled){ne("[AudioStreamManager] Audio not enabled, skipping playback"),this.audioQueue=[],this.isPlaying=!1;return}this.suppressPlaybackErrors=!1,await this.ensureAudioContext(),this.isPlaying=!0;const l=this.audioQueue.shift();try{if(!this.isPlaying)return;if(this.onPlaybackStart&&l.chunkIndex===0&&this.onPlaybackStart(),ne(`[AudioStreamManager] Playing chunk ${l.chunkIndex}`),!l.audio||l.audio.length===0)throw new Error(`Empty audio data for chunk ${l.chunkIndex}`);let d;try{d=atob(l.audio)}catch(w){throw new Error(`Failed to decode base64 audio for chunk ${l.chunkIndex}: ${w instanceof Error?w.message:String(w)}`)}if(d.length===0)throw new Error(`Decoded audio data is empty for chunk ${l.chunkIndex}`);const f=new Uint8Array(d.length);for(let w=0;w<d.length;w++)f[w]=d.charCodeAt(w);const h=this.resolveMimeType(l.audioFormat),p=new Blob([f],{type:h}),x=URL.createObjectURL(p);this.blobUrls.push(x);const v=()=>{if(this.currentAudio){try{this.currentAudio.pause()}catch{}this.currentAudio.removeAttribute("src"),this.currentAudio.load()}URL.revokeObjectURL(x),this.blobUrls=this.blobUrls.filter(w=>w!==x)};let b=!1;try{b=await this.playViaAudioElement(x,l,h,v)}catch{b=!1}if(!b&&!this.suppressPlaybackErrors&&this.audioContext){ne(`[AudioStreamManager] HTMLAudioElement failed for chunk ${l.chunkIndex}, trying AudioContext fallback`);try{b=await this.playViaAudioContext(f.buffer,l.chunkIndex)}catch(w){Ie(`[AudioStreamManager] AudioContext fallback also failed for chunk ${l.chunkIndex}:`,w)}v()}this.currentAudio=null,this.playNextChunk().catch(w=>{Ie("[AudioStreamManager] Playback chain error:",w)})}catch(d){if(this.suppressPlaybackErrors){ne("[AudioStreamManager] Playback stopped, suppressing audio error");return}const f=d instanceof Error?d.message:String(d);console.error(`[AudioStreamManager] Failed to play chunk ${l.chunkIndex}:`,f,d,{audioFormat:l.audioFormat,chunkIndex:l.chunkIndex,audioLength:(i=l.audio)==null?void 0:i.length,audioContextState:(c=this.audioContext)==null?void 0:c.state,isEnabled:this.isEnabled}),Ie(`[AudioStreamManager] Failed to play chunk ${l.chunkIndex}:`,d),this.playNextChunk().catch(h=>{Ie("[AudioStreamManager] Playback chain error after recovery:",h)})}}playViaAudioElement(l,i,c,d){return new Promise(f=>{const h=new Audio;h.setAttribute("playsinline",""),h.setAttribute("webkit-playsinline",""),h.src=l,this.currentAudio=h;let p=!1;const x=w=>{p||(p=!0,f(w))},v=()=>{if(this.suppressPlaybackErrors){d(),x(!0);return}const w=h.error;Ie(`[AudioStreamManager] Media error on chunk ${i.chunkIndex}:`,w?{code:w.code,message:w.message,SRC_NOT_SUPPORTED:w.code===MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED}:"unknown"),d(),x(!1)};h.addEventListener("error",v,{once:!0});const b=async()=>{if(!p)try{h.addEventListener("ended",()=>{p||(ne(`[AudioStreamManager] Chunk ${i.chunkIndex} finished`),this.onChunkPlayed&&this.onChunkPlayed(i.chunkIndex),d(),x(!0))},{once:!0}),await h.play()}catch(w){if(this.suppressPlaybackErrors){d(),x(!0);return}ne(`[AudioStreamManager] audio.play() rejected for chunk ${i.chunkIndex}:`,w),d(),x(!1)}};h.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?b():h.addEventListener("canplay",()=>b(),{once:!0})})}playViaAudioContext(l,i){return new Promise((c,d)=>{if(!this.audioContext){d(new Error("No AudioContext"));return}const f=l.slice(0);this.audioContext.decodeAudioData(f,h=>{if(!this.audioContext||this.suppressPlaybackErrors){c(!0);return}const p=this.audioContext.createBufferSource();p.buffer=h,p.connect(this.audioContext.destination),p.onended=()=>{ne(`[AudioStreamManager] Chunk ${i} finished (AudioContext path)`),this.onChunkPlayed&&this.onChunkPlayed(i),c(!0)},p.start(0)},h=>{d(h)})})}stop(){ne("[AudioStreamManager] Stopping playback"),this.suppressPlaybackErrors=!0,this.isPlaying=!1,this.audioQueue=[],this.currentAudio&&(this.currentAudio.pause(),this.currentAudio.src="",this.currentAudio=null),this.blobUrls.forEach(l=>URL.revokeObjectURL(l)),this.blobUrls=[]}reset(){this.stop(),ne("[AudioStreamManager] Manager reset")}getQueueSize(){return this.audioQueue.length}isCurrentlyPlaying(){return this.isPlaying}}const ql=new Py,Wy=sy()||Xb(),kg=()=>{if(Xo())return Sd()||void 0},oi=(r,l,i)=>({id:r,sessionId:l,title:"New Chat",messages:[],createdAt:new Date,updatedAt:new Date,apiUrl:i,adapterName:kg(),adapterLoadError:null}),Ho=()=>{const r=localStorage.getItem("chatbot-session-id");if(r)return r;const l=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return localStorage.setItem("chatbot-session-id",l),l},ev=r=>{localStorage.setItem("chatbot-session-id",r)};let tv=0;const ss=r=>{const l=Date.now(),i=++tv,c=Math.random().toString(36).substr(2,9);return`msg_${l}_${i}_${c}_${r}`},Bl=()=>{const r=Date.now(),l=Math.random().toString(36).substr(2,9);return`session_${r}_${l}`},_g=r=>{const l=new Set;let i=!1;const c=r.map(d=>{if(!l.has(d.id))return l.add(d.id),d;i=!0;const f={...d,id:ss(d.role)};return l.add(f.id),Fe(`[chatStore] Re-keyed duplicate message id ${d.id}`),f});return i?c:r},zp=r=>r.filter(l=>!l.isThreadMessage&&!(l.role==="assistant"&&l.isStreaming)).length,Dp=r=>r.flatMap(i=>[i.imageUrl,i.videoUrl,i.documentUrl]).map(i=>{var c;return((c=i==null?void 0:i.match(/\/api\/files\/([^/]+)\/content/))==null?void 0:c[1])??null}).filter(i=>i!==null),av=(r,l)=>{if(r instanceof Date)return new Date(r);if(typeof r=="number"&&Number.isFinite(r)){const i=new Date(r);if(!Number.isNaN(i.getTime()))return i}if(typeof r=="string"){const i=new Date(r);if(!Number.isNaN(i.getTime()))return i}return l?new Date(l):new Date},nv=(r,l)=>{const i=new Map;l.forEach((d,f)=>{d.databaseMessageId&&i.set(d.databaseMessageId,{message:d,index:f})});const c=new Set;return r.map((d,f)=>{var w;const h=d.role==="user"?"user":"assistant",p=typeof d.message_id=="string"&&d.message_id.length>0?d.message_id:void 0;let x;if(p&&i.has(p)){const k=i.get(p);x=k.message,c.add(k.index)}else{const k=f<l.length?f:0;if(!c.has(k)&&((w=l[k])==null?void 0:w.role)===h)x=l[k],c.add(k);else for(let S=1;S<l.length;S++){const _=(k+S)%l.length;if(!c.has(_)&&l[_].role===h){x=l[_],c.add(_);break}}}const v=d.timestamp?av(d.timestamp,x==null?void 0:x.timestamp):x!=null&&x.timestamp?new Date(x.timestamp):new Date,b=x?{...x,content:d.content??x.content,timestamp:v}:{id:p?`srv_${p}`:ss(h),content:d.content||"",role:h,timestamp:v};if(b.isStreaming=!1,p&&(b.databaseMessageId=p),!b.supportsThreading&&d.metadata&&typeof d.metadata=="object"){const k=d.metadata,S=k==null?void 0:k.retrieved_docs;Array.isArray(S)&&S.length>0&&(b.supportsThreading=!0)}return b})},lv=(r,l)=>{if(r.length!==l.length)return!1;for(let i=0;i<r.length;i++){const c=r[i],d=l[i];if(c.role!==d.role||c.content!==d.content||(c.databaseMessageId||null)!==(d.databaseMessageId||null)||+c.timestamp!=+d.timestamp)return!1}return!0},ed=r=>{var d,f,h,p,x,v;const l=((f=(d=r.adapterInfo)==null?void 0:d.adapter_name)==null?void 0:f.includes("voice"))||((p=(h=r.adapterInfo)==null?void 0:h.adapter_name)==null?void 0:p.includes("audio"))||((v=(x=r.adapterInfo)==null?void 0:x.adapter_name)==null?void 0:v.includes("multilingual"));let i=!1;try{const b=localStorage.getItem("chat-settings");b&&(i=JSON.parse(b).voiceEnabled===!0)}catch{Fe("Failed to read global voice setting")}const c=r.audioSettings;return{returnAudio:(c==null?void 0:c.enabled)??i??!!l,ttsVoice:(c==null?void 0:c.ttsVoice)||void 0,language:(c==null?void 0:c.language)||"en-US",audioFormat:c==null?void 0:c.audioFormat}},rv=300;let Co=null;const sa=r=>{Co&&clearTimeout(Co),Co=setTimeout(()=>{Co=null;try{const l=r(),i=l.conversations.map(c=>({...c,messages:c.messages.map(d=>d.audio||d.image||d.video||d.document?Object.fromEntries(Object.entries(d).filter(([h])=>h!=="audio"&&h!=="image"&&h!=="video"&&h!=="document")):d)}));localStorage.setItem("chat-state",JSON.stringify({conversations:i,currentConversationId:l.currentConversationId}))}catch(l){l instanceof DOMException&&l.name==="QuotaExceededError"?Fe("[chatStore] localStorage quota exceeded — skipping save"):Mt("[chatStore] Failed to save state to localStorage:",l)}},rv)},sv=32,is=new Map;let Dn=null,ra=null,yn=null,ll=null;const jo=(r,l)=>{const i=is.get(r);if(i){if(i.timeoutId&&(clearTimeout(i.timeoutId),i.timeoutId=null),i.content){const c=i.content;i.content="",l(d=>({conversations:d.conversations.map(f=>{if(f.id!==r)return f;const h=[...f.messages],p=h[h.length-1];return p&&p.role==="assistant"&&p.isStreaming&&(h[h.length-1]={...p,content:p.content+c}),{...f,messages:h,updatedAt:new Date}})}))}is.delete(r)}},rn=(r,l,i)=>({conversations:r.conversations.map(c=>{var h;if(c.id!==l)return c;const d=[...c.messages],f=d.length-1;return((h=d[f])==null?void 0:h.role)==="assistant"&&(d[f]={...d[f],...i(d[f])}),{...c,messages:d,updatedAt:new Date}})});let Fo=!1,Io="";async function si(){if(Fo&&Io)return!0;try{const r=await xt(),l=localStorage.getItem("chat-api-url");l&&l===id&&localStorage.removeItem("chat-api-url");const i=l&&l!==id?l:kt(),c=Ho(),d=localStorage.getItem("chat-adapter-name")||Wy;return r.configureApi(i,c,d),Io=i,Fo=!0,!0}catch(r){return Mt("Failed to configure API:",r),!1}}const Ye=Sg((r,l)=>({conversations:[],currentConversationId:null,isLoading:!1,error:null,sessionId:Ho(),getSessionId:()=>l().sessionId,configureApiSettings:async(i,c,d)=>{const f=l(),h=f.conversations.find(x=>x.id===f.currentConversationId),p=(h==null?void 0:h.sessionId)||c||Ho();c&&ev(c),r({sessionId:p});try{const x=await xt();if(!d||!d.trim())throw new Error("Adapter name is required");x.configureApi(i,p,d),Io=i,Fo=!0;let v;try{const b=new x.ApiClient({apiUrl:i,sessionId:null,adapterName:d});typeof b.getAdapterInfo=="function"&&(v=await b.getAdapterInfo(),ne("Adapter info loaded:",v))}catch(b){Fe("Failed to load adapter info:",b)}if(h)r(b=>({conversations:b.conversations.map(w=>w.id===h.id?{...w,adapterName:d,apiUrl:i,adapterInfo:v,adapterLoadError:null,updatedAt:new Date}:w)}));else if(d&&d.trim()){const b=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,w=Bl();r(k=>({conversations:[...k.conversations,{id:b,sessionId:w,title:"New Conversation",messages:[],createdAt:new Date,updatedAt:new Date,adapterName:d,apiUrl:i,adapterInfo:v,adapterLoadError:null}],currentConversationId:b}))}}catch(x){throw Ie("Failed to configure API:",x),r({isLoading:!1}),x instanceof Error?x:new Error("Failed to configure API settings")}d?localStorage.setItem("chat-adapter-name",d):localStorage.removeItem("chat-adapter-name"),r({isLoading:!1})},createConversation:()=>{var b;const i=l(),c=ze.maxConversations,d=i.conversations.length,f=i.currentConversationId?i.conversations.find(w=>w.id===i.currentConversationId):null;if(c!==null&&d>=c){if(Ea()&&!vn()){const k=`You've reached the guest limit of ${c} conversation${c===1?"":"s"}. Sign in to unlock more conversations, or delete conversations to start over.`;throw r({error:k}),Ma.getState().openLoginPrompt(k),new Error("Guest conversation limit reached")}const w=`Maximum of ${c} conversations reached. Please delete an existing conversation before starting a new one.`;throw r({error:w}),new Error(w)}const h=!!f&&(f.messages.length>0||(((b=f.attachedFiles)==null?void 0:b.length)||0)>0);if(f&&!h){const w="Finish or delete the current conversation before starting a new one.";throw r({error:w}),new Error(w)}const p=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,x=Bl(),v={id:p,sessionId:x,title:"New Chat",messages:[],createdAt:new Date,updatedAt:new Date,apiUrl:kt(),adapterName:kg(),adapterLoadError:null};return r(w=>({conversations:[v,...w.conversations],currentConversationId:p,sessionId:x,isLoading:!1})),sa(l),p},selectConversation:async i=>{const c=l().conversations.find(d=>d.id===i);if(c){const d=c.messages.some(x=>x.role==="assistant"&&x.isStreaming);r({currentConversationId:i,sessionId:c.sessionId,isLoading:d});const f=c.apiUrl||kt(),h=c.adapterName;if(await si()&&h){const x=await xt();if(x.configureApi(f,c.sessionId,h),!c.adapterInfo)try{const v=new x.ApiClient({apiUrl:f,sessionId:null,adapterName:h});if(typeof v.getAdapterInfo=="function"){const b=await v.getAdapterInfo();ne("Adapter info loaded for conversation:",b),r(w=>({conversations:w.conversations.map(k=>k.id===i?{...k,adapterInfo:b,adapterLoadError:null,updatedAt:new Date}:k)})),sa(l)}}catch(v){Fe("Failed to load adapter info for conversation:",v)}}l().loadFeedbackForConversation(c.sessionId).catch(()=>{})}sa(l)},deleteConversation:async i=>{var f,h;const c=l(),d=c.conversations.find(p=>p.id===i);if(ne(`🗑️ Deleting conversation ${i}:`,{conversationId:i,sessionId:d==null?void 0:d.sessionId,title:d==null?void 0:d.title,messageCount:d==null?void 0:d.messages.length,fileCount:((f=d==null?void 0:d.attachedFiles)==null?void 0:f.length)||0}),c.currentConversationId===i&&ql.stop(),d!=null&&d.sessionId)try{if(!await si())Mt("Failed to configure API for conversation deletion");else{const x=d.apiUrl||kt(),v=d.adapterName;v?ne(`Using conversation's adapter for deletion: ${v} (conversation: ${i})`):Fe(`Skipping server deletion for conversation ${i}: adapter not configured`);const b=await xt(),w=new b.ApiClient({apiUrl:x,sessionId:d.sessionId,adapterName:v}),k=((h=d.attachedFiles)==null?void 0:h.map(A=>A.file_id))||[],S=Dp(d.messages||[]),_=[...k,...S];if(ne(`🔧 Calling deleteConversationWithFiles for session: ${d.sessionId}`),w.deleteConversationWithFiles){const A=await w.deleteConversationWithFiles(d.sessionId,_);ne(`✅ Deleted conversation and files for session: ${d.sessionId}`,A),ne(` - Deleted ${A.deleted_messages} messages`),ne(` - Deleted ${A.deleted_files} files`),A.file_deletion_errors&&A.file_deletion_errors.length>0&&Fe(` - Errors deleting files: ${A.file_deletion_errors.join(", ")}`)}else Fe("⚠️ deleteConversationWithFiles method not available on API client")}}catch(p){Mt("Failed to clear conversation history from server:",p)}else Fe(`⚠️ No session ID found for conversation ${i}, skipping server-side deletion`);r(p=>{var b;const x=p.conversations.filter(w=>w.id!==i),v=p.currentConversationId===i?((b=x[0])==null?void 0:b.id)||null:p.currentConversationId;if(x.length===0){const w=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,k=Bl(),S=oi(w,k,kt());return sa(l),{conversations:[S],currentConversationId:w,sessionId:k}}return sa(l),{conversations:x,currentConversationId:v}})},deleteAllConversations:async()=>{const c=[...l().conversations];ne(`🗑️ Deleting all conversations (${c.length} total)`),ql.stop();const d=c.map(async b=>{var w;if(b!=null&&b.sessionId)try{if(!await si()){Mt("Failed to configure API for conversation deletion");return}const S=b.adapterName;if(!S){ne(`Skipping server deletion for conversation ${b.id}: adapter not configured`);return}const _=await xt(),A=new _.ApiClient({apiUrl:Ta(b.apiUrl),sessionId:b.sessionId,adapterName:S}),D=[...((w=b.attachedFiles)==null?void 0:w.map(O=>O.file_id))||[],...Dp(b.messages||[])];A.deleteConversationWithFiles?(await A.deleteConversationWithFiles(b.sessionId,D),ne(`✅ Deleted conversation ${b.id} and files`)):Fe(`deleteConversationWithFiles not available for conversation ${b.id}`)}catch(k){Mt(`Failed to delete conversation ${b.id} from server:`,k)}}),h=(await Promise.allSettled(d)).filter(b=>b.status==="rejected");h.length>0&&Mt(`Some conversations failed to delete from server: ${h.length}`,h);const p=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,x=Bl(),v=oi(p,x,kt());r({conversations:[v],currentConversationId:p,sessionId:x}),sa(l)},deleteThread:async(i,c,d)=>{const f=l().conversations.find(w=>w.id===i);if(!f)throw new Error("Conversation not found");if(!f.adapterName)throw new Error("Adapter not configured for this conversation");const h=f.messages.find(w=>w.id===c);if(!(h!=null&&h.threadInfo)||h.threadInfo.thread_id!==d)throw new Error("Thread not found for this message");const p=Ta(f.apiUrl||kt()),x=await xt(),v=new x.ApiClient({apiUrl:p,sessionId:f.sessionId,adapterName:f.adapterName});await new(await Un(async()=>{const{ThreadService:w}=await import("./threadService-B9Db3n0J.js");return{ThreadService:w}},[])).ThreadService(v).deleteThread(d),r(w=>({conversations:w.conversations.map(k=>{var A;if(k.id!==i)return k;const S=k.messages.filter(D=>D.isThreadMessage?!(D.threadId===d||D.parentMessageId===c):!0).map(D=>D.id!==c?D:{...D,threadInfo:void 0,supportsThreading:!0}),_=k.currentThreadId===d||k.currentThreadSessionId===((A=h.threadInfo)==null?void 0:A.thread_session_id);return{...k,messages:S,currentThreadId:_?void 0:k.currentThreadId,currentThreadSessionId:_?void 0:k.currentThreadSessionId,updatedAt:new Date}})})),sa(l)},sendMessage:async(i,c,d,f,h)=>{var x;let p=null;try{if(l().isLoading){Fe("Another request is already in progress");return}if(!await si())throw new Error("API not properly configured. Please configure API settings first.");let b=l().currentConversationId;b||(b=l().createConversation());const w=l().conversations.find(q=>q.id===b);if(!w)throw new Error("Conversation not found");const k=ze.maxConversations;if(Ea()&&!vn()&&k!==null&&l().conversations.length>k){Ma.getState().openLoginPrompt(`You've reached the guest limit of ${k} conversation${k===1?"":"s"}. Sign in to continue chatting.`),r({isLoading:!1});return}const S=c?c.map(q=>{var I;const V=(I=w==null?void 0:w.attachedFiles)==null?void 0:I.find(P=>P.file_id===q);return V||{file_id:q,filename:"",mime_type:"",file_size:0}}).filter(q=>q!==void 0):[];S.length>0&&S.forEach(q=>{l().addFileToConversation(b,q)});const _=d||null;let A,D=null;if(_){if(A=w.messages.find(q=>{var V;return((V=q.threadInfo)==null?void 0:V.thread_id)===_}),!A)throw new Error("Thread metadata not found. Please recreate the thread from this message.");if(D=((x=A.threadInfo)==null?void 0:x.thread_session_id)||null,!D)throw new Error("Thread session is missing. Please recreate the thread from this message.")}const O=zp(w.messages),ee=ze.maxMessagesPerConversation;if(ee!==null&&O>=ee){Ea()&&!vn()&&Ma.getState().openLoginPrompt(`You've reached the guest limit of ${ee} messages per conversation. Sign in to send more messages, or delete conversations to start over.`),Fe(`[chatStore] Conversation ${b} reached the message limit (${ee}).`),r({isLoading:!1});return}const U=ze.maxTotalMessages;if(U!==null&&l().conversations.reduce((V,I)=>V+zp(I.messages),0)>=U){Ea()&&!vn()&&Ma.getState().openLoginPrompt(`You've reached the guest limit of ${U} total messages. Sign in to continue chatting, or delete conversations to start over.`),Fe(`[chatStore] Workspace reached the total message limit (${U}).`),r({isLoading:!1});return}const z={id:ss("user"),content:i,role:"user",timestamp:new Date,attachments:S.length>0?S:void 0},H=ss("assistant"),K={id:H,content:"",role:"assistant",timestamp:new Date,isStreaming:!0};if(_&&A){z.isThreadMessage=!0,z.threadId=_,z.parentMessageId=A.id,K.isThreadMessage=!0,K.threadId=_,K.parentMessageId=A.id;const q=ze.maxMessagesPerThread;if(q!==null&&w.messages.filter(I=>I.isThreadMessage?(I.threadId===_||I.parentMessageId===A.id)&&!(I.role==="assistant"&&I.isStreaming):!1).length>=q){Ea()&&!vn()&&Ma.getState().openLoginPrompt(`You've reached the guest limit of ${q} messages per thread. Sign in to continue this thread, or delete conversations to start over.`),Fe(`[chatStore] Thread ${_} reached the message limit (${q}).`),r({isLoading:!1});return}}r(q=>{const V=q.conversations.find(P=>P.id===b),I=(V==null?void 0:V.messages.filter(P=>P.role==="assistant"&&P.isStreaming))||[];return I.length>0&&Fe(`Cleaning up ${I.length} existing streaming messages`),{conversations:q.conversations.map(P=>{if(P.id!==b)return P;const ue=P.messages.filter(_e=>!(_e.role==="assistant"&&_e.isStreaming));return{...P,messages:[...ue,z,K],updatedAt:new Date,title:P.messages.length===0?i.slice(0,50)+(i.length>50?"...":""):P.title}}),isLoading:!0,error:null}}),p=b;let j=!1;ql.reset();try{const q=l().conversations.find(B=>B.id===p);if(!q)throw new Error("Conversation not found");if(!q.adapterName)throw new Error("Adapter not configured for this conversation. Please select an adapter first.");const V=Ta(q.apiUrl),I=q.adapterName,P=D||q.sessionId,ue=await xt();ue.configureApi(V,P,I),_&&P!==q.sessionId&&ne(`[chatStore] Thread mode: using thread session ${P} (original: ${q.sessionId})`);const{returnAudio:_e,ttsVoice:te,language:oe,audioFormat:E}=ed(q);ne("[chatStore] Audio settings:",{returnAudio:_e,ttsVoice:te,language:oe,audioFormat:E});const Y=new AbortController;Dn=Y,yn=P,ll=p,ra=null;for await(const B of ue.streamChat(i,!0,c,_||void 0,void 0,void 0,oe,_e,te,void 0,void 0,f,h)){if(B.request_id&&!ra&&(ra=B.request_id,ne(`[chatStore] >>> CAPTURED request_id for stop: ${B.request_id}`)),B.audio_chunk&&ql.addChunk({audio:B.audio_chunk,audioFormat:B.audioFormat||"opus",chunkIndex:B.chunk_index??0}),B.text){const re=rs(B.text);re?(l().appendToLastMessage(re,p),j=!0):B.text.length>100&&Fe("[chatStore] Filtered out potential base64 audio data from message content")}if(B.audio&&B.done&&r(re=>rn(re,p,()=>({audio:B.audio,audioFormat:B.audioFormat||"mp3"}))),B.image&&B.done&&(j=!0,r(re=>rn(re,p,()=>({image:B.image,imageFormat:B.image_format||"png",imageRevisedPrompt:B.image_revised_prompt,imageUrl:B.image_url})))),(B.video||B.video_url)&&B.done&&(j=!0,r(re=>rn(re,p,()=>({video:B.video,videoFormat:B.video_format||"mp4",videoRevisedPrompt:B.video_revised_prompt,videoUrl:B.video_url})))),(B.document||B.document_url)&&B.done&&(j=!0,r(re=>rn(re,p,()=>({document:B.document,documentFormat:B.document_format||"pdf",documentRevisedPrompt:B.document_revised_prompt,documentUrl:B.document_url})))),B.done){ne("[chatStore] Stream completed, receivedAnyText:",j);const re=B.threading;re!=null&&re.supports_threading&&r(ce=>({conversations:ce.conversations.map(ge=>ge.id!==p?ge:{...ge,messages:ge.messages.map(pe=>pe.id===H?{...pe,supportsThreading:!0,databaseMessageId:re.message_id}:pe),updatedAt:new Date})})),B.assistant_message_id&&r(ce=>({conversations:ce.conversations.map(ge=>ge.id!==p?ge:{...ge,messages:ge.messages.map(pe=>pe.id===H&&!pe.databaseMessageId?{...pe,databaseMessageId:B.assistant_message_id}:pe),updatedAt:new Date})}));break}}!j&&!Y.signal.aborted&&l().appendToLastMessage("No response received from the server. Please try again later.",p)}catch(q){if(q instanceof Error&&(q.name==="AbortError"||q.message==="Stream cancelled by user"||q.message.includes("aborted")))ne("[chatStore] Stream was cancelled by user"),j=!0;else{Mt("Chat API error:",q);let I="Sorry, there was an error processing your request.";q instanceof Error&&(q.message.startsWith("Server error:")?I=q.message.substring(14):(q.message.includes("Could not connect")||q.message.includes("timed out"))&&(I=q.message)),l().appendToLastMessage(I,p)}}Dn=null,ra=null,yn=null,ll=null,jo(p,r),r(q=>{const V=q.conversations.map(P=>P.id===p?{...P,messages:P.messages.map(ue=>ue.id===H?{...ue,isStreaming:!1}:ue),updatedAt:new Date}:P),I=V.find(P=>P.id===q.currentConversationId);return{conversations:V,isLoading:I?I.messages.some(P=>P.role==="assistant"&&P.isStreaming):!1}}),sa(l)}catch(v){Mt("Chat store error:",v),r(b=>({isLoading:!1,...b.currentConversationId===p&&{error:`Failed to send message: ${v instanceof Error?v.message:"Unknown error"}`}}))}},createThread:async(i,c)=>{try{const d=l().conversations.find(k=>k.sessionId===c);if(!d)throw new Error("Conversation not found for session");if(!d.adapterName)throw new Error("Adapter not configured for this conversation");const f=d.messages.find(k=>k.id===i);if(!f)throw new Error("Message not found");const h=f.databaseMessageId||i,p=Ta(d.apiUrl||kt()),x=await xt(),v=new x.ApiClient({apiUrl:p,sessionId:c,adapterName:d.adapterName}),w=await new(await Un(async()=>{const{ThreadService:k}=await import("./threadService-B9Db3n0J.js");return{ThreadService:k}},[])).ThreadService(v).createThread(h,c);r(k=>({conversations:k.conversations.map(S=>S.sessionId!==c?S:{...S,messages:S.messages.map(_=>_.id===i?{..._,threadInfo:w,supportsThreading:!0}:_),currentThreadId:void 0,currentThreadSessionId:void 0})})),ne(`[chatStore] Created thread ${w.thread_id} for message ${i}`)}catch(d){throw Mt("Failed to create thread:",d),d}},appendToLastMessage:(i,c)=>{const d=rs(i);if(!d&&i){Fe("[chatStore] Filtered out base64 audio data from message content");return}const f=fd(d),h=c||l().currentConversationId;if(!h)return;const p=h,x=is.get(p);x?(x.content+=f,x.timeoutId&&clearTimeout(x.timeoutId)):is.set(p,{content:f,timeoutId:null});const v=()=>{const w=is.get(p);if(!w||!w.content)return;const k=w.content;w.content="",w.timeoutId=null,r(S=>({conversations:S.conversations.map(_=>{if(_.id!==h)return _;const A=[..._.messages],D=A[A.length-1];return D&&D.role==="assistant"&&D.isStreaming&&(A[A.length-1]={...D,content:D.content+k}),{..._,messages:A,updatedAt:new Date}})}))},b=is.get(p);b.timeoutId=setTimeout(v,sv)},regenerateResponse:async(i,c)=>{let d=null;try{if(l().isLoading){Fe("Another request is already in progress");return}if(!await si())throw new Error("API not properly configured");const h=l(),p=h.conversations.find(A=>A.id===h.currentConversationId);if(!p)return;const x=p.messages.findIndex(A=>A.id===i);if(x===-1)return;const v=p.messages[x];if(!v||v.role!=="assistant")return;const b=p.messages[x-1];if(!b||b.role!=="user")return;const w=(b.attachments||[]).map(A=>A.file_id).filter(A=>typeof A=="string"&&A.length>0),k=ss("assistant");if(r(A=>({conversations:A.conversations.map(D=>D.id===A.currentConversationId?{...D,messages:[...D.messages.slice(0,x),{id:k,content:"",role:"assistant",timestamp:new Date,isStreaming:!0,supportsThreading:v.supportsThreading,databaseMessageId:v.databaseMessageId,threadInfo:v.threadInfo,threadId:v.threadId,parentMessageId:v.parentMessageId,isThreadMessage:v.isThreadMessage},...D.messages.slice(x+1)],updatedAt:new Date}:D),isLoading:!0,error:null})),d=h.currentConversationId,!d)throw new Error("No conversation selected");let S=!1;const _=new AbortController;Dn=_,ll=d,ra=null;try{const A=l().conversations.find(z=>z.id===d);if(!A)throw new Error("Conversation not found");if(!A.adapterName)throw new Error("Adapter not configured for this conversation. Please select an adapter first.");yn=A.sessionId,A.sessionId&&(await xt()).configureApi(Ta(A.apiUrl),A.sessionId,A.adapterName);const D=await xt(),{returnAudio:O,ttsVoice:ee,language:U}=ed(A);for await(const z of D.streamChat(b.content,!0,w.length>0?w:void 0,void 0,void 0,void 0,U,O,ee,void 0,void 0,c)){if(z.request_id&&!ra&&(ra=z.request_id,ne(`[chatStore] >>> CAPTURED request_id for regenerate stop: ${z.request_id}`)),z.text){const H=rs(z.text);H?(l().appendToLastMessage(H,d),S=!0):z.text.length>100&&Fe("[chatStore] Filtered out potential base64 audio data from regenerated message content")}if(z.audio&&z.done&&r(H=>rn(H,d,()=>({audio:z.audio,audioFormat:z.audioFormat||"mp3"}))),z.image&&z.done&&(S=!0,r(H=>rn(H,d,()=>({image:z.image,imageFormat:z.image_format||"png",imageRevisedPrompt:z.image_revised_prompt,imageUrl:z.image_url})))),(z.video||z.video_url)&&z.done&&(S=!0,r(H=>rn(H,d,()=>({video:z.video,videoFormat:z.video_format||"mp4",videoRevisedPrompt:z.video_revised_prompt,videoUrl:z.video_url})))),(z.document||z.document_url)&&z.done&&(S=!0,r(H=>rn(H,d,()=>({document:z.document,documentFormat:z.document_format||"pdf",documentRevisedPrompt:z.document_revised_prompt,documentUrl:z.document_url})))),z.done){const H=z.threading;H!=null&&H.supports_threading&&r(K=>({conversations:K.conversations.map(j=>j.id!==d?j:{...j,messages:j.messages.map(q=>q.id===k?{...q,supportsThreading:!0,databaseMessageId:H.message_id}:q),updatedAt:new Date})})),z.assistant_message_id&&r(K=>({conversations:K.conversations.map(j=>j.id!==d?j:{...j,messages:j.messages.map(q=>q.id===k&&!q.databaseMessageId?{...q,databaseMessageId:z.assistant_message_id}:q),updatedAt:new Date})}));break}}!S&&!_.signal.aborted&&l().appendToLastMessage("No response received from the server. Please try again later.",d)}catch(A){if(A instanceof Error&&(A.name==="AbortError"||A.message==="Stream cancelled by user"||A.message.includes("aborted")))ne("[chatStore] Regeneration stream was cancelled by user"),S=!0;else{Mt("Regenerate API error:",A);let O="Sorry, there was an error regenerating the response.";A instanceof Error&&(A.message.startsWith("Server error:")?O=A.message.substring(14):(A.message.includes("Could not connect")||A.message.includes("timed out"))&&(O=A.message)),l().appendToLastMessage(O,d)}}Dn=null,ra=null,yn=null,ll=null,jo(d,r),r(A=>{const D=A.conversations.map(ee=>ee.id===d?{...ee,messages:ee.messages.map(U=>U.id===k?{...U,isStreaming:!1}:U),updatedAt:new Date}:ee),O=D.find(ee=>ee.id===A.currentConversationId);return{conversations:D,isLoading:O?O.messages.some(ee=>ee.role==="assistant"&&ee.isStreaming):!1}})}catch(f){Mt("Regenerate error:",f),r(h=>({isLoading:!1,...h.currentConversationId===d&&{error:`Failed to regenerate response: ${f instanceof Error?f.message:"Unknown error"}`}}))}},editMessageAndRegenerate:async(i,c,d)=>{let f=null;try{if(l().isLoading){await l().stopStreaming();const _=l().currentConversationId;_&&jo(_,r)}const h=l(),p=h.conversations.find(_=>_.id===h.currentConversationId);if(!p)return;const x=p.messages.findIndex(_=>_.id===i);if(x===-1)return;const v=p.messages[x];if(v.role!=="user")return;const b=(v.attachments||[]).map(_=>_.file_id).filter(_=>typeof _=="string"&&_.length>0),w=ss("assistant");r(_=>({conversations:_.conversations.map(A=>A.id===_.currentConversationId?{...A,messages:[...A.messages.slice(0,x),{...v,content:c,updatedAt:new Date},{id:w,content:"",role:"assistant",timestamp:new Date,isStreaming:!0}],updatedAt:new Date}:A),isLoading:!0,error:null})),f=h.currentConversationId;let k=!1;const S=new AbortController;Dn=S,ll=f,ra=null;try{const _=l().conversations.find(U=>U.id===f);if(!_)throw new Error("Conversation not found");if(!_.adapterName)throw new Error("Adapter not configured for this conversation. Please select an adapter first.");yn=_.sessionId,_.sessionId&&(await xt()).configureApi(Ta(_.apiUrl),_.sessionId,_.adapterName);const A=await xt(),{returnAudio:D,ttsVoice:O,language:ee}=ed(_);for await(const U of A.streamChat(c,!0,b.length>0?b:void 0,void 0,void 0,void 0,ee,D,O,void 0,void 0,d)){if(U.request_id&&!ra&&(ra=U.request_id,ne(`[chatStore] >>> CAPTURED request_id for edit-regenerate stop: ${U.request_id}`)),U.text){const z=rs(U.text);z&&(l().appendToLastMessage(z,f),k=!0)}if(U.audio&&U.done&&r(z=>rn(z,f,()=>({audio:U.audio,audioFormat:U.audioFormat||"mp3"}))),U.image&&U.done&&(k=!0,r(z=>rn(z,f,()=>({image:U.image,imageFormat:U.image_format||"png",imageRevisedPrompt:U.image_revised_prompt,imageUrl:U.image_url})))),(U.video||U.video_url)&&U.done&&(k=!0,r(z=>rn(z,f,()=>({video:U.video,videoFormat:U.video_format||"mp4",videoRevisedPrompt:U.video_revised_prompt,videoUrl:U.video_url})))),(U.document||U.document_url)&&U.done&&(k=!0,r(z=>rn(z,f,()=>({document:U.document,documentFormat:U.document_format||"pdf",documentRevisedPrompt:U.document_revised_prompt,documentUrl:U.document_url})))),U.done){const z=U.threading;z!=null&&z.supports_threading&&r(H=>({conversations:H.conversations.map(K=>K.id!==f?K:{...K,messages:K.messages.map(j=>j.id===w?{...j,supportsThreading:!0,databaseMessageId:z.message_id}:j),updatedAt:new Date})})),U.assistant_message_id&&r(H=>({conversations:H.conversations.map(K=>K.id!==f?K:{...K,messages:K.messages.map(j=>j.id===w&&!j.databaseMessageId?{...j,databaseMessageId:U.assistant_message_id}:j),updatedAt:new Date})}));break}}!k&&!S.signal.aborted&&l().appendToLastMessage("No response received from the server. Please try again later.",f)}catch(_){if(_ instanceof Error&&(_.name==="AbortError"||_.message==="Stream cancelled by user"||_.message.includes("aborted")))ne("[chatStore] Edit-regenerate stream was cancelled by user"),k=!0;else{Mt("Edit-regenerate API error:",_);let D="Sorry, there was an error regenerating the response.";_ instanceof Error&&(_.message.startsWith("Server error:")?D=_.message.substring(14):(_.message.includes("Could not connect")||_.message.includes("timed out"))&&(D=_.message)),l().appendToLastMessage(D,f)}}Dn=null,ra=null,yn=null,ll=null,jo(f,r),r(_=>{const A=_.conversations.map(O=>O.id===f?{...O,messages:O.messages.map(ee=>ee.id===w?{...ee,isStreaming:!1}:ee),updatedAt:new Date}:O),D=A.find(O=>O.id===_.currentConversationId);return{conversations:A,isLoading:D?D.messages.some(O=>O.role==="assistant"&&O.isStreaming):!1}}),sa(l)}catch(h){Mt("Edit & regenerate error:",h),r(p=>({isLoading:!1,...p.currentConversationId===f&&{error:`Failed to regenerate response: ${h instanceof Error?h.message:"Unknown error"}`}}))}},updateConversationTitle:(i,c)=>{r(d=>({conversations:d.conversations.map(f=>f.id===i?{...f,title:c,updatedAt:new Date}:f)})),sa(l)},clearError:()=>r({error:null}),cleanupStreamingMessages:()=>{const i=ll;r(c=>{let d=!1;return{conversations:c.conversations.map(h=>h.id===i?(h.messages.some(x=>x.role==="assistant"&&x.isStreaming)&&(d=!0),h):h.messages.some(x=>x.role==="assistant"&&x.isStreaming)?{...h,messages:h.messages.filter(x=>!(x.role==="assistant"&&x.isStreaming)),updatedAt:new Date}:h),isLoading:d}})},canCreateNewConversation:()=>{var h;const i=l(),c=ze.maxConversations;if(!i.currentConversationId)return c===null||i.conversations.length<c;const d=i.conversations.find(p=>p.id===i.currentConversationId);return!!d&&(d.messages.length>0||(((h=d.attachedFiles)==null?void 0:h.length)||0)>0)?c===null||i.conversations.length<c:!1},getConversationCount:()=>l().conversations.length,addFileToConversation:(i,c)=>{ne("[chatStore] addFileToConversation called",{conversationId:i,fileId:c.file_id,filename:c.filename}),r(d=>({conversations:d.conversations.map(f=>f.id===i?{...f,attachedFiles:[...(f.attachedFiles||[]).filter(h=>h.file_id!==c.file_id),c],updatedAt:new Date}:f)})),sa(l)},removeFileFromConversation:async(i,c)=>{ne("[chatStore] removeFileFromConversation called",{conversationId:i,fileId:c});try{const d=l().conversations.find(f=>f.id===i);if(!d)throw new Error("Conversation not found");if(!d.adapterName)throw new Error("Adapter not configured for this conversation. Cannot delete file.");await di.deleteFile(c,void 0,Ta(d.apiUrl),d.adapterName),ne(`[chatStore] Successfully deleted file ${c} from server`)}catch(d){d instanceof Error&&(d.message.includes("404")||d.message.includes("File not found"))?ne(`[chatStore] File ${c} was already deleted from server`):Ie(`[chatStore] Failed to delete file ${c} from server:`,d)}r(d=>({conversations:d.conversations.map(f=>f.id===i?{...f,attachedFiles:(f.attachedFiles||[]).filter(h=>h.file_id!==c),updatedAt:new Date}:f)})),sa(l)},loadConversationFiles:async i=>{try{const c=l().conversations.find(p=>p.id===i);if(!c)return;if(!c.adapterName){ne(`Skipping file load for conversation ${i}: adapter not configured`);return}if(new Set((c.attachedFiles||[]).map(p=>p.file_id)).size===0){ne(`No files to sync for conversation ${i}`);return}const f=await di.listFiles(void 0,Ta(c.apiUrl),c.adapterName),h=new Map(f.map(p=>[p.file_id,{file_id:p.file_id,filename:p.filename,mime_type:p.mime_type,file_size:p.file_size,upload_timestamp:p.upload_timestamp,processing_status:p.processing_status,chunk_count:p.chunk_count}]));r(p=>{const x=p.conversations.find(b=>b.id===i);if(!x)return p;const v=(x.attachedFiles||[]).map(b=>h.get(b.file_id)||b).filter(b=>h.has(b.file_id)||!b.processing_status||b.processing_status==="processing");return{conversations:p.conversations.map(b=>b.id===i?{...b,attachedFiles:v,updatedAt:new Date}:b)}}),sa(l)}catch(c){Mt(`Failed to load files for conversation ${i}:`,c)}},syncConversationFiles:async i=>{await l().loadConversationFiles(i)},syncConversationsWithBackend:async()=>{try{const i=l();if(i.conversations.length===0)return;const c=await xt(),d=ze.maxMessagesPerConversation!==null&&ze.maxMessagesPerConversation||void 0;let f=!1;const p=(await Promise.all(i.conversations.map(async x=>{var v;if(!x.sessionId)return null;if(!x.adapterName)return Fe(`[chatStore] Skipping backend sync for conversation ${x.id} - adapter not configured`),null;try{const b=new c.ApiClient({apiUrl:Ta(x.apiUrl),sessionId:x.sessionId,adapterName:x.adapterName});if(typeof b.getConversationHistory!="function")return f||(f=!0,Fe("[chatStore] Conversation history endpoint not supported by current API client")),null;const w=await b.getConversationHistory(x.sessionId,d),k=Array.isArray(w==null?void 0:w.messages)?w.messages:[];if(k.length===0)return x.messages.length===0?null:{id:x.id,sessionId:(w==null?void 0:w.session_id)||x.sessionId,messages:[],cleared:!0,updatedAt:new Date};const S=nv(k,x.messages),_=x.messages.filter(D=>D.isThreadMessage),A=_g(_.length>0?[...S,..._]:S);return lv(x.messages,A)?null:{id:x.id,sessionId:(w==null?void 0:w.session_id)||x.sessionId,messages:A,cleared:!1,updatedAt:((v=S[S.length-1])==null?void 0:v.timestamp)||new Date}}catch(b){return Fe(`[chatStore] Failed to sync session ${x.sessionId}:`,b),null}}))).filter(x=>!!x);if(p.length===0)return;r(x=>{const v=new Map(p.map(b=>[b.id,b]));return{conversations:x.conversations.map(b=>{const w=v.get(b.id);return w?w.cleared?{...b,sessionId:w.sessionId||b.sessionId,messages:[],attachedFiles:[],title:"New Chat",updatedAt:w.updatedAt,adapterLoadError:null}:{...b,sessionId:w.sessionId||b.sessionId,messages:w.messages,updatedAt:w.updatedAt,adapterLoadError:null}:b}),currentConversationId:x.currentConversationId}}),sa(l)}catch(i){Fe("Failed to synchronize conversations with backend:",i)}},stopStreaming:async()=>{var c;if(!l().isLoading){ne("[chatStore] stopStreaming called but not currently loading");return}if(ne("[chatStore] Stopping stream...",{hasAbortController:!!Dn,requestId:ra,sessionId:yn}),Dn&&Dn.abort(),ra&&yn)try{const d=await xt(),f=await((c=d.stopChat)==null?void 0:c.call(d,yn,ra));ne(`[chatStore] Server-side cancellation result: ${f}`)}catch(d){Fe("[chatStore] Failed to cancel server-side stream:",d)}else Fe(`[chatStore] Cannot call stopChat - missing IDs: requestId=${ra}, sessionId=${yn}`);const i=ll||l().currentConversationId;r(i?d=>({conversations:d.conversations.map(f=>f.id!==i?f:{...f,messages:f.messages.map(h=>h.isStreaming?{...h,isStreaming:!1}:h),updatedAt:new Date}),isLoading:!1}):{isLoading:!1}),Dn=null,ra=null,yn=null,ll=null,ne("[chatStore] Stream stopped successfully")},clearCurrentConversationAdapter:()=>{const i=l().currentConversationId;i&&(r(c=>({conversations:c.conversations.map(d=>d.id===i?{...d,adapterName:void 0,adapterInfo:void 0,adapterLoadError:null}:d)})),sa(l))},submitFeedback:async(i,c)=>{const d=l(),f=d.conversations.find(p=>p.id===d.currentConversationId);if(!f)return;const h=f.messages.find(p=>p.id===i);if(!(h!=null&&h.databaseMessageId)){Fe("[chatStore] Cannot submit feedback: no databaseMessageId on message");return}if(f.adapterName)try{const p=await xt(),b=(await new p.ApiClient({apiUrl:Ta(f.apiUrl||kt()),sessionId:f.sessionId,adapterName:f.adapterName}).submitFeedback(h.databaseMessageId,f.sessionId,c)).feedback_type;r(w=>({conversations:w.conversations.map(k=>k.id!==d.currentConversationId?k:{...k,messages:k.messages.map(S=>S.id===i?{...S,feedback:b}:S),updatedAt:new Date})})),sa(l)}catch(p){Ie("[chatStore] Failed to submit feedback:",p)}},loadFeedbackForConversation:async i=>{var f;const d=l().conversations.find(h=>h.sessionId===i);if(d!=null&&d.adapterName)try{const h=await xt(),p=new h.ApiClient({apiUrl:Ta(d.apiUrl||kt()),sessionId:d.sessionId,adapterName:d.adapterName}),x=new Set([i]);for(const w of d.messages)(f=w.threadInfo)!=null&&f.thread_session_id&&x.add(w.threadInfo.thread_session_id);const v=await Promise.all(Array.from(x).map(w=>p.getSessionFeedback(w).catch(()=>({feedbacks:[]})))),b=new Map;for(const w of v)if(w!=null&&w.feedbacks)for(const k of w.feedbacks)b.set(k.message_id,k.feedback_type);if(b.size===0)return;r(w=>({conversations:w.conversations.map(k=>k.sessionId!==i?k:{...k,messages:k.messages.map(S=>S.databaseMessageId&&b.has(S.databaseMessageId)?{...S,feedback:b.get(S.databaseMessageId)}:S)})}))}catch(h){Ie("[chatStore] Failed to load feedback:",h)}}})),iv=async()=>{var x;const r=localStorage.getItem("chat-state"),l=kt(),i=!!localStorage.getItem("chat-api-url");let c=Ho(),d=!1;if(r)try{const v=JSON.parse(r),b=S=>{if(S instanceof Date)return S;const _=S?new Date(S):new Date;return Number.isNaN(_.getTime())?new Date:_},k=(Array.isArray(v.conversations)?v.conversations:[]).map(S=>{const A=(Array.isArray(S.messages)?S.messages:[]).filter(U=>!(U.role==="assistant"&&U.isStreaming)).map(U=>({...U,timestamp:b(U.timestamp),isStreaming:!1})),D=_g(A),O={id:S.id,sessionId:S.sessionId||Bl(),title:S.title||"New Chat",messages:D,createdAt:b(S.createdAt),updatedAt:b(S.updatedAt),attachedFiles:S.attachedFiles||[],adapterName:S.adapterName,apiUrl:S.apiUrl,adapterInfo:S.adapterInfo,adapterLoadError:S.adapterLoadError||null,audioSettings:S.audioSettings,currentThreadId:void 0,currentThreadSessionId:void 0},ee=O.messages.length===0&&!O.adapterName;return{...O,apiUrl:ee&&!i?l:Ta(S.apiUrl)}});if(d=k.length>0,v.currentConversationId&&k.length>0){const S=k.find(_=>_.id===v.currentConversationId);S!=null&&S.sessionId&&(c=S.sessionId)}if(k.length===0){const S=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,_=Bl(),A=oi(S,_,kt());Ye.setState({conversations:[A],currentConversationId:S,sessionId:_}),c=_}else Ye.setState({conversations:k,currentConversationId:v.currentConversationId||((x=k[0])==null?void 0:x.id)||null,sessionId:c}),!v.currentConversationId&&k.length>0&&(Ye.setState({currentConversationId:k[0].id,sessionId:k[0].sessionId||c}),c=k[0].sessionId||c);ne("📋 Loaded conversations:",Ye.getState().conversations.map(S=>{var _;return{id:S.id,title:S.title,sessionId:S.sessionId,messageCount:((_=S.messages)==null?void 0:_.length)||0}})),setTimeout(()=>Ye.getState().cleanupStreamingMessages(),100)}catch(v){Mt("Failed to load chat state:",v);const b=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,w=Bl(),k=oi(b,w,kt());Ye.setState({conversations:[k],currentConversationId:b,sessionId:w}),c=w}else{const v=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,b=Bl(),w=oi(v,b,kt());Ye.setState({conversations:[w],currentConversationId:v,sessionId:b}),c=b}localStorage.removeItem("chat-api-key");const f=Ye.getState(),h=f.currentConversationId?f.conversations.find(v=>v.id===f.currentConversationId):null,p=d&&(h!=null&&h.apiUrl)?h.apiUrl:kt();try{const v=await xt(),b=h==null?void 0:h.adapterName;if(!b)ne("No adapter selected yet. Waiting for user selection before configuring API.");else if(v.configureApi(p,c,b),Io=p,Fo=!0,!(h!=null&&h.adapterInfo))try{const w=new v.ApiClient({apiUrl:p,sessionId:null,adapterName:b});if(typeof w.getAdapterInfo=="function"){const k=await w.getAdapterInfo();ne("Adapter info loaded for existing adapter:",k);const S=Ye.getState();S.currentConversationId&&(Ye.setState({conversations:S.conversations.map(_=>_.id===S.currentConversationId?{..._,adapterInfo:k,adapterLoadError:null,updatedAt:new Date}:_)}),setTimeout(()=>{const _=Ye.getState();localStorage.setItem("chat-state",JSON.stringify({conversations:_.conversations,currentConversationId:_.currentConversationId}))},0))}}catch(w){Fe("Failed to load adapter info for existing adapter:",w)}}catch(v){Mt("Failed to initialize API:",v)}try{await Ye.getState().syncConversationsWithBackend()}catch(v){Fe("Conversation history sync skipped:",v)}};typeof window<"u"&&iv();function ov(r){return r.includes("image")?u.jsx(Hx,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}):r.includes("video")||r.includes("audio")?u.jsx(ub,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}):u.jsx(vd,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"})}function cv(r){return r.replace(/-/g," ")}function Ag({skills:r,isLoading:l,selectedSkill:i,activeSkillName:c,query:d="",onSelect:f,onActiveSkillChange:h}){const p=Rn.useRef(null),x=d.toLowerCase().replace(/-/g," "),v=x?r.filter(b=>b.name.replace(/-/g," ").toLowerCase().includes(x)||b.description.toLowerCase().includes(x)):r;return Rn.useEffect(()=>{var w;const b=(w=p.current)==null?void 0:w.querySelector('[data-active="true"]');b==null||b.scrollIntoView({block:"nearest"})},[c,v.length]),!l&&r.length===0?u.jsx("div",{className:"w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-lg shadow-black/5 dark:border-[#242424] dark:bg-[#101010] dark:shadow-black/30",children:u.jsx("p",{className:"px-4 py-3 text-sm text-gray-500 dark:text-[#bfc2cd]",children:"No skills available for this adapter."})}):u.jsx("div",{className:"w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-lg shadow-black/5 dark:border-[#242424] dark:bg-[#101010] dark:shadow-black/30",children:l?u.jsx("div",{className:"px-4 py-3.5",children:u.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-[#bfc2cd]",children:[u.jsx("div",{className:"h-3.5 w-3.5 rounded-full border-2 border-current border-t-transparent animate-spin","aria-hidden":"true"}),"Loading skills..."]})}):v.length===0?u.jsx("div",{className:"px-4 py-3.5",children:u.jsx("p",{className:"text-sm text-gray-500 dark:text-[#bfc2cd]",children:x?`No matching skills for "${d}".`:"No matching skills."})}):u.jsx("div",{ref:p,role:"listbox","aria-label":"Available skills",className:"max-h-72 overflow-y-auto p-1.5",children:v.map((b,w)=>{const k=(i==null?void 0:i.name)===b.name,S=c===b.name||!c&&(k||!i&&w===0);return u.jsxs("button",{id:`skill-option-${b.name}`,type:"button",role:"option","aria-selected":S,"data-active":S?"true":void 0,onMouseEnter:()=>h==null?void 0:h(b),onClick:()=>f(b),className:`group flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:focus-visible:ring-gray-600 ${S?"bg-gray-100 text-gray-950 dark:bg-[#242424] dark:text-white":"text-gray-900 hover:bg-gray-50 dark:text-gray-100 dark:hover:bg-[#1a1a1a]"}`,children:[u.jsx("div",{className:`mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center transition-colors ${S?"text-gray-900 dark:text-white":"text-gray-500 group-hover:text-gray-700 dark:text-[#bfc2cd] dark:group-hover:text-gray-200"}`,children:ov(b.name)}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"flex min-w-0 items-center gap-2",children:u.jsx("span",{className:"truncate text-sm font-medium capitalize leading-5 text-current",children:cv(b.name)})}),b.description&&u.jsx("p",{className:"mt-0.5 line-clamp-2 text-xs leading-5 text-gray-500 dark:text-[#bfc2cd]",children:b.description})]}),k&&u.jsx("span",{className:"mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-gray-900 text-white dark:bg-white dark:text-gray-900",children:u.jsx(Uo,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]},b.name)})})})}function Cg({availableModels:r,defaultModel:l,selectedModel:i,onSelect:c,wrapperClassName:d="relative hidden md:block",maxWidthClass:f="max-w-[200px]",triggerTitle:h="Select model",listboxLabel:p="Select model",staticPaddingClass:x="px-3 py-1.5",triggerPaddingClass:v="px-3 py-1.5"}){const[b,w]=g.useState(!1),[k,S]=g.useState(""),[_,A]=g.useState(null),D=g.useRef(null),O=g.useRef(null),ee=g.useRef(null),U=g.useRef(null),z=i??l,H=k.trim()?r.filter(I=>I.name.toLowerCase().includes(k.trim().toLowerCase())):r,K=g.useCallback(()=>{if(!O.current)return;const I=O.current.getBoundingClientRect();A({bottom:window.innerHeight-I.top+8,right:window.innerWidth-I.right})},[]),j=g.useCallback(()=>{w(!1),S("")},[]),q=()=>{if(b){j();return}K(),w(!0)};if(g.useEffect(()=>{if(!b)return;const I=setTimeout(()=>{var te;return(te=ee.current)==null?void 0:te.focus()},10),P=te=>{var B,re;const oe=te.target,E=((B=D.current)==null?void 0:B.contains(oe))??!1,Y=((re=U.current)==null?void 0:re.contains(oe))??!1;!E&&!Y&&j()},ue=te=>{var oe;te.key==="Escape"&&(te.preventDefault(),j(),(oe=O.current)==null||oe.focus())},_e=new ResizeObserver(K);return O.current&&_e.observe(O.current),window.addEventListener("resize",K,{passive:!0}),document.addEventListener("scroll",K,{capture:!0,passive:!0}),document.addEventListener("pointerdown",P),document.addEventListener("keydown",ue),()=>{clearTimeout(I),_e.disconnect(),window.removeEventListener("resize",K),document.removeEventListener("scroll",K,{capture:!0}),document.removeEventListener("pointerdown",P),document.removeEventListener("keydown",ue)}},[j,b,K]),!l&&r.length===0)return null;const V=b&&_&&typeof document<"u"?Qo.createPortal(u.jsxs("div",{ref:U,style:{position:"fixed",bottom:_.bottom,right:_.right,width:288,zIndex:9999},className:"rounded-xl border border-gray-200 bg-white shadow-xl dark:border-[#2f303d] dark:bg-[#111111]",children:[u.jsx("div",{className:"p-2 border-b border-gray-100 dark:border-[#222222]",children:u.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-gray-50 px-3 py-1.5 dark:bg-[#1a1a1a]",children:[u.jsx(yd,{className:"h-3.5 w-3.5 flex-shrink-0 text-gray-400 dark:text-[#6b6f7a]","aria-hidden":"true"}),u.jsx("input",{ref:ee,type:"text",value:k,onChange:I=>S(I.target.value),placeholder:"Search models…",className:"flex-1 bg-transparent pl-1 text-xs text-gray-700 placeholder-gray-400 focus:outline-none dark:text-[#ececf1] dark:placeholder-[#6b6f7a]","aria-label":"Search models"})]})}),u.jsx("div",{role:"listbox","aria-label":p,className:"max-h-60 overflow-y-auto py-1",children:H.length===0?u.jsxs("div",{className:"px-3 py-5 text-center text-xs text-gray-400 dark:text-[#6b6f7a]",children:["No models match “",k,"”"]}):H.map(I=>{const P=z===I.name;return u.jsxs("button",{role:"option","aria-selected":P,type:"button",onClick:()=>{var ue;c(I.name),j(),(ue=O.current)==null||ue.focus()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs transition-colors ${P?"bg-gray-100 text-gray-900 dark:bg-[#1f1f1f] dark:text-[#ececf1]":"text-gray-700 hover:bg-gray-50 dark:text-[#bfc2cd] dark:hover:bg-[#1a1a1a]"}`,children:[u.jsx("span",{className:`flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded-full border ${P?"border-blue-500 bg-blue-500 dark:border-blue-400 dark:bg-blue-400":"border-gray-300 dark:border-[#5a5b65]"}`,children:P&&u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-white"})}),u.jsx("span",{className:"truncate font-medium normal-case tracking-normal",children:I.name})]},I.name)})}),r.length>8&&u.jsx("div",{className:"border-t border-gray-100 px-3 py-1.5 dark:border-[#222222]",children:u.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-[#6b6f7a]",children:[H.length," of ",r.length," models"]})})]}),document.body):null;return u.jsx("div",{ref:D,className:d,children:r.length>1?u.jsxs(u.Fragment,{children:[u.jsxs("button",{ref:O,type:"button",onClick:q,className:`inline-flex min-w-[100px] ${f} items-center gap-1.5 rounded-full border border-gray-200 bg-gray-100 ${v} text-xs font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:border-[#4a4b54] dark:bg-[#343541] dark:text-[#bfc2cd] dark:hover:bg-[#3a3b48]`,"aria-haspopup":"listbox","aria-expanded":b,title:h,children:[u.jsx("span",{className:"truncate flex-1",children:z}),u.jsx(fi,{className:`h-3.5 w-3.5 flex-shrink-0 text-gray-400 transition-transform duration-150 dark:text-[#6b6f7a] ${b?"rotate-180":""}`,"aria-hidden":"true"})]}),V]}):u.jsx("div",{className:`inline-flex min-w-[100px] ${f} items-center rounded-full border border-gray-200 bg-gray-100 ${x} text-xs text-gray-500 dark:border-[#4a4b54] dark:bg-[#343541] dark:text-[#bfc2cd]`,title:z??void 0,children:u.jsx("span",{className:"truncate",children:z})})})}const uv=[],dv=(r="png")=>{const l=r.toLowerCase().replace(/^image\//,"");return l==="jpg"?"image/jpeg":`image/${l||"png"}`},fv=(r,l)=>{const i=atob(r),c=new Uint8Array(i.length);for(let d=0;d<i.length;d+=1)c[d]=i.charCodeAt(d);return new Blob([c],{type:l})},mv=async r=>{const l=URL.createObjectURL(r);try{const i=new Image;i.decoding="async";const c=new Promise((h,p)=>{i.onload=()=>h(i),i.onerror=()=>p(new Error("Failed to load generated image for clipboard copy"))});i.src=l,await c;const d=document.createElement("canvas");d.width=i.naturalWidth,d.height=i.naturalHeight;const f=d.getContext("2d");if(!f)throw new Error("Could not create canvas context for image clipboard copy");return f.drawImage(i,0,0),await new Promise((h,p)=>{d.toBlob(x=>{x?h(x):p(new Error("Could not encode generated image for clipboard copy"))},"image/png")})}finally{URL.revokeObjectURL(l)}},hv=async(r,l)=>{const i=dv(r.imageFormat);if(r.image)return fv(r.image,i);if(!r.imageUrl)return null;const c=await fetch(r.imageUrl,{headers:l?{"X-Adapter-Name":l}:{}});if(!c.ok)throw new Error(`Could not fetch generated image for clipboard copy: ${c.status}`);const d=await c.blob();return d.type?d:new Blob([d],{type:i})},pv=r=>r.imageUrl?new URL(r.imageUrl,window.location.origin).toString():r.imageRevisedPrompt||r.content;function Lp({size:r="md"}){const l=r==="sm"?"h-2 w-2":"h-2.5 w-2.5";return u.jsx("div",{className:"flex items-center gap-1.5 py-1",children:[0,150,300].map(i=>u.jsx("span",{className:`inline-block ${l} animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]`,style:{animationDelay:`${i}ms`}},i))})}function gv({reply:r}){const[l,i]=g.useState(!1),[c,d]=g.useState(!1),f=g.useRef(null),h=Ye(x=>x.submitFeedback);g.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const p=async x=>{if(!r.databaseMessageId||l)return;const v=r.feedback!==x;i(!0);try{await h(r.id,x),v?(d(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{d(!1),f.current=null},2e3)):d(!1)}catch(b){Ie("Failed to submit thread reply feedback:",b)}finally{i(!1)}};return u.jsxs("div",{className:"flex items-center gap-0.5 mt-0.5",children:[u.jsx("button",{onClick:()=>p("up"),disabled:l,className:`rounded-md p-1.5 hover:bg-gray-100 dark:hover:bg-[#3c3f4a] transition-colors ${l?"opacity-50 cursor-not-allowed":""} ${r.feedback==="up"?"text-green-600 dark:text-green-400":"text-gray-400 dark:text-[#6e6e80] hover:text-gray-700 dark:hover:text-[#ececf1]"}`,title:"Good response","aria-label":"Good response",children:u.jsx(rg,{className:"h-3.5 w-3.5"})}),u.jsx("button",{onClick:()=>p("down"),disabled:l,className:`rounded-md p-1.5 hover:bg-gray-100 dark:hover:bg-[#3c3f4a] transition-colors ${l?"opacity-50 cursor-not-allowed":""} ${r.feedback==="down"?"text-red-600 dark:text-red-400":"text-gray-400 dark:text-[#6e6e80] hover:text-gray-700 dark:hover:text-[#ececf1]"}`,title:"Poor response","aria-label":"Poor response",children:u.jsx(lg,{className:"h-3.5 w-3.5"})}),c&&u.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 animate-fadeIn dark:bg-emerald-500/15 dark:text-emerald-300",children:[u.jsx(Uo,{className:"h-3 w-3"}),"Thanks!"]})]})}function xv({message:r,onRegenerate:l,onEdit:i,onStartThread:c,onClearThread:d,onSendThreadMessage:f,threadMessages:h,sessionId:p,isThreadSendDisabled:x,availableModels:v=[],defaultModel:b=null,selectedModel:w=null}){var ol,Sa,Xa;const[k,S]=g.useState(!1),[_,A]=g.useState(r.content||""),[D,O]=g.useState(!1),ee=g.useRef(null),[U,z]=g.useState(!1),[H,K]=g.useState(!1),[j,q]=g.useState(!1),[V,I]=g.useState(""),[P,ue]=g.useState(!1),[_e,te]=g.useState(!1),[oe,E]=g.useState(!1),[Y,B]=g.useState(0),[re,ce]=g.useState(!1),[ge,pe]=g.useState(!1),[G,me]=g.useState(()=>w??b),de=g.useRef(w),fe=g.useRef(((ol=r.threadInfo)==null?void 0:ol.thread_id)||null),ye=g.useRef(null),ae=g.useRef(null),ie=g.useRef(null),xe=g.useRef(!1),Ne=g.useRef(0),ve=g.useRef(""),Te=g.useRef(!1),Le=g.useRef(!0),qe=g.useRef(!1),Be=g.useRef(null),Ge=g.useRef(null),He=r.role==="assistant",vt=h??uv,st=vt.filter(W=>!(W.role==="assistant"&&W.isStreaming)).length,se=vt.some(W=>W.isStreaming),Ee=us(),zt=Ea()&&!Ee,we=Ye(W=>W.conversations.find($e=>$e.id===W.currentConversationId)),Xt=!!((r.image||r.imageUrl)&&He&&!r.isStreaming),sn=!!((r.video||r.videoUrl)&&He&&!r.isStreaming),Dt=Xt?"Copy image to clipboard":"Copy to clipboard",Ft=ny(),Hl=ze.maxMessageLength,ya=ze.maxMessagesPerThread,wn=ya!==null&&st>=ya,On=wn?zt?`You've reached the guest limit of ${ya} messages per thread. Sign in to continue this thread.`:`This thread reached the ${ya} message limit. Start a new conversation for more follow-ups.`:null,{theme:Lt,isDark:_t}=cs(),ia="Reply in thread...",Re=`thread-input-${r.id}`,{skills:oa,isLoading:za,selectedSkill:Me,selectSkill:Qe,clearSkill:it}=wg({adapterName:we==null?void 0:we.adapterName,enabled:Ft&&!!r.threadInfo,selectionScopeKey:((Sa=r.threadInfo)==null?void 0:Sa.thread_id)||r.id}),be=V.startsWith("/")?V.slice(1):"",It=be.toLowerCase().replace(/-/g," "),Rt=It?oa.filter(W=>W.name.replace(/-/g," ").toLowerCase().includes(It)||W.description.toLowerCase().includes(It)):oa,on=Rt.length>0?Math.min(Y,Rt.length-1):0,da=Rt[on]??null,sl=(da==null?void 0:da.name.replace(/-/g," "))??"",il=oe&&da&&V.startsWith("/")&&sl.toLowerCase().startsWith(be.toLowerCase())&&sl.length>be.length?sl.slice(be.length):null,Ga=Lt.mode==="dark"?"dark":Lt.mode==="light"?"light":"",ca=_t?"dark":"light",Fl=g.useMemo(()=>["message-markdown w-full min-w-0","prose prose-slate dark:prose-invert max-w-none",Ga].filter(Boolean).join(" "),[Ga]),Il=g.useMemo(()=>["message-markdown w-full min-w-0","prose dark:prose-invert max-w-none",Ga].filter(Boolean).join(" "),[Ga]),$n=He?Fl:Il,cn=`${Fl} text-sm leading-6`,qn=`${Il} text-sm leading-6`;g.useEffect(()=>{var W,$e;!fe.current&&((W=r.threadInfo)!=null&&W.thread_id)&&ue(!0),fe.current=(($e=r.threadInfo)==null?void 0:$e.thread_id)||null},[(Xa=r.threadInfo)==null?void 0:Xa.thread_id]),g.useEffect(()=>{r.threadInfo||setTimeout(()=>{I(""),ue(!1),te(!1),E(!1),it()},0)},[r.threadInfo,it]),g.useEffect(()=>{st>0&&setTimeout(()=>{ue(!0)},0)},[st]),g.useEffect(()=>()=>{Be.current&&clearTimeout(Be.current),Ge.current&&clearTimeout(Ge.current)},[]),g.useEffect(()=>{if(!k||!ee.current)return;const W=ee.current;W.focus(),W.setSelectionRange(W.value.length,W.value.length)},[k]),g.useEffect(()=>{if(!k||!ee.current)return;const W=ee.current;W.style.height="auto",W.style.height=`${W.scrollHeight}px`},[k,_]);const un=g.useCallback(()=>{const W=_.trim();if(!W||W===r.content){S(!1);return}i==null||i(r.id,W),S(!1)},[_,r.content,r.id,i]),fa=g.useCallback(()=>{requestAnimationFrame(()=>{ie.current&&(ie.current.scrollTop=ie.current.scrollHeight)})},[]);g.useEffect(()=>{if(!P)return;const W=vt.length,$e=W>Ne.current,he=vt[vt.length-1],Ze=(he==null?void 0:he.content)||"",Jt=Ze!==ve.current,Ot=(he==null?void 0:he.isStreaming)??!1,Pt=Te.current&&!Ot;$e||Ot&&Jt||Pt?(fa(),Le.current=!0):Le.current&&Jt&&fa(),Ne.current=W,ve.current=Ze,Te.current=Ot},[P,vt,fa]),g.useEffect(()=>{P&&(fa(),Le.current=!0)},[P,fa]);const Kt=He?"message-bubble message-bubble-assistant min-w-0 break-words leading-relaxed text-[#353740] dark:text-[#ececf1]":"message-bubble message-bubble-user relative inline-block min-w-0 break-words leading-relaxed rounded-[1.75rem] bg-[#f4f4f4] px-4 py-3 pr-10 text-[#111827] dark:bg-[#303030] dark:text-[#f5f5f5]",jt="border-gray-200 bg-white/80 dark:border-[#3b3c49] dark:bg-white/5",Ut=g.useCallback(()=>{z(!0),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{z(!1),Be.current=null},2e3)},[]),va=async()=>{try{if(Xt){if("ClipboardItem"in window&&navigator.clipboard.write)try{const $e=(we==null?void 0:we.adapterName)||(typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null),he=await hv(r,$e);if(he){const Ze=he.type==="image/png"?he:await mv(he);await navigator.clipboard.write([new ClipboardItem({[Ze.type||"image/png"]:Ze})]),Ut();return}}catch($e){Ie("Failed to copy generated image, falling back to text:",$e)}const W=pv(r);if(W){await navigator.clipboard.writeText(W),Ut();return}return}await navigator.clipboard.writeText(r.content),Ut()}catch(W){Ie(Xt?"Failed to copy generated image:":"Failed to copy text:",W)}},Gl=Ye(W=>W.submitFeedback),Gt=async W=>{if(!r.databaseMessageId||H)return;const $e=r.feedback!==W;K(!0);try{await Gl(r.id,W),$e?(q(!0),Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>{q(!1),Ge.current=null},2e3)):q(!1)}catch(he){Ie("Failed to submit feedback:",he)}finally{K(!1)}},Vl=async()=>{if(!f||!r.threadInfo||wn)return;const W=V.trim();if(!W)return;const $e=V,he=Me,Ze=Me==null?void 0:Me.name;I(""),te(!0),E(!1),Ze&&it();try{await f(r.threadInfo.thread_id,r.id,W,Ze,G??b??void 0),setTimeout(()=>{ye.current&&ye.current.focus()},100)}catch(Jt){Ie("Failed to send thread message:",Jt),I($e),he&&Qe(he),setTimeout(()=>{ye.current&&ye.current.focus()},100)}finally{te(!1)}},Sn=g.useCallback(W=>{var $e;Qe(W),E(!1),I(""),B(0),($e=ye.current)==null||$e.focus()},[Qe]),kn=g.useCallback(()=>{var W;E(!1),I(""),B(0),(W=ye.current)==null||W.focus()},[]),Va=g.useCallback(()=>{var W;I("/"),E(!0),B(0),(W=ye.current)==null||W.focus()},[]),Yt=W=>{if(oe){if(W.key==="ArrowDown"){W.preventDefault(),B($e=>Rt.length===0?0:($e+1)%Rt.length);return}if(W.key==="ArrowUp"){W.preventDefault(),B($e=>Rt.length===0?0:($e-1+Rt.length)%Rt.length);return}if(W.key==="Home"){W.preventDefault(),B(0);return}if(W.key==="End"){W.preventDefault(),B(Math.max(Rt.length-1,0));return}if((W.key==="Enter"&&!W.shiftKey||W.key==="Tab")&&da){W.preventDefault(),Sn(da);return}if(W.key==="Escape"){W.preventDefault(),kn();return}}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),Vl())},wa=!r.threadInfo||!f||x||se||_e||wn,Bn=!!r.threadInfo&&!!d&&st>0&&!se&&!_e&&!x,_n=async()=>{if(!(!r.threadInfo||!d)){pe(!0);try{await d(r.id,r.threadInfo.thread_id),ce(!1),ue(!1),I("")}catch(W){Ie("Failed to clear thread:",W)}finally{pe(!1)}}};g.useEffect(()=>{de.current=w},[w]),g.useEffect(()=>{me(de.current??b)},[b]),g.useEffect(()=>{if(!P||wa){qe.current=_e;return}const W=ye.current;if(!W){qe.current=_e;return}if(!(xe.current||qe.current)){qe.current=_e;return}const he=requestAnimationFrame(()=>{var Jt;xe.current&&((Jt=ae.current)==null||Jt.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})),W.focus();const Ze=W.value.length;W.setSelectionRange(Ze,Ze),xe.current=!1,qe.current=_e});return()=>{cancelAnimationFrame(he),qe.current=_e}},[P,wa,_e]),g.useEffect(()=>{if(ye.current){const $e=ye.current;$e.style.height="auto";const he=$e.scrollHeight;$e.style.height=`${Math.min(he,120)}px`,$e.style.overflowY=he>120?"auto":"hidden"}},[V]);const ot=g.useMemo(()=>{if(r.isStreaming&&(!r.content||r.content==="…"))return u.jsx("div",{className:$n,children:u.jsx(Lp,{})});const W=r.isStreaming&&He?" streaming-cursor":"";return u.jsx("div",{className:W||void 0,children:u.jsx(rl,{content:fd(rs(r.content||"")),className:$n,syntaxTheme:ca})})},[$n,r.content,r.isStreaming,He,ca]),Xl=g.useMemo(()=>{const W=he=>he instanceof Date?he.getTime():new Date(he).getTime();return[...vt].sort((he,Ze)=>W(he.timestamp)-W(Ze.timestamp)).map(he=>{const Ze=he.role==="assistant",Jt=Ze?cn:qn,Ot=he.isStreaming&&Ze?" streaming-cursor":"",Pt=he.isStreaming&&(!he.content||he.content==="…")?u.jsx("div",{className:Jt,children:u.jsx(Lp,{size:"sm"})}):u.jsx("div",{className:Ot||void 0,children:u.jsx(rl,{content:fd(rs(he.content||"")),className:Jt,syntaxTheme:ca})});return u.jsx("div",{className:`min-w-0 flex ${Ze?"justify-start":"justify-end"}`,children:u.jsxs("div",{className:Ze?"min-w-0 w-full max-w-full":"min-w-0 max-w-[85%]",children:[u.jsxs("div",{className:Ze?"thread-markdown-wrapper overflow-x-visible text-sm text-[#353740] dark:text-[#ececf1]":"thread-markdown-wrapper overflow-x-visible text-sm rounded-[1.75rem] bg-[#f4f4f4] px-4 py-3 text-[#111827] dark:bg-[#303030] dark:text-[#f5f5f5]",children:[Pt,he.audio&&Ze&&!he.isStreaming&&u.jsx(wp,{audio:he.audio,audioFormat:he.audioFormat,autoPlay:!1}),(he.image||he.imageUrl)&&Ze&&!he.isStreaming&&u.jsx(Sp,{image:he.image,imageUrl:he.imageUrl,imageFormat:he.imageFormat,revisedPrompt:he.imageRevisedPrompt}),(he.video||he.videoUrl)&&Ze&&!he.isStreaming&&u.jsx(kp,{video:he.video,videoUrl:he.videoUrl,videoFormat:he.videoFormat,revisedPrompt:he.videoRevisedPrompt,adapterName:we==null?void 0:we.adapterName}),(he.document||he.documentUrl)&&Ze&&!he.isStreaming&&u.jsx(jp,{document:he.document,documentUrl:he.documentUrl,documentFormat:he.documentFormat,revisedPrompt:he.documentRevisedPrompt,adapterName:we==null?void 0:we.adapterName})]}),Ze&&!he.isStreaming&&vp()&&u.jsx(gv,{reply:he})]})},he.id)})},[we==null?void 0:we.adapterName,ca,cn,vt,qn]);return u.jsxs("div",{className:"group animate-fadeIn min-w-0 w-full px-0",children:[u.jsxs("div",{className:"min-w-0 space-y-1",children:[u.jsxs("div",{className:Kt,children:[k?u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx("textarea",{ref:ee,className:"w-full resize-none overflow-hidden bg-transparent outline-none text-[#111827] dark:text-[#f5f5f5] leading-relaxed",value:_,onChange:W=>A(W.target.value),onCompositionStart:()=>O(!0),onCompositionEnd:()=>O(!1),onKeyDown:W=>{W.key==="Enter"&&!W.shiftKey&&!D&&(W.preventDefault(),W.stopPropagation(),un()),W.key==="Escape"&&(W.stopPropagation(),S(!1),A(r.content||""))},maxLength:ze.maxMessageLength,rows:1,style:{minHeight:"24px"}}),u.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[u.jsx("span",{className:"text-xs text-gray-400 dark:text-[#6e6e80]",children:"Will regenerate response"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:()=>{S(!1),A(r.content||"")},className:"px-3 py-1.5 text-xs font-medium rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 dark:bg-[#4a4b54] dark:text-gray-200 dark:hover:bg-[#565869] transition-colors",children:"Cancel"}),u.jsxs("button",{onClick:un,className:"px-3 py-1.5 text-xs font-medium rounded-full bg-blue-600 text-white hover:bg-blue-700 transition-colors flex items-center gap-1.5",children:[u.jsx(sd,{className:"w-3.5 h-3.5"}),"Send"]})]})]})]}):ot,r.attachments&&r.attachments.length>0&&u.jsx("div",{className:"mt-3 space-y-2",children:r.attachments.map(W=>u.jsxs("div",{className:`flex items-center gap-3 rounded-xl border p-3 ${jt}`,children:[u.jsx(Bx,{className:"h-4 w-4 text-gray-500 dark:text-[#bfc2cd]"}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"truncate text-sm font-medium text-[#353740] dark:text-[#ececf1]",children:W.filename}),u.jsxs("p",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:[(W.file_size/1024).toFixed(1)," KB"]})]})]},W.file_id))}),r.audio&&He&&!r.isStreaming&&u.jsx(wp,{audio:r.audio,audioFormat:r.audioFormat,autoPlay:!1}),(r.image||r.imageUrl)&&He&&!r.isStreaming&&u.jsx(Sp,{image:r.image,imageUrl:r.imageUrl,imageFormat:r.imageFormat,revisedPrompt:r.imageRevisedPrompt}),(r.video||r.videoUrl)&&He&&!r.isStreaming&&u.jsx(kp,{video:r.video,videoUrl:r.videoUrl,videoFormat:r.videoFormat,revisedPrompt:r.videoRevisedPrompt,adapterName:we==null?void 0:we.adapterName}),(r.document||r.documentUrl)&&He&&!r.isStreaming&&u.jsx(jp,{document:r.document,documentUrl:r.documentUrl,documentFormat:r.documentFormat,revisedPrompt:r.documentRevisedPrompt,adapterName:we==null?void 0:we.adapterName}),!He&&i&&!k&&u.jsx("button",{onClick:()=>{A(r.content||""),S(!0)},className:"absolute top-1/2 -translate-y-1/2 right-2 rounded-md p-1 text-gray-600 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white transition-colors",title:"Edit message","aria-label":"Edit message",children:u.jsx(ng,{className:"h-3.5 w-3.5"})})]}),He&&!r.isStreaming&&u.jsxs("div",{className:"py-1 flex flex-nowrap items-center gap-0.5 text-gray-400 dark:text-[#8e8ea0] transition-opacity",children:[!sn&&u.jsx("button",{onClick:va,className:"rounded-md p-1.5 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:Dt,"aria-label":Dt,children:U?u.jsx(Uo,{className:"h-4 w-4 text-emerald-500 dark:text-emerald-400"}):u.jsx(Rx,{className:"h-4 w-4"})}),vp()&&u.jsxs("div",{className:"relative flex items-center gap-0.5",children:[u.jsx("button",{onClick:()=>Gt("up"),disabled:H,className:`rounded-md p-1.5 transition-colors ${H?"opacity-50 cursor-not-allowed":""} ${r.feedback==="up"?"text-green-600 dark:text-green-400":"hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]"}`,title:"Good response","aria-label":"Good response",children:u.jsx(rg,{className:"h-4 w-4"})}),u.jsx("button",{onClick:()=>Gt("down"),disabled:H,className:`rounded-md p-1.5 transition-colors ${H?"opacity-50 cursor-not-allowed":""} ${r.feedback==="down"?"text-red-600 dark:text-red-400":"hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]"}`,title:"Poor response","aria-label":"Poor response",children:u.jsx(lg,{className:"h-4 w-4"})}),j&&u.jsxs("div",{className:"absolute bottom-full left-1/2 mb-2 -translate-x-1/2 whitespace-nowrap rounded-lg bg-emerald-500 px-2.5 py-1 text-[11px] font-bold uppercase tracking-wider text-white shadow-sm animate-fadeIn dark:bg-emerald-600",children:[u.jsx("div",{className:"absolute left-1/2 top-full h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rotate-45 bg-emerald-500 dark:bg-emerald-600"}),u.jsxs("div",{className:"relative flex items-center gap-1.5",children:[u.jsx(Uo,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Thanks!"})]})]})]}),l&&u.jsx("button",{onClick:()=>l(r.id),className:"rounded-md p-1.5 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:"Regenerate response","aria-label":"Regenerate response",children:u.jsx(lb,{className:"h-4 w-4"})}),Ft&&r.supportsThreading&&!r.threadInfo&&c&&p&&u.jsxs("button",{type:"button",onClick:()=>{xe.current=!0,ue(!0),c(r.id,p)},className:"ml-1 inline-flex items-center gap-1.5 rounded-full border border-blue-200 bg-blue-50 px-2.5 py-1.5 text-xs text-blue-700 shadow-sm transition-all hover:border-blue-300 hover:bg-blue-100 hover:text-blue-800 hover:shadow-md dark:border-blue-500/30 dark:bg-blue-500/10 dark:text-blue-200 dark:hover:border-blue-400/50 dark:hover:bg-blue-500/20 dark:hover:text-blue-100 animate-follow-up-enter whitespace-nowrap",title:"Continue this discussion with the current answer's context","aria-label":"Continue this discussion with the current answer's context",children:[u.jsx(mp,{className:"h-3.5 w-3.5 shrink-0"}),u.jsx("span",{children:"Continue"})]}),Ft&&r.threadInfo&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-px h-4 shrink-0 bg-gray-200 dark:bg-[#3c3f4a] mx-1"}),u.jsxs("button",{onClick:()=>ue(W=>!W),className:"inline-flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1] transition-colors text-xs",children:[u.jsx(mp,{className:"h-4 w-4"}),u.jsxs("span",{className:"truncate",children:[st," ",st===1?"reply":"replies"]}),P?u.jsx(Oo,{className:"h-3 w-3"}):u.jsx(fi,{className:"h-3 w-3"})]}),Bn&&u.jsx("button",{type:"button",onClick:()=>ce(!0),className:"inline-flex items-center rounded-md px-2 py-1 text-xs font-medium text-red-600 transition-colors hover:bg-red-50 dark:text-red-300 dark:hover:bg-red-900/30",title:"Clear replies","aria-label":"Clear replies",children:"Clear"})]})]}),Ft&&r.threadInfo&&P&&u.jsxs("div",{className:"thread-panel mt-3 md:mt-3 border-l-2 border-gray-200 pl-3 sm:pl-4 dark:border-[#3b3c49]",children:[u.jsx("div",{ref:ie,className:"thread-replies-scroll mt-2 space-y-2 pb-3",onScroll:()=>{if(!ie.current)return;const{scrollTop:W,scrollHeight:$e,clientHeight:he}=ie.current;Le.current=$e-W-he<100},children:st>0?Xl:null}),On&&u.jsxs("div",{className:"mt-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-500/30 dark:bg-[#2f2410] dark:text-amber-100",children:[On,zt&&u.jsx("div",{className:"mt-2",children:u.jsx("button",{type:"button",onClick:()=>Ma.getState().openLoginPrompt("Sign in to unlock higher message limits and continue this thread."),className:"inline-flex items-center gap-1 rounded-md bg-blue-600 px-2.5 py-1 text-[11px] font-medium text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",children:"Sign in for higher limits"})})]}),u.jsxs("div",{ref:ae,className:"mt-1 w-full max-w-[64rem] bg-transparent pt-1",children:[u.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-gray-200 bg-gray-50 px-3 py-2 dark:border-[#242424] dark:bg-[#101010]",children:[Me&&u.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs text-gray-700 shadow-sm dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-200",children:[u.jsx(vd,{className:"h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":"true"}),u.jsx("span",{className:"min-w-0 truncate font-medium capitalize",children:Me.name.replace(/-/g," ")}),u.jsx("button",{type:"button",onClick:()=>it(),className:"-mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-white/10 dark:hover:text-gray-100","aria-label":"Remove thread skill",children:u.jsx(ba,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),!Me&&oa.length>0&&V.length===0&&!wa&&u.jsxs("button",{type:"button",onClick:Va,className:"flex h-8 shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs font-medium text-gray-600 shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-300 dark:hover:bg-white/10 dark:hover:text-gray-100 dark:focus-visible:ring-gray-600","aria-label":"Show available skills (or type a forward slash)",title:"Use a skill",children:[u.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded bg-gray-200 font-mono text-[10px] leading-none text-gray-600 dark:bg-[#2a2a2a] dark:text-gray-300","aria-hidden":"true",children:"/"}),"Skills"]}),u.jsxs("div",{className:"relative flex min-h-8 flex-1 items-center min-w-0",children:[u.jsx("label",{htmlFor:Re,className:"sr-only",children:"Reply in thread"}),il&&u.jsxs("div",{className:"pointer-events-none absolute inset-0 whitespace-pre-wrap px-0 py-0 text-base leading-8 text-gray-400 dark:text-[#8e8ea0] sm:text-sm sm:leading-8","aria-hidden":"true",children:[u.jsx("span",{className:"invisible",children:V}),u.jsx("span",{children:il})]}),u.jsx("textarea",{id:Re,ref:ye,className:"relative z-10 block h-8 w-full min-w-0 resize-none overflow-hidden bg-transparent px-0 py-0 text-base leading-8 text-[#353740] placeholder-slate-500 outline-none transition focus:outline-none disabled:opacity-60 dark:text-[#ececf1] dark:placeholder-[#70707c] sm:text-sm sm:leading-8",placeholder:ia,"aria-label":"Reply in thread",value:V,onChange:W=>{const $e=W.target.value;I($e),$e.startsWith("/")&&B(0),E($e.startsWith("/"))},onKeyDown:Yt,disabled:wa,rows:1,maxLength:Hl,style:{minHeight:"32px",maxHeight:"120px",outline:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none",appearance:"none"}})]}),u.jsxs("div",{className:"flex items-center justify-between sm:justify-end gap-2",children:[u.jsx(Cg,{availableModels:v,defaultModel:b,selectedModel:G,onSelect:me,maxWidthClass:"max-w-[120px]",triggerPaddingClass:"px-2 py-1",staticPaddingClass:"px-2 py-1",triggerTitle:"Select model for this thread",listboxLabel:"Select model for this thread"}),V.trim().length>0&&u.jsx("button",{type:"button",onClick:Vl,disabled:wa||V.trim().length===0,className:"flex h-10 w-10 sm:h-8 sm:w-8 items-center justify-center rounded-full transition active:scale-95 bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400 disabled:cursor-not-allowed",title:"Send thread message",children:u.jsx(sd,{className:"h-5 w-5 sm:h-4 sm:w-4"})})]})]}),oe&&u.jsx("div",{className:"w-full pt-1",children:u.jsx(Ag,{skills:oa,isLoading:za,selectedSkill:Me,activeSkillName:da==null?void 0:da.name,query:be,onActiveSkillChange:W=>{const $e=Rt.findIndex(he=>he.name===W.name);$e>=0&&B($e)},onSelect:Sn,onClose:kn})})]}),st>0&&u.jsx("div",{className:"mt-2 flex justify-end",children:u.jsxs("button",{type:"button",onClick:()=>ue(!1),className:"inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-[#bfc2cd] dark:hover:bg-[#2f313a] dark:hover:text-white","aria-label":"Hide replies",children:[u.jsx(Oo,{className:"h-3 w-3"}),u.jsx("span",{children:"Hide replies"})]})})]})]}),u.jsx(Bo,{isOpen:re,onClose:()=>{ge||ce(!1)},onConfirm:_n,title:"Clear Replies",message:"Are you sure you want to clear these replies? This removes the child thread from the backend without deleting the main conversation.",confirmText:"Clear",cancelText:"Cancel",type:"danger",isLoading:ge})]})}let ls=null;function bv(){if(typeof window>"u")return null;const r=window.AudioContext??window.webkitAudioContext;return r?((!ls||ls.state==="closed")&&(ls=new r),ls.state==="suspended"&&ls.resume(),ls):(ne("[SoundEffects] AudioContext not supported in this browser"),null)}function yv(r){const l=bv();if(!l)return;const i=l.currentTime;for(const c of r){const d=l.createOscillator(),f=l.createGain();d.connect(f),f.connect(l.destination),d.frequency.value=c.frequency,d.type=c.type;const h=i+c.startTime,p=h+c.duration;f.gain.setValueAtTime(.001,h),f.gain.linearRampToValueAtTime(c.gain,h+.008),f.gain.exponentialRampToValueAtTime(.001,p),d.start(h),d.stop(p+.01)}}const vv={messageSent:[{frequency:1046,startTime:0,duration:.08,gain:.15,type:"sine"},{frequency:1397,startTime:.07,duration:.11,gain:.18,type:"sine"}],messageReceived:[{frequency:988,startTime:0,duration:.12,gain:.16,type:"sine"},{frequency:1319,startTime:.13,duration:.12,gain:.18,type:"sine"},{frequency:1568,startTime:.26,duration:.18,gain:.14,type:"sine"}],success:[{frequency:784,startTime:0,duration:.1,gain:.14,type:"sine"},{frequency:1175,startTime:.11,duration:.18,gain:.18,type:"sine"}],error:[{frequency:330,startTime:0,duration:.15,gain:.16,type:"sine"},{frequency:262,startTime:.18,duration:.22,gain:.13,type:"sine"}],notification:[{frequency:880,startTime:0,duration:.1,gain:.14,type:"sine"},{frequency:1109,startTime:.12,duration:.16,gain:.17,type:"sine"}]};function ii(r,l){if(!l)return;const i=vv[r];if(!i){ne(`[SoundEffects] Unknown sound effect type: ${r}`);return}try{yv(i),ne(`[SoundEffects] Playing ${r} sound effect`)}catch(c){ne(`[SoundEffects] Failed to play ${r} sound effect:`,c)}}function wv({messages:r,onRegenerate:l,onEditMessage:i,onStartThread:c,onClearThread:d,onSendThreadMessage:f,sessionId:h,isLoading:p,contentMaxWidthClass:x="max-w-[64rem]",availableModels:v,defaultModel:b,selectedModel:w}){const k=g.useRef(null),S=g.useRef(null),_=g.useRef(r.length),A=g.useRef(""),D=g.useRef(p),O=g.useRef(!0),{settings:ee}=Vo(),{topLevelMessages:U,threadLookup:z}=g.useMemo(()=>{const j=new Map,q=[];return r.forEach(V=>{if(V.isThreadMessage&&V.parentMessageId){const I=j.get(V.parentMessageId)||[];j.set(V.parentMessageId,[...I,V]);return}q.push(V)}),{topLevelMessages:q,threadLookup:j}},[r]),H=()=>{if(!S.current)return;const{scrollTop:j,scrollHeight:q,clientHeight:V}=S.current,P=q-j-V<200;O.current=P},K=g.useCallback(()=>{requestAnimationFrame(()=>{S.current&&(S.current.scrollTop=S.current.scrollHeight)})},[]);return g.useEffect(()=>{const j=r.length,q=_.current,V=j>q,I=r[r.length-1],P=(I==null?void 0:I.content)||"",ue=P!==A.current,_e=(I==null?void 0:I.isStreaming)??!1;V||_e&&ue?(K(),O.current=!0):O.current&&ue&&K(),_.current=j,A.current=P},[r,K]),g.useEffect(()=>{p&&(K(),O.current=!0)},[p,K]),g.useEffect(()=>{if(D.current&&!p){const j=r[r.length-1];(j==null?void 0:j.role)==="assistant"&&j.content&&ii("messageReceived",ee.soundEnabled)}D.current=p},[p,r,ee.soundEnabled]),U.length===0?u.jsx("div",{className:"flex-1 flex items-center justify-center px-4 sm:px-6",children:u.jsxs("div",{className:"text-center text-lg text-gray-500 dark:text-[#bfc2cd]",children:[u.jsx("p",{className:"text-xl",children:"Your messages will appear here."}),u.jsx("p",{className:"mt-1 text-lg",children:"Start the conversation by sending a prompt below."})]})}):u.jsx("div",{ref:S,className:"message-list flex-1 overflow-y-auto pb-8 pt-4 sm:pt-6",onScroll:H,children:u.jsx("div",{className:"mx-auto w-full max-w-[96rem] px-3 sm:px-5 md:px-6 lg:px-8 xl:px-10",children:u.jsxs("div",{className:`message-list__rail mx-auto w-full space-y-7 ${x}`,children:[U.map(j=>u.jsx("div",{className:`flex w-full ${j.role==="user"?"justify-end":"justify-start"}`,style:{contentVisibility:"auto",containIntrinsicSize:"420px"},children:u.jsx(xv,{message:j,onRegenerate:l,onEdit:i,onStartThread:c,onClearThread:d,onSendThreadMessage:f,threadMessages:z.get(j.id),sessionId:h,isThreadSendDisabled:p,availableModels:v,defaultModel:b,selectedModel:w})},j.id)),u.jsx("div",{ref:k,className:"h-8"})]})})})}const Sv=4e3;function kv(r,l,i={}){var q;const[c,d]=g.useState(!1),[f,h]=g.useState(null),p=g.useRef(null),x=g.useRef(""),v=g.useRef(""),b=g.useRef(!1),w=g.useRef(null),k=typeof navigator<"u"?navigator.language:"en-US",S=Number.isFinite(i.silenceTimeoutMs)?Math.max(Math.floor(i.silenceTimeoutMs),1e3):Sv,_=((q=i.language)==null?void 0:q.trim())||k||"en-US",A=g.useCallback(V=>V.replace(/\s+/g," ").trim(),[]),D=g.useCallback(V=>{const I=A(V);I&&I!==v.current&&(v.current=I,r(I))},[A,r]),O=g.useCallback(()=>{if(!x.current)return;const V=x.current;x.current="",D(V)},[D]),ee=typeof window<"u"&&("webkitSpeechRecognition"in window||"SpeechRecognition"in window),U=g.useCallback(()=>{!l||b.current||(b.current=!0,l())},[l]),z=g.useCallback(()=>{w.current!==null&&(clearTimeout(w.current),w.current=null)},[]),H=g.useCallback(()=>{z(),w.current=setTimeout(()=>{ne("Speech recognition silence threshold reached, stopping recording"),p.current?p.current.stop():U()},S)},[z,U,S]),K=g.useCallback(()=>{if(!ee){h("Speech recognition is not supported in this browser. Please try Chrome, Edge, or Safari.");return}if(!p.current)try{b.current=!1;const V=window.SpeechRecognition||window.webkitSpeechRecognition,I=new V;I.continuous=!0,I.interimResults=!0,I.lang=_,I.maxAlternatives=1,I.onstart=()=>{d(!0),h(null),x.current="",v.current="",ne("Speech recognition started"),H()},I.onresult=P=>{let ue="",_e="";for(let te=P.resultIndex;te<P.results.length;te++){const oe=P.results[te][0].transcript;P.results[te].isFinal?ue+=oe:_e+=oe}_e&&(x.current=A(_e)),ue&&(x.current="",D(ue)),H()},I.onend=()=>{z(),O(),d(!1),p.current=null,ne("Speech recognition ended"),U()},I.onerror=P=>{switch(z(),Ie("Speech recognition error:",P.error),d(!1),p.current=null,x.current="",U(),P.error){case"no-speech":h("No speech detected. Please try again.");break;case"audio-capture":h("Microphone access denied. Please allow microphone access and try again.");break;case"not-allowed":h("Microphone access not allowed. Please enable microphone permissions.");break;case"network":h("Network error occurred. Please check your connection.");break;default:h(`Speech recognition error: ${P.error}`)}},I.start(),p.current=I}catch(V){Ie("Failed to start speech recognition:",V),h("Failed to start speech recognition. Please try again."),d(!1)}},[ee,O,U,H,z,_,A,D]),j=g.useCallback(()=>{if(ne("Stopping speech recognition..."),p.current){const V=p.current;V.onstart=null,V.onerror=null;try{V.stop()}catch(I){ne("Recognition already stopped or error stopping:",I),z(),O(),V.onend=null,V.onresult=null,p.current=null,d(!1),U()}}z(),d(!1),h(null),ne("Speech recognition stopped, isListening set to false")},[z,O,U]);return{isListening:c,isSupported:ee,startListening:K,stopListening:j,error:f}}const _v=300,Rp=3,No=5,Av=6e4;function Up(r){if(typeof r!="string")return null;const l=r.replace(/[\r\n\u2028\u2029]+/g," ").replace(/\s{2,}/g," ").trim();return l?{text:l}:null}function Cv(r,l={}){const{enabled:i=ug(),adapterName:c,sessionId:d,adapterSupportsAutocomplete:f,skill:h,inputRef:p}=l,[x,v]=g.useState([]),[b,w]=g.useState(!1),[k,S]=g.useState(-1),_=g.useRef(null),A=g.useRef(null),D=g.useRef(null),O=g.useRef(null),ee=g.useRef(null),U=g.useRef(0),z=g.useRef([]),H=g.useRef([]),K=g.useRef(new Map);g.useEffect(()=>{z.current=x},[x]);const j=g.useCallback(oe=>{const E=K.current.get(oe);return E?E<=Date.now()?(K.current.delete(oe),!1):!0:!1},[]),q=g.useCallback((oe,E=!0)=>{const Y=oe.toLowerCase().trim(),B=H.current.length>0?H.current:z.current;if(!Y)return B.slice(0,No);const re=B.filter(ce=>ce.text.toLowerCase().includes(Y));return re.length>0?re.slice(0,No):E?B.slice(0,No):[]},[]),V=g.useCallback(async oe=>{if(!i||oe.length<Rp){v([]),H.current=[],A.current&&clearTimeout(A.current),D.current&&clearTimeout(D.current),w(!1);return}if(!c){v([]),H.current=[],A.current&&clearTimeout(A.current),w(!1);return}if(f===!1||j(c)){v([]),H.current=[],A.current&&clearTimeout(A.current),w(!1);return}O.current&&O.current.abort(),O.current=new AbortController;const E=U.current+1;U.current=E,A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{E===U.current&&w(!0)},150);try{const Y={"X-Adapter-Name":c};d&&(Y["X-Session-ID"]=d);const B=new URLSearchParams;B.set("q",oe),B.set("limit",String(No)),h&&B.set("skill",h);const re=`/api/v1/autocomplete?${B.toString()}`,ce=await fetch(re,{method:"GET",headers:Y,signal:O.current.signal});if(!ce.ok){Fe("[useAutocomplete] Request failed:",ce.status),[404,405,501].includes(ce.status)?(K.current.set(c,Date.now()+Av),v([]),H.current=[]):v(q(oe));return}const ge=await ce.json(),pe=Array.isArray(ge==null?void 0:ge.suggestions)?ge.suggestions.map(G=>Up(typeof G=="string"?G:G==null?void 0:G.text)).filter(G=>G!==null):[];if(E!==U.current)return;pe.length===0?v(q(oe,!1)):(v(pe),H.current=pe),S(-1),ne("[useAutocomplete] Received",pe.length,"suggestions")}catch(Y){if(Y instanceof Error&&Y.name==="AbortError")return;Fe("[useAutocomplete] Error:",Y instanceof Error?Y.message:String(Y)),E===U.current&&v(q(oe))}finally{E===U.current&&(A.current&&(clearTimeout(A.current),A.current=null),w(!1))}},[i,c,d,f,h,q,j]);g.useEffect(()=>{_.current&&clearTimeout(_.current);const oe=()=>{O.current&&O.current.abort(),A.current&&clearTimeout(A.current),w(!1)},E=()=>{D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null,v([]),oe()},0)};if(!i||r.length<Rp||f===!1||c&&j(c)){E();return}if(ee.current){if(r===ee.current){E();return}ee.current=null}return _.current=setTimeout(()=>{V(r)},_v),()=>{_.current&&clearTimeout(_.current),D.current&&(clearTimeout(D.current),D.current=null)}},[r,V,i,c,f,j]),g.useEffect(()=>()=>{O.current&&O.current.abort(),A.current&&clearTimeout(A.current)},[]);const I=g.useCallback(()=>{S(oe=>{const E=z.current.length;return E===0?-1:oe<E-1?oe+1:0})},[]),P=g.useCallback(()=>{S(oe=>{const E=z.current.length;return E===0?-1:oe>0?oe-1:E-1})},[]),ue=g.useCallback(()=>{v([]),H.current=[],S(-1),O.current&&O.current.abort(),A.current&&clearTimeout(A.current),w(!1)},[]),_e=g.useCallback(oe=>{if(!(p!=null&&p.current))return;const E=()=>{const Y=p.current;if(!Y)return;const B=typeof oe=="string"?oe.length:Y.value.length;Y.focus({preventScroll:!0}),typeof Y.setSelectionRange=="function"&&Y.setSelectionRange(B,B)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(E):setTimeout(E,0)},[p]),te=g.useCallback(oe=>{ee.current=oe},[]);return{suggestions:x,isLoading:b,selectedIndex:k,setSelectedIndex:S,selectNext:I,selectPrevious:P,clearSuggestions:ue,focusInputAfterSelection:_e,suppressUntilQueryChange:te}}const Ol=new Map,jv=new Map,Nv=new Map,Tv=new Set,Ev=()=>{if(typeof window>"u")return null;try{return localStorage.getItem("chat-adapter-name")}catch{return null}},jg=r=>typeof r=="object"&&r!==null&&"message"in r,Mv=r=>r instanceof Error?r.message:typeof r=="string"?r:jg(r)?r.message??"Unknown error":"Unknown error";function zv({conversationId:r,onFilesSelected:l,onUploadError:i,onClose:c,onUploadingChange:d,onUploadSuccess:f,maxFiles:h=ze.maxFilesPerConversation,disabled:p=!1}){const[x,v]=g.useState(!1),[b,w]=g.useState(0),k=g.useRef(null),S=g.useRef(Nv),_=g.useRef(Tv),A=g.useRef(new Map),D=g.useRef(!0),O=g.useRef(jv),ee=g.useRef(r),U=Ye(G=>G.conversations),z=g.useMemo(()=>{if(!r)return new Map;const G=Ol.get(r);return G?new Map(G):new Map},[r,b]),H=g.useCallback(G=>{if(!G){d==null||d(null,!1),w(ye=>ye+1);return}const me=Ol.get(G)||new Map,de=U.find(ye=>ye.id===G),fe=new Map(me);if(de!=null&&de.attachedFiles){const ye=new Set(de.attachedFiles.filter(ae=>ae.processing_status==="completed"||ae.processing_status==="failed"||ae.processing_status==="error").map(ae=>ae.file_id));fe.forEach((ae,ie)=>{ae.fileId&&ye.has(ae.fileId)&&fe.delete(ie)})}fe.size>0?(Ol.set(G,fe),d==null||d(G,!0)):(Ol.delete(G),d==null||d(G,!1)),w(ye=>ye+1)},[U,d]);g.useEffect(()=>{ee.current=r,setTimeout(()=>{H(r)},0)},[r,H]),g.useEffect(()=>{r&&setTimeout(()=>{H(r)},0)},[U,r,H]);const K=g.useCallback((G,me)=>{if(!G)return;const de=Ol.get(G)||new Map,fe=me(new Map(de));fe.size>0?Ol.set(G,fe):Ol.delete(G),d==null||d(G,fe.size>0),w(ye=>ye+1)},[d]),j=g.useCallback((G,me)=>{if(!G)return;const de=O.current.get(G)||[],fe=me([...de||[]]),ye=new Set(de.map(ae=>ae.file_id));if(O.current.set(G,fe),l(G,fe),f){const ae=fe.filter(ie=>!ye.has(ie.file_id));ae.length>0&&f(G,ae)}w(ae=>ae+1)},[l,f]),q=Ye(G=>G.removeFileFromConversation),V=Ye(G=>G.addFileToConversation);g.useEffect(()=>(D.current=!0,()=>{D.current=!1}),[]);const I=g.useCallback(()=>{D.current=!1,new Map(A.current).forEach(me=>me.abort()),setTimeout(()=>{const me=Ye.getState(),de=new Map(me.conversations.map(ye=>[ye.id,ye])),fe=[];S.current.forEach((ye,ae)=>{var ie;if(ye){const xe=de.get(ye);if(new Set(((ie=xe==null?void 0:xe.attachedFiles)==null?void 0:ie.map(ve=>ve.file_id))||[]).has(ae)){_.current.add(ae),S.current.delete(ae);return}}if(_.current.has(ae)){ne(`[FileUpload] Skipping cleanup delete for ${ae}; file was previously attached and already handled`),S.current.delete(ae),_.current.delete(ae);return}fe.push({fileId:ae,conversationId:ye||null})}),fe.length>0&&(c==null||c(),fe.forEach(async({fileId:ye,conversationId:ae})=>{try{if(ae)await q(ae,ye);else{const ie=Ev();await di.deleteFile(ye,void 0,void 0,ie??void 0)}}catch(ie){if(jg(ie)){const xe=ie.message??"";!xe.includes("404")&&!xe.includes("File not found")&&Fe(`Failed to cleanup file ${ye} during component unmount:`,ie)}else Fe(`Failed to cleanup file ${ye} during component unmount`,ie)}}))},300)},[c,q]);g.useEffect(()=>I,[I]);const P=g.useCallback(async G=>{if(!G||G.length===0)return;const me=Array.from(G),de=Ye.getState(),fe=r||de.currentConversationId;if(!fe){i==null||i("Please select or create a conversation before uploading files.");return}const ye=de.conversations.find(Ne=>Ne.id===fe);if(!ye){i==null||i("Conversation not found. Please try again.");return}if((O.current.get(fe)||[]).length+me.length>h){const Ne=`Maximum ${h} files allowed per conversation. Please remove some files first.`;Ea()&&!vn()&&Ma.getState().openLoginPrompt(`You've reached the guest limit of ${h} files per conversation. Sign in to upload more files.`),i==null||i(Ne);return}if(ze.maxTotalFiles!==null&&de.conversations.reduce((Te,Le)=>{var qe;return Te+(((qe=Le.attachedFiles)==null?void 0:qe.length)||0)},0)+me.length>ze.maxTotalFiles){const Te=`Maximum ${ze.maxTotalFiles} total files allowed across all conversations. Please remove some files from other conversations first.`;Ea()&&!vn()&&Ma.getState().openLoginPrompt(`You've reached the guest limit of ${ze.maxTotalFiles} total files. Sign in to upload more files.`),i==null||i(Te);return}if(!ye.adapterName){i==null||i("Adapter not configured for this conversation. Please select an adapter first.");return}const ie=ye.adapterName,xe=Ta(ye.apiUrl);for(let Ne=0;Ne<me.length;Ne++){const ve=me[Ne],Te=new AbortController;A.current.set(ve.name,Te);const Le=`${fe}-${ve.name}-${Date.now()}-${Ne}`;let qe=null;try{const Be=await di.uploadFile(ve,Ge=>{if(K(fe,He=>(He.set(Le,Ge),He)),Ge.fileId&&!qe){qe=Ge.fileId,S.current.set(Ge.fileId,fe),_.current.add(Ge.fileId);const He={file_id:Ge.fileId,filename:ve.name,mime_type:ve.type||"application/octet-stream",file_size:ve.size,processing_status:Ge.status==="uploading"?"uploading":Ge.status==="processing"?"processing":Ge.status==="completed"?"completed":void 0};ne(`[FileUpload] Adding file ${Ge.fileId} to conversation ${fe} immediately (status: ${He.processing_status})`),V(fe,He)}},void 0,xe,ie).catch(Ge=>{if(Ge.message&&Ge.message.includes("was deleted")){qe&&S.current.delete(qe);const He=Ge.message.match(/File\s+([\w-]+)\s+was deleted/);return He&&He[1]&&S.current.delete(He[1]),ne(`File ${ve.name} was deleted during upload`),null}throw Ge});Be?(S.current.set(Be.file_id,fe),_.current.add(Be.file_id),ne(`[FileUpload] Updating file ${Be.file_id} in conversation ${fe} with final status`),V(fe,Be),Be.processing_status==="completed"||Be.processing_status==="failed"||Be.processing_status==="error"?K(fe,He=>(He.delete(Le),He)):K(fe,He=>{const vt=He.get(Le);return vt&&He.set(Le,{...vt,progress:90,status:"processing",fileId:Be.file_id}),He}),j(fe,He=>{if(new Set(He.map(se=>se.file_id)).has(Be.file_id))return He;const st=[...He,Be];return ne(`[FileUpload] Updated uploadedFiles for ${fe}: ${st.length} files`,st),st})):(Fe(`Upload completed for ${ve.name} but uploadedAttachment is null`),K(fe,Ge=>(Ge.delete(Le),Ge)))}catch(Be){const Ge=Mv(Be);if(Be instanceof DOMException&&Be.name==="AbortError"||Te.signal.aborted){ne(`Upload cancelled for ${ve.name}`),qe&&S.current.delete(qe);continue}if(Ge.includes("was deleted")){ne(`File ${ve.name} was deleted during upload`),qe&&S.current.delete(qe);const st=Ge.match(/File\s+([\w-]+)\s+was deleted/);st&&st[1]&&S.current.delete(st[1]);continue}D.current?(Ie(`Failed to upload file ${ve.name}:`,Be),Ie(`File type: ${ve.type}, File name: ${ve.name}`),i==null||i(Ge||`Failed to upload ${ve.name}`)):Fe(`Upload error for ${ve.name} (component unmounted):`,Ge),qe&&S.current.delete(qe);const He=Le,vt=fe;setTimeout(()=>{K(vt,st=>(st.delete(He),st))},5e3)}finally{A.current.delete(ve.name)}}},[V,r,h,i,j,K]),ue=g.useCallback(G=>{G.preventDefault(),G.stopPropagation(),p||v(!0)},[p]),_e=g.useCallback(G=>{G.preventDefault(),G.stopPropagation(),v(!1)},[]),te=g.useCallback(G=>{if(G.preventDefault(),G.stopPropagation(),v(!1),p)return;const me=G.dataTransfer.files;P(me)},[p,P]),oe=g.useCallback(G=>{const me=G.target.files;P(me),k.current&&(k.current.value="")},[P]),E=g.useCallback(()=>{!p&&k.current&&k.current.click()},[p]),Y=g.useCallback(G=>{p||(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),E())},[p,E]),B=z.size>0,re=g.useMemo(()=>{const G=new Map;return U.forEach(me=>{G.set(me.id,me.title||"Conversation")}),G},[U]),ce=g.useMemo(()=>{const G=[];return Ol.forEach((me,de)=>{de!==r&&me.size>0&&G.push({conversationId:de,uploads:Array.from(me.entries()).map(([fe,ye])=>({key:fe,progress:ye}))})}),G},[r,b]),ge=(G,me)=>{const de=G.status==="error";return u.jsxs("div",{className:`group relative w-full flex items-center gap-3 rounded-lg px-3 py-2.5 overflow-hidden transition-colors ${de?"border border-red-200 bg-red-50 dark:border-red-500/30 dark:bg-[#101010]":"border border-gray-200 bg-gray-50 dark:border-[#242424] dark:bg-[#101010]"}`,children:[!de&&u.jsx("div",{className:"absolute inset-0 bg-blue-50 dark:bg-white/[0.04] transition-all duration-500 ease-out rounded-lg",style:{width:`${G.progress}%`}}),u.jsxs("div",{className:"relative flex items-center gap-3 w-full min-w-0",children:[u.jsx("div",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md ${de?"bg-red-100 dark:bg-red-500/15":"bg-blue-100 dark:bg-white/[0.06]"}`,children:de?u.jsx(Do,{className:"h-4 w-4 text-red-500 dark:text-red-400"}):u.jsx(Lo,{className:"h-4 w-4 text-blue-600 dark:text-blue-400 animate-spin"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"text-sm font-medium text-[#353740] dark:text-[#ececf1] truncate",children:G.filename}),de?u.jsx("p",{className:"mt-0.5 text-xs text-red-600 dark:text-red-400 truncate",children:G.error||"Processing failed"}):u.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[u.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-[#242424] rounded-full h-1",children:u.jsx("div",{className:"bg-blue-500 dark:bg-blue-400 h-1 rounded-full transition-all duration-500 ease-out",style:{width:`${G.progress}%`}})}),u.jsxs("span",{className:"text-[11px] tabular-nums text-gray-400 dark:text-[#8e8ea0] shrink-0",children:[Math.round(G.progress),"%"]})]})]}),u.jsx("span",{className:`text-xs font-medium shrink-0 ${de?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-[#bfc2cd]"}`,children:G.status==="uploading"?"Uploading":G.status==="processing"?"Processing":G.status==="completed"?"Done":"Failed"})]})]},me)},pe=u.jsx("div",{className:"w-full max-w-full overflow-hidden space-y-1.5",role:"status","aria-live":"polite",children:Array.from(z.entries()).map(([G,me])=>ge(me,G))});return u.jsxs("div",{className:"w-full max-w-full overflow-hidden space-y-2",children:[B&&pe,!B&&u.jsxs("button",{type:"button",onClick:E,onKeyDown:Y,onDragOver:ue,onDragLeave:_e,onDrop:te,disabled:p,className:`
|
|
335
|
-
group relative w-full max-w-full rounded-lg border p-4 transition-all duration-200 text-left overflow-hidden
|
|
336
|
-
${x?"border-blue-300 bg-blue-50 ring-2 ring-blue-400 ring-inset dark:border-blue-500/40 dark:bg-[#101010] dark:ring-blue-500":p?"border-gray-200 bg-gray-50 cursor-not-allowed opacity-50 dark:border-[#242424] dark:bg-[#101010]":"border-gray-200 bg-gray-50 hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 focus-visible:ring-inset dark:border-[#242424] dark:bg-[#101010] dark:hover:bg-[#1a1a1a]"}
|
|
337
|
-
`,"aria-label":p?"File upload disabled":"Upload files",children:[u.jsx("input",{ref:k,type:"file",multiple:!0,onChange:oe,className:"hidden",disabled:p,accept:".pdf,.doc,.docx,.txt,.md,.csv,.json,.html,.pptx,.xlsx,.py,.java,.sql,.js,.mjs,.ts,.tsx,.cpp,.cxx,.cc,.c,.h,.hpp,.go,.rs,.rb,.php,.sh,.bash,.zsh,.yaml,.yml,.xml,.css,.scss,.sass,.less,.png,.jpg,.jpeg,.tiff,.webp,.wav,.mp3,.mp4,.ogg,.flac,.webm,.m4a,.aac,.vtt"}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg transition-colors duration-200 ${x?"bg-blue-100 dark:bg-blue-500/15":"bg-gray-200/70 dark:bg-[#1a1a1a] group-hover:bg-blue-100 dark:group-hover:bg-[#242424]"}`,children:u.jsx(ob,{className:`h-5 w-5 transition-colors duration-200 ${x?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-[#8e8ea0] group-hover:text-blue-500 dark:group-hover:text-blue-400"}`})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:`text-sm font-medium transition-colors duration-200 ${x?"text-blue-700 dark:text-blue-300":"text-[#353740] dark:text-[#ececf1]"}`,children:p?"File upload disabled":x?"Drop files here":"Drop files or click to browse"}),u.jsxs("p",{className:"text-xs text-gray-400 dark:text-[#8e8ea0] mt-0.5",children:["PDF, DOCX, TXT, CSV, code files, images, audio · max ",h," files"]})]})]})]}),ce.length>0&&u.jsxs("div",{className:"w-full max-w-full space-y-2 rounded-lg border border-gray-200 bg-gray-50 p-2.5 dark:border-[#242424] dark:bg-[#101010]",children:[u.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-[#8e8ea0] px-1",children:"Other conversations"}),ce.map(({conversationId:G,uploads:me})=>u.jsxs("div",{className:"space-y-1.5",children:[u.jsx("div",{className:"text-[11px] font-medium text-gray-400 dark:text-[#6b6f7a] px-1",children:re.get(G)||"Conversation"}),me.map(({key:de,progress:fe})=>ge(fe,de))]},G))]})]})}const Op={"image/jpeg":"jpg","image/jpg":"jpg","image/png":"png","image/tiff":"tiff","image/tif":"tif","image/gif":"gif","image/webp":"webp","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/msword":"doc","text/plain":"txt","text/markdown":"md","application/json":"json"},To=4,Eo=3,Dv=0,Lv=0,td=2;function Rv(r){if(!r||typeof r!="object")return null;const l=r,i=["supportsAutocomplete","isAutocompleteSupported","autocompleteSupported"];for(const f of i)if(typeof l[f]=="boolean")return l[f];const c=["capabilities","features"],d=["autocomplete","supportsAutocomplete","autocomplete_supported"];for(const f of c){const h=l[f];if(!h||typeof h!="object")continue;const p=h;for(const x of d)if(typeof p[x]=="boolean")return p[x]}return null}function Uv(r){if(!r)return"bin";if(Op[r])return Op[r];const l=r.split("/");return l.length===2&&l[1]?l[1]:"bin"}function Ov(r){return r.replace(/[^a-zA-Z0-9._-]/g,"_").replace(/_+/g,"_")||"pasted-file"}function $v(r){const l=r.lastIndexOf(".");return l===-1||l===r.length-1?null:r.slice(l+1).toLowerCase()}function qv(r){const l=r.lastIndexOf(".");return l===-1?r:r.slice(0,l)}function Bv(r,l){const i=Date.now(),c=r.name&&r.name.trim().length>0?r.name.trim():"pasted-file",d=Ov(qv(c)),h=$v(c)||Uv(r.type),p=`${d}-${i}-${l}.${h}`;return new File([r],p,{type:r.type||"application/octet-stream"})}function $p({onSend:r,disabled:l=!1,placeholder:i=og(),autoFocusEnabled:c=!0,suppressMobileAutoFocus:d=!1,isCentered:f=!1,maxWidthClass:h="max-w-5xl",adapterNotes:p,skillState:x,availableModels:v=[],defaultModel:b=null,selectedModel:w=null,onSelectModel:k}){var gi;const[S,_]=g.useState(""),[A,D]=g.useState(!1),[O,ee]=g.useState(!1),[U,z]=g.useState(!1),[H,K]=g.useState(!1),[j,q]=g.useState([]),[V,I]=g.useState({}),[P,ue]=g.useState(new Map),[_e,te]=g.useState(!1),[oe,E]=g.useState(!1),[Y,B]=g.useState(null),[re,ce]=g.useState(null),[ge,pe]=g.useState(null),[G,me]=g.useState({isOpen:!1,fileId:"",filename:"",isDeleting:!1}),de=g.useRef(null),fe=g.useRef(null),ye=g.useRef(null),ae=g.useRef(null),ie=g.useRef(null),xe=g.useRef(new Set),Ne=g.useRef(""),ve=g.useRef(!1),Te=g.useRef(0),Le=g.useRef(null),{settings:qe,updateSettings:Be}=Vo(),{theme:Ge,isDark:He}=cs(),vt=Ge.mode==="dark"?"dark":Ge.mode==="light"?"light":"",st=He?"dark":"light";ui(fe,{enabled:U,onEscape:()=>z(!1)});const se=g.useCallback((N,le)=>{N&&I(Ce=>{if(Ce[N]===le)return Ce;const Oe={...Ce};return le?Oe[N]=!0:delete Oe[N],Oe})},[]),[Ee,zt]=g.useState(0),[we,Xt]=g.useState(!1),[sn,Dt]=g.useState(0),[Ft,Hl]=g.useState(()=>({top:To+Eo,bottom:Math.max(To-Eo,0)})),[ya,wn]=g.useState(null),On=us(),Lt=Ea()&&!On,_t=Ma(N=>N.showLoginPrompt),{createConversation:ia,currentConversationId:Re,conversations:oa,isLoading:za,syncConversationFiles:Me,stopStreaming:Qe,removeFileFromConversation:it}=Ye(),be=oa.find(N=>N.id===Re),It=be?be.messages.filter(N=>!(N.role==="assistant"&&N.isStreaming)).length:0,Rt=oa.reduce((N,le)=>N+le.messages.filter(Ce=>!(Ce.role==="assistant"&&Ce.isStreaming)).length,0),on=!!be&&ze.maxMessagesPerConversation!==null&&It>=ze.maxMessagesPerConversation,da=ze.maxTotalMessages!==null&&Rt>=ze.maxTotalMessages,sl=g.useCallback(()=>{zt(N=>N+1)},[]),il=ly(),Ga=ry(),{isListening:ca,isSupported:Fl,startListening:Il,stopListening:$n,error:cn}=kv(N=>{_(le=>{const Ce=le.length>0&&!/\s$/.test(le)?" ":"",Oe=(le+Ce+N).slice(0,ze.maxMessageLength);return Ne.current=Oe,Oe})},sl,{silenceTimeoutMs:il,language:Ga||void 0}),qn=ty(),un=ay(),fa=un&&Fl,Kt=ey(),jt=ug(),Ut=Rv(be==null?void 0:be.adapterInfo),{skills:va,isLoading:Gl,selectedSkill:Gt,selectSkill:Vl,clearSkill:Sn}=x,kn=(be==null?void 0:be.adapterName)||null,{suggestions:Va,selectedIndex:Yt,setSelectedIndex:wa,selectNext:Bn,selectPrevious:_n,clearSuggestions:ot,focusInputAfterSelection:Xl,suppressUntilQueryChange:ol}=Cv(S,{enabled:jt&&!ca,apiUrl:be==null?void 0:be.apiUrl,adapterName:kn,sessionId:be==null?void 0:be.sessionId,adapterSupportsAutocomplete:Ut,skill:(Gt==null?void 0:Gt.name)||null,inputRef:de}),Sa=Va.length>0,Xa=!ca,W=Xa&&Sa&&!we,$e=S.startsWith("/")?S.slice(1):"",he=$e.toLowerCase().replace(/-/g," "),Ze=he?va.filter(N=>N.name.replace(/-/g," ").toLowerCase().includes(he)||N.description.toLowerCase().includes(he)):va,Jt=Ze.length>0?Math.min(sn,Ze.length-1):0,Ot=Ze[Jt]??null,Pt=(Ot==null?void 0:Ot.name.replace(/-/g," "))??"",ka=we&&Ot&&S.startsWith("/")&&Pt.toLowerCase().startsWith($e.toLowerCase())&&Pt.length>$e.length?Pt.slice($e.length):null,mi=Yt>=0?Yt:0,Yl=Sa?Va[mi]:null,xr=g.useMemo(()=>{if(!Yl)return null;const N=Yl.text||"";if(!S)return N;const le=S;return N.toLowerCase().startsWith(le.toLowerCase())&&N.length>le.length?N.slice(le.length):null},[Yl,S]),br=ka??xr,yr=S.trim().length===0&&!br,Jo=g.useCallback(N=>{if(!S)return u.jsx("span",{className:"line-clamp-1 text-current",children:N});if(!N.toLowerCase().startsWith(S.toLowerCase()))return u.jsx("span",{className:"line-clamp-1 text-current",children:N});const le=N.slice(0,S.length),Ce=N.slice(S.length);return u.jsxs("span",{className:"line-clamp-1",children:[u.jsx("span",{className:"text-gray-500 dark:text-[#8e8ea0]",children:le}),u.jsx("span",{className:"font-semibold text-[#353740] dark:text-[#ececf1]",children:Ce})]})},[S]),ma=g.useCallback(N=>{var le;Vl(N),Xt(!1),_(""),ot(),Dt(0),(le=de.current)==null||le.focus()},[ot,Vl]),ds=g.useCallback(()=>{var N;_("/"),Xt(!0),Dt(0),(N=de.current)==null||N.focus()},[]),fs=g.useCallback(()=>{var N;Xt(!1),_(""),Dt(0),(N=de.current)==null||N.focus()},[]),dn=g.useCallback(()=>{const N=de.current;if(!N||typeof window>"u")return;const le=Ra=>{const jr=Ra+Eo,Nr=Math.max(Ra-Eo,0);N.style.paddingTop=`${jr}px`,N.style.paddingBottom=`${Nr}px`,Hl({top:jr,bottom:Nr})},Ce=window.getComputedStyle(N),Oe=parseFloat(Ce.lineHeight||"0");if(!Number.isNaN(Oe)&&Oe>0?wn(Ra=>Ra===Oe?Ra:Oe):wn(Ra=>Ra===null?Ra:null),!Oe||Number.isNaN(Oe)){le(To);return}const lt=N.scrollHeight,Wt=N.clientHeight;if(lt>Oe+2){le(To);return}const tt=Math.max(Wt-Oe,0),hn=Math.max(tt/2,0);le(hn)},[]),cl=()=>{const N=de.current;return N?N.selectionStart===N.selectionEnd&&N.selectionStart===S.length:!1},ms=(be==null?void 0:be.attachedFiles)||[],fn=Re?ms:j,ul=oa.reduce((N,le)=>{var Ce;return N+(((Ce=le.attachedFiles)==null?void 0:Ce.length)||0)},0),hi=ze.maxFilesPerConversation!==null&&ze.maxFilesPerConversation>0&&ms.length>=ze.maxFilesPerConversation,hs=ze.maxTotalFiles!==null&&ul>=ze.maxTotalFiles,dl=((gi=be==null?void 0:be.adapterInfo)==null?void 0:gi.isFileSupported)??!1,Ql=fn.some(N=>N.processing_status?N.processing_status!=="completed"&&N.processing_status!=="error"&&N.processing_status!=="failed":!0),ha=Re?!!V[Re]:!1,vr=Object.values(V).some(Boolean),fl=S.trim().length>0,Ya=on||da,wt=l||Ql||ha||Ya,wr=Kt&&dl,mn=hi||hs,Qa=!wr||wt||mn;g.useLayoutEffect(()=>{if(de.current){const N=de.current,le=120;N.style.height="auto";const Ce=N.scrollHeight;N.style.height=`${Math.min(Ce,le)}px`,N.style.overflowY=Ce>le?"auto":"hidden",dn()}},[S,dn]),g.useEffect(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;const N=de.current;if(!N)return;const le=new ResizeObserver(()=>{dn()});return le.observe(N),()=>{le.disconnect()}},[dn]);const ps=()=>{const N=document.activeElement;return N&&N.tagName==="TEXTAREA"},ml=g.useCallback(()=>!d||typeof window>"u"?!1:window.matchMedia("(max-width: 767px)").matches,[d]);g.useEffect(()=>{ml()||c&&!wt&&de.current&&!ps()&&de.current.focus()},[c,wt,d,ml]);const Sr=g.useRef(za);g.useEffect(()=>{if(ml()){Sr.current=za;return}c&&Sr.current&&!za&&!wt&&de.current&&setTimeout(()=>{de.current&&!ps()&&de.current.focus()},100),Sr.current=za},[c,za,wt,d,ml]),g.useEffect(()=>{if(!fa||(Ee>Te.current&&(ve.current=!0,Te.current=Ee),!ve.current||Ee===0))return;const N=Ne.current.trim(),le=Ye.getState();if(ne("[MessageInput] Auto-send check after voice completion:",{hasMessage:!!N,isInputDisabled:wt,isComposing:A,isLoading:le.isLoading}),ve.current=!1,!N)return;if(wt||A){ne("[MessageInput] Auto-send skipped because input is currently disabled or composing");return}const Ce=le.conversations.find(dt=>dt.id===le.currentConversationId),lt=((Ce==null?void 0:Ce.attachedFiles)||[]).map(dt=>dt.file_id),Wt=Gt==null?void 0:Gt.name;ne("[MessageInput] Auto-sending voice message immediately:",N),r(N,lt.length>0?lt:void 0,void 0,Wt),Wt&&Sn(),setTimeout(()=>{Xt(!1)},0),ot(),setTimeout(()=>{_("")},0),Ne.current="",de.current&&(de.current.style.height="auto",de.current.style.overflowY="hidden",dn())},[fa,Ee,wt,A,r,Gt,Sn,dn,ot]),g.useEffect(()=>{ha&&H&&setTimeout(()=>{K(!1)},0)},[ha,H]),g.useEffect(()=>{!ha&&fn.length},[ha,H,fn.length]);const An=g.useCallback((N,le)=>{setTimeout(()=>{let Ce=Ye.getState(),Oe=le||Ce.currentConversationId;if(Oe||(Oe=ia(),Ce=Ye.getState(),Oe=Ce.currentConversationId||Oe),!Oe){Ie("[MessageInput] Unable to sync files: conversation ID missing");return}const lt=new Set(N.map(dt=>dt.file_id)),Wt=[];xe.current.forEach((dt,tt)=>{const[,...hn]=tt.split("-"),Ra=hn.join("-");lt.has(Ra)||Wt.push(tt)}),Wt.forEach(dt=>xe.current.delete(dt)),N.forEach(dt=>{const tt=`${Oe}-${dt.file_id}`;xe.current.has(tt)||(xe.current.add(tt),ne(`[MessageInput] Adding file ${dt.file_id} to conversation ${Oe}`),Ce.addFileToConversation(Oe,dt))})},0)},[ia]);g.useEffect(()=>{if(Re!==Le.current)if(Le.current=Re||null,Re&&be){const N=be.attachedFiles||[];setTimeout(()=>{q(N.map(le=>({...le})))},0)}else setTimeout(()=>{q([])},0)},[Re,be]),g.useEffect(()=>{if(Re&&be){const N=be.attachedFiles||[];N.length>0?setTimeout(()=>{q(le=>{const Ce=new Set(le.map(lt=>lt.file_id)),Oe=N.filter(lt=>!Ce.has(lt.file_id));return Oe.length>0?(ne(`[MessageInput] Syncing ${Oe.length} missing files from conversation to UI`),[...le,...Oe]):le})},0):N.length===0&&j.length>0&&setTimeout(()=>{q([])},0)}},[Re,be,oa,j.length]);const Da=g.useRef(null),Zl=g.useRef(""),Cn=(be==null?void 0:be.attachedFiles)||[],La=Cn.length>0?`${Cn.length}:${Cn.map(N=>N.file_id).join("|")}`:"",kr=Cn.some(N=>!N.processing_status||N.processing_status==="processing"||N.processing_status==="uploading");g.useEffect(()=>{if(!Re||!(be!=null&&be.adapterName))return;const N=La!=="";if(N&&(Da.current!==Re||Zl.current!==La)?(ne(`[MessageInput] Syncing files for conversation ${Re}...`),Da.current=Re,Zl.current=La,Me(Re).catch(Oe=>{Ie("[MessageInput] Failed to sync conversation files:",Oe)})):N||(Da.current=Re,Zl.current=""),!kr)return;ne("[MessageInput] Files still processing, starting poll...");const Ce=setInterval(async()=>{const lt=Ye.getState().conversations.find(tt=>tt.id===Re);if(!lt){clearInterval(Ce);return}if((lt.attachedFiles||[]).filter(tt=>!tt.processing_status||tt.processing_status==="processing"||tt.processing_status==="uploading").length===0){ne("[MessageInput] All files completed processing, stopping poll"),clearInterval(Ce);return}try{await Me(Re)}catch(tt){Ie("[MessageInput] Failed to poll file status:",tt)}},3e3);return()=>{clearInterval(Ce)}},[Re,be==null?void 0:be.adapterName,La,kr,Me]),g.useEffect(()=>{setTimeout(()=>{I(N=>{const le=new Set(oa.map(lt=>lt.id));let Ce=!1;const Oe={...N};return Object.keys(Oe).forEach(lt=>{le.has(lt)||(delete Oe[lt],Ce=!0)}),Ce?Oe:N})},0)},[oa]);const Kl=N=>{if(N.preventDefault(),fl&&!wt&&!A){ca&&$n();const Ce=((be==null?void 0:be.attachedFiles)||[]).map(lt=>lt.file_id),Oe=Gt==null?void 0:Gt.name;r(S.trim(),Ce.length>0?Ce:void 0,void 0,Oe),Oe&&Sn(),Xt(!1),ii("messageSent",qe.soundEnabled),_(""),Ne.current="",q([]),K(!1),de.current&&(de.current.style.height="auto",de.current.style.overflowY="hidden",dn())}},Jl=g.useCallback(N=>{if(!N||N.length===0)return;const le=N.length===1?`File "${N[0].filename}" uploaded successfully`:`${N.length} files uploaded successfully`;ii("success",qe.soundEnabled),ce(le),setTimeout(()=>{ce(null)},6e3)},[qe.soundEnabled]),_r=g.useCallback((N,le)=>{ne(`[MessageInput] handleFilesSelected called with ${le.length} files for conversation ${N}:`,le),N&&(N===Re&&q(le),An(le,N))},[Re,An]),Ar=g.useCallback((N,le)=>{N===Re&&Jl(le)},[Re,Jl]),pi=g.useCallback(N=>{me({isOpen:!0,fileId:N.file_id,filename:N.filename,isDeleting:!1})},[]),ua=g.useCallback(()=>{me(N=>N.isDeleting?N:{isOpen:!1,fileId:"",filename:"",isDeleting:!1})},[]),Hn=g.useCallback(async()=>{if(!(!Re||!G.fileId)){me(N=>({...N,isDeleting:!0}));try{await it(Re,G.fileId),q(N=>N.filter(le=>le.file_id!==G.fileId)),me({isOpen:!1,fileId:"",filename:"",isDeleting:!1})}catch(N){const le=N instanceof Error?N.message:"Failed to remove file";Ie("[MessageInput] Failed to remove file:",N),pe(le),me({isOpen:!1,fileId:"",filename:"",isDeleting:!1})}}},[Re,G.fileId,it]),Pl=g.useCallback(N=>N.replace(/\s+/g," ").trim(),[]),jn=g.useCallback(N=>{const le=Pl(N);_(le),ot(),ol(le),Xl(le)},[ot,Xl,Pl,ol]),gs=g.useCallback(N=>{if(N<0)return;const le=Va[N]||Va[0];le&&jn(le.text)},[Va,jn]),xs=N=>{if(we){if(N.key==="ArrowDown"){N.preventDefault(),Dt(le=>Ze.length===0?0:(le+1)%Ze.length);return}if(N.key==="ArrowUp"){N.preventDefault(),Dt(le=>Ze.length===0?0:(le-1+Ze.length)%Ze.length);return}if(N.key==="Home"){N.preventDefault(),Dt(0);return}if(N.key==="End"){N.preventDefault(),Dt(Math.max(Ze.length-1,0));return}if((N.key==="Enter"&&!N.shiftKey||N.key==="Tab")&&Ot){N.preventDefault(),ma(Ot);return}if(N.key==="Escape"){N.preventDefault(),fs();return}}if(Sa&&Xa){if(N.key==="ArrowDown"){N.preventDefault(),Bn();return}if(N.key==="ArrowUp"){N.preventDefault(),_n();return}if(N.key==="Tab"){N.preventDefault();const le=Yt>=0?Yt:0;gs(le);return}if(N.key==="ArrowRight"&&cl()){if(xr&&Yl){N.preventDefault(),jn(Yl.text);return}if(Yt>=0){N.preventDefault(),gs(Yt);return}}if(N.key==="Enter"&&Yt>=0){N.preventDefault(),gs(Yt);return}if(N.key==="Escape"){N.preventDefault(),ot();return}}N.key==="Enter"&&!N.shiftKey&&!A&&(N.preventDefault(),Kl(N))},bs=()=>{ca?$n():(ot(),Il())},Wl=()=>{const N=!qe.voiceEnabled;Be({voiceEnabled:N}),N&&ql.enableAudio()},Cr=g.useCallback(async N=>{if(!Kt||!O||!dl||wt)return;const le=N.clipboardData;if(!le||!le.items)return;const Oe=Array.from(le.items).filter(dt=>dt.kind==="file");if(Oe.length===0)return;const lt=[];if(Oe.forEach((dt,tt)=>{const hn=dt.getAsFile();hn&<.push(Bv(hn,tt))}),lt.length===0)return;N.preventDefault(),B(null),ce(null);let Wt=null;try{const dt=Ye.getState(),tt=dt.conversations.find(pa=>pa.id===dt.currentConversationId);if(((tt==null?void 0:tt.attachedFiles)||[]).length+lt.length>ze.maxFilesPerConversation)throw Lt&&Ma.getState().openLoginPrompt(`You've reached the guest limit of ${ze.maxFilesPerConversation} files per conversation. Sign in to upload more files.`),new Error(`Maximum ${ze.maxFilesPerConversation} files allowed per conversation. Please remove some files first.`);if(ze.maxTotalFiles!==null&&dt.conversations.reduce((Za,pn)=>{var ea;return Za+(((ea=pn.attachedFiles)==null?void 0:ea.length)||0)},0)+lt.length>ze.maxTotalFiles)throw Lt&&Ma.getState().openLoginPrompt(`You've reached the guest limit of ${ze.maxTotalFiles} total files. Sign in to upload more files.`),new Error(`Maximum ${ze.maxTotalFiles} total files allowed across all conversations. Please remove some files from other conversations first.`);if(!tt)throw new Error("Conversation not found. Please select a conversation first.");if(!tt.adapterName)throw new Error("Adapter not configured for this conversation. Please select an adapter first.");const jr=Ta(tt.apiUrl),Nr=tt.adapterName;Wt=tt.id,se(Wt,!0);const hl=[],xi=[];for(let pa=0;pa<lt.length;pa++){const Za=lt[pa],pn=Za.name||`Clipboard file ${pa+1}`,ea=`${pn}-${Date.now()}-${pa}`;ue(Ua=>{const Ka=new Map(Ua);return Ka.set(ea,{filename:pn,progress:0,status:"uploading"}),Ka});const Wo=Ua=>{ue(Ka=>{const Qt=new Map(Ka),er=Qt.get(ea);return er&&Qt.set(ea,{...er,filename:pn,progress:Ua.progress,status:Ua.status,fileId:Ua.fileId}),Qt})},ec=()=>new Promise(Ua=>{ue(Ka=>{const Qt=new Map(Ka),er=Qt.get(ea);return er&&Qt.set(ea,{...er,progress:100,status:"completed"}),Qt}),setTimeout(()=>{ue(Ka=>{const Qt=new Map(Ka);return Qt.delete(ea),Qt}),Ua()},2500)});ne(`[MessageInput] Pasting file: ${Za.name}, type: ${Za.type||"unknown"}, size: ${Za.size}`);const tc=await di.uploadFile(Za,Ua=>{ne(`[MessageInput] Paste upload progress for ${Za.name}: ${Ua.progress}% - ${Ua.status}`),Wo(Ua)},void 0,jr,Nr);hl.push(tc),xi.push(ec())}if(hl.length>0){let pa=hl;if(Wt&&Wt===Re){const Za=new Set(j.map(ea=>ea.file_id)),pn=hl.filter(ea=>!Za.has(ea.file_id));pn.length>0?(q(ea=>[...ea,...pn]),pa=pn):pa=[]}pa.length>0&&An(pa,Wt),await Promise.all(xi),Jl(hl)}}catch(dt){const tt=dt instanceof Error?dt.message:"Failed to paste file";Ie("[MessageInput] Paste error:",dt),ii("error",qe.soundEnabled),B(tt),tt.toLowerCase().includes("maximum")&&pe(tt),setTimeout(()=>{B(null)},5e3),ue(new Map)}finally{se(Wt,!1)}},[j,Re,O,dl,Lt,wt,se,qe.soundEnabled,Jl,An,Kt]),ys=Zb(be==null?void 0:be.adapterName),vs=da?Lt?`Guest limit of ${ze.maxTotalMessages} messages reached. Sign in for higher limits.`:`Workspace limit of ${ze.maxTotalMessages} messages reached. Delete or archive old conversations to continue.`:on?Lt?`Guest limit of ${ze.maxMessagesPerConversation} messages reached. Sign in for higher limits.`:`This chat hit the ${ze.maxMessagesPerConversation} message limit. Start a new conversation to continue.`:Ql||ha?"Files are uploading, please wait...":ys||(wr?"Message ORBIT or drop files here":i),Fn=[];da&&ze.maxTotalMessages!==null&&(Lt?_t&&Fn.push(`Guest limit of ${ze.maxTotalMessages} total messages reached. Sign in for higher limits, or delete conversations to start over.`):Fn.push(`Workspace limit of ${ze.maxTotalMessages} total messages reached. Delete or export older conversations to continue.`)),on&&ze.maxMessagesPerConversation!==null&&(Lt?_t&&Fn.push(`Guest limit of ${ze.maxMessagesPerConversation} messages per conversation reached. Sign in for higher limits, or delete conversations to start over.`):Fn.push(`This conversation reached the ${ze.maxMessagesPerConversation} message limit. Start a new conversation to keep chatting.`)),ge&&Fn.push(ge),g.useEffect(()=>{!un||!cn||ii("error",qe.soundEnabled)},[un,qe.soundEnabled,cn]),g.useEffect(()=>{if(!ge)return;const N=setTimeout(()=>pe(null),5e3);return()=>clearTimeout(N)},[ge]),g.useEffect(()=>{var N;(H||ha||P.size>0||vr)&&((N=ye.current)==null||N.scrollIntoView({behavior:"smooth",block:"nearest"}))},[H,ha,P.size,vr]),g.useEffect(()=>{var N;W&&((N=ae.current)==null||N.scrollIntoView({behavior:"smooth",block:"nearest"}))},[W]),g.useEffect(()=>{var N;we&&((N=ie.current)==null||N.scrollIntoView({behavior:"smooth",block:"end"}))},[we,Ze.length]);const ws=h,Po=f?"flex justify-center":"";return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:`bg-transparent px-2 py-1.5 md:bg-transparent md:px-0 md:pt-4 md:pb-2 md:dark:bg-transparent sm:px-4 ${Po}`,children:u.jsxs("div",{className:`mx-auto w-full ${ws}`,children:[cn&&un&&u.jsxs("div",{role:"alert","aria-live":"assertive",className:"mb-2.5 w-full flex items-start gap-2.5 rounded-lg bg-red-50 dark:bg-red-950/40 px-3.5 py-2.5 animate-fadeIn",children:[u.jsx(Do,{className:"h-4 w-4 mt-0.5 flex-shrink-0 text-red-500 dark:text-red-400"}),u.jsx("span",{className:"text-sm text-red-700 dark:text-red-300",children:cn})]}),Y&&u.jsxs("div",{role:"alert","aria-live":"assertive",className:"mb-2.5 w-full flex items-start gap-2.5 rounded-lg bg-red-50 dark:bg-red-950/40 px-3.5 py-2.5 animate-fadeIn",children:[u.jsx(Do,{className:"h-4 w-4 mt-0.5 flex-shrink-0 text-red-500 dark:text-red-400"}),u.jsx("span",{className:"text-sm text-red-700 dark:text-red-300",children:Y})]}),re&&u.jsxs("div",{role:"status","aria-live":"polite",className:"mb-2.5 w-full flex items-center gap-2.5 rounded-lg bg-gray-50 dark:bg-[#1f1f24] px-3.5 py-2.5 animate-fadeIn",children:[u.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-emerald-100 dark:bg-emerald-900/40",children:u.jsx(Lx,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})}),u.jsx("span",{className:"text-sm text-[#353740] dark:text-[#ececf1]",children:re})]}),Fn.length>0&&u.jsxs("div",{role:"status","aria-live":"polite",className:"mb-2.5 w-full flex items-start gap-2.5 rounded-lg bg-amber-50 dark:bg-amber-950/30 px-3.5 py-2.5 animate-fadeIn",children:[u.jsx(wd,{className:"h-4 w-4 mt-0.5 flex-shrink-0 text-amber-500 dark:text-amber-400"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("ul",{className:"list-none space-y-0.5",children:Fn.map((N,le)=>u.jsx("li",{className:"text-sm text-amber-800 dark:text-amber-200",children:N},`${N}-${le}`))}),Lt&&(Ya||mn)&&_t&&u.jsx("button",{type:"button",onClick:()=>Ma.getState().openLoginPrompt("Sign in to unlock higher message limits and more conversations."),className:"mt-2 inline-flex items-center gap-1.5 rounded-md bg-[#353740] px-3 py-1.5 text-xs font-medium text-white hover:bg-[#40414f] dark:bg-white dark:text-[#353740] dark:hover:bg-gray-200 transition-colors",children:"Sign in for higher limits"})]})]}),u.jsxs("div",{className:"relative w-full",children:[u.jsxs("form",{onSubmit:Kl,className:"flex w-full flex-col gap-2 md:gap-3",children:[u.jsxs("div",{className:`flex flex-row items-center gap-1.5 md:gap-2 rounded-xl md:rounded-lg border px-2.5 py-1.5 md:px-4 md:py-3 shadow-sm transition-all ${O?"border-gray-400 shadow-md dark:border-[#3a3a3a] dark:shadow-lg":"border-gray-300 dark:border-[#242424]"} bg-gray-50 dark:bg-[#111111]`,children:[Gt&&u.jsxs("div",{className:"flex h-8 max-w-[45%] shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs text-gray-700 shadow-sm dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-200 sm:max-w-[38%] md:max-w-[32%]",children:[u.jsx(vd,{className:"h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":"true"}),u.jsx("span",{className:"min-w-0 truncate font-medium capitalize",children:Gt.name.replace(/-/g," ")}),u.jsx("button",{type:"button",onClick:()=>{var N;Sn(),(N=de.current)==null||N.focus()},className:"-mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:text-gray-400 dark:hover:bg-white/10 dark:hover:text-gray-100 dark:focus-visible:ring-gray-600","aria-label":"Remove skill",children:u.jsx(ba,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),!Gt&&va.length>0&&S.length===0&&!wt&&u.jsxs("button",{type:"button",onClick:ds,className:"flex h-8 shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs font-medium text-gray-600 shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-300 dark:hover:bg-white/10 dark:hover:text-gray-100 dark:focus-visible:ring-gray-600","aria-label":"Show available skills (or type a forward slash)",title:"Use a skill",children:[u.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded bg-gray-200 font-mono text-[10px] leading-none text-gray-600 dark:bg-[#2a2a2a] dark:text-gray-300","aria-hidden":"true",children:"/"}),"Skills"]}),u.jsxs("div",{className:"relative flex-1 w-full min-w-0",children:[yr&&vs&&u.jsx("div",{className:"pointer-events-none absolute inset-0 truncate whitespace-nowrap text-base md:text-sm text-gray-500 dark:text-[#8e8ea0]",style:{paddingTop:Math.max(Ft.top-Dv,0),paddingBottom:Ft.bottom,paddingLeft:`${td}px`,paddingRight:0,lineHeight:ya?`${ya}px`:void 0},"aria-hidden":"true",children:vs}),br&&O&&u.jsxs("div",{className:"pointer-events-none absolute inset-0 whitespace-pre-wrap text-base md:text-sm text-gray-400 dark:text-[#8e8ea0]",style:{paddingTop:Math.max(Ft.top-Lv,0),paddingBottom:Ft.bottom,paddingLeft:`${td}px`,paddingRight:0,lineHeight:ya?`${ya}px`:void 0},"aria-hidden":"true",children:[u.jsx("span",{className:"invisible",children:S}),u.jsx("span",{children:br})]}),u.jsx("textarea",{ref:de,"aria-label":"Message input",value:S,onChange:N=>{const le=N.target.value;_(le),le.startsWith("/")&&Dt(0),Xt(le.startsWith("/")&&va.length>0)},onKeyDown:xs,onPaste:Cr,onCompositionStart:()=>D(!0),onCompositionEnd:()=>D(!1),onFocus:()=>ee(!0),onBlur:()=>ee(!1),placeholder:vs,disabled:wt,rows:1,maxLength:ze.maxMessageLength,className:"relative z-10 flex-1 w-full min-w-0 resize-none bg-transparent py-0 text-base md:text-sm text-[#353740] placeholder-transparent focus:outline-none dark:text-[#ececf1] dark:placeholder-transparent",style:{minHeight:"24px",maxHeight:"120px",paddingTop:`${Ft.top}px`,paddingBottom:`${Ft.bottom}px`,paddingLeft:`${td}px`,paddingRight:0,border:"none",outline:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none",appearance:"none",caretColor:S.trim()||O?"inherit":"transparent"}})]}),u.jsxs("div",{className:"flex items-center justify-end gap-1 md:gap-2 flex-shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[f&&!Kt&&u.jsx("div",{className:"hidden md:block h-8 w-8 shrink-0","aria-hidden":"true"}),Kt&&u.jsx("button",{type:"button",onClick:N=>{N.preventDefault(),Qa||K(!H)},disabled:Qa,onMouseEnter:()=>te(!0),onMouseLeave:()=>te(!1),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${H||fn.length>0?"bg-gray-200 text-[#353740] dark:bg-[#565869] dark:text-[#ececf1]":Qa?"cursor-not-allowed text-gray-300 dark:text-[#6b6f7a]":"text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]"}`,title:dl?mn&&hi&&ze.maxFilesPerConversation!==null?`Maximum of ${ze.maxFilesPerConversation} files reached in this conversation. Start a new chat to upload more.`:mn&&hs&&ze.maxTotalFiles!==null?`Workspace limit of ${ze.maxTotalFiles} total files reached. Remove files from other conversations first.`:wt?"Files are uploading. Please wait...":fn.length>0?`${fn.length} file(s) attached`:"Attach files":"File upload not supported by this adapter","aria-label":"Attach files",children:Qa&&_e?u.jsx(ba,{className:"h-4 w-4"}):u.jsx(Px,{className:"h-4 w-4"})}),S.length>0&&u.jsx("div",{className:"hidden md:block px-2 text-xs text-gray-500 dark:text-[#bfc2cd] md:min-w-[72px] md:text-right",children:u.jsxs("span",{className:S.length>=ze.maxMessageLength?"text-red-600 font-semibold":"",children:[S.length,"/",ze.maxMessageLength]})})]}),u.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[u.jsx(Cg,{availableModels:v,defaultModel:b,selectedModel:w,onSelect:N=>k==null?void 0:k(N)}),(qn||un)&&u.jsxs(u.Fragment,{children:[qn&&u.jsx("button",{type:"button",onClick:Wl,className:`hidden md:flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${qe.voiceEnabled?"bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-300":"text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]"}`,title:qe.voiceEnabled?"Voice responses enabled - Click to disable":"Enable voice responses (text-to-speech)","aria-label":qe.voiceEnabled?"Disable voice responses":"Enable voice responses",children:qe.voiceEnabled?u.jsx($o,{className:"h-5 w-5"}):u.jsx(cb,{className:"h-5 w-5"})}),fa&&u.jsx("button",{type:"button",onClick:bs,disabled:wt,onMouseEnter:()=>E(!0),onMouseLeave:()=>E(!1),className:`hidden md:flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${ca?"!flex bg-red-100 text-red-600 dark:bg-red-900/40 dark:text-red-300":wt?"cursor-not-allowed text-gray-300 dark:text-[#6b6f7a]":"text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]"}`,title:wt?"Files are uploading. Please wait...":ca?"Stop recording":"Start voice input","aria-label":ca?"Stop recording":"Start voice input",children:ca||wt&&oe?u.jsx(Vx,{className:"h-5 w-5"}):u.jsx(Xx,{className:"h-5 w-5"})})]}),p&&u.jsx("button",{type:"button",onClick:()=>z(!0),className:"hidden md:flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]",title:"About this agent","aria-label":"About this agent",children:u.jsx(fp,{className:"h-5 w-5"})}),(Ql||ha)&&u.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:u.jsx(Lo,{className:"h-4 w-4 animate-spin text-gray-500 dark:text-[#bfc2cd]"})}),za?u.jsx("button",{type:"button",onClick:N=>{N.preventDefault(),Qe()},className:"flex h-9 w-9 md:h-8 md:w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 bg-red-500 text-white hover:bg-red-600 dark:bg-red-600 dark:hover:bg-red-700",title:"Stop generating","aria-label":"Stop generating",children:u.jsx(rb,{className:"h-4 w-4 md:h-3 md:w-3 fill-current"})}):u.jsx("button",{type:"submit",disabled:!fl||wt||A,className:`flex h-9 w-9 md:h-8 md:w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${fl&&!wt&&!A?"bg-black text-white hover:bg-gray-800 dark:bg-white dark:text-black dark:hover:bg-gray-200":"bg-gray-300 text-gray-500 dark:bg-[#565869] dark:text-[#6b6f7a]"}`,title:"Send message","aria-label":"Send message",children:u.jsx(sd,{className:"h-4 w-4"})})]})]})]}),fn.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2",children:fn.map(N=>{const le=!N.processing_status||N.processing_status==="processing"||N.processing_status==="uploading",Ce=N.processing_status==="failed"||N.processing_status==="error";return u.jsxs("div",{className:`flex items-center gap-2 rounded-md border px-2 py-1 text-xs ${Ce?"border-red-200 bg-red-50 dark:border-red-800/50 dark:bg-red-950/30":"border-gray-200 bg-white dark:border-[#4a4b54] dark:bg-[#2d2f39]"}`,title:Ce?N.error_message||"File processing failed":void 0,children:[le&&u.jsx(Lo,{className:"h-3 w-3 animate-spin text-blue-500 dark:text-blue-400 flex-shrink-0"}),Ce&&u.jsx(Do,{className:"h-3 w-3 text-red-500 dark:text-red-400 flex-shrink-0"}),u.jsx("span",{className:`truncate max-w-[150px] ${Ce?"text-red-700 dark:text-red-300":"text-[#353740] dark:text-[#ececf1]"}`,children:N.filename}),le&&u.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:N.processing_status==="uploading"?"Uploading...":"Processing..."}),Ce&&u.jsx("span",{className:"text-xs text-red-500 dark:text-red-400",children:"Failed"}),u.jsx("button",{type:"button",onClick:()=>{Ce?(Re&&it(Re,N.file_id),q(Oe=>Oe.filter(lt=>lt.file_id!==N.file_id))):pi(N)},className:"rounded p-2 md:p-0.5 text-gray-500 transition-colors hover:bg-red-50 hover:text-red-600 dark:text-[#bfc2cd] dark:hover:bg-red-900/30 dark:hover:text-red-300",title:Ce?"Dismiss":"Remove file",children:u.jsx(ba,{className:"h-4 w-4 md:h-3 md:w-3"})})]},N.file_id)})}),Kt&&(dl||vr)&&u.jsxs("div",{ref:ye,className:`rounded-lg border border-gray-200/80 bg-white p-2.5 dark:border-[#3c3f4a] dark:bg-[#2a2b32] transition-all duration-200 ${!H&&!ha&&P.size===0&&!vr?"hidden":""}`,children:[H&&u.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[u.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-[#8e8ea0] uppercase tracking-wider",children:"Attach files"}),u.jsx("button",{type:"button",onClick:()=>K(!1),className:"flex h-6 w-6 items-center justify-center rounded-md text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:text-[#6b6f7a] dark:hover:bg-[#3c3f4a] dark:hover:text-[#bfc2cd] transition-colors",title:"Close",children:u.jsx(ba,{className:"h-3.5 w-3.5"})})]}),(ha||P.size>0)&&!H&&P.size===0&&u.jsx("div",{className:"mb-2 px-1",children:u.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-[#8e8ea0] uppercase tracking-wider",children:"Uploading files"})}),P.size>0&&u.jsx("div",{className:"mb-2 space-y-1.5",children:Array.from(P.entries()).map(([N,le])=>u.jsxs("div",{className:"group relative w-full flex items-center gap-3 rounded-lg px-3 py-2.5 bg-gray-50 dark:bg-[#1f1f24] overflow-hidden transition-colors",children:[u.jsx("div",{className:"absolute inset-0 bg-blue-50 dark:bg-blue-900/15 transition-all duration-500 ease-out rounded-lg",style:{width:`${le.progress??0}%`}}),u.jsxs("div",{className:"relative flex items-center gap-3 w-full min-w-0",children:[u.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-blue-100 dark:bg-blue-900/30",children:u.jsx(Lo,{className:"h-4 w-4 text-blue-600 dark:text-blue-400 animate-spin"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"text-sm font-medium text-[#353740] dark:text-[#ececf1] truncate",children:le.filename}),u.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[u.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-[#3c3f4a] rounded-full h-1",children:u.jsx("div",{className:"bg-blue-500 dark:bg-blue-400 h-1 rounded-full transition-all duration-500 ease-out",style:{width:`${le.progress??0}%`}})}),u.jsxs("span",{className:"text-[11px] tabular-nums text-gray-400 dark:text-[#8e8ea0] shrink-0",children:[Math.round(le.progress??0),"%"]})]})]}),u.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-[#bfc2cd] shrink-0",children:le.status==="uploading"?"Uploading":le.status==="processing"?"Processing":le.status==="completed"?"Done":"Pending"})]})]},N))}),u.jsx("div",{className:`${H||ha?"block max-h-[40vh] overflow-y-auto":"hidden"}`,"aria-hidden":!(H||ha),children:u.jsx(zv,{conversationId:Re,onFilesSelected:_r,onUploadError:N=>{Ie("File upload error:",N),pe(N)},onUploadingChange:se,onUploadSuccess:Ar,maxFiles:ze.maxFilesPerConversation,disabled:Qa})})]}),u.jsx("div",{className:"h-3 md:h-1",children:fa&&ca&&u.jsxs("span",{className:"flex items-center gap-2 text-sm md:text-xs text-gray-500 dark:text-[#bfc2cd]",children:[u.jsx("span",{className:"h-2.5 w-2.5 md:h-2 md:w-2 animate-pulse rounded-full bg-red-500"}),"Listening..."]})})]}),we&&u.jsx("div",{ref:ie,className:"w-full pt-1",children:u.jsx(Ag,{skills:va,isLoading:Gl,selectedSkill:Gt,activeSkillName:Ot==null?void 0:Ot.name,query:$e,onActiveSkillChange:N=>{const le=Ze.findIndex(Ce=>Ce.name===N.name);le>=0&&Dt(le)},onSelect:ma,onClose:fs})}),W&&u.jsx("div",{ref:ae,role:"listbox","aria-label":"Autocomplete suggestions",className:"w-full pt-1",children:Va.map((N,le)=>{const Ce=le===Yt;return u.jsx("button",{type:"button",role:"option","aria-selected":Ce,className:`flex w-full items-center gap-3 px-3 py-3 md:py-2.5 text-left text-[15px] md:text-sm transition-colors ${Ce?"bg-gray-100 dark:bg-[#2d2f39]":"hover:bg-gray-50 dark:hover:bg-[#2d2f39]/60"}`,onClick:()=>jn(N.text),onMouseEnter:()=>wa(le),children:Jo(N.text)},le)})}),u.jsx(Bo,{isOpen:G.isOpen,onClose:ua,onConfirm:Hn,title:"Remove File",message:`Are you sure you want to remove "${G.filename}"? This will delete the file from both the server and this conversation. This action cannot be undone.`,confirmText:"Remove",cancelText:"Cancel",type:"danger",isLoading:G.isDeleting})]})]})}),U&&p&&typeof document<"u"&&Qo.createPortal(u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-black/60 p-4 backdrop-blur-sm animate-fadeIn",children:u.jsxs("div",{ref:fe,role:"dialog","aria-modal":"true","aria-labelledby":"agent-info-title",tabIndex:-1,className:"w-full max-w-2xl max-h-[calc(100vh-2rem)] overflow-y-auto rounded-2xl bg-white shadow-2xl transform animate-fadeIn dark:bg-[#1a1b1e]",children:[u.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-[#2d2f39]",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/20 flex items-center justify-center",children:u.jsx(fp,{className:"w-5 h-5 text-blue-500"})}),u.jsx("h2",{id:"agent-info-title",className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:"About this agent"})]}),u.jsx("button",{type:"button",onClick:()=>z(!1),className:"p-2 hover:bg-gray-100 dark:hover:bg-[#25262f] rounded-lg transition-colors","aria-label":"Close",children:u.jsx(ba,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),u.jsx("div",{className:"p-6",children:u.jsx(rl,{content:p,className:`message-markdown w-full min-w-0 prose prose-slate dark:prose-invert max-w-none text-sm leading-relaxed text-[#434654] dark:text-[#d7dae3] [&>:first-child]:mt-0 [&>:last-child]:mb-0 ${vt}`,syntaxTheme:st})}),u.jsx("div",{className:"flex items-center justify-end p-6 border-t border-gray-200 dark:border-[#2d2f39] bg-gray-50 dark:bg-[#111113] rounded-b-2xl",children:u.jsx("button",{type:"button",onClick:()=>z(!1),className:"px-4 py-3 md:py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium shadow-sm hover:shadow-md",children:"Got it"})})]})}),document.body)]})}function qp({adapter:r,onSelect:l}){var h;const i=(h=r.description)==null?void 0:h.trim(),{isDark:c}=cs(),d=c?"dark":"light",f=()=>l(r);return u.jsxs("div",{tabIndex:0,role:"button","data-agent-card":"true",onClick:f,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),f())},className:"group relative flex w-full cursor-pointer flex-col rounded-2xl border border-slate-200 bg-white px-4 py-3.5 text-left shadow-sm transition-colors duration-150 hover:border-slate-300 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 dark:border-[#242424] dark:bg-[#080808] dark:hover:border-[#333333] dark:hover:bg-[#111111] dark:focus-visible:ring-sky-400/30 md:px-5 md:py-4",children:[u.jsx("div",{className:"relative",children:u.jsx("div",{className:"min-w-0",children:u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"truncate text-[15px] font-semibold text-sky-900 dark:text-sky-300 md:text-base",children:r.name}),i?u.jsx("div",{className:"mt-1 text-sm leading-5 text-slate-600 dark:text-slate-300",children:u.jsx(rl,{content:i,className:"prose prose-slate max-w-none text-inherit dark:prose-invert [&>*]:mb-0 [&>*]:mt-0 [&_p]:overflow-hidden [&_p]:text-ellipsis [&_p]:[display:-webkit-box] [&_p]:[-webkit-box-orient:vertical] [&_p]:[-webkit-line-clamp:4]",syntaxTheme:d})}):u.jsx("p",{className:"mt-1 text-sm leading-5 text-slate-500 dark:text-slate-400",children:"Configure this agent to see its capabilities."})]}),u.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),f()},className:"hidden h-8 w-8 flex-shrink-0 items-center justify-center self-start rounded-full text-slate-700 transition-all duration-150 hover:bg-slate-100 group-hover:translate-x-0.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 dark:text-slate-200 dark:hover:bg-white/10 dark:focus-visible:ring-sky-400/30 md:inline-flex","aria-label":`Start conversation with ${r.name}`,children:u.jsx(dp,{className:"h-4 w-4","aria-hidden":"true"})})]})})}),u.jsx("div",{className:"mt-3 flex items-center justify-end gap-3 border-t border-slate-200 pt-2.5 text-xs text-slate-500 dark:border-white/10 dark:text-slate-400 md:hidden",children:u.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),f()},className:"inline-flex h-8 w-8 items-center justify-center rounded-full text-slate-700 transition-all duration-150 hover:bg-slate-100 group-hover:translate-x-0.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 dark:text-slate-200 dark:hover:bg-white/10 dark:focus-visible:ring-sky-400/30","aria-label":`Start conversation with ${r.name}`,children:u.jsx(dp,{className:"h-4 w-4","aria-hidden":"true"})})})]})}const gr=r=>{if(typeof r!="string")return;const l=r.trim();return l.length>0?l:void 0},Hv=r=>{if(!r||typeof r!="object")return null;const l=r,i=gr(l.name);if(!i)return null;const c=gr(l.id);if(!c)return console.warn(`[middlewareConfig] Adapter "${i}" is missing a required 'id' field — skipping.`),null;const d=gr(l.apiUrl),f=gr(l.model),h=gr(l.inputPlaceholder),p=typeof l.notes=="string"?l.notes.trim():void 0;let x=gr(l.description)||gr(l.summary);if(!x&&typeof p=="string"){const b=p.split(/\r?\n/).find(w=>w.trim().length>0);x=b?b.trim():void 0}const v={id:c,name:i};return d&&(v.apiUrl=d),x&&(v.description=x),p&&(v.notes=p),f&&(v.model=f),h&&(v.inputPlaceholder=h),v},Ng=r=>Array.isArray(r)?r.map(Hv).filter(l=>l!==null):[];let $l=null,ad=0;const Fv=3e4;function Iv(){if(typeof window<"u"){const r=window.ORBIT_CHAT_CONFIG;if(r!=null&&r.adapters&&Array.isArray(r.adapters)){ne("Loading adapters from window.ORBIT_CHAT_CONFIG");const l=Ng(r.adapters);if(l.length===0)return null;const i=`{
|
|
338
|
-
"simple-chat": "default-key",
|
|
339
|
-
"web-search": "orbit_XfxmYoTZgnp7zoMTKsIBfMBuYwj6U21P",
|
|
340
|
-
"chat-with-files": "multimodal",
|
|
341
|
-
"hr-db-chatbot": "human-resources",
|
|
342
|
-
"intent-sql-sqlite-classified": "classified",
|
|
343
|
-
"ecomm-analytics": "analytical",
|
|
344
|
-
"intent-duckdb-ev-population": "electric-vehicle",
|
|
345
|
-
"intent-http-jsonplaceholder": "rest-json-api",
|
|
346
|
-
"intent-http-paris-opendata": "paris-opendata",
|
|
347
|
-
"intent-mongodb-mflix": "mongodb-mflix",
|
|
348
|
-
"intent-graphql-spacex": "graphql-spacex",
|
|
349
|
-
"intent-sql-postgres": "postgres-customer-orders",
|
|
350
|
-
"open-ai-real-time-voice-chat": "open-ai-real-time-voice-chat",
|
|
351
|
-
"composite-multi-source-explorer": "composite-multi-source-explorer",
|
|
352
|
-
"math-teacher-quadratic": "math-teacher-trig-identities",
|
|
353
|
-
"qa-sql": "orbit_g6QuN5sPUh3fI2v0njoOJroXbAh1ILGP",
|
|
354
|
-
"qa-vector-chroma": "orbit_Rxm90sh85f8l5bzOLJpqpMUP9HcoNAX3",
|
|
355
|
-
"image-generator": "orbit_bZQ0h6kvpTphfCr9QgrCP13dkVclAsKQ",
|
|
356
|
-
"video-generator": "orbit_9P1vnx1GNMvVNyNCKF71VvVvcYx9duuo",
|
|
357
|
-
"intent-elasticsearch-log": "orbit_Ghpo8Q9mRdvVIODdw97ht7lBPpYBAzb6",
|
|
358
|
-
"audio-transcription": "orbit_RTBIwFoB6DA2mBuuHfnKf0xabwE6XKs2",
|
|
359
|
-
"voice-chat": "orbit_WjrkTqVjHE7mBa2ri8sAjENEVnLT9wbO",
|
|
360
|
-
"real-time-voice-chat": "orbit_xkvziKTXpZ1ufHWKg76pUDPbMDBRSRqC",
|
|
361
|
-
"tender-notices": "tender-notices",
|
|
362
|
-
"award-notices": "award-notices",
|
|
363
|
-
"contract-history": "contract-history",
|
|
364
|
-
"standing-offers": "standing-offers"
|
|
365
|
-
}`;if(!i.trim())return[];try{const c=JSON.parse(i),d=new Set(Object.entries(c).filter(([,f])=>{if(typeof f=="string")return f.trim().length>0;if(f&&typeof f=="object"){const h=f;if(typeof h.apiKey=="string"&&h.apiKey.trim().length>0||typeof h.key=="string"&&h.key.trim().length>0)return!0}return!1}).map(([f])=>f));return l.filter(f=>d.has(f.id))}catch{return[]}}}return null}async function Td(){if($l&&Date.now()-ad<Fv)return $l;try{const l=await fetch("/api/adapters?refresh=1",{cache:"no-store",headers:{"Cache-Control":"no-cache"}});if(l.ok){const i=await l.json(),c=Ng(i.adapters);if(c.length>0)return $l=c,ad=Date.now(),ne("Fetched adapters from /api/adapters:",$l),$l;ne("/api/adapters response did not contain valid adapters, trying fallback")}ne(`/api/adapters returned ${l.status}, trying fallback`)}catch(l){ne("Could not fetch from /api/adapters, trying fallback:",l)}const r=Iv();if(r&&r.length>0)return $l=r,ad=Date.now(),ne("Loaded adapters from config:",$l),$l;throw Ie("No adapters available from API or config"),new Error("No adapters available. Define adapters in orbitchat.yaml and provide matching ids in VITE_ADAPTER_KEYS.")}const Gv="h-[96px]";function Vv({onAdapterSelect:r,className:l="",title:i="",subtitle:c="",eyebrow:d=""}){const[f,h]=g.useState([]),[p,x]=g.useState(!0),[v,b]=g.useState(null),w=g.useRef(null),k=g.useRef(null),[S,_]=g.useState(""),[A,D]=g.useState(!1),O=g.useCallback(()=>{const te=w.current;if(!te){D(!1);return}D(te.scrollHeight-te.scrollTop-te.clientHeight>20)},[]),ee=()=>typeof window<"u"&&window.matchMedia("(min-width: 768px)").matches,U=()=>{var te;return Array.from(((te=w.current)==null?void 0:te.querySelectorAll('[data-agent-card="true"]'))??[])},z=te=>{const E=U()[te]??null;E&&(E.focus(),E.scrollIntoView({block:"nearest"}))},H=()=>{z(0)},K=()=>{const te=U();te.length!==0&&z(te.length-1)},j=te=>{if(!p&&!v&&I.length>0&&ee()){if(te.key==="Tab"&&!te.shiftKey){te.preventDefault(),H();return}if(te.key==="ArrowDown"){te.preventDefault(),H();return}te.key==="ArrowUp"&&(te.preventDefault(),K())}},q=te=>{var B;if(!P||!ee()||te.key!=="ArrowDown"&&te.key!=="ArrowUp")return;const oe=document.activeElement;if(!(oe instanceof HTMLElement)||oe.dataset.agentCard!=="true")return;const E=U(),Y=E.indexOf(oe);if(Y!==-1){if(te.preventDefault(),te.key==="ArrowDown"){z((Y+1)%E.length);return}if(Y===0){(B=k.current)==null||B.focus();return}z(Y-1)}},V=S.trim().toLowerCase(),I=V?f.filter(te=>{var B,re;const oe=te.name.toLowerCase().includes(V),E=((B=te.description)==null?void 0:B.toLowerCase().includes(V))??!1,Y=((re=te.model)==null?void 0:re.toLowerCase().includes(V))??!1;return oe||E||Y}):f,P=S.trim().length>0,ue=P||I.length===1;g.useEffect(()=>{const te=w.current;if(te)return O(),te.addEventListener("scroll",O,{passive:!0}),()=>te.removeEventListener("scroll",O)},[O,I]),g.useEffect(()=>{let te=!0;return(async()=>{try{x(!0),b(null);const Y=(await Td()).slice().sort((B,re)=>B.name.localeCompare(re.name,void 0,{sensitivity:"base"}));te&&h(Y)}catch(E){Ie("[AgentSelectionList] Failed to load adapters",E),te&&b("Unable to load agents right now.")}finally{te&&x(!1)}})(),()=>{te=!1}},[]),g.useEffect(()=>{var te;p||v||f.length===0||(te=k.current)==null||te.focus()},[p,v,f.length]);const _e=()=>p?u.jsx("div",{className:"grid gap-4",children:Array.from({length:3}).map((te,oe)=>u.jsx("div",{className:`${Gv} animate-pulse rounded-2xl border border-gray-200 bg-transparent dark:border-[#3b3c49]`},oe))}):v?u.jsx("div",{className:"rounded-2xl border border-red-200 bg-transparent px-4 py-6 text-sm text-red-700 dark:border-red-900 dark:text-red-200",children:v}):f.length===0?u.jsx("div",{className:"rounded-2xl border border-gray-200 bg-transparent px-4 py-6 text-sm text-gray-600 dark:border-[#3b3c49] dark:text-gray-300",children:"No agents are available yet. Configure adapters in your middleware settings to continue."}):I.length===0?u.jsx("div",{className:"rounded-2xl border border-gray-200 bg-transparent px-4 py-6 text-sm text-gray-600 dark:border-[#3b3c49] dark:text-gray-300",children:"No agents match your search."}):u.jsxs("div",{className:"relative flex flex-col h-full min-h-0",children:[u.jsx("div",{ref:w,onKeyDown:q,className:"agent-selection-scroll flex-1 min-h-0 overflow-y-auto pr-1 pb-2",children:ue?u.jsx("div",{className:"mx-auto flex w-full max-w-xl flex-col gap-3 lg:max-w-2xl",children:I.map(te=>u.jsx(qp,{adapter:te,onSelect:oe=>r(oe.id)},te.id))}):u.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:I.map(te=>u.jsx(qp,{adapter:te,onSelect:oe=>r(oe.id)},te.id))})}),A&&u.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-12 md:hidden bg-gradient-to-t from-white dark:from-[#212121] to-transparent","aria-hidden":"true"})]});return u.jsxs("div",{className:`flex w-full flex-col gap-4 md:gap-6 ${l}`,children:[(d||i||c)&&u.jsxs("div",{className:"flex-shrink-0",children:[d&&u.jsx("p",{className:"text-sm font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-300",children:d}),i&&u.jsx("h2",{className:"mt-2 text-2xl font-bold text-gray-900 dark:text-white",children:i}),c&&u.jsx("p",{className:"mt-2 text-base text-gray-600 dark:text-gray-300",children:c})]}),u.jsx("div",{className:"flex w-full flex-shrink-0 justify-center",children:u.jsx("div",{className:"w-full max-w-xl lg:max-w-2xl",children:u.jsxs("div",{className:"relative overflow-hidden rounded-[1.75rem] border border-slate-300/90 bg-[linear-gradient(180deg,rgba(255,255,255,0.96),rgba(248,250,252,0.94))] shadow-[0_10px_28px_rgba(15,23,42,0.05)] dark:border-white/20 dark:bg-[linear-gradient(180deg,rgba(37,39,49,0.95),rgba(29,31,39,0.92))] dark:shadow-[0_12px_30px_rgba(0,0,0,0.2)]",children:[u.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[inherit] bg-[linear-gradient(180deg,rgba(255,255,255,0.45),rgba(255,255,255,0))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]"}),u.jsx(yd,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400 dark:text-slate-500"}),u.jsx("input",{ref:k,type:"text",placeholder:"Search agents",value:S,maxLength:100,disabled:p||!!v||f.length===0,onChange:te=>_(te.target.value),onKeyDown:j,className:"relative z-10 w-full bg-transparent py-3 pl-11 pr-11 text-sm font-medium text-slate-700 placeholder:font-normal placeholder:text-slate-400 focus:outline-none focus:ring-0 focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-60 dark:text-slate-100 dark:placeholder:text-slate-400"}),S&&u.jsx("button",{type:"button",onClick:()=>_(""),className:"absolute right-3 top-1/2 z-10 inline-flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-slate-200/80 bg-white/90 text-slate-400 transition-colors hover:border-slate-300 hover:text-slate-600 focus:outline-none focus:ring-2 focus:ring-sky-200 dark:border-white/10 dark:bg-white/5 dark:text-slate-500 dark:hover:border-white/20 dark:hover:text-slate-200 dark:focus:ring-sky-500/20","aria-label":"Clear search",children:u.jsx(ba,{className:"h-3.5 w-3.5"})})]})})}),u.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:_e()})]})}function md(){return Ad()?Yo()==="entra"?u.jsx(Yv,{}):u.jsx(Xv,{}):null}function Xv(){const{user:r,logout:l,loginWithRedirect:i}=xd();if(!us()||!r)return u.jsx(Tg,{onClick:()=>i()});const d=r.name||r.email||"User";return u.jsx(Eg,{displayName:d,onClick:()=>l({logoutParams:{returnTo:window.location.origin}})})}function Yv(){const{instance:r,accounts:l}=gd();if(!us()||l.length===0)return u.jsx(Tg,{onClick:()=>r.loginRedirect({scopes:Cd()}).catch(()=>{})});const c=l[0],d=c.name||c.username||"User";return u.jsx(Eg,{displayName:d,onClick:()=>r.logoutRedirect({postLogoutRedirectUri:window.location.origin}).catch(()=>{})})}function Tg({onClick:r}){return u.jsxs("button",{onClick:r,className:"inline-flex items-center justify-center gap-1.5 rounded-lg border border-blue-400/70 bg-blue-600 px-3 py-2 text-xs font-semibold text-white shadow-sm active:scale-[0.97] transition-all duration-150 hover:bg-blue-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:border-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600",children:[u.jsx(ag,{className:"h-4 w-4"}),u.jsx("span",{children:"Sign in"})]})}function Eg({displayName:r,onClick:l}){return u.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm text-gray-600 dark:text-[#bfc2cd]",children:[u.jsx("span",{className:"hidden max-w-[170px] truncate font-medium md:block",title:r,children:r}),u.jsxs("button",{onClick:l,className:"inline-flex min-h-10 items-center justify-center gap-1.5 rounded-lg border border-slate-200 px-3 py-2 text-xs font-semibold text-slate-600 shadow-sm transition-colors hover:border-red-200 hover:bg-red-50 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-400 dark:border-[#454755] dark:text-[#c4c8d4] dark:hover:border-red-900/40 dark:hover:bg-red-900/20 dark:hover:text-red-300 md:rounded-full md:text-sm md:font-medium",title:"Log out","aria-label":"Log out",children:[u.jsx(Fx,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden md:inline",children:"Log out"})]})]})}function Mg({placement:r="default",compact:l=!1}){if(!hg())return null;const i=yy(),c=vy(),d=wy(),f=Sy(),h=ky(),p=_y(),x=Cy(),v=f?"border-t border-slate-200/80 dark:border-[#333645]":"",b=l?r==="sidebar"?"pt-4 pb-2":"pt-2 pb-2":p==="normal"?"pt-3 pb-3":"pt-5 pb-3",w=h==="inline"?"flex w-full flex-col gap-1 items-center justify-center text-center sm:flex-row sm:items-center sm:justify-center":"flex w-full flex-col items-center justify-center gap-1 text-center",k="justify-center",S=r==="sidebar"?"w-full px-2":"w-full px-3 sm:px-6",_=r==="sidebar"?"w-full":"mx-auto w-full max-w-7xl",A=l?"inline-flex min-h-8 items-center rounded px-1.5 text-xs font-medium transition-colors hover:bg-slate-100 hover:text-blue-700 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:hover:bg-[#2b2d39] dark:hover:text-blue-300":"inline-flex min-h-10 items-center rounded-md px-2.5 text-sm font-medium transition-colors hover:bg-slate-100 hover:text-blue-700 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:hover:bg-[#2b2d39] dark:hover:text-blue-300 sm:text-base";return u.jsx("footer",{className:`shrink-0 bg-white dark:bg-black text-sm ${b} ${v}`.trim(),style:{backgroundColor:c||void 0,color:d||void 0},children:u.jsx("div",{className:S,children:u.jsx("div",{className:_,children:u.jsxs("div",{className:w,children:[i&&u.jsx("p",{className:`${l?"text-xs leading-snug":"text-sm"} text-slate-700 dark:text-slate-200 ${r==="sidebar"?"pt-0.5":""}`.trim(),children:i}),x.length>0&&u.jsx("nav",{"aria-label":"Footer links",children:u.jsx("ul",{className:`flex flex-wrap items-center ${k} ${l?"gap-1":"gap-1.5 sm:gap-2"}`,children:x.map((D,O)=>{const ee=h==="inline"&&O>0;return u.jsxs("li",{className:"flex items-center",children:[ee&&u.jsx("span",{className:"mr-1.5 text-slate-400 dark:text-slate-500","aria-hidden":"true",children:"·"}),u.jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:A,style:{color:d||void 0},children:D.label})]},D.url)})})})]})})})})}const Qv=60*1e3;let nd=null,Bp=0;const ld=r=>{if(!r||r==="/")return"/";const l=r.trim();if(!l)return"/";const i=l.startsWith("/")?l:`/${l}`;return i==="/"?"/":i.endsWith("/")?i.slice(0,-1):i},zg=()=>{if(typeof window>"u")return ld("/");const r=ld("/");if(typeof document>"u")return r;const l=document.querySelector("base[href]");if(!l)return r;try{const i=new URL(l.getAttribute("href")||"/",window.location.origin);return ld(i.pathname||r)}catch{return r}},Go=r=>r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Zv=async()=>{const r=Date.now();if(nd&&r-Bp<Qv)return nd;let l=[];try{l=await Td()}catch(c){Fe("[agentRouting] Unable to load adapters for slug resolution",c)}const i=new Map;return l.forEach(c=>{const d=Go(c.name);d&&i.set(d,c.id);const f=Go(c.id);f&&f!==d&&i.set(f,c.id)}),nd=i,Bp=r,i},hd=r=>{var f;const l=zg(),i=r.startsWith("/")?r:`/${r}`;let c=i;if(l!=="/"){if(!i.startsWith(l))return null;c=i.slice(l.length)}const d=c.split("/").filter(Boolean);return d.length===0?null:((f=d[0])==null?void 0:f.toLowerCase())||null},Dg=r=>{const l=zg();if(!r)return l;const i=r.replace(/^\/+|\/+$/g,"");return l==="/"?i?`/${i}`:"/":`${l}/${i}`.replace(/\/{2,}/g,"/")},Ln=r=>{if(typeof window>"u")return;const l=Dg(r),i=window.location.pathname;if(l===i)return;const c=window.location.search||"",d=window.location.hash||"";window.history.replaceState(window.history.state,"",`${l}${c}${d}`)},Kv=()=>Dg(null),Jv=async r=>{const l=r.trim().toLowerCase();return l&&(await Zv()).get(l)||null},Pv="Single adapter mode requires agentMode.defaultAdapterId to match an adapter id in orbitchat.yaml.";function Wv({currentConversation:r,showEmptyState:l,createConversation:i,configureApiSettings:c,clearError:d,clearCurrentConversationAdapter:f}){var ye;const[h,p]=g.useState(!1),[x,v]=g.useState(null),b=Xo(),w=Sd(),k=typeof window<"u"?hd(window.location.pathname):null,[S,_]=g.useState(k),[A,D]=g.useState(()=>!b&&l&&!k),O=g.useRef(null),ee=g.useRef(new Map),U=g.useRef(0),z=3e4,H=!!r,K=(r==null?void 0:r.messages.length)??0,j=((ye=r==null?void 0:r.attachedFiles)==null?void 0:ye.length)??0,q=g.useMemo(()=>H&&(K>0||j>0),[j,K,H]),V=g.useCallback(()=>{sa(()=>Ye.getState())},[]),I=g.useCallback((ae,ie)=>{if(!ae)return;const xe=ie||"Unable to configure this agent.";let Ne=!1;Ye.setState(ve=>{const Te=ve.conversations.find(Le=>Le.id===ae);return!Te||Te.messages.length>0?ve:(Ne=!0,{conversations:ve.conversations.map(Le=>Le.id===ae?{...Le,adapterLoadError:xe}:Le)})}),Ne&&V()},[V]),P=g.useCallback(ae=>{if(!ae)return;let ie=!1;Ye.setState(xe=>{const Ne=xe.conversations.find(ve=>ve.id===ae);return!Ne||!Ne.adapterLoadError?xe:(ie=!0,{conversations:xe.conversations.map(ve=>ve.id===ae?{...ve,adapterLoadError:null}:ve)})}),ie&&V()},[V]),ue=g.useCallback(ae=>ae instanceof vg?ae.status===401?"We couldn’t load this agent. It may not exist or you might not have access to it.":ae.status===404?"This agent was not found on the server. Please pick another agent.":ae.message:ae instanceof Error?ae.message:"Unable to load agent overview right now.",[]),_e=g.useCallback(()=>{const ae=Ye.getState(),ie=ae.currentConversationId?ae.conversations.find(xe=>xe.id===ae.currentConversationId):null;if(!ie||ie.messages.length>0)try{return i()}catch(xe){Fe("Cannot create a new conversation for agent selection:",xe instanceof Error?xe.message:"Unknown error")}return(ie==null?void 0:ie.id)||null},[i]),te=g.useCallback(async ae=>{if(!(ae!=null&&ae.adapterName))return{ok:!1};try{const ie=await xt(),xe=new ie.ApiClient({apiUrl:ae.apiUrl||kt(),sessionId:null,adapterName:ae.adapterName});if(typeof xe.getAdapterInfo!="function")return{ok:!1};const Ne=await xe.getAdapterInfo();return Ye.setState(ve=>({conversations:ve.conversations.map(Te=>Te.id===ae.id?{...Te,adapterInfo:Ne,adapterLoadError:null,updatedAt:new Date}:Te)})),Ye.getState().currentConversationId===ae.id&&v(null),V(),{ok:!0}}catch(ie){const xe=ue(ie),Ne=Ye.getState();Ne.currentConversationId===ae.id&&v({conversationId:ae.id,message:xe});const ve=Ne.conversations.find(Te=>Te.id===ae.id);return ve&&ve.messages.length===0&&I(ae.id,xe),{ok:!1,error:ie}}},[ue,I,V]),oe=g.useCallback(async ae=>{if(!ae)return;const ie=Ye.getState(),xe=ie.currentConversationId?ie.conversations.find(Ne=>Ne.id===ie.currentConversationId):null;if(xe){p(!0),v(null),P(xe.id);try{const Ne=xe.apiUrl||kt();await c(Ne,void 0,ae),d();const ve=Ye.getState(),Te=ve.conversations.find(Le=>Le.id===ve.currentConversationId);if((Te==null?void 0:Te.adapterName)===ae&&(!Te.adapterInfo||Te.adapterInfo.notes===void 0)){const Le=await te(Te);!Le.ok&&Le.error&&Ie("Failed to load adapter info after selecting adapter:",Le.error)}}catch(Ne){Ie("Failed to configure adapter from empty state:",Ne);const ve=ue(Ne);v({conversationId:xe.id,message:ve}),I(xe.id,ve)}finally{p(!1)}}},[P,d,c,te,ue,I]),E=g.useCallback(ae=>{b||(_e(),D(!1),Ln(Go(ae)),oe(ae))},[_e,oe,b]),Y=g.useCallback(()=>{b||(f(),Ln(null),D(!0))},[f,b]),B=g.useCallback(()=>{var Ne,ve;if(b){const Te=Ye.getState(),Le=Te.currentConversationId?Te.conversations.find(Be=>Be.id===Te.currentConversationId):null;if(!!Le&&(Le.messages.length>0||(((Ne=Le.attachedFiles)==null?void 0:Ne.length)||0)>0))try{i()}catch(Be){Fe("Cannot go home (new conversation):",Be instanceof Error?Be.message:"Unknown error")}Ln(null),D(!1);return}_(null);const ae=Ye.getState(),ie=ae.currentConversationId?ae.conversations.find(Te=>Te.id===ae.currentConversationId):null;if(!!ie&&(ie.messages.length>0||(((ve=ie.attachedFiles)==null?void 0:ve.length)||0)>0))try{i()}catch(Te){Fe("Cannot go home (new conversation):",Te instanceof Error?Te.message:"Unknown error");return}else ie!=null&&ie.adapterName&&f();Ln(null),D(!0)},[f,i,b]),ce=!b&&l&&!S&&!(r!=null&&r.adapterName)&&!q||!b&&l&&A&&!(r!=null&&r.adapterName)&&!q;g.useEffect(()=>{if(b){Ln(null);return}if(!S){if(ce||!(r!=null&&r.adapterName)){Ln(null);return}Ln(Go(r.adapterName))}},[r==null?void 0:r.adapterName,b,S,ce]);const ge=g.useCallback(async()=>{if(typeof window>"u")return;const ae=++U.current;if(b){Ln(null),_(null);return}const ie=hd(window.location.pathname);if(!ie)return;const xe=await Jv(ie);if(ae===U.current){if(!xe){_e(),Ln(null),f(),D(!0),_(null);return}_e(),D(!1),Ln(ie),await oe(xe),_(null)}},[f,_e,oe,b]);g.useEffect(()=>{const ae=window.setTimeout(()=>{ge()},0),ie=()=>{ge()};return window.addEventListener("popstate",ie),()=>{window.clearTimeout(ae),U.current+=1,window.removeEventListener("popstate",ie)}},[ge]);const pe=r==null?void 0:r.id,G=r==null?void 0:r.adapterName,me=r==null?void 0:r.apiUrl,de=!!(r!=null&&r.adapterInfo);g.useEffect(()=>{if(!b||!w||!l||!pe||q||h)return;const ae=(G==null?void 0:G.trim())||w,ie=(G==null?void 0:G.trim())!==ae||!de;if(!ae||!ie)return;let xe=!1;return(async()=>{p(!0),v(null),P(pe);try{const ve=me||kt();await c(ve,void 0,ae),d()}catch(ve){if(!xe){const Te=ue(ve);v({conversationId:pe,message:Te}),I(pe,Te)}}finally{xe||p(!1)}})(),()=>{xe=!0}},[P,d,c,q,ue,h,b,I,l,G,me,de,pe,w]),g.useEffect(()=>{(async()=>{var Ne;const ie=r==null?void 0:r.adapterName;if(O.current===ie)return;const xe=!(r!=null&&r.adapterInfo)||(r==null?void 0:r.adapterInfo)&&r.adapterInfo.notes===void 0;if(ie&&xe){O.current=ie,ne("[ChatInterface] Loading adapter info - adapterName:",ie,"reason:",r!=null&&r.adapterInfo?"notes undefined":"missing");const ve=await te(r);if(ve.ok)ne("[ChatInterface] Adapter info loaded successfully");else{const Te=ve.error;Ie("[ChatInterface] Failed to load adapter info:",Te);const Le=Te instanceof Error?Te.message:String(Te);if((Le.includes("429")||Le.includes("Too Many Requests"))&&ie){const Be=ee.current.get(ie);Be&&clearTimeout(Be);const Ge=setTimeout(()=>{O.current===ie&&(O.current=null),ee.current.delete(ie)},z);ee.current.set(ie,Ge),Fe(`[ChatInterface] Adapter info request rate-limited; retrying in ${z/1e3}s`)}else O.current=null}}else ne("[ChatInterface] Skipping adapter info load:",{adapterName:ie,hasAdapterInfo:!!(r!=null&&r.adapterInfo),hasNotes:((Ne=r==null?void 0:r.adapterInfo)==null?void 0:Ne.notes)!==void 0,refValue:O.current})})()},[te,r]),g.useEffect(()=>{const ae=ee.current;return()=>{ae.forEach(ie=>clearTimeout(ie)),ae.clear()}},[]);const fe=b&&!w?Pv:(r==null?void 0:r.adapterLoadError)??((x==null?void 0:x.conversationId)===(r==null?void 0:r.id)?x.message:null);return{adapterNotesError:fe,handleAgentCardSelection:E,handleChangeAgent:Y,goToAgentSelectionHome:B,hasAdapterConfigurationError:!!fe,isAgentSelectionVisible:A,isConfiguringAdapter:h,isSingleAdapterMode:b,setIsAgentSelectionVisible:D,shouldShowAgentSelectionList:ce}}const Lg=g.createContext(null),e1={registerGoHome:()=>{},goHome:()=>{}};function Rg(){return g.useContext(Lg)??e1}function t1({adapter:r,syntaxTheme:l,forcedThemeClass:i=""}){var d;const c=(d=r.notes)==null?void 0:d.trim();return c?u.jsxs("section",{"aria-labelledby":"agent-seo-content-title",className:"mx-auto w-full max-w-[56rem] px-1 text-left sm:px-0",children:[u.jsx("h2",{id:"agent-seo-content-title",className:"sr-only",children:r.name}),u.jsx("div",{children:u.jsx(rl,{content:c,className:`message-markdown prose prose-slate dark:prose-invert max-w-none text-sm leading-relaxed text-[#434654] dark:text-[#d7dae3] [&>:first-child]:mt-0 [&>:last-child]:mb-0 ${i}`,syntaxTheme:l})})]}):null}const a1='meta[name="description"]',n1='meta[property="og:title"]',l1='meta[property="og:description"]',r1='meta[property="og:type"]',s1='link[rel="canonical"]';function Hp(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function i1(r){return r.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^>\s?/gm,"").replace(/[*_~]/g,"").replace(/\s+/g," ").trim()}function o1(r,l){const i=r==null?void 0:r.trim();if(i)return i;if(!l)return _d();const c=i1(l);return c.length>160?`${c.slice(0,157).trimEnd()}...`:c}function c1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function u1(r){const l=r.trim();if(!l)return null;try{return new URL(l).origin}catch{return null}}function d1(r){const l=r.trim();if(!l)return null;const i=`^${c1(l).replace(/\\\*/g,".*")}$`;try{return new RegExp(i,"i")}catch{return null}}function f1(r){return[cg(),...Kb()].map(u1).filter(i=>!!i).includes(r)?!0:Jb().some(i=>{const c=d1(i);return c?c.test(r):!1})}function m1(r){var c,d,f;const l=r==null?void 0:r.trim();if(!l)return null;const i=Se.adapters.find(h=>{var p;return((p=h==null?void 0:h.id)==null?void 0:p.trim())===l});return i?{id:i.id,name:((c=i.name)==null?void 0:c.trim())||i.id,description:((d=i.description)==null?void 0:d.trim())||void 0,notes:((f=i.notes)==null?void 0:f.trim())||void 0}:null}function h1(r){var c,d,f;if(typeof window>"u")return null;const l=hd(window.location.pathname);if(!l)return null;const i=Se.adapters.find(h=>{const p=Hp(h.name||""),x=Hp(h.id||"");return l===p||l===x});return i?{id:i.id,name:((c=i.name)==null?void 0:c.trim())||i.id,description:((d=i.description)==null?void 0:d.trim())||void 0,notes:((f=i.notes)==null?void 0:f.trim())||void 0}:null}function Mo(r,l,i){if(typeof document>"u")return null;const c=document.querySelector(r);if(c)return c;const d=document.createElement("meta");return d.setAttribute(l,i),document.head.appendChild(d),d}function p1(){if(typeof document>"u")return null;const r=document.querySelector(s1);if(r)return r;const l=document.createElement("link");return l.rel="canonical",document.head.appendChild(l),l}function Ug(r){if(typeof document>"u")return;const l=kd(),i=r?`${r.name} | ${l}`:l,c=r?o1(r.description,r.notes):_d();document.title=i;const d=Mo(a1,"name","description");d&&(d.content=c);const f=Mo(n1,"property","og:title");f&&(f.content=i);const h=Mo(l1,"property","og:description");h&&(h.content=c);const p=Mo(r1,"property","og:type");p&&(p.content="website");const x=p1();if(x&&typeof window<"u"){const v=cg(),b=window.location.origin,w=v?new URL(v.endsWith("/")?v:`${v}/`).origin:"",S=`${b&&f1(b)?b:w||b}${window.location.pathname}`;x.href=S}}function g1(){return Pb()}class Ed{static async getAdapterModels(l,i){const c=await xt(),d=new c.ApiClient({apiUrl:"",adapterName:i});if(!d.getAdapterModels)throw new Error("getAdapterModels is not available on this API client");return d.getAdapterModels(l)}static async getAllModels(l){const i=await xt(),c=new i.ApiClient({apiUrl:"",adapterName:l});if(!c.getAllModels)throw new Error("getAllModels is not available on this API client");return c.getAllModels()}static async listAdapterModels(l,i){return(await Ed.getAdapterModels(l,i)).models}}const x1="rounded-t-[32px] border border-white/40 bg-transparent px-4 pb-4 pt-[max(env(safe-area-inset-top),1rem)] shadow-none backdrop-blur-0 dark:border-[#2f303d] dark:bg-transparent md:rounded-none md:border-0 md:bg-transparent md:px-0 md:pb-0 md:pt-3 md:shadow-none md:backdrop-blur-0 md:dark:bg-transparent md:dark:border-0",b1="shrink-0 sticky bottom-[calc(var(--app-footer-height,0px)+0.25rem)] z-10 -mx-4 mt-auto overflow-visible bg-transparent pb-[max(env(safe-area-inset-bottom),0.5rem)] shadow-none backdrop-blur-0 transition-all duration-200 dark:bg-transparent md:bottom-[calc(var(--app-footer-height,0px)+0.5rem)] md:z-10 md:mx-0 md:mt-0 md:overflow-visible md:rounded-none md:border-0 md:bg-transparent md:pb-0 md:shadow-none md:backdrop-blur-0 md:dark:bg-transparent md:dark:border-0 [&>div]:bg-transparent md:[&>div]:rounded-none md:[&>div]:px-0",y1="relative z-20 shrink-0 -mx-4 px-4 pt-2 pb-2 bg-transparent border-b border-transparent dark:border-transparent dark:bg-transparent md:static md:mx-0 md:px-0 md:pt-6 md:pb-6 md:bg-transparent md:border-gray-200 md:dark:border-[#4a4b54] md:dark:bg-transparent";function v1({onOpenSettings:r,onOpenSidebar:l}){var On,Lt,_t,ia,Re,oa,za;const{conversations:i,currentConversationId:c,createConversation:d,canCreateNewConversation:f,sendMessage:h,regenerateResponse:p,editMessageAndRegenerate:x,isLoading:v,configureApiSettings:b,error:w,clearError:k,createThread:S,clearCurrentConversationAdapter:_}=Ye(),{settings:A}=Vo(),D=us(),O=Ea()&&!D,{theme:ee,isDark:U}=cs(),z=ee.mode==="dark"?"dark":ee.mode==="light"?"light":"",H=U?"dark":"light",K=["application-description agent-home-markdown prose prose-slate dark:prose-invert max-w-none text-sm md:text-base leading-relaxed","text-[#4a4c5a] dark:text-[#bfc2cd]","[&>:first-child]:mt-0 [&>:last-child]:mb-0",z].filter(Boolean).join(" "),j=i.find(Me=>Me.id===c),q=i.some(Me=>{var Qe;return(Me.messages.length>0||(((Qe=Me.attachedFiles)==null?void 0:Qe.length)||0)>0)&&!Me.adapterLoadError}),V=!j||j.messages.length===0,I=((On=j==null?void 0:j.adapterInfo)==null?void 0:On.supportsThreading)===!0,P=!!(j!=null&&j.adapterName&&(j!=null&&j.adapterInfo))&&!I,ue=wg({adapterName:j==null?void 0:j.adapterName,enabled:P,selectionScopeKey:c,supportsThreading:I}),_e=og(),te=kd(),oe=_d().trim(),E=oe.length>0,{registerGoHome:Y}=Rg(),[B,re]=g.useState([]),[ce,ge]=g.useState(null);g.useEffect(()=>{const Me=j==null?void 0:j.adapterName;let Qe=!1;async function it(){if(ge(null),!Me){re([]);return}try{const be=await Ed.listAdapterModels(Me,Me);if(Qe)return;re(be),ge(be.length>0?be[0].name:null)}catch{Qe||(re([]),ge(null))}}return it(),()=>{Qe=!0}},[j==null?void 0:j.adapterName]);const{adapterNotesError:pe,handleAgentCardSelection:G,handleChangeAgent:me,goToAgentSelectionHome:de,hasAdapterConfigurationError:fe,isAgentSelectionVisible:ye,isConfiguringAdapter:ae,isSingleAdapterMode:ie,shouldShowAgentSelectionList:xe}=Wv({currentConversation:j,showEmptyState:V,createConversation:d,configureApiSettings:b,clearError:k,clearCurrentConversationAdapter:_});g.useLayoutEffect(()=>(Y(()=>de()),()=>Y(null)),[Y,de]);const Ne="max-w-[96rem]",ve="max-w-[64rem]",Te="max-w-[56rem]",Le=`mx-auto w-full ${Ne}`,qe=f(),Be=!!(j!=null&&j.adapterName)&&((j==null?void 0:j.messages.length)||0)===0,Ge=qe?"Start a new conversation":O?"Guest conversation limit reached. Sign in for more conversations.":"Finish your current conversation before starting a new one.",He=!!(j&&!xe),vt=xe?"border-transparent dark:border-transparent md:border-transparent md:dark:border-transparent":"",st=!cd()&&xe?"pt-0 pb-0 md:pt-0 md:pb-1":"",Ee=`${y1} ${vt} ${st}`.trim(),zt=hg(),we=i.some(Me=>{var Qe;return(Me.messages.length>0||(((Qe=Me.attachedFiles)==null?void 0:Qe.length)??0)>0)&&!Me.adapterLoadError}),Xt=zt&&!we,sn=xe?"pt-0 md:pt-0":"pt-4 md:pt-6",Dt=g.useMemo(()=>{var be,It,Rt;if(xe)return null;const Me=m1(j==null?void 0:j.adapterName)||h1();if(!Me&&!(j!=null&&j.adapterName))return null;const Qe=(be=j==null?void 0:j.adapterName)==null?void 0:be.trim(),it=(Rt=(It=j==null?void 0:j.adapterInfo)==null?void 0:It.notes)==null?void 0:Rt.trim();return Me?{...Me,notes:it||Me.notes}:Qe?{id:Qe,name:Qe,notes:it||void 0}:null},[(Lt=j==null?void 0:j.adapterInfo)==null?void 0:Lt.notes,j==null?void 0:j.adapterName,xe]);g.useEffect(()=>{Ug(Dt)},[Dt]),g.useEffect(()=>{let Me=null;const Qe=()=>{Me&&(Me(),Me=null)};if(A.voiceEnabled){if(ql.isAudioEnabled())return ne("[ChatInterface] Audio streaming already enabled"),Qe;const it=()=>{Qe();const be=async()=>{Qe(),await ql.enableAudio()?ne("[ChatInterface] Audio streaming enabled after user gesture"):(Fe("[ChatInterface] User gesture did not enable audio streaming"),it())};document.addEventListener("pointerdown",be,{once:!0}),document.addEventListener("keydown",be,{once:!0}),Me=()=>{document.removeEventListener("pointerdown",be),document.removeEventListener("keydown",be)},ne("[ChatInterface] Waiting for user gesture to enable audio streaming")};return it(),Qe}return Qe(),ql.disableAudio(),ne("[ChatInterface] Audio streaming disabled via settings"),Qe},[A.voiceEnabled]);const Ft=(Me,Qe,it,be)=>{h(Me,Qe,it,ce??void 0,be)},Hl=async(Me,Qe,it,be,It)=>{await h(it,void 0,Me,It??ce??void 0,be)},ya=()=>{try{d()}catch(Me){Fe("Cannot create new conversation:",Me instanceof Error?Me.message:"Unknown error")}},wn=g.useCallback(async(Me,Qe)=>{if(j)try{await Ye.getState().deleteThread(j.id,Me,Qe)}catch(it){Ie("Failed to clear thread:",it)}},[j]);return u.jsx("main",{className:"flex-1 flex flex-col bg-transparent overflow-hidden","aria-label":"Chat workspace",children:u.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden px-3 sm:px-5 lg:px-8",children:u.jsxs("div",{className:`mx-auto flex h-full w-full ${Ne} flex-col overflow-hidden md:pb-4 ${x1}`,children:[w&&u.jsx("div",{role:"alert",className:"mt-6 rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-600/40 dark:bg-red-900/30 dark:text-red-200",children:u.jsxs("div",{className:"flex items-start justify-between",children:[u.jsx("p",{children:w}),u.jsx("button",{onClick:k,className:"ml-4 rounded p-1 text-red-500 hover:bg-red-100 hover:text-red-700 dark:text-red-200 dark:hover:bg-red-800/40","aria-label":"Dismiss error",children:"×"})]})}),u.jsxs("div",{className:Ee,children:[l&&u.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2 md:hidden",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("button",{onClick:l,disabled:!q,className:`inline-flex items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-semibold shadow-sm transition-all duration-150 ${q?"border-white/50 bg-white/80 text-gray-800 active:scale-[0.97] hover:bg-white dark:border-[#2f303d] dark:bg-[#232430] dark:text-[#ececf1]":"cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400 shadow-none dark:border-[#2f303d] dark:bg-[#181922] dark:text-[#6b6f7a]"}`,"aria-label":"Open conversations menu",children:[u.jsx(Gx,{className:"h-4 w-4"}),"Chats"]}),u.jsxs("button",{onClick:r,className:"inline-flex items-center justify-center gap-1.5 rounded-lg border border-white/50 bg-[#11121a]/90 px-3 py-2 text-xs font-semibold text-white shadow-sm active:scale-[0.97] transition-all duration-150 hover:bg-[#0c0d14] dark:border-[#3b3c49] dark:bg-[#565869] dark:hover:bg-[#6b6f7a]","aria-label":"Open settings",children:[u.jsx(hp,{className:"h-4 w-4"}),"Settings"]})]}),u.jsx("div",{className:"ml-auto flex-shrink-0",children:u.jsx(md,{})})]}),u.jsxs("div",{className:"flex flex-col gap-2 md:gap-4 sm:flex-row sm:items-end sm:justify-between",children:[u.jsx("div",{className:"min-w-0 flex-1",children:He&&u.jsx("div",{className:"space-y-1.5 md:space-y-3",children:u.jsxs("div",{className:"md:space-y-1",children:[u.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[u.jsx("h1",{className:"min-w-0 truncate text-lg md:text-2xl font-semibold text-[#353740] dark:text-[#ececf1]",children:(j==null?void 0:j.title)||"New Chat"}),j&&u.jsx("span",{className:"flex-shrink-0 text-xs md:hidden text-gray-500 dark:text-[#bfc2cd]",children:j.updatedAt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),j&&u.jsx("div",{className:"hidden md:flex items-center text-sm text-gray-500 dark:text-[#bfc2cd]",children:u.jsxs("span",{children:["Updated ",j.updatedAt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})})]})})}),u.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 my-2 md:my-0 sm:w-auto md:justify-end md:gap-3",children:[u.jsx("div",{className:"hidden flex-shrink-0 items-center md:inline-flex",children:u.jsx("button",{onClick:r,className:"inline-flex h-[42px] w-[42px] items-center justify-center rounded-full border border-gray-200 text-gray-500 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400/50 dark:border-[#3c3f4a] dark:text-[#9aa1bc] dark:hover:border-[#4d5166] dark:hover:bg-[#2d2f39] dark:hover:text-[#ececf1]","aria-label":"Settings",title:"Settings",children:u.jsx(hp,{className:"h-4 w-4"})})}),!ie&&!xe&&!!(j!=null&&j.adapterName)&&u.jsx("button",{type:"button",onClick:()=>{Be&&me()},disabled:!Be,className:`order-2 sm:order-1 inline-flex h-8 md:h-[42px] w-[calc(50%-0.25rem)] min-w-[140px] md:w-[190px] items-center justify-center gap-1 md:gap-2 rounded-full border px-2.5 md:px-3.5 py-1.5 md:py-2.5 text-[11px] md:text-[13px] font-medium tracking-[0.01em] transition-colors focus-visible:outline-none focus-visible:ring-2 ${Be?"border-blue-300 text-blue-700 hover:bg-blue-50 hover:border-blue-400 focus-visible:ring-blue-500 dark:border-blue-500/40 dark:text-blue-300 dark:hover:bg-blue-900/20 dark:hover:border-blue-400/60 dark:focus-visible:ring-blue-400/60":"cursor-not-allowed border-gray-200 text-gray-400 bg-transparent dark:border-[#3c3f4a] dark:text-[#6b6f7a]"}`,title:Be?"Switch to a different agent before starting this conversation":"Agent cannot be changed after the conversation has started",children:"Change Agent"}),!xe&&u.jsxs("button",{onClick:ya,disabled:!qe,className:`order-3 sm:order-2 inline-flex h-8 md:h-[42px] w-[calc(50%-0.25rem)] min-w-[140px] md:w-[190px] items-center justify-center gap-1 md:gap-2 rounded-full border px-2.5 md:px-3.5 py-1.5 md:py-2.5 text-[11px] md:text-[13px] font-medium tracking-[0.01em] ${qe?"border-[#1f2937] bg-[#1f2937] text-white shadow-[0_2px_8px_rgba(15,23,42,0.12)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1f2937]/40 dark:border-[#4b5568] dark:bg-[#2f3747] dark:text-[#e9edf8] dark:shadow-[0_2px_8px_rgba(0,0,0,0.25)] dark:focus-visible:ring-[#6f809f]/35":"cursor-not-allowed border-gray-200 text-gray-400 bg-white/40 dark:border-[#3c3f4a] dark:text-[#6b6f7a] dark:bg-transparent"}`,title:Ge,children:[u.jsx(tb,{className:"h-3.5 w-3.5"}),"New Conversation"]}),!cd()&&u.jsx("div",{className:"order-4 hidden flex-shrink-0 items-center md:inline-flex",children:u.jsx(md,{})})]})]})]}),V?u.jsxs("div",{className:`flex flex-1 flex-col min-h-0 ${sn} ${xe?"overflow-hidden":""}`,children:[xe?u.jsx("div",{className:"flex-1 flex flex-col md:justify-start min-h-0 overflow-hidden",children:u.jsx("div",{className:"w-full flex flex-col min-h-0 overflow-hidden flex-1",children:u.jsxs("div",{className:"flex flex-col min-h-0 flex-1 gap-3 overflow-hidden md:gap-6",children:[u.jsx("div",{className:`${Le} flex-shrink-0 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:u.jsxs("div",{className:"flex-1",children:[u.jsx(rl,{content:te,className:"agent-home-markdown prose prose-slate dark:prose-invert max-w-none [&>:first-child]:mt-0 [&>:last-child]:mb-0 text-2xl font-semibold text-[#11111b] dark:text-white text-center md:text-left [&_p]:text-2xl [&_p]:font-semibold [&_p]:leading-tight [&_p]:m-0",syntaxTheme:H}),E&&u.jsx("div",{className:"mt-2",children:u.jsx(rl,{content:oe,className:K,syntaxTheme:H})})]})}),u.jsx(Vv,{onAdapterSelect:G,className:`${Le} md:flex-1 md:min-h-0 md:overflow-hidden`})]})})}):u.jsx("div",{className:"flex flex-1 w-full min-h-0 flex-col overflow-y-auto pt-4 md:pt-6",children:u.jsxs("div",{className:`mx-auto flex w-full ${Te} flex-col items-center gap-4 pb-8 md:gap-5 md:pb-12`,children:[pe?u.jsx("p",{className:"w-full text-center text-sm text-red-600 dark:text-red-400",children:pe}):j!=null&&j.adapterName?u.jsx("h2",{className:"w-full text-center text-xl font-semibold tracking-tight text-[#353740] dark:text-[#ececf1] md:text-2xl",style:{fontFamily:'-apple-system, "SF Pro Display", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},children:Qb(j.adapterName)||j.adapterName}):ae?u.jsx("p",{className:"w-full text-center text-sm text-gray-500 dark:text-[#bfc2cd]",children:"Configuring your agent…"}):null,Dt&&g1()&&u.jsx(t1,{adapter:Dt,syntaxTheme:H,forcedThemeClass:z}),u.jsx("div",{className:"w-full min-w-0",children:u.jsx($p,{onSend:Ft,disabled:v||!j||!(j!=null&&j.adapterName)||fe,autoFocusEnabled:!0,placeholder:_e,isCentered:!0,maxWidthClass:Te,adapterNotes:(_t=j==null?void 0:j.adapterInfo)==null?void 0:_t.notes,skillState:ue,availableModels:B,defaultModel:((ia=j==null?void 0:j.adapterInfo)==null?void 0:ia.model)??null,selectedModel:ce,onSelectModel:ge})})]})}),Xt&&u.jsx("div",{className:"shrink-0 pt-5 md:pt-6",children:u.jsx(Mg,{compact:!0})})]}):u.jsxs("div",{className:"flex flex-1 flex-col min-h-0",children:[u.jsx(wv,{messages:j.messages,onRegenerate:Me=>p(Me,ce??void 0),onEditMessage:(Me,Qe)=>x(Me,Qe,ce??void 0),onStartThread:async(Me,Qe)=>{try{await S(Me,Qe)}catch(it){Ie("Failed to create thread:",it)}},onClearThread:wn,onSendThreadMessage:Hl,sessionId:j.sessionId,isLoading:v,contentMaxWidthClass:ve,availableModels:B,defaultModel:((Re=j==null?void 0:j.adapterInfo)==null?void 0:Re.model)??null,selectedModel:ce}),u.jsx("div",{className:b1,children:u.jsx("div",{className:"mx-auto w-full max-w-[96rem] px-3 sm:px-5 md:px-6 lg:px-8 xl:px-10",children:u.jsx($p,{onSend:Ft,disabled:v||!j||!j.adapterName||ye||fe,autoFocusEnabled:!0,placeholder:"Start a new topic...",maxWidthClass:ve,isCentered:!1,adapterNotes:(oa=j==null?void 0:j.adapterInfo)==null?void 0:oa.notes,skillState:ue,availableModels:B,defaultModel:((za=j==null?void 0:j.adapterInfo)==null?void 0:za.model)??null,selectedModel:ce,onSelectModel:ge})})})]})]})})})}function w1({selectedAdapter:r,onAdapterChange:l,disabled:i,showDescriptions:c=!1,variant:d="sidebar",label:f,showLabel:h}){const[p,x]=g.useState([]),[v,b]=g.useState(!0),[w,k]=g.useState(null),[S,_]=g.useState(!1);g.useEffect(()=>{let q=!0;async function V(){try{b(!0),k(null);const I=await Td();q&&x(I)}catch(I){Ie("Failed to load adapters:",I),q&&k("Failed to load adapters. Please check your connection.")}finally{q&&b(!1)}}return V(),()=>{q=!1}},[]);const A=p.find(q=>q.id===r),D=typeof h=="boolean"?h:d==="prominent",O=f||(d==="prominent"?"Select an agent":"Adapter"),ee=g.useMemo(()=>d==="prominent"?"relative w-full text-left":"relative w-full",[d]),U=g.useMemo(()=>{const q="w-full rounded-md border bg-white px-4 py-3 text-left text-sm text-[#353740] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:bg-[#343541] dark:text-[#ececf1]";return d==="prominent"?[q,"border-gray-300 shadow-sm transition-all duration-200 focus-visible:ring-blue-500 dark:border-[#4a4b54] dark:focus-visible:ring-blue-400"].join(" "):["w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-left text-sm text-[#353740] focus:border-gray-400 focus:outline-none dark:border-[#4a4b54] dark:bg-[#343541] dark:text-[#ececf1] dark:focus:border-[#6b6f7a]"].join(" ")},[d]),z=g.useMemo(()=>d==="prominent"?"absolute z-20 mt-2 w-full rounded-xl border border-gray-200 bg-white shadow-xl ring-1 ring-black/5 dark:border-[#4a4b54] dark:bg-[#1f2027]":"absolute z-20 mt-1 w-full rounded-md border border-gray-200 bg-white shadow-lg ring-1 ring-black/5 dark:border-[#4a4b54] dark:bg-[#1f2027]",[d]),j=D?`mb-2 block text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-[#bfc2cd] ${d==="prominent"?"!text-sm !font-semibold !text-gray-700 dark:!text-white":""}`:"sr-only";return u.jsxs("div",{className:ee,children:[u.jsx("label",{className:j,children:O}),u.jsxs("div",{className:"relative",children:[u.jsx("button",{type:"button",onClick:()=>!i&&_(!S),disabled:i||v||p.length===0,className:`${U} disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":O,children:u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex flex-col min-w-0",children:[u.jsx("span",{className:`truncate font-medium ${A?"text-[#11121a] dark:text-white":"text-gray-500 dark:text-gray-400"}`,children:v?"Loading agents…":w?"Error loading agents":A?A.name:p.length===0?"No agents available":"Select an agent"}),d==="prominent"&&(A==null?void 0:A.description)&&u.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:A.description})]}),u.jsx(fi,{className:`h-4 w-4 flex-shrink-0 transition-transform text-gray-400 dark:text-gray-300 ${S?"rotate-180":""}`})]})}),S&&!i&&p.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>_(!1)}),u.jsx("div",{className:z,children:u.jsx("div",{className:"max-h-72 overflow-auto py-2",children:p.map(q=>{const V=q.id===r;return u.jsx("button",{type:"button",onClick:()=>{V||l(q.id),_(!1)},className:`w-full px-4 py-3 text-left text-sm transition-colors ${V?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-200":"text-[#353740] hover:bg-gray-50 dark:text-[#ececf1] dark:hover:bg-[#2a2d35]"}`,children:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{className:"font-medium truncate",children:q.name}),c&&q.description&&u.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:q.description})]})},q.id)})})})]})]}),w&&u.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:w})]})}const zo=100;function S1(r,l){const i=new Date(l.getFullYear(),l.getMonth(),l.getDate()),c=new Date(i);c.setDate(c.getDate()-1);const d=new Date(i);d.setDate(d.getDate()-i.getDay());const f=new Date(l.getFullYear(),l.getMonth(),1);return r>=i?"Today":r>=c?"Yesterday":r>=d?"This Week":r>=f?"This Month":"Earlier"}function k1(r){const l=new Date,i=["Today","Yesterday","This Week","This Month","Earlier"],c=new Map;for(const d of r){const f=S1(d.updatedAt,l),h=c.get(f);h?h.push(d):c.set(f,[d])}return i.filter(d=>c.has(d)).map(d=>({label:d,conversations:c.get(d)}))}function Fp({onRequestClose:r,onToggleDesktopSidebar:l}){const i=Xo(),{conversations:c,currentConversationId:d,selectConversation:f,deleteConversation:h,deleteAllConversations:p,updateConversationTitle:x,getConversationCount:v,configureApiSettings:b,clearError:w}=Ye(),k=c.find(se=>se.id===d),[S,_]=g.useState(""),[A,D]=g.useState(null),[O,ee]=g.useState(""),[U,z]=g.useState({isOpen:!1,conversationId:"",conversationTitle:"",isDeleting:!1}),[H,K]=g.useState({isOpen:!1,isDeleting:!1}),[j,q]=g.useState(!1),[V,I]=g.useState(null),[P,ue]=g.useState(!1),[_e,te]=g.useState(null),oe=g.useRef(null),E=g.useRef(null),Y=g.useRef(null),B=!k||k.messages.length===0,re=(V==null?void 0:V.conversationId)===d?V.adapterName:(k==null?void 0:k.adapterName)??null,ce=(_e==null?void 0:_e.conversationId)===d?_e.message:null,ge=g.useMemo(()=>c.filter(se=>{var Ee;return(se.messages.length>0||(((Ee=se.attachedFiles)==null?void 0:Ee.length)||0)>0)&&!se.adapterLoadError}),[c]),pe=g.useMemo(()=>{if(!S)return ge;const se=S.toLowerCase();return ge.filter(Ee=>Ee.title.toLowerCase().includes(se)||Ee.messages.some(zt=>zt.content.toLowerCase().includes(se))||(Ee.attachedFiles||[]).some(zt=>zt.filename.toLowerCase().includes(se)))},[ge,S]),G=g.useMemo(()=>k1(pe),[pe]),me=v(),de=S.length>0,fe=ge.length>0;g.useEffect(()=>{if(!d||!E.current)return;const se=E.current.querySelector('[aria-current="true"]');se&&se.scrollIntoView({block:"nearest",behavior:"smooth"})},[d]);const ye=g.useCallback(se=>{var sn;if(se.key!=="ArrowDown"&&se.key!=="ArrowUp")return;se.preventDefault();const Ee=(sn=E.current)==null?void 0:sn.querySelectorAll('[role="option"]');if(!Ee||Ee.length===0)return;const zt=document.activeElement,we=Array.from(Ee).indexOf(zt);let Xt;se.key==="ArrowDown"?Xt=we<Ee.length-1?we+1:0:Xt=we>0?we-1:Ee.length-1,Ee[Xt].focus()},[]),ae=async se=>{if(!(!B||!se)){I({conversationId:d??null,adapterName:se}),te(null),ue(!0);try{const Ee=(k==null?void 0:k.apiUrl)||kt();await b(Ee,void 0,se),w(),q(!1)}catch(Ee){Ie("Failed to configure adapter:",Ee),te({conversationId:d??null,message:Ee instanceof Error?Ee.message:"Failed to configure adapter"})}finally{ue(!1)}}},ie=async se=>{try{await f(se),r==null||r()}catch(Ee){Ie("Failed to select conversation:",Ee)}},xe=(se,Ee)=>{se.stopPropagation(),z({isOpen:!0,conversationId:Ee.id,conversationTitle:Ee.title,isDeleting:!1})},Ne=async()=>{z(se=>({...se,isDeleting:!0}));try{await h(U.conversationId)}catch(se){Ie("Failed to delete conversation:",se)}z({isOpen:!1,conversationId:"",conversationTitle:"",isDeleting:!1})},ve=()=>{z({isOpen:!1,conversationId:"",conversationTitle:"",isDeleting:!1})},Te=(se,Ee)=>{se.stopPropagation(),D(Ee.id),ee(Ee.title.slice(0,zo))},Le=se=>{const Ee=O.slice(0,zo).trim();Ee&&x(se,Ee),D(null),ee("")},qe=()=>{D(null),ee("")},Be=()=>{K({isOpen:!0,isDeleting:!1})},Ge=async()=>{K(se=>({...se,isDeleting:!0}));try{await p()}catch(se){Ie("Failed to clear all conversations:",se)}K({isOpen:!1,isDeleting:!1})},He=()=>{K({isOpen:!1,isDeleting:!1})},vt=se=>{var Ee,zt,we;return(Ee=se.adapterName)!=null&&Ee.trim()?se.adapterName:(we=(zt=se.adapterInfo)==null?void 0:zt.adapter_name)!=null&&we.trim()?se.adapterInfo.adapter_name:null};ui(oe,{enabled:j,onEscape:()=>q(!1)});const st=se=>{const Ee=d===se.id,zt=vt(se);return u.jsx("div",{role:"option","aria-selected":Ee,tabIndex:0,onKeyDown:we=>{(we.key==="Enter"||we.key===" ")&&(we.preventDefault(),ie(se.id))},onClick:()=>ie(se.id),className:`group relative flex w-full cursor-pointer items-center rounded-lg px-3 py-2 text-left text-sm transition-colors duration-100
|
|
366
|
-
${Ee?"bg-slate-100 dark:bg-[#2a2b36]":"hover:bg-slate-100/70 dark:hover:bg-[#25262f]"} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/50 dark:focus-visible:ring-sky-400/40`,"aria-current":Ee?"true":void 0,"aria-label":`Open conversation: ${se.title}`,children:A===se.id?u.jsx("input",{type:"text",value:O,onChange:we=>ee(we.target.value.slice(0,zo)),onKeyDown:we=>{we.key==="Enter"&&Le(se.id),we.key==="Escape"&&qe(),we.stopPropagation()},onBlur:()=>Le(se.id),maxLength:zo,className:"flex-1 rounded border border-sky-300 bg-white px-2 py-0.5 text-sm text-[#353740] focus:outline-none focus:ring-2 focus:ring-sky-400/50 dark:border-sky-500/40 dark:bg-[#1a1b1e] dark:text-[#ececf1]",autoFocus:!0,"aria-label":"Edit conversation title"}):u.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[u.jsx("h3",{className:`flex-1 truncate text-sm leading-snug ${Ee?"font-medium text-slate-900 dark:text-[#ececf1]":"font-normal text-slate-700 dark:text-[#c5c8d6]"}`,children:se.title}),u.jsxs("div",{className:"ml-1 flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity duration-100 group-hover:opacity-100 group-focus-within:opacity-100",children:[u.jsx("button",{onClick:we=>Te(we,se),className:"rounded p-1 text-slate-400 transition-colors hover:bg-slate-200/80 hover:text-slate-600 dark:text-[#6b6f7a] dark:hover:bg-[#3c3f4a] dark:hover:text-[#c5c8d6]","aria-label":`Rename conversation: ${se.title}`,children:u.jsx(ng,{className:"h-3 w-3"})}),u.jsx("button",{onClick:we=>xe(we,se),className:"rounded p-1 text-slate-400 transition-colors hover:bg-red-100/80 hover:text-red-600 dark:text-[#6b6f7a] dark:hover:bg-red-900/30 dark:hover:text-red-400","aria-label":`Delete conversation: ${se.title}`,children:u.jsx(sg,{className:"h-3 w-3"})})]})]}),zt&&u.jsx("span",{className:"truncate text-[11px] leading-none text-slate-400 dark:text-[#6b6f7a]",children:zt})]})},se.id)};return u.jsxs(u.Fragment,{children:[!i&&j&&u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm px-4",children:u.jsxs("div",{ref:oe,role:"dialog","aria-modal":"true","aria-labelledby":"select-agent-title",tabIndex:-1,className:"w-full max-w-md rounded-2xl border border-gray-200 bg-white p-6 shadow-2xl dark:border-[#3d4050] dark:bg-[#1a1b1e]",children:[u.jsx("h2",{id:"select-agent-title",className:"mb-4 text-lg font-semibold text-gray-900 dark:text-[#ececf1]",children:"Select an Agent"}),u.jsxs("div",{className:"space-y-5",children:[u.jsx(w1,{selectedAdapter:re,onAdapterChange:ae,disabled:P,variant:"prominent",showDescriptions:!0,showLabel:!1}),ce&&u.jsx("div",{role:"alert",className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-600/40 dark:bg-red-900/30 dark:text-red-200",children:ce}),u.jsx("div",{className:"flex justify-end gap-3 pt-2",children:u.jsx("button",{type:"button",onClick:()=>{te(null),q(!1)},className:"rounded-lg px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:text-[#d1d5db] dark:hover:bg-[#2d2f39]",disabled:P,children:"Cancel"})})]})]})}),u.jsxs("nav",{"aria-label":"Conversation sidebar",className:"flex h-full md:h-[calc(100%-2rem)] md:mt-4 w-full md:w-72 flex-col border-r border-b border-gray-200 md:border-l md:border-t md:rounded-2xl md:overflow-hidden bg-transparent dark:border-[#2d2f39]",children:[u.jsxs("div",{className:"bg-transparent px-4 pb-4 pt-4 dark:border-[#2d2f39]",children:[u.jsxs("div",{className:"flex items-center gap-2 pb-3",children:[c.length>0&&c.some(se=>se.messages.length>0)&&u.jsxs("button",{onClick:Be,className:"flex flex-1 items-center justify-center gap-2 rounded-lg border border-red-200 px-3 py-2 text-sm font-medium text-red-600 transition-all duration-150 hover:bg-red-50 hover:border-red-300 hover:shadow-sm dark:border-red-500/25 dark:text-red-400 dark:hover:bg-red-950/20 dark:hover:border-red-500/40",title:"Delete all conversations",children:[u.jsx(ib,{className:"h-4 w-4"}),"Delete Conversations"]}),l&&u.jsx("button",{type:"button",onClick:l,className:"ml-auto hidden shrink-0 md:inline-flex h-9 w-9 items-center justify-center rounded-xl border border-slate-200/80 bg-white text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:border-[#333645] dark:bg-[#161616] dark:text-[#d1d5db] dark:hover:border-[#43465a] dark:hover:bg-[#202020] dark:hover:text-white","aria-label":"Close sidebar",title:"Close sidebar",children:u.jsx(Kx,{className:"h-4 w-4"})})]}),ce&&!j&&u.jsx("p",{role:"alert",className:"mt-2 text-xs text-red-600 dark:text-red-400",children:ce}),fe&&u.jsxs("div",{className:"border-t border-gray-200 pt-4 mt-4 dark:border-[#2d2f39]",children:[u.jsxs("div",{className:"relative overflow-hidden rounded-[1.75rem] border border-slate-200/85 bg-[linear-gradient(180deg,rgba(255,255,255,0.96),rgba(248,250,252,0.94))] shadow-[0_10px_28px_rgba(15,23,42,0.05)] transition-all duration-200 focus-within:border-sky-300/90 focus-within:shadow-[0_0_0_1px_rgba(125,211,252,0.55),0_10px_28px_rgba(15,23,42,0.05)] dark:border-white/10 dark:bg-[linear-gradient(180deg,rgba(37,39,49,0.95),rgba(29,31,39,0.92))] dark:shadow-[0_12px_30px_rgba(0,0,0,0.2)] dark:focus-within:border-sky-400/30 dark:focus-within:shadow-[0_0_0_1px_rgba(56,189,248,0.22),0_12px_30px_rgba(0,0,0,0.2)]",children:[u.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[inherit] bg-[linear-gradient(180deg,rgba(255,255,255,0.45),rgba(255,255,255,0))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]"}),u.jsx(yd,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400 dark:text-slate-500"}),u.jsx("input",{ref:Y,type:"text",role:"searchbox","aria-label":"Search conversations",placeholder:"Search Conversations",value:S,onChange:se=>_(se.target.value),className:"relative z-10 w-full bg-transparent py-3 pl-11 pr-11 text-sm font-medium text-slate-700 placeholder:font-normal placeholder:text-slate-400 focus:outline-none dark:text-slate-100 dark:placeholder:text-slate-500"}),S&&u.jsx("button",{type:"button",onClick:()=>{var se;_(""),(se=Y.current)==null||se.focus()},className:"absolute right-3 top-1/2 z-10 inline-flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-slate-200/80 bg-white/90 text-slate-400 transition-colors hover:border-slate-300 hover:text-slate-600 focus:outline-none focus:ring-2 focus:ring-sky-200 dark:border-white/10 dark:bg-white/5 dark:text-slate-500 dark:hover:border-white/20 dark:hover:text-slate-200 dark:focus:ring-sky-500/20","aria-label":"Clear search",children:u.jsx(ba,{className:"h-3.5 w-3.5"})})]}),de&&u.jsx("p",{"aria-live":"polite",className:"mt-2 text-center text-[11px] tabular-nums text-gray-400 dark:text-[#6e7490]",children:pe.length===0?"No results":`${pe.length} ${pe.length===1?"result":"results"}`})]})]}),u.jsx("div",{ref:E,role:"listbox","aria-label":"Conversations",onKeyDown:ye,className:"flex-1 overflow-y-auto bg-transparent px-3 py-2",children:pe.length===0?null:de?u.jsx("div",{className:"space-y-1",children:pe.map(st)}):u.jsx("div",{className:"space-y-4",children:G.map(se=>u.jsxs("section",{"aria-label":se.label,children:[u.jsx("h4",{className:"sticky top-0 z-10 mb-1 bg-transparent px-1 pb-1 pt-0.5 text-[11px] font-semibold uppercase tracking-wider text-gray-400 backdrop-blur-sm dark:text-[#6e7490]",children:se.label}),u.jsx("div",{className:"space-y-1",children:se.conversations.map(st)})]},se.label))})}),(()=>{const se=mg();return se.length===0?null:u.jsx("div",{className:"shrink-0 border-t border-gray-200/80 px-4 py-3 md:hidden dark:border-[#2d2f39]",children:u.jsx("nav",{"aria-label":"Header links",children:u.jsx("ul",{className:"flex flex-wrap gap-2",children:se.map(Ee=>u.jsx("li",{children:u.jsx("a",{href:Ee.url,className:"inline-flex items-center rounded-md px-2.5 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-[#d1d5db] dark:hover:bg-[#2b2d39]",children:Ee.label})},Ee.url))})})})})(),u.jsx("div",{className:"shrink-0 border-t border-gray-200/80 dark:border-[#2d2f39]",children:u.jsx(Mg,{placement:"sidebar",compact:!0})})]}),u.jsx(Bo,{isOpen:U.isOpen,onClose:ve,onConfirm:Ne,title:"Delete Conversation",message:`Are you sure you want to delete "${U.conversationTitle}"? This will clear the conversation history.`,confirmText:"Delete",cancelText:"Cancel",type:"danger",isLoading:U.isDeleting}),u.jsx(Bo,{isOpen:H.isOpen,onClose:He,onConfirm:Ge,title:"Clear All Conversations",message:me===1?"Are you sure you want to delete this conversation? This will clear all conversation history.":`Are you sure you want to delete all ${me} conversations? This will clear all conversation history.`,confirmText:"Clear All",cancelText:"Cancel",type:"danger",isLoading:H.isDeleting})]})}const _1="3.10.8",A1={version:_1},Md=A1.version,C1=["@@auth0spajs@@","a0.spajs","auth0","com.auth0"];function j1(r){const l=r.toLowerCase();return C1.some(i=>l.includes(i.toLowerCase()))}function N1(r){const l=[];for(let i=0;i<r.length;i++){const c=r.key(i);c&&j1(c)&&l.push(c)}l.forEach(i=>r.removeItem(i))}function Ip(r){try{N1(r),r.clear()}catch(l){console.warn("[Settings] Failed to clear browser storage during reset.",l)}}function T1(){if(typeof document>"u"||!document.cookie)return;const r=new Set([void 0]),l=window.location.hostname;l&&l!=="localhost"&&!/^\d{1,3}(?:\.\d{1,3}){3}$/.test(l)&&(r.add(l),r.add(`.${l}`)),document.cookie.split(";").forEach(c=>{const d=c.indexOf("="),f=(d>-1?c.slice(0,d):c).trim();f&&r.forEach(h=>{const p=h?`;domain=${h}`:"";document.cookie=`${f}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/${p}`})})}function E1(){Ip(localStorage),Ip(sessionStorage),T1()}function M1({isOpen:r,onClose:l}){const{theme:i,updateTheme:c}=cs(),{settings:d,updateSettings:f}=Vo(),[h,p]=g.useState(!1),x=g.useRef(null),v=g.useRef(null),b=A=>{c({mode:A})},w=()=>{f({soundEnabled:!d.soundEnabled})},k=()=>{p(!0)},S=()=>{p(!1)},_=()=>{S(),Zo(),Ko(!1),os(null),Ma.getState().closeLoginPrompt(),E1(),window.location.reload()};return ui(x,{enabled:r&&!h,onEscape:l}),ui(v,{enabled:h,onEscape:S}),r?u.jsxs("div",{className:"fixed inset-0 z-50 flex items-end md:items-center justify-center overflow-y-auto bg-black/50 p-0 md:p-4",children:[u.jsx("button",{type:"button",onClick:l,"aria-label":"Close settings overlay",className:"absolute inset-0"}),u.jsxs("div",{onClick:A=>A.stopPropagation(),ref:x,role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",tabIndex:-1,className:"relative flex h-[100dvh] w-full max-w-none flex-col overflow-hidden bg-white shadow-2xl dark:bg-[#1a1b1e] md:h-auto md:max-h-[90vh] md:max-w-md md:rounded-2xl",children:[u.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between border-b border-gray-200 px-6 pb-4 pt-[max(env(safe-area-inset-top),1rem)] dark:border-[#2d2f39] md:p-6",children:[u.jsx("h2",{id:"settings-title",className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:"Settings"}),u.jsx("button",{onClick:l,className:"p-2 hover:bg-gray-100 dark:hover:bg-[#25262f] rounded-lg transition-colors","aria-label":"Close settings",children:u.jsx(ba,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),u.jsxs("div",{className:"flex-1 min-h-0 space-y-6 overflow-y-auto px-6 pb-[max(env(safe-area-inset-bottom),1.25rem)] pt-6 md:p-6",children:[u.jsxs("div",{className:"space-y-4",children:[u.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[u.jsx(Zx,{className:"w-5 h-5"}),"Appearance"]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Theme"}),u.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{value:"light",label:"Light",icon:sb},{value:"dark",label:"Dark",icon:Qx},{value:"system",label:"System",icon:Yx}].map(({value:A,label:D,icon:O})=>u.jsxs("button",{onClick:()=>b(A),className:`flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all duration-200 ${i.mode===A?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-[#2d2f39] hover:border-gray-300 dark:hover:border-[#43465a] text-gray-700 dark:text-gray-300"}`,children:[u.jsx(O,{className:"w-5 h-5"}),u.jsx("span",{className:"text-sm font-medium",children:D})]},A))})]})]}),u.jsxs("div",{className:"space-y-4",children:[u.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Chat Preferences"}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx($o,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),u.jsxs("div",{children:[u.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Sound Effects"}),u.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Play sounds for notifications and events"})]})]}),u.jsx("button",{onClick:w,role:"switch","aria-checked":d.soundEnabled,"aria-label":"Toggle sound effects",className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${d.soundEnabled?"bg-blue-600":"bg-gray-200 dark:bg-[#3c3f4a]"}`,children:u.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${d.soundEnabled?"translate-x-6":"translate-x-1"}`})})]})]}),u.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-[#2d2f39]",children:[u.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[u.jsx(sg,{className:"w-5 h-5"}),"Data Management"]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Clear all application data including conversations, and personalized settings."}),u.jsx("button",{onClick:k,className:"w-full px-4 py-2 text-sm font-medium text-red-600 dark:text-red-400 border border-red-300 dark:border-red-700 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors",children:"Reset Application"})]})]}),u.jsxs("p",{className:"pt-2 text-center text-xs text-gray-400 dark:text-[#858999]",children:["v",Md]})]}),h&&u.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:u.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-labelledby":"reset-dialog-title",tabIndex:-1,className:"max-h-[calc(100dvh-2rem)] w-full max-w-sm overflow-y-auto rounded-2xl border border-red-100 bg-white p-6 shadow-2xl dark:border-red-800/60 dark:bg-[#111113]",children:[u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsx("div",{className:"mt-0.5 flex h-10 w-10 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/40",children:u.jsx(wd,{className:"w-5 h-5 text-red-600 dark:text-red-400"})}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx("p",{id:"reset-dialog-title",className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Reset application data?"}),u.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"This removes everything stored on this device and reloads the app."})]})]}),u.jsxs("div",{className:"mt-4 flex gap-2 pt-2",children:[u.jsx("button",{onClick:S,className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-[#2d2f39] rounded-lg hover:bg-gray-50 dark:hover:bg-[#1a1b1e] transition-colors",children:"Cancel"}),u.jsx("button",{onClick:_,className:"flex-1 px-4 py-2 text-sm font-semibold rounded-lg transition-colors bg-red-600 text-white hover:bg-red-700 dark:bg-red-700 dark:hover:bg-red-600",children:"Reset"})]})]})})]})]}):null}function z1({message:r}){const l=kd();return u.jsx("main",{className:"min-h-dvh bg-white px-4 py-6 text-slate-950 dark:bg-black dark:text-slate-100 sm:px-6 lg:px-8",children:u.jsxs("div",{className:"mx-auto flex min-h-[calc(100dvh-3rem)] w-full max-w-5xl flex-col",children:[u.jsxs("header",{className:"flex items-center justify-between gap-4",children:[u.jsx("p",{className:"min-w-0 truncate text-lg font-semibold tracking-tight sm:text-xl",children:l}),u.jsxs("span",{className:"shrink-0 text-xs font-medium text-slate-400 dark:text-[#858999]",children:["v",Md]})]}),u.jsx("section",{className:"flex flex-1 items-center justify-center py-12",children:u.jsxs("div",{className:"w-full max-w-lg space-y-8",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"relative flex h-2.5 w-2.5 shrink-0",children:[u.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-60 dark:bg-amber-500"}),u.jsx("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-amber-500 dark:bg-amber-400"})]}),u.jsx("span",{className:"text-xs font-semibold uppercase tracking-widest text-amber-700 dark:text-amber-400",children:"Service paused"})]}),u.jsxs("div",{className:"space-y-4",children:[u.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-slate-950 dark:text-white sm:text-4xl",children:"Temporarily unavailable"}),u.jsx("p",{className:"max-w-md whitespace-pre-wrap text-base leading-relaxed text-slate-500 dark:text-slate-400",children:r})]}),u.jsx("div",{className:"border-t border-slate-200 dark:border-[#242424]"}),u.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[u.jsxs("button",{type:"button",onClick:()=>window.location.reload(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-slate-950 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:[u.jsx(nb,{className:"h-4 w-4","aria-hidden":"true"}),"Try again"]}),u.jsx("span",{className:"hidden text-slate-300 dark:text-slate-700 sm:block","aria-hidden":"true",children:"·"})]})]})})]})})}function D1({children:r}){const{instance:l,accounts:i}=gd(),c=wx();return g.useEffect(()=>{Ko(c)},[c]),g.useEffect(()=>{if(!c||i.length===0){os(null);return}const d=i[0];os(d.username||d.name||d.localAccountId||null)},[c,i]),g.useEffect(()=>{if(!c||i.length===0)return;const d=i[0],f=Cd();return pg(async()=>(await l.acquireTokenSilent({scopes:f,account:d})).accessToken),()=>Zo()},[c,i,l]),u.jsx(u.Fragment,{children:r})}function L1({children:r}){return u.jsx(D1,{children:r})}function R1({children:r}){const{isLoading:l,isAuthenticated:i,getAccessTokenSilently:c,user:d}=xd();return g.useEffect(()=>{Ko(i)},[i]),g.useEffect(()=>{if(!i){os(null);return}const f=(d==null?void 0:d.sub)||(d==null?void 0:d.email)||(d==null?void 0:d.nickname)||(d==null?void 0:d.name)||null;os(f)},[i,d]),g.useEffect(()=>(i&&pg(()=>c()),()=>Zo()),[i,c]),l?u.jsx("div",{className:"flex items-center justify-center h-screen bg-white dark:bg-[#212121]",children:u.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 dark:border-gray-100"})}):u.jsx(u.Fragment,{children:r})}function U1({children:r}){return g.useEffect(()=>{Ko(!1),os(null),Zo()},[]),u.jsx(u.Fragment,{children:r})}function O1({children:r}){return Ea()?Yo()==="entra"?u.jsx(L1,{children:r}):u.jsx(R1,{children:r}):u.jsx(U1,{children:r})}function $1(){const r=Ad(),l=Ea(),i=us(),{showLoginPrompt:c,promptMessage:d,closeLoginPrompt:f}=Ma();return g.useEffect(()=>{c&&(!r||!l||i)&&f()},[c,r,l,i,f]),!r||!l||i||!c?null:Yo()==="entra"?u.jsx(B1,{message:d,onClose:f}):u.jsx(q1,{message:d,onClose:f})}function q1({message:r,onClose:l}){const{loginWithRedirect:i}=xd();return u.jsx(Og,{message:r,onClose:l,onLogin:()=>i()})}function B1({message:r,onClose:l}){const{instance:i}=gd();return u.jsx(Og,{message:r,onClose:l,onLogin:()=>i.loginRedirect({scopes:Cd()}).catch(()=>{})})}function Og({message:r,onClose:l,onLogin:i}){return u.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[u.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:l,"aria-hidden":"true"}),u.jsxs("div",{className:"relative z-10 mx-4 w-full max-w-md rounded-2xl border border-gray-200 bg-white p-6 shadow-2xl dark:border-[#4a4b54] dark:bg-[#2d2f39]",children:[u.jsx("button",{onClick:l,className:"absolute right-3 top-3 rounded-full p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]","aria-label":"Close",children:u.jsx(ba,{className:"h-4 w-4"})}),u.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[u.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/40",children:u.jsx(ag,{className:"h-5 w-5 text-blue-600 dark:text-blue-300"})}),u.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-[#ececf1]",children:"Sign in for more"})]}),u.jsx("p",{className:"mb-6 text-sm leading-relaxed text-gray-600 dark:text-[#bfc2cd]",children:r}),u.jsxs("div",{className:"flex gap-3",children:[u.jsx("button",{onClick:i,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600",children:"Sign in"}),u.jsx("button",{onClick:l,className:"flex-1 rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400 dark:border-[#4a4b54] dark:bg-[#2d2f39] dark:text-[#bfc2cd] dark:hover:bg-[#3c3f4a]",children:"Cancel"})]})]})]})}function H1(){const{goHome:r}=Rg(),{isDark:l}=cs(),i=Kv(),c=g.useRef(!1),d=dy(),f=fy(),h=my(),p=l?h:f,x=hy(),v=py(),b=!!(x||v),w=gy(),k=xy(),S=by(),_=mg(),A=S?"border-b border-slate-200/80 dark:border-[#333645]":"",D="inline-flex min-h-10 items-center rounded-md px-2.5 text-sm font-medium transition-colors hover:bg-slate-100 hover:text-blue-700 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:hover:bg-[#2b2d39] dark:hover:text-blue-300";return g.useEffect(()=>{c.current},[h,d,f]),cd()?u.jsx("header",{className:`relative z-30 shrink-0 bg-white px-3 pb-1 pt-2 dark:bg-black sm:px-5 sm:pb-2 sm:pt-3 lg:px-8 md:pt-5 ${A}`.trim(),style:{backgroundColor:w||void 0,color:k||void 0},children:u.jsxs("div",{className:"mx-auto flex w-full max-w-[96rem] items-center justify-between gap-3",children:[u.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-2 md:justify-start md:gap-3",children:u.jsx("a",{href:i,"aria-label":"Go to home page",onClick:O=>{O.preventDefault(),r()},className:"inline-flex items-center rounded-sm px-1 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-300 dark:focus-visible:ring-offset-black md:-ml-1",children:u.jsx("img",{src:p,alt:"Logo",draggable:!1,className:`block max-w-full flex-shrink-0 select-none ${b?"":"h-8 w-auto sm:h-10 md:h-11"}`.trim(),style:{WebkitUserDrag:"none",...x?{height:x}:{},...v?{width:v}:{}}})})}),u.jsxs("div",{className:"hidden min-w-0 flex-1 items-center justify-end gap-2 sm:gap-4 md:flex",children:[_.length>0&&u.jsx("nav",{"aria-label":"Header links",className:"hidden sm:block",children:u.jsx("ul",{className:"flex items-center gap-1.5 sm:gap-2",children:_.map(O=>u.jsx("li",{children:u.jsx("a",{href:O.url,target:"_blank",rel:"noopener noreferrer",className:D,style:{color:k||void 0},children:O.label})},O.url))})}),u.jsx(md,{})]})]})}):null}function F1({children:r}){const l=g.useRef(null),i=g.useCallback(d=>{l.current=d},[]),c=g.useCallback(()=>{var d;(d=l.current)==null||d.call(l)},[]);return u.jsx(Lg.Provider,{value:{registerGoHome:i,goHome:c},children:r})}function I1(){const[r,l]=g.useState(!1),[i,c]=g.useState(!1),[d,f]=g.useState(()=>localStorage.getItem("desktop-sidebar-collapsed")==="true"),h=Ye(v=>v.conversations),p=iy();if(g.useEffect(()=>{localStorage.setItem("desktop-sidebar-collapsed",String(d))},[d]),p)return u.jsx(up,{children:u.jsx(z1,{message:p})});const x=h.some(v=>{var b;return(v.messages.length>0||(((b=v.attachedFiles)==null?void 0:b.length)??0)>0)&&!v.adapterLoadError});return u.jsx(up,{children:u.jsx(Ex,{children:u.jsx(O1,{children:u.jsx(F1,{children:u.jsxs("div",{className:"h-dvh flex flex-col bg-white dark:bg-black text-slate-900 dark:text-slate-100",children:[u.jsxs("div",{className:"flex-1 flex flex-col md:flex-row md:pl-4 min-h-0",children:[x&&(d?u.jsx("div",{className:"hidden md:flex md:w-16 md:h-full shrink-0 items-start justify-center pt-8",children:u.jsx("button",{type:"button",onClick:()=>f(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-xl border border-slate-200/80 bg-white text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:border-[#333645] dark:bg-[#161616] dark:text-[#d1d5db] dark:hover:border-[#43465a] dark:hover:bg-[#202020] dark:hover:text-white","aria-label":"Open sidebar",title:"Open sidebar",children:u.jsx(Jx,{className:"h-4 w-4"})})}):u.jsx("div",{className:"hidden md:h-full md:flex",children:u.jsx(Fp,{onToggleDesktopSidebar:()=>f(!0)})})),u.jsxs("div",{className:"flex-1 flex flex-col w-full min-h-0",children:[u.jsx(H1,{}),u.jsx("div",{className:"flex-1 flex justify-center w-full min-h-0",children:u.jsx(v1,{onOpenSettings:()=>l(!0),onOpenSidebar:()=>c(!0)})})]})]}),u.jsx($1,{}),u.jsx(M1,{isOpen:r,onClose:()=>l(!1)}),i&&u.jsxs("div",{className:"fixed inset-0 z-50 flex md:hidden",children:[u.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>c(!1),"aria-hidden":"true"}),u.jsxs("div",{className:"relative z-10 h-full w-[min(20rem,90vw)] animate-slideIn bg-white dark:bg-black",children:[u.jsx(Fp,{onRequestClose:()=>c(!1)}),u.jsx("button",{onClick:()=>c(!1),className:"absolute -right-3 top-[max(env(safe-area-inset-top),0.75rem)] rounded-full bg-white/95 p-3 text-gray-600 shadow-lg active:scale-95 transition-transform dark:bg-[#2d2f39] dark:text-[#ececf1]","aria-label":"Close menu",children:u.jsx(ba,{className:"h-5 w-5"})})]})]})]})})})})})}const rd=new Sx({auth:{clientId:dg(),authority:`https://login.microsoftonline.com/${uy()}`,redirectUri:typeof window<"u"?window.location.origin:"/"},cache:{cacheLocation:"sessionStorage"}});function G1({children:r}){const[l,i]=g.useState(!1);return g.useEffect(()=>{rd.initialize().then(()=>rd.handleRedirectPromise()).catch(c=>{console.error("[EntraAuth] Redirect processing failed:",c)}).finally(()=>i(!0))},[]),l?u.jsx(kx,{instance:rd,children:r}):null}function V1({children:r}){if(!Ad()||!Ea())return u.jsx(u.Fragment,{children:r});if(Yo()==="entra")return u.jsx(G1,{children:r});const i=oy(),c=dg(),d=cy();return!i||!c?u.jsx(u.Fragment,{children:r}):u.jsx(_x,{domain:i,clientId:c,authorizationParams:{redirect_uri:window.location.origin,...d?{audience:d}:{}},cacheLocation:"memory",children:r})}Ug(null);const Gp=Wb(),Vp=document.querySelector('link[rel="icon"]');if(Vp)Vp.href=Gp;else{const r=document.createElement("link");r.rel="icon",r.href=Gp,document.head.appendChild(r)}const X1=Ay();var Xp,Yp,Qp,Zp,Kp,Jp;for(const r of X1){const l=((Xp=r.src)==null?void 0:Xp.trim())||"",i=((Yp=r.content)==null?void 0:Yp.trim())||"",c=((Qp=r.id)==null?void 0:Qp.trim())||"";if(!l&&!i||c&&document.querySelector(`script[data-orbitchat-startup-script-id="${c}"]`)||Array.from(document.querySelectorAll("script[data-orbitchat-startup-script]")).some(h=>{const p=l&&h.dataset.orbitchatStartupScriptSrc===l,x=i&&(h.textContent||"").trim()===i;return!!(p||x)}))continue;const f=document.createElement("script");l&&(f.src=l),i&&(f.text=i),f.async=r.async??!0,r.defer!==void 0&&(f.defer=r.defer),(Zp=r.type)!=null&&Zp.trim()&&(f.type=r.type.trim()),(Kp=r.integrity)!=null&&Kp.trim()&&(f.integrity=r.integrity.trim()),r.crossOrigin&&(f.crossOrigin=r.crossOrigin),(Jp=r.referrerPolicy)!=null&&Jp.trim()&&(f.referrerPolicy=r.referrerPolicy.trim()),f.dataset.orbitchatStartupScript="true",c&&(f.dataset.orbitchatStartupScriptId=c),l&&(f.dataset.orbitchatStartupScriptSrc=l),document.head.appendChild(f)}ne("🚀 AI Chat Application started");ne(`📱 App Version: v${Md}`);Tx.createRoot(document.getElementById("root")).render(u.jsx(g.StrictMode,{children:u.jsx(V1,{children:u.jsx(I1,{})})}));export{Qo as r};
|