@must-b/must-b 1.74.3 → 1.74.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BUILD.json +3 -3
- package/dist/embedded-skills.json +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/public/assets/{index-C5iDNui_.js → index-DVBjLym9.js} +35 -34
- package/dist/public/assets/{index-4ZDd8Esc.css → index-aoj2ryTL.css} +1 -1
- package/dist/public/index.html +2 -2
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ function vb(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(C,E){var z=C.length;C.push(E);e:for(;0<z;){var W=z-1>>>1,K=C[W];if(0<i(K,E))C[W]=E,C[z]=K,z=W;else break e}}function n(C){return C.length===0?null:C[0]}function s(C){if(C.length===0)return null;var E=C[0],z=C.pop();if(z!==E){C[0]=z;e:for(var W=0,K=C.length,X=K>>>1;W<X;){var I=2*(W+1)-1,Q=C[I],G=I+1,J=C[G];if(0>i(Q,z))G<K&&0>i(J,Q)?(C[W]=J,C[G]=z,W=G):(C[W]=Q,C[I]=z,W=I);else if(G<K&&0>i(J,z))C[W]=J,C[G]=z,W=G;else break e}}return E}function i(C,E){var z=C.sortIndex-E.sortIndex;return z!==0?z:C.id-E.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,p=null,f=3,m=!1,b=!1,
|
|
25
|
+
*/(function(e){function t(C,E){var z=C.length;C.push(E);e:for(;0<z;){var W=z-1>>>1,K=C[W];if(0<i(K,E))C[W]=E,C[z]=K,z=W;else break e}}function n(C){return C.length===0?null:C[0]}function s(C){if(C.length===0)return null;var E=C[0],z=C.pop();if(z!==E){C[0]=z;e:for(var W=0,K=C.length,X=K>>>1;W<X;){var I=2*(W+1)-1,Q=C[I],G=I+1,J=C[G];if(0>i(Q,z))G<K&&0>i(J,Q)?(C[W]=J,C[G]=z,W=G):(C[W]=Q,C[I]=z,W=I);else if(G<K&&0>i(J,z))C[W]=J,C[G]=z,W=G;else break e}}return E}function i(C,E){var z=C.sortIndex-E.sortIndex;return z!==0?z:C.id-E.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,p=null,f=3,m=!1,b=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(C){for(var E=n(d);E!==null;){if(E.callback===null)s(d);else if(E.startTime<=C)s(d),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(d)}}function j(C){if(y=!1,w(C),!b)if(n(c)!==null)b=!0,T(k);else{var E=n(d);E!==null&&F(j,E.startTime-C)}}function k(C,E){b=!1,y&&(y=!1,g(_),_=-1),m=!0;var z=f;try{for(w(E),p=n(c);p!==null&&(!(p.expirationTime>E)||C&&!P());){var W=p.callback;if(typeof W=="function"){p.callback=null,f=p.priorityLevel;var K=W(p.expirationTime<=E);E=e.unstable_now(),typeof K=="function"?p.callback=K:p===n(c)&&s(c),w(E)}else s(c);p=n(c)}if(p!==null)var X=!0;else{var I=n(d);I!==null&&F(j,I.startTime-E),X=!1}return X}finally{p=null,f=z,m=!1}}var N=!1,S=null,_=-1,R=5,L=-1;function P(){return!(e.unstable_now()-L<R)}function V(){if(S!==null){var C=e.unstable_now();L=C;var E=!0;try{E=S(!0,C)}finally{E?M():(N=!1,S=null)}}else N=!1}var M;if(typeof x=="function")M=function(){x(V)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,A=B.port2;B.port1.onmessage=V,M=function(){A.postMessage(null)}}else M=function(){v(V,0)};function T(C){S=C,N||(N=!0,M())}function F(C,E){_=v(function(){C(e.unstable_now())},E)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(C){C.callback=null},e.unstable_continueExecution=function(){b||m||(b=!0,T(k))},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(C){switch(f){case 1:case 2:case 3:var E=3;break;default:E=f}var z=f;f=E;try{return C()}finally{f=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(C,E){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var z=f;f=C;try{return E()}finally{f=z}},e.unstable_scheduleCallback=function(C,E,z){var W=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?W+z:W):z=W,C){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=z+K,C={id:u++,callback:E,priorityLevel:C,startTime:z,expirationTime:K,sortIndex:-1},z>W?(C.sortIndex=z,t(d,C),n(c)===null&&C===n(d)&&(y?(g(_),_=-1):y=!0,F(j,z-W))):(C.sortIndex=K,t(c,C),b||m||(b=!0,T(k))),C},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(C){var E=f;return function(){var z=f;f=E;try{return C.apply(this,arguments)}finally{f=z}}}})(mg);pg.exports=mg;var Vb=pg.exports;/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -34,10 +34,10 @@ function vb(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&
|
|
|
34
34
|
`+Kl+e}var Gl=!1;function ql(e,t){if(!e||Gl)return"";Gl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var s=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){s=d}e.call(t.prototype)}else{try{throw Error()}catch(d){s=d}e()}}catch(d){if(d&&s&&typeof d.stack=="string"){for(var i=d.stack.split(`
|
|
35
35
|
`),a=s.stack.split(`
|
|
36
36
|
`),o=i.length-1,l=a.length-1;1<=o&&0<=l&&i[o]!==a[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==a[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==a[l]){var c=`
|
|
37
|
-
`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Gl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?di(e):""}function Gb(e){switch(e.tag){case 5:return di(e.type);case 16:return di("Lazy");case 13:return di("Suspense");case 19:return di("SuspenseList");case 0:case 2:case 15:return e=ql(e.type,!1),e;case 11:return e=ql(e.type.render,!1),e;case 1:return e=ql(e.type,!0),e;default:return""}}function ed(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ar:return"Fragment";case ir:return"Portal";case Qc:return"Profiler";case Tu:return"StrictMode";case Jc:return"Suspense";case Zc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case yg:return(e.displayName||"Context")+".Consumer";case xg:return(e._context.displayName||"Context")+".Provider";case Pu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Au:return t=e.displayName||null,t!==null?t:ed(e.type)||"Memo";case Bn:t=e._payload,e=e._init;try{return ed(e(t))}catch{}}return null}function qb(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ed(t);case 8:return t===Tu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ss(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yb(e){var t=bg(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){s=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ea(e){e._valueTracker||(e._valueTracker=Yb(e))}function wg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=bg(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Eo(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}}function td(e,t){var n=t.checked;return Ee({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pf(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=ss(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function kg(e,t){t=t.checked,t!=null&&_u(e,"checked",t,!1)}function nd(e,t){kg(e,t);var n=ss(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?sd(e,t.type,n):t.hasOwnProperty("defaultValue")&&sd(e,t.type,ss(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Af(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function sd(e,t,n){(t!=="number"||Eo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ui=Array.isArray;function jr(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&s&&(e[n].defaultSelected=!0)}else{for(n=""+ss(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,s&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function rd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(U(91));return Ee({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Mf(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(U(92));if(ui(n)){if(1<n.length)throw Error(U(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ss(n)}}function jg(e,t){var n=ss(t.value),s=ss(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function Rf(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ng(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function id(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Ng(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var _a,Sg=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(_a=_a||document.createElement("div"),_a.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=_a.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Oi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var vi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Xb=["Webkit","ms","Moz","O"];Object.keys(vi).forEach(function(e){Xb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vi[t]=vi[e]})});function Cg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||vi.hasOwnProperty(e)&&vi[e]?(""+t).trim():t+"px"}function Eg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=Cg(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,i):e[n]=i}}var Qb=Ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ad(e,t){if(t){if(Qb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(U(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(U(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(U(61))}if(t.style!=null&&typeof t.style!="object")throw Error(U(62))}}function od(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 ld=null;function Mu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var cd=null,Nr=null,Sr=null;function zf(e){if(e=fa(e)){if(typeof cd!="function")throw Error(U(280));var t=e.stateNode;t&&(t=hl(t),cd(e.stateNode,e.type,t))}}function _g(e){Nr?Sr?Sr.push(e):Sr=[e]:Nr=e}function Tg(){if(Nr){var e=Nr,t=Sr;if(Sr=Nr=null,zf(e),t)for(e=0;e<t.length;e++)zf(t[e])}}function Pg(e,t){return e(t)}function Ag(){}var Yl=!1;function Mg(e,t,n){if(Yl)return e(t,n);Yl=!0;try{return Pg(e,t,n)}finally{Yl=!1,(Nr!==null||Sr!==null)&&(Ag(),Tg())}}function Di(e,t){var n=e.stateNode;if(n===null)return null;var s=hl(n);if(s===null)return null;n=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(U(231,t,typeof n));return n}var dd=!1;if(Nn)try{var ei={};Object.defineProperty(ei,"passive",{get:function(){dd=!0}}),window.addEventListener("test",ei,ei),window.removeEventListener("test",ei,ei)}catch{dd=!1}function Jb(e,t,n,s,i,a,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var bi=!1,_o=null,To=!1,ud=null,Zb={onError:function(e){bi=!0,_o=e}};function ew(e,t,n,s,i,a,o,l,c){bi=!1,_o=null,Jb.apply(Zb,arguments)}function tw(e,t,n,s,i,a,o,l,c){if(ew.apply(this,arguments),bi){if(bi){var d=_o;bi=!1,_o=null}else throw Error(U(198));To||(To=!0,ud=d)}}function $s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Rg(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 Lf(e){if($s(e)!==e)throw Error(U(188))}function nw(e){var t=e.alternate;if(!t){if(t=$s(e),t===null)throw Error(U(188));return t!==e?null:e}for(var n=e,s=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(s=i.return,s!==null){n=s;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return Lf(i),e;if(a===s)return Lf(i),t;a=a.sibling}throw Error(U(188))}if(n.return!==s.return)n=i,s=a;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,s=a;break}if(l===s){o=!0,s=i,n=a;break}l=l.sibling}if(!o){for(l=a.child;l;){if(l===n){o=!0,n=a,s=i;break}if(l===s){o=!0,s=a,n=i;break}l=l.sibling}if(!o)throw Error(U(189))}}if(n.alternate!==s)throw Error(U(190))}if(n.tag!==3)throw Error(U(188));return n.stateNode.current===n?e:t}function zg(e){return e=nw(e),e!==null?Lg(e):null}function Lg(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Lg(e);if(t!==null)return t;e=e.sibling}return null}var Og=wt.unstable_scheduleCallback,Of=wt.unstable_cancelCallback,sw=wt.unstable_shouldYield,rw=wt.unstable_requestPaint,Me=wt.unstable_now,iw=wt.unstable_getCurrentPriorityLevel,Ru=wt.unstable_ImmediatePriority,Dg=wt.unstable_UserBlockingPriority,Po=wt.unstable_NormalPriority,aw=wt.unstable_LowPriority,Ig=wt.unstable_IdlePriority,ll=null,ln=null;function ow(e){if(ln&&typeof ln.onCommitFiberRoot=="function")try{ln.onCommitFiberRoot(ll,e,void 0,(e.current.flags&128)===128)}catch{}}var Gt=Math.clz32?Math.clz32:dw,lw=Math.log,cw=Math.LN2;function dw(e){return e>>>=0,e===0?32:31-(lw(e)/cw|0)|0}var Ta=64,Pa=4194304;function hi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ao(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?s=hi(l):(a&=o,a!==0&&(s=hi(a)))}else o=n&~i,o!==0?s=hi(o):a!==0&&(s=hi(a));if(s===0)return 0;if(t!==0&&t!==s&&!(t&i)&&(i=s&-s,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Gt(t),i=1<<n,s|=e[n],t&=~i;return s}function uw(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hw(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Gt(a),l=1<<o,c=i[o];c===-1?(!(l&n)||l&s)&&(i[o]=uw(l,t)):c<=t&&(e.expiredLanes|=l),a&=~l}}function hd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Bg(){var e=Ta;return Ta<<=1,!(Ta&4194240)&&(Ta=64),e}function Xl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ua(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Gt(t),e[t]=n}function fw(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Gt(n),a=1<<i;t[i]=0,s[i]=-1,e[i]=-1,n&=~a}}function zu(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Gt(n),i=1<<s;i&t|e[s]&t&&(e[s]|=t),n&=~i}}var pe=0;function Fg(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Vg,Lu,$g,Ug,Hg,fd=!1,Aa=[],Kn=null,Gn=null,qn=null,Ii=new Map,Bi=new Map,Vn=[],pw="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 submit".split(" ");function Df(e,t){switch(e){case"focusin":case"focusout":Kn=null;break;case"dragenter":case"dragleave":Gn=null;break;case"mouseover":case"mouseout":qn=null;break;case"pointerover":case"pointerout":Ii.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bi.delete(t.pointerId)}}function ti(e,t,n,s,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:a,targetContainers:[i]},t!==null&&(t=fa(t),t!==null&&Lu(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function mw(e,t,n,s,i){switch(t){case"focusin":return Kn=ti(Kn,e,t,n,s,i),!0;case"dragenter":return Gn=ti(Gn,e,t,n,s,i),!0;case"mouseover":return qn=ti(qn,e,t,n,s,i),!0;case"pointerover":var a=i.pointerId;return Ii.set(a,ti(Ii.get(a)||null,e,t,n,s,i)),!0;case"gotpointercapture":return a=i.pointerId,Bi.set(a,ti(Bi.get(a)||null,e,t,n,s,i)),!0}return!1}function Wg(e){var t=Ns(e.target);if(t!==null){var n=$s(t);if(n!==null){if(t=n.tag,t===13){if(t=Rg(n),t!==null){e.blockedOn=t,Hg(e.priority,function(){$g(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ao(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);ld=s,n.target.dispatchEvent(s),ld=null}else return t=fa(n),t!==null&&Lu(t),e.blockedOn=n,!1;t.shift()}return!0}function If(e,t,n){ao(e)&&n.delete(t)}function gw(){fd=!1,Kn!==null&&ao(Kn)&&(Kn=null),Gn!==null&&ao(Gn)&&(Gn=null),qn!==null&&ao(qn)&&(qn=null),Ii.forEach(If),Bi.forEach(If)}function ni(e,t){e.blockedOn===t&&(e.blockedOn=null,fd||(fd=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,gw)))}function Fi(e){function t(i){return ni(i,e)}if(0<Aa.length){ni(Aa[0],e);for(var n=1;n<Aa.length;n++){var s=Aa[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Kn!==null&&ni(Kn,e),Gn!==null&&ni(Gn,e),qn!==null&&ni(qn,e),Ii.forEach(t),Bi.forEach(t),n=0;n<Vn.length;n++)s=Vn[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Vn.length&&(n=Vn[0],n.blockedOn===null);)Wg(n),n.blockedOn===null&&Vn.shift()}var Cr=Tn.ReactCurrentBatchConfig,Mo=!0;function xw(e,t,n,s){var i=pe,a=Cr.transition;Cr.transition=null;try{pe=1,Ou(e,t,n,s)}finally{pe=i,Cr.transition=a}}function yw(e,t,n,s){var i=pe,a=Cr.transition;Cr.transition=null;try{pe=4,Ou(e,t,n,s)}finally{pe=i,Cr.transition=a}}function Ou(e,t,n,s){if(Mo){var i=pd(e,t,n,s);if(i===null)ac(e,t,s,Ro,n),Df(e,s);else if(mw(i,e,t,n,s))s.stopPropagation();else if(Df(e,s),t&4&&-1<pw.indexOf(e)){for(;i!==null;){var a=fa(i);if(a!==null&&Vg(a),a=pd(e,t,n,s),a===null&&ac(e,t,s,Ro,n),a===i)break;i=a}i!==null&&s.stopPropagation()}else ac(e,t,s,null,n)}}var Ro=null;function pd(e,t,n,s){if(Ro=null,e=Mu(s),e=Ns(e),e!==null)if(t=$s(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Rg(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ro=e,null}function Kg(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(iw()){case Ru:return 1;case Dg:return 4;case Po:case aw:return 16;case Ig:return 536870912;default:return 16}default:return 16}}var Un=null,Du=null,oo=null;function Gg(){if(oo)return oo;var e,t=Du,n=t.length,s,i="value"in Un?Un.value:Un.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===i[a-s];s++);return oo=i.slice(e,1<s?1-s:void 0)}function lo(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 Ma(){return!0}function Bf(){return!1}function Nt(e){function t(n,s,i,a,o){this._reactName=n,this._targetInst=i,this.type=s,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Ma:Bf,this.isPropagationStopped=Bf,this}return Ee(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ma)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ma)},persist:function(){},isPersistent:Ma}),t}var $r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Iu=Nt($r),ha=Ee({},$r,{view:0,detail:0}),vw=Nt(ha),Ql,Jl,si,cl=Ee({},ha,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bu,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!==si&&(si&&e.type==="mousemove"?(Ql=e.screenX-si.screenX,Jl=e.screenY-si.screenY):Jl=Ql=0,si=e),Ql)},movementY:function(e){return"movementY"in e?e.movementY:Jl}}),Ff=Nt(cl),bw=Ee({},cl,{dataTransfer:0}),ww=Nt(bw),kw=Ee({},ha,{relatedTarget:0}),Zl=Nt(kw),jw=Ee({},$r,{animationName:0,elapsedTime:0,pseudoElement:0}),Nw=Nt(jw),Sw=Ee({},$r,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Cw=Nt(Sw),Ew=Ee({},$r,{data:0}),Vf=Nt(Ew),_w={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tw={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"},Pw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Aw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Pw[e])?!!t[e]:!1}function Bu(){return Aw}var Mw=Ee({},ha,{key:function(e){if(e.key){var t=_w[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=lo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Tw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bu,charCode:function(e){return e.type==="keypress"?lo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?lo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Rw=Nt(Mw),zw=Ee({},cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=Nt(zw),Lw=Ee({},ha,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bu}),Ow=Nt(Lw),Dw=Ee({},$r,{propertyName:0,elapsedTime:0,pseudoElement:0}),Iw=Nt(Dw),Bw=Ee({},cl,{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}),Fw=Nt(Bw),Vw=[9,13,27,32],Fu=Nn&&"CompositionEvent"in window,wi=null;Nn&&"documentMode"in document&&(wi=document.documentMode);var $w=Nn&&"TextEvent"in window&&!wi,qg=Nn&&(!Fu||wi&&8<wi&&11>=wi),Uf=" ",Hf=!1;function Yg(e,t){switch(e){case"keyup":return Vw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var or=!1;function Uw(e,t){switch(e){case"compositionend":return Xg(t);case"keypress":return t.which!==32?null:(Hf=!0,Uf);case"textInput":return e=t.data,e===Uf&&Hf?null:e;default:return null}}function Hw(e,t){if(or)return e==="compositionend"||!Fu&&Yg(e,t)?(e=Gg(),oo=Du=Un=null,or=!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 qg&&t.locale!=="ko"?null:t.data;default:return null}}var Ww={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 Wf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ww[e.type]:t==="textarea"}function Qg(e,t,n,s){_g(s),t=zo(t,"onChange"),0<t.length&&(n=new Iu("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var ki=null,Vi=null;function Kw(e){lx(e,0)}function dl(e){var t=dr(e);if(wg(t))return e}function Gw(e,t){if(e==="change")return t}var Jg=!1;if(Nn){var ec;if(Nn){var tc="oninput"in document;if(!tc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),tc=typeof Kf.oninput=="function"}ec=tc}else ec=!1;Jg=ec&&(!document.documentMode||9<document.documentMode)}function Gf(){ki&&(ki.detachEvent("onpropertychange",Zg),Vi=ki=null)}function Zg(e){if(e.propertyName==="value"&&dl(Vi)){var t=[];Qg(t,Vi,e,Mu(e)),Mg(Kw,t)}}function qw(e,t,n){e==="focusin"?(Gf(),ki=t,Vi=n,ki.attachEvent("onpropertychange",Zg)):e==="focusout"&&Gf()}function Yw(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return dl(Vi)}function Xw(e,t){if(e==="click")return dl(t)}function Qw(e,t){if(e==="input"||e==="change")return dl(t)}function Jw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yt=typeof Object.is=="function"?Object.is:Jw;function $i(e,t){if(Yt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var i=n[s];if(!Xc.call(t,i)||!Yt(e[i],t[i]))return!1}return!0}function qf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yf(e,t){var n=qf(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=qf(n)}}function ex(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ex(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function tx(){for(var e=window,t=Eo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Eo(e.document)}return t}function Vu(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")}function Zw(e){var t=tx(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ex(n.ownerDocument.documentElement,n)){if(s!==null&&Vu(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(s.start,i);s=s.end===void 0?a:Math.min(s.end,i),!e.extend&&a>s&&(i=s,s=a,a=i),i=Yf(n,a);var o=Yf(n,s);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>s?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var e2=Nn&&"documentMode"in document&&11>=document.documentMode,lr=null,md=null,ji=null,gd=!1;function Xf(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gd||lr==null||lr!==Eo(s)||(s=lr,"selectionStart"in s&&Vu(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ji&&$i(ji,s)||(ji=s,s=zo(md,"onSelect"),0<s.length&&(t=new Iu("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=lr)))}function Ra(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var cr={animationend:Ra("Animation","AnimationEnd"),animationiteration:Ra("Animation","AnimationIteration"),animationstart:Ra("Animation","AnimationStart"),transitionend:Ra("Transition","TransitionEnd")},nc={},nx={};Nn&&(nx=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);function ul(e){if(nc[e])return nc[e];if(!cr[e])return e;var t=cr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in nx)return nc[e]=t[n];return e}var sx=ul("animationend"),rx=ul("animationiteration"),ix=ul("animationstart"),ax=ul("transitionend"),ox=new Map,Qf="abort auxClick 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(" ");function cs(e,t){ox.set(e,t),Vs(t,[e])}for(var sc=0;sc<Qf.length;sc++){var rc=Qf[sc],t2=rc.toLowerCase(),n2=rc[0].toUpperCase()+rc.slice(1);cs(t2,"on"+n2)}cs(sx,"onAnimationEnd");cs(rx,"onAnimationIteration");cs(ix,"onAnimationStart");cs("dblclick","onDoubleClick");cs("focusin","onFocus");cs("focusout","onBlur");cs(ax,"onTransitionEnd");Pr("onMouseEnter",["mouseout","mouseover"]);Pr("onMouseLeave",["mouseout","mouseover"]);Pr("onPointerEnter",["pointerout","pointerover"]);Pr("onPointerLeave",["pointerout","pointerover"]);Vs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Vs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Vs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Vs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fi="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(" "),s2=new Set("cancel close invalid load scroll toggle".split(" ").concat(fi));function Jf(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,tw(s,t,void 0,e),e.currentTarget=null}function lx(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],i=s.event;s=s.listeners;e:{var a=void 0;if(t)for(var o=s.length-1;0<=o;o--){var l=s[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==a&&i.isPropagationStopped())break e;Jf(i,l,d),a=c}else for(o=0;o<s.length;o++){if(l=s[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==a&&i.isPropagationStopped())break e;Jf(i,l,d),a=c}}}if(To)throw e=ud,To=!1,ud=null,e}function ye(e,t){var n=t[wd];n===void 0&&(n=t[wd]=new Set);var s=e+"__bubble";n.has(s)||(cx(t,e,2,!1),n.add(s))}function ic(e,t,n){var s=0;t&&(s|=4),cx(n,e,s,t)}var za="_reactListening"+Math.random().toString(36).slice(2);function Ui(e){if(!e[za]){e[za]=!0,gg.forEach(function(n){n!=="selectionchange"&&(s2.has(n)||ic(n,!1,e),ic(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[za]||(t[za]=!0,ic("selectionchange",!1,t))}}function cx(e,t,n,s){switch(Kg(t)){case 1:var i=xw;break;case 4:i=yw;break;default:i=Ou}n=i.bind(null,t,n,e),i=void 0,!dd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),s?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function ac(e,t,n,s,i){var a=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var l=s.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Ns(l),o===null)return;if(c=o.tag,c===5||c===6){s=a=o;continue e}l=l.parentNode}}s=s.return}Mg(function(){var d=a,u=Mu(n),p=[];e:{var f=ox.get(e);if(f!==void 0){var m=Iu,b=e;switch(e){case"keypress":if(lo(n)===0)break e;case"keydown":case"keyup":m=Rw;break;case"focusin":b="focus",m=Zl;break;case"focusout":b="blur",m=Zl;break;case"beforeblur":case"afterblur":m=Zl;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Ff;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=ww;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Ow;break;case sx:case rx:case ix:m=Nw;break;case ax:m=Iw;break;case"scroll":m=vw;break;case"wheel":m=Fw;break;case"copy":case"cut":case"paste":m=Cw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=$f}var v=(t&4)!==0,y=!v&&e==="scroll",g=v?f!==null?f+"Capture":null:f;v=[];for(var x=d,w;x!==null;){w=x;var j=w.stateNode;if(w.tag===5&&j!==null&&(w=j,g!==null&&(j=Di(x,g),j!=null&&v.push(Hi(x,j,w)))),y)break;x=x.return}0<v.length&&(f=new m(f,b,null,n,u),p.push({event:f,listeners:v}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==ld&&(b=n.relatedTarget||n.fromElement)&&(Ns(b)||b[Sn]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(b=n.relatedTarget||n.toElement,m=d,b=b?Ns(b):null,b!==null&&(y=$s(b),b!==y||b.tag!==5&&b.tag!==6)&&(b=null)):(m=null,b=d),m!==b)){if(v=Ff,j="onMouseLeave",g="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(v=$f,j="onPointerLeave",g="onPointerEnter",x="pointer"),y=m==null?f:dr(m),w=b==null?f:dr(b),f=new v(j,x+"leave",m,n,u),f.target=y,f.relatedTarget=w,j=null,Ns(u)===d&&(v=new v(g,x+"enter",b,n,u),v.target=w,v.relatedTarget=y,j=v),y=j,m&&b)t:{for(v=m,g=b,x=0,w=v;w;w=Zs(w))x++;for(w=0,j=g;j;j=Zs(j))w++;for(;0<x-w;)v=Zs(v),x--;for(;0<w-x;)g=Zs(g),w--;for(;x--;){if(v===g||g!==null&&v===g.alternate)break t;v=Zs(v),g=Zs(g)}v=null}else v=null;m!==null&&Zf(p,f,m,v,!1),b!==null&&y!==null&&Zf(p,y,b,v,!0)}}e:{if(f=d?dr(d):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var k=Gw;else if(Wf(f))if(Jg)k=Qw;else{k=Yw;var N=qw}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=Xw);if(k&&(k=k(e,d))){Qg(p,k,n,u);break e}N&&N(e,f,d),e==="focusout"&&(N=f._wrapperState)&&N.controlled&&f.type==="number"&&sd(f,"number",f.value)}switch(N=d?dr(d):window,e){case"focusin":(Wf(N)||N.contentEditable==="true")&&(lr=N,md=d,ji=null);break;case"focusout":ji=md=lr=null;break;case"mousedown":gd=!0;break;case"contextmenu":case"mouseup":case"dragend":gd=!1,Xf(p,n,u);break;case"selectionchange":if(e2)break;case"keydown":case"keyup":Xf(p,n,u)}var S;if(Fu)e:{switch(e){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else or?Yg(e,n)&&(_="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(_="onCompositionStart");_&&(qg&&n.locale!=="ko"&&(or||_!=="onCompositionStart"?_==="onCompositionEnd"&&or&&(S=Gg()):(Un=u,Du="value"in Un?Un.value:Un.textContent,or=!0)),N=zo(d,_),0<N.length&&(_=new Vf(_,e,null,n,u),p.push({event:_,listeners:N}),S?_.data=S:(S=Xg(n),S!==null&&(_.data=S)))),(S=$w?Uw(e,n):Hw(e,n))&&(d=zo(d,"onBeforeInput"),0<d.length&&(u=new Vf("onBeforeInput","beforeinput",null,n,u),p.push({event:u,listeners:d}),u.data=S))}lx(p,t)})}function Hi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function zo(e,t){for(var n=t+"Capture",s=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Di(e,n),a!=null&&s.unshift(Hi(e,a,i)),a=Di(e,t),a!=null&&s.push(Hi(e,a,i))),e=e.return}return s}function Zs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Zf(e,t,n,s,i){for(var a=t._reactName,o=[];n!==null&&n!==s;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===s)break;l.tag===5&&d!==null&&(l=d,i?(c=Di(n,a),c!=null&&o.unshift(Hi(n,c,l))):i||(c=Di(n,a),c!=null&&o.push(Hi(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var r2=/\r\n?/g,i2=/\u0000|\uFFFD/g;function ep(e){return(typeof e=="string"?e:""+e).replace(r2,`
|
|
38
|
-
`).replace(i2,"")}function La(e,t,n){if(t=ep(t),ep(e)!==t&&n)throw Error(U(425))}function Lo(){}var xd=null,yd=null;function vd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bd=typeof setTimeout=="function"?setTimeout:void 0,a2=typeof clearTimeout=="function"?clearTimeout:void 0,tp=typeof Promise=="function"?Promise:void 0,o2=typeof queueMicrotask=="function"?queueMicrotask:typeof tp<"u"?function(e){return tp.resolve(null).then(e).catch(l2)}:bd;function l2(e){setTimeout(function(){throw e})}function oc(e,t){var n=t,s=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(s===0){e.removeChild(i),Fi(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=i}while(n);Fi(t)}function Yn(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==="$?")break;if(t==="/$")return null}}return e}function np(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ur=Math.random().toString(36).slice(2),an="__reactFiber$"+Ur,Wi="__reactProps$"+Ur,Sn="__reactContainer$"+Ur,wd="__reactEvents$"+Ur,c2="__reactListeners$"+Ur,d2="__reactHandles$"+Ur;function Ns(e){var t=e[an];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Sn]||n[an]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=np(e);e!==null;){if(n=e[an])return n;e=np(e)}return t}e=n,n=e.parentNode}return null}function fa(e){return e=e[an]||e[Sn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function dr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(U(33))}function hl(e){return e[Wi]||null}var kd=[],ur=-1;function ds(e){return{current:e}}function be(e){0>ur||(e.current=kd[ur],kd[ur]=null,ur--)}function xe(e,t){ur++,kd[ur]=e.current,e.current=t}var rs={},nt=ds(rs),ht=ds(!1),As=rs;function Ar(e,t){var n=e.type.contextTypes;if(!n)return rs;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ft(e){return e=e.childContextTypes,e!=null}function Oo(){be(ht),be(nt)}function sp(e,t,n){if(nt.current!==rs)throw Error(U(168));xe(nt,t),xe(ht,n)}function dx(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var i in s)if(!(i in t))throw Error(U(108,qb(e)||"Unknown",i));return Ee({},n,s)}function Do(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rs,As=nt.current,xe(nt,e),xe(ht,ht.current),!0}function rp(e,t,n){var s=e.stateNode;if(!s)throw Error(U(169));n?(e=dx(e,t,As),s.__reactInternalMemoizedMergedChildContext=e,be(ht),be(nt),xe(nt,e)):be(ht),xe(ht,n)}var xn=null,fl=!1,lc=!1;function ux(e){xn===null?xn=[e]:xn.push(e)}function u2(e){fl=!0,ux(e)}function us(){if(!lc&&xn!==null){lc=!0;var e=0,t=pe;try{var n=xn;for(pe=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}xn=null,fl=!1}catch(i){throw xn!==null&&(xn=xn.slice(e+1)),Og(Ru,us),i}finally{pe=t,lc=!1}}return null}var hr=[],fr=0,Io=null,Bo=0,Et=[],_t=0,Ms=null,vn=1,bn="";function bs(e,t){hr[fr++]=Bo,hr[fr++]=Io,Io=e,Bo=t}function hx(e,t,n){Et[_t++]=vn,Et[_t++]=bn,Et[_t++]=Ms,Ms=e;var s=vn;e=bn;var i=32-Gt(s)-1;s&=~(1<<i),n+=1;var a=32-Gt(t)+i;if(30<a){var o=i-i%5;a=(s&(1<<o)-1).toString(32),s>>=o,i-=o,vn=1<<32-Gt(t)+i|n<<i|s,bn=a+e}else vn=1<<a|n<<i|s,bn=e}function $u(e){e.return!==null&&(bs(e,1),hx(e,1,0))}function Uu(e){for(;e===Io;)Io=hr[--fr],hr[fr]=null,Bo=hr[--fr],hr[fr]=null;for(;e===Ms;)Ms=Et[--_t],Et[_t]=null,bn=Et[--_t],Et[_t]=null,vn=Et[--_t],Et[_t]=null}var vt=null,yt=null,je=!1,Wt=null;function fx(e,t){var n=Pt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ip(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,vt=e,yt=Yn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,vt=e,yt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ms!==null?{id:vn,overflow:bn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Pt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,vt=e,yt=null,!0):!1;default:return!1}}function jd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Nd(e){if(je){var t=yt;if(t){var n=t;if(!ip(e,t)){if(jd(e))throw Error(U(418));t=Yn(n.nextSibling);var s=vt;t&&ip(e,t)?fx(s,n):(e.flags=e.flags&-4097|2,je=!1,vt=e)}}else{if(jd(e))throw Error(U(418));e.flags=e.flags&-4097|2,je=!1,vt=e}}}function ap(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;vt=e}function Oa(e){if(e!==vt)return!1;if(!je)return ap(e),je=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!vd(e.type,e.memoizedProps)),t&&(t=yt)){if(jd(e))throw px(),Error(U(418));for(;t;)fx(e,t),t=Yn(t.nextSibling)}if(ap(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){yt=Yn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}yt=null}}else yt=vt?Yn(e.stateNode.nextSibling):null;return!0}function px(){for(var e=yt;e;)e=Yn(e.nextSibling)}function Mr(){yt=vt=null,je=!1}function Hu(e){Wt===null?Wt=[e]:Wt.push(e)}var h2=Tn.ReactCurrentBatchConfig;function ri(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(U(309));var s=n.stateNode}if(!s)throw Error(U(147,e));var i=s,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(o){var l=i.refs;o===null?delete l[a]:l[a]=o},t._stringRef=a,t)}if(typeof e!="string")throw Error(U(284));if(!n._owner)throw Error(U(290,e))}return e}function Da(e,t){throw e=Object.prototype.toString.call(t),Error(U(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function op(e){var t=e._init;return t(e._payload)}function mx(e){function t(g,x){if(e){var w=g.deletions;w===null?(g.deletions=[x],g.flags|=16):w.push(x)}}function n(g,x){if(!e)return null;for(;x!==null;)t(g,x),x=x.sibling;return null}function s(g,x){for(g=new Map;x!==null;)x.key!==null?g.set(x.key,x):g.set(x.index,x),x=x.sibling;return g}function i(g,x){return g=Zn(g,x),g.index=0,g.sibling=null,g}function a(g,x,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<x?(g.flags|=2,x):w):(g.flags|=2,x)):(g.flags|=1048576,x)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,x,w,j){return x===null||x.tag!==6?(x=mc(w,g.mode,j),x.return=g,x):(x=i(x,w),x.return=g,x)}function c(g,x,w,j){var k=w.type;return k===ar?u(g,x,w.props.children,j,w.key):x!==null&&(x.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Bn&&op(k)===x.type)?(j=i(x,w.props),j.ref=ri(g,x,w),j.return=g,j):(j=go(w.type,w.key,w.props,null,g.mode,j),j.ref=ri(g,x,w),j.return=g,j)}function d(g,x,w,j){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=gc(w,g.mode,j),x.return=g,x):(x=i(x,w.children||[]),x.return=g,x)}function u(g,x,w,j,k){return x===null||x.tag!==7?(x=Ts(w,g.mode,j,k),x.return=g,x):(x=i(x,w),x.return=g,x)}function p(g,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=mc(""+x,g.mode,w),x.return=g,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Ca:return w=go(x.type,x.key,x.props,null,g.mode,w),w.ref=ri(g,null,x),w.return=g,w;case ir:return x=gc(x,g.mode,w),x.return=g,x;case Bn:var j=x._init;return p(g,j(x._payload),w)}if(ui(x)||Zr(x))return x=Ts(x,g.mode,w,null),x.return=g,x;Da(g,x)}return null}function f(g,x,w,j){var k=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return k!==null?null:l(g,x,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ca:return w.key===k?c(g,x,w,j):null;case ir:return w.key===k?d(g,x,w,j):null;case Bn:return k=w._init,f(g,x,k(w._payload),j)}if(ui(w)||Zr(w))return k!==null?null:u(g,x,w,j,null);Da(g,w)}return null}function m(g,x,w,j,k){if(typeof j=="string"&&j!==""||typeof j=="number")return g=g.get(w)||null,l(x,g,""+j,k);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Ca:return g=g.get(j.key===null?w:j.key)||null,c(x,g,j,k);case ir:return g=g.get(j.key===null?w:j.key)||null,d(x,g,j,k);case Bn:var N=j._init;return m(g,x,w,N(j._payload),k)}if(ui(j)||Zr(j))return g=g.get(w)||null,u(x,g,j,k,null);Da(x,j)}return null}function b(g,x,w,j){for(var k=null,N=null,S=x,_=x=0,R=null;S!==null&&_<w.length;_++){S.index>_?(R=S,S=null):R=S.sibling;var L=f(g,S,w[_],j);if(L===null){S===null&&(S=R);break}e&&S&&L.alternate===null&&t(g,S),x=a(L,x,_),N===null?k=L:N.sibling=L,N=L,S=R}if(_===w.length)return n(g,S),je&&bs(g,_),k;if(S===null){for(;_<w.length;_++)S=p(g,w[_],j),S!==null&&(x=a(S,x,_),N===null?k=S:N.sibling=S,N=S);return je&&bs(g,_),k}for(S=s(g,S);_<w.length;_++)R=m(S,g,_,w[_],j),R!==null&&(e&&R.alternate!==null&&S.delete(R.key===null?_:R.key),x=a(R,x,_),N===null?k=R:N.sibling=R,N=R);return e&&S.forEach(function(P){return t(g,P)}),je&&bs(g,_),k}function v(g,x,w,j){var k=Zr(w);if(typeof k!="function")throw Error(U(150));if(w=k.call(w),w==null)throw Error(U(151));for(var N=k=null,S=x,_=x=0,R=null,L=w.next();S!==null&&!L.done;_++,L=w.next()){S.index>_?(R=S,S=null):R=S.sibling;var P=f(g,S,L.value,j);if(P===null){S===null&&(S=R);break}e&&S&&P.alternate===null&&t(g,S),x=a(P,x,_),N===null?k=P:N.sibling=P,N=P,S=R}if(L.done)return n(g,S),je&&bs(g,_),k;if(S===null){for(;!L.done;_++,L=w.next())L=p(g,L.value,j),L!==null&&(x=a(L,x,_),N===null?k=L:N.sibling=L,N=L);return je&&bs(g,_),k}for(S=s(g,S);!L.done;_++,L=w.next())L=m(S,g,_,L.value,j),L!==null&&(e&&L.alternate!==null&&S.delete(L.key===null?_:L.key),x=a(L,x,_),N===null?k=L:N.sibling=L,N=L);return e&&S.forEach(function(V){return t(g,V)}),je&&bs(g,_),k}function y(g,x,w,j){if(typeof w=="object"&&w!==null&&w.type===ar&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Ca:e:{for(var k=w.key,N=x;N!==null;){if(N.key===k){if(k=w.type,k===ar){if(N.tag===7){n(g,N.sibling),x=i(N,w.props.children),x.return=g,g=x;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Bn&&op(k)===N.type){n(g,N.sibling),x=i(N,w.props),x.ref=ri(g,N,w),x.return=g,g=x;break e}n(g,N);break}else t(g,N);N=N.sibling}w.type===ar?(x=Ts(w.props.children,g.mode,j,w.key),x.return=g,g=x):(j=go(w.type,w.key,w.props,null,g.mode,j),j.ref=ri(g,x,w),j.return=g,g=j)}return o(g);case ir:e:{for(N=w.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(g,x.sibling),x=i(x,w.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else t(g,x);x=x.sibling}x=gc(w,g.mode,j),x.return=g,g=x}return o(g);case Bn:return N=w._init,y(g,x,N(w._payload),j)}if(ui(w))return b(g,x,w,j);if(Zr(w))return v(g,x,w,j);Da(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(g,x.sibling),x=i(x,w),x.return=g,g=x):(n(g,x),x=mc(w,g.mode,j),x.return=g,g=x),o(g)):n(g,x)}return y}var Rr=mx(!0),gx=mx(!1),Fo=ds(null),Vo=null,pr=null,Wu=null;function Ku(){Wu=pr=Vo=null}function Gu(e){var t=Fo.current;be(Fo),e._currentValue=t}function Sd(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Er(e,t){Vo=e,Wu=pr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ut=!0),e.firstContext=null)}function Rt(e){var t=e._currentValue;if(Wu!==e)if(e={context:e,memoizedValue:t,next:null},pr===null){if(Vo===null)throw Error(U(308));pr=e,Vo.dependencies={lanes:0,firstContext:e}}else pr=pr.next=e;return t}var Ss=null;function qu(e){Ss===null?Ss=[e]:Ss.push(e)}function xx(e,t,n,s){var i=t.interleaved;return i===null?(n.next=n,qu(t)):(n.next=i.next,i.next=n),t.interleaved=n,Cn(e,s)}function Cn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Fn=!1;function Yu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Xn(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ue&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,Cn(e,n)}return i=s.interleaved,i===null?(t.next=t,qu(s)):(t.next=i.next,i.next=t),s.interleaved=t,Cn(e,n)}function co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zu(e,n)}}function lp(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function $o(e,t,n,s){var i=e.updateQueue;Fn=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?a=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(a!==null){var p=i.baseState;o=0,u=d=c=null,l=a;do{var f=l.lane,m=l.eventTime;if((s&f)===f){u!==null&&(u=u.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var b=e,v=l;switch(f=t,m=n,v.tag){case 1:if(b=v.payload,typeof b=="function"){p=b.call(m,p,f);break e}p=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=v.payload,f=typeof b=="function"?b.call(m,p,f):b,f==null)break e;p=Ee({},p,f);break e;case 2:Fn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=m,c=p):u=u.next=m,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(c=p),i.baseState=c,i.firstBaseUpdate=d,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);zs|=o,e.lanes=o,e.memoizedState=p}}function cp(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],i=s.callback;if(i!==null){if(s.callback=null,s=n,typeof i!="function")throw Error(U(191,i));i.call(s)}}}var pa={},cn=ds(pa),Ki=ds(pa),Gi=ds(pa);function Cs(e){if(e===pa)throw Error(U(174));return e}function Xu(e,t){switch(xe(Gi,t),xe(Ki,e),xe(cn,pa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:id(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=id(t,e)}be(cn),xe(cn,t)}function zr(){be(cn),be(Ki),be(Gi)}function vx(e){Cs(Gi.current);var t=Cs(cn.current),n=id(t,e.type);t!==n&&(xe(Ki,e),xe(cn,n))}function Qu(e){Ki.current===e&&(be(cn),be(Ki))}var Ne=ds(0);function Uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var cc=[];function Ju(){for(var e=0;e<cc.length;e++)cc[e]._workInProgressVersionPrimary=null;cc.length=0}var uo=Tn.ReactCurrentDispatcher,dc=Tn.ReactCurrentBatchConfig,Rs=0,Ce=null,De=null,$e=null,Ho=!1,Ni=!1,qi=0,f2=0;function Xe(){throw Error(U(321))}function Zu(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yt(e[n],t[n]))return!1;return!0}function eh(e,t,n,s,i,a){if(Rs=a,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,uo.current=e===null||e.memoizedState===null?x2:y2,e=n(s,i),Ni){a=0;do{if(Ni=!1,qi=0,25<=a)throw Error(U(301));a+=1,$e=De=null,t.updateQueue=null,uo.current=v2,e=n(s,i)}while(Ni)}if(uo.current=Wo,t=De!==null&&De.next!==null,Rs=0,$e=De=Ce=null,Ho=!1,t)throw Error(U(300));return e}function th(){var e=qi!==0;return qi=0,e}function rn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $e===null?Ce.memoizedState=$e=e:$e=$e.next=e,$e}function zt(){if(De===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=$e===null?Ce.memoizedState:$e.next;if(t!==null)$e=t,De=e;else{if(e===null)throw Error(U(310));De=e,e={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},$e===null?Ce.memoizedState=$e=e:$e=$e.next=e}return $e}function Yi(e,t){return typeof t=="function"?t(e):t}function uc(e){var t=zt(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var s=De,i=s.baseQueue,a=n.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}s.baseQueue=i=a,n.pending=null}if(i!==null){a=i.next,s=s.baseState;var l=o=null,c=null,d=a;do{var u=d.lane;if((Rs&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var p={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=p,o=s):c=c.next=p,Ce.lanes|=u,zs|=u}d=d.next}while(d!==null&&d!==a);c===null?o=s:c.next=l,Yt(s,t.memoizedState)||(ut=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){i=e;do a=i.lane,Ce.lanes|=a,zs|=a,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function hc(e){var t=zt(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var s=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);Yt(a,t.memoizedState)||(ut=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,s]}function bx(){}function wx(e,t){var n=Ce,s=zt(),i=t(),a=!Yt(s.memoizedState,i);if(a&&(s.memoizedState=i,ut=!0),s=s.queue,nh(Nx.bind(null,n,s,e),[e]),s.getSnapshot!==t||a||$e!==null&&$e.memoizedState.tag&1){if(n.flags|=2048,Xi(9,jx.bind(null,n,s,i,t),void 0,null),Ue===null)throw Error(U(349));Rs&30||kx(n,t,i)}return i}function kx(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function jx(e,t,n,s){t.value=n,t.getSnapshot=s,Sx(t)&&Cx(e)}function Nx(e,t,n){return n(function(){Sx(t)&&Cx(e)})}function Sx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yt(e,n)}catch{return!0}}function Cx(e){var t=Cn(e,1);t!==null&&qt(t,e,1,-1)}function dp(e){var t=rn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:e},t.queue=e,e=e.dispatch=g2.bind(null,Ce,e),[t.memoizedState,e]}function Xi(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function Ex(){return zt().memoizedState}function ho(e,t,n,s){var i=rn();Ce.flags|=e,i.memoizedState=Xi(1|t,n,void 0,s===void 0?null:s)}function pl(e,t,n,s){var i=zt();s=s===void 0?null:s;var a=void 0;if(De!==null){var o=De.memoizedState;if(a=o.destroy,s!==null&&Zu(s,o.deps)){i.memoizedState=Xi(t,n,a,s);return}}Ce.flags|=e,i.memoizedState=Xi(1|t,n,a,s)}function up(e,t){return ho(8390656,8,e,t)}function nh(e,t){return pl(2048,8,e,t)}function _x(e,t){return pl(4,2,e,t)}function Tx(e,t){return pl(4,4,e,t)}function Px(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ax(e,t,n){return n=n!=null?n.concat([e]):null,pl(4,4,Px.bind(null,t,e),n)}function sh(){}function Mx(e,t){var n=zt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Zu(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Rx(e,t){var n=zt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Zu(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function zx(e,t,n){return Rs&21?(Yt(n,t)||(n=Bg(),Ce.lanes|=n,zs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ut=!0),e.memoizedState=n)}function p2(e,t){var n=pe;pe=n!==0&&4>n?n:4,e(!0);var s=dc.transition;dc.transition={};try{e(!1),t()}finally{pe=n,dc.transition=s}}function Lx(){return zt().memoizedState}function m2(e,t,n){var s=Jn(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Ox(e))Dx(t,n);else if(n=xx(e,t,n,s),n!==null){var i=it();qt(n,e,s,i),Ix(n,t,s)}}function g2(e,t,n){var s=Jn(e),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ox(e))Dx(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,Yt(l,o)){var c=t.interleaved;c===null?(i.next=i,qu(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=xx(e,t,i,s),n!==null&&(i=it(),qt(n,e,s,i),Ix(n,t,s))}}function Ox(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function Dx(e,t){Ni=Ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ix(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zu(e,n)}}var Wo={readContext:Rt,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useInsertionEffect:Xe,useLayoutEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useMutableSource:Xe,useSyncExternalStore:Xe,useId:Xe,unstable_isNewReconciler:!1},x2={readContext:Rt,useCallback:function(e,t){return rn().memoizedState=[e,t===void 0?null:t],e},useContext:Rt,useEffect:up,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ho(4194308,4,Px.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ho(4194308,4,e,t)},useInsertionEffect:function(e,t){return ho(4,2,e,t)},useMemo:function(e,t){var n=rn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=rn();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=m2.bind(null,Ce,e),[s.memoizedState,e]},useRef:function(e){var t=rn();return e={current:e},t.memoizedState=e},useState:dp,useDebugValue:sh,useDeferredValue:function(e){return rn().memoizedState=e},useTransition:function(){var e=dp(!1),t=e[0];return e=p2.bind(null,e[1]),rn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=Ce,i=rn();if(je){if(n===void 0)throw Error(U(407));n=n()}else{if(n=t(),Ue===null)throw Error(U(349));Rs&30||kx(s,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,up(Nx.bind(null,s,a,e),[e]),s.flags|=2048,Xi(9,jx.bind(null,s,a,n,t),void 0,null),n},useId:function(){var e=rn(),t=Ue.identifierPrefix;if(je){var n=bn,s=vn;n=(s&~(1<<32-Gt(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=qi++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=f2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},y2={readContext:Rt,useCallback:Mx,useContext:Rt,useEffect:nh,useImperativeHandle:Ax,useInsertionEffect:_x,useLayoutEffect:Tx,useMemo:Rx,useReducer:uc,useRef:Ex,useState:function(){return uc(Yi)},useDebugValue:sh,useDeferredValue:function(e){var t=zt();return zx(t,De.memoizedState,e)},useTransition:function(){var e=uc(Yi)[0],t=zt().memoizedState;return[e,t]},useMutableSource:bx,useSyncExternalStore:wx,useId:Lx,unstable_isNewReconciler:!1},v2={readContext:Rt,useCallback:Mx,useContext:Rt,useEffect:nh,useImperativeHandle:Ax,useInsertionEffect:_x,useLayoutEffect:Tx,useMemo:Rx,useReducer:hc,useRef:Ex,useState:function(){return hc(Yi)},useDebugValue:sh,useDeferredValue:function(e){var t=zt();return De===null?t.memoizedState=e:zx(t,De.memoizedState,e)},useTransition:function(){var e=hc(Yi)[0],t=zt().memoizedState;return[e,t]},useMutableSource:bx,useSyncExternalStore:wx,useId:Lx,unstable_isNewReconciler:!1};function $t(e,t){if(e&&e.defaultProps){t=Ee({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Cd(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Ee({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ml={isMounted:function(e){return(e=e._reactInternals)?$s(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=it(),i=Jn(e),a=wn(s,i);a.payload=t,n!=null&&(a.callback=n),t=Xn(e,a,i),t!==null&&(qt(t,e,i,s),co(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=it(),i=Jn(e),a=wn(s,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Xn(e,a,i),t!==null&&(qt(t,e,i,s),co(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=it(),s=Jn(e),i=wn(n,s);i.tag=2,t!=null&&(i.callback=t),t=Xn(e,i,s),t!==null&&(qt(t,e,s,n),co(t,e,s))}};function hp(e,t,n,s,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,a,o):t.prototype&&t.prototype.isPureReactComponent?!$i(n,s)||!$i(i,a):!0}function Bx(e,t,n){var s=!1,i=rs,a=t.contextType;return typeof a=="object"&&a!==null?a=Rt(a):(i=ft(t)?As:nt.current,s=t.contextTypes,a=(s=s!=null)?Ar(e,i):rs),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ml,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function fp(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&ml.enqueueReplaceState(t,t.state,null)}function Ed(e,t,n,s){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Yu(e);var a=t.contextType;typeof a=="object"&&a!==null?i.context=Rt(a):(a=ft(t)?As:nt.current,i.context=Ar(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(Cd(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&ml.enqueueReplaceState(i,i.state,null),$o(e,n,i,s),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Lr(e,t){try{var n="",s=t;do n+=Gb(s),s=s.return;while(s);var i=n}catch(a){i=`
|
|
37
|
+
`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Gl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?di(e):""}function Gb(e){switch(e.tag){case 5:return di(e.type);case 16:return di("Lazy");case 13:return di("Suspense");case 19:return di("SuspenseList");case 0:case 2:case 15:return e=ql(e.type,!1),e;case 11:return e=ql(e.type.render,!1),e;case 1:return e=ql(e.type,!0),e;default:return""}}function ed(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ar:return"Fragment";case ir:return"Portal";case Qc:return"Profiler";case Tu:return"StrictMode";case Jc:return"Suspense";case Zc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case yg:return(e.displayName||"Context")+".Consumer";case xg:return(e._context.displayName||"Context")+".Provider";case Pu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Au:return t=e.displayName||null,t!==null?t:ed(e.type)||"Memo";case Bn:t=e._payload,e=e._init;try{return ed(e(t))}catch{}}return null}function qb(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ed(t);case 8:return t===Tu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ss(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yb(e){var t=bg(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){s=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ea(e){e._valueTracker||(e._valueTracker=Yb(e))}function wg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=bg(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Eo(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}}function td(e,t){var n=t.checked;return Ee({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pf(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=ss(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function kg(e,t){t=t.checked,t!=null&&_u(e,"checked",t,!1)}function nd(e,t){kg(e,t);var n=ss(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?sd(e,t.type,n):t.hasOwnProperty("defaultValue")&&sd(e,t.type,ss(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Af(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function sd(e,t,n){(t!=="number"||Eo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ui=Array.isArray;function jr(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&s&&(e[n].defaultSelected=!0)}else{for(n=""+ss(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,s&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function rd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(U(91));return Ee({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Mf(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(U(92));if(ui(n)){if(1<n.length)throw Error(U(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ss(n)}}function jg(e,t){var n=ss(t.value),s=ss(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function Rf(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ng(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function id(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Ng(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var _a,Sg=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(_a=_a||document.createElement("div"),_a.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=_a.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Oi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var vi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Xb=["Webkit","ms","Moz","O"];Object.keys(vi).forEach(function(e){Xb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vi[t]=vi[e]})});function Cg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||vi.hasOwnProperty(e)&&vi[e]?(""+t).trim():t+"px"}function Eg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=Cg(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,i):e[n]=i}}var Qb=Ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ad(e,t){if(t){if(Qb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(U(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(U(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(U(61))}if(t.style!=null&&typeof t.style!="object")throw Error(U(62))}}function od(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 ld=null;function Mu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var cd=null,Nr=null,Sr=null;function zf(e){if(e=fa(e)){if(typeof cd!="function")throw Error(U(280));var t=e.stateNode;t&&(t=hl(t),cd(e.stateNode,e.type,t))}}function _g(e){Nr?Sr?Sr.push(e):Sr=[e]:Nr=e}function Tg(){if(Nr){var e=Nr,t=Sr;if(Sr=Nr=null,zf(e),t)for(e=0;e<t.length;e++)zf(t[e])}}function Pg(e,t){return e(t)}function Ag(){}var Yl=!1;function Mg(e,t,n){if(Yl)return e(t,n);Yl=!0;try{return Pg(e,t,n)}finally{Yl=!1,(Nr!==null||Sr!==null)&&(Ag(),Tg())}}function Di(e,t){var n=e.stateNode;if(n===null)return null;var s=hl(n);if(s===null)return null;n=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(U(231,t,typeof n));return n}var dd=!1;if(Nn)try{var ei={};Object.defineProperty(ei,"passive",{get:function(){dd=!0}}),window.addEventListener("test",ei,ei),window.removeEventListener("test",ei,ei)}catch{dd=!1}function Jb(e,t,n,s,i,a,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var bi=!1,_o=null,To=!1,ud=null,Zb={onError:function(e){bi=!0,_o=e}};function ew(e,t,n,s,i,a,o,l,c){bi=!1,_o=null,Jb.apply(Zb,arguments)}function tw(e,t,n,s,i,a,o,l,c){if(ew.apply(this,arguments),bi){if(bi){var d=_o;bi=!1,_o=null}else throw Error(U(198));To||(To=!0,ud=d)}}function $s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Rg(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 Lf(e){if($s(e)!==e)throw Error(U(188))}function nw(e){var t=e.alternate;if(!t){if(t=$s(e),t===null)throw Error(U(188));return t!==e?null:e}for(var n=e,s=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(s=i.return,s!==null){n=s;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return Lf(i),e;if(a===s)return Lf(i),t;a=a.sibling}throw Error(U(188))}if(n.return!==s.return)n=i,s=a;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,s=a;break}if(l===s){o=!0,s=i,n=a;break}l=l.sibling}if(!o){for(l=a.child;l;){if(l===n){o=!0,n=a,s=i;break}if(l===s){o=!0,s=a,n=i;break}l=l.sibling}if(!o)throw Error(U(189))}}if(n.alternate!==s)throw Error(U(190))}if(n.tag!==3)throw Error(U(188));return n.stateNode.current===n?e:t}function zg(e){return e=nw(e),e!==null?Lg(e):null}function Lg(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Lg(e);if(t!==null)return t;e=e.sibling}return null}var Og=wt.unstable_scheduleCallback,Of=wt.unstable_cancelCallback,sw=wt.unstable_shouldYield,rw=wt.unstable_requestPaint,Me=wt.unstable_now,iw=wt.unstable_getCurrentPriorityLevel,Ru=wt.unstable_ImmediatePriority,Dg=wt.unstable_UserBlockingPriority,Po=wt.unstable_NormalPriority,aw=wt.unstable_LowPriority,Ig=wt.unstable_IdlePriority,ll=null,ln=null;function ow(e){if(ln&&typeof ln.onCommitFiberRoot=="function")try{ln.onCommitFiberRoot(ll,e,void 0,(e.current.flags&128)===128)}catch{}}var Gt=Math.clz32?Math.clz32:dw,lw=Math.log,cw=Math.LN2;function dw(e){return e>>>=0,e===0?32:31-(lw(e)/cw|0)|0}var Ta=64,Pa=4194304;function hi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ao(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?s=hi(l):(a&=o,a!==0&&(s=hi(a)))}else o=n&~i,o!==0?s=hi(o):a!==0&&(s=hi(a));if(s===0)return 0;if(t!==0&&t!==s&&!(t&i)&&(i=s&-s,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Gt(t),i=1<<n,s|=e[n],t&=~i;return s}function uw(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hw(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Gt(a),l=1<<o,c=i[o];c===-1?(!(l&n)||l&s)&&(i[o]=uw(l,t)):c<=t&&(e.expiredLanes|=l),a&=~l}}function hd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Bg(){var e=Ta;return Ta<<=1,!(Ta&4194240)&&(Ta=64),e}function Xl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ua(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Gt(t),e[t]=n}function fw(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Gt(n),a=1<<i;t[i]=0,s[i]=-1,e[i]=-1,n&=~a}}function zu(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Gt(n),i=1<<s;i&t|e[s]&t&&(e[s]|=t),n&=~i}}var pe=0;function Fg(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Vg,Lu,$g,Ug,Hg,fd=!1,Aa=[],Kn=null,Gn=null,qn=null,Ii=new Map,Bi=new Map,Vn=[],pw="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 submit".split(" ");function Df(e,t){switch(e){case"focusin":case"focusout":Kn=null;break;case"dragenter":case"dragleave":Gn=null;break;case"mouseover":case"mouseout":qn=null;break;case"pointerover":case"pointerout":Ii.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bi.delete(t.pointerId)}}function ti(e,t,n,s,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:a,targetContainers:[i]},t!==null&&(t=fa(t),t!==null&&Lu(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function mw(e,t,n,s,i){switch(t){case"focusin":return Kn=ti(Kn,e,t,n,s,i),!0;case"dragenter":return Gn=ti(Gn,e,t,n,s,i),!0;case"mouseover":return qn=ti(qn,e,t,n,s,i),!0;case"pointerover":var a=i.pointerId;return Ii.set(a,ti(Ii.get(a)||null,e,t,n,s,i)),!0;case"gotpointercapture":return a=i.pointerId,Bi.set(a,ti(Bi.get(a)||null,e,t,n,s,i)),!0}return!1}function Wg(e){var t=Ns(e.target);if(t!==null){var n=$s(t);if(n!==null){if(t=n.tag,t===13){if(t=Rg(n),t!==null){e.blockedOn=t,Hg(e.priority,function(){$g(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ao(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);ld=s,n.target.dispatchEvent(s),ld=null}else return t=fa(n),t!==null&&Lu(t),e.blockedOn=n,!1;t.shift()}return!0}function If(e,t,n){ao(e)&&n.delete(t)}function gw(){fd=!1,Kn!==null&&ao(Kn)&&(Kn=null),Gn!==null&&ao(Gn)&&(Gn=null),qn!==null&&ao(qn)&&(qn=null),Ii.forEach(If),Bi.forEach(If)}function ni(e,t){e.blockedOn===t&&(e.blockedOn=null,fd||(fd=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,gw)))}function Fi(e){function t(i){return ni(i,e)}if(0<Aa.length){ni(Aa[0],e);for(var n=1;n<Aa.length;n++){var s=Aa[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Kn!==null&&ni(Kn,e),Gn!==null&&ni(Gn,e),qn!==null&&ni(qn,e),Ii.forEach(t),Bi.forEach(t),n=0;n<Vn.length;n++)s=Vn[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Vn.length&&(n=Vn[0],n.blockedOn===null);)Wg(n),n.blockedOn===null&&Vn.shift()}var Cr=Tn.ReactCurrentBatchConfig,Mo=!0;function xw(e,t,n,s){var i=pe,a=Cr.transition;Cr.transition=null;try{pe=1,Ou(e,t,n,s)}finally{pe=i,Cr.transition=a}}function yw(e,t,n,s){var i=pe,a=Cr.transition;Cr.transition=null;try{pe=4,Ou(e,t,n,s)}finally{pe=i,Cr.transition=a}}function Ou(e,t,n,s){if(Mo){var i=pd(e,t,n,s);if(i===null)ac(e,t,s,Ro,n),Df(e,s);else if(mw(i,e,t,n,s))s.stopPropagation();else if(Df(e,s),t&4&&-1<pw.indexOf(e)){for(;i!==null;){var a=fa(i);if(a!==null&&Vg(a),a=pd(e,t,n,s),a===null&&ac(e,t,s,Ro,n),a===i)break;i=a}i!==null&&s.stopPropagation()}else ac(e,t,s,null,n)}}var Ro=null;function pd(e,t,n,s){if(Ro=null,e=Mu(s),e=Ns(e),e!==null)if(t=$s(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Rg(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ro=e,null}function Kg(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(iw()){case Ru:return 1;case Dg:return 4;case Po:case aw:return 16;case Ig:return 536870912;default:return 16}default:return 16}}var Un=null,Du=null,oo=null;function Gg(){if(oo)return oo;var e,t=Du,n=t.length,s,i="value"in Un?Un.value:Un.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===i[a-s];s++);return oo=i.slice(e,1<s?1-s:void 0)}function lo(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 Ma(){return!0}function Bf(){return!1}function Nt(e){function t(n,s,i,a,o){this._reactName=n,this._targetInst=i,this.type=s,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Ma:Bf,this.isPropagationStopped=Bf,this}return Ee(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ma)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ma)},persist:function(){},isPersistent:Ma}),t}var $r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Iu=Nt($r),ha=Ee({},$r,{view:0,detail:0}),vw=Nt(ha),Ql,Jl,si,cl=Ee({},ha,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bu,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!==si&&(si&&e.type==="mousemove"?(Ql=e.screenX-si.screenX,Jl=e.screenY-si.screenY):Jl=Ql=0,si=e),Ql)},movementY:function(e){return"movementY"in e?e.movementY:Jl}}),Ff=Nt(cl),bw=Ee({},cl,{dataTransfer:0}),ww=Nt(bw),kw=Ee({},ha,{relatedTarget:0}),Zl=Nt(kw),jw=Ee({},$r,{animationName:0,elapsedTime:0,pseudoElement:0}),Nw=Nt(jw),Sw=Ee({},$r,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Cw=Nt(Sw),Ew=Ee({},$r,{data:0}),Vf=Nt(Ew),_w={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tw={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"},Pw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Aw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Pw[e])?!!t[e]:!1}function Bu(){return Aw}var Mw=Ee({},ha,{key:function(e){if(e.key){var t=_w[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=lo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Tw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bu,charCode:function(e){return e.type==="keypress"?lo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?lo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Rw=Nt(Mw),zw=Ee({},cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=Nt(zw),Lw=Ee({},ha,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bu}),Ow=Nt(Lw),Dw=Ee({},$r,{propertyName:0,elapsedTime:0,pseudoElement:0}),Iw=Nt(Dw),Bw=Ee({},cl,{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}),Fw=Nt(Bw),Vw=[9,13,27,32],Fu=Nn&&"CompositionEvent"in window,wi=null;Nn&&"documentMode"in document&&(wi=document.documentMode);var $w=Nn&&"TextEvent"in window&&!wi,qg=Nn&&(!Fu||wi&&8<wi&&11>=wi),Uf=" ",Hf=!1;function Yg(e,t){switch(e){case"keyup":return Vw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var or=!1;function Uw(e,t){switch(e){case"compositionend":return Xg(t);case"keypress":return t.which!==32?null:(Hf=!0,Uf);case"textInput":return e=t.data,e===Uf&&Hf?null:e;default:return null}}function Hw(e,t){if(or)return e==="compositionend"||!Fu&&Yg(e,t)?(e=Gg(),oo=Du=Un=null,or=!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 qg&&t.locale!=="ko"?null:t.data;default:return null}}var Ww={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 Wf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ww[e.type]:t==="textarea"}function Qg(e,t,n,s){_g(s),t=zo(t,"onChange"),0<t.length&&(n=new Iu("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var ki=null,Vi=null;function Kw(e){lx(e,0)}function dl(e){var t=dr(e);if(wg(t))return e}function Gw(e,t){if(e==="change")return t}var Jg=!1;if(Nn){var ec;if(Nn){var tc="oninput"in document;if(!tc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),tc=typeof Kf.oninput=="function"}ec=tc}else ec=!1;Jg=ec&&(!document.documentMode||9<document.documentMode)}function Gf(){ki&&(ki.detachEvent("onpropertychange",Zg),Vi=ki=null)}function Zg(e){if(e.propertyName==="value"&&dl(Vi)){var t=[];Qg(t,Vi,e,Mu(e)),Mg(Kw,t)}}function qw(e,t,n){e==="focusin"?(Gf(),ki=t,Vi=n,ki.attachEvent("onpropertychange",Zg)):e==="focusout"&&Gf()}function Yw(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return dl(Vi)}function Xw(e,t){if(e==="click")return dl(t)}function Qw(e,t){if(e==="input"||e==="change")return dl(t)}function Jw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yt=typeof Object.is=="function"?Object.is:Jw;function $i(e,t){if(Yt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var i=n[s];if(!Xc.call(t,i)||!Yt(e[i],t[i]))return!1}return!0}function qf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yf(e,t){var n=qf(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=qf(n)}}function ex(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ex(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function tx(){for(var e=window,t=Eo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Eo(e.document)}return t}function Vu(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")}function Zw(e){var t=tx(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ex(n.ownerDocument.documentElement,n)){if(s!==null&&Vu(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(s.start,i);s=s.end===void 0?a:Math.min(s.end,i),!e.extend&&a>s&&(i=s,s=a,a=i),i=Yf(n,a);var o=Yf(n,s);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>s?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var e2=Nn&&"documentMode"in document&&11>=document.documentMode,lr=null,md=null,ji=null,gd=!1;function Xf(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gd||lr==null||lr!==Eo(s)||(s=lr,"selectionStart"in s&&Vu(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ji&&$i(ji,s)||(ji=s,s=zo(md,"onSelect"),0<s.length&&(t=new Iu("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=lr)))}function Ra(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var cr={animationend:Ra("Animation","AnimationEnd"),animationiteration:Ra("Animation","AnimationIteration"),animationstart:Ra("Animation","AnimationStart"),transitionend:Ra("Transition","TransitionEnd")},nc={},nx={};Nn&&(nx=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);function ul(e){if(nc[e])return nc[e];if(!cr[e])return e;var t=cr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in nx)return nc[e]=t[n];return e}var sx=ul("animationend"),rx=ul("animationiteration"),ix=ul("animationstart"),ax=ul("transitionend"),ox=new Map,Qf="abort auxClick 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(" ");function cs(e,t){ox.set(e,t),Vs(t,[e])}for(var sc=0;sc<Qf.length;sc++){var rc=Qf[sc],t2=rc.toLowerCase(),n2=rc[0].toUpperCase()+rc.slice(1);cs(t2,"on"+n2)}cs(sx,"onAnimationEnd");cs(rx,"onAnimationIteration");cs(ix,"onAnimationStart");cs("dblclick","onDoubleClick");cs("focusin","onFocus");cs("focusout","onBlur");cs(ax,"onTransitionEnd");Pr("onMouseEnter",["mouseout","mouseover"]);Pr("onMouseLeave",["mouseout","mouseover"]);Pr("onPointerEnter",["pointerout","pointerover"]);Pr("onPointerLeave",["pointerout","pointerover"]);Vs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Vs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Vs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Vs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fi="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(" "),s2=new Set("cancel close invalid load scroll toggle".split(" ").concat(fi));function Jf(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,tw(s,t,void 0,e),e.currentTarget=null}function lx(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],i=s.event;s=s.listeners;e:{var a=void 0;if(t)for(var o=s.length-1;0<=o;o--){var l=s[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==a&&i.isPropagationStopped())break e;Jf(i,l,d),a=c}else for(o=0;o<s.length;o++){if(l=s[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==a&&i.isPropagationStopped())break e;Jf(i,l,d),a=c}}}if(To)throw e=ud,To=!1,ud=null,e}function ye(e,t){var n=t[wd];n===void 0&&(n=t[wd]=new Set);var s=e+"__bubble";n.has(s)||(cx(t,e,2,!1),n.add(s))}function ic(e,t,n){var s=0;t&&(s|=4),cx(n,e,s,t)}var za="_reactListening"+Math.random().toString(36).slice(2);function Ui(e){if(!e[za]){e[za]=!0,gg.forEach(function(n){n!=="selectionchange"&&(s2.has(n)||ic(n,!1,e),ic(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[za]||(t[za]=!0,ic("selectionchange",!1,t))}}function cx(e,t,n,s){switch(Kg(t)){case 1:var i=xw;break;case 4:i=yw;break;default:i=Ou}n=i.bind(null,t,n,e),i=void 0,!dd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),s?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function ac(e,t,n,s,i){var a=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var l=s.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Ns(l),o===null)return;if(c=o.tag,c===5||c===6){s=a=o;continue e}l=l.parentNode}}s=s.return}Mg(function(){var d=a,u=Mu(n),p=[];e:{var f=ox.get(e);if(f!==void 0){var m=Iu,b=e;switch(e){case"keypress":if(lo(n)===0)break e;case"keydown":case"keyup":m=Rw;break;case"focusin":b="focus",m=Zl;break;case"focusout":b="blur",m=Zl;break;case"beforeblur":case"afterblur":m=Zl;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Ff;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=ww;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Ow;break;case sx:case rx:case ix:m=Nw;break;case ax:m=Iw;break;case"scroll":m=vw;break;case"wheel":m=Fw;break;case"copy":case"cut":case"paste":m=Cw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=$f}var y=(t&4)!==0,v=!y&&e==="scroll",g=y?f!==null?f+"Capture":null:f;y=[];for(var x=d,w;x!==null;){w=x;var j=w.stateNode;if(w.tag===5&&j!==null&&(w=j,g!==null&&(j=Di(x,g),j!=null&&y.push(Hi(x,j,w)))),v)break;x=x.return}0<y.length&&(f=new m(f,b,null,n,u),p.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==ld&&(b=n.relatedTarget||n.fromElement)&&(Ns(b)||b[Sn]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(b=n.relatedTarget||n.toElement,m=d,b=b?Ns(b):null,b!==null&&(v=$s(b),b!==v||b.tag!==5&&b.tag!==6)&&(b=null)):(m=null,b=d),m!==b)){if(y=Ff,j="onMouseLeave",g="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(y=$f,j="onPointerLeave",g="onPointerEnter",x="pointer"),v=m==null?f:dr(m),w=b==null?f:dr(b),f=new y(j,x+"leave",m,n,u),f.target=v,f.relatedTarget=w,j=null,Ns(u)===d&&(y=new y(g,x+"enter",b,n,u),y.target=w,y.relatedTarget=v,j=y),v=j,m&&b)t:{for(y=m,g=b,x=0,w=y;w;w=Zs(w))x++;for(w=0,j=g;j;j=Zs(j))w++;for(;0<x-w;)y=Zs(y),x--;for(;0<w-x;)g=Zs(g),w--;for(;x--;){if(y===g||g!==null&&y===g.alternate)break t;y=Zs(y),g=Zs(g)}y=null}else y=null;m!==null&&Zf(p,f,m,y,!1),b!==null&&v!==null&&Zf(p,v,b,y,!0)}}e:{if(f=d?dr(d):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var k=Gw;else if(Wf(f))if(Jg)k=Qw;else{k=Yw;var N=qw}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=Xw);if(k&&(k=k(e,d))){Qg(p,k,n,u);break e}N&&N(e,f,d),e==="focusout"&&(N=f._wrapperState)&&N.controlled&&f.type==="number"&&sd(f,"number",f.value)}switch(N=d?dr(d):window,e){case"focusin":(Wf(N)||N.contentEditable==="true")&&(lr=N,md=d,ji=null);break;case"focusout":ji=md=lr=null;break;case"mousedown":gd=!0;break;case"contextmenu":case"mouseup":case"dragend":gd=!1,Xf(p,n,u);break;case"selectionchange":if(e2)break;case"keydown":case"keyup":Xf(p,n,u)}var S;if(Fu)e:{switch(e){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else or?Yg(e,n)&&(_="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(_="onCompositionStart");_&&(qg&&n.locale!=="ko"&&(or||_!=="onCompositionStart"?_==="onCompositionEnd"&&or&&(S=Gg()):(Un=u,Du="value"in Un?Un.value:Un.textContent,or=!0)),N=zo(d,_),0<N.length&&(_=new Vf(_,e,null,n,u),p.push({event:_,listeners:N}),S?_.data=S:(S=Xg(n),S!==null&&(_.data=S)))),(S=$w?Uw(e,n):Hw(e,n))&&(d=zo(d,"onBeforeInput"),0<d.length&&(u=new Vf("onBeforeInput","beforeinput",null,n,u),p.push({event:u,listeners:d}),u.data=S))}lx(p,t)})}function Hi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function zo(e,t){for(var n=t+"Capture",s=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Di(e,n),a!=null&&s.unshift(Hi(e,a,i)),a=Di(e,t),a!=null&&s.push(Hi(e,a,i))),e=e.return}return s}function Zs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Zf(e,t,n,s,i){for(var a=t._reactName,o=[];n!==null&&n!==s;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===s)break;l.tag===5&&d!==null&&(l=d,i?(c=Di(n,a),c!=null&&o.unshift(Hi(n,c,l))):i||(c=Di(n,a),c!=null&&o.push(Hi(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var r2=/\r\n?/g,i2=/\u0000|\uFFFD/g;function ep(e){return(typeof e=="string"?e:""+e).replace(r2,`
|
|
38
|
+
`).replace(i2,"")}function La(e,t,n){if(t=ep(t),ep(e)!==t&&n)throw Error(U(425))}function Lo(){}var xd=null,yd=null;function vd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bd=typeof setTimeout=="function"?setTimeout:void 0,a2=typeof clearTimeout=="function"?clearTimeout:void 0,tp=typeof Promise=="function"?Promise:void 0,o2=typeof queueMicrotask=="function"?queueMicrotask:typeof tp<"u"?function(e){return tp.resolve(null).then(e).catch(l2)}:bd;function l2(e){setTimeout(function(){throw e})}function oc(e,t){var n=t,s=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(s===0){e.removeChild(i),Fi(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=i}while(n);Fi(t)}function Yn(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==="$?")break;if(t==="/$")return null}}return e}function np(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ur=Math.random().toString(36).slice(2),an="__reactFiber$"+Ur,Wi="__reactProps$"+Ur,Sn="__reactContainer$"+Ur,wd="__reactEvents$"+Ur,c2="__reactListeners$"+Ur,d2="__reactHandles$"+Ur;function Ns(e){var t=e[an];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Sn]||n[an]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=np(e);e!==null;){if(n=e[an])return n;e=np(e)}return t}e=n,n=e.parentNode}return null}function fa(e){return e=e[an]||e[Sn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function dr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(U(33))}function hl(e){return e[Wi]||null}var kd=[],ur=-1;function ds(e){return{current:e}}function be(e){0>ur||(e.current=kd[ur],kd[ur]=null,ur--)}function xe(e,t){ur++,kd[ur]=e.current,e.current=t}var rs={},nt=ds(rs),ht=ds(!1),As=rs;function Ar(e,t){var n=e.type.contextTypes;if(!n)return rs;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ft(e){return e=e.childContextTypes,e!=null}function Oo(){be(ht),be(nt)}function sp(e,t,n){if(nt.current!==rs)throw Error(U(168));xe(nt,t),xe(ht,n)}function dx(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var i in s)if(!(i in t))throw Error(U(108,qb(e)||"Unknown",i));return Ee({},n,s)}function Do(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rs,As=nt.current,xe(nt,e),xe(ht,ht.current),!0}function rp(e,t,n){var s=e.stateNode;if(!s)throw Error(U(169));n?(e=dx(e,t,As),s.__reactInternalMemoizedMergedChildContext=e,be(ht),be(nt),xe(nt,e)):be(ht),xe(ht,n)}var xn=null,fl=!1,lc=!1;function ux(e){xn===null?xn=[e]:xn.push(e)}function u2(e){fl=!0,ux(e)}function us(){if(!lc&&xn!==null){lc=!0;var e=0,t=pe;try{var n=xn;for(pe=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}xn=null,fl=!1}catch(i){throw xn!==null&&(xn=xn.slice(e+1)),Og(Ru,us),i}finally{pe=t,lc=!1}}return null}var hr=[],fr=0,Io=null,Bo=0,Et=[],_t=0,Ms=null,vn=1,bn="";function bs(e,t){hr[fr++]=Bo,hr[fr++]=Io,Io=e,Bo=t}function hx(e,t,n){Et[_t++]=vn,Et[_t++]=bn,Et[_t++]=Ms,Ms=e;var s=vn;e=bn;var i=32-Gt(s)-1;s&=~(1<<i),n+=1;var a=32-Gt(t)+i;if(30<a){var o=i-i%5;a=(s&(1<<o)-1).toString(32),s>>=o,i-=o,vn=1<<32-Gt(t)+i|n<<i|s,bn=a+e}else vn=1<<a|n<<i|s,bn=e}function $u(e){e.return!==null&&(bs(e,1),hx(e,1,0))}function Uu(e){for(;e===Io;)Io=hr[--fr],hr[fr]=null,Bo=hr[--fr],hr[fr]=null;for(;e===Ms;)Ms=Et[--_t],Et[_t]=null,bn=Et[--_t],Et[_t]=null,vn=Et[--_t],Et[_t]=null}var vt=null,yt=null,je=!1,Wt=null;function fx(e,t){var n=Pt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ip(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,vt=e,yt=Yn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,vt=e,yt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ms!==null?{id:vn,overflow:bn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Pt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,vt=e,yt=null,!0):!1;default:return!1}}function jd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Nd(e){if(je){var t=yt;if(t){var n=t;if(!ip(e,t)){if(jd(e))throw Error(U(418));t=Yn(n.nextSibling);var s=vt;t&&ip(e,t)?fx(s,n):(e.flags=e.flags&-4097|2,je=!1,vt=e)}}else{if(jd(e))throw Error(U(418));e.flags=e.flags&-4097|2,je=!1,vt=e}}}function ap(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;vt=e}function Oa(e){if(e!==vt)return!1;if(!je)return ap(e),je=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!vd(e.type,e.memoizedProps)),t&&(t=yt)){if(jd(e))throw px(),Error(U(418));for(;t;)fx(e,t),t=Yn(t.nextSibling)}if(ap(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){yt=Yn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}yt=null}}else yt=vt?Yn(e.stateNode.nextSibling):null;return!0}function px(){for(var e=yt;e;)e=Yn(e.nextSibling)}function Mr(){yt=vt=null,je=!1}function Hu(e){Wt===null?Wt=[e]:Wt.push(e)}var h2=Tn.ReactCurrentBatchConfig;function ri(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(U(309));var s=n.stateNode}if(!s)throw Error(U(147,e));var i=s,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(o){var l=i.refs;o===null?delete l[a]:l[a]=o},t._stringRef=a,t)}if(typeof e!="string")throw Error(U(284));if(!n._owner)throw Error(U(290,e))}return e}function Da(e,t){throw e=Object.prototype.toString.call(t),Error(U(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function op(e){var t=e._init;return t(e._payload)}function mx(e){function t(g,x){if(e){var w=g.deletions;w===null?(g.deletions=[x],g.flags|=16):w.push(x)}}function n(g,x){if(!e)return null;for(;x!==null;)t(g,x),x=x.sibling;return null}function s(g,x){for(g=new Map;x!==null;)x.key!==null?g.set(x.key,x):g.set(x.index,x),x=x.sibling;return g}function i(g,x){return g=Zn(g,x),g.index=0,g.sibling=null,g}function a(g,x,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<x?(g.flags|=2,x):w):(g.flags|=2,x)):(g.flags|=1048576,x)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,x,w,j){return x===null||x.tag!==6?(x=mc(w,g.mode,j),x.return=g,x):(x=i(x,w),x.return=g,x)}function c(g,x,w,j){var k=w.type;return k===ar?u(g,x,w.props.children,j,w.key):x!==null&&(x.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Bn&&op(k)===x.type)?(j=i(x,w.props),j.ref=ri(g,x,w),j.return=g,j):(j=go(w.type,w.key,w.props,null,g.mode,j),j.ref=ri(g,x,w),j.return=g,j)}function d(g,x,w,j){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=gc(w,g.mode,j),x.return=g,x):(x=i(x,w.children||[]),x.return=g,x)}function u(g,x,w,j,k){return x===null||x.tag!==7?(x=Ts(w,g.mode,j,k),x.return=g,x):(x=i(x,w),x.return=g,x)}function p(g,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=mc(""+x,g.mode,w),x.return=g,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Ca:return w=go(x.type,x.key,x.props,null,g.mode,w),w.ref=ri(g,null,x),w.return=g,w;case ir:return x=gc(x,g.mode,w),x.return=g,x;case Bn:var j=x._init;return p(g,j(x._payload),w)}if(ui(x)||Zr(x))return x=Ts(x,g.mode,w,null),x.return=g,x;Da(g,x)}return null}function f(g,x,w,j){var k=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return k!==null?null:l(g,x,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ca:return w.key===k?c(g,x,w,j):null;case ir:return w.key===k?d(g,x,w,j):null;case Bn:return k=w._init,f(g,x,k(w._payload),j)}if(ui(w)||Zr(w))return k!==null?null:u(g,x,w,j,null);Da(g,w)}return null}function m(g,x,w,j,k){if(typeof j=="string"&&j!==""||typeof j=="number")return g=g.get(w)||null,l(x,g,""+j,k);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Ca:return g=g.get(j.key===null?w:j.key)||null,c(x,g,j,k);case ir:return g=g.get(j.key===null?w:j.key)||null,d(x,g,j,k);case Bn:var N=j._init;return m(g,x,w,N(j._payload),k)}if(ui(j)||Zr(j))return g=g.get(w)||null,u(x,g,j,k,null);Da(x,j)}return null}function b(g,x,w,j){for(var k=null,N=null,S=x,_=x=0,R=null;S!==null&&_<w.length;_++){S.index>_?(R=S,S=null):R=S.sibling;var L=f(g,S,w[_],j);if(L===null){S===null&&(S=R);break}e&&S&&L.alternate===null&&t(g,S),x=a(L,x,_),N===null?k=L:N.sibling=L,N=L,S=R}if(_===w.length)return n(g,S),je&&bs(g,_),k;if(S===null){for(;_<w.length;_++)S=p(g,w[_],j),S!==null&&(x=a(S,x,_),N===null?k=S:N.sibling=S,N=S);return je&&bs(g,_),k}for(S=s(g,S);_<w.length;_++)R=m(S,g,_,w[_],j),R!==null&&(e&&R.alternate!==null&&S.delete(R.key===null?_:R.key),x=a(R,x,_),N===null?k=R:N.sibling=R,N=R);return e&&S.forEach(function(P){return t(g,P)}),je&&bs(g,_),k}function y(g,x,w,j){var k=Zr(w);if(typeof k!="function")throw Error(U(150));if(w=k.call(w),w==null)throw Error(U(151));for(var N=k=null,S=x,_=x=0,R=null,L=w.next();S!==null&&!L.done;_++,L=w.next()){S.index>_?(R=S,S=null):R=S.sibling;var P=f(g,S,L.value,j);if(P===null){S===null&&(S=R);break}e&&S&&P.alternate===null&&t(g,S),x=a(P,x,_),N===null?k=P:N.sibling=P,N=P,S=R}if(L.done)return n(g,S),je&&bs(g,_),k;if(S===null){for(;!L.done;_++,L=w.next())L=p(g,L.value,j),L!==null&&(x=a(L,x,_),N===null?k=L:N.sibling=L,N=L);return je&&bs(g,_),k}for(S=s(g,S);!L.done;_++,L=w.next())L=m(S,g,_,L.value,j),L!==null&&(e&&L.alternate!==null&&S.delete(L.key===null?_:L.key),x=a(L,x,_),N===null?k=L:N.sibling=L,N=L);return e&&S.forEach(function(V){return t(g,V)}),je&&bs(g,_),k}function v(g,x,w,j){if(typeof w=="object"&&w!==null&&w.type===ar&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Ca:e:{for(var k=w.key,N=x;N!==null;){if(N.key===k){if(k=w.type,k===ar){if(N.tag===7){n(g,N.sibling),x=i(N,w.props.children),x.return=g,g=x;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Bn&&op(k)===N.type){n(g,N.sibling),x=i(N,w.props),x.ref=ri(g,N,w),x.return=g,g=x;break e}n(g,N);break}else t(g,N);N=N.sibling}w.type===ar?(x=Ts(w.props.children,g.mode,j,w.key),x.return=g,g=x):(j=go(w.type,w.key,w.props,null,g.mode,j),j.ref=ri(g,x,w),j.return=g,g=j)}return o(g);case ir:e:{for(N=w.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(g,x.sibling),x=i(x,w.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else t(g,x);x=x.sibling}x=gc(w,g.mode,j),x.return=g,g=x}return o(g);case Bn:return N=w._init,v(g,x,N(w._payload),j)}if(ui(w))return b(g,x,w,j);if(Zr(w))return y(g,x,w,j);Da(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(g,x.sibling),x=i(x,w),x.return=g,g=x):(n(g,x),x=mc(w,g.mode,j),x.return=g,g=x),o(g)):n(g,x)}return v}var Rr=mx(!0),gx=mx(!1),Fo=ds(null),Vo=null,pr=null,Wu=null;function Ku(){Wu=pr=Vo=null}function Gu(e){var t=Fo.current;be(Fo),e._currentValue=t}function Sd(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Er(e,t){Vo=e,Wu=pr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ut=!0),e.firstContext=null)}function Rt(e){var t=e._currentValue;if(Wu!==e)if(e={context:e,memoizedValue:t,next:null},pr===null){if(Vo===null)throw Error(U(308));pr=e,Vo.dependencies={lanes:0,firstContext:e}}else pr=pr.next=e;return t}var Ss=null;function qu(e){Ss===null?Ss=[e]:Ss.push(e)}function xx(e,t,n,s){var i=t.interleaved;return i===null?(n.next=n,qu(t)):(n.next=i.next,i.next=n),t.interleaved=n,Cn(e,s)}function Cn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Fn=!1;function Yu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Xn(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ue&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,Cn(e,n)}return i=s.interleaved,i===null?(t.next=t,qu(s)):(t.next=i.next,i.next=t),s.interleaved=t,Cn(e,n)}function co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zu(e,n)}}function lp(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function $o(e,t,n,s){var i=e.updateQueue;Fn=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?a=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(a!==null){var p=i.baseState;o=0,u=d=c=null,l=a;do{var f=l.lane,m=l.eventTime;if((s&f)===f){u!==null&&(u=u.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var b=e,y=l;switch(f=t,m=n,y.tag){case 1:if(b=y.payload,typeof b=="function"){p=b.call(m,p,f);break e}p=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=y.payload,f=typeof b=="function"?b.call(m,p,f):b,f==null)break e;p=Ee({},p,f);break e;case 2:Fn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=m,c=p):u=u.next=m,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(c=p),i.baseState=c,i.firstBaseUpdate=d,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);zs|=o,e.lanes=o,e.memoizedState=p}}function cp(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],i=s.callback;if(i!==null){if(s.callback=null,s=n,typeof i!="function")throw Error(U(191,i));i.call(s)}}}var pa={},cn=ds(pa),Ki=ds(pa),Gi=ds(pa);function Cs(e){if(e===pa)throw Error(U(174));return e}function Xu(e,t){switch(xe(Gi,t),xe(Ki,e),xe(cn,pa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:id(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=id(t,e)}be(cn),xe(cn,t)}function zr(){be(cn),be(Ki),be(Gi)}function vx(e){Cs(Gi.current);var t=Cs(cn.current),n=id(t,e.type);t!==n&&(xe(Ki,e),xe(cn,n))}function Qu(e){Ki.current===e&&(be(cn),be(Ki))}var Ne=ds(0);function Uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var cc=[];function Ju(){for(var e=0;e<cc.length;e++)cc[e]._workInProgressVersionPrimary=null;cc.length=0}var uo=Tn.ReactCurrentDispatcher,dc=Tn.ReactCurrentBatchConfig,Rs=0,Ce=null,De=null,$e=null,Ho=!1,Ni=!1,qi=0,f2=0;function Xe(){throw Error(U(321))}function Zu(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yt(e[n],t[n]))return!1;return!0}function eh(e,t,n,s,i,a){if(Rs=a,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,uo.current=e===null||e.memoizedState===null?x2:y2,e=n(s,i),Ni){a=0;do{if(Ni=!1,qi=0,25<=a)throw Error(U(301));a+=1,$e=De=null,t.updateQueue=null,uo.current=v2,e=n(s,i)}while(Ni)}if(uo.current=Wo,t=De!==null&&De.next!==null,Rs=0,$e=De=Ce=null,Ho=!1,t)throw Error(U(300));return e}function th(){var e=qi!==0;return qi=0,e}function rn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $e===null?Ce.memoizedState=$e=e:$e=$e.next=e,$e}function zt(){if(De===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=$e===null?Ce.memoizedState:$e.next;if(t!==null)$e=t,De=e;else{if(e===null)throw Error(U(310));De=e,e={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},$e===null?Ce.memoizedState=$e=e:$e=$e.next=e}return $e}function Yi(e,t){return typeof t=="function"?t(e):t}function uc(e){var t=zt(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var s=De,i=s.baseQueue,a=n.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}s.baseQueue=i=a,n.pending=null}if(i!==null){a=i.next,s=s.baseState;var l=o=null,c=null,d=a;do{var u=d.lane;if((Rs&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var p={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=p,o=s):c=c.next=p,Ce.lanes|=u,zs|=u}d=d.next}while(d!==null&&d!==a);c===null?o=s:c.next=l,Yt(s,t.memoizedState)||(ut=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){i=e;do a=i.lane,Ce.lanes|=a,zs|=a,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function hc(e){var t=zt(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var s=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);Yt(a,t.memoizedState)||(ut=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,s]}function bx(){}function wx(e,t){var n=Ce,s=zt(),i=t(),a=!Yt(s.memoizedState,i);if(a&&(s.memoizedState=i,ut=!0),s=s.queue,nh(Nx.bind(null,n,s,e),[e]),s.getSnapshot!==t||a||$e!==null&&$e.memoizedState.tag&1){if(n.flags|=2048,Xi(9,jx.bind(null,n,s,i,t),void 0,null),Ue===null)throw Error(U(349));Rs&30||kx(n,t,i)}return i}function kx(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function jx(e,t,n,s){t.value=n,t.getSnapshot=s,Sx(t)&&Cx(e)}function Nx(e,t,n){return n(function(){Sx(t)&&Cx(e)})}function Sx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yt(e,n)}catch{return!0}}function Cx(e){var t=Cn(e,1);t!==null&&qt(t,e,1,-1)}function dp(e){var t=rn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:e},t.queue=e,e=e.dispatch=g2.bind(null,Ce,e),[t.memoizedState,e]}function Xi(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function Ex(){return zt().memoizedState}function ho(e,t,n,s){var i=rn();Ce.flags|=e,i.memoizedState=Xi(1|t,n,void 0,s===void 0?null:s)}function pl(e,t,n,s){var i=zt();s=s===void 0?null:s;var a=void 0;if(De!==null){var o=De.memoizedState;if(a=o.destroy,s!==null&&Zu(s,o.deps)){i.memoizedState=Xi(t,n,a,s);return}}Ce.flags|=e,i.memoizedState=Xi(1|t,n,a,s)}function up(e,t){return ho(8390656,8,e,t)}function nh(e,t){return pl(2048,8,e,t)}function _x(e,t){return pl(4,2,e,t)}function Tx(e,t){return pl(4,4,e,t)}function Px(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ax(e,t,n){return n=n!=null?n.concat([e]):null,pl(4,4,Px.bind(null,t,e),n)}function sh(){}function Mx(e,t){var n=zt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Zu(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Rx(e,t){var n=zt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Zu(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function zx(e,t,n){return Rs&21?(Yt(n,t)||(n=Bg(),Ce.lanes|=n,zs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ut=!0),e.memoizedState=n)}function p2(e,t){var n=pe;pe=n!==0&&4>n?n:4,e(!0);var s=dc.transition;dc.transition={};try{e(!1),t()}finally{pe=n,dc.transition=s}}function Lx(){return zt().memoizedState}function m2(e,t,n){var s=Jn(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Ox(e))Dx(t,n);else if(n=xx(e,t,n,s),n!==null){var i=it();qt(n,e,s,i),Ix(n,t,s)}}function g2(e,t,n){var s=Jn(e),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ox(e))Dx(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,Yt(l,o)){var c=t.interleaved;c===null?(i.next=i,qu(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=xx(e,t,i,s),n!==null&&(i=it(),qt(n,e,s,i),Ix(n,t,s))}}function Ox(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function Dx(e,t){Ni=Ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ix(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zu(e,n)}}var Wo={readContext:Rt,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useInsertionEffect:Xe,useLayoutEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useMutableSource:Xe,useSyncExternalStore:Xe,useId:Xe,unstable_isNewReconciler:!1},x2={readContext:Rt,useCallback:function(e,t){return rn().memoizedState=[e,t===void 0?null:t],e},useContext:Rt,useEffect:up,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ho(4194308,4,Px.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ho(4194308,4,e,t)},useInsertionEffect:function(e,t){return ho(4,2,e,t)},useMemo:function(e,t){var n=rn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=rn();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=m2.bind(null,Ce,e),[s.memoizedState,e]},useRef:function(e){var t=rn();return e={current:e},t.memoizedState=e},useState:dp,useDebugValue:sh,useDeferredValue:function(e){return rn().memoizedState=e},useTransition:function(){var e=dp(!1),t=e[0];return e=p2.bind(null,e[1]),rn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=Ce,i=rn();if(je){if(n===void 0)throw Error(U(407));n=n()}else{if(n=t(),Ue===null)throw Error(U(349));Rs&30||kx(s,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,up(Nx.bind(null,s,a,e),[e]),s.flags|=2048,Xi(9,jx.bind(null,s,a,n,t),void 0,null),n},useId:function(){var e=rn(),t=Ue.identifierPrefix;if(je){var n=bn,s=vn;n=(s&~(1<<32-Gt(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=qi++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=f2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},y2={readContext:Rt,useCallback:Mx,useContext:Rt,useEffect:nh,useImperativeHandle:Ax,useInsertionEffect:_x,useLayoutEffect:Tx,useMemo:Rx,useReducer:uc,useRef:Ex,useState:function(){return uc(Yi)},useDebugValue:sh,useDeferredValue:function(e){var t=zt();return zx(t,De.memoizedState,e)},useTransition:function(){var e=uc(Yi)[0],t=zt().memoizedState;return[e,t]},useMutableSource:bx,useSyncExternalStore:wx,useId:Lx,unstable_isNewReconciler:!1},v2={readContext:Rt,useCallback:Mx,useContext:Rt,useEffect:nh,useImperativeHandle:Ax,useInsertionEffect:_x,useLayoutEffect:Tx,useMemo:Rx,useReducer:hc,useRef:Ex,useState:function(){return hc(Yi)},useDebugValue:sh,useDeferredValue:function(e){var t=zt();return De===null?t.memoizedState=e:zx(t,De.memoizedState,e)},useTransition:function(){var e=hc(Yi)[0],t=zt().memoizedState;return[e,t]},useMutableSource:bx,useSyncExternalStore:wx,useId:Lx,unstable_isNewReconciler:!1};function $t(e,t){if(e&&e.defaultProps){t=Ee({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Cd(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Ee({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ml={isMounted:function(e){return(e=e._reactInternals)?$s(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=it(),i=Jn(e),a=wn(s,i);a.payload=t,n!=null&&(a.callback=n),t=Xn(e,a,i),t!==null&&(qt(t,e,i,s),co(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=it(),i=Jn(e),a=wn(s,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Xn(e,a,i),t!==null&&(qt(t,e,i,s),co(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=it(),s=Jn(e),i=wn(n,s);i.tag=2,t!=null&&(i.callback=t),t=Xn(e,i,s),t!==null&&(qt(t,e,s,n),co(t,e,s))}};function hp(e,t,n,s,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,a,o):t.prototype&&t.prototype.isPureReactComponent?!$i(n,s)||!$i(i,a):!0}function Bx(e,t,n){var s=!1,i=rs,a=t.contextType;return typeof a=="object"&&a!==null?a=Rt(a):(i=ft(t)?As:nt.current,s=t.contextTypes,a=(s=s!=null)?Ar(e,i):rs),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ml,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function fp(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&ml.enqueueReplaceState(t,t.state,null)}function Ed(e,t,n,s){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Yu(e);var a=t.contextType;typeof a=="object"&&a!==null?i.context=Rt(a):(a=ft(t)?As:nt.current,i.context=Ar(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(Cd(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&ml.enqueueReplaceState(i,i.state,null),$o(e,n,i,s),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Lr(e,t){try{var n="",s=t;do n+=Gb(s),s=s.return;while(s);var i=n}catch(a){i=`
|
|
39
39
|
Error generating stack: `+a.message+`
|
|
40
|
-
`+a.stack}return{value:e,source:t,stack:i,digest:null}}function fc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function _d(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var b2=typeof WeakMap=="function"?WeakMap:Map;function Fx(e,t,n){n=wn(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Go||(Go=!0,Id=s),_d(e,t)},n}function Vx(e,t,n){n=wn(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var i=t.value;n.payload=function(){return s(i)},n.callback=function(){_d(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){_d(e,t),typeof s!="function"&&(Qn===null?Qn=new Set([this]):Qn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function pp(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new b2;var i=new Set;s.set(t,i)}else i=s.get(t),i===void 0&&(i=new Set,s.set(t,i));i.has(n)||(i.add(n),e=z2.bind(null,e,t,n),t.then(e,e))}function mp(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function gp(e,t,n,s,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=wn(-1,1),t.tag=2,Xn(n,t,1))),n.lanes|=1),e)}var w2=Tn.ReactCurrentOwner,ut=!1;function rt(e,t,n,s){t.child=e===null?gx(t,null,n,s):Rr(t,e.child,n,s)}function xp(e,t,n,s,i){n=n.render;var a=t.ref;return Er(t,i),s=eh(e,t,n,s,a,i),n=th(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,En(e,t,i)):(je&&n&&$u(t),t.flags|=1,rt(e,t,s,i),t.child)}function yp(e,t,n,s,i){if(e===null){var a=n.type;return typeof a=="function"&&!uh(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,$x(e,t,a,s,i)):(e=go(n.type,null,s,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&i)){var o=a.memoizedProps;if(n=n.compare,n=n!==null?n:$i,n(o,s)&&e.ref===t.ref)return En(e,t,i)}return t.flags|=1,e=Zn(a,s),e.ref=t.ref,e.return=t,t.child=e}function $x(e,t,n,s,i){if(e!==null){var a=e.memoizedProps;if($i(a,s)&&e.ref===t.ref)if(ut=!1,t.pendingProps=s=a,(e.lanes&i)!==0)e.flags&131072&&(ut=!0);else return t.lanes=e.lanes,En(e,t,i)}return Td(e,t,n,s,i)}function Ux(e,t,n){var s=t.pendingProps,i=s.children,a=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xe(gr,xt),xt|=n;else{if(!(n&1073741824))return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xe(gr,xt),xt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=a!==null?a.baseLanes:n,xe(gr,xt),xt|=s}else a!==null?(s=a.baseLanes|n,t.memoizedState=null):s=n,xe(gr,xt),xt|=s;return rt(e,t,i,n),t.child}function Hx(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Td(e,t,n,s,i){var a=ft(n)?As:nt.current;return a=Ar(t,a),Er(t,i),n=eh(e,t,n,s,a,i),s=th(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,En(e,t,i)):(je&&s&&$u(t),t.flags|=1,rt(e,t,n,i),t.child)}function vp(e,t,n,s,i){if(ft(n)){var a=!0;Do(t)}else a=!1;if(Er(t,i),t.stateNode===null)fo(e,t),Bx(t,n,s),Ed(t,n,s,i),s=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=Rt(d):(d=ft(n)?As:nt.current,d=Ar(t,d));var u=n.getDerivedStateFromProps,p=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";p||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==s||c!==d)&&fp(t,o,s,d),Fn=!1;var f=t.memoizedState;o.state=f,$o(t,s,o,i),c=t.memoizedState,l!==s||f!==c||ht.current||Fn?(typeof u=="function"&&(Cd(t,n,u,s),c=t.memoizedState),(l=Fn||hp(t,n,l,s,f,c,d))?(p||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=s,t.memoizedState=c),o.props=s,o.state=c,o.context=d,s=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,yx(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:$t(t.type,l),o.props=d,p=t.pendingProps,f=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Rt(c):(c=ft(n)?As:nt.current,c=Ar(t,c));var m=n.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==p||f!==c)&&fp(t,o,s,c),Fn=!1,f=t.memoizedState,o.state=f,$o(t,s,o,i);var b=t.memoizedState;l!==p||f!==b||ht.current||Fn?(typeof m=="function"&&(Cd(t,n,m,s),b=t.memoizedState),(d=Fn||hp(t,n,d,s,f,b,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,b,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,b,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=b),o.props=s,o.state=b,o.context=c,s=d):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return Pd(e,t,n,s,a,i)}function Pd(e,t,n,s,i,a){Hx(e,t);var o=(t.flags&128)!==0;if(!s&&!o)return i&&rp(t,n,!1),En(e,t,a);s=t.stateNode,w2.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&o?(t.child=Rr(t,e.child,null,a),t.child=Rr(t,null,l,a)):rt(e,t,l,a),t.memoizedState=s.state,i&&rp(t,n,!0),t.child}function Wx(e){var t=e.stateNode;t.pendingContext?sp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&sp(e,t.context,!1),Xu(e,t.containerInfo)}function bp(e,t,n,s,i){return Mr(),Hu(i),t.flags|=256,rt(e,t,n,s),t.child}var Ad={dehydrated:null,treeContext:null,retryLane:0};function Md(e){return{baseLanes:e,cachePool:null,transitions:null}}function Kx(e,t,n){var s=t.pendingProps,i=Ne.current,a=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),xe(Ne,i&1),e===null)return Nd(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=s.children,e=s.fallback,a?(s=t.mode,a=t.child,o={mode:"hidden",children:o},!(s&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=yl(o,s,0,null),e=Ts(e,s,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Md(n),t.memoizedState=Ad,e):rh(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return k2(e,t,o,s,l,i,n);if(a){a=s.fallback,o=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&t.child!==i?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Zn(i,c),s.subtreeFlags=i.subtreeFlags&14680064),l!==null?a=Zn(l,a):(a=Ts(a,o,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,s=a,a=t.child,o=e.child.memoizedState,o=o===null?Md(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ad,s}return a=e.child,e=a.sibling,s=Zn(a,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function rh(e,t){return t=yl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ia(e,t,n,s){return s!==null&&Hu(s),Rr(t,e.child,null,n),e=rh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function k2(e,t,n,s,i,a,o){if(n)return t.flags&256?(t.flags&=-257,s=fc(Error(U(422))),Ia(e,t,o,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=s.fallback,i=t.mode,s=yl({mode:"visible",children:s.children},i,0,null),a=Ts(a,i,o,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,t.mode&1&&Rr(t,e.child,null,o),t.child.memoizedState=Md(o),t.memoizedState=Ad,a);if(!(t.mode&1))return Ia(e,t,o,null);if(i.data==="$!"){if(s=i.nextSibling&&i.nextSibling.dataset,s)var l=s.dgst;return s=l,a=Error(U(419)),s=fc(a,s,void 0),Ia(e,t,o,s)}if(l=(o&e.childLanes)!==0,ut||l){if(s=Ue,s!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(s.suspendedLanes|o)?0:i,i!==0&&i!==a.retryLane&&(a.retryLane=i,Cn(e,i),qt(s,e,i,-1))}return dh(),s=fc(Error(U(421))),Ia(e,t,o,s)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=L2.bind(null,e),i._reactRetry=t,null):(e=a.treeContext,yt=Yn(i.nextSibling),vt=t,je=!0,Wt=null,e!==null&&(Et[_t++]=vn,Et[_t++]=bn,Et[_t++]=Ms,vn=e.id,bn=e.overflow,Ms=t),t=rh(t,s.children),t.flags|=4096,t)}function wp(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Sd(e.return,t,n)}function pc(e,t,n,s,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=s,a.tail=n,a.tailMode=i)}function Gx(e,t,n){var s=t.pendingProps,i=s.revealOrder,a=s.tail;if(rt(e,t,s.children,n),s=Ne.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wp(e,n,t);else if(e.tag===19)wp(e,n,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}s&=1}if(xe(Ne,s),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Uo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),pc(t,!1,i,n,a);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}pc(t,!0,n,null,a);break;case"together":pc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fo(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function En(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(U(153));if(t.child!==null){for(e=t.child,n=Zn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function j2(e,t,n){switch(t.tag){case 3:Wx(t),Mr();break;case 5:vx(t);break;case 1:ft(t.type)&&Do(t);break;case 4:Xu(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,i=t.memoizedProps.value;xe(Fo,s._currentValue),s._currentValue=i;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(xe(Ne,Ne.current&1),t.flags|=128,null):n&t.child.childLanes?Kx(e,t,n):(xe(Ne,Ne.current&1),e=En(e,t,n),e!==null?e.sibling:null);xe(Ne,Ne.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Gx(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),xe(Ne,Ne.current),s)break;return null;case 22:case 23:return t.lanes=0,Ux(e,t,n)}return En(e,t,n)}var qx,Rd,Yx,Xx;qx=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Rd=function(){};Yx=function(e,t,n,s){var i=e.memoizedProps;if(i!==s){e=t.stateNode,Cs(cn.current);var a=null;switch(n){case"input":i=td(e,i),s=td(e,s),a=[];break;case"select":i=Ee({},i,{value:void 0}),s=Ee({},s,{value:void 0}),a=[];break;case"textarea":i=rd(e,i),s=rd(e,s),a=[];break;default:typeof i.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Lo)}ad(n,s);var o;n=null;for(d in i)if(!s.hasOwnProperty(d)&&i.hasOwnProperty(d)&&i[d]!=null)if(d==="style"){var l=i[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Li.hasOwnProperty(d)?a||(a=[]):(a=a||[]).push(d,null));for(d in s){var c=s[d];if(l=i!=null?i[d]:void 0,s.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(a||(a=[]),a.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(a=a||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Li.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&ye("scroll",e),a||l===c||(a=[])):(a=a||[]).push(d,c))}n&&(a=a||[]).push("style",n);var d=a;(t.updateQueue=d)&&(t.flags|=4)}};Xx=function(e,t,n,s){n!==s&&(t.flags|=4)};function ii(e,t){if(!je)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,s|=i.subtreeFlags&14680064,s|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,s|=i.subtreeFlags,s|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function N2(e,t,n){var s=t.pendingProps;switch(Uu(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return ft(t.type)&&Oo(),Qe(t),null;case 3:return s=t.stateNode,zr(),be(ht),be(nt),Ju(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Oa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wt!==null&&(Vd(Wt),Wt=null))),Rd(e,t),Qe(t),null;case 5:Qu(t);var i=Cs(Gi.current);if(n=t.type,e!==null&&t.stateNode!=null)Yx(e,t,n,s,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(U(166));return Qe(t),null}if(e=Cs(cn.current),Oa(t)){s=t.stateNode,n=t.type;var a=t.memoizedProps;switch(s[an]=t,s[Wi]=a,e=(t.mode&1)!==0,n){case"dialog":ye("cancel",s),ye("close",s);break;case"iframe":case"object":case"embed":ye("load",s);break;case"video":case"audio":for(i=0;i<fi.length;i++)ye(fi[i],s);break;case"source":ye("error",s);break;case"img":case"image":case"link":ye("error",s),ye("load",s);break;case"details":ye("toggle",s);break;case"input":Pf(s,a),ye("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!a.multiple},ye("invalid",s);break;case"textarea":Mf(s,a),ye("invalid",s)}ad(n,a),i=null;for(var o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="children"?typeof l=="string"?s.textContent!==l&&(a.suppressHydrationWarning!==!0&&La(s.textContent,l,e),i=["children",l]):typeof l=="number"&&s.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&La(s.textContent,l,e),i=["children",""+l]):Li.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ye("scroll",s)}switch(n){case"input":Ea(s),Af(s,a,!0);break;case"textarea":Ea(s),Rf(s);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(s.onclick=Lo)}s=i,t.updateQueue=s,s!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Ng(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=o.createElement(n,{is:s.is}):(e=o.createElement(n),n==="select"&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,n),e[an]=t,e[Wi]=s,qx(e,t,!1,!1),t.stateNode=e;e:{switch(o=od(n,s),n){case"dialog":ye("cancel",e),ye("close",e),i=s;break;case"iframe":case"object":case"embed":ye("load",e),i=s;break;case"video":case"audio":for(i=0;i<fi.length;i++)ye(fi[i],e);i=s;break;case"source":ye("error",e),i=s;break;case"img":case"image":case"link":ye("error",e),ye("load",e),i=s;break;case"details":ye("toggle",e),i=s;break;case"input":Pf(e,s),i=td(e,s),ye("invalid",e);break;case"option":i=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},i=Ee({},s,{value:void 0}),ye("invalid",e);break;case"textarea":Mf(e,s),i=rd(e,s),ye("invalid",e);break;default:i=s}ad(n,i),l=i;for(a in l)if(l.hasOwnProperty(a)){var c=l[a];a==="style"?Eg(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Sg(e,c)):a==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Oi(e,c):typeof c=="number"&&Oi(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Li.hasOwnProperty(a)?c!=null&&a==="onScroll"&&ye("scroll",e):c!=null&&_u(e,a,c,o))}switch(n){case"input":Ea(e),Af(e,s,!1);break;case"textarea":Ea(e),Rf(e);break;case"option":s.value!=null&&e.setAttribute("value",""+ss(s.value));break;case"select":e.multiple=!!s.multiple,a=s.value,a!=null?jr(e,!!s.multiple,a,!1):s.defaultValue!=null&&jr(e,!!s.multiple,s.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Lo)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Qe(t),null;case 6:if(e&&t.stateNode!=null)Xx(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(U(166));if(n=Cs(Gi.current),Cs(cn.current),Oa(t)){if(s=t.stateNode,n=t.memoizedProps,s[an]=t,(a=s.nodeValue!==n)&&(e=vt,e!==null))switch(e.tag){case 3:La(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&La(s.nodeValue,n,(e.mode&1)!==0)}a&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[an]=t,t.stateNode=s}return Qe(t),null;case 13:if(be(Ne),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(je&&yt!==null&&t.mode&1&&!(t.flags&128))px(),Mr(),t.flags|=98560,a=!1;else if(a=Oa(t),s!==null&&s.dehydrated!==null){if(e===null){if(!a)throw Error(U(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(U(317));a[an]=t}else Mr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Qe(t),a=!1}else Wt!==null&&(Vd(Wt),Wt=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||Ne.current&1?Ie===0&&(Ie=3):dh())),t.updateQueue!==null&&(t.flags|=4),Qe(t),null);case 4:return zr(),Rd(e,t),e===null&&Ui(t.stateNode.containerInfo),Qe(t),null;case 10:return Gu(t.type._context),Qe(t),null;case 17:return ft(t.type)&&Oo(),Qe(t),null;case 19:if(be(Ne),a=t.memoizedState,a===null)return Qe(t),null;if(s=(t.flags&128)!==0,o=a.rendering,o===null)if(s)ii(a,!1);else{if(Ie!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Uo(e),o!==null){for(t.flags|=128,ii(a,!1),s=o.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)a=n,e=s,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return xe(Ne,Ne.current&1|2),t.child}e=e.sibling}a.tail!==null&&Me()>Or&&(t.flags|=128,s=!0,ii(a,!1),t.lanes=4194304)}else{if(!s)if(e=Uo(o),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ii(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!je)return Qe(t),null}else 2*Me()-a.renderingStartTime>Or&&n!==1073741824&&(t.flags|=128,s=!0,ii(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Me(),t.sibling=null,n=Ne.current,xe(Ne,s?n&1|2:n&1),t):(Qe(t),null);case 22:case 23:return ch(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?xt&1073741824&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),null;case 24:return null;case 25:return null}throw Error(U(156,t.tag))}function S2(e,t){switch(Uu(t),t.tag){case 1:return ft(t.type)&&Oo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zr(),be(ht),be(nt),Ju(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Qu(t),null;case 13:if(be(Ne),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(U(340));Mr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return be(Ne),null;case 4:return zr(),null;case 10:return Gu(t.type._context),null;case 22:case 23:return ch(),null;case 24:return null;default:return null}}var Ba=!1,et=!1,C2=typeof WeakSet=="function"?WeakSet:Set,Z=null;function mr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Te(e,t,s)}else n.current=null}function zd(e,t,n){try{n()}catch(s){Te(e,t,s)}}var kp=!1;function E2(e,t){if(xd=Mo,e=tx(),Vu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,a=s.focusNode;s=s.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,u=0,p=e,f=null;t:for(;;){for(var m;p!==n||i!==0&&p.nodeType!==3||(l=o+i),p!==a||s!==0&&p.nodeType!==3||(c=o+s),p.nodeType===3&&(o+=p.nodeValue.length),(m=p.firstChild)!==null;)f=p,p=m;for(;;){if(p===e)break t;if(f===n&&++d===i&&(l=o),f===a&&++u===s&&(c=o),(m=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(yd={focusedElem:e,selectionRange:n},Mo=!1,Z=t;Z!==null;)if(t=Z,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var v=b.memoizedProps,y=b.memoizedState,g=t.stateNode,x=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:$t(t.type,v),y);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(j){Te(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return b=kp,kp=!1,b}function Si(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&zd(t,n,a)}i=i.next}while(i!==s)}}function gl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Ld(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Qx(e){var t=e.alternate;t!==null&&(e.alternate=null,Qx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[an],delete t[Wi],delete t[wd],delete t[c2],delete t[d2])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Jx(e){return e.tag===5||e.tag===3||e.tag===4}function jp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jx(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.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 Od(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Lo));else if(s!==4&&(e=e.child,e!==null))for(Od(e,t,n),e=e.sibling;e!==null;)Od(e,t,n),e=e.sibling}function Dd(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Dd(e,t,n),e=e.sibling;e!==null;)Dd(e,t,n),e=e.sibling}var We=null,Ut=!1;function On(e,t,n){for(n=n.child;n!==null;)Zx(e,t,n),n=n.sibling}function Zx(e,t,n){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(ll,n)}catch{}switch(n.tag){case 5:et||mr(n,t);case 6:var s=We,i=Ut;We=null,On(e,t,n),We=s,Ut=i,We!==null&&(Ut?(e=We,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):We.removeChild(n.stateNode));break;case 18:We!==null&&(Ut?(e=We,n=n.stateNode,e.nodeType===8?oc(e.parentNode,n):e.nodeType===1&&oc(e,n),Fi(e)):oc(We,n.stateNode));break;case 4:s=We,i=Ut,We=n.stateNode.containerInfo,Ut=!0,On(e,t,n),We=s,Ut=i;break;case 0:case 11:case 14:case 15:if(!et&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){i=s=s.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&zd(n,t,o),i=i.next}while(i!==s)}On(e,t,n);break;case 1:if(!et&&(mr(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(l){Te(n,t,l)}On(e,t,n);break;case 21:On(e,t,n);break;case 22:n.mode&1?(et=(s=et)||n.memoizedState!==null,On(e,t,n),et=s):On(e,t,n);break;default:On(e,t,n)}}function Np(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new C2),t.forEach(function(s){var i=O2.bind(null,e,s);n.has(s)||(n.add(s),s.then(i,i))})}}function Bt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var i=n[s];try{var a=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:We=l.stateNode,Ut=!1;break e;case 3:We=l.stateNode.containerInfo,Ut=!0;break e;case 4:We=l.stateNode.containerInfo,Ut=!0;break e}l=l.return}if(We===null)throw Error(U(160));Zx(a,o,i),We=null,Ut=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(d){Te(i,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)ey(t,e),t=t.sibling}function ey(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Bt(t,e),sn(e),s&4){try{Si(3,e,e.return),gl(3,e)}catch(v){Te(e,e.return,v)}try{Si(5,e,e.return)}catch(v){Te(e,e.return,v)}}break;case 1:Bt(t,e),sn(e),s&512&&n!==null&&mr(n,n.return);break;case 5:if(Bt(t,e),sn(e),s&512&&n!==null&&mr(n,n.return),e.flags&32){var i=e.stateNode;try{Oi(i,"")}catch(v){Te(e,e.return,v)}}if(s&4&&(i=e.stateNode,i!=null)){var a=e.memoizedProps,o=n!==null?n.memoizedProps:a,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&kg(i,a),od(l,o);var d=od(l,a);for(o=0;o<c.length;o+=2){var u=c[o],p=c[o+1];u==="style"?Eg(i,p):u==="dangerouslySetInnerHTML"?Sg(i,p):u==="children"?Oi(i,p):_u(i,u,p,d)}switch(l){case"input":nd(i,a);break;case"textarea":jg(i,a);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!a.multiple;var m=a.value;m!=null?jr(i,!!a.multiple,m,!1):f!==!!a.multiple&&(a.defaultValue!=null?jr(i,!!a.multiple,a.defaultValue,!0):jr(i,!!a.multiple,a.multiple?[]:"",!1))}i[Wi]=a}catch(v){Te(e,e.return,v)}}break;case 6:if(Bt(t,e),sn(e),s&4){if(e.stateNode===null)throw Error(U(162));i=e.stateNode,a=e.memoizedProps;try{i.nodeValue=a}catch(v){Te(e,e.return,v)}}break;case 3:if(Bt(t,e),sn(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Fi(t.containerInfo)}catch(v){Te(e,e.return,v)}break;case 4:Bt(t,e),sn(e);break;case 13:Bt(t,e),sn(e),i=e.child,i.flags&8192&&(a=i.memoizedState!==null,i.stateNode.isHidden=a,!a||i.alternate!==null&&i.alternate.memoizedState!==null||(oh=Me())),s&4&&Np(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(et=(d=et)||u,Bt(t,e),et=d):Bt(t,e),sn(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(Z=e,u=e.child;u!==null;){for(p=Z=u;Z!==null;){switch(f=Z,m=f.child,f.tag){case 0:case 11:case 14:case 15:Si(4,f,f.return);break;case 1:mr(f,f.return);var b=f.stateNode;if(typeof b.componentWillUnmount=="function"){s=f,n=f.return;try{t=s,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(v){Te(s,n,v)}}break;case 5:mr(f,f.return);break;case 22:if(f.memoizedState!==null){Cp(p);continue}}m!==null?(m.return=f,Z=m):Cp(p)}u=u.sibling}e:for(u=null,p=e;;){if(p.tag===5){if(u===null){u=p;try{i=p.stateNode,d?(a=i.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=p.stateNode,c=p.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Cg("display",o))}catch(v){Te(e,e.return,v)}}}else if(p.tag===6){if(u===null)try{p.stateNode.nodeValue=d?"":p.memoizedProps}catch(v){Te(e,e.return,v)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;u===p&&(u=null),p=p.return}u===p&&(u=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Bt(t,e),sn(e),s&4&&Np(e);break;case 21:break;default:Bt(t,e),sn(e)}}function sn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Jx(n)){var s=n;break e}n=n.return}throw Error(U(160))}switch(s.tag){case 5:var i=s.stateNode;s.flags&32&&(Oi(i,""),s.flags&=-33);var a=jp(e);Dd(e,a,i);break;case 3:case 4:var o=s.stateNode.containerInfo,l=jp(e);Od(e,l,o);break;default:throw Error(U(161))}}catch(c){Te(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _2(e,t,n){Z=e,ty(e)}function ty(e,t,n){for(var s=(e.mode&1)!==0;Z!==null;){var i=Z,a=i.child;if(i.tag===22&&s){var o=i.memoizedState!==null||Ba;if(!o){var l=i.alternate,c=l!==null&&l.memoizedState!==null||et;l=Ba;var d=et;if(Ba=o,(et=c)&&!d)for(Z=i;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null?Ep(i):c!==null?(c.return=o,Z=c):Ep(i);for(;a!==null;)Z=a,ty(a),a=a.sibling;Z=i,Ba=l,et=d}Sp(e)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Z=a):Sp(e)}}function Sp(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:et||gl(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!et)if(n===null)s.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:$t(t.type,n.memoizedProps);s.componentDidUpdate(i,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&cp(t,a,s);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}cp(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var p=u.dehydrated;p!==null&&Fi(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(U(163))}et||t.flags&512&&Ld(t)}catch(f){Te(t,t.return,f)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Cp(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ep(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{gl(4,t)}catch(c){Te(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var i=t.return;try{s.componentDidMount()}catch(c){Te(t,i,c)}}var a=t.return;try{Ld(t)}catch(c){Te(t,a,c)}break;case 5:var o=t.return;try{Ld(t)}catch(c){Te(t,o,c)}}}catch(c){Te(t,t.return,c)}if(t===e){Z=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Z=l;break}Z=t.return}}var T2=Math.ceil,Ko=Tn.ReactCurrentDispatcher,ih=Tn.ReactCurrentOwner,Mt=Tn.ReactCurrentBatchConfig,ue=0,Ue=null,ze=null,Ge=0,xt=0,gr=ds(0),Ie=0,Qi=null,zs=0,xl=0,ah=0,Ci=null,dt=null,oh=0,Or=1/0,gn=null,Go=!1,Id=null,Qn=null,Fa=!1,Hn=null,qo=0,Ei=0,Bd=null,po=-1,mo=0;function it(){return ue&6?Me():po!==-1?po:po=Me()}function Jn(e){return e.mode&1?ue&2&&Ge!==0?Ge&-Ge:h2.transition!==null?(mo===0&&(mo=Bg()),mo):(e=pe,e!==0||(e=window.event,e=e===void 0?16:Kg(e.type)),e):1}function qt(e,t,n,s){if(50<Ei)throw Ei=0,Bd=null,Error(U(185));ua(e,n,s),(!(ue&2)||e!==Ue)&&(e===Ue&&(!(ue&2)&&(xl|=n),Ie===4&&$n(e,Ge)),pt(e,s),n===1&&ue===0&&!(t.mode&1)&&(Or=Me()+500,fl&&us()))}function pt(e,t){var n=e.callbackNode;hw(e,t);var s=Ao(e,e===Ue?Ge:0);if(s===0)n!==null&&Of(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Of(n),t===1)e.tag===0?u2(_p.bind(null,e)):ux(_p.bind(null,e)),o2(function(){!(ue&6)&&us()}),n=null;else{switch(Fg(s)){case 1:n=Ru;break;case 4:n=Dg;break;case 16:n=Po;break;case 536870912:n=Ig;break;default:n=Po}n=cy(n,ny.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ny(e,t){if(po=-1,mo=0,ue&6)throw Error(U(327));var n=e.callbackNode;if(_r()&&e.callbackNode!==n)return null;var s=Ao(e,e===Ue?Ge:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=Yo(e,s);else{t=s;var i=ue;ue|=2;var a=ry();(Ue!==e||Ge!==t)&&(gn=null,Or=Me()+500,_s(e,t));do try{M2();break}catch(l){sy(e,l)}while(!0);Ku(),Ko.current=a,ue=i,ze!==null?t=0:(Ue=null,Ge=0,t=Ie)}if(t!==0){if(t===2&&(i=hd(e),i!==0&&(s=i,t=Fd(e,i))),t===1)throw n=Qi,_s(e,0),$n(e,s),pt(e,Me()),n;if(t===6)$n(e,s);else{if(i=e.current.alternate,!(s&30)&&!P2(i)&&(t=Yo(e,s),t===2&&(a=hd(e),a!==0&&(s=a,t=Fd(e,a))),t===1))throw n=Qi,_s(e,0),$n(e,s),pt(e,Me()),n;switch(e.finishedWork=i,e.finishedLanes=s,t){case 0:case 1:throw Error(U(345));case 2:ws(e,dt,gn);break;case 3:if($n(e,s),(s&130023424)===s&&(t=oh+500-Me(),10<t)){if(Ao(e,0)!==0)break;if(i=e.suspendedLanes,(i&s)!==s){it(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=bd(ws.bind(null,e,dt,gn),t);break}ws(e,dt,gn);break;case 4:if($n(e,s),(s&4194240)===s)break;for(t=e.eventTimes,i=-1;0<s;){var o=31-Gt(s);a=1<<o,o=t[o],o>i&&(i=o),s&=~a}if(s=i,s=Me()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*T2(s/1960))-s,10<s){e.timeoutHandle=bd(ws.bind(null,e,dt,gn),s);break}ws(e,dt,gn);break;case 5:ws(e,dt,gn);break;default:throw Error(U(329))}}}return pt(e,Me()),e.callbackNode===n?ny.bind(null,e):null}function Fd(e,t){var n=Ci;return e.current.memoizedState.isDehydrated&&(_s(e,t).flags|=256),e=Yo(e,t),e!==2&&(t=dt,dt=n,t!==null&&Vd(t)),e}function Vd(e){dt===null?dt=e:dt.push.apply(dt,e)}function P2(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var i=n[s],a=i.getSnapshot;i=i.value;try{if(!Yt(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function $n(e,t){for(t&=~ah,t&=~xl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Gt(t),s=1<<n;e[n]=-1,t&=~s}}function _p(e){if(ue&6)throw Error(U(327));_r();var t=Ao(e,0);if(!(t&1))return pt(e,Me()),null;var n=Yo(e,t);if(e.tag!==0&&n===2){var s=hd(e);s!==0&&(t=s,n=Fd(e,s))}if(n===1)throw n=Qi,_s(e,0),$n(e,t),pt(e,Me()),n;if(n===6)throw Error(U(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ws(e,dt,gn),pt(e,Me()),null}function lh(e,t){var n=ue;ue|=1;try{return e(t)}finally{ue=n,ue===0&&(Or=Me()+500,fl&&us())}}function Ls(e){Hn!==null&&Hn.tag===0&&!(ue&6)&&_r();var t=ue;ue|=1;var n=Mt.transition,s=pe;try{if(Mt.transition=null,pe=1,e)return e()}finally{pe=s,Mt.transition=n,ue=t,!(ue&6)&&us()}}function ch(){xt=gr.current,be(gr)}function _s(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,a2(n)),ze!==null)for(n=ze.return;n!==null;){var s=n;switch(Uu(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Oo();break;case 3:zr(),be(ht),be(nt),Ju();break;case 5:Qu(s);break;case 4:zr();break;case 13:be(Ne);break;case 19:be(Ne);break;case 10:Gu(s.type._context);break;case 22:case 23:ch()}n=n.return}if(Ue=e,ze=e=Zn(e.current,null),Ge=xt=t,Ie=0,Qi=null,ah=xl=zs=0,dt=Ci=null,Ss!==null){for(t=0;t<Ss.length;t++)if(n=Ss[t],s=n.interleaved,s!==null){n.interleaved=null;var i=s.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,s.next=o}n.pending=s}Ss=null}return e}function sy(e,t){do{var n=ze;try{if(Ku(),uo.current=Wo,Ho){for(var s=Ce.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Ho=!1}if(Rs=0,$e=De=Ce=null,Ni=!1,qi=0,ih.current=null,n===null||n.return===null){Ie=1,Qi=t,ze=null;break}e:{var a=e,o=n.return,l=n,c=t;if(t=Ge,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,p=u.tag;if(!(u.mode&1)&&(p===0||p===11||p===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=mp(o);if(m!==null){m.flags&=-257,gp(m,o,l,a,t),m.mode&1&&pp(a,d,t),t=m,c=d;var b=t.updateQueue;if(b===null){var v=new Set;v.add(c),t.updateQueue=v}else b.add(c);break e}else{if(!(t&1)){pp(a,d,t),dh();break e}c=Error(U(426))}}else if(je&&l.mode&1){var y=mp(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),gp(y,o,l,a,t),Hu(Lr(c,l));break e}}a=c=Lr(c,l),Ie!==4&&(Ie=2),Ci===null?Ci=[a]:Ci.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var g=Fx(a,c,t);lp(a,g);break e;case 1:l=c;var x=a.type,w=a.stateNode;if(!(a.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Qn===null||!Qn.has(w)))){a.flags|=65536,t&=-t,a.lanes|=t;var j=Vx(a,l,t);lp(a,j);break e}}a=a.return}while(a!==null)}ay(n)}catch(k){t=k,ze===n&&n!==null&&(ze=n=n.return);continue}break}while(!0)}function ry(){var e=Ko.current;return Ko.current=Wo,e===null?Wo:e}function dh(){(Ie===0||Ie===3||Ie===2)&&(Ie=4),Ue===null||!(zs&268435455)&&!(xl&268435455)||$n(Ue,Ge)}function Yo(e,t){var n=ue;ue|=2;var s=ry();(Ue!==e||Ge!==t)&&(gn=null,_s(e,t));do try{A2();break}catch(i){sy(e,i)}while(!0);if(Ku(),ue=n,Ko.current=s,ze!==null)throw Error(U(261));return Ue=null,Ge=0,Ie}function A2(){for(;ze!==null;)iy(ze)}function M2(){for(;ze!==null&&!sw();)iy(ze)}function iy(e){var t=ly(e.alternate,e,xt);e.memoizedProps=e.pendingProps,t===null?ay(e):ze=t,ih.current=null}function ay(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=S2(n,t),n!==null){n.flags&=32767,ze=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ie=6,ze=null;return}}else if(n=N2(n,t,xt),n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);Ie===0&&(Ie=5)}function ws(e,t,n){var s=pe,i=Mt.transition;try{Mt.transition=null,pe=1,R2(e,t,n,s)}finally{Mt.transition=i,pe=s}return null}function R2(e,t,n,s){do _r();while(Hn!==null);if(ue&6)throw Error(U(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(U(177));e.callbackNode=null,e.callbackPriority=0;var a=n.lanes|n.childLanes;if(fw(e,a),e===Ue&&(ze=Ue=null,Ge=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Fa||(Fa=!0,cy(Po,function(){return _r(),null})),a=(n.flags&15990)!==0,n.subtreeFlags&15990||a){a=Mt.transition,Mt.transition=null;var o=pe;pe=1;var l=ue;ue|=4,ih.current=null,E2(e,n),ey(n,e),Zw(yd),Mo=!!xd,yd=xd=null,e.current=n,_2(n),rw(),ue=l,pe=o,Mt.transition=a}else e.current=n;if(Fa&&(Fa=!1,Hn=e,qo=i),a=e.pendingLanes,a===0&&(Qn=null),ow(n.stateNode),pt(e,Me()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],s(i.value,{componentStack:i.stack,digest:i.digest});if(Go)throw Go=!1,e=Id,Id=null,e;return qo&1&&e.tag!==0&&_r(),a=e.pendingLanes,a&1?e===Bd?Ei++:(Ei=0,Bd=e):Ei=0,us(),null}function _r(){if(Hn!==null){var e=Fg(qo),t=Mt.transition,n=pe;try{if(Mt.transition=null,pe=16>e?16:e,Hn===null)var s=!1;else{if(e=Hn,Hn=null,qo=0,ue&6)throw Error(U(331));var i=ue;for(ue|=4,Z=e.current;Z!==null;){var a=Z,o=a.child;if(Z.flags&16){var l=a.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Z=d;Z!==null;){var u=Z;switch(u.tag){case 0:case 11:case 15:Si(8,u,a)}var p=u.child;if(p!==null)p.return=u,Z=p;else for(;Z!==null;){u=Z;var f=u.sibling,m=u.return;if(Qx(u),u===d){Z=null;break}if(f!==null){f.return=m,Z=f;break}Z=m}}}var b=a.alternate;if(b!==null){var v=b.child;if(v!==null){b.child=null;do{var y=v.sibling;v.sibling=null,v=y}while(v!==null)}}Z=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,Z=o;else e:for(;Z!==null;){if(a=Z,a.flags&2048)switch(a.tag){case 0:case 11:case 15:Si(9,a,a.return)}var g=a.sibling;if(g!==null){g.return=a.return,Z=g;break e}Z=a.return}}var x=e.current;for(Z=x;Z!==null;){o=Z;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,Z=w;else e:for(o=x;Z!==null;){if(l=Z,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:gl(9,l)}}catch(k){Te(l,l.return,k)}if(l===o){Z=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,Z=j;break e}Z=l.return}}if(ue=i,us(),ln&&typeof ln.onPostCommitFiberRoot=="function")try{ln.onPostCommitFiberRoot(ll,e)}catch{}s=!0}return s}finally{pe=n,Mt.transition=t}}return!1}function Tp(e,t,n){t=Lr(n,t),t=Fx(e,t,1),e=Xn(e,t,1),t=it(),e!==null&&(ua(e,1,t),pt(e,t))}function Te(e,t,n){if(e.tag===3)Tp(e,e,n);else for(;t!==null;){if(t.tag===3){Tp(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Qn===null||!Qn.has(s))){e=Lr(n,e),e=Vx(t,e,1),t=Xn(t,e,1),e=it(),t!==null&&(ua(t,1,e),pt(t,e));break}}t=t.return}}function z2(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=it(),e.pingedLanes|=e.suspendedLanes&n,Ue===e&&(Ge&n)===n&&(Ie===4||Ie===3&&(Ge&130023424)===Ge&&500>Me()-oh?_s(e,0):ah|=n),pt(e,t)}function oy(e,t){t===0&&(e.mode&1?(t=Pa,Pa<<=1,!(Pa&130023424)&&(Pa=4194304)):t=1);var n=it();e=Cn(e,t),e!==null&&(ua(e,t,n),pt(e,n))}function L2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),oy(e,n)}function O2(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(U(314))}s!==null&&s.delete(t),oy(e,n)}var ly;ly=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ht.current)ut=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ut=!1,j2(e,t,n);ut=!!(e.flags&131072)}else ut=!1,je&&t.flags&1048576&&hx(t,Bo,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;fo(e,t),e=t.pendingProps;var i=Ar(t,nt.current);Er(t,n),i=eh(null,t,s,e,i,n);var a=th();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ft(s)?(a=!0,Do(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Yu(t),i.updater=ml,t.stateNode=i,i._reactInternals=t,Ed(t,s,e,n),t=Pd(null,t,s,!0,a,n)):(t.tag=0,je&&a&&$u(t),rt(null,t,i,n),t=t.child),t;case 16:s=t.elementType;e:{switch(fo(e,t),e=t.pendingProps,i=s._init,s=i(s._payload),t.type=s,i=t.tag=I2(s),e=$t(s,e),i){case 0:t=Td(null,t,s,e,n);break e;case 1:t=vp(null,t,s,e,n);break e;case 11:t=xp(null,t,s,e,n);break e;case 14:t=yp(null,t,s,$t(s.type,e),n);break e}throw Error(U(306,s,""))}return t;case 0:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),Td(e,t,s,i,n);case 1:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),vp(e,t,s,i,n);case 3:e:{if(Wx(t),e===null)throw Error(U(387));s=t.pendingProps,a=t.memoizedState,i=a.element,yx(e,t),$o(t,s,null,n);var o=t.memoizedState;if(s=o.element,a.isDehydrated)if(a={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Lr(Error(U(423)),t),t=bp(e,t,s,n,i);break e}else if(s!==i){i=Lr(Error(U(424)),t),t=bp(e,t,s,n,i);break e}else for(yt=Yn(t.stateNode.containerInfo.firstChild),vt=t,je=!0,Wt=null,n=gx(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Mr(),s===i){t=En(e,t,n);break e}rt(e,t,s,n)}t=t.child}return t;case 5:return vx(t),e===null&&Nd(t),s=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,vd(s,i)?o=null:a!==null&&vd(s,a)&&(t.flags|=32),Hx(e,t),rt(e,t,o,n),t.child;case 6:return e===null&&Nd(t),null;case 13:return Kx(e,t,n);case 4:return Xu(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Rr(t,null,s,n):rt(e,t,s,n),t.child;case 11:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),xp(e,t,s,i,n);case 7:return rt(e,t,t.pendingProps,n),t.child;case 8:return rt(e,t,t.pendingProps.children,n),t.child;case 12:return rt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,xe(Fo,s._currentValue),s._currentValue=o,a!==null)if(Yt(a.value,o)){if(a.children===i.children&&!ht.current){t=En(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===s){if(a.tag===1){c=wn(-1,n&-n),c.tag=2;var d=a.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Sd(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(U(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Sd(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}rt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,s=t.pendingProps.children,Er(t,n),i=Rt(i),s=s(i),t.flags|=1,rt(e,t,s,n),t.child;case 14:return s=t.type,i=$t(s,t.pendingProps),i=$t(s.type,i),yp(e,t,s,i,n);case 15:return $x(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),fo(e,t),t.tag=1,ft(s)?(e=!0,Do(t)):e=!1,Er(t,n),Bx(t,s,i),Ed(t,s,i,n),Pd(null,t,s,!0,e,n);case 19:return Gx(e,t,n);case 22:return Ux(e,t,n)}throw Error(U(156,t.tag))};function cy(e,t){return Og(e,t)}function D2(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,n,s){return new D2(e,t,n,s)}function uh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function I2(e){if(typeof e=="function")return uh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pu)return 11;if(e===Au)return 14}return 2}function Zn(e,t){var n=e.alternate;return n===null?(n=Pt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function go(e,t,n,s,i,a){var o=2;if(s=e,typeof e=="function")uh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ar:return Ts(n.children,i,a,t);case Tu:o=8,i|=8;break;case Qc:return e=Pt(12,n,t,i|2),e.elementType=Qc,e.lanes=a,e;case Jc:return e=Pt(13,n,t,i),e.elementType=Jc,e.lanes=a,e;case Zc:return e=Pt(19,n,t,i),e.elementType=Zc,e.lanes=a,e;case vg:return yl(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xg:o=10;break e;case yg:o=9;break e;case Pu:o=11;break e;case Au:o=14;break e;case Bn:o=16,s=null;break e}throw Error(U(130,e==null?e:typeof e,""))}return t=Pt(o,n,t,i),t.elementType=e,t.type=s,t.lanes=a,t}function Ts(e,t,n,s){return e=Pt(7,e,s,t),e.lanes=n,e}function yl(e,t,n,s){return e=Pt(22,e,s,t),e.elementType=vg,e.lanes=n,e.stateNode={isHidden:!1},e}function mc(e,t,n){return e=Pt(6,e,null,t),e.lanes=n,e}function gc(e,t,n){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function B2(e,t,n,s,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xl(0),this.expirationTimes=Xl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xl(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function hh(e,t,n,s,i,a,o,l,c){return e=new B2(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=Pt(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yu(a),e}function F2(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ir,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function dy(e){if(!e)return rs;e=e._reactInternals;e:{if($s(e)!==e||e.tag!==1)throw Error(U(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ft(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(U(171))}if(e.tag===1){var n=e.type;if(ft(n))return dx(e,n,t)}return t}function uy(e,t,n,s,i,a,o,l,c){return e=hh(n,s,!0,e,i,a,o,l,c),e.context=dy(null),n=e.current,s=it(),i=Jn(n),a=wn(s,i),a.callback=t??null,Xn(n,a,i),e.current.lanes=i,ua(e,i,s),pt(e,s),e}function vl(e,t,n,s){var i=t.current,a=it(),o=Jn(i);return n=dy(n),t.context===null?t.context=n:t.pendingContext=n,t=wn(a,o),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Xn(i,t,o),e!==null&&(qt(e,i,o,a),co(e,i,o)),o}function Xo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Pp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fh(e,t){Pp(e,t),(e=e.alternate)&&Pp(e,t)}function V2(){return null}var hy=typeof reportError=="function"?reportError:function(e){console.error(e)};function ph(e){this._internalRoot=e}bl.prototype.render=ph.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(U(409));vl(e,t,null,null)};bl.prototype.unmount=ph.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ls(function(){vl(null,e,null,null)}),t[Sn]=null}};function bl(e){this._internalRoot=e}bl.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ug();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vn.length&&t!==0&&t<Vn[n].priority;n++);Vn.splice(n,0,e),n===0&&Wg(e)}};function mh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function wl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ap(){}function $2(e,t,n,s,i){if(i){if(typeof s=="function"){var a=s;s=function(){var d=Xo(o);a.call(d)}}var o=uy(t,s,e,0,null,!1,!1,"",Ap);return e._reactRootContainer=o,e[Sn]=o.current,Ui(e.nodeType===8?e.parentNode:e),Ls(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof s=="function"){var l=s;s=function(){var d=Xo(c);l.call(d)}}var c=hh(e,0,!1,null,null,!1,!1,"",Ap);return e._reactRootContainer=c,e[Sn]=c.current,Ui(e.nodeType===8?e.parentNode:e),Ls(function(){vl(t,c,n,s)}),c}function kl(e,t,n,s,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i=="function"){var l=i;i=function(){var c=Xo(o);l.call(c)}}vl(t,o,e,i)}else o=$2(n,t,e,i,s);return Xo(o)}Vg=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=hi(t.pendingLanes);n!==0&&(zu(t,n|1),pt(t,Me()),!(ue&6)&&(Or=Me()+500,us()))}break;case 13:Ls(function(){var s=Cn(e,1);if(s!==null){var i=it();qt(s,e,1,i)}}),fh(e,1)}};Lu=function(e){if(e.tag===13){var t=Cn(e,134217728);if(t!==null){var n=it();qt(t,e,134217728,n)}fh(e,134217728)}};$g=function(e){if(e.tag===13){var t=Jn(e),n=Cn(e,t);if(n!==null){var s=it();qt(n,e,t,s)}fh(e,t)}};Ug=function(){return pe};Hg=function(e,t){var n=pe;try{return pe=e,t()}finally{pe=n}};cd=function(e,t,n){switch(t){case"input":if(nd(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var i=hl(s);if(!i)throw Error(U(90));wg(s),nd(s,i)}}}break;case"textarea":jg(e,n);break;case"select":t=n.value,t!=null&&jr(e,!!n.multiple,t,!1)}};Pg=lh;Ag=Ls;var U2={usingClientEntryPoint:!1,Events:[fa,dr,hl,_g,Tg,lh]},ai={findFiberByHostInstance:Ns,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},H2={bundleType:ai.bundleType,version:ai.version,rendererPackageName:ai.rendererPackageName,rendererConfig:ai.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Tn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zg(e),e===null?null:e.stateNode},findFiberByHostInstance:ai.findFiberByHostInstance||V2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Va=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Va.isDisabled&&Va.supportsFiber)try{ll=Va.inject(H2),ln=Va}catch{}}jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U2;jt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mh(t))throw Error(U(200));return F2(e,t,null,n)};jt.createRoot=function(e,t){if(!mh(e))throw Error(U(299));var n=!1,s="",i=hy;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=hh(e,1,!1,null,null,n,!1,s,i),e[Sn]=t.current,Ui(e.nodeType===8?e.parentNode:e),new ph(t)};jt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(U(188)):(e=Object.keys(e).join(","),Error(U(268,e)));return e=zg(t),e=e===null?null:e.stateNode,e};jt.flushSync=function(e){return Ls(e)};jt.hydrate=function(e,t,n){if(!wl(t))throw Error(U(200));return kl(null,e,t,!0,n)};jt.hydrateRoot=function(e,t,n){if(!mh(e))throw Error(U(405));var s=n!=null&&n.hydratedSources||null,i=!1,a="",o=hy;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=uy(t,null,e,1,n??null,i,!1,a,o),e[Sn]=t.current,Ui(e),s)for(e=0;e<s.length;e++)n=s[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new bl(t)};jt.render=function(e,t,n){if(!wl(t))throw Error(U(200));return kl(null,e,t,!1,n)};jt.unmountComponentAtNode=function(e){if(!wl(e))throw Error(U(40));return e._reactRootContainer?(Ls(function(){kl(null,null,e,!1,function(){e._reactRootContainer=null,e[Sn]=null})}),!0):!1};jt.unstable_batchedUpdates=lh;jt.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!wl(n))throw Error(U(200));if(e==null||e._reactInternals===void 0)throw Error(U(38));return kl(e,t,n,!1,s)};jt.version="18.3.1-next-f1338f8080-20240426";function fy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fy)}catch(e){console.error(e)}}fy(),fg.exports=jt;var gh=fg.exports;const py=tg(gh);var my,Mp=gh;my=Mp.createRoot,Mp.hydrateRoot;/**
|
|
40
|
+
`+a.stack}return{value:e,source:t,stack:i,digest:null}}function fc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function _d(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var b2=typeof WeakMap=="function"?WeakMap:Map;function Fx(e,t,n){n=wn(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Go||(Go=!0,Id=s),_d(e,t)},n}function Vx(e,t,n){n=wn(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var i=t.value;n.payload=function(){return s(i)},n.callback=function(){_d(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){_d(e,t),typeof s!="function"&&(Qn===null?Qn=new Set([this]):Qn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function pp(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new b2;var i=new Set;s.set(t,i)}else i=s.get(t),i===void 0&&(i=new Set,s.set(t,i));i.has(n)||(i.add(n),e=z2.bind(null,e,t,n),t.then(e,e))}function mp(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function gp(e,t,n,s,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=wn(-1,1),t.tag=2,Xn(n,t,1))),n.lanes|=1),e)}var w2=Tn.ReactCurrentOwner,ut=!1;function rt(e,t,n,s){t.child=e===null?gx(t,null,n,s):Rr(t,e.child,n,s)}function xp(e,t,n,s,i){n=n.render;var a=t.ref;return Er(t,i),s=eh(e,t,n,s,a,i),n=th(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,En(e,t,i)):(je&&n&&$u(t),t.flags|=1,rt(e,t,s,i),t.child)}function yp(e,t,n,s,i){if(e===null){var a=n.type;return typeof a=="function"&&!uh(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,$x(e,t,a,s,i)):(e=go(n.type,null,s,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&i)){var o=a.memoizedProps;if(n=n.compare,n=n!==null?n:$i,n(o,s)&&e.ref===t.ref)return En(e,t,i)}return t.flags|=1,e=Zn(a,s),e.ref=t.ref,e.return=t,t.child=e}function $x(e,t,n,s,i){if(e!==null){var a=e.memoizedProps;if($i(a,s)&&e.ref===t.ref)if(ut=!1,t.pendingProps=s=a,(e.lanes&i)!==0)e.flags&131072&&(ut=!0);else return t.lanes=e.lanes,En(e,t,i)}return Td(e,t,n,s,i)}function Ux(e,t,n){var s=t.pendingProps,i=s.children,a=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xe(gr,xt),xt|=n;else{if(!(n&1073741824))return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xe(gr,xt),xt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=a!==null?a.baseLanes:n,xe(gr,xt),xt|=s}else a!==null?(s=a.baseLanes|n,t.memoizedState=null):s=n,xe(gr,xt),xt|=s;return rt(e,t,i,n),t.child}function Hx(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Td(e,t,n,s,i){var a=ft(n)?As:nt.current;return a=Ar(t,a),Er(t,i),n=eh(e,t,n,s,a,i),s=th(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,En(e,t,i)):(je&&s&&$u(t),t.flags|=1,rt(e,t,n,i),t.child)}function vp(e,t,n,s,i){if(ft(n)){var a=!0;Do(t)}else a=!1;if(Er(t,i),t.stateNode===null)fo(e,t),Bx(t,n,s),Ed(t,n,s,i),s=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=Rt(d):(d=ft(n)?As:nt.current,d=Ar(t,d));var u=n.getDerivedStateFromProps,p=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";p||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==s||c!==d)&&fp(t,o,s,d),Fn=!1;var f=t.memoizedState;o.state=f,$o(t,s,o,i),c=t.memoizedState,l!==s||f!==c||ht.current||Fn?(typeof u=="function"&&(Cd(t,n,u,s),c=t.memoizedState),(l=Fn||hp(t,n,l,s,f,c,d))?(p||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=s,t.memoizedState=c),o.props=s,o.state=c,o.context=d,s=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,yx(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:$t(t.type,l),o.props=d,p=t.pendingProps,f=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Rt(c):(c=ft(n)?As:nt.current,c=Ar(t,c));var m=n.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==p||f!==c)&&fp(t,o,s,c),Fn=!1,f=t.memoizedState,o.state=f,$o(t,s,o,i);var b=t.memoizedState;l!==p||f!==b||ht.current||Fn?(typeof m=="function"&&(Cd(t,n,m,s),b=t.memoizedState),(d=Fn||hp(t,n,d,s,f,b,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,b,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,b,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=b),o.props=s,o.state=b,o.context=c,s=d):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return Pd(e,t,n,s,a,i)}function Pd(e,t,n,s,i,a){Hx(e,t);var o=(t.flags&128)!==0;if(!s&&!o)return i&&rp(t,n,!1),En(e,t,a);s=t.stateNode,w2.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&o?(t.child=Rr(t,e.child,null,a),t.child=Rr(t,null,l,a)):rt(e,t,l,a),t.memoizedState=s.state,i&&rp(t,n,!0),t.child}function Wx(e){var t=e.stateNode;t.pendingContext?sp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&sp(e,t.context,!1),Xu(e,t.containerInfo)}function bp(e,t,n,s,i){return Mr(),Hu(i),t.flags|=256,rt(e,t,n,s),t.child}var Ad={dehydrated:null,treeContext:null,retryLane:0};function Md(e){return{baseLanes:e,cachePool:null,transitions:null}}function Kx(e,t,n){var s=t.pendingProps,i=Ne.current,a=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),xe(Ne,i&1),e===null)return Nd(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=s.children,e=s.fallback,a?(s=t.mode,a=t.child,o={mode:"hidden",children:o},!(s&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=yl(o,s,0,null),e=Ts(e,s,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Md(n),t.memoizedState=Ad,e):rh(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return k2(e,t,o,s,l,i,n);if(a){a=s.fallback,o=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&t.child!==i?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Zn(i,c),s.subtreeFlags=i.subtreeFlags&14680064),l!==null?a=Zn(l,a):(a=Ts(a,o,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,s=a,a=t.child,o=e.child.memoizedState,o=o===null?Md(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ad,s}return a=e.child,e=a.sibling,s=Zn(a,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function rh(e,t){return t=yl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ia(e,t,n,s){return s!==null&&Hu(s),Rr(t,e.child,null,n),e=rh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function k2(e,t,n,s,i,a,o){if(n)return t.flags&256?(t.flags&=-257,s=fc(Error(U(422))),Ia(e,t,o,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=s.fallback,i=t.mode,s=yl({mode:"visible",children:s.children},i,0,null),a=Ts(a,i,o,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,t.mode&1&&Rr(t,e.child,null,o),t.child.memoizedState=Md(o),t.memoizedState=Ad,a);if(!(t.mode&1))return Ia(e,t,o,null);if(i.data==="$!"){if(s=i.nextSibling&&i.nextSibling.dataset,s)var l=s.dgst;return s=l,a=Error(U(419)),s=fc(a,s,void 0),Ia(e,t,o,s)}if(l=(o&e.childLanes)!==0,ut||l){if(s=Ue,s!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(s.suspendedLanes|o)?0:i,i!==0&&i!==a.retryLane&&(a.retryLane=i,Cn(e,i),qt(s,e,i,-1))}return dh(),s=fc(Error(U(421))),Ia(e,t,o,s)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=L2.bind(null,e),i._reactRetry=t,null):(e=a.treeContext,yt=Yn(i.nextSibling),vt=t,je=!0,Wt=null,e!==null&&(Et[_t++]=vn,Et[_t++]=bn,Et[_t++]=Ms,vn=e.id,bn=e.overflow,Ms=t),t=rh(t,s.children),t.flags|=4096,t)}function wp(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Sd(e.return,t,n)}function pc(e,t,n,s,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=s,a.tail=n,a.tailMode=i)}function Gx(e,t,n){var s=t.pendingProps,i=s.revealOrder,a=s.tail;if(rt(e,t,s.children,n),s=Ne.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wp(e,n,t);else if(e.tag===19)wp(e,n,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}s&=1}if(xe(Ne,s),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Uo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),pc(t,!1,i,n,a);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}pc(t,!0,n,null,a);break;case"together":pc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fo(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function En(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(U(153));if(t.child!==null){for(e=t.child,n=Zn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function j2(e,t,n){switch(t.tag){case 3:Wx(t),Mr();break;case 5:vx(t);break;case 1:ft(t.type)&&Do(t);break;case 4:Xu(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,i=t.memoizedProps.value;xe(Fo,s._currentValue),s._currentValue=i;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(xe(Ne,Ne.current&1),t.flags|=128,null):n&t.child.childLanes?Kx(e,t,n):(xe(Ne,Ne.current&1),e=En(e,t,n),e!==null?e.sibling:null);xe(Ne,Ne.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Gx(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),xe(Ne,Ne.current),s)break;return null;case 22:case 23:return t.lanes=0,Ux(e,t,n)}return En(e,t,n)}var qx,Rd,Yx,Xx;qx=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Rd=function(){};Yx=function(e,t,n,s){var i=e.memoizedProps;if(i!==s){e=t.stateNode,Cs(cn.current);var a=null;switch(n){case"input":i=td(e,i),s=td(e,s),a=[];break;case"select":i=Ee({},i,{value:void 0}),s=Ee({},s,{value:void 0}),a=[];break;case"textarea":i=rd(e,i),s=rd(e,s),a=[];break;default:typeof i.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Lo)}ad(n,s);var o;n=null;for(d in i)if(!s.hasOwnProperty(d)&&i.hasOwnProperty(d)&&i[d]!=null)if(d==="style"){var l=i[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Li.hasOwnProperty(d)?a||(a=[]):(a=a||[]).push(d,null));for(d in s){var c=s[d];if(l=i!=null?i[d]:void 0,s.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(a||(a=[]),a.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(a=a||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Li.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&ye("scroll",e),a||l===c||(a=[])):(a=a||[]).push(d,c))}n&&(a=a||[]).push("style",n);var d=a;(t.updateQueue=d)&&(t.flags|=4)}};Xx=function(e,t,n,s){n!==s&&(t.flags|=4)};function ii(e,t){if(!je)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,s|=i.subtreeFlags&14680064,s|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,s|=i.subtreeFlags,s|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function N2(e,t,n){var s=t.pendingProps;switch(Uu(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return ft(t.type)&&Oo(),Qe(t),null;case 3:return s=t.stateNode,zr(),be(ht),be(nt),Ju(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Oa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wt!==null&&(Vd(Wt),Wt=null))),Rd(e,t),Qe(t),null;case 5:Qu(t);var i=Cs(Gi.current);if(n=t.type,e!==null&&t.stateNode!=null)Yx(e,t,n,s,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(U(166));return Qe(t),null}if(e=Cs(cn.current),Oa(t)){s=t.stateNode,n=t.type;var a=t.memoizedProps;switch(s[an]=t,s[Wi]=a,e=(t.mode&1)!==0,n){case"dialog":ye("cancel",s),ye("close",s);break;case"iframe":case"object":case"embed":ye("load",s);break;case"video":case"audio":for(i=0;i<fi.length;i++)ye(fi[i],s);break;case"source":ye("error",s);break;case"img":case"image":case"link":ye("error",s),ye("load",s);break;case"details":ye("toggle",s);break;case"input":Pf(s,a),ye("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!a.multiple},ye("invalid",s);break;case"textarea":Mf(s,a),ye("invalid",s)}ad(n,a),i=null;for(var o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="children"?typeof l=="string"?s.textContent!==l&&(a.suppressHydrationWarning!==!0&&La(s.textContent,l,e),i=["children",l]):typeof l=="number"&&s.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&La(s.textContent,l,e),i=["children",""+l]):Li.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ye("scroll",s)}switch(n){case"input":Ea(s),Af(s,a,!0);break;case"textarea":Ea(s),Rf(s);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(s.onclick=Lo)}s=i,t.updateQueue=s,s!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Ng(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=o.createElement(n,{is:s.is}):(e=o.createElement(n),n==="select"&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,n),e[an]=t,e[Wi]=s,qx(e,t,!1,!1),t.stateNode=e;e:{switch(o=od(n,s),n){case"dialog":ye("cancel",e),ye("close",e),i=s;break;case"iframe":case"object":case"embed":ye("load",e),i=s;break;case"video":case"audio":for(i=0;i<fi.length;i++)ye(fi[i],e);i=s;break;case"source":ye("error",e),i=s;break;case"img":case"image":case"link":ye("error",e),ye("load",e),i=s;break;case"details":ye("toggle",e),i=s;break;case"input":Pf(e,s),i=td(e,s),ye("invalid",e);break;case"option":i=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},i=Ee({},s,{value:void 0}),ye("invalid",e);break;case"textarea":Mf(e,s),i=rd(e,s),ye("invalid",e);break;default:i=s}ad(n,i),l=i;for(a in l)if(l.hasOwnProperty(a)){var c=l[a];a==="style"?Eg(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Sg(e,c)):a==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Oi(e,c):typeof c=="number"&&Oi(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Li.hasOwnProperty(a)?c!=null&&a==="onScroll"&&ye("scroll",e):c!=null&&_u(e,a,c,o))}switch(n){case"input":Ea(e),Af(e,s,!1);break;case"textarea":Ea(e),Rf(e);break;case"option":s.value!=null&&e.setAttribute("value",""+ss(s.value));break;case"select":e.multiple=!!s.multiple,a=s.value,a!=null?jr(e,!!s.multiple,a,!1):s.defaultValue!=null&&jr(e,!!s.multiple,s.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Lo)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Qe(t),null;case 6:if(e&&t.stateNode!=null)Xx(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(U(166));if(n=Cs(Gi.current),Cs(cn.current),Oa(t)){if(s=t.stateNode,n=t.memoizedProps,s[an]=t,(a=s.nodeValue!==n)&&(e=vt,e!==null))switch(e.tag){case 3:La(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&La(s.nodeValue,n,(e.mode&1)!==0)}a&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[an]=t,t.stateNode=s}return Qe(t),null;case 13:if(be(Ne),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(je&&yt!==null&&t.mode&1&&!(t.flags&128))px(),Mr(),t.flags|=98560,a=!1;else if(a=Oa(t),s!==null&&s.dehydrated!==null){if(e===null){if(!a)throw Error(U(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(U(317));a[an]=t}else Mr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Qe(t),a=!1}else Wt!==null&&(Vd(Wt),Wt=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||Ne.current&1?Ie===0&&(Ie=3):dh())),t.updateQueue!==null&&(t.flags|=4),Qe(t),null);case 4:return zr(),Rd(e,t),e===null&&Ui(t.stateNode.containerInfo),Qe(t),null;case 10:return Gu(t.type._context),Qe(t),null;case 17:return ft(t.type)&&Oo(),Qe(t),null;case 19:if(be(Ne),a=t.memoizedState,a===null)return Qe(t),null;if(s=(t.flags&128)!==0,o=a.rendering,o===null)if(s)ii(a,!1);else{if(Ie!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Uo(e),o!==null){for(t.flags|=128,ii(a,!1),s=o.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)a=n,e=s,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return xe(Ne,Ne.current&1|2),t.child}e=e.sibling}a.tail!==null&&Me()>Or&&(t.flags|=128,s=!0,ii(a,!1),t.lanes=4194304)}else{if(!s)if(e=Uo(o),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ii(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!je)return Qe(t),null}else 2*Me()-a.renderingStartTime>Or&&n!==1073741824&&(t.flags|=128,s=!0,ii(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Me(),t.sibling=null,n=Ne.current,xe(Ne,s?n&1|2:n&1),t):(Qe(t),null);case 22:case 23:return ch(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?xt&1073741824&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),null;case 24:return null;case 25:return null}throw Error(U(156,t.tag))}function S2(e,t){switch(Uu(t),t.tag){case 1:return ft(t.type)&&Oo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zr(),be(ht),be(nt),Ju(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Qu(t),null;case 13:if(be(Ne),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(U(340));Mr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return be(Ne),null;case 4:return zr(),null;case 10:return Gu(t.type._context),null;case 22:case 23:return ch(),null;case 24:return null;default:return null}}var Ba=!1,et=!1,C2=typeof WeakSet=="function"?WeakSet:Set,Z=null;function mr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Te(e,t,s)}else n.current=null}function zd(e,t,n){try{n()}catch(s){Te(e,t,s)}}var kp=!1;function E2(e,t){if(xd=Mo,e=tx(),Vu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,a=s.focusNode;s=s.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,u=0,p=e,f=null;t:for(;;){for(var m;p!==n||i!==0&&p.nodeType!==3||(l=o+i),p!==a||s!==0&&p.nodeType!==3||(c=o+s),p.nodeType===3&&(o+=p.nodeValue.length),(m=p.firstChild)!==null;)f=p,p=m;for(;;){if(p===e)break t;if(f===n&&++d===i&&(l=o),f===a&&++u===s&&(c=o),(m=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(yd={focusedElem:e,selectionRange:n},Mo=!1,Z=t;Z!==null;)if(t=Z,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var y=b.memoizedProps,v=b.memoizedState,g=t.stateNode,x=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:$t(t.type,y),v);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(j){Te(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return b=kp,kp=!1,b}function Si(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&zd(t,n,a)}i=i.next}while(i!==s)}}function gl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Ld(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Qx(e){var t=e.alternate;t!==null&&(e.alternate=null,Qx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[an],delete t[Wi],delete t[wd],delete t[c2],delete t[d2])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Jx(e){return e.tag===5||e.tag===3||e.tag===4}function jp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jx(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.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 Od(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Lo));else if(s!==4&&(e=e.child,e!==null))for(Od(e,t,n),e=e.sibling;e!==null;)Od(e,t,n),e=e.sibling}function Dd(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Dd(e,t,n),e=e.sibling;e!==null;)Dd(e,t,n),e=e.sibling}var We=null,Ut=!1;function On(e,t,n){for(n=n.child;n!==null;)Zx(e,t,n),n=n.sibling}function Zx(e,t,n){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(ll,n)}catch{}switch(n.tag){case 5:et||mr(n,t);case 6:var s=We,i=Ut;We=null,On(e,t,n),We=s,Ut=i,We!==null&&(Ut?(e=We,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):We.removeChild(n.stateNode));break;case 18:We!==null&&(Ut?(e=We,n=n.stateNode,e.nodeType===8?oc(e.parentNode,n):e.nodeType===1&&oc(e,n),Fi(e)):oc(We,n.stateNode));break;case 4:s=We,i=Ut,We=n.stateNode.containerInfo,Ut=!0,On(e,t,n),We=s,Ut=i;break;case 0:case 11:case 14:case 15:if(!et&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){i=s=s.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&zd(n,t,o),i=i.next}while(i!==s)}On(e,t,n);break;case 1:if(!et&&(mr(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(l){Te(n,t,l)}On(e,t,n);break;case 21:On(e,t,n);break;case 22:n.mode&1?(et=(s=et)||n.memoizedState!==null,On(e,t,n),et=s):On(e,t,n);break;default:On(e,t,n)}}function Np(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new C2),t.forEach(function(s){var i=O2.bind(null,e,s);n.has(s)||(n.add(s),s.then(i,i))})}}function Bt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var i=n[s];try{var a=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:We=l.stateNode,Ut=!1;break e;case 3:We=l.stateNode.containerInfo,Ut=!0;break e;case 4:We=l.stateNode.containerInfo,Ut=!0;break e}l=l.return}if(We===null)throw Error(U(160));Zx(a,o,i),We=null,Ut=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(d){Te(i,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)ey(t,e),t=t.sibling}function ey(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Bt(t,e),sn(e),s&4){try{Si(3,e,e.return),gl(3,e)}catch(y){Te(e,e.return,y)}try{Si(5,e,e.return)}catch(y){Te(e,e.return,y)}}break;case 1:Bt(t,e),sn(e),s&512&&n!==null&&mr(n,n.return);break;case 5:if(Bt(t,e),sn(e),s&512&&n!==null&&mr(n,n.return),e.flags&32){var i=e.stateNode;try{Oi(i,"")}catch(y){Te(e,e.return,y)}}if(s&4&&(i=e.stateNode,i!=null)){var a=e.memoizedProps,o=n!==null?n.memoizedProps:a,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&kg(i,a),od(l,o);var d=od(l,a);for(o=0;o<c.length;o+=2){var u=c[o],p=c[o+1];u==="style"?Eg(i,p):u==="dangerouslySetInnerHTML"?Sg(i,p):u==="children"?Oi(i,p):_u(i,u,p,d)}switch(l){case"input":nd(i,a);break;case"textarea":jg(i,a);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!a.multiple;var m=a.value;m!=null?jr(i,!!a.multiple,m,!1):f!==!!a.multiple&&(a.defaultValue!=null?jr(i,!!a.multiple,a.defaultValue,!0):jr(i,!!a.multiple,a.multiple?[]:"",!1))}i[Wi]=a}catch(y){Te(e,e.return,y)}}break;case 6:if(Bt(t,e),sn(e),s&4){if(e.stateNode===null)throw Error(U(162));i=e.stateNode,a=e.memoizedProps;try{i.nodeValue=a}catch(y){Te(e,e.return,y)}}break;case 3:if(Bt(t,e),sn(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Fi(t.containerInfo)}catch(y){Te(e,e.return,y)}break;case 4:Bt(t,e),sn(e);break;case 13:Bt(t,e),sn(e),i=e.child,i.flags&8192&&(a=i.memoizedState!==null,i.stateNode.isHidden=a,!a||i.alternate!==null&&i.alternate.memoizedState!==null||(oh=Me())),s&4&&Np(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(et=(d=et)||u,Bt(t,e),et=d):Bt(t,e),sn(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(Z=e,u=e.child;u!==null;){for(p=Z=u;Z!==null;){switch(f=Z,m=f.child,f.tag){case 0:case 11:case 14:case 15:Si(4,f,f.return);break;case 1:mr(f,f.return);var b=f.stateNode;if(typeof b.componentWillUnmount=="function"){s=f,n=f.return;try{t=s,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(y){Te(s,n,y)}}break;case 5:mr(f,f.return);break;case 22:if(f.memoizedState!==null){Cp(p);continue}}m!==null?(m.return=f,Z=m):Cp(p)}u=u.sibling}e:for(u=null,p=e;;){if(p.tag===5){if(u===null){u=p;try{i=p.stateNode,d?(a=i.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=p.stateNode,c=p.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Cg("display",o))}catch(y){Te(e,e.return,y)}}}else if(p.tag===6){if(u===null)try{p.stateNode.nodeValue=d?"":p.memoizedProps}catch(y){Te(e,e.return,y)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;u===p&&(u=null),p=p.return}u===p&&(u=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Bt(t,e),sn(e),s&4&&Np(e);break;case 21:break;default:Bt(t,e),sn(e)}}function sn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Jx(n)){var s=n;break e}n=n.return}throw Error(U(160))}switch(s.tag){case 5:var i=s.stateNode;s.flags&32&&(Oi(i,""),s.flags&=-33);var a=jp(e);Dd(e,a,i);break;case 3:case 4:var o=s.stateNode.containerInfo,l=jp(e);Od(e,l,o);break;default:throw Error(U(161))}}catch(c){Te(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _2(e,t,n){Z=e,ty(e)}function ty(e,t,n){for(var s=(e.mode&1)!==0;Z!==null;){var i=Z,a=i.child;if(i.tag===22&&s){var o=i.memoizedState!==null||Ba;if(!o){var l=i.alternate,c=l!==null&&l.memoizedState!==null||et;l=Ba;var d=et;if(Ba=o,(et=c)&&!d)for(Z=i;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null?Ep(i):c!==null?(c.return=o,Z=c):Ep(i);for(;a!==null;)Z=a,ty(a),a=a.sibling;Z=i,Ba=l,et=d}Sp(e)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Z=a):Sp(e)}}function Sp(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:et||gl(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!et)if(n===null)s.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:$t(t.type,n.memoizedProps);s.componentDidUpdate(i,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&cp(t,a,s);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}cp(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var p=u.dehydrated;p!==null&&Fi(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(U(163))}et||t.flags&512&&Ld(t)}catch(f){Te(t,t.return,f)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Cp(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ep(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{gl(4,t)}catch(c){Te(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var i=t.return;try{s.componentDidMount()}catch(c){Te(t,i,c)}}var a=t.return;try{Ld(t)}catch(c){Te(t,a,c)}break;case 5:var o=t.return;try{Ld(t)}catch(c){Te(t,o,c)}}}catch(c){Te(t,t.return,c)}if(t===e){Z=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Z=l;break}Z=t.return}}var T2=Math.ceil,Ko=Tn.ReactCurrentDispatcher,ih=Tn.ReactCurrentOwner,Mt=Tn.ReactCurrentBatchConfig,ue=0,Ue=null,ze=null,Ge=0,xt=0,gr=ds(0),Ie=0,Qi=null,zs=0,xl=0,ah=0,Ci=null,dt=null,oh=0,Or=1/0,gn=null,Go=!1,Id=null,Qn=null,Fa=!1,Hn=null,qo=0,Ei=0,Bd=null,po=-1,mo=0;function it(){return ue&6?Me():po!==-1?po:po=Me()}function Jn(e){return e.mode&1?ue&2&&Ge!==0?Ge&-Ge:h2.transition!==null?(mo===0&&(mo=Bg()),mo):(e=pe,e!==0||(e=window.event,e=e===void 0?16:Kg(e.type)),e):1}function qt(e,t,n,s){if(50<Ei)throw Ei=0,Bd=null,Error(U(185));ua(e,n,s),(!(ue&2)||e!==Ue)&&(e===Ue&&(!(ue&2)&&(xl|=n),Ie===4&&$n(e,Ge)),pt(e,s),n===1&&ue===0&&!(t.mode&1)&&(Or=Me()+500,fl&&us()))}function pt(e,t){var n=e.callbackNode;hw(e,t);var s=Ao(e,e===Ue?Ge:0);if(s===0)n!==null&&Of(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Of(n),t===1)e.tag===0?u2(_p.bind(null,e)):ux(_p.bind(null,e)),o2(function(){!(ue&6)&&us()}),n=null;else{switch(Fg(s)){case 1:n=Ru;break;case 4:n=Dg;break;case 16:n=Po;break;case 536870912:n=Ig;break;default:n=Po}n=cy(n,ny.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ny(e,t){if(po=-1,mo=0,ue&6)throw Error(U(327));var n=e.callbackNode;if(_r()&&e.callbackNode!==n)return null;var s=Ao(e,e===Ue?Ge:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=Yo(e,s);else{t=s;var i=ue;ue|=2;var a=ry();(Ue!==e||Ge!==t)&&(gn=null,Or=Me()+500,_s(e,t));do try{M2();break}catch(l){sy(e,l)}while(!0);Ku(),Ko.current=a,ue=i,ze!==null?t=0:(Ue=null,Ge=0,t=Ie)}if(t!==0){if(t===2&&(i=hd(e),i!==0&&(s=i,t=Fd(e,i))),t===1)throw n=Qi,_s(e,0),$n(e,s),pt(e,Me()),n;if(t===6)$n(e,s);else{if(i=e.current.alternate,!(s&30)&&!P2(i)&&(t=Yo(e,s),t===2&&(a=hd(e),a!==0&&(s=a,t=Fd(e,a))),t===1))throw n=Qi,_s(e,0),$n(e,s),pt(e,Me()),n;switch(e.finishedWork=i,e.finishedLanes=s,t){case 0:case 1:throw Error(U(345));case 2:ws(e,dt,gn);break;case 3:if($n(e,s),(s&130023424)===s&&(t=oh+500-Me(),10<t)){if(Ao(e,0)!==0)break;if(i=e.suspendedLanes,(i&s)!==s){it(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=bd(ws.bind(null,e,dt,gn),t);break}ws(e,dt,gn);break;case 4:if($n(e,s),(s&4194240)===s)break;for(t=e.eventTimes,i=-1;0<s;){var o=31-Gt(s);a=1<<o,o=t[o],o>i&&(i=o),s&=~a}if(s=i,s=Me()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*T2(s/1960))-s,10<s){e.timeoutHandle=bd(ws.bind(null,e,dt,gn),s);break}ws(e,dt,gn);break;case 5:ws(e,dt,gn);break;default:throw Error(U(329))}}}return pt(e,Me()),e.callbackNode===n?ny.bind(null,e):null}function Fd(e,t){var n=Ci;return e.current.memoizedState.isDehydrated&&(_s(e,t).flags|=256),e=Yo(e,t),e!==2&&(t=dt,dt=n,t!==null&&Vd(t)),e}function Vd(e){dt===null?dt=e:dt.push.apply(dt,e)}function P2(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var i=n[s],a=i.getSnapshot;i=i.value;try{if(!Yt(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function $n(e,t){for(t&=~ah,t&=~xl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Gt(t),s=1<<n;e[n]=-1,t&=~s}}function _p(e){if(ue&6)throw Error(U(327));_r();var t=Ao(e,0);if(!(t&1))return pt(e,Me()),null;var n=Yo(e,t);if(e.tag!==0&&n===2){var s=hd(e);s!==0&&(t=s,n=Fd(e,s))}if(n===1)throw n=Qi,_s(e,0),$n(e,t),pt(e,Me()),n;if(n===6)throw Error(U(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ws(e,dt,gn),pt(e,Me()),null}function lh(e,t){var n=ue;ue|=1;try{return e(t)}finally{ue=n,ue===0&&(Or=Me()+500,fl&&us())}}function Ls(e){Hn!==null&&Hn.tag===0&&!(ue&6)&&_r();var t=ue;ue|=1;var n=Mt.transition,s=pe;try{if(Mt.transition=null,pe=1,e)return e()}finally{pe=s,Mt.transition=n,ue=t,!(ue&6)&&us()}}function ch(){xt=gr.current,be(gr)}function _s(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,a2(n)),ze!==null)for(n=ze.return;n!==null;){var s=n;switch(Uu(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Oo();break;case 3:zr(),be(ht),be(nt),Ju();break;case 5:Qu(s);break;case 4:zr();break;case 13:be(Ne);break;case 19:be(Ne);break;case 10:Gu(s.type._context);break;case 22:case 23:ch()}n=n.return}if(Ue=e,ze=e=Zn(e.current,null),Ge=xt=t,Ie=0,Qi=null,ah=xl=zs=0,dt=Ci=null,Ss!==null){for(t=0;t<Ss.length;t++)if(n=Ss[t],s=n.interleaved,s!==null){n.interleaved=null;var i=s.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,s.next=o}n.pending=s}Ss=null}return e}function sy(e,t){do{var n=ze;try{if(Ku(),uo.current=Wo,Ho){for(var s=Ce.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Ho=!1}if(Rs=0,$e=De=Ce=null,Ni=!1,qi=0,ih.current=null,n===null||n.return===null){Ie=1,Qi=t,ze=null;break}e:{var a=e,o=n.return,l=n,c=t;if(t=Ge,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,p=u.tag;if(!(u.mode&1)&&(p===0||p===11||p===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=mp(o);if(m!==null){m.flags&=-257,gp(m,o,l,a,t),m.mode&1&&pp(a,d,t),t=m,c=d;var b=t.updateQueue;if(b===null){var y=new Set;y.add(c),t.updateQueue=y}else b.add(c);break e}else{if(!(t&1)){pp(a,d,t),dh();break e}c=Error(U(426))}}else if(je&&l.mode&1){var v=mp(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),gp(v,o,l,a,t),Hu(Lr(c,l));break e}}a=c=Lr(c,l),Ie!==4&&(Ie=2),Ci===null?Ci=[a]:Ci.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var g=Fx(a,c,t);lp(a,g);break e;case 1:l=c;var x=a.type,w=a.stateNode;if(!(a.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Qn===null||!Qn.has(w)))){a.flags|=65536,t&=-t,a.lanes|=t;var j=Vx(a,l,t);lp(a,j);break e}}a=a.return}while(a!==null)}ay(n)}catch(k){t=k,ze===n&&n!==null&&(ze=n=n.return);continue}break}while(!0)}function ry(){var e=Ko.current;return Ko.current=Wo,e===null?Wo:e}function dh(){(Ie===0||Ie===3||Ie===2)&&(Ie=4),Ue===null||!(zs&268435455)&&!(xl&268435455)||$n(Ue,Ge)}function Yo(e,t){var n=ue;ue|=2;var s=ry();(Ue!==e||Ge!==t)&&(gn=null,_s(e,t));do try{A2();break}catch(i){sy(e,i)}while(!0);if(Ku(),ue=n,Ko.current=s,ze!==null)throw Error(U(261));return Ue=null,Ge=0,Ie}function A2(){for(;ze!==null;)iy(ze)}function M2(){for(;ze!==null&&!sw();)iy(ze)}function iy(e){var t=ly(e.alternate,e,xt);e.memoizedProps=e.pendingProps,t===null?ay(e):ze=t,ih.current=null}function ay(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=S2(n,t),n!==null){n.flags&=32767,ze=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ie=6,ze=null;return}}else if(n=N2(n,t,xt),n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);Ie===0&&(Ie=5)}function ws(e,t,n){var s=pe,i=Mt.transition;try{Mt.transition=null,pe=1,R2(e,t,n,s)}finally{Mt.transition=i,pe=s}return null}function R2(e,t,n,s){do _r();while(Hn!==null);if(ue&6)throw Error(U(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(U(177));e.callbackNode=null,e.callbackPriority=0;var a=n.lanes|n.childLanes;if(fw(e,a),e===Ue&&(ze=Ue=null,Ge=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Fa||(Fa=!0,cy(Po,function(){return _r(),null})),a=(n.flags&15990)!==0,n.subtreeFlags&15990||a){a=Mt.transition,Mt.transition=null;var o=pe;pe=1;var l=ue;ue|=4,ih.current=null,E2(e,n),ey(n,e),Zw(yd),Mo=!!xd,yd=xd=null,e.current=n,_2(n),rw(),ue=l,pe=o,Mt.transition=a}else e.current=n;if(Fa&&(Fa=!1,Hn=e,qo=i),a=e.pendingLanes,a===0&&(Qn=null),ow(n.stateNode),pt(e,Me()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],s(i.value,{componentStack:i.stack,digest:i.digest});if(Go)throw Go=!1,e=Id,Id=null,e;return qo&1&&e.tag!==0&&_r(),a=e.pendingLanes,a&1?e===Bd?Ei++:(Ei=0,Bd=e):Ei=0,us(),null}function _r(){if(Hn!==null){var e=Fg(qo),t=Mt.transition,n=pe;try{if(Mt.transition=null,pe=16>e?16:e,Hn===null)var s=!1;else{if(e=Hn,Hn=null,qo=0,ue&6)throw Error(U(331));var i=ue;for(ue|=4,Z=e.current;Z!==null;){var a=Z,o=a.child;if(Z.flags&16){var l=a.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Z=d;Z!==null;){var u=Z;switch(u.tag){case 0:case 11:case 15:Si(8,u,a)}var p=u.child;if(p!==null)p.return=u,Z=p;else for(;Z!==null;){u=Z;var f=u.sibling,m=u.return;if(Qx(u),u===d){Z=null;break}if(f!==null){f.return=m,Z=f;break}Z=m}}}var b=a.alternate;if(b!==null){var y=b.child;if(y!==null){b.child=null;do{var v=y.sibling;y.sibling=null,y=v}while(y!==null)}}Z=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,Z=o;else e:for(;Z!==null;){if(a=Z,a.flags&2048)switch(a.tag){case 0:case 11:case 15:Si(9,a,a.return)}var g=a.sibling;if(g!==null){g.return=a.return,Z=g;break e}Z=a.return}}var x=e.current;for(Z=x;Z!==null;){o=Z;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,Z=w;else e:for(o=x;Z!==null;){if(l=Z,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:gl(9,l)}}catch(k){Te(l,l.return,k)}if(l===o){Z=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,Z=j;break e}Z=l.return}}if(ue=i,us(),ln&&typeof ln.onPostCommitFiberRoot=="function")try{ln.onPostCommitFiberRoot(ll,e)}catch{}s=!0}return s}finally{pe=n,Mt.transition=t}}return!1}function Tp(e,t,n){t=Lr(n,t),t=Fx(e,t,1),e=Xn(e,t,1),t=it(),e!==null&&(ua(e,1,t),pt(e,t))}function Te(e,t,n){if(e.tag===3)Tp(e,e,n);else for(;t!==null;){if(t.tag===3){Tp(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Qn===null||!Qn.has(s))){e=Lr(n,e),e=Vx(t,e,1),t=Xn(t,e,1),e=it(),t!==null&&(ua(t,1,e),pt(t,e));break}}t=t.return}}function z2(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=it(),e.pingedLanes|=e.suspendedLanes&n,Ue===e&&(Ge&n)===n&&(Ie===4||Ie===3&&(Ge&130023424)===Ge&&500>Me()-oh?_s(e,0):ah|=n),pt(e,t)}function oy(e,t){t===0&&(e.mode&1?(t=Pa,Pa<<=1,!(Pa&130023424)&&(Pa=4194304)):t=1);var n=it();e=Cn(e,t),e!==null&&(ua(e,t,n),pt(e,n))}function L2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),oy(e,n)}function O2(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(U(314))}s!==null&&s.delete(t),oy(e,n)}var ly;ly=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ht.current)ut=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ut=!1,j2(e,t,n);ut=!!(e.flags&131072)}else ut=!1,je&&t.flags&1048576&&hx(t,Bo,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;fo(e,t),e=t.pendingProps;var i=Ar(t,nt.current);Er(t,n),i=eh(null,t,s,e,i,n);var a=th();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ft(s)?(a=!0,Do(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Yu(t),i.updater=ml,t.stateNode=i,i._reactInternals=t,Ed(t,s,e,n),t=Pd(null,t,s,!0,a,n)):(t.tag=0,je&&a&&$u(t),rt(null,t,i,n),t=t.child),t;case 16:s=t.elementType;e:{switch(fo(e,t),e=t.pendingProps,i=s._init,s=i(s._payload),t.type=s,i=t.tag=I2(s),e=$t(s,e),i){case 0:t=Td(null,t,s,e,n);break e;case 1:t=vp(null,t,s,e,n);break e;case 11:t=xp(null,t,s,e,n);break e;case 14:t=yp(null,t,s,$t(s.type,e),n);break e}throw Error(U(306,s,""))}return t;case 0:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),Td(e,t,s,i,n);case 1:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),vp(e,t,s,i,n);case 3:e:{if(Wx(t),e===null)throw Error(U(387));s=t.pendingProps,a=t.memoizedState,i=a.element,yx(e,t),$o(t,s,null,n);var o=t.memoizedState;if(s=o.element,a.isDehydrated)if(a={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Lr(Error(U(423)),t),t=bp(e,t,s,n,i);break e}else if(s!==i){i=Lr(Error(U(424)),t),t=bp(e,t,s,n,i);break e}else for(yt=Yn(t.stateNode.containerInfo.firstChild),vt=t,je=!0,Wt=null,n=gx(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Mr(),s===i){t=En(e,t,n);break e}rt(e,t,s,n)}t=t.child}return t;case 5:return vx(t),e===null&&Nd(t),s=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,vd(s,i)?o=null:a!==null&&vd(s,a)&&(t.flags|=32),Hx(e,t),rt(e,t,o,n),t.child;case 6:return e===null&&Nd(t),null;case 13:return Kx(e,t,n);case 4:return Xu(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Rr(t,null,s,n):rt(e,t,s,n),t.child;case 11:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),xp(e,t,s,i,n);case 7:return rt(e,t,t.pendingProps,n),t.child;case 8:return rt(e,t,t.pendingProps.children,n),t.child;case 12:return rt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,xe(Fo,s._currentValue),s._currentValue=o,a!==null)if(Yt(a.value,o)){if(a.children===i.children&&!ht.current){t=En(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===s){if(a.tag===1){c=wn(-1,n&-n),c.tag=2;var d=a.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Sd(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(U(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Sd(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}rt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,s=t.pendingProps.children,Er(t,n),i=Rt(i),s=s(i),t.flags|=1,rt(e,t,s,n),t.child;case 14:return s=t.type,i=$t(s,t.pendingProps),i=$t(s.type,i),yp(e,t,s,i,n);case 15:return $x(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:$t(s,i),fo(e,t),t.tag=1,ft(s)?(e=!0,Do(t)):e=!1,Er(t,n),Bx(t,s,i),Ed(t,s,i,n),Pd(null,t,s,!0,e,n);case 19:return Gx(e,t,n);case 22:return Ux(e,t,n)}throw Error(U(156,t.tag))};function cy(e,t){return Og(e,t)}function D2(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,n,s){return new D2(e,t,n,s)}function uh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function I2(e){if(typeof e=="function")return uh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pu)return 11;if(e===Au)return 14}return 2}function Zn(e,t){var n=e.alternate;return n===null?(n=Pt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function go(e,t,n,s,i,a){var o=2;if(s=e,typeof e=="function")uh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ar:return Ts(n.children,i,a,t);case Tu:o=8,i|=8;break;case Qc:return e=Pt(12,n,t,i|2),e.elementType=Qc,e.lanes=a,e;case Jc:return e=Pt(13,n,t,i),e.elementType=Jc,e.lanes=a,e;case Zc:return e=Pt(19,n,t,i),e.elementType=Zc,e.lanes=a,e;case vg:return yl(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xg:o=10;break e;case yg:o=9;break e;case Pu:o=11;break e;case Au:o=14;break e;case Bn:o=16,s=null;break e}throw Error(U(130,e==null?e:typeof e,""))}return t=Pt(o,n,t,i),t.elementType=e,t.type=s,t.lanes=a,t}function Ts(e,t,n,s){return e=Pt(7,e,s,t),e.lanes=n,e}function yl(e,t,n,s){return e=Pt(22,e,s,t),e.elementType=vg,e.lanes=n,e.stateNode={isHidden:!1},e}function mc(e,t,n){return e=Pt(6,e,null,t),e.lanes=n,e}function gc(e,t,n){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function B2(e,t,n,s,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xl(0),this.expirationTimes=Xl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xl(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function hh(e,t,n,s,i,a,o,l,c){return e=new B2(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=Pt(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yu(a),e}function F2(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ir,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function dy(e){if(!e)return rs;e=e._reactInternals;e:{if($s(e)!==e||e.tag!==1)throw Error(U(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ft(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(U(171))}if(e.tag===1){var n=e.type;if(ft(n))return dx(e,n,t)}return t}function uy(e,t,n,s,i,a,o,l,c){return e=hh(n,s,!0,e,i,a,o,l,c),e.context=dy(null),n=e.current,s=it(),i=Jn(n),a=wn(s,i),a.callback=t??null,Xn(n,a,i),e.current.lanes=i,ua(e,i,s),pt(e,s),e}function vl(e,t,n,s){var i=t.current,a=it(),o=Jn(i);return n=dy(n),t.context===null?t.context=n:t.pendingContext=n,t=wn(a,o),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Xn(i,t,o),e!==null&&(qt(e,i,o,a),co(e,i,o)),o}function Xo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Pp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fh(e,t){Pp(e,t),(e=e.alternate)&&Pp(e,t)}function V2(){return null}var hy=typeof reportError=="function"?reportError:function(e){console.error(e)};function ph(e){this._internalRoot=e}bl.prototype.render=ph.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(U(409));vl(e,t,null,null)};bl.prototype.unmount=ph.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ls(function(){vl(null,e,null,null)}),t[Sn]=null}};function bl(e){this._internalRoot=e}bl.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ug();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vn.length&&t!==0&&t<Vn[n].priority;n++);Vn.splice(n,0,e),n===0&&Wg(e)}};function mh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function wl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ap(){}function $2(e,t,n,s,i){if(i){if(typeof s=="function"){var a=s;s=function(){var d=Xo(o);a.call(d)}}var o=uy(t,s,e,0,null,!1,!1,"",Ap);return e._reactRootContainer=o,e[Sn]=o.current,Ui(e.nodeType===8?e.parentNode:e),Ls(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof s=="function"){var l=s;s=function(){var d=Xo(c);l.call(d)}}var c=hh(e,0,!1,null,null,!1,!1,"",Ap);return e._reactRootContainer=c,e[Sn]=c.current,Ui(e.nodeType===8?e.parentNode:e),Ls(function(){vl(t,c,n,s)}),c}function kl(e,t,n,s,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i=="function"){var l=i;i=function(){var c=Xo(o);l.call(c)}}vl(t,o,e,i)}else o=$2(n,t,e,i,s);return Xo(o)}Vg=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=hi(t.pendingLanes);n!==0&&(zu(t,n|1),pt(t,Me()),!(ue&6)&&(Or=Me()+500,us()))}break;case 13:Ls(function(){var s=Cn(e,1);if(s!==null){var i=it();qt(s,e,1,i)}}),fh(e,1)}};Lu=function(e){if(e.tag===13){var t=Cn(e,134217728);if(t!==null){var n=it();qt(t,e,134217728,n)}fh(e,134217728)}};$g=function(e){if(e.tag===13){var t=Jn(e),n=Cn(e,t);if(n!==null){var s=it();qt(n,e,t,s)}fh(e,t)}};Ug=function(){return pe};Hg=function(e,t){var n=pe;try{return pe=e,t()}finally{pe=n}};cd=function(e,t,n){switch(t){case"input":if(nd(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var i=hl(s);if(!i)throw Error(U(90));wg(s),nd(s,i)}}}break;case"textarea":jg(e,n);break;case"select":t=n.value,t!=null&&jr(e,!!n.multiple,t,!1)}};Pg=lh;Ag=Ls;var U2={usingClientEntryPoint:!1,Events:[fa,dr,hl,_g,Tg,lh]},ai={findFiberByHostInstance:Ns,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},H2={bundleType:ai.bundleType,version:ai.version,rendererPackageName:ai.rendererPackageName,rendererConfig:ai.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Tn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zg(e),e===null?null:e.stateNode},findFiberByHostInstance:ai.findFiberByHostInstance||V2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Va=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Va.isDisabled&&Va.supportsFiber)try{ll=Va.inject(H2),ln=Va}catch{}}jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U2;jt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mh(t))throw Error(U(200));return F2(e,t,null,n)};jt.createRoot=function(e,t){if(!mh(e))throw Error(U(299));var n=!1,s="",i=hy;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=hh(e,1,!1,null,null,n,!1,s,i),e[Sn]=t.current,Ui(e.nodeType===8?e.parentNode:e),new ph(t)};jt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(U(188)):(e=Object.keys(e).join(","),Error(U(268,e)));return e=zg(t),e=e===null?null:e.stateNode,e};jt.flushSync=function(e){return Ls(e)};jt.hydrate=function(e,t,n){if(!wl(t))throw Error(U(200));return kl(null,e,t,!0,n)};jt.hydrateRoot=function(e,t,n){if(!mh(e))throw Error(U(405));var s=n!=null&&n.hydratedSources||null,i=!1,a="",o=hy;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=uy(t,null,e,1,n??null,i,!1,a,o),e[Sn]=t.current,Ui(e),s)for(e=0;e<s.length;e++)n=s[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new bl(t)};jt.render=function(e,t,n){if(!wl(t))throw Error(U(200));return kl(null,e,t,!1,n)};jt.unmountComponentAtNode=function(e){if(!wl(e))throw Error(U(40));return e._reactRootContainer?(Ls(function(){kl(null,null,e,!1,function(){e._reactRootContainer=null,e[Sn]=null})}),!0):!1};jt.unstable_batchedUpdates=lh;jt.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!wl(n))throw Error(U(200));if(e==null||e._reactInternals===void 0)throw Error(U(38));return kl(e,t,n,!1,s)};jt.version="18.3.1-next-f1338f8080-20240426";function fy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fy)}catch(e){console.error(e)}}fy(),fg.exports=jt;var gh=fg.exports;const py=tg(gh);var my,Mp=gh;my=Mp.createRoot,Mp.hydrateRoot;/**
|
|
41
41
|
* @remix-run/router v1.23.2
|
|
42
42
|
*
|
|
43
43
|
* Copyright (c) Remix Software Inc.
|
|
@@ -46,7 +46,7 @@ Error generating stack: `+a.message+`
|
|
|
46
46
|
* LICENSE.md file in the root directory of this source tree.
|
|
47
47
|
*
|
|
48
48
|
* @license MIT
|
|
49
|
-
*/function Ji(){return Ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ji.apply(this,arguments)}var Wn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Wn||(Wn={}));const Rp="popstate";function W2(e){e===void 0&&(e={});function t(s,i){let{pathname:a,search:o,hash:l}=s.location;return $d("",{pathname:a,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(s,i){return typeof i=="string"?i:Qo(i)}return G2(t,n,null,e)}function Re(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xh(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function K2(){return Math.random().toString(36).substr(2,8)}function zp(e,t){return{usr:e.state,key:e.key,idx:t}}function $d(e,t,n,s){return n===void 0&&(n=null),Ji({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Hr(t):t,{state:n,key:t&&t.key||s||K2()})}function Qo(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Hr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function G2(e,t,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:a=!1}=s,o=i.history,l=Wn.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(Ji({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function p(){l=Wn.Pop;let
|
|
49
|
+
*/function Ji(){return Ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ji.apply(this,arguments)}var Wn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Wn||(Wn={}));const Rp="popstate";function W2(e){e===void 0&&(e={});function t(s,i){let{pathname:a,search:o,hash:l}=s.location;return $d("",{pathname:a,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(s,i){return typeof i=="string"?i:Qo(i)}return G2(t,n,null,e)}function Re(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xh(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function K2(){return Math.random().toString(36).substr(2,8)}function zp(e,t){return{usr:e.state,key:e.key,idx:t}}function $d(e,t,n,s){return n===void 0&&(n=null),Ji({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Hr(t):t,{state:n,key:t&&t.key||s||K2()})}function Qo(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Hr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function G2(e,t,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:a=!1}=s,o=i.history,l=Wn.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(Ji({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function p(){l=Wn.Pop;let v=u(),g=v==null?null:v-d;d=v,c&&c({action:l,location:y.location,delta:g})}function f(v,g){l=Wn.Push;let x=$d(y.location,v,g);d=u()+1;let w=zp(x,d),j=y.createHref(x);try{o.pushState(w,"",j)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(j)}a&&c&&c({action:l,location:y.location,delta:1})}function m(v,g){l=Wn.Replace;let x=$d(y.location,v,g);d=u();let w=zp(x,d),j=y.createHref(x);o.replaceState(w,"",j),a&&c&&c({action:l,location:y.location,delta:0})}function b(v){let g=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof v=="string"?v:Qo(v);return x=x.replace(/ $/,"%20"),Re(g,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,g)}let y={get action(){return l},get location(){return e(i,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Rp,p),c=v,()=>{i.removeEventListener(Rp,p),c=null}},createHref(v){return t(i,v)},createURL:b,encodeLocation(v){let g=b(v);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:m,go(v){return o.go(v)}};return y}var Lp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Lp||(Lp={}));function q2(e,t,n){return n===void 0&&(n="/"),Y2(e,t,n)}function Y2(e,t,n,s){let i=typeof t=="string"?Hr(t):t,a=yh(i.pathname||"/",n);if(a==null)return null;let o=gy(e);X2(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=lk(a);l=ik(o[c],d)}return l}function gy(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let i=(a,o,l)=>{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Re(c.relativePath.startsWith(s),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(s.length));let d=es([s,c.relativePath]),u=n.concat(c);a.children&&a.children.length>0&&(Re(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),gy(a.children,t,u,d)),!(a.path==null&&!a.index)&&t.push({path:d,score:sk(d,a.index),routesMeta:u})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let c of xy(a.path))i(a,o,c)}),t}function xy(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(s.length===0)return i?[a,""]:[a];let o=xy(s.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function X2(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:rk(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const Q2=/^:[\w-]+$/,J2=3,Z2=2,ek=1,tk=10,nk=-2,Op=e=>e==="*";function sk(e,t){let n=e.split("/"),s=n.length;return n.some(Op)&&(s+=nk),t&&(s+=Z2),n.filter(i=>!Op(i)).reduce((i,a)=>i+(Q2.test(a)?J2:a===""?ek:tk),s)}function rk(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function ik(e,t,n){let{routesMeta:s}=e,i={},a="/",o=[];for(let l=0;l<s.length;++l){let c=s[l],d=l===s.length-1,u=a==="/"?t:t.slice(a.length)||"/",p=ak({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),f=c.route;if(!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:es([a,p.pathname]),pathnameBase:fk(es([a,p.pathnameBase])),route:f}),p.pathnameBase!=="/"&&(a=es([a,p.pathnameBase]))}return o}function ak(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=ok(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:s.reduce((d,u,p)=>{let{paramName:f,isOptional:m}=u;if(f==="*"){let y=l[p]||"";o=a.slice(0,a.length-y.length).replace(/(.)\/+$/,"$1")}const b=l[p];return m&&!b?d[f]=void 0:d[f]=(b||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:o,pattern:e}}function ok(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),xh(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(s.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function lk(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return xh(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function yh(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}const ck=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dk=e=>ck.test(e);function uk(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:i=""}=typeof e=="string"?Hr(e):e,a;if(n)if(dk(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),xh(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=Dp(n.substring(1),"/"):a=Dp(n,t)}else a=t;return{pathname:a,search:pk(s),hash:mk(i)}}function Dp(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function xc(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function hk(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function vh(e,t){let n=hk(e);return t?n.map((s,i)=>i===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function bh(e,t,n,s){s===void 0&&(s=!1);let i;typeof e=="string"?i=Hr(e):(i=Ji({},e),Re(!i.pathname||!i.pathname.includes("?"),xc("?","pathname","search",i)),Re(!i.pathname||!i.pathname.includes("#"),xc("#","pathname","hash",i)),Re(!i.search||!i.search.includes("#"),xc("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=n;else{let p=t.length-1;if(!s&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),p-=1;i.pathname=f.join("/")}l=p>=0?t[p]:"/"}let c=uk(i,l),d=o&&o!=="/"&&o.endsWith("/"),u=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const es=e=>e.join("/").replace(/\/\/+/g,"/"),fk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),pk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,mk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function gk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const yy=["post","put","patch","delete"];new Set(yy);const xk=["get",...yy];new Set(xk);/**
|
|
50
50
|
* React Router v6.30.3
|
|
51
51
|
*
|
|
52
52
|
* Copyright (c) Remix Software Inc.
|
|
@@ -55,7 +55,7 @@ Error generating stack: `+a.message+`
|
|
|
55
55
|
* LICENSE.md file in the root directory of this source tree.
|
|
56
56
|
*
|
|
57
57
|
* @license MIT
|
|
58
|
-
*/function Zi(){return Zi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Zi.apply(this,arguments)}const wh=h.createContext(null),yk=h.createContext(null),hs=h.createContext(null),jl=h.createContext(null),Pn=h.createContext({outlet:null,matches:[],isDataRoute:!1}),vy=h.createContext(null);function vk(e,t){let{relative:n}=t===void 0?{}:t;Wr()||Re(!1);let{basename:s,navigator:i}=h.useContext(hs),{hash:a,pathname:o,search:l}=wy(e,{relative:n}),c=o;return s!=="/"&&(c=o==="/"?s:es([s,o])),i.createHref({pathname:c,search:l,hash:a})}function Wr(){return h.useContext(jl)!=null}function fs(){return Wr()||Re(!1),h.useContext(jl).location}function by(e){h.useContext(hs).static||h.useLayoutEffect(e)}function mn(){let{isDataRoute:e}=h.useContext(Pn);return e?zk():bk()}function bk(){Wr()||Re(!1);let e=h.useContext(wh),{basename:t,future:n,navigator:s}=h.useContext(hs),{matches:i}=h.useContext(Pn),{pathname:a}=fs(),o=JSON.stringify(vh(i,n.v7_relativeSplatPath)),l=h.useRef(!1);return by(()=>{l.current=!0}),h.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){s.go(d);return}let p=bh(d,JSON.parse(o),a,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:es([t,p.pathname])),(u.replace?s.replace:s.push)(p,u.state,u)},[t,s,o,a,e])}const wk=h.createContext(null);function kk(e){let t=h.useContext(Pn).outlet;return t&&h.createElement(wk.Provider,{value:e},t)}function wy(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=h.useContext(hs),{matches:i}=h.useContext(Pn),{pathname:a}=fs(),o=JSON.stringify(vh(i,s.v7_relativeSplatPath));return h.useMemo(()=>bh(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function jk(e,t){return Nk(e,t)}function Nk(e,t,n,s){Wr()||Re(!1);let{navigator:i}=h.useContext(hs),{matches:a}=h.useContext(Pn),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=fs(),u;if(t){var p;let
|
|
58
|
+
*/function Zi(){return Zi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Zi.apply(this,arguments)}const wh=h.createContext(null),yk=h.createContext(null),hs=h.createContext(null),jl=h.createContext(null),Pn=h.createContext({outlet:null,matches:[],isDataRoute:!1}),vy=h.createContext(null);function vk(e,t){let{relative:n}=t===void 0?{}:t;Wr()||Re(!1);let{basename:s,navigator:i}=h.useContext(hs),{hash:a,pathname:o,search:l}=wy(e,{relative:n}),c=o;return s!=="/"&&(c=o==="/"?s:es([s,o])),i.createHref({pathname:c,search:l,hash:a})}function Wr(){return h.useContext(jl)!=null}function fs(){return Wr()||Re(!1),h.useContext(jl).location}function by(e){h.useContext(hs).static||h.useLayoutEffect(e)}function mn(){let{isDataRoute:e}=h.useContext(Pn);return e?zk():bk()}function bk(){Wr()||Re(!1);let e=h.useContext(wh),{basename:t,future:n,navigator:s}=h.useContext(hs),{matches:i}=h.useContext(Pn),{pathname:a}=fs(),o=JSON.stringify(vh(i,n.v7_relativeSplatPath)),l=h.useRef(!1);return by(()=>{l.current=!0}),h.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){s.go(d);return}let p=bh(d,JSON.parse(o),a,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:es([t,p.pathname])),(u.replace?s.replace:s.push)(p,u.state,u)},[t,s,o,a,e])}const wk=h.createContext(null);function kk(e){let t=h.useContext(Pn).outlet;return t&&h.createElement(wk.Provider,{value:e},t)}function wy(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=h.useContext(hs),{matches:i}=h.useContext(Pn),{pathname:a}=fs(),o=JSON.stringify(vh(i,s.v7_relativeSplatPath));return h.useMemo(()=>bh(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function jk(e,t){return Nk(e,t)}function Nk(e,t,n,s){Wr()||Re(!1);let{navigator:i}=h.useContext(hs),{matches:a}=h.useContext(Pn),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=fs(),u;if(t){var p;let v=typeof t=="string"?Hr(t):t;c==="/"||(p=v.pathname)!=null&&p.startsWith(c)||Re(!1),u=v}else u=d;let f=u.pathname||"/",m=f;if(c!=="/"){let v=c.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let b=q2(e,{pathname:m}),y=Tk(b&&b.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:es([c,i.encodeLocation?i.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:es([c,i.encodeLocation?i.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),a,n,s);return t&&y?h.createElement(jl.Provider,{value:{location:Zi({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Wn.Pop}},y):y}function Sk(){let e=Rk(),t=gk(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:i},n):null,null)}const Ck=h.createElement(Sk,null);class Ek extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(Pn.Provider,{value:this.props.routeContext},h.createElement(vy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function _k(e){let{routeContext:t,match:n,children:s}=e,i=h.useContext(wh);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(Pn.Provider,{value:t},s)}function Tk(e,t,n,s){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=s)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let u=o.findIndex(p=>p.route.id&&(l==null?void 0:l[p.route.id])!==void 0);u>=0||Re(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,d=-1;if(n&&s&&s.v7_partialHydration)for(let u=0;u<o.length;u++){let p=o[u];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=u),p.route.id){let{loaderData:f,errors:m}=n,b=p.route.loader&&f[p.route.id]===void 0&&(!m||m[p.route.id]===void 0);if(p.route.lazy||b){c=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((u,p,f)=>{let m,b=!1,y=null,v=null;n&&(m=l&&p.route.id?l[p.route.id]:void 0,y=p.route.errorElement||Ck,c&&(d<0&&f===0?(Lk("route-fallback"),b=!0,v=null):d===f&&(b=!0,v=p.route.hydrateFallbackElement||null)));let g=t.concat(o.slice(0,f+1)),x=()=>{let w;return m?w=y:b?w=v:p.route.Component?w=h.createElement(p.route.Component,null):p.route.element?w=p.route.element:w=u,h.createElement(_k,{match:p,routeContext:{outlet:u,matches:g,isDataRoute:n!=null},children:w})};return n&&(p.route.ErrorBoundary||p.route.errorElement||f===0)?h.createElement(Ek,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:x(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):x()},null)}var ky=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ky||{}),jy=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(jy||{});function Pk(e){let t=h.useContext(wh);return t||Re(!1),t}function Ak(e){let t=h.useContext(yk);return t||Re(!1),t}function Mk(e){let t=h.useContext(Pn);return t||Re(!1),t}function Ny(e){let t=Mk(),n=t.matches[t.matches.length-1];return n.route.id||Re(!1),n.route.id}function Rk(){var e;let t=h.useContext(vy),n=Ak(),s=Ny();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function zk(){let{router:e}=Pk(ky.UseNavigateStable),t=Ny(jy.UseNavigateStable),n=h.useRef(!1);return by(()=>{n.current=!0}),h.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Zi({fromRouteId:t},a)))},[e,t])}const Ip={};function Lk(e,t,n){Ip[e]||(Ip[e]=!0)}function Ok(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Bp(e){let{to:t,replace:n,state:s,relative:i}=e;Wr()||Re(!1);let{future:a,static:o}=h.useContext(hs),{matches:l}=h.useContext(Pn),{pathname:c}=fs(),d=mn(),u=bh(t,vh(l,a.v7_relativeSplatPath),c,i==="path"),p=JSON.stringify(u);return h.useEffect(()=>d(JSON.parse(p),{replace:n,state:s,relative:i}),[d,p,i,n,s]),null}function Dk(e){return kk(e.context)}function ve(e){Re(!1)}function Ik(e){let{basename:t="/",children:n=null,location:s,navigationType:i=Wn.Pop,navigator:a,static:o=!1,future:l}=e;Wr()&&Re(!1);let c=t.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:c,navigator:a,static:o,future:Zi({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof s=="string"&&(s=Hr(s));let{pathname:u="/",search:p="",hash:f="",state:m=null,key:b="default"}=s,y=h.useMemo(()=>{let v=yh(u,c);return v==null?null:{location:{pathname:v,search:p,hash:f,state:m,key:b},navigationType:i}},[c,u,p,f,m,b,i]);return y==null?null:h.createElement(hs.Provider,{value:d},h.createElement(jl.Provider,{children:n,value:y}))}function Bk(e){let{children:t,location:n}=e;return jk(Ud(t),n)}new Promise(()=>{});function Ud(e,t){t===void 0&&(t=[]);let n=[];return h.Children.forEach(e,(s,i)=>{if(!h.isValidElement(s))return;let a=[...t,i];if(s.type===h.Fragment){n.push.apply(n,Ud(s.props.children,a));return}s.type!==ve&&Re(!1),!s.props.index||!s.props.children||Re(!1);let o={id:s.props.id||a.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(o.children=Ud(s.props.children,a)),n.push(o)}),n}/**
|
|
59
59
|
* React Router DOM v6.30.3
|
|
60
60
|
*
|
|
61
61
|
* Copyright (c) Remix Software Inc.
|
|
@@ -64,8 +64,8 @@ Error generating stack: `+a.message+`
|
|
|
64
64
|
* LICENSE.md file in the root directory of this source tree.
|
|
65
65
|
*
|
|
66
66
|
* @license MIT
|
|
67
|
-
*/function Hd(){return Hd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Hd.apply(this,arguments)}function Fk(e,t){if(e==null)return{};var n={},s=Object.keys(e),i,a;for(a=0;a<s.length;a++)i=s[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Vk(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $k(e,t){return e.button===0&&(!t||t==="_self")&&!Vk(e)}function Wd(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(i=>[n,i]):[[n,s]])},[]))}function Uk(e,t){let n=Wd(e);return t&&t.forEach((s,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}const Hk=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Wk="6";try{window.__reactRouterVersion=Wk}catch{}const Kk="startTransition",Fp=Su[Kk];function Gk(e){let{basename:t,children:n,future:s,window:i}=e,a=h.useRef();a.current==null&&(a.current=W2({window:i,v5Compat:!0}));let o=a.current,[l,c]=h.useState({action:o.action,location:o.location}),{v7_startTransition:d}=s||{},u=h.useCallback(p=>{d&&Fp?Fp(()=>c(p)):c(p)},[c,d]);return h.useLayoutEffect(()=>o.listen(u),[o,u]),h.useEffect(()=>Ok(s),[s]),h.createElement(Ik,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:s})}const qk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Yk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_i=h.forwardRef(function(t,n){let{onClick:s,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:d,preventScrollReset:u,viewTransition:p}=t,f=Fk(t,Hk),{basename:m}=h.useContext(hs),b,v=!1;if(typeof d=="string"&&Yk.test(d)&&(b=d,qk))try{let w=new URL(window.location.href),j=d.startsWith("//")?new URL(w.protocol+d):new URL(d),k=yh(j.pathname,m);j.origin===w.origin&&k!=null?d=k+j.search+j.hash:v=!0}catch{}let y=vk(d,{relative:i}),g=Xk(d,{replace:o,state:l,target:c,preventScrollReset:u,relative:i,viewTransition:p});function x(w){s&&s(w),w.defaultPrevented||g(w)}return h.createElement("a",Hd({},f,{href:b||y,onClick:v||a?s:x,ref:n,target:c}))});var Vp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Vp||(Vp={}));var $p;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})($p||($p={}));function Xk(e,t){let{target:n,replace:s,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=mn(),d=fs(),u=wy(e,{relative:o});return h.useCallback(p=>{if($k(p,n)){p.preventDefault();let f=s!==void 0?s:Qo(d)===Qo(u);c(e,{replace:f,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[d,c,u,s,i,n,e,a,o,l])}function Qk(e){let t=h.useRef(Wd(e)),n=h.useRef(!1),s=fs(),i=h.useMemo(()=>Uk(s.search,n.current?null:t.current),[s.search]),a=mn(),o=h.useCallback((l,c)=>{const d=Wd(typeof l=="function"?l(i):l);n.current=!0,a("?"+d,c)},[a,i]);return[i,o]}var Jk=e=>{switch(e){case"success":return t5;case"info":return s5;case"warning":return n5;case"error":return r5;default:return null}},Zk=Array(12).fill(0),e5=({visible:e,className:t})=>q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},q.createElement("div",{className:"sonner-spinner"},Zk.map((n,s)=>q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),t5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),n5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),s5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),r5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),i5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),a5=()=>{let[e,t]=q.useState(document.hidden);return q.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Kd=1,o5=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Kd++,a=this.toasts.find(l=>l.id===i),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...e,id:i,title:n}),{...l,...e,id:i,dismissible:o,title:n}):l):this.addToast({title:n,...s,dismissible:o,id:i}),i},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),i=n!==void 0,a,o=s.then(async c=>{if(a=["resolve",c],q.isValidElement(c))i=!1,this.create({id:n,type:"default",message:c});else if(c5(c)&&!c.ok){i=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:d,description:u})}else if(t.success!==void 0){i=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:d,description:u})}}).catch(async c=>{if(a=["reject",c],t.error!==void 0){i=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:d,description:u})}}).finally(()=>{var c;i&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>o.then(()=>a[0]==="reject"?d(a[1]):c(a[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Kd++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ct=new o5,l5=(e,t)=>{let n=(t==null?void 0:t.id)||Kd++;return ct.addToast({title:e,...t,id:n}),n},c5=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",d5=l5,u5=()=>ct.toasts,h5=()=>ct.getActiveToasts(),de=Object.assign(d5,{success:ct.success,info:ct.info,warning:ct.warning,error:ct.error,custom:ct.custom,message:ct.message,promise:ct.promise,dismiss:ct.dismiss,loading:ct.loading},{getHistory:u5,getToasts:h5});function f5(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}f5(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
68
|
-
`);function $a(e){return e.label!==void 0}var p5=3,m5="32px",g5="16px",Up=4e3,x5=356,y5=14,v5=20,b5=200;function Ft(...e){return e.filter(Boolean).join(" ")}function w5(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var k5=e=>{var t,n,s,i,a,o,l,c,d,u,p;let{invert:f,toast:m,unstyled:b,interacting:v,setHeights:y,visibleToasts:g,heights:x,index:w,toasts:j,expanded:k,removeToast:N,defaultRichColors:S,closeButton:_,style:R,cancelButtonStyle:L,actionButtonStyle:P,className:V="",descriptionClassName:M="",duration:B,position:A,gap:T,loadingIcon:F,expandByDefault:C,classNames:E,icons:z,closeButtonAriaLabel:W="Close toast",pauseWhenPageIsHidden:K}=e,[X,I]=q.useState(null),[Q,G]=q.useState(null),[J,he]=q.useState(!1),[ce,Y]=q.useState(!1),[ee,Lt]=q.useState(!1),[Qr,qs]=q.useState(!1),[st,Ys]=q.useState(!1),[Vl,Xs]=q.useState(0),[$l,ka]=q.useState(0),gs=q.useRef(m.duration||B||Up),Jr=q.useRef(null),nn=q.useRef(null),O=w===0,ie=w+1<=g,se=m.type,Pe=m.dismissible!==!1,Ve=m.className||"",ja=m.descriptionClassName||"",Na=q.useMemo(()=>x.findIndex(ae=>ae.toastId===m.id)||0,[x,m.id]),pb=q.useMemo(()=>{var ae;return(ae=m.closeButton)!=null?ae:_},[m.closeButton,_]),bf=q.useMemo(()=>m.duration||B||Up,[m.duration,B]),Ul=q.useRef(0),Qs=q.useRef(0),wf=q.useRef(0),Js=q.useRef(null),[mb,gb]=A.split("-"),kf=q.useMemo(()=>x.reduce((ae,me,ke)=>ke>=Na?ae:ae+me.height,0),[x,Na]),jf=a5(),xb=m.invert||f,Hl=se==="loading";Qs.current=q.useMemo(()=>Na*T+kf,[Na,kf]),q.useEffect(()=>{gs.current=bf},[bf]),q.useEffect(()=>{he(!0)},[]),q.useEffect(()=>{let ae=nn.current;if(ae){let me=ae.getBoundingClientRect().height;return ka(me),y(ke=>[{toastId:m.id,height:me,position:m.position},...ke]),()=>y(ke=>ke.filter(Ot=>Ot.toastId!==m.id))}},[y,m.id]),q.useLayoutEffect(()=>{if(!J)return;let ae=nn.current,me=ae.style.height;ae.style.height="auto";let ke=ae.getBoundingClientRect().height;ae.style.height=me,ka(ke),y(Ot=>Ot.find(Dt=>Dt.toastId===m.id)?Ot.map(Dt=>Dt.toastId===m.id?{...Dt,height:ke}:Dt):[{toastId:m.id,height:ke,position:m.position},...Ot])},[J,m.title,m.description,y,m.id]);let Rn=q.useCallback(()=>{Y(!0),Xs(Qs.current),y(ae=>ae.filter(me=>me.toastId!==m.id)),setTimeout(()=>{N(m)},b5)},[m,N,y,Qs]);q.useEffect(()=>{if(m.promise&&se==="loading"||m.duration===1/0||m.type==="loading")return;let ae;return k||v||K&&jf?(()=>{if(wf.current<Ul.current){let me=new Date().getTime()-Ul.current;gs.current=gs.current-me}wf.current=new Date().getTime()})():gs.current!==1/0&&(Ul.current=new Date().getTime(),ae=setTimeout(()=>{var me;(me=m.onAutoClose)==null||me.call(m,m),Rn()},gs.current)),()=>clearTimeout(ae)},[k,v,m,se,K,jf,Rn]),q.useEffect(()=>{m.delete&&Rn()},[Rn,m.delete]);function yb(){var ae,me,ke;return z!=null&&z.loading?q.createElement("div",{className:Ft(E==null?void 0:E.loader,(ae=m==null?void 0:m.classNames)==null?void 0:ae.loader,"sonner-loader"),"data-visible":se==="loading"},z.loading):F?q.createElement("div",{className:Ft(E==null?void 0:E.loader,(me=m==null?void 0:m.classNames)==null?void 0:me.loader,"sonner-loader"),"data-visible":se==="loading"},F):q.createElement(e5,{className:Ft(E==null?void 0:E.loader,(ke=m==null?void 0:m.classNames)==null?void 0:ke.loader),visible:se==="loading"})}return q.createElement("li",{tabIndex:0,ref:nn,className:Ft(V,Ve,E==null?void 0:E.toast,(t=m==null?void 0:m.classNames)==null?void 0:t.toast,E==null?void 0:E.default,E==null?void 0:E[se],(n=m==null?void 0:m.classNames)==null?void 0:n[se]),"data-sonner-toast":"","data-rich-colors":(s=m.richColors)!=null?s:S,"data-styled":!(m.jsx||m.unstyled||b),"data-mounted":J,"data-promise":!!m.promise,"data-swiped":st,"data-removed":ce,"data-visible":ie,"data-y-position":mb,"data-x-position":gb,"data-index":w,"data-front":O,"data-swiping":ee,"data-dismissible":Pe,"data-type":se,"data-invert":xb,"data-swipe-out":Qr,"data-swipe-direction":Q,"data-expanded":!!(k||C&&J),style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${ce?Vl:Qs.current}px`,"--initial-height":C?"auto":`${$l}px`,...R,...m.style},onDragEnd:()=>{Lt(!1),I(null),Js.current=null},onPointerDown:ae=>{Hl||!Pe||(Jr.current=new Date,Xs(Qs.current),ae.target.setPointerCapture(ae.pointerId),ae.target.tagName!=="BUTTON"&&(Lt(!0),Js.current={x:ae.clientX,y:ae.clientY}))},onPointerUp:()=>{var ae,me,ke,Ot;if(Qr||!Pe)return;Js.current=null;let Dt=Number(((ae=nn.current)==null?void 0:ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),zn=Number(((me=nn.current)==null?void 0:me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),xs=new Date().getTime()-((ke=Jr.current)==null?void 0:ke.getTime()),It=X==="x"?Dt:zn,Ln=Math.abs(It)/xs;if(Math.abs(It)>=v5||Ln>.11){Xs(Qs.current),(Ot=m.onDismiss)==null||Ot.call(m,m),G(X==="x"?Dt>0?"right":"left":zn>0?"down":"up"),Rn(),qs(!0),Ys(!1);return}Lt(!1),I(null)},onPointerMove:ae=>{var me,ke,Ot,Dt;if(!Js.current||!Pe||((me=window.getSelection())==null?void 0:me.toString().length)>0)return;let zn=ae.clientY-Js.current.y,xs=ae.clientX-Js.current.x,It=(ke=e.swipeDirections)!=null?ke:w5(A);!X&&(Math.abs(xs)>1||Math.abs(zn)>1)&&I(Math.abs(xs)>Math.abs(zn)?"x":"y");let Ln={x:0,y:0};X==="y"?(It.includes("top")||It.includes("bottom"))&&(It.includes("top")&&zn<0||It.includes("bottom")&&zn>0)&&(Ln.y=zn):X==="x"&&(It.includes("left")||It.includes("right"))&&(It.includes("left")&&xs<0||It.includes("right")&&xs>0)&&(Ln.x=xs),(Math.abs(Ln.x)>0||Math.abs(Ln.y)>0)&&Ys(!0),(Ot=nn.current)==null||Ot.style.setProperty("--swipe-amount-x",`${Ln.x}px`),(Dt=nn.current)==null||Dt.style.setProperty("--swipe-amount-y",`${Ln.y}px`)}},pb&&!m.jsx?q.createElement("button",{"aria-label":W,"data-disabled":Hl,"data-close-button":!0,onClick:Hl||!Pe?()=>{}:()=>{var ae;Rn(),(ae=m.onDismiss)==null||ae.call(m,m)},className:Ft(E==null?void 0:E.closeButton,(i=m==null?void 0:m.classNames)==null?void 0:i.closeButton)},(a=z==null?void 0:z.close)!=null?a:i5):null,m.jsx||h.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:q.createElement(q.Fragment,null,se||m.icon||m.promise?q.createElement("div",{"data-icon":"",className:Ft(E==null?void 0:E.icon,(o=m==null?void 0:m.classNames)==null?void 0:o.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||yb():null,m.type!=="loading"?m.icon||(z==null?void 0:z[se])||Jk(se):null):null,q.createElement("div",{"data-content":"",className:Ft(E==null?void 0:E.content,(l=m==null?void 0:m.classNames)==null?void 0:l.content)},q.createElement("div",{"data-title":"",className:Ft(E==null?void 0:E.title,(c=m==null?void 0:m.classNames)==null?void 0:c.title)},typeof m.title=="function"?m.title():m.title),m.description?q.createElement("div",{"data-description":"",className:Ft(M,ja,E==null?void 0:E.description,(d=m==null?void 0:m.classNames)==null?void 0:d.description)},typeof m.description=="function"?m.description():m.description):null),h.isValidElement(m.cancel)?m.cancel:m.cancel&&$a(m.cancel)?q.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||L,onClick:ae=>{var me,ke;$a(m.cancel)&&Pe&&((ke=(me=m.cancel).onClick)==null||ke.call(me,ae),Rn())},className:Ft(E==null?void 0:E.cancelButton,(u=m==null?void 0:m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,h.isValidElement(m.action)?m.action:m.action&&$a(m.action)?q.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||P,onClick:ae=>{var me,ke;$a(m.action)&&((ke=(me=m.action).onClick)==null||ke.call(me,ae),!ae.defaultPrevented&&Rn())},className:Ft(E==null?void 0:E.actionButton,(p=m==null?void 0:m.classNames)==null?void 0:p.actionButton)},m.action.label):null))};function Hp(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function j5(e,t){let n={};return[e,t].forEach((s,i)=>{let a=i===1,o=a?"--mobile-offset":"--offset",l=a?g5:m5;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(d=>{s[d]===void 0?n[`${o}-${d}`]=l:n[`${o}-${d}`]=typeof s[d]=="number"?`${s[d]}px`:s[d]}):c(l)}),n}var N5=h.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:p,duration:f,style:m,visibleToasts:b=p5,toastOptions:v,dir:y=Hp(),gap:g=y5,loadingIcon:x,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:k}=e,[N,S]=q.useState([]),_=q.useMemo(()=>Array.from(new Set([s].concat(N.filter(K=>K.position).map(K=>K.position)))),[N,s]),[R,L]=q.useState([]),[P,V]=q.useState(!1),[M,B]=q.useState(!1),[A,T]=q.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=q.useRef(null),C=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),E=q.useRef(null),z=q.useRef(!1),W=q.useCallback(K=>{S(X=>{var I;return(I=X.find(Q=>Q.id===K.id))!=null&&I.delete||ct.dismiss(K.id),X.filter(({id:Q})=>Q!==K.id)})},[]);return q.useEffect(()=>ct.subscribe(K=>{if(K.dismiss){S(X=>X.map(I=>I.id===K.id?{...I,delete:!0}:I));return}setTimeout(()=>{py.flushSync(()=>{S(X=>{let I=X.findIndex(Q=>Q.id===K.id);return I!==-1?[...X.slice(0,I),{...X[I],...K},...X.slice(I+1)]:[K,...X]})})})}),[]),q.useEffect(()=>{if(u!=="system"){T(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?T("dark"):T("light")),typeof window>"u")return;let K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:X})=>{T(X?"dark":"light")})}catch{K.addListener(({matches:I})=>{try{T(I?"dark":"light")}catch(Q){console.error(Q)}})}},[u]),q.useEffect(()=>{N.length<=1&&V(!1)},[N]),q.useEffect(()=>{let K=X=>{var I,Q;i.every(G=>X[G]||X.code===G)&&(V(!0),(I=F.current)==null||I.focus()),X.code==="Escape"&&(document.activeElement===F.current||(Q=F.current)!=null&&Q.contains(document.activeElement))&&V(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[i]),q.useEffect(()=>{if(F.current)return()=>{E.current&&(E.current.focus({preventScroll:!0}),E.current=null,z.current=!1)}},[F.current]),q.createElement("section",{ref:t,"aria-label":`${j} ${C}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((K,X)=>{var I;let[Q,G]=K.split("-");return N.length?q.createElement("ol",{key:K,dir:y==="auto"?Hp():y,tabIndex:-1,ref:F,className:l,"data-sonner-toaster":!0,"data-theme":A,"data-y-position":Q,"data-lifted":P&&N.length>1&&!a,"data-x-position":G,style:{"--front-toast-height":`${((I=R[0])==null?void 0:I.height)||0}px`,"--width":`${x5}px`,"--gap":`${g}px`,...m,...j5(c,d)},onBlur:J=>{z.current&&!J.currentTarget.contains(J.relatedTarget)&&(z.current=!1,E.current&&(E.current.focus({preventScroll:!0}),E.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||z.current||(z.current=!0,E.current=J.relatedTarget)},onMouseEnter:()=>V(!0),onMouseMove:()=>V(!0),onMouseLeave:()=>{M||V(!1)},onDragEnd:()=>V(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||B(!0)},onPointerUp:()=>B(!1)},N.filter(J=>!J.position&&X===0||J.position===K).map((J,he)=>{var ce,Y;return q.createElement(k5,{key:J.id,icons:w,index:he,toast:J,defaultRichColors:p,duration:(ce=v==null?void 0:v.duration)!=null?ce:f,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:n,visibleToasts:b,closeButton:(Y=v==null?void 0:v.closeButton)!=null?Y:o,interacting:M,position:K,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,removeToast:W,toasts:N.filter(ee=>ee.position==J.position),heights:R.filter(ee=>ee.position==J.position),setHeights:L,expandByDefault:a,gap:g,loadingIcon:x,expanded:P,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))});const kh=h.createContext({});function Nl(e){const t=h.useRef(null);return t.current===null&&(t.current=e()),t.current}const Sl=h.createContext(null),ea=h.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class S5 extends h.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function C5({children:e,isPresent:t}){const n=h.useId(),s=h.useRef(null),i=h.useRef({width:0,height:0,top:0,left:0}),{nonce:a}=h.useContext(ea);return h.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:d}=i.current;if(t||!s.current||!o||!l)return;s.current.dataset.motionPopId=n;const u=document.createElement("style");return a&&(u.nonce=a),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(`
|
|
67
|
+
*/function Hd(){return Hd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Hd.apply(this,arguments)}function Fk(e,t){if(e==null)return{};var n={},s=Object.keys(e),i,a;for(a=0;a<s.length;a++)i=s[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Vk(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $k(e,t){return e.button===0&&(!t||t==="_self")&&!Vk(e)}function Wd(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(i=>[n,i]):[[n,s]])},[]))}function Uk(e,t){let n=Wd(e);return t&&t.forEach((s,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}const Hk=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Wk="6";try{window.__reactRouterVersion=Wk}catch{}const Kk="startTransition",Fp=Su[Kk];function Gk(e){let{basename:t,children:n,future:s,window:i}=e,a=h.useRef();a.current==null&&(a.current=W2({window:i,v5Compat:!0}));let o=a.current,[l,c]=h.useState({action:o.action,location:o.location}),{v7_startTransition:d}=s||{},u=h.useCallback(p=>{d&&Fp?Fp(()=>c(p)):c(p)},[c,d]);return h.useLayoutEffect(()=>o.listen(u),[o,u]),h.useEffect(()=>Ok(s),[s]),h.createElement(Ik,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:s})}const qk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Yk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_i=h.forwardRef(function(t,n){let{onClick:s,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:d,preventScrollReset:u,viewTransition:p}=t,f=Fk(t,Hk),{basename:m}=h.useContext(hs),b,y=!1;if(typeof d=="string"&&Yk.test(d)&&(b=d,qk))try{let w=new URL(window.location.href),j=d.startsWith("//")?new URL(w.protocol+d):new URL(d),k=yh(j.pathname,m);j.origin===w.origin&&k!=null?d=k+j.search+j.hash:y=!0}catch{}let v=vk(d,{relative:i}),g=Xk(d,{replace:o,state:l,target:c,preventScrollReset:u,relative:i,viewTransition:p});function x(w){s&&s(w),w.defaultPrevented||g(w)}return h.createElement("a",Hd({},f,{href:b||v,onClick:y||a?s:x,ref:n,target:c}))});var Vp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Vp||(Vp={}));var $p;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})($p||($p={}));function Xk(e,t){let{target:n,replace:s,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=mn(),d=fs(),u=wy(e,{relative:o});return h.useCallback(p=>{if($k(p,n)){p.preventDefault();let f=s!==void 0?s:Qo(d)===Qo(u);c(e,{replace:f,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[d,c,u,s,i,n,e,a,o,l])}function Qk(e){let t=h.useRef(Wd(e)),n=h.useRef(!1),s=fs(),i=h.useMemo(()=>Uk(s.search,n.current?null:t.current),[s.search]),a=mn(),o=h.useCallback((l,c)=>{const d=Wd(typeof l=="function"?l(i):l);n.current=!0,a("?"+d,c)},[a,i]);return[i,o]}var Jk=e=>{switch(e){case"success":return t5;case"info":return s5;case"warning":return n5;case"error":return r5;default:return null}},Zk=Array(12).fill(0),e5=({visible:e,className:t})=>q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},q.createElement("div",{className:"sonner-spinner"},Zk.map((n,s)=>q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),t5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),n5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),s5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),r5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),i5=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),a5=()=>{let[e,t]=q.useState(document.hidden);return q.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Kd=1,o5=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Kd++,a=this.toasts.find(l=>l.id===i),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...e,id:i,title:n}),{...l,...e,id:i,dismissible:o,title:n}):l):this.addToast({title:n,...s,dismissible:o,id:i}),i},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),i=n!==void 0,a,o=s.then(async c=>{if(a=["resolve",c],q.isValidElement(c))i=!1,this.create({id:n,type:"default",message:c});else if(c5(c)&&!c.ok){i=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:d,description:u})}else if(t.success!==void 0){i=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:d,description:u})}}).catch(async c=>{if(a=["reject",c],t.error!==void 0){i=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:d,description:u})}}).finally(()=>{var c;i&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>o.then(()=>a[0]==="reject"?d(a[1]):c(a[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Kd++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ct=new o5,l5=(e,t)=>{let n=(t==null?void 0:t.id)||Kd++;return ct.addToast({title:e,...t,id:n}),n},c5=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",d5=l5,u5=()=>ct.toasts,h5=()=>ct.getActiveToasts(),de=Object.assign(d5,{success:ct.success,info:ct.info,warning:ct.warning,error:ct.error,custom:ct.custom,message:ct.message,promise:ct.promise,dismiss:ct.dismiss,loading:ct.loading},{getHistory:u5,getToasts:h5});function f5(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}f5(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
68
|
+
`);function $a(e){return e.label!==void 0}var p5=3,m5="32px",g5="16px",Up=4e3,x5=356,y5=14,v5=20,b5=200;function Ft(...e){return e.filter(Boolean).join(" ")}function w5(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var k5=e=>{var t,n,s,i,a,o,l,c,d,u,p;let{invert:f,toast:m,unstyled:b,interacting:y,setHeights:v,visibleToasts:g,heights:x,index:w,toasts:j,expanded:k,removeToast:N,defaultRichColors:S,closeButton:_,style:R,cancelButtonStyle:L,actionButtonStyle:P,className:V="",descriptionClassName:M="",duration:B,position:A,gap:T,loadingIcon:F,expandByDefault:C,classNames:E,icons:z,closeButtonAriaLabel:W="Close toast",pauseWhenPageIsHidden:K}=e,[X,I]=q.useState(null),[Q,G]=q.useState(null),[J,he]=q.useState(!1),[ce,Y]=q.useState(!1),[ee,Lt]=q.useState(!1),[Qr,qs]=q.useState(!1),[st,Ys]=q.useState(!1),[Vl,Xs]=q.useState(0),[$l,ka]=q.useState(0),gs=q.useRef(m.duration||B||Up),Jr=q.useRef(null),nn=q.useRef(null),O=w===0,ie=w+1<=g,se=m.type,Pe=m.dismissible!==!1,Ve=m.className||"",ja=m.descriptionClassName||"",Na=q.useMemo(()=>x.findIndex(ae=>ae.toastId===m.id)||0,[x,m.id]),pb=q.useMemo(()=>{var ae;return(ae=m.closeButton)!=null?ae:_},[m.closeButton,_]),bf=q.useMemo(()=>m.duration||B||Up,[m.duration,B]),Ul=q.useRef(0),Qs=q.useRef(0),wf=q.useRef(0),Js=q.useRef(null),[mb,gb]=A.split("-"),kf=q.useMemo(()=>x.reduce((ae,me,ke)=>ke>=Na?ae:ae+me.height,0),[x,Na]),jf=a5(),xb=m.invert||f,Hl=se==="loading";Qs.current=q.useMemo(()=>Na*T+kf,[Na,kf]),q.useEffect(()=>{gs.current=bf},[bf]),q.useEffect(()=>{he(!0)},[]),q.useEffect(()=>{let ae=nn.current;if(ae){let me=ae.getBoundingClientRect().height;return ka(me),v(ke=>[{toastId:m.id,height:me,position:m.position},...ke]),()=>v(ke=>ke.filter(Ot=>Ot.toastId!==m.id))}},[v,m.id]),q.useLayoutEffect(()=>{if(!J)return;let ae=nn.current,me=ae.style.height;ae.style.height="auto";let ke=ae.getBoundingClientRect().height;ae.style.height=me,ka(ke),v(Ot=>Ot.find(Dt=>Dt.toastId===m.id)?Ot.map(Dt=>Dt.toastId===m.id?{...Dt,height:ke}:Dt):[{toastId:m.id,height:ke,position:m.position},...Ot])},[J,m.title,m.description,v,m.id]);let Rn=q.useCallback(()=>{Y(!0),Xs(Qs.current),v(ae=>ae.filter(me=>me.toastId!==m.id)),setTimeout(()=>{N(m)},b5)},[m,N,v,Qs]);q.useEffect(()=>{if(m.promise&&se==="loading"||m.duration===1/0||m.type==="loading")return;let ae;return k||y||K&&jf?(()=>{if(wf.current<Ul.current){let me=new Date().getTime()-Ul.current;gs.current=gs.current-me}wf.current=new Date().getTime()})():gs.current!==1/0&&(Ul.current=new Date().getTime(),ae=setTimeout(()=>{var me;(me=m.onAutoClose)==null||me.call(m,m),Rn()},gs.current)),()=>clearTimeout(ae)},[k,y,m,se,K,jf,Rn]),q.useEffect(()=>{m.delete&&Rn()},[Rn,m.delete]);function yb(){var ae,me,ke;return z!=null&&z.loading?q.createElement("div",{className:Ft(E==null?void 0:E.loader,(ae=m==null?void 0:m.classNames)==null?void 0:ae.loader,"sonner-loader"),"data-visible":se==="loading"},z.loading):F?q.createElement("div",{className:Ft(E==null?void 0:E.loader,(me=m==null?void 0:m.classNames)==null?void 0:me.loader,"sonner-loader"),"data-visible":se==="loading"},F):q.createElement(e5,{className:Ft(E==null?void 0:E.loader,(ke=m==null?void 0:m.classNames)==null?void 0:ke.loader),visible:se==="loading"})}return q.createElement("li",{tabIndex:0,ref:nn,className:Ft(V,Ve,E==null?void 0:E.toast,(t=m==null?void 0:m.classNames)==null?void 0:t.toast,E==null?void 0:E.default,E==null?void 0:E[se],(n=m==null?void 0:m.classNames)==null?void 0:n[se]),"data-sonner-toast":"","data-rich-colors":(s=m.richColors)!=null?s:S,"data-styled":!(m.jsx||m.unstyled||b),"data-mounted":J,"data-promise":!!m.promise,"data-swiped":st,"data-removed":ce,"data-visible":ie,"data-y-position":mb,"data-x-position":gb,"data-index":w,"data-front":O,"data-swiping":ee,"data-dismissible":Pe,"data-type":se,"data-invert":xb,"data-swipe-out":Qr,"data-swipe-direction":Q,"data-expanded":!!(k||C&&J),style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${ce?Vl:Qs.current}px`,"--initial-height":C?"auto":`${$l}px`,...R,...m.style},onDragEnd:()=>{Lt(!1),I(null),Js.current=null},onPointerDown:ae=>{Hl||!Pe||(Jr.current=new Date,Xs(Qs.current),ae.target.setPointerCapture(ae.pointerId),ae.target.tagName!=="BUTTON"&&(Lt(!0),Js.current={x:ae.clientX,y:ae.clientY}))},onPointerUp:()=>{var ae,me,ke,Ot;if(Qr||!Pe)return;Js.current=null;let Dt=Number(((ae=nn.current)==null?void 0:ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),zn=Number(((me=nn.current)==null?void 0:me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),xs=new Date().getTime()-((ke=Jr.current)==null?void 0:ke.getTime()),It=X==="x"?Dt:zn,Ln=Math.abs(It)/xs;if(Math.abs(It)>=v5||Ln>.11){Xs(Qs.current),(Ot=m.onDismiss)==null||Ot.call(m,m),G(X==="x"?Dt>0?"right":"left":zn>0?"down":"up"),Rn(),qs(!0),Ys(!1);return}Lt(!1),I(null)},onPointerMove:ae=>{var me,ke,Ot,Dt;if(!Js.current||!Pe||((me=window.getSelection())==null?void 0:me.toString().length)>0)return;let zn=ae.clientY-Js.current.y,xs=ae.clientX-Js.current.x,It=(ke=e.swipeDirections)!=null?ke:w5(A);!X&&(Math.abs(xs)>1||Math.abs(zn)>1)&&I(Math.abs(xs)>Math.abs(zn)?"x":"y");let Ln={x:0,y:0};X==="y"?(It.includes("top")||It.includes("bottom"))&&(It.includes("top")&&zn<0||It.includes("bottom")&&zn>0)&&(Ln.y=zn):X==="x"&&(It.includes("left")||It.includes("right"))&&(It.includes("left")&&xs<0||It.includes("right")&&xs>0)&&(Ln.x=xs),(Math.abs(Ln.x)>0||Math.abs(Ln.y)>0)&&Ys(!0),(Ot=nn.current)==null||Ot.style.setProperty("--swipe-amount-x",`${Ln.x}px`),(Dt=nn.current)==null||Dt.style.setProperty("--swipe-amount-y",`${Ln.y}px`)}},pb&&!m.jsx?q.createElement("button",{"aria-label":W,"data-disabled":Hl,"data-close-button":!0,onClick:Hl||!Pe?()=>{}:()=>{var ae;Rn(),(ae=m.onDismiss)==null||ae.call(m,m)},className:Ft(E==null?void 0:E.closeButton,(i=m==null?void 0:m.classNames)==null?void 0:i.closeButton)},(a=z==null?void 0:z.close)!=null?a:i5):null,m.jsx||h.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:q.createElement(q.Fragment,null,se||m.icon||m.promise?q.createElement("div",{"data-icon":"",className:Ft(E==null?void 0:E.icon,(o=m==null?void 0:m.classNames)==null?void 0:o.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||yb():null,m.type!=="loading"?m.icon||(z==null?void 0:z[se])||Jk(se):null):null,q.createElement("div",{"data-content":"",className:Ft(E==null?void 0:E.content,(l=m==null?void 0:m.classNames)==null?void 0:l.content)},q.createElement("div",{"data-title":"",className:Ft(E==null?void 0:E.title,(c=m==null?void 0:m.classNames)==null?void 0:c.title)},typeof m.title=="function"?m.title():m.title),m.description?q.createElement("div",{"data-description":"",className:Ft(M,ja,E==null?void 0:E.description,(d=m==null?void 0:m.classNames)==null?void 0:d.description)},typeof m.description=="function"?m.description():m.description):null),h.isValidElement(m.cancel)?m.cancel:m.cancel&&$a(m.cancel)?q.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||L,onClick:ae=>{var me,ke;$a(m.cancel)&&Pe&&((ke=(me=m.cancel).onClick)==null||ke.call(me,ae),Rn())},className:Ft(E==null?void 0:E.cancelButton,(u=m==null?void 0:m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,h.isValidElement(m.action)?m.action:m.action&&$a(m.action)?q.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||P,onClick:ae=>{var me,ke;$a(m.action)&&((ke=(me=m.action).onClick)==null||ke.call(me,ae),!ae.defaultPrevented&&Rn())},className:Ft(E==null?void 0:E.actionButton,(p=m==null?void 0:m.classNames)==null?void 0:p.actionButton)},m.action.label):null))};function Hp(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function j5(e,t){let n={};return[e,t].forEach((s,i)=>{let a=i===1,o=a?"--mobile-offset":"--offset",l=a?g5:m5;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(d=>{s[d]===void 0?n[`${o}-${d}`]=l:n[`${o}-${d}`]=typeof s[d]=="number"?`${s[d]}px`:s[d]}):c(l)}),n}var N5=h.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:p,duration:f,style:m,visibleToasts:b=p5,toastOptions:y,dir:v=Hp(),gap:g=y5,loadingIcon:x,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:k}=e,[N,S]=q.useState([]),_=q.useMemo(()=>Array.from(new Set([s].concat(N.filter(K=>K.position).map(K=>K.position)))),[N,s]),[R,L]=q.useState([]),[P,V]=q.useState(!1),[M,B]=q.useState(!1),[A,T]=q.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=q.useRef(null),C=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),E=q.useRef(null),z=q.useRef(!1),W=q.useCallback(K=>{S(X=>{var I;return(I=X.find(Q=>Q.id===K.id))!=null&&I.delete||ct.dismiss(K.id),X.filter(({id:Q})=>Q!==K.id)})},[]);return q.useEffect(()=>ct.subscribe(K=>{if(K.dismiss){S(X=>X.map(I=>I.id===K.id?{...I,delete:!0}:I));return}setTimeout(()=>{py.flushSync(()=>{S(X=>{let I=X.findIndex(Q=>Q.id===K.id);return I!==-1?[...X.slice(0,I),{...X[I],...K},...X.slice(I+1)]:[K,...X]})})})}),[]),q.useEffect(()=>{if(u!=="system"){T(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?T("dark"):T("light")),typeof window>"u")return;let K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:X})=>{T(X?"dark":"light")})}catch{K.addListener(({matches:I})=>{try{T(I?"dark":"light")}catch(Q){console.error(Q)}})}},[u]),q.useEffect(()=>{N.length<=1&&V(!1)},[N]),q.useEffect(()=>{let K=X=>{var I,Q;i.every(G=>X[G]||X.code===G)&&(V(!0),(I=F.current)==null||I.focus()),X.code==="Escape"&&(document.activeElement===F.current||(Q=F.current)!=null&&Q.contains(document.activeElement))&&V(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[i]),q.useEffect(()=>{if(F.current)return()=>{E.current&&(E.current.focus({preventScroll:!0}),E.current=null,z.current=!1)}},[F.current]),q.createElement("section",{ref:t,"aria-label":`${j} ${C}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((K,X)=>{var I;let[Q,G]=K.split("-");return N.length?q.createElement("ol",{key:K,dir:v==="auto"?Hp():v,tabIndex:-1,ref:F,className:l,"data-sonner-toaster":!0,"data-theme":A,"data-y-position":Q,"data-lifted":P&&N.length>1&&!a,"data-x-position":G,style:{"--front-toast-height":`${((I=R[0])==null?void 0:I.height)||0}px`,"--width":`${x5}px`,"--gap":`${g}px`,...m,...j5(c,d)},onBlur:J=>{z.current&&!J.currentTarget.contains(J.relatedTarget)&&(z.current=!1,E.current&&(E.current.focus({preventScroll:!0}),E.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||z.current||(z.current=!0,E.current=J.relatedTarget)},onMouseEnter:()=>V(!0),onMouseMove:()=>V(!0),onMouseLeave:()=>{M||V(!1)},onDragEnd:()=>V(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||B(!0)},onPointerUp:()=>B(!1)},N.filter(J=>!J.position&&X===0||J.position===K).map((J,he)=>{var ce,Y;return q.createElement(k5,{key:J.id,icons:w,index:he,toast:J,defaultRichColors:p,duration:(ce=y==null?void 0:y.duration)!=null?ce:f,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:b,closeButton:(Y=y==null?void 0:y.closeButton)!=null?Y:o,interacting:M,position:K,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,removeToast:W,toasts:N.filter(ee=>ee.position==J.position),heights:R.filter(ee=>ee.position==J.position),setHeights:L,expandByDefault:a,gap:g,loadingIcon:x,expanded:P,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))});const kh=h.createContext({});function Nl(e){const t=h.useRef(null);return t.current===null&&(t.current=e()),t.current}const Sl=h.createContext(null),ea=h.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class S5 extends h.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function C5({children:e,isPresent:t}){const n=h.useId(),s=h.useRef(null),i=h.useRef({width:0,height:0,top:0,left:0}),{nonce:a}=h.useContext(ea);return h.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:d}=i.current;if(t||!s.current||!o||!l)return;s.current.dataset.motionPopId=n;const u=document.createElement("style");return a&&(u.nonce=a),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(`
|
|
69
69
|
[data-motion-pop-id="${n}"] {
|
|
70
70
|
position: absolute !important;
|
|
71
71
|
width: ${o}px !important;
|
|
@@ -73,7 +73,7 @@ Error generating stack: `+a.message+`
|
|
|
73
73
|
top: ${c}px !important;
|
|
74
74
|
left: ${d}px !important;
|
|
75
75
|
}
|
|
76
|
-
`),()=>{document.head.removeChild(u)}},[t]),r.jsx(S5,{isPresent:t,childRef:s,sizeRef:i,children:h.cloneElement(e,{ref:s})})}const E5=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:a,mode:o})=>{const l=Nl(_5),c=h.useId(),d=h.useCallback(p=>{l.set(p,!0);for(const f of l.values())if(!f)return;s&&s()},[l,s]),u=h.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:d,register:p=>(l.set(p,!1),()=>l.delete(p))}),a?[Math.random(),d]:[n,d]);return h.useMemo(()=>{l.forEach((p,f)=>l.set(f,!1))},[n]),h.useEffect(()=>{!n&&!l.size&&s&&s()},[n]),o==="popLayout"&&(e=r.jsx(C5,{isPresent:n,children:e})),r.jsx(Sl.Provider,{value:u,children:e})};function _5(){return new Map}function Sy(e=!0){const t=h.useContext(Sl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=t,a=h.useId();h.useEffect(()=>{e&&i(a)},[e]);const o=h.useCallback(()=>e&&s&&s(a),[a,s,e]);return!n&&s?[!1,o]:[!0]}const Ua=e=>e.key||"";function Wp(e){const t=[];return h.Children.forEach(e,n=>{h.isValidElement(n)&&t.push(n)}),t}const jh=typeof window<"u",Cy=jh?h.useLayoutEffect:h.useEffect,ne=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:a="sync",propagate:o=!1})=>{const[l,c]=Sy(o),d=h.useMemo(()=>Wp(e),[e]),u=o&&!l?[]:d.map(Ua),p=h.useRef(!0),f=h.useRef(d),m=Nl(()=>new Map),[b,v]=h.useState(d),[y,g]=h.useState(d);Cy(()=>{p.current=!1,f.current=d;for(let j=0;j<y.length;j++){const k=Ua(y[j]);u.includes(k)?m.delete(k):m.get(k)!==!0&&m.set(k,!1)}},[y,u.length,u.join("-")]);const x=[];if(d!==b){let j=[...d];for(let k=0;k<y.length;k++){const N=y[k],S=Ua(N);u.includes(S)||(j.splice(k,0,N),x.push(N))}a==="wait"&&x.length&&(j=x),g(Wp(j)),v(d);return}const{forceRender:w}=h.useContext(kh);return r.jsx(r.Fragment,{children:y.map(j=>{const k=Ua(j),N=o&&!l?!1:d===y||u.includes(k),S=()=>{if(m.has(k))m.set(k,!0);else return;let _=!0;m.forEach(R=>{R||(_=!1)}),_&&(w==null||w(),g(f.current),o&&(c==null||c()),s&&s())};return r.jsx(E5,{isPresent:N,initial:!p.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:i,mode:a,onExitComplete:N?void 0:S,children:j},k)})})},bt=e=>e;let Ey=bt;function Nh(e){let t;return()=>(t===void 0&&(t=e()),t)}const Dr=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s},kn=e=>e*1e3,jn=e=>e/1e3,T5={useManualTiming:!1};function P5(e){let t=new Set,n=new Set,s=!1,i=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(d){a.has(d)&&(c.schedule(d),e()),d(o)}const c={schedule:(d,u=!1,p=!1)=>{const m=p&&s?t:n;return u&&a.add(d),m.has(d)||m.add(d),d},cancel:d=>{n.delete(d),a.delete(d)},process:d=>{if(o=d,s){i=!0;return}s=!0,[t,n]=[n,t],t.forEach(l),t.clear(),s=!1,i&&(i=!1,c.process(d))}};return c}const Ha=["read","resolveKeyframes","update","preRender","render","postRender"],A5=40;function _y(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Ha.reduce((g,x)=>(g[x]=P5(a),g),{}),{read:l,resolveKeyframes:c,update:d,preRender:u,render:p,postRender:f}=o,m=()=>{const g=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(g-i.timestamp,A5),1),i.timestamp=g,i.isProcessing=!0,l.process(i),c.process(i),d.process(i),u.process(i),p.process(i),f.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(m))},b=()=>{n=!0,s=!0,i.isProcessing||e(m)};return{schedule:Ha.reduce((g,x)=>{const w=o[x];return g[x]=(j,k=!1,N=!1)=>(n||b(),w.schedule(j,k,N)),g},{}),cancel:g=>{for(let x=0;x<Ha.length;x++)o[Ha[x]].cancel(g)},state:i,steps:o}}const{schedule:we,cancel:is,state:Ke,steps:yc}=_y(typeof requestAnimationFrame<"u"?requestAnimationFrame:bt,!0),Ty=h.createContext({strict:!1}),Kp={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ir={};for(const e in Kp)Ir[e]={isEnabled:t=>Kp[e].some(n=>!!t[n])};function M5(e){for(const t in e)Ir[t]={...Ir[t],...e[t]}}const R5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Jo(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||R5.has(e)}let Py=e=>!Jo(e);function Ay(e){e&&(Py=t=>t.startsWith("on")?!Jo(t):e(t))}try{Ay(require("@emotion/is-prop-valid").default)}catch{}function z5(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(Py(i)||n===!0&&Jo(i)||!t&&!Jo(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}function L5({children:e,isValidProp:t,...n}){t&&Ay(t),n={...h.useContext(ea),...n},n.isStatic=Nl(()=>n.isStatic);const s=h.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return r.jsx(ea.Provider,{value:s,children:e})}function O5(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const Cl=h.createContext({});function ta(e){return typeof e=="string"||Array.isArray(e)}function El(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Sh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ch=["initial",...Sh];function _l(e){return El(e.animate)||Ch.some(t=>ta(e[t]))}function My(e){return!!(_l(e)||e.variants)}function D5(e,t){if(_l(e)){const{initial:n,animate:s}=e;return{initial:n===!1||ta(n)?n:void 0,animate:ta(s)?s:void 0}}return e.inherit!==!1?t:{}}function I5(e){const{initial:t,animate:n}=D5(e,h.useContext(Cl));return h.useMemo(()=>({initial:t,animate:n}),[Gp(t),Gp(n)])}function Gp(e){return Array.isArray(e)?e.join(" "):e}const B5=Symbol.for("motionComponentSymbol");function xr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function F5(e,t,n){return h.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):xr(n)&&(n.current=s))},[t])}const Eh=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),V5="framerAppearId",Ry="data-"+Eh(V5),{schedule:_h}=_y(queueMicrotask,!1),zy=h.createContext({});function $5(e,t,n,s,i){var a,o;const{visualElement:l}=h.useContext(Cl),c=h.useContext(Ty),d=h.useContext(Sl),u=h.useContext(ea).reducedMotion,p=h.useRef(null);s=s||c.renderer,!p.current&&s&&(p.current=s(e,{visualState:t,parent:l,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:u}));const f=p.current,m=h.useContext(zy);f&&!f.projection&&i&&(f.type==="html"||f.type==="svg")&&U5(p.current,n,i,m);const b=h.useRef(!1);h.useInsertionEffect(()=>{f&&b.current&&f.update(n,d)});const v=n[Ry],y=h.useRef(!!v&&!(!((a=window.MotionHandoffIsComplete)===null||a===void 0)&&a.call(window,v))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,v)));return Cy(()=>{f&&(b.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),_h.render(f.render),y.current&&f.animationState&&f.animationState.animateChanges())}),h.useEffect(()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,v)}),y.current=!1))}),f}function U5(e,t,n,s){const{layoutId:i,layout:a,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Ly(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||l&&xr(l),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:d})}function Ly(e){if(e)return e.options.allowProjection!==!1?e.projection:Ly(e.parent)}function H5({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:i}){var a,o;e&&M5(e);function l(d,u){let p;const f={...h.useContext(ea),...d,layoutId:W5(d)},{isStatic:m}=f,b=I5(d),v=s(d,m);if(!m&&jh){K5();const y=G5(f);p=y.MeasureLayout,b.visualElement=$5(i,v,f,t,y.ProjectionNode)}return r.jsxs(Cl.Provider,{value:b,children:[p&&b.visualElement?r.jsx(p,{visualElement:b.visualElement,...f}):null,n(i,d,F5(v,b.visualElement,u),v,m,b.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(o=(a=i.displayName)!==null&&a!==void 0?a:i.name)!==null&&o!==void 0?o:""})`}`;const c=h.forwardRef(l);return c[B5]=i,c}function W5({layoutId:e}){const t=h.useContext(kh).id;return t&&e!==void 0?t+"-"+e:e}function K5(e,t){h.useContext(Ty).strict}function G5(e){const{drag:t,layout:n}=Ir;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const q5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Th(e){return typeof e!="string"||e.includes("-")?!1:!!(q5.indexOf(e)>-1||/[A-Z]/u.test(e))}function qp(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Ph(e,t,n,s){if(typeof t=="function"){const[i,a]=qp(s);t=t(n!==void 0?n:e.custom,i,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,a]=qp(s);t=t(n!==void 0?n:e.custom,i,a)}return t}const Gd=e=>Array.isArray(e),Y5=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),X5=e=>Gd(e)?e[e.length-1]||0:e,tt=e=>!!(e&&e.getVelocity);function xo(e){const t=tt(e)?e.get():e;return Y5(t)?t.toValue():t}function Q5({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},s,i,a){const o={latestValues:J5(s,i,a,e),renderState:t()};return n&&(o.onMount=l=>n({props:s,current:l,...o}),o.onUpdate=l=>n(l)),o}const Oy=e=>(t,n)=>{const s=h.useContext(Cl),i=h.useContext(Sl),a=()=>Q5(e,t,s,i);return n?a():Nl(a)};function J5(e,t,n,s){const i={},a=s(e,{});for(const f in a)i[f]=xo(a[f]);let{initial:o,animate:l}=e;const c=_l(e),d=My(e);t&&d&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const p=u?l:o;if(p&&typeof p!="boolean"&&!El(p)){const f=Array.isArray(p)?p:[p];for(let m=0;m<f.length;m++){const b=Ph(e,f[m]);if(b){const{transitionEnd:v,transition:y,...g}=b;for(const x in g){let w=g[x];if(Array.isArray(w)){const j=u?w.length-1:0;w=w[j]}w!==null&&(i[x]=w)}for(const x in v)i[x]=v[x]}}}return i}const Kr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Us=new Set(Kr),Dy=e=>t=>typeof t=="string"&&t.startsWith(e),Iy=Dy("--"),Z5=Dy("var(--"),Ah=e=>Z5(e)?ej.test(e.split("/*")[0].trim()):!1,ej=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,By=(e,t)=>t&&typeof e=="number"?t.transform(e):e,_n=(e,t,n)=>n>t?t:n<e?e:n,Gr={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},na={...Gr,transform:e=>_n(0,1,e)},Wa={...Gr,default:1},ma=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Dn=ma("deg"),dn=ma("%"),te=ma("px"),tj=ma("vh"),nj=ma("vw"),Yp={...dn,parse:e=>dn.parse(e)/100,transform:e=>dn.transform(e*100)},sj={borderWidth:te,borderTopWidth:te,borderRightWidth:te,borderBottomWidth:te,borderLeftWidth:te,borderRadius:te,radius:te,borderTopLeftRadius:te,borderTopRightRadius:te,borderBottomRightRadius:te,borderBottomLeftRadius:te,width:te,maxWidth:te,height:te,maxHeight:te,top:te,right:te,bottom:te,left:te,padding:te,paddingTop:te,paddingRight:te,paddingBottom:te,paddingLeft:te,margin:te,marginTop:te,marginRight:te,marginBottom:te,marginLeft:te,backgroundPositionX:te,backgroundPositionY:te},rj={rotate:Dn,rotateX:Dn,rotateY:Dn,rotateZ:Dn,scale:Wa,scaleX:Wa,scaleY:Wa,scaleZ:Wa,skew:Dn,skewX:Dn,skewY:Dn,distance:te,translateX:te,translateY:te,translateZ:te,x:te,y:te,z:te,perspective:te,transformPerspective:te,opacity:na,originX:Yp,originY:Yp,originZ:te},Xp={...Gr,transform:Math.round},Mh={...sj,...rj,zIndex:Xp,size:te,fillOpacity:na,strokeOpacity:na,numOctaves:Xp},ij={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aj=Kr.length;function oj(e,t,n){let s="",i=!0;for(let a=0;a<aj;a++){const o=Kr[a],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=By(l,Mh[o]);if(!c){i=!1;const u=ij[o]||o;s+=`${u}(${d}) `}n&&(t[o]=d)}}return s=s.trim(),n?s=n(t,i?"":s):i&&(s="none"),s}function Rh(e,t,n){const{style:s,vars:i,transformOrigin:a}=e;let o=!1,l=!1;for(const c in t){const d=t[c];if(Us.has(c)){o=!0;continue}else if(Iy(c)){i[c]=d;continue}else{const u=By(d,Mh[c]);c.startsWith("origin")?(l=!0,a[c]=u):s[c]=u}}if(t.transform||(o||n?s.transform=oj(t,e.transform,n):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=a;s.transformOrigin=`${c} ${d} ${u}`}}const lj={offset:"stroke-dashoffset",array:"stroke-dasharray"},cj={offset:"strokeDashoffset",array:"strokeDasharray"};function dj(e,t,n=1,s=0,i=!0){e.pathLength=1;const a=i?lj:cj;e[a.offset]=te.transform(-s);const o=te.transform(t),l=te.transform(n);e[a.array]=`${o} ${l}`}function Qp(e,t,n){return typeof e=="string"?e:te.transform(t+n*e)}function uj(e,t,n){const s=Qp(t,e.x,e.width),i=Qp(n,e.y,e.height);return`${s} ${i}`}function zh(e,{attrX:t,attrY:n,attrScale:s,originX:i,originY:a,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...d},u,p){if(Rh(e,d,p),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m,dimensions:b}=e;f.transform&&(b&&(m.transform=f.transform),delete f.transform),b&&(i!==void 0||a!==void 0||m.transform)&&(m.transformOrigin=uj(b,i!==void 0?i:.5,a!==void 0?a:.5)),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),s!==void 0&&(f.scale=s),o!==void 0&&dj(f,o,l,c,!1)}const Lh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Fy=()=>({...Lh(),attrs:{}}),Oh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Vy(e,{style:t,vars:n},s,i){Object.assign(e.style,t,i&&i.getProjectionStyles(s));for(const a in n)e.style.setProperty(a,n[a])}const $y=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Uy(e,t,n,s){Vy(e,t,void 0,s);for(const i in t.attrs)e.setAttribute($y.has(i)?i:Eh(i),t.attrs[i])}const Zo={};function hj(e){Object.assign(Zo,e)}function Hy(e,{layout:t,layoutId:n}){return Us.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Zo[e]||e==="opacity")}function Dh(e,t,n){var s;const{style:i}=e,a={};for(const o in i)(tt(i[o])||t.style&&tt(t.style[o])||Hy(o,e)||((s=n==null?void 0:n.getValue(o))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(a[o]=i[o]);return a}function Wy(e,t,n){const s=Dh(e,t,n);for(const i in e)if(tt(e[i])||tt(t[i])){const a=Kr.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[a]=e[i]}return s}function fj(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Jp=["x","y","width","height","cx","cy","r"],pj={useVisualState:Oy({scrapeMotionValuesFromProps:Wy,createRenderState:Fy,onUpdate:({props:e,prevProps:t,current:n,renderState:s,latestValues:i})=>{if(!n)return;let a=!!e.drag;if(!a){for(const l in i)if(Us.has(l)){a=!0;break}}if(!a)return;let o=!t;if(t)for(let l=0;l<Jp.length;l++){const c=Jp[l];e[c]!==t[c]&&(o=!0)}o&&we.read(()=>{fj(n,s),we.render(()=>{zh(s,i,Oh(n.tagName),e.transformTemplate),Uy(n,s)})})}})},mj={useVisualState:Oy({scrapeMotionValuesFromProps:Dh,createRenderState:Lh})};function Ky(e,t,n){for(const s in t)!tt(t[s])&&!Hy(s,n)&&(e[s]=t[s])}function gj({transformTemplate:e},t){return h.useMemo(()=>{const n=Lh();return Rh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function xj(e,t){const n=e.style||{},s={};return Ky(s,n,e),Object.assign(s,gj(e,t)),s}function yj(e,t){const n={},s=xj(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}function vj(e,t,n,s){const i=h.useMemo(()=>{const a=Fy();return zh(a,t,Oh(s),e.transformTemplate),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};Ky(a,e.style,e),i.style={...a,...i.style}}return i}function bj(e=!1){return(n,s,i,{latestValues:a},o)=>{const c=(Th(n)?vj:yj)(s,a,o,n),d=z5(s,typeof n=="string",e),u=n!==h.Fragment?{...d,...c,ref:i}:{},{children:p}=s,f=h.useMemo(()=>tt(p)?p.get():p,[p]);return h.createElement(n,{...u,children:f})}}function wj(e,t){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...Th(s)?pj:mj,preloadedFeatures:e,useRender:bj(i),createVisualElement:t,Component:s};return H5(o)}}function Gy(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}function Tl(e,t,n){const s=e.getProps();return Ph(s,t,n!==void 0?n:s.custom,e)}const kj=Nh(()=>window.ScrollTimeline!==void 0);class jj{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let s=0;s<this.animations.length;s++)this.animations[s][t]=n}attachTimeline(t,n){const s=this.animations.map(i=>{if(kj()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{s.forEach((i,a)=>{i&&i(),this.animations[a].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Nj extends jj{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function Ih(e,t){return e?e[t]||e.default||e:void 0}const qd=2e4;function qy(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<qd;)t+=n,s=e.next(t);return t>=qd?1/0:t}function Bh(e){return typeof e=="function"}function Zp(e,t){e.timeline=t,e.onfinish=null}const Fh=e=>Array.isArray(e)&&typeof e[0]=="number",Sj={linearEasing:void 0};function Cj(e,t){const n=Nh(e);return()=>{var s;return(s=Sj[t])!==null&&s!==void 0?s:n()}}const el=Cj(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Yy=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let a=0;a<i;a++)s+=e(Dr(0,i-1,a))+", ";return`linear(${s.substring(0,s.length-2)})`};function Xy(e){return!!(typeof e=="function"&&el()||!e||typeof e=="string"&&(e in Yd||el())||Fh(e)||Array.isArray(e)&&e.every(Xy))}const pi=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,Yd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pi([0,.65,.55,1]),circOut:pi([.55,0,1,.45]),backIn:pi([.31,.01,.66,-.59]),backOut:pi([.33,1.53,.69,.99])};function Qy(e,t){if(e)return typeof e=="function"&&el()?Yy(e,t):Fh(e)?pi(e):Array.isArray(e)?e.map(n=>Qy(n,t)||Yd.easeOut):Yd[e]}const Vt={x:!1,y:!1};function Jy(){return Vt.x||Vt.y}function Ej(e,t,n){var s;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const a=(s=void 0)!==null&&s!==void 0?s:i.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}function Zy(e,t){const n=Ej(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function em(e){return t=>{t.pointerType==="touch"||Jy()||e(t)}}function _j(e,t,n={}){const[s,i,a]=Zy(e,n),o=em(l=>{const{target:c}=l,d=t(l);if(typeof d!="function"||!c)return;const u=em(p=>{d(p),c.removeEventListener("pointerleave",u)});c.addEventListener("pointerleave",u,i)});return s.forEach(l=>{l.addEventListener("pointerenter",o,i)}),a}const e1=(e,t)=>t?e===t?!0:e1(e,t.parentElement):!1,Vh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Tj=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Pj(e){return Tj.has(e.tagName)||e.tabIndex!==-1}const mi=new WeakSet;function tm(e){return t=>{t.key==="Enter"&&e(t)}}function vc(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Aj=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=tm(()=>{if(mi.has(n))return;vc(n,"down");const i=tm(()=>{vc(n,"up")}),a=()=>vc(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",a,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function nm(e){return Vh(e)&&!Jy()}function Mj(e,t,n={}){const[s,i,a]=Zy(e,n),o=l=>{const c=l.currentTarget;if(!nm(l)||mi.has(c))return;mi.add(c);const d=t(l),u=(m,b)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",f),!(!nm(m)||!mi.has(c))&&(mi.delete(c),typeof d=="function"&&d(m,{success:b}))},p=m=>{u(m,n.useGlobalTarget||e1(c,m.target))},f=m=>{u(m,!1)};window.addEventListener("pointerup",p,i),window.addEventListener("pointercancel",f,i)};return s.forEach(l=>{!Pj(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,i),l.addEventListener("focus",d=>Aj(d,i),i)}),a}function Rj(e){return e==="x"||e==="y"?Vt[e]?null:(Vt[e]=!0,()=>{Vt[e]=!1}):Vt.x||Vt.y?null:(Vt.x=Vt.y=!0,()=>{Vt.x=Vt.y=!1})}const t1=new Set(["width","height","top","left","right","bottom",...Kr]);let yo;function zj(){yo=void 0}const un={now:()=>(yo===void 0&&un.set(Ke.isProcessing||T5.useManualTiming?Ke.timestamp:performance.now()),yo),set:e=>{yo=e,queueMicrotask(zj)}};function $h(e,t){e.indexOf(t)===-1&&e.push(t)}function Uh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Hh{constructor(){this.subscriptions=[]}add(t){return $h(this.subscriptions,t),()=>Uh(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let a=0;a<i;a++){const o=this.subscriptions[a];o&&o(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function n1(e,t){return t?e*(1e3/t):0}const sm=30,Lj=e=>!isNaN(parseFloat(e));class Oj{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{const a=un.now();this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=un.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Lj(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Hh);const s=this.events[t].add(n);return t==="change"?()=>{s(),we.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>sm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,sm);return n1(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function sa(e,t){return new Oj(e,t)}function Dj(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,sa(n))}function Ij(e,t){const n=Tl(e,t);let{transitionEnd:s={},transition:i={},...a}=n||{};a={...a,...s};for(const o in a){const l=X5(a[o]);Dj(e,o,l)}}function Bj(e){return!!(tt(e)&&e.add)}function Xd(e,t){const n=e.getValue("willChange");if(Bj(n))return n.add(t)}function s1(e){return e.props[Ry]}const r1=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Fj=1e-7,Vj=12;function $j(e,t,n,s,i){let a,o,l=0;do o=t+(n-t)/2,a=r1(o,s,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Fj&&++l<Vj);return o}function ga(e,t,n,s){if(e===t&&n===s)return bt;const i=a=>$j(a,0,1,e,n);return a=>a===0||a===1?a:r1(i(a),t,s)}const i1=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,a1=e=>t=>1-e(1-t),o1=ga(.33,1.53,.69,.99),Wh=a1(o1),l1=i1(Wh),c1=e=>(e*=2)<1?.5*Wh(e):.5*(2-Math.pow(2,-10*(e-1))),Kh=e=>1-Math.sin(Math.acos(e)),d1=a1(Kh),u1=i1(Kh),h1=e=>/^0[^.\s]+$/u.test(e);function Uj(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||h1(e):!0}const Ti=e=>Math.round(e*1e5)/1e5,Gh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Hj(e){return e==null}const Wj=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,qh=(e,t)=>n=>!!(typeof n=="string"&&Wj.test(n)&&n.startsWith(e)||t&&!Hj(n)&&Object.prototype.hasOwnProperty.call(n,t)),f1=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,a,o,l]=s.match(Gh);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Kj=e=>_n(0,255,e),bc={...Gr,transform:e=>Math.round(Kj(e))},Es={test:qh("rgb","red"),parse:f1("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+bc.transform(e)+", "+bc.transform(t)+", "+bc.transform(n)+", "+Ti(na.transform(s))+")"};function Gj(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const Qd={test:qh("#"),parse:Gj,transform:Es.transform},yr={test:qh("hsl","hue"),parse:f1("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+dn.transform(Ti(t))+", "+dn.transform(Ti(n))+", "+Ti(na.transform(s))+")"},Je={test:e=>Es.test(e)||Qd.test(e)||yr.test(e),parse:e=>Es.test(e)?Es.parse(e):yr.test(e)?yr.parse(e):Qd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Es.transform(e):yr.transform(e)},qj=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Yj(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Gh))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(qj))===null||n===void 0?void 0:n.length)||0)>0}const p1="number",m1="color",Xj="var",Qj="var(",rm="${}",Jj=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ra(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let a=0;const l=t.replace(Jj,c=>(Je.test(c)?(s.color.push(a),i.push(m1),n.push(Je.parse(c))):c.startsWith(Qj)?(s.var.push(a),i.push(Xj),n.push(c)):(s.number.push(a),i.push(p1),n.push(parseFloat(c))),++a,rm)).split(rm);return{values:n,split:l,indexes:s,types:i}}function g1(e){return ra(e).values}function x1(e){const{split:t,types:n}=ra(e),s=t.length;return i=>{let a="";for(let o=0;o<s;o++)if(a+=t[o],i[o]!==void 0){const l=n[o];l===p1?a+=Ti(i[o]):l===m1?a+=Je.transform(i[o]):a+=i[o]}return a}}const Zj=e=>typeof e=="number"?0:e;function eN(e){const t=g1(e);return x1(e)(t.map(Zj))}const as={test:Yj,parse:g1,createTransformer:x1,getAnimatableNone:eN},tN=new Set(["brightness","contrast","saturate","opacity"]);function nN(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Gh)||[];if(!s)return e;const i=n.replace(s,"");let a=tN.has(t)?1:0;return s!==n&&(a*=100),t+"("+a+i+")"}const sN=/\b([a-z-]*)\(.*?\)/gu,Jd={...as,getAnimatableNone:e=>{const t=e.match(sN);return t?t.map(nN).join(" "):e}},rN={...Mh,color:Je,backgroundColor:Je,outlineColor:Je,fill:Je,stroke:Je,borderColor:Je,borderTopColor:Je,borderRightColor:Je,borderBottomColor:Je,borderLeftColor:Je,filter:Jd,WebkitFilter:Jd},Yh=e=>rN[e];function y1(e,t){let n=Yh(e);return n!==Jd&&(n=as),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const iN=new Set(["auto","none","0"]);function aN(e,t,n){let s=0,i;for(;s<e.length&&!i;){const a=e[s];typeof a=="string"&&!iN.has(a)&&ra(a).values.length&&(i=e[s]),s++}if(i&&n)for(const a of t)e[a]=y1(n,i)}const im=e=>e===Gr||e===te,am=(e,t)=>parseFloat(e.split(", ")[t]),om=(e,t)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return am(i[1],t);{const a=s.match(/^matrix\((.+)\)$/u);return a?am(a[1],e):0}},oN=new Set(["x","y","z"]),lN=Kr.filter(e=>!oN.has(e));function cN(e){const t=[];return lN.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const Br={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:om(4,13),y:om(5,14)};Br.translateX=Br.x;Br.translateY=Br.y;const Ps=new Set;let Zd=!1,eu=!1;function v1(){if(eu){const e=Array.from(Ps).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=cN(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([a,o])=>{var l;(l=s.getValue(a))===null||l===void 0||l.set(o)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}eu=!1,Zd=!1,Ps.forEach(e=>e.complete()),Ps.clear()}function b1(){Ps.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(eu=!0)})}function dN(){b1(),v1()}class Xh{constructor(t,n,s,i,a,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ps.add(this),Zd||(Zd=!0,we.read(b1),we.resolveKeyframes(v1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;for(let a=0;a<t.length;a++)if(t[a]===null)if(a===0){const o=i==null?void 0:i.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(s&&n){const c=s.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),i&&o===void 0&&i.set(t[0])}else t[a]=t[a-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ps.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ps.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const w1=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),uN=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function hN(e){const t=uN.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function k1(e,t,n=1){const[s,i]=hN(e);if(!s)return;const a=window.getComputedStyle(t).getPropertyValue(s);if(a){const o=a.trim();return w1(o)?parseFloat(o):o}return Ah(i)?k1(i,t,n+1):i}const j1=e=>t=>t.test(e),fN={test:e=>e==="auto",parse:e=>e},N1=[Gr,te,dn,Dn,nj,tj,fN],lm=e=>N1.find(j1(e));class S1 extends Xh{constructor(t,n,s,i,a){super(t,n,s,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let d=t[c];if(typeof d=="string"&&(d=d.trim(),Ah(d))){const u=k1(d,n.current);u!==void 0&&(t[c]=u),c===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!t1.has(s)||t.length!==2)return;const[i,a]=t,o=lm(i),l=lm(a);if(o!==l)if(im(o)&&im(l))for(let c=0;c<t.length;c++){const d=t[c];typeof d=="string"&&(t[c]=parseFloat(d))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let i=0;i<t.length;i++)Uj(t[i])&&s.push(i);s.length&&aN(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Br[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(s,i).jump(i,!1)}measureEndState(){var t;const{element:n,name:s,unresolvedKeyframes:i}=this;if(!n||!n.current)return;const a=n.getValue(s);a&&a.jump(this.measuredOrigin,!1);const o=i.length-1,l=i[o];i[o]=Br[s](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,d])=>{n.getValue(c).set(d)}),this.resolveNoneKeyframes()}}const cm=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(as.test(e)||e==="0")&&!e.startsWith("url("));function pN(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function mN(e,t,n,s){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const a=e[e.length-1],o=cm(i,t),l=cm(a,t);return!o||!l?!1:pN(e)||(n==="spring"||Bh(n))&&s}const gN=e=>e!==null;function Pl(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(gN),a=t&&n!=="loop"&&t%2===1?0:i.length-1;return!a||s===void 0?i[a]:s}const xN=40;class C1{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=un.now(),this.options={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:a,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>xN?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&dN(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=un.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:a,delay:o,onComplete:l,onUpdate:c,isGenerator:d}=this.options;if(!d&&!mN(t,s,i,a))if(o)this.options.duration=0;else{c&&c(Pl(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const u=this.initPlayback(t,n);u!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...u},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Se=(e,t,n)=>e+(t-e)*n;function wc(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yN({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=wc(c,l,e+1/3),a=wc(c,l,e),o=wc(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:s}}function tl(e,t){return n=>n>0?t:e}const kc=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},vN=[Qd,Es,yr],bN=e=>vN.find(t=>t.test(e));function dm(e){const t=bN(e);if(!t)return!1;let n=t.parse(e);return t===yr&&(n=yN(n)),n}const um=(e,t)=>{const n=dm(e),s=dm(t);if(!n||!s)return tl(e,t);const i={...n};return a=>(i.red=kc(n.red,s.red,a),i.green=kc(n.green,s.green,a),i.blue=kc(n.blue,s.blue,a),i.alpha=Se(n.alpha,s.alpha,a),Es.transform(i))},wN=(e,t)=>n=>t(e(n)),xa=(...e)=>e.reduce(wN),tu=new Set(["none","hidden"]);function kN(e,t){return tu.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function jN(e,t){return n=>Se(e,t,n)}function Qh(e){return typeof e=="number"?jN:typeof e=="string"?Ah(e)?tl:Je.test(e)?um:CN:Array.isArray(e)?E1:typeof e=="object"?Je.test(e)?um:NN:tl}function E1(e,t){const n=[...e],s=n.length,i=e.map((a,o)=>Qh(a)(a,t[o]));return a=>{for(let o=0;o<s;o++)n[o]=i[o](a);return n}}function NN(e,t){const n={...e,...t},s={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(s[i]=Qh(e[i])(e[i],t[i]));return i=>{for(const a in s)n[a]=s[a](i);return n}}function SN(e,t){var n;const s=[],i={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],l=e.indexes[o][i[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;s[a]=c,i[o]++}return s}const CN=(e,t)=>{const n=as.createTransformer(t),s=ra(e),i=ra(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?tu.has(e)&&!i.values.length||tu.has(t)&&!s.values.length?kN(e,t):xa(E1(SN(s,i),i.values),n):tl(e,t)};function _1(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Se(e,t,n):Qh(e)(e,t)}const EN=5;function T1(e,t,n){const s=Math.max(t-EN,0);return n1(n-e(s),t-s)}const _e={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},jc=.001;function _N({duration:e=_e.duration,bounce:t=_e.bounce,velocity:n=_e.velocity,mass:s=_e.mass}){let i,a,o=1-t;o=_n(_e.minDamping,_e.maxDamping,o),e=_n(_e.minDuration,_e.maxDuration,jn(e)),o<1?(i=d=>{const u=d*o,p=u*e,f=u-n,m=nu(d,o),b=Math.exp(-p);return jc-f/m*b},a=d=>{const p=d*o*e,f=p*n+n,m=Math.pow(o,2)*Math.pow(d,2)*e,b=Math.exp(-p),v=nu(Math.pow(d,2),o);return(-i(d)+jc>0?-1:1)*((f-m)*b)/v}):(i=d=>{const u=Math.exp(-d*e),p=(d-n)*e+1;return-jc+u*p},a=d=>{const u=Math.exp(-d*e),p=(n-d)*(e*e);return u*p});const l=5/e,c=PN(i,a,l);if(e=kn(e),isNaN(c))return{stiffness:_e.stiffness,damping:_e.damping,duration:e};{const d=Math.pow(c,2)*s;return{stiffness:d,damping:o*2*Math.sqrt(s*d),duration:e}}}const TN=12;function PN(e,t,n){let s=n;for(let i=1;i<TN;i++)s=s-e(s)/t(s);return s}function nu(e,t){return e*Math.sqrt(1-t*t)}const AN=["duration","bounce"],MN=["stiffness","damping","mass"];function hm(e,t){return t.some(n=>e[n]!==void 0)}function RN(e){let t={velocity:_e.velocity,stiffness:_e.stiffness,damping:_e.damping,mass:_e.mass,isResolvedFromDuration:!1,...e};if(!hm(e,MN)&&hm(e,AN))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,a=2*_n(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:_e.mass,stiffness:i,damping:a}}else{const n=_N(e);t={...t,...n,mass:_e.mass},t.isResolvedFromDuration=!0}return t}function P1(e=_e.visualDuration,t=_e.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:d,mass:u,duration:p,velocity:f,isResolvedFromDuration:m}=RN({...n,velocity:-jn(n.velocity||0)}),b=f||0,v=d/(2*Math.sqrt(c*u)),y=o-a,g=jn(Math.sqrt(c/u)),x=Math.abs(y)<5;s||(s=x?_e.restSpeed.granular:_e.restSpeed.default),i||(i=x?_e.restDelta.granular:_e.restDelta.default);let w;if(v<1){const k=nu(g,v);w=N=>{const S=Math.exp(-v*g*N);return o-S*((b+v*g*y)/k*Math.sin(k*N)+y*Math.cos(k*N))}}else if(v===1)w=k=>o-Math.exp(-g*k)*(y+(b+g*y)*k);else{const k=g*Math.sqrt(v*v-1);w=N=>{const S=Math.exp(-v*g*N),_=Math.min(k*N,300);return o-S*((b+v*g*y)*Math.sinh(_)+k*y*Math.cosh(_))/k}}const j={calculatedDuration:m&&p||null,next:k=>{const N=w(k);if(m)l.done=k>=p;else{let S=0;v<1&&(S=k===0?kn(b):T1(w,k,N));const _=Math.abs(S)<=s,R=Math.abs(o-N)<=i;l.done=_&&R}return l.value=l.done?o:N,l},toString:()=>{const k=Math.min(qy(j),qd),N=Yy(S=>j.next(k*S).value,k,30);return k+"ms "+N}};return j}function fm({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:c,restDelta:d=.5,restSpeed:u}){const p=e[0],f={done:!1,value:p},m=_=>l!==void 0&&_<l||c!==void 0&&_>c,b=_=>l===void 0?c:c===void 0||Math.abs(l-_)<Math.abs(c-_)?l:c;let v=n*t;const y=p+v,g=o===void 0?y:o(y);g!==y&&(v=g-p);const x=_=>-v*Math.exp(-_/s),w=_=>g+x(_),j=_=>{const R=x(_),L=w(_);f.done=Math.abs(R)<=d,f.value=f.done?g:L};let k,N;const S=_=>{m(f.value)&&(k=_,N=P1({keyframes:[f.value,b(f.value)],velocity:T1(w,_,f.value),damping:i,stiffness:a,restDelta:d,restSpeed:u}))};return S(0),{calculatedDuration:null,next:_=>{let R=!1;return!N&&k===void 0&&(R=!0,j(_),S(_)),k!==void 0&&_>=k?N.next(_-k):(!R&&j(_),f)}}}const zN=ga(.42,0,1,1),LN=ga(0,0,.58,1),A1=ga(.42,0,.58,1),ON=e=>Array.isArray(e)&&typeof e[0]!="number",DN={linear:bt,easeIn:zN,easeInOut:A1,easeOut:LN,circIn:Kh,circInOut:u1,circOut:d1,backIn:Wh,backInOut:l1,backOut:o1,anticipate:c1},pm=e=>{if(Fh(e)){Ey(e.length===4);const[t,n,s,i]=e;return ga(t,n,s,i)}else if(typeof e=="string")return DN[e];return e};function IN(e,t,n){const s=[],i=n||_1,a=e.length-1;for(let o=0;o<a;o++){let l=i(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||bt:t;l=xa(c,l)}s.push(l)}return s}function BN(e,t,{clamp:n=!0,ease:s,mixer:i}={}){const a=e.length;if(Ey(a===t.length),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=IN(t,s,i),c=l.length,d=u=>{if(o&&u<e[0])return t[0];let p=0;if(c>1)for(;p<e.length-2&&!(u<e[p+1]);p++);const f=Dr(e[p],e[p+1],u);return l[p](f)};return n?u=>d(_n(e[0],e[a-1],u)):d}function FN(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=Dr(0,t,s);e.push(Se(n,1,i))}}function VN(e){const t=[0];return FN(t,e.length-1),t}function $N(e,t){return e.map(n=>n*t)}function UN(e,t){return e.map(()=>t||A1).splice(0,e.length-1)}function nl({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=ON(s)?s.map(pm):pm(s),a={done:!1,value:t[0]},o=$N(n&&n.length===t.length?n:VN(t),e),l=BN(o,t,{ease:Array.isArray(i)?i:UN(t,i)});return{calculatedDuration:e,next:c=>(a.value=l(c),a.done=c>=e,a)}}const HN=e=>{const t=({timestamp:n})=>e(n);return{start:()=>we.update(t,!0),stop:()=>is(t),now:()=>Ke.isProcessing?Ke.timestamp:un.now()}},WN={decay:fm,inertia:fm,tween:nl,keyframes:nl,spring:P1},KN=e=>e/100;class Jh extends C1{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:s,element:i,keyframes:a}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Xh,l=(c,d)=>this.onKeyframesResolved(c,d);this.resolver=new o(a,l,n,s,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=this.options,l=Bh(n)?n:WN[n]||nl;let c,d;l!==nl&&typeof t[0]!="number"&&(c=xa(KN,_1(t[0],t[1])),t=[0,100]);const u=l({...this.options,keyframes:t});a==="mirror"&&(d=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=qy(u));const{calculatedDuration:p}=u,f=p+i,m=f*(s+1)-i;return{generator:u,mirroredGenerator:d,mapPercentToKeyframes:c,calculatedDuration:p,resolvedDuration:f,totalDuration:m}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:s}=this;if(!s){const{keyframes:_}=this.options;return{done:!0,value:_[_.length-1]}}const{finalKeyframe:i,generator:a,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:d,totalDuration:u,resolvedDuration:p}=s;if(this.startTime===null)return a.next(0);const{delay:f,repeat:m,repeatType:b,repeatDelay:v,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-f*(this.speed>=0?1:-1),x=this.speed>=0?g<0:g>u;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let w=this.currentTime,j=a;if(m){const _=Math.min(this.currentTime,u)/p;let R=Math.floor(_),L=_%1;!L&&_>=1&&(L=1),L===1&&R--,R=Math.min(R,m+1),!!(R%2)&&(b==="reverse"?(L=1-L,v&&(L-=v/p)):b==="mirror"&&(j=o)),w=_n(0,1,L)*p}const k=x?{done:!1,value:c[0]}:j.next(w);l&&(k.value=l(k.value));let{done:N}=k;!x&&d!==null&&(N=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return S&&i!==void 0&&(k.value=Pl(c,this.options,i)),y&&y(k.value),S&&this.finish(),k}get duration(){const{resolved:t}=this;return t?jn(t.calculatedDuration):0}get time(){return jn(this.currentTime)}set time(t){t=kn(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=jn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=HN,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=s??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const GN=new Set(["opacity","clipPath","filter","transform"]);function qN(e,t,n,{delay:s=0,duration:i=300,repeat:a=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const d={[t]:n};c&&(d.offset=c);const u=Qy(l,i);return Array.isArray(u)&&(d.easing=u),e.animate(d,{delay:s,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"})}const YN=Nh(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),sl=10,XN=2e4;function QN(e){return Bh(e.type)||e.type==="spring"||!Xy(e.ease)}function JN(e,t){const n=new Jh({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:e[0]};const i=[];let a=0;for(;!s.done&&a<XN;)s=n.sample(a),i.push(s.value),a+=sl;return{times:void 0,keyframes:i,duration:a-sl,ease:"linear"}}const M1={anticipate:c1,backInOut:l1,circInOut:u1};function ZN(e){return e in M1}class mm extends C1{constructor(t){super(t);const{name:n,motionValue:s,element:i,keyframes:a}=this.options;this.resolver=new S1(a,(o,l)=>this.onKeyframesResolved(o,l),n,s,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:s=300,times:i,ease:a,type:o,motionValue:l,name:c,startTime:d}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof a=="string"&&el()&&ZN(a)&&(a=M1[a]),QN(this.options)){const{onComplete:p,onUpdate:f,motionValue:m,element:b,...v}=this.options,y=JN(t,v);t=y.keyframes,t.length===1&&(t[1]=t[0]),s=y.duration,i=y.times,a=y.ease,o="keyframes"}const u=qN(l.owner.current,c,t,{...this.options,duration:s,times:i,ease:a});return u.startTime=d??this.calcStartTime(),this.pendingTimeline?(Zp(u,this.pendingTimeline),this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:p}=this.options;l.set(Pl(t,this.options,n)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:i,type:o,ease:a,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return jn(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return jn(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=kn(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return bt;const{animation:s}=n;Zp(s,t)}return bt}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:s,duration:i,type:a,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:u,onComplete:p,element:f,...m}=this.options,b=new Jh({...m,keyframes:s,duration:i,type:a,ease:o,times:l,isGenerator:!0}),v=kn(this.time);d.setWithVelocity(b.sample(v-sl).value,b.sample(v).value,sl)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:s,repeatDelay:i,repeatType:a,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=n.owner.getProps();return YN()&&s&&GN.has(s)&&!c&&!d&&!i&&a!=="mirror"&&o!==0&&l!=="inertia"}}const eS={type:"spring",stiffness:500,damping:25,restSpeed:10},tS=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),nS={type:"keyframes",duration:.8},sS={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rS=(e,{keyframes:t})=>t.length>2?nS:Us.has(e)?e.startsWith("scale")?tS(t[1]):eS:sS;function iS({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const Zh=(e,t,n,s={},i,a)=>o=>{const l=Ih(s,e)||{},c=l.delay||s.delay||0;let{elapsed:d=0}=s;d=d-kn(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:f=>{t.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:a?void 0:i};iS(l)||(u={...u,...rS(e,u)}),u.duration&&(u.duration=kn(u.duration)),u.repeatDelay&&(u.repeatDelay=kn(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let p=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(p=!0)),p&&!a&&t.get()!==void 0){const f=Pl(u.keyframes,l);if(f!==void 0)return we.update(()=>{u.onUpdate(f),u.onComplete()}),new Nj([])}return!a&&mm.supports(u)?new mm(u):new Jh(u)};function aS({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function R1(e,t,{delay:n=0,transitionOverride:s,type:i}={}){var a;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;s&&(o=s);const d=[],u=i&&e.animationState&&e.animationState.getState()[i];for(const p in c){const f=e.getValue(p,(a=e.latestValues[p])!==null&&a!==void 0?a:null),m=c[p];if(m===void 0||u&&aS(u,p))continue;const b={delay:n,...Ih(o||{},p)};let v=!1;if(window.MotionHandoffAnimation){const g=s1(e);if(g){const x=window.MotionHandoffAnimation(g,p,we);x!==null&&(b.startTime=x,v=!0)}}Xd(e,p),f.start(Zh(p,f,m,e.shouldReduceMotion&&t1.has(p)?{type:!1}:b,e,v));const y=f.animation;y&&d.push(y)}return l&&Promise.all(d).then(()=>{we.update(()=>{l&&Ij(e,l)})}),d}function su(e,t,n={}){var s;const i=Tl(e,t,n.type==="exit"?(s=e.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(a=n.transitionOverride);const o=i?()=>Promise.all(R1(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:p,staggerDirection:f}=a;return oS(e,t,u+d,p,f,n)}:()=>Promise.resolve(),{when:c}=a;if(c){const[d,u]=c==="beforeChildren"?[o,l]:[l,o];return d().then(()=>u())}else return Promise.all([o(),l(n.delay)])}function oS(e,t,n=0,s=0,i=1,a){const o=[],l=(e.variantChildren.size-1)*s,c=i===1?(d=0)=>d*s:(d=0)=>l-d*s;return Array.from(e.variantChildren).sort(lS).forEach((d,u)=>{d.notify("AnimationStart",t),o.push(su(d,t,{...a,delay:n+c(u)}).then(()=>d.notify("AnimationComplete",t)))}),Promise.all(o)}function lS(e,t){return e.sortNodePosition(t)}function cS(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(a=>su(e,a,n));s=Promise.all(i)}else if(typeof t=="string")s=su(e,t,n);else{const i=typeof t=="function"?Tl(e,t,n.custom):t;s=Promise.all(R1(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const dS=Ch.length;function z1(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?z1(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<dS;n++){const s=Ch[n],i=e.props[s];(ta(i)||i===!1)&&(t[s]=i)}return t}const uS=[...Sh].reverse(),hS=Sh.length;function fS(e){return t=>Promise.all(t.map(({animation:n,options:s})=>cS(e,n,s)))}function pS(e){let t=fS(e),n=gm(),s=!0;const i=c=>(d,u)=>{var p;const f=Tl(e,u,c==="exit"?(p=e.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(f){const{transition:m,transitionEnd:b,...v}=f;d={...d,...v,...b}}return d};function a(c){t=c(e)}function o(c){const{props:d}=e,u=z1(e.parent)||{},p=[],f=new Set;let m={},b=1/0;for(let y=0;y<hS;y++){const g=uS[y],x=n[g],w=d[g]!==void 0?d[g]:u[g],j=ta(w),k=g===c?x.isActive:null;k===!1&&(b=y);let N=w===u[g]&&w!==d[g]&&j;if(N&&s&&e.manuallyAnimateOnMount&&(N=!1),x.protectedKeys={...m},!x.isActive&&k===null||!w&&!x.prevProp||El(w)||typeof w=="boolean")continue;const S=mS(x.prevProp,w);let _=S||g===c&&x.isActive&&!N&&j||y>b&&j,R=!1;const L=Array.isArray(w)?w:[w];let P=L.reduce(i(g),{});k===!1&&(P={});const{prevResolvedValues:V={}}=x,M={...V,...P},B=F=>{_=!0,f.has(F)&&(R=!0,f.delete(F)),x.needsAnimating[F]=!0;const C=e.getValue(F);C&&(C.liveStyle=!1)};for(const F in M){const C=P[F],E=V[F];if(m.hasOwnProperty(F))continue;let z=!1;Gd(C)&&Gd(E)?z=!Gy(C,E):z=C!==E,z?C!=null?B(F):f.add(F):C!==void 0&&f.has(F)?B(F):x.protectedKeys[F]=!0}x.prevProp=w,x.prevResolvedValues=P,x.isActive&&(m={...m,...P}),s&&e.blockInitialAnimation&&(_=!1),_&&(!(N&&S)||R)&&p.push(...L.map(F=>({animation:F,options:{type:g}})))}if(f.size){const y={};f.forEach(g=>{const x=e.getBaseTarget(g),w=e.getValue(g);w&&(w.liveStyle=!0),y[g]=x??null}),p.push({animation:y})}let v=!!p.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(v=!1),s=!1,v?t(p):Promise.resolve()}function l(c,d){var u;if(n[c].isActive===d)return Promise.resolve();(u=e.variantChildren)===null||u===void 0||u.forEach(f=>{var m;return(m=f.animationState)===null||m===void 0?void 0:m.setActive(c,d)}),n[c].isActive=d;const p=o(c);for(const f in n)n[f].protectedKeys={};return p}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=gm(),s=!0}}}function mS(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Gy(t,e):!1}function ys(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function gm(){return{animate:ys(!0),whileInView:ys(),whileHover:ys(),whileTap:ys(),whileDrag:ys(),whileFocus:ys(),exit:ys()}}class ps{constructor(t){this.isMounted=!1,this.node=t}update(){}}class gS extends ps{constructor(t){super(t),t.animationState||(t.animationState=pS(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();El(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let xS=0;class yS extends ps{constructor(){super(...arguments),this.id=xS++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const vS={animation:{Feature:gS},exit:{Feature:yS}};function ia(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function ya(e){return{point:{x:e.pageX,y:e.pageY}}}const bS=e=>t=>Vh(t)&&e(t,ya(t));function Pi(e,t,n,s){return ia(e,t,bS(n),s)}const xm=(e,t)=>Math.abs(e-t);function wS(e,t){const n=xm(e.x,t.x),s=xm(e.y,t.y);return Math.sqrt(n**2+s**2)}class L1{constructor(t,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:a=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=Sc(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,m=wS(p.offset,{x:0,y:0})>=3;if(!f&&!m)return;const{point:b}=p,{timestamp:v}=Ke;this.history.push({...b,timestamp:v});const{onStart:y,onMove:g}=this.handlers;f||(y&&y(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,p)},this.handlePointerMove=(p,f)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=Nc(f,this.transformPagePoint),we.update(this.updatePoint,!0)},this.handlePointerUp=(p,f)=>{this.end();const{onEnd:m,onSessionEnd:b,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=Sc(p.type==="pointercancel"?this.lastMoveEventInfo:Nc(f,this.transformPagePoint),this.history);this.startEvent&&m&&m(p,y),b&&b(p,y)},!Vh(t))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const o=ya(t),l=Nc(o,this.transformPagePoint),{point:c}=l,{timestamp:d}=Ke;this.history=[{...c,timestamp:d}];const{onSessionStart:u}=n;u&&u(t,Sc(l,this.history)),this.removeListeners=xa(Pi(this.contextWindow,"pointermove",this.handlePointerMove),Pi(this.contextWindow,"pointerup",this.handlePointerUp),Pi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),is(this.updatePoint)}}function Nc(e,t){return t?{point:t(e.point)}:e}function ym(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Sc({point:e},t){return{point:e,delta:ym(e,O1(t)),offset:ym(e,kS(t)),velocity:jS(t,.1)}}function kS(e){return e[0]}function O1(e){return e[e.length-1]}function jS(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=O1(e);for(;n>=0&&(s=e[n],!(i.timestamp-s.timestamp>kn(t)));)n--;if(!s)return{x:0,y:0};const a=jn(i.timestamp-s.timestamp);if(a===0)return{x:0,y:0};const o={x:(i.x-s.x)/a,y:(i.y-s.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const D1=1e-4,NS=1-D1,SS=1+D1,I1=.01,CS=0-I1,ES=0+I1;function kt(e){return e.max-e.min}function _S(e,t,n){return Math.abs(e-t)<=n}function vm(e,t,n,s=.5){e.origin=s,e.originPoint=Se(t.min,t.max,e.origin),e.scale=kt(n)/kt(t),e.translate=Se(n.min,n.max,e.origin)-e.originPoint,(e.scale>=NS&&e.scale<=SS||isNaN(e.scale))&&(e.scale=1),(e.translate>=CS&&e.translate<=ES||isNaN(e.translate))&&(e.translate=0)}function Ai(e,t,n,s){vm(e.x,t.x,n.x,s?s.originX:void 0),vm(e.y,t.y,n.y,s?s.originY:void 0)}function bm(e,t,n){e.min=n.min+t.min,e.max=e.min+kt(t)}function TS(e,t,n){bm(e.x,t.x,n.x),bm(e.y,t.y,n.y)}function wm(e,t,n){e.min=t.min-n.min,e.max=e.min+kt(t)}function Mi(e,t,n){wm(e.x,t.x,n.x),wm(e.y,t.y,n.y)}function PS(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?Se(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?Se(n,e,s.max):Math.min(e,n)),e}function km(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function AS(e,{top:t,left:n,bottom:s,right:i}){return{x:km(e.x,n,i),y:km(e.y,t,s)}}function jm(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function MS(e,t){return{x:jm(e.x,t.x),y:jm(e.y,t.y)}}function RS(e,t){let n=.5;const s=kt(e),i=kt(t);return i>s?n=Dr(t.min,t.max-s,e.min):s>i&&(n=Dr(e.min,e.max-i,t.min)),_n(0,1,n)}function zS(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ru=.35;function LS(e=ru){return e===!1?e=0:e===!0&&(e=ru),{x:Nm(e,"left","right"),y:Nm(e,"top","bottom")}}function Nm(e,t,n){return{min:Sm(e,t),max:Sm(e,n)}}function Sm(e,t){return typeof e=="number"?e:e[t]||0}const Cm=()=>({translate:0,scale:1,origin:0,originPoint:0}),vr=()=>({x:Cm(),y:Cm()}),Em=()=>({min:0,max:0}),Ae=()=>({x:Em(),y:Em()});function Ct(e){return[e("x"),e("y")]}function B1({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function OS({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function DS(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Cc(e){return e===void 0||e===1}function iu({scale:e,scaleX:t,scaleY:n}){return!Cc(e)||!Cc(t)||!Cc(n)}function ks(e){return iu(e)||F1(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function F1(e){return _m(e.x)||_m(e.y)}function _m(e){return e&&e!=="0%"}function rl(e,t,n){const s=e-n,i=t*s;return n+i}function Tm(e,t,n,s,i){return i!==void 0&&(e=rl(e,i,s)),rl(e,n,s)+t}function au(e,t=0,n=1,s,i){e.min=Tm(e.min,t,n,s,i),e.max=Tm(e.max,t,n,s,i)}function V1(e,{x:t,y:n}){au(e.x,t.translate,t.scale,t.originPoint),au(e.y,n.translate,n.scale,n.originPoint)}const Pm=.999999999999,Am=1.0000000000001;function IS(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let l=0;l<i;l++){a=n[l],o=a.projectionDelta;const{visualElement:c}=a.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&a.options.layoutScroll&&a.scroll&&a!==a.root&&wr(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,V1(e,o)),s&&ks(a.latestValues)&&wr(e,a.latestValues))}t.x<Am&&t.x>Pm&&(t.x=1),t.y<Am&&t.y>Pm&&(t.y=1)}function br(e,t){e.min=e.min+t,e.max=e.max+t}function Mm(e,t,n,s,i=.5){const a=Se(e.min,e.max,i);au(e,t,n,a,s)}function wr(e,t){Mm(e.x,t.x,t.scaleX,t.scale,t.originX),Mm(e.y,t.y,t.scaleY,t.scale,t.originY)}function $1(e,t){return B1(DS(e.getBoundingClientRect(),t))}function BS(e,t,n){const s=$1(e,n),{scroll:i}=t;return i&&(br(s.x,i.offset.x),br(s.y,i.offset.y)),s}const U1=({current:e})=>e?e.ownerDocument.defaultView:null,FS=new WeakMap;class VS{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ae(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=u=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ya(u).point)},a=(u,p)=>{const{drag:f,dragPropagation:m,onDragStart:b}=this.getProps();if(f&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Rj(f),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ct(y=>{let g=this.getAxisMotionValue(y).get()||0;if(dn.test(g)){const{projection:x}=this.visualElement;if(x&&x.layout){const w=x.layout.layoutBox[y];w&&(g=kt(w)*(parseFloat(g)/100))}}this.originPoint[y]=g}),b&&we.postRender(()=>b(u,p)),Xd(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(u,p)=>{const{dragPropagation:f,dragDirectionLock:m,onDirectionLock:b,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:y}=p;if(m&&this.currentDirection===null){this.currentDirection=$S(y),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",p.point,y),this.updateAxis("y",p.point,y),this.visualElement.render(),v&&v(u,p)},l=(u,p)=>this.stop(u,p),c=()=>Ct(u=>{var p;return this.getAnimationState(u)==="paused"&&((p=this.getAxisMotionValue(u).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new L1(t,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:U1(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&we.postRender(()=>a(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:i}=this.getProps();if(!s||!Ka(t,i,this.currentDirection))return;const a=this.getAxisMotionValue(t);let o=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(o=PS(o,this.constraints[t],this.elastic[t])),a.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:s}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,a=this.constraints;n&&xr(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=AS(i.layoutBox,n):this.constraints=!1,this.elastic=LS(s),a!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Ct(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=zS(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!xr(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=BS(s,i.root,this.visualElement.getTransformPagePoint());let o=MS(i.layout.layoutBox,a);if(n){const l=n(OS(o));this.hasMutatedConstraints=!!l,l&&(o=B1(l))}return o}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=Ct(u=>{if(!Ka(u,n,this.currentDirection))return;let p=c&&c[u]||{};o&&(p={min:0,max:0});const f=i?200:1e6,m=i?40:1e7,b={type:"inertia",velocity:s?t[u]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...a,...p};return this.startAxisValueAnimation(u,b)});return Promise.all(d).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return Xd(this.visualElement,t),s.start(Zh(t,s,0,n,this.visualElement,!1))}stopAnimation(){Ct(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ct(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Ct(n=>{const{drag:s}=this.getProps();if(!Ka(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:l}=i.layout.layoutBox[n];a.set(t[n]-Se(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!xr(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ct(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();i[o]=RS({min:c,max:c},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Ct(o=>{if(!Ka(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:d}=this.constraints[o];l.set(Se(c,d,i[o]))})}addListeners(){if(!this.visualElement.current)return;FS.set(this.visualElement,this);const t=this.visualElement.current,n=Pi(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();xr(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,a=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),we.read(s);const o=ia(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(Ct(u=>{const p=this.getAxisMotionValue(u);p&&(this.originPoint[u]+=c[u].translate,p.set(p.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),a(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:o=ru,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function Ka(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function $S(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class US extends ps{constructor(t){super(t),this.removeGroupControls=bt,this.removeListeners=bt,this.controls=new VS(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||bt}unmount(){this.removeGroupControls(),this.removeListeners()}}const Rm=e=>(t,n)=>{e&&we.postRender(()=>e(t,n))};class HS extends ps{constructor(){super(...arguments),this.removePointerDownListener=bt}onPointerDown(t){this.session=new L1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:U1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:Rm(t),onStart:Rm(n),onMove:s,onEnd:(a,o)=>{delete this.session,i&&we.postRender(()=>i(a,o))}}}mount(){this.removePointerDownListener=Pi(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const vo={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function zm(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const oi={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(te.test(e))e=parseFloat(e);else return e;const n=zm(e,t.target.x),s=zm(e,t.target.y);return`${n}% ${s}%`}},WS={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=as.parse(e);if(i.length>5)return s;const a=as.createTransformer(e),o=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=l,i[1+o]/=c;const d=Se(l,c,.5);return typeof i[2+o]=="number"&&(i[2+o]/=d),typeof i[3+o]=="number"&&(i[3+o]/=d),a(i)}};class KS extends h.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:a}=t;hj(GS),a&&(n.group&&n.group.add(a),s&&s.register&&i&&s.register(a),a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),vo.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:i,isPresent:a}=this.props,o=s.projection;return o&&(o.isPresent=a,i||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?o.promote():o.relegate()||we.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),_h.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function H1(e){const[t,n]=Sy(),s=h.useContext(kh);return r.jsx(KS,{...e,layoutGroup:s,switchLayoutGroup:h.useContext(zy),isPresent:t,safeToRemove:n})}const GS={borderRadius:{...oi,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:oi,borderTopRightRadius:oi,borderBottomLeftRadius:oi,borderBottomRightRadius:oi,boxShadow:WS};function qS(e,t,n){const s=tt(e)?e:sa(e);return s.start(Zh("",s,t,n)),s.animation}function YS(e){return e instanceof SVGElement&&e.tagName!=="svg"}const XS=(e,t)=>e.depth-t.depth;class QS{constructor(){this.children=[],this.isDirty=!1}add(t){$h(this.children,t),this.isDirty=!0}remove(t){Uh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(XS),this.isDirty=!1,this.children.forEach(t)}}function JS(e,t){const n=un.now(),s=({timestamp:i})=>{const a=i-n;a>=t&&(is(s),e(a-t))};return we.read(s,!0),()=>is(s)}const W1=["TopLeft","TopRight","BottomLeft","BottomRight"],ZS=W1.length,Lm=e=>typeof e=="string"?parseFloat(e):e,Om=e=>typeof e=="number"||te.test(e);function e4(e,t,n,s,i,a){i?(e.opacity=Se(0,n.opacity!==void 0?n.opacity:1,t4(s)),e.opacityExit=Se(t.opacity!==void 0?t.opacity:1,0,n4(s))):a&&(e.opacity=Se(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;o<ZS;o++){const l=`border${W1[o]}Radius`;let c=Dm(t,l),d=Dm(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||Om(c)===Om(d)?(e[l]=Math.max(Se(Lm(c),Lm(d),s),0),(dn.test(d)||dn.test(c))&&(e[l]+="%")):e[l]=d}(t.rotate||n.rotate)&&(e.rotate=Se(t.rotate||0,n.rotate||0,s))}function Dm(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const t4=K1(0,.5,d1),n4=K1(.5,.95,bt);function K1(e,t,n){return s=>s<e?0:s>t?1:n(Dr(e,t,s))}function Im(e,t){e.min=t.min,e.max=t.max}function St(e,t){Im(e.x,t.x),Im(e.y,t.y)}function Bm(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Fm(e,t,n,s,i){return e-=t,e=rl(e,1/n,s),i!==void 0&&(e=rl(e,1/i,s)),e}function s4(e,t=0,n=1,s=.5,i,a=e,o=e){if(dn.test(t)&&(t=parseFloat(t),t=Se(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Se(a.min,a.max,s);e===a&&(l-=t),e.min=Fm(e.min,t,n,l,i),e.max=Fm(e.max,t,n,l,i)}function Vm(e,t,[n,s,i],a,o){s4(e,t[n],t[s],t[i],t.scale,a,o)}const r4=["x","scaleX","originX"],i4=["y","scaleY","originY"];function $m(e,t,n,s){Vm(e.x,t,r4,n?n.x:void 0,s?s.x:void 0),Vm(e.y,t,i4,n?n.y:void 0,s?s.y:void 0)}function Um(e){return e.translate===0&&e.scale===1}function G1(e){return Um(e.x)&&Um(e.y)}function Hm(e,t){return e.min===t.min&&e.max===t.max}function a4(e,t){return Hm(e.x,t.x)&&Hm(e.y,t.y)}function Wm(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function q1(e,t){return Wm(e.x,t.x)&&Wm(e.y,t.y)}function Km(e){return kt(e.x)/kt(e.y)}function Gm(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class o4{constructor(){this.members=[]}add(t){$h(this.members,t),t.scheduleRender()}remove(t){if(Uh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const a=this.members[i];if(a.isPresent!==!1){s=a;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function l4(e,t,n){let s="";const i=e.x.translate/t.x,a=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||a||o)&&(s=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:p,rotateY:f,skewX:m,skewY:b}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),p&&(s+=`rotateX(${p}deg) `),f&&(s+=`rotateY(${f}deg) `),m&&(s+=`skewX(${m}deg) `),b&&(s+=`skewY(${b}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const js={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},gi=typeof window<"u"&&window.MotionDebug!==void 0,Ec=["","X","Y","Z"],c4={visibility:"hidden"},qm=1e3;let d4=0;function _c(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function Y1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=s1(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",we,!(i||a))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&Y1(s)}function X1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o={},l=t==null?void 0:t()){this.id=d4++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,gi&&(js.totalNodes=js.resolvedTargetDeltas=js.recalculatedProjection=0),this.nodes.forEach(f4),this.nodes.forEach(y4),this.nodes.forEach(v4),this.nodes.forEach(p4),gi&&window.MotionDebug.record(js)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new QS)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Hh),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=YS(o),this.instance=o;const{layoutId:c,layout:d,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(d||c)&&(this.isLayoutDirty=!0),e){let p;const f=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=JS(f,250),vo.hasAnimatedSinceResize&&(vo.hasAnimatedSinceResize=!1,this.nodes.forEach(Xm))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||d)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:f,hasRelativeTargetChanged:m,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||u.getDefaultTransition()||N4,{onLayoutAnimationStart:y,onLayoutAnimationComplete:g}=u.getProps(),x=!this.targetLayout||!q1(this.targetLayout,b)||m,w=!f&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||f&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,w);const j={...Ih(v,"layout"),onPlay:y,onComplete:g};(u.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j)}else f||Xm(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,is(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(b4),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Y1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const p=this.path[u];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ym);return}this.isUpdating||this.nodes.forEach(g4),this.isUpdating=!1,this.nodes.forEach(x4),this.nodes.forEach(u4),this.nodes.forEach(h4),this.clearAllSnapshots();const l=un.now();Ke.delta=_n(0,1e3/60,l-Ke.timestamp),Ke.timestamp=l,Ke.isProcessing=!0,yc.update.process(Ke),yc.preRender.process(Ke),yc.render.process(Ke),Ke.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,_h.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(m4),this.sharedNodes.forEach(w4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,we.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){we.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ae(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!G1(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;o&&(l||ks(this.latestValues)||u)&&(i(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),S4(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return Ae();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(C4))){const{scroll:u}=this.root;u&&(br(c.x,u.offset.x),br(c.y,u.offset.y))}return c}removeElementScroll(o){var l;const c=Ae();if(St(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:p,options:f}=u;u!==this.root&&p&&f.layoutScroll&&(p.wasRoot&&St(c,o),br(c.x,p.offset.x),br(c.y,p.offset.y))}return c}applyTransform(o,l=!1){const c=Ae();St(c,o);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&wr(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),ks(u.latestValues)&&wr(c,u.latestValues)}return ks(this.latestValues)&&wr(c,this.latestValues),c}removeTransform(o){const l=Ae();St(l,o);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!ks(d.latestValues))continue;iu(d.latestValues)&&d.updateSnapshot();const u=Ae(),p=d.measurePageBox();St(u,p),$m(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return ks(this.latestValues)&&$m(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ke.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(o||d&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:f}=this.options;if(!(!this.layout||!(p||f))){if(this.resolvedRelativeTargetAt=Ke.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ae(),this.relativeTargetOrigin=Ae(),Mi(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),St(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ae(),this.targetWithTransforms=Ae()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),TS(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):St(this.target,this.layout.layoutBox),V1(this.target,this.targetDelta)):St(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const m=this.getClosestProjectingParent();m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ae(),this.relativeTargetOrigin=Ae(),Mi(this.relativeTargetOrigin,this.target,m.target),St(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}gi&&js.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||iu(this.parent.latestValues)||F1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===Ke.timestamp&&(d=!1),d)return;const{layout:u,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||p))return;St(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;IS(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Ae());const{target:b}=l;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Bm(this.prevProjectionDelta.x,this.projectionDelta.x),Bm(this.prevProjectionDelta.y,this.projectionDelta.y)),Ai(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!Gm(this.projectionDelta.x,this.prevProjectionDelta.x)||!Gm(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),gi&&js.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=vr(),this.projectionDelta=vr(),this.projectionDeltaWithTransform=vr()}setAnimationOrigin(o,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},p=vr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=Ae(),m=c?c.source:void 0,b=this.layout?this.layout.source:void 0,v=m!==b,y=this.getStack(),g=!y||y.members.length<=1,x=!!(v&&!g&&this.options.crossfade===!0&&!this.path.some(j4));this.animationProgress=0;let w;this.mixTargetDelta=j=>{const k=j/1e3;Qm(p.x,o.x,k),Qm(p.y,o.y,k),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Mi(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),k4(this.relativeTarget,this.relativeTargetOrigin,f,k),w&&a4(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Ae()),St(w,this.relativeTarget)),v&&(this.animationValues=u,e4(u,d,this.latestValues,k,x,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(is(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=we.update(()=>{vo.hasAnimatedSinceResize=!0,this.currentAnimation=qS(0,qm,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(qm),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=o;if(!(!l||!c||!d)){if(this!==o&&this.layout&&d&&Q1(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||Ae();const p=kt(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+p;const f=kt(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+f}St(l,c),wr(l,u),Ai(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new o4),this.sharedNodes.get(o).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&_c("z",o,d,this.animationValues);for(let u=0;u<Ec.length;u++)_c(`rotate${Ec[u]}`,o,d,this.animationValues),_c(`skew${Ec[u]}`,o,d,this.animationValues);o.render();for(const u in d)o.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return c4;const d={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=xo(o==null?void 0:o.pointerEvents)||"",d.transform=u?u(this.latestValues,""):"none",d;const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){const v={};return this.options.layoutId&&(v.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,v.pointerEvents=xo(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!ks(this.latestValues)&&(v.transform=u?u({},""):"none",this.hasProjected=!1),v}const f=p.animationValues||p.latestValues;this.applyTransformsToTarget(),d.transform=l4(this.projectionDeltaWithTransform,this.treeScale,f),u&&(d.transform=u(f,d.transform));const{x:m,y:b}=this.projectionDelta;d.transformOrigin=`${m.origin*100}% ${b.origin*100}% 0`,p.animationValues?d.opacity=p===this?(c=(l=f.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:d.opacity=p===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const v in Zo){if(f[v]===void 0)continue;const{correct:y,applyTo:g}=Zo[v],x=d.transform==="none"?f[v]:y(f[v],p);if(g){const w=g.length;for(let j=0;j<w;j++)d[g[j]]=x}else d[v]=x}return this.options.layoutId&&(d.pointerEvents=p===this?xo(o==null?void 0:o.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Ym),this.root.sharedNodes.clear()}}}function u4(e){e.updateLayout()}function h4(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:a}=e.options,o=n.source!==e.layout.source;a==="size"?Ct(p=>{const f=o?n.measuredBox[p]:n.layoutBox[p],m=kt(f);f.min=s[p].min,f.max=f.min+m}):Q1(a,n.layoutBox,s)&&Ct(p=>{const f=o?n.measuredBox[p]:n.layoutBox[p],m=kt(s[p]);f.max=f.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+m)});const l=vr();Ai(l,s,n.layoutBox);const c=vr();o?Ai(c,e.applyTransform(i,!0),n.measuredBox):Ai(c,s,n.layoutBox);const d=!G1(l);let u=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:f,layout:m}=p;if(f&&m){const b=Ae();Mi(b,n.layoutBox,f.layoutBox);const v=Ae();Mi(v,s,m.layoutBox),q1(b,v)||(u=!0),p.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=b,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeTargetChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function f4(e){gi&&js.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function p4(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function m4(e){e.clearSnapshot()}function Ym(e){e.clearMeasurements()}function g4(e){e.isLayoutDirty=!1}function x4(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Xm(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function y4(e){e.resolveTargetDelta()}function v4(e){e.calcProjection()}function b4(e){e.resetSkewAndRotation()}function w4(e){e.removeLeadSnapshot()}function Qm(e,t,n){e.translate=Se(t.translate,0,n),e.scale=Se(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Jm(e,t,n,s){e.min=Se(t.min,n.min,s),e.max=Se(t.max,n.max,s)}function k4(e,t,n,s){Jm(e.x,t.x,n.x,s),Jm(e.y,t.y,n.y,s)}function j4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const N4={duration:.45,ease:[.4,0,.1,1]},Zm=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),e0=Zm("applewebkit/")&&!Zm("chrome/")?Math.round:bt;function t0(e){e.min=e0(e.min),e.max=e0(e.max)}function S4(e){t0(e.x),t0(e.y)}function Q1(e,t,n){return e==="position"||e==="preserve-aspect"&&!_S(Km(t),Km(n),.2)}function C4(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const E4=X1({attachResizeListener:(e,t)=>ia(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tc={current:void 0},J1=X1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Tc.current){const e=new E4({});e.mount(window),e.setOptions({layoutScroll:!0}),Tc.current=e}return Tc.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),_4={pan:{Feature:HS},drag:{Feature:US,ProjectionNode:J1,MeasureLayout:H1}};function n0(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,a=s[i];a&&we.postRender(()=>a(t,ya(t)))}class T4 extends ps{mount(){const{current:t}=this.node;t&&(this.unmount=_j(t,n=>(n0(this.node,n,"Start"),s=>n0(this.node,s,"End"))))}unmount(){}}class P4 extends ps{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xa(ia(this.node.current,"focus",()=>this.onFocus()),ia(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function s0(e,t,n){const{props:s}=e;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),a=s[i];a&&we.postRender(()=>a(t,ya(t)))}class A4 extends ps{mount(){const{current:t}=this.node;t&&(this.unmount=Mj(t,n=>(s0(this.node,n,"Start"),(s,{success:i})=>s0(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ou=new WeakMap,Pc=new WeakMap,M4=e=>{const t=ou.get(e.target);t&&t(e)},R4=e=>{e.forEach(M4)};function z4({root:e,...t}){const n=e||document;Pc.has(n)||Pc.set(n,{});const s=Pc.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(R4,{root:e,...t})),s[i]}function L4(e,t,n){const s=z4(t);return ou.set(e,n),s.observe(e),()=>{ou.delete(e),s.unobserve(e)}}const O4={some:0,all:1};class D4 extends ps{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:a}=t,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:O4[i]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,a&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:p}=this.node.getProps(),f=d?u:p;f&&f(c)};return L4(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(I4(t,n))&&this.startObserver()}unmount(){}}function I4({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const B4={inView:{Feature:D4},tap:{Feature:A4},focus:{Feature:P4},hover:{Feature:T4}},F4={layout:{ProjectionNode:J1,MeasureLayout:H1}},lu={current:null},Z1={current:!1};function V4(){if(Z1.current=!0,!!jh)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>lu.current=e.matches;e.addListener(t),t()}else lu.current=!1}const $4=[...N1,Je,as],U4=e=>$4.find(j1(e)),r0=new WeakMap;function H4(e,t,n){for(const s in t){const i=t[s],a=n[s];if(tt(i))e.addValue(s,i);else if(tt(a))e.addValue(s,sa(i,{owner:e}));else if(a!==i)if(e.hasValue(s)){const o=e.getValue(s);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(s);e.addValue(s,sa(o!==void 0?o:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const i0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class W4{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Xh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=un.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,we.render(this.render,!1,!0))};const{latestValues:c,renderState:d,onUpdate:u}=o;this.onUpdate=u,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=_l(n),this.isVariantNode=My(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in f){const b=f[m];c[m]!==void 0&&tt(b)&&b.set(c[m],!1)}}mount(t){this.current=t,r0.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Z1.current||V4(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:lu.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){r0.delete(this.current),this.projection&&this.projection.unmount(),is(this.notifyUpdate),is(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=Us.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&we.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),a=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),a(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ir){const n=Ir[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ae()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<i0.length;s++){const i=i0[s];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a="on"+i,o=t[a];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=H4(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=sa(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){var s;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(s=this.getBaseTargetFromProps(this.props,t))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(w1(i)||h1(i))?i=parseFloat(i):!U4(i)&&as.test(n)&&(i=y1(t,n)),this.setBaseTarget(t,tt(i)?i.get():i)),tt(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:s}=this.props;let i;if(typeof s=="string"||typeof s=="object"){const o=Ph(this.props,s,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(i=o[t])}if(s&&i!==void 0)return i;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!tt(a)?a:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Hh),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class ev extends W4{constructor(){super(...arguments),this.KeyframeResolver=S1}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;tt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function K4(e){return window.getComputedStyle(e)}class G4 extends ev{constructor(){super(...arguments),this.type="html",this.renderInstance=Vy}readValueFromInstance(t,n){if(Us.has(n)){const s=Yh(n);return s&&s.default||0}else{const s=K4(t),i=(Iy(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return $1(t,n)}build(t,n,s){Rh(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Dh(t,n,s)}}class q4 extends ev{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ae}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Us.has(n)){const s=Yh(n);return s&&s.default||0}return n=$y.has(n)?n:Eh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return Wy(t,n,s)}build(t,n,s){zh(t,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,s,i){Uy(t,n,s,i)}mount(t){this.isSVGTag=Oh(t.tagName),super.mount(t)}}const Y4=(e,t)=>Th(e)?new q4(t):new G4(t,{allowProjection:e!==h.Fragment}),X4=wj({...vS,...B4,..._4,...F4},Y4),H=O5(X4);/**
|
|
76
|
+
`),()=>{document.head.removeChild(u)}},[t]),r.jsx(S5,{isPresent:t,childRef:s,sizeRef:i,children:h.cloneElement(e,{ref:s})})}const E5=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:a,mode:o})=>{const l=Nl(_5),c=h.useId(),d=h.useCallback(p=>{l.set(p,!0);for(const f of l.values())if(!f)return;s&&s()},[l,s]),u=h.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:d,register:p=>(l.set(p,!1),()=>l.delete(p))}),a?[Math.random(),d]:[n,d]);return h.useMemo(()=>{l.forEach((p,f)=>l.set(f,!1))},[n]),h.useEffect(()=>{!n&&!l.size&&s&&s()},[n]),o==="popLayout"&&(e=r.jsx(C5,{isPresent:n,children:e})),r.jsx(Sl.Provider,{value:u,children:e})};function _5(){return new Map}function Sy(e=!0){const t=h.useContext(Sl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=t,a=h.useId();h.useEffect(()=>{e&&i(a)},[e]);const o=h.useCallback(()=>e&&s&&s(a),[a,s,e]);return!n&&s?[!1,o]:[!0]}const Ua=e=>e.key||"";function Wp(e){const t=[];return h.Children.forEach(e,n=>{h.isValidElement(n)&&t.push(n)}),t}const jh=typeof window<"u",Cy=jh?h.useLayoutEffect:h.useEffect,ne=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:a="sync",propagate:o=!1})=>{const[l,c]=Sy(o),d=h.useMemo(()=>Wp(e),[e]),u=o&&!l?[]:d.map(Ua),p=h.useRef(!0),f=h.useRef(d),m=Nl(()=>new Map),[b,y]=h.useState(d),[v,g]=h.useState(d);Cy(()=>{p.current=!1,f.current=d;for(let j=0;j<v.length;j++){const k=Ua(v[j]);u.includes(k)?m.delete(k):m.get(k)!==!0&&m.set(k,!1)}},[v,u.length,u.join("-")]);const x=[];if(d!==b){let j=[...d];for(let k=0;k<v.length;k++){const N=v[k],S=Ua(N);u.includes(S)||(j.splice(k,0,N),x.push(N))}a==="wait"&&x.length&&(j=x),g(Wp(j)),y(d);return}const{forceRender:w}=h.useContext(kh);return r.jsx(r.Fragment,{children:v.map(j=>{const k=Ua(j),N=o&&!l?!1:d===v||u.includes(k),S=()=>{if(m.has(k))m.set(k,!0);else return;let _=!0;m.forEach(R=>{R||(_=!1)}),_&&(w==null||w(),g(f.current),o&&(c==null||c()),s&&s())};return r.jsx(E5,{isPresent:N,initial:!p.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:i,mode:a,onExitComplete:N?void 0:S,children:j},k)})})},bt=e=>e;let Ey=bt;function Nh(e){let t;return()=>(t===void 0&&(t=e()),t)}const Dr=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s},kn=e=>e*1e3,jn=e=>e/1e3,T5={useManualTiming:!1};function P5(e){let t=new Set,n=new Set,s=!1,i=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(d){a.has(d)&&(c.schedule(d),e()),d(o)}const c={schedule:(d,u=!1,p=!1)=>{const m=p&&s?t:n;return u&&a.add(d),m.has(d)||m.add(d),d},cancel:d=>{n.delete(d),a.delete(d)},process:d=>{if(o=d,s){i=!0;return}s=!0,[t,n]=[n,t],t.forEach(l),t.clear(),s=!1,i&&(i=!1,c.process(d))}};return c}const Ha=["read","resolveKeyframes","update","preRender","render","postRender"],A5=40;function _y(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Ha.reduce((g,x)=>(g[x]=P5(a),g),{}),{read:l,resolveKeyframes:c,update:d,preRender:u,render:p,postRender:f}=o,m=()=>{const g=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(g-i.timestamp,A5),1),i.timestamp=g,i.isProcessing=!0,l.process(i),c.process(i),d.process(i),u.process(i),p.process(i),f.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(m))},b=()=>{n=!0,s=!0,i.isProcessing||e(m)};return{schedule:Ha.reduce((g,x)=>{const w=o[x];return g[x]=(j,k=!1,N=!1)=>(n||b(),w.schedule(j,k,N)),g},{}),cancel:g=>{for(let x=0;x<Ha.length;x++)o[Ha[x]].cancel(g)},state:i,steps:o}}const{schedule:we,cancel:is,state:Ke,steps:yc}=_y(typeof requestAnimationFrame<"u"?requestAnimationFrame:bt,!0),Ty=h.createContext({strict:!1}),Kp={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ir={};for(const e in Kp)Ir[e]={isEnabled:t=>Kp[e].some(n=>!!t[n])};function M5(e){for(const t in e)Ir[t]={...Ir[t],...e[t]}}const R5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Jo(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||R5.has(e)}let Py=e=>!Jo(e);function Ay(e){e&&(Py=t=>t.startsWith("on")?!Jo(t):e(t))}try{Ay(require("@emotion/is-prop-valid").default)}catch{}function z5(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(Py(i)||n===!0&&Jo(i)||!t&&!Jo(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}function L5({children:e,isValidProp:t,...n}){t&&Ay(t),n={...h.useContext(ea),...n},n.isStatic=Nl(()=>n.isStatic);const s=h.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return r.jsx(ea.Provider,{value:s,children:e})}function O5(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const Cl=h.createContext({});function ta(e){return typeof e=="string"||Array.isArray(e)}function El(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Sh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ch=["initial",...Sh];function _l(e){return El(e.animate)||Ch.some(t=>ta(e[t]))}function My(e){return!!(_l(e)||e.variants)}function D5(e,t){if(_l(e)){const{initial:n,animate:s}=e;return{initial:n===!1||ta(n)?n:void 0,animate:ta(s)?s:void 0}}return e.inherit!==!1?t:{}}function I5(e){const{initial:t,animate:n}=D5(e,h.useContext(Cl));return h.useMemo(()=>({initial:t,animate:n}),[Gp(t),Gp(n)])}function Gp(e){return Array.isArray(e)?e.join(" "):e}const B5=Symbol.for("motionComponentSymbol");function xr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function F5(e,t,n){return h.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):xr(n)&&(n.current=s))},[t])}const Eh=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),V5="framerAppearId",Ry="data-"+Eh(V5),{schedule:_h}=_y(queueMicrotask,!1),zy=h.createContext({});function $5(e,t,n,s,i){var a,o;const{visualElement:l}=h.useContext(Cl),c=h.useContext(Ty),d=h.useContext(Sl),u=h.useContext(ea).reducedMotion,p=h.useRef(null);s=s||c.renderer,!p.current&&s&&(p.current=s(e,{visualState:t,parent:l,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:u}));const f=p.current,m=h.useContext(zy);f&&!f.projection&&i&&(f.type==="html"||f.type==="svg")&&U5(p.current,n,i,m);const b=h.useRef(!1);h.useInsertionEffect(()=>{f&&b.current&&f.update(n,d)});const y=n[Ry],v=h.useRef(!!y&&!(!((a=window.MotionHandoffIsComplete)===null||a===void 0)&&a.call(window,y))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,y)));return Cy(()=>{f&&(b.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),_h.render(f.render),v.current&&f.animationState&&f.animationState.animateChanges())}),h.useEffect(()=>{f&&(!v.current&&f.animationState&&f.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,y)}),v.current=!1))}),f}function U5(e,t,n,s){const{layoutId:i,layout:a,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Ly(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||l&&xr(l),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:d})}function Ly(e){if(e)return e.options.allowProjection!==!1?e.projection:Ly(e.parent)}function H5({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:i}){var a,o;e&&M5(e);function l(d,u){let p;const f={...h.useContext(ea),...d,layoutId:W5(d)},{isStatic:m}=f,b=I5(d),y=s(d,m);if(!m&&jh){K5();const v=G5(f);p=v.MeasureLayout,b.visualElement=$5(i,y,f,t,v.ProjectionNode)}return r.jsxs(Cl.Provider,{value:b,children:[p&&b.visualElement?r.jsx(p,{visualElement:b.visualElement,...f}):null,n(i,d,F5(y,b.visualElement,u),y,m,b.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(o=(a=i.displayName)!==null&&a!==void 0?a:i.name)!==null&&o!==void 0?o:""})`}`;const c=h.forwardRef(l);return c[B5]=i,c}function W5({layoutId:e}){const t=h.useContext(kh).id;return t&&e!==void 0?t+"-"+e:e}function K5(e,t){h.useContext(Ty).strict}function G5(e){const{drag:t,layout:n}=Ir;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const q5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Th(e){return typeof e!="string"||e.includes("-")?!1:!!(q5.indexOf(e)>-1||/[A-Z]/u.test(e))}function qp(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Ph(e,t,n,s){if(typeof t=="function"){const[i,a]=qp(s);t=t(n!==void 0?n:e.custom,i,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,a]=qp(s);t=t(n!==void 0?n:e.custom,i,a)}return t}const Gd=e=>Array.isArray(e),Y5=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),X5=e=>Gd(e)?e[e.length-1]||0:e,tt=e=>!!(e&&e.getVelocity);function xo(e){const t=tt(e)?e.get():e;return Y5(t)?t.toValue():t}function Q5({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},s,i,a){const o={latestValues:J5(s,i,a,e),renderState:t()};return n&&(o.onMount=l=>n({props:s,current:l,...o}),o.onUpdate=l=>n(l)),o}const Oy=e=>(t,n)=>{const s=h.useContext(Cl),i=h.useContext(Sl),a=()=>Q5(e,t,s,i);return n?a():Nl(a)};function J5(e,t,n,s){const i={},a=s(e,{});for(const f in a)i[f]=xo(a[f]);let{initial:o,animate:l}=e;const c=_l(e),d=My(e);t&&d&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const p=u?l:o;if(p&&typeof p!="boolean"&&!El(p)){const f=Array.isArray(p)?p:[p];for(let m=0;m<f.length;m++){const b=Ph(e,f[m]);if(b){const{transitionEnd:y,transition:v,...g}=b;for(const x in g){let w=g[x];if(Array.isArray(w)){const j=u?w.length-1:0;w=w[j]}w!==null&&(i[x]=w)}for(const x in y)i[x]=y[x]}}}return i}const Kr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Us=new Set(Kr),Dy=e=>t=>typeof t=="string"&&t.startsWith(e),Iy=Dy("--"),Z5=Dy("var(--"),Ah=e=>Z5(e)?ej.test(e.split("/*")[0].trim()):!1,ej=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,By=(e,t)=>t&&typeof e=="number"?t.transform(e):e,_n=(e,t,n)=>n>t?t:n<e?e:n,Gr={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},na={...Gr,transform:e=>_n(0,1,e)},Wa={...Gr,default:1},ma=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Dn=ma("deg"),dn=ma("%"),te=ma("px"),tj=ma("vh"),nj=ma("vw"),Yp={...dn,parse:e=>dn.parse(e)/100,transform:e=>dn.transform(e*100)},sj={borderWidth:te,borderTopWidth:te,borderRightWidth:te,borderBottomWidth:te,borderLeftWidth:te,borderRadius:te,radius:te,borderTopLeftRadius:te,borderTopRightRadius:te,borderBottomRightRadius:te,borderBottomLeftRadius:te,width:te,maxWidth:te,height:te,maxHeight:te,top:te,right:te,bottom:te,left:te,padding:te,paddingTop:te,paddingRight:te,paddingBottom:te,paddingLeft:te,margin:te,marginTop:te,marginRight:te,marginBottom:te,marginLeft:te,backgroundPositionX:te,backgroundPositionY:te},rj={rotate:Dn,rotateX:Dn,rotateY:Dn,rotateZ:Dn,scale:Wa,scaleX:Wa,scaleY:Wa,scaleZ:Wa,skew:Dn,skewX:Dn,skewY:Dn,distance:te,translateX:te,translateY:te,translateZ:te,x:te,y:te,z:te,perspective:te,transformPerspective:te,opacity:na,originX:Yp,originY:Yp,originZ:te},Xp={...Gr,transform:Math.round},Mh={...sj,...rj,zIndex:Xp,size:te,fillOpacity:na,strokeOpacity:na,numOctaves:Xp},ij={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aj=Kr.length;function oj(e,t,n){let s="",i=!0;for(let a=0;a<aj;a++){const o=Kr[a],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=By(l,Mh[o]);if(!c){i=!1;const u=ij[o]||o;s+=`${u}(${d}) `}n&&(t[o]=d)}}return s=s.trim(),n?s=n(t,i?"":s):i&&(s="none"),s}function Rh(e,t,n){const{style:s,vars:i,transformOrigin:a}=e;let o=!1,l=!1;for(const c in t){const d=t[c];if(Us.has(c)){o=!0;continue}else if(Iy(c)){i[c]=d;continue}else{const u=By(d,Mh[c]);c.startsWith("origin")?(l=!0,a[c]=u):s[c]=u}}if(t.transform||(o||n?s.transform=oj(t,e.transform,n):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=a;s.transformOrigin=`${c} ${d} ${u}`}}const lj={offset:"stroke-dashoffset",array:"stroke-dasharray"},cj={offset:"strokeDashoffset",array:"strokeDasharray"};function dj(e,t,n=1,s=0,i=!0){e.pathLength=1;const a=i?lj:cj;e[a.offset]=te.transform(-s);const o=te.transform(t),l=te.transform(n);e[a.array]=`${o} ${l}`}function Qp(e,t,n){return typeof e=="string"?e:te.transform(t+n*e)}function uj(e,t,n){const s=Qp(t,e.x,e.width),i=Qp(n,e.y,e.height);return`${s} ${i}`}function zh(e,{attrX:t,attrY:n,attrScale:s,originX:i,originY:a,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...d},u,p){if(Rh(e,d,p),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m,dimensions:b}=e;f.transform&&(b&&(m.transform=f.transform),delete f.transform),b&&(i!==void 0||a!==void 0||m.transform)&&(m.transformOrigin=uj(b,i!==void 0?i:.5,a!==void 0?a:.5)),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),s!==void 0&&(f.scale=s),o!==void 0&&dj(f,o,l,c,!1)}const Lh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Fy=()=>({...Lh(),attrs:{}}),Oh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Vy(e,{style:t,vars:n},s,i){Object.assign(e.style,t,i&&i.getProjectionStyles(s));for(const a in n)e.style.setProperty(a,n[a])}const $y=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Uy(e,t,n,s){Vy(e,t,void 0,s);for(const i in t.attrs)e.setAttribute($y.has(i)?i:Eh(i),t.attrs[i])}const Zo={};function hj(e){Object.assign(Zo,e)}function Hy(e,{layout:t,layoutId:n}){return Us.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Zo[e]||e==="opacity")}function Dh(e,t,n){var s;const{style:i}=e,a={};for(const o in i)(tt(i[o])||t.style&&tt(t.style[o])||Hy(o,e)||((s=n==null?void 0:n.getValue(o))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(a[o]=i[o]);return a}function Wy(e,t,n){const s=Dh(e,t,n);for(const i in e)if(tt(e[i])||tt(t[i])){const a=Kr.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[a]=e[i]}return s}function fj(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Jp=["x","y","width","height","cx","cy","r"],pj={useVisualState:Oy({scrapeMotionValuesFromProps:Wy,createRenderState:Fy,onUpdate:({props:e,prevProps:t,current:n,renderState:s,latestValues:i})=>{if(!n)return;let a=!!e.drag;if(!a){for(const l in i)if(Us.has(l)){a=!0;break}}if(!a)return;let o=!t;if(t)for(let l=0;l<Jp.length;l++){const c=Jp[l];e[c]!==t[c]&&(o=!0)}o&&we.read(()=>{fj(n,s),we.render(()=>{zh(s,i,Oh(n.tagName),e.transformTemplate),Uy(n,s)})})}})},mj={useVisualState:Oy({scrapeMotionValuesFromProps:Dh,createRenderState:Lh})};function Ky(e,t,n){for(const s in t)!tt(t[s])&&!Hy(s,n)&&(e[s]=t[s])}function gj({transformTemplate:e},t){return h.useMemo(()=>{const n=Lh();return Rh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function xj(e,t){const n=e.style||{},s={};return Ky(s,n,e),Object.assign(s,gj(e,t)),s}function yj(e,t){const n={},s=xj(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}function vj(e,t,n,s){const i=h.useMemo(()=>{const a=Fy();return zh(a,t,Oh(s),e.transformTemplate),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};Ky(a,e.style,e),i.style={...a,...i.style}}return i}function bj(e=!1){return(n,s,i,{latestValues:a},o)=>{const c=(Th(n)?vj:yj)(s,a,o,n),d=z5(s,typeof n=="string",e),u=n!==h.Fragment?{...d,...c,ref:i}:{},{children:p}=s,f=h.useMemo(()=>tt(p)?p.get():p,[p]);return h.createElement(n,{...u,children:f})}}function wj(e,t){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...Th(s)?pj:mj,preloadedFeatures:e,useRender:bj(i),createVisualElement:t,Component:s};return H5(o)}}function Gy(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}function Tl(e,t,n){const s=e.getProps();return Ph(s,t,n!==void 0?n:s.custom,e)}const kj=Nh(()=>window.ScrollTimeline!==void 0);class jj{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let s=0;s<this.animations.length;s++)this.animations[s][t]=n}attachTimeline(t,n){const s=this.animations.map(i=>{if(kj()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{s.forEach((i,a)=>{i&&i(),this.animations[a].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Nj extends jj{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function Ih(e,t){return e?e[t]||e.default||e:void 0}const qd=2e4;function qy(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<qd;)t+=n,s=e.next(t);return t>=qd?1/0:t}function Bh(e){return typeof e=="function"}function Zp(e,t){e.timeline=t,e.onfinish=null}const Fh=e=>Array.isArray(e)&&typeof e[0]=="number",Sj={linearEasing:void 0};function Cj(e,t){const n=Nh(e);return()=>{var s;return(s=Sj[t])!==null&&s!==void 0?s:n()}}const el=Cj(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Yy=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let a=0;a<i;a++)s+=e(Dr(0,i-1,a))+", ";return`linear(${s.substring(0,s.length-2)})`};function Xy(e){return!!(typeof e=="function"&&el()||!e||typeof e=="string"&&(e in Yd||el())||Fh(e)||Array.isArray(e)&&e.every(Xy))}const pi=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,Yd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pi([0,.65,.55,1]),circOut:pi([.55,0,1,.45]),backIn:pi([.31,.01,.66,-.59]),backOut:pi([.33,1.53,.69,.99])};function Qy(e,t){if(e)return typeof e=="function"&&el()?Yy(e,t):Fh(e)?pi(e):Array.isArray(e)?e.map(n=>Qy(n,t)||Yd.easeOut):Yd[e]}const Vt={x:!1,y:!1};function Jy(){return Vt.x||Vt.y}function Ej(e,t,n){var s;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const a=(s=void 0)!==null&&s!==void 0?s:i.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}function Zy(e,t){const n=Ej(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function em(e){return t=>{t.pointerType==="touch"||Jy()||e(t)}}function _j(e,t,n={}){const[s,i,a]=Zy(e,n),o=em(l=>{const{target:c}=l,d=t(l);if(typeof d!="function"||!c)return;const u=em(p=>{d(p),c.removeEventListener("pointerleave",u)});c.addEventListener("pointerleave",u,i)});return s.forEach(l=>{l.addEventListener("pointerenter",o,i)}),a}const e1=(e,t)=>t?e===t?!0:e1(e,t.parentElement):!1,Vh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Tj=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Pj(e){return Tj.has(e.tagName)||e.tabIndex!==-1}const mi=new WeakSet;function tm(e){return t=>{t.key==="Enter"&&e(t)}}function vc(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Aj=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=tm(()=>{if(mi.has(n))return;vc(n,"down");const i=tm(()=>{vc(n,"up")}),a=()=>vc(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",a,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function nm(e){return Vh(e)&&!Jy()}function Mj(e,t,n={}){const[s,i,a]=Zy(e,n),o=l=>{const c=l.currentTarget;if(!nm(l)||mi.has(c))return;mi.add(c);const d=t(l),u=(m,b)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",f),!(!nm(m)||!mi.has(c))&&(mi.delete(c),typeof d=="function"&&d(m,{success:b}))},p=m=>{u(m,n.useGlobalTarget||e1(c,m.target))},f=m=>{u(m,!1)};window.addEventListener("pointerup",p,i),window.addEventListener("pointercancel",f,i)};return s.forEach(l=>{!Pj(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,i),l.addEventListener("focus",d=>Aj(d,i),i)}),a}function Rj(e){return e==="x"||e==="y"?Vt[e]?null:(Vt[e]=!0,()=>{Vt[e]=!1}):Vt.x||Vt.y?null:(Vt.x=Vt.y=!0,()=>{Vt.x=Vt.y=!1})}const t1=new Set(["width","height","top","left","right","bottom",...Kr]);let yo;function zj(){yo=void 0}const un={now:()=>(yo===void 0&&un.set(Ke.isProcessing||T5.useManualTiming?Ke.timestamp:performance.now()),yo),set:e=>{yo=e,queueMicrotask(zj)}};function $h(e,t){e.indexOf(t)===-1&&e.push(t)}function Uh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Hh{constructor(){this.subscriptions=[]}add(t){return $h(this.subscriptions,t),()=>Uh(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let a=0;a<i;a++){const o=this.subscriptions[a];o&&o(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function n1(e,t){return t?e*(1e3/t):0}const sm=30,Lj=e=>!isNaN(parseFloat(e));class Oj{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{const a=un.now();this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=un.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Lj(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Hh);const s=this.events[t].add(n);return t==="change"?()=>{s(),we.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>sm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,sm);return n1(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function sa(e,t){return new Oj(e,t)}function Dj(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,sa(n))}function Ij(e,t){const n=Tl(e,t);let{transitionEnd:s={},transition:i={},...a}=n||{};a={...a,...s};for(const o in a){const l=X5(a[o]);Dj(e,o,l)}}function Bj(e){return!!(tt(e)&&e.add)}function Xd(e,t){const n=e.getValue("willChange");if(Bj(n))return n.add(t)}function s1(e){return e.props[Ry]}const r1=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Fj=1e-7,Vj=12;function $j(e,t,n,s,i){let a,o,l=0;do o=t+(n-t)/2,a=r1(o,s,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Fj&&++l<Vj);return o}function ga(e,t,n,s){if(e===t&&n===s)return bt;const i=a=>$j(a,0,1,e,n);return a=>a===0||a===1?a:r1(i(a),t,s)}const i1=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,a1=e=>t=>1-e(1-t),o1=ga(.33,1.53,.69,.99),Wh=a1(o1),l1=i1(Wh),c1=e=>(e*=2)<1?.5*Wh(e):.5*(2-Math.pow(2,-10*(e-1))),Kh=e=>1-Math.sin(Math.acos(e)),d1=a1(Kh),u1=i1(Kh),h1=e=>/^0[^.\s]+$/u.test(e);function Uj(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||h1(e):!0}const Ti=e=>Math.round(e*1e5)/1e5,Gh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Hj(e){return e==null}const Wj=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,qh=(e,t)=>n=>!!(typeof n=="string"&&Wj.test(n)&&n.startsWith(e)||t&&!Hj(n)&&Object.prototype.hasOwnProperty.call(n,t)),f1=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,a,o,l]=s.match(Gh);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Kj=e=>_n(0,255,e),bc={...Gr,transform:e=>Math.round(Kj(e))},Es={test:qh("rgb","red"),parse:f1("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+bc.transform(e)+", "+bc.transform(t)+", "+bc.transform(n)+", "+Ti(na.transform(s))+")"};function Gj(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const Qd={test:qh("#"),parse:Gj,transform:Es.transform},yr={test:qh("hsl","hue"),parse:f1("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+dn.transform(Ti(t))+", "+dn.transform(Ti(n))+", "+Ti(na.transform(s))+")"},Je={test:e=>Es.test(e)||Qd.test(e)||yr.test(e),parse:e=>Es.test(e)?Es.parse(e):yr.test(e)?yr.parse(e):Qd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Es.transform(e):yr.transform(e)},qj=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Yj(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Gh))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(qj))===null||n===void 0?void 0:n.length)||0)>0}const p1="number",m1="color",Xj="var",Qj="var(",rm="${}",Jj=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ra(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let a=0;const l=t.replace(Jj,c=>(Je.test(c)?(s.color.push(a),i.push(m1),n.push(Je.parse(c))):c.startsWith(Qj)?(s.var.push(a),i.push(Xj),n.push(c)):(s.number.push(a),i.push(p1),n.push(parseFloat(c))),++a,rm)).split(rm);return{values:n,split:l,indexes:s,types:i}}function g1(e){return ra(e).values}function x1(e){const{split:t,types:n}=ra(e),s=t.length;return i=>{let a="";for(let o=0;o<s;o++)if(a+=t[o],i[o]!==void 0){const l=n[o];l===p1?a+=Ti(i[o]):l===m1?a+=Je.transform(i[o]):a+=i[o]}return a}}const Zj=e=>typeof e=="number"?0:e;function eN(e){const t=g1(e);return x1(e)(t.map(Zj))}const as={test:Yj,parse:g1,createTransformer:x1,getAnimatableNone:eN},tN=new Set(["brightness","contrast","saturate","opacity"]);function nN(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Gh)||[];if(!s)return e;const i=n.replace(s,"");let a=tN.has(t)?1:0;return s!==n&&(a*=100),t+"("+a+i+")"}const sN=/\b([a-z-]*)\(.*?\)/gu,Jd={...as,getAnimatableNone:e=>{const t=e.match(sN);return t?t.map(nN).join(" "):e}},rN={...Mh,color:Je,backgroundColor:Je,outlineColor:Je,fill:Je,stroke:Je,borderColor:Je,borderTopColor:Je,borderRightColor:Je,borderBottomColor:Je,borderLeftColor:Je,filter:Jd,WebkitFilter:Jd},Yh=e=>rN[e];function y1(e,t){let n=Yh(e);return n!==Jd&&(n=as),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const iN=new Set(["auto","none","0"]);function aN(e,t,n){let s=0,i;for(;s<e.length&&!i;){const a=e[s];typeof a=="string"&&!iN.has(a)&&ra(a).values.length&&(i=e[s]),s++}if(i&&n)for(const a of t)e[a]=y1(n,i)}const im=e=>e===Gr||e===te,am=(e,t)=>parseFloat(e.split(", ")[t]),om=(e,t)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return am(i[1],t);{const a=s.match(/^matrix\((.+)\)$/u);return a?am(a[1],e):0}},oN=new Set(["x","y","z"]),lN=Kr.filter(e=>!oN.has(e));function cN(e){const t=[];return lN.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const Br={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:om(4,13),y:om(5,14)};Br.translateX=Br.x;Br.translateY=Br.y;const Ps=new Set;let Zd=!1,eu=!1;function v1(){if(eu){const e=Array.from(Ps).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=cN(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([a,o])=>{var l;(l=s.getValue(a))===null||l===void 0||l.set(o)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}eu=!1,Zd=!1,Ps.forEach(e=>e.complete()),Ps.clear()}function b1(){Ps.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(eu=!0)})}function dN(){b1(),v1()}class Xh{constructor(t,n,s,i,a,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ps.add(this),Zd||(Zd=!0,we.read(b1),we.resolveKeyframes(v1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;for(let a=0;a<t.length;a++)if(t[a]===null)if(a===0){const o=i==null?void 0:i.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(s&&n){const c=s.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),i&&o===void 0&&i.set(t[0])}else t[a]=t[a-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ps.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ps.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const w1=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),uN=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function hN(e){const t=uN.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function k1(e,t,n=1){const[s,i]=hN(e);if(!s)return;const a=window.getComputedStyle(t).getPropertyValue(s);if(a){const o=a.trim();return w1(o)?parseFloat(o):o}return Ah(i)?k1(i,t,n+1):i}const j1=e=>t=>t.test(e),fN={test:e=>e==="auto",parse:e=>e},N1=[Gr,te,dn,Dn,nj,tj,fN],lm=e=>N1.find(j1(e));class S1 extends Xh{constructor(t,n,s,i,a){super(t,n,s,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let d=t[c];if(typeof d=="string"&&(d=d.trim(),Ah(d))){const u=k1(d,n.current);u!==void 0&&(t[c]=u),c===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!t1.has(s)||t.length!==2)return;const[i,a]=t,o=lm(i),l=lm(a);if(o!==l)if(im(o)&&im(l))for(let c=0;c<t.length;c++){const d=t[c];typeof d=="string"&&(t[c]=parseFloat(d))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let i=0;i<t.length;i++)Uj(t[i])&&s.push(i);s.length&&aN(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Br[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(s,i).jump(i,!1)}measureEndState(){var t;const{element:n,name:s,unresolvedKeyframes:i}=this;if(!n||!n.current)return;const a=n.getValue(s);a&&a.jump(this.measuredOrigin,!1);const o=i.length-1,l=i[o];i[o]=Br[s](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,d])=>{n.getValue(c).set(d)}),this.resolveNoneKeyframes()}}const cm=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(as.test(e)||e==="0")&&!e.startsWith("url("));function pN(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function mN(e,t,n,s){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const a=e[e.length-1],o=cm(i,t),l=cm(a,t);return!o||!l?!1:pN(e)||(n==="spring"||Bh(n))&&s}const gN=e=>e!==null;function Pl(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(gN),a=t&&n!=="loop"&&t%2===1?0:i.length-1;return!a||s===void 0?i[a]:s}const xN=40;class C1{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=un.now(),this.options={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:a,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>xN?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&dN(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=un.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:a,delay:o,onComplete:l,onUpdate:c,isGenerator:d}=this.options;if(!d&&!mN(t,s,i,a))if(o)this.options.duration=0;else{c&&c(Pl(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const u=this.initPlayback(t,n);u!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...u},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Se=(e,t,n)=>e+(t-e)*n;function wc(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yN({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=wc(c,l,e+1/3),a=wc(c,l,e),o=wc(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:s}}function tl(e,t){return n=>n>0?t:e}const kc=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},vN=[Qd,Es,yr],bN=e=>vN.find(t=>t.test(e));function dm(e){const t=bN(e);if(!t)return!1;let n=t.parse(e);return t===yr&&(n=yN(n)),n}const um=(e,t)=>{const n=dm(e),s=dm(t);if(!n||!s)return tl(e,t);const i={...n};return a=>(i.red=kc(n.red,s.red,a),i.green=kc(n.green,s.green,a),i.blue=kc(n.blue,s.blue,a),i.alpha=Se(n.alpha,s.alpha,a),Es.transform(i))},wN=(e,t)=>n=>t(e(n)),xa=(...e)=>e.reduce(wN),tu=new Set(["none","hidden"]);function kN(e,t){return tu.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function jN(e,t){return n=>Se(e,t,n)}function Qh(e){return typeof e=="number"?jN:typeof e=="string"?Ah(e)?tl:Je.test(e)?um:CN:Array.isArray(e)?E1:typeof e=="object"?Je.test(e)?um:NN:tl}function E1(e,t){const n=[...e],s=n.length,i=e.map((a,o)=>Qh(a)(a,t[o]));return a=>{for(let o=0;o<s;o++)n[o]=i[o](a);return n}}function NN(e,t){const n={...e,...t},s={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(s[i]=Qh(e[i])(e[i],t[i]));return i=>{for(const a in s)n[a]=s[a](i);return n}}function SN(e,t){var n;const s=[],i={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],l=e.indexes[o][i[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;s[a]=c,i[o]++}return s}const CN=(e,t)=>{const n=as.createTransformer(t),s=ra(e),i=ra(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?tu.has(e)&&!i.values.length||tu.has(t)&&!s.values.length?kN(e,t):xa(E1(SN(s,i),i.values),n):tl(e,t)};function _1(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Se(e,t,n):Qh(e)(e,t)}const EN=5;function T1(e,t,n){const s=Math.max(t-EN,0);return n1(n-e(s),t-s)}const _e={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},jc=.001;function _N({duration:e=_e.duration,bounce:t=_e.bounce,velocity:n=_e.velocity,mass:s=_e.mass}){let i,a,o=1-t;o=_n(_e.minDamping,_e.maxDamping,o),e=_n(_e.minDuration,_e.maxDuration,jn(e)),o<1?(i=d=>{const u=d*o,p=u*e,f=u-n,m=nu(d,o),b=Math.exp(-p);return jc-f/m*b},a=d=>{const p=d*o*e,f=p*n+n,m=Math.pow(o,2)*Math.pow(d,2)*e,b=Math.exp(-p),y=nu(Math.pow(d,2),o);return(-i(d)+jc>0?-1:1)*((f-m)*b)/y}):(i=d=>{const u=Math.exp(-d*e),p=(d-n)*e+1;return-jc+u*p},a=d=>{const u=Math.exp(-d*e),p=(n-d)*(e*e);return u*p});const l=5/e,c=PN(i,a,l);if(e=kn(e),isNaN(c))return{stiffness:_e.stiffness,damping:_e.damping,duration:e};{const d=Math.pow(c,2)*s;return{stiffness:d,damping:o*2*Math.sqrt(s*d),duration:e}}}const TN=12;function PN(e,t,n){let s=n;for(let i=1;i<TN;i++)s=s-e(s)/t(s);return s}function nu(e,t){return e*Math.sqrt(1-t*t)}const AN=["duration","bounce"],MN=["stiffness","damping","mass"];function hm(e,t){return t.some(n=>e[n]!==void 0)}function RN(e){let t={velocity:_e.velocity,stiffness:_e.stiffness,damping:_e.damping,mass:_e.mass,isResolvedFromDuration:!1,...e};if(!hm(e,MN)&&hm(e,AN))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,a=2*_n(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:_e.mass,stiffness:i,damping:a}}else{const n=_N(e);t={...t,...n,mass:_e.mass},t.isResolvedFromDuration=!0}return t}function P1(e=_e.visualDuration,t=_e.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:d,mass:u,duration:p,velocity:f,isResolvedFromDuration:m}=RN({...n,velocity:-jn(n.velocity||0)}),b=f||0,y=d/(2*Math.sqrt(c*u)),v=o-a,g=jn(Math.sqrt(c/u)),x=Math.abs(v)<5;s||(s=x?_e.restSpeed.granular:_e.restSpeed.default),i||(i=x?_e.restDelta.granular:_e.restDelta.default);let w;if(y<1){const k=nu(g,y);w=N=>{const S=Math.exp(-y*g*N);return o-S*((b+y*g*v)/k*Math.sin(k*N)+v*Math.cos(k*N))}}else if(y===1)w=k=>o-Math.exp(-g*k)*(v+(b+g*v)*k);else{const k=g*Math.sqrt(y*y-1);w=N=>{const S=Math.exp(-y*g*N),_=Math.min(k*N,300);return o-S*((b+y*g*v)*Math.sinh(_)+k*v*Math.cosh(_))/k}}const j={calculatedDuration:m&&p||null,next:k=>{const N=w(k);if(m)l.done=k>=p;else{let S=0;y<1&&(S=k===0?kn(b):T1(w,k,N));const _=Math.abs(S)<=s,R=Math.abs(o-N)<=i;l.done=_&&R}return l.value=l.done?o:N,l},toString:()=>{const k=Math.min(qy(j),qd),N=Yy(S=>j.next(k*S).value,k,30);return k+"ms "+N}};return j}function fm({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:c,restDelta:d=.5,restSpeed:u}){const p=e[0],f={done:!1,value:p},m=_=>l!==void 0&&_<l||c!==void 0&&_>c,b=_=>l===void 0?c:c===void 0||Math.abs(l-_)<Math.abs(c-_)?l:c;let y=n*t;const v=p+y,g=o===void 0?v:o(v);g!==v&&(y=g-p);const x=_=>-y*Math.exp(-_/s),w=_=>g+x(_),j=_=>{const R=x(_),L=w(_);f.done=Math.abs(R)<=d,f.value=f.done?g:L};let k,N;const S=_=>{m(f.value)&&(k=_,N=P1({keyframes:[f.value,b(f.value)],velocity:T1(w,_,f.value),damping:i,stiffness:a,restDelta:d,restSpeed:u}))};return S(0),{calculatedDuration:null,next:_=>{let R=!1;return!N&&k===void 0&&(R=!0,j(_),S(_)),k!==void 0&&_>=k?N.next(_-k):(!R&&j(_),f)}}}const zN=ga(.42,0,1,1),LN=ga(0,0,.58,1),A1=ga(.42,0,.58,1),ON=e=>Array.isArray(e)&&typeof e[0]!="number",DN={linear:bt,easeIn:zN,easeInOut:A1,easeOut:LN,circIn:Kh,circInOut:u1,circOut:d1,backIn:Wh,backInOut:l1,backOut:o1,anticipate:c1},pm=e=>{if(Fh(e)){Ey(e.length===4);const[t,n,s,i]=e;return ga(t,n,s,i)}else if(typeof e=="string")return DN[e];return e};function IN(e,t,n){const s=[],i=n||_1,a=e.length-1;for(let o=0;o<a;o++){let l=i(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||bt:t;l=xa(c,l)}s.push(l)}return s}function BN(e,t,{clamp:n=!0,ease:s,mixer:i}={}){const a=e.length;if(Ey(a===t.length),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=IN(t,s,i),c=l.length,d=u=>{if(o&&u<e[0])return t[0];let p=0;if(c>1)for(;p<e.length-2&&!(u<e[p+1]);p++);const f=Dr(e[p],e[p+1],u);return l[p](f)};return n?u=>d(_n(e[0],e[a-1],u)):d}function FN(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=Dr(0,t,s);e.push(Se(n,1,i))}}function VN(e){const t=[0];return FN(t,e.length-1),t}function $N(e,t){return e.map(n=>n*t)}function UN(e,t){return e.map(()=>t||A1).splice(0,e.length-1)}function nl({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=ON(s)?s.map(pm):pm(s),a={done:!1,value:t[0]},o=$N(n&&n.length===t.length?n:VN(t),e),l=BN(o,t,{ease:Array.isArray(i)?i:UN(t,i)});return{calculatedDuration:e,next:c=>(a.value=l(c),a.done=c>=e,a)}}const HN=e=>{const t=({timestamp:n})=>e(n);return{start:()=>we.update(t,!0),stop:()=>is(t),now:()=>Ke.isProcessing?Ke.timestamp:un.now()}},WN={decay:fm,inertia:fm,tween:nl,keyframes:nl,spring:P1},KN=e=>e/100;class Jh extends C1{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:s,element:i,keyframes:a}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Xh,l=(c,d)=>this.onKeyframesResolved(c,d);this.resolver=new o(a,l,n,s,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=this.options,l=Bh(n)?n:WN[n]||nl;let c,d;l!==nl&&typeof t[0]!="number"&&(c=xa(KN,_1(t[0],t[1])),t=[0,100]);const u=l({...this.options,keyframes:t});a==="mirror"&&(d=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=qy(u));const{calculatedDuration:p}=u,f=p+i,m=f*(s+1)-i;return{generator:u,mirroredGenerator:d,mapPercentToKeyframes:c,calculatedDuration:p,resolvedDuration:f,totalDuration:m}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:s}=this;if(!s){const{keyframes:_}=this.options;return{done:!0,value:_[_.length-1]}}const{finalKeyframe:i,generator:a,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:d,totalDuration:u,resolvedDuration:p}=s;if(this.startTime===null)return a.next(0);const{delay:f,repeat:m,repeatType:b,repeatDelay:y,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-f*(this.speed>=0?1:-1),x=this.speed>=0?g<0:g>u;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let w=this.currentTime,j=a;if(m){const _=Math.min(this.currentTime,u)/p;let R=Math.floor(_),L=_%1;!L&&_>=1&&(L=1),L===1&&R--,R=Math.min(R,m+1),!!(R%2)&&(b==="reverse"?(L=1-L,y&&(L-=y/p)):b==="mirror"&&(j=o)),w=_n(0,1,L)*p}const k=x?{done:!1,value:c[0]}:j.next(w);l&&(k.value=l(k.value));let{done:N}=k;!x&&d!==null&&(N=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return S&&i!==void 0&&(k.value=Pl(c,this.options,i)),v&&v(k.value),S&&this.finish(),k}get duration(){const{resolved:t}=this;return t?jn(t.calculatedDuration):0}get time(){return jn(this.currentTime)}set time(t){t=kn(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=jn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=HN,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=s??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const GN=new Set(["opacity","clipPath","filter","transform"]);function qN(e,t,n,{delay:s=0,duration:i=300,repeat:a=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const d={[t]:n};c&&(d.offset=c);const u=Qy(l,i);return Array.isArray(u)&&(d.easing=u),e.animate(d,{delay:s,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"})}const YN=Nh(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),sl=10,XN=2e4;function QN(e){return Bh(e.type)||e.type==="spring"||!Xy(e.ease)}function JN(e,t){const n=new Jh({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:e[0]};const i=[];let a=0;for(;!s.done&&a<XN;)s=n.sample(a),i.push(s.value),a+=sl;return{times:void 0,keyframes:i,duration:a-sl,ease:"linear"}}const M1={anticipate:c1,backInOut:l1,circInOut:u1};function ZN(e){return e in M1}class mm extends C1{constructor(t){super(t);const{name:n,motionValue:s,element:i,keyframes:a}=this.options;this.resolver=new S1(a,(o,l)=>this.onKeyframesResolved(o,l),n,s,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:s=300,times:i,ease:a,type:o,motionValue:l,name:c,startTime:d}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof a=="string"&&el()&&ZN(a)&&(a=M1[a]),QN(this.options)){const{onComplete:p,onUpdate:f,motionValue:m,element:b,...y}=this.options,v=JN(t,y);t=v.keyframes,t.length===1&&(t[1]=t[0]),s=v.duration,i=v.times,a=v.ease,o="keyframes"}const u=qN(l.owner.current,c,t,{...this.options,duration:s,times:i,ease:a});return u.startTime=d??this.calcStartTime(),this.pendingTimeline?(Zp(u,this.pendingTimeline),this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:p}=this.options;l.set(Pl(t,this.options,n)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:i,type:o,ease:a,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return jn(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return jn(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=kn(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return bt;const{animation:s}=n;Zp(s,t)}return bt}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:s,duration:i,type:a,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:u,onComplete:p,element:f,...m}=this.options,b=new Jh({...m,keyframes:s,duration:i,type:a,ease:o,times:l,isGenerator:!0}),y=kn(this.time);d.setWithVelocity(b.sample(y-sl).value,b.sample(y).value,sl)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:s,repeatDelay:i,repeatType:a,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=n.owner.getProps();return YN()&&s&&GN.has(s)&&!c&&!d&&!i&&a!=="mirror"&&o!==0&&l!=="inertia"}}const eS={type:"spring",stiffness:500,damping:25,restSpeed:10},tS=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),nS={type:"keyframes",duration:.8},sS={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rS=(e,{keyframes:t})=>t.length>2?nS:Us.has(e)?e.startsWith("scale")?tS(t[1]):eS:sS;function iS({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const Zh=(e,t,n,s={},i,a)=>o=>{const l=Ih(s,e)||{},c=l.delay||s.delay||0;let{elapsed:d=0}=s;d=d-kn(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:f=>{t.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:a?void 0:i};iS(l)||(u={...u,...rS(e,u)}),u.duration&&(u.duration=kn(u.duration)),u.repeatDelay&&(u.repeatDelay=kn(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let p=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(p=!0)),p&&!a&&t.get()!==void 0){const f=Pl(u.keyframes,l);if(f!==void 0)return we.update(()=>{u.onUpdate(f),u.onComplete()}),new Nj([])}return!a&&mm.supports(u)?new mm(u):new Jh(u)};function aS({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function R1(e,t,{delay:n=0,transitionOverride:s,type:i}={}){var a;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;s&&(o=s);const d=[],u=i&&e.animationState&&e.animationState.getState()[i];for(const p in c){const f=e.getValue(p,(a=e.latestValues[p])!==null&&a!==void 0?a:null),m=c[p];if(m===void 0||u&&aS(u,p))continue;const b={delay:n,...Ih(o||{},p)};let y=!1;if(window.MotionHandoffAnimation){const g=s1(e);if(g){const x=window.MotionHandoffAnimation(g,p,we);x!==null&&(b.startTime=x,y=!0)}}Xd(e,p),f.start(Zh(p,f,m,e.shouldReduceMotion&&t1.has(p)?{type:!1}:b,e,y));const v=f.animation;v&&d.push(v)}return l&&Promise.all(d).then(()=>{we.update(()=>{l&&Ij(e,l)})}),d}function su(e,t,n={}){var s;const i=Tl(e,t,n.type==="exit"?(s=e.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(a=n.transitionOverride);const o=i?()=>Promise.all(R1(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:p,staggerDirection:f}=a;return oS(e,t,u+d,p,f,n)}:()=>Promise.resolve(),{when:c}=a;if(c){const[d,u]=c==="beforeChildren"?[o,l]:[l,o];return d().then(()=>u())}else return Promise.all([o(),l(n.delay)])}function oS(e,t,n=0,s=0,i=1,a){const o=[],l=(e.variantChildren.size-1)*s,c=i===1?(d=0)=>d*s:(d=0)=>l-d*s;return Array.from(e.variantChildren).sort(lS).forEach((d,u)=>{d.notify("AnimationStart",t),o.push(su(d,t,{...a,delay:n+c(u)}).then(()=>d.notify("AnimationComplete",t)))}),Promise.all(o)}function lS(e,t){return e.sortNodePosition(t)}function cS(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(a=>su(e,a,n));s=Promise.all(i)}else if(typeof t=="string")s=su(e,t,n);else{const i=typeof t=="function"?Tl(e,t,n.custom):t;s=Promise.all(R1(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const dS=Ch.length;function z1(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?z1(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<dS;n++){const s=Ch[n],i=e.props[s];(ta(i)||i===!1)&&(t[s]=i)}return t}const uS=[...Sh].reverse(),hS=Sh.length;function fS(e){return t=>Promise.all(t.map(({animation:n,options:s})=>cS(e,n,s)))}function pS(e){let t=fS(e),n=gm(),s=!0;const i=c=>(d,u)=>{var p;const f=Tl(e,u,c==="exit"?(p=e.presenceContext)===null||p===void 0?void 0:p.custom:void 0);if(f){const{transition:m,transitionEnd:b,...y}=f;d={...d,...y,...b}}return d};function a(c){t=c(e)}function o(c){const{props:d}=e,u=z1(e.parent)||{},p=[],f=new Set;let m={},b=1/0;for(let v=0;v<hS;v++){const g=uS[v],x=n[g],w=d[g]!==void 0?d[g]:u[g],j=ta(w),k=g===c?x.isActive:null;k===!1&&(b=v);let N=w===u[g]&&w!==d[g]&&j;if(N&&s&&e.manuallyAnimateOnMount&&(N=!1),x.protectedKeys={...m},!x.isActive&&k===null||!w&&!x.prevProp||El(w)||typeof w=="boolean")continue;const S=mS(x.prevProp,w);let _=S||g===c&&x.isActive&&!N&&j||v>b&&j,R=!1;const L=Array.isArray(w)?w:[w];let P=L.reduce(i(g),{});k===!1&&(P={});const{prevResolvedValues:V={}}=x,M={...V,...P},B=F=>{_=!0,f.has(F)&&(R=!0,f.delete(F)),x.needsAnimating[F]=!0;const C=e.getValue(F);C&&(C.liveStyle=!1)};for(const F in M){const C=P[F],E=V[F];if(m.hasOwnProperty(F))continue;let z=!1;Gd(C)&&Gd(E)?z=!Gy(C,E):z=C!==E,z?C!=null?B(F):f.add(F):C!==void 0&&f.has(F)?B(F):x.protectedKeys[F]=!0}x.prevProp=w,x.prevResolvedValues=P,x.isActive&&(m={...m,...P}),s&&e.blockInitialAnimation&&(_=!1),_&&(!(N&&S)||R)&&p.push(...L.map(F=>({animation:F,options:{type:g}})))}if(f.size){const v={};f.forEach(g=>{const x=e.getBaseTarget(g),w=e.getValue(g);w&&(w.liveStyle=!0),v[g]=x??null}),p.push({animation:v})}let y=!!p.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(y=!1),s=!1,y?t(p):Promise.resolve()}function l(c,d){var u;if(n[c].isActive===d)return Promise.resolve();(u=e.variantChildren)===null||u===void 0||u.forEach(f=>{var m;return(m=f.animationState)===null||m===void 0?void 0:m.setActive(c,d)}),n[c].isActive=d;const p=o(c);for(const f in n)n[f].protectedKeys={};return p}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=gm(),s=!0}}}function mS(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Gy(t,e):!1}function ys(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function gm(){return{animate:ys(!0),whileInView:ys(),whileHover:ys(),whileTap:ys(),whileDrag:ys(),whileFocus:ys(),exit:ys()}}class ps{constructor(t){this.isMounted=!1,this.node=t}update(){}}class gS extends ps{constructor(t){super(t),t.animationState||(t.animationState=pS(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();El(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let xS=0;class yS extends ps{constructor(){super(...arguments),this.id=xS++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const vS={animation:{Feature:gS},exit:{Feature:yS}};function ia(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function ya(e){return{point:{x:e.pageX,y:e.pageY}}}const bS=e=>t=>Vh(t)&&e(t,ya(t));function Pi(e,t,n,s){return ia(e,t,bS(n),s)}const xm=(e,t)=>Math.abs(e-t);function wS(e,t){const n=xm(e.x,t.x),s=xm(e.y,t.y);return Math.sqrt(n**2+s**2)}class L1{constructor(t,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:a=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=Sc(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,m=wS(p.offset,{x:0,y:0})>=3;if(!f&&!m)return;const{point:b}=p,{timestamp:y}=Ke;this.history.push({...b,timestamp:y});const{onStart:v,onMove:g}=this.handlers;f||(v&&v(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,p)},this.handlePointerMove=(p,f)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=Nc(f,this.transformPagePoint),we.update(this.updatePoint,!0)},this.handlePointerUp=(p,f)=>{this.end();const{onEnd:m,onSessionEnd:b,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=Sc(p.type==="pointercancel"?this.lastMoveEventInfo:Nc(f,this.transformPagePoint),this.history);this.startEvent&&m&&m(p,v),b&&b(p,v)},!Vh(t))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const o=ya(t),l=Nc(o,this.transformPagePoint),{point:c}=l,{timestamp:d}=Ke;this.history=[{...c,timestamp:d}];const{onSessionStart:u}=n;u&&u(t,Sc(l,this.history)),this.removeListeners=xa(Pi(this.contextWindow,"pointermove",this.handlePointerMove),Pi(this.contextWindow,"pointerup",this.handlePointerUp),Pi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),is(this.updatePoint)}}function Nc(e,t){return t?{point:t(e.point)}:e}function ym(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Sc({point:e},t){return{point:e,delta:ym(e,O1(t)),offset:ym(e,kS(t)),velocity:jS(t,.1)}}function kS(e){return e[0]}function O1(e){return e[e.length-1]}function jS(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=O1(e);for(;n>=0&&(s=e[n],!(i.timestamp-s.timestamp>kn(t)));)n--;if(!s)return{x:0,y:0};const a=jn(i.timestamp-s.timestamp);if(a===0)return{x:0,y:0};const o={x:(i.x-s.x)/a,y:(i.y-s.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const D1=1e-4,NS=1-D1,SS=1+D1,I1=.01,CS=0-I1,ES=0+I1;function kt(e){return e.max-e.min}function _S(e,t,n){return Math.abs(e-t)<=n}function vm(e,t,n,s=.5){e.origin=s,e.originPoint=Se(t.min,t.max,e.origin),e.scale=kt(n)/kt(t),e.translate=Se(n.min,n.max,e.origin)-e.originPoint,(e.scale>=NS&&e.scale<=SS||isNaN(e.scale))&&(e.scale=1),(e.translate>=CS&&e.translate<=ES||isNaN(e.translate))&&(e.translate=0)}function Ai(e,t,n,s){vm(e.x,t.x,n.x,s?s.originX:void 0),vm(e.y,t.y,n.y,s?s.originY:void 0)}function bm(e,t,n){e.min=n.min+t.min,e.max=e.min+kt(t)}function TS(e,t,n){bm(e.x,t.x,n.x),bm(e.y,t.y,n.y)}function wm(e,t,n){e.min=t.min-n.min,e.max=e.min+kt(t)}function Mi(e,t,n){wm(e.x,t.x,n.x),wm(e.y,t.y,n.y)}function PS(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?Se(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?Se(n,e,s.max):Math.min(e,n)),e}function km(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function AS(e,{top:t,left:n,bottom:s,right:i}){return{x:km(e.x,n,i),y:km(e.y,t,s)}}function jm(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function MS(e,t){return{x:jm(e.x,t.x),y:jm(e.y,t.y)}}function RS(e,t){let n=.5;const s=kt(e),i=kt(t);return i>s?n=Dr(t.min,t.max-s,e.min):s>i&&(n=Dr(e.min,e.max-i,t.min)),_n(0,1,n)}function zS(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ru=.35;function LS(e=ru){return e===!1?e=0:e===!0&&(e=ru),{x:Nm(e,"left","right"),y:Nm(e,"top","bottom")}}function Nm(e,t,n){return{min:Sm(e,t),max:Sm(e,n)}}function Sm(e,t){return typeof e=="number"?e:e[t]||0}const Cm=()=>({translate:0,scale:1,origin:0,originPoint:0}),vr=()=>({x:Cm(),y:Cm()}),Em=()=>({min:0,max:0}),Ae=()=>({x:Em(),y:Em()});function Ct(e){return[e("x"),e("y")]}function B1({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function OS({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function DS(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Cc(e){return e===void 0||e===1}function iu({scale:e,scaleX:t,scaleY:n}){return!Cc(e)||!Cc(t)||!Cc(n)}function ks(e){return iu(e)||F1(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function F1(e){return _m(e.x)||_m(e.y)}function _m(e){return e&&e!=="0%"}function rl(e,t,n){const s=e-n,i=t*s;return n+i}function Tm(e,t,n,s,i){return i!==void 0&&(e=rl(e,i,s)),rl(e,n,s)+t}function au(e,t=0,n=1,s,i){e.min=Tm(e.min,t,n,s,i),e.max=Tm(e.max,t,n,s,i)}function V1(e,{x:t,y:n}){au(e.x,t.translate,t.scale,t.originPoint),au(e.y,n.translate,n.scale,n.originPoint)}const Pm=.999999999999,Am=1.0000000000001;function IS(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let l=0;l<i;l++){a=n[l],o=a.projectionDelta;const{visualElement:c}=a.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&a.options.layoutScroll&&a.scroll&&a!==a.root&&wr(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,V1(e,o)),s&&ks(a.latestValues)&&wr(e,a.latestValues))}t.x<Am&&t.x>Pm&&(t.x=1),t.y<Am&&t.y>Pm&&(t.y=1)}function br(e,t){e.min=e.min+t,e.max=e.max+t}function Mm(e,t,n,s,i=.5){const a=Se(e.min,e.max,i);au(e,t,n,a,s)}function wr(e,t){Mm(e.x,t.x,t.scaleX,t.scale,t.originX),Mm(e.y,t.y,t.scaleY,t.scale,t.originY)}function $1(e,t){return B1(DS(e.getBoundingClientRect(),t))}function BS(e,t,n){const s=$1(e,n),{scroll:i}=t;return i&&(br(s.x,i.offset.x),br(s.y,i.offset.y)),s}const U1=({current:e})=>e?e.ownerDocument.defaultView:null,FS=new WeakMap;class VS{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ae(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=u=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ya(u).point)},a=(u,p)=>{const{drag:f,dragPropagation:m,onDragStart:b}=this.getProps();if(f&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Rj(f),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ct(v=>{let g=this.getAxisMotionValue(v).get()||0;if(dn.test(g)){const{projection:x}=this.visualElement;if(x&&x.layout){const w=x.layout.layoutBox[v];w&&(g=kt(w)*(parseFloat(g)/100))}}this.originPoint[v]=g}),b&&we.postRender(()=>b(u,p)),Xd(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},o=(u,p)=>{const{dragPropagation:f,dragDirectionLock:m,onDirectionLock:b,onDrag:y}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:v}=p;if(m&&this.currentDirection===null){this.currentDirection=$S(v),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",p.point,v),this.updateAxis("y",p.point,v),this.visualElement.render(),y&&y(u,p)},l=(u,p)=>this.stop(u,p),c=()=>Ct(u=>{var p;return this.getAnimationState(u)==="paused"&&((p=this.getAxisMotionValue(u).animation)===null||p===void 0?void 0:p.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new L1(t,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:U1(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&we.postRender(()=>a(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:i}=this.getProps();if(!s||!Ka(t,i,this.currentDirection))return;const a=this.getAxisMotionValue(t);let o=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(o=PS(o,this.constraints[t],this.elastic[t])),a.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:s}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,a=this.constraints;n&&xr(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=AS(i.layoutBox,n):this.constraints=!1,this.elastic=LS(s),a!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Ct(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=zS(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!xr(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=BS(s,i.root,this.visualElement.getTransformPagePoint());let o=MS(i.layout.layoutBox,a);if(n){const l=n(OS(o));this.hasMutatedConstraints=!!l,l&&(o=B1(l))}return o}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=Ct(u=>{if(!Ka(u,n,this.currentDirection))return;let p=c&&c[u]||{};o&&(p={min:0,max:0});const f=i?200:1e6,m=i?40:1e7,b={type:"inertia",velocity:s?t[u]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...a,...p};return this.startAxisValueAnimation(u,b)});return Promise.all(d).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return Xd(this.visualElement,t),s.start(Zh(t,s,0,n,this.visualElement,!1))}stopAnimation(){Ct(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ct(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Ct(n=>{const{drag:s}=this.getProps();if(!Ka(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:l}=i.layout.layoutBox[n];a.set(t[n]-Se(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!xr(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ct(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();i[o]=RS({min:c,max:c},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Ct(o=>{if(!Ka(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:d}=this.constraints[o];l.set(Se(c,d,i[o]))})}addListeners(){if(!this.visualElement.current)return;FS.set(this.visualElement,this);const t=this.visualElement.current,n=Pi(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();xr(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,a=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),we.read(s);const o=ia(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(Ct(u=>{const p=this.getAxisMotionValue(u);p&&(this.originPoint[u]+=c[u].translate,p.set(p.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),a(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:o=ru,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function Ka(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function $S(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class US extends ps{constructor(t){super(t),this.removeGroupControls=bt,this.removeListeners=bt,this.controls=new VS(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||bt}unmount(){this.removeGroupControls(),this.removeListeners()}}const Rm=e=>(t,n)=>{e&&we.postRender(()=>e(t,n))};class HS extends ps{constructor(){super(...arguments),this.removePointerDownListener=bt}onPointerDown(t){this.session=new L1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:U1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:Rm(t),onStart:Rm(n),onMove:s,onEnd:(a,o)=>{delete this.session,i&&we.postRender(()=>i(a,o))}}}mount(){this.removePointerDownListener=Pi(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const vo={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function zm(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const oi={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(te.test(e))e=parseFloat(e);else return e;const n=zm(e,t.target.x),s=zm(e,t.target.y);return`${n}% ${s}%`}},WS={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=as.parse(e);if(i.length>5)return s;const a=as.createTransformer(e),o=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=l,i[1+o]/=c;const d=Se(l,c,.5);return typeof i[2+o]=="number"&&(i[2+o]/=d),typeof i[3+o]=="number"&&(i[3+o]/=d),a(i)}};class KS extends h.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:a}=t;hj(GS),a&&(n.group&&n.group.add(a),s&&s.register&&i&&s.register(a),a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),vo.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:i,isPresent:a}=this.props,o=s.projection;return o&&(o.isPresent=a,i||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?o.promote():o.relegate()||we.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),_h.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function H1(e){const[t,n]=Sy(),s=h.useContext(kh);return r.jsx(KS,{...e,layoutGroup:s,switchLayoutGroup:h.useContext(zy),isPresent:t,safeToRemove:n})}const GS={borderRadius:{...oi,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:oi,borderTopRightRadius:oi,borderBottomLeftRadius:oi,borderBottomRightRadius:oi,boxShadow:WS};function qS(e,t,n){const s=tt(e)?e:sa(e);return s.start(Zh("",s,t,n)),s.animation}function YS(e){return e instanceof SVGElement&&e.tagName!=="svg"}const XS=(e,t)=>e.depth-t.depth;class QS{constructor(){this.children=[],this.isDirty=!1}add(t){$h(this.children,t),this.isDirty=!0}remove(t){Uh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(XS),this.isDirty=!1,this.children.forEach(t)}}function JS(e,t){const n=un.now(),s=({timestamp:i})=>{const a=i-n;a>=t&&(is(s),e(a-t))};return we.read(s,!0),()=>is(s)}const W1=["TopLeft","TopRight","BottomLeft","BottomRight"],ZS=W1.length,Lm=e=>typeof e=="string"?parseFloat(e):e,Om=e=>typeof e=="number"||te.test(e);function e4(e,t,n,s,i,a){i?(e.opacity=Se(0,n.opacity!==void 0?n.opacity:1,t4(s)),e.opacityExit=Se(t.opacity!==void 0?t.opacity:1,0,n4(s))):a&&(e.opacity=Se(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;o<ZS;o++){const l=`border${W1[o]}Radius`;let c=Dm(t,l),d=Dm(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||Om(c)===Om(d)?(e[l]=Math.max(Se(Lm(c),Lm(d),s),0),(dn.test(d)||dn.test(c))&&(e[l]+="%")):e[l]=d}(t.rotate||n.rotate)&&(e.rotate=Se(t.rotate||0,n.rotate||0,s))}function Dm(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const t4=K1(0,.5,d1),n4=K1(.5,.95,bt);function K1(e,t,n){return s=>s<e?0:s>t?1:n(Dr(e,t,s))}function Im(e,t){e.min=t.min,e.max=t.max}function St(e,t){Im(e.x,t.x),Im(e.y,t.y)}function Bm(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Fm(e,t,n,s,i){return e-=t,e=rl(e,1/n,s),i!==void 0&&(e=rl(e,1/i,s)),e}function s4(e,t=0,n=1,s=.5,i,a=e,o=e){if(dn.test(t)&&(t=parseFloat(t),t=Se(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Se(a.min,a.max,s);e===a&&(l-=t),e.min=Fm(e.min,t,n,l,i),e.max=Fm(e.max,t,n,l,i)}function Vm(e,t,[n,s,i],a,o){s4(e,t[n],t[s],t[i],t.scale,a,o)}const r4=["x","scaleX","originX"],i4=["y","scaleY","originY"];function $m(e,t,n,s){Vm(e.x,t,r4,n?n.x:void 0,s?s.x:void 0),Vm(e.y,t,i4,n?n.y:void 0,s?s.y:void 0)}function Um(e){return e.translate===0&&e.scale===1}function G1(e){return Um(e.x)&&Um(e.y)}function Hm(e,t){return e.min===t.min&&e.max===t.max}function a4(e,t){return Hm(e.x,t.x)&&Hm(e.y,t.y)}function Wm(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function q1(e,t){return Wm(e.x,t.x)&&Wm(e.y,t.y)}function Km(e){return kt(e.x)/kt(e.y)}function Gm(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class o4{constructor(){this.members=[]}add(t){$h(this.members,t),t.scheduleRender()}remove(t){if(Uh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const a=this.members[i];if(a.isPresent!==!1){s=a;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function l4(e,t,n){let s="";const i=e.x.translate/t.x,a=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||a||o)&&(s=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:p,rotateY:f,skewX:m,skewY:b}=n;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),p&&(s+=`rotateX(${p}deg) `),f&&(s+=`rotateY(${f}deg) `),m&&(s+=`skewX(${m}deg) `),b&&(s+=`skewY(${b}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const js={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},gi=typeof window<"u"&&window.MotionDebug!==void 0,Ec=["","X","Y","Z"],c4={visibility:"hidden"},qm=1e3;let d4=0;function _c(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function Y1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=s1(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",we,!(i||a))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&Y1(s)}function X1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o={},l=t==null?void 0:t()){this.id=d4++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,gi&&(js.totalNodes=js.resolvedTargetDeltas=js.recalculatedProjection=0),this.nodes.forEach(f4),this.nodes.forEach(y4),this.nodes.forEach(v4),this.nodes.forEach(p4),gi&&window.MotionDebug.record(js)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new QS)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Hh),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=YS(o),this.instance=o;const{layoutId:c,layout:d,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(d||c)&&(this.isLayoutDirty=!0),e){let p;const f=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,p&&p(),p=JS(f,250),vo.hasAnimatedSinceResize&&(vo.hasAnimatedSinceResize=!1,this.nodes.forEach(Xm))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||d)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:f,hasRelativeTargetChanged:m,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||u.getDefaultTransition()||N4,{onLayoutAnimationStart:v,onLayoutAnimationComplete:g}=u.getProps(),x=!this.targetLayout||!q1(this.targetLayout,b)||m,w=!f&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||f&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(p,w);const j={...Ih(y,"layout"),onPlay:v,onComplete:g};(u.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j)}else f||Xm(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,is(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(b4),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Y1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const p=this.path[u];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ym);return}this.isUpdating||this.nodes.forEach(g4),this.isUpdating=!1,this.nodes.forEach(x4),this.nodes.forEach(u4),this.nodes.forEach(h4),this.clearAllSnapshots();const l=un.now();Ke.delta=_n(0,1e3/60,l-Ke.timestamp),Ke.timestamp=l,Ke.isProcessing=!0,yc.update.process(Ke),yc.preRender.process(Ke),yc.render.process(Ke),Ke.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,_h.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(m4),this.sharedNodes.forEach(w4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,we.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){we.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ae(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!G1(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;o&&(l||ks(this.latestValues)||u)&&(i(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),S4(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return Ae();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(C4))){const{scroll:u}=this.root;u&&(br(c.x,u.offset.x),br(c.y,u.offset.y))}return c}removeElementScroll(o){var l;const c=Ae();if(St(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:p,options:f}=u;u!==this.root&&p&&f.layoutScroll&&(p.wasRoot&&St(c,o),br(c.x,p.offset.x),br(c.y,p.offset.y))}return c}applyTransform(o,l=!1){const c=Ae();St(c,o);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&wr(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),ks(u.latestValues)&&wr(c,u.latestValues)}return ks(this.latestValues)&&wr(c,this.latestValues),c}removeTransform(o){const l=Ae();St(l,o);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!ks(d.latestValues))continue;iu(d.latestValues)&&d.updateSnapshot();const u=Ae(),p=d.measurePageBox();St(u,p),$m(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return ks(this.latestValues)&&$m(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ke.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(o||d&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:f}=this.options;if(!(!this.layout||!(p||f))){if(this.resolvedRelativeTargetAt=Ke.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ae(),this.relativeTargetOrigin=Ae(),Mi(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),St(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ae(),this.targetWithTransforms=Ae()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),TS(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):St(this.target,this.layout.layoutBox),V1(this.target,this.targetDelta)):St(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const m=this.getClosestProjectingParent();m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ae(),this.relativeTargetOrigin=Ae(),Mi(this.relativeTargetOrigin,this.target,m.target),St(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}gi&&js.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||iu(this.parent.latestValues)||F1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===Ke.timestamp&&(d=!1),d)return;const{layout:u,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||p))return;St(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;IS(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Ae());const{target:b}=l;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Bm(this.prevProjectionDelta.x,this.projectionDelta.x),Bm(this.prevProjectionDelta.y,this.projectionDelta.y)),Ai(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!Gm(this.projectionDelta.x,this.prevProjectionDelta.x)||!Gm(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),gi&&js.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=vr(),this.projectionDelta=vr(),this.projectionDeltaWithTransform=vr()}setAnimationOrigin(o,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},p=vr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=Ae(),m=c?c.source:void 0,b=this.layout?this.layout.source:void 0,y=m!==b,v=this.getStack(),g=!v||v.members.length<=1,x=!!(y&&!g&&this.options.crossfade===!0&&!this.path.some(j4));this.animationProgress=0;let w;this.mixTargetDelta=j=>{const k=j/1e3;Qm(p.x,o.x,k),Qm(p.y,o.y,k),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Mi(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),k4(this.relativeTarget,this.relativeTargetOrigin,f,k),w&&a4(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Ae()),St(w,this.relativeTarget)),y&&(this.animationValues=u,e4(u,d,this.latestValues,k,x,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(is(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=we.update(()=>{vo.hasAnimatedSinceResize=!0,this.currentAnimation=qS(0,qm,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(qm),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=o;if(!(!l||!c||!d)){if(this!==o&&this.layout&&d&&Q1(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||Ae();const p=kt(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+p;const f=kt(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+f}St(l,c),wr(l,u),Ai(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new o4),this.sharedNodes.get(o).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&_c("z",o,d,this.animationValues);for(let u=0;u<Ec.length;u++)_c(`rotate${Ec[u]}`,o,d,this.animationValues),_c(`skew${Ec[u]}`,o,d,this.animationValues);o.render();for(const u in d)o.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return c4;const d={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=xo(o==null?void 0:o.pointerEvents)||"",d.transform=u?u(this.latestValues,""):"none",d;const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){const y={};return this.options.layoutId&&(y.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,y.pointerEvents=xo(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!ks(this.latestValues)&&(y.transform=u?u({},""):"none",this.hasProjected=!1),y}const f=p.animationValues||p.latestValues;this.applyTransformsToTarget(),d.transform=l4(this.projectionDeltaWithTransform,this.treeScale,f),u&&(d.transform=u(f,d.transform));const{x:m,y:b}=this.projectionDelta;d.transformOrigin=`${m.origin*100}% ${b.origin*100}% 0`,p.animationValues?d.opacity=p===this?(c=(l=f.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:d.opacity=p===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const y in Zo){if(f[y]===void 0)continue;const{correct:v,applyTo:g}=Zo[y],x=d.transform==="none"?f[y]:v(f[y],p);if(g){const w=g.length;for(let j=0;j<w;j++)d[g[j]]=x}else d[y]=x}return this.options.layoutId&&(d.pointerEvents=p===this?xo(o==null?void 0:o.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Ym),this.root.sharedNodes.clear()}}}function u4(e){e.updateLayout()}function h4(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:a}=e.options,o=n.source!==e.layout.source;a==="size"?Ct(p=>{const f=o?n.measuredBox[p]:n.layoutBox[p],m=kt(f);f.min=s[p].min,f.max=f.min+m}):Q1(a,n.layoutBox,s)&&Ct(p=>{const f=o?n.measuredBox[p]:n.layoutBox[p],m=kt(s[p]);f.max=f.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+m)});const l=vr();Ai(l,s,n.layoutBox);const c=vr();o?Ai(c,e.applyTransform(i,!0),n.measuredBox):Ai(c,s,n.layoutBox);const d=!G1(l);let u=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:f,layout:m}=p;if(f&&m){const b=Ae();Mi(b,n.layoutBox,f.layoutBox);const y=Ae();Mi(y,s,m.layoutBox),q1(b,y)||(u=!0),p.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=b,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeTargetChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function f4(e){gi&&js.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function p4(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function m4(e){e.clearSnapshot()}function Ym(e){e.clearMeasurements()}function g4(e){e.isLayoutDirty=!1}function x4(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Xm(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function y4(e){e.resolveTargetDelta()}function v4(e){e.calcProjection()}function b4(e){e.resetSkewAndRotation()}function w4(e){e.removeLeadSnapshot()}function Qm(e,t,n){e.translate=Se(t.translate,0,n),e.scale=Se(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Jm(e,t,n,s){e.min=Se(t.min,n.min,s),e.max=Se(t.max,n.max,s)}function k4(e,t,n,s){Jm(e.x,t.x,n.x,s),Jm(e.y,t.y,n.y,s)}function j4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const N4={duration:.45,ease:[.4,0,.1,1]},Zm=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),e0=Zm("applewebkit/")&&!Zm("chrome/")?Math.round:bt;function t0(e){e.min=e0(e.min),e.max=e0(e.max)}function S4(e){t0(e.x),t0(e.y)}function Q1(e,t,n){return e==="position"||e==="preserve-aspect"&&!_S(Km(t),Km(n),.2)}function C4(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const E4=X1({attachResizeListener:(e,t)=>ia(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tc={current:void 0},J1=X1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Tc.current){const e=new E4({});e.mount(window),e.setOptions({layoutScroll:!0}),Tc.current=e}return Tc.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),_4={pan:{Feature:HS},drag:{Feature:US,ProjectionNode:J1,MeasureLayout:H1}};function n0(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,a=s[i];a&&we.postRender(()=>a(t,ya(t)))}class T4 extends ps{mount(){const{current:t}=this.node;t&&(this.unmount=_j(t,n=>(n0(this.node,n,"Start"),s=>n0(this.node,s,"End"))))}unmount(){}}class P4 extends ps{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xa(ia(this.node.current,"focus",()=>this.onFocus()),ia(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function s0(e,t,n){const{props:s}=e;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),a=s[i];a&&we.postRender(()=>a(t,ya(t)))}class A4 extends ps{mount(){const{current:t}=this.node;t&&(this.unmount=Mj(t,n=>(s0(this.node,n,"Start"),(s,{success:i})=>s0(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ou=new WeakMap,Pc=new WeakMap,M4=e=>{const t=ou.get(e.target);t&&t(e)},R4=e=>{e.forEach(M4)};function z4({root:e,...t}){const n=e||document;Pc.has(n)||Pc.set(n,{});const s=Pc.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(R4,{root:e,...t})),s[i]}function L4(e,t,n){const s=z4(t);return ou.set(e,n),s.observe(e),()=>{ou.delete(e),s.unobserve(e)}}const O4={some:0,all:1};class D4 extends ps{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:a}=t,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:O4[i]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,a&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:p}=this.node.getProps(),f=d?u:p;f&&f(c)};return L4(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(I4(t,n))&&this.startObserver()}unmount(){}}function I4({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const B4={inView:{Feature:D4},tap:{Feature:A4},focus:{Feature:P4},hover:{Feature:T4}},F4={layout:{ProjectionNode:J1,MeasureLayout:H1}},lu={current:null},Z1={current:!1};function V4(){if(Z1.current=!0,!!jh)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>lu.current=e.matches;e.addListener(t),t()}else lu.current=!1}const $4=[...N1,Je,as],U4=e=>$4.find(j1(e)),r0=new WeakMap;function H4(e,t,n){for(const s in t){const i=t[s],a=n[s];if(tt(i))e.addValue(s,i);else if(tt(a))e.addValue(s,sa(i,{owner:e}));else if(a!==i)if(e.hasValue(s)){const o=e.getValue(s);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(s);e.addValue(s,sa(o!==void 0?o:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const i0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class W4{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Xh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=un.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,we.render(this.render,!1,!0))};const{latestValues:c,renderState:d,onUpdate:u}=o;this.onUpdate=u,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=_l(n),this.isVariantNode=My(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in f){const b=f[m];c[m]!==void 0&&tt(b)&&b.set(c[m],!1)}}mount(t){this.current=t,r0.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Z1.current||V4(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:lu.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){r0.delete(this.current),this.projection&&this.projection.unmount(),is(this.notifyUpdate),is(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=Us.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&we.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),a=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),a(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ir){const n=Ir[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ae()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<i0.length;s++){const i=i0[s];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a="on"+i,o=t[a];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=H4(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=sa(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){var s;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(s=this.getBaseTargetFromProps(this.props,t))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(w1(i)||h1(i))?i=parseFloat(i):!U4(i)&&as.test(n)&&(i=y1(t,n)),this.setBaseTarget(t,tt(i)?i.get():i)),tt(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:s}=this.props;let i;if(typeof s=="string"||typeof s=="object"){const o=Ph(this.props,s,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(i=o[t])}if(s&&i!==void 0)return i;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!tt(a)?a:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Hh),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class ev extends W4{constructor(){super(...arguments),this.KeyframeResolver=S1}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;tt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function K4(e){return window.getComputedStyle(e)}class G4 extends ev{constructor(){super(...arguments),this.type="html",this.renderInstance=Vy}readValueFromInstance(t,n){if(Us.has(n)){const s=Yh(n);return s&&s.default||0}else{const s=K4(t),i=(Iy(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return $1(t,n)}build(t,n,s){Rh(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Dh(t,n,s)}}class q4 extends ev{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ae}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Us.has(n)){const s=Yh(n);return s&&s.default||0}return n=$y.has(n)?n:Eh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return Wy(t,n,s)}build(t,n,s){zh(t,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,s,i){Uy(t,n,s,i)}mount(t){this.isSVGTag=Oh(t.tagName),super.mount(t)}}const Y4=(e,t)=>Th(e)?new q4(t):new G4(t,{allowProjection:e!==h.Fragment}),X4=wj({...vS,...B4,..._4,...F4},Y4),H=O5(X4);/**
|
|
77
77
|
* @license lucide-react v0.462.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
@@ -706,18 +706,18 @@ Error generating stack: `+a.message+`
|
|
|
706
706
|
*/const Oe=D("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"}]]),vv={welcome:{tagline:"Your AI Brain",title:"Must-b",sleeping:"Sleeping...",waking:"Waking up...",awake:"Awakening...",wakeBtn:"Wake Must-b",wakeHint:"Tap to continue",reconfigure:"Reconfigure",footer:"© 2026 Must-b — Auto Step Platform"},sidebar:{newChat:"New Chat",recentChats:"Recent Chats",primary:"Primary",personalization:"Personalization",platform:"Platform",system:"System",automations:"My Automations",activeWorkflows:"Active Workflows",products:"Skills & Plugins",clients:"Client Management",integrations:"Integrations",logs:"Logs & Activity",settings:"Settings",logout:"Logout",poweredBy:"Powered by",deleteChat:"Delete Chat?",deleteConfirm:"This action cannot be undone.",cancel:"Cancel",delete:"Delete"},rightPanel:{agentRole:"Agent Role",hardware:"Hardware Score",model:"Active Model",connected:"Gateway Connected",rank:{master:"Master",planner:"Planner",worker:"Worker"}},workflow:{title:"Active Workflow",idle:"Idle — awaiting task",goal:"Goal",steps:{browse:"Opening browser",write:"Writing file",think:"Thinking",exec:"Executing command"}},dashboard:{placeholder:"Send a message to Must-b...",thinking:"Must-b is thinking..."},layout:{chats:"Chats",system:"System",openChats:"Open chat history",openSystem:"Open system panel",closePanel:"Close panel"},chat:{inputPlaceholder:"Ask Must-b anything…",listening:"Listening…",thoughtProcess:"Thought Process",saveAsSkill:"Save as Skill",skillSaved:"Skill saved to your library!",saving:"Saving…",retry:"Retry",save:"Save",guidance:"Guidance",errorBoundary:"Chat rendering error — reloading…",disclaimer:"Must-b is a cognitive assistant; verify critical outputs for accuracy.",placeholder:"What do you want to know?",tools:"Tools",attachFile:"Attach file",startDictation:"Start voice dictation",stopDictation:"Stop dictation",settingsAck:"Got it, settings updated permanently.",professionAck:"I've completed the necessary research on your profession and noted it in my mind (must-b.md). I'm now ready as your **{profession}** assistant."},nav:{chat:"Chat",browser:"Browser",workflows:"Workflows",voice:"Voice",settings:"Settings",files:"Files",memory:"Memory",apiKeys:"API Keys",skills:"Skills",plugins:"Plugins",mind:"Must-b Mind",channels:"Channels"},voice:{title:"Must-b Voice Command",back:"Go Back",wakeHint:'Say "Hey Must-b" to get started.',tapHint:"Tap the microphone to begin.",heard:"I hear you…",listening:"Listening…",stopHint:"Click to stop",thinking:"Processing…",cmdHint:"Go ahead, I'm listening…",speakingHint:"Must-b is speaking…"},dock:{chat:"Chat",files:"Files",browser:"Browser",skills:"Skills",memory:"Memory",plugins:"Plugins",workflows:"Workflows",settings:"Settings",system:"System",close:"Close",cat_webTools:"Web Tools",cat_fileMedia:"File & Media",cat_aiAgents:"AI & Agents",cat_systemTools:"System Tools",skill_webSearch:"Web Search",skill_webFetch:"Web Fetch",skill_browserControl:"Browser Control",skill_pdfReader:"PDF Reader",skill_imageAnalysis:"Image Analysis",skill_imageGeneration:"Image Generation",skill_tts:"Text-to-Speech",skill_spawnAgent:"Spawn Sub-Agent",skill_agentSessions:"Agent Sessions",skill_canvas:"Canvas",skill_git:"Git Operations",skill_gateway:"Gateway",skill_fileManager:"File Manager",skill_cron:"Cron Scheduler",skill_messages:"Messages",desc_webSearch:"Real-time web search (multi-provider)",desc_webFetch:"Fetch any URL as clean text",desc_browserControl:"Full Playwright browser automation",desc_pdfReader:"Extract & analyse PDF documents",desc_imageAnalysis:"Describe and analyse images",desc_imageGeneration:"Create AI-generated images",desc_tts:"Convert text to natural speech",desc_spawnAgent:"Launch a new autonomous agent session",desc_agentSessions:"List and manage active sessions",desc_canvas:"Visual drawing & whiteboard workspace",desc_git:"Commit, branch, diff, push/pull",desc_gateway:"Inter-system & A2A communication",desc_fileManager:"Read, write & manage files",desc_cron:"Schedule recurring tasks",desc_messages:"Send & receive inter-agent messages",cat_knowledgeBase:"Knowledge Base",cat_personalOrg:"Personal Organisation",mem_browse:"Browse Memories",mem_search:"Search Memory",mem_add:"Add Memory",mem_contacts:"Contacts",mem_calendar:"Calendar",desc_memBrowse:"View all stored knowledge entries",desc_memSearch:"Semantic search across your KB",desc_memAdd:"Store new facts and knowledge",desc_contacts:"Manage people and organisations",desc_calendar:"Schedule and manage events",cat_pluginManager:"Plugin Manager",cat_developer:"Developer",plug_marketplace:"Marketplace",plug_installed:"Installed",plug_mcp:"MCP Servers",plug_bundleMcp:"Bundle MCP",plug_cliCmds:"CLI Commands",desc_marketplace:"Discover plugins on ClawHub",desc_installed:"Manage and configure installed plugins",desc_mcp:"Model Context Protocol integrations",desc_bundleMcp:"Package & deploy MCP tool bundles",desc_cliCmds:"Custom slash command registration",cat_automation:"Automation",cat_advanced:"Advanced",wf_automations:"Automations",wf_scheduled:"Scheduled Tasks",wf_commands:"Commands",wf_nodes:"Nodes Workflow",wf_multiAgent:"Multi-Agent",desc_automations:"Build and run automated workflows",desc_scheduled:"Manage all cron schedules",desc_commands:"Custom slash commands",desc_nodes:"Visual node-graph pipelines",desc_multiAgent:"Orchestrate agent collaboration"},systemHealth:{lite:"LITE",safe:"SAFE",critical:"Critical",warning:"Warning",info:"Info",title:"System Health",moreModels:"More Models / API Settings",kinds:{cpu:"CPU",ram:"RAM",memory:"Memory",storage:"Storage",network:"Network",process:"Process",battery:"Battery",thermal:"Thermal",disk:"Disk"},alerts:{cpu_high:"High CPU usage — LLM load is saturating the system.",ram_high:"High memory usage — performance may degrade.",ram_critical:"Memory critical — system lockup risk."},recommendations:{cpu_high:"Close background processes or switch to a smaller model.",ram_high:"Consider switching to a lighter model.",ram_critical:"Switch to an 8B or 14B model immediately."}},panels:{memory:{title:"Memory Insights",indexLabel:"Index:",clearIndex:"Clear Index",searchPlaceholder:"Search your memory…",searchHint:"Semantic similarity search — press Enter or click",emptyTitle:"Search your AI memory",emptyNoResults:"No memories found",emptyHint:"Type a phrase to find semantically similar skills, conversations, and workspace files.",emptyNoResultsHint:"Try a different phrase or index more content using the controls above.",refreshStats:"Refresh stats",indexControls:"Index controls",vectors:"vectors",skills:"skills",files:"files",indexed:"Indexed",indexCleared:"Index cleared",opFailed:"Operation failed",reqError:"Request error"},plugins:{title:"Plugin Architect",newPlugin:"New Plugin",buildTitle:"Build New Plugin",namePlaceholder:"Plugin name (e.g. weather-monitor)",goalPlaceholder:"Goal (e.g. poll OpenWeather API every 5 min)",contextPlaceholder:"Optional context / notes",generatePlugin:"Generate Plugin",emptyTitle:"No plugins installed",emptyHint:'Click "New Plugin" to generate your first plugin.',installed:"installed",running:"RUNNING",stop:"Stop",run:"Run",opFailed:"Operation failed",reqError:"Request error",buildFailed:"Build failed",refresh:"Refresh"},skills:{title:"Skill Library",loading:"Loading skills…",emptyTitle:"No skills saved yet",emptyHint:"Complete a workflow in the Chat tab, then click",saveAsSkill:"Save as Skill",emptyHint2:"to build your library.",runningStatus:"Running skill…",completedStatus:"Skill completed",failedStatus:"Skill run failed",never:"Never",deleteConfirm:"Delete?",yes:"Yes",no:"No",runBtn:"Run",runningBtn:"Running…",doneBtn:"Done",lastRun:"last run"},settings:{title:"Settings",hardwareScore:"Hardware Score",searchPlaceholder:"Search providers…",allProviders:"All",apiKey:"API Key",baseUrl:"Base URL",model:"Model",testConnection:"Test Connection",save:"Save",testOk:"Connection successful",testFail:"Connection failed",saved:"Saved",saving:"Saving…",testing:"Testing…",apiKeyWarning:"API key required — update your key to continue."}}},UC={welcome:{tagline:"Yapay Zeka Beyniniz",title:"Must-b",sleeping:"Uyuyor...",waking:"Uyandırılıyor...",awake:"Uyanıyor...",wakeBtn:"Must-b'yi Uyandır",wakeHint:"Devam etmek için uyandır",reconfigure:"Yeniden Yapılandır",footer:"© 2026 Must-b — Auto Step Platform"},sidebar:{newChat:"Yeni Sohbet",recentChats:"Son Sohbetler",primary:"Birincil",personalization:"Kişiselleştirme",platform:"Platform",system:"Sistem",automations:"Otomasyonlarım",activeWorkflows:"Aktif İş Akışları",products:"Araçlar & Eklentiler",clients:"Müşteri Yönetimi",integrations:"Entegrasyonlar",logs:"Kayıtlar & Aktivite",settings:"Ayarlar",logout:"Çıkış",poweredBy:"Altyapısı:",deleteChat:"Sohbet Silinsin mi?",deleteConfirm:"Bu işlem geri alınamaz.",cancel:"İptal",delete:"Sil"},rightPanel:{agentRole:"Ajan Rolü",hardware:"Donanım Puanı",model:"Aktif Model",connected:"Gateway Bağlı",rank:{master:"Usta",planner:"Planlayıcı",worker:"İşçi"}},workflow:{title:"Aktif İş Akışı",idle:"Boşta — görev bekleniyor",goal:"Hedef",steps:{browse:"Tarayıcı açılıyor",write:"Dosya yazılıyor",think:"Düşünülüyor",exec:"Komut çalıştırılıyor"}},dashboard:{placeholder:"Must-b'ye bir mesaj gönderin...",thinking:"Must-b düşünüyor..."},layout:{chats:"Sohbetler",system:"Sistem",openChats:"Sohbet geçmişini aç",openSystem:"Sistem panelini aç",closePanel:"Paneli kapat"},chat:{inputPlaceholder:"Must-b'ye her şeyi sorun…",listening:"Dinleniyor…",thoughtProcess:"Düşünce Süreci",saveAsSkill:"Beceri Olarak Kaydet",skillSaved:"Beceri kütüphanenize kaydedildi!",saving:"Kaydediliyor…",retry:"Tekrar Dene",save:"Kaydet",guidance:"Rehberlik",errorBoundary:"Sohbet render hatası — yeniden yükleniyor…",disclaimer:"Must-b bilişsel bir asistandır; kritik çıktıları doğrulamanız önerilir.",placeholder:"Ne öğrenmek istiyorsunuz?",tools:"Araçlar",attachFile:"Dosya ekle",startDictation:"Sesli giriş başlat",stopDictation:"Durdur",settingsAck:"Anlaşıldı, ayarlar kalıcı olarak güncellendi.",professionAck:"Mesleğiniz hakkında gerekli araştırmaları yaptım ve zihnime (must-b.md) not aldım. Artık bir **{profession}** asistanı olarak hazırım."},nav:{chat:"Sohbet",browser:"Tarayıcı",workflows:"İş Akışları",voice:"Sesli",settings:"Ayarlar",files:"Dosyalar",memory:"Bellek",apiKeys:"API Anahtarları",skills:"Beceriler",plugins:"Eklentiler",mind:"Must-b Zihni",channels:"Kanallar"},voice:{title:"Must-b Sesli Komuta",back:"Geri Dön",wakeHint:'"Hey Must-b" demeyi dene.',tapHint:"Başlamak için mikrofona dokunun.",heard:"Sizi duyuyorum…",listening:"Dinleniyor…",stopHint:"Durdurmak için tıklayın",thinking:"İşleniyor…",cmdHint:"Buyurun, dinliyorum…",speakingHint:"Must-b konuşuyor…"},systemHealth:{lite:"LITE",safe:"GÜVENLİ",critical:"Kritik",warning:"Uyarı",info:"Bilgi",title:"Sistem Durumu",moreModels:"Daha Fazla Model / API Ayarları",kinds:{cpu:"İşlemci",ram:"RAM",memory:"Bellek",storage:"Depolama",network:"Ağ",process:"İşlem",battery:"Batarya",thermal:"Isı",disk:"Disk"},alerts:{cpu_high:"İşlemci kullanımı yüksek — LLM yükü sistemi doyuruyor.",ram_high:"Bellek kullanımı yüksek — performans düşebilir.",ram_critical:"Bellek kritik — sistem kilitlenme riski var."},recommendations:{cpu_high:"Arka plan işlemlerini kapatın veya daha küçük bir modele geçin.",ram_high:"Daha hafif bir modele geçmeyi düşünün.",ram_critical:"Hemen 8B veya 14B bir modele geçin."}},dock:{chat:"Sohbet",files:"Dosyalar",browser:"Tarayıcı",skills:"Beceriler",memory:"Bellek",plugins:"Eklentiler",workflows:"İş Akışları",settings:"Ayarlar",system:"Sistem",close:"Kapat",cat_webTools:"Web Araçları",cat_fileMedia:"Dosya & Medya",cat_aiAgents:"Yapay Zeka & Ajanlar",cat_systemTools:"Sistem Araçları",skill_webSearch:"Web Arama",skill_webFetch:"Web Çekme",skill_browserControl:"Tarayıcı Kontrolü",skill_pdfReader:"PDF Okuyucu",skill_imageAnalysis:"Görüntü Analizi",skill_imageGeneration:"Görüntü Oluşturma",skill_tts:"Metinden Sese",skill_spawnAgent:"Alt Ajan Başlat",skill_agentSessions:"Ajan Oturumları",skill_canvas:"Tuval",skill_git:"Git İşlemleri",skill_gateway:"Ağ Geçidi",skill_fileManager:"Dosya Yöneticisi",skill_cron:"Zamanlayıcı",skill_messages:"Mesajlar",desc_webSearch:"Gerçek zamanlı web araması (çoklu sağlayıcı)",desc_webFetch:"Herhangi bir URL'yi metin olarak çek",desc_browserControl:"Tam Playwright tarayıcı otomasyonu",desc_pdfReader:"PDF belgelerini çıkar ve analiz et",desc_imageAnalysis:"Görüntüleri tanımla ve analiz et",desc_imageGeneration:"Yapay zeka ile görüntü oluştur",desc_tts:"Metni doğal sese dönüştür",desc_spawnAgent:"Yeni özerk ajan oturumu başlat",desc_agentSessions:"Aktif oturumları listele ve yönet",desc_canvas:"Görsel çizim & beyaz tahta",desc_git:"Commit, branch, diff, push/pull",desc_gateway:"Sistemler arası & A2A iletişim",desc_fileManager:"Dosyaları oku, yaz ve yönet",desc_cron:"Tekrarlayan görevleri zamanla",desc_messages:"Ajanlar arası mesaj gönder ve al",cat_knowledgeBase:"Bilgi Tabanı",cat_personalOrg:"Kişisel Organizasyon",mem_browse:"Belleklere Göz At",mem_search:"Bellekte Ara",mem_add:"Bellek Ekle",mem_contacts:"Kişiler",mem_calendar:"Takvim",desc_memBrowse:"Tüm saklanan bilgi girişlerini görüntüle",desc_memSearch:"Bilgi tabanında anlamsal arama",desc_memAdd:"Yeni bilgi ve gerçekleri sakla",desc_contacts:"Kişileri ve kuruluşları yönet",desc_calendar:"Etkinlikleri zamanla ve yönet",cat_pluginManager:"Eklenti Yöneticisi",cat_developer:"Geliştirici",plug_marketplace:"Pazar Yeri",plug_installed:"Yüklü Eklentiler",plug_mcp:"MCP Sunucuları",plug_bundleMcp:"MCP Paketi",plug_cliCmds:"CLI Komutları",desc_marketplace:"ClawHub'da eklentileri keşfet",desc_installed:"Yüklü eklentileri yönet ve yapılandır",desc_mcp:"Model Context Protocol entegrasyonları",desc_bundleMcp:"MCP araç paketlerini oluştur ve dağıt",desc_cliCmds:"Özel eğik çizgi komutları kaydı",cat_automation:"Otomasyon",cat_advanced:"Gelişmiş",wf_automations:"Otomasyonlar",wf_scheduled:"Zamanlanmış Görevler",wf_commands:"Komutlar",wf_nodes:"Düğüm İş Akışı",wf_multiAgent:"Çoklu Ajan",desc_automations:"Otomatik iş akışları oluştur ve çalıştır",desc_scheduled:"Tüm cron zamanlamalarını yönet",desc_commands:"Özel eğik çizgi komutları",desc_nodes:"Görsel düğüm-grafik iş hatları",desc_multiAgent:"Ajan işbirliğini düzenle"},panels:{memory:{title:"Bellek Görüşleri",indexLabel:"İndeks:",clearIndex:"İndeksi Temizle",searchPlaceholder:"Belleğinizde arayın…",searchHint:"Anlamsal benzerlik araması — Enter'a basın veya tıklayın",emptyTitle:"Yapay Zeka Belleğinizi Arayın",emptyNoResults:"Bellek bulunamadı",emptyHint:"Beceriler, sohbetler ve dosyalarda anlamsal olarak benzer içerik bulmak için bir ifade yazın.",emptyNoResultsHint:"Farklı bir ifade deneyin veya yukarıdaki kontrollerle daha fazla içerik ekleyin.",refreshStats:"İstatistikleri yenile",indexControls:"İndeks kontrolleri",vectors:"vektör",skills:"beceri",files:"dosya",indexed:"İndekslendi",indexCleared:"İndeks temizlendi",opFailed:"İşlem başarısız",reqError:"İstek hatası"},plugins:{title:"Eklenti Mimarı",newPlugin:"Yeni Eklenti",buildTitle:"Yeni Eklenti Oluştur",namePlaceholder:"Eklenti adı (örn. hava-durumu-monitörü)",goalPlaceholder:"Hedef (örn. OpenWeather API'yi 5 dakikada bir sorgula)",contextPlaceholder:"İsteğe bağlı bağlam / notlar",generatePlugin:"Eklenti Oluştur",emptyTitle:"Yüklü eklenti yok",emptyHint:'İlk eklentinizi oluşturmak için "Yeni Eklenti"ye tıklayın.',installed:"yüklü",running:"ÇALIŞIYOR",stop:"Durdur",run:"Çalıştır",opFailed:"İşlem başarısız",reqError:"İstek hatası",buildFailed:"Oluşturma başarısız",refresh:"Yenile"},skills:{title:"Beceri Kütüphanesi",loading:"Beceriler yükleniyor…",emptyTitle:"Henüz kaydedilmiş beceri yok",emptyHint:"Sohbet sekmesinde bir iş akışını tamamlayın, ardından tıklayın",saveAsSkill:"Beceri Olarak Kaydet",emptyHint2:"kütüphanenizi oluşturmak için.",runningStatus:"Beceri çalışıyor…",completedStatus:"Beceri tamamlandı",failedStatus:"Beceri çalıştırma başarısız",never:"Hiçbir zaman",deleteConfirm:"Sil?",yes:"Evet",no:"Hayır",runBtn:"Çalıştır",runningBtn:"Çalışıyor…",doneBtn:"Tamamlandı",lastRun:"son çalıştırma"},settings:{title:"Ayarlar",hardwareScore:"Donanım Puanı",searchPlaceholder:"Sağlayıcı ara…",allProviders:"Tümü",apiKey:"API Anahtarı",baseUrl:"Temel URL",model:"Model",testConnection:"Bağlantıyı Test Et",save:"Kaydet",testOk:"Bağlantı başarılı",testFail:"Bağlantı başarısız",saved:"Kaydedildi",saving:"Kaydediliyor…",testing:"Test ediliyor…",apiKeyWarning:"API anahtarı gerekli — devam etmek için anahtarınızı güncelleyin."}}},HC={welcome:{tagline:"Ihr KI-Gehirn",title:"Must-b",sleeping:"Schläft...",waking:"Wird geweckt...",awake:"Erwacht...",wakeBtn:"Must-b wecken",wakeHint:"Tippen zum Fortfahren",reconfigure:"Neu konfigurieren",footer:"© 2026 Must-b — Auto Step Platform"},sidebar:{newChat:"Neuer Chat",recentChats:"Letzte Chats",platform:"Plattform",system:"System",automations:"Meine Automatisierungen",activeWorkflows:"Aktive Workflows",products:"Skills & Plugins",clients:"Kundenverwaltung",integrations:"Integrationen",logs:"Protokolle & Aktivität",settings:"Einstellungen",logout:"Abmelden",poweredBy:"Betrieben von",deleteChat:"Chat löschen?",deleteConfirm:"Diese Aktion kann nicht rückgängig gemacht werden.",cancel:"Abbrechen",delete:"Löschen"},rightPanel:{agentRole:"Agentenrolle",hardware:"Hardware-Score",model:"Aktives Modell",connected:"Gateway verbunden",rank:{master:"Meister",planner:"Planer",worker:"Arbeiter"}},workflow:{title:"Aktiver Workflow",idle:"Leerlauf — wartet auf Aufgabe",goal:"Ziel",steps:{browse:"Browser wird geöffnet",write:"Datei wird geschrieben",think:"Wird nachgedacht",exec:"Befehl wird ausgeführt"}},dashboard:{placeholder:"Nachricht an Must-b senden...",thinking:"Must-b denkt nach..."},layout:{chats:"Chats",system:"System",openChats:"Chatverlauf öffnen",openSystem:"Systembereich öffnen",closePanel:"Bereich schließen"},chat:{inputPlaceholder:"Fragen Sie Must-b alles…",listening:"Höre zu…",thoughtProcess:"Denkprozess",saveAsSkill:"Als Fähigkeit speichern",skillSaved:"Fähigkeit in Ihrer Bibliothek gespeichert!",saving:"Speichere…",retry:"Erneut versuchen",save:"Speichern",guidance:"Hinweis",errorBoundary:"Chat rendering error — reloading…",disclaimer:"Must-b is a cognitive assistant; verify critical outputs for accuracy.",placeholder:"What do you want to know?",tools:"Tools",attachFile:"Attach file",startDictation:"Start voice dictation",stopDictation:"Stop dictation"},nav:{chat:"Chat",browser:"Browser",workflows:"Workflows",voice:"Voice",settings:"Settings",files:"Files",memory:"Memory",apiKeys:"API Keys",channels:"Kanäle"},voice:{title:"Must-b Voice Command",back:"Go Back",wakeHint:'Say "Hey Must-b" to get started.',tapHint:"Tap the microphone to begin.",heard:"I hear you…",listening:"Listening…",stopHint:"Click to stop",thinking:"Processing…",cmdHint:"Go ahead, I am listening…",speakingHint:"Must-b is speaking…"},dock:{chat:"Chat",files:"Dateien",browser:"Browser",skills:"Fähigkeiten",memory:"Gedächtnis",plugins:"Plugins",workflows:"Workflows",settings:"Einstellungen",system:"System",close:"Schließen",cat_webTools:"Web-Werkzeuge",cat_fileMedia:"Datei & Medien",cat_aiAgents:"KI & Agenten",cat_systemTools:"Systemwerkzeuge",skill_webSearch:"Websuche",skill_webFetch:"Web-Abruf",skill_browserControl:"Browser-Steuerung",skill_pdfReader:"PDF-Leser",skill_imageAnalysis:"Bildanalyse",skill_imageGeneration:"Bilderzeugung",skill_tts:"Text-zu-Sprache",skill_spawnAgent:"Unteragent starten",skill_agentSessions:"Agentensitzungen",skill_canvas:"Leinwand",skill_git:"Git-Operationen",skill_gateway:"Gateway",skill_fileManager:"Dateimanager",skill_cron:"Aufgabenplaner",skill_messages:"Nachrichten",desc_webSearch:"Echtzeit-Websuche (Multi-Provider)",desc_webFetch:"Beliebige URL als sauberen Text abrufen",desc_browserControl:"Vollständige Playwright-Browserautomatisierung",desc_pdfReader:"PDF-Dokumente extrahieren & analysieren",desc_imageAnalysis:"Bilder beschreiben und analysieren",desc_imageGeneration:"KI-generierte Bilder erstellen",desc_tts:"Text in natürliche Sprache umwandeln",desc_spawnAgent:"Neue autonome Agentensitzung starten",desc_agentSessions:"Aktive Sitzungen auflisten und verwalten",desc_canvas:"Visueller Zeichen- & Whiteboard-Bereich",desc_git:"Commit, Branch, Diff, Push/Pull",desc_gateway:"Systemübergreifende & A2A-Kommunikation",desc_fileManager:"Dateien lesen, schreiben & verwalten",desc_cron:"Wiederkehrende Aufgaben planen",desc_messages:"Agenten-Nachrichten senden & empfangen",cat_knowledgeBase:"Wissensdatenbank",cat_personalOrg:"Persönliche Organisation",mem_browse:"Erinnerungen durchsuchen",mem_search:"Gedächtnis suchen",mem_add:"Erinnerung hinzufügen",mem_contacts:"Kontakte",mem_calendar:"Kalender",desc_memBrowse:"Alle gespeicherten Wissenseinträge anzeigen",desc_memSearch:"Semantische Suche in der Wissensdatenbank",desc_memAdd:"Neue Fakten und Wissen speichern",desc_contacts:"Personen und Organisationen verwalten",desc_calendar:"Termine planen und verwalten",cat_pluginManager:"Plugin-Manager",cat_developer:"Entwickler",plug_marketplace:"Marktplatz",plug_installed:"Installiert",plug_mcp:"MCP-Server",plug_bundleMcp:"MCP bündeln",plug_cliCmds:"CLI-Befehle",desc_marketplace:"Plugins auf ClawHub entdecken",desc_installed:"Installierte Plugins verwalten und konfigurieren",desc_mcp:"Model Context Protocol-Integrationen",desc_bundleMcp:"MCP-Werkzeugpakete erstellen & bereitstellen",desc_cliCmds:"Benutzerdefinierte Schrägstrichbefehle registrieren",cat_automation:"Automatisierung",cat_advanced:"Erweitert",wf_automations:"Automatisierungen",wf_scheduled:"Geplante Aufgaben",wf_commands:"Befehle",wf_nodes:"Knoten-Workflow",wf_multiAgent:"Multi-Agent",desc_automations:"Automatisierte Workflows erstellen und ausführen",desc_scheduled:"Alle Cron-Zeitpläne verwalten",desc_commands:"Benutzerdefinierte Schrägstrichbefehle",desc_nodes:"Visuelle Knoten-Graph-Pipelines",desc_multiAgent:"Agentenzusammenarbeit orchestrieren"},systemHealth:{lite:"LITE",safe:"SAFE",critical:"Critical",warning:"Warning",info:"Info",title:"System Health",kinds:{cpu:"CPU",ram:"RAM",memory:"Memory",storage:"Storage",network:"Network",process:"Process",battery:"Battery",thermal:"Thermal",disk:"Disk"},moreModels:"More Models / API Settings"},panels:{memory:{title:"Gedächtnisübersicht",indexLabel:"Index:",clearIndex:"Index löschen",searchPlaceholder:"Gedächtnis durchsuchen…",searchHint:"Semantische Ähnlichkeitssuche — Enter drücken oder klicken",emptyTitle:"KI-Gedächtnis durchsuchen",emptyNoResults:"Keine Erinnerungen gefunden",emptyHint:"Geben Sie einen Begriff ein, um semantisch ähnliche Fähigkeiten, Gespräche und Dateien zu finden.",emptyNoResultsHint:"Versuchen Sie eine andere Formulierung oder indizieren Sie mehr Inhalte.",refreshStats:"Statistiken aktualisieren",indexControls:"Indexsteuerung",vectors:"Vektoren",skills:"Fähigkeiten",files:"Dateien",indexed:"Indiziert",indexCleared:"Index gelöscht",opFailed:"Vorgang fehlgeschlagen",reqError:"Anfragefehler"},plugins:{title:"Plugin-Architekt",newPlugin:"Neues Plugin",buildTitle:"Neues Plugin erstellen",namePlaceholder:"Plugin-Name (z.B. wetter-monitor)",goalPlaceholder:"Ziel (z.B. OpenWeather API alle 5 Min. abfragen)",contextPlaceholder:"Optionaler Kontext / Notizen",generatePlugin:"Plugin generieren",emptyTitle:"Keine Plugins installiert",emptyHint:'Klicken Sie auf "Neues Plugin", um Ihr erstes Plugin zu erstellen.',installed:"installiert",running:"LÄUFT",stop:"Stoppen",run:"Ausführen",opFailed:"Vorgang fehlgeschlagen",reqError:"Anfragefehler",buildFailed:"Erstellung fehlgeschlagen",refresh:"Aktualisieren"},skills:{title:"Fähigkeitenbibliothek",loading:"Fähigkeiten werden geladen…",emptyTitle:"Noch keine Fähigkeiten gespeichert",emptyHint:"Schließen Sie einen Workflow im Chat-Tab ab, dann klicken Sie auf",saveAsSkill:"Als Fähigkeit speichern",emptyHint2:"um Ihre Bibliothek aufzubauen.",runningStatus:"Fähigkeit wird ausgeführt…",completedStatus:"Fähigkeit abgeschlossen",failedStatus:"Ausführung fehlgeschlagen",never:"Nie",deleteConfirm:"Löschen?",yes:"Ja",no:"Nein",runBtn:"Ausführen",runningBtn:"Läuft…",doneBtn:"Fertig",lastRun:"letzter Lauf"},settings:{title:"Einstellungen",hardwareScore:"Hardware-Score",searchPlaceholder:"Anbieter suchen…",allProviders:"Alle",apiKey:"API-Schlüssel",baseUrl:"Basis-URL",model:"Modell",testConnection:"Verbindung testen",save:"Speichern",testOk:"Verbindung erfolgreich",testFail:"Verbindung fehlgeschlagen",saved:"Gespeichert",saving:"Speichern…",testing:"Teste…",apiKeyWarning:"API-Schlüssel erforderlich — aktualisieren Sie Ihren Schlüssel."}}},WC={welcome:{tagline:"Votre cerveau IA",title:"Must-b",sleeping:"En veille...",waking:"Réveil en cours...",awake:"Éveil...",wakeBtn:"Réveiller Must-b",wakeHint:"Appuyez pour continuer",reconfigure:"Reconfigurer",footer:"© 2026 Must-b — Plateforme Auto Step"},sidebar:{newChat:"Nouvelle discussion",recentChats:"Discussions récentes",platform:"Plateforme",system:"Système",automations:"Mes automatisations",activeWorkflows:"Flux de travail actifs",products:"Skills & Plugins",clients:"Gestion des clients",integrations:"Intégrations",logs:"Journaux & Activité",settings:"Paramètres",logout:"Déconnexion",poweredBy:"Propulsé par",deleteChat:"Supprimer la discussion ?",deleteConfirm:"Cette action est irréversible.",cancel:"Annuler",delete:"Supprimer"},rightPanel:{agentRole:"Rôle de l'agent",hardware:"Score matériel",model:"Modèle actif",connected:"Passerelle connectée",rank:{master:"Maître",planner:"Planificateur",worker:"Exécutant"}},workflow:{title:"Flux de travail actif",idle:"Inactif — en attente d'une tâche",goal:"Objectif",steps:{browse:"Ouverture du navigateur",write:"Écriture du fichier",think:"Réflexion",exec:"Exécution de la commande"}},dashboard:{placeholder:"Envoyer un message à Must-b...",thinking:"Must-b réfléchit..."},layout:{chats:"Discussions",system:"Système",openChats:"Ouvrir l'historique des discussions",openSystem:"Ouvrir le panneau système",closePanel:"Fermer le panneau"},chat:{inputPlaceholder:"Posez n'importe quelle question à Must-b…",listening:"Écoute en cours…",thoughtProcess:"Processus de réflexion",saveAsSkill:"Enregistrer comme compétence",skillSaved:"Compétence enregistrée dans votre bibliothèque !",saving:"Enregistrement…",retry:"Réessayer",save:"Enregistrer",guidance:"Conseils",errorBoundary:"Chat rendering error — reloading…",disclaimer:"Must-b is a cognitive assistant; verify critical outputs for accuracy.",placeholder:"What do you want to know?",tools:"Tools",attachFile:"Attach file",startDictation:"Start voice dictation",stopDictation:"Stop dictation"},nav:{chat:"Chat",browser:"Browser",workflows:"Workflows",voice:"Voice",settings:"Settings",files:"Files",memory:"Memory",apiKeys:"API Keys",channels:"Canaux"},voice:{title:"Must-b Voice Command",back:"Go Back",wakeHint:'Say "Hey Must-b" to get started.',tapHint:"Tap the microphone to begin.",heard:"I hear you…",listening:"Listening…",stopHint:"Click to stop",thinking:"Processing…",cmdHint:"Go ahead, I am listening…",speakingHint:"Must-b is speaking…"},dock:{chat:"Discussion",files:"Fichiers",browser:"Navigateur",skills:"Compétences",memory:"Mémoire",plugins:"Plugins",workflows:"Flux de travail",settings:"Paramètres",system:"Système",close:"Fermer",cat_webTools:"Outils web",cat_fileMedia:"Fichiers & Médias",cat_aiAgents:"IA & Agents",cat_systemTools:"Outils système",skill_webSearch:"Recherche web",skill_webFetch:"Récupération web",skill_browserControl:"Contrôle du navigateur",skill_pdfReader:"Lecteur PDF",skill_imageAnalysis:"Analyse d'image",skill_imageGeneration:"Génération d'image",skill_tts:"Synthèse vocale",skill_spawnAgent:"Créer un sous-agent",skill_agentSessions:"Sessions d'agents",skill_canvas:"Tableau de travail",skill_git:"Opérations Git",skill_gateway:"Passerelle",skill_fileManager:"Gestionnaire de fichiers",skill_cron:"Planificateur Cron",skill_messages:"Messages",desc_webSearch:"Recherche web en temps réel (multi-fournisseur)",desc_webFetch:"Récupérer n'importe quelle URL en texte brut",desc_browserControl:"Automatisation complète du navigateur Playwright",desc_pdfReader:"Extraire et analyser des documents PDF",desc_imageAnalysis:"Décrire et analyser des images",desc_imageGeneration:"Créer des images générées par IA",desc_tts:"Convertir du texte en parole naturelle",desc_spawnAgent:"Lancer une nouvelle session d'agent autonome",desc_agentSessions:"Lister et gérer les sessions actives",desc_canvas:"Espace de dessin visuel et tableau blanc",desc_git:"Commit, branche, diff, push/pull",desc_gateway:"Communication inter-systèmes & A2A",desc_fileManager:"Lire, écrire et gérer des fichiers",desc_cron:"Planifier des tâches récurrentes",desc_messages:"Envoyer & recevoir des messages inter-agents",cat_knowledgeBase:"Base de connaissances",cat_personalOrg:"Organisation personnelle",mem_browse:"Parcourir les souvenirs",mem_search:"Rechercher dans la mémoire",mem_add:"Ajouter un souvenir",mem_contacts:"Contacts",mem_calendar:"Calendrier",desc_memBrowse:"Voir toutes les entrées de connaissances stockées",desc_memSearch:"Recherche sémantique dans votre base de connaissances",desc_memAdd:"Stocker de nouveaux faits et connaissances",desc_contacts:"Gérer les personnes et organisations",desc_calendar:"Planifier et gérer des événements",cat_pluginManager:"Gestionnaire de plugins",cat_developer:"Développeur",plug_marketplace:"Marché",plug_installed:"Installés",plug_mcp:"Serveurs MCP",plug_bundleMcp:"Bundle MCP",plug_cliCmds:"Commandes CLI",desc_marketplace:"Découvrir des plugins sur ClawHub",desc_installed:"Gérer et configurer les plugins installés",desc_mcp:"Intégrations du protocole de contexte de modèle",desc_bundleMcp:"Empaqueter et déployer des bundles d'outils MCP",desc_cliCmds:"Enregistrement de commandes slash personnalisées",cat_automation:"Automatisation",cat_advanced:"Avancé",wf_automations:"Automatisations",wf_scheduled:"Tâches planifiées",wf_commands:"Commandes",wf_nodes:"Flux de nœuds",wf_multiAgent:"Multi-Agent",desc_automations:"Créer et exécuter des flux de travail automatisés",desc_scheduled:"Gérer tous les plannings cron",desc_commands:"Commandes slash personnalisées",desc_nodes:"Pipelines visuels en graphe de nœuds",desc_multiAgent:"Orchestrer la collaboration entre agents"},systemHealth:{lite:"LITE",safe:"SAFE",critical:"Critical",warning:"Warning",info:"Info",title:"System Health",kinds:{cpu:"CPU",ram:"RAM",memory:"Memory",storage:"Storage",network:"Network",process:"Process",battery:"Battery",thermal:"Thermal",disk:"Disk"},moreModels:"More Models / API Settings"},panels:{memory:{title:"Aperçus de la mémoire",indexLabel:"Index :",clearIndex:"Effacer l'index",searchPlaceholder:"Rechercher dans votre mémoire…",searchHint:"Recherche par similarité sémantique — appuyez sur Entrée ou cliquez",emptyTitle:"Recherchez dans votre mémoire IA",emptyNoResults:"Aucun souvenir trouvé",emptyHint:"Saisissez une phrase pour trouver des compétences, conversations et fichiers sémantiquement similaires.",emptyNoResultsHint:"Essayez une phrase différente ou indexez plus de contenu via les contrôles ci-dessus.",refreshStats:"Actualiser les statistiques",indexControls:"Contrôles de l'index",vectors:"vecteurs",skills:"compétences",files:"fichiers",indexed:"Indexé",indexCleared:"Index effacé",opFailed:"Opération échouée",reqError:"Erreur de requête"},plugins:{title:"Architecte de plugins",newPlugin:"Nouveau plugin",buildTitle:"Créer un nouveau plugin",namePlaceholder:"Nom du plugin (ex. weather-monitor)",goalPlaceholder:"Objectif (ex. interroger l'API OpenWeather toutes les 5 min)",contextPlaceholder:"Contexte / notes optionnels",generatePlugin:"Générer le plugin",emptyTitle:"Aucun plugin installé",emptyHint:"Cliquez sur « Nouveau plugin » pour générer votre premier plugin.",installed:"installé",running:"EN COURS",stop:"Arrêter",run:"Exécuter",opFailed:"Opération échouée",reqError:"Erreur de requête",buildFailed:"Échec de la compilation",refresh:"Actualiser"},skills:{title:"Bibliothèque de compétences",loading:"Chargement des compétences…",emptyTitle:"Aucune compétence enregistrée",emptyHint:"Terminez un flux de travail dans l'onglet Discussion, puis cliquez sur",saveAsSkill:"Enregistrer comme compétence",emptyHint2:"pour constituer votre bibliothèque.",runningStatus:"Exécution de la compétence…",completedStatus:"Compétence terminée",failedStatus:"Échec de l'exécution",never:"Jamais",deleteConfirm:"Supprimer ?",yes:"Oui",no:"Non",runBtn:"Exécuter",runningBtn:"En cours…",doneBtn:"Terminé",lastRun:"dernière exécution"},settings:{title:"Paramètres",hardwareScore:"Score matériel",searchPlaceholder:"Rechercher des fournisseurs…",allProviders:"Tous",apiKey:"Clé API",baseUrl:"URL de base",model:"Modèle",testConnection:"Tester la connexion",save:"Enregistrer",testOk:"Connexion réussie",testFail:"Échec de la connexion",saved:"Enregistré",saving:"Enregistrement…",testing:"Test en cours…",apiKeyWarning:"Clé API requise — mettez à jour votre clé pour continuer."}}},KC={welcome:{tagline:"Tu cerebro de IA",title:"Must-b",sleeping:"Durmiendo...",waking:"Despertando...",awake:"Despertando...",wakeBtn:"Despertar Must-b",wakeHint:"Toca para continuar",reconfigure:"Reconfigurar",footer:"© 2026 Must-b — Plataforma Auto Step"},sidebar:{newChat:"Nueva conversación",recentChats:"Conversaciones recientes",platform:"Plataforma",system:"Sistema",automations:"Mis automatizaciones",activeWorkflows:"Flujos de trabajo activos",products:"Skills & Plugins",clients:"Gestión de clientes",integrations:"Integraciones",logs:"Registros y actividad",settings:"Configuración",logout:"Cerrar sesión",poweredBy:"Desarrollado por",deleteChat:"¿Eliminar conversación?",deleteConfirm:"Esta acción no se puede deshacer.",cancel:"Cancelar",delete:"Eliminar"},rightPanel:{agentRole:"Rol del agente",hardware:"Puntuación de hardware",model:"Modelo activo",connected:"Puerta de enlace conectada",rank:{master:"Maestro",planner:"Planificador",worker:"Trabajador"}},workflow:{title:"Flujo de trabajo activo",idle:"Inactivo — esperando tarea",goal:"Objetivo",steps:{browse:"Abriendo navegador",write:"Escribiendo archivo",think:"Pensando",exec:"Ejecutando comando"}},dashboard:{placeholder:"Envía un mensaje a Must-b...",thinking:"Must-b está pensando..."},layout:{chats:"Conversaciones",system:"Sistema",openChats:"Abrir historial de conversaciones",openSystem:"Abrir panel del sistema",closePanel:"Cerrar panel"},chat:{inputPlaceholder:"Pregunta cualquier cosa a Must-b…",listening:"Escuchando…",thoughtProcess:"Proceso de pensamiento",saveAsSkill:"Guardar como habilidad",skillSaved:"¡Habilidad guardada en tu biblioteca!",saving:"Guardando…",retry:"Reintentar",save:"Guardar",guidance:"Orientación",errorBoundary:"Chat rendering error — reloading…",disclaimer:"Must-b is a cognitive assistant; verify critical outputs for accuracy.",placeholder:"What do you want to know?",tools:"Tools",attachFile:"Attach file",startDictation:"Start voice dictation",stopDictation:"Stop dictation"},nav:{chat:"Chat",browser:"Browser",workflows:"Workflows",voice:"Voice",settings:"Settings",files:"Files",memory:"Memory",apiKeys:"API Keys",channels:"Canales"},voice:{title:"Must-b Voice Command",back:"Go Back",wakeHint:'Say "Hey Must-b" to get started.',tapHint:"Tap the microphone to begin.",heard:"I hear you…",listening:"Listening…",stopHint:"Click to stop",thinking:"Processing…",cmdHint:"Go ahead, I am listening…",speakingHint:"Must-b is speaking…"},dock:{chat:"Conversación",files:"Archivos",browser:"Navegador",skills:"Habilidades",memory:"Memoria",plugins:"Plugins",workflows:"Flujos de trabajo",settings:"Configuración",system:"Sistema",close:"Cerrar",cat_webTools:"Herramientas web",cat_fileMedia:"Archivos y medios",cat_aiAgents:"IA y agentes",cat_systemTools:"Herramientas del sistema",skill_webSearch:"Búsqueda web",skill_webFetch:"Recuperación web",skill_browserControl:"Control del navegador",skill_pdfReader:"Lector de PDF",skill_imageAnalysis:"Análisis de imagen",skill_imageGeneration:"Generación de imágenes",skill_tts:"Texto a voz",skill_spawnAgent:"Crear subagente",skill_agentSessions:"Sesiones de agentes",skill_canvas:"Lienzo",skill_git:"Operaciones Git",skill_gateway:"Puerta de enlace",skill_fileManager:"Gestor de archivos",skill_cron:"Planificador Cron",skill_messages:"Mensajes",desc_webSearch:"Búsqueda web en tiempo real (multi-proveedor)",desc_webFetch:"Obtener cualquier URL como texto limpio",desc_browserControl:"Automatización completa del navegador con Playwright",desc_pdfReader:"Extraer y analizar documentos PDF",desc_imageAnalysis:"Describir y analizar imágenes",desc_imageGeneration:"Crear imágenes generadas por IA",desc_tts:"Convertir texto en habla natural",desc_spawnAgent:"Iniciar una nueva sesión de agente autónomo",desc_agentSessions:"Listar y gestionar sesiones activas",desc_canvas:"Espacio de dibujo visual y pizarra",desc_git:"Commit, rama, diff, push/pull",desc_gateway:"Comunicación entre sistemas y A2A",desc_fileManager:"Leer, escribir y gestionar archivos",desc_cron:"Programar tareas recurrentes",desc_messages:"Enviar y recibir mensajes entre agentes",cat_knowledgeBase:"Base de conocimientos",cat_personalOrg:"Organización personal",mem_browse:"Explorar recuerdos",mem_search:"Buscar en memoria",mem_add:"Agregar recuerdo",mem_contacts:"Contactos",mem_calendar:"Calendario",desc_memBrowse:"Ver todas las entradas de conocimiento almacenadas",desc_memSearch:"Búsqueda semántica en tu base de conocimientos",desc_memAdd:"Almacenar nuevos hechos y conocimientos",desc_contacts:"Gestionar personas y organizaciones",desc_calendar:"Programar y gestionar eventos",cat_pluginManager:"Gestor de plugins",cat_developer:"Desarrollador",plug_marketplace:"Mercado",plug_installed:"Instalados",plug_mcp:"Servidores MCP",plug_bundleMcp:"Bundle MCP",plug_cliCmds:"Comandos CLI",desc_marketplace:"Descubrir plugins en ClawHub",desc_installed:"Gestionar y configurar plugins instalados",desc_mcp:"Integraciones del Protocolo de Contexto de Modelo",desc_bundleMcp:"Empaquetar y desplegar bundles de herramientas MCP",desc_cliCmds:"Registro de comandos slash personalizados",cat_automation:"Automatización",cat_advanced:"Avanzado",wf_automations:"Automatizaciones",wf_scheduled:"Tareas programadas",wf_commands:"Comandos",wf_nodes:"Flujo de nodos",wf_multiAgent:"Multi-Agente",desc_automations:"Crear y ejecutar flujos de trabajo automatizados",desc_scheduled:"Gestionar todos los programas cron",desc_commands:"Comandos slash personalizados",desc_nodes:"Pipelines visuales en grafo de nodos",desc_multiAgent:"Orquestar la colaboración entre agentes"},systemHealth:{lite:"LITE",safe:"SAFE",critical:"Critical",warning:"Warning",info:"Info",title:"System Health",kinds:{cpu:"CPU",ram:"RAM",memory:"Memory",storage:"Storage",network:"Network",process:"Process",battery:"Battery",thermal:"Thermal",disk:"Disk"},moreModels:"More Models / API Settings"},panels:{memory:{title:"Perspectivas de memoria",indexLabel:"Índice:",clearIndex:"Limpiar índice",searchPlaceholder:"Buscar en tu memoria…",searchHint:"Búsqueda por similitud semántica — presiona Enter o haz clic",emptyTitle:"Busca en tu memoria de IA",emptyNoResults:"No se encontraron recuerdos",emptyHint:"Escribe una frase para encontrar habilidades, conversaciones y archivos semánticamente similares.",emptyNoResultsHint:"Prueba una frase diferente o indexa más contenido usando los controles de arriba.",refreshStats:"Actualizar estadísticas",indexControls:"Controles de índice",vectors:"vectores",skills:"habilidades",files:"archivos",indexed:"Indexado",indexCleared:"Índice limpiado",opFailed:"Operación fallida",reqError:"Error de solicitud"},plugins:{title:"Arquitecto de plugins",newPlugin:"Nuevo plugin",buildTitle:"Crear nuevo plugin",namePlaceholder:"Nombre del plugin (ej. weather-monitor)",goalPlaceholder:"Objetivo (ej. consultar la API OpenWeather cada 5 min)",contextPlaceholder:"Contexto / notas opcionales",generatePlugin:"Generar plugin",emptyTitle:"No hay plugins instalados",emptyHint:"Haz clic en «Nuevo plugin» para generar tu primer plugin.",installed:"instalado",running:"EN EJECUCIÓN",stop:"Detener",run:"Ejecutar",opFailed:"Operación fallida",reqError:"Error de solicitud",buildFailed:"Error de compilación",refresh:"Actualizar"},skills:{title:"Biblioteca de habilidades",loading:"Cargando habilidades…",emptyTitle:"No hay habilidades guardadas aún",emptyHint:"Completa un flujo de trabajo en la pestaña Conversación, luego haz clic en",saveAsSkill:"Guardar como habilidad",emptyHint2:"para construir tu biblioteca.",runningStatus:"Ejecutando habilidad…",completedStatus:"Habilidad completada",failedStatus:"Fallo en la ejecución",never:"Nunca",deleteConfirm:"¿Eliminar?",yes:"Sí",no:"No",runBtn:"Ejecutar",runningBtn:"Ejecutando…",doneBtn:"Listo",lastRun:"última ejecución"},settings:{title:"Configuración",hardwareScore:"Puntuación de hardware",searchPlaceholder:"Buscar proveedores…",allProviders:"Todos",apiKey:"Clave API",baseUrl:"URL base",model:"Modelo",testConnection:"Probar conexión",save:"Guardar",testOk:"Conexión exitosa",testFail:"Conexión fallida",saved:"Guardado",saving:"Guardando…",testing:"Probando…",apiKeyWarning:"Clave API requerida — actualiza tu clave para continuar."}}},GC={welcome:{tagline:"あなたのAIブレイン",title:"Must-b",sleeping:"スリープ中...",waking:"起動中...",awake:"覚醒中...",wakeBtn:"Must-bを起動",wakeHint:"タップして続行",reconfigure:"再設定",footer:"© 2026 Must-b — Auto Step Platform"},sidebar:{newChat:"新しいチャット",recentChats:"最近のチャット",platform:"プラットフォーム",system:"システム",automations:"マイオートメーション",activeWorkflows:"アクティブなワークフロー",products:"スキル & プラグイン",clients:"クライアント管理",integrations:"インテグレーション",logs:"ログ・アクティビティ",settings:"設定",logout:"ログアウト",poweredBy:"提供:",deleteChat:"チャットを削除しますか?",deleteConfirm:"この操作は元に戻せません。",cancel:"キャンセル",delete:"削除"},rightPanel:{agentRole:"エージェントの役割",hardware:"ハードウェアスコア",model:"アクティブモデル",connected:"ゲートウェイ接続済み",rank:{master:"マスター",planner:"プランナー",worker:"ワーカー"}},workflow:{title:"アクティブなワークフロー",idle:"待機中 — タスクを待っています",goal:"目標",steps:{browse:"ブラウザを開いています",write:"ファイルを書き込んでいます",think:"考えています",exec:"コマンドを実行しています"}},dashboard:{placeholder:"Must-bにメッセージを送信...",thinking:"Must-bが考えています..."},layout:{chats:"チャット",system:"システム",openChats:"チャット履歴を開く",openSystem:"システムパネルを開く",closePanel:"パネルを閉じる"},chat:{inputPlaceholder:"Must-bに何でも聞いてください…",listening:"聞いています…",thoughtProcess:"思考プロセス",saveAsSkill:"スキルとして保存",skillSaved:"スキルがライブラリに保存されました!",saving:"保存中…",retry:"再試行",save:"保存",guidance:"ガイダンス",errorBoundary:"Chat rendering error — reloading…",disclaimer:"Must-b is a cognitive assistant; verify critical outputs for accuracy.",placeholder:"What do you want to know?",tools:"Tools",attachFile:"Attach file",startDictation:"Start voice dictation",stopDictation:"Stop dictation"},nav:{chat:"Chat",browser:"Browser",workflows:"Workflows",voice:"Voice",settings:"Settings",files:"Files",memory:"Memory",apiKeys:"API Keys",channels:"チャンネル"},voice:{title:"Must-b Voice Command",back:"Go Back",wakeHint:'Say "Hey Must-b" to get started.',tapHint:"Tap the microphone to begin.",heard:"I hear you…",listening:"Listening…",stopHint:"Click to stop",thinking:"Processing…",cmdHint:"Go ahead, I am listening…",speakingHint:"Must-b is speaking…"},dock:{chat:"チャット",files:"ファイル",browser:"ブラウザ",skills:"スキル",memory:"メモリ",plugins:"プラグイン",workflows:"ワークフロー",settings:"設定",system:"システム",close:"閉じる",cat_webTools:"ウェブツール",cat_fileMedia:"ファイル・メディア",cat_aiAgents:"AI・エージェント",cat_systemTools:"システムツール",skill_webSearch:"ウェブ検索",skill_webFetch:"ウェブ取得",skill_browserControl:"ブラウザ制御",skill_pdfReader:"PDFリーダー",skill_imageAnalysis:"画像分析",skill_imageGeneration:"画像生成",skill_tts:"テキスト読み上げ",skill_spawnAgent:"サブエージェント作成",skill_agentSessions:"エージェントセッション",skill_canvas:"キャンバス",skill_git:"Git操作",skill_gateway:"ゲートウェイ",skill_fileManager:"ファイルマネージャー",skill_cron:"Cronスケジューラー",skill_messages:"メッセージ",desc_webSearch:"リアルタイムウェブ検索(マルチプロバイダー)",desc_webFetch:"任意のURLをクリーンなテキストとして取得",desc_browserControl:"Playwrightによる完全なブラウザ自動化",desc_pdfReader:"PDFドキュメントの抽出と分析",desc_imageAnalysis:"画像の説明と分析",desc_imageGeneration:"AI生成画像の作成",desc_tts:"テキストを自然な音声に変換",desc_spawnAgent:"新しい自律エージェントセッションを起動",desc_agentSessions:"アクティブセッションの一覧と管理",desc_canvas:"ビジュアル描画・ホワイトボードワークスペース",desc_git:"コミット、ブランチ、差分、プッシュ/プル",desc_gateway:"システム間・A2A通信",desc_fileManager:"ファイルの読み取り、書き込み、管理",desc_cron:"定期タスクのスケジュール",desc_messages:"エージェント間メッセージの送受信",cat_knowledgeBase:"ナレッジベース",cat_personalOrg:"個人管理",mem_browse:"メモリを閲覧",mem_search:"メモリを検索",mem_add:"メモリを追加",mem_contacts:"連絡先",mem_calendar:"カレンダー",desc_memBrowse:"保存されたすべての知識エントリを表示",desc_memSearch:"ナレッジベース全体のセマンティック検索",desc_memAdd:"新しい事実と知識を保存",desc_contacts:"人物と組織の管理",desc_calendar:"イベントのスケジュールと管理",cat_pluginManager:"プラグインマネージャー",cat_developer:"開発者",plug_marketplace:"マーケットプレイス",plug_installed:"インストール済み",plug_mcp:"MCPサーバー",plug_bundleMcp:"MCPバンドル",plug_cliCmds:"CLIコマンド",desc_marketplace:"ClawHubでプラグインを探す",desc_installed:"インストール済みプラグインの管理と設定",desc_mcp:"モデルコンテキストプロトコル統合",desc_bundleMcp:"MCPツールバンドルのパッケージ化とデプロイ",desc_cliCmds:"カスタムスラッシュコマンドの登録",cat_automation:"自動化",cat_advanced:"高度な設定",wf_automations:"自動化",wf_scheduled:"スケジュールタスク",wf_commands:"コマンド",wf_nodes:"ノードワークフロー",wf_multiAgent:"マルチエージェント",desc_automations:"自動化されたワークフローの構築と実行",desc_scheduled:"すべてのCronスケジュールを管理",desc_commands:"カスタムスラッシュコマンド",desc_nodes:"ビジュアルノードグラフパイプライン",desc_multiAgent:"エージェント間の協調をオーケストレーション"},systemHealth:{lite:"LITE",safe:"SAFE",critical:"Critical",warning:"Warning",info:"Info",title:"System Health",kinds:{cpu:"CPU",ram:"RAM",memory:"Memory",storage:"Storage",network:"Network",process:"Process",battery:"Battery",thermal:"Thermal",disk:"Disk"},moreModels:"More Models / API Settings"},panels:{memory:{title:"メモリインサイト",indexLabel:"インデックス:",clearIndex:"インデックスをクリア",searchPlaceholder:"メモリを検索…",searchHint:"セマンティック類似性検索 — Enterキーを押すかクリック",emptyTitle:"AIメモリを検索",emptyNoResults:"メモリが見つかりません",emptyHint:"フレーズを入力して、意味的に類似したスキル、会話、ワークスペースファイルを見つけてください。",emptyNoResultsHint:"別のフレーズを試すか、上のコントロールを使ってより多くのコンテンツをインデックスしてください。",refreshStats:"統計を更新",indexControls:"インデックスコントロール",vectors:"ベクター",skills:"スキル",files:"ファイル",indexed:"インデックス済み",indexCleared:"インデックスをクリアしました",opFailed:"操作に失敗しました",reqError:"リクエストエラー"},plugins:{title:"プラグインアーキテクト",newPlugin:"新しいプラグイン",buildTitle:"新しいプラグインを作成",namePlaceholder:"プラグイン名(例:weather-monitor)",goalPlaceholder:"目標(例:5分ごとにOpenWeather APIをポーリング)",contextPlaceholder:"オプションのコンテキスト / メモ",generatePlugin:"プラグインを生成",emptyTitle:"プラグインがインストールされていません",emptyHint:"「新しいプラグイン」をクリックして最初のプラグインを生成してください。",installed:"インストール済み",running:"実行中",stop:"停止",run:"実行",opFailed:"操作に失敗しました",reqError:"リクエストエラー",buildFailed:"ビルド失敗",refresh:"更新"},skills:{title:"スキルライブラリ",loading:"スキルを読み込んでいます…",emptyTitle:"スキルがまだ保存されていません",emptyHint:"チャットタブでワークフローを完了したら、クリック",saveAsSkill:"スキルとして保存",emptyHint2:"してライブラリを構築してください。",runningStatus:"スキルを実行中…",completedStatus:"スキル完了",failedStatus:"スキルの実行に失敗しました",never:"なし",deleteConfirm:"削除しますか?",yes:"はい",no:"いいえ",runBtn:"実行",runningBtn:"実行中…",doneBtn:"完了",lastRun:"最終実行"},settings:{title:"設定",hardwareScore:"ハードウェアスコア",searchPlaceholder:"プロバイダーを検索…",allProviders:"すべて",apiKey:"APIキー",baseUrl:"ベースURL",model:"モデル",testConnection:"接続をテスト",save:"保存",testOk:"接続成功",testFail:"接続失敗",saved:"保存済み",saving:"保存中…",testing:"テスト中…",apiKeyWarning:"APIキーが必要です — 続行するにはキーを更新してください。"}}},qC={welcome:{tagline:"您的AI大脑",title:"Must-b",sleeping:"休眠中...",waking:"唤醒中...",awake:"正在觉醒...",wakeBtn:"唤醒 Must-b",wakeHint:"点击继续",reconfigure:"重新配置",footer:"© 2026 Must-b — Auto Step 平台"},sidebar:{newChat:"新建对话",recentChats:"最近对话",platform:"平台",system:"系统",automations:"我的自动化",activeWorkflows:"活跃工作流",products:"技能与插件",clients:"客户管理",integrations:"集成",logs:"日志与活动",settings:"设置",logout:"退出登录",poweredBy:"技术支持:",deleteChat:"删除对话?",deleteConfirm:"此操作无法撤销。",cancel:"取消",delete:"删除"},rightPanel:{agentRole:"代理角色",hardware:"硬件评分",model:"活跃模型",connected:"网关已连接",rank:{master:"主控",planner:"规划者",worker:"执行者"}},workflow:{title:"活跃工作流",idle:"空闲中 — 等待任务",goal:"目标",steps:{browse:"正在打开浏览器",write:"正在写入文件",think:"正在思考",exec:"正在执行命令"}},dashboard:{placeholder:"向 Must-b 发送消息...",thinking:"Must-b 正在思考..."},layout:{chats:"对话",system:"系统",openChats:"打开对话历史",openSystem:"打开系统面板",closePanel:"关闭面板"},chat:{inputPlaceholder:"向 Must-b 提问任何问题…",listening:"正在聆听…",thoughtProcess:"思考过程",saveAsSkill:"保存为技能",skillSaved:"技能已保存到您的库中!",saving:"保存中…",retry:"重试",save:"保存",guidance:"指导",errorBoundary:"Chat rendering error — reloading…",disclaimer:"Must-b is a cognitive assistant; verify critical outputs for accuracy.",placeholder:"What do you want to know?",tools:"Tools",attachFile:"Attach file",startDictation:"Start voice dictation",stopDictation:"Stop dictation"},nav:{chat:"Chat",browser:"Browser",workflows:"Workflows",voice:"Voice",settings:"Settings",files:"Files",memory:"Memory",apiKeys:"API Keys",channels:"频道"},voice:{title:"Must-b Voice Command",back:"Go Back",wakeHint:'Say "Hey Must-b" to get started.',tapHint:"Tap the microphone to begin.",heard:"I hear you…",listening:"Listening…",stopHint:"Click to stop",thinking:"Processing…",cmdHint:"Go ahead, I am listening…",speakingHint:"Must-b is speaking…"},dock:{chat:"对话",files:"文件",browser:"浏览器",skills:"技能",memory:"记忆",plugins:"插件",workflows:"工作流",settings:"设置",system:"系统",close:"关闭",cat_webTools:"网络工具",cat_fileMedia:"文件与媒体",cat_aiAgents:"AI与代理",cat_systemTools:"系统工具",skill_webSearch:"网络搜索",skill_webFetch:"网络获取",skill_browserControl:"浏览器控制",skill_pdfReader:"PDF阅读器",skill_imageAnalysis:"图像分析",skill_imageGeneration:"图像生成",skill_tts:"文字转语音",skill_spawnAgent:"创建子代理",skill_agentSessions:"代理会话",skill_canvas:"画布",skill_git:"Git操作",skill_gateway:"网关",skill_fileManager:"文件管理器",skill_cron:"Cron调度器",skill_messages:"消息",desc_webSearch:"实时网络搜索(多供应商)",desc_webFetch:"将任意URL获取为纯文本",desc_browserControl:"完整的Playwright浏览器自动化",desc_pdfReader:"提取和分析PDF文档",desc_imageAnalysis:"描述和分析图像",desc_imageGeneration:"创建AI生成的图像",desc_tts:"将文本转换为自然语音",desc_spawnAgent:"启动新的自主代理会话",desc_agentSessions:"列出并管理活跃会话",desc_canvas:"可视化绘图与白板工作区",desc_git:"提交、分支、差异、推送/拉取",desc_gateway:"系统间与A2A通信",desc_fileManager:"读取、写入和管理文件",desc_cron:"调度定期任务",desc_messages:"发送和接收代理间消息",cat_knowledgeBase:"知识库",cat_personalOrg:"个人组织",mem_browse:"浏览记忆",mem_search:"搜索记忆",mem_add:"添加记忆",mem_contacts:"联系人",mem_calendar:"日历",desc_memBrowse:"查看所有存储的知识条目",desc_memSearch:"在知识库中进行语义搜索",desc_memAdd:"存储新的事实和知识",desc_contacts:"管理人员和组织",desc_calendar:"安排和管理事件",cat_pluginManager:"插件管理器",cat_developer:"开发者",plug_marketplace:"市场",plug_installed:"已安装",plug_mcp:"MCP服务器",plug_bundleMcp:"MCP捆绑包",plug_cliCmds:"CLI命令",desc_marketplace:"在ClawHub上发现插件",desc_installed:"管理和配置已安装的插件",desc_mcp:"模型上下文协议集成",desc_bundleMcp:"打包和部署MCP工具捆绑包",desc_cliCmds:"自定义斜杠命令注册",cat_automation:"自动化",cat_advanced:"高级",wf_automations:"自动化",wf_scheduled:"计划任务",wf_commands:"命令",wf_nodes:"节点工作流",wf_multiAgent:"多代理",desc_automations:"构建和运行自动化工作流",desc_scheduled:"管理所有Cron计划",desc_commands:"自定义斜杠命令",desc_nodes:"可视化节点图管道",desc_multiAgent:"协调代理间协作"},systemHealth:{lite:"LITE",safe:"SAFE",critical:"Critical",warning:"Warning",info:"Info",title:"System Health",kinds:{cpu:"CPU",ram:"RAM",memory:"Memory",storage:"Storage",network:"Network",process:"Process",battery:"Battery",thermal:"Thermal",disk:"Disk"},moreModels:"More Models / API Settings"},panels:{memory:{title:"记忆洞察",indexLabel:"索引:",clearIndex:"清除索引",searchPlaceholder:"搜索您的记忆…",searchHint:"语义相似性搜索 — 按回车键或点击",emptyTitle:"搜索您的AI记忆",emptyNoResults:"未找到记忆",emptyHint:"输入短语以查找语义相似的技能、对话和工作区文件。",emptyNoResultsHint:"尝试不同的短语,或使用上方控件索引更多内容。",refreshStats:"刷新统计",indexControls:"索引控件",vectors:"向量",skills:"技能",files:"文件",indexed:"已索引",indexCleared:"索引已清除",opFailed:"操作失败",reqError:"请求错误"},plugins:{title:"插件架构师",newPlugin:"新建插件",buildTitle:"创建新插件",namePlaceholder:"插件名称(例:weather-monitor)",goalPlaceholder:"目标(例:每5分钟轮询OpenWeather API)",contextPlaceholder:"可选上下文 / 备注",generatePlugin:"生成插件",emptyTitle:"未安装任何插件",emptyHint:"点击「新建插件」生成您的第一个插件。",installed:"已安装",running:"运行中",stop:"停止",run:"运行",opFailed:"操作失败",reqError:"请求错误",buildFailed:"构建失败",refresh:"刷新"},skills:{title:"技能库",loading:"正在加载技能…",emptyTitle:"尚未保存任何技能",emptyHint:"在对话标签中完成工作流,然后点击",saveAsSkill:"保存为技能",emptyHint2:"来构建您的技能库。",runningStatus:"正在运行技能…",completedStatus:"技能已完成",failedStatus:"技能运行失败",never:"从未",deleteConfirm:"删除?",yes:"是",no:"否",runBtn:"运行",runningBtn:"运行中…",doneBtn:"完成",lastRun:"上次运行"},settings:{title:"设置",hardwareScore:"硬件评分",searchPlaceholder:"搜索供应商…",allProviders:"全部",apiKey:"API密钥",baseUrl:"基础URL",model:"模型",testConnection:"测试连接",save:"保存",testOk:"连接成功",testFail:"连接失败",saved:"已保存",saving:"保存中…",testing:"测试中…",apiKeyWarning:"需要API密钥 — 请更新您的密钥以继续。"}}},YC={welcome:{tagline:"Seu cérebro de IA",title:"Must-b",sleeping:"Dormindo...",waking:"Acordando...",awake:"Despertando...",wakeBtn:"Acordar Must-b",wakeHint:"Toque para continuar",reconfigure:"Reconfigurar",footer:"© 2026 Must-b — Plataforma Auto Step"},sidebar:{newChat:"Nova conversa",recentChats:"Conversas recentes",platform:"Plataforma",system:"Sistema",automations:"Minhas automações",activeWorkflows:"Fluxos de trabalho ativos",products:"Skills & Plugins",clients:"Gestão de clientes",integrations:"Integrações",logs:"Registros e atividade",settings:"Configurações",logout:"Sair",poweredBy:"Desenvolvido por",deleteChat:"Excluir conversa?",deleteConfirm:"Esta ação não pode ser desfeita.",cancel:"Cancelar",delete:"Excluir"},rightPanel:{agentRole:"Função do agente",hardware:"Pontuação de hardware",model:"Modelo ativo",connected:"Gateway conectado",rank:{master:"Mestre",planner:"Planejador",worker:"Trabalhador"}},workflow:{title:"Fluxo de trabalho ativo",idle:"Ocioso — aguardando tarefa",goal:"Objetivo",steps:{browse:"Abrindo navegador",write:"Escrevendo arquivo",think:"Pensando",exec:"Executando comando"}},dashboard:{placeholder:"Envie uma mensagem para Must-b...",thinking:"Must-b está pensando..."},layout:{chats:"Conversas",system:"Sistema",openChats:"Abrir histórico de conversas",openSystem:"Abrir painel do sistema",closePanel:"Fechar painel"},chat:{inputPlaceholder:"Pergunte qualquer coisa ao Must-b…",listening:"Ouvindo…",thoughtProcess:"Processo de pensamento",saveAsSkill:"Salvar como habilidade",skillSaved:"Habilidade salva na sua biblioteca!",saving:"Salvando…",retry:"Tentar novamente",save:"Salvar",guidance:"Orientação",errorBoundary:"Chat rendering error — reloading…",disclaimer:"Must-b is a cognitive assistant; verify critical outputs for accuracy.",placeholder:"What do you want to know?",tools:"Tools",attachFile:"Attach file",startDictation:"Start voice dictation",stopDictation:"Stop dictation"},nav:{chat:"Chat",browser:"Browser",workflows:"Workflows",voice:"Voice",settings:"Settings",files:"Files",memory:"Memory",apiKeys:"API Keys",channels:"Canais"},voice:{title:"Must-b Voice Command",back:"Go Back",wakeHint:'Say "Hey Must-b" to get started.',tapHint:"Tap the microphone to begin.",heard:"I hear you…",listening:"Listening…",stopHint:"Click to stop",thinking:"Processing…",cmdHint:"Go ahead, I am listening…",speakingHint:"Must-b is speaking…"},dock:{chat:"Conversa",files:"Arquivos",browser:"Navegador",skills:"Habilidades",memory:"Memória",plugins:"Plugins",workflows:"Fluxos de trabalho",settings:"Configurações",system:"Sistema",close:"Fechar",cat_webTools:"Ferramentas web",cat_fileMedia:"Arquivos e mídia",cat_aiAgents:"IA e agentes",cat_systemTools:"Ferramentas do sistema",skill_webSearch:"Pesquisa web",skill_webFetch:"Busca web",skill_browserControl:"Controle do navegador",skill_pdfReader:"Leitor de PDF",skill_imageAnalysis:"Análise de imagem",skill_imageGeneration:"Geração de imagens",skill_tts:"Texto para fala",skill_spawnAgent:"Criar subagente",skill_agentSessions:"Sessões de agentes",skill_canvas:"Canvas",skill_git:"Operações Git",skill_gateway:"Gateway",skill_fileManager:"Gerenciador de arquivos",skill_cron:"Agendador Cron",skill_messages:"Mensagens",desc_webSearch:"Pesquisa web em tempo real (multi-provedor)",desc_webFetch:"Buscar qualquer URL como texto limpo",desc_browserControl:"Automação completa do navegador com Playwright",desc_pdfReader:"Extrair e analisar documentos PDF",desc_imageAnalysis:"Descrever e analisar imagens",desc_imageGeneration:"Criar imagens geradas por IA",desc_tts:"Converter texto em fala natural",desc_spawnAgent:"Iniciar uma nova sessão de agente autônomo",desc_agentSessions:"Listar e gerenciar sessões ativas",desc_canvas:"Espaço de desenho visual e quadro branco",desc_git:"Commit, branch, diff, push/pull",desc_gateway:"Comunicação entre sistemas e A2A",desc_fileManager:"Ler, escrever e gerenciar arquivos",desc_cron:"Agendar tarefas recorrentes",desc_messages:"Enviar e receber mensagens entre agentes",cat_knowledgeBase:"Base de conhecimento",cat_personalOrg:"Organização pessoal",mem_browse:"Explorar memórias",mem_search:"Pesquisar memória",mem_add:"Adicionar memória",mem_contacts:"Contatos",mem_calendar:"Calendário",desc_memBrowse:"Ver todas as entradas de conhecimento armazenadas",desc_memSearch:"Pesquisa semântica na sua base de conhecimento",desc_memAdd:"Armazenar novos fatos e conhecimentos",desc_contacts:"Gerenciar pessoas e organizações",desc_calendar:"Agendar e gerenciar eventos",cat_pluginManager:"Gerenciador de plugins",cat_developer:"Desenvolvedor",plug_marketplace:"Marketplace",plug_installed:"Instalados",plug_mcp:"Servidores MCP",plug_bundleMcp:"Bundle MCP",plug_cliCmds:"Comandos CLI",desc_marketplace:"Descobrir plugins no ClawHub",desc_installed:"Gerenciar e configurar plugins instalados",desc_mcp:"Integrações do Protocolo de Contexto de Modelo",desc_bundleMcp:"Empacotar e implantar bundles de ferramentas MCP",desc_cliCmds:"Registro de comandos slash personalizados",cat_automation:"Automação",cat_advanced:"Avançado",wf_automations:"Automações",wf_scheduled:"Tarefas agendadas",wf_commands:"Comandos",wf_nodes:"Fluxo de nós",wf_multiAgent:"Multi-Agente",desc_automations:"Criar e executar fluxos de trabalho automatizados",desc_scheduled:"Gerenciar todos os agendamentos cron",desc_commands:"Comandos slash personalizados",desc_nodes:"Pipelines visuais em grafo de nós",desc_multiAgent:"Orquestrar colaboração entre agentes"},systemHealth:{lite:"LITE",safe:"SAFE",critical:"Critical",warning:"Warning",info:"Info",title:"System Health",kinds:{cpu:"CPU",ram:"RAM",memory:"Memory",storage:"Storage",network:"Network",process:"Process",battery:"Battery",thermal:"Thermal",disk:"Disk"},moreModels:"More Models / API Settings"},panels:{memory:{title:"Insights de memória",indexLabel:"Índice:",clearIndex:"Limpar índice",searchPlaceholder:"Pesquisar na sua memória…",searchHint:"Pesquisa por similaridade semântica — pressione Enter ou clique",emptyTitle:"Pesquise na sua memória de IA",emptyNoResults:"Nenhuma memória encontrada",emptyHint:"Digite uma frase para encontrar habilidades, conversas e arquivos semanticamente similares.",emptyNoResultsHint:"Tente uma frase diferente ou indexe mais conteúdo usando os controles acima.",refreshStats:"Atualizar estatísticas",indexControls:"Controles de índice",vectors:"vetores",skills:"habilidades",files:"arquivos",indexed:"Indexado",indexCleared:"Índice limpo",opFailed:"Operação falhou",reqError:"Erro de requisição"},plugins:{title:"Arquiteto de plugins",newPlugin:"Novo plugin",buildTitle:"Criar novo plugin",namePlaceholder:"Nome do plugin (ex.: weather-monitor)",goalPlaceholder:"Objetivo (ex.: consultar a API OpenWeather a cada 5 min)",contextPlaceholder:"Contexto / notas opcionais",generatePlugin:"Gerar plugin",emptyTitle:"Nenhum plugin instalado",emptyHint:"Clique em «Novo plugin» para gerar seu primeiro plugin.",installed:"instalado",running:"EM EXECUÇÃO",stop:"Parar",run:"Executar",opFailed:"Operação falhou",reqError:"Erro de requisição",buildFailed:"Falha na compilação",refresh:"Atualizar"},skills:{title:"Biblioteca de habilidades",loading:"Carregando habilidades…",emptyTitle:"Nenhuma habilidade salva ainda",emptyHint:"Conclua um fluxo de trabalho na aba Conversa, depois clique em",saveAsSkill:"Salvar como habilidade",emptyHint2:"para construir sua biblioteca.",runningStatus:"Executando habilidade…",completedStatus:"Habilidade concluída",failedStatus:"Falha na execução",never:"Nunca",deleteConfirm:"Excluir?",yes:"Sim",no:"Não",runBtn:"Executar",runningBtn:"Executando…",doneBtn:"Concluído",lastRun:"última execução"},settings:{title:"Configurações",hardwareScore:"Pontuação de hardware",searchPlaceholder:"Pesquisar provedores…",allProviders:"Todos",apiKey:"Chave API",baseUrl:"URL base",model:"Modelo",testConnection:"Testar conexão",save:"Salvar",testOk:"Conexão bem-sucedida",testFail:"Falha na conexão",saved:"Salvo",saving:"Salvando…",testing:"Testando…",apiKeyWarning:"Chave API necessária — atualize sua chave para continuar."}}},Mc={en:vv,tr:UC,de:HC,fr:WC,es:KC,ja:GC,zh:qC,pt:YC},bv=h.createContext({locale:"en",t:vv,setLocale:()=>{}});function XC({children:e}){const t=typeof localStorage<"u"?localStorage.getItem("mustb-lang"):null,[n,s]=h.useState(t&&t in Mc?t:"en"),i=a=>{s(a);try{localStorage.setItem("mustb-lang",a)}catch{}fetch("/api/settings/language",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({language:a})}).catch(()=>{})};return h.useEffect(()=>{fetch("/api/setup/status").then(a=>a.ok?a.json():null).then(a=>{if(!(a!=null&&a.activeLanguage))return;const o=a.activeLanguage;if(o in Mc&&o!==n){s(o);try{localStorage.setItem("mustb-lang",o)}catch{}}}).catch(()=>{})},[]),r.jsx(bv.Provider,{value:{locale:n,t:Mc[n],setLocale:i},children:e})}const gt=()=>h.useContext(bv);function d0(){const e=mn(),{t}=gt(),[n,s]=h.useState("sleeping"),i=async()=>{if(n==="sleeping"){s("exiting");try{const a=await fetch("/api/setup/status");if(a.ok&&!(await a.json()).configured){e("/setup",{replace:!0});return}await fetch("/api/auth/local").catch(()=>{})}catch{}setTimeout(()=>e("/app/chat",{replace:!0}),450)}};return r.jsxs("div",{className:"relative min-h-screen overflow-hidden flex flex-col",children:[r.jsx(ne,{children:n==="sleeping"&&r.jsxs(H.div,{className:"fixed inset-0 z-40 flex flex-col items-center justify-center",initial:{opacity:1},exit:{opacity:0,filter:"blur(24px)"},transition:{duration:.65,ease:"easeInOut"},children:[r.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:{backgroundImage:"url(/avatar/sleep.png)"}}),r.jsx("div",{className:"absolute inset-0 bg-black/55"}),r.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-8 px-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(H.div,{animate:{opacity:[.5,1,.5]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},children:r.jsx(Rl,{size:20,className:"text-orange-400/70"})}),r.jsx("span",{className:"text-white/30 text-sm font-semibold tracking-widest uppercase select-none",children:"Must-b"})]}),r.jsxs(H.button,{onClick:i,disabled:n==="exiting",className:`group relative flex items-center gap-3 px-8 py-4 rounded-2xl
|
|
707
707
|
bg-orange-500/15 border border-orange-500/35 text-orange-300
|
|
708
708
|
backdrop-blur-md hover:bg-orange-500/25 hover:border-orange-500/60
|
|
709
|
-
transition-all duration-300 disabled:opacity-50 select-none`,animate:{y:[0,-6,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut"},whileHover:{scale:1.04},whileTap:{scale:.97},children:[r.jsx("span",{className:"text-[15px] font-bold tracking-wider",children:t.welcome.wakeBtn}),r.jsx("div",{className:"w-8 h-8 rounded-full bg-orange-500/20 border border-orange-500/40 flex items-center justify-center",children:r.jsx(sC,{size:14,className:"text-orange-400"})})]}),r.jsx("p",{className:"text-white/20 text-[11px] tracking-widest uppercase select-none",children:t.welcome.wakeHint})]})]},"sleep-screen")}),r.jsx(ne,{children:n==="exiting"&&r.jsx(H.div,{className:"fixed inset-0 z-50 pointer-events-none",style:{background:"linear-gradient(180deg, #1a0802 0%, #f97316 40%, #0d0602 100%)"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.45}})})]})}function wv(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=wv(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Ze(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=wv(e))&&(s&&(s+=" "),s+=t);return s}const QC={frontier:"⚡ Frontier",gateway:"🌐 Gateway",fast:"🚀 Fast Inference",local:"💻 Local / Offline",open:"🔓 Open Source Cloud",specialist:"🎯 Specialist",regional:"🌏 Regional",enterprise:"🏢 Enterprise",custom:"⚙️ Custom"},JC=["frontier","gateway","fast","local","open","specialist","regional","enterprise","custom"],u0=[{value:"en-US",label:"English (US)"},{value:"tr-TR",label:"Türkçe"},{value:"de-DE",label:"Deutsch"},{value:"es-ES",label:"Español"},{value:"fr-FR",label:"Français"},{value:"zh-CN",label:"中文 (简体)"},{value:"ja-JP",label:"日本語"},{value:"ar-SA",label:"العربية"}],wo=["Identity","AI Engine","Workspace","Voice","Channels","Finalize"],Rc=[{id:"meta-llama/llama-4-scout:free",label:"Llama 4 Scout (Free)",desc:"Meta's latest · 10M ctx · fast & free",free:!0},{id:"nvidia/llama-3.1-nemotron-ultra-253b:free",label:"Nemotron Ultra 253B (Free)",desc:"NVIDIA's flagship open-source model — highly capable",free:!0},{id:"meta-llama/llama-4-maverick:free",label:"Llama 4 Maverick (Free)",desc:"Meta's latest Llama 4 release — free tier",free:!0},{id:"mistralai/mistral-small-3.1-24b-instruct:free",label:"Mistral Small 3.1 (Free)",desc:"Mistral's efficient 24B instruction model",free:!0},{id:"deepseek/deepseek-r1:free",label:"DeepSeek R1 (Free)",desc:"Strong reasoning model — open weights",free:!0},{id:"openai/gpt-4o-mini",label:"GPT-4o Mini",desc:"OpenAI's fast & affordable flagship mini",free:!1},{id:"anthropic/claude-3-5-haiku",label:"Claude 3.5 Haiku",desc:"Anthropic's fastest Claude model",free:!1},{id:"google/gemini-flash-1.5",label:"Gemini Flash 1.5",desc:"Google's ultra-fast flash model",free:!1}],h0=[{id:"telegram",label:"Telegram",emoji:"✈️",hint:"Create a bot at t.me/BotFather",fields:[{key:"TELEGRAM_BOT_TOKEN",label:"Bot Token",placeholder:"123456789:AAF...",secret:!0}]},{id:"discord",label:"Discord",emoji:"🎮",hint:"discord.com/developers → Applications",fields:[{key:"DISCORD_BOT_TOKEN",label:"Bot Token",placeholder:"MT…",secret:!0},{key:"DISCORD_CLIENT_ID",label:"Client ID",placeholder:"012…",secret:!1}]},{id:"slack",label:"Slack",emoji:"💬",hint:"api.slack.com/apps → OAuth & Permissions",fields:[{key:"SLACK_BOT_TOKEN",label:"Bot Token",placeholder:"xoxb-…",secret:!0},{key:"SLACK_SIGNING_SECRET",label:"Signing Secret",placeholder:"abc123…",secret:!0}]},{id:"whatsapp",label:"WhatsApp",emoji:"📱",hint:"developers.facebook.com → WhatsApp",fields:[{key:"WHATSAPP_API_KEY",label:"API Token",placeholder:"EAA…",secret:!0},{key:"WHATSAPP_PHONE_ID",label:"Phone ID",placeholder:"1234567890",secret:!1}]}];function ZC({index:e,current:t}){const n=e<t,s=e===t;return r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:Ze("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all duration-300",n?"bg-orange-500 text-white":s?"bg-orange-500/20 border-2 border-orange-500 text-orange-400":"bg-white/5 border border-white/10 text-gray-400"),children:n?r.jsx(at,{size:13}):e+1}),e<wo.length-1&&r.jsx("div",{className:Ze("w-8 h-px transition-colors duration-300",n?"bg-orange-500/50":"bg-white/10")})]})}function e3({label:e}){return r.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-bold bg-white/5 text-gray-400 border border-white/8",children:e})}function t3({fit:e}){return e==="recommended"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-green-400 bg-green-500/10 border border-green-500/20 px-1.5 py-0.5 rounded",children:[r.jsx(at,{size:9})," Recommended"]}):e==="marginal"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-orange-400 bg-orange-500/10 border border-orange-500/20 px-1.5 py-0.5 rounded",children:[r.jsx(Oe,{size:9})," Marginal"]}):r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded",children:[r.jsx(ls,{size:9})," Heavy"]})}function f0({checked:e,onChange:t,label:n,description:s}){return r.jsxs("button",{type:"button",onClick:()=>t(!e),className:Ze("w-full flex items-center gap-4 px-4 py-4 rounded-xl border transition-all text-left",e?"bg-orange-500/10 border-orange-500/30 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("relative flex-shrink-0 w-11 h-6 rounded-full transition-colors duration-200",e?"bg-orange-500":"bg-white/15"),children:r.jsx("div",{className:Ze("absolute top-1 w-4 h-4 rounded-full bg-white shadow transition-all duration-200",e?"left-6":"left-1")})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:n}),s&&r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:s})]})]})}function n3(){var Jr,nn;mn();const[e,t]=h.useState([]),[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState(!0),[c,d]=h.useState("~/Mustb-Projects"),[u,p]=h.useState(0),[f,m]=h.useState(""),[b,v]=h.useState("en-US"),[y,g]=h.useState("openrouter"),[x,w]=h.useState(""),[j,k]=h.useState(""),[N,S]=h.useState(Rc[0].id),[_,R]=h.useState(Rc),[L,P]=h.useState(!1),[V,M]=h.useState("http://localhost:11434"),[B,A]=h.useState(""),[T,F]=h.useState(""),[C,E]=h.useState(!1),[z,W]=h.useState(!1),[K,X]=h.useState({}),[I,Q]=h.useState({}),[G,J]=h.useState({}),[he,ce]=h.useState("idle"),[Y,ee]=h.useState(!1),[Lt,Qr]=h.useState(null);h.useEffect(()=>{fetch("/api/setup/providers").then(O=>O.ok?O.json():{providers:[]}).then(O=>{var ie;(ie=O.providers)!=null&&ie.length&&t(O.providers)}).catch(()=>{}).finally(()=>l(!1)),fetch("/api/setup/workspace-default").then(O=>O.ok?O.json():null).then(O=>{O!=null&&O.suggested&&(d(O.suggested),F(O.suggested))}).catch(()=>{})},[]),h.useEffect(()=>{y==="openrouter"&&(P(!0),fetch("/api/openrouter/free-models").then(O=>O.ok?O.json():null).then(O=>{if(O!=null&&O.models&&O.models.length>0){const ie=O.models.slice(0,16).map(Ve=>({id:Ve.id,label:Ve.label??Ve.name??Ve.id,desc:Ve.desc??Ve.description??"",free:Ve.id.endsWith(":free")})),se=new Set(ie.map(Ve=>Ve.id)),Pe=Rc.filter(Ve=>!se.has(Ve.id));R([...ie,...Pe])}}).catch(()=>{}).finally(()=>P(!1)))},[y]),h.useEffect(()=>{y==="ollama"&&fetch("/api/setup/ollama-models").then(O=>O.ok?O.json():null).then(O=>{O!=null&&O.models&&s(O.models),O!=null&&O.hardware&&a(O.hardware)}).catch(()=>{})},[y]);const qs=y==="ollama",st=e.find(O=>O.id===y),Ys=h.useMemo(()=>{const O=x.toLowerCase().trim();return O?e.filter(ie=>ie.label.toLowerCase().includes(O)||ie.description.toLowerCase().includes(O)||ie.tags.some(se=>se.toLowerCase().includes(O))):e},[e,x]),Vl=h.useMemo(()=>{const O={};for(const ie of Ys)O[ie.category]||(O[ie.category]=[]),O[ie.category].push(ie);return O},[Ys]),Xs=()=>{switch(u){case 0:return f.trim().length>0;case 1:{if(qs){const O=n.length===0||B.trim().length>0;return V.trim().length>0&&O}return y==="openrouter"?j.trim().length>0&&N.trim().length>0:st!=null&&st.envKeyIsUrl?!0:j.trim().length>0}case 2:return T.trim().length>0;default:return!0}},$l=async()=>{ce("testing");try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(ie=>ie.stop()),ce("granted")}catch{ce("denied")}},ka=async O=>{J(ie=>({...ie,[O]:"testing"}));try{const se=await(await fetch(`/api/channels/${O}/status`)).json().catch(()=>({}));J(Pe=>({...Pe,[O]:se.configured?"ok":"fail"}))}catch{J(ie=>({...ie,[O]:"fail"}))}},gs=async()=>{ee(!0),Qr(null);try{const O={};for(const Pe of h0)if(K[Pe.id]){for(const Ve of Pe.fields){const ja=(I[Ve.key]??"").trim();ja&&(O[Ve.key]=ja)}O[`CHANNEL_${Pe.id.toUpperCase()}_ENABLED`]="true"}const ie={name:f.trim()||"User",language:b,provider:y,apiKey:qs?V:j,model:qs?B:y==="openrouter"?N:st==null?void 0:st.defaultModel,skills:["browser","terminal","memory","web_search","filesystem","git","vision","input","telegram","analyzer"],mode:"local",workspacePath:T.trim()||c,wakeWord:C,telemetry:z,channels:O};let se=await fetch("/api/setup/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(!se.ok&&se.status===404&&(se=await fetch("/api/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)})),!se.ok){const Pe=await se.json().catch(()=>({}));throw new Error(Pe.error??"Setup failed")}localStorage.setItem("mustb_boot_report","1"),localStorage.setItem("mustb_setup_complete","1"),window.location.href="/app"}catch(O){Qr(O instanceof Error?O.message:"Unknown error"),ee(!1)}};return r.jsxs("div",{className:"min-h-screen bg-[#02040a] flex flex-col items-center justify-center px-4 py-12 relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] bg-orange-900/12 rounded-full blur-[120px]"})}),r.jsxs("div",{className:"relative z-10 w-full max-w-xl",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"flex justify-center mb-4",children:r.jsxs("div",{className:"relative w-14 h-14",children:[r.jsx("div",{className:"absolute inset-0 bg-orange-500 rounded-full blur-lg opacity-40 animate-pulse"}),r.jsx("img",{src:"/logo.png",alt:"Must-b",className:"w-full h-full object-contain relative z-10"})]})}),r.jsx("h1",{className:"text-3xl font-extrabold text-white tracking-tight",children:"Setup Must-b"}),r.jsx("p",{className:"text-gray-400 mt-1.5 text-sm",children:"First-time configuration · 6 steps"})]}),r.jsx("div",{className:"flex justify-center items-center mb-6",children:wo.map((O,ie)=>r.jsxs("div",{className:"flex flex-col items-center gap-1",children:[r.jsx(ZC,{index:ie,current:u}),r.jsx("span",{className:Ze("text-[9px] font-bold uppercase tracking-widest transition-colors",ie===u?"text-orange-400":ie<u?"text-orange-500/50":"text-gray-700"),children:O})]},ie))}),r.jsx(ne,{mode:"wait",children:r.jsxs(H.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.18},className:"glass rounded-2xl p-6 border border-white/8",children:[r.jsxs("p",{className:"text-[10px] font-bold text-orange-500/60 uppercase tracking-widest mb-1",children:["Step ",u+1," of ",wo.length]}),r.jsx("h2",{className:"text-xl font-bold text-white mb-5",children:wo[u]}),u===0&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Your name"}),r.jsx("input",{autoFocus:!0,type:"text",value:f,onChange:O=>m(O.target.value),onKeyDown:O=>O.key==="Enter"&&Xs()&&p(1),placeholder:"e.g. Burak",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 transition-all text-base"}),r.jsx("p",{className:"text-gray-400 text-xs",children:"Used in greetings and memory. Editable anytime in Settings."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Language"}),r.jsxs("div",{className:"relative",children:[r.jsx(qe,{size:14,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),r.jsx("select",{value:b,onChange:O=>v(O.target.value),className:"w-full bg-white/5 border border-white/10 rounded-xl pl-9 pr-4 py-3 text-white focus:outline-none focus:ring-1 focus:ring-orange-500/50 transition-all text-sm appearance-none cursor-pointer",children:u0.map(O=>r.jsx("option",{value:O.value,className:"bg-[#0d1117] text-white",children:O.label},O.value))}),r.jsx(Qt,{size:13,className:"absolute right-3.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none rotate-90"})]})]})]}),u===1&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Zt,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",value:x,onChange:O=>w(O.target.value),placeholder:"Search providers…",className:"w-full bg-white/5 border border-white/10 rounded-xl pl-9 pr-4 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 text-sm"})]}),r.jsxs("div",{className:"max-h-[260px] overflow-y-auto space-y-4 pr-1 scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent",children:[o?r.jsx("p",{className:"text-center py-6 text-gray-400 text-sm",children:"Loading providers…"}):JC.map(O=>{const ie=Vl[O];return ie!=null&&ie.length?r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-1.5 px-1",children:QC[O]}),r.jsx("div",{className:"space-y-1",children:ie.map(se=>r.jsxs("button",{onClick:()=>{g(se.id),k("")},className:Ze("w-full flex items-center gap-3 px-3 py-2.5 rounded-xl border transition-all text-left",y===se.id?"bg-orange-500/10 border-orange-500/40 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("w-3 h-3 rounded-full border-2 flex-shrink-0 transition-all",y===se.id?"border-orange-500 bg-orange-500":"border-gray-600")}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-semibold text-sm leading-tight",children:se.label}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:se.description})]}),r.jsx("div",{className:"flex flex-wrap gap-1 justify-end flex-shrink-0 max-w-[120px]",children:se.tags.slice(0,2).map(Pe=>r.jsx(e3,{label:Pe},Pe))})]},se.id))})]},O):null}),!o&&Ys.length===0&&r.jsxs("p",{className:"text-center py-6 text-gray-400 text-sm",children:['No providers match "',x,'"']})]}),qs?r.jsxs("div",{className:"space-y-3 pt-1 border-t border-white/6",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Ollama Base URL"}),r.jsx("input",{type:"url",value:V,onChange:O=>M(O.target.value),placeholder:"http://localhost:11434",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 font-mono text-sm"})]}),i&&r.jsxs("div",{className:"flex items-center gap-4 rounded-xl bg-white/3 border border-white/8 px-3 py-2 text-xs text-gray-400",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(uv,{size:11,className:"text-orange-400"}),i.ramGb.toFixed(1)," GB RAM"]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(fn,{size:11,className:"text-orange-400"}),i.cpuCount," CPUs"]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Oe,{size:11,className:"text-orange-400"}),"Score ",i.score," · ",i.tier]})]}),n.length>0&&r.jsx("div",{className:"max-h-[180px] overflow-y-auto space-y-1.5 pr-1",children:n.map(O=>r.jsxs("button",{onClick:()=>A(O.modelId),className:Ze("w-full flex items-center gap-3 px-3 py-2.5 rounded-xl border transition-all text-left",B===O.modelId?"bg-orange-500/10 border-orange-500/40 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("w-3 h-3 rounded-full border-2 flex-shrink-0",B===O.modelId?"border-orange-500 bg-orange-500":"border-gray-600")}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"font-semibold text-sm",children:O.name}),r.jsx("span",{className:"text-[10px] text-gray-400 font-mono",children:O.params})]}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:O.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[r.jsx(t3,{fit:O.fit}),r.jsxs("span",{className:"text-[10px] text-gray-400",children:[O.ramGb," GB"]})]})]},O.id))})]}):st?r.jsxs("div",{className:"space-y-2 pt-1 border-t border-white/6",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:st.envKeyIsUrl?"Base URL":`${st.label} API Key`}),r.jsx("input",{type:st.envKeyIsUrl?"url":"password",value:j,onChange:O=>k(O.target.value),placeholder:st.placeholder,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 font-mono text-sm"}),y==="openrouter"&&r.jsxs("div",{className:"space-y-2 pt-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold flex-1",children:"Select Model"}),L&&r.jsx("span",{className:"text-[10px] text-orange-400/60 animate-pulse",children:"Loading live models…"}),r.jsx("span",{className:"text-[10px] text-green-500/60",children:"✓ Offline list always ready"})]}),r.jsx("div",{className:"max-h-[200px] overflow-y-auto space-y-1.5 pr-1",children:_.map(O=>r.jsxs("button",{type:"button",onClick:()=>S(O.id),className:Ze("w-full flex items-start gap-3 px-3 py-2.5 rounded-xl border transition-all text-left",N===O.id?"bg-orange-500/12 border-orange-500/40 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("w-3 h-3 rounded-full border-2 flex-shrink-0 mt-0.5",N===O.id?"border-orange-500 bg-orange-500":"border-gray-600")}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("p",{className:"font-semibold text-sm leading-tight",children:O.label}),O.free&&r.jsx("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded bg-green-500/15 text-green-400 border border-green-500/20",children:"FREE"})]}),r.jsx("p",{className:"text-[11px] text-gray-500 truncate",children:O.desc})]})]},O.id))}),!N&&r.jsxs("p",{className:"text-xs text-orange-400 flex items-center gap-1.5",children:[r.jsx(ls,{size:11})," Select a model to continue"]})]}),y!=="openrouter"&&st.latestModels.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:st.latestModels.slice(0,4).map(O=>r.jsx("span",{className:"text-[11px] font-mono text-orange-400/60 bg-orange-500/5 border border-orange-500/10 px-2 py-0.5 rounded-lg",children:O},O))}),r.jsxs("p",{className:"text-gray-400 text-xs",children:["Stored locally in ",r.jsx("code",{className:"text-orange-500/60",children:".env"})," — never sent to external servers."]})]}):null]}),u===2&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Workspace Directory"}),r.jsxs("div",{className:"relative",children:[r.jsx(hC,{size:13,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),r.jsx("input",{autoFocus:!0,type:"text",value:T,onChange:O=>F(O.target.value),placeholder:c,className:"w-full bg-white/5 border border-white/10 rounded-xl pl-9 pr-4 py-3 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 font-mono text-sm"})]}),r.jsxs("p",{className:"text-gray-400 text-xs",children:["Must-b will read and write files ",r.jsx("span",{className:"text-orange-500/70 font-medium",children:"only within this directory"}),". The folder will be created if it doesn't exist."]})]}),r.jsxs("div",{className:"flex items-start gap-3 rounded-xl bg-white/3 border border-white/8 px-4 py-3",children:[r.jsx(mv,{size:15,className:"text-green-400 flex-shrink-0 mt-0.5"}),r.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:"Must-b operates in a sandboxed workspace. It cannot access files outside this directory unless you explicitly provide a path in a prompt."})]})]}),u===3&&r.jsxs("div",{className:"space-y-4",children:[r.jsx(f0,{checked:C,onChange:E,label:'Enable "Hey Must-b" Wake Word',description:"Always-on voice activation — must-b-ui listens passively via your microphone."}),r.jsx("div",{className:"rounded-xl bg-white/3 border border-white/8 px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-white",children:"Test Microphone Permission"}),r.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[he==="idle"&&"Click to verify your browser can access the microphone.",he==="testing"&&"Requesting permission…",he==="granted"&&"Microphone access granted ✓",he==="denied"&&"Permission denied — check browser settings."]})]}),r.jsx("button",{onClick:$l,disabled:he==="testing",className:Ze("flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all shrink-0",he==="granted"?"bg-green-500/10 border border-green-500/20 text-green-400 cursor-default":he==="denied"?"bg-red-500/10 border border-red-500/20 text-red-400":"bg-white/5 border border-white/10 text-gray-300 hover:border-white/25 hover:text-white"),children:he==="granted"?r.jsxs(r.Fragment,{children:[r.jsx(at,{size:12})," Granted"]}):he==="denied"?r.jsxs(r.Fragment,{children:[r.jsx(sf,{size:12})," Denied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Bs,{size:12})," Test"]})})]})}),r.jsx("p",{className:"text-gray-700 text-xs px-1",children:"Wake word and microphone can be reconfigured at any time in Settings → Voice."})]}),u===4&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-[12px] text-gray-500",children:"Connect messaging channels so Must-b can send and receive messages on your behalf. All tokens are stored locally. You can skip and configure later in Settings."}),h0.map(O=>{const ie=!!K[O.id];return r.jsxs("div",{className:"rounded-xl border transition-all overflow-hidden",style:{borderColor:ie?"rgba(234,88,12,0.35)":"rgba(255,255,255,0.07)",background:ie?"rgba(234,88,12,0.06)":"rgba(255,255,255,0.02)"},children:[r.jsxs("div",{className:"flex items-center",children:[r.jsxs("button",{onClick:()=>X(se=>({...se,[O.id]:!ie})),className:"flex-1 flex items-center justify-between px-4 py-3",children:[r.jsxs("span",{className:"flex items-center gap-2.5 text-[13px] font-semibold text-gray-200",children:[r.jsx("span",{className:"text-base",children:O.emoji}),O.label,r.jsx("span",{className:"text-[10px] text-gray-600 font-normal",children:O.hint}),G[O.id]==="ok"&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 flex-shrink-0"}),G[O.id]==="fail"&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 flex-shrink-0"}),G[O.id]==="testing"&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-400 animate-pulse flex-shrink-0"})]}),r.jsx("span",{className:"w-8 h-4 rounded-full relative transition-all flex-shrink-0",style:{background:ie?"#ea580c":"rgba(255,255,255,0.1)"},children:r.jsx("span",{className:"absolute top-0.5 w-3 h-3 bg-white rounded-full transition-all shadow-sm",style:{left:ie?"calc(100% - 14px)":"2px"}})})]}),ie&&O.fields.some(se=>(I[se.key]??"").trim())&&r.jsx("button",{onClick:se=>{se.stopPropagation(),ka(O.id)},disabled:G[O.id]==="testing",className:"mr-3 px-2 py-1 rounded-lg text-[10px] font-semibold transition-all disabled:opacity-40",style:{background:"rgba(234,88,12,0.12)",border:"1px solid rgba(234,88,12,0.25)",color:"#fb923c"},children:G[O.id]==="testing"?"…":"Test"})]}),ie&&r.jsx("div",{className:"px-4 pb-3 space-y-2 border-t",style:{borderColor:"rgba(234,88,12,0.15)"},children:O.fields.map(se=>r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] font-semibold text-gray-500 uppercase tracking-widest mb-1 mt-2",children:se.label}),r.jsx("input",{type:se.secret?"password":"text",value:I[se.key]??"",onChange:Pe=>Q(Ve=>({...Ve,[se.key]:Pe.target.value})),placeholder:se.placeholder,className:"w-full px-3 py-2 rounded-lg text-[12px] text-gray-200 placeholder-gray-700 outline-none transition-all",style:{background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.08)"}})]},se.key))})]},O.id)})]}),u===5&&r.jsxs("div",{className:"space-y-5",children:[r.jsx(f0,{checked:z,onChange:W,label:"Send anonymous crash reports",description:"Helps improve Must-b. No personal data, no conversation content — only error traces."}),r.jsxs("div",{className:"rounded-xl bg-white/3 border border-white/6 px-4 py-4 space-y-2",children:[r.jsx("p",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-widest mb-2",children:"Configuration Summary"}),[{label:"Name",value:f||"—"},{label:"Language",value:((Jr=u0.find(O=>O.value===b))==null?void 0:Jr.label)??b},{label:"Provider",value:((nn=e.find(O=>O.id===y))==null?void 0:nn.label)??y},{label:"Workspace",value:(T||c).replace(/^.*\/([^/]+\/[^/]+)$/,"…/$1")},{label:"Wake Word",value:C?"Enabled":"Disabled"}].map(O=>r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-gray-400",children:O.label}),r.jsx("span",{className:"text-gray-300 font-mono truncate max-w-[200px]",children:O.value})]},O.label))]}),Lt&&r.jsx("div",{className:"rounded-xl bg-red-500/10 border border-red-500/20 px-4 py-3 text-red-400 text-sm",children:Lt}),r.jsx("button",{onClick:gs,disabled:Y,className:"w-full flex items-center justify-center gap-3 px-8 py-4 rounded-2xl bg-gradient-to-r from-orange-600 to-amber-600 hover:from-orange-500 hover:to-amber-500 text-white font-bold text-base transition-all shadow-lg shadow-orange-500/25 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",children:Y?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"w-5 h-5 border-2 border-white/40 border-t-white rounded-full animate-spin"})," Initializing…"]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-lg",children:"🚀"})," Initialize Must-b"]})})]})]},u)}),u<5&&r.jsxs("div",{className:"flex items-center justify-between mt-5",children:[r.jsxs("button",{onClick:()=>p(O=>O-1),disabled:u===0,className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all disabled:opacity-25 disabled:cursor-not-allowed text-sm font-medium",children:[r.jsx(a0,{size:16})," Back"]}),r.jsxs("button",{onClick:()=>p(O=>O+1),disabled:!Xs(),className:"flex items-center gap-2 px-6 py-2.5 rounded-xl bg-orange-600 hover:bg-orange-500 text-white font-semibold text-sm transition-all shadow-lg shadow-orange-500/20 active:scale-[0.97] disabled:opacity-40 disabled:cursor-not-allowed",children:["Continue ",r.jsx(Qt,{size:16})]})]}),u===5&&r.jsx("div",{className:"flex justify-start mt-5",children:r.jsxs("button",{onClick:()=>p(4),className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all text-sm font-medium",children:[r.jsx(a0,{size:16})," Back"]})}),r.jsxs("p",{className:"text-center text-xs text-gray-700 mt-5",children:["All settings saved locally · Run ",r.jsx("code",{className:"text-orange-500/60",children:"must-b doctor"})," to verify"]})]})]})}const pn=Object.create(null);pn.open="0";pn.close="1";pn.ping="2";pn.pong="3";pn.message="4";pn.upgrade="5";pn.noop="6";const ko=Object.create(null);Object.keys(pn).forEach(e=>{ko[pn[e]]=e});const hu={type:"error",data:"parser error"},kv=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",jv=typeof ArrayBuffer=="function",Nv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,uf=({type:e,data:t},n,s)=>kv&&t instanceof Blob?n?s(t):p0(t,s):jv&&(t instanceof ArrayBuffer||Nv(t))?n?s(t):p0(new Blob([t]),s):s(pn[e]+(t||"")),p0=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function m0(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let zc;function s3(e,t){if(kv&&e.data instanceof Blob)return e.data.arrayBuffer().then(m0).then(t);if(jv&&(e.data instanceof ArrayBuffer||Nv(e.data)))return t(m0(e.data));uf(e,!1,n=>{zc||(zc=new TextEncoder),t(zc.encode(n))})}const g0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<g0.length;e++)xi[g0.charCodeAt(e)]=e;const r3=e=>{let t=e.length*.75,n=e.length,s,i=0,a,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),u=new Uint8Array(d);for(s=0;s<n;s+=4)a=xi[e.charCodeAt(s)],o=xi[e.charCodeAt(s+1)],l=xi[e.charCodeAt(s+2)],c=xi[e.charCodeAt(s+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|l>>2,u[i++]=(l&3)<<6|c&63;return d},i3=typeof ArrayBuffer=="function",hf=(e,t)=>{if(typeof e!="string")return{type:"message",data:Sv(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:a3(e.substring(1),t)}:ko[n]?e.length>1?{type:ko[n],data:e.substring(1)}:{type:ko[n]}:hu},a3=(e,t)=>{if(i3){const n=r3(e);return Sv(n,t)}else return{base64:!0,data:e}},Sv=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Cv="",o3=(e,t)=>{const n=e.length,s=new Array(n);let i=0;e.forEach((a,o)=>{uf(a,!1,l=>{s[o]=l,++i===n&&t(s.join(Cv))})})},l3=(e,t)=>{const n=e.split(Cv),s=[];for(let i=0;i<n.length;i++){const a=hf(n[i],t);if(s.push(a),a.type==="error")break}return s};function c3(){return new TransformStream({transform(e,t){s3(e,n=>{const s=n.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,s)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let Lc;function qa(e){return e.reduce((t,n)=>t+n.length,0)}function Ya(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let i=0;i<t;i++)n[i]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function d3(e,t){Lc||(Lc=new TextDecoder);const n=[];let s=0,i=-1,a=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(s===0){if(qa(n)<1)break;const c=Ya(n,1);a=(c[0]&128)===128,i=c[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(qa(n)<2)break;const c=Ya(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(qa(n)<8)break;const c=Ya(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),u=d.getUint32(0);if(u>Math.pow(2,21)-1){l.enqueue(hu);break}i=u*Math.pow(2,32)+d.getUint32(4),s=3}else{if(qa(n)<i)break;const c=Ya(n,i);l.enqueue(hf(a?c:Lc.decode(c),t)),s=0}if(i===0||i>e){l.enqueue(hu);break}}}})}const Ev=4;function Le(e){if(e)return u3(e)}function u3(e){for(var t in Le.prototype)e[t]=Le.prototype[t];return e}Le.prototype.on=Le.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Le.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Le.prototype.off=Le.prototype.removeListener=Le.prototype.removeAllListeners=Le.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,i=0;i<n.length;i++)if(s=n[i],s===t||s.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Le.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,i=n.length;s<i;++s)n[s].apply(this,t)}return this};Le.prototype.emitReserved=Le.prototype.emit;Le.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Le.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Ol=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Tt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),h3="arraybuffer";function _v(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const f3=Tt.setTimeout,p3=Tt.clearTimeout;function Dl(e,t){t.useNativeTimers?(e.setTimeoutFn=f3.bind(Tt),e.clearTimeoutFn=p3.bind(Tt)):(e.setTimeoutFn=Tt.setTimeout.bind(Tt),e.clearTimeoutFn=Tt.clearTimeout.bind(Tt))}const m3=1.33;function g3(e){return typeof e=="string"?x3(e):Math.ceil((e.byteLength||e.size)*m3)}function x3(e){let t=0,n=0;for(let s=0,i=e.length;s<i;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function Tv(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function y3(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function v3(e){let t={},n=e.split("&");for(let s=0,i=n.length;s<i;s++){let a=n[s].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class b3 extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class ff extends Le{constructor(t){super(),this.writable=!1,Dl(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new b3(t,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=hf(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=y3(t);return n.length?"?"+n:""}}class w3 extends ff{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};l3(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,o3(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Tv()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Pv=!1;try{Pv=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const k3=Pv;function j3(){}class N3 extends w3{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}class hn extends Le{constructor(t,n,s){super(),this.createRequest=t,Dl(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const n=_v(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=hn.requestsCount++,hn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=j3,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete hn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}hn.requestsCount=0;hn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",x0);else if(typeof addEventListener=="function"){const e="onpagehide"in Tt?"pagehide":"unload";addEventListener(e,x0,!1)}}function x0(){for(let e in hn.requests)hn.requests.hasOwnProperty(e)&&hn.requests[e].abort()}const S3=function(){const e=Av({xdomain:!1});return e&&e.responseType!==null}();class C3 extends N3{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=S3&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new hn(Av,this.uri(),t)}}function Av(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||k3))return new XMLHttpRequest}catch{}if(!t)try{return new Tt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Mv=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class E3 extends ff{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=Mv?{}:_v(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],i=n===t.length-1;uf(s,this.supportsBinary,a=>{try{this.doWrite(s,a)}catch{}i&&Ol(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Tv()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Oc=Tt.WebSocket||Tt.MozWebSocket;class _3 extends E3{createSocket(t,n,s){return Mv?new Oc(t,n,s):n?new Oc(t,n):new Oc(t)}doWrite(t,n){this.ws.send(n)}}class T3 extends ff{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=d3(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),i=c3();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const a=()=>{s.read().then(({done:l,value:c})=>{l||(this.onPacket(c),a())}).catch(l=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],i=n===t.length-1;this._writer.write(s).then(()=>{i&&Ol(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const P3={websocket:_3,webtransport:T3,polling:C3},A3=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,M3=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fu(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let i=A3.exec(e||""),a={},o=14;for(;o--;)a[M3[o]]=i[o]||"";return n!=-1&&s!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=R3(a,a.path),a.queryKey=z3(a,a.query),a}function R3(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function z3(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,a){i&&(n[i]=a)}),n}const pu=typeof addEventListener=="function"&&typeof removeEventListener=="function",jo=[];pu&&addEventListener("offline",()=>{jo.forEach(e=>e())},!1);class ts extends Le{constructor(t,n){if(super(),this.binaryType=h3,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const s=fu(t);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=fu(n.host).host);Dl(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=v3(this.opts.query)),pu&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},jo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Ev,n.transport=t,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ts.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",ts.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(n+=g3(i)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Ol(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,i){if(typeof n=="function"&&(i=n,n=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const a={type:t,data:n,options:s};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ts.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),pu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=jo.indexOf(this._offlineEventListener);s!==-1&&jo.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}ts.protocol=Ev;class L3 extends ts{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),s=!1;ts.priorWebsocketSuccess=!1;const i=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!s)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;ts.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function a(){s||(s=!0,u(),n.close(),n=null)}const o=p=>{const f=new Error("probe error: "+p);f.transport=n.name,a(),this.emitReserved("upgradeError",f)};function l(){o("transport closed")}function c(){o("socket closed")}function d(p){n&&p.name!==n.name&&a()}const u=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let O3=class extends L3{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>P3[i]).filter(i=>!!i)),super(t,s)}};function D3(e,t="",n){let s=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),s=fu(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const a=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+a+":"+s.port+t,s.href=s.protocol+"://"+a+(n&&n.port===s.port?"":":"+s.port),s}const I3=typeof ArrayBuffer=="function",B3=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Rv=Object.prototype.toString,F3=typeof Blob=="function"||typeof Blob<"u"&&Rv.call(Blob)==="[object BlobConstructor]",V3=typeof File=="function"||typeof File<"u"&&Rv.call(File)==="[object FileConstructor]";function pf(e){return I3&&(e instanceof ArrayBuffer||B3(e))||F3&&e instanceof Blob||V3&&e instanceof File}function No(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(No(e[n]))return!0;return!1}if(pf(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return No(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&No(e[n]))return!0;return!1}function $3(e){const t=[],n=e.data,s=e;return s.data=mu(n,t),s.attachments=t.length,{packet:s,buffers:t}}function mu(e,t){if(!e)return e;if(pf(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=mu(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=mu(e[s],t));return n}return e}function U3(e,t){return e.data=gu(e.data,t),delete e.attachments,e}function gu(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=gu(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=gu(e[n],t));return e}const H3=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var le;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(le||(le={}));class W3{constructor(t){this.replacer=t}encode(t){return(t.type===le.EVENT||t.type===le.ACK)&&No(t)?this.encodeAsBinary({type:t.type===le.EVENT?le.BINARY_EVENT:le.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===le.BINARY_EVENT||t.type===le.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=$3(t),s=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(s),i}}class mf extends Le{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const s=n.type===le.BINARY_EVENT;s||n.type===le.BINARY_ACK?(n.type=s?le.EVENT:le.ACK,this.reconstructor=new K3(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(pf(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const s={type:Number(t.charAt(0))};if(le[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===le.BINARY_EVENT||s.type===le.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(a,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(a,n)}else s.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const a=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}s.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(mf.isPayloadValid(s.type,a))s.data=a;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case le.CONNECT:return y0(n);case le.DISCONNECT:return n===void 0;case le.CONNECT_ERROR:return typeof n=="string"||y0(n);case le.EVENT:case le.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&H3.indexOf(n[0])===-1);case le.ACK:case le.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class K3{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=U3(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function y0(e){return Object.prototype.toString.call(e)==="[object Object]"}const G3=Object.freeze(Object.defineProperty({__proto__:null,Decoder:mf,Encoder:W3,get PacketType(){return le}},Symbol.toStringTag,{value:"Module"}));function Ht(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const q3=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zv extends Le{constructor(t,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ht(t,"open",this.onopen.bind(this)),Ht(t,"packet",this.onpacket.bind(this)),Ht(t,"error",this.onerror.bind(this)),Ht(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var s,i,a;if(q3.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:le.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,p=n.pop();this._registerAckCallback(u,p),o.id=u}const l=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},i),o=(...l)=>{this.io.clearTimeoutFn(a),n.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((s,i)=>{const a=(o,l)=>o?i(o):s(l);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>(this._queue[0],i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:le.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case le.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case le.EVENT:case le.BINARY_EVENT:this.onevent(t);break;case le.ACK:case le.BINARY_ACK:this.onack(t);break;case le.DISCONNECT:this.ondisconnect();break;case le.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let s=!1;return function(...i){s||(s=!0,n.packet({type:le.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:le.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,t.data)}}}function Xr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Xr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Xr.prototype.reset=function(){this.attempts=0};Xr.prototype.setMin=function(e){this.ms=e};Xr.prototype.setMax=function(e){this.max=e};Xr.prototype.setJitter=function(e){this.jitter=e};class xu extends Le{constructor(t,n){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Dl(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Xr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||G3;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new O3(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=Ht(n,"open",function(){s.onopen(),t&&t()}),a=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=Ht(n,"error",a);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ht(t,"ping",this.onping.bind(this)),Ht(t,"data",this.ondata.bind(this)),Ht(t,"error",this.onerror.bind(this)),Ht(t,"close",this.onclose.bind(this)),Ht(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Ol(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new zv(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const li={};function zi(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=D3(e,t.path||"/socket.io"),s=n.source,i=n.id,a=n.path,o=li[i]&&a in li[i].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new xu(s,t):(li[i]||(li[i]=new xu(s,t)),c=li[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(zi,{Manager:xu,Socket:zv,io:zi,connect:zi});const Y3={};let vs=null;function X3(){const e=Y3;if(e!=null&&e.VITE_BACKEND_URL)return e.VITE_BACKEND_URL.replace(/\/$/,"");const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||/^\d{1,3}(\.\d{1,3}){3}$/.test(t)?window.location.origin:"http://localhost:4309"}function Be(){return vs||(vs=zi(X3(),{transports:["websocket","polling"],withCredentials:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,randomizationFactor:.3,timeout:1e4}),vs.on("agentUpdate",e=>{try{e!=null&&window.dispatchEvent(new CustomEvent("mustb:agentUpdate",{detail:e}))}catch{}}),vs.on("connect",()=>{window.dispatchEvent(new CustomEvent("mustb:connected"))}),vs.on("disconnect",e=>{window.dispatchEvent(new CustomEvent("mustb:disconnected",{detail:{reason:e}}))}),vs.io.on("reconnect",e=>{window.dispatchEvent(new CustomEvent("mustb:reconnected",{detail:{attemptNumber:e}}))})),vs}const Q3={};let yi=null;const J3=(()=>{const e=Q3,t=(e==null?void 0:e.VITE_BACKEND_URL)??"";return t&&!t.includes(window.location.hostname)?t.replace(/\/$/,""):""})();function Lv(e){return e.startsWith("http")?e:`${J3}${e}`}async function Z3(){if(yi)return yi;try{const e=await fetch(Lv("/api/auth/local"));if(e.ok)return yi=(await e.json()).token??null,yi}catch{}return null}async function $(e,t={},{retries:n=3,retryDelay:s=800}={}){const i=await Z3(),a={"Content-Type":"application/json",...t.headers};i&&(a.Authorization=`Bearer ${i}`);const o=Lv(e);let l;for(let c=1;c<=n;c++)try{const d=await fetch(o,{...t,headers:a});return d.status===401&&(yi=null,window.dispatchEvent(new CustomEvent("mustb:401",{detail:{url:o}}))),d}catch(d){l=d,c<n&&await new Promise(u=>setTimeout(u,s*c))}throw window.dispatchEvent(new CustomEvent("mustb:offline",{detail:{url:o}})),l}function v0(e){const t=e.toLowerCase();if(t.includes("gemini-2")||t.includes("gemini-flash"))return 9999;if(t.includes("llama-3")&&(t.includes("70b")||t.includes("405b")))return 9998;if(t.includes("gpt-4o"))return 8888;if(t.includes("claude-3-5")||t.includes("claude-3.5"))return 8887;if(t.includes("gemini-pro")||t.includes("gemini-1.5-pro"))return 8886;const n=t.match(/(\d+)x(\d+)b/);if(n)return parseFloat(n[1])*parseFloat(n[2]);const s=t.match(/(\d+(?:\.\d+)?)b/);return s?parseFloat(s[1]):0}function Dc(e){return[...e].sort((t,n)=>v0(n.id)-v0(t.id))}function eE(){const{t:e}=gt(),[t,n]=h.useState(!1),[s,i]=h.useState(()=>localStorage.getItem("mustb_active_model")??"Loading…"),[a,o]=h.useState([]),l=h.useRef(null);h.useEffect(()=>{const f=localStorage.getItem("mustb_active_model");f&&f!=="Loading…"&&$("/api/settings/model",{method:"POST",body:JSON.stringify({model:f})}).catch(()=>{}),$("/api/setup/status").then(m=>m.ok?m.json():null).then(m=>{if(!m)return;const b=localStorage.getItem("mustb_active_model");m.activeModel&&(!b||b==="Loading…")&&(i(m.activeModel),localStorage.setItem("mustb_active_model",m.activeModel)),(m.activeProvider??"openrouter").toLowerCase()==="ollama"?$("/api/models").then(y=>y.ok?y.json():[]).then(y=>{const x=(Array.isArray(y)?y:[]).map(w=>({id:w.id??String(w),name:w.name??w.id??String(w),free:!0}));o(Dc(x))}).catch(()=>{}):$("/api/providers/openrouter/models").then(y=>y.ok?y.json():{}).then(y=>{const g=Dc((y.free??[]).map(j=>({id:j.id,name:j.name??j.id,free:!0}))),x=Dc((y.power??[]).map(j=>({id:j.id,name:j.name??j.id,free:!1}))),w=[...g,...x];o(w),!(m!=null&&m.activeModel)&&w.length>0&&i(w[0].id)}).catch(()=>{})}).catch(()=>{})},[]),h.useEffect(()=>{if(!t)return;const f=m=>{l.current&&!l.current.contains(m.target)&&n(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[t]);const c=async f=>{i(f),localStorage.setItem("mustb_active_model",f),n(!1),await $("/api/settings/model",{method:"POST",body:JSON.stringify({model:f})}).catch(()=>{})},d=a.filter(f=>f.free),u=a.filter(f=>!f.free),p=s.length>28?s.slice(0,26)+"…":s;return r.jsxs("div",{ref:l,className:"relative",children:[r.jsxs("button",{onClick:()=>n(f=>!f),className:"flex items-center gap-1 px-2 py-1 rounded-lg border border-white/10 bg-white/5 hover:bg-white/10 text-white/50 hover:text-white/80 text-[11px] font-medium transition-all",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-500 shrink-0"}),r.jsx("span",{className:"truncate max-w-[110px]",children:p}),r.jsx(qr,{size:10,className:`transition-transform duration-200 shrink-0 text-white/30 ${t?"rotate-180":""}`})]}),r.jsx(ne,{children:t&&r.jsxs(H.div,{initial:{opacity:0,y:6,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,scale:.97},transition:{duration:.14,ease:[.22,1,.36,1]},className:"absolute bottom-full mb-2 left-0 z-50 w-72 rounded-xl shadow-xl border border-white/10 flex flex-col",style:{background:"rgba(18,8,2,0.97)",backdropFilter:"blur(24px)",maxHeight:"400px"},children:[r.jsxs("div",{className:"overflow-y-auto flex-1 p-1.5",children:[d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2.5 pt-2 pb-1 text-[9.5px] font-black uppercase tracking-[0.12em] text-emerald-500/80",children:"Free"}),d.slice(0,5).map(f=>r.jsxs("button",{onClick:()=>c(f.id),className:`w-full flex items-center gap-2 px-2.5 py-2 rounded-lg text-left transition-colors ${s===f.id?"bg-orange-500/15 text-orange-300":"text-white/60 hover:bg-white/5 hover:text-white/90"}`,children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${s===f.id?"bg-orange-500":"bg-emerald-400"}`}),r.jsx("span",{className:"text-[12px] font-medium truncate",children:f.name}),s===f.id&&r.jsx("span",{className:"ml-auto text-[9px] font-semibold text-orange-400 shrink-0",children:"active"})]},f.id))]}),u.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2.5 pt-2 pb-1 text-[9.5px] font-black uppercase tracking-[0.12em] text-orange-400/80",children:"Pro"}),u.map(f=>r.jsxs("button",{onClick:()=>c(f.id),className:`w-full flex items-center gap-2 px-2.5 py-2 rounded-lg text-left transition-colors ${s===f.id?"bg-orange-500/15 text-orange-300":"text-white/60 hover:bg-white/5 hover:text-white/90"}`,children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${s===f.id?"bg-orange-500":"bg-orange-300"}`}),r.jsx("span",{className:"text-[12px] font-medium truncate",children:f.name}),s===f.id&&r.jsx("span",{className:"ml-auto text-[9px] font-semibold text-orange-400 shrink-0",children:"active"})]},f.id))]}),a.length===0&&r.jsx("div",{className:"px-3 py-4 text-[12px] text-white/30 text-center",children:"No models available"})]}),r.jsx("div",{className:"shrink-0 border-t border-white/8 p-1.5",children:r.jsxs(_i,{to:"/app/settings",onClick:()=>n(!1),className:"flex items-center justify-center gap-1.5 w-full px-2.5 py-2 rounded-lg text-[11px] font-medium text-white/35 hover:text-orange-400 hover:bg-orange-500/8 transition-colors",children:[r.jsx(lf,{size:11}),e.systemHealth.moreModels]})})]})})]})}function Kt(e){if(typeof e=="string")return e;if(e==null)return"";if(typeof e=="object"){const t=e,n=t.message??t.error??t.text??t.content??t.result;return n!==void 0?Kt(n):JSON.stringify(e)}return String(e)}function tE(e,t){switch(e){case"planGenerated":{const n=t.steps;return`Plan ready — ${(n==null?void 0:n.length)??0} step(s)`}case"stepStart":{const n=t.step;return`▶ ${(n==null?void 0:n.description)??Kt(t.step)}`}case"stepFinish":{if(t.status==="error")return`✗ ${Kt(t.error)}`;const n=t.step,s=t.result!==void 0?Kt(t.result):void 0,i=(n==null?void 0:n.description)??"Step complete";return s&&s.length<180?`✓ ${i} → ${s}`:`✓ ${i}`}case"agentRepair":{const n=Kt(t.action),s=t.reason?` — ${Kt(t.reason).slice(0,120)}`:"";return`⟳ Repair: ${n}${s}`}default:return null}}function nE(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>t(s.result),s.onerror=n,s.readAsDataURL(e)})}function sE({lang:e,code:t}){const[n,s]=h.useState(!1);return r.jsxs("div",{className:"my-3 rounded-xl overflow-hidden border border-white/8 bg-[#1a0800]/90",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 border-b border-white/6 select-none",children:[r.jsx("span",{className:"text-[11px] font-mono text-orange-300/50",children:e||"code"}),r.jsx("button",{onClick:()=>{navigator.clipboard.writeText(t).catch(()=>{}),s(!0),setTimeout(()=>s(!1),2e3)},className:"flex items-center gap-1.5 text-[11px] text-orange-300/50 hover:text-orange-200 transition-colors",children:n?r.jsxs(r.Fragment,{children:[r.jsx(at,{size:10,className:"text-orange-400"}),r.jsx("span",{className:"text-orange-400",children:"Copied"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{size:10}),"Copy"]})})]}),r.jsx("pre",{className:"overflow-x-auto px-4 py-3 text-[13px] text-orange-50 font-mono leading-relaxed whitespace-pre",children:r.jsx("code",{children:t})})]})}function er(e,t){return e.split(/(`[^`\n]+`)/).map((s,i)=>{if(s.startsWith("`")&&s.endsWith("`")&&s.length>2)return r.jsx("code",{className:"px-1.5 py-0.5 rounded bg-black/15 text-orange-700 font-mono text-[12px]",children:s.slice(1,-1)},`${t}-ic${i}`);const a=s.split(/(\*\*[^*\n]+\*\*|\*[^*\n]+\*)/);return r.jsx(h.Fragment,{children:a.map((o,l)=>o.startsWith("**")&&o.endsWith("**")&&o.length>4?r.jsx("strong",{className:"font-bold text-inherit dark:text-gray-100",children:o.slice(2,-2)},`${t}-b${i}-${l}`):o.startsWith("*")&&o.endsWith("*")&&o.length>2?r.jsx("em",{className:"italic",children:o.slice(1,-1)},`${t}-em${i}-${l}`):r.jsx("span",{children:o},`${t}-s${i}-${l}`))},`${t}-bi${i}`)})}function rE({text:e,dark:t=!1}){const n=t?"text-orange-50":"text-[#3d1a06]",s=[],i=e.split(`
|
|
710
|
-
`);let a=0,o=0;const l=()=>`md-${o++}`;for(;a<i.length;){const c=i[a],d=c.match(/^```(\w*)/);if(d){const b=d[1]??"",
|
|
711
|
-
`)},l()));continue}const u=c.match(/^### (.+)/);if(u){s.push(r.jsx("h3",{className:`text-sm font-bold mt-4 mb-1 ${n}`,children:er(u[1],l())},l())),a++;continue}const p=c.match(/^## (.+)/);if(p){s.push(r.jsx("h2",{className:`text-base font-bold mt-5 mb-1.5 ${n}`,children:er(p[1],l())},l())),a++;continue}const f=c.match(/^# (.+)/);if(f){s.push(r.jsx("h1",{className:`text-lg font-bold mt-6 mb-2 ${n}`,children:er(f[1],l())},l())),a++;continue}if(c.match(/^[-*]{3,}$/)){s.push(r.jsx("hr",{className:"border-black/10 my-4"},l())),a++;continue}if(c.match(/^[-*•] /)){const b=[];for(;a<i.length&&i[a].match(/^[-*•] /);)b.push(i[a].replace(/^[-*•] /,"")),a++;s.push(r.jsx("ul",{className:"my-2 space-y-1.5 pl-1",children:b.map((v
|
|
712
|
-
…`:e.content;return r.jsxs("div",{className:"mb-3 rounded-xl overflow-hidden font-mono text-[10px]",style:{background:"#060d1a",border:`1px solid ${s?"rgba(52,211,153,0.18)":"rgba(99,179,237,0.15)"}`},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/6",style:{background:"#0c1528"},children:[r.jsx(Jt,{size:9,className:s?"text-emerald-400/70 shrink-0":"text-sky-400/60 shrink-0"}),r.jsx("span",{className:"text-white/50 truncate flex-1",children:e.filename}),r.jsx("span",{className:`text-[9px] font-bold tracking-widest uppercase shrink-0 ${s?"text-emerald-400/60":"text-sky-400/50"}`,children:s?"SAVED":"READ"}),r.jsx("button",{onClick:()=>{navigator.clipboard.writeText(e.content).catch(()=>{}),n(!0),setTimeout(()=>n(!1),2e3)},className:"ml-2 text-white/25 hover:text-white/60 transition-colors shrink-0",title:"Copy content",children:t?r.jsx(at,{size:9,className:"text-green-400"}):r.jsx(Os,{size:9})})]}),r.jsx("div",{className:"px-3 py-2 max-h-52 overflow-y-auto scrollbar-hide",children:r.jsx("pre",{className:"text-[10px] leading-relaxed whitespace-pre-wrap break-all",style:{color:s?"rgba(52,211,153,0.7)":"rgba(147,197,253,0.65)"},children:i})})]})}function cE({workflow:e,onDismiss:t}){const[n,s]=h.useState("idle"),[i,a]=h.useState(e.goal.slice(0,52)+(e.goal.length>52?"…":"")),o=async()=>{s("saving");try{const l=await $("/api/skills/save",{method:"POST",body:JSON.stringify({goal:e.goal,answer:e.answer,steps:e.steps,name:i.trim()||void 0})});if(!l.ok)throw new Error(`HTTP ${l.status}`);s("saved"),setTimeout(t,1800)}catch{s("error"),setTimeout(()=>s("idle"),3e3)}};return r.jsx(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.2},className:"mt-3",children:r.jsx("div",{className:"flex items-center gap-3 px-4 py-2.5 rounded-xl bg-orange-900/20 border border-orange-600/30",children:n==="saved"?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:13,className:"text-orange-400 shrink-0"}),r.jsx("span",{className:"text-xs font-medium text-orange-400",children:"Skill saved!"})]}):r.jsxs(r.Fragment,{children:[r.jsx(sv,{size:13,className:"text-orange-600 shrink-0"}),r.jsx("span",{className:"text-[11px] text-orange-200 shrink-0 font-medium",children:"Save as Skill:"}),r.jsx("input",{value:i,onChange:l=>a(l.target.value),onKeyDown:l=>l.key==="Enter"&&n==="idle"&&o(),placeholder:"Skill name…",className:"flex-1 bg-transparent text-[12px] text-orange-100 outline-none placeholder-orange-600/50 min-w-0"}),r.jsx("button",{onClick:o,disabled:n!=="idle",className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-orange-900/30 hover:bg-orange-900/50 border border-orange-800/40 text-orange-200 text-[11px] font-semibold transition-all shrink-0 disabled:opacity-50",children:n==="saving"?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:10,className:"animate-spin"})," Saving…"]}):n==="error"?"Retry":"Save"}),r.jsx("button",{onClick:t,className:"text-orange-700 hover:text-orange-500 transition-colors text-[11px] shrink-0",children:"✕"})]})})})}function dE({src:e,onClose:t}){const[n,s]=h.useState(!1);h.useEffect(()=>{const o=l=>{l.key==="Escape"&&t()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t]);const i=()=>{const o=document.createElement("a");o.href=e,o.download=`mustb-image-${Date.now()}.jpg`,o.click()},a=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}catch{}};return r.jsxs("div",{className:"fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-black/90 backdrop-blur-sm",onClick:t,children:[r.jsxs("div",{className:"absolute top-5 right-5 flex items-center gap-2",onClick:o=>o.stopPropagation(),children:[r.jsxs("button",{onClick:a,title:"Copy link",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/10 hover:bg-white/20 text-white/80 hover:text-white text-[12px] font-medium transition-all",children:[n?r.jsx(at,{size:14,className:"text-green-400"}):r.jsx(Os,{size:14}),n?"Copied!":"Copy"]}),r.jsxs("button",{onClick:i,title:"Download image",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/10 hover:bg-white/20 text-white/80 hover:text-white text-[12px] font-medium transition-all",children:[r.jsx(Ri,{size:14}),"Download"]}),r.jsx("button",{onClick:t,className:"w-9 h-9 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 text-white/80 hover:text-white transition-all",children:r.jsx(He,{size:18})})]}),r.jsx("img",{src:e,alt:"Preview",className:"max-w-[90vw] max-h-[85vh] object-contain rounded-2xl shadow-2xl",onClick:o=>o.stopPropagation()})]})}class uE extends h.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t.message??"Unknown error"}}componentDidCatch(t,n){console.error("[ChatErrorBoundary]",t,n.componentStack)}render(){return this.state.error?r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-8 text-center",children:[r.jsx("span",{className:"text-2xl",children:"⚠️"}),r.jsx("p",{className:"text-red-400 font-bold text-sm",children:"Chat render error"}),r.jsx("p",{className:"text-orange-200/70 text-xs font-mono max-w-sm break-all",children:this.state.error}),r.jsx("button",{onClick:()=>this.setState({error:null}),className:"mt-1 px-4 py-2 rounded-xl bg-orange-900/20 border border-orange-800/30 text-orange-200 text-xs font-bold hover:bg-orange-900/40 transition-all",children:"Retry"})]}):this.props.children}}const b0=[{id:"terminal",label:"Terminal",Icon:os},{id:"browser",label:"Browser",Icon:qe},{id:"image-gen",label:"Görsel Üret",Icon:fv},{id:"web-search",label:"Web Search",Icon:Zt},{id:"file-manager",label:"Files",Icon:An},{id:"code",label:"Code",Icon:Jt},{id:"screen-sense",label:"Ekranı Gör",Icon:rf}];function hE({onSend:e,onStop:t,disabled:n}){const{t:s}=gt(),[i,a]=h.useState(""),[o,l]=h.useState(!1),[c,d]=h.useState(""),[u,p]=h.useState([]),[f,m]=h.useState([]),[b,v]=h.useState(!1),y=h.useRef(null),g=h.useRef(!1),x=h.useRef(null),w=h.useRef(null),j=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition),k=()=>{const A=window.SpeechRecognition||window.webkitSpeechRecognition;if(!A)return;const T=new A;T.continuous=!0,T.interimResults=!0,T.lang="tr-TR",T.onresult=F=>{let C="",E="";for(let z=F.resultIndex;z<F.results.length;z++)F.results[z].isFinal?C+=F.results[z][0].transcript:E+=F.results[z][0].transcript;C?(a(z=>(z.trim()?z.trimEnd()+" ":"")+C.trim()),d("")):d(E)},T.onend=()=>{d(""),g.current?setTimeout(k,150):(l(!1),y.current=null)},T.onerror=F=>{F.error!=="no-speech"&&l(!1),d(""),g.current&&F.error!=="not-allowed"&&setTimeout(k,500)},y.current=T;try{T.start()}catch{}},N=()=>{var A;o?(g.current=!1,(A=y.current)==null||A.stop(),d("")):(g.current=!0,l(!0),k())},S=A=>{p(T=>[...T,...Array.from(A)])},_=A=>{const T=Array.from(A.clipboardData.files);T.length&&(A.preventDefault(),S(T))},R=A=>{A.preventDefault(),S(A.dataTransfer.files)},L=A=>p(T=>T.filter((F,C)=>C!==A));h.useEffect(()=>{if(!b)return;const A=T=>{w.current&&!w.current.contains(T.target)&&v(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[b]);const P=async()=>{try{const A=await navigator.mediaDevices.getDisplayMedia({video:!0}),T=document.createElement("video");T.srcObject=A,T.muted=!0,await new Promise(C=>{T.onloadedmetadata=()=>{T.play(),C()}}),await new Promise(C=>setTimeout(C,120));const F=document.createElement("canvas");F.width=T.videoWidth,F.height=T.videoHeight,F.getContext("2d").drawImage(T,0,0),A.getTracks().forEach(C=>C.stop()),F.toBlob(C=>{if(!C)return;const E=new File([C],`ekran-${Date.now()}.png`,{type:"image/png"});S([E]),a(z=>z.trim()?z:"Bu ekranı analiz et ve ne gördüğünü açıkla."),de.success("Ekran yakalandı — göndermek için ▶ basın.")},"image/png",.9)}catch(A){(A==null?void 0:A.name)!=="NotAllowedError"&&de.error("Ekran yakalanamadı.")}},V=A=>{if(A==="screen-sense"){P(),v(!1);return}m(T=>T.includes(A)?T.filter(F=>F!==A):[...T,A])},M=()=>{var F;const A=i.trim();if(!A||n)return;o&&(g.current=!1,(F=y.current)==null||F.stop(),d(""));const T=[...u];a(""),p([]),e(A,f.length>0?f:void 0,T.length>0?T:void 0)};h.useEffect(()=>{x.current&&(x.current.style.height="auto",x.current.style.height=`${Math.min(x.current.scrollHeight,160)}px`)},[i]),h.useEffect(()=>{const A=T=>{var C;const F=((C=T.detail)==null?void 0:C.text)??"";a(F),setTimeout(()=>{var E;return(E=x.current)==null?void 0:E.focus()},60)};return window.addEventListener("mustb:prefill",A),()=>window.removeEventListener("mustb:prefill",A)},[]);const B=o?c||s.chat.listening:"What do you want to know?";return r.jsx("div",{className:"max-w-3xl mx-auto w-full",children:r.jsxs("div",{className:"glass-input rounded-2xl flex flex-col px-4 pt-3 pb-3 gap-2.5",onPaste:_,onDrop:R,onDragOver:A=>A.preventDefault(),children:[u.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 px-1",children:u.map((A,T)=>r.jsxs("div",{className:"relative group w-12 h-12",children:[A.type.startsWith("image/")?r.jsx("img",{src:URL.createObjectURL(A),alt:A.name,className:"w-12 h-12 object-cover rounded-lg border border-orange-500/20"}):r.jsx("div",{className:"w-12 h-12 rounded-lg border border-orange-500/20 bg-orange-500/10 flex items-center justify-center",children:r.jsx(en,{size:16,className:"text-orange-400"})}),r.jsx("button",{onClick:()=>L(T),className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(He,{size:9})})]},T))}),r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsxs("div",{ref:w,className:"flex items-center gap-0.5 mb-0.5 shrink-0 relative",children:[r.jsx("button",{type:"button",onClick:()=>v(A=>!A),title:"Araçlar",className:`p-2 rounded-full transition-all ${b||f.length>0?"text-orange-400 bg-orange-500/15 border border-orange-500/25":"text-white/30 hover:text-white/70 hover:bg-white/8"}`,children:r.jsx(df,{size:16})}),r.jsx(ne,{children:b&&r.jsxs(H.div,{initial:{opacity:0,y:8,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.97},transition:{duration:.14,ease:[.22,1,.36,1]},className:"absolute bottom-full mb-2 left-0 z-50 w-52 rounded-2xl p-2 shadow-2xl",style:{background:"rgba(16,7,2,0.97)",border:"1px solid rgba(249,115,22,0.18)",backdropFilter:"blur(24px)"},children:[r.jsx("p",{className:"px-2.5 pt-1.5 pb-1 text-[9.5px] font-black uppercase tracking-[0.14em] text-orange-400/60",children:"Araçlar"}),b0.map(({id:A,label:T,Icon:F})=>{const C=f.includes(A);return r.jsxs("button",{onClick:()=>V(A),className:`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-xl transition-all text-left ${C?"bg-orange-500/15 text-orange-300":"text-white/55 hover:bg-white/6 hover:text-white/90"}`,children:[r.jsx(F,{size:13,className:C?"text-orange-400":"text-white/30"}),r.jsx("span",{className:"text-[12px] font-medium",children:T}),C&&r.jsx("span",{className:"ml-auto w-3.5 h-3.5 rounded-full bg-orange-500/30 border border-orange-500/60 flex items-center justify-center text-[8px] text-orange-300",children:"✓"})]},A)})]})}),r.jsxs("label",{className:"p-2 rounded-full cursor-pointer text-white/30 hover:text-white/70 hover:bg-white/8 transition-all",title:s.chat.attachFile,children:[r.jsx(_C,{size:16}),r.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:A=>A.target.files&&S(A.target.files)})]})]}),r.jsx("textarea",{ref:x,value:i,onChange:A=>a(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),M())},placeholder:B,disabled:n,rows:1,className:"flex-1 bg-transparent text-white/90 placeholder-white/35 text-[15px] outline-none resize-none min-h-[28px] max-h-[160px] scrollbar-hide leading-relaxed"}),r.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5 shrink-0",children:[j&&r.jsx("button",{onClick:N,title:o?"Stop dictation":"Start voice dictation (append mode)",className:`p-2 rounded-full transition-all ${o?"text-red-400 bg-red-500/15 border border-red-500/30 shadow-[0_0_10px_rgba(239,68,68,0.3)]":"text-white/40 hover:text-white/70 hover:bg-white/8"}`,children:o?r.jsx(rC,{size:17,className:"animate-pulse"}):r.jsx(Bs,{size:17})}),n?r.jsx("button",{onClick:t,title:"Durdur",className:"w-9 h-9 rounded-full flex items-center justify-center transition-all bg-red-600/80 hover:bg-red-500 text-white shadow-[0_0_12px_rgba(239,68,68,0.5)] active:scale-95",children:r.jsx(cf,{size:14})}):r.jsx("button",{onClick:M,disabled:!i.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center transition-all ${i.trim()?"bg-orange-600 hover:bg-orange-500 text-white shadow-[0_0_15px_rgba(249,115,22,0.4)] active:scale-95":"bg-white/10 text-white/25 cursor-not-allowed"}`,children:r.jsx(of,{size:16})})]})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.length>0?r.jsx("div",{className:"flex flex-wrap gap-1.5 flex-1",children:f.map(A=>{const T=b0.find(E=>E.id===A);if(!T)return null;const{Icon:F,label:C}=T;return r.jsxs("span",{className:"flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-orange-500/15 border border-orange-500/25 text-orange-300 text-[11px] font-medium",children:[r.jsx(F,{size:10}),r.jsx("span",{children:C}),r.jsx("button",{type:"button",onClick:()=>V(A),className:"ml-0.5 p-0.5 rounded-full hover:bg-orange-500/20 text-orange-400/60 hover:text-orange-300 transition-colors",children:r.jsx(He,{size:9})})]},A)})}):r.jsx("div",{className:"flex-1"}),r.jsx(eE,{})]})]})})}function Ic(e){return`mustb_chat_turns_${e}`}function fE(){const{t:e,setLocale:t}=gt(),n=h.useRef(e);h.useEffect(()=>{n.current=e},[e]);const[s]=Qk(),i=mn(),a=s.get("chat")??"default",o=h.useRef(null),[l,c]=h.useState(null),[d,u]=h.useState(null),[p,f]=h.useState(""),[m,b]=h.useState(null),[v,y]=h.useState(()=>{try{const M=localStorage.getItem(Ic(a));if(M)return JSON.parse(M)}catch{}return[]}),g=h.useRef(null),x=h.useRef(null),w=h.useRef(a),[j,k]=h.useState(!1),[N,S]=h.useState(null),_=v.some(M=>M.kind==="assistant"&&M.status==="pending");h.useEffect(()=>{w.current=a;try{const M=localStorage.getItem(Ic(a));y(M?JSON.parse(M):[])}catch{y([])}g.current=null},[a]),h.useEffect(()=>{if(a==="default"||!o.current)return;const M=o.current;o.current=null,setTimeout(()=>P(M.text,M.tools,M.files),0)},[a]),h.useEffect(()=>{const M=Be();return M.on("thought_stream",B=>{const A=g.current;if(!A)return;const T=(B.message??"").trim();T&&(T.length>200||T.includes("|")||T.includes(`
|
|
713
|
-
`)||
|
|
714
|
-
A: ${M.content.slice(0,400)}`;fetch("/api/memory/ltm/semantic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:A,tags:["chat","autosave"]})}).catch(()=>{})},[
|
|
715
|
-
`).length+1),className:"w-full rounded-2xl px-5 py-3 text-white text-[14px] leading-relaxed resize-none outline-none",style:{background:"rgba(25,10,2,0.85)",border:"1px solid rgba(249,115,22,0.5)",backdropFilter:"blur(12px)"}}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>u(null),className:"px-3 py-1.5 rounded-xl text-[12px] text-white/40 hover:text-white/70 border border-white/10 hover:bg-white/5 transition-all",children:"Cancel"}),r.jsx("button",{onClick:()=>{const J=p.trim();if(!J)return;const he=
|
|
709
|
+
transition-all duration-300 disabled:opacity-50 select-none`,animate:{y:[0,-6,0]},transition:{duration:4,repeat:1/0,ease:"easeInOut"},whileHover:{scale:1.04},whileTap:{scale:.97},children:[r.jsx("span",{className:"text-[15px] font-bold tracking-wider",children:t.welcome.wakeBtn}),r.jsx("div",{className:"w-8 h-8 rounded-full bg-orange-500/20 border border-orange-500/40 flex items-center justify-center",children:r.jsx(sC,{size:14,className:"text-orange-400"})})]}),r.jsx("p",{className:"text-white/20 text-[11px] tracking-widest uppercase select-none",children:t.welcome.wakeHint})]})]},"sleep-screen")}),r.jsx(ne,{children:n==="exiting"&&r.jsx(H.div,{className:"fixed inset-0 z-50 pointer-events-none",style:{background:"linear-gradient(180deg, #1a0802 0%, #f97316 40%, #0d0602 100%)"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.45}})})]})}function wv(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=wv(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Ze(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=wv(e))&&(s&&(s+=" "),s+=t);return s}const QC={frontier:"⚡ Frontier",gateway:"🌐 Gateway",fast:"🚀 Fast Inference",local:"💻 Local / Offline",open:"🔓 Open Source Cloud",specialist:"🎯 Specialist",regional:"🌏 Regional",enterprise:"🏢 Enterprise",custom:"⚙️ Custom"},JC=["frontier","gateway","fast","local","open","specialist","regional","enterprise","custom"],u0=[{value:"en-US",label:"English (US)"},{value:"tr-TR",label:"Türkçe"},{value:"de-DE",label:"Deutsch"},{value:"es-ES",label:"Español"},{value:"fr-FR",label:"Français"},{value:"zh-CN",label:"中文 (简体)"},{value:"ja-JP",label:"日本語"},{value:"ar-SA",label:"العربية"}],wo=["Identity","AI Engine","Workspace","Voice","Channels","Finalize"],Rc=[{id:"meta-llama/llama-4-scout:free",label:"Llama 4 Scout (Free)",desc:"Meta's latest · 10M ctx · fast & free",free:!0},{id:"nvidia/llama-3.1-nemotron-ultra-253b:free",label:"Nemotron Ultra 253B (Free)",desc:"NVIDIA's flagship open-source model — highly capable",free:!0},{id:"meta-llama/llama-4-maverick:free",label:"Llama 4 Maverick (Free)",desc:"Meta's latest Llama 4 release — free tier",free:!0},{id:"mistralai/mistral-small-3.1-24b-instruct:free",label:"Mistral Small 3.1 (Free)",desc:"Mistral's efficient 24B instruction model",free:!0},{id:"deepseek/deepseek-r1:free",label:"DeepSeek R1 (Free)",desc:"Strong reasoning model — open weights",free:!0},{id:"openai/gpt-4o-mini",label:"GPT-4o Mini",desc:"OpenAI's fast & affordable flagship mini",free:!1},{id:"anthropic/claude-3-5-haiku",label:"Claude 3.5 Haiku",desc:"Anthropic's fastest Claude model",free:!1},{id:"google/gemini-flash-1.5",label:"Gemini Flash 1.5",desc:"Google's ultra-fast flash model",free:!1}],h0=[{id:"telegram",label:"Telegram",emoji:"✈️",hint:"Create a bot at t.me/BotFather",fields:[{key:"TELEGRAM_BOT_TOKEN",label:"Bot Token",placeholder:"123456789:AAF...",secret:!0}]},{id:"discord",label:"Discord",emoji:"🎮",hint:"discord.com/developers → Applications",fields:[{key:"DISCORD_BOT_TOKEN",label:"Bot Token",placeholder:"MT…",secret:!0},{key:"DISCORD_CLIENT_ID",label:"Client ID",placeholder:"012…",secret:!1}]},{id:"slack",label:"Slack",emoji:"💬",hint:"api.slack.com/apps → OAuth & Permissions",fields:[{key:"SLACK_BOT_TOKEN",label:"Bot Token",placeholder:"xoxb-…",secret:!0},{key:"SLACK_SIGNING_SECRET",label:"Signing Secret",placeholder:"abc123…",secret:!0}]},{id:"whatsapp",label:"WhatsApp",emoji:"📱",hint:"developers.facebook.com → WhatsApp",fields:[{key:"WHATSAPP_API_KEY",label:"API Token",placeholder:"EAA…",secret:!0},{key:"WHATSAPP_PHONE_ID",label:"Phone ID",placeholder:"1234567890",secret:!1}]}];function ZC({index:e,current:t}){const n=e<t,s=e===t;return r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:Ze("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all duration-300",n?"bg-orange-500 text-white":s?"bg-orange-500/20 border-2 border-orange-500 text-orange-400":"bg-white/5 border border-white/10 text-gray-400"),children:n?r.jsx(at,{size:13}):e+1}),e<wo.length-1&&r.jsx("div",{className:Ze("w-8 h-px transition-colors duration-300",n?"bg-orange-500/50":"bg-white/10")})]})}function e3({label:e}){return r.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-bold bg-white/5 text-gray-400 border border-white/8",children:e})}function t3({fit:e}){return e==="recommended"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-green-400 bg-green-500/10 border border-green-500/20 px-1.5 py-0.5 rounded",children:[r.jsx(at,{size:9})," Recommended"]}):e==="marginal"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-orange-400 bg-orange-500/10 border border-orange-500/20 px-1.5 py-0.5 rounded",children:[r.jsx(Oe,{size:9})," Marginal"]}):r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded",children:[r.jsx(ls,{size:9})," Heavy"]})}function f0({checked:e,onChange:t,label:n,description:s}){return r.jsxs("button",{type:"button",onClick:()=>t(!e),className:Ze("w-full flex items-center gap-4 px-4 py-4 rounded-xl border transition-all text-left",e?"bg-orange-500/10 border-orange-500/30 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("relative flex-shrink-0 w-11 h-6 rounded-full transition-colors duration-200",e?"bg-orange-500":"bg-white/15"),children:r.jsx("div",{className:Ze("absolute top-1 w-4 h-4 rounded-full bg-white shadow transition-all duration-200",e?"left-6":"left-1")})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:n}),s&&r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:s})]})]})}function n3(){var Jr,nn;mn();const[e,t]=h.useState([]),[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState(!0),[c,d]=h.useState("~/Mustb-Projects"),[u,p]=h.useState(0),[f,m]=h.useState(""),[b,y]=h.useState("en-US"),[v,g]=h.useState("openrouter"),[x,w]=h.useState(""),[j,k]=h.useState(""),[N,S]=h.useState(Rc[0].id),[_,R]=h.useState(Rc),[L,P]=h.useState(!1),[V,M]=h.useState("http://localhost:11434"),[B,A]=h.useState(""),[T,F]=h.useState(""),[C,E]=h.useState(!1),[z,W]=h.useState(!1),[K,X]=h.useState({}),[I,Q]=h.useState({}),[G,J]=h.useState({}),[he,ce]=h.useState("idle"),[Y,ee]=h.useState(!1),[Lt,Qr]=h.useState(null);h.useEffect(()=>{fetch("/api/setup/providers").then(O=>O.ok?O.json():{providers:[]}).then(O=>{var ie;(ie=O.providers)!=null&&ie.length&&t(O.providers)}).catch(()=>{}).finally(()=>l(!1)),fetch("/api/setup/workspace-default").then(O=>O.ok?O.json():null).then(O=>{O!=null&&O.suggested&&(d(O.suggested),F(O.suggested))}).catch(()=>{})},[]),h.useEffect(()=>{v==="openrouter"&&(P(!0),fetch("/api/openrouter/free-models").then(O=>O.ok?O.json():null).then(O=>{if(O!=null&&O.models&&O.models.length>0){const ie=O.models.slice(0,16).map(Ve=>({id:Ve.id,label:Ve.label??Ve.name??Ve.id,desc:Ve.desc??Ve.description??"",free:Ve.id.endsWith(":free")})),se=new Set(ie.map(Ve=>Ve.id)),Pe=Rc.filter(Ve=>!se.has(Ve.id));R([...ie,...Pe])}}).catch(()=>{}).finally(()=>P(!1)))},[v]),h.useEffect(()=>{v==="ollama"&&fetch("/api/setup/ollama-models").then(O=>O.ok?O.json():null).then(O=>{O!=null&&O.models&&s(O.models),O!=null&&O.hardware&&a(O.hardware)}).catch(()=>{})},[v]);const qs=v==="ollama",st=e.find(O=>O.id===v),Ys=h.useMemo(()=>{const O=x.toLowerCase().trim();return O?e.filter(ie=>ie.label.toLowerCase().includes(O)||ie.description.toLowerCase().includes(O)||ie.tags.some(se=>se.toLowerCase().includes(O))):e},[e,x]),Vl=h.useMemo(()=>{const O={};for(const ie of Ys)O[ie.category]||(O[ie.category]=[]),O[ie.category].push(ie);return O},[Ys]),Xs=()=>{switch(u){case 0:return f.trim().length>0;case 1:{if(qs){const O=n.length===0||B.trim().length>0;return V.trim().length>0&&O}return v==="openrouter"?j.trim().length>0&&N.trim().length>0:st!=null&&st.envKeyIsUrl?!0:j.trim().length>0}case 2:return T.trim().length>0;default:return!0}},$l=async()=>{ce("testing");try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(ie=>ie.stop()),ce("granted")}catch{ce("denied")}},ka=async O=>{J(ie=>({...ie,[O]:"testing"}));try{const se=await(await fetch(`/api/channels/${O}/status`)).json().catch(()=>({}));J(Pe=>({...Pe,[O]:se.configured?"ok":"fail"}))}catch{J(ie=>({...ie,[O]:"fail"}))}},gs=async()=>{ee(!0),Qr(null);try{const O={};for(const Pe of h0)if(K[Pe.id]){for(const Ve of Pe.fields){const ja=(I[Ve.key]??"").trim();ja&&(O[Ve.key]=ja)}O[`CHANNEL_${Pe.id.toUpperCase()}_ENABLED`]="true"}const ie={name:f.trim()||"User",language:b,provider:v,apiKey:qs?V:j,model:qs?B:v==="openrouter"?N:st==null?void 0:st.defaultModel,skills:["browser","terminal","memory","web_search","filesystem","git","vision","input","telegram","analyzer"],mode:"local",workspacePath:T.trim()||c,wakeWord:C,telemetry:z,channels:O};let se=await fetch("/api/setup/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(!se.ok&&se.status===404&&(se=await fetch("/api/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)})),!se.ok){const Pe=await se.json().catch(()=>({}));throw new Error(Pe.error??"Setup failed")}localStorage.setItem("mustb_boot_report","1"),localStorage.setItem("mustb_setup_complete","1"),window.location.href="/app"}catch(O){Qr(O instanceof Error?O.message:"Unknown error"),ee(!1)}};return r.jsxs("div",{className:"min-h-screen bg-[#02040a] flex flex-col items-center justify-center px-4 py-12 relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] bg-orange-900/12 rounded-full blur-[120px]"})}),r.jsxs("div",{className:"relative z-10 w-full max-w-xl",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"flex justify-center mb-4",children:r.jsxs("div",{className:"relative w-14 h-14",children:[r.jsx("div",{className:"absolute inset-0 bg-orange-500 rounded-full blur-lg opacity-40 animate-pulse"}),r.jsx("img",{src:"/logo.png",alt:"Must-b",className:"w-full h-full object-contain relative z-10"})]})}),r.jsx("h1",{className:"text-3xl font-extrabold text-white tracking-tight",children:"Setup Must-b"}),r.jsx("p",{className:"text-gray-400 mt-1.5 text-sm",children:"First-time configuration · 6 steps"})]}),r.jsx("div",{className:"flex justify-center items-center mb-6",children:wo.map((O,ie)=>r.jsxs("div",{className:"flex flex-col items-center gap-1",children:[r.jsx(ZC,{index:ie,current:u}),r.jsx("span",{className:Ze("text-[9px] font-bold uppercase tracking-widest transition-colors",ie===u?"text-orange-400":ie<u?"text-orange-500/50":"text-gray-700"),children:O})]},ie))}),r.jsx(ne,{mode:"wait",children:r.jsxs(H.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.18},className:"glass rounded-2xl p-6 border border-white/8",children:[r.jsxs("p",{className:"text-[10px] font-bold text-orange-500/60 uppercase tracking-widest mb-1",children:["Step ",u+1," of ",wo.length]}),r.jsx("h2",{className:"text-xl font-bold text-white mb-5",children:wo[u]}),u===0&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Your name"}),r.jsx("input",{autoFocus:!0,type:"text",value:f,onChange:O=>m(O.target.value),onKeyDown:O=>O.key==="Enter"&&Xs()&&p(1),placeholder:"e.g. Burak",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 transition-all text-base"}),r.jsx("p",{className:"text-gray-400 text-xs",children:"Used in greetings and memory. Editable anytime in Settings."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Language"}),r.jsxs("div",{className:"relative",children:[r.jsx(qe,{size:14,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),r.jsx("select",{value:b,onChange:O=>y(O.target.value),className:"w-full bg-white/5 border border-white/10 rounded-xl pl-9 pr-4 py-3 text-white focus:outline-none focus:ring-1 focus:ring-orange-500/50 transition-all text-sm appearance-none cursor-pointer",children:u0.map(O=>r.jsx("option",{value:O.value,className:"bg-[#0d1117] text-white",children:O.label},O.value))}),r.jsx(Qt,{size:13,className:"absolute right-3.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none rotate-90"})]})]})]}),u===1&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Zt,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",value:x,onChange:O=>w(O.target.value),placeholder:"Search providers…",className:"w-full bg-white/5 border border-white/10 rounded-xl pl-9 pr-4 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 text-sm"})]}),r.jsxs("div",{className:"max-h-[260px] overflow-y-auto space-y-4 pr-1 scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent",children:[o?r.jsx("p",{className:"text-center py-6 text-gray-400 text-sm",children:"Loading providers…"}):JC.map(O=>{const ie=Vl[O];return ie!=null&&ie.length?r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-1.5 px-1",children:QC[O]}),r.jsx("div",{className:"space-y-1",children:ie.map(se=>r.jsxs("button",{onClick:()=>{g(se.id),k("")},className:Ze("w-full flex items-center gap-3 px-3 py-2.5 rounded-xl border transition-all text-left",v===se.id?"bg-orange-500/10 border-orange-500/40 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("w-3 h-3 rounded-full border-2 flex-shrink-0 transition-all",v===se.id?"border-orange-500 bg-orange-500":"border-gray-600")}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-semibold text-sm leading-tight",children:se.label}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:se.description})]}),r.jsx("div",{className:"flex flex-wrap gap-1 justify-end flex-shrink-0 max-w-[120px]",children:se.tags.slice(0,2).map(Pe=>r.jsx(e3,{label:Pe},Pe))})]},se.id))})]},O):null}),!o&&Ys.length===0&&r.jsxs("p",{className:"text-center py-6 text-gray-400 text-sm",children:['No providers match "',x,'"']})]}),qs?r.jsxs("div",{className:"space-y-3 pt-1 border-t border-white/6",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Ollama Base URL"}),r.jsx("input",{type:"url",value:V,onChange:O=>M(O.target.value),placeholder:"http://localhost:11434",className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 font-mono text-sm"})]}),i&&r.jsxs("div",{className:"flex items-center gap-4 rounded-xl bg-white/3 border border-white/8 px-3 py-2 text-xs text-gray-400",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(uv,{size:11,className:"text-orange-400"}),i.ramGb.toFixed(1)," GB RAM"]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(fn,{size:11,className:"text-orange-400"}),i.cpuCount," CPUs"]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Oe,{size:11,className:"text-orange-400"}),"Score ",i.score," · ",i.tier]})]}),n.length>0&&r.jsx("div",{className:"max-h-[180px] overflow-y-auto space-y-1.5 pr-1",children:n.map(O=>r.jsxs("button",{onClick:()=>A(O.modelId),className:Ze("w-full flex items-center gap-3 px-3 py-2.5 rounded-xl border transition-all text-left",B===O.modelId?"bg-orange-500/10 border-orange-500/40 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("w-3 h-3 rounded-full border-2 flex-shrink-0",B===O.modelId?"border-orange-500 bg-orange-500":"border-gray-600")}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"font-semibold text-sm",children:O.name}),r.jsx("span",{className:"text-[10px] text-gray-400 font-mono",children:O.params})]}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:O.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[r.jsx(t3,{fit:O.fit}),r.jsxs("span",{className:"text-[10px] text-gray-400",children:[O.ramGb," GB"]})]})]},O.id))})]}):st?r.jsxs("div",{className:"space-y-2 pt-1 border-t border-white/6",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:st.envKeyIsUrl?"Base URL":`${st.label} API Key`}),r.jsx("input",{type:st.envKeyIsUrl?"url":"password",value:j,onChange:O=>k(O.target.value),placeholder:st.placeholder,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 font-mono text-sm"}),v==="openrouter"&&r.jsxs("div",{className:"space-y-2 pt-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold flex-1",children:"Select Model"}),L&&r.jsx("span",{className:"text-[10px] text-orange-400/60 animate-pulse",children:"Loading live models…"}),r.jsx("span",{className:"text-[10px] text-green-500/60",children:"✓ Offline list always ready"})]}),r.jsx("div",{className:"max-h-[200px] overflow-y-auto space-y-1.5 pr-1",children:_.map(O=>r.jsxs("button",{type:"button",onClick:()=>S(O.id),className:Ze("w-full flex items-start gap-3 px-3 py-2.5 rounded-xl border transition-all text-left",N===O.id?"bg-orange-500/12 border-orange-500/40 text-white":"bg-white/3 border-white/8 text-gray-400 hover:border-white/20 hover:text-white"),children:[r.jsx("div",{className:Ze("w-3 h-3 rounded-full border-2 flex-shrink-0 mt-0.5",N===O.id?"border-orange-500 bg-orange-500":"border-gray-600")}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("p",{className:"font-semibold text-sm leading-tight",children:O.label}),O.free&&r.jsx("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded bg-green-500/15 text-green-400 border border-green-500/20",children:"FREE"})]}),r.jsx("p",{className:"text-[11px] text-gray-500 truncate",children:O.desc})]})]},O.id))}),!N&&r.jsxs("p",{className:"text-xs text-orange-400 flex items-center gap-1.5",children:[r.jsx(ls,{size:11})," Select a model to continue"]})]}),v!=="openrouter"&&st.latestModels.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:st.latestModels.slice(0,4).map(O=>r.jsx("span",{className:"text-[11px] font-mono text-orange-400/60 bg-orange-500/5 border border-orange-500/10 px-2 py-0.5 rounded-lg",children:O},O))}),r.jsxs("p",{className:"text-gray-400 text-xs",children:["Stored locally in ",r.jsx("code",{className:"text-orange-500/60",children:".env"})," — never sent to external servers."]})]}):null]}),u===2&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs text-gray-400 uppercase tracking-widest font-bold",children:"Workspace Directory"}),r.jsxs("div",{className:"relative",children:[r.jsx(hC,{size:13,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),r.jsx("input",{autoFocus:!0,type:"text",value:T,onChange:O=>F(O.target.value),placeholder:c,className:"w-full bg-white/5 border border-white/10 rounded-xl pl-9 pr-4 py-3 text-white placeholder-gray-600 focus:outline-none focus:ring-1 focus:ring-orange-500/50 font-mono text-sm"})]}),r.jsxs("p",{className:"text-gray-400 text-xs",children:["Must-b will read and write files ",r.jsx("span",{className:"text-orange-500/70 font-medium",children:"only within this directory"}),". The folder will be created if it doesn't exist."]})]}),r.jsxs("div",{className:"flex items-start gap-3 rounded-xl bg-white/3 border border-white/8 px-4 py-3",children:[r.jsx(mv,{size:15,className:"text-green-400 flex-shrink-0 mt-0.5"}),r.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:"Must-b operates in a sandboxed workspace. It cannot access files outside this directory unless you explicitly provide a path in a prompt."})]})]}),u===3&&r.jsxs("div",{className:"space-y-4",children:[r.jsx(f0,{checked:C,onChange:E,label:'Enable "Hey Must-b" Wake Word',description:"Always-on voice activation — must-b-ui listens passively via your microphone."}),r.jsx("div",{className:"rounded-xl bg-white/3 border border-white/8 px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-white",children:"Test Microphone Permission"}),r.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[he==="idle"&&"Click to verify your browser can access the microphone.",he==="testing"&&"Requesting permission…",he==="granted"&&"Microphone access granted ✓",he==="denied"&&"Permission denied — check browser settings."]})]}),r.jsx("button",{onClick:$l,disabled:he==="testing",className:Ze("flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all shrink-0",he==="granted"?"bg-green-500/10 border border-green-500/20 text-green-400 cursor-default":he==="denied"?"bg-red-500/10 border border-red-500/20 text-red-400":"bg-white/5 border border-white/10 text-gray-300 hover:border-white/25 hover:text-white"),children:he==="granted"?r.jsxs(r.Fragment,{children:[r.jsx(at,{size:12})," Granted"]}):he==="denied"?r.jsxs(r.Fragment,{children:[r.jsx(sf,{size:12})," Denied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Bs,{size:12})," Test"]})})]})}),r.jsx("p",{className:"text-gray-700 text-xs px-1",children:"Wake word and microphone can be reconfigured at any time in Settings → Voice."})]}),u===4&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-[12px] text-gray-500",children:"Connect messaging channels so Must-b can send and receive messages on your behalf. All tokens are stored locally. You can skip and configure later in Settings."}),h0.map(O=>{const ie=!!K[O.id];return r.jsxs("div",{className:"rounded-xl border transition-all overflow-hidden",style:{borderColor:ie?"rgba(234,88,12,0.35)":"rgba(255,255,255,0.07)",background:ie?"rgba(234,88,12,0.06)":"rgba(255,255,255,0.02)"},children:[r.jsxs("div",{className:"flex items-center",children:[r.jsxs("button",{onClick:()=>X(se=>({...se,[O.id]:!ie})),className:"flex-1 flex items-center justify-between px-4 py-3",children:[r.jsxs("span",{className:"flex items-center gap-2.5 text-[13px] font-semibold text-gray-200",children:[r.jsx("span",{className:"text-base",children:O.emoji}),O.label,r.jsx("span",{className:"text-[10px] text-gray-600 font-normal",children:O.hint}),G[O.id]==="ok"&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 flex-shrink-0"}),G[O.id]==="fail"&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 flex-shrink-0"}),G[O.id]==="testing"&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-400 animate-pulse flex-shrink-0"})]}),r.jsx("span",{className:"w-8 h-4 rounded-full relative transition-all flex-shrink-0",style:{background:ie?"#ea580c":"rgba(255,255,255,0.1)"},children:r.jsx("span",{className:"absolute top-0.5 w-3 h-3 bg-white rounded-full transition-all shadow-sm",style:{left:ie?"calc(100% - 14px)":"2px"}})})]}),ie&&O.fields.some(se=>(I[se.key]??"").trim())&&r.jsx("button",{onClick:se=>{se.stopPropagation(),ka(O.id)},disabled:G[O.id]==="testing",className:"mr-3 px-2 py-1 rounded-lg text-[10px] font-semibold transition-all disabled:opacity-40",style:{background:"rgba(234,88,12,0.12)",border:"1px solid rgba(234,88,12,0.25)",color:"#fb923c"},children:G[O.id]==="testing"?"…":"Test"})]}),ie&&r.jsx("div",{className:"px-4 pb-3 space-y-2 border-t",style:{borderColor:"rgba(234,88,12,0.15)"},children:O.fields.map(se=>r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] font-semibold text-gray-500 uppercase tracking-widest mb-1 mt-2",children:se.label}),r.jsx("input",{type:se.secret?"password":"text",value:I[se.key]??"",onChange:Pe=>Q(Ve=>({...Ve,[se.key]:Pe.target.value})),placeholder:se.placeholder,className:"w-full px-3 py-2 rounded-lg text-[12px] text-gray-200 placeholder-gray-700 outline-none transition-all",style:{background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.08)"}})]},se.key))})]},O.id)})]}),u===5&&r.jsxs("div",{className:"space-y-5",children:[r.jsx(f0,{checked:z,onChange:W,label:"Send anonymous crash reports",description:"Helps improve Must-b. No personal data, no conversation content — only error traces."}),r.jsxs("div",{className:"rounded-xl bg-white/3 border border-white/6 px-4 py-4 space-y-2",children:[r.jsx("p",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-widest mb-2",children:"Configuration Summary"}),[{label:"Name",value:f||"—"},{label:"Language",value:((Jr=u0.find(O=>O.value===b))==null?void 0:Jr.label)??b},{label:"Provider",value:((nn=e.find(O=>O.id===v))==null?void 0:nn.label)??v},{label:"Workspace",value:(T||c).replace(/^.*\/([^/]+\/[^/]+)$/,"…/$1")},{label:"Wake Word",value:C?"Enabled":"Disabled"}].map(O=>r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-gray-400",children:O.label}),r.jsx("span",{className:"text-gray-300 font-mono truncate max-w-[200px]",children:O.value})]},O.label))]}),Lt&&r.jsx("div",{className:"rounded-xl bg-red-500/10 border border-red-500/20 px-4 py-3 text-red-400 text-sm",children:Lt}),r.jsx("button",{onClick:gs,disabled:Y,className:"w-full flex items-center justify-center gap-3 px-8 py-4 rounded-2xl bg-gradient-to-r from-orange-600 to-amber-600 hover:from-orange-500 hover:to-amber-500 text-white font-bold text-base transition-all shadow-lg shadow-orange-500/25 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",children:Y?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"w-5 h-5 border-2 border-white/40 border-t-white rounded-full animate-spin"})," Initializing…"]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-lg",children:"🚀"})," Initialize Must-b"]})})]})]},u)}),u<5&&r.jsxs("div",{className:"flex items-center justify-between mt-5",children:[r.jsxs("button",{onClick:()=>p(O=>O-1),disabled:u===0,className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all disabled:opacity-25 disabled:cursor-not-allowed text-sm font-medium",children:[r.jsx(a0,{size:16})," Back"]}),r.jsxs("button",{onClick:()=>p(O=>O+1),disabled:!Xs(),className:"flex items-center gap-2 px-6 py-2.5 rounded-xl bg-orange-600 hover:bg-orange-500 text-white font-semibold text-sm transition-all shadow-lg shadow-orange-500/20 active:scale-[0.97] disabled:opacity-40 disabled:cursor-not-allowed",children:["Continue ",r.jsx(Qt,{size:16})]})]}),u===5&&r.jsx("div",{className:"flex justify-start mt-5",children:r.jsxs("button",{onClick:()=>p(4),className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all text-sm font-medium",children:[r.jsx(a0,{size:16})," Back"]})}),r.jsxs("p",{className:"text-center text-xs text-gray-700 mt-5",children:["All settings saved locally · Run ",r.jsx("code",{className:"text-orange-500/60",children:"must-b doctor"})," to verify"]})]})]})}const pn=Object.create(null);pn.open="0";pn.close="1";pn.ping="2";pn.pong="3";pn.message="4";pn.upgrade="5";pn.noop="6";const ko=Object.create(null);Object.keys(pn).forEach(e=>{ko[pn[e]]=e});const hu={type:"error",data:"parser error"},kv=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",jv=typeof ArrayBuffer=="function",Nv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,uf=({type:e,data:t},n,s)=>kv&&t instanceof Blob?n?s(t):p0(t,s):jv&&(t instanceof ArrayBuffer||Nv(t))?n?s(t):p0(new Blob([t]),s):s(pn[e]+(t||"")),p0=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function m0(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let zc;function s3(e,t){if(kv&&e.data instanceof Blob)return e.data.arrayBuffer().then(m0).then(t);if(jv&&(e.data instanceof ArrayBuffer||Nv(e.data)))return t(m0(e.data));uf(e,!1,n=>{zc||(zc=new TextEncoder),t(zc.encode(n))})}const g0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<g0.length;e++)xi[g0.charCodeAt(e)]=e;const r3=e=>{let t=e.length*.75,n=e.length,s,i=0,a,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),u=new Uint8Array(d);for(s=0;s<n;s+=4)a=xi[e.charCodeAt(s)],o=xi[e.charCodeAt(s+1)],l=xi[e.charCodeAt(s+2)],c=xi[e.charCodeAt(s+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|l>>2,u[i++]=(l&3)<<6|c&63;return d},i3=typeof ArrayBuffer=="function",hf=(e,t)=>{if(typeof e!="string")return{type:"message",data:Sv(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:a3(e.substring(1),t)}:ko[n]?e.length>1?{type:ko[n],data:e.substring(1)}:{type:ko[n]}:hu},a3=(e,t)=>{if(i3){const n=r3(e);return Sv(n,t)}else return{base64:!0,data:e}},Sv=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Cv="",o3=(e,t)=>{const n=e.length,s=new Array(n);let i=0;e.forEach((a,o)=>{uf(a,!1,l=>{s[o]=l,++i===n&&t(s.join(Cv))})})},l3=(e,t)=>{const n=e.split(Cv),s=[];for(let i=0;i<n.length;i++){const a=hf(n[i],t);if(s.push(a),a.type==="error")break}return s};function c3(){return new TransformStream({transform(e,t){s3(e,n=>{const s=n.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,s)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let Lc;function qa(e){return e.reduce((t,n)=>t+n.length,0)}function Ya(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let i=0;i<t;i++)n[i]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function d3(e,t){Lc||(Lc=new TextDecoder);const n=[];let s=0,i=-1,a=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(s===0){if(qa(n)<1)break;const c=Ya(n,1);a=(c[0]&128)===128,i=c[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(qa(n)<2)break;const c=Ya(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(qa(n)<8)break;const c=Ya(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),u=d.getUint32(0);if(u>Math.pow(2,21)-1){l.enqueue(hu);break}i=u*Math.pow(2,32)+d.getUint32(4),s=3}else{if(qa(n)<i)break;const c=Ya(n,i);l.enqueue(hf(a?c:Lc.decode(c),t)),s=0}if(i===0||i>e){l.enqueue(hu);break}}}})}const Ev=4;function Le(e){if(e)return u3(e)}function u3(e){for(var t in Le.prototype)e[t]=Le.prototype[t];return e}Le.prototype.on=Le.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Le.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Le.prototype.off=Le.prototype.removeListener=Le.prototype.removeAllListeners=Le.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,i=0;i<n.length;i++)if(s=n[i],s===t||s.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Le.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,i=n.length;s<i;++s)n[s].apply(this,t)}return this};Le.prototype.emitReserved=Le.prototype.emit;Le.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Le.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Ol=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Tt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),h3="arraybuffer";function _v(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const f3=Tt.setTimeout,p3=Tt.clearTimeout;function Dl(e,t){t.useNativeTimers?(e.setTimeoutFn=f3.bind(Tt),e.clearTimeoutFn=p3.bind(Tt)):(e.setTimeoutFn=Tt.setTimeout.bind(Tt),e.clearTimeoutFn=Tt.clearTimeout.bind(Tt))}const m3=1.33;function g3(e){return typeof e=="string"?x3(e):Math.ceil((e.byteLength||e.size)*m3)}function x3(e){let t=0,n=0;for(let s=0,i=e.length;s<i;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function Tv(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function y3(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function v3(e){let t={},n=e.split("&");for(let s=0,i=n.length;s<i;s++){let a=n[s].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class b3 extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class ff extends Le{constructor(t){super(),this.writable=!1,Dl(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new b3(t,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=hf(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=y3(t);return n.length?"?"+n:""}}class w3 extends ff{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};l3(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,o3(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Tv()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Pv=!1;try{Pv=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const k3=Pv;function j3(){}class N3 extends w3{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}class hn extends Le{constructor(t,n,s){super(),this.createRequest=t,Dl(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const n=_v(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=hn.requestsCount++,hn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=j3,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete hn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}hn.requestsCount=0;hn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",x0);else if(typeof addEventListener=="function"){const e="onpagehide"in Tt?"pagehide":"unload";addEventListener(e,x0,!1)}}function x0(){for(let e in hn.requests)hn.requests.hasOwnProperty(e)&&hn.requests[e].abort()}const S3=function(){const e=Av({xdomain:!1});return e&&e.responseType!==null}();class C3 extends N3{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=S3&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new hn(Av,this.uri(),t)}}function Av(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||k3))return new XMLHttpRequest}catch{}if(!t)try{return new Tt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Mv=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class E3 extends ff{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=Mv?{}:_v(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],i=n===t.length-1;uf(s,this.supportsBinary,a=>{try{this.doWrite(s,a)}catch{}i&&Ol(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Tv()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Oc=Tt.WebSocket||Tt.MozWebSocket;class _3 extends E3{createSocket(t,n,s){return Mv?new Oc(t,n,s):n?new Oc(t,n):new Oc(t)}doWrite(t,n){this.ws.send(n)}}class T3 extends ff{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=d3(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),i=c3();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const a=()=>{s.read().then(({done:l,value:c})=>{l||(this.onPacket(c),a())}).catch(l=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],i=n===t.length-1;this._writer.write(s).then(()=>{i&&Ol(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const P3={websocket:_3,webtransport:T3,polling:C3},A3=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,M3=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fu(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let i=A3.exec(e||""),a={},o=14;for(;o--;)a[M3[o]]=i[o]||"";return n!=-1&&s!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=R3(a,a.path),a.queryKey=z3(a,a.query),a}function R3(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function z3(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,a){i&&(n[i]=a)}),n}const pu=typeof addEventListener=="function"&&typeof removeEventListener=="function",jo=[];pu&&addEventListener("offline",()=>{jo.forEach(e=>e())},!1);class ts extends Le{constructor(t,n){if(super(),this.binaryType=h3,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const s=fu(t);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=fu(n.host).host);Dl(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=v3(this.opts.query)),pu&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},jo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Ev,n.transport=t,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ts.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",ts.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(n+=g3(i)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Ol(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,i){if(typeof n=="function"&&(i=n,n=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const a={type:t,data:n,options:s};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ts.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),pu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=jo.indexOf(this._offlineEventListener);s!==-1&&jo.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}ts.protocol=Ev;class L3 extends ts{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),s=!1;ts.priorWebsocketSuccess=!1;const i=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!s)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;ts.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function a(){s||(s=!0,u(),n.close(),n=null)}const o=p=>{const f=new Error("probe error: "+p);f.transport=n.name,a(),this.emitReserved("upgradeError",f)};function l(){o("transport closed")}function c(){o("socket closed")}function d(p){n&&p.name!==n.name&&a()}const u=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let O3=class extends L3{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>P3[i]).filter(i=>!!i)),super(t,s)}};function D3(e,t="",n){let s=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),s=fu(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const a=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+a+":"+s.port+t,s.href=s.protocol+"://"+a+(n&&n.port===s.port?"":":"+s.port),s}const I3=typeof ArrayBuffer=="function",B3=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Rv=Object.prototype.toString,F3=typeof Blob=="function"||typeof Blob<"u"&&Rv.call(Blob)==="[object BlobConstructor]",V3=typeof File=="function"||typeof File<"u"&&Rv.call(File)==="[object FileConstructor]";function pf(e){return I3&&(e instanceof ArrayBuffer||B3(e))||F3&&e instanceof Blob||V3&&e instanceof File}function No(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(No(e[n]))return!0;return!1}if(pf(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return No(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&No(e[n]))return!0;return!1}function $3(e){const t=[],n=e.data,s=e;return s.data=mu(n,t),s.attachments=t.length,{packet:s,buffers:t}}function mu(e,t){if(!e)return e;if(pf(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=mu(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=mu(e[s],t));return n}return e}function U3(e,t){return e.data=gu(e.data,t),delete e.attachments,e}function gu(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=gu(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=gu(e[n],t));return e}const H3=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var le;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(le||(le={}));class W3{constructor(t){this.replacer=t}encode(t){return(t.type===le.EVENT||t.type===le.ACK)&&No(t)?this.encodeAsBinary({type:t.type===le.EVENT?le.BINARY_EVENT:le.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===le.BINARY_EVENT||t.type===le.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=$3(t),s=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(s),i}}class mf extends Le{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const s=n.type===le.BINARY_EVENT;s||n.type===le.BINARY_ACK?(n.type=s?le.EVENT:le.ACK,this.reconstructor=new K3(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(pf(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const s={type:Number(t.charAt(0))};if(le[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===le.BINARY_EVENT||s.type===le.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(a,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(a,n)}else s.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const a=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}s.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(mf.isPayloadValid(s.type,a))s.data=a;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case le.CONNECT:return y0(n);case le.DISCONNECT:return n===void 0;case le.CONNECT_ERROR:return typeof n=="string"||y0(n);case le.EVENT:case le.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&H3.indexOf(n[0])===-1);case le.ACK:case le.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class K3{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=U3(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function y0(e){return Object.prototype.toString.call(e)==="[object Object]"}const G3=Object.freeze(Object.defineProperty({__proto__:null,Decoder:mf,Encoder:W3,get PacketType(){return le}},Symbol.toStringTag,{value:"Module"}));function Ht(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const q3=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zv extends Le{constructor(t,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ht(t,"open",this.onopen.bind(this)),Ht(t,"packet",this.onpacket.bind(this)),Ht(t,"error",this.onerror.bind(this)),Ht(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var s,i,a;if(q3.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:le.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,p=n.pop();this._registerAckCallback(u,p),o.id=u}const l=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},i),o=(...l)=>{this.io.clearTimeoutFn(a),n.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((s,i)=>{const a=(o,l)=>o?i(o):s(l);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>(this._queue[0],i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:le.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case le.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case le.EVENT:case le.BINARY_EVENT:this.onevent(t);break;case le.ACK:case le.BINARY_ACK:this.onack(t);break;case le.DISCONNECT:this.ondisconnect();break;case le.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let s=!1;return function(...i){s||(s=!0,n.packet({type:le.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:le.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,t.data)}}}function Xr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Xr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Xr.prototype.reset=function(){this.attempts=0};Xr.prototype.setMin=function(e){this.ms=e};Xr.prototype.setMax=function(e){this.max=e};Xr.prototype.setJitter=function(e){this.jitter=e};class xu extends Le{constructor(t,n){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Dl(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Xr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||G3;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new O3(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=Ht(n,"open",function(){s.onopen(),t&&t()}),a=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=Ht(n,"error",a);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ht(t,"ping",this.onping.bind(this)),Ht(t,"data",this.ondata.bind(this)),Ht(t,"error",this.onerror.bind(this)),Ht(t,"close",this.onclose.bind(this)),Ht(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Ol(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new zv(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const li={};function zi(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=D3(e,t.path||"/socket.io"),s=n.source,i=n.id,a=n.path,o=li[i]&&a in li[i].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new xu(s,t):(li[i]||(li[i]=new xu(s,t)),c=li[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(zi,{Manager:xu,Socket:zv,io:zi,connect:zi});const Y3={};let vs=null;function X3(){const e=Y3;if(e!=null&&e.VITE_BACKEND_URL)return e.VITE_BACKEND_URL.replace(/\/$/,"");const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||/^\d{1,3}(\.\d{1,3}){3}$/.test(t)?window.location.origin:"http://localhost:4309"}function Be(){return vs||(vs=zi(X3(),{transports:["websocket","polling"],withCredentials:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,randomizationFactor:.3,timeout:1e4}),vs.on("agentUpdate",e=>{try{e!=null&&window.dispatchEvent(new CustomEvent("mustb:agentUpdate",{detail:e}))}catch{}}),vs.on("connect",()=>{window.dispatchEvent(new CustomEvent("mustb:connected"))}),vs.on("disconnect",e=>{window.dispatchEvent(new CustomEvent("mustb:disconnected",{detail:{reason:e}}))}),vs.io.on("reconnect",e=>{window.dispatchEvent(new CustomEvent("mustb:reconnected",{detail:{attemptNumber:e}}))})),vs}const Q3={};let yi=null;const J3=(()=>{const e=Q3,t=(e==null?void 0:e.VITE_BACKEND_URL)??"";return t&&!t.includes(window.location.hostname)?t.replace(/\/$/,""):""})();function Lv(e){return e.startsWith("http")?e:`${J3}${e}`}async function Z3(){if(yi)return yi;try{const e=await fetch(Lv("/api/auth/local"));if(e.ok)return yi=(await e.json()).token??null,yi}catch{}return null}async function $(e,t={},{retries:n=3,retryDelay:s=800}={}){const i=await Z3(),a={"Content-Type":"application/json",...t.headers};i&&(a.Authorization=`Bearer ${i}`);const o=Lv(e);let l;for(let c=1;c<=n;c++)try{const d=await fetch(o,{...t,headers:a});return d.status===401&&(yi=null,window.dispatchEvent(new CustomEvent("mustb:401",{detail:{url:o}}))),d}catch(d){l=d,c<n&&await new Promise(u=>setTimeout(u,s*c))}throw window.dispatchEvent(new CustomEvent("mustb:offline",{detail:{url:o}})),l}function v0(e){const t=e.toLowerCase();if(t.includes("gemini-2")||t.includes("gemini-flash"))return 9999;if(t.includes("llama-3")&&(t.includes("70b")||t.includes("405b")))return 9998;if(t.includes("gpt-4o"))return 8888;if(t.includes("claude-3-5")||t.includes("claude-3.5"))return 8887;if(t.includes("gemini-pro")||t.includes("gemini-1.5-pro"))return 8886;const n=t.match(/(\d+)x(\d+)b/);if(n)return parseFloat(n[1])*parseFloat(n[2]);const s=t.match(/(\d+(?:\.\d+)?)b/);return s?parseFloat(s[1]):0}function Dc(e){return[...e].sort((t,n)=>v0(n.id)-v0(t.id))}function eE(){const{t:e}=gt(),[t,n]=h.useState(!1),[s,i]=h.useState(()=>localStorage.getItem("mustb_active_model")??"Loading…"),[a,o]=h.useState([]),l=h.useRef(null);h.useEffect(()=>{const f=localStorage.getItem("mustb_active_model");f&&f!=="Loading…"&&$("/api/settings/model",{method:"POST",body:JSON.stringify({model:f})}).catch(()=>{}),$("/api/setup/status").then(m=>m.ok?m.json():null).then(m=>{if(!m)return;const b=localStorage.getItem("mustb_active_model");m.activeModel&&(!b||b==="Loading…")&&(i(m.activeModel),localStorage.setItem("mustb_active_model",m.activeModel)),(m.activeProvider??"openrouter").toLowerCase()==="ollama"?$("/api/models").then(v=>v.ok?v.json():[]).then(v=>{const x=(Array.isArray(v)?v:[]).map(w=>({id:w.id??String(w),name:w.name??w.id??String(w),free:!0}));o(Dc(x))}).catch(()=>{}):$("/api/providers/openrouter/models").then(v=>v.ok?v.json():{}).then(v=>{const g=Dc((v.free??[]).map(j=>({id:j.id,name:j.name??j.id,free:!0}))),x=Dc((v.power??[]).map(j=>({id:j.id,name:j.name??j.id,free:!1}))),w=[...g,...x];o(w),!(m!=null&&m.activeModel)&&w.length>0&&i(w[0].id)}).catch(()=>{})}).catch(()=>{})},[]),h.useEffect(()=>{if(!t)return;const f=m=>{l.current&&!l.current.contains(m.target)&&n(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[t]);const c=async f=>{i(f),localStorage.setItem("mustb_active_model",f),n(!1),await $("/api/settings/model",{method:"POST",body:JSON.stringify({model:f})}).catch(()=>{})},d=a.filter(f=>f.free),u=a.filter(f=>!f.free),p=s.length>28?s.slice(0,26)+"…":s;return r.jsxs("div",{ref:l,className:"relative",children:[r.jsxs("button",{onClick:()=>n(f=>!f),className:"flex items-center gap-1 px-2 py-1 rounded-lg border border-white/10 bg-white/5 hover:bg-white/10 text-white/50 hover:text-white/80 text-[11px] font-medium transition-all",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-500 shrink-0"}),r.jsx("span",{className:"truncate max-w-[110px]",children:p}),r.jsx(qr,{size:10,className:`transition-transform duration-200 shrink-0 text-white/30 ${t?"rotate-180":""}`})]}),r.jsx(ne,{children:t&&r.jsxs(H.div,{initial:{opacity:0,y:6,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,scale:.97},transition:{duration:.14,ease:[.22,1,.36,1]},className:"absolute bottom-full mb-2 left-0 z-50 w-72 rounded-xl shadow-xl border border-white/10 flex flex-col",style:{background:"rgba(18,8,2,0.97)",backdropFilter:"blur(24px)",maxHeight:"400px"},children:[r.jsxs("div",{className:"overflow-y-auto flex-1 p-1.5",children:[d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2.5 pt-2 pb-1 text-[9.5px] font-black uppercase tracking-[0.12em] text-emerald-500/80",children:"Free"}),d.slice(0,5).map(f=>r.jsxs("button",{onClick:()=>c(f.id),className:`w-full flex items-center gap-2 px-2.5 py-2 rounded-lg text-left transition-colors ${s===f.id?"bg-orange-500/15 text-orange-300":"text-white/60 hover:bg-white/5 hover:text-white/90"}`,children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${s===f.id?"bg-orange-500":"bg-emerald-400"}`}),r.jsx("span",{className:"text-[12px] font-medium truncate",children:f.name}),s===f.id&&r.jsx("span",{className:"ml-auto text-[9px] font-semibold text-orange-400 shrink-0",children:"active"})]},f.id))]}),u.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2.5 pt-2 pb-1 text-[9.5px] font-black uppercase tracking-[0.12em] text-orange-400/80",children:"Pro"}),u.map(f=>r.jsxs("button",{onClick:()=>c(f.id),className:`w-full flex items-center gap-2 px-2.5 py-2 rounded-lg text-left transition-colors ${s===f.id?"bg-orange-500/15 text-orange-300":"text-white/60 hover:bg-white/5 hover:text-white/90"}`,children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${s===f.id?"bg-orange-500":"bg-orange-300"}`}),r.jsx("span",{className:"text-[12px] font-medium truncate",children:f.name}),s===f.id&&r.jsx("span",{className:"ml-auto text-[9px] font-semibold text-orange-400 shrink-0",children:"active"})]},f.id))]}),a.length===0&&r.jsx("div",{className:"px-3 py-4 text-[12px] text-white/30 text-center",children:"No models available"})]}),r.jsx("div",{className:"shrink-0 border-t border-white/8 p-1.5",children:r.jsxs(_i,{to:"/app/settings",onClick:()=>n(!1),className:"flex items-center justify-center gap-1.5 w-full px-2.5 py-2 rounded-lg text-[11px] font-medium text-white/35 hover:text-orange-400 hover:bg-orange-500/8 transition-colors",children:[r.jsx(lf,{size:11}),e.systemHealth.moreModels]})})]})})]})}function Kt(e){if(typeof e=="string")return e;if(e==null)return"";if(typeof e=="object"){const t=e,n=t.message??t.error??t.text??t.content??t.result;return n!==void 0?Kt(n):JSON.stringify(e)}return String(e)}function tE(e,t){switch(e){case"planGenerated":{const n=t.steps;return`Plan ready — ${(n==null?void 0:n.length)??0} step(s)`}case"stepStart":{const n=t.step;return`▶ ${(n==null?void 0:n.description)??Kt(t.step)}`}case"stepFinish":{if(t.status==="error")return`✗ ${Kt(t.error)}`;const n=t.step,s=t.result!==void 0?Kt(t.result):void 0,i=(n==null?void 0:n.description)??"Step complete";return s&&s.length<180?`✓ ${i} → ${s}`:`✓ ${i}`}case"agentRepair":{const n=Kt(t.action),s=t.reason?` — ${Kt(t.reason).slice(0,120)}`:"";return`⟳ Repair: ${n}${s}`}default:return null}}function nE(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>t(s.result),s.onerror=n,s.readAsDataURL(e)})}function sE({lang:e,code:t}){const[n,s]=h.useState(!1);return r.jsxs("div",{className:"my-3 rounded-xl overflow-hidden border border-white/8 bg-[#1a0800]/90",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 border-b border-white/6 select-none",children:[r.jsx("span",{className:"text-[11px] font-mono text-orange-300/50",children:e||"code"}),r.jsx("button",{onClick:()=>{navigator.clipboard.writeText(t).catch(()=>{}),s(!0),setTimeout(()=>s(!1),2e3)},className:"flex items-center gap-1.5 text-[11px] text-orange-300/50 hover:text-orange-200 transition-colors",children:n?r.jsxs(r.Fragment,{children:[r.jsx(at,{size:10,className:"text-orange-400"}),r.jsx("span",{className:"text-orange-400",children:"Copied"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{size:10}),"Copy"]})})]}),r.jsx("pre",{className:"overflow-x-auto px-4 py-3 text-[13px] text-orange-50 font-mono leading-relaxed whitespace-pre",children:r.jsx("code",{children:t})})]})}function er(e,t){return e.split(/(`[^`\n]+`)/).map((s,i)=>{if(s.startsWith("`")&&s.endsWith("`")&&s.length>2)return r.jsx("code",{className:"px-1.5 py-0.5 rounded bg-black/15 text-orange-700 font-mono text-[12px]",children:s.slice(1,-1)},`${t}-ic${i}`);const a=s.split(/(\*\*[^*\n]+\*\*|\*[^*\n]+\*)/);return r.jsx(h.Fragment,{children:a.map((o,l)=>o.startsWith("**")&&o.endsWith("**")&&o.length>4?r.jsx("strong",{className:"font-bold text-inherit dark:text-gray-100",children:o.slice(2,-2)},`${t}-b${i}-${l}`):o.startsWith("*")&&o.endsWith("*")&&o.length>2?r.jsx("em",{className:"italic",children:o.slice(1,-1)},`${t}-em${i}-${l}`):r.jsx("span",{children:o},`${t}-s${i}-${l}`))},`${t}-bi${i}`)})}function rE({text:e,dark:t=!1}){const n=t?"text-orange-50":"text-[#3d1a06]",s=[],i=e.split(`
|
|
710
|
+
`);let a=0,o=0;const l=()=>`md-${o++}`;for(;a<i.length;){const c=i[a],d=c.match(/^```(\w*)/);if(d){const b=d[1]??"",y=[];for(a++;a<i.length&&!i[a].startsWith("```");)y.push(i[a]),a++;a<i.length&&a++,s.push(r.jsx(sE,{lang:b,code:y.join(`
|
|
711
|
+
`)},l()));continue}const u=c.match(/^### (.+)/);if(u){s.push(r.jsx("h3",{className:`text-sm font-bold mt-4 mb-1 ${n}`,children:er(u[1],l())},l())),a++;continue}const p=c.match(/^## (.+)/);if(p){s.push(r.jsx("h2",{className:`text-base font-bold mt-5 mb-1.5 ${n}`,children:er(p[1],l())},l())),a++;continue}const f=c.match(/^# (.+)/);if(f){s.push(r.jsx("h1",{className:`text-lg font-bold mt-6 mb-2 ${n}`,children:er(f[1],l())},l())),a++;continue}if(c.match(/^[-*]{3,}$/)){s.push(r.jsx("hr",{className:"border-black/10 my-4"},l())),a++;continue}if(c.match(/^[-*•] /)){const b=[];for(;a<i.length&&i[a].match(/^[-*•] /);)b.push(i[a].replace(/^[-*•] /,"")),a++;s.push(r.jsx("ul",{className:"my-2 space-y-1.5 pl-1",children:b.map((y,v)=>r.jsxs("li",{className:`flex items-start gap-2.5 text-[14px] leading-relaxed ${n}`,children:[r.jsx("span",{className:"mt-[7px] w-1.5 h-1.5 rounded-full bg-orange-500/60 flex-shrink-0"}),r.jsx("span",{children:er(y,`ul-${v}`)})]},v))},l()));continue}if(c.match(/^\d+\. /)){const b=[];for(;a<i.length&&i[a].match(/^\d+\. /);)b.push(i[a].replace(/^\d+\. /,"")),a++;s.push(r.jsx("ol",{className:"my-2 space-y-1.5 pl-1",children:b.map((y,v)=>r.jsxs("li",{className:`flex items-start gap-2.5 text-[14px] leading-relaxed ${n}`,children:[r.jsxs("span",{className:"flex-shrink-0 mt-px font-mono text-[12px] w-5 text-right text-orange-600/60",children:[v+1,"."]}),r.jsx("span",{children:er(y,`ol-${v}`)})]},v))},l()));continue}if(c.trim()===""){a++;continue}const m=[];for(;a<i.length&&i[a].trim()!==""&&!i[a].match(/^(```|#{1,3} |[-*•] |\d+\. |[-*]{3,}$)/);)m.push(i[a]),a++;m.length&&s.push(r.jsx("p",{className:`text-[14px] leading-[1.75] my-1.5 ${n}`,children:er(m.join(" "),`p-${o}`)},l()))}return r.jsx("div",{children:s})}function iE(){const[e,t]=h.useState(0);h.useEffect(()=>{const i=setInterval(()=>t(a=>a+1),1e3);return()=>clearInterval(i)},[]);const n=String(Math.floor(e/60)).padStart(2,"0"),s=String(e%60).padStart(2,"0");return r.jsxs("span",{className:"text-[10px] text-white/20 font-mono ml-1",children:["[",n,":",s,"]"]})}function aE({startedAt:e}){const[t,n]=h.useState(()=>e?Math.floor((Date.now()-e)/1e3):0);h.useEffect(()=>{if(!e)return;const a=setInterval(()=>n(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(a)},[e]);const s=Math.floor(t/60),i=t%60;return r.jsxs("span",{className:"text-[10px] text-orange-400/40 font-mono",children:["Working… ",s>0?`${s}m ${i}s`:`${i}s`]})}function oE({block:e}){const t=h.useRef(null);return h.useEffect(()=>{e.status==="running"&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[e.lines.length,e.status]),r.jsxs("div",{className:"mb-3 rounded-xl overflow-hidden font-mono text-[10px]",style:{background:"#0d0d0d",border:"1px solid rgba(255,255,255,0.09)"},children:[r.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-white/6",style:{background:"#1a1a1a"},children:[r.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500/60"}),r.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400/60"}),r.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500/60"}),r.jsx("span",{className:"ml-2 text-white/30 tracking-widest uppercase truncate flex-1",children:e.command}),e.status==="running"&&r.jsx(re,{size:9,className:"animate-spin text-orange-400/60 shrink-0"}),e.status==="done"&&r.jsx(Fe,{size:9,className:"text-emerald-400/60 shrink-0"}),e.status==="error"&&r.jsx("span",{className:"text-red-400/60 shrink-0",children:"✗"})]}),r.jsxs("div",{ref:t,className:"px-3 py-2 max-h-52 overflow-y-auto scrollbar-hide space-y-0.5",children:[e.lines.length===0?r.jsx("span",{className:"text-white/20 italic",children:"Connecting…"}):e.lines.map((n,s)=>r.jsx("div",{className:`leading-relaxed whitespace-pre-wrap break-all ${n.startsWith("$ ")?"text-green-400/90":n.startsWith("[stderr]")?"text-red-400/70":n.startsWith("⚠")?"text-amber-400/80":"text-white/45"}`,children:n},s)),e.status==="running"&&r.jsx("span",{className:"inline-block w-1.5 h-3 bg-green-400/70 animate-pulse ml-0.5"})]})]})}function lE({block:e}){const[t,n]=h.useState(!1),s=e.op==="write",i=e.content.length>3e3?e.content.slice(0,3e3)+`
|
|
712
|
+
…`:e.content;return r.jsxs("div",{className:"mb-3 rounded-xl overflow-hidden font-mono text-[10px]",style:{background:"#060d1a",border:`1px solid ${s?"rgba(52,211,153,0.18)":"rgba(99,179,237,0.15)"}`},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/6",style:{background:"#0c1528"},children:[r.jsx(Jt,{size:9,className:s?"text-emerald-400/70 shrink-0":"text-sky-400/60 shrink-0"}),r.jsx("span",{className:"text-white/50 truncate flex-1",children:e.filename}),r.jsx("span",{className:`text-[9px] font-bold tracking-widest uppercase shrink-0 ${s?"text-emerald-400/60":"text-sky-400/50"}`,children:s?"SAVED":"READ"}),r.jsx("button",{onClick:()=>{navigator.clipboard.writeText(e.content).catch(()=>{}),n(!0),setTimeout(()=>n(!1),2e3)},className:"ml-2 text-white/25 hover:text-white/60 transition-colors shrink-0",title:"Copy content",children:t?r.jsx(at,{size:9,className:"text-green-400"}):r.jsx(Os,{size:9})})]}),r.jsx("div",{className:"px-3 py-2 max-h-52 overflow-y-auto scrollbar-hide",children:r.jsx("pre",{className:"text-[10px] leading-relaxed whitespace-pre-wrap break-all",style:{color:s?"rgba(52,211,153,0.7)":"rgba(147,197,253,0.65)"},children:i})})]})}function cE({workflow:e,onDismiss:t}){const[n,s]=h.useState("idle"),[i,a]=h.useState(e.goal.slice(0,52)+(e.goal.length>52?"…":"")),o=async()=>{s("saving");try{const l=await $("/api/skills/save",{method:"POST",body:JSON.stringify({goal:e.goal,answer:e.answer,steps:e.steps,name:i.trim()||void 0})});if(!l.ok)throw new Error(`HTTP ${l.status}`);s("saved"),setTimeout(t,1800)}catch{s("error"),setTimeout(()=>s("idle"),3e3)}};return r.jsx(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.2},className:"mt-3",children:r.jsx("div",{className:"flex items-center gap-3 px-4 py-2.5 rounded-xl bg-orange-900/20 border border-orange-600/30",children:n==="saved"?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:13,className:"text-orange-400 shrink-0"}),r.jsx("span",{className:"text-xs font-medium text-orange-400",children:"Skill saved!"})]}):r.jsxs(r.Fragment,{children:[r.jsx(sv,{size:13,className:"text-orange-600 shrink-0"}),r.jsx("span",{className:"text-[11px] text-orange-200 shrink-0 font-medium",children:"Save as Skill:"}),r.jsx("input",{value:i,onChange:l=>a(l.target.value),onKeyDown:l=>l.key==="Enter"&&n==="idle"&&o(),placeholder:"Skill name…",className:"flex-1 bg-transparent text-[12px] text-orange-100 outline-none placeholder-orange-600/50 min-w-0"}),r.jsx("button",{onClick:o,disabled:n!=="idle",className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-orange-900/30 hover:bg-orange-900/50 border border-orange-800/40 text-orange-200 text-[11px] font-semibold transition-all shrink-0 disabled:opacity-50",children:n==="saving"?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:10,className:"animate-spin"})," Saving…"]}):n==="error"?"Retry":"Save"}),r.jsx("button",{onClick:t,className:"text-orange-700 hover:text-orange-500 transition-colors text-[11px] shrink-0",children:"✕"})]})})})}function dE({src:e,onClose:t}){const[n,s]=h.useState(!1);h.useEffect(()=>{const o=l=>{l.key==="Escape"&&t()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t]);const i=()=>{const o=document.createElement("a");o.href=e,o.download=`mustb-image-${Date.now()}.jpg`,o.click()},a=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}catch{}};return r.jsxs("div",{className:"fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-black/90 backdrop-blur-sm",onClick:t,children:[r.jsxs("div",{className:"absolute top-5 right-5 flex items-center gap-2",onClick:o=>o.stopPropagation(),children:[r.jsxs("button",{onClick:a,title:"Copy link",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/10 hover:bg-white/20 text-white/80 hover:text-white text-[12px] font-medium transition-all",children:[n?r.jsx(at,{size:14,className:"text-green-400"}):r.jsx(Os,{size:14}),n?"Copied!":"Copy"]}),r.jsxs("button",{onClick:i,title:"Download image",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-white/10 hover:bg-white/20 text-white/80 hover:text-white text-[12px] font-medium transition-all",children:[r.jsx(Ri,{size:14}),"Download"]}),r.jsx("button",{onClick:t,className:"w-9 h-9 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 text-white/80 hover:text-white transition-all",children:r.jsx(He,{size:18})})]}),r.jsx("img",{src:e,alt:"Preview",className:"max-w-[90vw] max-h-[85vh] object-contain rounded-2xl shadow-2xl",onClick:o=>o.stopPropagation()})]})}class uE extends h.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t.message??"Unknown error"}}componentDidCatch(t,n){console.error("[ChatErrorBoundary]",t,n.componentStack)}render(){return this.state.error?r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-8 text-center",children:[r.jsx("span",{className:"text-2xl",children:"⚠️"}),r.jsx("p",{className:"text-red-400 font-bold text-sm",children:"Chat render error"}),r.jsx("p",{className:"text-orange-200/70 text-xs font-mono max-w-sm break-all",children:this.state.error}),r.jsx("button",{onClick:()=>this.setState({error:null}),className:"mt-1 px-4 py-2 rounded-xl bg-orange-900/20 border border-orange-800/30 text-orange-200 text-xs font-bold hover:bg-orange-900/40 transition-all",children:"Retry"})]}):this.props.children}}const b0=[{id:"terminal",label:"Terminal",Icon:os},{id:"browser",label:"Browser",Icon:qe},{id:"image-gen",label:"Görsel Üret",Icon:fv},{id:"web-search",label:"Web Search",Icon:Zt},{id:"file-manager",label:"Files",Icon:An},{id:"code",label:"Code",Icon:Jt},{id:"screen-sense",label:"Ekranı Gör",Icon:rf}];function hE({onSend:e,onStop:t,disabled:n}){const{t:s}=gt(),[i,a]=h.useState(""),[o,l]=h.useState(!1),[c,d]=h.useState(""),[u,p]=h.useState([]),[f,m]=h.useState([]),[b,y]=h.useState(!1),v=h.useRef(null),g=h.useRef(!1),x=h.useRef(null),w=h.useRef(null),j=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition),k=()=>{const A=window.SpeechRecognition||window.webkitSpeechRecognition;if(!A)return;const T=new A;T.continuous=!0,T.interimResults=!0,T.lang="tr-TR",T.onresult=F=>{let C="",E="";for(let z=F.resultIndex;z<F.results.length;z++)F.results[z].isFinal?C+=F.results[z][0].transcript:E+=F.results[z][0].transcript;C?(a(z=>(z.trim()?z.trimEnd()+" ":"")+C.trim()),d("")):d(E)},T.onend=()=>{d(""),g.current?setTimeout(k,150):(l(!1),v.current=null)},T.onerror=F=>{F.error!=="no-speech"&&l(!1),d(""),g.current&&F.error!=="not-allowed"&&setTimeout(k,500)},v.current=T;try{T.start()}catch{}},N=()=>{var A;o?(g.current=!1,(A=v.current)==null||A.stop(),d("")):(g.current=!0,l(!0),k())},S=A=>{p(T=>[...T,...Array.from(A)])},_=A=>{const T=Array.from(A.clipboardData.files);T.length&&(A.preventDefault(),S(T))},R=A=>{A.preventDefault(),S(A.dataTransfer.files)},L=A=>p(T=>T.filter((F,C)=>C!==A));h.useEffect(()=>{if(!b)return;const A=T=>{w.current&&!w.current.contains(T.target)&&y(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[b]);const P=async()=>{try{const A=await navigator.mediaDevices.getDisplayMedia({video:!0}),T=document.createElement("video");T.srcObject=A,T.muted=!0,await new Promise(C=>{T.onloadedmetadata=()=>{T.play(),C()}}),await new Promise(C=>setTimeout(C,120));const F=document.createElement("canvas");F.width=T.videoWidth,F.height=T.videoHeight,F.getContext("2d").drawImage(T,0,0),A.getTracks().forEach(C=>C.stop()),F.toBlob(C=>{if(!C)return;const E=new File([C],`ekran-${Date.now()}.png`,{type:"image/png"});S([E]),a(z=>z.trim()?z:"Bu ekranı analiz et ve ne gördüğünü açıkla."),de.success("Ekran yakalandı — göndermek için ▶ basın.")},"image/png",.9)}catch(A){(A==null?void 0:A.name)!=="NotAllowedError"&&de.error("Ekran yakalanamadı.")}},V=A=>{if(A==="screen-sense"){P(),y(!1);return}m(T=>T.includes(A)?T.filter(F=>F!==A):[...T,A])},M=()=>{var F;const A=i.trim();if(!A||n)return;o&&(g.current=!1,(F=v.current)==null||F.stop(),d(""));const T=[...u];a(""),p([]),e(A,f.length>0?f:void 0,T.length>0?T:void 0)};h.useEffect(()=>{x.current&&(x.current.style.height="auto",x.current.style.height=`${Math.min(x.current.scrollHeight,160)}px`)},[i]),h.useEffect(()=>{const A=T=>{var C;const F=((C=T.detail)==null?void 0:C.text)??"";a(F),setTimeout(()=>{var E;return(E=x.current)==null?void 0:E.focus()},60)};return window.addEventListener("mustb:prefill",A),()=>window.removeEventListener("mustb:prefill",A)},[]);const B=o?c||s.chat.listening:"What do you want to know?";return r.jsx("div",{className:"max-w-3xl mx-auto w-full",children:r.jsxs("div",{className:"glass-input rounded-2xl flex flex-col px-4 pt-3 pb-3 gap-2.5",onPaste:_,onDrop:R,onDragOver:A=>A.preventDefault(),children:[u.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 px-1",children:u.map((A,T)=>r.jsxs("div",{className:"relative group w-12 h-12",children:[A.type.startsWith("image/")?r.jsx("img",{src:URL.createObjectURL(A),alt:A.name,className:"w-12 h-12 object-cover rounded-lg border border-orange-500/20"}):r.jsx("div",{className:"w-12 h-12 rounded-lg border border-orange-500/20 bg-orange-500/10 flex items-center justify-center",children:r.jsx(en,{size:16,className:"text-orange-400"})}),r.jsx("button",{onClick:()=>L(T),className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(He,{size:9})})]},T))}),r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsxs("div",{ref:w,className:"flex items-center gap-0.5 mb-0.5 shrink-0 relative",children:[r.jsx("button",{type:"button",onClick:()=>y(A=>!A),title:"Araçlar",className:`p-2 rounded-full transition-all ${b||f.length>0?"text-orange-400 bg-orange-500/15 border border-orange-500/25":"text-white/30 hover:text-white/70 hover:bg-white/8"}`,children:r.jsx(df,{size:16})}),r.jsx(ne,{children:b&&r.jsxs(H.div,{initial:{opacity:0,y:8,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.97},transition:{duration:.14,ease:[.22,1,.36,1]},className:"absolute bottom-full mb-2 left-0 z-50 w-52 rounded-2xl p-2 shadow-2xl",style:{background:"rgba(16,7,2,0.97)",border:"1px solid rgba(249,115,22,0.18)",backdropFilter:"blur(24px)"},children:[r.jsx("p",{className:"px-2.5 pt-1.5 pb-1 text-[9.5px] font-black uppercase tracking-[0.14em] text-orange-400/60",children:"Araçlar"}),b0.map(({id:A,label:T,Icon:F})=>{const C=f.includes(A);return r.jsxs("button",{onClick:()=>V(A),className:`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-xl transition-all text-left ${C?"bg-orange-500/15 text-orange-300":"text-white/55 hover:bg-white/6 hover:text-white/90"}`,children:[r.jsx(F,{size:13,className:C?"text-orange-400":"text-white/30"}),r.jsx("span",{className:"text-[12px] font-medium",children:T}),C&&r.jsx("span",{className:"ml-auto w-3.5 h-3.5 rounded-full bg-orange-500/30 border border-orange-500/60 flex items-center justify-center text-[8px] text-orange-300",children:"✓"})]},A)})]})}),r.jsxs("label",{className:"p-2 rounded-full cursor-pointer text-white/30 hover:text-white/70 hover:bg-white/8 transition-all",title:s.chat.attachFile,children:[r.jsx(_C,{size:16}),r.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:A=>A.target.files&&S(A.target.files)})]})]}),r.jsx("textarea",{ref:x,value:i,onChange:A=>a(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),M())},placeholder:B,disabled:n,rows:1,className:"flex-1 bg-transparent text-white/90 placeholder-white/35 text-[15px] outline-none resize-none min-h-[28px] max-h-[160px] scrollbar-hide leading-relaxed"}),r.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5 shrink-0",children:[j&&r.jsx("button",{onClick:N,title:o?"Stop dictation":"Start voice dictation (append mode)",className:`p-2 rounded-full transition-all ${o?"text-red-400 bg-red-500/15 border border-red-500/30 shadow-[0_0_10px_rgba(239,68,68,0.3)]":"text-white/40 hover:text-white/70 hover:bg-white/8"}`,children:o?r.jsx(rC,{size:17,className:"animate-pulse"}):r.jsx(Bs,{size:17})}),n?r.jsx("button",{onClick:t,title:"Durdur",className:"w-9 h-9 rounded-full flex items-center justify-center transition-all bg-red-600/80 hover:bg-red-500 text-white shadow-[0_0_12px_rgba(239,68,68,0.5)] active:scale-95",children:r.jsx(cf,{size:14})}):r.jsx("button",{onClick:M,disabled:!i.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center transition-all ${i.trim()?"bg-orange-600 hover:bg-orange-500 text-white shadow-[0_0_15px_rgba(249,115,22,0.4)] active:scale-95":"bg-white/10 text-white/25 cursor-not-allowed"}`,children:r.jsx(of,{size:16})})]})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.length>0?r.jsx("div",{className:"flex flex-wrap gap-1.5 flex-1",children:f.map(A=>{const T=b0.find(E=>E.id===A);if(!T)return null;const{Icon:F,label:C}=T;return r.jsxs("span",{className:"flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-orange-500/15 border border-orange-500/25 text-orange-300 text-[11px] font-medium",children:[r.jsx(F,{size:10}),r.jsx("span",{children:C}),r.jsx("button",{type:"button",onClick:()=>V(A),className:"ml-0.5 p-0.5 rounded-full hover:bg-orange-500/20 text-orange-400/60 hover:text-orange-300 transition-colors",children:r.jsx(He,{size:9})})]},A)})}):r.jsx("div",{className:"flex-1"}),r.jsx(eE,{})]})]})})}function Ic(e){return`mustb_chat_turns_${e}`}function fE(){const{t:e,setLocale:t}=gt(),n=h.useRef(e);h.useEffect(()=>{n.current=e},[e]);const[s]=Qk(),i=mn(),a=s.get("chat")??"default",o=h.useRef(null),[l,c]=h.useState(null),[d,u]=h.useState(null),[p,f]=h.useState(""),[m,b]=h.useState(null),[y,v]=h.useState(()=>{try{const M=localStorage.getItem(Ic(a));if(M)return JSON.parse(M)}catch{}return[]}),g=h.useRef(null),x=h.useRef(null),w=h.useRef(a),[j,k]=h.useState(!1),[N,S]=h.useState(null),_=y.some(M=>M.kind==="assistant"&&M.status==="pending");h.useEffect(()=>{w.current=a;try{const M=localStorage.getItem(Ic(a));v(M?JSON.parse(M):[])}catch{v([])}g.current=null},[a]),h.useEffect(()=>{if(a==="default"||!o.current)return;const M=o.current;o.current=null,setTimeout(()=>P(M.text,M.tools,M.files),0)},[a]),h.useEffect(()=>{const M=Be();return M.on("thought_stream",B=>{const A=g.current;if(!A)return;const T=(B.message??"").trim();T&&(T.length>200||T.includes("|")||T.includes(`
|
|
713
|
+
`)||v(F=>F.map(C=>C.id===A?{...C,thoughts:[...C.thoughts,T]}:C)))}),M.on("agentUpdate",B=>{const{type:A,...T}=B;if(A==="memorySearch")return;if(A==="planStart"){const E=`asst-${Date.now()}-${Math.random().toString(36).slice(2)}`;g.current=E,v(z=>[...z,{id:E,kind:"assistant",content:"",thoughts:[],steps:[],status:"pending",startedAt:Date.now()}]);return}if(A==="stepStart"){const E=g.current;if(!E)return;const z=T.step,W=(z==null?void 0:z.description)??Kt(T.step);v(K=>K.map(X=>X.id===E?{...X,steps:[...X.steps??[],{label:W,status:"running"}]}:X));return}if(A==="stepFinish"){const E=g.current;if(!E)return;const z=T.status==="error",W=T.step,K=(W==null?void 0:W.description)??"Step",X=T.result!==void 0?Kt(T.result):void 0,I=X&&X.length>120?X.slice(0,120)+"…":X;v(Q=>Q.map(G=>{if(G.id!==E)return G;const J=[...G.steps??[]],he=J.map(ee=>ee.status).lastIndexOf("running");he>=0&&(J[he]={label:K,status:z?"error":"done",result:I});const ce=[...G.terminals??[]],Y=ce.map(ee=>ee.status).lastIndexOf("running");return Y>=0&&(ce[Y]={...ce[Y],status:z?"error":"done"}),{...G,steps:J,...ce.length>0?{terminals:ce}:{}}}));return}if(A==="codeArtifact"){const E=g.current;if(!E)return;const z={id:`code-${Date.now()}-${Math.random().toString(36).slice(2)}`,filename:String(T.filename??"file"),lang:String(T.lang??"text"),content:String(T.content??""),op:T.op??"read"};v(W=>W.map(K=>K.id===E?{...K,codeArtifacts:[...K.codeArtifacts??[],z]}:K));return}if(A==="terminalLog"){const E=g.current;if(!E)return;const z=Kt(T.line??"");if(!z)return;v(W=>W.map(K=>{if(K.id!==E)return K;const X=[...K.terminals??[]],I=X.map(ce=>ce.status).lastIndexOf("running");if(I>=0){const ce=X[I];return ce.lines.length<200&&(X[I]={...ce,lines:[...ce.lines,z]}),{...K,terminals:X}}const Q=K.steps??[],G=Q.map(ce=>ce.status).lastIndexOf("running"),J=G>=0?Q[G].label:"shell",he={id:`term-${Date.now()}-${Math.random().toString(36).slice(2)}`,command:J,lines:[z],status:"running"};return{...K,terminals:[...X,he]}}));return}if(A==="resourceWarning"){const E=g.current;if(!E)return;const z=Kt(T.message??"⚠ Sistem Uyarısı: Yüksek kaynak kullanımı");v(W=>W.map(K=>{if(K.id!==E)return K;const X=[...K.steps??[]],I=X.map(J=>J.status).lastIndexOf("running");if(I<0)return K;const Q=X[I],G=Q.logs??[];return X[I]={...Q,logs:[...G,z]},{...K,steps:X}}));return}if(A==="finalAnswer"){const E=g.current;if(!E)return;v(z=>z.map(W=>W.id===E?{...W,content:Kt(T.answer??"Done.")}:W));return}if(A==="planFinish"){k(!1);const E=g.current;if(!E)return;const z=T.status==="failed"?"error":"done",W=T.status==="completed"?{goal:String(T.goal??""),answer:String(T.answer??""),steps:T.steps??[]}:void 0;v(K=>K.map(X=>X.id===E?{...X,status:z,...W?{workflow:W}:{}}:X)),g.current=null;return}if(A==="professionResearched"){const E=String(T.profession??"");if(!E)return;const z=n.current.chat.professionAck.replace("{profession}",E);v(W=>[...W,{id:`prof-ack-${Date.now()}`,kind:"assistant",content:z,thoughts:[],status:"done"}]);return}const F=tE(A,T);if(!F)return;const C=g.current;C&&v(E=>E.map(z=>z.id===C?{...z,thoughts:[...z.thoughts,F]}:z))}),()=>{M.off("thought_stream"),M.off("agentUpdate")}},[]),h.useEffect(()=>{var M;(M=x.current)==null||M.scrollIntoView({behavior:"smooth"})},[y]),h.useEffect(()=>{const M=async()=>{var A;const B=g.current;if(B)try{const T=await $("/api/goal/status");if(!T.ok)return;const F=await T.json();if(!F.busy||!((A=F.events)!=null&&A.length))return;for(const C of F.events)if(C.type==="stepStart"){const E=C.step,z=(E==null?void 0:E.description)??"";v(W=>W.map(K=>K.id===B?{...K,steps:[...K.steps??[],{label:z,status:"running"}]}:K))}else if(C.type==="stepFinish"){const E=C.step,z=(E==null?void 0:E.description)??"Step",W=C.result!==void 0?String(C.result).slice(0,120):void 0;v(K=>K.map(X=>{if(X.id!==B)return X;const I=[...X.steps??[]],Q=I.map(G=>G.status).lastIndexOf("running");return Q>=0&&(I[Q]={label:z,status:C.status==="error"?"error":"done",result:W}),{...X,steps:I}}))}else if(C.type==="finalAnswer"){const E=String(C.answer??"");E&&v(z=>z.map(W=>W.id===B?{...W,content:E}:W))}else if(C.type==="planFinish"){k(!1);const E=C.status==="failed"?"error":"done";v(z=>z.map(W=>W.id===B?{...W,status:E}:W)),g.current=null}}catch{}};return window.addEventListener("mustb:reconnected",M),()=>window.removeEventListener("mustb:reconnected",M)},[]),h.useEffect(()=>{const M=B=>{var C;const A=(C=B.detail)==null?void 0:C.skill;if(!A)return;const F={"web-search":"Search the web for: ","web-fetch":"Fetch and summarize this URL: ",browser:"Open the browser and navigate to: ",pdf:"Read and summarize this PDF: ","image-analysis":"Analyze this image: ","image-generate":"Generate an image of: ",tts:"Convert this text to speech: ","spawn-agent":"Spawn a new agent to: ",sessions:"List all active agent sessions",canvas:"Open the canvas workspace",git:"Run a git operation: ",gateway:"Connect to Must-b gateway node: ","file-manager":"Open the file manager",cron:"Create a scheduled task: ",messages:"Check and reply to messages","memory-add":"Save this to memory: ",contacts:"Look up contact: ",calendar:"Check my calendar for: ",automations:"Create an automation that: ","scheduled-tasks":"List all scheduled tasks",commands:"Run this command: ",nodes:"List all gateway nodes","multi-agent":"Start a multi-agent workflow to: ","chat-focus":""}[A]??`Run skill "${A}": `;window.dispatchEvent(new CustomEvent("mustb:prefill",{detail:{text:F}}))};return window.addEventListener("mustb:invoke-skill",M),()=>window.removeEventListener("mustb:invoke-skill",M)},[]),h.useEffect(()=>{if(w.current===a)try{localStorage.setItem(Ic(a),JSON.stringify(y))}catch{}},[y,a]),h.useEffect(()=>{if(!j)return;let M=null;const B=setTimeout(()=>{M=setInterval(async()=>{try{const A=await $("/api/status");if(!A.ok)return;(await A.json()).busy===!1&&(M&&(clearInterval(M),M=null),k(!1),v(F=>F.map(C=>C.status!=="pending"?C:{...C,status:C.content?"done":"error",content:C.content||"Görev tamamlandı ancak sonuç alınamadı (bağlantı koptu). Lütfen tekrar deneyin."})),g.current=null)}catch{}},5e3)},1e4);return()=>{clearTimeout(B),M&&clearInterval(M)}},[j]),h.useEffect(()=>{const M=y[y.length-1];if(!M||M.kind!=="assistant"||M.status!=="done"||!M.content)return;const B=[...y].reverse().find(T=>T.kind==="user");if(!B)return;const A=`Q: ${B.content}
|
|
714
|
+
A: ${M.content.slice(0,400)}`;fetch("/api/memory/ltm/semantic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:A,tags:["chat","autosave"]})}).catch(()=>{})},[y.length]);const R=M=>{const B=[[/\b(spanish mode|speak spanish|habla español|en español)\b/i,"es"],[/\b(french mode|speak french|en français|parle français)\b/i,"fr"],[/\b(german mode|speak german|auf deutsch|deutsch mode)\b/i,"de"],[/\b(japanese mode|speak japanese|日本語モード)\b/i,"ja"],[/\b(chinese mode|speak chinese|中文模式)\b/i,"zh"],[/\b(portuguese mode|fala português)\b/i,"pt"],[/\b(turkish mode|türkçe mode|türkçe konuş)\b/i,"tr"],[/\b(english mode|switch to english|speak english)\b/i,"en"]],A={tr:"Anlaşıldı, ayarlar kalıcı olarak güncellendi.",en:"Got it, settings updated permanently.",es:"Entendido, configuración actualizada permanentemente.",fr:"Compris, paramètres mis à jour définitivement.",de:"Verstanden, Einstellungen dauerhaft aktualisiert.",ja:"了解です。設定が永久に更新されました。",zh:"明白,设置已永久更新。",pt:"Entendido, configurações atualizadas permanentemente."};for(const[F,C]of B)if(F.test(M)){t(C);const E=A[C]??A.en;return v(z=>[...z,{id:`cfg-lang-${Date.now()}`,kind:"assistant",content:E,thoughts:[],status:"done"}]),!0}const T=[[/use\s+gpt[-\s]?4o?\b/i,"openai/gpt-4o"],[/use\s+(claude[-\s]?3\.5|claude[-\s]?sonnet|claude[-\s]?opus)\b/i,"anthropic/claude-3-5-sonnet"],[/use\s+(gemini[-\s]?flash|gemini[-\s]?pro|gemini)\b/i,"google/gemini-flash"],[/use\s+(llama[-\s]?3|llama)\b/i,"meta-llama/llama-3-70b-instruct:free"],[/use\s+mistral\b/i,"mistralai/mistral-7b-instruct:free"],[/use\s+deepseek\b/i,"deepseek/deepseek-chat"]];for(const[F,C]of T)if(F.test(M))return $("/api/settings/model",{method:"POST",body:JSON.stringify({model:C})}).catch(()=>{}),v(E=>[...E,{id:`cfg-model-${Date.now()}`,kind:"assistant",content:e.chat.settingsAck,thoughts:[],status:"done"}]),!0;return!1},L=M=>{const B=[[/\bi(?:'m| am)\s+a(?:n)?\s+(lawyer|attorney|solicitor|barrister)\b/i,"lawyer"],[/\bi(?:'m| am)\s+a(?:n)?\s+(doctor|physician|nurse|surgeon|pharmacist)\b/i,"medical"],[/\bi(?:'m| am)\s+a(?:n?)?\s+(software engineer|developer|programmer|coder)\b/i,"software-engineer"],[/\bi(?:'m| am)\s+a(?:n)?\s+(teacher|professor|educator|instructor)\b/i,"educator"],[/\bi(?:'m| am)\s+a(?:n)?\s+(accountant|auditor|financial advisor|analyst)\b/i,"finance"],[/\bi(?:'m| am)\s+a(?:n)?\s+(architect|civil engineer|structural engineer)\b/i,"engineering"],[/\bi(?:'m| am)\s+a(?:n)?\s+(designer|ux designer|graphic designer)\b/i,"designer"],[/\bi(?:'m| am)\s+a(?:n?)?\s+(data scientist|ml engineer|ai researcher)\b/i,"data-science"],[/\bben\s+bir?\s+avukat\b/i,"lawyer"],[/\bavukat(?:ım|ım)?\b/i,"lawyer"],[/\bben\s+bir?\s+doktor\b/i,"medical"],[/\bdoktor(?:um|um)?\b/i,"medical"],[/\bben\s+bir?\s+hemşire\b/i,"medical"],[/\bben\s+bir?\s+mühendis\b/i,"engineering"],[/\bmühendis(?:im|im)?\b/i,"engineering"],[/\bben\s+bir?\s+yazılımcı\b/i,"software-engineer"],[/\byazılımcı(?:yım|yım)?\b/i,"software-engineer"],[/\bben\s+bir?\s+öğretmen\b/i,"educator"],[/\böğretmen(?:im|im)?\b/i,"educator"],[/\bben\s+bir?\s+muhasebeci\b/i,"finance"],[/\bmuhasebeci(?:yim|yim)?\b/i,"finance"],[/\bben\s+bir?\s+tasarımcı\b/i,"designer"],[/\btasarımcı(?:yım|yım)?\b/i,"designer"],[/\bben\s+bir?\s+mimar\b/i,"engineering"],[/\bmimar(?:ım|ım)?\b/i,"engineering"]];for(const[A,T]of B)if(A.test(M)){$("/api/memory/profession-research",{method:"POST",body:JSON.stringify({profession:T,userMessage:M})}).catch(()=>{});break}},P=async(M,B,A)=>{if(M.startsWith("__GUIDANCE__")){const z=M.slice(12);v(W=>[...W,{id:`guidance-${Date.now()}`,kind:"assistant",content:`ℹ ${z}`,thoughts:[],status:"done"}]);return}if(R(M))return;L(M);let T=M;if(B!=null&&B.includes("image-gen")&&!M.toLowerCase().startsWith("generate")&&!M.toLowerCase().startsWith("create")&&(T=`Görsel oluştur: ${M}`),a==="default")try{const z=M.trim().split(/\s+/).slice(0,4).join(" "),W=await $("/api/chats",{method:"POST",body:JSON.stringify({title:z})});if(W.ok){const K=await W.json();o.current={text:T,tools:B,files:A},i(`/app?chat=${K.id}`);return}}catch{}if(!y.some(z=>z.kind==="user")&&a!=="default"){const z=M.trim().split(/\s+/).slice(0,4).join(" ");z&&$(`/api/chats/${a}`,{method:"PATCH",body:JSON.stringify({title:z})}).then(()=>{window.dispatchEvent(new CustomEvent("mustb:chat-renamed",{detail:{id:a,title:z}}))}).catch(()=>{})}v(z=>z.map(W=>({...W,workflow:void 0})));const C=A==null?void 0:A.filter(z=>z.type.startsWith("image/")).map(z=>URL.createObjectURL(z));v(z=>[...z,{id:`user-${Date.now()}`,kind:"user",content:M,thoughts:[],status:"done",...C!=null&&C.length?{attachments:C}:{}}]);const E={goal:T};if(B&&B.length>0&&(E.focus_tools=B),A&&A.length>0)try{E.attachments=await Promise.all(A.map(async z=>({name:z.name,type:z.type,data:await nE(z)})))}catch{}k(!0);try{await $("/api/goal",{method:"POST",body:JSON.stringify(E)})}catch{k(!1)}},V=y.length>0;return r.jsxs(uE,{children:[l&&r.jsx(dE,{src:l,onClose:()=>c(null)}),r.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[r.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide",children:V?r.jsxs("div",{className:"max-w-3xl mx-auto w-full px-5 pt-6 pb-4",children:[y.map(M=>{if(M.kind==="user"){const G=d===M.id;return r.jsx("div",{className:"flex justify-end mb-5 group/userturn",children:r.jsxs("div",{className:G?"w-full max-w-3xl flex flex-col items-end gap-2":"max-w-[78%] flex flex-col items-end gap-2",children:[M.attachments&&M.attachments.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 justify-end",children:M.attachments.map((J,he)=>r.jsxs("div",{className:"relative group w-24 h-24 shrink-0",children:[r.jsx("img",{src:J,alt:`attachment-${he}`,onClick:()=>c(J),width:96,height:96,className:"w-24 h-24 object-cover rounded-xl border border-orange-500/25 hover:opacity-90 transition-opacity duration-150 cursor-zoom-in",style:{minWidth:96,minHeight:96}}),r.jsx("button",{onClick:ce=>{ce.stopPropagation(),P("Bu görseli analiz et ve açıkla",void 0,void 0)},title:"Düzenle / Analiz Et",className:"absolute bottom-1 right-1 w-6 h-6 flex items-center justify-center rounded-full bg-black/70 hover:bg-orange-600 opacity-0 group-hover:opacity-100 transition-all duration-150 text-white",children:r.jsx(du,{size:11})})]},he))}),G?r.jsxs("div",{className:"w-full flex flex-col gap-2",children:[r.jsx("textarea",{autoFocus:!0,value:p,onChange:J=>f(J.target.value),onKeyDown:J=>{if(J.key==="Enter"&&!J.shiftKey){J.preventDefault();const he=p.trim();if(!he)return;const ce=y.findIndex(Y=>Y.id===M.id);v(Y=>Y.slice(0,ce)),u(null),setTimeout(()=>P(he),0)}J.key==="Escape"&&u(null)},rows:Math.min(8,p.split(`
|
|
715
|
+
`).length+1),className:"w-full rounded-2xl px-5 py-3 text-white text-[14px] leading-relaxed resize-none outline-none",style:{background:"rgba(25,10,2,0.85)",border:"1px solid rgba(249,115,22,0.5)",backdropFilter:"blur(12px)"}}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>u(null),className:"px-3 py-1.5 rounded-xl text-[12px] text-white/40 hover:text-white/70 border border-white/10 hover:bg-white/5 transition-all",children:"Cancel"}),r.jsx("button",{onClick:()=>{const J=p.trim();if(!J)return;const he=y.findIndex(ce=>ce.id===M.id);v(ce=>ce.slice(0,he)),u(null),setTimeout(()=>P(J),0)},className:"px-3 py-1.5 rounded-xl text-[12px] bg-orange-600 hover:bg-orange-500 text-white font-semibold transition-all",children:"Resend"})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"rounded-2xl rounded-br-sm px-5 py-3 text-white text-[14px] leading-relaxed whitespace-pre-wrap",style:{background:"rgba(25,10,2,0.72)",border:"1px solid rgba(249,115,22,0.22)",backdropFilter:"blur(12px)"},children:M.content}),r.jsxs("div",{className:"flex gap-1 opacity-0 group-hover/userturn:opacity-100 transition-opacity duration-150",children:[r.jsx("button",{onClick:()=>{navigator.clipboard.writeText(M.content).catch(()=>{}),b(M.id),setTimeout(()=>b(null),2e3)},title:"Copy message",className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[11px] text-white/30 hover:text-white/70 hover:bg-white/6 border border-white/6 transition-all",children:m===M.id?r.jsxs(r.Fragment,{children:[r.jsx(at,{size:10,className:"text-green-400"}),r.jsx("span",{className:"text-green-400",children:"Copied"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{size:10}),"Copy"]})}),r.jsxs("button",{onClick:()=>{u(M.id),f(M.content)},title:"Edit and resend",className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[11px] text-white/30 hover:text-orange-400 hover:bg-orange-500/8 border border-white/6 transition-all",children:[r.jsx(du,{size:10}),"Edit"]})]})]})]})},M.id)}const B=M.thoughts.length>0,A=M.content.length>0,T=M.status==="pending",F=M.status==="error"&&!A,C=M.steps??[],E=M.terminals??[],z=E.length>0,W=M.codeArtifacts??[],K=W.length>0,X=T?C.find(G=>G.status==="running"):null,I=C.filter(G=>G.status==="done").length,Q=C.length>0;return r.jsxs("div",{className:"mb-8",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[r.jsxs("div",{className:"relative w-5 h-5 shrink-0",children:[r.jsx("div",{className:"absolute inset-0 bg-orange-600/30 rounded-full blur-sm"}),r.jsx("img",{src:"/logo.png",alt:"Must-b",className:"w-full h-full object-contain relative z-10"})]}),r.jsx("span",{className:"text-[12px] font-semibold text-white/70 tracking-wide",children:"Must-b"}),B&&r.jsxs("span",{className:"text-[10px] text-white/35 font-mono",children:[M.thoughts.length," step",M.thoughts.length!==1?"s":""]})]}),X&&r.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{background:"rgba(0,0,0,0.22)",border:"1px solid rgba(255,255,255,0.05)"},children:[r.jsx(re,{size:10,className:"animate-spin text-orange-400/70 shrink-0"}),r.jsx("span",{className:"text-[11px] font-mono text-white/40 truncate flex-1",children:X.label}),I>0&&r.jsxs("span",{className:"text-[10px] text-white/20 font-mono shrink-0",children:[I," done"]}),r.jsx("div",{className:"ml-1 shrink-0",children:r.jsx(aE,{startedAt:M.startedAt})})]}),z&&E.map(G=>r.jsx(oE,{block:G},G.id)),K&&W.map(G=>r.jsx(lE,{block:G},G.id)),B&&r.jsxs("details",{className:"mb-3 group",style:{background:"rgba(255,255,255,0.025)",borderRadius:"10px",padding:"6px 10px"},children:[r.jsxs("summary",{className:"flex items-center gap-1.5 cursor-pointer list-none select-none w-fit",children:[r.jsx(Qt,{size:10,className:"text-orange-400/50 group-open:rotate-90 transition-transform duration-150 flex-shrink-0"}),r.jsxs("span",{className:"text-[10px] font-semibold text-orange-300/50 hover:text-orange-300/80 transition-colors tracking-wide uppercase",children:[M.thoughts.length," detail",M.thoughts.length!==1?"s":""," · Thought process"]})]}),r.jsx("div",{className:"mt-2 ml-3.5 pl-3 border-l border-orange-500/15 space-y-1",children:M.thoughts.map((G,J)=>r.jsx("p",{className:"text-[11px] font-mono text-white/30 leading-relaxed break-all",children:G},J))})]}),A?r.jsxs("div",{className:"w-full py-2",children:[r.jsx(rE,{text:M.content,dark:!0}),r.jsx("div",{className:"flex justify-end mt-3",children:r.jsx("button",{onClick:()=>{navigator.clipboard.writeText(M.content).catch(()=>{}),S(M.id),setTimeout(()=>S(null),2e3)},className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-white/30 hover:text-white/70 hover:bg-white/6 text-[11px] transition-all border border-white/6",children:N===M.id?r.jsxs(r.Fragment,{children:[r.jsx(at,{size:12,className:"text-green-400"})," Kopyalandı"]}):r.jsxs(r.Fragment,{children:[r.jsx(Os,{size:12})," Kopyala"]})})})]}):T?Q?null:r.jsxs("div",{className:"flex items-center gap-2 py-2 px-1",children:[[0,120,240].map(G=>r.jsx("div",{className:"w-1.5 h-1.5 rounded-full animate-bounce",style:{background:"rgba(251,146,60,0.7)",animationDelay:`${G}ms`}},G)),r.jsx("span",{className:"text-[11px] text-white/25 ml-1",children:"Planning…"}),r.jsx(iE,{})]}):F?r.jsxs("div",{className:"rounded-xl px-4 py-3 flex items-center gap-2",style:{background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.2)"},children:[r.jsx("span",{className:"text-red-400 text-sm",children:"⚠"}),r.jsx("p",{className:"text-sm text-red-300/80",children:"Something went wrong. Please try again."})]}):null,r.jsx(ne,{children:M.workflow&&!T&&r.jsx(cE,{workflow:M.workflow,onDismiss:()=>v(G=>G.map(J=>J.id===M.id?{...J,workflow:void 0}:J))})})]},M.id)}),r.jsx("div",{ref:x,className:"h-2"})]}):r.jsx("div",{className:"flex flex-col items-center justify-center h-full px-6 select-none",children:r.jsx(ne,{children:r.jsx(H.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-10,scale:.96},transition:{duration:.55,ease:"easeOut"},className:"flex flex-col items-center gap-4 mb-10",children:r.jsx("span",{className:"font-black tracking-tighter select-none leading-none px-2 w-full text-center",style:{fontSize:"clamp(56px, 16vw, 120px)",background:"linear-gradient(135deg, rgba(249,115,22,0.92) 0%, rgba(253,186,116,0.75) 40%, rgba(255,255,255,0.30) 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",paddingBottom:"0.05em",paddingRight:"20px"},children:"Must-b"})},"hero")})})}),r.jsxs("div",{className:"shrink-0 px-4 pb-3 pt-2",children:[r.jsx(hE,{onSend:(M,B,A)=>P(M,B,A),onStop:()=>{k(!1),$("/api/goal/abort",{method:"POST"}).catch(()=>{}),v(M=>M.map(B=>{if(B.status!=="pending")return B;const A=B.content||(B.thoughts.length>0?`⏹ Durduruldu.
|
|
716
716
|
|
|
717
717
|
**Tamamlanan adımlar:**
|
|
718
718
|
${B.thoughts.join(`
|
|
719
|
-
`)}`:"⏹ Durduruldu.");return{...B,status:"done",content:A}})),g.current=null},disabled:j||_}),r.jsx("p",{className:"text-center text-[11px] text-white/20 mt-2 select-none",children:e.chat.disclaimer})]})]})]})}function pE(){const[e,t]=h.useState(!1);return h.useEffect(()=>{const n=Be();return n.on("agentUpdate",s=>{s.type==="SCREEN_CAPTURE_START"&&t(!0),(s.type==="SCREEN_CAPTURED"||s.type==="SCREEN_CAPTURE_END")&&setTimeout(()=>t(!1),700)}),()=>{n.off("agentUpdate")}},[]),r.jsx(ne,{children:e&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},className:"fixed inset-0 z-[9999] pointer-events-none",children:[r.jsxs("div",{className:"absolute inset-0",children:[r.jsx("div",{className:"absolute top-0 left-0 w-12 h-12 border-t-2 border-l-2 border-orange-500/70"}),r.jsx("div",{className:"absolute top-0 right-0 w-12 h-12 border-t-2 border-r-2 border-orange-500/70"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-12 h-12 border-b-2 border-l-2 border-orange-500/70"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-12 h-12 border-b-2 border-r-2 border-orange-500/70"})]}),r.jsx(H.div,{className:"absolute left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-orange-500/60 to-transparent",animate:{top:["0%","100%"]},transition:{duration:1.4,repeat:1/0,ease:"linear"}}),r.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2",children:r.jsxs(H.div,{initial:{y:-10,opacity:0},animate:{y:0,opacity:1},className:"flex items-center gap-2 px-4 py-2 bg-black/80 border border-orange-500/30 rounded-full shadow-[0_0_20px_rgba(234,88,12,0.3)] backdrop-blur-xl",children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-orange-500"})]}),r.jsx(oa,{size:12,className:"text-orange-400 animate-spin"}),r.jsx("span",{className:"text-orange-300 text-xs font-semibold tracking-wide",children:"Scanning screen…"})]})})]},"scan-overlay")})}const Xa={button:"rgba(234,88,12,0.7)",input:"rgba(59,130,246,0.7)",image:"rgba(168,85,247,0.6)",unknown:"rgba(255,255,255,0.3)"},mE={browse:qe,write:en,think:Xt,exec:os},gE={running:"bg-orange-500/8 border border-orange-500/20 text-orange-300",done:"bg-green-500/5 border border-green-500/10 text-gray-500",queued:"bg-white/2 border border-white/5 text-gray-600"},xE={mouseMove:CC,mouseClick:hv,typeText:xC,visionClick:Ds},yE={mouseMove:"text-gray-500",mouseClick:"text-orange-400",typeText:"text-blue-400",visionClick:"text-purple-400"};function vE(){const{t:e}=gt(),[t,n]=h.useState(!1),[s,i]=h.useState(null),[a,o]=h.useState(null),[l,c]=h.useState(!1),d=h.useRef(null),[u,p]=h.useState(null),[f,m]=h.useState(!1),[b,v]=h.useState(()=>new Array(3).fill(null)),[y,g]=h.useState(0),[x,w]=h.useState([]),[j,k]=h.useState(null),[N,S]=h.useState([]),_=h.useRef(null),[R,L]=h.useState(!1),[P,V]=h.useState(!1);h.useEffect(()=>{if(!s||!d.current)return;const T=d.current,F=T.getContext("2d");if(!F)return;const C=new Image;C.onload=()=>{var E;if(T.width=C.width,T.height=C.height,F.drawImage(C,0,0),(E=s.elements)!=null&&E.length)for(const z of s.elements)F.strokeStyle=Xa[z.type]??Xa.unknown,F.lineWidth=Math.max(2,Math.round(C.width/400)),F.strokeRect(z.x,z.y,z.width,z.height),F.fillStyle=Xa[z.type]??Xa.unknown,F.font=`${Math.max(10,Math.round(C.width/120))}px monospace`,F.fillText(z.type,z.x+4,z.y+14)},C.src=`data:image/png;base64,${s.base64}`},[s]),h.useEffect(()=>{const T=Be(),F=C=>{if(C.type==="SCREEN_CAPTURE_START"&&n(!0),C.type==="SCREEN_CAPTURED"&&(n(!1),i({base64:C.base64,width:C.width,height:C.height,source:C.source,elements:C.elements}),L(!1),V(!1)),C.type==="workflowStart"&&(k(C.goal??null),w(C.steps??[]),L(!1),V(!1)),C.type==="workflowStep"&&C.step){const E=C.step;w(z=>z.map(W=>W.id===E.id?E:W))}if(C.type==="workflowDone"&&setTimeout(()=>{w([]),k(null)},2500),C.type==="shadowFrame"&&typeof C.slot!="number"&&(p(C.base64),m(!0),L(!1)),C.type==="shadowToggle"&&typeof C.slot!="number"&&(m(C.enabled),C.enabled||p(null)),C.type==="ghostFrame"){const E=typeof C.slot=="number"?C.slot:-1;E>=0&&E<=2&&typeof C.base64=="string"&&(v(z=>{const W=[...z];return W[E]=C.base64,W}),L(!1))}if(C.type==="ghostSlot"){const E=typeof C.slot=="number"?C.slot:-1;E>=0&&E<=2&&g(E)}if(C.type==="shadowToggle"&&typeof C.slot=="number"){const E=C.slot;E>=0&&E<=2&&!C.enabled&&v(z=>{const W=[...z];return W[E]=null,W})}if(C.type==="inputAction"){const E={id:`${Date.now()}-${Math.random()}`,action:C.action??"mouseClick",label:C.label??"",timestamp:C.timestamp??Date.now()};S(z=>[...z.slice(-11),E]),L(!1),V(!1)}};return T.on("agentUpdate",F),()=>{T.off("agentUpdate",F)}},[]),h.useEffect(()=>{var T;(T=_.current)==null||T.scrollIntoView({behavior:"smooth"})},[N]);const M=async()=>{if(!t){try{const T=await $("/api/system/vision-guidance");if(T.ok){const F=await T.json();F.warn&&F.message&&o(F.message)}}catch{}await $("/api/system/screenshot",{method:"POST",body:JSON.stringify({detect:!0})}).catch(()=>{})}},B=b.some(T=>T!==null);return!(s||x.length>0||N.length>0||t||f||B)||P?null:r.jsx(ne,{children:r.jsxs(H.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.22},className:"mx-4 mb-3 bg-[#0a0d16] border border-orange-500/12 rounded-2xl overflow-hidden shadow-xl shadow-orange-500/4 shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"w-2 h-2 rounded-full bg-orange-500 animate-pulse"}),r.jsx("span",{className:"text-[10px] font-bold text-orange-400 uppercase tracking-widest",children:"War Room"}),s&&r.jsxs("span",{className:"text-[10px] text-gray-600 font-mono",children:[s.width,"×",s.height]}),f&&r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-purple-400 bg-purple-500/10 border border-purple-500/25 px-2 py-0.5 rounded-full",children:[r.jsx(Ga,{size:9,className:"animate-pulse"}),"Shadow Active"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:M,disabled:t,className:`flex items-center gap-1 px-2.5 py-1 rounded-lg text-[11px] font-medium transition-all ${t?"text-orange-400 bg-orange-500/10 animate-pulse cursor-not-allowed":"text-gray-600 hover:text-orange-400 hover:bg-orange-500/8 border border-white/5"}`,children:[r.jsx(oa,{size:10}),t?"Scanning…":"Capture"]}),s&&r.jsx("button",{onClick:()=>c(T=>!T),className:"text-gray-700 hover:text-gray-400 transition-colors",title:l?"Collapse preview":"Expand preview",children:l?r.jsx(ef,{size:12}):r.jsx(Ds,{size:12})}),r.jsx("button",{onClick:()=>L(T=>!T),className:"text-gray-700 hover:text-gray-400 transition-colors",title:R?"Expand war room":"Collapse war room",children:R?r.jsx(qr,{size:12}):r.jsx(Ml,{size:12})}),r.jsx("button",{onClick:()=>V(!0),className:"text-gray-700 hover:text-red-400 transition-colors",title:"Dismiss war room",children:r.jsx(He,{size:12})})]})]}),r.jsx(ne,{children:!R&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:[a&&r.jsxs("div",{className:"px-4 py-2 bg-amber-500/8 border-b border-amber-500/15 flex items-start justify-between gap-2",children:[r.jsx("p",{className:"text-[11px] text-amber-400 leading-relaxed flex-1",children:a}),r.jsx("button",{onClick:()=>o(null),className:"text-[10px] text-amber-600 hover:text-amber-400 shrink-0",children:"Dismiss"})]}),r.jsxs("div",{className:"flex gap-0 divide-x divide-white/5",children:[r.jsx("div",{className:"w-1/2 shrink-0",children:B&&b[y]?r.jsxs("div",{className:"flex flex-col",children:[r.jsx("div",{className:"flex border-b border-white/5",children:[0,1,2].map(T=>b[T]!==null&&r.jsxs("button",{onClick:()=>g(T),className:`flex items-center gap-0.5 px-2 py-1 text-[9px] font-bold transition-colors ${y===T?"text-purple-400 border-b-2 border-purple-500":"text-gray-600 hover:text-gray-400"}`,children:[r.jsx(Ga,{size:7})," G",T+1]},T))}),r.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 ${l?"max-h-[300px]":"max-h-[110px]"}`,children:[r.jsx("img",{src:`data:image/jpeg;base64,${b[y]}`,alt:`Ghost ${y+1}`,className:"w-full object-contain"}),r.jsxs("div",{className:"absolute top-1.5 left-1.5 flex items-center gap-1 px-2 py-0.5 bg-black/75 rounded-lg text-[9px] font-bold text-purple-400 border border-purple-500/30",children:[r.jsx(Ga,{size:8,className:"animate-pulse"})," G",y+1]}),r.jsx("div",{className:"absolute bottom-1.5 right-1.5 px-1.5 py-0.5 bg-black/70 rounded text-[8px] font-mono text-purple-300 border border-purple-500/20",children:"LIVE"})]})]}):f&&u?r.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 ${l?"max-h-[300px]":"max-h-[120px]"}`,children:[r.jsx("img",{src:`data:image/jpeg;base64,${u}`,alt:"Shadow browser",className:"w-full object-contain"}),r.jsxs("div",{className:"absolute top-1.5 left-1.5 flex items-center gap-1 px-2 py-0.5 bg-black/75 rounded-lg text-[9px] font-bold text-purple-400 border border-purple-500/30",children:[r.jsx(Ga,{size:8,className:"animate-pulse"})," SHADOW"]}),r.jsx("div",{className:"absolute bottom-1.5 right-1.5 px-1.5 py-0.5 bg-black/70 rounded text-[8px] font-mono text-purple-300 border border-purple-500/20",children:"LIVE"})]}):s?r.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 ${l?"max-h-[300px]":"max-h-[120px]"}`,children:[r.jsx("canvas",{ref:d,className:"w-full object-contain",style:{imageRendering:"auto"}}),s.elements&&s.elements.length>0&&r.jsxs("div",{className:"absolute bottom-1.5 right-1.5 px-2 py-0.5 bg-black/70 rounded text-[9px] font-mono text-orange-400 border border-orange-500/20",children:[s.elements.length," elements"]})]}):t?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-orange-400 text-xs animate-pulse",children:[r.jsx(oa,{size:13,className:"animate-spin"})," Scanning…"]}):r.jsx("div",{className:"flex items-center justify-center py-8 text-gray-700 text-[11px]",children:"No capture yet"})}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[x.length>0&&r.jsxs("div",{className:"border-b border-white/5",children:[j&&r.jsx("div",{className:"px-3 py-1.5 border-b border-white/4 bg-white/[0.01]",children:r.jsxs("p",{className:"text-[10px] text-gray-500 truncate",children:[e.workflow.goal,": ",r.jsx("span",{className:"text-gray-300",children:j})]})}),r.jsx("div",{className:"p-2 space-y-1 max-h-[100px] overflow-y-auto scrollbar-hide",children:x.map(T=>{const F=mE[T.type]??Xt;return r.jsxs("div",{className:`flex items-center gap-2 px-2.5 py-1.5 rounded-xl text-[11px] font-medium ${gE[T.status]}`,children:[T.status==="running"?r.jsx(re,{size:11,className:"animate-spin text-orange-400 shrink-0"}):T.status==="done"?r.jsx(Fe,{size:11,className:"text-green-500 shrink-0"}):r.jsx(F,{size:11,className:"text-gray-600 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:T.label})]},T.id)})})]}),N.length>0&&r.jsxs("div",{className:"flex-1 overflow-hidden",children:[r.jsx("div",{className:"px-3 py-1 border-b border-white/4",children:r.jsx("span",{className:"text-[9px] font-bold text-gray-600 uppercase tracking-widest",children:"Control Feed"})}),r.jsxs("div",{className:"px-2 py-1 space-y-px overflow-y-auto max-h-[100px] scrollbar-hide font-mono",children:[N.map(T=>{const F=xE[T.action]??hv,C=yE[T.action]??"text-gray-500";return r.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[r.jsx(F,{size:10,className:`${C} shrink-0`}),r.jsx("span",{className:`text-[10px] ${C} truncate flex-1`,children:T.label}),r.jsx("span",{className:"text-[9px] text-gray-700 shrink-0 tabular-nums",children:new Date(T.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]},T.id)}),r.jsx("div",{ref:_})]})]})]})]})]})})]})})}const w0="mustb_briefing_shown",bE=14*60*60*1e3,yu={CodeHealth:{label:"Kod Sağlığı",Icon:Jt,color:"#fb923c"},DepAudit:{label:"Bağımlılık Denetimi",Icon:Hs,color:"#a78bfa"},LogAnalysis:{label:"Log Analizi",Icon:en,color:"#38bdf8"},LTMGap:{label:"Bellek Boşluğu",Icon:Xt,color:"#34d399"},WorkspaceDiff:{label:"Değişiklik Özeti",Icon:ov,color:"#fbbf24"}};function wE(e){const t=Object.keys(yu).find(n=>e.toLowerCase().includes(n.toLowerCase()));return t?yu[t]:{label:e,Icon:Ll,color:"#fb923c"}}function kE(e){const t=new Set(["NightShift-Insights","nightshift-insights","nightshift","night-shift"]);return e.find(n=>!t.has(n))??"General"}function k0(e){if(!e)return"—";const t=Math.round(e/1e3);return t<60?`${t} sn`:`${Math.floor(t/60)} dk ${t%60} sn`}function jE(e){const t=Date.now()-e,n=Math.floor(t/36e5),s=Math.floor(t%36e5/6e4);return n>0?`${n} saat ${s} dk önce`:s>0?`${s} dk önce`:"Az önce"}const NE={hidden:{opacity:0},show:{opacity:1,transition:{duration:.4}},exit:{opacity:0,transition:{duration:.35}}},SE={hidden:{opacity:0,y:32,scale:.97},show:{opacity:1,y:0,scale:1,transition:{type:"spring",stiffness:260,damping:26}},exit:{opacity:0,y:20,scale:.97,transition:{duration:.25}}},CE={hidden:{},show:{transition:{staggerChildren:.11,delayChildren:.45}}},EE={hidden:{opacity:0,x:24},show:{opacity:1,x:0,transition:{type:"spring",stiffness:300,damping:28}}};function _E(){const[e,t]=h.useState(!1),[n,s]=h.useState(null),[i,a]=h.useState([]),[o,l]=h.useState(!0),c=h.useRef(!1);h.useEffect(()=>{c.current||(c.current=!0,(async()=>{try{const u=await $("/api/automation/nightowl/status");if(!u.ok)return;const p=await u.json();if(!p.lastShiftTs||Date.now()-p.lastShiftTs>bE||localStorage.getItem(w0)===String(p.lastShiftTs)||p.totalFindings===0)return;const f=await $("/api/memory/ltm/search?q=NightShift-Insights&limit=15&category=semantic"),b=(f.ok?await f.json():{results:[]}).results.filter(v=>v.tags.some(y=>y.toLowerCase().includes("nightshift"))).slice(0,8).map(v=>({task:kE(v.tags),summary:v.content.replace(/\n/g," ").slice(0,180)}));s(p),a(b),l(!1),t(!0),localStorage.setItem(w0,String(p.lastShiftTs))}catch{}})())},[]);const d=()=>t(!1);return r.jsx(ne,{children:e&&r.jsx(H.div,{variants:NE,initial:"hidden",animate:"show",exit:"exit",className:"fixed inset-0 z-[400] flex items-center justify-center px-4",style:{background:"rgba(4,1,0,0.82)",backdropFilter:"blur(8px)"},onClick:u=>{u.target===u.currentTarget&&d()},children:r.jsxs(H.div,{variants:SE,initial:"hidden",animate:"show",exit:"exit",className:"relative w-full max-w-[620px] max-h-[88vh] flex flex-col rounded-3xl overflow-hidden",style:{background:"rgba(14,6,1,0.92)",border:"1px solid rgba(249,115,22,0.22)",backdropFilter:"blur(32px)",boxShadow:"0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(249,115,22,0.08), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsx("button",{onClick:d,className:"absolute top-4 right-4 z-10 w-7 h-7 rounded-full flex items-center justify-center text-white/25 hover:text-white/70 hover:bg-white/8 transition-all",children:r.jsx(He,{size:14})}),r.jsxs("div",{className:"flex-shrink-0 px-8 pt-8 pb-6",style:{borderBottom:"1px solid rgba(249,115,22,0.10)"},children:[r.jsxs(H.div,{initial:{opacity:0,y:-12},animate:{opacity:1,y:0},transition:{delay:.1,duration:.5},className:"flex items-start gap-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.25)",boxShadow:"0 0 24px rgba(249,115,22,0.15)"},children:r.jsx(Rl,{size:22,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-semibold text-orange-400/60 tracking-widest uppercase mb-1",children:"Sabah Raporu"}),r.jsx("h2",{className:"text-[22px] font-black text-white/90 leading-tight tracking-tight",children:"Gece Vardiyası Tamamlandı"}),(n==null?void 0:n.lastShiftTs)&&r.jsxs("p",{className:"text-[12px] text-white/35 mt-1",children:[jE(n.lastShiftTs)," · ",k0(n.lastShiftMs)," sürdü"]})]})]}),n&&r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"flex items-center gap-4 mt-5",children:[{label:"Bulgu",value:String(n.totalFindings)},{label:"Görev",value:String(Object.keys(yu).length)},{label:"Süre",value:k0(n.lastShiftMs)}].map(u=>r.jsxs("div",{className:"flex-1 rounded-xl px-3 py-2.5 text-center",style:{background:"rgba(249,115,22,0.06)",border:"1px solid rgba(249,115,22,0.12)"},children:[r.jsx("p",{className:"text-[18px] font-black text-orange-400",children:u.value}),r.jsx("p",{className:"text-[10px] text-white/30 font-medium mt-0.5",children:u.label})]},u.label))})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-5 space-y-2.5",style:{scrollbarWidth:"none"},children:[o&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"flex gap-1.5",children:[0,1,2].map(u=>r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-400/40 animate-bounce",style:{animationDelay:`${u*.15}s`}},u))})}),!o&&i.length===0&&r.jsx("p",{className:"text-center text-[13px] text-white/30 py-10",children:"Kayıtlı bulgu bulunamadı."}),!o&&i.length>0&&r.jsx(H.div,{variants:CE,initial:"hidden",animate:"show",className:"space-y-2.5",children:i.map((u,p)=>{const f=wE(u.task),m=f.Icon;return r.jsx(H.div,{variants:EE,children:r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-2xl",style:{background:"rgba(255,255,255,0.03)",border:`1px solid ${f.color}22`},children:[r.jsx("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:`${f.color}15`,border:`1px solid ${f.color}30`},children:r.jsx(m,{size:14,style:{color:f.color}})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[11px] font-bold mb-1 tracking-wide",style:{color:f.color},children:f.label}),r.jsx("p",{className:"text-[12.5px] text-white/65 leading-relaxed",children:u.summary})]}),r.jsx(Qt,{size:13,className:"text-white/15 flex-shrink-0 mt-1"})]})},p)})})]}),r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.6},className:"flex-shrink-0 px-8 py-5",style:{borderTop:"1px solid rgba(249,115,22,0.10)"},children:r.jsxs("button",{onClick:d,className:"w-full py-3 rounded-2xl flex items-center justify-center gap-2 font-bold text-[14px] transition-all active:scale-[0.98]",style:{background:"rgba(249,115,22,0.15)",border:"1px solid rgba(249,115,22,0.30)",color:"#fdba74"},onMouseEnter:u=>u.currentTarget.style.background="rgba(249,115,22,0.22)",onMouseLeave:u=>u.currentTarget.style.background="rgba(249,115,22,0.15)",children:[r.jsx(Oe,{size:15}),"Günün başlasın"]})})]})},"morning-briefing-overlay")})}const j0={CodeHealth:{label:"Kod Sağlığı",Icon:Jt,color:"#fb923c"},DepAudit:{label:"Bağımlılık",Icon:Hs,color:"#a78bfa"},LogAnalysis:{label:"Log Analizi",Icon:en,color:"#38bdf8"},LTMGap:{label:"Bellek",Icon:Xt,color:"#34d399"},WorkspaceDiff:{label:"Değişiklikler",Icon:ov,color:"#fbbf24"}};function TE(e){const t=Object.keys(j0).find(n=>e.toLowerCase().includes(n.toLowerCase()));return t?j0[t]:{label:e,Icon:Ll,color:"#fb923c"}}function PE(e){const t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}const AE={hidden:{opacity:0,x:24,scale:.96},show:{opacity:1,x:0,scale:1,transition:{type:"spring",stiffness:320,damping:28}},exit:{opacity:0,x:24,scale:.96,transition:{duration:.22}}},ME={hidden:{opacity:0,y:-6},show:{opacity:1,y:0,transition:{duration:.22}}};function RE(){const[e,t]=h.useState("idle"),[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState(!1),[c,d]=h.useState(!1),u=h.useRef(null),p=h.useRef(0),f=h.useCallback((b=2e4)=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{l(!1),setTimeout(()=>d(!1),600)},b)},[]);if(h.useEffect(()=>{const b=Be();return b.on("nightOwlEvent",v=>{if(v.type==="shiftStart"){u.current&&clearTimeout(u.current),t("scanning"),s([]),a(null),d(!0),l(!0);return}if(v.type==="finding"){const y={id:`${++p.current}`,task:String(v.task??"General"),summary:String(v.summary??"").slice(0,120),ts:Number(v.ts??Date.now())};s(g=>[y,...g].slice(0,20));return}if(v.type==="shiftEnd"){t("done"),a({findingsCount:Number(v.findingsCount??0),durationMs:Number(v.durationMs??0),ts:Number(v.ts??Date.now())}),f(2e4);return}}),()=>{b.off("nightOwlEvent"),u.current&&clearTimeout(u.current)}},[f]),!c)return null;const m="#fb923c";return r.jsx(ne,{children:r.jsx(H.div,{variants:AE,initial:"hidden",animate:"show",exit:"exit",className:"fixed z-[130] flex flex-col",style:{top:"80px",right:"20px",width:"300px",maxHeight:"70vh",pointerEvents:"auto"},children:r.jsxs("div",{className:"rounded-2xl overflow-hidden flex flex-col",style:{background:"rgba(10,4,1,0.90)",border:`1px solid ${m}28`,backdropFilter:"blur(24px)",boxShadow:"0 12px 40px rgba(0,0,0,0.60), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsxs("button",{onClick:()=>{l(b=>!b),u.current&&clearTimeout(u.current)},className:"flex items-center justify-between px-4 py-3 w-full select-none",style:{borderBottom:o?`1px solid ${m}10`:"none"},children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[e==="scanning"?r.jsxs("span",{className:"relative flex-shrink-0",children:[r.jsx("span",{className:"block w-2 h-2 rounded-full bg-orange-400"}),r.jsx("span",{className:"absolute inset-0 rounded-full bg-orange-400 animate-ping opacity-70"})]}):e==="done"?r.jsx(Fe,{size:13,className:"text-green-400 flex-shrink-0"}):r.jsx(Rl,{size:13,className:"text-orange-300/50 flex-shrink-0"}),r.jsx("span",{className:"text-[12px] font-semibold text-white/75",children:e==="scanning"?"Gece Vardiyası":"Vardiya Logu"}),e==="scanning"&&r.jsx("span",{className:"text-[10px] text-orange-400/70 font-mono animate-pulse",children:"taranıyor…"}),e==="done"&&i&&r.jsxs("span",{className:"text-[10px] text-white/30 font-mono",children:[i.findingsCount," bulgu · ",PE(i.durationMs)]})]}),o?r.jsx(Ml,{size:12,className:"text-white/25"}):r.jsx(qr,{size:12,className:"text-white/25"})]}),r.jsx(ne,{children:o&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22},className:"overflow-hidden",children:[r.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:"52vh",scrollbarWidth:"none"},children:[e==="scanning"&&n.length===0&&r.jsxs("div",{className:"flex items-center justify-center py-8 gap-2",children:[r.jsx("div",{className:"flex gap-1",children:[0,1,2].map(b=>r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-400/50 animate-bounce",style:{animationDelay:`${b*.15}s`}},b))}),r.jsx("span",{className:"text-[11px] text-white/30",children:"Sistem analiz ediliyor…"})]}),r.jsx(ne,{initial:!1,children:n.map(b=>{const v=TE(b.task),y=v.Icon;return r.jsxs(H.div,{variants:ME,initial:"hidden",animate:"show",exit:{opacity:0,height:0},className:"flex items-start gap-3 px-4 py-3",style:{borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[r.jsx("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:`${v.color}15`,border:`1px solid ${v.color}30`},children:r.jsx(y,{size:11,style:{color:v.color}})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[10px] font-bold mb-0.5",style:{color:v.color},children:v.label}),r.jsx("p",{className:"text-[11px] text-white/50 leading-snug line-clamp-3",children:b.summary})]})]},b.id)})}),e==="done"&&n.length===0&&r.jsx("p",{className:"text-center text-[12px] text-white/25 py-8",children:"Kayda değer bulgu yok."})]}),e==="done"&&i&&r.jsxs("div",{className:"px-4 py-2.5 flex items-center justify-between",style:{borderTop:`1px solid ${m}10`},children:[r.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:new Date(i.ts).toLocaleTimeString("tr-TR")}),r.jsx("span",{className:"text-[10px] text-green-400/70 font-semibold",children:"✓ Tamamlandı"})]})]},"log-body")})]})},"night-shift-log")})}const N0="mustb_boot_report",S0=14e3;function zE({value:e,max:t=10}){const n=Math.round(e/t*100),s=n>=70?"#22c55e":n>=40?"#f97316":"#ef4444";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.08)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${n}%`,background:s}})}),r.jsx("span",{className:"text-[11px] font-mono",style:{color:s},children:e.toFixed(1)})]})}function LE(){const[e,t]=h.useState(!1),[n,s]=h.useState(null),i=h.useCallback(()=>{t(!1),localStorage.removeItem(N0)},[]);return h.useEffect(()=>{if(localStorage.getItem(N0)!=="1")return;t(!0),$("/api/status").then(o=>o.ok?o.json():null).then(o=>{o&&s(o)}).catch(()=>{});const a=setTimeout(i,S0);return()=>clearTimeout(a)},[i]),r.jsx(ne,{children:e&&r.jsx(H.div,{initial:{opacity:0,scale:.96,y:16},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:16},transition:{duration:.28,ease:"easeOut"},className:"fixed inset-0 z-[500] flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.55)",backdropFilter:"blur(8px)"},children:r.jsxs("div",{className:"relative w-full max-w-sm rounded-2xl overflow-hidden",style:{background:"rgba(14,6,2,0.92)",border:"1px solid rgba(234,88,12,0.30)",boxShadow:"0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(234,88,12,0.10)",backdropFilter:"blur(24px)"},children:[r.jsx("button",{onClick:i,className:"absolute top-3 right-3 text-white/25 hover:text-white/60 transition-colors z-10",children:r.jsx(He,{size:14})}),r.jsxs("div",{className:"px-5 pt-5 pb-3 flex items-center gap-3",children:[r.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(234,88,12,0.15)",border:"1px solid rgba(234,88,12,0.25)"},children:r.jsx(Fe,{size:18,style:{color:"#22c55e"}})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90",children:"System Ready"}),r.jsx("p",{className:"text-[11px] text-white/40",children:"Must-b initialised successfully"})]})]}),r.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.05)",margin:"0 20px"}}),r.jsxs("div",{className:"px-5 py-4 space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"rounded-xl px-3 py-2.5",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-white/30 mb-1",children:"Agent"}),r.jsx("p",{className:"text-[12px] font-semibold text-white/80 truncate",children:(n==null?void 0:n.role)??"—"})]}),r.jsxs("div",{className:"rounded-xl px-3 py-2.5",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-white/30 mb-1",children:"Model"}),r.jsx("p",{className:"text-[12px] font-semibold text-white/80 truncate",children:(n==null?void 0:n.model)??"—"})]})]}),r.jsxs("div",{className:"rounded-xl px-3 py-2.5 space-y-2",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-semibold text-white/40",children:[r.jsx(fn,{size:10})," CPU"]}),r.jsxs("span",{className:"text-[10px] font-mono text-white/50",children:[(n==null?void 0:n.cpuPct)??0,"%"]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-semibold text-white/40",children:[r.jsx(uv,{size:10})," RAM"]}),r.jsxs("span",{className:"text-[10px] font-mono text-white/50",children:[((n==null?void 0:n.ramGb)??0).toFixed(2)," GB"]})]}),n&&r.jsxs("div",{className:"flex items-center justify-between pt-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-semibold text-white/40",children:[r.jsx(Oe,{size:10})," Score"]}),r.jsx(zE,{value:n.score})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1",children:[r.jsx("span",{className:"text-[10px] text-white/30",children:"Dashboard port"}),r.jsxs("span",{className:"text-[11px] font-mono text-orange-400/70",children:[":",(n==null?void 0:n.port)??4309]})]})]}),r.jsx("div",{className:"px-5 pb-4",style:{borderTop:"1px solid rgba(255,255,255,0.05)",paddingTop:"12px"},children:r.jsx("button",{onClick:i,className:"w-full py-2 rounded-xl text-[12px] font-semibold transition-all",style:{background:"rgba(234,88,12,0.15)",border:"1px solid rgba(234,88,12,0.30)",color:"#fb923c"},children:"Open Dashboard"})}),r.jsx(H.div,{initial:{scaleX:1},animate:{scaleX:0},transition:{duration:S0/1e3,ease:"linear"},style:{position:"absolute",bottom:0,left:0,right:0,height:2,background:"rgba(234,88,12,0.50)",transformOrigin:"left"}})]})},"boot-report")})}function OE(e,t){if(t.includes("🛡")||t.toLowerCase().includes("ghostguard"))return"#fb923c";switch(e){case"thought":return"#22d3ee";case"planStart":return"#67e8f9";case"planGenerated":return"#a5f3fc";case"stepStart":return"#06b6d4";case"stepFinish":return t.includes("error")||t.includes("fail")?"#f87171":"#4ade80";case"finalAnswer":return"#86efac";case"planFinish":return t.includes("failed")||t.includes("error")?"#f87171":"#4ade80";case"error":return"#fb923c";case"memorySearch":return"#a78bfa";case"systemHealth":return"#fbbf24";default:return"#4b5563"}}function DE(e){switch(e){case"thought":return"◎";case"planStart":return"▶";case"planGenerated":return"◈";case"stepStart":return"→";case"stepFinish":return"✓";case"finalAnswer":return"◆";case"planFinish":return"■";case"error":return"⚠";case"memorySearch":return"⟳";case"systemHealth":return"🛡";default:return"·"}}function IE(e,t){var n,s;if(!t)return e;switch(e){case"thought":return String(t.message??t).slice(0,120);case"planStart":return`Goal: ${String(t.goal??"").slice(0,90)}`;case"planGenerated":return`Plan ready — ${Array.isArray(t.steps)?t.steps.length:"?"} steps`;case"stepStart":return String(((n=t.step)==null?void 0:n.description)??t.description??"Step starting…").slice(0,100);case"stepFinish":{const i=String(((s=t.step)==null?void 0:s.description)??t.description??"").slice(0,70),a=String(t.status??"");return`${i} [${a}]`}case"finalAnswer":return String(t.answer??"").slice(0,110);case"planFinish":return`${String(t.status??"")} — ${String(t.goal??"").slice(0,60)}`;case"error":return`Repair: ${String(t.action??"")} — ${String(t.reason??"")}`.slice(0,110);case"memorySearch":return t.active?"Searching memory…":"Memory search done";case"systemHealth":return`${String(t.level??"").toUpperCase()} — ${String(t.message??"")}`.slice(0,100);default:return JSON.stringify(t).slice(0,90)}}const C0=200;function BE(e){return new Date(e).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function FE(){const[e,t]=h.useState(!0),[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState(!0),c=h.useRef(null),d=h.useRef(0),u=h.useRef(0);h.useEffect(()=>{o&&c.current&&(c.current.scrollTop=c.current.scrollHeight)},[n,o]);const p=h.useCallback((f,m)=>{const b=IE(f,m),v=OE(f,b);s(y=>{const g=[...y,{id:`t-${++d.current}`,type:f,text:b,color:v,ts:Date.now()}];return g.length>C0?g.slice(-C0):g})},[]);return h.useEffect(()=>{const f=Be(),m=v=>{p(v.type,v.payload)},b=v=>{a(v);const y=Date.now();(v.cpu>80||v.ram>85)&&y-u.current>1e4&&(u.current=y,p("systemHealth",{level:"warning",message:`🛡️ GhostGuard: CPU ${v.cpu}% / RAM ${v.ram}%`}))};return f.on("telemetry:stream",m),f.on("systemStats",b),()=>{f.off("telemetry:stream",m),f.off("systemStats",b)}},[p]),r.jsxs(r.Fragment,{children:[r.jsx(ne,{children:!e&&r.jsxs(H.button,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.18},onClick:()=>t(!0),title:"Open telemetry",className:"fixed right-0 top-1/2 -translate-y-1/2 z-50 flex flex-col items-center justify-center gap-1 w-6 h-16 rounded-l-md border border-r-0 border-white/10 hover:border-cyan-500/40 hover:bg-cyan-400/5 transition-all duration-200 group",style:{background:"#0c0d10"},children:[r.jsx(nv,{size:11,className:"text-cyan-500/50 group-hover:text-cyan-400 transition-colors"}),r.jsx("span",{className:"font-mono text-[7px] leading-none text-white/20 group-hover:text-cyan-400/60 transition-colors",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:"TEL"})]},"fab")}),r.jsx("div",{className:`relative z-50 flex-shrink-0 flex flex-col transition-[width] duration-300 overflow-hidden${e?" border-l border-white/5":""}`,style:{background:"#0c0d10",width:e?288:0},children:r.jsx(ne,{children:e&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex flex-col flex-1 min-h-0 overflow-hidden",style:{width:288},children:[r.jsxs("div",{className:"flex items-center justify-between px-2.5 py-1.5 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cyan-500"})]}),r.jsx("span",{className:"font-mono text-[9px] font-bold text-cyan-400 tracking-[0.2em] uppercase",children:"Live"}),r.jsxs("span",{className:"font-mono text-[9px] text-white/15",children:[n.length," events"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[i&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:`font-mono text-[9px] ${i.cpu>80?"text-orange-400":"text-white/25"}`,children:["CPU ",i.cpu,"%"]}),r.jsxs("span",{className:`font-mono text-[9px] ${i.ram>85?"text-orange-400":"text-white/25"}`,children:["RAM ",i.ram,"%"]})]}),r.jsx("button",{onClick:()=>s([]),title:"Clear log",className:"text-white/15 hover:text-white/40 transition-colors",children:r.jsx(ms,{size:10})}),r.jsx("button",{onClick:()=>t(!1),title:"Collapse telemetry",className:"text-white/15 hover:text-orange-400/70 transition-colors",children:r.jsx(Qt,{size:10})})]})]}),r.jsx("div",{ref:c,className:"flex-1 overflow-y-auto scrollbar-hide px-2 py-1",onMouseEnter:()=>l(!1),onMouseLeave:()=>l(!0),children:n.length===0?r.jsx("div",{className:"flex items-center justify-center h-12 font-mono text-[10px] text-white/10",children:"awaiting events…"}):r.jsx(ne,{initial:!1,children:n.map(f=>r.jsxs(H.div,{initial:{opacity:0,x:6},animate:{opacity:1,x:0},transition:{duration:.12},className:"flex items-start gap-1.5 py-[2px] group",children:[r.jsx("span",{className:"font-mono text-[8px] text-white/10 shrink-0 mt-[2px] group-hover:text-white/20 transition-colors",children:BE(f.ts)}),r.jsxs("span",{className:"font-mono text-[10px] leading-[1.45] break-all",style:{color:f.color},children:[DE(f.type)," ",f.text]})]},f.id))})})]},"panel")})})]})}function E0(){return h.useEffect(()=>{Be()},[]),r.jsxs("div",{className:"flex flex-col h-[calc(100vh-72px)] overflow-hidden",children:[r.jsx(pE,{}),r.jsx(vE,{}),r.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[r.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:r.jsx(fE,{})}),r.jsx(FE,{})]}),r.jsx(LE,{}),r.jsx(_E,{}),r.jsx(RE,{})]})}function wa(){const[e,t]=h.useState(!1),[n,s]=h.useState(!0),i=h.useRef(!0),a=h.useCallback(async()=>{try{const o=await $("/api/gateway/status",{},{retries:1,retryDelay:500});if(!i.current)return;const l=await o.json().catch(()=>({}));t(!!(l!=null&&l.online))}catch{i.current&&t(!1)}finally{i.current&&s(!1)}},[]);return h.useEffect(()=>{i.current=!0,a();const o=setInterval(a,15e3),l=()=>{a()},c=()=>{a()},d=()=>{i.current&&t(!1)};try{Be()}catch{}return window.addEventListener("mustb:connected",l),window.addEventListener("mustb:reconnected",c),window.addEventListener("mustb:disconnected",d),()=>{i.current=!1,clearInterval(o),window.removeEventListener("mustb:connected",l),window.removeEventListener("mustb:reconnected",c),window.removeEventListener("mustb:disconnected",d)}},[a]),{online:e,loading:n}}function _0({connected:e,configured:t}){return e?r.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400 flex-shrink-0"}):t?r.jsx("span",{className:"w-2 h-2 rounded-full bg-orange-400 flex-shrink-0"}):r.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-600 flex-shrink-0"})}function VE(){const{online:e}=wa(),[t,n]=h.useState(null),[s,i]=h.useState([]),[a,o]=h.useState(null),[l,c]=h.useState(null),[d,u]=h.useState(!0);h.useEffect(()=>{(async()=>{var g;u(!0);try{const w=await(await $("/api/gateway/channels")).json();n(w),(g=w.channelOrder)!=null&&g.length&&o(w.channelOrder[0])}catch{n({offline:!0,channelOrder:[],channelLabels:{},channelAccounts:{}})}finally{u(!1)}})()},[e]),h.useEffect(()=>{t!=null&&t.offline&&$("/api/channels").then(y=>y.json()).then(i).catch(()=>i([]))},[t==null?void 0:t.offline]);const p=async(y,g)=>{c(`${y}-${g}`);try{await $(`/api/gateway/channels/${y}/logout`,{method:"POST",body:JSON.stringify({accountId:g})});const x=await $("/api/gateway/channels");n(await x.json())}catch{}finally{c(null)}};if(d)return r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(fe,{size:18,className:"animate-spin text-orange-400"}),r.jsx("span",{className:"ml-2 text-sm text-gray-500",children:"Kanallar yükleniyor…"})]});if(t!=null&&t.offline)return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-xl bg-orange-500/8 border border-orange-500/20",children:[r.jsx(Ks,{size:14,className:"text-orange-400 flex-shrink-0"}),r.jsx("p",{className:"text-[12px] text-orange-300",children:"Must-b gateway çevrimdışı — yerel kanallar gösteriliyor."})]}),s.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-6",children:"Yapılandırılmış kanal yok."}):r.jsx("div",{className:"grid grid-cols-2 gap-2",children:s.map(y=>r.jsxs("div",{className:"px-3 py-2.5 rounded-xl bg-white/3 border border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(_0,{configured:y.configured,connected:!1}),r.jsx("span",{className:"text-[13px] font-semibold text-gray-200",children:y.name}),y.configured&&r.jsx("span",{className:"ml-auto text-[9px] font-bold px-1.5 py-0.5 rounded-md bg-orange-500/10 border border-orange-500/20 text-orange-400",children:"Yapılandırıldı"})]}),r.jsx("p",{className:"text-[11px] text-gray-500 line-clamp-2",children:y.description})]},y.id))})]});const f=(t==null?void 0:t.channelOrder)??[],m=(t==null?void 0:t.channelLabels)??{},b=(t==null?void 0:t.channelAccounts)??{};if(f.length===0)return r.jsx("p",{className:"text-center text-sm text-gray-600 py-8",children:"Yapılandırılmış kanal bulunamadı."});const v=a?b[a]??[]:[];return r.jsxs("div",{className:"flex gap-4 min-h-[320px]",children:[r.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:f.map(y=>{const g=b[y]??[],x=g.some(j=>j.connected),w=g.some(j=>j.configured);return r.jsx("button",{onClick:()=>o(y),className:`w-full text-left px-3 py-2 rounded-xl border transition-all ${a===y?"bg-orange-500/12 border-orange-500/30":"bg-white/3 border-white/6 hover:bg-white/5 hover:border-white/12"}`,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_0,{connected:x,configured:w}),r.jsx("span",{className:"text-[12px] font-semibold text-gray-200 truncate",children:m[y]??y}),g.length>0&&r.jsx("span",{className:"ml-auto text-[10px] font-bold text-gray-500",children:g.length})]})},y)})}),r.jsx("div",{className:"flex-1 min-w-0",children:a?v.length===0?r.jsxs("div",{className:"px-4 py-4 rounded-xl bg-white/3 border border-white/6",children:[r.jsx("p",{className:"text-[13px] font-semibold text-gray-300 mb-1",children:m[a]??a}),r.jsx("p",{className:"text-[12px] text-gray-500",children:"Henüz bağlı hesap yok."})]}):r.jsx("div",{className:"space-y-2",children:v.map(y=>r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/3 border border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[y.connected?r.jsx(Fe,{size:13,className:"text-green-400 flex-shrink-0"}):y.lastError?r.jsx(iv,{size:13,className:"text-red-400 flex-shrink-0"}):r.jsx(ls,{size:13,className:"text-orange-400 flex-shrink-0"}),r.jsx("span",{className:"text-[13px] font-semibold text-gray-200 truncate",children:y.name??y.accountId}),r.jsxs("button",{onClick:()=>p(a,y.accountId),disabled:l===`${a}-${y.accountId}`,className:"ml-auto flex items-center gap-1 px-2 py-1 rounded-lg bg-red-500/8 border border-red-500/20 text-red-400 text-[10px] font-semibold hover:bg-red-500/15 transition-all disabled:opacity-40",children:[r.jsx(nf,{size:9}),"Logout"]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-20 flex-shrink-0",children:"Status"}),r.jsx("span",{className:`text-[11px] font-semibold ${y.connected?"text-green-400":"text-gray-500"}`,children:y.connected?"Connected":"Disconnected"})]}),y.lastConnectedAt&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-20 flex-shrink-0",children:"Last seen"}),r.jsx("span",{className:"text-[11px] text-gray-400",children:new Date(y.lastConnectedAt).toLocaleString()})]}),y.lastError&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-20 flex-shrink-0 pt-0.5",children:"Error"}),r.jsx("span",{className:"text-[11px] text-red-400 break-all",children:y.lastError})]})]})]},y.accountId))}):r.jsx("p",{className:"text-sm text-gray-600 pt-4",children:"Bir kanal seçin."})})]})}function $E(e){return e===0?"Free":e<1?`$${e.toFixed(3)}/1M`:`$${e.toFixed(2)}/1M`}function UE(e){return e?e>=1e3?`${(e/1e3).toFixed(0)}M`:`${e}k`:"—"}const T0={free:{label:"Free",icon:r.jsx(fC,{size:11}),color:"#22c55e",bg:"rgba(34,197,94,0.12)"},balanced:{label:"Balanced",icon:r.jsx(MC,{size:11}),color:"#60a5fa",bg:"rgba(96,165,250,0.12)"},power:{label:"Power",icon:r.jsx(Oe,{size:11}),color:"#f59e0b",bg:"rgba(245,158,11,0.12)"}};function HE({currentModel:e,onSelect:t,className:n}){const[s,i]=h.useState(null),[a,o]=h.useState(!0),[l,c]=h.useState(null),[d,u]=h.useState("free"),[p,f]=h.useState(""),m=h.useRef(null),b=(g=!1)=>{o(!0),c(null),fetch(`/api/providers/openrouter/models${g?"?refresh=1":""}`).then(x=>x.ok?x.json():Promise.reject(new Error(`HTTP ${x.status}`))).then(x=>{if(i(x),e){const w=x.free.some(j=>j.id===e)?"free":x.balanced.some(j=>j.id===e)?"balanced":x.power.some(j=>j.id===e)?"power":"free";u(w)}o(!1)}).catch(x=>{c(x.message),o(!1)})};h.useEffect(()=>{b()},[]),h.useEffect(()=>{m.current&&m.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[d,s]);const v=(s==null?void 0:s[d])??[],y=p?v.filter(g=>g.name.toLowerCase().includes(p.toLowerCase())||g.id.toLowerCase().includes(p.toLowerCase())):v;return r.jsxs("div",{className:`flex flex-col rounded-xl overflow-hidden ${n??""}`,style:{background:"rgba(12,5,2,0.85)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2",children:[r.jsx("span",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-widest",children:"OpenRouter Models"}),r.jsx("button",{onClick:()=>b(!0),className:"text-gray-600 hover:text-orange-400 transition-colors p-1 rounded",title:"Refresh catalog",disabled:a,children:r.jsx(fe,{size:11,className:a?"animate-spin":""})})]}),r.jsx("div",{className:"flex gap-1 px-3 pb-2",children:["free","balanced","power"].map(g=>{var k;const x=T0[g],w=((k=s==null?void 0:s.totals)==null?void 0:k[g])??0,j=d===g;return r.jsxs("button",{onClick:()=>u(g),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all",style:{background:j?x.bg:"transparent",color:j?x.color:"#6b7280",border:`1px solid ${j?x.color+"40":"transparent"}`},children:[x.icon,x.label,w>0&&r.jsx("span",{className:"text-[9px] font-bold opacity-60",children:w})]},g)})}),r.jsx("div",{className:"px-3 pb-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(Zt,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-600"}),r.jsx("input",{value:p,onChange:g=>f(g.target.value),placeholder:"Search models…",className:"w-full pl-7 pr-3 py-1.5 rounded-lg text-[11px] text-gray-300 placeholder-gray-600 outline-none",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"}})]})}),r.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:"320px"},children:[a&&r.jsxs("div",{className:"py-8 text-center text-[11px] text-gray-600",children:[r.jsx(fe,{size:14,className:"animate-spin mx-auto mb-2"}),"Fetching live catalog…"]}),!a&&l&&r.jsxs("div",{className:"py-6 px-4 text-center text-[11px] text-red-400",children:[l,r.jsx("br",{}),r.jsx("button",{onClick:()=>b(!0),className:"mt-2 underline text-orange-400 hover:text-orange-300",children:"Retry"})]}),!a&&!l&&y.length===0&&r.jsx("div",{className:"py-8 text-center text-[11px] text-gray-600",children:"No models found."}),!a&&!l&&y.map(g=>{const x=g.id===e,w=T0[g.tier];return r.jsx("button",{ref:x?m:void 0,onClick:()=>t(g.id),className:"w-full text-left px-3 py-2 transition-all",style:{background:x?"rgba(234,88,12,0.10)":"transparent",borderLeft:x?"2px solid #ea580c":"2px solid transparent"},children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:`text-[12px] font-semibold truncate ${x?"text-orange-300":"text-gray-300"}`,children:g.name}),g.hasVision&&r.jsx(Ds,{size:9,className:"text-purple-400 flex-shrink-0",title:"Vision / multimodal"})]}),r.jsx("span",{className:"text-[9px] text-gray-600 font-mono truncate block",children:g.id}),g.description&&r.jsx("span",{className:"text-[10px] text-gray-600 line-clamp-1 mt-0.5",children:g.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[r.jsx("span",{className:"text-[9px] font-bold",style:{color:w.color},children:$E(g.costPer1M)}),r.jsxs("span",{className:"text-[9px] text-gray-600",children:[UE(g.contextK)," ctx"]})]})]})},g.id)})]}),s&&r.jsx("div",{className:"px-3 py-1.5 border-t",style:{borderColor:"rgba(255,255,255,0.04)"},children:r.jsxs("span",{className:"text-[9px] text-gray-700 font-mono",children:["Catalog cached · ",new Date(s.fetchedAt).toLocaleTimeString()]})})]})}const Bc=[{code:"en",label:"English",flag:"🇬🇧",native:"English"},{code:"tr",label:"Turkish",flag:"🇹🇷",native:"Türkçe"},{code:"de",label:"German",flag:"🇩🇪",native:"Deutsch"},{code:"fr",label:"French",flag:"🇫🇷",native:"Français"},{code:"es",label:"Spanish",flag:"🇪🇸",native:"Español"},{code:"pt",label:"Portuguese (Brazil)",flag:"🇧🇷",native:"Português"},{code:"ja",label:"Japanese",flag:"🇯🇵",native:"日本語"},{code:"zh",label:"Chinese (Simplified)",flag:"🇨🇳",native:"简体中文"}];function WE(){const{locale:e,setLocale:t}=gt(),[n,s]=h.useState(!1),i=h.useRef(null),a=Bc.find(o=>o.code===e)??Bc[0];return h.useEffect(()=>{if(!n)return;const o=l=>{l.key==="Escape"&&s(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]),r.jsxs("div",{ref:i,className:"relative",children:[r.jsxs("button",{onClick:()=>s(o=>!o),"aria-label":"Switch language",className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-full border text-[12px] font-semibold transition-all select-none ${n?"bg-orange-500/15 border-orange-400/30 text-orange-700":"text-black/65 border-transparent hover:text-black hover:bg-black/6"}`,children:[r.jsx(yC,{size:12,className:"text-orange-400 shrink-0"}),r.jsx("span",{children:a.flag}),r.jsx("span",{className:"tracking-wide",children:a.code.toUpperCase()})]}),r.jsx(ne,{children:n&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>s(!1)}),r.jsxs(H.div,{initial:{opacity:0,y:-6,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-6,scale:.96},transition:{duration:.13,ease:"easeOut"},className:"absolute right-0 top-full mt-2 z-20 w-52 bg-[#100806]/96 backdrop-blur-2xl border border-orange-500/15 rounded-xl shadow-2xl shadow-black/60 overflow-hidden max-h-72 overflow-y-auto",children:[r.jsx("div",{className:"px-3 py-2 border-b border-white/6",children:r.jsx("p",{className:"text-[9px] font-bold text-gray-600 uppercase tracking-widest",children:"Language"})}),Bc.map(o=>{const l=e===o.code;return r.jsxs("button",{onClick:()=>{t(o.code),s(!1)},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[12px] font-medium transition-colors ${l?"bg-orange-500/12 text-orange-400":"text-gray-300 hover:bg-white/5 hover:text-white"}`,children:[r.jsx("span",{className:"text-base leading-none",children:o.flag}),r.jsxs("div",{className:"text-left flex-1",children:[r.jsx("p",{className:"leading-none",children:o.native}),!l&&r.jsx("p",{className:"text-[10px] text-gray-600 mt-0.5",children:o.label})]}),l&&r.jsx(at,{size:12,className:"text-orange-400 shrink-0"})]},o.code)})]})]})})]})}const P0={frontier:"⚡ Frontier",gateway:"🌐 Gateway",fast:"🚀 Fast",local:"💻 Local",open:"🔓 Open Source",specialist:"🎯 Specialist",regional:"🌏 Regional",enterprise:"🏢 Enterprise",custom:"⚙️ Custom"},A0=["frontier","gateway","fast","local","open","specialist","regional","enterprise","custom"];function Ov({tag:e}){return r.jsx("span",{className:"px-1.5 py-0.5 rounded-md bg-white/5 border border-white/8 text-[9px] text-gray-400 font-medium",children:e})}function KE({p:e,active:t,onClick:n}){return r.jsx("button",{onClick:n,className:`w-full text-left px-3 py-2.5 rounded-xl border transition-all ${t?"bg-orange-500/12 border-orange-500/30":"bg-white/3 border-white/6 hover:bg-white/5 hover:border-white/12"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`text-[13px] font-semibold leading-tight truncate ${t?"text-orange-300":"text-gray-200"}`,children:e.label}),r.jsx("p",{className:"text-[11px] text-gray-400 mt-0.5 leading-snug line-clamp-2",children:e.description}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:e.tags.slice(0,3).map(s=>r.jsx(Ov,{tag:s},s))})]}),t&&r.jsx(Qt,{size:13,className:"text-orange-400 shrink-0 mt-1"})]})})}function GE(){const{t:e}=gt(),t=e.panels.settings,[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState("all"),[u,p]=h.useState(""),[f,m]=h.useState(null),[b,v]=h.useState(""),[y,g]=h.useState(""),[x,w]=h.useState(!1),[j,k]=h.useState(!1),[N,S]=h.useState(!1),[_,R]=h.useState(null),[L,P]=h.useState(null),[V,M]=h.useState(!!window.__MUSTB_NEED_API_KEY),[B,A]=h.useState(null),[T,F]=h.useState("providers"),C=h.useRef(null);h.useEffect(()=>{$("/api/setup/providers").then(ee=>ee.ok?ee.json():null).then(ee=>{ee!=null&&ee.providers&&s(ee.providers)}).catch(()=>{}),$("/api/setup/status").then(ee=>ee.ok?ee.json():null).then(ee=>{ee&&a(ee)}).catch(()=>{}),$("/api/setup/ollama-models").then(ee=>ee.ok?ee.json():null).then(ee=>{ee!=null&&ee.models&&l(ee.models)}).catch(()=>{});const Y=()=>{M(!0),window.__MUSTB_NEED_API_KEY=!0};return window.addEventListener("mustb:401",Y),()=>window.removeEventListener("mustb:401",Y)},[]),h.useEffect(()=>{f&&v(f.defaultModel)},[f]);const E=u.toLowerCase(),z=n.filter(Y=>!(c!=="all"&&Y.category!==c||E&&!Y.label.toLowerCase().includes(E)&&!Y.description.toLowerCase().includes(E))),W={};for(const Y of z)W[Y.category]||(W[Y.category]=[]),W[Y.category].push(Y);const K=async()=>{if(f){k(!0),R(null);try{const ee=await(await $("/api/setup/test-key",{method:"POST",body:JSON.stringify({provider:f.id,apiKey:y||void 0,model:b||void 0})})).json();R({ok:ee.ok,msg:ee.message??(ee.ok?"Connection successful":"Connection failed")})}catch{R({ok:!1,msg:"Gateway unreachable"})}k(!1)}},X=async()=>{if(!(!f||!f.envKeyIsUrl&&!y.trim())){S(!0),P(null);try{const ee=await $("/api/setup/update-key",{method:"POST",body:JSON.stringify({provider:f.id,apiKey:y||void 0,model:b||void 0})});if(ee.ok){P("Saved successfully."),g(""),window.__MUSTB_NEED_API_KEY=!1,M(!1);const Lt=await $("/api/setup/status");Lt.ok&&a(await Lt.json())}else{const Lt=await ee.json();P(Lt.error??"Failed to save.")}}catch{P("Gateway unreachable.")}S(!1),setTimeout(()=>P(null),6e3)}},I=Y=>{A(Y),$("/api/setup/save",{method:"POST",body:JSON.stringify({provider:"ollama",model:Y})}).finally(()=>{setTimeout(()=>A(null),3e3)})},Q=(f==null?void 0:f.envKeyIsUrl)??!1,G=(f==null?void 0:f.id)==="ollama",J=(f==null?void 0:f.id)==="openrouter",he=A0.filter(Y=>n.some(ee=>ee.category===Y)),ce=i?i.score>=70?"text-green-400":i.score>=40?"text-amber-400":"text-red-400":"text-gray-400";return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden font-sans",children:[r.jsxs("div",{className:"shrink-0 flex items-center justify-between px-5 py-3 border-b border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/10 border border-orange-500/20 flex items-center justify-center",children:r.jsx(lf,{size:15,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[14px] font-bold text-white leading-tight",children:t.title}),r.jsxs("p",{className:"text-[10px] text-gray-400 leading-tight",children:[i!=null&&i.configured?`Active · ${i.provider??"unknown"}`:"Not configured",i!=null&&i.mode?` · ${i.mode}`:""]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(WE,{}),i&&r.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white/4 border border-white/8",children:[r.jsx(fn,{size:11,className:ce}),r.jsxs("span",{className:`text-[11px] font-semibold ${ce}`,children:["HW ",i.score]}),r.jsxs("span",{className:"text-[10px] text-gray-400",children:["· ",i.tier]})]})]})]}),V&&r.jsxs("div",{className:"shrink-0 mx-4 mt-3 flex items-start gap-2.5 px-3.5 py-2.5 rounded-xl bg-red-500/10 border border-red-500/25 text-red-300",children:[r.jsx(ls,{size:14,className:"shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold",children:"API key missing or invalid"}),r.jsx("p",{className:"text-[10px] text-red-400/70 mt-0.5",children:"A request returned 401 Unauthorized. Select a provider and update your key below."})]})]}),r.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 px-5 pt-3 pb-0",children:[r.jsxs("button",{onClick:()=>F("providers"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${T==="providers"?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-400 hover:text-gray-300 hover:border-white/12"}`,children:[r.jsx(fn,{size:11})," LLM Providers"]}),r.jsxs("button",{onClick:()=>F("channels"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${T==="channels"?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-400 hover:text-gray-300 hover:border-white/12"}`,children:[r.jsx(bo,{size:11})," Kanallar"]})]}),T==="channels"&&r.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:r.jsx(VE,{})}),T==="providers"&&r.jsxs("div",{className:"flex flex-1 min-h-0 gap-0",children:[r.jsxs("div",{className:"w-[52%] flex flex-col border-r border-white/6 min-h-0",children:[r.jsxs("div",{className:"shrink-0 px-4 pt-3 pb-2 space-y-2.5",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Zt,{size:12,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx("input",{ref:C,type:"text",value:u,onChange:Y=>p(Y.target.value),placeholder:t.searchPlaceholder,className:"w-full bg-white/4 border border-white/8 rounded-xl pl-8 pr-3 py-2 text-[12px] text-white placeholder:text-gray-400 outline-none focus:border-orange-500/40 transition-colors"})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.jsx("button",{onClick:()=>d("all"),className:`px-2 py-0.5 rounded-lg text-[10px] font-semibold border transition-all ${c==="all"?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/4 border-white/8 text-gray-400 hover:text-gray-300"}`,children:t.allProviders}),he.map(Y=>r.jsx("button",{onClick:()=>d(Y),className:`px-2 py-0.5 rounded-lg text-[10px] font-semibold border transition-all ${c===Y?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/4 border-white/8 text-gray-400 hover:text-gray-300"}`,children:P0[Y]},Y))]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4 space-y-4",children:[n.length===0&&r.jsxs("div",{className:"flex items-center gap-2 py-6 text-gray-400 text-[12px]",children:[r.jsx(re,{size:13,className:"animate-spin"})," Loading providers…"]}),A0.filter(Y=>{var ee;return(ee=W[Y])==null?void 0:ee.length}).map(Y=>r.jsxs("div",{children:[r.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest mb-1.5 px-1",children:P0[Y]}),r.jsx("div",{className:"space-y-1.5",children:W[Y].map(ee=>r.jsx(KE,{p:ee,active:(f==null?void 0:f.id)===ee.id,onClick:()=>{m(ee),R(null),g("")}},ee.id))})]},Y)),n.length>0&&z.length===0&&r.jsxs("p",{className:"text-[12px] text-gray-400 py-4 text-center",children:['No providers match "',u,'"']})]})]}),r.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-y-auto",children:f?r.jsxs("div",{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-[16px] font-bold text-white",children:f.label}),r.jsx("p",{className:"text-[12px] text-gray-400 mt-0.5 leading-snug",children:f.description}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:f.tags.map(Y=>r.jsx(Ov,{tag:Y},Y))})]}),r.jsxs("a",{href:f.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 flex items-center gap-1 px-2.5 py-1.5 rounded-lg bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white transition-colors",children:["Docs ",r.jsx(ba,{size:10})]})]}),G&&o.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Recommended Models for Your Hardware"}),r.jsx("div",{className:"space-y-1.5",children:o.map(Y=>{const ee=Y.fit==="recommended"?"text-green-400 border-green-500/20 bg-green-500/6":Y.fit==="marginal"?"text-amber-400 border-amber-500/20 bg-amber-500/6":"text-red-400 border-red-500/20 bg-red-500/6";return r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-xl bg-white/3 border border-white/6",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[12px] font-semibold text-gray-200 truncate",children:Y.label}),r.jsxs("p",{className:"text-[10px] text-gray-400",children:[Y.sizeGb," GB"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-md border ${ee}`,children:Y.fit}),r.jsxs("button",{onClick:()=>{v(Y.id),I(Y.id)},disabled:B===Y.id,className:"flex items-center gap-1 px-2 py-1 rounded-lg bg-orange-500/10 border border-orange-500/20 text-orange-400 text-[10px] font-semibold hover:bg-orange-500/15 transition-all disabled:opacity-40",children:[B===Y.id?r.jsx(re,{size:10,className:"animate-spin"}):r.jsx(Ri,{size:10}),B===Y.id?"Pulling…":"Pull"]})]})]},Y.id)})})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest flex items-center gap-1.5",children:[Q?r.jsx(RC,{size:9}):r.jsx(gC,{size:9}),Q?t.baseUrl:t.apiKey]}),G&&!Q?r.jsx("div",{className:"px-3.5 py-2.5 rounded-xl bg-green-500/6 border border-green-500/15 text-green-400 text-[12px]",children:"Ollama runs locally — no API key required. Just make sure Ollama is running."}):r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:x||Q?"text":"password",value:y,onChange:Y=>{g(Y.target.value),R(null)},placeholder:f.placeholder,className:"w-full bg-white/4 border border-white/10 rounded-xl px-4 py-2.5 pr-10 text-[12px] text-white placeholder:text-gray-400 outline-none focus:border-orange-500/40 transition-colors"}),!Q&&r.jsx("button",{onClick:()=>w(Y=>!Y),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-300 transition-colors",children:x?r.jsx(ef,{size:13}):r.jsx(Ds,{size:13})})]}),r.jsx("p",{className:"text-[10px] text-gray-400 px-1",children:Q?`Stored in .env as ${f.envKey}. Default: ${f.placeholder}`:`Stored locally in .env as ${f.envKey} — never sent to external servers.`})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest flex items-center gap-1.5",children:[r.jsx(Oe,{size:9}),t.model]}),J?r.jsx(HE,{currentModel:b,onSelect:v,className:"rounded-xl border border-white/10 bg-white/3"}):r.jsx("select",{value:b,onChange:Y=>v(Y.target.value),className:"w-full bg-white/4 border border-white/10 rounded-xl px-3 py-2.5 text-[12px] text-white outline-none focus:border-orange-500/40 transition-colors appearance-none",children:f.latestModels.map(Y=>r.jsx("option",{value:Y,className:"bg-[#1a0c06]",children:Y},Y))})]}),r.jsxs("div",{className:"flex items-center gap-2.5 pt-1",children:[!G&&r.jsxs("button",{onClick:K,disabled:j||!y&&!(i!=null&&i.configured),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-white/5 border border-white/10 text-[12px] text-gray-300 font-medium hover:bg-white/8 hover:text-white transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:j?"animate-spin":""}),j?t.testing:t.testConnection]}),r.jsxs("button",{onClick:X,disabled:N||!y.trim()&&!Q&&!G,className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-orange-600 hover:bg-orange-500 text-white text-[12px] font-semibold transition-all disabled:opacity-40 shadow-lg shadow-orange-500/20",children:[r.jsx(pv,{size:12,className:N?"animate-spin":""}),N?t.saving:t.save]})]}),_&&r.jsxs("div",{className:`flex items-start gap-2 px-3.5 py-2.5 rounded-xl border text-[12px] ${_.ok?"bg-green-500/8 border-green-500/20 text-green-300":"bg-red-500/8 border-red-500/20 text-red-300"}`,children:[_.ok?r.jsx(Fe,{size:13,className:"shrink-0 mt-0.5"}):r.jsx(ls,{size:13,className:"shrink-0 mt-0.5"}),_.msg]}),L&&r.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 rounded-xl bg-orange-500/8 border border-orange-500/20 text-orange-300 text-[12px]",children:[r.jsx(Fe,{size:13,className:"shrink-0"}),L]}),G&&r.jsxs("div",{className:"pt-1 space-y-1.5",children:[r.jsxs("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest flex items-center gap-1.5",children:[r.jsx(mC,{size:9}),"Custom Base URL (optional)"]}),r.jsx("input",{type:"text",value:y,onChange:Y=>g(Y.target.value),placeholder:"http://localhost:11434",className:"w-full bg-white/4 border border-white/10 rounded-xl px-4 py-2.5 text-[12px] text-white placeholder:text-gray-400 outline-none focus:border-orange-500/40 transition-colors"}),r.jsx("p",{className:"text-[10px] text-gray-400 px-1",children:"Leave blank to use the default http://localhost:11434"})]})]}):r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center px-8",children:[r.jsx("div",{className:"w-12 h-12 rounded-2xl bg-orange-500/8 border border-orange-500/15 flex items-center justify-center",children:r.jsx(qe,{size:20,className:"text-orange-500/50"})}),r.jsx("p",{className:"text-[13px] text-gray-400",children:"Select a provider from the left to configure your API key"})]})})]})]})}function qE(e){if(!e)return"—";const t=Date.now()-e;return t<6e4?`${Math.floor(t/1e3)}s önce`:t<36e5?`${Math.floor(t/6e4)}dk önce`:`${Math.floor(t/36e5)}sa önce`}function YE(){const{online:e}=wa(),[t,n]=h.useState([]),[s,i]=h.useState(!0),[a,o]=h.useState("all"),l=async()=>{i(!0);try{const p=await(await $("/api/gateway/sessions?limit=50&includeDerivedTitles=true&includeLastMessage=true")).json(),f=Array.isArray(p)?p:Array.isArray(p==null?void 0:p.sessions)?p.sessions:[];n(f)}catch{n([])}finally{i(!1)}};h.useEffect(()=>{l()},[e]);const c=u=>!!u.runningAtMs&&Date.now()-u.runningAtMs<12e4,d=t.filter(u=>a==="running"?c(u):a==="idle"?!c(u):!0);return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(qe,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Aktif Oturumlar"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:[t.length," oturum"]})]})]}),r.jsxs("button",{onClick:l,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white hover:border-white/16 transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:s?"animate-spin":""}),"Yenile"]})]}),!e&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-xl bg-orange-500/8 border border-orange-500/20",children:[r.jsx(Ks,{size:13,className:"text-orange-400 flex-shrink-0"}),r.jsx("p",{className:"text-[12px] text-orange-300",children:"Gateway çevrimdışı — oturum verisi alınamıyor."})]}),r.jsx("div",{className:"flex gap-1.5",children:["all","running","idle"].map(u=>r.jsx("button",{onClick:()=>o(u),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${a===u?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:u==="all"?"Tümü":u==="running"?"Çalışıyor":"Boşta"},u))}),s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):d.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[r.jsx(Is,{size:32,className:"text-gray-700"}),r.jsx("p",{className:"text-sm text-gray-600",children:e?"Aktif oturum bulunamadı.":"Gateway çevrimdışı."})]}):r.jsx("div",{className:"space-y-2",children:d.map(u=>{const p=c(u);return r.jsx("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6 hover:border-white/10 transition-all",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5 flex-shrink-0",children:p?r.jsx("span",{className:"block w-2 h-2 rounded-full bg-orange-400 animate-pulse"}):r.jsx("span",{className:"block w-2 h-2 rounded-full bg-gray-700"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("p",{className:"text-[13px] font-semibold text-gray-200 truncate",children:u.derivedTitle??u.label??u.key.slice(0,20)+"…"}),u.agentId&&r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-gray-600 flex-shrink-0",children:[r.jsx(fn,{size:9}),u.agentId]})]}),u.lastMessage&&r.jsx("p",{className:"text-[11px] text-gray-500 truncate mb-1",children:u.lastMessage}),r.jsxs("div",{className:"flex items-center gap-3",children:[u.messageCount!==void 0&&r.jsxs("span",{className:"text-[10px] text-gray-600",children:[u.messageCount," mesaj"]}),r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-gray-600",children:[r.jsx(At,{size:9}),qE(u.lastActivityAt)]})]})]})]})},u.key)})})]})}function XE(e){if(!e||typeof e!="object")return String(e??"—");const t=e;return t.type==="every"&&t.intervalMs?`Her ${Math.round(t.intervalMs/6e4)} dakika`:t.type==="at"&&t.time?`Her gün ${t.time}`:t.type==="cron"&&t.expression?`Cron: ${t.expression}`:JSON.stringify(e).slice(0,40)}function QE(e){if(!e)return"—";const t=e-Date.now();return t<0?"Geçti":t<6e4?`${Math.floor(t/1e3)}s sonra`:t<36e5?`${Math.floor(t/6e4)}dk sonra`:`${Math.floor(t/36e5)}sa sonra`}function JE(){const{online:e}=wa(),[t,n]=h.useState([]),[s,i]=h.useState(!0),[a,o]=h.useState("all"),[l,c]=h.useState(null),[d,u]=h.useState(null),p=async()=>{i(!0);try{const x=await(await $("/api/gateway/automations?enabled=all&limit=50")).json();n(Array.isArray(x==null?void 0:x.jobs)?x.jobs:Array.isArray(x)?x:[])}catch{n([])}finally{i(!1)}};h.useEffect(()=>{p()},[e]);const f=async g=>{try{await $(`/api/gateway/automations/${g.id}`,{method:"PATCH",body:JSON.stringify({patch:{enabled:!g.enabled}})}),n(x=>x.map(w=>w.id===g.id?{...w,enabled:!w.enabled}:w))}catch{}},m=async g=>{c(g);try{await $(`/api/gateway/automations/${g}/run`,{method:"POST"}),await p()}catch{}finally{c(null)}},b=async g=>{if(window.confirm("Bu otomasyon silinsin mi?")){u(g);try{await $(`/api/gateway/automations/${g}`,{method:"DELETE"}),n(x=>x.filter(w=>w.id!==g))}catch{}finally{u(null)}}},v=t.filter(g=>a==="enabled"?g.enabled:a==="disabled"?!g.enabled:!0),y=g=>g==="ok"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-green-400",children:[r.jsx(Fe,{size:9})," Başarılı"]}):g==="error"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-red-400",children:[r.jsx(iv,{size:9})," Hata"]}):r.jsx("span",{className:"text-[10px] text-gray-600",children:"—"});return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(Oe,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Otomasyonlar"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:[t.length," zamanlanmış görev"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[!e&&r.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] bg-red-500/8 border border-red-500/20 text-red-400",children:[r.jsx(Ks,{size:10})," Çevrimdışı"]}),r.jsxs("button",{onClick:p,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white hover:border-white/16 transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:s?"animate-spin":""})," Yenile"]})]})]}),r.jsx("div",{className:"flex gap-1.5",children:["all","enabled","disabled"].map(g=>r.jsx("button",{onClick:()=>o(g),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${a===g?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:g==="all"?"Tümü":g==="enabled"?"Aktif":"Pasif"},g))}),s?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):v.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[r.jsx(Oe,{size:32,className:"text-gray-700"}),r.jsx("p",{className:"text-sm text-gray-600",children:e?"Otomasyon bulunamadı.":"Gateway çevrimdışı."})]}):r.jsx("div",{className:"space-y-2",children:v.map(g=>{var x,w;return r.jsx("div",{className:`px-4 py-3 rounded-xl border transition-all ${g.enabled?"bg-white/[0.025] border-white/6":"bg-white/[0.01] border-white/4"}`,children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{onClick:()=>f(g),disabled:!e,className:"mt-0.5 text-gray-500 hover:text-orange-400 transition-colors disabled:opacity-40",title:g.enabled?"Devre dışı bırak":"Etkinleştir",children:g.enabled?r.jsx(IC,{size:18,className:"text-orange-400"}):r.jsx(DC,{size:18})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("p",{className:`text-[13px] font-semibold truncate ${g.enabled?"text-gray-200":"text-gray-500"}`,children:g.name??g.id}),y((x=g.state)==null?void 0:x.lastRunStatus)]}),r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-gray-500",children:[r.jsx(At,{size:9})," ",XE(g.schedule)]}),((w=g.state)==null?void 0:w.nextRunAtMs)&&r.jsx("span",{className:"text-[11px] text-gray-600",children:QE(g.state.nextRunAtMs)})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[r.jsxs("button",{onClick:()=>m(g.id),disabled:!e||l===g.id,className:"flex items-center gap-1 px-2 py-1 rounded-lg bg-orange-500/8 border border-orange-500/20 text-orange-400 text-[10px] font-semibold hover:bg-orange-500/15 transition-all disabled:opacity-40",children:[l===g.id?r.jsx(fe,{size:9,className:"animate-spin"}):r.jsx(Ws,{size:9}),"Çalıştır"]}),r.jsxs("button",{onClick:()=>b(g.id),disabled:!e||d===g.id,className:"flex items-center gap-1 px-2 py-1 rounded-lg bg-red-500/8 border border-red-500/20 text-red-400 text-[10px] font-semibold hover:bg-red-500/15 transition-all disabled:opacity-40",children:[d===g.id?r.jsx(fe,{size:9,className:"animate-spin"}):r.jsx(ms,{size:9}),"Sil"]})]})]})},g.id)})})]})}function ZE(e){var t;return(t=e.presence)!=null&&t.ts?Date.now()-e.presence.ts<6e4:!1}function e_({platform:e}){const t=(e??"").toLowerCase();return t.includes("ios")||t.includes("iphone")?r.jsx(c0,{size:14,className:"text-gray-400"}):t.includes("android")?r.jsx(c0,{size:14,className:"text-green-500"}):t.includes("mac")||t.includes("darwin")?r.jsx(eC,{size:14,className:"text-gray-300"}):t.includes("win")?r.jsx(rf,{size:14,className:"text-blue-400"}):r.jsx(vC,{size:14,className:"text-gray-500"})}function t_(){const{online:e}=wa(),[t,n]=h.useState([]),[s,i]=h.useState(!0),[a,o]=h.useState(null),[l,c]=h.useState(""),d=async()=>{i(!0);try{const f=await(await $("/api/gateway/clients")).json();n(Array.isArray(f==null?void 0:f.nodes)?f.nodes:Array.isArray(f)?f:[])}catch{n([])}finally{i(!1)}};h.useEffect(()=>{d()},[e]);const u=async p=>{if(!l.trim()){o(null);return}try{await $(`/api/gateway/clients/${p}/rename`,{method:"POST",body:JSON.stringify({displayName:l.trim()})}),n(f=>f.map(m=>m.nodeId===p?{...m,displayName:l.trim()}:m))}catch{}finally{o(null)}};return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(uu,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Bağlı Nodlar"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:[t.length," cihaz"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[!e&&r.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] bg-red-500/8 border border-red-500/20 text-red-400",children:[r.jsx(Ks,{size:10})," Çevrimdışı"]}),r.jsxs("button",{onClick:d,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white hover:border-white/16 transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:s?"animate-spin":""})," Yenile"]})]})]}),s?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):t.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[r.jsx(uu,{size:32,className:"text-gray-700"}),r.jsx("p",{className:"text-sm text-gray-600",children:e?"Bağlı node yok.":"Gateway çevrimdışı."})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:t.map(p=>r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6 hover:border-white/10 transition-all",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[r.jsx(e_,{platform:p.platform}),r.jsx("div",{className:"flex-1 min-w-0",children:a===p.nodeId?r.jsx("input",{autoFocus:!0,value:l,onChange:f=>c(f.target.value),onBlur:()=>u(p.nodeId),onKeyDown:f=>{f.key==="Enter"&&u(p.nodeId),f.key==="Escape"&&o(null)},className:"w-full bg-white/6 border border-orange-500/30 rounded-lg px-2 py-0.5 text-[13px] text-white outline-none"}):r.jsx("p",{className:"text-[13px] font-semibold text-gray-200 truncate cursor-text",onDoubleClick:()=>{o(p.nodeId),c(p.displayName??"")},title:"Çift tıklayarak düzenle",children:p.displayName??p.nodeId})}),r.jsx("span",{className:`flex-shrink-0 w-2 h-2 rounded-full mt-1 ${ZE(p)?"bg-green-400 animate-pulse":"bg-gray-700"}`})]}),r.jsxs("div",{className:"space-y-1",children:[p.platform&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-16",children:"Platform"}),r.jsx("span",{className:"text-[11px] text-gray-400",children:p.platform})]}),p.version&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-16",children:"Versiyon"}),r.jsx("span",{className:"text-[11px] text-gray-400",children:p.version})]}),(p.caps??[]).length>0&&r.jsxs("div",{className:"flex items-center gap-1 flex-wrap mt-1",children:[(p.caps??[]).slice(0,3).map(f=>r.jsx("span",{className:"px-1.5 py-0.5 rounded-md bg-orange-500/8 border border-orange-500/15 text-[9px] text-orange-400 font-medium",children:f},f)),(p.caps??[]).length>3&&r.jsxs("span",{className:"text-[9px] text-gray-600",children:["+",(p.caps??[]).length-3]})]})]})]},p.nodeId))})]})}function n_({online:e}){var d;const[t,n]=h.useState({}),[s,i]=h.useState(!0),a=h.useRef(0),o=h.useRef(null),l=async(u=0)=>{try{const f=await(await $(`/api/gateway/logs?cursor=${u}&limit=200`)).json();u===0?(n(f),a.current=f.cursor??0):(n(m=>({...f,lines:[...m.lines??[],...f.lines??[]]})),a.current=f.cursor??a.current)}catch{}finally{i(!1)}};h.useEffect(()=>{l(0)},[e]),h.useEffect(()=>{const u=setInterval(()=>l(a.current),1e4);return()=>clearInterval(u)},[e]),h.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[(d=t.lines)==null?void 0:d.length]);const c=u=>u.includes("error")||u.includes("ERROR")?"text-red-400":u.includes("warn")||u.includes("WARN")?"text-amber-400":u.includes("info")||u.includes("INFO")?"text-green-400":"text-gray-400";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-[11px] text-gray-600",children:[(t.lines??[]).length," satır"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:()=>navigator.clipboard.writeText((t.lines??[]).join(`
|
|
720
|
-
`)),className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-white/4 border border-white/8 text-[10px] text-gray-400 hover:text-white transition-all",children:[r.jsx(Os,{size:10})," Kopyala"]}),r.jsxs("button",{onClick:()=>{a.current=0,l(0)},className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-white/4 border border-white/8 text-[10px] text-gray-400 hover:text-white transition-all",children:[r.jsx(fe,{size:10})," Sıfırla"]})]})]}),r.jsx("div",{ref:o,className:"h-96 overflow-y-auto rounded-xl bg-black/40 border border-white/6 p-3 font-mono text-[11px] space-y-0.5",children:s?r.jsx("p",{className:"text-gray-600",children:"Yükleniyor…"}):!e||t.offline?r.jsx("p",{className:"text-orange-500",children:"Gateway çevrimdışı — log verisi alınamıyor."}):(t.lines??[]).length===0?r.jsx("p",{className:"text-gray-600",children:"Henüz log yok."}):(t.lines??[]).map((u,p)=>r.jsx("p",{className:`whitespace-pre-wrap break-all leading-5 ${c(u)}`,children:u},p))})]})}function s_({online:e}){var l,c;const[t,n]=h.useState({}),[s,i]=h.useState(!0);h.useEffect(()=>{i(!0),$("/api/gateway/usage/cost").then(d=>d.json()).then(n).catch(()=>n({})).finally(()=>i(!1))},[e]);const a=t.daily??[],o=Math.max(1,...a.map(d=>d.tokens??0));return r.jsxs("div",{className:"space-y-4",children:[(!e||t.offline)&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-orange-500/8 border border-orange-500/20",children:[r.jsx(Ks,{size:12,className:"text-orange-400"}),r.jsx("p",{className:"text-[11px] text-orange-300",children:"Gateway çevrimdışı."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6",children:[r.jsx("p",{className:"text-[10px] text-gray-600 mb-1 uppercase tracking-widest",children:"Toplam Token"}),r.jsx("p",{className:"text-xl font-bold text-white",children:s?"—":(((l=t.total)==null?void 0:l.tokens)??0).toLocaleString()})]}),r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6",children:[r.jsxs("p",{className:"text-[10px] text-gray-600 mb-1 uppercase tracking-widest flex items-center gap-1",children:[r.jsx(cC,{size:8})," Tahmini Maliyet"]}),r.jsx("p",{className:"text-xl font-bold text-orange-400",children:s?"—":`$${(((c=t.total)==null?void 0:c.cost)??0).toFixed(4)}`})]})]}),(t.providers??[]).length>0&&r.jsxs("div",{className:"rounded-xl bg-white/[0.02] border border-white/6 overflow-hidden",children:[r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/6 text-[10px] font-bold text-gray-600 uppercase tracking-widest",children:[r.jsx("span",{children:"Provider"}),r.jsx("span",{className:"text-right",children:"Giriş"}),r.jsx("span",{className:"text-right",children:"Çıkış"}),r.jsx("span",{className:"text-right",children:"Maliyet"})]}),(t.providers??[]).map((d,u)=>r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/4 last:border-0 text-[12px]",children:[r.jsx("span",{className:"text-gray-300 font-medium truncate",children:d.provider}),r.jsx("span",{className:"text-right text-gray-500",children:(d.inputTokens??0).toLocaleString()}),r.jsx("span",{className:"text-right text-gray-500",children:(d.outputTokens??0).toLocaleString()}),r.jsxs("span",{className:"text-right text-orange-400",children:["$",(d.cost??0).toFixed(4)]})]},u))]}),a.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"text-[10px] text-gray-600 uppercase tracking-widest",children:"Günlük Kullanım"}),r.jsx("div",{className:"flex items-end gap-1 h-16 px-1",children:a.slice(-14).map((d,u)=>{var f;const p=Math.max(2,Math.round((d.tokens??0)/o*56));return r.jsxs("div",{className:"flex-1 flex flex-col items-center gap-0.5",children:[r.jsx("div",{style:{height:p},className:"w-full rounded-sm bg-orange-500/40 hover:bg-orange-500/60 transition-all",title:`${d.date}: ${(d.tokens??0).toLocaleString()} token`}),r.jsx("span",{className:"text-[8px] text-gray-700 truncate w-full text-center",children:(f=d.date)==null?void 0:f.slice(5)})]},u)})})]})]})}function r_({online:e}){const[t,n]=h.useState([]),[s,i]=h.useState(!0);return h.useEffect(()=>{i(!0),$("/api/gateway/sessions/usage?limit=30").then(a=>a.json()).then(a=>n(Array.isArray(a)?a:(a==null?void 0:a.sessions)??[])).catch(()=>n([])).finally(()=>i(!1))},[e]),r.jsxs("div",{className:"rounded-xl bg-white/[0.02] border border-white/6 overflow-hidden",children:[r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/6 text-[10px] font-bold text-gray-600 uppercase tracking-widest",children:[r.jsx("span",{className:"col-span-2",children:"Oturum"}),r.jsx("span",{className:"text-right",children:"Token"}),r.jsx("span",{className:"text-right",children:"Maliyet"})]}),s?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(fe,{size:14,className:"animate-spin text-orange-400"})}):t.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-6",children:e?"Oturum bulunamadı.":"Gateway çevrimdışı."}):t.map((a,o)=>{var l;return r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/4 last:border-0 text-[12px]",children:[r.jsx("span",{className:"col-span-2 text-gray-300 truncate font-mono text-[10px]",children:((l=a.key)==null?void 0:l.slice(0,28))??"—"}),r.jsx("span",{className:"text-right text-gray-500",children:(a.tokens??0).toLocaleString()}),r.jsxs("span",{className:"text-right text-orange-400",children:["$",(a.cost??0).toFixed(4)]})]},o)})]})}function i_(){const{online:e}=wa(),[t,n]=h.useState("logs");return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(oC,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Loglar & Aktivite"}),r.jsx("p",{className:"text-[11px] text-gray-500",children:"Must-b gateway log, kullanım ve oturum istatistikleri"})]}),!e&&r.jsxs("span",{className:"ml-auto flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] bg-red-500/8 border border-red-500/20 text-red-400",children:[r.jsx(Ks,{size:10})," Çevrimdışı"]})]}),r.jsx("div",{className:"flex gap-1.5",children:["logs","usage","sessions"].map(s=>r.jsx("button",{onClick:()=>n(s),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${t===s?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:s==="logs"?"Loglar":s==="usage"?"Kullanım":"Oturumlar"},s))}),t==="logs"&&r.jsx(n_,{online:e}),t==="usage"&&r.jsx(s_,{online:e}),t==="sessions"&&r.jsx(r_,{online:e})]})}function a_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState("all"),[o,l]=h.useState(new Set);h.useEffect(()=>{s(!0),$("/api/tools").then(u=>u.json()).then(u=>{const p=Array.isArray(u==null?void 0:u.groups)?u.groups:[];t(p),l(new Set(p.slice(0,3).map(f=>f.id)))}).catch(()=>t([])).finally(()=>s(!1))},[]);const c=e.map(u=>({...u,tools:(u.tools??[]).filter(p=>i==="core"?p.source!=="plugin":i==="plugin"?p.source==="plugin":!0)})).filter(u=>u.tools.length>0),d=u=>{l(p=>{const f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f})};return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex gap-1.5",children:["all","core","plugin"].map(u=>r.jsx("button",{onClick:()=>a(u),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${i===u?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:u==="all"?"All":u==="core"?"Core":"Plugin"},u))}),n?r.jsx("div",{className:"flex justify-center py-10",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):c.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-8",children:"No tools found."}):r.jsx("div",{className:"space-y-2",children:c.map(u=>{var p;return r.jsxs("div",{className:"rounded-xl bg-white/[0.02] border border-white/6 overflow-hidden",children:[r.jsxs("button",{onClick:()=>d(u.id),className:"w-full flex items-center justify-between px-4 py-2.5 hover:bg-white/3 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(df,{size:12,className:"text-orange-400"}),r.jsx("span",{className:"text-[12px] font-semibold text-gray-300",children:u.label??u.id}),r.jsxs("span",{className:"text-[10px] text-gray-600",children:[((p=u.tools)==null?void 0:p.length)??0," tools"]})]}),o.has(u.id)?r.jsx(qr,{size:12,className:"text-gray-600"}):r.jsx(Qt,{size:12,className:"text-gray-600"})]}),o.has(u.id)&&r.jsx("div",{className:"border-t border-white/5 divide-y divide-white/4",children:(u.tools??[]).map((f,m)=>r.jsxs("div",{className:"px-4 py-2 flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[12px] font-semibold text-gray-300",children:f.label??f.name}),f.description&&r.jsx("p",{className:"text-[11px] text-gray-600 line-clamp-1",children:f.description})]}),r.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:r.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-md border ${f.source==="plugin"?"bg-blue-500/8 border-blue-500/20 text-blue-400":"bg-orange-500/8 border-orange-500/20 text-orange-400"}`,children:f.source==="plugin"?"plugin":"core"})})]},m))})]},u.id)})})]})}function o_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0);return h.useEffect(()=>{s(!0),$("/api/agents").then(i=>i.json()).then(i=>t(Array.isArray(i==null?void 0:i.agents)?i.agents:[])).catch(()=>t([])).finally(()=>s(!1))},[]),n?r.jsx("div",{className:"flex justify-center py-10",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):e.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-8",children:"No agents found."}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:e.map(i=>r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx("span",{className:"text-xl",children:i.emoji??"🤖"}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"text-[13px] font-semibold text-gray-200 truncate",children:i.name??i.id})}),i.isDefault&&r.jsx("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded-md bg-orange-500/12 border border-orange-500/25 text-orange-400",children:"Default"})]}),i.description&&r.jsx("p",{className:"text-[11px] text-gray-500 line-clamp-2",children:i.description})]},i.id))})}function l_(){const[e,t]=h.useState("tools");return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(Hs,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Skills & Plugins"}),r.jsx("p",{className:"text-[11px] text-gray-500",children:"Must-b tool catalog and agent management"})]})]}),r.jsx("div",{className:"flex gap-1.5",children:["tools","agents"].map(n=>r.jsxs("button",{onClick:()=>t(n),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${e===n?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:[n==="tools"?r.jsx(df,{size:11}):r.jsx(aa,{size:11}),n==="tools"?"Tools":"Agents"]},n))}),e==="tools"&&r.jsx(a_,{}),e==="agents"&&r.jsx(o_,{})]})}const M0=[{key:"all",label:"Tümü",icon:va,test:()=>!0},{key:"nightowl",label:"NightOwl Bulguları",icon:Rl,test:e=>e.tags.some(t=>/nightshift|nightowl/i.test(t))},{key:"preferences",label:"Kullanıcı Tercihleri",icon:yv,test:e=>e.category==="semantic"&&!e.tags.some(t=>/project|workspace|nightshift|nightowl/i.test(t))},{key:"architecture",label:"Proje Mimarisi",icon:dv,test:e=>e.tags.some(t=>/project|workspace|context|summary/i.test(t))},{key:"episodic",label:"Episodik",icon:At,test:e=>e.category==="episodic"},{key:"semantic",label:"Semantik",icon:Xt,test:e=>e.category==="semantic"}],c_={episodic:{border:"rgba(249,115,22,0.30)",bg:"rgba(249,115,22,0.08)",dot:"#f97316",label:"Episodik"},semantic:{border:"rgba(99,102,241,0.30)",bg:"rgba(99,102,241,0.08)",dot:"#6366f1",label:"Semantik"}};function d_(e){const n=(Date.now()-new Date(e+"Z").getTime())/1e3,s=n/60,i=s/60,a=i/24;return n<60?{label:"az önce",tier:"fresh"}:s<60?{label:`${Math.floor(s)}d önce`,tier:"fresh"}:i<24?{label:`${Math.floor(i)}s önce`,tier:"recent"}:a<7?{label:`${Math.floor(a)}g önce`,tier:"recent"}:a<30?{label:`${Math.floor(a/7)}h önce`,tier:"old"}:{label:`${Math.floor(a/30)}ay önce`,tier:"ancient"}}const u_={fresh:"#34d399",recent:"#f97316",old:"#a78bfa",ancient:"#6b7280"};function R0(e,t){return t.trim()?e.split(new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi")).map((s,i)=>s.toLowerCase()===t.toLowerCase()?r.jsx("mark",{className:"bg-orange-500/30 text-orange-300 rounded px-0.5",children:s},i):s):e}function h_({entry:e,query:t,index:n,onDelete:s}){const[i,a]=h.useState(!1),[o,l]=h.useState(!1),c=d_(e.createdAt),d=c_[e.category],u=e.content.slice(0,180),p=e.content.length>180,f=async m=>{m.stopPropagation(),l(!0);try{(await $(`/api/memory/ltm/delete/${e.id}`,{method:"DELETE"})).ok?(s(e.id),de.success("Kayıt silindi.")):de.error("Silinemedi.")}catch{de.error("Bağlantı hatası.")}l(!1)};return r.jsxs(H.div,{layout:!0,initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-8,scale:.97},transition:{delay:Math.min(n*.03,.3),duration:.25},className:"rounded-2xl overflow-hidden cursor-pointer group",style:{background:"rgba(10,4,1,0.78)",border:`1px solid ${d.border}`,backdropFilter:"blur(20px)",boxShadow:`0 4px 24px rgba(0,0,0,0.45), 0 0 0 1px ${d.bg}, inset 0 1px 0 rgba(255,255,255,0.03)`},onClick:()=>a(m=>!m),children:[r.jsxs("div",{className:"flex items-start gap-3 px-4 pt-3.5 pb-2.5",style:{borderBottom:`1px solid ${d.bg}`},children:[r.jsx("span",{className:"mt-0.5 w-2 h-2 rounded-full flex-shrink-0",style:{background:d.dot,boxShadow:`0 0 6px ${d.dot}`}}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"text-[13px] text-white/80 leading-relaxed break-words",children:R0(i?e.content:u+(p?"…":""),t)})}),p&&r.jsx(H.span,{animate:{rotate:i?90:0},transition:{duration:.18},className:"flex-shrink-0 text-white/20",children:r.jsx(Qt,{size:14})}),r.jsx("button",{onClick:f,disabled:o,className:"flex-shrink-0 p-1 rounded-lg opacity-0 group-hover:opacity-100 text-white/25 hover:text-red-400 hover:bg-red-500/12 transition-all disabled:opacity-30",title:"Bu kaydı sil",children:r.jsx(ms,{size:13})})]}),r.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 flex-wrap",children:[r.jsx("span",{className:"text-[10px] font-semibold tracking-widest uppercase px-2 py-0.5 rounded-full",style:{color:d.dot,background:d.bg,border:`1px solid ${d.border}`},children:d.label}),e.tags.slice(0,3).map(m=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-white/35 px-1.5 py-0.5 rounded-md",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)"},children:[r.jsx(xv,{size:8,className:"opacity-60"}),m]},m)),r.jsx("span",{className:"flex-1"}),r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-medium",style:{color:u_[c.tier]},title:e.createdAt,children:[r.jsx(At,{size:9}),c.label]})]})]})}function f_({entries:e}){const t=e.filter(a=>a.category==="episodic").length,n=e.filter(a=>a.category==="semantic").length,s=e.filter(a=>a.tags.some(o=>/nightshift|nightowl/i.test(o))).length,i=[{label:`${e.length} toplam`,color:"#f97316"},{label:`${t} episodik`,color:"#f97316"},{label:`${n} semantik`,color:"#6366f1"},{label:`${s} NightOwl`,color:"#a78bfa"}];return r.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:i.map(a=>r.jsx("span",{className:"text-[11px] font-semibold px-2.5 py-1 rounded-full",style:{color:a.color,background:`${a.color}14`,border:`1px solid ${a.color}30`},children:a.label},a.label))})}function p_({onConfirm:e,onCancel:t}){return r.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4",children:r.jsxs(H.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},className:"rounded-2xl p-6 w-full max-w-sm shadow-2xl",style:{background:"rgba(18,8,2,0.97)",border:"1px solid rgba(249,115,22,0.25)"},children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shrink-0",style:{background:"rgba(239,68,68,0.12)",border:"1px solid rgba(239,68,68,0.25)"},children:r.jsx(ls,{size:18,className:"text-red-400"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-[15px] font-bold text-white/90",children:"Tüm Hafızayı Temizle"}),r.jsx("p",{className:"text-[11px] text-white/35",children:"Bu işlem geri alınamaz"})]}),r.jsx("button",{onClick:t,className:"ml-auto p-1.5 rounded-lg text-white/30 hover:text-white/60 hover:bg-white/6 transition-all",children:r.jsx(He,{size:15})})]}),r.jsx("p",{className:"text-[13px] text-white/50 mb-5 leading-relaxed",children:"Tüm episodik ve semantik hafıza kayıtları kalıcı olarak silinecek. Bu işlem geri alınamaz."}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 rounded-xl bg-white/8 hover:bg-white/12 text-white/70 text-[13px] font-medium transition-colors",children:"İptal"}),r.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 rounded-xl bg-red-600/80 hover:bg-red-600 text-white text-[13px] font-semibold transition-colors border border-red-500/30",children:"Tümünü Sil"})]})]})})}function m_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState(""),[o,l]=h.useState("all"),[c,d]=h.useState(!1),[u,p]=h.useState(!1),f=h.useCallback(async()=>{s(!0);try{const y=await $("/api/memory/ltm/explore?category=all&limit=200");if(y.ok){const g=await y.json();t(g.entries??[])}}catch{}s(!1)},[]);h.useEffect(()=>{f()},[f]);const m=y=>{t(g=>g.filter(x=>x.id!==y))},b=async()=>{p(!0);try{const y=await $("/api/memory/ltm/clear-all",{method:"DELETE"});if(y.ok){const g=await y.json();t([]),de.success(`${g.deleted??0} kayıt temizlendi.`)}else de.error("Temizleme başarısız.")}catch{de.error("Bağlantı hatası.")}p(!1),d(!1)},v=h.useMemo(()=>{var x;const y=((x=M0.find(w=>w.key===o))==null?void 0:x.test)??(()=>!0),g=i.trim().toLowerCase();return e.filter(y).filter(w=>!g||w.content.toLowerCase().includes(g)||w.tags.some(j=>j.includes(g)))},[e,o,i]);return r.jsxs("div",{className:"h-[calc(100vh-72px)] overflow-y-auto px-6 py-6 space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.28)",boxShadow:"0 0 16px rgba(249,115,22,0.12)"},children:r.jsx(Xt,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[15px] font-bold text-white/90 tracking-tight",children:"Hafıza Tüneli"}),r.jsx("p",{className:"text-[11px] text-white/35",children:"Long-Term Memory Explorer — semantik & episodik"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:()=>d(!0),disabled:u||e.length===0,className:"flex items-center gap-1.5 text-[11px] font-semibold px-3 py-1.5 rounded-lg transition-all border border-red-500/20 text-red-400/70 hover:text-red-400 hover:bg-red-500/10 disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"rgba(239,68,68,0.04)"},children:[r.jsx(ms,{size:11}),"Tüm Hafızayı Temizle"]}),r.jsxs("button",{onClick:()=>void f(),disabled:n,className:"flex items-center gap-1.5 text-[11px] text-white/40 hover:text-white/70 transition-colors px-3 py-1.5 rounded-lg",style:{border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)"},children:[r.jsx(fe,{size:11,className:n?"animate-spin":""}),"Yenile"]})]})]}),!n&&r.jsx(f_,{entries:e}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-3 py-2.5",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.10)",backdropFilter:"blur(12px)"},children:[r.jsx(Zt,{size:13,className:"text-white/30 flex-shrink-0"}),r.jsx("input",{type:"text",value:i,onChange:y=>a(y.target.value),placeholder:"Hafızada ara…",className:"flex-1 bg-transparent text-[13px] text-white/80 placeholder:text-white/25 outline-none"}),i&&r.jsx("button",{onClick:()=>a(""),className:"text-white/25 hover:text-white/60 text-xs",children:"✕"})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(uC,{size:11,className:"text-white/25"}),M0.map(y=>{const g=y.icon,x=o===y.key,w=e.filter(y.test).length;return r.jsxs("button",{onClick:()=>l(y.key),className:"flex items-center gap-1.5 text-[11px] font-medium px-2.5 py-1 rounded-full transition-all",style:{background:x?"rgba(249,115,22,0.16)":"rgba(255,255,255,0.04)",border:x?"1px solid rgba(249,115,22,0.40)":"1px solid rgba(255,255,255,0.08)",color:x?"#fb923c":"rgba(255,255,255,0.45)"},children:[r.jsx(g,{size:10}),y.label,r.jsxs("span",{style:{opacity:.6},children:["(",w,")"]})]},y.key)})]})]}),n?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-24",children:[r.jsx(H.div,{animate:{rotate:360},transition:{repeat:1/0,duration:1.5,ease:"linear"},children:r.jsx(Xt,{size:28,className:"text-orange-500/50"})}),r.jsx("p",{className:"text-[12px] text-white/30",children:"Hafıza taranıyor…"})]}):v.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-24",children:[r.jsx(Ll,{size:28,className:"text-white/15"}),r.jsx("p",{className:"text-[13px] text-white/30",children:e.length===0?"Henüz hafıza yok. İlk konuşmadan sonra dolmaya başlar.":"Filtrene uyan kayıt yok."})]}):r.jsxs("div",{className:"space-y-3 pb-8",children:[r.jsxs("p",{className:"text-[11px] text-white/25",children:[v.length," kayıt gösteriliyor",i&&r.jsxs(r.Fragment,{children:[" · ",r.jsxs("span",{className:"text-orange-400/60",children:['"',i,'"']})," araması"]})]}),r.jsx(ne,{mode:"popLayout",children:v.map((y,g)=>r.jsx(h_,{entry:y,query:i,index:g,onDelete:m},y.id))})]}),r.jsx(ne,{children:c&&r.jsx(p_,{onConfirm:b,onCancel:()=>d(!1)})})]})}const Qa=`# Must-b Zihni
|
|
719
|
+
`)}`:"⏹ Durduruldu.");return{...B,status:"done",content:A}})),g.current=null},disabled:j||_}),r.jsx("p",{className:"text-center text-[11px] text-white/20 mt-2 select-none",children:e.chat.disclaimer})]})]})]})}function pE(){const[e,t]=h.useState(!1);return h.useEffect(()=>{const n=Be();return n.on("agentUpdate",s=>{s.type==="SCREEN_CAPTURE_START"&&t(!0),(s.type==="SCREEN_CAPTURED"||s.type==="SCREEN_CAPTURE_END")&&setTimeout(()=>t(!1),700)}),()=>{n.off("agentUpdate")}},[]),r.jsx(ne,{children:e&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},className:"fixed inset-0 z-[9999] pointer-events-none",children:[r.jsxs("div",{className:"absolute inset-0",children:[r.jsx("div",{className:"absolute top-0 left-0 w-12 h-12 border-t-2 border-l-2 border-orange-500/70"}),r.jsx("div",{className:"absolute top-0 right-0 w-12 h-12 border-t-2 border-r-2 border-orange-500/70"}),r.jsx("div",{className:"absolute bottom-0 left-0 w-12 h-12 border-b-2 border-l-2 border-orange-500/70"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-12 h-12 border-b-2 border-r-2 border-orange-500/70"})]}),r.jsx(H.div,{className:"absolute left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-orange-500/60 to-transparent",animate:{top:["0%","100%"]},transition:{duration:1.4,repeat:1/0,ease:"linear"}}),r.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2",children:r.jsxs(H.div,{initial:{y:-10,opacity:0},animate:{y:0,opacity:1},className:"flex items-center gap-2 px-4 py-2 bg-black/80 border border-orange-500/30 rounded-full shadow-[0_0_20px_rgba(234,88,12,0.3)] backdrop-blur-xl",children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-orange-500"})]}),r.jsx(oa,{size:12,className:"text-orange-400 animate-spin"}),r.jsx("span",{className:"text-orange-300 text-xs font-semibold tracking-wide",children:"Scanning screen…"})]})})]},"scan-overlay")})}const Xa={button:"rgba(234,88,12,0.7)",input:"rgba(59,130,246,0.7)",image:"rgba(168,85,247,0.6)",unknown:"rgba(255,255,255,0.3)"},mE={browse:qe,write:en,think:Xt,exec:os},gE={running:"bg-orange-500/8 border border-orange-500/20 text-orange-300",done:"bg-green-500/5 border border-green-500/10 text-gray-500",queued:"bg-white/2 border border-white/5 text-gray-600"},xE={mouseMove:CC,mouseClick:hv,typeText:xC,visionClick:Ds},yE={mouseMove:"text-gray-500",mouseClick:"text-orange-400",typeText:"text-blue-400",visionClick:"text-purple-400"};function vE(){const{t:e}=gt(),[t,n]=h.useState(!1),[s,i]=h.useState(null),[a,o]=h.useState(null),[l,c]=h.useState(!1),d=h.useRef(null),[u,p]=h.useState(null),[f,m]=h.useState(!1),[b,y]=h.useState(()=>new Array(3).fill(null)),[v,g]=h.useState(0),[x,w]=h.useState([]),[j,k]=h.useState(null),[N,S]=h.useState([]),_=h.useRef(null),[R,L]=h.useState(!1),[P,V]=h.useState(!1);h.useEffect(()=>{if(!s||!d.current)return;const T=d.current,F=T.getContext("2d");if(!F)return;const C=new Image;C.onload=()=>{var E;if(T.width=C.width,T.height=C.height,F.drawImage(C,0,0),(E=s.elements)!=null&&E.length)for(const z of s.elements)F.strokeStyle=Xa[z.type]??Xa.unknown,F.lineWidth=Math.max(2,Math.round(C.width/400)),F.strokeRect(z.x,z.y,z.width,z.height),F.fillStyle=Xa[z.type]??Xa.unknown,F.font=`${Math.max(10,Math.round(C.width/120))}px monospace`,F.fillText(z.type,z.x+4,z.y+14)},C.src=`data:image/png;base64,${s.base64}`},[s]),h.useEffect(()=>{const T=Be(),F=C=>{if(C.type==="SCREEN_CAPTURE_START"&&n(!0),C.type==="SCREEN_CAPTURED"&&(n(!1),i({base64:C.base64,width:C.width,height:C.height,source:C.source,elements:C.elements}),L(!1),V(!1)),C.type==="workflowStart"&&(k(C.goal??null),w(C.steps??[]),L(!1),V(!1)),C.type==="workflowStep"&&C.step){const E=C.step;w(z=>z.map(W=>W.id===E.id?E:W))}if(C.type==="workflowDone"&&setTimeout(()=>{w([]),k(null)},2500),C.type==="shadowFrame"&&typeof C.slot!="number"&&(p(C.base64),m(!0),L(!1)),C.type==="shadowToggle"&&typeof C.slot!="number"&&(m(C.enabled),C.enabled||p(null)),C.type==="ghostFrame"){const E=typeof C.slot=="number"?C.slot:-1;E>=0&&E<=2&&typeof C.base64=="string"&&(y(z=>{const W=[...z];return W[E]=C.base64,W}),L(!1))}if(C.type==="ghostSlot"){const E=typeof C.slot=="number"?C.slot:-1;E>=0&&E<=2&&g(E)}if(C.type==="shadowToggle"&&typeof C.slot=="number"){const E=C.slot;E>=0&&E<=2&&!C.enabled&&y(z=>{const W=[...z];return W[E]=null,W})}if(C.type==="inputAction"){const E={id:`${Date.now()}-${Math.random()}`,action:C.action??"mouseClick",label:C.label??"",timestamp:C.timestamp??Date.now()};S(z=>[...z.slice(-11),E]),L(!1),V(!1)}};return T.on("agentUpdate",F),()=>{T.off("agentUpdate",F)}},[]),h.useEffect(()=>{var T;(T=_.current)==null||T.scrollIntoView({behavior:"smooth"})},[N]);const M=async()=>{if(!t){try{const T=await $("/api/system/vision-guidance");if(T.ok){const F=await T.json();F.warn&&F.message&&o(F.message)}}catch{}await $("/api/system/screenshot",{method:"POST",body:JSON.stringify({detect:!0})}).catch(()=>{})}},B=b.some(T=>T!==null);return!(s||x.length>0||N.length>0||t||f||B)||P?null:r.jsx(ne,{children:r.jsxs(H.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.22},className:"mx-4 mb-3 bg-[#0a0d16] border border-orange-500/12 rounded-2xl overflow-hidden shadow-xl shadow-orange-500/4 shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"w-2 h-2 rounded-full bg-orange-500 animate-pulse"}),r.jsx("span",{className:"text-[10px] font-bold text-orange-400 uppercase tracking-widest",children:"War Room"}),s&&r.jsxs("span",{className:"text-[10px] text-gray-600 font-mono",children:[s.width,"×",s.height]}),f&&r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold text-purple-400 bg-purple-500/10 border border-purple-500/25 px-2 py-0.5 rounded-full",children:[r.jsx(Ga,{size:9,className:"animate-pulse"}),"Shadow Active"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:M,disabled:t,className:`flex items-center gap-1 px-2.5 py-1 rounded-lg text-[11px] font-medium transition-all ${t?"text-orange-400 bg-orange-500/10 animate-pulse cursor-not-allowed":"text-gray-600 hover:text-orange-400 hover:bg-orange-500/8 border border-white/5"}`,children:[r.jsx(oa,{size:10}),t?"Scanning…":"Capture"]}),s&&r.jsx("button",{onClick:()=>c(T=>!T),className:"text-gray-700 hover:text-gray-400 transition-colors",title:l?"Collapse preview":"Expand preview",children:l?r.jsx(ef,{size:12}):r.jsx(Ds,{size:12})}),r.jsx("button",{onClick:()=>L(T=>!T),className:"text-gray-700 hover:text-gray-400 transition-colors",title:R?"Expand war room":"Collapse war room",children:R?r.jsx(qr,{size:12}):r.jsx(Ml,{size:12})}),r.jsx("button",{onClick:()=>V(!0),className:"text-gray-700 hover:text-red-400 transition-colors",title:"Dismiss war room",children:r.jsx(He,{size:12})})]})]}),r.jsx(ne,{children:!R&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:[a&&r.jsxs("div",{className:"px-4 py-2 bg-amber-500/8 border-b border-amber-500/15 flex items-start justify-between gap-2",children:[r.jsx("p",{className:"text-[11px] text-amber-400 leading-relaxed flex-1",children:a}),r.jsx("button",{onClick:()=>o(null),className:"text-[10px] text-amber-600 hover:text-amber-400 shrink-0",children:"Dismiss"})]}),r.jsxs("div",{className:"flex gap-0 divide-x divide-white/5",children:[r.jsx("div",{className:"w-1/2 shrink-0",children:B&&b[v]?r.jsxs("div",{className:"flex flex-col",children:[r.jsx("div",{className:"flex border-b border-white/5",children:[0,1,2].map(T=>b[T]!==null&&r.jsxs("button",{onClick:()=>g(T),className:`flex items-center gap-0.5 px-2 py-1 text-[9px] font-bold transition-colors ${v===T?"text-purple-400 border-b-2 border-purple-500":"text-gray-600 hover:text-gray-400"}`,children:[r.jsx(Ga,{size:7})," G",T+1]},T))}),r.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 ${l?"max-h-[300px]":"max-h-[110px]"}`,children:[r.jsx("img",{src:`data:image/jpeg;base64,${b[v]}`,alt:`Ghost ${v+1}`,className:"w-full object-contain"}),r.jsxs("div",{className:"absolute top-1.5 left-1.5 flex items-center gap-1 px-2 py-0.5 bg-black/75 rounded-lg text-[9px] font-bold text-purple-400 border border-purple-500/30",children:[r.jsx(Ga,{size:8,className:"animate-pulse"})," G",v+1]}),r.jsx("div",{className:"absolute bottom-1.5 right-1.5 px-1.5 py-0.5 bg-black/70 rounded text-[8px] font-mono text-purple-300 border border-purple-500/20",children:"LIVE"})]})]}):f&&u?r.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 ${l?"max-h-[300px]":"max-h-[120px]"}`,children:[r.jsx("img",{src:`data:image/jpeg;base64,${u}`,alt:"Shadow browser",className:"w-full object-contain"}),r.jsxs("div",{className:"absolute top-1.5 left-1.5 flex items-center gap-1 px-2 py-0.5 bg-black/75 rounded-lg text-[9px] font-bold text-purple-400 border border-purple-500/30",children:[r.jsx(Ga,{size:8,className:"animate-pulse"})," SHADOW"]}),r.jsx("div",{className:"absolute bottom-1.5 right-1.5 px-1.5 py-0.5 bg-black/70 rounded text-[8px] font-mono text-purple-300 border border-purple-500/20",children:"LIVE"})]}):s?r.jsxs("div",{className:`relative overflow-hidden transition-all duration-300 ${l?"max-h-[300px]":"max-h-[120px]"}`,children:[r.jsx("canvas",{ref:d,className:"w-full object-contain",style:{imageRendering:"auto"}}),s.elements&&s.elements.length>0&&r.jsxs("div",{className:"absolute bottom-1.5 right-1.5 px-2 py-0.5 bg-black/70 rounded text-[9px] font-mono text-orange-400 border border-orange-500/20",children:[s.elements.length," elements"]})]}):t?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-orange-400 text-xs animate-pulse",children:[r.jsx(oa,{size:13,className:"animate-spin"})," Scanning…"]}):r.jsx("div",{className:"flex items-center justify-center py-8 text-gray-700 text-[11px]",children:"No capture yet"})}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[x.length>0&&r.jsxs("div",{className:"border-b border-white/5",children:[j&&r.jsx("div",{className:"px-3 py-1.5 border-b border-white/4 bg-white/[0.01]",children:r.jsxs("p",{className:"text-[10px] text-gray-500 truncate",children:[e.workflow.goal,": ",r.jsx("span",{className:"text-gray-300",children:j})]})}),r.jsx("div",{className:"p-2 space-y-1 max-h-[100px] overflow-y-auto scrollbar-hide",children:x.map(T=>{const F=mE[T.type]??Xt;return r.jsxs("div",{className:`flex items-center gap-2 px-2.5 py-1.5 rounded-xl text-[11px] font-medium ${gE[T.status]}`,children:[T.status==="running"?r.jsx(re,{size:11,className:"animate-spin text-orange-400 shrink-0"}):T.status==="done"?r.jsx(Fe,{size:11,className:"text-green-500 shrink-0"}):r.jsx(F,{size:11,className:"text-gray-600 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:T.label})]},T.id)})})]}),N.length>0&&r.jsxs("div",{className:"flex-1 overflow-hidden",children:[r.jsx("div",{className:"px-3 py-1 border-b border-white/4",children:r.jsx("span",{className:"text-[9px] font-bold text-gray-600 uppercase tracking-widest",children:"Control Feed"})}),r.jsxs("div",{className:"px-2 py-1 space-y-px overflow-y-auto max-h-[100px] scrollbar-hide font-mono",children:[N.map(T=>{const F=xE[T.action]??hv,C=yE[T.action]??"text-gray-500";return r.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[r.jsx(F,{size:10,className:`${C} shrink-0`}),r.jsx("span",{className:`text-[10px] ${C} truncate flex-1`,children:T.label}),r.jsx("span",{className:"text-[9px] text-gray-700 shrink-0 tabular-nums",children:new Date(T.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]},T.id)}),r.jsx("div",{ref:_})]})]})]})]})]})})]})})}const w0="mustb_briefing_shown",bE=14*60*60*1e3,yu={CodeHealth:{label:"Kod Sağlığı",Icon:Jt,color:"#fb923c"},DepAudit:{label:"Bağımlılık Denetimi",Icon:Hs,color:"#a78bfa"},LogAnalysis:{label:"Log Analizi",Icon:en,color:"#38bdf8"},LTMGap:{label:"Bellek Boşluğu",Icon:Xt,color:"#34d399"},WorkspaceDiff:{label:"Değişiklik Özeti",Icon:ov,color:"#fbbf24"}};function wE(e){const t=Object.keys(yu).find(n=>e.toLowerCase().includes(n.toLowerCase()));return t?yu[t]:{label:e,Icon:Ll,color:"#fb923c"}}function kE(e){const t=new Set(["NightShift-Insights","nightshift-insights","nightshift","night-shift"]);return e.find(n=>!t.has(n))??"General"}function k0(e){if(!e)return"—";const t=Math.round(e/1e3);return t<60?`${t} sn`:`${Math.floor(t/60)} dk ${t%60} sn`}function jE(e){const t=Date.now()-e,n=Math.floor(t/36e5),s=Math.floor(t%36e5/6e4);return n>0?`${n} saat ${s} dk önce`:s>0?`${s} dk önce`:"Az önce"}const NE={hidden:{opacity:0},show:{opacity:1,transition:{duration:.4}},exit:{opacity:0,transition:{duration:.35}}},SE={hidden:{opacity:0,y:32,scale:.97},show:{opacity:1,y:0,scale:1,transition:{type:"spring",stiffness:260,damping:26}},exit:{opacity:0,y:20,scale:.97,transition:{duration:.25}}},CE={hidden:{},show:{transition:{staggerChildren:.11,delayChildren:.45}}},EE={hidden:{opacity:0,x:24},show:{opacity:1,x:0,transition:{type:"spring",stiffness:300,damping:28}}};function _E(){const[e,t]=h.useState(!1),[n,s]=h.useState(null),[i,a]=h.useState([]),[o,l]=h.useState(!0),c=h.useRef(!1);h.useEffect(()=>{c.current||(c.current=!0,(async()=>{try{const u=await $("/api/automation/nightowl/status");if(!u.ok)return;const p=await u.json();if(!p.lastShiftTs||Date.now()-p.lastShiftTs>bE||localStorage.getItem(w0)===String(p.lastShiftTs)||p.totalFindings===0)return;const f=await $("/api/memory/ltm/search?q=NightShift-Insights&limit=15&category=semantic"),b=(f.ok?await f.json():{results:[]}).results.filter(y=>y.tags.some(v=>v.toLowerCase().includes("nightshift"))).slice(0,8).map(y=>({task:kE(y.tags),summary:y.content.replace(/\n/g," ").slice(0,180)}));s(p),a(b),l(!1),t(!0),localStorage.setItem(w0,String(p.lastShiftTs))}catch{}})())},[]);const d=()=>t(!1);return r.jsx(ne,{children:e&&r.jsx(H.div,{variants:NE,initial:"hidden",animate:"show",exit:"exit",className:"fixed inset-0 z-[400] flex items-center justify-center px-4",style:{background:"rgba(4,1,0,0.82)",backdropFilter:"blur(8px)"},onClick:u=>{u.target===u.currentTarget&&d()},children:r.jsxs(H.div,{variants:SE,initial:"hidden",animate:"show",exit:"exit",className:"relative w-full max-w-[620px] max-h-[88vh] flex flex-col rounded-3xl overflow-hidden",style:{background:"rgba(14,6,1,0.92)",border:"1px solid rgba(249,115,22,0.22)",backdropFilter:"blur(32px)",boxShadow:"0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(249,115,22,0.08), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsx("button",{onClick:d,className:"absolute top-4 right-4 z-10 w-7 h-7 rounded-full flex items-center justify-center text-white/25 hover:text-white/70 hover:bg-white/8 transition-all",children:r.jsx(He,{size:14})}),r.jsxs("div",{className:"flex-shrink-0 px-8 pt-8 pb-6",style:{borderBottom:"1px solid rgba(249,115,22,0.10)"},children:[r.jsxs(H.div,{initial:{opacity:0,y:-12},animate:{opacity:1,y:0},transition:{delay:.1,duration:.5},className:"flex items-start gap-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.25)",boxShadow:"0 0 24px rgba(249,115,22,0.15)"},children:r.jsx(Rl,{size:22,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-semibold text-orange-400/60 tracking-widest uppercase mb-1",children:"Sabah Raporu"}),r.jsx("h2",{className:"text-[22px] font-black text-white/90 leading-tight tracking-tight",children:"Gece Vardiyası Tamamlandı"}),(n==null?void 0:n.lastShiftTs)&&r.jsxs("p",{className:"text-[12px] text-white/35 mt-1",children:[jE(n.lastShiftTs)," · ",k0(n.lastShiftMs)," sürdü"]})]})]}),n&&r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"flex items-center gap-4 mt-5",children:[{label:"Bulgu",value:String(n.totalFindings)},{label:"Görev",value:String(Object.keys(yu).length)},{label:"Süre",value:k0(n.lastShiftMs)}].map(u=>r.jsxs("div",{className:"flex-1 rounded-xl px-3 py-2.5 text-center",style:{background:"rgba(249,115,22,0.06)",border:"1px solid rgba(249,115,22,0.12)"},children:[r.jsx("p",{className:"text-[18px] font-black text-orange-400",children:u.value}),r.jsx("p",{className:"text-[10px] text-white/30 font-medium mt-0.5",children:u.label})]},u.label))})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-5 space-y-2.5",style:{scrollbarWidth:"none"},children:[o&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"flex gap-1.5",children:[0,1,2].map(u=>r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-400/40 animate-bounce",style:{animationDelay:`${u*.15}s`}},u))})}),!o&&i.length===0&&r.jsx("p",{className:"text-center text-[13px] text-white/30 py-10",children:"Kayıtlı bulgu bulunamadı."}),!o&&i.length>0&&r.jsx(H.div,{variants:CE,initial:"hidden",animate:"show",className:"space-y-2.5",children:i.map((u,p)=>{const f=wE(u.task),m=f.Icon;return r.jsx(H.div,{variants:EE,children:r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-2xl",style:{background:"rgba(255,255,255,0.03)",border:`1px solid ${f.color}22`},children:[r.jsx("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:`${f.color}15`,border:`1px solid ${f.color}30`},children:r.jsx(m,{size:14,style:{color:f.color}})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[11px] font-bold mb-1 tracking-wide",style:{color:f.color},children:f.label}),r.jsx("p",{className:"text-[12.5px] text-white/65 leading-relaxed",children:u.summary})]}),r.jsx(Qt,{size:13,className:"text-white/15 flex-shrink-0 mt-1"})]})},p)})})]}),r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.6},className:"flex-shrink-0 px-8 py-5",style:{borderTop:"1px solid rgba(249,115,22,0.10)"},children:r.jsxs("button",{onClick:d,className:"w-full py-3 rounded-2xl flex items-center justify-center gap-2 font-bold text-[14px] transition-all active:scale-[0.98]",style:{background:"rgba(249,115,22,0.15)",border:"1px solid rgba(249,115,22,0.30)",color:"#fdba74"},onMouseEnter:u=>u.currentTarget.style.background="rgba(249,115,22,0.22)",onMouseLeave:u=>u.currentTarget.style.background="rgba(249,115,22,0.15)",children:[r.jsx(Oe,{size:15}),"Günün başlasın"]})})]})},"morning-briefing-overlay")})}const j0={CodeHealth:{label:"Kod Sağlığı",Icon:Jt,color:"#fb923c"},DepAudit:{label:"Bağımlılık",Icon:Hs,color:"#a78bfa"},LogAnalysis:{label:"Log Analizi",Icon:en,color:"#38bdf8"},LTMGap:{label:"Bellek",Icon:Xt,color:"#34d399"},WorkspaceDiff:{label:"Değişiklikler",Icon:ov,color:"#fbbf24"}};function TE(e){const t=Object.keys(j0).find(n=>e.toLowerCase().includes(n.toLowerCase()));return t?j0[t]:{label:e,Icon:Ll,color:"#fb923c"}}function PE(e){const t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}const AE={hidden:{opacity:0,x:24,scale:.96},show:{opacity:1,x:0,scale:1,transition:{type:"spring",stiffness:320,damping:28}},exit:{opacity:0,x:24,scale:.96,transition:{duration:.22}}},ME={hidden:{opacity:0,y:-6},show:{opacity:1,y:0,transition:{duration:.22}}};function RE(){const[e,t]=h.useState("idle"),[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState(!1),[c,d]=h.useState(!1),u=h.useRef(null),p=h.useRef(0),f=h.useCallback((b=2e4)=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{l(!1),setTimeout(()=>d(!1),600)},b)},[]);if(h.useEffect(()=>{const b=Be();return b.on("nightOwlEvent",y=>{if(y.type==="shiftStart"){u.current&&clearTimeout(u.current),t("scanning"),s([]),a(null),d(!0),l(!0);return}if(y.type==="finding"){const v={id:`${++p.current}`,task:String(y.task??"General"),summary:String(y.summary??"").slice(0,120),ts:Number(y.ts??Date.now())};s(g=>[v,...g].slice(0,20));return}if(y.type==="shiftEnd"){t("done"),a({findingsCount:Number(y.findingsCount??0),durationMs:Number(y.durationMs??0),ts:Number(y.ts??Date.now())}),f(2e4);return}}),()=>{b.off("nightOwlEvent"),u.current&&clearTimeout(u.current)}},[f]),!c)return null;const m="#fb923c";return r.jsx(ne,{children:r.jsx(H.div,{variants:AE,initial:"hidden",animate:"show",exit:"exit",className:"fixed z-[130] flex flex-col",style:{top:"80px",right:"20px",width:"300px",maxHeight:"70vh",pointerEvents:"auto"},children:r.jsxs("div",{className:"rounded-2xl overflow-hidden flex flex-col",style:{background:"rgba(10,4,1,0.90)",border:`1px solid ${m}28`,backdropFilter:"blur(24px)",boxShadow:"0 12px 40px rgba(0,0,0,0.60), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsxs("button",{onClick:()=>{l(b=>!b),u.current&&clearTimeout(u.current)},className:"flex items-center justify-between px-4 py-3 w-full select-none",style:{borderBottom:o?`1px solid ${m}10`:"none"},children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[e==="scanning"?r.jsxs("span",{className:"relative flex-shrink-0",children:[r.jsx("span",{className:"block w-2 h-2 rounded-full bg-orange-400"}),r.jsx("span",{className:"absolute inset-0 rounded-full bg-orange-400 animate-ping opacity-70"})]}):e==="done"?r.jsx(Fe,{size:13,className:"text-green-400 flex-shrink-0"}):r.jsx(Rl,{size:13,className:"text-orange-300/50 flex-shrink-0"}),r.jsx("span",{className:"text-[12px] font-semibold text-white/75",children:e==="scanning"?"Gece Vardiyası":"Vardiya Logu"}),e==="scanning"&&r.jsx("span",{className:"text-[10px] text-orange-400/70 font-mono animate-pulse",children:"taranıyor…"}),e==="done"&&i&&r.jsxs("span",{className:"text-[10px] text-white/30 font-mono",children:[i.findingsCount," bulgu · ",PE(i.durationMs)]})]}),o?r.jsx(Ml,{size:12,className:"text-white/25"}):r.jsx(qr,{size:12,className:"text-white/25"})]}),r.jsx(ne,{children:o&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22},className:"overflow-hidden",children:[r.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:"52vh",scrollbarWidth:"none"},children:[e==="scanning"&&n.length===0&&r.jsxs("div",{className:"flex items-center justify-center py-8 gap-2",children:[r.jsx("div",{className:"flex gap-1",children:[0,1,2].map(b=>r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-400/50 animate-bounce",style:{animationDelay:`${b*.15}s`}},b))}),r.jsx("span",{className:"text-[11px] text-white/30",children:"Sistem analiz ediliyor…"})]}),r.jsx(ne,{initial:!1,children:n.map(b=>{const y=TE(b.task),v=y.Icon;return r.jsxs(H.div,{variants:ME,initial:"hidden",animate:"show",exit:{opacity:0,height:0},className:"flex items-start gap-3 px-4 py-3",style:{borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[r.jsx("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:`${y.color}15`,border:`1px solid ${y.color}30`},children:r.jsx(v,{size:11,style:{color:y.color}})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[10px] font-bold mb-0.5",style:{color:y.color},children:y.label}),r.jsx("p",{className:"text-[11px] text-white/50 leading-snug line-clamp-3",children:b.summary})]})]},b.id)})}),e==="done"&&n.length===0&&r.jsx("p",{className:"text-center text-[12px] text-white/25 py-8",children:"Kayda değer bulgu yok."})]}),e==="done"&&i&&r.jsxs("div",{className:"px-4 py-2.5 flex items-center justify-between",style:{borderTop:`1px solid ${m}10`},children:[r.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:new Date(i.ts).toLocaleTimeString("tr-TR")}),r.jsx("span",{className:"text-[10px] text-green-400/70 font-semibold",children:"✓ Tamamlandı"})]})]},"log-body")})]})},"night-shift-log")})}const N0="mustb_boot_report",S0=14e3;function zE({value:e,max:t=10}){const n=Math.round(e/t*100),s=n>=70?"#22c55e":n>=40?"#f97316":"#ef4444";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.08)"},children:r.jsx("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${n}%`,background:s}})}),r.jsx("span",{className:"text-[11px] font-mono",style:{color:s},children:e.toFixed(1)})]})}function LE(){const[e,t]=h.useState(!1),[n,s]=h.useState(null),i=h.useCallback(()=>{t(!1),localStorage.removeItem(N0)},[]);return h.useEffect(()=>{if(localStorage.getItem(N0)!=="1")return;t(!0),$("/api/status").then(o=>o.ok?o.json():null).then(o=>{o&&s(o)}).catch(()=>{});const a=setTimeout(i,S0);return()=>clearTimeout(a)},[i]),r.jsx(ne,{children:e&&r.jsx(H.div,{initial:{opacity:0,scale:.96,y:16},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:16},transition:{duration:.28,ease:"easeOut"},className:"fixed inset-0 z-[500] flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.55)",backdropFilter:"blur(8px)"},children:r.jsxs("div",{className:"relative w-full max-w-sm rounded-2xl overflow-hidden",style:{background:"rgba(14,6,2,0.92)",border:"1px solid rgba(234,88,12,0.30)",boxShadow:"0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(234,88,12,0.10)",backdropFilter:"blur(24px)"},children:[r.jsx("button",{onClick:i,className:"absolute top-3 right-3 text-white/25 hover:text-white/60 transition-colors z-10",children:r.jsx(He,{size:14})}),r.jsxs("div",{className:"px-5 pt-5 pb-3 flex items-center gap-3",children:[r.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(234,88,12,0.15)",border:"1px solid rgba(234,88,12,0.25)"},children:r.jsx(Fe,{size:18,style:{color:"#22c55e"}})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90",children:"System Ready"}),r.jsx("p",{className:"text-[11px] text-white/40",children:"Must-b initialised successfully"})]})]}),r.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.05)",margin:"0 20px"}}),r.jsxs("div",{className:"px-5 py-4 space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"rounded-xl px-3 py-2.5",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-white/30 mb-1",children:"Agent"}),r.jsx("p",{className:"text-[12px] font-semibold text-white/80 truncate",children:(n==null?void 0:n.role)??"—"})]}),r.jsxs("div",{className:"rounded-xl px-3 py-2.5",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-white/30 mb-1",children:"Model"}),r.jsx("p",{className:"text-[12px] font-semibold text-white/80 truncate",children:(n==null?void 0:n.model)??"—"})]})]}),r.jsxs("div",{className:"rounded-xl px-3 py-2.5 space-y-2",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-semibold text-white/40",children:[r.jsx(fn,{size:10})," CPU"]}),r.jsxs("span",{className:"text-[10px] font-mono text-white/50",children:[(n==null?void 0:n.cpuPct)??0,"%"]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-semibold text-white/40",children:[r.jsx(uv,{size:10})," RAM"]}),r.jsxs("span",{className:"text-[10px] font-mono text-white/50",children:[((n==null?void 0:n.ramGb)??0).toFixed(2)," GB"]})]}),n&&r.jsxs("div",{className:"flex items-center justify-between pt-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-semibold text-white/40",children:[r.jsx(Oe,{size:10})," Score"]}),r.jsx(zE,{value:n.score})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1",children:[r.jsx("span",{className:"text-[10px] text-white/30",children:"Dashboard port"}),r.jsxs("span",{className:"text-[11px] font-mono text-orange-400/70",children:[":",(n==null?void 0:n.port)??4309]})]})]}),r.jsx("div",{className:"px-5 pb-4",style:{borderTop:"1px solid rgba(255,255,255,0.05)",paddingTop:"12px"},children:r.jsx("button",{onClick:i,className:"w-full py-2 rounded-xl text-[12px] font-semibold transition-all",style:{background:"rgba(234,88,12,0.15)",border:"1px solid rgba(234,88,12,0.30)",color:"#fb923c"},children:"Open Dashboard"})}),r.jsx(H.div,{initial:{scaleX:1},animate:{scaleX:0},transition:{duration:S0/1e3,ease:"linear"},style:{position:"absolute",bottom:0,left:0,right:0,height:2,background:"rgba(234,88,12,0.50)",transformOrigin:"left"}})]})},"boot-report")})}function OE(e,t){if(t.includes("🛡")||t.toLowerCase().includes("ghostguard"))return"#fb923c";switch(e){case"thought":return"#22d3ee";case"planStart":return"#67e8f9";case"planGenerated":return"#a5f3fc";case"stepStart":return"#06b6d4";case"stepFinish":return t.includes("error")||t.includes("fail")?"#f87171":"#4ade80";case"finalAnswer":return"#86efac";case"planFinish":return t.includes("failed")||t.includes("error")?"#f87171":"#4ade80";case"error":return"#fb923c";case"memorySearch":return"#a78bfa";case"systemHealth":return"#fbbf24";default:return"#4b5563"}}function DE(e){switch(e){case"thought":return"◎";case"planStart":return"▶";case"planGenerated":return"◈";case"stepStart":return"→";case"stepFinish":return"✓";case"finalAnswer":return"◆";case"planFinish":return"■";case"error":return"⚠";case"memorySearch":return"⟳";case"systemHealth":return"🛡";default:return"·"}}function IE(e,t){var n,s;if(!t)return e;switch(e){case"thought":return String(t.message??t).slice(0,120);case"planStart":return`Goal: ${String(t.goal??"").slice(0,90)}`;case"planGenerated":return`Plan ready — ${Array.isArray(t.steps)?t.steps.length:"?"} steps`;case"stepStart":return String(((n=t.step)==null?void 0:n.description)??t.description??"Step starting…").slice(0,100);case"stepFinish":{const i=String(((s=t.step)==null?void 0:s.description)??t.description??"").slice(0,70),a=String(t.status??"");return`${i} [${a}]`}case"finalAnswer":return String(t.answer??"").slice(0,110);case"planFinish":return`${String(t.status??"")} — ${String(t.goal??"").slice(0,60)}`;case"error":return`Repair: ${String(t.action??"")} — ${String(t.reason??"")}`.slice(0,110);case"memorySearch":return t.active?"Searching memory…":"Memory search done";case"systemHealth":return`${String(t.level??"").toUpperCase()} — ${String(t.message??"")}`.slice(0,100);default:return JSON.stringify(t).slice(0,90)}}const C0=200;function BE(e){return new Date(e).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function FE(){const[e,t]=h.useState(!0),[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState(!0),c=h.useRef(null),d=h.useRef(0),u=h.useRef(0);h.useEffect(()=>{o&&c.current&&(c.current.scrollTop=c.current.scrollHeight)},[n,o]);const p=h.useCallback((f,m)=>{const b=IE(f,m),y=OE(f,b);s(v=>{const g=[...v,{id:`t-${++d.current}`,type:f,text:b,color:y,ts:Date.now()}];return g.length>C0?g.slice(-C0):g})},[]);return h.useEffect(()=>{const f=Be(),m=y=>{p(y.type,y.payload)},b=y=>{a(y);const v=Date.now();(y.cpu>80||y.ram>85)&&v-u.current>1e4&&(u.current=v,p("systemHealth",{level:"warning",message:`🛡️ GhostGuard: CPU ${y.cpu}% / RAM ${y.ram}%`}))};return f.on("telemetry:stream",m),f.on("systemStats",b),()=>{f.off("telemetry:stream",m),f.off("systemStats",b)}},[p]),r.jsxs(r.Fragment,{children:[r.jsx(ne,{children:!e&&r.jsxs(H.button,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.18},onClick:()=>t(!0),title:"Open telemetry",className:"fixed right-0 top-1/2 -translate-y-1/2 z-50 flex flex-col items-center justify-center gap-1 w-6 h-16 rounded-l-md border border-r-0 border-white/10 hover:border-cyan-500/40 hover:bg-cyan-400/5 transition-all duration-200 group",style:{background:"#0c0d10"},children:[r.jsx(nv,{size:11,className:"text-cyan-500/50 group-hover:text-cyan-400 transition-colors"}),r.jsx("span",{className:"font-mono text-[7px] leading-none text-white/20 group-hover:text-cyan-400/60 transition-colors",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:"TEL"})]},"fab")}),r.jsx("div",{className:`relative z-50 flex-shrink-0 flex flex-col transition-[width] duration-300 overflow-hidden${e?" border-l border-white/5":""}`,style:{background:"#0c0d10",width:e?288:0},children:r.jsx(ne,{children:e&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex flex-col flex-1 min-h-0 overflow-hidden",style:{width:288},children:[r.jsxs("div",{className:"flex items-center justify-between px-2.5 py-1.5 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cyan-500"})]}),r.jsx("span",{className:"font-mono text-[9px] font-bold text-cyan-400 tracking-[0.2em] uppercase",children:"Live"}),r.jsxs("span",{className:"font-mono text-[9px] text-white/15",children:[n.length," events"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[i&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:`font-mono text-[9px] ${i.cpu>80?"text-orange-400":"text-white/25"}`,children:["CPU ",i.cpu,"%"]}),r.jsxs("span",{className:`font-mono text-[9px] ${i.ram>85?"text-orange-400":"text-white/25"}`,children:["RAM ",i.ram,"%"]})]}),r.jsx("button",{onClick:()=>s([]),title:"Clear log",className:"text-white/15 hover:text-white/40 transition-colors",children:r.jsx(ms,{size:10})}),r.jsx("button",{onClick:()=>t(!1),title:"Collapse telemetry",className:"text-white/15 hover:text-orange-400/70 transition-colors",children:r.jsx(Qt,{size:10})})]})]}),r.jsx("div",{ref:c,className:"flex-1 overflow-y-auto scrollbar-hide px-2 py-1",onMouseEnter:()=>l(!1),onMouseLeave:()=>l(!0),children:n.length===0?r.jsx("div",{className:"flex items-center justify-center h-12 font-mono text-[10px] text-white/10",children:"awaiting events…"}):r.jsx(ne,{initial:!1,children:n.map(f=>r.jsxs(H.div,{initial:{opacity:0,x:6},animate:{opacity:1,x:0},transition:{duration:.12},className:"flex items-start gap-1.5 py-[2px] group",children:[r.jsx("span",{className:"font-mono text-[8px] text-white/10 shrink-0 mt-[2px] group-hover:text-white/20 transition-colors",children:BE(f.ts)}),r.jsxs("span",{className:"font-mono text-[10px] leading-[1.45] break-all",style:{color:f.color},children:[DE(f.type)," ",f.text]})]},f.id))})})]},"panel")})})]})}function E0(){return h.useEffect(()=>{Be()},[]),r.jsxs("div",{className:"flex flex-col h-[calc(100vh-72px)] overflow-hidden",children:[r.jsx(pE,{}),r.jsx(vE,{}),r.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[r.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:r.jsx(fE,{})}),r.jsx(FE,{})]}),r.jsx(LE,{}),r.jsx(_E,{}),r.jsx(RE,{})]})}function wa(){const[e,t]=h.useState(!1),[n,s]=h.useState(!0),i=h.useRef(!0),a=h.useCallback(async()=>{try{const o=await $("/api/gateway/status",{},{retries:1,retryDelay:500});if(!i.current)return;const l=await o.json().catch(()=>({}));t(!!(l!=null&&l.online))}catch{i.current&&t(!1)}finally{i.current&&s(!1)}},[]);return h.useEffect(()=>{i.current=!0,a();const o=setInterval(a,15e3),l=()=>{a()},c=()=>{a()},d=()=>{i.current&&t(!1)};try{Be()}catch{}return window.addEventListener("mustb:connected",l),window.addEventListener("mustb:reconnected",c),window.addEventListener("mustb:disconnected",d),()=>{i.current=!1,clearInterval(o),window.removeEventListener("mustb:connected",l),window.removeEventListener("mustb:reconnected",c),window.removeEventListener("mustb:disconnected",d)}},[a]),{online:e,loading:n}}function _0({connected:e,configured:t}){return e?r.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400 flex-shrink-0"}):t?r.jsx("span",{className:"w-2 h-2 rounded-full bg-orange-400 flex-shrink-0"}):r.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-600 flex-shrink-0"})}function VE(){const{online:e}=wa(),[t,n]=h.useState(null),[s,i]=h.useState([]),[a,o]=h.useState(null),[l,c]=h.useState(null),[d,u]=h.useState(!0);h.useEffect(()=>{(async()=>{var g;u(!0);try{const w=await(await $("/api/gateway/channels")).json();n(w),(g=w.channelOrder)!=null&&g.length&&o(w.channelOrder[0])}catch{n({offline:!0,channelOrder:[],channelLabels:{},channelAccounts:{}})}finally{u(!1)}})()},[e]),h.useEffect(()=>{t!=null&&t.offline&&$("/api/channels").then(v=>v.json()).then(i).catch(()=>i([]))},[t==null?void 0:t.offline]);const p=async(v,g)=>{c(`${v}-${g}`);try{await $(`/api/gateway/channels/${v}/logout`,{method:"POST",body:JSON.stringify({accountId:g})});const x=await $("/api/gateway/channels");n(await x.json())}catch{}finally{c(null)}};if(d)return r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(fe,{size:18,className:"animate-spin text-orange-400"}),r.jsx("span",{className:"ml-2 text-sm text-gray-500",children:"Kanallar yükleniyor…"})]});if(t!=null&&t.offline)return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-xl bg-orange-500/8 border border-orange-500/20",children:[r.jsx(Ks,{size:14,className:"text-orange-400 flex-shrink-0"}),r.jsx("p",{className:"text-[12px] text-orange-300",children:"Must-b gateway çevrimdışı — yerel kanallar gösteriliyor."})]}),s.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-6",children:"Yapılandırılmış kanal yok."}):r.jsx("div",{className:"grid grid-cols-2 gap-2",children:s.map(v=>r.jsxs("div",{className:"px-3 py-2.5 rounded-xl bg-white/3 border border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(_0,{configured:v.configured,connected:!1}),r.jsx("span",{className:"text-[13px] font-semibold text-gray-200",children:v.name}),v.configured&&r.jsx("span",{className:"ml-auto text-[9px] font-bold px-1.5 py-0.5 rounded-md bg-orange-500/10 border border-orange-500/20 text-orange-400",children:"Yapılandırıldı"})]}),r.jsx("p",{className:"text-[11px] text-gray-500 line-clamp-2",children:v.description})]},v.id))})]});const f=(t==null?void 0:t.channelOrder)??[],m=(t==null?void 0:t.channelLabels)??{},b=(t==null?void 0:t.channelAccounts)??{};if(f.length===0)return r.jsx("p",{className:"text-center text-sm text-gray-600 py-8",children:"Yapılandırılmış kanal bulunamadı."});const y=a?b[a]??[]:[];return r.jsxs("div",{className:"flex gap-4 min-h-[320px]",children:[r.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:f.map(v=>{const g=b[v]??[],x=g.some(j=>j.connected),w=g.some(j=>j.configured);return r.jsx("button",{onClick:()=>o(v),className:`w-full text-left px-3 py-2 rounded-xl border transition-all ${a===v?"bg-orange-500/12 border-orange-500/30":"bg-white/3 border-white/6 hover:bg-white/5 hover:border-white/12"}`,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_0,{connected:x,configured:w}),r.jsx("span",{className:"text-[12px] font-semibold text-gray-200 truncate",children:m[v]??v}),g.length>0&&r.jsx("span",{className:"ml-auto text-[10px] font-bold text-gray-500",children:g.length})]})},v)})}),r.jsx("div",{className:"flex-1 min-w-0",children:a?y.length===0?r.jsxs("div",{className:"px-4 py-4 rounded-xl bg-white/3 border border-white/6",children:[r.jsx("p",{className:"text-[13px] font-semibold text-gray-300 mb-1",children:m[a]??a}),r.jsx("p",{className:"text-[12px] text-gray-500",children:"Henüz bağlı hesap yok."})]}):r.jsx("div",{className:"space-y-2",children:y.map(v=>r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/3 border border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[v.connected?r.jsx(Fe,{size:13,className:"text-green-400 flex-shrink-0"}):v.lastError?r.jsx(iv,{size:13,className:"text-red-400 flex-shrink-0"}):r.jsx(ls,{size:13,className:"text-orange-400 flex-shrink-0"}),r.jsx("span",{className:"text-[13px] font-semibold text-gray-200 truncate",children:v.name??v.accountId}),r.jsxs("button",{onClick:()=>p(a,v.accountId),disabled:l===`${a}-${v.accountId}`,className:"ml-auto flex items-center gap-1 px-2 py-1 rounded-lg bg-red-500/8 border border-red-500/20 text-red-400 text-[10px] font-semibold hover:bg-red-500/15 transition-all disabled:opacity-40",children:[r.jsx(nf,{size:9}),"Logout"]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-20 flex-shrink-0",children:"Status"}),r.jsx("span",{className:`text-[11px] font-semibold ${v.connected?"text-green-400":"text-gray-500"}`,children:v.connected?"Connected":"Disconnected"})]}),v.lastConnectedAt&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-20 flex-shrink-0",children:"Last seen"}),r.jsx("span",{className:"text-[11px] text-gray-400",children:new Date(v.lastConnectedAt).toLocaleString()})]}),v.lastError&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-20 flex-shrink-0 pt-0.5",children:"Error"}),r.jsx("span",{className:"text-[11px] text-red-400 break-all",children:v.lastError})]})]})]},v.accountId))}):r.jsx("p",{className:"text-sm text-gray-600 pt-4",children:"Bir kanal seçin."})})]})}function $E(e){return e===0?"Free":e<1?`$${e.toFixed(3)}/1M`:`$${e.toFixed(2)}/1M`}function UE(e){return e?e>=1e3?`${(e/1e3).toFixed(0)}M`:`${e}k`:"—"}const T0={free:{label:"Free",icon:r.jsx(fC,{size:11}),color:"#22c55e",bg:"rgba(34,197,94,0.12)"},balanced:{label:"Balanced",icon:r.jsx(MC,{size:11}),color:"#60a5fa",bg:"rgba(96,165,250,0.12)"},power:{label:"Power",icon:r.jsx(Oe,{size:11}),color:"#f59e0b",bg:"rgba(245,158,11,0.12)"}};function HE({currentModel:e,onSelect:t,className:n}){const[s,i]=h.useState(null),[a,o]=h.useState(!0),[l,c]=h.useState(null),[d,u]=h.useState("free"),[p,f]=h.useState(""),m=h.useRef(null),b=(g=!1)=>{o(!0),c(null),fetch(`/api/providers/openrouter/models${g?"?refresh=1":""}`).then(x=>x.ok?x.json():Promise.reject(new Error(`HTTP ${x.status}`))).then(x=>{if(i(x),e){const w=x.free.some(j=>j.id===e)?"free":x.balanced.some(j=>j.id===e)?"balanced":x.power.some(j=>j.id===e)?"power":"free";u(w)}o(!1)}).catch(x=>{c(x.message),o(!1)})};h.useEffect(()=>{b()},[]),h.useEffect(()=>{m.current&&m.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[d,s]);const y=(s==null?void 0:s[d])??[],v=p?y.filter(g=>g.name.toLowerCase().includes(p.toLowerCase())||g.id.toLowerCase().includes(p.toLowerCase())):y;return r.jsxs("div",{className:`flex flex-col rounded-xl overflow-hidden ${n??""}`,style:{background:"rgba(12,5,2,0.85)",border:"1px solid rgba(255,255,255,0.07)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2",children:[r.jsx("span",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-widest",children:"OpenRouter Models"}),r.jsx("button",{onClick:()=>b(!0),className:"text-gray-600 hover:text-orange-400 transition-colors p-1 rounded",title:"Refresh catalog",disabled:a,children:r.jsx(fe,{size:11,className:a?"animate-spin":""})})]}),r.jsx("div",{className:"flex gap-1 px-3 pb-2",children:["free","balanced","power"].map(g=>{var k;const x=T0[g],w=((k=s==null?void 0:s.totals)==null?void 0:k[g])??0,j=d===g;return r.jsxs("button",{onClick:()=>u(g),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all",style:{background:j?x.bg:"transparent",color:j?x.color:"#6b7280",border:`1px solid ${j?x.color+"40":"transparent"}`},children:[x.icon,x.label,w>0&&r.jsx("span",{className:"text-[9px] font-bold opacity-60",children:w})]},g)})}),r.jsx("div",{className:"px-3 pb-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(Zt,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-600"}),r.jsx("input",{value:p,onChange:g=>f(g.target.value),placeholder:"Search models…",className:"w-full pl-7 pr-3 py-1.5 rounded-lg text-[11px] text-gray-300 placeholder-gray-600 outline-none",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.07)"}})]})}),r.jsxs("div",{className:"overflow-y-auto",style:{maxHeight:"320px"},children:[a&&r.jsxs("div",{className:"py-8 text-center text-[11px] text-gray-600",children:[r.jsx(fe,{size:14,className:"animate-spin mx-auto mb-2"}),"Fetching live catalog…"]}),!a&&l&&r.jsxs("div",{className:"py-6 px-4 text-center text-[11px] text-red-400",children:[l,r.jsx("br",{}),r.jsx("button",{onClick:()=>b(!0),className:"mt-2 underline text-orange-400 hover:text-orange-300",children:"Retry"})]}),!a&&!l&&v.length===0&&r.jsx("div",{className:"py-8 text-center text-[11px] text-gray-600",children:"No models found."}),!a&&!l&&v.map(g=>{const x=g.id===e,w=T0[g.tier];return r.jsx("button",{ref:x?m:void 0,onClick:()=>t(g.id),className:"w-full text-left px-3 py-2 transition-all",style:{background:x?"rgba(234,88,12,0.10)":"transparent",borderLeft:x?"2px solid #ea580c":"2px solid transparent"},children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:`text-[12px] font-semibold truncate ${x?"text-orange-300":"text-gray-300"}`,children:g.name}),g.hasVision&&r.jsx(Ds,{size:9,className:"text-purple-400 flex-shrink-0",title:"Vision / multimodal"})]}),r.jsx("span",{className:"text-[9px] text-gray-600 font-mono truncate block",children:g.id}),g.description&&r.jsx("span",{className:"text-[10px] text-gray-600 line-clamp-1 mt-0.5",children:g.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[r.jsx("span",{className:"text-[9px] font-bold",style:{color:w.color},children:$E(g.costPer1M)}),r.jsxs("span",{className:"text-[9px] text-gray-600",children:[UE(g.contextK)," ctx"]})]})]})},g.id)})]}),s&&r.jsx("div",{className:"px-3 py-1.5 border-t",style:{borderColor:"rgba(255,255,255,0.04)"},children:r.jsxs("span",{className:"text-[9px] text-gray-700 font-mono",children:["Catalog cached · ",new Date(s.fetchedAt).toLocaleTimeString()]})})]})}const Bc=[{code:"en",label:"English",flag:"🇬🇧",native:"English"},{code:"tr",label:"Turkish",flag:"🇹🇷",native:"Türkçe"},{code:"de",label:"German",flag:"🇩🇪",native:"Deutsch"},{code:"fr",label:"French",flag:"🇫🇷",native:"Français"},{code:"es",label:"Spanish",flag:"🇪🇸",native:"Español"},{code:"pt",label:"Portuguese (Brazil)",flag:"🇧🇷",native:"Português"},{code:"ja",label:"Japanese",flag:"🇯🇵",native:"日本語"},{code:"zh",label:"Chinese (Simplified)",flag:"🇨🇳",native:"简体中文"}];function WE(){const{locale:e,setLocale:t}=gt(),[n,s]=h.useState(!1),i=h.useRef(null),a=Bc.find(o=>o.code===e)??Bc[0];return h.useEffect(()=>{if(!n)return;const o=l=>{l.key==="Escape"&&s(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]),r.jsxs("div",{ref:i,className:"relative",children:[r.jsxs("button",{onClick:()=>s(o=>!o),"aria-label":"Switch language",className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-full border text-[12px] font-semibold transition-all select-none ${n?"bg-orange-500/15 border-orange-400/30 text-orange-700":"text-black/65 border-transparent hover:text-black hover:bg-black/6"}`,children:[r.jsx(yC,{size:12,className:"text-orange-400 shrink-0"}),r.jsx("span",{children:a.flag}),r.jsx("span",{className:"tracking-wide",children:a.code.toUpperCase()})]}),r.jsx(ne,{children:n&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>s(!1)}),r.jsxs(H.div,{initial:{opacity:0,y:-6,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-6,scale:.96},transition:{duration:.13,ease:"easeOut"},className:"absolute right-0 top-full mt-2 z-20 w-52 bg-[#100806]/96 backdrop-blur-2xl border border-orange-500/15 rounded-xl shadow-2xl shadow-black/60 overflow-hidden max-h-72 overflow-y-auto",children:[r.jsx("div",{className:"px-3 py-2 border-b border-white/6",children:r.jsx("p",{className:"text-[9px] font-bold text-gray-600 uppercase tracking-widest",children:"Language"})}),Bc.map(o=>{const l=e===o.code;return r.jsxs("button",{onClick:()=>{t(o.code),s(!1)},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[12px] font-medium transition-colors ${l?"bg-orange-500/12 text-orange-400":"text-gray-300 hover:bg-white/5 hover:text-white"}`,children:[r.jsx("span",{className:"text-base leading-none",children:o.flag}),r.jsxs("div",{className:"text-left flex-1",children:[r.jsx("p",{className:"leading-none",children:o.native}),!l&&r.jsx("p",{className:"text-[10px] text-gray-600 mt-0.5",children:o.label})]}),l&&r.jsx(at,{size:12,className:"text-orange-400 shrink-0"})]},o.code)})]})]})})]})}const P0={frontier:"⚡ Frontier",gateway:"🌐 Gateway",fast:"🚀 Fast",local:"💻 Local",open:"🔓 Open Source",specialist:"🎯 Specialist",regional:"🌏 Regional",enterprise:"🏢 Enterprise",custom:"⚙️ Custom"},A0=["frontier","gateway","fast","local","open","specialist","regional","enterprise","custom"];function Ov({tag:e}){return r.jsx("span",{className:"px-1.5 py-0.5 rounded-md bg-white/5 border border-white/8 text-[9px] text-gray-400 font-medium",children:e})}function KE({p:e,active:t,onClick:n}){return r.jsx("button",{onClick:n,className:`w-full text-left px-3 py-2.5 rounded-xl border transition-all ${t?"bg-orange-500/12 border-orange-500/30":"bg-white/3 border-white/6 hover:bg-white/5 hover:border-white/12"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`text-[13px] font-semibold leading-tight truncate ${t?"text-orange-300":"text-gray-200"}`,children:e.label}),r.jsx("p",{className:"text-[11px] text-gray-400 mt-0.5 leading-snug line-clamp-2",children:e.description}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:e.tags.slice(0,3).map(s=>r.jsx(Ov,{tag:s},s))})]}),t&&r.jsx(Qt,{size:13,className:"text-orange-400 shrink-0 mt-1"})]})})}function GE(){const{t:e}=gt(),t=e.panels.settings,[n,s]=h.useState([]),[i,a]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState("all"),[u,p]=h.useState(""),[f,m]=h.useState(null),[b,y]=h.useState(""),[v,g]=h.useState(""),[x,w]=h.useState(!1),[j,k]=h.useState(!1),[N,S]=h.useState(!1),[_,R]=h.useState(null),[L,P]=h.useState(null),[V,M]=h.useState(!!window.__MUSTB_NEED_API_KEY),[B,A]=h.useState(null),[T,F]=h.useState("providers"),C=h.useRef(null);h.useEffect(()=>{$("/api/setup/providers").then(ee=>ee.ok?ee.json():null).then(ee=>{ee!=null&&ee.providers&&s(ee.providers)}).catch(()=>{}),$("/api/setup/status").then(ee=>ee.ok?ee.json():null).then(ee=>{ee&&a(ee)}).catch(()=>{}),$("/api/setup/ollama-models").then(ee=>ee.ok?ee.json():null).then(ee=>{ee!=null&&ee.models&&l(ee.models)}).catch(()=>{});const Y=()=>{M(!0),window.__MUSTB_NEED_API_KEY=!0};return window.addEventListener("mustb:401",Y),()=>window.removeEventListener("mustb:401",Y)},[]),h.useEffect(()=>{f&&y(f.defaultModel)},[f]);const E=u.toLowerCase(),z=n.filter(Y=>!(c!=="all"&&Y.category!==c||E&&!Y.label.toLowerCase().includes(E)&&!Y.description.toLowerCase().includes(E))),W={};for(const Y of z)W[Y.category]||(W[Y.category]=[]),W[Y.category].push(Y);const K=async()=>{if(f){k(!0),R(null);try{const ee=await(await $("/api/setup/test-key",{method:"POST",body:JSON.stringify({provider:f.id,apiKey:v||void 0,model:b||void 0})})).json();R({ok:ee.ok,msg:ee.message??(ee.ok?"Connection successful":"Connection failed")})}catch{R({ok:!1,msg:"Gateway unreachable"})}k(!1)}},X=async()=>{if(!(!f||!f.envKeyIsUrl&&!v.trim())){S(!0),P(null);try{const ee=await $("/api/setup/update-key",{method:"POST",body:JSON.stringify({provider:f.id,apiKey:v||void 0,model:b||void 0})});if(ee.ok){P("Saved successfully."),g(""),window.__MUSTB_NEED_API_KEY=!1,M(!1);const Lt=await $("/api/setup/status");Lt.ok&&a(await Lt.json())}else{const Lt=await ee.json();P(Lt.error??"Failed to save.")}}catch{P("Gateway unreachable.")}S(!1),setTimeout(()=>P(null),6e3)}},I=Y=>{A(Y),$("/api/setup/save",{method:"POST",body:JSON.stringify({provider:"ollama",model:Y})}).finally(()=>{setTimeout(()=>A(null),3e3)})},Q=(f==null?void 0:f.envKeyIsUrl)??!1,G=(f==null?void 0:f.id)==="ollama",J=(f==null?void 0:f.id)==="openrouter",he=A0.filter(Y=>n.some(ee=>ee.category===Y)),ce=i?i.score>=70?"text-green-400":i.score>=40?"text-amber-400":"text-red-400":"text-gray-400";return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden font-sans",children:[r.jsxs("div",{className:"shrink-0 flex items-center justify-between px-5 py-3 border-b border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/10 border border-orange-500/20 flex items-center justify-center",children:r.jsx(lf,{size:15,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[14px] font-bold text-white leading-tight",children:t.title}),r.jsxs("p",{className:"text-[10px] text-gray-400 leading-tight",children:[i!=null&&i.configured?`Active · ${i.provider??"unknown"}`:"Not configured",i!=null&&i.mode?` · ${i.mode}`:""]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(WE,{}),i&&r.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white/4 border border-white/8",children:[r.jsx(fn,{size:11,className:ce}),r.jsxs("span",{className:`text-[11px] font-semibold ${ce}`,children:["HW ",i.score]}),r.jsxs("span",{className:"text-[10px] text-gray-400",children:["· ",i.tier]})]})]})]}),V&&r.jsxs("div",{className:"shrink-0 mx-4 mt-3 flex items-start gap-2.5 px-3.5 py-2.5 rounded-xl bg-red-500/10 border border-red-500/25 text-red-300",children:[r.jsx(ls,{size:14,className:"shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold",children:"API key missing or invalid"}),r.jsx("p",{className:"text-[10px] text-red-400/70 mt-0.5",children:"A request returned 401 Unauthorized. Select a provider and update your key below."})]})]}),r.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 px-5 pt-3 pb-0",children:[r.jsxs("button",{onClick:()=>F("providers"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${T==="providers"?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-400 hover:text-gray-300 hover:border-white/12"}`,children:[r.jsx(fn,{size:11})," LLM Providers"]}),r.jsxs("button",{onClick:()=>F("channels"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${T==="channels"?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-400 hover:text-gray-300 hover:border-white/12"}`,children:[r.jsx(bo,{size:11})," Kanallar"]})]}),T==="channels"&&r.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:r.jsx(VE,{})}),T==="providers"&&r.jsxs("div",{className:"flex flex-1 min-h-0 gap-0",children:[r.jsxs("div",{className:"w-[52%] flex flex-col border-r border-white/6 min-h-0",children:[r.jsxs("div",{className:"shrink-0 px-4 pt-3 pb-2 space-y-2.5",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Zt,{size:12,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx("input",{ref:C,type:"text",value:u,onChange:Y=>p(Y.target.value),placeholder:t.searchPlaceholder,className:"w-full bg-white/4 border border-white/8 rounded-xl pl-8 pr-3 py-2 text-[12px] text-white placeholder:text-gray-400 outline-none focus:border-orange-500/40 transition-colors"})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.jsx("button",{onClick:()=>d("all"),className:`px-2 py-0.5 rounded-lg text-[10px] font-semibold border transition-all ${c==="all"?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/4 border-white/8 text-gray-400 hover:text-gray-300"}`,children:t.allProviders}),he.map(Y=>r.jsx("button",{onClick:()=>d(Y),className:`px-2 py-0.5 rounded-lg text-[10px] font-semibold border transition-all ${c===Y?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/4 border-white/8 text-gray-400 hover:text-gray-300"}`,children:P0[Y]},Y))]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4 space-y-4",children:[n.length===0&&r.jsxs("div",{className:"flex items-center gap-2 py-6 text-gray-400 text-[12px]",children:[r.jsx(re,{size:13,className:"animate-spin"})," Loading providers…"]}),A0.filter(Y=>{var ee;return(ee=W[Y])==null?void 0:ee.length}).map(Y=>r.jsxs("div",{children:[r.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase tracking-widest mb-1.5 px-1",children:P0[Y]}),r.jsx("div",{className:"space-y-1.5",children:W[Y].map(ee=>r.jsx(KE,{p:ee,active:(f==null?void 0:f.id)===ee.id,onClick:()=>{m(ee),R(null),g("")}},ee.id))})]},Y)),n.length>0&&z.length===0&&r.jsxs("p",{className:"text-[12px] text-gray-400 py-4 text-center",children:['No providers match "',u,'"']})]})]}),r.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-y-auto",children:f?r.jsxs("div",{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-[16px] font-bold text-white",children:f.label}),r.jsx("p",{className:"text-[12px] text-gray-400 mt-0.5 leading-snug",children:f.description}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:f.tags.map(Y=>r.jsx(Ov,{tag:Y},Y))})]}),r.jsxs("a",{href:f.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 flex items-center gap-1 px-2.5 py-1.5 rounded-lg bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white transition-colors",children:["Docs ",r.jsx(ba,{size:10})]})]}),G&&o.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:"Recommended Models for Your Hardware"}),r.jsx("div",{className:"space-y-1.5",children:o.map(Y=>{const ee=Y.fit==="recommended"?"text-green-400 border-green-500/20 bg-green-500/6":Y.fit==="marginal"?"text-amber-400 border-amber-500/20 bg-amber-500/6":"text-red-400 border-red-500/20 bg-red-500/6";return r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-xl bg-white/3 border border-white/6",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[12px] font-semibold text-gray-200 truncate",children:Y.label}),r.jsxs("p",{className:"text-[10px] text-gray-400",children:[Y.sizeGb," GB"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-md border ${ee}`,children:Y.fit}),r.jsxs("button",{onClick:()=>{y(Y.id),I(Y.id)},disabled:B===Y.id,className:"flex items-center gap-1 px-2 py-1 rounded-lg bg-orange-500/10 border border-orange-500/20 text-orange-400 text-[10px] font-semibold hover:bg-orange-500/15 transition-all disabled:opacity-40",children:[B===Y.id?r.jsx(re,{size:10,className:"animate-spin"}):r.jsx(Ri,{size:10}),B===Y.id?"Pulling…":"Pull"]})]})]},Y.id)})})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest flex items-center gap-1.5",children:[Q?r.jsx(RC,{size:9}):r.jsx(gC,{size:9}),Q?t.baseUrl:t.apiKey]}),G&&!Q?r.jsx("div",{className:"px-3.5 py-2.5 rounded-xl bg-green-500/6 border border-green-500/15 text-green-400 text-[12px]",children:"Ollama runs locally — no API key required. Just make sure Ollama is running."}):r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:x||Q?"text":"password",value:v,onChange:Y=>{g(Y.target.value),R(null)},placeholder:f.placeholder,className:"w-full bg-white/4 border border-white/10 rounded-xl px-4 py-2.5 pr-10 text-[12px] text-white placeholder:text-gray-400 outline-none focus:border-orange-500/40 transition-colors"}),!Q&&r.jsx("button",{onClick:()=>w(Y=>!Y),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-300 transition-colors",children:x?r.jsx(ef,{size:13}):r.jsx(Ds,{size:13})})]}),r.jsx("p",{className:"text-[10px] text-gray-400 px-1",children:Q?`Stored in .env as ${f.envKey}. Default: ${f.placeholder}`:`Stored locally in .env as ${f.envKey} — never sent to external servers.`})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest flex items-center gap-1.5",children:[r.jsx(Oe,{size:9}),t.model]}),J?r.jsx(HE,{currentModel:b,onSelect:y,className:"rounded-xl border border-white/10 bg-white/3"}):r.jsx("select",{value:b,onChange:Y=>y(Y.target.value),className:"w-full bg-white/4 border border-white/10 rounded-xl px-3 py-2.5 text-[12px] text-white outline-none focus:border-orange-500/40 transition-colors appearance-none",children:f.latestModels.map(Y=>r.jsx("option",{value:Y,className:"bg-[#1a0c06]",children:Y},Y))})]}),r.jsxs("div",{className:"flex items-center gap-2.5 pt-1",children:[!G&&r.jsxs("button",{onClick:K,disabled:j||!v&&!(i!=null&&i.configured),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-white/5 border border-white/10 text-[12px] text-gray-300 font-medium hover:bg-white/8 hover:text-white transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:j?"animate-spin":""}),j?t.testing:t.testConnection]}),r.jsxs("button",{onClick:X,disabled:N||!v.trim()&&!Q&&!G,className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-orange-600 hover:bg-orange-500 text-white text-[12px] font-semibold transition-all disabled:opacity-40 shadow-lg shadow-orange-500/20",children:[r.jsx(pv,{size:12,className:N?"animate-spin":""}),N?t.saving:t.save]})]}),_&&r.jsxs("div",{className:`flex items-start gap-2 px-3.5 py-2.5 rounded-xl border text-[12px] ${_.ok?"bg-green-500/8 border-green-500/20 text-green-300":"bg-red-500/8 border-red-500/20 text-red-300"}`,children:[_.ok?r.jsx(Fe,{size:13,className:"shrink-0 mt-0.5"}):r.jsx(ls,{size:13,className:"shrink-0 mt-0.5"}),_.msg]}),L&&r.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 rounded-xl bg-orange-500/8 border border-orange-500/20 text-orange-300 text-[12px]",children:[r.jsx(Fe,{size:13,className:"shrink-0"}),L]}),G&&r.jsxs("div",{className:"pt-1 space-y-1.5",children:[r.jsxs("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest flex items-center gap-1.5",children:[r.jsx(mC,{size:9}),"Custom Base URL (optional)"]}),r.jsx("input",{type:"text",value:v,onChange:Y=>g(Y.target.value),placeholder:"http://localhost:11434",className:"w-full bg-white/4 border border-white/10 rounded-xl px-4 py-2.5 text-[12px] text-white placeholder:text-gray-400 outline-none focus:border-orange-500/40 transition-colors"}),r.jsx("p",{className:"text-[10px] text-gray-400 px-1",children:"Leave blank to use the default http://localhost:11434"})]})]}):r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center px-8",children:[r.jsx("div",{className:"w-12 h-12 rounded-2xl bg-orange-500/8 border border-orange-500/15 flex items-center justify-center",children:r.jsx(qe,{size:20,className:"text-orange-500/50"})}),r.jsx("p",{className:"text-[13px] text-gray-400",children:"Select a provider from the left to configure your API key"})]})})]})]})}function qE(e){if(!e)return"—";const t=Date.now()-e;return t<6e4?`${Math.floor(t/1e3)}s önce`:t<36e5?`${Math.floor(t/6e4)}dk önce`:`${Math.floor(t/36e5)}sa önce`}function YE(){const{online:e}=wa(),[t,n]=h.useState([]),[s,i]=h.useState(!0),[a,o]=h.useState("all"),l=async()=>{i(!0);try{const p=await(await $("/api/gateway/sessions?limit=50&includeDerivedTitles=true&includeLastMessage=true")).json(),f=Array.isArray(p)?p:Array.isArray(p==null?void 0:p.sessions)?p.sessions:[];n(f)}catch{n([])}finally{i(!1)}};h.useEffect(()=>{l()},[e]);const c=u=>!!u.runningAtMs&&Date.now()-u.runningAtMs<12e4,d=t.filter(u=>a==="running"?c(u):a==="idle"?!c(u):!0);return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(qe,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Aktif Oturumlar"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:[t.length," oturum"]})]})]}),r.jsxs("button",{onClick:l,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white hover:border-white/16 transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:s?"animate-spin":""}),"Yenile"]})]}),!e&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-xl bg-orange-500/8 border border-orange-500/20",children:[r.jsx(Ks,{size:13,className:"text-orange-400 flex-shrink-0"}),r.jsx("p",{className:"text-[12px] text-orange-300",children:"Gateway çevrimdışı — oturum verisi alınamıyor."})]}),r.jsx("div",{className:"flex gap-1.5",children:["all","running","idle"].map(u=>r.jsx("button",{onClick:()=>o(u),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${a===u?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:u==="all"?"Tümü":u==="running"?"Çalışıyor":"Boşta"},u))}),s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):d.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[r.jsx(Is,{size:32,className:"text-gray-700"}),r.jsx("p",{className:"text-sm text-gray-600",children:e?"Aktif oturum bulunamadı.":"Gateway çevrimdışı."})]}):r.jsx("div",{className:"space-y-2",children:d.map(u=>{const p=c(u);return r.jsx("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6 hover:border-white/10 transition-all",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5 flex-shrink-0",children:p?r.jsx("span",{className:"block w-2 h-2 rounded-full bg-orange-400 animate-pulse"}):r.jsx("span",{className:"block w-2 h-2 rounded-full bg-gray-700"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("p",{className:"text-[13px] font-semibold text-gray-200 truncate",children:u.derivedTitle??u.label??u.key.slice(0,20)+"…"}),u.agentId&&r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-gray-600 flex-shrink-0",children:[r.jsx(fn,{size:9}),u.agentId]})]}),u.lastMessage&&r.jsx("p",{className:"text-[11px] text-gray-500 truncate mb-1",children:u.lastMessage}),r.jsxs("div",{className:"flex items-center gap-3",children:[u.messageCount!==void 0&&r.jsxs("span",{className:"text-[10px] text-gray-600",children:[u.messageCount," mesaj"]}),r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-gray-600",children:[r.jsx(At,{size:9}),qE(u.lastActivityAt)]})]})]})]})},u.key)})})]})}function XE(e){if(!e||typeof e!="object")return String(e??"—");const t=e;return t.type==="every"&&t.intervalMs?`Her ${Math.round(t.intervalMs/6e4)} dakika`:t.type==="at"&&t.time?`Her gün ${t.time}`:t.type==="cron"&&t.expression?`Cron: ${t.expression}`:JSON.stringify(e).slice(0,40)}function QE(e){if(!e)return"—";const t=e-Date.now();return t<0?"Geçti":t<6e4?`${Math.floor(t/1e3)}s sonra`:t<36e5?`${Math.floor(t/6e4)}dk sonra`:`${Math.floor(t/36e5)}sa sonra`}function JE(){const{online:e}=wa(),[t,n]=h.useState([]),[s,i]=h.useState(!0),[a,o]=h.useState("all"),[l,c]=h.useState(null),[d,u]=h.useState(null),p=async()=>{i(!0);try{const x=await(await $("/api/gateway/automations?enabled=all&limit=50")).json();n(Array.isArray(x==null?void 0:x.jobs)?x.jobs:Array.isArray(x)?x:[])}catch{n([])}finally{i(!1)}};h.useEffect(()=>{p()},[e]);const f=async g=>{try{await $(`/api/gateway/automations/${g.id}`,{method:"PATCH",body:JSON.stringify({patch:{enabled:!g.enabled}})}),n(x=>x.map(w=>w.id===g.id?{...w,enabled:!w.enabled}:w))}catch{}},m=async g=>{c(g);try{await $(`/api/gateway/automations/${g}/run`,{method:"POST"}),await p()}catch{}finally{c(null)}},b=async g=>{if(window.confirm("Bu otomasyon silinsin mi?")){u(g);try{await $(`/api/gateway/automations/${g}`,{method:"DELETE"}),n(x=>x.filter(w=>w.id!==g))}catch{}finally{u(null)}}},y=t.filter(g=>a==="enabled"?g.enabled:a==="disabled"?!g.enabled:!0),v=g=>g==="ok"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-green-400",children:[r.jsx(Fe,{size:9})," Başarılı"]}):g==="error"?r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-red-400",children:[r.jsx(iv,{size:9})," Hata"]}):r.jsx("span",{className:"text-[10px] text-gray-600",children:"—"});return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(Oe,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Otomasyonlar"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:[t.length," zamanlanmış görev"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[!e&&r.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] bg-red-500/8 border border-red-500/20 text-red-400",children:[r.jsx(Ks,{size:10})," Çevrimdışı"]}),r.jsxs("button",{onClick:p,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white hover:border-white/16 transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:s?"animate-spin":""})," Yenile"]})]})]}),r.jsx("div",{className:"flex gap-1.5",children:["all","enabled","disabled"].map(g=>r.jsx("button",{onClick:()=>o(g),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${a===g?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:g==="all"?"Tümü":g==="enabled"?"Aktif":"Pasif"},g))}),s?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):y.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[r.jsx(Oe,{size:32,className:"text-gray-700"}),r.jsx("p",{className:"text-sm text-gray-600",children:e?"Otomasyon bulunamadı.":"Gateway çevrimdışı."})]}):r.jsx("div",{className:"space-y-2",children:y.map(g=>{var x,w;return r.jsx("div",{className:`px-4 py-3 rounded-xl border transition-all ${g.enabled?"bg-white/[0.025] border-white/6":"bg-white/[0.01] border-white/4"}`,children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{onClick:()=>f(g),disabled:!e,className:"mt-0.5 text-gray-500 hover:text-orange-400 transition-colors disabled:opacity-40",title:g.enabled?"Devre dışı bırak":"Etkinleştir",children:g.enabled?r.jsx(IC,{size:18,className:"text-orange-400"}):r.jsx(DC,{size:18})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("p",{className:`text-[13px] font-semibold truncate ${g.enabled?"text-gray-200":"text-gray-500"}`,children:g.name??g.id}),v((x=g.state)==null?void 0:x.lastRunStatus)]}),r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-gray-500",children:[r.jsx(At,{size:9})," ",XE(g.schedule)]}),((w=g.state)==null?void 0:w.nextRunAtMs)&&r.jsx("span",{className:"text-[11px] text-gray-600",children:QE(g.state.nextRunAtMs)})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[r.jsxs("button",{onClick:()=>m(g.id),disabled:!e||l===g.id,className:"flex items-center gap-1 px-2 py-1 rounded-lg bg-orange-500/8 border border-orange-500/20 text-orange-400 text-[10px] font-semibold hover:bg-orange-500/15 transition-all disabled:opacity-40",children:[l===g.id?r.jsx(fe,{size:9,className:"animate-spin"}):r.jsx(Ws,{size:9}),"Çalıştır"]}),r.jsxs("button",{onClick:()=>b(g.id),disabled:!e||d===g.id,className:"flex items-center gap-1 px-2 py-1 rounded-lg bg-red-500/8 border border-red-500/20 text-red-400 text-[10px] font-semibold hover:bg-red-500/15 transition-all disabled:opacity-40",children:[d===g.id?r.jsx(fe,{size:9,className:"animate-spin"}):r.jsx(ms,{size:9}),"Sil"]})]})]})},g.id)})})]})}function ZE(e){var t;return(t=e.presence)!=null&&t.ts?Date.now()-e.presence.ts<6e4:!1}function e_({platform:e}){const t=(e??"").toLowerCase();return t.includes("ios")||t.includes("iphone")?r.jsx(c0,{size:14,className:"text-gray-400"}):t.includes("android")?r.jsx(c0,{size:14,className:"text-green-500"}):t.includes("mac")||t.includes("darwin")?r.jsx(eC,{size:14,className:"text-gray-300"}):t.includes("win")?r.jsx(rf,{size:14,className:"text-blue-400"}):r.jsx(vC,{size:14,className:"text-gray-500"})}function t_(){const{online:e}=wa(),[t,n]=h.useState([]),[s,i]=h.useState(!0),[a,o]=h.useState(null),[l,c]=h.useState(""),d=async()=>{i(!0);try{const f=await(await $("/api/gateway/clients")).json();n(Array.isArray(f==null?void 0:f.nodes)?f.nodes:Array.isArray(f)?f:[])}catch{n([])}finally{i(!1)}};h.useEffect(()=>{d()},[e]);const u=async p=>{if(!l.trim()){o(null);return}try{await $(`/api/gateway/clients/${p}/rename`,{method:"POST",body:JSON.stringify({displayName:l.trim()})}),n(f=>f.map(m=>m.nodeId===p?{...m,displayName:l.trim()}:m))}catch{}finally{o(null)}};return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(uu,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Bağlı Nodlar"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:[t.length," cihaz"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[!e&&r.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] bg-red-500/8 border border-red-500/20 text-red-400",children:[r.jsx(Ks,{size:10})," Çevrimdışı"]}),r.jsxs("button",{onClick:d,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-[11px] text-gray-400 hover:text-white hover:border-white/16 transition-all disabled:opacity-40",children:[r.jsx(fe,{size:12,className:s?"animate-spin":""})," Yenile"]})]})]}),s?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):t.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[r.jsx(uu,{size:32,className:"text-gray-700"}),r.jsx("p",{className:"text-sm text-gray-600",children:e?"Bağlı node yok.":"Gateway çevrimdışı."})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:t.map(p=>r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6 hover:border-white/10 transition-all",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[r.jsx(e_,{platform:p.platform}),r.jsx("div",{className:"flex-1 min-w-0",children:a===p.nodeId?r.jsx("input",{autoFocus:!0,value:l,onChange:f=>c(f.target.value),onBlur:()=>u(p.nodeId),onKeyDown:f=>{f.key==="Enter"&&u(p.nodeId),f.key==="Escape"&&o(null)},className:"w-full bg-white/6 border border-orange-500/30 rounded-lg px-2 py-0.5 text-[13px] text-white outline-none"}):r.jsx("p",{className:"text-[13px] font-semibold text-gray-200 truncate cursor-text",onDoubleClick:()=>{o(p.nodeId),c(p.displayName??"")},title:"Çift tıklayarak düzenle",children:p.displayName??p.nodeId})}),r.jsx("span",{className:`flex-shrink-0 w-2 h-2 rounded-full mt-1 ${ZE(p)?"bg-green-400 animate-pulse":"bg-gray-700"}`})]}),r.jsxs("div",{className:"space-y-1",children:[p.platform&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-16",children:"Platform"}),r.jsx("span",{className:"text-[11px] text-gray-400",children:p.platform})]}),p.version&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-16",children:"Versiyon"}),r.jsx("span",{className:"text-[11px] text-gray-400",children:p.version})]}),(p.caps??[]).length>0&&r.jsxs("div",{className:"flex items-center gap-1 flex-wrap mt-1",children:[(p.caps??[]).slice(0,3).map(f=>r.jsx("span",{className:"px-1.5 py-0.5 rounded-md bg-orange-500/8 border border-orange-500/15 text-[9px] text-orange-400 font-medium",children:f},f)),(p.caps??[]).length>3&&r.jsxs("span",{className:"text-[9px] text-gray-600",children:["+",(p.caps??[]).length-3]})]})]})]},p.nodeId))})]})}function n_({online:e}){var d;const[t,n]=h.useState({}),[s,i]=h.useState(!0),a=h.useRef(0),o=h.useRef(null),l=async(u=0)=>{try{const f=await(await $(`/api/gateway/logs?cursor=${u}&limit=200`)).json();u===0?(n(f),a.current=f.cursor??0):(n(m=>({...f,lines:[...m.lines??[],...f.lines??[]]})),a.current=f.cursor??a.current)}catch{}finally{i(!1)}};h.useEffect(()=>{l(0)},[e]),h.useEffect(()=>{const u=setInterval(()=>l(a.current),1e4);return()=>clearInterval(u)},[e]),h.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[(d=t.lines)==null?void 0:d.length]);const c=u=>u.includes("error")||u.includes("ERROR")?"text-red-400":u.includes("warn")||u.includes("WARN")?"text-amber-400":u.includes("info")||u.includes("INFO")?"text-green-400":"text-gray-400";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-[11px] text-gray-600",children:[(t.lines??[]).length," satır"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:()=>navigator.clipboard.writeText((t.lines??[]).join(`
|
|
720
|
+
`)),className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-white/4 border border-white/8 text-[10px] text-gray-400 hover:text-white transition-all",children:[r.jsx(Os,{size:10})," Kopyala"]}),r.jsxs("button",{onClick:()=>{a.current=0,l(0)},className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-white/4 border border-white/8 text-[10px] text-gray-400 hover:text-white transition-all",children:[r.jsx(fe,{size:10})," Sıfırla"]})]})]}),r.jsx("div",{ref:o,className:"h-96 overflow-y-auto rounded-xl bg-black/40 border border-white/6 p-3 font-mono text-[11px] space-y-0.5",children:s?r.jsx("p",{className:"text-gray-600",children:"Yükleniyor…"}):!e||t.offline?r.jsx("p",{className:"text-orange-500",children:"Gateway çevrimdışı — log verisi alınamıyor."}):(t.lines??[]).length===0?r.jsx("p",{className:"text-gray-600",children:"Henüz log yok."}):(t.lines??[]).map((u,p)=>r.jsx("p",{className:`whitespace-pre-wrap break-all leading-5 ${c(u)}`,children:u},p))})]})}function s_({online:e}){var l,c;const[t,n]=h.useState({}),[s,i]=h.useState(!0);h.useEffect(()=>{i(!0),$("/api/gateway/usage/cost").then(d=>d.json()).then(n).catch(()=>n({})).finally(()=>i(!1))},[e]);const a=t.daily??[],o=Math.max(1,...a.map(d=>d.tokens??0));return r.jsxs("div",{className:"space-y-4",children:[(!e||t.offline)&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-orange-500/8 border border-orange-500/20",children:[r.jsx(Ks,{size:12,className:"text-orange-400"}),r.jsx("p",{className:"text-[11px] text-orange-300",children:"Gateway çevrimdışı."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6",children:[r.jsx("p",{className:"text-[10px] text-gray-600 mb-1 uppercase tracking-widest",children:"Toplam Token"}),r.jsx("p",{className:"text-xl font-bold text-white",children:s?"—":(((l=t.total)==null?void 0:l.tokens)??0).toLocaleString()})]}),r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6",children:[r.jsxs("p",{className:"text-[10px] text-gray-600 mb-1 uppercase tracking-widest flex items-center gap-1",children:[r.jsx(cC,{size:8})," Tahmini Maliyet"]}),r.jsx("p",{className:"text-xl font-bold text-orange-400",children:s?"—":`$${(((c=t.total)==null?void 0:c.cost)??0).toFixed(4)}`})]})]}),(t.providers??[]).length>0&&r.jsxs("div",{className:"rounded-xl bg-white/[0.02] border border-white/6 overflow-hidden",children:[r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/6 text-[10px] font-bold text-gray-600 uppercase tracking-widest",children:[r.jsx("span",{children:"Provider"}),r.jsx("span",{className:"text-right",children:"Giriş"}),r.jsx("span",{className:"text-right",children:"Çıkış"}),r.jsx("span",{className:"text-right",children:"Maliyet"})]}),(t.providers??[]).map((d,u)=>r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/4 last:border-0 text-[12px]",children:[r.jsx("span",{className:"text-gray-300 font-medium truncate",children:d.provider}),r.jsx("span",{className:"text-right text-gray-500",children:(d.inputTokens??0).toLocaleString()}),r.jsx("span",{className:"text-right text-gray-500",children:(d.outputTokens??0).toLocaleString()}),r.jsxs("span",{className:"text-right text-orange-400",children:["$",(d.cost??0).toFixed(4)]})]},u))]}),a.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"text-[10px] text-gray-600 uppercase tracking-widest",children:"Günlük Kullanım"}),r.jsx("div",{className:"flex items-end gap-1 h-16 px-1",children:a.slice(-14).map((d,u)=>{var f;const p=Math.max(2,Math.round((d.tokens??0)/o*56));return r.jsxs("div",{className:"flex-1 flex flex-col items-center gap-0.5",children:[r.jsx("div",{style:{height:p},className:"w-full rounded-sm bg-orange-500/40 hover:bg-orange-500/60 transition-all",title:`${d.date}: ${(d.tokens??0).toLocaleString()} token`}),r.jsx("span",{className:"text-[8px] text-gray-700 truncate w-full text-center",children:(f=d.date)==null?void 0:f.slice(5)})]},u)})})]})]})}function r_({online:e}){const[t,n]=h.useState([]),[s,i]=h.useState(!0);return h.useEffect(()=>{i(!0),$("/api/gateway/sessions/usage?limit=30").then(a=>a.json()).then(a=>n(Array.isArray(a)?a:(a==null?void 0:a.sessions)??[])).catch(()=>n([])).finally(()=>i(!1))},[e]),r.jsxs("div",{className:"rounded-xl bg-white/[0.02] border border-white/6 overflow-hidden",children:[r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/6 text-[10px] font-bold text-gray-600 uppercase tracking-widest",children:[r.jsx("span",{className:"col-span-2",children:"Oturum"}),r.jsx("span",{className:"text-right",children:"Token"}),r.jsx("span",{className:"text-right",children:"Maliyet"})]}),s?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(fe,{size:14,className:"animate-spin text-orange-400"})}):t.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-6",children:e?"Oturum bulunamadı.":"Gateway çevrimdışı."}):t.map((a,o)=>{var l;return r.jsxs("div",{className:"grid grid-cols-4 px-4 py-2 border-b border-white/4 last:border-0 text-[12px]",children:[r.jsx("span",{className:"col-span-2 text-gray-300 truncate font-mono text-[10px]",children:((l=a.key)==null?void 0:l.slice(0,28))??"—"}),r.jsx("span",{className:"text-right text-gray-500",children:(a.tokens??0).toLocaleString()}),r.jsxs("span",{className:"text-right text-orange-400",children:["$",(a.cost??0).toFixed(4)]})]},o)})]})}function i_(){const{online:e}=wa(),[t,n]=h.useState("logs");return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(oC,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Loglar & Aktivite"}),r.jsx("p",{className:"text-[11px] text-gray-500",children:"Must-b gateway log, kullanım ve oturum istatistikleri"})]}),!e&&r.jsxs("span",{className:"ml-auto flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] bg-red-500/8 border border-red-500/20 text-red-400",children:[r.jsx(Ks,{size:10})," Çevrimdışı"]})]}),r.jsx("div",{className:"flex gap-1.5",children:["logs","usage","sessions"].map(s=>r.jsx("button",{onClick:()=>n(s),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${t===s?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:s==="logs"?"Loglar":s==="usage"?"Kullanım":"Oturumlar"},s))}),t==="logs"&&r.jsx(n_,{online:e}),t==="usage"&&r.jsx(s_,{online:e}),t==="sessions"&&r.jsx(r_,{online:e})]})}function a_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState("all"),[o,l]=h.useState(new Set);h.useEffect(()=>{s(!0),$("/api/tools").then(u=>u.json()).then(u=>{const p=Array.isArray(u==null?void 0:u.groups)?u.groups:[];t(p),l(new Set(p.slice(0,3).map(f=>f.id)))}).catch(()=>t([])).finally(()=>s(!1))},[]);const c=e.map(u=>({...u,tools:(u.tools??[]).filter(p=>i==="core"?p.source!=="plugin":i==="plugin"?p.source==="plugin":!0)})).filter(u=>u.tools.length>0),d=u=>{l(p=>{const f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f})};return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex gap-1.5",children:["all","core","plugin"].map(u=>r.jsx("button",{onClick:()=>a(u),className:`px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${i===u?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:u==="all"?"All":u==="core"?"Core":"Plugin"},u))}),n?r.jsx("div",{className:"flex justify-center py-10",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):c.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-8",children:"No tools found."}):r.jsx("div",{className:"space-y-2",children:c.map(u=>{var p;return r.jsxs("div",{className:"rounded-xl bg-white/[0.02] border border-white/6 overflow-hidden",children:[r.jsxs("button",{onClick:()=>d(u.id),className:"w-full flex items-center justify-between px-4 py-2.5 hover:bg-white/3 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(df,{size:12,className:"text-orange-400"}),r.jsx("span",{className:"text-[12px] font-semibold text-gray-300",children:u.label??u.id}),r.jsxs("span",{className:"text-[10px] text-gray-600",children:[((p=u.tools)==null?void 0:p.length)??0," tools"]})]}),o.has(u.id)?r.jsx(qr,{size:12,className:"text-gray-600"}):r.jsx(Qt,{size:12,className:"text-gray-600"})]}),o.has(u.id)&&r.jsx("div",{className:"border-t border-white/5 divide-y divide-white/4",children:(u.tools??[]).map((f,m)=>r.jsxs("div",{className:"px-4 py-2 flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[12px] font-semibold text-gray-300",children:f.label??f.name}),f.description&&r.jsx("p",{className:"text-[11px] text-gray-600 line-clamp-1",children:f.description})]}),r.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:r.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-md border ${f.source==="plugin"?"bg-blue-500/8 border-blue-500/20 text-blue-400":"bg-orange-500/8 border-orange-500/20 text-orange-400"}`,children:f.source==="plugin"?"plugin":"core"})})]},m))})]},u.id)})})]})}function o_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0);return h.useEffect(()=>{s(!0),$("/api/agents").then(i=>i.json()).then(i=>t(Array.isArray(i==null?void 0:i.agents)?i.agents:[])).catch(()=>t([])).finally(()=>s(!1))},[]),n?r.jsx("div",{className:"flex justify-center py-10",children:r.jsx(fe,{size:18,className:"animate-spin text-orange-400"})}):e.length===0?r.jsx("p",{className:"text-center text-sm text-gray-600 py-8",children:"No agents found."}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:e.map(i=>r.jsxs("div",{className:"px-4 py-3 rounded-xl bg-white/[0.025] border border-white/6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx("span",{className:"text-xl",children:i.emoji??"🤖"}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"text-[13px] font-semibold text-gray-200 truncate",children:i.name??i.id})}),i.isDefault&&r.jsx("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded-md bg-orange-500/12 border border-orange-500/25 text-orange-400",children:"Default"})]}),i.description&&r.jsx("p",{className:"text-[11px] text-gray-500 line-clamp-2",children:i.description})]},i.id))})}function l_(){const[e,t]=h.useState("tools");return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(Hs,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Skills & Plugins"}),r.jsx("p",{className:"text-[11px] text-gray-500",children:"Must-b tool catalog and agent management"})]})]}),r.jsx("div",{className:"flex gap-1.5",children:["tools","agents"].map(n=>r.jsxs("button",{onClick:()=>t(n),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold border transition-all ${e===n?"bg-orange-500/15 border-orange-500/30 text-orange-300":"bg-white/3 border-white/6 text-gray-500 hover:text-gray-300 hover:border-white/12"}`,children:[n==="tools"?r.jsx(df,{size:11}):r.jsx(aa,{size:11}),n==="tools"?"Tools":"Agents"]},n))}),e==="tools"&&r.jsx(a_,{}),e==="agents"&&r.jsx(o_,{})]})}const M0=[{key:"all",label:"Tümü",icon:va,test:()=>!0},{key:"nightowl",label:"NightOwl Bulguları",icon:Rl,test:e=>e.tags.some(t=>/nightshift|nightowl/i.test(t))},{key:"preferences",label:"Kullanıcı Tercihleri",icon:yv,test:e=>e.category==="semantic"&&!e.tags.some(t=>/project|workspace|nightshift|nightowl/i.test(t))},{key:"architecture",label:"Proje Mimarisi",icon:dv,test:e=>e.tags.some(t=>/project|workspace|context|summary/i.test(t))},{key:"episodic",label:"Episodik",icon:At,test:e=>e.category==="episodic"},{key:"semantic",label:"Semantik",icon:Xt,test:e=>e.category==="semantic"}],c_={episodic:{border:"rgba(249,115,22,0.30)",bg:"rgba(249,115,22,0.08)",dot:"#f97316",label:"Episodik"},semantic:{border:"rgba(99,102,241,0.30)",bg:"rgba(99,102,241,0.08)",dot:"#6366f1",label:"Semantik"}};function d_(e){const n=(Date.now()-new Date(e+"Z").getTime())/1e3,s=n/60,i=s/60,a=i/24;return n<60?{label:"az önce",tier:"fresh"}:s<60?{label:`${Math.floor(s)}d önce`,tier:"fresh"}:i<24?{label:`${Math.floor(i)}s önce`,tier:"recent"}:a<7?{label:`${Math.floor(a)}g önce`,tier:"recent"}:a<30?{label:`${Math.floor(a/7)}h önce`,tier:"old"}:{label:`${Math.floor(a/30)}ay önce`,tier:"ancient"}}const u_={fresh:"#34d399",recent:"#f97316",old:"#a78bfa",ancient:"#6b7280"};function R0(e,t){return t.trim()?e.split(new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi")).map((s,i)=>s.toLowerCase()===t.toLowerCase()?r.jsx("mark",{className:"bg-orange-500/30 text-orange-300 rounded px-0.5",children:s},i):s):e}function h_({entry:e,query:t,index:n,onDelete:s}){const[i,a]=h.useState(!1),[o,l]=h.useState(!1),c=d_(e.createdAt),d=c_[e.category],u=e.content.slice(0,180),p=e.content.length>180,f=async m=>{m.stopPropagation(),l(!0);try{(await $(`/api/memory/ltm/delete/${e.id}`,{method:"DELETE"})).ok?(s(e.id),de.success("Kayıt silindi.")):de.error("Silinemedi.")}catch{de.error("Bağlantı hatası.")}l(!1)};return r.jsxs(H.div,{layout:!0,initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-8,scale:.97},transition:{delay:Math.min(n*.03,.3),duration:.25},className:"rounded-2xl overflow-hidden cursor-pointer group",style:{background:"rgba(10,4,1,0.78)",border:`1px solid ${d.border}`,backdropFilter:"blur(20px)",boxShadow:`0 4px 24px rgba(0,0,0,0.45), 0 0 0 1px ${d.bg}, inset 0 1px 0 rgba(255,255,255,0.03)`},onClick:()=>a(m=>!m),children:[r.jsxs("div",{className:"flex items-start gap-3 px-4 pt-3.5 pb-2.5",style:{borderBottom:`1px solid ${d.bg}`},children:[r.jsx("span",{className:"mt-0.5 w-2 h-2 rounded-full flex-shrink-0",style:{background:d.dot,boxShadow:`0 0 6px ${d.dot}`}}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"text-[13px] text-white/80 leading-relaxed break-words",children:R0(i?e.content:u+(p?"…":""),t)})}),p&&r.jsx(H.span,{animate:{rotate:i?90:0},transition:{duration:.18},className:"flex-shrink-0 text-white/20",children:r.jsx(Qt,{size:14})}),r.jsx("button",{onClick:f,disabled:o,className:"flex-shrink-0 p-1 rounded-lg opacity-0 group-hover:opacity-100 text-white/25 hover:text-red-400 hover:bg-red-500/12 transition-all disabled:opacity-30",title:"Bu kaydı sil",children:r.jsx(ms,{size:13})})]}),r.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 flex-wrap",children:[r.jsx("span",{className:"text-[10px] font-semibold tracking-widest uppercase px-2 py-0.5 rounded-full",style:{color:d.dot,background:d.bg,border:`1px solid ${d.border}`},children:d.label}),e.tags.slice(0,3).map(m=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-white/35 px-1.5 py-0.5 rounded-md",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)"},children:[r.jsx(xv,{size:8,className:"opacity-60"}),m]},m)),r.jsx("span",{className:"flex-1"}),r.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-medium",style:{color:u_[c.tier]},title:e.createdAt,children:[r.jsx(At,{size:9}),c.label]})]})]})}function f_({entries:e}){const t=e.filter(a=>a.category==="episodic").length,n=e.filter(a=>a.category==="semantic").length,s=e.filter(a=>a.tags.some(o=>/nightshift|nightowl/i.test(o))).length,i=[{label:`${e.length} toplam`,color:"#f97316"},{label:`${t} episodik`,color:"#f97316"},{label:`${n} semantik`,color:"#6366f1"},{label:`${s} NightOwl`,color:"#a78bfa"}];return r.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:i.map(a=>r.jsx("span",{className:"text-[11px] font-semibold px-2.5 py-1 rounded-full",style:{color:a.color,background:`${a.color}14`,border:`1px solid ${a.color}30`},children:a.label},a.label))})}function p_({onConfirm:e,onCancel:t}){return r.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4",children:r.jsxs(H.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},className:"rounded-2xl p-6 w-full max-w-sm shadow-2xl",style:{background:"rgba(18,8,2,0.97)",border:"1px solid rgba(249,115,22,0.25)"},children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shrink-0",style:{background:"rgba(239,68,68,0.12)",border:"1px solid rgba(239,68,68,0.25)"},children:r.jsx(ls,{size:18,className:"text-red-400"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-[15px] font-bold text-white/90",children:"Tüm Hafızayı Temizle"}),r.jsx("p",{className:"text-[11px] text-white/35",children:"Bu işlem geri alınamaz"})]}),r.jsx("button",{onClick:t,className:"ml-auto p-1.5 rounded-lg text-white/30 hover:text-white/60 hover:bg-white/6 transition-all",children:r.jsx(He,{size:15})})]}),r.jsx("p",{className:"text-[13px] text-white/50 mb-5 leading-relaxed",children:"Tüm episodik ve semantik hafıza kayıtları kalıcı olarak silinecek. Bu işlem geri alınamaz."}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 rounded-xl bg-white/8 hover:bg-white/12 text-white/70 text-[13px] font-medium transition-colors",children:"İptal"}),r.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 rounded-xl bg-red-600/80 hover:bg-red-600 text-white text-[13px] font-semibold transition-colors border border-red-500/30",children:"Tümünü Sil"})]})]})})}function m_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState(""),[o,l]=h.useState("all"),[c,d]=h.useState(!1),[u,p]=h.useState(!1),f=h.useCallback(async()=>{s(!0);try{const v=await $("/api/memory/ltm/explore?category=all&limit=200");if(v.ok){const g=await v.json();t(g.entries??[])}}catch{}s(!1)},[]);h.useEffect(()=>{f()},[f]);const m=v=>{t(g=>g.filter(x=>x.id!==v))},b=async()=>{p(!0);try{const v=await $("/api/memory/ltm/clear-all",{method:"DELETE"});if(v.ok){const g=await v.json();t([]),de.success(`${g.deleted??0} kayıt temizlendi.`)}else de.error("Temizleme başarısız.")}catch{de.error("Bağlantı hatası.")}p(!1),d(!1)},y=h.useMemo(()=>{var x;const v=((x=M0.find(w=>w.key===o))==null?void 0:x.test)??(()=>!0),g=i.trim().toLowerCase();return e.filter(v).filter(w=>!g||w.content.toLowerCase().includes(g)||w.tags.some(j=>j.includes(g)))},[e,o,i]);return r.jsxs("div",{className:"h-[calc(100vh-72px)] overflow-y-auto px-6 py-6 space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.28)",boxShadow:"0 0 16px rgba(249,115,22,0.12)"},children:r.jsx(Xt,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[15px] font-bold text-white/90 tracking-tight",children:"Hafıza Tüneli"}),r.jsx("p",{className:"text-[11px] text-white/35",children:"Long-Term Memory Explorer — semantik & episodik"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:()=>d(!0),disabled:u||e.length===0,className:"flex items-center gap-1.5 text-[11px] font-semibold px-3 py-1.5 rounded-lg transition-all border border-red-500/20 text-red-400/70 hover:text-red-400 hover:bg-red-500/10 disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"rgba(239,68,68,0.04)"},children:[r.jsx(ms,{size:11}),"Tüm Hafızayı Temizle"]}),r.jsxs("button",{onClick:()=>void f(),disabled:n,className:"flex items-center gap-1.5 text-[11px] text-white/40 hover:text-white/70 transition-colors px-3 py-1.5 rounded-lg",style:{border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)"},children:[r.jsx(fe,{size:11,className:n?"animate-spin":""}),"Yenile"]})]})]}),!n&&r.jsx(f_,{entries:e}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-3 py-2.5",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.10)",backdropFilter:"blur(12px)"},children:[r.jsx(Zt,{size:13,className:"text-white/30 flex-shrink-0"}),r.jsx("input",{type:"text",value:i,onChange:v=>a(v.target.value),placeholder:"Hafızada ara…",className:"flex-1 bg-transparent text-[13px] text-white/80 placeholder:text-white/25 outline-none"}),i&&r.jsx("button",{onClick:()=>a(""),className:"text-white/25 hover:text-white/60 text-xs",children:"✕"})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(uC,{size:11,className:"text-white/25"}),M0.map(v=>{const g=v.icon,x=o===v.key,w=e.filter(v.test).length;return r.jsxs("button",{onClick:()=>l(v.key),className:"flex items-center gap-1.5 text-[11px] font-medium px-2.5 py-1 rounded-full transition-all",style:{background:x?"rgba(249,115,22,0.16)":"rgba(255,255,255,0.04)",border:x?"1px solid rgba(249,115,22,0.40)":"1px solid rgba(255,255,255,0.08)",color:x?"#fb923c":"rgba(255,255,255,0.45)"},children:[r.jsx(g,{size:10}),v.label,r.jsxs("span",{style:{opacity:.6},children:["(",w,")"]})]},v.key)})]})]}),n?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-24",children:[r.jsx(H.div,{animate:{rotate:360},transition:{repeat:1/0,duration:1.5,ease:"linear"},children:r.jsx(Xt,{size:28,className:"text-orange-500/50"})}),r.jsx("p",{className:"text-[12px] text-white/30",children:"Hafıza taranıyor…"})]}):y.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-24",children:[r.jsx(Ll,{size:28,className:"text-white/15"}),r.jsx("p",{className:"text-[13px] text-white/30",children:e.length===0?"Henüz hafıza yok. İlk konuşmadan sonra dolmaya başlar.":"Filtrene uyan kayıt yok."})]}):r.jsxs("div",{className:"space-y-3 pb-8",children:[r.jsxs("p",{className:"text-[11px] text-white/25",children:[y.length," kayıt gösteriliyor",i&&r.jsxs(r.Fragment,{children:[" · ",r.jsxs("span",{className:"text-orange-400/60",children:['"',i,'"']})," araması"]})]}),r.jsx(ne,{mode:"popLayout",children:y.map((v,g)=>r.jsx(h_,{entry:v,query:i,index:g,onDelete:m},v.id))})]}),r.jsx(ne,{children:c&&r.jsx(p_,{onConfirm:b,onCancel:()=>d(!1)})})]})}const Qa=`# Must-b Zihni
|
|
721
721
|
Burada senin hakkında öğrendiğim bilgiler yer alır.
|
|
722
722
|
|
|
723
723
|
## Genel Bilgiler
|
|
@@ -761,7 +761,7 @@ Burada senin hakkında öğrendiğim bilgiler yer alır.
|
|
|
761
761
|
color: rgba(251,146,60,0.9);
|
|
762
762
|
margin-left: auto;
|
|
763
763
|
}
|
|
764
|
-
`}),r.jsx("div",{className:"max-w-full",dangerouslySetInnerHTML:{__html:f}})]})]})]})]})}const v_=[{id:"terminal",label:"Terminal",desc:"Kabuk komutları çalıştır",Icon:os,color:"text-green-400",bg:"bg-green-500/10",border:"border-green-500/20"},{id:"browser",label:"Browser",desc:"Playwright ile tam web otomasyonu",Icon:qe,color:"text-blue-400",bg:"bg-blue-500/10",border:"border-blue-500/20"},{id:"web-search",label:"Web Search",desc:"Çoklu sağlayıcıyla gerçek zamanlı arama",Icon:Zt,color:"text-cyan-400",bg:"bg-cyan-500/10",border:"border-cyan-500/20"},{id:"file-manager",label:"Files",desc:"Dosya oku, yaz ve yönet",Icon:An,color:"text-yellow-400",bg:"bg-yellow-500/10",border:"border-yellow-500/20"},{id:"image-gen",label:"Görsel Üret",desc:"AI ile görsel üret",Icon:fv,color:"text-pink-400",bg:"bg-pink-500/10",border:"border-pink-500/20"},{id:"code",label:"Kod Analizi",desc:"Kod yaz, analiz et ve hata ayıkla",Icon:Jt,color:"text-purple-400",bg:"bg-purple-500/10",border:"border-purple-500/20"},{id:"memory",label:"Bellek",desc:"Semantik hafıza arama & kayıt",Icon:Xt,color:"text-orange-400",bg:"bg-orange-500/10",border:"border-orange-500/20"},{id:"vision",label:"Görme",desc:"Ekran ve görsel algı",Icon:cu,color:"text-emerald-400",bg:"bg-emerald-500/10",border:"border-emerald-500/20"},{id:"screen-sense",label:"Ekranı Gör",desc:"Kullanıcı ekranını yakala ve analiz et",Icon:rf,color:"text-indigo-400",bg:"bg-indigo-500/10",border:"border-indigo-500/20"},{id:"gateway",label:"Gateway",desc:"Sistem arası ve A2A iletişim",Icon:il,color:"text-teal-400",bg:"bg-teal-500/10",border:"border-teal-500/20"},{id:"messages",label:"Mesajlar",desc:"Ajan-arası mesaj gönder & al",Icon:Is,color:"text-rose-400",bg:"bg-rose-500/10",border:"border-rose-500/20"},{id:"git",label:"Git",desc:"Commit, branch, diff, push/pull",Icon:lv,color:"text-amber-400",bg:"bg-amber-500/10",border:"border-amber-500/20"}];function b_(){const[e,t]=h.useState("tools"),[n,s]=h.useState([]),[i,a]=h.useState([]),[o,l]=h.useState({}),[c,d]=h.useState(!1),[u,p]=h.useState(""),f=h.useCallback(async()=>{d(!0);try{const j=await $("/api/skills/list");if(j.ok){const k=await j.json();s(Array.isArray(k)?k:[])}}catch{}d(!1)},[]),m=h.useCallback(async()=>{d(!0);try{const j=await $("/api/skills/catalog");if(j.ok){const k=await j.json(),N=Array.isArray(k)?k:k.skills??[];a(N)}}catch{}d(!1)},[]);h.useEffect(()=>{e==="saved"&&f(),e==="catalog"&&m()},[e,f,m]);const b=async j=>{l(k=>({...k,[j.id]:"running"}));try{const k=await $("/api/skills/run",{method:"POST",body:JSON.stringify({id:j.id})});l(N=>({...N,[j.id]:k.ok?"done":"error"})),de[k.ok?"success":"error"](k.ok?`"${j.name}" çalıştırıldı`:"Çalıştırma başarısız"),setTimeout(()=>l(N=>({...N,[j.id]:"idle"})),2500)}catch{l(k=>({...k,[j.id]:"error"}))}},v=async j=>{try{await $(`/api/skills/${j}`,{method:"DELETE"}),s(k=>k.filter(N=>N.id!==j)),de.success("Beceri silindi.")}catch{de.error("Silinemedi.")}},y=async(j,k)=>{l(N=>({...N,[j]:"running"}));try{const N=await $("/api/v1/skills/invoke",{method:"POST",body:JSON.stringify({skill:j,goal:`${k} becerisini çalıştır`})});l(S=>({...S,[j]:N.ok?"done":"error"})),N.ok&&de.success(`"${k}" yapay zekanın araç kutusuna eklendi ve aktif edildi`),setTimeout(()=>l(S=>({...S,[j]:"idle"})),2500)}catch{l(N=>({...N,[j]:"error"}))}},g=v_.filter(j=>j.label.toLowerCase().includes(u.toLowerCase())||j.desc.toLowerCase().includes(u.toLowerCase())),x=n.filter(j=>j.name.toLowerCase().includes(u.toLowerCase())||j.goal.toLowerCase().includes(u.toLowerCase())),w=i.filter(j=>j.name.toLowerCase().includes(u.toLowerCase())||j.description.toLowerCase().includes(u.toLowerCase())||(j.pluginName??"").toLowerCase().includes(u.toLowerCase()));return r.jsxs("div",{className:"min-h-screen bg-transparent pt-4 pb-10 px-4 sm:px-6 max-w-5xl mx-auto",children:[r.jsx("div",{className:"mb-6",children:r.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[r.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.25)"},children:r.jsx(Oe,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[22px] font-black text-white/95 leading-none",children:"Beceriler & Araçlar"}),r.jsx("p",{className:"text-[12px] text-white/35 mt-0.5",children:"Must-b'nin bilişsel yetenekleri"})]})]})}),r.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[r.jsxs("div",{className:"relative flex-1 max-w-xs",children:[r.jsx(Zt,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/25"}),r.jsx("input",{value:u,onChange:j=>p(j.target.value),placeholder:"Ara…",className:"w-full bg-white/5 border border-white/8 rounded-xl py-2 pl-8 pr-3 text-[13px] text-white/75 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20"})]}),r.jsx("div",{className:"flex rounded-xl overflow-hidden border border-white/8",children:[{key:"tools",label:"Dahili Araçlar"},{key:"saved",label:"Kaydedilen"},{key:"catalog",label:"Katalog"}].map(({key:j,label:k})=>r.jsx("button",{onClick:()=>t(j),className:`px-4 py-2 text-[12px] font-semibold transition-all ${e===j?"bg-orange-500/20 text-orange-300":"text-white/40 hover:text-white/70 hover:bg-white/5"}`,children:k},j))})]}),e==="tools"&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:g.map(({id:j,label:k,desc:N,Icon:S,color:_,bg:R,border:L})=>r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18},className:`rounded-2xl p-4 flex gap-3 items-start border ${L}`,style:{background:"rgba(13,7,3,0.6)",backdropFilter:"blur(12px)"},children:[r.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${R} border ${L}`,children:r.jsx(S,{size:16,className:_})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90 leading-tight",children:k}),r.jsx("p",{className:"text-[11px] text-white/40 mt-0.5 leading-tight",children:N})]}),r.jsx("div",{className:"shrink-0 mt-1",children:r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-md bg-green-500/12 border border-green-500/20 text-green-400",children:"Aktif"})})]},j))}),e==="saved"&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("p",{className:"text-[11px] text-white/30",children:[n.length," kaydedilmiş beceri"]}),r.jsx("button",{onClick:f,className:"p-1.5 text-white/30 hover:text-white/70 rounded-lg hover:bg-white/6 transition-all",children:r.jsx(fe,{size:13})})]}),c?r.jsx("div",{className:"flex justify-center py-16",children:r.jsx(re,{size:20,className:"animate-spin text-orange-500/50"})}):x.length===0?r.jsx("div",{className:"text-center py-16 text-white/20 text-[13px]",children:u?"Eşleşen beceri bulunamadı.":"Henüz kaydedilmiş beceri yok."}):r.jsx("div",{className:"space-y-2",children:x.map(j=>{const k=o[j.id]??"idle";return r.jsxs(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-2xl p-4 border border-orange-500/10",style:{background:"rgba(13,7,3,0.6)",backdropFilter:"blur(12px)"},children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/10 border border-orange-500/20 flex items-center justify-center shrink-0 mt-0.5",children:r.jsx(Al,{size:14,className:"text-orange-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90",children:j.name}),r.jsx("p",{className:"text-[11px] text-white/40 truncate mt-0.5",children:j.goal}),r.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-white/25",children:[r.jsx(rv,{size:9})," ",j.runCount," çalıştırma"]}),r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-white/25",children:[r.jsx(At,{size:9})," ",new Date(j.savedAt).toLocaleDateString("tr-TR")]})]})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{onClick:()=>b(j),disabled:k==="running",className:`w-8 h-8 rounded-xl flex items-center justify-center transition-all border ${k==="done"?"bg-green-500/15 border-green-500/25 text-green-400":k==="error"?"bg-red-500/15 border-red-500/25 text-red-400":k==="running"?"bg-orange-500/10 border-orange-500/20 text-orange-400":"bg-white/5 border-white/10 text-white/50 hover:bg-orange-500/15 hover:border-orange-500/25 hover:text-orange-300"}`,children:k==="running"?r.jsx(re,{size:13,className:"animate-spin"}):k==="done"?r.jsx(Fe,{size:13}):k==="error"?r.jsx(mt,{size:13}):r.jsx(Ws,{size:13})}),r.jsx("button",{onClick:()=>v(j.id),className:"w-8 h-8 rounded-xl flex items-center justify-center border border-white/8 text-white/25 hover:bg-red-500/12 hover:border-red-500/20 hover:text-red-400 transition-all",children:r.jsx(ms,{size:13})})]})]}),(j.tags??[]).length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-2 ml-11",children:(j.tags??[]).map(N=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/5 border border-white/8 text-white/35",children:N},N))})]},j.id)})})]}),e==="catalog"&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("p",{className:"text-[11px] text-white/30",children:[i.length," beceri"]}),r.jsx("button",{onClick:m,className:"p-1.5 text-white/30 hover:text-white/70 rounded-lg hover:bg-white/6 transition-all",children:r.jsx(fe,{size:13})})]}),c?r.jsx("div",{className:"flex justify-center py-16",children:r.jsx(re,{size:20,className:"animate-spin text-orange-500/50"})}):w.length===0?r.jsx("div",{className:"text-center py-16 text-white/20 text-[13px]",children:u?"Eşleşen beceri bulunamadı.":"Katalog boş."}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:w.map(j=>{var N;const k=o[j.id]??"idle";return r.jsxs(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-2xl p-4 border border-white/8 flex gap-3",style:{background:"rgba(13,7,3,0.55)",backdropFilter:"blur(12px)"},children:[r.jsx("div",{className:"text-[22px] shrink-0",children:j.emoji??"⚡"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90",children:j.name}),r.jsx("p",{className:"text-[11px] text-white/40 mt-0.5 leading-tight line-clamp-2",children:j.description}),j.pluginName&&r.jsx("p",{className:"text-[10px] text-white/20 mt-1",children:j.pluginName}),(((N=j.requires)==null?void 0:N.bins)??[]).length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:(j.requires.bins??[]).map(S=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-orange-500/8 border border-orange-500/15 text-orange-400/70",children:S},S))})]}),r.jsx("button",{onClick:()=>y(j.id,j.name),disabled:k==="running",className:`w-8 h-8 rounded-xl flex items-center justify-center shrink-0 transition-all border mt-0.5 ${k==="done"?"bg-green-500/15 border-green-500/25 text-green-400":k==="error"?"bg-red-500/15 border-red-500/25 text-red-400":k==="running"?"bg-orange-500/10 border-orange-500/20 text-orange-400":"bg-white/5 border-white/10 text-white/50 hover:bg-orange-500/15 hover:border-orange-500/25 hover:text-orange-300"}`,children:k==="running"?r.jsx(re,{size:13,className:"animate-spin"}):k==="done"?r.jsx(Fe,{size:13}):k==="error"?r.jsx(mt,{size:13}):r.jsx(fn,{size:13})})]},j.id)})})]})]})}const w_={node:Jt,python:yn,api:Yr,cli:os,web:qe,database:va,cloud:av,agent:aa};function k_(e,t){const n=e.toLowerCase();return n.includes("api")||n.includes("webhook")?Yr:n.includes("db")||n.includes("database")||n.includes("sql")?va:n.includes("cloud")||n.includes("s3")||n.includes("gcs")?av:n.includes("agent")||n.includes("bot")?aa:n.includes("web")||n.includes("http")?qe:w_[t]??Hs}function j_(e){const t=new Map;for(const n of e){if(!n.pluginName)continue;const s=t.get(n.pluginName);s?s.skillCount+=1:t.set(n.pluginName,{name:n.pluginName,emoji:n.emoji??"🔧",skillCount:1})}return Array.from(t.values()).sort((n,s)=>n.name.localeCompare(s.name))}function N_(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(!1),[u,p]=h.useState(""),[f,m]=h.useState(""),[b,v]=h.useState("node"),[y,g]=h.useState(""),[x,w]=h.useState(!1),j=h.useCallback(async()=>{a(!0);try{const[R,L]=await Promise.all([$("/api/plugins/list"),$("/api/skills/catalog")]);if(R.ok){const P=await R.json();t(Array.isArray(P)?P:[])}if(L.ok){const P=await L.json(),V=Array.isArray(P)?P:P.skills??[];s(j_(V))}}catch{}a(!1)},[]);h.useEffect(()=>{j()},[j]);const k=async R=>{l(R.name);try{const L=R.running?"/api/plugins/stop":"/api/plugins/run";(await $(L,{method:"POST",body:JSON.stringify({name:R.name})})).ok?(t(V=>(Array.isArray(V)?V:[]).map(M=>M.name===R.name?{...M,running:!M.running}:M)),de.success(R.running?`"${R.name}" durduruldu`:`"${R.name}" başlatıldı`)):de.error("İşlem başarısız.")}catch{de.error("Bağlantı hatası.")}l(null)},N=async R=>{if(R.preventDefault(),!(!u.trim()||!f.trim())){w(!0);try{const L=await $("/api/plugins/build",{method:"POST",body:JSON.stringify({name:u,goal:f,lang:b,context:y})});if(L.ok){const P=await L.json();de.success(`"${P.name??u}" eklentisi oluşturuldu!`),p(""),m(""),g(""),d(!1),j()}else{const P=await L.json().catch(()=>({}));de.error(P.error??"Oluşturma başarısız.")}}catch{de.error("Gateway bağlantı hatası.")}w(!1)}},S=Array.isArray(e)?e:[],_=S.filter(R=>R.running).length;return r.jsxs("div",{className:"min-h-screen bg-transparent pt-4 pb-10 px-4 sm:px-6 max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.25)"},children:r.jsx(Fr,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[22px] font-black text-white/95 leading-none",children:"Eklentiler"}),r.jsxs("p",{className:"text-[12px] text-white/35 mt-0.5",children:[S.length," özel eklenti · ",_," çalışıyor"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:j,className:"p-2.5 rounded-xl text-white/30 hover:text-white/70 hover:bg-white/6 border border-white/8 transition-all",children:r.jsx(fe,{size:14})}),r.jsxs("button",{onClick:()=>d(R=>!R),className:`flex items-center gap-1.5 px-4 py-2.5 rounded-xl text-[12px] font-semibold transition-all border ${c?"bg-orange-500/20 border-orange-500/30 text-orange-300":"bg-white/6 border-white/10 text-white/60 hover:bg-orange-500/12 hover:border-orange-500/20 hover:text-orange-300"}`,children:[c?r.jsx(He,{size:13}):r.jsx(zl,{size:13}),c?"Kapat":"Yeni Eklenti"]})]})]}),r.jsx(ne,{children:c&&r.jsx(H.div,{initial:{opacity:0,y:-10,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:-8,height:0},transition:{duration:.2},className:"overflow-hidden mb-5",children:r.jsxs("form",{onSubmit:N,className:"rounded-2xl p-5 border border-orange-500/20",style:{background:"rgba(13,7,3,0.7)",backdropFilter:"blur(16px)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Oe,{size:14,className:"text-orange-400"}),r.jsx("h3",{className:"text-[13px] font-bold text-white/90",children:"Yeni Eklenti Oluştur"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Ad"}),r.jsx("input",{value:u,onChange:R=>p(R.target.value),placeholder:"my-plugin",required:!0,className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2 text-[13px] text-white/80 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Dil"}),r.jsx("div",{className:"flex rounded-xl overflow-hidden border border-white/8",children:["node","python"].map(R=>r.jsxs("button",{type:"button",onClick:()=>v(R),className:`flex-1 py-2 text-[12px] font-semibold transition-all flex items-center justify-center gap-1.5 ${b===R?"bg-orange-500/20 text-orange-300":"text-white/40 hover:text-white/70 hover:bg-white/5"}`,children:[R==="node"?r.jsx(Jt,{size:12}):r.jsx(yn,{size:12}),R==="node"?"Node.js":"Python"]},R))})]})]}),r.jsxs("div",{className:"mb-3",children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Hedef / Açıklama"}),r.jsx("textarea",{value:f,onChange:R=>m(R.target.value),placeholder:"Bu eklenti ne yapmalı?",required:!0,rows:2,className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2 text-[13px] text-white/80 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20 resize-none"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Bağlam (isteğe bağlı)"}),r.jsx("textarea",{value:y,onChange:R=>g(R.target.value),placeholder:"API anahtarları, URL'ler, ek bağlam…",rows:2,className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2 text-[13px] text-white/80 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20 resize-none"})]}),r.jsxs("button",{type:"submit",disabled:x||!u.trim()||!f.trim(),className:"flex items-center gap-2 px-5 py-2.5 rounded-xl bg-orange-600/20 border border-orange-500/30 text-orange-300 text-[13px] font-semibold hover:bg-orange-600/30 transition-all disabled:opacity-40",children:[x?r.jsx(re,{size:13,className:"animate-spin"}):r.jsx(fn,{size:13}),x?"Oluşturuluyor…":"Oluştur"]})]})})}),n.length>0&&r.jsxs("div",{className:"mb-6",children:[r.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-white/25 mb-3",children:"Yüklü Beceri Paketleri"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:n.map(R=>r.jsxs(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-2xl p-4 flex gap-3 items-center border border-white/8",style:{background:"rgba(13,7,3,0.55)",backdropFilter:"blur(12px)"},children:[r.jsx("div",{className:"text-[22px] shrink-0",children:R.emoji}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90 leading-tight truncate",children:R.name}),r.jsxs("p",{className:"text-[10px] text-white/30 mt-0.5",children:[R.skillCount," beceri"]})]}),r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-md bg-green-500/12 border border-green-500/20 text-green-400 shrink-0",children:"Yüklü"})]},R.name))})]}),i?r.jsx("div",{className:"flex justify-center py-20",children:r.jsx(re,{size:22,className:"animate-spin text-orange-500/50"})}):S.length===0?r.jsxs("div",{className:"rounded-2xl border border-white/8 p-8 text-center",style:{background:"rgba(13,7,3,0.4)"},children:[r.jsx(Fr,{size:28,className:"text-white/15 mx-auto mb-3"}),r.jsx("p",{className:"text-[13px] text-white/30 font-medium",children:"Henüz özel eklenti yok"}),r.jsx("p",{className:"text-[12px] text-white/20 mt-1",children:'Yukarıdaki "Yeni Eklenti" ile kendi konektörünü oluştur.'})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:S.map(R=>{const L=o===R.name,P=k_(R.name,R.lang),V=R.lang==="node"?Jt:yn;return r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:`rounded-2xl p-4 border transition-all ${R.running?"border-orange-500/25":"border-white/8 hover:border-white/14"}`,style:{background:R.running?"rgba(249,115,22,0.06)":"rgba(13,7,3,0.55)",backdropFilter:"blur(12px)"},children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${R.running?"bg-orange-500/15 border border-orange-500/25":"bg-white/6 border border-white/10"}`,children:r.jsx(P,{size:16,className:R.running?"text-orange-400":"text-white/50"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90 leading-tight truncate max-w-[120px]",children:R.name}),r.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[r.jsx(V,{size:9,className:R.lang==="node"?"text-green-400/60":"text-blue-400/60"}),r.jsx("span",{className:`text-[9px] font-semibold ${R.lang==="node"?"text-green-400/60":"text-blue-400/60"}`,children:R.lang==="node"?"Node.js":"Python"})]})]})]}),r.jsx("span",{className:`text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-md border ${R.running?"bg-orange-500/15 border-orange-500/25 text-orange-400":"bg-white/5 border-white/10 text-white/30"}`,children:R.running?"Çalışıyor":"Durdu"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] text-white/25",children:new Date(R.createdAt).toLocaleDateString("tr-TR")}),r.jsxs("button",{onClick:()=>k(R),disabled:L,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold transition-all border ${R.running?"bg-red-500/12 border-red-500/20 text-red-400 hover:bg-red-500/20":"bg-orange-500/12 border-orange-500/20 text-orange-400 hover:bg-orange-500/20"} disabled:opacity-40`,children:[L?r.jsx(re,{size:11,className:"animate-spin"}):R.running?r.jsx(cf,{size:11}):r.jsx(Ws,{size:11}),R.running?"Durdur":"Başlat"]})]})]},R.name)})})]})}function S_(){return new URLSearchParams(window.location.search).get("token")??""}function C_(){const[e,t]=h.useState("connecting"),[n,s]=h.useState([]),[i,a]=h.useState([]),[o,l]=h.useState("idle"),[c,d]=h.useState(null),[u,p]=h.useState(""),f=h.useRef(null),m=h.useRef(null),b=h.useRef([]),v=S_();h.useEffect(()=>{if(!v){t("denied");return}const k=zi(`${window.location.origin}/mobile`,{query:{token:v},transports:["websocket","polling"]});return f.current=k,k.on("connect",()=>t("connected")),k.on("disconnect",()=>t("disconnected")),k.on("authError",()=>{t("denied"),k.disconnect()}),k.on("agentUpdate",N=>{const{type:S}=N;if(S==="planStart"&&s([]),S==="stepStart"){const _=N.step;s(R=>[...R,{id:`${Date.now()}-${Math.random()}`,description:(_==null?void 0:_.description)??"Working…",status:"running"}])}S==="stepFinish"&&s(_=>{const R=[..._],L=R.findLastIndex(P=>P.status==="running");return L>=0&&(R[L]={...R[L],status:N.status==="error"?"error":"done"}),R}),S==="skillRunStart"&&N.skillId&&d(N.skillId),S==="planFinish"&&d(null)}),()=>{k.disconnect()}},[v]);const y=h.useCallback(async()=>{try{const k=await fetch("/api/skills/list",{headers:{Authorization:`Bearer ${v}`}});if(k.ok){const N=await k.json();a(N.skills??[])}}catch{}},[v]);h.useEffect(()=>{y()},[y]);const g=async()=>{try{const k=await navigator.mediaDevices.getUserMedia({audio:!0}),N=new MediaRecorder(k,{mimeType:"audio/webm"});b.current=[],N.ondataavailable=S=>{S.data.size>0&&b.current.push(S.data)},N.onstop=()=>{k.getTracks().forEach(S=>S.stop()),w()},N.start(),m.current=N,l("recording")}catch{l("idle")}},x=()=>{var k;(k=m.current)==null||k.stop(),l("sending")},w=async()=>{const k=new Blob(b.current,{type:"audio/webm"}),N=new FormData;N.append("audio",k,"voice.webm");try{const S=await fetch("/api/voice/transcribe",{method:"POST",headers:{Authorization:`Bearer ${v}`},body:N});if(S.ok){const{text:_}=await S.json();p(_),await fetch("/api/goal",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({goal:_})})}}catch{}l("idle")},j=async k=>{if(!c){d(k.id);try{await fetch("/api/skills/run",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({id:k.id})})}catch{d(null)}}};return!v||e==="denied"?r.jsxs("div",{className:"min-h-screen bg-[#02040a] flex flex-col items-center justify-center gap-4 text-center px-8",children:[r.jsx(mt,{size:40,className:"text-red-400"}),r.jsx("p",{className:"text-white font-bold text-xl",children:"Access Denied"}),r.jsxs("p",{className:"text-gray-500 text-sm",children:["This link is invalid or has expired.",r.jsx("br",{}),"Generate a new QR code from your desktop."]})]}):r.jsxs("div",{className:"min-h-screen bg-[#02040a] text-white flex flex-col pb-8",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("img",{src:"/logo.png",alt:"Must-b",className:"w-8 h-8 object-contain"}),r.jsx("span",{className:"font-bold text-base",children:"Must-b"}),r.jsx("span",{className:"text-[10px] text-orange-400 font-medium bg-orange-400/10 border border-orange-400/20 px-2 py-0.5 rounded-full",children:"Companion"})]}),r.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:e==="connected"?r.jsxs(r.Fragment,{children:[r.jsx(VC,{size:13,className:"text-green-400"}),r.jsx("span",{className:"text-green-400",children:"Connected"})]}):e==="connecting"?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:13,className:"animate-spin text-orange-400"}),r.jsx("span",{className:"text-orange-400",children:"Connecting…"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Ks,{size:13,className:"text-gray-600"}),r.jsx("span",{className:"text-gray-500",children:"Offline"})]})})]}),r.jsxs("div",{className:"flex flex-col items-center justify-center py-10 px-6 border-b border-white/5",children:[r.jsx("p",{className:"text-[11px] text-gray-500 font-medium uppercase tracking-widest mb-6",children:"Voice Command"}),r.jsxs(H.button,{onPointerDown:g,onPointerUp:x,onPointerLeave:o==="recording"?x:void 0,disabled:o==="sending"||e!=="connected",whileTap:{scale:.93},className:`relative w-28 h-28 rounded-full flex items-center justify-center transition-all select-none ${o==="recording"?"bg-red-500/20 border-2 border-red-500 shadow-[0_0_40px_rgba(239,68,68,0.4)]":o==="sending"?"bg-orange-500/10 border-2 border-orange-500/30":"bg-orange-500/10 border-2 border-orange-500/40 hover:bg-orange-500/20 active:scale-95"} disabled:opacity-40`,children:[o==="sending"?r.jsx(re,{size:36,className:"text-orange-400 animate-spin"}):o==="recording"?r.jsx(sf,{size:36,className:"text-red-400"}):r.jsx(Bs,{size:36,className:"text-orange-400"}),o==="recording"&&r.jsx(H.span,{className:"absolute inset-0 rounded-full border-2 border-red-500",animate:{scale:[1,1.3,1],opacity:[.8,0,.8]},transition:{duration:1.4,repeat:1/0}})]}),r.jsx("p",{className:"text-[12px] text-gray-600 mt-4",children:o==="recording"?"Listening… release to send":"Hold to speak"}),u&&r.jsxs("p",{className:"text-[11px] text-orange-300 mt-3 text-center max-w-xs",children:['"',u,'"']})]}),r.jsxs("div",{className:"px-5 pt-6 pb-4 border-b border-white/5",children:[r.jsx("p",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-widest mb-3",children:"Live Workflow"}),r.jsx(ne,{children:n.length===0?r.jsx("p",{className:"text-[12px] text-gray-700 text-center py-4",children:"No active workflow"}):r.jsx("div",{className:"space-y-2",children:n.slice(-6).map(k=>r.jsxs(H.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex items-start gap-2.5 p-3 rounded-xl border text-[12px] ${k.status==="running"?"bg-orange-500/8 border-orange-500/20":k.status==="error"?"bg-red-500/8 border-red-500/15":"bg-white/3 border-white/5"}`,children:[k.status==="running"&&r.jsx(re,{size:12,className:"animate-spin text-orange-400 mt-0.5 shrink-0"}),k.status==="done"&&r.jsx(Fe,{size:12,className:"text-green-400 mt-0.5 shrink-0"}),k.status==="error"&&r.jsx(mt,{size:12,className:"text-red-400 mt-0.5 shrink-0"}),r.jsx("span",{className:k.status==="running"?"text-orange-300":k.status==="error"?"text-red-300":"text-gray-400",children:k.description})]},k.id))})})]}),r.jsxs("div",{className:"px-5 pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("p",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-widest",children:"My Skills"}),r.jsx("button",{onClick:y,className:"text-gray-600 hover:text-gray-400 transition-colors",children:r.jsx(fe,{size:12})})]}),i.length===0?r.jsx("p",{className:"text-[12px] text-gray-700 text-center py-6",children:"No skills saved yet"}):r.jsx("div",{className:"space-y-2.5",children:i.map(k=>{const N=c===k.id;return r.jsxs(H.div,{layout:!0,className:`flex items-center gap-3 p-3.5 rounded-2xl border transition-all ${N?"bg-orange-500/10 border-orange-500/25":"bg-[#0c0f18] border-white/6"}`,children:[r.jsx(Oe,{size:14,className:"text-orange-400 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-semibold text-[13px] text-white truncate",children:k.name}),r.jsxs("p",{className:"text-[10px] text-gray-600 mt-0.5",children:[k.runCount,"× run"]})]}),r.jsxs("button",{onClick:()=>j(k),disabled:!!c,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold transition-all ${N?"bg-orange-500/15 text-orange-400 border border-orange-500/25 cursor-not-allowed":"bg-orange-500/10 border border-orange-500/20 text-orange-400 hover:bg-orange-500/20 disabled:opacity-40 disabled:cursor-not-allowed"}`,children:[N?r.jsx(re,{size:11,className:"animate-spin"}):r.jsx(Ws,{size:11}),N?"Running":"Run"]})]},k.id)})})]})]})}function E_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState(null);return h.useEffect(()=>{$("/api/workspace/files").then(o=>o.ok?o.json():Promise.reject(`HTTP ${o.status}`)).then(o=>{const l=Array.isArray(o==null?void 0:o.files)?o.files:[];t(l.map(c=>({name:c.name,path:c.rel,size:c.size,modified:c.mtime})))}).catch(o=>a(String(o))).finally(()=>s(!1))},[]),r.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx(An,{size:20,className:"text-orange-400"}),r.jsx("h1",{className:"text-lg font-bold text-white",children:"Files"})]}),n&&r.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm",children:[r.jsx(re,{size:14,className:"animate-spin"}),"Loading files…"]}),i&&r.jsxs("p",{className:"text-red-400 text-sm",children:["Failed to load files: ",i]}),!n&&!i&&e.length===0&&r.jsx("p",{className:"text-gray-500 text-sm",children:"No files found in workspace."}),!n&&e.length>0&&r.jsx("div",{className:"space-y-1",children:e.map(o=>r.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 rounded-lg hover:bg-white/5 transition-colors",children:[r.jsx(en,{size:14,className:"text-gray-400 shrink-0"}),r.jsx("span",{className:"text-[13px] text-gray-200 flex-1 truncate",children:o.name}),o.size!==void 0&&r.jsxs("span",{className:"text-[11px] text-gray-500",children:[(o.size/1024).toFixed(1)," KB"]})]},o.path))})]})}const __=[{value:"all",label:"Tüm Veriler",icon:r.jsx(qe,{size:13})},{value:"text",label:"Sadece Metin",icon:r.jsx(en,{size:13})},{value:"links",label:"Sadece Linkler",icon:r.jsx(Yr,{size:13})},{value:"images",label:"Sadece Görseller",icon:r.jsx(tf,{size:13})}];function T_(e){return e==="text"?r.jsx(en,{size:13,className:"text-orange-400 shrink-0 mt-0.5"}):e==="link"?r.jsx(Yr,{size:13,className:"text-blue-400 shrink-0 mt-0.5"}):r.jsx(tf,{size:13,className:"text-purple-400 shrink-0 mt-0.5"})}function P_(e){return e==="text"?"Metin":e==="link"?"Link":"Görsel"}function A_(){const[e,t]=h.useState(""),[n,s]=h.useState("all"),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(new Set),[f,m]=h.useState(!1),[b,v]=h.useState(!1),[y,g]=h.useState(""),[x,w]=h.useState(""),[j,k]=h.useState(!1),[N,S]=h.useState(""),[_,R]=h.useState([]),[L,P]=h.useState(null),[V,M]=h.useState(!1),B=h.useRef(null);h.useEffect(()=>{$("/api/memory/save-path").then(I=>I.json()).then(I=>{I.ok&&I.path&&(g(I.path),w(I.path))}).catch(()=>{})},[]);const A=(c??[]).filter(I=>n==="all"?!0:I.type===(n==="links"?"link":n==="images"?"image":"text")),T=I=>{p(Q=>{const G=new Set(Q);return G.has(I)?G.delete(I):G.add(I),G})},F=()=>{u.size===A.length?p(new Set):p(new Set(A.map(I=>I.id)))},C=async()=>{const I=e.trim();if(I){a(!0),l(null),d(null),p(new Set),v(!1);try{const Q=await $("/api/browser/scrape",{method:"POST",body:JSON.stringify({url:I,mode:n})}),G=await Q.json();if(!Q.ok||!G.ok)l(G.error??`Sunucu hatası: ${Q.status}`);else{const J=G.items??[];d(J),p(new Set(J.map(he=>he.id)))}}catch{l("Ağ bağlantısı kurulamadı. Backend çalışıyor mu?")}finally{a(!1)}}},E=async()=>{const I=(c??[]).filter(Q=>u.has(Q.id));if(I.length!==0){m(!0);try{const Q=await $("/api/memory/import",{method:"POST",body:JSON.stringify({entries:I.map(G=>({type:G.type,content:G.content,source:e}))})});if(Q.ok){const G=await Q.json();G.savedTo&&g(G.savedTo.replace(/[\\/][^\\/]+$/,""))}v(!0)}catch{}finally{m(!1)}}},z=()=>{S(y),P(null),R([]),k(!0)},W=()=>{k(!1),S(y),R([]),P(null)},K=I=>{S(I),P(null),B.current&&clearTimeout(B.current),B.current=setTimeout(async()=>{try{const Q=I.replace(/[/\\][^/\\]*$/,"")||I,J=await(await $(`/api/fs/list-dirs?path=${encodeURIComponent(Q)}`)).json();J.ok&&R((J.dirs??[]).filter(he=>he.toLowerCase().startsWith(I.toLowerCase())))}catch{}},250)},X=async()=>{if(!N.trim()){W();return}M(!0),P(null);try{const Q=await(await $("/api/memory/save-path",{method:"POST",body:JSON.stringify({path:N.trim()})})).json();Q.ok&&Q.path?(g(Q.path),w(Q.path),k(!1),R([])):(P(Q.error??"Geçersiz dizin. Önceki yol geri yüklendi."),g(x),S(x))}catch{P("Bağlantı hatası. Önceki yol korunuyor."),g(x),S(x)}finally{M(!1)}};return r.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-10",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shrink-0",style:{background:"rgba(234,88,12,0.15)",border:"1px solid rgba(234,88,12,0.3)"},children:r.jsx(qe,{size:18,className:"text-orange-400 animate-pulse"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[17px] font-bold text-white/90 leading-tight",children:"Tarayıcı Otomasyonu"}),r.jsx("p",{className:"text-[12px] text-white/40",children:"Web sayfalarını tara, analiz et ve verileri belleğine kaydet"})]})]}),r.jsxs("div",{className:"rounded-xl px-5 py-4 mb-5",style:{background:"rgba(249,115,22,0.05)",border:"1px solid rgba(249,115,22,0.15)"},children:[r.jsx("p",{className:"text-[13px] font-semibold text-white/80 mb-3 leading-snug",children:"Must-b Otonom Tarayıcı ile internetin gücünü belleğinize katın:"}),r.jsx("ol",{className:"space-y-1.5",children:["Hedef URL'yi girin.","Çıkarmak istediğiniz veri türünü seçin (Metin, Link veya Görsel).","Başlat butonuna basarak Must-b'nin siteyi analiz etmesini bekleyin.","Sonuçları inceleyin ve kalıcı hafızaya kaydetmek istediklerinizi seçin."].map((I,Q)=>r.jsxs("li",{className:"flex items-start gap-2.5 text-[13px] text-white/80 leading-relaxed",children:[r.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full text-[10px] font-black shrink-0 mt-0.5",style:{background:"rgba(249,115,22,0.25)",color:"#fb923c"},children:Q+1}),I]},Q))}),r.jsxs("p",{className:"mt-3 text-[11px] text-orange-400/70 flex items-start gap-1.5 leading-relaxed",children:[r.jsx("span",{className:"shrink-0 mt-0.5",children:"🔒"}),r.jsxs("span",{children:[r.jsx("strong",{className:"text-orange-400/90",children:"Güvenlik Notu:"})," ","Tüm işlemler yerel Playwright motorunda gerçekleşir, verileriniz üçüncü taraflara asla iletilmez."]})]})]}),r.jsxs("div",{className:"rounded-2xl p-5 mb-4",style:{background:"rgba(13,7,3,0.80)",border:"1px solid rgba(255,255,255,0.10)",backdropFilter:"blur(20px)",boxShadow:"0 8px 40px rgba(0,0,0,0.45)"},children:[r.jsx("label",{className:"block text-[11px] font-bold text-white/40 uppercase tracking-widest mb-2",children:"Hedef URL"}),r.jsxs("div",{className:"flex gap-2 mb-5",children:[r.jsx("input",{type:"url",value:e,onChange:I=>t(I.target.value),onKeyDown:I=>I.key==="Enter"&&!i&&C(),placeholder:"https://example.com",className:"flex-1 px-4 py-2.5 rounded-xl text-[13px] text-white/85 placeholder-white/20 outline-none transition-all",style:{background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.12)"},onFocus:I=>I.currentTarget.style.borderColor="rgba(249,115,22,0.55)",onBlur:I=>I.currentTarget.style.borderColor="rgba(255,255,255,0.12)"}),r.jsxs("button",{onClick:C,disabled:i||!e.trim(),className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-[13px] font-semibold transition-all disabled:opacity-40",style:{background:i||!e.trim()?"rgba(249,115,22,0.25)":"rgba(249,115,22,0.85)",color:"#fff",border:"1px solid rgba(249,115,22,0.4)"},children:[i?r.jsx(re,{size:14,className:"animate-spin"}):r.jsx(ba,{size:14}),i?"Taranıyor…":"Başlat"]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-bold text-white/40 uppercase tracking-widest mb-2.5",children:"Çıkarma Modu"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:__.map(I=>r.jsxs("button",{onClick:()=>s(I.value),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-[12px] font-medium transition-all",style:{background:n===I.value?"rgba(249,115,22,0.18)":"rgba(255,255,255,0.04)",border:n===I.value?"1px solid rgba(249,115,22,0.45)":"1px solid rgba(255,255,255,0.08)",color:n===I.value?"#fb923c":"rgba(255,255,255,0.45)"},children:[I.icon,I.label]},I.value))})]}),i&&r.jsxs("div",{className:"mt-5 flex items-center gap-3 px-4 py-3 rounded-xl",style:{background:"rgba(249,115,22,0.08)",border:"1px solid rgba(249,115,22,0.2)"},children:[r.jsx(re,{size:15,className:"animate-spin text-orange-400 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold text-orange-300",children:"Sayfa taranıyor…"}),r.jsx("p",{className:"text-[11px] text-white/35 mt-0.5",children:"Playwright sayfayı açıyor ve içerik çıkarılıyor"})]})]}),o&&r.jsxs("div",{className:"mt-5 flex items-start gap-3 px-4 py-3 rounded-xl",style:{background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.25)"},children:[r.jsx(mt,{size:15,className:"text-red-400 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold text-red-300",children:"Hata oluştu"}),r.jsx("p",{className:"text-[11px] text-red-400/70 mt-0.5",children:o})]})]})]}),c!==null&&A.length>0&&r.jsxs("div",{className:"rounded-2xl p-5",style:{background:"rgba(13,7,3,0.75)",border:"1px solid rgba(255,255,255,0.10)",backdropFilter:"blur(20px)",boxShadow:"0 8px 40px rgba(0,0,0,0.40)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[13px] font-bold text-white/85",children:"Çıkarılan Veriler"}),r.jsxs("p",{className:"text-[11px] text-white/35 mt-0.5",children:[A.length," öğe bulundu · ",u.size," seçili"]})]}),r.jsxs("button",{onClick:F,className:"text-[11px] font-medium text-orange-400/80 hover:text-orange-400 transition-colors flex items-center gap-1",children:[r.jsx(Qt,{size:12}),u.size===A.length?"Seçimi Kaldır":"Tümünü Seç"]})]}),["text","link","image"].map(I=>{const Q=A.filter(G=>G.type===I);return Q.length===0?null:r.jsxs("div",{className:"mb-4 last:mb-0",children:[r.jsxs("p",{className:"text-[10px] font-bold uppercase tracking-widest text-white/25 mb-1.5 px-1",children:[P_(I)," (",Q.length,")"]}),r.jsx("div",{className:"space-y-1",children:Q.map(G=>r.jsxs("label",{className:"flex items-start gap-3 px-3 py-2.5 rounded-lg cursor-pointer transition-all",style:{background:u.has(G.id)?"rgba(249,115,22,0.08)":"rgba(255,255,255,0.03)",border:u.has(G.id)?"1px solid rgba(249,115,22,0.22)":"1px solid rgba(255,255,255,0.06)"},children:[r.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center shrink-0 mt-0.5 transition-all",style:{background:u.has(G.id)?"rgba(249,115,22,0.8)":"rgba(255,255,255,0.08)",border:u.has(G.id)?"1px solid rgba(249,115,22,0.9)":"1px solid rgba(255,255,255,0.18)"},onClick:()=>T(G.id),children:u.has(G.id)&&r.jsx(at,{size:10,className:"text-white"})}),T_(G.type),r.jsx("span",{className:"text-[12px] text-white/65 leading-relaxed break-all",children:G.content})]},G.id))})]},I)}),r.jsxs("div",{className:"mt-5 pt-4 border-t border-white/8",children:[b?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-2.5 rounded-xl text-[13px] font-semibold",style:{background:"rgba(34,197,94,0.12)",border:"1px solid rgba(34,197,94,0.25)",color:"#4ade80"},children:[r.jsx(at,{size:14}),u.size," öğe belleğe kaydedildi"]}):r.jsx("button",{onClick:E,disabled:f||u.size===0,className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-xl text-[13px] font-semibold transition-all disabled:opacity-40",style:{background:"rgba(249,115,22,0.18)",border:"1px solid rgba(249,115,22,0.35)",color:"#fb923c"},children:f?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:14,className:"animate-spin"})," Kaydediliyor…"]}):r.jsxs(r.Fragment,{children:[r.jsx(sv,{size:14})," Seçilenleri Belleğe Kaydet (",u.size,")"]})}),y&&r.jsxs("div",{className:"mt-3 rounded-xl px-4 py-3",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.09)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx(An,{size:12,className:"text-white/35 shrink-0"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-white/30",children:"Kaydedilen Konum"})]}),j?r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{autoFocus:!0,value:N,onChange:I=>K(I.target.value),onKeyDown:I=>{I.key==="Enter"&&X(),I.key==="Escape"&&W()},placeholder:"Dizin yolu girin…",className:"flex-1 px-3 py-1.5 rounded-lg text-[12px] text-white/80 placeholder-white/20 outline-none",style:{background:"rgba(255,255,255,0.07)",border:"1px solid rgba(249,115,22,0.45)"}}),r.jsx("button",{onClick:X,disabled:V,className:"px-3 py-1.5 rounded-lg text-[11px] font-semibold transition-all disabled:opacity-40",style:{background:"rgba(249,115,22,0.75)",color:"#fff"},children:V?r.jsx(re,{size:11,className:"animate-spin"}):r.jsx(at,{size:11})}),r.jsx("button",{onClick:W,className:"px-2.5 py-1.5 rounded-lg transition-all",style:{background:"rgba(255,255,255,0.06)",color:"rgba(255,255,255,0.4)"},children:r.jsx(He,{size:11})})]}),_.length>0&&r.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 rounded-xl overflow-hidden z-50",style:{background:"rgba(20,12,5,0.97)",border:"1px solid rgba(249,115,22,0.3)",boxShadow:"0 8px 24px rgba(0,0,0,0.6)"},children:_.map(I=>r.jsx("button",{onClick:()=>{S(I),R([])},className:"w-full text-left px-4 py-2 text-[11px] text-white/70 hover:bg-orange-500/10 hover:text-orange-300 transition-colors truncate",children:I},I))}),L&&r.jsxs("p",{className:"mt-1.5 text-[11px] text-red-400 flex items-center gap-1",children:[r.jsx(mt,{size:10}),L]})]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"flex-1 text-[12px] text-white/55 font-mono leading-relaxed break-all",children:y}),r.jsxs("button",{onClick:z,className:"shrink-0 flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium transition-all hover:text-orange-400",style:{background:"rgba(249,115,22,0.1)",border:"1px solid rgba(249,115,22,0.2)",color:"rgba(251,146,60,0.7)"},children:[r.jsx(du,{size:10}),"Düzenle"]})]})]})]})]}),c!==null&&A.length===0&&r.jsx("div",{className:"text-center py-10 text-[13px] text-white/25",children:"Bu modda çıkarılacak veri bulunamadı."})]})}function M_(e){return e.replace(/hey\s+must\s*-?\s*be\b/gi,"Hey Must-b").replace(/hey\s+mustbe\b/gi,"Hey Must-b").replace(/hey\s+most\s+be\b/gi,"Hey Must-b").replace(/hey\s+must\s+b\b/gi,"Hey Must-b").replace(/hey\s+must\s+bee\b/gi,"Hey Must-b").replace(/hay\s+mas+bi\b/gi,"Hey Must-b").replace(/hey\s+mas+bi\b/gi,"Hey Must-b").replace(/hey\s+mast\s*b[ei]?\b/gi,"Hey Must-b").replace(/hey\s+m[au]s[t]?\s*b[ei]?\b/gi,"Hey Must-b").replace(/hey\s+must\s*b[eiy]+\b/gi,"Hey Must-b").replace(/hey\s+moos+\s*b[ei]?\b/gi,"Hey Must-b")}function R_(e){const t=window.speechSynthesis.getVoices(),n=e.toLowerCase();return t.find(s=>s.name.toLowerCase().includes("google")&&s.lang.toLowerCase().startsWith(n))||t.find(s=>s.lang.toLowerCase().startsWith(n)&&!s.localService)||t.find(s=>s.lang.toLowerCase().startsWith(n))||null}function z_(){const e=mn(),{t,locale:n}=gt(),[s,i]=h.useState("wake-listening"),[a,o]=h.useState("Must-b"),[l,c]=h.useState(""),[d,u]=h.useState(""),p=h.useRef(null),f=h.useRef(!1),m=h.useRef(""),b=h.useRef(null),v=h.useRef("wake-listening");h.useEffect(()=>{v.current=s},[s]),h.useEffect(()=>{$("/api/identity").then(N=>N.json()).then(N=>{N.name&&o(N.name)}).catch(()=>{})},[]);const y=h.useCallback(N=>{if(!window.speechSynthesis)return;window.speechSynthesis.cancel();const S=new SpeechSynthesisUtterance(N),_=n==="tr"?"tr-TR":n==="de"?"de-DE":n==="fr"?"fr-FR":n==="es"?"es-ES":n==="ja"?"ja-JP":n==="zh"?"zh-CN":n==="pt"?"pt-PT":"en-US";S.lang=_,S.rate=1.05,S.pitch=1;const R=()=>{const L=R_(_.split("-")[0]);L&&(S.voice=L)};R(),!S.voice&&window.speechSynthesis.onvoiceschanged!==void 0&&(window.speechSynthesis.onvoiceschanged=R),S.onend=()=>{i("wake-listening"),u(""),c("")},S.onerror=()=>i("wake-listening"),i("speaking"),window.speechSynthesis.speak(S)},[n]),g=h.useCallback(async N=>{if(!N.trim()){i("wake-listening");return}i("thinking"),c(N);try{const _=await(await $("/api/goal",{method:"POST",body:JSON.stringify({goal:N,voice:!0})})).json(),R=_.result??_.reply??_.response??_.output??"Done.";u(R),y(R)}catch{i("wake-listening")}},[y]),x=h.useCallback(()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N||!f.current)return;const S=new N;S.continuous=!0,S.interimResults=!0,S.lang=n==="tr"?"tr-TR":"en-US",S.onresult=_=>{var V,M;let R="";for(let B=_.resultIndex;B<_.results.length;B++)R+=_.results[B][0].transcript;const L=M_(R),P=v.current;if(c(L),P==="wake-listening"){const B=`hey ${a}`.toLowerCase();if(L.toLowerCase().includes(B)){const A=((V=L.toLowerCase().split(B)[1])==null?void 0:V.trim())??"";m.current=A,i("cmd-listening"),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{if(m.current.trim()&&v.current==="cmd-listening"){const T=m.current;m.current="",g(T)}},1800)}}else if(P==="cmd-listening"){const B=`hey ${a}`.toLowerCase(),A=L.toLowerCase().includes(B)?((M=L.toLowerCase().split(B)[1])==null?void 0:M.trim())??L:L;m.current=A,b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{if(m.current.trim()&&v.current==="cmd-listening"){const T=m.current;m.current="",g(T)}},2200)}},S.onend=()=>{const _=v.current;f.current&&_!=="thinking"&&_!=="speaking"?setTimeout(x,200):f.current||(i("off"),p.current=null)},S.onerror=_=>{_.error!=="no-speech"&&i("wake-listening"),f.current&&_.error!=="not-allowed"&&setTimeout(x,600)},p.current=S;try{S.start()}catch{}},[a,n,g]),w=()=>{var N,S;s!=="off"?(f.current=!1,(N=p.current)==null||N.stop(),(S=window.speechSynthesis)==null||S.cancel(),b.current&&clearTimeout(b.current),i("off"),c("")):(f.current=!0,i("wake-listening"),x())};h.useEffect(()=>(f.current=!0,i("wake-listening"),x(),()=>{var N,S;f.current=!1,(N=p.current)==null||N.stop(),(S=window.speechSynthesis)==null||S.cancel(),b.current&&clearTimeout(b.current)}),[]);const j=s==="wake-listening"||s==="cmd-listening",k=s==="off";return r.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center overflow-hidden",style:{background:"radial-gradient(ellipse at 50% 45%, rgba(249,115,22,0.22) 0%, #060301 55%)"},children:[r.jsxs("button",{onClick:()=>e("/app"),className:"absolute top-20 left-6 flex items-center gap-2 px-3 py-2 rounded-xl text-white/40 hover:text-white/80 hover:bg-white/8 transition-all text-[13px] font-medium z-10",children:[r.jsx(nC,{size:15}),r.jsx("span",{children:t.voice.back})]}),r.jsx("p",{className:"absolute top-6 text-[12px] font-bold text-white/25 tracking-[0.18em] uppercase select-none",children:t.voice.title}),[200,290,380].map((N,S)=>r.jsx(H.div,{className:"absolute rounded-full",style:{width:N,height:N,border:`1px solid rgba(249,115,22,${.12-S*.03})`},animate:j?{opacity:[.4,.7,.4],scale:[1,1.04,1]}:{opacity:.2,scale:1},transition:{duration:2.2+S*.6,repeat:1/0,ease:"easeInOut",delay:S*.4}},N)),r.jsx(H.button,{onClick:w,className:"relative w-36 h-36 rounded-full flex items-center justify-center cursor-pointer select-none mb-10",style:{background:j?"radial-gradient(circle at 38% 32%, rgba(249,115,22,0.92), rgba(160,55,8,0.75))":"radial-gradient(circle at 38% 32%, rgba(249,115,22,0.38), rgba(22,10,3,0.88))",border:`1px solid rgba(249,115,22,${j?.5:.28})`,boxShadow:j?"0 0 70px rgba(249,115,22,0.55), 0 0 140px rgba(249,115,22,0.18), inset 0 1px 0 rgba(255,255,255,0.12)":"0 0 30px rgba(249,115,22,0.12), inset 0 1px 0 rgba(255,255,255,0.05)"},animate:j?{scale:[1,1.06,1]}:{scale:1},transition:{duration:1.6,repeat:j?1/0:0,ease:"easeInOut"},whileHover:{scale:1.04},whileTap:{scale:.95},children:s==="thinking"?r.jsx(H.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-10 h-10 rounded-full border-2 border-orange-500/30 border-t-orange-400"}):s==="speaking"?r.jsx(H.span,{animate:{scale:[.9,1.1,.9]},transition:{duration:.7,repeat:1/0,ease:"easeInOut"},className:"text-4xl",children:"🔊"}):s==="cmd-listening"?r.jsx(H.span,{animate:{opacity:[.6,1,.6]},transition:{duration:.5,repeat:1/0},children:r.jsx(Bs,{size:38,className:"text-white/95"})}):k?r.jsx(Bs,{size:38,className:"text-orange-300/90"}):r.jsx(sf,{size:38,className:"text-white/90"})}),r.jsx(ne,{mode:"wait",children:r.jsxs(H.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:"flex flex-col items-center gap-3 px-6 text-center",children:[s==="thinking"&&r.jsx("p",{className:"text-[17px] font-medium text-white/65",children:t.voice.thinking}),s==="speaking"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-[17px] font-medium text-orange-300",children:t.voice.speakingHint}),d&&r.jsxs("p",{className:"text-[12px] text-white/35 italic max-w-sm line-clamp-3",children:["“",d.slice(0,140),d.length>140?"…":"","”"]})]}),s==="cmd-listening"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-[17px] font-medium text-white/75",children:t.voice.cmdHint}),l&&r.jsxs("p",{className:"text-[13px] text-white/40 italic max-w-sm",children:["“",l,"”"]})]}),s==="wake-listening"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-[17px] font-medium text-white/65",children:t.voice.wakeHint}),l&&r.jsxs("p",{className:"text-[13px] text-white/35 italic max-w-sm",children:["“",l,"”"]}),r.jsx("p",{className:"text-[11px] text-white/25",children:t.voice.stopHint})]}),s==="off"&&r.jsx("p",{className:"text-[17px] font-medium text-white/40",children:t.voice.tapHint}),j&&r.jsx("div",{className:"flex items-center gap-1 mt-1",children:[0,1,2,3,4].map(N=>r.jsx(H.div,{className:"w-0.5 rounded-full bg-orange-500/60",animate:{height:["6px","18px","6px"]},transition:{duration:.8,repeat:1/0,delay:N*.12,ease:"easeInOut"}},N))})]},s)})]})}function L_({id:e,size:t=16}){const n="shrink-0";switch(e){case"telegram":return r.jsx(of,{size:t,className:n});case"whatsapp":return r.jsx(bo,{size:t,className:n});case"discord":return r.jsx(l0,{size:t,className:n});case"slack":return r.jsx(l0,{size:t,className:n});case"signal":return r.jsx(mv,{size:t,className:n});case"imessage":case"bluebubbles":return r.jsx(Is,{size:t,className:n});case"line":return r.jsx(Is,{size:t,className:n});case"msteams":return r.jsx(uu,{size:t,className:n});case"matrix":case"mattermost":case"irc":case"nextcloud-talk":return r.jsx(il,{size:t,className:n});case"voice-call":case"talk-voice":case"phone-control":return r.jsx(PC,{size:t,className:n});case"twitch":return r.jsx(BC,{size:t,className:n});case"nostr":return r.jsx(af,{size:t,className:n});case"googlechat":return r.jsx(bo,{size:t,className:n});case"feishu":return r.jsx(aC,{size:t,className:n});case"tlon":return r.jsx(qe,{size:t,className:n});case"zalo":case"zalouser":return r.jsx(bo,{size:t,className:n});case"synology-chat":return r.jsx(bC,{size:t,className:n});case"lobster":return r.jsx(Bs,{size:t,className:n});case"memory-lancedb":case"memory-core":return r.jsx(va,{size:t,className:n});case"ollama":case"sglang":case"vllm":case"copilot-proxy":return r.jsx(fn,{size:t,className:n});case"open-prose":return r.jsx(Al,{size:t,className:n});default:return r.jsx(AC,{size:t,className:n})}}function O_({ext:e}){var n,s,i;return e.active?r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-green-500/10 border-green-500/25 text-green-400",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 animate-pulse"}),"Active"]}):((n=e.loadError)==null?void 0:n.includes("Cannot find module"))||((s=e.loadError)==null?void 0:s.includes("MODULE_NOT_FOUND"))||((i=e.loadError)==null?void 0:i.includes("ERR_MODULE_NOT_FOUND"))?r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-white/4 border-white/10 text-gray-500",children:[r.jsx(EC,{size:9,className:"shrink-0"}),"Missing Deps"]}):e.loadError?r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-amber-500/8 border-amber-500/20 text-amber-500",children:[r.jsx(mt,{size:9,className:"shrink-0"}),"Error"]}):r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-white/4 border-white/10 text-gray-500",children:[r.jsx(At,{size:9,className:"shrink-0"}),"Deferred"]})}function D_({ext:e}){var i;const t=((i=e.channel)==null?void 0:i.label)??e.id,n=e.active?"text-orange-400":"text-white/30",s=e.active?"border-orange-500/20 hover:border-orange-500/35":"border-white/6 hover:border-white/10";return r.jsxs("div",{className:`group relative flex flex-col gap-3 p-4 rounded-2xl bg-white/[0.025] border transition-all ${s}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${e.active?"bg-orange-500/12 border border-orange-500/20":"bg-white/4 border border-white/8"}`,children:r.jsx("span",{className:n,children:r.jsx(L_,{id:e.id,size:16})})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-[13px] font-semibold text-white/85 truncate leading-tight",children:t}),r.jsxs("p",{className:"text-[10px] text-gray-600 mt-0.5 font-mono",children:["v",e.version]})]})]}),r.jsx(O_,{ext:e})]}),e.description&&r.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed line-clamp-2",children:e.description}),!e.active&&e.loadError&&!e.loadError.includes("Cannot find module")&&r.jsx("p",{className:"text-[10px] text-amber-600/80 font-mono truncate border-t border-white/5 pt-2",children:e.loadError.slice(0,80)})]})}function O0({title:e,items:t}){if(t.length===0)return null;const n=t.filter(s=>s.active).length;return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-[11px] font-bold text-white/40 uppercase tracking-widest",children:e}),r.jsxs("span",{className:"text-[10px] text-gray-600",children:[t.length," total"]}),n>0&&r.jsxs("span",{className:"text-[10px] text-green-500 font-semibold",children:[n," active"]})]}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(s=>r.jsx(D_,{ext:s},s.id))})]})}function I_(){return r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Array.from({length:9}).map((e,t)=>r.jsx("div",{className:"h-[100px] rounded-2xl bg-white/[0.025] border border-white/6 animate-pulse"},t))})}function B_(){const[e,t]=h.useState(null),[n,s]=h.useState(!0),[i,a]=h.useState(null),o=h.useCallback(async()=>{s(!0),a(null);try{const p=await $("/api/extensions");if(!p.ok)throw new Error(`HTTP ${p.status}`);t(await p.json())}catch(p){a(String(p))}finally{s(!1)}},[]);h.useEffect(()=>{o()},[o]);const l=(e==null?void 0:e.extensions.filter(p=>p.channel!==null).sort((p,f)=>{var m,b;return(((m=p.channel)==null?void 0:m.order)??99)-(((b=f.channel)==null?void 0:b.order)??99)}))??[],c=(e==null?void 0:e.extensions.filter(p=>p.channel===null))??[],d=(e==null?void 0:e.loaded)??0,u=(e==null?void 0:e.catalogSize)??0;return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(af,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Channels & Extensions"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:["Phase B — ",u," extensions discovered"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[e&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-xl bg-white/[0.025] border border-white/8",children:[d>0?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:13,className:"text-green-400 shrink-0"}),r.jsxs("span",{className:"text-[11px] font-semibold text-green-400",children:[d," active"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(At,{size:13,className:"text-gray-500 shrink-0"}),r.jsx("span",{className:"text-[11px] font-semibold text-gray-500",children:"0 active"})]}),r.jsx("span",{className:"text-white/15",children:"·"}),r.jsxs("span",{className:"text-[11px] text-gray-600",children:[u-d," deferred"]})]}),r.jsxs("button",{onClick:o,disabled:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-gray-400 hover:text-white/80 hover:bg-white/6 hover:border-white/12 transition-all text-[11px] font-medium disabled:opacity-40",children:[r.jsx(fe,{size:12,className:n?"animate-spin":""}),"Refresh"]})]})]}),!n&&e&&d===0&&r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl bg-amber-500/5 border border-amber-500/15",children:[r.jsx(mt,{size:15,className:"text-amber-500 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold text-amber-400",children:"Extensions deferred — dependencies not installed"}),r.jsxs("p",{className:"text-[11px] text-amber-600/80 mt-0.5",children:["Channel extensions require their SDK packages (e.g. ",r.jsx("code",{className:"font-mono",children:"must-b/plugin-sdk/*"}),") and memory-lancedb requires ",r.jsx("code",{className:"font-mono",children:"@lancedb/lancedb"}),". The ExtensionLoader catalog is ready — install dependencies to activate extensions at next boot."]})]})]}),n&&!e&&r.jsx(I_,{}),i&&r.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-xl bg-red-500/8 border border-red-500/15",children:[r.jsx(mt,{size:15,className:"text-red-400 shrink-0"}),r.jsx("p",{className:"text-[12px] text-red-400",children:i})]}),e&&r.jsxs("div",{className:"space-y-8",children:[r.jsx(O0,{title:"Messaging Channels",items:l}),r.jsx(O0,{title:"System Plugins",items:c})]})]})}function ns(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function D0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gf(...e){return t=>{let n=!1;const s=e.map(i=>{const a=D0(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<s.length;i++){const a=s[i];typeof a=="function"?a():D0(e[i],null)}}}}function Gs(...e){return h.useCallback(gf(...e),e)}function F_(e,t){const n=h.createContext(t),s=a=>{const{children:o,...l}=a,c=h.useMemo(()=>l,Object.values(l));return r.jsx(n.Provider,{value:c,children:o})};s.displayName=e+"Provider";function i(a){const o=h.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,i]}function V_(e,t=[]){let n=[];function s(a,o){const l=h.createContext(o),c=n.length;n=[...n,o];const d=p=>{var g;const{scope:f,children:m,...b}=p,v=((g=f==null?void 0:f[e])==null?void 0:g[c])||l,y=h.useMemo(()=>b,Object.values(b));return r.jsx(v.Provider,{value:y,children:m})};d.displayName=a+"Provider";function u(p,f){var v;const m=((v=f==null?void 0:f[e])==null?void 0:v[c])||l,b=h.useContext(m);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,u]}const i=()=>{const a=n.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[s,$_(i,...t)]}function $_(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const p=c(a)[`__scope${d}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var la=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},U_=Su[" useId ".trim().toString()]||(()=>{}),H_=0;function Fc(e){const[t,n]=h.useState(U_());return la(()=>{n(s=>s??String(H_++))},[e]),e||(t?`radix-${t}`:"")}var W_=Su[" useInsertionEffect ".trim().toString()]||la;function K_({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,a,o]=G_({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i;{const u=h.useRef(e!==void 0);h.useEffect(()=>{const p=u.current;p!==l&&console.warn(`${s} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,s])}const d=h.useCallback(u=>{var p;if(l){const f=q_(u)?u(e):u;f!==e&&((p=o.current)==null||p.call(o,f))}else a(u)},[l,e,a,o]);return[c,d]}function G_({defaultProp:e,onChange:t}){const[n,s]=h.useState(e),i=h.useRef(n),a=h.useRef(t);return W_(()=>{a.current=t},[t]),h.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,s,a]}function q_(e){return typeof e=="function"}function Y_(e){const t=X_(e),n=h.forwardRef((s,i)=>{const{children:a,...o}=s,l=h.Children.toArray(a),c=l.find(J_);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return r.jsx(t,{...o,ref:i,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return r.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function X_(e){const t=h.forwardRef((n,s)=>{const{children:i,...a}=n;if(h.isValidElement(i)){const o=eT(i),l=Z_(a,i.props);return i.type!==h.Fragment&&(l.ref=s?gf(s,o):o),h.cloneElement(i,l)}return h.Children.count(i)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Q_=Symbol("radix.slottable");function J_(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Q_}function Z_(e,t){const n={...t};for(const s in t){const i=e[s],a=t[s];/^on[A-Z]/.test(s)?i&&a?n[s]=(...l)=>{const c=a(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...a}:s==="className"&&(n[s]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function eT(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mn=tT.reduce((e,t)=>{const n=Y_(`Primitive.${t}`),s=h.forwardRef((i,a)=>{const{asChild:o,...l}=i,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function nT(e,t){e&&gh.flushSync(()=>e.dispatchEvent(t))}function ca(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function sT(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e);h.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var rT="DismissableLayer",vu="dismissableLayer.update",iT="dismissableLayer.pointerDownOutside",aT="dismissableLayer.focusOutside",I0,Dv=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Iv=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=e,d=h.useContext(Dv),[u,p]=h.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=h.useState({}),b=Gs(t,S=>p(S)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),x=u?v.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,j=x>=g,k=cT(S=>{const _=S.target,R=[...d.branches].some(L=>L.contains(_));!j||R||(i==null||i(S),o==null||o(S),S.defaultPrevented||l==null||l())},f),N=dT(S=>{const _=S.target;[...d.branches].some(L=>L.contains(_))||(a==null||a(S),o==null||o(S),S.defaultPrevented||l==null||l())},f);return sT(S=>{x===d.layers.size-1&&(s==null||s(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),h.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(I0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),B0(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=I0)}},[u,f,n,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),B0())},[u,d]),h.useEffect(()=>{const S=()=>m({});return document.addEventListener(vu,S),()=>document.removeEventListener(vu,S)},[]),r.jsx(Mn.div,{...c,ref:b,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:ns(e.onFocusCapture,N.onFocusCapture),onBlurCapture:ns(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ns(e.onPointerDownCapture,k.onPointerDownCapture)})});Iv.displayName=rT;var oT="DismissableLayerBranch",lT=h.forwardRef((e,t)=>{const n=h.useContext(Dv),s=h.useRef(null),i=Gs(t,s);return h.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),r.jsx(Mn.div,{...e,ref:i})});lT.displayName=oT;function cT(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e),s=h.useRef(!1),i=h.useRef(()=>{});return h.useEffect(()=>{const a=l=>{if(l.target&&!s.current){let c=function(){Bv(iT,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function dT(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e),s=h.useRef(!1);return h.useEffect(()=>{const i=a=>{a.target&&!s.current&&Bv(aT,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function B0(){const e=new CustomEvent(vu);document.dispatchEvent(e)}function Bv(e,t,n,{discrete:s}){const i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?nT(i,a):i.dispatchEvent(a)}var Vc="focusScope.autoFocusOnMount",$c="focusScope.autoFocusOnUnmount",F0={bubbles:!1,cancelable:!0},uT="FocusScope",Fv=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[l,c]=h.useState(null),d=ca(i),u=ca(a),p=h.useRef(null),f=Gs(t,v=>c(v)),m=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(s){let v=function(w){if(m.paused||!l)return;const j=w.target;l.contains(j)?p.current=j:In(p.current,{select:!0})},y=function(w){if(m.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||In(p.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const k of w)k.removedNodes.length>0&&In(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const x=new MutationObserver(g);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),x.disconnect()}}},[s,l,m.paused]),h.useEffect(()=>{if(l){$0.add(m);const v=document.activeElement;if(!l.contains(v)){const g=new CustomEvent(Vc,F0);l.addEventListener(Vc,d),l.dispatchEvent(g),g.defaultPrevented||(hT(xT(Vv(l)),{select:!0}),document.activeElement===v&&In(l))}return()=>{l.removeEventListener(Vc,d),setTimeout(()=>{const g=new CustomEvent($c,F0);l.addEventListener($c,u),l.dispatchEvent(g),g.defaultPrevented||In(v??document.body,{select:!0}),l.removeEventListener($c,u),$0.remove(m)},0)}}},[l,d,u,m]);const b=h.useCallback(v=>{if(!n&&!s||m.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(y&&g){const x=v.currentTarget,[w,j]=fT(x);w&&j?!v.shiftKey&&g===j?(v.preventDefault(),n&&In(w,{select:!0})):v.shiftKey&&g===w&&(v.preventDefault(),n&&In(j,{select:!0})):g===x&&v.preventDefault()}},[n,s,m.paused]);return r.jsx(Mn.div,{tabIndex:-1,...o,ref:f,onKeyDown:b})});Fv.displayName=uT;function hT(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(In(s,{select:t}),document.activeElement!==n)return}function fT(e){const t=Vv(e),n=V0(t,e),s=V0(t.reverse(),e);return[n,s]}function Vv(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function V0(e,t){for(const n of e)if(!pT(n,{upTo:t}))return n}function pT(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function mT(e){return e instanceof HTMLInputElement&&"select"in e}function In(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mT(e)&&t&&e.select()}}var $0=gT();function gT(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=U0(e,t),e.unshift(t)},remove(t){var n;e=U0(e,t),(n=e[0])==null||n.resume()}}}function U0(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function xT(e){return e.filter(t=>t.tagName!=="A")}var yT="Portal",$v=h.forwardRef((e,t)=>{var l;const{container:n,...s}=e,[i,a]=h.useState(!1);la(()=>a(!0),[]);const o=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?py.createPortal(r.jsx(Mn.div,{...s,ref:t}),o):null});$v.displayName=yT;function vT(e,t){return h.useReducer((n,s)=>t[n][s]??n,e)}var Il=e=>{const{present:t,children:n}=e,s=bT(t),i=typeof n=="function"?n({present:s.isPresent}):h.Children.only(n),a=Gs(s.ref,wT(i));return typeof n=="function"||s.isPresent?h.cloneElement(i,{ref:a}):null};Il.displayName="Presence";function bT(e){const[t,n]=h.useState(),s=h.useRef(null),i=h.useRef(e),a=h.useRef("none"),o=e?"mounted":"unmounted",[l,c]=vT(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=Ja(s.current);a.current=l==="mounted"?d:"none"},[l]),la(()=>{const d=s.current,u=i.current;if(u!==e){const f=a.current,m=Ja(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&f!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),la(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,p=m=>{const v=Ja(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(c("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=m=>{m.target===t&&(a.current=Ja(s.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(d=>{s.current=d?getComputedStyle(d):null,n(d)},[])}}function Ja(e){return(e==null?void 0:e.animationName)||"none"}function wT(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Uc=0;function kT(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??H0()),document.body.insertAdjacentElement("beforeend",e[1]??H0()),Uc++,()=>{Uc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Uc--}},[])}function H0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var on=function(){return on=Object.assign||function(t){for(var n,s=1,i=arguments.length;s<i;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},on.apply(this,arguments)};function Uv(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function jT(e,t,n){if(n||arguments.length===2)for(var s=0,i=t.length,a;s<i;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var So="right-scroll-bar-position",Co="width-before-scroll-bar",NT="with-scroll-bars-hidden",ST="--removed-body-scroll-bar-size";function Hc(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function CT(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=t,n.facade}var ET=typeof window<"u"?h.useLayoutEffect:h.useEffect,W0=new WeakMap;function _T(e,t){var n=CT(null,function(s){return e.forEach(function(i){return Hc(i,s)})});return ET(function(){var s=W0.get(n);if(s){var i=new Set(s),a=new Set(e),o=n.current;i.forEach(function(l){a.has(l)||Hc(l,null)}),a.forEach(function(l){i.has(l)||Hc(l,o)})}W0.set(n,e)},[e]),n}function TT(e){return e}function PT(e,t){t===void 0&&(t=TT);var n=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var o=t(a,s);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(s=!0;n.length;){var o=n;n=[],o.forEach(a)}n={push:function(l){return a(l)},filter:function(){return n}}},assignMedium:function(a){s=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(a),o=n}var c=function(){var u=o;o=[],u.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return i}function AT(e){e===void 0&&(e={});var t=PT(null);return t.options=on({async:!0,ssr:!1},e),t}var Hv=function(e){var t=e.sideCar,n=Uv(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return h.createElement(s,on({},n))};Hv.isSideCarExport=!0;function MT(e,t){return e.useMedium(t),Hv}var Wv=AT(),Wc=function(){},Bl=h.forwardRef(function(e,t){var n=h.useRef(null),s=h.useState({onScrollCapture:Wc,onWheelCapture:Wc,onTouchMoveCapture:Wc}),i=s[0],a=s[1],o=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,p=e.shards,f=e.sideCar,m=e.noRelative,b=e.noIsolation,v=e.inert,y=e.allowPinchZoom,g=e.as,x=g===void 0?"div":g,w=e.gapMode,j=Uv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,N=_T([n,t]),S=on(on({},j),i);return h.createElement(h.Fragment,null,u&&h.createElement(k,{sideCar:Wv,removeScrollBar:d,shards:p,noRelative:m,noIsolation:b,inert:v,setCallbacks:a,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?h.cloneElement(h.Children.only(l),on(on({},S),{ref:N})):h.createElement(x,on({},S,{className:c,ref:N}),l))});Bl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Bl.classNames={fullWidth:Co,zeroRight:So};var RT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=RT();return t&&e.setAttribute("nonce",t),e}function LT(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function OT(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var DT=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zT())&&(LT(t,n),OT(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},IT=function(){var e=DT();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Kv=function(){var e=IT(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},BT={left:0,top:0,right:0,gap:0},Kc=function(e){return parseInt(e||"",10)||0},FT=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Kc(n),Kc(s),Kc(i)]},VT=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return BT;var t=FT(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},$T=Kv(),Tr="data-scroll-locked",UT=function(e,t,n,s){var i=e.left,a=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
764
|
+
`}),r.jsx("div",{className:"max-w-full",dangerouslySetInnerHTML:{__html:f}})]})]})]})]})}const v_=[{id:"terminal",label:"Terminal",desc:"Kabuk komutları çalıştır",Icon:os,color:"text-green-400",bg:"bg-green-500/10",border:"border-green-500/20"},{id:"browser",label:"Browser",desc:"Playwright ile tam web otomasyonu",Icon:qe,color:"text-blue-400",bg:"bg-blue-500/10",border:"border-blue-500/20"},{id:"web-search",label:"Web Search",desc:"Çoklu sağlayıcıyla gerçek zamanlı arama",Icon:Zt,color:"text-cyan-400",bg:"bg-cyan-500/10",border:"border-cyan-500/20"},{id:"file-manager",label:"Files",desc:"Dosya oku, yaz ve yönet",Icon:An,color:"text-yellow-400",bg:"bg-yellow-500/10",border:"border-yellow-500/20"},{id:"image-gen",label:"Görsel Üret",desc:"AI ile görsel üret",Icon:fv,color:"text-pink-400",bg:"bg-pink-500/10",border:"border-pink-500/20"},{id:"code",label:"Kod Analizi",desc:"Kod yaz, analiz et ve hata ayıkla",Icon:Jt,color:"text-purple-400",bg:"bg-purple-500/10",border:"border-purple-500/20"},{id:"memory",label:"Bellek",desc:"Semantik hafıza arama & kayıt",Icon:Xt,color:"text-orange-400",bg:"bg-orange-500/10",border:"border-orange-500/20"},{id:"vision",label:"Görme",desc:"Ekran ve görsel algı",Icon:cu,color:"text-emerald-400",bg:"bg-emerald-500/10",border:"border-emerald-500/20"},{id:"screen-sense",label:"Ekranı Gör",desc:"Kullanıcı ekranını yakala ve analiz et",Icon:rf,color:"text-indigo-400",bg:"bg-indigo-500/10",border:"border-indigo-500/20"},{id:"gateway",label:"Gateway",desc:"Sistem arası ve A2A iletişim",Icon:il,color:"text-teal-400",bg:"bg-teal-500/10",border:"border-teal-500/20"},{id:"messages",label:"Mesajlar",desc:"Ajan-arası mesaj gönder & al",Icon:Is,color:"text-rose-400",bg:"bg-rose-500/10",border:"border-rose-500/20"},{id:"git",label:"Git",desc:"Commit, branch, diff, push/pull",Icon:lv,color:"text-amber-400",bg:"bg-amber-500/10",border:"border-amber-500/20"}];function b_(){const[e,t]=h.useState("tools"),[n,s]=h.useState([]),[i,a]=h.useState([]),[o,l]=h.useState({}),[c,d]=h.useState(!1),[u,p]=h.useState(""),f=h.useCallback(async()=>{d(!0);try{const j=await $("/api/skills/list");if(j.ok){const k=await j.json();s(Array.isArray(k)?k:[])}}catch{}d(!1)},[]),m=h.useCallback(async()=>{d(!0);try{const j=await $("/api/skills/catalog");if(j.ok){const k=await j.json(),N=Array.isArray(k)?k:k.skills??[];a(N)}}catch{}d(!1)},[]);h.useEffect(()=>{e==="saved"&&f(),e==="catalog"&&m()},[e,f,m]);const b=async j=>{l(k=>({...k,[j.id]:"running"}));try{const k=await $("/api/skills/run",{method:"POST",body:JSON.stringify({id:j.id})});l(N=>({...N,[j.id]:k.ok?"done":"error"})),de[k.ok?"success":"error"](k.ok?`"${j.name}" çalıştırıldı`:"Çalıştırma başarısız"),setTimeout(()=>l(N=>({...N,[j.id]:"idle"})),2500)}catch{l(k=>({...k,[j.id]:"error"}))}},y=async j=>{try{await $(`/api/skills/${j}`,{method:"DELETE"}),s(k=>k.filter(N=>N.id!==j)),de.success("Beceri silindi.")}catch{de.error("Silinemedi.")}},v=async(j,k)=>{l(N=>({...N,[j]:"running"}));try{const N=await $("/api/v1/skills/invoke",{method:"POST",body:JSON.stringify({skill:j,goal:`${k} becerisini çalıştır`})});l(S=>({...S,[j]:N.ok?"done":"error"})),N.ok&&de.success(`"${k}" yapay zekanın araç kutusuna eklendi ve aktif edildi`),setTimeout(()=>l(S=>({...S,[j]:"idle"})),2500)}catch{l(N=>({...N,[j]:"error"}))}},g=v_.filter(j=>j.label.toLowerCase().includes(u.toLowerCase())||j.desc.toLowerCase().includes(u.toLowerCase())),x=n.filter(j=>j.name.toLowerCase().includes(u.toLowerCase())||j.goal.toLowerCase().includes(u.toLowerCase())),w=i.filter(j=>j.name.toLowerCase().includes(u.toLowerCase())||j.description.toLowerCase().includes(u.toLowerCase())||(j.pluginName??"").toLowerCase().includes(u.toLowerCase()));return r.jsxs("div",{className:"min-h-screen bg-transparent pt-4 pb-10 px-4 sm:px-6 max-w-5xl mx-auto",children:[r.jsx("div",{className:"mb-6",children:r.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[r.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.25)"},children:r.jsx(Oe,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[22px] font-black text-white/95 leading-none",children:"Beceriler & Araçlar"}),r.jsx("p",{className:"text-[12px] text-white/35 mt-0.5",children:"Must-b'nin bilişsel yetenekleri"})]})]})}),r.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[r.jsxs("div",{className:"relative flex-1 max-w-xs",children:[r.jsx(Zt,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/25"}),r.jsx("input",{value:u,onChange:j=>p(j.target.value),placeholder:"Ara…",className:"w-full bg-white/5 border border-white/8 rounded-xl py-2 pl-8 pr-3 text-[13px] text-white/75 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20"})]}),r.jsx("div",{className:"flex rounded-xl overflow-hidden border border-white/8",children:[{key:"tools",label:"Dahili Araçlar"},{key:"saved",label:"Kaydedilen"},{key:"catalog",label:"Katalog"}].map(({key:j,label:k})=>r.jsx("button",{onClick:()=>t(j),className:`px-4 py-2 text-[12px] font-semibold transition-all ${e===j?"bg-orange-500/20 text-orange-300":"text-white/40 hover:text-white/70 hover:bg-white/5"}`,children:k},j))})]}),e==="tools"&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:g.map(({id:j,label:k,desc:N,Icon:S,color:_,bg:R,border:L})=>r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18},className:`rounded-2xl p-4 flex gap-3 items-start border ${L}`,style:{background:"rgba(13,7,3,0.6)",backdropFilter:"blur(12px)"},children:[r.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${R} border ${L}`,children:r.jsx(S,{size:16,className:_})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90 leading-tight",children:k}),r.jsx("p",{className:"text-[11px] text-white/40 mt-0.5 leading-tight",children:N})]}),r.jsx("div",{className:"shrink-0 mt-1",children:r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-md bg-green-500/12 border border-green-500/20 text-green-400",children:"Aktif"})})]},j))}),e==="saved"&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("p",{className:"text-[11px] text-white/30",children:[n.length," kaydedilmiş beceri"]}),r.jsx("button",{onClick:f,className:"p-1.5 text-white/30 hover:text-white/70 rounded-lg hover:bg-white/6 transition-all",children:r.jsx(fe,{size:13})})]}),c?r.jsx("div",{className:"flex justify-center py-16",children:r.jsx(re,{size:20,className:"animate-spin text-orange-500/50"})}):x.length===0?r.jsx("div",{className:"text-center py-16 text-white/20 text-[13px]",children:u?"Eşleşen beceri bulunamadı.":"Henüz kaydedilmiş beceri yok."}):r.jsx("div",{className:"space-y-2",children:x.map(j=>{const k=o[j.id]??"idle";return r.jsxs(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-2xl p-4 border border-orange-500/10",style:{background:"rgba(13,7,3,0.6)",backdropFilter:"blur(12px)"},children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/10 border border-orange-500/20 flex items-center justify-center shrink-0 mt-0.5",children:r.jsx(Al,{size:14,className:"text-orange-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90",children:j.name}),r.jsx("p",{className:"text-[11px] text-white/40 truncate mt-0.5",children:j.goal}),r.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-white/25",children:[r.jsx(rv,{size:9})," ",j.runCount," çalıştırma"]}),r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-white/25",children:[r.jsx(At,{size:9})," ",new Date(j.savedAt).toLocaleDateString("tr-TR")]})]})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{onClick:()=>b(j),disabled:k==="running",className:`w-8 h-8 rounded-xl flex items-center justify-center transition-all border ${k==="done"?"bg-green-500/15 border-green-500/25 text-green-400":k==="error"?"bg-red-500/15 border-red-500/25 text-red-400":k==="running"?"bg-orange-500/10 border-orange-500/20 text-orange-400":"bg-white/5 border-white/10 text-white/50 hover:bg-orange-500/15 hover:border-orange-500/25 hover:text-orange-300"}`,children:k==="running"?r.jsx(re,{size:13,className:"animate-spin"}):k==="done"?r.jsx(Fe,{size:13}):k==="error"?r.jsx(mt,{size:13}):r.jsx(Ws,{size:13})}),r.jsx("button",{onClick:()=>y(j.id),className:"w-8 h-8 rounded-xl flex items-center justify-center border border-white/8 text-white/25 hover:bg-red-500/12 hover:border-red-500/20 hover:text-red-400 transition-all",children:r.jsx(ms,{size:13})})]})]}),(j.tags??[]).length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-2 ml-11",children:(j.tags??[]).map(N=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/5 border border-white/8 text-white/35",children:N},N))})]},j.id)})})]}),e==="catalog"&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("p",{className:"text-[11px] text-white/30",children:[i.length," beceri"]}),r.jsx("button",{onClick:m,className:"p-1.5 text-white/30 hover:text-white/70 rounded-lg hover:bg-white/6 transition-all",children:r.jsx(fe,{size:13})})]}),c?r.jsx("div",{className:"flex justify-center py-16",children:r.jsx(re,{size:20,className:"animate-spin text-orange-500/50"})}):w.length===0?r.jsx("div",{className:"text-center py-16 text-white/20 text-[13px]",children:u?"Eşleşen beceri bulunamadı.":"Katalog boş."}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:w.map(j=>{var N;const k=o[j.id]??"idle";return r.jsxs(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-2xl p-4 border border-white/8 flex gap-3",style:{background:"rgba(13,7,3,0.55)",backdropFilter:"blur(12px)"},children:[r.jsx("div",{className:"text-[22px] shrink-0",children:j.emoji??"⚡"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90",children:j.name}),r.jsx("p",{className:"text-[11px] text-white/40 mt-0.5 leading-tight line-clamp-2",children:j.description}),j.pluginName&&r.jsx("p",{className:"text-[10px] text-white/20 mt-1",children:j.pluginName}),(((N=j.requires)==null?void 0:N.bins)??[]).length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:(j.requires.bins??[]).map(S=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-orange-500/8 border border-orange-500/15 text-orange-400/70",children:S},S))})]}),r.jsx("button",{onClick:()=>v(j.id,j.name),disabled:k==="running",className:`w-8 h-8 rounded-xl flex items-center justify-center shrink-0 transition-all border mt-0.5 ${k==="done"?"bg-green-500/15 border-green-500/25 text-green-400":k==="error"?"bg-red-500/15 border-red-500/25 text-red-400":k==="running"?"bg-orange-500/10 border-orange-500/20 text-orange-400":"bg-white/5 border-white/10 text-white/50 hover:bg-orange-500/15 hover:border-orange-500/25 hover:text-orange-300"}`,children:k==="running"?r.jsx(re,{size:13,className:"animate-spin"}):k==="done"?r.jsx(Fe,{size:13}):k==="error"?r.jsx(mt,{size:13}):r.jsx(fn,{size:13})})]},j.id)})})]})]})}const w_={node:Jt,python:yn,api:Yr,cli:os,web:qe,database:va,cloud:av,agent:aa};function k_(e,t){const n=e.toLowerCase();return n.includes("api")||n.includes("webhook")?Yr:n.includes("db")||n.includes("database")||n.includes("sql")?va:n.includes("cloud")||n.includes("s3")||n.includes("gcs")?av:n.includes("agent")||n.includes("bot")?aa:n.includes("web")||n.includes("http")?qe:w_[t]??Hs}function j_(e){const t=new Map;for(const n of e){if(!n.pluginName)continue;const s=t.get(n.pluginName);s?s.skillCount+=1:t.set(n.pluginName,{name:n.pluginName,emoji:n.emoji??"🔧",skillCount:1})}return Array.from(t.values()).sort((n,s)=>n.name.localeCompare(s.name))}function N_(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(!1),[u,p]=h.useState(""),[f,m]=h.useState(""),[b,y]=h.useState("node"),[v,g]=h.useState(""),[x,w]=h.useState(!1),j=h.useCallback(async()=>{a(!0);try{const[R,L]=await Promise.all([$("/api/plugins/list"),$("/api/skills/catalog")]);if(R.ok){const P=await R.json();t(Array.isArray(P)?P:[])}if(L.ok){const P=await L.json(),V=Array.isArray(P)?P:P.skills??[];s(j_(V))}}catch{}a(!1)},[]);h.useEffect(()=>{j()},[j]);const k=async R=>{l(R.name);try{const L=R.running?"/api/plugins/stop":"/api/plugins/run";(await $(L,{method:"POST",body:JSON.stringify({name:R.name})})).ok?(t(V=>(Array.isArray(V)?V:[]).map(M=>M.name===R.name?{...M,running:!M.running}:M)),de.success(R.running?`"${R.name}" durduruldu`:`"${R.name}" başlatıldı`)):de.error("İşlem başarısız.")}catch{de.error("Bağlantı hatası.")}l(null)},N=async R=>{if(R.preventDefault(),!(!u.trim()||!f.trim())){w(!0);try{const L=await $("/api/plugins/build",{method:"POST",body:JSON.stringify({name:u,goal:f,lang:b,context:v})});if(L.ok){const P=await L.json();de.success(`"${P.name??u}" eklentisi oluşturuldu!`),p(""),m(""),g(""),d(!1),j()}else{const P=await L.json().catch(()=>({}));de.error(P.error??"Oluşturma başarısız.")}}catch{de.error("Gateway bağlantı hatası.")}w(!1)}},S=Array.isArray(e)?e:[],_=S.filter(R=>R.running).length;return r.jsxs("div",{className:"min-h-screen bg-transparent pt-4 pb-10 px-4 sm:px-6 max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center shrink-0",style:{background:"rgba(249,115,22,0.12)",border:"1px solid rgba(249,115,22,0.25)"},children:r.jsx(Fr,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[22px] font-black text-white/95 leading-none",children:"Eklentiler"}),r.jsxs("p",{className:"text-[12px] text-white/35 mt-0.5",children:[S.length," özel eklenti · ",_," çalışıyor"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:j,className:"p-2.5 rounded-xl text-white/30 hover:text-white/70 hover:bg-white/6 border border-white/8 transition-all",children:r.jsx(fe,{size:14})}),r.jsxs("button",{onClick:()=>d(R=>!R),className:`flex items-center gap-1.5 px-4 py-2.5 rounded-xl text-[12px] font-semibold transition-all border ${c?"bg-orange-500/20 border-orange-500/30 text-orange-300":"bg-white/6 border-white/10 text-white/60 hover:bg-orange-500/12 hover:border-orange-500/20 hover:text-orange-300"}`,children:[c?r.jsx(He,{size:13}):r.jsx(zl,{size:13}),c?"Kapat":"Yeni Eklenti"]})]})]}),r.jsx(ne,{children:c&&r.jsx(H.div,{initial:{opacity:0,y:-10,height:0},animate:{opacity:1,y:0,height:"auto"},exit:{opacity:0,y:-8,height:0},transition:{duration:.2},className:"overflow-hidden mb-5",children:r.jsxs("form",{onSubmit:N,className:"rounded-2xl p-5 border border-orange-500/20",style:{background:"rgba(13,7,3,0.7)",backdropFilter:"blur(16px)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Oe,{size:14,className:"text-orange-400"}),r.jsx("h3",{className:"text-[13px] font-bold text-white/90",children:"Yeni Eklenti Oluştur"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Ad"}),r.jsx("input",{value:u,onChange:R=>p(R.target.value),placeholder:"my-plugin",required:!0,className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2 text-[13px] text-white/80 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Dil"}),r.jsx("div",{className:"flex rounded-xl overflow-hidden border border-white/8",children:["node","python"].map(R=>r.jsxs("button",{type:"button",onClick:()=>y(R),className:`flex-1 py-2 text-[12px] font-semibold transition-all flex items-center justify-center gap-1.5 ${b===R?"bg-orange-500/20 text-orange-300":"text-white/40 hover:text-white/70 hover:bg-white/5"}`,children:[R==="node"?r.jsx(Jt,{size:12}):r.jsx(yn,{size:12}),R==="node"?"Node.js":"Python"]},R))})]})]}),r.jsxs("div",{className:"mb-3",children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Hedef / Açıklama"}),r.jsx("textarea",{value:f,onChange:R=>m(R.target.value),placeholder:"Bu eklenti ne yapmalı?",required:!0,rows:2,className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2 text-[13px] text-white/80 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20 resize-none"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-[10px] font-bold text-white/35 uppercase tracking-wider mb-1",children:"Bağlam (isteğe bağlı)"}),r.jsx("textarea",{value:v,onChange:R=>g(R.target.value),placeholder:"API anahtarları, URL'ler, ek bağlam…",rows:2,className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2 text-[13px] text-white/80 outline-none focus:border-orange-500/40 transition-colors placeholder-white/20 resize-none"})]}),r.jsxs("button",{type:"submit",disabled:x||!u.trim()||!f.trim(),className:"flex items-center gap-2 px-5 py-2.5 rounded-xl bg-orange-600/20 border border-orange-500/30 text-orange-300 text-[13px] font-semibold hover:bg-orange-600/30 transition-all disabled:opacity-40",children:[x?r.jsx(re,{size:13,className:"animate-spin"}):r.jsx(fn,{size:13}),x?"Oluşturuluyor…":"Oluştur"]})]})})}),n.length>0&&r.jsxs("div",{className:"mb-6",children:[r.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-white/25 mb-3",children:"Yüklü Beceri Paketleri"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:n.map(R=>r.jsxs(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-2xl p-4 flex gap-3 items-center border border-white/8",style:{background:"rgba(13,7,3,0.55)",backdropFilter:"blur(12px)"},children:[r.jsx("div",{className:"text-[22px] shrink-0",children:R.emoji}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90 leading-tight truncate",children:R.name}),r.jsxs("p",{className:"text-[10px] text-white/30 mt-0.5",children:[R.skillCount," beceri"]})]}),r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-md bg-green-500/12 border border-green-500/20 text-green-400 shrink-0",children:"Yüklü"})]},R.name))})]}),i?r.jsx("div",{className:"flex justify-center py-20",children:r.jsx(re,{size:22,className:"animate-spin text-orange-500/50"})}):S.length===0?r.jsxs("div",{className:"rounded-2xl border border-white/8 p-8 text-center",style:{background:"rgba(13,7,3,0.4)"},children:[r.jsx(Fr,{size:28,className:"text-white/15 mx-auto mb-3"}),r.jsx("p",{className:"text-[13px] text-white/30 font-medium",children:"Henüz özel eklenti yok"}),r.jsx("p",{className:"text-[12px] text-white/20 mt-1",children:'Yukarıdaki "Yeni Eklenti" ile kendi konektörünü oluştur.'})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:S.map(R=>{const L=o===R.name,P=k_(R.name,R.lang),V=R.lang==="node"?Jt:yn;return r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:`rounded-2xl p-4 border transition-all ${R.running?"border-orange-500/25":"border-white/8 hover:border-white/14"}`,style:{background:R.running?"rgba(249,115,22,0.06)":"rgba(13,7,3,0.55)",backdropFilter:"blur(12px)"},children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${R.running?"bg-orange-500/15 border border-orange-500/25":"bg-white/6 border border-white/10"}`,children:r.jsx(P,{size:16,className:R.running?"text-orange-400":"text-white/50"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[13px] font-bold text-white/90 leading-tight truncate max-w-[120px]",children:R.name}),r.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[r.jsx(V,{size:9,className:R.lang==="node"?"text-green-400/60":"text-blue-400/60"}),r.jsx("span",{className:`text-[9px] font-semibold ${R.lang==="node"?"text-green-400/60":"text-blue-400/60"}`,children:R.lang==="node"?"Node.js":"Python"})]})]})]}),r.jsx("span",{className:`text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-md border ${R.running?"bg-orange-500/15 border-orange-500/25 text-orange-400":"bg-white/5 border-white/10 text-white/30"}`,children:R.running?"Çalışıyor":"Durdu"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] text-white/25",children:new Date(R.createdAt).toLocaleDateString("tr-TR")}),r.jsxs("button",{onClick:()=>k(R),disabled:L,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold transition-all border ${R.running?"bg-red-500/12 border-red-500/20 text-red-400 hover:bg-red-500/20":"bg-orange-500/12 border-orange-500/20 text-orange-400 hover:bg-orange-500/20"} disabled:opacity-40`,children:[L?r.jsx(re,{size:11,className:"animate-spin"}):R.running?r.jsx(cf,{size:11}):r.jsx(Ws,{size:11}),R.running?"Durdur":"Başlat"]})]})]},R.name)})})]})}function S_(){return new URLSearchParams(window.location.search).get("token")??""}function C_(){const[e,t]=h.useState("connecting"),[n,s]=h.useState([]),[i,a]=h.useState([]),[o,l]=h.useState("idle"),[c,d]=h.useState(null),[u,p]=h.useState(""),f=h.useRef(null),m=h.useRef(null),b=h.useRef([]),y=S_();h.useEffect(()=>{if(!y){t("denied");return}const k=zi(`${window.location.origin}/mobile`,{query:{token:y},transports:["websocket","polling"]});return f.current=k,k.on("connect",()=>t("connected")),k.on("disconnect",()=>t("disconnected")),k.on("authError",()=>{t("denied"),k.disconnect()}),k.on("agentUpdate",N=>{const{type:S}=N;if(S==="planStart"&&s([]),S==="stepStart"){const _=N.step;s(R=>[...R,{id:`${Date.now()}-${Math.random()}`,description:(_==null?void 0:_.description)??"Working…",status:"running"}])}S==="stepFinish"&&s(_=>{const R=[..._],L=R.findLastIndex(P=>P.status==="running");return L>=0&&(R[L]={...R[L],status:N.status==="error"?"error":"done"}),R}),S==="skillRunStart"&&N.skillId&&d(N.skillId),S==="planFinish"&&d(null)}),()=>{k.disconnect()}},[y]);const v=h.useCallback(async()=>{try{const k=await fetch("/api/skills/list",{headers:{Authorization:`Bearer ${y}`}});if(k.ok){const N=await k.json();a(N.skills??[])}}catch{}},[y]);h.useEffect(()=>{v()},[v]);const g=async()=>{try{const k=await navigator.mediaDevices.getUserMedia({audio:!0}),N=new MediaRecorder(k,{mimeType:"audio/webm"});b.current=[],N.ondataavailable=S=>{S.data.size>0&&b.current.push(S.data)},N.onstop=()=>{k.getTracks().forEach(S=>S.stop()),w()},N.start(),m.current=N,l("recording")}catch{l("idle")}},x=()=>{var k;(k=m.current)==null||k.stop(),l("sending")},w=async()=>{const k=new Blob(b.current,{type:"audio/webm"}),N=new FormData;N.append("audio",k,"voice.webm");try{const S=await fetch("/api/voice/transcribe",{method:"POST",headers:{Authorization:`Bearer ${y}`},body:N});if(S.ok){const{text:_}=await S.json();p(_),await fetch("/api/goal",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},body:JSON.stringify({goal:_})})}}catch{}l("idle")},j=async k=>{if(!c){d(k.id);try{await fetch("/api/skills/run",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},body:JSON.stringify({id:k.id})})}catch{d(null)}}};return!y||e==="denied"?r.jsxs("div",{className:"min-h-screen bg-[#02040a] flex flex-col items-center justify-center gap-4 text-center px-8",children:[r.jsx(mt,{size:40,className:"text-red-400"}),r.jsx("p",{className:"text-white font-bold text-xl",children:"Access Denied"}),r.jsxs("p",{className:"text-gray-500 text-sm",children:["This link is invalid or has expired.",r.jsx("br",{}),"Generate a new QR code from your desktop."]})]}):r.jsxs("div",{className:"min-h-screen bg-[#02040a] text-white flex flex-col pb-8",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("img",{src:"/logo.png",alt:"Must-b",className:"w-8 h-8 object-contain"}),r.jsx("span",{className:"font-bold text-base",children:"Must-b"}),r.jsx("span",{className:"text-[10px] text-orange-400 font-medium bg-orange-400/10 border border-orange-400/20 px-2 py-0.5 rounded-full",children:"Companion"})]}),r.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:e==="connected"?r.jsxs(r.Fragment,{children:[r.jsx(VC,{size:13,className:"text-green-400"}),r.jsx("span",{className:"text-green-400",children:"Connected"})]}):e==="connecting"?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:13,className:"animate-spin text-orange-400"}),r.jsx("span",{className:"text-orange-400",children:"Connecting…"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Ks,{size:13,className:"text-gray-600"}),r.jsx("span",{className:"text-gray-500",children:"Offline"})]})})]}),r.jsxs("div",{className:"flex flex-col items-center justify-center py-10 px-6 border-b border-white/5",children:[r.jsx("p",{className:"text-[11px] text-gray-500 font-medium uppercase tracking-widest mb-6",children:"Voice Command"}),r.jsxs(H.button,{onPointerDown:g,onPointerUp:x,onPointerLeave:o==="recording"?x:void 0,disabled:o==="sending"||e!=="connected",whileTap:{scale:.93},className:`relative w-28 h-28 rounded-full flex items-center justify-center transition-all select-none ${o==="recording"?"bg-red-500/20 border-2 border-red-500 shadow-[0_0_40px_rgba(239,68,68,0.4)]":o==="sending"?"bg-orange-500/10 border-2 border-orange-500/30":"bg-orange-500/10 border-2 border-orange-500/40 hover:bg-orange-500/20 active:scale-95"} disabled:opacity-40`,children:[o==="sending"?r.jsx(re,{size:36,className:"text-orange-400 animate-spin"}):o==="recording"?r.jsx(sf,{size:36,className:"text-red-400"}):r.jsx(Bs,{size:36,className:"text-orange-400"}),o==="recording"&&r.jsx(H.span,{className:"absolute inset-0 rounded-full border-2 border-red-500",animate:{scale:[1,1.3,1],opacity:[.8,0,.8]},transition:{duration:1.4,repeat:1/0}})]}),r.jsx("p",{className:"text-[12px] text-gray-600 mt-4",children:o==="recording"?"Listening… release to send":"Hold to speak"}),u&&r.jsxs("p",{className:"text-[11px] text-orange-300 mt-3 text-center max-w-xs",children:['"',u,'"']})]}),r.jsxs("div",{className:"px-5 pt-6 pb-4 border-b border-white/5",children:[r.jsx("p",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-widest mb-3",children:"Live Workflow"}),r.jsx(ne,{children:n.length===0?r.jsx("p",{className:"text-[12px] text-gray-700 text-center py-4",children:"No active workflow"}):r.jsx("div",{className:"space-y-2",children:n.slice(-6).map(k=>r.jsxs(H.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex items-start gap-2.5 p-3 rounded-xl border text-[12px] ${k.status==="running"?"bg-orange-500/8 border-orange-500/20":k.status==="error"?"bg-red-500/8 border-red-500/15":"bg-white/3 border-white/5"}`,children:[k.status==="running"&&r.jsx(re,{size:12,className:"animate-spin text-orange-400 mt-0.5 shrink-0"}),k.status==="done"&&r.jsx(Fe,{size:12,className:"text-green-400 mt-0.5 shrink-0"}),k.status==="error"&&r.jsx(mt,{size:12,className:"text-red-400 mt-0.5 shrink-0"}),r.jsx("span",{className:k.status==="running"?"text-orange-300":k.status==="error"?"text-red-300":"text-gray-400",children:k.description})]},k.id))})})]}),r.jsxs("div",{className:"px-5 pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("p",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-widest",children:"My Skills"}),r.jsx("button",{onClick:v,className:"text-gray-600 hover:text-gray-400 transition-colors",children:r.jsx(fe,{size:12})})]}),i.length===0?r.jsx("p",{className:"text-[12px] text-gray-700 text-center py-6",children:"No skills saved yet"}):r.jsx("div",{className:"space-y-2.5",children:i.map(k=>{const N=c===k.id;return r.jsxs(H.div,{layout:!0,className:`flex items-center gap-3 p-3.5 rounded-2xl border transition-all ${N?"bg-orange-500/10 border-orange-500/25":"bg-[#0c0f18] border-white/6"}`,children:[r.jsx(Oe,{size:14,className:"text-orange-400 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-semibold text-[13px] text-white truncate",children:k.name}),r.jsxs("p",{className:"text-[10px] text-gray-600 mt-0.5",children:[k.runCount,"× run"]})]}),r.jsxs("button",{onClick:()=>j(k),disabled:!!c,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold transition-all ${N?"bg-orange-500/15 text-orange-400 border border-orange-500/25 cursor-not-allowed":"bg-orange-500/10 border border-orange-500/20 text-orange-400 hover:bg-orange-500/20 disabled:opacity-40 disabled:cursor-not-allowed"}`,children:[N?r.jsx(re,{size:11,className:"animate-spin"}):r.jsx(Ws,{size:11}),N?"Running":"Run"]})]},k.id)})})]})]})}function E_(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState(null);return h.useEffect(()=>{$("/api/workspace/files").then(o=>o.ok?o.json():Promise.reject(`HTTP ${o.status}`)).then(o=>{const l=Array.isArray(o==null?void 0:o.files)?o.files:[];t(l.map(c=>({name:c.name,path:c.rel,size:c.size,modified:c.mtime})))}).catch(o=>a(String(o))).finally(()=>s(!1))},[]),r.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx(An,{size:20,className:"text-orange-400"}),r.jsx("h1",{className:"text-lg font-bold text-white",children:"Files"})]}),n&&r.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm",children:[r.jsx(re,{size:14,className:"animate-spin"}),"Loading files…"]}),i&&r.jsxs("p",{className:"text-red-400 text-sm",children:["Failed to load files: ",i]}),!n&&!i&&e.length===0&&r.jsx("p",{className:"text-gray-500 text-sm",children:"No files found in workspace."}),!n&&e.length>0&&r.jsx("div",{className:"space-y-1",children:e.map(o=>r.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 rounded-lg hover:bg-white/5 transition-colors",children:[r.jsx(en,{size:14,className:"text-gray-400 shrink-0"}),r.jsx("span",{className:"text-[13px] text-gray-200 flex-1 truncate",children:o.name}),o.size!==void 0&&r.jsxs("span",{className:"text-[11px] text-gray-500",children:[(o.size/1024).toFixed(1)," KB"]})]},o.path))})]})}const __=[{value:"all",label:"Tüm Veriler",icon:r.jsx(qe,{size:13})},{value:"text",label:"Sadece Metin",icon:r.jsx(en,{size:13})},{value:"links",label:"Sadece Linkler",icon:r.jsx(Yr,{size:13})},{value:"images",label:"Sadece Görseller",icon:r.jsx(tf,{size:13})}];function T_(e){return e==="text"?r.jsx(en,{size:13,className:"text-orange-400 shrink-0 mt-0.5"}):e==="link"?r.jsx(Yr,{size:13,className:"text-blue-400 shrink-0 mt-0.5"}):r.jsx(tf,{size:13,className:"text-purple-400 shrink-0 mt-0.5"})}function P_(e){return e==="text"?"Metin":e==="link"?"Link":"Görsel"}function A_(){const[e,t]=h.useState(""),[n,s]=h.useState("all"),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(new Set),[f,m]=h.useState(!1),[b,y]=h.useState(!1),[v,g]=h.useState(""),[x,w]=h.useState(""),[j,k]=h.useState(!1),[N,S]=h.useState(""),[_,R]=h.useState([]),[L,P]=h.useState(null),[V,M]=h.useState(!1),B=h.useRef(null);h.useEffect(()=>{$("/api/memory/save-path").then(I=>I.json()).then(I=>{I.ok&&I.path&&(g(I.path),w(I.path))}).catch(()=>{})},[]);const A=(c??[]).filter(I=>n==="all"?!0:I.type===(n==="links"?"link":n==="images"?"image":"text")),T=I=>{p(Q=>{const G=new Set(Q);return G.has(I)?G.delete(I):G.add(I),G})},F=()=>{u.size===A.length?p(new Set):p(new Set(A.map(I=>I.id)))},C=async()=>{const I=e.trim();if(I){a(!0),l(null),d(null),p(new Set),y(!1);try{const Q=await $("/api/browser/scrape",{method:"POST",body:JSON.stringify({url:I,mode:n})}),G=await Q.json();if(!Q.ok||!G.ok)l(G.error??`Sunucu hatası: ${Q.status}`);else{const J=G.items??[];d(J),p(new Set(J.map(he=>he.id)))}}catch{l("Ağ bağlantısı kurulamadı. Backend çalışıyor mu?")}finally{a(!1)}}},E=async()=>{const I=(c??[]).filter(Q=>u.has(Q.id));if(I.length!==0){m(!0);try{const Q=await $("/api/memory/import",{method:"POST",body:JSON.stringify({entries:I.map(G=>({type:G.type,content:G.content,source:e}))})});if(Q.ok){const G=await Q.json();G.savedTo&&g(G.savedTo.replace(/[\\/][^\\/]+$/,""))}y(!0)}catch{}finally{m(!1)}}},z=()=>{S(v),P(null),R([]),k(!0)},W=()=>{k(!1),S(v),R([]),P(null)},K=I=>{S(I),P(null),B.current&&clearTimeout(B.current),B.current=setTimeout(async()=>{try{const Q=I.replace(/[/\\][^/\\]*$/,"")||I,J=await(await $(`/api/fs/list-dirs?path=${encodeURIComponent(Q)}`)).json();J.ok&&R((J.dirs??[]).filter(he=>he.toLowerCase().startsWith(I.toLowerCase())))}catch{}},250)},X=async()=>{if(!N.trim()){W();return}M(!0),P(null);try{const Q=await(await $("/api/memory/save-path",{method:"POST",body:JSON.stringify({path:N.trim()})})).json();Q.ok&&Q.path?(g(Q.path),w(Q.path),k(!1),R([])):(P(Q.error??"Geçersiz dizin. Önceki yol geri yüklendi."),g(x),S(x))}catch{P("Bağlantı hatası. Önceki yol korunuyor."),g(x),S(x)}finally{M(!1)}};return r.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-10",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shrink-0",style:{background:"rgba(234,88,12,0.15)",border:"1px solid rgba(234,88,12,0.3)"},children:r.jsx(qe,{size:18,className:"text-orange-400 animate-pulse"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[17px] font-bold text-white/90 leading-tight",children:"Tarayıcı Otomasyonu"}),r.jsx("p",{className:"text-[12px] text-white/40",children:"Web sayfalarını tara, analiz et ve verileri belleğine kaydet"})]})]}),r.jsxs("div",{className:"rounded-xl px-5 py-4 mb-5",style:{background:"rgba(249,115,22,0.05)",border:"1px solid rgba(249,115,22,0.15)"},children:[r.jsx("p",{className:"text-[13px] font-semibold text-white/80 mb-3 leading-snug",children:"Must-b Otonom Tarayıcı ile internetin gücünü belleğinize katın:"}),r.jsx("ol",{className:"space-y-1.5",children:["Hedef URL'yi girin.","Çıkarmak istediğiniz veri türünü seçin (Metin, Link veya Görsel).","Başlat butonuna basarak Must-b'nin siteyi analiz etmesini bekleyin.","Sonuçları inceleyin ve kalıcı hafızaya kaydetmek istediklerinizi seçin."].map((I,Q)=>r.jsxs("li",{className:"flex items-start gap-2.5 text-[13px] text-white/80 leading-relaxed",children:[r.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full text-[10px] font-black shrink-0 mt-0.5",style:{background:"rgba(249,115,22,0.25)",color:"#fb923c"},children:Q+1}),I]},Q))}),r.jsxs("p",{className:"mt-3 text-[11px] text-orange-400/70 flex items-start gap-1.5 leading-relaxed",children:[r.jsx("span",{className:"shrink-0 mt-0.5",children:"🔒"}),r.jsxs("span",{children:[r.jsx("strong",{className:"text-orange-400/90",children:"Güvenlik Notu:"})," ","Tüm işlemler yerel Playwright motorunda gerçekleşir, verileriniz üçüncü taraflara asla iletilmez."]})]})]}),r.jsxs("div",{className:"rounded-2xl p-5 mb-4",style:{background:"rgba(13,7,3,0.80)",border:"1px solid rgba(255,255,255,0.10)",backdropFilter:"blur(20px)",boxShadow:"0 8px 40px rgba(0,0,0,0.45)"},children:[r.jsx("label",{className:"block text-[11px] font-bold text-white/40 uppercase tracking-widest mb-2",children:"Hedef URL"}),r.jsxs("div",{className:"flex gap-2 mb-5",children:[r.jsx("input",{type:"url",value:e,onChange:I=>t(I.target.value),onKeyDown:I=>I.key==="Enter"&&!i&&C(),placeholder:"https://example.com",className:"flex-1 px-4 py-2.5 rounded-xl text-[13px] text-white/85 placeholder-white/20 outline-none transition-all",style:{background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.12)"},onFocus:I=>I.currentTarget.style.borderColor="rgba(249,115,22,0.55)",onBlur:I=>I.currentTarget.style.borderColor="rgba(255,255,255,0.12)"}),r.jsxs("button",{onClick:C,disabled:i||!e.trim(),className:"flex items-center gap-2 px-5 py-2.5 rounded-xl text-[13px] font-semibold transition-all disabled:opacity-40",style:{background:i||!e.trim()?"rgba(249,115,22,0.25)":"rgba(249,115,22,0.85)",color:"#fff",border:"1px solid rgba(249,115,22,0.4)"},children:[i?r.jsx(re,{size:14,className:"animate-spin"}):r.jsx(ba,{size:14}),i?"Taranıyor…":"Başlat"]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-bold text-white/40 uppercase tracking-widest mb-2.5",children:"Çıkarma Modu"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:__.map(I=>r.jsxs("button",{onClick:()=>s(I.value),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-[12px] font-medium transition-all",style:{background:n===I.value?"rgba(249,115,22,0.18)":"rgba(255,255,255,0.04)",border:n===I.value?"1px solid rgba(249,115,22,0.45)":"1px solid rgba(255,255,255,0.08)",color:n===I.value?"#fb923c":"rgba(255,255,255,0.45)"},children:[I.icon,I.label]},I.value))})]}),i&&r.jsxs("div",{className:"mt-5 flex items-center gap-3 px-4 py-3 rounded-xl",style:{background:"rgba(249,115,22,0.08)",border:"1px solid rgba(249,115,22,0.2)"},children:[r.jsx(re,{size:15,className:"animate-spin text-orange-400 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold text-orange-300",children:"Sayfa taranıyor…"}),r.jsx("p",{className:"text-[11px] text-white/35 mt-0.5",children:"Playwright sayfayı açıyor ve içerik çıkarılıyor"})]})]}),o&&r.jsxs("div",{className:"mt-5 flex items-start gap-3 px-4 py-3 rounded-xl",style:{background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.25)"},children:[r.jsx(mt,{size:15,className:"text-red-400 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold text-red-300",children:"Hata oluştu"}),r.jsx("p",{className:"text-[11px] text-red-400/70 mt-0.5",children:o})]})]})]}),c!==null&&A.length>0&&r.jsxs("div",{className:"rounded-2xl p-5",style:{background:"rgba(13,7,3,0.75)",border:"1px solid rgba(255,255,255,0.10)",backdropFilter:"blur(20px)",boxShadow:"0 8px 40px rgba(0,0,0,0.40)"},children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[13px] font-bold text-white/85",children:"Çıkarılan Veriler"}),r.jsxs("p",{className:"text-[11px] text-white/35 mt-0.5",children:[A.length," öğe bulundu · ",u.size," seçili"]})]}),r.jsxs("button",{onClick:F,className:"text-[11px] font-medium text-orange-400/80 hover:text-orange-400 transition-colors flex items-center gap-1",children:[r.jsx(Qt,{size:12}),u.size===A.length?"Seçimi Kaldır":"Tümünü Seç"]})]}),["text","link","image"].map(I=>{const Q=A.filter(G=>G.type===I);return Q.length===0?null:r.jsxs("div",{className:"mb-4 last:mb-0",children:[r.jsxs("p",{className:"text-[10px] font-bold uppercase tracking-widest text-white/25 mb-1.5 px-1",children:[P_(I)," (",Q.length,")"]}),r.jsx("div",{className:"space-y-1",children:Q.map(G=>r.jsxs("label",{className:"flex items-start gap-3 px-3 py-2.5 rounded-lg cursor-pointer transition-all",style:{background:u.has(G.id)?"rgba(249,115,22,0.08)":"rgba(255,255,255,0.03)",border:u.has(G.id)?"1px solid rgba(249,115,22,0.22)":"1px solid rgba(255,255,255,0.06)"},children:[r.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center shrink-0 mt-0.5 transition-all",style:{background:u.has(G.id)?"rgba(249,115,22,0.8)":"rgba(255,255,255,0.08)",border:u.has(G.id)?"1px solid rgba(249,115,22,0.9)":"1px solid rgba(255,255,255,0.18)"},onClick:()=>T(G.id),children:u.has(G.id)&&r.jsx(at,{size:10,className:"text-white"})}),T_(G.type),r.jsx("span",{className:"text-[12px] text-white/65 leading-relaxed break-all",children:G.content})]},G.id))})]},I)}),r.jsxs("div",{className:"mt-5 pt-4 border-t border-white/8",children:[b?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-2.5 rounded-xl text-[13px] font-semibold",style:{background:"rgba(34,197,94,0.12)",border:"1px solid rgba(34,197,94,0.25)",color:"#4ade80"},children:[r.jsx(at,{size:14}),u.size," öğe belleğe kaydedildi"]}):r.jsx("button",{onClick:E,disabled:f||u.size===0,className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-xl text-[13px] font-semibold transition-all disabled:opacity-40",style:{background:"rgba(249,115,22,0.18)",border:"1px solid rgba(249,115,22,0.35)",color:"#fb923c"},children:f?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:14,className:"animate-spin"})," Kaydediliyor…"]}):r.jsxs(r.Fragment,{children:[r.jsx(sv,{size:14})," Seçilenleri Belleğe Kaydet (",u.size,")"]})}),v&&r.jsxs("div",{className:"mt-3 rounded-xl px-4 py-3",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.09)"},children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[r.jsx(An,{size:12,className:"text-white/35 shrink-0"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-white/30",children:"Kaydedilen Konum"})]}),j?r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{autoFocus:!0,value:N,onChange:I=>K(I.target.value),onKeyDown:I=>{I.key==="Enter"&&X(),I.key==="Escape"&&W()},placeholder:"Dizin yolu girin…",className:"flex-1 px-3 py-1.5 rounded-lg text-[12px] text-white/80 placeholder-white/20 outline-none",style:{background:"rgba(255,255,255,0.07)",border:"1px solid rgba(249,115,22,0.45)"}}),r.jsx("button",{onClick:X,disabled:V,className:"px-3 py-1.5 rounded-lg text-[11px] font-semibold transition-all disabled:opacity-40",style:{background:"rgba(249,115,22,0.75)",color:"#fff"},children:V?r.jsx(re,{size:11,className:"animate-spin"}):r.jsx(at,{size:11})}),r.jsx("button",{onClick:W,className:"px-2.5 py-1.5 rounded-lg transition-all",style:{background:"rgba(255,255,255,0.06)",color:"rgba(255,255,255,0.4)"},children:r.jsx(He,{size:11})})]}),_.length>0&&r.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 rounded-xl overflow-hidden z-50",style:{background:"rgba(20,12,5,0.97)",border:"1px solid rgba(249,115,22,0.3)",boxShadow:"0 8px 24px rgba(0,0,0,0.6)"},children:_.map(I=>r.jsx("button",{onClick:()=>{S(I),R([])},className:"w-full text-left px-4 py-2 text-[11px] text-white/70 hover:bg-orange-500/10 hover:text-orange-300 transition-colors truncate",children:I},I))}),L&&r.jsxs("p",{className:"mt-1.5 text-[11px] text-red-400 flex items-center gap-1",children:[r.jsx(mt,{size:10}),L]})]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"flex-1 text-[12px] text-white/55 font-mono leading-relaxed break-all",children:v}),r.jsxs("button",{onClick:z,className:"shrink-0 flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium transition-all hover:text-orange-400",style:{background:"rgba(249,115,22,0.1)",border:"1px solid rgba(249,115,22,0.2)",color:"rgba(251,146,60,0.7)"},children:[r.jsx(du,{size:10}),"Düzenle"]})]})]})]})]}),c!==null&&A.length===0&&r.jsx("div",{className:"text-center py-10 text-[13px] text-white/25",children:"Bu modda çıkarılacak veri bulunamadı."})]})}function M_(e){return e.replace(/hey\s+must\s*-?\s*be\b/gi,"Hey Must-b").replace(/hey\s+mustbe\b/gi,"Hey Must-b").replace(/hey\s+most\s+be\b/gi,"Hey Must-b").replace(/hey\s+must\s+b\b/gi,"Hey Must-b").replace(/hey\s+must\s+bee\b/gi,"Hey Must-b").replace(/hay\s+mas+bi\b/gi,"Hey Must-b").replace(/hey\s+mas+bi\b/gi,"Hey Must-b").replace(/hey\s+mast\s*b[ei]?\b/gi,"Hey Must-b").replace(/hey\s+m[au]s[t]?\s*b[ei]?\b/gi,"Hey Must-b").replace(/hey\s+must\s*b[eiy]+\b/gi,"Hey Must-b").replace(/hey\s+moos+\s*b[ei]?\b/gi,"Hey Must-b")}function R_(e){const t=window.speechSynthesis.getVoices(),n=e.toLowerCase();return t.find(s=>s.name.toLowerCase().includes("google")&&s.lang.toLowerCase().startsWith(n))||t.find(s=>s.lang.toLowerCase().startsWith(n)&&!s.localService)||t.find(s=>s.lang.toLowerCase().startsWith(n))||null}function z_(){const e=mn(),{t,locale:n}=gt(),[s,i]=h.useState("wake-listening"),[a,o]=h.useState("Must-b"),[l,c]=h.useState(""),[d,u]=h.useState(""),p=h.useRef(null),f=h.useRef(!1),m=h.useRef(""),b=h.useRef(null),y=h.useRef("wake-listening");h.useEffect(()=>{y.current=s},[s]),h.useEffect(()=>{$("/api/identity").then(N=>N.json()).then(N=>{N.name&&o(N.name)}).catch(()=>{})},[]);const v=h.useCallback(N=>{if(!window.speechSynthesis)return;window.speechSynthesis.cancel();const S=new SpeechSynthesisUtterance(N),_=n==="tr"?"tr-TR":n==="de"?"de-DE":n==="fr"?"fr-FR":n==="es"?"es-ES":n==="ja"?"ja-JP":n==="zh"?"zh-CN":n==="pt"?"pt-PT":"en-US";S.lang=_,S.rate=1.05,S.pitch=1;const R=()=>{const L=R_(_.split("-")[0]);L&&(S.voice=L)};R(),!S.voice&&window.speechSynthesis.onvoiceschanged!==void 0&&(window.speechSynthesis.onvoiceschanged=R),S.onend=()=>{i("wake-listening"),u(""),c("")},S.onerror=()=>i("wake-listening"),i("speaking"),window.speechSynthesis.speak(S)},[n]),g=h.useCallback(async N=>{if(!N.trim()){i("wake-listening");return}i("thinking"),c(N);try{const _=await(await $("/api/goal",{method:"POST",body:JSON.stringify({goal:N,voice:!0})})).json(),R=_.result??_.reply??_.response??_.output??"Done.";u(R),v(R)}catch{i("wake-listening")}},[v]),x=h.useCallback(()=>{const N=window.SpeechRecognition||window.webkitSpeechRecognition;if(!N||!f.current)return;const S=new N;S.continuous=!0,S.interimResults=!0,S.lang=n==="tr"?"tr-TR":"en-US",S.onresult=_=>{var V,M;let R="";for(let B=_.resultIndex;B<_.results.length;B++)R+=_.results[B][0].transcript;const L=M_(R),P=y.current;if(c(L),P==="wake-listening"){const B=`hey ${a}`.toLowerCase();if(L.toLowerCase().includes(B)){const A=((V=L.toLowerCase().split(B)[1])==null?void 0:V.trim())??"";m.current=A,i("cmd-listening"),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{if(m.current.trim()&&y.current==="cmd-listening"){const T=m.current;m.current="",g(T)}},1800)}}else if(P==="cmd-listening"){const B=`hey ${a}`.toLowerCase(),A=L.toLowerCase().includes(B)?((M=L.toLowerCase().split(B)[1])==null?void 0:M.trim())??L:L;m.current=A,b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{if(m.current.trim()&&y.current==="cmd-listening"){const T=m.current;m.current="",g(T)}},2200)}},S.onend=()=>{const _=y.current;f.current&&_!=="thinking"&&_!=="speaking"?setTimeout(x,200):f.current||(i("off"),p.current=null)},S.onerror=_=>{_.error!=="no-speech"&&i("wake-listening"),f.current&&_.error!=="not-allowed"&&setTimeout(x,600)},p.current=S;try{S.start()}catch{}},[a,n,g]),w=()=>{var N,S;s!=="off"?(f.current=!1,(N=p.current)==null||N.stop(),(S=window.speechSynthesis)==null||S.cancel(),b.current&&clearTimeout(b.current),i("off"),c("")):(f.current=!0,i("wake-listening"),x())};h.useEffect(()=>(f.current=!0,i("wake-listening"),x(),()=>{var N,S;f.current=!1,(N=p.current)==null||N.stop(),(S=window.speechSynthesis)==null||S.cancel(),b.current&&clearTimeout(b.current)}),[]);const j=s==="wake-listening"||s==="cmd-listening",k=s==="off";return r.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center overflow-hidden",style:{background:"radial-gradient(ellipse at 50% 45%, rgba(249,115,22,0.22) 0%, #060301 55%)"},children:[r.jsxs("button",{onClick:()=>e("/app"),className:"absolute top-20 left-6 flex items-center gap-2 px-3 py-2 rounded-xl text-white/40 hover:text-white/80 hover:bg-white/8 transition-all text-[13px] font-medium z-10",children:[r.jsx(nC,{size:15}),r.jsx("span",{children:t.voice.back})]}),r.jsx("p",{className:"absolute top-6 text-[12px] font-bold text-white/25 tracking-[0.18em] uppercase select-none",children:t.voice.title}),[200,290,380].map((N,S)=>r.jsx(H.div,{className:"absolute rounded-full",style:{width:N,height:N,border:`1px solid rgba(249,115,22,${.12-S*.03})`},animate:j?{opacity:[.4,.7,.4],scale:[1,1.04,1]}:{opacity:.2,scale:1},transition:{duration:2.2+S*.6,repeat:1/0,ease:"easeInOut",delay:S*.4}},N)),r.jsx(H.button,{onClick:w,className:"relative w-36 h-36 rounded-full flex items-center justify-center cursor-pointer select-none mb-10",style:{background:j?"radial-gradient(circle at 38% 32%, rgba(249,115,22,0.92), rgba(160,55,8,0.75))":"radial-gradient(circle at 38% 32%, rgba(249,115,22,0.38), rgba(22,10,3,0.88))",border:`1px solid rgba(249,115,22,${j?.5:.28})`,boxShadow:j?"0 0 70px rgba(249,115,22,0.55), 0 0 140px rgba(249,115,22,0.18), inset 0 1px 0 rgba(255,255,255,0.12)":"0 0 30px rgba(249,115,22,0.12), inset 0 1px 0 rgba(255,255,255,0.05)"},animate:j?{scale:[1,1.06,1]}:{scale:1},transition:{duration:1.6,repeat:j?1/0:0,ease:"easeInOut"},whileHover:{scale:1.04},whileTap:{scale:.95},children:s==="thinking"?r.jsx(H.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-10 h-10 rounded-full border-2 border-orange-500/30 border-t-orange-400"}):s==="speaking"?r.jsx(H.span,{animate:{scale:[.9,1.1,.9]},transition:{duration:.7,repeat:1/0,ease:"easeInOut"},className:"text-4xl",children:"🔊"}):s==="cmd-listening"?r.jsx(H.span,{animate:{opacity:[.6,1,.6]},transition:{duration:.5,repeat:1/0},children:r.jsx(Bs,{size:38,className:"text-white/95"})}):k?r.jsx(Bs,{size:38,className:"text-orange-300/90"}):r.jsx(sf,{size:38,className:"text-white/90"})}),r.jsx(ne,{mode:"wait",children:r.jsxs(H.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:"flex flex-col items-center gap-3 px-6 text-center",children:[s==="thinking"&&r.jsx("p",{className:"text-[17px] font-medium text-white/65",children:t.voice.thinking}),s==="speaking"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-[17px] font-medium text-orange-300",children:t.voice.speakingHint}),d&&r.jsxs("p",{className:"text-[12px] text-white/35 italic max-w-sm line-clamp-3",children:["“",d.slice(0,140),d.length>140?"…":"","”"]})]}),s==="cmd-listening"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-[17px] font-medium text-white/75",children:t.voice.cmdHint}),l&&r.jsxs("p",{className:"text-[13px] text-white/40 italic max-w-sm",children:["“",l,"”"]})]}),s==="wake-listening"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-[17px] font-medium text-white/65",children:t.voice.wakeHint}),l&&r.jsxs("p",{className:"text-[13px] text-white/35 italic max-w-sm",children:["“",l,"”"]}),r.jsx("p",{className:"text-[11px] text-white/25",children:t.voice.stopHint})]}),s==="off"&&r.jsx("p",{className:"text-[17px] font-medium text-white/40",children:t.voice.tapHint}),j&&r.jsx("div",{className:"flex items-center gap-1 mt-1",children:[0,1,2,3,4].map(N=>r.jsx(H.div,{className:"w-0.5 rounded-full bg-orange-500/60",animate:{height:["6px","18px","6px"]},transition:{duration:.8,repeat:1/0,delay:N*.12,ease:"easeInOut"}},N))})]},s)})]})}function L_({id:e,size:t=16}){const n="shrink-0";switch(e){case"telegram":return r.jsx(of,{size:t,className:n});case"whatsapp":return r.jsx(bo,{size:t,className:n});case"discord":return r.jsx(l0,{size:t,className:n});case"slack":return r.jsx(l0,{size:t,className:n});case"signal":return r.jsx(mv,{size:t,className:n});case"imessage":case"bluebubbles":return r.jsx(Is,{size:t,className:n});case"line":return r.jsx(Is,{size:t,className:n});case"msteams":return r.jsx(uu,{size:t,className:n});case"matrix":case"mattermost":case"irc":case"nextcloud-talk":return r.jsx(il,{size:t,className:n});case"voice-call":case"talk-voice":case"phone-control":return r.jsx(PC,{size:t,className:n});case"twitch":return r.jsx(BC,{size:t,className:n});case"nostr":return r.jsx(af,{size:t,className:n});case"googlechat":return r.jsx(bo,{size:t,className:n});case"feishu":return r.jsx(aC,{size:t,className:n});case"tlon":return r.jsx(qe,{size:t,className:n});case"zalo":case"zalouser":return r.jsx(bo,{size:t,className:n});case"synology-chat":return r.jsx(bC,{size:t,className:n});case"lobster":return r.jsx(Bs,{size:t,className:n});case"memory-lancedb":case"memory-core":return r.jsx(va,{size:t,className:n});case"ollama":case"sglang":case"vllm":case"copilot-proxy":return r.jsx(fn,{size:t,className:n});case"open-prose":return r.jsx(Al,{size:t,className:n});default:return r.jsx(AC,{size:t,className:n})}}function O_({ext:e}){var n,s,i;return e.active?r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-green-500/10 border-green-500/25 text-green-400",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 animate-pulse"}),"Active"]}):((n=e.loadError)==null?void 0:n.includes("Cannot find module"))||((s=e.loadError)==null?void 0:s.includes("MODULE_NOT_FOUND"))||((i=e.loadError)==null?void 0:i.includes("ERR_MODULE_NOT_FOUND"))?r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-white/4 border-white/10 text-gray-500",children:[r.jsx(EC,{size:9,className:"shrink-0"}),"Missing Deps"]}):e.loadError?r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-amber-500/8 border-amber-500/20 text-amber-500",children:[r.jsx(mt,{size:9,className:"shrink-0"}),"Error"]}):r.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold border bg-white/4 border-white/10 text-gray-500",children:[r.jsx(At,{size:9,className:"shrink-0"}),"Deferred"]})}function D_({ext:e}){var i;const t=((i=e.channel)==null?void 0:i.label)??e.id,n=e.active?"text-orange-400":"text-white/30",s=e.active?"border-orange-500/20 hover:border-orange-500/35":"border-white/6 hover:border-white/10";return r.jsxs("div",{className:`group relative flex flex-col gap-3 p-4 rounded-2xl bg-white/[0.025] border transition-all ${s}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${e.active?"bg-orange-500/12 border border-orange-500/20":"bg-white/4 border border-white/8"}`,children:r.jsx("span",{className:n,children:r.jsx(L_,{id:e.id,size:16})})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-[13px] font-semibold text-white/85 truncate leading-tight",children:t}),r.jsxs("p",{className:"text-[10px] text-gray-600 mt-0.5 font-mono",children:["v",e.version]})]})]}),r.jsx(O_,{ext:e})]}),e.description&&r.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed line-clamp-2",children:e.description}),!e.active&&e.loadError&&!e.loadError.includes("Cannot find module")&&r.jsx("p",{className:"text-[10px] text-amber-600/80 font-mono truncate border-t border-white/5 pt-2",children:e.loadError.slice(0,80)})]})}function O0({title:e,items:t}){if(t.length===0)return null;const n=t.filter(s=>s.active).length;return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-[11px] font-bold text-white/40 uppercase tracking-widest",children:e}),r.jsxs("span",{className:"text-[10px] text-gray-600",children:[t.length," total"]}),n>0&&r.jsxs("span",{className:"text-[10px] text-green-500 font-semibold",children:[n," active"]})]}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(s=>r.jsx(D_,{ext:s},s.id))})]})}function I_(){return r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Array.from({length:9}).map((e,t)=>r.jsx("div",{className:"h-[100px] rounded-2xl bg-white/[0.025] border border-white/6 animate-pulse"},t))})}function B_(){const[e,t]=h.useState(null),[n,s]=h.useState(!0),[i,a]=h.useState(null),o=h.useCallback(async()=>{s(!0),a(null);try{const p=await $("/api/extensions");if(!p.ok)throw new Error(`HTTP ${p.status}`);t(await p.json())}catch(p){a(String(p))}finally{s(!1)}},[]);h.useEffect(()=>{o()},[o]);const l=(e==null?void 0:e.extensions.filter(p=>p.channel!==null).sort((p,f)=>{var m,b;return(((m=p.channel)==null?void 0:m.order)??99)-(((b=f.channel)==null?void 0:b.order)??99)}))??[],c=(e==null?void 0:e.extensions.filter(p=>p.channel===null))??[],d=(e==null?void 0:e.loaded)??0,u=(e==null?void 0:e.catalogSize)??0;return r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-orange-500/15 border border-orange-500/25 flex items-center justify-center",children:r.jsx(af,{size:16,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-white",children:"Channels & Extensions"}),r.jsxs("p",{className:"text-[11px] text-gray-500",children:["Phase B — ",u," extensions discovered"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[e&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-xl bg-white/[0.025] border border-white/8",children:[d>0?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:13,className:"text-green-400 shrink-0"}),r.jsxs("span",{className:"text-[11px] font-semibold text-green-400",children:[d," active"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(At,{size:13,className:"text-gray-500 shrink-0"}),r.jsx("span",{className:"text-[11px] font-semibold text-gray-500",children:"0 active"})]}),r.jsx("span",{className:"text-white/15",children:"·"}),r.jsxs("span",{className:"text-[11px] text-gray-600",children:[u-d," deferred"]})]}),r.jsxs("button",{onClick:o,disabled:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/4 border border-white/8 text-gray-400 hover:text-white/80 hover:bg-white/6 hover:border-white/12 transition-all text-[11px] font-medium disabled:opacity-40",children:[r.jsx(fe,{size:12,className:n?"animate-spin":""}),"Refresh"]})]})]}),!n&&e&&d===0&&r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl bg-amber-500/5 border border-amber-500/15",children:[r.jsx(mt,{size:15,className:"text-amber-500 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[12px] font-semibold text-amber-400",children:"Extensions deferred — dependencies not installed"}),r.jsxs("p",{className:"text-[11px] text-amber-600/80 mt-0.5",children:["Channel extensions require their SDK packages (e.g. ",r.jsx("code",{className:"font-mono",children:"must-b/plugin-sdk/*"}),") and memory-lancedb requires ",r.jsx("code",{className:"font-mono",children:"@lancedb/lancedb"}),". The ExtensionLoader catalog is ready — install dependencies to activate extensions at next boot."]})]})]}),n&&!e&&r.jsx(I_,{}),i&&r.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-xl bg-red-500/8 border border-red-500/15",children:[r.jsx(mt,{size:15,className:"text-red-400 shrink-0"}),r.jsx("p",{className:"text-[12px] text-red-400",children:i})]}),e&&r.jsxs("div",{className:"space-y-8",children:[r.jsx(O0,{title:"Messaging Channels",items:l}),r.jsx(O0,{title:"System Plugins",items:c})]})]})}function ns(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function D0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gf(...e){return t=>{let n=!1;const s=e.map(i=>{const a=D0(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<s.length;i++){const a=s[i];typeof a=="function"?a():D0(e[i],null)}}}}function Gs(...e){return h.useCallback(gf(...e),e)}function F_(e,t){const n=h.createContext(t),s=a=>{const{children:o,...l}=a,c=h.useMemo(()=>l,Object.values(l));return r.jsx(n.Provider,{value:c,children:o})};s.displayName=e+"Provider";function i(a){const o=h.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,i]}function V_(e,t=[]){let n=[];function s(a,o){const l=h.createContext(o),c=n.length;n=[...n,o];const d=p=>{var g;const{scope:f,children:m,...b}=p,y=((g=f==null?void 0:f[e])==null?void 0:g[c])||l,v=h.useMemo(()=>b,Object.values(b));return r.jsx(y.Provider,{value:v,children:m})};d.displayName=a+"Provider";function u(p,f){var y;const m=((y=f==null?void 0:f[e])==null?void 0:y[c])||l,b=h.useContext(m);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,u]}const i=()=>{const a=n.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[s,$_(i,...t)]}function $_(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const p=c(a)[`__scope${d}`];return{...l,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var la=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},U_=Su[" useId ".trim().toString()]||(()=>{}),H_=0;function Fc(e){const[t,n]=h.useState(U_());return la(()=>{n(s=>s??String(H_++))},[e]),e||(t?`radix-${t}`:"")}var W_=Su[" useInsertionEffect ".trim().toString()]||la;function K_({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,a,o]=G_({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i;{const u=h.useRef(e!==void 0);h.useEffect(()=>{const p=u.current;p!==l&&console.warn(`${s} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,s])}const d=h.useCallback(u=>{var p;if(l){const f=q_(u)?u(e):u;f!==e&&((p=o.current)==null||p.call(o,f))}else a(u)},[l,e,a,o]);return[c,d]}function G_({defaultProp:e,onChange:t}){const[n,s]=h.useState(e),i=h.useRef(n),a=h.useRef(t);return W_(()=>{a.current=t},[t]),h.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,s,a]}function q_(e){return typeof e=="function"}function Y_(e){const t=X_(e),n=h.forwardRef((s,i)=>{const{children:a,...o}=s,l=h.Children.toArray(a),c=l.find(J_);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return r.jsx(t,{...o,ref:i,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return r.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function X_(e){const t=h.forwardRef((n,s)=>{const{children:i,...a}=n;if(h.isValidElement(i)){const o=eT(i),l=Z_(a,i.props);return i.type!==h.Fragment&&(l.ref=s?gf(s,o):o),h.cloneElement(i,l)}return h.Children.count(i)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Q_=Symbol("radix.slottable");function J_(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Q_}function Z_(e,t){const n={...t};for(const s in t){const i=e[s],a=t[s];/^on[A-Z]/.test(s)?i&&a?n[s]=(...l)=>{const c=a(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...a}:s==="className"&&(n[s]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function eT(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mn=tT.reduce((e,t)=>{const n=Y_(`Primitive.${t}`),s=h.forwardRef((i,a)=>{const{asChild:o,...l}=i,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function nT(e,t){e&&gh.flushSync(()=>e.dispatchEvent(t))}function ca(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function sT(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e);h.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var rT="DismissableLayer",vu="dismissableLayer.update",iT="dismissableLayer.pointerDownOutside",aT="dismissableLayer.focusOutside",I0,Dv=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Iv=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=e,d=h.useContext(Dv),[u,p]=h.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=h.useState({}),b=Gs(t,S=>p(S)),y=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=y.indexOf(v),x=u?y.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,j=x>=g,k=cT(S=>{const _=S.target,R=[...d.branches].some(L=>L.contains(_));!j||R||(i==null||i(S),o==null||o(S),S.defaultPrevented||l==null||l())},f),N=dT(S=>{const _=S.target;[...d.branches].some(L=>L.contains(_))||(a==null||a(S),o==null||o(S),S.defaultPrevented||l==null||l())},f);return sT(S=>{x===d.layers.size-1&&(s==null||s(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),h.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(I0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),B0(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=I0)}},[u,f,n,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),B0())},[u,d]),h.useEffect(()=>{const S=()=>m({});return document.addEventListener(vu,S),()=>document.removeEventListener(vu,S)},[]),r.jsx(Mn.div,{...c,ref:b,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:ns(e.onFocusCapture,N.onFocusCapture),onBlurCapture:ns(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ns(e.onPointerDownCapture,k.onPointerDownCapture)})});Iv.displayName=rT;var oT="DismissableLayerBranch",lT=h.forwardRef((e,t)=>{const n=h.useContext(Dv),s=h.useRef(null),i=Gs(t,s);return h.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),r.jsx(Mn.div,{...e,ref:i})});lT.displayName=oT;function cT(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e),s=h.useRef(!1),i=h.useRef(()=>{});return h.useEffect(()=>{const a=l=>{if(l.target&&!s.current){let c=function(){Bv(iT,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function dT(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e),s=h.useRef(!1);return h.useEffect(()=>{const i=a=>{a.target&&!s.current&&Bv(aT,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function B0(){const e=new CustomEvent(vu);document.dispatchEvent(e)}function Bv(e,t,n,{discrete:s}){const i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?nT(i,a):i.dispatchEvent(a)}var Vc="focusScope.autoFocusOnMount",$c="focusScope.autoFocusOnUnmount",F0={bubbles:!1,cancelable:!0},uT="FocusScope",Fv=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[l,c]=h.useState(null),d=ca(i),u=ca(a),p=h.useRef(null),f=Gs(t,y=>c(y)),m=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(s){let y=function(w){if(m.paused||!l)return;const j=w.target;l.contains(j)?p.current=j:In(p.current,{select:!0})},v=function(w){if(m.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||In(p.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const k of w)k.removedNodes.length>0&&In(l)};document.addEventListener("focusin",y),document.addEventListener("focusout",v);const x=new MutationObserver(g);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",v),x.disconnect()}}},[s,l,m.paused]),h.useEffect(()=>{if(l){$0.add(m);const y=document.activeElement;if(!l.contains(y)){const g=new CustomEvent(Vc,F0);l.addEventListener(Vc,d),l.dispatchEvent(g),g.defaultPrevented||(hT(xT(Vv(l)),{select:!0}),document.activeElement===y&&In(l))}return()=>{l.removeEventListener(Vc,d),setTimeout(()=>{const g=new CustomEvent($c,F0);l.addEventListener($c,u),l.dispatchEvent(g),g.defaultPrevented||In(y??document.body,{select:!0}),l.removeEventListener($c,u),$0.remove(m)},0)}}},[l,d,u,m]);const b=h.useCallback(y=>{if(!n&&!s||m.paused)return;const v=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,g=document.activeElement;if(v&&g){const x=y.currentTarget,[w,j]=fT(x);w&&j?!y.shiftKey&&g===j?(y.preventDefault(),n&&In(w,{select:!0})):y.shiftKey&&g===w&&(y.preventDefault(),n&&In(j,{select:!0})):g===x&&y.preventDefault()}},[n,s,m.paused]);return r.jsx(Mn.div,{tabIndex:-1,...o,ref:f,onKeyDown:b})});Fv.displayName=uT;function hT(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(In(s,{select:t}),document.activeElement!==n)return}function fT(e){const t=Vv(e),n=V0(t,e),s=V0(t.reverse(),e);return[n,s]}function Vv(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function V0(e,t){for(const n of e)if(!pT(n,{upTo:t}))return n}function pT(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function mT(e){return e instanceof HTMLInputElement&&"select"in e}function In(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mT(e)&&t&&e.select()}}var $0=gT();function gT(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=U0(e,t),e.unshift(t)},remove(t){var n;e=U0(e,t),(n=e[0])==null||n.resume()}}}function U0(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function xT(e){return e.filter(t=>t.tagName!=="A")}var yT="Portal",$v=h.forwardRef((e,t)=>{var l;const{container:n,...s}=e,[i,a]=h.useState(!1);la(()=>a(!0),[]);const o=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?py.createPortal(r.jsx(Mn.div,{...s,ref:t}),o):null});$v.displayName=yT;function vT(e,t){return h.useReducer((n,s)=>t[n][s]??n,e)}var Il=e=>{const{present:t,children:n}=e,s=bT(t),i=typeof n=="function"?n({present:s.isPresent}):h.Children.only(n),a=Gs(s.ref,wT(i));return typeof n=="function"||s.isPresent?h.cloneElement(i,{ref:a}):null};Il.displayName="Presence";function bT(e){const[t,n]=h.useState(),s=h.useRef(null),i=h.useRef(e),a=h.useRef("none"),o=e?"mounted":"unmounted",[l,c]=vT(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=Ja(s.current);a.current=l==="mounted"?d:"none"},[l]),la(()=>{const d=s.current,u=i.current;if(u!==e){const f=a.current,m=Ja(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&f!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),la(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,p=m=>{const y=Ja(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&y&&(c("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},f=m=>{m.target===t&&(a.current=Ja(s.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(d=>{s.current=d?getComputedStyle(d):null,n(d)},[])}}function Ja(e){return(e==null?void 0:e.animationName)||"none"}function wT(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Uc=0;function kT(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??H0()),document.body.insertAdjacentElement("beforeend",e[1]??H0()),Uc++,()=>{Uc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Uc--}},[])}function H0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var on=function(){return on=Object.assign||function(t){for(var n,s=1,i=arguments.length;s<i;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},on.apply(this,arguments)};function Uv(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function jT(e,t,n){if(n||arguments.length===2)for(var s=0,i=t.length,a;s<i;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var So="right-scroll-bar-position",Co="width-before-scroll-bar",NT="with-scroll-bars-hidden",ST="--removed-body-scroll-bar-size";function Hc(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function CT(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=t,n.facade}var ET=typeof window<"u"?h.useLayoutEffect:h.useEffect,W0=new WeakMap;function _T(e,t){var n=CT(null,function(s){return e.forEach(function(i){return Hc(i,s)})});return ET(function(){var s=W0.get(n);if(s){var i=new Set(s),a=new Set(e),o=n.current;i.forEach(function(l){a.has(l)||Hc(l,null)}),a.forEach(function(l){i.has(l)||Hc(l,o)})}W0.set(n,e)},[e]),n}function TT(e){return e}function PT(e,t){t===void 0&&(t=TT);var n=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var o=t(a,s);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(s=!0;n.length;){var o=n;n=[],o.forEach(a)}n={push:function(l){return a(l)},filter:function(){return n}}},assignMedium:function(a){s=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(a),o=n}var c=function(){var u=o;o=[],u.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return i}function AT(e){e===void 0&&(e={});var t=PT(null);return t.options=on({async:!0,ssr:!1},e),t}var Hv=function(e){var t=e.sideCar,n=Uv(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return h.createElement(s,on({},n))};Hv.isSideCarExport=!0;function MT(e,t){return e.useMedium(t),Hv}var Wv=AT(),Wc=function(){},Bl=h.forwardRef(function(e,t){var n=h.useRef(null),s=h.useState({onScrollCapture:Wc,onWheelCapture:Wc,onTouchMoveCapture:Wc}),i=s[0],a=s[1],o=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,p=e.shards,f=e.sideCar,m=e.noRelative,b=e.noIsolation,y=e.inert,v=e.allowPinchZoom,g=e.as,x=g===void 0?"div":g,w=e.gapMode,j=Uv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,N=_T([n,t]),S=on(on({},j),i);return h.createElement(h.Fragment,null,u&&h.createElement(k,{sideCar:Wv,removeScrollBar:d,shards:p,noRelative:m,noIsolation:b,inert:y,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:w}),o?h.cloneElement(h.Children.only(l),on(on({},S),{ref:N})):h.createElement(x,on({},S,{className:c,ref:N}),l))});Bl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Bl.classNames={fullWidth:Co,zeroRight:So};var RT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=RT();return t&&e.setAttribute("nonce",t),e}function LT(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function OT(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var DT=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zT())&&(LT(t,n),OT(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},IT=function(){var e=DT();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Kv=function(){var e=IT(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},BT={left:0,top:0,right:0,gap:0},Kc=function(e){return parseInt(e||"",10)||0},FT=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Kc(n),Kc(s),Kc(i)]},VT=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return BT;var t=FT(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},$T=Kv(),Tr="data-scroll-locked",UT=function(e,t,n,s){var i=e.left,a=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
765
765
|
.`.concat(NT,` {
|
|
766
766
|
overflow: hidden `).concat(s,`;
|
|
767
767
|
padding-right: `).concat(l,"px ").concat(s,`;
|
|
@@ -798,19 +798,19 @@ Burada senin hakkında öğrendiğim bilgiler yer alır.
|
|
|
798
798
|
body[`).concat(Tr,`] {
|
|
799
799
|
`).concat(ST,": ").concat(l,`px;
|
|
800
800
|
}
|
|
801
|
-
`)},K0=function(){var e=parseInt(document.body.getAttribute(Tr)||"0",10);return isFinite(e)?e:0},HT=function(){h.useEffect(function(){return document.body.setAttribute(Tr,(K0()+1).toString()),function(){var e=K0()-1;e<=0?document.body.removeAttribute(Tr):document.body.setAttribute(Tr,e.toString())}},[])},WT=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;HT();var a=h.useMemo(function(){return VT(i)},[i]);return h.createElement($T,{styles:UT(a,!t,i,n?"":"!important")})},bu=!1;if(typeof window<"u")try{var Za=Object.defineProperty({},"passive",{get:function(){return bu=!0,!0}});window.addEventListener("test",Za,Za),window.removeEventListener("test",Za,Za)}catch{bu=!1}var tr=bu?{passive:!1}:!1,KT=function(e){return e.tagName==="TEXTAREA"},Gv=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!KT(e)&&n[t]==="visible")},GT=function(e){return Gv(e,"overflowY")},qT=function(e){return Gv(e,"overflowX")},G0=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=qv(e,s);if(i){var a=Yv(e,s),o=a[1],l=a[2];if(o>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},YT=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},XT=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},qv=function(e,t){return e==="v"?GT(t):qT(t)},Yv=function(e,t){return e==="v"?YT(t):XT(t)},QT=function(e,t){return e==="h"&&t==="rtl"?-1:1},JT=function(e,t,n,s,i){var a=QT(e,window.getComputedStyle(t).direction),o=a*s,l=n.target,c=t.contains(l),d=!1,u=o>0,p=0,f=0;do{if(!l)break;var m=Yv(e,l),b=m[0],
|
|
801
|
+
`)},K0=function(){var e=parseInt(document.body.getAttribute(Tr)||"0",10);return isFinite(e)?e:0},HT=function(){h.useEffect(function(){return document.body.setAttribute(Tr,(K0()+1).toString()),function(){var e=K0()-1;e<=0?document.body.removeAttribute(Tr):document.body.setAttribute(Tr,e.toString())}},[])},WT=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;HT();var a=h.useMemo(function(){return VT(i)},[i]);return h.createElement($T,{styles:UT(a,!t,i,n?"":"!important")})},bu=!1;if(typeof window<"u")try{var Za=Object.defineProperty({},"passive",{get:function(){return bu=!0,!0}});window.addEventListener("test",Za,Za),window.removeEventListener("test",Za,Za)}catch{bu=!1}var tr=bu?{passive:!1}:!1,KT=function(e){return e.tagName==="TEXTAREA"},Gv=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!KT(e)&&n[t]==="visible")},GT=function(e){return Gv(e,"overflowY")},qT=function(e){return Gv(e,"overflowX")},G0=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=qv(e,s);if(i){var a=Yv(e,s),o=a[1],l=a[2];if(o>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},YT=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},XT=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},qv=function(e,t){return e==="v"?GT(t):qT(t)},Yv=function(e,t){return e==="v"?YT(t):XT(t)},QT=function(e,t){return e==="h"&&t==="rtl"?-1:1},JT=function(e,t,n,s,i){var a=QT(e,window.getComputedStyle(t).direction),o=a*s,l=n.target,c=t.contains(l),d=!1,u=o>0,p=0,f=0;do{if(!l)break;var m=Yv(e,l),b=m[0],y=m[1],v=m[2],g=y-v-a*b;(b||g)&&qv(e,l)&&(p+=g,f+=b);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&Math.abs(p)<1||!u&&Math.abs(f)<1)&&(d=!0),d},eo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},q0=function(e){return[e.deltaX,e.deltaY]},Y0=function(e){return e&&"current"in e?e.current:e},ZT=function(e,t){return e[0]===t[0]&&e[1]===t[1]},eP=function(e){return`
|
|
802
802
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
803
803
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
804
|
-
`)},tP=0,nr=[];function nP(e){var t=h.useRef([]),n=h.useRef([0,0]),s=h.useRef(),i=h.useState(tP++)[0],a=h.useState(Kv)[0],o=h.useRef(e);h.useEffect(function(){o.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=jT([e.lockRef.current],(e.shards||[]).map(Y0),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var g=eo(v),x=n.current,w="deltaX"in v?v.deltaX:x[0]-g[0],j="deltaY"in v?v.deltaY:x[1]-g[1],k,N=v.target,S=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in v&&S==="h"&&N.type==="range")return!1;var _=window.getSelection(),R=_&&_.anchorNode,L=R?R===N||R.contains(N):!1;if(L)return!1;var P=G0(S,N);if(!P)return!0;if(P?k=S:(k=S==="v"?"h":"v",P=G0(S,N)),!P)return!1;if(!s.current&&"changedTouches"in v&&(w||j)&&(s.current=k),!k)return!0;var V=s.current||k;return JT(V,y,v,V==="h"?w:j)},[]),c=h.useCallback(function(v){var y=v;if(!(!nr.length||nr[nr.length-1]!==a)){var g="deltaY"in y?q0(y):eo(y),x=t.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&ZT(k.delta,g)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(Y0).filter(Boolean).filter(function(k){return k.contains(y.target)}),j=w.length>0?l(y,w[0]):!o.current.noIsolation;j&&y.cancelable&&y.preventDefault()}}},[]),d=h.useCallback(function(v,y,g,x){var w={name:v,delta:y,target:g,should:x,shadowParent:sP(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),u=h.useCallback(function(v){n.current=eo(v),s.current=void 0},[]),p=h.useCallback(function(v){d(v.type,q0(v),v.target,l(v,e.lockRef.current))},[]),f=h.useCallback(function(v){d(v.type,eo(v),v.target,l(v,e.lockRef.current))},[]);h.useEffect(function(){return nr.push(a),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,tr),document.addEventListener("touchmove",c,tr),document.addEventListener("touchstart",u,tr),function(){nr=nr.filter(function(v){return v!==a}),document.removeEventListener("wheel",c,tr),document.removeEventListener("touchmove",c,tr),document.removeEventListener("touchstart",u,tr)}},[]);var m=e.removeScrollBar,b=e.inert;return h.createElement(h.Fragment,null,b?h.createElement(a,{styles:eP(i)}):null,m?h.createElement(WT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rP=MT(Wv,nP);var Xv=h.forwardRef(function(e,t){return h.createElement(Bl,on({},e,{ref:t,sideCar:rP}))});Xv.classNames=Bl.classNames;var iP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},sr=new WeakMap,to=new WeakMap,no={},Gc=0,Qv=function(e){return e&&(e.host||Qv(e.parentNode))},aP=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Qv(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},oP=function(e,t,n,s){var i=aP(t,Array.isArray(e)?e:[e]);no[n]||(no[n]=new WeakMap);var a=no[n],o=[],l=new Set,c=new Set(i),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};i.forEach(d);var u=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(f){if(l.has(f))u(f);else try{var m=f.getAttribute(s),b=m!==null&&m!=="false",v=(sr.get(f)||0)+1,y=(a.get(f)||0)+1;sr.set(f,v),a.set(f,y),o.push(f),v===1&&b&&to.set(f,!0),y===1&&f.setAttribute(n,"true"),b||f.setAttribute(s,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return u(t),l.clear(),Gc++,function(){o.forEach(function(p){var f=sr.get(p)-1,m=a.get(p)-1;sr.set(p,f),a.set(p,m),f||(to.has(p)||p.removeAttribute(s),to.delete(p)),m||p.removeAttribute(n)}),Gc--,Gc||(sr=new WeakMap,sr=new WeakMap,to=new WeakMap,no={})}},lP=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=iP(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),oP(s,i,n,"aria-hidden")):function(){return null}};function cP(e){const t=dP(e),n=h.forwardRef((s,i)=>{const{children:a,...o}=s,l=h.Children.toArray(a),c=l.find(hP);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return r.jsx(t,{...o,ref:i,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return r.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function dP(e){const t=h.forwardRef((n,s)=>{const{children:i,...a}=n;if(h.isValidElement(i)){const o=pP(i),l=fP(a,i.props);return i.type!==h.Fragment&&(l.ref=s?gf(s,o):o),h.cloneElement(i,l)}return h.Children.count(i)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uP=Symbol("radix.slottable");function hP(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uP}function fP(e,t){const n={...t};for(const s in t){const i=e[s],a=t[s];/^on[A-Z]/.test(s)?i&&a?n[s]=(...l)=>{const c=a(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...a}:s==="className"&&(n[s]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function pP(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Fl="Dialog",[Jv]=V_(Fl),[mP,tn]=Jv(Fl),Zv=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,l=h.useRef(null),c=h.useRef(null),[d,u]=K_({prop:s,defaultProp:i??!1,onChange:a,caller:Fl});return r.jsx(mP,{scope:t,triggerRef:l,contentRef:c,contentId:Fc(),titleId:Fc(),descriptionId:Fc(),open:d,onOpenChange:u,onOpenToggle:h.useCallback(()=>u(p=>!p),[u]),modal:o,children:n})};Zv.displayName=Fl;var eb="DialogTrigger",gP=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(eb,n),a=Gs(t,i.triggerRef);return r.jsx(Mn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":vf(i.open),...s,ref:a,onClick:ns(e.onClick,i.onOpenToggle)})});gP.displayName=eb;var xf="DialogPortal",[xP,tb]=Jv(xf,{forceMount:void 0}),nb=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:i}=e,a=tn(xf,t);return r.jsx(xP,{scope:t,forceMount:n,children:h.Children.map(s,o=>r.jsx(Il,{present:n||a.open,children:r.jsx($v,{asChild:!0,container:i,children:o})}))})};nb.displayName=xf;var al="DialogOverlay",sb=h.forwardRef((e,t)=>{const n=tb(al,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,a=tn(al,e.__scopeDialog);return a.modal?r.jsx(Il,{present:s||a.open,children:r.jsx(vP,{...i,ref:t})}):null});sb.displayName=al;var yP=cP("DialogOverlay.RemoveScroll"),vP=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(al,n);return r.jsx(Xv,{as:yP,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(Mn.div,{"data-state":vf(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Fs="DialogContent",rb=h.forwardRef((e,t)=>{const n=tb(Fs,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,a=tn(Fs,e.__scopeDialog);return r.jsx(Il,{present:s||a.open,children:a.modal?r.jsx(bP,{...i,ref:t}):r.jsx(wP,{...i,ref:t})})});rb.displayName=Fs;var bP=h.forwardRef((e,t)=>{const n=tn(Fs,e.__scopeDialog),s=h.useRef(null),i=Gs(t,n.contentRef,s);return h.useEffect(()=>{const a=s.current;if(a)return lP(a)},[]),r.jsx(ib,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ns(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ns(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:ns(e.onFocusOutside,a=>a.preventDefault())})}),wP=h.forwardRef((e,t)=>{const n=tn(Fs,e.__scopeDialog),s=h.useRef(!1),i=h.useRef(!1);return r.jsx(ib,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:a=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),ib=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,l=tn(Fs,n),c=h.useRef(null),d=Gs(t,c);return kT(),r.jsxs(r.Fragment,{children:[r.jsx(Fv,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:a,children:r.jsx(Iv,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":vf(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(kP,{titleId:l.titleId}),r.jsx(NP,{contentRef:c,descriptionId:l.descriptionId})]})]})}),yf="DialogTitle",ab=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(yf,n);return r.jsx(Mn.h2,{id:i.titleId,...s,ref:t})});ab.displayName=yf;var ob="DialogDescription",lb=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(ob,n);return r.jsx(Mn.p,{id:i.descriptionId,...s,ref:t})});lb.displayName=ob;var cb="DialogClose",db=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(cb,n);return r.jsx(Mn.button,{type:"button",...s,ref:t,onClick:ns(e.onClick,()=>i.onOpenChange(!1))})});db.displayName=cb;function vf(e){return e?"open":"closed"}var ub="DialogTitleWarning",[W6,hb]=F_(ub,{contentName:Fs,titleName:yf,docsSlug:"dialog"}),kP=({titleId:e})=>{const t=hb(ub),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
804
|
+
`)},tP=0,nr=[];function nP(e){var t=h.useRef([]),n=h.useRef([0,0]),s=h.useRef(),i=h.useState(tP++)[0],a=h.useState(Kv)[0],o=h.useRef(e);h.useEffect(function(){o.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=jT([e.lockRef.current],(e.shards||[]).map(Y0),!0).filter(Boolean);return y.forEach(function(v){return v.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(y,v){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var g=eo(y),x=n.current,w="deltaX"in y?y.deltaX:x[0]-g[0],j="deltaY"in y?y.deltaY:x[1]-g[1],k,N=y.target,S=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in y&&S==="h"&&N.type==="range")return!1;var _=window.getSelection(),R=_&&_.anchorNode,L=R?R===N||R.contains(N):!1;if(L)return!1;var P=G0(S,N);if(!P)return!0;if(P?k=S:(k=S==="v"?"h":"v",P=G0(S,N)),!P)return!1;if(!s.current&&"changedTouches"in y&&(w||j)&&(s.current=k),!k)return!0;var V=s.current||k;return JT(V,v,y,V==="h"?w:j)},[]),c=h.useCallback(function(y){var v=y;if(!(!nr.length||nr[nr.length-1]!==a)){var g="deltaY"in v?q0(v):eo(v),x=t.current.filter(function(k){return k.name===v.type&&(k.target===v.target||v.target===k.shadowParent)&&ZT(k.delta,g)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(Y0).filter(Boolean).filter(function(k){return k.contains(v.target)}),j=w.length>0?l(v,w[0]):!o.current.noIsolation;j&&v.cancelable&&v.preventDefault()}}},[]),d=h.useCallback(function(y,v,g,x){var w={name:y,delta:v,target:g,should:x,shadowParent:sP(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),u=h.useCallback(function(y){n.current=eo(y),s.current=void 0},[]),p=h.useCallback(function(y){d(y.type,q0(y),y.target,l(y,e.lockRef.current))},[]),f=h.useCallback(function(y){d(y.type,eo(y),y.target,l(y,e.lockRef.current))},[]);h.useEffect(function(){return nr.push(a),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,tr),document.addEventListener("touchmove",c,tr),document.addEventListener("touchstart",u,tr),function(){nr=nr.filter(function(y){return y!==a}),document.removeEventListener("wheel",c,tr),document.removeEventListener("touchmove",c,tr),document.removeEventListener("touchstart",u,tr)}},[]);var m=e.removeScrollBar,b=e.inert;return h.createElement(h.Fragment,null,b?h.createElement(a,{styles:eP(i)}):null,m?h.createElement(WT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rP=MT(Wv,nP);var Xv=h.forwardRef(function(e,t){return h.createElement(Bl,on({},e,{ref:t,sideCar:rP}))});Xv.classNames=Bl.classNames;var iP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},sr=new WeakMap,to=new WeakMap,no={},Gc=0,Qv=function(e){return e&&(e.host||Qv(e.parentNode))},aP=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Qv(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},oP=function(e,t,n,s){var i=aP(t,Array.isArray(e)?e:[e]);no[n]||(no[n]=new WeakMap);var a=no[n],o=[],l=new Set,c=new Set(i),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};i.forEach(d);var u=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(f){if(l.has(f))u(f);else try{var m=f.getAttribute(s),b=m!==null&&m!=="false",y=(sr.get(f)||0)+1,v=(a.get(f)||0)+1;sr.set(f,y),a.set(f,v),o.push(f),y===1&&b&&to.set(f,!0),v===1&&f.setAttribute(n,"true"),b||f.setAttribute(s,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return u(t),l.clear(),Gc++,function(){o.forEach(function(p){var f=sr.get(p)-1,m=a.get(p)-1;sr.set(p,f),a.set(p,m),f||(to.has(p)||p.removeAttribute(s),to.delete(p)),m||p.removeAttribute(n)}),Gc--,Gc||(sr=new WeakMap,sr=new WeakMap,to=new WeakMap,no={})}},lP=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=iP(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),oP(s,i,n,"aria-hidden")):function(){return null}};function cP(e){const t=dP(e),n=h.forwardRef((s,i)=>{const{children:a,...o}=s,l=h.Children.toArray(a),c=l.find(hP);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return r.jsx(t,{...o,ref:i,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return r.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function dP(e){const t=h.forwardRef((n,s)=>{const{children:i,...a}=n;if(h.isValidElement(i)){const o=pP(i),l=fP(a,i.props);return i.type!==h.Fragment&&(l.ref=s?gf(s,o):o),h.cloneElement(i,l)}return h.Children.count(i)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uP=Symbol("radix.slottable");function hP(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uP}function fP(e,t){const n={...t};for(const s in t){const i=e[s],a=t[s];/^on[A-Z]/.test(s)?i&&a?n[s]=(...l)=>{const c=a(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...a}:s==="className"&&(n[s]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function pP(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Fl="Dialog",[Jv]=V_(Fl),[mP,tn]=Jv(Fl),Zv=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,l=h.useRef(null),c=h.useRef(null),[d,u]=K_({prop:s,defaultProp:i??!1,onChange:a,caller:Fl});return r.jsx(mP,{scope:t,triggerRef:l,contentRef:c,contentId:Fc(),titleId:Fc(),descriptionId:Fc(),open:d,onOpenChange:u,onOpenToggle:h.useCallback(()=>u(p=>!p),[u]),modal:o,children:n})};Zv.displayName=Fl;var eb="DialogTrigger",gP=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(eb,n),a=Gs(t,i.triggerRef);return r.jsx(Mn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":vf(i.open),...s,ref:a,onClick:ns(e.onClick,i.onOpenToggle)})});gP.displayName=eb;var xf="DialogPortal",[xP,tb]=Jv(xf,{forceMount:void 0}),nb=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:i}=e,a=tn(xf,t);return r.jsx(xP,{scope:t,forceMount:n,children:h.Children.map(s,o=>r.jsx(Il,{present:n||a.open,children:r.jsx($v,{asChild:!0,container:i,children:o})}))})};nb.displayName=xf;var al="DialogOverlay",sb=h.forwardRef((e,t)=>{const n=tb(al,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,a=tn(al,e.__scopeDialog);return a.modal?r.jsx(Il,{present:s||a.open,children:r.jsx(vP,{...i,ref:t})}):null});sb.displayName=al;var yP=cP("DialogOverlay.RemoveScroll"),vP=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(al,n);return r.jsx(Xv,{as:yP,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(Mn.div,{"data-state":vf(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Fs="DialogContent",rb=h.forwardRef((e,t)=>{const n=tb(Fs,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,a=tn(Fs,e.__scopeDialog);return r.jsx(Il,{present:s||a.open,children:a.modal?r.jsx(bP,{...i,ref:t}):r.jsx(wP,{...i,ref:t})})});rb.displayName=Fs;var bP=h.forwardRef((e,t)=>{const n=tn(Fs,e.__scopeDialog),s=h.useRef(null),i=Gs(t,n.contentRef,s);return h.useEffect(()=>{const a=s.current;if(a)return lP(a)},[]),r.jsx(ib,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ns(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ns(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:ns(e.onFocusOutside,a=>a.preventDefault())})}),wP=h.forwardRef((e,t)=>{const n=tn(Fs,e.__scopeDialog),s=h.useRef(!1),i=h.useRef(!1);return r.jsx(ib,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:a=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),ib=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,l=tn(Fs,n),c=h.useRef(null),d=Gs(t,c);return kT(),r.jsxs(r.Fragment,{children:[r.jsx(Fv,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:a,children:r.jsx(Iv,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":vf(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(kP,{titleId:l.titleId}),r.jsx(NP,{contentRef:c,descriptionId:l.descriptionId})]})]})}),yf="DialogTitle",ab=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(yf,n);return r.jsx(Mn.h2,{id:i.titleId,...s,ref:t})});ab.displayName=yf;var ob="DialogDescription",lb=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(ob,n);return r.jsx(Mn.p,{id:i.descriptionId,...s,ref:t})});lb.displayName=ob;var cb="DialogClose",db=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=tn(cb,n);return r.jsx(Mn.button,{type:"button",...s,ref:t,onClick:ns(e.onClick,()=>i.onOpenChange(!1))})});db.displayName=cb;function vf(e){return e?"open":"closed"}var ub="DialogTitleWarning",[W6,hb]=F_(ub,{contentName:Fs,titleName:yf,docsSlug:"dialog"}),kP=({titleId:e})=>{const t=hb(ub),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
805
805
|
|
|
806
806
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
807
807
|
|
|
808
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},jP="DialogDescriptionWarning",NP=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hb(jP).contentName}}.`;return h.useEffect(()=>{var a;const i=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},SP=Zv,CP=nb,EP=sb,_P=rb,TP=ab,PP=lb,X0=db;const AP={Messaging:{icon:"💬",accent:"text-blue-300",border:"border-blue-500/20",bg:"bg-blue-500/10",iconBg:"bg-blue-500/10"},Finance:{icon:"📈",accent:"text-emerald-300",border:"border-emerald-500/20",bg:"bg-emerald-500/10",iconBg:"bg-emerald-500/10"},System:{icon:"⚙️",accent:"text-orange-300",border:"border-orange-500/20",bg:"bg-orange-500/10",iconBg:"bg-orange-500/10"}};function MP(e){return AP[e]??{icon:"🔌",accent:"text-white/60",border:"border-white/10",bg:"bg-white/5",iconBg:"bg-white/5"}}function RP({name:e}){return r.jsx("span",{className:"inline-block px-2 py-0.5 rounded-md text-[10px] font-mono bg-white/5 text-white/40 border border-white/8",children:e})}function zP({pack:e,installing:t,installLog:n,onInstall:s,onConfigure:i}){const[a,o]=h.useState(!1),l=MP(e.category),c=e.extensions.length===0;return r.jsxs("div",{className:"flex flex-col bg-white/5 border border-white/8 rounded-2xl p-5 gap-3 hover:bg-white/[0.07] hover:border-white/12 transition-all duration-200",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`w-12 h-12 rounded-xl ${l.iconBg} flex items-center justify-center text-[24px] shrink-0 select-none border ${l.border}`,children:l.icon}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-white/90 font-bold text-[15px] leading-snug",children:e.name}),e.installed&&r.jsx(kr,{size:14,className:"text-emerald-400 shrink-0"})]}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:`text-[10px] font-bold uppercase tracking-widest ${l.accent}`,children:e.category}),!c&&r.jsxs("span",{className:"text-[10px] text-white/30",children:[e.extensions.length," extension",e.extensions.length!==1?"s":""]}),c&&r.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-yellow-500/10 text-yellow-400 border border-yellow-500/20 font-medium",children:"Coming Soon"})]})]})]}),r.jsx("p",{className:"text-white/45 text-[13px] leading-relaxed",children:e.description}),r.jsx("p",{className:"text-[11px] font-mono text-white/25",children:e.npmPackage}),e.extensions.length>0&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>o(d=>!d),className:"flex items-center gap-1 text-[11px] text-white/30 hover:text-white/60 transition-colors mb-2",children:[a?r.jsx(Ml,{size:12}):r.jsx(qr,{size:12}),a?"Hide":"Show"," included extensions"]}),a&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.extensions.map(d=>r.jsx(RP,{name:d},d))})]}),t&&n&&r.jsx("pre",{className:"text-[10px] text-white/40 bg-black/40 rounded-xl p-2.5 max-h-[72px] overflow-y-auto font-mono whitespace-pre-wrap break-all border border-white/6",children:n}),r.jsx("div",{className:"mt-auto pt-1",children:c?r.jsx("div",{className:"w-full py-2 rounded-xl text-[12px] font-medium text-center bg-white/4 text-white/25 border border-white/8 cursor-default select-none",children:"Not yet available"}):e.installed?r.jsx("button",{onClick:i,className:"w-full py-2 rounded-xl text-[12px] font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 hover:bg-emerald-500/15 hover:border-emerald-500/30 transition-colors",children:"Installed — Configure Keys"}):r.jsx("button",{onClick:s,disabled:t,className:`w-full flex items-center justify-center gap-2 py-2 rounded-xl text-[12px] font-semibold ${l.bg} ${l.accent} border ${l.border} hover:brightness-125 disabled:opacity-50 disabled:cursor-not-allowed transition-all`,children:t?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:13,className:"animate-spin shrink-0"}),r.jsx("span",{children:"Installing…"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Hs,{size:13,className:"shrink-0"}),r.jsx("span",{children:"Install Pack"})]})})})]})}function LP({pack:e,onClose:t}){const[n,s]=h.useState({}),[i,a]=h.useState(!1);h.useEffect(()=>{e&&s({})},[e]);const o=async()=>{if(e){a(!0);try{if(!(await $("/api/store/configure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:n})})).ok)throw new Error("Configure request failed");de.success(`${e.name} configured — keys saved to .env`),t()}catch(c){de.error(c instanceof Error?c.message:"Configure failed")}finally{a(!1)}}},l={};for(const c of(e==null?void 0:e.requiredKeys)??[]){const d=c.forExtension??"general";(l[d]??(l[d]=[])).push(c)}return r.jsx(SP,{open:!!e,onOpenChange:c=>{c||t()},children:r.jsxs(CP,{children:[r.jsx(EP,{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm"}),r.jsxs(_P,{className:"fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-[460px] mx-4 bg-[#0d0f14] border border-white/10 rounded-2xl p-6 shadow-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsxs(TP,{className:"text-white/90 font-semibold text-[15px]",children:["Configure ",e==null?void 0:e.name]}),r.jsx(X0,{className:"w-7 h-7 flex items-center justify-center rounded-lg text-white/30 hover:text-white/70 hover:bg-white/6 transition-colors",children:r.jsx(He,{size:15})})]}),r.jsxs(PP,{className:"text-white/40 text-[12px] mb-5 leading-relaxed",children:["Fill in the keys for the extensions you want to use. Leave others blank — they can be added later. Keys are saved to your local"," ",r.jsx("code",{className:"font-mono text-white/60 bg-white/8 px-1 rounded",children:".env"})," file."]}),r.jsx("div",{className:"space-y-5",children:Object.entries(l).map(([c,d])=>r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-white/30 mb-2.5",children:c}),r.jsx("div",{className:"space-y-3",children:d.map(u=>r.jsxs("div",{children:[r.jsx("label",{className:"block text-[12px] font-medium text-white/70 mb-1",children:u.label}),u.hint&&r.jsx("p",{className:"text-[11px] text-white/35 mb-1.5",children:u.hint}),r.jsx("input",{type:"password",autoComplete:"off",value:n[u.env]??"",onChange:p=>s(f=>({...f,[u.env]:p.target.value})),className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2.5 text-sm text-white/80 placeholder-white/20 focus:outline-none focus:border-orange-500/40 focus:bg-white/[0.07] transition-colors font-mono",placeholder:`Enter ${u.label}`})]},u.env))})]},c))}),r.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[r.jsxs("button",{onClick:o,disabled:i,className:"flex-1 flex items-center justify-center gap-2 bg-orange-500/20 hover:bg-orange-500/30 border border-orange-500/30 hover:border-orange-500/50 disabled:opacity-60 text-orange-300 rounded-xl py-2.5 text-[13px] font-semibold transition-all active:scale-[0.97]",children:[i?r.jsx(re,{size:14,className:"animate-spin"}):r.jsx(kr,{size:14}),"Save & Activate"]}),r.jsx(X0,{className:"px-4 py-2.5 text-[13px] text-white/35 hover:text-white/60 transition-colors rounded-xl hover:bg-white/5",children:"Skip"})]})]})]})})}const OP=12e4;function DP(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState(null),[o,l]=h.useState({}),[c,d]=h.useState(null),u=h.useRef(null),p=h.useCallback(async()=>{s(!0);try{const b=await $("/api/store/extensions");b.ok&&t(await b.json())}catch{}finally{s(!1)}},[]);h.useEffect(()=>{p()},[p]);const f=h.useCallback(async b=>{var g;(g=u.current)==null||g.abort();const v=new AbortController;u.current=v,a(b.id),l(x=>({...x,[b.id]:""}));const y=setTimeout(()=>{v.abort()},OP);try{const x=await $("/api/store/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:b.id}),signal:v.signal},{retries:1,retryDelay:0});if(!x.body)throw new Error("No response stream");const w=x.body.getReader(),j=new TextDecoder;let k="";for(;;){const{done:N,value:S}=await w.read();if(N)break;const _=j.decode(S,{stream:!0});k+=_,l(R=>({...R,[b.id]:k}))}k.includes("__MUSTB_INSTALL_OK__")?(de.success(`${b.name} installed!`),t(N=>N.map(S=>S.id===b.id?{...S,installed:!0}:S)),b.requiredKeys.length>0&&d(b)):k.includes("__MUSTB_INSTALL_FAILED__")?de.error(`${b.name} installation failed — check the log above.`):de.error(`${b.name} installation failed.`)}catch(x){x.name==="AbortError"?de.error(`Install timed out — is ${b.npmPackage} published to npm?`):de.error(x instanceof Error?x.message:"Install failed")}finally{clearTimeout(y),a(null)}},[]),m=e.filter(b=>b.installed).length;return r.jsxs("div",{className:"min-h-screen bg-transparent pt-4 pb-10 px-4 sm:px-6 max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-2xl bg-orange-500/10 border border-orange-500/20 flex items-center justify-center shrink-0",children:r.jsx(gv,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[22px] font-black text-white/95 leading-none",children:"Extension Store"}),m>0&&r.jsxs("span",{className:"text-[11px] text-emerald-400/80 font-medium",children:[m," pack",m!==1?"s":""," installed"]})]})]}),r.jsxs("p",{className:"text-white/40 text-[13px] leading-relaxed max-w-2xl mt-1",children:["Extensions are grouped into themed packs."," ","Install one pack to get all its integrations — fetched directly from npm into"," ",r.jsx("code",{className:"font-mono text-white/60 bg-white/5 px-1.5 py-0.5 rounded text-[11px] border border-white/8",children:"~/.must-b/extensions/"})]})]}),r.jsx("button",{onClick:p,title:"Refresh",className:"p-2.5 rounded-xl text-white/30 hover:text-white/70 hover:bg-white/6 border border-white/8 transition-all shrink-0",children:r.jsx(fe,{size:15})})]}),r.jsxs("div",{className:"mb-8 px-3 py-2.5 rounded-xl bg-white/5 border border-white/8 flex items-center gap-3",children:[r.jsx("code",{className:"text-[11px] font-mono text-white/30 shrink-0",children:"CLI:"}),r.jsxs("code",{className:"text-[12px] font-mono text-white/50",children:[r.jsx("span",{className:"text-orange-400",children:"must-b ext list"})," · ",r.jsx("span",{className:"text-orange-400",children:"must-b ext install channels"})," · ",r.jsx("span",{className:"text-orange-400",children:"must-b ext install system"})]})]}),n?r.jsxs("div",{className:"flex flex-col items-center justify-center py-24 gap-3",children:[r.jsx(re,{size:22,className:"animate-spin text-orange-400"}),r.jsx("p",{className:"text-white/35 text-[13px]",children:"Loading extension store…"})]}):e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-24 gap-3",children:[r.jsx(Hs,{size:28,className:"text-white/20"}),r.jsx("p",{className:"text-white/35 text-[13px]",children:"No packs available — backend may not be running."}),r.jsx("button",{onClick:p,className:"mt-1 px-4 py-2 rounded-xl bg-orange-500/10 border border-orange-500/20 text-orange-400 text-[12px] font-medium hover:bg-orange-500/20 transition-colors",children:"Retry"})]}):r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-5",children:e.map(b=>r.jsx(zP,{pack:b,installing:i===b.id,installLog:o[b.id]??"",onInstall:()=>f(b),onConfigure:()=>d(b)},b.id))}),r.jsxs("p",{className:"text-center text-white/20 text-[11px] mt-12",children:["Packs are built with"," ",r.jsx("code",{className:"font-mono bg-white/5 px-1 rounded border border-white/8",children:"npm run build:packs"})," ","and published to npm. Run"," ",r.jsx("code",{className:"font-mono bg-white/5 px-1 rounded border border-white/8",children:"must-b ext list"})," ","for the CLI interface."]}),r.jsx(LP,{pack:c,onClose:()=>d(null)})]})}function Q0(e){return e>=90?"#ef4444":e>=70?"#f97316":"#22c55e"}function ci(e){return e==="critical"?"#ef4444":e==="warning"?"#f97316":"#60a5fa"}function IP(){const{t:e,locale:t}=gt(),n=e.systemHealth,[s,i]=h.useState(null),[a,o]=h.useState(null),[l,c]=h.useState(!1),d=h.useCallback(()=>o(null),[]);h.useEffect(()=>{window.dispatchEvent(new CustomEvent("mustb:safeMode",{detail:{active:(s==null?void 0:s.safeMode)??!1}}))},[s==null?void 0:s.safeMode]),h.useEffect(()=>{const f=Be();return f.on("systemStats",m=>i(m)),f.on("systemHealth",m=>{if(o(m),c(!0),m.level!=="critical"){const b=m.level==="info"?6e3:12e3;setTimeout(()=>o(null),b)}}),()=>{f.off("systemStats"),f.off("systemHealth")}},[]);const u=(s==null?void 0:s.cpu)??0,p=(s==null?void 0:s.ram)??0;return r.jsxs("div",{className:"relative flex items-center",children:[r.jsxs("button",{onClick:()=>a&&c(f=>!f),className:"flex items-center gap-1.5 select-none transition-all rounded-md",style:{cursor:a?"pointer":"default"},title:a?a.message:n.title,children:[a?r.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0 animate-pulse",style:{background:ci(a.level)}}):r.jsx(fn,{size:12,className:"text-orange-400/70"}),s&&r.jsxs("span",{className:"hidden sm:flex items-center gap-1.5",children:[r.jsx("span",{className:"text-[10px] font-semibold text-white/45",children:"CPU"}),r.jsx("span",{className:"w-9 h-1 rounded-full bg-white/10 overflow-hidden flex-shrink-0",children:r.jsx("span",{className:"h-full rounded-full block transition-all duration-700",style:{width:`${u}%`,background:Q0(u)}})}),r.jsxs("span",{className:"text-[9px] font-mono text-white/40 w-6 text-right",children:[u,"%"]}),r.jsx("span",{className:"w-px h-3 bg-white/10"}),r.jsx("span",{className:"text-[10px] font-semibold text-white/45",children:"RAM"}),r.jsx("span",{className:"w-9 h-1 rounded-full bg-white/10 overflow-hidden flex-shrink-0",children:r.jsx("span",{className:"h-full rounded-full block transition-all duration-700",style:{width:`${p}%`,background:Q0(p)}})}),r.jsxs("span",{className:"text-[9px] font-mono text-white/40 w-6 text-right",children:[p,"%"]}),s.liteMode&&!s.safeMode&&r.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded bg-orange-500/20 text-orange-400 ml-0.5",children:n.lite}),s.safeMode&&r.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded bg-red-500/20 text-red-400 ml-0.5",children:n.safe})]}),!s&&r.jsx("span",{className:"text-[10px] font-semibold hidden sm:inline text-white/35",children:n.title})]}),r.jsx(ne,{children:l&&a&&r.jsxs(H.div,{initial:{opacity:0,y:8,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.96},transition:{duration:.2,ease:"easeOut"},className:"absolute top-full right-0 mt-2 w-72 z-[200] rounded-2xl overflow-hidden",style:{background:"rgba(20,8,2,0.88)",border:`1px solid ${ci(a.level)}44`,backdropFilter:"blur(20px)",boxShadow:`0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px ${ci(a.level)}22`},children:[r.jsxs("div",{className:"flex items-start justify-between px-4 pt-3 pb-2",style:{borderBottom:`1px solid ${ci(a.level)}22`},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ls,{size:13,style:{color:ci(a.level)}}),r.jsxs("span",{className:"text-[12px] font-bold text-white/90 capitalize",children:[n[a.level]??a.level," — ",n.kinds[a.kind]??a.kind]})]}),r.jsx("button",{onClick:d,className:"text-white/30 hover:text-white/70 transition-colors",children:r.jsx(He,{size:13})})]}),r.jsxs("div",{className:"px-4 py-3 space-y-2",children:[r.jsx("p",{className:"text-[13px] text-white/80 leading-relaxed",children:n.alerts[a.kind]??a.message}),r.jsx("p",{className:"text-[11px] text-white/45 leading-relaxed italic",children:n.recommendations[a.kind]??a.recommendation})]}),r.jsx("div",{className:"px-4 pb-3",children:r.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:new Date(a.ts).toLocaleTimeString()})})]},"health-popover")})]})}function BP(e){return`${Math.round(e*100)}%`}const J0={skill:{label:"Skill",icon:Oe,color:"text-orange-400"},conversation:{label:"Conversation",icon:Is,color:"text-blue-400"},workspace:{label:"Workspace",icon:An,color:"text-green-400"},custom:{label:"Custom",icon:en,color:"text-gray-400"}};function FP(){const{t:e}=gt(),t=e.panels.memory,[n,s]=h.useState(""),[i,a]=h.useState([]),[o,l]=h.useState(null),[c,d]=h.useState(!1),[u,p]=h.useState(null),[f,m]=h.useState(null),[b,v]=h.useState(!1),y=h.useRef(null),g=h.useCallback(async k=>{const N=k.trim();if(N){d(!0),a([]);try{const S=await $(`/api/memory/search?q=${encodeURIComponent(N)}&limit=10`);if(S.ok){const _=await S.json();a(_.results??[])}}catch{}d(!1)}},[]),x=k=>{k.key==="Enter"&&g(n)},w=h.useCallback(async()=>{try{const k=await $("/api/memory/stats");k.ok&&l(await k.json())}catch{}},[]),j=async k=>{p(k),m(null);try{const N=k==="clear"?await $("/api/memory/clear-index",{method:"DELETE"}):await $(`/api/memory/index-${k}`,{method:"POST"});if(N.ok){const S=await N.json(),_=k==="clear"?t.indexCleared:`${t.indexed} ${S.indexed??0} ${k==="skills"?t.skills:t.files}`;m({ok:!0,msg:_}),w(),k==="clear"&&a([])}else m({ok:!1,msg:t.opFailed})}catch{m({ok:!1,msg:t.reqError})}p(null),setTimeout(()=>m(null),4e3)};return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-[13px] font-bold text-gray-300",children:t.title}),o&&r.jsxs("span",{className:"text-[10px] text-gray-600 bg-white/5 px-2 py-0.5 rounded-full font-mono",children:[o.items.toLocaleString()," ",t.vectors]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>{v(k=>!k),o||w()},className:`text-gray-600 hover:text-gray-400 transition-colors ${b?"text-orange-400":""}`,title:t.indexControls,children:r.jsx(OC,{size:13})}),r.jsx("button",{onClick:w,className:"text-gray-600 hover:text-gray-400 transition-colors",title:t.refreshStats,children:r.jsx(fe,{size:13})})]})]}),r.jsx(ne,{children:b&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"border-b border-white/5 bg-white/2 overflow-hidden shrink-0",children:[r.jsxs("div",{className:"px-6 py-3 flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 uppercase tracking-widest font-bold shrink-0",children:t.indexLabel}),["skills","workspace"].map(k=>r.jsxs("button",{onClick:()=>j(k),disabled:u!==null,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-white/4 border border-white/6 text-[11px] text-gray-400 hover:text-gray-200 hover:bg-white/8 transition-all disabled:opacity-40 capitalize",children:[u===k?r.jsx(re,{size:10,className:"animate-spin"}):k==="skills"?r.jsx(Oe,{size:10}):r.jsx(An,{size:10}),k]},k)),r.jsxs("button",{onClick:()=>j("clear"),disabled:u!==null,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-red-500/8 border border-red-500/15 text-[11px] text-red-400 hover:bg-red-500/15 transition-all disabled:opacity-40 ml-auto",children:[u==="clear"?r.jsx(re,{size:10,className:"animate-spin"}):r.jsx(ms,{size:10}),t.clearIndex]})]}),r.jsx(ne,{children:f&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`flex items-center gap-1.5 px-6 pb-3 text-[11px] font-medium ${f.ok?"text-green-400":"text-red-400"}`,children:[f.ok?r.jsx(Fe,{size:11}):r.jsx(mt,{size:11}),f.msg]})})]})}),r.jsxs("div",{className:"px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/4 border border-white/8 focus-within:border-orange-500/30 transition-colors",children:[r.jsx(Zt,{size:13,className:"text-gray-600 shrink-0"}),r.jsx("input",{ref:y,value:n,onChange:k=>s(k.target.value),onKeyDown:x,placeholder:t.searchPlaceholder,className:"flex-1 bg-transparent text-[13px] text-gray-200 outline-none placeholder-gray-700"}),c?r.jsx(re,{size:13,className:"text-orange-400 animate-spin shrink-0"}):r.jsx("button",{onClick:()=>g(n),disabled:!n.trim(),className:"text-[10px] px-2 py-0.5 rounded-lg bg-orange-500/12 text-orange-400 font-semibold hover:bg-orange-500/22 border border-orange-500/20 transition-all disabled:opacity-30",children:"⌘↵"})]}),r.jsx("p",{className:"text-[10px] text-gray-700 mt-1.5 ml-1",children:t.searchHint})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-4 space-y-3",children:[i.length===0&&!c&&r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx(Xt,{size:36,className:"text-gray-700 mb-4"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:n.trim()?t.emptyNoResults:t.emptyTitle}),r.jsx("p",{className:"text-xs text-gray-700 mt-1 max-w-xs leading-relaxed",children:n.trim()?t.emptyNoResultsHint:t.emptyHint})]}),i.map((k,N)=>{const S=J0[k.metadata.source]??J0.custom,_=S.icon;return r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:N*.04},className:"rounded-2xl border border-white/6 bg-[#0c0f18] p-4 hover:border-white/12 transition-all",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(_,{size:11,className:`${S.color} shrink-0`}),r.jsx("p",{className:"text-[12px] font-semibold text-gray-300 truncate",children:k.metadata.title})]}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full border ${k.score>=.85?"bg-green-500/10 border-green-500/20 text-green-400":k.score>=.65?"bg-orange-500/10 border-orange-500/20 text-orange-400":"bg-white/4 border-white/6 text-gray-500"}`,children:BP(k.score)}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-white/4 border border-white/6 font-medium ${S.color}`,children:S.label})]})]}),r.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed line-clamp-3 mb-2",children:k.text}),k.metadata.tags&&k.metadata.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:k.metadata.tags.map((R,L)=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/4 text-gray-600 font-mono",children:R},L))}),r.jsx("div",{className:"mt-2 h-0.5 bg-white/4 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-orange-600 to-amber-400",style:{width:`${k.score*100}%`}})})]},N)})]})]})}const VP={node:Jt,python:yn},$P={node:"text-green-400",python:"text-blue-400"};function UP(){const{t:e}=gt(),t=e.panels.plugins,[n,s]=h.useState([]),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(!1),[f,m]=h.useState(""),[b,v]=h.useState(""),[y,g]=h.useState("node"),[x,w]=h.useState(""),[j,k]=h.useState(!1),N=(L,P)=>{d({ok:L,msg:P}),setTimeout(()=>d(null),4e3)},S=h.useCallback(async()=>{a(!0);try{const L=await $("/api/plugins/list");if(L.ok){const P=await L.json();s(P.plugins??[])}}catch{}a(!1)},[]);h.useEffect(()=>{S()},[S]);const _=async(L,P)=>{l(L);try{(await $(P?"/api/plugins/stop":"/api/plugins/run",{method:"POST",body:JSON.stringify({name:L})})).ok?(N(!0,P?`${L} stopped`:`${L} launched`),await S()):N(!1,t.opFailed)}catch{N(!1,t.reqError)}l(null)},R=async()=>{if(!(!f.trim()||!b.trim())){k(!0);try{(await $("/api/plugins/build",{method:"POST",body:JSON.stringify({name:f.trim(),goal:b.trim(),lang:y,context:x.trim()||void 0})})).ok?(N(!0,`Plugin "${f}" created`),m(""),v(""),w(""),p(!1),await S()):N(!1,t.buildFailed)}catch{N(!1,t.reqError)}k(!1)}};return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Fr,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-[13px] font-bold text-gray-300",children:t.title}),r.jsxs("span",{className:"text-[10px] text-gray-600 bg-white/5 px-2 py-0.5 rounded-full font-mono",children:[n.length," ",t.installed]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:S,className:"text-gray-600 hover:text-gray-400 transition-colors",title:t.refresh,children:r.jsx(fe,{size:13,className:i?"animate-spin":""})}),r.jsxs("button",{onClick:()=>p(L=>!L),className:`flex items-center gap-1 text-[10px] px-2.5 py-1 rounded-lg border font-semibold transition-all ${u?"bg-orange-500/15 border-orange-500/25 text-orange-400":"bg-white/4 border-white/8 text-gray-500 hover:text-gray-300"}`,children:[r.jsx(zl,{size:10}),t.newPlugin]})]})]}),r.jsx(ne,{children:c&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`flex items-center gap-1.5 px-6 py-2 text-[11px] font-medium shrink-0 ${c.ok?"text-green-400":"text-red-400"}`,children:[c.ok?r.jsx(Fe,{size:11}):r.jsx(mt,{size:11}),c.msg]})}),r.jsx(ne,{children:u&&r.jsx(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"border-b border-white/5 bg-white/2 overflow-hidden shrink-0",children:r.jsxs("div",{className:"px-6 py-4 space-y-3",children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:t.buildTitle}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx("input",{value:f,onChange:L=>m(L.target.value),placeholder:t.namePlaceholder,className:"col-span-2 px-3 py-2 rounded-lg bg-white/4 border border-white/8 text-[12px] text-gray-200 outline-none placeholder-gray-700 focus:border-orange-500/30 transition-colors"}),r.jsx("input",{value:b,onChange:L=>v(L.target.value),placeholder:t.goalPlaceholder,className:"col-span-2 px-3 py-2 rounded-lg bg-white/4 border border-white/8 text-[12px] text-gray-200 outline-none placeholder-gray-700 focus:border-orange-500/30 transition-colors"}),r.jsx("input",{value:x,onChange:L=>w(L.target.value),placeholder:t.contextPlaceholder,className:"col-span-2 px-3 py-2 rounded-lg bg-white/4 border border-white/8 text-[12px] text-gray-200 outline-none placeholder-gray-700 focus:border-orange-500/30 transition-colors"}),r.jsx("div",{className:"flex gap-2",children:["node","python"].map(L=>r.jsx("button",{onClick:()=>g(L),className:`flex-1 py-1.5 rounded-lg border text-[11px] font-semibold transition-all capitalize ${y===L?"bg-orange-500/15 border-orange-500/25 text-orange-400":"bg-white/4 border-white/8 text-gray-500"}`,children:L},L))}),r.jsxs("button",{onClick:R,disabled:j||!f.trim()||!b.trim(),className:"flex items-center justify-center gap-1.5 py-2 rounded-lg bg-orange-500/12 border border-orange-500/20 text-orange-400 text-[11px] font-bold hover:bg-orange-500/20 transition-all disabled:opacity-40",children:[j?r.jsx(re,{size:11,className:"animate-spin"}):r.jsx(Oe,{size:11}),t.generatePlugin]})]})]})})}),r.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-4 space-y-2",children:[n.length===0&&!i&&r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx(Fr,{size:36,className:"text-gray-700 mb-4"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:t.emptyTitle}),r.jsx("p",{className:"text-xs text-gray-700 mt-1",children:t.emptyHint})]}),n.map((L,P)=>{const V=VP[L.lang]??Jt,M=o===L.name;return r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:P*.04},className:`flex items-center gap-3 p-3 rounded-2xl border transition-all ${L.running?"bg-green-500/5 border-green-500/15 hover:border-green-500/25":"bg-[#0c0f18] border-white/6 hover:border-white/12"}`,children:[r.jsx(V,{size:13,className:$P[L.lang]??"text-gray-400"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[12px] font-semibold text-gray-300 truncate",children:L.name}),r.jsx("p",{className:"text-[10px] text-gray-600 font-mono",children:L.filename})]}),L.running&&r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-green-500/12 border border-green-500/20 text-green-400 font-bold",children:t.running}),r.jsxs("button",{disabled:M,onClick:()=>_(L.name,L.running),className:`flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-[10px] font-bold transition-all disabled:opacity-40 ${L.running?"bg-red-500/8 border-red-500/15 text-red-400 hover:bg-red-500/15":"bg-green-500/8 border-green-500/15 text-green-400 hover:bg-green-500/15"}`,children:[M?r.jsx(re,{size:10,className:"animate-spin"}):L.running?r.jsx(cf,{size:10}):r.jsx(Ws,{size:10}),L.running?t.stop:t.run]})]},L.name)})]})]})}function HP(e){if(!e)return"Never";try{return new Date(e).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})}catch{return e}}function WP(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function KP({skill:e}){const[t,n]=h.useState(!1),[s,i]=h.useState(!1),[a,o]=h.useState(""),[l,c]=h.useState(!1),d=async()=>{if(!l){c(!0);return}if(a.trim()){n(!0);try{await $("/api/v1/skills/invoke",{method:"POST",body:JSON.stringify({skill:e.id,params:{goal:a.trim(),_autoRun:!0}})}),i(!0),c(!1),o(""),setTimeout(()=>i(!1),3e3)}catch{}n(!1)}},u=(e.requires.bins??[]).length>0,p=(e.requires.config??[]).length>0;return r.jsx(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"rounded-2xl border border-white/6 bg-[#0c0f18] hover:border-white/12 transition-all",children:r.jsxs("div",{className:"p-3",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-1.5",children:[r.jsx("span",{className:"text-base leading-none mt-0.5 shrink-0",children:e.emoji??"⚡"}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"text-[12px] font-bold text-gray-200 truncate capitalize",children:e.name})}),e.hasScripts&&r.jsx(os,{size:10,className:"text-gray-700 shrink-0 mt-0.5"})]}),r.jsx("p",{className:"text-[10px] text-gray-500 leading-relaxed line-clamp-2 mb-2 ml-6",children:e.description}),(u||p)&&r.jsxs("div",{className:"flex flex-wrap gap-1 mb-2 ml-6",children:[(e.requires.bins??[]).map(f=>r.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-blue-500/8 border border-blue-500/15 text-blue-400 font-mono",children:["bin:",f]},f)),(e.requires.config??[]).map(f=>r.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-purple-500/8 border border-purple-500/15 text-purple-400 font-mono",children:["cfg:",f]},f))]}),r.jsx(ne,{children:l&&r.jsx(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden mb-2",children:r.jsx("input",{autoFocus:!0,value:a,onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&d(),f.key==="Escape"&&(c(!1),o(""))},placeholder:`Goal for ${e.name}…`,className:"w-full px-2.5 py-1.5 rounded-lg bg-white/4 border border-white/10 text-[11px] text-gray-200 placeholder-gray-700 outline-none focus:border-orange-500/30 transition-colors"})})}),r.jsxs("div",{className:"flex items-center justify-end gap-1 ml-6",children:[l&&r.jsx("button",{onClick:()=>{c(!1),o("")},className:"text-[10px] px-2 py-1 rounded-lg bg-white/4 text-gray-600 hover:text-gray-400 transition-colors",children:"Cancel"}),r.jsx("button",{onClick:d,disabled:t||l&&!a.trim(),className:`flex items-center gap-1 px-2.5 py-1 rounded-lg text-[10px] font-semibold border transition-all disabled:opacity-40 ${s?"bg-green-500/10 border-green-500/20 text-green-400":"bg-orange-500/8 border-orange-500/15 text-orange-400 hover:bg-orange-500/15"}`,children:t?r.jsx(re,{size:9,className:"animate-spin"}):s?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:9})," Sent"]}):l?r.jsxs(r.Fragment,{children:[r.jsx(Qt,{size:9})," Run"]}):r.jsxs(r.Fragment,{children:[r.jsx(zC,{size:9})," Use"]})})]})]})})}function GP(){const{t:e}=gt(),t=e.panels.skills,[n,s]=h.useState("saved"),[i,a]=h.useState([]),[o,l]=h.useState(!1),[c,d]=h.useState(null),[u,p]=h.useState("idle"),[f,m]=h.useState(null),[b,v]=h.useState(null),[y,g]=h.useState([]),[x,w]=h.useState(!1),[j,k]=h.useState(""),N=h.useCallback(async()=>{l(!0);try{const P=await $("/api/skills/list");if(P.ok){const V=await P.json();a(V.skills??[])}}catch{}l(!1)},[]),S=h.useCallback(async()=>{w(!0);try{const P=await $("/api/skills/catalog");if(P.ok){const V=await P.json();g(V.skills??[])}}catch{}w(!1)},[]);h.useEffect(()=>{N()},[N]),h.useEffect(()=>{n==="library"&&y.length===0&&S()},[n,y.length,S]),h.useEffect(()=>{const P=Be(),V=M=>{M.type==="skillRunStart"&&M.skillId&&(d(M.skillId),p("running")),M.type==="planFinish"&&(p("done"),d(null),N(),setTimeout(()=>p("idle"),2500))};return P.on("agentUpdate",V),()=>{P.off("agentUpdate",V)}},[N]);const _=async P=>{if(!c){d(P.id),p("running");try{const V=await $("/api/skills/run",{method:"POST",body:JSON.stringify({id:P.id})});if(!V.ok)throw new Error(`HTTP ${V.status}`)}catch{p("error"),d(null),setTimeout(()=>p("idle"),3e3)}}},R=async P=>{m(P);try{await $(`/api/skills/${P}`,{method:"DELETE"}),a(V=>V.filter(M=>M.id!==P))}catch{}m(null),v(null)},L=j.trim()?y.filter(P=>P.name.toLowerCase().includes(j.toLowerCase())||P.description.toLowerCase().includes(j.toLowerCase())):y;return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Al,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-[13px] font-bold text-gray-300",children:t.title})]}),r.jsxs("div",{className:"flex items-center gap-1 bg-white/4 rounded-lg p-0.5",children:[r.jsxs("button",{onClick:()=>s("saved"),className:`flex items-center gap-1 px-2.5 py-1 rounded-md text-[10px] font-semibold transition-all ${n==="saved"?"bg-orange-500/15 text-orange-400":"text-gray-600 hover:text-gray-400"}`,children:[r.jsx(Oe,{size:9}),"Saved",i.length>0&&r.jsx("span",{className:"text-[9px] font-mono text-gray-600",children:i.length})]}),r.jsxs("button",{onClick:()=>s("library"),className:`flex items-center gap-1 px-2.5 py-1 rounded-md text-[10px] font-semibold transition-all ${n==="library"?"bg-orange-500/15 text-orange-400":"text-gray-600 hover:text-gray-400"}`,children:[r.jsx(Ac,{size:9}),"Library",y.length>0&&r.jsx("span",{className:"text-[9px] font-mono text-gray-600",children:y.length})]})]}),r.jsx("button",{onClick:n==="saved"?N:S,disabled:n==="saved"?o:x,className:"text-gray-600 hover:text-gray-400 transition-colors",title:"Refresh",children:r.jsx(fe,{size:13,className:(n==="saved"?o:x)?"animate-spin":""})})]}),n==="saved"&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{children:u!=="idle"&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:`px-6 py-2 border-b flex items-center gap-2 text-xs font-medium ${u==="running"?"bg-orange-500/8 border-orange-500/15 text-orange-400":u==="done"?"bg-green-500/8 border-green-500/15 text-green-400":"bg-red-500/8 border-red-500/15 text-red-400"}`,children:[u==="running"&&r.jsx(re,{size:12,className:"animate-spin"}),u==="done"&&r.jsx(Fe,{size:12}),u==="error"&&r.jsx(mt,{size:12}),u==="running"?t.runningStatus:u==="done"?t.completedStatus:t.failedStatus]})}),r.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-4 space-y-3",children:o&&i.length===0?r.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-700 text-xs gap-2",children:[r.jsx(re,{size:13,className:"animate-spin"})," ",t.loading]}):i.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx(Oe,{size:36,className:"text-gray-700 mb-4"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:t.emptyTitle}),r.jsxs("p",{className:"text-xs text-gray-700 mt-1 max-w-xs",children:[t.emptyHint," ",r.jsx("span",{className:"text-orange-400 font-medium",children:t.saveAsSkill})," ",t.emptyHint2]}),r.jsxs("button",{onClick:()=>s("library"),className:"mt-4 flex items-center gap-1.5 text-[11px] text-orange-400 hover:text-orange-300 transition-colors",children:[r.jsx(Ac,{size:11})," Browse skill library"]})]}):i.map((P,V)=>{const M=c===P.id&&u==="running",B=c===P.id&&u==="done",A=f===P.id;return r.jsx(H.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:V*.04},className:`rounded-2xl border bg-[#0c0f18] transition-all ${M?"border-orange-500/30 shadow-[0_0_12px_rgba(234,88,12,0.12)]":B?"border-green-500/20":"border-white/6 hover:border-white/12"}`,children:r.jsxs("div",{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(Oe,{size:13,className:"text-orange-400 shrink-0 mt-0.5"}),r.jsx("p",{className:"text-[13px] font-bold text-white truncate",children:P.name})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-gray-600 shrink-0 font-mono",children:[r.jsx(rv,{size:9}),P.runCount,"×"]})]}),r.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed mb-2 line-clamp-2",children:P.goal}),P.steps.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[P.steps.slice(0,4).map((T,F)=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/4 text-gray-600 font-mono",children:T.tool??"step"},F)),P.steps.length>4&&r.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/4 text-gray-600 font-mono",children:["+",P.steps.length-4," more"]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-gray-700",children:[r.jsx(At,{size:9}),r.jsx("span",{children:WP(P.savedAt)}),P.lastRunAt&&r.jsxs("span",{className:"text-gray-800",children:["· ",t.lastRun," ",HP(P.lastRunAt)]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[b===P.id?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"text-[10px] text-red-400",children:t.deleteConfirm}),r.jsx("button",{onClick:()=>R(P.id),disabled:A,className:"text-[10px] px-2 py-0.5 rounded bg-red-500/15 text-red-400 hover:bg-red-500/25 transition-colors",children:A?"…":t.yes}),r.jsx("button",{onClick:()=>v(null),className:"text-[10px] px-2 py-0.5 rounded bg-white/5 text-gray-500 hover:bg-white/8",children:t.no})]}):r.jsx("button",{onClick:()=>v(P.id),className:"p-1.5 rounded-lg text-gray-700 hover:text-red-400 hover:bg-red-500/8 transition-all",title:"Delete skill",children:r.jsx(ms,{size:12})}),r.jsx("button",{onClick:()=>_(P),disabled:!!c,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold transition-all ${M?"bg-orange-500/15 text-orange-400 border border-orange-500/25 cursor-not-allowed":B?"bg-green-500/12 text-green-400 border border-green-500/20":"bg-orange-500/10 hover:bg-orange-500/20 text-orange-400 border border-orange-500/20 hover:border-orange-500/35 disabled:opacity-40 disabled:cursor-not-allowed"}`,children:M?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:11,className:"animate-spin"})," ",t.runningBtn]}):B?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:11})," ",t.doneBtn]}):r.jsxs(r.Fragment,{children:[r.jsx(Ws,{size:11})," ",t.runBtn]})})]})]})]})},P.id)})})]}),n==="library"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-2.5 border-b border-white/5 shrink-0",children:r.jsx("input",{value:j,onChange:P=>k(P.target.value),placeholder:"Search skills…",className:"w-full px-3 py-1.5 rounded-lg bg-white/4 border border-white/8 text-[11px] text-gray-300 placeholder-gray-700 outline-none focus:border-orange-500/25 transition-colors"})}),r.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-3 grid grid-cols-1 gap-2",children:x&&y.length===0?r.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-700 text-xs gap-2 col-span-1",children:[r.jsx(re,{size:13,className:"animate-spin"})," Loading skill library…"]}):L.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center col-span-1",children:[r.jsx(Ac,{size:36,className:"text-gray-700 mb-3"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:"No skills found"}),j&&r.jsx("button",{onClick:()=>k(""),className:"mt-2 text-[11px] text-orange-400 hover:text-orange-300",children:"Clear filter"})]}):L.map((P,V)=>r.jsx(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:Math.min(V*.02,.4)},children:r.jsx(KP,{skill:P})},P.id))}),y.length>0&&r.jsx("div",{className:"px-4 py-2 border-t border-white/5 shrink-0 flex items-center gap-1.5",children:r.jsxs("span",{className:"text-[10px] text-gray-700 font-mono",children:[L.length," / ",y.length," skills"]})})]})]})}const qP={html:o0,htm:o0,json:yn,js:yn,ts:yn,tsx:yn,jsx:yn};function YP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function XP(e){try{return new Date(e).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})}catch{return e}}function QP(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,t=>{let n="color:#86efac";return/^"/.test(t)&&(n=/:$/.test(t)?"color:#93c5fd":"color:#fca5a5"),/true|false/.test(t)&&(n="color:#f97316"),/null/.test(t)&&(n="color:#6b7280"),`<span style="${n}">${t}</span>`})}function JP(){const[e,t]=h.useState([]),[n,s]=h.useState(null),[i,a]=h.useState(null),[o,l]=h.useState(!1),[c,d]=h.useState(null),[u,p]=h.useState(!1),f=h.useCallback(async()=>{p(!0);try{const y=await $("/api/workspace/files");if(y.ok){const g=await y.json();t(g.files??[])}}catch{}p(!1)},[]);h.useEffect(()=>{f()},[f]);const m=async y=>{s(y),a(null),d(null),l(!0);try{const g=await $(`/api/workspace/file?p=${encodeURIComponent(y.rel)}`);if(!g.ok)throw new Error(`HTTP ${g.status}`);const x=await g.json();a(x.content+(x.truncated?`
|
|
808
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},jP="DialogDescriptionWarning",NP=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hb(jP).contentName}}.`;return h.useEffect(()=>{var a;const i=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},SP=Zv,CP=nb,EP=sb,_P=rb,TP=ab,PP=lb,X0=db;const AP={Messaging:{icon:"💬",accent:"text-blue-300",border:"border-blue-500/20",bg:"bg-blue-500/10",iconBg:"bg-blue-500/10"},Finance:{icon:"📈",accent:"text-emerald-300",border:"border-emerald-500/20",bg:"bg-emerald-500/10",iconBg:"bg-emerald-500/10"},System:{icon:"⚙️",accent:"text-orange-300",border:"border-orange-500/20",bg:"bg-orange-500/10",iconBg:"bg-orange-500/10"}};function MP(e){return AP[e]??{icon:"🔌",accent:"text-white/60",border:"border-white/10",bg:"bg-white/5",iconBg:"bg-white/5"}}function RP({name:e}){return r.jsx("span",{className:"inline-block px-2 py-0.5 rounded-md text-[10px] font-mono bg-white/5 text-white/40 border border-white/8",children:e})}function zP({pack:e,installing:t,installLog:n,onInstall:s,onConfigure:i}){const[a,o]=h.useState(!1),l=MP(e.category),c=e.extensions.length===0;return r.jsxs("div",{className:"flex flex-col bg-white/5 border border-white/8 rounded-2xl p-5 gap-3 hover:bg-white/[0.07] hover:border-white/12 transition-all duration-200",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`w-12 h-12 rounded-xl ${l.iconBg} flex items-center justify-center text-[24px] shrink-0 select-none border ${l.border}`,children:l.icon}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-white/90 font-bold text-[15px] leading-snug",children:e.name}),e.installed&&r.jsx(kr,{size:14,className:"text-emerald-400 shrink-0"})]}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:`text-[10px] font-bold uppercase tracking-widest ${l.accent}`,children:e.category}),!c&&r.jsxs("span",{className:"text-[10px] text-white/30",children:[e.extensions.length," extension",e.extensions.length!==1?"s":""]}),c&&r.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-yellow-500/10 text-yellow-400 border border-yellow-500/20 font-medium",children:"Coming Soon"})]})]})]}),r.jsx("p",{className:"text-white/45 text-[13px] leading-relaxed",children:e.description}),r.jsx("p",{className:"text-[11px] font-mono text-white/25",children:e.npmPackage}),e.extensions.length>0&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>o(d=>!d),className:"flex items-center gap-1 text-[11px] text-white/30 hover:text-white/60 transition-colors mb-2",children:[a?r.jsx(Ml,{size:12}):r.jsx(qr,{size:12}),a?"Hide":"Show"," included extensions"]}),a&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.extensions.map(d=>r.jsx(RP,{name:d},d))})]}),t&&n&&r.jsx("pre",{className:"text-[10px] text-white/40 bg-black/40 rounded-xl p-2.5 max-h-[72px] overflow-y-auto font-mono whitespace-pre-wrap break-all border border-white/6",children:n}),r.jsx("div",{className:"mt-auto pt-1",children:c?r.jsx("div",{className:"w-full py-2 rounded-xl text-[12px] font-medium text-center bg-white/4 text-white/25 border border-white/8 cursor-default select-none",children:"Not yet available"}):e.installed?r.jsx("button",{onClick:i,className:"w-full py-2 rounded-xl text-[12px] font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 hover:bg-emerald-500/15 hover:border-emerald-500/30 transition-colors",children:"Installed — Configure Keys"}):r.jsx("button",{onClick:s,disabled:t,className:`w-full flex items-center justify-center gap-2 py-2 rounded-xl text-[12px] font-semibold ${l.bg} ${l.accent} border ${l.border} hover:brightness-125 disabled:opacity-50 disabled:cursor-not-allowed transition-all`,children:t?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:13,className:"animate-spin shrink-0"}),r.jsx("span",{children:"Installing…"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Hs,{size:13,className:"shrink-0"}),r.jsx("span",{children:"Install Pack"})]})})})]})}function LP({pack:e,onClose:t}){const[n,s]=h.useState({}),[i,a]=h.useState(!1);h.useEffect(()=>{e&&s({})},[e]);const o=async()=>{if(e){a(!0);try{if(!(await $("/api/store/configure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:n})})).ok)throw new Error("Configure request failed");de.success(`${e.name} configured — keys saved to .env`),t()}catch(c){de.error(c instanceof Error?c.message:"Configure failed")}finally{a(!1)}}},l={};for(const c of(e==null?void 0:e.requiredKeys)??[]){const d=c.forExtension??"general";(l[d]??(l[d]=[])).push(c)}return r.jsx(SP,{open:!!e,onOpenChange:c=>{c||t()},children:r.jsxs(CP,{children:[r.jsx(EP,{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm"}),r.jsxs(_P,{className:"fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-[460px] mx-4 bg-[#0d0f14] border border-white/10 rounded-2xl p-6 shadow-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsxs(TP,{className:"text-white/90 font-semibold text-[15px]",children:["Configure ",e==null?void 0:e.name]}),r.jsx(X0,{className:"w-7 h-7 flex items-center justify-center rounded-lg text-white/30 hover:text-white/70 hover:bg-white/6 transition-colors",children:r.jsx(He,{size:15})})]}),r.jsxs(PP,{className:"text-white/40 text-[12px] mb-5 leading-relaxed",children:["Fill in the keys for the extensions you want to use. Leave others blank — they can be added later. Keys are saved to your local"," ",r.jsx("code",{className:"font-mono text-white/60 bg-white/8 px-1 rounded",children:".env"})," file."]}),r.jsx("div",{className:"space-y-5",children:Object.entries(l).map(([c,d])=>r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-white/30 mb-2.5",children:c}),r.jsx("div",{className:"space-y-3",children:d.map(u=>r.jsxs("div",{children:[r.jsx("label",{className:"block text-[12px] font-medium text-white/70 mb-1",children:u.label}),u.hint&&r.jsx("p",{className:"text-[11px] text-white/35 mb-1.5",children:u.hint}),r.jsx("input",{type:"password",autoComplete:"off",value:n[u.env]??"",onChange:p=>s(f=>({...f,[u.env]:p.target.value})),className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2.5 text-sm text-white/80 placeholder-white/20 focus:outline-none focus:border-orange-500/40 focus:bg-white/[0.07] transition-colors font-mono",placeholder:`Enter ${u.label}`})]},u.env))})]},c))}),r.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[r.jsxs("button",{onClick:o,disabled:i,className:"flex-1 flex items-center justify-center gap-2 bg-orange-500/20 hover:bg-orange-500/30 border border-orange-500/30 hover:border-orange-500/50 disabled:opacity-60 text-orange-300 rounded-xl py-2.5 text-[13px] font-semibold transition-all active:scale-[0.97]",children:[i?r.jsx(re,{size:14,className:"animate-spin"}):r.jsx(kr,{size:14}),"Save & Activate"]}),r.jsx(X0,{className:"px-4 py-2.5 text-[13px] text-white/35 hover:text-white/60 transition-colors rounded-xl hover:bg-white/5",children:"Skip"})]})]})]})})}const OP=12e4;function DP(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[i,a]=h.useState(null),[o,l]=h.useState({}),[c,d]=h.useState(null),u=h.useRef(null),p=h.useCallback(async()=>{s(!0);try{const b=await $("/api/store/extensions");b.ok&&t(await b.json())}catch{}finally{s(!1)}},[]);h.useEffect(()=>{p()},[p]);const f=h.useCallback(async b=>{var g;(g=u.current)==null||g.abort();const y=new AbortController;u.current=y,a(b.id),l(x=>({...x,[b.id]:""}));const v=setTimeout(()=>{y.abort()},OP);try{const x=await $("/api/store/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:b.id}),signal:y.signal},{retries:1,retryDelay:0});if(!x.body)throw new Error("No response stream");const w=x.body.getReader(),j=new TextDecoder;let k="";for(;;){const{done:N,value:S}=await w.read();if(N)break;const _=j.decode(S,{stream:!0});k+=_,l(R=>({...R,[b.id]:k}))}k.includes("__MUSTB_INSTALL_OK__")?(de.success(`${b.name} installed!`),t(N=>N.map(S=>S.id===b.id?{...S,installed:!0}:S)),b.requiredKeys.length>0&&d(b)):k.includes("__MUSTB_INSTALL_FAILED__")?de.error(`${b.name} installation failed — check the log above.`):de.error(`${b.name} installation failed.`)}catch(x){x.name==="AbortError"?de.error(`Install timed out — is ${b.npmPackage} published to npm?`):de.error(x instanceof Error?x.message:"Install failed")}finally{clearTimeout(v),a(null)}},[]),m=e.filter(b=>b.installed).length;return r.jsxs("div",{className:"min-h-screen bg-transparent pt-4 pb-10 px-4 sm:px-6 max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-2xl bg-orange-500/10 border border-orange-500/20 flex items-center justify-center shrink-0",children:r.jsx(gv,{size:18,className:"text-orange-400"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-[22px] font-black text-white/95 leading-none",children:"Extension Store"}),m>0&&r.jsxs("span",{className:"text-[11px] text-emerald-400/80 font-medium",children:[m," pack",m!==1?"s":""," installed"]})]})]}),r.jsxs("p",{className:"text-white/40 text-[13px] leading-relaxed max-w-2xl mt-1",children:["Extensions are grouped into themed packs."," ","Install one pack to get all its integrations — fetched directly from npm into"," ",r.jsx("code",{className:"font-mono text-white/60 bg-white/5 px-1.5 py-0.5 rounded text-[11px] border border-white/8",children:"~/.must-b/extensions/"})]})]}),r.jsx("button",{onClick:p,title:"Refresh",className:"p-2.5 rounded-xl text-white/30 hover:text-white/70 hover:bg-white/6 border border-white/8 transition-all shrink-0",children:r.jsx(fe,{size:15})})]}),r.jsxs("div",{className:"mb-8 px-3 py-2.5 rounded-xl bg-white/5 border border-white/8 flex items-center gap-3",children:[r.jsx("code",{className:"text-[11px] font-mono text-white/30 shrink-0",children:"CLI:"}),r.jsxs("code",{className:"text-[12px] font-mono text-white/50",children:[r.jsx("span",{className:"text-orange-400",children:"must-b ext list"})," · ",r.jsx("span",{className:"text-orange-400",children:"must-b ext install channels"})," · ",r.jsx("span",{className:"text-orange-400",children:"must-b ext install system"})]})]}),n?r.jsxs("div",{className:"flex flex-col items-center justify-center py-24 gap-3",children:[r.jsx(re,{size:22,className:"animate-spin text-orange-400"}),r.jsx("p",{className:"text-white/35 text-[13px]",children:"Loading extension store…"})]}):e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-24 gap-3",children:[r.jsx(Hs,{size:28,className:"text-white/20"}),r.jsx("p",{className:"text-white/35 text-[13px]",children:"No packs available — backend may not be running."}),r.jsx("button",{onClick:p,className:"mt-1 px-4 py-2 rounded-xl bg-orange-500/10 border border-orange-500/20 text-orange-400 text-[12px] font-medium hover:bg-orange-500/20 transition-colors",children:"Retry"})]}):r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-5",children:e.map(b=>r.jsx(zP,{pack:b,installing:i===b.id,installLog:o[b.id]??"",onInstall:()=>f(b),onConfigure:()=>d(b)},b.id))}),r.jsxs("p",{className:"text-center text-white/20 text-[11px] mt-12",children:["Packs are built with"," ",r.jsx("code",{className:"font-mono bg-white/5 px-1 rounded border border-white/8",children:"npm run build:packs"})," ","and published to npm. Run"," ",r.jsx("code",{className:"font-mono bg-white/5 px-1 rounded border border-white/8",children:"must-b ext list"})," ","for the CLI interface."]}),r.jsx(LP,{pack:c,onClose:()=>d(null)})]})}function Q0(e){return e>=90?"#ef4444":e>=70?"#f97316":"#22c55e"}function ci(e){return e==="critical"?"#ef4444":e==="warning"?"#f97316":"#60a5fa"}function IP(){const{t:e,locale:t}=gt(),n=e.systemHealth,[s,i]=h.useState(null),[a,o]=h.useState(null),[l,c]=h.useState(!1),d=h.useCallback(()=>o(null),[]);h.useEffect(()=>{window.dispatchEvent(new CustomEvent("mustb:safeMode",{detail:{active:(s==null?void 0:s.safeMode)??!1}}))},[s==null?void 0:s.safeMode]),h.useEffect(()=>{const f=Be();return f.on("systemStats",m=>i(m)),f.on("systemHealth",m=>{if(o(m),c(!0),m.level!=="critical"){const b=m.level==="info"?6e3:12e3;setTimeout(()=>o(null),b)}}),()=>{f.off("systemStats"),f.off("systemHealth")}},[]);const u=(s==null?void 0:s.cpu)??0,p=(s==null?void 0:s.ram)??0;return r.jsxs("div",{className:"relative flex items-center",children:[r.jsxs("button",{onClick:()=>a&&c(f=>!f),className:"flex items-center gap-1.5 select-none transition-all rounded-md",style:{cursor:a?"pointer":"default"},title:a?a.message:n.title,children:[a?r.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0 animate-pulse",style:{background:ci(a.level)}}):r.jsx(fn,{size:12,className:"text-orange-400/70"}),s&&r.jsxs("span",{className:"hidden sm:flex items-center gap-1.5",children:[r.jsx("span",{className:"text-[10px] font-semibold text-white/45",children:"CPU"}),r.jsx("span",{className:"w-9 h-1 rounded-full bg-white/10 overflow-hidden flex-shrink-0",children:r.jsx("span",{className:"h-full rounded-full block transition-all duration-700",style:{width:`${u}%`,background:Q0(u)}})}),r.jsxs("span",{className:"text-[9px] font-mono text-white/40 w-6 text-right",children:[u,"%"]}),r.jsx("span",{className:"w-px h-3 bg-white/10"}),r.jsx("span",{className:"text-[10px] font-semibold text-white/45",children:"RAM"}),r.jsx("span",{className:"w-9 h-1 rounded-full bg-white/10 overflow-hidden flex-shrink-0",children:r.jsx("span",{className:"h-full rounded-full block transition-all duration-700",style:{width:`${p}%`,background:Q0(p)}})}),r.jsxs("span",{className:"text-[9px] font-mono text-white/40 w-6 text-right",children:[p,"%"]}),s.liteMode&&!s.safeMode&&r.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded bg-orange-500/20 text-orange-400 ml-0.5",children:n.lite}),s.safeMode&&r.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded bg-red-500/20 text-red-400 ml-0.5",children:n.safe})]}),!s&&r.jsx("span",{className:"text-[10px] font-semibold hidden sm:inline text-white/35",children:n.title})]}),r.jsx(ne,{children:l&&a&&r.jsxs(H.div,{initial:{opacity:0,y:8,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.96},transition:{duration:.2,ease:"easeOut"},className:"absolute top-full right-0 mt-2 w-72 z-[200] rounded-2xl overflow-hidden",style:{background:"rgba(20,8,2,0.88)",border:`1px solid ${ci(a.level)}44`,backdropFilter:"blur(20px)",boxShadow:`0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px ${ci(a.level)}22`},children:[r.jsxs("div",{className:"flex items-start justify-between px-4 pt-3 pb-2",style:{borderBottom:`1px solid ${ci(a.level)}22`},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ls,{size:13,style:{color:ci(a.level)}}),r.jsxs("span",{className:"text-[12px] font-bold text-white/90 capitalize",children:[n[a.level]??a.level," — ",n.kinds[a.kind]??a.kind]})]}),r.jsx("button",{onClick:d,className:"text-white/30 hover:text-white/70 transition-colors",children:r.jsx(He,{size:13})})]}),r.jsxs("div",{className:"px-4 py-3 space-y-2",children:[r.jsx("p",{className:"text-[13px] text-white/80 leading-relaxed",children:n.alerts[a.kind]??a.message}),r.jsx("p",{className:"text-[11px] text-white/45 leading-relaxed italic",children:n.recommendations[a.kind]??a.recommendation})]}),r.jsx("div",{className:"px-4 pb-3",children:r.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:new Date(a.ts).toLocaleTimeString()})})]},"health-popover")})]})}function BP(e){return`${Math.round(e*100)}%`}const J0={skill:{label:"Skill",icon:Oe,color:"text-orange-400"},conversation:{label:"Conversation",icon:Is,color:"text-blue-400"},workspace:{label:"Workspace",icon:An,color:"text-green-400"},custom:{label:"Custom",icon:en,color:"text-gray-400"}};function FP(){const{t:e}=gt(),t=e.panels.memory,[n,s]=h.useState(""),[i,a]=h.useState([]),[o,l]=h.useState(null),[c,d]=h.useState(!1),[u,p]=h.useState(null),[f,m]=h.useState(null),[b,y]=h.useState(!1),v=h.useRef(null),g=h.useCallback(async k=>{const N=k.trim();if(N){d(!0),a([]);try{const S=await $(`/api/memory/search?q=${encodeURIComponent(N)}&limit=10`);if(S.ok){const _=await S.json();a(_.results??[])}}catch{}d(!1)}},[]),x=k=>{k.key==="Enter"&&g(n)},w=h.useCallback(async()=>{try{const k=await $("/api/memory/stats");k.ok&&l(await k.json())}catch{}},[]),j=async k=>{p(k),m(null);try{const N=k==="clear"?await $("/api/memory/clear-index",{method:"DELETE"}):await $(`/api/memory/index-${k}`,{method:"POST"});if(N.ok){const S=await N.json(),_=k==="clear"?t.indexCleared:`${t.indexed} ${S.indexed??0} ${k==="skills"?t.skills:t.files}`;m({ok:!0,msg:_}),w(),k==="clear"&&a([])}else m({ok:!1,msg:t.opFailed})}catch{m({ok:!1,msg:t.reqError})}p(null),setTimeout(()=>m(null),4e3)};return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-[13px] font-bold text-gray-300",children:t.title}),o&&r.jsxs("span",{className:"text-[10px] text-gray-600 bg-white/5 px-2 py-0.5 rounded-full font-mono",children:[o.items.toLocaleString()," ",t.vectors]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>{y(k=>!k),o||w()},className:`text-gray-600 hover:text-gray-400 transition-colors ${b?"text-orange-400":""}`,title:t.indexControls,children:r.jsx(OC,{size:13})}),r.jsx("button",{onClick:w,className:"text-gray-600 hover:text-gray-400 transition-colors",title:t.refreshStats,children:r.jsx(fe,{size:13})})]})]}),r.jsx(ne,{children:b&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"border-b border-white/5 bg-white/2 overflow-hidden shrink-0",children:[r.jsxs("div",{className:"px-6 py-3 flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 uppercase tracking-widest font-bold shrink-0",children:t.indexLabel}),["skills","workspace"].map(k=>r.jsxs("button",{onClick:()=>j(k),disabled:u!==null,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-white/4 border border-white/6 text-[11px] text-gray-400 hover:text-gray-200 hover:bg-white/8 transition-all disabled:opacity-40 capitalize",children:[u===k?r.jsx(re,{size:10,className:"animate-spin"}):k==="skills"?r.jsx(Oe,{size:10}):r.jsx(An,{size:10}),k]},k)),r.jsxs("button",{onClick:()=>j("clear"),disabled:u!==null,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-red-500/8 border border-red-500/15 text-[11px] text-red-400 hover:bg-red-500/15 transition-all disabled:opacity-40 ml-auto",children:[u==="clear"?r.jsx(re,{size:10,className:"animate-spin"}):r.jsx(ms,{size:10}),t.clearIndex]})]}),r.jsx(ne,{children:f&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`flex items-center gap-1.5 px-6 pb-3 text-[11px] font-medium ${f.ok?"text-green-400":"text-red-400"}`,children:[f.ok?r.jsx(Fe,{size:11}):r.jsx(mt,{size:11}),f.msg]})})]})}),r.jsxs("div",{className:"px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/4 border border-white/8 focus-within:border-orange-500/30 transition-colors",children:[r.jsx(Zt,{size:13,className:"text-gray-600 shrink-0"}),r.jsx("input",{ref:v,value:n,onChange:k=>s(k.target.value),onKeyDown:x,placeholder:t.searchPlaceholder,className:"flex-1 bg-transparent text-[13px] text-gray-200 outline-none placeholder-gray-700"}),c?r.jsx(re,{size:13,className:"text-orange-400 animate-spin shrink-0"}):r.jsx("button",{onClick:()=>g(n),disabled:!n.trim(),className:"text-[10px] px-2 py-0.5 rounded-lg bg-orange-500/12 text-orange-400 font-semibold hover:bg-orange-500/22 border border-orange-500/20 transition-all disabled:opacity-30",children:"⌘↵"})]}),r.jsx("p",{className:"text-[10px] text-gray-700 mt-1.5 ml-1",children:t.searchHint})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-4 space-y-3",children:[i.length===0&&!c&&r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx(Xt,{size:36,className:"text-gray-700 mb-4"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:n.trim()?t.emptyNoResults:t.emptyTitle}),r.jsx("p",{className:"text-xs text-gray-700 mt-1 max-w-xs leading-relaxed",children:n.trim()?t.emptyNoResultsHint:t.emptyHint})]}),i.map((k,N)=>{const S=J0[k.metadata.source]??J0.custom,_=S.icon;return r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:N*.04},className:"rounded-2xl border border-white/6 bg-[#0c0f18] p-4 hover:border-white/12 transition-all",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(_,{size:11,className:`${S.color} shrink-0`}),r.jsx("p",{className:"text-[12px] font-semibold text-gray-300 truncate",children:k.metadata.title})]}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx("span",{className:`text-[9px] font-bold px-1.5 py-0.5 rounded-full border ${k.score>=.85?"bg-green-500/10 border-green-500/20 text-green-400":k.score>=.65?"bg-orange-500/10 border-orange-500/20 text-orange-400":"bg-white/4 border-white/6 text-gray-500"}`,children:BP(k.score)}),r.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-white/4 border border-white/6 font-medium ${S.color}`,children:S.label})]})]}),r.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed line-clamp-3 mb-2",children:k.text}),k.metadata.tags&&k.metadata.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:k.metadata.tags.map((R,L)=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/4 text-gray-600 font-mono",children:R},L))}),r.jsx("div",{className:"mt-2 h-0.5 bg-white/4 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-orange-600 to-amber-400",style:{width:`${k.score*100}%`}})})]},N)})]})]})}const VP={node:Jt,python:yn},$P={node:"text-green-400",python:"text-blue-400"};function UP(){const{t:e}=gt(),t=e.panels.plugins,[n,s]=h.useState([]),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(!1),[f,m]=h.useState(""),[b,y]=h.useState(""),[v,g]=h.useState("node"),[x,w]=h.useState(""),[j,k]=h.useState(!1),N=(L,P)=>{d({ok:L,msg:P}),setTimeout(()=>d(null),4e3)},S=h.useCallback(async()=>{a(!0);try{const L=await $("/api/plugins/list");if(L.ok){const P=await L.json();s(P.plugins??[])}}catch{}a(!1)},[]);h.useEffect(()=>{S()},[S]);const _=async(L,P)=>{l(L);try{(await $(P?"/api/plugins/stop":"/api/plugins/run",{method:"POST",body:JSON.stringify({name:L})})).ok?(N(!0,P?`${L} stopped`:`${L} launched`),await S()):N(!1,t.opFailed)}catch{N(!1,t.reqError)}l(null)},R=async()=>{if(!(!f.trim()||!b.trim())){k(!0);try{(await $("/api/plugins/build",{method:"POST",body:JSON.stringify({name:f.trim(),goal:b.trim(),lang:v,context:x.trim()||void 0})})).ok?(N(!0,`Plugin "${f}" created`),m(""),y(""),w(""),p(!1),await S()):N(!1,t.buildFailed)}catch{N(!1,t.reqError)}k(!1)}};return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Fr,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-[13px] font-bold text-gray-300",children:t.title}),r.jsxs("span",{className:"text-[10px] text-gray-600 bg-white/5 px-2 py-0.5 rounded-full font-mono",children:[n.length," ",t.installed]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:S,className:"text-gray-600 hover:text-gray-400 transition-colors",title:t.refresh,children:r.jsx(fe,{size:13,className:i?"animate-spin":""})}),r.jsxs("button",{onClick:()=>p(L=>!L),className:`flex items-center gap-1 text-[10px] px-2.5 py-1 rounded-lg border font-semibold transition-all ${u?"bg-orange-500/15 border-orange-500/25 text-orange-400":"bg-white/4 border-white/8 text-gray-500 hover:text-gray-300"}`,children:[r.jsx(zl,{size:10}),t.newPlugin]})]})]}),r.jsx(ne,{children:c&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`flex items-center gap-1.5 px-6 py-2 text-[11px] font-medium shrink-0 ${c.ok?"text-green-400":"text-red-400"}`,children:[c.ok?r.jsx(Fe,{size:11}):r.jsx(mt,{size:11}),c.msg]})}),r.jsx(ne,{children:u&&r.jsx(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"border-b border-white/5 bg-white/2 overflow-hidden shrink-0",children:r.jsxs("div",{className:"px-6 py-4 space-y-3",children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:t.buildTitle}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx("input",{value:f,onChange:L=>m(L.target.value),placeholder:t.namePlaceholder,className:"col-span-2 px-3 py-2 rounded-lg bg-white/4 border border-white/8 text-[12px] text-gray-200 outline-none placeholder-gray-700 focus:border-orange-500/30 transition-colors"}),r.jsx("input",{value:b,onChange:L=>y(L.target.value),placeholder:t.goalPlaceholder,className:"col-span-2 px-3 py-2 rounded-lg bg-white/4 border border-white/8 text-[12px] text-gray-200 outline-none placeholder-gray-700 focus:border-orange-500/30 transition-colors"}),r.jsx("input",{value:x,onChange:L=>w(L.target.value),placeholder:t.contextPlaceholder,className:"col-span-2 px-3 py-2 rounded-lg bg-white/4 border border-white/8 text-[12px] text-gray-200 outline-none placeholder-gray-700 focus:border-orange-500/30 transition-colors"}),r.jsx("div",{className:"flex gap-2",children:["node","python"].map(L=>r.jsx("button",{onClick:()=>g(L),className:`flex-1 py-1.5 rounded-lg border text-[11px] font-semibold transition-all capitalize ${v===L?"bg-orange-500/15 border-orange-500/25 text-orange-400":"bg-white/4 border-white/8 text-gray-500"}`,children:L},L))}),r.jsxs("button",{onClick:R,disabled:j||!f.trim()||!b.trim(),className:"flex items-center justify-center gap-1.5 py-2 rounded-lg bg-orange-500/12 border border-orange-500/20 text-orange-400 text-[11px] font-bold hover:bg-orange-500/20 transition-all disabled:opacity-40",children:[j?r.jsx(re,{size:11,className:"animate-spin"}):r.jsx(Oe,{size:11}),t.generatePlugin]})]})]})})}),r.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-4 space-y-2",children:[n.length===0&&!i&&r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx(Fr,{size:36,className:"text-gray-700 mb-4"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:t.emptyTitle}),r.jsx("p",{className:"text-xs text-gray-700 mt-1",children:t.emptyHint})]}),n.map((L,P)=>{const V=VP[L.lang]??Jt,M=o===L.name;return r.jsxs(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:P*.04},className:`flex items-center gap-3 p-3 rounded-2xl border transition-all ${L.running?"bg-green-500/5 border-green-500/15 hover:border-green-500/25":"bg-[#0c0f18] border-white/6 hover:border-white/12"}`,children:[r.jsx(V,{size:13,className:$P[L.lang]??"text-gray-400"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[12px] font-semibold text-gray-300 truncate",children:L.name}),r.jsx("p",{className:"text-[10px] text-gray-600 font-mono",children:L.filename})]}),L.running&&r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-green-500/12 border border-green-500/20 text-green-400 font-bold",children:t.running}),r.jsxs("button",{disabled:M,onClick:()=>_(L.name,L.running),className:`flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-[10px] font-bold transition-all disabled:opacity-40 ${L.running?"bg-red-500/8 border-red-500/15 text-red-400 hover:bg-red-500/15":"bg-green-500/8 border-green-500/15 text-green-400 hover:bg-green-500/15"}`,children:[M?r.jsx(re,{size:10,className:"animate-spin"}):L.running?r.jsx(cf,{size:10}):r.jsx(Ws,{size:10}),L.running?t.stop:t.run]})]},L.name)})]})]})}function HP(e){if(!e)return"Never";try{return new Date(e).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})}catch{return e}}function WP(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function KP({skill:e}){const[t,n]=h.useState(!1),[s,i]=h.useState(!1),[a,o]=h.useState(""),[l,c]=h.useState(!1),d=async()=>{if(!l){c(!0);return}if(a.trim()){n(!0);try{await $("/api/v1/skills/invoke",{method:"POST",body:JSON.stringify({skill:e.id,params:{goal:a.trim(),_autoRun:!0}})}),i(!0),c(!1),o(""),setTimeout(()=>i(!1),3e3)}catch{}n(!1)}},u=(e.requires.bins??[]).length>0,p=(e.requires.config??[]).length>0;return r.jsx(H.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"rounded-2xl border border-white/6 bg-[#0c0f18] hover:border-white/12 transition-all",children:r.jsxs("div",{className:"p-3",children:[r.jsxs("div",{className:"flex items-start gap-2 mb-1.5",children:[r.jsx("span",{className:"text-base leading-none mt-0.5 shrink-0",children:e.emoji??"⚡"}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"text-[12px] font-bold text-gray-200 truncate capitalize",children:e.name})}),e.hasScripts&&r.jsx(os,{size:10,className:"text-gray-700 shrink-0 mt-0.5"})]}),r.jsx("p",{className:"text-[10px] text-gray-500 leading-relaxed line-clamp-2 mb-2 ml-6",children:e.description}),(u||p)&&r.jsxs("div",{className:"flex flex-wrap gap-1 mb-2 ml-6",children:[(e.requires.bins??[]).map(f=>r.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-blue-500/8 border border-blue-500/15 text-blue-400 font-mono",children:["bin:",f]},f)),(e.requires.config??[]).map(f=>r.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-purple-500/8 border border-purple-500/15 text-purple-400 font-mono",children:["cfg:",f]},f))]}),r.jsx(ne,{children:l&&r.jsx(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden mb-2",children:r.jsx("input",{autoFocus:!0,value:a,onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&d(),f.key==="Escape"&&(c(!1),o(""))},placeholder:`Goal for ${e.name}…`,className:"w-full px-2.5 py-1.5 rounded-lg bg-white/4 border border-white/10 text-[11px] text-gray-200 placeholder-gray-700 outline-none focus:border-orange-500/30 transition-colors"})})}),r.jsxs("div",{className:"flex items-center justify-end gap-1 ml-6",children:[l&&r.jsx("button",{onClick:()=>{c(!1),o("")},className:"text-[10px] px-2 py-1 rounded-lg bg-white/4 text-gray-600 hover:text-gray-400 transition-colors",children:"Cancel"}),r.jsx("button",{onClick:d,disabled:t||l&&!a.trim(),className:`flex items-center gap-1 px-2.5 py-1 rounded-lg text-[10px] font-semibold border transition-all disabled:opacity-40 ${s?"bg-green-500/10 border-green-500/20 text-green-400":"bg-orange-500/8 border-orange-500/15 text-orange-400 hover:bg-orange-500/15"}`,children:t?r.jsx(re,{size:9,className:"animate-spin"}):s?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:9})," Sent"]}):l?r.jsxs(r.Fragment,{children:[r.jsx(Qt,{size:9})," Run"]}):r.jsxs(r.Fragment,{children:[r.jsx(zC,{size:9})," Use"]})})]})]})})}function GP(){const{t:e}=gt(),t=e.panels.skills,[n,s]=h.useState("saved"),[i,a]=h.useState([]),[o,l]=h.useState(!1),[c,d]=h.useState(null),[u,p]=h.useState("idle"),[f,m]=h.useState(null),[b,y]=h.useState(null),[v,g]=h.useState([]),[x,w]=h.useState(!1),[j,k]=h.useState(""),N=h.useCallback(async()=>{l(!0);try{const P=await $("/api/skills/list");if(P.ok){const V=await P.json();a(V.skills??[])}}catch{}l(!1)},[]),S=h.useCallback(async()=>{w(!0);try{const P=await $("/api/skills/catalog");if(P.ok){const V=await P.json();g(V.skills??[])}}catch{}w(!1)},[]);h.useEffect(()=>{N()},[N]),h.useEffect(()=>{n==="library"&&v.length===0&&S()},[n,v.length,S]),h.useEffect(()=>{const P=Be(),V=M=>{M.type==="skillRunStart"&&M.skillId&&(d(M.skillId),p("running")),M.type==="planFinish"&&(p("done"),d(null),N(),setTimeout(()=>p("idle"),2500))};return P.on("agentUpdate",V),()=>{P.off("agentUpdate",V)}},[N]);const _=async P=>{if(!c){d(P.id),p("running");try{const V=await $("/api/skills/run",{method:"POST",body:JSON.stringify({id:P.id})});if(!V.ok)throw new Error(`HTTP ${V.status}`)}catch{p("error"),d(null),setTimeout(()=>p("idle"),3e3)}}},R=async P=>{m(P);try{await $(`/api/skills/${P}`,{method:"DELETE"}),a(V=>V.filter(M=>M.id!==P))}catch{}m(null),y(null)},L=j.trim()?v.filter(P=>P.name.toLowerCase().includes(j.toLowerCase())||P.description.toLowerCase().includes(j.toLowerCase())):v;return r.jsxs("div",{className:"h-full flex flex-col overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-white/5 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Al,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-[13px] font-bold text-gray-300",children:t.title})]}),r.jsxs("div",{className:"flex items-center gap-1 bg-white/4 rounded-lg p-0.5",children:[r.jsxs("button",{onClick:()=>s("saved"),className:`flex items-center gap-1 px-2.5 py-1 rounded-md text-[10px] font-semibold transition-all ${n==="saved"?"bg-orange-500/15 text-orange-400":"text-gray-600 hover:text-gray-400"}`,children:[r.jsx(Oe,{size:9}),"Saved",i.length>0&&r.jsx("span",{className:"text-[9px] font-mono text-gray-600",children:i.length})]}),r.jsxs("button",{onClick:()=>s("library"),className:`flex items-center gap-1 px-2.5 py-1 rounded-md text-[10px] font-semibold transition-all ${n==="library"?"bg-orange-500/15 text-orange-400":"text-gray-600 hover:text-gray-400"}`,children:[r.jsx(Ac,{size:9}),"Library",v.length>0&&r.jsx("span",{className:"text-[9px] font-mono text-gray-600",children:v.length})]})]}),r.jsx("button",{onClick:n==="saved"?N:S,disabled:n==="saved"?o:x,className:"text-gray-600 hover:text-gray-400 transition-colors",title:"Refresh",children:r.jsx(fe,{size:13,className:(n==="saved"?o:x)?"animate-spin":""})})]}),n==="saved"&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{children:u!=="idle"&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:`px-6 py-2 border-b flex items-center gap-2 text-xs font-medium ${u==="running"?"bg-orange-500/8 border-orange-500/15 text-orange-400":u==="done"?"bg-green-500/8 border-green-500/15 text-green-400":"bg-red-500/8 border-red-500/15 text-red-400"}`,children:[u==="running"&&r.jsx(re,{size:12,className:"animate-spin"}),u==="done"&&r.jsx(Fe,{size:12}),u==="error"&&r.jsx(mt,{size:12}),u==="running"?t.runningStatus:u==="done"?t.completedStatus:t.failedStatus]})}),r.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-4 space-y-3",children:o&&i.length===0?r.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-700 text-xs gap-2",children:[r.jsx(re,{size:13,className:"animate-spin"})," ",t.loading]}):i.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx(Oe,{size:36,className:"text-gray-700 mb-4"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:t.emptyTitle}),r.jsxs("p",{className:"text-xs text-gray-700 mt-1 max-w-xs",children:[t.emptyHint," ",r.jsx("span",{className:"text-orange-400 font-medium",children:t.saveAsSkill})," ",t.emptyHint2]}),r.jsxs("button",{onClick:()=>s("library"),className:"mt-4 flex items-center gap-1.5 text-[11px] text-orange-400 hover:text-orange-300 transition-colors",children:[r.jsx(Ac,{size:11})," Browse skill library"]})]}):i.map((P,V)=>{const M=c===P.id&&u==="running",B=c===P.id&&u==="done",A=f===P.id;return r.jsx(H.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:V*.04},className:`rounded-2xl border bg-[#0c0f18] transition-all ${M?"border-orange-500/30 shadow-[0_0_12px_rgba(234,88,12,0.12)]":B?"border-green-500/20":"border-white/6 hover:border-white/12"}`,children:r.jsxs("div",{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(Oe,{size:13,className:"text-orange-400 shrink-0 mt-0.5"}),r.jsx("p",{className:"text-[13px] font-bold text-white truncate",children:P.name})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-gray-600 shrink-0 font-mono",children:[r.jsx(rv,{size:9}),P.runCount,"×"]})]}),r.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed mb-2 line-clamp-2",children:P.goal}),P.steps.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[P.steps.slice(0,4).map((T,F)=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/4 text-gray-600 font-mono",children:T.tool??"step"},F)),P.steps.length>4&&r.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded-md bg-white/4 text-gray-600 font-mono",children:["+",P.steps.length-4," more"]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-gray-700",children:[r.jsx(At,{size:9}),r.jsx("span",{children:WP(P.savedAt)}),P.lastRunAt&&r.jsxs("span",{className:"text-gray-800",children:["· ",t.lastRun," ",HP(P.lastRunAt)]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[b===P.id?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"text-[10px] text-red-400",children:t.deleteConfirm}),r.jsx("button",{onClick:()=>R(P.id),disabled:A,className:"text-[10px] px-2 py-0.5 rounded bg-red-500/15 text-red-400 hover:bg-red-500/25 transition-colors",children:A?"…":t.yes}),r.jsx("button",{onClick:()=>y(null),className:"text-[10px] px-2 py-0.5 rounded bg-white/5 text-gray-500 hover:bg-white/8",children:t.no})]}):r.jsx("button",{onClick:()=>y(P.id),className:"p-1.5 rounded-lg text-gray-700 hover:text-red-400 hover:bg-red-500/8 transition-all",title:"Delete skill",children:r.jsx(ms,{size:12})}),r.jsx("button",{onClick:()=>_(P),disabled:!!c,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-semibold transition-all ${M?"bg-orange-500/15 text-orange-400 border border-orange-500/25 cursor-not-allowed":B?"bg-green-500/12 text-green-400 border border-green-500/20":"bg-orange-500/10 hover:bg-orange-500/20 text-orange-400 border border-orange-500/20 hover:border-orange-500/35 disabled:opacity-40 disabled:cursor-not-allowed"}`,children:M?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:11,className:"animate-spin"})," ",t.runningBtn]}):B?r.jsxs(r.Fragment,{children:[r.jsx(Fe,{size:11})," ",t.doneBtn]}):r.jsxs(r.Fragment,{children:[r.jsx(Ws,{size:11})," ",t.runBtn]})})]})]})]})},P.id)})})]}),n==="library"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-4 py-2.5 border-b border-white/5 shrink-0",children:r.jsx("input",{value:j,onChange:P=>k(P.target.value),placeholder:"Search skills…",className:"w-full px-3 py-1.5 rounded-lg bg-white/4 border border-white/8 text-[11px] text-gray-300 placeholder-gray-700 outline-none focus:border-orange-500/25 transition-colors"})}),r.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide p-3 grid grid-cols-1 gap-2",children:x&&v.length===0?r.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-700 text-xs gap-2 col-span-1",children:[r.jsx(re,{size:13,className:"animate-spin"})," Loading skill library…"]}):L.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center col-span-1",children:[r.jsx(Ac,{size:36,className:"text-gray-700 mb-3"}),r.jsx("p",{className:"text-sm font-semibold text-gray-500",children:"No skills found"}),j&&r.jsx("button",{onClick:()=>k(""),className:"mt-2 text-[11px] text-orange-400 hover:text-orange-300",children:"Clear filter"})]}):L.map((P,V)=>r.jsx(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:Math.min(V*.02,.4)},children:r.jsx(KP,{skill:P})},P.id))}),v.length>0&&r.jsx("div",{className:"px-4 py-2 border-t border-white/5 shrink-0 flex items-center gap-1.5",children:r.jsxs("span",{className:"text-[10px] text-gray-700 font-mono",children:[L.length," / ",v.length," skills"]})})]})]})}const qP={html:o0,htm:o0,json:yn,js:yn,ts:yn,tsx:yn,jsx:yn};function YP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function XP(e){try{return new Date(e).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})}catch{return e}}function QP(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,t=>{let n="color:#86efac";return/^"/.test(t)&&(n=/:$/.test(t)?"color:#93c5fd":"color:#fca5a5"),/true|false/.test(t)&&(n="color:#f97316"),/null/.test(t)&&(n="color:#6b7280"),`<span style="${n}">${t}</span>`})}function JP(){const[e,t]=h.useState([]),[n,s]=h.useState(null),[i,a]=h.useState(null),[o,l]=h.useState(!1),[c,d]=h.useState(null),[u,p]=h.useState(!1),f=h.useCallback(async()=>{p(!0);try{const v=await $("/api/workspace/files");if(v.ok){const g=await v.json();t(g.files??[])}}catch{}p(!1)},[]);h.useEffect(()=>{f()},[f]);const m=async v=>{s(v),a(null),d(null),l(!0);try{const g=await $(`/api/workspace/file?p=${encodeURIComponent(v.rel)}`);if(!g.ok)throw new Error(`HTTP ${g.status}`);const x=await g.json();a(x.content+(x.truncated?`
|
|
809
809
|
|
|
810
|
-
[… file truncated at 1.5 MB …]`:""))}catch(g){d(g instanceof Error?g.message:"Failed to load file")}l(!1)},b=y=>{const g=qP[y]??en;return r.jsx(g,{size:12,className:"shrink-0 text-gray-500"})},v=()=>{if(o)return r.jsxs("div",{className:"flex items-center justify-center h-full text-gray-600 text-xs gap-2",children:[r.jsx(fe,{size:14,className:"animate-spin"})," Loading…"]});if(c)return r.jsxs("div",{className:"flex items-center justify-center h-full gap-2 text-red-400 text-xs",children:[r.jsx(mt,{size:14})," ",c]});if(!i)return r.jsx("div",{className:"flex items-center justify-center h-full text-gray-700 text-xs",children:"Select a file to preview"});const y=(n==null?void 0:n.ext)??"";if(y==="html"||y==="htm")return r.jsx("iframe",{srcDoc:i,sandbox:"allow-scripts",className:"w-full h-full border-0 bg-white",title:"workspace-preview"});const g=y==="json"?QP(i):i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return r.jsx("pre",{className:"w-full h-full overflow-auto p-4 text-[11px] font-mono text-gray-300 leading-relaxed whitespace-pre-wrap break-words bg-transparent",dangerouslySetInnerHTML:{__html:g}})};return r.jsxs("div",{className:"flex h-full overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"w-52 shrink-0 border-r border-white/5 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:[r.jsx(An,{size:11,className:"text-orange-400"}),"Workspace"]}),r.jsx("button",{onClick:f,disabled:u,className:"text-gray-700 hover:text-gray-400 transition-colors",title:"Refresh",children:r.jsx(fe,{size:11,className:u?"animate-spin":""})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto py-1 scrollbar-hide",children:e.length===0?r.jsx("p",{className:"text-[10px] text-gray-700 text-center py-6",children:"No files in workspace yet"}):e.map(y=>r.jsxs("button",{onClick:()=>m(y),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left transition-colors group ${(n==null?void 0:n.rel)===y.rel?"bg-orange-500/10 text-orange-300":"text-gray-500 hover:text-gray-300 hover:bg-white/3"}`,children:[b(y.ext),r.jsx("span",{className:"text-[11px] truncate flex-1",children:y.name}),r.jsx(Qt,{size:10,className:`shrink-0 opacity-0 group-hover:opacity-100 transition-opacity ${(n==null?void 0:n.rel)===y.rel?"opacity-100 text-orange-400":""}`})]},y.rel))})]}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/5 bg-white/[0.015] shrink-0",children:[r.jsx(ne,{mode:"wait",children:n?r.jsxs(H.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0},className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:"text-[11px] font-mono text-gray-400 truncate",children:n.rel}),r.jsxs("span",{className:"text-[9px] text-gray-700 shrink-0",children:[YP(n.size)," · ",XP(n.mtime)]})]},n.rel):r.jsx("span",{className:"text-[11px] text-gray-700",children:"No file selected"})}),n&&(n.ext==="html"||n.ext==="htm")&&r.jsx("button",{onClick:()=>window.open(`/api/workspace/file?p=${encodeURIComponent(n.rel)}&raw=1`,"_blank"),className:"text-gray-600 hover:text-gray-300 transition-colors shrink-0 ml-2",title:"Open in new tab",children:r.jsx(ba,{size:12})})]}),r.jsx("div",{className:"flex-1 overflow-hidden relative",children:v()})]})]})}const so={button:"rgba(234,88,12,0.7)",input:"rgba(59,130,246,0.7)",image:"rgba(168,85,247,0.6)",unknown:"rgba(255,255,255,0.3)"};function ZP(){const[e,t]=h.useState(!1),[n,s]=h.useState(null),[i,a]=h.useState(null),[o,l]=h.useState(!1),c=h.useRef(null);h.useEffect(()=>{if(!n||!c.current)return;const u=c.current,p=u.getContext("2d");if(!p)return;const f=new Image;f.onload=()=>{var m;if(u.width=f.width,u.height=f.height,p.drawImage(f,0,0),(m=n.elements)!=null&&m.length)for(const b of n.elements)p.strokeStyle=so[b.type]??so.unknown,p.lineWidth=Math.max(2,Math.round(f.width/400)),p.strokeRect(b.x,b.y,b.width,b.height),p.fillStyle=so[b.type]??so.unknown,p.font=`${Math.max(10,Math.round(f.width/120))}px monospace`,p.fillText(b.type,b.x+4,b.y+14)},f.src=`data:image/png;base64,${n.base64}`},[n]),h.useEffect(()=>{const u=Be();return u.on("agentUpdate",p=>{p.type==="SCREEN_CAPTURE_START"?t(!0):p.type==="SCREEN_CAPTURED"&&(t(!1),s({base64:p.base64,width:p.width,height:p.height,source:p.source,elements:p.elements}))}),()=>{u.off("agentUpdate")}},[]);const d=async()=>{if(!e){try{const u=await $("/api/system/vision-guidance");if(u.ok){const p=await u.json();p.warn&&p.message&&a(p.message)}}catch{}await $("/api/system/screenshot",{method:"POST",body:JSON.stringify({detect:!0})}).catch(()=>{})}};return r.jsxs("div",{className:"border border-white/5 rounded-2xl bg-[#0a0d16]/60 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ds,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-xs font-bold text-gray-400 tracking-widest uppercase",children:"Live Sight"}),n&&r.jsxs("span",{className:"text-[10px] text-gray-600 font-mono",children:[n.width,"×",n.height," · ",n.source]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx("button",{onClick:()=>l(u=>!u),className:"text-gray-600 hover:text-gray-300 transition-colors",title:o?"Collapse":"Expand",children:o?r.jsx(ef,{size:13}):r.jsx(Ds,{size:13})}),r.jsxs("button",{onClick:d,disabled:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-lg text-xs font-medium transition-all ${e?"text-orange-400 bg-orange-500/10 animate-pulse cursor-not-allowed":"text-gray-500 hover:text-orange-400 hover:bg-orange-500/10 border border-white/5"}`,children:[r.jsx(oa,{size:11}),e?"Scanning…":"Capture"]})]})]}),r.jsx(ne,{children:i&&r.jsxs(H.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"px-4 py-3 bg-amber-500/8 border-b border-amber-500/15",children:[r.jsx("p",{className:"text-[11px] text-amber-400 leading-relaxed",children:i}),r.jsx("button",{onClick:()=>a(null),className:"text-[10px] text-amber-600 hover:text-amber-400 mt-1 transition-colors",children:"Dismiss"})]})}),r.jsx(ne,{children:n&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},className:`relative overflow-hidden transition-all duration-300 ${o?"max-h-[500px]":"max-h-[140px]"}`,children:[r.jsx("canvas",{ref:c,className:"w-full object-contain",style:{imageRendering:"auto"}}),n.elements&&n.elements.length>0&&r.jsxs("div",{className:"absolute bottom-2 right-2 px-2 py-0.5 bg-black/70 rounded-md text-[10px] font-mono text-orange-400 border border-orange-500/20",children:[n.elements.length," elements"]})]})}),!n&&!e&&r.jsx("div",{className:"flex items-center justify-center py-8 text-gray-700 text-xs",children:"Press Capture to see what Must-b sees"}),e&&r.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-orange-400 text-xs animate-pulse",children:[r.jsx(oa,{size:14,className:"animate-spin"}),"Scanning screen…"]})]})}const e6=4,Z0=1e4;function t6(){const[e,t]=h.useState([]),n=h.useId(),s=h.useCallback(i=>{t(a=>a.filter(o=>o.id!==i))},[]);return h.useEffect(()=>{const i=Be();return i.on("projectInsight",a=>{const o={id:`${n}-${a.ts}-${Math.random().toString(36).slice(2,7)}`,message:a.message,filePath:a.filePath,ts:a.ts};t(l=>[o,...l].slice(0,e6)),setTimeout(()=>s(o.id),Z0)}),()=>{i.off("projectInsight")}},[s,n]),e.length===0?null:r.jsx("div",{className:"fixed bottom-6 right-5 z-[150] flex flex-col gap-2.5 items-end",style:{maxWidth:"340px",pointerEvents:"none"},children:r.jsx(ne,{mode:"popLayout",children:e.map((i,a)=>r.jsx(H.div,{layout:!0,initial:{opacity:0,x:60,scale:.94},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:60,scale:.92},transition:{type:"spring",stiffness:340,damping:28},style:{pointerEvents:"auto",opacity:a===0?1:1-a*.12},className:"w-full",children:r.jsxs("div",{className:"rounded-2xl overflow-hidden",style:{background:"rgba(15,6,1,0.82)",border:"1px solid rgba(249,115,22,0.28)",backdropFilter:"blur(24px)",boxShadow:"0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(249,115,22,0.08), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-2",style:{borderBottom:"1px solid rgba(249,115,22,0.12)"},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0",style:{background:"rgba(249,115,22,0.18)",border:"1px solid rgba(249,115,22,0.30)"},children:r.jsx(Ll,{size:10,className:"text-orange-400"})}),r.jsx("span",{className:"text-[11px] font-semibold text-orange-300/80 tracking-wide uppercase",children:"Must-b fısıldıyor"})]}),r.jsx("button",{onClick:()=>s(i.id),className:"text-white/25 hover:text-white/60 transition-colors",children:r.jsx(He,{size:12})})]}),r.jsxs("div",{className:"px-4 py-3 space-y-2",children:[r.jsx("p",{className:"text-[13px] text-white/80 leading-relaxed",children:i.message}),i.filePath&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(en,{size:10,className:"text-white/25 flex-shrink-0"}),r.jsx("span",{className:"text-[10px] font-mono text-white/35 truncate",children:i.filePath.replace(/\\/g,"/")})]})]}),r.jsx("div",{className:"h-px w-full",style:{background:"rgba(249,115,22,0.10)"},children:r.jsx(H.div,{className:"h-full",style:{background:"rgba(249,115,22,0.45)"},initial:{width:"100%"},animate:{width:"0%"},transition:{duration:Z0/1e3,ease:"linear"}})})]})},i.id))})})}const n6=6e3,s6=/https?:\/\/[^\s"'>)]+/,r6=new Set(["browser_navigate","browser_click","browser_type","browser_scroll","browser_wait","browser_perceive","browser_extract","browser_snapshot","browser_screenshot","web_fetch","web-fetch","web-search"]);function i6(e){const t=e.match(s6);return t?t[0].replace(/[.,;)]+$/,""):null}function a6(e,t=52){try{const n=new URL(e),s=n.hostname.replace(/^www\./,""),i=n.pathname.length>1?n.pathname:"",a=s+i;return a.length>t?a.slice(0,t-1)+"…":a}catch{return e.length>t?e.slice(0,t-1)+"…":e}}function o6(){const[e,t]=h.useState(null),[n,s]=h.useState(!1),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(!1),f=h.useRef(null),m=h.useRef(!1),b=h.useCallback(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{s(!1),t(null),l(null),d(null),m.current=!1},n6)},[]);return h.useEffect(()=>{const v=Be(),y=g=>{if(g.type==="shadowFrame"&&typeof g.slot!="number"||g.type==="ghostFrame"){const x=g.base64;if(!x)return;t(x),p(!1),m.current||(m.current=!0,s(!0),a(!1)),b();return}if(g.type==="shadowToggle"){!g.enabled&&typeof g.slot!="number"?(s(!1),t(null),l(null),d(null),m.current=!1,f.current&&clearTimeout(f.current)):g.enabled&&typeof g.slot!="number"&&(p(!0),s(!0),a(!1),m.current=!0);return}if(g.type==="ghostNav"){const x=g.url;x&&x!=="about:blank"&&l(x);return}if(g.type==="stepStart"){const x=g.step,w=(x==null?void 0:x.description)??"",j=(x==null?void 0:x.tool)??"";if(r6.has(j)||/navigate|click|type|browse|fetch|search/i.test(w)){const k=w.length>72?w.slice(0,71)+"…":w;d(k);const N=i6(w);N&&l(N)}return}if(g.type==="stepFinish"){d(null);return}if(g.type==="planFinish"){d(null),b();return}};return v.on("agentUpdate",y),()=>{v.off("agentUpdate",y),f.current&&clearTimeout(f.current)}},[b]),r.jsx(ne,{children:n&&r.jsx(H.div,{initial:{opacity:0,y:24,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:16,scale:.92},transition:{type:"spring",stiffness:340,damping:30},className:"fixed bottom-6 left-5 z-[140] flex flex-col",style:{width:i?"auto":"320px",pointerEvents:"auto"},children:r.jsxs("div",{className:"rounded-2xl overflow-hidden flex flex-col",style:{background:"rgba(10,4,1,0.88)",border:"1px solid rgba(249,115,22,0.28)",backdropFilter:"blur(24px) saturate(180%)",boxShadow:"0 12px 40px rgba(0,0,0,0.65), 0 0 0 1px rgba(249,115,22,0.08), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 select-none flex-shrink-0",style:{borderBottom:i?"none":"1px solid rgba(249,115,22,0.12)"},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"relative flex-shrink-0",children:[r.jsx("span",{className:"block w-2 h-2 rounded-full bg-orange-500"}),r.jsx("span",{className:"absolute inset-0 rounded-full bg-orange-500 animate-ping opacity-60"})]}),r.jsx(qe,{size:11,className:"text-orange-400/70"}),r.jsx("span",{className:"text-[11px] font-semibold text-white/70 tracking-wide",children:"Live Browser"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>a(v=>!v),className:"w-5 h-5 rounded-full flex items-center justify-center text-white/25 hover:text-white/60 hover:bg-white/8 transition-all",title:i?"Expand":"Minimize",children:i?r.jsx(jC,{size:10}):r.jsx(SC,{size:10})}),r.jsx("button",{onClick:()=>{s(!1),m.current=!1},className:"w-5 h-5 rounded-full flex items-center justify-center text-white/25 hover:text-white/60 hover:bg-white/8 transition-all",title:"Close",children:r.jsx(He,{size:10})})]})]}),r.jsx(ne,{children:!i&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22},className:"overflow-hidden",children:[r.jsxs("div",{className:"relative w-full overflow-hidden",style:{aspectRatio:"16 / 10",background:"#08030100"},children:[u&&!e?r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx(re,{size:20,className:"text-orange-400/50 animate-spin"})}):e?r.jsx("img",{src:`data:image/jpeg;base64,${e}`,alt:"Browser preview",className:"w-full h-full object-cover",style:{imageRendering:"auto"}}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[r.jsx(qe,{size:22,className:"text-orange-400/20"}),r.jsx("span",{className:"text-[11px] text-white/20",children:"Browser waiting…"})]}),e&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px)"}})]}),o&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",style:{borderTop:"1px solid rgba(249,115,22,0.10)"},children:[r.jsx(qe,{size:9,className:"text-orange-400/40 flex-shrink-0"}),r.jsx("span",{className:"text-[10px] font-mono text-white/40 truncate flex-1",children:a6(o)})]}),r.jsx(ne,{children:c&&r.jsxs(H.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.18},className:"px-3 py-2 flex items-start gap-2",style:{borderTop:"1px solid rgba(249,115,22,0.08)"},children:[r.jsx("div",{className:"flex items-center gap-0.5 mt-1 flex-shrink-0",children:[0,1,2].map(v=>r.jsx("span",{className:"block w-1 h-1 rounded-full bg-orange-400/60 animate-bounce",style:{animationDelay:`${v*.15}s`}},v))}),r.jsx("p",{className:"text-[10.5px] text-white/50 leading-snug line-clamp-2",children:c})]},"action-bar")})]},"pip-content")})]})},"live-browser-pip")})}function l6({url:e}){const[t,n]=h.useState(!1),s=h.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return r.jsxs("button",{onClick:s,title:"Copy login URL to clipboard",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-semibold
|
|
810
|
+
[… file truncated at 1.5 MB …]`:""))}catch(g){d(g instanceof Error?g.message:"Failed to load file")}l(!1)},b=v=>{const g=qP[v]??en;return r.jsx(g,{size:12,className:"shrink-0 text-gray-500"})},y=()=>{if(o)return r.jsxs("div",{className:"flex items-center justify-center h-full text-gray-600 text-xs gap-2",children:[r.jsx(fe,{size:14,className:"animate-spin"})," Loading…"]});if(c)return r.jsxs("div",{className:"flex items-center justify-center h-full gap-2 text-red-400 text-xs",children:[r.jsx(mt,{size:14})," ",c]});if(!i)return r.jsx("div",{className:"flex items-center justify-center h-full text-gray-700 text-xs",children:"Select a file to preview"});const v=(n==null?void 0:n.ext)??"";if(v==="html"||v==="htm")return r.jsx("iframe",{srcDoc:i,sandbox:"allow-scripts",className:"w-full h-full border-0 bg-white",title:"workspace-preview"});const g=v==="json"?QP(i):i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return r.jsx("pre",{className:"w-full h-full overflow-auto p-4 text-[11px] font-mono text-gray-300 leading-relaxed whitespace-pre-wrap break-words bg-transparent",dangerouslySetInnerHTML:{__html:g}})};return r.jsxs("div",{className:"flex h-full overflow-hidden bg-[#080b12]",children:[r.jsxs("div",{className:"w-52 shrink-0 border-r border-white/5 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:[r.jsx(An,{size:11,className:"text-orange-400"}),"Workspace"]}),r.jsx("button",{onClick:f,disabled:u,className:"text-gray-700 hover:text-gray-400 transition-colors",title:"Refresh",children:r.jsx(fe,{size:11,className:u?"animate-spin":""})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto py-1 scrollbar-hide",children:e.length===0?r.jsx("p",{className:"text-[10px] text-gray-700 text-center py-6",children:"No files in workspace yet"}):e.map(v=>r.jsxs("button",{onClick:()=>m(v),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left transition-colors group ${(n==null?void 0:n.rel)===v.rel?"bg-orange-500/10 text-orange-300":"text-gray-500 hover:text-gray-300 hover:bg-white/3"}`,children:[b(v.ext),r.jsx("span",{className:"text-[11px] truncate flex-1",children:v.name}),r.jsx(Qt,{size:10,className:`shrink-0 opacity-0 group-hover:opacity-100 transition-opacity ${(n==null?void 0:n.rel)===v.rel?"opacity-100 text-orange-400":""}`})]},v.rel))})]}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/5 bg-white/[0.015] shrink-0",children:[r.jsx(ne,{mode:"wait",children:n?r.jsxs(H.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0},className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:"text-[11px] font-mono text-gray-400 truncate",children:n.rel}),r.jsxs("span",{className:"text-[9px] text-gray-700 shrink-0",children:[YP(n.size)," · ",XP(n.mtime)]})]},n.rel):r.jsx("span",{className:"text-[11px] text-gray-700",children:"No file selected"})}),n&&(n.ext==="html"||n.ext==="htm")&&r.jsx("button",{onClick:()=>window.open(`/api/workspace/file?p=${encodeURIComponent(n.rel)}&raw=1`,"_blank"),className:"text-gray-600 hover:text-gray-300 transition-colors shrink-0 ml-2",title:"Open in new tab",children:r.jsx(ba,{size:12})})]}),r.jsx("div",{className:"flex-1 overflow-hidden relative",children:y()})]})]})}const so={button:"rgba(234,88,12,0.7)",input:"rgba(59,130,246,0.7)",image:"rgba(168,85,247,0.6)",unknown:"rgba(255,255,255,0.3)"};function ZP(){const[e,t]=h.useState(!1),[n,s]=h.useState(null),[i,a]=h.useState(null),[o,l]=h.useState(!1),c=h.useRef(null);h.useEffect(()=>{if(!n||!c.current)return;const u=c.current,p=u.getContext("2d");if(!p)return;const f=new Image;f.onload=()=>{var m;if(u.width=f.width,u.height=f.height,p.drawImage(f,0,0),(m=n.elements)!=null&&m.length)for(const b of n.elements)p.strokeStyle=so[b.type]??so.unknown,p.lineWidth=Math.max(2,Math.round(f.width/400)),p.strokeRect(b.x,b.y,b.width,b.height),p.fillStyle=so[b.type]??so.unknown,p.font=`${Math.max(10,Math.round(f.width/120))}px monospace`,p.fillText(b.type,b.x+4,b.y+14)},f.src=`data:image/png;base64,${n.base64}`},[n]),h.useEffect(()=>{const u=Be();return u.on("agentUpdate",p=>{p.type==="SCREEN_CAPTURE_START"?t(!0):p.type==="SCREEN_CAPTURED"&&(t(!1),s({base64:p.base64,width:p.width,height:p.height,source:p.source,elements:p.elements}))}),()=>{u.off("agentUpdate")}},[]);const d=async()=>{if(!e){try{const u=await $("/api/system/vision-guidance");if(u.ok){const p=await u.json();p.warn&&p.message&&a(p.message)}}catch{}await $("/api/system/screenshot",{method:"POST",body:JSON.stringify({detect:!0})}).catch(()=>{})}};return r.jsxs("div",{className:"border border-white/5 rounded-2xl bg-[#0a0d16]/60 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ds,{size:14,className:"text-orange-400"}),r.jsx("span",{className:"text-xs font-bold text-gray-400 tracking-widest uppercase",children:"Live Sight"}),n&&r.jsxs("span",{className:"text-[10px] text-gray-600 font-mono",children:[n.width,"×",n.height," · ",n.source]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx("button",{onClick:()=>l(u=>!u),className:"text-gray-600 hover:text-gray-300 transition-colors",title:o?"Collapse":"Expand",children:o?r.jsx(ef,{size:13}):r.jsx(Ds,{size:13})}),r.jsxs("button",{onClick:d,disabled:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-lg text-xs font-medium transition-all ${e?"text-orange-400 bg-orange-500/10 animate-pulse cursor-not-allowed":"text-gray-500 hover:text-orange-400 hover:bg-orange-500/10 border border-white/5"}`,children:[r.jsx(oa,{size:11}),e?"Scanning…":"Capture"]})]})]}),r.jsx(ne,{children:i&&r.jsxs(H.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"px-4 py-3 bg-amber-500/8 border-b border-amber-500/15",children:[r.jsx("p",{className:"text-[11px] text-amber-400 leading-relaxed",children:i}),r.jsx("button",{onClick:()=>a(null),className:"text-[10px] text-amber-600 hover:text-amber-400 mt-1 transition-colors",children:"Dismiss"})]})}),r.jsx(ne,{children:n&&r.jsxs(H.div,{initial:{opacity:0},animate:{opacity:1},className:`relative overflow-hidden transition-all duration-300 ${o?"max-h-[500px]":"max-h-[140px]"}`,children:[r.jsx("canvas",{ref:c,className:"w-full object-contain",style:{imageRendering:"auto"}}),n.elements&&n.elements.length>0&&r.jsxs("div",{className:"absolute bottom-2 right-2 px-2 py-0.5 bg-black/70 rounded-md text-[10px] font-mono text-orange-400 border border-orange-500/20",children:[n.elements.length," elements"]})]})}),!n&&!e&&r.jsx("div",{className:"flex items-center justify-center py-8 text-gray-700 text-xs",children:"Press Capture to see what Must-b sees"}),e&&r.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-orange-400 text-xs animate-pulse",children:[r.jsx(oa,{size:14,className:"animate-spin"}),"Scanning screen…"]})]})}const e6=4,Z0=1e4;function t6(){const[e,t]=h.useState([]),n=h.useId(),s=h.useCallback(i=>{t(a=>a.filter(o=>o.id!==i))},[]);return h.useEffect(()=>{const i=Be();return i.on("projectInsight",a=>{const o={id:`${n}-${a.ts}-${Math.random().toString(36).slice(2,7)}`,message:a.message,filePath:a.filePath,ts:a.ts};t(l=>[o,...l].slice(0,e6)),setTimeout(()=>s(o.id),Z0)}),()=>{i.off("projectInsight")}},[s,n]),e.length===0?null:r.jsx("div",{className:"fixed bottom-6 right-5 z-[150] flex flex-col gap-2.5 items-end",style:{maxWidth:"340px",pointerEvents:"none"},children:r.jsx(ne,{mode:"popLayout",children:e.map((i,a)=>r.jsx(H.div,{layout:!0,initial:{opacity:0,x:60,scale:.94},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:60,scale:.92},transition:{type:"spring",stiffness:340,damping:28},style:{pointerEvents:"auto",opacity:a===0?1:1-a*.12},className:"w-full",children:r.jsxs("div",{className:"rounded-2xl overflow-hidden",style:{background:"rgba(15,6,1,0.82)",border:"1px solid rgba(249,115,22,0.28)",backdropFilter:"blur(24px)",boxShadow:"0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(249,115,22,0.08), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-2",style:{borderBottom:"1px solid rgba(249,115,22,0.12)"},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0",style:{background:"rgba(249,115,22,0.18)",border:"1px solid rgba(249,115,22,0.30)"},children:r.jsx(Ll,{size:10,className:"text-orange-400"})}),r.jsx("span",{className:"text-[11px] font-semibold text-orange-300/80 tracking-wide uppercase",children:"Must-b fısıldıyor"})]}),r.jsx("button",{onClick:()=>s(i.id),className:"text-white/25 hover:text-white/60 transition-colors",children:r.jsx(He,{size:12})})]}),r.jsxs("div",{className:"px-4 py-3 space-y-2",children:[r.jsx("p",{className:"text-[13px] text-white/80 leading-relaxed",children:i.message}),i.filePath&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(en,{size:10,className:"text-white/25 flex-shrink-0"}),r.jsx("span",{className:"text-[10px] font-mono text-white/35 truncate",children:i.filePath.replace(/\\/g,"/")})]})]}),r.jsx("div",{className:"h-px w-full",style:{background:"rgba(249,115,22,0.10)"},children:r.jsx(H.div,{className:"h-full",style:{background:"rgba(249,115,22,0.45)"},initial:{width:"100%"},animate:{width:"0%"},transition:{duration:Z0/1e3,ease:"linear"}})})]})},i.id))})})}const n6=6e3,s6=/https?:\/\/[^\s"'>)]+/,r6=new Set(["browser_navigate","browser_click","browser_type","browser_scroll","browser_wait","browser_perceive","browser_extract","browser_snapshot","browser_screenshot","web_fetch","web-fetch","web-search"]);function i6(e){const t=e.match(s6);return t?t[0].replace(/[.,;)]+$/,""):null}function a6(e,t=52){try{const n=new URL(e),s=n.hostname.replace(/^www\./,""),i=n.pathname.length>1?n.pathname:"",a=s+i;return a.length>t?a.slice(0,t-1)+"…":a}catch{return e.length>t?e.slice(0,t-1)+"…":e}}function o6(){const[e,t]=h.useState(null),[n,s]=h.useState(!1),[i,a]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(null),[u,p]=h.useState(!1),f=h.useRef(null),m=h.useRef(!1),b=h.useCallback(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{s(!1),t(null),l(null),d(null),m.current=!1},n6)},[]);return h.useEffect(()=>{const y=Be(),v=g=>{if(g.type==="shadowFrame"&&typeof g.slot!="number"||g.type==="ghostFrame"){const x=g.base64;if(!x)return;t(x),p(!1),m.current||(m.current=!0,s(!0),a(!1)),b();return}if(g.type==="shadowToggle"){!g.enabled&&typeof g.slot!="number"?(s(!1),t(null),l(null),d(null),m.current=!1,f.current&&clearTimeout(f.current)):g.enabled&&typeof g.slot!="number"&&(p(!0),s(!0),a(!1),m.current=!0);return}if(g.type==="ghostNav"){const x=g.url;x&&x!=="about:blank"&&l(x);return}if(g.type==="stepStart"){const x=g.step,w=(x==null?void 0:x.description)??"",j=(x==null?void 0:x.tool)??"";if(r6.has(j)||/navigate|click|type|browse|fetch|search/i.test(w)){const k=w.length>72?w.slice(0,71)+"…":w;d(k);const N=i6(w);N&&l(N)}return}if(g.type==="stepFinish"){d(null);return}if(g.type==="planFinish"){d(null),b();return}};return y.on("agentUpdate",v),()=>{y.off("agentUpdate",v),f.current&&clearTimeout(f.current)}},[b]),r.jsx(ne,{children:n&&r.jsx(H.div,{initial:{opacity:0,y:24,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:16,scale:.92},transition:{type:"spring",stiffness:340,damping:30},className:"fixed bottom-6 left-5 z-[140] flex flex-col",style:{width:i?"auto":"320px",pointerEvents:"auto"},children:r.jsxs("div",{className:"rounded-2xl overflow-hidden flex flex-col",style:{background:"rgba(10,4,1,0.88)",border:"1px solid rgba(249,115,22,0.28)",backdropFilter:"blur(24px) saturate(180%)",boxShadow:"0 12px 40px rgba(0,0,0,0.65), 0 0 0 1px rgba(249,115,22,0.08), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 select-none flex-shrink-0",style:{borderBottom:i?"none":"1px solid rgba(249,115,22,0.12)"},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"relative flex-shrink-0",children:[r.jsx("span",{className:"block w-2 h-2 rounded-full bg-orange-500"}),r.jsx("span",{className:"absolute inset-0 rounded-full bg-orange-500 animate-ping opacity-60"})]}),r.jsx(qe,{size:11,className:"text-orange-400/70"}),r.jsx("span",{className:"text-[11px] font-semibold text-white/70 tracking-wide",children:"Live Browser"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>a(y=>!y),className:"w-5 h-5 rounded-full flex items-center justify-center text-white/25 hover:text-white/60 hover:bg-white/8 transition-all",title:i?"Expand":"Minimize",children:i?r.jsx(jC,{size:10}):r.jsx(SC,{size:10})}),r.jsx("button",{onClick:()=>{s(!1),m.current=!1},className:"w-5 h-5 rounded-full flex items-center justify-center text-white/25 hover:text-white/60 hover:bg-white/8 transition-all",title:"Close",children:r.jsx(He,{size:10})})]})]}),r.jsx(ne,{children:!i&&r.jsxs(H.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22},className:"overflow-hidden",children:[r.jsxs("div",{className:"relative w-full overflow-hidden",style:{aspectRatio:"16 / 10",background:"#08030100"},children:[u&&!e?r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx(re,{size:20,className:"text-orange-400/50 animate-spin"})}):e?r.jsx("img",{src:`data:image/jpeg;base64,${e}`,alt:"Browser preview",className:"w-full h-full object-cover",style:{imageRendering:"auto"}}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[r.jsx(qe,{size:22,className:"text-orange-400/20"}),r.jsx("span",{className:"text-[11px] text-white/20",children:"Browser waiting…"})]}),e&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px)"}})]}),o&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",style:{borderTop:"1px solid rgba(249,115,22,0.10)"},children:[r.jsx(qe,{size:9,className:"text-orange-400/40 flex-shrink-0"}),r.jsx("span",{className:"text-[10px] font-mono text-white/40 truncate flex-1",children:a6(o)})]}),r.jsx(ne,{children:c&&r.jsxs(H.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.18},className:"px-3 py-2 flex items-start gap-2",style:{borderTop:"1px solid rgba(249,115,22,0.08)"},children:[r.jsx("div",{className:"flex items-center gap-0.5 mt-1 flex-shrink-0",children:[0,1,2].map(y=>r.jsx("span",{className:"block w-1 h-1 rounded-full bg-orange-400/60 animate-bounce",style:{animationDelay:`${y*.15}s`}},y))}),r.jsx("p",{className:"text-[10.5px] text-white/50 leading-snug line-clamp-2",children:c})]},"action-bar")})]},"pip-content")})]})},"live-browser-pip")})}function l6({url:e}){const[t,n]=h.useState(!1),s=h.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return r.jsxs("button",{onClick:s,title:"Copy login URL to clipboard",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-semibold
|
|
811
811
|
transition-all duration-150 shrink-0
|
|
812
812
|
${t?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"bg-white/6 text-white/50 border border-white/10 hover:bg-white/10 hover:text-white/80"}`,children:[t?r.jsx(at,{size:11}):r.jsx(Os,{size:11}),t?"Copied!":"Copy URL"]})}function eg({url:e}){const t=e.length>48?e.slice(0,48)+"…":e;return r.jsxs("div",{className:`flex items-center gap-2 w-full bg-black/30 border border-white/8
|
|
813
|
-
rounded-xl px-3 py-2 mt-1`,children:[r.jsx("span",{className:"flex-1 text-[10px] font-mono text-cyan-400/80 truncate",title:e,children:t}),r.jsx(l6,{url:e})]})}function c6({onClose:e,onSuccess:t}){const[n,s]=h.useState("pending"),[i,a]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(""),u=h.useRef(null);h.useEffect(()=>{const m=Be();m.emit("auth:request_login");const b=
|
|
813
|
+
rounded-xl px-3 py-2 mt-1`,children:[r.jsx("span",{className:"flex-1 text-[10px] font-mono text-cyan-400/80 truncate",title:e,children:t}),r.jsx(l6,{url:e})]})}function c6({onClose:e,onSuccess:t}){const[n,s]=h.useState("pending"),[i,a]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(""),u=h.useRef(null);h.useEffect(()=>{const m=Be();m.emit("auth:request_login");const b=y=>{y.loginUrl&&l(y.loginUrl),y.phase==="success"?(s("success"),setTimeout(()=>{t(),e()},2e3)):y.phase==="error"&&(s("error"),a(y.message??"Login failed. Please try again."))};return m.on("auth:status",b),()=>{m.off("auth:status",b)}},[e,t]),h.useEffect(()=>{n==="manual"&&setTimeout(()=>{var m;return(m=u.current)==null?void 0:m.focus()},80)},[n]),h.useEffect(()=>{const m=b=>{b.key==="Escape"&&e()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e]);const p=h.useCallback(()=>{const m=c.trim();m&&(Be().emit("auth:submit_manual_token",{token:m}),d(""))},[c]),f=h.useCallback(()=>{s("pending"),l(""),Be().emit("auth:request_login")},[]);return r.jsxs("div",{className:"fixed inset-0 z-[90] flex items-center justify-center",children:[r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/65 backdrop-blur-[5px]",onClick:e},"login-backdrop"),r.jsxs(H.div,{initial:{opacity:0,scale:.91,y:18},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.91,y:12},transition:{type:"spring",stiffness:400,damping:32},className:`relative z-10 w-full max-w-[420px] mx-4 rounded-2xl overflow-hidden
|
|
814
814
|
bg-[#0c0d10] border border-white/10
|
|
815
815
|
shadow-[0_36px_90px_rgba(0,0,0,0.85),0_0_0_1px_rgba(249,115,22,0.14)]`,onClick:m=>m.stopPropagation(),children:[r.jsxs("div",{className:`flex items-center justify-between px-5 py-3.5
|
|
816
816
|
border-b border-white/[0.07] bg-white/[0.025]`,children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:`w-6 h-6 rounded-lg bg-orange-500/15 border border-orange-400/20
|
|
@@ -827,16 +827,17 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
827
827
|
transition-colors text-left`,children:"← Back to waiting"})]},"manual"),n==="success"&&r.jsxs(H.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{type:"spring",stiffness:360,damping:28},className:"flex flex-col items-center gap-3 py-4",children:[r.jsx("div",{className:`w-14 h-14 rounded-full bg-emerald-500/15 border border-emerald-400/30
|
|
828
828
|
flex items-center justify-center`,children:r.jsx(Fe,{size:32,className:"text-emerald-400"})}),r.jsx("p",{className:"text-[15px] font-bold text-white/90",children:"Login Successful!"}),r.jsx("p",{className:"text-[12px] text-white/35",children:"Closing in a moment…"})]},"success"),n==="error"&&r.jsxs(H.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"flex flex-col items-center gap-3 py-3 text-center",children:[r.jsx("p",{className:"text-[13px] text-red-400 font-semibold",children:"Login Failed"}),r.jsx("p",{className:"text-[12px] text-white/38",children:i}),r.jsx("button",{onClick:f,className:`px-4 py-2 rounded-xl bg-orange-600 hover:bg-orange-500
|
|
829
829
|
text-white text-[12px] font-semibold transition-all mt-1
|
|
830
|
-
shadow-[0_4px_14px_rgba(249,115,22,0.25)]`,children:"Try Again"})]},"error")]})}),r.jsx("div",{className:"px-5 pb-4 border-t border-white/[0.05] pt-3",children:r.jsx("p",{className:"text-[9px] text-white/15 text-center tracking-wide",children:"SECURE OAUTH CALLBACK · TOKEN SAVED TO ~/.mustb/auth.json"})})]},"login-card")]})}const qc={authenticated:!1,userEmail:null,userName:null,avatarUrl:null,expiresAt:null};function d6(e,t){return e?e.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase():t?t[0].toUpperCase():"?"}function u6(){var
|
|
830
|
+
shadow-[0_4px_14px_rgba(249,115,22,0.25)]`,children:"Try Again"})]},"error")]})}),r.jsx("div",{className:"px-5 pb-4 border-t border-white/[0.05] pt-3",children:r.jsx("p",{className:"text-[9px] text-white/15 text-center tracking-wide",children:"SECURE OAUTH CALLBACK · TOKEN SAVED TO ~/.mustb/auth.json"})})]},"login-card")]})}const qc={authenticated:!1,userEmail:null,userName:null,avatarUrl:null,expiresAt:null};function d6(e,t){return e?e.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase():t?t[0].toUpperCase():"?"}function u6(){var g;const[e,t]=h.useState(qc),[n,s]=h.useState(!1),[i,a]=h.useState(!1),[o,l]=h.useState(!1),[c,d]=h.useState(!1),u=h.useRef(null),p=h.useCallback(()=>{fetch("/api/auth/user-status").then(x=>x.json()).then(x=>t(x)).catch(()=>{})},[]);h.useEffect(()=>{p()},[p]),h.useEffect(()=>{const x=Be(),w=j=>{j.authenticated?t(k=>({...k,authenticated:!0,userEmail:j.userEmail??k.userEmail,userName:j.userName??k.userName,avatarUrl:j.avatarUrl??k.avatarUrl})):t(qc)};return x.on("authStateChanged",w),()=>{x.off("authStateChanged",w)}},[]),h.useEffect(()=>{if(!n)return;const x=w=>{u.current&&!u.current.contains(w.target)&&s(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),h.useEffect(()=>{if(!n)return;const x=w=>{w.key==="Escape"&&s(!1)};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);const f="https://must-b.com",m=async()=>{a(!0);try{await fetch("/api/auth/signout",{method:"POST"}),t(qc),s(!1)}finally{a(!1)}},b=x=>window.open(`${f}${x}`,"_blank","noopener,noreferrer"),y=d6(e.userName,e.userEmail),v=e.authenticated;return r.jsxs("div",{ref:u,className:"relative flex flex-col items-end",children:[r.jsx(ne,{children:o&&r.jsx(c6,{onClose:()=>{l(!1),d(!1)},onSuccess:()=>{l(!1),d(!1),p()}})}),!v&&r.jsxs("button",{onClick:x=>{x.preventDefault(),x.stopPropagation(),!c&&(d(!0),l(!0))},disabled:c,className:`flex items-center gap-2 px-3.5 py-2 rounded-xl font-semibold
|
|
831
831
|
text-[13px] select-none transition-all duration-200 focus:outline-none
|
|
832
832
|
bg-orange-600 hover:bg-orange-500 text-white
|
|
833
|
-
shadow-[0_4px_20px_rgba(249,115,22,0.45)] active:scale-[0.97]
|
|
833
|
+
shadow-[0_4px_20px_rgba(249,115,22,0.45)] active:scale-[0.97]
|
|
834
|
+
disabled:opacity-60 disabled:cursor-not-allowed disabled:active:scale-100`,children:[r.jsx(wC,{size:14}),"Sign In"]}),v&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>s(x=>!x),title:e.userEmail??"Account",className:`flex items-center gap-2 pl-1 pr-3 py-1 rounded-full select-none
|
|
834
835
|
transition-all duration-200 focus:outline-none
|
|
835
836
|
bg-white/8 border border-white/12 hover:bg-white/12
|
|
836
837
|
hover:border-orange-400/40 shadow-[0_4px_16px_rgba(0,0,0,0.4)]`,children:[r.jsxs("div",{className:`relative w-7 h-7 rounded-full overflow-hidden shrink-0
|
|
837
838
|
bg-orange-500/20 border border-orange-400/30
|
|
838
|
-
flex items-center justify-center`,children:[e.avatarUrl?r.jsx("img",{src:e.avatarUrl,alt:e.userName??"avatar",className:"w-full h-full object-cover",onError:
|
|
839
|
-
bg-emerald-400 border border-black`})]}),r.jsx("span",{className:"text-[12px] font-semibold text-white/75 max-w-[90px] truncate",children:e.userName??((
|
|
839
|
+
flex items-center justify-center`,children:[e.avatarUrl?r.jsx("img",{src:e.avatarUrl,alt:e.userName??"avatar",className:"w-full h-full object-cover",onError:x=>{x.currentTarget.style.display="none"}}):r.jsx("span",{className:"text-[11px] font-black text-orange-400",children:y}),r.jsx("span",{className:`absolute bottom-0 right-0 w-2 h-2 rounded-full
|
|
840
|
+
bg-emerald-400 border border-black`})]}),r.jsx("span",{className:"text-[12px] font-semibold text-white/75 max-w-[90px] truncate",children:e.userName??((g=e.userEmail)==null?void 0:g.split("@")[0])??"Account"})]}),r.jsx(ne,{children:n&&r.jsxs(H.div,{initial:{opacity:0,scale:.94,y:-8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.94,y:-6},transition:{duration:.16,ease:[.22,1,.36,1]},className:`absolute top-full right-0 mt-2 w-60
|
|
840
841
|
bg-[#0e0f11] border border-white/10 rounded-2xl overflow-hidden
|
|
841
842
|
shadow-[0_24px_64px_rgba(0,0,0,0.75),0_0_0_1px_rgba(249,115,22,0.12)]
|
|
842
843
|
z-[60]`,children:[r.jsxs("div",{className:`flex items-center justify-between px-4 py-3
|
|
@@ -845,20 +846,20 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
845
846
|
hover:bg-white/8 text-white/25 hover:text-white/55
|
|
846
847
|
transition-colors`,children:r.jsx(He,{size:11})})]}),r.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3",children:[r.jsx("div",{className:`w-8 h-8 rounded-full bg-orange-500/15 border
|
|
847
848
|
border-orange-400/25 flex items-center justify-center
|
|
848
|
-
shrink-0 overflow-hidden`,children:e.avatarUrl?r.jsx("img",{src:e.avatarUrl,alt:"avatar",className:"w-full h-full object-cover rounded-full"}):r.jsx("span",{className:"text-[13px] font-black text-orange-400",children:
|
|
849
|
+
shrink-0 overflow-hidden`,children:e.avatarUrl?r.jsx("img",{src:e.avatarUrl,alt:"avatar",className:"w-full h-full object-cover rounded-full"}):r.jsx("span",{className:"text-[13px] font-black text-orange-400",children:y})}),r.jsxs("div",{className:"min-w-0",children:[e.userName&&r.jsx("p",{className:"text-[12px] font-semibold text-white/85 truncate",children:e.userName}),r.jsx("p",{className:"text-[10px] text-white/38 truncate",children:e.userEmail??"—"})]})]}),r.jsx("div",{className:"h-px bg-white/[0.06] mx-3 mb-1"}),r.jsxs("div",{className:"p-1.5",children:[[{icon:r.jsx(yv,{size:12}),label:"Profile Settings",action:()=>b("/profile/settings")},{icon:r.jsx(cv,{size:12}),label:"Security",action:()=>b("/profile/security")}].map(x=>r.jsxs("button",{onClick:()=>{x.action(),s(!1)},className:`w-full flex items-center gap-2.5 px-3 py-2 rounded-xl
|
|
849
850
|
hover:bg-white/6 transition-colors group text-left`,children:[r.jsx("span",{className:`w-5 h-5 flex items-center justify-center rounded-lg
|
|
850
851
|
bg-white/5 text-white/35 group-hover:text-orange-400
|
|
851
|
-
group-hover:bg-orange-500/10 transition-all shrink-0`,children:
|
|
852
|
-
group-hover:text-white/85 transition-colors flex-1`,children:
|
|
853
|
-
transition-colors`})]},
|
|
852
|
+
group-hover:bg-orange-500/10 transition-all shrink-0`,children:x.icon}),r.jsx("span",{className:`text-[12px] font-medium text-white/65
|
|
853
|
+
group-hover:text-white/85 transition-colors flex-1`,children:x.label}),r.jsx(ba,{size:9,className:`text-white/20 group-hover:text-orange-400/50
|
|
854
|
+
transition-colors`})]},x.label)),r.jsx("div",{className:"h-px bg-white/[0.06] mx-1 my-1"}),r.jsxs("button",{onClick:m,disabled:i,className:`w-full flex items-center gap-2.5 px-3 py-2 rounded-xl
|
|
854
855
|
hover:bg-red-500/10 transition-colors group text-left
|
|
855
856
|
disabled:opacity-50 disabled:cursor-not-allowed`,children:[r.jsx("span",{className:`w-5 h-5 flex items-center justify-center rounded-lg
|
|
856
857
|
bg-white/5 text-white/28 group-hover:text-red-400
|
|
857
858
|
group-hover:bg-red-500/10 transition-all shrink-0`,children:r.jsx(nf,{size:12})}),r.jsx("span",{className:`text-[12px] font-medium text-white/45
|
|
858
|
-
group-hover:text-red-400 transition-colors`,children:i?"Signing out…":"Sign Out"})]})]}),r.jsx("div",{className:"px-4 py-2 border-t border-white/[0.05]",children:r.jsx("p",{className:"text-[8.5px] text-white/14 text-center",children:"must-b.com · Secure connection"})})]},"profile-panel")})]})]})}const h6=4,f6=3e3;function p6(){return r.jsxs(H.div,{className:"fixed inset-0 z-[200] pointer-events-none flex items-center justify-center",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:[r.jsx("div",{className:"absolute inset-0 bg-black/35"}),Array.from({length:h6}).map((e,t)=>r.jsx(H.span,{className:"absolute rounded-full",style:{border:"1.5px solid rgba(249,115,22,0.70)",boxShadow:"0 0 20px rgba(249,115,22,0.25)"},initial:{width:64,height:64,opacity:.9,scale:1},animate:{width:64+t*0,height:64+t*0,scale:[1,3.5+t*1.2],opacity:[.8,0]},transition:{duration:1.8,delay:t*.22,ease:"easeOut",repeat:1/0,repeatDelay:.1}},t)),r.jsx(H.div,{className:"relative z-10 w-16 h-16 rounded-full flex items-center justify-center",style:{background:"rgba(249,115,22,0.18)",border:"1.5px solid rgba(249,115,22,0.55)",backdropFilter:"blur(16px)",boxShadow:"0 0 32px rgba(249,115,22,0.35), 0 0 64px rgba(249,115,22,0.15)"},animate:{scale:[1,1.06,1]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"},children:r.jsx(Bs,{size:26,className:"text-orange-400"})}),r.jsx(H.p,{className:"absolute text-[12px] font-semibold text-orange-300/80 tracking-widest uppercase",style:{top:"calc(50% + 52px)"},initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:.15,duration:.3},children:"Dinliyorum…"})]})}function m6(){const[e,t]=h.useState(!1),n=h.useRef(null),s=h.useCallback(()=>{t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),f6)},[]);return h.useEffect(()=>(window.addEventListener("mustb:wake",s),()=>{window.removeEventListener("mustb:wake",s),n.current&&clearTimeout(n.current)}),[s]),r.jsx(ne,{children:e&&r.jsx(p6,{},"wake-aura")})}const g6={browser_navigate:"navigate",web_search:"search",http_request:"request"},x6=20,y6=5e3;function v6(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e.slice(0,30)}}function b6(e){try{return new URL(e).pathname.slice(0,40)||"/"}catch{return""}}function w6(e){return e==="search"?r.jsx(Zt,{size:10}):e==="request"?r.jsx(Yr,{size:10}):r.jsx(qe,{size:10})}function fb(e){return e==="search"?"#a78bfa":e==="request"?"#94a3b8":"#38bdf8"}function k6({domain:e,kind:t}){var i;const n=((i=e[0])==null?void 0:i.toUpperCase())??"?",s=fb(t);return r.jsx("span",{className:"w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 text-[10px] font-black",style:{background:`${s}18`,border:`1px solid ${s}30`,color:s},children:n})}function j6({entry:e,isLatest:t}){var a;const n=fb(e.kind),s=e.domain??"",i=e.query??(e.url?b6(e.url):"");return r.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",style:{borderLeft:t?`2px solid ${n}`:"2px solid transparent",background:t?`${n}08`:"transparent"},children:[r.jsx(k6,{domain:s||"?",kind:e.kind}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[11px] font-semibold text-white/80 truncate leading-tight",children:s||((a=e.query)==null?void 0:a.slice(0,30))||"—"}),i&&r.jsx("p",{className:"text-[9px] text-white/35 truncate font-mono mt-0.5",children:i})]}),r.jsx("span",{style:{color:n,opacity:.6},className:"flex-shrink-0",children:w6(e.kind)}),r.jsx("span",{className:"text-[9px] text-white/20 font-mono flex-shrink-0",children:new Date(e.ts).toLocaleTimeString("tr-TR",{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]})}function N6(){const[e,t]=h.useState([]),[n,s]=h.useState(!1),[i,a]=h.useState(!1),[o,l]=h.useState(!1),c=h.useRef(null),d=h.useCallback(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{s(!1),t([]),l(!1)},y6)},[]);return h.useEffect(()=>{const u=Be(),p=f=>{const{type:m}=f;if(m==="planStart"){c.current&&clearTimeout(c.current),l(!0);return}if(m==="planFinish"){l(!1),t(b=>b.map(v=>({...v,done:!0}))),d();return}if(m==="stepStart"&&f.step){const b=f.step,v=b.tool?g6[b.tool]:void 0;if(!v)return;const y=b.parameters??{},g=String(y.url??y.endpoint??"").trim(),x=String(y.query??"").trim();if(!g&&!x)return;const w={id:`v-${Date.now()}-${Math.random().toString(36).slice(2,5)}`,kind:v,url:g||void 0,query:x||void 0,domain:g?v6(g):void 0,ts:Date.now(),done:!1};t(j=>[w,...j].slice(0,x6)),s(!0),a(!1)}};return u.on("agentUpdate",p),()=>{u.off("agentUpdate",p),c.current&&clearTimeout(c.current)}},[d]),!n||e.length===0?null:r.jsx(H.div,{className:"fixed right-4 z-[120] w-[300px]",style:{top:"88px"},initial:{opacity:0,x:20,scale:.95},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:16,scale:.96},transition:{type:"spring",stiffness:360,damping:30},children:r.jsxs("div",{className:"rounded-2xl overflow-hidden",style:{background:"rgba(5,3,1,0.88)",border:"1px solid rgba(56,189,248,0.22)",backdropFilter:"blur(24px)",boxShadow:"0 8px 40px rgba(0,0,0,0.65), 0 0 0 1px rgba(56,189,248,0.06), inset 0 1px 0 rgba(255,255,255,0.03)"},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer select-none",style:{borderBottom:i?"none":"1px solid rgba(255,255,255,0.06)"},onClick:()=>a(u=>!u),children:[r.jsx(kC,{size:11,className:"text-sky-400/70 flex-shrink-0"}),r.jsx("span",{className:"text-[11px] font-bold text-white/60 flex-1 tracking-wide uppercase",children:"Gezi Haritası"}),o&&r.jsxs("span",{className:"flex items-center gap-1.5 flex-shrink-0",children:[r.jsx(H.span,{className:"w-1.5 h-1.5 rounded-full bg-sky-400",animate:{opacity:[1,.3,1]},transition:{duration:1,repeat:1/0}}),r.jsx("span",{className:"text-[10px] text-sky-400/70 font-medium",children:"taranıyor"})]}),r.jsx("span",{className:"text-[10px] text-white/25 flex-shrink-0 font-mono ml-1",children:e.length}),r.jsx("button",{onClick:u=>{u.stopPropagation(),s(!1),t([])},className:"text-white/20 hover:text-white/50 transition-colors flex-shrink-0 ml-1",children:r.jsx(He,{size:10})}),r.jsx("span",{className:"text-white/20 flex-shrink-0",children:i?r.jsx(Ml,{size:10}):r.jsx(qr,{size:10})})]}),r.jsx(ne,{children:!i&&r.jsxs(H.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{duration:.18},className:"overflow-hidden",children:[r.jsx("div",{className:"overflow-y-auto divide-y divide-white/4",style:{maxHeight:"260px"},children:r.jsx(ne,{mode:"popLayout",children:e.map((u,p)=>r.jsx(H.div,{layout:!0,initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:-8},transition:{duration:.15},children:r.jsx(j6,{entry:u,isLatest:p===0&&o})},u.id))})}),r.jsx("div",{className:"px-3 py-1.5 flex items-center justify-between",style:{borderTop:"1px solid rgba(255,255,255,0.04)"},children:r.jsxs("span",{className:"text-[9px] text-white/20 font-mono",children:[e.filter(u=>u.kind==="navigate").length," gezinti ·"," ",e.filter(u=>u.kind==="search").length," arama ·"," ",e.filter(u=>u.kind==="request").length," istek"]})})]})})]})})}function S6(e){if(!e.created_at)return"Older";const t=new Date,n=new Date(e.created_at),s=(t.getTime()-n.getTime())/864e5;return s<1&&t.getDate()===n.getDate()?"Today":s<2&&t.getDate()-n.getDate()===1?"Yesterday":s<7?"Last 7 Days":"Older"}const C6=["Today","Yesterday","Last 7 Days","Older"],E6="flex items-center gap-2.5 px-2.5 py-2 rounded-lg transition-all text-[13px] font-medium mb-0.5 w-full text-left",_6="bg-orange-500/15 text-orange-300 border border-orange-500/25",T6="text-white/80 hover:text-white/95 hover:bg-white/6";function P6(e){return Ze(E6,e?_6:T6)}function A6(e){return e?"text-orange-400 shrink-0":"text-white/70 shrink-0"}function M6({onClose:e}){const{t}=gt(),n=fs(),s=mn(),i=n.pathname,[a,o]=h.useState([]),[l,c]=h.useState(null),[d,u]=h.useState(""),[p,f]=h.useState(null),[m,b]=h.useState(null),[v,y]=h.useState(""),[g,x]=h.useState(""),[w,j]=h.useState(!1),k=h.useCallback(async()=>{try{const P=await $("/api/chats");if(!P.ok)return;const V=await P.json();o(V);const M=new Set([...V.map(B=>B.id),"default"]);for(let B=localStorage.length-1;B>=0;B--){const A=localStorage.key(B);A!=null&&A.startsWith("mustb_chat_turns_")&&!M.has(A.slice(17))&&localStorage.removeItem(A)}}catch{}},[]);h.useEffect(()=>{k();const P=setInterval(k,1e4);return()=>clearInterval(P)},[k]),h.useEffect(()=>{const P=V=>{const{id:M,title:B}=V.detail;o(A=>A.map(T=>T.id===M?{...T,title:B}:T))};return window.addEventListener("mustb:chat-renamed",P),()=>window.removeEventListener("mustb:chat-renamed",P)},[]),h.useEffect(()=>{$("/api/setup/status").then(P=>P.ok?P.json():null).then(P=>{P&&(y(P.activeProvider??""),x(P.activeModel??""))}).catch(()=>{}),fetch("/api/auth/user-status").then(P=>P.json()).then(P=>j(!!P.authenticated)).catch(()=>{})},[]);const N=async()=>{try{const P=await $("/api/chats",{method:"POST",body:JSON.stringify({title:"New Chat"})});if(!P.ok){de.error("Failed to create chat.");return}const V=await P.json();o(M=>[V,...M]),s(`/app?chat=${V.id}`),e()}catch{de.error("Gateway unreachable.")}},S=async()=>{if(p){try{await $(`/api/chats/${p}`,{method:"DELETE"}),o(P=>P.filter(V=>V.id!==p)),de.success("Chat deleted."),i.includes(p)&&s("/app")}catch{de.error("Failed to delete chat.")}f(null)}},_=async P=>{b(null);try{await $(`/api/chats/${P}`,{method:"PATCH",body:JSON.stringify({archived:!0})}),o(V=>V.filter(M=>M.id!==P)),de.success("Chat archived.")}catch{de.error("Failed to archive chat.")}},R=async()=>{if(!l||!d.trim()){c(null);return}try{await $(`/api/chats/${l}`,{method:"PATCH",body:JSON.stringify({title:d})}),o(P=>P.map(V=>V.id===l?{...V,title:d}:V)),de.success("Chat renamed.")}catch{de.error("Failed to rename chat.")}c(null)},L=[{to:"/app/browser",icon:r.jsx(qe,{size:14}),label:t.nav.browser},{to:"/app/automations",icon:r.jsx($C,{size:14}),label:t.nav.workflows},{to:"/app/skills",icon:r.jsx(Oe,{size:14}),label:t.nav.skills},{to:"/app/plugins",icon:r.jsx(Fr,{size:14}),label:t.nav.plugins},{to:"/app/store",icon:r.jsx(gv,{size:14}),label:"Store"},{to:"/app/channels",icon:r.jsx(af,{size:14}),label:t.nav.channels},{to:"/app/files",icon:r.jsx(An,{size:14}),label:t.nav.files},{to:"/app/memory",icon:r.jsx(va,{size:14}),label:t.nav.memory,exact:!0},{to:"/app/settings",icon:r.jsx(lf,{size:14}),label:t.nav.settings,exact:!0},{to:"/app/settings?tab=api-keys",icon:r.jsx(cv,{size:14}),label:t.nav.apiKeys}];return r.jsxs("aside",{className:"w-[280px] h-full bg-[#0d0703] border-r border-orange-500/10 flex flex-col overflow-hidden",children:[r.jsx("div",{className:"flex items-center h-[60px] pl-14 pr-4 shrink-0",children:r.jsxs(_i,{to:"/app",onClick:e,className:"flex items-center gap-2.5 hover:opacity-80 transition-opacity",children:[r.jsxs("div",{className:"relative w-7 h-7 shrink-0",children:[r.jsx("div",{className:"absolute inset-0 bg-orange-500 rounded-full blur-sm opacity-40"}),r.jsx("img",{src:"/logo.png",alt:"Must-b",className:"w-full h-full object-contain relative z-10"})]}),r.jsx("span",{className:"text-[18px] font-black tracking-tight text-white/90 leading-none select-none",children:"Must-b"})]})}),r.jsx("p",{className:"text-[10px] font-bold text-white/30 uppercase tracking-widest px-3 mb-2",children:"Sohbet"}),r.jsx("div",{className:"px-3 pb-3 shrink-0",children:r.jsxs("button",{onClick:N,className:"flex items-center justify-center gap-2 w-full px-3 py-1.5 rounded-lg border border-orange-500/20 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20 hover:border-orange-500/30 transition-all text-[12px] font-medium",children:[r.jsx(zl,{size:14}),t.sidebar.newChat]})}),r.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-hide px-2 pb-4",onClick:()=>m&&b(null),children:[(()=>{const P={Today:[],Yesterday:[],"Last 7 Days":[],Older:[]};for(const V of a)P[S6(V)].push(V);return C6.map(V=>{const M=P[V];return M.length===0?null:r.jsxs("div",{children:[r.jsx("p",{className:"px-2 mt-3 mb-1 text-[9.5px] font-bold text-white/20 uppercase tracking-widest",children:V}),r.jsx("div",{className:"space-y-0.5",children:M.map(B=>r.jsx("div",{className:"group relative",children:l===B.id?r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 bg-orange-500/10 rounded-lg border border-orange-500/25",children:[r.jsx("input",{value:d,onChange:A=>u(A.target.value),className:"flex-1 bg-transparent text-[13px] text-white/80 outline-none min-w-0",autoFocus:!0,onKeyDown:A=>{A.key==="Enter"&&R(),A.key==="Escape"&&c(null)}}),r.jsx("button",{onClick:R,className:"p-1 text-green-400 hover:bg-green-400/10 rounded transition-colors",children:r.jsx(at,{size:12})}),r.jsx("button",{onClick:()=>c(null),className:"p-1 text-red-400 hover:bg-red-400/10 rounded transition-colors",children:r.jsx(He,{size:12})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(_i,{to:`/app?chat=${B.id}`,onClick:e,className:Ze("flex items-center gap-2.5 px-2.5 py-2 rounded-lg transition-all text-[13px] font-medium pr-8",i.includes(B.id)?"bg-orange-500/15 text-orange-300 border border-orange-500/25":"text-white/55 hover:text-white/85 hover:bg-white/6"),children:[r.jsx(Is,{size:13,className:i.includes(B.id)?"text-orange-400 shrink-0":"text-white/30 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:B.title})]}),r.jsx("button",{onClick:A=>{A.preventDefault(),A.stopPropagation(),b(m===B.id?null:B.id)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded text-white/25 hover:text-white/70 hover:bg-white/8 opacity-0 group-hover:opacity-100 transition-all",children:r.jsx(dC,{size:14})}),m===B.id&&r.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[150px] rounded-xl py-1 overflow-hidden",style:{background:"rgba(16,6,2,0.97)",border:"1px solid rgba(249,115,22,0.15)",backdropFilter:"blur(20px)"},onClick:A=>A.stopPropagation(),children:[r.jsxs("button",{onClick:()=>{b(null),c(B.id),u(B.title)},className:"flex items-center gap-2.5 w-full px-3 py-2 text-[12px] text-white/60 hover:bg-white/5 transition-colors",children:[r.jsx(TC,{size:12,className:"text-white/35 shrink-0"})," Rename"]}),r.jsxs("button",{onClick:()=>_(B.id),className:"flex items-center gap-2.5 w-full px-3 py-2 text-[12px] text-white/60 hover:bg-white/5 transition-colors",children:[r.jsx(tC,{size:12,className:"text-white/35 shrink-0"})," Archive"]}),r.jsx("hr",{className:"my-1 border-white/8"}),r.jsxs("button",{onClick:A=>{A.preventDefault(),A.stopPropagation(),b(null),f(B.id)},className:"flex items-center gap-2.5 w-full px-3 py-2 text-[12px] text-red-400 hover:bg-red-500/10 transition-colors",children:[r.jsx(ms,{size:12,className:"shrink-0"})," Delete"]})]})]})},B.id))})]},V)})})(),r.jsx("hr",{className:"my-3 border-white/10"}),L.map(({to:P,icon:V,label:M,exact:B})=>{const A=P.split("?")[0],T=B?i===A:i.startsWith(A);return r.jsxs(_i,{to:P,onClick:e,className:P6(T),children:[r.jsx("span",{className:A6(T),children:V}),M]},P)})]}),r.jsxs("div",{className:"border-t border-orange-500/10 p-3 shrink-0",children:[g&&r.jsxs("div",{className:"mb-2 px-1",children:[r.jsx("p",{className:"text-[9px] text-white/25 font-bold uppercase tracking-[0.2em] mb-0.5",children:"Active Model"}),r.jsx("p",{className:"text-orange-400 text-[11px] font-bold truncate",children:g}),v&&r.jsx("p",{className:"text-white/30 text-[10px] capitalize",children:v})]}),w&&r.jsxs("button",{onClick:async()=>{try{await fetch("/api/auth/signout",{method:"POST"})}catch{}e(),s("/app"),window.location.reload()},className:"w-full flex items-center gap-2 px-2.5 py-2 rounded-lg text-white/30 hover:text-red-400 hover:bg-red-500/10 transition-all text-xs font-medium",children:[r.jsx(nf,{size:13}),t.sidebar.logout]}),r.jsxs("p",{className:"mt-2 text-[10px] text-white/20 px-1",children:[t.sidebar.poweredBy," ",r.jsx("span",{className:"text-orange-500/70 font-semibold",children:"Auto Step"})]})]}),p&&r.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 p-4",children:r.jsxs("div",{className:"rounded-2xl p-6 w-full max-w-sm shadow-2xl",style:{background:"rgba(16,6,2,0.97)",border:"1px solid rgba(249,115,22,0.18)"},children:[r.jsx("h3",{className:"text-lg font-bold text-white/90 mb-2",children:t.sidebar.deleteChat}),r.jsx("p",{className:"text-white/45 text-sm mb-6",children:t.sidebar.deleteConfirm}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:()=>f(null),className:"flex-1 px-4 py-2 rounded-xl bg-white/8 hover:bg-white/12 text-white/70 text-sm font-medium transition-colors",children:t.sidebar.cancel}),r.jsx("button",{onClick:S,className:"flex-1 px-4 py-2 rounded-xl bg-red-600 hover:bg-red-500 text-white text-sm font-medium transition-colors",children:t.sidebar.delete})]})]})})]})}function ge(e){window.dispatchEvent(new CustomEvent("mustb:invoke-skill",{detail:{skill:e}})),setTimeout(()=>{var t;return(t=document.querySelector("textarea"))==null?void 0:t.focus()},80)}function R6({panel:e,title:t,onClose:n}){return h.useEffect(()=>{const s=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[n]),r.jsxs(ne,{children:[r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},className:"fixed inset-0 z-40 bg-black/55 backdrop-blur-[3px]",onClick:n},"stage-backdrop"),r.jsxs(H.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:12},transition:{type:"spring",stiffness:380,damping:32},className:`fixed z-50 top-[72px] left-1/2 -translate-x-1/2
|
|
859
|
+
group-hover:text-red-400 transition-colors`,children:i?"Signing out…":"Sign Out"})]})]}),r.jsx("div",{className:"px-4 py-2 border-t border-white/[0.05]",children:r.jsx("p",{className:"text-[8.5px] text-white/14 text-center",children:"must-b.com · Secure connection"})})]},"profile-panel")})]})]})}const h6=4,f6=3e3;function p6(){return r.jsxs(H.div,{className:"fixed inset-0 z-[200] pointer-events-none flex items-center justify-center",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:[r.jsx("div",{className:"absolute inset-0 bg-black/35"}),Array.from({length:h6}).map((e,t)=>r.jsx(H.span,{className:"absolute rounded-full",style:{border:"1.5px solid rgba(249,115,22,0.70)",boxShadow:"0 0 20px rgba(249,115,22,0.25)"},initial:{width:64,height:64,opacity:.9,scale:1},animate:{width:64+t*0,height:64+t*0,scale:[1,3.5+t*1.2],opacity:[.8,0]},transition:{duration:1.8,delay:t*.22,ease:"easeOut",repeat:1/0,repeatDelay:.1}},t)),r.jsx(H.div,{className:"relative z-10 w-16 h-16 rounded-full flex items-center justify-center",style:{background:"rgba(249,115,22,0.18)",border:"1.5px solid rgba(249,115,22,0.55)",backdropFilter:"blur(16px)",boxShadow:"0 0 32px rgba(249,115,22,0.35), 0 0 64px rgba(249,115,22,0.15)"},animate:{scale:[1,1.06,1]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"},children:r.jsx(Bs,{size:26,className:"text-orange-400"})}),r.jsx(H.p,{className:"absolute text-[12px] font-semibold text-orange-300/80 tracking-widest uppercase",style:{top:"calc(50% + 52px)"},initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:.15,duration:.3},children:"Dinliyorum…"})]})}function m6(){const[e,t]=h.useState(!1),n=h.useRef(null),s=h.useCallback(()=>{t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),f6)},[]);return h.useEffect(()=>(window.addEventListener("mustb:wake",s),()=>{window.removeEventListener("mustb:wake",s),n.current&&clearTimeout(n.current)}),[s]),r.jsx(ne,{children:e&&r.jsx(p6,{},"wake-aura")})}const g6={browser_navigate:"navigate",web_search:"search",http_request:"request"},x6=20,y6=5e3;function v6(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e.slice(0,30)}}function b6(e){try{return new URL(e).pathname.slice(0,40)||"/"}catch{return""}}function w6(e){return e==="search"?r.jsx(Zt,{size:10}):e==="request"?r.jsx(Yr,{size:10}):r.jsx(qe,{size:10})}function fb(e){return e==="search"?"#a78bfa":e==="request"?"#94a3b8":"#38bdf8"}function k6({domain:e,kind:t}){var i;const n=((i=e[0])==null?void 0:i.toUpperCase())??"?",s=fb(t);return r.jsx("span",{className:"w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 text-[10px] font-black",style:{background:`${s}18`,border:`1px solid ${s}30`,color:s},children:n})}function j6({entry:e,isLatest:t}){var a;const n=fb(e.kind),s=e.domain??"",i=e.query??(e.url?b6(e.url):"");return r.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",style:{borderLeft:t?`2px solid ${n}`:"2px solid transparent",background:t?`${n}08`:"transparent"},children:[r.jsx(k6,{domain:s||"?",kind:e.kind}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-[11px] font-semibold text-white/80 truncate leading-tight",children:s||((a=e.query)==null?void 0:a.slice(0,30))||"—"}),i&&r.jsx("p",{className:"text-[9px] text-white/35 truncate font-mono mt-0.5",children:i})]}),r.jsx("span",{style:{color:n,opacity:.6},className:"flex-shrink-0",children:w6(e.kind)}),r.jsx("span",{className:"text-[9px] text-white/20 font-mono flex-shrink-0",children:new Date(e.ts).toLocaleTimeString("tr-TR",{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]})}function N6(){const[e,t]=h.useState([]),[n,s]=h.useState(!1),[i,a]=h.useState(!1),[o,l]=h.useState(!1),c=h.useRef(null),d=h.useCallback(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{s(!1),t([]),l(!1)},y6)},[]);return h.useEffect(()=>{const u=Be(),p=f=>{const{type:m}=f;if(m==="planStart"){c.current&&clearTimeout(c.current),l(!0);return}if(m==="planFinish"){l(!1),t(b=>b.map(y=>({...y,done:!0}))),d();return}if(m==="stepStart"&&f.step){const b=f.step,y=b.tool?g6[b.tool]:void 0;if(!y)return;const v=b.parameters??{},g=String(v.url??v.endpoint??"").trim(),x=String(v.query??"").trim();if(!g&&!x)return;const w={id:`v-${Date.now()}-${Math.random().toString(36).slice(2,5)}`,kind:y,url:g||void 0,query:x||void 0,domain:g?v6(g):void 0,ts:Date.now(),done:!1};t(j=>[w,...j].slice(0,x6)),s(!0),a(!1)}};return u.on("agentUpdate",p),()=>{u.off("agentUpdate",p),c.current&&clearTimeout(c.current)}},[d]),!n||e.length===0?null:r.jsx(H.div,{className:"fixed right-4 z-[120] w-[300px]",style:{top:"88px"},initial:{opacity:0,x:20,scale:.95},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:16,scale:.96},transition:{type:"spring",stiffness:360,damping:30},children:r.jsxs("div",{className:"rounded-2xl overflow-hidden",style:{background:"rgba(5,3,1,0.88)",border:"1px solid rgba(56,189,248,0.22)",backdropFilter:"blur(24px)",boxShadow:"0 8px 40px rgba(0,0,0,0.65), 0 0 0 1px rgba(56,189,248,0.06), inset 0 1px 0 rgba(255,255,255,0.03)"},children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer select-none",style:{borderBottom:i?"none":"1px solid rgba(255,255,255,0.06)"},onClick:()=>a(u=>!u),children:[r.jsx(kC,{size:11,className:"text-sky-400/70 flex-shrink-0"}),r.jsx("span",{className:"text-[11px] font-bold text-white/60 flex-1 tracking-wide uppercase",children:"Gezi Haritası"}),o&&r.jsxs("span",{className:"flex items-center gap-1.5 flex-shrink-0",children:[r.jsx(H.span,{className:"w-1.5 h-1.5 rounded-full bg-sky-400",animate:{opacity:[1,.3,1]},transition:{duration:1,repeat:1/0}}),r.jsx("span",{className:"text-[10px] text-sky-400/70 font-medium",children:"taranıyor"})]}),r.jsx("span",{className:"text-[10px] text-white/25 flex-shrink-0 font-mono ml-1",children:e.length}),r.jsx("button",{onClick:u=>{u.stopPropagation(),s(!1),t([])},className:"text-white/20 hover:text-white/50 transition-colors flex-shrink-0 ml-1",children:r.jsx(He,{size:10})}),r.jsx("span",{className:"text-white/20 flex-shrink-0",children:i?r.jsx(Ml,{size:10}):r.jsx(qr,{size:10})})]}),r.jsx(ne,{children:!i&&r.jsxs(H.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{duration:.18},className:"overflow-hidden",children:[r.jsx("div",{className:"overflow-y-auto divide-y divide-white/4",style:{maxHeight:"260px"},children:r.jsx(ne,{mode:"popLayout",children:e.map((u,p)=>r.jsx(H.div,{layout:!0,initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:-8},transition:{duration:.15},children:r.jsx(j6,{entry:u,isLatest:p===0&&o})},u.id))})}),r.jsx("div",{className:"px-3 py-1.5 flex items-center justify-between",style:{borderTop:"1px solid rgba(255,255,255,0.04)"},children:r.jsxs("span",{className:"text-[9px] text-white/20 font-mono",children:[e.filter(u=>u.kind==="navigate").length," gezinti ·"," ",e.filter(u=>u.kind==="search").length," arama ·"," ",e.filter(u=>u.kind==="request").length," istek"]})})]})})]})})}function S6(e){if(!e.created_at)return"Older";const t=new Date,n=new Date(e.created_at),s=(t.getTime()-n.getTime())/864e5;return s<1&&t.getDate()===n.getDate()?"Today":s<2&&t.getDate()-n.getDate()===1?"Yesterday":s<7?"Last 7 Days":"Older"}const C6=["Today","Yesterday","Last 7 Days","Older"],E6="flex items-center gap-2.5 px-2.5 py-2 rounded-lg transition-all text-[13px] font-medium mb-0.5 w-full text-left",_6="bg-orange-500/15 text-orange-300 border border-orange-500/25",T6="text-white/80 hover:text-white/95 hover:bg-white/6";function P6(e){return Ze(E6,e?_6:T6)}function A6(e){return e?"text-orange-400 shrink-0":"text-white/70 shrink-0"}function M6({onClose:e}){const{t}=gt(),n=fs(),s=mn(),i=n.pathname,[a,o]=h.useState([]),[l,c]=h.useState(null),[d,u]=h.useState(""),[p,f]=h.useState(null),[m,b]=h.useState(null),[y,v]=h.useState(""),[g,x]=h.useState(""),[w,j]=h.useState(!1),k=h.useCallback(async()=>{try{const P=await $("/api/chats");if(!P.ok)return;const V=await P.json();o(V);const M=new Set([...V.map(B=>B.id),"default"]);for(let B=localStorage.length-1;B>=0;B--){const A=localStorage.key(B);A!=null&&A.startsWith("mustb_chat_turns_")&&!M.has(A.slice(17))&&localStorage.removeItem(A)}}catch{}},[]);h.useEffect(()=>{k();const P=setInterval(k,1e4);return()=>clearInterval(P)},[k]),h.useEffect(()=>{const P=V=>{const{id:M,title:B}=V.detail;o(A=>A.map(T=>T.id===M?{...T,title:B}:T))};return window.addEventListener("mustb:chat-renamed",P),()=>window.removeEventListener("mustb:chat-renamed",P)},[]),h.useEffect(()=>{$("/api/setup/status").then(P=>P.ok?P.json():null).then(P=>{P&&(v(P.activeProvider??""),x(P.activeModel??""))}).catch(()=>{}),fetch("/api/auth/user-status").then(P=>P.json()).then(P=>j(!!P.authenticated)).catch(()=>{})},[]);const N=async()=>{try{const P=await $("/api/chats",{method:"POST",body:JSON.stringify({title:"New Chat"})});if(!P.ok){de.error("Failed to create chat.");return}const V=await P.json();o(M=>[V,...M]),s(`/app?chat=${V.id}`),e()}catch{de.error("Gateway unreachable.")}},S=async()=>{if(p){try{await $(`/api/chats/${p}`,{method:"DELETE"}),o(P=>P.filter(V=>V.id!==p)),de.success("Chat deleted."),i.includes(p)&&s("/app")}catch{de.error("Failed to delete chat.")}f(null)}},_=async P=>{b(null);try{await $(`/api/chats/${P}`,{method:"PATCH",body:JSON.stringify({archived:!0})}),o(V=>V.filter(M=>M.id!==P)),de.success("Chat archived.")}catch{de.error("Failed to archive chat.")}},R=async()=>{if(!l||!d.trim()){c(null);return}try{await $(`/api/chats/${l}`,{method:"PATCH",body:JSON.stringify({title:d})}),o(P=>P.map(V=>V.id===l?{...V,title:d}:V)),de.success("Chat renamed.")}catch{de.error("Failed to rename chat.")}c(null)},L=[{to:"/app/browser",icon:r.jsx(qe,{size:14}),label:t.nav.browser},{to:"/app/automations",icon:r.jsx($C,{size:14}),label:t.nav.workflows},{to:"/app/skills",icon:r.jsx(Oe,{size:14}),label:t.nav.skills},{to:"/app/plugins",icon:r.jsx(Fr,{size:14}),label:t.nav.plugins},{to:"/app/store",icon:r.jsx(gv,{size:14}),label:"Store"},{to:"/app/channels",icon:r.jsx(af,{size:14}),label:t.nav.channels},{to:"/app/files",icon:r.jsx(An,{size:14}),label:t.nav.files},{to:"/app/memory",icon:r.jsx(va,{size:14}),label:t.nav.memory,exact:!0},{to:"/app/settings",icon:r.jsx(lf,{size:14}),label:t.nav.settings,exact:!0},{to:"/app/settings?tab=api-keys",icon:r.jsx(cv,{size:14}),label:t.nav.apiKeys}];return r.jsxs("aside",{className:"w-[280px] h-full bg-[#0d0703] border-r border-orange-500/10 flex flex-col overflow-hidden",children:[r.jsx("div",{className:"flex items-center h-[60px] pl-14 pr-4 shrink-0",children:r.jsxs(_i,{to:"/app",onClick:e,className:"flex items-center gap-2.5 hover:opacity-80 transition-opacity",children:[r.jsxs("div",{className:"relative w-7 h-7 shrink-0",children:[r.jsx("div",{className:"absolute inset-0 bg-orange-500 rounded-full blur-sm opacity-40"}),r.jsx("img",{src:"/logo.png",alt:"Must-b",className:"w-full h-full object-contain relative z-10"})]}),r.jsx("span",{className:"text-[18px] font-black tracking-tight text-white/90 leading-none select-none",children:"Must-b"})]})}),r.jsx("p",{className:"text-[10px] font-bold text-white/30 uppercase tracking-widest px-3 mb-2",children:"Sohbet"}),r.jsx("div",{className:"px-3 pb-3 shrink-0",children:r.jsxs("button",{onClick:N,className:"flex items-center justify-center gap-2 w-full px-3 py-1.5 rounded-lg border border-orange-500/20 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20 hover:border-orange-500/30 transition-all text-[12px] font-medium",children:[r.jsx(zl,{size:14}),t.sidebar.newChat]})}),r.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-hide px-2 pb-4",onClick:()=>m&&b(null),children:[(()=>{const P={Today:[],Yesterday:[],"Last 7 Days":[],Older:[]};for(const V of a)P[S6(V)].push(V);return C6.map(V=>{const M=P[V];return M.length===0?null:r.jsxs("div",{children:[r.jsx("p",{className:"px-2 mt-3 mb-1 text-[9.5px] font-bold text-white/20 uppercase tracking-widest",children:V}),r.jsx("div",{className:"space-y-0.5",children:M.map(B=>r.jsx("div",{className:"group relative",children:l===B.id?r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 bg-orange-500/10 rounded-lg border border-orange-500/25",children:[r.jsx("input",{value:d,onChange:A=>u(A.target.value),className:"flex-1 bg-transparent text-[13px] text-white/80 outline-none min-w-0",autoFocus:!0,onKeyDown:A=>{A.key==="Enter"&&R(),A.key==="Escape"&&c(null)}}),r.jsx("button",{onClick:R,className:"p-1 text-green-400 hover:bg-green-400/10 rounded transition-colors",children:r.jsx(at,{size:12})}),r.jsx("button",{onClick:()=>c(null),className:"p-1 text-red-400 hover:bg-red-400/10 rounded transition-colors",children:r.jsx(He,{size:12})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(_i,{to:`/app?chat=${B.id}`,onClick:e,className:Ze("flex items-center gap-2.5 px-2.5 py-2 rounded-lg transition-all text-[13px] font-medium pr-8",i.includes(B.id)?"bg-orange-500/15 text-orange-300 border border-orange-500/25":"text-white/55 hover:text-white/85 hover:bg-white/6"),children:[r.jsx(Is,{size:13,className:i.includes(B.id)?"text-orange-400 shrink-0":"text-white/30 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:B.title})]}),r.jsx("button",{onClick:A=>{A.preventDefault(),A.stopPropagation(),b(m===B.id?null:B.id)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded text-white/25 hover:text-white/70 hover:bg-white/8 opacity-0 group-hover:opacity-100 transition-all",children:r.jsx(dC,{size:14})}),m===B.id&&r.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[150px] rounded-xl py-1 overflow-hidden",style:{background:"rgba(16,6,2,0.97)",border:"1px solid rgba(249,115,22,0.15)",backdropFilter:"blur(20px)"},onClick:A=>A.stopPropagation(),children:[r.jsxs("button",{onClick:()=>{b(null),c(B.id),u(B.title)},className:"flex items-center gap-2.5 w-full px-3 py-2 text-[12px] text-white/60 hover:bg-white/5 transition-colors",children:[r.jsx(TC,{size:12,className:"text-white/35 shrink-0"})," Rename"]}),r.jsxs("button",{onClick:()=>_(B.id),className:"flex items-center gap-2.5 w-full px-3 py-2 text-[12px] text-white/60 hover:bg-white/5 transition-colors",children:[r.jsx(tC,{size:12,className:"text-white/35 shrink-0"})," Archive"]}),r.jsx("hr",{className:"my-1 border-white/8"}),r.jsxs("button",{onClick:A=>{A.preventDefault(),A.stopPropagation(),b(null),f(B.id)},className:"flex items-center gap-2.5 w-full px-3 py-2 text-[12px] text-red-400 hover:bg-red-500/10 transition-colors",children:[r.jsx(ms,{size:12,className:"shrink-0"})," Delete"]})]})]})},B.id))})]},V)})})(),r.jsx("hr",{className:"my-3 border-white/10"}),L.map(({to:P,icon:V,label:M,exact:B})=>{const A=P.split("?")[0],T=B?i===A:i.startsWith(A);return r.jsxs(_i,{to:P,onClick:e,className:P6(T),children:[r.jsx("span",{className:A6(T),children:V}),M]},P)})]}),r.jsxs("div",{className:"border-t border-orange-500/10 p-3 shrink-0",children:[g&&r.jsxs("div",{className:"mb-2 px-1",children:[r.jsx("p",{className:"text-[9px] text-white/25 font-bold uppercase tracking-[0.2em] mb-0.5",children:"Active Model"}),r.jsx("p",{className:"text-orange-400 text-[11px] font-bold truncate",children:g}),y&&r.jsx("p",{className:"text-white/30 text-[10px] capitalize",children:y})]}),w&&r.jsxs("button",{onClick:async()=>{try{await fetch("/api/auth/signout",{method:"POST"})}catch{}e(),s("/app"),window.location.reload()},className:"w-full flex items-center gap-2 px-2.5 py-2 rounded-lg text-white/30 hover:text-red-400 hover:bg-red-500/10 transition-all text-xs font-medium",children:[r.jsx(nf,{size:13}),t.sidebar.logout]}),r.jsxs("p",{className:"mt-2 text-[10px] text-white/20 px-1",children:[t.sidebar.poweredBy," ",r.jsx("span",{className:"text-orange-500/70 font-semibold",children:"Auto Step"})]})]}),p&&r.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 p-4",children:r.jsxs("div",{className:"rounded-2xl p-6 w-full max-w-sm shadow-2xl",style:{background:"rgba(16,6,2,0.97)",border:"1px solid rgba(249,115,22,0.18)"},children:[r.jsx("h3",{className:"text-lg font-bold text-white/90 mb-2",children:t.sidebar.deleteChat}),r.jsx("p",{className:"text-white/45 text-sm mb-6",children:t.sidebar.deleteConfirm}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:()=>f(null),className:"flex-1 px-4 py-2 rounded-xl bg-white/8 hover:bg-white/12 text-white/70 text-sm font-medium transition-colors",children:t.sidebar.cancel}),r.jsx("button",{onClick:S,className:"flex-1 px-4 py-2 rounded-xl bg-red-600 hover:bg-red-500 text-white text-sm font-medium transition-colors",children:t.sidebar.delete})]})]})})]})}function ge(e){window.dispatchEvent(new CustomEvent("mustb:invoke-skill",{detail:{skill:e}})),setTimeout(()=>{var t;return(t=document.querySelector("textarea"))==null?void 0:t.focus()},80)}function R6({panel:e,title:t,onClose:n}){return h.useEffect(()=>{const s=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[n]),r.jsxs(ne,{children:[r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},className:"fixed inset-0 z-40 bg-black/55 backdrop-blur-[3px]",onClick:n},"stage-backdrop"),r.jsxs(H.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:12},transition:{type:"spring",stiffness:380,damping:32},className:`fixed z-50 top-[72px] left-1/2 -translate-x-1/2
|
|
859
860
|
w-full max-w-2xl max-h-[calc(100vh-92px)]
|
|
860
861
|
glass-panel rounded-3xl overflow-hidden flex flex-col
|
|
861
|
-
shadow-[0_24px_80px_rgba(0,0,0,0.7),0_0_0_1px_rgba(249,115,22,0.18)]`,onClick:s=>s.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-orange-500/12 shrink-0",children:[r.jsx("span",{className:"text-[13px] font-bold text-white/80",children:t}),r.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-full hover:bg-white/8 text-white/40 hover:text-white/70 transition-colors",children:r.jsx(He,{size:14})})]}),r.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[e==="memory"&&r.jsx(FP,{}),e==="plugins"&&r.jsx(UP,{}),e==="skills"&&r.jsx(GP,{}),e==="workspace"&&r.jsx(JP,{}),e==="livesight"&&r.jsx(ZP,{})]})]},"stage-card")]})}function z6(){const{t:e}=gt(),t=fs(),n=mn(),[s,i]=h.useState(!1),[a,o]=h.useState(""),[l,c]=h.useState(null),[d,u]=h.useState(!1);h.useEffect(()=>{const b=v=>{u(v.detail.active)};return window.addEventListener("mustb:safeMode",b),()=>window.removeEventListener("mustb:safeMode",b)},[]),h.useEffect(()=>{i(!1)},[t.pathname]),t.pathname,h.useCallback(b=>o(v=>v===b?"":b),[]),h.useCallback(b=>{c(b),o("")},[]);const p=h.useCallback(()=>c(null),[]),f=e.dock;f.cat_webTools,f.skill_webSearch,f.desc_webSearch,f.skill_webFetch,f.desc_webFetch,f.skill_browserControl,f.desc_browserControl,f.cat_fileMedia,f.skill_pdfReader,f.desc_pdfReader,f.skill_imageAnalysis,f.desc_imageAnalysis,f.skill_imageGeneration,f.desc_imageGeneration,f.skill_tts,f.desc_tts,f.cat_aiAgents,f.skills,f.skill_spawnAgent,f.desc_spawnAgent,f.skill_agentSessions,f.desc_agentSessions,f.skill_canvas,f.desc_canvas,f.skill_git,f.desc_git,f.cat_systemTools,f.skill_gateway,f.desc_gateway,f.skill_fileManager,f.desc_fileManager,f.skill_cron,f.desc_cron,f.skill_messages,f.desc_messages,f.cat_knowledgeBase,f.mem_browse,f.desc_memBrowse,f.mem_search,f.desc_memSearch,f.mem_add,f.desc_memAdd,f.cat_personalOrg,f.mem_contacts,f.desc_contacts,f.mem_calendar,f.desc_calendar,f.cat_pluginManager,f.plug_marketplace,f.desc_marketplace,f.plug_installed,f.desc_installed,f.plug_mcp,f.desc_mcp,f.cat_developer,f.plug_bundleMcp,f.desc_bundleMcp,f.plug_cliCmds,f.desc_cliCmds,f.cat_automation,f.wf_automations,f.desc_automations,f.wf_scheduled,f.desc_scheduled,f.wf_commands,f.desc_commands,f.cat_advanced,f.wf_nodes,f.desc_nodes,f.wf_multiAgent,f.desc_multiAgent;const m={memory:f.memory,plugins:f.plugins,skills:f.skills,workspace:f.files,livesight:"Visual Audit"};return r.jsx(L5,{reducedMotion:d?"always":"never",children:r.jsxs("div",{className:"relative min-h-screen overflow-x-hidden font-sans bg-transparent",children:[l&&r.jsx(R6,{panel:l,title:m[l],onClose:p}),r.jsx("div",{className:"fixed top-[14px] left-4 z-40 overflow-hidden",children:r.jsx("button",{onClick:()=>i(b=>!b),"aria-label":"Toggle sidebar",className:"p-2 rounded-full text-white/45 hover:text-white/90 hover:bg-white/8 transition-all leading-none",style:{backdropFilter:"blur(8px)",fontSize:0},children:r.jsx(NC,{size:17,"aria-hidden":"true",focusable:"false"})})}),r.jsxs("header",{className:"fixed top-0 inset-x-0 z-50 h-16 flex items-center justify-between px-6 pointer-events-none",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex items-center gap-2.5 shrink-0 pointer-events-auto",children:[r.jsxs(_i,{to:"/app/voice",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[12px] font-medium transition-all select-none ${t.pathname==="/app/voice"?"bg-orange-500/20 text-orange-300 border border-orange-500/30":"text-white/45 hover:text-white/85 hover:bg-white/8"}`,title:e.nav.voice,children:[r.jsx(iC,{size:14}),r.jsx("span",{className:"hidden sm:inline",children:e.nav.voice})]}),r.jsx(H.div,{initial:{opacity:0,x:12},animate:{opacity:1,x:0},transition:{duration:.4,delay:.15},className:"flex items-center gap-1 px-2 py-1.5 rounded-full",style:{background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.09)"},children:r.jsx(IP,{})}),r.jsx(u6,{})]})]}),r.jsx(ne,{children:s&&r.jsx(H.div,{initial:{x:-280},animate:{x:0},exit:{x:-280},transition:{type:"spring",stiffness:340,damping:34},className:"fixed top-0 left-0 bottom-0 z-30 w-[280px]",children:r.jsx(M6,{onClose:()=>i(!1)})},"sidebar-panel")}),r.jsx("main",{className:"relative min-h-screen pt-16 transition-[margin] duration-300 bg-transparent",style:{marginLeft:s?280:0},children:r.jsx(Dk,{})}),r.jsx(t6,{}),r.jsx(o6,{}),r.jsx(m6,{}),r.jsx(N6,{})]})})}const L6=[{decision:"duplicate",label:"Create New Agent",sublabel:"Keep both — cloud data is copied to a separate folder",icon:pC,accent:"border-blue-500/30 bg-blue-500/8 hover:border-blue-500/50 text-blue-400"},{decision:"restore",label:"Use Cloud (Overwrite)",sublabel:"Cloud wins — local memory is replaced with cloud version",icon:lC,accent:"border-orange-500/30 bg-orange-500/8 hover:border-orange-500/50 text-orange-400"},{decision:"upload",label:"Keep Mine",sublabel:"Local wins — cloud memory is overwritten with local data",icon:LC,accent:"border-green-500/30 bg-green-500/8 hover:border-green-500/50 text-green-400"}];function O6(){const[e,t]=h.useState(null),[n,s]=h.useState(!1),[i,a]=h.useState(!1);h.useEffect(()=>{const c=Be(),d=u=>{u.type==="CONFLICT_DETECTED"&&(t({localAgentName:u.localAgentName??null,cloudAgentName:u.cloudAgentName??null,localMtime:u.localMtime??null,cloudTimestamp:u.cloudTimestamp??null}),a(!1)),u.type==="syncResolveFinish"&&(a(!0),setTimeout(()=>{t(null),a(!1)},1800))};return c.on("agentUpdate",d),()=>{c.off("agentUpdate",d)}},[]);const o=async c=>{if(!n){s(!0);try{await fetch("/api/setup/sync-resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:c})})}catch{}s(!1)}},l=c=>{if(!c)return"—";try{return new Date(c).toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}catch{return c}};return r.jsx(ne,{children:e&&r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/70 backdrop-blur-sm px-4",children:r.jsxs(H.div,{initial:{opacity:0,y:24,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:24,scale:.95},transition:{duration:.25},className:"w-full max-w-md bg-[#0c0f18] border border-white/10 rounded-2xl shadow-2xl overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3 px-6 py-5 border-b border-white/8 bg-amber-500/5",children:[r.jsx("div",{className:"w-9 h-9 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:r.jsx(ls,{size:18,className:"text-amber-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-white font-bold text-base",children:"Memory Conflict Detected"}),r.jsx("p",{className:"text-gray-500 text-xs mt-0.5",children:"Two agent identities found — action required"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 px-6 pt-5 pb-2",children:[r.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/3 px-4 py-3",children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest mb-1",children:"Local Agent"}),r.jsx("p",{className:"text-white font-bold text-sm",children:e.localAgentName??"—"}),r.jsx("p",{className:"text-gray-600 text-[10px] mt-1",children:l(e.localMtime)})]}),r.jsxs("div",{className:"rounded-xl border border-orange-500/20 bg-orange-500/5 px-4 py-3",children:[r.jsx("p",{className:"text-[10px] font-bold text-orange-400/60 uppercase tracking-widest mb-1",children:"Cloud Agent"}),r.jsx("p",{className:"text-orange-300 font-bold text-sm",children:e.cloudAgentName??"—"}),r.jsx("p",{className:"text-orange-400/40 text-[10px] mt-1",children:l(e.cloudTimestamp)})]})]}),r.jsx("div",{className:"px-6 py-4 space-y-2",children:i?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-green-400 text-sm font-semibold",children:[r.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-green-400 flex items-center justify-center text-[10px]",children:"✓"}),"Conflict resolved"]}):L6.map(c=>{const d=c.icon;return r.jsxs("button",{onClick:()=>o(c.decision),disabled:n,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl border transition-all text-left disabled:opacity-50 disabled:cursor-not-allowed ${c.accent}`,children:[n?r.jsx(re,{size:16,className:"animate-spin flex-shrink-0"}):r.jsx(d,{size:16,className:"flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm text-white",children:c.label}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5",children:c.sublabel})]})]},c.decision)})}),r.jsx("div",{className:"px-6 pb-5 pt-1",children:r.jsx("p",{className:"text-[10px] text-gray-700 text-center",children:'This action cannot be undone · If unsure, choose "Create New Agent" first'})})]})})})}const D6="1.73.3";function I6(){const[e,t]=h.useState("idle"),[n,s]=h.useState(null),[i,a]=h.useState(""),[o,l]=h.useState(""),c=h.useRef(!1),d=h.useCallback(async()=>{var m,b;t("checking"),a("");try{const v=await $("/api/system/version");if(!v.ok)throw new Error(`Server returned ${v.status}`);const g=await v.json(),x=(g==null?void 0:g.current)??((m=g==null?void 0:g.data)==null?void 0:m.current),w=(g==null?void 0:g.latest)??((b=g==null?void 0:g.data)==null?void 0:b.latest);if(!x||!w)throw new Error("Version endpoint returned incomplete data");s({current:x,latest:w}),B6(w,x)>0?t("update-available"):(t("up-to-date"),setTimeout(()=>t("idle"),3e3))}catch(v){a((v==null?void 0:v.message)??"Check failed"),t("error"),setTimeout(()=>{t("idle"),a("")},4e3)}},[]);h.useEffect(()=>{if(e!=="restarting")return;const m=setTimeout(()=>window.close(),1e4),b=setInterval(async()=>{try{(await fetch("/api/system/health",{credentials:"include"})).ok&&(clearInterval(b),clearTimeout(m),c.current=!0,t("done"),window.close())}catch{}},3e3);return()=>{clearInterval(b),clearTimeout(m)}},[e]),h.useEffect(()=>{d()},[d]),h.useEffect(()=>{const b=setInterval(()=>{t(v=>((v==="idle"||v==="up-to-date")&&d(),v))},288e5);return()=>clearInterval(b)},[d]);const u=h.useCallback(async()=>{t("downloading"),l("");try{const m=await fetch("/api/system/update",{method:"POST",credentials:"include"});if(!m.body)throw new Error("No response body");const b=m.body.getReader(),v=new TextDecoder;let y="";for(;;){const{done:g,value:x}=await b.read();if(g)break;const w=v.decode(x);y+=w,l(j=>j+w)}y.includes("__MUSTB_SHUTTING_DOWN__")?t("restarting"):y.includes("❌")?(a("Install failed — see log above"),t("error"),setTimeout(()=>{t("idle"),a("")},5e3)):t("done")}catch(m){a((m==null?void 0:m.message)??"Update failed"),t("error")}},[]),p=h.useCallback(async()=>{t("restarting");try{await $("/api/system/restart",{method:"POST"})}catch{}const m=Be();let b=0;const v=setInterval(()=>{b++,m.connected&&(clearInterval(v),window.location.reload()),b>60&&clearInterval(v)},500)},[]),f=(n==null?void 0:n.current)??D6;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"fixed bottom-4 right-4 z-40 flex flex-col items-end gap-2",children:[!["update-available","downloading","done","restarting"].includes(e)&&r.jsxs("button",{onClick:e==="idle"||e==="up-to-date"||e==="error"?d:void 0,disabled:["checking","downloading","restarting"].includes(e),title:"Check for updates",className:Ze("flex items-center gap-2","py-2 px-4 rounded-full shadow-2xl","text-xs font-medium","transition-all duration-200",e==="update-available"?"bg-red-900/90 backdrop-blur-md border border-red-500/50 text-white hover:bg-red-800 hover:border-red-400/60":e==="error"?"bg-amber-900/90 backdrop-blur-md border border-amber-500/60 text-white hover:bg-amber-800 hover:border-amber-400/70":"bg-gray-900/90 backdrop-blur-md border border-gray-700/50 text-gray-300 hover:bg-gray-800 hover:border-gray-600/60 hover:text-white",["checking","downloading","restarting"].includes(e)&&"cursor-wait opacity-80"),children:[e==="checking"&&r.jsx(re,{size:13,className:"animate-spin text-orange-400 shrink-0"}),e==="update-available"&&r.jsx(Ri,{size:13,className:"text-red-300 shrink-0"}),e==="up-to-date"&&r.jsx(kr,{size:13,className:"text-emerald-400 shrink-0"}),e==="downloading"&&r.jsx(re,{size:13,className:"animate-spin text-orange-400 shrink-0"}),e==="done"&&r.jsx(kr,{size:13,className:"text-emerald-400 shrink-0"}),e==="restarting"&&r.jsx(re,{size:13,className:"animate-spin text-orange-400 shrink-0"}),e==="error"&&r.jsx(mt,{size:13,className:"text-amber-300 shrink-0"}),e==="idle"&&r.jsx(fe,{size:13,className:"text-gray-500 shrink-0"}),r.jsxs("span",{className:"tabular-nums",children:[r.jsx("span",{children:"Must-b v"}),r.jsx("span",{children:f})]}),e==="checking"&&r.jsx("span",{className:"text-orange-400/80",children:"Checking…"}),e==="up-to-date"&&r.jsx("span",{className:"text-emerald-400/80",children:"Up to date"}),e==="downloading"&&r.jsx("span",{className:"text-orange-400/80",children:"Installing…"}),e==="done"&&r.jsx("span",{className:"text-emerald-400/80",children:"Installed!"}),e==="restarting"&&r.jsx("span",{className:"text-orange-400/80",children:"Restarting…"}),e==="error"&&r.jsxs("span",{className:"text-amber-300/90 max-w-[140px] truncate",children:["Check failed",i?` — ${i}`:""]})]}),e==="update-available"&&n&&r.jsxs("div",{className:"flex flex-col gap-3 p-4 rounded-2xl bg-gray-900/95 border border-orange-500/30 backdrop-blur-md shadow-2xl w-60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ri,{size:16,className:"text-orange-400 shrink-0"}),r.jsx("span",{className:"text-orange-300 font-semibold text-sm",children:"Update Available"})]}),r.jsxs("div",{className:"text-gray-400 text-xs leading-relaxed",children:[r.jsx("span",{children:"Version "}),r.jsx("span",{className:"font-mono text-white",children:n.latest}),r.jsx("span",{children:" is ready to install."})]}),r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500",children:[r.jsxs("span",{children:["Current: ",r.jsx("span",{className:"font-mono",children:n.current})]}),r.jsxs("span",{children:["Latest: ",r.jsx("span",{className:"font-mono text-orange-300",children:n.latest})]})]}),r.jsxs("button",{onClick:u,className:"flex items-center justify-center gap-2 bg-orange-600 hover:bg-orange-500 active:scale-95 text-white rounded-xl py-2 text-xs font-semibold transition-all duration-150 shadow-lg shadow-orange-900/30",children:[r.jsx(Ri,{size:13}),r.jsx("span",{children:"Download & Install"})]}),r.jsx("button",{onClick:()=>t("idle"),className:"text-center text-[11px] text-gray-600 hover:text-gray-400 transition-colors",children:r.jsx("span",{children:"Dismiss"})})]}),e==="downloading"&&r.jsxs("div",{className:"p-4 rounded-2xl bg-gray-900/95 border border-white/10 backdrop-blur-md shadow-2xl w-60",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-orange-300 mb-3",children:[r.jsx(re,{size:13,className:"animate-spin shrink-0"}),r.jsx("span",{children:"Installing update…"})]}),r.jsx("pre",{className:"text-[10px] text-gray-400 max-h-24 overflow-y-auto whitespace-pre-wrap break-all font-mono bg-black/30 rounded-lg p-2",children:r.jsx("span",{children:o||"Connecting to npm registry…"})})]}),e==="done"&&!c.current&&r.jsxs("div",{className:"flex flex-col gap-3 p-4 rounded-2xl bg-gray-900/95 border border-emerald-500/30 backdrop-blur-md shadow-2xl w-60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kr,{size:16,className:"text-emerald-400 shrink-0"}),r.jsx("span",{className:"text-emerald-300 font-semibold text-sm",children:"Update Installed!"})]}),r.jsx("p",{className:"text-gray-400 text-xs",children:r.jsx("span",{children:"Restart Must-b to apply the new version."})}),r.jsxs("button",{onClick:p,className:"flex items-center justify-center gap-2 bg-emerald-700 hover:bg-emerald-600 active:scale-95 text-white rounded-xl py-2 text-xs font-semibold transition-all duration-150",children:[r.jsx(fe,{size:13}),r.jsx("span",{children:"Restart Now"})]})]})]}),e==="done"&&c.current&&r.jsx("div",{className:"fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-black",children:r.jsxs("div",{className:"font-mono text-center px-8 max-w-xl w-full",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 mb-8",children:[r.jsx(kr,{size:18,className:"text-green-400 shrink-0"}),r.jsx("span",{className:"text-green-400 text-xs tracking-widest uppercase",children:"must-b terminal"})]}),r.jsx("pre",{className:"text-green-400 text-sm leading-relaxed text-left inline-block",children:`╔══════════════════════════════════════════════════════╗
|
|
862
|
+
shadow-[0_24px_80px_rgba(0,0,0,0.7),0_0_0_1px_rgba(249,115,22,0.18)]`,onClick:s=>s.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-orange-500/12 shrink-0",children:[r.jsx("span",{className:"text-[13px] font-bold text-white/80",children:t}),r.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-full hover:bg-white/8 text-white/40 hover:text-white/70 transition-colors",children:r.jsx(He,{size:14})})]}),r.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[e==="memory"&&r.jsx(FP,{}),e==="plugins"&&r.jsx(UP,{}),e==="skills"&&r.jsx(GP,{}),e==="workspace"&&r.jsx(JP,{}),e==="livesight"&&r.jsx(ZP,{})]})]},"stage-card")]})}function z6(){const{t:e}=gt(),t=fs(),n=mn(),[s,i]=h.useState(!1),[a,o]=h.useState(""),[l,c]=h.useState(null),[d,u]=h.useState(!1);h.useEffect(()=>{const b=y=>{u(y.detail.active)};return window.addEventListener("mustb:safeMode",b),()=>window.removeEventListener("mustb:safeMode",b)},[]),h.useEffect(()=>{i(!1)},[t.pathname]),t.pathname,h.useCallback(b=>o(y=>y===b?"":b),[]),h.useCallback(b=>{c(b),o("")},[]);const p=h.useCallback(()=>c(null),[]),f=e.dock;f.cat_webTools,f.skill_webSearch,f.desc_webSearch,f.skill_webFetch,f.desc_webFetch,f.skill_browserControl,f.desc_browserControl,f.cat_fileMedia,f.skill_pdfReader,f.desc_pdfReader,f.skill_imageAnalysis,f.desc_imageAnalysis,f.skill_imageGeneration,f.desc_imageGeneration,f.skill_tts,f.desc_tts,f.cat_aiAgents,f.skills,f.skill_spawnAgent,f.desc_spawnAgent,f.skill_agentSessions,f.desc_agentSessions,f.skill_canvas,f.desc_canvas,f.skill_git,f.desc_git,f.cat_systemTools,f.skill_gateway,f.desc_gateway,f.skill_fileManager,f.desc_fileManager,f.skill_cron,f.desc_cron,f.skill_messages,f.desc_messages,f.cat_knowledgeBase,f.mem_browse,f.desc_memBrowse,f.mem_search,f.desc_memSearch,f.mem_add,f.desc_memAdd,f.cat_personalOrg,f.mem_contacts,f.desc_contacts,f.mem_calendar,f.desc_calendar,f.cat_pluginManager,f.plug_marketplace,f.desc_marketplace,f.plug_installed,f.desc_installed,f.plug_mcp,f.desc_mcp,f.cat_developer,f.plug_bundleMcp,f.desc_bundleMcp,f.plug_cliCmds,f.desc_cliCmds,f.cat_automation,f.wf_automations,f.desc_automations,f.wf_scheduled,f.desc_scheduled,f.wf_commands,f.desc_commands,f.cat_advanced,f.wf_nodes,f.desc_nodes,f.wf_multiAgent,f.desc_multiAgent;const m={memory:f.memory,plugins:f.plugins,skills:f.skills,workspace:f.files,livesight:"Visual Audit"};return r.jsx(L5,{reducedMotion:d?"always":"never",children:r.jsxs("div",{className:"relative min-h-screen overflow-x-hidden font-sans bg-transparent",children:[l&&r.jsx(R6,{panel:l,title:m[l],onClose:p}),r.jsx("div",{className:"fixed top-[14px] left-4 z-40 overflow-hidden",children:r.jsx("button",{onClick:()=>i(b=>!b),"aria-label":"Toggle sidebar",className:"p-2 rounded-full text-white/45 hover:text-white/90 hover:bg-white/8 transition-all leading-none",style:{backdropFilter:"blur(8px)",fontSize:0},children:r.jsx(NC,{size:17,"aria-hidden":"true",focusable:"false"})})}),r.jsxs("header",{className:"fixed top-0 inset-x-0 z-50 h-16 flex items-center justify-between px-6 pointer-events-none",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex items-center gap-2.5 shrink-0 pointer-events-auto",children:[r.jsxs(_i,{to:"/app/voice",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[12px] font-medium transition-all select-none ${t.pathname==="/app/voice"?"bg-orange-500/20 text-orange-300 border border-orange-500/30":"text-white/45 hover:text-white/85 hover:bg-white/8"}`,title:e.nav.voice,children:[r.jsx(iC,{size:14}),r.jsx("span",{className:"hidden sm:inline",children:e.nav.voice})]}),r.jsx(H.div,{initial:{opacity:0,x:12},animate:{opacity:1,x:0},transition:{duration:.4,delay:.15},className:"flex items-center gap-1 px-2 py-1.5 rounded-full",style:{background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.09)"},children:r.jsx(IP,{})}),r.jsx(u6,{})]})]}),r.jsx(ne,{children:s&&r.jsx(H.div,{initial:{x:-280},animate:{x:0},exit:{x:-280},transition:{type:"spring",stiffness:340,damping:34},className:"fixed top-0 left-0 bottom-0 z-30 w-[280px]",children:r.jsx(M6,{onClose:()=>i(!1)})},"sidebar-panel")}),r.jsx("main",{className:"relative min-h-screen pt-16 transition-[margin] duration-300 bg-transparent",style:{marginLeft:s?280:0},children:r.jsx(Dk,{})}),r.jsx(t6,{}),r.jsx(o6,{}),r.jsx(m6,{}),r.jsx(N6,{})]})})}const L6=[{decision:"duplicate",label:"Create New Agent",sublabel:"Keep both — cloud data is copied to a separate folder",icon:pC,accent:"border-blue-500/30 bg-blue-500/8 hover:border-blue-500/50 text-blue-400"},{decision:"restore",label:"Use Cloud (Overwrite)",sublabel:"Cloud wins — local memory is replaced with cloud version",icon:lC,accent:"border-orange-500/30 bg-orange-500/8 hover:border-orange-500/50 text-orange-400"},{decision:"upload",label:"Keep Mine",sublabel:"Local wins — cloud memory is overwritten with local data",icon:LC,accent:"border-green-500/30 bg-green-500/8 hover:border-green-500/50 text-green-400"}];function O6(){const[e,t]=h.useState(null),[n,s]=h.useState(!1),[i,a]=h.useState(!1);h.useEffect(()=>{const c=Be(),d=u=>{u.type==="CONFLICT_DETECTED"&&(t({localAgentName:u.localAgentName??null,cloudAgentName:u.cloudAgentName??null,localMtime:u.localMtime??null,cloudTimestamp:u.cloudTimestamp??null}),a(!1)),u.type==="syncResolveFinish"&&(a(!0),setTimeout(()=>{t(null),a(!1)},1800))};return c.on("agentUpdate",d),()=>{c.off("agentUpdate",d)}},[]);const o=async c=>{if(!n){s(!0);try{await fetch("/api/setup/sync-resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:c})})}catch{}s(!1)}},l=c=>{if(!c)return"—";try{return new Date(c).toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}catch{return c}};return r.jsx(ne,{children:e&&r.jsx(H.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/70 backdrop-blur-sm px-4",children:r.jsxs(H.div,{initial:{opacity:0,y:24,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:24,scale:.95},transition:{duration:.25},className:"w-full max-w-md bg-[#0c0f18] border border-white/10 rounded-2xl shadow-2xl overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3 px-6 py-5 border-b border-white/8 bg-amber-500/5",children:[r.jsx("div",{className:"w-9 h-9 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:r.jsx(ls,{size:18,className:"text-amber-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-white font-bold text-base",children:"Memory Conflict Detected"}),r.jsx("p",{className:"text-gray-500 text-xs mt-0.5",children:"Two agent identities found — action required"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 px-6 pt-5 pb-2",children:[r.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/3 px-4 py-3",children:[r.jsx("p",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest mb-1",children:"Local Agent"}),r.jsx("p",{className:"text-white font-bold text-sm",children:e.localAgentName??"—"}),r.jsx("p",{className:"text-gray-600 text-[10px] mt-1",children:l(e.localMtime)})]}),r.jsxs("div",{className:"rounded-xl border border-orange-500/20 bg-orange-500/5 px-4 py-3",children:[r.jsx("p",{className:"text-[10px] font-bold text-orange-400/60 uppercase tracking-widest mb-1",children:"Cloud Agent"}),r.jsx("p",{className:"text-orange-300 font-bold text-sm",children:e.cloudAgentName??"—"}),r.jsx("p",{className:"text-orange-400/40 text-[10px] mt-1",children:l(e.cloudTimestamp)})]})]}),r.jsx("div",{className:"px-6 py-4 space-y-2",children:i?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-green-400 text-sm font-semibold",children:[r.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-green-400 flex items-center justify-center text-[10px]",children:"✓"}),"Conflict resolved"]}):L6.map(c=>{const d=c.icon;return r.jsxs("button",{onClick:()=>o(c.decision),disabled:n,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl border transition-all text-left disabled:opacity-50 disabled:cursor-not-allowed ${c.accent}`,children:[n?r.jsx(re,{size:16,className:"animate-spin flex-shrink-0"}):r.jsx(d,{size:16,className:"flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm text-white",children:c.label}),r.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5",children:c.sublabel})]})]},c.decision)})}),r.jsx("div",{className:"px-6 pb-5 pt-1",children:r.jsx("p",{className:"text-[10px] text-gray-700 text-center",children:'This action cannot be undone · If unsure, choose "Create New Agent" first'})})]})})})}const D6="1.73.3";function I6(){const[e,t]=h.useState("idle"),[n,s]=h.useState(null),[i,a]=h.useState(""),[o,l]=h.useState(""),c=h.useRef(!1),d=h.useCallback(async()=>{var m,b;t("checking"),a("");try{const y=await $("/api/system/version");if(!y.ok)throw new Error(`Server returned ${y.status}`);const g=await y.json(),x=(g==null?void 0:g.current)??((m=g==null?void 0:g.data)==null?void 0:m.current),w=(g==null?void 0:g.latest)??((b=g==null?void 0:g.data)==null?void 0:b.latest);if(!x||!w)throw new Error("Version endpoint returned incomplete data");s({current:x,latest:w}),B6(w,x)>0?t("update-available"):(t("up-to-date"),setTimeout(()=>t("idle"),3e3))}catch(y){a((y==null?void 0:y.message)??"Check failed"),t("error"),setTimeout(()=>{t("idle"),a("")},4e3)}},[]);h.useEffect(()=>{if(e!=="restarting")return;const m=setTimeout(()=>window.close(),1e4),b=setInterval(async()=>{try{(await fetch("/api/system/health",{credentials:"include"})).ok&&(clearInterval(b),clearTimeout(m),c.current=!0,t("done"),window.close())}catch{}},3e3);return()=>{clearInterval(b),clearTimeout(m)}},[e]),h.useEffect(()=>{d()},[d]),h.useEffect(()=>{const b=setInterval(()=>{t(y=>((y==="idle"||y==="up-to-date")&&d(),y))},288e5);return()=>clearInterval(b)},[d]);const u=h.useCallback(async()=>{t("downloading"),l("");try{const m=await fetch("/api/system/update",{method:"POST",credentials:"include"});if(!m.body)throw new Error("No response body");const b=m.body.getReader(),y=new TextDecoder;let v="";for(;;){const{done:g,value:x}=await b.read();if(g)break;const w=y.decode(x);v+=w,l(j=>j+w)}v.includes("__MUSTB_SHUTTING_DOWN__")?t("restarting"):v.includes("❌")?(a("Install failed — see log above"),t("error"),setTimeout(()=>{t("idle"),a("")},5e3)):t("done")}catch(m){a((m==null?void 0:m.message)??"Update failed"),t("error")}},[]),p=h.useCallback(async()=>{t("restarting");try{await $("/api/system/restart",{method:"POST"})}catch{}const m=Be();let b=0;const y=setInterval(()=>{b++,m.connected&&(clearInterval(y),window.location.reload()),b>60&&clearInterval(y)},500)},[]),f=(n==null?void 0:n.current)??D6;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"fixed bottom-4 right-4 z-40 flex flex-col items-end gap-2",children:[!["update-available","downloading","done","restarting"].includes(e)&&r.jsxs("button",{onClick:e==="idle"||e==="up-to-date"||e==="error"?d:void 0,disabled:["checking","downloading","restarting"].includes(e),title:"Check for updates",className:Ze("flex items-center gap-2","py-2 px-4 rounded-full shadow-2xl","text-xs font-medium","transition-all duration-200",e==="update-available"?"bg-red-900/90 backdrop-blur-md border border-red-500/50 text-white hover:bg-red-800 hover:border-red-400/60":e==="error"?"bg-amber-900/90 backdrop-blur-md border border-amber-500/60 text-white hover:bg-amber-800 hover:border-amber-400/70":"bg-gray-900/90 backdrop-blur-md border border-gray-700/50 text-gray-300 hover:bg-gray-800 hover:border-gray-600/60 hover:text-white",["checking","downloading","restarting"].includes(e)&&"cursor-wait opacity-80"),children:[e==="checking"&&r.jsx(re,{size:13,className:"animate-spin text-orange-400 shrink-0"}),e==="update-available"&&r.jsx(Ri,{size:13,className:"text-red-300 shrink-0"}),e==="up-to-date"&&r.jsx(kr,{size:13,className:"text-emerald-400 shrink-0"}),e==="downloading"&&r.jsx(re,{size:13,className:"animate-spin text-orange-400 shrink-0"}),e==="done"&&r.jsx(kr,{size:13,className:"text-emerald-400 shrink-0"}),e==="restarting"&&r.jsx(re,{size:13,className:"animate-spin text-orange-400 shrink-0"}),e==="error"&&r.jsx(mt,{size:13,className:"text-amber-300 shrink-0"}),e==="idle"&&r.jsx(fe,{size:13,className:"text-gray-500 shrink-0"}),r.jsxs("span",{className:"tabular-nums",children:[r.jsx("span",{children:"Must-b v"}),r.jsx("span",{children:f})]}),e==="checking"&&r.jsx("span",{className:"text-orange-400/80",children:"Checking…"}),e==="up-to-date"&&r.jsx("span",{className:"text-emerald-400/80",children:"Up to date"}),e==="downloading"&&r.jsx("span",{className:"text-orange-400/80",children:"Installing…"}),e==="done"&&r.jsx("span",{className:"text-emerald-400/80",children:"Installed!"}),e==="restarting"&&r.jsx("span",{className:"text-orange-400/80",children:"Restarting…"}),e==="error"&&r.jsxs("span",{className:"text-amber-300/90 max-w-[140px] truncate",children:["Check failed",i?` — ${i}`:""]})]}),e==="update-available"&&n&&r.jsxs("div",{className:"flex flex-col gap-3 p-4 rounded-2xl bg-gray-900/95 border border-orange-500/30 backdrop-blur-md shadow-2xl w-60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ri,{size:16,className:"text-orange-400 shrink-0"}),r.jsx("span",{className:"text-orange-300 font-semibold text-sm",children:"Update Available"})]}),r.jsxs("div",{className:"text-gray-400 text-xs leading-relaxed",children:[r.jsx("span",{children:"Version "}),r.jsx("span",{className:"font-mono text-white",children:n.latest}),r.jsx("span",{children:" is ready to install."})]}),r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500",children:[r.jsxs("span",{children:["Current: ",r.jsx("span",{className:"font-mono",children:n.current})]}),r.jsxs("span",{children:["Latest: ",r.jsx("span",{className:"font-mono text-orange-300",children:n.latest})]})]}),r.jsxs("button",{onClick:u,className:"flex items-center justify-center gap-2 bg-orange-600 hover:bg-orange-500 active:scale-95 text-white rounded-xl py-2 text-xs font-semibold transition-all duration-150 shadow-lg shadow-orange-900/30",children:[r.jsx(Ri,{size:13}),r.jsx("span",{children:"Download & Install"})]}),r.jsx("button",{onClick:()=>t("idle"),className:"text-center text-[11px] text-gray-600 hover:text-gray-400 transition-colors",children:r.jsx("span",{children:"Dismiss"})})]}),e==="downloading"&&r.jsxs("div",{className:"p-4 rounded-2xl bg-gray-900/95 border border-white/10 backdrop-blur-md shadow-2xl w-60",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-orange-300 mb-3",children:[r.jsx(re,{size:13,className:"animate-spin shrink-0"}),r.jsx("span",{children:"Installing update…"})]}),r.jsx("pre",{className:"text-[10px] text-gray-400 max-h-24 overflow-y-auto whitespace-pre-wrap break-all font-mono bg-black/30 rounded-lg p-2",children:r.jsx("span",{children:o||"Connecting to npm registry…"})})]}),e==="done"&&!c.current&&r.jsxs("div",{className:"flex flex-col gap-3 p-4 rounded-2xl bg-gray-900/95 border border-emerald-500/30 backdrop-blur-md shadow-2xl w-60",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kr,{size:16,className:"text-emerald-400 shrink-0"}),r.jsx("span",{className:"text-emerald-300 font-semibold text-sm",children:"Update Installed!"})]}),r.jsx("p",{className:"text-gray-400 text-xs",children:r.jsx("span",{children:"Restart Must-b to apply the new version."})}),r.jsxs("button",{onClick:p,className:"flex items-center justify-center gap-2 bg-emerald-700 hover:bg-emerald-600 active:scale-95 text-white rounded-xl py-2 text-xs font-semibold transition-all duration-150",children:[r.jsx(fe,{size:13}),r.jsx("span",{children:"Restart Now"})]})]})]}),e==="done"&&c.current&&r.jsx("div",{className:"fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-black",children:r.jsxs("div",{className:"font-mono text-center px-8 max-w-xl w-full",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 mb-8",children:[r.jsx(kr,{size:18,className:"text-green-400 shrink-0"}),r.jsx("span",{className:"text-green-400 text-xs tracking-widest uppercase",children:"must-b terminal"})]}),r.jsx("pre",{className:"text-green-400 text-sm leading-relaxed text-left inline-block",children:`╔══════════════════════════════════════════════════════╗
|
|
862
863
|
║ ║
|
|
863
864
|
║ MUST-B IS BACK ONLINE ║
|
|
864
865
|
║ ───────────────────────────────────────────── ║
|