clearhand 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +146 -0
  3. package/SECURITY.md +77 -0
  4. package/bin/clearhand.js +230 -0
  5. package/dist/mcp/index.js +159 -0
  6. package/dist/server/connectors/crawl.js +52 -0
  7. package/dist/server/connectors/github.js +45 -0
  8. package/dist/server/connectors/mailbox.js +257 -0
  9. package/dist/server/connectors/stripe.js +252 -0
  10. package/dist/server/context.js +83 -0
  11. package/dist/server/db/index.js +324 -0
  12. package/dist/server/demo.js +194 -0
  13. package/dist/server/index.js +51 -0
  14. package/dist/server/routes/api.js +704 -0
  15. package/dist/server/secrets/redaction.js +62 -0
  16. package/dist/server/secrets/store.js +238 -0
  17. package/dist/server/services/approval.js +206 -0
  18. package/dist/server/services/connections.js +99 -0
  19. package/dist/server/services/executor.js +417 -0
  20. package/dist/server/services/lint.js +129 -0
  21. package/dist/server/services/onboarding.js +168 -0
  22. package/dist/server/services/overlay.js +65 -0
  23. package/dist/server/trust/egress.js +12 -0
  24. package/dist/shared/actions.js +136 -0
  25. package/dist/shared/config.js +33 -0
  26. package/dist/shared/paths.js +34 -0
  27. package/package.json +73 -0
  28. package/public/assets/index-BicJ8AKo.css +1 -0
  29. package/public/assets/index-DZSNZW8-.js +43 -0
  30. package/public/index.html +17 -0
  31. package/templates/CLEARHAND.md +79 -0
  32. package/templates/overlay/escalation.md +21 -0
  33. package/templates/overlay/policies.md +30 -0
  34. package/templates/overlay/products.md +25 -0
  35. package/templates/overlay/tone-lint.json +14 -0
  36. package/templates/overlay/voice.md +24 -0
  37. package/templates/skills/clearhand-cs/SKILL.md +75 -0
  38. package/templates/skills/clearhand-onboard/SKILL.md +126 -0
