claude-code-session-manager 0.8.0 → 0.8.1
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/assets/{cssMode-CDGOCAW5.js → cssMode-DKTELvb6.js} +1 -1
- package/dist/assets/{editor.main-zj3Myqhk.js → editor.main-Dx55Am4z.js} +3 -3
- package/dist/assets/{freemarker2-Dh6-Vi35.js → freemarker2-CBdvn_u-.js} +1 -1
- package/dist/assets/{handlebars-KgXZ3LUu.js → handlebars-B67ay2ue.js} +1 -1
- package/dist/assets/{html-D12q2PkL.js → html-002uK0_M.js} +1 -1
- package/dist/assets/{htmlMode-CCaSY5vs.js → htmlMode-DsT8oVY_.js} +1 -1
- package/dist/assets/{index-Dejlz0I1.js → index-E14-spyd.js} +4 -4
- package/dist/assets/{javascript-ClkFzW_a.js → javascript-Cfg-gFlu.js} +1 -1
- package/dist/assets/{jsonMode-BV7azwkW.js → jsonMode-CCIKxANa.js} +1 -1
- package/dist/assets/{liquid-C9Id9V-K.js → liquid-DewgYvox.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-COD69jzF.js → lspLanguageFeatures-BcMPMUo0.js} +1 -1
- package/dist/assets/{mdx-D8YvWtiq.js → mdx-BGrrIvjV.js} +1 -1
- package/dist/assets/{python-YtsitwE4.js → python-CVhAv32T.js} +1 -1
- package/dist/assets/{razor-T48OHh5u.js → razor-DteXtrPO.js} +1 -1
- package/dist/assets/{tsMode-DHTMR4b8.js → tsMode-DKeWRYvl.js} +1 -1
- package/dist/assets/{typescript-Ckq032Ud.js → typescript-Dl1KPrAp.js} +1 -1
- package/dist/assets/{xml-B7dYWEXB.js → xml-DdyOGE0N.js} +1 -1
- package/dist/assets/{yaml-DUufEgrd.js → yaml-BwFXDW6t.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/main/scheduler.cjs +3 -1
- package/src/preload/api.d.ts +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./editor.main-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./editor.main-Dx55Am4z.js","./editor-BTnBOi8r.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var xx=Object.defineProperty;var Sx=(t,i,o)=>i in t?xx(t,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[i]=o;var jm=(t,i,o)=>Sx(t,typeof i!="symbol"?i+"":i,o);(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))a(f);new MutationObserver(f=>{for(const S of f)if(S.type==="childList")for(const v of S.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&a(v)}).observe(document,{childList:!0,subtree:!0});function o(f){const S={};return f.integrity&&(S.integrity=f.integrity),f.referrerPolicy&&(S.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?S.credentials="include":f.crossOrigin==="anonymous"?S.credentials="omit":S.credentials="same-origin",S}function a(f){if(f.ep)return;f.ep=!0;const S=o(f);fetch(f.href,S)}})();function zw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Om={exports:{}},Bh={},Nm={exports:{}},Vt={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -38,7 +38,7 @@ var xx=Object.defineProperty;var Sx=(t,i,o)=>i in t?xx(t,i,{enumerable:!0,config
|
|
|
38
38
|
`+L[Z].replace(" at new "," at ");return r.displayName&&we.includes("<anonymous>")&&(we=we.replace("<anonymous>",r.displayName)),we}while(1<=Z&&0<=fe);break}}}finally{Pe=!1,Error.prepareStackTrace=d}return(r=r?r.displayName||r.name:"")?ne(r):""}function Ge(r){switch(r.tag){case 5:return ne(r.type);case 16:return ne("Lazy");case 13:return ne("Suspense");case 19:return ne("SuspenseList");case 0:case 2:case 15:return r=Ve(r.type,!1),r;case 11:return r=Ve(r.type.render,!1),r;case 1:return r=Ve(r.type,!0),r;default:return""}}function it(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case F:return"Fragment";case O:return"Portal";case U:return"Profiler";case I:return"StrictMode";case ie:return"Suspense";case ye:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case se:return(r.displayName||"Context")+".Consumer";case Y:return(r._context.displayName||"Context")+".Provider";case de:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ge:return s=r.displayName||null,s!==null?s:it(r.type)||"Memo";case ke:s=r._payload,r=r._init;try{return it(r(s))}catch{}}return null}function Ce(r){var s=r.type;switch(r.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=s.render,r=r.displayName||r.name||"",s.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return it(s);case 8:return s===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function J(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Me(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function $e(r){var s=Me(r)?"checked":"value",d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s),E=""+r[s];if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var L=d.get,z=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return L.call(this)},set:function(Z){E=""+Z,z.call(this,Z)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return E},setValue:function(Z){E=""+Z},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Ze(r){r._valueTracker||(r._valueTracker=$e(r))}function tt(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var d=s.getValue(),E="";return r&&(E=Me(r)?r.checked?"true":"false":r.value),r=E,r!==d?(s.setValue(r),!0):!1}function It(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function jt(r,s){var d=s.checked;return re({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??r._wrapperState.initialChecked})}function $t(r,s){var d=s.defaultValue==null?"":s.defaultValue,E=s.checked!=null?s.checked:s.defaultChecked;d=J(s.value!=null?s.value:d),r._wrapperState={initialChecked:E,initialValue:d,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Wt(r,s){s=s.checked,s!=null&&C(r,"checked",s,!1)}function ht(r,s){Wt(r,s);var d=J(s.value),E=s.type;if(d!=null)E==="number"?(d===0&&r.value===""||r.value!=d)&&(r.value=""+d):r.value!==""+d&&(r.value=""+d);else if(E==="submit"||E==="reset"){r.removeAttribute("value");return}s.hasOwnProperty("value")?tr(r,s.type,d):s.hasOwnProperty("defaultValue")&&tr(r,s.type,J(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(r.defaultChecked=!!s.defaultChecked)}function Ei(r,s,d){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var E=s.type;if(!(E!=="submit"&&E!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+r._wrapperState.initialValue,d||s===r.value||(r.value=s),r.defaultValue=s}d=r.name,d!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,d!==""&&(r.name=d)}function tr(r,s,d){(s!=="number"||It(r.ownerDocument)!==r)&&(d==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+d&&(r.defaultValue=""+d))}var kr=Array.isArray;function Rr(r,s,d,E){if(r=r.options,s){s={};for(var L=0;L<d.length;L++)s["$"+d[L]]=!0;for(d=0;d<r.length;d++)L=s.hasOwnProperty("$"+r[d].value),r[d].selected!==L&&(r[d].selected=L),L&&E&&(r[d].defaultSelected=!0)}else{for(d=""+J(d),s=null,L=0;L<r.length;L++){if(r[L].value===d){r[L].selected=!0,E&&(r[L].defaultSelected=!0);return}s!==null||r[L].disabled||(s=r[L])}s!==null&&(s.selected=!0)}}function Is(r,s){if(s.dangerouslySetInnerHTML!=null)throw Error(o(91));return re({},s,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Fr(r,s){var d=s.value;if(d==null){if(d=s.children,s=s.defaultValue,d!=null){if(s!=null)throw Error(o(92));if(kr(d)){if(1<d.length)throw Error(o(93));d=d[0]}s=d}s==null&&(s=""),d=s}r._wrapperState={initialValue:J(d)}}function Ms(r,s){var d=J(s.value),E=J(s.defaultValue);d!=null&&(d=""+d,d!==r.value&&(r.value=d),s.defaultValue==null&&r.defaultValue!==d&&(r.defaultValue=d)),E!=null&&(r.defaultValue=""+E)}function ui(r){var s=r.textContent;s===r._wrapperState.initialValue&&s!==""&&s!==null&&(r.value=s)}function Ls(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function vs(r,s){return r==null||r==="http://www.w3.org/1999/xhtml"?Ls(s):r==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Jt,Mi=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,d,E,L){MSApp.execUnsafeLocalFunction(function(){return r(s,d,E,L)})}:r})(function(r,s){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=s;else{for(Jt=Jt||document.createElement("div"),Jt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Jt.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;s.firstChild;)r.appendChild(s.firstChild)}});function Or(r,s){if(s){var d=r.firstChild;if(d&&d===r.lastChild&&d.nodeType===3){d.nodeValue=s;return}}r.textContent=s}var Ur={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Yt=["Webkit","ms","Moz","O"];Object.keys(Ur).forEach(function(r){Yt.forEach(function(s){s=s+r.charAt(0).toUpperCase()+r.substring(1),Ur[s]=Ur[r]})});function Nn(r,s,d){return s==null||typeof s=="boolean"||s===""?"":d||typeof s!="number"||s===0||Ur.hasOwnProperty(r)&&Ur[r]?(""+s).trim():s+"px"}function oc(r,s){r=r.style;for(var d in s)if(s.hasOwnProperty(d)){var E=d.indexOf("--")===0,L=Nn(d,s[d],E);d==="float"&&(d="cssFloat"),E?r.setProperty(d,L):r[d]=L}}var qa=re({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _o(r,s){if(s){if(qa[r]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(o(137,r));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(o(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(o(61))}if(s.style!=null&&typeof s.style!="object")throw Error(o(62))}}function er(r,s){if(r.indexOf("-")===-1)return typeof s.is=="string";switch(r){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 nn=null;function ys(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var wo=null,js=null,es=null;function Go(r){if(r=va(r)){if(typeof wo!="function")throw Error(o(280));var s=r.stateNode;s&&(s=pl(s),wo(r.stateNode,r.type,s))}}function Bn(r){js?es?es.push(r):es=[r]:js=r}function Ko(){if(js){var r=js,s=es;if(es=js=null,Go(r),s)for(r=0;r<s.length;r++)Go(s[r])}}function zn(r,s){return r(s)}function Xo(){}var on=!1;function Fn(r,s,d){if(on)return r(s,d);on=!0;try{return zn(r,s,d)}finally{on=!1,(js!==null||es!==null)&&(Xo(),Ko())}}function Li(r,s){var d=r.stateNode;if(d===null)return null;var E=pl(d);if(E===null)return null;d=E[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(E=!E.disabled)||(r=r.type,E=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!E;break e;default:r=!1}if(r)return null;if(d&&typeof d!="function")throw Error(o(231,s,typeof d));return d}var ji=!1;if(l)try{var _s={};Object.defineProperty(_s,"passive",{get:function(){ji=!0}}),window.addEventListener("test",_s,_s),window.removeEventListener("test",_s,_s)}catch{ji=!1}function Ga(r,s,d,E,L,z,Z,fe,we){var Le=Array.prototype.slice.call(arguments,3);try{s.apply(d,Le)}catch(Xe){this.onError(Xe)}}var an=!1,Un=null,Os=!1,St=null,Ti={onError:function(r){an=!0,Un=r}};function pr(r,s,d,E,L,z,Z,fe,we){an=!1,Un=null,Ga.apply(Ti,arguments)}function ln(r,s,d,E,L,z,Z,fe,we){if(pr.apply(this,arguments),an){if(an){var Le=Un;an=!1,Un=null}else throw Error(o(198));Os||(Os=!0,St=Le)}}function ct(r){var s=r,d=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(d=s.return),r=s.return;while(r)}return s.tag===3?d:null}function Vn(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function Jo(r){if(ct(r)!==r)throw Error(o(188))}function sd(r){var s=r.alternate;if(!s){if(s=ct(r),s===null)throw Error(o(188));return s!==r?null:r}for(var d=r,E=s;;){var L=d.return;if(L===null)break;var z=L.alternate;if(z===null){if(E=L.return,E!==null){d=E;continue}break}if(L.child===z.child){for(z=L.child;z;){if(z===d)return Jo(L),r;if(z===E)return Jo(L),s;z=z.sibling}throw Error(o(188))}if(d.return!==E.return)d=L,E=z;else{for(var Z=!1,fe=L.child;fe;){if(fe===d){Z=!0,d=L,E=z;break}if(fe===E){Z=!0,E=L,d=z;break}fe=fe.sibling}if(!Z){for(fe=z.child;fe;){if(fe===d){Z=!0,d=z,E=L;break}if(fe===E){Z=!0,E=z,d=L;break}fe=fe.sibling}if(!Z)throw Error(o(189))}}if(d.alternate!==E)throw Error(o(190))}if(d.tag!==3)throw Error(o(188));return d.stateNode.current===d?r:s}function Yo(r){return r=sd(r),r!==null?Qo(r):null}function Qo(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var s=Qo(r);if(s!==null)return s;r=r.sibling}return null}var Zo=i.unstable_scheduleCallback,ts=i.unstable_cancelCallback,Ka=i.unstable_shouldYield,Xa=i.unstable_requestPaint,mr=i.unstable_now,$i=i.unstable_getCurrentPriorityLevel,Qr=i.unstable_ImmediatePriority,di=i.unstable_UserBlockingPriority,Ns=i.unstable_NormalPriority,bo=i.unstable_LowPriority,Wn=i.unstable_IdlePriority,Bs=null,hi=null;function xt(r){if(hi&&typeof hi.onCommitFiberRoot=="function")try{hi.onCommitFiberRoot(Bs,r,void 0,(r.current.flags&128)===128)}catch{}}var Vr=Math.clz32?Math.clz32:ea,Ja=Math.log,Ya=Math.LN2;function ea(r){return r>>>=0,r===0?32:31-(Ja(r)/Ya|0)|0}var cn=64,Oi=4194304;function zs(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function un(r,s){var d=r.pendingLanes;if(d===0)return 0;var E=0,L=r.suspendedLanes,z=r.pingedLanes,Z=d&268435455;if(Z!==0){var fe=Z&~L;fe!==0?E=zs(fe):(z&=Z,z!==0&&(E=zs(z)))}else Z=d&~L,Z!==0?E=zs(Z):z!==0&&(E=zs(z));if(E===0)return 0;if(s!==0&&s!==E&&(s&L)===0&&(L=E&-E,z=s&-s,L>=z||L===16&&(z&4194240)!==0))return s;if((E&4)!==0&&(E|=d&16),s=r.entangledLanes,s!==0)for(r=r.entanglements,s&=E;0<s;)d=31-Vr(s),L=1<<d,E|=r[d],s&=~L;return E}function Nt(r,s){switch(r){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ni(r,s){for(var d=r.suspendedLanes,E=r.pingedLanes,L=r.expirationTimes,z=r.pendingLanes;0<z;){var Z=31-Vr(z),fe=1<<Z,we=L[Z];we===-1?((fe&d)===0||(fe&E)!==0)&&(L[Z]=Nt(fe,s)):we<=s&&(r.expiredLanes|=fe),z&=~fe}}function Hn(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function ws(){var r=cn;return cn<<=1,(cn&4194240)===0&&(cn=64),r}function Be(r){for(var s=[],d=0;31>d;d++)s.push(r);return s}function rs(r,s,d){r.pendingLanes|=s,s!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,s=31-Vr(s),r[s]=d}function ta(r,s){var d=r.pendingLanes&~s;r.pendingLanes=s,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=s,r.mutableReadLanes&=s,r.entangledLanes&=s,s=r.entanglements;var E=r.eventTimes;for(r=r.expirationTimes;0<d;){var L=31-Vr(d),z=1<<L;s[L]=0,E[L]=-1,r[L]=-1,d&=~z}}function xo(r,s){var d=r.entangledLanes|=s;for(r=r.entanglements;d;){var E=31-Vr(d),L=1<<E;L&s|r[E]&s&&(r[E]|=s),d&=~L}}var Ft=0;function mt(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var bs,Fs,Us,dn,qn,hn=!1,Ai=[],Wr=null,Bi=null,zi=null,Vs=new Map,fn=new Map,is=[],ac="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function pn(r,s){switch(r){case"focusin":case"focusout":Wr=null;break;case"dragenter":case"dragleave":Bi=null;break;case"mouseover":case"mouseout":zi=null;break;case"pointerover":case"pointerout":Vs.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":fn.delete(s.pointerId)}}function mn(r,s,d,E,L,z){return r===null||r.nativeEvent!==z?(r={blockedOn:s,domEventName:d,eventSystemFlags:E,nativeEvent:z,targetContainers:[L]},s!==null&&(s=va(s),s!==null&&Fs(s)),r):(r.eventSystemFlags|=E,s=r.targetContainers,L!==null&&s.indexOf(L)===-1&&s.push(L),r)}function Qa(r,s,d,E,L){switch(s){case"focusin":return Wr=mn(Wr,r,s,d,E,L),!0;case"dragenter":return Bi=mn(Bi,r,s,d,E,L),!0;case"mouseover":return zi=mn(zi,r,s,d,E,L),!0;case"pointerover":var z=L.pointerId;return Vs.set(z,mn(Vs.get(z)||null,r,s,d,E,L)),!0;case"gotpointercapture":return z=L.pointerId,fn.set(z,mn(fn.get(z)||null,r,s,d,E,L)),!0}return!1}function ra(r){var s=Xn(r.target);if(s!==null){var d=ct(s);if(d!==null){if(s=d.tag,s===13){if(s=Vn(d),s!==null){r.blockedOn=s,qn(r.priority,function(){Us(d)});return}}else if(s===3&&d.stateNode.current.memoizedState.isDehydrated){r.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}r.blockedOn=null}function gn(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var d=q(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(d===null){d=r.nativeEvent;var E=new d.constructor(d.type,d);nn=E,d.target.dispatchEvent(E),nn=null}else return s=va(d),s!==null&&Fs(s),r.blockedOn=d,!1;s.shift()}return!0}function So(r,s,d){gn(r)&&d.delete(s)}function ia(){hn=!1,Wr!==null&&gn(Wr)&&(Wr=null),Bi!==null&&gn(Bi)&&(Bi=null),zi!==null&&gn(zi)&&(zi=null),Vs.forEach(So),fn.forEach(So)}function xs(r,s){r.blockedOn===s&&(r.blockedOn=null,hn||(hn=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,ia)))}function Ws(r){function s(L){return xs(L,r)}if(0<Ai.length){xs(Ai[0],r);for(var d=1;d<Ai.length;d++){var E=Ai[d];E.blockedOn===r&&(E.blockedOn=null)}}for(Wr!==null&&xs(Wr,r),Bi!==null&&xs(Bi,r),zi!==null&&xs(zi,r),Vs.forEach(s),fn.forEach(s),d=0;d<is.length;d++)E=is[d],E.blockedOn===r&&(E.blockedOn=null);for(;0<is.length&&(d=is[0],d.blockedOn===null);)ra(d),d.blockedOn===null&&is.shift()}var Ss=P.ReactCurrentBatchConfig,vn=!0;function Za(r,s,d,E){var L=Ft,z=Ss.transition;Ss.transition=null;try{Ft=1,sa(r,s,d,E)}finally{Ft=L,Ss.transition=z}}function el(r,s,d,E){var L=Ft,z=Ss.transition;Ss.transition=null;try{Ft=4,sa(r,s,d,E)}finally{Ft=L,Ss.transition=z}}function sa(r,s,d,E){if(vn){var L=q(r,s,d,E);if(L===null)bc(r,s,E,na,d),pn(r,E);else if(Qa(L,r,s,d,E))E.stopPropagation();else if(pn(r,E),s&4&&-1<ac.indexOf(r)){for(;L!==null;){var z=va(L);if(z!==null&&bs(z),z=q(r,s,d,E),z===null&&bc(r,s,E,na,d),z===L)break;L=z}L!==null&&E.stopPropagation()}else bc(r,s,E,null,d)}}var na=null;function q(r,s,d,E){if(na=null,r=ys(E),r=Xn(r),r!==null)if(s=ct(r),s===null)r=null;else if(d=s.tag,d===13){if(r=Vn(s),r!==null)return r;r=null}else if(d===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null);return na=r,null}function te(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch($i()){case Qr:return 1;case di:return 4;case Ns:case bo:return 16;case Wn:return 536870912;default:return 16}default:return 16}}var ce=null,_e=null,pe=null;function Re(){if(pe)return pe;var r,s=_e,d=s.length,E,L="value"in ce?ce.value:ce.textContent,z=L.length;for(r=0;r<d&&s[r]===L[r];r++);var Z=d-r;for(E=1;E<=Z&&s[d-E]===L[z-E];E++);return pe=L.slice(r,1<E?1-E:void 0)}function xe(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function Se(){return!0}function De(){return!1}function Ue(r){function s(d,E,L,z,Z){this._reactName=d,this._targetInst=L,this.type=E,this.nativeEvent=z,this.target=Z,this.currentTarget=null;for(var fe in r)r.hasOwnProperty(fe)&&(d=r[fe],this[fe]=d?d(z):z[fe]);return this.isDefaultPrevented=(z.defaultPrevented!=null?z.defaultPrevented:z.returnValue===!1)?Se:De,this.isPropagationStopped=De,this}return re(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Se)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Se)},persist:function(){},isPersistent:Se}),s}var qe={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},We=Ue(qe),Oe=re({},qe,{view:0,detail:0}),lt=Ue(Oe),Ae,Ye,Qt,At=re({},Oe,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bt,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Qt&&(Qt&&r.type==="mousemove"?(Ae=r.screenX-Qt.screenX,Ye=r.screenY-Qt.screenY):Ye=Ae=0,Qt=r),Ae)},movementY:function(r){return"movementY"in r?r.movementY:Ye}}),Rt=Ue(At),Zt=re({},At,{dataTransfer:0}),gt=Ue(Zt),rr=re({},Oe,{relatedTarget:0}),Ut=Ue(rr),Pr=re({},qe,{animationName:0,elapsedTime:0,pseudoElement:0}),Hr=Ue(Pr),Zr=re({},qe,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),ko=Ue(Zr),ei=re({},qe,{data:0}),oa=Ue(ei),tl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Dr={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"},ss={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rl(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=ss[r])?!!s[r]:!1}function Bt(){return rl}var Fi=re({},Oe,{key:function(r){if(r.key){var s=tl[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=xe(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Dr[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bt,charCode:function(r){return r.type==="keypress"?xe(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?xe(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),lc=Ue(Fi),ks=re({},At,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gn=Ue(ks),wr=re({},Oe,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bt}),ti=Ue(wr),aa=re({},qe,{propertyName:0,elapsedTime:0,pseudoElement:0}),ri=Ue(aa),il=re({},At,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),cc=Ue(il),Cs=[9,13,27,32],Ui=l&&"CompositionEvent"in window,ns=null;l&&"documentMode"in document&&(ns=document.documentMode);var br=l&&"TextEvent"in window&&!ns,ar=l&&(!Ui||ns&&8<ns&&11>=ns),Vi=" ",sl=!1;function nl(r,s){switch(r){case"keyup":return Cs.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cf(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ii=!1;function Ef(r,s){switch(r){case"compositionend":return Cf(s);case"keypress":return s.which!==32?null:(sl=!0,Vi);case"textInput":return r=s.data,r===Vi&&sl?null:r;default:return null}}function uc(r,s){if(ii)return r==="compositionend"||!Ui&&nl(r,s)?(r=Re(),pe=_e=ce=null,ii=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return ar&&s.locale!=="ko"?null:s.data;default:return null}}var nd={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 os(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!nd[r.type]:s==="textarea"}function od(r,s,d,E){Bn(E),s=cl(s,"onChange"),0<s.length&&(d=new We("onChange","change",null,d,E),r.push({event:d,listeners:s}))}var la=null,ca=null;function Tf(r){xd(r,0)}function ol(r){var s=To(r);if(tt(s))return r}function $f(r,s){if(r==="change")return s}var ad=!1;if(l){var dc;if(l){var hc="oninput"in document;if(!hc){var ld=document.createElement("div");ld.setAttribute("oninput","return;"),hc=typeof ld.oninput=="function"}dc=hc}else dc=!1;ad=dc&&(!document.documentMode||9<document.documentMode)}function as(){la&&(la.detachEvent("onpropertychange",cd),ca=la=null)}function cd(r){if(r.propertyName==="value"&&ol(ca)){var s=[];od(s,ca,r,ys(r)),Fn(Tf,s)}}function Af(r,s,d){r==="focusin"?(as(),la=s,ca=d,la.attachEvent("onpropertychange",cd)):r==="focusout"&&as()}function Rf(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ol(ca)}function Pf(r,s){if(r==="click")return ol(s)}function Df(r,s){if(r==="input"||r==="change")return ol(s)}function If(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var ls=typeof Object.is=="function"?Object.is:If;function ua(r,s){if(ls(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var d=Object.keys(r),E=Object.keys(s);if(d.length!==E.length)return!1;for(E=0;E<d.length;E++){var L=d[E];if(!u.call(s,L)||!ls(r[L],s[L]))return!1}return!0}function ud(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function dd(r,s){var d=ud(r);r=0;for(var E;d;){if(d.nodeType===3){if(E=r+d.textContent.length,r<=s&&E>=s)return{node:d,offset:s-r};r=E}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=ud(d)}}function fc(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?fc(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function pc(){for(var r=window,s=It();s instanceof r.HTMLIFrameElement;){try{var d=typeof s.contentWindow.location.href=="string"}catch{d=!1}if(d)r=s.contentWindow;else break;s=It(r.document)}return s}function mc(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}function Mf(r){var s=pc(),d=r.focusedElem,E=r.selectionRange;if(s!==d&&d&&d.ownerDocument&&fc(d.ownerDocument.documentElement,d)){if(E!==null&&mc(d)){if(s=E.start,r=E.end,r===void 0&&(r=s),"selectionStart"in d)d.selectionStart=s,d.selectionEnd=Math.min(r,d.value.length);else if(r=(s=d.ownerDocument||document)&&s.defaultView||window,r.getSelection){r=r.getSelection();var L=d.textContent.length,z=Math.min(E.start,L);E=E.end===void 0?z:Math.min(E.end,L),!r.extend&&z>E&&(L=E,E=z,z=L),L=dd(d,z);var Z=dd(d,E);L&&Z&&(r.rangeCount!==1||r.anchorNode!==L.node||r.anchorOffset!==L.offset||r.focusNode!==Z.node||r.focusOffset!==Z.offset)&&(s=s.createRange(),s.setStart(L.node,L.offset),r.removeAllRanges(),z>E?(r.addRange(s),r.extend(Z.node,Z.offset)):(s.setEnd(Z.node,Z.offset),r.addRange(s)))}}for(s=[],r=d;r=r.parentNode;)r.nodeType===1&&s.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<s.length;d++)r=s[d],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var hd=l&&"documentMode"in document&&11>=document.documentMode,da=null,gc=null,Kn=null,vc=!1;function fd(r,s,d){var E=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;vc||da==null||da!==It(E)||(E=da,"selectionStart"in E&&mc(E)?E={start:E.selectionStart,end:E.selectionEnd}:(E=(E.ownerDocument&&E.ownerDocument.defaultView||window).getSelection(),E={anchorNode:E.anchorNode,anchorOffset:E.anchorOffset,focusNode:E.focusNode,focusOffset:E.focusOffset}),Kn&&ua(Kn,E)||(Kn=E,E=cl(gc,"onSelect"),0<E.length&&(s=new We("onSelect","select",null,s,d),r.push({event:s,listeners:E}),s.target=da)))}function al(r,s){var d={};return d[r.toLowerCase()]=s.toLowerCase(),d["Webkit"+r]="webkit"+s,d["Moz"+r]="moz"+s,d}var Hs={animationend:al("Animation","AnimationEnd"),animationiteration:al("Animation","AnimationIteration"),animationstart:al("Animation","AnimationStart"),transitionend:al("Transition","TransitionEnd")},yc={},pd={};l&&(pd=document.createElement("div").style,"AnimationEvent"in window||(delete Hs.animationend.animation,delete Hs.animationiteration.animation,delete Hs.animationstart.animation),"TransitionEvent"in window||delete Hs.transitionend.transition);function ha(r){if(yc[r])return yc[r];if(!Hs[r])return r;var s=Hs[r],d;for(d in s)if(s.hasOwnProperty(d)&&d in pd)return yc[r]=s[d];return r}var md=ha("animationend"),gd=ha("animationiteration"),vd=ha("animationstart"),yd=ha("transitionend"),Lf=new Map,_d="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function yn(r,s){Lf.set(r,s),S(s,[r])}for(var _c=0;_c<_d.length;_c++){var wd=_d[_c],jf=wd.toLowerCase(),qt=wd[0].toUpperCase()+wd.slice(1);yn(jf,"on"+qt)}yn(md,"onAnimationEnd"),yn(gd,"onAnimationIteration"),yn(vd,"onAnimationStart"),yn("dblclick","onDoubleClick"),yn("focusin","onFocus"),yn("focusout","onBlur"),yn(yd,"onTransitionEnd"),v("onMouseEnter",["mouseout","mouseover"]),v("onMouseLeave",["mouseout","mouseover"]),v("onPointerEnter",["pointerout","pointerover"]),v("onPointerLeave",["pointerout","pointerover"]),S("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),S("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),S("onBeforeInput",["compositionend","keypress","textInput","paste"]),S("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),S("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),S("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fa="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(" "),Of=new Set("cancel close invalid load scroll toggle".split(" ").concat(fa));function bd(r,s,d){var E=r.type||"unknown-event";r.currentTarget=d,ln(E,s,void 0,r),r.currentTarget=null}function xd(r,s){s=(s&4)!==0;for(var d=0;d<r.length;d++){var E=r[d],L=E.event;E=E.listeners;e:{var z=void 0;if(s)for(var Z=E.length-1;0<=Z;Z--){var fe=E[Z],we=fe.instance,Le=fe.currentTarget;if(fe=fe.listener,we!==z&&L.isPropagationStopped())break e;bd(L,fe,Le),z=we}else for(Z=0;Z<E.length;Z++){if(fe=E[Z],we=fe.instance,Le=fe.currentTarget,fe=fe.listener,we!==z&&L.isPropagationStopped())break e;bd(L,fe,Le),z=we}}}if(Os)throw r=St,Os=!1,St=null,r}function nr(r,s){var d=s[Tc];d===void 0&&(d=s[Tc]=new Set);var E=r+"__bubble";d.has(E)||(Sd(s,r,2,!1),d.add(E))}function wc(r,s,d){var E=0;s&&(E|=4),Sd(d,r,E,s)}var ll="_reactListening"+Math.random().toString(36).slice(2);function pa(r){if(!r[ll]){r[ll]=!0,a.forEach(function(d){d!=="selectionchange"&&(Of.has(d)||wc(d,!1,r),wc(d,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[ll]||(s[ll]=!0,wc("selectionchange",!1,s))}}function Sd(r,s,d,E){switch(te(s)){case 1:var L=Za;break;case 4:L=el;break;default:L=sa}d=L.bind(null,s,d,r),L=void 0,!ji||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(L=!0),E?L!==void 0?r.addEventListener(s,d,{capture:!0,passive:L}):r.addEventListener(s,d,!0):L!==void 0?r.addEventListener(s,d,{passive:L}):r.addEventListener(s,d,!1)}function bc(r,s,d,E,L){var z=E;if((s&1)===0&&(s&2)===0&&E!==null)e:for(;;){if(E===null)return;var Z=E.tag;if(Z===3||Z===4){var fe=E.stateNode.containerInfo;if(fe===L||fe.nodeType===8&&fe.parentNode===L)break;if(Z===4)for(Z=E.return;Z!==null;){var we=Z.tag;if((we===3||we===4)&&(we=Z.stateNode.containerInfo,we===L||we.nodeType===8&&we.parentNode===L))return;Z=Z.return}for(;fe!==null;){if(Z=Xn(fe),Z===null)return;if(we=Z.tag,we===5||we===6){E=z=Z;continue e}fe=fe.parentNode}}E=E.return}Fn(function(){var Le=z,Xe=ys(d),Je=[];e:{var Ke=Lf.get(r);if(Ke!==void 0){var at=We,dt=r;switch(r){case"keypress":if(xe(d)===0)break e;case"keydown":case"keyup":at=lc;break;case"focusin":dt="focus",at=Ut;break;case"focusout":dt="blur",at=Ut;break;case"beforeblur":case"afterblur":at=Ut;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":at=Rt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":at=gt;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":at=ti;break;case md:case gd:case vd:at=Hr;break;case yd:at=ri;break;case"scroll":at=lt;break;case"wheel":at=cc;break;case"copy":case"cut":case"paste":at=ko;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":at=Gn}var ft=(s&4)!==0,sr=!ft&&r==="scroll",Ie=ft?Ke!==null?Ke+"Capture":null:Ke;ft=[];for(var Ee=Le,je;Ee!==null;){je=Ee;var rt=je.stateNode;if(je.tag===5&&rt!==null&&(je=rt,Ie!==null&&(rt=Li(Ee,Ie),rt!=null&&ft.push(ma(Ee,rt,je)))),sr)break;Ee=Ee.return}0<ft.length&&(Ke=new at(Ke,dt,null,d,Xe),Je.push({event:Ke,listeners:ft}))}}if((s&7)===0){e:{if(Ke=r==="mouseover"||r==="pointerover",at=r==="mouseout"||r==="pointerout",Ke&&d!==nn&&(dt=d.relatedTarget||d.fromElement)&&(Xn(dt)||dt[Ts]))break e;if((at||Ke)&&(Ke=Xe.window===Xe?Xe:(Ke=Xe.ownerDocument)?Ke.defaultView||Ke.parentWindow:window,at?(dt=d.relatedTarget||d.toElement,at=Le,dt=dt?Xn(dt):null,dt!==null&&(sr=ct(dt),dt!==sr||dt.tag!==5&&dt.tag!==6)&&(dt=null)):(at=null,dt=Le),at!==dt)){if(ft=Rt,rt="onMouseLeave",Ie="onMouseEnter",Ee="mouse",(r==="pointerout"||r==="pointerover")&&(ft=Gn,rt="onPointerLeave",Ie="onPointerEnter",Ee="pointer"),sr=at==null?Ke:To(at),je=dt==null?Ke:To(dt),Ke=new ft(rt,Ee+"leave",at,d,Xe),Ke.target=sr,Ke.relatedTarget=je,rt=null,Xn(Xe)===Le&&(ft=new ft(Ie,Ee+"enter",dt,d,Xe),ft.target=je,ft.relatedTarget=sr,rt=ft),sr=rt,at&&dt)t:{for(ft=at,Ie=dt,Ee=0,je=ft;je;je=Co(je))Ee++;for(je=0,rt=Ie;rt;rt=Co(rt))je++;for(;0<Ee-je;)ft=Co(ft),Ee--;for(;0<je-Ee;)Ie=Co(Ie),je--;for(;Ee--;){if(ft===Ie||Ie!==null&&ft===Ie.alternate)break t;ft=Co(ft),Ie=Co(Ie)}ft=null}else ft=null;at!==null&&kd(Je,Ke,at,ft,!1),dt!==null&&sr!==null&&kd(Je,sr,dt,ft,!0)}}e:{if(Ke=Le?To(Le):window,at=Ke.nodeName&&Ke.nodeName.toLowerCase(),at==="select"||at==="input"&&Ke.type==="file")var _t=$f;else if(os(Ke))if(ad)_t=Df;else{_t=Rf;var Et=Af}else(at=Ke.nodeName)&&at.toLowerCase()==="input"&&(Ke.type==="checkbox"||Ke.type==="radio")&&(_t=Pf);if(_t&&(_t=_t(r,Le))){od(Je,_t,d,Xe);break e}Et&&Et(r,Ke,Le),r==="focusout"&&(Et=Ke._wrapperState)&&Et.controlled&&Ke.type==="number"&&tr(Ke,"number",Ke.value)}switch(Et=Le?To(Le):window,r){case"focusin":(os(Et)||Et.contentEditable==="true")&&(da=Et,gc=Le,Kn=null);break;case"focusout":Kn=gc=da=null;break;case"mousedown":vc=!0;break;case"contextmenu":case"mouseup":case"dragend":vc=!1,fd(Je,d,Xe);break;case"selectionchange":if(hd)break;case"keydown":case"keyup":fd(Je,d,Xe)}var Tt;if(Ui)e:{switch(r){case"compositionstart":var Lt="onCompositionStart";break e;case"compositionend":Lt="onCompositionEnd";break e;case"compositionupdate":Lt="onCompositionUpdate";break e}Lt=void 0}else ii?nl(r,d)&&(Lt="onCompositionEnd"):r==="keydown"&&d.keyCode===229&&(Lt="onCompositionStart");Lt&&(ar&&d.locale!=="ko"&&(ii||Lt!=="onCompositionStart"?Lt==="onCompositionEnd"&&ii&&(Tt=Re()):(ce=Xe,_e="value"in ce?ce.value:ce.textContent,ii=!0)),Et=cl(Le,Lt),0<Et.length&&(Lt=new oa(Lt,r,null,d,Xe),Je.push({event:Lt,listeners:Et}),Tt?Lt.data=Tt:(Tt=Cf(d),Tt!==null&&(Lt.data=Tt)))),(Tt=br?Ef(r,d):uc(r,d))&&(Le=cl(Le,"onBeforeInput"),0<Le.length&&(Xe=new oa("onBeforeInput","beforeinput",null,d,Xe),Je.push({event:Xe,listeners:Le}),Xe.data=Tt))}xd(Je,s)})}function ma(r,s,d){return{instance:r,listener:s,currentTarget:d}}function cl(r,s){for(var d=s+"Capture",E=[];r!==null;){var L=r,z=L.stateNode;L.tag===5&&z!==null&&(L=z,z=Li(r,d),z!=null&&E.unshift(ma(r,z,L)),z=Li(r,s),z!=null&&E.push(ma(r,z,L))),r=r.return}return E}function Co(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function kd(r,s,d,E,L){for(var z=s._reactName,Z=[];d!==null&&d!==E;){var fe=d,we=fe.alternate,Le=fe.stateNode;if(we!==null&&we===E)break;fe.tag===5&&Le!==null&&(fe=Le,L?(we=Li(d,z),we!=null&&Z.unshift(ma(d,we,fe))):L||(we=Li(d,z),we!=null&&Z.push(ma(d,we,fe)))),d=d.return}Z.length!==0&&r.push({event:s,listeners:Z})}var ul=/\r\n?/g,Nf=/\u0000|\uFFFD/g;function dl(r){return(typeof r=="string"?r:""+r).replace(ul,`
|
|
39
39
|
`).replace(Nf,"")}function hl(r,s,d){if(s=dl(s),dl(r)!==s&&d)throw Error(o(425))}function fl(){}var xc=null,Sc=null;function kc(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Cc=typeof setTimeout=="function"?setTimeout:void 0,Bf=typeof clearTimeout=="function"?clearTimeout:void 0,Cd=typeof Promise=="function"?Promise:void 0,zf=typeof queueMicrotask=="function"?queueMicrotask:typeof Cd<"u"?function(r){return Cd.resolve(null).then(r).catch(Ff)}:Cc;function Ff(r){setTimeout(function(){throw r})}function Ec(r,s){var d=s,E=0;do{var L=d.nextSibling;if(r.removeChild(d),L&&L.nodeType===8)if(d=L.data,d==="/$"){if(E===0){r.removeChild(L),Ws(s);return}E--}else d!=="$"&&d!=="$?"&&d!=="$!"||E++;d=L}while(d);Ws(s)}function _n(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return r}function Ed(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var d=r.data;if(d==="$"||d==="$!"||d==="$?"){if(s===0)return r;s--}else d==="/$"&&s++}r=r.previousSibling}return null}var Eo=Math.random().toString(36).slice(2),Es="__reactFiber$"+Eo,ga="__reactProps$"+Eo,Ts="__reactContainer$"+Eo,Tc="__reactEvents$"+Eo,Td="__reactListeners$"+Eo,$d="__reactHandles$"+Eo;function Xn(r){var s=r[Es];if(s)return s;for(var d=r.parentNode;d;){if(s=d[Ts]||d[Es]){if(d=s.alternate,s.child!==null||d!==null&&d.child!==null)for(r=Ed(r);r!==null;){if(d=r[Es])return d;r=Ed(r)}return s}r=d,d=r.parentNode}return null}function va(r){return r=r[Es]||r[Ts],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function To(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(o(33))}function pl(r){return r[ga]||null}var $c=[],$o=-1;function qs(r){return{current:r}}function or(r){0>$o||(r.current=$c[$o],$c[$o]=null,$o--)}function ir(r,s){$o++,$c[$o]=r.current,r.current=s}var wn={},si=qs(wn),fi=qs(!1),Jn=wn;function ni(r,s){var d=r.type.contextTypes;if(!d)return wn;var E=r.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===s)return E.__reactInternalMemoizedMaskedChildContext;var L={},z;for(z in d)L[z]=s[z];return E&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=s,r.__reactInternalMemoizedMaskedChildContext=L),L}function pi(r){return r=r.childContextTypes,r!=null}function ml(){or(fi),or(si)}function Ad(r,s,d){if(si.current!==wn)throw Error(o(168));ir(si,s),ir(fi,d)}function Rd(r,s,d){var E=r.stateNode;if(s=s.childContextTypes,typeof E.getChildContext!="function")return d;E=E.getChildContext();for(var L in E)if(!(L in s))throw Error(o(108,Ce(r)||"Unknown",L));return re({},d,E)}function gl(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||wn,Jn=si.current,ir(si,r),ir(fi,fi.current),!0}function Pd(r,s,d){var E=r.stateNode;if(!E)throw Error(o(169));d?(r=Rd(r,s,Jn),E.__reactInternalMemoizedMergedChildContext=r,or(fi),or(si),ir(si,r)):or(fi),ir(fi,d)}var Gs=null,vl=!1,Ac=!1;function Dd(r){Gs===null?Gs=[r]:Gs.push(r)}function Em(r){vl=!0,Dd(r)}function bn(){if(!Ac&&Gs!==null){Ac=!0;var r=0,s=Ft;try{var d=Gs;for(Ft=1;r<d.length;r++){var E=d[r];do E=E(!0);while(E!==null)}Gs=null,vl=!1}catch(L){throw Gs!==null&&(Gs=Gs.slice(r+1)),Zo(Qr,bn),L}finally{Ft=s,Ac=!1}}return null}var Ao=[],Ro=0,yl=null,_l=0,Wi=[],cs=0,Hi=null,mi=1,gi="";function xn(r,s){Ao[Ro++]=_l,Ao[Ro++]=yl,yl=r,_l=s}function Yn(r,s,d){Wi[cs++]=mi,Wi[cs++]=gi,Wi[cs++]=Hi,Hi=r;var E=mi;r=gi;var L=32-Vr(E)-1;E&=~(1<<L),d+=1;var z=32-Vr(s)+L;if(30<z){var Z=L-L%5;z=(E&(1<<Z)-1).toString(32),E>>=Z,L-=Z,mi=1<<32-Vr(s)+L|d<<L|E,gi=z+r}else mi=1<<z|d<<L|E,gi=r}function Cr(r){r.return!==null&&(xn(r,1),Yn(r,1,0))}function Rc(r){for(;r===yl;)yl=Ao[--Ro],Ao[Ro]=null,_l=Ao[--Ro],Ao[Ro]=null;for(;r===Hi;)Hi=Wi[--cs],Wi[cs]=null,gi=Wi[--cs],Wi[cs]=null,mi=Wi[--cs],Wi[cs]=null}var vi=null,Ri=null,ur=!1,yi=null;function Pc(r,s){var d=Di(5,null,null,0);d.elementType="DELETED",d.stateNode=s,d.return=r,s=r.deletions,s===null?(r.deletions=[d],r.flags|=16):s.push(d)}function Dc(r,s){switch(r.tag){case 5:var d=r.type;return s=s.nodeType!==1||d.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(r.stateNode=s,vi=r,Ri=_n(s.firstChild),!0):!1;case 6:return s=r.pendingProps===""||s.nodeType!==3?null:s,s!==null?(r.stateNode=s,vi=r,Ri=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(d=Hi!==null?{id:mi,overflow:gi}:null,r.memoizedState={dehydrated:s,treeContext:d,retryLane:1073741824},d=Di(18,null,null,0),d.stateNode=s,d.return=r,r.child=d,vi=r,Ri=null,!0):!1;default:return!1}}function Ic(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Mc(r){if(ur){var s=Ri;if(s){var d=s;if(!Dc(r,s)){if(Ic(r))throw Error(o(418));s=_n(d.nextSibling);var E=vi;s&&Dc(r,s)?Pc(E,d):(r.flags=r.flags&-4097|2,ur=!1,vi=r)}}else{if(Ic(r))throw Error(o(418));r.flags=r.flags&-4097|2,ur=!1,vi=r}}}function Lc(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;vi=r}function ya(r){if(r!==vi)return!1;if(!ur)return Lc(r),ur=!0,!1;var s;if((s=r.tag!==3)&&!(s=r.tag!==5)&&(s=r.type,s=s!=="head"&&s!=="body"&&!kc(r.type,r.memoizedProps)),s&&(s=Ri)){if(Ic(r))throw Id(),Error(o(418));for(;s;)Pc(r,s),s=_n(s.nextSibling)}if(Lc(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(317));e:{for(r=r.nextSibling,s=0;r;){if(r.nodeType===8){var d=r.data;if(d==="/$"){if(s===0){Ri=_n(r.nextSibling);break e}s--}else d!=="$"&&d!=="$!"&&d!=="$?"||s++}r=r.nextSibling}Ri=null}}else Ri=vi?_n(r.stateNode.nextSibling):null;return!0}function Id(){for(var r=Ri;r;)r=_n(r.nextSibling)}function Qn(){Ri=vi=null,ur=!1}function jc(r){yi===null?yi=[r]:yi.push(r)}var Oc=P.ReactCurrentBatchConfig;function Po(r,s,d){if(r=d.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(o(309));var E=d.stateNode}if(!E)throw Error(o(147,r));var L=E,z=""+r;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===z?s.ref:(s=function(Z){var fe=L.refs;Z===null?delete fe[z]:fe[z]=Z},s._stringRef=z,s)}if(typeof r!="string")throw Error(o(284));if(!d._owner)throw Error(o(290,r))}return r}function wl(r,s){throw r=Object.prototype.toString.call(s),Error(o(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r))}function Md(r){var s=r._init;return s(r._payload)}function Uf(r){function s(Ie,Ee){if(r){var je=Ie.deletions;je===null?(Ie.deletions=[Ee],Ie.flags|=16):je.push(Ee)}}function d(Ie,Ee){if(!r)return null;for(;Ee!==null;)s(Ie,Ee),Ee=Ee.sibling;return null}function E(Ie,Ee){for(Ie=new Map;Ee!==null;)Ee.key!==null?Ie.set(Ee.key,Ee):Ie.set(Ee.index,Ee),Ee=Ee.sibling;return Ie}function L(Ie,Ee){return Ie=Rn(Ie,Ee),Ie.index=0,Ie.sibling=null,Ie}function z(Ie,Ee,je){return Ie.index=je,r?(je=Ie.alternate,je!==null?(je=je.index,je<Ee?(Ie.flags|=2,Ee):je):(Ie.flags|=2,Ee)):(Ie.flags|=1048576,Ee)}function Z(Ie){return r&&Ie.alternate===null&&(Ie.flags|=2),Ie}function fe(Ie,Ee,je,rt){return Ee===null||Ee.tag!==6?(Ee=Mu(je,Ie.mode,rt),Ee.return=Ie,Ee):(Ee=L(Ee,je),Ee.return=Ie,Ee)}function we(Ie,Ee,je,rt){var _t=je.type;return _t===F?Xe(Ie,Ee,je.props.children,rt,je.key):Ee!==null&&(Ee.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===ke&&Md(_t)===Ee.type)?(rt=L(Ee,je.props),rt.ref=Po(Ie,Ee,je),rt.return=Ie,rt):(rt=Ul(je.type,je.key,je.props,null,Ie.mode,rt),rt.ref=Po(Ie,Ee,je),rt.return=Ie,rt)}function Le(Ie,Ee,je,rt){return Ee===null||Ee.tag!==4||Ee.stateNode.containerInfo!==je.containerInfo||Ee.stateNode.implementation!==je.implementation?(Ee=Lu(je,Ie.mode,rt),Ee.return=Ie,Ee):(Ee=L(Ee,je.children||[]),Ee.return=Ie,Ee)}function Xe(Ie,Ee,je,rt,_t){return Ee===null||Ee.tag!==7?(Ee=Fo(je,Ie.mode,rt,_t),Ee.return=Ie,Ee):(Ee=L(Ee,je),Ee.return=Ie,Ee)}function Je(Ie,Ee,je){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return Ee=Mu(""+Ee,Ie.mode,je),Ee.return=Ie,Ee;if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case j:return je=Ul(Ee.type,Ee.key,Ee.props,null,Ie.mode,je),je.ref=Po(Ie,null,Ee),je.return=Ie,je;case O:return Ee=Lu(Ee,Ie.mode,je),Ee.return=Ie,Ee;case ke:var rt=Ee._init;return Je(Ie,rt(Ee._payload),je)}if(kr(Ee)||W(Ee))return Ee=Fo(Ee,Ie.mode,je,null),Ee.return=Ie,Ee;wl(Ie,Ee)}return null}function Ke(Ie,Ee,je,rt){var _t=Ee!==null?Ee.key:null;if(typeof je=="string"&&je!==""||typeof je=="number")return _t!==null?null:fe(Ie,Ee,""+je,rt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case j:return je.key===_t?we(Ie,Ee,je,rt):null;case O:return je.key===_t?Le(Ie,Ee,je,rt):null;case ke:return _t=je._init,Ke(Ie,Ee,_t(je._payload),rt)}if(kr(je)||W(je))return _t!==null?null:Xe(Ie,Ee,je,rt,null);wl(Ie,je)}return null}function at(Ie,Ee,je,rt,_t){if(typeof rt=="string"&&rt!==""||typeof rt=="number")return Ie=Ie.get(je)||null,fe(Ee,Ie,""+rt,_t);if(typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case j:return Ie=Ie.get(rt.key===null?je:rt.key)||null,we(Ee,Ie,rt,_t);case O:return Ie=Ie.get(rt.key===null?je:rt.key)||null,Le(Ee,Ie,rt,_t);case ke:var Et=rt._init;return at(Ie,Ee,je,Et(rt._payload),_t)}if(kr(rt)||W(rt))return Ie=Ie.get(je)||null,Xe(Ee,Ie,rt,_t,null);wl(Ee,rt)}return null}function dt(Ie,Ee,je,rt){for(var _t=null,Et=null,Tt=Ee,Lt=Ee=0,Lr=null;Tt!==null&&Lt<je.length;Lt++){Tt.index>Lt?(Lr=Tt,Tt=null):Lr=Tt.sibling;var Xt=Ke(Ie,Tt,je[Lt],rt);if(Xt===null){Tt===null&&(Tt=Lr);break}r&&Tt&&Xt.alternate===null&&s(Ie,Tt),Ee=z(Xt,Ee,Lt),Et===null?_t=Xt:Et.sibling=Xt,Et=Xt,Tt=Lr}if(Lt===je.length)return d(Ie,Tt),ur&&xn(Ie,Lt),_t;if(Tt===null){for(;Lt<je.length;Lt++)Tt=Je(Ie,je[Lt],rt),Tt!==null&&(Ee=z(Tt,Ee,Lt),Et===null?_t=Tt:Et.sibling=Tt,Et=Tt);return ur&&xn(Ie,Lt),_t}for(Tt=E(Ie,Tt);Lt<je.length;Lt++)Lr=at(Tt,Ie,Lt,je[Lt],rt),Lr!==null&&(r&&Lr.alternate!==null&&Tt.delete(Lr.key===null?Lt:Lr.key),Ee=z(Lr,Ee,Lt),Et===null?_t=Lr:Et.sibling=Lr,Et=Lr);return r&&Tt.forEach(function(Qs){return s(Ie,Qs)}),ur&&xn(Ie,Lt),_t}function ft(Ie,Ee,je,rt){var _t=W(je);if(typeof _t!="function")throw Error(o(150));if(je=_t.call(je),je==null)throw Error(o(151));for(var Et=_t=null,Tt=Ee,Lt=Ee=0,Lr=null,Xt=je.next();Tt!==null&&!Xt.done;Lt++,Xt=je.next()){Tt.index>Lt?(Lr=Tt,Tt=null):Lr=Tt.sibling;var Qs=Ke(Ie,Tt,Xt.value,rt);if(Qs===null){Tt===null&&(Tt=Lr);break}r&&Tt&&Qs.alternate===null&&s(Ie,Tt),Ee=z(Qs,Ee,Lt),Et===null?_t=Qs:Et.sibling=Qs,Et=Qs,Tt=Lr}if(Xt.done)return d(Ie,Tt),ur&&xn(Ie,Lt),_t;if(Tt===null){for(;!Xt.done;Lt++,Xt=je.next())Xt=Je(Ie,Xt.value,rt),Xt!==null&&(Ee=z(Xt,Ee,Lt),Et===null?_t=Xt:Et.sibling=Xt,Et=Xt);return ur&&xn(Ie,Lt),_t}for(Tt=E(Ie,Tt);!Xt.done;Lt++,Xt=je.next())Xt=at(Tt,Ie,Lt,Xt.value,rt),Xt!==null&&(r&&Xt.alternate!==null&&Tt.delete(Xt.key===null?Lt:Xt.key),Ee=z(Xt,Ee,Lt),Et===null?_t=Xt:Et.sibling=Xt,Et=Xt);return r&&Tt.forEach(function(bp){return s(Ie,bp)}),ur&&xn(Ie,Lt),_t}function sr(Ie,Ee,je,rt){if(typeof je=="object"&&je!==null&&je.type===F&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case j:e:{for(var _t=je.key,Et=Ee;Et!==null;){if(Et.key===_t){if(_t=je.type,_t===F){if(Et.tag===7){d(Ie,Et.sibling),Ee=L(Et,je.props.children),Ee.return=Ie,Ie=Ee;break e}}else if(Et.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===ke&&Md(_t)===Et.type){d(Ie,Et.sibling),Ee=L(Et,je.props),Ee.ref=Po(Ie,Et,je),Ee.return=Ie,Ie=Ee;break e}d(Ie,Et);break}else s(Ie,Et);Et=Et.sibling}je.type===F?(Ee=Fo(je.props.children,Ie.mode,rt,je.key),Ee.return=Ie,Ie=Ee):(rt=Ul(je.type,je.key,je.props,null,Ie.mode,rt),rt.ref=Po(Ie,Ee,je),rt.return=Ie,Ie=rt)}return Z(Ie);case O:e:{for(Et=je.key;Ee!==null;){if(Ee.key===Et)if(Ee.tag===4&&Ee.stateNode.containerInfo===je.containerInfo&&Ee.stateNode.implementation===je.implementation){d(Ie,Ee.sibling),Ee=L(Ee,je.children||[]),Ee.return=Ie,Ie=Ee;break e}else{d(Ie,Ee);break}else s(Ie,Ee);Ee=Ee.sibling}Ee=Lu(je,Ie.mode,rt),Ee.return=Ie,Ie=Ee}return Z(Ie);case ke:return Et=je._init,sr(Ie,Ee,Et(je._payload),rt)}if(kr(je))return dt(Ie,Ee,je,rt);if(W(je))return ft(Ie,Ee,je,rt);wl(Ie,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,Ee!==null&&Ee.tag===6?(d(Ie,Ee.sibling),Ee=L(Ee,je),Ee.return=Ie,Ie=Ee):(d(Ie,Ee),Ee=Mu(je,Ie.mode,rt),Ee.return=Ie,Ie=Ee),Z(Ie)):d(Ie,Ee)}return sr}var Do=Uf(!0),Nc=Uf(!1),Zn=qs(null),bl=null,eo=null,Bc=null;function zc(){Bc=eo=bl=null}function Fc(r){var s=Zn.current;or(Zn),r._currentValue=s}function Ld(r,s,d){for(;r!==null;){var E=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,E!==null&&(E.childLanes|=s)):E!==null&&(E.childLanes&s)!==s&&(E.childLanes|=s),r===d)break;r=r.return}}function Io(r,s){bl=r,Bc=eo=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&s)!==0&&(_i=!0),r.firstContext=null)}function qi(r){var s=r._currentValue;if(Bc!==r)if(r={context:r,memoizedValue:s,next:null},eo===null){if(bl===null)throw Error(o(308));eo=r,bl.dependencies={lanes:0,firstContext:r}}else eo=eo.next=r;return s}var Mo=null;function Uc(r){Mo===null?Mo=[r]:Mo.push(r)}function xl(r,s,d,E){var L=s.interleaved;return L===null?(d.next=d,Uc(s)):(d.next=L.next,L.next=d),s.interleaved=d,Ks(r,E)}function Ks(r,s){r.lanes|=s;var d=r.alternate;for(d!==null&&(d.lanes|=s),d=r,r=r.return;r!==null;)r.childLanes|=s,d=r.alternate,d!==null&&(d.childLanes|=s),d=r,r=r.return;return d.tag===3?d.stateNode:null}var $s=!1;function Sl(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vc(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Xs(r,s){return{eventTime:r,lane:s,tag:0,payload:null,callback:null,next:null}}function Sn(r,s,d){var E=r.updateQueue;if(E===null)return null;if(E=E.shared,(Gt&2)!==0){var L=E.pending;return L===null?s.next=s:(s.next=L.next,L.next=s),E.pending=s,Ks(r,d)}return L=E.interleaved,L===null?(s.next=s,Uc(E)):(s.next=L.next,L.next=s),E.interleaved=s,Ks(r,d)}function _a(r,s,d){if(s=s.updateQueue,s!==null&&(s=s.shared,(d&4194240)!==0)){var E=s.lanes;E&=r.pendingLanes,d|=E,s.lanes=d,xo(r,d)}}function Vf(r,s){var d=r.updateQueue,E=r.alternate;if(E!==null&&(E=E.updateQueue,d===E)){var L=null,z=null;if(d=d.firstBaseUpdate,d!==null){do{var Z={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};z===null?L=z=Z:z=z.next=Z,d=d.next}while(d!==null);z===null?L=z=s:z=z.next=s}else L=z=s;d={baseState:E.baseState,firstBaseUpdate:L,lastBaseUpdate:z,shared:E.shared,effects:E.effects},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=s:r.next=s,d.lastBaseUpdate=s}function kl(r,s,d,E){var L=r.updateQueue;$s=!1;var z=L.firstBaseUpdate,Z=L.lastBaseUpdate,fe=L.shared.pending;if(fe!==null){L.shared.pending=null;var we=fe,Le=we.next;we.next=null,Z===null?z=Le:Z.next=Le,Z=we;var Xe=r.alternate;Xe!==null&&(Xe=Xe.updateQueue,fe=Xe.lastBaseUpdate,fe!==Z&&(fe===null?Xe.firstBaseUpdate=Le:fe.next=Le,Xe.lastBaseUpdate=we))}if(z!==null){var Je=L.baseState;Z=0,Xe=Le=we=null,fe=z;do{var Ke=fe.lane,at=fe.eventTime;if((E&Ke)===Ke){Xe!==null&&(Xe=Xe.next={eventTime:at,lane:0,tag:fe.tag,payload:fe.payload,callback:fe.callback,next:null});e:{var dt=r,ft=fe;switch(Ke=s,at=d,ft.tag){case 1:if(dt=ft.payload,typeof dt=="function"){Je=dt.call(at,Je,Ke);break e}Je=dt;break e;case 3:dt.flags=dt.flags&-65537|128;case 0:if(dt=ft.payload,Ke=typeof dt=="function"?dt.call(at,Je,Ke):dt,Ke==null)break e;Je=re({},Je,Ke);break e;case 2:$s=!0}}fe.callback!==null&&fe.lane!==0&&(r.flags|=64,Ke=L.effects,Ke===null?L.effects=[fe]:Ke.push(fe))}else at={eventTime:at,lane:Ke,tag:fe.tag,payload:fe.payload,callback:fe.callback,next:null},Xe===null?(Le=Xe=at,we=Je):Xe=Xe.next=at,Z|=Ke;if(fe=fe.next,fe===null){if(fe=L.shared.pending,fe===null)break;Ke=fe,fe=Ke.next,Ke.next=null,L.lastBaseUpdate=Ke,L.shared.pending=null}}while(!0);if(Xe===null&&(we=Je),L.baseState=we,L.firstBaseUpdate=Le,L.lastBaseUpdate=Xe,s=L.shared.interleaved,s!==null){L=s;do Z|=L.lane,L=L.next;while(L!==s)}else z===null&&(L.shared.lanes=0);oo|=Z,r.lanes=Z,r.memoizedState=Je}}function Wf(r,s,d){if(r=s.effects,s.effects=null,r!==null)for(s=0;s<r.length;s++){var E=r[s],L=E.callback;if(L!==null){if(E.callback=null,E=d,typeof L!="function")throw Error(o(191,L));L.call(E)}}}var wa={},As=qs(wa),ba=qs(wa),Lo=qs(wa);function to(r){if(r===wa)throw Error(o(174));return r}function Wc(r,s){switch(ir(Lo,s),ir(ba,r),ir(As,wa),r=s.nodeType,r){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:vs(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=vs(s,r)}or(As),ir(As,s)}function ro(){or(As),or(ba),or(Lo)}function jd(r){to(Lo.current);var s=to(As.current),d=vs(s,r.type);s!==d&&(ir(ba,r),ir(As,d))}function Hc(r){ba.current===r&&(or(As),or(ba))}var gr=qs(0);function Cl(r){for(var s=r;s!==null;){if(s.tag===13){var d=s.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var qc=[];function Gc(){for(var r=0;r<qc.length;r++)qc[r]._workInProgressVersionPrimary=null;qc.length=0}var Kc=P.ReactCurrentDispatcher,Xc=P.ReactCurrentBatchConfig,io=0,dr=null,Er=null,Ir=null,Jc=!1,so=!1,kn=0,Od=0;function qr(){throw Error(o(321))}function Yc(r,s){if(s===null)return!1;for(var d=0;d<s.length&&d<r.length;d++)if(!ls(r[d],s[d]))return!1;return!0}function Qc(r,s,d,E,L,z){if(io=z,dr=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Kc.current=r===null||r.memoizedState===null?Jf:Yf,r=d(E,L),so){z=0;do{if(so=!1,kn=0,25<=z)throw Error(o(301));z+=1,Ir=Er=null,s.updateQueue=null,Kc.current=$m,r=d(E,L)}while(so)}if(Kc.current=Al,s=Er!==null&&Er.next!==null,io=0,Ir=Er=dr=null,Jc=!1,s)throw Error(o(300));return r}function Zc(){var r=kn!==0;return kn=0,r}function us(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ir===null?dr.memoizedState=Ir=r:Ir=Ir.next=r,Ir}function Gi(){if(Er===null){var r=dr.alternate;r=r!==null?r.memoizedState:null}else r=Er.next;var s=Ir===null?dr.memoizedState:Ir.next;if(s!==null)Ir=s,Er=r;else{if(r===null)throw Error(o(310));Er=r,r={memoizedState:Er.memoizedState,baseState:Er.baseState,baseQueue:Er.baseQueue,queue:Er.queue,next:null},Ir===null?dr.memoizedState=Ir=r:Ir=Ir.next=r}return Ir}function xa(r,s){return typeof s=="function"?s(r):s}function eu(r){var s=Gi(),d=s.queue;if(d===null)throw Error(o(311));d.lastRenderedReducer=r;var E=Er,L=E.baseQueue,z=d.pending;if(z!==null){if(L!==null){var Z=L.next;L.next=z.next,z.next=Z}E.baseQueue=L=z,d.pending=null}if(L!==null){z=L.next,E=E.baseState;var fe=Z=null,we=null,Le=z;do{var Xe=Le.lane;if((io&Xe)===Xe)we!==null&&(we=we.next={lane:0,action:Le.action,hasEagerState:Le.hasEagerState,eagerState:Le.eagerState,next:null}),E=Le.hasEagerState?Le.eagerState:r(E,Le.action);else{var Je={lane:Xe,action:Le.action,hasEagerState:Le.hasEagerState,eagerState:Le.eagerState,next:null};we===null?(fe=we=Je,Z=E):we=we.next=Je,dr.lanes|=Xe,oo|=Xe}Le=Le.next}while(Le!==null&&Le!==z);we===null?Z=E:we.next=fe,ls(E,s.memoizedState)||(_i=!0),s.memoizedState=E,s.baseState=Z,s.baseQueue=we,d.lastRenderedState=E}if(r=d.interleaved,r!==null){L=r;do z=L.lane,dr.lanes|=z,oo|=z,L=L.next;while(L!==r)}else L===null&&(d.lanes=0);return[s.memoizedState,d.dispatch]}function Nd(r){var s=Gi(),d=s.queue;if(d===null)throw Error(o(311));d.lastRenderedReducer=r;var E=d.dispatch,L=d.pending,z=s.memoizedState;if(L!==null){d.pending=null;var Z=L=L.next;do z=r(z,Z.action),Z=Z.next;while(Z!==L);ls(z,s.memoizedState)||(_i=!0),s.memoizedState=z,s.baseQueue===null&&(s.baseState=z),d.lastRenderedState=z}return[z,E]}function Bd(){}function tu(r,s){var d=dr,E=Gi(),L=s(),z=!ls(E.memoizedState,L);if(z&&(E.memoizedState=L,_i=!0),E=E.queue,Gd(Ud.bind(null,d,E,r),[r]),E.getSnapshot!==s||z||Ir!==null&&Ir.memoizedState.tag&1){if(d.flags|=2048,El(9,Fd.bind(null,d,E,L,s),void 0,null),$r===null)throw Error(o(349));(io&30)!==0||zd(d,s,L)}return L}function zd(r,s,d){r.flags|=16384,r={getSnapshot:s,value:d},s=dr.updateQueue,s===null?(s={lastEffect:null,stores:null},dr.updateQueue=s,s.stores=[r]):(d=s.stores,d===null?s.stores=[r]:d.push(r))}function Fd(r,s,d,E){s.value=d,s.getSnapshot=E,Hf(s)&&Vd(r)}function Ud(r,s,d){return d(function(){Hf(s)&&Vd(r)})}function Hf(r){var s=r.getSnapshot;r=r.value;try{var d=s();return!ls(r,d)}catch{return!0}}function Vd(r){var s=Ks(r,1);s!==null&&fs(s,r,1,-1)}function Wd(r){var s=us();return typeof r=="function"&&(r=r()),s.memoizedState=s.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:xa,lastRenderedState:r},s.queue=r,r=r.dispatch=Kf.bind(null,dr,r),[s.memoizedState,r]}function El(r,s,d,E){return r={tag:r,create:s,destroy:d,deps:E,next:null},s=dr.updateQueue,s===null?(s={lastEffect:null,stores:null},dr.updateQueue=s,s.lastEffect=r.next=r):(d=s.lastEffect,d===null?s.lastEffect=r.next=r:(E=d.next,d.next=r,r.next=E,s.lastEffect=r)),r}function Hd(){return Gi().memoizedState}function Tl(r,s,d,E){var L=us();dr.flags|=r,L.memoizedState=El(1|s,d,void 0,E===void 0?null:E)}function $l(r,s,d,E){var L=Gi();E=E===void 0?null:E;var z=void 0;if(Er!==null){var Z=Er.memoizedState;if(z=Z.destroy,E!==null&&Yc(E,Z.deps)){L.memoizedState=El(s,d,z,E);return}}dr.flags|=r,L.memoizedState=El(1|s,d,z,E)}function qd(r,s){return Tl(8390656,8,r,s)}function Gd(r,s){return $l(2048,8,r,s)}function Kd(r,s){return $l(4,2,r,s)}function Xd(r,s){return $l(4,4,r,s)}function Jd(r,s){if(typeof s=="function")return r=r(),s(r),function(){s(null)};if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function qf(r,s,d){return d=d!=null?d.concat([r]):null,$l(4,4,Jd.bind(null,s,r),d)}function ru(){}function Yd(r,s){var d=Gi();s=s===void 0?null:s;var E=d.memoizedState;return E!==null&&s!==null&&Yc(s,E[1])?E[0]:(d.memoizedState=[r,s],r)}function Qd(r,s){var d=Gi();s=s===void 0?null:s;var E=d.memoizedState;return E!==null&&s!==null&&Yc(s,E[1])?E[0]:(r=r(),d.memoizedState=[r,s],r)}function Zd(r,s,d){return(io&21)===0?(r.baseState&&(r.baseState=!1,_i=!0),r.memoizedState=d):(ls(d,s)||(d=ws(),dr.lanes|=d,oo|=d,r.baseState=!0),s)}function Tm(r,s){var d=Ft;Ft=d!==0&&4>d?d:4,r(!0);var E=Xc.transition;Xc.transition={};try{r(!1),s()}finally{Ft=d,Xc.transition=E}}function eh(){return Gi().memoizedState}function Gf(r,s,d){var E=$n(r);if(d={lane:E,action:d,hasEagerState:!1,eagerState:null,next:null},th(r))Xf(s,d);else if(d=xl(r,s,d,E),d!==null){var L=ai();fs(d,r,E,L),rh(d,s,E)}}function Kf(r,s,d){var E=$n(r),L={lane:E,action:d,hasEagerState:!1,eagerState:null,next:null};if(th(r))Xf(s,L);else{var z=r.alternate;if(r.lanes===0&&(z===null||z.lanes===0)&&(z=s.lastRenderedReducer,z!==null))try{var Z=s.lastRenderedState,fe=z(Z,d);if(L.hasEagerState=!0,L.eagerState=fe,ls(fe,Z)){var we=s.interleaved;we===null?(L.next=L,Uc(s)):(L.next=we.next,we.next=L),s.interleaved=L;return}}catch{}finally{}d=xl(r,s,L,E),d!==null&&(L=ai(),fs(d,r,E,L),rh(d,s,E))}}function th(r){var s=r.alternate;return r===dr||s!==null&&s===dr}function Xf(r,s){so=Jc=!0;var d=r.pending;d===null?s.next=s:(s.next=d.next,d.next=s),r.pending=s}function rh(r,s,d){if((d&4194240)!==0){var E=s.lanes;E&=r.pendingLanes,d|=E,s.lanes=d,xo(r,d)}}var Al={readContext:qi,useCallback:qr,useContext:qr,useEffect:qr,useImperativeHandle:qr,useInsertionEffect:qr,useLayoutEffect:qr,useMemo:qr,useReducer:qr,useRef:qr,useState:qr,useDebugValue:qr,useDeferredValue:qr,useTransition:qr,useMutableSource:qr,useSyncExternalStore:qr,useId:qr,unstable_isNewReconciler:!1},Jf={readContext:qi,useCallback:function(r,s){return us().memoizedState=[r,s===void 0?null:s],r},useContext:qi,useEffect:qd,useImperativeHandle:function(r,s,d){return d=d!=null?d.concat([r]):null,Tl(4194308,4,Jd.bind(null,s,r),d)},useLayoutEffect:function(r,s){return Tl(4194308,4,r,s)},useInsertionEffect:function(r,s){return Tl(4,2,r,s)},useMemo:function(r,s){var d=us();return s=s===void 0?null:s,r=r(),d.memoizedState=[r,s],r},useReducer:function(r,s,d){var E=us();return s=d!==void 0?d(s):s,E.memoizedState=E.baseState=s,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:s},E.queue=r,r=r.dispatch=Gf.bind(null,dr,r),[E.memoizedState,r]},useRef:function(r){var s=us();return r={current:r},s.memoizedState=r},useState:Wd,useDebugValue:ru,useDeferredValue:function(r){return us().memoizedState=r},useTransition:function(){var r=Wd(!1),s=r[0];return r=Tm.bind(null,r[1]),us().memoizedState=r,[s,r]},useMutableSource:function(){},useSyncExternalStore:function(r,s,d){var E=dr,L=us();if(ur){if(d===void 0)throw Error(o(407));d=d()}else{if(d=s(),$r===null)throw Error(o(349));(io&30)!==0||zd(E,s,d)}L.memoizedState=d;var z={value:d,getSnapshot:s};return L.queue=z,qd(Ud.bind(null,E,z,r),[r]),E.flags|=2048,El(9,Fd.bind(null,E,z,d,s),void 0,null),d},useId:function(){var r=us(),s=$r.identifierPrefix;if(ur){var d=gi,E=mi;d=(E&~(1<<32-Vr(E)-1)).toString(32)+d,s=":"+s+"R"+d,d=kn++,0<d&&(s+="H"+d.toString(32)),s+=":"}else d=Od++,s=":"+s+"r"+d.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},Yf={readContext:qi,useCallback:Yd,useContext:qi,useEffect:Gd,useImperativeHandle:qf,useInsertionEffect:Kd,useLayoutEffect:Xd,useMemo:Qd,useReducer:eu,useRef:Hd,useState:function(){return eu(xa)},useDebugValue:ru,useDeferredValue:function(r){var s=Gi();return Zd(s,Er.memoizedState,r)},useTransition:function(){var r=eu(xa)[0],s=Gi().memoizedState;return[r,s]},useMutableSource:Bd,useSyncExternalStore:tu,useId:eh,unstable_isNewReconciler:!1},$m={readContext:qi,useCallback:Yd,useContext:qi,useEffect:Gd,useImperativeHandle:qf,useInsertionEffect:Kd,useLayoutEffect:Xd,useMemo:Qd,useReducer:Nd,useRef:Hd,useState:function(){return Nd(xa)},useDebugValue:ru,useDeferredValue:function(r){var s=Gi();return Er===null?s.memoizedState=r:Zd(s,Er.memoizedState,r)},useTransition:function(){var r=Nd(xa)[0],s=Gi().memoizedState;return[r,s]},useMutableSource:Bd,useSyncExternalStore:tu,useId:eh,unstable_isNewReconciler:!1};function Tr(r,s){if(r&&r.defaultProps){s=re({},s),r=r.defaultProps;for(var d in r)s[d]===void 0&&(s[d]=r[d]);return s}return s}function Rs(r,s,d,E){s=r.memoizedState,d=d(E,s),d=d==null?s:re({},s,d),r.memoizedState=d,r.lanes===0&&(r.updateQueue.baseState=d)}var Js={isMounted:function(r){return(r=r._reactInternals)?ct(r)===r:!1},enqueueSetState:function(r,s,d){r=r._reactInternals;var E=ai(),L=$n(r),z=Xs(E,L);z.payload=s,d!=null&&(z.callback=d),s=Sn(r,z,L),s!==null&&(fs(s,r,L,E),_a(s,r,L))},enqueueReplaceState:function(r,s,d){r=r._reactInternals;var E=ai(),L=$n(r),z=Xs(E,L);z.tag=1,z.payload=s,d!=null&&(z.callback=d),s=Sn(r,z,L),s!==null&&(fs(s,r,L,E),_a(s,r,L))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var d=ai(),E=$n(r),L=Xs(d,E);L.tag=2,s!=null&&(L.callback=s),s=Sn(r,L,E),s!==null&&(fs(s,r,E,d),_a(s,r,E))}};function no(r,s,d,E,L,z,Z){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(E,z,Z):s.prototype&&s.prototype.isPureReactComponent?!ua(d,E)||!ua(L,z):!0}function ih(r,s,d){var E=!1,L=wn,z=s.contextType;return typeof z=="object"&&z!==null?z=qi(z):(L=pi(s)?Jn:si.current,E=s.contextTypes,z=(E=E!=null)?ni(r,L):wn),s=new s(d,z),r.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Js,r.stateNode=s,s._reactInternals=r,E&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=L,r.__reactInternalMemoizedMaskedChildContext=z),s}function sh(r,s,d,E){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(d,E),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(d,E),s.state!==r&&Js.enqueueReplaceState(s,s.state,null)}function iu(r,s,d,E){var L=r.stateNode;L.props=d,L.state=r.memoizedState,L.refs={},Sl(r);var z=s.contextType;typeof z=="object"&&z!==null?L.context=qi(z):(z=pi(s)?Jn:si.current,L.context=ni(r,z)),L.state=r.memoizedState,z=s.getDerivedStateFromProps,typeof z=="function"&&(Rs(r,s,z,d),L.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof L.getSnapshotBeforeUpdate=="function"||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(s=L.state,typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount(),s!==L.state&&Js.enqueueReplaceState(L,L.state,null),kl(r,d,L,E),L.state=r.memoizedState),typeof L.componentDidMount=="function"&&(r.flags|=4194308)}function jo(r,s){try{var d="",E=s;do d+=Ge(E),E=E.return;while(E);var L=d}catch(z){L=`
|
|
40
40
|
Error generating stack: `+z.message+`
|
|
41
|
-
`+z.stack}return{value:r,source:s,stack:L,digest:null}}function su(r,s,d){return{value:r,source:null,stack:d??null,digest:s??null}}function nu(r,s){try{console.error(s.value)}catch(d){setTimeout(function(){throw d})}}var Qf=typeof WeakMap=="function"?WeakMap:Map;function nh(r,s,d){d=Xs(-1,d),d.tag=3,d.payload={element:null};var E=s.value;return d.callback=function(){Ol||(Ol=!0,Eu=E),nu(r,s)},d}function oh(r,s,d){d=Xs(-1,d),d.tag=3;var E=r.type.getDerivedStateFromError;if(typeof E=="function"){var L=s.value;d.payload=function(){return E(L)},d.callback=function(){nu(r,s)}}var z=r.stateNode;return z!==null&&typeof z.componentDidCatch=="function"&&(d.callback=function(){nu(r,s),typeof E!="function"&&(Tn===null?Tn=new Set([this]):Tn.add(this));var Z=s.stack;this.componentDidCatch(s.value,{componentStack:Z!==null?Z:""})}),d}function ah(r,s,d){var E=r.pingCache;if(E===null){E=r.pingCache=new Qf;var L=new Set;E.set(s,L)}else L=E.get(s),L===void 0&&(L=new Set,E.set(s,L));L.has(d)||(L.add(d),r=up.bind(null,r,s,d),s.then(r,r))}function Zf(r){do{var s;if((s=r.tag===13)&&(s=r.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return r;r=r.return}while(r!==null);return null}function oi(r,s,d,E,L){return(r.mode&1)===0?(r===s?r.flags|=65536:(r.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(s=Xs(-1,1),s.tag=2,Sn(d,s,1))),d.lanes|=1),r):(r.flags|=65536,r.lanes=L,r)}var ep=P.ReactCurrentOwner,_i=!1;function Gr(r,s,d,E){s.child=r===null?Nc(s,null,d,E):Do(s,r.child,d,E)}function lh(r,s,d,E,L){d=d.render;var z=s.ref;return Io(s,L),E=Qc(r,s,d,E,z,L),d=Zc(),r!==null&&!_i?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~L,Ys(r,s,L)):(ur&&d&&Cr(s),s.flags|=1,Gr(r,s,E,L),s.child)}function Sa(r,s,d,E,L){if(r===null){var z=d.type;return typeof z=="function"&&!Iu(z)&&z.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(s.tag=15,s.type=z,ch(r,s,z,E,L)):(r=Ul(d.type,null,E,s,s.mode,L),r.ref=s.ref,r.return=s,s.child=r)}if(z=r.child,(r.lanes&L)===0){var Z=z.memoizedProps;if(d=d.compare,d=d!==null?d:ua,d(Z,E)&&r.ref===s.ref)return Ys(r,s,L)}return s.flags|=1,r=Rn(z,E),r.ref=s.ref,r.return=s,s.child=r}function ch(r,s,d,E,L){if(r!==null){var z=r.memoizedProps;if(ua(z,E)&&r.ref===s.ref)if(_i=!1,s.pendingProps=E=z,(r.lanes&L)!==0)(r.flags&131072)!==0&&(_i=!0);else return s.lanes=r.lanes,Ys(r,s,L)}return ou(r,s,d,E,L)}function uh(r,s,d){var E=s.pendingProps,L=E.children,z=r!==null?r.memoizedState:null;if(E.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ir(No,Pi),Pi|=d;else{if((d&1073741824)===0)return r=z!==null?z.baseLanes|d:d,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:r,cachePool:null,transitions:null},s.updateQueue=null,ir(No,Pi),Pi|=r,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},E=z!==null?z.baseLanes:d,ir(No,Pi),Pi|=E}else z!==null?(E=z.baseLanes|d,s.memoizedState=null):E=d,ir(No,Pi),Pi|=E;return Gr(r,s,L,d),s.child}function dh(r,s){var d=s.ref;(r===null&&d!==null||r!==null&&r.ref!==d)&&(s.flags|=512,s.flags|=2097152)}function ou(r,s,d,E,L){var z=pi(d)?Jn:si.current;return z=ni(s,z),Io(s,L),d=Qc(r,s,d,E,z,L),E=Zc(),r!==null&&!_i?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~L,Ys(r,s,L)):(ur&&E&&Cr(s),s.flags|=1,Gr(r,s,d,L),s.child)}function hh(r,s,d,E,L){if(pi(d)){var z=!0;gl(s)}else z=!1;if(Io(s,L),s.stateNode===null)Pl(r,s),ih(s,d,E),iu(s,d,E,L),E=!0;else if(r===null){var Z=s.stateNode,fe=s.memoizedProps;Z.props=fe;var we=Z.context,Le=d.contextType;typeof Le=="object"&&Le!==null?Le=qi(Le):(Le=pi(d)?Jn:si.current,Le=ni(s,Le));var Xe=d.getDerivedStateFromProps,Je=typeof Xe=="function"||typeof Z.getSnapshotBeforeUpdate=="function";Je||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(fe!==E||we!==Le)&&sh(s,Z,E,Le),$s=!1;var Ke=s.memoizedState;Z.state=Ke,kl(s,E,Z,L),we=s.memoizedState,fe!==E||Ke!==we||fi.current||$s?(typeof Xe=="function"&&(Rs(s,d,Xe,E),we=s.memoizedState),(fe=$s||no(s,d,fe,E,Ke,we,Le))?(Je||typeof Z.UNSAFE_componentWillMount!="function"&&typeof Z.componentWillMount!="function"||(typeof Z.componentWillMount=="function"&&Z.componentWillMount(),typeof Z.UNSAFE_componentWillMount=="function"&&Z.UNSAFE_componentWillMount()),typeof Z.componentDidMount=="function"&&(s.flags|=4194308)):(typeof Z.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=E,s.memoizedState=we),Z.props=E,Z.state=we,Z.context=Le,E=fe):(typeof Z.componentDidMount=="function"&&(s.flags|=4194308),E=!1)}else{Z=s.stateNode,Vc(r,s),fe=s.memoizedProps,Le=s.type===s.elementType?fe:Tr(s.type,fe),Z.props=Le,Je=s.pendingProps,Ke=Z.context,we=d.contextType,typeof we=="object"&&we!==null?we=qi(we):(we=pi(d)?Jn:si.current,we=ni(s,we));var at=d.getDerivedStateFromProps;(Xe=typeof at=="function"||typeof Z.getSnapshotBeforeUpdate=="function")||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(fe!==Je||Ke!==we)&&sh(s,Z,E,we),$s=!1,Ke=s.memoizedState,Z.state=Ke,kl(s,E,Z,L);var dt=s.memoizedState;fe!==Je||Ke!==dt||fi.current||$s?(typeof at=="function"&&(Rs(s,d,at,E),dt=s.memoizedState),(Le=$s||no(s,d,Le,E,Ke,dt,we)||!1)?(Xe||typeof Z.UNSAFE_componentWillUpdate!="function"&&typeof Z.componentWillUpdate!="function"||(typeof Z.componentWillUpdate=="function"&&Z.componentWillUpdate(E,dt,we),typeof Z.UNSAFE_componentWillUpdate=="function"&&Z.UNSAFE_componentWillUpdate(E,dt,we)),typeof Z.componentDidUpdate=="function"&&(s.flags|=4),typeof Z.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof Z.componentDidUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=1024),s.memoizedProps=E,s.memoizedState=dt),Z.props=E,Z.state=dt,Z.context=we,E=Le):(typeof Z.componentDidUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=1024),E=!1)}return au(r,s,d,E,z,L)}function au(r,s,d,E,L,z){dh(r,s);var Z=(s.flags&128)!==0;if(!E&&!Z)return L&&Pd(s,d,!1),Ys(r,s,z);E=s.stateNode,ep.current=s;var fe=Z&&typeof d.getDerivedStateFromError!="function"?null:E.render();return s.flags|=1,r!==null&&Z?(s.child=Do(s,r.child,null,z),s.child=Do(s,null,fe,z)):Gr(r,s,fe,z),s.memoizedState=E.state,L&&Pd(s,d,!0),s.child}function lu(r){var s=r.stateNode;s.pendingContext?Ad(r,s.pendingContext,s.pendingContext!==s.context):s.context&&Ad(r,s.context,!1),Wc(r,s.containerInfo)}function fh(r,s,d,E,L){return Qn(),jc(L),s.flags|=256,Gr(r,s,d,E),s.child}var cu={dehydrated:null,treeContext:null,retryLane:0};function uu(r){return{baseLanes:r,cachePool:null,transitions:null}}function ph(r,s,d){var E=s.pendingProps,L=gr.current,z=!1,Z=(s.flags&128)!==0,fe;if((fe=Z)||(fe=r!==null&&r.memoizedState===null?!1:(L&2)!==0),fe?(z=!0,s.flags&=-129):(r===null||r.memoizedState!==null)&&(L|=1),ir(gr,L&1),r===null)return Mc(s),r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((s.mode&1)===0?s.lanes=1:r.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(Z=E.children,r=E.fallback,z?(E=s.mode,z=s.child,Z={mode:"hidden",children:Z},(E&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=Z):z=Vl(Z,E,0,null),r=Fo(r,E,d,null),z.return=s,r.return=s,z.sibling=r,s.child=z,s.child.memoizedState=uu(d),s.memoizedState=cu,r):ka(s,Z));if(L=r.memoizedState,L!==null&&(fe=L.dehydrated,fe!==null))return tp(r,s,Z,E,fe,L,d);if(z){z=E.fallback,Z=s.mode,L=r.child,fe=L.sibling;var we={mode:"hidden",children:E.children};return(Z&1)===0&&s.child!==L?(E=s.child,E.childLanes=0,E.pendingProps=we,s.deletions=null):(E=Rn(L,we),E.subtreeFlags=L.subtreeFlags&14680064),fe!==null?z=Rn(fe,z):(z=Fo(z,Z,d,null),z.flags|=2),z.return=s,E.return=s,E.sibling=z,s.child=E,E=z,z=s.child,Z=r.child.memoizedState,Z=Z===null?uu(d):{baseLanes:Z.baseLanes|d,cachePool:null,transitions:Z.transitions},z.memoizedState=Z,z.childLanes=r.childLanes&~d,s.memoizedState=cu,E}return z=r.child,r=z.sibling,E=Rn(z,{mode:"visible",children:E.children}),(s.mode&1)===0&&(E.lanes=d),E.return=s,E.sibling=null,r!==null&&(d=s.deletions,d===null?(s.deletions=[r],s.flags|=16):d.push(r)),s.child=E,s.memoizedState=null,E}function ka(r,s){return s=Vl({mode:"visible",children:s},r.mode,0,null),s.return=r,r.child=s}function Rl(r,s,d,E){return E!==null&&jc(E),Do(s,r.child,null,d),r=ka(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function tp(r,s,d,E,L,z,Z){if(d)return s.flags&256?(s.flags&=-257,E=su(Error(o(422))),Rl(r,s,Z,E)):s.memoizedState!==null?(s.child=r.child,s.flags|=128,null):(z=E.fallback,L=s.mode,E=Vl({mode:"visible",children:E.children},L,0,null),z=Fo(z,L,Z,null),z.flags|=2,E.return=s,z.return=s,E.sibling=z,s.child=E,(s.mode&1)!==0&&Do(s,r.child,null,Z),s.child.memoizedState=uu(Z),s.memoizedState=cu,z);if((s.mode&1)===0)return Rl(r,s,Z,null);if(L.data==="$!"){if(E=L.nextSibling&&L.nextSibling.dataset,E)var fe=E.dgst;return E=fe,z=Error(o(419)),E=su(z,E,void 0),Rl(r,s,Z,E)}if(fe=(Z&r.childLanes)!==0,_i||fe){if(E=$r,E!==null){switch(Z&-Z){case 4:L=2;break;case 16:L=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:L=32;break;case 536870912:L=268435456;break;default:L=0}L=(L&(E.suspendedLanes|Z))!==0?0:L,L!==0&&L!==z.retryLane&&(z.retryLane=L,Ks(r,L),fs(E,r,L,-1))}return Du(),E=su(Error(o(421))),Rl(r,s,Z,E)}return L.data==="$?"?(s.flags|=128,s.child=r.child,s=hp.bind(null,r),L._reactRetry=s,null):(r=z.treeContext,Ri=_n(L.nextSibling),vi=s,ur=!0,yi=null,r!==null&&(Wi[cs++]=mi,Wi[cs++]=gi,Wi[cs++]=Hi,mi=r.id,gi=r.overflow,Hi=s),s=ka(s,E.children),s.flags|=4096,s)}function mh(r,s,d){r.lanes|=s;var E=r.alternate;E!==null&&(E.lanes|=s),Ld(r.return,s,d)}function du(r,s,d,E,L){var z=r.memoizedState;z===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:E,tail:d,tailMode:L}:(z.isBackwards=s,z.rendering=null,z.renderingStartTime=0,z.last=E,z.tail=d,z.tailMode=L)}function hu(r,s,d){var E=s.pendingProps,L=E.revealOrder,z=E.tail;if(Gr(r,s,E.children,d),E=gr.current,(E&2)!==0)E=E&1|2,s.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&mh(r,d,s);else if(r.tag===19)mh(r,d,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}E&=1}if(ir(gr,E),(s.mode&1)===0)s.memoizedState=null;else switch(L){case"forwards":for(d=s.child,L=null;d!==null;)r=d.alternate,r!==null&&Cl(r)===null&&(L=d),d=d.sibling;d=L,d===null?(L=s.child,s.child=null):(L=d.sibling,d.sibling=null),du(s,!1,L,d,z);break;case"backwards":for(d=null,L=s.child,s.child=null;L!==null;){if(r=L.alternate,r!==null&&Cl(r)===null){s.child=L;break}r=L.sibling,L.sibling=d,d=L,L=r}du(s,!0,d,null,z);break;case"together":du(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Pl(r,s){(s.mode&1)===0&&r!==null&&(r.alternate=null,s.alternate=null,s.flags|=2)}function Ys(r,s,d){if(r!==null&&(s.dependencies=r.dependencies),oo|=s.lanes,(d&s.childLanes)===0)return null;if(r!==null&&s.child!==r.child)throw Error(o(153));if(s.child!==null){for(r=s.child,d=Rn(r,r.pendingProps),s.child=d,d.return=s;r.sibling!==null;)r=r.sibling,d=d.sibling=Rn(r,r.pendingProps),d.return=s;d.sibling=null}return s.child}function Am(r,s,d){switch(s.tag){case 3:lu(s),Qn();break;case 5:jd(s);break;case 1:pi(s.type)&&gl(s);break;case 4:Wc(s,s.stateNode.containerInfo);break;case 10:var E=s.type._context,L=s.memoizedProps.value;ir(Zn,E._currentValue),E._currentValue=L;break;case 13:if(E=s.memoizedState,E!==null)return E.dehydrated!==null?(ir(gr,gr.current&1),s.flags|=128,null):(d&s.child.childLanes)!==0?ph(r,s,d):(ir(gr,gr.current&1),r=Ys(r,s,d),r!==null?r.sibling:null);ir(gr,gr.current&1);break;case 19:if(E=(d&s.childLanes)!==0,(r.flags&128)!==0){if(E)return hu(r,s,d);s.flags|=128}if(L=s.memoizedState,L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),ir(gr,gr.current),E)break;return null;case 22:case 23:return s.lanes=0,uh(r,s,d)}return Ys(r,s,d)}var fu,pu,gh,vh;fu=function(r,s){for(var d=s.child;d!==null;){if(d.tag===5||d.tag===6)r.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===s)break;for(;d.sibling===null;){if(d.return===null||d.return===s)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},pu=function(){},gh=function(r,s,d,E){var L=r.memoizedProps;if(L!==E){r=s.stateNode,to(As.current);var z=null;switch(d){case"input":L=jt(r,L),E=jt(r,E),z=[];break;case"select":L=re({},L,{value:void 0}),E=re({},E,{value:void 0}),z=[];break;case"textarea":L=Is(r,L),E=Is(r,E),z=[];break;default:typeof L.onClick!="function"&&typeof E.onClick=="function"&&(r.onclick=fl)}_o(d,E);var Z;d=null;for(Le in L)if(!E.hasOwnProperty(Le)&&L.hasOwnProperty(Le)&&L[Le]!=null)if(Le==="style"){var fe=L[Le];for(Z in fe)fe.hasOwnProperty(Z)&&(d||(d={}),d[Z]="")}else Le!=="dangerouslySetInnerHTML"&&Le!=="children"&&Le!=="suppressContentEditableWarning"&&Le!=="suppressHydrationWarning"&&Le!=="autoFocus"&&(f.hasOwnProperty(Le)?z||(z=[]):(z=z||[]).push(Le,null));for(Le in E){var we=E[Le];if(fe=L!=null?L[Le]:void 0,E.hasOwnProperty(Le)&&we!==fe&&(we!=null||fe!=null))if(Le==="style")if(fe){for(Z in fe)!fe.hasOwnProperty(Z)||we&&we.hasOwnProperty(Z)||(d||(d={}),d[Z]="");for(Z in we)we.hasOwnProperty(Z)&&fe[Z]!==we[Z]&&(d||(d={}),d[Z]=we[Z])}else d||(z||(z=[]),z.push(Le,d)),d=we;else Le==="dangerouslySetInnerHTML"?(we=we?we.__html:void 0,fe=fe?fe.__html:void 0,we!=null&&fe!==we&&(z=z||[]).push(Le,we)):Le==="children"?typeof we!="string"&&typeof we!="number"||(z=z||[]).push(Le,""+we):Le!=="suppressContentEditableWarning"&&Le!=="suppressHydrationWarning"&&(f.hasOwnProperty(Le)?(we!=null&&Le==="onScroll"&&nr("scroll",r),z||fe===we||(z=[])):(z=z||[]).push(Le,we))}d&&(z=z||[]).push("style",d);var Le=z;(s.updateQueue=Le)&&(s.flags|=4)}},vh=function(r,s,d,E){d!==E&&(s.flags|=4)};function Dl(r,s){if(!ur)switch(r.tailMode){case"hidden":s=r.tail;for(var d=null;s!==null;)s.alternate!==null&&(d=s),s=s.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var E=null;d!==null;)d.alternate!==null&&(E=d),d=d.sibling;E===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:E.sibling=null}}function Kr(r){var s=r.alternate!==null&&r.alternate.child===r.child,d=0,E=0;if(s)for(var L=r.child;L!==null;)d|=L.lanes|L.childLanes,E|=L.subtreeFlags&14680064,E|=L.flags&14680064,L.return=r,L=L.sibling;else for(L=r.child;L!==null;)d|=L.lanes|L.childLanes,E|=L.subtreeFlags,E|=L.flags,L.return=r,L=L.sibling;return r.subtreeFlags|=E,r.childLanes=d,s}function rp(r,s,d){var E=s.pendingProps;switch(Rc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kr(s),null;case 1:return pi(s.type)&&ml(),Kr(s),null;case 3:return E=s.stateNode,ro(),or(fi),or(si),Gc(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(r===null||r.child===null)&&(ya(s)?s.flags|=4:r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,yi!==null&&(Au(yi),yi=null))),pu(r,s),Kr(s),null;case 5:Hc(s);var L=to(Lo.current);if(d=s.type,r!==null&&s.stateNode!=null)gh(r,s,d,E,L),r.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!E){if(s.stateNode===null)throw Error(o(166));return Kr(s),null}if(r=to(As.current),ya(s)){E=s.stateNode,d=s.type;var z=s.memoizedProps;switch(E[Es]=s,E[ga]=z,r=(s.mode&1)!==0,d){case"dialog":nr("cancel",E),nr("close",E);break;case"iframe":case"object":case"embed":nr("load",E);break;case"video":case"audio":for(L=0;L<fa.length;L++)nr(fa[L],E);break;case"source":nr("error",E);break;case"img":case"image":case"link":nr("error",E),nr("load",E);break;case"details":nr("toggle",E);break;case"input":$t(E,z),nr("invalid",E);break;case"select":E._wrapperState={wasMultiple:!!z.multiple},nr("invalid",E);break;case"textarea":Fr(E,z),nr("invalid",E)}_o(d,z),L=null;for(var Z in z)if(z.hasOwnProperty(Z)){var fe=z[Z];Z==="children"?typeof fe=="string"?E.textContent!==fe&&(z.suppressHydrationWarning!==!0&&hl(E.textContent,fe,r),L=["children",fe]):typeof fe=="number"&&E.textContent!==""+fe&&(z.suppressHydrationWarning!==!0&&hl(E.textContent,fe,r),L=["children",""+fe]):f.hasOwnProperty(Z)&&fe!=null&&Z==="onScroll"&&nr("scroll",E)}switch(d){case"input":Ze(E),Ei(E,z,!0);break;case"textarea":Ze(E),ui(E);break;case"select":case"option":break;default:typeof z.onClick=="function"&&(E.onclick=fl)}E=L,s.updateQueue=E,E!==null&&(s.flags|=4)}else{Z=L.nodeType===9?L:L.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Ls(d)),r==="http://www.w3.org/1999/xhtml"?d==="script"?(r=Z.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof E.is=="string"?r=Z.createElement(d,{is:E.is}):(r=Z.createElement(d),d==="select"&&(Z=r,E.multiple?Z.multiple=!0:E.size&&(Z.size=E.size))):r=Z.createElementNS(r,d),r[Es]=s,r[ga]=E,fu(r,s,!1,!1),s.stateNode=r;e:{switch(Z=er(d,E),d){case"dialog":nr("cancel",r),nr("close",r),L=E;break;case"iframe":case"object":case"embed":nr("load",r),L=E;break;case"video":case"audio":for(L=0;L<fa.length;L++)nr(fa[L],r);L=E;break;case"source":nr("error",r),L=E;break;case"img":case"image":case"link":nr("error",r),nr("load",r),L=E;break;case"details":nr("toggle",r),L=E;break;case"input":$t(r,E),L=jt(r,E),nr("invalid",r);break;case"option":L=E;break;case"select":r._wrapperState={wasMultiple:!!E.multiple},L=re({},E,{value:void 0}),nr("invalid",r);break;case"textarea":Fr(r,E),L=Is(r,E),nr("invalid",r);break;default:L=E}_o(d,L),fe=L;for(z in fe)if(fe.hasOwnProperty(z)){var we=fe[z];z==="style"?oc(r,we):z==="dangerouslySetInnerHTML"?(we=we?we.__html:void 0,we!=null&&Mi(r,we)):z==="children"?typeof we=="string"?(d!=="textarea"||we!=="")&&Or(r,we):typeof we=="number"&&Or(r,""+we):z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&z!=="autoFocus"&&(f.hasOwnProperty(z)?we!=null&&z==="onScroll"&&nr("scroll",r):we!=null&&C(r,z,we,Z))}switch(d){case"input":Ze(r),Ei(r,E,!1);break;case"textarea":Ze(r),ui(r);break;case"option":E.value!=null&&r.setAttribute("value",""+J(E.value));break;case"select":r.multiple=!!E.multiple,z=E.value,z!=null?Rr(r,!!E.multiple,z,!1):E.defaultValue!=null&&Rr(r,!!E.multiple,E.defaultValue,!0);break;default:typeof L.onClick=="function"&&(r.onclick=fl)}switch(d){case"button":case"input":case"select":case"textarea":E=!!E.autoFocus;break e;case"img":E=!0;break e;default:E=!1}}E&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Kr(s),null;case 6:if(r&&s.stateNode!=null)vh(r,s,r.memoizedProps,E);else{if(typeof E!="string"&&s.stateNode===null)throw Error(o(166));if(d=to(Lo.current),to(As.current),ya(s)){if(E=s.stateNode,d=s.memoizedProps,E[Es]=s,(z=E.nodeValue!==d)&&(r=vi,r!==null))switch(r.tag){case 3:hl(E.nodeValue,d,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&hl(E.nodeValue,d,(r.mode&1)!==0)}z&&(s.flags|=4)}else E=(d.nodeType===9?d:d.ownerDocument).createTextNode(E),E[Es]=s,s.stateNode=E}return Kr(s),null;case 13:if(or(gr),E=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(ur&&Ri!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Id(),Qn(),s.flags|=98560,z=!1;else if(z=ya(s),E!==null&&E.dehydrated!==null){if(r===null){if(!z)throw Error(o(318));if(z=s.memoizedState,z=z!==null?z.dehydrated:null,!z)throw Error(o(317));z[Es]=s}else Qn(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Kr(s),z=!1}else yi!==null&&(Au(yi),yi=null),z=!0;if(!z)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=d,s):(E=E!==null,E!==(r!==null&&r.memoizedState!==null)&&E&&(s.child.flags|=8192,(s.mode&1)!==0&&(r===null||(gr.current&1)!==0?Mr===0&&(Mr=3):Du())),s.updateQueue!==null&&(s.flags|=4),Kr(s),null);case 4:return ro(),pu(r,s),r===null&&pa(s.stateNode.containerInfo),Kr(s),null;case 10:return Fc(s.type._context),Kr(s),null;case 17:return pi(s.type)&&ml(),Kr(s),null;case 19:if(or(gr),z=s.memoizedState,z===null)return Kr(s),null;if(E=(s.flags&128)!==0,Z=z.rendering,Z===null)if(E)Dl(z,!1);else{if(Mr!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(Z=Cl(r),Z!==null){for(s.flags|=128,Dl(z,!1),E=Z.updateQueue,E!==null&&(s.updateQueue=E,s.flags|=4),s.subtreeFlags=0,E=d,d=s.child;d!==null;)z=d,r=E,z.flags&=14680066,Z=z.alternate,Z===null?(z.childLanes=0,z.lanes=r,z.child=null,z.subtreeFlags=0,z.memoizedProps=null,z.memoizedState=null,z.updateQueue=null,z.dependencies=null,z.stateNode=null):(z.childLanes=Z.childLanes,z.lanes=Z.lanes,z.child=Z.child,z.subtreeFlags=0,z.deletions=null,z.memoizedProps=Z.memoizedProps,z.memoizedState=Z.memoizedState,z.updateQueue=Z.updateQueue,z.type=Z.type,r=Z.dependencies,z.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),d=d.sibling;return ir(gr,gr.current&1|2),s.child}r=r.sibling}z.tail!==null&&mr()>Bo&&(s.flags|=128,E=!0,Dl(z,!1),s.lanes=4194304)}else{if(!E)if(r=Cl(Z),r!==null){if(s.flags|=128,E=!0,d=r.updateQueue,d!==null&&(s.updateQueue=d,s.flags|=4),Dl(z,!0),z.tail===null&&z.tailMode==="hidden"&&!Z.alternate&&!ur)return Kr(s),null}else 2*mr()-z.renderingStartTime>Bo&&d!==1073741824&&(s.flags|=128,E=!0,Dl(z,!1),s.lanes=4194304);z.isBackwards?(Z.sibling=s.child,s.child=Z):(d=z.last,d!==null?d.sibling=Z:s.child=Z,z.last=Z)}return z.tail!==null?(s=z.tail,z.rendering=s,z.tail=s.sibling,z.renderingStartTime=mr(),s.sibling=null,d=gr.current,ir(gr,E?d&1|2:d&1),s):(Kr(s),null);case 22:case 23:return Pu(),E=s.memoizedState!==null,r!==null&&r.memoizedState!==null!==E&&(s.flags|=8192),E&&(s.mode&1)!==0?(Pi&1073741824)!==0&&(Kr(s),s.subtreeFlags&6&&(s.flags|=8192)):Kr(s),null;case 24:return null;case 25:return null}throw Error(o(156,s.tag))}function ip(r,s){switch(Rc(s),s.tag){case 1:return pi(s.type)&&ml(),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return ro(),or(fi),or(si),Gc(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return Hc(s),null;case 13:if(or(gr),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(o(340));Qn()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return or(gr),null;case 4:return ro(),null;case 10:return Fc(s.type._context),null;case 22:case 23:return Pu(),null;case 24:return null;default:return null}}var mu=!1,Xr=!1,sp=typeof WeakSet=="function"?WeakSet:Set,ut=null;function Oo(r,s){var d=r.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(E){vr(r,s,E)}else d.current=null}function gu(r,s,d){try{d()}catch(E){vr(r,s,E)}}var yh=!1;function np(r,s){if(xc=vn,r=pc(),mc(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var E=d.getSelection&&d.getSelection();if(E&&E.rangeCount!==0){d=E.anchorNode;var L=E.anchorOffset,z=E.focusNode;E=E.focusOffset;try{d.nodeType,z.nodeType}catch{d=null;break e}var Z=0,fe=-1,we=-1,Le=0,Xe=0,Je=r,Ke=null;t:for(;;){for(var at;Je!==d||L!==0&&Je.nodeType!==3||(fe=Z+L),Je!==z||E!==0&&Je.nodeType!==3||(we=Z+E),Je.nodeType===3&&(Z+=Je.nodeValue.length),(at=Je.firstChild)!==null;)Ke=Je,Je=at;for(;;){if(Je===r)break t;if(Ke===d&&++Le===L&&(fe=Z),Ke===z&&++Xe===E&&(we=Z),(at=Je.nextSibling)!==null)break;Je=Ke,Ke=Je.parentNode}Je=at}d=fe===-1||we===-1?null:{start:fe,end:we}}else d=null}d=d||{start:0,end:0}}else d=null;for(Sc={focusedElem:r,selectionRange:d},vn=!1,ut=s;ut!==null;)if(s=ut,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,ut=r;else for(;ut!==null;){s=ut;try{var dt=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(dt!==null){var ft=dt.memoizedProps,sr=dt.memoizedState,Ie=s.stateNode,Ee=Ie.getSnapshotBeforeUpdate(s.elementType===s.type?ft:Tr(s.type,ft),sr);Ie.__reactInternalSnapshotBeforeUpdate=Ee}break;case 3:var je=s.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(rt){vr(s,s.return,rt)}if(r=s.sibling,r!==null){r.return=s.return,ut=r;break}ut=s.return}return dt=yh,yh=!1,dt}function Ca(r,s,d){var E=s.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var L=E=E.next;do{if((L.tag&r)===r){var z=L.destroy;L.destroy=void 0,z!==void 0&&gu(s,d,z)}L=L.next}while(L!==E)}}function vu(r,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var d=s=s.next;do{if((d.tag&r)===r){var E=d.create;d.destroy=E()}d=d.next}while(d!==s)}}function yu(r){var s=r.ref;if(s!==null){var d=r.stateNode;switch(r.tag){case 5:r=d;break;default:r=d}typeof s=="function"?s(r):s.current=r}}function _h(r){var s=r.alternate;s!==null&&(r.alternate=null,_h(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&(delete s[Es],delete s[ga],delete s[Tc],delete s[Td],delete s[$d])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function wh(r){return r.tag===5||r.tag===3||r.tag===4}function bh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||wh(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function _u(r,s,d){var E=r.tag;if(E===5||E===6)r=r.stateNode,s?d.nodeType===8?d.parentNode.insertBefore(r,s):d.insertBefore(r,s):(d.nodeType===8?(s=d.parentNode,s.insertBefore(r,d)):(s=d,s.appendChild(r)),d=d._reactRootContainer,d!=null||s.onclick!==null||(s.onclick=fl));else if(E!==4&&(r=r.child,r!==null))for(_u(r,s,d),r=r.sibling;r!==null;)_u(r,s,d),r=r.sibling}function wu(r,s,d){var E=r.tag;if(E===5||E===6)r=r.stateNode,s?d.insertBefore(r,s):d.appendChild(r);else if(E!==4&&(r=r.child,r!==null))for(wu(r,s,d),r=r.sibling;r!==null;)wu(r,s,d),r=r.sibling}var Nr=null,ds=!1;function Cn(r,s,d){for(d=d.child;d!==null;)op(r,s,d),d=d.sibling}function op(r,s,d){if(hi&&typeof hi.onCommitFiberUnmount=="function")try{hi.onCommitFiberUnmount(Bs,d)}catch{}switch(d.tag){case 5:Xr||Oo(d,s);case 6:var E=Nr,L=ds;Nr=null,Cn(r,s,d),Nr=E,ds=L,Nr!==null&&(ds?(r=Nr,d=d.stateNode,r.nodeType===8?r.parentNode.removeChild(d):r.removeChild(d)):Nr.removeChild(d.stateNode));break;case 18:Nr!==null&&(ds?(r=Nr,d=d.stateNode,r.nodeType===8?Ec(r.parentNode,d):r.nodeType===1&&Ec(r,d),Ws(r)):Ec(Nr,d.stateNode));break;case 4:E=Nr,L=ds,Nr=d.stateNode.containerInfo,ds=!0,Cn(r,s,d),Nr=E,ds=L;break;case 0:case 11:case 14:case 15:if(!Xr&&(E=d.updateQueue,E!==null&&(E=E.lastEffect,E!==null))){L=E=E.next;do{var z=L,Z=z.destroy;z=z.tag,Z!==void 0&&((z&2)!==0||(z&4)!==0)&&gu(d,s,Z),L=L.next}while(L!==E)}Cn(r,s,d);break;case 1:if(!Xr&&(Oo(d,s),E=d.stateNode,typeof E.componentWillUnmount=="function"))try{E.props=d.memoizedProps,E.state=d.memoizedState,E.componentWillUnmount()}catch(fe){vr(d,s,fe)}Cn(r,s,d);break;case 21:Cn(r,s,d);break;case 22:d.mode&1?(Xr=(E=Xr)||d.memoizedState!==null,Cn(r,s,d),Xr=E):Cn(r,s,d);break;default:Cn(r,s,d)}}function Ea(r){var s=r.updateQueue;if(s!==null){r.updateQueue=null;var d=r.stateNode;d===null&&(d=r.stateNode=new sp),s.forEach(function(E){var L=fp.bind(null,r,E);d.has(E)||(d.add(E),E.then(L,L))})}}function Ki(r,s){var d=s.deletions;if(d!==null)for(var E=0;E<d.length;E++){var L=d[E];try{var z=r,Z=s,fe=Z;e:for(;fe!==null;){switch(fe.tag){case 5:Nr=fe.stateNode,ds=!1;break e;case 3:Nr=fe.stateNode.containerInfo,ds=!0;break e;case 4:Nr=fe.stateNode.containerInfo,ds=!0;break e}fe=fe.return}if(Nr===null)throw Error(o(160));op(z,Z,L),Nr=null,ds=!1;var we=L.alternate;we!==null&&(we.return=null),L.return=null}catch(Le){vr(L,s,Le)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)bu(s,r),s=s.sibling}function bu(r,s){var d=r.alternate,E=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Ki(s,r),hs(r),E&4){try{Ca(3,r,r.return),vu(3,r)}catch(ft){vr(r,r.return,ft)}try{Ca(5,r,r.return)}catch(ft){vr(r,r.return,ft)}}break;case 1:Ki(s,r),hs(r),E&512&&d!==null&&Oo(d,d.return);break;case 5:if(Ki(s,r),hs(r),E&512&&d!==null&&Oo(d,d.return),r.flags&32){var L=r.stateNode;try{Or(L,"")}catch(ft){vr(r,r.return,ft)}}if(E&4&&(L=r.stateNode,L!=null)){var z=r.memoizedProps,Z=d!==null?d.memoizedProps:z,fe=r.type,we=r.updateQueue;if(r.updateQueue=null,we!==null)try{fe==="input"&&z.type==="radio"&&z.name!=null&&Wt(L,z),er(fe,Z);var Le=er(fe,z);for(Z=0;Z<we.length;Z+=2){var Xe=we[Z],Je=we[Z+1];Xe==="style"?oc(L,Je):Xe==="dangerouslySetInnerHTML"?Mi(L,Je):Xe==="children"?Or(L,Je):C(L,Xe,Je,Le)}switch(fe){case"input":ht(L,z);break;case"textarea":Ms(L,z);break;case"select":var Ke=L._wrapperState.wasMultiple;L._wrapperState.wasMultiple=!!z.multiple;var at=z.value;at!=null?Rr(L,!!z.multiple,at,!1):Ke!==!!z.multiple&&(z.defaultValue!=null?Rr(L,!!z.multiple,z.defaultValue,!0):Rr(L,!!z.multiple,z.multiple?[]:"",!1))}L[ga]=z}catch(ft){vr(r,r.return,ft)}}break;case 6:if(Ki(s,r),hs(r),E&4){if(r.stateNode===null)throw Error(o(162));L=r.stateNode,z=r.memoizedProps;try{L.nodeValue=z}catch(ft){vr(r,r.return,ft)}}break;case 3:if(Ki(s,r),hs(r),E&4&&d!==null&&d.memoizedState.isDehydrated)try{Ws(s.containerInfo)}catch(ft){vr(r,r.return,ft)}break;case 4:Ki(s,r),hs(r);break;case 13:Ki(s,r),hs(r),L=r.child,L.flags&8192&&(z=L.memoizedState!==null,L.stateNode.isHidden=z,!z||L.alternate!==null&&L.alternate.memoizedState!==null||(Cu=mr())),E&4&&Ea(r);break;case 22:if(Xe=d!==null&&d.memoizedState!==null,r.mode&1?(Xr=(Le=Xr)||Xe,Ki(s,r),Xr=Le):Ki(s,r),hs(r),E&8192){if(Le=r.memoizedState!==null,(r.stateNode.isHidden=Le)&&!Xe&&(r.mode&1)!==0)for(ut=r,Xe=r.child;Xe!==null;){for(Je=ut=Xe;ut!==null;){switch(Ke=ut,at=Ke.child,Ke.tag){case 0:case 11:case 14:case 15:Ca(4,Ke,Ke.return);break;case 1:Oo(Ke,Ke.return);var dt=Ke.stateNode;if(typeof dt.componentWillUnmount=="function"){E=Ke,d=Ke.return;try{s=E,dt.props=s.memoizedProps,dt.state=s.memoizedState,dt.componentWillUnmount()}catch(ft){vr(E,d,ft)}}break;case 5:Oo(Ke,Ke.return);break;case 22:if(Ke.memoizedState!==null){xu(Je);continue}}at!==null?(at.return=Ke,ut=at):xu(Je)}Xe=Xe.sibling}e:for(Xe=null,Je=r;;){if(Je.tag===5){if(Xe===null){Xe=Je;try{L=Je.stateNode,Le?(z=L.style,typeof z.setProperty=="function"?z.setProperty("display","none","important"):z.display="none"):(fe=Je.stateNode,we=Je.memoizedProps.style,Z=we!=null&&we.hasOwnProperty("display")?we.display:null,fe.style.display=Nn("display",Z))}catch(ft){vr(r,r.return,ft)}}}else if(Je.tag===6){if(Xe===null)try{Je.stateNode.nodeValue=Le?"":Je.memoizedProps}catch(ft){vr(r,r.return,ft)}}else if((Je.tag!==22&&Je.tag!==23||Je.memoizedState===null||Je===r)&&Je.child!==null){Je.child.return=Je,Je=Je.child;continue}if(Je===r)break e;for(;Je.sibling===null;){if(Je.return===null||Je.return===r)break e;Xe===Je&&(Xe=null),Je=Je.return}Xe===Je&&(Xe=null),Je.sibling.return=Je.return,Je=Je.sibling}}break;case 19:Ki(s,r),hs(r),E&4&&Ea(r);break;case 21:break;default:Ki(s,r),hs(r)}}function hs(r){var s=r.flags;if(s&2){try{e:{for(var d=r.return;d!==null;){if(wh(d)){var E=d;break e}d=d.return}throw Error(o(160))}switch(E.tag){case 5:var L=E.stateNode;E.flags&32&&(Or(L,""),E.flags&=-33);var z=bh(r);wu(r,z,L);break;case 3:case 4:var Z=E.stateNode.containerInfo,fe=bh(r);_u(r,fe,Z);break;default:throw Error(o(161))}}catch(we){vr(r,r.return,we)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function xh(r,s,d){ut=r,Sh(r)}function Sh(r,s,d){for(var E=(r.mode&1)!==0;ut!==null;){var L=ut,z=L.child;if(L.tag===22&&E){var Z=L.memoizedState!==null||mu;if(!Z){var fe=L.alternate,we=fe!==null&&fe.memoizedState!==null||Xr;fe=mu;var Le=Xr;if(mu=Z,(Xr=we)&&!Le)for(ut=L;ut!==null;)Z=ut,we=Z.child,Z.tag===22&&Z.memoizedState!==null?Su(L):we!==null?(we.return=Z,ut=we):Su(L);for(;z!==null;)ut=z,Sh(z),z=z.sibling;ut=L,mu=fe,Xr=Le}kh(r)}else(L.subtreeFlags&8772)!==0&&z!==null?(z.return=L,ut=z):kh(r)}}function kh(r){for(;ut!==null;){var s=ut;if((s.flags&8772)!==0){var d=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Xr||vu(5,s);break;case 1:var E=s.stateNode;if(s.flags&4&&!Xr)if(d===null)E.componentDidMount();else{var L=s.elementType===s.type?d.memoizedProps:Tr(s.type,d.memoizedProps);E.componentDidUpdate(L,d.memoizedState,E.__reactInternalSnapshotBeforeUpdate)}var z=s.updateQueue;z!==null&&Wf(s,z,E);break;case 3:var Z=s.updateQueue;if(Z!==null){if(d=null,s.child!==null)switch(s.child.tag){case 5:d=s.child.stateNode;break;case 1:d=s.child.stateNode}Wf(s,Z,d)}break;case 5:var fe=s.stateNode;if(d===null&&s.flags&4){d=fe;var we=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":we.autoFocus&&d.focus();break;case"img":we.src&&(d.src=we.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var Le=s.alternate;if(Le!==null){var Xe=Le.memoizedState;if(Xe!==null){var Je=Xe.dehydrated;Je!==null&&Ws(Je)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}Xr||s.flags&512&&yu(s)}catch(Ke){vr(s,s.return,Ke)}}if(s===r){ut=null;break}if(d=s.sibling,d!==null){d.return=s.return,ut=d;break}ut=s.return}}function xu(r){for(;ut!==null;){var s=ut;if(s===r){ut=null;break}var d=s.sibling;if(d!==null){d.return=s.return,ut=d;break}ut=s.return}}function Su(r){for(;ut!==null;){var s=ut;try{switch(s.tag){case 0:case 11:case 15:var d=s.return;try{vu(4,s)}catch(we){vr(s,d,we)}break;case 1:var E=s.stateNode;if(typeof E.componentDidMount=="function"){var L=s.return;try{E.componentDidMount()}catch(we){vr(s,L,we)}}var z=s.return;try{yu(s)}catch(we){vr(s,z,we)}break;case 5:var Z=s.return;try{yu(s)}catch(we){vr(s,Z,we)}}}catch(we){vr(s,s.return,we)}if(s===r){ut=null;break}var fe=s.sibling;if(fe!==null){fe.return=s.return,ut=fe;break}ut=s.return}}var ap=Math.ceil,Il=P.ReactCurrentDispatcher,Ml=P.ReactCurrentOwner,Xi=P.ReactCurrentBatchConfig,Gt=0,$r=null,xr=null,Br=0,Pi=0,No=qs(0),Mr=0,Ta=null,oo=0,Ll=0,ku=0,jl=null,wi=null,Cu=0,Bo=1/0,En=null,Ol=!1,Eu=null,Tn=null,Nl=!1,ao=null,Bl=0,$a=0,Tu=null,Aa=-1,zl=0;function ai(){return(Gt&6)!==0?mr():Aa!==-1?Aa:Aa=mr()}function $n(r){return(r.mode&1)===0?1:(Gt&2)!==0&&Br!==0?Br&-Br:Oc.transition!==null?(zl===0&&(zl=ws()),zl):(r=Ft,r!==0||(r=window.event,r=r===void 0?16:te(r.type)),r)}function fs(r,s,d,E){if(50<$a)throw $a=0,Tu=null,Error(o(185));rs(r,d,E),((Gt&2)===0||r!==$r)&&(r===$r&&((Gt&2)===0&&(Ll|=d),Mr===4&&An(r,Br)),bi(r,E),d===1&&Gt===0&&(s.mode&1)===0&&(Bo=mr()+500,vl&&bn()))}function bi(r,s){var d=r.callbackNode;Ni(r,s);var E=un(r,r===$r?Br:0);if(E===0)d!==null&&ts(d),r.callbackNode=null,r.callbackPriority=0;else if(s=E&-E,r.callbackPriority!==s){if(d!=null&&ts(d),s===1)r.tag===0?Em(Th.bind(null,r)):Dd(Th.bind(null,r)),zf(function(){(Gt&6)===0&&bn()}),d=null;else{switch(mt(E)){case 1:d=Qr;break;case 4:d=di;break;case 16:d=Ns;break;case 536870912:d=Wn;break;default:d=Ns}d=Ih(d,Ch.bind(null,r))}r.callbackPriority=s,r.callbackNode=d}}function Ch(r,s){if(Aa=-1,zl=0,(Gt&6)!==0)throw Error(o(327));var d=r.callbackNode;if(zo()&&r.callbackNode!==d)return null;var E=un(r,r===$r?Br:0);if(E===0)return null;if((E&30)!==0||(E&r.expiredLanes)!==0||s)s=Fl(r,E);else{s=E;var L=Gt;Gt|=2;var z=lp();($r!==r||Br!==s)&&(En=null,Bo=mr()+500,co(r,s));do try{Rm();break}catch(fe){$h(r,fe)}while(!0);zc(),Il.current=z,Gt=L,xr!==null?s=0:($r=null,Br=0,s=Mr)}if(s!==0){if(s===2&&(L=Hn(r),L!==0&&(E=L,s=$u(r,L))),s===1)throw d=Ta,co(r,0),An(r,E),bi(r,mr()),d;if(s===6)An(r,E);else{if(L=r.current.alternate,(E&30)===0&&!Eh(L)&&(s=Fl(r,E),s===2&&(z=Hn(r),z!==0&&(E=z,s=$u(r,z))),s===1))throw d=Ta,co(r,0),An(r,E),bi(r,mr()),d;switch(r.finishedWork=L,r.finishedLanes=E,s){case 0:case 1:throw Error(o(345));case 2:uo(r,wi,En);break;case 3:if(An(r,E),(E&130023424)===E&&(s=Cu+500-mr(),10<s)){if(un(r,0)!==0)break;if(L=r.suspendedLanes,(L&E)!==E){ai(),r.pingedLanes|=r.suspendedLanes&L;break}r.timeoutHandle=Cc(uo.bind(null,r,wi,En),s);break}uo(r,wi,En);break;case 4:if(An(r,E),(E&4194240)===E)break;for(s=r.eventTimes,L=-1;0<E;){var Z=31-Vr(E);z=1<<Z,Z=s[Z],Z>L&&(L=Z),E&=~z}if(E=L,E=mr()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*ap(E/1960))-E,10<E){r.timeoutHandle=Cc(uo.bind(null,r,wi,En),E);break}uo(r,wi,En);break;case 5:uo(r,wi,En);break;default:throw Error(o(329))}}}return bi(r,mr()),r.callbackNode===d?Ch.bind(null,r):null}function $u(r,s){var d=jl;return r.current.memoizedState.isDehydrated&&(co(r,s).flags|=256),r=Fl(r,s),r!==2&&(s=wi,wi=d,s!==null&&Au(s)),r}function Au(r){wi===null?wi=r:wi.push.apply(wi,r)}function Eh(r){for(var s=r;;){if(s.flags&16384){var d=s.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var E=0;E<d.length;E++){var L=d[E],z=L.getSnapshot;L=L.value;try{if(!ls(z(),L))return!1}catch{return!1}}}if(d=s.child,s.subtreeFlags&16384&&d!==null)d.return=s,s=d;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function An(r,s){for(s&=~ku,s&=~Ll,r.suspendedLanes|=s,r.pingedLanes&=~s,r=r.expirationTimes;0<s;){var d=31-Vr(s),E=1<<d;r[d]=-1,s&=~E}}function Th(r){if((Gt&6)!==0)throw Error(o(327));zo();var s=un(r,0);if((s&1)===0)return bi(r,mr()),null;var d=Fl(r,s);if(r.tag!==0&&d===2){var E=Hn(r);E!==0&&(s=E,d=$u(r,E))}if(d===1)throw d=Ta,co(r,0),An(r,s),bi(r,mr()),d;if(d===6)throw Error(o(345));return r.finishedWork=r.current.alternate,r.finishedLanes=s,uo(r,wi,En),bi(r,mr()),null}function Ru(r,s){var d=Gt;Gt|=1;try{return r(s)}finally{Gt=d,Gt===0&&(Bo=mr()+500,vl&&bn())}}function lo(r){ao!==null&&ao.tag===0&&(Gt&6)===0&&zo();var s=Gt;Gt|=1;var d=Xi.transition,E=Ft;try{if(Xi.transition=null,Ft=1,r)return r()}finally{Ft=E,Xi.transition=d,Gt=s,(Gt&6)===0&&bn()}}function Pu(){Pi=No.current,or(No)}function co(r,s){r.finishedWork=null,r.finishedLanes=0;var d=r.timeoutHandle;if(d!==-1&&(r.timeoutHandle=-1,Bf(d)),xr!==null)for(d=xr.return;d!==null;){var E=d;switch(Rc(E),E.tag){case 1:E=E.type.childContextTypes,E!=null&&ml();break;case 3:ro(),or(fi),or(si),Gc();break;case 5:Hc(E);break;case 4:ro();break;case 13:or(gr);break;case 19:or(gr);break;case 10:Fc(E.type._context);break;case 22:case 23:Pu()}d=d.return}if($r=r,xr=r=Rn(r.current,null),Br=Pi=s,Mr=0,Ta=null,ku=Ll=oo=0,wi=jl=null,Mo!==null){for(s=0;s<Mo.length;s++)if(d=Mo[s],E=d.interleaved,E!==null){d.interleaved=null;var L=E.next,z=d.pending;if(z!==null){var Z=z.next;z.next=L,E.next=Z}d.pending=E}Mo=null}return r}function $h(r,s){do{var d=xr;try{if(zc(),Kc.current=Al,Jc){for(var E=dr.memoizedState;E!==null;){var L=E.queue;L!==null&&(L.pending=null),E=E.next}Jc=!1}if(io=0,Ir=Er=dr=null,so=!1,kn=0,Ml.current=null,d===null||d.return===null){Mr=1,Ta=s,xr=null;break}e:{var z=r,Z=d.return,fe=d,we=s;if(s=Br,fe.flags|=32768,we!==null&&typeof we=="object"&&typeof we.then=="function"){var Le=we,Xe=fe,Je=Xe.tag;if((Xe.mode&1)===0&&(Je===0||Je===11||Je===15)){var Ke=Xe.alternate;Ke?(Xe.updateQueue=Ke.updateQueue,Xe.memoizedState=Ke.memoizedState,Xe.lanes=Ke.lanes):(Xe.updateQueue=null,Xe.memoizedState=null)}var at=Zf(Z);if(at!==null){at.flags&=-257,oi(at,Z,fe,z,s),at.mode&1&&ah(z,Le,s),s=at,we=Le;var dt=s.updateQueue;if(dt===null){var ft=new Set;ft.add(we),s.updateQueue=ft}else dt.add(we);break e}else{if((s&1)===0){ah(z,Le,s),Du();break e}we=Error(o(426))}}else if(ur&&fe.mode&1){var sr=Zf(Z);if(sr!==null){(sr.flags&65536)===0&&(sr.flags|=256),oi(sr,Z,fe,z,s),jc(jo(we,fe));break e}}z=we=jo(we,fe),Mr!==4&&(Mr=2),jl===null?jl=[z]:jl.push(z),z=Z;do{switch(z.tag){case 3:z.flags|=65536,s&=-s,z.lanes|=s;var Ie=nh(z,we,s);Vf(z,Ie);break e;case 1:fe=we;var Ee=z.type,je=z.stateNode;if((z.flags&128)===0&&(typeof Ee.getDerivedStateFromError=="function"||je!==null&&typeof je.componentDidCatch=="function"&&(Tn===null||!Tn.has(je)))){z.flags|=65536,s&=-s,z.lanes|=s;var rt=oh(z,fe,s);Vf(z,rt);break e}}z=z.return}while(z!==null)}Ra(d)}catch(_t){s=_t,xr===d&&d!==null&&(xr=d=d.return);continue}break}while(!0)}function lp(){var r=Il.current;return Il.current=Al,r===null?Al:r}function Du(){(Mr===0||Mr===3||Mr===2)&&(Mr=4),$r===null||(oo&268435455)===0&&(Ll&268435455)===0||An($r,Br)}function Fl(r,s){var d=Gt;Gt|=2;var E=lp();($r!==r||Br!==s)&&(En=null,co(r,s));do try{cp();break}catch(L){$h(r,L)}while(!0);if(zc(),Gt=d,Il.current=E,xr!==null)throw Error(o(261));return $r=null,Br=0,Mr}function cp(){for(;xr!==null;)Ah(xr)}function Rm(){for(;xr!==null&&!Ka();)Ah(xr)}function Ah(r){var s=Dh(r.alternate,r,Pi);r.memoizedProps=r.pendingProps,s===null?Ra(r):xr=s,Ml.current=null}function Ra(r){var s=r;do{var d=s.alternate;if(r=s.return,(s.flags&32768)===0){if(d=rp(d,s,Pi),d!==null){xr=d;return}}else{if(d=ip(d,s),d!==null){d.flags&=32767,xr=d;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Mr=6,xr=null;return}}if(s=s.sibling,s!==null){xr=s;return}xr=s=r}while(s!==null);Mr===0&&(Mr=5)}function uo(r,s,d){var E=Ft,L=Xi.transition;try{Xi.transition=null,Ft=1,Rh(r,s,d,E)}finally{Xi.transition=L,Ft=E}return null}function Rh(r,s,d,E){do zo();while(ao!==null);if((Gt&6)!==0)throw Error(o(327));d=r.finishedWork;var L=r.finishedLanes;if(d===null)return null;if(r.finishedWork=null,r.finishedLanes=0,d===r.current)throw Error(o(177));r.callbackNode=null,r.callbackPriority=0;var z=d.lanes|d.childLanes;if(ta(r,z),r===$r&&(xr=$r=null,Br=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Nl||(Nl=!0,Ih(Ns,function(){return zo(),null})),z=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||z){z=Xi.transition,Xi.transition=null;var Z=Ft;Ft=1;var fe=Gt;Gt|=4,Ml.current=null,np(r,d),bu(d,r),Mf(Sc),vn=!!xc,Sc=xc=null,r.current=d,xh(d),Xa(),Gt=fe,Ft=Z,Xi.transition=z}else r.current=d;if(Nl&&(Nl=!1,ao=r,Bl=L),z=r.pendingLanes,z===0&&(Tn=null),xt(d.stateNode),bi(r,mr()),s!==null)for(E=r.onRecoverableError,d=0;d<s.length;d++)L=s[d],E(L.value,{componentStack:L.stack,digest:L.digest});if(Ol)throw Ol=!1,r=Eu,Eu=null,r;return(Bl&1)!==0&&r.tag!==0&&zo(),z=r.pendingLanes,(z&1)!==0?r===Tu?$a++:($a=0,Tu=r):$a=0,bn(),null}function zo(){if(ao!==null){var r=mt(Bl),s=Xi.transition,d=Ft;try{if(Xi.transition=null,Ft=16>r?16:r,ao===null)var E=!1;else{if(r=ao,ao=null,Bl=0,(Gt&6)!==0)throw Error(o(331));var L=Gt;for(Gt|=4,ut=r.current;ut!==null;){var z=ut,Z=z.child;if((ut.flags&16)!==0){var fe=z.deletions;if(fe!==null){for(var we=0;we<fe.length;we++){var Le=fe[we];for(ut=Le;ut!==null;){var Xe=ut;switch(Xe.tag){case 0:case 11:case 15:Ca(8,Xe,z)}var Je=Xe.child;if(Je!==null)Je.return=Xe,ut=Je;else for(;ut!==null;){Xe=ut;var Ke=Xe.sibling,at=Xe.return;if(_h(Xe),Xe===Le){ut=null;break}if(Ke!==null){Ke.return=at,ut=Ke;break}ut=at}}}var dt=z.alternate;if(dt!==null){var ft=dt.child;if(ft!==null){dt.child=null;do{var sr=ft.sibling;ft.sibling=null,ft=sr}while(ft!==null)}}ut=z}}if((z.subtreeFlags&2064)!==0&&Z!==null)Z.return=z,ut=Z;else e:for(;ut!==null;){if(z=ut,(z.flags&2048)!==0)switch(z.tag){case 0:case 11:case 15:Ca(9,z,z.return)}var Ie=z.sibling;if(Ie!==null){Ie.return=z.return,ut=Ie;break e}ut=z.return}}var Ee=r.current;for(ut=Ee;ut!==null;){Z=ut;var je=Z.child;if((Z.subtreeFlags&2064)!==0&&je!==null)je.return=Z,ut=je;else e:for(Z=Ee;ut!==null;){if(fe=ut,(fe.flags&2048)!==0)try{switch(fe.tag){case 0:case 11:case 15:vu(9,fe)}}catch(_t){vr(fe,fe.return,_t)}if(fe===Z){ut=null;break e}var rt=fe.sibling;if(rt!==null){rt.return=fe.return,ut=rt;break e}ut=fe.return}}if(Gt=L,bn(),hi&&typeof hi.onPostCommitFiberRoot=="function")try{hi.onPostCommitFiberRoot(Bs,r)}catch{}E=!0}return E}finally{Ft=d,Xi.transition=s}}return!1}function Ph(r,s,d){s=jo(d,s),s=nh(r,s,1),r=Sn(r,s,1),s=ai(),r!==null&&(rs(r,1,s),bi(r,s))}function vr(r,s,d){if(r.tag===3)Ph(r,r,d);else for(;s!==null;){if(s.tag===3){Ph(s,r,d);break}else if(s.tag===1){var E=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof E.componentDidCatch=="function"&&(Tn===null||!Tn.has(E))){r=jo(d,r),r=oh(s,r,1),s=Sn(s,r,1),r=ai(),s!==null&&(rs(s,1,r),bi(s,r));break}}s=s.return}}function up(r,s,d){var E=r.pingCache;E!==null&&E.delete(s),s=ai(),r.pingedLanes|=r.suspendedLanes&d,$r===r&&(Br&d)===d&&(Mr===4||Mr===3&&(Br&130023424)===Br&&500>mr()-Cu?co(r,0):ku|=d),bi(r,s)}function dp(r,s){s===0&&((r.mode&1)===0?s=1:(s=Oi,Oi<<=1,(Oi&130023424)===0&&(Oi=4194304)));var d=ai();r=Ks(r,s),r!==null&&(rs(r,s,d),bi(r,d))}function hp(r){var s=r.memoizedState,d=0;s!==null&&(d=s.retryLane),dp(r,d)}function fp(r,s){var d=0;switch(r.tag){case 13:var E=r.stateNode,L=r.memoizedState;L!==null&&(d=L.retryLane);break;case 19:E=r.stateNode;break;default:throw Error(o(314))}E!==null&&E.delete(s),dp(r,d)}var Dh;Dh=function(r,s,d){if(r!==null)if(r.memoizedProps!==s.pendingProps||fi.current)_i=!0;else{if((r.lanes&d)===0&&(s.flags&128)===0)return _i=!1,Am(r,s,d);_i=(r.flags&131072)!==0}else _i=!1,ur&&(s.flags&1048576)!==0&&Yn(s,_l,s.index);switch(s.lanes=0,s.tag){case 2:var E=s.type;Pl(r,s),r=s.pendingProps;var L=ni(s,si.current);Io(s,d),L=Qc(null,s,E,r,L,d);var z=Zc();return s.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,pi(E)?(z=!0,gl(s)):z=!1,s.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,Sl(s),L.updater=Js,s.stateNode=L,L._reactInternals=s,iu(s,E,r,d),s=au(null,s,E,!0,z,d)):(s.tag=0,ur&&z&&Cr(s),Gr(null,s,L,d),s=s.child),s;case 16:E=s.elementType;e:{switch(Pl(r,s),r=s.pendingProps,L=E._init,E=L(E._payload),s.type=E,L=s.tag=pp(E),r=Tr(E,r),L){case 0:s=ou(null,s,E,r,d);break e;case 1:s=hh(null,s,E,r,d);break e;case 11:s=lh(null,s,E,r,d);break e;case 14:s=Sa(null,s,E,Tr(E.type,r),d);break e}throw Error(o(306,E,""))}return s;case 0:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),ou(r,s,E,L,d);case 1:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),hh(r,s,E,L,d);case 3:e:{if(lu(s),r===null)throw Error(o(387));E=s.pendingProps,z=s.memoizedState,L=z.element,Vc(r,s),kl(s,E,null,d);var Z=s.memoizedState;if(E=Z.element,z.isDehydrated)if(z={element:E,isDehydrated:!1,cache:Z.cache,pendingSuspenseBoundaries:Z.pendingSuspenseBoundaries,transitions:Z.transitions},s.updateQueue.baseState=z,s.memoizedState=z,s.flags&256){L=jo(Error(o(423)),s),s=fh(r,s,E,d,L);break e}else if(E!==L){L=jo(Error(o(424)),s),s=fh(r,s,E,d,L);break e}else for(Ri=_n(s.stateNode.containerInfo.firstChild),vi=s,ur=!0,yi=null,d=Nc(s,null,E,d),s.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Qn(),E===L){s=Ys(r,s,d);break e}Gr(r,s,E,d)}s=s.child}return s;case 5:return jd(s),r===null&&Mc(s),E=s.type,L=s.pendingProps,z=r!==null?r.memoizedProps:null,Z=L.children,kc(E,L)?Z=null:z!==null&&kc(E,z)&&(s.flags|=32),dh(r,s),Gr(r,s,Z,d),s.child;case 6:return r===null&&Mc(s),null;case 13:return ph(r,s,d);case 4:return Wc(s,s.stateNode.containerInfo),E=s.pendingProps,r===null?s.child=Do(s,null,E,d):Gr(r,s,E,d),s.child;case 11:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),lh(r,s,E,L,d);case 7:return Gr(r,s,s.pendingProps,d),s.child;case 8:return Gr(r,s,s.pendingProps.children,d),s.child;case 12:return Gr(r,s,s.pendingProps.children,d),s.child;case 10:e:{if(E=s.type._context,L=s.pendingProps,z=s.memoizedProps,Z=L.value,ir(Zn,E._currentValue),E._currentValue=Z,z!==null)if(ls(z.value,Z)){if(z.children===L.children&&!fi.current){s=Ys(r,s,d);break e}}else for(z=s.child,z!==null&&(z.return=s);z!==null;){var fe=z.dependencies;if(fe!==null){Z=z.child;for(var we=fe.firstContext;we!==null;){if(we.context===E){if(z.tag===1){we=Xs(-1,d&-d),we.tag=2;var Le=z.updateQueue;if(Le!==null){Le=Le.shared;var Xe=Le.pending;Xe===null?we.next=we:(we.next=Xe.next,Xe.next=we),Le.pending=we}}z.lanes|=d,we=z.alternate,we!==null&&(we.lanes|=d),Ld(z.return,d,s),fe.lanes|=d;break}we=we.next}}else if(z.tag===10)Z=z.type===s.type?null:z.child;else if(z.tag===18){if(Z=z.return,Z===null)throw Error(o(341));Z.lanes|=d,fe=Z.alternate,fe!==null&&(fe.lanes|=d),Ld(Z,d,s),Z=z.sibling}else Z=z.child;if(Z!==null)Z.return=z;else for(Z=z;Z!==null;){if(Z===s){Z=null;break}if(z=Z.sibling,z!==null){z.return=Z.return,Z=z;break}Z=Z.return}z=Z}Gr(r,s,L.children,d),s=s.child}return s;case 9:return L=s.type,E=s.pendingProps.children,Io(s,d),L=qi(L),E=E(L),s.flags|=1,Gr(r,s,E,d),s.child;case 14:return E=s.type,L=Tr(E,s.pendingProps),L=Tr(E.type,L),Sa(r,s,E,L,d);case 15:return ch(r,s,s.type,s.pendingProps,d);case 17:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),Pl(r,s),s.tag=1,pi(E)?(r=!0,gl(s)):r=!1,Io(s,d),ih(s,E,L),iu(s,E,L,d),au(null,s,E,!0,r,d);case 19:return hu(r,s,d);case 22:return uh(r,s,d)}throw Error(o(156,s.tag))};function Ih(r,s){return Zo(r,s)}function Pm(r,s,d,E){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Di(r,s,d,E){return new Pm(r,s,d,E)}function Iu(r){return r=r.prototype,!(!r||!r.isReactComponent)}function pp(r){if(typeof r=="function")return Iu(r)?1:0;if(r!=null){if(r=r.$$typeof,r===de)return 11;if(r===ge)return 14}return 2}function Rn(r,s){var d=r.alternate;return d===null?(d=Di(r.tag,s,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=s,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&14680064,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,s=r.dependencies,d.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d}function Ul(r,s,d,E,L,z){var Z=2;if(E=r,typeof r=="function")Iu(r)&&(Z=1);else if(typeof r=="string")Z=5;else e:switch(r){case F:return Fo(d.children,L,z,s);case I:Z=8,L|=8;break;case U:return r=Di(12,d,s,L|2),r.elementType=U,r.lanes=z,r;case ie:return r=Di(13,d,s,L),r.elementType=ie,r.lanes=z,r;case ye:return r=Di(19,d,s,L),r.elementType=ye,r.lanes=z,r;case be:return Vl(d,L,z,s);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Y:Z=10;break e;case se:Z=9;break e;case de:Z=11;break e;case ge:Z=14;break e;case ke:Z=16,E=null;break e}throw Error(o(130,r==null?r:typeof r,""))}return s=Di(Z,d,s,L),s.elementType=r,s.type=E,s.lanes=z,s}function Fo(r,s,d,E){return r=Di(7,r,E,s),r.lanes=d,r}function Vl(r,s,d,E){return r=Di(22,r,E,s),r.elementType=be,r.lanes=d,r.stateNode={isHidden:!1},r}function Mu(r,s,d){return r=Di(6,r,null,s),r.lanes=d,r}function Lu(r,s,d){return s=Di(4,r.children!==null?r.children:[],r.key,s),s.lanes=d,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}function Dm(r,s,d,E,L){this.tag=s,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Be(0),this.expirationTimes=Be(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Be(0),this.identifierPrefix=E,this.onRecoverableError=L,this.mutableSourceEagerHydrationData=null}function ju(r,s,d,E,L,z,Z,fe,we){return r=new Dm(r,s,d,fe,we),s===1?(s=1,z===!0&&(s|=8)):s=0,z=Di(3,null,null,s),r.current=z,z.stateNode=r,z.memoizedState={element:E,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sl(z),r}function Im(r,s,d){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:E==null?null:""+E,children:r,containerInfo:s,implementation:d}}function Mh(r){if(!r)return wn;r=r._reactInternals;e:{if(ct(r)!==r||r.tag!==1)throw Error(o(170));var s=r;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(pi(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(o(171))}if(r.tag===1){var d=r.type;if(pi(d))return Rd(r,d,s)}return s}function mp(r,s,d,E,L,z,Z,fe,we){return r=ju(d,E,!0,r,L,z,Z,fe,we),r.context=Mh(null),d=r.current,E=ai(),L=$n(d),z=Xs(E,L),z.callback=s??null,Sn(d,z,L),r.current.lanes=L,rs(r,L,E),bi(r,E),r}function Wl(r,s,d,E){var L=s.current,z=ai(),Z=$n(L);return d=Mh(d),s.context===null?s.context=d:s.pendingContext=d,s=Xs(z,Z),s.payload={element:r},E=E===void 0?null:E,E!==null&&(s.callback=E),r=Sn(L,s,Z),r!==null&&(fs(r,L,Z,z),_a(r,L,Z)),Z}function Hl(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Lh(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<s?d:s}}function Ou(r,s){Lh(r,s),(r=r.alternate)&&Lh(r,s)}function gp(){return null}var vp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Nu(r){this._internalRoot=r}Uo.prototype.render=Nu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(o(409));Wl(r,s,null,null)},Uo.prototype.unmount=Nu.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;lo(function(){Wl(null,r,null,null)}),s[Ts]=null}};function Uo(r){this._internalRoot=r}Uo.prototype.unstable_scheduleHydration=function(r){if(r){var s=dn();r={blockedOn:null,target:r,priority:s};for(var d=0;d<is.length&&s!==0&&s<is[d].priority;d++);is.splice(d,0,r),d===0&&ra(r)}};function Bu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function ql(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function yp(){}function _p(r,s,d,E,L){if(L){if(typeof E=="function"){var z=E;E=function(){var Le=Hl(Z);z.call(Le)}}var Z=mp(s,E,r,0,null,!1,!1,"",yp);return r._reactRootContainer=Z,r[Ts]=Z.current,pa(r.nodeType===8?r.parentNode:r),lo(),Z}for(;L=r.lastChild;)r.removeChild(L);if(typeof E=="function"){var fe=E;E=function(){var Le=Hl(we);fe.call(Le)}}var we=ju(r,0,!1,null,null,!1,!1,"",yp);return r._reactRootContainer=we,r[Ts]=we.current,pa(r.nodeType===8?r.parentNode:r),lo(function(){Wl(s,we,d,E)}),we}function Pa(r,s,d,E,L){var z=d._reactRootContainer;if(z){var Z=z;if(typeof L=="function"){var fe=L;L=function(){var we=Hl(Z);fe.call(we)}}Wl(s,Z,r,L)}else Z=_p(d,s,r,L,E);return Hl(Z)}bs=function(r){switch(r.tag){case 3:var s=r.stateNode;if(s.current.memoizedState.isDehydrated){var d=zs(s.pendingLanes);d!==0&&(xo(s,d|1),bi(s,mr()),(Gt&6)===0&&(Bo=mr()+500,bn()))}break;case 13:lo(function(){var E=Ks(r,1);if(E!==null){var L=ai();fs(E,r,1,L)}}),Ou(r,1)}},Fs=function(r){if(r.tag===13){var s=Ks(r,134217728);if(s!==null){var d=ai();fs(s,r,134217728,d)}Ou(r,134217728)}},Us=function(r){if(r.tag===13){var s=$n(r),d=Ks(r,s);if(d!==null){var E=ai();fs(d,r,s,E)}Ou(r,s)}},dn=function(){return Ft},qn=function(r,s){var d=Ft;try{return Ft=r,s()}finally{Ft=d}},wo=function(r,s,d){switch(s){case"input":if(ht(r,d),s=d.name,d.type==="radio"&&s!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<d.length;s++){var E=d[s];if(E!==r&&E.form===r.form){var L=pl(E);if(!L)throw Error(o(90));tt(E),ht(E,L)}}}break;case"textarea":Ms(r,d);break;case"select":s=d.value,s!=null&&Rr(r,!!d.multiple,s,!1)}},zn=Ru,Xo=lo;var jh={usingClientEntryPoint:!1,Events:[va,To,pl,Bn,Ko,Ru]},ps={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},wp={bundleType:ps.bundleType,version:ps.version,rendererPackageName:ps.rendererPackageName,rendererConfig:ps.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Yo(r),r===null?null:r.stateNode},findFiberByHostInstance:ps.findFiberByHostInstance||gp,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Da=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Da.isDisabled&&Da.supportsFiber)try{Bs=Da.inject(wp),hi=Da}catch{}}return ms.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jh,ms.createPortal=function(r,s){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bu(s))throw Error(o(200));return Im(r,s,null,d)},ms.createRoot=function(r,s){if(!Bu(r))throw Error(o(299));var d=!1,E="",L=vp;return s!=null&&(s.unstable_strictMode===!0&&(d=!0),s.identifierPrefix!==void 0&&(E=s.identifierPrefix),s.onRecoverableError!==void 0&&(L=s.onRecoverableError)),s=ju(r,1,!1,null,null,d,!1,E,L),r[Ts]=s.current,pa(r.nodeType===8?r.parentNode:r),new Nu(s)},ms.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(o(188)):(r=Object.keys(r).join(","),Error(o(268,r)));return r=Yo(s),r=r===null?null:r.stateNode,r},ms.flushSync=function(r){return lo(r)},ms.hydrate=function(r,s,d){if(!ql(s))throw Error(o(200));return Pa(null,r,s,!0,d)},ms.hydrateRoot=function(r,s,d){if(!Bu(r))throw Error(o(405));var E=d!=null&&d.hydratedSources||null,L=!1,z="",Z=vp;if(d!=null&&(d.unstable_strictMode===!0&&(L=!0),d.identifierPrefix!==void 0&&(z=d.identifierPrefix),d.onRecoverableError!==void 0&&(Z=d.onRecoverableError)),s=mp(s,null,r,1,d??null,L,!1,z,Z),r[Ts]=s.current,pa(r),E)for(r=0;r<E.length;r++)d=E[r],L=d._getVersion,L=L(d._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[d,L]:s.mutableSourceEagerHydrationData.push(d,L);return new Uo(s)},ms.render=function(r,s,d){if(!ql(s))throw Error(o(200));return Pa(null,r,s,!1,d)},ms.unmountComponentAtNode=function(r){if(!ql(r))throw Error(o(40));return r._reactRootContainer?(lo(function(){Pa(null,null,r,!1,function(){r._reactRootContainer=null,r[Ts]=null})}),!0):!1},ms.unstable_batchedUpdates=Ru,ms.unstable_renderSubtreeIntoContainer=function(r,s,d,E){if(!ql(d))throw Error(o(200));if(r==null||r._reactInternals===void 0)throw Error(o(38));return Pa(r,s,d,!1,E)},ms.version="18.3.1-next-f1338f8080-20240426",ms}var ay;function Fw(){if(ay)return Bm.exports;ay=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(i){console.error(i)}}return t(),Bm.exports=Ax(),Bm.exports}var ly;function Rx(){if(ly)return Sp;ly=1;var t=Fw();return Sp.createRoot=t.createRoot,Sp.hydrateRoot=t.hydrateRoot,Sp}var Px=Rx();const Dx=zw(Px);var X=ov();const Ln=zw(X),cy=t=>{let i;const o=new Set,a=(p,y)=>{const m=typeof p=="function"?p(i):p;if(!Object.is(m,i)){const x=i;i=y??(typeof m!="object"||m===null)?m:Object.assign({},i,m),o.forEach($=>$(i,x))}},f=()=>i,l={setState:a,getState:f,getInitialState:()=>u,subscribe:p=>(o.add(p),()=>o.delete(p))},u=i=t(a,f,l);return l},Ix=(t=>t?cy(t):cy),Mx=t=>t;function Lx(t,i=Mx){const o=Ln.useSyncExternalStore(t.subscribe,Ln.useCallback(()=>i(t.getState()),[t,i]),Ln.useCallback(()=>i(t.getInitialState()),[t,i]));return Ln.useDebugValue(o),o}const uy=t=>{const i=Ix(t),o=a=>Lx(i,a);return Object.assign(o,i),o},vf=(t=>t?uy(t):uy);function On(t){return"'"+t.replace(/'/g,"'\\''")+"'"}const Um=({sessionId:t})=>`claude --dangerously-skip-permissions --session-id ${On(t)}`,dy=({sessionId:t})=>`claude --session-id ${On(t)}`,jx=()=>"claude --resume",Uw=[{id:"sm-dangerous",label:"Session Manager (skip perms)",description:"claude --dangerously-skip-permissions in this project",category:"build",cwd:"app-cwd",command:Um},{id:"sm-safe",label:"Session Manager (safe)",description:"claude with normal permission prompts in this project",category:"build",cwd:"app-cwd",command:dy},{id:"home-dangerous",label:"Home (skip perms)",description:"claude --dangerously-skip-permissions in ~",category:"build",cwd:"home",command:Um},{id:"pick-dangerous",label:"Pick directory (skip perms)…",description:"Choose a folder, launch claude --dangerously-skip-permissions",category:"build",cwd:"pick",command:Um},{id:"pick-safe",label:"Pick directory (safe)…",description:"Choose a folder, launch claude with normal prompts",category:"build",cwd:"pick",command:dy},{id:"pick-resume",label:"Pick directory + resume…",description:"Choose a folder, then pick a past session to resume",category:"build",cwd:"pick",command:jx},{id:"pick-shell",label:"Pick directory (shell only)…",description:"Bare interactive shell, no claude auto-launch",category:"build",cwd:"pick",command:null}];let Zs=null;async function Ox(){if(Zs)return Zs;try{const t=await window.api.app.engageRulesPath();if(!t)return Zs=[],Zs;const i=await window.api.config.readJson(t);if(!i.exists||i.parseError||!i.data)return Zs=[],Zs;const o=i.data;if(!o.presets||!Array.isArray(o.presets))return Zs=[],Zs;const a=o.projectPath;return Zs=o.presets.map(f=>({id:f.id,label:f.label,description:f.description,category:"engage",cwd:a,platform:f.platform,pipeline:f.pipeline,rules:f.rules,command:()=>`cd ${On(a)} && ${f.cliEntry}`})),Zs}catch(t){return console.warn("[presets] Failed to load engage presets:",t),Zs=[],Zs}}async function Vw(t){const i=Uw.find(a=>a.id===t);return i||((await Ox()).find(a=>a.id===t)??null)}async function Nx(t){return t.cwd==="app-cwd"?window.api.app.cwd():t.cwd==="home"?window.api.app.homeDir():t.cwd==="pick"?window.api.app.pickDirectory():t.cwd}function Ww(t,i){return t.command?t.command(i):null}function Bx(t){const i=t.split("/").filter(Boolean);return i[i.length-1]||t}const zt=vf((t,i)=>({tabs:[],activeTabId:null,hydrated:!1,addTab:({id:o,cwd:a,startupCommand:f,presetId:S=null,label:v})=>{const l=o??crypto.randomUUID();if(i().tabs.find(y=>y.id===l))return t({activeTabId:l}),l;const p={id:l,claudeSessionId:l,label:v??Bx(a),cwd:a,pid:null,status:"spawning",exitCode:null,startupCommand:f,presetId:S,generation:0};return t({tabs:[...i().tabs,p],activeTabId:l}),l},setTabRunning:(o,a)=>t({tabs:i().tabs.map(f=>f.id===o?{...f,pid:a,status:"running"}:f)}),setTabExited:(o,a)=>t({tabs:i().tabs.map(f=>f.id===o?{...f,status:"exited",exitCode:a}:f)}),closeTab:o=>{var S;window.api.pty.kill(o);const a=i().tabs.filter(v=>v.id!==o),f=i().activeTabId===o?((S=a[a.length-1])==null?void 0:S.id)??null:i().activeTabId;t({tabs:a,activeTabId:f})},setActive:o=>t({activeTabId:o}),restartTab:o=>{const a=i().tabs.find(v=>v.id===o);if(!a)return;window.api.pty.kill(o);const f=crypto.randomUUID(),S=v=>{t({tabs:i().tabs.map(l=>l.id===o?{...l,claudeSessionId:f,pid:null,status:"spawning",exitCode:null,startupCommand:v,generation:l.generation+1}:l)})};a.presetId?Vw(a.presetId).then(v=>{S(v?Ww(v,{sessionId:f,cwd:a.cwd}):`claude --dangerously-skip-permissions --session-id ${On(f)}`)}):S(`claude --dangerously-skip-permissions --session-id ${On(f)}`)},reorderTab:(o,a)=>{const f=[...i().tabs];if(o<0||o>=f.length||a<0||a>=f.length||o===a)return;const[S]=f.splice(o,1);f.splice(a,0,S),t({tabs:f})},restoreTabs:(o,a)=>t({tabs:o,activeTabId:a,hydrated:!0})}));async function Hw(){var o;if(zt.getState().hydrated)return;try{const{tabs:a,activeTabId:f,freshStart:S}=await window.api.sessions.load();if(a.length>0){const v=await Promise.all(a.map(async u=>{let p=!S;if(p){const m=await window.api.transcripts.pathFor(u.cwd,u.claudeSessionId);p=await window.api.config.exists(m)}const y=p?u.claudeSessionId:crypto.randomUUID();return{id:u.id,claudeSessionId:y,cwd:u.cwd,label:u.label,presetId:u.presetId,pid:null,status:"spawning",exitCode:null,startupCommand:p?`claude --dangerously-skip-permissions --resume ${On(y)}`:`claude --dangerously-skip-permissions --session-id ${On(y)}`,generation:0}})),l=f&&v.find(u=>u.id===f)?f:((o=v[0])==null?void 0:o.id)??null;zt.getState().restoreTabs(v,l)}else zt.setState({hydrated:!0})}catch(a){console.warn("[sessions] hydrate failed:",a),zt.setState({hydrated:!0})}const t=()=>{const{tabs:a,activeTabId:f}=zt.getState(),S=a.map(v=>({id:v.id,claudeSessionId:v.claudeSessionId,cwd:v.cwd,label:v.label,presetId:v.presetId}));window.api.sessions.save({tabs:S,activeTabId:f}).catch(v=>{console.warn("[sessions] save failed:",v)})};let i=null;zt.subscribe((a,f)=>{a.hydrated&&(a.tabs===f.tabs&&a.activeTabId===f.activeTabId||(i!==null&&window.clearTimeout(i),i=window.setTimeout(t,200)))}),t()}const zx=Object.freeze(Object.defineProperty({__proto__:null,hydrateSessions:Hw,useSessions:zt},Symbol.toStringTag,{value:"Module"})),hy=200,Fx=/\x1b\[[0-9;]*m/g;function Ux(t){return t.replace(Fx,"")}const qu=vf((t,i)=>({watchers:{},initialized:!1,init:()=>{i().initialized||(t({initialized:!0}),window.api.watchers.onLine(o=>i().ingestLine(o)),window.api.watchers.onClosed(({watcherId:o})=>i().closed(o)))},add:async({tabId:o,label:a,command:f,cwd:S})=>{try{const v=await window.api.watchers.add({tabId:o,label:a,command:f,cwd:S??null}),l={watcherId:v.watcherId,tabId:v.tabId,label:v.label,command:v.command,cwd:v.cwd,pid:v.pid,startedAt:v.startedAt,lineCount:0,lines:[],lastLineAt:null};return t({watchers:{...i().watchers,[l.watcherId]:l}}),l}catch(v){return console.error("[watchers] add failed:",v),null}},remove:async o=>{try{await window.api.watchers.remove(o)}catch(f){console.error("[watchers] remove failed:",f)}const a={...i().watchers};delete a[o],t({watchers:a})},watchersForTab:o=>Object.values(i().watchers).filter(a=>a.tabId===o),ingestLine:o=>{const a=i().watchers[o.watcherId];if(!a)return;const f=Ux(o.line),S=a.lines.length>=hy?[...a.lines.slice(a.lines.length-hy+1),{line:f,ts:o.ts}]:[...a.lines,{line:f,ts:o.ts}];t({watchers:{...i().watchers,[o.watcherId]:{...a,lines:S,lineCount:a.lineCount+1,lastLineAt:o.ts}}})},closed:o=>{if(!i().watchers[o])return;const a={...i().watchers};delete a[o],t({watchers:a})}})),Vx=4,fy=40,py=6;function Wx(t){const{onReorder:i,onActivate:o}=t,a=X.useRef(null),f=X.useRef(null),S=X.useRef(0),v=X.useRef(0),[l,u]=X.useState(!1),[,p]=X.useState(0),y=X.useRef(o);y.current=o;const m=X.useCallback(()=>a.current?Array.from(a.current.querySelectorAll("[data-drag-index]")):[],[]),x=X.useCallback((g,k,w)=>{for(let C=0;C<k.length;C++){const P=k[C].left+k[C].width/2;if(g<P)return C<=w?C:C-1}return k.length-1},[]),$=X.useCallback(()=>{const g=f.current,k=a.current;if(!(g!=null&&g.active)||!k)return;const w=k.getBoundingClientRect(),C=g.startX+g.deltaX,P=C-w.left,j=w.right-C;P<fy?k.scrollLeft-=py:j<fy&&(k.scrollLeft+=py),S.current=requestAnimationFrame($)},[]);X.useEffect(()=>{const g=a.current;if(!g)return;let k=!1;const w=()=>{k||(k=!0,v.current=requestAnimationFrame(()=>{k=!1,p(j=>j+1)}))},C=j=>{var Y;const O=f.current;if(!O)return;const F=j.clientX-O.startX;if(!O.active&&Math.abs(F)<Vx)return;if(!O.active){O.active=!0,O.tabRects=m().map(se=>se.getBoundingClientRect()),u(!0);try{(Y=a.current)==null||Y.setPointerCapture(O.pointerId)}catch{}S.current=requestAnimationFrame($)}O.deltaX=F;const I=O.tabRects[O.fromIndex],U=I.left+I.width/2+F;O.currentIndex=x(U,O.tabRects,O.fromIndex),w()},P=j=>{const O=f.current;if(O&&O.pointerId===j.pointerId){cancelAnimationFrame(S.current),cancelAnimationFrame(v.current);try{g.releasePointerCapture(O.pointerId)}catch{}O.active&&O.fromIndex!==O.currentIndex?i(O.fromIndex,O.currentIndex):y.current(O.fromIndex),f.current=null,u(!1),p(F=>F+1)}};return g.addEventListener("pointermove",C),g.addEventListener("pointerup",P),g.addEventListener("pointercancel",P),()=>{g.removeEventListener("pointermove",C),g.removeEventListener("pointerup",P),g.removeEventListener("pointercancel",P),cancelAnimationFrame(S.current),cancelAnimationFrame(v.current)}},[i,m,x,$]);const D=X.useCallback((g,k)=>{g.button!==0||g.target.closest("button")||(f.current={active:!1,fromIndex:k,currentIndex:k,startX:g.clientX,deltaX:0,tabRects:[],pointerId:g.pointerId})},[]);return{getTabDragProps:X.useCallback(g=>{var C;const k=f.current,w={};if(k!=null&&k.active)if(g===k.fromIndex)w.transform=`translateX(${k.deltaX}px) scale(1.03)`,w.zIndex=10,w.opacity=.85,w.boxShadow="0 2px 8px rgba(0,0,0,0.4)",w.position="relative",w.pointerEvents="none";else{const P=k.fromIndex,j=k.currentIndex,F=(((C=k.tabRects[P])==null?void 0:C.width)??0)+4;w.transition="transform 0.15s ease",P<j&&g>P&&g<=j?w.transform=`translateX(-${F}px)`:P>j&&g>=j&&g<P?w.transform=`translateX(${F}px)`:w.transform="translateX(0)"}return{onPointerDown:P=>D(P,g),style:w,"data-drag-index":g}},[D]),isDragging:l,containerRef:a}}const Hx=3e4;function qx(){const t=zt(g=>g.tabs),i=zt(g=>g.activeTabId),o=zt(g=>g.addTab),a=zt(g=>g.closeTab),f=zt(g=>g.setActive),S=zt(g=>g.reorderTab),v=qu(g=>g.watchers),[l,u]=X.useState(null),[p,y]=X.useState(()=>Date.now());X.useEffect(()=>{const g=window.setInterval(()=>y(Date.now()),1e3);return()=>window.clearInterval(g)},[]);const m=g=>{for(const k of Object.values(v))if(k.tabId===g&&k.lastLineAt&&p-k.lastLineAt<Hx)return!0;return!1},{getTabDragProps:x,isDragging:$,containerRef:D}=Wx({tabCount:t.length,onReorder:S,onActivate:g=>{const k=t[g];k&&f(k.id)}}),T=async()=>{u(null);try{const g=await window.api.app.pickDirectory();if(!g)return;const k=crypto.randomUUID(),w=`claude --dangerously-skip-permissions --session-id ${On(k)}`;o({id:k,cwd:g,startupCommand:w,presetId:"pick-dangerous"})}catch(g){const k=g instanceof Error?g.message:String(g);u(k),console.error("[TabBar] createPickedSession failed:",g)}};return h.jsxs("div",{className:"h-9 bg-bg-elev border-b border-line flex items-center px-2 gap-1 shrink-0",children:[h.jsx("div",{ref:D,className:`flex items-center gap-1 overflow-x-auto min-w-0 flex-1 select-none ${$?"cursor-grabbing":""}`,children:t.map((g,k)=>{const w=g.id===i,C=x(k);return h.jsxs("div",{...C,style:C.style,className:`group px-3 py-1 flex items-center gap-2 rounded-t text-xs shrink-0 transition-colors ${$?"":"cursor-grab"} ${w?"bg-bg-hi text-fg font-semibold border border-b-0 border-accent border-t-2 -mb-px relative z-10":"bg-bg-elev text-fg-dim border border-line hover:text-fg hover:bg-bg"}`,title:g.cwd,"aria-current":w?"true":void 0,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${g.status==="running"?"bg-green-500":g.status==="spawning"?"bg-yellow-500 animate-pulse":"bg-fg-faint"}`}),h.jsx("span",{children:g.label}),m(g.id)&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse",title:"watcher emitted a line in the last 30s","data-testid":"tab-watcher-dot"}),h.jsx("button",{onClick:P=>{P.stopPropagation(),a(g.id)},className:"text-fg-faint opacity-0 group-hover:opacity-100 hover:text-fg ml-1",title:"Close session",children:"×"})]},g.id)})}),h.jsx("div",{className:"shrink-0",children:h.jsx("button",{onClick:T,className:"px-2 py-1 text-fg-dim hover:text-fg text-xs",title:"New session — pick a project directory",children:"+ new"})}),l&&h.jsx("div",{className:"text-red-400 text-xs px-2 shrink-0",children:l}),h.jsx("div",{className:"text-fg-faint text-xs px-2 shrink-0",children:"Claude Session Manager"})]})}const Gx="modulepreload",Kx=function(t,i){return new URL(t,i).href},my={},qw=function(i,o,a){let f=Promise.resolve();if(o&&o.length>0){let v=function(y){return Promise.all(y.map(m=>Promise.resolve(m).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const l=document.getElementsByTagName("link"),u=document.querySelector("meta[property=csp-nonce]"),p=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));f=v(o.map(y=>{if(y=Kx(y,a),y in my)return;my[y]=!0;const m=y.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(!!a)for(let T=l.length-1;T>=0;T--){const g=l[T];if(g.href===y&&(!m||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${x}`))return;const D=document.createElement("link");if(D.rel=m?"stylesheet":Gx,m||(D.as="script"),D.crossOrigin="",D.href=y,p&&D.setAttribute("nonce",p),document.head.appendChild(D),m)return new Promise((T,g)=>{D.addEventListener("load",T),D.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${y}`)))})}))}function S(v){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=v,window.dispatchEvent(l),!l.defaultPrevented)throw v}return f.then(v=>{for(const l of v||[])l.status==="rejected"&&S(l.reason);return i().catch(S)})};var Vm={},zh={},gy;function Gw(){if(gy)return zh;gy=1,Object.defineProperty(zh,"__esModule",{value:!0}),zh.baseAssetPath=void 0;const i=typeof window<"u"&&typeof window.document<"u"?window.document.currentScript:null;let o="/";return i&&(o=i.src.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^/]+$/,"/")),zh.baseAssetPath=o,zh}var Fh={},vy;function av(){if(vy)return Fh;vy=1,Object.defineProperty(Fh,"__esModule",{value:!0}),Fh.defaultModelFetcher=void 0;const t=i=>fetch(i).then(o=>o.arrayBuffer());return Fh.defaultModelFetcher=t,Fh}var Wo={},Uh={},yy;function yf(){if(yy)return Uh;yy=1,Object.defineProperty(Uh,"__esModule",{value:!0}),Uh.log=void 0;const t=i=>o=>{console.log(`VAD | ${i} >`,o)};return Uh.log={error:t("error"),debug:t("debug"),warn:t("warn")},Uh}var Vh={},_y;function vm(){if(_y)return Vh;_y=1,Object.defineProperty(Vh,"__esModule",{value:!0}),Vh.Message=void 0;var t;return(function(i){i.AudioFrame="AUDIO_FRAME",i.SpeechStart="SPEECH_START",i.VADMisfire="VAD_MISFIRE",i.SpeechEnd="SPEECH_END",i.SpeechStop="SPEECH_STOP",i.SpeechRealStart="SPEECH_REAL_START",i.FrameProcessed="FRAME_PROCESSED"})(t||(Vh.Message=t={})),Vh}var wy;function lv(){if(wy)return Wo;wy=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.FrameProcessor=Wo.validateOptions=Wo.defaultFrameProcessorOptions=void 0;const t=yf(),i=vm();Wo.defaultFrameProcessorOptions={positiveSpeechThreshold:.3,negativeSpeechThreshold:.25,preSpeechPadMs:800,redemptionMs:1400,minSpeechMs:400,submitUserSpeechOnPause:!1};function o(v){(v.positiveSpeechThreshold<0||v.positiveSpeechThreshold>1)&&t.log.error("positiveSpeechThreshold should be a number between 0 and 1"),(v.negativeSpeechThreshold<0||v.negativeSpeechThreshold>v.positiveSpeechThreshold)&&t.log.error("negativeSpeechThreshold should be between 0 and positiveSpeechThreshold"),v.preSpeechPadMs<0&&t.log.error("preSpeechPadMs should be positive"),v.redemptionMs<0&&t.log.error("redemptionMs should be positive"),v.minSpeechMs<0&&t.log.error("minSpeechMs should be positive")}Wo.validateOptions=o;const a=v=>{const l=v.reduce((p,y)=>(p.push(p.at(-1)+y.length),p),[0]),u=new Float32Array(l.at(-1));return v.forEach((p,y)=>{const m=l[y];u.set(p,m)}),u};function f(v,l){const u=Math.floor(v.redemptionMs/l),p=Math.floor(v.preSpeechPadMs/l),y=Math.floor(v.minSpeechMs/l);return{redemptionFrames:u,preSpeechPadFrames:p,minSpeechFrames:y}}class S{constructor(l,u,p,y){this.modelProcessFunc=l,this.modelResetFunc=u,this.options=p,this.msPerFrame=y,this.speaking=!1,this.redemptionCounter=0,this.speechFrameCount=0,this.active=!1,this.speechRealStartFired=!1,this.setOptions=D=>{this.options={...this.options,...D};const{redemptionFrames:T,preSpeechPadFrames:g,minSpeechFrames:k}=f(this.options,this.msPerFrame);this.redemptionFrames=T,this.preSpeechPadFrames=g,this.minSpeechFrames=k},this.reset=()=>{this.speaking=!1,this.speechRealStartFired=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0,this.speechFrameCount=0},this.pause=D=>{this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment(D):this.reset()},this.resume=()=>{this.active=!0},this.endSegment=D=>{const T=this.audioBuffer;this.audioBuffer=[];const g=this.speaking;if(this.reset(),g)if(T.reduce((w,C)=>C.isSpeech?w+1:w,0)>=this.minSpeechFrames){const w=a(T.map(C=>C.frame));D({msg:i.Message.SpeechEnd,audio:w})}else D({msg:i.Message.VADMisfire});return{}},this.process=async(D,T)=>{if(!this.active)return;const g=await this.modelProcessFunc(D),k=g.isSpeech>=this.options.positiveSpeechThreshold;if(T({probs:g,msg:i.Message.FrameProcessed,frame:D}),this.audioBuffer.push({frame:D,isSpeech:k}),k&&(this.speechFrameCount++,this.redemptionCounter=0),k&&!this.speaking&&(this.speaking=!0,T({msg:i.Message.SpeechStart})),this.speaking&&this.speechFrameCount===this.minSpeechFrames&&!this.speechRealStartFired&&(this.speechRealStartFired=!0,T({msg:i.Message.SpeechRealStart})),g.isSpeech<this.options.negativeSpeechThreshold&&this.speaking&&++this.redemptionCounter>=this.redemptionFrames){this.redemptionCounter=0,this.speechFrameCount=0,this.speaking=!1,this.speechRealStartFired=!1;const w=this.audioBuffer;if(this.audioBuffer=[],w.reduce((P,j)=>j.isSpeech?P+1:P,0)>=this.minSpeechFrames){const P=a(w.map(j=>j.frame));T({msg:i.Message.SpeechEnd,audio:P})}else T({msg:i.Message.VADMisfire})}if(!this.speaking){for(;this.audioBuffer.length>this.preSpeechPadFrames;)this.audioBuffer.shift();this.speechFrameCount=0}},this.audioBuffer=[];const{redemptionFrames:m,preSpeechPadFrames:x,minSpeechFrames:$}=f(this.options,this.msPerFrame);this.redemptionFrames=m,this.preSpeechPadFrames=x,this.minSpeechFrames=$,this.reset()}}return Wo.FrameProcessor=S,Wo}var Ho={};function tn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wm={exports:{}};/*!
|
|
41
|
+
`+z.stack}return{value:r,source:s,stack:L,digest:null}}function su(r,s,d){return{value:r,source:null,stack:d??null,digest:s??null}}function nu(r,s){try{console.error(s.value)}catch(d){setTimeout(function(){throw d})}}var Qf=typeof WeakMap=="function"?WeakMap:Map;function nh(r,s,d){d=Xs(-1,d),d.tag=3,d.payload={element:null};var E=s.value;return d.callback=function(){Ol||(Ol=!0,Eu=E),nu(r,s)},d}function oh(r,s,d){d=Xs(-1,d),d.tag=3;var E=r.type.getDerivedStateFromError;if(typeof E=="function"){var L=s.value;d.payload=function(){return E(L)},d.callback=function(){nu(r,s)}}var z=r.stateNode;return z!==null&&typeof z.componentDidCatch=="function"&&(d.callback=function(){nu(r,s),typeof E!="function"&&(Tn===null?Tn=new Set([this]):Tn.add(this));var Z=s.stack;this.componentDidCatch(s.value,{componentStack:Z!==null?Z:""})}),d}function ah(r,s,d){var E=r.pingCache;if(E===null){E=r.pingCache=new Qf;var L=new Set;E.set(s,L)}else L=E.get(s),L===void 0&&(L=new Set,E.set(s,L));L.has(d)||(L.add(d),r=up.bind(null,r,s,d),s.then(r,r))}function Zf(r){do{var s;if((s=r.tag===13)&&(s=r.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return r;r=r.return}while(r!==null);return null}function oi(r,s,d,E,L){return(r.mode&1)===0?(r===s?r.flags|=65536:(r.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(s=Xs(-1,1),s.tag=2,Sn(d,s,1))),d.lanes|=1),r):(r.flags|=65536,r.lanes=L,r)}var ep=P.ReactCurrentOwner,_i=!1;function Gr(r,s,d,E){s.child=r===null?Nc(s,null,d,E):Do(s,r.child,d,E)}function lh(r,s,d,E,L){d=d.render;var z=s.ref;return Io(s,L),E=Qc(r,s,d,E,z,L),d=Zc(),r!==null&&!_i?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~L,Ys(r,s,L)):(ur&&d&&Cr(s),s.flags|=1,Gr(r,s,E,L),s.child)}function Sa(r,s,d,E,L){if(r===null){var z=d.type;return typeof z=="function"&&!Iu(z)&&z.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(s.tag=15,s.type=z,ch(r,s,z,E,L)):(r=Ul(d.type,null,E,s,s.mode,L),r.ref=s.ref,r.return=s,s.child=r)}if(z=r.child,(r.lanes&L)===0){var Z=z.memoizedProps;if(d=d.compare,d=d!==null?d:ua,d(Z,E)&&r.ref===s.ref)return Ys(r,s,L)}return s.flags|=1,r=Rn(z,E),r.ref=s.ref,r.return=s,s.child=r}function ch(r,s,d,E,L){if(r!==null){var z=r.memoizedProps;if(ua(z,E)&&r.ref===s.ref)if(_i=!1,s.pendingProps=E=z,(r.lanes&L)!==0)(r.flags&131072)!==0&&(_i=!0);else return s.lanes=r.lanes,Ys(r,s,L)}return ou(r,s,d,E,L)}function uh(r,s,d){var E=s.pendingProps,L=E.children,z=r!==null?r.memoizedState:null;if(E.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ir(No,Pi),Pi|=d;else{if((d&1073741824)===0)return r=z!==null?z.baseLanes|d:d,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:r,cachePool:null,transitions:null},s.updateQueue=null,ir(No,Pi),Pi|=r,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},E=z!==null?z.baseLanes:d,ir(No,Pi),Pi|=E}else z!==null?(E=z.baseLanes|d,s.memoizedState=null):E=d,ir(No,Pi),Pi|=E;return Gr(r,s,L,d),s.child}function dh(r,s){var d=s.ref;(r===null&&d!==null||r!==null&&r.ref!==d)&&(s.flags|=512,s.flags|=2097152)}function ou(r,s,d,E,L){var z=pi(d)?Jn:si.current;return z=ni(s,z),Io(s,L),d=Qc(r,s,d,E,z,L),E=Zc(),r!==null&&!_i?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~L,Ys(r,s,L)):(ur&&E&&Cr(s),s.flags|=1,Gr(r,s,d,L),s.child)}function hh(r,s,d,E,L){if(pi(d)){var z=!0;gl(s)}else z=!1;if(Io(s,L),s.stateNode===null)Pl(r,s),ih(s,d,E),iu(s,d,E,L),E=!0;else if(r===null){var Z=s.stateNode,fe=s.memoizedProps;Z.props=fe;var we=Z.context,Le=d.contextType;typeof Le=="object"&&Le!==null?Le=qi(Le):(Le=pi(d)?Jn:si.current,Le=ni(s,Le));var Xe=d.getDerivedStateFromProps,Je=typeof Xe=="function"||typeof Z.getSnapshotBeforeUpdate=="function";Je||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(fe!==E||we!==Le)&&sh(s,Z,E,Le),$s=!1;var Ke=s.memoizedState;Z.state=Ke,kl(s,E,Z,L),we=s.memoizedState,fe!==E||Ke!==we||fi.current||$s?(typeof Xe=="function"&&(Rs(s,d,Xe,E),we=s.memoizedState),(fe=$s||no(s,d,fe,E,Ke,we,Le))?(Je||typeof Z.UNSAFE_componentWillMount!="function"&&typeof Z.componentWillMount!="function"||(typeof Z.componentWillMount=="function"&&Z.componentWillMount(),typeof Z.UNSAFE_componentWillMount=="function"&&Z.UNSAFE_componentWillMount()),typeof Z.componentDidMount=="function"&&(s.flags|=4194308)):(typeof Z.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=E,s.memoizedState=we),Z.props=E,Z.state=we,Z.context=Le,E=fe):(typeof Z.componentDidMount=="function"&&(s.flags|=4194308),E=!1)}else{Z=s.stateNode,Vc(r,s),fe=s.memoizedProps,Le=s.type===s.elementType?fe:Tr(s.type,fe),Z.props=Le,Je=s.pendingProps,Ke=Z.context,we=d.contextType,typeof we=="object"&&we!==null?we=qi(we):(we=pi(d)?Jn:si.current,we=ni(s,we));var at=d.getDerivedStateFromProps;(Xe=typeof at=="function"||typeof Z.getSnapshotBeforeUpdate=="function")||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(fe!==Je||Ke!==we)&&sh(s,Z,E,we),$s=!1,Ke=s.memoizedState,Z.state=Ke,kl(s,E,Z,L);var dt=s.memoizedState;fe!==Je||Ke!==dt||fi.current||$s?(typeof at=="function"&&(Rs(s,d,at,E),dt=s.memoizedState),(Le=$s||no(s,d,Le,E,Ke,dt,we)||!1)?(Xe||typeof Z.UNSAFE_componentWillUpdate!="function"&&typeof Z.componentWillUpdate!="function"||(typeof Z.componentWillUpdate=="function"&&Z.componentWillUpdate(E,dt,we),typeof Z.UNSAFE_componentWillUpdate=="function"&&Z.UNSAFE_componentWillUpdate(E,dt,we)),typeof Z.componentDidUpdate=="function"&&(s.flags|=4),typeof Z.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof Z.componentDidUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=1024),s.memoizedProps=E,s.memoizedState=dt),Z.props=E,Z.state=dt,Z.context=we,E=Le):(typeof Z.componentDidUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||fe===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=1024),E=!1)}return au(r,s,d,E,z,L)}function au(r,s,d,E,L,z){dh(r,s);var Z=(s.flags&128)!==0;if(!E&&!Z)return L&&Pd(s,d,!1),Ys(r,s,z);E=s.stateNode,ep.current=s;var fe=Z&&typeof d.getDerivedStateFromError!="function"?null:E.render();return s.flags|=1,r!==null&&Z?(s.child=Do(s,r.child,null,z),s.child=Do(s,null,fe,z)):Gr(r,s,fe,z),s.memoizedState=E.state,L&&Pd(s,d,!0),s.child}function lu(r){var s=r.stateNode;s.pendingContext?Ad(r,s.pendingContext,s.pendingContext!==s.context):s.context&&Ad(r,s.context,!1),Wc(r,s.containerInfo)}function fh(r,s,d,E,L){return Qn(),jc(L),s.flags|=256,Gr(r,s,d,E),s.child}var cu={dehydrated:null,treeContext:null,retryLane:0};function uu(r){return{baseLanes:r,cachePool:null,transitions:null}}function ph(r,s,d){var E=s.pendingProps,L=gr.current,z=!1,Z=(s.flags&128)!==0,fe;if((fe=Z)||(fe=r!==null&&r.memoizedState===null?!1:(L&2)!==0),fe?(z=!0,s.flags&=-129):(r===null||r.memoizedState!==null)&&(L|=1),ir(gr,L&1),r===null)return Mc(s),r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((s.mode&1)===0?s.lanes=1:r.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(Z=E.children,r=E.fallback,z?(E=s.mode,z=s.child,Z={mode:"hidden",children:Z},(E&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=Z):z=Vl(Z,E,0,null),r=Fo(r,E,d,null),z.return=s,r.return=s,z.sibling=r,s.child=z,s.child.memoizedState=uu(d),s.memoizedState=cu,r):ka(s,Z));if(L=r.memoizedState,L!==null&&(fe=L.dehydrated,fe!==null))return tp(r,s,Z,E,fe,L,d);if(z){z=E.fallback,Z=s.mode,L=r.child,fe=L.sibling;var we={mode:"hidden",children:E.children};return(Z&1)===0&&s.child!==L?(E=s.child,E.childLanes=0,E.pendingProps=we,s.deletions=null):(E=Rn(L,we),E.subtreeFlags=L.subtreeFlags&14680064),fe!==null?z=Rn(fe,z):(z=Fo(z,Z,d,null),z.flags|=2),z.return=s,E.return=s,E.sibling=z,s.child=E,E=z,z=s.child,Z=r.child.memoizedState,Z=Z===null?uu(d):{baseLanes:Z.baseLanes|d,cachePool:null,transitions:Z.transitions},z.memoizedState=Z,z.childLanes=r.childLanes&~d,s.memoizedState=cu,E}return z=r.child,r=z.sibling,E=Rn(z,{mode:"visible",children:E.children}),(s.mode&1)===0&&(E.lanes=d),E.return=s,E.sibling=null,r!==null&&(d=s.deletions,d===null?(s.deletions=[r],s.flags|=16):d.push(r)),s.child=E,s.memoizedState=null,E}function ka(r,s){return s=Vl({mode:"visible",children:s},r.mode,0,null),s.return=r,r.child=s}function Rl(r,s,d,E){return E!==null&&jc(E),Do(s,r.child,null,d),r=ka(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function tp(r,s,d,E,L,z,Z){if(d)return s.flags&256?(s.flags&=-257,E=su(Error(o(422))),Rl(r,s,Z,E)):s.memoizedState!==null?(s.child=r.child,s.flags|=128,null):(z=E.fallback,L=s.mode,E=Vl({mode:"visible",children:E.children},L,0,null),z=Fo(z,L,Z,null),z.flags|=2,E.return=s,z.return=s,E.sibling=z,s.child=E,(s.mode&1)!==0&&Do(s,r.child,null,Z),s.child.memoizedState=uu(Z),s.memoizedState=cu,z);if((s.mode&1)===0)return Rl(r,s,Z,null);if(L.data==="$!"){if(E=L.nextSibling&&L.nextSibling.dataset,E)var fe=E.dgst;return E=fe,z=Error(o(419)),E=su(z,E,void 0),Rl(r,s,Z,E)}if(fe=(Z&r.childLanes)!==0,_i||fe){if(E=$r,E!==null){switch(Z&-Z){case 4:L=2;break;case 16:L=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:L=32;break;case 536870912:L=268435456;break;default:L=0}L=(L&(E.suspendedLanes|Z))!==0?0:L,L!==0&&L!==z.retryLane&&(z.retryLane=L,Ks(r,L),fs(E,r,L,-1))}return Du(),E=su(Error(o(421))),Rl(r,s,Z,E)}return L.data==="$?"?(s.flags|=128,s.child=r.child,s=hp.bind(null,r),L._reactRetry=s,null):(r=z.treeContext,Ri=_n(L.nextSibling),vi=s,ur=!0,yi=null,r!==null&&(Wi[cs++]=mi,Wi[cs++]=gi,Wi[cs++]=Hi,mi=r.id,gi=r.overflow,Hi=s),s=ka(s,E.children),s.flags|=4096,s)}function mh(r,s,d){r.lanes|=s;var E=r.alternate;E!==null&&(E.lanes|=s),Ld(r.return,s,d)}function du(r,s,d,E,L){var z=r.memoizedState;z===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:E,tail:d,tailMode:L}:(z.isBackwards=s,z.rendering=null,z.renderingStartTime=0,z.last=E,z.tail=d,z.tailMode=L)}function hu(r,s,d){var E=s.pendingProps,L=E.revealOrder,z=E.tail;if(Gr(r,s,E.children,d),E=gr.current,(E&2)!==0)E=E&1|2,s.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&mh(r,d,s);else if(r.tag===19)mh(r,d,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}E&=1}if(ir(gr,E),(s.mode&1)===0)s.memoizedState=null;else switch(L){case"forwards":for(d=s.child,L=null;d!==null;)r=d.alternate,r!==null&&Cl(r)===null&&(L=d),d=d.sibling;d=L,d===null?(L=s.child,s.child=null):(L=d.sibling,d.sibling=null),du(s,!1,L,d,z);break;case"backwards":for(d=null,L=s.child,s.child=null;L!==null;){if(r=L.alternate,r!==null&&Cl(r)===null){s.child=L;break}r=L.sibling,L.sibling=d,d=L,L=r}du(s,!0,d,null,z);break;case"together":du(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Pl(r,s){(s.mode&1)===0&&r!==null&&(r.alternate=null,s.alternate=null,s.flags|=2)}function Ys(r,s,d){if(r!==null&&(s.dependencies=r.dependencies),oo|=s.lanes,(d&s.childLanes)===0)return null;if(r!==null&&s.child!==r.child)throw Error(o(153));if(s.child!==null){for(r=s.child,d=Rn(r,r.pendingProps),s.child=d,d.return=s;r.sibling!==null;)r=r.sibling,d=d.sibling=Rn(r,r.pendingProps),d.return=s;d.sibling=null}return s.child}function Am(r,s,d){switch(s.tag){case 3:lu(s),Qn();break;case 5:jd(s);break;case 1:pi(s.type)&&gl(s);break;case 4:Wc(s,s.stateNode.containerInfo);break;case 10:var E=s.type._context,L=s.memoizedProps.value;ir(Zn,E._currentValue),E._currentValue=L;break;case 13:if(E=s.memoizedState,E!==null)return E.dehydrated!==null?(ir(gr,gr.current&1),s.flags|=128,null):(d&s.child.childLanes)!==0?ph(r,s,d):(ir(gr,gr.current&1),r=Ys(r,s,d),r!==null?r.sibling:null);ir(gr,gr.current&1);break;case 19:if(E=(d&s.childLanes)!==0,(r.flags&128)!==0){if(E)return hu(r,s,d);s.flags|=128}if(L=s.memoizedState,L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),ir(gr,gr.current),E)break;return null;case 22:case 23:return s.lanes=0,uh(r,s,d)}return Ys(r,s,d)}var fu,pu,gh,vh;fu=function(r,s){for(var d=s.child;d!==null;){if(d.tag===5||d.tag===6)r.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===s)break;for(;d.sibling===null;){if(d.return===null||d.return===s)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},pu=function(){},gh=function(r,s,d,E){var L=r.memoizedProps;if(L!==E){r=s.stateNode,to(As.current);var z=null;switch(d){case"input":L=jt(r,L),E=jt(r,E),z=[];break;case"select":L=re({},L,{value:void 0}),E=re({},E,{value:void 0}),z=[];break;case"textarea":L=Is(r,L),E=Is(r,E),z=[];break;default:typeof L.onClick!="function"&&typeof E.onClick=="function"&&(r.onclick=fl)}_o(d,E);var Z;d=null;for(Le in L)if(!E.hasOwnProperty(Le)&&L.hasOwnProperty(Le)&&L[Le]!=null)if(Le==="style"){var fe=L[Le];for(Z in fe)fe.hasOwnProperty(Z)&&(d||(d={}),d[Z]="")}else Le!=="dangerouslySetInnerHTML"&&Le!=="children"&&Le!=="suppressContentEditableWarning"&&Le!=="suppressHydrationWarning"&&Le!=="autoFocus"&&(f.hasOwnProperty(Le)?z||(z=[]):(z=z||[]).push(Le,null));for(Le in E){var we=E[Le];if(fe=L!=null?L[Le]:void 0,E.hasOwnProperty(Le)&&we!==fe&&(we!=null||fe!=null))if(Le==="style")if(fe){for(Z in fe)!fe.hasOwnProperty(Z)||we&&we.hasOwnProperty(Z)||(d||(d={}),d[Z]="");for(Z in we)we.hasOwnProperty(Z)&&fe[Z]!==we[Z]&&(d||(d={}),d[Z]=we[Z])}else d||(z||(z=[]),z.push(Le,d)),d=we;else Le==="dangerouslySetInnerHTML"?(we=we?we.__html:void 0,fe=fe?fe.__html:void 0,we!=null&&fe!==we&&(z=z||[]).push(Le,we)):Le==="children"?typeof we!="string"&&typeof we!="number"||(z=z||[]).push(Le,""+we):Le!=="suppressContentEditableWarning"&&Le!=="suppressHydrationWarning"&&(f.hasOwnProperty(Le)?(we!=null&&Le==="onScroll"&&nr("scroll",r),z||fe===we||(z=[])):(z=z||[]).push(Le,we))}d&&(z=z||[]).push("style",d);var Le=z;(s.updateQueue=Le)&&(s.flags|=4)}},vh=function(r,s,d,E){d!==E&&(s.flags|=4)};function Dl(r,s){if(!ur)switch(r.tailMode){case"hidden":s=r.tail;for(var d=null;s!==null;)s.alternate!==null&&(d=s),s=s.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var E=null;d!==null;)d.alternate!==null&&(E=d),d=d.sibling;E===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:E.sibling=null}}function Kr(r){var s=r.alternate!==null&&r.alternate.child===r.child,d=0,E=0;if(s)for(var L=r.child;L!==null;)d|=L.lanes|L.childLanes,E|=L.subtreeFlags&14680064,E|=L.flags&14680064,L.return=r,L=L.sibling;else for(L=r.child;L!==null;)d|=L.lanes|L.childLanes,E|=L.subtreeFlags,E|=L.flags,L.return=r,L=L.sibling;return r.subtreeFlags|=E,r.childLanes=d,s}function rp(r,s,d){var E=s.pendingProps;switch(Rc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kr(s),null;case 1:return pi(s.type)&&ml(),Kr(s),null;case 3:return E=s.stateNode,ro(),or(fi),or(si),Gc(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(r===null||r.child===null)&&(ya(s)?s.flags|=4:r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,yi!==null&&(Au(yi),yi=null))),pu(r,s),Kr(s),null;case 5:Hc(s);var L=to(Lo.current);if(d=s.type,r!==null&&s.stateNode!=null)gh(r,s,d,E,L),r.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!E){if(s.stateNode===null)throw Error(o(166));return Kr(s),null}if(r=to(As.current),ya(s)){E=s.stateNode,d=s.type;var z=s.memoizedProps;switch(E[Es]=s,E[ga]=z,r=(s.mode&1)!==0,d){case"dialog":nr("cancel",E),nr("close",E);break;case"iframe":case"object":case"embed":nr("load",E);break;case"video":case"audio":for(L=0;L<fa.length;L++)nr(fa[L],E);break;case"source":nr("error",E);break;case"img":case"image":case"link":nr("error",E),nr("load",E);break;case"details":nr("toggle",E);break;case"input":$t(E,z),nr("invalid",E);break;case"select":E._wrapperState={wasMultiple:!!z.multiple},nr("invalid",E);break;case"textarea":Fr(E,z),nr("invalid",E)}_o(d,z),L=null;for(var Z in z)if(z.hasOwnProperty(Z)){var fe=z[Z];Z==="children"?typeof fe=="string"?E.textContent!==fe&&(z.suppressHydrationWarning!==!0&&hl(E.textContent,fe,r),L=["children",fe]):typeof fe=="number"&&E.textContent!==""+fe&&(z.suppressHydrationWarning!==!0&&hl(E.textContent,fe,r),L=["children",""+fe]):f.hasOwnProperty(Z)&&fe!=null&&Z==="onScroll"&&nr("scroll",E)}switch(d){case"input":Ze(E),Ei(E,z,!0);break;case"textarea":Ze(E),ui(E);break;case"select":case"option":break;default:typeof z.onClick=="function"&&(E.onclick=fl)}E=L,s.updateQueue=E,E!==null&&(s.flags|=4)}else{Z=L.nodeType===9?L:L.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Ls(d)),r==="http://www.w3.org/1999/xhtml"?d==="script"?(r=Z.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof E.is=="string"?r=Z.createElement(d,{is:E.is}):(r=Z.createElement(d),d==="select"&&(Z=r,E.multiple?Z.multiple=!0:E.size&&(Z.size=E.size))):r=Z.createElementNS(r,d),r[Es]=s,r[ga]=E,fu(r,s,!1,!1),s.stateNode=r;e:{switch(Z=er(d,E),d){case"dialog":nr("cancel",r),nr("close",r),L=E;break;case"iframe":case"object":case"embed":nr("load",r),L=E;break;case"video":case"audio":for(L=0;L<fa.length;L++)nr(fa[L],r);L=E;break;case"source":nr("error",r),L=E;break;case"img":case"image":case"link":nr("error",r),nr("load",r),L=E;break;case"details":nr("toggle",r),L=E;break;case"input":$t(r,E),L=jt(r,E),nr("invalid",r);break;case"option":L=E;break;case"select":r._wrapperState={wasMultiple:!!E.multiple},L=re({},E,{value:void 0}),nr("invalid",r);break;case"textarea":Fr(r,E),L=Is(r,E),nr("invalid",r);break;default:L=E}_o(d,L),fe=L;for(z in fe)if(fe.hasOwnProperty(z)){var we=fe[z];z==="style"?oc(r,we):z==="dangerouslySetInnerHTML"?(we=we?we.__html:void 0,we!=null&&Mi(r,we)):z==="children"?typeof we=="string"?(d!=="textarea"||we!=="")&&Or(r,we):typeof we=="number"&&Or(r,""+we):z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&z!=="autoFocus"&&(f.hasOwnProperty(z)?we!=null&&z==="onScroll"&&nr("scroll",r):we!=null&&C(r,z,we,Z))}switch(d){case"input":Ze(r),Ei(r,E,!1);break;case"textarea":Ze(r),ui(r);break;case"option":E.value!=null&&r.setAttribute("value",""+J(E.value));break;case"select":r.multiple=!!E.multiple,z=E.value,z!=null?Rr(r,!!E.multiple,z,!1):E.defaultValue!=null&&Rr(r,!!E.multiple,E.defaultValue,!0);break;default:typeof L.onClick=="function"&&(r.onclick=fl)}switch(d){case"button":case"input":case"select":case"textarea":E=!!E.autoFocus;break e;case"img":E=!0;break e;default:E=!1}}E&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Kr(s),null;case 6:if(r&&s.stateNode!=null)vh(r,s,r.memoizedProps,E);else{if(typeof E!="string"&&s.stateNode===null)throw Error(o(166));if(d=to(Lo.current),to(As.current),ya(s)){if(E=s.stateNode,d=s.memoizedProps,E[Es]=s,(z=E.nodeValue!==d)&&(r=vi,r!==null))switch(r.tag){case 3:hl(E.nodeValue,d,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&hl(E.nodeValue,d,(r.mode&1)!==0)}z&&(s.flags|=4)}else E=(d.nodeType===9?d:d.ownerDocument).createTextNode(E),E[Es]=s,s.stateNode=E}return Kr(s),null;case 13:if(or(gr),E=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(ur&&Ri!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Id(),Qn(),s.flags|=98560,z=!1;else if(z=ya(s),E!==null&&E.dehydrated!==null){if(r===null){if(!z)throw Error(o(318));if(z=s.memoizedState,z=z!==null?z.dehydrated:null,!z)throw Error(o(317));z[Es]=s}else Qn(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Kr(s),z=!1}else yi!==null&&(Au(yi),yi=null),z=!0;if(!z)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=d,s):(E=E!==null,E!==(r!==null&&r.memoizedState!==null)&&E&&(s.child.flags|=8192,(s.mode&1)!==0&&(r===null||(gr.current&1)!==0?Mr===0&&(Mr=3):Du())),s.updateQueue!==null&&(s.flags|=4),Kr(s),null);case 4:return ro(),pu(r,s),r===null&&pa(s.stateNode.containerInfo),Kr(s),null;case 10:return Fc(s.type._context),Kr(s),null;case 17:return pi(s.type)&&ml(),Kr(s),null;case 19:if(or(gr),z=s.memoizedState,z===null)return Kr(s),null;if(E=(s.flags&128)!==0,Z=z.rendering,Z===null)if(E)Dl(z,!1);else{if(Mr!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(Z=Cl(r),Z!==null){for(s.flags|=128,Dl(z,!1),E=Z.updateQueue,E!==null&&(s.updateQueue=E,s.flags|=4),s.subtreeFlags=0,E=d,d=s.child;d!==null;)z=d,r=E,z.flags&=14680066,Z=z.alternate,Z===null?(z.childLanes=0,z.lanes=r,z.child=null,z.subtreeFlags=0,z.memoizedProps=null,z.memoizedState=null,z.updateQueue=null,z.dependencies=null,z.stateNode=null):(z.childLanes=Z.childLanes,z.lanes=Z.lanes,z.child=Z.child,z.subtreeFlags=0,z.deletions=null,z.memoizedProps=Z.memoizedProps,z.memoizedState=Z.memoizedState,z.updateQueue=Z.updateQueue,z.type=Z.type,r=Z.dependencies,z.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),d=d.sibling;return ir(gr,gr.current&1|2),s.child}r=r.sibling}z.tail!==null&&mr()>Bo&&(s.flags|=128,E=!0,Dl(z,!1),s.lanes=4194304)}else{if(!E)if(r=Cl(Z),r!==null){if(s.flags|=128,E=!0,d=r.updateQueue,d!==null&&(s.updateQueue=d,s.flags|=4),Dl(z,!0),z.tail===null&&z.tailMode==="hidden"&&!Z.alternate&&!ur)return Kr(s),null}else 2*mr()-z.renderingStartTime>Bo&&d!==1073741824&&(s.flags|=128,E=!0,Dl(z,!1),s.lanes=4194304);z.isBackwards?(Z.sibling=s.child,s.child=Z):(d=z.last,d!==null?d.sibling=Z:s.child=Z,z.last=Z)}return z.tail!==null?(s=z.tail,z.rendering=s,z.tail=s.sibling,z.renderingStartTime=mr(),s.sibling=null,d=gr.current,ir(gr,E?d&1|2:d&1),s):(Kr(s),null);case 22:case 23:return Pu(),E=s.memoizedState!==null,r!==null&&r.memoizedState!==null!==E&&(s.flags|=8192),E&&(s.mode&1)!==0?(Pi&1073741824)!==0&&(Kr(s),s.subtreeFlags&6&&(s.flags|=8192)):Kr(s),null;case 24:return null;case 25:return null}throw Error(o(156,s.tag))}function ip(r,s){switch(Rc(s),s.tag){case 1:return pi(s.type)&&ml(),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return ro(),or(fi),or(si),Gc(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return Hc(s),null;case 13:if(or(gr),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(o(340));Qn()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return or(gr),null;case 4:return ro(),null;case 10:return Fc(s.type._context),null;case 22:case 23:return Pu(),null;case 24:return null;default:return null}}var mu=!1,Xr=!1,sp=typeof WeakSet=="function"?WeakSet:Set,ut=null;function Oo(r,s){var d=r.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(E){vr(r,s,E)}else d.current=null}function gu(r,s,d){try{d()}catch(E){vr(r,s,E)}}var yh=!1;function np(r,s){if(xc=vn,r=pc(),mc(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var E=d.getSelection&&d.getSelection();if(E&&E.rangeCount!==0){d=E.anchorNode;var L=E.anchorOffset,z=E.focusNode;E=E.focusOffset;try{d.nodeType,z.nodeType}catch{d=null;break e}var Z=0,fe=-1,we=-1,Le=0,Xe=0,Je=r,Ke=null;t:for(;;){for(var at;Je!==d||L!==0&&Je.nodeType!==3||(fe=Z+L),Je!==z||E!==0&&Je.nodeType!==3||(we=Z+E),Je.nodeType===3&&(Z+=Je.nodeValue.length),(at=Je.firstChild)!==null;)Ke=Je,Je=at;for(;;){if(Je===r)break t;if(Ke===d&&++Le===L&&(fe=Z),Ke===z&&++Xe===E&&(we=Z),(at=Je.nextSibling)!==null)break;Je=Ke,Ke=Je.parentNode}Je=at}d=fe===-1||we===-1?null:{start:fe,end:we}}else d=null}d=d||{start:0,end:0}}else d=null;for(Sc={focusedElem:r,selectionRange:d},vn=!1,ut=s;ut!==null;)if(s=ut,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,ut=r;else for(;ut!==null;){s=ut;try{var dt=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(dt!==null){var ft=dt.memoizedProps,sr=dt.memoizedState,Ie=s.stateNode,Ee=Ie.getSnapshotBeforeUpdate(s.elementType===s.type?ft:Tr(s.type,ft),sr);Ie.__reactInternalSnapshotBeforeUpdate=Ee}break;case 3:var je=s.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(rt){vr(s,s.return,rt)}if(r=s.sibling,r!==null){r.return=s.return,ut=r;break}ut=s.return}return dt=yh,yh=!1,dt}function Ca(r,s,d){var E=s.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var L=E=E.next;do{if((L.tag&r)===r){var z=L.destroy;L.destroy=void 0,z!==void 0&&gu(s,d,z)}L=L.next}while(L!==E)}}function vu(r,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var d=s=s.next;do{if((d.tag&r)===r){var E=d.create;d.destroy=E()}d=d.next}while(d!==s)}}function yu(r){var s=r.ref;if(s!==null){var d=r.stateNode;switch(r.tag){case 5:r=d;break;default:r=d}typeof s=="function"?s(r):s.current=r}}function _h(r){var s=r.alternate;s!==null&&(r.alternate=null,_h(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&(delete s[Es],delete s[ga],delete s[Tc],delete s[Td],delete s[$d])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function wh(r){return r.tag===5||r.tag===3||r.tag===4}function bh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||wh(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function _u(r,s,d){var E=r.tag;if(E===5||E===6)r=r.stateNode,s?d.nodeType===8?d.parentNode.insertBefore(r,s):d.insertBefore(r,s):(d.nodeType===8?(s=d.parentNode,s.insertBefore(r,d)):(s=d,s.appendChild(r)),d=d._reactRootContainer,d!=null||s.onclick!==null||(s.onclick=fl));else if(E!==4&&(r=r.child,r!==null))for(_u(r,s,d),r=r.sibling;r!==null;)_u(r,s,d),r=r.sibling}function wu(r,s,d){var E=r.tag;if(E===5||E===6)r=r.stateNode,s?d.insertBefore(r,s):d.appendChild(r);else if(E!==4&&(r=r.child,r!==null))for(wu(r,s,d),r=r.sibling;r!==null;)wu(r,s,d),r=r.sibling}var Nr=null,ds=!1;function Cn(r,s,d){for(d=d.child;d!==null;)op(r,s,d),d=d.sibling}function op(r,s,d){if(hi&&typeof hi.onCommitFiberUnmount=="function")try{hi.onCommitFiberUnmount(Bs,d)}catch{}switch(d.tag){case 5:Xr||Oo(d,s);case 6:var E=Nr,L=ds;Nr=null,Cn(r,s,d),Nr=E,ds=L,Nr!==null&&(ds?(r=Nr,d=d.stateNode,r.nodeType===8?r.parentNode.removeChild(d):r.removeChild(d)):Nr.removeChild(d.stateNode));break;case 18:Nr!==null&&(ds?(r=Nr,d=d.stateNode,r.nodeType===8?Ec(r.parentNode,d):r.nodeType===1&&Ec(r,d),Ws(r)):Ec(Nr,d.stateNode));break;case 4:E=Nr,L=ds,Nr=d.stateNode.containerInfo,ds=!0,Cn(r,s,d),Nr=E,ds=L;break;case 0:case 11:case 14:case 15:if(!Xr&&(E=d.updateQueue,E!==null&&(E=E.lastEffect,E!==null))){L=E=E.next;do{var z=L,Z=z.destroy;z=z.tag,Z!==void 0&&((z&2)!==0||(z&4)!==0)&&gu(d,s,Z),L=L.next}while(L!==E)}Cn(r,s,d);break;case 1:if(!Xr&&(Oo(d,s),E=d.stateNode,typeof E.componentWillUnmount=="function"))try{E.props=d.memoizedProps,E.state=d.memoizedState,E.componentWillUnmount()}catch(fe){vr(d,s,fe)}Cn(r,s,d);break;case 21:Cn(r,s,d);break;case 22:d.mode&1?(Xr=(E=Xr)||d.memoizedState!==null,Cn(r,s,d),Xr=E):Cn(r,s,d);break;default:Cn(r,s,d)}}function Ea(r){var s=r.updateQueue;if(s!==null){r.updateQueue=null;var d=r.stateNode;d===null&&(d=r.stateNode=new sp),s.forEach(function(E){var L=fp.bind(null,r,E);d.has(E)||(d.add(E),E.then(L,L))})}}function Ki(r,s){var d=s.deletions;if(d!==null)for(var E=0;E<d.length;E++){var L=d[E];try{var z=r,Z=s,fe=Z;e:for(;fe!==null;){switch(fe.tag){case 5:Nr=fe.stateNode,ds=!1;break e;case 3:Nr=fe.stateNode.containerInfo,ds=!0;break e;case 4:Nr=fe.stateNode.containerInfo,ds=!0;break e}fe=fe.return}if(Nr===null)throw Error(o(160));op(z,Z,L),Nr=null,ds=!1;var we=L.alternate;we!==null&&(we.return=null),L.return=null}catch(Le){vr(L,s,Le)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)bu(s,r),s=s.sibling}function bu(r,s){var d=r.alternate,E=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Ki(s,r),hs(r),E&4){try{Ca(3,r,r.return),vu(3,r)}catch(ft){vr(r,r.return,ft)}try{Ca(5,r,r.return)}catch(ft){vr(r,r.return,ft)}}break;case 1:Ki(s,r),hs(r),E&512&&d!==null&&Oo(d,d.return);break;case 5:if(Ki(s,r),hs(r),E&512&&d!==null&&Oo(d,d.return),r.flags&32){var L=r.stateNode;try{Or(L,"")}catch(ft){vr(r,r.return,ft)}}if(E&4&&(L=r.stateNode,L!=null)){var z=r.memoizedProps,Z=d!==null?d.memoizedProps:z,fe=r.type,we=r.updateQueue;if(r.updateQueue=null,we!==null)try{fe==="input"&&z.type==="radio"&&z.name!=null&&Wt(L,z),er(fe,Z);var Le=er(fe,z);for(Z=0;Z<we.length;Z+=2){var Xe=we[Z],Je=we[Z+1];Xe==="style"?oc(L,Je):Xe==="dangerouslySetInnerHTML"?Mi(L,Je):Xe==="children"?Or(L,Je):C(L,Xe,Je,Le)}switch(fe){case"input":ht(L,z);break;case"textarea":Ms(L,z);break;case"select":var Ke=L._wrapperState.wasMultiple;L._wrapperState.wasMultiple=!!z.multiple;var at=z.value;at!=null?Rr(L,!!z.multiple,at,!1):Ke!==!!z.multiple&&(z.defaultValue!=null?Rr(L,!!z.multiple,z.defaultValue,!0):Rr(L,!!z.multiple,z.multiple?[]:"",!1))}L[ga]=z}catch(ft){vr(r,r.return,ft)}}break;case 6:if(Ki(s,r),hs(r),E&4){if(r.stateNode===null)throw Error(o(162));L=r.stateNode,z=r.memoizedProps;try{L.nodeValue=z}catch(ft){vr(r,r.return,ft)}}break;case 3:if(Ki(s,r),hs(r),E&4&&d!==null&&d.memoizedState.isDehydrated)try{Ws(s.containerInfo)}catch(ft){vr(r,r.return,ft)}break;case 4:Ki(s,r),hs(r);break;case 13:Ki(s,r),hs(r),L=r.child,L.flags&8192&&(z=L.memoizedState!==null,L.stateNode.isHidden=z,!z||L.alternate!==null&&L.alternate.memoizedState!==null||(Cu=mr())),E&4&&Ea(r);break;case 22:if(Xe=d!==null&&d.memoizedState!==null,r.mode&1?(Xr=(Le=Xr)||Xe,Ki(s,r),Xr=Le):Ki(s,r),hs(r),E&8192){if(Le=r.memoizedState!==null,(r.stateNode.isHidden=Le)&&!Xe&&(r.mode&1)!==0)for(ut=r,Xe=r.child;Xe!==null;){for(Je=ut=Xe;ut!==null;){switch(Ke=ut,at=Ke.child,Ke.tag){case 0:case 11:case 14:case 15:Ca(4,Ke,Ke.return);break;case 1:Oo(Ke,Ke.return);var dt=Ke.stateNode;if(typeof dt.componentWillUnmount=="function"){E=Ke,d=Ke.return;try{s=E,dt.props=s.memoizedProps,dt.state=s.memoizedState,dt.componentWillUnmount()}catch(ft){vr(E,d,ft)}}break;case 5:Oo(Ke,Ke.return);break;case 22:if(Ke.memoizedState!==null){xu(Je);continue}}at!==null?(at.return=Ke,ut=at):xu(Je)}Xe=Xe.sibling}e:for(Xe=null,Je=r;;){if(Je.tag===5){if(Xe===null){Xe=Je;try{L=Je.stateNode,Le?(z=L.style,typeof z.setProperty=="function"?z.setProperty("display","none","important"):z.display="none"):(fe=Je.stateNode,we=Je.memoizedProps.style,Z=we!=null&&we.hasOwnProperty("display")?we.display:null,fe.style.display=Nn("display",Z))}catch(ft){vr(r,r.return,ft)}}}else if(Je.tag===6){if(Xe===null)try{Je.stateNode.nodeValue=Le?"":Je.memoizedProps}catch(ft){vr(r,r.return,ft)}}else if((Je.tag!==22&&Je.tag!==23||Je.memoizedState===null||Je===r)&&Je.child!==null){Je.child.return=Je,Je=Je.child;continue}if(Je===r)break e;for(;Je.sibling===null;){if(Je.return===null||Je.return===r)break e;Xe===Je&&(Xe=null),Je=Je.return}Xe===Je&&(Xe=null),Je.sibling.return=Je.return,Je=Je.sibling}}break;case 19:Ki(s,r),hs(r),E&4&&Ea(r);break;case 21:break;default:Ki(s,r),hs(r)}}function hs(r){var s=r.flags;if(s&2){try{e:{for(var d=r.return;d!==null;){if(wh(d)){var E=d;break e}d=d.return}throw Error(o(160))}switch(E.tag){case 5:var L=E.stateNode;E.flags&32&&(Or(L,""),E.flags&=-33);var z=bh(r);wu(r,z,L);break;case 3:case 4:var Z=E.stateNode.containerInfo,fe=bh(r);_u(r,fe,Z);break;default:throw Error(o(161))}}catch(we){vr(r,r.return,we)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function xh(r,s,d){ut=r,Sh(r)}function Sh(r,s,d){for(var E=(r.mode&1)!==0;ut!==null;){var L=ut,z=L.child;if(L.tag===22&&E){var Z=L.memoizedState!==null||mu;if(!Z){var fe=L.alternate,we=fe!==null&&fe.memoizedState!==null||Xr;fe=mu;var Le=Xr;if(mu=Z,(Xr=we)&&!Le)for(ut=L;ut!==null;)Z=ut,we=Z.child,Z.tag===22&&Z.memoizedState!==null?Su(L):we!==null?(we.return=Z,ut=we):Su(L);for(;z!==null;)ut=z,Sh(z),z=z.sibling;ut=L,mu=fe,Xr=Le}kh(r)}else(L.subtreeFlags&8772)!==0&&z!==null?(z.return=L,ut=z):kh(r)}}function kh(r){for(;ut!==null;){var s=ut;if((s.flags&8772)!==0){var d=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Xr||vu(5,s);break;case 1:var E=s.stateNode;if(s.flags&4&&!Xr)if(d===null)E.componentDidMount();else{var L=s.elementType===s.type?d.memoizedProps:Tr(s.type,d.memoizedProps);E.componentDidUpdate(L,d.memoizedState,E.__reactInternalSnapshotBeforeUpdate)}var z=s.updateQueue;z!==null&&Wf(s,z,E);break;case 3:var Z=s.updateQueue;if(Z!==null){if(d=null,s.child!==null)switch(s.child.tag){case 5:d=s.child.stateNode;break;case 1:d=s.child.stateNode}Wf(s,Z,d)}break;case 5:var fe=s.stateNode;if(d===null&&s.flags&4){d=fe;var we=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":we.autoFocus&&d.focus();break;case"img":we.src&&(d.src=we.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var Le=s.alternate;if(Le!==null){var Xe=Le.memoizedState;if(Xe!==null){var Je=Xe.dehydrated;Je!==null&&Ws(Je)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}Xr||s.flags&512&&yu(s)}catch(Ke){vr(s,s.return,Ke)}}if(s===r){ut=null;break}if(d=s.sibling,d!==null){d.return=s.return,ut=d;break}ut=s.return}}function xu(r){for(;ut!==null;){var s=ut;if(s===r){ut=null;break}var d=s.sibling;if(d!==null){d.return=s.return,ut=d;break}ut=s.return}}function Su(r){for(;ut!==null;){var s=ut;try{switch(s.tag){case 0:case 11:case 15:var d=s.return;try{vu(4,s)}catch(we){vr(s,d,we)}break;case 1:var E=s.stateNode;if(typeof E.componentDidMount=="function"){var L=s.return;try{E.componentDidMount()}catch(we){vr(s,L,we)}}var z=s.return;try{yu(s)}catch(we){vr(s,z,we)}break;case 5:var Z=s.return;try{yu(s)}catch(we){vr(s,Z,we)}}}catch(we){vr(s,s.return,we)}if(s===r){ut=null;break}var fe=s.sibling;if(fe!==null){fe.return=s.return,ut=fe;break}ut=s.return}}var ap=Math.ceil,Il=P.ReactCurrentDispatcher,Ml=P.ReactCurrentOwner,Xi=P.ReactCurrentBatchConfig,Gt=0,$r=null,xr=null,Br=0,Pi=0,No=qs(0),Mr=0,Ta=null,oo=0,Ll=0,ku=0,jl=null,wi=null,Cu=0,Bo=1/0,En=null,Ol=!1,Eu=null,Tn=null,Nl=!1,ao=null,Bl=0,$a=0,Tu=null,Aa=-1,zl=0;function ai(){return(Gt&6)!==0?mr():Aa!==-1?Aa:Aa=mr()}function $n(r){return(r.mode&1)===0?1:(Gt&2)!==0&&Br!==0?Br&-Br:Oc.transition!==null?(zl===0&&(zl=ws()),zl):(r=Ft,r!==0||(r=window.event,r=r===void 0?16:te(r.type)),r)}function fs(r,s,d,E){if(50<$a)throw $a=0,Tu=null,Error(o(185));rs(r,d,E),((Gt&2)===0||r!==$r)&&(r===$r&&((Gt&2)===0&&(Ll|=d),Mr===4&&An(r,Br)),bi(r,E),d===1&&Gt===0&&(s.mode&1)===0&&(Bo=mr()+500,vl&&bn()))}function bi(r,s){var d=r.callbackNode;Ni(r,s);var E=un(r,r===$r?Br:0);if(E===0)d!==null&&ts(d),r.callbackNode=null,r.callbackPriority=0;else if(s=E&-E,r.callbackPriority!==s){if(d!=null&&ts(d),s===1)r.tag===0?Em(Th.bind(null,r)):Dd(Th.bind(null,r)),zf(function(){(Gt&6)===0&&bn()}),d=null;else{switch(mt(E)){case 1:d=Qr;break;case 4:d=di;break;case 16:d=Ns;break;case 536870912:d=Wn;break;default:d=Ns}d=Ih(d,Ch.bind(null,r))}r.callbackPriority=s,r.callbackNode=d}}function Ch(r,s){if(Aa=-1,zl=0,(Gt&6)!==0)throw Error(o(327));var d=r.callbackNode;if(zo()&&r.callbackNode!==d)return null;var E=un(r,r===$r?Br:0);if(E===0)return null;if((E&30)!==0||(E&r.expiredLanes)!==0||s)s=Fl(r,E);else{s=E;var L=Gt;Gt|=2;var z=lp();($r!==r||Br!==s)&&(En=null,Bo=mr()+500,co(r,s));do try{Rm();break}catch(fe){$h(r,fe)}while(!0);zc(),Il.current=z,Gt=L,xr!==null?s=0:($r=null,Br=0,s=Mr)}if(s!==0){if(s===2&&(L=Hn(r),L!==0&&(E=L,s=$u(r,L))),s===1)throw d=Ta,co(r,0),An(r,E),bi(r,mr()),d;if(s===6)An(r,E);else{if(L=r.current.alternate,(E&30)===0&&!Eh(L)&&(s=Fl(r,E),s===2&&(z=Hn(r),z!==0&&(E=z,s=$u(r,z))),s===1))throw d=Ta,co(r,0),An(r,E),bi(r,mr()),d;switch(r.finishedWork=L,r.finishedLanes=E,s){case 0:case 1:throw Error(o(345));case 2:uo(r,wi,En);break;case 3:if(An(r,E),(E&130023424)===E&&(s=Cu+500-mr(),10<s)){if(un(r,0)!==0)break;if(L=r.suspendedLanes,(L&E)!==E){ai(),r.pingedLanes|=r.suspendedLanes&L;break}r.timeoutHandle=Cc(uo.bind(null,r,wi,En),s);break}uo(r,wi,En);break;case 4:if(An(r,E),(E&4194240)===E)break;for(s=r.eventTimes,L=-1;0<E;){var Z=31-Vr(E);z=1<<Z,Z=s[Z],Z>L&&(L=Z),E&=~z}if(E=L,E=mr()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*ap(E/1960))-E,10<E){r.timeoutHandle=Cc(uo.bind(null,r,wi,En),E);break}uo(r,wi,En);break;case 5:uo(r,wi,En);break;default:throw Error(o(329))}}}return bi(r,mr()),r.callbackNode===d?Ch.bind(null,r):null}function $u(r,s){var d=jl;return r.current.memoizedState.isDehydrated&&(co(r,s).flags|=256),r=Fl(r,s),r!==2&&(s=wi,wi=d,s!==null&&Au(s)),r}function Au(r){wi===null?wi=r:wi.push.apply(wi,r)}function Eh(r){for(var s=r;;){if(s.flags&16384){var d=s.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var E=0;E<d.length;E++){var L=d[E],z=L.getSnapshot;L=L.value;try{if(!ls(z(),L))return!1}catch{return!1}}}if(d=s.child,s.subtreeFlags&16384&&d!==null)d.return=s,s=d;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function An(r,s){for(s&=~ku,s&=~Ll,r.suspendedLanes|=s,r.pingedLanes&=~s,r=r.expirationTimes;0<s;){var d=31-Vr(s),E=1<<d;r[d]=-1,s&=~E}}function Th(r){if((Gt&6)!==0)throw Error(o(327));zo();var s=un(r,0);if((s&1)===0)return bi(r,mr()),null;var d=Fl(r,s);if(r.tag!==0&&d===2){var E=Hn(r);E!==0&&(s=E,d=$u(r,E))}if(d===1)throw d=Ta,co(r,0),An(r,s),bi(r,mr()),d;if(d===6)throw Error(o(345));return r.finishedWork=r.current.alternate,r.finishedLanes=s,uo(r,wi,En),bi(r,mr()),null}function Ru(r,s){var d=Gt;Gt|=1;try{return r(s)}finally{Gt=d,Gt===0&&(Bo=mr()+500,vl&&bn())}}function lo(r){ao!==null&&ao.tag===0&&(Gt&6)===0&&zo();var s=Gt;Gt|=1;var d=Xi.transition,E=Ft;try{if(Xi.transition=null,Ft=1,r)return r()}finally{Ft=E,Xi.transition=d,Gt=s,(Gt&6)===0&&bn()}}function Pu(){Pi=No.current,or(No)}function co(r,s){r.finishedWork=null,r.finishedLanes=0;var d=r.timeoutHandle;if(d!==-1&&(r.timeoutHandle=-1,Bf(d)),xr!==null)for(d=xr.return;d!==null;){var E=d;switch(Rc(E),E.tag){case 1:E=E.type.childContextTypes,E!=null&&ml();break;case 3:ro(),or(fi),or(si),Gc();break;case 5:Hc(E);break;case 4:ro();break;case 13:or(gr);break;case 19:or(gr);break;case 10:Fc(E.type._context);break;case 22:case 23:Pu()}d=d.return}if($r=r,xr=r=Rn(r.current,null),Br=Pi=s,Mr=0,Ta=null,ku=Ll=oo=0,wi=jl=null,Mo!==null){for(s=0;s<Mo.length;s++)if(d=Mo[s],E=d.interleaved,E!==null){d.interleaved=null;var L=E.next,z=d.pending;if(z!==null){var Z=z.next;z.next=L,E.next=Z}d.pending=E}Mo=null}return r}function $h(r,s){do{var d=xr;try{if(zc(),Kc.current=Al,Jc){for(var E=dr.memoizedState;E!==null;){var L=E.queue;L!==null&&(L.pending=null),E=E.next}Jc=!1}if(io=0,Ir=Er=dr=null,so=!1,kn=0,Ml.current=null,d===null||d.return===null){Mr=1,Ta=s,xr=null;break}e:{var z=r,Z=d.return,fe=d,we=s;if(s=Br,fe.flags|=32768,we!==null&&typeof we=="object"&&typeof we.then=="function"){var Le=we,Xe=fe,Je=Xe.tag;if((Xe.mode&1)===0&&(Je===0||Je===11||Je===15)){var Ke=Xe.alternate;Ke?(Xe.updateQueue=Ke.updateQueue,Xe.memoizedState=Ke.memoizedState,Xe.lanes=Ke.lanes):(Xe.updateQueue=null,Xe.memoizedState=null)}var at=Zf(Z);if(at!==null){at.flags&=-257,oi(at,Z,fe,z,s),at.mode&1&&ah(z,Le,s),s=at,we=Le;var dt=s.updateQueue;if(dt===null){var ft=new Set;ft.add(we),s.updateQueue=ft}else dt.add(we);break e}else{if((s&1)===0){ah(z,Le,s),Du();break e}we=Error(o(426))}}else if(ur&&fe.mode&1){var sr=Zf(Z);if(sr!==null){(sr.flags&65536)===0&&(sr.flags|=256),oi(sr,Z,fe,z,s),jc(jo(we,fe));break e}}z=we=jo(we,fe),Mr!==4&&(Mr=2),jl===null?jl=[z]:jl.push(z),z=Z;do{switch(z.tag){case 3:z.flags|=65536,s&=-s,z.lanes|=s;var Ie=nh(z,we,s);Vf(z,Ie);break e;case 1:fe=we;var Ee=z.type,je=z.stateNode;if((z.flags&128)===0&&(typeof Ee.getDerivedStateFromError=="function"||je!==null&&typeof je.componentDidCatch=="function"&&(Tn===null||!Tn.has(je)))){z.flags|=65536,s&=-s,z.lanes|=s;var rt=oh(z,fe,s);Vf(z,rt);break e}}z=z.return}while(z!==null)}Ra(d)}catch(_t){s=_t,xr===d&&d!==null&&(xr=d=d.return);continue}break}while(!0)}function lp(){var r=Il.current;return Il.current=Al,r===null?Al:r}function Du(){(Mr===0||Mr===3||Mr===2)&&(Mr=4),$r===null||(oo&268435455)===0&&(Ll&268435455)===0||An($r,Br)}function Fl(r,s){var d=Gt;Gt|=2;var E=lp();($r!==r||Br!==s)&&(En=null,co(r,s));do try{cp();break}catch(L){$h(r,L)}while(!0);if(zc(),Gt=d,Il.current=E,xr!==null)throw Error(o(261));return $r=null,Br=0,Mr}function cp(){for(;xr!==null;)Ah(xr)}function Rm(){for(;xr!==null&&!Ka();)Ah(xr)}function Ah(r){var s=Dh(r.alternate,r,Pi);r.memoizedProps=r.pendingProps,s===null?Ra(r):xr=s,Ml.current=null}function Ra(r){var s=r;do{var d=s.alternate;if(r=s.return,(s.flags&32768)===0){if(d=rp(d,s,Pi),d!==null){xr=d;return}}else{if(d=ip(d,s),d!==null){d.flags&=32767,xr=d;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Mr=6,xr=null;return}}if(s=s.sibling,s!==null){xr=s;return}xr=s=r}while(s!==null);Mr===0&&(Mr=5)}function uo(r,s,d){var E=Ft,L=Xi.transition;try{Xi.transition=null,Ft=1,Rh(r,s,d,E)}finally{Xi.transition=L,Ft=E}return null}function Rh(r,s,d,E){do zo();while(ao!==null);if((Gt&6)!==0)throw Error(o(327));d=r.finishedWork;var L=r.finishedLanes;if(d===null)return null;if(r.finishedWork=null,r.finishedLanes=0,d===r.current)throw Error(o(177));r.callbackNode=null,r.callbackPriority=0;var z=d.lanes|d.childLanes;if(ta(r,z),r===$r&&(xr=$r=null,Br=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Nl||(Nl=!0,Ih(Ns,function(){return zo(),null})),z=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||z){z=Xi.transition,Xi.transition=null;var Z=Ft;Ft=1;var fe=Gt;Gt|=4,Ml.current=null,np(r,d),bu(d,r),Mf(Sc),vn=!!xc,Sc=xc=null,r.current=d,xh(d),Xa(),Gt=fe,Ft=Z,Xi.transition=z}else r.current=d;if(Nl&&(Nl=!1,ao=r,Bl=L),z=r.pendingLanes,z===0&&(Tn=null),xt(d.stateNode),bi(r,mr()),s!==null)for(E=r.onRecoverableError,d=0;d<s.length;d++)L=s[d],E(L.value,{componentStack:L.stack,digest:L.digest});if(Ol)throw Ol=!1,r=Eu,Eu=null,r;return(Bl&1)!==0&&r.tag!==0&&zo(),z=r.pendingLanes,(z&1)!==0?r===Tu?$a++:($a=0,Tu=r):$a=0,bn(),null}function zo(){if(ao!==null){var r=mt(Bl),s=Xi.transition,d=Ft;try{if(Xi.transition=null,Ft=16>r?16:r,ao===null)var E=!1;else{if(r=ao,ao=null,Bl=0,(Gt&6)!==0)throw Error(o(331));var L=Gt;for(Gt|=4,ut=r.current;ut!==null;){var z=ut,Z=z.child;if((ut.flags&16)!==0){var fe=z.deletions;if(fe!==null){for(var we=0;we<fe.length;we++){var Le=fe[we];for(ut=Le;ut!==null;){var Xe=ut;switch(Xe.tag){case 0:case 11:case 15:Ca(8,Xe,z)}var Je=Xe.child;if(Je!==null)Je.return=Xe,ut=Je;else for(;ut!==null;){Xe=ut;var Ke=Xe.sibling,at=Xe.return;if(_h(Xe),Xe===Le){ut=null;break}if(Ke!==null){Ke.return=at,ut=Ke;break}ut=at}}}var dt=z.alternate;if(dt!==null){var ft=dt.child;if(ft!==null){dt.child=null;do{var sr=ft.sibling;ft.sibling=null,ft=sr}while(ft!==null)}}ut=z}}if((z.subtreeFlags&2064)!==0&&Z!==null)Z.return=z,ut=Z;else e:for(;ut!==null;){if(z=ut,(z.flags&2048)!==0)switch(z.tag){case 0:case 11:case 15:Ca(9,z,z.return)}var Ie=z.sibling;if(Ie!==null){Ie.return=z.return,ut=Ie;break e}ut=z.return}}var Ee=r.current;for(ut=Ee;ut!==null;){Z=ut;var je=Z.child;if((Z.subtreeFlags&2064)!==0&&je!==null)je.return=Z,ut=je;else e:for(Z=Ee;ut!==null;){if(fe=ut,(fe.flags&2048)!==0)try{switch(fe.tag){case 0:case 11:case 15:vu(9,fe)}}catch(_t){vr(fe,fe.return,_t)}if(fe===Z){ut=null;break e}var rt=fe.sibling;if(rt!==null){rt.return=fe.return,ut=rt;break e}ut=fe.return}}if(Gt=L,bn(),hi&&typeof hi.onPostCommitFiberRoot=="function")try{hi.onPostCommitFiberRoot(Bs,r)}catch{}E=!0}return E}finally{Ft=d,Xi.transition=s}}return!1}function Ph(r,s,d){s=jo(d,s),s=nh(r,s,1),r=Sn(r,s,1),s=ai(),r!==null&&(rs(r,1,s),bi(r,s))}function vr(r,s,d){if(r.tag===3)Ph(r,r,d);else for(;s!==null;){if(s.tag===3){Ph(s,r,d);break}else if(s.tag===1){var E=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof E.componentDidCatch=="function"&&(Tn===null||!Tn.has(E))){r=jo(d,r),r=oh(s,r,1),s=Sn(s,r,1),r=ai(),s!==null&&(rs(s,1,r),bi(s,r));break}}s=s.return}}function up(r,s,d){var E=r.pingCache;E!==null&&E.delete(s),s=ai(),r.pingedLanes|=r.suspendedLanes&d,$r===r&&(Br&d)===d&&(Mr===4||Mr===3&&(Br&130023424)===Br&&500>mr()-Cu?co(r,0):ku|=d),bi(r,s)}function dp(r,s){s===0&&((r.mode&1)===0?s=1:(s=Oi,Oi<<=1,(Oi&130023424)===0&&(Oi=4194304)));var d=ai();r=Ks(r,s),r!==null&&(rs(r,s,d),bi(r,d))}function hp(r){var s=r.memoizedState,d=0;s!==null&&(d=s.retryLane),dp(r,d)}function fp(r,s){var d=0;switch(r.tag){case 13:var E=r.stateNode,L=r.memoizedState;L!==null&&(d=L.retryLane);break;case 19:E=r.stateNode;break;default:throw Error(o(314))}E!==null&&E.delete(s),dp(r,d)}var Dh;Dh=function(r,s,d){if(r!==null)if(r.memoizedProps!==s.pendingProps||fi.current)_i=!0;else{if((r.lanes&d)===0&&(s.flags&128)===0)return _i=!1,Am(r,s,d);_i=(r.flags&131072)!==0}else _i=!1,ur&&(s.flags&1048576)!==0&&Yn(s,_l,s.index);switch(s.lanes=0,s.tag){case 2:var E=s.type;Pl(r,s),r=s.pendingProps;var L=ni(s,si.current);Io(s,d),L=Qc(null,s,E,r,L,d);var z=Zc();return s.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,pi(E)?(z=!0,gl(s)):z=!1,s.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,Sl(s),L.updater=Js,s.stateNode=L,L._reactInternals=s,iu(s,E,r,d),s=au(null,s,E,!0,z,d)):(s.tag=0,ur&&z&&Cr(s),Gr(null,s,L,d),s=s.child),s;case 16:E=s.elementType;e:{switch(Pl(r,s),r=s.pendingProps,L=E._init,E=L(E._payload),s.type=E,L=s.tag=pp(E),r=Tr(E,r),L){case 0:s=ou(null,s,E,r,d);break e;case 1:s=hh(null,s,E,r,d);break e;case 11:s=lh(null,s,E,r,d);break e;case 14:s=Sa(null,s,E,Tr(E.type,r),d);break e}throw Error(o(306,E,""))}return s;case 0:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),ou(r,s,E,L,d);case 1:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),hh(r,s,E,L,d);case 3:e:{if(lu(s),r===null)throw Error(o(387));E=s.pendingProps,z=s.memoizedState,L=z.element,Vc(r,s),kl(s,E,null,d);var Z=s.memoizedState;if(E=Z.element,z.isDehydrated)if(z={element:E,isDehydrated:!1,cache:Z.cache,pendingSuspenseBoundaries:Z.pendingSuspenseBoundaries,transitions:Z.transitions},s.updateQueue.baseState=z,s.memoizedState=z,s.flags&256){L=jo(Error(o(423)),s),s=fh(r,s,E,d,L);break e}else if(E!==L){L=jo(Error(o(424)),s),s=fh(r,s,E,d,L);break e}else for(Ri=_n(s.stateNode.containerInfo.firstChild),vi=s,ur=!0,yi=null,d=Nc(s,null,E,d),s.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Qn(),E===L){s=Ys(r,s,d);break e}Gr(r,s,E,d)}s=s.child}return s;case 5:return jd(s),r===null&&Mc(s),E=s.type,L=s.pendingProps,z=r!==null?r.memoizedProps:null,Z=L.children,kc(E,L)?Z=null:z!==null&&kc(E,z)&&(s.flags|=32),dh(r,s),Gr(r,s,Z,d),s.child;case 6:return r===null&&Mc(s),null;case 13:return ph(r,s,d);case 4:return Wc(s,s.stateNode.containerInfo),E=s.pendingProps,r===null?s.child=Do(s,null,E,d):Gr(r,s,E,d),s.child;case 11:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),lh(r,s,E,L,d);case 7:return Gr(r,s,s.pendingProps,d),s.child;case 8:return Gr(r,s,s.pendingProps.children,d),s.child;case 12:return Gr(r,s,s.pendingProps.children,d),s.child;case 10:e:{if(E=s.type._context,L=s.pendingProps,z=s.memoizedProps,Z=L.value,ir(Zn,E._currentValue),E._currentValue=Z,z!==null)if(ls(z.value,Z)){if(z.children===L.children&&!fi.current){s=Ys(r,s,d);break e}}else for(z=s.child,z!==null&&(z.return=s);z!==null;){var fe=z.dependencies;if(fe!==null){Z=z.child;for(var we=fe.firstContext;we!==null;){if(we.context===E){if(z.tag===1){we=Xs(-1,d&-d),we.tag=2;var Le=z.updateQueue;if(Le!==null){Le=Le.shared;var Xe=Le.pending;Xe===null?we.next=we:(we.next=Xe.next,Xe.next=we),Le.pending=we}}z.lanes|=d,we=z.alternate,we!==null&&(we.lanes|=d),Ld(z.return,d,s),fe.lanes|=d;break}we=we.next}}else if(z.tag===10)Z=z.type===s.type?null:z.child;else if(z.tag===18){if(Z=z.return,Z===null)throw Error(o(341));Z.lanes|=d,fe=Z.alternate,fe!==null&&(fe.lanes|=d),Ld(Z,d,s),Z=z.sibling}else Z=z.child;if(Z!==null)Z.return=z;else for(Z=z;Z!==null;){if(Z===s){Z=null;break}if(z=Z.sibling,z!==null){z.return=Z.return,Z=z;break}Z=Z.return}z=Z}Gr(r,s,L.children,d),s=s.child}return s;case 9:return L=s.type,E=s.pendingProps.children,Io(s,d),L=qi(L),E=E(L),s.flags|=1,Gr(r,s,E,d),s.child;case 14:return E=s.type,L=Tr(E,s.pendingProps),L=Tr(E.type,L),Sa(r,s,E,L,d);case 15:return ch(r,s,s.type,s.pendingProps,d);case 17:return E=s.type,L=s.pendingProps,L=s.elementType===E?L:Tr(E,L),Pl(r,s),s.tag=1,pi(E)?(r=!0,gl(s)):r=!1,Io(s,d),ih(s,E,L),iu(s,E,L,d),au(null,s,E,!0,r,d);case 19:return hu(r,s,d);case 22:return uh(r,s,d)}throw Error(o(156,s.tag))};function Ih(r,s){return Zo(r,s)}function Pm(r,s,d,E){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Di(r,s,d,E){return new Pm(r,s,d,E)}function Iu(r){return r=r.prototype,!(!r||!r.isReactComponent)}function pp(r){if(typeof r=="function")return Iu(r)?1:0;if(r!=null){if(r=r.$$typeof,r===de)return 11;if(r===ge)return 14}return 2}function Rn(r,s){var d=r.alternate;return d===null?(d=Di(r.tag,s,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=s,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&14680064,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,s=r.dependencies,d.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d}function Ul(r,s,d,E,L,z){var Z=2;if(E=r,typeof r=="function")Iu(r)&&(Z=1);else if(typeof r=="string")Z=5;else e:switch(r){case F:return Fo(d.children,L,z,s);case I:Z=8,L|=8;break;case U:return r=Di(12,d,s,L|2),r.elementType=U,r.lanes=z,r;case ie:return r=Di(13,d,s,L),r.elementType=ie,r.lanes=z,r;case ye:return r=Di(19,d,s,L),r.elementType=ye,r.lanes=z,r;case be:return Vl(d,L,z,s);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Y:Z=10;break e;case se:Z=9;break e;case de:Z=11;break e;case ge:Z=14;break e;case ke:Z=16,E=null;break e}throw Error(o(130,r==null?r:typeof r,""))}return s=Di(Z,d,s,L),s.elementType=r,s.type=E,s.lanes=z,s}function Fo(r,s,d,E){return r=Di(7,r,E,s),r.lanes=d,r}function Vl(r,s,d,E){return r=Di(22,r,E,s),r.elementType=be,r.lanes=d,r.stateNode={isHidden:!1},r}function Mu(r,s,d){return r=Di(6,r,null,s),r.lanes=d,r}function Lu(r,s,d){return s=Di(4,r.children!==null?r.children:[],r.key,s),s.lanes=d,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}function Dm(r,s,d,E,L){this.tag=s,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Be(0),this.expirationTimes=Be(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Be(0),this.identifierPrefix=E,this.onRecoverableError=L,this.mutableSourceEagerHydrationData=null}function ju(r,s,d,E,L,z,Z,fe,we){return r=new Dm(r,s,d,fe,we),s===1?(s=1,z===!0&&(s|=8)):s=0,z=Di(3,null,null,s),r.current=z,z.stateNode=r,z.memoizedState={element:E,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sl(z),r}function Im(r,s,d){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:E==null?null:""+E,children:r,containerInfo:s,implementation:d}}function Mh(r){if(!r)return wn;r=r._reactInternals;e:{if(ct(r)!==r||r.tag!==1)throw Error(o(170));var s=r;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(pi(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(o(171))}if(r.tag===1){var d=r.type;if(pi(d))return Rd(r,d,s)}return s}function mp(r,s,d,E,L,z,Z,fe,we){return r=ju(d,E,!0,r,L,z,Z,fe,we),r.context=Mh(null),d=r.current,E=ai(),L=$n(d),z=Xs(E,L),z.callback=s??null,Sn(d,z,L),r.current.lanes=L,rs(r,L,E),bi(r,E),r}function Wl(r,s,d,E){var L=s.current,z=ai(),Z=$n(L);return d=Mh(d),s.context===null?s.context=d:s.pendingContext=d,s=Xs(z,Z),s.payload={element:r},E=E===void 0?null:E,E!==null&&(s.callback=E),r=Sn(L,s,Z),r!==null&&(fs(r,L,Z,z),_a(r,L,Z)),Z}function Hl(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Lh(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<s?d:s}}function Ou(r,s){Lh(r,s),(r=r.alternate)&&Lh(r,s)}function gp(){return null}var vp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Nu(r){this._internalRoot=r}Uo.prototype.render=Nu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(o(409));Wl(r,s,null,null)},Uo.prototype.unmount=Nu.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;lo(function(){Wl(null,r,null,null)}),s[Ts]=null}};function Uo(r){this._internalRoot=r}Uo.prototype.unstable_scheduleHydration=function(r){if(r){var s=dn();r={blockedOn:null,target:r,priority:s};for(var d=0;d<is.length&&s!==0&&s<is[d].priority;d++);is.splice(d,0,r),d===0&&ra(r)}};function Bu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function ql(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function yp(){}function _p(r,s,d,E,L){if(L){if(typeof E=="function"){var z=E;E=function(){var Le=Hl(Z);z.call(Le)}}var Z=mp(s,E,r,0,null,!1,!1,"",yp);return r._reactRootContainer=Z,r[Ts]=Z.current,pa(r.nodeType===8?r.parentNode:r),lo(),Z}for(;L=r.lastChild;)r.removeChild(L);if(typeof E=="function"){var fe=E;E=function(){var Le=Hl(we);fe.call(Le)}}var we=ju(r,0,!1,null,null,!1,!1,"",yp);return r._reactRootContainer=we,r[Ts]=we.current,pa(r.nodeType===8?r.parentNode:r),lo(function(){Wl(s,we,d,E)}),we}function Pa(r,s,d,E,L){var z=d._reactRootContainer;if(z){var Z=z;if(typeof L=="function"){var fe=L;L=function(){var we=Hl(Z);fe.call(we)}}Wl(s,Z,r,L)}else Z=_p(d,s,r,L,E);return Hl(Z)}bs=function(r){switch(r.tag){case 3:var s=r.stateNode;if(s.current.memoizedState.isDehydrated){var d=zs(s.pendingLanes);d!==0&&(xo(s,d|1),bi(s,mr()),(Gt&6)===0&&(Bo=mr()+500,bn()))}break;case 13:lo(function(){var E=Ks(r,1);if(E!==null){var L=ai();fs(E,r,1,L)}}),Ou(r,1)}},Fs=function(r){if(r.tag===13){var s=Ks(r,134217728);if(s!==null){var d=ai();fs(s,r,134217728,d)}Ou(r,134217728)}},Us=function(r){if(r.tag===13){var s=$n(r),d=Ks(r,s);if(d!==null){var E=ai();fs(d,r,s,E)}Ou(r,s)}},dn=function(){return Ft},qn=function(r,s){var d=Ft;try{return Ft=r,s()}finally{Ft=d}},wo=function(r,s,d){switch(s){case"input":if(ht(r,d),s=d.name,d.type==="radio"&&s!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<d.length;s++){var E=d[s];if(E!==r&&E.form===r.form){var L=pl(E);if(!L)throw Error(o(90));tt(E),ht(E,L)}}}break;case"textarea":Ms(r,d);break;case"select":s=d.value,s!=null&&Rr(r,!!d.multiple,s,!1)}},zn=Ru,Xo=lo;var jh={usingClientEntryPoint:!1,Events:[va,To,pl,Bn,Ko,Ru]},ps={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},wp={bundleType:ps.bundleType,version:ps.version,rendererPackageName:ps.rendererPackageName,rendererConfig:ps.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Yo(r),r===null?null:r.stateNode},findFiberByHostInstance:ps.findFiberByHostInstance||gp,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Da=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Da.isDisabled&&Da.supportsFiber)try{Bs=Da.inject(wp),hi=Da}catch{}}return ms.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jh,ms.createPortal=function(r,s){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bu(s))throw Error(o(200));return Im(r,s,null,d)},ms.createRoot=function(r,s){if(!Bu(r))throw Error(o(299));var d=!1,E="",L=vp;return s!=null&&(s.unstable_strictMode===!0&&(d=!0),s.identifierPrefix!==void 0&&(E=s.identifierPrefix),s.onRecoverableError!==void 0&&(L=s.onRecoverableError)),s=ju(r,1,!1,null,null,d,!1,E,L),r[Ts]=s.current,pa(r.nodeType===8?r.parentNode:r),new Nu(s)},ms.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(o(188)):(r=Object.keys(r).join(","),Error(o(268,r)));return r=Yo(s),r=r===null?null:r.stateNode,r},ms.flushSync=function(r){return lo(r)},ms.hydrate=function(r,s,d){if(!ql(s))throw Error(o(200));return Pa(null,r,s,!0,d)},ms.hydrateRoot=function(r,s,d){if(!Bu(r))throw Error(o(405));var E=d!=null&&d.hydratedSources||null,L=!1,z="",Z=vp;if(d!=null&&(d.unstable_strictMode===!0&&(L=!0),d.identifierPrefix!==void 0&&(z=d.identifierPrefix),d.onRecoverableError!==void 0&&(Z=d.onRecoverableError)),s=mp(s,null,r,1,d??null,L,!1,z,Z),r[Ts]=s.current,pa(r),E)for(r=0;r<E.length;r++)d=E[r],L=d._getVersion,L=L(d._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[d,L]:s.mutableSourceEagerHydrationData.push(d,L);return new Uo(s)},ms.render=function(r,s,d){if(!ql(s))throw Error(o(200));return Pa(null,r,s,!1,d)},ms.unmountComponentAtNode=function(r){if(!ql(r))throw Error(o(40));return r._reactRootContainer?(lo(function(){Pa(null,null,r,!1,function(){r._reactRootContainer=null,r[Ts]=null})}),!0):!1},ms.unstable_batchedUpdates=Ru,ms.unstable_renderSubtreeIntoContainer=function(r,s,d,E){if(!ql(d))throw Error(o(200));if(r==null||r._reactInternals===void 0)throw Error(o(38));return Pa(r,s,d,!1,E)},ms.version="18.3.1-next-f1338f8080-20240426",ms}var ay;function Fw(){if(ay)return Bm.exports;ay=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(i){console.error(i)}}return t(),Bm.exports=Ax(),Bm.exports}var ly;function Rx(){if(ly)return Sp;ly=1;var t=Fw();return Sp.createRoot=t.createRoot,Sp.hydrateRoot=t.hydrateRoot,Sp}var Px=Rx();const Dx=zw(Px);var X=ov();const Ln=zw(X),cy=t=>{let i;const o=new Set,a=(p,y)=>{const m=typeof p=="function"?p(i):p;if(!Object.is(m,i)){const x=i;i=y??(typeof m!="object"||m===null)?m:Object.assign({},i,m),o.forEach($=>$(i,x))}},f=()=>i,l={setState:a,getState:f,getInitialState:()=>u,subscribe:p=>(o.add(p),()=>o.delete(p))},u=i=t(a,f,l);return l},Ix=(t=>t?cy(t):cy),Mx=t=>t;function Lx(t,i=Mx){const o=Ln.useSyncExternalStore(t.subscribe,Ln.useCallback(()=>i(t.getState()),[t,i]),Ln.useCallback(()=>i(t.getInitialState()),[t,i]));return Ln.useDebugValue(o),o}const uy=t=>{const i=Ix(t),o=a=>Lx(i,a);return Object.assign(o,i),o},vf=(t=>t?uy(t):uy);function On(t){return"'"+t.replace(/'/g,"'\\''")+"'"}const Um=({sessionId:t})=>`claude --dangerously-skip-permissions --session-id ${On(t)}`,dy=({sessionId:t})=>`claude --session-id ${On(t)}`,jx=()=>"claude --resume",Uw=[{id:"sm-dangerous",label:"Session Manager (skip perms)",description:"claude --dangerously-skip-permissions in this project",category:"build",cwd:"app-cwd",command:Um},{id:"sm-safe",label:"Session Manager (safe)",description:"claude with normal permission prompts in this project",category:"build",cwd:"app-cwd",command:dy},{id:"home-dangerous",label:"Home (skip perms)",description:"claude --dangerously-skip-permissions in ~",category:"build",cwd:"home",command:Um},{id:"pick-dangerous",label:"Pick directory (skip perms)…",description:"Choose a folder, launch claude --dangerously-skip-permissions",category:"build",cwd:"pick",command:Um},{id:"pick-safe",label:"Pick directory (safe)…",description:"Choose a folder, launch claude with normal prompts",category:"build",cwd:"pick",command:dy},{id:"pick-resume",label:"Pick directory + resume…",description:"Choose a folder, then pick a past session to resume",category:"build",cwd:"pick",command:jx},{id:"pick-shell",label:"Pick directory (shell only)…",description:"Bare interactive shell, no claude auto-launch",category:"build",cwd:"pick",command:null}];let Zs=null;async function Ox(){if(Zs)return Zs;try{const t=await window.api.app.engageRulesPath();if(!t)return Zs=[],Zs;const i=await window.api.config.readJson(t);if(!i.exists||i.parseError||!i.data)return Zs=[],Zs;const o=i.data;if(!o.presets||!Array.isArray(o.presets))return Zs=[],Zs;const a=o.projectPath;return Zs=o.presets.map(f=>({id:f.id,label:f.label,description:f.description,category:"engage",cwd:a,platform:f.platform,pipeline:f.pipeline,rules:f.rules,command:()=>`cd ${On(a)} && ${f.cliEntry}`})),Zs}catch(t){return console.warn("[presets] Failed to load engage presets:",t),Zs=[],Zs}}async function Vw(t){const i=Uw.find(a=>a.id===t);return i||((await Ox()).find(a=>a.id===t)??null)}async function Nx(t){return t.cwd==="app-cwd"?window.api.app.cwd():t.cwd==="home"?window.api.app.homeDir():t.cwd==="pick"?window.api.app.pickDirectory():t.cwd}function Ww(t,i){return t.command?t.command(i):null}function Bx(t){const i=t.split("/").filter(Boolean);return i[i.length-1]||t}const zt=vf((t,i)=>({tabs:[],activeTabId:null,hydrated:!1,addTab:({id:o,cwd:a,startupCommand:f,presetId:S=null,label:v})=>{const l=o??crypto.randomUUID();if(i().tabs.find(y=>y.id===l))return t({activeTabId:l}),l;const p={id:l,claudeSessionId:l,label:v??Bx(a),cwd:a,pid:null,status:"spawning",exitCode:null,startupCommand:f,presetId:S,generation:0};return t({tabs:[...i().tabs,p],activeTabId:l}),l},setTabRunning:(o,a)=>t({tabs:i().tabs.map(f=>f.id===o?{...f,pid:a,status:"running"}:f)}),setTabExited:(o,a)=>t({tabs:i().tabs.map(f=>f.id===o?{...f,status:"exited",exitCode:a}:f)}),closeTab:o=>{var S;window.api.pty.kill(o);const a=i().tabs.filter(v=>v.id!==o),f=i().activeTabId===o?((S=a[a.length-1])==null?void 0:S.id)??null:i().activeTabId;t({tabs:a,activeTabId:f})},setActive:o=>t({activeTabId:o}),restartTab:o=>{const a=i().tabs.find(v=>v.id===o);if(!a)return;window.api.pty.kill(o);const f=crypto.randomUUID(),S=v=>{t({tabs:i().tabs.map(l=>l.id===o?{...l,claudeSessionId:f,pid:null,status:"spawning",exitCode:null,startupCommand:v,generation:l.generation+1}:l)})};a.presetId?Vw(a.presetId).then(v=>{S(v?Ww(v,{sessionId:f,cwd:a.cwd}):`claude --dangerously-skip-permissions --session-id ${On(f)}`)}):S(`claude --dangerously-skip-permissions --session-id ${On(f)}`)},reorderTab:(o,a)=>{const f=[...i().tabs];if(o<0||o>=f.length||a<0||a>=f.length||o===a)return;const[S]=f.splice(o,1);f.splice(a,0,S),t({tabs:f})},restoreTabs:(o,a)=>t({tabs:o,activeTabId:a,hydrated:!0})}));async function Hw(){var o;if(zt.getState().hydrated)return;try{const{tabs:a,activeTabId:f,freshStart:S}=await window.api.sessions.load();if(a.length>0){const v=await Promise.all(a.map(async u=>{let p=!S;if(p){const m=await window.api.transcripts.pathFor(u.cwd,u.claudeSessionId);p=await window.api.config.exists(m)}const y=p?u.claudeSessionId:crypto.randomUUID();return{id:u.id,claudeSessionId:y,cwd:u.cwd,label:u.label,presetId:u.presetId,pid:null,status:"spawning",exitCode:null,startupCommand:p?`claude --dangerously-skip-permissions --resume ${On(y)}`:`claude --dangerously-skip-permissions --session-id ${On(y)}`,generation:0}})),l=f&&v.find(u=>u.id===f)?f:((o=v[0])==null?void 0:o.id)??null;zt.getState().restoreTabs(v,l)}else zt.setState({hydrated:!0})}catch(a){console.warn("[sessions] hydrate failed:",a),zt.setState({hydrated:!0})}const t=()=>{const{tabs:a,activeTabId:f}=zt.getState(),S=a.map(v=>({id:v.id,claudeSessionId:v.claudeSessionId,cwd:v.cwd,label:v.label,presetId:v.presetId}));window.api.sessions.save({tabs:S,activeTabId:f}).catch(v=>{console.warn("[sessions] save failed:",v)})};let i=null;zt.subscribe((a,f)=>{a.hydrated&&(a.tabs===f.tabs&&a.activeTabId===f.activeTabId||(i!==null&&window.clearTimeout(i),i=window.setTimeout(t,200)))}),t()}const zx=Object.freeze(Object.defineProperty({__proto__:null,hydrateSessions:Hw,useSessions:zt},Symbol.toStringTag,{value:"Module"})),hy=200,Fx=/\x1b\[[0-9;]*m/g;function Ux(t){return t.replace(Fx,"")}const qu=vf((t,i)=>({watchers:{},initialized:!1,init:()=>{i().initialized||(t({initialized:!0}),window.api.watchers.onLine(o=>i().ingestLine(o)),window.api.watchers.onClosed(({watcherId:o})=>i().closed(o)))},add:async({tabId:o,label:a,command:f,cwd:S})=>{try{const v=await window.api.watchers.add({tabId:o,label:a,command:f,cwd:S??null}),l={watcherId:v.watcherId,tabId:v.tabId,label:v.label,command:v.command,cwd:v.cwd,pid:v.pid,startedAt:v.startedAt,lineCount:0,lines:[],lastLineAt:null};return t({watchers:{...i().watchers,[l.watcherId]:l}}),l}catch(v){return console.error("[watchers] add failed:",v),null}},remove:async o=>{try{await window.api.watchers.remove(o)}catch(f){console.error("[watchers] remove failed:",f)}const a={...i().watchers};delete a[o],t({watchers:a})},watchersForTab:o=>Object.values(i().watchers).filter(a=>a.tabId===o),ingestLine:o=>{const a=i().watchers[o.watcherId];if(!a)return;const f=Ux(o.line),S=a.lines.length>=hy?[...a.lines.slice(a.lines.length-hy+1),{line:f,ts:o.ts}]:[...a.lines,{line:f,ts:o.ts}];t({watchers:{...i().watchers,[o.watcherId]:{...a,lines:S,lineCount:a.lineCount+1,lastLineAt:o.ts}}})},closed:o=>{if(!i().watchers[o])return;const a={...i().watchers};delete a[o],t({watchers:a})}})),Vx=4,fy=40,py=6;function Wx(t){const{onReorder:i,onActivate:o}=t,a=X.useRef(null),f=X.useRef(null),S=X.useRef(0),v=X.useRef(0),[l,u]=X.useState(!1),[,p]=X.useState(0),y=X.useRef(o);y.current=o;const m=X.useCallback(()=>a.current?Array.from(a.current.querySelectorAll("[data-drag-index]")):[],[]),x=X.useCallback((g,k,w)=>{for(let C=0;C<k.length;C++){const P=k[C].left+k[C].width/2;if(g<P)return C<=w?C:C-1}return k.length-1},[]),$=X.useCallback(()=>{const g=f.current,k=a.current;if(!(g!=null&&g.active)||!k)return;const w=k.getBoundingClientRect(),C=g.startX+g.deltaX,P=C-w.left,j=w.right-C;P<fy?k.scrollLeft-=py:j<fy&&(k.scrollLeft+=py),S.current=requestAnimationFrame($)},[]);X.useEffect(()=>{const g=a.current;if(!g)return;let k=!1;const w=()=>{k||(k=!0,v.current=requestAnimationFrame(()=>{k=!1,p(j=>j+1)}))},C=j=>{var Y;const O=f.current;if(!O)return;const F=j.clientX-O.startX;if(!O.active&&Math.abs(F)<Vx)return;if(!O.active){O.active=!0,O.tabRects=m().map(se=>se.getBoundingClientRect()),u(!0);try{(Y=a.current)==null||Y.setPointerCapture(O.pointerId)}catch{}S.current=requestAnimationFrame($)}O.deltaX=F;const I=O.tabRects[O.fromIndex],U=I.left+I.width/2+F;O.currentIndex=x(U,O.tabRects,O.fromIndex),w()},P=j=>{const O=f.current;if(O&&O.pointerId===j.pointerId){cancelAnimationFrame(S.current),cancelAnimationFrame(v.current);try{g.releasePointerCapture(O.pointerId)}catch{}O.active&&O.fromIndex!==O.currentIndex?i(O.fromIndex,O.currentIndex):y.current(O.fromIndex),f.current=null,u(!1),p(F=>F+1)}};return g.addEventListener("pointermove",C),g.addEventListener("pointerup",P),g.addEventListener("pointercancel",P),()=>{g.removeEventListener("pointermove",C),g.removeEventListener("pointerup",P),g.removeEventListener("pointercancel",P),cancelAnimationFrame(S.current),cancelAnimationFrame(v.current)}},[i,m,x,$]);const D=X.useCallback((g,k)=>{g.button!==0||g.target.closest("button")||(f.current={active:!1,fromIndex:k,currentIndex:k,startX:g.clientX,deltaX:0,tabRects:[],pointerId:g.pointerId})},[]);return{getTabDragProps:X.useCallback(g=>{var C;const k=f.current,w={};if(k!=null&&k.active)if(g===k.fromIndex)w.transform=`translateX(${k.deltaX}px) scale(1.03)`,w.zIndex=10,w.opacity=.85,w.boxShadow="0 2px 8px rgba(0,0,0,0.4)",w.position="relative",w.pointerEvents="none";else{const P=k.fromIndex,j=k.currentIndex,F=(((C=k.tabRects[P])==null?void 0:C.width)??0)+4;w.transition="transform 0.15s ease",P<j&&g>P&&g<=j?w.transform=`translateX(-${F}px)`:P>j&&g>=j&&g<P?w.transform=`translateX(${F}px)`:w.transform="translateX(0)"}return{onPointerDown:P=>D(P,g),style:w,"data-drag-index":g}},[D]),isDragging:l,containerRef:a}}const Hx=3e4;function qx(){const t=zt(g=>g.tabs),i=zt(g=>g.activeTabId),o=zt(g=>g.addTab),a=zt(g=>g.closeTab),f=zt(g=>g.setActive),S=zt(g=>g.reorderTab),v=qu(g=>g.watchers),[l,u]=X.useState(null),[p,y]=X.useState(()=>Date.now());X.useEffect(()=>{const g=window.setInterval(()=>y(Date.now()),1e3);return()=>window.clearInterval(g)},[]);const m=g=>{for(const k of Object.values(v))if(k.tabId===g&&k.lastLineAt&&p-k.lastLineAt<Hx)return!0;return!1},{getTabDragProps:x,isDragging:$,containerRef:D}=Wx({tabCount:t.length,onReorder:S,onActivate:g=>{const k=t[g];k&&f(k.id)}}),T=async()=>{u(null);try{const g=await window.api.app.pickDirectory();if(!g)return;const k=crypto.randomUUID(),w=`claude --dangerously-skip-permissions --session-id ${On(k)}`;o({id:k,cwd:g,startupCommand:w,presetId:"pick-dangerous"})}catch(g){const k=g instanceof Error?g.message:String(g);u(k),console.error("[TabBar] createPickedSession failed:",g)}};return h.jsxs("div",{className:"h-9 bg-bg-elev border-b border-line flex items-center px-2 gap-1 shrink-0",children:[h.jsx("div",{ref:D,className:`flex items-center gap-1 overflow-x-auto min-w-0 flex-1 select-none ${$?"cursor-grabbing":""}`,children:t.map((g,k)=>{const w=g.id===i,C=x(k);return h.jsxs("div",{...C,style:C.style,className:`group px-3 py-1 flex items-center gap-2 rounded-t text-xs shrink-0 transition-colors ${$?"":"cursor-grab"} ${w?"bg-bg-hi text-fg font-semibold border border-b-0 border-accent border-t-2 -mb-px relative z-10":"bg-bg-elev text-fg-dim border border-line hover:text-fg hover:bg-bg"}`,title:g.cwd,"aria-current":w?"true":void 0,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${g.status==="running"?"bg-green-500":g.status==="spawning"?"bg-yellow-500 animate-pulse":"bg-fg-faint"}`}),h.jsx("span",{children:g.label}),m(g.id)&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse",title:"watcher emitted a line in the last 30s","data-testid":"tab-watcher-dot"}),h.jsx("button",{onClick:P=>{P.stopPropagation(),a(g.id)},className:"text-fg-faint opacity-0 group-hover:opacity-100 hover:text-fg ml-1",title:"Close session",children:"×"})]},g.id)})}),h.jsx("div",{className:"shrink-0",children:h.jsx("button",{onClick:T,className:"px-2 py-1 text-fg-dim hover:text-fg text-xs",title:"New session — pick a project directory",children:"+ new"})}),l&&h.jsx("div",{className:"text-red-400 text-xs px-2 shrink-0",children:l}),h.jsxs("div",{className:"text-fg-faint text-xs px-2 shrink-0",children:["Claude Session Manager"," ",h.jsxs("span",{className:"font-mono text-fg-dim",children:["v","0.8.1"]})]})]})}const Gx="modulepreload",Kx=function(t,i){return new URL(t,i).href},my={},qw=function(i,o,a){let f=Promise.resolve();if(o&&o.length>0){let v=function(y){return Promise.all(y.map(m=>Promise.resolve(m).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const l=document.getElementsByTagName("link"),u=document.querySelector("meta[property=csp-nonce]"),p=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));f=v(o.map(y=>{if(y=Kx(y,a),y in my)return;my[y]=!0;const m=y.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(!!a)for(let T=l.length-1;T>=0;T--){const g=l[T];if(g.href===y&&(!m||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${x}`))return;const D=document.createElement("link");if(D.rel=m?"stylesheet":Gx,m||(D.as="script"),D.crossOrigin="",D.href=y,p&&D.setAttribute("nonce",p),document.head.appendChild(D),m)return new Promise((T,g)=>{D.addEventListener("load",T),D.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${y}`)))})}))}function S(v){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=v,window.dispatchEvent(l),!l.defaultPrevented)throw v}return f.then(v=>{for(const l of v||[])l.status==="rejected"&&S(l.reason);return i().catch(S)})};var Vm={},zh={},gy;function Gw(){if(gy)return zh;gy=1,Object.defineProperty(zh,"__esModule",{value:!0}),zh.baseAssetPath=void 0;const i=typeof window<"u"&&typeof window.document<"u"?window.document.currentScript:null;let o="/";return i&&(o=i.src.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^/]+$/,"/")),zh.baseAssetPath=o,zh}var Fh={},vy;function av(){if(vy)return Fh;vy=1,Object.defineProperty(Fh,"__esModule",{value:!0}),Fh.defaultModelFetcher=void 0;const t=i=>fetch(i).then(o=>o.arrayBuffer());return Fh.defaultModelFetcher=t,Fh}var Wo={},Uh={},yy;function yf(){if(yy)return Uh;yy=1,Object.defineProperty(Uh,"__esModule",{value:!0}),Uh.log=void 0;const t=i=>o=>{console.log(`VAD | ${i} >`,o)};return Uh.log={error:t("error"),debug:t("debug"),warn:t("warn")},Uh}var Vh={},_y;function vm(){if(_y)return Vh;_y=1,Object.defineProperty(Vh,"__esModule",{value:!0}),Vh.Message=void 0;var t;return(function(i){i.AudioFrame="AUDIO_FRAME",i.SpeechStart="SPEECH_START",i.VADMisfire="VAD_MISFIRE",i.SpeechEnd="SPEECH_END",i.SpeechStop="SPEECH_STOP",i.SpeechRealStart="SPEECH_REAL_START",i.FrameProcessed="FRAME_PROCESSED"})(t||(Vh.Message=t={})),Vh}var wy;function lv(){if(wy)return Wo;wy=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.FrameProcessor=Wo.validateOptions=Wo.defaultFrameProcessorOptions=void 0;const t=yf(),i=vm();Wo.defaultFrameProcessorOptions={positiveSpeechThreshold:.3,negativeSpeechThreshold:.25,preSpeechPadMs:800,redemptionMs:1400,minSpeechMs:400,submitUserSpeechOnPause:!1};function o(v){(v.positiveSpeechThreshold<0||v.positiveSpeechThreshold>1)&&t.log.error("positiveSpeechThreshold should be a number between 0 and 1"),(v.negativeSpeechThreshold<0||v.negativeSpeechThreshold>v.positiveSpeechThreshold)&&t.log.error("negativeSpeechThreshold should be between 0 and positiveSpeechThreshold"),v.preSpeechPadMs<0&&t.log.error("preSpeechPadMs should be positive"),v.redemptionMs<0&&t.log.error("redemptionMs should be positive"),v.minSpeechMs<0&&t.log.error("minSpeechMs should be positive")}Wo.validateOptions=o;const a=v=>{const l=v.reduce((p,y)=>(p.push(p.at(-1)+y.length),p),[0]),u=new Float32Array(l.at(-1));return v.forEach((p,y)=>{const m=l[y];u.set(p,m)}),u};function f(v,l){const u=Math.floor(v.redemptionMs/l),p=Math.floor(v.preSpeechPadMs/l),y=Math.floor(v.minSpeechMs/l);return{redemptionFrames:u,preSpeechPadFrames:p,minSpeechFrames:y}}class S{constructor(l,u,p,y){this.modelProcessFunc=l,this.modelResetFunc=u,this.options=p,this.msPerFrame=y,this.speaking=!1,this.redemptionCounter=0,this.speechFrameCount=0,this.active=!1,this.speechRealStartFired=!1,this.setOptions=D=>{this.options={...this.options,...D};const{redemptionFrames:T,preSpeechPadFrames:g,minSpeechFrames:k}=f(this.options,this.msPerFrame);this.redemptionFrames=T,this.preSpeechPadFrames=g,this.minSpeechFrames=k},this.reset=()=>{this.speaking=!1,this.speechRealStartFired=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0,this.speechFrameCount=0},this.pause=D=>{this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment(D):this.reset()},this.resume=()=>{this.active=!0},this.endSegment=D=>{const T=this.audioBuffer;this.audioBuffer=[];const g=this.speaking;if(this.reset(),g)if(T.reduce((w,C)=>C.isSpeech?w+1:w,0)>=this.minSpeechFrames){const w=a(T.map(C=>C.frame));D({msg:i.Message.SpeechEnd,audio:w})}else D({msg:i.Message.VADMisfire});return{}},this.process=async(D,T)=>{if(!this.active)return;const g=await this.modelProcessFunc(D),k=g.isSpeech>=this.options.positiveSpeechThreshold;if(T({probs:g,msg:i.Message.FrameProcessed,frame:D}),this.audioBuffer.push({frame:D,isSpeech:k}),k&&(this.speechFrameCount++,this.redemptionCounter=0),k&&!this.speaking&&(this.speaking=!0,T({msg:i.Message.SpeechStart})),this.speaking&&this.speechFrameCount===this.minSpeechFrames&&!this.speechRealStartFired&&(this.speechRealStartFired=!0,T({msg:i.Message.SpeechRealStart})),g.isSpeech<this.options.negativeSpeechThreshold&&this.speaking&&++this.redemptionCounter>=this.redemptionFrames){this.redemptionCounter=0,this.speechFrameCount=0,this.speaking=!1,this.speechRealStartFired=!1;const w=this.audioBuffer;if(this.audioBuffer=[],w.reduce((P,j)=>j.isSpeech?P+1:P,0)>=this.minSpeechFrames){const P=a(w.map(j=>j.frame));T({msg:i.Message.SpeechEnd,audio:P})}else T({msg:i.Message.VADMisfire})}if(!this.speaking){for(;this.audioBuffer.length>this.preSpeechPadFrames;)this.audioBuffer.shift();this.speechFrameCount=0}},this.audioBuffer=[];const{redemptionFrames:m,preSpeechPadFrames:x,minSpeechFrames:$}=f(this.options,this.msPerFrame);this.redemptionFrames=m,this.preSpeechPadFrames=x,this.minSpeechFrames=$,this.reset()}}return Wo.FrameProcessor=S,Wo}var Ho={};function tn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wm={exports:{}};/*!
|
|
42
42
|
* ONNX Runtime Web v1.24.3
|
|
43
43
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
44
44
|
* Licensed under the MIT License.
|
|
@@ -2874,7 +2874,7 @@ ${A}`,M=c.createShaderModule({code:R,label:e.name});Nt("verbose",()=>`[WebGPU] $
|
|
|
2874
2874
|
* ONNX Runtime Web v1.24.3
|
|
2875
2875
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2876
2876
|
* Licensed under the MIT License.
|
|
2877
|
-
*/var Ay;function tS(){return Ay||(Ay=1,(function(t,i){var o=(()=>{var a=Object.defineProperty,f=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,v=Object.prototype.hasOwnProperty,l=(q=>typeof tn<"u"?tn:typeof Proxy<"u"?new Proxy(q,{get:(te,ce)=>(typeof tn<"u"?tn:te)[ce]}):q)(function(q){if(typeof tn<"u")return tn.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')}),u=(q,te)=>()=>(q&&(te=q(q=0)),te),p=(q,te)=>{for(var ce in te)a(q,ce,{get:te[ce],enumerable:!0})},y=(q,te,ce,_e)=>{if(te&&typeof te=="object"||typeof te=="function")for(let pe of S(te))!v.call(q,pe)&&pe!==ce&&a(q,pe,{get:()=>te[pe],enumerable:!(_e=f(te,pe))||_e.enumerable});return q},m=q=>y(a({},"__esModule",{value:!0}),q),x,$,D,T,g,k=u(()=>{x=new Map,$=[],D=(q,te,ce)=>{if(te&&typeof te.init=="function"&&typeof te.createInferenceSessionHandler=="function"){let _e=x.get(q);if(_e===void 0)x.set(q,{backend:te,priority:ce});else{if(_e.priority>ce)return;if(_e.priority===ce&&_e.backend!==te)throw new Error(`cannot register backend "${q}" using priority ${ce}`)}if(ce>=0){let pe=$.indexOf(q);pe!==-1&&$.splice(pe,1);for(let Re=0;Re<$.length;Re++)if(x.get($[Re]).priority<=ce){$.splice(Re,0,q);return}$.push(q)}return}throw new TypeError("not a valid backend")},T=async q=>{let te=x.get(q);if(!te)return"backend not found.";if(te.initialized)return te.backend;if(te.aborted)return te.error;{let ce=!!te.initPromise;try{return ce||(te.initPromise=te.backend.init(q)),await te.initPromise,te.initialized=!0,te.backend}catch(_e){return ce||(te.error=`${_e}`,te.aborted=!0),te.error}finally{delete te.initPromise}}},g=async q=>{let te=q.executionProviders||[],ce=te.map(De=>typeof De=="string"?De:De.name),_e=ce.length===0?$:ce,pe,Re=[],xe=new Set;for(let De of _e){let Ue=await T(De);typeof Ue=="string"?Re.push({name:De,err:Ue}):(pe||(pe=Ue),pe===Ue&&xe.add(De))}if(!pe)throw new Error(`no available backend found. ERR: ${Re.map(De=>`[${De.name}] ${De.err}`).join(", ")}`);for(let{name:De,err:Ue}of Re)ce.includes(De)&&console.warn(`removing requested execution provider "${De}" from session options because it is not available: ${Ue}`);let Se=te.filter(De=>xe.has(typeof De=="string"?De:De.name));return[pe,new Proxy(q,{get:(De,Ue)=>Ue==="executionProviders"?Se:Reflect.get(De,Ue)})]}}),w=u(()=>{k()}),C,P=u(()=>{C="1.24.3"}),j,O,F=u(()=>{P(),j="warning",O={wasm:{},webgl:{},webgpu:{},versions:{common:C},set logLevel(q){if(q!==void 0){if(typeof q!="string"||["verbose","info","warning","error","fatal"].indexOf(q)===-1)throw new Error(`Unsupported logging level: ${q}`);j=q}},get logLevel(){return j}},Object.defineProperty(O,"logLevel",{enumerable:!0})}),I,U=u(()=>{F(),I=O}),Y,se,de=u(()=>{Y=(q,te)=>{let ce=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);ce.width=q.dims[3],ce.height=q.dims[2];let _e=ce.getContext("2d");if(_e!=null){let pe,Re;(te==null?void 0:te.tensorLayout)!==void 0&&te.tensorLayout==="NHWC"?(pe=q.dims[2],Re=q.dims[3]):(pe=q.dims[3],Re=q.dims[2]);let xe=(te==null?void 0:te.format)!==void 0?te.format:"RGB",Se=te==null?void 0:te.norm,De,Ue;Se===void 0||Se.mean===void 0?De=[255,255,255,255]:typeof Se.mean=="number"?De=[Se.mean,Se.mean,Se.mean,Se.mean]:(De=[Se.mean[0],Se.mean[1],Se.mean[2],0],Se.mean[3]!==void 0&&(De[3]=Se.mean[3])),Se===void 0||Se.bias===void 0?Ue=[0,0,0,0]:typeof Se.bias=="number"?Ue=[Se.bias,Se.bias,Se.bias,Se.bias]:(Ue=[Se.bias[0],Se.bias[1],Se.bias[2],0],Se.bias[3]!==void 0&&(Ue[3]=Se.bias[3]));let qe=Re*pe,We=0,Oe=qe,lt=qe*2,Ae=-1;xe==="RGBA"?(We=0,Oe=qe,lt=qe*2,Ae=qe*3):xe==="RGB"?(We=0,Oe=qe,lt=qe*2):xe==="RBG"&&(We=0,lt=qe,Oe=qe*2);for(let Ye=0;Ye<Re;Ye++)for(let Qt=0;Qt<pe;Qt++){let At=(q.data[We++]-Ue[0])*De[0],Rt=(q.data[Oe++]-Ue[1])*De[1],Zt=(q.data[lt++]-Ue[2])*De[2],gt=Ae===-1?255:(q.data[Ae++]-Ue[3])*De[3];_e.fillStyle="rgba("+At+","+Rt+","+Zt+","+gt+")",_e.fillRect(Qt,Ye,1,1)}if("toDataURL"in ce)return ce.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},se=(q,te)=>{let ce=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),_e;if(ce!=null){let pe,Re,xe;(te==null?void 0:te.tensorLayout)!==void 0&&te.tensorLayout==="NHWC"?(pe=q.dims[2],Re=q.dims[1],xe=q.dims[3]):(pe=q.dims[3],Re=q.dims[2],xe=q.dims[1]);let Se=te!==void 0&&te.format!==void 0?te.format:"RGB",De=te==null?void 0:te.norm,Ue,qe;De===void 0||De.mean===void 0?Ue=[255,255,255,255]:typeof De.mean=="number"?Ue=[De.mean,De.mean,De.mean,De.mean]:(Ue=[De.mean[0],De.mean[1],De.mean[2],255],De.mean[3]!==void 0&&(Ue[3]=De.mean[3])),De===void 0||De.bias===void 0?qe=[0,0,0,0]:typeof De.bias=="number"?qe=[De.bias,De.bias,De.bias,De.bias]:(qe=[De.bias[0],De.bias[1],De.bias[2],0],De.bias[3]!==void 0&&(qe[3]=De.bias[3]));let We=Re*pe;if(te!==void 0&&(te.format!==void 0&&xe===4&&te.format!=="RGBA"||xe===3&&te.format!=="RGB"&&te.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let Oe=4,lt=0,Ae=1,Ye=2,Qt=3,At=0,Rt=We,Zt=We*2,gt=-1;Se==="RGBA"?(At=0,Rt=We,Zt=We*2,gt=We*3):Se==="RGB"?(At=0,Rt=We,Zt=We*2):Se==="RBG"&&(At=0,Zt=We,Rt=We*2),_e=ce.createImageData(pe,Re);for(let rr=0;rr<Re*pe;lt+=Oe,Ae+=Oe,Ye+=Oe,Qt+=Oe,rr++)_e.data[lt]=(q.data[At++]-qe[0])*Ue[0],_e.data[Ae]=(q.data[Rt++]-qe[1])*Ue[1],_e.data[Ye]=(q.data[Zt++]-qe[2])*Ue[2],_e.data[Qt]=gt===-1?255:(q.data[gt++]-qe[3])*Ue[3]}else throw new Error("Can not access image data");return _e}}),ie,ye,ge,ke,be,ue,W=u(()=>{Me(),ie=(q,te)=>{if(q===void 0)throw new Error("Image buffer must be defined");if(te.height===void 0||te.width===void 0)throw new Error("Image height and width must be defined");if(te.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:ce,width:_e}=te,pe=te.norm??{mean:255,bias:0},Re,xe;typeof pe.mean=="number"?Re=[pe.mean,pe.mean,pe.mean,pe.mean]:Re=[pe.mean[0],pe.mean[1],pe.mean[2],pe.mean[3]??255],typeof pe.bias=="number"?xe=[pe.bias,pe.bias,pe.bias,pe.bias]:xe=[pe.bias[0],pe.bias[1],pe.bias[2],pe.bias[3]??0];let Se=te.format!==void 0?te.format:"RGBA",De=te.tensorFormat!==void 0&&te.tensorFormat!==void 0?te.tensorFormat:"RGB",Ue=ce*_e,qe=De==="RGBA"?new Float32Array(Ue*4):new Float32Array(Ue*3),We=4,Oe=0,lt=1,Ae=2,Ye=3,Qt=0,At=Ue,Rt=Ue*2,Zt=-1;Se==="RGB"&&(We=3,Oe=0,lt=1,Ae=2,Ye=-1),De==="RGBA"?Zt=Ue*3:De==="RBG"?(Qt=0,Rt=Ue,At=Ue*2):De==="BGR"&&(Rt=0,At=Ue,Qt=Ue*2);for(let gt=0;gt<Ue;gt++,Oe+=We,Ae+=We,lt+=We,Ye+=We)qe[Qt++]=(q[Oe]+xe[0])/Re[0],qe[At++]=(q[lt]+xe[1])/Re[1],qe[Rt++]=(q[Ae]+xe[2])/Re[2],Zt!==-1&&Ye!==-1&&(qe[Zt++]=(q[Ye]+xe[3])/Re[3]);return De==="RGBA"?new J("float32",qe,[1,4,ce,_e]):new J("float32",qe,[1,3,ce,_e])},ye=async(q,te)=>{let ce=typeof HTMLImageElement<"u"&&q instanceof HTMLImageElement,_e=typeof ImageData<"u"&&q instanceof ImageData,pe=typeof ImageBitmap<"u"&&q instanceof ImageBitmap,Re=typeof q=="string",xe,Se=te??{},De=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},Ue=qe=>typeof HTMLCanvasElement<"u"&&qe instanceof HTMLCanvasElement||qe instanceof OffscreenCanvas?qe.getContext("2d"):null;if(ce){let qe=De();qe.width=q.width,qe.height=q.height;let We=Ue(qe);if(We!=null){let Oe=q.height,lt=q.width;if(te!==void 0&&te.resizedHeight!==void 0&&te.resizedWidth!==void 0&&(Oe=te.resizedHeight,lt=te.resizedWidth),te!==void 0){if(Se=te,te.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");Se.tensorFormat="RGBA",Se.height=Oe,Se.width=lt}else Se.tensorFormat="RGBA",Se.height=Oe,Se.width=lt;We.drawImage(q,0,0),xe=We.getImageData(0,0,lt,Oe).data}else throw new Error("Can not access image data")}else if(_e){let qe,We;if(te!==void 0&&te.resizedWidth!==void 0&&te.resizedHeight!==void 0?(qe=te.resizedHeight,We=te.resizedWidth):(qe=q.height,We=q.width),te!==void 0&&(Se=te),Se.format="RGBA",Se.height=qe,Se.width=We,te!==void 0){let Oe=De();Oe.width=We,Oe.height=qe;let lt=Ue(Oe);if(lt!=null)lt.putImageData(q,0,0),xe=lt.getImageData(0,0,We,qe).data;else throw new Error("Can not access image data")}else xe=q.data}else if(pe){if(te===void 0)throw new Error("Please provide image config with format for Imagebitmap");let qe=De();qe.width=q.width,qe.height=q.height;let We=Ue(qe);if(We!=null){let Oe=q.height,lt=q.width;return We.drawImage(q,0,0,lt,Oe),xe=We.getImageData(0,0,lt,Oe).data,Se.height=Oe,Se.width=lt,ie(xe,Se)}else throw new Error("Can not access image data")}else{if(Re)return new Promise((qe,We)=>{let Oe=De(),lt=Ue(Oe);if(!q||!lt)return We();let Ae=new Image;Ae.crossOrigin="Anonymous",Ae.src=q,Ae.onload=()=>{Oe.width=Ae.width,Oe.height=Ae.height,lt.drawImage(Ae,0,0,Oe.width,Oe.height);let Ye=lt.getImageData(0,0,Oe.width,Oe.height);Se.height=Oe.height,Se.width=Oe.width,qe(ie(Ye.data,Se))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(xe!==void 0)return ie(xe,Se);throw new Error("Input data provided is not supported - aborted tensor creation")},ge=(q,te)=>{let{width:ce,height:_e,download:pe,dispose:Re}=te,xe=[1,_e,ce,4];return new J({location:"texture",type:"float32",texture:q,dims:xe,download:pe,dispose:Re})},ke=(q,te)=>{let{dataType:ce,dims:_e,download:pe,dispose:Re}=te;return new J({location:"gpu-buffer",type:ce??"float32",gpuBuffer:q,dims:_e,download:pe,dispose:Re})},be=(q,te)=>{let{dataType:ce,dims:_e,download:pe,dispose:Re}=te;return new J({location:"ml-tensor",type:ce??"float32",mlTensor:q,dims:_e,download:pe,dispose:Re})},ue=(q,te,ce)=>new J({location:"cpu-pinned",type:q,data:te,dims:ce??[te.length]})}),re,G,ne,Pe,Ve=u(()=>{re=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),G=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),ne=!1,Pe=()=>{if(!ne){ne=!0;let q=typeof BigInt64Array<"u"&&BigInt64Array.from,te=typeof BigUint64Array<"u"&&BigUint64Array.from,ce=globalThis.Float16Array,_e=typeof ce<"u"&&ce.from;q&&(re.set("int64",BigInt64Array),G.set(BigInt64Array,"int64")),te&&(re.set("uint64",BigUint64Array),G.set(BigUint64Array,"uint64")),_e?(re.set("float16",ce),G.set(ce,"float16")):re.set("float16",Uint16Array)}}}),Ge,it,Ce=u(()=>{Me(),Ge=q=>{let te=1;for(let ce=0;ce<q.length;ce++){let _e=q[ce];if(typeof _e!="number"||!Number.isSafeInteger(_e))throw new TypeError(`dims[${ce}] must be an integer, got: ${_e}`);if(_e<0)throw new RangeError(`dims[${ce}] must be a non-negative integer, got: ${_e}`);te*=_e}return te},it=(q,te)=>{switch(q.location){case"cpu":return new J(q.type,q.data,te);case"cpu-pinned":return new J({location:"cpu-pinned",data:q.data,type:q.type,dims:te});case"texture":return new J({location:"texture",texture:q.texture,type:q.type,dims:te});case"gpu-buffer":return new J({location:"gpu-buffer",gpuBuffer:q.gpuBuffer,type:q.type,dims:te});case"ml-tensor":return new J({location:"ml-tensor",mlTensor:q.mlTensor,type:q.type,dims:te});default:throw new Error(`tensorReshape: tensor location ${q.location} is not supported`)}}}),J,Me=u(()=>{de(),W(),Ve(),Ce(),J=class{constructor(q,te,ce){Pe();let _e,pe;if(typeof q=="object"&&"location"in q)switch(this.dataLocation=q.location,_e=q.type,pe=q.dims,q.location){case"cpu-pinned":{let xe=re.get(_e);if(!xe)throw new TypeError(`unsupported type "${_e}" to create tensor from pinned buffer`);if(!(q.data instanceof xe))throw new TypeError(`buffer should be of type ${xe.name}`);this.cpuData=q.data;break}case"texture":{if(_e!=="float32")throw new TypeError(`unsupported type "${_e}" to create tensor from texture`);this.gpuTextureData=q.texture,this.downloader=q.download,this.disposer=q.dispose;break}case"gpu-buffer":{if(_e!=="float32"&&_e!=="float16"&&_e!=="int32"&&_e!=="int64"&&_e!=="uint32"&&_e!=="uint8"&&_e!=="bool"&&_e!=="uint4"&&_e!=="int4")throw new TypeError(`unsupported type "${_e}" to create tensor from gpu buffer`);this.gpuBufferData=q.gpuBuffer,this.downloader=q.download,this.disposer=q.dispose;break}case"ml-tensor":{if(_e!=="float32"&&_e!=="float16"&&_e!=="int32"&&_e!=="int64"&&_e!=="uint32"&&_e!=="uint64"&&_e!=="int8"&&_e!=="uint8"&&_e!=="bool"&&_e!=="uint4"&&_e!=="int4")throw new TypeError(`unsupported type "${_e}" to create tensor from MLTensor`);this.mlTensorData=q.mlTensor,this.downloader=q.download,this.disposer=q.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let xe,Se;if(typeof q=="string")if(_e=q,Se=ce,q==="string"){if(!Array.isArray(te))throw new TypeError("A string tensor's data must be a string array.");xe=te}else{let De=re.get(q);if(De===void 0)throw new TypeError(`Unsupported tensor type: ${q}.`);if(Array.isArray(te)){if(q==="float16"&&De===Uint16Array||q==="uint4"||q==="int4")throw new TypeError(`Creating a ${q} tensor from number array is not supported. Please use ${De.name} as data.`);q==="uint64"||q==="int64"?xe=De.from(te,BigInt):xe=De.from(te)}else if(te instanceof De)xe=te;else if(te instanceof Uint8ClampedArray)if(q==="uint8")xe=Uint8Array.from(te);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(q==="float16"&&te instanceof Uint16Array&&De!==Uint16Array)xe=new globalThis.Float16Array(te.buffer,te.byteOffset,te.length);else throw new TypeError(`A ${_e} tensor's data must be type of ${De}`)}else if(Se=te,Array.isArray(q)){if(q.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let De=typeof q[0];if(De==="string")_e="string",xe=q;else if(De==="boolean")_e="bool",xe=Uint8Array.from(q);else throw new TypeError(`Invalid element type of data array: ${De}.`)}else if(q instanceof Uint8ClampedArray)_e="uint8",xe=Uint8Array.from(q);else{let De=G.get(q.constructor);if(De===void 0)throw new TypeError(`Unsupported type for tensor data: ${q.constructor}.`);_e=De,xe=q}if(Se===void 0)Se=[xe.length];else if(!Array.isArray(Se))throw new TypeError("A tensor's dims must be a number array");pe=Se,this.cpuData=xe,this.dataLocation="cpu"}let Re=Ge(pe);if(this.cpuData&&Re!==this.cpuData.length&&!((_e==="uint4"||_e==="int4")&&Math.ceil(Re/2)===this.cpuData.length))throw new Error(`Tensor's size(${Re}) does not match data length(${this.cpuData.length}).`);this.type=_e,this.dims=pe,this.size=Re}static async fromImage(q,te){return ye(q,te)}static fromTexture(q,te){return ge(q,te)}static fromGpuBuffer(q,te){return ke(q,te)}static fromMLTensor(q,te){return be(q,te)}static fromPinnedBuffer(q,te,ce){return ue(q,te,ce)}toDataURL(q){return Y(this,q)}toImageData(q){return se(this,q)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(q){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let te=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=te,q&&this.disposer&&(this.disposer(),this.disposer=void 0),te}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(q){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return it(this,q)}}}),$e,Ze=u(()=>{Me(),$e=J}),tt,It,jt,$t,Wt,ht,Ei=u(()=>{F(),tt=(q,te)=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||console.timeStamp(`${q}::ORT::${te}`)},It=(q,te)=>{var pe;let ce=((pe=new Error().stack)==null?void 0:pe.split(/\r\n|\r|\n/g))||[],_e=!1;for(let Re=0;Re<ce.length;Re++){if(_e&&!ce[Re].includes("TRACE_FUNC")){let xe=`FUNC_${q}::${ce[Re].trim().split(" ")[1]}`;te&&(xe+=`::${te}`),tt("CPU",xe);return}ce[Re].includes("TRACE_FUNC")&&(_e=!0)}},jt=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||It("BEGIN",q)},$t=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||It("END",q)},Wt=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||console.time(`ORT::${q}`)},ht=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||console.timeEnd(`ORT::${q}`)}}),tr,kr=u(()=>{k(),Ze(),Ei(),tr=class Qw{constructor(te){this.handler=te}async run(te,ce,_e){jt(),Wt("InferenceSession.run");let pe={},Re={};if(typeof te!="object"||te===null||te instanceof $e||Array.isArray(te))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let xe=!0;if(typeof ce=="object"){if(ce===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(ce instanceof $e)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(ce)){if(ce.length===0)throw new TypeError("'fetches' cannot be an empty array.");xe=!1;for(let Ue of ce){if(typeof Ue!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(Ue)===-1)throw new RangeError(`'fetches' contains invalid output name: ${Ue}.`);pe[Ue]=null}if(typeof _e=="object"&&_e!==null)Re=_e;else if(typeof _e<"u")throw new TypeError("'options' must be an object.")}else{let Ue=!1,qe=Object.getOwnPropertyNames(ce);for(let We of this.outputNames)if(qe.indexOf(We)!==-1){let Oe=ce[We];(Oe===null||Oe instanceof $e)&&(Ue=!0,xe=!1,pe[We]=Oe)}if(Ue){if(typeof _e=="object"&&_e!==null)Re=_e;else if(typeof _e<"u")throw new TypeError("'options' must be an object.")}else Re=ce}}else if(typeof ce<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let Ue of this.inputNames)if(typeof te[Ue]>"u")throw new Error(`input '${Ue}' is missing in 'feeds'.`);if(xe)for(let Ue of this.outputNames)pe[Ue]=null;let Se=await this.handler.run(te,pe,Re),De={};for(let Ue in Se)if(Object.hasOwnProperty.call(Se,Ue)){let qe=Se[Ue];qe instanceof $e?De[Ue]=qe:De[Ue]=new $e(qe.type,qe.data,qe.dims)}return ht("InferenceSession.run"),$t(),De}async release(){return this.handler.dispose()}static async create(te,ce,_e,pe){jt(),Wt("InferenceSession.create");let Re,xe={};if(typeof te=="string"){if(Re=te,typeof ce=="object"&&ce!==null)xe=ce;else if(typeof ce<"u")throw new TypeError("'options' must be an object.")}else if(te instanceof Uint8Array){if(Re=te,typeof ce=="object"&&ce!==null)xe=ce;else if(typeof ce<"u")throw new TypeError("'options' must be an object.")}else if(te instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&te instanceof SharedArrayBuffer){let qe=te,We=0,Oe=te.byteLength;if(typeof ce=="object"&&ce!==null)xe=ce;else if(typeof ce=="number"){if(We=ce,!Number.isSafeInteger(We))throw new RangeError("'byteOffset' must be an integer.");if(We<0||We>=qe.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${qe.byteLength}).`);if(Oe=te.byteLength-We,typeof _e=="number"){if(Oe=_e,!Number.isSafeInteger(Oe))throw new RangeError("'byteLength' must be an integer.");if(Oe<=0||We+Oe>qe.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${qe.byteLength-We}].`);if(typeof pe=="object"&&pe!==null)xe=pe;else if(typeof pe<"u")throw new TypeError("'options' must be an object.")}else if(typeof _e<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof ce<"u")throw new TypeError("'options' must be an object.");Re=new Uint8Array(qe,We,Oe)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[Se,De]=await g(xe),Ue=await Se.createInferenceSessionHandler(Re,De);return ht("InferenceSession.create"),$t(),new Qw(Ue)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),Rr,Is=u(()=>{kr(),Rr=tr}),Fr=u(()=>{}),Ms=u(()=>{}),ui=u(()=>{}),Ls=u(()=>{}),vs={};p(vs,{InferenceSession:()=>Rr,TRACE:()=>tt,TRACE_EVENT_BEGIN:()=>Wt,TRACE_EVENT_END:()=>ht,TRACE_FUNC_BEGIN:()=>jt,TRACE_FUNC_END:()=>$t,Tensor:()=>$e,env:()=>I,registerBackend:()=>D});var Jt=u(()=>{w(),U(),Is(),Ze(),Fr(),Ms(),Ei(),ui(),Ls()}),Mi=u(()=>{}),Or={};p(Or,{default:()=>Nn});var Ur,Yt,Nn,oc=u(()=>{var q;xo(),Ti(),on(),Ur="ort-wasm-proxy-worker",Yt=((q=globalThis.self)==null?void 0:q.name)===Ur,Yt&&(self.onmessage=te=>{let{type:ce,in:_e}=te.data;try{switch(ce){case"init-wasm":Os(_e.wasm).then(()=>{ea(_e).then(()=>{postMessage({type:ce})},pe=>{postMessage({type:ce,err:pe})})},pe=>{postMessage({type:ce,err:pe})});break;case"init-ep":{let{epName:pe,env:Re}=_e;cn(Re,pe).then(()=>{postMessage({type:ce})},xe=>{postMessage({type:ce,err:xe})});break}case"copy-from":{let{buffer:pe}=_e,Re=Nt(pe);postMessage({type:ce,out:Re});break}case"create":{let{model:pe,options:Re}=_e;Ni(pe,Re).then(xe=>{postMessage({type:ce,out:xe})},xe=>{postMessage({type:ce,err:xe})});break}case"release":Hn(_e),postMessage({type:ce});break;case"run":{let{sessionId:pe,inputIndices:Re,inputs:xe,outputIndices:Se,options:De}=_e;Be(pe,Re,xe,Se,new Array(Se.length).fill(null),De).then(Ue=>{Ue.some(qe=>qe[3]!=="cpu")?postMessage({type:ce,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:ce,out:Ue},ta([...xe,...Ue]))},Ue=>{postMessage({type:ce,err:Ue})});break}case"end-profiling":rs(_e),postMessage({type:ce});break;default:}}catch(pe){postMessage({type:ce,err:pe})}}),Nn=Yt?null:te=>new Worker(te??er,{type:"classic",name:Ur})}),qa,_o,er,nn,ys,wo,js,es,Go,Bn,Ko,zn,Xo,on=u(()=>{Mi(),qa=typeof location>"u"?void 0:location.origin,_o=()=>{var q,te;return typeof document<"u"?(q=document.currentScript)==null?void 0:q.src:typeof self<"u"?(te=self.location)==null?void 0:te.href:void 0},er=_o(),nn=()=>{if(er&&!er.startsWith("blob:"))return er.substring(0,er.lastIndexOf("/")+1)},ys=(q,te)=>{try{let ce=te??er;return(ce?new URL(q,ce):new URL(q)).origin===qa}catch{return!1}},wo=(q,te)=>{let ce=te??er;try{return(ce?new URL(q,ce):new URL(q)).href}catch{return}},js=(q,te)=>`${te??"./"}${q}`,es=async q=>{let te=await(await fetch(q,{credentials:"same-origin"})).blob();return URL.createObjectURL(te)},Go=async q=>(await import(q)).default,Bn=(oc(),m(Or)).default,Ko=async()=>{if(!er)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(ys(er))return[void 0,Bn()];let q=await es(er);return[q,Bn(q)]},zn=void 0,Xo=async(q,te,ce,_e)=>{let pe=zn&&!(q||te);if(pe)if(er)pe=ys(er)||_e&&!ce;else if(_e&&!ce)pe=!0;else throw new Error("cannot determine the script source URL.");if(pe)return[void 0,zn];{let Re="ort-wasm-simd-threaded.mjs",xe=q??wo(Re,te),Se=ce&&xe&&!ys(xe,te),De=Se?await es(xe):xe??js(Re,te);return[Se?De:void 0,await Go(De)]}}}),Fn,Li,ji,_s,Ga,an,Un,Os,St,Ti=u(()=>{on(),Li=!1,ji=!1,_s=!1,Ga=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},an=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},Un=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},Os=async q=>{if(Li)return Promise.resolve();if(ji)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(_s)throw new Error("previous call to 'initializeWebAssembly()' failed.");ji=!0;let te=q.initTimeout,ce=q.numThreads;if(q.simd!==!1){if(q.simd==="relaxed"){if(!Un())throw new Error("Relaxed WebAssembly SIMD is not supported in the current environment.")}else if(!an())throw new Error("WebAssembly SIMD is not supported in the current environment.")}let _e=Ga();ce>1&&!_e&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+ce+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),q.numThreads=ce=1);let pe=q.wasmPaths,Re=typeof pe=="string"?pe:void 0,xe=pe==null?void 0:pe.mjs,Se=(xe==null?void 0:xe.href)??xe,De=pe==null?void 0:pe.wasm,Ue=(De==null?void 0:De.href)??De,qe=q.wasmBinary,[We,Oe]=await Xo(Se,Re,ce>1,!!qe||!!Ue),lt=!1,Ae=[];if(te>0&&Ae.push(new Promise(Ye=>{setTimeout(()=>{lt=!0,Ye()},te)})),Ae.push(new Promise((Ye,Qt)=>{let At={numThreads:ce};if(qe)At.wasmBinary=qe,At.locateFile=Rt=>Rt;else if(Ue||Re)At.locateFile=Rt=>Ue??Re+Rt;else if(Se&&Se.indexOf("blob:")!==0)At.locateFile=Rt=>new URL(Rt,Se).href;else if(We){let Rt=nn();Rt&&(At.locateFile=Zt=>Rt+Zt)}Oe(At).then(Rt=>{ji=!1,Li=!0,Fn=Rt,Ye(),We&&URL.revokeObjectURL(We)},Rt=>{ji=!1,_s=!0,Qt(Rt)})})),await Promise.race(Ae),lt)throw new Error(`WebAssembly backend initializing failed due to timeout: ${te}ms`)},St=()=>{if(Li&&Fn)return Fn;throw new Error("WebAssembly is not initialized yet.")}}),pr,ln,ct,Vn=u(()=>{Ti(),pr=(q,te)=>{let ce=St(),_e=ce.lengthBytesUTF8(q)+1,pe=ce._malloc(_e);return ce.stringToUTF8(q,pe,_e),te.push(pe),pe},ln=(q,te,ce,_e)=>{if(typeof q=="object"&&q!==null){if(ce.has(q))throw new Error("Circular reference in options");ce.add(q)}Object.entries(q).forEach(([pe,Re])=>{let xe=te?te+pe:pe;if(typeof Re=="object")ln(Re,xe+".",ce,_e);else if(typeof Re=="string"||typeof Re=="number")_e(xe,Re.toString());else if(typeof Re=="boolean")_e(xe,Re?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof Re}`)})},ct=q=>{let te=St(),ce=te.stackSave();try{let _e=te.PTR_SIZE,pe=te.stackAlloc(2*_e);te._OrtGetLastError(pe,pe+_e);let Re=Number(te.getValue(pe,_e===4?"i32":"i64")),xe=te.getValue(pe+_e,"*"),Se=xe?te.UTF8ToString(xe):"";throw new Error(`${q} ERROR_CODE: ${Re}, ERROR_MESSAGE: ${Se}`)}finally{te.stackRestore(ce)}}}),Jo,sd=u(()=>{Ti(),Vn(),Jo=q=>{let te=St(),ce=0,_e=[],pe=q||{};try{if((q==null?void 0:q.logSeverityLevel)===void 0)pe.logSeverityLevel=2;else if(typeof q.logSeverityLevel!="number"||!Number.isInteger(q.logSeverityLevel)||q.logSeverityLevel<0||q.logSeverityLevel>4)throw new Error(`log severity level is not valid: ${q.logSeverityLevel}`);if((q==null?void 0:q.logVerbosityLevel)===void 0)pe.logVerbosityLevel=0;else if(typeof q.logVerbosityLevel!="number"||!Number.isInteger(q.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${q.logVerbosityLevel}`);(q==null?void 0:q.terminate)===void 0&&(pe.terminate=!1);let Re=0;return(q==null?void 0:q.tag)!==void 0&&(Re=pr(q.tag,_e)),ce=te._OrtCreateRunOptions(pe.logSeverityLevel,pe.logVerbosityLevel,!!pe.terminate,Re),ce===0&&ct("Can't create run options."),(q==null?void 0:q.extra)!==void 0&&ln(q.extra,"",new WeakSet,(xe,Se)=>{let De=pr(xe,_e),Ue=pr(Se,_e);te._OrtAddRunConfigEntry(ce,De,Ue)!==0&&ct(`Can't set a run config entry: ${xe} - ${Se}.`)}),[ce,_e]}catch(Re){throw ce!==0&&te._OrtReleaseRunOptions(ce),_e.forEach(xe=>te._free(xe)),Re}}}),Yo,Qo,Zo,ts,Ka,Xa,mr=u(()=>{Ti(),Vn(),Yo=q=>{switch(q){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"layout":return 3;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${q}`)}},Qo=q=>{switch(q){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${q}`)}},Zo=q=>{q.extra||(q.extra={}),q.extra.session||(q.extra.session={});let te=q.extra.session;te.use_ort_model_bytes_directly||(te.use_ort_model_bytes_directly="1"),q.executionProviders&&q.executionProviders.some(ce=>(typeof ce=="string"?ce:ce.name)==="webgpu")&&(q.enableMemPattern=!1)},ts=(q,te,ce,_e)=>{let pe=pr(te,_e),Re=pr(ce,_e);St()._OrtAddSessionConfigEntry(q,pe,Re)!==0&&ct(`Can't set a session config entry: ${te} - ${ce}.`)},Ka=async(q,te,ce)=>{let _e=te.executionProviders;for(let pe of _e){let Re=typeof pe=="string"?pe:pe.name,xe=[];switch(Re){case"webnn":if(Re="WEBNN",typeof pe!="string"){let We=pe==null?void 0:pe.deviceType;We&&ts(q,"deviceType",We,ce)}break;case"webgpu":if(Re="JS",typeof pe!="string"){let We=pe;if(We!=null&&We.preferredLayout){if(We.preferredLayout!=="NCHW"&&We.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${We.preferredLayout}`);ts(q,"preferredLayout",We.preferredLayout,ce)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${Re}`)}let Se=pr(Re,ce),De=xe.length,Ue=0,qe=0;if(De>0){Ue=St()._malloc(De*St().PTR_SIZE),ce.push(Ue),qe=St()._malloc(De*St().PTR_SIZE),ce.push(qe);for(let We=0;We<De;We++)St().setValue(Ue+We*St().PTR_SIZE,xe[We][0],"*"),St().setValue(qe+We*St().PTR_SIZE,xe[We][1],"*")}await St()._OrtAppendExecutionProvider(q,Se,Ue,qe,De)!==0&&ct(`Can't append execution provider: ${Re}.`)}},Xa=async q=>{let te=St(),ce=0,_e=[],pe=q||{};Zo(pe);try{let Re=Yo(pe.graphOptimizationLevel??"all"),xe=Qo(pe.executionMode??"sequential"),Se=typeof pe.logId=="string"?pr(pe.logId,_e):0,De=pe.logSeverityLevel??2;if(!Number.isInteger(De)||De<0||De>4)throw new Error(`log severity level is not valid: ${De}`);let Ue=pe.logVerbosityLevel??0;if(!Number.isInteger(Ue)||Ue<0||Ue>4)throw new Error(`log verbosity level is not valid: ${Ue}`);let qe=typeof pe.optimizedModelFilePath=="string"?pr(pe.optimizedModelFilePath,_e):0;if(ce=te._OrtCreateSessionOptions(Re,!!pe.enableCpuMemArena,!!pe.enableMemPattern,xe,!!pe.enableProfiling,0,Se,De,Ue,qe),ce===0&&ct("Can't create session options."),pe.executionProviders&&await Ka(ce,pe,_e),pe.enableGraphCapture!==void 0){if(typeof pe.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${pe.enableGraphCapture}`);ts(ce,"enableGraphCapture",pe.enableGraphCapture.toString(),_e)}if(pe.freeDimensionOverrides)for(let[We,Oe]of Object.entries(pe.freeDimensionOverrides)){if(typeof We!="string")throw new Error(`free dimension override name must be a string: ${We}`);if(typeof Oe!="number"||!Number.isInteger(Oe)||Oe<0)throw new Error(`free dimension override value must be a non-negative integer: ${Oe}`);let lt=pr(We,_e);te._OrtAddFreeDimensionOverride(ce,lt,Oe)!==0&&ct(`Can't set a free dimension override: ${We} - ${Oe}.`)}return pe.extra!==void 0&&ln(pe.extra,"",new WeakSet,(We,Oe)=>{ts(ce,We,Oe,_e)}),[ce,_e]}catch(Re){throw ce!==0&&te._OrtReleaseSessionOptions(ce)!==0&&ct("Can't release session options."),_e.forEach(xe=>te._free(xe)),Re}}}),$i,Qr,di,Ns,bo,Wn,Bs,hi,xt=u(()=>{$i=q=>{switch(q){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${q}`)}},Qr=q=>{switch(q){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${q}`)}},di=(q,te)=>{let ce=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][q],_e=typeof te=="number"?te:te.reduce((pe,Re)=>pe*Re,1);return ce>0?Math.ceil(_e*ce):void 0},Ns=q=>{switch(q){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${q}`)}},bo=q=>{switch(q){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${q}`)}},Wn=q=>q==="float32"||q==="float16"||q==="int32"||q==="int64"||q==="uint32"||q==="uint8"||q==="bool"||q==="uint4"||q==="int4",Bs=q=>q==="float32"||q==="float16"||q==="int32"||q==="int64"||q==="uint32"||q==="uint64"||q==="int8"||q==="uint8"||q==="bool"||q==="uint4"||q==="int4",hi=q=>{switch(q){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${q}`)}}}),Vr,Ja=u(()=>{Mi(),Vr=async q=>{if(typeof q=="string"){let te=await fetch(q);if(!te.ok)throw new Error(`failed to load external data file: ${q}`);let ce=te.headers.get("Content-Length"),_e=ce?parseInt(ce,10):0;if(_e<1073741824)return new Uint8Array(await te.arrayBuffer());{if(!te.body)throw new Error(`failed to load external data file: ${q}, no response body.`);let pe=te.body.getReader(),Re;try{Re=new ArrayBuffer(_e)}catch(Se){if(Se instanceof RangeError){let De=Math.ceil(_e/65536);Re=new WebAssembly.Memory({initial:De,maximum:De}).buffer}else throw Se}let xe=0;for(;;){let{done:Se,value:De}=await pe.read();if(Se)break;let Ue=De.byteLength;new Uint8Array(Re,xe,Ue).set(De),xe+=Ue}return new Uint8Array(Re,0,_e)}}else return q instanceof Blob?new Uint8Array(await q.arrayBuffer()):q instanceof Uint8Array?q:new Uint8Array(q)}}),Ya,ea,cn,Oi,zs,un,Nt,Ni,Hn,ws,Be,rs,ta,xo=u(()=>{Jt(),sd(),mr(),xt(),Ti(),Vn(),Ja(),Ya=(q,te)=>{St()._OrtInit(q,te)!==0&&ct("Can't initialize onnxruntime.")},ea=async q=>{Ya(q.wasm.numThreads,bo(q.logLevel))},cn=async(q,te)=>{var _e,pe;(pe=(_e=St()).asyncInit)==null||pe.call(_e);let ce=q.webgpu.adapter;if(te==="webgpu"){if(typeof navigator>"u"||!navigator.gpu)throw new Error("WebGPU is not supported in current environment");if(ce){if(typeof ce.limits!="object"||typeof ce.features!="object"||typeof ce.requestDevice!="function")throw new Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let Re=q.webgpu.powerPreference;if(Re!==void 0&&Re!=="low-power"&&Re!=="high-performance")throw new Error(`Invalid powerPreference setting: "${Re}"`);let xe=q.webgpu.forceFallbackAdapter;if(xe!==void 0&&typeof xe!="boolean")throw new Error(`Invalid forceFallbackAdapter setting: "${xe}"`);if(ce=await navigator.gpu.requestAdapter({powerPreference:Re,forceFallbackAdapter:xe}),!ce)throw new Error('Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.')}}if(te==="webnn"&&(typeof navigator>"u"||!navigator.ml))throw new Error("WebNN is not supported in current environment")},Oi=new Map,zs=q=>{let te=St(),ce=te.stackSave();try{let _e=te.PTR_SIZE,pe=te.stackAlloc(2*_e);te._OrtGetInputOutputCount(q,pe,pe+_e)!==0&&ct("Can't get session input/output count.");let Re=_e===4?"i32":"i64";return[Number(te.getValue(pe,Re)),Number(te.getValue(pe+_e,Re))]}finally{te.stackRestore(ce)}},un=(q,te)=>{let ce=St(),_e=ce.stackSave(),pe=0;try{let Re=ce.PTR_SIZE,xe=ce.stackAlloc(2*Re);ce._OrtGetInputOutputMetadata(q,te,xe,xe+Re)!==0&&ct("Can't get session input/output metadata.");let Se=Number(ce.getValue(xe,"*"));pe=Number(ce.getValue(xe+Re,"*"));let De=ce.HEAP32[pe/4];if(De===0)return[Se,0];let Ue=ce.HEAPU32[pe/4+1],qe=[];for(let We=0;We<Ue;We++){let Oe=Number(ce.getValue(pe+8+We*Re,"*"));qe.push(Oe!==0?ce.UTF8ToString(Oe):Number(ce.getValue(pe+8+(We+Ue)*Re,"*")))}return[Se,De,qe]}finally{ce.stackRestore(_e),pe!==0&&ce._OrtFree(pe)}},Nt=q=>{let te=St(),ce=te._malloc(q.byteLength);if(ce===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${q.byteLength}.`);return te.HEAPU8.set(q,ce),[ce,q.byteLength]},Ni=async(q,te)=>{var qe,We,Oe;let ce,_e,pe=St();Array.isArray(q)?[ce,_e]=q:q.buffer===pe.HEAPU8.buffer?[ce,_e]=[q.byteOffset,q.byteLength]:[ce,_e]=Nt(q);let Re=0,xe=0,Se=[],De=[],Ue=[];try{if([xe,Se]=await Xa(te),(te==null?void 0:te.externalData)&&pe.mountExternalData){let rr=[];for(let Ut of te.externalData){let Pr=typeof Ut=="string"?Ut:Ut.path;rr.push(Vr(typeof Ut=="string"?Ut:Ut.data).then(Hr=>{pe.mountExternalData(Pr,Hr)}))}await Promise.all(rr)}for(let rr of(te==null?void 0:te.executionProviders)??[])if((typeof rr=="string"?rr:rr.name)==="webnn"){if(pe.shouldTransferToMLTensor=!1,typeof rr!="string"){let Ut=rr,Pr=Ut==null?void 0:Ut.context,Hr=Ut==null?void 0:Ut.gpuDevice,Zr=Ut==null?void 0:Ut.deviceType,ko=Ut==null?void 0:Ut.powerPreference;Pr?pe.currentContext=Pr:Hr?pe.currentContext=await pe.webnnCreateMLContext(Hr):pe.currentContext=await pe.webnnCreateMLContext({deviceType:Zr,powerPreference:ko})}else pe.currentContext=await pe.webnnCreateMLContext();break}Re=await pe._OrtCreateSession(ce,_e,xe),(qe=pe.webgpuOnCreateSession)==null||qe.call(pe,Re),Re===0&&ct("Can't create a session."),(We=pe.jsepOnCreateSession)==null||We.call(pe),pe.currentContext&&(pe.webnnRegisterMLContext(Re,pe.currentContext),pe.currentContext=void 0,pe.shouldTransferToMLTensor=!0);let[lt,Ae]=zs(Re),Ye=!!(te!=null&&te.enableGraphCapture),Qt=[],At=[],Rt=[],Zt=[],gt=[];for(let rr=0;rr<lt;rr++){let[Ut,Pr,Hr]=un(Re,rr);Ut===0&&ct("Can't get an input name."),De.push(Ut);let Zr=pe.UTF8ToString(Ut);Qt.push(Zr),Rt.push(Pr===0?{name:Zr,isTensor:!1}:{name:Zr,isTensor:!0,type:Qr(Pr),shape:Hr})}for(let rr=0;rr<Ae;rr++){let[Ut,Pr,Hr]=un(Re,rr+lt);Ut===0&&ct("Can't get an output name."),Ue.push(Ut);let Zr=pe.UTF8ToString(Ut);At.push(Zr),Zt.push(Pr===0?{name:Zr,isTensor:!1}:{name:Zr,isTensor:!0,type:Qr(Pr),shape:Hr})}return Oi.set(Re,[Re,De,Ue,null,Ye,!1]),[Re,Qt,At,Rt,Zt]}catch(lt){throw De.forEach(Ae=>pe._OrtFree(Ae)),Ue.forEach(Ae=>pe._OrtFree(Ae)),Re!==0&&pe._OrtReleaseSession(Re)!==0&&ct("Can't release session."),lt}finally{pe._free(ce),xe!==0&&pe._OrtReleaseSessionOptions(xe)!==0&&ct("Can't release session options."),Se.forEach(lt=>pe._free(lt)),(Oe=pe.unmountExternalData)==null||Oe.call(pe)}},Hn=q=>{var De,Ue,qe;let te=St(),ce=Oi.get(q);if(!ce)throw new Error(`cannot release session. invalid session id: ${q}`);let[_e,pe,Re,xe,Se]=ce;xe&&(Se&&te._OrtClearBoundOutputs(xe.handle)!==0&&ct("Can't clear bound outputs."),te._OrtReleaseBinding(xe.handle)!==0&&ct("Can't release IO binding.")),(De=te.jsepOnReleaseSession)==null||De.call(te,q),(Ue=te.webnnOnReleaseSession)==null||Ue.call(te,q),(qe=te.webgpuOnReleaseSession)==null||qe.call(te,q),pe.forEach(We=>te._OrtFree(We)),Re.forEach(We=>te._OrtFree(We)),te._OrtReleaseSession(_e)!==0&&ct("Can't release session."),Oi.delete(q)},ws=async(q,te,ce,_e,pe,Re,xe=!1)=>{if(!q){te.push(0);return}let Se=St(),De=Se.PTR_SIZE,Ue=q[0],qe=q[1],We=q[3],Oe=We,lt,Ae;if(Ue==="string"&&(We==="gpu-buffer"||We==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(xe&&We!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${Re} when enableGraphCapture is true.`);if(We==="gpu-buffer"){let At=q[2].gpuBuffer;Ae=di($i(Ue),qe);{let Rt=Se.jsepRegisterBuffer;if(!Rt)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');lt=Rt(_e,Re,At,Ae)}}else if(We==="ml-tensor"){let At=q[2].mlTensor;Ae=di($i(Ue),qe);let Rt=Se.webnnRegisterMLTensor;if(!Rt)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');lt=Rt(_e,At,$i(Ue),qe)}else{let At=q[2];if(Array.isArray(At)){Ae=De*At.length,lt=Se._malloc(Ae),ce.push(lt);for(let Rt=0;Rt<At.length;Rt++){if(typeof At[Rt]!="string")throw new TypeError(`tensor data at index ${Rt} is not a string`);Se.setValue(lt+Rt*De,pr(At[Rt],ce),"*")}}else{let Rt=Se.webnnIsGraphInput,Zt=Se.webnnIsGraphOutput;if(Ue!=="string"&&Rt&&Zt){let gt=Se.UTF8ToString(pe);if(Rt(_e,gt)||Zt(_e,gt)){let rr=$i(Ue);Ae=di(rr,qe),Oe="ml-tensor";let Ut=Se.webnnCreateTemporaryTensor,Pr=Se.webnnUploadTensor;if(!Ut||!Pr)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');let Hr=await Ut(_e,rr,qe);Pr(Hr,new Uint8Array(At.buffer,At.byteOffset,At.byteLength)),lt=Hr}else Ae=At.byteLength,lt=Se._malloc(Ae),ce.push(lt),Se.HEAPU8.set(new Uint8Array(At.buffer,At.byteOffset,Ae),lt)}else Ae=At.byteLength,lt=Se._malloc(Ae),ce.push(lt),Se.HEAPU8.set(new Uint8Array(At.buffer,At.byteOffset,Ae),lt)}}let Ye=Se.stackSave(),Qt=Se.stackAlloc(4*qe.length);try{qe.forEach((Rt,Zt)=>Se.setValue(Qt+Zt*De,Rt,De===4?"i32":"i64"));let At=Se._OrtCreateTensor($i(Ue),lt,Ae,Qt,qe.length,hi(Oe));At===0&&ct(`Can't create tensor for input/output. session=${_e}, index=${Re}.`),te.push(At)}finally{Se.stackRestore(Ye)}},Be=async(q,te,ce,_e,pe,Re)=>{var ei,oa,tl;let xe=St(),Se=xe.PTR_SIZE,De=Oi.get(q);if(!De)throw new Error(`cannot run inference. invalid session id: ${q}`);let Ue=De[0],qe=De[1],We=De[2],Oe=De[3],lt=De[4];De[5];let Ae=te.length,Ye=_e.length,Qt=0,At=[],Rt=[],Zt=[],gt=[],rr=[],Ut=xe.stackSave(),Pr=xe.stackAlloc(Ae*Se),Hr=xe.stackAlloc(Ae*Se),Zr=xe.stackAlloc(Ye*Se),ko=xe.stackAlloc(Ye*Se);try{[Qt,At]=Jo(Re),Wt("wasm prepareInputOutputTensor");for(let Bt=0;Bt<Ae;Bt++)await ws(ce[Bt],Rt,gt,q,qe[te[Bt]],te[Bt],lt);for(let Bt=0;Bt<Ye;Bt++)await ws(pe[Bt],Zt,gt,q,We[_e[Bt]],Ae+_e[Bt],lt);ht("wasm prepareInputOutputTensor");for(let Bt=0;Bt<Ae;Bt++)xe.setValue(Pr+Bt*Se,Rt[Bt],"*"),xe.setValue(Hr+Bt*Se,qe[te[Bt]],"*");for(let Bt=0;Bt<Ye;Bt++)xe.setValue(Zr+Bt*Se,Zt[Bt],"*"),xe.setValue(ko+Bt*Se,We[_e[Bt]],"*");(ei=xe.jsepOnRunStart)==null||ei.call(xe,Ue),(oa=xe.webnnOnRunStart)==null||oa.call(xe,Ue);let Dr;Dr=await xe._OrtRun(Ue,Hr,Pr,Ae,ko,Ye,Zr,Qt),Dr!==0&&ct("failed to call OrtRun().");let ss=[],rl=[];Wt("wasm ProcessOutputTensor");for(let Bt=0;Bt<Ye;Bt++){let Fi=Number(xe.getValue(Zr+Bt*Se,"*"));if(Fi===Zt[Bt]||rr.includes(Zt[Bt])){ss.push(pe[Bt]),Fi!==Zt[Bt]&&xe._OrtReleaseTensor(Fi)!==0&&ct("Can't release tensor.");continue}let lc=xe.stackSave(),ks=xe.stackAlloc(4*Se),Gn=!1,wr,ti=0;try{xe._OrtGetTensorData(Fi,ks,ks+Se,ks+2*Se,ks+3*Se)!==0&&ct(`Can't access output tensor data on index ${Bt}.`);let aa=Se===4?"i32":"i64",ri=Number(xe.getValue(ks,aa));ti=xe.getValue(ks+Se,"*");let il=xe.getValue(ks+Se*2,"*"),cc=Number(xe.getValue(ks+Se*3,aa)),Cs=[];for(let br=0;br<cc;br++)Cs.push(Number(xe.getValue(il+br*Se,aa)));xe._OrtFree(il)!==0&&ct("Can't free memory for tensor dims.");let Ui=Cs.reduce((br,ar)=>br*ar,1);wr=Qr(ri);let ns=Oe==null?void 0:Oe.outputPreferredLocations[_e[Bt]];if(wr==="string"){if(ns==="gpu-buffer"||ns==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let br=[];for(let ar=0;ar<Ui;ar++){let Vi=xe.getValue(ti+ar*Se,"*"),sl=xe.getValue(ti+(ar+1)*Se,"*"),nl=ar===Ui-1?void 0:sl-Vi;br.push(xe.UTF8ToString(Vi,nl))}ss.push([wr,Cs,br,"cpu"])}else if(ns==="gpu-buffer"&&Ui>0){let br=xe.jsepGetBuffer;if(!br)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let ar=br(ti),Vi=di(ri,Ui);if(Vi===void 0||!Wn(wr))throw new Error(`Unsupported data type: ${wr}`);Gn=!0,ss.push([wr,Cs,{gpuBuffer:ar,download:xe.jsepCreateDownloader(ar,Vi,wr),dispose:()=>{xe._OrtReleaseTensor(Fi)!==0&&ct("Can't release tensor.")}},"gpu-buffer"])}else if(ns==="ml-tensor"&&Ui>0){let br=xe.webnnEnsureTensor,ar=xe.webnnIsGraphInputOutputTypeSupported;if(!br||!ar)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(di(ri,Ui)===void 0||!Bs(wr))throw new Error(`Unsupported data type: ${wr}`);if(!ar(q,wr,!1))throw new Error(`preferredLocation "ml-tensor" for ${wr} output is not supported by current WebNN Context.`);let Vi=await br(q,ti,ri,Cs,!1);Gn=!0,ss.push([wr,Cs,{mlTensor:Vi,download:xe.webnnCreateMLTensorDownloader(ti,wr),dispose:()=>{xe.webnnReleaseTensorId(ti),xe._OrtReleaseTensor(Fi)}},"ml-tensor"])}else if(ns==="ml-tensor-cpu-output"&&Ui>0){let br=xe.webnnCreateMLTensorDownloader(ti,wr)(),ar=ss.length;Gn=!0,rl.push((async()=>{let Vi=[ar,await br];return xe.webnnReleaseTensorId(ti),xe._OrtReleaseTensor(Fi),Vi})()),ss.push([wr,Cs,[],"cpu"])}else{let br=Ns(wr),ar=new br(Ui);new Uint8Array(ar.buffer,ar.byteOffset,ar.byteLength).set(xe.HEAPU8.subarray(ti,ti+ar.byteLength)),ss.push([wr,Cs,ar,"cpu"])}}finally{xe.stackRestore(lc),wr==="string"&&ti&&xe._free(ti),Gn||xe._OrtReleaseTensor(Fi)}}Oe&&!lt&&(xe._OrtClearBoundOutputs(Oe.handle)!==0&&ct("Can't clear bound outputs."),Oi.set(q,[Ue,qe,We,Oe,lt,!1]));for(let[Bt,Fi]of await Promise.all(rl))ss[Bt][2]=Fi;return ht("wasm ProcessOutputTensor"),ss}finally{(tl=xe.webnnOnRunEnd)==null||tl.call(xe,Ue),xe.stackRestore(Ut),Rt.forEach(Dr=>xe._OrtReleaseTensor(Dr)),Zt.forEach(Dr=>xe._OrtReleaseTensor(Dr)),gt.forEach(Dr=>xe._free(Dr)),Qt!==0&&xe._OrtReleaseRunOptions(Qt),At.forEach(Dr=>xe._free(Dr))}},rs=q=>{let te=St(),ce=Oi.get(q);if(!ce)throw new Error("invalid session id");let _e=ce[0],pe=te._OrtEndProfiling(_e);pe===0&&ct("Can't get an profile file name."),te._OrtFree(pe)},ta=q=>{let te=[];for(let ce of q){let _e=ce[2];!Array.isArray(_e)&&"buffer"in _e&&te.push(_e.buffer)}return te}}),Ft,mt,bs,Fs,Us,dn,qn,hn,Ai,Wr,Bi,zi,Vs,fn,is,ac,pn,mn,Qa=u(()=>{Jt(),xo(),Ti(),on(),Ft=()=>!!I.wasm.proxy&&typeof document<"u",bs=!1,Fs=!1,Us=!1,hn=new Map,Ai=(q,te)=>{let ce=hn.get(q);ce?ce.push(te):hn.set(q,[te])},Wr=()=>{if(bs||!Fs||Us||!mt)throw new Error("worker not ready")},Bi=q=>{switch(q.data.type){case"init-wasm":bs=!1,q.data.err?(Us=!0,qn[1](q.data.err)):(Fs=!0,qn[0]()),dn&&(URL.revokeObjectURL(dn),dn=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let te=hn.get(q.data.type);q.data.err?te.shift()[1](q.data.err):te.shift()[0](q.data.out);break}}},zi=async()=>{if(!Fs){if(bs)throw new Error("multiple calls to 'initWasm()' detected.");if(Us)throw new Error("previous call to 'initWasm()' failed.");if(bs=!0,Ft())return new Promise((q,te)=>{mt==null||mt.terminate(),Ko().then(([ce,_e])=>{try{mt=_e,mt.onerror=Re=>te(Re),mt.onmessage=Bi,qn=[q,te];let pe={type:"init-wasm",in:I};if(!pe.in.wasm.wasmPaths&&ce){let Re=nn();Re&&(pe.in.wasm.wasmPaths=Re)}mt.postMessage(pe),dn=ce}catch(pe){te(pe)}},te)});try{await Os(I.wasm),await ea(I),Fs=!0}catch(q){throw Us=!0,q}finally{bs=!1}}},Vs=async q=>{if(Ft())return Wr(),new Promise((te,ce)=>{Ai("init-ep",[te,ce]);let _e={type:"init-ep",in:{epName:q,env:I}};mt.postMessage(_e)});await cn(I,q)},fn=async q=>Ft()?(Wr(),new Promise((te,ce)=>{Ai("copy-from",[te,ce]);let _e={type:"copy-from",in:{buffer:q}};mt.postMessage(_e,[q.buffer])})):Nt(q),is=async(q,te)=>{if(Ft()){if(te!=null&&te.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return Wr(),new Promise((ce,_e)=>{Ai("create",[ce,_e]);let pe={type:"create",in:{model:q,options:{...te}}},Re=[];q instanceof Uint8Array&&Re.push(q.buffer),mt.postMessage(pe,Re)})}else return Ni(q,te)},ac=async q=>{if(Ft())return Wr(),new Promise((te,ce)=>{Ai("release",[te,ce]);let _e={type:"release",in:q};mt.postMessage(_e)});Hn(q)},pn=async(q,te,ce,_e,pe,Re)=>{if(Ft()){if(ce.some(xe=>xe[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(pe.some(xe=>xe))throw new Error("pre-allocated output tensor is not supported for proxy.");return Wr(),new Promise((xe,Se)=>{Ai("run",[xe,Se]);let De=ce,Ue={type:"run",in:{sessionId:q,inputIndices:te,inputs:De,outputIndices:_e,options:Re}};mt.postMessage(Ue,ta(De))})}else return Be(q,te,ce,_e,pe,Re)},mn=async q=>{if(Ft())return Wr(),new Promise((te,ce)=>{Ai("end-profiling",[te,ce]);let _e={type:"end-profiling",in:q};mt.postMessage(_e)});rs(q)}}),ra,gn,So,ia=u(()=>{Jt(),Qa(),xt(),Mi(),Ja(),ra=(q,te)=>{switch(q.location){case"cpu":return[q.type,q.dims,q.data,"cpu"];case"gpu-buffer":return[q.type,q.dims,{gpuBuffer:q.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[q.type,q.dims,{mlTensor:q.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${q.location} for ${te()}`)}},gn=q=>{switch(q[3]){case"cpu":return new $e(q[0],q[2],q[1]);case"gpu-buffer":{let te=q[0];if(!Wn(te))throw new Error(`not supported data type: ${te} for deserializing GPU tensor`);let{gpuBuffer:ce,download:_e,dispose:pe}=q[2];return $e.fromGpuBuffer(ce,{dataType:te,dims:q[1],download:_e,dispose:pe})}case"ml-tensor":{let te=q[0];if(!Bs(te))throw new Error(`not supported data type: ${te} for deserializing MLTensor tensor`);let{mlTensor:ce,download:_e,dispose:pe}=q[2];return $e.fromMLTensor(ce,{dataType:te,dims:q[1],download:_e,dispose:pe})}default:throw new Error(`invalid data location: ${q[3]}`)}},So=class{async fetchModelAndCopyToWasmMemory(q){return fn(await Vr(q))}async loadModel(q,te){jt();let ce;typeof q=="string"?ce=await this.fetchModelAndCopyToWasmMemory(q):ce=q,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await is(ce,te),$t()}async dispose(){return ac(this.sessionId)}async run(q,te,ce){jt();let _e=[],pe=[];Object.entries(q).forEach(We=>{let Oe=We[0],lt=We[1],Ae=this.inputNames.indexOf(Oe);if(Ae===-1)throw new Error(`invalid input '${Oe}'`);_e.push(lt),pe.push(Ae)});let Re=[],xe=[];Object.entries(te).forEach(We=>{let Oe=We[0],lt=We[1],Ae=this.outputNames.indexOf(Oe);if(Ae===-1)throw new Error(`invalid output '${Oe}'`);Re.push(lt),xe.push(Ae)});let Se=_e.map((We,Oe)=>ra(We,()=>`input "${this.inputNames[pe[Oe]]}"`)),De=Re.map((We,Oe)=>We?ra(We,()=>`output "${this.outputNames[xe[Oe]]}"`):null),Ue=await pn(this.sessionId,pe,Se,xe,De,ce),qe={};for(let We=0;We<Ue.length;We++)qe[this.outputNames[xe[We]]]=Re[We]??gn(Ue[We]);return $t(),qe}startProfiling(){}endProfiling(){mn(this.sessionId)}}}),xs={};p(xs,{OnnxruntimeWebAssemblyBackend:()=>Ss,initializeFlags:()=>Ws,wasmBackend:()=>vn});var Ws,Ss,vn,Za=u(()=>{Jt(),Qa(),ia(),Ws=()=>{(typeof I.wasm.initTimeout!="number"||I.wasm.initTimeout<0)&&(I.wasm.initTimeout=0);let q=I.wasm.simd;if(typeof q!="boolean"&&q!==void 0&&q!=="fixed"&&q!=="relaxed"&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${q}". Reset it to \`false\` and ignore SIMD feature checking.`),I.wasm.simd=!1),typeof I.wasm.proxy!="boolean"&&(I.wasm.proxy=!1),typeof I.wasm.trace!="boolean"&&(I.wasm.trace=!1),typeof I.wasm.numThreads!="number"||!Number.isInteger(I.wasm.numThreads)||I.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)I.wasm.numThreads=1;else{let te=typeof navigator>"u"?l("node:os").cpus().length:navigator.hardwareConcurrency;I.wasm.numThreads=Math.min(4,Math.ceil((te||1)/2))}},Ss=class{async init(q){Ws(),await zi(),await Vs(q)}async createInferenceSessionHandler(q,te){let ce=new So;return await ce.loadModel(q,te),ce}},vn=new Ss}),el={};p(el,{InferenceSession:()=>Rr,TRACE:()=>tt,TRACE_EVENT_BEGIN:()=>Wt,TRACE_EVENT_END:()=>ht,TRACE_FUNC_BEGIN:()=>jt,TRACE_FUNC_END:()=>$t,Tensor:()=>$e,default:()=>na,env:()=>I,registerBackend:()=>D}),Jt(),Jt(),Jt();var sa="1.24.3",na=vs;{let q=(Za(),m(xs)).wasmBackend;D("cpu",q,10),D("wasm",q,10)}return Object.defineProperty(I.versions,"web",{value:sa,enumerable:!0}),m(el)})();t.exports=o})(qm)),qm.exports}var Ry;function rS(){return Ry||(Ry=1,(function(t){var i=qo&&qo.__createBinding||(Object.create?(function(C,P,j,O){O===void 0&&(O=j);var F=Object.getOwnPropertyDescriptor(P,j);(!F||("get"in F?!P.__esModule:F.writable||F.configurable))&&(F={enumerable:!0,get:function(){return P[j]}}),Object.defineProperty(C,O,F)}):(function(C,P,j,O){O===void 0&&(O=j),C[O]=P[j]})),o=qo&&qo.__setModuleDefault||(Object.create?(function(C,P){Object.defineProperty(C,"default",{enumerable:!0,value:P})}):function(C,P){C.default=P}),a=qo&&qo.__importStar||function(C){if(C&&C.__esModule)return C;var P={};if(C!=null)for(var j in C)j!=="default"&&Object.prototype.hasOwnProperty.call(C,j)&&i(P,C,j);return o(P,C),P};Object.defineProperty(t,"__esModule",{value:!0}),t.MicVAD=t.getDefaultRealTimeVADOptions=t.ort=t.DEFAULT_MODEL=void 0;const f=a(tS()),S=av(),v=lv(),l=yf(),u=vm(),p=Jw(),y=Yw();t.DEFAULT_MODEL="legacy",t.ort=f;const m="vad.worklet.bundle.min.js",x="silero_vad_v5.onnx",$="silero_vad_legacy.onnx",D=C=>({...v.defaultFrameProcessorOptions,onFrameProcessed:()=>{},onVADMisfire:()=>{l.log.debug("VAD misfire")},onSpeechStart:()=>{l.log.debug("Detected speech start")},onSpeechEnd:()=>{l.log.debug("Detected speech end")},onSpeechRealStart:()=>{l.log.debug("Detected real speech start")},baseAssetPath:"./",onnxWASMBasePath:"./",model:C,workletOptions:{},getStream:async()=>await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}),pauseStream:async P=>{P.getTracks().forEach(j=>{j.stop()})},resumeStream:async()=>await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}),ortConfig:P=>{P.env.logLevel="error"},startOnLoad:!0,processorType:"auto"});t.getDefaultRealTimeVADOptions=D;const T=C=>"audioWorklet"in C&&typeof AudioWorkletNode=="function"?"AudioWorklet":"ScriptProcessor";async function g(C,P,j,O,F){await j.audioWorklet.addModule(C),P.processorOptions={...P.processorOptions??{},frameSamples:O};const I=new AudioWorkletNode(j,"vad-helper-worklet",P);return I.port.onmessage=async U=>{const Y=U.data;if(!(typeof Y=="object"&&Y&&"message"in Y)){console.error("Invalid message event",Y);return}switch(Y.message){case u.Message.AudioFrame:{if(!("data"in Y&&Y.data instanceof ArrayBuffer)){console.log("Audio frame message has no data");return}const se=new Float32Array(Y.data);await F(se);break}}},I}async function k(C,P,j){const O=new y.Resampler({nativeSampleRate:C.sampleRate,targetSampleRate:16e3,targetFrameSize:P});l.log.debug("using script processor");const I=C.createScriptProcessor(4096,1,1);let U=!1;return I.onaudioprocess=async Y=>{if(!U){U=!0;try{const se=Y.inputBuffer.getChannelData(0);Y.outputBuffer.getChannelData(0).fill(0);const ie=O.process(se);for(const ye of ie)await j(ye)}catch(se){console.error("Error processing audio:",se)}finally{U=!1}}},I.connect(C.destination),I}class w{constructor(P,j,O,F,I=!1,U=null,Y=null,se=null,de=null,ie=null,ye=null,ge="uninitialized",ke=!1){this.options=P,this.frameProcessor=j,this.model=O,this.frameSamples=F,this.listening=I,this.errored=U,this._stream=Y,this._audioContext=se,this._vadNode=de,this._mediaStreamAudioSourceNode=ie,this._audioProcessorAdapterType=ye,this.initializationState=ge,this.ownsAudioContext=ke,this.getAudioInstances=()=>{if(this._stream===null||this._audioContext===null||this._vadNode==null||this._mediaStreamAudioSourceNode==null)throw new Error("MicVAD has null stream, audio context, or processor adapter");return{stream:this._stream,audioContext:this._audioContext,vadNode:this._vadNode,mediaStreamAudioSourceNode:this._mediaStreamAudioSourceNode}},this.setErrored=be=>{this.initializationState="errored",this.errored=be},this.start=async()=>{switch(this.initializationState){case"uninitialized":{l.log.debug("initializing micVAD"),this.initializationState="initializing",this.frameProcessor.resume();try{this._stream=await this.options.getStream()}catch(be){throw be instanceof Error?this.setErrored(be.message):this.setErrored(String(be)),be}if(this.options.audioContext?(console.log("using custom audio context"),this._audioContext=this.options.audioContext):(console.log("using default audio context"),this._audioContext=new AudioContext,this.ownsAudioContext=!0),!this._audioContext)throw this.setErrored("Audio context is null"),Error("Audio context is null");switch(this._audioProcessorAdapterType=this.options.processorType=="auto"?T(this._audioContext):this.options.processorType,this._audioProcessorAdapterType){case"AudioWorklet":this._vadNode=await g(this.options.baseAssetPath+m,this.options.workletOptions,this._audioContext,this.frameSamples,this.processFrame);break;case"ScriptProcessor":this._vadNode=await k(this._audioContext,this.frameSamples,this.processFrame);break;default:throw new Error(`Unsupported audio processor adapter type: ${this._audioProcessorAdapterType}`)}this._mediaStreamAudioSourceNode=new MediaStreamAudioSourceNode(this._audioContext,{mediaStream:this._stream}),this._mediaStreamAudioSourceNode.connect(this._vadNode),l.log.debug("started micVAD"),this.listening=!0,this.initializationState="initialized";break}case"initializing":{l.log.warn("start called while initializing");break}case"initialized":{if(this.listening)return;this.listening=!0,this.frameProcessor.resume();const{stream:be,audioContext:ue,vadNode:W}=this.getAudioInstances();this._stream=await this.options.resumeStream(be);const re=new MediaStreamAudioSourceNode(ue,{mediaStream:this._stream});this._mediaStreamAudioSourceNode=re,re.connect(W);break}case"destroyed":{l.log.warn("start called after destroyed");break}case"errored":{l.log.error("start called after errored");break}default:{l.log.warn("weird initialization state");break}}},this.pause=async()=>{if(!this.listening)return;this.listening=!1;const{stream:be,mediaStreamAudioSourceNode:ue}=this.getAudioInstances();await this.options.pauseStream(be),ue.disconnect(),this.frameProcessor.pause(this.handleFrameProcessorEvent)},this.destroy=async()=>{var ue;l.log.debug("destroy called"),this.initializationState="destroyed";const{vadNode:be}=this.getAudioInstances();be instanceof AudioWorkletNode&&be.port.postMessage(u.Message.SpeechStop),this.listening&&await this.pause(),await this.model.release(),this.ownsAudioContext&&await((ue=this._audioContext)==null?void 0:ue.close())},this.setOptions=be=>{this.frameProcessor.setOptions(be)},this.processFrame=async be=>{await this.frameProcessor.process(be,this.handleFrameProcessorEvent)},this.handleFrameProcessorEvent=be=>{switch(be.msg){case u.Message.FrameProcessed:this.options.onFrameProcessed(be.probs,be.frame);break;case u.Message.SpeechStart:this.options.onSpeechStart();break;case u.Message.SpeechRealStart:this.options.onSpeechRealStart();break;case u.Message.VADMisfire:this.options.onVADMisfire();break;case u.Message.SpeechEnd:this.options.onSpeechEnd(be.audio);break}}}static async new(P={}){const j={...(0,t.getDefaultRealTimeVADOptions)(P.model??t.DEFAULT_MODEL),...P};(0,v.validateOptions)(j),t.ort.env.wasm.wasmPaths=j.onnxWASMBasePath,j.ortConfig!==void 0&&j.ortConfig(t.ort);const O=j.model==="v5"?x:$,F=j.baseAssetPath+O,I=j.model==="v5"?p.SileroV5.new:p.SileroLegacy.new;let U;try{U=await I(t.ort,()=>(0,S.defaultModelFetcher)(F))}catch(ye){throw console.error(`Encountered an error while loading model file ${F}`),ye}const Y=j.model==="v5"?512:1536,se=Y/16,de=new v.FrameProcessor(U.process,U.reset_state,{positiveSpeechThreshold:j.positiveSpeechThreshold,negativeSpeechThreshold:j.negativeSpeechThreshold,redemptionMs:j.redemptionMs,preSpeechPadMs:j.preSpeechPadMs,minSpeechMs:j.minSpeechMs,submitUserSpeechOnPause:j.submitUserSpeechOnPause},se),ie=new w(j,de,U,Y);if(j.startOnLoad)try{await ie.start()}catch(ye){throw console.error("Error starting micVad",ye),ye}return ie}}t.MicVAD=w})(qo)),qo}var Py;function iS(){return Py||(Py=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultRealTimeVADOptions=t.MicVAD=t.DEFAULT_MODEL=t.utils=t.NonRealTimeVAD=t.Message=t.FrameProcessor=t.defaultModelFetcher=t.baseAssetPath=void 0;var i=Gw();Object.defineProperty(t,"baseAssetPath",{enumerable:!0,get:function(){return i.baseAssetPath}});var o=av();Object.defineProperty(t,"defaultModelFetcher",{enumerable:!0,get:function(){return o.defaultModelFetcher}});var a=lv();Object.defineProperty(t,"FrameProcessor",{enumerable:!0,get:function(){return a.FrameProcessor}});var f=vm();Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return f.Message}});var S=Zx();Object.defineProperty(t,"NonRealTimeVAD",{enumerable:!0,get:function(){return S.NonRealTimeVAD}});const v=eS();t.utils={audioFileToArray:v.audioFileToArray,minFramesForTargetMS:v.minFramesForTargetMS,arrayBufferToBase64:v.arrayBufferToBase64,encodeWAV:v.encodeWAV};var l=rS();Object.defineProperty(t,"DEFAULT_MODEL",{enumerable:!0,get:function(){return l.DEFAULT_MODEL}}),Object.defineProperty(t,"MicVAD",{enumerable:!0,get:function(){return l.MicVAD}}),Object.defineProperty(t,"getDefaultRealTimeVADOptions",{enumerable:!0,get:function(){return l.getDefaultRealTimeVADOptions}})})(Vm)),Vm}var sS=iS();function kp(t,i,o,a){var S,v;try{(v=(S=window.api)==null?void 0:S.logs)==null||v.write(t,i,o,a)}catch{}const f=i==="error"?console.error:i==="warn"?console.warn:console.log;a!==void 0?f(`[${t}]`,o,a):f(`[${t}]`,o)}const ot={debug:(t,i,o)=>kp(t,"debug",i,o),info:(t,i,o)=>kp(t,"info",i,o),warn:(t,i,o)=>kp(t,"warn",i,o),error:(t,i,o)=>kp(t,"error",i,o)},Zw=16e3,nS=6,zu=Zw*nS,oS=800,aS=Zw*oS/1e3,Dy=500,Iy=2e3,My=1500,Ly=3e3,lS=.5,cS=.35,jy=.85,Oy=.7;let gs=null,po=!1,Ji=!1;const Eg=new Set;function Cp(t){for(const i of Array.from(Eg))try{i(t)}catch(o){ot.warn("speech","workerDeath listener threw",{error:o instanceof Error?o.message:String(o)})}}let Gm=0;const Ny=2;let Gu=!1,e0=!1;function t0(t){t.addEventListener("message",i=>{var a;if(((a=i.data)==null?void 0:a.type)!=="log")return;const o=i.data.level||"info";ot[o]("whisperWorker",i.data.message??"",i.data.meta)}),t.addEventListener("error",i=>{ot.error("whisperWorker","worker error event (fatal)",{message:i.message,filename:i.filename,lineno:i.lineno}),uS(`error:${i.message||"unknown"}`)})}function sm(){return gs||(gs=new Worker(new URL(""+new URL("whisperWorker-ivwFFLMj.js",import.meta.url).href,import.meta.url),{type:"module"}),t0(gs),ot.info("speech","worker spawned"),gs)}let Ep=!1;function uS(t){if(!Gu){if(Ep){ot.warn("speech","respawnWorker: already in flight, ignoring",{reason:t});return}if(Ep=!0,Gm+=1,e0=!0,ot.warn("speech","respawnWorker: starting",{reason:t,attempt:Gm}),Cp({reason:t,respawned:!1,finalOnly:!0}),Gm>Ny){if(Gu=!0,ot.error("speech","respawnWorker: limit exceeded, disabling speech",{limit:Ny}),gs)try{gs.terminate()}catch{}gs=null,po=!1,Ji=!1,Cp({reason:"respawn-limit-exceeded",respawned:!1,finalOnly:!0}),Ep=!1;return}if(gs)try{gs.terminate()}catch{}gs=null,po=!1,Ji=!1;try{gs=new Worker(new URL(""+new URL("whisperWorker-ivwFFLMj.js",import.meta.url).href,import.meta.url),{type:"module"}),t0(gs),Ji=!0,gs.postMessage({type:"load"}),ot.info("speech","respawnWorker: new worker spawned, load posted"),Cp({reason:t,respawned:!0,finalOnly:!0})}catch(i){Gu=!0,ot.error("speech","respawnWorker: spawn failed, disabling speech",{error:i instanceof Error?i.message:String(i)}),Cp({reason:"spawn-failed",respawned:!1,finalOnly:!0})}finally{Ep=!1}}}function dS(t,i){if(po||Ji)return;Ji=!0;const o=sm();ot.info("speech","preloadModel: posting load");const a=f=>{f.data.type==="status"?(t==null||t(f.data.status,f.data.message),f.data.status==="ready"&&(po=!0,Ji=!1,ot.info("speech","preloadModel: ready"),o.removeEventListener("message",a))):f.data.type==="progress"?i==null||i(f.data.pct):f.data.type==="error"&&(Ji=!1,ot.error("speech","preloadModel: worker reported error",{error:f.data.error}),t==null||t("error",f.data.error),o.removeEventListener("message",a))};o.addEventListener("message",a),o.postMessage({type:"load"})}function hS(){ot.info("speech","resetModel: clearing load flags"),po=!1,Ji=!1}function cv(){var t;return typeof Worker<"u"&&!!((t=navigator.mediaDevices)!=null&&t.getUserMedia)&&typeof AudioWorkletNode<"u"}function fS(t){const i=sm();return!po&&!Ji&&(Ji=!0,i.postMessage({type:"load"})),new Promise((o,a)=>{const f=S=>{var v,l,u;((v=S.data)==null?void 0:v.type)==="result"?(i.removeEventListener("message",f),o((S.data.text??"").trim())):((l=S.data)==null?void 0:l.type)==="error"?(i.removeEventListener("message",f),a(new Error(String(S.data.error??"Transcription failed")))):((u=S.data)==null?void 0:u.type)==="status"&&S.data.status==="ready"&&(po=!0,Ji=!1)};i.addEventListener("message",f),i.postMessage({type:"transcribe",audio:t},[t.buffer])})}function pS(t){let i=sm(),o=!1,a=null,f=null,S=null,v=null,l=null;const u=[],p=new Set;let y=null,m=0,x=!1,$=0,D=!1,T=!1,g=0,k=0,w=0,C=-1,P=Dy,j=0,O=null;const F=()=>(y||(y=new Float32Array(zu)),y),I=()=>{m=0},U=be=>{const ue=F(),W=be.length;if(W>=zu){ue.set(be.subarray(W-zu)),m=zu;return}if(m+W<=zu){ue.set(be,m),m+=W;return}const re=m+W-zu;ue.copyWithin(0,re,m),m-=re,ue.set(be,m),m+=W},Y=()=>{O&&(clearTimeout(O),O=null)},se=()=>{Y(),x=!1,D=!1,T=!1,P=Dy,I()},de=()=>{if(o||!x||T||D||O)return;if(m<aS){O=setTimeout(()=>{O=null,de()},P);return}const be=performance.now()-g;if(be<P&&g!==0){O=setTimeout(()=>{O=null,de()},P-be);return}if(e0||Gu||t.partialsEnabled&&!t.partialsEnabled())return;const ue=F(),W=new Float32Array(m);W.set(ue.subarray(0,m)),k+=1,w=k,D=!0,j=performance.now(),g=j,i.postMessage({type:"transcribe-partial",audio:W,seq:k},[W.buffer])},ie=be=>be.length===0?Promise.resolve():Gu?(ot.warn("speech","transcribeAudio: speech disabled (worker respawn limit hit)"),o||t.onError("Speech recognition disabled — please reload the app."),Promise.resolve()):new Promise(ue=>{u.push(ue),k+=1;const W=k;C=W,i.postMessage({type:"transcribe",audio:be,seq:W},[be.buffer])}),ye=be=>{const ue=ie(be);return p.add(ue),ue.finally(()=>{p.delete(ue)}),ue},ge=be=>{var ue,W,re,G,ne;if(be.data.type==="result"){const Pe=be.data.text,Ve=be.data.seq??0;Ve&&Ve<C&&ot.warn("speech","result: seq below latestFinalSeq (delivering anyway)",{seq:Ve,latestFinalSeq:C}),!o&&Pe&&t.onFinal(Pe),(ue=u.shift())==null||ue()}else if(be.data.type==="partial"){const Pe=be.data.seq??0,Ve=be.data.text??"",Ge=performance.now()-j;D=!1,Ge>=Ly?(T=!0,ot.warn("speech","partials.disabled.budget",{elapsedMs:Math.round(Ge),seq:Pe})):Ge>=My&&(P=Math.min(P*2,Iy),ot.warn("speech","partials.slowdown",{elapsedMs:Math.round(Ge),newIntervalMs:P,seq:Pe}));const it=Pe!==w||Pe<=C;!o&&!it&&Ve&&((W=t.onPartial)==null||W.call(t,Ve)),de()}else if(be.data.type==="partial-error"){const Pe=performance.now()-j;D=!1,Pe>=Ly?(T=!0,ot.warn("speech","partials.disabled.budget (after error)",{elapsedMs:Math.round(Pe),seq:be.data.seq})):Pe>=My&&(P=Math.min(P*2,Iy),ot.warn("speech","partials.slowdown (after error)",{elapsedMs:Math.round(Pe),newIntervalMs:P,seq:be.data.seq})),ot.warn("speech","partial encode failed",{error:be.data.error,seq:be.data.seq}),de()}else be.data.type==="error"?(o||t.onError(be.data.error),(re=u.shift())==null||re()):be.data.type==="status"?(o||(G=t.onModelStatus)==null||G.call(t,be.data.status,be.data.message),be.data.status==="ready"&&(po=!0,Ji=!1)):be.data.type==="progress"&&(o||(ne=t.onProgress)==null||ne.call(t,be.data.pct))};i.addEventListener("message",ge);const ke=be=>{var ue,W;if(!o){for(ot.warn("speech","createRecognition: worker death event",be),(ue=t.onStatusChange)==null||ue.call(t,"restarting");u.length;)(W=u.shift())==null||W();if(p.clear(),Y(),D=!1,be.respawned){try{i.removeEventListener("message",ge)}catch{}i=sm(),i.addEventListener("message",ge)}}};return Eg.add(ke),{start:async()=>{if(!o){if(Gu){t.onError("Speech recognition disabled — please reload the app.");return}!po&&!Ji&&(Ji=!0,ot.info("speech","createRecognition.start: triggering model load"),i.postMessage({type:"load"})),ot.info("speech","createRecognition.start: initializing VAD",{modelReady:po,modelLoading:Ji});try{const be=new URL("vad/",document.baseURI).href,ue=t.inputDeviceId||null,W={channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0};ue&&(W.deviceId={exact:ue}),ot.info("speech","getUserMedia",{hasDeviceId:!!ue,deviceIdPrefix:ue?ue.slice(0,8):null});const re=await navigator.mediaDevices.getUserMedia({audio:W});f=re,S=new AudioContext;for(const G of re.getAudioTracks())G.addEventListener("ended",()=>{o||(ot.warn("speech","mic track ended (permission revoked or device removed)"),t.onError("Microphone disconnected or permission revoked"))});try{l=S.createMediaStreamSource(f),v=S.createAnalyser(),v.fftSize=2048,v.smoothingTimeConstant=.3,l.connect(v)}catch(G){ot.warn("speech","analyser init failed",{error:G instanceof Error?G.message:String(G)}),l=null,v=null}a=await sS.MicVAD.new({audioContext:S,getStream:async()=>re,resumeStream:async()=>re,pauseStream:async()=>{},baseAssetPath:be,onnxWASMBasePath:be,model:"v5",positiveSpeechThreshold:lS,negativeSpeechThreshold:cS,minSpeechMs:250,redemptionMs:600,preSpeechPadMs:300,submitUserSpeechOnPause:!0,onFrameProcessed:(G,ne)=>{o||x&&(U(ne),de())},onSpeechStart:()=>{var G;o||(se(),x=!0,$=performance.now(),(G=t.onSpeechStart)==null||G.call(t))},onSpeechEnd:G=>{var ne;o||((ne=t.onStatusChange)==null||ne.call(t,"transcribing"),se(),ye(G))},onVADMisfire:()=>{var G,ne;o||((G=t.onStatusChange)==null||G.call(t,"idle"),se(),(ne=t.onMisfire)==null||ne.call(t))}}),a.start()}catch(be){const ue=be instanceof Error?be.message:"Microphone access denied",W=be instanceof Error?be.stack:"";if(ot.error("speech","createRecognition.start: VAD init failed",{error:ue,stack:W}),v){try{v.disconnect()}catch{}v=null}if(l){try{l.disconnect()}catch{}l=null}if(f){try{f.getTracks().forEach(re=>re.stop())}catch{}f=null}if(S){try{await S.close()}catch{}S=null}t.onError(ue)}}},stop:async()=>{if(a)try{await a.pause()}catch{}for(se();p.size>0;)await Promise.all(Array.from(p));if(a){try{await a.destroy()}catch{}a=null}if(v){try{v.disconnect()}catch{}v=null}if(l){try{l.disconnect()}catch{}l=null}if(f){try{f.getTracks().forEach(be=>be.stop())}catch{}f=null}if(S){try{await S.close()}catch{}S=null}},setVadThresholds:(be,ue)=>{if(a)try{a.setOptions({positiveSpeechThreshold:be,negativeSpeechThreshold:ue})}catch(W){ot.warn("speech","setVadThresholds failed",{error:W instanceof Error?W.message:String(W)})}},getAnalyser:()=>v,destroy:()=>{if(o=!0,se(),a){try{a.destroy()}catch{}a=null}if(v){try{v.disconnect()}catch{}v=null}if(l){try{l.disconnect()}catch{}l=null}if(S){try{S.close()}catch{}S=null}if(f){try{f.getTracks().forEach(be=>be.stop())}catch{}f=null}Eg.delete(ke),i.removeEventListener("message",ge)}}}let sf=null;const Tg=new Set,$g=new Set;function mS(){for(const t of Tg)try{t()}catch{}}function Ag(){for(const t of $g)try{t()}catch{}}function gS(t){return t.replace(/```[\s\S]*?```/g,"").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/\*{1,3}([^*]+)\*{1,3}/g,"$1").replace(/_{1,3}([^_]+)_{1,3}/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/^[-*_]{3,}\s*$/gm,"").replace(/^>\s?/gm,"").replace(/^[\s]*[-*+]\s/gm,"").replace(/^[\s]*\d+\.\s/gm,"").trim()}function vS(t){if(!window.speechSynthesis)return;const i=gS(t);if(!i)return;const o=new SpeechSynthesisUtterance(i);o.rate=1,o.pitch=1,o.onstart=()=>{sf=performance.now(),mS()},o.onend=()=>{!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&(sf=null,Ag())},o.onerror=a=>{a.error!=="canceled"&&!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&(sf=null,Ag())},window.speechSynthesis.speak(o)}function r0(){window.speechSynthesis&&(window.speechSynthesis.cancel(),sf=null,Ag())}function i0(){var t;return((t=window.speechSynthesis)==null?void 0:t.speaking)??!1}function yS(){return sf}function _S(t){return Tg.add(t),()=>{Tg.delete(t)}}function wS(t){return $g.add(t),()=>{$g.delete(t)}}const bS=.5,xS=.35;function SS(t){i0()&&(t.setVadThresholds(jy,Oy),ot.info("voice","tts.duck.on",{reason:"already-speaking-on-attach"}));const i=_S(()=>{t.setVadThresholds(jy,Oy),ot.info("voice","tts.duck.on")}),o=wS(()=>{t.setVadThresholds(bS,xS),ot.info("voice","tts.duck.off")});return()=>{i(),o()}}const kS=[{match:/^(send|submit|enter)\.?$/i,data:"\r",label:"send"},{match:/^(cancel|escape)\.?$/i,data:"\x1B",label:"cancel"},{match:/^clear( line)?\.?$/i,data:"",label:"clear"}];function CS(t){const i=t.trim();return kS.find(o=>o.match.test(i))??null}const ES=5e3;let Yl=null;function Km(){Yl&&clearTimeout(Yl),Yl=setTimeout(()=>{Yl=null,wt.getState().stopRecording()},ES)}function Tp(){Yl&&(clearTimeout(Yl),Yl=null)}let Ql=null;function TS(t){Ql&&clearTimeout(Ql);const i=wt.getState().submitDelayMs;wt.setState({submitCountdownStartAt:performance.now()}),Ql=setTimeout(()=>{Ql=null,wt.setState({submitCountdownStartAt:null});try{window.api.pty.write({tabId:t,data:"\r"})}catch(o){ot.warn("voice","submit pty.write failed",{error:o instanceof Error?o.message:String(o)})}wt.getState().stopRecording()},i)}function Gh(){Ql&&(clearTimeout(Ql),Ql=null),wt.getState().submitCountdownStartAt!==null&&wt.setState({submitCountdownStartAt:null})}let ci=null,Ii=null;function $S(){var t;return((t=ci==null?void 0:ci.getAnalyser)==null?void 0:t.call(ci))??null}const $p=1e4;let nf=null;function Ap(){nf&&(clearTimeout(nf),nf=null)}let Hp=null,qp=null;function Rp(){Hp=null,qp&&(qp(),qp=null)}const AS=1500,RS=9e4;let Pp=0,Gp=null,Rg=-1;function Dp(){Gp&&(clearTimeout(Gp),Gp=null,Rg=-1)}const PS=new Set(["you","You","Thank you.","Thanks for watching.","Thanks for watching!","Thank you for watching.","Thank you for watching!",".","Bye.","Bye!"]),wt=vf((t,i)=>({isRecording:!1,ttsEnabled:!1,autoSubmit:!0,submitDelayMs:3e3,submitCountdownStartAt:null,lastTranscript:"",lastPartial:"",statusPill:"idle",partialsEnabled:!0,error:null,errorKind:null,modelStatus:"idle",loadingProgress:0,permissionState:"unknown",lastBargeInAt:null,hotkeyState:"idle",levelMeterEnabled:!0,turnDetectorState:"disabled",turnDetectorMode:"off",wizardArmed:!1,wizardOpen:!1,initModel:()=>{if(i().modelStatus!=="idle")return;ot.info("voice","initModel: kicking off preload"),t({modelStatus:"loading",error:null,errorKind:null,loadingProgress:0});const o=++Pp,a=()=>{o===Pp&&(Dp(),Rg=o,Gp=setTimeout(()=>{Rg===o&&i().modelStatus==="loading"&&(ot.warn("voice","mic.gate.timeout: no progress within 90s"),t({modelStatus:"error",error:"Model load timed out",errorKind:"timeout"}))},RS))};a(),dS((f,S)=>{o===Pp&&(f==="ready"?(Dp(),ot.info("voice","modelStatus -> ready"),t({modelStatus:"ready",loadingProgress:100,errorKind:null})):f==="error"?(Dp(),ot.error("voice","modelStatus -> error",{msg:S}),t({modelStatus:"error",error:S,errorKind:"load"})):t({modelStatus:"loading"}))},f=>{o===Pp&&(a(),t({loadingProgress:Math.round(f)}))})},resetAndRetryModel:()=>{ot.info("voice","mic.gate.retry"),Dp(),hS(),t({modelStatus:"idle",error:null,errorKind:null,loadingProgress:0}),i().initModel()},startRecording:o=>{if(i().isRecording)return;if(ci){ot.warn("voice","startRecording: prior handle still draining, ignoring");return}if(!cv()){t({error:"Microphone or Web Worker not available",errorKind:"recording"});return}const a=f=>{try{const S=pS({inputDeviceId:f,onStatusChange:v=>{t(v==="transcribing"?{statusPill:"transcribing"}:v==="restarting"?{statusPill:"restarting"}:{statusPill:"idle"})},onPartial:v=>{i().partialsEnabled&&t({lastPartial:v})},partialsEnabled:()=>i().partialsEnabled,onSpeechStart:()=>{if(t({statusPill:"listening",lastPartial:""}),Tp(),Gh(),i0()){const l=yS(),u=l!==null?performance.now()-l:null;r0(),t({lastBargeInAt:performance.now()}),ot.info("voice","barge-in",{tabId:o,utteranceOffsetMs:u})}else ot.debug("voice","barge-in.no-op",{tabId:o})},onMisfire:()=>{t({lastPartial:"",statusPill:"idle"}),Km();const v=i().lastBargeInAt;v!==null&&performance.now()-v<600&&ot.warn("voice","barge-in.misfire",{tabId:o,sinceBargeInMs:Math.round(performance.now()-v)})},onFinal:v=>{Km();const l=v.trim();if(!l||PS.has(l)){t({lastTranscript:"",lastPartial:"",statusPill:"idle"});return}const u=CS(l);if(u){ot.info("voice","voice-command",{tabId:o,label:u.label,transcript:l}),window.api.pty.write({tabId:o,data:u.data}),t({lastTranscript:"",lastPartial:"",statusPill:"idle"}),Gh();const y=window;y.__transcripts&&(y.__transcripts.push({tabId:o,text:l}),y.__transcripts.length>500&&y.__transcripts.shift());return}window.api.pty.write({tabId:o,data:l}),t({lastTranscript:"",lastPartial:"",statusPill:"idle"}),i().autoSubmit&&TS(o);const p=window;p.__transcripts&&(p.__transcripts.push({tabId:o,text:l}),p.__transcripts.length>500&&p.__transcripts.shift())},onError:v=>{ot.error("voice","recognition error",{err:v}),t({error:v,errorKind:"recording",isRecording:!1,lastPartial:"",statusPill:"idle"}),Ii==null||Ii(),Ii=null,Tp(),ci==null||ci.destroy(),ci=null},onModelStatus:v=>{v==="ready"?t({modelStatus:"ready",loadingProgress:100}):v==="loading"&&t({modelStatus:"loading"})},onProgress:v=>t({loadingProgress:Math.round(v)})});ci=S,t({isRecording:!0,error:null,lastTranscript:"",lastPartial:"",statusPill:"listening"}),Km(),S.start().then(()=>{ci===S&&(Ii==null||Ii(),Ii=SS(S))}).catch(v=>{ot.error("voice","handle.start() failed",{error:v instanceof Error?v.message:String(v)})})}catch(S){t({error:S instanceof Error?S.message:"Failed to start recording",errorKind:"recording"})}};Promise.resolve().then(()=>{var f,S,v;return((v=(S=(f=window.api)==null?void 0:f.voice)==null?void 0:S.getDevicePref)==null?void 0:v.call(S))??Promise.resolve(null)}).then(f=>a((f==null?void 0:f.selectedDeviceId)??null)).catch(f=>{ot.warn("voice","getDevicePref failed; using default device",{error:f instanceof Error?f.message:String(f)}),a(null)})},stopRecording:()=>{const o=ci;o&&(Tp(),Gh(),Ii==null||Ii(),Ii=null,t({isRecording:!1,lastTranscript:"",lastPartial:"",statusPill:"idle"}),o.stop().finally(()=>{o.destroy(),ci===o&&(ci=null),i().hotkeyState==="stopping"&&(Ap(),t({hotkeyState:"idle"}))}))},restartWithDevice:async()=>{if(!i().isRecording)return;const o=ci;if(!o)return;Tp(),Ii==null||Ii(),Ii=null,t({isRecording:!1,lastTranscript:"",lastPartial:""});try{await o.stop()}catch(S){ot.warn("voice","restartWithDevice: drain rejected",{error:S instanceof Error?S.message:String(S)})}o.destroy(),ci===o&&(ci=null);const{useSessions:a}=await qw(async()=>{const{useSessions:S}=await Promise.resolve().then(()=>zx);return{useSessions:S}},[],import.meta.url),f=a.getState().activeTabId;f&&i().startRecording(f)},toggleTTS:()=>t(o=>({ttsEnabled:!o.ttsEnabled})),setAutoSubmit:o=>t({autoSubmit:o}),setSubmitDelayMs:o=>t({submitDelayMs:Math.max(500,Math.min(1e4,Math.floor(o)))}),cancelSubmit:()=>Gh(),setPartialsEnabled:o=>{i().partialsEnabled!==o&&(t({partialsEnabled:o}),o||t({lastPartial:""}))},clearError:()=>t({error:null,errorKind:null}),setPermissionState:o=>{i().permissionState!==o&&(ot.info("voice","mic.gate.permission_changed",{from:i().permissionState,to:o}),t({permissionState:o}))},setLevelMeterEnabled:o=>{i().levelMeterEnabled!==o&&t({levelMeterEnabled:o})},setTurnDetectorRuntimeState:o=>{i().turnDetectorState!==o&&(t({turnDetectorState:o}),o==="load_failed"?ot.warn("voice-turn","voice-turn.load_failed"):o==="runtime_error"?ot.warn("voice-turn","voice-turn.runtime_error"):o==="disabled"&&ot.info("voice-turn","voice-turn.fallback_to_vad"))},setWizardArmed:o=>{i().wizardArmed!==o&&t({wizardArmed:o})},openWizard:()=>{i().wizardOpen||t({wizardOpen:!0})},closeWizard:()=>{i().wizardOpen&&t({wizardOpen:!1})},armHotkey:({phase:o,source:a,mode:f,tabId:S})=>{const v=i(),{canRecord:l,reason:u}=Pg(v);if(o==="down"){if(u==="error"||u==="load-timeout"){v.resetAndRetryModel(),ot.info("voice-hotkey","down.retry",{source:a,reason:u});return}if(!l&&u!=="loading"){ot.warn("voice-hotkey","miss-model-loading",{modelStatus:v.modelStatus,reason:u});return}if(v.hotkeyState==="recording"||v.isRecording){(f==="toggle"||a==="global")&&(t({hotkeyState:"stopping"}),Ap(),nf=setTimeout(()=>{i().hotkeyState==="stopping"&&(ot.warn("voice-hotkey","drain-timeout",{durationMs:$p}),t({hotkeyState:"aborted"}),setTimeout(()=>{i().hotkeyState==="aborted"&&t({hotkeyState:"idle"})},0))},$p),v.stopRecording());return}if(u==="loading"){v.hotkeyState!=="armed"&&(t({hotkeyState:"armed"}),ot.info("voice-hotkey","armed",{source:a,modelStatus:v.modelStatus})),Rp(),Hp={tabId:S,source:a,mode:f},qp=wt.subscribe((p,y)=>{if(Hp&&p.modelStatus==="ready"&&y.modelStatus!=="ready"&&p.hotkeyState==="armed"){const m=Hp;if(Rp(),!m.tabId){ot.warn("voice-hotkey","armed-promote-no-tab",{source:m.source}),t({hotkeyState:"idle"});return}ot.info("voice-hotkey","armed-promote",m),t({hotkeyState:"recording"}),wt.getState().startRecording(m.tabId)}});return}if(!S){ot.warn("voice-hotkey","no-active-tab",{source:a});return}ot.info("voice-hotkey","start",{source:a,mode:f,tabId:S}),v.startRecording(S),i().isRecording?t({hotkeyState:"recording"}):(ot.warn("voice-hotkey","start: recording did not engage",{errorKind:i().errorKind}),t({hotkeyState:"idle"}));return}if(!(f!=="hold"||a==="global")){if(v.hotkeyState==="armed"){Rp(),ot.info("voice-hotkey","miss-model-loading-armed-up"),t({hotkeyState:"idle"});return}v.hotkeyState==="recording"&&(t({hotkeyState:"stopping"}),Ap(),nf=setTimeout(()=>{i().hotkeyState==="stopping"&&(ot.warn("voice-hotkey","drain-timeout",{durationMs:$p}),t({hotkeyState:"aborted"}),setTimeout(()=>{i().hotkeyState==="aborted"&&t({hotkeyState:"idle"})},0))},$p),v.stopRecording())}},destroyHotkey:()=>{const o=i();if(Rp(),Gh(),o.hotkeyState==="recording"){ot.warn("voice-hotkey","destroyed-mid-recording"),t({hotkeyState:"destroyed"});try{o.stopRecording()}catch{}}else(o.hotkeyState==="armed"||o.hotkeyState==="stopping")&&(Ap(),t({hotkeyState:"destroyed"}))}})),Pg=t=>cv()?t.permissionState==="denied"?{canRecord:!1,reason:"permission-denied"}:t.modelStatus==="ready"?{canRecord:!0,reason:"ready"}:t.modelStatus==="loading"?{canRecord:!1,reason:"loading"}:t.modelStatus==="error"?{canRecord:!1,reason:t.errorKind==="timeout"?"load-timeout":"error"}:{canRecord:!1,reason:"idle"}:{canRecord:!1,reason:"unsupported"};if(typeof window<"u"){const t=window;t.__voice=wt,t.__transcripts=[]}function DS(t,i={}){switch(t){case"ready":return i.isRecording?"Stop voice input":"Start voice input (local Whisper, offline)";case"idle":return"Microphone — speech model not started";case"loading":return`Microphone — loading speech model, ${typeof i.loadingPct=="number"?Math.round(i.loadingPct):0} percent`;case"error":return i.errorMessage?`Microphone — speech model error: ${i.errorMessage}. Activate to retry.`:"Microphone — speech model error. Activate to retry.";case"load-timeout":return"Microphone — model load timed out. Activate to retry.";case"permission-denied":return"Microphone — permission denied. Open OS settings.";case"unsupported":return"Microphone — voice input not supported in this build."}}const By=t=>Symbol.iterator in t,zy=t=>"entries"in t,Fy=(t,i)=>{const o=t instanceof Map?t:new Map(t.entries()),a=i instanceof Map?i:new Map(i.entries());if(o.size!==a.size)return!1;for(const[f,S]of o)if(!a.has(f)||!Object.is(S,a.get(f)))return!1;return!0},IS=(t,i)=>{const o=t[Symbol.iterator](),a=i[Symbol.iterator]();let f=o.next(),S=a.next();for(;!f.done&&!S.done;){if(!Object.is(f.value,S.value))return!1;f=o.next(),S=a.next()}return!!f.done&&!!S.done};function MS(t,i){return Object.is(t,i)?!0:typeof t!="object"||t===null||typeof i!="object"||i===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(i)?!1:By(t)&&By(i)?zy(t)&&zy(i)?Fy(t,i):IS(t,i):Fy({entries:()=>Object.entries(t)},{entries:()=>Object.entries(i)})}function LS(t){const i=Ln.useRef(void 0);return o=>{const a=t(o);return MS(i.current,a)?i.current:i.current=a}}let Uy=0;const jS=1e3;function OS(t){const i=performance.now();i-Uy<jS||(Uy=i,ot.debug("voice","mic.gate.click_rejected",{reason:t}))}function NS(){const t=wt(p=>p.isRecording),i=wt(p=>p.error),o=wt(p=>p.loadingProgress),a=wt(LS(Pg)),f=()=>{const p=wt.getState(),{canRecord:y,reason:m}=Pg(p);if(p.isRecording)return p.stopRecording();if(p.wizardArmed&&!p.wizardOpen){p.openWizard();return}if(m==="error"||m==="load-timeout"){p.resetAndRetryModel();return}if(!y)return OS(m);const x=zt.getState().activeTabId;x&&p.startRecording(x)},S=DS(a.reason,{loadingPct:o,errorMessage:i,isRecording:t}),v=a.reason==="unsupported",l=!a.canRecord,u=a.reason==="loading"?"text-fg-faint animate-pulse cursor-wait":a.reason==="error"||a.reason==="load-timeout"?"text-red-400 cursor-pointer":a.reason==="permission-denied"?"text-amber-400 cursor-pointer":a.reason==="idle"?"text-fg-faint cursor-pointer":a.reason==="unsupported"?"text-fg-faint cursor-not-allowed":t?"text-red-400 ring-2 ring-red-400 animate-pulse":"text-fg-dim hover:text-fg";return h.jsx("button",{onClick:f,disabled:v,"aria-disabled":l,"aria-label":S,title:S,"data-testid":"mic-button","data-state":a.reason,className:`p-1.5 rounded transition-colors ${u}`,children:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"9",y:"1",width:"6",height:"12",rx:"3"}),h.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),h.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),h.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"})]})})}function BS(){const t=wt(o=>o.ttsEnabled),i=wt(o=>o.toggleTTS);return h.jsxs("button",{onClick:i,title:t?"Read Claude replies aloud: ON":"Read Claude replies aloud: OFF",className:`px-1.5 py-1 rounded transition-colors flex items-center gap-1 ${t?"text-accent":"text-fg-dim hover:text-fg"}`,children:[h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),t?h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),h.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}):h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),h.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]})]}),h.jsx("span",{className:"text-[10px] font-medium tracking-wide",children:"TTS"})]})}function zS(t){return/^monitor of /i.test(t.trim())}function Vy(t){return t.replace(/\s*\([^)]*\)\s*$/,"").replace(/\s*#\d+\s*$/,"").replace(/\s+/g," ").trim().toLowerCase()}function Wy(t,i,o){if(t){const v=o.find(l=>l.deviceId===t);if(v)return v}if(!i)return null;const a=o.filter(v=>v.label===i);if(a.length===1)return a[0];if(a.length>1)return null;const f=Vy(i),S=o.filter(v=>v.label&&Vy(v.label)===f);return S.length===1?S[0]:null}async function Hy(t){var o;return(o=navigator.mediaDevices)!=null&&o.enumerateDevices?(await navigator.mediaDevices.enumerateDevices()).filter(a=>!(a.kind!=="audioinput"||a.label&&zS(a.label))):[]}const qy=!1;function s0(){const t=wt(p=>p.isRecording);wt(p=>p.startRecording),wt(p=>p.stopRecording);const[i,o]=X.useState([]),[a,f]=X.useState(null),[S,v]=X.useState(null);X.useEffect(()=>{let p=!1;return(async()=>{try{const y=await window.api.voice.getDevicePref();if(p)return;const m=await Hy(qy);if(p)return;o(m),v(y.selectedLabel);const x=Wy(y.selectedDeviceId,y.selectedLabel,m);x?(f(x.deviceId),y.selectedDeviceId&&x.deviceId!==y.selectedDeviceId&&(ot.info("voice","device-picker rebind-by-label",{fromIdPrefix:y.selectedDeviceId.slice(0,8),toIdPrefix:x.deviceId.slice(0,8)}),await window.api.voice.setDevicePref({selectedDeviceId:x.deviceId,selectedLabel:x.label||y.selectedLabel}).catch(()=>{}))):((y.selectedDeviceId||y.selectedLabel)&&(console.warn("[MicDevicePicker] previously-selected device unavailable; falling back to OS default",{savedLabel:y.selectedLabel,hadId:!!y.selectedDeviceId}),ot.warn("voice","device-picker selected-unavailable",{hadId:!!y.selectedDeviceId})),f(null))}catch(y){ot.warn("voice","device-picker init failed",{error:y instanceof Error?y.message:String(y)})}})(),()=>{p=!0}},[]);const l=X.useCallback(async()=>{try{const p=await Hy(qy);if(o(p),a&&!p.some(y=>y.deviceId===a)){const y=Wy(null,S,p);y?(f(y.deviceId),await window.api.voice.setDevicePref({selectedDeviceId:y.deviceId,selectedLabel:y.label||S}).catch(()=>{})):f(null)}}catch(p){ot.warn("voice","device-picker refresh failed",{error:p instanceof Error?p.message:String(p)})}},[a,S]);X.useEffect(()=>{const p=()=>{l()};return window.addEventListener("mic-device-change",p),()=>window.removeEventListener("mic-device-change",p)},[l]);const u=async p=>{var $;const y=p.target.value,m=y===""?null:y,x=m?(($=i.find(D=>D.deviceId===m))==null?void 0:$.label)??null:null;f(m),v(x);try{await window.api.voice.setDevicePref({selectedDeviceId:m,selectedLabel:x}),ot.info("voice","device-picker selected",{deviceIdPrefix:m?m.slice(0,8):null})}catch(D){ot.warn("voice","setDevicePref failed",{error:D instanceof Error?D.message:String(D)})}if(t)try{await wt.getState().restartWithDevice()}catch(D){ot.warn("voice","device-picker restart failed",{error:D instanceof Error?D.message:String(D)})}};return h.jsxs("select",{value:a??"",onChange:u,onFocus:()=>{l()},title:"Microphone input device","data-testid":"mic-device-picker",className:"text-[10px] bg-bg border border-line text-fg-dim hover:text-fg rounded px-1.5 py-1 max-w-[8rem] truncate",children:[h.jsx("option",{value:"",children:"Default"}),i.map(p=>h.jsx("option",{value:p.deviceId,children:p.label||`Mic ${p.deviceId.slice(0,6)}`},p.deviceId))]})}function FS(){const t=wt($=>$.isRecording),i=wt($=>$.levelMeterEnabled),[o,a]=X.useState(0),[f,S]=X.useState(0),v=X.useRef(0);v.current=f;const[l,u]=X.useState(0),[p,y]=X.useState(!1),m=X.useRef(null);if(X.useEffect(()=>{if(!t||!i){a(0),S(0);return}let $=0,D=!1,T=null,g=null;const k=()=>{if(D)return;const C=g??$S();if(!C){$=requestAnimationFrame(k);return}g!==C&&(g=C,T=new Uint8Array(new ArrayBuffer(C.fftSize)));const P=T;C.getByteTimeDomainData(P);let j=0;for(let U=0;U<P.length;U++){const Y=P[U]-128;j+=Y*Y}const O=Math.sqrt(j/P.length)/128,F=O>0?20*Math.log10(O):-60,I=Math.max(0,Math.min(1,(F+60)/60));S(O),a(I),O>=.95&&(y(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>y(!1),150)),$=requestAnimationFrame(k)};$=requestAnimationFrame(k);const w=setInterval(()=>{D||u(Math.round(v.current*100))},250);return()=>{D=!0,cancelAnimationFrame($),clearInterval(w),m.current&&(clearTimeout(m.current),m.current=null)}},[t,i]),!t||!i)return null;const x=p?"bg-red-500":f>=.7?"bg-amber-400":"bg-green-500";return h.jsx("div",{role:"meter","aria-label":"Microphone input level","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":100,"data-testid":"mic-level-meter",className:`mx-3 mb-2 h-1 rounded bg-bg overflow-hidden ${p?"ring-1 ring-red-500":""}`,children:h.jsx("div",{className:`h-full ${x} transition-[width] duration-75 ease-out`,style:{width:`${o*100}%`}})})}const US=5,VS=1440*60*1e3,n0="sm.scheduler.hiddenCompletedSlugs";function WS(){try{const t=localStorage.getItem(n0);if(!t)return new Set;const i=JSON.parse(t);return Array.isArray(i)?new Set(i.filter(o=>typeof o=="string")):new Set}catch{return new Set}}function Gy(t){try{localStorage.setItem(n0,JSON.stringify([...t]))}catch{}}function HS(t){if(!t)return null;const i=t.replace(/\/+$/,"").split("/");return i[i.length-1]||t}function qS(){const[t,i]=X.useState(null),[o,a]=X.useState(()=>Date.now()),[f,S]=X.useState(()=>WS()),[v,l]=X.useState(!1);X.useEffect(()=>{let O=null;return window.api.schedule.state().then(i).catch(()=>{}),O=window.api.schedule.onState(i),()=>{O&&O()}},[]),X.useEffect(()=>{const O=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(O)},[]);const u=X.useMemo(()=>{if(!t)return 15e4;const O=[];for(const F of t.jobs)if(F.status==="completed"&&F.startedAt&&F.finishedAt){const I=Date.parse(F.finishedAt)-Date.parse(F.startedAt);I>0&&O.push(I)}return O.length===0?15e4:O.reduce((F,I)=>F+I,0)/O.length},[t]);if(!t)return null;const{config:p,jobs:y,paused:m,lastRunAt:x,nextReset:$}=t,D={pending:0,running:0,completed:0,failed:0};for(const O of y)(O.status==="pending"||O.status==="running"||O.status==="completed"||O.status==="failed")&&D[O.status]++;const T=GS({snap:t,now:o,avgDurationMs:u}),g=KS(y),{inline:k,collapsedCount:w}=XS(y,f,o,v),C=()=>{const O=new Set(f);for(const F of y)F.status==="completed"&&O.add(F.slug);S(O),Gy(O)},P=()=>{S(new Set),Gy(new Set),l(!1)},j=k.some(O=>O.status==="completed");return h.jsxs("div",{className:"bg-bg-elev/60",children:[h.jsxs("div",{className:`px-3 py-2 ${YS(T.kind)}`,title:T.tooltip,children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(JS,{kind:T.kind}),h.jsx("div",{className:"text-[11px] font-medium truncate",children:T.line1})]}),T.action&&h.jsx("button",{type:"button",onClick:T.action.onClick,className:"text-[10px] px-1.5 py-0.5 border border-line hover:border-fg-faint rounded shrink-0 hover:bg-bg",title:T.action.title,children:T.action.label})]}),T.line2&&h.jsx("div",{className:"text-[10px] text-fg-faint mt-0.5 truncate font-mono",children:T.line2})]}),h.jsxs("div",{className:"px-3 pb-3 pt-2 space-y-2 border-t border-line",children:[h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-fg-faint",children:[h.jsxs("label",{className:"flex items-center gap-1",children:[h.jsx("span",{children:"policy"}),h.jsxs("select",{value:p.firePolicy??"when-available",onChange:O=>window.api.schedule.setConfig({firePolicy:O.target.value}),className:"bg-bg border border-line rounded px-1 py-0.5",title:"when-available: poll usage and fire when tokens are below threshold. on-reset: fire after each 5h reset. manual: only on Run now.",children:[h.jsx("option",{value:"when-available",children:"when available"}),h.jsx("option",{value:"on-reset",children:"on reset"}),h.jsx("option",{value:"manual",children:"manual"})]})]}),h.jsxs("label",{className:"flex items-center gap-1",title:"Max simultaneous jobs within a parallel group",children:[h.jsx("span",{children:"parallel"}),h.jsx("input",{type:"number",min:1,max:20,value:p.concurrencyCap,onChange:O=>window.api.schedule.setConfig({concurrencyCap:Number(O.target.value)}),className:"w-10 bg-bg border border-line rounded px-1 py-0.5 font-mono"})]}),p.firePolicy==="when-available"&&h.jsxs("label",{className:"flex items-center gap-1",title:"Fire only when 5h utilization is below this percent",children:[h.jsx("span",{children:"util<"}),h.jsx("input",{type:"number",min:0,max:100,value:p.utilizationThreshold??90,onChange:O=>window.api.schedule.setConfig({utilizationThreshold:Number(O.target.value)}),className:"w-10 bg-bg border border-line rounded px-1 py-0.5 font-mono"}),h.jsx("span",{children:"%"})]})]}),h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-fg-faint",children:[h.jsx("button",{type:"button",onClick:()=>window.api.schedule.runNow(),disabled:D.pending===0&&D.running===0,className:"px-2 py-0.5 text-fg-dim hover:text-fg border border-line hover:border-fg-faint rounded disabled:opacity-40 disabled:cursor-not-allowed",title:"Execute all pending jobs now (clears any pause)",children:"Run now"}),h.jsxs("div",{className:"flex-1 text-right font-mono",children:[D.pending,"p · ",D.running,"r · ",D.completed,"d",D.failed>0&&h.jsxs("span",{className:"text-red-400",children:[" · ",D.failed,"f"]})]}),j&&h.jsx("button",{type:"button",onClick:C,className:"px-1.5 py-0.5 text-fg-faint hover:text-fg-dim hover:border-fg-faint border border-line rounded",title:"Hide completed jobs from this view (queue.json unchanged — they remain in history)",children:"Clear done"})]}),h.jsxs("div",{className:"space-y-0.5 max-h-72 overflow-y-auto",children:[y.length===0&&h.jsxs("div",{className:"text-[10px] text-fg-faint italic",children:["No PRDs queued. Drop .md files in:",h.jsx("button",{type:"button",onClick:()=>window.api.schedule.openFolder(),className:"block mt-1 text-fg-dim hover:text-fg underline truncate w-full text-left",children:"~/.claude/session-manager/scheduled-plans/prds/"})]}),k.map(O=>h.jsx(ZS,{job:O,eta:QS(O,y,g.get(O.slug)??0,u,T.kind,o),now:o},O.slug)),w>0&&h.jsxs("button",{type:"button",onClick:()=>l(O=>!O),className:"w-full text-left text-[10px] text-fg-faint hover:text-fg-dim px-1.5 py-1",title:v?"Re-collapse old/cleared completed":"Show all completed (incl. cleared and >24h)",children:[v?"▾":"▸"," ",w," more completed",f.size>0&&h.jsx("span",{className:"ml-2 underline",onClick:O=>{O.stopPropagation(),P()},children:"un-hide"})]})]}),h.jsxs("div",{className:"flex items-center justify-between text-[9px] text-fg-faint pt-1 border-t border-line",children:[h.jsxs("span",{children:[$&&h.jsxs("span",{title:`next 5h reset: ${$}`,children:["reset ",Ku(Date.parse($)-o)]}),x&&h.jsxs("span",{className:"ml-2",title:x,children:["last run ",Ku(o-Date.parse(x))," ago"]})]}),h.jsx("button",{type:"button",onClick:()=>window.api.schedule.openFolder(),className:"hover:text-fg-dim underline",children:"folder"})]})]})]})}function GS({snap:t,now:i,avgDurationMs:o}){const{config:a,jobs:f,paused:S,nextReset:v,utilization:l}=t;let u=0,p=0,y=null;for(const T of f)T.status==="pending"?u++:T.status==="completed"?p++:T.status==="running"&&!y&&(y=T);const x=u+(y?1:0);if(y){const T=y,g=T.startedAt?i-Date.parse(T.startedAt):0,k=p+1,w=p+x;return{kind:"running",line1:`Running ${k}/${w} · ${Dg(g)}`,line2:T.title,tooltip:`${T.slug} (group ${T.parallelGroup})`}}if(S){const T=S.resumeAt?Date.parse(S.resumeAt)-i:null;return{kind:"paused",line1:S.reason==="rate_limit"?"Paused — tokens exhausted":`Paused — ${S.reason}`,line2:T!==null&&T>0?`auto-resume ${Xm(Date.parse(S.resumeAt))} (in ${Ku(T)})`:S.resumeAt?"resuming…":"no auto-resume scheduled",tooltip:S.resumeAt??"",action:{label:"Resume",onClick:()=>window.api.schedule.resume(),title:"Clear the pause and resume queue immediately"}}}if(x===0)return{kind:"idle",line1:"No work queued",line2:null};const $=a.firePolicy??"when-available";if($==="manual")return{kind:"manual",line1:`Manual · ${u} pending`,line2:"click Run now to fire",action:{label:"Run now",onClick:()=>window.api.schedule.runNow(),title:"Execute all pending jobs now"}};if($==="on-reset"){if(!v)return{kind:"on-reset",line1:"On-reset · waiting for billing data",line2:null};const T=Date.parse(v)+a.offsetMinutes*6e4,g=T-i;return{kind:"on-reset",line1:`On-reset · ${u} pending`,line2:g>0?`fires ${Xm(T)} (in ${Ku(g)})`:"firing now…"}}const D=a.utilizationThreshold??90;if(l==null)return{kind:"auto-soon",line1:`Auto · ${u} pending`,line2:"checking token availability…"};if(l>=D){const T=v?Date.parse(v)-i:null;return{kind:"auto-throttled",line1:`Auto · throttled (util ${l.toFixed(0)}% ≥ ${D}%)`,line2:T&&T>0?`next reset ${Xm(Date.parse(v))} (in ${Ku(T)})`:"will fire when usage drops"}}return{kind:"auto-soon",line1:`Auto · ${u} pending · util ${l.toFixed(0)}%`,line2:"fires within 2 min (poll cycle)"}}function KS(t){const i=t.filter(a=>a.status==="running"||a.status==="pending").sort((a,f)=>a.parallelGroup-f.parallelGroup||a.slug.localeCompare(f.slug)),o=new Map;return i.forEach((a,f)=>o.set(a.slug,f)),o}function XS(t,i,o,a){if(a)return{inline:t,collapsedCount:0};const f=t.filter(p=>p.status==="completed").sort((p,y)=>{const m=p.finishedAt?Date.parse(p.finishedAt):0;return(y.finishedAt?Date.parse(y.finishedAt):0)-m}),S=new Set;let v=0;for(const p of f){if(v>=US)break;i.has(p.slug)||p.finishedAt&&o-Date.parse(p.finishedAt)>VS||(S.add(p.slug),v++)}const l=[];let u=0;for(const p of t){if(p.status!=="completed"){l.push(p);continue}S.has(p.slug)?l.push(p):u++}return{inline:l,collapsedCount:u}}function JS({kind:t}){return t==="running"?h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse shrink-0"}):t==="paused"?h.jsx("span",{className:"text-[11px] shrink-0",title:"paused",children:"⏸"}):t==="manual"?h.jsx("span",{className:"text-[11px] shrink-0",title:"manual",children:"✋"}):t==="on-reset"||t==="auto-soon"?h.jsx("span",{className:"text-[11px] shrink-0",title:"auto",children:"⏰"}):t==="auto-throttled"?h.jsx("span",{className:"text-[11px] shrink-0",title:"throttled",children:"⏳"}):h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-fg-faint/40 shrink-0"})}function YS(t){return t==="running"?"bg-accent/5":t==="paused"?"bg-amber-500/10":t==="auto-throttled"?"bg-amber-500/5":""}function QS(t,i,o,a,f,S){if(t.status!=="pending"||f==="paused"||f==="manual"||f==="auto-throttled")return null;let v=o*a;if(o>0){const l=i.find(u=>u.status==="running"&&u.startedAt);l&&l.startedAt&&(v-=Math.min(a,S-Date.parse(l.startedAt)))}return v<=5e3?"~now":`~+${Ku(v)}`}function ZS({job:t,eta:i,now:o}){const[a,f]=X.useState(!1),S=t.status==="running"?"bg-accent animate-pulse":t.status==="completed"?"bg-green-500":t.status==="failed"?"bg-red-400":"bg-fg-faint/40";let v=null;t.status==="running"&&t.startedAt?v=Dg(o-Date.parse(t.startedAt)):t.status==="completed"&&t.startedAt&&t.finishedAt?v=Dg(Date.parse(t.finishedAt)-Date.parse(t.startedAt)):i&&(v=i);const l=HS(t.cwd);return h.jsxs("div",{className:"text-[11px]",children:[h.jsxs("button",{type:"button",onClick:()=>f(u=>!u),className:"w-full flex items-center gap-2 px-1.5 py-1 hover:bg-bg-hi rounded text-left",title:t.title,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S}`}),h.jsx("span",{className:"truncate flex-1 text-fg-dim",children:t.title}),l&&h.jsx("span",{className:"font-mono text-[9px] text-fg-faint shrink-0 px-1 rounded bg-bg/50",title:t.cwd??"",children:l}),v&&h.jsx("span",{className:"font-mono text-[9px] text-fg-faint shrink-0",children:v})]}),a&&h.jsxs("div",{className:"px-3 py-1 text-[10px] text-fg-faint space-y-1 bg-bg/50 rounded",children:[h.jsxs("div",{className:"font-mono",children:["g",t.parallelGroup," · ",t.slug]}),t.cwd&&h.jsxs("div",{className:"font-mono truncate",title:t.cwd,children:["cwd: ",t.cwd]}),t.exitCode!==null&&h.jsxs("div",{className:t.exitCode===0?"text-green-500":"text-red-400",children:["exit ",t.exitCode]}),t.error&&h.jsx("div",{className:"text-red-400 break-all",children:t.error}),h.jsxs("div",{className:"flex gap-2 pt-1",children:[t.status!=="pending"&&h.jsx("button",{type:"button",onClick:()=>window.api.schedule.resetJob(t.slug),className:"text-fg-dim hover:text-fg underline",children:"reset to pending"}),t.runId&&h.jsx("button",{type:"button",onClick:async()=>{const u=await window.api.schedule.readLog(t.runId,t.slug);if(u.ok&&u.text){const p=window.open("","_blank");p&&(p.document.body.innerText=u.text,p.document.title=`${t.slug} — ${t.runId}`)}},className:"text-fg-dim hover:text-fg underline",children:"view log"})]})]})]})}function Dg(t){t<0&&(t=0);const i=Math.floor(t/1e3);if(i<60)return`${i}s`;const o=Math.floor(i/60);return o<60?`${o}m${(i%60).toString().padStart(2,"0")}s`:`${Math.floor(o/60)}h${(o%60).toString().padStart(2,"0")}m`}function Ku(t){t<0&&(t=0);const i=Math.floor(t/1e3);if(i<60)return`${i}s`;const o=Math.floor(i/60);return o<60?`${o}m`:`${Math.floor(o/60)}h${o%60?` ${o%60}m`:""}`}function Xm(t){return new Date(t).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",timeZoneName:"short"})}function e1(){const t=wt(p=>p.submitCountdownStartAt),i=wt(p=>p.submitDelayMs),[o,a]=X.useState(()=>performance.now());if(X.useEffect(()=>{if(t===null)return;let p;const y=()=>{a(performance.now()),p=requestAnimationFrame(y)};return p=requestAnimationFrame(y),()=>cancelAnimationFrame(p)},[t]),t===null)return null;const f=o-t,S=Math.max(0,i-f),v=Math.max(0,Math.min(100,S/i*100)),l=S<500,u=wt.getState().cancelSubmit;return h.jsx("div",{className:"px-3 pb-1",onClick:u,title:`Submitting in ${(S/1e3).toFixed(1)}s — click to cancel`,children:h.jsx("div",{className:"h-0.5 w-full bg-bg rounded overflow-hidden cursor-pointer",children:h.jsx("div",{className:`h-full transition-colors ${l?"bg-amber-400":"bg-accent"}`,style:{width:`${v}%`}})})})}function t1(t,i,o){return{tabId:t,sessionUuid:o,cwd:i,path:null,todos:[],lastToolUses:[],plans:[],agents:[],usage:{inputTokens:0,outputTokens:0},lastEventAt:0}}const ki=vf((t,i)=>({tabs:{},refs:{},unsubs:{},subscribe:(o,a,f)=>{const S={...i().refs};if(S[o]=(S[o]??0)+1,t({refs:S}),S[o]>1)return;t({tabs:{...i().tabs,[o]:t1(o,a,f)}});const v=window.api.transcripts.onEvent(o,l=>i().ingest(o,l));t({unsubs:{...i().unsubs,[o]:v}}),window.api.transcripts.subscribe({tabId:o,cwd:a,sessionUuid:f}).then(async l=>{const u=i().tabs[o];if(!u)return;t({tabs:{...i().tabs,[o]:{...u,path:l.path}}});const p=await window.api.transcripts.buffer(o);for(const y of p)i().ingest(o,y,{replay:!0})}).catch(l=>console.error("[live] transcripts.subscribe failed:",o,l))},unsubscribe:o=>{const a={...i().refs};if(!a[o])return;if(a[o]--,a[o]>0){t({refs:a});return}delete a[o];const f=i().unsubs[o];f==null||f();const S={...i().unsubs};delete S[o];const v={...i().tabs};delete v[o],window.api.transcripts.unsubscribe(o),t({refs:a,unsubs:S,tabs:v})},ingest:(o,a,f)=>{const S=i().tabs[o];if(!S)return;const v={...S,lastEventAt:f!=null&&f.replay?S.lastEventAt:Date.now()};switch(a.kind){case"todo_write":{const l=Array.isArray(a.data)?a.data:[];v.todos=l;break}case"tool_use":{const l=a.data;v.lastToolUses=[{id:l.id,name:l.name,input:l.input,at:Date.now()},...S.lastToolUses].slice(0,50);break}case"plan":{const l=a.data,u=typeof l=="string"?l:(l==null?void 0:l.plan)??JSON.stringify(l);v.plans=[{at:Date.now(),content:u??""},...S.plans];break}case"agent_spawn":{const l=a.data;v.agents=[{at:Date.now(),subagentType:l==null?void 0:l.subagent_type,description:l==null?void 0:l.description},...S.agents].slice(0,50);break}case"usage":{const l=a.data;v.usage={inputTokens:(S.usage.inputTokens||0)+(l.input_tokens??l.inputTokens??0),outputTokens:(S.usage.outputTokens||0)+(l.output_tokens??l.outputTokens??0),cacheCreationInputTokens:(S.usage.cacheCreationInputTokens||0)+(l.cache_creation_input_tokens??l.cacheCreationInputTokens??0),cacheReadInputTokens:(S.usage.cacheReadInputTokens||0)+(l.cache_read_input_tokens??l.cacheReadInputTokens??0)};break}}t({tabs:{...i().tabs,[o]:v}})}})),r1=[{key:"overview",label:"Overview"},{key:"terminal",label:"Terminal"},{key:"system-prompt",label:"System Prompt"},{key:"settings",label:"Settings"},{key:"permissions",label:"Permissions"},{key:"skills",label:"Skills"},{key:"plugins",label:"Plugins"},{key:"mcp",label:"MCP Servers"},{key:"hooks",label:"Hooks"},{key:"subagents",label:"Subagents",liveKind:"subagents"},{key:"plans",label:"Plans"},{key:"tasks",label:"Tasks",liveKind:"tasks"},{key:"projects",label:"Projects"},{key:"history",label:"History"},{key:"keybindings",label:"Keybindings"},{key:"usage",label:"Usage"},{key:"agent-view",label:"Agent-View",liveKind:"agentView"}],o0="sm.leftNavWidth",Jm=240,a0=200,l0=420,i1={subagents:"A subagent was spawned in the last minute",tasks:"A task is currently in progress",agentView:"Claude is working right now"};function s1(){const t=ki(f=>f.tabs),[i,o]=X.useState(()=>Date.now());X.useEffect(()=>{const f=setInterval(()=>o(Date.now()),5e3);return()=>clearInterval(f)},[]);const a=Object.values(t);return{subagents:a.some(f=>f.agents.some(S=>i-S.at<6e4)),tasks:a.some(f=>f.todos.some(S=>S.status==="in_progress")),agentView:a.some(f=>f.lastEventAt>0&&i-f.lastEventAt<5e3)}}function n1(){try{const t=localStorage.getItem(o0);if(!t)return Jm;const i=parseInt(t,10);return Number.isFinite(i)?Math.max(a0,Math.min(l0,i)):Jm}catch{return Jm}}function o1(t){try{localStorage.setItem(o0,String(t))}catch{}}function a1({onResize:t}){const i=X.useRef(!1),o=X.useRef(0),a=X.useCallback(f=>{f.preventDefault(),i.current=!0,o.current=f.clientX,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const S=l=>{if(!i.current)return;const u=l.clientX-o.current;o.current=l.clientX,t(u)},v=()=>{i.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",S),window.addEventListener("mouseup",v)},[t]);return h.jsx("div",{onMouseDown:a,className:"absolute top-0 right-0 h-full w-1 cursor-col-resize hover:bg-accent/40 active:bg-accent/60 transition-colors z-10",title:"Drag to resize"})}function l1(t,i){try{const o=localStorage.getItem(`sm.leftNav.section.${t}.collapsed`);return o===null?i:o==="1"}catch{return i}}function c1(t,i){try{localStorage.setItem(`sm.leftNav.section.${t}.collapsed`,i?"1":"0")}catch{}}function uv({title:t,storageKey:i,defaultCollapsed:o=!1,badge:a,children:f}){const[S,v]=X.useState(()=>l1(i,o)),l=()=>{const u=!S;v(u),c1(i,u)};return h.jsxs("div",{className:"border-t border-line",children:[h.jsxs("button",{type:"button",onClick:l,className:"w-full px-3 py-1.5 flex items-center justify-between text-[10px] uppercase tracking-wider text-fg-faint hover:text-fg-dim",children:[h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx("span",{children:t}),a]}),h.jsx("span",{children:S?"▸":"▾"})]}),!S&&f]})}function u1({active:t,onChange:i,onNewSession:o}){const a=s1(),[f,S]=X.useState(()=>n1()),v=X.useCallback(l=>{S(u=>{const p=Math.max(a0,Math.min(l0,u+l));return o1(p),p})},[]);return h.jsxs("nav",{className:"bg-bg-elev border-r border-line shrink-0 overflow-hidden flex flex-col relative",style:{width:`${f}px`},children:[h.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:r1.map(l=>{const u=l.liveKind?a[l.liveKind]:!1,p=l.liveKind&&u?i1[l.liveKind]:void 0;return h.jsxs("button",{onClick:()=>i(l.key),title:p,className:`w-full text-left px-4 py-1.5 text-xs flex items-center justify-between transition-colors ${t===l.key?"bg-bg-hi text-fg border-l-2 border-accent":"text-fg-dim hover:text-fg hover:bg-bg-hi border-l-2 border-transparent"}`,children:[h.jsx("span",{children:l.label}),u&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})]},l.key)})}),o&&h.jsxs("div",{className:"shrink-0 max-h-[60vh] overflow-y-auto",children:[h.jsx(d1,{}),h.jsx(h1,{}),h.jsx(m1,{onNewSession:o})]}),h.jsx(a1,{onResize:v})]})}function d1(){const[t,i]=X.useState(0),[o,a]=X.useState("idle");X.useEffect(()=>{let v=null;const l=u=>{if(!u)return;const p=u.jobs.filter(x=>x.status==="pending").length,y=u.jobs.some(x=>x.status==="running"),m=u.paused?"paused":y?"running":"idle";i(x=>x===p?x:p),a(x=>x===m?x:m)};return window.api.schedule.state().then(l).catch(()=>{}),v=window.api.schedule.onState(l),()=>{v&&v()}},[]);const f=t>0||o!=="idle",S=h.jsxs("span",{className:"flex items-center gap-1",children:[t>0&&h.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg text-fg-dim font-mono normal-case tracking-normal",children:t}),o==="running"&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse",title:"running"}),o==="paused"&&h.jsx("span",{className:"text-amber-400",title:"paused",children:"⏸"})]});return h.jsx(uv,{title:"Scheduler",storageKey:"scheduler",defaultCollapsed:!f,badge:S,children:h.jsx(qS,{})})}function h1(){const t=wt(a=>a.isRecording),i=wt(a=>a.error),o=h.jsxs("span",{className:"flex items-center gap-1",children:[t&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse",title:"recording"}),i&&h.jsx("span",{className:"text-red-400",title:i,children:"⚠"})]});return h.jsxs(uv,{title:"Microphone",storageKey:"microphone",defaultCollapsed:!1,badge:o,children:[h.jsx(v1,{}),h.jsx(e1,{}),h.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 flex-wrap",children:[h.jsx(NS,{}),h.jsx(s0,{}),h.jsx(BS,{})]}),h.jsx(f1,{}),h.jsxs("div",{className:"px-3 pb-2 flex items-center gap-3 flex-wrap",children:[h.jsx("button",{type:"button",onClick:()=>wt.getState().openWizard(),className:"text-[10px] text-fg-faint hover:text-fg-dim underline","data-testid":"run-mic-check",children:"Run mic check"}),h.jsx(g1,{})]}),h.jsx(FS,{})]})}function f1(){const t=wt(S=>S.isRecording),[i,o]=X.useState(null);if(X.useEffect(()=>{let S=!1;window.api.voice.getHotkeyConfig().then(l=>{S||o(l)}).catch(()=>{});const v=window.api.voice.onHotkeyConfigChanged(l=>o(l));return()=>{S=!0,v()}},[]),t||!i)return null;const a=i.mode==="hold"?"Hold":"Press",f=p1(i.accelerator);return h.jsxs("div",{className:"px-3 pb-1 text-[10px] text-fg-faint",children:[h.jsxs("span",{children:[a," "]}),h.jsx("kbd",{className:"px-1 py-0.5 rounded border border-line bg-bg font-mono text-fg-dim",children:f}),h.jsx("span",{children:" to record"})]})}function p1(t){const i=typeof navigator<"u"&&/Mac/.test(navigator.platform);return t.replace(/CommandOrControl/g,i?"⌘":"Ctrl").replace(/CmdOrCtrl/g,i?"⌘":"Ctrl").replace(/Command/g,"⌘").replace(/Control/g,"Ctrl").replace(/Option/g,i?"⌥":"Alt").replace(/Shift/g,i?"⇧":"Shift")}function m1({onNewSession:t}){return h.jsx(uv,{title:"Session",storageKey:"session",defaultCollapsed:!1,children:h.jsx("div",{className:"px-3 py-2",children:h.jsx("button",{onClick:t,className:"w-full px-3 py-1.5 text-xs text-fg-dim hover:text-fg bg-bg hover:bg-bg-hi border border-line rounded transition-colors",children:"+ New Session"})})})}function g1(){const[t,i]=X.useState(null);if(X.useEffect(()=>{let a=!1;window.api.voice.getHotkeyConfig().then(S=>{a||i(S)}).catch(S=>ot.warn("voice-hotkey","getHotkeyConfig (toggle) failed",{error:String(S)}));const f=window.api.voice.onHotkeyConfigChanged(S=>{i(S)});return()=>{a=!0,f()}},[]),!t)return null;const o=async a=>{if(t.mode===a)return;const f={...t,mode:a};i(f);try{await window.api.voice.setHotkeyConfig(f)}catch(S){ot.warn("voice-hotkey","setHotkeyConfig (toggle) failed",{error:S instanceof Error?S.message:String(S)})}};return h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-fg-faint select-none",title:"Mic hotkey behavior. Tap on/off: press once to start, again to stop. Hold to talk: record only while held (push-to-talk).",children:[h.jsxs("label",{className:"flex items-center gap-0.5 cursor-pointer hover:text-fg-dim",children:[h.jsx("input",{type:"radio",name:"hotkey-mode",checked:t.mode==="toggle",onChange:()=>o("toggle"),className:"cursor-pointer","data-testid":"hotkey-mode-toggle"}),h.jsx("span",{children:"Tap on/off"})]}),h.jsxs("label",{className:"flex items-center gap-0.5 cursor-pointer hover:text-fg-dim",children:[h.jsx("input",{type:"radio",name:"hotkey-mode",checked:t.mode==="hold",onChange:()=>o("hold"),className:"cursor-pointer","data-testid":"hotkey-mode-hold"}),h.jsx("span",{children:"Hold to talk"})]})]})}function v1(){const t=wt(S=>S.isRecording),i=wt(S=>S.lastTranscript),o=wt(S=>S.error),a=wt(S=>S.modelStatus),f=wt(S=>S.loadingProgress);return o?h.jsxs("div",{className:"px-3 py-2 text-[11px] text-red-400 truncate",title:o,children:["⚠ ",o]}):t?h.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 text-[11px] text-fg-dim border-b border-line",children:[h.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-red-400 animate-pulse shrink-0"}),h.jsx("span",{className:"truncate",title:i,children:i||"Listening…"})]}):a==="loading"?h.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-faint",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{children:"Loading speech model"}),h.jsxs("span",{className:"font-mono",children:[f,"%"]})]}),h.jsx("div",{className:"h-1 rounded bg-bg overflow-hidden",children:h.jsx("div",{className:"h-full bg-accent transition-[width] duration-200",style:{width:`${f}%`}})})]}):null}const Ky=6e4,Xy=3e4,y1=1e3,La={value:null,ts:0},Ym=new Map;function _1(t){if(!t)return"—";const i=Date.parse(t);if(Number.isNaN(i))return"—";const o=i-Date.now();if(o<=0)return"0m";const a=Math.floor(o/36e5),f=Math.floor(o%36e5/6e4);return`${a}h ${f}m`}function w1(){var C;const t=zt(P=>P.tabs),i=zt(P=>P.activeTabId),o=zt(P=>P.restartTab),a=t.find(P=>P.id===i)??null,f=ki(P=>{var j;return i?((j=P.tabs[i])==null?void 0:j.lastEventAt)??0:0}),[S,v]=X.useState(null),[l,u]=X.useState(La.value),[p,y]=X.useState(null),[,m]=X.useState(0);X.useEffect(()=>{const P=window.setInterval(()=>m(j=>j+1),y1);return()=>window.clearInterval(P)},[]),X.useEffect(()=>{let P=!1;const j=(a==null?void 0:a.presetId)??null;if(!j){v(null);return}return Vw(j).then(O=>{P||v((O==null?void 0:O.model)??null)}).catch(()=>{P||v(null)}),()=>{P=!0}},[a==null?void 0:a.presetId]),X.useEffect(()=>{let P=!1;const j=async()=>{const F=Date.now();if(La.value&&F-La.ts<Ky){P||u(La.value);return}try{const I=await window.api.billing.fetch();if(P)return;La.value=I,La.ts=Date.now(),u(I)}catch{if(P)return;La.value=null,La.ts=Date.now(),u(null)}};j();const O=window.setInterval(j,Ky);return()=>{P=!0,window.clearInterval(O)}},[]);const x=(a==null?void 0:a.cwd)??null;if(X.useEffect(()=>{let P=!1;if(!x){y(null);return}const j=async()=>{const F=Date.now(),I=Ym.get(x);if(I&&F-I.ts<Xy){P||y(I.value);return}try{const U=await window.api.app.gitBranch(x);if(P)return;Ym.set(x,{value:U,ts:Date.now()}),y(U)}catch{if(P)return;Ym.set(x,{value:null,ts:Date.now()}),y(null)}};j();const O=window.setInterval(j,Xy);return()=>{P=!0,window.clearInterval(O)}},[x]),!a)return h.jsx("div",{className:"h-6 bg-bg-elev border-t border-line flex items-center px-3 gap-4 text-xs text-fg-faint shrink-0"});const $=l!=null&&l.ok?((C=l.data)==null?void 0:C.usage.five_hour)??null:null,D=$?`${Math.round($.utilization)}%`:"—",T=$?_1($.resets_at):"—",g=S??"—",k=p??"—",w=f>0?`${Math.max(0,Math.floor((Date.now()-f)/1e3))}s`:"—";return h.jsxs("div",{className:"h-6 bg-bg-elev border-t border-line flex items-center px-3 gap-3 text-xs shrink-0 overflow-x-auto",children:[h.jsxs("div",{className:"font-mono text-fg-dim flex items-center gap-1 whitespace-nowrap tabular-nums",children:[h.jsx(Kh,{label:"model",value:g}),h.jsx(Ip,{}),h.jsx(Kh,{label:"5h",value:D}),h.jsx(Ip,{}),h.jsx(Kh,{label:"reset",value:T}),h.jsx(Ip,{}),h.jsx(Kh,{label:"branch",value:k}),h.jsx(Ip,{}),h.jsx(Kh,{label:"last",value:w})]}),h.jsx("div",{className:"flex-1"}),a.status==="running"&&h.jsx("button",{onClick:()=>o(a.id),className:"text-fg-faint hover:text-fg transition-colors whitespace-nowrap",title:"Restart session — kill claude and start fresh (picks up config changes)",children:"restart session"}),h.jsx("button",{onClick:()=>window.api.app.rebootApp(),className:"text-fg-faint hover:text-fg transition-colors whitespace-nowrap",title:"Restart Session Manager — reload app code (Ctrl+Shift+R)",children:"restart app"}),h.jsxs("span",{className:"truncate max-w-md text-fg-faint",children:["cwd: ",h.jsx("span",{className:"text-fg-dim font-mono",children:a.cwd})]})]})}function Kh({label:t,value:i}){return h.jsxs("span",{children:[h.jsxs("span",{className:"text-fg-faint",children:[t,":"]}),h.jsx("span",{className:"text-fg-dim",children:i})]})}function Ip(){return h.jsx("span",{className:"text-fg-faint",children:"·"})}var Qm={exports:{}},Jy;function b1(){return Jy||(Jy=1,(function(t,i){(function(o,a){t.exports=a()})(globalThis,(()=>(()=>{var o={4567:function(v,l,u){var p=this&&this.__decorate||function(w,C,P,j){var O,F=arguments.length,I=F<3?C:j===null?j=Object.getOwnPropertyDescriptor(C,P):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(w,C,P,j);else for(var U=w.length-1;U>=0;U--)(O=w[U])&&(I=(F<3?O(I):F>3?O(C,P,I):O(C,P))||I);return F>3&&I&&Object.defineProperty(C,P,I),I},y=this&&this.__param||function(w,C){return function(P,j){C(P,j,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=u(9042),x=u(9924),$=u(844),D=u(4725),T=u(2585),g=u(3656);let k=l.AccessibilityManager=class extends $.Disposable{constructor(w,C,P,j){super(),this._terminal=w,this._coreBrowserService=P,this._renderService=j,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let O=0;O<this._terminal.rows;O++)this._rowElements[O]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[O]);if(this._topBoundaryFocusListener=O=>this._handleBoundaryFocus(O,0),this._bottomBoundaryFocusListener=O=>this._handleBoundaryFocus(O,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((O=>this._handleResize(O.rows)))),this.register(this._terminal.onRender((O=>this._refreshRows(O.start,O.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((O=>this._handleChar(O)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2877
|
+
*/var Ay;function tS(){return Ay||(Ay=1,(function(t,i){var o=(()=>{var a=Object.defineProperty,f=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,v=Object.prototype.hasOwnProperty,l=(q=>typeof tn<"u"?tn:typeof Proxy<"u"?new Proxy(q,{get:(te,ce)=>(typeof tn<"u"?tn:te)[ce]}):q)(function(q){if(typeof tn<"u")return tn.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')}),u=(q,te)=>()=>(q&&(te=q(q=0)),te),p=(q,te)=>{for(var ce in te)a(q,ce,{get:te[ce],enumerable:!0})},y=(q,te,ce,_e)=>{if(te&&typeof te=="object"||typeof te=="function")for(let pe of S(te))!v.call(q,pe)&&pe!==ce&&a(q,pe,{get:()=>te[pe],enumerable:!(_e=f(te,pe))||_e.enumerable});return q},m=q=>y(a({},"__esModule",{value:!0}),q),x,$,D,T,g,k=u(()=>{x=new Map,$=[],D=(q,te,ce)=>{if(te&&typeof te.init=="function"&&typeof te.createInferenceSessionHandler=="function"){let _e=x.get(q);if(_e===void 0)x.set(q,{backend:te,priority:ce});else{if(_e.priority>ce)return;if(_e.priority===ce&&_e.backend!==te)throw new Error(`cannot register backend "${q}" using priority ${ce}`)}if(ce>=0){let pe=$.indexOf(q);pe!==-1&&$.splice(pe,1);for(let Re=0;Re<$.length;Re++)if(x.get($[Re]).priority<=ce){$.splice(Re,0,q);return}$.push(q)}return}throw new TypeError("not a valid backend")},T=async q=>{let te=x.get(q);if(!te)return"backend not found.";if(te.initialized)return te.backend;if(te.aborted)return te.error;{let ce=!!te.initPromise;try{return ce||(te.initPromise=te.backend.init(q)),await te.initPromise,te.initialized=!0,te.backend}catch(_e){return ce||(te.error=`${_e}`,te.aborted=!0),te.error}finally{delete te.initPromise}}},g=async q=>{let te=q.executionProviders||[],ce=te.map(De=>typeof De=="string"?De:De.name),_e=ce.length===0?$:ce,pe,Re=[],xe=new Set;for(let De of _e){let Ue=await T(De);typeof Ue=="string"?Re.push({name:De,err:Ue}):(pe||(pe=Ue),pe===Ue&&xe.add(De))}if(!pe)throw new Error(`no available backend found. ERR: ${Re.map(De=>`[${De.name}] ${De.err}`).join(", ")}`);for(let{name:De,err:Ue}of Re)ce.includes(De)&&console.warn(`removing requested execution provider "${De}" from session options because it is not available: ${Ue}`);let Se=te.filter(De=>xe.has(typeof De=="string"?De:De.name));return[pe,new Proxy(q,{get:(De,Ue)=>Ue==="executionProviders"?Se:Reflect.get(De,Ue)})]}}),w=u(()=>{k()}),C,P=u(()=>{C="1.24.3"}),j,O,F=u(()=>{P(),j="warning",O={wasm:{},webgl:{},webgpu:{},versions:{common:C},set logLevel(q){if(q!==void 0){if(typeof q!="string"||["verbose","info","warning","error","fatal"].indexOf(q)===-1)throw new Error(`Unsupported logging level: ${q}`);j=q}},get logLevel(){return j}},Object.defineProperty(O,"logLevel",{enumerable:!0})}),I,U=u(()=>{F(),I=O}),Y,se,de=u(()=>{Y=(q,te)=>{let ce=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);ce.width=q.dims[3],ce.height=q.dims[2];let _e=ce.getContext("2d");if(_e!=null){let pe,Re;(te==null?void 0:te.tensorLayout)!==void 0&&te.tensorLayout==="NHWC"?(pe=q.dims[2],Re=q.dims[3]):(pe=q.dims[3],Re=q.dims[2]);let xe=(te==null?void 0:te.format)!==void 0?te.format:"RGB",Se=te==null?void 0:te.norm,De,Ue;Se===void 0||Se.mean===void 0?De=[255,255,255,255]:typeof Se.mean=="number"?De=[Se.mean,Se.mean,Se.mean,Se.mean]:(De=[Se.mean[0],Se.mean[1],Se.mean[2],0],Se.mean[3]!==void 0&&(De[3]=Se.mean[3])),Se===void 0||Se.bias===void 0?Ue=[0,0,0,0]:typeof Se.bias=="number"?Ue=[Se.bias,Se.bias,Se.bias,Se.bias]:(Ue=[Se.bias[0],Se.bias[1],Se.bias[2],0],Se.bias[3]!==void 0&&(Ue[3]=Se.bias[3]));let qe=Re*pe,We=0,Oe=qe,lt=qe*2,Ae=-1;xe==="RGBA"?(We=0,Oe=qe,lt=qe*2,Ae=qe*3):xe==="RGB"?(We=0,Oe=qe,lt=qe*2):xe==="RBG"&&(We=0,lt=qe,Oe=qe*2);for(let Ye=0;Ye<Re;Ye++)for(let Qt=0;Qt<pe;Qt++){let At=(q.data[We++]-Ue[0])*De[0],Rt=(q.data[Oe++]-Ue[1])*De[1],Zt=(q.data[lt++]-Ue[2])*De[2],gt=Ae===-1?255:(q.data[Ae++]-Ue[3])*De[3];_e.fillStyle="rgba("+At+","+Rt+","+Zt+","+gt+")",_e.fillRect(Qt,Ye,1,1)}if("toDataURL"in ce)return ce.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},se=(q,te)=>{let ce=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),_e;if(ce!=null){let pe,Re,xe;(te==null?void 0:te.tensorLayout)!==void 0&&te.tensorLayout==="NHWC"?(pe=q.dims[2],Re=q.dims[1],xe=q.dims[3]):(pe=q.dims[3],Re=q.dims[2],xe=q.dims[1]);let Se=te!==void 0&&te.format!==void 0?te.format:"RGB",De=te==null?void 0:te.norm,Ue,qe;De===void 0||De.mean===void 0?Ue=[255,255,255,255]:typeof De.mean=="number"?Ue=[De.mean,De.mean,De.mean,De.mean]:(Ue=[De.mean[0],De.mean[1],De.mean[2],255],De.mean[3]!==void 0&&(Ue[3]=De.mean[3])),De===void 0||De.bias===void 0?qe=[0,0,0,0]:typeof De.bias=="number"?qe=[De.bias,De.bias,De.bias,De.bias]:(qe=[De.bias[0],De.bias[1],De.bias[2],0],De.bias[3]!==void 0&&(qe[3]=De.bias[3]));let We=Re*pe;if(te!==void 0&&(te.format!==void 0&&xe===4&&te.format!=="RGBA"||xe===3&&te.format!=="RGB"&&te.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let Oe=4,lt=0,Ae=1,Ye=2,Qt=3,At=0,Rt=We,Zt=We*2,gt=-1;Se==="RGBA"?(At=0,Rt=We,Zt=We*2,gt=We*3):Se==="RGB"?(At=0,Rt=We,Zt=We*2):Se==="RBG"&&(At=0,Zt=We,Rt=We*2),_e=ce.createImageData(pe,Re);for(let rr=0;rr<Re*pe;lt+=Oe,Ae+=Oe,Ye+=Oe,Qt+=Oe,rr++)_e.data[lt]=(q.data[At++]-qe[0])*Ue[0],_e.data[Ae]=(q.data[Rt++]-qe[1])*Ue[1],_e.data[Ye]=(q.data[Zt++]-qe[2])*Ue[2],_e.data[Qt]=gt===-1?255:(q.data[gt++]-qe[3])*Ue[3]}else throw new Error("Can not access image data");return _e}}),ie,ye,ge,ke,be,ue,W=u(()=>{Me(),ie=(q,te)=>{if(q===void 0)throw new Error("Image buffer must be defined");if(te.height===void 0||te.width===void 0)throw new Error("Image height and width must be defined");if(te.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:ce,width:_e}=te,pe=te.norm??{mean:255,bias:0},Re,xe;typeof pe.mean=="number"?Re=[pe.mean,pe.mean,pe.mean,pe.mean]:Re=[pe.mean[0],pe.mean[1],pe.mean[2],pe.mean[3]??255],typeof pe.bias=="number"?xe=[pe.bias,pe.bias,pe.bias,pe.bias]:xe=[pe.bias[0],pe.bias[1],pe.bias[2],pe.bias[3]??0];let Se=te.format!==void 0?te.format:"RGBA",De=te.tensorFormat!==void 0&&te.tensorFormat!==void 0?te.tensorFormat:"RGB",Ue=ce*_e,qe=De==="RGBA"?new Float32Array(Ue*4):new Float32Array(Ue*3),We=4,Oe=0,lt=1,Ae=2,Ye=3,Qt=0,At=Ue,Rt=Ue*2,Zt=-1;Se==="RGB"&&(We=3,Oe=0,lt=1,Ae=2,Ye=-1),De==="RGBA"?Zt=Ue*3:De==="RBG"?(Qt=0,Rt=Ue,At=Ue*2):De==="BGR"&&(Rt=0,At=Ue,Qt=Ue*2);for(let gt=0;gt<Ue;gt++,Oe+=We,Ae+=We,lt+=We,Ye+=We)qe[Qt++]=(q[Oe]+xe[0])/Re[0],qe[At++]=(q[lt]+xe[1])/Re[1],qe[Rt++]=(q[Ae]+xe[2])/Re[2],Zt!==-1&&Ye!==-1&&(qe[Zt++]=(q[Ye]+xe[3])/Re[3]);return De==="RGBA"?new J("float32",qe,[1,4,ce,_e]):new J("float32",qe,[1,3,ce,_e])},ye=async(q,te)=>{let ce=typeof HTMLImageElement<"u"&&q instanceof HTMLImageElement,_e=typeof ImageData<"u"&&q instanceof ImageData,pe=typeof ImageBitmap<"u"&&q instanceof ImageBitmap,Re=typeof q=="string",xe,Se=te??{},De=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},Ue=qe=>typeof HTMLCanvasElement<"u"&&qe instanceof HTMLCanvasElement||qe instanceof OffscreenCanvas?qe.getContext("2d"):null;if(ce){let qe=De();qe.width=q.width,qe.height=q.height;let We=Ue(qe);if(We!=null){let Oe=q.height,lt=q.width;if(te!==void 0&&te.resizedHeight!==void 0&&te.resizedWidth!==void 0&&(Oe=te.resizedHeight,lt=te.resizedWidth),te!==void 0){if(Se=te,te.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");Se.tensorFormat="RGBA",Se.height=Oe,Se.width=lt}else Se.tensorFormat="RGBA",Se.height=Oe,Se.width=lt;We.drawImage(q,0,0),xe=We.getImageData(0,0,lt,Oe).data}else throw new Error("Can not access image data")}else if(_e){let qe,We;if(te!==void 0&&te.resizedWidth!==void 0&&te.resizedHeight!==void 0?(qe=te.resizedHeight,We=te.resizedWidth):(qe=q.height,We=q.width),te!==void 0&&(Se=te),Se.format="RGBA",Se.height=qe,Se.width=We,te!==void 0){let Oe=De();Oe.width=We,Oe.height=qe;let lt=Ue(Oe);if(lt!=null)lt.putImageData(q,0,0),xe=lt.getImageData(0,0,We,qe).data;else throw new Error("Can not access image data")}else xe=q.data}else if(pe){if(te===void 0)throw new Error("Please provide image config with format for Imagebitmap");let qe=De();qe.width=q.width,qe.height=q.height;let We=Ue(qe);if(We!=null){let Oe=q.height,lt=q.width;return We.drawImage(q,0,0,lt,Oe),xe=We.getImageData(0,0,lt,Oe).data,Se.height=Oe,Se.width=lt,ie(xe,Se)}else throw new Error("Can not access image data")}else{if(Re)return new Promise((qe,We)=>{let Oe=De(),lt=Ue(Oe);if(!q||!lt)return We();let Ae=new Image;Ae.crossOrigin="Anonymous",Ae.src=q,Ae.onload=()=>{Oe.width=Ae.width,Oe.height=Ae.height,lt.drawImage(Ae,0,0,Oe.width,Oe.height);let Ye=lt.getImageData(0,0,Oe.width,Oe.height);Se.height=Oe.height,Se.width=Oe.width,qe(ie(Ye.data,Se))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(xe!==void 0)return ie(xe,Se);throw new Error("Input data provided is not supported - aborted tensor creation")},ge=(q,te)=>{let{width:ce,height:_e,download:pe,dispose:Re}=te,xe=[1,_e,ce,4];return new J({location:"texture",type:"float32",texture:q,dims:xe,download:pe,dispose:Re})},ke=(q,te)=>{let{dataType:ce,dims:_e,download:pe,dispose:Re}=te;return new J({location:"gpu-buffer",type:ce??"float32",gpuBuffer:q,dims:_e,download:pe,dispose:Re})},be=(q,te)=>{let{dataType:ce,dims:_e,download:pe,dispose:Re}=te;return new J({location:"ml-tensor",type:ce??"float32",mlTensor:q,dims:_e,download:pe,dispose:Re})},ue=(q,te,ce)=>new J({location:"cpu-pinned",type:q,data:te,dims:ce??[te.length]})}),re,G,ne,Pe,Ve=u(()=>{re=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),G=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),ne=!1,Pe=()=>{if(!ne){ne=!0;let q=typeof BigInt64Array<"u"&&BigInt64Array.from,te=typeof BigUint64Array<"u"&&BigUint64Array.from,ce=globalThis.Float16Array,_e=typeof ce<"u"&&ce.from;q&&(re.set("int64",BigInt64Array),G.set(BigInt64Array,"int64")),te&&(re.set("uint64",BigUint64Array),G.set(BigUint64Array,"uint64")),_e?(re.set("float16",ce),G.set(ce,"float16")):re.set("float16",Uint16Array)}}}),Ge,it,Ce=u(()=>{Me(),Ge=q=>{let te=1;for(let ce=0;ce<q.length;ce++){let _e=q[ce];if(typeof _e!="number"||!Number.isSafeInteger(_e))throw new TypeError(`dims[${ce}] must be an integer, got: ${_e}`);if(_e<0)throw new RangeError(`dims[${ce}] must be a non-negative integer, got: ${_e}`);te*=_e}return te},it=(q,te)=>{switch(q.location){case"cpu":return new J(q.type,q.data,te);case"cpu-pinned":return new J({location:"cpu-pinned",data:q.data,type:q.type,dims:te});case"texture":return new J({location:"texture",texture:q.texture,type:q.type,dims:te});case"gpu-buffer":return new J({location:"gpu-buffer",gpuBuffer:q.gpuBuffer,type:q.type,dims:te});case"ml-tensor":return new J({location:"ml-tensor",mlTensor:q.mlTensor,type:q.type,dims:te});default:throw new Error(`tensorReshape: tensor location ${q.location} is not supported`)}}}),J,Me=u(()=>{de(),W(),Ve(),Ce(),J=class{constructor(q,te,ce){Pe();let _e,pe;if(typeof q=="object"&&"location"in q)switch(this.dataLocation=q.location,_e=q.type,pe=q.dims,q.location){case"cpu-pinned":{let xe=re.get(_e);if(!xe)throw new TypeError(`unsupported type "${_e}" to create tensor from pinned buffer`);if(!(q.data instanceof xe))throw new TypeError(`buffer should be of type ${xe.name}`);this.cpuData=q.data;break}case"texture":{if(_e!=="float32")throw new TypeError(`unsupported type "${_e}" to create tensor from texture`);this.gpuTextureData=q.texture,this.downloader=q.download,this.disposer=q.dispose;break}case"gpu-buffer":{if(_e!=="float32"&&_e!=="float16"&&_e!=="int32"&&_e!=="int64"&&_e!=="uint32"&&_e!=="uint8"&&_e!=="bool"&&_e!=="uint4"&&_e!=="int4")throw new TypeError(`unsupported type "${_e}" to create tensor from gpu buffer`);this.gpuBufferData=q.gpuBuffer,this.downloader=q.download,this.disposer=q.dispose;break}case"ml-tensor":{if(_e!=="float32"&&_e!=="float16"&&_e!=="int32"&&_e!=="int64"&&_e!=="uint32"&&_e!=="uint64"&&_e!=="int8"&&_e!=="uint8"&&_e!=="bool"&&_e!=="uint4"&&_e!=="int4")throw new TypeError(`unsupported type "${_e}" to create tensor from MLTensor`);this.mlTensorData=q.mlTensor,this.downloader=q.download,this.disposer=q.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let xe,Se;if(typeof q=="string")if(_e=q,Se=ce,q==="string"){if(!Array.isArray(te))throw new TypeError("A string tensor's data must be a string array.");xe=te}else{let De=re.get(q);if(De===void 0)throw new TypeError(`Unsupported tensor type: ${q}.`);if(Array.isArray(te)){if(q==="float16"&&De===Uint16Array||q==="uint4"||q==="int4")throw new TypeError(`Creating a ${q} tensor from number array is not supported. Please use ${De.name} as data.`);q==="uint64"||q==="int64"?xe=De.from(te,BigInt):xe=De.from(te)}else if(te instanceof De)xe=te;else if(te instanceof Uint8ClampedArray)if(q==="uint8")xe=Uint8Array.from(te);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(q==="float16"&&te instanceof Uint16Array&&De!==Uint16Array)xe=new globalThis.Float16Array(te.buffer,te.byteOffset,te.length);else throw new TypeError(`A ${_e} tensor's data must be type of ${De}`)}else if(Se=te,Array.isArray(q)){if(q.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let De=typeof q[0];if(De==="string")_e="string",xe=q;else if(De==="boolean")_e="bool",xe=Uint8Array.from(q);else throw new TypeError(`Invalid element type of data array: ${De}.`)}else if(q instanceof Uint8ClampedArray)_e="uint8",xe=Uint8Array.from(q);else{let De=G.get(q.constructor);if(De===void 0)throw new TypeError(`Unsupported type for tensor data: ${q.constructor}.`);_e=De,xe=q}if(Se===void 0)Se=[xe.length];else if(!Array.isArray(Se))throw new TypeError("A tensor's dims must be a number array");pe=Se,this.cpuData=xe,this.dataLocation="cpu"}let Re=Ge(pe);if(this.cpuData&&Re!==this.cpuData.length&&!((_e==="uint4"||_e==="int4")&&Math.ceil(Re/2)===this.cpuData.length))throw new Error(`Tensor's size(${Re}) does not match data length(${this.cpuData.length}).`);this.type=_e,this.dims=pe,this.size=Re}static async fromImage(q,te){return ye(q,te)}static fromTexture(q,te){return ge(q,te)}static fromGpuBuffer(q,te){return ke(q,te)}static fromMLTensor(q,te){return be(q,te)}static fromPinnedBuffer(q,te,ce){return ue(q,te,ce)}toDataURL(q){return Y(this,q)}toImageData(q){return se(this,q)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(q){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let te=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=te,q&&this.disposer&&(this.disposer(),this.disposer=void 0),te}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(q){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return it(this,q)}}}),$e,Ze=u(()=>{Me(),$e=J}),tt,It,jt,$t,Wt,ht,Ei=u(()=>{F(),tt=(q,te)=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||console.timeStamp(`${q}::ORT::${te}`)},It=(q,te)=>{var pe;let ce=((pe=new Error().stack)==null?void 0:pe.split(/\r\n|\r|\n/g))||[],_e=!1;for(let Re=0;Re<ce.length;Re++){if(_e&&!ce[Re].includes("TRACE_FUNC")){let xe=`FUNC_${q}::${ce[Re].trim().split(" ")[1]}`;te&&(xe+=`::${te}`),tt("CPU",xe);return}ce[Re].includes("TRACE_FUNC")&&(_e=!0)}},jt=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||It("BEGIN",q)},$t=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||It("END",q)},Wt=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||console.time(`ORT::${q}`)},ht=q=>{(typeof O.trace>"u"?!O.wasm.trace:!O.trace)||console.timeEnd(`ORT::${q}`)}}),tr,kr=u(()=>{k(),Ze(),Ei(),tr=class Qw{constructor(te){this.handler=te}async run(te,ce,_e){jt(),Wt("InferenceSession.run");let pe={},Re={};if(typeof te!="object"||te===null||te instanceof $e||Array.isArray(te))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let xe=!0;if(typeof ce=="object"){if(ce===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(ce instanceof $e)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(ce)){if(ce.length===0)throw new TypeError("'fetches' cannot be an empty array.");xe=!1;for(let Ue of ce){if(typeof Ue!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(Ue)===-1)throw new RangeError(`'fetches' contains invalid output name: ${Ue}.`);pe[Ue]=null}if(typeof _e=="object"&&_e!==null)Re=_e;else if(typeof _e<"u")throw new TypeError("'options' must be an object.")}else{let Ue=!1,qe=Object.getOwnPropertyNames(ce);for(let We of this.outputNames)if(qe.indexOf(We)!==-1){let Oe=ce[We];(Oe===null||Oe instanceof $e)&&(Ue=!0,xe=!1,pe[We]=Oe)}if(Ue){if(typeof _e=="object"&&_e!==null)Re=_e;else if(typeof _e<"u")throw new TypeError("'options' must be an object.")}else Re=ce}}else if(typeof ce<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let Ue of this.inputNames)if(typeof te[Ue]>"u")throw new Error(`input '${Ue}' is missing in 'feeds'.`);if(xe)for(let Ue of this.outputNames)pe[Ue]=null;let Se=await this.handler.run(te,pe,Re),De={};for(let Ue in Se)if(Object.hasOwnProperty.call(Se,Ue)){let qe=Se[Ue];qe instanceof $e?De[Ue]=qe:De[Ue]=new $e(qe.type,qe.data,qe.dims)}return ht("InferenceSession.run"),$t(),De}async release(){return this.handler.dispose()}static async create(te,ce,_e,pe){jt(),Wt("InferenceSession.create");let Re,xe={};if(typeof te=="string"){if(Re=te,typeof ce=="object"&&ce!==null)xe=ce;else if(typeof ce<"u")throw new TypeError("'options' must be an object.")}else if(te instanceof Uint8Array){if(Re=te,typeof ce=="object"&&ce!==null)xe=ce;else if(typeof ce<"u")throw new TypeError("'options' must be an object.")}else if(te instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&te instanceof SharedArrayBuffer){let qe=te,We=0,Oe=te.byteLength;if(typeof ce=="object"&&ce!==null)xe=ce;else if(typeof ce=="number"){if(We=ce,!Number.isSafeInteger(We))throw new RangeError("'byteOffset' must be an integer.");if(We<0||We>=qe.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${qe.byteLength}).`);if(Oe=te.byteLength-We,typeof _e=="number"){if(Oe=_e,!Number.isSafeInteger(Oe))throw new RangeError("'byteLength' must be an integer.");if(Oe<=0||We+Oe>qe.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${qe.byteLength-We}].`);if(typeof pe=="object"&&pe!==null)xe=pe;else if(typeof pe<"u")throw new TypeError("'options' must be an object.")}else if(typeof _e<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof ce<"u")throw new TypeError("'options' must be an object.");Re=new Uint8Array(qe,We,Oe)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[Se,De]=await g(xe),Ue=await Se.createInferenceSessionHandler(Re,De);return ht("InferenceSession.create"),$t(),new Qw(Ue)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),Rr,Is=u(()=>{kr(),Rr=tr}),Fr=u(()=>{}),Ms=u(()=>{}),ui=u(()=>{}),Ls=u(()=>{}),vs={};p(vs,{InferenceSession:()=>Rr,TRACE:()=>tt,TRACE_EVENT_BEGIN:()=>Wt,TRACE_EVENT_END:()=>ht,TRACE_FUNC_BEGIN:()=>jt,TRACE_FUNC_END:()=>$t,Tensor:()=>$e,env:()=>I,registerBackend:()=>D});var Jt=u(()=>{w(),U(),Is(),Ze(),Fr(),Ms(),Ei(),ui(),Ls()}),Mi=u(()=>{}),Or={};p(Or,{default:()=>Nn});var Ur,Yt,Nn,oc=u(()=>{var q;xo(),Ti(),on(),Ur="ort-wasm-proxy-worker",Yt=((q=globalThis.self)==null?void 0:q.name)===Ur,Yt&&(self.onmessage=te=>{let{type:ce,in:_e}=te.data;try{switch(ce){case"init-wasm":Os(_e.wasm).then(()=>{ea(_e).then(()=>{postMessage({type:ce})},pe=>{postMessage({type:ce,err:pe})})},pe=>{postMessage({type:ce,err:pe})});break;case"init-ep":{let{epName:pe,env:Re}=_e;cn(Re,pe).then(()=>{postMessage({type:ce})},xe=>{postMessage({type:ce,err:xe})});break}case"copy-from":{let{buffer:pe}=_e,Re=Nt(pe);postMessage({type:ce,out:Re});break}case"create":{let{model:pe,options:Re}=_e;Ni(pe,Re).then(xe=>{postMessage({type:ce,out:xe})},xe=>{postMessage({type:ce,err:xe})});break}case"release":Hn(_e),postMessage({type:ce});break;case"run":{let{sessionId:pe,inputIndices:Re,inputs:xe,outputIndices:Se,options:De}=_e;Be(pe,Re,xe,Se,new Array(Se.length).fill(null),De).then(Ue=>{Ue.some(qe=>qe[3]!=="cpu")?postMessage({type:ce,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:ce,out:Ue},ta([...xe,...Ue]))},Ue=>{postMessage({type:ce,err:Ue})});break}case"end-profiling":rs(_e),postMessage({type:ce});break;default:}}catch(pe){postMessage({type:ce,err:pe})}}),Nn=Yt?null:te=>new Worker(te??er,{type:"classic",name:Ur})}),qa,_o,er,nn,ys,wo,js,es,Go,Bn,Ko,zn,Xo,on=u(()=>{Mi(),qa=typeof location>"u"?void 0:location.origin,_o=()=>{var q,te;return typeof document<"u"?(q=document.currentScript)==null?void 0:q.src:typeof self<"u"?(te=self.location)==null?void 0:te.href:void 0},er=_o(),nn=()=>{if(er&&!er.startsWith("blob:"))return er.substring(0,er.lastIndexOf("/")+1)},ys=(q,te)=>{try{let ce=te??er;return(ce?new URL(q,ce):new URL(q)).origin===qa}catch{return!1}},wo=(q,te)=>{let ce=te??er;try{return(ce?new URL(q,ce):new URL(q)).href}catch{return}},js=(q,te)=>`${te??"./"}${q}`,es=async q=>{let te=await(await fetch(q,{credentials:"same-origin"})).blob();return URL.createObjectURL(te)},Go=async q=>(await import(q)).default,Bn=(oc(),m(Or)).default,Ko=async()=>{if(!er)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(ys(er))return[void 0,Bn()];let q=await es(er);return[q,Bn(q)]},zn=void 0,Xo=async(q,te,ce,_e)=>{let pe=zn&&!(q||te);if(pe)if(er)pe=ys(er)||_e&&!ce;else if(_e&&!ce)pe=!0;else throw new Error("cannot determine the script source URL.");if(pe)return[void 0,zn];{let Re="ort-wasm-simd-threaded.mjs",xe=q??wo(Re,te),Se=ce&&xe&&!ys(xe,te),De=Se?await es(xe):xe??js(Re,te);return[Se?De:void 0,await Go(De)]}}}),Fn,Li,ji,_s,Ga,an,Un,Os,St,Ti=u(()=>{on(),Li=!1,ji=!1,_s=!1,Ga=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},an=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},Un=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},Os=async q=>{if(Li)return Promise.resolve();if(ji)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(_s)throw new Error("previous call to 'initializeWebAssembly()' failed.");ji=!0;let te=q.initTimeout,ce=q.numThreads;if(q.simd!==!1){if(q.simd==="relaxed"){if(!Un())throw new Error("Relaxed WebAssembly SIMD is not supported in the current environment.")}else if(!an())throw new Error("WebAssembly SIMD is not supported in the current environment.")}let _e=Ga();ce>1&&!_e&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+ce+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),q.numThreads=ce=1);let pe=q.wasmPaths,Re=typeof pe=="string"?pe:void 0,xe=pe==null?void 0:pe.mjs,Se=(xe==null?void 0:xe.href)??xe,De=pe==null?void 0:pe.wasm,Ue=(De==null?void 0:De.href)??De,qe=q.wasmBinary,[We,Oe]=await Xo(Se,Re,ce>1,!!qe||!!Ue),lt=!1,Ae=[];if(te>0&&Ae.push(new Promise(Ye=>{setTimeout(()=>{lt=!0,Ye()},te)})),Ae.push(new Promise((Ye,Qt)=>{let At={numThreads:ce};if(qe)At.wasmBinary=qe,At.locateFile=Rt=>Rt;else if(Ue||Re)At.locateFile=Rt=>Ue??Re+Rt;else if(Se&&Se.indexOf("blob:")!==0)At.locateFile=Rt=>new URL(Rt,Se).href;else if(We){let Rt=nn();Rt&&(At.locateFile=Zt=>Rt+Zt)}Oe(At).then(Rt=>{ji=!1,Li=!0,Fn=Rt,Ye(),We&&URL.revokeObjectURL(We)},Rt=>{ji=!1,_s=!0,Qt(Rt)})})),await Promise.race(Ae),lt)throw new Error(`WebAssembly backend initializing failed due to timeout: ${te}ms`)},St=()=>{if(Li&&Fn)return Fn;throw new Error("WebAssembly is not initialized yet.")}}),pr,ln,ct,Vn=u(()=>{Ti(),pr=(q,te)=>{let ce=St(),_e=ce.lengthBytesUTF8(q)+1,pe=ce._malloc(_e);return ce.stringToUTF8(q,pe,_e),te.push(pe),pe},ln=(q,te,ce,_e)=>{if(typeof q=="object"&&q!==null){if(ce.has(q))throw new Error("Circular reference in options");ce.add(q)}Object.entries(q).forEach(([pe,Re])=>{let xe=te?te+pe:pe;if(typeof Re=="object")ln(Re,xe+".",ce,_e);else if(typeof Re=="string"||typeof Re=="number")_e(xe,Re.toString());else if(typeof Re=="boolean")_e(xe,Re?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof Re}`)})},ct=q=>{let te=St(),ce=te.stackSave();try{let _e=te.PTR_SIZE,pe=te.stackAlloc(2*_e);te._OrtGetLastError(pe,pe+_e);let Re=Number(te.getValue(pe,_e===4?"i32":"i64")),xe=te.getValue(pe+_e,"*"),Se=xe?te.UTF8ToString(xe):"";throw new Error(`${q} ERROR_CODE: ${Re}, ERROR_MESSAGE: ${Se}`)}finally{te.stackRestore(ce)}}}),Jo,sd=u(()=>{Ti(),Vn(),Jo=q=>{let te=St(),ce=0,_e=[],pe=q||{};try{if((q==null?void 0:q.logSeverityLevel)===void 0)pe.logSeverityLevel=2;else if(typeof q.logSeverityLevel!="number"||!Number.isInteger(q.logSeverityLevel)||q.logSeverityLevel<0||q.logSeverityLevel>4)throw new Error(`log severity level is not valid: ${q.logSeverityLevel}`);if((q==null?void 0:q.logVerbosityLevel)===void 0)pe.logVerbosityLevel=0;else if(typeof q.logVerbosityLevel!="number"||!Number.isInteger(q.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${q.logVerbosityLevel}`);(q==null?void 0:q.terminate)===void 0&&(pe.terminate=!1);let Re=0;return(q==null?void 0:q.tag)!==void 0&&(Re=pr(q.tag,_e)),ce=te._OrtCreateRunOptions(pe.logSeverityLevel,pe.logVerbosityLevel,!!pe.terminate,Re),ce===0&&ct("Can't create run options."),(q==null?void 0:q.extra)!==void 0&&ln(q.extra,"",new WeakSet,(xe,Se)=>{let De=pr(xe,_e),Ue=pr(Se,_e);te._OrtAddRunConfigEntry(ce,De,Ue)!==0&&ct(`Can't set a run config entry: ${xe} - ${Se}.`)}),[ce,_e]}catch(Re){throw ce!==0&&te._OrtReleaseRunOptions(ce),_e.forEach(xe=>te._free(xe)),Re}}}),Yo,Qo,Zo,ts,Ka,Xa,mr=u(()=>{Ti(),Vn(),Yo=q=>{switch(q){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"layout":return 3;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${q}`)}},Qo=q=>{switch(q){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${q}`)}},Zo=q=>{q.extra||(q.extra={}),q.extra.session||(q.extra.session={});let te=q.extra.session;te.use_ort_model_bytes_directly||(te.use_ort_model_bytes_directly="1"),q.executionProviders&&q.executionProviders.some(ce=>(typeof ce=="string"?ce:ce.name)==="webgpu")&&(q.enableMemPattern=!1)},ts=(q,te,ce,_e)=>{let pe=pr(te,_e),Re=pr(ce,_e);St()._OrtAddSessionConfigEntry(q,pe,Re)!==0&&ct(`Can't set a session config entry: ${te} - ${ce}.`)},Ka=async(q,te,ce)=>{let _e=te.executionProviders;for(let pe of _e){let Re=typeof pe=="string"?pe:pe.name,xe=[];switch(Re){case"webnn":if(Re="WEBNN",typeof pe!="string"){let We=pe==null?void 0:pe.deviceType;We&&ts(q,"deviceType",We,ce)}break;case"webgpu":if(Re="JS",typeof pe!="string"){let We=pe;if(We!=null&&We.preferredLayout){if(We.preferredLayout!=="NCHW"&&We.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${We.preferredLayout}`);ts(q,"preferredLayout",We.preferredLayout,ce)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${Re}`)}let Se=pr(Re,ce),De=xe.length,Ue=0,qe=0;if(De>0){Ue=St()._malloc(De*St().PTR_SIZE),ce.push(Ue),qe=St()._malloc(De*St().PTR_SIZE),ce.push(qe);for(let We=0;We<De;We++)St().setValue(Ue+We*St().PTR_SIZE,xe[We][0],"*"),St().setValue(qe+We*St().PTR_SIZE,xe[We][1],"*")}await St()._OrtAppendExecutionProvider(q,Se,Ue,qe,De)!==0&&ct(`Can't append execution provider: ${Re}.`)}},Xa=async q=>{let te=St(),ce=0,_e=[],pe=q||{};Zo(pe);try{let Re=Yo(pe.graphOptimizationLevel??"all"),xe=Qo(pe.executionMode??"sequential"),Se=typeof pe.logId=="string"?pr(pe.logId,_e):0,De=pe.logSeverityLevel??2;if(!Number.isInteger(De)||De<0||De>4)throw new Error(`log severity level is not valid: ${De}`);let Ue=pe.logVerbosityLevel??0;if(!Number.isInteger(Ue)||Ue<0||Ue>4)throw new Error(`log verbosity level is not valid: ${Ue}`);let qe=typeof pe.optimizedModelFilePath=="string"?pr(pe.optimizedModelFilePath,_e):0;if(ce=te._OrtCreateSessionOptions(Re,!!pe.enableCpuMemArena,!!pe.enableMemPattern,xe,!!pe.enableProfiling,0,Se,De,Ue,qe),ce===0&&ct("Can't create session options."),pe.executionProviders&&await Ka(ce,pe,_e),pe.enableGraphCapture!==void 0){if(typeof pe.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${pe.enableGraphCapture}`);ts(ce,"enableGraphCapture",pe.enableGraphCapture.toString(),_e)}if(pe.freeDimensionOverrides)for(let[We,Oe]of Object.entries(pe.freeDimensionOverrides)){if(typeof We!="string")throw new Error(`free dimension override name must be a string: ${We}`);if(typeof Oe!="number"||!Number.isInteger(Oe)||Oe<0)throw new Error(`free dimension override value must be a non-negative integer: ${Oe}`);let lt=pr(We,_e);te._OrtAddFreeDimensionOverride(ce,lt,Oe)!==0&&ct(`Can't set a free dimension override: ${We} - ${Oe}.`)}return pe.extra!==void 0&&ln(pe.extra,"",new WeakSet,(We,Oe)=>{ts(ce,We,Oe,_e)}),[ce,_e]}catch(Re){throw ce!==0&&te._OrtReleaseSessionOptions(ce)!==0&&ct("Can't release session options."),_e.forEach(xe=>te._free(xe)),Re}}}),$i,Qr,di,Ns,bo,Wn,Bs,hi,xt=u(()=>{$i=q=>{switch(q){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${q}`)}},Qr=q=>{switch(q){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${q}`)}},di=(q,te)=>{let ce=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][q],_e=typeof te=="number"?te:te.reduce((pe,Re)=>pe*Re,1);return ce>0?Math.ceil(_e*ce):void 0},Ns=q=>{switch(q){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${q}`)}},bo=q=>{switch(q){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${q}`)}},Wn=q=>q==="float32"||q==="float16"||q==="int32"||q==="int64"||q==="uint32"||q==="uint8"||q==="bool"||q==="uint4"||q==="int4",Bs=q=>q==="float32"||q==="float16"||q==="int32"||q==="int64"||q==="uint32"||q==="uint64"||q==="int8"||q==="uint8"||q==="bool"||q==="uint4"||q==="int4",hi=q=>{switch(q){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${q}`)}}}),Vr,Ja=u(()=>{Mi(),Vr=async q=>{if(typeof q=="string"){let te=await fetch(q);if(!te.ok)throw new Error(`failed to load external data file: ${q}`);let ce=te.headers.get("Content-Length"),_e=ce?parseInt(ce,10):0;if(_e<1073741824)return new Uint8Array(await te.arrayBuffer());{if(!te.body)throw new Error(`failed to load external data file: ${q}, no response body.`);let pe=te.body.getReader(),Re;try{Re=new ArrayBuffer(_e)}catch(Se){if(Se instanceof RangeError){let De=Math.ceil(_e/65536);Re=new WebAssembly.Memory({initial:De,maximum:De}).buffer}else throw Se}let xe=0;for(;;){let{done:Se,value:De}=await pe.read();if(Se)break;let Ue=De.byteLength;new Uint8Array(Re,xe,Ue).set(De),xe+=Ue}return new Uint8Array(Re,0,_e)}}else return q instanceof Blob?new Uint8Array(await q.arrayBuffer()):q instanceof Uint8Array?q:new Uint8Array(q)}}),Ya,ea,cn,Oi,zs,un,Nt,Ni,Hn,ws,Be,rs,ta,xo=u(()=>{Jt(),sd(),mr(),xt(),Ti(),Vn(),Ja(),Ya=(q,te)=>{St()._OrtInit(q,te)!==0&&ct("Can't initialize onnxruntime.")},ea=async q=>{Ya(q.wasm.numThreads,bo(q.logLevel))},cn=async(q,te)=>{var _e,pe;(pe=(_e=St()).asyncInit)==null||pe.call(_e);let ce=q.webgpu.adapter;if(te==="webgpu"){if(typeof navigator>"u"||!navigator.gpu)throw new Error("WebGPU is not supported in current environment");if(ce){if(typeof ce.limits!="object"||typeof ce.features!="object"||typeof ce.requestDevice!="function")throw new Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let Re=q.webgpu.powerPreference;if(Re!==void 0&&Re!=="low-power"&&Re!=="high-performance")throw new Error(`Invalid powerPreference setting: "${Re}"`);let xe=q.webgpu.forceFallbackAdapter;if(xe!==void 0&&typeof xe!="boolean")throw new Error(`Invalid forceFallbackAdapter setting: "${xe}"`);if(ce=await navigator.gpu.requestAdapter({powerPreference:Re,forceFallbackAdapter:xe}),!ce)throw new Error('Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.')}}if(te==="webnn"&&(typeof navigator>"u"||!navigator.ml))throw new Error("WebNN is not supported in current environment")},Oi=new Map,zs=q=>{let te=St(),ce=te.stackSave();try{let _e=te.PTR_SIZE,pe=te.stackAlloc(2*_e);te._OrtGetInputOutputCount(q,pe,pe+_e)!==0&&ct("Can't get session input/output count.");let Re=_e===4?"i32":"i64";return[Number(te.getValue(pe,Re)),Number(te.getValue(pe+_e,Re))]}finally{te.stackRestore(ce)}},un=(q,te)=>{let ce=St(),_e=ce.stackSave(),pe=0;try{let Re=ce.PTR_SIZE,xe=ce.stackAlloc(2*Re);ce._OrtGetInputOutputMetadata(q,te,xe,xe+Re)!==0&&ct("Can't get session input/output metadata.");let Se=Number(ce.getValue(xe,"*"));pe=Number(ce.getValue(xe+Re,"*"));let De=ce.HEAP32[pe/4];if(De===0)return[Se,0];let Ue=ce.HEAPU32[pe/4+1],qe=[];for(let We=0;We<Ue;We++){let Oe=Number(ce.getValue(pe+8+We*Re,"*"));qe.push(Oe!==0?ce.UTF8ToString(Oe):Number(ce.getValue(pe+8+(We+Ue)*Re,"*")))}return[Se,De,qe]}finally{ce.stackRestore(_e),pe!==0&&ce._OrtFree(pe)}},Nt=q=>{let te=St(),ce=te._malloc(q.byteLength);if(ce===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${q.byteLength}.`);return te.HEAPU8.set(q,ce),[ce,q.byteLength]},Ni=async(q,te)=>{var qe,We,Oe;let ce,_e,pe=St();Array.isArray(q)?[ce,_e]=q:q.buffer===pe.HEAPU8.buffer?[ce,_e]=[q.byteOffset,q.byteLength]:[ce,_e]=Nt(q);let Re=0,xe=0,Se=[],De=[],Ue=[];try{if([xe,Se]=await Xa(te),(te==null?void 0:te.externalData)&&pe.mountExternalData){let rr=[];for(let Ut of te.externalData){let Pr=typeof Ut=="string"?Ut:Ut.path;rr.push(Vr(typeof Ut=="string"?Ut:Ut.data).then(Hr=>{pe.mountExternalData(Pr,Hr)}))}await Promise.all(rr)}for(let rr of(te==null?void 0:te.executionProviders)??[])if((typeof rr=="string"?rr:rr.name)==="webnn"){if(pe.shouldTransferToMLTensor=!1,typeof rr!="string"){let Ut=rr,Pr=Ut==null?void 0:Ut.context,Hr=Ut==null?void 0:Ut.gpuDevice,Zr=Ut==null?void 0:Ut.deviceType,ko=Ut==null?void 0:Ut.powerPreference;Pr?pe.currentContext=Pr:Hr?pe.currentContext=await pe.webnnCreateMLContext(Hr):pe.currentContext=await pe.webnnCreateMLContext({deviceType:Zr,powerPreference:ko})}else pe.currentContext=await pe.webnnCreateMLContext();break}Re=await pe._OrtCreateSession(ce,_e,xe),(qe=pe.webgpuOnCreateSession)==null||qe.call(pe,Re),Re===0&&ct("Can't create a session."),(We=pe.jsepOnCreateSession)==null||We.call(pe),pe.currentContext&&(pe.webnnRegisterMLContext(Re,pe.currentContext),pe.currentContext=void 0,pe.shouldTransferToMLTensor=!0);let[lt,Ae]=zs(Re),Ye=!!(te!=null&&te.enableGraphCapture),Qt=[],At=[],Rt=[],Zt=[],gt=[];for(let rr=0;rr<lt;rr++){let[Ut,Pr,Hr]=un(Re,rr);Ut===0&&ct("Can't get an input name."),De.push(Ut);let Zr=pe.UTF8ToString(Ut);Qt.push(Zr),Rt.push(Pr===0?{name:Zr,isTensor:!1}:{name:Zr,isTensor:!0,type:Qr(Pr),shape:Hr})}for(let rr=0;rr<Ae;rr++){let[Ut,Pr,Hr]=un(Re,rr+lt);Ut===0&&ct("Can't get an output name."),Ue.push(Ut);let Zr=pe.UTF8ToString(Ut);At.push(Zr),Zt.push(Pr===0?{name:Zr,isTensor:!1}:{name:Zr,isTensor:!0,type:Qr(Pr),shape:Hr})}return Oi.set(Re,[Re,De,Ue,null,Ye,!1]),[Re,Qt,At,Rt,Zt]}catch(lt){throw De.forEach(Ae=>pe._OrtFree(Ae)),Ue.forEach(Ae=>pe._OrtFree(Ae)),Re!==0&&pe._OrtReleaseSession(Re)!==0&&ct("Can't release session."),lt}finally{pe._free(ce),xe!==0&&pe._OrtReleaseSessionOptions(xe)!==0&&ct("Can't release session options."),Se.forEach(lt=>pe._free(lt)),(Oe=pe.unmountExternalData)==null||Oe.call(pe)}},Hn=q=>{var De,Ue,qe;let te=St(),ce=Oi.get(q);if(!ce)throw new Error(`cannot release session. invalid session id: ${q}`);let[_e,pe,Re,xe,Se]=ce;xe&&(Se&&te._OrtClearBoundOutputs(xe.handle)!==0&&ct("Can't clear bound outputs."),te._OrtReleaseBinding(xe.handle)!==0&&ct("Can't release IO binding.")),(De=te.jsepOnReleaseSession)==null||De.call(te,q),(Ue=te.webnnOnReleaseSession)==null||Ue.call(te,q),(qe=te.webgpuOnReleaseSession)==null||qe.call(te,q),pe.forEach(We=>te._OrtFree(We)),Re.forEach(We=>te._OrtFree(We)),te._OrtReleaseSession(_e)!==0&&ct("Can't release session."),Oi.delete(q)},ws=async(q,te,ce,_e,pe,Re,xe=!1)=>{if(!q){te.push(0);return}let Se=St(),De=Se.PTR_SIZE,Ue=q[0],qe=q[1],We=q[3],Oe=We,lt,Ae;if(Ue==="string"&&(We==="gpu-buffer"||We==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(xe&&We!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${Re} when enableGraphCapture is true.`);if(We==="gpu-buffer"){let At=q[2].gpuBuffer;Ae=di($i(Ue),qe);{let Rt=Se.jsepRegisterBuffer;if(!Rt)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');lt=Rt(_e,Re,At,Ae)}}else if(We==="ml-tensor"){let At=q[2].mlTensor;Ae=di($i(Ue),qe);let Rt=Se.webnnRegisterMLTensor;if(!Rt)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');lt=Rt(_e,At,$i(Ue),qe)}else{let At=q[2];if(Array.isArray(At)){Ae=De*At.length,lt=Se._malloc(Ae),ce.push(lt);for(let Rt=0;Rt<At.length;Rt++){if(typeof At[Rt]!="string")throw new TypeError(`tensor data at index ${Rt} is not a string`);Se.setValue(lt+Rt*De,pr(At[Rt],ce),"*")}}else{let Rt=Se.webnnIsGraphInput,Zt=Se.webnnIsGraphOutput;if(Ue!=="string"&&Rt&&Zt){let gt=Se.UTF8ToString(pe);if(Rt(_e,gt)||Zt(_e,gt)){let rr=$i(Ue);Ae=di(rr,qe),Oe="ml-tensor";let Ut=Se.webnnCreateTemporaryTensor,Pr=Se.webnnUploadTensor;if(!Ut||!Pr)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');let Hr=await Ut(_e,rr,qe);Pr(Hr,new Uint8Array(At.buffer,At.byteOffset,At.byteLength)),lt=Hr}else Ae=At.byteLength,lt=Se._malloc(Ae),ce.push(lt),Se.HEAPU8.set(new Uint8Array(At.buffer,At.byteOffset,Ae),lt)}else Ae=At.byteLength,lt=Se._malloc(Ae),ce.push(lt),Se.HEAPU8.set(new Uint8Array(At.buffer,At.byteOffset,Ae),lt)}}let Ye=Se.stackSave(),Qt=Se.stackAlloc(4*qe.length);try{qe.forEach((Rt,Zt)=>Se.setValue(Qt+Zt*De,Rt,De===4?"i32":"i64"));let At=Se._OrtCreateTensor($i(Ue),lt,Ae,Qt,qe.length,hi(Oe));At===0&&ct(`Can't create tensor for input/output. session=${_e}, index=${Re}.`),te.push(At)}finally{Se.stackRestore(Ye)}},Be=async(q,te,ce,_e,pe,Re)=>{var ei,oa,tl;let xe=St(),Se=xe.PTR_SIZE,De=Oi.get(q);if(!De)throw new Error(`cannot run inference. invalid session id: ${q}`);let Ue=De[0],qe=De[1],We=De[2],Oe=De[3],lt=De[4];De[5];let Ae=te.length,Ye=_e.length,Qt=0,At=[],Rt=[],Zt=[],gt=[],rr=[],Ut=xe.stackSave(),Pr=xe.stackAlloc(Ae*Se),Hr=xe.stackAlloc(Ae*Se),Zr=xe.stackAlloc(Ye*Se),ko=xe.stackAlloc(Ye*Se);try{[Qt,At]=Jo(Re),Wt("wasm prepareInputOutputTensor");for(let Bt=0;Bt<Ae;Bt++)await ws(ce[Bt],Rt,gt,q,qe[te[Bt]],te[Bt],lt);for(let Bt=0;Bt<Ye;Bt++)await ws(pe[Bt],Zt,gt,q,We[_e[Bt]],Ae+_e[Bt],lt);ht("wasm prepareInputOutputTensor");for(let Bt=0;Bt<Ae;Bt++)xe.setValue(Pr+Bt*Se,Rt[Bt],"*"),xe.setValue(Hr+Bt*Se,qe[te[Bt]],"*");for(let Bt=0;Bt<Ye;Bt++)xe.setValue(Zr+Bt*Se,Zt[Bt],"*"),xe.setValue(ko+Bt*Se,We[_e[Bt]],"*");(ei=xe.jsepOnRunStart)==null||ei.call(xe,Ue),(oa=xe.webnnOnRunStart)==null||oa.call(xe,Ue);let Dr;Dr=await xe._OrtRun(Ue,Hr,Pr,Ae,ko,Ye,Zr,Qt),Dr!==0&&ct("failed to call OrtRun().");let ss=[],rl=[];Wt("wasm ProcessOutputTensor");for(let Bt=0;Bt<Ye;Bt++){let Fi=Number(xe.getValue(Zr+Bt*Se,"*"));if(Fi===Zt[Bt]||rr.includes(Zt[Bt])){ss.push(pe[Bt]),Fi!==Zt[Bt]&&xe._OrtReleaseTensor(Fi)!==0&&ct("Can't release tensor.");continue}let lc=xe.stackSave(),ks=xe.stackAlloc(4*Se),Gn=!1,wr,ti=0;try{xe._OrtGetTensorData(Fi,ks,ks+Se,ks+2*Se,ks+3*Se)!==0&&ct(`Can't access output tensor data on index ${Bt}.`);let aa=Se===4?"i32":"i64",ri=Number(xe.getValue(ks,aa));ti=xe.getValue(ks+Se,"*");let il=xe.getValue(ks+Se*2,"*"),cc=Number(xe.getValue(ks+Se*3,aa)),Cs=[];for(let br=0;br<cc;br++)Cs.push(Number(xe.getValue(il+br*Se,aa)));xe._OrtFree(il)!==0&&ct("Can't free memory for tensor dims.");let Ui=Cs.reduce((br,ar)=>br*ar,1);wr=Qr(ri);let ns=Oe==null?void 0:Oe.outputPreferredLocations[_e[Bt]];if(wr==="string"){if(ns==="gpu-buffer"||ns==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let br=[];for(let ar=0;ar<Ui;ar++){let Vi=xe.getValue(ti+ar*Se,"*"),sl=xe.getValue(ti+(ar+1)*Se,"*"),nl=ar===Ui-1?void 0:sl-Vi;br.push(xe.UTF8ToString(Vi,nl))}ss.push([wr,Cs,br,"cpu"])}else if(ns==="gpu-buffer"&&Ui>0){let br=xe.jsepGetBuffer;if(!br)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let ar=br(ti),Vi=di(ri,Ui);if(Vi===void 0||!Wn(wr))throw new Error(`Unsupported data type: ${wr}`);Gn=!0,ss.push([wr,Cs,{gpuBuffer:ar,download:xe.jsepCreateDownloader(ar,Vi,wr),dispose:()=>{xe._OrtReleaseTensor(Fi)!==0&&ct("Can't release tensor.")}},"gpu-buffer"])}else if(ns==="ml-tensor"&&Ui>0){let br=xe.webnnEnsureTensor,ar=xe.webnnIsGraphInputOutputTypeSupported;if(!br||!ar)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(di(ri,Ui)===void 0||!Bs(wr))throw new Error(`Unsupported data type: ${wr}`);if(!ar(q,wr,!1))throw new Error(`preferredLocation "ml-tensor" for ${wr} output is not supported by current WebNN Context.`);let Vi=await br(q,ti,ri,Cs,!1);Gn=!0,ss.push([wr,Cs,{mlTensor:Vi,download:xe.webnnCreateMLTensorDownloader(ti,wr),dispose:()=>{xe.webnnReleaseTensorId(ti),xe._OrtReleaseTensor(Fi)}},"ml-tensor"])}else if(ns==="ml-tensor-cpu-output"&&Ui>0){let br=xe.webnnCreateMLTensorDownloader(ti,wr)(),ar=ss.length;Gn=!0,rl.push((async()=>{let Vi=[ar,await br];return xe.webnnReleaseTensorId(ti),xe._OrtReleaseTensor(Fi),Vi})()),ss.push([wr,Cs,[],"cpu"])}else{let br=Ns(wr),ar=new br(Ui);new Uint8Array(ar.buffer,ar.byteOffset,ar.byteLength).set(xe.HEAPU8.subarray(ti,ti+ar.byteLength)),ss.push([wr,Cs,ar,"cpu"])}}finally{xe.stackRestore(lc),wr==="string"&&ti&&xe._free(ti),Gn||xe._OrtReleaseTensor(Fi)}}Oe&&!lt&&(xe._OrtClearBoundOutputs(Oe.handle)!==0&&ct("Can't clear bound outputs."),Oi.set(q,[Ue,qe,We,Oe,lt,!1]));for(let[Bt,Fi]of await Promise.all(rl))ss[Bt][2]=Fi;return ht("wasm ProcessOutputTensor"),ss}finally{(tl=xe.webnnOnRunEnd)==null||tl.call(xe,Ue),xe.stackRestore(Ut),Rt.forEach(Dr=>xe._OrtReleaseTensor(Dr)),Zt.forEach(Dr=>xe._OrtReleaseTensor(Dr)),gt.forEach(Dr=>xe._free(Dr)),Qt!==0&&xe._OrtReleaseRunOptions(Qt),At.forEach(Dr=>xe._free(Dr))}},rs=q=>{let te=St(),ce=Oi.get(q);if(!ce)throw new Error("invalid session id");let _e=ce[0],pe=te._OrtEndProfiling(_e);pe===0&&ct("Can't get an profile file name."),te._OrtFree(pe)},ta=q=>{let te=[];for(let ce of q){let _e=ce[2];!Array.isArray(_e)&&"buffer"in _e&&te.push(_e.buffer)}return te}}),Ft,mt,bs,Fs,Us,dn,qn,hn,Ai,Wr,Bi,zi,Vs,fn,is,ac,pn,mn,Qa=u(()=>{Jt(),xo(),Ti(),on(),Ft=()=>!!I.wasm.proxy&&typeof document<"u",bs=!1,Fs=!1,Us=!1,hn=new Map,Ai=(q,te)=>{let ce=hn.get(q);ce?ce.push(te):hn.set(q,[te])},Wr=()=>{if(bs||!Fs||Us||!mt)throw new Error("worker not ready")},Bi=q=>{switch(q.data.type){case"init-wasm":bs=!1,q.data.err?(Us=!0,qn[1](q.data.err)):(Fs=!0,qn[0]()),dn&&(URL.revokeObjectURL(dn),dn=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let te=hn.get(q.data.type);q.data.err?te.shift()[1](q.data.err):te.shift()[0](q.data.out);break}}},zi=async()=>{if(!Fs){if(bs)throw new Error("multiple calls to 'initWasm()' detected.");if(Us)throw new Error("previous call to 'initWasm()' failed.");if(bs=!0,Ft())return new Promise((q,te)=>{mt==null||mt.terminate(),Ko().then(([ce,_e])=>{try{mt=_e,mt.onerror=Re=>te(Re),mt.onmessage=Bi,qn=[q,te];let pe={type:"init-wasm",in:I};if(!pe.in.wasm.wasmPaths&&ce){let Re=nn();Re&&(pe.in.wasm.wasmPaths=Re)}mt.postMessage(pe),dn=ce}catch(pe){te(pe)}},te)});try{await Os(I.wasm),await ea(I),Fs=!0}catch(q){throw Us=!0,q}finally{bs=!1}}},Vs=async q=>{if(Ft())return Wr(),new Promise((te,ce)=>{Ai("init-ep",[te,ce]);let _e={type:"init-ep",in:{epName:q,env:I}};mt.postMessage(_e)});await cn(I,q)},fn=async q=>Ft()?(Wr(),new Promise((te,ce)=>{Ai("copy-from",[te,ce]);let _e={type:"copy-from",in:{buffer:q}};mt.postMessage(_e,[q.buffer])})):Nt(q),is=async(q,te)=>{if(Ft()){if(te!=null&&te.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return Wr(),new Promise((ce,_e)=>{Ai("create",[ce,_e]);let pe={type:"create",in:{model:q,options:{...te}}},Re=[];q instanceof Uint8Array&&Re.push(q.buffer),mt.postMessage(pe,Re)})}else return Ni(q,te)},ac=async q=>{if(Ft())return Wr(),new Promise((te,ce)=>{Ai("release",[te,ce]);let _e={type:"release",in:q};mt.postMessage(_e)});Hn(q)},pn=async(q,te,ce,_e,pe,Re)=>{if(Ft()){if(ce.some(xe=>xe[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(pe.some(xe=>xe))throw new Error("pre-allocated output tensor is not supported for proxy.");return Wr(),new Promise((xe,Se)=>{Ai("run",[xe,Se]);let De=ce,Ue={type:"run",in:{sessionId:q,inputIndices:te,inputs:De,outputIndices:_e,options:Re}};mt.postMessage(Ue,ta(De))})}else return Be(q,te,ce,_e,pe,Re)},mn=async q=>{if(Ft())return Wr(),new Promise((te,ce)=>{Ai("end-profiling",[te,ce]);let _e={type:"end-profiling",in:q};mt.postMessage(_e)});rs(q)}}),ra,gn,So,ia=u(()=>{Jt(),Qa(),xt(),Mi(),Ja(),ra=(q,te)=>{switch(q.location){case"cpu":return[q.type,q.dims,q.data,"cpu"];case"gpu-buffer":return[q.type,q.dims,{gpuBuffer:q.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[q.type,q.dims,{mlTensor:q.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${q.location} for ${te()}`)}},gn=q=>{switch(q[3]){case"cpu":return new $e(q[0],q[2],q[1]);case"gpu-buffer":{let te=q[0];if(!Wn(te))throw new Error(`not supported data type: ${te} for deserializing GPU tensor`);let{gpuBuffer:ce,download:_e,dispose:pe}=q[2];return $e.fromGpuBuffer(ce,{dataType:te,dims:q[1],download:_e,dispose:pe})}case"ml-tensor":{let te=q[0];if(!Bs(te))throw new Error(`not supported data type: ${te} for deserializing MLTensor tensor`);let{mlTensor:ce,download:_e,dispose:pe}=q[2];return $e.fromMLTensor(ce,{dataType:te,dims:q[1],download:_e,dispose:pe})}default:throw new Error(`invalid data location: ${q[3]}`)}},So=class{async fetchModelAndCopyToWasmMemory(q){return fn(await Vr(q))}async loadModel(q,te){jt();let ce;typeof q=="string"?ce=await this.fetchModelAndCopyToWasmMemory(q):ce=q,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await is(ce,te),$t()}async dispose(){return ac(this.sessionId)}async run(q,te,ce){jt();let _e=[],pe=[];Object.entries(q).forEach(We=>{let Oe=We[0],lt=We[1],Ae=this.inputNames.indexOf(Oe);if(Ae===-1)throw new Error(`invalid input '${Oe}'`);_e.push(lt),pe.push(Ae)});let Re=[],xe=[];Object.entries(te).forEach(We=>{let Oe=We[0],lt=We[1],Ae=this.outputNames.indexOf(Oe);if(Ae===-1)throw new Error(`invalid output '${Oe}'`);Re.push(lt),xe.push(Ae)});let Se=_e.map((We,Oe)=>ra(We,()=>`input "${this.inputNames[pe[Oe]]}"`)),De=Re.map((We,Oe)=>We?ra(We,()=>`output "${this.outputNames[xe[Oe]]}"`):null),Ue=await pn(this.sessionId,pe,Se,xe,De,ce),qe={};for(let We=0;We<Ue.length;We++)qe[this.outputNames[xe[We]]]=Re[We]??gn(Ue[We]);return $t(),qe}startProfiling(){}endProfiling(){mn(this.sessionId)}}}),xs={};p(xs,{OnnxruntimeWebAssemblyBackend:()=>Ss,initializeFlags:()=>Ws,wasmBackend:()=>vn});var Ws,Ss,vn,Za=u(()=>{Jt(),Qa(),ia(),Ws=()=>{(typeof I.wasm.initTimeout!="number"||I.wasm.initTimeout<0)&&(I.wasm.initTimeout=0);let q=I.wasm.simd;if(typeof q!="boolean"&&q!==void 0&&q!=="fixed"&&q!=="relaxed"&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${q}". Reset it to \`false\` and ignore SIMD feature checking.`),I.wasm.simd=!1),typeof I.wasm.proxy!="boolean"&&(I.wasm.proxy=!1),typeof I.wasm.trace!="boolean"&&(I.wasm.trace=!1),typeof I.wasm.numThreads!="number"||!Number.isInteger(I.wasm.numThreads)||I.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)I.wasm.numThreads=1;else{let te=typeof navigator>"u"?l("node:os").cpus().length:navigator.hardwareConcurrency;I.wasm.numThreads=Math.min(4,Math.ceil((te||1)/2))}},Ss=class{async init(q){Ws(),await zi(),await Vs(q)}async createInferenceSessionHandler(q,te){let ce=new So;return await ce.loadModel(q,te),ce}},vn=new Ss}),el={};p(el,{InferenceSession:()=>Rr,TRACE:()=>tt,TRACE_EVENT_BEGIN:()=>Wt,TRACE_EVENT_END:()=>ht,TRACE_FUNC_BEGIN:()=>jt,TRACE_FUNC_END:()=>$t,Tensor:()=>$e,default:()=>na,env:()=>I,registerBackend:()=>D}),Jt(),Jt(),Jt();var sa="1.24.3",na=vs;{let q=(Za(),m(xs)).wasmBackend;D("cpu",q,10),D("wasm",q,10)}return Object.defineProperty(I.versions,"web",{value:sa,enumerable:!0}),m(el)})();t.exports=o})(qm)),qm.exports}var Ry;function rS(){return Ry||(Ry=1,(function(t){var i=qo&&qo.__createBinding||(Object.create?(function(C,P,j,O){O===void 0&&(O=j);var F=Object.getOwnPropertyDescriptor(P,j);(!F||("get"in F?!P.__esModule:F.writable||F.configurable))&&(F={enumerable:!0,get:function(){return P[j]}}),Object.defineProperty(C,O,F)}):(function(C,P,j,O){O===void 0&&(O=j),C[O]=P[j]})),o=qo&&qo.__setModuleDefault||(Object.create?(function(C,P){Object.defineProperty(C,"default",{enumerable:!0,value:P})}):function(C,P){C.default=P}),a=qo&&qo.__importStar||function(C){if(C&&C.__esModule)return C;var P={};if(C!=null)for(var j in C)j!=="default"&&Object.prototype.hasOwnProperty.call(C,j)&&i(P,C,j);return o(P,C),P};Object.defineProperty(t,"__esModule",{value:!0}),t.MicVAD=t.getDefaultRealTimeVADOptions=t.ort=t.DEFAULT_MODEL=void 0;const f=a(tS()),S=av(),v=lv(),l=yf(),u=vm(),p=Jw(),y=Yw();t.DEFAULT_MODEL="legacy",t.ort=f;const m="vad.worklet.bundle.min.js",x="silero_vad_v5.onnx",$="silero_vad_legacy.onnx",D=C=>({...v.defaultFrameProcessorOptions,onFrameProcessed:()=>{},onVADMisfire:()=>{l.log.debug("VAD misfire")},onSpeechStart:()=>{l.log.debug("Detected speech start")},onSpeechEnd:()=>{l.log.debug("Detected speech end")},onSpeechRealStart:()=>{l.log.debug("Detected real speech start")},baseAssetPath:"./",onnxWASMBasePath:"./",model:C,workletOptions:{},getStream:async()=>await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}),pauseStream:async P=>{P.getTracks().forEach(j=>{j.stop()})},resumeStream:async()=>await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}),ortConfig:P=>{P.env.logLevel="error"},startOnLoad:!0,processorType:"auto"});t.getDefaultRealTimeVADOptions=D;const T=C=>"audioWorklet"in C&&typeof AudioWorkletNode=="function"?"AudioWorklet":"ScriptProcessor";async function g(C,P,j,O,F){await j.audioWorklet.addModule(C),P.processorOptions={...P.processorOptions??{},frameSamples:O};const I=new AudioWorkletNode(j,"vad-helper-worklet",P);return I.port.onmessage=async U=>{const Y=U.data;if(!(typeof Y=="object"&&Y&&"message"in Y)){console.error("Invalid message event",Y);return}switch(Y.message){case u.Message.AudioFrame:{if(!("data"in Y&&Y.data instanceof ArrayBuffer)){console.log("Audio frame message has no data");return}const se=new Float32Array(Y.data);await F(se);break}}},I}async function k(C,P,j){const O=new y.Resampler({nativeSampleRate:C.sampleRate,targetSampleRate:16e3,targetFrameSize:P});l.log.debug("using script processor");const I=C.createScriptProcessor(4096,1,1);let U=!1;return I.onaudioprocess=async Y=>{if(!U){U=!0;try{const se=Y.inputBuffer.getChannelData(0);Y.outputBuffer.getChannelData(0).fill(0);const ie=O.process(se);for(const ye of ie)await j(ye)}catch(se){console.error("Error processing audio:",se)}finally{U=!1}}},I.connect(C.destination),I}class w{constructor(P,j,O,F,I=!1,U=null,Y=null,se=null,de=null,ie=null,ye=null,ge="uninitialized",ke=!1){this.options=P,this.frameProcessor=j,this.model=O,this.frameSamples=F,this.listening=I,this.errored=U,this._stream=Y,this._audioContext=se,this._vadNode=de,this._mediaStreamAudioSourceNode=ie,this._audioProcessorAdapterType=ye,this.initializationState=ge,this.ownsAudioContext=ke,this.getAudioInstances=()=>{if(this._stream===null||this._audioContext===null||this._vadNode==null||this._mediaStreamAudioSourceNode==null)throw new Error("MicVAD has null stream, audio context, or processor adapter");return{stream:this._stream,audioContext:this._audioContext,vadNode:this._vadNode,mediaStreamAudioSourceNode:this._mediaStreamAudioSourceNode}},this.setErrored=be=>{this.initializationState="errored",this.errored=be},this.start=async()=>{switch(this.initializationState){case"uninitialized":{l.log.debug("initializing micVAD"),this.initializationState="initializing",this.frameProcessor.resume();try{this._stream=await this.options.getStream()}catch(be){throw be instanceof Error?this.setErrored(be.message):this.setErrored(String(be)),be}if(this.options.audioContext?(console.log("using custom audio context"),this._audioContext=this.options.audioContext):(console.log("using default audio context"),this._audioContext=new AudioContext,this.ownsAudioContext=!0),!this._audioContext)throw this.setErrored("Audio context is null"),Error("Audio context is null");switch(this._audioProcessorAdapterType=this.options.processorType=="auto"?T(this._audioContext):this.options.processorType,this._audioProcessorAdapterType){case"AudioWorklet":this._vadNode=await g(this.options.baseAssetPath+m,this.options.workletOptions,this._audioContext,this.frameSamples,this.processFrame);break;case"ScriptProcessor":this._vadNode=await k(this._audioContext,this.frameSamples,this.processFrame);break;default:throw new Error(`Unsupported audio processor adapter type: ${this._audioProcessorAdapterType}`)}this._mediaStreamAudioSourceNode=new MediaStreamAudioSourceNode(this._audioContext,{mediaStream:this._stream}),this._mediaStreamAudioSourceNode.connect(this._vadNode),l.log.debug("started micVAD"),this.listening=!0,this.initializationState="initialized";break}case"initializing":{l.log.warn("start called while initializing");break}case"initialized":{if(this.listening)return;this.listening=!0,this.frameProcessor.resume();const{stream:be,audioContext:ue,vadNode:W}=this.getAudioInstances();this._stream=await this.options.resumeStream(be);const re=new MediaStreamAudioSourceNode(ue,{mediaStream:this._stream});this._mediaStreamAudioSourceNode=re,re.connect(W);break}case"destroyed":{l.log.warn("start called after destroyed");break}case"errored":{l.log.error("start called after errored");break}default:{l.log.warn("weird initialization state");break}}},this.pause=async()=>{if(!this.listening)return;this.listening=!1;const{stream:be,mediaStreamAudioSourceNode:ue}=this.getAudioInstances();await this.options.pauseStream(be),ue.disconnect(),this.frameProcessor.pause(this.handleFrameProcessorEvent)},this.destroy=async()=>{var ue;l.log.debug("destroy called"),this.initializationState="destroyed";const{vadNode:be}=this.getAudioInstances();be instanceof AudioWorkletNode&&be.port.postMessage(u.Message.SpeechStop),this.listening&&await this.pause(),await this.model.release(),this.ownsAudioContext&&await((ue=this._audioContext)==null?void 0:ue.close())},this.setOptions=be=>{this.frameProcessor.setOptions(be)},this.processFrame=async be=>{await this.frameProcessor.process(be,this.handleFrameProcessorEvent)},this.handleFrameProcessorEvent=be=>{switch(be.msg){case u.Message.FrameProcessed:this.options.onFrameProcessed(be.probs,be.frame);break;case u.Message.SpeechStart:this.options.onSpeechStart();break;case u.Message.SpeechRealStart:this.options.onSpeechRealStart();break;case u.Message.VADMisfire:this.options.onVADMisfire();break;case u.Message.SpeechEnd:this.options.onSpeechEnd(be.audio);break}}}static async new(P={}){const j={...(0,t.getDefaultRealTimeVADOptions)(P.model??t.DEFAULT_MODEL),...P};(0,v.validateOptions)(j),t.ort.env.wasm.wasmPaths=j.onnxWASMBasePath,j.ortConfig!==void 0&&j.ortConfig(t.ort);const O=j.model==="v5"?x:$,F=j.baseAssetPath+O,I=j.model==="v5"?p.SileroV5.new:p.SileroLegacy.new;let U;try{U=await I(t.ort,()=>(0,S.defaultModelFetcher)(F))}catch(ye){throw console.error(`Encountered an error while loading model file ${F}`),ye}const Y=j.model==="v5"?512:1536,se=Y/16,de=new v.FrameProcessor(U.process,U.reset_state,{positiveSpeechThreshold:j.positiveSpeechThreshold,negativeSpeechThreshold:j.negativeSpeechThreshold,redemptionMs:j.redemptionMs,preSpeechPadMs:j.preSpeechPadMs,minSpeechMs:j.minSpeechMs,submitUserSpeechOnPause:j.submitUserSpeechOnPause},se),ie=new w(j,de,U,Y);if(j.startOnLoad)try{await ie.start()}catch(ye){throw console.error("Error starting micVad",ye),ye}return ie}}t.MicVAD=w})(qo)),qo}var Py;function iS(){return Py||(Py=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultRealTimeVADOptions=t.MicVAD=t.DEFAULT_MODEL=t.utils=t.NonRealTimeVAD=t.Message=t.FrameProcessor=t.defaultModelFetcher=t.baseAssetPath=void 0;var i=Gw();Object.defineProperty(t,"baseAssetPath",{enumerable:!0,get:function(){return i.baseAssetPath}});var o=av();Object.defineProperty(t,"defaultModelFetcher",{enumerable:!0,get:function(){return o.defaultModelFetcher}});var a=lv();Object.defineProperty(t,"FrameProcessor",{enumerable:!0,get:function(){return a.FrameProcessor}});var f=vm();Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return f.Message}});var S=Zx();Object.defineProperty(t,"NonRealTimeVAD",{enumerable:!0,get:function(){return S.NonRealTimeVAD}});const v=eS();t.utils={audioFileToArray:v.audioFileToArray,minFramesForTargetMS:v.minFramesForTargetMS,arrayBufferToBase64:v.arrayBufferToBase64,encodeWAV:v.encodeWAV};var l=rS();Object.defineProperty(t,"DEFAULT_MODEL",{enumerable:!0,get:function(){return l.DEFAULT_MODEL}}),Object.defineProperty(t,"MicVAD",{enumerable:!0,get:function(){return l.MicVAD}}),Object.defineProperty(t,"getDefaultRealTimeVADOptions",{enumerable:!0,get:function(){return l.getDefaultRealTimeVADOptions}})})(Vm)),Vm}var sS=iS();function kp(t,i,o,a){var S,v;try{(v=(S=window.api)==null?void 0:S.logs)==null||v.write(t,i,o,a)}catch{}const f=i==="error"?console.error:i==="warn"?console.warn:console.log;a!==void 0?f(`[${t}]`,o,a):f(`[${t}]`,o)}const ot={debug:(t,i,o)=>kp(t,"debug",i,o),info:(t,i,o)=>kp(t,"info",i,o),warn:(t,i,o)=>kp(t,"warn",i,o),error:(t,i,o)=>kp(t,"error",i,o)},Zw=16e3,nS=6,zu=Zw*nS,oS=800,aS=Zw*oS/1e3,Dy=500,Iy=2e3,My=1500,Ly=3e3,lS=.5,cS=.35,jy=.85,Oy=.7;let gs=null,po=!1,Ji=!1;const Eg=new Set;function Cp(t){for(const i of Array.from(Eg))try{i(t)}catch(o){ot.warn("speech","workerDeath listener threw",{error:o instanceof Error?o.message:String(o)})}}let Gm=0;const Ny=2;let Gu=!1,e0=!1;function t0(t){t.addEventListener("message",i=>{var a;if(((a=i.data)==null?void 0:a.type)!=="log")return;const o=i.data.level||"info";ot[o]("whisperWorker",i.data.message??"",i.data.meta)}),t.addEventListener("error",i=>{ot.error("whisperWorker","worker error event (fatal)",{message:i.message,filename:i.filename,lineno:i.lineno}),uS(`error:${i.message||"unknown"}`)})}function sm(){return gs||(gs=new Worker(new URL(""+new URL("whisperWorker-ivwFFLMj.js",import.meta.url).href,import.meta.url),{type:"module"}),t0(gs),ot.info("speech","worker spawned"),gs)}let Ep=!1;function uS(t){if(!Gu){if(Ep){ot.warn("speech","respawnWorker: already in flight, ignoring",{reason:t});return}if(Ep=!0,Gm+=1,e0=!0,ot.warn("speech","respawnWorker: starting",{reason:t,attempt:Gm}),Cp({reason:t,respawned:!1,finalOnly:!0}),Gm>Ny){if(Gu=!0,ot.error("speech","respawnWorker: limit exceeded, disabling speech",{limit:Ny}),gs)try{gs.terminate()}catch{}gs=null,po=!1,Ji=!1,Cp({reason:"respawn-limit-exceeded",respawned:!1,finalOnly:!0}),Ep=!1;return}if(gs)try{gs.terminate()}catch{}gs=null,po=!1,Ji=!1;try{gs=new Worker(new URL(""+new URL("whisperWorker-ivwFFLMj.js",import.meta.url).href,import.meta.url),{type:"module"}),t0(gs),Ji=!0,gs.postMessage({type:"load"}),ot.info("speech","respawnWorker: new worker spawned, load posted"),Cp({reason:t,respawned:!0,finalOnly:!0})}catch(i){Gu=!0,ot.error("speech","respawnWorker: spawn failed, disabling speech",{error:i instanceof Error?i.message:String(i)}),Cp({reason:"spawn-failed",respawned:!1,finalOnly:!0})}finally{Ep=!1}}}function dS(t,i){if(po||Ji)return;Ji=!0;const o=sm();ot.info("speech","preloadModel: posting load");const a=f=>{f.data.type==="status"?(t==null||t(f.data.status,f.data.message),f.data.status==="ready"&&(po=!0,Ji=!1,ot.info("speech","preloadModel: ready"),o.removeEventListener("message",a))):f.data.type==="progress"?i==null||i(f.data.pct):f.data.type==="error"&&(Ji=!1,ot.error("speech","preloadModel: worker reported error",{error:f.data.error}),t==null||t("error",f.data.error),o.removeEventListener("message",a))};o.addEventListener("message",a),o.postMessage({type:"load"})}function hS(){ot.info("speech","resetModel: clearing load flags"),po=!1,Ji=!1}function cv(){var t;return typeof Worker<"u"&&!!((t=navigator.mediaDevices)!=null&&t.getUserMedia)&&typeof AudioWorkletNode<"u"}function fS(t){const i=sm();return!po&&!Ji&&(Ji=!0,i.postMessage({type:"load"})),new Promise((o,a)=>{const f=S=>{var v,l,u;((v=S.data)==null?void 0:v.type)==="result"?(i.removeEventListener("message",f),o((S.data.text??"").trim())):((l=S.data)==null?void 0:l.type)==="error"?(i.removeEventListener("message",f),a(new Error(String(S.data.error??"Transcription failed")))):((u=S.data)==null?void 0:u.type)==="status"&&S.data.status==="ready"&&(po=!0,Ji=!1)};i.addEventListener("message",f),i.postMessage({type:"transcribe",audio:t},[t.buffer])})}function pS(t){let i=sm(),o=!1,a=null,f=null,S=null,v=null,l=null;const u=[],p=new Set;let y=null,m=0,x=!1,$=0,D=!1,T=!1,g=0,k=0,w=0,C=-1,P=Dy,j=0,O=null;const F=()=>(y||(y=new Float32Array(zu)),y),I=()=>{m=0},U=be=>{const ue=F(),W=be.length;if(W>=zu){ue.set(be.subarray(W-zu)),m=zu;return}if(m+W<=zu){ue.set(be,m),m+=W;return}const re=m+W-zu;ue.copyWithin(0,re,m),m-=re,ue.set(be,m),m+=W},Y=()=>{O&&(clearTimeout(O),O=null)},se=()=>{Y(),x=!1,D=!1,T=!1,P=Dy,I()},de=()=>{if(o||!x||T||D||O)return;if(m<aS){O=setTimeout(()=>{O=null,de()},P);return}const be=performance.now()-g;if(be<P&&g!==0){O=setTimeout(()=>{O=null,de()},P-be);return}if(e0||Gu||t.partialsEnabled&&!t.partialsEnabled())return;const ue=F(),W=new Float32Array(m);W.set(ue.subarray(0,m)),k+=1,w=k,D=!0,j=performance.now(),g=j,i.postMessage({type:"transcribe-partial",audio:W,seq:k},[W.buffer])},ie=be=>be.length===0?Promise.resolve():Gu?(ot.warn("speech","transcribeAudio: speech disabled (worker respawn limit hit)"),o||t.onError("Speech recognition disabled — please reload the app."),Promise.resolve()):new Promise(ue=>{u.push(ue),k+=1;const W=k;C=W,i.postMessage({type:"transcribe",audio:be,seq:W},[be.buffer])}),ye=be=>{const ue=ie(be);return p.add(ue),ue.finally(()=>{p.delete(ue)}),ue},ge=be=>{var ue,W,re,G,ne;if(be.data.type==="result"){const Pe=be.data.text,Ve=be.data.seq??0;Ve&&Ve<C&&ot.warn("speech","result: seq below latestFinalSeq (delivering anyway)",{seq:Ve,latestFinalSeq:C}),!o&&Pe&&t.onFinal(Pe),(ue=u.shift())==null||ue()}else if(be.data.type==="partial"){const Pe=be.data.seq??0,Ve=be.data.text??"",Ge=performance.now()-j;D=!1,Ge>=Ly?(T=!0,ot.warn("speech","partials.disabled.budget",{elapsedMs:Math.round(Ge),seq:Pe})):Ge>=My&&(P=Math.min(P*2,Iy),ot.warn("speech","partials.slowdown",{elapsedMs:Math.round(Ge),newIntervalMs:P,seq:Pe}));const it=Pe!==w||Pe<=C;!o&&!it&&Ve&&((W=t.onPartial)==null||W.call(t,Ve)),de()}else if(be.data.type==="partial-error"){const Pe=performance.now()-j;D=!1,Pe>=Ly?(T=!0,ot.warn("speech","partials.disabled.budget (after error)",{elapsedMs:Math.round(Pe),seq:be.data.seq})):Pe>=My&&(P=Math.min(P*2,Iy),ot.warn("speech","partials.slowdown (after error)",{elapsedMs:Math.round(Pe),newIntervalMs:P,seq:be.data.seq})),ot.warn("speech","partial encode failed",{error:be.data.error,seq:be.data.seq}),de()}else be.data.type==="error"?(o||t.onError(be.data.error),(re=u.shift())==null||re()):be.data.type==="status"?(o||(G=t.onModelStatus)==null||G.call(t,be.data.status,be.data.message),be.data.status==="ready"&&(po=!0,Ji=!1)):be.data.type==="progress"&&(o||(ne=t.onProgress)==null||ne.call(t,be.data.pct))};i.addEventListener("message",ge);const ke=be=>{var ue,W;if(!o){for(ot.warn("speech","createRecognition: worker death event",be),(ue=t.onStatusChange)==null||ue.call(t,"restarting");u.length;)(W=u.shift())==null||W();if(p.clear(),Y(),D=!1,be.respawned){try{i.removeEventListener("message",ge)}catch{}i=sm(),i.addEventListener("message",ge)}}};return Eg.add(ke),{start:async()=>{if(!o){if(Gu){t.onError("Speech recognition disabled — please reload the app.");return}!po&&!Ji&&(Ji=!0,ot.info("speech","createRecognition.start: triggering model load"),i.postMessage({type:"load"})),ot.info("speech","createRecognition.start: initializing VAD",{modelReady:po,modelLoading:Ji});try{const be=new URL("vad/",document.baseURI).href,ue=t.inputDeviceId||null,W={channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0};ue&&(W.deviceId={exact:ue}),ot.info("speech","getUserMedia",{hasDeviceId:!!ue,deviceIdPrefix:ue?ue.slice(0,8):null});const re=await navigator.mediaDevices.getUserMedia({audio:W});f=re,S=new AudioContext;for(const G of re.getAudioTracks())G.addEventListener("ended",()=>{o||(ot.warn("speech","mic track ended (permission revoked or device removed)"),t.onError("Microphone disconnected or permission revoked"))});try{l=S.createMediaStreamSource(f),v=S.createAnalyser(),v.fftSize=2048,v.smoothingTimeConstant=.3,l.connect(v)}catch(G){ot.warn("speech","analyser init failed",{error:G instanceof Error?G.message:String(G)}),l=null,v=null}a=await sS.MicVAD.new({audioContext:S,getStream:async()=>re,resumeStream:async()=>re,pauseStream:async()=>{},baseAssetPath:be,onnxWASMBasePath:be,model:"v5",positiveSpeechThreshold:lS,negativeSpeechThreshold:cS,minSpeechMs:250,redemptionMs:600,preSpeechPadMs:300,submitUserSpeechOnPause:!0,onFrameProcessed:(G,ne)=>{o||x&&(U(ne),de())},onSpeechStart:()=>{var G;o||(se(),x=!0,$=performance.now(),(G=t.onSpeechStart)==null||G.call(t))},onSpeechEnd:G=>{var ne;o||((ne=t.onStatusChange)==null||ne.call(t,"transcribing"),se(),ye(G))},onVADMisfire:()=>{var G,ne;o||((G=t.onStatusChange)==null||G.call(t,"idle"),se(),(ne=t.onMisfire)==null||ne.call(t))}}),a.start()}catch(be){const ue=be instanceof Error?be.message:"Microphone access denied",W=be instanceof Error?be.stack:"";if(ot.error("speech","createRecognition.start: VAD init failed",{error:ue,stack:W}),v){try{v.disconnect()}catch{}v=null}if(l){try{l.disconnect()}catch{}l=null}if(f){try{f.getTracks().forEach(re=>re.stop())}catch{}f=null}if(S){try{await S.close()}catch{}S=null}t.onError(ue)}}},stop:async()=>{if(a)try{await a.pause()}catch{}for(se();p.size>0;)await Promise.all(Array.from(p));if(a){try{await a.destroy()}catch{}a=null}if(v){try{v.disconnect()}catch{}v=null}if(l){try{l.disconnect()}catch{}l=null}if(f){try{f.getTracks().forEach(be=>be.stop())}catch{}f=null}if(S){try{await S.close()}catch{}S=null}},setVadThresholds:(be,ue)=>{if(a)try{a.setOptions({positiveSpeechThreshold:be,negativeSpeechThreshold:ue})}catch(W){ot.warn("speech","setVadThresholds failed",{error:W instanceof Error?W.message:String(W)})}},getAnalyser:()=>v,destroy:()=>{if(o=!0,se(),a){try{a.destroy()}catch{}a=null}if(v){try{v.disconnect()}catch{}v=null}if(l){try{l.disconnect()}catch{}l=null}if(S){try{S.close()}catch{}S=null}if(f){try{f.getTracks().forEach(be=>be.stop())}catch{}f=null}Eg.delete(ke),i.removeEventListener("message",ge)}}}let sf=null;const Tg=new Set,$g=new Set;function mS(){for(const t of Tg)try{t()}catch{}}function Ag(){for(const t of $g)try{t()}catch{}}function gS(t){return t.replace(/```[\s\S]*?```/g,"").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/\*{1,3}([^*]+)\*{1,3}/g,"$1").replace(/_{1,3}([^_]+)_{1,3}/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/^[-*_]{3,}\s*$/gm,"").replace(/^>\s?/gm,"").replace(/^[\s]*[-*+]\s/gm,"").replace(/^[\s]*\d+\.\s/gm,"").trim()}function vS(t){if(!window.speechSynthesis)return;const i=gS(t);if(!i)return;const o=new SpeechSynthesisUtterance(i);o.rate=1,o.pitch=1,o.onstart=()=>{sf=performance.now(),mS()},o.onend=()=>{!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&(sf=null,Ag())},o.onerror=a=>{a.error!=="canceled"&&!window.speechSynthesis.speaking&&!window.speechSynthesis.pending&&(sf=null,Ag())},window.speechSynthesis.speak(o)}function r0(){window.speechSynthesis&&(window.speechSynthesis.cancel(),sf=null,Ag())}function i0(){var t;return((t=window.speechSynthesis)==null?void 0:t.speaking)??!1}function yS(){return sf}function _S(t){return Tg.add(t),()=>{Tg.delete(t)}}function wS(t){return $g.add(t),()=>{$g.delete(t)}}const bS=.5,xS=.35;function SS(t){i0()&&(t.setVadThresholds(jy,Oy),ot.info("voice","tts.duck.on",{reason:"already-speaking-on-attach"}));const i=_S(()=>{t.setVadThresholds(jy,Oy),ot.info("voice","tts.duck.on")}),o=wS(()=>{t.setVadThresholds(bS,xS),ot.info("voice","tts.duck.off")});return()=>{i(),o()}}const kS=[{match:/^(send|submit|enter)\.?$/i,data:"\r",label:"send"},{match:/^(cancel|escape)\.?$/i,data:"\x1B",label:"cancel"},{match:/^clear( line)?\.?$/i,data:"",label:"clear"}];function CS(t){const i=t.trim();return kS.find(o=>o.match.test(i))??null}const ES=5e3;let Yl=null;function Km(){Yl&&clearTimeout(Yl),Yl=setTimeout(()=>{Yl=null,wt.getState().stopRecording()},ES)}function Tp(){Yl&&(clearTimeout(Yl),Yl=null)}let Ql=null;function TS(t){Ql&&clearTimeout(Ql);const i=wt.getState().submitDelayMs;wt.setState({submitCountdownStartAt:performance.now()}),Ql=setTimeout(()=>{Ql=null,wt.setState({submitCountdownStartAt:null});try{window.api.pty.write({tabId:t,data:"\r"})}catch(o){ot.warn("voice","submit pty.write failed",{error:o instanceof Error?o.message:String(o)})}wt.getState().stopRecording()},i)}function Gh(){Ql&&(clearTimeout(Ql),Ql=null),wt.getState().submitCountdownStartAt!==null&&wt.setState({submitCountdownStartAt:null})}let ci=null,Ii=null;function $S(){var t;return((t=ci==null?void 0:ci.getAnalyser)==null?void 0:t.call(ci))??null}const $p=1e4;let nf=null;function Ap(){nf&&(clearTimeout(nf),nf=null)}let Hp=null,qp=null;function Rp(){Hp=null,qp&&(qp(),qp=null)}const AS=1500,RS=9e4;let Pp=0,Gp=null,Rg=-1;function Dp(){Gp&&(clearTimeout(Gp),Gp=null,Rg=-1)}const PS=new Set(["you","You","Thank you.","Thanks for watching.","Thanks for watching!","Thank you for watching.","Thank you for watching!",".","Bye.","Bye!"]),wt=vf((t,i)=>({isRecording:!1,ttsEnabled:!1,autoSubmit:!0,submitDelayMs:3e3,submitCountdownStartAt:null,lastTranscript:"",lastPartial:"",statusPill:"idle",partialsEnabled:!0,error:null,errorKind:null,modelStatus:"idle",loadingProgress:0,permissionState:"unknown",lastBargeInAt:null,hotkeyState:"idle",levelMeterEnabled:!0,turnDetectorState:"disabled",turnDetectorMode:"off",wizardArmed:!1,wizardOpen:!1,initModel:()=>{if(i().modelStatus!=="idle")return;ot.info("voice","initModel: kicking off preload"),t({modelStatus:"loading",error:null,errorKind:null,loadingProgress:0});const o=++Pp,a=()=>{o===Pp&&(Dp(),Rg=o,Gp=setTimeout(()=>{Rg===o&&i().modelStatus==="loading"&&(ot.warn("voice","mic.gate.timeout: no progress within 90s"),t({modelStatus:"error",error:"Model load timed out",errorKind:"timeout"}))},RS))};a(),dS((f,S)=>{o===Pp&&(f==="ready"?(Dp(),ot.info("voice","modelStatus -> ready"),t({modelStatus:"ready",loadingProgress:100,errorKind:null})):f==="error"?(Dp(),ot.error("voice","modelStatus -> error",{msg:S}),t({modelStatus:"error",error:S,errorKind:"load"})):t({modelStatus:"loading"}))},f=>{o===Pp&&(a(),t({loadingProgress:Math.round(f)}))})},resetAndRetryModel:()=>{ot.info("voice","mic.gate.retry"),Dp(),hS(),t({modelStatus:"idle",error:null,errorKind:null,loadingProgress:0}),i().initModel()},startRecording:o=>{if(i().isRecording)return;if(ci){ot.warn("voice","startRecording: prior handle still draining, ignoring");return}if(!cv()){t({error:"Microphone or Web Worker not available",errorKind:"recording"});return}const a=f=>{try{const S=pS({inputDeviceId:f,onStatusChange:v=>{t(v==="transcribing"?{statusPill:"transcribing"}:v==="restarting"?{statusPill:"restarting"}:{statusPill:"idle"})},onPartial:v=>{i().partialsEnabled&&t({lastPartial:v})},partialsEnabled:()=>i().partialsEnabled,onSpeechStart:()=>{if(t({statusPill:"listening",lastPartial:""}),Tp(),Gh(),i0()){const l=yS(),u=l!==null?performance.now()-l:null;r0(),t({lastBargeInAt:performance.now()}),ot.info("voice","barge-in",{tabId:o,utteranceOffsetMs:u})}else ot.debug("voice","barge-in.no-op",{tabId:o})},onMisfire:()=>{t({lastPartial:"",statusPill:"idle"}),Km();const v=i().lastBargeInAt;v!==null&&performance.now()-v<600&&ot.warn("voice","barge-in.misfire",{tabId:o,sinceBargeInMs:Math.round(performance.now()-v)})},onFinal:v=>{Km();const l=v.trim();if(!l||PS.has(l)){t({lastTranscript:"",lastPartial:"",statusPill:"idle"});return}const u=CS(l);if(u){ot.info("voice","voice-command",{tabId:o,label:u.label,transcript:l}),window.api.pty.write({tabId:o,data:u.data}),t({lastTranscript:"",lastPartial:"",statusPill:"idle"}),Gh();const y=window;y.__transcripts&&(y.__transcripts.push({tabId:o,text:l}),y.__transcripts.length>500&&y.__transcripts.shift());return}window.api.pty.write({tabId:o,data:l}),t({lastTranscript:"",lastPartial:"",statusPill:"idle"}),i().autoSubmit&&TS(o);const p=window;p.__transcripts&&(p.__transcripts.push({tabId:o,text:l}),p.__transcripts.length>500&&p.__transcripts.shift())},onError:v=>{ot.error("voice","recognition error",{err:v}),t({error:v,errorKind:"recording",isRecording:!1,lastPartial:"",statusPill:"idle"}),Ii==null||Ii(),Ii=null,Tp(),ci==null||ci.destroy(),ci=null},onModelStatus:v=>{v==="ready"?t({modelStatus:"ready",loadingProgress:100}):v==="loading"&&t({modelStatus:"loading"})},onProgress:v=>t({loadingProgress:Math.round(v)})});ci=S,t({isRecording:!0,error:null,lastTranscript:"",lastPartial:"",statusPill:"listening"}),Km(),S.start().then(()=>{ci===S&&(Ii==null||Ii(),Ii=SS(S))}).catch(v=>{ot.error("voice","handle.start() failed",{error:v instanceof Error?v.message:String(v)})})}catch(S){t({error:S instanceof Error?S.message:"Failed to start recording",errorKind:"recording"})}};Promise.resolve().then(()=>{var f,S,v;return((v=(S=(f=window.api)==null?void 0:f.voice)==null?void 0:S.getDevicePref)==null?void 0:v.call(S))??Promise.resolve(null)}).then(f=>a((f==null?void 0:f.selectedDeviceId)??null)).catch(f=>{ot.warn("voice","getDevicePref failed; using default device",{error:f instanceof Error?f.message:String(f)}),a(null)})},stopRecording:()=>{const o=ci;o&&(Tp(),Gh(),Ii==null||Ii(),Ii=null,t({isRecording:!1,lastTranscript:"",lastPartial:"",statusPill:"idle"}),o.stop().finally(()=>{o.destroy(),ci===o&&(ci=null),i().hotkeyState==="stopping"&&(Ap(),t({hotkeyState:"idle"}))}))},restartWithDevice:async()=>{if(!i().isRecording)return;const o=ci;if(!o)return;Tp(),Ii==null||Ii(),Ii=null,t({isRecording:!1,lastTranscript:"",lastPartial:""});try{await o.stop()}catch(S){ot.warn("voice","restartWithDevice: drain rejected",{error:S instanceof Error?S.message:String(S)})}o.destroy(),ci===o&&(ci=null);const{useSessions:a}=await qw(async()=>{const{useSessions:S}=await Promise.resolve().then(()=>zx);return{useSessions:S}},[],import.meta.url),f=a.getState().activeTabId;f&&i().startRecording(f)},toggleTTS:()=>t(o=>({ttsEnabled:!o.ttsEnabled})),setAutoSubmit:o=>t({autoSubmit:o}),setSubmitDelayMs:o=>t({submitDelayMs:Math.max(500,Math.min(1e4,Math.floor(o)))}),cancelSubmit:()=>Gh(),setPartialsEnabled:o=>{i().partialsEnabled!==o&&(t({partialsEnabled:o}),o||t({lastPartial:""}))},clearError:()=>t({error:null,errorKind:null}),setPermissionState:o=>{i().permissionState!==o&&(ot.info("voice","mic.gate.permission_changed",{from:i().permissionState,to:o}),t({permissionState:o}))},setLevelMeterEnabled:o=>{i().levelMeterEnabled!==o&&t({levelMeterEnabled:o})},setTurnDetectorRuntimeState:o=>{i().turnDetectorState!==o&&(t({turnDetectorState:o}),o==="load_failed"?ot.warn("voice-turn","voice-turn.load_failed"):o==="runtime_error"?ot.warn("voice-turn","voice-turn.runtime_error"):o==="disabled"&&ot.info("voice-turn","voice-turn.fallback_to_vad"))},setWizardArmed:o=>{i().wizardArmed!==o&&t({wizardArmed:o})},openWizard:()=>{i().wizardOpen||t({wizardOpen:!0})},closeWizard:()=>{i().wizardOpen&&t({wizardOpen:!1})},armHotkey:({phase:o,source:a,mode:f,tabId:S})=>{const v=i(),{canRecord:l,reason:u}=Pg(v);if(o==="down"){if(u==="error"||u==="load-timeout"){v.resetAndRetryModel(),ot.info("voice-hotkey","down.retry",{source:a,reason:u});return}if(!l&&u!=="loading"){ot.warn("voice-hotkey","miss-model-loading",{modelStatus:v.modelStatus,reason:u});return}if(v.hotkeyState==="recording"||v.isRecording){(f==="toggle"||a==="global")&&(t({hotkeyState:"stopping"}),Ap(),nf=setTimeout(()=>{i().hotkeyState==="stopping"&&(ot.warn("voice-hotkey","drain-timeout",{durationMs:$p}),t({hotkeyState:"aborted"}),setTimeout(()=>{i().hotkeyState==="aborted"&&t({hotkeyState:"idle"})},0))},$p),v.stopRecording());return}if(u==="loading"){v.hotkeyState!=="armed"&&(t({hotkeyState:"armed"}),ot.info("voice-hotkey","armed",{source:a,modelStatus:v.modelStatus})),Rp(),Hp={tabId:S,source:a,mode:f},qp=wt.subscribe((p,y)=>{if(Hp&&p.modelStatus==="ready"&&y.modelStatus!=="ready"&&p.hotkeyState==="armed"){const m=Hp;if(Rp(),!m.tabId){ot.warn("voice-hotkey","armed-promote-no-tab",{source:m.source}),t({hotkeyState:"idle"});return}ot.info("voice-hotkey","armed-promote",m),t({hotkeyState:"recording"}),wt.getState().startRecording(m.tabId)}});return}if(!S){ot.warn("voice-hotkey","no-active-tab",{source:a});return}ot.info("voice-hotkey","start",{source:a,mode:f,tabId:S}),v.startRecording(S),i().isRecording?t({hotkeyState:"recording"}):(ot.warn("voice-hotkey","start: recording did not engage",{errorKind:i().errorKind}),t({hotkeyState:"idle"}));return}if(!(f!=="hold"||a==="global")){if(v.hotkeyState==="armed"){Rp(),ot.info("voice-hotkey","miss-model-loading-armed-up"),t({hotkeyState:"idle"});return}v.hotkeyState==="recording"&&(t({hotkeyState:"stopping"}),Ap(),nf=setTimeout(()=>{i().hotkeyState==="stopping"&&(ot.warn("voice-hotkey","drain-timeout",{durationMs:$p}),t({hotkeyState:"aborted"}),setTimeout(()=>{i().hotkeyState==="aborted"&&t({hotkeyState:"idle"})},0))},$p),v.stopRecording())}},destroyHotkey:()=>{const o=i();if(Rp(),Gh(),o.hotkeyState==="recording"){ot.warn("voice-hotkey","destroyed-mid-recording"),t({hotkeyState:"destroyed"});try{o.stopRecording()}catch{}}else(o.hotkeyState==="armed"||o.hotkeyState==="stopping")&&(Ap(),t({hotkeyState:"destroyed"}))}})),Pg=t=>cv()?t.permissionState==="denied"?{canRecord:!1,reason:"permission-denied"}:t.modelStatus==="ready"?{canRecord:!0,reason:"ready"}:t.modelStatus==="loading"?{canRecord:!1,reason:"loading"}:t.modelStatus==="error"?{canRecord:!1,reason:t.errorKind==="timeout"?"load-timeout":"error"}:{canRecord:!1,reason:"idle"}:{canRecord:!1,reason:"unsupported"};if(typeof window<"u"){const t=window;t.__voice=wt,t.__transcripts=[]}function DS(t,i={}){switch(t){case"ready":return i.isRecording?"Stop voice input":"Start voice input (local Whisper, offline)";case"idle":return"Microphone — speech model not started";case"loading":return`Microphone — loading speech model, ${typeof i.loadingPct=="number"?Math.round(i.loadingPct):0} percent`;case"error":return i.errorMessage?`Microphone — speech model error: ${i.errorMessage}. Activate to retry.`:"Microphone — speech model error. Activate to retry.";case"load-timeout":return"Microphone — model load timed out. Activate to retry.";case"permission-denied":return"Microphone — permission denied. Open OS settings.";case"unsupported":return"Microphone — voice input not supported in this build."}}const By=t=>Symbol.iterator in t,zy=t=>"entries"in t,Fy=(t,i)=>{const o=t instanceof Map?t:new Map(t.entries()),a=i instanceof Map?i:new Map(i.entries());if(o.size!==a.size)return!1;for(const[f,S]of o)if(!a.has(f)||!Object.is(S,a.get(f)))return!1;return!0},IS=(t,i)=>{const o=t[Symbol.iterator](),a=i[Symbol.iterator]();let f=o.next(),S=a.next();for(;!f.done&&!S.done;){if(!Object.is(f.value,S.value))return!1;f=o.next(),S=a.next()}return!!f.done&&!!S.done};function MS(t,i){return Object.is(t,i)?!0:typeof t!="object"||t===null||typeof i!="object"||i===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(i)?!1:By(t)&&By(i)?zy(t)&&zy(i)?Fy(t,i):IS(t,i):Fy({entries:()=>Object.entries(t)},{entries:()=>Object.entries(i)})}function LS(t){const i=Ln.useRef(void 0);return o=>{const a=t(o);return MS(i.current,a)?i.current:i.current=a}}let Uy=0;const jS=1e3;function OS(t){const i=performance.now();i-Uy<jS||(Uy=i,ot.debug("voice","mic.gate.click_rejected",{reason:t}))}function NS(){const t=wt(p=>p.isRecording),i=wt(p=>p.error),o=wt(p=>p.loadingProgress),a=wt(LS(Pg)),f=()=>{const p=wt.getState(),{canRecord:y,reason:m}=Pg(p);if(p.isRecording)return p.stopRecording();if(p.wizardArmed&&!p.wizardOpen){p.openWizard();return}if(m==="error"||m==="load-timeout"){p.resetAndRetryModel();return}if(!y)return OS(m);const x=zt.getState().activeTabId;x&&p.startRecording(x)},S=DS(a.reason,{loadingPct:o,errorMessage:i,isRecording:t}),v=a.reason==="unsupported",l=!a.canRecord,u=a.reason==="loading"?"text-fg-faint animate-pulse cursor-wait":a.reason==="error"||a.reason==="load-timeout"?"text-red-400 cursor-pointer":a.reason==="permission-denied"?"text-amber-400 cursor-pointer":a.reason==="idle"?"text-fg-faint cursor-pointer":a.reason==="unsupported"?"text-fg-faint cursor-not-allowed":t?"text-red-400 ring-2 ring-red-400 animate-pulse":"text-fg-dim hover:text-fg";return h.jsx("button",{onClick:f,disabled:v,"aria-disabled":l,"aria-label":S,title:S,"data-testid":"mic-button","data-state":a.reason,className:`p-1.5 rounded transition-colors ${u}`,children:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"9",y:"1",width:"6",height:"12",rx:"3"}),h.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),h.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"}),h.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"})]})})}function BS(){const t=wt(o=>o.ttsEnabled),i=wt(o=>o.toggleTTS);return h.jsxs("button",{onClick:i,title:t?"Read Claude replies aloud: ON":"Read Claude replies aloud: OFF",className:`px-1.5 py-1 rounded transition-colors flex items-center gap-1 ${t?"text-accent":"text-fg-dim hover:text-fg"}`,children:[h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),t?h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),h.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}):h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),h.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]})]}),h.jsx("span",{className:"text-[10px] font-medium tracking-wide",children:"TTS"})]})}function zS(t){return/^monitor of /i.test(t.trim())}function Vy(t){return t.replace(/\s*\([^)]*\)\s*$/,"").replace(/\s*#\d+\s*$/,"").replace(/\s+/g," ").trim().toLowerCase()}function Wy(t,i,o){if(t){const v=o.find(l=>l.deviceId===t);if(v)return v}if(!i)return null;const a=o.filter(v=>v.label===i);if(a.length===1)return a[0];if(a.length>1)return null;const f=Vy(i),S=o.filter(v=>v.label&&Vy(v.label)===f);return S.length===1?S[0]:null}async function Hy(t){var o;return(o=navigator.mediaDevices)!=null&&o.enumerateDevices?(await navigator.mediaDevices.enumerateDevices()).filter(a=>!(a.kind!=="audioinput"||a.label&&zS(a.label))):[]}const qy=!1;function s0(){const t=wt(p=>p.isRecording);wt(p=>p.startRecording),wt(p=>p.stopRecording);const[i,o]=X.useState([]),[a,f]=X.useState(null),[S,v]=X.useState(null);X.useEffect(()=>{let p=!1;return(async()=>{try{const y=await window.api.voice.getDevicePref();if(p)return;const m=await Hy(qy);if(p)return;o(m),v(y.selectedLabel);const x=Wy(y.selectedDeviceId,y.selectedLabel,m);x?(f(x.deviceId),y.selectedDeviceId&&x.deviceId!==y.selectedDeviceId&&(ot.info("voice","device-picker rebind-by-label",{fromIdPrefix:y.selectedDeviceId.slice(0,8),toIdPrefix:x.deviceId.slice(0,8)}),await window.api.voice.setDevicePref({selectedDeviceId:x.deviceId,selectedLabel:x.label||y.selectedLabel}).catch(()=>{}))):((y.selectedDeviceId||y.selectedLabel)&&(console.warn("[MicDevicePicker] previously-selected device unavailable; falling back to OS default",{savedLabel:y.selectedLabel,hadId:!!y.selectedDeviceId}),ot.warn("voice","device-picker selected-unavailable",{hadId:!!y.selectedDeviceId})),f(null))}catch(y){ot.warn("voice","device-picker init failed",{error:y instanceof Error?y.message:String(y)})}})(),()=>{p=!0}},[]);const l=X.useCallback(async()=>{try{const p=await Hy(qy);if(o(p),a&&!p.some(y=>y.deviceId===a)){const y=Wy(null,S,p);y?(f(y.deviceId),await window.api.voice.setDevicePref({selectedDeviceId:y.deviceId,selectedLabel:y.label||S}).catch(()=>{})):f(null)}}catch(p){ot.warn("voice","device-picker refresh failed",{error:p instanceof Error?p.message:String(p)})}},[a,S]);X.useEffect(()=>{const p=()=>{l()};return window.addEventListener("mic-device-change",p),()=>window.removeEventListener("mic-device-change",p)},[l]);const u=async p=>{var $;const y=p.target.value,m=y===""?null:y,x=m?(($=i.find(D=>D.deviceId===m))==null?void 0:$.label)??null:null;f(m),v(x);try{await window.api.voice.setDevicePref({selectedDeviceId:m,selectedLabel:x}),ot.info("voice","device-picker selected",{deviceIdPrefix:m?m.slice(0,8):null})}catch(D){ot.warn("voice","setDevicePref failed",{error:D instanceof Error?D.message:String(D)})}if(t)try{await wt.getState().restartWithDevice()}catch(D){ot.warn("voice","device-picker restart failed",{error:D instanceof Error?D.message:String(D)})}};return h.jsxs("select",{value:a??"",onChange:u,onFocus:()=>{l()},title:"Microphone input device","data-testid":"mic-device-picker",className:"text-[10px] bg-bg border border-line text-fg-dim hover:text-fg rounded px-1.5 py-1 max-w-[8rem] truncate",children:[h.jsx("option",{value:"",children:"Default"}),i.map(p=>h.jsx("option",{value:p.deviceId,children:p.label||`Mic ${p.deviceId.slice(0,6)}`},p.deviceId))]})}function FS(){const t=wt($=>$.isRecording),i=wt($=>$.levelMeterEnabled),[o,a]=X.useState(0),[f,S]=X.useState(0),v=X.useRef(0);v.current=f;const[l,u]=X.useState(0),[p,y]=X.useState(!1),m=X.useRef(null);if(X.useEffect(()=>{if(!t||!i){a(0),S(0);return}let $=0,D=!1,T=null,g=null;const k=()=>{if(D)return;const C=g??$S();if(!C){$=requestAnimationFrame(k);return}g!==C&&(g=C,T=new Uint8Array(new ArrayBuffer(C.fftSize)));const P=T;C.getByteTimeDomainData(P);let j=0;for(let U=0;U<P.length;U++){const Y=P[U]-128;j+=Y*Y}const O=Math.sqrt(j/P.length)/128,F=O>0?20*Math.log10(O):-60,I=Math.max(0,Math.min(1,(F+60)/60));S(O),a(I),O>=.95&&(y(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>y(!1),150)),$=requestAnimationFrame(k)};$=requestAnimationFrame(k);const w=setInterval(()=>{D||u(Math.round(v.current*100))},250);return()=>{D=!0,cancelAnimationFrame($),clearInterval(w),m.current&&(clearTimeout(m.current),m.current=null)}},[t,i]),!t||!i)return null;const x=p?"bg-red-500":f>=.7?"bg-amber-400":"bg-green-500";return h.jsx("div",{role:"meter","aria-label":"Microphone input level","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":100,"data-testid":"mic-level-meter",className:`mx-3 mb-2 h-1 rounded bg-bg overflow-hidden ${p?"ring-1 ring-red-500":""}`,children:h.jsx("div",{className:`h-full ${x} transition-[width] duration-75 ease-out`,style:{width:`${o*100}%`}})})}const US=5,VS=1440*60*1e3,n0="sm.scheduler.hiddenCompletedSlugs";function WS(){try{const t=localStorage.getItem(n0);if(!t)return new Set;const i=JSON.parse(t);return Array.isArray(i)?new Set(i.filter(o=>typeof o=="string")):new Set}catch{return new Set}}function Gy(t){try{localStorage.setItem(n0,JSON.stringify([...t]))}catch{}}function HS(t){if(!t)return null;const i=t.replace(/\/+$/,"").split("/");return i[i.length-1]||t}function qS(){const[t,i]=X.useState(null),[o,a]=X.useState(()=>Date.now()),[f,S]=X.useState(()=>WS()),[v,l]=X.useState(!1);X.useEffect(()=>{let O=null;return window.api.schedule.state().then(i).catch(()=>{}),O=window.api.schedule.onState(i),()=>{O&&O()}},[]),X.useEffect(()=>{const O=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(O)},[]);const u=X.useMemo(()=>{if(!t)return 15e4;const O=[];for(const F of t.jobs)if(F.status==="completed"&&F.startedAt&&F.finishedAt){const I=Date.parse(F.finishedAt)-Date.parse(F.startedAt);I>0&&O.push(I)}return O.length===0?15e4:O.reduce((F,I)=>F+I,0)/O.length},[t]);if(!t)return null;const{config:p,jobs:y,paused:m,lastRunAt:x,nextReset:$}=t,D={pending:0,running:0,completed:0,failed:0};for(const O of y)(O.status==="pending"||O.status==="running"||O.status==="completed"||O.status==="failed")&&D[O.status]++;const T=GS({snap:t,now:o,avgDurationMs:u}),g=KS(y),{inline:k,collapsedCount:w}=XS(y,f,o,v),C=()=>{const O=new Set(f);for(const F of y)F.status==="completed"&&O.add(F.slug);S(O),Gy(O)},P=()=>{S(new Set),Gy(new Set),l(!1)},j=k.some(O=>O.status==="completed");return h.jsxs("div",{className:"bg-bg-elev/60",children:[h.jsxs("div",{className:`px-3 py-2 ${YS(T.kind)}`,title:T.tooltip,children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(JS,{kind:T.kind}),h.jsx("div",{className:"text-[11px] font-medium truncate",children:T.line1})]}),T.action&&h.jsx("button",{type:"button",onClick:T.action.onClick,className:"text-[10px] px-1.5 py-0.5 border border-line hover:border-fg-faint rounded shrink-0 hover:bg-bg",title:T.action.title,children:T.action.label})]}),T.line2&&h.jsx("div",{className:"text-[10px] text-fg-faint mt-0.5 truncate font-mono",children:T.line2})]}),h.jsxs("div",{className:"px-3 pb-3 pt-2 space-y-2 border-t border-line",children:[h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-fg-faint",children:[h.jsxs("label",{className:"flex items-center gap-1",children:[h.jsx("span",{children:"policy"}),h.jsxs("select",{value:p.firePolicy??"when-available",onChange:O=>window.api.schedule.setConfig({firePolicy:O.target.value}),className:"bg-bg border border-line rounded px-1 py-0.5",title:"when-available: poll usage and fire when tokens are below threshold. on-reset: fire after each 5h reset. manual: only on Run now.",children:[h.jsx("option",{value:"when-available",children:"when available"}),h.jsx("option",{value:"on-reset",children:"on reset"}),h.jsx("option",{value:"manual",children:"manual"})]})]}),h.jsxs("label",{className:"flex items-center gap-1",title:"Max simultaneous jobs within a parallel group",children:[h.jsx("span",{children:"parallel"}),h.jsx("input",{type:"number",min:1,max:20,value:p.concurrencyCap,onChange:O=>window.api.schedule.setConfig({concurrencyCap:Number(O.target.value)}),className:"w-10 bg-bg border border-line rounded px-1 py-0.5 font-mono"})]}),p.firePolicy==="when-available"&&h.jsxs("label",{className:"flex items-center gap-1",title:"Fire only when 5h utilization is below this percent",children:[h.jsx("span",{children:"util<"}),h.jsx("input",{type:"number",min:0,max:100,value:p.utilizationThreshold??90,onChange:O=>window.api.schedule.setConfig({utilizationThreshold:Number(O.target.value)}),className:"w-10 bg-bg border border-line rounded px-1 py-0.5 font-mono"}),h.jsx("span",{children:"%"})]})]}),h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-fg-faint",children:[h.jsx("button",{type:"button",onClick:()=>window.api.schedule.runNow(),disabled:D.pending===0&&D.running===0,className:"px-2 py-0.5 text-fg-dim hover:text-fg border border-line hover:border-fg-faint rounded disabled:opacity-40 disabled:cursor-not-allowed",title:"Execute all pending jobs now (clears any pause)",children:"Run now"}),h.jsxs("div",{className:"flex-1 text-right font-mono",children:[D.pending,"p · ",D.running,"r · ",D.completed,"d",D.failed>0&&h.jsxs("span",{className:"text-red-400",children:[" · ",D.failed,"f"]})]}),j&&h.jsx("button",{type:"button",onClick:C,className:"px-1.5 py-0.5 text-fg-faint hover:text-fg-dim hover:border-fg-faint border border-line rounded",title:"Hide completed jobs from this view (queue.json unchanged — they remain in history)",children:"Clear done"})]}),h.jsxs("div",{className:"space-y-0.5 max-h-72 overflow-y-auto",children:[y.length===0&&h.jsxs("div",{className:"text-[10px] text-fg-faint italic",children:["No PRDs queued. Drop .md files in:",h.jsx("button",{type:"button",onClick:()=>window.api.schedule.openFolder(),className:"block mt-1 text-fg-dim hover:text-fg underline truncate w-full text-left",children:"~/.claude/session-manager/scheduled-plans/prds/"})]}),k.map(O=>h.jsx(ZS,{job:O,eta:QS(O,y,g.get(O.slug)??0,u,T.kind,o),now:o},O.slug)),w>0&&h.jsxs("button",{type:"button",onClick:()=>l(O=>!O),className:"w-full text-left text-[10px] text-fg-faint hover:text-fg-dim px-1.5 py-1",title:v?"Re-collapse old/cleared completed":"Show all completed (incl. cleared and >24h)",children:[v?"▾":"▸"," ",w," more completed",f.size>0&&h.jsx("span",{className:"ml-2 underline",onClick:O=>{O.stopPropagation(),P()},children:"un-hide"})]})]}),h.jsxs("div",{className:"flex items-center justify-between text-[9px] text-fg-faint pt-1 border-t border-line",children:[h.jsxs("span",{children:[$&&h.jsxs("span",{title:`next 5h reset: ${$}`,children:["reset ",Ku(Date.parse($)-o)]}),x&&h.jsxs("span",{className:"ml-2",title:x,children:["last run ",Ku(o-Date.parse(x))," ago"]})]}),h.jsx("button",{type:"button",onClick:()=>window.api.schedule.openFolder(),className:"hover:text-fg-dim underline",children:"folder"})]})]})]})}function GS({snap:t,now:i,avgDurationMs:o}){const{config:a,jobs:f,paused:S,nextReset:v,utilization:l}=t;let u=0,p=0,y=null;for(const T of f)T.status==="pending"?u++:T.status==="completed"?p++:T.status==="running"&&!y&&(y=T);const x=u+(y?1:0);if(y){const T=y,g=T.startedAt?i-Date.parse(T.startedAt):0,k=p+1,w=p+x;return{kind:"running",line1:`Running ${k}/${w} · ${Dg(g)}`,line2:T.title,tooltip:`${T.slug} (group ${T.parallelGroup})`}}if(S){const T=S.resumeAt?Date.parse(S.resumeAt)-i:null;return{kind:"paused",line1:S.reason==="rate_limit"?"Paused — tokens exhausted":`Paused — ${S.reason}`,line2:T!==null&&T>0?`auto-resume ${Xm(Date.parse(S.resumeAt))} (in ${Ku(T)})`:S.resumeAt?"resuming…":"no auto-resume scheduled",tooltip:S.resumeAt??"",action:{label:"Resume",onClick:()=>window.api.schedule.resume(),title:"Clear the pause and resume queue immediately"}}}if(x===0)return{kind:"idle",line1:"No work queued",line2:null};const $=a.firePolicy??"when-available";if($==="manual")return{kind:"manual",line1:`Manual · ${u} pending`,line2:"click Run now to fire",action:{label:"Run now",onClick:()=>window.api.schedule.runNow(),title:"Execute all pending jobs now"}};if($==="on-reset"){if(!v)return{kind:"on-reset",line1:"On-reset · waiting for billing data",line2:null};const T=Date.parse(v)+a.offsetMinutes*6e4,g=T-i;return{kind:"on-reset",line1:`On-reset · ${u} pending`,line2:g>0?`fires ${Xm(T)} (in ${Ku(g)})`:"firing now…"}}const D=a.utilizationThreshold??90;if(l==null)return{kind:"auto-soon",line1:`Auto · ${u} pending`,line2:"checking token availability…"};if(l>=D){const T=v?Date.parse(v)-i:null;return{kind:"auto-throttled",line1:`Auto · throttled (util ${l.toFixed(0)}% ≥ ${D}%)`,line2:T&&T>0?`next reset ${Xm(Date.parse(v))} (in ${Ku(T)})`:"will fire when usage drops"}}return{kind:"auto-soon",line1:`Auto · ${u} pending · util ${l.toFixed(0)}%`,line2:"fires within 2 min (poll cycle)"}}function KS(t){const i=t.filter(a=>a.status==="running"||a.status==="pending").sort((a,f)=>a.parallelGroup-f.parallelGroup||a.slug.localeCompare(f.slug)),o=new Map;return i.forEach((a,f)=>o.set(a.slug,f)),o}function XS(t,i,o,a){if(a)return{inline:t,collapsedCount:0};const f=t.filter(p=>p.status==="completed").sort((p,y)=>{const m=p.finishedAt?Date.parse(p.finishedAt):0;return(y.finishedAt?Date.parse(y.finishedAt):0)-m}),S=new Set;let v=0;for(const p of f){if(v>=US)break;i.has(p.slug)||p.finishedAt&&o-Date.parse(p.finishedAt)>VS||(S.add(p.slug),v++)}const l=[];let u=0;for(const p of t){if(p.status!=="completed"){l.push(p);continue}S.has(p.slug)?l.push(p):u++}return{inline:l,collapsedCount:u}}function JS({kind:t}){return t==="running"?h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse shrink-0"}):t==="paused"?h.jsx("span",{className:"text-[11px] shrink-0",title:"paused",children:"⏸"}):t==="manual"?h.jsx("span",{className:"text-[11px] shrink-0",title:"manual",children:"✋"}):t==="on-reset"||t==="auto-soon"?h.jsx("span",{className:"text-[11px] shrink-0",title:"auto",children:"⏰"}):t==="auto-throttled"?h.jsx("span",{className:"text-[11px] shrink-0",title:"throttled",children:"⏳"}):h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-fg-faint/40 shrink-0"})}function YS(t){return t==="running"?"bg-accent/5":t==="paused"?"bg-amber-500/10":t==="auto-throttled"?"bg-amber-500/5":""}function QS(t,i,o,a,f,S){if(t.status!=="pending"||f==="paused"||f==="manual"||f==="auto-throttled")return null;let v=o*a;if(o>0){const l=i.find(u=>u.status==="running"&&u.startedAt);l&&l.startedAt&&(v-=Math.min(a,S-Date.parse(l.startedAt)))}return v<=5e3?"~now":`~+${Ku(v)}`}function ZS({job:t,eta:i,now:o}){const[a,f]=X.useState(!1),S=t.status==="running"?"bg-accent animate-pulse":t.status==="completed"?"bg-green-500":t.status==="failed"?"bg-red-400":"bg-fg-faint/40";let v=null;t.status==="running"&&t.startedAt?v=Dg(o-Date.parse(t.startedAt)):t.status==="completed"&&t.startedAt&&t.finishedAt?v=Dg(Date.parse(t.finishedAt)-Date.parse(t.startedAt)):i&&(v=i);const l=HS(t.cwd);return h.jsxs("div",{className:"text-[11px]",children:[h.jsxs("button",{type:"button",onClick:()=>f(u=>!u),className:"w-full flex items-center gap-2 px-1.5 py-1 hover:bg-bg-hi rounded text-left",title:t.title,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S}`}),h.jsx("span",{className:"truncate flex-1 text-fg-dim",children:t.title}),l&&h.jsx("span",{className:"font-mono text-[9px] text-fg-faint shrink-0 px-1 rounded bg-bg/50",title:t.cwd??"",children:l}),v&&h.jsx("span",{className:"font-mono text-[9px] text-fg-faint shrink-0",children:v})]}),a&&h.jsxs("div",{className:"px-3 py-1 text-[10px] text-fg-faint space-y-1 bg-bg/50 rounded",children:[h.jsxs("div",{className:"font-mono",children:["g",t.parallelGroup," · ",t.slug]}),t.cwd&&h.jsxs("div",{className:"font-mono truncate",title:t.cwd,children:["cwd: ",t.cwd]}),t.exitCode!==null&&h.jsxs("div",{className:t.exitCode===0?"text-green-500":"text-red-400",children:["exit ",t.exitCode]}),t.error&&h.jsx("div",{className:"text-red-400 break-all",children:t.error}),h.jsxs("div",{className:"flex gap-2 pt-1",children:[t.status!=="pending"&&h.jsx("button",{type:"button",onClick:()=>window.api.schedule.resetJob(t.slug),className:"text-fg-dim hover:text-fg underline",children:"reset to pending"}),t.runId&&h.jsx("button",{type:"button",onClick:async()=>{const u=await window.api.schedule.readLog(t.runId,t.slug);if(u.ok&&u.text){const p=window.open("","_blank");p&&(p.document.body.innerText=u.text,p.document.title=`${t.slug} — ${t.runId}`)}},className:"text-fg-dim hover:text-fg underline",children:"view log"})]})]})]})}function Dg(t){t<0&&(t=0);const i=Math.floor(t/1e3);if(i<60)return`${i}s`;const o=Math.floor(i/60);return o<60?`${o}m${(i%60).toString().padStart(2,"0")}s`:`${Math.floor(o/60)}h${(o%60).toString().padStart(2,"0")}m`}function Ku(t){t<0&&(t=0);const i=Math.floor(t/1e3);if(i<60)return`${i}s`;const o=Math.floor(i/60);return o<60?`${o}m`:`${Math.floor(o/60)}h${o%60?` ${o%60}m`:""}`}function Xm(t){return new Date(t).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",timeZoneName:"short"})}function e1(){const t=wt(p=>p.submitCountdownStartAt),i=wt(p=>p.submitDelayMs),[o,a]=X.useState(()=>performance.now());if(X.useEffect(()=>{if(t===null)return;let p;const y=()=>{a(performance.now()),p=requestAnimationFrame(y)};return p=requestAnimationFrame(y),()=>cancelAnimationFrame(p)},[t]),t===null)return null;const f=o-t,S=Math.max(0,i-f),v=Math.max(0,Math.min(100,S/i*100)),l=S<500,u=wt.getState().cancelSubmit;return h.jsx("div",{className:"px-3 pb-1",onClick:u,title:`Submitting in ${(S/1e3).toFixed(1)}s — click to cancel`,children:h.jsx("div",{className:"h-0.5 w-full bg-bg rounded overflow-hidden cursor-pointer",children:h.jsx("div",{className:`h-full transition-colors ${l?"bg-amber-400":"bg-accent"}`,style:{width:`${v}%`}})})})}function t1(t,i,o){return{tabId:t,sessionUuid:o,cwd:i,path:null,todos:[],lastToolUses:[],plans:[],agents:[],usage:{inputTokens:0,outputTokens:0},lastEventAt:0}}const ki=vf((t,i)=>({tabs:{},refs:{},unsubs:{},subscribe:(o,a,f)=>{const S={...i().refs};if(S[o]=(S[o]??0)+1,t({refs:S}),S[o]>1)return;t({tabs:{...i().tabs,[o]:t1(o,a,f)}});const v=window.api.transcripts.onEvent(o,l=>i().ingest(o,l));t({unsubs:{...i().unsubs,[o]:v}}),window.api.transcripts.subscribe({tabId:o,cwd:a,sessionUuid:f}).then(async l=>{const u=i().tabs[o];if(!u)return;t({tabs:{...i().tabs,[o]:{...u,path:l.path}}});const p=await window.api.transcripts.buffer(o);for(const y of p)i().ingest(o,y,{replay:!0})}).catch(l=>console.error("[live] transcripts.subscribe failed:",o,l))},unsubscribe:o=>{const a={...i().refs};if(!a[o])return;if(a[o]--,a[o]>0){t({refs:a});return}delete a[o];const f=i().unsubs[o];f==null||f();const S={...i().unsubs};delete S[o];const v={...i().tabs};delete v[o],window.api.transcripts.unsubscribe(o),t({refs:a,unsubs:S,tabs:v})},ingest:(o,a,f)=>{const S=i().tabs[o];if(!S)return;const v={...S,lastEventAt:f!=null&&f.replay?S.lastEventAt:Date.now()};switch(a.kind){case"todo_write":{const l=Array.isArray(a.data)?a.data:[];v.todos=l;break}case"tool_use":{const l=a.data;v.lastToolUses=[{id:l.id,name:l.name,input:l.input,at:Date.now()},...S.lastToolUses].slice(0,50);break}case"plan":{const l=a.data,u=typeof l=="string"?l:(l==null?void 0:l.plan)??JSON.stringify(l);v.plans=[{at:Date.now(),content:u??""},...S.plans];break}case"agent_spawn":{const l=a.data;v.agents=[{at:Date.now(),subagentType:l==null?void 0:l.subagent_type,description:l==null?void 0:l.description},...S.agents].slice(0,50);break}case"usage":{const l=a.data;v.usage={inputTokens:(S.usage.inputTokens||0)+(l.input_tokens??l.inputTokens??0),outputTokens:(S.usage.outputTokens||0)+(l.output_tokens??l.outputTokens??0),cacheCreationInputTokens:(S.usage.cacheCreationInputTokens||0)+(l.cache_creation_input_tokens??l.cacheCreationInputTokens??0),cacheReadInputTokens:(S.usage.cacheReadInputTokens||0)+(l.cache_read_input_tokens??l.cacheReadInputTokens??0)};break}}t({tabs:{...i().tabs,[o]:v}})}})),r1=[{key:"overview",label:"Overview"},{key:"terminal",label:"Terminal"},{key:"system-prompt",label:"System Prompt"},{key:"settings",label:"Settings"},{key:"permissions",label:"Permissions"},{key:"skills",label:"Skills"},{key:"plugins",label:"Plugins"},{key:"mcp",label:"MCP Servers"},{key:"hooks",label:"Hooks"},{key:"subagents",label:"Subagents",liveKind:"subagents"},{key:"plans",label:"Plans"},{key:"tasks",label:"Tasks",liveKind:"tasks"},{key:"projects",label:"Projects"},{key:"history",label:"History"},{key:"keybindings",label:"Keybindings"},{key:"usage",label:"Usage"},{key:"agent-view",label:"Agent-View",liveKind:"agentView"}],o0="sm.leftNavWidth",Jm=240,a0=200,l0=420,i1={subagents:"A subagent was spawned in the last minute",tasks:"A task is currently in progress",agentView:"Claude is working right now"};function s1(){const t=ki(f=>f.tabs),[i,o]=X.useState(()=>Date.now());X.useEffect(()=>{const f=setInterval(()=>o(Date.now()),5e3);return()=>clearInterval(f)},[]);const a=Object.values(t);return{subagents:a.some(f=>f.agents.some(S=>i-S.at<6e4)),tasks:a.some(f=>f.todos.some(S=>S.status==="in_progress")),agentView:a.some(f=>f.lastEventAt>0&&i-f.lastEventAt<5e3)}}function n1(){try{const t=localStorage.getItem(o0);if(!t)return Jm;const i=parseInt(t,10);return Number.isFinite(i)?Math.max(a0,Math.min(l0,i)):Jm}catch{return Jm}}function o1(t){try{localStorage.setItem(o0,String(t))}catch{}}function a1({onResize:t}){const i=X.useRef(!1),o=X.useRef(0),a=X.useCallback(f=>{f.preventDefault(),i.current=!0,o.current=f.clientX,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const S=l=>{if(!i.current)return;const u=l.clientX-o.current;o.current=l.clientX,t(u)},v=()=>{i.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",S),window.addEventListener("mouseup",v)},[t]);return h.jsx("div",{onMouseDown:a,className:"absolute top-0 right-0 h-full w-1 cursor-col-resize hover:bg-accent/40 active:bg-accent/60 transition-colors z-10",title:"Drag to resize"})}function l1(t,i){try{const o=localStorage.getItem(`sm.leftNav.section.${t}.collapsed`);return o===null?i:o==="1"}catch{return i}}function c1(t,i){try{localStorage.setItem(`sm.leftNav.section.${t}.collapsed`,i?"1":"0")}catch{}}function uv({title:t,storageKey:i,defaultCollapsed:o=!1,badge:a,children:f}){const[S,v]=X.useState(()=>l1(i,o)),l=()=>{const u=!S;v(u),c1(i,u)};return h.jsxs("div",{className:"border-t border-line",children:[h.jsxs("button",{type:"button",onClick:l,className:"w-full px-3 py-1.5 flex items-center justify-between text-[10px] uppercase tracking-wider text-fg-faint hover:text-fg-dim",children:[h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx("span",{children:t}),a]}),h.jsx("span",{children:S?"▸":"▾"})]}),!S&&f]})}function u1({active:t,onChange:i,onNewSession:o}){const a=s1(),[f,S]=X.useState(()=>n1()),v=X.useCallback(l=>{S(u=>{const p=Math.max(a0,Math.min(l0,u+l));return o1(p),p})},[]);return h.jsxs("nav",{className:"bg-bg-elev border-r border-line shrink-0 overflow-hidden flex flex-col relative",style:{width:`${f}px`},children:[h.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:r1.map(l=>{const u=l.liveKind?a[l.liveKind]:!1,p=l.liveKind&&u?i1[l.liveKind]:void 0;return h.jsxs("button",{onClick:()=>i(l.key),title:p,className:`w-full text-left px-4 py-1.5 text-xs flex items-center justify-between transition-colors ${t===l.key?"bg-bg-hi text-fg border-l-2 border-accent":"text-fg-dim hover:text-fg hover:bg-bg-hi border-l-2 border-transparent"}`,children:[h.jsx("span",{children:l.label}),u&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"})]},l.key)})}),o&&h.jsxs("div",{className:"shrink-0 max-h-[60vh] overflow-y-auto",children:[h.jsx(d1,{}),h.jsx(h1,{}),h.jsx(m1,{onNewSession:o})]}),h.jsx(a1,{onResize:v})]})}function d1(){const[t,i]=X.useState(0),[o,a]=X.useState("idle");X.useEffect(()=>{let v=null;const l=u=>{if(!u)return;const p=u.jobs.filter(x=>x.status==="pending").length,y=u.jobs.some(x=>x.status==="running"),m=u.paused?"paused":y?"running":"idle";i(x=>x===p?x:p),a(x=>x===m?x:m)};return window.api.schedule.state().then(l).catch(()=>{}),v=window.api.schedule.onState(l),()=>{v&&v()}},[]);const f=t>0||o!=="idle",S=h.jsxs("span",{className:"flex items-center gap-1",children:[t>0&&h.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg text-fg-dim font-mono normal-case tracking-normal",children:t}),o==="running"&&h.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-accent/15 text-accent normal-case tracking-normal",title:"a scheduler job is running",children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),h.jsx("span",{className:"text-[9px] font-medium",children:"working"})]}),o==="paused"&&h.jsx("span",{className:"text-amber-400",title:"paused",children:"⏸"})]});return h.jsx(uv,{title:"Scheduler",storageKey:"scheduler",defaultCollapsed:!f,badge:S,children:h.jsx(qS,{})})}function h1(){const t=wt(a=>a.isRecording),i=wt(a=>a.error),o=h.jsxs("span",{className:"flex items-center gap-1",children:[t&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-400 animate-pulse",title:"recording"}),i&&h.jsx("span",{className:"text-red-400",title:i,children:"⚠"})]});return h.jsxs(uv,{title:"Microphone",storageKey:"microphone",defaultCollapsed:!1,badge:o,children:[h.jsx(v1,{}),h.jsx(e1,{}),h.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 flex-wrap",children:[h.jsx(NS,{}),h.jsx(s0,{}),h.jsx(BS,{})]}),h.jsx(f1,{}),h.jsxs("div",{className:"px-3 pb-2 flex items-center gap-3 flex-wrap",children:[h.jsx("button",{type:"button",onClick:()=>wt.getState().openWizard(),className:"text-[10px] text-fg-faint hover:text-fg-dim underline","data-testid":"run-mic-check",children:"Run mic check"}),h.jsx(g1,{})]}),h.jsx(FS,{})]})}function f1(){const t=wt(S=>S.isRecording),[i,o]=X.useState(null);if(X.useEffect(()=>{let S=!1;window.api.voice.getHotkeyConfig().then(l=>{S||o(l)}).catch(()=>{});const v=window.api.voice.onHotkeyConfigChanged(l=>o(l));return()=>{S=!0,v()}},[]),t||!i)return null;const a=i.mode==="hold"?"Hold":"Press",f=p1(i.accelerator);return h.jsxs("div",{className:"px-3 pb-1 text-[10px] text-fg-faint",children:[h.jsxs("span",{children:[a," "]}),h.jsx("kbd",{className:"px-1 py-0.5 rounded border border-line bg-bg font-mono text-fg-dim",children:f}),h.jsx("span",{children:" to record"})]})}function p1(t){const i=typeof navigator<"u"&&/Mac/.test(navigator.platform);return t.replace(/CommandOrControl/g,i?"⌘":"Ctrl").replace(/CmdOrCtrl/g,i?"⌘":"Ctrl").replace(/Command/g,"⌘").replace(/Control/g,"Ctrl").replace(/Option/g,i?"⌥":"Alt").replace(/Shift/g,i?"⇧":"Shift")}function m1({onNewSession:t}){return h.jsx(uv,{title:"Session",storageKey:"session",defaultCollapsed:!1,children:h.jsx("div",{className:"px-3 py-2",children:h.jsx("button",{onClick:t,className:"w-full px-3 py-1.5 text-xs text-fg-dim hover:text-fg bg-bg hover:bg-bg-hi border border-line rounded transition-colors",children:"+ New Session"})})})}function g1(){const[t,i]=X.useState(null);if(X.useEffect(()=>{let a=!1;window.api.voice.getHotkeyConfig().then(S=>{a||i(S)}).catch(S=>ot.warn("voice-hotkey","getHotkeyConfig (toggle) failed",{error:String(S)}));const f=window.api.voice.onHotkeyConfigChanged(S=>{i(S)});return()=>{a=!0,f()}},[]),!t)return null;const o=async a=>{if(t.mode===a)return;const f={...t,mode:a};i(f);try{await window.api.voice.setHotkeyConfig(f)}catch(S){ot.warn("voice-hotkey","setHotkeyConfig (toggle) failed",{error:S instanceof Error?S.message:String(S)})}};return h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-fg-faint select-none",title:"Mic hotkey behavior. Tap on/off: press once to start, again to stop. Hold to talk: record only while held (push-to-talk).",children:[h.jsxs("label",{className:"flex items-center gap-0.5 cursor-pointer hover:text-fg-dim",children:[h.jsx("input",{type:"radio",name:"hotkey-mode",checked:t.mode==="toggle",onChange:()=>o("toggle"),className:"cursor-pointer","data-testid":"hotkey-mode-toggle"}),h.jsx("span",{children:"Tap on/off"})]}),h.jsxs("label",{className:"flex items-center gap-0.5 cursor-pointer hover:text-fg-dim",children:[h.jsx("input",{type:"radio",name:"hotkey-mode",checked:t.mode==="hold",onChange:()=>o("hold"),className:"cursor-pointer","data-testid":"hotkey-mode-hold"}),h.jsx("span",{children:"Hold to talk"})]})]})}function v1(){const t=wt(S=>S.isRecording),i=wt(S=>S.lastTranscript),o=wt(S=>S.error),a=wt(S=>S.modelStatus),f=wt(S=>S.loadingProgress);return o?h.jsxs("div",{className:"px-3 py-2 text-[11px] text-red-400 truncate",title:o,children:["⚠ ",o]}):t?h.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 text-[11px] text-fg-dim border-b border-line",children:[h.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-red-400 animate-pulse shrink-0"}),h.jsx("span",{className:"truncate",title:i,children:i||"Listening…"})]}):a==="loading"?h.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-faint",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{children:"Loading speech model"}),h.jsxs("span",{className:"font-mono",children:[f,"%"]})]}),h.jsx("div",{className:"h-1 rounded bg-bg overflow-hidden",children:h.jsx("div",{className:"h-full bg-accent transition-[width] duration-200",style:{width:`${f}%`}})})]}):null}const Ky=6e4,Xy=3e4,y1=1e3,La={value:null,ts:0},Ym=new Map;function _1(t){if(!t)return"—";const i=Date.parse(t);if(Number.isNaN(i))return"—";const o=i-Date.now();if(o<=0)return"0m";const a=Math.floor(o/36e5),f=Math.floor(o%36e5/6e4);return`${a}h ${f}m`}function w1(){var C;const t=zt(P=>P.tabs),i=zt(P=>P.activeTabId),o=zt(P=>P.restartTab),a=t.find(P=>P.id===i)??null,f=ki(P=>{var j;return i?((j=P.tabs[i])==null?void 0:j.lastEventAt)??0:0}),[S,v]=X.useState(null),[l,u]=X.useState(La.value),[p,y]=X.useState(null),[,m]=X.useState(0);X.useEffect(()=>{const P=window.setInterval(()=>m(j=>j+1),y1);return()=>window.clearInterval(P)},[]),X.useEffect(()=>{let P=!1;const j=(a==null?void 0:a.presetId)??null;if(!j){v(null);return}return Vw(j).then(O=>{P||v((O==null?void 0:O.model)??null)}).catch(()=>{P||v(null)}),()=>{P=!0}},[a==null?void 0:a.presetId]),X.useEffect(()=>{let P=!1;const j=async()=>{const F=Date.now();if(La.value&&F-La.ts<Ky){P||u(La.value);return}try{const I=await window.api.billing.fetch();if(P)return;La.value=I,La.ts=Date.now(),u(I)}catch{if(P)return;La.value=null,La.ts=Date.now(),u(null)}};j();const O=window.setInterval(j,Ky);return()=>{P=!0,window.clearInterval(O)}},[]);const x=(a==null?void 0:a.cwd)??null;if(X.useEffect(()=>{let P=!1;if(!x){y(null);return}const j=async()=>{const F=Date.now(),I=Ym.get(x);if(I&&F-I.ts<Xy){P||y(I.value);return}try{const U=await window.api.app.gitBranch(x);if(P)return;Ym.set(x,{value:U,ts:Date.now()}),y(U)}catch{if(P)return;Ym.set(x,{value:null,ts:Date.now()}),y(null)}};j();const O=window.setInterval(j,Xy);return()=>{P=!0,window.clearInterval(O)}},[x]),!a)return h.jsx("div",{className:"h-6 bg-bg-elev border-t border-line flex items-center px-3 gap-4 text-xs text-fg-faint shrink-0"});const $=l!=null&&l.ok?((C=l.data)==null?void 0:C.usage.five_hour)??null:null,D=$?`${Math.round($.utilization)}%`:"—",T=$?_1($.resets_at):"—",g=S??"—",k=p??"—",w=f>0?`${Math.max(0,Math.floor((Date.now()-f)/1e3))}s`:"—";return h.jsxs("div",{className:"h-6 bg-bg-elev border-t border-line flex items-center px-3 gap-3 text-xs shrink-0 overflow-x-auto",children:[h.jsxs("div",{className:"font-mono text-fg-dim flex items-center gap-1 whitespace-nowrap tabular-nums",children:[h.jsx(Kh,{label:"model",value:g}),h.jsx(Ip,{}),h.jsx(Kh,{label:"5h",value:D}),h.jsx(Ip,{}),h.jsx(Kh,{label:"reset",value:T}),h.jsx(Ip,{}),h.jsx(Kh,{label:"branch",value:k}),h.jsx(Ip,{}),h.jsx(Kh,{label:"last",value:w})]}),h.jsx("div",{className:"flex-1"}),a.status==="running"&&h.jsx("button",{onClick:()=>o(a.id),className:"text-fg-faint hover:text-fg transition-colors whitespace-nowrap",title:"Restart session — kill claude and start fresh (picks up config changes)",children:"restart session"}),h.jsx("button",{onClick:()=>window.api.app.rebootApp(),className:"text-fg-faint hover:text-fg transition-colors whitespace-nowrap",title:"Restart Session Manager — reload app code (Ctrl+Shift+R)",children:"restart app"}),h.jsxs("span",{className:"truncate max-w-md text-fg-faint",children:["cwd: ",h.jsx("span",{className:"text-fg-dim font-mono",children:a.cwd})]})]})}function Kh({label:t,value:i}){return h.jsxs("span",{children:[h.jsxs("span",{className:"text-fg-faint",children:[t,":"]}),h.jsx("span",{className:"text-fg-dim",children:i})]})}function Ip(){return h.jsx("span",{className:"text-fg-faint",children:"·"})}var Qm={exports:{}},Jy;function b1(){return Jy||(Jy=1,(function(t,i){(function(o,a){t.exports=a()})(globalThis,(()=>(()=>{var o={4567:function(v,l,u){var p=this&&this.__decorate||function(w,C,P,j){var O,F=arguments.length,I=F<3?C:j===null?j=Object.getOwnPropertyDescriptor(C,P):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(w,C,P,j);else for(var U=w.length-1;U>=0;U--)(O=w[U])&&(I=(F<3?O(I):F>3?O(C,P,I):O(C,P))||I);return F>3&&I&&Object.defineProperty(C,P,I),I},y=this&&this.__param||function(w,C){return function(P,j){C(P,j,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=u(9042),x=u(9924),$=u(844),D=u(4725),T=u(2585),g=u(3656);let k=l.AccessibilityManager=class extends $.Disposable{constructor(w,C,P,j){super(),this._terminal=w,this._coreBrowserService=P,this._renderService=j,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let O=0;O<this._terminal.rows;O++)this._rowElements[O]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[O]);if(this._topBoundaryFocusListener=O=>this._handleBoundaryFocus(O,0),this._bottomBoundaryFocusListener=O=>this._handleBoundaryFocus(O,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((O=>this._handleResize(O.rows)))),this.register(this._terminal.onRender((O=>this._refreshRows(O.start,O.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((O=>this._handleChar(O)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2878
2878
|
`)))),this.register(this._terminal.onA11yTab((O=>this._handleTab(O)))),this.register(this._terminal.onKey((O=>this._handleKey(O.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,$.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(w){for(let C=0;C<w;C++)this._handleChar(" ")}_handleChar(w){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==w&&(this._charsToAnnounce+=w):this._charsToAnnounce+=w,w===`
|
|
2879
2879
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(w){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(w)||this._charsToConsume.push(w)}_refreshRows(w,C){this._liveRegionDebouncer.refresh(w,C,this._terminal.rows)}_renderRows(w,C){const P=this._terminal.buffer,j=P.lines.length.toString();for(let O=w;O<=C;O++){const F=P.lines.get(P.ydisp+O),I=[],U=(F==null?void 0:F.translateToString(!0,void 0,void 0,I))||"",Y=(P.ydisp+O+1).toString(),se=this._rowElements[O];se&&(U.length===0?(se.innerText=" ",this._rowColumns.set(se,[0,1])):(se.textContent=U,this._rowColumns.set(se,I)),se.setAttribute("aria-posinset",Y),se.setAttribute("aria-setsize",j))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(w,C){const P=w.target,j=this._rowElements[C===0?1:this._rowElements.length-2];if(P.getAttribute("aria-posinset")===(C===0?"1":`${this._terminal.buffer.lines.length}`)||w.relatedTarget!==j)return;let O,F;if(C===0?(O=P,F=this._rowElements.pop(),this._rowContainer.removeChild(F)):(O=this._rowElements.shift(),F=P,this._rowContainer.removeChild(O)),O.removeEventListener("focus",this._topBoundaryFocusListener),F.removeEventListener("focus",this._bottomBoundaryFocusListener),C===0){const I=this._createAccessibilityTreeNode();this._rowElements.unshift(I),this._rowContainer.insertAdjacentElement("afterbegin",I)}else{const I=this._createAccessibilityTreeNode();this._rowElements.push(I),this._rowContainer.appendChild(I)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(C===0?-1:1),this._rowElements[C===0?1:this._rowElements.length-2].focus(),w.preventDefault(),w.stopImmediatePropagation()}_handleSelectionChange(){var U;if(this._rowElements.length===0)return;const w=document.getSelection();if(!w)return;if(w.isCollapsed)return void(this._rowContainer.contains(w.anchorNode)&&this._terminal.clearSelection());if(!w.anchorNode||!w.focusNode)return void console.error("anchorNode and/or focusNode are null");let C={node:w.anchorNode,offset:w.anchorOffset},P={node:w.focusNode,offset:w.focusOffset};if((C.node.compareDocumentPosition(P.node)&Node.DOCUMENT_POSITION_PRECEDING||C.node===P.node&&C.offset>P.offset)&&([C,P]=[P,C]),C.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(C={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(C.node))return;const j=this._rowElements.slice(-1)[0];if(P.node.compareDocumentPosition(j)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(P={node:j,offset:((U=j.textContent)==null?void 0:U.length)??0}),!this._rowContainer.contains(P.node))return;const O=({node:Y,offset:se})=>{const de=Y instanceof Text?Y.parentNode:Y;let ie=parseInt(de==null?void 0:de.getAttribute("aria-posinset"),10)-1;if(isNaN(ie))return console.warn("row is invalid. Race condition?"),null;const ye=this._rowColumns.get(de);if(!ye)return console.warn("columns is null. Race condition?"),null;let ge=se<ye.length?ye[se]:ye.slice(-1)[0]+1;return ge>=this._terminal.cols&&(++ie,ge=0),{row:ie,column:ge}},F=O(C),I=O(P);if(F&&I){if(F.row>I.row||F.row===I.row&&F.column>=I.column)throw new Error("invalid range");this._terminal.select(F.column,F.row,(I.row-F.row)*this._terminal.cols-F.column+I.column)}}_handleResize(w){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let C=this._rowContainer.children.length;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);for(;this._rowElements.length>w;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const w=this._coreBrowserService.mainDocument.createElement("div");return w.setAttribute("role","listitem"),w.tabIndex=-1,this._refreshRowDimensions(w),w}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let w=0;w<this._terminal.rows;w++)this._refreshRowDimensions(this._rowElements[w])}}_refreshRowDimensions(w){w.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=k=p([y(1,T.IInstantiationService),y(2,D.ICoreBrowserService),y(3,D.IRenderService)],k)},3614:(v,l)=>{function u(x){return x.replace(/\r?\n/g,"\r")}function p(x,$){return $?"\x1B[200~"+x+"\x1B[201~":x}function y(x,$,D,T){x=p(x=u(x),D.decPrivateModes.bracketedPasteMode&&T.rawOptions.ignoreBracketedPasteMode!==!0),D.triggerDataEvent(x,!0),$.value=""}function m(x,$,D){const T=D.getBoundingClientRect(),g=x.clientX-T.left-10,k=x.clientY-T.top-10;$.style.width="20px",$.style.height="20px",$.style.left=`${g}px`,$.style.top=`${k}px`,$.style.zIndex="1000",$.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=u,l.bracketTextForPaste=p,l.copyHandler=function(x,$){x.clipboardData&&x.clipboardData.setData("text/plain",$.selectionText),x.preventDefault()},l.handlePasteEvent=function(x,$,D,T){x.stopPropagation(),x.clipboardData&&y(x.clipboardData.getData("text/plain"),$,D,T)},l.paste=y,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(x,$,D,T,g){m(x,$,D),g&&T.rightClickSelect(x),$.value=T.selectionText,$.select()}},7239:(v,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const p=u(1505);l.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(y,m,x){this._css.set(y,m,x)}getCss(y,m){return this._css.get(y,m)}setColor(y,m,x){this._color.set(y,m,x)}getColor(y,m){return this._color.get(y,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(v,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(u,p,y,m){u.addEventListener(p,y,m);let x=!1;return{dispose:()=>{x||(x=!0,u.removeEventListener(p,y,m))}}}},3551:function(v,l,u){var p=this&&this.__decorate||function(k,w,C,P){var j,O=arguments.length,F=O<3?w:P===null?P=Object.getOwnPropertyDescriptor(w,C):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(k,w,C,P);else for(var I=k.length-1;I>=0;I--)(j=k[I])&&(F=(O<3?j(F):O>3?j(w,C,F):j(w,C))||F);return O>3&&F&&Object.defineProperty(w,C,F),F},y=this&&this.__param||function(k,w){return function(C,P){w(C,P,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=u(3656),x=u(8460),$=u(844),D=u(2585),T=u(4725);let g=l.Linkifier=class extends $.Disposable{get currentLink(){return this._currentLink}constructor(k,w,C,P,j){super(),this._element=k,this._mouseService=w,this._renderService=C,this._bufferService=P,this._linkProviderService=j,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,$.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,$.toDisposable)((()=>{var O;this._lastMouseEvent=void 0,(O=this._activeProviderReplies)==null||O.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(k){this._lastMouseEvent=k;const w=this._positionFromMouseEvent(k,this._element,this._mouseService);if(!w)return;this._isMouseOut=!1;const C=k.composedPath();for(let P=0;P<C.length;P++){const j=C[P];if(j.classList.contains("xterm"))break;if(j.classList.contains("xterm-hover"))return}this._lastBufferCell&&w.x===this._lastBufferCell.x&&w.y===this._lastBufferCell.y||(this._handleHover(w),this._lastBufferCell=w)}_handleHover(k){if(this._activeLine!==k.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(k,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,k)||(this._clearCurrentLink(),this._askForLink(k,!0))}_askForLink(k,w){var P,j;this._activeProviderReplies&&w||((P=this._activeProviderReplies)==null||P.forEach((O=>{O==null||O.forEach((F=>{F.link.dispose&&F.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=k.y);let C=!1;for(const[O,F]of this._linkProviderService.linkProviders.entries())w?(j=this._activeProviderReplies)!=null&&j.get(O)&&(C=this._checkLinkProviderResult(O,k,C)):F.provideLinks(k.y,(I=>{var Y,se;if(this._isMouseOut)return;const U=I==null?void 0:I.map((de=>({link:de})));(Y=this._activeProviderReplies)==null||Y.set(O,U),C=this._checkLinkProviderResult(O,k,C),((se=this._activeProviderReplies)==null?void 0:se.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(k.y,this._activeProviderReplies)}))}_removeIntersectingLinks(k,w){const C=new Set;for(let P=0;P<w.size;P++){const j=w.get(P);if(j)for(let O=0;O<j.length;O++){const F=j[O],I=F.link.range.start.y<k?0:F.link.range.start.x,U=F.link.range.end.y>k?this._bufferService.cols:F.link.range.end.x;for(let Y=I;Y<=U;Y++){if(C.has(Y)){j.splice(O--,1);break}C.add(Y)}}}}_checkLinkProviderResult(k,w,C){var O;if(!this._activeProviderReplies)return C;const P=this._activeProviderReplies.get(k);let j=!1;for(let F=0;F<k;F++)this._activeProviderReplies.has(F)&&!this._activeProviderReplies.get(F)||(j=!0);if(!j&&P){const F=P.find((I=>this._linkAtPosition(I.link,w)));F&&(C=!0,this._handleNewLink(F))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!C)for(let F=0;F<this._activeProviderReplies.size;F++){const I=(O=this._activeProviderReplies.get(F))==null?void 0:O.find((U=>this._linkAtPosition(U.link,w)));if(I){C=!0,this._handleNewLink(I);break}}return C}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(k){if(!this._currentLink)return;const w=this._positionFromMouseEvent(k,this._element,this._mouseService);w&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,w)&&this._currentLink.link.activate(k,this._currentLink.link.text)}_clearCurrentLink(k,w){this._currentLink&&this._lastMouseEvent&&(!k||!w||this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=w)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,$.disposeArray)(this._linkCacheDisposables))}_handleNewLink(k){if(!this._lastMouseEvent)return;const w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._linkAtPosition(k.link,w)&&(this._currentLink=k,this._currentLink.state={decorations:{underline:k.link.decorations===void 0||k.link.decorations.underline,pointerCursor:k.link.decorations===void 0||k.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,k.link,this._lastMouseEvent),k.link.decorations={},Object.defineProperties(k.link.decorations,{pointerCursor:{get:()=>{var C,P;return(P=(C=this._currentLink)==null?void 0:C.state)==null?void 0:P.decorations.pointerCursor},set:C=>{var P;(P=this._currentLink)!=null&&P.state&&this._currentLink.state.decorations.pointerCursor!==C&&(this._currentLink.state.decorations.pointerCursor=C,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",C))}},underline:{get:()=>{var C,P;return(P=(C=this._currentLink)==null?void 0:C.state)==null?void 0:P.decorations.underline},set:C=>{var P,j,O;(P=this._currentLink)!=null&&P.state&&((O=(j=this._currentLink)==null?void 0:j.state)==null?void 0:O.decorations.underline)!==C&&(this._currentLink.state.decorations.underline=C,this._currentLink.state.isHovered&&this._fireUnderlineEvent(k.link,C))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((C=>{if(!this._currentLink)return;const P=C.start===0?0:C.start+1+this._bufferService.buffer.ydisp,j=this._bufferService.buffer.ydisp+1+C.end;if(this._currentLink.link.range.start.y>=P&&this._currentLink.link.range.end.y<=j&&(this._clearCurrentLink(P,j),this._lastMouseEvent)){const O=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);O&&this._askForLink(O,!1)}}))))}_linkHover(k,w,C){var P;(P=this._currentLink)!=null&&P.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(w,!0),this._currentLink.state.decorations.pointerCursor&&k.classList.add("xterm-cursor-pointer")),w.hover&&w.hover(C,w.text)}_fireUnderlineEvent(k,w){const C=k.range,P=this._bufferService.buffer.ydisp,j=this._createLinkUnderlineEvent(C.start.x-1,C.start.y-P-1,C.end.x,C.end.y-P-1,void 0);(w?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(j)}_linkLeave(k,w,C){var P;(P=this._currentLink)!=null&&P.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(w,!1),this._currentLink.state.decorations.pointerCursor&&k.classList.remove("xterm-cursor-pointer")),w.leave&&w.leave(C,w.text)}_linkAtPosition(k,w){const C=k.range.start.y*this._bufferService.cols+k.range.start.x,P=k.range.end.y*this._bufferService.cols+k.range.end.x,j=w.y*this._bufferService.cols+w.x;return C<=j&&j<=P}_positionFromMouseEvent(k,w,C){const P=C.getCoords(k,w,this._bufferService.cols,this._bufferService.rows);if(P)return{x:P[0],y:P[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(k,w,C,P,j){return{x1:k,y1:w,x2:C,y2:P,cols:this._bufferService.cols,fg:j}}};l.Linkifier=g=p([y(1,T.IMouseService),y(2,T.IRenderService),y(3,D.IBufferService),y(4,T.ILinkProviderService)],g)},9042:(v,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(v,l,u){var p=this&&this.__decorate||function(T,g,k,w){var C,P=arguments.length,j=P<3?g:w===null?w=Object.getOwnPropertyDescriptor(g,k):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(T,g,k,w);else for(var O=T.length-1;O>=0;O--)(C=T[O])&&(j=(P<3?C(j):P>3?C(g,k,j):C(g,k))||j);return P>3&&j&&Object.defineProperty(g,k,j),j},y=this&&this.__param||function(T,g){return function(k,w){g(k,w,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=u(511),x=u(2585);let $=l.OscLinkProvider=class{constructor(T,g,k){this._bufferService=T,this._optionsService=g,this._oscLinkService=k}provideLinks(T,g){var U;const k=this._bufferService.buffer.lines.get(T-1);if(!k)return void g(void 0);const w=[],C=this._optionsService.rawOptions.linkHandler,P=new m.CellData,j=k.getTrimmedLength();let O=-1,F=-1,I=!1;for(let Y=0;Y<j;Y++)if(F!==-1||k.hasContent(Y)){if(k.loadCell(Y,P),P.hasExtendedAttrs()&&P.extended.urlId){if(F===-1){F=Y,O=P.extended.urlId;continue}I=P.extended.urlId!==O}else F!==-1&&(I=!0);if(I||F!==-1&&Y===j-1){const se=(U=this._oscLinkService.getLinkData(O))==null?void 0:U.uri;if(se){const de={start:{x:F+1,y:T},end:{x:Y+(I||Y!==j-1?0:1),y:T}};let ie=!1;if(!(C!=null&&C.allowNonHttpProtocols))try{const ye=new URL(se);["http:","https:"].includes(ye.protocol)||(ie=!0)}catch{ie=!0}ie||w.push({text:se,range:de,activate:(ye,ge)=>C?C.activate(ye,ge,de):D(0,ge),hover:(ye,ge)=>{var ke;return(ke=C==null?void 0:C.hover)==null?void 0:ke.call(C,ye,ge,de)},leave:(ye,ge)=>{var ke;return(ke=C==null?void 0:C.leave)==null?void 0:ke.call(C,ye,ge,de)}})}I=!1,P.hasExtendedAttrs()&&P.extended.urlId?(F=Y,O=P.extended.urlId):(F=-1,O=-1)}}g(w)}};function D(T,g){if(confirm(`Do you want to navigate to ${g}?
|
|
2880
2880
|
|
|
@@ -2897,7 +2897,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2897
2897
|
monaco.config({ paths: { vs: '...' } })
|
|
2898
2898
|
|
|
2899
2899
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
2900
|
-
`},s_=ck(fk)(u0),pk={config:dk},mk=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return function(f){return o.reduceRight(function(S,v){return v(S)},f)}};function d0(t,i){return Object.keys(i).forEach(function(o){i[o]instanceof Object&&t[o]&&Object.assign(i[o],d0(t[o],i[o]))}),t_(t_({},t),i)}var gk={type:"cancelation",msg:"operation is manually canceled"};function ig(t){var i=!1,o=new Promise(function(a,f){t.then(function(S){return i?f(gk):a(S)}),t.catch(f)});return o.cancel=function(){return i=!0},o}var vk=["monaco"],yk=ak.create({config:lk,isInitialized:!1,resolve:null,reject:null,monaco:null}),h0=V1(yk,2),_f=h0[0],ym=h0[1];function _k(t){var i=pk.config(t),o=i.monaco,a=F1(i,vk);ym(function(f){return{config:d0(f.config,a),monaco:o}})}function wk(){var t=_f(function(i){var o=i.monaco,a=i.isInitialized,f=i.resolve;return{monaco:o,isInitialized:a,resolve:f}});if(!t.isInitialized){if(ym({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),ig(sg);if(window.monaco&&window.monaco.editor)return f0(window.monaco),t.resolve(window.monaco),ig(sg);mk(bk,Sk)(kk)}return ig(sg)}function bk(t){return document.body.appendChild(t)}function xk(t){var i=document.createElement("script");return t&&(i.src=t),i}function Sk(t){var i=_f(function(a){var f=a.config,S=a.reject;return{config:f,reject:S}}),o=xk("".concat(i.config.paths.vs,"/loader.js"));return o.onload=function(){return t()},o.onerror=i.reject,o}function kk(){var t=_f(function(o){var a=o.config,f=o.resolve,S=o.reject;return{config:a,resolve:f,reject:S}}),i=window.require;i.config(t.config),i(["vs/editor/editor.main"],function(o){var a=o.m||o;f0(a),t.resolve(a)},function(o){t.reject(o)})}function f0(t){_f().monaco||ym({monaco:t})}function Ck(){return _f(function(t){var i=t.monaco;return i})}var sg=new Promise(function(t,i){return ym({resolve:t,reject:i})}),p0={config:_k,init:wk,__getMonacoInstance:Ck},Ek={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ng=Ek,Tk={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},$k=Tk;function Ak({children:t}){return Ln.createElement("div",{style:$k.container},t)}var Rk=Ak,Pk=Rk;function Dk({width:t,height:i,isEditorReady:o,loading:a,_ref:f,className:S,wrapperProps:v}){return Ln.createElement("section",{style:{...ng.wrapper,width:t,height:i},...v},!o&&Ln.createElement(Pk,null,a),Ln.createElement("div",{ref:f,style:{...ng.fullWidth,...!o&&ng.hide},className:S}))}var Ik=Dk,m0=X.memo(Ik);function Mk(t){X.useEffect(t,[])}var g0=Mk;function Lk(t,i,o=!0){let a=X.useRef(!0);X.useEffect(a.current||!o?()=>{a.current=!1}:t,i)}var Ps=Lk;function of(){}function Uu(t,i,o,a){return jk(t,a)||Ok(t,i,o,a)}function jk(t,i){return t.editor.getModel(v0(t,i))}function Ok(t,i,o,a){return t.editor.createModel(i,o,a?v0(t,a):void 0)}function v0(t,i){return t.Uri.parse(i)}function Nk({original:t,modified:i,language:o,originalLanguage:a,modifiedLanguage:f,originalModelPath:S,modifiedModelPath:v,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:u=!1,theme:p="light",loading:y="Loading...",options:m={},height:x="100%",width:$="100%",className:D,wrapperProps:T={},beforeMount:g=of,onMount:k=of}){let[w,C]=X.useState(!1),[P,j]=X.useState(!0),O=X.useRef(null),F=X.useRef(null),I=X.useRef(null),U=X.useRef(k),Y=X.useRef(g),se=X.useRef(!1);g0(()=>{let ge=p0.init();return ge.then(ke=>(F.current=ke)&&j(!1)).catch(ke=>(ke==null?void 0:ke.type)!=="cancelation"&&console.error("Monaco initialization: error:",ke)),()=>O.current?ye():ge.cancel()}),Ps(()=>{if(O.current&&F.current){let ge=O.current.getOriginalEditor(),ke=Uu(F.current,t||"",a||o||"text",S||"");ke!==ge.getModel()&&ge.setModel(ke)}},[S],w),Ps(()=>{if(O.current&&F.current){let ge=O.current.getModifiedEditor(),ke=Uu(F.current,i||"",f||o||"text",v||"");ke!==ge.getModel()&&ge.setModel(ke)}},[v],w),Ps(()=>{let ge=O.current.getModifiedEditor();ge.getOption(F.current.editor.EditorOption.readOnly)?ge.setValue(i||""):i!==ge.getValue()&&(ge.executeEdits("",[{range:ge.getModel().getFullModelRange(),text:i||"",forceMoveMarkers:!0}]),ge.pushUndoStop())},[i],w),Ps(()=>{var ge,ke;(ke=(ge=O.current)==null?void 0:ge.getModel())==null||ke.original.setValue(t||"")},[t],w),Ps(()=>{let{original:ge,modified:ke}=O.current.getModel();F.current.editor.setModelLanguage(ge,a||o||"text"),F.current.editor.setModelLanguage(ke,f||o||"text")},[o,a,f],w),Ps(()=>{var ge;(ge=F.current)==null||ge.editor.setTheme(p)},[p],w),Ps(()=>{var ge;(ge=O.current)==null||ge.updateOptions(m)},[m],w);let de=X.useCallback(()=>{var be;if(!F.current)return;Y.current(F.current);let ge=Uu(F.current,t||"",a||o||"text",S||""),ke=Uu(F.current,i||"",f||o||"text",v||"");(be=O.current)==null||be.setModel({original:ge,modified:ke})},[o,i,f,t,a,S,v]),ie=X.useCallback(()=>{var ge;!se.current&&I.current&&(O.current=F.current.editor.createDiffEditor(I.current,{automaticLayout:!0,...m}),de(),(ge=F.current)==null||ge.editor.setTheme(p),C(!0),se.current=!0)},[m,p,de]);X.useEffect(()=>{w&&U.current(O.current,F.current)},[w]),X.useEffect(()=>{!P&&!w&&ie()},[P,w,ie]);function ye(){var ke,be,ue,W;let ge=(ke=O.current)==null?void 0:ke.getModel();l||((be=ge==null?void 0:ge.original)==null||be.dispose()),u||((ue=ge==null?void 0:ge.modified)==null||ue.dispose()),(W=O.current)==null||W.dispose()}return Ln.createElement(m0,{width:$,height:x,isEditorReady:w,loading:y,_ref:I,className:D,wrapperProps:T})}var Bk=Nk;X.memo(Bk);function zk(t){let i=X.useRef();return X.useEffect(()=>{i.current=t},[t]),i.current}var Fk=zk,Op=new Map;function Uk({defaultValue:t,defaultLanguage:i,defaultPath:o,value:a,language:f,path:S,theme:v="light",line:l,loading:u="Loading...",options:p={},overrideServices:y={},saveViewState:m=!0,keepCurrentModel:x=!1,width:$="100%",height:D="100%",className:T,wrapperProps:g={},beforeMount:k=of,onMount:w=of,onChange:C,onValidate:P=of}){let[j,O]=X.useState(!1),[F,I]=X.useState(!0),U=X.useRef(null),Y=X.useRef(null),se=X.useRef(null),de=X.useRef(w),ie=X.useRef(k),ye=X.useRef(),ge=X.useRef(a),ke=Fk(S),be=X.useRef(!1),ue=X.useRef(!1);g0(()=>{let G=p0.init();return G.then(ne=>(U.current=ne)&&I(!1)).catch(ne=>(ne==null?void 0:ne.type)!=="cancelation"&&console.error("Monaco initialization: error:",ne)),()=>Y.current?re():G.cancel()}),Ps(()=>{var ne,Pe,Ve,Ge;let G=Uu(U.current,t||a||"",i||f||"",S||o||"");G!==((ne=Y.current)==null?void 0:ne.getModel())&&(m&&Op.set(ke,(Pe=Y.current)==null?void 0:Pe.saveViewState()),(Ve=Y.current)==null||Ve.setModel(G),m&&((Ge=Y.current)==null||Ge.restoreViewState(Op.get(S))))},[S],j),Ps(()=>{var G;(G=Y.current)==null||G.updateOptions(p)},[p],j),Ps(()=>{!Y.current||a===void 0||(Y.current.getOption(U.current.editor.EditorOption.readOnly)?Y.current.setValue(a):a!==Y.current.getValue()&&(ue.current=!0,Y.current.executeEdits("",[{range:Y.current.getModel().getFullModelRange(),text:a,forceMoveMarkers:!0}]),Y.current.pushUndoStop(),ue.current=!1))},[a],j),Ps(()=>{var ne,Pe;let G=(ne=Y.current)==null?void 0:ne.getModel();G&&f&&((Pe=U.current)==null||Pe.editor.setModelLanguage(G,f))},[f],j),Ps(()=>{var G;l!==void 0&&((G=Y.current)==null||G.revealLine(l))},[l],j),Ps(()=>{var G;(G=U.current)==null||G.editor.setTheme(v)},[v],j);let W=X.useCallback(()=>{var G;if(!(!se.current||!U.current)&&!be.current){ie.current(U.current);let ne=S||o,Pe=Uu(U.current,a||t||"",i||f||"",ne||"");Y.current=(G=U.current)==null?void 0:G.editor.create(se.current,{model:Pe,automaticLayout:!0,...p},y),m&&Y.current.restoreViewState(Op.get(ne)),U.current.editor.setTheme(v),l!==void 0&&Y.current.revealLine(l),O(!0),be.current=!0}},[t,i,o,a,f,S,p,y,m,v,l]);X.useEffect(()=>{j&&de.current(Y.current,U.current)},[j]),X.useEffect(()=>{!F&&!j&&W()},[F,j,W]),ge.current=a,X.useEffect(()=>{var G,ne;j&&C&&((G=ye.current)==null||G.dispose(),ye.current=(ne=Y.current)==null?void 0:ne.onDidChangeModelContent(Pe=>{ue.current||C(Y.current.getValue(),Pe)}))},[j,C]),X.useEffect(()=>{if(j){let G=U.current.editor.onDidChangeMarkers(ne=>{var Ve;let Pe=(Ve=Y.current.getModel())==null?void 0:Ve.uri;if(Pe&&ne.find(Ge=>Ge.path===Pe.path)){let Ge=U.current.editor.getModelMarkers({resource:Pe});P==null||P(Ge)}});return()=>{G==null||G.dispose()}}return()=>{}},[j,P]);function re(){var G,ne;(G=ye.current)==null||G.dispose(),x?m&&Op.set(S,Y.current.saveViewState()):(ne=Y.current.getModel())==null||ne.dispose(),Y.current.dispose()}return Ln.createElement(m0,{width:$,height:D,isEditorReady:j,loading:u,_ref:se,className:T,wrapperProps:g})}var Vk=Uk,Wk=X.memo(Vk),y0=Wk;function _0({value:t,onChange:i,path:o,readOnly:a}){const f=X.useRef(null),S=v=>{f.current=v};return h.jsx(y0,{path:`file://${o}`,defaultLanguage:"json",value:t,onChange:v=>i(v??""),onMount:S,theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:12,fontFamily:"JetBrains Mono, ui-monospace, Menlo, monospace",lineNumbers:"on",renderLineHighlight:"line",scrollBeyondLastLine:!1,tabSize:2,formatOnPaste:!0,readOnly:a,automaticLayout:!0,bracketPairColorization:{enabled:!0},wordWrap:"on"}})}let n_=!1;async function Hk(t){if(n_)return;const i=await qw(()=>import("./editor.main-zj3Myqhk.js").then(f=>f.b),__vite__mapDeps([0,1]),import.meta.url),o=await Promise.all(t.map(async f=>{let S=f.schema;if(!S){const v=["https://json.schemastore.org","https://www.schemastore.org","https://code.claude.com"];try{const l=new URL(f.uri).origin;if(!v.includes(l))throw new Error("untrusted origin");const u=await fetch(f.uri);u.ok&&(S=await u.json())}catch{}}return{uri:f.uri,fileMatch:f.fileMatch,schema:S}}));i.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!1,schemas:o.filter(f=>f.schema),enableSchemaRequest:!0}),n_=!0}function dv({node:t,targetScope:i,onOverride:o,schema:a,rootLabel:f}){const[S,v]=X.useState(""),[l,u]=X.useState(!0),p=[],y=t.kind==="object"&&Object.keys(t.children).length===0,x=((a==null?void 0:a.rootKeys())??[]).length>0;return h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[h.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",h.jsx("span",{className:"text-fg-dim",children:Yi[i].label})]}),x&&h.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:l,onChange:$=>u($.target.checked),className:"accent-accent"}),"show unset keys"]}),h.jsx("div",{className:"flex-1"}),h.jsx("input",{value:S,onChange:$=>v($.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),h.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:y&&!l?h.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):h.jsx(w0,{node:t,path:p,label:f??"(root)",targetScope:i,onOverride:o,filter:S,depth:0,schema:a,showGhosts:l,defaultOpen:!0})})]})}function w0(t){return t.node.kind==="object"?h.jsx(qk,{...t,node:t.node}):t.node.kind==="array"?h.jsx(Gk,{...t,node:t.node}):h.jsx(Kk,{...t,node:t.node})}function o_(t,i){return i.trim()?t.toLowerCase().includes(i.toLowerCase()):!0}function Yu(t,i,o){return!!(!o.trim()||t.some(a=>o_(a,o))||i!=null&&i.description&&o_(i.description,o))}function qk({node:t,path:i,label:o,targetScope:a,onOverride:f,filter:S,depth:v,schema:l,showGhosts:u,defaultOpen:p}){const[y,m]=X.useState(p??v<2),x=(l==null?void 0:l.at(i))??null,$=new Set(Object.keys(t.children)),D=u?(x==null?void 0:x.knownChildren)??[]:[],T=Array.from(new Set([...$,...D])).sort(),g=X.useMemo(()=>S.trim()?T.filter(w=>{const C=(l==null?void 0:l.at([...i,w]))??null;return Yu([...i,w],C,S)?!0:$.has(w)?b0(t.children[w],[...i,w],S,l):!1}):T,[T.join(","),S,t,i.join("."),l]);if(S.trim()&&g.length===0&&!Yu(i,x,S))return null;if(i.length===0)return h.jsx("div",{children:g.map(w=>k(w))});return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:v*14},onClick:()=>m(!y),children:[h.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:y?"▾":"▸"}),h.jsx("span",{className:"text-fg",children:o}),h.jsxs("span",{className:"text-fg-faint",children:[" {",$.size,D.length>$.size?`/${new Set([...$,...D]).size}`:"","}"]}),(x==null?void 0:x.description)&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:x.description,children:["— ",x.description]})]}),y&&g.map(w=>k(w))]});function k(w){if($.has(w))return h.jsx(w0,{node:t.children[w],path:[...i,w],label:w,targetScope:a,onOverride:f,filter:S,depth:v+1,schema:l,showGhosts:u},w);const C=(l==null?void 0:l.at([...i,w]))??null;return C?h.jsx(Xk,{path:[...i,w],label:w,info:C,targetScope:a,onSet:f,depth:v+1,filter:S},w):null}}function b0(t,i,o,a){const f=(a==null?void 0:a.at(i))??null;if(Yu(i,f,o))return!0;if(t.kind!=="object")return!1;for(const S of Object.keys(t.children))if(b0(t.children[S],[...i,S],o,a))return!0;return!1}function Gk({node:t,path:i,label:o,filter:a,depth:f,schema:S}){const[v,l]=X.useState(!0),u=(S==null?void 0:S.at(i))??null;return Yu(i,u,a)?h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:f*14},onClick:()=>l(!v),children:[h.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:v?"▾":"▸"}),h.jsx("span",{className:"text-fg",children:o}),h.jsxs("span",{className:"text-fg-faint",children:[" [",t.items.length,"]"]}),h.jsx(hf,{tone:"warn",children:"accumulated"}),(u==null?void 0:u.description)&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:u.description,children:["— ",u.description]})]}),v&&t.items.map((p,y)=>h.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(f+1)*14},children:[h.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),h.jsxs("span",{className:"text-fg-faint",children:[y,":"]}),h.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:om(p.value)}),h.jsx(Mg,{scope:p.fromScope})]},y))]}):null}function Kk({node:t,path:i,label:o,targetScope:a,onOverride:f,filter:S,depth:v,schema:l}){const[u,p]=X.useState(!1),y=(l==null?void 0:l.at(i))??null;if(!Yu(i,y,S))return null;const m=t.winner!==a,x=t.shadowed.length>0;return h.jsxs("div",{children:[h.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:v*14},children:[h.jsx("span",{className:`w-3 shrink-0 ${x?"text-fg-faint cursor-pointer":""}`,onClick:()=>x&&p(!u),children:x?u?"▾":"▸":""}),h.jsxs("span",{className:"text-fg",children:[o,":"]}),h.jsx("span",{className:"text-fg-dim truncate max-w-md",children:om(t.value)}),h.jsx(Mg,{scope:t.winner}),(y==null?void 0:y.deprecated)&&h.jsx(hf,{tone:"warn",children:"deprecated"}),(y==null?void 0:y.default)!==void 0&&Jk(t.value,y.default)&&h.jsx(hf,{tone:"dim",children:"= default"}),t.typeMismatch&&h.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(y==null?void 0:y.description)&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:y.description,children:["— ",y.description]}),h.jsx("div",{className:"flex-1"}),(y==null?void 0:y.enum)&&h.jsx(x0,{values:y.enum}),h.jsx("button",{disabled:!m,onClick:()=>f(i,t.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${m?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:m?`copy into ${Yi[a].label} draft`:`already winning in ${Yi[a].label}`,children:"override"})]}),u&&t.shadowed.map(($,D)=>h.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(v+1)*14+12},children:[h.jsx("span",{children:"shadowed:"}),h.jsx("span",{className:"truncate max-w-xl",children:om($.value)}),h.jsx(Mg,{scope:$.scope,dim:!0})]},D))]})}function Xk({path:t,label:i,info:o,targetScope:a,onSet:f,depth:S,filter:v}){if(!Yu(t,o,v))return null;const l=o.default!==void 0?o.default:Yk(o.type),u=Array.isArray(o.type)?o.type.join("|"):o.type??"?";return h.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:S*14},children:[h.jsx("span",{className:"w-3 shrink-0"}),h.jsx("span",{className:"text-fg-dim",children:i}),h.jsx(hf,{tone:"dim",children:u}),o.required&&h.jsx(hf,{tone:"warn",children:"required"}),o.default!==void 0&&h.jsxs("span",{className:"text-fg-faint",children:["default: ",om(o.default)]}),o.description&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:o.description,children:["— ",o.description]}),h.jsx("div",{className:"flex-1"}),o.enum&&h.jsx(x0,{values:o.enum}),h.jsx("button",{onClick:()=>f(t,l),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${Yi[a].label} draft`,children:"set"})]})}function Jk(t,i){return t===i?!0:typeof t!=typeof i?!1:t&&i&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(i):!1}function Yk(t){switch(Array.isArray(t)?t[0]:t){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function om(t){if(typeof t=="string")return JSON.stringify(t);if(t===null)return"null";if(typeof t=="object"){const i=JSON.stringify(t);return i.length>100?i.slice(0,100)+"…":i}return String(t)}function Mg({scope:t,dim:i}){const o=t==="user"?"bg-bg-hi text-fg-dim border-line":t==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return h.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${o} ${i?"opacity-60":""}`,children:Yi[t].label})}function hf({children:t,tone:i="default"}){const o={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[i];return h.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${o}`,children:t})}function x0({values:t}){const i=t.map(o=>String(o)).join(" | ");return h.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${i}`,children:["∈ ",i.length>30?i.slice(0,30)+"…":i]})}const Qk=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Which model runs, how hard it thinks, and fast-mode toggles.",keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],Zk={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function S0(t){return t.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((a,f)=>{const S=Zk[a];return S||(f===0?a.charAt(0).toUpperCase()+a.slice(1):a)}).join(" ")}function eC(t){const i=new Set,o=[];for(const f of Qk){const S=f.keys.filter(v=>t.has(v));S.forEach(v=>i.add(v)),S.length!==0&&o.push({id:f.id,title:f.title,summary:f.summary,advanced:!!f.advanced,keys:S})}const a=Array.from(t).filter(f=>!i.has(f)&&f!=="$schema").sort();return a.length>0&&o.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:a}),o}function tC({node:t,targetScope:i,onOverride:o,schema:a}){const[f,S]=X.useState(""),[v,l]=X.useState(!1),[u,p]=X.useState(!0),y=t.kind==="object"?t:null,m=y?Object.keys(y.children):[],x=a.rootKeys(),$=new Set([...m,...x]),D=X.useMemo(()=>eC($),[Array.from($).sort().join(",")]),T=X.useMemo(()=>D.filter(g=>v||!g.advanced).map(g=>({...g,keys:g.keys.filter(k=>{const w=(y==null?void 0:y.children[k])!==void 0;if(!u&&!w)return!1;if(!f.trim())return!0;const C=a.at([k]);return[k,S0(k),(C==null?void 0:C.description)??""].join(" ").toLowerCase().includes(f.toLowerCase())})})).filter(g=>g.keys.length>0),[D,f,v,u,y,a]);return h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[h.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",h.jsx("span",{className:"text-fg-dim font-medium",children:Yi[i].label})]}),h.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:u,onChange:g=>p(g.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),h.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:v,onChange:g=>l(g.target.checked),className:"accent-accent"}),"show advanced"]}),h.jsx("div",{className:"flex-1"}),h.jsx("input",{value:f,onChange:g=>S(g.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[T.map(g=>h.jsx(rC,{title:g.title,summary:g.summary,advanced:g.advanced,children:g.keys.map(k=>{const w=y==null?void 0:y.children[k],C=a.at([k]);return h.jsx(iC,{keyName:k,node:w,info:C,targetScope:i,onOverride:P=>o([k],P)},k)})},g.id)),T.length===0&&h.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',f,'"']})]})]})}function rC({title:t,summary:i,advanced:o,children:a}){const[f,S]=X.useState(!0);return h.jsxs("section",{className:"border-b border-line",children:[h.jsxs("header",{className:"px-4 py-2.5 bg-bg-elev/40 cursor-pointer hover:bg-bg-elev flex items-center gap-3",onClick:()=>S(!f),children:[h.jsx("span",{className:"text-fg-faint w-3",children:f?"▾":"▸"}),h.jsxs("div",{className:"flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-fg text-sm font-medium",children:t}),o&&h.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),h.jsx("p",{className:"text-fg-faint text-xs",children:i})]})]}),f&&h.jsx("div",{className:"divide-y divide-line/60",children:a})]})}function iC({keyName:t,node:i,info:o,targetScope:a,onOverride:f}){const[S,v]=X.useState(!1),l=S0(t),u=i!==void 0,y=(i==null?void 0:i.kind)==="leaf"?i:null,m=(i==null?void 0:i.kind)==="object"||(i==null?void 0:i.kind)==="array",x=o==null?void 0:o.default,$=y&&x!==void 0&&C0(y.value,x),D=cC({isSet:u,leafNode:y,defaultVal:x,isDefault:!!$,node:i});return h.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("button",{onClick:()=>v(!S),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:S?"collapse":"expand",children:S?"▾":"▸"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[h.jsx("h3",{className:"text-fg text-sm",children:l}),h.jsx(uC,{kind:D.kind,label:D.label}),(o==null?void 0:o.deprecated)&&h.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(o==null?void 0:o.required)&&!u&&h.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),(o==null?void 0:o.description)&&h.jsx("p",{className:"text-fg-dim text-xs mt-0.5 leading-relaxed",children:dC(o.description)}),S&&h.jsx(sC,{keyName:t,node:i,info:o,targetScope:a,onOverride:f})]}),h.jsx("div",{className:"shrink-0",children:!S&&h.jsx(lC,{node:i,info:o,onSet:T=>{f(T)},disabled:m&&u})})]})})}function sC({keyName:t,node:i,info:o,targetScope:a,onOverride:f}){const v=(i==null?void 0:i.kind)==="leaf"?i:null;return h.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[(o==null?void 0:o.description)&&h.jsx("p",{className:"text-fg-dim leading-relaxed whitespace-pre-wrap",children:o.description}),h.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(o==null?void 0:o.type)&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Type"}),h.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(o.type)?o.type.join(" | "):o.type})]}),(o==null?void 0:o.default)!==void 0&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Default"}),h.jsx("dd",{className:"text-fg-dim font-mono",children:Kp(o.default)})]}),(o==null?void 0:o.enum)&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Options"}),h.jsx("dd",{className:"text-fg-dim font-mono",children:o.enum.map(l=>String(l)).join(" | ")})]}),v&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Current"}),h.jsxs("dd",{className:"font-mono",children:[h.jsx("span",{className:"text-fg-dim",children:Kp(v.value)}),h.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",Yi[v.winner].label]})]})]}),v&&v.shadowed.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Shadowed"}),h.jsx("dd",{className:"space-y-0.5",children:v.shadowed.map((l,u)=>h.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[Kp(l.value)," —"," ",h.jsx("span",{className:"no-underline",children:Yi[l.scope].label})]},u))})]}),(i==null?void 0:i.kind)==="array"&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Accumulated"}),h.jsxs("dd",{className:"text-fg-dim",children:[i.items.length," items across all scopes"]})]})]}),h.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:h.jsx(nC,{keyName:t,node:i,info:o,onChange:f,targetScope:a})})]})}function nC({node:t,info:i,onChange:o,targetScope:a}){const S=(t==null?void 0:t.kind)==="leaf"?t.value:i==null?void 0:i.default,v=k0(i==null?void 0:i.type);if(v==="boolean"){const l=S===!0;return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-fg-faint",children:"Set to:"}),h.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:u,label:p})=>h.jsx("button",{onClick:()=>o(u),className:`px-3 py-0.5 text-xs transition-colors ${l===u?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:p},p))}),h.jsxs("span",{className:"text-fg-faint",children:["→ ",Yi[a].label]})]})}return i!=null&&i.enum?h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("span",{className:"text-fg-faint",children:"Choose:"}),i.enum.map(l=>{const u=C0(S,l);return h.jsx("button",{onClick:()=>o(l),className:`px-2 py-0.5 text-xs rounded border ${u?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(l)},String(l))}),h.jsxs("span",{className:"text-fg-faint",children:["→ ",Yi[a].label]})]}):v==="integer"||v==="number"?h.jsx(oC,{value:typeof S=="number"?S:void 0,integer:v==="integer",onCommit:o,target:Yi[a].label}):v==="string"?h.jsx(aC,{value:typeof S=="string"?S:"",onCommit:o,target:Yi[a].label}):h.jsxs("div",{className:"text-fg-faint",children:["Complex value (",v??"object/array",") — use the"," ",h.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function oC({value:t,integer:i,onCommit:o,target:a}){const[f,S]=X.useState(t!==void 0?String(t):""),v=()=>{const l=i?parseInt(f,10):parseFloat(f);Number.isNaN(l)||o(l)};return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-fg-faint",children:"Set to:"}),h.jsx("input",{type:"number",value:f,onChange:l=>S(l.target.value),onBlur:v,onKeyDown:l=>{l.key==="Enter"&&l.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),h.jsxs("button",{onClick:v,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",a]})]})}function aC({value:t,onCommit:i,target:o}){const[a,f]=X.useState(t);return h.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[h.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),h.jsx("input",{type:"text",value:a,onChange:S=>f(S.target.value),onKeyDown:S=>{S.key==="Enter"&&i(a)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),h.jsxs("button",{onClick:()=>i(a),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",o]})]})}function lC({node:t,info:i,onSet:o,disabled:a}){const f=(t==null?void 0:t.kind)==="leaf",S=k0(i==null?void 0:i.type);if(a)return null;if(S==="boolean"){const v=f&&t.value===!0;return h.jsx("button",{onClick:()=>o(!v),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${v?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:v?"on":"off"})}return null}function cC({isSet:t,leafNode:i,defaultVal:o,isDefault:a,node:f}){return t?(f==null?void 0:f.kind)==="array"?{kind:"accumulated",label:`${f.items.length} items`}:(f==null?void 0:f.kind)==="object"?{kind:"set",label:"configured"}:i?a?{kind:"default",label:`= default · ${Yi[i.winner].label}`}:i.shadowed.length>0?{kind:"override",label:`overriding ${i.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${Yi[i.winner].label}`}:{kind:"set",label:"configured"}:o!==void 0?{kind:"default",label:`using default: ${Kp(o)}`}:{kind:"unset",label:"not configured"}}function uC({kind:t,label:i}){const o={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[t];return h.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${o}`,children:i})}function k0(t){if(t)return Array.isArray(t)?t.find(o=>o!=="null")??t[0]:t}function C0(t,i){return t===i?!0:typeof t!=typeof i?!1:t&&i&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(i):!1}function dC(t){const i=t.trim().split(`
|
|
2900
|
+
`},s_=ck(fk)(u0),pk={config:dk},mk=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return function(f){return o.reduceRight(function(S,v){return v(S)},f)}};function d0(t,i){return Object.keys(i).forEach(function(o){i[o]instanceof Object&&t[o]&&Object.assign(i[o],d0(t[o],i[o]))}),t_(t_({},t),i)}var gk={type:"cancelation",msg:"operation is manually canceled"};function ig(t){var i=!1,o=new Promise(function(a,f){t.then(function(S){return i?f(gk):a(S)}),t.catch(f)});return o.cancel=function(){return i=!0},o}var vk=["monaco"],yk=ak.create({config:lk,isInitialized:!1,resolve:null,reject:null,monaco:null}),h0=V1(yk,2),_f=h0[0],ym=h0[1];function _k(t){var i=pk.config(t),o=i.monaco,a=F1(i,vk);ym(function(f){return{config:d0(f.config,a),monaco:o}})}function wk(){var t=_f(function(i){var o=i.monaco,a=i.isInitialized,f=i.resolve;return{monaco:o,isInitialized:a,resolve:f}});if(!t.isInitialized){if(ym({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),ig(sg);if(window.monaco&&window.monaco.editor)return f0(window.monaco),t.resolve(window.monaco),ig(sg);mk(bk,Sk)(kk)}return ig(sg)}function bk(t){return document.body.appendChild(t)}function xk(t){var i=document.createElement("script");return t&&(i.src=t),i}function Sk(t){var i=_f(function(a){var f=a.config,S=a.reject;return{config:f,reject:S}}),o=xk("".concat(i.config.paths.vs,"/loader.js"));return o.onload=function(){return t()},o.onerror=i.reject,o}function kk(){var t=_f(function(o){var a=o.config,f=o.resolve,S=o.reject;return{config:a,resolve:f,reject:S}}),i=window.require;i.config(t.config),i(["vs/editor/editor.main"],function(o){var a=o.m||o;f0(a),t.resolve(a)},function(o){t.reject(o)})}function f0(t){_f().monaco||ym({monaco:t})}function Ck(){return _f(function(t){var i=t.monaco;return i})}var sg=new Promise(function(t,i){return ym({resolve:t,reject:i})}),p0={config:_k,init:wk,__getMonacoInstance:Ck},Ek={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ng=Ek,Tk={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},$k=Tk;function Ak({children:t}){return Ln.createElement("div",{style:$k.container},t)}var Rk=Ak,Pk=Rk;function Dk({width:t,height:i,isEditorReady:o,loading:a,_ref:f,className:S,wrapperProps:v}){return Ln.createElement("section",{style:{...ng.wrapper,width:t,height:i},...v},!o&&Ln.createElement(Pk,null,a),Ln.createElement("div",{ref:f,style:{...ng.fullWidth,...!o&&ng.hide},className:S}))}var Ik=Dk,m0=X.memo(Ik);function Mk(t){X.useEffect(t,[])}var g0=Mk;function Lk(t,i,o=!0){let a=X.useRef(!0);X.useEffect(a.current||!o?()=>{a.current=!1}:t,i)}var Ps=Lk;function of(){}function Uu(t,i,o,a){return jk(t,a)||Ok(t,i,o,a)}function jk(t,i){return t.editor.getModel(v0(t,i))}function Ok(t,i,o,a){return t.editor.createModel(i,o,a?v0(t,a):void 0)}function v0(t,i){return t.Uri.parse(i)}function Nk({original:t,modified:i,language:o,originalLanguage:a,modifiedLanguage:f,originalModelPath:S,modifiedModelPath:v,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:u=!1,theme:p="light",loading:y="Loading...",options:m={},height:x="100%",width:$="100%",className:D,wrapperProps:T={},beforeMount:g=of,onMount:k=of}){let[w,C]=X.useState(!1),[P,j]=X.useState(!0),O=X.useRef(null),F=X.useRef(null),I=X.useRef(null),U=X.useRef(k),Y=X.useRef(g),se=X.useRef(!1);g0(()=>{let ge=p0.init();return ge.then(ke=>(F.current=ke)&&j(!1)).catch(ke=>(ke==null?void 0:ke.type)!=="cancelation"&&console.error("Monaco initialization: error:",ke)),()=>O.current?ye():ge.cancel()}),Ps(()=>{if(O.current&&F.current){let ge=O.current.getOriginalEditor(),ke=Uu(F.current,t||"",a||o||"text",S||"");ke!==ge.getModel()&&ge.setModel(ke)}},[S],w),Ps(()=>{if(O.current&&F.current){let ge=O.current.getModifiedEditor(),ke=Uu(F.current,i||"",f||o||"text",v||"");ke!==ge.getModel()&&ge.setModel(ke)}},[v],w),Ps(()=>{let ge=O.current.getModifiedEditor();ge.getOption(F.current.editor.EditorOption.readOnly)?ge.setValue(i||""):i!==ge.getValue()&&(ge.executeEdits("",[{range:ge.getModel().getFullModelRange(),text:i||"",forceMoveMarkers:!0}]),ge.pushUndoStop())},[i],w),Ps(()=>{var ge,ke;(ke=(ge=O.current)==null?void 0:ge.getModel())==null||ke.original.setValue(t||"")},[t],w),Ps(()=>{let{original:ge,modified:ke}=O.current.getModel();F.current.editor.setModelLanguage(ge,a||o||"text"),F.current.editor.setModelLanguage(ke,f||o||"text")},[o,a,f],w),Ps(()=>{var ge;(ge=F.current)==null||ge.editor.setTheme(p)},[p],w),Ps(()=>{var ge;(ge=O.current)==null||ge.updateOptions(m)},[m],w);let de=X.useCallback(()=>{var be;if(!F.current)return;Y.current(F.current);let ge=Uu(F.current,t||"",a||o||"text",S||""),ke=Uu(F.current,i||"",f||o||"text",v||"");(be=O.current)==null||be.setModel({original:ge,modified:ke})},[o,i,f,t,a,S,v]),ie=X.useCallback(()=>{var ge;!se.current&&I.current&&(O.current=F.current.editor.createDiffEditor(I.current,{automaticLayout:!0,...m}),de(),(ge=F.current)==null||ge.editor.setTheme(p),C(!0),se.current=!0)},[m,p,de]);X.useEffect(()=>{w&&U.current(O.current,F.current)},[w]),X.useEffect(()=>{!P&&!w&&ie()},[P,w,ie]);function ye(){var ke,be,ue,W;let ge=(ke=O.current)==null?void 0:ke.getModel();l||((be=ge==null?void 0:ge.original)==null||be.dispose()),u||((ue=ge==null?void 0:ge.modified)==null||ue.dispose()),(W=O.current)==null||W.dispose()}return Ln.createElement(m0,{width:$,height:x,isEditorReady:w,loading:y,_ref:I,className:D,wrapperProps:T})}var Bk=Nk;X.memo(Bk);function zk(t){let i=X.useRef();return X.useEffect(()=>{i.current=t},[t]),i.current}var Fk=zk,Op=new Map;function Uk({defaultValue:t,defaultLanguage:i,defaultPath:o,value:a,language:f,path:S,theme:v="light",line:l,loading:u="Loading...",options:p={},overrideServices:y={},saveViewState:m=!0,keepCurrentModel:x=!1,width:$="100%",height:D="100%",className:T,wrapperProps:g={},beforeMount:k=of,onMount:w=of,onChange:C,onValidate:P=of}){let[j,O]=X.useState(!1),[F,I]=X.useState(!0),U=X.useRef(null),Y=X.useRef(null),se=X.useRef(null),de=X.useRef(w),ie=X.useRef(k),ye=X.useRef(),ge=X.useRef(a),ke=Fk(S),be=X.useRef(!1),ue=X.useRef(!1);g0(()=>{let G=p0.init();return G.then(ne=>(U.current=ne)&&I(!1)).catch(ne=>(ne==null?void 0:ne.type)!=="cancelation"&&console.error("Monaco initialization: error:",ne)),()=>Y.current?re():G.cancel()}),Ps(()=>{var ne,Pe,Ve,Ge;let G=Uu(U.current,t||a||"",i||f||"",S||o||"");G!==((ne=Y.current)==null?void 0:ne.getModel())&&(m&&Op.set(ke,(Pe=Y.current)==null?void 0:Pe.saveViewState()),(Ve=Y.current)==null||Ve.setModel(G),m&&((Ge=Y.current)==null||Ge.restoreViewState(Op.get(S))))},[S],j),Ps(()=>{var G;(G=Y.current)==null||G.updateOptions(p)},[p],j),Ps(()=>{!Y.current||a===void 0||(Y.current.getOption(U.current.editor.EditorOption.readOnly)?Y.current.setValue(a):a!==Y.current.getValue()&&(ue.current=!0,Y.current.executeEdits("",[{range:Y.current.getModel().getFullModelRange(),text:a,forceMoveMarkers:!0}]),Y.current.pushUndoStop(),ue.current=!1))},[a],j),Ps(()=>{var ne,Pe;let G=(ne=Y.current)==null?void 0:ne.getModel();G&&f&&((Pe=U.current)==null||Pe.editor.setModelLanguage(G,f))},[f],j),Ps(()=>{var G;l!==void 0&&((G=Y.current)==null||G.revealLine(l))},[l],j),Ps(()=>{var G;(G=U.current)==null||G.editor.setTheme(v)},[v],j);let W=X.useCallback(()=>{var G;if(!(!se.current||!U.current)&&!be.current){ie.current(U.current);let ne=S||o,Pe=Uu(U.current,a||t||"",i||f||"",ne||"");Y.current=(G=U.current)==null?void 0:G.editor.create(se.current,{model:Pe,automaticLayout:!0,...p},y),m&&Y.current.restoreViewState(Op.get(ne)),U.current.editor.setTheme(v),l!==void 0&&Y.current.revealLine(l),O(!0),be.current=!0}},[t,i,o,a,f,S,p,y,m,v,l]);X.useEffect(()=>{j&&de.current(Y.current,U.current)},[j]),X.useEffect(()=>{!F&&!j&&W()},[F,j,W]),ge.current=a,X.useEffect(()=>{var G,ne;j&&C&&((G=ye.current)==null||G.dispose(),ye.current=(ne=Y.current)==null?void 0:ne.onDidChangeModelContent(Pe=>{ue.current||C(Y.current.getValue(),Pe)}))},[j,C]),X.useEffect(()=>{if(j){let G=U.current.editor.onDidChangeMarkers(ne=>{var Ve;let Pe=(Ve=Y.current.getModel())==null?void 0:Ve.uri;if(Pe&&ne.find(Ge=>Ge.path===Pe.path)){let Ge=U.current.editor.getModelMarkers({resource:Pe});P==null||P(Ge)}});return()=>{G==null||G.dispose()}}return()=>{}},[j,P]);function re(){var G,ne;(G=ye.current)==null||G.dispose(),x?m&&Op.set(S,Y.current.saveViewState()):(ne=Y.current.getModel())==null||ne.dispose(),Y.current.dispose()}return Ln.createElement(m0,{width:$,height:D,isEditorReady:j,loading:u,_ref:se,className:T,wrapperProps:g})}var Vk=Uk,Wk=X.memo(Vk),y0=Wk;function _0({value:t,onChange:i,path:o,readOnly:a}){const f=X.useRef(null),S=v=>{f.current=v};return h.jsx(y0,{path:`file://${o}`,defaultLanguage:"json",value:t,onChange:v=>i(v??""),onMount:S,theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:12,fontFamily:"JetBrains Mono, ui-monospace, Menlo, monospace",lineNumbers:"on",renderLineHighlight:"line",scrollBeyondLastLine:!1,tabSize:2,formatOnPaste:!0,readOnly:a,automaticLayout:!0,bracketPairColorization:{enabled:!0},wordWrap:"on"}})}let n_=!1;async function Hk(t){if(n_)return;const i=await qw(()=>import("./editor.main-Dx55Am4z.js").then(f=>f.b),__vite__mapDeps([0,1]),import.meta.url),o=await Promise.all(t.map(async f=>{let S=f.schema;if(!S){const v=["https://json.schemastore.org","https://www.schemastore.org","https://code.claude.com"];try{const l=new URL(f.uri).origin;if(!v.includes(l))throw new Error("untrusted origin");const u=await fetch(f.uri);u.ok&&(S=await u.json())}catch{}}return{uri:f.uri,fileMatch:f.fileMatch,schema:S}}));i.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!1,schemas:o.filter(f=>f.schema),enableSchemaRequest:!0}),n_=!0}function dv({node:t,targetScope:i,onOverride:o,schema:a,rootLabel:f}){const[S,v]=X.useState(""),[l,u]=X.useState(!0),p=[],y=t.kind==="object"&&Object.keys(t.children).length===0,x=((a==null?void 0:a.rootKeys())??[]).length>0;return h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[h.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",h.jsx("span",{className:"text-fg-dim",children:Yi[i].label})]}),x&&h.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:l,onChange:$=>u($.target.checked),className:"accent-accent"}),"show unset keys"]}),h.jsx("div",{className:"flex-1"}),h.jsx("input",{value:S,onChange:$=>v($.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),h.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:y&&!l?h.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):h.jsx(w0,{node:t,path:p,label:f??"(root)",targetScope:i,onOverride:o,filter:S,depth:0,schema:a,showGhosts:l,defaultOpen:!0})})]})}function w0(t){return t.node.kind==="object"?h.jsx(qk,{...t,node:t.node}):t.node.kind==="array"?h.jsx(Gk,{...t,node:t.node}):h.jsx(Kk,{...t,node:t.node})}function o_(t,i){return i.trim()?t.toLowerCase().includes(i.toLowerCase()):!0}function Yu(t,i,o){return!!(!o.trim()||t.some(a=>o_(a,o))||i!=null&&i.description&&o_(i.description,o))}function qk({node:t,path:i,label:o,targetScope:a,onOverride:f,filter:S,depth:v,schema:l,showGhosts:u,defaultOpen:p}){const[y,m]=X.useState(p??v<2),x=(l==null?void 0:l.at(i))??null,$=new Set(Object.keys(t.children)),D=u?(x==null?void 0:x.knownChildren)??[]:[],T=Array.from(new Set([...$,...D])).sort(),g=X.useMemo(()=>S.trim()?T.filter(w=>{const C=(l==null?void 0:l.at([...i,w]))??null;return Yu([...i,w],C,S)?!0:$.has(w)?b0(t.children[w],[...i,w],S,l):!1}):T,[T.join(","),S,t,i.join("."),l]);if(S.trim()&&g.length===0&&!Yu(i,x,S))return null;if(i.length===0)return h.jsx("div",{children:g.map(w=>k(w))});return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:v*14},onClick:()=>m(!y),children:[h.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:y?"▾":"▸"}),h.jsx("span",{className:"text-fg",children:o}),h.jsxs("span",{className:"text-fg-faint",children:[" {",$.size,D.length>$.size?`/${new Set([...$,...D]).size}`:"","}"]}),(x==null?void 0:x.description)&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:x.description,children:["— ",x.description]})]}),y&&g.map(w=>k(w))]});function k(w){if($.has(w))return h.jsx(w0,{node:t.children[w],path:[...i,w],label:w,targetScope:a,onOverride:f,filter:S,depth:v+1,schema:l,showGhosts:u},w);const C=(l==null?void 0:l.at([...i,w]))??null;return C?h.jsx(Xk,{path:[...i,w],label:w,info:C,targetScope:a,onSet:f,depth:v+1,filter:S},w):null}}function b0(t,i,o,a){const f=(a==null?void 0:a.at(i))??null;if(Yu(i,f,o))return!0;if(t.kind!=="object")return!1;for(const S of Object.keys(t.children))if(b0(t.children[S],[...i,S],o,a))return!0;return!1}function Gk({node:t,path:i,label:o,filter:a,depth:f,schema:S}){const[v,l]=X.useState(!0),u=(S==null?void 0:S.at(i))??null;return Yu(i,u,a)?h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:f*14},onClick:()=>l(!v),children:[h.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:v?"▾":"▸"}),h.jsx("span",{className:"text-fg",children:o}),h.jsxs("span",{className:"text-fg-faint",children:[" [",t.items.length,"]"]}),h.jsx(hf,{tone:"warn",children:"accumulated"}),(u==null?void 0:u.description)&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:u.description,children:["— ",u.description]})]}),v&&t.items.map((p,y)=>h.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(f+1)*14},children:[h.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),h.jsxs("span",{className:"text-fg-faint",children:[y,":"]}),h.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:om(p.value)}),h.jsx(Mg,{scope:p.fromScope})]},y))]}):null}function Kk({node:t,path:i,label:o,targetScope:a,onOverride:f,filter:S,depth:v,schema:l}){const[u,p]=X.useState(!1),y=(l==null?void 0:l.at(i))??null;if(!Yu(i,y,S))return null;const m=t.winner!==a,x=t.shadowed.length>0;return h.jsxs("div",{children:[h.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:v*14},children:[h.jsx("span",{className:`w-3 shrink-0 ${x?"text-fg-faint cursor-pointer":""}`,onClick:()=>x&&p(!u),children:x?u?"▾":"▸":""}),h.jsxs("span",{className:"text-fg",children:[o,":"]}),h.jsx("span",{className:"text-fg-dim truncate max-w-md",children:om(t.value)}),h.jsx(Mg,{scope:t.winner}),(y==null?void 0:y.deprecated)&&h.jsx(hf,{tone:"warn",children:"deprecated"}),(y==null?void 0:y.default)!==void 0&&Jk(t.value,y.default)&&h.jsx(hf,{tone:"dim",children:"= default"}),t.typeMismatch&&h.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(y==null?void 0:y.description)&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:y.description,children:["— ",y.description]}),h.jsx("div",{className:"flex-1"}),(y==null?void 0:y.enum)&&h.jsx(x0,{values:y.enum}),h.jsx("button",{disabled:!m,onClick:()=>f(i,t.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${m?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:m?`copy into ${Yi[a].label} draft`:`already winning in ${Yi[a].label}`,children:"override"})]}),u&&t.shadowed.map(($,D)=>h.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(v+1)*14+12},children:[h.jsx("span",{children:"shadowed:"}),h.jsx("span",{className:"truncate max-w-xl",children:om($.value)}),h.jsx(Mg,{scope:$.scope,dim:!0})]},D))]})}function Xk({path:t,label:i,info:o,targetScope:a,onSet:f,depth:S,filter:v}){if(!Yu(t,o,v))return null;const l=o.default!==void 0?o.default:Yk(o.type),u=Array.isArray(o.type)?o.type.join("|"):o.type??"?";return h.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:S*14},children:[h.jsx("span",{className:"w-3 shrink-0"}),h.jsx("span",{className:"text-fg-dim",children:i}),h.jsx(hf,{tone:"dim",children:u}),o.required&&h.jsx(hf,{tone:"warn",children:"required"}),o.default!==void 0&&h.jsxs("span",{className:"text-fg-faint",children:["default: ",om(o.default)]}),o.description&&h.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:o.description,children:["— ",o.description]}),h.jsx("div",{className:"flex-1"}),o.enum&&h.jsx(x0,{values:o.enum}),h.jsx("button",{onClick:()=>f(t,l),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${Yi[a].label} draft`,children:"set"})]})}function Jk(t,i){return t===i?!0:typeof t!=typeof i?!1:t&&i&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(i):!1}function Yk(t){switch(Array.isArray(t)?t[0]:t){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function om(t){if(typeof t=="string")return JSON.stringify(t);if(t===null)return"null";if(typeof t=="object"){const i=JSON.stringify(t);return i.length>100?i.slice(0,100)+"…":i}return String(t)}function Mg({scope:t,dim:i}){const o=t==="user"?"bg-bg-hi text-fg-dim border-line":t==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return h.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${o} ${i?"opacity-60":""}`,children:Yi[t].label})}function hf({children:t,tone:i="default"}){const o={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[i];return h.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${o}`,children:t})}function x0({values:t}){const i=t.map(o=>String(o)).join(" | ");return h.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${i}`,children:["∈ ",i.length>30?i.slice(0,30)+"…":i]})}const Qk=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Which model runs, how hard it thinks, and fast-mode toggles.",keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],Zk={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function S0(t){return t.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((a,f)=>{const S=Zk[a];return S||(f===0?a.charAt(0).toUpperCase()+a.slice(1):a)}).join(" ")}function eC(t){const i=new Set,o=[];for(const f of Qk){const S=f.keys.filter(v=>t.has(v));S.forEach(v=>i.add(v)),S.length!==0&&o.push({id:f.id,title:f.title,summary:f.summary,advanced:!!f.advanced,keys:S})}const a=Array.from(t).filter(f=>!i.has(f)&&f!=="$schema").sort();return a.length>0&&o.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:a}),o}function tC({node:t,targetScope:i,onOverride:o,schema:a}){const[f,S]=X.useState(""),[v,l]=X.useState(!1),[u,p]=X.useState(!0),y=t.kind==="object"?t:null,m=y?Object.keys(y.children):[],x=a.rootKeys(),$=new Set([...m,...x]),D=X.useMemo(()=>eC($),[Array.from($).sort().join(",")]),T=X.useMemo(()=>D.filter(g=>v||!g.advanced).map(g=>({...g,keys:g.keys.filter(k=>{const w=(y==null?void 0:y.children[k])!==void 0;if(!u&&!w)return!1;if(!f.trim())return!0;const C=a.at([k]);return[k,S0(k),(C==null?void 0:C.description)??""].join(" ").toLowerCase().includes(f.toLowerCase())})})).filter(g=>g.keys.length>0),[D,f,v,u,y,a]);return h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[h.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",h.jsx("span",{className:"text-fg-dim font-medium",children:Yi[i].label})]}),h.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:u,onChange:g=>p(g.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),h.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:v,onChange:g=>l(g.target.checked),className:"accent-accent"}),"show advanced"]}),h.jsx("div",{className:"flex-1"}),h.jsx("input",{value:f,onChange:g=>S(g.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[T.map(g=>h.jsx(rC,{title:g.title,summary:g.summary,advanced:g.advanced,children:g.keys.map(k=>{const w=y==null?void 0:y.children[k],C=a.at([k]);return h.jsx(iC,{keyName:k,node:w,info:C,targetScope:i,onOverride:P=>o([k],P)},k)})},g.id)),T.length===0&&h.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',f,'"']})]})]})}function rC({title:t,summary:i,advanced:o,children:a}){const[f,S]=X.useState(!0);return h.jsxs("section",{className:"border-b border-line",children:[h.jsxs("header",{className:"px-4 py-2.5 bg-bg-elev/40 cursor-pointer hover:bg-bg-elev flex items-center gap-3",onClick:()=>S(!f),children:[h.jsx("span",{className:"text-fg-faint w-3",children:f?"▾":"▸"}),h.jsxs("div",{className:"flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-fg text-sm font-medium",children:t}),o&&h.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),h.jsx("p",{className:"text-fg-faint text-xs",children:i})]})]}),f&&h.jsx("div",{className:"divide-y divide-line/60",children:a})]})}function iC({keyName:t,node:i,info:o,targetScope:a,onOverride:f}){const[S,v]=X.useState(!1),l=S0(t),u=i!==void 0,y=(i==null?void 0:i.kind)==="leaf"?i:null,m=(i==null?void 0:i.kind)==="object"||(i==null?void 0:i.kind)==="array",x=o==null?void 0:o.default,$=y&&x!==void 0&&C0(y.value,x),D=cC({isSet:u,leafNode:y,defaultVal:x,isDefault:!!$,node:i});return h.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("button",{onClick:()=>v(!S),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:S?"collapse":"expand",children:S?"▾":"▸"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[h.jsx("h3",{className:"text-fg text-sm",children:l}),h.jsx(uC,{kind:D.kind,label:D.label}),(o==null?void 0:o.deprecated)&&h.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(o==null?void 0:o.required)&&!u&&h.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),(o==null?void 0:o.description)&&h.jsx("p",{className:"text-fg-dim text-xs mt-0.5 leading-relaxed",children:dC(o.description)}),S&&h.jsx(sC,{keyName:t,node:i,info:o,targetScope:a,onOverride:f})]}),h.jsx("div",{className:"shrink-0",children:!S&&h.jsx(lC,{node:i,info:o,onSet:T=>{f(T)},disabled:m&&u})})]})})}function sC({keyName:t,node:i,info:o,targetScope:a,onOverride:f}){const v=(i==null?void 0:i.kind)==="leaf"?i:null;return h.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[(o==null?void 0:o.description)&&h.jsx("p",{className:"text-fg-dim leading-relaxed whitespace-pre-wrap",children:o.description}),h.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(o==null?void 0:o.type)&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Type"}),h.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(o.type)?o.type.join(" | "):o.type})]}),(o==null?void 0:o.default)!==void 0&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Default"}),h.jsx("dd",{className:"text-fg-dim font-mono",children:Kp(o.default)})]}),(o==null?void 0:o.enum)&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Options"}),h.jsx("dd",{className:"text-fg-dim font-mono",children:o.enum.map(l=>String(l)).join(" | ")})]}),v&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Current"}),h.jsxs("dd",{className:"font-mono",children:[h.jsx("span",{className:"text-fg-dim",children:Kp(v.value)}),h.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",Yi[v.winner].label]})]})]}),v&&v.shadowed.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Shadowed"}),h.jsx("dd",{className:"space-y-0.5",children:v.shadowed.map((l,u)=>h.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[Kp(l.value)," —"," ",h.jsx("span",{className:"no-underline",children:Yi[l.scope].label})]},u))})]}),(i==null?void 0:i.kind)==="array"&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{children:"Accumulated"}),h.jsxs("dd",{className:"text-fg-dim",children:[i.items.length," items across all scopes"]})]})]}),h.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:h.jsx(nC,{keyName:t,node:i,info:o,onChange:f,targetScope:a})})]})}function nC({node:t,info:i,onChange:o,targetScope:a}){const S=(t==null?void 0:t.kind)==="leaf"?t.value:i==null?void 0:i.default,v=k0(i==null?void 0:i.type);if(v==="boolean"){const l=S===!0;return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-fg-faint",children:"Set to:"}),h.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:u,label:p})=>h.jsx("button",{onClick:()=>o(u),className:`px-3 py-0.5 text-xs transition-colors ${l===u?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:p},p))}),h.jsxs("span",{className:"text-fg-faint",children:["→ ",Yi[a].label]})]})}return i!=null&&i.enum?h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("span",{className:"text-fg-faint",children:"Choose:"}),i.enum.map(l=>{const u=C0(S,l);return h.jsx("button",{onClick:()=>o(l),className:`px-2 py-0.5 text-xs rounded border ${u?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(l)},String(l))}),h.jsxs("span",{className:"text-fg-faint",children:["→ ",Yi[a].label]})]}):v==="integer"||v==="number"?h.jsx(oC,{value:typeof S=="number"?S:void 0,integer:v==="integer",onCommit:o,target:Yi[a].label}):v==="string"?h.jsx(aC,{value:typeof S=="string"?S:"",onCommit:o,target:Yi[a].label}):h.jsxs("div",{className:"text-fg-faint",children:["Complex value (",v??"object/array",") — use the"," ",h.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function oC({value:t,integer:i,onCommit:o,target:a}){const[f,S]=X.useState(t!==void 0?String(t):""),v=()=>{const l=i?parseInt(f,10):parseFloat(f);Number.isNaN(l)||o(l)};return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-fg-faint",children:"Set to:"}),h.jsx("input",{type:"number",value:f,onChange:l=>S(l.target.value),onBlur:v,onKeyDown:l=>{l.key==="Enter"&&l.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),h.jsxs("button",{onClick:v,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",a]})]})}function aC({value:t,onCommit:i,target:o}){const[a,f]=X.useState(t);return h.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[h.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),h.jsx("input",{type:"text",value:a,onChange:S=>f(S.target.value),onKeyDown:S=>{S.key==="Enter"&&i(a)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),h.jsxs("button",{onClick:()=>i(a),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",o]})]})}function lC({node:t,info:i,onSet:o,disabled:a}){const f=(t==null?void 0:t.kind)==="leaf",S=k0(i==null?void 0:i.type);if(a)return null;if(S==="boolean"){const v=f&&t.value===!0;return h.jsx("button",{onClick:()=>o(!v),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${v?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:v?"on":"off"})}return null}function cC({isSet:t,leafNode:i,defaultVal:o,isDefault:a,node:f}){return t?(f==null?void 0:f.kind)==="array"?{kind:"accumulated",label:`${f.items.length} items`}:(f==null?void 0:f.kind)==="object"?{kind:"set",label:"configured"}:i?a?{kind:"default",label:`= default · ${Yi[i.winner].label}`}:i.shadowed.length>0?{kind:"override",label:`overriding ${i.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${Yi[i.winner].label}`}:{kind:"set",label:"configured"}:o!==void 0?{kind:"default",label:`using default: ${Kp(o)}`}:{kind:"unset",label:"not configured"}}function uC({kind:t,label:i}){const o={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[t];return h.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${o}`,children:i})}function k0(t){if(t)return Array.isArray(t)?t.find(o=>o!=="null")??t[0]:t}function C0(t,i){return t===i?!0:typeof t!=typeof i?!1:t&&i&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(i):!1}function dC(t){const i=t.trim().split(`
|
|
2901
2901
|
`)[0],o=i.match(/^([^.!?]+[.!?])/);return o?o[1]:i.length>120?i.slice(0,120)+"…":i}function Kp(t){if(typeof t=="string")return t===""?'""':JSON.stringify(t);if(t===null)return"null";if(t===void 0)return"—";if(typeof t=="object"){const i=JSON.stringify(t);return i.length>60?i.slice(0,60)+"…":i}return String(t)}function hv({options:t,active:i,onChange:o}){return h.jsx("div",{className:"flex rounded border border-line overflow-hidden",children:t.map(({key:a,label:f})=>h.jsx("button",{onClick:()=>o(a),className:`px-2 py-0.5 text-xs ${i===a?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:f},a))})}function Xh(t){return{path:t,diskRaw:"",draftRaw:"",diskData:null,exists:!1,parseError:null,loadError:null,mtimeMs:0,dirty:!1,busy:!1,lastSavedAt:null}}function og(t,i,o){const a={...t,diskRaw:i.raw,diskData:i.data,exists:i.exists,parseError:i.parseError,loadError:i.error,mtimeMs:i.mtimeMs,busy:!1};return!o||!t.dirty?(a.draftRaw=i.raw,a.dirty=!1):a.dirty=a.draftRaw!==a.diskRaw,a}function a_(t,i,o){const a={...t,diskRaw:i.text,diskData:null,exists:i.exists,parseError:null,loadError:i.error,mtimeMs:i.mtimeMs,busy:!1};return a.draftRaw=i.text,a.dirty=!1,a}const Ct=vf((t,i)=>({files:{},watchRefs:{},loadJson:async o=>{const a=i().files[o];t({files:{...i().files,[o]:{...a??Xh(o),busy:!0}}});const f=await window.api.config.readJson(o),S=i().files[o]??Xh(o);t({files:{...i().files,[o]:og(S,f,!1)}})},loadText:async o=>{const a=i().files[o];t({files:{...i().files,[o]:{...a??Xh(o),busy:!0}}});const f=await window.api.config.readText(o),S=i().files[o]??Xh(o);t({files:{...i().files,[o]:a_(S,f)}})},setDraft:(o,a)=>{const f=i().files[o]??Xh(o),S=a!==f.diskRaw;t({files:{...i().files,[o]:{...f,draftRaw:a,dirty:S}}})},revert:o=>{const a=i().files[o];a&&t({files:{...i().files,[o]:{...a,draftRaw:a.diskRaw,dirty:!1}}})},saveJson:async o=>{const a=i().files[o];if(!a)return{ok:!1,error:"not loaded"};let f;try{f=a.draftRaw.trim()===""?{}:JSON.parse(a.draftRaw)}catch(u){return{ok:!1,error:`invalid JSON: ${u.message}`}}t({files:{...i().files,[o]:{...a,busy:!0}}});const S=await window.api.config.writeJson(o,f);if(!S.ok)return t({files:{...i().files,[o]:{...a,busy:!1}}}),{ok:!1,error:S.error};const v=await window.api.config.readJson(o),l=og({...a,busy:!1},v,!1);return t({files:{...i().files,[o]:{...l,lastSavedAt:Date.now()}}}),{ok:!0}},saveText:async o=>{const a=i().files[o];if(!a)return{ok:!1,error:"not loaded"};t({files:{...i().files,[o]:{...a,busy:!0}}});const f=await window.api.config.writeText(o,a.draftRaw);if(!f.ok)return t({files:{...i().files,[o]:{...a,busy:!1}}}),{ok:!1,error:f.error};const S=await window.api.config.readText(o),v=a_({...a,busy:!1},S);return t({files:{...i().files,[o]:{...v,lastSavedAt:Date.now()}}}),{ok:!0}},watchFile:o=>{const a={...i().watchRefs};a[o]=(a[o]??0)+1,t({watchRefs:a}),a[o]===1&&window.api.config.watch([o])},unwatchFile:o=>{const a={...i().watchRefs};a[o]&&(a[o]--,a[o]<=0&&(delete a[o],window.api.config.unwatch([o])),t({watchRefs:a}))},onExternalChange:o=>{i().files[o]&&window.api.config.readJson(o).then(f=>{const S=i().files[o];S&&t({files:{...i().files,[o]:og(S,f,!0)}})})}}));function hC(){return window.api.config.onChanged(({path:t})=>{Ct.getState().onExternalChange(t)})}const fC=[];function Np(t){return Array.isArray(t)?"array":t!==null&&typeof t=="object"?"object":"scalar"}function fv(t){const i=t.filter(o=>o.data!==void 0);return i.length===0?{kind:"object",children:{}}:E0(i,[])}function E0(t,i){const o=fC.includes(i.join(".")),a=t.every(y=>Np(y.data)==="object"),f=t.every(y=>Np(y.data)==="array");if(a){const y=new Set;for(const x of t)for(const $ of Object.keys(x.data))y.add($);const m={};for(const x of y){const $=t.filter(D=>x in D.data).map(D=>({scope:D.scope,data:D.data[x]}));m[x]=E0($,[...i,x])}return{kind:"object",children:m}}if(f&&!o){const y=[];for(const m of[...t].reverse())for(const x of m.data)y.push({value:x,fromScope:m.scope,index:y.length});return{kind:"array",items:y}}const S=[...t].reverse(),v=S[0],l=S.slice(1).map(y=>({scope:y.scope,value:y.data})),u=Np(v.data),p=l.some(y=>Np(y.value)!==u);return{kind:"leaf",value:v.data,winner:v.scope,shadowed:l,...p?{typeMismatch:!0}:{}}}function pv(t,i){if(i.length===0)return t;if(t.kind!=="object")return null;const[o,...a]=i,f=t.children[o];return f?pv(f,a):null}function _m(t,i,o){if(i.length===0)return o;const[a,...f]=i,S=t&&typeof t=="object"&&!Array.isArray(t)?{...t}:{};return S[a]=_m(S[a],f,o),S}const pC=["user","project","local"];function mv(t,i){const o=[];for(const a of pC){const f=i[a];if(!f)continue;const S=t[f];if(!S||!S.exists)continue;const v=S.draftRaw??"";if(v.trim())try{o.push({scope:a,data:JSON.parse(v)})}catch{}}return o}const mC="http://json-schema.org/draft-07/schema#",gC="https://json.schemastore.org/claude-code-settings.json",vC={permissionRule:{type:"string",description:`Tool permission rule.
|
|
2902
2902
|
See https://code.claude.com/docs/en/settings#permission-rule-syntax
|
|
2903
2903
|
See https://code.claude.com/docs/en/settings#tools-available-to-claude for full list of tools available to Claude.`,pattern:"^((Agent|Bash|Edit|ExitPlanMode|Glob|Grep|KillShell|LSP|NotebookEdit|Read|Skill|TaskCreate|TaskGet|TaskList|TaskOutput|TaskStop|TaskUpdate|TodoWrite|ToolSearch|WebFetch|WebSearch|Write)(\\((?=.*[^)*?])[^)]+\\))?|mcp__.*)$",examples:["Bash","Bash(npm run build)","Bash(git commit *)","Bash(npm run *)","Bash(ls*)","Bash(git * main)","Edit","Edit(/src/**/*.ts)","Read(./.env)","Read(./secrets/**)","Read(//Users/alice/secrets/**)","Read(~/Documents/*.pdf)","Agent(Explore)","WebFetch","WebFetch(domain:example.com)","mcp__puppeteer","mcp__github__search_repositories"]},hookCommand:{anyOf:[{type:"object",description:"Bash command hook",additionalProperties:!1,required:["type","command"],properties:{type:{type:"string",description:"Hook type",const:"command"},command:{type:"string",description:"Shell command to execute",minLength:1},timeout:{type:"number",description:"Optional timeout in seconds",exclusiveMinimum:0},async:{type:"boolean",description:"Run this hook asynchronously without blocking Claude Code"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"LLM prompt hook. See https://code.claude.com/docs/en/hooks#prompt-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"prompt"},prompt:{type:"string",description:"Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 30)",exclusiveMinimum:0},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"Agent hook with multi-turn tool access for verification. See https://code.claude.com/docs/en/hooks#agent-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"agent"},prompt:{type:"string",description:"Prompt describing what to verify. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 60)",exclusiveMinimum:0},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"HTTP webhook hook. POST JSON to a URL and receive JSON response. See https://code.claude.com/docs/en/hooks#http-hooks",additionalProperties:!1,required:["type","url"],properties:{type:{type:"string",description:"Hook type",const:"http"},url:{type:"string",description:"URL to POST hook input JSON to. Endpoint must accept POST requests and return JSON.",minLength:1},headers:{type:"object",additionalProperties:{type:"string"},description:"Custom HTTP headers (e.g., Authorization: Bearer token). Values support $VAR_NAME or ${VAR_NAME} interpolation."},allowedEnvVars:{type:"array",items:{type:"string",minLength:1},description:"List of environment variable names permitted for interpolation in headers. If not set, no env var interpolation is allowed."},timeout:{type:"number",description:"Optional timeout in seconds (default: 30)",exclusiveMinimum:0},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}}]},hookMatcher:{type:"object",description:"Hook matcher configuration with multiple hooks",additionalProperties:!1,required:["hooks"],properties:{matcher:{type:"string",description:"Optional pattern to match event contexts, case-sensitive. Behavior depends on event type. See https://code.claude.com/docs/en/hooks#matcher-patterns for event-specific details and examples"},hooks:{type:"array",description:"Array of hooks to execute",items:{$ref:"#/$defs/hookCommand"}}}}},yC="Configuration settings for Claude Code. Learn more: https://code.claude.com/docs/en/settings",_C=!0,wC=!0,bC="object",xC=JSON.parse(`{"$schema":{"type":"string","description":"JSON Schema reference for Claude Code settings"},"apiKeyHelper":{"type":"string","description":"Path to a script that outputs authentication values","examples":["/bin/generate_temp_api_key.sh"],"minLength":1},"autoMemoryEnabled":{"type":"boolean","description":"Enable automatic memory saves that capture useful context to .claude/memory/. Also configurable via CLAUDE_CODE_DISABLE_AUTO_MEMORY environment variable (set to 1 to disable, 0 to enable). See https://code.claude.com/docs/en/memory#auto-memory","default":true},"autoUpdatesChannel":{"type":"string","enum":["stable","latest"],"description":"Release channel to follow for updates. Use \\"stable\\" for a version that is typically about one week old and skips versions with major regressions, or \\"latest\\" (default) for the most recent release. Set DISABLE_AUTOUPDATER=1 to disable updates entirely.","default":"latest"},"awsCredentialExport":{"type":"string","description":"Path to a script that exports AWS credentials","examples":["/bin/generate_aws_grant.sh"],"minLength":1},"awsAuthRefresh":{"type":"string","description":"Path to a script that refreshes AWS authentication","examples":["aws sso login --profile myprofile"],"minLength":1},"claudeMdExcludes":{"type":"array","items":{"type":"string","minLength":1},"description":"Glob patterns for CLAUDE.md files to exclude from loading. Useful in monorepos to skip irrelevant instructions from other teams. Patterns match against absolute file paths. Arrays merge across settings layers. Managed policy CLAUDE.md files cannot be excluded. See https://code.claude.com/docs/en/memory#exclude-specific-claudemd-files","examples":[["**/monorepo/CLAUDE.md","/home/user/monorepo/other-team/.claude/rules/**"]]},"cleanupPeriodDays":{"type":"integer","minimum":0,"description":"Number of days to retain chat transcripts (0 to disable cleanup)","examples":[20,30,60],"default":30},"env":{"type":"object","additionalProperties":false,"description":"Environment variables to set for Claude Code sessions. Many environment variables provide settings dimensions not available as dedicated settings.json properties (e.g., thinking tokens, prompt caching, bash timeouts, shell configuration). See https://code.claude.com/docs/en/settings#environment-variables for the full list.\\nUNDOCUMENTED: CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS (plugin marketplace git timeout in ms, default 120000, see https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2151).\\nUNDOCUMENTED: ENABLE_CLAUDEAI_MCP_SERVERS (set to false to opt out of claude.ai MCP servers, see https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2163).","examples":[{"ANTHROPIC_MODEL":"claude-opus-4-1","ANTHROPIC_SMALL_FAST_MODEL":"claude-3-5-haiku-latest"}],"default":{},"patternProperties":{"^[A-Z_][A-Z0-9_]*$":{"type":"string","description":"Environment variable value"}}},"attribution":{"type":"object","description":"Customize attribution for git commits and pull requests. See https://code.claude.com/docs/en/settings#attribution-settings","additionalProperties":false,"properties":{"commit":{"type":"string","description":"Attribution for git commits, including any trailers. Empty string hides commit attribution"},"pr":{"type":"string","description":"Attribution for pull request descriptions. Empty string hides pull request attribution"}}},"includeGitInstructions":{"type":"boolean","description":"Include built-in git commit and PR workflow instructions in Claude's system prompt. Also configurable via CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS environment variable (set to 1 to disable). See https://code.claude.com/docs/en/settings#available-settings","default":true},"includeCoAuthoredBy":{"type":"boolean","description":"DEPRECATED. Use 'attribution' instead. Whether to include the co-authored-by Claude byline in git commits and pull requests (default: true)","default":true},"plansDirectory":{"type":"string","description":"Customize where plan files are stored. Path is relative to project root (default: ~/.claude/plans)","default":"~/.claude/plans","examples":["./plans"]},"respectGitignore":{"type":"boolean","description":"Control whether the @ file picker respects .gitignore patterns. When true (default), files matching .gitignore patterns are excluded from suggestions","default":true},"permissions":{"type":"object","properties":{"allow":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for allowed operations","uniqueItems":true},"deny":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for denied operations","uniqueItems":true},"ask":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules that should always prompt for confirmation","uniqueItems":true},"defaultMode":{"type":"string","enum":["acceptEdits","bypassPermissions","default","delegate","dontAsk","plan"],"description":"Default permission mode.\\n\\"default\\": prompts on first use.\\n\\"acceptEdits\\": auto-accepts file edits.\\n\\"plan\\": read-only, no modifications.\\nUNDOCUMENTED. \\"delegate\\": coordination-only for agent team leads (agent teams are experimental; enable via CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS).\\n\\"dontAsk\\": auto-denies unless pre-approved via permissions.\\n\\"bypassPermissions\\": skips all prompts (use only in isolated environments).\\nSee https://code.claude.com/docs/en/permissions"},"disableBypassPermissionsMode":{"type":"string","enum":["disable"],"description":"Disable the ability to bypass permission prompts"},"additionalDirectories":{"type":"array","items":{"type":"string","minLength":1},"description":"Additional directories to include in the permission scope","examples":[["//Users/alice/Documents","~/projects"]],"uniqueItems":true}},"additionalProperties":false,"description":"Tool usage permissions configuration.\\nSee https://code.claude.com/docs/en/permissions and https://code.claude.com/docs/en/settings#permission-settings\\nSee https://code.claude.com/docs/en/settings#tools-available-to-claude for full list of tools available to Claude.","examples":[{"allow":["Bash(git add:*)"],"ask":["Bash(gh pr create:*)","Bash(git commit:*)"],"deny":["Read(*.env)","Bash(rm:*)","Bash(curl:*)"],"defaultMode":"default"}]},"language":{"type":"string","description":"Preferred language for Claude's responses","examples":["japanese","spanish","french"]},"model":{"type":"string","description":"Override the default model used by Claude Code. For finer control, use environment variables: ANTHROPIC_MODEL (runtime override), ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL (per-class pinning), CLAUDE_CODE_SUBAGENT_MODEL (subagent model). See https://code.claude.com/docs/en/model-config"},"availableModels":{"type":"array","items":{"type":"string"},"description":"Restrict which models users can select. When defined at multiple settings levels (user, project, etc.), arrays are merged and deduplicated. See https://code.claude.com/docs/en/model-config#restrict-model-selection","examples":[["sonnet","haiku"]]},"modelOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Map Anthropic model IDs to provider-specific model IDs such as Bedrock inference profile ARNs, Vertex AI version names, or Foundry deployment names. Each model picker entry uses its mapped value when calling the provider API. Unknown keys are ignored. See https://code.claude.com/docs/en/model-config#override-model-ids-per-version","examples":[{"claude-opus-4-6":"arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/opus-prod"}]},"effortLevel":{"type":"string","enum":["low","medium","high"],"description":"Control Opus 4.6 adaptive reasoning effort. Lower effort is faster and cheaper for straightforward tasks, higher effort provides deeper reasoning. Defaults vary by model and plan (Opus 4.6 defaults to medium for Max and Team subscribers). Use /effort auto to reset to model default. Also configurable via CLAUDE_CODE_EFFORT_LEVEL environment variable. See https://code.claude.com/docs/en/model-config#adjust-effort-level"},"fastMode":{"type":"boolean","description":"Enable fast mode for Opus 4.6 (research preview). Fast mode uses the same model with 2.5x faster output at higher per-token cost. Requires extra usage enabled. Alternatively, toggle with /fast command. See https://code.claude.com/docs/en/fast-mode","default":false},"fastModePerSessionOptIn":{"type":"boolean","description":"Require per-session opt-in for fast mode. When true, fast mode does not persist across sessions and users must enable it with /fast each session. Useful for controlling costs. See https://code.claude.com/docs/en/fast-mode","default":false},"feedbackSurveyRate":{"type":"number","minimum":0,"maximum":1,"description":"Probability (0–1) that the session quality survey appears when eligible. A value of 0.05 means 5% of eligible sessions. See https://code.claude.com/docs/en/settings","examples":[0.05]},"enableAllProjectMcpServers":{"type":"boolean","description":"Whether to automatically approve all MCP servers in the project. See https://code.claude.com/docs/en/mcp","examples":[true]},"enabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of approved MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["memory","github"]]},"disabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of rejected MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["filesystem"]]},"allowedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that users are allowed to configure"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"deniedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that is explicitly blocked"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"httpHookAllowedEnvVars":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. Undefined = no restriction. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["MY_TOKEN","HOOK_SECRET"]]},"hooks":{"type":"object","additionalProperties":false,"description":"Custom commands to run before/after tool executions. See https://code.claude.com/docs/en/hooks","examples":[{"PostToolUse":[{"matcher":"Edit|Write","hooks":[{"type":"command","command":"prettier --write","timeout":5}]}]}],"properties":{"PreToolUse":{"type":"array","description":"Hooks that run before tool calls","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUse":{"type":"array","description":"Hooks that run after tool completion","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUseFailure":{"type":"array","description":"Hooks that run after a tool fails","items":{"$ref":"#/$defs/hookMatcher"}},"PermissionRequest":{"type":"array","description":"Hooks that run when a permission dialog appears","items":{"$ref":"#/$defs/hookMatcher"}},"Notification":{"type":"array","description":"Hooks that trigger on notifications","items":{"$ref":"#/$defs/hookMatcher"}},"UserPromptSubmit":{"type":"array","description":"Hooks that run when a user submits a prompt","items":{"$ref":"#/$defs/hookMatcher"}},"Stop":{"type":"array","description":"Hooks that run when agents finish responding. Does not run on user interrupt","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStart":{"type":"array","description":"Hooks that run when a subagent is spawned","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStop":{"type":"array","description":"Hooks that run when subagents finish responding","items":{"$ref":"#/$defs/hookMatcher"}},"PreCompact":{"type":"array","description":"Hooks that run before the context is compacted","items":{"$ref":"#/$defs/hookMatcher"}},"PostCompact":{"type":"array","description":"Hooks that run after the context is compacted. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"Elicitation":{"type":"array","description":"Hooks that run when an MCP server requests user input during a tool call. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"ElicitationResult":{"type":"array","description":"Hooks that run after a user responds to an MCP elicitation, before the response is sent back to the server. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"TeammateIdle":{"type":"array","description":"Hooks that run when an agent team teammate is about to go idle. Exit code 2 sends feedback and keeps the teammate working. Does not support matchers. Agent teams are experimental. See https://code.claude.com/docs/en/hooks#teammateidle","items":{"$ref":"#/$defs/hookMatcher"}},"TaskCompleted":{"type":"array","description":"Hooks that run when a task is being marked as completed. Exit code 2 prevents completion and sends feedback. Does not support matchers. See https://code.claude.com/docs/en/hooks#taskcompleted","items":{"$ref":"#/$defs/hookMatcher"}},"Setup":{"type":"array","description":"UNDOCUMENTED. Hooks that run during repository initialization (--init, --init-only) or maintenance (--maintenance)","items":{"$ref":"#/$defs/hookMatcher"}},"InstructionsLoaded":{"type":"array","description":"Hooks that run when a CLAUDE.md or .claude/rules/*.md file is loaded into context. Fires at session start and when files are lazily loaded (e.g., nested traversal, path glob match). No decision control; used for audit logging and observability. Does not support matchers. See https://code.claude.com/docs/en/hooks#instructionsloaded","items":{"$ref":"#/$defs/hookMatcher"}},"ConfigChange":{"type":"array","description":"Hooks that run when settings, managed settings, or skill files change during a session. Supports matchers: user_settings, project_settings, local_settings, policy_settings, skills. Command handlers only. Exit code 2 blocks the change (except policy_settings which is audit-only). See https://code.claude.com/docs/en/hooks#configchange","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeCreate":{"type":"array","description":"Hooks that run when a worktree is created via --worktree or isolation: \\"worktree\\" in subagents. Command handlers only, no matchers. Hook must print absolute path to created worktree on stdout; non-zero exit fails creation. See https://code.claude.com/docs/en/hooks#worktreecreate","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeRemove":{"type":"array","description":"Hooks that run when a worktree is being removed at session exit or when a subagent finishes. Command handlers only, no matchers. Used for cleanup tasks; cannot block removal. See https://code.claude.com/docs/en/hooks#worktreeremove","items":{"$ref":"#/$defs/hookMatcher"}},"SessionStart":{"type":"array","description":"Hooks that run when a new session starts","items":{"$ref":"#/$defs/hookMatcher"}},"SessionEnd":{"type":"array","description":"Hooks that run when a session ends","items":{"$ref":"#/$defs/hookMatcher"}}}},"disableAllHooks":{"type":"boolean","description":"Disable all hooks and statusLine execution. When true in managed settings, user and project-level disableAllHooks cannot override it. See https://code.claude.com/docs/en/hooks#disable-or-remove-hooks"},"allowedHttpHookUrls":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard. When set, hooks with non-matching URLs are blocked. Undefined = no restriction, empty array = block all HTTP hooks. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["https://hooks.example.com/*","http://localhost:*"]]},"allowManagedHooksOnly":{"type":"boolean","description":"(Managed settings only) Prevent loading of user, project, and plugin hooks. Only allows managed hooks and SDK hooks. See https://code.claude.com/docs/en/settings#hook-configuration"},"allowManagedPermissionRulesOnly":{"type":"boolean","description":"(Managed settings only) Prevent user and project settings from defining allow, ask, or deny permission rules. Only rules in managed settings apply. See https://code.claude.com/docs/en/settings#permission-settings"},"statusLine":{"type":"object","properties":{"type":{"type":"string","description":"The type of status line handler; must be set to \\"command\\" to run a custom shell script that receives JSON session data via stdin.","const":"command"},"command":{"type":"string","description":"A shell command or path to a script that displays session information (context usage, costs, git status, etc.) by reading JSON data from stdin and writing output to stdout. See https://code.claude.com/docs/en/statusline"},"padding":{"type":"number","description":"Optional number of extra horizontal spacing characters added to the status line content; defaults to 0."}},"required":["type","command"],"additionalProperties":false,"description":"Custom status line display configuration. See https://code.claude.com/docs/en/statusline","examples":[{"type":"command","command":"~/.claude/statusline.sh"}]},"fileSuggestion":{"type":"object","properties":{"type":{"type":"string","description":"The type of file suggestion handler; must be set to \\"command\\" to execute a custom shell script that generates file suggestions for the @ file picker.","const":"command"},"command":{"type":"string","description":"Shell command to execute for file suggestions"}},"required":["type","command"],"additionalProperties":false,"description":"Configure a custom script for @ file autocomplete. See https://code.claude.com/docs/en/settings#file-suggestion-settings","examples":[{"type":"command","command":"~/.claude/file-suggestion.sh"}]},"enabledPlugins":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"boolean"},{"not":{}}]},"description":"Enabled plugins using plugin-id@marketplace-id format. Example: { \\"formatter@anthropic-tools\\": true }. See https://code.claude.com/docs/en/plugins"},"extraKnownMarketplaces":{"type":"object","additionalProperties":{"type":"object","properties":{"source":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","pattern":"\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false}],"description":"Where to fetch the marketplace from"},"installLocation":{"type":"string","description":"Local cache path where marketplace manifest is stored (auto-generated if not provided)"}},"required":["source"],"additionalProperties":false},"description":"Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources. See https://code.claude.com/docs/en/plugin-marketplaces"},"strictKnownMarketplaces":{"type":"array","description":"(Managed settings only) Allowlist of plugin marketplaces users can add. Undefined = no restrictions, empty array = lockdown. Uses exact matching for source specifications. See https://code.claude.com/docs/en/settings#strictknownmarketplaces","items":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"HTTP headers for authenticated access"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package name (supports scoped packages)"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Absolute path to marketplace.json file"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Absolute path to directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"pathPattern"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"],"additionalProperties":false}]},"examples":[[{"source":"github","repo":"acme-corp/approved-plugins"},{"source":"npm","package":"@acme-corp/compliance-plugins"}]]},"skippedMarketplaces":{"type":"array","items":{"type":"string","minLength":1},"description":"List of marketplace names the user has chosen not to install when prompted"},"skippedPlugins":{"type":"array","items":{"type":"string","minLength":1},"description":"List of plugin IDs (plugin@marketplace format) the user has chosen not to install when prompted"},"forceLoginMethod":{"type":"string","enum":["claudeai","console"],"description":"Force a specific login method: \\"claudeai\\" for Claude Pro/Max, \\"console\\" for Console billing","examples":["claudeai"]},"forceLoginOrgUUID":{"type":"string","description":"Organization UUID to use for OAuth login","examples":["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],"minLength":1},"otelHeadersHelper":{"type":"string","description":"Path to a script that outputs OpenTelemetry headers","minLength":1},"outputStyle":{"type":"string","description":"Controls the output style for assistant responses. Built-in styles: default, Explanatory, Learning. Custom styles can be added in ~/.claude/output-styles/ or .claude/output-styles/. See https://code.claude.com/docs/en/output-styles","examples":["default","Explanatory","Learning"],"minLength":1},"skipWebFetchPreflight":{"type":"boolean","description":"Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"},"sandbox":{"type":"object","description":"Sandbox execution configuration. See https://code.claude.com/docs/en/sandboxing","properties":{"network":{"type":"object","description":"Configures network isolation settings for the sandboxed bash environment, including domain restrictions, Unix socket access, and custom proxy configuration.","properties":{"allowUnixSockets":{"type":"array","items":{"type":"string"},"description":"Allow Unix domain sockets for local IPC (SSH agent, Docker, etc.). Provide an array of specific paths. Defaults to blocking if not specified"},"allowLocalBinding":{"type":"boolean","description":"Allow binding to local network addresses (e.g., localhost ports). Defaults to false if not specified"},"httpProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"HTTP proxy port to use for network filtering. If not specified, a proxy server will be started automatically"},"socksProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"SOCKS proxy port to use for network filtering. If not specified, a proxy server will be started automatically"},"allowAllUnixSockets":{"type":"boolean","description":"Allow all Unix domain socket connections. If true, this overrides allowUnixSockets"},"allowedDomains":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of network domains for sandboxed commands. Supports wildcard patterns like *.example.com"},"allowManagedDomainsOnly":{"type":"boolean","description":"(Managed settings only) Only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources. Non-allowed domains are automatically blocked without user prompts."}},"additionalProperties":false},"ignoreViolations":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"},"description":"List of filesystem paths to ignore sandbox violations for when this command pattern matches"},"description":"Map of command patterns to filesystem paths to ignore violations for. Use \\"*\\" to match all commands"},"excludedCommands":{"type":"array","items":{"type":"string"},"description":"Commands that should never run in the sandbox (e.g., [\\"git\\", \\"docker\\"])"},"autoAllowBashIfSandboxed":{"type":"boolean","description":"Automatically allow bash commands without prompting when they run in the sandbox. Only applies to commands that will run sandboxed.","default":true},"enableWeakerNetworkIsolation":{"type":"boolean","description":"macOS only. Allow access to the system TLS trust service (com.apple.trustd.agent) in the sandbox. Required for Go-based tools like gh, gcloud, and terraform to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. Reduces security by opening a potential data exfiltration path. Default: false. See https://code.claude.com/docs/en/settings#sandbox-settings","default":false},"enableWeakerNestedSandbox":{"type":"boolean","description":"Enable weaker sandbox mode for unprivileged docker environments where --proc mounting fails. This significantly reduces the strength of the sandbox and should only be used when this risk is acceptable.Default: false (secure)."},"allowUnsandboxedCommands":{"type":"boolean","description":"Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."},"enabled":{"type":"boolean","description":"Enable sandboxed bash"},"filesystem":{"type":"object","description":"Filesystem access control for sandboxed commands. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation","properties":{"allowWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are allowed to write. Supports prefixes: // (absolute), ~/ (home directory), / (relative to settings file), ./ or no prefix (relative path)"},"denyWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied write access. Takes precedence over allowWrite"},"denyRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied read access"},"allowRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths"},"allowManagedReadPathsOnly":{"type":"boolean","description":"When true (managed settings only), only allowRead paths from managed settings are used"}},"additionalProperties":false}},"additionalProperties":false},"spinnerVerbs":{"type":"object","description":"Customize the verbs shown in spinner progress messages","properties":{"mode":{"type":"string","enum":["append","replace"],"description":"How to combine custom verbs with default spinner verbs: 'append' adds custom verbs to the default list, 'replace' uses only custom verbs"},"verbs":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"description":"Custom verbs used in spinner progress text"}},"required":["verbs"],"additionalProperties":false},"spinnerTipsEnabled":{"type":"boolean","description":"Show tips in the spinner while Claude is working. Set to false to disable tips (default: true)","default":true},"spinnerTipsOverride":{"type":"object","description":"Customize the tips displayed in the spinner while Claude is working. See https://code.claude.com/docs/en/settings#available-settings","properties":{"excludeDefault":{"type":"boolean","description":"If true, only show custom tips. If false or absent, custom tips merge with built-in tips","default":false},"tips":{"type":"array","items":{"type":"string","minLength":1},"description":"Custom tip strings to display in the spinner","minItems":1}},"required":["tips"],"additionalProperties":false},"terminalProgressBarEnabled":{"type":"boolean","description":"Enable the terminal progress bar that shows progress in supported terminals like Windows Terminal and iTerm2 (default: true)","default":true},"showTurnDuration":{"type":"boolean","description":"Show turn duration messages after responses (e.g., \\"Cooked for 1m 6s\\"). Set to false to hide these messages (default: true)","default":true},"prefersReducedMotion":{"type":"boolean","description":"Reduce or disable UI animations (spinners, shimmer, flash effects) for accessibility","default":false},"alwaysThinkingEnabled":{"type":"boolean","description":"Enable extended thinking by default for all sessions. Typically configured via the /config command rather than editing directly. See https://code.claude.com/docs/en/common-workflows#use-extended-thinking-thinking-mode"},"companyAnnouncements":{"type":"array","items":{"type":"string","minLength":1},"description":"Company announcements to display at startup (one will be randomly selected if multiple are provided)"},"teammateMode":{"type":"string","enum":["auto","in-process","tmux"],"description":"How agent team teammates display: \\"auto\\" picks split panes in tmux or iTerm2, in-process otherwise. Agent teams are experimental and disabled by default. Enable them by adding CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to your settings.json or environment. See https://code.claude.com/docs/en/agent-teams","default":"auto"},"worktree":{"type":"object","additionalProperties":false,"description":"Configuration for --worktree sessions. See https://code.claude.com/docs/en/settings","properties":{"sparsePaths":{"type":"array","items":{"type":"string","minLength":1},"description":"Directories to check out in each worktree via git sparse-checkout (cone mode). Only the listed paths are written to disk, which is faster in large monorepos.","examples":[["packages/my-app","shared/utils"]]}}},"pluginTrustMessage":{"type":"string","description":"(Managed settings only) Custom message appended to the plugin trust warning shown before installation. Use to provide organization-specific context about approved plugins. See https://code.claude.com/docs/en/settings#plugin-settings","minLength":1},"pluginConfigs":{"type":"object","additionalProperties":{"type":"object","properties":{"mcpServers":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}}]}},"description":"User configuration values for MCP servers keyed by server name"}},"additionalProperties":false},"description":"Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format). See https://code.claude.com/docs/en/plugins"},"allowManagedMcpServersOnly":{"type":"boolean","description":"(Managed settings only) Only allowedMcpServers from managed settings are respected. deniedMcpServers still merges from all sources. Users can still add their own MCP servers, but only the admin-defined allowlist applies."},"blockedMarketplaces":{"type":"array","description":"(Managed settings only) Blocklist of marketplace sources. These exact sources are blocked from being added as marketplaces. The check happens before downloading, so blocked sources never touch the filesystem.","items":{"anyOf":[{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"url","description":"Block marketplace fetched from direct URL"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom HTTP headers (e.g., for authentication)"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"github","description":"Block marketplace from GitHub repository"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","repo"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"git","description":"Block marketplace from git repository URL"},"url":{"type":"string","pattern":".*\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"npm","description":"Block marketplace from NPM package"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"file","description":"Block marketplace from local file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"directory","description":"Block marketplace from local directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"hostPattern","description":"Block marketplace by host pattern matching"},"hostPattern":{"type":"string","description":"Regex pattern to match the host/domain extracted from any marketplace source type"}},"required":["source","hostPattern"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"pathPattern","description":"Block marketplace by file/directory path pattern matching"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"]}]}}}`),SC="Claude Code Settings",kC={$schema:mC,$id:gC,$defs:vC,description:yC,allowTrailingCommas:_C,additionalProperties:wC,type:bC,properties:xC,title:SC};function CC(t){const i=t??{},o={...i.$defs??{},...i.definitions??{}},a=$=>{if(!$)return{};if(!$.$ref)return v($);const D=/^#\/(\$defs|definitions)\/(.+)$/.exec($.$ref);if(!D)return v($);const T=o[D[2]];return T?a({...T,...l($)}):v($)},f=new Set(["__proto__","constructor","prototype"]),S=$=>{if(!$)return{};const D={};for(const[T,g]of Object.entries($))f.has(T)||(D[T]=g);return D},v=$=>{if(!$.allOf||$.allOf.length===0)return $;const D={...$};delete D.allOf;for(const T of $.allOf){const g=a(T);Object.assign(D,{properties:{...S(D.properties),...S(g.properties)},required:EC([...D.required??[],...g.required??[]])}),!D.description&&g.description&&(D.description=g.description),D.default===void 0&&g.default!==void 0&&(D.default=g.default),!D.type&&g.type&&(D.type=g.type)}return D},l=$=>{const{$ref:D,...T}=$;return T},u=($,D)=>{let T=a($);for(const g of D){if(!T)return null;if(/^\d+$/.test(g)){const C=Array.isArray(T.items)?T.items[Number(g)]:T.items;T=C?a(C):null;continue}const k=T.properties;if(k&&!f.has(g)&&g in k){T=a(k[g]);continue}const w=T.additionalProperties;if(w&&typeof w=="object"){T=a(w);continue}return null}return T},p=($,D,T)=>{if(!$)return null;const g={};if($.description&&(g.description=$.description),$.type&&(g.type=$.type),$.default!==void 0&&(g.default=$.default),$.enum&&(g.enum=$.enum),$.const!==void 0&&(g.const=$.const),$.deprecated&&(g.deprecated=!0),$.examples&&(g.examples=$.examples),$.properties&&(g.knownChildren=Object.keys($.properties)),T&&(D!=null&&D.includes(T))&&(g.required=!0),$.items&&!Array.isArray($.items)){const k=a($.items),w=p(k,void 0,null);w&&(g.itemsInfo=w)}return($.additionalProperties===!0||typeof $.additionalProperties=="object")&&(g.open=!0),g},y=$=>D=>{if(D.length===0)return p(a($),void 0,null);const T=u($,D.slice(0,-1));if(!T)return null;const g=D[D.length-1],k=u(T,[g]);return p(k,T.required,g)},m=$=>{const D=a($);return Object.keys(D.properties??{})},x=$=>({at:y($),rootKeys:()=>m($),rootedAt:D=>{const T=u($,D);return x(T??{})}});return x(i)}function EC(t){return Array.from(new Set(t))}let ag=null;function am(){return ag||(ag=CC(kC)),ag}function Lg({checked:t,onChange:i,label:o,disabled:a}){return h.jsxs("label",{className:`inline-flex items-center gap-2 text-xs ${a?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[h.jsx("button",{type:"button",role:"switch","aria-checked":t,disabled:a,onClick:()=>!a&&i(!t),className:`relative w-7 h-4 rounded-full transition-colors ${t?"bg-accent":"bg-bg-hi border border-line"}`,children:h.jsx("span",{className:`absolute top-0.5 w-3 h-3 rounded-full bg-fg transition-transform ${t?"translate-x-3.5":"translate-x-0.5"}`})}),o&&h.jsx("span",{className:"text-fg-dim",children:o})]})}function TC(){const[t,i]=X.useState(null),[o,a]=X.useState(null),[f,S]=X.useState(null),[v,l]=X.useState(null),[u,p]=X.useState(!1),[y,m]=X.useState(null),[x,$]=X.useState(null);if(X.useEffect(()=>{let w=!1;return Promise.all([window.api.otel.getConfig(),window.api.otel.status(),window.api.otel.configPath()]).then(([C,P,j])=>{w||(i(C),S(C),a(P),l(j))}).catch(C=>{console.warn("[telemetry] load failed:",C==null?void 0:C.message)}),()=>{w=!0}},[]),!f||!t)return h.jsx(Dt,{title:"loading…"});const D=JSON.stringify(f)!==JSON.stringify(t),T=(w,C)=>{m(null),S({...f,[w]:C})},g=async()=>{p(!0),m(null);try{const w=await window.api.otel.setConfig(f);!w.ok&&w.error&&m(w.error),i(w.config),S(w.config),a(w.status),$(Date.now())}catch(w){m(w instanceof Error?w.message:String(w))}finally{p(!1)}},k=()=>{m(null),S(t)};return h.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[h.jsxs("header",{className:"space-y-1",children:[h.jsx("h2",{className:"text-fg text-base font-medium",children:"Telemetry — OpenTelemetry export"}),h.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"When enabled, every classified transcript event (tool_use, todo_write, plan, usage, agent_spawn) is mirrored as a 0-duration OTLP/HTTP span. Point this at a local collector (Jaeger, Grafana Tempo, SigNoz, Honeycomb) for cross-session analysis."}),v&&h.jsxs("p",{className:"text-fg-faint text-[11px]",children:["stored at ",h.jsx("span",{className:"font-mono",children:v})]})]}),h.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-fg",children:"Export transcripts to OTEL"}),h.jsx("div",{className:"text-fg-faint text-xs",children:"Toggle off to disable all span emission immediately."})]}),h.jsx(Lg,{checked:f.enabled,onChange:w=>T("enabled",w),label:f.enabled?"on":"off"})]}),h.jsxs("label",{className:"block space-y-1",children:[h.jsx("span",{className:"text-fg-dim text-xs",children:"OTLP/HTTP traces endpoint"}),h.jsx("input",{type:"text",value:f.endpoint,onChange:w=>T("endpoint",w.target.value),placeholder:"http://localhost:4318/v1/traces",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),h.jsxs("label",{className:"block space-y-1",children:[h.jsxs("span",{className:"text-fg-dim text-xs",children:["Headers (newline-separated ",h.jsx("span",{className:"font-mono",children:"Key: Value"}),")"]}),h.jsx("textarea",{value:f.headers,onChange:w=>T("headers",w.target.value),placeholder:"x-honeycomb-team: YOUR_API_KEY",rows:3,className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),h.jsxs("label",{className:"block space-y-1",children:[h.jsx("span",{className:"text-fg-dim text-xs",children:"Service name"}),h.jsx("input",{type:"text",value:f.serviceName,onChange:w=>T("serviceName",w.target.value),placeholder:"session-manager",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),h.jsxs("div",{className:"flex items-start justify-between gap-3 pt-1",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-fg",children:"Include content (PII)"}),h.jsxs("div",{className:"text-fg-faint text-xs leading-relaxed",children:["Adds tool inputs, plan text, and agent prompts to span attributes. Off by default — matches upstream Claude Code's ",h.jsx("span",{className:"font-mono",children:"OTEL_LOG_USER_PROMPTS"})," opt-in."]})]}),h.jsx(Lg,{checked:f.includeContent,onChange:w=>T("includeContent",w),label:f.includeContent?"on":"off"})]})]}),o&&h.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1",children:[h.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),h.jsxs("div",{children:[h.jsx("span",{className:"text-fg-faint",children:"enabled:"})," ",h.jsx("span",{className:o.enabled?"text-accent":"text-fg-dim",children:String(o.enabled)})]}),o.error&&h.jsxs("div",{className:"text-red-400 break-words",children:[h.jsx("span",{className:"text-fg-faint",children:"error:"})," ",o.error]}),!o.error&&o.enabled&&h.jsx("div",{className:"text-fg-faint",children:"spans batched and exported in the background. Verify by enabling and pointing at a local Jaeger."})]}),h.jsxs("footer",{className:"flex items-center gap-3 pt-2 border-t border-line",children:[h.jsx("button",{onClick:g,disabled:!D||u,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:u?"saving…":"Save"}),h.jsx("button",{onClick:k,disabled:!D||u,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg disabled:opacity-50 disabled:cursor-not-allowed",children:"Revert"}),y&&h.jsx("span",{className:"text-red-400 text-xs",children:y}),!y&&x&&!D&&h.jsx("span",{className:"text-fg-faint text-xs",children:"saved"})]})]})}function $C(){const t=Yr(),i=zt(I=>I.tabs),o=zt(I=>I.activeTabId),a=i.find(I=>I.id===o)??null,f=(a==null?void 0:a.cwd)??null,[S,v]=X.useState("user"),[l,u]=X.useState("effective"),p=X.useMemo(()=>{const I={};for(const U of Ju.scopes){const Y=Ju.resolve(U,t??"",f);Y&&(I[U]=Y)}return I},[t,f]),y=p[S]??null,m=Ct(I=>I.files),x=Ct(I=>I.loadJson),$=Ct(I=>I.setDraft),D=Ct(I=>I.saveJson),T=Ct(I=>I.revert),g=Ct(I=>I.watchFile),k=Ct(I=>I.unwatchFile);X.useEffect(()=>{const I=Object.values(p).filter(Boolean);return I.forEach(U=>{m[U]||x(U),g(U)}),()=>{I.forEach(U=>k(U))}},[JSON.stringify(p)]);const[w,C]=X.useState(null),P=X.useMemo(()=>fv(mv(m,p)),[m,p]),j=(I,U)=>{var ye;const Y=p[S];if(!Y)return;C(null);const se=((ye=m[Y])==null?void 0:ye.draftRaw)??"";let de={};if(se.trim())try{de=JSON.parse(se)}catch{de={}}const ie=_m(de,I,U);$(Y,JSON.stringify(ie,null,2)+`
|