dorkos 0.17.1 → 0.17.2
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/bin/cli.js +5 -5
- package/dist/client/assets/{TopologyGraph-D5wrT_gg.js → TopologyGraph-8CSPQVAk.js} +1 -1
- package/dist/client/assets/{highlighted-body-TPN3WLV5-Cdu5M8r2.js → highlighted-body-TPN3WLV5-DFPa3ej5.js} +1 -1
- package/dist/client/assets/{index-Ds1LTep8.js → index-BktypfRN.js} +4 -4
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TopologyGraph-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TopologyGraph-8CSPQVAk.js","assets/TopologyGraph-C7eadB24.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var z$=Object.defineProperty;var Oj=e=>{throw TypeError(e)};var H$=(e,t,n)=>t in e?z$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var lt=(e,t,n)=>H$(e,typeof t!="symbol"?t+"":t,n),y1=(e,t,n)=>t.has(e)||Oj("Cannot "+n);var re=(e,t,n)=>(y1(e,t,"read from private field"),n?n.call(e):t.get(e)),nt=(e,t,n)=>t.has(e)?Oj("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ze=(e,t,n,r)=>(y1(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),St=(e,t,n)=>(y1(e,t,"access private method"),n);var Jm=(e,t,n,r)=>({set _(s){ze(e,t,s,n)},get _(){return re(e,t,r)}});function U$(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();const $$="modulepreload",V$=function(e){return"/"+e},Ij={},W0=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));s=l(n.map(f=>{if(f=V$(f),f in Ij)return;Ij[f]=!0;const m=f.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const x=document.createElement("link");if(x.rel=m?"stylesheet":$$,m||(x.as="script"),x.crossOrigin="",x.href=f,d&&x.setAttribute("nonce",d),document.head.appendChild(x),m)return new Promise((b,v)=>{x.addEventListener("load",b),x.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function a(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return s.then(l=>{for(const c of l||[])c.status==="rejected"&&a(c.reason);return t().catch(a)})};var _Ae=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var v1={exports:{}},Uf={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -48,7 +48,7 @@ var z$=Object.defineProperty;var Oj=e=>{throw TypeError(e)};var H$=(e,t,n)=>t in
|
|
|
48
48
|
Error generating stack: `+y.message+`
|
|
49
49
|
`+y.stack}}var ct=Object.prototype.hasOwnProperty,Mt=e.unstable_scheduleCallback,un=e.unstable_cancelCallback,Zt=e.unstable_shouldYield,wn=e.unstable_requestPaint,Xt=e.unstable_now,Ie=e.unstable_getCurrentPriorityLevel,se=e.unstable_ImmediatePriority,Ee=e.unstable_UserBlockingPriority,Me=e.unstable_NormalPriority,qe=e.unstable_LowPriority,et=e.unstable_IdlePriority,Ht=e.log,Kt=e.unstable_setDisableYieldValue,Jt=null,en=null;function gn(o){if(typeof Ht=="function"&&Kt(o),en&&typeof en.setStrictMode=="function")try{en.setStrictMode(Jt,o)}catch{}}var kt=Math.clz32?Math.clz32:Xe,cr=Math.log,_n=Math.LN2;function Xe(o){return o>>>=0,o===0?32:31-(cr(o)/_n|0)|0}var ht=256,Pt=262144,xt=4194304;function Ue(o){var u=o&42;if(u!==0)return u;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function $e(o,u,h){var y=o.pendingLanes;if(y===0)return 0;var T=0,C=o.suspendedLanes,O=o.pingedLanes;o=o.warmLanes;var H=y&134217727;return H!==0?(y=H&~C,y!==0?T=Ue(y):(O&=H,O!==0?T=Ue(O):h||(h=H&~o,h!==0&&(T=Ue(h))))):(H=y&~C,H!==0?T=Ue(H):O!==0?T=Ue(O):h||(h=y&~o,h!==0&&(T=Ue(h)))),T===0?0:u!==0&&u!==T&&(u&C)===0&&(C=T&-T,h=u&-u,C>=h||C===32&&(h&4194048)!==0)?u:T}function rt(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function pt(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function bt(){var o=xt;return xt<<=1,(xt&62914560)===0&&(xt=4194304),o}function dn(o){for(var u=[],h=0;31>h;h++)u.push(o);return u}function Ct(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function mt(o,u,h,y,T,C){var O=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var H=o.entanglements,ne=o.expirationTimes,he=o.hiddenUpdates;for(h=O&~h;0<h;){var Te=31-kt(h),Ce=1<<Te;H[Te]=0,ne[Te]=-1;var me=he[Te];if(me!==null)for(he[Te]=null,Te=0;Te<me.length;Te++){var be=me[Te];be!==null&&(be.lane&=-536870913)}h&=~Ce}y!==0&&Ut(o,y,0),C!==0&&T===0&&o.tag!==0&&(o.suspendedLanes|=C&~(O&~u))}function Ut(o,u,h){o.pendingLanes|=u,o.suspendedLanes&=~u;var y=31-kt(u);o.entangledLanes|=u,o.entanglements[y]=o.entanglements[y]|1073741824|h&261930}function tn(o,u){var h=o.entangledLanes|=u;for(o=o.entanglements;h;){var y=31-kt(h),T=1<<y;T&u|o[y]&u&&(o[y]|=u),h&=~T}}function Un(o,u){var h=u&-u;return h=(h&42)!==0?1:ta(h),(h&(o.suspendedLanes|u))!==0?0:h}function ta(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function ss(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function js(){var o=$.p;return o!==0?o:(o=window.event,o===void 0?32:kj(o.type))}function Qd(o,u){var h=$.p;try{return $.p=o,u()}finally{$.p=h}}var Yi=Math.random().toString(36).slice(2),xr="__reactFiber$"+Yi,zr="__reactProps$"+Yi,_c="__reactContainer$"+Yi,ub="__reactEvents$"+Yi,jH="__reactListeners$"+Yi,_H="__reactHandles$"+Yi,VC="__reactResources$"+Yi,Zd="__reactMarker$"+Yi;function db(o){delete o[xr],delete o[zr],delete o[ub],delete o[jH],delete o[_H]}function Rc(o){var u=o[xr];if(u)return u;for(var h=o.parentNode;h;){if(u=h[_c]||h[xr]){if(h=u.alternate,u.child!==null||h!==null&&h.child!==null)for(o=dj(o);o!==null;){if(h=o[xr])return h;o=dj(o)}return u}o=h,h=o.parentNode}return null}function Dc(o){if(o=o[xr]||o[_c]){var u=o.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return o}return null}function Jd(o){var u=o.tag;if(u===5||u===26||u===27||u===6)return o.stateNode;throw Error(r(33))}function Mc(o){var u=o[VC];return u||(u=o[VC]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function ur(o){o[Zd]=!0}var qC=new Set,GC={};function al(o,u){Oc(o,u),Oc(o+"Capture",u)}function Oc(o,u){for(GC[o]=u,o=0;o<u.length;o++)qC.add(u[o])}var RH=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),YC={},KC={};function DH(o){return ct.call(KC,o)?!0:ct.call(YC,o)?!1:RH.test(o)?KC[o]=!0:(YC[o]=!0,!1)}function Hp(o,u,h){if(DH(u))if(h===null)o.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":o.removeAttribute(u);return;case"boolean":var y=u.toLowerCase().slice(0,5);if(y!=="data-"&&y!=="aria-"){o.removeAttribute(u);return}}o.setAttribute(u,""+h)}}function Up(o,u,h){if(h===null)o.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttribute(u,""+h)}}function ei(o,u,h,y){if(y===null)o.removeAttribute(h);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(h);return}o.setAttributeNS(u,h,""+y)}}function _s(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function WC(o){var u=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function MH(o,u,h){var y=Object.getOwnPropertyDescriptor(o.constructor.prototype,u);if(!o.hasOwnProperty(u)&&typeof y<"u"&&typeof y.get=="function"&&typeof y.set=="function"){var T=y.get,C=y.set;return Object.defineProperty(o,u,{configurable:!0,get:function(){return T.call(this)},set:function(O){h=""+O,C.call(this,O)}}),Object.defineProperty(o,u,{enumerable:y.enumerable}),{getValue:function(){return h},setValue:function(O){h=""+O},stopTracking:function(){o._valueTracker=null,delete o[u]}}}}function fb(o){if(!o._valueTracker){var u=WC(o)?"checked":"value";o._valueTracker=MH(o,u,""+o[u])}}function XC(o){if(!o)return!1;var u=o._valueTracker;if(!u)return!0;var h=u.getValue(),y="";return o&&(y=WC(o)?o.checked?"true":"false":o.value),o=y,o!==h?(u.setValue(o),!0):!1}function $p(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var OH=/[\n"\\]/g;function Rs(o){return o.replace(OH,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function hb(o,u,h,y,T,C,O,H){o.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?o.type=O:o.removeAttribute("type"),u!=null?O==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+_s(u)):o.value!==""+_s(u)&&(o.value=""+_s(u)):O!=="submit"&&O!=="reset"||o.removeAttribute("value"),u!=null?pb(o,O,_s(u)):h!=null?pb(o,O,_s(h)):y!=null&&o.removeAttribute("value"),T==null&&C!=null&&(o.defaultChecked=!!C),T!=null&&(o.checked=T&&typeof T!="function"&&typeof T!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?o.name=""+_s(H):o.removeAttribute("name")}function QC(o,u,h,y,T,C,O,H){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(o.type=C),u!=null||h!=null){if(!(C!=="submit"&&C!=="reset"||u!=null)){fb(o);return}h=h!=null?""+_s(h):"",u=u!=null?""+_s(u):h,H||u===o.value||(o.value=u),o.defaultValue=u}y=y??T,y=typeof y!="function"&&typeof y!="symbol"&&!!y,o.checked=H?o.checked:!!y,o.defaultChecked=!!y,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(o.name=O),fb(o)}function pb(o,u,h){u==="number"&&$p(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function Ic(o,u,h,y){if(o=o.options,u){u={};for(var T=0;T<h.length;T++)u["$"+h[T]]=!0;for(h=0;h<o.length;h++)T=u.hasOwnProperty("$"+o[h].value),o[h].selected!==T&&(o[h].selected=T),T&&y&&(o[h].defaultSelected=!0)}else{for(h=""+_s(h),u=null,T=0;T<o.length;T++){if(o[T].value===h){o[T].selected=!0,y&&(o[T].defaultSelected=!0);return}u!==null||o[T].disabled||(u=o[T])}u!==null&&(u.selected=!0)}}function ZC(o,u,h){if(u!=null&&(u=""+_s(u),u!==o.value&&(o.value=u),h==null)){o.defaultValue!==u&&(o.defaultValue=u);return}o.defaultValue=h!=null?""+_s(h):""}function JC(o,u,h,y){if(u==null){if(y!=null){if(h!=null)throw Error(r(92));if(W(y)){if(1<y.length)throw Error(r(93));y=y[0]}h=y}h==null&&(h=""),u=h}h=_s(u),o.defaultValue=h,y=o.textContent,y===h&&y!==""&&y!==null&&(o.value=y),fb(o)}function Lc(o,u){if(u){var h=o.firstChild;if(h&&h===o.lastChild&&h.nodeType===3){h.nodeValue=u;return}}o.textContent=u}var IH=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function eN(o,u,h){var y=u.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?y?o.setProperty(u,""):u==="float"?o.cssFloat="":o[u]="":y?o.setProperty(u,h):typeof h!="number"||h===0||IH.has(u)?u==="float"?o.cssFloat=h:o[u]=(""+h).trim():o[u]=h+"px"}function tN(o,u,h){if(u!=null&&typeof u!="object")throw Error(r(62));if(o=o.style,h!=null){for(var y in h)!h.hasOwnProperty(y)||u!=null&&u.hasOwnProperty(y)||(y.indexOf("--")===0?o.setProperty(y,""):y==="float"?o.cssFloat="":o[y]="");for(var T in u)y=u[T],u.hasOwnProperty(T)&&h[T]!==y&&eN(o,T,y)}else for(var C in u)u.hasOwnProperty(C)&&eN(o,C,u[C])}function mb(o){if(o.indexOf("-")===-1)return!1;switch(o){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 LH=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),PH=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Vp(o){return PH.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function ti(){}var gb=null;function xb(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Pc=null,Bc=null;function nN(o){var u=Dc(o);if(u&&(o=u.stateNode)){var h=o[zr]||null;e:switch(o=u.stateNode,u.type){case"input":if(hb(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),u=h.name,h.type==="radio"&&u!=null){for(h=o;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+Rs(""+u)+'"][type="radio"]'),u=0;u<h.length;u++){var y=h[u];if(y!==o&&y.form===o.form){var T=y[zr]||null;if(!T)throw Error(r(90));hb(y,T.value,T.defaultValue,T.defaultValue,T.checked,T.defaultChecked,T.type,T.name)}}for(u=0;u<h.length;u++)y=h[u],y.form===o.form&&XC(y)}break e;case"textarea":ZC(o,h.value,h.defaultValue);break e;case"select":u=h.value,u!=null&&Ic(o,!!h.multiple,u,!1)}}}var bb=!1;function rN(o,u,h){if(bb)return o(u,h);bb=!0;try{var y=o(u);return y}finally{if(bb=!1,(Pc!==null||Bc!==null)&&(Rm(),Pc&&(u=Pc,o=Bc,Bc=Pc=null,nN(u),o)))for(u=0;u<o.length;u++)nN(o[u])}}function ef(o,u){var h=o.stateNode;if(h===null)return null;var y=h[zr]||null;if(y===null)return null;h=y[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(o=o.type,y=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!y;break e;default:o=!1}if(o)return null;if(h&&typeof h!="function")throw Error(r(231,u,typeof h));return h}var ni=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yb=!1;if(ni)try{var tf={};Object.defineProperty(tf,"passive",{get:function(){yb=!0}}),window.addEventListener("test",tf,tf),window.removeEventListener("test",tf,tf)}catch{yb=!1}var Ki=null,vb=null,qp=null;function sN(){if(qp)return qp;var o,u=vb,h=u.length,y,T="value"in Ki?Ki.value:Ki.textContent,C=T.length;for(o=0;o<h&&u[o]===T[o];o++);var O=h-o;for(y=1;y<=O&&u[h-y]===T[C-y];y++);return qp=T.slice(o,1<y?1-y:void 0)}function Gp(o){var u=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&u===13&&(o=13)):o=u,o===10&&(o=13),32<=o||o===13?o:0}function Yp(){return!0}function aN(){return!1}function Hr(o){function u(h,y,T,C,O){this._reactName=h,this._targetInst=T,this.type=y,this.nativeEvent=C,this.target=O,this.currentTarget=null;for(var H in o)o.hasOwnProperty(H)&&(h=o[H],this[H]=h?h(C):C[H]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?Yp:aN,this.isPropagationStopped=aN,this}return p(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=Yp)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=Yp)},persist:function(){},isPersistent:Yp}),u}var il={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kp=Hr(il),nf=p({},il,{view:0,detail:0}),BH=Hr(nf),Eb,Tb,rf,Wp=p({},nf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wb,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==rf&&(rf&&o.type==="mousemove"?(Eb=o.screenX-rf.screenX,Tb=o.screenY-rf.screenY):Tb=Eb=0,rf=o),Eb)},movementY:function(o){return"movementY"in o?o.movementY:Tb}}),iN=Hr(Wp),FH=p({},Wp,{dataTransfer:0}),zH=Hr(FH),HH=p({},nf,{relatedTarget:0}),Sb=Hr(HH),UH=p({},il,{animationName:0,elapsedTime:0,pseudoElement:0}),$H=Hr(UH),VH=p({},il,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),qH=Hr(VH),GH=p({},il,{data:0}),oN=Hr(GH),YH={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KH={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"},WH={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function XH(o){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(o):(o=WH[o])?!!u[o]:!1}function wb(){return XH}var QH=p({},nf,{key:function(o){if(o.key){var u=YH[o.key]||o.key;if(u!=="Unidentified")return u}return o.type==="keypress"?(o=Gp(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?KH[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wb,charCode:function(o){return o.type==="keypress"?Gp(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Gp(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),ZH=Hr(QH),JH=p({},Wp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lN=Hr(JH),eU=p({},nf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wb}),tU=Hr(eU),nU=p({},il,{propertyName:0,elapsedTime:0,pseudoElement:0}),rU=Hr(nU),sU=p({},Wp,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),aU=Hr(sU),iU=p({},il,{newState:0,oldState:0}),oU=Hr(iU),lU=[9,13,27,32],Cb=ni&&"CompositionEvent"in window,sf=null;ni&&"documentMode"in document&&(sf=document.documentMode);var cU=ni&&"TextEvent"in window&&!sf,cN=ni&&(!Cb||sf&&8<sf&&11>=sf),uN=" ",dN=!1;function fN(o,u){switch(o){case"keyup":return lU.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hN(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Fc=!1;function uU(o,u){switch(o){case"compositionend":return hN(u);case"keypress":return u.which!==32?null:(dN=!0,uN);case"textInput":return o=u.data,o===uN&&dN?null:o;default:return null}}function dU(o,u){if(Fc)return o==="compositionend"||!Cb&&fN(o,u)?(o=sN(),qp=vb=Ki=null,Fc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return cN&&u.locale!=="ko"?null:u.data;default:return null}}var fU={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 pN(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u==="input"?!!fU[o.type]:u==="textarea"}function mN(o,u,h,y){Pc?Bc?Bc.push(y):Bc=[y]:Pc=y,u=Bm(u,"onChange"),0<u.length&&(h=new Kp("onChange","change",null,h,y),o.push({event:h,listeners:u}))}var af=null,of=null;function hU(o){QA(o,0)}function Xp(o){var u=Jd(o);if(XC(u))return o}function gN(o,u){if(o==="change")return u}var xN=!1;if(ni){var Nb;if(ni){var kb="oninput"in document;if(!kb){var bN=document.createElement("div");bN.setAttribute("oninput","return;"),kb=typeof bN.oninput=="function"}Nb=kb}else Nb=!1;xN=Nb&&(!document.documentMode||9<document.documentMode)}function yN(){af&&(af.detachEvent("onpropertychange",vN),of=af=null)}function vN(o){if(o.propertyName==="value"&&Xp(of)){var u=[];mN(u,of,o,xb(o)),rN(hU,u)}}function pU(o,u,h){o==="focusin"?(yN(),af=u,of=h,af.attachEvent("onpropertychange",vN)):o==="focusout"&&yN()}function mU(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Xp(of)}function gU(o,u){if(o==="click")return Xp(u)}function xU(o,u){if(o==="input"||o==="change")return Xp(u)}function bU(o,u){return o===u&&(o!==0||1/o===1/u)||o!==o&&u!==u}var as=typeof Object.is=="function"?Object.is:bU;function lf(o,u){if(as(o,u))return!0;if(typeof o!="object"||o===null||typeof u!="object"||u===null)return!1;var h=Object.keys(o),y=Object.keys(u);if(h.length!==y.length)return!1;for(y=0;y<h.length;y++){var T=h[y];if(!ct.call(u,T)||!as(o[T],u[T]))return!1}return!0}function EN(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function TN(o,u){var h=EN(o);o=0;for(var y;h;){if(h.nodeType===3){if(y=o+h.textContent.length,o<=u&&y>=u)return{node:h,offset:u-o};o=y}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=EN(h)}}function SN(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?SN(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function wN(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=$p(o.document);u instanceof o.HTMLIFrameElement;){try{var h=typeof u.contentWindow.location.href=="string"}catch{h=!1}if(h)o=u.contentWindow;else break;u=$p(o.document)}return u}function Ab(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var yU=ni&&"documentMode"in document&&11>=document.documentMode,zc=null,jb=null,cf=null,_b=!1;function CN(o,u,h){var y=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;_b||zc==null||zc!==$p(y)||(y=zc,"selectionStart"in y&&Ab(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),cf&&lf(cf,y)||(cf=y,y=Bm(jb,"onSelect"),0<y.length&&(u=new Kp("onSelect","select",null,u,h),o.push({event:u,listeners:y}),u.target=zc)))}function ol(o,u){var h={};return h[o.toLowerCase()]=u.toLowerCase(),h["Webkit"+o]="webkit"+u,h["Moz"+o]="moz"+u,h}var Hc={animationend:ol("Animation","AnimationEnd"),animationiteration:ol("Animation","AnimationIteration"),animationstart:ol("Animation","AnimationStart"),transitionrun:ol("Transition","TransitionRun"),transitionstart:ol("Transition","TransitionStart"),transitioncancel:ol("Transition","TransitionCancel"),transitionend:ol("Transition","TransitionEnd")},Rb={},NN={};ni&&(NN=document.createElement("div").style,"AnimationEvent"in window||(delete Hc.animationend.animation,delete Hc.animationiteration.animation,delete Hc.animationstart.animation),"TransitionEvent"in window||delete Hc.transitionend.transition);function ll(o){if(Rb[o])return Rb[o];if(!Hc[o])return o;var u=Hc[o],h;for(h in u)if(u.hasOwnProperty(h)&&h in NN)return Rb[o]=u[h];return o}var kN=ll("animationend"),AN=ll("animationiteration"),jN=ll("animationstart"),vU=ll("transitionrun"),EU=ll("transitionstart"),TU=ll("transitioncancel"),_N=ll("transitionend"),RN=new Map,Db="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Db.push("scrollEnd");function na(o,u){RN.set(o,u),al(u,[o])}var Qp=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Ds=[],Uc=0,Mb=0;function Zp(){for(var o=Uc,u=Mb=Uc=0;u<o;){var h=Ds[u];Ds[u++]=null;var y=Ds[u];Ds[u++]=null;var T=Ds[u];Ds[u++]=null;var C=Ds[u];if(Ds[u++]=null,y!==null&&T!==null){var O=y.pending;O===null?T.next=T:(T.next=O.next,O.next=T),y.pending=T}C!==0&&DN(h,T,C)}}function Jp(o,u,h,y){Ds[Uc++]=o,Ds[Uc++]=u,Ds[Uc++]=h,Ds[Uc++]=y,Mb|=y,o.lanes|=y,o=o.alternate,o!==null&&(o.lanes|=y)}function Ob(o,u,h,y){return Jp(o,u,h,y),em(o)}function cl(o,u){return Jp(o,null,null,u),em(o)}function DN(o,u,h){o.lanes|=h;var y=o.alternate;y!==null&&(y.lanes|=h);for(var T=!1,C=o.return;C!==null;)C.childLanes|=h,y=C.alternate,y!==null&&(y.childLanes|=h),C.tag===22&&(o=C.stateNode,o===null||o._visibility&1||(T=!0)),o=C,C=C.return;return o.tag===3?(C=o.stateNode,T&&u!==null&&(T=31-kt(h),o=C.hiddenUpdates,y=o[T],y===null?o[T]=[u]:y.push(u),u.lane=h|536870912),C):null}function em(o){if(50<Rf)throw Rf=0,$y=null,Error(r(185));for(var u=o.return;u!==null;)o=u,u=o.return;return o.tag===3?o.stateNode:null}var $c={};function SU(o,u,h,y){this.tag=o,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function is(o,u,h,y){return new SU(o,u,h,y)}function Ib(o){return o=o.prototype,!(!o||!o.isReactComponent)}function ri(o,u){var h=o.alternate;return h===null?(h=is(o.tag,u,o.key,o.mode),h.elementType=o.elementType,h.type=o.type,h.stateNode=o.stateNode,h.alternate=o,o.alternate=h):(h.pendingProps=u,h.type=o.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=o.flags&65011712,h.childLanes=o.childLanes,h.lanes=o.lanes,h.child=o.child,h.memoizedProps=o.memoizedProps,h.memoizedState=o.memoizedState,h.updateQueue=o.updateQueue,u=o.dependencies,h.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},h.sibling=o.sibling,h.index=o.index,h.ref=o.ref,h.refCleanup=o.refCleanup,h}function MN(o,u){o.flags&=65011714;var h=o.alternate;return h===null?(o.childLanes=0,o.lanes=u,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=h.childLanes,o.lanes=h.lanes,o.child=h.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=h.memoizedProps,o.memoizedState=h.memoizedState,o.updateQueue=h.updateQueue,o.type=h.type,u=h.dependencies,o.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),o}function tm(o,u,h,y,T,C){var O=0;if(y=o,typeof o=="function")Ib(o)&&(O=1);else if(typeof o=="string")O=A$(o,h,Z.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case L:return o=is(31,h,u,T),o.elementType=L,o.lanes=C,o;case E:return ul(h.children,T,C,u);case w:O=8,T|=24;break;case S:return o=is(12,h,u,T|2),o.elementType=S,o.lanes=C,o;case R:return o=is(13,h,u,T),o.elementType=R,o.lanes=C,o;case _:return o=is(19,h,u,T),o.elementType=_,o.lanes=C,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case A:O=10;break e;case N:O=9;break e;case j:O=11;break e;case D:O=14;break e;case I:O=16,y=null;break e}O=29,h=Error(r(130,o===null?"null":typeof o,"")),y=null}return u=is(O,h,u,T),u.elementType=o,u.type=y,u.lanes=C,u}function ul(o,u,h,y){return o=is(7,o,y,u),o.lanes=h,o}function Lb(o,u,h){return o=is(6,o,null,u),o.lanes=h,o}function ON(o){var u=is(18,null,null,0);return u.stateNode=o,u}function Pb(o,u,h){return u=is(4,o.children!==null?o.children:[],o.key,u),u.lanes=h,u.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},u}var IN=new WeakMap;function Ms(o,u){if(typeof o=="object"&&o!==null){var h=IN.get(o);return h!==void 0?h:(u={value:o,source:u,stack:at(u)},IN.set(o,u),u)}return{value:o,source:u,stack:at(u)}}var Vc=[],qc=0,nm=null,uf=0,Os=[],Is=0,Wi=null,wa=1,Ca="";function si(o,u){Vc[qc++]=uf,Vc[qc++]=nm,nm=o,uf=u}function LN(o,u,h){Os[Is++]=wa,Os[Is++]=Ca,Os[Is++]=Wi,Wi=o;var y=wa;o=Ca;var T=32-kt(y)-1;y&=~(1<<T),h+=1;var C=32-kt(u)+T;if(30<C){var O=T-T%5;C=(y&(1<<O)-1).toString(32),y>>=O,T-=O,wa=1<<32-kt(u)+T|h<<T|y,Ca=C+o}else wa=1<<C|h<<T|y,Ca=o}function Bb(o){o.return!==null&&(si(o,1),LN(o,1,0))}function Fb(o){for(;o===nm;)nm=Vc[--qc],Vc[qc]=null,uf=Vc[--qc],Vc[qc]=null;for(;o===Wi;)Wi=Os[--Is],Os[Is]=null,Ca=Os[--Is],Os[Is]=null,wa=Os[--Is],Os[Is]=null}function PN(o,u){Os[Is++]=wa,Os[Is++]=Ca,Os[Is++]=Wi,wa=u.id,Ca=u.overflow,Wi=o}var br=null,bn=null,Bt=!1,Xi=null,Ls=!1,zb=Error(r(519));function Qi(o){var u=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw df(Ms(u,o)),zb}function BN(o){var u=o.stateNode,h=o.type,y=o.memoizedProps;switch(u[xr]=o,u[zr]=y,h){case"dialog":Rt("cancel",u),Rt("close",u);break;case"iframe":case"object":case"embed":Rt("load",u);break;case"video":case"audio":for(h=0;h<Mf.length;h++)Rt(Mf[h],u);break;case"source":Rt("error",u);break;case"img":case"image":case"link":Rt("error",u),Rt("load",u);break;case"details":Rt("toggle",u);break;case"input":Rt("invalid",u),QC(u,y.value,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name,!0);break;case"select":Rt("invalid",u);break;case"textarea":Rt("invalid",u),JC(u,y.value,y.defaultValue,y.children)}h=y.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||u.textContent===""+h||y.suppressHydrationWarning===!0||tj(u.textContent,h)?(y.popover!=null&&(Rt("beforetoggle",u),Rt("toggle",u)),y.onScroll!=null&&Rt("scroll",u),y.onScrollEnd!=null&&Rt("scrollend",u),y.onClick!=null&&(u.onclick=ti),u=!0):u=!1,u||Qi(o,!0)}function FN(o){for(br=o.return;br;)switch(br.tag){case 5:case 31:case 13:Ls=!1;return;case 27:case 3:Ls=!0;return;default:br=br.return}}function Gc(o){if(o!==br)return!1;if(!Bt)return FN(o),Bt=!0,!1;var u=o.tag,h;if((h=u!==3&&u!==27)&&((h=u===5)&&(h=o.type,h=!(h!=="form"&&h!=="button")||s1(o.type,o.memoizedProps)),h=!h),h&&bn&&Qi(o),FN(o),u===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));bn=uj(o)}else if(u===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));bn=uj(o)}else u===27?(u=bn,fo(o.type)?(o=c1,c1=null,bn=o):bn=u):bn=br?Bs(o.stateNode.nextSibling):null;return!0}function dl(){bn=br=null,Bt=!1}function Hb(){var o=Xi;return o!==null&&(qr===null?qr=o:qr.push.apply(qr,o),Xi=null),o}function df(o){Xi===null?Xi=[o]:Xi.push(o)}var Ub=U(null),fl=null,ai=null;function Zi(o,u,h){M(Ub,u._currentValue),u._currentValue=h}function ii(o){o._currentValue=Ub.current,V(Ub)}function $b(o,u,h){for(;o!==null;){var y=o.alternate;if((o.childLanes&u)!==u?(o.childLanes|=u,y!==null&&(y.childLanes|=u)):y!==null&&(y.childLanes&u)!==u&&(y.childLanes|=u),o===h)break;o=o.return}}function Vb(o,u,h,y){var T=o.child;for(T!==null&&(T.return=o);T!==null;){var C=T.dependencies;if(C!==null){var O=T.child;C=C.firstContext;e:for(;C!==null;){var H=C;C=T;for(var ne=0;ne<u.length;ne++)if(H.context===u[ne]){C.lanes|=h,H=C.alternate,H!==null&&(H.lanes|=h),$b(C.return,h,o),y||(O=null);break e}C=H.next}}else if(T.tag===18){if(O=T.return,O===null)throw Error(r(341));O.lanes|=h,C=O.alternate,C!==null&&(C.lanes|=h),$b(O,h,o),O=null}else O=T.child;if(O!==null)O.return=T;else for(O=T;O!==null;){if(O===o){O=null;break}if(T=O.sibling,T!==null){T.return=O.return,O=T;break}O=O.return}T=O}}function Yc(o,u,h,y){o=null;for(var T=u,C=!1;T!==null;){if(!C){if((T.flags&524288)!==0)C=!0;else if((T.flags&262144)!==0)break}if(T.tag===10){var O=T.alternate;if(O===null)throw Error(r(387));if(O=O.memoizedProps,O!==null){var H=T.type;as(T.pendingProps.value,O.value)||(o!==null?o.push(H):o=[H])}}else if(T===ie.current){if(O=T.alternate,O===null)throw Error(r(387));O.memoizedState.memoizedState!==T.memoizedState.memoizedState&&(o!==null?o.push(Bf):o=[Bf])}T=T.return}o!==null&&Vb(u,o,h,y),u.flags|=262144}function rm(o){for(o=o.firstContext;o!==null;){if(!as(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function hl(o){fl=o,ai=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function yr(o){return zN(fl,o)}function sm(o,u){return fl===null&&hl(o),zN(o,u)}function zN(o,u){var h=u._currentValue;if(u={context:u,memoizedValue:h,next:null},ai===null){if(o===null)throw Error(r(308));ai=u,o.dependencies={lanes:0,firstContext:u},o.flags|=524288}else ai=ai.next=u;return h}var wU=typeof AbortController<"u"?AbortController:function(){var o=[],u=this.signal={aborted:!1,addEventListener:function(h,y){o.push(y)}};this.abort=function(){u.aborted=!0,o.forEach(function(h){return h()})}},CU=e.unstable_scheduleCallback,NU=e.unstable_NormalPriority,Yn={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qb(){return{controller:new wU,data:new Map,refCount:0}}function ff(o){o.refCount--,o.refCount===0&&CU(NU,function(){o.controller.abort()})}var hf=null,Gb=0,Kc=0,Wc=null;function kU(o,u){if(hf===null){var h=hf=[];Gb=0,Kc=Wy(),Wc={status:"pending",value:void 0,then:function(y){h.push(y)}}}return Gb++,u.then(HN,HN),u}function HN(){if(--Gb===0&&hf!==null){Wc!==null&&(Wc.status="fulfilled");var o=hf;hf=null,Kc=0,Wc=null;for(var u=0;u<o.length;u++)(0,o[u])()}}function AU(o,u){var h=[],y={status:"pending",value:null,reason:null,then:function(T){h.push(T)}};return o.then(function(){y.status="fulfilled",y.value=u;for(var T=0;T<h.length;T++)(0,h[T])(u)},function(T){for(y.status="rejected",y.reason=T,T=0;T<h.length;T++)(0,h[T])(void 0)}),y}var UN=F.S;F.S=function(o,u){CA=Xt(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&kU(o,u),UN!==null&&UN(o,u)};var pl=U(null);function Yb(){var o=pl.current;return o!==null?o:fn.pooledCache}function am(o,u){u===null?M(pl,pl.current):M(pl,u.pool)}function $N(){var o=Yb();return o===null?null:{parent:Yn._currentValue,pool:o}}var Xc=Error(r(460)),Kb=Error(r(474)),im=Error(r(542)),om={then:function(){}};function VN(o){return o=o.status,o==="fulfilled"||o==="rejected"}function qN(o,u,h){switch(h=o[h],h===void 0?o.push(u):h!==u&&(u.then(ti,ti),u=h),u.status){case"fulfilled":return u.value;case"rejected":throw o=u.reason,YN(o),o;default:if(typeof u.status=="string")u.then(ti,ti);else{if(o=fn,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=u,o.status="pending",o.then(function(y){if(u.status==="pending"){var T=u;T.status="fulfilled",T.value=y}},function(y){if(u.status==="pending"){var T=u;T.status="rejected",T.reason=y}})}switch(u.status){case"fulfilled":return u.value;case"rejected":throw o=u.reason,YN(o),o}throw gl=u,Xc}}function ml(o){try{var u=o._init;return u(o._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?(gl=h,Xc):h}}var gl=null;function GN(){if(gl===null)throw Error(r(459));var o=gl;return gl=null,o}function YN(o){if(o===Xc||o===im)throw Error(r(483))}var Qc=null,pf=0;function lm(o){var u=pf;return pf+=1,Qc===null&&(Qc=[]),qN(Qc,o,u)}function mf(o,u){u=u.props.ref,o.ref=u!==void 0?u:null}function cm(o,u){throw u.$$typeof===x?Error(r(525)):(o=Object.prototype.toString.call(u),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":o)))}function KN(o){function u(ce,ae){if(o){var fe=ce.deletions;fe===null?(ce.deletions=[ae],ce.flags|=16):fe.push(ae)}}function h(ce,ae){if(!o)return null;for(;ae!==null;)u(ce,ae),ae=ae.sibling;return null}function y(ce){for(var ae=new Map;ce!==null;)ce.key!==null?ae.set(ce.key,ce):ae.set(ce.index,ce),ce=ce.sibling;return ae}function T(ce,ae){return ce=ri(ce,ae),ce.index=0,ce.sibling=null,ce}function C(ce,ae,fe){return ce.index=fe,o?(fe=ce.alternate,fe!==null?(fe=fe.index,fe<ae?(ce.flags|=67108866,ae):fe):(ce.flags|=67108866,ae)):(ce.flags|=1048576,ae)}function O(ce){return o&&ce.alternate===null&&(ce.flags|=67108866),ce}function H(ce,ae,fe,we){return ae===null||ae.tag!==6?(ae=Lb(fe,ce.mode,we),ae.return=ce,ae):(ae=T(ae,fe),ae.return=ce,ae)}function ne(ce,ae,fe,we){var st=fe.type;return st===E?Te(ce,ae,fe.props.children,we,fe.key):ae!==null&&(ae.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===I&&ml(st)===ae.type)?(ae=T(ae,fe.props),mf(ae,fe),ae.return=ce,ae):(ae=tm(fe.type,fe.key,fe.props,null,ce.mode,we),mf(ae,fe),ae.return=ce,ae)}function he(ce,ae,fe,we){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==fe.containerInfo||ae.stateNode.implementation!==fe.implementation?(ae=Pb(fe,ce.mode,we),ae.return=ce,ae):(ae=T(ae,fe.children||[]),ae.return=ce,ae)}function Te(ce,ae,fe,we,st){return ae===null||ae.tag!==7?(ae=ul(fe,ce.mode,we,st),ae.return=ce,ae):(ae=T(ae,fe),ae.return=ce,ae)}function Ce(ce,ae,fe){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return ae=Lb(""+ae,ce.mode,fe),ae.return=ce,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:return fe=tm(ae.type,ae.key,ae.props,null,ce.mode,fe),mf(fe,ae),fe.return=ce,fe;case v:return ae=Pb(ae,ce.mode,fe),ae.return=ce,ae;case I:return ae=ml(ae),Ce(ce,ae,fe)}if(W(ae)||G(ae))return ae=ul(ae,ce.mode,fe,null),ae.return=ce,ae;if(typeof ae.then=="function")return Ce(ce,lm(ae),fe);if(ae.$$typeof===A)return Ce(ce,sm(ce,ae),fe);cm(ce,ae)}return null}function me(ce,ae,fe,we){var st=ae!==null?ae.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return st!==null?null:H(ce,ae,""+fe,we);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return fe.key===st?ne(ce,ae,fe,we):null;case v:return fe.key===st?he(ce,ae,fe,we):null;case I:return fe=ml(fe),me(ce,ae,fe,we)}if(W(fe)||G(fe))return st!==null?null:Te(ce,ae,fe,we,null);if(typeof fe.then=="function")return me(ce,ae,lm(fe),we);if(fe.$$typeof===A)return me(ce,ae,sm(ce,fe),we);cm(ce,fe)}return null}function be(ce,ae,fe,we,st){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return ce=ce.get(fe)||null,H(ae,ce,""+we,st);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case b:return ce=ce.get(we.key===null?fe:we.key)||null,ne(ae,ce,we,st);case v:return ce=ce.get(we.key===null?fe:we.key)||null,he(ae,ce,we,st);case I:return we=ml(we),be(ce,ae,fe,we,st)}if(W(we)||G(we))return ce=ce.get(fe)||null,Te(ae,ce,we,st,null);if(typeof we.then=="function")return be(ce,ae,fe,lm(we),st);if(we.$$typeof===A)return be(ce,ae,fe,sm(ae,we),st);cm(ae,we)}return null}function Ge(ce,ae,fe,we){for(var st=null,$t=null,Qe=ae,vt=ae=0,It=null;Qe!==null&&vt<fe.length;vt++){Qe.index>vt?(It=Qe,Qe=null):It=Qe.sibling;var Vt=me(ce,Qe,fe[vt],we);if(Vt===null){Qe===null&&(Qe=It);break}o&&Qe&&Vt.alternate===null&&u(ce,Qe),ae=C(Vt,ae,vt),$t===null?st=Vt:$t.sibling=Vt,$t=Vt,Qe=It}if(vt===fe.length)return h(ce,Qe),Bt&&si(ce,vt),st;if(Qe===null){for(;vt<fe.length;vt++)Qe=Ce(ce,fe[vt],we),Qe!==null&&(ae=C(Qe,ae,vt),$t===null?st=Qe:$t.sibling=Qe,$t=Qe);return Bt&&si(ce,vt),st}for(Qe=y(Qe);vt<fe.length;vt++)It=be(Qe,ce,vt,fe[vt],we),It!==null&&(o&&It.alternate!==null&&Qe.delete(It.key===null?vt:It.key),ae=C(It,ae,vt),$t===null?st=It:$t.sibling=It,$t=It);return o&&Qe.forEach(function(xo){return u(ce,xo)}),Bt&&si(ce,vt),st}function ot(ce,ae,fe,we){if(fe==null)throw Error(r(151));for(var st=null,$t=null,Qe=ae,vt=ae=0,It=null,Vt=fe.next();Qe!==null&&!Vt.done;vt++,Vt=fe.next()){Qe.index>vt?(It=Qe,Qe=null):It=Qe.sibling;var xo=me(ce,Qe,Vt.value,we);if(xo===null){Qe===null&&(Qe=It);break}o&&Qe&&xo.alternate===null&&u(ce,Qe),ae=C(xo,ae,vt),$t===null?st=xo:$t.sibling=xo,$t=xo,Qe=It}if(Vt.done)return h(ce,Qe),Bt&&si(ce,vt),st;if(Qe===null){for(;!Vt.done;vt++,Vt=fe.next())Vt=Ce(ce,Vt.value,we),Vt!==null&&(ae=C(Vt,ae,vt),$t===null?st=Vt:$t.sibling=Vt,$t=Vt);return Bt&&si(ce,vt),st}for(Qe=y(Qe);!Vt.done;vt++,Vt=fe.next())Vt=be(Qe,ce,vt,Vt.value,we),Vt!==null&&(o&&Vt.alternate!==null&&Qe.delete(Vt.key===null?vt:Vt.key),ae=C(Vt,ae,vt),$t===null?st=Vt:$t.sibling=Vt,$t=Vt);return o&&Qe.forEach(function(F$){return u(ce,F$)}),Bt&&si(ce,vt),st}function ln(ce,ae,fe,we){if(typeof fe=="object"&&fe!==null&&fe.type===E&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:e:{for(var st=fe.key;ae!==null;){if(ae.key===st){if(st=fe.type,st===E){if(ae.tag===7){h(ce,ae.sibling),we=T(ae,fe.props.children),we.return=ce,ce=we;break e}}else if(ae.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===I&&ml(st)===ae.type){h(ce,ae.sibling),we=T(ae,fe.props),mf(we,fe),we.return=ce,ce=we;break e}h(ce,ae);break}else u(ce,ae);ae=ae.sibling}fe.type===E?(we=ul(fe.props.children,ce.mode,we,fe.key),we.return=ce,ce=we):(we=tm(fe.type,fe.key,fe.props,null,ce.mode,we),mf(we,fe),we.return=ce,ce=we)}return O(ce);case v:e:{for(st=fe.key;ae!==null;){if(ae.key===st)if(ae.tag===4&&ae.stateNode.containerInfo===fe.containerInfo&&ae.stateNode.implementation===fe.implementation){h(ce,ae.sibling),we=T(ae,fe.children||[]),we.return=ce,ce=we;break e}else{h(ce,ae);break}else u(ce,ae);ae=ae.sibling}we=Pb(fe,ce.mode,we),we.return=ce,ce=we}return O(ce);case I:return fe=ml(fe),ln(ce,ae,fe,we)}if(W(fe))return Ge(ce,ae,fe,we);if(G(fe)){if(st=G(fe),typeof st!="function")throw Error(r(150));return fe=st.call(fe),ot(ce,ae,fe,we)}if(typeof fe.then=="function")return ln(ce,ae,lm(fe),we);if(fe.$$typeof===A)return ln(ce,ae,sm(ce,fe),we);cm(ce,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint"?(fe=""+fe,ae!==null&&ae.tag===6?(h(ce,ae.sibling),we=T(ae,fe),we.return=ce,ce=we):(h(ce,ae),we=Lb(fe,ce.mode,we),we.return=ce,ce=we),O(ce)):h(ce,ae)}return function(ce,ae,fe,we){try{pf=0;var st=ln(ce,ae,fe,we);return Qc=null,st}catch(Qe){if(Qe===Xc||Qe===im)throw Qe;var $t=is(29,Qe,null,ce.mode);return $t.lanes=we,$t.return=ce,$t}finally{}}}var xl=KN(!0),WN=KN(!1),Ji=!1;function Wb(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xb(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function eo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function to(o,u,h){var y=o.updateQueue;if(y===null)return null;if(y=y.shared,(Wt&2)!==0){var T=y.pending;return T===null?u.next=u:(u.next=T.next,T.next=u),y.pending=u,u=em(o),DN(o,null,h),u}return Jp(o,y,u,h),em(o)}function gf(o,u,h){if(u=u.updateQueue,u!==null&&(u=u.shared,(h&4194048)!==0)){var y=u.lanes;y&=o.pendingLanes,h|=y,u.lanes=h,tn(o,h)}}function Qb(o,u){var h=o.updateQueue,y=o.alternate;if(y!==null&&(y=y.updateQueue,h===y)){var T=null,C=null;if(h=h.firstBaseUpdate,h!==null){do{var O={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};C===null?T=C=O:C=C.next=O,h=h.next}while(h!==null);C===null?T=C=u:C=C.next=u}else T=C=u;h={baseState:y.baseState,firstBaseUpdate:T,lastBaseUpdate:C,shared:y.shared,callbacks:y.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=u:o.next=u,h.lastBaseUpdate=u}var Zb=!1;function xf(){if(Zb){var o=Wc;if(o!==null)throw o}}function bf(o,u,h,y){Zb=!1;var T=o.updateQueue;Ji=!1;var C=T.firstBaseUpdate,O=T.lastBaseUpdate,H=T.shared.pending;if(H!==null){T.shared.pending=null;var ne=H,he=ne.next;ne.next=null,O===null?C=he:O.next=he,O=ne;var Te=o.alternate;Te!==null&&(Te=Te.updateQueue,H=Te.lastBaseUpdate,H!==O&&(H===null?Te.firstBaseUpdate=he:H.next=he,Te.lastBaseUpdate=ne))}if(C!==null){var Ce=T.baseState;O=0,Te=he=ne=null,H=C;do{var me=H.lane&-536870913,be=me!==H.lane;if(be?(Ot&me)===me:(y&me)===me){me!==0&&me===Kc&&(Zb=!0),Te!==null&&(Te=Te.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Ge=o,ot=H;me=u;var ln=h;switch(ot.tag){case 1:if(Ge=ot.payload,typeof Ge=="function"){Ce=Ge.call(ln,Ce,me);break e}Ce=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=ot.payload,me=typeof Ge=="function"?Ge.call(ln,Ce,me):Ge,me==null)break e;Ce=p({},Ce,me);break e;case 2:Ji=!0}}me=H.callback,me!==null&&(o.flags|=64,be&&(o.flags|=8192),be=T.callbacks,be===null?T.callbacks=[me]:be.push(me))}else be={lane:me,tag:H.tag,payload:H.payload,callback:H.callback,next:null},Te===null?(he=Te=be,ne=Ce):Te=Te.next=be,O|=me;if(H=H.next,H===null){if(H=T.shared.pending,H===null)break;be=H,H=be.next,be.next=null,T.lastBaseUpdate=be,T.shared.pending=null}}while(!0);Te===null&&(ne=Ce),T.baseState=ne,T.firstBaseUpdate=he,T.lastBaseUpdate=Te,C===null&&(T.shared.lanes=0),io|=O,o.lanes=O,o.memoizedState=Ce}}function XN(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function QN(o,u){var h=o.callbacks;if(h!==null)for(o.callbacks=null,o=0;o<h.length;o++)XN(h[o],u)}var Zc=U(null),um=U(0);function ZN(o,u){o=mi,M(um,o),M(Zc,u),mi=o|u.baseLanes}function Jb(){M(um,mi),M(Zc,Zc.current)}function ey(){mi=um.current,V(Zc),V(um)}var os=U(null),Ps=null;function no(o){var u=o.alternate;M($n,$n.current&1),M(os,o),Ps===null&&(u===null||Zc.current!==null||u.memoizedState!==null)&&(Ps=o)}function ty(o){M($n,$n.current),M(os,o),Ps===null&&(Ps=o)}function JN(o){o.tag===22?(M($n,$n.current),M(os,o),Ps===null&&(Ps=o)):ro()}function ro(){M($n,$n.current),M(os,os.current)}function ls(o){V(os),Ps===o&&(Ps=null),V($n)}var $n=U(0);function dm(o){for(var u=o;u!==null;){if(u.tag===13){var h=u.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||o1(h)||l1(h)))return u}else if(u.tag===19&&(u.memoizedProps.revealOrder==="forwards"||u.memoizedProps.revealOrder==="backwards"||u.memoizedProps.revealOrder==="unstable_legacy-backwards"||u.memoizedProps.revealOrder==="together")){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var oi=0,yt=null,an=null,Kn=null,fm=!1,Jc=!1,bl=!1,hm=0,yf=0,eu=null,jU=0;function Ln(){throw Error(r(321))}function ny(o,u){if(u===null)return!1;for(var h=0;h<u.length&&h<o.length;h++)if(!as(o[h],u[h]))return!1;return!0}function ry(o,u,h,y,T,C){return oi=C,yt=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,F.H=o===null||o.memoizedState===null?Lk:by,bl=!1,C=h(y,T),bl=!1,Jc&&(C=tk(u,h,y,T)),ek(o),C}function ek(o){F.H=Tf;var u=an!==null&&an.next!==null;if(oi=0,Kn=an=yt=null,fm=!1,yf=0,eu=null,u)throw Error(r(300));o===null||Wn||(o=o.dependencies,o!==null&&rm(o)&&(Wn=!0))}function tk(o,u,h,y){yt=o;var T=0;do{if(Jc&&(eu=null),yf=0,Jc=!1,25<=T)throw Error(r(301));if(T+=1,Kn=an=null,o.updateQueue!=null){var C=o.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}F.H=Pk,C=u(h,y)}while(Jc);return C}function _U(){var o=F.H,u=o.useState()[0];return u=typeof u.then=="function"?vf(u):u,o=o.useState()[0],(an!==null?an.memoizedState:null)!==o&&(yt.flags|=1024),u}function sy(){var o=hm!==0;return hm=0,o}function ay(o,u,h){u.updateQueue=o.updateQueue,u.flags&=-2053,o.lanes&=~h}function iy(o){if(fm){for(o=o.memoizedState;o!==null;){var u=o.queue;u!==null&&(u.pending=null),o=o.next}fm=!1}oi=0,Kn=an=yt=null,Jc=!1,yf=hm=0,eu=null}function Rr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kn===null?yt.memoizedState=Kn=o:Kn=Kn.next=o,Kn}function Vn(){if(an===null){var o=yt.alternate;o=o!==null?o.memoizedState:null}else o=an.next;var u=Kn===null?yt.memoizedState:Kn.next;if(u!==null)Kn=u,an=o;else{if(o===null)throw yt.alternate===null?Error(r(467)):Error(r(310));an=o,o={memoizedState:an.memoizedState,baseState:an.baseState,baseQueue:an.baseQueue,queue:an.queue,next:null},Kn===null?yt.memoizedState=Kn=o:Kn=Kn.next=o}return Kn}function pm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vf(o){var u=yf;return yf+=1,eu===null&&(eu=[]),o=qN(eu,o,u),u=yt,(Kn===null?u.memoizedState:Kn.next)===null&&(u=u.alternate,F.H=u===null||u.memoizedState===null?Lk:by),o}function mm(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return vf(o);if(o.$$typeof===A)return yr(o)}throw Error(r(438,String(o)))}function oy(o){var u=null,h=yt.updateQueue;if(h!==null&&(u=h.memoCache),u==null){var y=yt.alternate;y!==null&&(y=y.updateQueue,y!==null&&(y=y.memoCache,y!=null&&(u={data:y.data.map(function(T){return T.slice()}),index:0})))}if(u==null&&(u={data:[],index:0}),h===null&&(h=pm(),yt.updateQueue=h),h.memoCache=u,h=u.data[u.index],h===void 0)for(h=u.data[u.index]=Array(o),y=0;y<o;y++)h[y]=B;return u.index++,h}function li(o,u){return typeof u=="function"?u(o):u}function gm(o){var u=Vn();return ly(u,an,o)}function ly(o,u,h){var y=o.queue;if(y===null)throw Error(r(311));y.lastRenderedReducer=h;var T=o.baseQueue,C=y.pending;if(C!==null){if(T!==null){var O=T.next;T.next=C.next,C.next=O}u.baseQueue=T=C,y.pending=null}if(C=o.baseState,T===null)o.memoizedState=C;else{u=T.next;var H=O=null,ne=null,he=u,Te=!1;do{var Ce=he.lane&-536870913;if(Ce!==he.lane?(Ot&Ce)===Ce:(oi&Ce)===Ce){var me=he.revertLane;if(me===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),Ce===Kc&&(Te=!0);else if((oi&me)===me){he=he.next,me===Kc&&(Te=!0);continue}else Ce={lane:0,revertLane:he.revertLane,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},ne===null?(H=ne=Ce,O=C):ne=ne.next=Ce,yt.lanes|=me,io|=me;Ce=he.action,bl&&h(C,Ce),C=he.hasEagerState?he.eagerState:h(C,Ce)}else me={lane:Ce,revertLane:he.revertLane,gesture:he.gesture,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},ne===null?(H=ne=me,O=C):ne=ne.next=me,yt.lanes|=Ce,io|=Ce;he=he.next}while(he!==null&&he!==u);if(ne===null?O=C:ne.next=H,!as(C,o.memoizedState)&&(Wn=!0,Te&&(h=Wc,h!==null)))throw h;o.memoizedState=C,o.baseState=O,o.baseQueue=ne,y.lastRenderedState=C}return T===null&&(y.lanes=0),[o.memoizedState,y.dispatch]}function cy(o){var u=Vn(),h=u.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=o;var y=h.dispatch,T=h.pending,C=u.memoizedState;if(T!==null){h.pending=null;var O=T=T.next;do C=o(C,O.action),O=O.next;while(O!==T);as(C,u.memoizedState)||(Wn=!0),u.memoizedState=C,u.baseQueue===null&&(u.baseState=C),h.lastRenderedState=C}return[C,y]}function nk(o,u,h){var y=yt,T=Vn(),C=Bt;if(C){if(h===void 0)throw Error(r(407));h=h()}else h=u();var O=!as((an||T).memoizedState,h);if(O&&(T.memoizedState=h,Wn=!0),T=T.queue,fy(ak.bind(null,y,T,o),[o]),T.getSnapshot!==u||O||Kn!==null&&Kn.memoizedState.tag&1){if(y.flags|=2048,tu(9,{destroy:void 0},sk.bind(null,y,T,h,u),null),fn===null)throw Error(r(349));C||(oi&127)!==0||rk(y,u,h)}return h}function rk(o,u,h){o.flags|=16384,o={getSnapshot:u,value:h},u=yt.updateQueue,u===null?(u=pm(),yt.updateQueue=u,u.stores=[o]):(h=u.stores,h===null?u.stores=[o]:h.push(o))}function sk(o,u,h,y){u.value=h,u.getSnapshot=y,ik(u)&&ok(o)}function ak(o,u,h){return h(function(){ik(u)&&ok(o)})}function ik(o){var u=o.getSnapshot;o=o.value;try{var h=u();return!as(o,h)}catch{return!0}}function ok(o){var u=cl(o,2);u!==null&&Gr(u,o,2)}function uy(o){var u=Rr();if(typeof o=="function"){var h=o;if(o=h(),bl){gn(!0);try{h()}finally{gn(!1)}}}return u.memoizedState=u.baseState=o,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:o},u}function lk(o,u,h,y){return o.baseState=h,ly(o,an,typeof y=="function"?y:li)}function RU(o,u,h,y,T){if(ym(o))throw Error(r(485));if(o=u.action,o!==null){var C={payload:T,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){C.listeners.push(O)}};F.T!==null?h(!0):C.isTransition=!1,y(C),h=u.pending,h===null?(C.next=u.pending=C,ck(u,C)):(C.next=h.next,u.pending=h.next=C)}}function ck(o,u){var h=u.action,y=u.payload,T=o.state;if(u.isTransition){var C=F.T,O={};F.T=O;try{var H=h(T,y),ne=F.S;ne!==null&&ne(O,H),uk(o,u,H)}catch(he){dy(o,u,he)}finally{C!==null&&O.types!==null&&(C.types=O.types),F.T=C}}else try{C=h(T,y),uk(o,u,C)}catch(he){dy(o,u,he)}}function uk(o,u,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(y){dk(o,u,y)},function(y){return dy(o,u,y)}):dk(o,u,h)}function dk(o,u,h){u.status="fulfilled",u.value=h,fk(u),o.state=h,u=o.pending,u!==null&&(h=u.next,h===u?o.pending=null:(h=h.next,u.next=h,ck(o,h)))}function dy(o,u,h){var y=o.pending;if(o.pending=null,y!==null){y=y.next;do u.status="rejected",u.reason=h,fk(u),u=u.next;while(u!==y)}o.action=null}function fk(o){o=o.listeners;for(var u=0;u<o.length;u++)(0,o[u])()}function hk(o,u){return u}function pk(o,u){if(Bt){var h=fn.formState;if(h!==null){e:{var y=yt;if(Bt){if(bn){t:{for(var T=bn,C=Ls;T.nodeType!==8;){if(!C){T=null;break t}if(T=Bs(T.nextSibling),T===null){T=null;break t}}C=T.data,T=C==="F!"||C==="F"?T:null}if(T){bn=Bs(T.nextSibling),y=T.data==="F!";break e}}Qi(y)}y=!1}y&&(u=h[0])}}return h=Rr(),h.memoizedState=h.baseState=u,y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hk,lastRenderedState:u},h.queue=y,h=Mk.bind(null,yt,y),y.dispatch=h,y=uy(!1),C=xy.bind(null,yt,!1,y.queue),y=Rr(),T={state:u,dispatch:null,action:o,pending:null},y.queue=T,h=RU.bind(null,yt,T,C,h),T.dispatch=h,y.memoizedState=o,[u,h,!1]}function mk(o){var u=Vn();return gk(u,an,o)}function gk(o,u,h){if(u=ly(o,u,hk)[0],o=gm(li)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var y=vf(u)}catch(O){throw O===Xc?im:O}else y=u;u=Vn();var T=u.queue,C=T.dispatch;return h!==u.memoizedState&&(yt.flags|=2048,tu(9,{destroy:void 0},DU.bind(null,T,h),null)),[y,C,o]}function DU(o,u){o.action=u}function xk(o){var u=Vn(),h=an;if(h!==null)return gk(u,h,o);Vn(),u=u.memoizedState,h=Vn();var y=h.queue.dispatch;return h.memoizedState=o,[u,y,!1]}function tu(o,u,h,y){return o={tag:o,create:h,deps:y,inst:u,next:null},u=yt.updateQueue,u===null&&(u=pm(),yt.updateQueue=u),h=u.lastEffect,h===null?u.lastEffect=o.next=o:(y=h.next,h.next=o,o.next=y,u.lastEffect=o),o}function bk(){return Vn().memoizedState}function xm(o,u,h,y){var T=Rr();yt.flags|=o,T.memoizedState=tu(1|u,{destroy:void 0},h,y===void 0?null:y)}function bm(o,u,h,y){var T=Vn();y=y===void 0?null:y;var C=T.memoizedState.inst;an!==null&&y!==null&&ny(y,an.memoizedState.deps)?T.memoizedState=tu(u,C,h,y):(yt.flags|=o,T.memoizedState=tu(1|u,C,h,y))}function yk(o,u){xm(8390656,8,o,u)}function fy(o,u){bm(2048,8,o,u)}function MU(o){yt.flags|=4;var u=yt.updateQueue;if(u===null)u=pm(),yt.updateQueue=u,u.events=[o];else{var h=u.events;h===null?u.events=[o]:h.push(o)}}function vk(o){var u=Vn().memoizedState;return MU({ref:u,nextImpl:o}),function(){if((Wt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}function Ek(o,u){return bm(4,2,o,u)}function Tk(o,u){return bm(4,4,o,u)}function Sk(o,u){if(typeof u=="function"){o=o();var h=u(o);return function(){typeof h=="function"?h():u(null)}}if(u!=null)return o=o(),u.current=o,function(){u.current=null}}function wk(o,u,h){h=h!=null?h.concat([o]):null,bm(4,4,Sk.bind(null,u,o),h)}function hy(){}function Ck(o,u){var h=Vn();u=u===void 0?null:u;var y=h.memoizedState;return u!==null&&ny(u,y[1])?y[0]:(h.memoizedState=[o,u],o)}function Nk(o,u){var h=Vn();u=u===void 0?null:u;var y=h.memoizedState;if(u!==null&&ny(u,y[1]))return y[0];if(y=o(),bl){gn(!0);try{o()}finally{gn(!1)}}return h.memoizedState=[y,u],y}function py(o,u,h){return h===void 0||(oi&1073741824)!==0&&(Ot&261930)===0?o.memoizedState=u:(o.memoizedState=h,o=kA(),yt.lanes|=o,io|=o,h)}function kk(o,u,h,y){return as(h,u)?h:Zc.current!==null?(o=py(o,h,y),as(o,u)||(Wn=!0),o):(oi&42)===0||(oi&1073741824)!==0&&(Ot&261930)===0?(Wn=!0,o.memoizedState=h):(o=kA(),yt.lanes|=o,io|=o,u)}function Ak(o,u,h,y,T){var C=$.p;$.p=C!==0&&8>C?C:8;var O=F.T,H={};F.T=H,xy(o,!1,u,h);try{var ne=T(),he=F.S;if(he!==null&&he(H,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var Te=AU(ne,y);Ef(o,u,Te,ds(o))}else Ef(o,u,y,ds(o))}catch(Ce){Ef(o,u,{then:function(){},status:"rejected",reason:Ce},ds())}finally{$.p=C,O!==null&&H.types!==null&&(O.types=H.types),F.T=O}}function OU(){}function my(o,u,h,y){if(o.tag!==5)throw Error(r(476));var T=jk(o).queue;Ak(o,T,u,z,h===null?OU:function(){return _k(o),h(y)})}function jk(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:z},next:null};var h={};return u.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:h},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function _k(o){var u=jk(o);u.next===null&&(u=o.alternate.memoizedState),Ef(o,u.next.queue,{},ds())}function gy(){return yr(Bf)}function Rk(){return Vn().memoizedState}function Dk(){return Vn().memoizedState}function IU(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var h=ds();o=eo(h);var y=to(u,o,h);y!==null&&(Gr(y,u,h),gf(y,u,h)),u={cache:qb()},o.payload=u;return}u=u.return}}function LU(o,u,h){var y=ds();h={lane:y,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},ym(o)?Ok(u,h):(h=Ob(o,u,h,y),h!==null&&(Gr(h,o,y),Ik(h,u,y)))}function Mk(o,u,h){var y=ds();Ef(o,u,h,y)}function Ef(o,u,h,y){var T={lane:y,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(ym(o))Ok(u,T);else{var C=o.alternate;if(o.lanes===0&&(C===null||C.lanes===0)&&(C=u.lastRenderedReducer,C!==null))try{var O=u.lastRenderedState,H=C(O,h);if(T.hasEagerState=!0,T.eagerState=H,as(H,O))return Jp(o,u,T,0),fn===null&&Zp(),!1}catch{}finally{}if(h=Ob(o,u,T,y),h!==null)return Gr(h,o,y),Ik(h,u,y),!0}return!1}function xy(o,u,h,y){if(y={lane:2,revertLane:Wy(),gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},ym(o)){if(u)throw Error(r(479))}else u=Ob(o,h,y,2),u!==null&&Gr(u,o,2)}function ym(o){var u=o.alternate;return o===yt||u!==null&&u===yt}function Ok(o,u){Jc=fm=!0;var h=o.pending;h===null?u.next=u:(u.next=h.next,h.next=u),o.pending=u}function Ik(o,u,h){if((h&4194048)!==0){var y=u.lanes;y&=o.pendingLanes,h|=y,u.lanes=h,tn(o,h)}}var Tf={readContext:yr,use:mm,useCallback:Ln,useContext:Ln,useEffect:Ln,useImperativeHandle:Ln,useLayoutEffect:Ln,useInsertionEffect:Ln,useMemo:Ln,useReducer:Ln,useRef:Ln,useState:Ln,useDebugValue:Ln,useDeferredValue:Ln,useTransition:Ln,useSyncExternalStore:Ln,useId:Ln,useHostTransitionStatus:Ln,useFormState:Ln,useActionState:Ln,useOptimistic:Ln,useMemoCache:Ln,useCacheRefresh:Ln};Tf.useEffectEvent=Ln;var Lk={readContext:yr,use:mm,useCallback:function(o,u){return Rr().memoizedState=[o,u===void 0?null:u],o},useContext:yr,useEffect:yk,useImperativeHandle:function(o,u,h){h=h!=null?h.concat([o]):null,xm(4194308,4,Sk.bind(null,u,o),h)},useLayoutEffect:function(o,u){return xm(4194308,4,o,u)},useInsertionEffect:function(o,u){xm(4,2,o,u)},useMemo:function(o,u){var h=Rr();u=u===void 0?null:u;var y=o();if(bl){gn(!0);try{o()}finally{gn(!1)}}return h.memoizedState=[y,u],y},useReducer:function(o,u,h){var y=Rr();if(h!==void 0){var T=h(u);if(bl){gn(!0);try{h(u)}finally{gn(!1)}}}else T=u;return y.memoizedState=y.baseState=T,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:T},y.queue=o,o=o.dispatch=LU.bind(null,yt,o),[y.memoizedState,o]},useRef:function(o){var u=Rr();return o={current:o},u.memoizedState=o},useState:function(o){o=uy(o);var u=o.queue,h=Mk.bind(null,yt,u);return u.dispatch=h,[o.memoizedState,h]},useDebugValue:hy,useDeferredValue:function(o,u){var h=Rr();return py(h,o,u)},useTransition:function(){var o=uy(!1);return o=Ak.bind(null,yt,o.queue,!0,!1),Rr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,h){var y=yt,T=Rr();if(Bt){if(h===void 0)throw Error(r(407));h=h()}else{if(h=u(),fn===null)throw Error(r(349));(Ot&127)!==0||rk(y,u,h)}T.memoizedState=h;var C={value:h,getSnapshot:u};return T.queue=C,yk(ak.bind(null,y,C,o),[o]),y.flags|=2048,tu(9,{destroy:void 0},sk.bind(null,y,C,h,u),null),h},useId:function(){var o=Rr(),u=fn.identifierPrefix;if(Bt){var h=Ca,y=wa;h=(y&~(1<<32-kt(y)-1)).toString(32)+h,u="_"+u+"R_"+h,h=hm++,0<h&&(u+="H"+h.toString(32)),u+="_"}else h=jU++,u="_"+u+"r_"+h.toString(32)+"_";return o.memoizedState=u},useHostTransitionStatus:gy,useFormState:pk,useActionState:pk,useOptimistic:function(o){var u=Rr();u.memoizedState=u.baseState=o;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=h,u=xy.bind(null,yt,!0,h),h.dispatch=u,[o,u]},useMemoCache:oy,useCacheRefresh:function(){return Rr().memoizedState=IU.bind(null,yt)},useEffectEvent:function(o){var u=Rr(),h={impl:o};return u.memoizedState=h,function(){if((Wt&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}},by={readContext:yr,use:mm,useCallback:Ck,useContext:yr,useEffect:fy,useImperativeHandle:wk,useInsertionEffect:Ek,useLayoutEffect:Tk,useMemo:Nk,useReducer:gm,useRef:bk,useState:function(){return gm(li)},useDebugValue:hy,useDeferredValue:function(o,u){var h=Vn();return kk(h,an.memoizedState,o,u)},useTransition:function(){var o=gm(li)[0],u=Vn().memoizedState;return[typeof o=="boolean"?o:vf(o),u]},useSyncExternalStore:nk,useId:Rk,useHostTransitionStatus:gy,useFormState:mk,useActionState:mk,useOptimistic:function(o,u){var h=Vn();return lk(h,an,o,u)},useMemoCache:oy,useCacheRefresh:Dk};by.useEffectEvent=vk;var Pk={readContext:yr,use:mm,useCallback:Ck,useContext:yr,useEffect:fy,useImperativeHandle:wk,useInsertionEffect:Ek,useLayoutEffect:Tk,useMemo:Nk,useReducer:cy,useRef:bk,useState:function(){return cy(li)},useDebugValue:hy,useDeferredValue:function(o,u){var h=Vn();return an===null?py(h,o,u):kk(h,an.memoizedState,o,u)},useTransition:function(){var o=cy(li)[0],u=Vn().memoizedState;return[typeof o=="boolean"?o:vf(o),u]},useSyncExternalStore:nk,useId:Rk,useHostTransitionStatus:gy,useFormState:xk,useActionState:xk,useOptimistic:function(o,u){var h=Vn();return an!==null?lk(h,an,o,u):(h.baseState=o,[o,h.queue.dispatch])},useMemoCache:oy,useCacheRefresh:Dk};Pk.useEffectEvent=vk;function yy(o,u,h,y){u=o.memoizedState,h=h(y,u),h=h==null?u:p({},u,h),o.memoizedState=h,o.lanes===0&&(o.updateQueue.baseState=h)}var vy={enqueueSetState:function(o,u,h){o=o._reactInternals;var y=ds(),T=eo(y);T.payload=u,h!=null&&(T.callback=h),u=to(o,T,y),u!==null&&(Gr(u,o,y),gf(u,o,y))},enqueueReplaceState:function(o,u,h){o=o._reactInternals;var y=ds(),T=eo(y);T.tag=1,T.payload=u,h!=null&&(T.callback=h),u=to(o,T,y),u!==null&&(Gr(u,o,y),gf(u,o,y))},enqueueForceUpdate:function(o,u){o=o._reactInternals;var h=ds(),y=eo(h);y.tag=2,u!=null&&(y.callback=u),u=to(o,y,h),u!==null&&(Gr(u,o,h),gf(u,o,h))}};function Bk(o,u,h,y,T,C,O){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(y,C,O):u.prototype&&u.prototype.isPureReactComponent?!lf(h,y)||!lf(T,C):!0}function Fk(o,u,h,y){o=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(h,y),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(h,y),u.state!==o&&vy.enqueueReplaceState(u,u.state,null)}function yl(o,u){var h=u;if("ref"in u){h={};for(var y in u)y!=="ref"&&(h[y]=u[y])}if(o=o.defaultProps){h===u&&(h=p({},h));for(var T in o)h[T]===void 0&&(h[T]=o[T])}return h}function zk(o){Qp(o)}function Hk(o){console.error(o)}function Uk(o){Qp(o)}function vm(o,u){try{var h=o.onUncaughtError;h(u.value,{componentStack:u.stack})}catch(y){setTimeout(function(){throw y})}}function $k(o,u,h){try{var y=o.onCaughtError;y(h.value,{componentStack:h.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(T){setTimeout(function(){throw T})}}function Ey(o,u,h){return h=eo(h),h.tag=3,h.payload={element:null},h.callback=function(){vm(o,u)},h}function Vk(o){return o=eo(o),o.tag=3,o}function qk(o,u,h,y){var T=h.type.getDerivedStateFromError;if(typeof T=="function"){var C=y.value;o.payload=function(){return T(C)},o.callback=function(){$k(u,h,y)}}var O=h.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(o.callback=function(){$k(u,h,y),typeof T!="function"&&(oo===null?oo=new Set([this]):oo.add(this));var H=y.stack;this.componentDidCatch(y.value,{componentStack:H!==null?H:""})})}function PU(o,u,h,y,T){if(h.flags|=32768,y!==null&&typeof y=="object"&&typeof y.then=="function"){if(u=h.alternate,u!==null&&Yc(u,h,T,!0),h=os.current,h!==null){switch(h.tag){case 31:case 13:return Ps===null?Dm():h.alternate===null&&Pn===0&&(Pn=3),h.flags&=-257,h.flags|=65536,h.lanes=T,y===om?h.flags|=16384:(u=h.updateQueue,u===null?h.updateQueue=new Set([y]):u.add(y),Gy(o,y,T)),!1;case 22:return h.flags|=65536,y===om?h.flags|=16384:(u=h.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([y])},h.updateQueue=u):(h=u.retryQueue,h===null?u.retryQueue=new Set([y]):h.add(y)),Gy(o,y,T)),!1}throw Error(r(435,h.tag))}return Gy(o,y,T),Dm(),!1}if(Bt)return u=os.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=T,y!==zb&&(o=Error(r(422),{cause:y}),df(Ms(o,h)))):(y!==zb&&(u=Error(r(423),{cause:y}),df(Ms(u,h))),o=o.current.alternate,o.flags|=65536,T&=-T,o.lanes|=T,y=Ms(y,h),T=Ey(o.stateNode,y,T),Qb(o,T),Pn!==4&&(Pn=2)),!1;var C=Error(r(520),{cause:y});if(C=Ms(C,h),_f===null?_f=[C]:_f.push(C),Pn!==4&&(Pn=2),u===null)return!0;y=Ms(y,h),h=u;do{switch(h.tag){case 3:return h.flags|=65536,o=T&-T,h.lanes|=o,o=Ey(h.stateNode,y,o),Qb(h,o),!1;case 1:if(u=h.type,C=h.stateNode,(h.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(oo===null||!oo.has(C))))return h.flags|=65536,T&=-T,h.lanes|=T,T=Vk(T),qk(T,o,h,y),Qb(h,T),!1}h=h.return}while(h!==null);return!1}var Ty=Error(r(461)),Wn=!1;function vr(o,u,h,y){u.child=o===null?WN(u,null,h,y):xl(u,o.child,h,y)}function Gk(o,u,h,y,T){h=h.render;var C=u.ref;if("ref"in y){var O={};for(var H in y)H!=="ref"&&(O[H]=y[H])}else O=y;return hl(u),y=ry(o,u,h,O,C,T),H=sy(),o!==null&&!Wn?(ay(o,u,T),ci(o,u,T)):(Bt&&H&&Bb(u),u.flags|=1,vr(o,u,y,T),u.child)}function Yk(o,u,h,y,T){if(o===null){var C=h.type;return typeof C=="function"&&!Ib(C)&&C.defaultProps===void 0&&h.compare===null?(u.tag=15,u.type=C,Kk(o,u,C,y,T)):(o=tm(h.type,null,y,u,u.mode,T),o.ref=u.ref,o.return=u,u.child=o)}if(C=o.child,!_y(o,T)){var O=C.memoizedProps;if(h=h.compare,h=h!==null?h:lf,h(O,y)&&o.ref===u.ref)return ci(o,u,T)}return u.flags|=1,o=ri(C,y),o.ref=u.ref,o.return=u,u.child=o}function Kk(o,u,h,y,T){if(o!==null){var C=o.memoizedProps;if(lf(C,y)&&o.ref===u.ref)if(Wn=!1,u.pendingProps=y=C,_y(o,T))(o.flags&131072)!==0&&(Wn=!0);else return u.lanes=o.lanes,ci(o,u,T)}return Sy(o,u,h,y,T)}function Wk(o,u,h,y){var T=y.children,C=o!==null?o.memoizedState:null;if(o===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),y.mode==="hidden"){if((u.flags&128)!==0){if(C=C!==null?C.baseLanes|h:h,o!==null){for(y=u.child=o.child,T=0;y!==null;)T=T|y.lanes|y.childLanes,y=y.sibling;y=T&~C}else y=0,u.child=null;return Xk(o,u,C,h,y)}if((h&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},o!==null&&am(u,C!==null?C.cachePool:null),C!==null?ZN(u,C):Jb(),JN(u);else return y=u.lanes=536870912,Xk(o,u,C!==null?C.baseLanes|h:h,h,y)}else C!==null?(am(u,C.cachePool),ZN(u,C),ro(),u.memoizedState=null):(o!==null&&am(u,null),Jb(),ro());return vr(o,u,T,h),u.child}function Sf(o,u){return o!==null&&o.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function Xk(o,u,h,y,T){var C=Yb();return C=C===null?null:{parent:Yn._currentValue,pool:C},u.memoizedState={baseLanes:h,cachePool:C},o!==null&&am(u,null),Jb(),JN(u),o!==null&&Yc(o,u,y,!0),u.childLanes=T,null}function Em(o,u){return u=Sm({mode:u.mode,children:u.children},o.mode),u.ref=o.ref,o.child=u,u.return=o,u}function Qk(o,u,h){return xl(u,o.child,null,h),o=Em(u,u.pendingProps),o.flags|=2,ls(u),u.memoizedState=null,o}function BU(o,u,h){var y=u.pendingProps,T=(u.flags&128)!==0;if(u.flags&=-129,o===null){if(Bt){if(y.mode==="hidden")return o=Em(u,y),u.lanes=536870912,Sf(null,o);if(ty(u),(o=bn)?(o=cj(o,Ls),o=o!==null&&o.data==="&"?o:null,o!==null&&(u.memoizedState={dehydrated:o,treeContext:Wi!==null?{id:wa,overflow:Ca}:null,retryLane:536870912,hydrationErrors:null},h=ON(o),h.return=u,u.child=h,br=u,bn=null)):o=null,o===null)throw Qi(u);return u.lanes=536870912,null}return Em(u,y)}var C=o.memoizedState;if(C!==null){var O=C.dehydrated;if(ty(u),T)if(u.flags&256)u.flags&=-257,u=Qk(o,u,h);else if(u.memoizedState!==null)u.child=o.child,u.flags|=128,u=null;else throw Error(r(558));else if(Wn||Yc(o,u,h,!1),T=(h&o.childLanes)!==0,Wn||T){if(y=fn,y!==null&&(O=Un(y,h),O!==0&&O!==C.retryLane))throw C.retryLane=O,cl(o,O),Gr(y,o,O),Ty;Dm(),u=Qk(o,u,h)}else o=C.treeContext,bn=Bs(O.nextSibling),br=u,Bt=!0,Xi=null,Ls=!1,o!==null&&PN(u,o),u=Em(u,y),u.flags|=4096;return u}return o=ri(o.child,{mode:y.mode,children:y.children}),o.ref=u.ref,u.child=o,o.return=u,o}function Tm(o,u){var h=u.ref;if(h===null)o!==null&&o.ref!==null&&(u.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(r(284));(o===null||o.ref!==h)&&(u.flags|=4194816)}}function Sy(o,u,h,y,T){return hl(u),h=ry(o,u,h,y,void 0,T),y=sy(),o!==null&&!Wn?(ay(o,u,T),ci(o,u,T)):(Bt&&y&&Bb(u),u.flags|=1,vr(o,u,h,T),u.child)}function Zk(o,u,h,y,T,C){return hl(u),u.updateQueue=null,h=tk(u,y,h,T),ek(o),y=sy(),o!==null&&!Wn?(ay(o,u,C),ci(o,u,C)):(Bt&&y&&Bb(u),u.flags|=1,vr(o,u,h,C),u.child)}function Jk(o,u,h,y,T){if(hl(u),u.stateNode===null){var C=$c,O=h.contextType;typeof O=="object"&&O!==null&&(C=yr(O)),C=new h(y,C),u.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=vy,u.stateNode=C,C._reactInternals=u,C=u.stateNode,C.props=y,C.state=u.memoizedState,C.refs={},Wb(u),O=h.contextType,C.context=typeof O=="object"&&O!==null?yr(O):$c,C.state=u.memoizedState,O=h.getDerivedStateFromProps,typeof O=="function"&&(yy(u,h,O,y),C.state=u.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(O=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),O!==C.state&&vy.enqueueReplaceState(C,C.state,null),bf(u,y,C,T),xf(),C.state=u.memoizedState),typeof C.componentDidMount=="function"&&(u.flags|=4194308),y=!0}else if(o===null){C=u.stateNode;var H=u.memoizedProps,ne=yl(h,H);C.props=ne;var he=C.context,Te=h.contextType;O=$c,typeof Te=="object"&&Te!==null&&(O=yr(Te));var Ce=h.getDerivedStateFromProps;Te=typeof Ce=="function"||typeof C.getSnapshotBeforeUpdate=="function",H=u.pendingProps!==H,Te||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(H||he!==O)&&Fk(u,C,y,O),Ji=!1;var me=u.memoizedState;C.state=me,bf(u,y,C,T),xf(),he=u.memoizedState,H||me!==he||Ji?(typeof Ce=="function"&&(yy(u,h,Ce,y),he=u.memoizedState),(ne=Ji||Bk(u,h,ne,y,me,he,O))?(Te||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(u.flags|=4194308)):(typeof C.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=y,u.memoizedState=he),C.props=y,C.state=he,C.context=O,y=ne):(typeof C.componentDidMount=="function"&&(u.flags|=4194308),y=!1)}else{C=u.stateNode,Xb(o,u),O=u.memoizedProps,Te=yl(h,O),C.props=Te,Ce=u.pendingProps,me=C.context,he=h.contextType,ne=$c,typeof he=="object"&&he!==null&&(ne=yr(he)),H=h.getDerivedStateFromProps,(he=typeof H=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(O!==Ce||me!==ne)&&Fk(u,C,y,ne),Ji=!1,me=u.memoizedState,C.state=me,bf(u,y,C,T),xf();var be=u.memoizedState;O!==Ce||me!==be||Ji||o!==null&&o.dependencies!==null&&rm(o.dependencies)?(typeof H=="function"&&(yy(u,h,H,y),be=u.memoizedState),(Te=Ji||Bk(u,h,Te,y,me,be,ne)||o!==null&&o.dependencies!==null&&rm(o.dependencies))?(he||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(y,be,ne),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(y,be,ne)),typeof C.componentDidUpdate=="function"&&(u.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof C.componentDidUpdate!="function"||O===o.memoizedProps&&me===o.memoizedState||(u.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&me===o.memoizedState||(u.flags|=1024),u.memoizedProps=y,u.memoizedState=be),C.props=y,C.state=be,C.context=ne,y=Te):(typeof C.componentDidUpdate!="function"||O===o.memoizedProps&&me===o.memoizedState||(u.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||O===o.memoizedProps&&me===o.memoizedState||(u.flags|=1024),y=!1)}return C=y,Tm(o,u),y=(u.flags&128)!==0,C||y?(C=u.stateNode,h=y&&typeof h.getDerivedStateFromError!="function"?null:C.render(),u.flags|=1,o!==null&&y?(u.child=xl(u,o.child,null,T),u.child=xl(u,null,h,T)):vr(o,u,h,T),u.memoizedState=C.state,o=u.child):o=ci(o,u,T),o}function eA(o,u,h,y){return dl(),u.flags|=256,vr(o,u,h,y),u.child}var wy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cy(o){return{baseLanes:o,cachePool:$N()}}function Ny(o,u,h){return o=o!==null?o.childLanes&~h:0,u&&(o|=us),o}function tA(o,u,h){var y=u.pendingProps,T=!1,C=(u.flags&128)!==0,O;if((O=C)||(O=o!==null&&o.memoizedState===null?!1:($n.current&2)!==0),O&&(T=!0,u.flags&=-129),O=(u.flags&32)!==0,u.flags&=-33,o===null){if(Bt){if(T?no(u):ro(),(o=bn)?(o=cj(o,Ls),o=o!==null&&o.data!=="&"?o:null,o!==null&&(u.memoizedState={dehydrated:o,treeContext:Wi!==null?{id:wa,overflow:Ca}:null,retryLane:536870912,hydrationErrors:null},h=ON(o),h.return=u,u.child=h,br=u,bn=null)):o=null,o===null)throw Qi(u);return l1(o)?u.lanes=32:u.lanes=536870912,null}var H=y.children;return y=y.fallback,T?(ro(),T=u.mode,H=Sm({mode:"hidden",children:H},T),y=ul(y,T,h,null),H.return=u,y.return=u,H.sibling=y,u.child=H,y=u.child,y.memoizedState=Cy(h),y.childLanes=Ny(o,O,h),u.memoizedState=wy,Sf(null,y)):(no(u),ky(u,H))}var ne=o.memoizedState;if(ne!==null&&(H=ne.dehydrated,H!==null)){if(C)u.flags&256?(no(u),u.flags&=-257,u=Ay(o,u,h)):u.memoizedState!==null?(ro(),u.child=o.child,u.flags|=128,u=null):(ro(),H=y.fallback,T=u.mode,y=Sm({mode:"visible",children:y.children},T),H=ul(H,T,h,null),H.flags|=2,y.return=u,H.return=u,y.sibling=H,u.child=y,xl(u,o.child,null,h),y=u.child,y.memoizedState=Cy(h),y.childLanes=Ny(o,O,h),u.memoizedState=wy,u=Sf(null,y));else if(no(u),l1(H)){if(O=H.nextSibling&&H.nextSibling.dataset,O)var he=O.dgst;O=he,y=Error(r(419)),y.stack="",y.digest=O,df({value:y,source:null,stack:null}),u=Ay(o,u,h)}else if(Wn||Yc(o,u,h,!1),O=(h&o.childLanes)!==0,Wn||O){if(O=fn,O!==null&&(y=Un(O,h),y!==0&&y!==ne.retryLane))throw ne.retryLane=y,cl(o,y),Gr(O,o,y),Ty;o1(H)||Dm(),u=Ay(o,u,h)}else o1(H)?(u.flags|=192,u.child=o.child,u=null):(o=ne.treeContext,bn=Bs(H.nextSibling),br=u,Bt=!0,Xi=null,Ls=!1,o!==null&&PN(u,o),u=ky(u,y.children),u.flags|=4096);return u}return T?(ro(),H=y.fallback,T=u.mode,ne=o.child,he=ne.sibling,y=ri(ne,{mode:"hidden",children:y.children}),y.subtreeFlags=ne.subtreeFlags&65011712,he!==null?H=ri(he,H):(H=ul(H,T,h,null),H.flags|=2),H.return=u,y.return=u,y.sibling=H,u.child=y,Sf(null,y),y=u.child,H=o.child.memoizedState,H===null?H=Cy(h):(T=H.cachePool,T!==null?(ne=Yn._currentValue,T=T.parent!==ne?{parent:ne,pool:ne}:T):T=$N(),H={baseLanes:H.baseLanes|h,cachePool:T}),y.memoizedState=H,y.childLanes=Ny(o,O,h),u.memoizedState=wy,Sf(o.child,y)):(no(u),h=o.child,o=h.sibling,h=ri(h,{mode:"visible",children:y.children}),h.return=u,h.sibling=null,o!==null&&(O=u.deletions,O===null?(u.deletions=[o],u.flags|=16):O.push(o)),u.child=h,u.memoizedState=null,h)}function ky(o,u){return u=Sm({mode:"visible",children:u},o.mode),u.return=o,o.child=u}function Sm(o,u){return o=is(22,o,null,u),o.lanes=0,o}function Ay(o,u,h){return xl(u,o.child,null,h),o=ky(u,u.pendingProps.children),o.flags|=2,u.memoizedState=null,o}function nA(o,u,h){o.lanes|=u;var y=o.alternate;y!==null&&(y.lanes|=u),$b(o.return,u,h)}function jy(o,u,h,y,T,C){var O=o.memoizedState;O===null?o.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:y,tail:h,tailMode:T,treeForkCount:C}:(O.isBackwards=u,O.rendering=null,O.renderingStartTime=0,O.last=y,O.tail=h,O.tailMode=T,O.treeForkCount=C)}function rA(o,u,h){var y=u.pendingProps,T=y.revealOrder,C=y.tail;y=y.children;var O=$n.current,H=(O&2)!==0;if(H?(O=O&1|2,u.flags|=128):O&=1,M($n,O),vr(o,u,y,h),y=Bt?uf:0,!H&&o!==null&&(o.flags&128)!==0)e:for(o=u.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&nA(o,h,u);else if(o.tag===19)nA(o,h,u);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===u)break e;for(;o.sibling===null;){if(o.return===null||o.return===u)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(T){case"forwards":for(h=u.child,T=null;h!==null;)o=h.alternate,o!==null&&dm(o)===null&&(T=h),h=h.sibling;h=T,h===null?(T=u.child,u.child=null):(T=h.sibling,h.sibling=null),jy(u,!1,T,h,C,y);break;case"backwards":case"unstable_legacy-backwards":for(h=null,T=u.child,u.child=null;T!==null;){if(o=T.alternate,o!==null&&dm(o)===null){u.child=T;break}o=T.sibling,T.sibling=h,h=T,T=o}jy(u,!0,h,null,C,y);break;case"together":jy(u,!1,null,null,void 0,y);break;default:u.memoizedState=null}return u.child}function ci(o,u,h){if(o!==null&&(u.dependencies=o.dependencies),io|=u.lanes,(h&u.childLanes)===0)if(o!==null){if(Yc(o,u,h,!1),(h&u.childLanes)===0)return null}else return null;if(o!==null&&u.child!==o.child)throw Error(r(153));if(u.child!==null){for(o=u.child,h=ri(o,o.pendingProps),u.child=h,h.return=u;o.sibling!==null;)o=o.sibling,h=h.sibling=ri(o,o.pendingProps),h.return=u;h.sibling=null}return u.child}function _y(o,u){return(o.lanes&u)!==0?!0:(o=o.dependencies,!!(o!==null&&rm(o)))}function FU(o,u,h){switch(u.tag){case 3:xe(u,u.stateNode.containerInfo),Zi(u,Yn,o.memoizedState.cache),dl();break;case 27:case 5:je(u);break;case 4:xe(u,u.stateNode.containerInfo);break;case 10:Zi(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,ty(u),null;break;case 13:var y=u.memoizedState;if(y!==null)return y.dehydrated!==null?(no(u),u.flags|=128,null):(h&u.child.childLanes)!==0?tA(o,u,h):(no(u),o=ci(o,u,h),o!==null?o.sibling:null);no(u);break;case 19:var T=(o.flags&128)!==0;if(y=(h&u.childLanes)!==0,y||(Yc(o,u,h,!1),y=(h&u.childLanes)!==0),T){if(y)return rA(o,u,h);u.flags|=128}if(T=u.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),M($n,$n.current),y)break;return null;case 22:return u.lanes=0,Wk(o,u,h,u.pendingProps);case 24:Zi(u,Yn,o.memoizedState.cache)}return ci(o,u,h)}function sA(o,u,h){if(o!==null)if(o.memoizedProps!==u.pendingProps)Wn=!0;else{if(!_y(o,h)&&(u.flags&128)===0)return Wn=!1,FU(o,u,h);Wn=(o.flags&131072)!==0}else Wn=!1,Bt&&(u.flags&1048576)!==0&&LN(u,uf,u.index);switch(u.lanes=0,u.tag){case 16:e:{var y=u.pendingProps;if(o=ml(u.elementType),u.type=o,typeof o=="function")Ib(o)?(y=yl(o,y),u.tag=1,u=Jk(null,u,o,y,h)):(u.tag=0,u=Sy(null,u,o,y,h));else{if(o!=null){var T=o.$$typeof;if(T===j){u.tag=11,u=Gk(null,u,o,y,h);break e}else if(T===D){u.tag=14,u=Yk(null,u,o,y,h);break e}}throw u=Y(o)||o,Error(r(306,u,""))}}return u;case 0:return Sy(o,u,u.type,u.pendingProps,h);case 1:return y=u.type,T=yl(y,u.pendingProps),Jk(o,u,y,T,h);case 3:e:{if(xe(u,u.stateNode.containerInfo),o===null)throw Error(r(387));y=u.pendingProps;var C=u.memoizedState;T=C.element,Xb(o,u),bf(u,y,null,h);var O=u.memoizedState;if(y=O.cache,Zi(u,Yn,y),y!==C.cache&&Vb(u,[Yn],h,!0),xf(),y=O.element,C.isDehydrated)if(C={element:y,isDehydrated:!1,cache:O.cache},u.updateQueue.baseState=C,u.memoizedState=C,u.flags&256){u=eA(o,u,y,h);break e}else if(y!==T){T=Ms(Error(r(424)),u),df(T),u=eA(o,u,y,h);break e}else{switch(o=u.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(bn=Bs(o.firstChild),br=u,Bt=!0,Xi=null,Ls=!0,h=WN(u,null,y,h),u.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling}else{if(dl(),y===T){u=ci(o,u,h);break e}vr(o,u,y,h)}u=u.child}return u;case 26:return Tm(o,u),o===null?(h=mj(u.type,null,u.pendingProps,null))?u.memoizedState=h:Bt||(h=u.type,o=u.pendingProps,y=Fm(pe.current).createElement(h),y[xr]=u,y[zr]=o,Er(y,h,o),ur(y),u.stateNode=y):u.memoizedState=mj(u.type,o.memoizedProps,u.pendingProps,o.memoizedState),null;case 27:return je(u),o===null&&Bt&&(y=u.stateNode=fj(u.type,u.pendingProps,pe.current),br=u,Ls=!0,T=bn,fo(u.type)?(c1=T,bn=Bs(y.firstChild)):bn=T),vr(o,u,u.pendingProps.children,h),Tm(o,u),o===null&&(u.flags|=4194304),u.child;case 5:return o===null&&Bt&&((T=y=bn)&&(y=m$(y,u.type,u.pendingProps,Ls),y!==null?(u.stateNode=y,br=u,bn=Bs(y.firstChild),Ls=!1,T=!0):T=!1),T||Qi(u)),je(u),T=u.type,C=u.pendingProps,O=o!==null?o.memoizedProps:null,y=C.children,s1(T,C)?y=null:O!==null&&s1(T,O)&&(u.flags|=32),u.memoizedState!==null&&(T=ry(o,u,_U,null,null,h),Bf._currentValue=T),Tm(o,u),vr(o,u,y,h),u.child;case 6:return o===null&&Bt&&((o=h=bn)&&(h=g$(h,u.pendingProps,Ls),h!==null?(u.stateNode=h,br=u,bn=null,o=!0):o=!1),o||Qi(u)),null;case 13:return tA(o,u,h);case 4:return xe(u,u.stateNode.containerInfo),y=u.pendingProps,o===null?u.child=xl(u,null,y,h):vr(o,u,y,h),u.child;case 11:return Gk(o,u,u.type,u.pendingProps,h);case 7:return vr(o,u,u.pendingProps,h),u.child;case 8:return vr(o,u,u.pendingProps.children,h),u.child;case 12:return vr(o,u,u.pendingProps.children,h),u.child;case 10:return y=u.pendingProps,Zi(u,u.type,y.value),vr(o,u,y.children,h),u.child;case 9:return T=u.type._context,y=u.pendingProps.children,hl(u),T=yr(T),y=y(T),u.flags|=1,vr(o,u,y,h),u.child;case 14:return Yk(o,u,u.type,u.pendingProps,h);case 15:return Kk(o,u,u.type,u.pendingProps,h);case 19:return rA(o,u,h);case 31:return BU(o,u,h);case 22:return Wk(o,u,h,u.pendingProps);case 24:return hl(u),y=yr(Yn),o===null?(T=Yb(),T===null&&(T=fn,C=qb(),T.pooledCache=C,C.refCount++,C!==null&&(T.pooledCacheLanes|=h),T=C),u.memoizedState={parent:y,cache:T},Wb(u),Zi(u,Yn,T)):((o.lanes&h)!==0&&(Xb(o,u),bf(u,null,null,h),xf()),T=o.memoizedState,C=u.memoizedState,T.parent!==y?(T={parent:y,cache:y},u.memoizedState=T,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=T),Zi(u,Yn,y)):(y=C.cache,Zi(u,Yn,y),y!==T.cache&&Vb(u,[Yn],h,!0))),vr(o,u,u.pendingProps.children,h),u.child;case 29:throw u.pendingProps}throw Error(r(156,u.tag))}function ui(o){o.flags|=4}function Ry(o,u,h,y,T){if((u=(o.mode&32)!==0)&&(u=!1),u){if(o.flags|=16777216,(T&335544128)===T)if(o.stateNode.complete)o.flags|=8192;else if(RA())o.flags|=8192;else throw gl=om,Kb}else o.flags&=-16777217}function aA(o,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!vj(u))if(RA())o.flags|=8192;else throw gl=om,Kb}function wm(o,u){u!==null&&(o.flags|=4),o.flags&16384&&(u=o.tag!==22?bt():536870912,o.lanes|=u,au|=u)}function wf(o,u){if(!Bt)switch(o.tailMode){case"hidden":u=o.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?o.tail=null:h.sibling=null;break;case"collapsed":h=o.tail;for(var y=null;h!==null;)h.alternate!==null&&(y=h),h=h.sibling;y===null?u||o.tail===null?o.tail=null:o.tail.sibling=null:y.sibling=null}}function yn(o){var u=o.alternate!==null&&o.alternate.child===o.child,h=0,y=0;if(u)for(var T=o.child;T!==null;)h|=T.lanes|T.childLanes,y|=T.subtreeFlags&65011712,y|=T.flags&65011712,T.return=o,T=T.sibling;else for(T=o.child;T!==null;)h|=T.lanes|T.childLanes,y|=T.subtreeFlags,y|=T.flags,T.return=o,T=T.sibling;return o.subtreeFlags|=y,o.childLanes=h,u}function zU(o,u,h){var y=u.pendingProps;switch(Fb(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yn(u),null;case 1:return yn(u),null;case 3:return h=u.stateNode,y=null,o!==null&&(y=o.memoizedState.cache),u.memoizedState.cache!==y&&(u.flags|=2048),ii(Yn),Se(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(o===null||o.child===null)&&(Gc(u)?ui(u):o===null||o.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,Hb())),yn(u),null;case 26:var T=u.type,C=u.memoizedState;return o===null?(ui(u),C!==null?(yn(u),aA(u,C)):(yn(u),Ry(u,T,null,y,h))):C?C!==o.memoizedState?(ui(u),yn(u),aA(u,C)):(yn(u),u.flags&=-16777217):(o=o.memoizedProps,o!==y&&ui(u),yn(u),Ry(u,T,o,y,h)),null;case 27:if(Le(u),h=pe.current,T=u.type,o!==null&&u.stateNode!=null)o.memoizedProps!==y&&ui(u);else{if(!y){if(u.stateNode===null)throw Error(r(166));return yn(u),null}o=Z.current,Gc(u)?BN(u):(o=fj(T,y,h),u.stateNode=o,ui(u))}return yn(u),null;case 5:if(Le(u),T=u.type,o!==null&&u.stateNode!=null)o.memoizedProps!==y&&ui(u);else{if(!y){if(u.stateNode===null)throw Error(r(166));return yn(u),null}if(C=Z.current,Gc(u))BN(u);else{var O=Fm(pe.current);switch(C){case 1:C=O.createElementNS("http://www.w3.org/2000/svg",T);break;case 2:C=O.createElementNS("http://www.w3.org/1998/Math/MathML",T);break;default:switch(T){case"svg":C=O.createElementNS("http://www.w3.org/2000/svg",T);break;case"math":C=O.createElementNS("http://www.w3.org/1998/Math/MathML",T);break;case"script":C=O.createElement("div"),C.innerHTML="<script><\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof y.is=="string"?O.createElement("select",{is:y.is}):O.createElement("select"),y.multiple?C.multiple=!0:y.size&&(C.size=y.size);break;default:C=typeof y.is=="string"?O.createElement(T,{is:y.is}):O.createElement(T)}}C[xr]=u,C[zr]=y;e:for(O=u.child;O!==null;){if(O.tag===5||O.tag===6)C.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===u)break e;for(;O.sibling===null;){if(O.return===null||O.return===u)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}u.stateNode=C;e:switch(Er(C,T,y),T){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}y&&ui(u)}}return yn(u),Ry(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,h),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==y&&ui(u);else{if(typeof y!="string"&&u.stateNode===null)throw Error(r(166));if(o=pe.current,Gc(u)){if(o=u.stateNode,h=u.memoizedProps,y=null,T=br,T!==null)switch(T.tag){case 27:case 5:y=T.memoizedProps}o[xr]=u,o=!!(o.nodeValue===h||y!==null&&y.suppressHydrationWarning===!0||tj(o.nodeValue,h)),o||Qi(u,!0)}else o=Fm(o).createTextNode(y),o[xr]=u,u.stateNode=o}return yn(u),null;case 31:if(h=u.memoizedState,o===null||o.memoizedState!==null){if(y=Gc(u),h!==null){if(o===null){if(!y)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[xr]=u}else dl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;yn(u),o=!1}else h=Hb(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return u.flags&256?(ls(u),u):(ls(u),null);if((u.flags&128)!==0)throw Error(r(558))}return yn(u),null;case 13:if(y=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(T=Gc(u),y!==null&&y.dehydrated!==null){if(o===null){if(!T)throw Error(r(318));if(T=u.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(r(317));T[xr]=u}else dl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;yn(u),T=!1}else T=Hb(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=T),T=!0;if(!T)return u.flags&256?(ls(u),u):(ls(u),null)}return ls(u),(u.flags&128)!==0?(u.lanes=h,u):(h=y!==null,o=o!==null&&o.memoizedState!==null,h&&(y=u.child,T=null,y.alternate!==null&&y.alternate.memoizedState!==null&&y.alternate.memoizedState.cachePool!==null&&(T=y.alternate.memoizedState.cachePool.pool),C=null,y.memoizedState!==null&&y.memoizedState.cachePool!==null&&(C=y.memoizedState.cachePool.pool),C!==T&&(y.flags|=2048)),h!==o&&h&&(u.child.flags|=8192),wm(u,u.updateQueue),yn(u),null);case 4:return Se(),o===null&&Jy(u.stateNode.containerInfo),yn(u),null;case 10:return ii(u.type),yn(u),null;case 19:if(V($n),y=u.memoizedState,y===null)return yn(u),null;if(T=(u.flags&128)!==0,C=y.rendering,C===null)if(T)wf(y,!1);else{if(Pn!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(C=dm(o),C!==null){for(u.flags|=128,wf(y,!1),o=C.updateQueue,u.updateQueue=o,wm(u,o),u.subtreeFlags=0,o=h,h=u.child;h!==null;)MN(h,o),h=h.sibling;return M($n,$n.current&1|2),Bt&&si(u,y.treeForkCount),u.child}o=o.sibling}y.tail!==null&&Xt()>jm&&(u.flags|=128,T=!0,wf(y,!1),u.lanes=4194304)}else{if(!T)if(o=dm(C),o!==null){if(u.flags|=128,T=!0,o=o.updateQueue,u.updateQueue=o,wm(u,o),wf(y,!0),y.tail===null&&y.tailMode==="hidden"&&!C.alternate&&!Bt)return yn(u),null}else 2*Xt()-y.renderingStartTime>jm&&h!==536870912&&(u.flags|=128,T=!0,wf(y,!1),u.lanes=4194304);y.isBackwards?(C.sibling=u.child,u.child=C):(o=y.last,o!==null?o.sibling=C:u.child=C,y.last=C)}return y.tail!==null?(o=y.tail,y.rendering=o,y.tail=o.sibling,y.renderingStartTime=Xt(),o.sibling=null,h=$n.current,M($n,T?h&1|2:h&1),Bt&&si(u,y.treeForkCount),o):(yn(u),null);case 22:case 23:return ls(u),ey(),y=u.memoizedState!==null,o!==null?o.memoizedState!==null!==y&&(u.flags|=8192):y&&(u.flags|=8192),y?(h&536870912)!==0&&(u.flags&128)===0&&(yn(u),u.subtreeFlags&6&&(u.flags|=8192)):yn(u),h=u.updateQueue,h!==null&&wm(u,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==h&&(u.flags|=2048),o!==null&&V(pl),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),u.memoizedState.cache!==h&&(u.flags|=2048),ii(Yn),yn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function HU(o,u){switch(Fb(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return ii(Yn),Se(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return Le(u),null;case 31:if(u.memoizedState!==null){if(ls(u),u.alternate===null)throw Error(r(340));dl()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(ls(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));dl()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return V($n),null;case 4:return Se(),null;case 10:return ii(u.type),null;case 22:case 23:return ls(u),ey(),o!==null&&V(pl),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return ii(Yn),null;case 25:return null;default:return null}}function iA(o,u){switch(Fb(u),u.tag){case 3:ii(Yn),Se();break;case 26:case 27:case 5:Le(u);break;case 4:Se();break;case 31:u.memoizedState!==null&&ls(u);break;case 13:ls(u);break;case 19:V($n);break;case 10:ii(u.type);break;case 22:case 23:ls(u),ey(),o!==null&&V(pl);break;case 24:ii(Yn)}}function Cf(o,u){try{var h=u.updateQueue,y=h!==null?h.lastEffect:null;if(y!==null){var T=y.next;h=T;do{if((h.tag&o)===o){y=void 0;var C=h.create,O=h.inst;y=C(),O.destroy=y}h=h.next}while(h!==T)}}catch(H){rn(u,u.return,H)}}function so(o,u,h){try{var y=u.updateQueue,T=y!==null?y.lastEffect:null;if(T!==null){var C=T.next;y=C;do{if((y.tag&o)===o){var O=y.inst,H=O.destroy;if(H!==void 0){O.destroy=void 0,T=u;var ne=h,he=H;try{he()}catch(Te){rn(T,ne,Te)}}}y=y.next}while(y!==C)}}catch(Te){rn(u,u.return,Te)}}function oA(o){var u=o.updateQueue;if(u!==null){var h=o.stateNode;try{QN(u,h)}catch(y){rn(o,o.return,y)}}}function lA(o,u,h){h.props=yl(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(y){rn(o,u,y)}}function Nf(o,u){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var y=o.stateNode;break;case 30:y=o.stateNode;break;default:y=o.stateNode}typeof h=="function"?o.refCleanup=h(y):h.current=y}}catch(T){rn(o,u,T)}}function Na(o,u){var h=o.ref,y=o.refCleanup;if(h!==null)if(typeof y=="function")try{y()}catch(T){rn(o,u,T)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(T){rn(o,u,T)}else h.current=null}function cA(o){var u=o.type,h=o.memoizedProps,y=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":h.autoFocus&&y.focus();break e;case"img":h.src?y.src=h.src:h.srcSet&&(y.srcset=h.srcSet)}}catch(T){rn(o,o.return,T)}}function Dy(o,u,h){try{var y=o.stateNode;c$(y,o.type,h,u),y[zr]=u}catch(T){rn(o,o.return,T)}}function uA(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&fo(o.type)||o.tag===4}function My(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||uA(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&fo(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Oy(o,u,h){var y=o.tag;if(y===5||y===6)o=o.stateNode,u?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,u):(u=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,u.appendChild(o),h=h._reactRootContainer,h!=null||u.onclick!==null||(u.onclick=ti));else if(y!==4&&(y===27&&fo(o.type)&&(h=o.stateNode,u=null),o=o.child,o!==null))for(Oy(o,u,h),o=o.sibling;o!==null;)Oy(o,u,h),o=o.sibling}function Cm(o,u,h){var y=o.tag;if(y===5||y===6)o=o.stateNode,u?h.insertBefore(o,u):h.appendChild(o);else if(y!==4&&(y===27&&fo(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(Cm(o,u,h),o=o.sibling;o!==null;)Cm(o,u,h),o=o.sibling}function dA(o){var u=o.stateNode,h=o.memoizedProps;try{for(var y=o.type,T=u.attributes;T.length;)u.removeAttributeNode(T[0]);Er(u,y,h),u[xr]=o,u[zr]=h}catch(C){rn(o,o.return,C)}}var di=!1,Xn=!1,Iy=!1,fA=typeof WeakSet=="function"?WeakSet:Set,dr=null;function UU(o,u){if(o=o.containerInfo,n1=Gm,o=wN(o),Ab(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var y=h.getSelection&&h.getSelection();if(y&&y.rangeCount!==0){h=y.anchorNode;var T=y.anchorOffset,C=y.focusNode;y=y.focusOffset;try{h.nodeType,C.nodeType}catch{h=null;break e}var O=0,H=-1,ne=-1,he=0,Te=0,Ce=o,me=null;t:for(;;){for(var be;Ce!==h||T!==0&&Ce.nodeType!==3||(H=O+T),Ce!==C||y!==0&&Ce.nodeType!==3||(ne=O+y),Ce.nodeType===3&&(O+=Ce.nodeValue.length),(be=Ce.firstChild)!==null;)me=Ce,Ce=be;for(;;){if(Ce===o)break t;if(me===h&&++he===T&&(H=O),me===C&&++Te===y&&(ne=O),(be=Ce.nextSibling)!==null)break;Ce=me,me=Ce.parentNode}Ce=be}h=H===-1||ne===-1?null:{start:H,end:ne}}else h=null}h=h||{start:0,end:0}}else h=null;for(r1={focusedElem:o,selectionRange:h},Gm=!1,dr=u;dr!==null;)if(u=dr,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,dr=o;else for(;dr!==null;){switch(u=dr,C=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h<o.length;h++)T=o[h],T.ref.impl=T.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&C!==null){o=void 0,h=u,T=C.memoizedProps,C=C.memoizedState,y=h.stateNode;try{var Ge=yl(h.type,T);o=y.getSnapshotBeforeUpdate(Ge,C),y.__reactInternalSnapshotBeforeUpdate=o}catch(ot){rn(h,h.return,ot)}}break;case 3:if((o&1024)!==0){if(o=u.stateNode.containerInfo,h=o.nodeType,h===9)i1(o);else if(h===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":i1(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=u.sibling,o!==null){o.return=u.return,dr=o;break}dr=u.return}}function hA(o,u,h){var y=h.flags;switch(h.tag){case 0:case 11:case 15:hi(o,h),y&4&&Cf(5,h);break;case 1:if(hi(o,h),y&4)if(o=h.stateNode,u===null)try{o.componentDidMount()}catch(O){rn(h,h.return,O)}else{var T=yl(h.type,u.memoizedProps);u=u.memoizedState;try{o.componentDidUpdate(T,u,o.__reactInternalSnapshotBeforeUpdate)}catch(O){rn(h,h.return,O)}}y&64&&oA(h),y&512&&Nf(h,h.return);break;case 3:if(hi(o,h),y&64&&(o=h.updateQueue,o!==null)){if(u=null,h.child!==null)switch(h.child.tag){case 27:case 5:u=h.child.stateNode;break;case 1:u=h.child.stateNode}try{QN(o,u)}catch(O){rn(h,h.return,O)}}break;case 27:u===null&&y&4&&dA(h);case 26:case 5:hi(o,h),u===null&&y&4&&cA(h),y&512&&Nf(h,h.return);break;case 12:hi(o,h);break;case 31:hi(o,h),y&4&&gA(o,h);break;case 13:hi(o,h),y&4&&xA(o,h),y&64&&(o=h.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(h=QU.bind(null,h),x$(o,h))));break;case 22:if(y=h.memoizedState!==null||di,!y){u=u!==null&&u.memoizedState!==null||Xn,T=di;var C=Xn;di=y,(Xn=u)&&!C?pi(o,h,(h.subtreeFlags&8772)!==0):hi(o,h),di=T,Xn=C}break;case 30:break;default:hi(o,h)}}function pA(o){var u=o.alternate;u!==null&&(o.alternate=null,pA(u)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(u=o.stateNode,u!==null&&db(u)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Cn=null,Ur=!1;function fi(o,u,h){for(h=h.child;h!==null;)mA(o,u,h),h=h.sibling}function mA(o,u,h){if(en&&typeof en.onCommitFiberUnmount=="function")try{en.onCommitFiberUnmount(Jt,h)}catch{}switch(h.tag){case 26:Xn||Na(h,u),fi(o,u,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:Xn||Na(h,u);var y=Cn,T=Ur;fo(h.type)&&(Cn=h.stateNode,Ur=!1),fi(o,u,h),If(h.stateNode),Cn=y,Ur=T;break;case 5:Xn||Na(h,u);case 6:if(y=Cn,T=Ur,Cn=null,fi(o,u,h),Cn=y,Ur=T,Cn!==null)if(Ur)try{(Cn.nodeType===9?Cn.body:Cn.nodeName==="HTML"?Cn.ownerDocument.body:Cn).removeChild(h.stateNode)}catch(C){rn(h,u,C)}else try{Cn.removeChild(h.stateNode)}catch(C){rn(h,u,C)}break;case 18:Cn!==null&&(Ur?(o=Cn,oj(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,h.stateNode),hu(o)):oj(Cn,h.stateNode));break;case 4:y=Cn,T=Ur,Cn=h.stateNode.containerInfo,Ur=!0,fi(o,u,h),Cn=y,Ur=T;break;case 0:case 11:case 14:case 15:so(2,h,u),Xn||so(4,h,u),fi(o,u,h);break;case 1:Xn||(Na(h,u),y=h.stateNode,typeof y.componentWillUnmount=="function"&&lA(h,u,y)),fi(o,u,h);break;case 21:fi(o,u,h);break;case 22:Xn=(y=Xn)||h.memoizedState!==null,fi(o,u,h),Xn=y;break;default:fi(o,u,h)}}function gA(o,u){if(u.memoizedState===null&&(o=u.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{hu(o)}catch(h){rn(u,u.return,h)}}}function xA(o,u){if(u.memoizedState===null&&(o=u.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{hu(o)}catch(h){rn(u,u.return,h)}}function $U(o){switch(o.tag){case 31:case 13:case 19:var u=o.stateNode;return u===null&&(u=o.stateNode=new fA),u;case 22:return o=o.stateNode,u=o._retryCache,u===null&&(u=o._retryCache=new fA),u;default:throw Error(r(435,o.tag))}}function Nm(o,u){var h=$U(o);u.forEach(function(y){if(!h.has(y)){h.add(y);var T=ZU.bind(null,o,y);y.then(T,T)}})}function $r(o,u){var h=u.deletions;if(h!==null)for(var y=0;y<h.length;y++){var T=h[y],C=o,O=u,H=O;e:for(;H!==null;){switch(H.tag){case 27:if(fo(H.type)){Cn=H.stateNode,Ur=!1;break e}break;case 5:Cn=H.stateNode,Ur=!1;break e;case 3:case 4:Cn=H.stateNode.containerInfo,Ur=!0;break e}H=H.return}if(Cn===null)throw Error(r(160));mA(C,O,T),Cn=null,Ur=!1,C=T.alternate,C!==null&&(C.return=null),T.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)bA(u,o),u=u.sibling}var ra=null;function bA(o,u){var h=o.alternate,y=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:$r(u,o),Vr(o),y&4&&(so(3,o,o.return),Cf(3,o),so(5,o,o.return));break;case 1:$r(u,o),Vr(o),y&512&&(Xn||h===null||Na(h,h.return)),y&64&&di&&(o=o.updateQueue,o!==null&&(y=o.callbacks,y!==null&&(h=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=h===null?y:h.concat(y))));break;case 26:var T=ra;if($r(u,o),Vr(o),y&512&&(Xn||h===null||Na(h,h.return)),y&4){var C=h!==null?h.memoizedState:null;if(y=o.memoizedState,h===null)if(y===null)if(o.stateNode===null){e:{y=o.type,h=o.memoizedProps,T=T.ownerDocument||T;t:switch(y){case"title":C=T.getElementsByTagName("title")[0],(!C||C[Zd]||C[xr]||C.namespaceURI==="http://www.w3.org/2000/svg"||C.hasAttribute("itemprop"))&&(C=T.createElement(y),T.head.insertBefore(C,T.querySelector("head > title"))),Er(C,y,h),C[xr]=o,ur(C),y=C;break e;case"link":var O=bj("link","href",T).get(y+(h.href||""));if(O){for(var H=0;H<O.length;H++)if(C=O[H],C.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&C.getAttribute("rel")===(h.rel==null?null:h.rel)&&C.getAttribute("title")===(h.title==null?null:h.title)&&C.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){O.splice(H,1);break t}}C=T.createElement(y),Er(C,y,h),T.head.appendChild(C);break;case"meta":if(O=bj("meta","content",T).get(y+(h.content||""))){for(H=0;H<O.length;H++)if(C=O[H],C.getAttribute("content")===(h.content==null?null:""+h.content)&&C.getAttribute("name")===(h.name==null?null:h.name)&&C.getAttribute("property")===(h.property==null?null:h.property)&&C.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&C.getAttribute("charset")===(h.charSet==null?null:h.charSet)){O.splice(H,1);break t}}C=T.createElement(y),Er(C,y,h),T.head.appendChild(C);break;default:throw Error(r(468,y))}C[xr]=o,ur(C),y=C}o.stateNode=y}else yj(T,o.type,o.stateNode);else o.stateNode=xj(T,y,o.memoizedProps);else C!==y?(C===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):C.count--,y===null?yj(T,o.type,o.stateNode):xj(T,y,o.memoizedProps)):y===null&&o.stateNode!==null&&Dy(o,o.memoizedProps,h.memoizedProps)}break;case 27:$r(u,o),Vr(o),y&512&&(Xn||h===null||Na(h,h.return)),h!==null&&y&4&&Dy(o,o.memoizedProps,h.memoizedProps);break;case 5:if($r(u,o),Vr(o),y&512&&(Xn||h===null||Na(h,h.return)),o.flags&32){T=o.stateNode;try{Lc(T,"")}catch(Ge){rn(o,o.return,Ge)}}y&4&&o.stateNode!=null&&(T=o.memoizedProps,Dy(o,T,h!==null?h.memoizedProps:T)),y&1024&&(Iy=!0);break;case 6:if($r(u,o),Vr(o),y&4){if(o.stateNode===null)throw Error(r(162));y=o.memoizedProps,h=o.stateNode;try{h.nodeValue=y}catch(Ge){rn(o,o.return,Ge)}}break;case 3:if(Um=null,T=ra,ra=zm(u.containerInfo),$r(u,o),ra=T,Vr(o),y&4&&h!==null&&h.memoizedState.isDehydrated)try{hu(u.containerInfo)}catch(Ge){rn(o,o.return,Ge)}Iy&&(Iy=!1,yA(o));break;case 4:y=ra,ra=zm(o.stateNode.containerInfo),$r(u,o),Vr(o),ra=y;break;case 12:$r(u,o),Vr(o);break;case 31:$r(u,o),Vr(o),y&4&&(y=o.updateQueue,y!==null&&(o.updateQueue=null,Nm(o,y)));break;case 13:$r(u,o),Vr(o),o.child.flags&8192&&o.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(Am=Xt()),y&4&&(y=o.updateQueue,y!==null&&(o.updateQueue=null,Nm(o,y)));break;case 22:T=o.memoizedState!==null;var ne=h!==null&&h.memoizedState!==null,he=di,Te=Xn;if(di=he||T,Xn=Te||ne,$r(u,o),Xn=Te,di=he,Vr(o),y&8192)e:for(u=o.stateNode,u._visibility=T?u._visibility&-2:u._visibility|1,T&&(h===null||ne||di||Xn||vl(o)),h=null,u=o;;){if(u.tag===5||u.tag===26){if(h===null){ne=h=u;try{if(C=ne.stateNode,T)O=C.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{H=ne.stateNode;var Ce=ne.memoizedProps.style,me=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;H.style.display=me==null||typeof me=="boolean"?"":(""+me).trim()}}catch(Ge){rn(ne,ne.return,Ge)}}}else if(u.tag===6){if(h===null){ne=u;try{ne.stateNode.nodeValue=T?"":ne.memoizedProps}catch(Ge){rn(ne,ne.return,Ge)}}}else if(u.tag===18){if(h===null){ne=u;try{var be=ne.stateNode;T?lj(be,!0):lj(ne.stateNode,!1)}catch(Ge){rn(ne,ne.return,Ge)}}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===o)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break e;for(;u.sibling===null;){if(u.return===null||u.return===o)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}y&4&&(y=o.updateQueue,y!==null&&(h=y.retryQueue,h!==null&&(y.retryQueue=null,Nm(o,h))));break;case 19:$r(u,o),Vr(o),y&4&&(y=o.updateQueue,y!==null&&(o.updateQueue=null,Nm(o,y)));break;case 30:break;case 21:break;default:$r(u,o),Vr(o)}}function Vr(o){var u=o.flags;if(u&2){try{for(var h,y=o.return;y!==null;){if(uA(y)){h=y;break}y=y.return}if(h==null)throw Error(r(160));switch(h.tag){case 27:var T=h.stateNode,C=My(o);Cm(o,C,T);break;case 5:var O=h.stateNode;h.flags&32&&(Lc(O,""),h.flags&=-33);var H=My(o);Cm(o,H,O);break;case 3:case 4:var ne=h.stateNode.containerInfo,he=My(o);Oy(o,he,ne);break;default:throw Error(r(161))}}catch(Te){rn(o,o.return,Te)}o.flags&=-3}u&4096&&(o.flags&=-4097)}function yA(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var u=o;yA(u),u.tag===5&&u.flags&1024&&u.stateNode.reset(),o=o.sibling}}function hi(o,u){if(u.subtreeFlags&8772)for(u=u.child;u!==null;)hA(o,u.alternate,u),u=u.sibling}function vl(o){for(o=o.child;o!==null;){var u=o;switch(u.tag){case 0:case 11:case 14:case 15:so(4,u,u.return),vl(u);break;case 1:Na(u,u.return);var h=u.stateNode;typeof h.componentWillUnmount=="function"&&lA(u,u.return,h),vl(u);break;case 27:If(u.stateNode);case 26:case 5:Na(u,u.return),vl(u);break;case 22:u.memoizedState===null&&vl(u);break;case 30:vl(u);break;default:vl(u)}o=o.sibling}}function pi(o,u,h){for(h=h&&(u.subtreeFlags&8772)!==0,u=u.child;u!==null;){var y=u.alternate,T=o,C=u,O=C.flags;switch(C.tag){case 0:case 11:case 15:pi(T,C,h),Cf(4,C);break;case 1:if(pi(T,C,h),y=C,T=y.stateNode,typeof T.componentDidMount=="function")try{T.componentDidMount()}catch(he){rn(y,y.return,he)}if(y=C,T=y.updateQueue,T!==null){var H=y.stateNode;try{var ne=T.shared.hiddenCallbacks;if(ne!==null)for(T.shared.hiddenCallbacks=null,T=0;T<ne.length;T++)XN(ne[T],H)}catch(he){rn(y,y.return,he)}}h&&O&64&&oA(C),Nf(C,C.return);break;case 27:dA(C);case 26:case 5:pi(T,C,h),h&&y===null&&O&4&&cA(C),Nf(C,C.return);break;case 12:pi(T,C,h);break;case 31:pi(T,C,h),h&&O&4&&gA(T,C);break;case 13:pi(T,C,h),h&&O&4&&xA(T,C);break;case 22:C.memoizedState===null&&pi(T,C,h),Nf(C,C.return);break;case 30:break;default:pi(T,C,h)}u=u.sibling}}function Ly(o,u){var h=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),o=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(o=u.memoizedState.cachePool.pool),o!==h&&(o!=null&&o.refCount++,h!=null&&ff(h))}function Py(o,u){o=null,u.alternate!==null&&(o=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==o&&(u.refCount++,o!=null&&ff(o))}function sa(o,u,h,y){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)vA(o,u,h,y),u=u.sibling}function vA(o,u,h,y){var T=u.flags;switch(u.tag){case 0:case 11:case 15:sa(o,u,h,y),T&2048&&Cf(9,u);break;case 1:sa(o,u,h,y);break;case 3:sa(o,u,h,y),T&2048&&(o=null,u.alternate!==null&&(o=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==o&&(u.refCount++,o!=null&&ff(o)));break;case 12:if(T&2048){sa(o,u,h,y),o=u.stateNode;try{var C=u.memoizedProps,O=C.id,H=C.onPostCommit;typeof H=="function"&&H(O,u.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(ne){rn(u,u.return,ne)}}else sa(o,u,h,y);break;case 31:sa(o,u,h,y);break;case 13:sa(o,u,h,y);break;case 23:break;case 22:C=u.stateNode,O=u.alternate,u.memoizedState!==null?C._visibility&2?sa(o,u,h,y):kf(o,u):C._visibility&2?sa(o,u,h,y):(C._visibility|=2,nu(o,u,h,y,(u.subtreeFlags&10256)!==0||!1)),T&2048&&Ly(O,u);break;case 24:sa(o,u,h,y),T&2048&&Py(u.alternate,u);break;default:sa(o,u,h,y)}}function nu(o,u,h,y,T){for(T=T&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var C=o,O=u,H=h,ne=y,he=O.flags;switch(O.tag){case 0:case 11:case 15:nu(C,O,H,ne,T),Cf(8,O);break;case 23:break;case 22:var Te=O.stateNode;O.memoizedState!==null?Te._visibility&2?nu(C,O,H,ne,T):kf(C,O):(Te._visibility|=2,nu(C,O,H,ne,T)),T&&he&2048&&Ly(O.alternate,O);break;case 24:nu(C,O,H,ne,T),T&&he&2048&&Py(O.alternate,O);break;default:nu(C,O,H,ne,T)}u=u.sibling}}function kf(o,u){if(u.subtreeFlags&10256)for(u=u.child;u!==null;){var h=o,y=u,T=y.flags;switch(y.tag){case 22:kf(h,y),T&2048&&Ly(y.alternate,y);break;case 24:kf(h,y),T&2048&&Py(y.alternate,y);break;default:kf(h,y)}u=u.sibling}}var Af=8192;function ru(o,u,h){if(o.subtreeFlags&Af)for(o=o.child;o!==null;)EA(o,u,h),o=o.sibling}function EA(o,u,h){switch(o.tag){case 26:ru(o,u,h),o.flags&Af&&o.memoizedState!==null&&j$(h,ra,o.memoizedState,o.memoizedProps);break;case 5:ru(o,u,h);break;case 3:case 4:var y=ra;ra=zm(o.stateNode.containerInfo),ru(o,u,h),ra=y;break;case 22:o.memoizedState===null&&(y=o.alternate,y!==null&&y.memoizedState!==null?(y=Af,Af=16777216,ru(o,u,h),Af=y):ru(o,u,h));break;default:ru(o,u,h)}}function TA(o){var u=o.alternate;if(u!==null&&(o=u.child,o!==null)){u.child=null;do u=o.sibling,o.sibling=null,o=u;while(o!==null)}}function jf(o){var u=o.deletions;if((o.flags&16)!==0){if(u!==null)for(var h=0;h<u.length;h++){var y=u[h];dr=y,wA(y,o)}TA(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)SA(o),o=o.sibling}function SA(o){switch(o.tag){case 0:case 11:case 15:jf(o),o.flags&2048&&so(9,o,o.return);break;case 3:jf(o);break;case 12:jf(o);break;case 22:var u=o.stateNode;o.memoizedState!==null&&u._visibility&2&&(o.return===null||o.return.tag!==13)?(u._visibility&=-3,km(o)):jf(o);break;default:jf(o)}}function km(o){var u=o.deletions;if((o.flags&16)!==0){if(u!==null)for(var h=0;h<u.length;h++){var y=u[h];dr=y,wA(y,o)}TA(o)}for(o=o.child;o!==null;){switch(u=o,u.tag){case 0:case 11:case 15:so(8,u,u.return),km(u);break;case 22:h=u.stateNode,h._visibility&2&&(h._visibility&=-3,km(u));break;default:km(u)}o=o.sibling}}function wA(o,u){for(;dr!==null;){var h=dr;switch(h.tag){case 0:case 11:case 15:so(8,h,u);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var y=h.memoizedState.cachePool.pool;y!=null&&y.refCount++}break;case 24:ff(h.memoizedState.cache)}if(y=h.child,y!==null)y.return=h,dr=y;else e:for(h=o;dr!==null;){y=dr;var T=y.sibling,C=y.return;if(pA(y),y===h){dr=null;break e}if(T!==null){T.return=C,dr=T;break e}dr=C}}}var VU={getCacheForType:function(o){var u=yr(Yn),h=u.data.get(o);return h===void 0&&(h=o(),u.data.set(o,h)),h},cacheSignal:function(){return yr(Yn).controller.signal}},qU=typeof WeakMap=="function"?WeakMap:Map,Wt=0,fn=null,_t=null,Ot=0,nn=0,cs=null,ao=!1,su=!1,By=!1,mi=0,Pn=0,io=0,El=0,Fy=0,us=0,au=0,_f=null,qr=null,zy=!1,Am=0,CA=0,jm=1/0,_m=null,oo=null,nr=0,lo=null,iu=null,gi=0,Hy=0,Uy=null,NA=null,Rf=0,$y=null;function ds(){return(Wt&2)!==0&&Ot!==0?Ot&-Ot:F.T!==null?Wy():js()}function kA(){if(us===0)if((Ot&536870912)===0||Bt){var o=Pt;Pt<<=1,(Pt&3932160)===0&&(Pt=262144),us=o}else us=536870912;return o=os.current,o!==null&&(o.flags|=32),us}function Gr(o,u,h){(o===fn&&(nn===2||nn===9)||o.cancelPendingCommit!==null)&&(ou(o,0),co(o,Ot,us,!1)),Ct(o,h),((Wt&2)===0||o!==fn)&&(o===fn&&((Wt&2)===0&&(El|=h),Pn===4&&co(o,Ot,us,!1)),ka(o))}function AA(o,u,h){if((Wt&6)!==0)throw Error(r(327));var y=!h&&(u&127)===0&&(u&o.expiredLanes)===0||rt(o,u),T=y?KU(o,u):qy(o,u,!0),C=y;do{if(T===0){su&&!y&&co(o,u,0,!1);break}else{if(h=o.current.alternate,C&&!GU(h)){T=qy(o,u,!1),C=!1;continue}if(T===2){if(C=u,o.errorRecoveryDisabledLanes&C)var O=0;else O=o.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){u=O;e:{var H=o;T=_f;var ne=H.current.memoizedState.isDehydrated;if(ne&&(ou(H,O).flags|=256),O=qy(H,O,!1),O!==2){if(By&&!ne){H.errorRecoveryDisabledLanes|=C,El|=C,T=4;break e}C=qr,qr=T,C!==null&&(qr===null?qr=C:qr.push.apply(qr,C))}T=O}if(C=!1,T!==2)continue}}if(T===1){ou(o,0),co(o,u,0,!0);break}e:{switch(y=o,C=T,C){case 0:case 1:throw Error(r(345));case 4:if((u&4194048)!==u)break;case 6:co(y,u,us,!ao);break e;case 2:qr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((u&62914560)===u&&(T=Am+300-Xt(),10<T)){if(co(y,u,us,!ao),$e(y,0,!0)!==0)break e;gi=u,y.timeoutHandle=aj(jA.bind(null,y,h,qr,_m,zy,u,us,El,au,ao,C,"Throttled",-0,0),T);break e}jA(y,h,qr,_m,zy,u,us,El,au,ao,C,null,-0,0)}}break}while(!0);ka(o)}function jA(o,u,h,y,T,C,O,H,ne,he,Te,Ce,me,be){if(o.timeoutHandle=-1,Ce=u.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ti},EA(u,C,Ce);var Ge=(C&62914560)===C?Am-Xt():(C&4194048)===C?CA-Xt():0;if(Ge=_$(Ce,Ge),Ge!==null){gi=C,o.cancelPendingCommit=Ge(PA.bind(null,o,u,C,h,y,T,O,H,ne,Te,Ce,null,me,be)),co(o,C,O,!he);return}}PA(o,u,C,h,y,T,O,H,ne)}function GU(o){for(var u=o;;){var h=u.tag;if((h===0||h===11||h===15)&&u.flags&16384&&(h=u.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var y=0;y<h.length;y++){var T=h[y],C=T.getSnapshot;T=T.value;try{if(!as(C(),T))return!1}catch{return!1}}if(h=u.child,u.subtreeFlags&16384&&h!==null)h.return=u,u=h;else{if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function co(o,u,h,y){u&=~Fy,u&=~El,o.suspendedLanes|=u,o.pingedLanes&=~u,y&&(o.warmLanes|=u),y=o.expirationTimes;for(var T=u;0<T;){var C=31-kt(T),O=1<<C;y[C]=-1,T&=~O}h!==0&&Ut(o,h,u)}function Rm(){return(Wt&6)===0?(Df(0),!1):!0}function Vy(){if(_t!==null){if(nn===0)var o=_t.return;else o=_t,ai=fl=null,iy(o),Qc=null,pf=0,o=_t;for(;o!==null;)iA(o.alternate,o),o=o.return;_t=null}}function ou(o,u){var h=o.timeoutHandle;h!==-1&&(o.timeoutHandle=-1,f$(h)),h=o.cancelPendingCommit,h!==null&&(o.cancelPendingCommit=null,h()),gi=0,Vy(),fn=o,_t=h=ri(o.current,null),Ot=u,nn=0,cs=null,ao=!1,su=rt(o,u),By=!1,au=us=Fy=El=io=Pn=0,qr=_f=null,zy=!1,(u&8)!==0&&(u|=u&32);var y=o.entangledLanes;if(y!==0)for(o=o.entanglements,y&=u;0<y;){var T=31-kt(y),C=1<<T;u|=o[T],y&=~C}return mi=u,Zp(),h}function _A(o,u){yt=null,F.H=Tf,u===Xc||u===im?(u=GN(),nn=3):u===Kb?(u=GN(),nn=4):nn=u===Ty?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,cs=u,_t===null&&(Pn=1,vm(o,Ms(u,o.current)))}function RA(){var o=os.current;return o===null?!0:(Ot&4194048)===Ot?Ps===null:(Ot&62914560)===Ot||(Ot&536870912)!==0?o===Ps:!1}function DA(){var o=F.H;return F.H=Tf,o===null?Tf:o}function MA(){var o=F.A;return F.A=VU,o}function Dm(){Pn=4,ao||(Ot&4194048)!==Ot&&os.current!==null||(su=!0),(io&134217727)===0&&(El&134217727)===0||fn===null||co(fn,Ot,us,!1)}function qy(o,u,h){var y=Wt;Wt|=2;var T=DA(),C=MA();(fn!==o||Ot!==u)&&(_m=null,ou(o,u)),u=!1;var O=Pn;e:do try{if(nn!==0&&_t!==null){var H=_t,ne=cs;switch(nn){case 8:Vy(),O=6;break e;case 3:case 2:case 9:case 6:os.current===null&&(u=!0);var he=nn;if(nn=0,cs=null,lu(o,H,ne,he),h&&su){O=0;break e}break;default:he=nn,nn=0,cs=null,lu(o,H,ne,he)}}YU(),O=Pn;break}catch(Te){_A(o,Te)}while(!0);return u&&o.shellSuspendCounter++,ai=fl=null,Wt=y,F.H=T,F.A=C,_t===null&&(fn=null,Ot=0,Zp()),O}function YU(){for(;_t!==null;)OA(_t)}function KU(o,u){var h=Wt;Wt|=2;var y=DA(),T=MA();fn!==o||Ot!==u?(_m=null,jm=Xt()+500,ou(o,u)):su=rt(o,u);e:do try{if(nn!==0&&_t!==null){u=_t;var C=cs;t:switch(nn){case 1:nn=0,cs=null,lu(o,u,C,1);break;case 2:case 9:if(VN(C)){nn=0,cs=null,IA(u);break}u=function(){nn!==2&&nn!==9||fn!==o||(nn=7),ka(o)},C.then(u,u);break e;case 3:nn=7;break e;case 4:nn=5;break e;case 7:VN(C)?(nn=0,cs=null,IA(u)):(nn=0,cs=null,lu(o,u,C,7));break;case 5:var O=null;switch(_t.tag){case 26:O=_t.memoizedState;case 5:case 27:var H=_t;if(O?vj(O):H.stateNode.complete){nn=0,cs=null;var ne=H.sibling;if(ne!==null)_t=ne;else{var he=H.return;he!==null?(_t=he,Mm(he)):_t=null}break t}}nn=0,cs=null,lu(o,u,C,5);break;case 6:nn=0,cs=null,lu(o,u,C,6);break;case 8:Vy(),Pn=6;break e;default:throw Error(r(462))}}WU();break}catch(Te){_A(o,Te)}while(!0);return ai=fl=null,F.H=y,F.A=T,Wt=h,_t!==null?0:(fn=null,Ot=0,Zp(),Pn)}function WU(){for(;_t!==null&&!Zt();)OA(_t)}function OA(o){var u=sA(o.alternate,o,mi);o.memoizedProps=o.pendingProps,u===null?Mm(o):_t=u}function IA(o){var u=o,h=u.alternate;switch(u.tag){case 15:case 0:u=Zk(h,u,u.pendingProps,u.type,void 0,Ot);break;case 11:u=Zk(h,u,u.pendingProps,u.type.render,u.ref,Ot);break;case 5:iy(u);default:iA(h,u),u=_t=MN(u,mi),u=sA(h,u,mi)}o.memoizedProps=o.pendingProps,u===null?Mm(o):_t=u}function lu(o,u,h,y){ai=fl=null,iy(u),Qc=null,pf=0;var T=u.return;try{if(PU(o,T,u,h,Ot)){Pn=1,vm(o,Ms(h,o.current)),_t=null;return}}catch(C){if(T!==null)throw _t=T,C;Pn=1,vm(o,Ms(h,o.current)),_t=null;return}u.flags&32768?(Bt||y===1?o=!0:su||(Ot&536870912)!==0?o=!1:(ao=o=!0,(y===2||y===9||y===3||y===6)&&(y=os.current,y!==null&&y.tag===13&&(y.flags|=16384))),LA(u,o)):Mm(u)}function Mm(o){var u=o;do{if((u.flags&32768)!==0){LA(u,ao);return}o=u.return;var h=zU(u.alternate,u,mi);if(h!==null){_t=h;return}if(u=u.sibling,u!==null){_t=u;return}_t=u=o}while(u!==null);Pn===0&&(Pn=5)}function LA(o,u){do{var h=HU(o.alternate,o);if(h!==null){h.flags&=32767,_t=h;return}if(h=o.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!u&&(o=o.sibling,o!==null)){_t=o;return}_t=o=h}while(o!==null);Pn=6,_t=null}function PA(o,u,h,y,T,C,O,H,ne){o.cancelPendingCommit=null;do Om();while(nr!==0);if((Wt&6)!==0)throw Error(r(327));if(u!==null){if(u===o.current)throw Error(r(177));if(C=u.lanes|u.childLanes,C|=Mb,mt(o,h,C,O,H,ne),o===fn&&(_t=fn=null,Ot=0),iu=u,lo=o,gi=h,Hy=C,Uy=T,NA=y,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,JU(Me,function(){return UA(),null})):(o.callbackNode=null,o.callbackPriority=0),y=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||y){y=F.T,F.T=null,T=$.p,$.p=2,O=Wt,Wt|=4;try{UU(o,u,h)}finally{Wt=O,$.p=T,F.T=y}}nr=1,BA(),FA(),zA()}}function BA(){if(nr===1){nr=0;var o=lo,u=iu,h=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||h){h=F.T,F.T=null;var y=$.p;$.p=2;var T=Wt;Wt|=4;try{bA(u,o);var C=r1,O=wN(o.containerInfo),H=C.focusedElem,ne=C.selectionRange;if(O!==H&&H&&H.ownerDocument&&SN(H.ownerDocument.documentElement,H)){if(ne!==null&&Ab(H)){var he=ne.start,Te=ne.end;if(Te===void 0&&(Te=he),"selectionStart"in H)H.selectionStart=he,H.selectionEnd=Math.min(Te,H.value.length);else{var Ce=H.ownerDocument||document,me=Ce&&Ce.defaultView||window;if(me.getSelection){var be=me.getSelection(),Ge=H.textContent.length,ot=Math.min(ne.start,Ge),ln=ne.end===void 0?ot:Math.min(ne.end,Ge);!be.extend&&ot>ln&&(O=ln,ln=ot,ot=O);var ce=TN(H,ot),ae=TN(H,ln);if(ce&&ae&&(be.rangeCount!==1||be.anchorNode!==ce.node||be.anchorOffset!==ce.offset||be.focusNode!==ae.node||be.focusOffset!==ae.offset)){var fe=Ce.createRange();fe.setStart(ce.node,ce.offset),be.removeAllRanges(),ot>ln?(be.addRange(fe),be.extend(ae.node,ae.offset)):(fe.setEnd(ae.node,ae.offset),be.addRange(fe))}}}}for(Ce=[],be=H;be=be.parentNode;)be.nodeType===1&&Ce.push({element:be,left:be.scrollLeft,top:be.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<Ce.length;H++){var we=Ce[H];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}Gm=!!n1,r1=n1=null}finally{Wt=T,$.p=y,F.T=h}}o.current=u,nr=2}}function FA(){if(nr===2){nr=0;var o=lo,u=iu,h=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||h){h=F.T,F.T=null;var y=$.p;$.p=2;var T=Wt;Wt|=4;try{hA(o,u.alternate,u)}finally{Wt=T,$.p=y,F.T=h}}nr=3}}function zA(){if(nr===4||nr===3){nr=0,wn();var o=lo,u=iu,h=gi,y=NA;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?nr=5:(nr=0,iu=lo=null,HA(o,o.pendingLanes));var T=o.pendingLanes;if(T===0&&(oo=null),ss(h),u=u.stateNode,en&&typeof en.onCommitFiberRoot=="function")try{en.onCommitFiberRoot(Jt,u,void 0,(u.current.flags&128)===128)}catch{}if(y!==null){u=F.T,T=$.p,$.p=2,F.T=null;try{for(var C=o.onRecoverableError,O=0;O<y.length;O++){var H=y[O];C(H.value,{componentStack:H.stack})}}finally{F.T=u,$.p=T}}(gi&3)!==0&&Om(),ka(o),T=o.pendingLanes,(h&261930)!==0&&(T&42)!==0?o===$y?Rf++:(Rf=0,$y=o):Rf=0,Df(0)}}function HA(o,u){(o.pooledCacheLanes&=u)===0&&(u=o.pooledCache,u!=null&&(o.pooledCache=null,ff(u)))}function Om(){return BA(),FA(),zA(),UA()}function UA(){if(nr!==5)return!1;var o=lo,u=Hy;Hy=0;var h=ss(gi),y=F.T,T=$.p;try{$.p=32>h?32:h,F.T=null,h=Uy,Uy=null;var C=lo,O=gi;if(nr=0,iu=lo=null,gi=0,(Wt&6)!==0)throw Error(r(331));var H=Wt;if(Wt|=4,SA(C.current),vA(C,C.current,O,h),Wt=H,Df(0,!1),en&&typeof en.onPostCommitFiberRoot=="function")try{en.onPostCommitFiberRoot(Jt,C)}catch{}return!0}finally{$.p=T,F.T=y,HA(o,u)}}function $A(o,u,h){u=Ms(h,u),u=Ey(o.stateNode,u,2),o=to(o,u,2),o!==null&&(Ct(o,2),ka(o))}function rn(o,u,h){if(o.tag===3)$A(o,o,h);else for(;u!==null;){if(u.tag===3){$A(u,o,h);break}else if(u.tag===1){var y=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(oo===null||!oo.has(y))){o=Ms(h,o),h=Vk(2),y=to(u,h,2),y!==null&&(qk(h,y,u,o),Ct(y,2),ka(y));break}}u=u.return}}function Gy(o,u,h){var y=o.pingCache;if(y===null){y=o.pingCache=new qU;var T=new Set;y.set(u,T)}else T=y.get(u),T===void 0&&(T=new Set,y.set(u,T));T.has(h)||(By=!0,T.add(h),o=XU.bind(null,o,u,h),u.then(o,o))}function XU(o,u,h){var y=o.pingCache;y!==null&&y.delete(u),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,fn===o&&(Ot&h)===h&&(Pn===4||Pn===3&&(Ot&62914560)===Ot&&300>Xt()-Am?(Wt&2)===0&&ou(o,0):Fy|=h,au===Ot&&(au=0)),ka(o)}function VA(o,u){u===0&&(u=bt()),o=cl(o,u),o!==null&&(Ct(o,u),ka(o))}function QU(o){var u=o.memoizedState,h=0;u!==null&&(h=u.retryLane),VA(o,h)}function ZU(o,u){var h=0;switch(o.tag){case 31:case 13:var y=o.stateNode,T=o.memoizedState;T!==null&&(h=T.retryLane);break;case 19:y=o.stateNode;break;case 22:y=o.stateNode._retryCache;break;default:throw Error(r(314))}y!==null&&y.delete(u),VA(o,h)}function JU(o,u){return Mt(o,u)}var Im=null,cu=null,Yy=!1,Lm=!1,Ky=!1,uo=0;function ka(o){o!==cu&&o.next===null&&(cu===null?Im=cu=o:cu=cu.next=o),Lm=!0,Yy||(Yy=!0,t$())}function Df(o,u){if(!Ky&&Lm){Ky=!0;do for(var h=!1,y=Im;y!==null;){if(o!==0){var T=y.pendingLanes;if(T===0)var C=0;else{var O=y.suspendedLanes,H=y.pingedLanes;C=(1<<31-kt(42|o)+1)-1,C&=T&~(O&~H),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(h=!0,KA(y,C))}else C=Ot,C=$e(y,y===fn?C:0,y.cancelPendingCommit!==null||y.timeoutHandle!==-1),(C&3)===0||rt(y,C)||(h=!0,KA(y,C));y=y.next}while(h);Ky=!1}}function e$(){qA()}function qA(){Lm=Yy=!1;var o=0;uo!==0&&d$()&&(o=uo);for(var u=Xt(),h=null,y=Im;y!==null;){var T=y.next,C=GA(y,u);C===0?(y.next=null,h===null?Im=T:h.next=T,T===null&&(cu=h)):(h=y,(o!==0||(C&3)!==0)&&(Lm=!0)),y=T}nr!==0&&nr!==5||Df(o),uo!==0&&(uo=0)}function GA(o,u){for(var h=o.suspendedLanes,y=o.pingedLanes,T=o.expirationTimes,C=o.pendingLanes&-62914561;0<C;){var O=31-kt(C),H=1<<O,ne=T[O];ne===-1?((H&h)===0||(H&y)!==0)&&(T[O]=pt(H,u)):ne<=u&&(o.expiredLanes|=H),C&=~H}if(u=fn,h=Ot,h=$e(o,o===u?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),y=o.callbackNode,h===0||o===u&&(nn===2||nn===9)||o.cancelPendingCommit!==null)return y!==null&&y!==null&&un(y),o.callbackNode=null,o.callbackPriority=0;if((h&3)===0||rt(o,h)){if(u=h&-h,u===o.callbackPriority)return u;switch(y!==null&&un(y),ss(h)){case 2:case 8:h=Ee;break;case 32:h=Me;break;case 268435456:h=et;break;default:h=Me}return y=YA.bind(null,o),h=Mt(h,y),o.callbackPriority=u,o.callbackNode=h,u}return y!==null&&y!==null&&un(y),o.callbackPriority=2,o.callbackNode=null,2}function YA(o,u){if(nr!==0&&nr!==5)return o.callbackNode=null,o.callbackPriority=0,null;var h=o.callbackNode;if(Om()&&o.callbackNode!==h)return null;var y=Ot;return y=$e(o,o===fn?y:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),y===0?null:(AA(o,y,u),GA(o,Xt()),o.callbackNode!=null&&o.callbackNode===h?YA.bind(null,o):null)}function KA(o,u){if(Om())return null;AA(o,u,!0)}function t$(){h$(function(){(Wt&6)!==0?Mt(se,e$):qA()})}function Wy(){if(uo===0){var o=Kc;o===0&&(o=ht,ht<<=1,(ht&261888)===0&&(ht=256)),uo=o}return uo}function WA(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Vp(""+o)}function XA(o,u){var h=u.ownerDocument.createElement("input");return h.name=u.name,h.value=u.value,o.id&&h.setAttribute("form",o.id),u.parentNode.insertBefore(h,u),o=new FormData(o),h.parentNode.removeChild(h),o}function n$(o,u,h,y,T){if(u==="submit"&&h&&h.stateNode===T){var C=WA((T[zr]||null).action),O=y.submitter;O&&(u=(u=O[zr]||null)?WA(u.formAction):O.getAttribute("formAction"),u!==null&&(C=u,O=null));var H=new Kp("action","action",null,y,T);o.push({event:H,listeners:[{instance:null,listener:function(){if(y.defaultPrevented){if(uo!==0){var ne=O?XA(T,O):new FormData(T);my(h,{pending:!0,data:ne,method:T.method,action:C},null,ne)}}else typeof C=="function"&&(H.preventDefault(),ne=O?XA(T,O):new FormData(T),my(h,{pending:!0,data:ne,method:T.method,action:C},C,ne))},currentTarget:T}]})}}for(var Xy=0;Xy<Db.length;Xy++){var Qy=Db[Xy],r$=Qy.toLowerCase(),s$=Qy[0].toUpperCase()+Qy.slice(1);na(r$,"on"+s$)}na(kN,"onAnimationEnd"),na(AN,"onAnimationIteration"),na(jN,"onAnimationStart"),na("dblclick","onDoubleClick"),na("focusin","onFocus"),na("focusout","onBlur"),na(vU,"onTransitionRun"),na(EU,"onTransitionStart"),na(TU,"onTransitionCancel"),na(_N,"onTransitionEnd"),Oc("onMouseEnter",["mouseout","mouseover"]),Oc("onMouseLeave",["mouseout","mouseover"]),Oc("onPointerEnter",["pointerout","pointerover"]),Oc("onPointerLeave",["pointerout","pointerover"]),al("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),al("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),al("onBeforeInput",["compositionend","keypress","textInput","paste"]),al("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),al("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),al("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mf="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(" "),a$=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Mf));function QA(o,u){u=(u&4)!==0;for(var h=0;h<o.length;h++){var y=o[h],T=y.event;y=y.listeners;e:{var C=void 0;if(u)for(var O=y.length-1;0<=O;O--){var H=y[O],ne=H.instance,he=H.currentTarget;if(H=H.listener,ne!==C&&T.isPropagationStopped())break e;C=H,T.currentTarget=he;try{C(T)}catch(Te){Qp(Te)}T.currentTarget=null,C=ne}else for(O=0;O<y.length;O++){if(H=y[O],ne=H.instance,he=H.currentTarget,H=H.listener,ne!==C&&T.isPropagationStopped())break e;C=H,T.currentTarget=he;try{C(T)}catch(Te){Qp(Te)}T.currentTarget=null,C=ne}}}}function Rt(o,u){var h=u[ub];h===void 0&&(h=u[ub]=new Set);var y=o+"__bubble";h.has(y)||(ZA(u,o,2,!1),h.add(y))}function Zy(o,u,h){var y=0;u&&(y|=4),ZA(h,o,y,u)}var Pm="_reactListening"+Math.random().toString(36).slice(2);function Jy(o){if(!o[Pm]){o[Pm]=!0,qC.forEach(function(h){h!=="selectionchange"&&(a$.has(h)||Zy(h,!1,o),Zy(h,!0,o))});var u=o.nodeType===9?o:o.ownerDocument;u===null||u[Pm]||(u[Pm]=!0,Zy("selectionchange",!1,u))}}function ZA(o,u,h,y){switch(kj(u)){case 2:var T=M$;break;case 8:T=O$;break;default:T=p1}h=T.bind(null,u,h,o),T=void 0,!yb||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(T=!0),y?T!==void 0?o.addEventListener(u,h,{capture:!0,passive:T}):o.addEventListener(u,h,!0):T!==void 0?o.addEventListener(u,h,{passive:T}):o.addEventListener(u,h,!1)}function e1(o,u,h,y,T){var C=y;if((u&1)===0&&(u&2)===0&&y!==null)e:for(;;){if(y===null)return;var O=y.tag;if(O===3||O===4){var H=y.stateNode.containerInfo;if(H===T)break;if(O===4)for(O=y.return;O!==null;){var ne=O.tag;if((ne===3||ne===4)&&O.stateNode.containerInfo===T)return;O=O.return}for(;H!==null;){if(O=Rc(H),O===null)return;if(ne=O.tag,ne===5||ne===6||ne===26||ne===27){y=C=O;continue e}H=H.parentNode}}y=y.return}rN(function(){var he=C,Te=xb(h),Ce=[];e:{var me=RN.get(o);if(me!==void 0){var be=Kp,Ge=o;switch(o){case"keypress":if(Gp(h)===0)break e;case"keydown":case"keyup":be=ZH;break;case"focusin":Ge="focus",be=Sb;break;case"focusout":Ge="blur",be=Sb;break;case"beforeblur":case"afterblur":be=Sb;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":be=iN;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=zH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=tU;break;case kN:case AN:case jN:be=$H;break;case _N:be=rU;break;case"scroll":case"scrollend":be=BH;break;case"wheel":be=aU;break;case"copy":case"cut":case"paste":be=qH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=lN;break;case"toggle":case"beforetoggle":be=oU}var ot=(u&4)!==0,ln=!ot&&(o==="scroll"||o==="scrollend"),ce=ot?me!==null?me+"Capture":null:me;ot=[];for(var ae=he,fe;ae!==null;){var we=ae;if(fe=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||fe===null||ce===null||(we=ef(ae,ce),we!=null&&ot.push(Of(ae,we,fe))),ln)break;ae=ae.return}0<ot.length&&(me=new be(me,Ge,null,h,Te),Ce.push({event:me,listeners:ot}))}}if((u&7)===0){e:{if(me=o==="mouseover"||o==="pointerover",be=o==="mouseout"||o==="pointerout",me&&h!==gb&&(Ge=h.relatedTarget||h.fromElement)&&(Rc(Ge)||Ge[_c]))break e;if((be||me)&&(me=Te.window===Te?Te:(me=Te.ownerDocument)?me.defaultView||me.parentWindow:window,be?(Ge=h.relatedTarget||h.toElement,be=he,Ge=Ge?Rc(Ge):null,Ge!==null&&(ln=a(Ge),ot=Ge.tag,Ge!==ln||ot!==5&&ot!==27&&ot!==6)&&(Ge=null)):(be=null,Ge=he),be!==Ge)){if(ot=iN,we="onMouseLeave",ce="onMouseEnter",ae="mouse",(o==="pointerout"||o==="pointerover")&&(ot=lN,we="onPointerLeave",ce="onPointerEnter",ae="pointer"),ln=be==null?me:Jd(be),fe=Ge==null?me:Jd(Ge),me=new ot(we,ae+"leave",be,h,Te),me.target=ln,me.relatedTarget=fe,we=null,Rc(Te)===he&&(ot=new ot(ce,ae+"enter",Ge,h,Te),ot.target=fe,ot.relatedTarget=ln,we=ot),ln=we,be&&Ge)t:{for(ot=i$,ce=be,ae=Ge,fe=0,we=ce;we;we=ot(we))fe++;we=0;for(var st=ae;st;st=ot(st))we++;for(;0<fe-we;)ce=ot(ce),fe--;for(;0<we-fe;)ae=ot(ae),we--;for(;fe--;){if(ce===ae||ae!==null&&ce===ae.alternate){ot=ce;break t}ce=ot(ce),ae=ot(ae)}ot=null}else ot=null;be!==null&&JA(Ce,me,be,ot,!1),Ge!==null&&ln!==null&&JA(Ce,ln,Ge,ot,!0)}}e:{if(me=he?Jd(he):window,be=me.nodeName&&me.nodeName.toLowerCase(),be==="select"||be==="input"&&me.type==="file")var $t=gN;else if(pN(me))if(xN)$t=xU;else{$t=mU;var Qe=pU}else be=me.nodeName,!be||be.toLowerCase()!=="input"||me.type!=="checkbox"&&me.type!=="radio"?he&&mb(he.elementType)&&($t=gN):$t=gU;if($t&&($t=$t(o,he))){mN(Ce,$t,h,Te);break e}Qe&&Qe(o,me,he),o==="focusout"&&he&&me.type==="number"&&he.memoizedProps.value!=null&&pb(me,"number",me.value)}switch(Qe=he?Jd(he):window,o){case"focusin":(pN(Qe)||Qe.contentEditable==="true")&&(zc=Qe,jb=he,cf=null);break;case"focusout":cf=jb=zc=null;break;case"mousedown":_b=!0;break;case"contextmenu":case"mouseup":case"dragend":_b=!1,CN(Ce,h,Te);break;case"selectionchange":if(yU)break;case"keydown":case"keyup":CN(Ce,h,Te)}var vt;if(Cb)e:{switch(o){case"compositionstart":var It="onCompositionStart";break e;case"compositionend":It="onCompositionEnd";break e;case"compositionupdate":It="onCompositionUpdate";break e}It=void 0}else Fc?fN(o,h)&&(It="onCompositionEnd"):o==="keydown"&&h.keyCode===229&&(It="onCompositionStart");It&&(cN&&h.locale!=="ko"&&(Fc||It!=="onCompositionStart"?It==="onCompositionEnd"&&Fc&&(vt=sN()):(Ki=Te,vb="value"in Ki?Ki.value:Ki.textContent,Fc=!0)),Qe=Bm(he,It),0<Qe.length&&(It=new oN(It,o,null,h,Te),Ce.push({event:It,listeners:Qe}),vt?It.data=vt:(vt=hN(h),vt!==null&&(It.data=vt)))),(vt=cU?uU(o,h):dU(o,h))&&(It=Bm(he,"onBeforeInput"),0<It.length&&(Qe=new oN("onBeforeInput","beforeinput",null,h,Te),Ce.push({event:Qe,listeners:It}),Qe.data=vt)),n$(Ce,o,he,h,Te)}QA(Ce,u)})}function Of(o,u,h){return{instance:o,listener:u,currentTarget:h}}function Bm(o,u){for(var h=u+"Capture",y=[];o!==null;){var T=o,C=T.stateNode;if(T=T.tag,T!==5&&T!==26&&T!==27||C===null||(T=ef(o,h),T!=null&&y.unshift(Of(o,T,C)),T=ef(o,u),T!=null&&y.push(Of(o,T,C))),o.tag===3)return y;o=o.return}return[]}function i$(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function JA(o,u,h,y,T){for(var C=u._reactName,O=[];h!==null&&h!==y;){var H=h,ne=H.alternate,he=H.stateNode;if(H=H.tag,ne!==null&&ne===y)break;H!==5&&H!==26&&H!==27||he===null||(ne=he,T?(he=ef(h,C),he!=null&&O.unshift(Of(h,he,ne))):T||(he=ef(h,C),he!=null&&O.push(Of(h,he,ne)))),h=h.return}O.length!==0&&o.push({event:u,listeners:O})}var o$=/\r\n?/g,l$=/\u0000|\uFFFD/g;function ej(o){return(typeof o=="string"?o:""+o).replace(o$,`
|
|
50
50
|
`).replace(l$,"")}function tj(o,u){return u=ej(u),ej(o)===u}function on(o,u,h,y,T,C){switch(h){case"children":typeof y=="string"?u==="body"||u==="textarea"&&y===""||Lc(o,y):(typeof y=="number"||typeof y=="bigint")&&u!=="body"&&Lc(o,""+y);break;case"className":Up(o,"class",y);break;case"tabIndex":Up(o,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":Up(o,h,y);break;case"style":tN(o,y,C);break;case"data":if(u!=="object"){Up(o,"data",y);break}case"src":case"href":if(y===""&&(u!=="a"||h!=="href")){o.removeAttribute(h);break}if(y==null||typeof y=="function"||typeof y=="symbol"||typeof y=="boolean"){o.removeAttribute(h);break}y=Vp(""+y),o.setAttribute(h,y);break;case"action":case"formAction":if(typeof y=="function"){o.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof C=="function"&&(h==="formAction"?(u!=="input"&&on(o,u,"name",T.name,T,null),on(o,u,"formEncType",T.formEncType,T,null),on(o,u,"formMethod",T.formMethod,T,null),on(o,u,"formTarget",T.formTarget,T,null)):(on(o,u,"encType",T.encType,T,null),on(o,u,"method",T.method,T,null),on(o,u,"target",T.target,T,null)));if(y==null||typeof y=="symbol"||typeof y=="boolean"){o.removeAttribute(h);break}y=Vp(""+y),o.setAttribute(h,y);break;case"onClick":y!=null&&(o.onclick=ti);break;case"onScroll":y!=null&&Rt("scroll",o);break;case"onScrollEnd":y!=null&&Rt("scrollend",o);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(r(61));if(h=y.__html,h!=null){if(T.children!=null)throw Error(r(60));o.innerHTML=h}}break;case"multiple":o.multiple=y&&typeof y!="function"&&typeof y!="symbol";break;case"muted":o.muted=y&&typeof y!="function"&&typeof y!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(y==null||typeof y=="function"||typeof y=="boolean"||typeof y=="symbol"){o.removeAttribute("xlink:href");break}h=Vp(""+y),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":y!=null&&typeof y!="function"&&typeof y!="symbol"?o.setAttribute(h,""+y):o.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":y&&typeof y!="function"&&typeof y!="symbol"?o.setAttribute(h,""):o.removeAttribute(h);break;case"capture":case"download":y===!0?o.setAttribute(h,""):y!==!1&&y!=null&&typeof y!="function"&&typeof y!="symbol"?o.setAttribute(h,y):o.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":y!=null&&typeof y!="function"&&typeof y!="symbol"&&!isNaN(y)&&1<=y?o.setAttribute(h,y):o.removeAttribute(h);break;case"rowSpan":case"start":y==null||typeof y=="function"||typeof y=="symbol"||isNaN(y)?o.removeAttribute(h):o.setAttribute(h,y);break;case"popover":Rt("beforetoggle",o),Rt("toggle",o),Hp(o,"popover",y);break;case"xlinkActuate":ei(o,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":ei(o,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":ei(o,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":ei(o,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":ei(o,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":ei(o,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":ei(o,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":ei(o,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":ei(o,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":Hp(o,"is",y);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=LH.get(h)||h,Hp(o,h,y))}}function t1(o,u,h,y,T,C){switch(h){case"style":tN(o,y,C);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(r(61));if(h=y.__html,h!=null){if(T.children!=null)throw Error(r(60));o.innerHTML=h}}break;case"children":typeof y=="string"?Lc(o,y):(typeof y=="number"||typeof y=="bigint")&&Lc(o,""+y);break;case"onScroll":y!=null&&Rt("scroll",o);break;case"onScrollEnd":y!=null&&Rt("scrollend",o);break;case"onClick":y!=null&&(o.onclick=ti);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!GC.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(T=h.endsWith("Capture"),u=h.slice(2,T?h.length-7:void 0),C=o[zr]||null,C=C!=null?C[h]:null,typeof C=="function"&&o.removeEventListener(u,C,T),typeof y=="function")){typeof C!="function"&&C!==null&&(h in o?o[h]=null:o.hasAttribute(h)&&o.removeAttribute(h)),o.addEventListener(u,y,T);break e}h in o?o[h]=y:y===!0?o.setAttribute(h,""):Hp(o,h,y)}}}function Er(o,u,h){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Rt("error",o),Rt("load",o);var y=!1,T=!1,C;for(C in h)if(h.hasOwnProperty(C)){var O=h[C];if(O!=null)switch(C){case"src":y=!0;break;case"srcSet":T=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,u));default:on(o,u,C,O,h,null)}}T&&on(o,u,"srcSet",h.srcSet,h,null),y&&on(o,u,"src",h.src,h,null);return;case"input":Rt("invalid",o);var H=C=O=T=null,ne=null,he=null;for(y in h)if(h.hasOwnProperty(y)){var Te=h[y];if(Te!=null)switch(y){case"name":T=Te;break;case"type":O=Te;break;case"checked":ne=Te;break;case"defaultChecked":he=Te;break;case"value":C=Te;break;case"defaultValue":H=Te;break;case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(r(137,u));break;default:on(o,u,y,Te,h,null)}}QC(o,C,H,ne,he,O,T,!1);return;case"select":Rt("invalid",o),y=O=C=null;for(T in h)if(h.hasOwnProperty(T)&&(H=h[T],H!=null))switch(T){case"value":C=H;break;case"defaultValue":O=H;break;case"multiple":y=H;default:on(o,u,T,H,h,null)}u=C,h=O,o.multiple=!!y,u!=null?Ic(o,!!y,u,!1):h!=null&&Ic(o,!!y,h,!0);return;case"textarea":Rt("invalid",o),C=T=y=null;for(O in h)if(h.hasOwnProperty(O)&&(H=h[O],H!=null))switch(O){case"value":y=H;break;case"defaultValue":T=H;break;case"children":C=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(91));break;default:on(o,u,O,H,h,null)}JC(o,y,T,C);return;case"option":for(ne in h)if(h.hasOwnProperty(ne)&&(y=h[ne],y!=null))switch(ne){case"selected":o.selected=y&&typeof y!="function"&&typeof y!="symbol";break;default:on(o,u,ne,y,h,null)}return;case"dialog":Rt("beforetoggle",o),Rt("toggle",o),Rt("cancel",o),Rt("close",o);break;case"iframe":case"object":Rt("load",o);break;case"video":case"audio":for(y=0;y<Mf.length;y++)Rt(Mf[y],o);break;case"image":Rt("error",o),Rt("load",o);break;case"details":Rt("toggle",o);break;case"embed":case"source":case"link":Rt("error",o),Rt("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(he in h)if(h.hasOwnProperty(he)&&(y=h[he],y!=null))switch(he){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,u));default:on(o,u,he,y,h,null)}return;default:if(mb(u)){for(Te in h)h.hasOwnProperty(Te)&&(y=h[Te],y!==void 0&&t1(o,u,Te,y,h,void 0));return}}for(H in h)h.hasOwnProperty(H)&&(y=h[H],y!=null&&on(o,u,H,y,h,null))}function c$(o,u,h,y){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var T=null,C=null,O=null,H=null,ne=null,he=null,Te=null;for(be in h){var Ce=h[be];if(h.hasOwnProperty(be)&&Ce!=null)switch(be){case"checked":break;case"value":break;case"defaultValue":ne=Ce;default:y.hasOwnProperty(be)||on(o,u,be,null,y,Ce)}}for(var me in y){var be=y[me];if(Ce=h[me],y.hasOwnProperty(me)&&(be!=null||Ce!=null))switch(me){case"type":C=be;break;case"name":T=be;break;case"checked":he=be;break;case"defaultChecked":Te=be;break;case"value":O=be;break;case"defaultValue":H=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(r(137,u));break;default:be!==Ce&&on(o,u,me,be,y,Ce)}}hb(o,O,H,ne,he,Te,C,T);return;case"select":be=O=H=me=null;for(C in h)if(ne=h[C],h.hasOwnProperty(C)&&ne!=null)switch(C){case"value":break;case"multiple":be=ne;default:y.hasOwnProperty(C)||on(o,u,C,null,y,ne)}for(T in y)if(C=y[T],ne=h[T],y.hasOwnProperty(T)&&(C!=null||ne!=null))switch(T){case"value":me=C;break;case"defaultValue":H=C;break;case"multiple":O=C;default:C!==ne&&on(o,u,T,C,y,ne)}u=H,h=O,y=be,me!=null?Ic(o,!!h,me,!1):!!y!=!!h&&(u!=null?Ic(o,!!h,u,!0):Ic(o,!!h,h?[]:"",!1));return;case"textarea":be=me=null;for(H in h)if(T=h[H],h.hasOwnProperty(H)&&T!=null&&!y.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:on(o,u,H,null,y,T)}for(O in y)if(T=y[O],C=h[O],y.hasOwnProperty(O)&&(T!=null||C!=null))switch(O){case"value":me=T;break;case"defaultValue":be=T;break;case"children":break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(r(91));break;default:T!==C&&on(o,u,O,T,y,C)}ZC(o,me,be);return;case"option":for(var Ge in h)if(me=h[Ge],h.hasOwnProperty(Ge)&&me!=null&&!y.hasOwnProperty(Ge))switch(Ge){case"selected":o.selected=!1;break;default:on(o,u,Ge,null,y,me)}for(ne in y)if(me=y[ne],be=h[ne],y.hasOwnProperty(ne)&&me!==be&&(me!=null||be!=null))switch(ne){case"selected":o.selected=me&&typeof me!="function"&&typeof me!="symbol";break;default:on(o,u,ne,me,y,be)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ot in h)me=h[ot],h.hasOwnProperty(ot)&&me!=null&&!y.hasOwnProperty(ot)&&on(o,u,ot,null,y,me);for(he in y)if(me=y[he],be=h[he],y.hasOwnProperty(he)&&me!==be&&(me!=null||be!=null))switch(he){case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(r(137,u));break;default:on(o,u,he,me,y,be)}return;default:if(mb(u)){for(var ln in h)me=h[ln],h.hasOwnProperty(ln)&&me!==void 0&&!y.hasOwnProperty(ln)&&t1(o,u,ln,void 0,y,me);for(Te in y)me=y[Te],be=h[Te],!y.hasOwnProperty(Te)||me===be||me===void 0&&be===void 0||t1(o,u,Te,me,y,be);return}}for(var ce in h)me=h[ce],h.hasOwnProperty(ce)&&me!=null&&!y.hasOwnProperty(ce)&&on(o,u,ce,null,y,me);for(Ce in y)me=y[Ce],be=h[Ce],!y.hasOwnProperty(Ce)||me===be||me==null&&be==null||on(o,u,Ce,me,y,be)}function nj(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u$(){if(typeof performance.getEntriesByType=="function"){for(var o=0,u=0,h=performance.getEntriesByType("resource"),y=0;y<h.length;y++){var T=h[y],C=T.transferSize,O=T.initiatorType,H=T.duration;if(C&&H&&nj(O)){for(O=0,H=T.responseEnd,y+=1;y<h.length;y++){var ne=h[y],he=ne.startTime;if(he>H)break;var Te=ne.transferSize,Ce=ne.initiatorType;Te&&nj(Ce)&&(ne=ne.responseEnd,O+=Te*(ne<H?1:(H-he)/(ne-he)))}if(--y,u+=8*(C+O)/(T.duration/1e3),o++,10<o)break}}if(0<o)return u/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var n1=null,r1=null;function Fm(o){return o.nodeType===9?o:o.ownerDocument}function rj(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sj(o,u){if(o===0)switch(u){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&u==="foreignObject"?0:o}function s1(o,u){return o==="textarea"||o==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.children=="bigint"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var a1=null;function d$(){var o=window.event;return o&&o.type==="popstate"?o===a1?!1:(a1=o,!0):(a1=null,!1)}var aj=typeof setTimeout=="function"?setTimeout:void 0,f$=typeof clearTimeout=="function"?clearTimeout:void 0,ij=typeof Promise=="function"?Promise:void 0,h$=typeof queueMicrotask=="function"?queueMicrotask:typeof ij<"u"?function(o){return ij.resolve(null).then(o).catch(p$)}:aj;function p$(o){setTimeout(function(){throw o})}function fo(o){return o==="head"}function oj(o,u){var h=u,y=0;do{var T=h.nextSibling;if(o.removeChild(h),T&&T.nodeType===8)if(h=T.data,h==="/$"||h==="/&"){if(y===0){o.removeChild(T),hu(u);return}y--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")y++;else if(h==="html")If(o.ownerDocument.documentElement);else if(h==="head"){h=o.ownerDocument.head,If(h);for(var C=h.firstChild;C;){var O=C.nextSibling,H=C.nodeName;C[Zd]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&C.rel.toLowerCase()==="stylesheet"||h.removeChild(C),C=O}}else h==="body"&&If(o.ownerDocument.body);h=T}while(h);hu(u)}function lj(o,u){var h=o;o=0;do{var y=h.nextSibling;if(h.nodeType===1?u?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(u?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),y&&y.nodeType===8)if(h=y.data,h==="/$"){if(o===0)break;o--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||o++;h=y}while(h)}function i1(o){var u=o.firstChild;for(u&&u.nodeType===10&&(u=u.nextSibling);u;){var h=u;switch(u=u.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":i1(h),db(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}o.removeChild(h)}}function m$(o,u,h,y){for(;o.nodeType===1;){var T=h;if(o.nodeName.toLowerCase()!==u.toLowerCase()){if(!y&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(y){if(!o[Zd])switch(u){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(C=o.getAttribute("rel"),C==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(C!==T.rel||o.getAttribute("href")!==(T.href==null||T.href===""?null:T.href)||o.getAttribute("crossorigin")!==(T.crossOrigin==null?null:T.crossOrigin)||o.getAttribute("title")!==(T.title==null?null:T.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(C=o.getAttribute("src"),(C!==(T.src==null?null:T.src)||o.getAttribute("type")!==(T.type==null?null:T.type)||o.getAttribute("crossorigin")!==(T.crossOrigin==null?null:T.crossOrigin))&&C&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(u==="input"&&o.type==="hidden"){var C=T.name==null?null:""+T.name;if(T.type==="hidden"&&o.getAttribute("name")===C)return o}else return o;if(o=Bs(o.nextSibling),o===null)break}return null}function g$(o,u,h){if(u==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!h||(o=Bs(o.nextSibling),o===null))return null;return o}function cj(o,u){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Bs(o.nextSibling),o===null))return null;return o}function o1(o){return o.data==="$?"||o.data==="$~"}function l1(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function x$(o,u){var h=o.ownerDocument;if(o.data==="$~")o._reactRetry=u;else if(o.data!=="$?"||h.readyState!=="loading")u();else{var y=function(){u(),h.removeEventListener("DOMContentLoaded",y)};h.addEventListener("DOMContentLoaded",y),o._reactRetry=y}}function Bs(o){for(;o!=null;o=o.nextSibling){var u=o.nodeType;if(u===1||u===3)break;if(u===8){if(u=o.data,u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"||u==="F!"||u==="F")break;if(u==="/$"||u==="/&")return null}}return o}var c1=null;function uj(o){o=o.nextSibling;for(var u=0;o;){if(o.nodeType===8){var h=o.data;if(h==="/$"||h==="/&"){if(u===0)return Bs(o.nextSibling);u--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||u++}o=o.nextSibling}return null}function dj(o){o=o.previousSibling;for(var u=0;o;){if(o.nodeType===8){var h=o.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(u===0)return o;u--}else h!=="/$"&&h!=="/&"||u++}o=o.previousSibling}return null}function fj(o,u,h){switch(u=Fm(h),o){case"html":if(o=u.documentElement,!o)throw Error(r(452));return o;case"head":if(o=u.head,!o)throw Error(r(453));return o;case"body":if(o=u.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function If(o){for(var u=o.attributes;u.length;)o.removeAttributeNode(u[0]);db(o)}var Fs=new Map,hj=new Set;function zm(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var xi=$.d;$.d={f:b$,r:y$,D:v$,C:E$,L:T$,m:S$,X:C$,S:w$,M:N$};function b$(){var o=xi.f(),u=Rm();return o||u}function y$(o){var u=Dc(o);u!==null&&u.tag===5&&u.type==="form"?_k(u):xi.r(o)}var uu=typeof document>"u"?null:document;function pj(o,u,h){var y=uu;if(y&&typeof u=="string"&&u){var T=Rs(u);T='link[rel="'+o+'"][href="'+T+'"]',typeof h=="string"&&(T+='[crossorigin="'+h+'"]'),hj.has(T)||(hj.add(T),o={rel:o,crossOrigin:h,href:u},y.querySelector(T)===null&&(u=y.createElement("link"),Er(u,"link",o),ur(u),y.head.appendChild(u)))}}function v$(o){xi.D(o),pj("dns-prefetch",o,null)}function E$(o,u){xi.C(o,u),pj("preconnect",o,u)}function T$(o,u,h){xi.L(o,u,h);var y=uu;if(y&&o&&u){var T='link[rel="preload"][as="'+Rs(u)+'"]';u==="image"&&h&&h.imageSrcSet?(T+='[imagesrcset="'+Rs(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(T+='[imagesizes="'+Rs(h.imageSizes)+'"]')):T+='[href="'+Rs(o)+'"]';var C=T;switch(u){case"style":C=du(o);break;case"script":C=fu(o)}Fs.has(C)||(o=p({rel:"preload",href:u==="image"&&h&&h.imageSrcSet?void 0:o,as:u},h),Fs.set(C,o),y.querySelector(T)!==null||u==="style"&&y.querySelector(Lf(C))||u==="script"&&y.querySelector(Pf(C))||(u=y.createElement("link"),Er(u,"link",o),ur(u),y.head.appendChild(u)))}}function S$(o,u){xi.m(o,u);var h=uu;if(h&&o){var y=u&&typeof u.as=="string"?u.as:"script",T='link[rel="modulepreload"][as="'+Rs(y)+'"][href="'+Rs(o)+'"]',C=T;switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=fu(o)}if(!Fs.has(C)&&(o=p({rel:"modulepreload",href:o},u),Fs.set(C,o),h.querySelector(T)===null)){switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Pf(C)))return}y=h.createElement("link"),Er(y,"link",o),ur(y),h.head.appendChild(y)}}}function w$(o,u,h){xi.S(o,u,h);var y=uu;if(y&&o){var T=Mc(y).hoistableStyles,C=du(o);u=u||"default";var O=T.get(C);if(!O){var H={loading:0,preload:null};if(O=y.querySelector(Lf(C)))H.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},h),(h=Fs.get(C))&&u1(o,h);var ne=O=y.createElement("link");ur(ne),Er(ne,"link",o),ne._p=new Promise(function(he,Te){ne.onload=he,ne.onerror=Te}),ne.addEventListener("load",function(){H.loading|=1}),ne.addEventListener("error",function(){H.loading|=2}),H.loading|=4,Hm(O,u,y)}O={type:"stylesheet",instance:O,count:1,state:H},T.set(C,O)}}}function C$(o,u){xi.X(o,u);var h=uu;if(h&&o){var y=Mc(h).hoistableScripts,T=fu(o),C=y.get(T);C||(C=h.querySelector(Pf(T)),C||(o=p({src:o,async:!0},u),(u=Fs.get(T))&&d1(o,u),C=h.createElement("script"),ur(C),Er(C,"link",o),h.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},y.set(T,C))}}function N$(o,u){xi.M(o,u);var h=uu;if(h&&o){var y=Mc(h).hoistableScripts,T=fu(o),C=y.get(T);C||(C=h.querySelector(Pf(T)),C||(o=p({src:o,async:!0,type:"module"},u),(u=Fs.get(T))&&d1(o,u),C=h.createElement("script"),ur(C),Er(C,"link",o),h.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},y.set(T,C))}}function mj(o,u,h,y){var T=(T=pe.current)?zm(T):null;if(!T)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(u=du(h.href),h=Mc(T).hoistableStyles,y=h.get(u),y||(y={type:"style",instance:null,count:0,state:null},h.set(u,y)),y):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=du(h.href);var C=Mc(T).hoistableStyles,O=C.get(o);if(O||(T=T.ownerDocument||T,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(o,O),(C=T.querySelector(Lf(o)))&&!C._p&&(O.instance=C,O.state.loading=5),Fs.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},Fs.set(o,h),C||k$(T,o,h,O.state))),u&&y===null)throw Error(r(528,""));return O}if(u&&y!==null)throw Error(r(529,""));return null;case"script":return u=h.async,h=h.src,typeof h=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=fu(h),h=Mc(T).hoistableScripts,y=h.get(u),y||(y={type:"script",instance:null,count:0,state:null},h.set(u,y)),y):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function du(o){return'href="'+Rs(o)+'"'}function Lf(o){return'link[rel="stylesheet"]['+o+"]"}function gj(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function k$(o,u,h,y){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?y.loading=1:(u=o.createElement("link"),y.preload=u,u.addEventListener("load",function(){return y.loading|=1}),u.addEventListener("error",function(){return y.loading|=2}),Er(u,"link",h),ur(u),o.head.appendChild(u))}function fu(o){return'[src="'+Rs(o)+'"]'}function Pf(o){return"script[async]"+o}function xj(o,u,h){if(u.count++,u.instance===null)switch(u.type){case"style":var y=o.querySelector('style[data-href~="'+Rs(h.href)+'"]');if(y)return u.instance=y,ur(y),y;var T=p({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return y=(o.ownerDocument||o).createElement("style"),ur(y),Er(y,"style",T),Hm(y,h.precedence,o),u.instance=y;case"stylesheet":T=du(h.href);var C=o.querySelector(Lf(T));if(C)return u.state.loading|=4,u.instance=C,ur(C),C;y=gj(h),(T=Fs.get(T))&&u1(y,T),C=(o.ownerDocument||o).createElement("link"),ur(C);var O=C;return O._p=new Promise(function(H,ne){O.onload=H,O.onerror=ne}),Er(C,"link",y),u.state.loading|=4,Hm(C,h.precedence,o),u.instance=C;case"script":return C=fu(h.src),(T=o.querySelector(Pf(C)))?(u.instance=T,ur(T),T):(y=h,(T=Fs.get(C))&&(y=p({},h),d1(y,T)),o=o.ownerDocument||o,T=o.createElement("script"),ur(T),Er(T,"link",y),o.head.appendChild(T),u.instance=T);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(y=u.instance,u.state.loading|=4,Hm(y,h.precedence,o));return u.instance}function Hm(o,u,h){for(var y=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),T=y.length?y[y.length-1]:null,C=T,O=0;O<y.length;O++){var H=y[O];if(H.dataset.precedence===u)C=H;else if(C!==T)break}C?C.parentNode.insertBefore(o,C.nextSibling):(u=h.nodeType===9?h.head:h,u.insertBefore(o,u.firstChild))}function u1(o,u){o.crossOrigin==null&&(o.crossOrigin=u.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=u.referrerPolicy),o.title==null&&(o.title=u.title)}function d1(o,u){o.crossOrigin==null&&(o.crossOrigin=u.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=u.referrerPolicy),o.integrity==null&&(o.integrity=u.integrity)}var Um=null;function bj(o,u,h){if(Um===null){var y=new Map,T=Um=new Map;T.set(h,y)}else T=Um,y=T.get(h),y||(y=new Map,T.set(h,y));if(y.has(o))return y;for(y.set(o,null),h=h.getElementsByTagName(o),T=0;T<h.length;T++){var C=h[T];if(!(C[Zd]||C[xr]||o==="link"&&C.getAttribute("rel")==="stylesheet")&&C.namespaceURI!=="http://www.w3.org/2000/svg"){var O=C.getAttribute(u)||"";O=o+O;var H=y.get(O);H?H.push(C):y.set(O,[C])}}return y}function yj(o,u,h){o=o.ownerDocument||o,o.head.insertBefore(h,u==="title"?o.querySelector("head > title"):null)}function A$(o,u,h){if(h===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function vj(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function j$(o,u,h,y){if(h.type==="stylesheet"&&(typeof y.media!="string"||matchMedia(y.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var T=du(y.href),C=u.querySelector(Lf(T));if(C){u=C._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=$m.bind(o),u.then(o,o)),h.state.loading|=4,h.instance=C,ur(C);return}C=u.ownerDocument||u,y=gj(y),(T=Fs.get(T))&&u1(y,T),C=C.createElement("link"),ur(C);var O=C;O._p=new Promise(function(H,ne){O.onload=H,O.onerror=ne}),Er(C,"link",y),h.instance=C}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,u),(u=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=$m.bind(o),u.addEventListener("load",h),u.addEventListener("error",h))}}var f1=0;function _$(o,u){return o.stylesheets&&o.count===0&&qm(o,o.stylesheets),0<o.count||0<o.imgCount?function(h){var y=setTimeout(function(){if(o.stylesheets&&qm(o,o.stylesheets),o.unsuspend){var C=o.unsuspend;o.unsuspend=null,C()}},6e4+u);0<o.imgBytes&&f1===0&&(f1=62500*u$());var T=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&qm(o,o.stylesheets),o.unsuspend)){var C=o.unsuspend;o.unsuspend=null,C()}},(o.imgBytes>f1?50:800)+u);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(y),clearTimeout(T)}}:null}function $m(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Vm=null;function qm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Vm=new Map,u.forEach(R$,o),Vm=null,$m.call(o))}function R$(o,u){if(!(u.state.loading&4)){var h=Vm.get(o);if(h)var y=h.get(null);else{h=new Map,Vm.set(o,h);for(var T=o.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C<T.length;C++){var O=T[C];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(h.set(O.dataset.precedence,O),y=O)}y&&h.set(null,y)}T=u.instance,O=T.getAttribute("data-precedence"),C=h.get(O)||y,C===y&&h.set(null,T),h.set(O,T),this.count++,y=$m.bind(this),T.addEventListener("load",y),T.addEventListener("error",y),C?C.parentNode.insertBefore(T,C.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(T,o.firstChild)),u.state.loading|=4}}var Bf={$$typeof:A,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function D$(o,u,h,y,T,C,O,H,ne){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=dn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dn(0),this.hiddenUpdates=dn(null),this.identifierPrefix=y,this.onUncaughtError=T,this.onCaughtError=C,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ne,this.incompleteTransitions=new Map}function Ej(o,u,h,y,T,C,O,H,ne,he,Te,Ce){return o=new D$(o,u,h,O,ne,he,Te,Ce,H),u=1,C===!0&&(u|=24),C=is(3,null,null,u),o.current=C,C.stateNode=o,u=qb(),u.refCount++,o.pooledCache=u,u.refCount++,C.memoizedState={element:y,isDehydrated:h,cache:u},Wb(C),o}function Tj(o){return o?(o=$c,o):$c}function Sj(o,u,h,y,T,C){T=Tj(T),y.context===null?y.context=T:y.pendingContext=T,y=eo(u),y.payload={element:h},C=C===void 0?null:C,C!==null&&(y.callback=C),h=to(o,y,u),h!==null&&(Gr(h,o,u),gf(h,o,u))}function wj(o,u){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var h=o.retryLane;o.retryLane=h!==0&&h<u?h:u}}function h1(o,u){wj(o,u),(o=o.alternate)&&wj(o,u)}function Cj(o){if(o.tag===13||o.tag===31){var u=cl(o,67108864);u!==null&&Gr(u,o,67108864),h1(o,67108864)}}function Nj(o){if(o.tag===13||o.tag===31){var u=ds();u=ta(u);var h=cl(o,u);h!==null&&Gr(h,o,u),h1(o,u)}}var Gm=!0;function M$(o,u,h,y){var T=F.T;F.T=null;var C=$.p;try{$.p=2,p1(o,u,h,y)}finally{$.p=C,F.T=T}}function O$(o,u,h,y){var T=F.T;F.T=null;var C=$.p;try{$.p=8,p1(o,u,h,y)}finally{$.p=C,F.T=T}}function p1(o,u,h,y){if(Gm){var T=m1(y);if(T===null)e1(o,u,y,Ym,h),Aj(o,y);else if(L$(T,o,u,h,y))y.stopPropagation();else if(Aj(o,y),u&4&&-1<I$.indexOf(o)){for(;T!==null;){var C=Dc(T);if(C!==null)switch(C.tag){case 3:if(C=C.stateNode,C.current.memoizedState.isDehydrated){var O=Ue(C.pendingLanes);if(O!==0){var H=C;for(H.pendingLanes|=2,H.entangledLanes|=2;O;){var ne=1<<31-kt(O);H.entanglements[1]|=ne,O&=~ne}ka(C),(Wt&6)===0&&(jm=Xt()+500,Df(0))}}break;case 31:case 13:H=cl(C,2),H!==null&&Gr(H,C,2),Rm(),h1(C,2)}if(C=m1(y),C===null&&e1(o,u,y,Ym,h),C===T)break;T=C}T!==null&&y.stopPropagation()}else e1(o,u,y,null,h)}}function m1(o){return o=xb(o),g1(o)}var Ym=null;function g1(o){if(Ym=null,o=Rc(o),o!==null){var u=a(o);if(u===null)o=null;else{var h=u.tag;if(h===13){if(o=l(u),o!==null)return o;o=null}else if(h===31){if(o=c(u),o!==null)return o;o=null}else if(h===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;o=null}else u!==o&&(o=null)}}return Ym=o,null}function kj(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ie()){case se:return 2;case Ee:return 8;case Me:case qe:return 32;case et:return 268435456;default:return 32}default:return 32}}var x1=!1,ho=null,po=null,mo=null,Ff=new Map,zf=new Map,go=[],I$="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Aj(o,u){switch(o){case"focusin":case"focusout":ho=null;break;case"dragenter":case"dragleave":po=null;break;case"mouseover":case"mouseout":mo=null;break;case"pointerover":case"pointerout":Ff.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":zf.delete(u.pointerId)}}function Hf(o,u,h,y,T,C){return o===null||o.nativeEvent!==C?(o={blockedOn:u,domEventName:h,eventSystemFlags:y,nativeEvent:C,targetContainers:[T]},u!==null&&(u=Dc(u),u!==null&&Cj(u)),o):(o.eventSystemFlags|=y,u=o.targetContainers,T!==null&&u.indexOf(T)===-1&&u.push(T),o)}function L$(o,u,h,y,T){switch(u){case"focusin":return ho=Hf(ho,o,u,h,y,T),!0;case"dragenter":return po=Hf(po,o,u,h,y,T),!0;case"mouseover":return mo=Hf(mo,o,u,h,y,T),!0;case"pointerover":var C=T.pointerId;return Ff.set(C,Hf(Ff.get(C)||null,o,u,h,y,T)),!0;case"gotpointercapture":return C=T.pointerId,zf.set(C,Hf(zf.get(C)||null,o,u,h,y,T)),!0}return!1}function jj(o){var u=Rc(o.target);if(u!==null){var h=a(u);if(h!==null){if(u=h.tag,u===13){if(u=l(h),u!==null){o.blockedOn=u,Qd(o.priority,function(){Nj(h)});return}}else if(u===31){if(u=c(h),u!==null){o.blockedOn=u,Qd(o.priority,function(){Nj(h)});return}}else if(u===3&&h.stateNode.current.memoizedState.isDehydrated){o.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Km(o){if(o.blockedOn!==null)return!1;for(var u=o.targetContainers;0<u.length;){var h=m1(o.nativeEvent);if(h===null){h=o.nativeEvent;var y=new h.constructor(h.type,h);gb=y,h.target.dispatchEvent(y),gb=null}else return u=Dc(h),u!==null&&Cj(u),o.blockedOn=h,!1;u.shift()}return!0}function _j(o,u,h){Km(o)&&h.delete(u)}function P$(){x1=!1,ho!==null&&Km(ho)&&(ho=null),po!==null&&Km(po)&&(po=null),mo!==null&&Km(mo)&&(mo=null),Ff.forEach(_j),zf.forEach(_j)}function Wm(o,u){o.blockedOn===u&&(o.blockedOn=null,x1||(x1=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,P$)))}var Xm=null;function Rj(o){Xm!==o&&(Xm=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Xm===o&&(Xm=null);for(var u=0;u<o.length;u+=3){var h=o[u],y=o[u+1],T=o[u+2];if(typeof y!="function"){if(g1(y||h)===null)continue;break}var C=Dc(h);C!==null&&(o.splice(u,3),u-=3,my(C,{pending:!0,data:T,method:h.method,action:y},y,T))}}))}function hu(o){function u(ne){return Wm(ne,o)}ho!==null&&Wm(ho,o),po!==null&&Wm(po,o),mo!==null&&Wm(mo,o),Ff.forEach(u),zf.forEach(u);for(var h=0;h<go.length;h++){var y=go[h];y.blockedOn===o&&(y.blockedOn=null)}for(;0<go.length&&(h=go[0],h.blockedOn===null);)jj(h),h.blockedOn===null&&go.shift();if(h=(o.ownerDocument||o).$$reactFormReplay,h!=null)for(y=0;y<h.length;y+=3){var T=h[y],C=h[y+1],O=T[zr]||null;if(typeof C=="function")O||Rj(h);else if(O){var H=null;if(C&&C.hasAttribute("formAction")){if(T=C,O=C[zr]||null)H=O.formAction;else if(g1(T)!==null)continue}else H=O.action;typeof H=="function"?h[y+1]=H:(h.splice(y,3),y-=3),Rj(h)}}}function Dj(){function o(C){C.canIntercept&&C.info==="react-transition"&&C.intercept({handler:function(){return new Promise(function(O){return T=O})},focusReset:"manual",scroll:"manual"})}function u(){T!==null&&(T(),T=null),y||setTimeout(h,20)}function h(){if(!y&&!navigation.transition){var C=navigation.currentEntry;C&&C.url!=null&&navigation.navigate(C.url,{state:C.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var y=!1,T=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",u),navigation.addEventListener("navigateerror",u),setTimeout(h,100),function(){y=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",u),navigation.removeEventListener("navigateerror",u),T!==null&&(T(),T=null)}}}function b1(o){this._internalRoot=o}Qm.prototype.render=b1.prototype.render=function(o){var u=this._internalRoot;if(u===null)throw Error(r(409));var h=u.current,y=ds();Sj(h,y,o,u,null,null)},Qm.prototype.unmount=b1.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var u=o.containerInfo;Sj(o.current,2,null,o,null,null),Rm(),u[_c]=null}};function Qm(o){this._internalRoot=o}Qm.prototype.unstable_scheduleHydration=function(o){if(o){var u=js();o={blockedOn:null,target:o,priority:u};for(var h=0;h<go.length&&u!==0&&u<go[h].priority;h++);go.splice(h,0,o),h===0&&jj(o)}};var Mj=t.version;if(Mj!=="19.2.4")throw Error(r(527,Mj,"19.2.4"));$.findDOMNode=function(o){var u=o._reactInternals;if(u===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=f(u),o=o!==null?m(o):null,o=o===null?null:o.stateNode,o};var B$={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zm.isDisabled&&Zm.supportsFiber)try{Jt=Zm.inject(B$),en=Zm}catch{}}return $f.createRoot=function(o,u){if(!s(o))throw Error(r(299));var h=!1,y="",T=zk,C=Hk,O=Uk;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(T=u.onUncaughtError),u.onCaughtError!==void 0&&(C=u.onCaughtError),u.onRecoverableError!==void 0&&(O=u.onRecoverableError)),u=Ej(o,1,!1,null,null,h,y,null,T,C,O,Dj),o[_c]=u.current,Jy(o),new b1(u)},$f.hydrateRoot=function(o,u,h){if(!s(o))throw Error(r(299));var y=!1,T="",C=zk,O=Hk,H=Uk,ne=null;return h!=null&&(h.unstable_strictMode===!0&&(y=!0),h.identifierPrefix!==void 0&&(T=h.identifierPrefix),h.onUncaughtError!==void 0&&(C=h.onUncaughtError),h.onCaughtError!==void 0&&(O=h.onCaughtError),h.onRecoverableError!==void 0&&(H=h.onRecoverableError),h.formState!==void 0&&(ne=h.formState)),u=Ej(o,1,!0,u,h??null,y,T,ne,C,O,H,Dj),u.context=Tj(null),h=u.current,y=ds(),y=ta(y),T=eo(y),T.callback=null,to(h,T,y),h=y,u.current.lanes=h,Ct(u,h),ka(u),o[_c]=u.current,Jy(o),new Qm(u)},$f.version="19.2.4",$f}var qj;function Z$(){if(qj)return T1.exports;qj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),T1.exports=Q$(),T1.exports}var J$=Z$();const eV=zi(J$);var vd=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tV={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ao,NS,uO,nV=(uO=class{constructor(){nt(this,Ao,tV);nt(this,NS,!1)}setTimeoutProvider(e){ze(this,Ao,e)}setTimeout(e,t){return re(this,Ao).setTimeout(e,t)}clearTimeout(e){re(this,Ao).clearTimeout(e)}setInterval(e,t){return re(this,Ao).setInterval(e,t)}clearInterval(e){re(this,Ao).clearInterval(e)}},Ao=new WeakMap,NS=new WeakMap,uO),Ml=new nV;function rV(e){setTimeout(e,0)}var Kl=typeof window>"u"||"Deno"in globalThis;function Mr(){}function sV(e,t){return typeof e=="function"?e(t):e}function TE(e){return typeof e=="number"&&e>=0&&e!==1/0}function TO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zo(e,t){return typeof e=="function"?e(t):e}function Hs(e,t){return typeof e=="function"?e(t):e}function Gj(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:l,stale:c}=e;if(l){if(r){if(t.queryHash!==AS(l,t.options))return!1}else if(!Mh(t.queryKey,l))return!1}if(n!=="all"){const d=t.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||a&&!a(t))}function Yj(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Wl(t.options.mutationKey)!==Wl(a))return!1}else if(!Mh(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function AS(e,t){return((t==null?void 0:t.queryKeyHashFn)||Wl)(e)}function Wl(e){return JSON.stringify(e,(t,n)=>SE(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Mh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Mh(e[n],t[n])):!1}var aV=Object.prototype.hasOwnProperty;function SO(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Kj(e)&&Kj(t);if(!r&&!(SE(e)&&SE(t)))return t;const a=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),c=l.length,d=r?new Array(c):{};let f=0;for(let m=0;m<c;m++){const p=r?m:l[m],x=e[p],b=t[p];if(x===b){d[p]=x,(r?m<a:aV.call(e,p))&&f++;continue}if(x===null||b===null||typeof x!="object"||typeof b!="object"){d[p]=b;continue}const v=SO(x,b,n+1);d[p]=v,v===x&&f++}return a===c&&f===a?e:d}function n0(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Kj(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function SE(e){if(!Wj(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Wj(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Wj(e){return Object.prototype.toString.call(e)==="[object Object]"}function iV(e){return new Promise(t=>{Ml.setTimeout(t,e)})}function wE(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?SO(e,t):t}function oV(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function lV(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var jS=Symbol();function wO(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===jS?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _S(e,t){return typeof e=="function"?e(...t):!!e}function cV(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Pl,jo,Zu,dO,uV=(dO=class extends vd{constructor(){super();nt(this,Pl);nt(this,jo);nt(this,Zu);ze(this,Zu,t=>{if(!Kl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){re(this,jo)||this.setEventListener(re(this,Zu))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,jo))==null||t.call(this),ze(this,jo,void 0))}setEventListener(t){var n;ze(this,Zu,t),(n=re(this,jo))==null||n.call(this),ze(this,jo,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){re(this,Pl)!==t&&(ze(this,Pl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof re(this,Pl)=="boolean"?re(this,Pl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Pl=new WeakMap,jo=new WeakMap,Zu=new WeakMap,dO),RS=new uV;function CE(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var dV=rV;function fV(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=dV;const a=c=>{t?e.push(c):s(()=>{n(c)})},l=()=>{const c=e;e=[],c.length&&s(()=>{r(()=>{c.forEach(d=>{n(d)})})})};return{batch:c=>{let d;t++;try{d=c()}finally{t--,t||l()}return d},batchCalls:c=>(...d)=>{a(()=>{c(...d)})},schedule:a,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{s=c}}}var or=fV(),Ju,_o,ed,fO,hV=(fO=class extends vd{constructor(){super();nt(this,Ju,!0);nt(this,_o);nt(this,ed);ze(this,ed,t=>{if(!Kl&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){re(this,_o)||this.setEventListener(re(this,ed))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,_o))==null||t.call(this),ze(this,_o,void 0))}setEventListener(t){var n;ze(this,ed,t),(n=re(this,_o))==null||n.call(this),ze(this,_o,t(this.setOnline.bind(this)))}setOnline(t){re(this,Ju)!==t&&(ze(this,Ju,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return re(this,Ju)}},Ju=new WeakMap,_o=new WeakMap,ed=new WeakMap,fO),r0=new hV;function pV(e){return Math.min(1e3*2**e,3e4)}function CO(e){return(e??"online")==="online"?r0.isOnline():!0}var NE=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function NO(e){let t=!1,n=0,r;const s=CE(),a=()=>s.status!=="pending",l=E=>{var w;if(!a()){const S=new NE(E);x(S),(w=e.onCancel)==null||w.call(e,S)}},c=()=>{t=!0},d=()=>{t=!1},f=()=>RS.isFocused()&&(e.networkMode==="always"||r0.isOnline())&&e.canRun(),m=()=>CO(e.networkMode)&&e.canRun(),p=E=>{a()||(r==null||r(),s.resolve(E))},x=E=>{a()||(r==null||r(),s.reject(E))},b=()=>new Promise(E=>{var w;r=S=>{(a()||f())&&E(S)},(w=e.onPause)==null||w.call(e)}).then(()=>{var E;r=void 0,a()||(E=e.onContinue)==null||E.call(e)}),v=()=>{if(a())return;let E;const w=n===0?e.initialPromise:void 0;try{E=w??e.fn()}catch(S){E=Promise.reject(S)}Promise.resolve(E).then(p).catch(S=>{var _;if(a())return;const N=e.retry??(Kl?0:3),A=e.retryDelay??pV,j=typeof A=="function"?A(n,S):A,R=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,S);if(t||!R){x(S);return}n++,(_=e.onFail)==null||_.call(e,n,S),iV(j).then(()=>f()?void 0:b()).then(()=>{t?x(S):v()})})};return{promise:s,status:()=>s.status,cancel:l,continue:()=>(r==null||r(),s),cancelRetry:c,continueRetry:d,canStart:m,start:()=>(m()?v():b().then(v),s)}}var Bl,hO,kO=(hO=class{constructor(){nt(this,Bl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),TE(this.gcTime)&&ze(this,Bl,Ml.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Kl?1/0:300*1e3))}clearGcTimeout(){re(this,Bl)&&(Ml.clearTimeout(re(this,Bl)),ze(this,Bl,void 0))}},Bl=new WeakMap,hO),Fl,td,zs,zl,hr,tp,Hl,ca,yi,pO,mV=(pO=class extends kO{constructor(t){super();nt(this,ca);nt(this,Fl);nt(this,td);nt(this,zs);nt(this,zl);nt(this,hr);nt(this,tp);nt(this,Hl);ze(this,Hl,!1),ze(this,tp,t.defaultOptions),this.setOptions(t.options),this.observers=[],ze(this,zl,t.client),ze(this,zs,re(this,zl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ze(this,Fl,Qj(this.options)),this.state=t.state??re(this,Fl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=re(this,hr))==null?void 0:t.promise}setOptions(t){if(this.options={...re(this,tp),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Qj(this.options);n.data!==void 0&&(this.setState(Xj(n.data,n.dataUpdatedAt)),ze(this,Fl,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&re(this,zs).remove(this)}setData(t,n){const r=wE(this.state.data,t,this.options);return St(this,ca,yi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){St(this,ca,yi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=re(this,hr))==null?void 0:r.promise;return(s=re(this,hr))==null||s.cancel(t),n?n.then(Mr).catch(Mr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,Fl))}isActive(){return this.observers.some(t=>Hs(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===jS||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zo(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!TO(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,hr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,hr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),re(this,zs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(re(this,hr)&&(re(this,Hl)?re(this,hr).cancel({revert:!0}):re(this,hr).cancelRetry()),this.scheduleGc()),re(this,zs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||St(this,ca,yi).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,m,p,x,b,v,E,w,S,N,A;if(this.state.fetchStatus!=="idle"&&((d=re(this,hr))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(re(this,hr))return re(this,hr).continueRetry(),re(this,hr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const j=this.observers.find(R=>R.options.queryFn);j&&this.setOptions(j.options)}const r=new AbortController,s=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(ze(this,Hl,!0),r.signal)})},a=()=>{const j=wO(this.options,n),_=(()=>{const D={client:re(this,zl),queryKey:this.queryKey,meta:this.meta};return s(D),D})();return ze(this,Hl,!1),this.options.persister?this.options.persister(j,_,this):j(_)},c=(()=>{const j={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:re(this,zl),state:this.state,fetchFn:a};return s(j),j})();(f=this.options.behavior)==null||f.onFetch(c,this),ze(this,td,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=c.fetchOptions)==null?void 0:m.meta))&&St(this,ca,yi).call(this,{type:"fetch",meta:(p=c.fetchOptions)==null?void 0:p.meta}),ze(this,hr,NO({initialPromise:n==null?void 0:n.initialPromise,fn:c.fetchFn,onCancel:j=>{j instanceof NE&&j.revert&&this.setState({...re(this,td),fetchStatus:"idle"}),r.abort()},onFail:(j,R)=>{St(this,ca,yi).call(this,{type:"failed",failureCount:j,error:R})},onPause:()=>{St(this,ca,yi).call(this,{type:"pause"})},onContinue:()=>{St(this,ca,yi).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0}));try{const j=await re(this,hr).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(b=(x=re(this,zs).config).onSuccess)==null||b.call(x,j,this),(E=(v=re(this,zs).config).onSettled)==null||E.call(v,j,this.state.error,this),j}catch(j){if(j instanceof NE){if(j.silent)return re(this,hr).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw St(this,ca,yi).call(this,{type:"error",error:j}),(S=(w=re(this,zs).config).onError)==null||S.call(w,j,this),(A=(N=re(this,zs).config).onSettled)==null||A.call(N,this.state.data,j,this),j}finally{this.scheduleGc()}}},Fl=new WeakMap,td=new WeakMap,zs=new WeakMap,zl=new WeakMap,hr=new WeakMap,tp=new WeakMap,Hl=new WeakMap,ca=new WeakSet,yi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...AO(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Xj(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ze(this,td,t.manual?s:void 0),s;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),or.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),re(this,zs).notify({query:this,type:"updated",action:t})})},pO);function AO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:CO(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Xj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Qj(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Qr,Ft,np,Dr,Ul,nd,Si,Ro,rp,rd,sd,$l,Vl,Do,ad,Qt,lh,kE,AE,jE,_E,RE,DE,ME,jO,mO,gV=(mO=class extends vd{constructor(t,n){super();nt(this,Qt);nt(this,Qr);nt(this,Ft);nt(this,np);nt(this,Dr);nt(this,Ul);nt(this,nd);nt(this,Si);nt(this,Ro);nt(this,rp);nt(this,rd);nt(this,sd);nt(this,$l);nt(this,Vl);nt(this,Do);nt(this,ad,new Set);this.options=n,ze(this,Qr,t),ze(this,Ro,null),ze(this,Si,CE()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(re(this,Ft).addObserver(this),Zj(re(this,Ft),this.options)?St(this,Qt,lh).call(this):this.updateResult(),St(this,Qt,_E).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return OE(re(this,Ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return OE(re(this,Ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,St(this,Qt,RE).call(this),St(this,Qt,DE).call(this),re(this,Ft).removeObserver(this)}setOptions(t){const n=this.options,r=re(this,Ft);if(this.options=re(this,Qr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Hs(this.options.enabled,re(this,Ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");St(this,Qt,ME).call(this),re(this,Ft).setOptions(this.options),n._defaulted&&!n0(this.options,n)&&re(this,Qr).getQueryCache().notify({type:"observerOptionsUpdated",query:re(this,Ft),observer:this});const s=this.hasListeners();s&&Jj(re(this,Ft),r,this.options,n)&&St(this,Qt,lh).call(this),this.updateResult(),s&&(re(this,Ft)!==r||Hs(this.options.enabled,re(this,Ft))!==Hs(n.enabled,re(this,Ft))||zo(this.options.staleTime,re(this,Ft))!==zo(n.staleTime,re(this,Ft)))&&St(this,Qt,kE).call(this);const a=St(this,Qt,AE).call(this);s&&(re(this,Ft)!==r||Hs(this.options.enabled,re(this,Ft))!==Hs(n.enabled,re(this,Ft))||a!==re(this,Do))&&St(this,Qt,jE).call(this,a)}getOptimisticResult(t){const n=re(this,Qr).getQueryCache().build(re(this,Qr),t),r=this.createResult(n,t);return bV(this,r)&&(ze(this,Dr,r),ze(this,nd,this.options),ze(this,Ul,re(this,Ft).state)),r}getCurrentResult(){return re(this,Dr)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&re(this,Si).status==="pending"&&re(this,Si).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){re(this,ad).add(t)}getCurrentQuery(){return re(this,Ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=re(this,Qr).defaultQueryOptions(t),r=re(this,Qr).getQueryCache().build(re(this,Qr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return St(this,Qt,lh).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),re(this,Dr)))}createResult(t,n){var L;const r=re(this,Ft),s=this.options,a=re(this,Dr),l=re(this,Ul),c=re(this,nd),f=t!==r?t.state:re(this,np),{state:m}=t;let p={...m},x=!1,b;if(n._optimisticResults){const B=this.hasListeners(),X=!B&&Zj(t,n),G=B&&Jj(t,r,n,s);(X||G)&&(p={...p,...AO(m.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:v,errorUpdatedAt:E,status:w}=p;b=p.data;let S=!1;if(n.placeholderData!==void 0&&b===void 0&&w==="pending"){let B;a!=null&&a.isPlaceholderData&&n.placeholderData===(c==null?void 0:c.placeholderData)?(B=a.data,S=!0):B=typeof n.placeholderData=="function"?n.placeholderData((L=re(this,sd))==null?void 0:L.state.data,re(this,sd)):n.placeholderData,B!==void 0&&(w="success",b=wE(a==null?void 0:a.data,B,n),x=!0)}if(n.select&&b!==void 0&&!S)if(a&&b===(l==null?void 0:l.data)&&n.select===re(this,rp))b=re(this,rd);else try{ze(this,rp,n.select),b=n.select(b),b=wE(a==null?void 0:a.data,b,n),ze(this,rd,b),ze(this,Ro,null)}catch(B){ze(this,Ro,B)}re(this,Ro)&&(v=re(this,Ro),b=re(this,rd),E=Date.now(),w="error");const N=p.fetchStatus==="fetching",A=w==="pending",j=w==="error",R=A&&N,_=b!==void 0,I={status:w,fetchStatus:p.fetchStatus,isPending:A,isSuccess:w==="success",isError:j,isInitialLoading:R,isLoading:R,data:b,dataUpdatedAt:p.dataUpdatedAt,error:v,errorUpdatedAt:E,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:N,isRefetching:N&&!A,isLoadingError:j&&!_,isPaused:p.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:j&&_,isStale:DS(t,n),refetch:this.refetch,promise:re(this,Si),isEnabled:Hs(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const B=I.data!==void 0,X=I.status==="error"&&!B,G=W=>{X?W.reject(I.error):B&&W.resolve(I.data)},J=()=>{const W=ze(this,Si,I.promise=CE());G(W)},Y=re(this,Si);switch(Y.status){case"pending":t.queryHash===r.queryHash&&G(Y);break;case"fulfilled":(X||I.data!==Y.value)&&J();break;case"rejected":(!X||I.error!==Y.reason)&&J();break}}return I}updateResult(){const t=re(this,Dr),n=this.createResult(re(this,Ft),this.options);if(ze(this,Ul,re(this,Ft).state),ze(this,nd,this.options),re(this,Ul).data!==void 0&&ze(this,sd,re(this,Ft)),n0(n,t))return;ze(this,Dr,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!re(this,ad).size)return!0;const l=new Set(a??re(this,ad));return this.options.throwOnError&&l.add("error"),Object.keys(re(this,Dr)).some(c=>{const d=c;return re(this,Dr)[d]!==t[d]&&l.has(d)})};St(this,Qt,jO).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&St(this,Qt,_E).call(this)}},Qr=new WeakMap,Ft=new WeakMap,np=new WeakMap,Dr=new WeakMap,Ul=new WeakMap,nd=new WeakMap,Si=new WeakMap,Ro=new WeakMap,rp=new WeakMap,rd=new WeakMap,sd=new WeakMap,$l=new WeakMap,Vl=new WeakMap,Do=new WeakMap,ad=new WeakMap,Qt=new WeakSet,lh=function(t){St(this,Qt,ME).call(this);let n=re(this,Ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Mr)),n},kE=function(){St(this,Qt,RE).call(this);const t=zo(this.options.staleTime,re(this,Ft));if(Kl||re(this,Dr).isStale||!TE(t))return;const r=TO(re(this,Dr).dataUpdatedAt,t)+1;ze(this,$l,Ml.setTimeout(()=>{re(this,Dr).isStale||this.updateResult()},r))},AE=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(re(this,Ft)):this.options.refetchInterval)??!1},jE=function(t){St(this,Qt,DE).call(this),ze(this,Do,t),!(Kl||Hs(this.options.enabled,re(this,Ft))===!1||!TE(re(this,Do))||re(this,Do)===0)&&ze(this,Vl,Ml.setInterval(()=>{(this.options.refetchIntervalInBackground||RS.isFocused())&&St(this,Qt,lh).call(this)},re(this,Do)))},_E=function(){St(this,Qt,kE).call(this),St(this,Qt,jE).call(this,St(this,Qt,AE).call(this))},RE=function(){re(this,$l)&&(Ml.clearTimeout(re(this,$l)),ze(this,$l,void 0))},DE=function(){re(this,Vl)&&(Ml.clearInterval(re(this,Vl)),ze(this,Vl,void 0))},ME=function(){const t=re(this,Qr).getQueryCache().build(re(this,Qr),this.options);if(t===re(this,Ft))return;const n=re(this,Ft);ze(this,Ft,t),ze(this,np,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},jO=function(t){or.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(re(this,Dr))}),re(this,Qr).getQueryCache().notify({query:re(this,Ft),type:"observerResultsUpdated"})})},mO);function xV(e,t){return Hs(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Zj(e,t){return xV(e,t)||e.state.data!==void 0&&OE(e,t,t.refetchOnMount)}function OE(e,t,n){if(Hs(t.enabled,e)!==!1&&zo(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&DS(e,t)}return!1}function Jj(e,t,n,r){return(e!==t||Hs(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&DS(e,n)}function DS(e,t){return Hs(t.enabled,e)!==!1&&e.isStaleByTime(zo(t.staleTime,e))}function bV(e,t){return!n0(e.getCurrentResult(),t)}function e_(e){return{onFetch:(t,n)=>{var m,p,x,b,v;const r=t.options,s=(x=(p=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:p.fetchMore)==null?void 0:x.direction,a=((b=t.state.data)==null?void 0:b.pages)||[],l=((v=t.state.data)==null?void 0:v.pageParams)||[];let c={pages:[],pageParams:[]},d=0;const f=async()=>{let E=!1;const w=A=>{cV(A,()=>t.signal,()=>E=!0)},S=wO(t.options,t.fetchOptions),N=async(A,j,R)=>{if(E)return Promise.reject();if(j==null&&A.pages.length)return Promise.resolve(A);const D=(()=>{const X={client:t.client,queryKey:t.queryKey,pageParam:j,direction:R?"backward":"forward",meta:t.options.meta};return w(X),X})(),I=await S(D),{maxPages:L}=t.options,B=R?lV:oV;return{pages:B(A.pages,I,L),pageParams:B(A.pageParams,j,L)}};if(s&&a.length){const A=s==="backward",j=A?yV:t_,R={pages:a,pageParams:l},_=j(r,R);c=await N(R,_,A)}else{const A=e??a.length;do{const j=d===0?l[0]??r.initialPageParam:t_(r,c);if(d>0&&j==null)break;c=await N(c,j),d++}while(d<A)}return c};t.options.persister?t.fetchFn=()=>{var E,w;return(w=(E=t.options).persister)==null?void 0:w.call(E,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function t_(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function yV(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var sp,Da,Nr,ql,Ma,vo,gO,vV=(gO=class extends kO{constructor(t){super();nt(this,Ma);nt(this,sp);nt(this,Da);nt(this,Nr);nt(this,ql);ze(this,sp,t.client),this.mutationId=t.mutationId,ze(this,Nr,t.mutationCache),ze(this,Da,[]),this.state=t.state||_O(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){re(this,Da).includes(t)||(re(this,Da).push(t),this.clearGcTimeout(),re(this,Nr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ze(this,Da,re(this,Da).filter(n=>n!==t)),this.scheduleGc(),re(this,Nr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){re(this,Da).length||(this.state.status==="pending"?this.scheduleGc():re(this,Nr).remove(this))}continue(){var t;return((t=re(this,ql))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,c,d,f,m,p,x,b,v,E,w,S,N,A,j,R,_,D;const n=()=>{St(this,Ma,vo).call(this,{type:"continue"})},r={client:re(this,sp),meta:this.options.meta,mutationKey:this.options.mutationKey};ze(this,ql,NO({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(I,L)=>{St(this,Ma,vo).call(this,{type:"failed",failureCount:I,error:L})},onPause:()=>{St(this,Ma,vo).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>re(this,Nr).canRun(this)}));const s=this.state.status==="pending",a=!re(this,ql).canStart();try{if(s)n();else{St(this,Ma,vo).call(this,{type:"pending",variables:t,isPaused:a}),re(this,Nr).config.onMutate&&await re(this,Nr).config.onMutate(t,this,r);const L=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t,r));L!==this.state.context&&St(this,Ma,vo).call(this,{type:"pending",context:L,variables:t,isPaused:a})}const I=await re(this,ql).start();return await((f=(d=re(this,Nr).config).onSuccess)==null?void 0:f.call(d,I,t,this.state.context,this,r)),await((p=(m=this.options).onSuccess)==null?void 0:p.call(m,I,t,this.state.context,r)),await((b=(x=re(this,Nr).config).onSettled)==null?void 0:b.call(x,I,null,this.state.variables,this.state.context,this,r)),await((E=(v=this.options).onSettled)==null?void 0:E.call(v,I,null,t,this.state.context,r)),St(this,Ma,vo).call(this,{type:"success",data:I}),I}catch(I){try{await((S=(w=re(this,Nr).config).onError)==null?void 0:S.call(w,I,t,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((A=(N=this.options).onError)==null?void 0:A.call(N,I,t,this.state.context,r))}catch(L){Promise.reject(L)}try{await((R=(j=re(this,Nr).config).onSettled)==null?void 0:R.call(j,void 0,I,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((D=(_=this.options).onSettled)==null?void 0:D.call(_,void 0,I,t,this.state.context,r))}catch(L){Promise.reject(L)}throw St(this,Ma,vo).call(this,{type:"error",error:I}),I}finally{re(this,Nr).runNext(this)}}},sp=new WeakMap,Da=new WeakMap,Nr=new WeakMap,ql=new WeakMap,Ma=new WeakSet,vo=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),or.batch(()=>{re(this,Da).forEach(r=>{r.onMutationUpdate(t)}),re(this,Nr).notify({mutation:this,type:"updated",action:t})})},gO);function _O(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wi,ua,ap,xO,EV=(xO=class extends vd{constructor(t={}){super();nt(this,wi);nt(this,ua);nt(this,ap);this.config=t,ze(this,wi,new Set),ze(this,ua,new Map),ze(this,ap,0)}build(t,n,r){const s=new vV({client:t,mutationCache:this,mutationId:++Jm(this,ap)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){re(this,wi).add(t);const n=eg(t);if(typeof n=="string"){const r=re(this,ua).get(n);r?r.push(t):re(this,ua).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(re(this,wi).delete(t)){const n=eg(t);if(typeof n=="string"){const r=re(this,ua).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&re(this,ua).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=eg(t);if(typeof n=="string"){const r=re(this,ua).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=eg(t);if(typeof n=="string"){const s=(r=re(this,ua).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){or.batch(()=>{re(this,wi).forEach(t=>{this.notify({type:"removed",mutation:t})}),re(this,wi).clear(),re(this,ua).clear()})}getAll(){return Array.from(re(this,wi))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Yj(n,r))}findAll(t={}){return this.getAll().filter(n=>Yj(t,n))}notify(t){or.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return or.batch(()=>Promise.all(t.map(n=>n.continue().catch(Mr))))}},wi=new WeakMap,ua=new WeakMap,ap=new WeakMap,xO);function eg(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ci,Mo,Zr,Ni,_i,zg,IE,bO,TV=(bO=class extends vd{constructor(n,r){super();nt(this,_i);nt(this,Ci);nt(this,Mo);nt(this,Zr);nt(this,Ni);ze(this,Ci,n),this.setOptions(r),this.bindMethods(),St(this,_i,zg).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=re(this,Ci).defaultMutationOptions(n),n0(this.options,r)||re(this,Ci).getMutationCache().notify({type:"observerOptionsUpdated",mutation:re(this,Zr),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Wl(r.mutationKey)!==Wl(this.options.mutationKey)?this.reset():((s=re(this,Zr))==null?void 0:s.state.status)==="pending"&&re(this,Zr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=re(this,Zr))==null||n.removeObserver(this)}onMutationUpdate(n){St(this,_i,zg).call(this),St(this,_i,IE).call(this,n)}getCurrentResult(){return re(this,Mo)}reset(){var n;(n=re(this,Zr))==null||n.removeObserver(this),ze(this,Zr,void 0),St(this,_i,zg).call(this),St(this,_i,IE).call(this)}mutate(n,r){var s;return ze(this,Ni,r),(s=re(this,Zr))==null||s.removeObserver(this),ze(this,Zr,re(this,Ci).getMutationCache().build(re(this,Ci),this.options)),re(this,Zr).addObserver(this),re(this,Zr).execute(n)}},Ci=new WeakMap,Mo=new WeakMap,Zr=new WeakMap,Ni=new WeakMap,_i=new WeakSet,zg=function(){var r;const n=((r=re(this,Zr))==null?void 0:r.state)??_O();ze(this,Mo,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},IE=function(n){or.batch(()=>{var r,s,a,l,c,d,f,m;if(re(this,Ni)&&this.hasListeners()){const p=re(this,Mo).variables,x=re(this,Mo).context,b={client:re(this,Ci),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=re(this,Ni)).onSuccess)==null||s.call(r,n.data,p,x,b)}catch(v){Promise.reject(v)}try{(l=(a=re(this,Ni)).onSettled)==null||l.call(a,n.data,null,p,x,b)}catch(v){Promise.reject(v)}}else if((n==null?void 0:n.type)==="error"){try{(d=(c=re(this,Ni)).onError)==null||d.call(c,n.error,p,x,b)}catch(v){Promise.reject(v)}try{(m=(f=re(this,Ni)).onSettled)==null||m.call(f,void 0,n.error,p,x,b)}catch(v){Promise.reject(v)}}}this.listeners.forEach(p=>{p(re(this,Mo))})})},bO),Oa,yO,SV=(yO=class extends vd{constructor(t={}){super();nt(this,Oa);this.config=t,ze(this,Oa,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??AS(s,n);let l=this.get(a);return l||(l=new mV({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(l)),l}add(t){re(this,Oa).has(t.queryHash)||(re(this,Oa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=re(this,Oa).get(t.queryHash);n&&(t.destroy(),n===t&&re(this,Oa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){or.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return re(this,Oa).get(t)}getAll(){return[...re(this,Oa).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Gj(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Gj(t,r)):n}notify(t){or.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){or.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){or.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Oa=new WeakMap,yO),Bn,Oo,Io,id,od,Lo,ld,cd,vO,wV=(vO=class{constructor(e={}){nt(this,Bn);nt(this,Oo);nt(this,Io);nt(this,id);nt(this,od);nt(this,Lo);nt(this,ld);nt(this,cd);ze(this,Bn,e.queryCache||new SV),ze(this,Oo,e.mutationCache||new EV),ze(this,Io,e.defaultOptions||{}),ze(this,id,new Map),ze(this,od,new Map),ze(this,Lo,0)}mount(){Jm(this,Lo)._++,re(this,Lo)===1&&(ze(this,ld,RS.subscribe(async e=>{e&&(await this.resumePausedMutations(),re(this,Bn).onFocus())})),ze(this,cd,r0.subscribe(async e=>{e&&(await this.resumePausedMutations(),re(this,Bn).onOnline())})))}unmount(){var e,t;Jm(this,Lo)._--,re(this,Lo)===0&&((e=re(this,ld))==null||e.call(this),ze(this,ld,void 0),(t=re(this,cd))==null||t.call(this),ze(this,cd,void 0))}isFetching(e){return re(this,Bn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,Oo).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=re(this,Bn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=re(this,Bn).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(zo(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return re(this,Bn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=re(this,Bn).get(r.queryHash),a=s==null?void 0:s.state.data,l=sV(t,a);if(l!==void 0)return re(this,Bn).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return or.batch(()=>re(this,Bn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=re(this,Bn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=re(this,Bn);or.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=re(this,Bn);return or.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=or.batch(()=>re(this,Bn).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Mr).catch(Mr)}invalidateQueries(e,t={}){return or.batch(()=>(re(this,Bn).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=or.batch(()=>re(this,Bn).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Mr)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Mr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=re(this,Bn).build(this,t);return n.isStaleByTime(zo(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mr).catch(Mr)}fetchInfiniteQuery(e){return e.behavior=e_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mr).catch(Mr)}ensureInfiniteQueryData(e){return e.behavior=e_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return r0.isOnline()?re(this,Oo).resumePausedMutations():Promise.resolve()}getQueryCache(){return re(this,Bn)}getMutationCache(){return re(this,Oo)}getDefaultOptions(){return re(this,Io)}setDefaultOptions(e){ze(this,Io,e)}setQueryDefaults(e,t){re(this,id).set(Wl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...re(this,id).values()],n={};return t.forEach(r=>{Mh(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){re(this,od).set(Wl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...re(this,od).values()],n={};return t.forEach(r=>{Mh(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...re(this,Io).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=AS(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===jS&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...re(this,Io).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,Bn).clear(),re(this,Oo).clear()}},Bn=new WeakMap,Oo=new WeakMap,Io=new WeakMap,id=new WeakMap,od=new WeakMap,Lo=new WeakMap,ld=new WeakMap,cd=new WeakMap,vO),RO=g.createContext(void 0),Yt=e=>{const t=g.useContext(RO);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},CV=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(RO.Provider,{value:e,children:t})),DO=g.createContext(!1),NV=()=>g.useContext(DO);DO.Provider;function kV(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var AV=g.createContext(kV()),jV=()=>g.useContext(AV),_V=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?_S(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},RV=e=>{g.useEffect(()=>{e.clearReset()},[e])},DV=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||_S(n,[e.error,r])),MV=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},OV=(e,t)=>e.isLoading&&e.isFetching&&!t,IV=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,n_=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function LV(e,t,n){var x,b,v,E;const r=NV(),s=jV(),a=Yt(),l=a.defaultQueryOptions(e);(b=(x=a.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||b.call(x,l);const c=a.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",MV(l),_V(l,s,c),RV(s);const d=!a.getQueryCache().get(l.queryHash),[f]=g.useState(()=>new t(a,l)),m=f.getOptimisticResult(l),p=!r&&e.subscribed!==!1;if(g.useSyncExternalStore(g.useCallback(w=>{const S=p?f.subscribe(or.batchCalls(w)):Mr;return f.updateResult(),S},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),g.useEffect(()=>{f.setOptions(l)},[l,f]),IV(l,m))throw n_(l,f,s);if(DV({result:m,errorResetBoundary:s,throwOnError:l.throwOnError,query:c,suspense:l.suspense}))throw m.error;if((E=(v=a.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||E.call(v,l,m),l.experimental_prefetchInRender&&!Kl&&OV(m,r)){const w=d?n_(l,f,s):c==null?void 0:c.promise;w==null||w.catch(Mr).finally(()=>{f.updateResult()})}return l.notifyOnChangeProps?m:f.trackResult(m)}function Tt(e,t){return LV(e,gV)}function Sn(e,t){const n=Yt(),[r]=g.useState(()=>new TV(n,e));g.useEffect(()=>{r.setOptions(e)},[r,e]);const s=g.useSyncExternalStore(g.useCallback(l=>r.subscribe(or.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=g.useCallback((l,c)=>{r.mutate(l,c).catch(Mr)},[r]);if(s.error&&_S(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const MS=FV();function kn(e,...t){if(!MS)return;const n=BV(e,...t);performance.mark(n);try{console.log(e,...t)}catch{console.log(n)}}function PV(e,...t){MS&&console.warn(e,...t)}function BV(e,...t){return e.replace(/%[sfdO]/g,n=>{const r=t.shift();return n==="%O"&&r?JSON.stringify(r).replace(/"([^"]+)":/g,"$1:"):String(r)})}function FV(){try{const e="nuqs-localStorage-test";if(typeof localStorage>"u")return!1;localStorage.setItem(e,e);const t=localStorage.getItem(e)===e;return localStorage.removeItem(e),t&&(localStorage.getItem("debug")||"").includes("nuqs")}catch{return!1}}const zV={303:"Multiple adapter contexts detected. This might happen in monorepos.",404:"nuqs requires an adapter to work with your framework.",409:"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",414:"Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.",422:"Invalid options combination: `limitUrlUpdates: debounce` should be used in SSR scenarios, with `shallow: false`",429:"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",500:"Empty search params cache. Search params can't be accessed in Layouts.",501:"Search params cache already populated. Have you called `parse` twice?"};function op(e){return`[nuqs] ${zV[e]}
|
|
51
|
-
See https://nuqs.dev/NUQS-${e}`}function HV(e){if(e.size===0)return"";const t=[];for(const[r,s]of e.entries()){const a=r.replace(/#/g,"%23").replace(/&/g,"%26").replace(/\+/g,"%2B").replace(/=/g,"%3D").replace(/\?/g,"%3F");t.push(`${a}=${UV(s)}`)}return"?"+t.join("&")}function UV(e){return e.replace(/%/g,"%25").replace(/\+/g,"%2B").replace(/ /g,"+").replace(/#/g,"%23").replace(/&/g,"%26").replace(/"/g,"%22").replace(/'/g,"%27").replace(/`/g,"%60").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/[\x00-\x1F]/g,t=>encodeURIComponent(t))}const Xl=g.createContext({useAdapter(){throw new Error(op(404))}});Xl.displayName="NuqsAdapterContext";MS&&typeof window<"u"&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==Xl&&console.error(op(303)),window.__NuqsAdapterContext=Xl);function $V(e){return({children:t,defaultOptions:n,processUrlSearchParams:r,...s})=>g.createElement(Xl.Provider,{...s,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:r}},t)}function VV(e){const t=g.useContext(Xl);if(!("useAdapter"in t))throw new Error(op(404));return t.useAdapter(e)}const qV=()=>g.useContext(Xl).defaultOptions,GV=()=>g.useContext(Xl).processUrlSearchParams;function YV(){var e;if(typeof window>"u"||!window.GestureEvent)return 50;try{const t=(e=navigator.userAgent)==null?void 0:e.match(/version\/([\d\.]+) safari/i);return parseFloat(t[1])>=17?120:320}catch{return 320}}function KV(e){return{method:"throttle",timeMs:e}}const bh=KV(YV());function WV(e){return e===null||Array.isArray(e)&&e.length===0}function XV(e,t,n){if(typeof e=="string")n.set(t,e);else{n.delete(t);for(const r of e)n.append(t,r);n.has(t)||n.set(t,"")}return n}function OS(){const e=new Map;return{on(t,n){const r=e.get(t)||[];return r.push(n),e.set(t,r),()=>this.off(t,n)},off(t,n){const r=e.get(t);r&&e.set(t,r.filter(s=>s!==n))},emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))}}}function LE(e,t,n){function r(){e(),n.removeEventListener("abort",a)}const s=setTimeout(r,t);function a(){clearTimeout(s),n.removeEventListener("abort",a)}n.addEventListener("abort",a)}function PE(){const e=Promise;if(Promise.hasOwnProperty("withResolvers"))return Promise.withResolvers();let t=()=>{},n=()=>{};return{promise:new e((r,s)=>{t=r,n=s}),resolve:t,reject:n}}function QV(e,t){let n=t;for(let r=e.length-1;r>=0;r--){const s=e[r];if(!s)continue;const a=n;n=()=>s(a)}n()}function BE(){return new URLSearchParams(location.search)}var MO=class{constructor(){lt(this,"updateMap",new Map);lt(this,"options",{history:"replace",scroll:!1,shallow:!0});lt(this,"timeMs",bh.timeMs);lt(this,"transitions",new Set);lt(this,"resolvers",null);lt(this,"controller",null);lt(this,"lastFlushedAt",0);lt(this,"resetQueueOnNextPush",!1)}push({key:e,query:t,options:n},r=bh.timeMs){this.resetQueueOnNextPush&&(this.reset(),this.resetQueueOnNextPush=!1),kn("[nuqs gtq] Enqueueing %s=%s %O",e,t,n),this.updateMap.set(e,t),n.history==="push"&&(this.options.history="push"),n.scroll&&(this.options.scroll=!0),n.shallow===!1&&(this.options.shallow=!1),n.startTransition&&this.transitions.add(n.startTransition),(!Number.isFinite(this.timeMs)||r>this.timeMs)&&(this.timeMs=r)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=BE}){var t;return((t=this.resolvers)==null?void 0:t.promise)??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=BE,rateLimitFactor:t=1,...n},r){if(this.controller??(this.controller=new AbortController),!Number.isFinite(this.timeMs))return kn("[nuqs gtq] Skipping flush due to throttleMs=Infinity"),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=PE();const s=()=>{this.lastFlushedAt=performance.now();const[l,c]=this.applyPendingUpdates({...n,autoResetQueueOnUpdate:n.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},r);c===null?(this.resolvers.resolve(l),this.resetQueueOnNextPush=!0):this.resolvers.reject(l),this.resolvers=null};return LE(()=>{const l=performance.now()-this.lastFlushedAt,c=this.timeMs,d=t*Math.max(0,c-l);kn("[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)",d,c,t),d===0?s():LE(s,d,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){var e,t;return(e=this.controller)==null||e.abort(),this.controller=new AbortController,(t=this.resolvers)==null||t.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){const e=Array.from(this.updateMap.keys());return kn("[nuqs gtq] Resetting queue %s",JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:"replace",scroll:!1,shallow:!0},this.timeMs=bh.timeMs,e}applyPendingUpdates(e,t){const{updateUrl:n,getSearchParamsSnapshot:r}=e;let s=r();if(kn("[nuqs gtq] Applying %d pending update(s) on top of %s",this.updateMap.size,s.toString()),this.updateMap.size===0)return[s,null];const a=Array.from(this.updateMap.entries()),l={...this.options},c=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),kn("[nuqs gtq] Flushing queue %O with options %O",a,l);for(const[d,f]of a)f===null?s.delete(d):s=XV(f,d,s);t&&(s=t(s));try{return QV(c,()=>{n(s,l)}),[s,null]}catch(d){return console.error(op(429),a.map(([f])=>f).join(),d),[s,d]}}};const Hg=new MO;function ZV(e,t,n){const r=g.useCallback(()=>{const a=Object.fromEntries(e.map(l=>[l,n(l)]));return[JSON.stringify(a),a]},[e.join(","),n]),s=g.useRef(null);return s.current===null&&(s.current=r()),g.useSyncExternalStore(g.useCallback(a=>{const l=e.map(c=>t(c,a));return()=>l.forEach(c=>c())},[e.join(","),t]),()=>{const[a,l]=r();return s.current[0]===a?s.current[1]:(s.current=[a,l],l)},()=>s.current[1])}var JV=class{constructor(e){lt(this,"callback");lt(this,"resolvers",PE());lt(this,"controller",new AbortController);lt(this,"queuedValue");this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,LE(()=>{const n=this.resolvers;try{kn("[nuqs dq] Flushing debounce queue",e);const r=this.callback(e);kn("[nuqs dq] Reset debounce queue %O",this.queuedValue),this.queuedValue=void 0,this.resolvers=PE(),r.then(s=>n.resolve(s)).catch(s=>n.reject(s))}catch(r){this.queuedValue=void 0,n.reject(r)}},t,this.controller.signal),this.resolvers.promise}},eq=class{constructor(e=new MO){lt(this,"throttleQueue");lt(this,"queues",new Map);lt(this,"queuedQuerySync",OS());this.throttleQueue=e}useQueuedQueries(e){return ZV(e,(t,n)=>this.queuedQuerySync.on(t,n),t=>this.getQueuedQuery(t))}push(e,t,n,r){if(!Number.isFinite(t)){const l=n.getSearchParamsSnapshot??BE;return Promise.resolve(l())}const s=e.key;if(!this.queues.has(s)){kn("[nuqs dqc] Creating debounce queue for `%s`",s);const l=new JV(c=>(this.throttleQueue.push(c),this.throttleQueue.flush(n,r).finally(()=>{var d;((d=this.queues.get(c.key))==null?void 0:d.queuedValue)===void 0&&(kn("[nuqs dqc] Cleaning up empty queue for `%s`",c.key),this.queues.delete(c.key)),this.queuedQuerySync.emit(c.key)})));this.queues.set(s,l)}kn("[nuqs dqc] Enqueueing debounce update %O",e);const a=this.queues.get(s).push(e,t);return this.queuedQuerySync.emit(s),a}abort(e){var n;const t=this.queues.get(e);return t?(kn("[nuqs dqc] Aborting debounce queue %s=%s",e,(n=t.queuedValue)==null?void 0:n.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),r=>(r.then(t.resolvers.resolve,t.resolvers.reject),r)):r=>r}abortAll(){var e;for(const[t,n]of this.queues.entries())kn("[nuqs dqc] Aborting debounce queue %s=%s",t,(e=n.queuedValue)==null?void 0:e.query),n.abort(),n.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(t);this.queues.clear()}getQueuedQuery(e){var n,r;const t=(r=(n=this.queues.get(e))==null?void 0:n.queuedValue)==null?void 0:r.query;return t!==void 0?t:this.throttleQueue.getQueuedQuery(e)}};const N1=new eq(Hg);function OO(e,t){return e===t?!0:e===null||t===null||typeof e=="string"||typeof t=="string"||e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function r_(e,t,n){return r=>{if(!(t.length===0||t.some(a=>!OO(r.getAll(a),e.getAll(a)))))return kn("[nuqs `%s`] no change, returning previous",t.join(","),r),r;const s=IO(e,t,n);return kn("[nuqs `%s`] subbed search params change\n from %O\n to %O",t.join(","),r,s),s}}function IO(e,t,n){if(t.length===0)return e;const r=n?new URLSearchParams(e):e;for(const s of e.keys())t.includes(s)||r.delete(s);return r}const tq="__nuqs__",FE=OS();function nq(e){return function(n,r){const s=new URL(location.href);s.search=HV(n),kn("[nuqs react] Updating url: %s",s),e&&r.shallow===!1?(r.history==="push"?location.assign:location.replace).call(location,s):(r.history==="push"?history.pushState:history.replaceState).call(history,history.state,tq,s),FE.emit("update",n),r.scroll===!0&&window.scrollTo({top:0})}}const LO=g.createContext({fullPageNavigationOnShallowFalseUpdates:!1});function rq(e){const{fullPageNavigationOnShallowFalseUpdates:t}=g.useContext(LO),[n,r]=g.useState(()=>typeof location>"u"?new URLSearchParams:IO(new URLSearchParams(location.search),e,!1));return g.useEffect(()=>{const s=()=>{r(r_(new URLSearchParams(location.search),e,!1))},a=l=>{r(r_(l,e,!0))};return FE.on("update",a),window.addEventListener("popstate",s),()=>{FE.off("update",a),window.removeEventListener("popstate",s)}},[e.join("&")]),{searchParams:n,updateUrl:g.useMemo(()=>nq(t),[t])}}const sq=$V(rq);function aq({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return g.createElement(LO.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},g.createElement(sq,{...n,children:e}))}const PO=g.createContext(null);function iq({transport:e,children:t}){return i.jsx(PO.Provider,{value:e,children:t})}function Ve(){const e=g.useContext(PO);if(!e)throw new Error("useTransport must be used within a TransportProvider");return e}const s_=e=>{let t;const n=new Set,r=(f,m)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const x=t;t=m??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(b=>b(t,x))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f))},d=t=e(r,s,c);return c},oq=(e=>e?s_(e):s_),lq=e=>e;function cq(e,t=lq){const n=ue.useSyncExternalStore(e.subscribe,ue.useCallback(()=>t(e.getState()),[e,t]),ue.useCallback(()=>t(e.getInitialState()),[e,t]));return ue.useDebugValue(n),n}const a_=e=>{const t=oq(e),n=r=>cq(t,r);return Object.assign(n,t),n},X0=(e=>e?a_(e):a_),i_={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},o_=e=>!!e.dispatchFromDevtools&&typeof e.dispatch=="function",Oh=new Map,tg=e=>{const t=Oh.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([n,r])=>[n,r.getState()])):{}},uq=(e,t,n)=>{if(e===void 0)return{type:"untracked",connection:t.connect(n)};const r=Oh.get(n.name);if(r)return{type:"tracked",store:e,...r};const s={connection:t.connect(n),stores:{}};return Oh.set(n.name,s),{type:"tracked",store:e,...s}},dq=(e,t)=>{if(t===void 0)return;const n=Oh.get(e);n&&(delete n.stores[t],Object.keys(n.stores).length===0&&Oh.delete(e))},fq=e=>{var t,n;if(!e)return;const r=e.split(`
|
|
51
|
+
See https://nuqs.dev/NUQS-${e}`}function HV(e){if(e.size===0)return"";const t=[];for(const[r,s]of e.entries()){const a=r.replace(/#/g,"%23").replace(/&/g,"%26").replace(/\+/g,"%2B").replace(/=/g,"%3D").replace(/\?/g,"%3F");t.push(`${a}=${UV(s)}`)}return"?"+t.join("&")}function UV(e){return e.replace(/%/g,"%25").replace(/\+/g,"%2B").replace(/ /g,"+").replace(/#/g,"%23").replace(/&/g,"%26").replace(/"/g,"%22").replace(/'/g,"%27").replace(/`/g,"%60").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/[\x00-\x1F]/g,t=>encodeURIComponent(t))}const Xl=g.createContext({useAdapter(){throw new Error(op(404))}});Xl.displayName="NuqsAdapterContext";MS&&typeof window<"u"&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==Xl&&console.error(op(303)),window.__NuqsAdapterContext=Xl);function $V(e){return({children:t,defaultOptions:n,processUrlSearchParams:r,...s})=>g.createElement(Xl.Provider,{...s,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:r}},t)}function VV(e){const t=g.useContext(Xl);if(!("useAdapter"in t))throw new Error(op(404));return t.useAdapter(e)}const qV=()=>g.useContext(Xl).defaultOptions,GV=()=>g.useContext(Xl).processUrlSearchParams;function YV(){var e;if(typeof window>"u"||!window.GestureEvent)return 50;try{const t=(e=navigator.userAgent)==null?void 0:e.match(/version\/([\d\.]+) safari/i);return parseFloat(t[1])>=17?120:320}catch{return 320}}function KV(e){return{method:"throttle",timeMs:e}}const bh=KV(YV());function WV(e){return e===null||Array.isArray(e)&&e.length===0}function XV(e,t,n){if(typeof e=="string")n.set(t,e);else{n.delete(t);for(const r of e)n.append(t,r);n.has(t)||n.set(t,"")}return n}function OS(){const e=new Map;return{on(t,n){const r=e.get(t)||[];return r.push(n),e.set(t,r),()=>this.off(t,n)},off(t,n){const r=e.get(t);r&&e.set(t,r.filter(s=>s!==n))},emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))}}}function LE(e,t,n){function r(){e(),n.removeEventListener("abort",a)}const s=setTimeout(r,t);function a(){clearTimeout(s),n.removeEventListener("abort",a)}n.addEventListener("abort",a)}function PE(){const e=Promise;if(Promise.hasOwnProperty("withResolvers"))return Promise.withResolvers();let t=()=>{},n=()=>{};return{promise:new e((r,s)=>{t=r,n=s}),resolve:t,reject:n}}function QV(e,t){let n=t;for(let r=e.length-1;r>=0;r--){const s=e[r];if(!s)continue;const a=n;n=()=>s(a)}n()}function BE(){return new URLSearchParams(location.search)}var MO=class{constructor(){lt(this,"updateMap",new Map);lt(this,"options",{history:"replace",scroll:!1,shallow:!0});lt(this,"timeMs",bh.timeMs);lt(this,"transitions",new Set);lt(this,"resolvers",null);lt(this,"controller",null);lt(this,"lastFlushedAt",0);lt(this,"resetQueueOnNextPush",!1)}push({key:e,query:t,options:n},r=bh.timeMs){this.resetQueueOnNextPush&&(this.reset(),this.resetQueueOnNextPush=!1),kn("[nuqs gtq] Enqueueing %s=%s %O",e,t,n),this.updateMap.set(e,t),n.history==="push"&&(this.options.history="push"),n.scroll&&(this.options.scroll=!0),n.shallow===!1&&(this.options.shallow=!1),n.startTransition&&this.transitions.add(n.startTransition),(!Number.isFinite(this.timeMs)||r>this.timeMs)&&(this.timeMs=r)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=BE}){var t;return((t=this.resolvers)==null?void 0:t.promise)??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=BE,rateLimitFactor:t=1,...n},r){if(this.controller??(this.controller=new AbortController),!Number.isFinite(this.timeMs))return kn("[nuqs gtq] Skipping flush due to throttleMs=Infinity"),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=PE();const s=()=>{this.lastFlushedAt=performance.now();const[l,c]=this.applyPendingUpdates({...n,autoResetQueueOnUpdate:n.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},r);c===null?(this.resolvers.resolve(l),this.resetQueueOnNextPush=!0):this.resolvers.reject(l),this.resolvers=null};return LE(()=>{const l=performance.now()-this.lastFlushedAt,c=this.timeMs,d=t*Math.max(0,c-l);kn("[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)",d,c,t),d===0?s():LE(s,d,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){var e,t;return(e=this.controller)==null||e.abort(),this.controller=new AbortController,(t=this.resolvers)==null||t.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){const e=Array.from(this.updateMap.keys());return kn("[nuqs gtq] Resetting queue %s",JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:"replace",scroll:!1,shallow:!0},this.timeMs=bh.timeMs,e}applyPendingUpdates(e,t){const{updateUrl:n,getSearchParamsSnapshot:r}=e;let s=r();if(kn("[nuqs gtq] Applying %d pending update(s) on top of %s",this.updateMap.size,s.toString()),this.updateMap.size===0)return[s,null];const a=Array.from(this.updateMap.entries()),l={...this.options},c=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),kn("[nuqs gtq] Flushing queue %O with options %O",a,l);for(const[d,f]of a)f===null?s.delete(d):s=XV(f,d,s);t&&(s=t(s));try{return QV(c,()=>{n(s,l)}),[s,null]}catch(d){return console.error(op(429),a.map(([f])=>f).join(),d),[s,d]}}};const Hg=new MO;function ZV(e,t,n){const r=g.useCallback(()=>{const a=Object.fromEntries(e.map(l=>[l,n(l)]));return[JSON.stringify(a),a]},[e.join(","),n]),s=g.useRef(null);return s.current===null&&(s.current=r()),g.useSyncExternalStore(g.useCallback(a=>{const l=e.map(c=>t(c,a));return()=>l.forEach(c=>c())},[e.join(","),t]),()=>{const[a,l]=r();return s.current[0]===a?s.current[1]:(s.current=[a,l],l)},()=>s.current[1])}var JV=class{constructor(e){lt(this,"callback");lt(this,"resolvers",PE());lt(this,"controller",new AbortController);lt(this,"queuedValue");this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,LE(()=>{const n=this.resolvers;try{kn("[nuqs dq] Flushing debounce queue",e);const r=this.callback(e);kn("[nuqs dq] Reset debounce queue %O",this.queuedValue),this.queuedValue=void 0,this.resolvers=PE(),r.then(s=>n.resolve(s)).catch(s=>n.reject(s))}catch(r){this.queuedValue=void 0,n.reject(r)}},t,this.controller.signal),this.resolvers.promise}},eq=class{constructor(e=new MO){lt(this,"throttleQueue");lt(this,"queues",new Map);lt(this,"queuedQuerySync",OS());this.throttleQueue=e}useQueuedQueries(e){return ZV(e,(t,n)=>this.queuedQuerySync.on(t,n),t=>this.getQueuedQuery(t))}push(e,t,n,r){if(!Number.isFinite(t)){const l=n.getSearchParamsSnapshot??BE;return Promise.resolve(l())}const s=e.key;if(!this.queues.has(s)){kn("[nuqs dqc] Creating debounce queue for `%s`",s);const l=new JV(c=>(this.throttleQueue.push(c),this.throttleQueue.flush(n,r).finally(()=>{var d;((d=this.queues.get(c.key))==null?void 0:d.queuedValue)===void 0&&(kn("[nuqs dqc] Cleaning up empty queue for `%s`",c.key),this.queues.delete(c.key)),this.queuedQuerySync.emit(c.key)})));this.queues.set(s,l)}kn("[nuqs dqc] Enqueueing debounce update %O",e);const a=this.queues.get(s).push(e,t);return this.queuedQuerySync.emit(s),a}abort(e){var n;const t=this.queues.get(e);return t?(kn("[nuqs dqc] Aborting debounce queue %s=%s",e,(n=t.queuedValue)==null?void 0:n.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),r=>(r.then(t.resolvers.resolve,t.resolvers.reject),r)):r=>r}abortAll(){var e;for(const[t,n]of this.queues.entries())kn("[nuqs dqc] Aborting debounce queue %s=%s",t,(e=n.queuedValue)==null?void 0:e.query),n.abort(),n.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(t);this.queues.clear()}getQueuedQuery(e){var n,r;const t=(r=(n=this.queues.get(e))==null?void 0:n.queuedValue)==null?void 0:r.query;return t!==void 0?t:this.throttleQueue.getQueuedQuery(e)}};const N1=new eq(Hg);function OO(e,t){return e===t?!0:e===null||t===null||typeof e=="string"||typeof t=="string"||e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function r_(e,t,n){return r=>{if(!(t.length===0||t.some(a=>!OO(r.getAll(a),e.getAll(a)))))return kn("[nuqs `%s`] no change, returning previous",t.join(","),r),r;const s=IO(e,t,n);return kn("[nuqs `%s`] subbed search params change\n from %O\n to %O",t.join(","),r,s),s}}function IO(e,t,n){if(t.length===0)return e;const r=n?new URLSearchParams(e):e;for(const s of e.keys())t.includes(s)||r.delete(s);return r}const tq="__nuqs__",FE=OS();function nq(e){return function(n,r){const s=new URL(location.href);s.search=HV(n),kn("[nuqs react] Updating url: %s",s),e&&r.shallow===!1?(r.history==="push"?location.assign:location.replace).call(location,s):(r.history==="push"?history.pushState:history.replaceState).call(history,history.state,tq,s),FE.emit("update",n),r.scroll===!0&&window.scrollTo({top:0})}}const LO=g.createContext({fullPageNavigationOnShallowFalseUpdates:!1});function rq(e){const{fullPageNavigationOnShallowFalseUpdates:t}=g.useContext(LO),[n,r]=g.useState(()=>typeof location>"u"?new URLSearchParams:IO(new URLSearchParams(location.search),e,!1));return g.useEffect(()=>{const s=()=>{r(r_(new URLSearchParams(location.search),e,!1))},a=l=>{r(r_(l,e,!0))};return FE.on("update",a),window.addEventListener("popstate",s),()=>{FE.off("update",a),window.removeEventListener("popstate",s)}},[e.join("&")]),{searchParams:n,updateUrl:g.useMemo(()=>nq(t),[t])}}const sq=$V(rq);function aq({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return g.createElement(LO.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},g.createElement(sq,{...n,children:e}))}const PO=g.createContext(null);function iq({transport:e,children:t}){return i.jsx(PO.Provider,{value:e,children:t})}function Ve(){const e=g.useContext(PO);if(!e)throw new Error("useTransport must be used within a TransportProvider");return e}const s_=e=>{let t;const n=new Set,r=(f,m)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const x=t;t=m??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(b=>b(t,x))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f))},d=t=e(r,s,c);return c},oq=(e=>e?s_(e):s_),lq=e=>e;function cq(e,t=lq){const n=ue.useSyncExternalStore(e.subscribe,ue.useCallback(()=>t(e.getState()),[e,t]),ue.useCallback(()=>t(e.getInitialState()),[e,t]));return ue.useDebugValue(n),n}const a_=e=>{const t=oq(e),n=r=>cq(t,r);return Object.assign(n,t),n},X0=(e=>e?a_(e):a_),i_={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_PORT:"6241"},o_=e=>!!e.dispatchFromDevtools&&typeof e.dispatch=="function",Oh=new Map,tg=e=>{const t=Oh.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([n,r])=>[n,r.getState()])):{}},uq=(e,t,n)=>{if(e===void 0)return{type:"untracked",connection:t.connect(n)};const r=Oh.get(n.name);if(r)return{type:"tracked",store:e,...r};const s={connection:t.connect(n),stores:{}};return Oh.set(n.name,s),{type:"tracked",store:e,...s}},dq=(e,t)=>{if(t===void 0)return;const n=Oh.get(e);n&&(delete n.stores[t],Object.keys(n.stores).length===0&&Oh.delete(e))},fq=e=>{var t,n;if(!e)return;const r=e.split(`
|
|
52
52
|
`),s=r.findIndex(l=>l.includes("api.setState"));if(s<0)return;const a=((t=r[s+1])==null?void 0:t.trim())||"";return(n=/.+ (.+) .+/.exec(a))==null?void 0:n[1]},hq=(e,t={})=>(n,r,s)=>{const{enabled:a,anonymousActionType:l,store:c,...d}=t;let f;try{f=(a??(i_?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!f)return e(n,r,s);const{connection:m,...p}=uq(c,f,d);let x=!0;s.setState=((E,w,S)=>{const N=n(E,w);if(!x)return N;const A=S===void 0?{type:l||fq(new Error().stack)||"anonymous"}:typeof S=="string"?{type:S}:S;return c===void 0?(m==null||m.send(A,r()),N):(m==null||m.send({...A,type:`${c}/${A.type}`},{...tg(d.name),[c]:s.getState()}),N)}),s.devtools={cleanup:()=>{m&&typeof m.unsubscribe=="function"&&m.unsubscribe(),dq(d.name,c)}};const b=(...E)=>{const w=x;x=!1,n(...E),x=w},v=e(s.setState,r,s);if(p.type==="untracked"?m==null||m.init(v):(p.stores[p.store]=s,m==null||m.init(Object.fromEntries(Object.entries(p.stores).map(([E,w])=>[E,E===p.store?v:w.getState()])))),o_(s)){let E=!1;const w=s.dispatch;s.dispatch=(...S)=>{(i_?"production":void 0)!=="production"&&S[0].type==="__setState"&&!E&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),E=!0),w(...S)}}return m.subscribe(E=>{var w;switch(E.type){case"ACTION":if(typeof E.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return k1(E.payload,S=>{if(S.type==="__setState"){if(c===void 0){b(S.state);return}Object.keys(S.state).length!==1&&console.error(`
|
|
53
53
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
54
54
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
@@ -733,7 +733,7 @@ ${e}</tr>
|
|
|
733
733
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
734
734
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${vi(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=ZD(e);if(s===null)return r;e=s;let a='<a href="'+e+'"';return t&&(a+=' title="'+vi(t)+'"'),a+=">"+r+"</a>",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=ZD(e);if(s===null)return vi(n);e=s;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${vi(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:vi(e.text)}},bC=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},ga=class nS{constructor(t){lt(this,"options");lt(this,"renderer");lt(this,"textRenderer");this.options=t||jc,this.options.renderer=this.options.renderer||new H0,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new bC}static parse(t,n){return new nS(n).parse(t)}static parseInline(t,n){return new nS(n).parseInline(t)}parse(t){var r,s;let n="";for(let a=0;a<t.length;a++){let l=t[a];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[l.type]){let d=l,f=this.options.extensions.renderers[d.type].call({parser:this},d);if(f!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){n+=f||"";continue}}let c=l;switch(c.type){case"space":{n+=this.renderer.space(c);break}case"hr":{n+=this.renderer.hr(c);break}case"heading":{n+=this.renderer.heading(c);break}case"code":{n+=this.renderer.code(c);break}case"table":{n+=this.renderer.table(c);break}case"blockquote":{n+=this.renderer.blockquote(c);break}case"list":{n+=this.renderer.list(c);break}case"checkbox":{n+=this.renderer.checkbox(c);break}case"html":{n+=this.renderer.html(c);break}case"def":{n+=this.renderer.def(c);break}case"paragraph":{n+=this.renderer.paragraph(c);break}case"text":{n+=this.renderer.text(c);break}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var s,a;let r="";for(let l=0;l<t.length;l++){let c=t[l];if((a=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&a[c.type]){let f=this.options.extensions.renderers[c.type].call({parser:this},c);if(f!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(c.type)){r+=f||"";continue}}let d=c;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let f='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}return r}},Fg,gh=(Fg=class{constructor(e){lt(this,"options");lt(this,"block");this.options=e||jc}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Vs.lex:Vs.lexInline}provideParser(){return this.block?ga.parse:ga.parseInline}},lt(Fg,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),lt(Fg,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Fg),h1e=class{constructor(...t){lt(this,"defaults",uC());lt(this,"options",this.setOptions);lt(this,"parse",this.parseMarkdown(!0));lt(this,"parseInline",this.parseMarkdown(!1));lt(this,"Parser",ga);lt(this,"Renderer",H0);lt(this,"TextRenderer",bC);lt(this,"Lexer",Vs);lt(this,"Tokenizer",z0);lt(this,"Hooks",gh);this.use(...t)}walkTokens(t,n){var s,a;let r=[];for(let l of t)switch(r=r.concat(n.call(this,l)),l.type){case"table":{let c=l;for(let d of c.header)r=r.concat(this.walkTokens(d.tokens,n));for(let d of c.rows)for(let f of d)r=r.concat(this.walkTokens(f.tokens,n));break}case"list":{let c=l;r=r.concat(this.walkTokens(c.items,n));break}default:{let c=l;(a=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&a[c.type]?this.defaults.extensions.childTokens[c.type].forEach(d=>{let f=c[d].flat(1/0);r=r.concat(this.walkTokens(f,n))}):c.tokens&&(r=r.concat(this.walkTokens(c.tokens,n)))}}return r}use(...t){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let l=n.renderers[a.name];l?n.renderers[a.name]=function(...c){let d=a.renderer.apply(this,c);return d===!1&&(d=l.apply(this,c)),d}:n.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=n[a.level];l?l.unshift(a.tokenizer):n[a.level]=[a.tokenizer],a.start&&(a.level==="block"?n.startBlock?n.startBlock.push(a.start):n.startBlock=[a.start]:a.level==="inline"&&(n.startInline?n.startInline.push(a.start):n.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(n.childTokens[a.name]=a.childTokens)}),s.extensions=n),r.renderer){let a=this.defaults.renderer||new H0(this.defaults);for(let l in r.renderer){if(!(l in a))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let c=l,d=r.renderer[c],f=a[c];a[c]=(...m)=>{let p=d.apply(a,m);return p===!1&&(p=f.apply(a,m)),p||""}}s.renderer=a}if(r.tokenizer){let a=this.defaults.tokenizer||new z0(this.defaults);for(let l in r.tokenizer){if(!(l in a))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let c=l,d=r.tokenizer[c],f=a[c];a[c]=(...m)=>{let p=d.apply(a,m);return p===!1&&(p=f.apply(a,m)),p}}s.tokenizer=a}if(r.hooks){let a=this.defaults.hooks||new gh;for(let l in r.hooks){if(!(l in a))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let c=l,d=r.hooks[c],f=a[c];gh.passThroughHooks.has(l)?a[c]=m=>{if(this.defaults.async&&gh.passThroughHooksRespectAsync.has(l))return(async()=>{let x=await d.call(a,m);return f.call(a,x)})();let p=d.call(a,m);return f.call(a,p)}:a[c]=(...m)=>{if(this.defaults.async)return(async()=>{let x=await d.apply(a,m);return x===!1&&(x=await f.apply(a,m)),x})();let p=d.apply(a,m);return p===!1&&(p=f.apply(a,m)),p}}s.hooks=a}if(r.walkTokens){let a=this.defaults.walkTokens,l=r.walkTokens;s.walkTokens=function(c){let d=[];return d.push(l.call(this,c)),a&&(d=d.concat(a.call(this,c))),d}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return Vs.lex(t,n??this.defaults)}parser(t,n){return ga.parse(t,n??this.defaults)}parseMarkdown(t){return(n,r)=>{let s={...r},a={...this.defaults,...s},l=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&s.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(a.hooks&&(a.hooks.options=a,a.hooks.block=t),a.async)return(async()=>{let c=a.hooks?await a.hooks.preprocess(n):n,d=await(a.hooks?await a.hooks.provideLexer():t?Vs.lex:Vs.lexInline)(c,a),f=a.hooks?await a.hooks.processAllTokens(d):d;a.walkTokens&&await Promise.all(this.walkTokens(f,a.walkTokens));let m=await(a.hooks?await a.hooks.provideParser():t?ga.parse:ga.parseInline)(f,a);return a.hooks?await a.hooks.postprocess(m):m})().catch(l);try{a.hooks&&(n=a.hooks.preprocess(n));let c=(a.hooks?a.hooks.provideLexer():t?Vs.lex:Vs.lexInline)(n,a);a.hooks&&(c=a.hooks.processAllTokens(c)),a.walkTokens&&this.walkTokens(c,a.walkTokens);let d=(a.hooks?a.hooks.provideParser():t?ga.parse:ga.parseInline)(c,a);return a.hooks&&(d=a.hooks.postprocess(d)),d}catch(c){return l(c)}}}onError(t,n){return r=>{if(r.message+=`
|
|
735
735
|
Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+vi(r.message+"",!0)+"</pre>";return n?Promise.resolve(s):s}if(n)return Promise.reject(r);throw r}}},ac=new h1e;function cn(e,t){return ac.parse(e,t)}cn.options=cn.setOptions=function(e){return ac.setOptions(e),cn.defaults=ac.defaults,jF(cn.defaults),cn};cn.getDefaults=uC;cn.defaults=jc;cn.use=function(...e){return ac.use(...e),cn.defaults=ac.defaults,jF(cn.defaults),cn};cn.walkTokens=function(e,t){return ac.walkTokens(e,t)};cn.parseInline=ac.parseInline;cn.Parser=ga;cn.parser=ga.parse;cn.Renderer=H0;cn.TextRenderer=bC;cn.Lexer=Vs;cn.lexer=Vs.lex;cn.Tokenizer=z0;cn.Hooks=gh;cn.parse=cn;cn.options;cn.setOptions;cn.use;cn.walkTokens;cn.parseInline;ga.parse;Vs.lex;var p1e=300,m1e="300px",g1e=500;function x1e(e={}){let{immediate:t=!1,debounceDelay:n=p1e,rootMargin:r=m1e,idleTimeout:s=g1e}=e,[a,l]=g.useState(!1),c=g.useRef(null),d=g.useRef(null),f=g.useRef(null),m=g.useMemo(()=>b=>{let v=Date.now();return window.setTimeout(()=>{b({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-v))})},1)},[]),p=g.useMemo(()=>typeof window<"u"&&window.requestIdleCallback?(b,v)=>window.requestIdleCallback(b,v):m,[m]),x=g.useMemo(()=>typeof window<"u"&&window.cancelIdleCallback?b=>window.cancelIdleCallback(b):b=>{clearTimeout(b)},[]);return g.useEffect(()=>{if(t){l(!0);return}let b=c.current;if(!b)return;d.current&&(clearTimeout(d.current),d.current=null),f.current&&(x(f.current),f.current=null);let v=()=>{d.current&&(clearTimeout(d.current),d.current=null),f.current&&(x(f.current),f.current=null)},E=A=>{f.current=p(j=>{j.timeRemaining()>0||j.didTimeout?(l(!0),A.disconnect()):f.current=p(()=>{l(!0),A.disconnect()},{timeout:s/2})},{timeout:s})},w=A=>{v(),d.current=window.setTimeout(()=>{var j,R;let _=A.takeRecords();(_.length===0||(R=(j=_.at(-1))==null?void 0:j.isIntersecting)!=null&&R)&&E(A)},n)},S=(A,j)=>{A.isIntersecting?w(j):v()},N=new IntersectionObserver(A=>{for(let j of A)S(j,N)},{rootMargin:r,threshold:0});return N.observe(b),()=>{d.current&&clearTimeout(d.current),f.current&&x(f.current),N.disconnect()}},[t,n,r,s,x,p]),{shouldRender:a,containerRef:c}}var zF=/\s/,b1e=/^\s+$/,y1e=new Set(["code","pre","svg","math","annotation"]),v1e=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",E1e=e=>e.some(t=>v1e(t)&&y1e.has(t.tagName)),T1e=e=>{let t=[],n="",r=!1;for(let s of e){let a=zF.test(s);a!==r&&n&&(t.push(n),n=""),n+=s,r=a}return n&&t.push(n),t},S1e=e=>{let t=[],n="";for(let r of e)zF.test(r)?n+=r:(n&&(t.push(n),n=""),t.push(r));return n&&t.push(n),t},w1e=(e,t,n,r,s)=>({type:"element",tagName:"span",properties:{"data-sd-animate":!0,style:s?`--sd-animation:sd-${t};--sd-duration:0ms;--sd-easing:${r}`:`--sd-animation:sd-${t};--sd-duration:${n}ms;--sd-easing:${r}`},children:[{type:"text",value:e}]}),C1e=(e,t,n,r,s)=>{let a=t.at(-1);if(!(a&&"children"in a))return;if(E1e(t))return Bu;let l=a,c=l.children.indexOf(e);if(c===-1)return;let d=e.value;if(!d.trim()){s.count+=d.length;return}let f=n.sep==="char"?S1e(d):T1e(d),m=r.prevContentLength,p=f.map(x=>{let b=s.count;if(s.count+=x.length,b1e.test(x))return{type:"text",value:x};let v=m>0&&b<m;return w1e(x,n.animation,n.duration,n.easing,v)});return l.children.splice(c,1,...p),c+p.length},N1e=0;function rS(e){var t,n,r,s;let a={animation:(t=e==null?void 0:e.animation)!=null?t:"fadeIn",duration:(n=e==null?void 0:e.duration)!=null?n:150,easing:(r=e==null?void 0:e.easing)!=null?r:"ease",sep:(s=e==null?void 0:e.sep)!=null?s:"word"},l={prevContentLength:0,lastRenderCharCount:0},c=N1e++,d=()=>f=>{let m={count:0};z2(f,"text",(p,x)=>C1e(p,x,a,l,m)),l.lastRenderCharCount=m.count,l.prevContentLength=0};return Object.defineProperty(d,"name",{value:`rehypeAnimate$${c}`}),{name:"animate",type:"animate",rehypePlugin:d,setPrevContentLength(f){l.prevContentLength=f},getLastRenderCharCount(){let f=l.lastRenderCharCount;return l.lastRenderCharCount=0,f}}}rS();var HF=g.createContext(!1),k1e=()=>g.useContext(HF),yC=(...e)=>Z0(Q0(e)),A1e=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(r=>r.startsWith(n)?r:`${e}:${r}`).join(" ")},j1e=e=>e?(...t)=>A1e(e,Z0(Q0(t))):yC,Wu=(e,t,n)=>{let r=typeof t=="string"?new Blob([t],{type:n}):t,s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(s)},sS=g.createContext(yC),jt=()=>g.useContext(sS),_1e=yC("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),R1e=e=>{let t={};for(let n of e.split(";")){let r=n.indexOf(":");if(r>0){let s=n.slice(0,r).trim(),a=n.slice(r+1).trim();s&&a&&(t[s]=a)}}return t},D1e=g.memo(({children:e,result:t,language:n,className:r,startLine:s,...a})=>{let l=jt(),c=g.useMemo(()=>l(_1e),[l]),d=g.useMemo(()=>{let f={};return t.bg&&(f["--sdm-bg"]=t.bg),t.fg&&(f["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(f,R1e(t.rootStyle)),f},[t.bg,t.fg,t.rootStyle]);return i.jsx("div",{className:l(r,"overflow-hidden rounded-md border border-border bg-background p-4 text-sm"),"data-language":n,"data-streamdown":"code-block-body",...a,children:i.jsx("pre",{className:l(r,"bg-[var(--sdm-bg,inherit]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),style:d,children:i.jsx("code",{className:l("[counter-increment:line_0] [counter-reset:line]"),style:s&&s>1?{counterReset:`line ${s-1}`}:void 0,children:t.tokens.map((f,m)=>i.jsx("span",{className:c,children:f.length===0||f.length===1&&f[0].content===""?`
|
|
736
|
-
`:f.map((p,x)=>{let b={},v=!!p.bgColor;if(p.color&&(b["--sdm-c"]=p.color),p.bgColor&&(b["--sdm-tbg"]=p.bgColor),p.htmlStyle)for(let[E,w]of Object.entries(p.htmlStyle))E==="color"?b["--sdm-c"]=w:E==="background-color"?(b["--sdm-tbg"]=w,v=!0):b[E]=w;return i.jsx("span",{className:l("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",v&&"bg-[var(--sdm-tbg)]",v&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:b,...p.htmlAttrs,children:p.content},x)})},m))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine),M1e=({className:e,language:t,style:n,isIncomplete:r,...s})=>{let a=jt();return i.jsx("div",{className:a("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...n},...s})},UF=g.createContext({code:""}),$F=()=>g.useContext(UF),O1e=({language:e})=>{let t=jt();return i.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:i.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})},I1e=/\n+$/,L1e=g.lazy(()=>W0(()=>import("./highlighted-body-TPN3WLV5-
|
|
736
|
+
`:f.map((p,x)=>{let b={},v=!!p.bgColor;if(p.color&&(b["--sdm-c"]=p.color),p.bgColor&&(b["--sdm-tbg"]=p.bgColor),p.htmlStyle)for(let[E,w]of Object.entries(p.htmlStyle))E==="color"?b["--sdm-c"]=w:E==="background-color"?(b["--sdm-tbg"]=w,v=!0):b[E]=w;return i.jsx("span",{className:l("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",v&&"bg-[var(--sdm-tbg)]",v&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:b,...p.htmlAttrs,children:p.content},x)})},m))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine),M1e=({className:e,language:t,style:n,isIncomplete:r,...s})=>{let a=jt();return i.jsx("div",{className:a("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...n},...s})},UF=g.createContext({code:""}),$F=()=>g.useContext(UF),O1e=({language:e})=>{let t=jt();return i.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:i.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})},I1e=/\n+$/,L1e=g.lazy(()=>W0(()=>import("./highlighted-body-TPN3WLV5-DFPa3ej5.js"),[]).then(e=>({default:e.HighlightedCodeBlockBody}))),P1e=({code:e,language:t,className:n,children:r,isIncomplete:s=!1,startLine:a,...l})=>{let c=jt(),d=g.useMemo(()=>e.replace(I1e,""),[e]),f=g.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:d.split(`
|
|
737
737
|
`).map(m=>[{content:m,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[d]);return i.jsx(UF.Provider,{value:{code:e},children:i.jsxs(M1e,{isIncomplete:s,language:t,children:[i.jsx(O1e,{language:t}),r?i.jsx("div",{className:c("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:i.jsx("div",{className:c("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:r})}):null,i.jsx(g.Suspense,{fallback:i.jsx(D1e,{className:n,language:t,result:f,startLine:a,...l}),children:i.jsx(L1e,{className:n,code:d,language:t,raw:f,startLine:a,...l})})]})})},B1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),F1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),z1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),H1e=e=>i.jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[i.jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),i.jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),U1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),$1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),V1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),q1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),G1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),Y1e=e=>i.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:i.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),xh={CheckIcon:B1e,CopyIcon:F1e,DownloadIcon:z1e,ExternalLinkIcon:q1e,Loader2Icon:H1e,Maximize2Icon:U1e,RotateCcwIcon:$1e,XIcon:V1e,ZoomInIcon:G1e,ZoomOutIcon:Y1e},VF=g.createContext(xh),K1e=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>e[s]===t[s])},t5=({icons:e,children:t})=>{let n=g.useRef(e),r=g.useRef(e?{...xh,...e}:xh);K1e(n.current,e)||(n.current=e,r.current=e?{...xh,...e}:xh);let s=r.current;return i.jsx(VF.Provider,{value:s,children:t})},Sa=()=>g.useContext(VF),qF={copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},aS=g.createContext(qF),qi=()=>g.useContext(aS),n5=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:s,code:a,...l})=>{let c=jt(),[d,f]=g.useState(!1),m=g.useRef(0),{code:p}=$F(),{isAnimating:x}=g.useContext(As),b=qi(),v=a??p,E=async()=>{var N;if(typeof window>"u"||!((N=navigator==null?void 0:navigator.clipboard)!=null&&N.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{d||(await navigator.clipboard.writeText(v),f(!0),e==null||e(),m.current=window.setTimeout(()=>f(!1),n))}catch(A){t==null||t(A)}};g.useEffect(()=>()=>{window.clearTimeout(m.current)},[]);let w=Sa(),S=d?w.CheckIcon:w.CopyIcon;return i.jsx("button",{className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",s),"data-streamdown":"code-block-copy-button",disabled:x,onClick:E,title:b.copyCode,type:"button",...l,children:r??i.jsx(S,{size:14})})},r5={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",文言:"wy"},W1e=({onDownload:e,onError:t,language:n,children:r,className:s,code:a,...l})=>{let c=jt(),{code:d}=$F(),{isAnimating:f}=g.useContext(As),m=qi(),p=Sa(),x=a??d,b=`file.${n&&n in r5?r5[n]:"txt"}`,v="text/plain",E=()=>{try{Wu(b,x,v),e==null||e()}catch(w){t==null||t(w)}};return i.jsx("button",{className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",s),"data-streamdown":"code-block-download-button",disabled:f,onClick:E,title:m.downloadFile,type:"button",...l,children:r??i.jsx(p.DownloadIcon,{size:14})})},s5=()=>{let{Loader2Icon:e}=Sa(),t=jt();return i.jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[i.jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),i.jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:i.jsx(e,{className:t("size-4 animate-spin")})})]})},X1e=/\.[^/.]+$/,Q1e=({node:e,className:t,src:n,alt:r,onLoad:s,onError:a,...l})=>{let{DownloadIcon:c}=Sa(),d=jt(),f=g.useRef(null),[m,p]=g.useState(!1),[x,b]=g.useState(!1),v=qi(),E=l.width!=null||l.height!=null,w=(m||E)&&!x,S=x&&!E;g.useEffect(()=>{let R=f.current;if(R!=null&&R.complete){let _=R.naturalWidth>0;p(_),b(!_)}},[]);let N=g.useCallback(R=>{p(!0),b(!1),s==null||s(R)},[s]),A=g.useCallback(R=>{p(!1),b(!0),a==null||a(R)},[a]),j=async()=>{if(n)try{let R=await(await fetch(n)).blob(),_=new URL(n,window.location.origin).pathname.split("/").pop()||"",D=_.split(".").pop(),I=_.includes(".")&&D!==void 0&&D.length<=4,L="";if(I)L=_;else{let B=R.type,X="png";B.includes("jpeg")||B.includes("jpg")?X="jpg":B.includes("png")?X="png":B.includes("svg")?X="svg":B.includes("gif")?X="gif":B.includes("webp")&&(X="webp"),L=`${(r||_||"image").replace(X1e,"")}.${X}`}Wu(L,R,R.type)}catch{window.open(n,"_blank")}};return n?i.jsxs("div",{className:d("group relative my-4 inline-block"),"data-streamdown":"image-wrapper",children:[i.jsx("img",{alt:r,className:d("max-w-full rounded-lg",S&&"hidden",t),"data-streamdown":"image",onError:A,onLoad:N,ref:f,src:n,...l}),S&&i.jsx("span",{className:d("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:v.imageNotAvailable}),i.jsx("div",{className:d("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block")}),w&&i.jsx("button",{className:d("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:j,title:v.downloadImage,type:"button",children:i.jsx(c,{size:14})})]}):null},Dh=0,vC=()=>{Dh+=1,Dh===1&&(document.body.style.overflow="hidden")},EC=()=>{Dh=Math.max(0,Dh-1),Dh===0&&(document.body.style.overflow="")},Z1e=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:s,CopyIcon:a,ExternalLinkIcon:l,XIcon:c}=Sa(),d=jt(),[f,m]=g.useState(!1),p=qi(),x=g.useCallback(async()=>{try{await navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},[e]),b=g.useCallback(()=>{r(),n()},[r,n]);return g.useEffect(()=>{if(t){vC();let v=E=>{E.key==="Escape"&&n()};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v),EC()}}},[t,n]),t?i.jsx("div",{className:d("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:n,onKeyDown:v=>{v.key==="Escape"&&n()},role:"button",tabIndex:0,children:i.jsxs("div",{className:d("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:v=>v.stopPropagation(),onKeyDown:v=>v.stopPropagation(),role:"presentation",children:[i.jsx("button",{className:d("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:n,title:p.close,type:"button",children:i.jsx(c,{size:16})}),i.jsxs("div",{className:d("flex flex-col gap-2"),children:[i.jsxs("div",{className:d("flex items-center gap-2 font-semibold text-lg"),children:[i.jsx(l,{size:20}),i.jsx("span",{children:p.openExternalLink})]}),i.jsx("p",{className:d("text-muted-foreground text-sm"),children:p.externalLinkWarning})]}),i.jsx("div",{className:d("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),i.jsxs("div",{className:d("flex gap-2"),children:[i.jsx("button",{className:d("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),onClick:x,type:"button",children:f?i.jsxs(i.Fragment,{children:[i.jsx(s,{size:14}),i.jsx("span",{children:p.copied})]}):i.jsxs(i.Fragment,{children:[i.jsx(a,{size:14}),i.jsx("span",{children:p.copyLink})]})}),i.jsxs("button",{className:d("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:b,type:"button",children:[i.jsx(l,{size:14}),i.jsx("span",{children:p.openLink})]})]})]})}):null},iS=g.createContext(null),TC=()=>g.useContext(iS),LAe=()=>{var e;let t=TC();return(e=t==null?void 0:t.code)!=null?e:null},SC=()=>{var e;let t=TC();return(e=t==null?void 0:t.mermaid)!=null?e:null},J1e=e=>{var t;let n=TC();return n!=null&&n.renderers&&e&&(t=n.renderers.find(r=>Array.isArray(r.language)?r.language.includes(e):r.language===e))!=null?t:null},eve=(e,t)=>{var n;let r=(n=void 0)!=null?n:5;return new Promise((s,a)=>{let l="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),c=new Image;c.crossOrigin="anonymous",c.onload=()=>{let d=document.createElement("canvas"),f=c.width*r,m=c.height*r;d.width=f,d.height=m;let p=d.getContext("2d");if(!p){a(new Error("Failed to create 2D canvas context for PNG export"));return}p.drawImage(c,0,0,f,m),d.toBlob(x=>{if(!x){a(new Error("Failed to create PNG blob"));return}s(x)},"image/png")},c.onerror=()=>a(new Error("Failed to load SVG image")),c.src=l})},tve=({chart:e,children:t,className:n,onDownload:r,config:s,onError:a})=>{let l=jt(),[c,d]=g.useState(!1),f=g.useRef(null),{isAnimating:m}=g.useContext(As),p=Sa(),x=SC(),b=qi(),v=async E=>{try{if(E==="mmd"){Wu("diagram.mmd",e,"text/plain"),d(!1),r==null||r(E);return}if(!x){a==null||a(new Error("Mermaid plugin not available"));return}let w=x.getMermaid(s),S=e.split("").reduce((j,R)=>(j<<5)-j+R.charCodeAt(0)|0,0),N=`mermaid-${Math.abs(S)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:A}=await w.render(N,e);if(!A){a==null||a(new Error("SVG not found. Please wait for the diagram to render."));return}if(E==="svg"){Wu("diagram.svg",A,"image/svg+xml"),d(!1),r==null||r(E);return}if(E==="png"){let j=await eve(A);Wu("diagram.png",j,"image/png"),r==null||r(E),d(!1);return}}catch(w){a==null||a(w)}};return g.useEffect(()=>{let E=w=>{let S=w.composedPath();f.current&&!S.includes(f.current)&&d(!1)};return document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[]),i.jsxs("div",{className:l("relative"),ref:f,children:[i.jsx("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",n),disabled:m,onClick:()=>d(!c),title:b.downloadDiagram,type:"button",children:t??i.jsx(p.DownloadIcon,{size:14})}),c?i.jsxs("div",{className:l("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[i.jsx("button",{className:l("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>v("svg"),title:b.downloadDiagramAsSvg,type:"button",children:b.mermaidFormatSvg}),i.jsx("button",{className:l("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>v("png"),title:b.downloadDiagramAsPng,type:"button",children:b.mermaidFormatPng}),i.jsx("button",{className:l("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>v("mmd"),title:b.downloadDiagramAsMmd,type:"button",children:b.mermaidFormatMmd})]}):null]})},nve=({chart:e,config:t,onFullscreen:n,onExit:r,className:s,...a})=>{let{Maximize2Icon:l,XIcon:c}=Sa(),d=jt(),[f,m]=g.useState(!1),{isAnimating:p,controls:x}=g.useContext(As),b=qi(),v=(()=>{if(typeof x=="boolean")return x;let w=x.mermaid;return w===!1?!1:w===!0||w===void 0?!0:w.panZoom!==!1})(),E=()=>{m(!f)};return g.useEffect(()=>{if(f){vC();let w=S=>{S.key==="Escape"&&m(!1)};return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w),EC()}}},[f]),g.useEffect(()=>{f?n==null||n():r&&r()},[f,n,r]),i.jsxs(i.Fragment,{children:[i.jsx("button",{className:d("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",s),disabled:p,onClick:E,title:b.viewFullscreen,type:"button",...a,children:i.jsx(l,{size:14})}),f?Ka.createPortal(i.jsxs("div",{className:d("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),onClick:E,onKeyDown:w=>{w.key==="Escape"&&E()},role:"button",tabIndex:0,children:[i.jsx("button",{className:d("absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:E,title:b.exitFullscreen,type:"button",children:i.jsx(c,{size:20})}),i.jsx("div",{className:d("flex size-full items-center justify-center p-4"),onClick:w=>w.stopPropagation(),onKeyDown:w=>w.stopPropagation(),role:"presentation",children:i.jsx(Sz,{chart:e,className:d("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:!0,showControls:v})})]}),document.body):null]})},GF=e=>{var t,n;let r=[],s=[],a=e.querySelectorAll("thead th");for(let c of a)r.push(((t=c.textContent)==null?void 0:t.trim())||"");let l=e.querySelectorAll("tbody tr");for(let c of l){let d=[],f=c.querySelectorAll("td");for(let m of f)d.push(((n=m.textContent)==null?void 0:n.trim())||"");s.push(d)}return{headers:r,rows:s}},YF=e=>{let{headers:t,rows:n}=e,r=c=>{let d=!1,f=!1;for(let m of c){if(m==='"'){d=!0,f=!0;break}(m===","||m===`
|
|
738
738
|
`)&&(d=!0)}return d?f?`"${c.replace(/"/g,'""')}"`:`"${c}"`:c},s=t.length>0?n.length+1:n.length,a=new Array(s),l=0;t.length>0&&(a[l]=t.map(r).join(","),l+=1);for(let c of n)a[l]=c.map(r).join(","),l+=1;return a.join(`
|
|
739
739
|
`)},rve=e=>{let{headers:t,rows:n}=e,r=c=>{let d=!1;for(let m of c)if(m===" "||m===`
|
|
@@ -853,7 +853,7 @@ ${[`Name: ${e.name}`,`ID: ${e.id}`,e.description&&`Description: ${e.description}
|
|
|
853
853
|
|
|
854
854
|
<agent_persona>
|
|
855
855
|
${s}
|
|
856
|
-
</agent_persona>`),x},[e.name,e.id,e.description,e.capabilities,r,s]);return i.jsxs("div",{className:"space-y-6",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:"This text is appended to Claude Code's system prompt for every session in this directory. Use it to define the agent's expertise, constraints, and personality."}),i.jsx(Ws,{children:i.jsxs(Xs,{children:[i.jsxs(Yh,{orientation:"horizontal",className:"items-center justify-between",children:[i.jsx(Kh,{htmlFor:"persona-toggle",className:"text-sm font-medium",children:"Inject persona into sessions"}),i.jsx(qt,{id:"persona-toggle",checked:r,onCheckedChange:c})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("textarea",{id:"persona-text",value:s,onChange:p=>d(p.target.value),onBlur:f,rows:8,maxLength:sM,disabled:!r,className:"border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring w-full resize-none rounded-md border px-3 py-2 font-mono text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"You are backend-bot, an expert in REST API design..."}),i.jsxs("p",{className:"text-muted-foreground text-right text-xs",children:[s.length," / ",sM.toLocaleString()]})]})]})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{className:"text-sm font-medium",children:"Preview (injected into system prompt)"}),i.jsx("pre",{className:"bg-muted max-h-48 overflow-auto rounded-md p-3",children:i.jsx("code",{className:"text-xs",children:m})})]})]})}function Twe({domain:e,agentOverride:t,globalDefault:n,onToggle:r,onReset:s}){const a=t!==void 0,l=t??n,c=a?`Overridden: ${l?"On":"Off"}`:"Inherited";return e.serverDisabled?i.jsx(vn,{label:e.label,description:e.description,className:"py-1",children:i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground/50 text-xs",children:"Server off"}),i.jsx(qt,{checked:!1,disabled:!0,"aria-label":`Toggle ${e.label} tools`})]})}),i.jsx(ks,{side:"left",children:e.serverDisabledReason??"Disabled globally by server configuration."})]})}):i.jsx(vn,{label:e.label,description:e.description,className:"py-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`text-xs ${a?"text-foreground":"text-muted-foreground"}`,children:c}),a&&i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsx(tt,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>s(e.key),"aria-label":`Reset ${e.label} to default`,children:i.jsx(TI,{className:"size-3"})})}),i.jsx(ks,{side:"top",children:"Reset to default"})]}),i.jsx(qt,{checked:l,onCheckedChange:d=>r(e.key,d),"aria-label":`Toggle ${e.label} tools`})]})})}const Mg="border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring w-full rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",Swe=500;function wwe({agent:e,onUpdate:t}){var A,j,R;const[n,r]=g.useState(""),s=Nd(),a=kd(),{config:l}=Dz(),[c,d]=g.useState(e.namespace??""),f=g.useRef(null);g.useEffect(()=>{d(e.namespace??"")},[e.id]);const m=g.useCallback(_=>{d(_),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{t({namespace:_||void 0})},Swe)},[t]),p=g.useCallback(()=>{f.current&&clearTimeout(f.current);const _=c||void 0;_!==e.namespace&&t({namespace:_})},[c,e.namespace,t]);g.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const x=g.useCallback(_=>{const D=_.trim();!D||e.capabilities.includes(D)||(t({capabilities:[...e.capabilities,D]}),r(""))},[e.capabilities,t]),b=g.useCallback(_=>{t({capabilities:e.capabilities.filter(D=>D!==_)})},[e.capabilities,t]),v=g.useCallback(_=>{(_.key==="Enter"||_.key===",")&&(_.preventDefault(),x(n))},[n,x]),E=g.useCallback((_,D)=>{const I=e.enabledToolGroups??{};t({enabledToolGroups:{...I,[_]:D}})},[e.enabledToolGroups,t]),w=g.useCallback(_=>{const D={...e.enabledToolGroups??{}};delete D[_],t({enabledToolGroups:D})},[e.enabledToolGroups,t]),S=[{key:"pulse",configKey:"pulseTools",label:"Pulse (Scheduling)",description:"Create and manage scheduled agent runs",serverDisabled:!a,serverDisabledReason:"Disabled globally by server configuration."},{key:"relay",configKey:"relayTools",label:"Relay (Messaging)",description:"Send messages, check inbox, register endpoints",serverDisabled:!s,serverDisabledReason:"Disabled globally by server configuration."},{key:"mesh",configKey:"meshTools",label:"Mesh (Discovery)",description:"Discover, register, and query agents"},{key:"adapter",configKey:"adapterTools",label:"Relay Adapters",description:"Manage Slack, Telegram, and other adapters",serverDisabled:!s,serverDisabledReason:"Disabled globally by server configuration."}],N=e.enabledToolGroups??{};return i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ws,{children:i.jsxs(Xs,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{htmlFor:"cap-input",className:"text-sm font-medium",children:"Capabilities"}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.capabilities.map(_=>i.jsxs(sn,{variant:"secondary",className:"gap-1 pr-1",children:[_,i.jsx("button",{onClick:()=>b(_),className:"hover:bg-muted rounded-sm p-0.5 transition-colors duration-150","aria-label":`Remove ${_}`,children:i.jsx(wr,{className:"size-3"})})]},_))}),i.jsx("input",{id:"cap-input",type:"text",value:n,onChange:_=>r(_.target.value),onKeyDown:v,className:Mg,placeholder:"Add capability and press Enter"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{htmlFor:"agent-namespace",className:"text-sm font-medium",children:"Namespace"}),i.jsx("input",{id:"agent-namespace",type:"text",value:c,onChange:_=>m(_.target.value),onBlur:p,className:Mg,placeholder:"Optional grouping namespace"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{className:"text-sm font-medium",children:"Response Mode"}),i.jsxs(On,{value:((A=e.behavior)==null?void 0:A.responseMode)??"always",onValueChange:_=>t({behavior:{...e.behavior,responseMode:_}}),children:[i.jsx(An,{className:"w-full",children:i.jsx(In,{})}),i.jsxs(jn,{children:[i.jsx(ft,{value:"always",children:"Always respond"}),i.jsx(ft,{value:"direct-only",children:"Direct messages only"}),i.jsx(ft,{value:"mention-only",children:"Mentions only"}),i.jsx(ft,{value:"silent",children:"Silent"})]})]})]})]})}),i.jsx("h3",{className:"text-sm font-semibold",children:"Budget"}),i.jsx(Ws,{children:i.jsx(Xs,{children:i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"max-hops",className:"text-muted-foreground text-xs",children:"Max Hops / Message"}),i.jsx("input",{id:"max-hops",type:"number",min:1,value:((j=e.budget)==null?void 0:j.maxHopsPerMessage)??5,onChange:_=>t({budget:{...e.budget,maxHopsPerMessage:parseInt(_.target.value)||5}}),className:Mg})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"max-calls",className:"text-muted-foreground text-xs",children:"Max Calls / Hour"}),i.jsx("input",{id:"max-calls",type:"number",min:1,value:((R=e.budget)==null?void 0:R.maxCallsPerHour)??100,onChange:_=>t({budget:{...e.budget,maxCallsPerHour:parseInt(_.target.value)||100}}),className:Mg})]})]})})}),i.jsx("h3",{className:"text-sm font-semibold",children:"Tool Groups"}),i.jsx("p",{className:"text-muted-foreground text-xs",children:"Override which MCP tool domains are available to this agent. Leave unset to inherit global defaults."}),i.jsx(Ws,{children:i.jsxs(Xs,{children:[i.jsx(vn,{label:"Core Tools",description:"ping, server info, agent identity",className:"py-1",children:i.jsx("span",{className:"text-muted-foreground text-xs",children:"Always enabled"})}),S.map(_=>i.jsx(Twe,{domain:_,agentOverride:N[_.key],globalDefault:l[_.configKey],onToggle:E,onReset:w},_.key))]})})]})}function Cwe({agent:e}){const t=kd(),n=Nd(),{data:r}=MC(e.id);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Pulse Schedules"}),i.jsx(sn,{variant:t?"default":"secondary",className:"text-xs",children:t?"Enabled":"Disabled"})]}),i.jsx("p",{className:"text-muted-foreground text-sm",children:t?"Configure automated schedules for this agent in the Pulse panel.":"Enable Pulse to schedule automated agent runs."})]}),i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Relay Endpoints"}),i.jsx(sn,{variant:n?"default":"secondary",className:"text-xs",children:n?"Enabled":"Disabled"})]}),i.jsx("p",{className:"text-muted-foreground text-sm",children:n?"Manage messaging endpoints for this agent in the Relay panel.":"Enable Relay for inter-agent messaging."})]}),i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Mesh Health"}),i.jsx(sn,{variant:"default",className:"text-xs",children:"Enabled"})]}),r?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:"Status:"}),i.jsx(sn,{variant:r.status==="active"?"default":"secondary",className:"text-xs",children:r.status}),r.lastSeenAt&&i.jsxs("span",{className:"text-muted-foreground text-xs",children:["Last seen ",new Date(r.lastSeenAt).toLocaleString()]})]}):i.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading health information..."})]})]})}function $z({projectPath:e,open:t,onOpenChange:n}){const[r,s]=g.useState("identity"),{data:a}=ex(e),l=VG(),c=g.useCallback(d=>{l.mutate({path:e,updates:d})},[e,l]);return a?i.jsx(ys,{open:t,onOpenChange:n,children:i.jsx(vs,{"data-testid":"agent-dialog",className:"max-h-[85vh] max-w-2xl gap-0 p-0",children:i.jsxs(R2,{value:r,onValueChange:s,children:[i.jsx(Yu,{}),i.jsxs(I2,{children:[i.jsx(Qs,{className:"text-sm font-medium",children:a.name}),i.jsx(Zs,{className:"text-muted-foreground text-xs",children:"Agent configuration"}),i.jsxs("div",{className:"text-muted-foreground/60 flex items-center gap-1.5 pt-1",children:[i.jsx(Ii,{className:"size-3 flex-shrink-0"}),i.jsx(PT,{path:e,maxSegments:3,size:"sm"})]})]}),i.jsxs(O2,{children:[i.jsxs(D2,{children:[i.jsx(fa,{value:"identity",icon:ete,children:"Identity"}),i.jsx(fa,{value:"persona",icon:CI,children:"Persona"}),i.jsx(fa,{value:"capabilities",icon:pte,children:"Capabilities"}),i.jsx(fa,{value:"connections",icon:EI,children:"Connections"})]}),i.jsxs(M2,{className:"min-h-[280px] p-4",children:[i.jsx(pa,{value:"identity",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Identity"}),i.jsx(ywe,{agent:a,projectPath:e,onUpdate:c})]})}),i.jsx(pa,{value:"persona",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Persona"}),i.jsx(Ewe,{agent:a,onUpdate:c})]})}),i.jsx(pa,{value:"capabilities",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Capabilities"}),i.jsx(wwe,{agent:a,onUpdate:c})]})}),i.jsx(pa,{value:"connections",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Connections"}),i.jsx(Cwe,{agent:a})]})})]})]})]})})}):i.jsx(ys,{open:t,onOpenChange:n,children:i.jsxs(vs,{className:"max-h-[85vh] max-w-lg gap-0 p-0",children:[i.jsxs($a,{className:"space-y-0 border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Agent"}),i.jsx(Zs,{className:"sr-only",children:"Agent configuration"})]}),i.jsxs("div",{className:"flex h-32 flex-col items-center justify-center gap-2",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:"No agent registered"}),i.jsxs("div",{className:"text-muted-foreground/60 flex items-center gap-1.5",children:[i.jsx(Ii,{className:"size-3.5 flex-shrink-0"}),i.jsx(PT,{path:e,maxSegments:3,size:"sm"})]})]})]})})}X0(e=>({open:!1,projectPath:null,openDialog:t=>e({open:!0,projectPath:t}),closeDialog:()=>e({open:!1,projectPath:null})}));function Nwe({enabled:e=!0}){const{data:t,isLoading:n}=MTe(e);return!e||n||!t?null:i.jsxs("div",{className:"flex items-center gap-3 border-b px-3 py-1.5 text-xs text-muted-foreground",children:[i.jsxs("span",{children:[t.totalAgents," agents"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500","aria-hidden":"true"}),t.activeCount]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500","aria-hidden":"true"}),t.inactiveCount]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-zinc-400","aria-hidden":"true"}),t.staleCount]})]})}function aM(e){if(!e)return"Never";const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(Number.isNaN(r)||r<0)return"just now";const s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const l=Math.floor(a/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}const Vz={active:{label:"Active",color:"bg-green-500"},inactive:{label:"Inactive",color:"bg-amber-500"},stale:{label:"Stale",color:"bg-zinc-400"}};function kwe(e){return e in Vz}function iM({onClick:e}){return i.jsx("button",{type:"button",onClick:e,"aria-label":"Close detail panel",className:"text-muted-foreground hover:text-foreground",children:i.jsx(wr,{className:"size-(--size-icon-sm)"})})}function Awe({agentId:e,onClose:t,onOpenSettings:n}){const{data:r,isLoading:s}=MC(e);if(s)return i.jsx("div",{className:"flex w-64 items-center justify-center border-l p-4",children:i.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})});if(!r)return i.jsxs("div",{className:"w-64 border-l p-4",children:[i.jsx("div",{className:"flex justify-end",children:i.jsx(iM,{onClick:t})}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agent not found"})]});const a=kwe(r.status)?r.status:"stale",l=Vz[a];return i.jsxs("div",{className:"w-64 overflow-y-auto border-l p-4",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h3",{className:"truncate text-sm font-semibold",children:r.name}),i.jsx(iM,{onClick:t})]}),i.jsxs("div",{className:"space-y-3 text-xs",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${l.color}`,"aria-hidden":"true"}),i.jsx("span",{children:l.label})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Last seen: "}),i.jsx("span",{children:aM(r.lastSeenAt)})]}),r.lastSeenEvent&&i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Last event: "}),i.jsx("span",{children:r.lastSeenEvent})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Runtime: "}),i.jsx(sn,{variant:"secondary",className:"text-[0.625rem]",children:r.runtime})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Registered: "}),i.jsx("span",{children:aM(r.registeredAt)})]}),Array.isArray(r.capabilities)&&r.capabilities.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"mb-1 block text-muted-foreground",children:"Capabilities:"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:r.capabilities.map(c=>i.jsx(sn,{variant:"outline",className:"text-[0.625rem]",children:c},c))})]})]}),n&&i.jsx("div",{className:"mt-4 border-t pt-3",children:i.jsxs("button",{type:"button",onClick:n,className:"inline-flex w-full items-center justify-center gap-2 rounded-md border px-3 py-1.5 text-xs font-medium hover:bg-muted",children:[i.jsx(cx,{className:"size-3.5"}),"Open Settings"]})})]})}function PC({icon:e,headline:t,description:n,action:r,preview:s}){return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-12 text-center",children:[s&&i.jsx("div",{className:"mb-4 w-full max-w-sm select-none opacity-40 pointer-events-none",children:s}),i.jsx("div",{className:"rounded-xl bg-muted/50 p-3",children:i.jsx(e,{className:"size-6 text-muted-foreground"})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-medium",children:t}),i.jsx("p",{className:"max-w-[280px] text-xs text-muted-foreground",children:n})]}),r&&i.jsx(tt,{size:"sm",onClick:r.onClick,className:"mt-1",children:r.label})]})}function jwe({namespace:e,agentCount:t,agents:n}){const[r,s]=g.useState(!1);return i.jsxs("div",{className:"rounded-xl border",children:[i.jsxs("button",{type:"button",onClick:()=>s(!r),className:"flex w-full items-center gap-2 px-4 py-3 text-left hover:bg-muted/50",children:[r?i.jsx(Ss,{className:"size-4"}):i.jsx(Js,{className:"size-4"}),i.jsx("span",{className:"font-medium text-sm",children:e}),i.jsxs(sn,{variant:"secondary",className:"ml-auto text-xs",children:[t," agent",t!==1?"s":""]})]}),r&&i.jsx("div",{className:"border-t px-4 py-2 space-y-2",children:n.map(a=>i.jsxs("div",{className:"flex items-center justify-between py-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm",children:a.name}),i.jsx(sn,{variant:"outline",className:"text-xs",children:a.runtime})]}),a.budget&&i.jsxs("div",{className:"flex gap-2 text-xs text-muted-foreground",children:[i.jsxs("span",{children:[a.budget.maxCallsPerHour," calls/hr"]}),i.jsxs("span",{children:[a.budget.maxHopsPerMessage," max hops"]})]})]},a.id))})]})}function _we({sourceNamespace:e,targetNamespace:t,action:n,onRemove:r}){return i.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"font-mono",children:e}),i.jsx("span",{className:"text-muted-foreground",children:"→"}),i.jsx("span",{className:"font-mono",children:t}),i.jsx(sn,{variant:n==="allow"?"default":"destructive",className:"text-xs",children:n})]}),i.jsx("button",{type:"button",onClick:r,className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":`Remove rule ${e} to ${t}`,children:i.jsx(Rd,{className:"size-3.5"})})]})}function Rwe({namespaces:e,onAdd:t,isPending:n}){const[r,s]=g.useState(""),[a,l]=g.useState("");function c(d){d.preventDefault(),r&&a&&r!==a&&(t(r,a),s(""),l(""))}return i.jsxs("form",{onSubmit:c,className:"flex items-end gap-2",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{htmlFor:"acl-source",className:"text-xs font-medium text-muted-foreground",children:"Source"}),i.jsxs("select",{id:"acl-source",value:r,onChange:d=>s(d.target.value),className:"mt-1 w-full rounded-md border bg-transparent px-2 py-1.5 text-sm",children:[i.jsx("option",{value:"",children:"Select namespace"}),e.map(d=>i.jsx("option",{value:d,children:d},d))]})]}),i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{htmlFor:"acl-target",className:"text-xs font-medium text-muted-foreground",children:"Target"}),i.jsxs("select",{id:"acl-target",value:a,onChange:d=>l(d.target.value),className:"mt-1 w-full rounded-md border bg-transparent px-2 py-1.5 text-sm",children:[i.jsx("option",{value:"",children:"Select namespace"}),e.map(d=>i.jsx("option",{value:d,children:d},d))]})]}),i.jsxs("button",{type:"submit",disabled:n||!r||!a||r===a,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:[n?i.jsx(Gn,{className:"size-4 animate-spin"}):i.jsx(Ql,{className:"size-4"}),"Allow"]})]})}function Dwe({onGoToDiscovery:e}={}){const{data:t,isLoading:n}=ITe(),{mutate:r,isPending:s}=PTe();if(n)return i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})});const a=(t==null?void 0:t.namespaces)??[],l=(t==null?void 0:t.accessRules)??[],c=a.map(d=>d.namespace);return a.length===0?i.jsx(PC,{icon:hp,headline:"Cross-project access requires multiple namespaces",description:"Register agents from different directories to create namespaces, then configure cross-namespace access rules.",action:e?{label:"Go to Discovery",onClick:e}:void 0}):i.jsxs("div",{className:"space-y-6 p-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Namespaces"}),a.map(d=>i.jsx(jwe,{namespace:d.namespace,agentCount:d.agentCount,agents:d.agents},d.namespace))]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Cross-Project Access Rules"}),l.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"No cross-project rules. Agents can only communicate within their own namespace."}):i.jsx("div",{className:"space-y-1",children:l.map(d=>i.jsx(_we,{sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:d.action,onRemove:()=>r({sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:"deny"})},`${d.sourceNamespace}-${d.targetNamespace}`))})]}),c.length>=2&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Add Cross-Project Rule"}),i.jsx(Rwe,{namespaces:c,isPending:s,onAdd:(d,f)=>r({sourceNamespace:d,targetNamespace:f,action:"allow"})})]})]})}const oM={candidates:[],progress:null,isScanning:!1,error:null,lastScanAt:null},BC=X0()(BO(e=>({...oM,startScan:()=>e({candidates:[],progress:null,isScanning:!0,error:null},!1,"discovery/startScan"),addCandidate:t=>e(n=>({candidates:[...n.candidates,t]}),!1,"discovery/addCandidate"),setProgress:t=>e({progress:t},!1,"discovery/setProgress"),completeScan:t=>e({progress:t,isScanning:!1,lastScanAt:new Date().toISOString()},!1,"discovery/completeScan"),setError:t=>e({error:t,isScanning:!1},!1,"discovery/setError"),reset:()=>e(oM,!1,"discovery/reset")}),{name:"DiscoveryStore"}));function qz(){const e=Ve(),t=g.useRef(null),{startScan:n,addCandidate:r,setProgress:s,completeScan:a,setError:l}=BC(),c=g.useCallback((f={roots:[]})=>{var p;(p=t.current)==null||p.abort();const m=new AbortController;t.current=m,n(),e.scan(f,x=>{switch(x.type){case"candidate":r(x.data);break;case"progress":s(x.data);break;case"complete":a(x.data);break;case"error":l(x.data.error);break}},m.signal).catch(x=>{x instanceof Error&&x.name!=="AbortError"&&l(x.message)})},[e,n,r,s,a,l]),d=g.useCallback(()=>{var f;(f=t.current)==null||f.abort(),t.current=null},[]);return{startScan:c,stopScan:d}}const Mwe={manifest:"Found a .dork/agent.json manifest file in this directory.",heuristic:"Inferred from project file structure and naming conventions.","package.json":"Detected agent configuration inside package.json."};function Owe(e){return Mwe[e]??`Detected via "${e}" strategy.`}const Iwe={"code-review":"Reviews code for bugs, style issues, and correctness.",summarize:"Summarizes documents, conversations, or code.","file-ops":"Reads and writes files on the filesystem.",test:"Generates and runs tests for a codebase.",search:"Searches code, files, or the web for relevant information.",refactor:"Refactors code while preserving existing behavior.",analyze:"Analyzes data, logs, or codebases for patterns and insights.",generate:"Generates code, content, or structured output.",debug:"Diagnoses and fixes bugs in code.",deploy:"Manages deployment pipelines and infrastructure changes."};function Lwe(e){return Iwe[e]??"Agent capability detected from project structure."}function Gz({candidate:e,onApprove:t,onDeny:n,onSkip:r,className:s}){const{path:a,strategy:l,hints:c}=e;return i.jsxs(ve.div,{"data-slot":"candidate-card",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.15,ease:"easeOut"},className:oe("flex items-start justify-between rounded-xl border p-4",s),children:[i.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[i.jsx("p",{className:"text-sm font-semibold leading-tight",children:c.suggestedName||a.split("/").pop()||a}),i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx($u,{className:"size-3 shrink-0"}),i.jsx("span",{className:"truncate font-mono",children:a})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs(Cce,{openDelay:300,children:[i.jsx(Nce,{asChild:!0,children:i.jsx(sn,{variant:"secondary",className:"cursor-default text-xs hover:bg-secondary/80",children:c.detectedRuntime})}),i.jsxs(kce,{className:"w-56 space-y-1.5 p-3",side:"top",align:"start",children:[i.jsx("p",{className:"text-xs font-medium",children:"Detected runtime"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:Owe(l)})]})]}),c.inferredCapabilities&&c.inferredCapabilities.length>0&&c.inferredCapabilities.map(d=>i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsx(sn,{variant:"outline",className:"cursor-default text-[10px]",children:d})}),i.jsx(ks,{side:"top",className:"max-w-48 text-center",children:Lwe(d)})]},d))]})]}),i.jsxs("div",{className:"ml-4 flex shrink-0 items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>t(e),className:"rounded-md bg-green-600/10 px-2.5 py-1 text-xs font-medium text-green-700 hover:bg-green-600/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 dark:text-green-400",children:"Approve"}),r&&i.jsx("button",{type:"button",onClick:()=>r(e),className:"rounded-md px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Skip"}),n&&i.jsx("button",{type:"button",onClick:()=>n(e),className:"rounded-md bg-red-600/10 px-2.5 py-1 text-xs font-medium text-red-700 hover:bg-red-600/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 dark:text-red-400",children:"Deny"})]})]})}function Pwe({roots:e,onChange:t}){const[n,r]=g.useState(""),[s,a]=g.useState(!1),l=g.useCallback(m=>{const p=m.trim();p&&!e.includes(p)&&t([...e,p])},[e,t]),c=g.useCallback(m=>{t(e.filter(p=>p!==m))},[e,t]),d=g.useCallback(m=>{(m.key==="Enter"||m.key===",")&&(m.preventDefault(),n.trim()&&(l(n),r(""))),m.key==="Backspace"&&n===""&&e.length>0&&c(e[e.length-1])},[n,e,l,c]),f=g.useCallback(m=>{l(m)},[l]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-h-[40px] flex-wrap items-center gap-1.5 rounded-md border bg-transparent px-3 py-1.5 focus-within:ring-2 focus-within:ring-ring",children:[e.map(m=>i.jsxs(sn,{variant:"secondary",className:"gap-1 py-0.5 font-mono text-xs",children:[m,i.jsx("button",{type:"button",onClick:()=>c(m),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20","aria-label":`Remove ${m}`,children:i.jsx(wr,{className:"size-3"})})]},m)),i.jsx("input",{type:"text",value:n,onChange:m=>r(m.target.value),onKeyDown:d,placeholder:e.length===0?"Add paths to scan (Enter to add)":"Add more...",className:"min-w-[120px] flex-1 bg-transparent text-sm placeholder:text-muted-foreground focus-visible:outline-none"}),i.jsx("button",{type:"button",onClick:()=>a(!0),className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":"Browse for directory",children:i.jsx(Ii,{className:"size-4"})})]}),i.jsx(qx,{open:s,onOpenChange:a,onSelect:f})]})}const Bwe=[{name:"claude-code",signal:"CLAUDE.md",label:"Claude Code project"},{name:"cursor",signal:".cursor/",label:"Cursor project"},{name:"codex",signal:".codex/",label:"Codex project"},{name:"dork",signal:".dork/agent.json",label:"DorkOS agent (auto-imported)"}];function lM({fullBleed:e=!1}){const{roots:t,setScanRoots:n}=FTe(),[r,s]=g.useState(null),[a,l]=g.useState(!1),[c,d]=g.useState(3),{startScan:f}=qz(),{candidates:m,isScanning:p}=BC(),{mutate:x}=Oz(),{mutate:b}=kTe(),{data:v}=Gi(),E=r??t;function w(_){s(_),n(_)}function S(){E.length>0&&f({roots:E,maxDepth:c})}const[N,A]=g.useState(new Set),j=m.filter(_=>!N.has(_.path));function R(_){A(D=>new Set([...D,_]))}return i.jsxs("div",{className:e?"flex h-full flex-col p-6":"space-y-4 p-4",children:[e&&i.jsxs("div",{className:"mb-4 space-y-1",children:[i.jsx("h2",{className:"text-lg font-semibold",children:"Discover Agents"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Scan directories to find agents on your computer."})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>l(!a),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[i.jsx(Ss,{className:`size-3 transition-transform ${a?"":"-rotate-90"}`}),"Advanced"]}),a&&i.jsxs("div",{className:"mt-2 space-y-3 rounded-lg border bg-muted/30 p-3",children:[i.jsx(Pwe,{roots:E,onChange:w}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("label",{htmlFor:"scan-depth",className:"text-xs text-muted-foreground",children:"Scan depth"}),i.jsx("input",{id:"scan-depth",type:"range",min:1,max:5,value:c,onChange:_=>d(Number(_.target.value)),className:"flex-1"}),i.jsx("span",{className:"min-w-[1.5rem] text-center text-xs font-medium",children:c})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("p",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(PJ,{className:"size-3"}),"Detection strategies"]}),i.jsx("ul",{className:"space-y-1 pl-4",children:Bwe.map(_=>i.jsxs("li",{className:"flex items-baseline gap-1.5",children:[i.jsx("code",{className:"text-[10px] text-foreground/70",children:_.signal}),i.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["→ ",_.label]})]},_.name))})]})]})]}),i.jsxs("button",{type:"button",onClick:S,disabled:p||E.length===0,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:[p?i.jsx(Gn,{className:"size-4 animate-spin"}):i.jsx(lc,{className:"size-4"}),"Scan for Agents"]})]}),i.jsxs("div",{className:e?"mt-4 flex-1 overflow-y-auto":"",children:[p&&i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})}),!p&&j&&j.length===0&&(()=>{var D;const _=(((D=v==null?void 0:v.agents)==null?void 0:D.length)??0)>0;return i.jsxs("div",{className:"rounded-xl border border-dashed p-8 text-center",children:[i.jsx("p",{className:"text-sm font-medium",children:_?"No new agents found":"No agents found"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:_?"All discovered agents are already registered. Check the Agents tab to see them.":"Try scanning deeper directories or adding different paths."})]})})(),!p&&j&&j.length>0&&i.jsx(Ze,{mode:"popLayout",children:j.map(_=>i.jsx(Gz,{candidate:_,className:"mb-2",onApprove:D=>x({path:D.path,overrides:{name:D.hints.suggestedName,runtime:D.hints.detectedRuntime,...D.hints.inferredCapabilities?{capabilities:D.hints.inferredCapabilities}:{},...D.hints.description?{description:D.hints.description}:{}}},{onSuccess:()=>R(D.path)}),onDeny:D=>b({path:D.path},{onSuccess:()=>R(D.path)})},_.path))})]})]})}const Fwe=g.lazy(()=>W0(()=>import("./TopologyGraph-D5wrT_gg.js"),__vite__mapDeps([0,1])).then(e=>({default:e.TopologyGraph})));function zwe({agents:e,isLoading:t,onGoToDiscovery:n}){return t?i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})}):e.length===0?i.jsx(PC,{icon:pee,headline:"No agents registered yet",description:"Discover agents in your filesystem and register them to the mesh.",action:{label:"Go to Discovery",onClick:n}}):i.jsx("div",{className:"space-y-2 p-4",children:e.map(r=>i.jsx(Hwe,{agent:r},r.id))})}function Hwe({agent:e}){const{mutate:t}=ATe();return i.jsxs("div",{className:"space-y-1 rounded-xl border p-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"text-sm font-medium",children:e.name}),i.jsx(sn,{variant:"secondary",children:e.runtime})]}),i.jsx("button",{type:"button",onClick:()=>t(e.id),className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":`Unregister ${e.name}`,children:i.jsx(wr,{className:"size-3.5"})})]}),e.description&&i.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),e.capabilities.length>0&&i.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:e.capabilities.map(n=>i.jsx(sn,{variant:"outline",className:"text-xs",children:n},n))})]})}function Uwe({denied:e,isLoading:t}){return t?i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})}):e.length===0?i.jsx(PC,{icon:Dw,headline:"No blocked paths",description:"When you deny agent paths during discovery, they appear here. This is a healthy state."}):i.jsx("div",{className:"space-y-2 p-4",children:e.map(n=>i.jsxs("div",{className:"flex items-center justify-between rounded-xl border px-4 py-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-mono text-sm",children:n.path}),n.reason&&i.jsx("p",{className:"text-xs text-muted-foreground",children:n.reason})]}),i.jsx(sn,{variant:"outline",className:"text-xs",children:n.strategy})]},n.path))})}function $we(){const{data:e,isLoading:t,isError:n,refetch:r}=Gi(),s=(e==null?void 0:e.agents)??[],{data:a,isLoading:l}=_Te(),c=(a==null?void 0:a.denied)??[],[d,f]=g.useState(null),[m,p]=g.useState(""),[x,b]=g.useState("topology"),[v,E]=g.useState(""),[w,S]=g.useState(!1),[,N]=Cd(),A=g.useCallback(L=>{N(L)},[N]),j=g.useCallback((L,B)=>{f(L),p(B)},[]),R=g.useCallback((L,B)=>{E(B),S(!0)},[]),D=!(s.length>0)&&!t&&!n;if(n)return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[i.jsx("div",{className:"rounded-xl bg-destructive/10 p-3",children:i.jsx(Li,{className:"size-6 text-destructive"})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Could not load agents"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The mesh API is unreachable. Check that the server is running correctly."})]}),i.jsx("button",{type:"button",onClick:()=>void r(),className:"mt-1 inline-flex items-center rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90",children:"Retry"})]});const I=()=>b("discovery");return i.jsxs(i.Fragment,{children:[i.jsx(Ze,{mode:"wait",initial:!1,children:D?i.jsx(ve.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"flex h-full flex-col",children:i.jsx(lM,{fullBleed:!0})},"mode-a"):i.jsx(ve.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"flex h-full flex-col",children:i.jsxs(P2,{value:x,onValueChange:b,className:"flex h-full flex-col",children:[i.jsx(Nwe,{}),i.jsxs(B2,{className:"mx-4 mt-3 shrink-0",children:[i.jsx(ko,{value:"topology",children:"Topology"}),i.jsx(ko,{value:"discovery",children:"Discovery"}),i.jsx(ko,{value:"agents",children:"Agents"}),i.jsx(ko,{value:"denied",children:"Denied"}),i.jsx(ko,{value:"access",children:"Access"})]}),i.jsxs(Ai,{value:"topology",className:"relative flex-1 overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0",children:i.jsx(g.Suspense,{fallback:i.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Loading topology..."}),children:i.jsx(Fwe,{onSelectAgent:j,onOpenSettings:R,onOpenChat:A})})}),i.jsx(Ze,{children:d&&i.jsx(ve.div,{initial:{x:64,opacity:0},animate:{x:0,opacity:1},exit:{x:64,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"absolute right-0 top-0 bottom-0",children:i.jsx(Awe,{agentId:d,onClose:()=>f(null),onOpenSettings:m?()=>R(d,m):void 0})},d)})]}),i.jsx(Ai,{value:"discovery",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(lM,{})}),i.jsx(Ai,{value:"agents",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(zwe,{agents:s,isLoading:t,onGoToDiscovery:I})}),i.jsx(Ai,{value:"denied",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(Uwe,{denied:c,isLoading:l})}),i.jsx(Ai,{value:"access",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(Dwe,{onGoToDiscovery:I})})]})},"mode-b")}),v&&i.jsx($z,{projectPath:v,open:w,onOpenChange:S})]})}const cM=["config"],Vwe=["discovery","pulse","adapters"];function zp(){const e=Ve(),t=Yt(),n=g.useRef(new Set),r=g.useRef(new Set),{data:s,isLoading:a}=Tt({queryKey:[...cM],queryFn:()=>e.getConfig(),staleTime:300*1e3}),l={completedSteps:[],skippedSteps:[],startedAt:null,dismissedAt:null},c=s!=null&&s.onboarding?{completedSteps:s.onboarding.completedSteps,skippedSteps:s.onboarding.skippedSteps,startedAt:s.onboarding.startedAt,dismissedAt:s.onboarding.dismissedAt}:l,d=Vwe.every(w=>c.completedSteps.includes(w)),f=c.dismissedAt!==null,m=!a&&!d&&!f,p=Sn({mutationFn:w=>e.updateConfig({onboarding:w}),onSuccess:()=>{t.invalidateQueries({queryKey:[...cM]}).then(()=>{n.current.clear(),r.current.clear()})},onError:(w,S)=>{n.current.clear(),r.current.clear();const N=Object.keys(S).join(", ");Dn.error(`Failed to save onboarding progress (${N})`)}});function x(w){const S=new Set([...c.completedSteps,...n.current]);S.has(w)||(n.current.add(w),p.mutate({completedSteps:[...S,w]}))}function b(w){const S=new Set([...c.skippedSteps,...r.current]);S.has(w)||(r.current.add(w),p.mutate({skippedSteps:[...S,w]}))}function v(){return p.mutateAsync({dismissedAt:new Date().toISOString()})}function E(){c.startedAt||p.mutate({startedAt:new Date().toISOString()})}return{state:c,isLoading:a,isOnboardingComplete:d,isOnboardingDismissed:f,shouldShowOnboarding:m,completeStep:x,skipStep:b,dismiss:v,startOnboarding:E}}const qwe={default:"#1A1A1A",white:"#FFFFFF",orange:"#CE2021",current:"currentColor"};function hS({variant:e="default",size:t=40,className:n,style:r}){const s=qwe[e],a=t*(799/2325);return i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:a,viewBox:"0 0 2325 799",fill:"none",className:n,style:r,"aria-hidden":"true",children:[i.jsx("rect",{x:"50",y:"50",width:"2225",height:"699",stroke:s,strokeWidth:"100"}),i.jsx("path",{d:"M492.333 199.627L599.833 295.627L600 295.776V491.707L492.207 599.5H199.5V199.5H492.19L492.333 199.627ZM334 347.5V448.5H435V347.5H334Z",fill:s}),i.jsx("path",{d:"M1108.5 497.715L1108.34 497.862L1001.34 599.362L1001.2 599.5H699V296.283L699.158 296.135L802.158 199.635L802.303 199.5H1108.5V497.715ZM855 347.5V448.5H956V347.5H855Z",fill:s}),i.jsx("path",{d:"M1616.94 200.24L1510.07 395.005L1616.94 598.768L1617.64 600.103L1616.28 599.451L1409 500.056L1208.22 599.448L1207.5 599.806V199.5H1617.34L1616.94 200.24ZM1332 337.5V439.207L1433.71 337.5H1332Z",fill:s}),i.jsx("path",{d:"M1716.5 599V200L1841 291.5L2125 200L2017.5 400L2125 599L1841 501L1716.5 599Z",fill:s,stroke:s})]})}const uE=["Welcome","to","DorkOS"],Gwe=[{icon:lc,label:"Discover agents"},{icon:oc,label:"Schedule tasks"},{icon:Rw,label:"Connect channels"}];function Ywe({onGetStarted:e,onSkip:t}){const n=ic();return i.jsxs("div",{className:"mx-auto flex w-full max-w-md flex-col items-center px-4 text-center",children:[i.jsxs(ve.div,{className:"mb-6 opacity-80",initial:n?!1:{opacity:0,scale:.8},animate:{opacity:.8,scale:1},transition:{duration:.4},children:[i.jsx(hS,{size:150,className:"dark:hidden"}),i.jsx(hS,{variant:"white",size:150,className:"hidden dark:block"})]}),i.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:n?uE.join(" "):i.jsx(ve.span,{initial:"hidden",animate:"visible",variants:{visible:{transition:{staggerChildren:.08}}},children:uE.map((r,s)=>i.jsxs(ve.span,{className:"inline-block",variants:{hidden:{opacity:0,filter:"blur(4px)"},visible:{opacity:1,filter:"blur(0px)"}},transition:{duration:.4},children:[r,s<uE.length-1?" ":""]},s))})}),i.jsx(ve.p,{className:"mt-4 text-muted-foreground",initial:n?!1:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.5},children:"Let’s set up your AI agent workspace."}),i.jsx(ve.div,{className:"mt-10 flex gap-8",initial:n?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.6,duration:.4},children:Gwe.map(({icon:r,label:s},a)=>i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-muted",children:i.jsx(r,{className:"size-5 text-muted-foreground"})}),i.jsx("span",{className:"text-xs text-muted-foreground",children:s})]},a))}),i.jsxs(ve.div,{className:"mt-12 flex flex-col items-center gap-3",initial:n?!1:{opacity:0},animate:{opacity:1},transition:{delay:.8,duration:.4},children:[i.jsx(bB,{className:"px-6 py-2",duration:1.2,onClick:e,children:"Get Started"}),i.jsx("button",{onClick:t,className:"text-sm text-muted-foreground transition-colors hover:text-foreground",children:"Skip setup"})]})]})}function Kwe({onAgentCreated:e}){var b;const[t,n]=g.useState(""),[r,s]=g.useState(""),[a,l]=g.useState(""),[c,d]=g.useState(!1),[f,m]=g.useState(!1),p=$G(),x=g.useCallback(()=>{!t||!r.trim()||p.mutate({path:t,name:r.trim(),description:a.trim()||void 0},{onSuccess:()=>{m(!0),setTimeout(e,1200)}})},[t,r,a,p,e]);return f?i.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 py-12 text-center",children:[i.jsx(fp,{className:"text-primary size-12"}),i.jsx("h3",{className:"text-lg font-semibold",children:"Agent created"}),i.jsxs("p",{className:"text-muted-foreground text-sm",children:[i.jsx("span",{className:"font-medium",children:r})," is ready at"," ",i.jsx("span",{className:"font-mono text-xs",children:Mi(t)})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center space-y-6 py-8",children:[i.jsxs("div",{className:"space-y-2 text-center",children:[i.jsx("div",{className:"bg-muted mx-auto flex size-12 items-center justify-center rounded-full",children:i.jsx(uI,{className:"text-muted-foreground size-6"})}),i.jsx("h3",{className:"text-lg font-semibold",children:"No agents found"}),i.jsx("p",{className:"text-muted-foreground mx-auto max-w-sm text-sm",children:"Agents give your projects an identity. Each agent lives in a project directory and can have its own name, persona, and scheduled tasks."})]}),i.jsxs("div",{className:"w-full max-w-sm space-y-4",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Lt,{htmlFor:"agent-directory",children:"Project directory"}),i.jsxs("button",{id:"agent-directory",type:"button",onClick:()=>d(!0),className:`border-input bg-background hover:bg-accent flex h-10 w-full items-center gap-2 rounded-md border px-3 text-sm transition-colors ${t?"text-foreground":"text-muted-foreground"}`,children:[i.jsx(Ii,{className:"size-4 flex-shrink-0"}),i.jsx("span",{className:"truncate",children:t?Mi(t):"Select a directory..."})]}),i.jsx(qx,{open:c,onOpenChange:d,onSelect:n})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Lt,{htmlFor:"agent-name",children:"Agent name"}),i.jsx(ts,{id:"agent-name",type:"text",placeholder:"e.g. my-project",value:r,onChange:v=>s(v.target.value)})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Lt,{htmlFor:"agent-persona",children:["Persona ",i.jsx("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),i.jsx(F2,{id:"agent-persona",placeholder:"Describe what this agent does...",value:a,onChange:v=>l(v.target.value),rows:3})]}),i.jsx(tt,{className:"w-full",onClick:x,disabled:!t||!r.trim()||p.isPending,children:p.isPending?i.jsxs(i.Fragment,{children:[i.jsx(Gn,{className:"size-4 animate-spin"}),"Creating..."]}):"Create agent"}),p.isError&&i.jsxs("p",{className:"text-destructive text-center text-sm",children:["Failed to create agent. ",((b=p.error)==null?void 0:b.message)??"Please try again."]})]})]})}function Wwe(e){return[...e].sort((t,n)=>{const r=t.strategy==="dork-manifest",s=n.strategy==="dork-manifest";return r!==s?r?-1:1:t.path.localeCompare(n.path)})}function Xwe({onStepComplete:e}){const{startScan:t}=qz(),{candidates:n,isScanning:r,progress:s,error:a}=BC(),l=Oz(),[c,d]=g.useState(new Set),[f,m]=g.useState(!1),p=ic(),x=g.useRef(!1);g.useEffect(()=>{x.current||(x.current=!0,m(!0),t())},[t]);const b=g.useMemo(()=>r?n:Wwe(n),[n,r]),v=g.useCallback(I=>{d(L=>new Set(L).add(I))},[]),E=g.useCallback(I=>{v(I.path),l.mutate({path:I.path,overrides:{name:I.hints.suggestedName,runtime:I.hints.detectedRuntime,...I.hints.inferredCapabilities?{capabilities:I.hints.inferredCapabilities}:{},...I.hints.description?{description:I.hints.description}:{}}})},[l,v]),w=g.useCallback(I=>{v(I.path)},[v]),S=g.useCallback(()=>{d(new Set),m(!0),t()},[t]),N=g.useCallback(()=>{S()},[S]),A=n.length>0,j=f&&!r,R=j&&!A,_=A&&n.every(I=>c.has(I.path)),D=b.filter(I=>!c.has(I.path));return i.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center",children:[i.jsxs("div",{className:"w-full shrink-0 text-center",children:[i.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:r&&!A?"Searching your projects...":"Discovered Agents"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"We’ll find AI-configured projects on your machine."})]}),r&&!A&&i.jsxs("div",{className:"mt-8 flex shrink-0 flex-col items-center gap-4",children:[i.jsx(ve.div,{animate:p?{}:{scale:[1,1.15,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"},children:i.jsx(lc,{className:"size-8 text-muted-foreground"})}),s&&i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Scanned ",s.scannedDirs," directories"]})]}),r&&A&&s&&i.jsxs("div",{className:"mt-4 shrink-0 text-center text-sm text-muted-foreground",children:["Scanning... ",s.scannedDirs," directories · Found ",s.foundAgents," agent",s.foundAgents===1?"":"s"]}),j&&A&&i.jsxs("p",{className:"mt-4 shrink-0 text-center text-sm text-muted-foreground",children:["Found ",n.length," project",n.length===1?"":"s",". Approve or skip each one."]}),a&&i.jsx("div",{className:"mt-6 shrink-0 rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:a}),A&&i.jsx("div",{className:"mt-4 min-h-0 w-full flex-1 overflow-y-auto pr-1",children:i.jsx("div",{className:"space-y-3",children:i.jsx(Ze,{mode:"popLayout",children:D.map(I=>i.jsx(Gz,{candidate:I,onApprove:E,onSkip:w},I.path))})})}),R&&i.jsxs("div",{className:"mt-8 w-full",children:[i.jsx(Kwe,{onAgentCreated:N}),i.jsx("div",{className:"mt-4 flex justify-center",children:i.jsx(tt,{variant:"outline",onClick:S,children:"Scan Again"})})]}),j&&A&&i.jsx("div",{className:"mt-4 flex shrink-0 flex-col items-center gap-2 border-t pt-4",children:i.jsx(tt,{size:"lg",onClick:e,variant:_?"default":"outline",children:"Continue"})})]})}function Qwe({onStepComplete:e,agents:t}){const{data:n,isLoading:r,isError:s}=$S(),a=b4(),[l,c]=g.useState(null),[d,f]=g.useState(!1),[m,p]=g.useState(null),x=t.length===1?t[0]:t.find(N=>N.id===m)??null,b=g.useMemo(()=>l??new Set((n==null?void 0:n.map(N=>N.id))??[]),[l,n]),v=g.useCallback(N=>{c(A=>{const j=A??new Set((n==null?void 0:n.map(_=>_.id))??[]),R=new Set(j);return R.has(N)?R.delete(N):R.add(N),R})},[n]),E=b.size,w=E>0&&x!==null,S=g.useCallback(async()=>{if(!n||E===0||!x){e();return}f(!0);const N=n.filter(R=>b.has(R.id)),j=(await Promise.allSettled(N.map(R=>a.mutateAsync({name:R.name,prompt:R.prompt,cron:R.cron,cwd:x.projectPath})))).filter(R=>R.status==="rejected");j.length>0&&(console.error("[PulsePresetsStep] Schedule creation failures:",j),Dn.warning(`${j.length} of ${N.length} schedule(s) failed to create. You can retry from Pulse later.`)),f(!1),e()},[n,E,b,x,a,e]);return i.jsxs("div",{className:"mx-auto w-full max-w-2xl flex-1 space-y-4 overflow-y-auto px-4",children:[i.jsxs("div",{className:"space-y-2 text-center",children:[i.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Want your agents to work while you sleep?"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Pulse runs automated tasks on a schedule — like a cron job for your agents."})]}),t.length===1&&i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Scheduling for ",t[0].icon?`${t[0].icon} `:"",t[0].name]}),t.length>=2&&i.jsx("div",{className:"mx-auto max-w-xs",children:i.jsxs(On,{value:m??"",onValueChange:p,children:[i.jsx(An,{children:i.jsx(In,{placeholder:"Select a project..."})}),i.jsx(jn,{children:t.map(N=>i.jsxs(ft,{value:N.id,children:[N.icon?`${N.icon} `:"",N.name]},N.id))})]})}),r&&i.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Loading presets..."}),s&&i.jsx("p",{className:"text-center text-sm text-destructive",children:"Failed to load presets. You can skip this step and configure schedules later."}),n&&n.length>0&&i.jsx("div",{className:"grid gap-3",children:n.map(N=>i.jsx(Fz,{preset:N,variant:"toggle",checked:b.has(N.id),onCheckedChange:()=>v(N.id)},N.id))}),i.jsxs("div",{className:"flex flex-col items-center gap-3 pt-2",children:[i.jsx(tt,{onClick:S,size:"lg",disabled:d||E>0&&!w,children:d?"Creating...":E>0?`Create ${E} Schedule${E===1?"":"s"}`:"Continue Without Schedules"}),t.length>=2&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"You can put your other agents on autopilot anytime from Pulse."})]})]})}const dE=["You're","all","set!"];function Zwe({onComplete:e}){const t=ic(),{state:n}=zp(),r=g.useRef(!1);g.useEffect(()=>{r.current||(r.current=!0,r4())},[]);const s=n.completedSteps.includes("discovery"),a=n.completedSteps.includes("pulse"),l=[{icon:NI,label:s?"Agents discovered":"Agents skipped",done:s},{icon:oc,label:a?"Schedules created":"Schedules skipped",done:a},{icon:Rw,label:"Adapters: coming soon",done:!1}];return i.jsxs(ve.div,{initial:t?!1:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.3,ease:"easeOut"},className:"mx-auto flex w-full max-w-md flex-col items-center gap-8 px-4 text-center",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h2",{className:"text-3xl font-semibold tracking-tight",children:t?dE.join(" "):i.jsx(ve.span,{initial:"hidden",animate:"visible",variants:{visible:{transition:{staggerChildren:.08}}},children:dE.map((c,d)=>i.jsxs(ve.span,{className:"inline-block",variants:{hidden:{opacity:0,filter:"blur(4px)"},visible:{opacity:1,filter:"blur(0px)"}},transition:{duration:.4},children:[c,d<dE.length-1?" ":""]},d))})}),i.jsx("p",{className:"text-muted-foreground",children:"Your workspace is configured and ready."})]}),i.jsx(ve.div,{className:"w-full space-y-3",initial:"hidden",animate:"visible",variants:t?{}:{visible:{transition:{staggerChildren:.12,delayChildren:.3}}},children:l.map(({icon:c,label:d,done:f})=>i.jsxs(ve.div,{variants:t?{}:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0}},transition:{duration:.3},className:"flex items-center gap-3 rounded-lg border p-4",children:[i.jsx(c,{className:`size-5 ${f?"text-primary":"text-muted-foreground/50"}`}),i.jsx("span",{className:f?"text-sm":"text-sm text-muted-foreground",children:d})]},d))}),i.jsx(ve.div,{initial:t?!1:{opacity:0},animate:{opacity:1},transition:{delay:.8,duration:.4},children:i.jsx(bB,{className:"px-6 py-2",duration:1.2,onClick:e,children:"Start your first session"})})]})}const Og=["discovery","pulse"];function Yz({onComplete:e,initialStep:t=-1}){var D;const[n,r]=g.useState(t),[s,a]=g.useState(1),[l,c]=g.useState(!1),{completeStep:d,skipStep:f,dismiss:m,startOnboarding:p}=zp(),x=Hi(),b=ic(),v=DC();g.useEffect(()=>{p()},[]);const E=g.useCallback(()=>{n<Og.length-1?(a(1),r(I=>I+1)):(d("adapters"),c(!0))},[n,d]),w=g.useCallback(()=>{n>0?(a(-1),r(I=>I-1)):n===0&&(a(-1),r(-1))},[n]),S=g.useCallback(()=>{d(Og[n]),E()},[n,d,E]),N=g.useCallback(()=>{f(Og[n]),E()},[n,f,E]),A=g.useCallback(async()=>{await m(),e()},[m,e]),j=g.useCallback(()=>{a(1),r(0)},[]);if(g.useEffect(()=>{var I;n===1&&!v.isLoading&&((I=v.data)==null?void 0:I.agents.length)===0&&(d("pulse"),E())},[n,v.isLoading,v.data,d,E]),l)return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background",children:i.jsx(Zwe,{onComplete:e})});if(n===-1)return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background",children:i.jsx(Ywe,{onGetStarted:j,onSkip:A})});const R=x?150:300,_=b?{enter:{opacity:0},center:{opacity:1},exit:{opacity:0}}:{enter:I=>({x:I>0?R:-R,opacity:0,scale:.98,filter:"blur(2px)"}),center:{x:0,opacity:1,scale:1,filter:"blur(0px)"},exit:I=>({x:I>0?-R:R,opacity:0,scale:.98,filter:"blur(2px)"})};return i.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-background",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 sm:px-6",children:[i.jsx(tt,{variant:"ghost",size:"sm",onClick:w,className:"min-w-16",children:"Back"}),i.jsx("div",{className:"flex items-center gap-2",children:Og.map((I,L)=>i.jsx("div",{className:"relative flex items-center justify-center",children:L===n?i.jsx(ve.div,{layoutId:"step-indicator",className:"flex h-2 w-6 items-center justify-center rounded-full bg-primary",transition:{type:"spring",damping:25,stiffness:200}}):L<n?i.jsx("div",{className:"flex size-2 items-center justify-center rounded-full bg-primary/60",children:i.jsx(Tn,{className:"size-1.5 text-primary-foreground"})}):i.jsx("div",{className:oe("size-2 rounded-full ring-1 ring-muted-foreground/30")})},L))}),i.jsxs("div",{className:"flex min-w-16 items-center justify-end gap-1",children:[i.jsx(tt,{variant:"ghost",size:"sm",onClick:N,children:"Skip"}),i.jsx(tt,{variant:"ghost",size:"sm",onClick:A,className:"text-muted-foreground",children:"Skip all"})]})]}),i.jsx("div",{className:"relative flex-1 overflow-hidden",children:i.jsx(Ze,{mode:"wait",custom:s,children:i.jsx(ve.div,{custom:s,variants:_,initial:"enter",animate:"center",exit:"exit",transition:{type:b?"tween":"spring",damping:25,stiffness:200,duration:b?.15:void 0},className:"absolute inset-0 flex flex-col",children:i.jsxs("div",{className:"mx-auto flex min-h-0 w-full max-w-2xl flex-1 flex-col px-4 py-4 sm:px-6",children:[n===0&&i.jsx(Xwe,{onStepComplete:S}),n===1&&i.jsx(Qwe,{onStepComplete:S,agents:((D=v.data)==null?void 0:D.agents)??[]})]})},n)})})]})}const fE={discovery:"Discover agents",pulse:"Set up Pulse schedules",adapters:"Connect adapters"},Jwe=["discovery","pulse"];function e2e({onStepClick:e,onDismiss:t}){const{state:n}=zp(),r=ic();return i.jsxs(ve.div,{initial:r?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3},className:"border-border bg-card relative rounded-lg border p-3",children:[i.jsx("button",{onClick:t,className:"text-muted-foreground/50 hover:text-muted-foreground absolute right-1.5 top-1.5 rounded-md p-0.5 transition-colors duration-150","aria-label":"Dismiss getting started",children:i.jsx(wr,{className:"size-3.5"})}),i.jsx("h3",{className:"text-xs font-medium mb-2",children:"Getting Started"}),i.jsx("ul",{className:"space-y-1",children:Jwe.map((s,a)=>{const l=n.completedSteps.includes(s),c=n.skippedSteps.includes(s);return l?i.jsxs("li",{className:"flex items-center gap-2 py-0.5",children:[i.jsx(Tn,{className:"text-primary size-3.5 shrink-0"}),i.jsx("span",{className:"text-muted-foreground text-xs",children:fE[s]})]},s):c?i.jsxs("li",{className:"flex items-center gap-2 py-0.5",children:[i.jsx(cee,{className:"text-muted-foreground/40 size-3.5 shrink-0"}),i.jsx("button",{onClick:()=>e(a),className:oe("text-muted-foreground/40 text-xs text-left transition-colors duration-150","hover:text-muted-foreground"),children:fE[s]})]},s):i.jsxs("li",{className:"flex items-center gap-2 py-0.5",children:[i.jsx(Cw,{className:"text-muted-foreground size-3.5 shrink-0"}),i.jsx("button",{onClick:()=>e(a),className:"text-foreground text-xs text-left transition-colors duration-150 hover:underline",children:fE[s]})]},s)})})]})}function t2e(){const{settingsOpen:e,setSettingsOpen:t,pulseOpen:n,setPulseOpen:r,relayOpen:s,setRelayOpen:a,meshOpen:l,setMeshOpen:c,pickerOpen:d,setPickerOpen:f,agentDialogOpen:m,setAgentDialogOpen:p,onboardingStep:x,setOnboardingStep:b,recentCwds:v}=He(),[E,w]=Cd(),S=g.useMemo(()=>v.map(A=>A.path),[v]),{data:N}=d4(S);return i.jsxs(i.Fragment,{children:[i.jsx(mTe,{open:e,onOpenChange:t}),i.jsx(qx,{open:d,onOpenChange:f,onSelect:A=>w(A),initialPath:E,resolvedAgents:N}),i.jsx(ys,{open:n,onOpenChange:r,children:i.jsxs(vs,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[i.jsx(Yu,{}),i.jsxs($a,{className:"border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Pulse Scheduler"}),i.jsx(Zs,{className:"sr-only",children:"Manage scheduled AI agent tasks"})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i.jsx(pSe,{})})]})}),i.jsx(ys,{open:s,onOpenChange:a,children:i.jsxs(vs,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[i.jsx(Yu,{}),i.jsxs($a,{className:"border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Connections"}),i.jsx(Zs,{className:"sr-only",children:"Manage adapters and monitor message activity"})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i.jsx(xwe,{})})]})}),i.jsx(ys,{open:l,onOpenChange:c,children:i.jsxs(vs,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[i.jsx(Yu,{}),i.jsxs($a,{className:"border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Mesh"}),i.jsx(Zs,{className:"sr-only",children:"Agent discovery and registry"})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i.jsx($we,{})})]})}),E&&i.jsx($z,{projectPath:E,open:m,onOpenChange:p}),x!==null&&i.jsx("div",{className:"fixed inset-0 z-50 bg-background",children:i.jsx(Yz,{initialStep:x,onComplete:()=>b(null)})})]})}const hE=["light","dark","system"],n2e={light:Kee,dark:xI,system:dee};function r2e(){const{setSettingsOpen:e,setAgentDialogOpen:t,devtoolsOpen:n,toggleDevtools:r}=He(),{theme:s,setTheme:a}=J0(),l=n2e[s],c=g.useCallback(()=>{const d=hE.indexOf(s);a(hE[(d+1)%hE.length])},[s,a]);return i.jsxs("div",{className:"border-border flex items-center border-t px-2 py-1.5",children:[i.jsx("a",{href:"https://dorkos.ai",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors duration-150",children:i.jsx(hS,{variant:"current",size:60})}),i.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[i.jsx("button",{onClick:()=>t(!0),className:"text-muted-foreground/50 hover:text-muted-foreground rounded-md p-1 transition-colors duration-150","aria-label":"Edit agent",children:i.jsx(yI,{className:"size-(--size-icon-sm)"})}),i.jsx("button",{onClick:()=>e(!0),className:"text-muted-foreground/50 hover:text-muted-foreground rounded-md p-1 transition-colors duration-150","aria-label":"Settings",children:i.jsx(cx,{className:"size-(--size-icon-sm)"})}),i.jsx("button",{onClick:c,className:"text-muted-foreground/50 hover:text-muted-foreground rounded-md p-1 transition-colors duration-150","aria-label":`Theme: ${s}. Click to cycle.`,title:`Theme: ${s}`,children:i.jsx(l,{className:"size-(--size-icon-sm)"})}),!1]})]})}const s2e=[{id:"sessions",icon:_w,label:"Sessions",shortcut:1},{id:"schedules",icon:oc,label:"Schedules",shortcut:2},{id:"connections",icon:EI,label:"Connections",shortcut:3}],a2e={ok:"bg-green-500",partial:"bg-amber-500",error:"bg-red-500"};function i2e({activeTab:e,onTabChange:t,schedulesBadge:n,connectionsStatus:r,visibleTabs:s}){const a=g.useRef(null),l=Sd?"⌘":"Ctrl+",c=g.useCallback(f=>{var x,b;const m=s.indexOf(e);let p=m;if(f.key==="ArrowRight"?(p=(m+1)%s.length,f.preventDefault()):f.key==="ArrowLeft"&&(p=(m-1+s.length)%s.length,f.preventDefault()),p!==m){t(s[p]);const v=(x=a.current)==null?void 0:x.querySelectorAll('[role="tab"]');(b=v==null?void 0:v[p])==null||b.focus()}},[e,t,s]),d=s2e.filter(f=>s.includes(f.id));return i.jsx("div",{ref:a,role:"tablist","aria-label":"Sidebar views",tabIndex:-1,className:"border-border relative flex items-center gap-1 border-b px-2 py-1.5",onKeyDown:c,children:d.map(f=>{const m=e===f.id,p=f.icon;return i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsxs("button",{role:"tab",id:`sidebar-tab-${f.id}`,"aria-selected":m,"aria-controls":`sidebar-tabpanel-${f.id}`,tabIndex:m?0:-1,onClick:()=>t(f.id),className:oe("relative rounded-md p-2 transition-colors duration-150",m?"text-foreground":"text-muted-foreground/50 hover:text-muted-foreground"),children:[i.jsx(p,{className:"size-(--size-icon-sm)"}),f.id==="schedules"&&n>0&&i.jsxs("span",{className:"absolute -right-0.5 -top-0.5 flex size-4 items-center justify-center rounded-full bg-green-500 text-[10px] font-medium text-white",children:[n>9?"9+":n,i.jsx("span",{className:"absolute inset-0 animate-pulse rounded-full bg-green-500/30"})]}),f.id==="connections"&&r!=="none"&&i.jsx("span",{className:oe("absolute -right-0.5 -top-0.5 size-1.5 rounded-full",a2e[r])}),m&&i.jsx(ve.div,{layoutId:"sidebar-tab-indicator",className:"bg-brand absolute right-0 bottom-[-7px] left-0 h-0.5 rounded-full",transition:{type:"spring",stiffness:280,damping:32}})]})}),i.jsxs(ks,{side:"bottom",children:[f.label," ",`${l}${f.shortcut}`]})]},f.id)})})}function uM(e){try{return new Date(e).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function o2e({text:e,label:t}){const[n,r]=g.useState(!1),s=g.useCallback(async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),Ts.COPY_FEEDBACK_MS)}catch{}},[e]);return i.jsx("button",{onClick:s,className:"hover:bg-secondary/80 text-muted-foreground/60 hover:text-muted-foreground rounded p-0.5 transition-colors duration-100 max-md:p-2","aria-label":`Copy ${t}`,children:n?i.jsx(Tn,{className:"size-(--size-icon-xs) text-green-500"}):i.jsx(Nw,{className:"size-(--size-icon-xs)"})})}function l2e({session:e,isActive:t,onClick:n,isNew:r=!1}){const[s,a]=g.useState(!1),l=e.permissionMode==="bypassPermissions",c=r?ve.div:"div",d=r?{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.2,ease:[0,0,.2,1]}}:{};function f(m){m.stopPropagation(),a(p=>!p)}return i.jsxs(c,{...d,"data-testid":"session-item",className:oe("group relative rounded-lg transition-colors duration-150",t?"text-foreground border-primary border-l-2":"border-l-2 border-transparent"),children:[t&&i.jsx(ve.div,{layoutId:"active-session-bg",className:"absolute inset-0 rounded-lg bg-secondary",transition:{type:"spring",stiffness:280,damping:32}}),i.jsxs(ve.div,{role:"button",tabIndex:0,onClick:()=>{n()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n())},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:30},className:"relative z-10 cursor-pointer px-3 py-2",children:[i.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"min-w-0 flex-1",children:Ih(e.updatedAt)}),i.jsxs("span",{className:"flex flex-shrink-0 items-center gap-1",children:[l&&i.jsx(wI,{className:"size-(--size-icon-xs) text-red-500","aria-label":"Permissions skipped"}),i.jsx("button",{onClick:f,className:oe("rounded p-0.5 transition-all duration-150 max-md:hidden max-md:p-2",s?"text-muted-foreground opacity-100":"text-muted-foreground/60 hover:text-muted-foreground opacity-0 group-hover:opacity-100"),"aria-label":"Session details",children:i.jsx(ve.div,{animate:{rotate:s?180:0},transition:{type:"spring",stiffness:400,damping:30},children:i.jsx(Ss,{className:"size-(--size-icon-sm)"})})})]})]}),i.jsx("div",{className:"text-muted-foreground/70 mt-0.5 truncate text-xs",children:e.title})]}),i.jsx(Ze,{initial:!1,children:s&&i.jsx(ve.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:[0,0,.2,1]},className:"overflow-hidden",children:i.jsxs("div",{className:"text-muted-foreground border-border/30 mx-2 space-y-1.5 border-t px-3 pt-2 pb-2 text-[11px]",children:[i.jsx(Ig,{label:"Session ID",value:e.id,copyable:!0}),i.jsx(Ig,{label:"Created",value:uM(e.createdAt)}),i.jsx(Ig,{label:"Updated",value:uM(e.updatedAt)}),i.jsx(Ig,{label:"Permissions",value:l?"Skip (unsafe)":"Default"})]})})})]})}function Ig({label:e,value:t,copyable:n=!1}){return i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-muted-foreground/60 w-16 flex-shrink-0",children:e}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono select-all",children:t}),n&&i.jsx(o2e,{text:t,label:e})]})}function c2e({activeSessionId:e,groupedSessions:t,onSessionClick:n}){return i.jsx(Vx,{type:"scroll",className:"h-full",viewportClassName:"[&>div]:!block",children:i.jsx(ve.div,{layout:!0,children:t.length>0?i.jsx(i.Fragment,{children:t.map(r=>{const s=t.length===1&&r.label==="Today";return i.jsxs(Xu,{children:[!s&&i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:r.label}),i.jsx(La,{children:r.sessions.map(a=>i.jsx(Pa,{children:i.jsx(l2e,{session:a,isActive:a.id===e,onClick:()=>n(a.id)})},a.id))})]},r.label)})}):i.jsx("div",{className:"flex h-32 items-center justify-center",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No conversations yet"})})})})}function u2e({toolStatus:e,agentId:t}){const n=He(v=>v.setPulseOpen),r=He(v=>v.openPulseForAgent),s=He(v=>v.openPulseToEdit),a=e!=="disabled-by-server",{data:l=[]}=x4(a),{data:c=0}=US(a),{data:d=[]}=$S(),{openWithPreset:f}=VS(),m=[d[0],d[2]].filter(Boolean),p=t?l.filter(v=>v.agentId===t):l;if(e==="disabled-by-agent")return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 px-4 py-8",children:[i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Pulse disabled for this agent"}),i.jsx("button",{onClick:()=>t?r(t):n(!0),className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Pulse →"})]});if(p.length===0)return i.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[i.jsx("p",{className:"text-xs text-muted-foreground/70",children:"No schedules yet."}),m.length>0&&i.jsx("div",{className:"space-y-2",children:m.map(v=>i.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[i.jsx("div",{className:"font-medium",children:v.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:Bz(v.cron)}),i.jsx("button",{type:"button",onClick:()=>{f(v),t?r(t):n(!0)},className:"mt-2 text-xs text-primary hover:underline",children:"+ Use preset"})]},v.id))}),i.jsx("button",{onClick:()=>t?r(t):n(!0),className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Pulse →"})]});const x=p.filter(v=>v.enabled&&v.status==="active"),b=p.filter(v=>!v.enabled||v.status!=="active");return i.jsx(Vx,{type:"scroll",className:"h-full",children:i.jsxs("div",{className:"pr-1",children:[x.length>0&&i.jsxs(Xu,{children:[i.jsxs(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Active",c>0&&i.jsxs("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:[c," running"]})]}),i.jsx(La,{children:x.map(v=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>s(v.id),className:"text-sm",children:[i.jsx("span",{className:"size-2 shrink-0 animate-pulse rounded-full bg-green-500"}),i.jsx("span",{className:"truncate",children:v.name})]})},v.id))})]}),b.length>0&&i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),i.jsx(La,{children:b.map(v=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>s(v.id),className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",v.enabled?"bg-muted-foreground/40":"bg-muted-foreground/20")}),i.jsx("span",{className:"truncate",children:v.name}),v.nextRun&&i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:Ih(v.nextRun)})]})},v.id))})]}),i.jsx("div",{className:"px-3 py-2",children:i.jsx("button",{onClick:()=>t?r(t):n(!0),className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Pulse →"})})]})})}const d2e={connected:"bg-green-500",disconnected:"bg-amber-500",error:"bg-red-500"},f2e={enabled:"bg-green-500","disabled-by-agent":"bg-muted-foreground/20","disabled-by-server":"bg-muted-foreground/20"},dM={connected:"bg-green-500",failed:"bg-red-500","needs-auth":"bg-amber-500",pending:"bg-amber-500",disabled:"bg-muted-foreground/20"},h2e=[{key:"pulse",label:"Pulse"},{key:"relay",label:"Relay"},{key:"mesh",label:"Mesh"}],pE=3,mE=4,cb=[0,0,.2,1],fM={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0}},hM={duration:.2,ease:cb},pM={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0}},mM={duration:.25,ease:cb},gM={initial:{opacity:0,y:3},animate:{opacity:1,y:0},exit:{opacity:0,y:-3}},xM={duration:.12,ease:cb},Su={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},wu={duration:.15,ease:cb};function p2e({toolStatus:e,agentId:t}){const{setRelayOpen:n,setMeshOpen:r,setAgentDialogOpen:s,selectedCwd:a}=He(),l=e.relay!=="disabled-by-server",c=e.mesh!=="disabled-by-server",{data:d=[]}=p4(l),{data:f=[]}=OC(),{data:m}=Gi(void 0,c),p=g.useMemo(()=>(m==null?void 0:m.agents)??[],[m==null?void 0:m.agents]),{data:x}=BY(a),b=(x==null?void 0:x.servers)??[],v=b.slice(0,mE),E=Math.max(0,b.length-mE),{data:w,isLoading:S}=BTe(t??"",c&&!!t),N=g.useMemo(()=>{const G=Y=>Y.config.type==="claude-code"&&Y.config.builtin===!0;if(!t)return d.filter(G);const J=new Set(f.filter(Y=>Y.agentId===t).map(Y=>Y.adapterId));return d.filter(Y=>G(Y)||J.has(Y.config.id))},[d,f,t]),A=g.useMemo(()=>{if(!t||S||!w)return p;const G=new Set(w.agents.map(J=>J.id));return p.filter(J=>G.has(J.id))},[p,t,w,S]),j=A.slice(0,pE),R=Math.max(0,A.length-pE),[_,D]=g.useState(!1),[I,L]=g.useState(!1),B=l,X=c;return i.jsx(Vx,{type:"scroll",className:"h-full",children:i.jsxs("div",{className:"pr-1",children:[i.jsx(Ze,{initial:!1,children:B&&i.jsx(ve.div,{variants:pM,initial:"initial",animate:"animate",exit:"exit",transition:mM,className:"overflow-hidden",children:i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Adapters"}),i.jsx(Uv,{"aria-label":"Open Relay panel",onClick:()=>n(!0),children:i.jsx(Uu,{})}),i.jsx(Ze,{mode:"wait",initial:!1,children:e.relay==="disabled-by-agent"?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Relay disabled for this agent"})},"relay-disabled"):N.length===0?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No adapters configured"})},"relay-empty"):i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,children:i.jsx(La,{children:N.map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>n(!0),className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",d2e[G.status.state]??"bg-muted-foreground/20",G.status.state==="connected"&&"animate-pulse")}),i.jsx("span",{className:"truncate",children:G.status.displayName}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs capitalize",children:G.status.state})]})},G.config.id))})},"relay-list")})]})})}),i.jsx(Ze,{initial:!1,children:X&&i.jsx(ve.div,{variants:pM,initial:"initial",animate:"animate",exit:"exit",transition:mM,className:"overflow-hidden",children:i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Agents"}),i.jsx(Uv,{"aria-label":"Open Mesh panel",onClick:()=>r(!0),children:i.jsx(Uu,{})}),i.jsx(Ze,{mode:"wait",initial:!1,children:e.mesh==="disabled-by-agent"?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Mesh disabled for this agent"})},"mesh-disabled"):A.length===0?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No agents registered"})},"mesh-empty"):i.jsxs(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,children:[i.jsx(La,{children:j.map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>r(!0),className:"text-sm",children:[i.jsx("span",{className:"size-2 shrink-0 rounded-full bg-muted-foreground/40"}),i.jsx("span",{className:"truncate",children:G.name})]})},G.id))}),i.jsx(Ze,{initial:!1,children:_&&i.jsx(ve.div,{variants:fM,initial:"initial",animate:"animate",exit:"exit",transition:hM,className:"overflow-hidden",children:i.jsx(La,{children:A.slice(pE).map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>r(!0),className:"text-sm",children:[i.jsx("span",{className:"size-2 shrink-0 rounded-full bg-muted-foreground/40"}),i.jsx("span",{className:"truncate",children:G.name})]})},G.id))})})})]},"mesh-list")}),R>0&&i.jsx("div",{className:"px-3 py-1",children:i.jsx("button",{onClick:()=>D(G=>!G),className:"text-muted-foreground hover:text-foreground relative text-xs transition-colors",children:i.jsx(Ze,{mode:"wait",initial:!1,children:i.jsx(ve.span,{variants:gM,initial:"initial",animate:"animate",exit:"exit",transition:xM,className:"block",children:_?"Show less":`+ ${R} more ${R===1?"agent":"agents"} reachable →`},_?"less":"more")})})})]})})}),i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Tools"}),i.jsx(Uv,{"aria-label":"Edit capabilities",onClick:()=>s(!0),children:i.jsx(Uu,{})}),i.jsx(La,{children:h2e.map(({key:G,label:J})=>{const Y=e[G];return i.jsx(Pa,{children:i.jsxs(Ei,{className:"text-sm",onClick:()=>s(!0),children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",f2e[Y])}),i.jsx("span",{className:"truncate",children:J}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:Y==="enabled"?"enabled":"off"})]})},G)})}),i.jsx(La,{children:v.map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",dM[G.status??""]??"bg-muted-foreground/40",G.status==="connected"&&"animate-pulse")}),i.jsx("span",{className:"truncate",children:G.name}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:"mcp"})]})},G.name))}),i.jsx(Ze,{initial:!1,children:I&&i.jsx(ve.div,{variants:fM,initial:"initial",animate:"animate",exit:"exit",transition:hM,className:"overflow-hidden",children:i.jsx(La,{children:b.slice(mE).map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",dM[G.status??""]??"bg-muted-foreground/40",G.status==="connected"&&"animate-pulse")}),i.jsx("span",{className:"truncate",children:G.name}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:"mcp"})]})},G.name))})})}),E>0&&i.jsx("div",{className:"px-3 py-1",children:i.jsx("button",{onClick:()=>L(G=>!G),className:"text-muted-foreground hover:text-foreground relative text-xs transition-colors",children:i.jsx(Ze,{mode:"wait",initial:!1,children:i.jsx(ve.span,{variants:gM,initial:"initial",animate:"animate",exit:"exit",transition:xM,className:"block",children:I?"Show less":`+ ${E} more ${E===1?"server":"servers"} →`},I?"less":"more")})})})]})]})})}function m2e(e){const t=T4(e),n=t.relay!=="disabled-by-server",r=t.mesh!=="disabled-by-server",{data:s}=p4(n),{data:a}=Gi(void 0,r),l=a==null?void 0:a.agents;return g.useMemo(()=>{const c=s??[],d=l??[];return c.length===0&&d.length===0?"none":c.some(f=>f.status.state==="error")?"error":c.every(f=>f.status.state==="connected")?"ok":"partial"},[s,l])}function bM(){const{sessions:e,activeSessionId:t,setActiveSession:n}=PS(),{setSidebarOpen:r,setPulseOpen:s,setOnboardingStep:a}=He(),l=Hi(),c=g.useRef(!1),d=kd(),{unviewedCount:f,clearBadge:m}=PY(d),p=He(W=>W.enablePulseNotifications),{shouldShowOnboarding:x,dismiss:b}=zp(),v=He(W=>W.pulseOpen),E=g.useContext(_C);g.useEffect(()=>{if(c.current){c.current=!1;return}!t&&e.length>0&&n(e[0].id)},[t,e,n]);const w=g.useCallback(()=>{c.current=!0,n(null),l&&setTimeout(()=>{r(!1),E==null||E.setOpenMobile(!1)},Ts.SIDEBAR_AUTO_CLOSE_MS)},[n,l,r,E]),S=g.useCallback(W=>{n(W),l&&(r(!1),E==null||E.setOpenMobile(!1))},[l,n,r,E]);g.useEffect(()=>{v&&m()},[v,m]);const N=g.useRef(0);g.useEffect(()=>{p&&(f>N.current&&Dn("Pulse run completed",{description:"A scheduled run has finished.",duration:6e3,action:{label:"View history",onClick:()=>s(!0)}}),N.current=f)},[f,p,s]);const A=He(W=>W.setPulseBadgeCount);g.useEffect(()=>(A(f),()=>A(0)),[f,A]);const j=g.useMemo(()=>mG(e),[e]),{sidebarActiveTab:R,setSidebarActiveTab:_}=He(),D=He(W=>W.selectedCwd),{data:I}=ex(D),L=T4(D),B=L.pulse!=="disabled-by-server",{data:X=0}=US(B),G=m2e(D),J=g.useMemo(()=>{const W=["sessions"];return B&&W.push("schedules"),W.push("connections"),W},[B]);g.useEffect(()=>{J.includes(R)||_("sessions")},[J,R,_]);const Y=He(W=>W.sidebarOpen);return g.useEffect(()=>{if(!Y)return;const W=F=>{if(!(F.metaKey||F.ctrlKey))return;const z={1:"sessions",2:"schedules",3:"connections"}[F.key];z&&J.includes(z)&&(F.preventDefault(),_(z))};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[Y,J,_]),g.useEffect(()=>{const W=F=>{(F.metaKey||F.ctrlKey)&&F.shiftKey&&F.key==="N"&&(F.preventDefault(),w())};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[w]),i.jsxs(i.Fragment,{children:[i.jsx(oEe,{className:"border-b p-3",children:i.jsx(La,{children:i.jsx(Pa,{children:i.jsxs(Ei,{onClick:w,className:"group border-border text-muted-foreground hover:bg-accent hover:text-foreground flex w-full items-center justify-between gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium transition-all duration-100 active:scale-[0.98] disabled:opacity-50",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx(Ql,{className:"size-(--size-icon-sm)"}),"New session"]}),i.jsx(ps,{className:"shrink-0 opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:a4(s4.NEW_SESSION)})]})})})}),i.jsx(i2e,{activeTab:R,onTabChange:_,schedulesBadge:X,connectionsStatus:G,visibleTabs:J}),i.jsxs(cEe,{"data-testid":"session-list",className:"!overflow-hidden",children:[i.jsx("div",{role:"tabpanel",id:"sidebar-tabpanel-sessions","aria-labelledby":"sidebar-tab-sessions",className:oe("h-full",R!=="sessions"&&"hidden"),children:i.jsx(c2e,{activeSessionId:t,groupedSessions:j,onSessionClick:S})}),i.jsx("div",{role:"tabpanel",id:"sidebar-tabpanel-schedules","aria-labelledby":"sidebar-tab-schedules",className:oe("h-full",R!=="schedules"&&"hidden"),children:i.jsx(u2e,{toolStatus:L.pulse,agentId:(I==null?void 0:I.id)??null})}),i.jsx("div",{role:"tabpanel",id:"sidebar-tabpanel-connections","aria-labelledby":"sidebar-tab-connections",className:oe("h-full",R!=="connections"&&"hidden"),children:i.jsx(p2e,{toolStatus:L,agentId:I==null?void 0:I.id})})]}),i.jsxs(lEe,{className:"border-t p-3",children:[x&&i.jsx("div",{className:"mb-2",children:i.jsx(e2e,{onStepClick:W=>a(W),onDismiss:b})}),i.jsx(r2e,{})]}),i.jsx(aEe,{})]})}function FC(e){const t=[],n=[];for(const r of e)r.type==="text"?t.push(r.text):r.type==="tool_call"&&n.push({toolCallId:r.toolCallId,toolName:r.toolName,input:r.input||"",result:r.result,progressOutput:r.progressOutput,status:r.status,interactiveType:r.interactiveType,questions:r.questions,answers:r.answers,timeoutMs:r.timeoutMs,hooks:r.hooks});return{content:t.join(`
|
|
856
|
+
</agent_persona>`),x},[e.name,e.id,e.description,e.capabilities,r,s]);return i.jsxs("div",{className:"space-y-6",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:"This text is appended to Claude Code's system prompt for every session in this directory. Use it to define the agent's expertise, constraints, and personality."}),i.jsx(Ws,{children:i.jsxs(Xs,{children:[i.jsxs(Yh,{orientation:"horizontal",className:"items-center justify-between",children:[i.jsx(Kh,{htmlFor:"persona-toggle",className:"text-sm font-medium",children:"Inject persona into sessions"}),i.jsx(qt,{id:"persona-toggle",checked:r,onCheckedChange:c})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("textarea",{id:"persona-text",value:s,onChange:p=>d(p.target.value),onBlur:f,rows:8,maxLength:sM,disabled:!r,className:"border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring w-full resize-none rounded-md border px-3 py-2 font-mono text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"You are backend-bot, an expert in REST API design..."}),i.jsxs("p",{className:"text-muted-foreground text-right text-xs",children:[s.length," / ",sM.toLocaleString()]})]})]})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{className:"text-sm font-medium",children:"Preview (injected into system prompt)"}),i.jsx("pre",{className:"bg-muted max-h-48 overflow-auto rounded-md p-3",children:i.jsx("code",{className:"text-xs",children:m})})]})]})}function Twe({domain:e,agentOverride:t,globalDefault:n,onToggle:r,onReset:s}){const a=t!==void 0,l=t??n,c=a?`Overridden: ${l?"On":"Off"}`:"Inherited";return e.serverDisabled?i.jsx(vn,{label:e.label,description:e.description,className:"py-1",children:i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground/50 text-xs",children:"Server off"}),i.jsx(qt,{checked:!1,disabled:!0,"aria-label":`Toggle ${e.label} tools`})]})}),i.jsx(ks,{side:"left",children:e.serverDisabledReason??"Disabled globally by server configuration."})]})}):i.jsx(vn,{label:e.label,description:e.description,className:"py-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`text-xs ${a?"text-foreground":"text-muted-foreground"}`,children:c}),a&&i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsx(tt,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>s(e.key),"aria-label":`Reset ${e.label} to default`,children:i.jsx(TI,{className:"size-3"})})}),i.jsx(ks,{side:"top",children:"Reset to default"})]}),i.jsx(qt,{checked:l,onCheckedChange:d=>r(e.key,d),"aria-label":`Toggle ${e.label} tools`})]})})}const Mg="border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring w-full rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",Swe=500;function wwe({agent:e,onUpdate:t}){var A,j,R;const[n,r]=g.useState(""),s=Nd(),a=kd(),{config:l}=Dz(),[c,d]=g.useState(e.namespace??""),f=g.useRef(null);g.useEffect(()=>{d(e.namespace??"")},[e.id]);const m=g.useCallback(_=>{d(_),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{t({namespace:_||void 0})},Swe)},[t]),p=g.useCallback(()=>{f.current&&clearTimeout(f.current);const _=c||void 0;_!==e.namespace&&t({namespace:_})},[c,e.namespace,t]);g.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const x=g.useCallback(_=>{const D=_.trim();!D||e.capabilities.includes(D)||(t({capabilities:[...e.capabilities,D]}),r(""))},[e.capabilities,t]),b=g.useCallback(_=>{t({capabilities:e.capabilities.filter(D=>D!==_)})},[e.capabilities,t]),v=g.useCallback(_=>{(_.key==="Enter"||_.key===",")&&(_.preventDefault(),x(n))},[n,x]),E=g.useCallback((_,D)=>{const I=e.enabledToolGroups??{};t({enabledToolGroups:{...I,[_]:D}})},[e.enabledToolGroups,t]),w=g.useCallback(_=>{const D={...e.enabledToolGroups??{}};delete D[_],t({enabledToolGroups:D})},[e.enabledToolGroups,t]),S=[{key:"pulse",configKey:"pulseTools",label:"Pulse (Scheduling)",description:"Create and manage scheduled agent runs",serverDisabled:!a,serverDisabledReason:"Disabled globally by server configuration."},{key:"relay",configKey:"relayTools",label:"Relay (Messaging)",description:"Send messages, check inbox, register endpoints",serverDisabled:!s,serverDisabledReason:"Disabled globally by server configuration."},{key:"mesh",configKey:"meshTools",label:"Mesh (Discovery)",description:"Discover, register, and query agents"},{key:"adapter",configKey:"adapterTools",label:"Relay Adapters",description:"Manage Slack, Telegram, and other adapters",serverDisabled:!s,serverDisabledReason:"Disabled globally by server configuration."}],N=e.enabledToolGroups??{};return i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ws,{children:i.jsxs(Xs,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{htmlFor:"cap-input",className:"text-sm font-medium",children:"Capabilities"}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.capabilities.map(_=>i.jsxs(sn,{variant:"secondary",className:"gap-1 pr-1",children:[_,i.jsx("button",{onClick:()=>b(_),className:"hover:bg-muted rounded-sm p-0.5 transition-colors duration-150","aria-label":`Remove ${_}`,children:i.jsx(wr,{className:"size-3"})})]},_))}),i.jsx("input",{id:"cap-input",type:"text",value:n,onChange:_=>r(_.target.value),onKeyDown:v,className:Mg,placeholder:"Add capability and press Enter"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{htmlFor:"agent-namespace",className:"text-sm font-medium",children:"Namespace"}),i.jsx("input",{id:"agent-namespace",type:"text",value:c,onChange:_=>m(_.target.value),onBlur:p,className:Mg,placeholder:"Optional grouping namespace"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Lt,{className:"text-sm font-medium",children:"Response Mode"}),i.jsxs(On,{value:((A=e.behavior)==null?void 0:A.responseMode)??"always",onValueChange:_=>t({behavior:{...e.behavior,responseMode:_}}),children:[i.jsx(An,{className:"w-full",children:i.jsx(In,{})}),i.jsxs(jn,{children:[i.jsx(ft,{value:"always",children:"Always respond"}),i.jsx(ft,{value:"direct-only",children:"Direct messages only"}),i.jsx(ft,{value:"mention-only",children:"Mentions only"}),i.jsx(ft,{value:"silent",children:"Silent"})]})]})]})]})}),i.jsx("h3",{className:"text-sm font-semibold",children:"Budget"}),i.jsx(Ws,{children:i.jsx(Xs,{children:i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"max-hops",className:"text-muted-foreground text-xs",children:"Max Hops / Message"}),i.jsx("input",{id:"max-hops",type:"number",min:1,value:((j=e.budget)==null?void 0:j.maxHopsPerMessage)??5,onChange:_=>t({budget:{...e.budget,maxHopsPerMessage:parseInt(_.target.value)||5}}),className:Mg})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"max-calls",className:"text-muted-foreground text-xs",children:"Max Calls / Hour"}),i.jsx("input",{id:"max-calls",type:"number",min:1,value:((R=e.budget)==null?void 0:R.maxCallsPerHour)??100,onChange:_=>t({budget:{...e.budget,maxCallsPerHour:parseInt(_.target.value)||100}}),className:Mg})]})]})})}),i.jsx("h3",{className:"text-sm font-semibold",children:"Tool Groups"}),i.jsx("p",{className:"text-muted-foreground text-xs",children:"Override which MCP tool domains are available to this agent. Leave unset to inherit global defaults."}),i.jsx(Ws,{children:i.jsxs(Xs,{children:[i.jsx(vn,{label:"Core Tools",description:"ping, server info, agent identity",className:"py-1",children:i.jsx("span",{className:"text-muted-foreground text-xs",children:"Always enabled"})}),S.map(_=>i.jsx(Twe,{domain:_,agentOverride:N[_.key],globalDefault:l[_.configKey],onToggle:E,onReset:w},_.key))]})})]})}function Cwe({agent:e}){const t=kd(),n=Nd(),{data:r}=MC(e.id);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Pulse Schedules"}),i.jsx(sn,{variant:t?"default":"secondary",className:"text-xs",children:t?"Enabled":"Disabled"})]}),i.jsx("p",{className:"text-muted-foreground text-sm",children:t?"Configure automated schedules for this agent in the Pulse panel.":"Enable Pulse to schedule automated agent runs."})]}),i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Relay Endpoints"}),i.jsx(sn,{variant:n?"default":"secondary",className:"text-xs",children:n?"Enabled":"Disabled"})]}),i.jsx("p",{className:"text-muted-foreground text-sm",children:n?"Manage messaging endpoints for this agent in the Relay panel.":"Enable Relay for inter-agent messaging."})]}),i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Mesh Health"}),i.jsx(sn,{variant:"default",className:"text-xs",children:"Enabled"})]}),r?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:"Status:"}),i.jsx(sn,{variant:r.status==="active"?"default":"secondary",className:"text-xs",children:r.status}),r.lastSeenAt&&i.jsxs("span",{className:"text-muted-foreground text-xs",children:["Last seen ",new Date(r.lastSeenAt).toLocaleString()]})]}):i.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading health information..."})]})]})}function $z({projectPath:e,open:t,onOpenChange:n}){const[r,s]=g.useState("identity"),{data:a}=ex(e),l=VG(),c=g.useCallback(d=>{l.mutate({path:e,updates:d})},[e,l]);return a?i.jsx(ys,{open:t,onOpenChange:n,children:i.jsx(vs,{"data-testid":"agent-dialog",className:"max-h-[85vh] max-w-2xl gap-0 p-0",children:i.jsxs(R2,{value:r,onValueChange:s,children:[i.jsx(Yu,{}),i.jsxs(I2,{children:[i.jsx(Qs,{className:"text-sm font-medium",children:a.name}),i.jsx(Zs,{className:"text-muted-foreground text-xs",children:"Agent configuration"}),i.jsxs("div",{className:"text-muted-foreground/60 flex items-center gap-1.5 pt-1",children:[i.jsx(Ii,{className:"size-3 flex-shrink-0"}),i.jsx(PT,{path:e,maxSegments:3,size:"sm"})]})]}),i.jsxs(O2,{children:[i.jsxs(D2,{children:[i.jsx(fa,{value:"identity",icon:ete,children:"Identity"}),i.jsx(fa,{value:"persona",icon:CI,children:"Persona"}),i.jsx(fa,{value:"capabilities",icon:pte,children:"Capabilities"}),i.jsx(fa,{value:"connections",icon:EI,children:"Connections"})]}),i.jsxs(M2,{className:"min-h-[280px] p-4",children:[i.jsx(pa,{value:"identity",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Identity"}),i.jsx(ywe,{agent:a,projectPath:e,onUpdate:c})]})}),i.jsx(pa,{value:"persona",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Persona"}),i.jsx(Ewe,{agent:a,onUpdate:c})]})}),i.jsx(pa,{value:"capabilities",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Capabilities"}),i.jsx(wwe,{agent:a,onUpdate:c})]})}),i.jsx(pa,{value:"connections",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(ha,{children:"Connections"}),i.jsx(Cwe,{agent:a})]})})]})]})]})})}):i.jsx(ys,{open:t,onOpenChange:n,children:i.jsxs(vs,{className:"max-h-[85vh] max-w-lg gap-0 p-0",children:[i.jsxs($a,{className:"space-y-0 border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Agent"}),i.jsx(Zs,{className:"sr-only",children:"Agent configuration"})]}),i.jsxs("div",{className:"flex h-32 flex-col items-center justify-center gap-2",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:"No agent registered"}),i.jsxs("div",{className:"text-muted-foreground/60 flex items-center gap-1.5",children:[i.jsx(Ii,{className:"size-3.5 flex-shrink-0"}),i.jsx(PT,{path:e,maxSegments:3,size:"sm"})]})]})]})})}X0(e=>({open:!1,projectPath:null,openDialog:t=>e({open:!0,projectPath:t}),closeDialog:()=>e({open:!1,projectPath:null})}));function Nwe({enabled:e=!0}){const{data:t,isLoading:n}=MTe(e);return!e||n||!t?null:i.jsxs("div",{className:"flex items-center gap-3 border-b px-3 py-1.5 text-xs text-muted-foreground",children:[i.jsxs("span",{children:[t.totalAgents," agents"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500","aria-hidden":"true"}),t.activeCount]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500","aria-hidden":"true"}),t.inactiveCount]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-zinc-400","aria-hidden":"true"}),t.staleCount]})]})}function aM(e){if(!e)return"Never";const t=Date.now(),n=new Date(e).getTime(),r=t-n;if(Number.isNaN(r)||r<0)return"just now";const s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const l=Math.floor(a/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}const Vz={active:{label:"Active",color:"bg-green-500"},inactive:{label:"Inactive",color:"bg-amber-500"},stale:{label:"Stale",color:"bg-zinc-400"}};function kwe(e){return e in Vz}function iM({onClick:e}){return i.jsx("button",{type:"button",onClick:e,"aria-label":"Close detail panel",className:"text-muted-foreground hover:text-foreground",children:i.jsx(wr,{className:"size-(--size-icon-sm)"})})}function Awe({agentId:e,onClose:t,onOpenSettings:n}){const{data:r,isLoading:s}=MC(e);if(s)return i.jsx("div",{className:"flex w-64 items-center justify-center border-l p-4",children:i.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})});if(!r)return i.jsxs("div",{className:"w-64 border-l p-4",children:[i.jsx("div",{className:"flex justify-end",children:i.jsx(iM,{onClick:t})}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Agent not found"})]});const a=kwe(r.status)?r.status:"stale",l=Vz[a];return i.jsxs("div",{className:"w-64 overflow-y-auto border-l p-4",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h3",{className:"truncate text-sm font-semibold",children:r.name}),i.jsx(iM,{onClick:t})]}),i.jsxs("div",{className:"space-y-3 text-xs",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${l.color}`,"aria-hidden":"true"}),i.jsx("span",{children:l.label})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Last seen: "}),i.jsx("span",{children:aM(r.lastSeenAt)})]}),r.lastSeenEvent&&i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Last event: "}),i.jsx("span",{children:r.lastSeenEvent})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Runtime: "}),i.jsx(sn,{variant:"secondary",className:"text-[0.625rem]",children:r.runtime})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"Registered: "}),i.jsx("span",{children:aM(r.registeredAt)})]}),Array.isArray(r.capabilities)&&r.capabilities.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"mb-1 block text-muted-foreground",children:"Capabilities:"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:r.capabilities.map(c=>i.jsx(sn,{variant:"outline",className:"text-[0.625rem]",children:c},c))})]})]}),n&&i.jsx("div",{className:"mt-4 border-t pt-3",children:i.jsxs("button",{type:"button",onClick:n,className:"inline-flex w-full items-center justify-center gap-2 rounded-md border px-3 py-1.5 text-xs font-medium hover:bg-muted",children:[i.jsx(cx,{className:"size-3.5"}),"Open Settings"]})})]})}function PC({icon:e,headline:t,description:n,action:r,preview:s}){return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-12 text-center",children:[s&&i.jsx("div",{className:"mb-4 w-full max-w-sm select-none opacity-40 pointer-events-none",children:s}),i.jsx("div",{className:"rounded-xl bg-muted/50 p-3",children:i.jsx(e,{className:"size-6 text-muted-foreground"})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-medium",children:t}),i.jsx("p",{className:"max-w-[280px] text-xs text-muted-foreground",children:n})]}),r&&i.jsx(tt,{size:"sm",onClick:r.onClick,className:"mt-1",children:r.label})]})}function jwe({namespace:e,agentCount:t,agents:n}){const[r,s]=g.useState(!1);return i.jsxs("div",{className:"rounded-xl border",children:[i.jsxs("button",{type:"button",onClick:()=>s(!r),className:"flex w-full items-center gap-2 px-4 py-3 text-left hover:bg-muted/50",children:[r?i.jsx(Ss,{className:"size-4"}):i.jsx(Js,{className:"size-4"}),i.jsx("span",{className:"font-medium text-sm",children:e}),i.jsxs(sn,{variant:"secondary",className:"ml-auto text-xs",children:[t," agent",t!==1?"s":""]})]}),r&&i.jsx("div",{className:"border-t px-4 py-2 space-y-2",children:n.map(a=>i.jsxs("div",{className:"flex items-center justify-between py-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm",children:a.name}),i.jsx(sn,{variant:"outline",className:"text-xs",children:a.runtime})]}),a.budget&&i.jsxs("div",{className:"flex gap-2 text-xs text-muted-foreground",children:[i.jsxs("span",{children:[a.budget.maxCallsPerHour," calls/hr"]}),i.jsxs("span",{children:[a.budget.maxHopsPerMessage," max hops"]})]})]},a.id))})]})}function _we({sourceNamespace:e,targetNamespace:t,action:n,onRemove:r}){return i.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"font-mono",children:e}),i.jsx("span",{className:"text-muted-foreground",children:"→"}),i.jsx("span",{className:"font-mono",children:t}),i.jsx(sn,{variant:n==="allow"?"default":"destructive",className:"text-xs",children:n})]}),i.jsx("button",{type:"button",onClick:r,className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":`Remove rule ${e} to ${t}`,children:i.jsx(Rd,{className:"size-3.5"})})]})}function Rwe({namespaces:e,onAdd:t,isPending:n}){const[r,s]=g.useState(""),[a,l]=g.useState("");function c(d){d.preventDefault(),r&&a&&r!==a&&(t(r,a),s(""),l(""))}return i.jsxs("form",{onSubmit:c,className:"flex items-end gap-2",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{htmlFor:"acl-source",className:"text-xs font-medium text-muted-foreground",children:"Source"}),i.jsxs("select",{id:"acl-source",value:r,onChange:d=>s(d.target.value),className:"mt-1 w-full rounded-md border bg-transparent px-2 py-1.5 text-sm",children:[i.jsx("option",{value:"",children:"Select namespace"}),e.map(d=>i.jsx("option",{value:d,children:d},d))]})]}),i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{htmlFor:"acl-target",className:"text-xs font-medium text-muted-foreground",children:"Target"}),i.jsxs("select",{id:"acl-target",value:a,onChange:d=>l(d.target.value),className:"mt-1 w-full rounded-md border bg-transparent px-2 py-1.5 text-sm",children:[i.jsx("option",{value:"",children:"Select namespace"}),e.map(d=>i.jsx("option",{value:d,children:d},d))]})]}),i.jsxs("button",{type:"submit",disabled:n||!r||!a||r===a,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:[n?i.jsx(Gn,{className:"size-4 animate-spin"}):i.jsx(Ql,{className:"size-4"}),"Allow"]})]})}function Dwe({onGoToDiscovery:e}={}){const{data:t,isLoading:n}=ITe(),{mutate:r,isPending:s}=PTe();if(n)return i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})});const a=(t==null?void 0:t.namespaces)??[],l=(t==null?void 0:t.accessRules)??[],c=a.map(d=>d.namespace);return a.length===0?i.jsx(PC,{icon:hp,headline:"Cross-project access requires multiple namespaces",description:"Register agents from different directories to create namespaces, then configure cross-namespace access rules.",action:e?{label:"Go to Discovery",onClick:e}:void 0}):i.jsxs("div",{className:"space-y-6 p-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Namespaces"}),a.map(d=>i.jsx(jwe,{namespace:d.namespace,agentCount:d.agentCount,agents:d.agents},d.namespace))]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Cross-Project Access Rules"}),l.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"No cross-project rules. Agents can only communicate within their own namespace."}):i.jsx("div",{className:"space-y-1",children:l.map(d=>i.jsx(_we,{sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:d.action,onRemove:()=>r({sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:"deny"})},`${d.sourceNamespace}-${d.targetNamespace}`))})]}),c.length>=2&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Add Cross-Project Rule"}),i.jsx(Rwe,{namespaces:c,isPending:s,onAdd:(d,f)=>r({sourceNamespace:d,targetNamespace:f,action:"allow"})})]})]})}const oM={candidates:[],progress:null,isScanning:!1,error:null,lastScanAt:null},BC=X0()(BO(e=>({...oM,startScan:()=>e({candidates:[],progress:null,isScanning:!0,error:null},!1,"discovery/startScan"),addCandidate:t=>e(n=>({candidates:[...n.candidates,t]}),!1,"discovery/addCandidate"),setProgress:t=>e({progress:t},!1,"discovery/setProgress"),completeScan:t=>e({progress:t,isScanning:!1,lastScanAt:new Date().toISOString()},!1,"discovery/completeScan"),setError:t=>e({error:t,isScanning:!1},!1,"discovery/setError"),reset:()=>e(oM,!1,"discovery/reset")}),{name:"DiscoveryStore"}));function qz(){const e=Ve(),t=g.useRef(null),{startScan:n,addCandidate:r,setProgress:s,completeScan:a,setError:l}=BC(),c=g.useCallback((f={roots:[]})=>{var p;(p=t.current)==null||p.abort();const m=new AbortController;t.current=m,n(),e.scan(f,x=>{switch(x.type){case"candidate":r(x.data);break;case"progress":s(x.data);break;case"complete":a(x.data);break;case"error":l(x.data.error);break}},m.signal).catch(x=>{x instanceof Error&&x.name!=="AbortError"&&l(x.message)})},[e,n,r,s,a,l]),d=g.useCallback(()=>{var f;(f=t.current)==null||f.abort(),t.current=null},[]);return{startScan:c,stopScan:d}}const Mwe={manifest:"Found a .dork/agent.json manifest file in this directory.",heuristic:"Inferred from project file structure and naming conventions.","package.json":"Detected agent configuration inside package.json."};function Owe(e){return Mwe[e]??`Detected via "${e}" strategy.`}const Iwe={"code-review":"Reviews code for bugs, style issues, and correctness.",summarize:"Summarizes documents, conversations, or code.","file-ops":"Reads and writes files on the filesystem.",test:"Generates and runs tests for a codebase.",search:"Searches code, files, or the web for relevant information.",refactor:"Refactors code while preserving existing behavior.",analyze:"Analyzes data, logs, or codebases for patterns and insights.",generate:"Generates code, content, or structured output.",debug:"Diagnoses and fixes bugs in code.",deploy:"Manages deployment pipelines and infrastructure changes."};function Lwe(e){return Iwe[e]??"Agent capability detected from project structure."}function Gz({candidate:e,onApprove:t,onDeny:n,onSkip:r,className:s}){const{path:a,strategy:l,hints:c}=e;return i.jsxs(ve.div,{"data-slot":"candidate-card",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.15,ease:"easeOut"},className:oe("flex items-start justify-between rounded-xl border p-4",s),children:[i.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[i.jsx("p",{className:"text-sm font-semibold leading-tight",children:c.suggestedName||a.split("/").pop()||a}),i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[i.jsx($u,{className:"size-3 shrink-0"}),i.jsx("span",{className:"truncate font-mono",children:a})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs(Cce,{openDelay:300,children:[i.jsx(Nce,{asChild:!0,children:i.jsx(sn,{variant:"secondary",className:"cursor-default text-xs hover:bg-secondary/80",children:c.detectedRuntime})}),i.jsxs(kce,{className:"w-56 space-y-1.5 p-3",side:"top",align:"start",children:[i.jsx("p",{className:"text-xs font-medium",children:"Detected runtime"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:Owe(l)})]})]}),c.inferredCapabilities&&c.inferredCapabilities.length>0&&c.inferredCapabilities.map(d=>i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsx(sn,{variant:"outline",className:"cursor-default text-[10px]",children:d})}),i.jsx(ks,{side:"top",className:"max-w-48 text-center",children:Lwe(d)})]},d))]})]}),i.jsxs("div",{className:"ml-4 flex shrink-0 items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>t(e),className:"rounded-md bg-green-600/10 px-2.5 py-1 text-xs font-medium text-green-700 hover:bg-green-600/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 dark:text-green-400",children:"Approve"}),r&&i.jsx("button",{type:"button",onClick:()=>r(e),className:"rounded-md px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Skip"}),n&&i.jsx("button",{type:"button",onClick:()=>n(e),className:"rounded-md bg-red-600/10 px-2.5 py-1 text-xs font-medium text-red-700 hover:bg-red-600/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 dark:text-red-400",children:"Deny"})]})]})}function Pwe({roots:e,onChange:t}){const[n,r]=g.useState(""),[s,a]=g.useState(!1),l=g.useCallback(m=>{const p=m.trim();p&&!e.includes(p)&&t([...e,p])},[e,t]),c=g.useCallback(m=>{t(e.filter(p=>p!==m))},[e,t]),d=g.useCallback(m=>{(m.key==="Enter"||m.key===",")&&(m.preventDefault(),n.trim()&&(l(n),r(""))),m.key==="Backspace"&&n===""&&e.length>0&&c(e[e.length-1])},[n,e,l,c]),f=g.useCallback(m=>{l(m)},[l]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex min-h-[40px] flex-wrap items-center gap-1.5 rounded-md border bg-transparent px-3 py-1.5 focus-within:ring-2 focus-within:ring-ring",children:[e.map(m=>i.jsxs(sn,{variant:"secondary",className:"gap-1 py-0.5 font-mono text-xs",children:[m,i.jsx("button",{type:"button",onClick:()=>c(m),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20","aria-label":`Remove ${m}`,children:i.jsx(wr,{className:"size-3"})})]},m)),i.jsx("input",{type:"text",value:n,onChange:m=>r(m.target.value),onKeyDown:d,placeholder:e.length===0?"Add paths to scan (Enter to add)":"Add more...",className:"min-w-[120px] flex-1 bg-transparent text-sm placeholder:text-muted-foreground focus-visible:outline-none"}),i.jsx("button",{type:"button",onClick:()=>a(!0),className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":"Browse for directory",children:i.jsx(Ii,{className:"size-4"})})]}),i.jsx(qx,{open:s,onOpenChange:a,onSelect:f})]})}const Bwe=[{name:"claude-code",signal:"CLAUDE.md",label:"Claude Code project"},{name:"cursor",signal:".cursor/",label:"Cursor project"},{name:"codex",signal:".codex/",label:"Codex project"},{name:"dork",signal:".dork/agent.json",label:"DorkOS agent (auto-imported)"}];function lM({fullBleed:e=!1}){const{roots:t,setScanRoots:n}=FTe(),[r,s]=g.useState(null),[a,l]=g.useState(!1),[c,d]=g.useState(3),{startScan:f}=qz(),{candidates:m,isScanning:p}=BC(),{mutate:x}=Oz(),{mutate:b}=kTe(),{data:v}=Gi(),E=r??t;function w(_){s(_),n(_)}function S(){E.length>0&&f({roots:E,maxDepth:c})}const[N,A]=g.useState(new Set),j=m.filter(_=>!N.has(_.path));function R(_){A(D=>new Set([...D,_]))}return i.jsxs("div",{className:e?"flex h-full flex-col p-6":"space-y-4 p-4",children:[e&&i.jsxs("div",{className:"mb-4 space-y-1",children:[i.jsx("h2",{className:"text-lg font-semibold",children:"Discover Agents"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Scan directories to find agents on your computer."})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>l(!a),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[i.jsx(Ss,{className:`size-3 transition-transform ${a?"":"-rotate-90"}`}),"Advanced"]}),a&&i.jsxs("div",{className:"mt-2 space-y-3 rounded-lg border bg-muted/30 p-3",children:[i.jsx(Pwe,{roots:E,onChange:w}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("label",{htmlFor:"scan-depth",className:"text-xs text-muted-foreground",children:"Scan depth"}),i.jsx("input",{id:"scan-depth",type:"range",min:1,max:5,value:c,onChange:_=>d(Number(_.target.value)),className:"flex-1"}),i.jsx("span",{className:"min-w-[1.5rem] text-center text-xs font-medium",children:c})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("p",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(PJ,{className:"size-3"}),"Detection strategies"]}),i.jsx("ul",{className:"space-y-1 pl-4",children:Bwe.map(_=>i.jsxs("li",{className:"flex items-baseline gap-1.5",children:[i.jsx("code",{className:"text-[10px] text-foreground/70",children:_.signal}),i.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["→ ",_.label]})]},_.name))})]})]})]}),i.jsxs("button",{type:"button",onClick:S,disabled:p||E.length===0,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:[p?i.jsx(Gn,{className:"size-4 animate-spin"}):i.jsx(lc,{className:"size-4"}),"Scan for Agents"]})]}),i.jsxs("div",{className:e?"mt-4 flex-1 overflow-y-auto":"",children:[p&&i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})}),!p&&j&&j.length===0&&(()=>{var D;const _=(((D=v==null?void 0:v.agents)==null?void 0:D.length)??0)>0;return i.jsxs("div",{className:"rounded-xl border border-dashed p-8 text-center",children:[i.jsx("p",{className:"text-sm font-medium",children:_?"No new agents found":"No agents found"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:_?"All discovered agents are already registered. Check the Agents tab to see them.":"Try scanning deeper directories or adding different paths."})]})})(),!p&&j&&j.length>0&&i.jsx(Ze,{mode:"popLayout",children:j.map(_=>i.jsx(Gz,{candidate:_,className:"mb-2",onApprove:D=>x({path:D.path,overrides:{name:D.hints.suggestedName,runtime:D.hints.detectedRuntime,...D.hints.inferredCapabilities?{capabilities:D.hints.inferredCapabilities}:{},...D.hints.description?{description:D.hints.description}:{}}},{onSuccess:()=>R(D.path)}),onDeny:D=>b({path:D.path},{onSuccess:()=>R(D.path)})},_.path))})]})]})}const Fwe=g.lazy(()=>W0(()=>import("./TopologyGraph-8CSPQVAk.js"),__vite__mapDeps([0,1])).then(e=>({default:e.TopologyGraph})));function zwe({agents:e,isLoading:t,onGoToDiscovery:n}){return t?i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})}):e.length===0?i.jsx(PC,{icon:pee,headline:"No agents registered yet",description:"Discover agents in your filesystem and register them to the mesh.",action:{label:"Go to Discovery",onClick:n}}):i.jsx("div",{className:"space-y-2 p-4",children:e.map(r=>i.jsx(Hwe,{agent:r},r.id))})}function Hwe({agent:e}){const{mutate:t}=ATe();return i.jsxs("div",{className:"space-y-1 rounded-xl border p-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"text-sm font-medium",children:e.name}),i.jsx(sn,{variant:"secondary",children:e.runtime})]}),i.jsx("button",{type:"button",onClick:()=>t(e.id),className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":`Unregister ${e.name}`,children:i.jsx(wr,{className:"size-3.5"})})]}),e.description&&i.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),e.capabilities.length>0&&i.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:e.capabilities.map(n=>i.jsx(sn,{variant:"outline",className:"text-xs",children:n},n))})]})}function Uwe({denied:e,isLoading:t}){return t?i.jsx("div",{className:"flex items-center justify-center p-8",children:i.jsx(Gn,{className:"size-5 animate-spin text-muted-foreground"})}):e.length===0?i.jsx(PC,{icon:Dw,headline:"No blocked paths",description:"When you deny agent paths during discovery, they appear here. This is a healthy state."}):i.jsx("div",{className:"space-y-2 p-4",children:e.map(n=>i.jsxs("div",{className:"flex items-center justify-between rounded-xl border px-4 py-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-mono text-sm",children:n.path}),n.reason&&i.jsx("p",{className:"text-xs text-muted-foreground",children:n.reason})]}),i.jsx(sn,{variant:"outline",className:"text-xs",children:n.strategy})]},n.path))})}function $we(){const{data:e,isLoading:t,isError:n,refetch:r}=Gi(),s=(e==null?void 0:e.agents)??[],{data:a,isLoading:l}=_Te(),c=(a==null?void 0:a.denied)??[],[d,f]=g.useState(null),[m,p]=g.useState(""),[x,b]=g.useState("topology"),[v,E]=g.useState(""),[w,S]=g.useState(!1),[,N]=Cd(),A=g.useCallback(L=>{N(L)},[N]),j=g.useCallback((L,B)=>{f(L),p(B)},[]),R=g.useCallback((L,B)=>{E(B),S(!0)},[]),D=!(s.length>0)&&!t&&!n;if(n)return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[i.jsx("div",{className:"rounded-xl bg-destructive/10 p-3",children:i.jsx(Li,{className:"size-6 text-destructive"})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Could not load agents"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The mesh API is unreachable. Check that the server is running correctly."})]}),i.jsx("button",{type:"button",onClick:()=>void r(),className:"mt-1 inline-flex items-center rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90",children:"Retry"})]});const I=()=>b("discovery");return i.jsxs(i.Fragment,{children:[i.jsx(Ze,{mode:"wait",initial:!1,children:D?i.jsx(ve.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"flex h-full flex-col",children:i.jsx(lM,{fullBleed:!0})},"mode-a"):i.jsx(ve.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"flex h-full flex-col",children:i.jsxs(P2,{value:x,onValueChange:b,className:"flex h-full flex-col",children:[i.jsx(Nwe,{}),i.jsxs(B2,{className:"mx-4 mt-3 shrink-0",children:[i.jsx(ko,{value:"topology",children:"Topology"}),i.jsx(ko,{value:"discovery",children:"Discovery"}),i.jsx(ko,{value:"agents",children:"Agents"}),i.jsx(ko,{value:"denied",children:"Denied"}),i.jsx(ko,{value:"access",children:"Access"})]}),i.jsxs(Ai,{value:"topology",className:"relative flex-1 overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0",children:i.jsx(g.Suspense,{fallback:i.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Loading topology..."}),children:i.jsx(Fwe,{onSelectAgent:j,onOpenSettings:R,onOpenChat:A})})}),i.jsx(Ze,{children:d&&i.jsx(ve.div,{initial:{x:64,opacity:0},animate:{x:0,opacity:1},exit:{x:64,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"absolute right-0 top-0 bottom-0",children:i.jsx(Awe,{agentId:d,onClose:()=>f(null),onOpenSettings:m?()=>R(d,m):void 0})},d)})]}),i.jsx(Ai,{value:"discovery",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(lM,{})}),i.jsx(Ai,{value:"agents",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(zwe,{agents:s,isLoading:t,onGoToDiscovery:I})}),i.jsx(Ai,{value:"denied",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(Uwe,{denied:c,isLoading:l})}),i.jsx(Ai,{value:"access",className:"min-h-0 flex-1 overflow-y-auto",children:i.jsx(Dwe,{onGoToDiscovery:I})})]})},"mode-b")}),v&&i.jsx($z,{projectPath:v,open:w,onOpenChange:S})]})}const cM=["config"],Vwe=["discovery","pulse","adapters"];function zp(){const e=Ve(),t=Yt(),n=g.useRef(new Set),r=g.useRef(new Set),{data:s,isLoading:a}=Tt({queryKey:[...cM],queryFn:()=>e.getConfig(),staleTime:300*1e3}),l={completedSteps:[],skippedSteps:[],startedAt:null,dismissedAt:null},c=s!=null&&s.onboarding?{completedSteps:s.onboarding.completedSteps,skippedSteps:s.onboarding.skippedSteps,startedAt:s.onboarding.startedAt,dismissedAt:s.onboarding.dismissedAt}:l,d=Vwe.every(w=>c.completedSteps.includes(w)),f=c.dismissedAt!==null,m=!a&&!d&&!f,p=Sn({mutationFn:w=>e.updateConfig({onboarding:w}),onSuccess:()=>{t.invalidateQueries({queryKey:[...cM]}).then(()=>{n.current.clear(),r.current.clear()})},onError:(w,S)=>{n.current.clear(),r.current.clear();const N=Object.keys(S).join(", ");Dn.error(`Failed to save onboarding progress (${N})`)}});function x(w){const S=new Set([...c.completedSteps,...n.current]);S.has(w)||(n.current.add(w),p.mutate({completedSteps:[...S,w]}))}function b(w){const S=new Set([...c.skippedSteps,...r.current]);S.has(w)||(r.current.add(w),p.mutate({skippedSteps:[...S,w]}))}function v(){return p.mutateAsync({dismissedAt:new Date().toISOString()})}function E(){c.startedAt||p.mutate({startedAt:new Date().toISOString()})}return{state:c,isLoading:a,isOnboardingComplete:d,isOnboardingDismissed:f,shouldShowOnboarding:m,completeStep:x,skipStep:b,dismiss:v,startOnboarding:E}}const qwe={default:"#1A1A1A",white:"#FFFFFF",orange:"#CE2021",current:"currentColor"};function hS({variant:e="default",size:t=40,className:n,style:r}){const s=qwe[e],a=t*(799/2325);return i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:a,viewBox:"0 0 2325 799",fill:"none",className:n,style:r,"aria-hidden":"true",children:[i.jsx("rect",{x:"50",y:"50",width:"2225",height:"699",stroke:s,strokeWidth:"100"}),i.jsx("path",{d:"M492.333 199.627L599.833 295.627L600 295.776V491.707L492.207 599.5H199.5V199.5H492.19L492.333 199.627ZM334 347.5V448.5H435V347.5H334Z",fill:s}),i.jsx("path",{d:"M1108.5 497.715L1108.34 497.862L1001.34 599.362L1001.2 599.5H699V296.283L699.158 296.135L802.158 199.635L802.303 199.5H1108.5V497.715ZM855 347.5V448.5H956V347.5H855Z",fill:s}),i.jsx("path",{d:"M1616.94 200.24L1510.07 395.005L1616.94 598.768L1617.64 600.103L1616.28 599.451L1409 500.056L1208.22 599.448L1207.5 599.806V199.5H1617.34L1616.94 200.24ZM1332 337.5V439.207L1433.71 337.5H1332Z",fill:s}),i.jsx("path",{d:"M1716.5 599V200L1841 291.5L2125 200L2017.5 400L2125 599L1841 501L1716.5 599Z",fill:s,stroke:s})]})}const uE=["Welcome","to","DorkOS"],Gwe=[{icon:lc,label:"Discover agents"},{icon:oc,label:"Schedule tasks"},{icon:Rw,label:"Connect channels"}];function Ywe({onGetStarted:e,onSkip:t}){const n=ic();return i.jsxs("div",{className:"mx-auto flex w-full max-w-md flex-col items-center px-4 text-center",children:[i.jsxs(ve.div,{className:"mb-6 opacity-80",initial:n?!1:{opacity:0,scale:.8},animate:{opacity:.8,scale:1},transition:{duration:.4},children:[i.jsx(hS,{size:150,className:"dark:hidden"}),i.jsx(hS,{variant:"white",size:150,className:"hidden dark:block"})]}),i.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:n?uE.join(" "):i.jsx(ve.span,{initial:"hidden",animate:"visible",variants:{visible:{transition:{staggerChildren:.08}}},children:uE.map((r,s)=>i.jsxs(ve.span,{className:"inline-block",variants:{hidden:{opacity:0,filter:"blur(4px)"},visible:{opacity:1,filter:"blur(0px)"}},transition:{duration:.4},children:[r,s<uE.length-1?" ":""]},s))})}),i.jsx(ve.p,{className:"mt-4 text-muted-foreground",initial:n?!1:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.5},children:"Let’s set up your AI agent workspace."}),i.jsx(ve.div,{className:"mt-10 flex gap-8",initial:n?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.6,duration:.4},children:Gwe.map(({icon:r,label:s},a)=>i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-muted",children:i.jsx(r,{className:"size-5 text-muted-foreground"})}),i.jsx("span",{className:"text-xs text-muted-foreground",children:s})]},a))}),i.jsxs(ve.div,{className:"mt-12 flex flex-col items-center gap-3",initial:n?!1:{opacity:0},animate:{opacity:1},transition:{delay:.8,duration:.4},children:[i.jsx(bB,{className:"px-6 py-2",duration:1.2,onClick:e,children:"Get Started"}),i.jsx("button",{onClick:t,className:"text-sm text-muted-foreground transition-colors hover:text-foreground",children:"Skip setup"})]})]})}function Kwe({onAgentCreated:e}){var b;const[t,n]=g.useState(""),[r,s]=g.useState(""),[a,l]=g.useState(""),[c,d]=g.useState(!1),[f,m]=g.useState(!1),p=$G(),x=g.useCallback(()=>{!t||!r.trim()||p.mutate({path:t,name:r.trim(),description:a.trim()||void 0},{onSuccess:()=>{m(!0),setTimeout(e,1200)}})},[t,r,a,p,e]);return f?i.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 py-12 text-center",children:[i.jsx(fp,{className:"text-primary size-12"}),i.jsx("h3",{className:"text-lg font-semibold",children:"Agent created"}),i.jsxs("p",{className:"text-muted-foreground text-sm",children:[i.jsx("span",{className:"font-medium",children:r})," is ready at"," ",i.jsx("span",{className:"font-mono text-xs",children:Mi(t)})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center space-y-6 py-8",children:[i.jsxs("div",{className:"space-y-2 text-center",children:[i.jsx("div",{className:"bg-muted mx-auto flex size-12 items-center justify-center rounded-full",children:i.jsx(uI,{className:"text-muted-foreground size-6"})}),i.jsx("h3",{className:"text-lg font-semibold",children:"No agents found"}),i.jsx("p",{className:"text-muted-foreground mx-auto max-w-sm text-sm",children:"Agents give your projects an identity. Each agent lives in a project directory and can have its own name, persona, and scheduled tasks."})]}),i.jsxs("div",{className:"w-full max-w-sm space-y-4",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Lt,{htmlFor:"agent-directory",children:"Project directory"}),i.jsxs("button",{id:"agent-directory",type:"button",onClick:()=>d(!0),className:`border-input bg-background hover:bg-accent flex h-10 w-full items-center gap-2 rounded-md border px-3 text-sm transition-colors ${t?"text-foreground":"text-muted-foreground"}`,children:[i.jsx(Ii,{className:"size-4 flex-shrink-0"}),i.jsx("span",{className:"truncate",children:t?Mi(t):"Select a directory..."})]}),i.jsx(qx,{open:c,onOpenChange:d,onSelect:n})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Lt,{htmlFor:"agent-name",children:"Agent name"}),i.jsx(ts,{id:"agent-name",type:"text",placeholder:"e.g. my-project",value:r,onChange:v=>s(v.target.value)})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Lt,{htmlFor:"agent-persona",children:["Persona ",i.jsx("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),i.jsx(F2,{id:"agent-persona",placeholder:"Describe what this agent does...",value:a,onChange:v=>l(v.target.value),rows:3})]}),i.jsx(tt,{className:"w-full",onClick:x,disabled:!t||!r.trim()||p.isPending,children:p.isPending?i.jsxs(i.Fragment,{children:[i.jsx(Gn,{className:"size-4 animate-spin"}),"Creating..."]}):"Create agent"}),p.isError&&i.jsxs("p",{className:"text-destructive text-center text-sm",children:["Failed to create agent. ",((b=p.error)==null?void 0:b.message)??"Please try again."]})]})]})}function Wwe(e){return[...e].sort((t,n)=>{const r=t.strategy==="dork-manifest",s=n.strategy==="dork-manifest";return r!==s?r?-1:1:t.path.localeCompare(n.path)})}function Xwe({onStepComplete:e}){const{startScan:t}=qz(),{candidates:n,isScanning:r,progress:s,error:a}=BC(),l=Oz(),[c,d]=g.useState(new Set),[f,m]=g.useState(!1),p=ic(),x=g.useRef(!1);g.useEffect(()=>{x.current||(x.current=!0,m(!0),t())},[t]);const b=g.useMemo(()=>r?n:Wwe(n),[n,r]),v=g.useCallback(I=>{d(L=>new Set(L).add(I))},[]),E=g.useCallback(I=>{v(I.path),l.mutate({path:I.path,overrides:{name:I.hints.suggestedName,runtime:I.hints.detectedRuntime,...I.hints.inferredCapabilities?{capabilities:I.hints.inferredCapabilities}:{},...I.hints.description?{description:I.hints.description}:{}}})},[l,v]),w=g.useCallback(I=>{v(I.path)},[v]),S=g.useCallback(()=>{d(new Set),m(!0),t()},[t]),N=g.useCallback(()=>{S()},[S]),A=n.length>0,j=f&&!r,R=j&&!A,_=A&&n.every(I=>c.has(I.path)),D=b.filter(I=>!c.has(I.path));return i.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center",children:[i.jsxs("div",{className:"w-full shrink-0 text-center",children:[i.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:r&&!A?"Searching your projects...":"Discovered Agents"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"We’ll find AI-configured projects on your machine."})]}),r&&!A&&i.jsxs("div",{className:"mt-8 flex shrink-0 flex-col items-center gap-4",children:[i.jsx(ve.div,{animate:p?{}:{scale:[1,1.15,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"},children:i.jsx(lc,{className:"size-8 text-muted-foreground"})}),s&&i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Scanned ",s.scannedDirs," directories"]})]}),r&&A&&s&&i.jsxs("div",{className:"mt-4 shrink-0 text-center text-sm text-muted-foreground",children:["Scanning... ",s.scannedDirs," directories · Found ",s.foundAgents," agent",s.foundAgents===1?"":"s"]}),j&&A&&i.jsxs("p",{className:"mt-4 shrink-0 text-center text-sm text-muted-foreground",children:["Found ",n.length," project",n.length===1?"":"s",". Approve or skip each one."]}),a&&i.jsx("div",{className:"mt-6 shrink-0 rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:a}),A&&i.jsx("div",{className:"mt-4 min-h-0 w-full flex-1 overflow-y-auto pr-1",children:i.jsx("div",{className:"space-y-3",children:i.jsx(Ze,{mode:"popLayout",children:D.map(I=>i.jsx(Gz,{candidate:I,onApprove:E,onSkip:w},I.path))})})}),R&&i.jsxs("div",{className:"mt-8 w-full",children:[i.jsx(Kwe,{onAgentCreated:N}),i.jsx("div",{className:"mt-4 flex justify-center",children:i.jsx(tt,{variant:"outline",onClick:S,children:"Scan Again"})})]}),j&&A&&i.jsx("div",{className:"mt-4 flex shrink-0 flex-col items-center gap-2 border-t pt-4",children:i.jsx(tt,{size:"lg",onClick:e,variant:_?"default":"outline",children:"Continue"})})]})}function Qwe({onStepComplete:e,agents:t}){const{data:n,isLoading:r,isError:s}=$S(),a=b4(),[l,c]=g.useState(null),[d,f]=g.useState(!1),[m,p]=g.useState(null),x=t.length===1?t[0]:t.find(N=>N.id===m)??null,b=g.useMemo(()=>l??new Set((n==null?void 0:n.map(N=>N.id))??[]),[l,n]),v=g.useCallback(N=>{c(A=>{const j=A??new Set((n==null?void 0:n.map(_=>_.id))??[]),R=new Set(j);return R.has(N)?R.delete(N):R.add(N),R})},[n]),E=b.size,w=E>0&&x!==null,S=g.useCallback(async()=>{if(!n||E===0||!x){e();return}f(!0);const N=n.filter(R=>b.has(R.id)),j=(await Promise.allSettled(N.map(R=>a.mutateAsync({name:R.name,prompt:R.prompt,cron:R.cron,cwd:x.projectPath})))).filter(R=>R.status==="rejected");j.length>0&&(console.error("[PulsePresetsStep] Schedule creation failures:",j),Dn.warning(`${j.length} of ${N.length} schedule(s) failed to create. You can retry from Pulse later.`)),f(!1),e()},[n,E,b,x,a,e]);return i.jsxs("div",{className:"mx-auto w-full max-w-2xl flex-1 space-y-4 overflow-y-auto px-4",children:[i.jsxs("div",{className:"space-y-2 text-center",children:[i.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Want your agents to work while you sleep?"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Pulse runs automated tasks on a schedule — like a cron job for your agents."})]}),t.length===1&&i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Scheduling for ",t[0].icon?`${t[0].icon} `:"",t[0].name]}),t.length>=2&&i.jsx("div",{className:"mx-auto max-w-xs",children:i.jsxs(On,{value:m??"",onValueChange:p,children:[i.jsx(An,{children:i.jsx(In,{placeholder:"Select a project..."})}),i.jsx(jn,{children:t.map(N=>i.jsxs(ft,{value:N.id,children:[N.icon?`${N.icon} `:"",N.name]},N.id))})]})}),r&&i.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Loading presets..."}),s&&i.jsx("p",{className:"text-center text-sm text-destructive",children:"Failed to load presets. You can skip this step and configure schedules later."}),n&&n.length>0&&i.jsx("div",{className:"grid gap-3",children:n.map(N=>i.jsx(Fz,{preset:N,variant:"toggle",checked:b.has(N.id),onCheckedChange:()=>v(N.id)},N.id))}),i.jsxs("div",{className:"flex flex-col items-center gap-3 pt-2",children:[i.jsx(tt,{onClick:S,size:"lg",disabled:d||E>0&&!w,children:d?"Creating...":E>0?`Create ${E} Schedule${E===1?"":"s"}`:"Continue Without Schedules"}),t.length>=2&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"You can put your other agents on autopilot anytime from Pulse."})]})]})}const dE=["You're","all","set!"];function Zwe({onComplete:e}){const t=ic(),{state:n}=zp(),r=g.useRef(!1);g.useEffect(()=>{r.current||(r.current=!0,r4())},[]);const s=n.completedSteps.includes("discovery"),a=n.completedSteps.includes("pulse"),l=[{icon:NI,label:s?"Agents discovered":"Agents skipped",done:s},{icon:oc,label:a?"Schedules created":"Schedules skipped",done:a},{icon:Rw,label:"Adapters: coming soon",done:!1}];return i.jsxs(ve.div,{initial:t?!1:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.3,ease:"easeOut"},className:"mx-auto flex w-full max-w-md flex-col items-center gap-8 px-4 text-center",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h2",{className:"text-3xl font-semibold tracking-tight",children:t?dE.join(" "):i.jsx(ve.span,{initial:"hidden",animate:"visible",variants:{visible:{transition:{staggerChildren:.08}}},children:dE.map((c,d)=>i.jsxs(ve.span,{className:"inline-block",variants:{hidden:{opacity:0,filter:"blur(4px)"},visible:{opacity:1,filter:"blur(0px)"}},transition:{duration:.4},children:[c,d<dE.length-1?" ":""]},d))})}),i.jsx("p",{className:"text-muted-foreground",children:"Your workspace is configured and ready."})]}),i.jsx(ve.div,{className:"w-full space-y-3",initial:"hidden",animate:"visible",variants:t?{}:{visible:{transition:{staggerChildren:.12,delayChildren:.3}}},children:l.map(({icon:c,label:d,done:f})=>i.jsxs(ve.div,{variants:t?{}:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0}},transition:{duration:.3},className:"flex items-center gap-3 rounded-lg border p-4",children:[i.jsx(c,{className:`size-5 ${f?"text-primary":"text-muted-foreground/50"}`}),i.jsx("span",{className:f?"text-sm":"text-sm text-muted-foreground",children:d})]},d))}),i.jsx(ve.div,{initial:t?!1:{opacity:0},animate:{opacity:1},transition:{delay:.8,duration:.4},children:i.jsx(bB,{className:"px-6 py-2",duration:1.2,onClick:e,children:"Start your first session"})})]})}const Og=["discovery","pulse"];function Yz({onComplete:e,initialStep:t=-1}){var D;const[n,r]=g.useState(t),[s,a]=g.useState(1),[l,c]=g.useState(!1),{completeStep:d,skipStep:f,dismiss:m,startOnboarding:p}=zp(),x=Hi(),b=ic(),v=DC();g.useEffect(()=>{p()},[]);const E=g.useCallback(()=>{n<Og.length-1?(a(1),r(I=>I+1)):(d("adapters"),c(!0))},[n,d]),w=g.useCallback(()=>{n>0?(a(-1),r(I=>I-1)):n===0&&(a(-1),r(-1))},[n]),S=g.useCallback(()=>{d(Og[n]),E()},[n,d,E]),N=g.useCallback(()=>{f(Og[n]),E()},[n,f,E]),A=g.useCallback(async()=>{await m(),e()},[m,e]),j=g.useCallback(()=>{a(1),r(0)},[]);if(g.useEffect(()=>{var I;n===1&&!v.isLoading&&((I=v.data)==null?void 0:I.agents.length)===0&&(d("pulse"),E())},[n,v.isLoading,v.data,d,E]),l)return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background",children:i.jsx(Zwe,{onComplete:e})});if(n===-1)return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background",children:i.jsx(Ywe,{onGetStarted:j,onSkip:A})});const R=x?150:300,_=b?{enter:{opacity:0},center:{opacity:1},exit:{opacity:0}}:{enter:I=>({x:I>0?R:-R,opacity:0,scale:.98,filter:"blur(2px)"}),center:{x:0,opacity:1,scale:1,filter:"blur(0px)"},exit:I=>({x:I>0?-R:R,opacity:0,scale:.98,filter:"blur(2px)"})};return i.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-background",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 sm:px-6",children:[i.jsx(tt,{variant:"ghost",size:"sm",onClick:w,className:"min-w-16",children:"Back"}),i.jsx("div",{className:"flex items-center gap-2",children:Og.map((I,L)=>i.jsx("div",{className:"relative flex items-center justify-center",children:L===n?i.jsx(ve.div,{layoutId:"step-indicator",className:"flex h-2 w-6 items-center justify-center rounded-full bg-primary",transition:{type:"spring",damping:25,stiffness:200}}):L<n?i.jsx("div",{className:"flex size-2 items-center justify-center rounded-full bg-primary/60",children:i.jsx(Tn,{className:"size-1.5 text-primary-foreground"})}):i.jsx("div",{className:oe("size-2 rounded-full ring-1 ring-muted-foreground/30")})},L))}),i.jsxs("div",{className:"flex min-w-16 items-center justify-end gap-1",children:[i.jsx(tt,{variant:"ghost",size:"sm",onClick:N,children:"Skip"}),i.jsx(tt,{variant:"ghost",size:"sm",onClick:A,className:"text-muted-foreground",children:"Skip all"})]})]}),i.jsx("div",{className:"relative flex-1 overflow-hidden",children:i.jsx(Ze,{mode:"wait",custom:s,children:i.jsx(ve.div,{custom:s,variants:_,initial:"enter",animate:"center",exit:"exit",transition:{type:b?"tween":"spring",damping:25,stiffness:200,duration:b?.15:void 0},className:"absolute inset-0 flex flex-col",children:i.jsxs("div",{className:"mx-auto flex min-h-0 w-full max-w-2xl flex-1 flex-col px-4 py-4 sm:px-6",children:[n===0&&i.jsx(Xwe,{onStepComplete:S}),n===1&&i.jsx(Qwe,{onStepComplete:S,agents:((D=v.data)==null?void 0:D.agents)??[]})]})},n)})})]})}const fE={discovery:"Discover agents",pulse:"Set up Pulse schedules",adapters:"Connect adapters"},Jwe=["discovery","pulse"];function e2e({onStepClick:e,onDismiss:t}){const{state:n}=zp(),r=ic();return i.jsxs(ve.div,{initial:r?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3},className:"border-border bg-card relative rounded-lg border p-3",children:[i.jsx("button",{onClick:t,className:"text-muted-foreground/50 hover:text-muted-foreground absolute right-1.5 top-1.5 rounded-md p-0.5 transition-colors duration-150","aria-label":"Dismiss getting started",children:i.jsx(wr,{className:"size-3.5"})}),i.jsx("h3",{className:"text-xs font-medium mb-2",children:"Getting Started"}),i.jsx("ul",{className:"space-y-1",children:Jwe.map((s,a)=>{const l=n.completedSteps.includes(s),c=n.skippedSteps.includes(s);return l?i.jsxs("li",{className:"flex items-center gap-2 py-0.5",children:[i.jsx(Tn,{className:"text-primary size-3.5 shrink-0"}),i.jsx("span",{className:"text-muted-foreground text-xs",children:fE[s]})]},s):c?i.jsxs("li",{className:"flex items-center gap-2 py-0.5",children:[i.jsx(cee,{className:"text-muted-foreground/40 size-3.5 shrink-0"}),i.jsx("button",{onClick:()=>e(a),className:oe("text-muted-foreground/40 text-xs text-left transition-colors duration-150","hover:text-muted-foreground"),children:fE[s]})]},s):i.jsxs("li",{className:"flex items-center gap-2 py-0.5",children:[i.jsx(Cw,{className:"text-muted-foreground size-3.5 shrink-0"}),i.jsx("button",{onClick:()=>e(a),className:"text-foreground text-xs text-left transition-colors duration-150 hover:underline",children:fE[s]})]},s)})})]})}function t2e(){const{settingsOpen:e,setSettingsOpen:t,pulseOpen:n,setPulseOpen:r,relayOpen:s,setRelayOpen:a,meshOpen:l,setMeshOpen:c,pickerOpen:d,setPickerOpen:f,agentDialogOpen:m,setAgentDialogOpen:p,onboardingStep:x,setOnboardingStep:b,recentCwds:v}=He(),[E,w]=Cd(),S=g.useMemo(()=>v.map(A=>A.path),[v]),{data:N}=d4(S);return i.jsxs(i.Fragment,{children:[i.jsx(mTe,{open:e,onOpenChange:t}),i.jsx(qx,{open:d,onOpenChange:f,onSelect:A=>w(A),initialPath:E,resolvedAgents:N}),i.jsx(ys,{open:n,onOpenChange:r,children:i.jsxs(vs,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[i.jsx(Yu,{}),i.jsxs($a,{className:"border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Pulse Scheduler"}),i.jsx(Zs,{className:"sr-only",children:"Manage scheduled AI agent tasks"})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i.jsx(pSe,{})})]})}),i.jsx(ys,{open:s,onOpenChange:a,children:i.jsxs(vs,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[i.jsx(Yu,{}),i.jsxs($a,{className:"border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Connections"}),i.jsx(Zs,{className:"sr-only",children:"Manage adapters and monitor message activity"})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i.jsx(xwe,{})})]})}),i.jsx(ys,{open:l,onOpenChange:c,children:i.jsxs(vs,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[i.jsx(Yu,{}),i.jsxs($a,{className:"border-b px-4 py-3",children:[i.jsx(Qs,{className:"text-sm font-medium",children:"Mesh"}),i.jsx(Zs,{className:"sr-only",children:"Agent discovery and registry"})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i.jsx($we,{})})]})}),E&&i.jsx($z,{projectPath:E,open:m,onOpenChange:p}),x!==null&&i.jsx("div",{className:"fixed inset-0 z-50 bg-background",children:i.jsx(Yz,{initialStep:x,onComplete:()=>b(null)})})]})}const hE=["light","dark","system"],n2e={light:Kee,dark:xI,system:dee};function r2e(){const{setSettingsOpen:e,setAgentDialogOpen:t,devtoolsOpen:n,toggleDevtools:r}=He(),{theme:s,setTheme:a}=J0(),l=n2e[s],c=g.useCallback(()=>{const d=hE.indexOf(s);a(hE[(d+1)%hE.length])},[s,a]);return i.jsxs("div",{className:"border-border flex items-center border-t px-2 py-1.5",children:[i.jsx("a",{href:"https://dorkos.ai",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors duration-150",children:i.jsx(hS,{variant:"current",size:60})}),i.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[i.jsx("button",{onClick:()=>t(!0),className:"text-muted-foreground/50 hover:text-muted-foreground rounded-md p-1 transition-colors duration-150","aria-label":"Edit agent",children:i.jsx(yI,{className:"size-(--size-icon-sm)"})}),i.jsx("button",{onClick:()=>e(!0),className:"text-muted-foreground/50 hover:text-muted-foreground rounded-md p-1 transition-colors duration-150","aria-label":"Settings",children:i.jsx(cx,{className:"size-(--size-icon-sm)"})}),i.jsx("button",{onClick:c,className:"text-muted-foreground/50 hover:text-muted-foreground rounded-md p-1 transition-colors duration-150","aria-label":`Theme: ${s}. Click to cycle.`,title:`Theme: ${s}`,children:i.jsx(l,{className:"size-(--size-icon-sm)"})}),!1]})]})}const s2e=[{id:"sessions",icon:_w,label:"Sessions",shortcut:1},{id:"schedules",icon:oc,label:"Schedules",shortcut:2},{id:"connections",icon:EI,label:"Connections",shortcut:3}],a2e={ok:"bg-green-500",partial:"bg-amber-500",error:"bg-red-500"};function i2e({activeTab:e,onTabChange:t,schedulesBadge:n,connectionsStatus:r,visibleTabs:s}){const a=g.useRef(null),l=Sd?"⌘":"Ctrl+",c=g.useCallback(f=>{var x,b;const m=s.indexOf(e);let p=m;if(f.key==="ArrowRight"?(p=(m+1)%s.length,f.preventDefault()):f.key==="ArrowLeft"&&(p=(m-1+s.length)%s.length,f.preventDefault()),p!==m){t(s[p]);const v=(x=a.current)==null?void 0:x.querySelectorAll('[role="tab"]');(b=v==null?void 0:v[p])==null||b.focus()}},[e,t,s]),d=s2e.filter(f=>s.includes(f.id));return i.jsx("div",{ref:a,role:"tablist","aria-label":"Sidebar views",tabIndex:-1,className:"border-border relative flex items-center gap-1 border-b px-2 py-1.5",onKeyDown:c,children:d.map(f=>{const m=e===f.id,p=f.icon;return i.jsxs(Cs,{children:[i.jsx(Ns,{asChild:!0,children:i.jsxs("button",{role:"tab",id:`sidebar-tab-${f.id}`,"aria-selected":m,"aria-controls":`sidebar-tabpanel-${f.id}`,tabIndex:m?0:-1,onClick:()=>t(f.id),className:oe("relative rounded-md p-2 transition-colors duration-150",m?"text-foreground":"text-muted-foreground/50 hover:text-muted-foreground"),children:[i.jsx(p,{className:"size-(--size-icon-sm)"}),f.id==="schedules"&&n>0&&i.jsxs("span",{className:"absolute -right-0.5 -top-0.5 flex size-4 items-center justify-center rounded-full bg-green-500 text-[10px] font-medium text-white",children:[n>9?"9+":n,i.jsx("span",{className:"absolute inset-0 animate-pulse rounded-full bg-green-500/30"})]}),f.id==="connections"&&r!=="none"&&i.jsx("span",{className:oe("absolute -right-0.5 -top-0.5 size-1.5 rounded-full",a2e[r])}),m&&i.jsx(ve.div,{layoutId:"sidebar-tab-indicator",className:"bg-brand absolute right-0 bottom-[-7px] left-0 h-0.5 rounded-full",transition:{type:"spring",stiffness:280,damping:32}})]})}),i.jsxs(ks,{side:"bottom",children:[f.label," ",`${l}${f.shortcut}`]})]},f.id)})})}function uM(e){try{return new Date(e).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function o2e({text:e,label:t}){const[n,r]=g.useState(!1),s=g.useCallback(async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),Ts.COPY_FEEDBACK_MS)}catch{}},[e]);return i.jsx("button",{onClick:s,className:"hover:bg-secondary/80 text-muted-foreground/60 hover:text-muted-foreground rounded p-0.5 transition-colors duration-100 max-md:p-2","aria-label":`Copy ${t}`,children:n?i.jsx(Tn,{className:"size-(--size-icon-xs) text-green-500"}):i.jsx(Nw,{className:"size-(--size-icon-xs)"})})}function l2e({session:e,isActive:t,onClick:n,isNew:r=!1}){const[s,a]=g.useState(!1),l=e.permissionMode==="bypassPermissions",c=r?ve.div:"div",d=r?{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.2,ease:[0,0,.2,1]}}:{};function f(m){m.stopPropagation(),a(p=>!p)}return i.jsxs(c,{...d,"data-testid":"session-item",className:oe("group relative rounded-lg transition-colors duration-150",t?"text-foreground border-primary border-l-2":"border-l-2 border-transparent"),children:[t&&i.jsx(ve.div,{layoutId:"active-session-bg",className:"absolute inset-0 rounded-lg bg-secondary",transition:{type:"spring",stiffness:280,damping:32}}),i.jsxs(ve.div,{role:"button",tabIndex:0,onClick:()=>{n()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n())},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:30},className:"relative z-10 cursor-pointer px-3 py-2",children:[i.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"min-w-0 flex-1",children:Ih(e.updatedAt)}),i.jsxs("span",{className:"flex flex-shrink-0 items-center gap-1",children:[l&&i.jsx(wI,{className:"size-(--size-icon-xs) text-red-500","aria-label":"Permissions skipped"}),i.jsx("button",{onClick:f,className:oe("rounded p-0.5 transition-all duration-150 max-md:hidden max-md:p-2",s?"text-muted-foreground opacity-100":"text-muted-foreground/60 hover:text-muted-foreground opacity-0 group-hover:opacity-100"),"aria-label":"Session details",children:i.jsx(ve.div,{animate:{rotate:s?180:0},transition:{type:"spring",stiffness:400,damping:30},children:i.jsx(Ss,{className:"size-(--size-icon-sm)"})})})]})]}),i.jsx("div",{className:"text-muted-foreground/70 mt-0.5 truncate text-xs",children:e.title})]}),i.jsx(Ze,{initial:!1,children:s&&i.jsx(ve.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:[0,0,.2,1]},className:"overflow-hidden",children:i.jsxs("div",{className:"text-muted-foreground border-border/30 mx-2 space-y-1.5 border-t px-3 pt-2 pb-2 text-[11px]",children:[i.jsx(Ig,{label:"Session ID",value:e.id,copyable:!0}),i.jsx(Ig,{label:"Created",value:uM(e.createdAt)}),i.jsx(Ig,{label:"Updated",value:uM(e.updatedAt)}),i.jsx(Ig,{label:"Permissions",value:l?"Skip (unsafe)":"Default"})]})})})]})}function Ig({label:e,value:t,copyable:n=!1}){return i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-muted-foreground/60 w-16 flex-shrink-0",children:e}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono select-all",children:t}),n&&i.jsx(o2e,{text:t,label:e})]})}function c2e({activeSessionId:e,groupedSessions:t,onSessionClick:n}){return i.jsx(Vx,{type:"scroll",className:"h-full",viewportClassName:"[&>div]:!block",children:i.jsx(ve.div,{layout:!0,children:t.length>0?i.jsx(i.Fragment,{children:t.map(r=>{const s=t.length===1&&r.label==="Today";return i.jsxs(Xu,{children:[!s&&i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:r.label}),i.jsx(La,{children:r.sessions.map(a=>i.jsx(Pa,{children:i.jsx(l2e,{session:a,isActive:a.id===e,onClick:()=>n(a.id)})},a.id))})]},r.label)})}):i.jsx("div",{className:"flex h-32 items-center justify-center",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No conversations yet"})})})})}function u2e({toolStatus:e,agentId:t}){const n=He(v=>v.setPulseOpen),r=He(v=>v.openPulseForAgent),s=He(v=>v.openPulseToEdit),a=e!=="disabled-by-server",{data:l=[]}=x4(a),{data:c=0}=US(a),{data:d=[]}=$S(),{openWithPreset:f}=VS(),m=[d[0],d[2]].filter(Boolean),p=t?l.filter(v=>v.agentId===t):l;if(e==="disabled-by-agent")return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 px-4 py-8",children:[i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Pulse disabled for this agent"}),i.jsx("button",{onClick:()=>t?r(t):n(!0),className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Pulse →"})]});if(p.length===0)return i.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[i.jsx("p",{className:"text-xs text-muted-foreground/70",children:"No schedules yet."}),m.length>0&&i.jsx("div",{className:"space-y-2",children:m.map(v=>i.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[i.jsx("div",{className:"font-medium",children:v.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:Bz(v.cron)}),i.jsx("button",{type:"button",onClick:()=>{f(v),t?r(t):n(!0)},className:"mt-2 text-xs text-primary hover:underline",children:"+ Use preset"})]},v.id))}),i.jsx("button",{onClick:()=>t?r(t):n(!0),className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Pulse →"})]});const x=p.filter(v=>v.enabled&&v.status==="active"),b=p.filter(v=>!v.enabled||v.status!=="active");return i.jsx(Vx,{type:"scroll",className:"h-full",children:i.jsxs("div",{className:"pr-1",children:[x.length>0&&i.jsxs(Xu,{children:[i.jsxs(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Active",c>0&&i.jsxs("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:[c," running"]})]}),i.jsx(La,{children:x.map(v=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>s(v.id),className:"text-sm",children:[i.jsx("span",{className:"size-2 shrink-0 animate-pulse rounded-full bg-green-500"}),i.jsx("span",{className:"truncate",children:v.name})]})},v.id))})]}),b.length>0&&i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),i.jsx(La,{children:b.map(v=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>s(v.id),className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",v.enabled?"bg-muted-foreground/40":"bg-muted-foreground/20")}),i.jsx("span",{className:"truncate",children:v.name}),v.nextRun&&i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:Ih(v.nextRun)})]})},v.id))})]}),i.jsx("div",{className:"px-3 py-2",children:i.jsx("button",{onClick:()=>t?r(t):n(!0),className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Pulse →"})})]})})}const d2e={connected:"bg-green-500",disconnected:"bg-amber-500",error:"bg-red-500"},f2e={enabled:"bg-green-500","disabled-by-agent":"bg-muted-foreground/20","disabled-by-server":"bg-muted-foreground/20"},dM={connected:"bg-green-500",failed:"bg-red-500","needs-auth":"bg-amber-500",pending:"bg-amber-500",disabled:"bg-muted-foreground/20"},h2e=[{key:"pulse",label:"Pulse"},{key:"relay",label:"Relay"},{key:"mesh",label:"Mesh"}],pE=3,mE=4,cb=[0,0,.2,1],fM={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0}},hM={duration:.2,ease:cb},pM={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0}},mM={duration:.25,ease:cb},gM={initial:{opacity:0,y:3},animate:{opacity:1,y:0},exit:{opacity:0,y:-3}},xM={duration:.12,ease:cb},Su={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},wu={duration:.15,ease:cb};function p2e({toolStatus:e,agentId:t}){const{setRelayOpen:n,setMeshOpen:r,setAgentDialogOpen:s,selectedCwd:a}=He(),l=e.relay!=="disabled-by-server",c=e.mesh!=="disabled-by-server",{data:d=[]}=p4(l),{data:f=[]}=OC(),{data:m}=Gi(void 0,c),p=g.useMemo(()=>(m==null?void 0:m.agents)??[],[m==null?void 0:m.agents]),{data:x}=BY(a),b=(x==null?void 0:x.servers)??[],v=b.slice(0,mE),E=Math.max(0,b.length-mE),{data:w,isLoading:S}=BTe(t??"",c&&!!t),N=g.useMemo(()=>{const G=Y=>Y.config.type==="claude-code"&&Y.config.builtin===!0;if(!t)return d.filter(G);const J=new Set(f.filter(Y=>Y.agentId===t).map(Y=>Y.adapterId));return d.filter(Y=>G(Y)||J.has(Y.config.id))},[d,f,t]),A=g.useMemo(()=>{if(!t||S||!w)return p;const G=new Set(w.agents.map(J=>J.id));return p.filter(J=>G.has(J.id))},[p,t,w,S]),j=A.slice(0,pE),R=Math.max(0,A.length-pE),[_,D]=g.useState(!1),[I,L]=g.useState(!1),B=l,X=c;return i.jsx(Vx,{type:"scroll",className:"h-full",children:i.jsxs("div",{className:"pr-1",children:[i.jsx(Ze,{initial:!1,children:B&&i.jsx(ve.div,{variants:pM,initial:"initial",animate:"animate",exit:"exit",transition:mM,className:"overflow-hidden",children:i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Adapters"}),i.jsx(Uv,{"aria-label":"Open Relay panel",onClick:()=>n(!0),children:i.jsx(Uu,{})}),i.jsx(Ze,{mode:"wait",initial:!1,children:e.relay==="disabled-by-agent"?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Relay disabled for this agent"})},"relay-disabled"):N.length===0?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No adapters configured"})},"relay-empty"):i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,children:i.jsx(La,{children:N.map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>n(!0),className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",d2e[G.status.state]??"bg-muted-foreground/20",G.status.state==="connected"&&"animate-pulse")}),i.jsx("span",{className:"truncate",children:G.status.displayName}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs capitalize",children:G.status.state})]})},G.config.id))})},"relay-list")})]})})}),i.jsx(Ze,{initial:!1,children:X&&i.jsx(ve.div,{variants:pM,initial:"initial",animate:"animate",exit:"exit",transition:mM,className:"overflow-hidden",children:i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Agents"}),i.jsx(Uv,{"aria-label":"Open Mesh panel",onClick:()=>r(!0),children:i.jsx(Uu,{})}),i.jsx(Ze,{mode:"wait",initial:!1,children:e.mesh==="disabled-by-agent"?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Mesh disabled for this agent"})},"mesh-disabled"):A.length===0?i.jsx(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,className:"px-3 py-2",children:i.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No agents registered"})},"mesh-empty"):i.jsxs(ve.div,{variants:Su,initial:"initial",animate:"animate",exit:"exit",transition:wu,children:[i.jsx(La,{children:j.map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>r(!0),className:"text-sm",children:[i.jsx("span",{className:"size-2 shrink-0 rounded-full bg-muted-foreground/40"}),i.jsx("span",{className:"truncate",children:G.name})]})},G.id))}),i.jsx(Ze,{initial:!1,children:_&&i.jsx(ve.div,{variants:fM,initial:"initial",animate:"animate",exit:"exit",transition:hM,className:"overflow-hidden",children:i.jsx(La,{children:A.slice(pE).map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{onClick:()=>r(!0),className:"text-sm",children:[i.jsx("span",{className:"size-2 shrink-0 rounded-full bg-muted-foreground/40"}),i.jsx("span",{className:"truncate",children:G.name})]})},G.id))})})})]},"mesh-list")}),R>0&&i.jsx("div",{className:"px-3 py-1",children:i.jsx("button",{onClick:()=>D(G=>!G),className:"text-muted-foreground hover:text-foreground relative text-xs transition-colors",children:i.jsx(Ze,{mode:"wait",initial:!1,children:i.jsx(ve.span,{variants:gM,initial:"initial",animate:"animate",exit:"exit",transition:xM,className:"block",children:_?"Show less":`+ ${R} more ${R===1?"agent":"agents"} reachable →`},_?"less":"more")})})})]})})}),i.jsxs(Xu,{children:[i.jsx(Qu,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Tools"}),i.jsx(Uv,{"aria-label":"Edit capabilities",onClick:()=>s(!0),children:i.jsx(Uu,{})}),i.jsx(La,{children:h2e.map(({key:G,label:J})=>{const Y=e[G];return i.jsx(Pa,{children:i.jsxs(Ei,{className:"text-sm",onClick:()=>s(!0),children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",f2e[Y])}),i.jsx("span",{className:"truncate",children:J}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:Y==="enabled"?"enabled":"off"})]})},G)})}),i.jsx(La,{children:v.map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",dM[G.status??""]??"bg-muted-foreground/40",G.status==="connected"&&"animate-pulse")}),i.jsx("span",{className:"truncate",children:G.name}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:"mcp"})]})},G.name))}),i.jsx(Ze,{initial:!1,children:I&&i.jsx(ve.div,{variants:fM,initial:"initial",animate:"animate",exit:"exit",transition:hM,className:"overflow-hidden",children:i.jsx(La,{children:b.slice(mE).map(G=>i.jsx(Pa,{children:i.jsxs(Ei,{className:"text-sm",children:[i.jsx("span",{className:oe("size-2 shrink-0 rounded-full",dM[G.status??""]??"bg-muted-foreground/40",G.status==="connected"&&"animate-pulse")}),i.jsx("span",{className:"truncate",children:G.name}),i.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs",children:"mcp"})]})},G.name))})})}),E>0&&i.jsx("div",{className:"px-3 py-1",children:i.jsx("button",{onClick:()=>L(G=>!G),className:"text-muted-foreground hover:text-foreground relative text-xs transition-colors",children:i.jsx(Ze,{mode:"wait",initial:!1,children:i.jsx(ve.span,{variants:gM,initial:"initial",animate:"animate",exit:"exit",transition:xM,className:"block",children:I?"Show less":`+ ${E} more ${E===1?"server":"servers"} →`},I?"less":"more")})})})]})]})})}function m2e(e){const t=T4(e),n=t.relay!=="disabled-by-server",r=t.mesh!=="disabled-by-server",{data:s}=p4(n),{data:a}=Gi(void 0,r),l=a==null?void 0:a.agents;return g.useMemo(()=>{const c=s??[],d=l??[];return c.length===0&&d.length===0?"none":c.some(f=>f.status.state==="error")?"error":c.every(f=>f.status.state==="connected")?"ok":"partial"},[s,l])}function bM(){const{sessions:e,activeSessionId:t,setActiveSession:n}=PS(),{setSidebarOpen:r,setPulseOpen:s,setOnboardingStep:a}=He(),l=Hi(),c=g.useRef(!1),d=kd(),{unviewedCount:f,clearBadge:m}=PY(d),p=He(W=>W.enablePulseNotifications),{shouldShowOnboarding:x,dismiss:b}=zp(),v=He(W=>W.pulseOpen),E=g.useContext(_C);g.useEffect(()=>{if(c.current){c.current=!1;return}!t&&e.length>0&&n(e[0].id)},[t,e,n]);const w=g.useCallback(()=>{c.current=!0,n(null),l&&setTimeout(()=>{r(!1),E==null||E.setOpenMobile(!1)},Ts.SIDEBAR_AUTO_CLOSE_MS)},[n,l,r,E]),S=g.useCallback(W=>{n(W),l&&(r(!1),E==null||E.setOpenMobile(!1))},[l,n,r,E]);g.useEffect(()=>{v&&m()},[v,m]);const N=g.useRef(0);g.useEffect(()=>{p&&(f>N.current&&Dn("Pulse run completed",{description:"A scheduled run has finished.",duration:6e3,action:{label:"View history",onClick:()=>s(!0)}}),N.current=f)},[f,p,s]);const A=He(W=>W.setPulseBadgeCount);g.useEffect(()=>(A(f),()=>A(0)),[f,A]);const j=g.useMemo(()=>mG(e),[e]),{sidebarActiveTab:R,setSidebarActiveTab:_}=He(),D=He(W=>W.selectedCwd),{data:I}=ex(D),L=T4(D),B=L.pulse!=="disabled-by-server",{data:X=0}=US(B),G=m2e(D),J=g.useMemo(()=>{const W=["sessions"];return B&&W.push("schedules"),W.push("connections"),W},[B]);g.useEffect(()=>{J.includes(R)||_("sessions")},[J,R,_]);const Y=He(W=>W.sidebarOpen);return g.useEffect(()=>{if(!Y)return;const W=F=>{if(!(F.metaKey||F.ctrlKey))return;const z={1:"sessions",2:"schedules",3:"connections"}[F.key];z&&J.includes(z)&&(F.preventDefault(),_(z))};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[Y,J,_]),g.useEffect(()=>{const W=F=>{(F.metaKey||F.ctrlKey)&&F.shiftKey&&F.key==="N"&&(F.preventDefault(),w())};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[w]),i.jsxs(i.Fragment,{children:[i.jsx(oEe,{className:"border-b p-3",children:i.jsx(La,{children:i.jsx(Pa,{children:i.jsxs(Ei,{onClick:w,className:"group border-border text-muted-foreground hover:bg-accent hover:text-foreground flex w-full items-center justify-between gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium transition-all duration-100 active:scale-[0.98] disabled:opacity-50",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx(Ql,{className:"size-(--size-icon-sm)"}),"New session"]}),i.jsx(ps,{className:"shrink-0 opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:a4(s4.NEW_SESSION)})]})})})}),i.jsx(i2e,{activeTab:R,onTabChange:_,schedulesBadge:X,connectionsStatus:G,visibleTabs:J}),i.jsxs(cEe,{"data-testid":"session-list",className:"!overflow-hidden",children:[i.jsx("div",{role:"tabpanel",id:"sidebar-tabpanel-sessions","aria-labelledby":"sidebar-tab-sessions",className:oe("h-full",R!=="sessions"&&"hidden"),children:i.jsx(c2e,{activeSessionId:t,groupedSessions:j,onSessionClick:S})}),i.jsx("div",{role:"tabpanel",id:"sidebar-tabpanel-schedules","aria-labelledby":"sidebar-tab-schedules",className:oe("h-full",R!=="schedules"&&"hidden"),children:i.jsx(u2e,{toolStatus:L.pulse,agentId:(I==null?void 0:I.id)??null})}),i.jsx("div",{role:"tabpanel",id:"sidebar-tabpanel-connections","aria-labelledby":"sidebar-tab-connections",className:oe("h-full",R!=="connections"&&"hidden"),children:i.jsx(p2e,{toolStatus:L,agentId:I==null?void 0:I.id})})]}),i.jsxs(lEe,{className:"border-t p-3",children:[x&&i.jsx("div",{className:"mb-2",children:i.jsx(e2e,{onStepClick:W=>a(W),onDismiss:b})}),i.jsx(r2e,{})]}),i.jsx(aEe,{})]})}function FC(e){const t=[],n=[];for(const r of e)r.type==="text"?t.push(r.text):r.type==="tool_call"&&n.push({toolCallId:r.toolCallId,toolName:r.toolName,input:r.input||"",result:r.result,progressOutput:r.progressOutput,status:r.status,interactiveType:r.interactiveType,questions:r.questions,answers:r.answers,timeoutMs:r.timeoutMs,hooks:r.hooks});return{content:t.join(`
|
|
857
857
|
`),toolCalls:n}}function g2e(e){const{currentPartsRef:t,orphanHooksRef:n,assistantCreatedRef:r,setMessages:s}=e;function a(m){for(let p=t.current.length-1;p>=0;p--){const x=t.current[p];if(x.type==="tool_call"&&x.toolCallId===m)return x}}function l(m){for(let p=t.current.length-1;p>=0;p--){const x=t.current[p];if(x.type==="tool_call"&&x.hooks){const b=x.hooks.find(v=>v.hookId===m);if(b)return b}}}function c(m){for(let p=t.current.length-1;p>=0;p--){const x=t.current[p];if(x.type==="subagent"&&x.taskId===m)return x}}function d(m){r.current||(r.current=!0,s(p=>[...p,{id:m,role:"assistant",content:"",toolCalls:[],parts:[],timestamp:new Date().toISOString(),_streaming:!0}]))}function f(m){d(m);const p=t.current.map(b=>({...b})),x=FC(p);s(b=>b.map(v=>v.id===m?{...v,content:x.content,toolCalls:x.toolCalls.length>0?x.toolCalls:[],parts:p}:v))}return{findToolCallPart:a,findHookById:l,findSubagentPart:c,updateAssistantMessage:f,currentPartsRef:t,orphanHooksRef:n}}function x2e(e,t,n){const r=t,s=e.orphanHooksRef.current.get(r.toolCallId);e.orphanHooksRef.current.delete(r.toolCallId),e.currentPartsRef.current.push({type:"tool_call",toolCallId:r.toolCallId,toolName:r.toolName,input:"",status:"running",...s&&s.length>0?{hooks:s}:{}}),e.updateAssistantMessage(n)}function b2e(e,t,n){const r=t,s=e.findToolCallPart(r.toolCallId);s&&r.input?s.input=(s.input||"")+r.input:s||console.warn("[stream] tool_call_delta: unknown toolCallId",r.toolCallId),e.updateAssistantMessage(n)}function y2e(e,t,n){const r=t,s=e.findToolCallPart(r.toolCallId);s?s.progressOutput=(s.progressOutput||"")+r.content:console.warn("[stream] tool_progress: unknown toolCallId",r.toolCallId),e.updateAssistantMessage(n)}function v2e(e,t,n){const r=t,s=e.findToolCallPart(r.toolCallId);s?s.interactiveType||(s.status="complete"):console.warn("[stream] tool_call_end: unknown toolCallId",r.toolCallId),e.updateAssistantMessage(n)}function E2e(e,t,n){const r=t,s=e.findToolCallPart(r.toolCallId);s?(s.result=r.result,s.status="complete",s.progressOutput=void 0,s.interactiveType==="question"&&!s.answers&&(s.answers={})):console.warn("[stream] tool_result: unknown toolCallId",r.toolCallId),queueMicrotask(()=>e.updateAssistantMessage(n))}function T2e(e,t,n){const r=t,s=e.findToolCallPart(r.toolCallId);s?(s.interactiveType="approval",s.input=r.input,s.status="pending",s.timeoutMs=r.timeoutMs):e.currentPartsRef.current.push({type:"tool_call",toolCallId:r.toolCallId,toolName:r.toolName,input:r.input,status:"pending",interactiveType:"approval",timeoutMs:r.timeoutMs}),e.updateAssistantMessage(n)}function S2e(e,t,n){const r=t,s=e.findToolCallPart(r.toolCallId);s?(s.interactiveType="question",s.questions=r.questions,s.status="pending"):e.currentPartsRef.current.push({type:"tool_call",toolCallId:r.toolCallId,toolName:"AskUserQuestion",input:"",status:"pending",interactiveType:"question",questions:r.questions}),e.updateAssistantMessage(n)}function w2e(e,t,n){const{taskId:r,description:s}=t;e.currentPartsRef.current.push({type:"subagent",taskId:r,description:s,status:"running"}),e.updateAssistantMessage(n)}function C2e(e,t,n){const r=t,s=e.findSubagentPart(r.taskId);s?(s.toolUses=r.toolUses,s.lastToolName=r.lastToolName,s.durationMs=r.durationMs):console.warn("[stream] subagent_progress: unknown taskId",r.taskId),e.updateAssistantMessage(n)}function N2e(e,t,n){const r=t,s=e.findSubagentPart(r.taskId);s?(s.status=r.status==="completed"?"complete":"error",s.summary=r.summary,r.toolUses!==void 0&&(s.toolUses=r.toolUses),r.durationMs!==void 0&&(s.durationMs=r.durationMs)):console.warn("[stream] subagent_done: unknown taskId",r.taskId),e.updateAssistantMessage(n)}function k2e(e,t,n){const r=t,s={hookId:r.hookId,hookName:r.hookName,hookEvent:r.hookEvent,status:"running",stdout:"",stderr:""};if(r.toolCallId){const a=e.findToolCallPart(r.toolCallId);if(a)a.hooks=[...a.hooks||[],s],e.updateAssistantMessage(n);else{const l=e.orphanHooksRef.current.get(r.toolCallId)||[];e.orphanHooksRef.current.set(r.toolCallId,[...l,s])}}}function A2e(e,t,n){const r=t,s=e.findHookById(r.hookId);s&&(s.stdout=r.stdout,s.stderr=r.stderr,e.updateAssistantMessage(n))}function j2e(e,t,n){const r=t,s=e.findHookById(r.hookId);s&&(s.status=r.outcome,s.stdout=r.stdout,s.stderr=r.stderr,s.exitCode=r.exitCode,e.updateAssistantMessage(n))}function _2e(e){const{currentPartsRef:t,assistantCreatedRef:n,sessionStatusRef:r,streamStartTimeRef:s,estimatedTokensRef:a,textStreamingTimerRef:l,isTextStreamingRef:c,thinkingStartRef:d,setMessages:f,setError:m,setStatus:p,setSessionStatus:x,setEstimatedTokens:b,setStreamStartTime:v,setIsTextStreaming:E,setRateLimitRetryAfter:w,setIsRateLimited:S,rateLimitClearRef:N,setSystemStatus:A,setPromptSuggestions:j,sessionId:R,onTaskEventRef:_,onSessionIdChangeRef:D,onStreamingDoneRef:I}=e,L=g2e(e);return function(X,G,J){var Y,W,F,$,z,q,P,U,V;switch(X!=="rate_limit"&&((Y=N.current)==null||Y.call(N)),X){case"thinking_delta":{const{text:M}=G,Z=t.current,te=Z[Z.length-1];te&&te.type==="thinking"?t.current=[...Z.slice(0,-1),{...te,text:te.text+M}]:(d.current=Date.now(),t.current=[...Z,{type:"thinking",text:M,isStreaming:!0}]),L.updateAssistantMessage(J);break}case"text_delta":{if(d.current!==null){const pe=Date.now()-d.current;d.current=null;const ie=t.current.map(xe=>xe.type==="thinking"&&xe.isStreaming?{...xe,isStreaming:!1,elapsedMs:pe}:xe);t.current=ie}const{text:M}=G,Z=t.current,te=Z[Z.length-1];if(te&&te.type==="text")t.current=[...Z.slice(0,-1),{...te,text:te.text+M}];else{const pe=`text-part-${Z.length}`,ie={type:"text",text:M,_partId:pe};t.current=[...Z,ie]}a.current+=M.length/4,b(a.current),c.current||(c.current=!0,E(!0)),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1,E(!1)},500),L.updateAssistantMessage(J);break}case"tool_call_start":x2e(L,G,J);break;case"tool_call_delta":b2e(L,G,J);break;case"tool_progress":y2e(L,G,J);break;case"tool_call_end":v2e(L,G,J);break;case"tool_result":E2e(L,G,J);break;case"approval_required":T2e(L,G,J);break;case"question_prompt":S2e(L,G,J);break;case"error":{const M=G;M.category?(t.current.push({type:"error",message:M.message,category:M.category,details:M.details}),L.updateAssistantMessage(J)):m({heading:"Error",message:M.message,retryable:!1}),p("error");break}case"rate_limit":{const{retryAfter:M}=G;w(M??null),S(!0);break}case"session_status":{const M=G,Z={...r.current,...M,model:M.model??((W=r.current)==null?void 0:W.model),costUsd:M.costUsd??((F=r.current)==null?void 0:F.costUsd),contextTokens:M.contextTokens??(($=r.current)==null?void 0:$.contextTokens),contextMaxTokens:M.contextMaxTokens??((z=r.current)==null?void 0:z.contextMaxTokens),outputTokens:M.outputTokens??((q=r.current)==null?void 0:q.outputTokens)};r.current=Z,x(Z);break}case"task_update":{const M=G;(P=_.current)==null||P.call(_,M);break}case"subagent_started":w2e(L,G,J);break;case"subagent_progress":C2e(L,G,J);break;case"subagent_done":N2e(L,G,J);break;case"hook_started":k2e(L,G,J);break;case"hook_progress":A2e(L,G,J);break;case"hook_response":j2e(L,G,J);break;case"system_status":{const{message:M}=G;A(M);break}case"prompt_suggestion":{const{suggestions:M}=G;j(M);break}case"compact_boundary":{f(M=>[...M,{id:`compaction-${Date.now()}`,role:"user",content:"",parts:[],timestamp:new Date().toISOString(),messageType:"compaction"}]);break}case"done":{const M=G;if(M.sessionId&&M.sessionId!==R&&(t.current=[],n.current=!1,e.isRemappingRef.current=!0,(U=D.current)==null||U.call(D,M.sessionId)),M.messageIds){const{user:Z,assistant:te}=M.messageIds;f(pe=>pe.map(ie=>ie._streaming&&ie.role==="user"&&Z?{...ie,id:Z,_streaming:!1}:ie._streaming&&ie.role==="assistant"&&te?{...ie,id:te,_streaming:!1}:ie))}if(s.current&&Date.now()-s.current>=Ts.MIN_STREAM_DURATION_MS&&((V=I.current)==null||V.call(I)),s.current=null,a.current=0,d.current!==null){const Z=Date.now()-d.current;t.current=t.current.map(te=>te.type==="thinking"&&te.isStreaming?{...te,isStreaming:!1,elapsedMs:Z}:te)}d.current=null,v(null),b(0),l.current&&clearTimeout(l.current),c.current=!1,E(!1),A(null),p("idle");break}default:{console.warn("[stream] unknown event type:",X,G);break}}}}function yM(e){const t=e instanceof Error?e:new Error(String(e)),n=e==null?void 0:e.code,r=e==null?void 0:e.status;return n==="SESSION_LOCKED"?{heading:"Session in use",message:"Another client is sending a message. Try again in a few seconds.",retryable:!1,autoDismissMs:Ts.SESSION_BUSY_CLEAR_MS}:t instanceof TypeError||/fetch|network/i.test(t.message)?{heading:"Connection failed",message:"Could not reach the server. Check your connection and try again.",retryable:!0}:r&&r>=500&&r<=599?{heading:"Server error",message:"The server encountered an error. Try again.",retryable:!0}:r===408||/timeout/i.test(t.message)?{heading:"Request timed out",message:"The server took too long to respond. Try again.",retryable:!0}:{heading:"Error",message:t.message,retryable:!1}}function Lg(e){const t=e.parts?[...e.parts]:[];if(t.length===0&&(e.content&&t.push({type:"text",text:e.content}),e.toolCalls))for(const r of e.toolCalls)t.push({type:"tool_call",toolCallId:r.toolCallId,toolName:r.toolName,input:r.input,result:r.result,status:r.status,...r.questions?{interactiveType:"question",questions:r.questions,answers:r.answers}:{}});const n=FC(t);return{id:e.id,role:e.role,content:n.content,toolCalls:n.toolCalls.length>0?n.toolCalls:void 0,parts:t,timestamp:e.timestamp||"",messageType:e.messageType,commandName:e.commandName,commandArgs:e.commandArgs}}function R2e(e,t={}){const n=Ve(),r=Yt(),s=He(Ue=>Ue.selectedCwd),a=He(Ue=>Ue.enableCrossClientSync),l=He(Ue=>Ue.enableMessagePolling),[c,d]=g.useState([]),[f,m]=g.useState(""),[p,x]=g.useState("idle"),[b,v]=g.useState(null),[E,w]=g.useState(!1),S=g.useRef(null),[N,A]=g.useState(null),j=g.useRef(null),R=g.useRef([]),_=g.useRef(new Map),D=g.useRef(""),I=g.useRef(!1),L=g.useRef(!1),B=g.useRef(null),X=g.useRef(0),[G,J]=g.useState(null),[Y,W]=g.useState(0),F=g.useRef(null),$=g.useRef(!1),[z,q]=g.useState(!1),P=g.useRef(null),[U,V]=g.useState(null),[M,Z]=g.useState(!1),te=g.useRef(null),[pe,ie]=g.useState(null),[xe,Se]=g.useState([]),je=g.useRef(null),Le=g.useRef(null),[ge,Ae]=g.useState(null),[Ne,le]=g.useState(!1),Fe=g.useRef(null),Pe=g.useRef(null),at=g.useRef(s),[ct,Mt]=g.useState(!document.hidden),un=g.useRef(c),Zt=g.useRef(null),wn=g.useRef(!1);g.useEffect(()=>{un.current=c},[c]),g.useEffect(()=>{at.current=s},[s]),g.useEffect(()=>{Fe.current=ge},[ge]),g.useEffect(()=>{const Ue=()=>{Mt(!document.hidden)};return document.addEventListener("visibilitychange",Ue),()=>{document.removeEventListener("visibilitychange",Ue)}},[]);const Xt=p==="streaming",Ie=g.useRef(p);g.useEffect(()=>{Ie.current=p}),te.current=()=>{Z(!1),V(null)};const se=g.useCallback(Ue=>{je.current&&(clearTimeout(je.current),je.current=null),ie(Ue),Ue&&(je.current=setTimeout(()=>{ie(null),je.current=null},Ts.SYSTEM_STATUS_DISMISS_MS))},[]),Ee=g.useRef(t.onTaskEvent),Me=g.useRef(t.onSessionIdChange),qe=g.useRef(t.onStreamingDone),et=g.useRef(t.transformContent);Ee.current=t.onTaskEvent,Me.current=t.onSessionIdChange,qe.current=t.onStreamingDone,et.current=t.transformContent;const Ht=g.useMemo(()=>_2e({currentPartsRef:R,orphanHooksRef:_,assistantCreatedRef:I,sessionStatusRef:S,streamStartTimeRef:B,estimatedTokensRef:X,textStreamingTimerRef:F,isTextStreamingRef:$,thinkingStartRef:P,setMessages:d,setError:v,setStatus:x,setSessionStatus:A,setEstimatedTokens:W,setStreamStartTime:J,setIsTextStreaming:q,setRateLimitRetryAfter:V,setIsRateLimited:Z,setSystemStatus:se,setPromptSuggestions:Se,rateLimitClearRef:te,sessionId:e??"",onTaskEventRef:Ee,onSessionIdChangeRef:Me,onStreamingDoneRef:qe,isRemappingRef:wn}),[e,se]),Kt=Tt({queryKey:["messages",e,s],queryFn:()=>n.getMessages(e,s??void 0),staleTime:Gs.MESSAGE_STALE_TIME_MS,refetchOnWindowFocus:!1,enabled:e!==null,refetchInterval:()=>Xt||!l?!1:ct?Gs.ACTIVE_TAB_REFETCH_MS:Gs.BACKGROUND_TAB_REFETCH_MS});g.useEffect(()=>{if(wn.current){wn.current=!1,L.current=!0;return}L.current=!1,Ie.current!=="streaming"&&d([])},[e,s]),g.useEffect(()=>{Ae(null),le(!1)},[e]),g.useEffect(()=>{if(!Kt.data)return;const Ue=Kt.data.messages;if(!L.current&&Ue.length>0){if(Xt)return;L.current=!0,d(Ue.map(Lg));return}if(L.current&&!Xt){const $e=new Set(un.current.map(mt=>mt.id)),rt=un.current.filter(mt=>mt._streaming),pt=rt.find(mt=>mt.role==="user"),bt=rt.find(mt=>mt.role==="assistant"),dn=[];let Ct=-1;for(let mt=0;mt<Ue.length;mt++){const Ut=Ue[mt];if(!$e.has(Ut.id)){if(pt&&Ut.role==="user"&&Ut.content===pt.content){Ct=mt,d(tn=>tn.map(Un=>Un.id===pt.id?{...Lg(Ut),_streaming:!1}:Un));continue}if(bt&&Ct>=0&&mt===Ct+1&&Ut.role==="assistant"){const tn=Lg(Ut),Un=new Set(tn.parts.filter(js=>js.type==="subagent").map(js=>js.taskId)),ta=bt.parts.filter(js=>js.type==="subagent"&&!Un.has(js.taskId)),ss=ta.length>0?[...tn.parts,...ta]:tn.parts;d(js=>js.map(Qd=>Qd.id===bt.id?{...tn,parts:ss,_streaming:!1}:Qd));continue}dn.push(Ut)}}dn.length>0&&d(mt=>[...mt,...dn.map(Lg)])}},[Kt.data,Xt]),g.useEffect(()=>{if(!e||Xt||!a)return;const Ue=n.clientId?`?clientId=${encodeURIComponent(n.clientId)}`:"",$e=`/api/sessions/${e}/stream${Ue}`,rt=new EventSource($e);return rt.addEventListener("sync_update",()=>{r.invalidateQueries({queryKey:["messages",e,at.current]}),r.invalidateQueries({queryKey:["tasks",e,at.current]}),Fe.current&&Fe.current.clientCount>1&&(le(!0),Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(()=>{le(!1),Pe.current=null},1e3))}),rt.addEventListener("presence_update",pt=>{try{const bt=JSON.parse(pt.data);Ae(bt)}catch{}}),()=>{rt.close()}},[e,Xt,r,n.clientId,a]),g.useEffect(()=>()=>{Le.current&&clearTimeout(Le.current),je.current&&clearTimeout(je.current),Pe.current&&clearTimeout(Pe.current)},[]);const Jt=g.useCallback(async(Ue,$e,rt)=>{var mt;let pt=e;if(!pt){pt=crypto.randomUUID();const Ut=new Date().toISOString();PG(r,at.current,{id:pt,title:`Session ${pt.slice(0,8)}`,createdAt:Ut,updatedAt:Ut,permissionMode:"default"}),(mt=Me.current)==null||mt.call(Me,pt)}const bt=`pending-user-${crypto.randomUUID()}`;Zt.current=bt,d(Ut=>[...Ut,{id:bt,role:"user",content:Ue,parts:[{type:"text",text:Ue}],timestamp:new Date().toISOString(),_streaming:!0}]),$e&&m(""),Se([]),x("streaming"),Ie.current="streaming",v(null),R.current=[];const dn=Date.now();B.current=dn,X.current=0,J(dn),W(0),D.current=crypto.randomUUID(),I.current=!1;const Ct=new AbortController;j.current=Ct;try{const Ut=et.current?await et.current(Ue):Ue;await n.sendMessage(pt,Ut,tn=>Ht(tn.type,tn.data,D.current),Ct.signal,s??void 0,{clientMessageId:bt}),Zt.current=null,x("idle")}catch(Ut){if(Zt.current){const tn=Zt.current;d(Un=>Un.filter(ta=>ta.id!==tn)),Zt.current=null}Ut.name!=="AbortError"&&(Ut.code==="SESSION_LOCKED"?(w(!0),v(yM(Ut)),$e&&m(rt),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{w(!1),v(null),Le.current=null},Ts.SESSION_BUSY_CLEAR_MS)):v(yM(Ut)),x("error")),F.current&&clearTimeout(F.current),$.current=!1,q(!1),Z(!1),V(null)}},[e,Ht,r]),en=g.useCallback(async()=>{if(!f.trim()||p==="streaming")return;const Ue=f.trim();await Jt(Ue,!0,Ue)},[f,p,Jt]),gn=g.useCallback(async Ue=>{!Ue.trim()||p==="streaming"||await Jt(Ue.trim(),!1,"")},[p,Jt]),kt=g.useCallback(()=>{var Ue;(Ue=j.current)==null||Ue.abort(),F.current&&clearTimeout(F.current),$.current=!1,q(!1),Z(!1),V(null),x("idle")},[]),cr=g.useCallback(Ue=>{const $e=R.current.find(rt=>rt.type==="tool_call"&&rt.toolCallId===Ue);if($e&&$e.type==="tool_call"){$e.status="running";const rt=R.current.map(bt=>({...bt})),pt=FC(rt);d(bt=>bt.map(dn=>dn.id===D.current?{...dn,content:pt.content,toolCalls:pt.toolCalls.length>0?pt.toolCalls:[],parts:rt}:dn))}},[]),_n=Kt.isLoading&&c.length===0,ht=g.useMemo(()=>c.flatMap(Ue=>Ue.toolCalls||[]).filter(Ue=>Ue.interactiveType&&Ue.status==="pending"),[c])[0]||null,Pt=ht!==null,xt=(ht==null?void 0:ht.interactiveType)||null;return{messages:c,input:f,setInput:m,handleSubmit:en,submitContent:gn,status:p,error:b,sessionBusy:E,stop:kt,isLoadingHistory:_n,sessionStatus:N,streamStartTime:G,estimatedTokens:Y,isTextStreaming:z,isWaitingForUser:Pt,waitingType:xt,activeInteraction:ht,markToolCallResponded:cr,isRateLimited:M,rateLimitRetryAfter:U,systemStatus:pe,promptSuggestions:xe,presenceInfo:ge,presencePulse:Ne}}function D2e({status:e,sessionBusy:t,sessionId:n,selectedCwd:r,onFlush:s}){const[a,l]=g.useState([]),[c,d]=g.useState(null),f=g.useRef(s);f.current=s;const m=g.useRef("idle");g.useEffect(()=>{if(m.current==="streaming"&&e==="idle"&&a.length>0&&!t){const N=c===0?a.length>1?1:null:0;if(N!==null){const j=`[Note: This message was composed while the agent was responding to the previous message]
|
|
858
858
|
|
|
859
859
|
${a[N].content}`;l(R=>R.filter((_,D)=>D!==N)),c!==null&&c>N&&d(R=>R!==null?R-1:null),f.current(j)}}m.current=e},[e,t,a,c]),g.useEffect(()=>{l([]),d(null)},[n,r]);const p=g.useCallback(N=>{N.trim()&&l(A=>[...A,{id:crypto.randomUUID(),content:N,createdAt:Date.now()}])},[]),x=g.useCallback((N,A)=>{l(j=>j.map((R,_)=>_===N?{...R,content:A}:R))},[]),b=g.useCallback(N=>{l(A=>A.filter((j,R)=>R!==N)),d(A=>A===N?null:A!==null&&A>N?A-1:A)},[]),v=g.useCallback(N=>{var A;return d(N),((A=a[N])==null?void 0:A.content)??""},[a]),E=g.useCallback(()=>{d(null)},[]),w=g.useCallback(N=>{c!==null&&(x(c,N),d(null))},[c,x]),S=g.useCallback(()=>{l([]),d(null)},[]);return{queue:a,editingIndex:c,addToQueue:p,updateQueueItem:x,removeFromQueue:b,startEditing:v,cancelEditing:E,saveEditing:w,clearQueue:S}}function Kz(e){const t=Ve();return Tt({queryKey:["commands",{cwd:e??null}],queryFn:()=>t.getCommands(!1,e??void 0),staleTime:Gs.COMMANDS_STALE_TIME_MS,gcTime:Gs.COMMANDS_GC_TIME_MS})}const vM={in_progress:0,pending:1,completed:2};function M2e(e){return[...e].sort((t,n)=>vM[t.status]-vM[n.status])}function O2e(e){const t={};for(const[n,r]of Object.entries(e))r!==void 0&&r!==""&&(t[n]=r);return t}const I2e=10;function L2e(e){const t=Ve(),n=He(E=>E.selectedCwd),[r,s]=g.useState(new Map),[a,l]=g.useState(!1),c=g.useRef(1),{data:d}=Tt({queryKey:["tasks",e,n],queryFn:()=>t.getTasks(e,n??void 0),staleTime:3e4,refetchOnWindowFocus:!1,enabled:!!e});g.useEffect(()=>{if(s(new Map),c.current=1,d&&d.tasks.length>0){const E=new Map;for(const w of d.tasks)E.set(w.id,w);s(E),c.current=d.tasks.length+1}},[d]);const f=g.useCallback(E=>{s(w=>{const S=new Map(w);if(E.action==="create"){const N=String(c.current++);S.set(N,{...E.task,id:N})}else if(E.action==="update"&&E.task.id){const N=S.get(E.task.id);N&&S.set(E.task.id,{...N,...O2e(E.task)})}return S})},[]),m=g.useCallback(()=>{l(E=>!E)},[]),p=Array.from(r.values()),x=M2e(p),b=p.find(E=>E.status==="in_progress"),v=(b==null?void 0:b.activeForm)??null;return{tasks:x.slice(0,I2e),activeForm:v,isCollapsed:a,toggleCollapse:m,handleTaskEvent:f}}function P2e(e){const t=g.useRef(null),[n,r]=g.useState(0),[s,a]=g.useState(0),l=g.useCallback(v=>{t.current=v,a(v&&"getOptionCount"in v?v.getOptionCount():0)},[]);g.useEffect(()=>{r(0),a(0)},[e==null?void 0:e.toolCallId]);const c=g.useMemo(()=>e!=null&&e.interactiveType?{type:e.interactiveType,toolCallId:e.toolCallId}:null,[e]),d=g.useCallback(()=>{const v=t.current;v&&"approve"in v&&v.approve()},[]),f=g.useCallback(()=>{const v=t.current;v&&"deny"in v&&v.deny()},[]),m=g.useCallback(v=>{const E=t.current;E&&"toggleOption"in E&&(E.toggleOption(v),r(v))},[]),p=g.useCallback(v=>{r(E=>{const w=t.current,S=w&&"getOptionCount"in w?w.getOptionCount():0;return S===0?E:v==="up"?E<=0?S-1:E-1:E>=S-1?0:E+1})},[]),x=g.useCallback(v=>{const E=t.current;E&&"navigateQuestion"in E&&(E.navigateQuestion(v),r(0),a(E.getOptionCount()))},[]),b=g.useCallback(()=>{const v=t.current;v&&"submit"in v&&v.submit()},[]);return MG({activeInteraction:c,onApprove:d,onDeny:f,onToggleOption:m,onNavigateOption:p,onNavigateQuestion:x,onSubmit:b,optionCount:s,focusedIndex:n}),{handleToolRef:l,focusedOptionIndex:n}}function B2e(e,t){const[n,r]=g.useState(!0),[s,a]=g.useState(!1),l=g.useRef(e.length),c=g.useCallback(f=>{r(f.isAtBottom)},[]),d=g.useCallback(()=>{var f;(f=t.current)==null||f.scrollToBottom(),r(!0),a(!1)},[t]);return g.useEffect(()=>{const f=l.current;l.current=e.length,e.length>f&&!n&&a(!0)},[e.length,n]),g.useEffect(()=>{n&&a(!1)},[n]),{isAtBottom:n,hasNewMessages:s,scrollToBottom:d,handleScrollStateChange:c}}function F2e({commands:e,input:t,cursorPos:n}){const[r,s]=g.useState(!1),[a,l]=g.useState(""),[c,d]=g.useState(0),[f,m]=g.useState(-1),p=g.useMemo(()=>a?e.map(N=>{const A=`${N.fullCommand} ${N.description}`,j=JO(a,A);return{cmd:N,...j}}).filter(N=>N.match).sort((N,A)=>A.score-N.score).map(N=>N.cmd):e,[e,a]);g.useEffect(()=>{d(0)},[a,r]),g.useEffect(()=>{p.length>0&&c>=p.length&&d(p.length-1)},[p.length,c]);const x=g.useCallback((N,A)=>{const R=N.slice(0,A).match(/(^|\s)\/([\w:-]*)$/);return R?(s(!0),l(R[2]),m((R.index??0)+R[1].length),!0):(s(!1),!1)},[]),b=g.useCallback(N=>{const A=t.slice(0,f);return s(!1),A+N.fullCommand+" "},[t,f]),v=g.useCallback(()=>{d(N=>p.length===0?0:(N+1)%p.length)},[p.length]),E=g.useCallback(()=>{d(N=>p.length===0?0:(N-1+p.length)%p.length)},[p.length]),w=g.useCallback(()=>p.length>0&&c<p.length?b(p[c]):(s(!1),null),[p,c,b]),S=g.useCallback(()=>{s(!1),l("")},[]);return{showCommands:r,setShowCommands:s,commandQuery:a,selectedIndex:c,filteredCommands:p,slashTriggerPos:f,detectCommandTrigger:x,handleCommandSelect:b,handleArrowUp:E,handleArrowDown:v,handleKeyboardSelect:w,resetCommand:S}}function z2e({fileEntries:e,input:t,cursorPos:n}){const[r,s]=g.useState(!1),[a,l]=g.useState(""),[c,d]=g.useState(0),[f,m]=g.useState(-1),p=g.useMemo(()=>r?a?e.map(N=>({...N,...JO(a,N.path)})).filter(N=>N.match).sort((N,A)=>A.score-N.score).slice(0,50):e.slice(0,50).map(N=>({...N,indices:[]})):[],[e,a,r]);g.useEffect(()=>{d(0)},[a,r]),g.useEffect(()=>{p.length>0&&c>=p.length&&d(p.length-1)},[p.length,c]);const x=g.useCallback((N,A)=>{const R=N.slice(0,A).match(/(^|\s)@([\w./:-]*)$/);return R?(s(!0),l(R[2]),m((R.index??0)+R[1].length),!0):(s(!1),!1)},[]),b=g.useCallback(N=>{const A=t.slice(0,f),j=t.slice(f+1+a.length);if(N.isDirectory){const _=A+"@"+N.path+j,D=A.length+1+N.path.length;return l(N.path),d(0),{newValue:_,newCursorPos:D,keepOpen:!0}}const R=A+"@"+N.path+" "+j;return s(!1),{newValue:R,keepOpen:!1}},[t,f,a]),v=g.useCallback(()=>{d(N=>p.length===0?0:(N+1)%p.length)},[p.length]),E=g.useCallback(()=>{d(N=>p.length===0?0:(N-1+p.length)%p.length)},[p.length]),w=g.useCallback(()=>p.length>0&&c<p.length?b(p[c]):(s(!1),null),[p,c,b]),S=g.useCallback(()=>{s(!1),l("")},[]);return{showFiles:r,setShowFiles:s,fileQuery:a,fileSelectedIndex:c,filteredFiles:p,fileTriggerPos:f,detectFileTrigger:x,handleFileSelect:b,handleArrowUp:E,handleArrowDown:v,handleKeyboardSelect:w,resetFiles:S}}function H2e({input:e,setInput:t,commands:n,fileEntries:r,chatInputRef:s}){const[a,l]=g.useState(0),c=F2e({commands:n,input:e,cursorPos:a}),d=z2e({fileEntries:r,input:e,cursorPos:a}),f=g.useCallback((R,_)=>{if(d.detectFileTrigger(R,_)){c.setShowCommands(!1);return}if(c.detectCommandTrigger(R,_)){d.setShowFiles(!1);return}d.setShowFiles(!1),c.setShowCommands(!1)},[d,c]),m=g.useCallback(R=>{t(R),f(R,a||R.length)},[t,f,a]),p=g.useCallback(R=>{l(R),f(e,R)},[e,f]),x=g.useCallback(R=>{const _=c.handleCommandSelect(R);t(_)},[c,t]),b=g.useCallback(R=>{const _=d.handleFileSelect(R);t(_.newValue),_.newCursorPos!==void 0&&l(_.newCursorPos)},[d,t]),v=g.useCallback(()=>{d.showFiles?d.handleArrowDown():c.handleArrowDown()},[d,c]),E=g.useCallback(()=>{d.showFiles?d.handleArrowUp():c.handleArrowUp()},[d,c]),w=g.useCallback(()=>{if(d.showFiles){const R=d.handleKeyboardSelect();R&&(t(R.newValue),R.newCursorPos!==void 0&&l(R.newCursorPos))}else if(c.showCommands){const R=c.handleKeyboardSelect();R&&t(R)}},[d,c,t]),S=g.useCallback(R=>{const _=e.match(/(^|\s)([/@])([\w./:-]*)$/);let D;if(_){const I=_[2],L=_[3],B=(_.index??0)+_[1].length;if(I===R&&!L){const X=e.slice(0,B);D=X.endsWith(" ")&&B>0?X.slice(0,-1):X,t(D),d.setShowFiles(!1),c.setShowCommands(!1),requestAnimationFrame(()=>{var G;return(G=s.current)==null?void 0:G.focusAt(D.length)});return}D=e.slice(0,B)+R}else e.length>0&&!e.endsWith(" ")?D=e+" "+R:D=e+R;t(D),f(D,D.length),requestAnimationFrame(()=>{var I;return(I=s.current)==null?void 0:I.focusAt(D.length)})},[e,t,f,d,c,s]),N=g.useCallback(()=>{c.setShowCommands(!1),d.setShowFiles(!1)},[c,d]),A=c.showCommands||d.showFiles,j=d.showFiles&&d.filteredFiles.length>0?`file-item-${d.fileSelectedIndex}`:c.showCommands&&c.filteredCommands.length>0?`command-item-${c.selectedIndex}`:void 0;return{commands:{show:c.showCommands,filtered:c.filteredCommands,selectedIndex:c.selectedIndex},files:{show:d.showFiles,filtered:d.filteredFiles,selectedIndex:d.fileSelectedIndex},isPaletteOpen:A,activeDescendantId:j,handleInputChange:m,handleCursorChange:p,handleArrowUp:E,handleArrowDown:v,handleKeyboardSelect:w,handleCommandSelect:x,handleFileSelect:b,handleChipClick:S,dismissPalettes:N}}function U2e(e,t,n,r){const s=He(d=>d.setIsStreaming),a=He(d=>d.setIsWaitingForUser),l=He(d=>d.setActiveForm),c=He(d=>d.setIsTextStreaming);g.useEffect(()=>(s(e==="streaming"),()=>s(!1)),[e,s]),g.useEffect(()=>(a(t),()=>a(!1)),[t,a]),g.useEffect(()=>(l(n),()=>l(null)),[n,l]),g.useEffect(()=>(c(r),()=>c(!1)),[r,c])}function $2e(){const e=Ve(),t=He(f=>f.selectedCwd),[n,r]=g.useState([]),s=g.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));r(p=>[...p,...m])},[]),a=g.useCallback(f=>{r(m=>m.filter(p=>p.id!==f))},[]),l=g.useCallback(()=>{r([])},[]),c=Sn({mutationFn:async f=>{if(!t)throw new Error("No working directory selected");r(x=>x.map(b=>f.some(v=>v.id===b.id)?{...b,status:"uploading"}:b));const m=x=>{r(b=>b.map(v=>v.status==="uploading"?{...v,progress:x.percentage}:v))},p=f.map(x=>x.file);return e.uploadFiles(p,t,m)},onSuccess:(f,m)=>{r(p=>p.map(x=>{const b=m.findIndex(v=>v.id===x.id);return b===-1?x:{...x,status:"uploaded",progress:100,result:f[b]}}))},onError:f=>{r(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),d=g.useCallback(async()=>{const f=n.filter(p=>p.status==="pending");return f.length===0?n.filter(p=>p.status==="uploaded"&&p.result).map(p=>p.result.savedPath):(await c.mutateAsync(f)).map(p=>p.savedPath)},[n,c]);return{pendingFiles:n,addFiles:s,removeFile:a,clearFiles:l,uploadAndGetPaths:d,hasPendingFiles:n.length>0,isUploading:c.isPending}}function V2e(e){const t=[],n=new Set;for(const r of e){const s=r.lastIndexOf("/"),a=s>=0?r.slice(0,s+1):"",l=s>=0?r.slice(s+1):r;t.push({path:r,filename:l,directory:a,isDirectory:!1});const c=r.split("/");for(let d=1;d<c.length;d++){const f=c.slice(0,d).join("/")+"/";n.has(f)||(n.add(f),t.push({path:f,filename:c[d-1]+"/",directory:d>1?c.slice(0,d-1).join("/")+"/":"",isDirectory:!0}))}}return t}function Cu(e,t,n){let r=n.initialDeps??[],s,a=!0;function l(){var c,d,f;let m;n.key&&((c=n.debug)!=null&&c.call(n))&&(m=Date.now());const p=e();if(!(p.length!==r.length||p.some((v,E)=>r[E]!==v)))return s;r=p;let b;if(n.key&&((d=n.debug)!=null&&d.call(n))&&(b=Date.now()),s=t(...p),n.key&&((f=n.debug)!=null&&f.call(n))){const v=Math.round((Date.now()-m)*100)/100,E=Math.round((Date.now()-b)*100)/100,w=E/16,S=(N,A)=>{for(N=String(N);N.length<A;)N=" "+N;return N};console.info(`%c⏱ ${S(E,5)} /${S(v,5)} ms`,`
|