@@ -0,0 +1,43 @@
1
+ var Sd=Object.defineProperty;var _d=(e,t,n)=>t in e?Sd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var il=(e,t,n)=>_d(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function Cd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xo={exports:{}},Hs={},Zo={exports:{}},O={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var $r=Symbol.for("react.element"),bd=Symbol.for("react.portal"),Ed=Symbol.for("react.fragment"),Pd=Symbol.for("react.strict_mode"),Ld=Symbol.for("react.profiler"),Md=Symbol.for("react.provider"),Td=Symbol.for("react.context"),$d=Symbol.for("react.forward_ref"),Rd=Symbol.for("react.suspense"),Fd=Symbol.for("react.memo"),Ad=Symbol.for("react.lazy"),Ca=Symbol.iterator;function zd(e){return e===null||typeof e!="object"?null:(e=Ca&&e[Ca]||e["@@iterator"],typeof e=="function"?e:null)}var qo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Jo=Object.assign,ec={};function Wn(e,t,n){this.props=e,this.context=t,this.refs=ec,this.updater=n||qo}Wn.prototype.isReactComponent={};Wn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Wn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function tc(){}tc.prototype=Wn.prototype;function Ei(e,t,n){this.props=e,this.context=t,this.refs=ec,this.updater=n||qo}var Pi=Ei.prototype=new tc;Pi.constructor=Ei;Jo(Pi,Wn.prototype);Pi.isPureReactComponent=!0;var ba=Array.isArray,nc=Object.prototype.hasOwnProperty,Li={current:null},rc={key:!0,ref:!0,__self:!0,__source:!0};function sc(e,t,n){var r,l={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)nc.call(t,r)&&!rc.hasOwnProperty(r)&&(l[r]=t[r]);var o=arguments.length-2;if(o===1)l.children=n;else if(1<o){for(var c=Array(o),u=0;u<o;u++)c[u]=arguments[u+2];l.children=c}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)l[r]===void 0&&(l[r]=o[r]);return{$$typeof:$r,type:e,key:i,ref:a,props:l,_owner:Li.current}}function Od(e,t){return{$$typeof:$r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Mi(e){return typeof e=="object"&&e!==null&&e.$$typeof===$r}function Id(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ea=/\/+/g;function al(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Id(""+e.key):t.toString(36)}function ns(e,t,n,r,l){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case $r:case bd:a=!0}}if(a)return a=e,l=l(a),e=r===""?"."+al(a,0):r,ba(l)?(n="",e!=null&&(n=e.replace(Ea,"$&/")+"/"),ns(l,t,n,"",function(u){return u})):l!=null&&(Mi(l)&&(l=Od(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(Ea,"$&/")+"/")+e)),t.push(l)),1;if(a=0,r=r===""?".":r+":",ba(e))for(var o=0;o<e.length;o++){i=e[o];var c=r+al(i,o);a+=ns(i,t,n,c,l)}else if(c=zd(e),typeof c=="function")for(e=c.call(e),o=0;!(i=e.next()).done;)i=i.value,c=r+al(i,o++),a+=ns(i,t,n,c,l);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Or(e,t,n){if(e==null)return e;var r=[],l=0;return ns(e,r,"","",function(i){return t.call(n,i,l++)}),r}function Dd(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Se={current:null},rs={transition:null},Hd={ReactCurrentDispatcher:Se,ReactCurrentBatchConfig:rs,ReactCurrentOwner:Li};function lc(){throw Error("act(...) is not supported in production builds of React.")}O.Children={map:Or,forEach:function(e,t,n){Or(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Or(e,function(){t++}),t},toArray:function(e){return Or(e,function(t){return t})||[]},only:function(e){if(!Mi(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};O.Component=Wn;O.Fragment=Ed;O.Profiler=Ld;O.PureComponent=Ei;O.StrictMode=Pd;O.Suspense=Rd;O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hd;O.act=lc;O.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Jo({},e.props),l=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Li.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(c in t)nc.call(t,c)&&!rc.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&o!==void 0?o[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){o=Array(c);for(var u=0;u<c;u++)o[u]=arguments[u+2];r.children=o}return{$$typeof:$r,type:e.type,key:l,ref:i,props:r,_owner:a}};O.createContext=function(e){return e={$$typeof:Td,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Md,_context:e},e.Consumer=e};O.createElement=sc;O.createFactory=function(e){var t=sc.bind(null,e);return t.type=e,t};O.createRef=function(){return{current:null}};O.forwardRef=function(e){return{$$typeof:$d,render:e}};O.isValidElement=Mi;O.lazy=function(e){return{$$typeof:Ad,_payload:{_status:-1,_result:e},_init:Dd}};O.memo=function(e,t){return{$$typeof:Fd,type:e,compare:t===void 0?null:t}};O.startTransition=function(e){var t=rs.transition;rs.transition={};try{e()}finally{rs.transition=t}};O.unstable_act=lc;O.useCallback=function(e,t){return Se.current.useCallback(e,t)};O.useContext=function(e){return Se.current.useContext(e)};O.useDebugValue=function(){};O.useDeferredValue=function(e){return Se.current.useDeferredValue(e)};O.useEffect=function(e,t){return Se.current.useEffect(e,t)};O.useId=function(){return Se.current.useId()};O.useImperativeHandle=function(e,t,n){return Se.current.useImperativeHandle(e,t,n)};O.useInsertionEffect=function(e,t){return Se.current.useInsertionEffect(e,t)};O.useLayoutEffect=function(e,t){return Se.current.useLayoutEffect(e,t)};O.useMemo=function(e,t){return Se.current.useMemo(e,t)};O.useReducer=function(e,t,n){return Se.current.useReducer(e,t,n)};O.useRef=function(e){return Se.current.useRef(e)};O.useState=function(e){return Se.current.useState(e)};O.useSyncExternalStore=function(e,t,n){return Se.current.useSyncExternalStore(e,t,n)};O.useTransition=function(){return Se.current.useTransition()};O.version="18.3.1";Zo.exports=O;var N=Zo.exports;const Ud=Cd(N);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Wd=N,Vd=Symbol.for("react.element"),Bd=Symbol.for("react.fragment"),Qd=Object.prototype.hasOwnProperty,Kd=Wd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Gd={key:!0,ref:!0,__self:!0,__source:!0};function ic(e,t,n){var r,l={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Qd.call(t,r)&&!Gd.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:Vd,type:e,key:i,ref:a,props:l,_owner:Kd.current}}Hs.Fragment=Bd;Hs.jsx=ic;Hs.jsxs=ic;Xo.exports=Hs;var s=Xo.exports,$l={},ac={exports:{}},Ie={},oc={exports:{}},cc={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(P,F){var A=P.length;P.push(F);e:for(;0<A;){var Y=A-1>>>1,se=P[Y];if(0<l(se,F))P[Y]=F,P[A]=se,A=Y;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var F=P[0],A=P.pop();if(A!==F){P[0]=A;e:for(var Y=0,se=P.length,Gt=se>>>1;Y<Gt;){var ft=2*(Y+1)-1,Qn=P[ft],pt=ft+1,Yt=P[pt];if(0>l(Qn,A))pt<se&&0>l(Yt,Qn)?(P[Y]=Yt,P[pt]=A,Y=pt):(P[Y]=Qn,P[ft]=A,Y=ft);else if(pt<se&&0>l(Yt,A))P[Y]=Yt,P[pt]=A,Y=pt;else break e}}return F}function l(P,F){var A=P.sortIndex-F.sortIndex;return A!==0?A:P.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var c=[],u=[],m=1,f=null,h=3,y=!1,v=!1,j=!1,_=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(P){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=P)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function k(P){if(j=!1,g(P),!v)if(n(c)!==null)v=!0,Ye(C);else{var F=n(u);F!==null&&xe(k,F.startTime-P)}}function C(P,F){v=!1,j&&(j=!1,p(x),x=-1),y=!0;var A=h;try{for(g(F),f=n(c);f!==null&&(!(f.expirationTime>F)||P&&!W());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,h=f.priorityLevel;var se=Y(f.expirationTime<=F);F=e.unstable_now(),typeof se=="function"?f.callback=se:f===n(c)&&r(c),g(F)}else r(c);f=n(c)}if(f!==null)var Gt=!0;else{var ft=n(u);ft!==null&&xe(k,ft.startTime-F),Gt=!1}return Gt}finally{f=null,h=A,y=!1}}var b=!1,w=null,x=-1,L=5,M=-1;function W(){return!(e.unstable_now()-M<L)}function ve(){if(w!==null){var P=e.unstable_now();M=P;var F=!0;try{F=w(!0,P)}finally{F?$():(b=!1,w=null)}}else b=!1}var $;if(typeof d=="function")$=function(){d(ve)};else if(typeof MessageChannel<"u"){var hn=new MessageChannel,mn=hn.port2;hn.port1.onmessage=ve,$=function(){mn.postMessage(null)}}else $=function(){_(ve,0)};function Ye(P){w=P,b||(b=!0,$())}function xe(P,F){x=_(function(){P(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_continueExecution=function(){v||y||(v=!0,Ye(C))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(P){switch(h){case 1:case 2:case 3:var F=3;break;default:F=h}var A=h;h=F;try{return P()}finally{h=A}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,F){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var A=h;h=P;try{return F()}finally{h=A}},e.unstable_scheduleCallback=function(P,F,A){var Y=e.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?Y+A:Y):A=Y,P){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=A+se,P={id:m++,callback:F,priorityLevel:P,startTime:A,expirationTime:se,sortIndex:-1},A>Y?(P.sortIndex=A,t(u,P),n(c)===null&&P===n(u)&&(j?(p(x),x=-1):j=!0,xe(k,A-Y))):(P.sortIndex=se,t(c,P),v||y||(v=!0,Ye(C))),P},e.unstable_shouldYield=W,e.unstable_wrapCallback=function(P){var F=h;return function(){var A=h;h=F;try{return P.apply(this,arguments)}finally{h=A}}}})(cc);oc.exports=cc;var Yd=oc.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Xd=N,ze=Yd;function S(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var uc=new Set,gr={};function fn(e,t){Fn(e,t),Fn(e+"Capture",t)}function Fn(e,t){for(gr[e]=t,e=0;e<t.length;e++)uc.add(t[e])}var jt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rl=Object.prototype.hasOwnProperty,Zd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Pa={},La={};function qd(e){return Rl.call(La,e)?!0:Rl.call(Pa,e)?!1:Zd.test(e)?La[e]=!0:(Pa[e]=!0,!1)}function Jd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ef(e,t,n,r){if(t===null||typeof t>"u"||Jd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _e(e,t,n,r,l,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var fe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){fe[e]=new _e(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];fe[t]=new _e(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){fe[e]=new _e(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){fe[e]=new _e(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){fe[e]=new _e(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){fe[e]=new _e(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){fe[e]=new _e(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){fe[e]=new _e(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){fe[e]=new _e(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ti=/[\-:]([a-z])/g;function $i(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ti,$i);fe[t]=new _e(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ti,$i);fe[t]=new _e(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ti,$i);fe[t]=new _e(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){fe[e]=new _e(e,1,!1,e.toLowerCase(),null,!1,!1)});fe.xlinkHref=new _e("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){fe[e]=new _e(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ri(e,t,n,r){var l=fe.hasOwnProperty(t)?fe[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(ef(t,n,l,r)&&(n=null),r||l===null?qd(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):l.mustUseProperty?e[l.propertyName]=n===null?l.type===3?!1:"":n:(t=l.attributeName,r=l.attributeNamespace,n===null?e.removeAttribute(t):(l=l.type,n=l===3||l===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var St=Xd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ir=Symbol.for("react.element"),yn=Symbol.for("react.portal"),vn=Symbol.for("react.fragment"),Fi=Symbol.for("react.strict_mode"),Fl=Symbol.for("react.profiler"),dc=Symbol.for("react.provider"),fc=Symbol.for("react.context"),Ai=Symbol.for("react.forward_ref"),Al=Symbol.for("react.suspense"),zl=Symbol.for("react.suspense_list"),zi=Symbol.for("react.memo"),Ct=Symbol.for("react.lazy"),pc=Symbol.for("react.offscreen"),Ma=Symbol.iterator;function Gn(e){return e===null||typeof e!="object"?null:(e=Ma&&e[Ma]||e["@@iterator"],typeof e=="function"?e:null)}var te=Object.assign,ol;function rr(e){if(ol===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ol=t&&t[1]||""}return`
34
+ `+ol+e}var cl=!1;function ul(e,t){if(!e||cl)return"";cl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var l=u.stack.split(`
35
+ `),i=r.stack.split(`
36
+ `),a=l.length-1,o=i.length-1;1<=a&&0<=o&&l[a]!==i[o];)o--;for(;1<=a&&0<=o;a--,o--)if(l[a]!==i[o]){if(a!==1||o!==1)do if(a--,o--,0>o||l[a]!==i[o]){var c=`
37
+ `+l[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=o);break}}}finally{cl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?rr(e):""}function tf(e){switch(e.tag){case 5:return rr(e.type);case 16:return rr("Lazy");case 13:return rr("Suspense");case 19:return rr("SuspenseList");case 0:case 2:case 15:return e=ul(e.type,!1),e;case 11:return e=ul(e.type.render,!1),e;case 1:return e=ul(e.type,!0),e;default:return""}}function Ol(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case vn:return"Fragment";case yn:return"Portal";case Fl:return"Profiler";case Fi:return"StrictMode";case Al:return"Suspense";case zl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fc:return(e.displayName||"Context")+".Consumer";case dc:return(e._context.displayName||"Context")+".Provider";case Ai:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case zi:return t=e.displayName||null,t!==null?t:Ol(e.type)||"Memo";case Ct:t=e._payload,e=e._init;try{return Ol(e(t))}catch{}}return null}function nf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ol(t);case 8:return t===Fi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ut(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rf(e){var t=hc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Dr(e){e._valueTracker||(e._valueTracker=rf(e))}function mc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=hc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function hs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Il(e,t){var n=t.checked;return te({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ta(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ut(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function gc(e,t){t=t.checked,t!=null&&Ri(e,"checked",t,!1)}function Dl(e,t){gc(e,t);var n=Ut(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Hl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Hl(e,t.type,Ut(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $a(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Hl(e,t,n){(t!=="number"||hs(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sr=Array.isArray;function Pn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ut(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,r&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function Ul(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(S(91));return te({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ra(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(S(92));if(sr(n)){if(1<n.length)throw Error(S(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ut(n)}}function yc(e,t){var n=Ut(t.value),r=Ut(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Fa(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function vc(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Wl(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?vc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Hr,xc=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,l){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,l)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Hr=Hr||document.createElement("div"),Hr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Hr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function yr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ar={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},sf=["Webkit","ms","Moz","O"];Object.keys(ar).forEach(function(e){sf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ar[t]=ar[e]})});function jc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ar.hasOwnProperty(e)&&ar[e]?(""+t).trim():t+"px"}function wc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=jc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var lf=te({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 Vl(e,t){if(t){if(lf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function Bl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ql=null;function Oi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Kl=null,Ln=null,Mn=null;function Aa(e){if(e=Ar(e)){if(typeof Kl!="function")throw Error(S(280));var t=e.stateNode;t&&(t=Qs(t),Kl(e.stateNode,e.type,t))}}function Nc(e){Ln?Mn?Mn.push(e):Mn=[e]:Ln=e}function kc(){if(Ln){var e=Ln,t=Mn;if(Mn=Ln=null,Aa(e),t)for(e=0;e<t.length;e++)Aa(t[e])}}function Sc(e,t){return e(t)}function _c(){}var dl=!1;function Cc(e,t,n){if(dl)return e(t,n);dl=!0;try{return Sc(e,t,n)}finally{dl=!1,(Ln!==null||Mn!==null)&&(_c(),kc())}}function vr(e,t){var n=e.stateNode;if(n===null)return null;var r=Qs(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(S(231,t,typeof n));return n}var Gl=!1;if(jt)try{var Yn={};Object.defineProperty(Yn,"passive",{get:function(){Gl=!0}}),window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch{Gl=!1}function af(e,t,n,r,l,i,a,o,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(m){this.onError(m)}}var or=!1,ms=null,gs=!1,Yl=null,of={onError:function(e){or=!0,ms=e}};function cf(e,t,n,r,l,i,a,o,c){or=!1,ms=null,af.apply(of,arguments)}function uf(e,t,n,r,l,i,a,o,c){if(cf.apply(this,arguments),or){if(or){var u=ms;or=!1,ms=null}else throw Error(S(198));gs||(gs=!0,Yl=u)}}function pn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function bc(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function za(e){if(pn(e)!==e)throw Error(S(188))}function df(e){var t=e.alternate;if(!t){if(t=pn(e),t===null)throw Error(S(188));return t!==e?null:e}for(var n=e,r=t;;){var l=n.return;if(l===null)break;var i=l.alternate;if(i===null){if(r=l.return,r!==null){n=r;continue}break}if(l.child===i.child){for(i=l.child;i;){if(i===n)return za(l),e;if(i===r)return za(l),t;i=i.sibling}throw Error(S(188))}if(n.return!==r.return)n=l,r=i;else{for(var a=!1,o=l.child;o;){if(o===n){a=!0,n=l,r=i;break}if(o===r){a=!0,r=l,n=i;break}o=o.sibling}if(!a){for(o=i.child;o;){if(o===n){a=!0,n=i,r=l;break}if(o===r){a=!0,r=i,n=l;break}o=o.sibling}if(!a)throw Error(S(189))}}if(n.alternate!==r)throw Error(S(190))}if(n.tag!==3)throw Error(S(188));return n.stateNode.current===n?e:t}function Ec(e){return e=df(e),e!==null?Pc(e):null}function Pc(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Pc(e);if(t!==null)return t;e=e.sibling}return null}var Lc=ze.unstable_scheduleCallback,Oa=ze.unstable_cancelCallback,ff=ze.unstable_shouldYield,pf=ze.unstable_requestPaint,re=ze.unstable_now,hf=ze.unstable_getCurrentPriorityLevel,Ii=ze.unstable_ImmediatePriority,Mc=ze.unstable_UserBlockingPriority,ys=ze.unstable_NormalPriority,mf=ze.unstable_LowPriority,Tc=ze.unstable_IdlePriority,Us=null,ct=null;function gf(e){if(ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(Us,e,void 0,(e.current.flags&128)===128)}catch{}}var tt=Math.clz32?Math.clz32:xf,yf=Math.log,vf=Math.LN2;function xf(e){return e>>>=0,e===0?32:31-(yf(e)/vf|0)|0}var Ur=64,Wr=4194304;function lr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function vs(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~l;o!==0?r=lr(o):(i&=a,i!==0&&(r=lr(i)))}else a=n&~l,a!==0?r=lr(a):i!==0&&(r=lr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-tt(t),l=1<<n,r|=e[n],t&=~l;return r}function jf(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function wf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-tt(i),o=1<<a,c=l[a];c===-1?(!(o&n)||o&r)&&(l[a]=jf(o,t)):c<=t&&(e.expiredLanes|=o),i&=~o}}function Xl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function $c(){var e=Ur;return Ur<<=1,!(Ur&4194240)&&(Ur=64),e}function fl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Rr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-tt(t),e[t]=n}function Nf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-tt(n),i=1<<l;t[l]=0,r[l]=-1,e[l]=-1,n&=~i}}function Di(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-tt(n),l=1<<r;l&t|e[r]&t&&(e[r]|=t),n&=~l}}var U=0;function Rc(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Fc,Hi,Ac,zc,Oc,Zl=!1,Vr=[],Rt=null,Ft=null,At=null,xr=new Map,jr=new Map,Pt=[],kf="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 Ia(e,t){switch(e){case"focusin":case"focusout":Rt=null;break;case"dragenter":case"dragleave":Ft=null;break;case"mouseover":case"mouseout":At=null;break;case"pointerover":case"pointerout":xr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":jr.delete(t.pointerId)}}function Xn(e,t,n,r,l,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[l]},t!==null&&(t=Ar(t),t!==null&&Hi(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Sf(e,t,n,r,l){switch(t){case"focusin":return Rt=Xn(Rt,e,t,n,r,l),!0;case"dragenter":return Ft=Xn(Ft,e,t,n,r,l),!0;case"mouseover":return At=Xn(At,e,t,n,r,l),!0;case"pointerover":var i=l.pointerId;return xr.set(i,Xn(xr.get(i)||null,e,t,n,r,l)),!0;case"gotpointercapture":return i=l.pointerId,jr.set(i,Xn(jr.get(i)||null,e,t,n,r,l)),!0}return!1}function Ic(e){var t=qt(e.target);if(t!==null){var n=pn(t);if(n!==null){if(t=n.tag,t===13){if(t=bc(n),t!==null){e.blockedOn=t,Oc(e.priority,function(){Ac(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ss(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ql(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ql=r,n.target.dispatchEvent(r),Ql=null}else return t=Ar(n),t!==null&&Hi(t),e.blockedOn=n,!1;t.shift()}return!0}function Da(e,t,n){ss(e)&&n.delete(t)}function _f(){Zl=!1,Rt!==null&&ss(Rt)&&(Rt=null),Ft!==null&&ss(Ft)&&(Ft=null),At!==null&&ss(At)&&(At=null),xr.forEach(Da),jr.forEach(Da)}function Zn(e,t){e.blockedOn===t&&(e.blockedOn=null,Zl||(Zl=!0,ze.unstable_scheduleCallback(ze.unstable_NormalPriority,_f)))}function wr(e){function t(l){return Zn(l,e)}if(0<Vr.length){Zn(Vr[0],e);for(var n=1;n<Vr.length;n++){var r=Vr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Rt!==null&&Zn(Rt,e),Ft!==null&&Zn(Ft,e),At!==null&&Zn(At,e),xr.forEach(t),jr.forEach(t),n=0;n<Pt.length;n++)r=Pt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Pt.length&&(n=Pt[0],n.blockedOn===null);)Ic(n),n.blockedOn===null&&Pt.shift()}var Tn=St.ReactCurrentBatchConfig,xs=!0;function Cf(e,t,n,r){var l=U,i=Tn.transition;Tn.transition=null;try{U=1,Ui(e,t,n,r)}finally{U=l,Tn.transition=i}}function bf(e,t,n,r){var l=U,i=Tn.transition;Tn.transition=null;try{U=4,Ui(e,t,n,r)}finally{U=l,Tn.transition=i}}function Ui(e,t,n,r){if(xs){var l=ql(e,t,n,r);if(l===null)Nl(e,t,r,js,n),Ia(e,r);else if(Sf(l,e,t,n,r))r.stopPropagation();else if(Ia(e,r),t&4&&-1<kf.indexOf(e)){for(;l!==null;){var i=Ar(l);if(i!==null&&Fc(i),i=ql(e,t,n,r),i===null&&Nl(e,t,r,js,n),i===l)break;l=i}l!==null&&r.stopPropagation()}else Nl(e,t,r,null,n)}}var js=null;function ql(e,t,n,r){if(js=null,e=Oi(r),e=qt(e),e!==null)if(t=pn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=bc(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return js=e,null}function Dc(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(hf()){case Ii:return 1;case Mc:return 4;case ys:case mf:return 16;case Tc:return 536870912;default:return 16}default:return 16}}var Mt=null,Wi=null,ls=null;function Hc(){if(ls)return ls;var e,t=Wi,n=t.length,r,l="value"in Mt?Mt.value:Mt.textContent,i=l.length;for(e=0;e<n&&t[e]===l[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===l[i-r];r++);return ls=l.slice(e,1<r?1-r:void 0)}function is(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Br(){return!0}function Ha(){return!1}function De(e){function t(n,r,l,i,a){this._reactName=n,this._targetInst=l,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Br:Ha,this.isPropagationStopped=Ha,this}return te(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Br)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Br)},persist:function(){},isPersistent:Br}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vi=De(Vn),Fr=te({},Vn,{view:0,detail:0}),Ef=De(Fr),pl,hl,qn,Ws=te({},Fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bi,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==qn&&(qn&&e.type==="mousemove"?(pl=e.screenX-qn.screenX,hl=e.screenY-qn.screenY):hl=pl=0,qn=e),pl)},movementY:function(e){return"movementY"in e?e.movementY:hl}}),Ua=De(Ws),Pf=te({},Ws,{dataTransfer:0}),Lf=De(Pf),Mf=te({},Fr,{relatedTarget:0}),ml=De(Mf),Tf=te({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0}),$f=De(Tf),Rf=te({},Vn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ff=De(Rf),Af=te({},Vn,{data:0}),Wa=De(Af),zf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Of={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"},If={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Df(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=If[e])?!!t[e]:!1}function Bi(){return Df}var Hf=te({},Fr,{key:function(e){if(e.key){var t=zf[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=is(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Of[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bi,charCode:function(e){return e.type==="keypress"?is(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?is(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Uf=De(Hf),Wf=te({},Ws,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Va=De(Wf),Vf=te({},Fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bi}),Bf=De(Vf),Qf=te({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kf=De(Qf),Gf=te({},Ws,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Yf=De(Gf),Xf=[9,13,27,32],Qi=jt&&"CompositionEvent"in window,cr=null;jt&&"documentMode"in document&&(cr=document.documentMode);var Zf=jt&&"TextEvent"in window&&!cr,Uc=jt&&(!Qi||cr&&8<cr&&11>=cr),Ba=" ",Qa=!1;function Wc(e,t){switch(e){case"keyup":return Xf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xn=!1;function qf(e,t){switch(e){case"compositionend":return Vc(t);case"keypress":return t.which!==32?null:(Qa=!0,Ba);case"textInput":return e=t.data,e===Ba&&Qa?null:e;default:return null}}function Jf(e,t){if(xn)return e==="compositionend"||!Qi&&Wc(e,t)?(e=Hc(),ls=Wi=Mt=null,xn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Uc&&t.locale!=="ko"?null:t.data;default:return null}}var ep={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 Ka(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ep[e.type]:t==="textarea"}function Bc(e,t,n,r){Nc(r),t=ws(t,"onChange"),0<t.length&&(n=new Vi("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ur=null,Nr=null;function tp(e){nu(e,0)}function Vs(e){var t=Nn(e);if(mc(t))return e}function np(e,t){if(e==="change")return t}var Qc=!1;if(jt){var gl;if(jt){var yl="oninput"in document;if(!yl){var Ga=document.createElement("div");Ga.setAttribute("oninput","return;"),yl=typeof Ga.oninput=="function"}gl=yl}else gl=!1;Qc=gl&&(!document.documentMode||9<document.documentMode)}function Ya(){ur&&(ur.detachEvent("onpropertychange",Kc),Nr=ur=null)}function Kc(e){if(e.propertyName==="value"&&Vs(Nr)){var t=[];Bc(t,Nr,e,Oi(e)),Cc(tp,t)}}function rp(e,t,n){e==="focusin"?(Ya(),ur=t,Nr=n,ur.attachEvent("onpropertychange",Kc)):e==="focusout"&&Ya()}function sp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vs(Nr)}function lp(e,t){if(e==="click")return Vs(t)}function ip(e,t){if(e==="input"||e==="change")return Vs(t)}function ap(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rt=typeof Object.is=="function"?Object.is:ap;function kr(e,t){if(rt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var l=n[r];if(!Rl.call(t,l)||!rt(e[l],t[l]))return!1}return!0}function Xa(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Za(e,t){var n=Xa(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Xa(n)}}function Gc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Gc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Yc(){for(var e=window,t=hs();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=hs(e.document)}return t}function Ki(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function op(e){var t=Yc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Gc(n.ownerDocument.documentElement,n)){if(r!==null&&Ki(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Za(n,i);var a=Za(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var cp=jt&&"documentMode"in document&&11>=document.documentMode,jn=null,Jl=null,dr=null,ei=!1;function qa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ei||jn==null||jn!==hs(r)||(r=jn,"selectionStart"in r&&Ki(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),dr&&kr(dr,r)||(dr=r,r=ws(Jl,"onSelect"),0<r.length&&(t=new Vi("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=jn)))}function Qr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wn={animationend:Qr("Animation","AnimationEnd"),animationiteration:Qr("Animation","AnimationIteration"),animationstart:Qr("Animation","AnimationStart"),transitionend:Qr("Transition","TransitionEnd")},vl={},Xc={};jt&&(Xc=document.createElement("div").style,"AnimationEvent"in window||(delete wn.animationend.animation,delete wn.animationiteration.animation,delete wn.animationstart.animation),"TransitionEvent"in window||delete wn.transitionend.transition);function Bs(e){if(vl[e])return vl[e];if(!wn[e])return e;var t=wn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xc)return vl[e]=t[n];return e}var Zc=Bs("animationend"),qc=Bs("animationiteration"),Jc=Bs("animationstart"),eu=Bs("transitionend"),tu=new Map,Ja="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 Bt(e,t){tu.set(e,t),fn(t,[e])}for(var xl=0;xl<Ja.length;xl++){var jl=Ja[xl],up=jl.toLowerCase(),dp=jl[0].toUpperCase()+jl.slice(1);Bt(up,"on"+dp)}Bt(Zc,"onAnimationEnd");Bt(qc,"onAnimationIteration");Bt(Jc,"onAnimationStart");Bt("dblclick","onDoubleClick");Bt("focusin","onFocus");Bt("focusout","onBlur");Bt(eu,"onTransitionEnd");Fn("onMouseEnter",["mouseout","mouseover"]);Fn("onMouseLeave",["mouseout","mouseover"]);Fn("onPointerEnter",["pointerout","pointerover"]);Fn("onPointerLeave",["pointerout","pointerover"]);fn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));fn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));fn("onBeforeInput",["compositionend","keypress","textInput","paste"]);fn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));fn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));fn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ir="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(" "),fp=new Set("cancel close invalid load scroll toggle".split(" ").concat(ir));function eo(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,uf(r,t,void 0,e),e.currentTarget=null}function nu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],l=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var o=r[a],c=o.instance,u=o.currentTarget;if(o=o.listener,c!==i&&l.isPropagationStopped())break e;eo(l,o,u),i=c}else for(a=0;a<r.length;a++){if(o=r[a],c=o.instance,u=o.currentTarget,o=o.listener,c!==i&&l.isPropagationStopped())break e;eo(l,o,u),i=c}}}if(gs)throw e=Yl,gs=!1,Yl=null,e}function K(e,t){var n=t[li];n===void 0&&(n=t[li]=new Set);var r=e+"__bubble";n.has(r)||(ru(t,e,2,!1),n.add(r))}function wl(e,t,n){var r=0;t&&(r|=4),ru(n,e,r,t)}var Kr="_reactListening"+Math.random().toString(36).slice(2);function Sr(e){if(!e[Kr]){e[Kr]=!0,uc.forEach(function(n){n!=="selectionchange"&&(fp.has(n)||wl(n,!1,e),wl(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kr]||(t[Kr]=!0,wl("selectionchange",!1,t))}}function ru(e,t,n,r){switch(Dc(t)){case 1:var l=Cf;break;case 4:l=bf;break;default:l=Ui}n=l.bind(null,t,n,e),l=void 0,!Gl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),r?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function Nl(e,t,n,r,l){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===l||o.nodeType===8&&o.parentNode===l)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===l||c.nodeType===8&&c.parentNode===l))return;a=a.return}for(;o!==null;){if(a=qt(o),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}o=o.parentNode}}r=r.return}Cc(function(){var u=i,m=Oi(n),f=[];e:{var h=tu.get(e);if(h!==void 0){var y=Vi,v=e;switch(e){case"keypress":if(is(n)===0)break e;case"keydown":case"keyup":y=Uf;break;case"focusin":v="focus",y=ml;break;case"focusout":v="blur",y=ml;break;case"beforeblur":case"afterblur":y=ml;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":y=Ua;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=Lf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=Bf;break;case Zc:case qc:case Jc:y=$f;break;case eu:y=Kf;break;case"scroll":y=Ef;break;case"wheel":y=Yf;break;case"copy":case"cut":case"paste":y=Ff;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Va}var j=(t&4)!==0,_=!j&&e==="scroll",p=j?h!==null?h+"Capture":null:h;j=[];for(var d=u,g;d!==null;){g=d;var k=g.stateNode;if(g.tag===5&&k!==null&&(g=k,p!==null&&(k=vr(d,p),k!=null&&j.push(_r(d,k,g)))),_)break;d=d.return}0<j.length&&(h=new y(h,v,null,n,m),f.push({event:h,listeners:j}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",h&&n!==Ql&&(v=n.relatedTarget||n.fromElement)&&(qt(v)||v[wt]))break e;if((y||h)&&(h=m.window===m?m:(h=m.ownerDocument)?h.defaultView||h.parentWindow:window,y?(v=n.relatedTarget||n.toElement,y=u,v=v?qt(v):null,v!==null&&(_=pn(v),v!==_||v.tag!==5&&v.tag!==6)&&(v=null)):(y=null,v=u),y!==v)){if(j=Ua,k="onMouseLeave",p="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(j=Va,k="onPointerLeave",p="onPointerEnter",d="pointer"),_=y==null?h:Nn(y),g=v==null?h:Nn(v),h=new j(k,d+"leave",y,n,m),h.target=_,h.relatedTarget=g,k=null,qt(m)===u&&(j=new j(p,d+"enter",v,n,m),j.target=g,j.relatedTarget=_,k=j),_=k,y&&v)t:{for(j=y,p=v,d=0,g=j;g;g=gn(g))d++;for(g=0,k=p;k;k=gn(k))g++;for(;0<d-g;)j=gn(j),d--;for(;0<g-d;)p=gn(p),g--;for(;d--;){if(j===p||p!==null&&j===p.alternate)break t;j=gn(j),p=gn(p)}j=null}else j=null;y!==null&&to(f,h,y,j,!1),v!==null&&_!==null&&to(f,_,v,j,!0)}}e:{if(h=u?Nn(u):window,y=h.nodeName&&h.nodeName.toLowerCase(),y==="select"||y==="input"&&h.type==="file")var C=np;else if(Ka(h))if(Qc)C=ip;else{C=sp;var b=rp}else(y=h.nodeName)&&y.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(C=lp);if(C&&(C=C(e,u))){Bc(f,C,n,m);break e}b&&b(e,h,u),e==="focusout"&&(b=h._wrapperState)&&b.controlled&&h.type==="number"&&Hl(h,"number",h.value)}switch(b=u?Nn(u):window,e){case"focusin":(Ka(b)||b.contentEditable==="true")&&(jn=b,Jl=u,dr=null);break;case"focusout":dr=Jl=jn=null;break;case"mousedown":ei=!0;break;case"contextmenu":case"mouseup":case"dragend":ei=!1,qa(f,n,m);break;case"selectionchange":if(cp)break;case"keydown":case"keyup":qa(f,n,m)}var w;if(Qi)e:{switch(e){case"compositionstart":var x="onCompositionStart";break e;case"compositionend":x="onCompositionEnd";break e;case"compositionupdate":x="onCompositionUpdate";break e}x=void 0}else xn?Wc(e,n)&&(x="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(x="onCompositionStart");x&&(Uc&&n.locale!=="ko"&&(xn||x!=="onCompositionStart"?x==="onCompositionEnd"&&xn&&(w=Hc()):(Mt=m,Wi="value"in Mt?Mt.value:Mt.textContent,xn=!0)),b=ws(u,x),0<b.length&&(x=new Wa(x,e,null,n,m),f.push({event:x,listeners:b}),w?x.data=w:(w=Vc(n),w!==null&&(x.data=w)))),(w=Zf?qf(e,n):Jf(e,n))&&(u=ws(u,"onBeforeInput"),0<u.length&&(m=new Wa("onBeforeInput","beforeinput",null,n,m),f.push({event:m,listeners:u}),m.data=w))}nu(f,t)})}function _r(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ws(e,t){for(var n=t+"Capture",r=[];e!==null;){var l=e,i=l.stateNode;l.tag===5&&i!==null&&(l=i,i=vr(e,n),i!=null&&r.unshift(_r(e,i,l)),i=vr(e,t),i!=null&&r.push(_r(e,i,l))),e=e.return}return r}function gn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function to(e,t,n,r,l){for(var i=t._reactName,a=[];n!==null&&n!==r;){var o=n,c=o.alternate,u=o.stateNode;if(c!==null&&c===r)break;o.tag===5&&u!==null&&(o=u,l?(c=vr(n,i),c!=null&&a.unshift(_r(n,c,o))):l||(c=vr(n,i),c!=null&&a.push(_r(n,c,o)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var pp=/\r\n?/g,hp=/\u0000|\uFFFD/g;function no(e){return(typeof e=="string"?e:""+e).replace(pp,`
38
+ `).replace(hp,"")}function Gr(e,t,n){if(t=no(t),no(e)!==t&&n)throw Error(S(425))}function Ns(){}var ti=null,ni=null;function ri(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var si=typeof setTimeout=="function"?setTimeout:void 0,mp=typeof clearTimeout=="function"?clearTimeout:void 0,ro=typeof Promise=="function"?Promise:void 0,gp=typeof queueMicrotask=="function"?queueMicrotask:typeof ro<"u"?function(e){return ro.resolve(null).then(e).catch(yp)}:si;function yp(e){setTimeout(function(){throw e})}function kl(e,t){var n=t,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(r===0){e.removeChild(l),wr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);wr(t)}function zt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function so(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Bn=Math.random().toString(36).slice(2),at="__reactFiber$"+Bn,Cr="__reactProps$"+Bn,wt="__reactContainer$"+Bn,li="__reactEvents$"+Bn,vp="__reactListeners$"+Bn,xp="__reactHandles$"+Bn;function qt(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[wt]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=so(e);e!==null;){if(n=e[at])return n;e=so(e)}return t}e=n,n=e.parentNode}return null}function Ar(e){return e=e[at]||e[wt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Nn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(S(33))}function Qs(e){return e[Cr]||null}var ii=[],kn=-1;function Qt(e){return{current:e}}function G(e){0>kn||(e.current=ii[kn],ii[kn]=null,kn--)}function B(e,t){kn++,ii[kn]=e.current,e.current=t}var Wt={},ge=Qt(Wt),Me=Qt(!1),rn=Wt;function An(e,t){var n=e.type.contextTypes;if(!n)return Wt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Te(e){return e=e.childContextTypes,e!=null}function ks(){G(Me),G(ge)}function lo(e,t,n){if(ge.current!==Wt)throw Error(S(168));B(ge,t),B(Me,n)}function su(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(S(108,nf(e)||"Unknown",l));return te({},n,r)}function Ss(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wt,rn=ge.current,B(ge,e),B(Me,Me.current),!0}function io(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=su(e,t,rn),r.__reactInternalMemoizedMergedChildContext=e,G(Me),G(ge),B(ge,e)):G(Me),B(Me,n)}var mt=null,Ks=!1,Sl=!1;function lu(e){mt===null?mt=[e]:mt.push(e)}function jp(e){Ks=!0,lu(e)}function Kt(){if(!Sl&&mt!==null){Sl=!0;var e=0,t=U;try{var n=mt;for(U=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}mt=null,Ks=!1}catch(l){throw mt!==null&&(mt=mt.slice(e+1)),Lc(Ii,Kt),l}finally{U=t,Sl=!1}}return null}var Sn=[],_n=0,_s=null,Cs=0,He=[],Ue=0,sn=null,gt=1,yt="";function Xt(e,t){Sn[_n++]=Cs,Sn[_n++]=_s,_s=e,Cs=t}function iu(e,t,n){He[Ue++]=gt,He[Ue++]=yt,He[Ue++]=sn,sn=e;var r=gt;e=yt;var l=32-tt(r)-1;r&=~(1<<l),n+=1;var i=32-tt(t)+l;if(30<i){var a=l-l%5;i=(r&(1<<a)-1).toString(32),r>>=a,l-=a,gt=1<<32-tt(t)+l|n<<l|r,yt=i+e}else gt=1<<i|n<<l|r,yt=e}function Gi(e){e.return!==null&&(Xt(e,1),iu(e,1,0))}function Yi(e){for(;e===_s;)_s=Sn[--_n],Sn[_n]=null,Cs=Sn[--_n],Sn[_n]=null;for(;e===sn;)sn=He[--Ue],He[Ue]=null,yt=He[--Ue],He[Ue]=null,gt=He[--Ue],He[Ue]=null}var Ae=null,Fe=null,X=!1,Je=null;function au(e,t){var n=We(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ao(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Ae=e,Fe=zt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ae=e,Fe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=sn!==null?{id:gt,overflow:yt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=We(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ae=e,Fe=null,!0):!1;default:return!1}}function ai(e){return(e.mode&1)!==0&&(e.flags&128)===0}function oi(e){if(X){var t=Fe;if(t){var n=t;if(!ao(e,t)){if(ai(e))throw Error(S(418));t=zt(n.nextSibling);var r=Ae;t&&ao(e,t)?au(r,n):(e.flags=e.flags&-4097|2,X=!1,Ae=e)}}else{if(ai(e))throw Error(S(418));e.flags=e.flags&-4097|2,X=!1,Ae=e}}}function oo(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ae=e}function Yr(e){if(e!==Ae)return!1;if(!X)return oo(e),X=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ri(e.type,e.memoizedProps)),t&&(t=Fe)){if(ai(e))throw ou(),Error(S(418));for(;t;)au(e,t),t=zt(t.nextSibling)}if(oo(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(S(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Fe=zt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Fe=null}}else Fe=Ae?zt(e.stateNode.nextSibling):null;return!0}function ou(){for(var e=Fe;e;)e=zt(e.nextSibling)}function zn(){Fe=Ae=null,X=!1}function Xi(e){Je===null?Je=[e]:Je.push(e)}var wp=St.ReactCurrentBatchConfig;function Jn(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(S(309));var r=n.stateNode}if(!r)throw Error(S(147,e));var l=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var o=l.refs;a===null?delete o[i]:o[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(S(284));if(!n._owner)throw Error(S(290,e))}return e}function Xr(e,t){throw e=Object.prototype.toString.call(t),Error(S(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function co(e){var t=e._init;return t(e._payload)}function cu(e){function t(p,d){if(e){var g=p.deletions;g===null?(p.deletions=[d],p.flags|=16):g.push(d)}}function n(p,d){if(!e)return null;for(;d!==null;)t(p,d),d=d.sibling;return null}function r(p,d){for(p=new Map;d!==null;)d.key!==null?p.set(d.key,d):p.set(d.index,d),d=d.sibling;return p}function l(p,d){return p=Ht(p,d),p.index=0,p.sibling=null,p}function i(p,d,g){return p.index=g,e?(g=p.alternate,g!==null?(g=g.index,g<d?(p.flags|=2,d):g):(p.flags|=2,d)):(p.flags|=1048576,d)}function a(p){return e&&p.alternate===null&&(p.flags|=2),p}function o(p,d,g,k){return d===null||d.tag!==6?(d=Ml(g,p.mode,k),d.return=p,d):(d=l(d,g),d.return=p,d)}function c(p,d,g,k){var C=g.type;return C===vn?m(p,d,g.props.children,k,g.key):d!==null&&(d.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ct&&co(C)===d.type)?(k=l(d,g.props),k.ref=Jn(p,d,g),k.return=p,k):(k=ps(g.type,g.key,g.props,null,p.mode,k),k.ref=Jn(p,d,g),k.return=p,k)}function u(p,d,g,k){return d===null||d.tag!==4||d.stateNode.containerInfo!==g.containerInfo||d.stateNode.implementation!==g.implementation?(d=Tl(g,p.mode,k),d.return=p,d):(d=l(d,g.children||[]),d.return=p,d)}function m(p,d,g,k,C){return d===null||d.tag!==7?(d=nn(g,p.mode,k,C),d.return=p,d):(d=l(d,g),d.return=p,d)}function f(p,d,g){if(typeof d=="string"&&d!==""||typeof d=="number")return d=Ml(""+d,p.mode,g),d.return=p,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Ir:return g=ps(d.type,d.key,d.props,null,p.mode,g),g.ref=Jn(p,null,d),g.return=p,g;case yn:return d=Tl(d,p.mode,g),d.return=p,d;case Ct:var k=d._init;return f(p,k(d._payload),g)}if(sr(d)||Gn(d))return d=nn(d,p.mode,g,null),d.return=p,d;Xr(p,d)}return null}function h(p,d,g,k){var C=d!==null?d.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return C!==null?null:o(p,d,""+g,k);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Ir:return g.key===C?c(p,d,g,k):null;case yn:return g.key===C?u(p,d,g,k):null;case Ct:return C=g._init,h(p,d,C(g._payload),k)}if(sr(g)||Gn(g))return C!==null?null:m(p,d,g,k,null);Xr(p,g)}return null}function y(p,d,g,k,C){if(typeof k=="string"&&k!==""||typeof k=="number")return p=p.get(g)||null,o(d,p,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Ir:return p=p.get(k.key===null?g:k.key)||null,c(d,p,k,C);case yn:return p=p.get(k.key===null?g:k.key)||null,u(d,p,k,C);case Ct:var b=k._init;return y(p,d,g,b(k._payload),C)}if(sr(k)||Gn(k))return p=p.get(g)||null,m(d,p,k,C,null);Xr(d,k)}return null}function v(p,d,g,k){for(var C=null,b=null,w=d,x=d=0,L=null;w!==null&&x<g.length;x++){w.index>x?(L=w,w=null):L=w.sibling;var M=h(p,w,g[x],k);if(M===null){w===null&&(w=L);break}e&&w&&M.alternate===null&&t(p,w),d=i(M,d,x),b===null?C=M:b.sibling=M,b=M,w=L}if(x===g.length)return n(p,w),X&&Xt(p,x),C;if(w===null){for(;x<g.length;x++)w=f(p,g[x],k),w!==null&&(d=i(w,d,x),b===null?C=w:b.sibling=w,b=w);return X&&Xt(p,x),C}for(w=r(p,w);x<g.length;x++)L=y(w,p,x,g[x],k),L!==null&&(e&&L.alternate!==null&&w.delete(L.key===null?x:L.key),d=i(L,d,x),b===null?C=L:b.sibling=L,b=L);return e&&w.forEach(function(W){return t(p,W)}),X&&Xt(p,x),C}function j(p,d,g,k){var C=Gn(g);if(typeof C!="function")throw Error(S(150));if(g=C.call(g),g==null)throw Error(S(151));for(var b=C=null,w=d,x=d=0,L=null,M=g.next();w!==null&&!M.done;x++,M=g.next()){w.index>x?(L=w,w=null):L=w.sibling;var W=h(p,w,M.value,k);if(W===null){w===null&&(w=L);break}e&&w&&W.alternate===null&&t(p,w),d=i(W,d,x),b===null?C=W:b.sibling=W,b=W,w=L}if(M.done)return n(p,w),X&&Xt(p,x),C;if(w===null){for(;!M.done;x++,M=g.next())M=f(p,M.value,k),M!==null&&(d=i(M,d,x),b===null?C=M:b.sibling=M,b=M);return X&&Xt(p,x),C}for(w=r(p,w);!M.done;x++,M=g.next())M=y(w,p,x,M.value,k),M!==null&&(e&&M.alternate!==null&&w.delete(M.key===null?x:M.key),d=i(M,d,x),b===null?C=M:b.sibling=M,b=M);return e&&w.forEach(function(ve){return t(p,ve)}),X&&Xt(p,x),C}function _(p,d,g,k){if(typeof g=="object"&&g!==null&&g.type===vn&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Ir:e:{for(var C=g.key,b=d;b!==null;){if(b.key===C){if(C=g.type,C===vn){if(b.tag===7){n(p,b.sibling),d=l(b,g.props.children),d.return=p,p=d;break e}}else if(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ct&&co(C)===b.type){n(p,b.sibling),d=l(b,g.props),d.ref=Jn(p,b,g),d.return=p,p=d;break e}n(p,b);break}else t(p,b);b=b.sibling}g.type===vn?(d=nn(g.props.children,p.mode,k,g.key),d.return=p,p=d):(k=ps(g.type,g.key,g.props,null,p.mode,k),k.ref=Jn(p,d,g),k.return=p,p=k)}return a(p);case yn:e:{for(b=g.key;d!==null;){if(d.key===b)if(d.tag===4&&d.stateNode.containerInfo===g.containerInfo&&d.stateNode.implementation===g.implementation){n(p,d.sibling),d=l(d,g.children||[]),d.return=p,p=d;break e}else{n(p,d);break}else t(p,d);d=d.sibling}d=Tl(g,p.mode,k),d.return=p,p=d}return a(p);case Ct:return b=g._init,_(p,d,b(g._payload),k)}if(sr(g))return v(p,d,g,k);if(Gn(g))return j(p,d,g,k);Xr(p,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,d!==null&&d.tag===6?(n(p,d.sibling),d=l(d,g),d.return=p,p=d):(n(p,d),d=Ml(g,p.mode,k),d.return=p,p=d),a(p)):n(p,d)}return _}var On=cu(!0),uu=cu(!1),bs=Qt(null),Es=null,Cn=null,Zi=null;function qi(){Zi=Cn=Es=null}function Ji(e){var t=bs.current;G(bs),e._currentValue=t}function ci(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function $n(e,t){Es=e,Zi=Cn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Le=!0),e.firstContext=null)}function Qe(e){var t=e._currentValue;if(Zi!==e)if(e={context:e,memoizedValue:t,next:null},Cn===null){if(Es===null)throw Error(S(308));Cn=e,Es.dependencies={lanes:0,firstContext:e}}else Cn=Cn.next=e;return t}var Jt=null;function ea(e){Jt===null?Jt=[e]:Jt.push(e)}function du(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ea(t)):(n.next=l.next,l.next=n),t.interleaved=n,Nt(e,r)}function Nt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var bt=!1;function ta(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function vt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ot(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,D&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Nt(e,n)}return l=r.interleaved,l===null?(t.next=t,ea(r)):(t.next=l.next,l.next=t),r.interleaved=t,Nt(e,n)}function as(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Di(e,n)}}function uo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ps(e,t,n,r){var l=e.updateQueue;bt=!1;var i=l.firstBaseUpdate,a=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var m=e.alternate;m!==null&&(m=m.updateQueue,o=m.lastBaseUpdate,o!==a&&(o===null?m.firstBaseUpdate=u:o.next=u,m.lastBaseUpdate=c))}if(i!==null){var f=l.baseState;a=0,m=u=c=null,o=i;do{var h=o.lane,y=o.eventTime;if((r&h)===h){m!==null&&(m=m.next={eventTime:y,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var v=e,j=o;switch(h=t,y=n,j.tag){case 1:if(v=j.payload,typeof v=="function"){f=v.call(y,f,h);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=j.payload,h=typeof v=="function"?v.call(y,f,h):v,h==null)break e;f=te({},f,h);break e;case 2:bt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[o]:h.push(o))}else y={eventTime:y,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},m===null?(u=m=y,c=f):m=m.next=y,a|=h;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;h=o,o=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(m===null&&(c=f),l.baseState=c,l.firstBaseUpdate=u,l.lastBaseUpdate=m,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);an|=a,e.lanes=a,e.memoizedState=f}}function fo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],l=r.callback;if(l!==null){if(r.callback=null,r=n,typeof l!="function")throw Error(S(191,l));l.call(r)}}}var zr={},ut=Qt(zr),br=Qt(zr),Er=Qt(zr);function en(e){if(e===zr)throw Error(S(174));return e}function na(e,t){switch(B(Er,t),B(br,e),B(ut,zr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Wl(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Wl(t,e)}G(ut),B(ut,t)}function In(){G(ut),G(br),G(Er)}function pu(e){en(Er.current);var t=en(ut.current),n=Wl(t,e.type);t!==n&&(B(br,e),B(ut,n))}function ra(e){br.current===e&&(G(ut),G(br))}var J=Qt(0);function Ls(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _l=[];function sa(){for(var e=0;e<_l.length;e++)_l[e]._workInProgressVersionPrimary=null;_l.length=0}var os=St.ReactCurrentDispatcher,Cl=St.ReactCurrentBatchConfig,ln=0,ee=null,ie=null,oe=null,Ms=!1,fr=!1,Pr=0,Np=0;function pe(){throw Error(S(321))}function la(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!rt(e[n],t[n]))return!1;return!0}function ia(e,t,n,r,l,i){if(ln=i,ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,os.current=e===null||e.memoizedState===null?Cp:bp,e=n(r,l),fr){i=0;do{if(fr=!1,Pr=0,25<=i)throw Error(S(301));i+=1,oe=ie=null,t.updateQueue=null,os.current=Ep,e=n(r,l)}while(fr)}if(os.current=Ts,t=ie!==null&&ie.next!==null,ln=0,oe=ie=ee=null,Ms=!1,t)throw Error(S(300));return e}function aa(){var e=Pr!==0;return Pr=0,e}function it(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oe===null?ee.memoizedState=oe=e:oe=oe.next=e,oe}function Ke(){if(ie===null){var e=ee.alternate;e=e!==null?e.memoizedState:null}else e=ie.next;var t=oe===null?ee.memoizedState:oe.next;if(t!==null)oe=t,ie=e;else{if(e===null)throw Error(S(310));ie=e,e={memoizedState:ie.memoizedState,baseState:ie.baseState,baseQueue:ie.baseQueue,queue:ie.queue,next:null},oe===null?ee.memoizedState=oe=e:oe=oe.next=e}return oe}function Lr(e,t){return typeof t=="function"?t(e):t}function bl(e){var t=Ke(),n=t.queue;if(n===null)throw Error(S(311));n.lastRenderedReducer=e;var r=ie,l=r.baseQueue,i=n.pending;if(i!==null){if(l!==null){var a=l.next;l.next=i.next,i.next=a}r.baseQueue=l=i,n.pending=null}if(l!==null){i=l.next,r=r.baseState;var o=a=null,c=null,u=i;do{var m=u.lane;if((ln&m)===m)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:m,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(o=c=f,a=r):c=c.next=f,ee.lanes|=m,an|=m}u=u.next}while(u!==null&&u!==i);c===null?a=r:c.next=o,rt(r,t.memoizedState)||(Le=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){l=e;do i=l.lane,ee.lanes|=i,an|=i,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function El(e){var t=Ke(),n=t.queue;if(n===null)throw Error(S(311));n.lastRenderedReducer=e;var r=n.dispatch,l=n.pending,i=t.memoizedState;if(l!==null){n.pending=null;var a=l=l.next;do i=e(i,a.action),a=a.next;while(a!==l);rt(i,t.memoizedState)||(Le=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function hu(){}function mu(e,t){var n=ee,r=Ke(),l=t(),i=!rt(r.memoizedState,l);if(i&&(r.memoizedState=l,Le=!0),r=r.queue,oa(vu.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||oe!==null&&oe.memoizedState.tag&1){if(n.flags|=2048,Mr(9,yu.bind(null,n,r,l,t),void 0,null),ce===null)throw Error(S(349));ln&30||gu(n,t,l)}return l}function gu(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ee.updateQueue,t===null?(t={lastEffect:null,stores:null},ee.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function yu(e,t,n,r){t.value=n,t.getSnapshot=r,xu(t)&&ju(e)}function vu(e,t,n){return n(function(){xu(t)&&ju(e)})}function xu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!rt(e,n)}catch{return!0}}function ju(e){var t=Nt(e,1);t!==null&&nt(t,e,1,-1)}function po(e){var t=it();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:e},t.queue=e,e=e.dispatch=_p.bind(null,ee,e),[t.memoizedState,e]}function Mr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ee.updateQueue,t===null?(t={lastEffect:null,stores:null},ee.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function wu(){return Ke().memoizedState}function cs(e,t,n,r){var l=it();ee.flags|=e,l.memoizedState=Mr(1|t,n,void 0,r===void 0?null:r)}function Gs(e,t,n,r){var l=Ke();r=r===void 0?null:r;var i=void 0;if(ie!==null){var a=ie.memoizedState;if(i=a.destroy,r!==null&&la(r,a.deps)){l.memoizedState=Mr(t,n,i,r);return}}ee.flags|=e,l.memoizedState=Mr(1|t,n,i,r)}function ho(e,t){return cs(8390656,8,e,t)}function oa(e,t){return Gs(2048,8,e,t)}function Nu(e,t){return Gs(4,2,e,t)}function ku(e,t){return Gs(4,4,e,t)}function Su(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _u(e,t,n){return n=n!=null?n.concat([e]):null,Gs(4,4,Su.bind(null,t,e),n)}function ca(){}function Cu(e,t){var n=Ke();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&la(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bu(e,t){var n=Ke();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&la(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Eu(e,t,n){return ln&21?(rt(n,t)||(n=$c(),ee.lanes|=n,an|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Le=!0),e.memoizedState=n)}function kp(e,t){var n=U;U=n!==0&&4>n?n:4,e(!0);var r=Cl.transition;Cl.transition={};try{e(!1),t()}finally{U=n,Cl.transition=r}}function Pu(){return Ke().memoizedState}function Sp(e,t,n){var r=Dt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Lu(e))Mu(t,n);else if(n=du(e,t,n,r),n!==null){var l=ke();nt(n,e,r,l),Tu(n,t,r)}}function _p(e,t,n){var r=Dt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Lu(e))Mu(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(l.hasEagerState=!0,l.eagerState=o,rt(o,a)){var c=t.interleaved;c===null?(l.next=l,ea(t)):(l.next=c.next,c.next=l),t.interleaved=l;return}}catch{}finally{}n=du(e,t,l,r),n!==null&&(l=ke(),nt(n,e,r,l),Tu(n,t,r))}}function Lu(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function Mu(e,t){fr=Ms=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Tu(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Di(e,n)}}var Ts={readContext:Qe,useCallback:pe,useContext:pe,useEffect:pe,useImperativeHandle:pe,useInsertionEffect:pe,useLayoutEffect:pe,useMemo:pe,useReducer:pe,useRef:pe,useState:pe,useDebugValue:pe,useDeferredValue:pe,useTransition:pe,useMutableSource:pe,useSyncExternalStore:pe,useId:pe,unstable_isNewReconciler:!1},Cp={readContext:Qe,useCallback:function(e,t){return it().memoizedState=[e,t===void 0?null:t],e},useContext:Qe,useEffect:ho,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,cs(4194308,4,Su.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){return cs(4,2,e,t)},useMemo:function(e,t){var n=it();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=it();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Sp.bind(null,ee,e),[r.memoizedState,e]},useRef:function(e){var t=it();return e={current:e},t.memoizedState=e},useState:po,useDebugValue:ca,useDeferredValue:function(e){return it().memoizedState=e},useTransition:function(){var e=po(!1),t=e[0];return e=kp.bind(null,e[1]),it().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ee,l=it();if(X){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),ce===null)throw Error(S(349));ln&30||gu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,ho(vu.bind(null,r,i,e),[e]),r.flags|=2048,Mr(9,yu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=it(),t=ce.identifierPrefix;if(X){var n=yt,r=gt;n=(r&~(1<<32-tt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Pr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Np++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},bp={readContext:Qe,useCallback:Cu,useContext:Qe,useEffect:oa,useImperativeHandle:_u,useInsertionEffect:Nu,useLayoutEffect:ku,useMemo:bu,useReducer:bl,useRef:wu,useState:function(){return bl(Lr)},useDebugValue:ca,useDeferredValue:function(e){var t=Ke();return Eu(t,ie.memoizedState,e)},useTransition:function(){var e=bl(Lr)[0],t=Ke().memoizedState;return[e,t]},useMutableSource:hu,useSyncExternalStore:mu,useId:Pu,unstable_isNewReconciler:!1},Ep={readContext:Qe,useCallback:Cu,useContext:Qe,useEffect:oa,useImperativeHandle:_u,useInsertionEffect:Nu,useLayoutEffect:ku,useMemo:bu,useReducer:El,useRef:wu,useState:function(){return El(Lr)},useDebugValue:ca,useDeferredValue:function(e){var t=Ke();return ie===null?t.memoizedState=e:Eu(t,ie.memoizedState,e)},useTransition:function(){var e=El(Lr)[0],t=Ke().memoizedState;return[e,t]},useMutableSource:hu,useSyncExternalStore:mu,useId:Pu,unstable_isNewReconciler:!1};function Ze(e,t){if(e&&e.defaultProps){t=te({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ui(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:te({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ys={isMounted:function(e){return(e=e._reactInternals)?pn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ke(),l=Dt(e),i=vt(r,l);i.payload=t,n!=null&&(i.callback=n),t=Ot(e,i,l),t!==null&&(nt(t,e,l,r),as(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ke(),l=Dt(e),i=vt(r,l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ot(e,i,l),t!==null&&(nt(t,e,l,r),as(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ke(),r=Dt(e),l=vt(n,r);l.tag=2,t!=null&&(l.callback=t),t=Ot(e,l,r),t!==null&&(nt(t,e,r,n),as(t,e,r))}};function mo(e,t,n,r,l,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!kr(n,r)||!kr(l,i):!0}function $u(e,t,n){var r=!1,l=Wt,i=t.contextType;return typeof i=="object"&&i!==null?i=Qe(i):(l=Te(t)?rn:ge.current,r=t.contextTypes,i=(r=r!=null)?An(e,l):Wt),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ys,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=i),t}function go(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ys.enqueueReplaceState(t,t.state,null)}function di(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},ta(e);var i=t.contextType;typeof i=="object"&&i!==null?l.context=Qe(i):(i=Te(t)?rn:ge.current,l.context=An(e,i)),l.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(ui(e,t,i,n),l.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(t=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),t!==l.state&&Ys.enqueueReplaceState(l,l.state,null),Ps(e,n,l,r),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Dn(e,t){try{var n="",r=t;do n+=tf(r),r=r.return;while(r);var l=n}catch(i){l=`
39
+ Error generating stack: `+i.message+`
40
+ `+i.stack}return{value:e,source:t,stack:l,digest:null}}function Pl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function fi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Pp=typeof WeakMap=="function"?WeakMap:Map;function Ru(e,t,n){n=vt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Rs||(Rs=!0,Ni=r),fi(e,t)},n}function Fu(e,t,n){n=vt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){fi(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){fi(e,t),typeof r!="function"&&(It===null?It=new Set([this]):It.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function yo(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Pp;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Wp.bind(null,e,t,n),t.then(e,e))}function vo(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function xo(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=vt(-1,1),t.tag=2,Ot(n,t,1))),n.lanes|=1),e)}var Lp=St.ReactCurrentOwner,Le=!1;function Ne(e,t,n,r){t.child=e===null?uu(t,null,n,r):On(t,e.child,n,r)}function jo(e,t,n,r,l){n=n.render;var i=t.ref;return $n(t,l),r=ia(e,t,n,r,i,l),n=aa(),e!==null&&!Le?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,kt(e,t,l)):(X&&n&&Gi(t),t.flags|=1,Ne(e,t,r,l),t.child)}function wo(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!ya(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Au(e,t,i,r,l)):(e=ps(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:kr,n(a,r)&&e.ref===t.ref)return kt(e,t,l)}return t.flags|=1,e=Ht(i,r),e.ref=t.ref,e.return=t,t.child=e}function Au(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(kr(i,r)&&e.ref===t.ref)if(Le=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(Le=!0);else return t.lanes=e.lanes,kt(e,t,l)}return pi(e,t,n,r,l)}function zu(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},B(En,Re),Re|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,B(En,Re),Re|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,B(En,Re),Re|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,B(En,Re),Re|=r;return Ne(e,t,l,n),t.child}function Ou(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function pi(e,t,n,r,l){var i=Te(n)?rn:ge.current;return i=An(t,i),$n(t,l),n=ia(e,t,n,r,i,l),r=aa(),e!==null&&!Le?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,kt(e,t,l)):(X&&r&&Gi(t),t.flags|=1,Ne(e,t,n,l),t.child)}function No(e,t,n,r,l){if(Te(n)){var i=!0;Ss(t)}else i=!1;if($n(t,l),t.stateNode===null)us(e,t),$u(t,n,r),di(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=Qe(u):(u=Te(n)?rn:ge.current,u=An(t,u));var m=n.getDerivedStateFromProps,f=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||c!==u)&&go(t,a,r,u),bt=!1;var h=t.memoizedState;a.state=h,Ps(t,r,a,l),c=t.memoizedState,o!==r||h!==c||Me.current||bt?(typeof m=="function"&&(ui(t,n,m,r),c=t.memoizedState),(o=bt||mo(t,n,o,r,h,c,u))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,fu(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:Ze(t.type,o),a.props=u,f=t.pendingProps,h=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Qe(c):(c=Te(n)?rn:ge.current,c=An(t,c));var y=n.getDerivedStateFromProps;(m=typeof y=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==f||h!==c)&&go(t,a,r,c),bt=!1,h=t.memoizedState,a.state=h,Ps(t,r,a,l);var v=t.memoizedState;o!==f||h!==v||Me.current||bt?(typeof y=="function"&&(ui(t,n,y,r),v=t.memoizedState),(u=bt||mo(t,n,u,r,h,v,c)||!1)?(m||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,v,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,v,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),a.props=r,a.state=v,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return hi(e,t,n,r,i,l)}function hi(e,t,n,r,l,i){Ou(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&io(t,n,!1),kt(e,t,i);r=t.stateNode,Lp.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=On(t,e.child,null,i),t.child=On(t,null,o,i)):Ne(e,t,o,i),t.memoizedState=r.state,l&&io(t,n,!0),t.child}function Iu(e){var t=e.stateNode;t.pendingContext?lo(e,t.pendingContext,t.pendingContext!==t.context):t.context&&lo(e,t.context,!1),na(e,t.containerInfo)}function ko(e,t,n,r,l){return zn(),Xi(l),t.flags|=256,Ne(e,t,n,r),t.child}var mi={dehydrated:null,treeContext:null,retryLane:0};function gi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Du(e,t,n){var r=t.pendingProps,l=J.current,i=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(l&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),B(J,l&1),e===null)return oi(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=qs(a,r,0,null),e=nn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=gi(n),t.memoizedState=mi,e):ua(t,a));if(l=e.memoizedState,l!==null&&(o=l.dehydrated,o!==null))return Mp(e,t,a,r,o,l,n);if(i){i=r.fallback,a=t.mode,l=e.child,o=l.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Ht(l,c),r.subtreeFlags=l.subtreeFlags&14680064),o!==null?i=Ht(o,i):(i=nn(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?gi(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=mi,r}return i=e.child,e=i.sibling,r=Ht(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ua(e,t){return t=qs({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Zr(e,t,n,r){return r!==null&&Xi(r),On(t,e.child,null,n),e=ua(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Mp(e,t,n,r,l,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Pl(Error(S(422))),Zr(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=qs({mode:"visible",children:r.children},l,0,null),i=nn(i,l,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&On(t,e.child,null,a),t.child.memoizedState=gi(a),t.memoizedState=mi,i);if(!(t.mode&1))return Zr(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(S(419)),r=Pl(i,r,void 0),Zr(e,t,a,r)}if(o=(a&e.childLanes)!==0,Le||o){if(r=ce,r!==null){switch(a&-a){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&(r.suspendedLanes|a)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,Nt(e,l),nt(r,e,l,-1))}return ga(),r=Pl(Error(S(421))),Zr(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Vp.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,Fe=zt(l.nextSibling),Ae=t,X=!0,Je=null,e!==null&&(He[Ue++]=gt,He[Ue++]=yt,He[Ue++]=sn,gt=e.id,yt=e.overflow,sn=t),t=ua(t,r.children),t.flags|=4096,t)}function So(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ci(e.return,t,n)}function Ll(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function Hu(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(Ne(e,t,r.children,n),r=J.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&So(e,n,t);else if(e.tag===19)So(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(B(J,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Ls(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Ll(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Ls(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Ll(t,!0,n,null,i);break;case"together":Ll(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function us(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function kt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),an|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(S(153));if(t.child!==null){for(e=t.child,n=Ht(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ht(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tp(e,t,n){switch(t.tag){case 3:Iu(t),zn();break;case 5:pu(t);break;case 1:Te(t.type)&&Ss(t);break;case 4:na(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;B(bs,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(B(J,J.current&1),t.flags|=128,null):n&t.child.childLanes?Du(e,t,n):(B(J,J.current&1),e=kt(e,t,n),e!==null?e.sibling:null);B(J,J.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Hu(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),B(J,J.current),r)break;return null;case 22:case 23:return t.lanes=0,zu(e,t,n)}return kt(e,t,n)}var Uu,yi,Wu,Vu;Uu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};yi=function(){};Wu=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,en(ut.current);var i=null;switch(n){case"input":l=Il(e,l),r=Il(e,r),i=[];break;case"select":l=te({},l,{value:void 0}),r=te({},r,{value:void 0}),i=[];break;case"textarea":l=Ul(e,l),r=Ul(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ns)}Vl(n,r);var a;n=null;for(u in l)if(!r.hasOwnProperty(u)&&l.hasOwnProperty(u)&&l[u]!=null)if(u==="style"){var o=l[u];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(gr.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(o=l!=null?l[u]:void 0,r.hasOwnProperty(u)&&c!==o&&(c!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&o[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,o=o?o.__html:void 0,c!=null&&o!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(gr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&K("scroll",e),i||o===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Vu=function(e,t,n,r){n!==r&&(t.flags|=4)};function er(e,t){if(!X)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function he(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function $p(e,t,n){var r=t.pendingProps;switch(Yi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return he(t),null;case 1:return Te(t.type)&&ks(),he(t),null;case 3:return r=t.stateNode,In(),G(Me),G(ge),sa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Je!==null&&(_i(Je),Je=null))),yi(e,t),he(t),null;case 5:ra(t);var l=en(Er.current);if(n=t.type,e!==null&&t.stateNode!=null)Wu(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(S(166));return he(t),null}if(e=en(ut.current),Yr(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[at]=t,r[Cr]=i,e=(t.mode&1)!==0,n){case"dialog":K("cancel",r),K("close",r);break;case"iframe":case"object":case"embed":K("load",r);break;case"video":case"audio":for(l=0;l<ir.length;l++)K(ir[l],r);break;case"source":K("error",r);break;case"img":case"image":case"link":K("error",r),K("load",r);break;case"details":K("toggle",r);break;case"input":Ta(r,i),K("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},K("invalid",r);break;case"textarea":Ra(r,i),K("invalid",r)}Vl(n,i),l=null;for(var a in i)if(i.hasOwnProperty(a)){var o=i[a];a==="children"?typeof o=="string"?r.textContent!==o&&(i.suppressHydrationWarning!==!0&&Gr(r.textContent,o,e),l=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&Gr(r.textContent,o,e),l=["children",""+o]):gr.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&K("scroll",r)}switch(n){case"input":Dr(r),$a(r,i,!0);break;case"textarea":Dr(r),Fa(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Ns)}r=l,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=vc(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[at]=t,e[Cr]=r,Uu(e,t,!1,!1),t.stateNode=e;e:{switch(a=Bl(n,r),n){case"dialog":K("cancel",e),K("close",e),l=r;break;case"iframe":case"object":case"embed":K("load",e),l=r;break;case"video":case"audio":for(l=0;l<ir.length;l++)K(ir[l],e);l=r;break;case"source":K("error",e),l=r;break;case"img":case"image":case"link":K("error",e),K("load",e),l=r;break;case"details":K("toggle",e),l=r;break;case"input":Ta(e,r),l=Il(e,r),K("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=te({},r,{value:void 0}),K("invalid",e);break;case"textarea":Ra(e,r),l=Ul(e,r),K("invalid",e);break;default:l=r}Vl(n,l),o=l;for(i in o)if(o.hasOwnProperty(i)){var c=o[i];i==="style"?wc(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&xc(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&yr(e,c):typeof c=="number"&&yr(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(gr.hasOwnProperty(i)?c!=null&&i==="onScroll"&&K("scroll",e):c!=null&&Ri(e,i,c,a))}switch(n){case"input":Dr(e),$a(e,r,!1);break;case"textarea":Dr(e),Fa(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ut(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Pn(e,!!r.multiple,i,!1):r.defaultValue!=null&&Pn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Ns)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return he(t),null;case 6:if(e&&t.stateNode!=null)Vu(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(S(166));if(n=en(Er.current),en(ut.current),Yr(t)){if(r=t.stateNode,n=t.memoizedProps,r[at]=t,(i=r.nodeValue!==n)&&(e=Ae,e!==null))switch(e.tag){case 3:Gr(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Gr(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[at]=t,t.stateNode=r}return he(t),null;case 13:if(G(J),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(X&&Fe!==null&&t.mode&1&&!(t.flags&128))ou(),zn(),t.flags|=98560,i=!1;else if(i=Yr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(S(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(S(317));i[at]=t}else zn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;he(t),i=!1}else Je!==null&&(_i(Je),Je=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||J.current&1?ae===0&&(ae=3):ga())),t.updateQueue!==null&&(t.flags|=4),he(t),null);case 4:return In(),yi(e,t),e===null&&Sr(t.stateNode.containerInfo),he(t),null;case 10:return Ji(t.type._context),he(t),null;case 17:return Te(t.type)&&ks(),he(t),null;case 19:if(G(J),i=t.memoizedState,i===null)return he(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)er(i,!1);else{if(ae!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ls(e),a!==null){for(t.flags|=128,er(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return B(J,J.current&1|2),t.child}e=e.sibling}i.tail!==null&&re()>Hn&&(t.flags|=128,r=!0,er(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ls(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),er(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!X)return he(t),null}else 2*re()-i.renderingStartTime>Hn&&n!==1073741824&&(t.flags|=128,r=!0,er(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=re(),t.sibling=null,n=J.current,B(J,r?n&1|2:n&1),t):(he(t),null);case 22:case 23:return ma(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Re&1073741824&&(he(t),t.subtreeFlags&6&&(t.flags|=8192)):he(t),null;case 24:return null;case 25:return null}throw Error(S(156,t.tag))}function Rp(e,t){switch(Yi(t),t.tag){case 1:return Te(t.type)&&ks(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return In(),G(Me),G(ge),sa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ra(t),null;case 13:if(G(J),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));zn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return G(J),null;case 4:return In(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return ma(),null;case 24:return null;default:return null}}var qr=!1,me=!1,Fp=typeof WeakSet=="function"?WeakSet:Set,T=null;function bn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ne(e,t,r)}else n.current=null}function vi(e,t,n){try{n()}catch(r){ne(e,t,r)}}var _o=!1;function Ap(e,t){if(ti=xs,e=Yc(),Ki(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,m=0,f=e,h=null;t:for(;;){for(var y;f!==n||l!==0&&f.nodeType!==3||(o=a+l),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(y=f.firstChild)!==null;)h=f,f=y;for(;;){if(f===e)break t;if(h===n&&++u===l&&(o=a),h===i&&++m===r&&(c=a),(y=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=y}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ni={focusedElem:e,selectionRange:n},xs=!1,T=t;T!==null;)if(t=T,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,T=e;else for(;T!==null;){t=T;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var j=v.memoizedProps,_=v.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?j:Ze(t.type,j),_);p.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(S(163))}}catch(k){ne(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,T=e;break}T=t.return}return v=_o,_o=!1,v}function pr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&vi(t,n,i)}l=l.next}while(l!==r)}}function Xs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function xi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Bu(e){var t=e.alternate;t!==null&&(e.alternate=null,Bu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[at],delete t[Cr],delete t[li],delete t[vp],delete t[xp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Qu(e){return e.tag===5||e.tag===3||e.tag===4}function Co(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ji(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ns));else if(r!==4&&(e=e.child,e!==null))for(ji(e,t,n),e=e.sibling;e!==null;)ji(e,t,n),e=e.sibling}function wi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wi(e,t,n),e=e.sibling;e!==null;)wi(e,t,n),e=e.sibling}var ue=null,qe=!1;function _t(e,t,n){for(n=n.child;n!==null;)Ku(e,t,n),n=n.sibling}function Ku(e,t,n){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(Us,n)}catch{}switch(n.tag){case 5:me||bn(n,t);case 6:var r=ue,l=qe;ue=null,_t(e,t,n),ue=r,qe=l,ue!==null&&(qe?(e=ue,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ue.removeChild(n.stateNode));break;case 18:ue!==null&&(qe?(e=ue,n=n.stateNode,e.nodeType===8?kl(e.parentNode,n):e.nodeType===1&&kl(e,n),wr(e)):kl(ue,n.stateNode));break;case 4:r=ue,l=qe,ue=n.stateNode.containerInfo,qe=!0,_t(e,t,n),ue=r,qe=l;break;case 0:case 11:case 14:case 15:if(!me&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&vi(n,t,a),l=l.next}while(l!==r)}_t(e,t,n);break;case 1:if(!me&&(bn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){ne(n,t,o)}_t(e,t,n);break;case 21:_t(e,t,n);break;case 22:n.mode&1?(me=(r=me)||n.memoizedState!==null,_t(e,t,n),me=r):_t(e,t,n);break;default:_t(e,t,n)}}function bo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Fp),t.forEach(function(r){var l=Bp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Xe(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];try{var i=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:ue=o.stateNode,qe=!1;break e;case 3:ue=o.stateNode.containerInfo,qe=!0;break e;case 4:ue=o.stateNode.containerInfo,qe=!0;break e}o=o.return}if(ue===null)throw Error(S(160));Ku(i,a,l),ue=null,qe=!1;var c=l.alternate;c!==null&&(c.return=null),l.return=null}catch(u){ne(l,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Gu(t,e),t=t.sibling}function Gu(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Xe(t,e),lt(e),r&4){try{pr(3,e,e.return),Xs(3,e)}catch(j){ne(e,e.return,j)}try{pr(5,e,e.return)}catch(j){ne(e,e.return,j)}}break;case 1:Xe(t,e),lt(e),r&512&&n!==null&&bn(n,n.return);break;case 5:if(Xe(t,e),lt(e),r&512&&n!==null&&bn(n,n.return),e.flags&32){var l=e.stateNode;try{yr(l,"")}catch(j){ne(e,e.return,j)}}if(r&4&&(l=e.stateNode,l!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,o=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&gc(l,i),Bl(o,a);var u=Bl(o,i);for(a=0;a<c.length;a+=2){var m=c[a],f=c[a+1];m==="style"?wc(l,f):m==="dangerouslySetInnerHTML"?xc(l,f):m==="children"?yr(l,f):Ri(l,m,f,u)}switch(o){case"input":Dl(l,i);break;case"textarea":yc(l,i);break;case"select":var h=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!i.multiple;var y=i.value;y!=null?Pn(l,!!i.multiple,y,!1):h!==!!i.multiple&&(i.defaultValue!=null?Pn(l,!!i.multiple,i.defaultValue,!0):Pn(l,!!i.multiple,i.multiple?[]:"",!1))}l[Cr]=i}catch(j){ne(e,e.return,j)}}break;case 6:if(Xe(t,e),lt(e),r&4){if(e.stateNode===null)throw Error(S(162));l=e.stateNode,i=e.memoizedProps;try{l.nodeValue=i}catch(j){ne(e,e.return,j)}}break;case 3:if(Xe(t,e),lt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{wr(t.containerInfo)}catch(j){ne(e,e.return,j)}break;case 4:Xe(t,e),lt(e);break;case 13:Xe(t,e),lt(e),l=e.child,l.flags&8192&&(i=l.memoizedState!==null,l.stateNode.isHidden=i,!i||l.alternate!==null&&l.alternate.memoizedState!==null||(pa=re())),r&4&&bo(e);break;case 22:if(m=n!==null&&n.memoizedState!==null,e.mode&1?(me=(u=me)||m,Xe(t,e),me=u):Xe(t,e),lt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!m&&e.mode&1)for(T=e,m=e.child;m!==null;){for(f=T=m;T!==null;){switch(h=T,y=h.child,h.tag){case 0:case 11:case 14:case 15:pr(4,h,h.return);break;case 1:bn(h,h.return);var v=h.stateNode;if(typeof v.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(j){ne(r,n,j)}}break;case 5:bn(h,h.return);break;case 22:if(h.memoizedState!==null){Po(f);continue}}y!==null?(y.return=h,T=y):Po(f)}m=m.sibling}e:for(m=null,f=e;;){if(f.tag===5){if(m===null){m=f;try{l=f.stateNode,u?(i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,o.style.display=jc("display",a))}catch(j){ne(e,e.return,j)}}}else if(f.tag===6){if(m===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(j){ne(e,e.return,j)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;m===f&&(m=null),f=f.return}m===f&&(m=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Xe(t,e),lt(e),r&4&&bo(e);break;case 21:break;default:Xe(t,e),lt(e)}}function lt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Qu(n)){var r=n;break e}n=n.return}throw Error(S(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(yr(l,""),r.flags&=-33);var i=Co(e);wi(e,i,l);break;case 3:case 4:var a=r.stateNode.containerInfo,o=Co(e);ji(e,o,a);break;default:throw Error(S(161))}}catch(c){ne(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function zp(e,t,n){T=e,Yu(e)}function Yu(e,t,n){for(var r=(e.mode&1)!==0;T!==null;){var l=T,i=l.child;if(l.tag===22&&r){var a=l.memoizedState!==null||qr;if(!a){var o=l.alternate,c=o!==null&&o.memoizedState!==null||me;o=qr;var u=me;if(qr=a,(me=c)&&!u)for(T=l;T!==null;)a=T,c=a.child,a.tag===22&&a.memoizedState!==null?Lo(l):c!==null?(c.return=a,T=c):Lo(l);for(;i!==null;)T=i,Yu(i),i=i.sibling;T=l,qr=o,me=u}Eo(e)}else l.subtreeFlags&8772&&i!==null?(i.return=l,T=i):Eo(e)}}function Eo(e){for(;T!==null;){var t=T;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:me||Xs(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!me)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:Ze(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&fo(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}fo(t,a,n)}break;case 5:var o=t.stateNode;if(n===null&&t.flags&4){n=o;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var m=u.memoizedState;if(m!==null){var f=m.dehydrated;f!==null&&wr(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(S(163))}me||t.flags&512&&xi(t)}catch(h){ne(t,t.return,h)}}if(t===e){T=null;break}if(n=t.sibling,n!==null){n.return=t.return,T=n;break}T=t.return}}function Po(e){for(;T!==null;){var t=T;if(t===e){T=null;break}var n=t.sibling;if(n!==null){n.return=t.return,T=n;break}T=t.return}}function Lo(e){for(;T!==null;){var t=T;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Xs(4,t)}catch(c){ne(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(c){ne(t,l,c)}}var i=t.return;try{xi(t)}catch(c){ne(t,i,c)}break;case 5:var a=t.return;try{xi(t)}catch(c){ne(t,a,c)}}}catch(c){ne(t,t.return,c)}if(t===e){T=null;break}var o=t.sibling;if(o!==null){o.return=t.return,T=o;break}T=t.return}}var Op=Math.ceil,$s=St.ReactCurrentDispatcher,da=St.ReactCurrentOwner,Be=St.ReactCurrentBatchConfig,D=0,ce=null,le=null,de=0,Re=0,En=Qt(0),ae=0,Tr=null,an=0,Zs=0,fa=0,hr=null,Ee=null,pa=0,Hn=1/0,ht=null,Rs=!1,Ni=null,It=null,Jr=!1,Tt=null,Fs=0,mr=0,ki=null,ds=-1,fs=0;function ke(){return D&6?re():ds!==-1?ds:ds=re()}function Dt(e){return e.mode&1?D&2&&de!==0?de&-de:wp.transition!==null?(fs===0&&(fs=$c()),fs):(e=U,e!==0||(e=window.event,e=e===void 0?16:Dc(e.type)),e):1}function nt(e,t,n,r){if(50<mr)throw mr=0,ki=null,Error(S(185));Rr(e,n,r),(!(D&2)||e!==ce)&&(e===ce&&(!(D&2)&&(Zs|=n),ae===4&&Lt(e,de)),$e(e,r),n===1&&D===0&&!(t.mode&1)&&(Hn=re()+500,Ks&&Kt()))}function $e(e,t){var n=e.callbackNode;wf(e,t);var r=vs(e,e===ce?de:0);if(r===0)n!==null&&Oa(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Oa(n),t===1)e.tag===0?jp(Mo.bind(null,e)):lu(Mo.bind(null,e)),gp(function(){!(D&6)&&Kt()}),n=null;else{switch(Rc(r)){case 1:n=Ii;break;case 4:n=Mc;break;case 16:n=ys;break;case 536870912:n=Tc;break;default:n=ys}n=rd(n,Xu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Xu(e,t){if(ds=-1,fs=0,D&6)throw Error(S(327));var n=e.callbackNode;if(Rn()&&e.callbackNode!==n)return null;var r=vs(e,e===ce?de:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=As(e,r);else{t=r;var l=D;D|=2;var i=qu();(ce!==e||de!==t)&&(ht=null,Hn=re()+500,tn(e,t));do try{Hp();break}catch(o){Zu(e,o)}while(!0);qi(),$s.current=i,D=l,le!==null?t=0:(ce=null,de=0,t=ae)}if(t!==0){if(t===2&&(l=Xl(e),l!==0&&(r=l,t=Si(e,l))),t===1)throw n=Tr,tn(e,0),Lt(e,r),$e(e,re()),n;if(t===6)Lt(e,r);else{if(l=e.current.alternate,!(r&30)&&!Ip(l)&&(t=As(e,r),t===2&&(i=Xl(e),i!==0&&(r=i,t=Si(e,i))),t===1))throw n=Tr,tn(e,0),Lt(e,r),$e(e,re()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(S(345));case 2:Zt(e,Ee,ht);break;case 3:if(Lt(e,r),(r&130023424)===r&&(t=pa+500-re(),10<t)){if(vs(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){ke(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=si(Zt.bind(null,e,Ee,ht),t);break}Zt(e,Ee,ht);break;case 4:if(Lt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var a=31-tt(r);i=1<<a,a=t[a],a>l&&(l=a),r&=~i}if(r=l,r=re()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Op(r/1960))-r,10<r){e.timeoutHandle=si(Zt.bind(null,e,Ee,ht),r);break}Zt(e,Ee,ht);break;case 5:Zt(e,Ee,ht);break;default:throw Error(S(329))}}}return $e(e,re()),e.callbackNode===n?Xu.bind(null,e):null}function Si(e,t){var n=hr;return e.current.memoizedState.isDehydrated&&(tn(e,t).flags|=256),e=As(e,t),e!==2&&(t=Ee,Ee=n,t!==null&&_i(t)),e}function _i(e){Ee===null?Ee=e:Ee.push.apply(Ee,e)}function Ip(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var l=n[r],i=l.getSnapshot;l=l.value;try{if(!rt(i(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Lt(e,t){for(t&=~fa,t&=~Zs,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-tt(t),r=1<<n;e[n]=-1,t&=~r}}function Mo(e){if(D&6)throw Error(S(327));Rn();var t=vs(e,0);if(!(t&1))return $e(e,re()),null;var n=As(e,t);if(e.tag!==0&&n===2){var r=Xl(e);r!==0&&(t=r,n=Si(e,r))}if(n===1)throw n=Tr,tn(e,0),Lt(e,t),$e(e,re()),n;if(n===6)throw Error(S(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Zt(e,Ee,ht),$e(e,re()),null}function ha(e,t){var n=D;D|=1;try{return e(t)}finally{D=n,D===0&&(Hn=re()+500,Ks&&Kt())}}function on(e){Tt!==null&&Tt.tag===0&&!(D&6)&&Rn();var t=D;D|=1;var n=Be.transition,r=U;try{if(Be.transition=null,U=1,e)return e()}finally{U=r,Be.transition=n,D=t,!(D&6)&&Kt()}}function ma(){Re=En.current,G(En)}function tn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,mp(n)),le!==null)for(n=le.return;n!==null;){var r=n;switch(Yi(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ks();break;case 3:In(),G(Me),G(ge),sa();break;case 5:ra(r);break;case 4:In();break;case 13:G(J);break;case 19:G(J);break;case 10:Ji(r.type._context);break;case 22:case 23:ma()}n=n.return}if(ce=e,le=e=Ht(e.current,null),de=Re=t,ae=0,Tr=null,fa=Zs=an=0,Ee=hr=null,Jt!==null){for(t=0;t<Jt.length;t++)if(n=Jt[t],r=n.interleaved,r!==null){n.interleaved=null;var l=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=l,r.next=a}n.pending=r}Jt=null}return e}function Zu(e,t){do{var n=le;try{if(qi(),os.current=Ts,Ms){for(var r=ee.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}Ms=!1}if(ln=0,oe=ie=ee=null,fr=!1,Pr=0,da.current=null,n===null||n.return===null){ae=1,Tr=t,le=null;break}e:{var i=e,a=n.return,o=n,c=t;if(t=de,o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,m=o,f=m.tag;if(!(m.mode&1)&&(f===0||f===11||f===15)){var h=m.alternate;h?(m.updateQueue=h.updateQueue,m.memoizedState=h.memoizedState,m.lanes=h.lanes):(m.updateQueue=null,m.memoizedState=null)}var y=vo(a);if(y!==null){y.flags&=-257,xo(y,a,o,i,t),y.mode&1&&yo(i,u,t),t=y,c=u;var v=t.updateQueue;if(v===null){var j=new Set;j.add(c),t.updateQueue=j}else v.add(c);break e}else{if(!(t&1)){yo(i,u,t),ga();break e}c=Error(S(426))}}else if(X&&o.mode&1){var _=vo(a);if(_!==null){!(_.flags&65536)&&(_.flags|=256),xo(_,a,o,i,t),Xi(Dn(c,o));break e}}i=c=Dn(c,o),ae!==4&&(ae=2),hr===null?hr=[i]:hr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var p=Ru(i,c,t);uo(i,p);break e;case 1:o=c;var d=i.type,g=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(It===null||!It.has(g)))){i.flags|=65536,t&=-t,i.lanes|=t;var k=Fu(i,o,t);uo(i,k);break e}}i=i.return}while(i!==null)}ed(n)}catch(C){t=C,le===n&&n!==null&&(le=n=n.return);continue}break}while(!0)}function qu(){var e=$s.current;return $s.current=Ts,e===null?Ts:e}function ga(){(ae===0||ae===3||ae===2)&&(ae=4),ce===null||!(an&268435455)&&!(Zs&268435455)||Lt(ce,de)}function As(e,t){var n=D;D|=2;var r=qu();(ce!==e||de!==t)&&(ht=null,tn(e,t));do try{Dp();break}catch(l){Zu(e,l)}while(!0);if(qi(),D=n,$s.current=r,le!==null)throw Error(S(261));return ce=null,de=0,ae}function Dp(){for(;le!==null;)Ju(le)}function Hp(){for(;le!==null&&!ff();)Ju(le)}function Ju(e){var t=nd(e.alternate,e,Re);e.memoizedProps=e.pendingProps,t===null?ed(e):le=t,da.current=null}function ed(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Rp(n,t),n!==null){n.flags&=32767,le=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ae=6,le=null;return}}else if(n=$p(n,t,Re),n!==null){le=n;return}if(t=t.sibling,t!==null){le=t;return}le=t=e}while(t!==null);ae===0&&(ae=5)}function Zt(e,t,n){var r=U,l=Be.transition;try{Be.transition=null,U=1,Up(e,t,n,r)}finally{Be.transition=l,U=r}return null}function Up(e,t,n,r){do Rn();while(Tt!==null);if(D&6)throw Error(S(327));n=e.finishedWork;var l=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(S(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Nf(e,i),e===ce&&(le=ce=null,de=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Jr||(Jr=!0,rd(ys,function(){return Rn(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Be.transition,Be.transition=null;var a=U;U=1;var o=D;D|=4,da.current=null,Ap(e,n),Gu(n,e),op(ni),xs=!!ti,ni=ti=null,e.current=n,zp(n),pf(),D=o,U=a,Be.transition=i}else e.current=n;if(Jr&&(Jr=!1,Tt=e,Fs=l),i=e.pendingLanes,i===0&&(It=null),gf(n.stateNode),$e(e,re()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],r(l.value,{componentStack:l.stack,digest:l.digest});if(Rs)throw Rs=!1,e=Ni,Ni=null,e;return Fs&1&&e.tag!==0&&Rn(),i=e.pendingLanes,i&1?e===ki?mr++:(mr=0,ki=e):mr=0,Kt(),null}function Rn(){if(Tt!==null){var e=Rc(Fs),t=Be.transition,n=U;try{if(Be.transition=null,U=16>e?16:e,Tt===null)var r=!1;else{if(e=Tt,Tt=null,Fs=0,D&6)throw Error(S(331));var l=D;for(D|=4,T=e.current;T!==null;){var i=T,a=i.child;if(T.flags&16){var o=i.deletions;if(o!==null){for(var c=0;c<o.length;c++){var u=o[c];for(T=u;T!==null;){var m=T;switch(m.tag){case 0:case 11:case 15:pr(8,m,i)}var f=m.child;if(f!==null)f.return=m,T=f;else for(;T!==null;){m=T;var h=m.sibling,y=m.return;if(Bu(m),m===u){T=null;break}if(h!==null){h.return=y,T=h;break}T=y}}}var v=i.alternate;if(v!==null){var j=v.child;if(j!==null){v.child=null;do{var _=j.sibling;j.sibling=null,j=_}while(j!==null)}}T=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,T=a;else e:for(;T!==null;){if(i=T,i.flags&2048)switch(i.tag){case 0:case 11:case 15:pr(9,i,i.return)}var p=i.sibling;if(p!==null){p.return=i.return,T=p;break e}T=i.return}}var d=e.current;for(T=d;T!==null;){a=T;var g=a.child;if(a.subtreeFlags&2064&&g!==null)g.return=a,T=g;else e:for(a=d;T!==null;){if(o=T,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:Xs(9,o)}}catch(C){ne(o,o.return,C)}if(o===a){T=null;break e}var k=o.sibling;if(k!==null){k.return=o.return,T=k;break e}T=o.return}}if(D=l,Kt(),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(Us,e)}catch{}r=!0}return r}finally{U=n,Be.transition=t}}return!1}function To(e,t,n){t=Dn(n,t),t=Ru(e,t,1),e=Ot(e,t,1),t=ke(),e!==null&&(Rr(e,1,t),$e(e,t))}function ne(e,t,n){if(e.tag===3)To(e,e,n);else for(;t!==null;){if(t.tag===3){To(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(It===null||!It.has(r))){e=Dn(n,e),e=Fu(t,e,1),t=Ot(t,e,1),e=ke(),t!==null&&(Rr(t,1,e),$e(t,e));break}}t=t.return}}function Wp(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ke(),e.pingedLanes|=e.suspendedLanes&n,ce===e&&(de&n)===n&&(ae===4||ae===3&&(de&130023424)===de&&500>re()-pa?tn(e,0):fa|=n),$e(e,t)}function td(e,t){t===0&&(e.mode&1?(t=Wr,Wr<<=1,!(Wr&130023424)&&(Wr=4194304)):t=1);var n=ke();e=Nt(e,t),e!==null&&(Rr(e,t,n),$e(e,n))}function Vp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),td(e,n)}function Bp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(S(314))}r!==null&&r.delete(t),td(e,n)}var nd;nd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Me.current)Le=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Le=!1,Tp(e,t,n);Le=!!(e.flags&131072)}else Le=!1,X&&t.flags&1048576&&iu(t,Cs,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;us(e,t),e=t.pendingProps;var l=An(t,ge.current);$n(t,n),l=ia(null,t,r,e,l,n);var i=aa();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Te(r)?(i=!0,Ss(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ta(t),l.updater=Ys,t.stateNode=l,l._reactInternals=t,di(t,r,e,n),t=hi(null,t,r,!0,i,n)):(t.tag=0,X&&i&&Gi(t),Ne(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(us(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Kp(r),e=Ze(r,e),l){case 0:t=pi(null,t,r,e,n);break e;case 1:t=No(null,t,r,e,n);break e;case 11:t=jo(null,t,r,e,n);break e;case 14:t=wo(null,t,r,Ze(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ze(r,l),pi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ze(r,l),No(e,t,r,l,n);case 3:e:{if(Iu(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,fu(e,t),Ps(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=Dn(Error(S(423)),t),t=ko(e,t,r,n,l);break e}else if(r!==l){l=Dn(Error(S(424)),t),t=ko(e,t,r,n,l);break e}else for(Fe=zt(t.stateNode.containerInfo.firstChild),Ae=t,X=!0,Je=null,n=uu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(zn(),r===l){t=kt(e,t,n);break e}Ne(e,t,r,n)}t=t.child}return t;case 5:return pu(t),e===null&&oi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,ri(r,l)?a=null:i!==null&&ri(r,i)&&(t.flags|=32),Ou(e,t),Ne(e,t,a,n),t.child;case 6:return e===null&&oi(t),null;case 13:return Du(e,t,n);case 4:return na(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=On(t,null,r,n):Ne(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ze(r,l),jo(e,t,r,l,n);case 7:return Ne(e,t,t.pendingProps,n),t.child;case 8:return Ne(e,t,t.pendingProps.children,n),t.child;case 12:return Ne(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,a=l.value,B(bs,r._currentValue),r._currentValue=a,i!==null)if(rt(i.value,a)){if(i.children===l.children&&!Me.current){t=kt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=vt(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var m=u.pending;m===null?c.next=c:(c.next=m.next,m.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),ci(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(S(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),ci(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Ne(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,$n(t,n),l=Qe(l),r=r(l),t.flags|=1,Ne(e,t,r,n),t.child;case 14:return r=t.type,l=Ze(r,t.pendingProps),l=Ze(r.type,l),wo(e,t,r,l,n);case 15:return Au(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ze(r,l),us(e,t),t.tag=1,Te(r)?(e=!0,Ss(t)):e=!1,$n(t,n),$u(t,r,l),di(t,r,l,n),hi(null,t,r,!0,e,n);case 19:return Hu(e,t,n);case 22:return zu(e,t,n)}throw Error(S(156,t.tag))};function rd(e,t){return Lc(e,t)}function Qp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function We(e,t,n,r){return new Qp(e,t,n,r)}function ya(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Kp(e){if(typeof e=="function")return ya(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ai)return 11;if(e===zi)return 14}return 2}function Ht(e,t){var n=e.alternate;return n===null?(n=We(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ps(e,t,n,r,l,i){var a=2;if(r=e,typeof e=="function")ya(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case vn:return nn(n.children,l,i,t);case Fi:a=8,l|=8;break;case Fl:return e=We(12,n,t,l|2),e.elementType=Fl,e.lanes=i,e;case Al:return e=We(13,n,t,l),e.elementType=Al,e.lanes=i,e;case zl:return e=We(19,n,t,l),e.elementType=zl,e.lanes=i,e;case pc:return qs(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dc:a=10;break e;case fc:a=9;break e;case Ai:a=11;break e;case zi:a=14;break e;case Ct:a=16,r=null;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=We(a,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function nn(e,t,n,r){return e=We(7,e,r,t),e.lanes=n,e}function qs(e,t,n,r){return e=We(22,e,r,t),e.elementType=pc,e.lanes=n,e.stateNode={isHidden:!1},e}function Ml(e,t,n){return e=We(6,e,null,t),e.lanes=n,e}function Tl(e,t,n){return t=We(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Gp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fl(0),this.expirationTimes=fl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function va(e,t,n,r,l,i,a,o,c){return e=new Gp(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=We(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ta(i),e}function Yp(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function sd(e){if(!e)return Wt;e=e._reactInternals;e:{if(pn(e)!==e||e.tag!==1)throw Error(S(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Te(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(S(171))}if(e.tag===1){var n=e.type;if(Te(n))return su(e,n,t)}return t}function ld(e,t,n,r,l,i,a,o,c){return e=va(n,r,!0,e,l,i,a,o,c),e.context=sd(null),n=e.current,r=ke(),l=Dt(n),i=vt(r,l),i.callback=t??null,Ot(n,i,l),e.current.lanes=l,Rr(e,l,r),$e(e,r),e}function Js(e,t,n,r){var l=t.current,i=ke(),a=Dt(l);return n=sd(n),t.context===null?t.context=n:t.pendingContext=n,t=vt(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ot(l,t,a),e!==null&&(nt(e,l,a,i),as(e,l,a)),a}function zs(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function $o(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xa(e,t){$o(e,t),(e=e.alternate)&&$o(e,t)}function Xp(){return null}var id=typeof reportError=="function"?reportError:function(e){console.error(e)};function ja(e){this._internalRoot=e}el.prototype.render=ja.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(S(409));Js(e,t,null,null)};el.prototype.unmount=ja.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;on(function(){Js(null,e,null,null)}),t[wt]=null}};function el(e){this._internalRoot=e}el.prototype.unstable_scheduleHydration=function(e){if(e){var t=zc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Pt.length&&t!==0&&t<Pt[n].priority;n++);Pt.splice(n,0,e),n===0&&Ic(e)}};function wa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function tl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ro(){}function Zp(e,t,n,r,l){if(l){if(typeof r=="function"){var i=r;r=function(){var u=zs(a);i.call(u)}}var a=ld(t,r,e,0,null,!1,!1,"",Ro);return e._reactRootContainer=a,e[wt]=a.current,Sr(e.nodeType===8?e.parentNode:e),on(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var o=r;r=function(){var u=zs(c);o.call(u)}}var c=va(e,0,!1,null,null,!1,!1,"",Ro);return e._reactRootContainer=c,e[wt]=c.current,Sr(e.nodeType===8?e.parentNode:e),on(function(){Js(t,c,n,r)}),c}function nl(e,t,n,r,l){var i=n._reactRootContainer;if(i){var a=i;if(typeof l=="function"){var o=l;l=function(){var c=zs(a);o.call(c)}}Js(t,a,e,l)}else a=Zp(n,t,e,l,r);return zs(a)}Fc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=lr(t.pendingLanes);n!==0&&(Di(t,n|1),$e(t,re()),!(D&6)&&(Hn=re()+500,Kt()))}break;case 13:on(function(){var r=Nt(e,1);if(r!==null){var l=ke();nt(r,e,1,l)}}),xa(e,1)}};Hi=function(e){if(e.tag===13){var t=Nt(e,134217728);if(t!==null){var n=ke();nt(t,e,134217728,n)}xa(e,134217728)}};Ac=function(e){if(e.tag===13){var t=Dt(e),n=Nt(e,t);if(n!==null){var r=ke();nt(n,e,t,r)}xa(e,t)}};zc=function(){return U};Oc=function(e,t){var n=U;try{return U=e,t()}finally{U=n}};Kl=function(e,t,n){switch(t){case"input":if(Dl(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var l=Qs(r);if(!l)throw Error(S(90));mc(r),Dl(r,l)}}}break;case"textarea":yc(e,n);break;case"select":t=n.value,t!=null&&Pn(e,!!n.multiple,t,!1)}};Sc=ha;_c=on;var qp={usingClientEntryPoint:!1,Events:[Ar,Nn,Qs,Nc,kc,ha]},tr={findFiberByHostInstance:qt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Jp={bundleType:tr.bundleType,version:tr.version,rendererPackageName:tr.rendererPackageName,rendererConfig:tr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:St.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ec(e),e===null?null:e.stateNode},findFiberByHostInstance:tr.findFiberByHostInstance||Xp,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 es=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!es.isDisabled&&es.supportsFiber)try{Us=es.inject(Jp),ct=es}catch{}}Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qp;Ie.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wa(t))throw Error(S(200));return Yp(e,t,null,n)};Ie.createRoot=function(e,t){if(!wa(e))throw Error(S(299));var n=!1,r="",l=id;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=va(e,1,!1,null,null,n,!1,r,l),e[wt]=t.current,Sr(e.nodeType===8?e.parentNode:e),new ja(t)};Ie.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(S(188)):(e=Object.keys(e).join(","),Error(S(268,e)));return e=Ec(t),e=e===null?null:e.stateNode,e};Ie.flushSync=function(e){return on(e)};Ie.hydrate=function(e,t,n){if(!tl(t))throw Error(S(200));return nl(null,e,t,!0,n)};Ie.hydrateRoot=function(e,t,n){if(!wa(e))throw Error(S(405));var r=n!=null&&n.hydratedSources||null,l=!1,i="",a=id;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=ld(t,null,e,1,n??null,l,!1,i,a),e[wt]=t.current,Sr(e),r)for(e=0;e<r.length;e++)n=r[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new el(t)};Ie.render=function(e,t,n){if(!tl(t))throw Error(S(200));return nl(null,e,t,!1,n)};Ie.unmountComponentAtNode=function(e){if(!tl(e))throw Error(S(40));return e._reactRootContainer?(on(function(){nl(null,null,e,!1,function(){e._reactRootContainer=null,e[wt]=null})}),!0):!1};Ie.unstable_batchedUpdates=ha;Ie.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!tl(n))throw Error(S(200));if(e==null||e._reactInternals===void 0)throw Error(S(38));return nl(e,t,n,!1,r)};Ie.version="18.3.1-next-f1338f8080-20240426";function ad(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ad)}catch(e){console.error(e)}}ad(),ac.exports=Ie;var eh=ac.exports,Fo=eh;$l.createRoot=Fo.createRoot,$l.hydrateRoot=Fo.hydrateRoot;class Os extends Error{constructor(n,r){const l=r&&typeof r.error=="string"?r.error:`Request failed (${n})`;super(l);il(this,"status");il(this,"body");this.name="ApiError",this.status=n,this.body=r}get code(){return this.body&&typeof this.body.code=="string"?this.body.code:null}}async function we(e,t){let n;try{n=await fetch(e,t)}catch{throw new Os(0,{error:"Cannot reach the ClearHand server. Is it running?"})}const r=await n.text();let l=null;if(r)try{l=JSON.parse(r)}catch{l=null}if(!n.ok)throw new Os(n.status,l??null);return l}function be(e,t){return we(e,{method:"POST",headers:{"Content-Type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)})}function th(e,t){return we(e,{method:"PATCH",headers:{"Content-Type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)})}const R={getStatus:()=>we("/api/status"),getTrust:()=>we("/api/trust"),getAudit:e=>we(e!=null?`/api/audit?case_id=${e}`:"/api/audit"),getCases:(e={})=>{const t=new URLSearchParams;e.status&&t.set("status",e.status),e.search&&t.set("search",e.search),e.limit&&t.set("limit",String(e.limit)),e.sort&&t.set("sort",e.sort),e.offset&&t.set("offset",String(e.offset)),e.dateFrom&&t.set("date_from",e.dateFrom),e.dateTo&&t.set("date_to",e.dateTo);const n=t.toString();return we(`/api/cases${n?`?${n}`:""}`)},getCase:e=>we(`/api/cases/${e}`),setCaseStatus:(e,t,n)=>be(`/api/cases/${e}/status`,{status:t,...n?{allow_pending_financial:!0}:{}}),executeActions:(e,t,n)=>be(`/api/cases/${e}/actions/execute`,{actionIds:t,...n?{sendMode:n}:{}}),rejectAction:(e,t,n)=>be(`/api/cases/${e}/actions/${t}/reject`,n?{reason:n}:{}),updateDraft:(e,t)=>be(`/api/cases/${e}/update-draft`,{body_english:t}),sendReply:(e,t,n)=>be(`/api/cases/${e}/send-reply`,{body:t,...n?{allow_pending_financial:!0}:{}}),connectStripe:e=>be("/api/connections/stripe",{api_key:e}),connectMailbox:e=>be("/api/connections/mailbox",e),connectGithub:(e,t)=>be("/api/connections/github",{token:e,repo:t}),disconnect:e=>we(`/api/connections/${e}`,{method:"DELETE"}),sync:()=>be("/api/sync"),getCalibrations:()=>we("/api/calibrations"),reviewCalibration:(e,t,n)=>be(`/api/calibrations/${e}/review`,{verdict:t,...n?{note:n}:{}}),getOverlay:()=>we("/api/overlay"),getOverlayFile:e=>we(`/api/overlay/${encodeURIComponent(e)}`),getFeedback:()=>we("/api/feedback"),getLearningReviews:()=>we("/api/learning-reviews"),resolveLearningReview:(e,t)=>be(`/api/learning-reviews/${e}/resolve`,{status:t}),getOnboarding:()=>we("/api/onboarding"),setOnboardingStage:(e,t)=>th("/api/onboarding/stage",{stage:e,status:t}),postOnboardingEvent:(e,t,n)=>be("/api/onboarding/events",{stage:e,kind:t,payload:n}),getOnboardingEvents:e=>we(`/api/onboarding/events?after=${e}`),postOnboardingConfirmation:(e,t)=>be("/api/onboarding/confirmations",{key:e,value:t}),postOnboardingStyle:e=>be("/api/onboarding/style",e)};function nh(){const e=()=>{const r=window.location.hash.replace(/^#/,"");return r===""?"/":r},[t,n]=N.useState(e);return N.useEffect(()=>{const r=()=>n(e());return window.addEventListener("hashchange",r),()=>window.removeEventListener("hashchange",r)},[]),t}function Oe(e,t){const[n,r]=N.useState(null),[l,i]=N.useState(!0),[a,o]=N.useState(null),[c,u]=N.useState(0);return N.useEffect(()=>{let m=!0;return i(!0),o(null),e().then(f=>{m&&(r(f),i(!1))}).catch(f=>{m&&(o(f instanceof Error?f.message:String(f)),i(!1))}),()=>{m=!1}},[...t,c]),{data:n,loading:l,error:a,reload:()=>u(m=>m+1)}}function rh(e,t=250){const[n,r]=N.useState(e);return N.useEffect(()=>{const l=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(l)},[e,t]),n}const od=N.createContext({status:null,reloadStatus:()=>{}}),dt=()=>N.useContext(od);function rl(e){if(typeof e=="number")return new Date(e<1e12?e*1e3:e);const t=e.trim();if(t==="")return null;if(/^\d+(\.\d+)?$/.test(t))return rl(Number(t));let n=t;/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(n)&&(n=n.replace(" ","T"),/[zZ]|[+-]\d{2}:?\d{2}$/.test(n)||(n+="Z"));const r=new Date(n);return isNaN(r.getTime())?null:r}function ye(e){if(e==null||e==="")return"—";const t=rl(e);if(!t)return String(e);const n=Math.round((Date.now()-t.getTime())/1e3);if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const l=Math.round(r/60);if(l<24)return`${l}h ago`;const i=Math.round(l/24);if(i<7)return`${i}d ago`;const a={month:"short",day:"numeric"};return t.getFullYear()!==new Date().getFullYear()&&(a.year="numeric"),t.toLocaleDateString(void 0,a)}function sh(e){if(e==null||e==="")return"—";const t=rl(e);return t?t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):String(e)}function Ao(e){if(e==null||e==="")return"—";const t=rl(e);return t?t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):String(e)}function lh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Is(e,t){const n=(t??"usd").toUpperCase(),r=(e/100).toFixed(2);return n==="USD"?`$${r}`:`${r} ${n}`}function cd(e){const t=typeof e.currency=="string"?e.currency:void 0,n=e.amount_cents??e.amountCents;if(typeof n=="number")return Is(n,t);const r=e.amount_usd??e.amountUsd;if(typeof r=="number")return t&&t.toUpperCase()!=="USD"?`${r.toFixed(2)} ${t.toUpperCase()}`:`$${r.toFixed(2)}`;const l=e.amount;if(typeof l=="number"){if(Number.isInteger(l)&&l>=100)return Is(l,t);const i=(t??"usd").toUpperCase();return i==="USD"?`$${l.toFixed(2)}`:`${l.toFixed(2)} ${i}`}return null}function xt(e){if(e==null)return null;if(typeof e=="object")return e;const t=e.trim();if(t==="")return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:{value:n}}catch{return null}}function ud(e){if(e==null)return"";if(typeof e=="string")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Ve(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function V(e){return typeof e=="string"&&e!==""?e:null}const zo={inbox:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M22 12h-6l-2 3h-4l-2-3H2"}),s.jsx("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),shield:s.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}),sliders:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3"}),s.jsx("path",{d:"M1 14h6M9 8h6M17 16h6"})]}),book:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),s.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),pulse:s.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"}),user:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),agent:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2"}),s.jsx("rect",{x:"10",y:"10",width:"4",height:"4"}),s.jsx("path",{d:"M9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3"})]}),gear:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),dollar:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 1v22"}),s.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]}),cancel:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"m15 9-6 6M9 9l6 6"})]}),mail:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"}),s.jsx("path",{d:"m22 6-10 7L2 6"})]}),tag:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M20.59 13.41 12 22l-10-10V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),s.jsx("path",{d:"M7 7h.01"})]}),github:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M6 3v12"}),s.jsx("circle",{cx:"6",cy:"18",r:"3"}),s.jsx("circle",{cx:"18",cy:"6",r:"3"}),s.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),sync:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M23 4v6h-6M1 20v-6h6"}),s.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),alert:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("path",{d:"M12 9v4M12 17h.01"})]}),check:s.jsx("path",{d:"M20 6 9 17l-5-5"}),lock:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2"}),s.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),bolt:s.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"}),hand:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M18 11V6a2 2 0 0 0-4 0v5"}),s.jsx("path",{d:"M14 10V4a2 2 0 0 0-4 0v6"}),s.jsx("path",{d:"M10 10.5V6a2 2 0 0 0-4 0v8"}),s.jsx("path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]})};function H({name:e,size:t=16}){const n=zo[e]??zo.gear;return s.jsx("svg",{className:"icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n})}function Z({tone:e="neutral",children:t,title:n}){return s.jsx("span",{className:`pill pill-${e}`,title:n,children:t})}const ih={new:"sage",processed:"neutral",reviewing:"amber",pending:"amber",resolved:"green",closed:"neutral",approved:"sage",executed:"green",rejected:"neutral",failed:"red",error:"red",ok:"green",healthy:"green"};function sl({status:e}){const t=ih[e]??"neutral";return s.jsx(Z,{tone:t,children:e.replace(/_/g," ")})}const ah={new:"Untriaged — synced from your mailbox; no agent has touched it yet.",reviewing:"An agent session has claimed this case and is working it now.",processed:"Drafted and proposed — waiting for your review.",pending:"Waiting on the customer.",resolved:"Closed — the customer got their answer.",escalated:"Handed to you — the agent will not act further on it.",ignored:"Marked ignorable — kept, not deleted."};function dd({status:e}){const t=ah[e],n=s.jsx(sl,{status:e});return t?s.jsx(Q,{tip:t,label:`What does “${e}” mean?`,children:n}):n}function Q({tip:e,label:t,children:n,wide:r}){const[l,i]=N.useState(!1),a=N.useRef(!1),o=N.useRef(null),[c,u]=N.useState({top:0,left:0,above:!1}),m=r?320:250,f=()=>{const j=o.current;if(!j)return;const _=j.getBoundingClientRect(),p=Math.min(Math.max(8,_.left+_.width/2-m/2),window.innerWidth-m-8),d=window.innerHeight-_.bottom<140;u({top:d?_.top-6:_.bottom+6,left:p,above:d})},h=()=>{f(),i(!0)},y=N.useCallback(()=>{a.current=!1,i(!1)},[]);N.useEffect(()=>{if(!l)return;const j=p=>{p.key==="Escape"&&y()},_=()=>y();return window.addEventListener("keydown",j),window.addEventListener("scroll",_,!0),()=>{window.removeEventListener("keydown",j),window.removeEventListener("scroll",_,!0)}},[l,y]);const v=()=>{a.current?y():(a.current=!0,h())};return s.jsxs("span",{className:"help-wrap",children:[s.jsx("span",{ref:o,role:"button",tabIndex:0,"aria-label":t??"More about this","aria-expanded":l,className:n?"help-term":"help-dot",onMouseEnter:h,onMouseLeave:()=>{a.current||i(!1)},onFocus:h,onBlur:y,onClick:j=>{j.preventDefault(),j.stopPropagation(),v()},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),v())},children:n??s.jsx("span",{className:"help-i","aria-hidden":"true",children:"i"})}),l&&s.jsx("span",{className:"help-pop",role:"tooltip",style:{top:c.top,left:c.left,width:m,transform:c.above?"translateY(-100%)":void 0},children:e})]})}function st({label:e="Loading…"}){return s.jsxs("div",{className:"state-block",children:[s.jsx("span",{className:"spinner","aria-hidden":"true"}),s.jsx("span",{children:e})]})}function Ge({message:e,onRetry:t}){return s.jsxs("div",{className:"error-box",role:"alert",children:[s.jsx(H,{name:"alert"}),s.jsxs("div",{className:"error-box-body",children:[s.jsx("strong",{children:"Something went wrong."}),s.jsx("div",{children:e})]}),t&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:t,children:"Retry"})]})}function cn({title:e,children:t}){return s.jsxs("div",{className:"empty-state",children:[s.jsx("div",{className:"empty-state-title",children:e}),t&&s.jsx("div",{className:"empty-state-body",children:t})]})}function $t({data:e}){return s.jsx("pre",{className:"json-view",children:ud(e)})}function oh({title:e,children:t,footer:n,onClose:r}){return N.useEffect(()=>{const l=i=>{i.key==="Escape"&&r()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),s.jsx("div",{className:"modal-overlay",onMouseDown:l=>l.target===l.currentTarget&&r(),children:s.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":e,children:[s.jsx("div",{className:"modal-title",children:e}),s.jsx("div",{className:"modal-body",children:t}),n&&s.jsx("div",{className:"modal-footer",children:n})]})})}const fd=N.createContext(()=>{}),Ce=()=>N.useContext(fd);let ch=0;function uh({children:e}){const[t,n]=N.useState([]),r=N.useCallback((l,i="info")=>{const a=++ch;n(o=>[...o,{id:a,kind:i,msg:l}]),window.setTimeout(()=>{n(o=>o.filter(c=>c.id!==a))},5e3)},[]);return s.jsxs(fd.Provider,{value:r,children:[e,s.jsx("div",{className:"toast-stack","aria-live":"polite",children:t.map(l=>s.jsxs("div",{className:`toast toast-${l.kind}`,children:[s.jsx(H,{name:l.kind==="error"||l.kind==="warn"?"alert":"check"}),s.jsx("span",{children:l.msg})]},l.id))})]})}const dh=["all","new","processed","reviewing","pending","resolved"],fh=[{value:"money_first",label:"money first"},{value:"updated",label:"newest"},{value:"oldest",label:"oldest"}],Oo=50;function ph(){var b,w;const{status:e,reloadStatus:t}=dt(),n=Ce(),[r,l]=N.useState("all"),[i,a]=N.useState(""),[o,c]=N.useState("money_first"),[u,m]=N.useState(!1),[f,h]=N.useState([]),[y,v]=N.useState(!1),j=rh(i.trim(),300),_=Oe(()=>R.getCases({status:r==="all"?void 0:r,search:j||void 0,sort:o,limit:Oo}),[r,j,o]);N.useEffect(()=>{h([])},[r,j,o]);const d=[...((b=_.data)==null?void 0:b.cases)??[],...f],g=((w=_.data)==null?void 0:w.total)??0,k=async()=>{v(!0);try{const x=await R.getCases({status:r==="all"?void 0:r,search:j||void 0,sort:o,limit:Oo,offset:d.length});h(L=>[...L,...x.cases])}catch(x){n(x instanceof Error?x.message:"Could not load more cases","error")}finally{v(!1)}},C=async()=>{m(!0);try{const x=await R.sync(),L=[];typeof x.scanned=="number"&&L.push(`${x.scanned} scanned`),typeof x.ingested=="number"&&L.push(`${x.ingested} ingested`),typeof x.newCases=="number"&&L.push(`${x.newCases} new case${x.newCases===1?"":"s"}`),n(L.length>0?`Inbox synced — ${L.join(", ")}`:"Inbox synced","success"),h([]),_.reload(),t()}catch(x){n(x instanceof Error?x.message:"Sync failed","error")}finally{m(!1)}};return s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Queue"}),s.jsx("div",{className:"page-sub",children:e?`${e.queue.open_cases} open case${e.queue.open_cases===1?"":"s"} · ${e.queue.pending_proposals} proposal${e.queue.pending_proposals===1?"":"s"} waiting for you`:"Cases prepared by your agent, waiting for your judgment."})]}),s.jsxs("div",{className:"page-head-actions",children:[(e==null?void 0:e.demo_mode)&&s.jsx(Z,{tone:"amber",title:"Running against sample data — nothing here is real.",children:"demo mode"}),s.jsxs("button",{className:`btn btn-secondary${u?" spin":""}`,onClick:()=>void C(),disabled:u,children:[s.jsx(H,{name:"sync"}),u?"Syncing…":"Sync inbox"]})]})]}),s.jsxs("div",{className:"filter-row",children:[dh.map(x=>s.jsx("button",{className:`filter-pill${r===x?" active":""}`,onClick:()=>l(x),children:x},x)),s.jsxs("div",{className:"sort-control",role:"group","aria-label":"Sort cases",children:[s.jsx("span",{className:"sort-label",children:"sort"}),fh.map(x=>s.jsx("button",{className:`filter-pill${o===x.value?" active":""}`,onClick:()=>c(x.value),children:x.label},x.value))]}),s.jsx("input",{className:"input filter-search",type:"search",placeholder:"Search cases & message text…",value:i,onChange:x=>a(x.target.value),"aria-label":"Search cases and message text"})]}),_.loading&&!_.data&&s.jsx(st,{label:"Loading cases…"}),_.error&&s.jsx(Ge,{message:_.error,onRetry:_.reload}),_.data&&d.length===0&&s.jsx(cn,{title:"Nothing here",children:r==="all"&&!j?"No cases yet. Hit “Sync inbox” to pull in new customer emails.":"No cases match this filter."}),_.data&&d.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"case-list",children:d.map(x=>s.jsxs("a",{className:"case-row",href:`#/case/${x.id}`,children:[s.jsxs("div",{className:"case-row-main",children:[s.jsxs("div",{className:"case-row-top",children:[s.jsx("span",{className:"case-row-subject",children:x.subject||"(no subject)"}),x.pending_financial>0&&s.jsx(Q,{tip:"A refund or cancellation is proposed but not executed — these cases sort first.",label:"What does money pending mean?",children:s.jsx(Z,{tone:"red",children:"money pending"})}),x.proposed_actions>0&&s.jsx(Q,{tip:"Actions the agent proposed for this case. Nothing runs until you approve it.",label:"What are proposals?",children:s.jsxs(Z,{tone:"sage",children:[x.proposed_actions," proposal",x.proposed_actions===1?"":"s"]})})]}),s.jsxs("div",{className:"case-row-sub",children:[s.jsx("span",{className:"case-row-customer",children:x.customer_name||x.customer_email||"Unknown customer"}),x.summary?s.jsxs(s.Fragment,{children:[" — ",Ve(x.summary,140)]}):null]})]}),s.jsxs("div",{className:"case-row-side",children:[x.category&&s.jsx("span",{className:"case-row-category",children:x.category}),s.jsx(dd,{status:x.status}),s.jsx("span",{className:"case-row-time",children:ye(x.updated_at)})]})]},x.id))}),s.jsxs("div",{className:"queue-foot",children:[s.jsxs("span",{className:"queue-count",children:[d.length," of ",g]}),d.length<g&&s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>void k(),disabled:y,children:y?"Loading…":"Load more"})]})]})]})}const hh=new Set(["refund","cancel_subscription"]);function Ci(e){return hh.has(e)}function un(e){switch(e){case"refund":return"Refund";case"cancel_subscription":return"Cancel subscription";case"send_reply":return"Send reply";case"set_case_status":return"Set case status";case"create_github_issue":return"Create GitHub issue";default:return e.replace(/_/g," ")}}function mh(e){switch(e){case"refund":return"dollar";case"cancel_subscription":return"cancel";case"send_reply":return"mail";case"set_case_status":return"tag";case"create_github_issue":return"github";default:return"bolt"}}function Na(e){return xt(e.modified_json)??xt(e.proposal_json)??{}}function gh(e){return V(e.subscription_id)??V(e.subscription)??V(e.sub_id)??(typeof e.subscription=="object"&&e.subscription!==null?V(e.subscription.id):null)}function yh(e){return V(e.charge_id)??V(e.charge)??V(e.payment_intent)??V(e.charge_ref)}function pd(e){const t=V(e.mode)??V(e.cancellation_mode)??V(e.when);return t?t.replace(/_/g," "):e.at_period_end===!1||e.cancel_at_period_end===!1?"immediately":"at period end"}function hd(e){return V(e.body)??V(e.body_english)??V(e.text)??V(e.message)}function vh(e){const t=Na(e);switch(e.action_type){case"refund":{const n=cd(t),r=yh(t),l=V(t.reason);let i=n?`Refund ${n}`:"Refund";return r&&(i+=` on ${Ve(r,24)}`),l&&(i+=` — ${l.replace(/_/g," ")}`),i}case"cancel_subscription":{const n=gh(t);let r=`Cancel ${pd(t)}`;return n&&(r+=` — ${Ve(n,28)}`),r}case"send_reply":{const n=hd(t);return n?`Reply to customer: “${Ve(n.replace(/\s+/g," ").trim(),90)}”`:"Send the drafted reply to the customer"}case"set_case_status":return`Move case to “${V(t.status)??V(t.target_status)??V(t.target)??"?"}”`;case"create_github_issue":{const n=V(t.title)??V(t.issue_title),r=V(t.repo);return n?`“${Ve(n,80)}”${r?` in ${r}`:""}`:"Open a GitHub issue"}default:{const n=Object.keys(t);return n.length>0?`${un(e.action_type)} (${n.slice(0,4).join(", ")})`:un(e.action_type)}}}function xh(e){const t=Na(e);switch(e.action_type){case"refund":{const n=cd(t);return n?`refund ${n}`:"issue refund"}case"cancel_subscription":return`cancel ${pd(t)}`;case"send_reply":return"send reply";case"set_case_status":{const n=V(t.status)??V(t.target_status)??V(t.target);return n==="resolved"?"resolve case":`set status to ${n??"?"}`}case"create_github_issue":return"create GitHub issue";default:return un(e.action_type).toLowerCase()}}function jh(e){const t=xt(e.result_json);if(!t)return null;const n=t.details&&typeof t.details=="object"?t.details:null;return{message:V(t.message)??(n?V(n.message):null),idempotentNoop:t.idempotent_noop===!0||(n==null?void 0:n.idempotent_noop)===!0,raw:t}}function wh(e){try{return/refus\w*\s+to\s+resolve/i.test(JSON.stringify(e)??"")}catch{return!1}}const Io=["new","processed","reviewing","pending","resolved"];function Nh({guard:e,onDismiss:t}){const n=e.pending;return s.jsxs("div",{className:"guard-banner",role:"alert",children:[s.jsx(H,{name:"shield",size:22}),s.jsxs("div",{style:{flex:1},children:[s.jsxs("div",{className:"guard-banner-title",children:["Held by the money guard"," ",s.jsx(Q,{tip:"ClearHand refuses to resolve a case or send a reply while proposed money actions are unresolved — so a customer is never told “done” while nothing ran.",label:"Why did the guard step in?"})]}),s.jsxs("div",{className:"guard-banner-body",children:["You asked to ",e.verb,", but ",n>0?n:"some"," financial action",n===1?" is":"s are"," still waiting for your decision. ClearHand won't move on while money is on the table — approve or reject those actions first, and this will go through on its own."]}),s.jsxs("div",{className:"guard-banner-actions",children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>{var r;return(r=document.getElementById("proposed-actions"))==null?void 0:r.scrollIntoView({behavior:"smooth",block:"start"})},children:"Show pending actions"}),s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>{window.confirm("Skip the money guard? Pending financial actions will stay unresolved.")&&e.retry()},children:e.proceedLabel}),s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,children:"Dismiss"})]})]})]})}function kh(){return s.jsxs("div",{className:"guard-banner",role:"alert",children:[s.jsx(H,{name:"shield",size:22}),s.jsxs("div",{children:[s.jsxs("div",{className:"guard-banner-title",children:["The resolve guard stepped in"," ",s.jsx(Q,{tip:"ClearHand refuses to resolve while money is owed. Approve or reject the pending money actions and the resolve goes through.",label:"What is the resolve guard?"})]}),s.jsx("div",{className:"guard-banner-body",children:"An action asked to resolve this case while financial actions were still pending, and ClearHand refused — kindly, and on purpose. Nothing was lost: approve or reject the remaining money actions below, then resolve the case."})]})]})}function Sh({resp:e,actions:t,onDismiss:n}){var a;const r=new Map(t.map(o=>[o.id,o])),l=o=>{const c=r.get(o);return c?un(c.action_type):`Action ${o}`},i=e.results.some(o=>wh(o));return s.jsxs(s.Fragment,{children:[i&&s.jsx(kh,{}),s.jsxs("div",{className:"results-panel",children:[s.jsxs("div",{className:"results-panel-head",children:[s.jsx(H,{name:"bolt"}),"Execution results",s.jsx("span",{style:{marginLeft:"auto"},children:s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Dismiss"})})]}),(a=e.lint_failures)==null?void 0:a.map(o=>s.jsxs("div",{className:"result-row result-warn",children:[s.jsx(H,{name:"alert"}),s.jsxs("div",{children:[s.jsx("strong",{children:l(o.actionId)})," — held back by tone lint:"," ",o.errors.join("; ")]})]},`lint-${o.actionId}`)),e.results.map(o=>{var u;const c=((u=o.details)==null?void 0:u.idempotent_noop)===!0;return s.jsxs("div",{className:`result-row ${o.success?"result-ok":"result-fail"}`,children:[s.jsx(H,{name:o.success?"check":"alert"}),s.jsxs("div",{children:[s.jsx("strong",{children:l(o.actionId)}),o.message?` — ${o.message}`:o.success?" — done":" — failed"," ",c&&s.jsx(Q,{tip:"The guard found it already done — nothing was double-executed.",label:"What is a no-op?",children:s.jsx(Z,{tone:"sage",children:"no-op (guard) — already done"})})]})]},o.actionId)}),e.results.length===0&&(e.lint_failures??[]).length===0&&s.jsxs("div",{className:"result-row",children:[s.jsx(H,{name:"check"}),s.jsx("div",{children:"Nothing was executed."})]})]})]})}function _h({action:e,checked:t,onToggle:n,onReject:r,busy:l}){const i=Na(e),a=Ci(e.action_type),o=jh(e),c=e.action_type==="send_reply"?hd(i):null,u=e.status==="proposed"||e.status==="failed",m=e.confidence==null?null:Math.round(e.confidence<=1?e.confidence*100:e.confidence),f=xt(e.modified_json),h=xt(e.proposal_json);return s.jsxs("div",{className:`action-card${a?" financial":""}${e.status==="executed"?" executed":""}`,children:[s.jsxs("div",{className:"action-head",children:[u&&s.jsx("input",{type:"checkbox",className:"action-check",checked:t,onChange:n,"aria-label":`Select ${un(e.action_type)}`}),s.jsx("span",{className:"action-icon",children:s.jsx(H,{name:mh(e.action_type)})}),s.jsx("span",{className:"action-title",children:un(e.action_type)}),s.jsx(Q,{tip:"Execution order — lower runs first. Money before words: the refund runs before the reply that mentions it.",label:"What does the order number mean?",children:s.jsxs("span",{className:"order-chip",children:["#",e.execution_order]})}),a&&s.jsx(Z,{tone:"gold",title:"Money moves only with your click",children:"$"}),f&&s.jsx(Z,{tone:"neutral",title:"This proposal was edited before approval",children:"edited"}),s.jsxs("span",{className:"action-head-right",children:[m!=null&&s.jsx(Q,{tip:"The agent's own confidence in this proposal. Low numbers deserve a closer look before you approve.",label:"What does the confidence number mean?",children:s.jsxs("span",{className:"confidence",children:[m,"% confident"]})}),s.jsx(sl,{status:e.status}),(o==null?void 0:o.idempotentNoop)&&s.jsx(Q,{tip:"The guard found it already done — nothing was double-executed.",label:"What is a no-op?",children:s.jsx(Z,{tone:"sage",children:"no-op (guard)"})})]})]}),s.jsx("div",{className:"action-summary",children:vh(e)}),e.policy_matched&&s.jsxs("div",{className:"action-policy",children:[s.jsx(Q,{tip:"The policy line the agent applied when proposing this action — traceable back to your policy book.",label:"What is the matched policy?",children:s.jsx("span",{className:"action-policy-label",children:"policy"})})," ",s.jsx("span",{className:"action-policy-text",children:e.policy_matched})]}),s.jsxs("div",{className:"action-body",children:[c&&s.jsxs("details",{className:"disclosure",children:[s.jsx("summary",{children:"Preview reply body"}),s.jsx("pre",{className:"reply-preview",children:c})]}),e.error_message&&s.jsxs("div",{className:"action-error",children:[s.jsx("strong",{children:"Failed:"})," ",e.error_message]}),(o==null?void 0:o.idempotentNoop)&&s.jsx("div",{className:"action-result",children:"Already done — the guard prevented double-execution. Nothing was charged or sent a second time."}),o&&!o.idempotentNoop&&e.status==="executed"&&s.jsxs("div",{className:"action-result",children:[o.message??"Executed successfully.",e.executed_at&&s.jsxs(s.Fragment,{children:[" · ",ye(e.executed_at)]})]}),s.jsxs("details",{className:"disclosure",children:[s.jsx("summary",{children:"Raw proposal JSON"}),f?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"micro-label",children:"Modified (this is what runs)"}),s.jsx($t,{data:f}),s.jsx("div",{className:"micro-label",children:"Original proposal"}),s.jsx($t,{data:h??{}})]}):s.jsx($t,{data:h??{}}),(o==null?void 0:o.raw)&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"micro-label",children:"Result"}),s.jsx($t,{data:o.raw})]})]}),u&&s.jsx("div",{className:"action-foot",children:s.jsx("button",{className:"btn btn-danger btn-sm",onClick:r,disabled:l,children:"Reject"})})]})]})}function md(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Do(e){return Array.isArray(e)?e.map(t=>md(t)??{}):[]}function Ch(e){return typeof e=="number"?Is(e):typeof e=="string"&&e!==""?e:null}function bh({ctx:e}){const t=xt(e);if(!t)return null;const n=md(t.stripe),r=n?Ch(n.ltv??n.lifetime_value??n.total_spent):null,l=n?typeof n.customer_id=="string"?n.customer_id:typeof n.customer=="string"?n.customer:null:null,i=n?Do(n.subscriptions):[],a=n?Do(n.recent_charges??n.charges):[];return s.jsxs("details",{className:"card side-details",open:!0,children:[s.jsxs("summary",{children:[s.jsx(H,{name:"dollar"}),"Customer enrichment"," ",s.jsx(Q,{tip:"Read from Stripe by the server, not by the agent — the agent can't fabricate this. Money proposals are checked against it.",label:"Where does enrichment come from?"})]}),s.jsxs("div",{className:"side-details-body",children:[!n&&s.jsx($t,{data:t}),n&&s.jsxs(s.Fragment,{children:[r&&s.jsxs("div",{className:"side-stat",children:[s.jsx("span",{className:"side-stat-label",children:"Lifetime value"}),s.jsx("span",{className:"side-stat-value",children:r})]}),l&&s.jsxs("div",{className:"side-stat",children:[s.jsx("span",{className:"side-stat-label",children:"Stripe customer"}),s.jsx("span",{className:"side-stat-value mono",children:Ve(l,22)})]}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"micro-label",children:"Subscriptions"}),s.jsx("div",{className:"side-list",children:i.map((o,c)=>{const u=typeof o.id=="string"?o.id:`sub ${c+1}`,m=typeof o.status=="string"?o.status:"unknown",f=typeof o.plan=="string"&&o.plan||typeof o.nickname=="string"&&o.nickname||typeof o.product=="string"&&o.product||null,h=o.current_period_end??o.period_end,y=o.cancel_at_period_end===!0;return s.jsxs("div",{className:"side-item",children:[s.jsxs("div",{className:"side-item-head",children:[s.jsx("span",{className:"mono",children:Ve(u,24)}),s.jsx(sl,{status:m})]}),s.jsxs("div",{className:"side-item-sub",children:[f&&s.jsxs(s.Fragment,{children:[f," · "]}),h!=null&&s.jsxs(s.Fragment,{children:[y?"ends":"renews"," ",Ao(h)]}),y&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Z,{tone:"amber",children:"cancels at period end"})]})]})]},u)})})]}),a.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"micro-label",children:"Recent charges"}),s.jsx("div",{className:"side-list",children:a.map((o,c)=>{const u=typeof o.id=="string"?o.id:`charge ${c+1}`,m=typeof o.amount=="number"?Is(o.amount,typeof o.currency=="string"?o.currency:void 0):null,f=o.refunded===!0,h=typeof o.amount_refunded=="number"&&o.amount_refunded>0&&!f;return s.jsxs("div",{className:"side-item",children:[s.jsxs("div",{className:"side-item-head",children:[s.jsx("span",{children:m??s.jsx("span",{className:"mono",children:Ve(u,20)})}),f?s.jsx(Z,{tone:"red",children:"refunded"}):h?s.jsx(Z,{tone:"amber",children:"partially refunded"}):s.jsx(Z,{tone:"green",children:typeof o.status=="string"?o.status:"paid"})]}),s.jsxs("div",{className:"side-item-sub",children:[s.jsx("span",{className:"mono",children:Ve(u,26)}),o.created!=null&&s.jsxs(s.Fragment,{children:[" · ",Ao(o.created)]})]})]},u)})})]})]})]})]})}function gd(e){const t=(e||"").toLowerCase();return t.includes("human")||t.includes("user")||t.includes("you")?{icon:"user",cls:"tl-icon-human"}:t.includes("agent")||t.includes("claude")||t.includes("llm")||t.includes("ai")?{icon:"agent",cls:"tl-icon-agent"}:{icon:"gear",cls:"tl-icon-system"}}function Eh({events:e}){return s.jsxs("div",{className:"card card-pad",children:[s.jsxs("div",{className:"card-title",children:[s.jsx(H,{name:"pulse"}),"Audit trail"]}),e.length===0&&s.jsx("div",{className:"side-item-sub",children:"No audit events for this case yet."}),s.jsx("div",{className:"timeline timeline-compact",children:e.map(t=>{const{icon:n,cls:r}=gd(t.actor);return s.jsxs("div",{className:"tl-item",children:[s.jsxs("div",{className:"tl-rail",children:[s.jsx("span",{className:`tl-icon ${r}`,title:t.actor,children:s.jsx(H,{name:n})}),s.jsx("span",{className:"tl-line"})]}),s.jsxs("div",{className:"tl-body",children:[s.jsxs("div",{className:"tl-head",children:[s.jsx("span",{className:"tl-event",children:t.event.replace(/_/g," ")}),t.phase&&s.jsx(Z,{tone:"neutral",children:t.phase}),s.jsx("span",{className:"tl-time",children:ye(t.at)})]}),t.detail&&s.jsx("div",{className:"tl-detail",title:t.detail,children:Ve(t.detail,140)})]})]},t.id)})})]})}function Ph({id:e}){var Yt,Sa,_a;const t=Ce(),{reloadStatus:n}=dt(),r=Oe(()=>R.getCase(e),[e]),l=Oe(()=>R.getAudit(e),[e]),[i,a]=N.useState(new Set),[o,c]=N.useState(""),[u,m]=N.useState(!1),[f,h]=N.useState(null),[y,v]=N.useState(null),[j,_]=N.useState(!1),[p,d]=N.useState(!1),[g,k]=N.useState(null),[C,b]=N.useState(""),[w,x]=N.useState([]),[L,M]=N.useState(!1),[W,ve]=N.useState(!1),$=r.data,hn=`${e}:${((Yt=$==null?void 0:$.draft)==null?void 0:Yt.id)??"none"}:${((Sa=$==null?void 0:$.draft)==null?void 0:Sa.version)??0}`;N.useEffect(()=>{var E;b(((E=$==null?void 0:$.draft)==null?void 0:E.body_english)??""),x([])},[hn]),N.useEffect(()=>{$&&c($.status)},[$==null?void 0:$.status]),N.useEffect(()=>{a(new Set),h(null),v(null)},[e]);const mn=N.useMemo(()=>[...($==null?void 0:$.actions)??[]].sort((E,I)=>E.execution_order-I.execution_order||E.id-I.id),[$==null?void 0:$.actions]),Ye=mn.filter(E=>E.status==="proposed"||E.status==="failed"),xe=Ye.filter(E=>i.has(E.id)),P=xe.filter(E=>Ci(E.action_type)),F=()=>{r.reload(),l.reload(),n()},A=(E,I,je,Kn)=>{const ll=E instanceof Os&&E.body?E.body.pending_financial:void 0;return E instanceof Os&&E.status===409&&(E.code==="pending_financial_actions"||ll!=null)?(h({pending:typeof ll=="number"?ll:0,verb:I,proceedLabel:je,retry:Kn}),window.scrollTo({top:0,behavior:"smooth"}),!0):!1},Y=async(E=!1)=>{if(o){m(!0);try{await R.setCaseStatus(e,o,E),h(null),t(`Case moved to “${o}”`,"success"),F()}catch(I){A(I,`move this case to “${o}”`,"Change status anyway",()=>void Y(!0))||t(I instanceof Error?I.message:"Failed to update status","error")}finally{m(!1)}}},se=async()=>{M(!0);try{const I=(await R.updateDraft(e,C)).warnings??[];x(I),t(I.length>0?"Draft saved — tone lint left some notes":"Draft saved",I.length>0?"warn":"success")}catch(E){t(E instanceof Error?E.message:"Failed to save draft","error")}finally{M(!1)}},Gt=async(E=!1)=>{if(!C.trim()){t("The draft is empty — nothing to send.","warn");return}if(!(!E&&!window.confirm(`Send this reply to ${($==null?void 0:$.customer_email)??"the customer"}?`))){ve(!0);try{const I=await R.sendReply(e,C,E);h(null),I.warning&&t(I.warning,"warn"),t("Reply sent","success"),F()}catch(I){A(I,"send this reply","Send anyway",()=>void Gt(!0))||t(I instanceof Error?I.message:"Failed to send reply","error")}finally{ve(!1)}}},ft=async()=>{_(!1),d(!0);try{const E=await R.executeActions(e,xe.map(Kn=>Kn.id));v(E);const I=E.results.filter(Kn=>Kn.success).length,je=E.results.length-I;t(je===0?`Executed ${I} action${I===1?"":"s"}`:`${I} succeeded, ${je} failed — see results`,je===0?"success":"warn"),a(new Set),F()}catch(E){t(E instanceof Error?E.message:"Execution failed","error")}finally{d(!1)}},Qn=async E=>{const I=window.prompt(`Reject “${un(E.action_type)}” — reason (optional):`,"");if(I!==null){k(E.id);try{await R.rejectAction(e,E.id,I.trim()||void 0),t("Action rejected","success"),F()}catch(je){t(je instanceof Error?je.message:"Failed to reject action","error")}finally{k(null)}}};if(r.loading&&!$)return s.jsx(st,{label:"Loading case…"});if(r.error)return s.jsx(Ge,{message:r.error,onRetry:r.reload});if(!$)return null;const pt=()=>{xe.length===Ye.length?a(new Set):a(new Set(Ye.map(E=>E.id)))};return s.jsxs(s.Fragment,{children:[s.jsx("a",{className:"back-link",href:"#/",children:"← Back to queue"}),s.jsx("div",{className:"case-head",children:s.jsxs("div",{className:"case-head-row",children:[s.jsxs("div",{className:"case-head-main",children:[s.jsx("h1",{children:$.subject||"(no subject)"}),s.jsxs("div",{className:"case-meta",children:[s.jsxs("span",{className:"mono",children:["case #",$.id]}),s.jsx("span",{className:"sep",children:"·"}),s.jsxs("span",{children:[$.customer_name||"Unknown"," ",$.customer_email&&s.jsxs("span",{className:"mono",children:["<",$.customer_email,">"]})]}),$.category&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sep",children:"·"}),s.jsx("span",{children:$.category})]}),s.jsx(dd,{status:$.status})]}),$.summary&&s.jsx("div",{className:"page-sub",children:$.summary})]}),s.jsxs("div",{className:"status-changer",children:[s.jsxs("select",{className:"select",value:o,onChange:E=>c(E.target.value),"aria-label":"Case status",children:[Io.map(E=>s.jsx("option",{value:E,children:E},E)),!Io.includes($.status)&&s.jsx("option",{value:$.status,children:$.status})]}),s.jsx("button",{className:"btn btn-secondary",onClick:()=>void Y(),disabled:u||o===$.status,children:u?"Applying…":"Apply"})]})]})}),(f||y)&&s.jsxs("div",{className:"case-alerts",children:[f&&s.jsx(Nh,{guard:f,onDismiss:()=>h(null)}),y&&s.jsx(Sh,{resp:y,actions:mn,onDismiss:()=>v(null)})]}),s.jsxs("div",{className:"case-grid",children:[s.jsxs("div",{className:"case-col-main",children:[s.jsxs("section",{className:"card card-pad",children:[s.jsxs("div",{className:"card-title",children:[s.jsx(H,{name:"mail"}),"Conversation"]}),$.emails.length===0?s.jsx("div",{className:"side-item-sub",children:"No emails on this case yet."}):s.jsx("div",{className:"thread",children:$.emails.map(E=>{const I=E.direction==="outbound";return s.jsxs("div",{className:`bubble ${I?"bubble-out":"bubble-in"}`,children:[s.jsxs("div",{className:"bubble-meta",children:[s.jsx("strong",{children:I?`To ${E.to_addr}`:E.from_addr}),E.subject&&E.subject!==$.subject&&s.jsxs("span",{children:["“",Ve(E.subject,60),"”"]}),s.jsx("span",{children:ye(E.received_at)})]}),s.jsx("pre",{className:"bubble-body",children:E.body_text})]},E.id)})})]}),s.jsxs("section",{className:"card card-pad",children:[s.jsxs("div",{className:"card-title",children:[s.jsx(H,{name:"book"}),"Draft reply"]}),$.draft==null&&!C?s.jsx("div",{className:"side-item-sub",children:"No draft yet — your agent hasn't proposed a reply for this case."}):s.jsxs(s.Fragment,{children:[s.jsx("textarea",{className:"input",value:C,onChange:E=>b(E.target.value),"aria-label":"Draft reply body",spellCheck:!0}),w.length>0&&s.jsx("div",{className:"warn-chips",children:w.map((E,I)=>s.jsxs("span",{className:"warn-chip",children:[s.jsx(H,{name:"alert",size:13}),E]},I))}),s.jsxs("div",{className:"draft-actions",children:[s.jsx("button",{className:"btn btn-primary",onClick:()=>void se(),disabled:L,children:L?"Saving…":"Save draft"}),s.jsxs("button",{className:"btn btn-secondary",onClick:()=>void Gt(),disabled:W||!C.trim(),children:[s.jsx(H,{name:"mail"}),W?"Sending…":"Send reply"]}),$.draft&&s.jsx(Q,{tip:`Draft version ${$.draft.version}, written by ${$.draft.created_by==="agent"?"the agent":"you"}. Saving your edit creates v${$.draft.version+1} and is recorded as a learning signal.`,label:"What does the draft byline mean?",children:s.jsxs("span",{className:"draft-byline",children:["v",$.draft.version," · drafted by ",$.draft.created_by]})})]})]})]}),s.jsxs("section",{id:"proposed-actions",children:[s.jsxs("div",{className:"actions-head",children:[s.jsxs("div",{className:"card-title",style:{margin:0},children:[s.jsx(H,{name:"bolt"}),"Proposed actions"]}),s.jsx("span",{className:"actions-head-note",children:"Nothing runs until you approve it."}),Ye.length>1&&s.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto"},onClick:pt,children:xe.length===Ye.length?"Clear selection":`Select all (${Ye.length})`})]}),mn.length===0?s.jsxs("div",{className:"empty-state",style:{padding:"28px 20px"},children:[s.jsx("div",{className:"empty-state-title",children:"No proposed actions"}),s.jsx("div",{className:"empty-state-body",children:"Your agent hasn't proposed anything for this case."})]}):s.jsx("div",{className:"action-list",children:mn.map(E=>s.jsx(_h,{action:E,checked:i.has(E.id),onToggle:()=>a(I=>{const je=new Set(I);return je.has(E.id)?je.delete(E.id):je.add(E.id),je}),onReject:()=>void Qn(E),busy:g===E.id},E.id))}),Ye.length>0&&s.jsxs("div",{className:"execute-bar",style:{marginTop:14},children:[s.jsxs("button",{className:"btn btn-primary",disabled:xe.length===0||p,onClick:()=>_(!0),children:[s.jsx(H,{name:"check"}),p?"Executing…":`Approve & execute (${xe.length})`]}),s.jsx(Q,{tip:"Runs the checked actions in order through the deterministic executor. This click is the only thing that moves money.",label:"What does approve and execute do?"}),s.jsx("span",{className:"execute-bar-note",children:P.length>0?`${P.length} money action${P.length===1?"":"s"} selected — money moves only with your click.`:"Actions run in order. Nothing happens without your approval."})]})]})]}),s.jsxs("div",{className:"case-col-side",children:[s.jsx(bh,{ctx:$.prepared_context}),l.error?s.jsx(Ge,{message:l.error,onRetry:l.reload}):s.jsx(Eh,{events:((_a=l.data)==null?void 0:_a.audit)??[]})]})]}),j&&s.jsxs(oh,{title:`Approve & execute ${xe.length} action${xe.length===1?"":"s"}`,onClose:()=>_(!1),footer:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-secondary",onClick:()=>_(!1),children:"Cancel"}),s.jsxs("button",{className:"btn btn-primary",onClick:()=>void ft(),children:["Run ",xe.length," action",xe.length===1?"":"s"]})]}),children:[s.jsx("div",{children:"This will run, in order:"}),s.jsx("ol",{className:"run-list",children:xe.map((E,I)=>s.jsxs("li",{children:[s.jsx("span",{className:"run-num",children:I+1}),s.jsx("span",{className:Ci(E.action_type)?"run-money":"",children:xh(E)})]},E.id))}),P.length>0&&s.jsx("div",{className:"modal-note",children:"Gold items move real money. Each runs exactly once — the idempotency guard prevents double-execution."})]})]})}function dn(e){if(!e)return"local secret store";const t=e.toLowerCase();return t.includes("keychain")?"macOS Keychain":t.includes("libsecret")||t.includes("gnome")?"libsecret (GNOME Keyring)":t.includes("wincred")||t.includes("windows")?"Windows Credential Manager":t.includes("file")?"encrypted local file":e}function Ds({children:e}){return s.jsxs("div",{className:"warn-banner",role:"alert",children:[s.jsx(H,{name:"alert"}),s.jsx("div",{children:e})]})}const Lh={"paste-a-key":s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:"Paste-a-key"})," — you create a scoped credential yourself and paste it into this local form. It goes straight into your OS keychain; the ClearHand server reads it just-in-time and every read is logged below. Works offline, depends on nobody.",s.jsx("br",{}),s.jsx("br",{}),s.jsx("strong",{children:"One-click"})," (planned) — an OAuth install (a Stripe App install, or a Google consent screen) instead of handling a key. Tokens land in the same keychain. For Stripe this routes through a small broker at connect.clearhand.help that exchanges tokens and stores nothing — and paste-a-key stays available forever as the fallback."]})};function ka({name:e,icon:t,connected:n,health:r,method:l,children:i}){return s.jsxs("div",{className:"card card-pad",children:[s.jsxs("div",{className:"connector-head",children:[s.jsx("span",{className:`dot ${n?"dot-green":"dot-faint"}`}),s.jsx(H,{name:t}),s.jsx("span",{className:"connector-name",children:e}),l&&s.jsx(Q,{tip:Lh["paste-a-key"],label:"How does this connector attach?",wide:!0,children:s.jsx("span",{className:"method-badge",children:l})}),n?r?s.jsx(sl,{status:r}):s.jsx(Z,{tone:"green",children:"connected"}):s.jsx(Z,{tone:"neutral",children:"not connected"})]}),i]})}function ot({k:e,children:t}){return s.jsxs("div",{className:"kv-row",children:[s.jsx("span",{className:"kv-key",children:e}),s.jsx("span",{className:"kv-val",children:t})]})}function Mh({onChanged:e}){const{status:t}=dt(),n=Ce(),r=t==null?void 0:t.connections.stripe,[l,i]=N.useState(""),[a,o]=N.useState(!1),[c,u]=N.useState(null),[m,f]=N.useState(null),h=async j=>{j.preventDefault(),o(!0),u(null);try{const _=await R.connectStripe(l.trim());f(_.warning??null),i(""),n(_.key_type?`Stripe connected (${_.key_type} key)`:"Stripe connected",_.warning?"warn":"success"),e()}catch(_){u(_ instanceof Error?_.message:"Failed to connect Stripe")}finally{o(!1)}},y=async()=>{if(window.confirm("Disconnect Stripe? The stored key will be removed."))try{await R.disconnect("stripe"),n("Stripe disconnected","success"),f(null),e()}catch(j){n(j instanceof Error?j.message:"Failed to disconnect","error")}},v=(r==null?void 0:r.key_type)!=null&&!/restrict/i.test(r.key_type);return s.jsxs(ka,{name:"Stripe",method:"paste-a-key",icon:"dollar",connected:(r==null?void 0:r.connected)??!1,health:r==null?void 0:r.health,children:[m&&s.jsx(Ds,{children:m}),r!=null&&r.connected?s.jsxs(s.Fragment,{children:[v&&s.jsxs(Ds,{children:["This looks like a ",s.jsx("strong",{children:"full-access key"}),". ClearHand only needs a restricted key with: customers:read, charges:read, refunds:write, subscriptions:write, invoices:read. Consider rotating."]}),r.account_hint&&s.jsx(ot,{k:"Account",children:s.jsx("span",{className:"mono",children:r.account_hint})}),r.secret_hint&&s.jsxs(ot,{k:"Key",children:[s.jsx("span",{className:"mono",children:r.secret_hint}),r.key_type&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Z,{tone:/restrict/i.test(r.key_type)?"green":"amber",children:r.key_type})]})]}),s.jsx(ot,{k:"Stored in",children:s.jsxs(Z,{tone:"green",children:[s.jsx(H,{name:"lock",size:11}),dn(r.storage??(t==null?void 0:t.secret_storage))]})}),r.last_verified&&s.jsx(ot,{k:"Verified",children:ye(r.last_verified)}),s.jsx("div",{className:"connector-foot",children:s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>void y(),children:"Disconnect"})})]}):s.jsxs("form",{onSubmit:j=>void h(j),children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"stripe-key",children:"Secret API key"}),s.jsx("input",{id:"stripe-key",className:"input",type:"password",autoComplete:"off",placeholder:"rk_live_…",value:l,onChange:j=>i(j.target.value),required:!0}),s.jsxs("span",{className:"field-hint",children:["Use a"," ",s.jsx(Q,{tip:"A Stripe key limited to exactly five scopes: read customers, charges, and invoices; execute refunds and subscription changes only after your click. It cannot do anything else, even if leaked.",label:"What is a restricted key?",children:s.jsx("strong",{children:"restricted key"})})," ","with exactly these scopes:"," ",s.jsx("span",{className:"mono",children:"customers:read, charges:read, refunds:write, subscriptions:write, invoices:read"}),". ClearHand never needs more."]})]}),c&&s.jsx("div",{className:"form-error",children:c}),s.jsx("div",{className:"connector-foot",children:s.jsx("button",{className:"btn btn-primary",disabled:a||l.trim()==="",children:a?"Connecting…":"Connect Stripe"})})]})]})}function Th({onChanged:e}){const{status:t}=dt(),n=Ce(),r=t==null?void 0:t.connections.mailbox,[l,i]=N.useState(""),[a,o]=N.useState(""),[c,u]=N.useState(""),[m,f]=N.useState(""),[h,y]=N.useState(""),[v,j]=N.useState(""),[_,p]=N.useState(""),[d,g]=N.useState(!1),[k,C]=N.useState(null),[b,w]=N.useState(null),x=async M=>{M.preventDefault(),g(!0),C(null);try{const W=await R.connectMailbox({address:l.trim(),password:a,...c.trim()?{imapHost:c.trim()}:{},...m.trim()?{imapPort:Number(m)}:{},...h.trim()?{smtpHost:h.trim()}:{},...v.trim()?{smtpPort:Number(v)}:{},..._.trim()?{displayName:_.trim()}:{}});w(W.warning??null),o(""),n("Mailbox connected",W.warning?"warn":"success"),e()}catch(W){C(W instanceof Error?W.message:"Failed to connect mailbox")}finally{g(!1)}},L=async()=>{if(window.confirm("Disconnect the mailbox? The stored password will be removed."))try{await R.disconnect("mailbox"),n("Mailbox disconnected","success"),w(null),e()}catch(M){n(M instanceof Error?M.message:"Failed to disconnect","error")}};return s.jsxs(ka,{name:"Mailbox",method:"paste-a-key",icon:"mail",connected:(r==null?void 0:r.connected)??!1,health:r==null?void 0:r.health,children:[b&&s.jsx(Ds,{children:b}),r!=null&&r.connected?s.jsxs(s.Fragment,{children:[r.address&&s.jsx(ot,{k:"Address",children:s.jsx("span",{className:"mono",children:r.address})}),s.jsx(ot,{k:"Stored in",children:s.jsxs(Z,{tone:"green",children:[s.jsx(H,{name:"lock",size:11}),dn(r.storage??(t==null?void 0:t.secret_storage))]})}),r.last_verified&&s.jsx(ot,{k:"Verified",children:ye(r.last_verified)}),s.jsx("div",{className:"connector-foot",children:s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>void L(),children:"Disconnect"})})]}):s.jsxs("form",{onSubmit:M=>void x(M),children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"mb-address",children:"Support address"}),s.jsx("input",{id:"mb-address",className:"input",type:"email",placeholder:"support@yourcompany.com",value:l,onChange:M=>i(M.target.value),required:!0})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"mb-password",children:"App password"}),s.jsx("input",{id:"mb-password",className:"input",type:"password",autoComplete:"off",value:a,onChange:M=>o(M.target.value),required:!0}),s.jsx("span",{className:"field-hint",children:"Use an app-specific password, not your account password."})]}),s.jsxs("details",{className:"disclosure",children:[s.jsx("summary",{children:"Advanced — hosts & ports"}),s.jsxs("div",{style:{marginTop:10},children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"mb-imap-host",children:"IMAP host"}),s.jsx("input",{id:"mb-imap-host",className:"input",placeholder:"imap.yourprovider.com",value:c,onChange:M=>u(M.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"mb-imap-port",children:"IMAP port"}),s.jsx("input",{id:"mb-imap-port",className:"input",inputMode:"numeric",placeholder:"993",value:m,onChange:M=>f(M.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"mb-smtp-host",children:"SMTP host"}),s.jsx("input",{id:"mb-smtp-host",className:"input",placeholder:"smtp.yourprovider.com",value:h,onChange:M=>y(M.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"mb-smtp-port",children:"SMTP port"}),s.jsx("input",{id:"mb-smtp-port",className:"input",inputMode:"numeric",placeholder:"465",value:v,onChange:M=>j(M.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"mb-display",children:"Display name"}),s.jsx("input",{id:"mb-display",className:"input",placeholder:"Acme Support",value:_,onChange:M=>p(M.target.value)})]})]})]}),k&&s.jsx("div",{className:"form-error",children:k}),s.jsx("div",{className:"connector-foot",children:s.jsx("button",{className:"btn btn-primary",disabled:d||!l.trim()||!a,children:d?"Connecting…":"Connect mailbox"})})]})]})}function $h({onChanged:e}){const{status:t}=dt(),n=Ce(),r=t==null?void 0:t.connections.github,[l,i]=N.useState(""),[a,o]=N.useState(""),[c,u]=N.useState(!1),[m,f]=N.useState(null),[h,y]=N.useState(null),v=async _=>{_.preventDefault(),u(!0),f(null);try{const p=await R.connectGithub(l.trim(),a.trim());y(p.warning??null),i(""),n("GitHub connected",p.warning?"warn":"success"),e()}catch(p){f(p instanceof Error?p.message:"Failed to connect GitHub")}finally{u(!1)}},j=async()=>{if(window.confirm("Disconnect GitHub? The stored token will be removed."))try{await R.disconnect("github"),n("GitHub disconnected","success"),y(null),e()}catch(_){n(_ instanceof Error?_.message:"Failed to disconnect","error")}};return s.jsxs(ka,{name:"GitHub",method:"paste-a-key",icon:"github",connected:(r==null?void 0:r.connected)??!1,health:r==null?void 0:r.health,children:[h&&s.jsx(Ds,{children:h}),r!=null&&r.connected?s.jsxs(s.Fragment,{children:[r.repo&&s.jsx(ot,{k:"Repository",children:s.jsx("span",{className:"mono",children:r.repo})}),s.jsx(ot,{k:"Stored in",children:s.jsxs(Z,{tone:"green",children:[s.jsx(H,{name:"lock",size:11}),dn(r.storage??(t==null?void 0:t.secret_storage))]})}),r.last_verified&&s.jsx(ot,{k:"Verified",children:ye(r.last_verified)}),s.jsx("div",{className:"connector-foot",children:s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>void j(),children:"Disconnect"})})]}):s.jsxs("form",{onSubmit:_=>void v(_),children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"gh-token",children:"Personal access token"}),s.jsx("input",{id:"gh-token",className:"input",type:"password",autoComplete:"off",placeholder:"github_pat_…",value:l,onChange:_=>i(_.target.value),required:!0}),s.jsx("span",{className:"field-hint",children:"A fine-grained token with issue write access to one repo is enough."})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"gh-repo",children:"Repository"}),s.jsx("input",{id:"gh-repo",className:"input",placeholder:"owner/repo",value:a,onChange:_=>o(_.target.value),required:!0})]}),m&&s.jsx("div",{className:"form-error",children:m}),s.jsx("div",{className:"connector-foot",children:s.jsx("button",{className:"btn btn-primary",disabled:c||!l.trim()||!a.trim(),children:c?"Connecting…":"Connect GitHub"})})]})]})}function Rh(){var m,f,h;const{status:e,reloadStatus:t}=dt(),n=Oe(()=>R.getTrust(),[]),[r,l]=N.useState(!1),i=()=>{t(),n.reload()},a=((m=n.data)==null?void 0:m.secret_storage)??(e==null?void 0:e.secret_storage),o=((f=n.data)==null?void 0:f.secret_access_log)??[],c=r?o:o.slice(0,20),u=(h=n.data)==null?void 0:h.telemetry;return s.jsxs(s.Fragment,{children:[s.jsx("header",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{children:"Connections & Trust"}),s.jsx("div",{className:"page-sub",children:"What ClearHand can touch, where secrets live, and every time they were used."})]})}),s.jsxs("div",{className:"storage-banner",children:[s.jsx(H,{name:"lock"}),s.jsxs("div",{children:[s.jsxs("div",{className:"storage-banner-title",children:["Secrets live in: ",s.jsx("span",{className:"mono",children:dn(a)})," ",s.jsx(Q,{tip:"Keys live in your OS keychain and are decrypted just-in-time, per action. Every read lands in the access log below.",label:"How are secrets stored?"})]}),s.jsx("div",{className:"storage-banner-sub",children:"API keys never sit in plain text in your repo or config. Your agent can use them — every read is logged in the access log below."})]})]}),s.jsxs("div",{className:"connector-grid",children:[s.jsx(Mh,{onChanged:i}),s.jsx(Th,{onChanged:i}),s.jsx($h,{onChanged:i})]}),n.loading&&!n.data&&s.jsx(st,{label:"Loading trust data…"}),n.error&&s.jsx(Ge,{message:n.error,onRetry:n.reload}),n.data&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"section-title",children:["Where your secrets live"," ",s.jsx(Q,{tip:"Only masked hints are shown here. Every server response passes a redaction filter, so a stored secret can never appear in this UI or in logs.",label:"Why only hints?"})]}),s.jsx("div",{className:"card",children:n.data.secrets.length===0?s.jsx("div",{className:"card-pad side-item-sub",children:"No secrets stored yet."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Secret"}),s.jsx("th",{children:"Backend"}),s.jsx("th",{children:"Hint"}),s.jsx("th",{children:"Updated"})]})}),s.jsx("tbody",{children:n.data.secrets.map(y=>s.jsxs("tr",{children:[s.jsx("td",{className:"mono",children:y.key}),s.jsx("td",{children:s.jsxs(Z,{tone:"green",children:[s.jsx(H,{name:"lock",size:11}),dn(y.backend)]})}),s.jsx("td",{className:"mono",children:y.hint}),s.jsx("td",{children:ye(y.updatedAt)})]},y.key))})]})})}),s.jsxs("div",{className:"section-title",children:["Secret access log"," ",s.jsx(Q,{tip:"Every time a stored secret was read — when, which key, for what purpose, and the case or action it served.",label:"What is the access log?"})]}),s.jsx("div",{className:"card",children:o.length===0?s.jsx("div",{className:"card-pad side-item-sub",children:"No secret reads yet. Every time ClearHand uses a stored secret, it lands here."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"When"}),s.jsx("th",{children:"Secret"}),s.jsx("th",{children:"Purpose"}),s.jsx("th",{children:"Ref"})]})}),s.jsx("tbody",{children:c.map(y=>s.jsxs("tr",{children:[s.jsx("td",{title:y.at,children:sh(y.at)}),s.jsx("td",{className:"mono",children:y.secret_key}),s.jsx("td",{children:y.purpose}),s.jsx("td",{className:"mono",children:y.ref})]},y.id))})]})}),o.length>20&&s.jsx("div",{className:"table-caption",children:s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>l(y=>!y),children:r?"Show recent 20":`Show all (${o.length})`})})]})}),s.jsxs("div",{className:"section-title",children:["Egress ledger"," ",s.jsx(Q,{tip:"Every host this server has ever contacted. Verify it yourself from a terminal: lsof -i -a -p <pid>.",label:"What is the egress ledger?"})]}),s.jsxs("div",{className:"card",children:[n.data.egress.length===0?s.jsx("div",{className:"card-pad side-item-sub",children:"No outbound connections yet."}):s.jsx("div",{className:"table-wrap",children:s.jsxs("table",{className:"table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Host"}),s.jsx("th",{children:"Purpose"}),s.jsx("th",{children:"Count"}),s.jsx("th",{children:"Last contact"})]})}),s.jsx("tbody",{children:n.data.egress.map(y=>s.jsxs("tr",{children:[s.jsx("td",{className:"mono",children:y.host}),s.jsx("td",{children:y.purpose}),s.jsx("td",{children:y.count}),s.jsx("td",{title:y.last_at,children:ye(y.last_at)})]},`${y.host}-${y.purpose}`))})]})}),s.jsxs("div",{className:"table-caption",children:["ClearHand has contacted exactly these hosts. Verify independently:"," ",s.jsx("code",{children:"lsof -i -a -p <pid>"})]})]}),s.jsx("div",{className:"section-title",children:"Telemetry"}),s.jsxs("div",{className:"telemetry-card",children:[s.jsx(H,{name:"shield",size:20}),s.jsxs("div",{children:[s.jsx("div",{className:"telemetry-card-title",children:"No telemetry"}),s.jsx("div",{className:"telemetry-card-body",children:typeof u=="string"&&u!==""?u:"ClearHand never phones home. No analytics, no crash reports, no usage pings. The egress ledger above is the complete list of hosts this install has contacted."})]})]})]})]})}const yd=[{value:"fine",label:"Looks right",kind:"fine"},{value:"edited",label:"I'd edit",kind:"bad"},{value:"wrong_policy",label:"Wrong policy",kind:"bad"},{value:"wrong_facts",label:"Wrong facts",kind:"bad"},{value:"wrong_tone",label:"Wrong tone",kind:"bad"}];function Ho(e){var t;return((t=yd.find(n=>n.value===e))==null?void 0:t.label)??e.replace(/_/g," ")}function Fh(e){return e==="fine"?"green":e==="edited"?"amber":"red"}function vd({cal:e,onReviewed:t}){const n=Ce(),[r,l]=N.useState(""),[i,a]=N.useState(null),o=e.verdict!=null&&e.verdict!=="",c=async u=>{a(u);try{await R.reviewCalibration(e.id,u,r.trim()||void 0),n(`Marked “${Ho(u)}”`,"success"),t()}catch(m){n(m instanceof Error?m.message:"Failed to save review","error")}finally{a(null)}};return s.jsxs("div",{className:"card card-pad cal-card",children:[s.jsxs("div",{className:"cal-meta",children:[s.jsxs("span",{className:"mono",children:["#",e.id]}),s.jsxs("span",{children:["created ",ye(e.created_at)]}),e.context_note&&s.jsxs("span",{children:["· ",e.context_note]}),o&&e.reviewed_at&&s.jsxs("span",{children:["· reviewed ",ye(e.reviewed_at)]})]}),s.jsxs("div",{className:"cal-customer",children:[s.jsx("div",{className:"cal-label",children:"Customer wrote"}),s.jsx("pre",{className:"cal-text",children:e.customer_message})]}),s.jsxs("div",{className:"cal-cols",children:[s.jsxs("div",{className:"cal-col cal-col-clearhand",children:[s.jsx("div",{className:"cal-label",children:"ClearHand would have sent"}),s.jsx("pre",{className:"cal-text",children:e.clearhand_draft})]}),s.jsxs("div",{className:"cal-col",children:[s.jsx("div",{className:"cal-label",children:"You actually sent"}),e.actual_reply?s.jsx("pre",{className:"cal-text",children:e.actual_reply}):s.jsx("div",{className:"side-item-sub",children:"No reply of yours on record for this one."})]})]}),o?s.jsxs("div",{className:"cal-reviewed",children:[s.jsx(Z,{tone:Fh(e.verdict),children:Ho(e.verdict)}),e.note&&s.jsxs("span",{children:["“",e.note,"”"]})]}):s.jsxs("div",{className:"cal-review",children:[yd.map(u=>s.jsx("button",{className:`verdict-btn v-${u.kind}`,disabled:i!=null,onClick:()=>void c(u.value),children:i===u.value?"Saving…":u.label},u.value)),s.jsx(Q,{tip:"Your verdict is learning-loop input. The wrong-policy, wrong-facts, and wrong-tone verdicts become overlay fixes — your agent folds them into the policy book before anything goes live.",label:"What do verdicts do?"}),s.jsx("input",{className:"input cal-note-input",placeholder:"Optional note…",value:r,onChange:u=>l(u.target.value),"aria-label":"Optional review note"})]})]})}function Ah(){var r;const e=Oe(()=>R.getCalibrations(),[]),t=((r=e.data)==null?void 0:r.calibrations)??[],n=t.filter(l=>l.verdict!=null&&l.verdict!=="").length;return s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"page-head",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"Calibration"}),s.jsx("div",{className:"page-sub",children:"Shadow drafts against emails you already answered — teach ClearHand your voice before it touches a real customer."})]}),t.length>0&&s.jsxs("div",{className:"page-head-actions",style:{alignItems:"center"},children:[s.jsxs("span",{className:"page-sub",style:{marginTop:0},children:[n," of ",t.length," reviewed"]}),s.jsx("div",{className:"progress-track","aria-hidden":"true",children:s.jsx("div",{className:"progress-fill",style:{width:`${t.length===0?0:n/t.length*100}%`}})})]})]}),e.loading&&!e.data&&s.jsx(st,{label:"Loading calibrations…"}),e.error&&s.jsx(Ge,{message:e.error,onRetry:e.reload}),e.data&&t.length===0&&s.jsx(cn,{title:"No calibration pairs yet",children:"Your agent creates calibration pairs during onboarding by drafting against emails you already answered. Once they exist, you review them here — no customer ever sees a calibration draft."}),t.map(l=>s.jsx(vd,{cal:l,onReviewed:e.reload},l.id))]})}const Uo={"voice.md":"How replies sound — greeting, sign-off, sentence length, languages.","policies.md":"What we do — refunds, cancellations, escalation triggers, and your behavior contract, verbatim.","products.md":"Facts the agent may state — products, plans, prices, sources.","escalation.md":"When a human gets looped in instead of the agent acting.","tone-lint.json":"Mechanical tone rules enforced on every draft before it can send."};function zh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function nr(e){let t=zh(e);return t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t=t.replace(/(^|[\s(])\*([^*\s][^*]*)\*/g,"$1<em>$2</em>"),t=t.replace(/\[([^\]]+)\]\((https?:[^)\s]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),t}function Oh(e){const t=e.replace(/\r\n/g,`
41
+ `).split(`
42
+ `),n=[];let r=0,l=0;for(;r<t.length;){const i=t[r];if(i.trim()===""){r+=1;continue}if(/^```/.test(i)){const c=[];for(r+=1;r<t.length&&!/^```/.test(t[r]);)c.push(t[r]),r+=1;r+=1,n.push(s.jsx("pre",{children:s.jsx("code",{children:c.join(`
43
+ `)})},l++));continue}const a=/^(#{1,4})\s+(.*)$/.exec(i);if(a){const c=a[1].length,u={__html:nr(a[2])};c===1?n.push(s.jsx("h1",{dangerouslySetInnerHTML:u},l++)):c===2?n.push(s.jsx("h2",{dangerouslySetInnerHTML:u},l++)):c===3?n.push(s.jsx("h3",{dangerouslySetInnerHTML:u},l++)):n.push(s.jsx("h4",{dangerouslySetInnerHTML:u},l++)),r+=1;continue}if(/^(-{3,}|\*{3,})\s*$/.test(i)){n.push(s.jsx("hr",{},l++)),r+=1;continue}if(/^>\s?/.test(i)){const c=[];for(;r<t.length&&/^>\s?/.test(t[r]);)c.push(t[r].replace(/^>\s?/,"")),r+=1;n.push(s.jsx("blockquote",{dangerouslySetInnerHTML:{__html:nr(c.join(" "))}},l++));continue}if(/^\s*[-*+]\s+/.test(i)){const c=[];for(;r<t.length&&/^\s*[-*+]\s+/.test(t[r]);)c.push(t[r].replace(/^\s*[-*+]\s+/,"")),r+=1;n.push(s.jsx("ul",{children:c.map((u,m)=>s.jsx("li",{dangerouslySetInnerHTML:{__html:nr(u)}},m))},l++));continue}if(/^\s*\d+[.)]\s+/.test(i)){const c=[];for(;r<t.length&&/^\s*\d+[.)]\s+/.test(t[r]);)c.push(t[r].replace(/^\s*\d+[.)]\s+/,"")),r+=1;n.push(s.jsx("ol",{children:c.map((u,m)=>s.jsx("li",{dangerouslySetInnerHTML:{__html:nr(u)}},m))},l++));continue}const o=[i];for(r+=1;r<t.length&&t[r].trim()!==""&&!/^(#{1,4}\s|```|>\s?|\s*[-*+]\s+|\s*\d+[.)]\s+|-{3,}\s*$)/.test(t[r]);)o.push(t[r]),r+=1;n.push(s.jsx("p",{dangerouslySetInnerHTML:{__html:nr(o.join(" "))}},l++))}return n}function Ih({name:e}){const t=Oe(()=>R.getOverlayFile(e),[e]);if(t.loading&&!t.data)return s.jsx(st,{label:`Loading ${e}…`});if(t.error)return s.jsx(Ge,{message:t.error,onRetry:t.reload});if(!t.data)return null;const n=/\.(md|markdown)$/i.test(e),r=/\.json$/i.test(e);return s.jsx("div",{className:"card doc-view",children:n?Oh(t.data.content):s.jsx("pre",{children:r?ud(t.data.content):t.data.content})})}function Dh(){var l;const e=Oe(()=>R.getOverlay(),[]),[t,n]=N.useState(null),r=((l=e.data)==null?void 0:l.files)??[];return N.useEffect(()=>{if(t==null&&r.length>0){const i=r.find(a=>a.exists);i&&n(i.name)}},[r,t]),s.jsxs(s.Fragment,{children:[s.jsx("header",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{children:"Policy Book"}),s.jsx("div",{className:"page-sub",children:"The rules your agent follows — refund limits, tone, escalation paths."})]})}),s.jsxs("div",{className:"overlay-banner",children:[s.jsx(H,{name:"book"}),s.jsxs("div",{children:["These files are yours. Edit them in your repo at"," ",s.jsx("code",{children:".clearhand/overlay/"})," — or just tell your agent what to change."]})]}),e.loading&&!e.data&&s.jsx(st,{label:"Loading policy files…"}),e.error&&s.jsx(Ge,{message:e.error,onRetry:e.reload}),e.data&&r.length===0&&s.jsxs(cn,{title:"No overlay files yet",children:["Your agent will create policy files in ",s.jsx("code",{children:".clearhand/overlay/"})," during onboarding."]}),r.length>0&&s.jsxs("div",{className:"overlay-grid",children:[s.jsx("div",{children:r.map(i=>s.jsxs("button",{className:`file-item${t===i.name?" active":""}${i.exists?"":" missing"}`,onClick:()=>i.exists&&n(i.name),"aria-disabled":!i.exists,children:[s.jsxs("div",{className:"file-name",children:[i.name,Uo[i.name]&&s.jsx(Q,{tip:Uo[i.name],label:`What is ${i.name}?`})]}),s.jsx("div",{className:"file-meta",children:i.exists?`${lh(i.bytes)} · modified ${ye(i.modifiedAt)}`:"not created yet"})]},i.name))}),s.jsx("div",{children:t?s.jsx(Ih,{name:t}):s.jsx(cn,{title:"Pick a file",children:"Select a policy file on the left to read it."})})]})]})}const Wo=60,Hh={proposed:"amber",approved:"green",applied:"green",rejected:"neutral"};function Uh({review:e,onResolved:t}){const n=Ce(),[r,l]=N.useState(null),i=async o=>{l(o);try{await R.resolveLearningReview(e.id,o),n(o==="approved"?`Approved — your agent will apply this to ${e.target_file}`:"Rejected — the rule will not be applied","success"),t()}catch(c){n(c instanceof Error?c.message:"Could not resolve the proposal","error")}finally{l(null)}},a=e.status!=="proposed";return s.jsxs("div",{className:`card lr-card${a?" lr-settled":""}`,children:[s.jsxs("div",{className:"lr-head",children:[s.jsx(Z,{tone:Hh[e.status],children:e.status}),e.category&&s.jsx("span",{className:"lr-category",children:e.category}),s.jsxs("span",{className:"lr-target mono",children:["→ ",e.target_file,e.target_section?` § ${e.target_section}`:""]}),e.case_id!=null&&s.jsxs("a",{href:`#/case/${e.case_id}`,className:"mono",children:["case #",e.case_id]}),s.jsx("span",{className:"tl-time",style:{marginLeft:"auto"},title:e.created_at,children:ye(e.created_at)})]}),s.jsx("blockquote",{className:"lr-rule",children:e.proposed_rule}),e.status==="proposed"&&s.jsxs("div",{className:"lr-actions",children:[s.jsx("button",{className:"btn btn-primary btn-sm",disabled:r!=null,onClick:()=>void i("approved"),children:r==="approved"?"Approving…":"Approve"}),s.jsx("button",{className:"btn btn-danger btn-sm",disabled:r!=null,onClick:()=>void i("rejected"),children:r==="rejected"?"Rejecting…":"Reject"}),s.jsx("span",{className:"lr-note",children:"Approving does not edit the file — your agent applies it and reports back."})]}),e.status==="approved"&&s.jsxs("div",{className:"lr-note",children:["approved — your agent will apply this to"," ",s.jsx("span",{className:"mono",children:e.target_file})]}),e.status==="applied"&&s.jsxs("div",{className:"lr-note",children:["applied to ",s.jsx("span",{className:"mono",children:e.target_file}),e.resolved_at?` · ${ye(e.resolved_at)}`:""]})]})}function Wh(){var l;const e=Oe(()=>R.getLearningReviews(),[]),t=((l=e.data)==null?void 0:l.reviews)??[],n=[...t].sort((i,a)=>{const o=c=>c.status==="proposed"?0:1;return o(i)-o(a)||a.id-i.id}),r=t.filter(i=>i.status==="proposed").length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"section-title",children:["Rule proposals",r>0?` (${r} waiting)`:""," ",s.jsx(Q,{tip:"The human gate of the learning loop — nothing changes the policy book without your approval here.",label:"What are rule proposals?"})]}),e.loading&&!e.data&&s.jsx(st,{label:"Loading rule proposals…"}),e.error&&s.jsx(Ge,{message:e.error,onRetry:e.reload}),e.data&&t.length===0&&s.jsx(cn,{title:"No rule proposals yet",children:"When you correct the agent repeatedly, it proposes a rule here for your approval."}),n.map(i=>s.jsx(Uh,{review:i,onResolved:e.reload},i.id))]})}function Vh(){var o,c;const e=Oe(()=>R.getAudit(),[]),t=Oe(()=>R.getFeedback(),[]),[n,r]=N.useState(Wo),l=((o=e.data)==null?void 0:o.audit)??[],i=l.slice(0,n),a=((c=t.data)==null?void 0:c.events)??[];return s.jsxs(s.Fragment,{children:[s.jsx("header",{className:"page-head",children:s.jsxs("div",{children:[s.jsx("h1",{children:"Activity"}),s.jsx("div",{className:"page-sub",children:"Everything ClearHand and your agent have done, in one auditable stream."})]})}),s.jsx(Wh,{}),s.jsx("div",{className:"section-title",children:"Audit stream"}),e.loading&&!e.data&&s.jsx(st,{label:"Loading activity…"}),e.error&&s.jsx(Ge,{message:e.error,onRetry:e.reload}),e.data&&l.length===0&&s.jsx(cn,{title:"No activity yet",children:"As soon as your agent processes a case — or you approve an action — it shows up here."}),i.length>0&&s.jsxs("div",{className:"card card-pad",children:[s.jsx("div",{className:"timeline",children:i.map(u=>{const{icon:m,cls:f}=gd(u.actor),h=xt(u.detail);return s.jsxs("div",{className:"tl-item",children:[s.jsxs("div",{className:"tl-rail",children:[s.jsx("span",{className:`tl-icon ${f}`,title:u.actor,children:s.jsx(H,{name:m})}),s.jsx("span",{className:"tl-line"})]}),s.jsxs("div",{className:"tl-body",children:[s.jsxs("div",{className:"tl-head",children:[s.jsx("span",{className:"tl-event",children:u.event.replace(/_/g," ")}),u.phase&&s.jsx(Z,{tone:"neutral",children:u.phase}),u.case_id!=null&&s.jsxs("a",{href:`#/case/${u.case_id}`,className:"mono",children:["case #",u.case_id]}),s.jsx("span",{className:"tl-time",title:u.at,children:ye(u.at)})]}),u.detail&&(h?s.jsxs("details",{className:"disclosure",children:[s.jsx("summary",{children:"Detail"}),s.jsx($t,{data:h})]}):s.jsx("div",{className:"tl-detail",children:Ve(u.detail,200)}))]})]},u.id)})}),l.length>n&&s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>r(u=>u+Wo),children:["Show more (",l.length-n," older)"]})]}),s.jsx("div",{className:"section-title",children:"Learning signals"}),t.loading&&!t.data&&s.jsx(st,{label:"Loading signals…"}),t.error&&s.jsx(Ge,{message:t.error,onRetry:t.reload}),t.data&&a.length===0&&s.jsx(cn,{title:"No learning signals yet",children:"When you edit a draft, modify a proposal, or reject an action, ClearHand records the difference so your agent can fold it back into the policy book."}),a.length>0&&s.jsx("div",{className:"case-list",children:a.map(u=>{const m=xt(u.original_json),f=xt(u.modified_json);return s.jsxs("div",{className:"card signal-card",children:[s.jsxs("div",{className:"signal-head",children:[s.jsx(Z,{tone:"sage",children:u.event_type.replace(/_/g," ")}),s.jsx("span",{className:"tl-time",style:{marginLeft:"auto"},title:u.created_at,children:ye(u.created_at)})]}),u.diff_summary&&s.jsx("div",{className:"signal-summary",children:u.diff_summary}),(m||f)&&s.jsxs("details",{className:"disclosure",children:[s.jsx("summary",{children:"Before / after"}),s.jsxs("div",{className:"signal-diff-grid",children:[s.jsxs("div",{children:[s.jsx("div",{className:"micro-label",children:"Original"}),s.jsx($t,{data:m??{}})]}),s.jsxs("div",{children:[s.jsx("div",{className:"micro-label",children:"Modified"}),s.jsx($t,{data:f??{}})]})]})]})]},u.id)})})]})}const Vo=500,Bh=1500;function et(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function z(e){return typeof e=="string"&&e!==""?e:null}function q(e){const t=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(t)?t.toLocaleString("en-US"):"—"}function Un(e){if(!e)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function xd(e){const t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function jd(e){const[t,n]=N.useState(()=>Date.now());return N.useEffect(()=>{if(!e)return;const r=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(r)},[e]),t}const Pe=e=>e==="done",Bo=e=>e==="done"||e==="skipped";function Qh(){const[e,t]=N.useState(null),[n,r]=N.useState(!1),[l,i]=N.useState([]),[a,o]=N.useState(!0),[c,u]=N.useState(null),[m,f]=N.useState(!1),h=N.useRef(0),y=N.useRef(!1),v=N.useCallback(async()=>{let p=await R.getOnboardingEvents(h.current),d=[];for(;p.events.length>0&&(d=d.concat(p.events),h.current=p.events[p.events.length-1].id,!(p.events.length<Vo));)p=await R.getOnboardingEvents(h.current);d.length>0&&i(g=>[...g,...d].slice(-Vo))},[]),j=N.useCallback(async()=>{const p=await R.getOnboarding();t(p.state),r(p.demo_mode),await v()},[v]);N.useEffect(()=>{let p=!0;return(async()=>{try{const d=await R.getOnboarding();if(!p)return;t(d.state),r(d.demo_mode),await v()}catch(d){p&&u(d instanceof Error?d.message:String(d))}finally{p&&o(!1)}})(),()=>{p=!1}},[v]);const _=e?Object.values(e.stages).some(p=>p==="active"):!1;return N.useEffect(()=>{if(!_&&!m)return;const p=window.setInterval(()=>{y.current||(y.current=!0,j().catch(()=>{}).finally(()=>{y.current=!1}))},Bh);return()=>window.clearInterval(p)},[_,m,j]),{state:e,demoMode:n,events:l,loading:a,error:c,refresh:j,setDriverRunning:f}}const ts=["thumb","index","middle","ring","pinky"],Qo={thumb:"Mailbox",index:"Stripe",middle:"Products & pricing",ring:"Voice & procedures",pinky:"Policies & precedents"},Kh={thumb:"Completes when your mailbox is verified over IMAP and its inventory counted.",index:"Completes when a restricted Stripe key is verified.",middle:"Completes when products.md is written from your pricing page and Stripe catalog.",ring:"Completes when voice.md is written from your sent replies.",pinky:"Completes when policies.md is written and you have chosen a handling style."},Gh={thumb:{x:2,top:50,bottom:93,w:32},index:{x:25,top:22,bottom:65,w:16},middle:{x:41,top:13,bottom:65,w:16},ring:{x:57,top:20,bottom:65,w:16},pinky:{x:73.5,top:36,bottom:67,w:14}},Yh={thumb:"M31.9 84.6 L13.9 58.6 A6 6 0 0 0 4.1 65.4 L22.1 91.4 A6 6 0 0 0 31.9 84.6 Z",index:"M26.5 64 L26.5 31.5 A6.5 6.5 0 0 1 39.5 31.5 L39.5 64 Z",middle:"M42.5 64 L42.5 22.5 A6.5 6.5 0 0 1 55.5 22.5 L55.5 64 Z",ring:"M58.5 64 L58.5 29.5 A6.5 6.5 0 0 1 71.5 29.5 L71.5 64 Z",pinky:"M74.5 66 L74.5 44.5 A5.5 5.5 0 0 1 85.5 44.5 L85.5 66 Z"},Xh=["M31.9 84.6 L13.9 58.6 A6 6 0 0 0 4.1 65.4 L22.1 91.4","M26.5 62 L26.5 31.5 A6.5 6.5 0 0 1 39.5 31.5 L39.5 62","M42.5 62 L42.5 22.5 A6.5 6.5 0 0 1 55.5 22.5 L55.5 62","M58.5 62 L58.5 29.5 A6.5 6.5 0 0 1 71.5 29.5 L71.5 62","M74.5 64 L74.5 44.5 A5.5 5.5 0 0 1 85.5 44.5 L85.5 64","M24 60 L24 87 C24 100.5 36.5 109 53.5 109 C70.5 109 88 100.5 88 87 L88 60"];function Zh({finger:e,lit:t}){const n=Gh[e],r=N.useRef(null),l=N.useRef(!1);return N.useEffect(()=>{const i=r.current;if(!i)return;const a=n.bottom-n.top;if(!t){i.setAttribute("y",String(n.bottom)),i.setAttribute("height","0"),l.current=!0;return}if(!l.current){i.setAttribute("y",String(n.top)),i.setAttribute("height",String(a)),l.current=!0;return}let o=0;const c=performance.now(),u=f=>{const h=Math.min(1,Math.max(0,(f-c)/600)),y=1-Math.pow(1-h,3);i.setAttribute("y",String(n.bottom-a*y)),i.setAttribute("height",String(a*y)),h<1&&(o=requestAnimationFrame(u))};o=requestAnimationFrame(u);const m=window.setTimeout(()=>{i.setAttribute("y",String(n.top)),i.setAttribute("height",String(a))},650);return()=>{cancelAnimationFrame(o),window.clearTimeout(m)}},[t,n]),s.jsx("clipPath",{id:`onb-clip-${e}`,children:s.jsx("rect",{ref:r,x:n.x,width:n.w,y:n.bottom,height:0})})}function qh(e){const t=e.stages;return{lit:{thumb:Pe(t.mailbox),index:Pe(t.stripe),middle:Pe(t.reading_products),ring:Pe(t.reading_voice),pinky:Pe(t.reading_policies)&&Pe(t.style)},active:{thumb:t.mailbox==="active",index:t.stripe==="active",middle:t.reading_products==="active",ring:t.reading_voice==="active",pinky:t.reading_policies==="active"||t.style==="active"}}}function Jh({st:e}){const{lit:t,active:n}=qh(e),r=ts.every(l=>t[l]);return s.jsxs("div",{className:"onb-top",children:[s.jsxs("div",{className:"onb-top-title",children:[s.jsx("h1",{children:"Setup"}),s.jsx("div",{className:"page-sub",children:"five foundations · local only"})]}),s.jsxs("div",{className:`onb-hand-caption${r?" show":""}`,"aria-hidden":!r,children:["You have a clear hand.",s.jsx("span",{className:"hc-sub",children:"Money still moves only when you click."})]}),s.jsxs("div",{className:"onb-hand-cluster",children:[s.jsxs("svg",{className:`onb-hand${r?" complete":""}`,viewBox:"0 0 100 112",width:"74",height:"83",role:"img","aria-label":"Setup progress hand",children:[s.jsx("defs",{children:ts.map(l=>s.jsx(Zh,{finger:l,lit:t[l]},l))}),s.jsx("path",{className:"palm-fill",d:"M24 61 L88 61 L88 87 C88 100.5 70.5 109 53.5 109 C36.5 109 24 100.5 24 87 Z"}),ts.map(l=>s.jsx("path",{className:"h-fill",clipPath:`url(#onb-clip-${l})`,d:Yh[l]},l)),Xh.map((l,i)=>s.jsx("path",{className:"h-outline",d:l},i))]}),s.jsx("ul",{className:"onb-foundations",children:ts.map(l=>s.jsxs("li",{className:`${t[l]?"done":""}${n[l]?" active":""}`,children:[s.jsx("span",{className:"fdot",children:"✓"}),s.jsx(Q,{tip:Kh[l],label:`What completes ${Qo[l]}?`,children:Qo[l]})]},l))})]})]})}function Vt({kicker:e,title:t,lede:n,meta:r}){return s.jsxs("div",{className:"onb-screen-head",children:[s.jsx("span",{className:"onb-kicker",children:e}),s.jsxs("div",{className:"onb-head-row",children:[s.jsx("h2",{children:t}),r]}),n&&s.jsx("p",{className:"onb-lede",children:n})]})}function wd(){return s.jsx("p",{className:"onb-pledge-line",children:s.jsx("b",{children:"local only · keychain · every read logged · nothing moves without your click."})})}function Nd(){return s.jsx("p",{className:"onb-demo-note",children:"demo mode — any value connects a simulated account."})}function em({text:e}){const[t,n]=N.useState(!1);return s.jsxs("button",{type:"button",className:"onb-paste-chip",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(e).catch(()=>{}),n(!0),window.setTimeout(()=>n(!1),1400)},"aria-label":"Copy this instruction for your agent",children:[s.jsx("code",{children:e}),s.jsx("span",{className:"pc-copy",children:t?"copied":"copy"})]})}class Ko extends Error{}function tm(e,t){const n=Ce(),[r,l]=N.useState(!1),i=N.useRef(!1),a=N.useCallback(()=>{i.current=!0},[]),o=N.useCallback(async()=>{if(r)return;i.current=!1,l(!0),e.setDriverRunning(!0);const c=()=>{if(i.current)throw new Ko},u=async h=>{c(),await new Promise(y=>setTimeout(y,h)),c()},m=async(h,y)=>{c(),await R.setOnboardingStage(h,y)},f=async(h,y,v)=>{c(),await R.postOnboardingEvent(h,y,v)};try{await m("arrival","done"),await m("mailbox","active"),await u(400);const h=await R.connectMailbox({address:"demo@acme.dev",password:"demo-app-password"});h.address&&await R.postOnboardingConfirmation("mailbox_address",h.address),h.inventory&&await R.postOnboardingConfirmation("mailbox_inventory",h.inventory),t(),await u(700),await m("stripe","active"),await u(400);const y=await R.connectStripe("rk_demo_acme");y.inventory&&await R.postOnboardingConfirmation("stripe_inventory",y.inventory),t(),await u(700),await m("reading_products","active"),await m("reading_voice","active"),await m("reading_policies","active"),await f("reading_products","activity",{line:"reading your pricing page…"}),await u(400),await f("reading_voice","activity",{line:"reading 312 sent replies…"}),await u(400),await f("reading_policies","activity",{line:"reading 41 refunds and 3 disputes…"}),await u(400),await f("reading_products","finding",{card:"product",name:"Acme Pro",prices:"$29/mo · $290/yr",source:"stripe"}),await u(400),await f("reading_voice","finding",{chip:"greeting: “Hey {first},” — 187×"}),await u(600),await f("reading_products","activity",{line:"cross-checking Stripe catalog…"}),await f("reading_voice","finding",{chip:"sign-off: “— Allen” — 201×"}),await u(400),await f("reading_policies","activity",{line:"comparing what your site promises with what you actually did…"}),await u(400),await f("reading_products","finding",{card:"product",name:"Starter",prices:"$9/mo",source:"pricing page"}),await f("reading_voice","finding",{chip:"median reply: 4 sentences"}),await u(600),await f("reading_voice","activity",{line:"learning how you sound…"}),await f("reading_policies","finding",{card:"contrast",said:"refunds within 14 days.",did:"refunded 84% of asks; median full refund; 12 approvals outside the window.",note:"(You’ll pick which me to be below.)"}),await u(400),await f("reading_products","finding",{card:"product",name:"Acme Team",prices:"$79/mo · $790/yr",source:"stripe"}),await f("reading_voice","finding",{chip:"languages: EN 71% · 中文 22% · FR 7%"}),await u(600),await f("reading_voice","finding",{chip:"apologizes only when at fault"}),await u(400),await f("reading_products","conflict",{question:"Site says $29/mo, Stripe charges $24.99 — which is right?",options:["$29 — the site","$24.99 — Stripe"]}),await u(700),await f("reading_voice","finding",{card:"excerpt",quote:"Hey [name], — good catch, the duplicate charge is on us. I refunded the $29 a minute ago; you’ll see it in 3–5 business days. — Allen"}),await u(400),await f("reading_policies","finding",{card:"dispute",head:"dispute precedent · 1 of 3",outcome:"won",text:"“Charge not recognized” — countered with the delivery log and login timestamps.",foot:"I’ll handle new ones the same way, and always escalate them to you."}),await u(700),await f("reading_products","activity",{line:"writing products.md"}),await f("reading_products","artifact",{name:"products.md",bytes:1210}),await u(400),await f("reading_voice","finding",{card:"procedure",text:"When asked about invoices you always attach a PDF and cc billing@",seen:"seen 23×"}),await u(400),await f("reading_products","artifact",{name:"products.md",bytes:2412}),await f("reading_policies","activity",{line:"writing policies.md"}),await f("reading_policies","artifact",{name:"policies.md",bytes:2203}),await u(400),await f("reading_voice","activity",{line:"writing voice.md"}),await f("reading_voice","artifact",{name:"voice.md",bytes:1847}),await u(600),await f("reading_products","activity",{line:"products.md written · 3 products · 1 conflict flagged"}),await m("reading_products","done"),await u(600),await f("reading_voice","activity",{line:"voice.md written · 5 patterns · 1 procedure"}),await m("reading_voice","done"),await u(600),await f("reading_policies","activity",{line:"policies.md written · refund practice + 3 dispute precedents"}),await m("reading_policies","done"),await u(800),await m("style","active"),await u(600),await R.postOnboardingStyle({choice:"track_record",escalation:{repeatRefunders:!0,amountOverCents:2e4,vipList:[]},cancelDefault:"end_of_period",contractText:bi("track_record",!0,200,"end_of_period")}),await u(700),await m("calibration","active");const v=await R.getCalibrations();for(const j of v.calibrations)c(),(j.verdict==null||j.verdict==="")&&(await R.reviewCalibration(j.id,"fine","demo driver — auto-reviewed"),await u(300));await m("calibration","done"),await u(700),await m("first_batch","active"),await f("first_batch","activity",{line:"counting the last 3 days…"}),await u(700),await f("first_batch","batch_case",{group:"money",title:"Refund ask — duplicate $99 charge",note:"draft + refund proposed"}),await f("first_batch","activity",{line:"triaged 3/23"}),await u(500),await f("first_batch","batch_case",{group:"money",title:"Annual → monthly",note:"refund $191 + scheduled cancel proposed"}),await u(500),await f("first_batch","batch_case",{group:"reply",title:"Can’t log in after renewal",note:"fix confirmed, draft ready"}),await f("first_batch","activity",{line:"triaged 8/23"}),await u(500),await f("first_batch","batch_case",{group:"reply",title:"Invoice for May",note:"PDF attached, draft ready"}),await u(500),await f("first_batch","batch_case",{group:"reply",title:"Does Acme integrate with Zapier",note:"answered from products.md"}),await f("first_batch","activity",{line:"triaged 14/23"}),await u(500),await f("first_batch","batch_case",{group:"reply",title:"+11 more",note:""}),await u(500),await f("first_batch","batch_case",{group:"escalated",title:"Chargeback threat",note:"never refund under threat, per your policy"}),await u(500),await f("first_batch","batch_case",{group:"escalated",title:"VIP domain (bigco.com)",note:"flagged per your list"}),await f("first_batch","activity",{line:"triaged 20/23"}),await u(500),await f("first_batch","batch_case",{group:"ignorable",title:"newsletters & receipts (5)",note:"marked, not deleted"}),await f("first_batch","activity",{line:"triaged 23/23"}),await u(600),await f("first_batch","batch_done",{processed:23,drafts:16,money:2,escalated:2,ignorable:5}),await m("first_batch","done"),await m("live","active")}catch(h){h instanceof Ko||n(h instanceof Error?h.message:"Demo run failed","error")}finally{i.current=!1,l(!1),e.setDriverRunning(!1),e.refresh()}},[r,e,t,n]);return{running:r,run:o,stop:a}}function nm({demoMode:e,driver:t,onStart:n}){const[r,l]=N.useState(!1),i=Ce(),a=async()=>{l(!0);try{await n()}catch(o){i(o instanceof Error?o.message:"Could not start","error")}finally{l(!1)}};return s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"clearhand · setup",title:"Five things make ClearHand useful.",lede:"Two you connect — about five minutes. Three I read and learn from your own data — I'll show you everything I find and where it goes. Along the way you'll set how I should handle things. Nothing is sent and no money moves without your click."}),s.jsxs("p",{className:"onb-agent-line",children:["Your agent does the reading — keep it open alongside this page. If it isn't running yet, paste into it:"," ",s.jsx(em,{text:"read CLEARHAND.md and run the clearhand-onboard skill"})]}),s.jsxs("div",{className:"onb-chips",children:[s.jsx("span",{className:"onb-chip",children:"runs on your machine"}),s.jsx("span",{className:"onb-chip",children:"secrets → OS keychain"}),s.jsx("span",{className:"onb-chip",children:"every read logged"}),s.jsx("span",{className:"onb-chip",children:"no telemetry"})]}),s.jsxs("div",{className:"onb-cta-row",children:[s.jsx("button",{className:"btn btn-primary",disabled:r||t.running,onClick:()=>void a(),children:"Start with your mailbox"}),e&&s.jsx("button",{className:"quiet-link",disabled:t.running,onClick:()=>void t.run(),children:t.running?"demo running…":"Run the 90-second demo"})]}),e&&s.jsx("p",{className:"onb-demo-note",style:{marginTop:10},children:"demo mode — the demo drives this exact flow through the real endpoints with a simulated mailbox and Stripe account."})]})}function kd({blocks:e}){return s.jsx("div",{className:"onb-disclosure",children:e.map(t=>s.jsxs("div",{className:`d-block d-${t.tone}`,children:[s.jsx("span",{className:"d-label",children:t.label}),s.jsx("p",{children:t.body}),t.footnote&&s.jsx("p",{className:"d-footnote",children:t.footnote})]},t.label))})}function rm({st:e,demoMode:t,refresh:n}){const{status:r,reloadStatus:l}=dt(),i=Ce(),[a,o]=N.useState(""),[c,u]=N.useState(""),[m,f]=N.useState(""),[h,y]=N.useState(""),[v,j]=N.useState(!1),[_,p]=N.useState(null),d=e.stages.mailbox,g=et(e.confirmations.mailbox_inventory),k=dn(r==null?void 0:r.secret_storage),C=async x=>{x.preventDefault(),j(!0),p(null);try{const L=await R.connectMailbox({address:a.trim(),password:c,...m.trim()?{imapHost:m.trim()}:{},...h.trim()?{imapPort:Number(h)}:{}});u(""),L.address&&await R.postOnboardingConfirmation("mailbox_address",L.address),L.inventory&&await R.postOnboardingConfirmation("mailbox_inventory",L.inventory),l(),await n()}catch(L){p(L instanceof Error?L.message:"Failed to connect the mailbox")}finally{j(!1)}},b=async()=>{try{await R.setOnboardingStage("mailbox","skipped"),await R.setOnboardingStage("stripe","active"),await n()}catch(x){i(x instanceof Error?x.message:"Could not skip","error")}},w=async()=>{try{e.stages.stripe==="pending"&&await R.setOnboardingStage("stripe","active"),await n()}catch(x){i(x instanceof Error?x.message:"Could not advance","error")}};return s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"foundation 1 of 5 · mailbox",title:"Connect your mailbox.",lede:"IMAP, read-only. About two minutes."}),s.jsxs("div",{className:"onb-connect-grid",children:[s.jsx("div",{className:"onb-panel",children:d==="done"?s.jsxs("div",{className:"onb-connected",children:[s.jsxs("p",{className:"onb-payoff",children:[s.jsx("span",{className:"ok",children:"✓"})," Connected",z(e.confirmations.mailbox_address)?s.jsxs(s.Fragment,{children:[" ","as ",s.jsx("span",{className:"mono",children:z(e.confirmations.mailbox_address)})]}):null,". Found ",s.jsxs("strong",{children:[q(g.inboxMessages)," conversations"]})," ·"," ",s.jsxs("strong",{children:[q(g.sentMessages)," sent replies"]}),"."]}),e.stages.stripe==="pending"&&s.jsx("button",{className:"btn btn-primary",onClick:()=>void w(),children:"Next: Stripe"})]}):d==="skipped"?s.jsxs("p",{className:"onb-skipped",children:["Skipped for now — the reading will use your site and Stripe only. Connect any time on the ",s.jsx("a",{href:"#/connections",children:"Connections page"}),"."]}):s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Your mailbox"}),t&&s.jsx(Nd,{}),s.jsxs("form",{onSubmit:x=>void C(x),children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"onb-mb-addr",children:"Email address"}),s.jsx("input",{id:"onb-mb-addr",className:"input",type:"email",autoComplete:"off",placeholder:"support@yourcompany.com",value:a,onChange:x=>o(x.target.value),required:!0})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"onb-mb-pass",children:"App password"}),s.jsx("input",{id:"onb-mb-pass",className:"input",type:"password",autoComplete:"off",value:c,onChange:x=>u(x.target.value),required:!0}),s.jsxs("span",{className:"field-hint",children:[s.jsxs("span",{className:"kc",children:["stored in your ",k]})," — never in a config file."]})]}),s.jsxs("p",{className:"onb-form-hint",children:["Gmail needs 2-step verification on, then an app password."," ",s.jsx("a",{href:"https://myaccount.google.com/apppasswords",target:"_blank",rel:"noopener noreferrer",children:"Create one →"})]}),s.jsxs("details",{className:"onb-alt-imap",children:[s.jsx("summary",{children:"Not Gmail?"}),s.jsxs("div",{className:"row2",children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"onb-mb-host",children:"IMAP host"}),s.jsx("input",{id:"onb-mb-host",className:"input",placeholder:"imap.yourhost.com",value:m,onChange:x=>f(x.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"onb-mb-port",children:"Port"}),s.jsx("input",{id:"onb-mb-port",className:"input",inputMode:"numeric",placeholder:"993",value:h,onChange:x=>y(x.target.value)})]})]})]}),_&&s.jsx("div",{className:"form-error",children:_}),s.jsxs("div",{className:"onb-verify-row",children:[s.jsx("button",{className:"btn btn-primary",disabled:v||!a.trim()||!c,children:v?"Verifying…":"Verify & connect"}),s.jsx("button",{type:"button",className:"quiet-link",onClick:()=>void b(),children:"connect later"})]})]}),s.jsx(wd,{})]})}),s.jsx(kd,{blocks:[{tone:"read",label:"What I'll read",body:"Support conversations from the last 90 days, and your sent replies — that's where your voice and your real policies live."},{tone:"never",label:"What I'll never do",body:"Send, delete, or move anything; read other folders; keep the raw mail anywhere but this machine.",footnote:"One honest caveat: to learn your voice, your agent reads excerpts of this mail — that inference goes through the agent's model provider, exactly like your code does today. ClearHand's own server contacts no model."}]})]})]})}const Go=[{scope:"customers:read",why:"who is writing in"},{scope:"charges:read",why:"what they paid"},{scope:"refunds:write",why:"after your click"},{scope:"subscriptions:write",why:"after your click"},{scope:"invoices:read",why:"what they were billed"}];function sm({st:e,demoMode:t,refresh:n}){const{status:r,reloadStatus:l}=dt(),i=Ce(),[a,o]=N.useState(""),[c,u]=N.useState(!1),[m,f]=N.useState(null),[h,y]=N.useState(null),[v,j]=N.useState(!1),_=e.stages.stripe,p=et(e.confirmations.stripe_inventory),d=dn(r==null?void 0:r.secret_storage),g=/^sk_/.test(a.trim()),k=async w=>{w.preventDefault(),u(!0),f(null);try{const x=await R.connectStripe(a.trim());y(x.warning??null),o(""),x.inventory&&await R.postOnboardingConfirmation("stripe_inventory",x.inventory),l(),await n()}catch(x){f(x instanceof Error?x.message:"Failed to connect Stripe")}finally{u(!1)}},C=()=>{var x;const w=Go.map(L=>L.scope).join(" ");(x=navigator.clipboard)==null||x.writeText(w).catch(()=>{}),j(!0),window.setTimeout(()=>j(!1),1400)},b=async()=>{try{for(const w of["reading_products","reading_voice","reading_policies"])e.stages[w]==="pending"&&await R.setOnboardingStage(w,"active");await n()}catch(w){i(w instanceof Error?w.message:"Could not advance","error")}};return s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"foundation 2 of 5 · stripe",title:"Connect Stripe with a restricted key.",lede:"The key you paste below can do exactly five things."}),s.jsxs("div",{className:"onb-connect-grid",children:[s.jsxs("div",{className:"onb-panel",children:[_==="done"?s.jsxs("div",{className:"onb-connected",children:[s.jsxs("p",{className:"onb-payoff",children:[s.jsx("span",{className:"ok",children:"✓"})," Connected."," ",s.jsxs("strong",{children:[q(p.products)," products"]})," ·"," ",s.jsxs("strong",{children:[q(p.prices)," prices"]})," ·"," ",s.jsxs("strong",{children:[q(p.charges)," charges"]})," ·"," ",s.jsxs("strong",{children:[q(p.refunds)," refunds"]})," ·"," ",s.jsxs("strong",{children:[q(p.disputes)," disputes"]}),"."]}),h&&s.jsx("p",{className:"onb-key-warn show",children:h})]}):s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Restricted key — five scopes"}),t&&s.jsx(Nd,{}),s.jsx("ul",{className:"onb-scopes",children:Go.map(w=>s.jsxs("li",{children:[s.jsx("span",{className:"tick",children:"✓"}),w.scope,s.jsx("span",{className:"why",children:w.why})]},w.scope))}),s.jsxs("div",{className:"onb-scope-actions",children:[s.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:C,children:v?"copied":"Copy scopes"}),s.jsx("a",{className:"quiet-link",href:"https://dashboard.stripe.com/apikeys/create",target:"_blank",rel:"noopener noreferrer",children:"Create a restricted key in Stripe →"})]}),s.jsxs("form",{onSubmit:w=>void k(w),children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"onb-sk-key",children:"Restricted key"}),s.jsx("input",{id:"onb-sk-key",className:"input",type:"password",spellCheck:!1,autoComplete:"off",placeholder:"rk_live_…",value:a,onChange:w=>o(w.target.value),required:!0}),s.jsxs("span",{className:"field-hint",children:[s.jsxs("span",{className:"kc",children:["stored in your ",d]}),"; read just-in-time; every read logged on the ",s.jsx("a",{href:"#/connections",children:"Trust page"}),"."]}),g&&s.jsx("p",{className:"onb-key-warn show",children:"That's a full-access secret key. I only need the five scopes above — please create a restricted key instead."})]}),m&&s.jsx("div",{className:"form-error",children:m}),s.jsx("div",{className:"onb-verify-row",children:s.jsx("button",{className:"btn btn-primary",disabled:c||a.trim()==="",children:c?"Verifying…":"Verify & connect"})})]}),s.jsx(wd,{})]}),_==="done"&&["reading_products","reading_voice","reading_policies"].every(w=>e.stages[w]==="pending")&&s.jsx("button",{className:"btn btn-primary",onClick:()=>void b(),children:"Next: the reading"})]}),s.jsx(kd,{blocks:[{tone:"read",label:"What I'll read",body:"Products, prices, charges, refunds, disputes."},{tone:"can",label:"What I can do — only after your click, each time",body:"Refund a charge, cancel a subscription."},{tone:"never",label:"What I can't",body:"Anything else; the key you paste can't either."}]})]})]})}const Et=[{stage:"reading_products",name:"Products & pricing",file:"products.md",help:"Reads your pricing page and cross-checks the Stripe catalog; writes products.md."},{stage:"reading_voice",name:"Voice & procedures",file:"voice.md",help:"Reads your sent replies to learn greeting, sign-off, length, and languages; writes voice.md."},{stage:"reading_policies",name:"Policies & precedents",file:"policies.md",help:"Reads refunds and disputes, and compares what your site promises with what you actually did; writes policies.md."}];function lm({quote:e}){const t=e.split("[name]");return s.jsx("blockquote",{children:t.map((n,r)=>s.jsxs(N.Fragment,{children:[r>0&&s.jsx("span",{className:"redact","aria-label":"redacted name"}),n]},r))})}function im({event:e,file:t,confirmations:n,onConfirm:r}){const l=et(e.payload);if(e.kind==="conflict"){const o=`conflict:${e.id}`,c=z(n[o]),u=Array.isArray(l.options)?l.options.map(String):[];return s.jsxs("div",{className:`onb-finding conflict${c?" resolved":""}`,children:[s.jsx("span",{className:"c-label",children:"conflict"}),z(l.question),s.jsx("div",{className:"c-btns",children:u.map(m=>s.jsx("button",{className:`c-btn${c===m?" picked":""}`,disabled:c!=null,onClick:()=>r(o,m),children:m},m))}),c&&s.jsxs("span",{className:"c-note",children:["noted · written into ",t]})]})}const i=z(l.card);if(i==="product")return s.jsxs("div",{className:"onb-finding",children:[z(l.source)&&s.jsx("span",{className:"f-src",children:z(l.source)}),s.jsx("span",{className:"f-title",children:z(l.name)}),z(l.prices)&&s.jsxs(s.Fragment,{children:[" ","— ",s.jsx("span",{className:"f-sub",children:z(l.prices)})]})]});if(i==="excerpt"){const o=`excerpt:${e.id}`,c=z(n[o]);return s.jsxs("div",{className:`onb-finding excerpt${c==="dropped"?" dropped":""}`,children:[s.jsx("span",{className:"e-label",children:"this is you, verbatim — did I pick well?"}),s.jsx(lm,{quote:z(l.quote)??""}),s.jsxs("div",{className:"vote-btns",children:[s.jsx("button",{className:`vote${c==="kept"?" picked":""}`,disabled:c!=null,onClick:()=>r(o,"kept"),children:"👍"}),s.jsx("button",{className:`vote${c==="dropped"?" picked":""}`,disabled:c!=null,onClick:()=>r(o,"dropped"),children:"👎"}),c&&s.jsx("span",{className:"vote-note",children:c==="dropped"?"dropped — I’ll pick another":"kept"})]})]})}if(i==="procedure"){const o=`procedure:${e.id}`,c=z(n[o])??"keep";return s.jsxs("div",{className:"onb-finding procedure",children:[z(l.text),s.jsxs("div",{className:"p-row",children:[s.jsx("span",{className:"p-seen",children:z(l.seen)}),s.jsxs("span",{className:"seg",children:[s.jsx("button",{className:c==="keep"?"on":"",onClick:()=>r(o,"keep"),children:"keep"}),s.jsx("button",{className:c==="drop"?"on":"",onClick:()=>r(o,"drop"),children:"drop"})]})]})]})}if(i==="contrast")return s.jsxs("div",{className:"onb-finding contrast",children:[s.jsxs("div",{className:"ct-row ct-said",children:[s.jsx("span",{className:"ct-label",children:"Your site says"}),z(l.said)]}),s.jsxs("div",{className:"ct-row ct-did",children:[s.jsx("span",{className:"ct-label",children:"You actually did"}),z(l.did)]}),z(l.note)&&s.jsx("span",{className:"ct-note",children:z(l.note)})]});if(i==="dispute")return s.jsxs("div",{className:"onb-finding dispute-card",children:[s.jsxs("div",{className:"d-head",children:[z(l.head),z(l.outcome)&&s.jsxs(s.Fragment,{children:[" ","· ",s.jsx("span",{className:"won",children:z(l.outcome)})]})]}),z(l.text),z(l.foot)&&s.jsx("div",{className:"d-foot",children:z(l.foot)})]});if(z(l.chip))return s.jsx("div",{className:"onb-finding f-chip",children:z(l.chip)});if(l.card&&typeof l.card=="object"){const o=Object.entries(l.card).filter(([,c])=>c!=null&&c!=="");if(o.length>0)return s.jsx("div",{className:"onb-finding",children:o.map(([c,u])=>s.jsxs("div",{className:"f-kv",children:[s.jsx("span",{className:"f-k",children:c}),s.jsx("span",{className:"f-sub",children:String(u)})]},c))})}const a=z(l.title)??z(l.line)??z(l.text)??z(l.name);return a?s.jsx("div",{className:"onb-finding",children:s.jsx("span",{className:"f-sub",children:a})}):null}function am({st:e,events:t,refresh:n}){const r=Ce(),l=e.stages,i=Et.some(v=>l[v.stage]==="active"),a=Et.every(v=>Pe(l[v.stage])),o=Et.every(v=>l[v.stage]==="pending"),c=jd(i),u=Et.map(v=>Un(e.timestamps[`${v.stage}_active`])).filter(v=>v!=null).reduce((v,j)=>v==null?j:Math.min(v,j),null),m=a?Et.map(v=>Un(e.timestamps[`${v.stage}_done`])).filter(v=>v!=null).reduce((v,j)=>v==null?j:Math.max(v,j),null):c,f=u!=null&&m!=null?xd(m-u):"0:00",h=(v,j)=>{R.postOnboardingConfirmation(v,j).then(()=>n()).catch(_=>r(_ instanceof Error?_.message:"Could not save","error"))},y=async()=>{try{l.style==="pending"&&await R.setOnboardingStage("style","active"),await n()}catch(v){r(v instanceof Error?v.message:"Could not advance","error")}};return s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"foundations 3–5 · the reading",title:"I'm reading. Everything below is clickable — check me.",lede:"Three tracks run in parallel · typical 3–8 minutes.",meta:s.jsxs("div",{className:"onb-head-meta",children:[s.jsxs("span",{className:"mono",children:["elapsed ",f,a?" · done":""]}),s.jsx("a",{className:"quiet-link",href:"#/activity",children:"raw audit log →"})]})}),o&&s.jsxs("p",{className:"onb-hint",children:["Waiting for your agent. Ask it to read ",s.jsx("code",{children:"CLEARHAND.md"})," and run the onboarding skill — every finding lands here as it happens."]}),s.jsx("div",{className:"onb-tracks",children:Et.map(v=>{const j=l[v.stage],_=t.filter(d=>d.stage===v.stage&&(d.kind==="finding"||d.kind==="conflict")),p=e.artifacts[v.stage];return s.jsxs("div",{className:`onb-track${j==="active"?" running":""}${Pe(j)?" done":""}`,children:[s.jsxs("div",{className:"track-head",children:[s.jsx(Q,{tip:v.help,label:`What does the ${v.name} track do?`,children:s.jsx("span",{className:"track-name",children:v.name})}),s.jsxs("span",{className:"track-file",children:["→ ",v.file]})]}),s.jsxs("div",{className:"track-activity",children:[s.jsx("span",{className:"pulse"}),s.jsx("span",{children:e.activity[v.stage]??"waiting to start"})]}),s.jsx("div",{className:"track-findings",children:_.map(d=>s.jsx(im,{event:d,file:v.file,confirmations:e.confirmations,onConfirm:h},d.id))}),s.jsxs("div",{className:"track-foot",children:[s.jsx("span",{className:"fname",children:(p==null?void 0:p.name)??v.file}),s.jsx("span",{className:"bytes",children:p?`${p.bytes.toLocaleString("en-US")} bytes`:"—"}),s.jsx("a",{className:"quiet-link",href:"#/overlay",children:"view diff"})]})]},v.stage)})}),a&&s.jsxs("div",{className:"onb-strip",children:[s.jsx("p",{children:"Done. products.md, voice.md and policies.md are written — your answers above are folded in before anything goes live."}),l.style==="pending"&&s.jsx("button",{className:"btn btn-primary",onClick:()=>void y(),children:"Continue: handling style"})]})]})}const om={by_the_book:"I follow your stated policy, strictly: refunds only within the 14-day window",track_record:"I follow your track record: refund first-time asks up to $99 even a few days outside the window",generous:"I refund politely and fast up to $99 with no friction, and send you a weekly digest"};function bi(e,t,n,r){return`${om[e]}, escalate ${t?"repeat refunders and ":""}anything over $${n}, cancel ${r==="end_of_period"?"at period end unless asked otherwise":"immediately when asked"}, always escalate legal or chargeback threats, and never promise anything I can’t see in Stripe.`}const Yo=[{choice:"by_the_book",head:"By the book",rule:"Stated policy, strictly; every exception escalates.",mara:"escalated (day 16 > 14)",cost:"most escalations"},{choice:"track_record",head:"Match my track record",rec:!0,rule:"Mirror your actual decisions — 84% approval including out-of-window; flag repeat refunders.",mara:"full refund, like your last 12",cost:"closest to today"},{choice:"generous",head:"Generous & fast",rule:"Refund politely up to a cap, no friction; weekly digest.",mara:"full refund",cost:"fastest, loosest"}];function cm({st:e,refresh:t}){var b;const n=Ce(),[r,l]=N.useState("track_record"),[i,a]=N.useState(!0),[o,c]=N.useState(200),[u,m]=N.useState(""),[f,h]=N.useState("end_of_period"),[y,v]=N.useState(()=>bi("track_record",!0,200,"end_of_period")),[j,_]=N.useState(!1),[p,d]=N.useState(!1),g=Pe(e.stages.style),k=(w,x,L,M)=>{v(bi(w,x,L,M))},C=async()=>{_(!0);try{await R.postOnboardingStyle({choice:r,escalation:{repeatRefunders:i,amountOverCents:Math.round(o*100),vipList:u.split(",").map(w=>w.trim()).filter(w=>w!=="")},cancelDefault:f,contractText:y}),d(!1),await t(),n("Style saved — written to overlay/policies.md","success")}catch(w){n(w instanceof Error?w.message:"Could not save the style","error")}finally{_(!1)}};if(g&&!p){const w=et(e.confirmations.handling_style),x=((b=Yo.find(L=>L.choice===z(w.choice)))==null?void 0:b.head)??"saved";return s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"handling style",title:"How should I handle things?"}),s.jsxs("div",{className:"onb-strip",children:[s.jsxs("p",{children:["Handling style: ",s.jsx("strong",{children:x})," — written to"," ",s.jsx("span",{className:"mono",children:"overlay/policies.md"}),"."," ",s.jsx("a",{href:"#/overlay",children:"see the full policy book →"})]}),s.jsx("button",{className:"quiet-link",onClick:()=>d(!0),children:"revisit"})]})]})}return s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"handling style",title:"How should I handle things?",lede:"Three styles, ranked by your own evidence — each shows what it would have done on a real past case."}),s.jsx("div",{className:"onb-style-cards",children:Yo.map(w=>s.jsxs("button",{className:`onb-style-card${r===w.choice?" selected":""}`,onClick:()=>{l(w.choice),k(w.choice,i,o,f)},children:[s.jsxs("span",{className:"sc-head",children:[w.head,w.rec&&s.jsx("span",{className:"sc-rec",children:"★ recommended"})]}),s.jsx("span",{className:"sc-rule",children:w.rule}),s.jsxs("span",{className:"sc-case",children:[s.jsx("span",{className:"sc-label",children:"Mara's case →"}),w.mara]}),s.jsx("span",{className:"sc-cost",children:w.cost})]},w.choice))}),s.jsxs("div",{className:"onb-tune-grid",children:[s.jsxs("div",{className:"onb-panel",children:[s.jsx("h4",{children:"Escalation triggers"}),s.jsxs("ul",{className:"onb-tune-list",children:[s.jsxs("li",{children:[s.jsx("input",{type:"checkbox",checked:!0,disabled:!0,id:"onb-t-legal"}),s.jsx("label",{htmlFor:"onb-t-legal",children:"legal or chargeback threats"}),s.jsx("span",{className:"lock",children:"always on"})]}),s.jsxs("li",{children:[s.jsx("input",{type:"checkbox",id:"onb-t-repeat",checked:i,onChange:w=>{a(w.target.checked),k(r,w.target.checked,o,f)}}),s.jsx("label",{htmlFor:"onb-t-repeat",children:"repeat refunders (2+)"})]})]}),s.jsxs("div",{className:"onb-slider-row",children:[s.jsxs("div",{className:"sl-label",children:[s.jsxs("span",{children:["over $",o," escalates"]}),s.jsx("span",{className:"sl-note",children:"default = your p90 refund"})]}),s.jsx("input",{type:"range",min:50,max:500,step:10,value:o,onChange:w=>{const x=Number(w.target.value);c(x),k(r,i,x,f)}})]}),s.jsxs("div",{className:"field",style:{margin:"12px 0 0"},children:[s.jsx("label",{htmlFor:"onb-vip",children:"VIP list"}),s.jsx("input",{id:"onb-vip",className:"input",placeholder:"emails or domains, comma-separated",value:u,onChange:w=>m(w.target.value)})]})]}),s.jsxs("div",{className:"onb-panel",children:[s.jsx("h4",{children:"Cancel default"}),s.jsxs("div",{className:"onb-radio-row",children:[s.jsxs("label",{children:[s.jsx("input",{type:"radio",name:"onb-cancel",checked:f==="end_of_period",onChange:()=>{h("end_of_period"),k(r,i,o,"end_of_period")}}),"end of period (recommended)"]}),s.jsxs("label",{children:[s.jsx("input",{type:"radio",name:"onb-cancel",checked:f==="immediate",onChange:()=>{h("immediate"),k(r,i,o,"immediate")}}),"immediate"]})]}),s.jsx("p",{className:"onb-fine-note",children:"Everything here is pre-filled from your history. All of it is optional."})]})]}),s.jsxs("div",{className:"onb-contract",children:[s.jsxs("h4",{children:["Your behavior contract"," ",s.jsx(Q,{tip:"This paragraph is the policy. It is written into policies.md verbatim — editing the prose is editing the policy.",label:"What is the behavior contract?"})]}),s.jsx("textarea",{spellCheck:!1,value:y,onChange:w=>v(w.target.value),"aria-label":"Behavior contract"}),s.jsxs("p",{className:"caption",children:[s.jsx("b",{children:"Editing this prose is editing the policy"})," — it's written into policies.md verbatim. ",s.jsx("a",{href:"#/overlay",children:"see the full policy book →"})]})]}),s.jsx("div",{className:"onb-cta-row",style:{marginTop:24},children:s.jsx("button",{className:"btn btn-primary",disabled:j||y.trim().length<20,onClick:()=>void C(),children:j?"Saving…":"Save style & continue"})})]})}function um({st:e,refresh:t}){var o;const n=Oe(()=>R.getCalibrations(),[]),r=((o=n.data)==null?void 0:o.calibrations)??[],l=r.filter(c=>c.verdict==null||c.verdict===""),i=e.stages.calibration,a=N.useRef(!1);return N.useEffect(()=>{!n.data||a.current||(r.length>0&&l.length===0&&i!=="done"?(a.current=!0,R.setOnboardingStage("calibration","done").then(()=>t()).finally(()=>{a.current=!1})):l.length>0&&i==="pending"&&(a.current=!0,R.setOnboardingStage("calibration","active").then(()=>t()).finally(()=>{a.current=!1})))},[n.data,r.length,l.length,i,t]),s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"go-live",title:"Shadow drafts",lede:"Before I touch anything real — threads you already answered, and what I would have sent.",meta:r.length>0?s.jsxs("div",{className:"onb-head-meta",children:[s.jsxs("span",{className:"mono",children:[r.length-l.length," of ",r.length," reviewed"]}),s.jsx("a",{className:"quiet-link",href:"#/calibration",children:"all calibrations →"})]}):void 0}),n.loading&&!n.data&&s.jsx(st,{label:"Loading shadow drafts…"}),n.error&&s.jsx(Ge,{message:n.error,onRetry:n.reload}),n.data&&r.length===0&&s.jsx("p",{className:"onb-hint",children:"No calibration pairs yet — your agent creates them by drafting against threads you already answered."}),l.map(c=>s.jsx(vd,{cal:c,onReviewed:()=>{n.reload(),t()}},c.id)),n.data&&r.length>0&&l.length===0&&s.jsx("div",{className:"onb-strip",children:s.jsxs("p",{children:["All ",r.length," reviewed. Your verdicts are learning-loop input — the overlay picks them up before anything goes live."]})})]})}const dm=[{key:"money",head:"🟡 Money — review these first",help:"Proposals that move money — a refund or cancellation. They sort first and run only on your click."},{key:"reply",head:"✉️ Reply drafted",help:"Drafts ready for your review — nothing is sent until you approve it."},{key:"escalated",head:"⚠️ Escalated to you",help:"Cases the agent will not act on — legal or chargeback threats, VIPs, anything over your limits."},{key:"ignorable",head:"🚫 Ignorable, marked not deleted",help:"Newsletters and receipts — marked so they stay out of your way, never deleted."}];function fm({st:e,batchDone:t}){const n=et(e.confirmations.mailbox_inventory),r=et(e.confirmations.stripe_inventory),l=h=>{window.location.hash=h},i=[{label:`${q(n.inboxMessages)} conversations`,hash:"#/connections"},{label:`${q(n.sentMessages)} sent replies`,hash:"#/connections"},{label:"pricing page + ToS",hash:"#/overlay"},{label:`${q(r.charges)} charges`,hash:"#/connections"},{label:`${q(r.refunds)} refunds · ${q(r.disputes)} disputes`,hash:"#/connections"}],a=["voice.md","products.md","policies.md"],o=t?q(t.processed):"—",c=t?q(t.drafts):"—",u=Un(e.startedAt),m=Un(e.timestamps.first_batch_done),f=u!=null&&m!=null?Math.max(1,Math.round((m-u)/6e4)):null;return s.jsxs("div",{className:"onb-golive-block",children:[s.jsx("h3",{children:"What got built"}),s.jsx("div",{className:"onb-pmap-wrap",children:s.jsxs("svg",{className:"onb-pmap",viewBox:"0 0 960 232",width:"100%","aria-label":"Prep map: sources to overlay files to policy book to today's queue",children:[s.jsx("path",{className:"edge",d:"M198 24 C260 24 258 45 320 45"}),s.jsx("path",{className:"edge",d:"M198 66 C260 66 258 45 320 45"}),s.jsx("path",{className:"edge",d:"M198 108 L320 108"}),s.jsx("path",{className:"edge",d:"M198 150 C260 150 258 171 320 171"}),s.jsx("path",{className:"edge",d:"M198 192 C260 192 258 171 320 171"}),s.jsx("path",{className:"edge",d:"M470 45 C520 45 522 100 572 100"}),s.jsx("path",{className:"edge",d:"M470 108 L572 108"}),s.jsx("path",{className:"edge",d:"M470 171 C520 171 522 116 572 116"}),s.jsx("path",{className:"edge",d:"M762 108 L800 108"}),i.map((h,y)=>s.jsxs("g",{className:"node",onClick:()=>l(h.hash),children:[s.jsx("rect",{className:"n-box",x:8,y:8+y*42,width:190,height:32,rx:8}),s.jsx("text",{x:103,y:28+y*42,textAnchor:"middle",children:h.label})]},h.label)),a.map((h,y)=>s.jsxs("g",{className:"node n-file",onClick:()=>l("#/overlay"),children:[s.jsx("rect",{className:"n-box",x:320,y:29+y*63,width:150,height:32,rx:8}),s.jsx("text",{className:"t-mono",x:395,y:49+y*63,textAnchor:"middle",children:h})]},h)),s.jsxs("g",{className:"node n-file",onClick:()=>l("#/overlay"),children:[s.jsx("rect",{className:"n-box",x:572,y:82,width:190,height:52,rx:10}),s.jsx("text",{x:667,y:103,textAnchor:"middle",children:"your policy book"}),s.jsx("text",{className:"t-sub",x:667,y:121,textAnchor:"middle",children:".clearhand/overlay"})]}),s.jsxs("g",{className:"node n-today",onClick:()=>l("#/"),children:[s.jsx("rect",{className:"n-box",x:800,y:82,width:152,height:52,rx:10}),s.jsxs("text",{x:876,y:103,textAnchor:"middle",children:["today: ",o," processed,"]}),s.jsxs("text",{x:876,y:121,textAnchor:"middle",children:[c," drafts await you"]})]})]})}),s.jsxs("p",{className:"onb-pmap-caption",children:["Built from your data, on your machine",f!=null?`, in ${f} minute${f===1?"":"s"}`:"",". It keeps learning from every edit you make."]})]})}function pm({st:e,events:t,driver:n,refresh:r}){const{status:l}=dt(),i=Ce(),o=e.stages.first_batch==="active",c=jd(o),u=t.filter(L=>L.stage==="first_batch"&&L.kind==="batch_case"),m=[...t].reverse().find(L=>L.stage==="first_batch"&&L.kind==="batch_done"),f=m?et(m.payload):null,h=(l==null?void 0:l.connections.mailbox.address)??z(e.confirmations.mailbox_address),y=h?h.split("@")[0].split(/[.+_-]/)[0]:null,j=y&&!new Set(["support","hello","hi","info","admin","contact","help","team","sales","billing","care","service","mail","no-reply","noreply"]).has(y.toLowerCase())?y.charAt(0).toUpperCase()+y.slice(1):"there",_=f?q(f.processed):u.length>0?String(u.length):"—",p=Un(e.timestamps.first_batch_active),d=f?Un(e.timestamps.first_batch_done):c,g=p!=null&&d!=null?xd(d-p):null,k=f?`triaged ${q(f.processed)}/${q(f.processed)}${g?` · ${g}`:""}`:(e.activity.first_batch??`triaged ${u.length}`)+(g?` · ${g}`:""),C=e.confirmations.first_batch_stop===!0,b=async()=>{n.stop();try{await R.postOnboardingConfirmation("first_batch_stop",!0),await r()}catch(L){i(L instanceof Error?L.message:"Could not stop","error")}},w=()=>{R.setOnboardingStage("live","done").catch(()=>{}).finally(()=>{window.location.hash="#/"})},x=L=>{const M=u.filter($=>z(et($.payload).group)===L&&!(z(et($.payload).title)??"").startsWith("+")).length;if(!f)return M;if(L==="money")return q(f.money);if(L==="escalated")return q(f.escalated);if(L==="ignorable")return q(f.ignorable);const W=Number(f.drafts),ve=Number(f.money);return Number.isFinite(W)&&Number.isFinite(ve)?Math.max(W-ve,M):M};return s.jsxs("section",{className:"onb-screen",children:[s.jsx(Vt,{kicker:"go-live",title:"The first batch."}),s.jsxs("div",{className:"onb-greet",children:[s.jsxs("div",{children:[s.jsxs("h3",{children:["All set, ",j,"."]}),s.jsxs("p",{children:["Your last 3 days hold ",s.jsxs("strong",{children:[_," customer emails"]}),". I've started on them — first drafts in about a minute. Nothing sends, refunds, or cancels without your click."]})]}),!f&&s.jsx("button",{className:"btn btn-secondary btn-sm",disabled:C||!o,onClick:()=>void b(),children:C?"stopped":"stop"})]}),s.jsxs("div",{className:`onb-batchwrap${o?" running":""}${f?" done":""}`,children:[s.jsxs("div",{className:"batch-counter",children:[s.jsx("span",{className:"pulse"}),s.jsx("span",{children:k})]}),dm.map(L=>{const M=u.filter(W=>z(et(W.payload).group)===L.key);return M.length===0?null:s.jsxs(N.Fragment,{children:[s.jsxs("div",{className:"bg-head",children:[s.jsx(Q,{tip:L.help,label:"What lands in this group?",children:s.jsx("span",{children:L.head})})," ",s.jsxs("span",{className:"bg-count",children:["(",x(L.key),")"]})]}),M.map(W=>{const ve=et(W.payload),$=z(ve.title)??"",hn=$.startsWith("+");return s.jsxs("div",{className:`onb-brow${hn?" more":""}`,children:[s.jsx("span",{className:"br-title",children:$}),z(ve.note)&&s.jsx("span",{className:"br-meta",children:z(ve.note)})]},W.id)})]},L.key)}),f&&s.jsxs("div",{className:"onb-strip onb-batch-end",children:[s.jsxs("p",{children:[q(f.processed)," processed · ",q(f.drafts)," drafts and ",q(f.money)," money proposals await you · nothing sent."]}),s.jsxs("div",{className:"be-cta",children:[s.jsx("button",{className:"btn btn-primary",onClick:w,children:"Review the queue"}),s.jsx("span",{className:"be-sub",children:"sorted money-first"})]})]})]}),f&&s.jsx(fm,{st:e,batchDone:f})]})}function hm(){return s.jsxs("section",{className:"onb-enh",children:[s.jsxs("div",{className:"enh-head",children:["Deeper context ",s.jsx("span",{children:"(optional, later)"})]}),s.jsxs("div",{className:"enh-grid",children:[s.jsxs("div",{className:"enh-card",children:[s.jsxs("div",{className:"e-title",children:["Product analytics",s.jsx("span",{className:"e-tag",children:"planned"})]}),s.jsx("div",{className:"e-prov",children:"PostHog · Google Analytics · Plausible"}),s.jsx("p",{children:"See what a customer did right before they wrote in."})]}),s.jsxs("div",{className:"enh-card",children:[s.jsxs("div",{className:"e-title",children:["Acquisition",s.jsx("span",{className:"e-tag",children:"planned"})]}),s.jsx("div",{className:"e-prov",children:"Search Console · Google Ads"}),s.jsx("p",{children:"Know which promise brought them in the door."})]}),s.jsxs("div",{className:"enh-card",children:[s.jsxs("div",{className:"e-title",children:["Your user database",s.jsx("span",{className:"e-tag",children:"planned"})]}),s.jsx("div",{className:"e-prov",children:"read-only DSN"}),s.jsx("p",{children:"The deepest context: plan state, usage, flags. Power-user setup."})]})]}),s.jsx("a",{className:"quiet-link",href:"https://github.com/honganai/clearhand-help/issues/new",target:"_blank",rel:"noopener noreferrer",children:"Want one of these sooner? Tell us →"})]})}function mm(){const e=Qh(),{reloadStatus:t}=dt(),n=tm(e,t),r=Ce();if(e.loading&&!e.state)return s.jsx(st,{label:"Loading setup…"});if(!e.state)return s.jsx(Ge,{message:e.error??"Could not load onboarding state."});const l=e.state,i=l.stages,a=Object.values(i).every(v=>v==="pending"),o=Bo(i.arrival)||i.mailbox!=="pending",c=Bo(i.mailbox)||i.stripe!=="pending",u=Pe(i.mailbox)||Pe(i.stripe)||Et.some(v=>i[v.stage]!=="pending"),m=Et.every(v=>Pe(i[v.stage]))||i.style!=="pending",f=Pe(i.style)||i.calibration!=="pending",h=Pe(i.calibration)||i.first_batch!=="pending",y=async()=>{await R.setOnboardingStage("arrival","done"),await R.setOnboardingStage("mailbox","active"),await e.refresh()};return s.jsxs("div",{className:"onb",children:[s.jsx(Jh,{st:l}),e.error&&!e.loading&&s.jsxs("p",{className:"onb-demo-note",children:["Live updates hiccuped: ",e.error,". Retrying on the next poll."]}),a&&s.jsx(nm,{demoMode:e.demoMode,driver:n,onStart:()=>y().catch(v=>{r(v instanceof Error?v.message:"Could not start","error")})}),o&&s.jsx(rm,{st:l,demoMode:e.demoMode,refresh:e.refresh}),c&&s.jsx(sm,{st:l,demoMode:e.demoMode,refresh:e.refresh}),u&&s.jsx(am,{st:l,events:e.events,refresh:e.refresh}),m&&s.jsx(cm,{st:l,refresh:e.refresh}),f&&s.jsx(um,{st:l,refresh:e.refresh}),h&&s.jsx(pm,{st:l,events:e.events,driver:n,refresh:e.refresh}),u&&s.jsx(hm,{})]})}const gm=[{hash:"#/",label:"Queue",icon:"inbox",isActive:e=>e==="/"||e.startsWith("/case/")},{hash:"#/connections",label:"Connections & Trust",icon:"shield",isActive:e=>e.startsWith("/connections")},{hash:"#/calibration",label:"Calibration",icon:"sliders",isActive:e=>e.startsWith("/calibration")},{hash:"#/overlay",label:"Policy Book",icon:"book",isActive:e=>e.startsWith("/overlay")},{hash:"#/activity",label:"Activity",icon:"pulse",isActive:e=>e.startsWith("/activity")},{hash:"#/onboarding",label:"Setup",icon:"hand",isActive:e=>e.startsWith("/onboarding")}];function ym({route:e,status:t,setupIncomplete:n}){return s.jsxs("nav",{className:"sidebar","aria-label":"Main navigation",children:[s.jsxs("a",{className:"wordmark",href:"#/",children:["clearhand",s.jsx("span",{className:"wordmark-dot","aria-hidden":"true"})]}),s.jsx("div",{className:"wordmark-sub",children:"safe hands for support"}),gm.map(r=>s.jsxs("a",{className:`nav-item${r.isActive(e)?" active":""}`,href:r.hash,children:[s.jsx(H,{name:r.icon}),r.label,r.label==="Queue"&&t&&t.queue.open_cases>0&&s.jsx("span",{className:"nav-count",children:t.queue.open_cases}),r.label==="Setup"&&n&&s.jsx("span",{className:"nav-dot","aria-label":"setup incomplete"})]},r.hash)),s.jsxs("div",{className:"sidebar-foot",children:[(t==null?void 0:t.demo_mode)&&s.jsx("span",{className:"pill pill-amber",children:"demo mode"}),s.jsxs("span",{children:[t?`clearhand ${t.clearhand}`:"clearhand"," · local only"]})]})]})}function vm({route:e}){if(e==="/")return s.jsx(ph,{});const t=/^\/case\/(\d+)/.exec(e);return t?s.jsx(Ph,{id:Number(t[1])}):e.startsWith("/connections")?s.jsx(Rh,{}):e.startsWith("/calibration")?s.jsx(Ah,{}):e.startsWith("/overlay")?s.jsx(Dh,{}):e.startsWith("/activity")?s.jsx(Vh,{}):e.startsWith("/onboarding")?s.jsx(mm,{}):s.jsxs("div",{className:"empty-state",children:[s.jsx("div",{className:"empty-state-title",children:"Page not found"}),s.jsx("div",{className:"empty-state-body",children:s.jsx("a",{href:"#/",children:"Back to the queue"})})]})}function xm(){const e=nh(),t=Oe(()=>R.getStatus(),[]),n=Oe(()=>R.getOnboarding(),[e]),r=n.data?!Object.values(n.data.state.stages).every(l=>l==="done"||l==="skipped"):!1;return s.jsx(uh,{children:s.jsx(od.Provider,{value:{status:t.data,reloadStatus:t.reload},children:s.jsxs("div",{className:"app",children:[s.jsx(ym,{route:e,status:t.data,setupIncomplete:r}),s.jsx("main",{className:"main",children:s.jsx("div",{className:"content",children:s.jsx(vm,{route:e})})})]})})})}$l.createRoot(document.getElementById("root")).render(s.jsx(Ud.StrictMode,{children:s.jsx(xm,{})}));