@reshotdev/screenshot 0.0.1-beta.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 (59) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +388 -0
  3. package/package.json +64 -0
  4. package/src/commands/auth.js +259 -0
  5. package/src/commands/chrome.js +140 -0
  6. package/src/commands/ci-run.js +123 -0
  7. package/src/commands/ci-setup.js +288 -0
  8. package/src/commands/drifts.js +423 -0
  9. package/src/commands/import-tests.js +309 -0
  10. package/src/commands/ingest.js +458 -0
  11. package/src/commands/init.js +633 -0
  12. package/src/commands/publish.js +1721 -0
  13. package/src/commands/pull.js +303 -0
  14. package/src/commands/record.js +94 -0
  15. package/src/commands/run.js +476 -0
  16. package/src/commands/setup-wizard.js +740 -0
  17. package/src/commands/setup.js +137 -0
  18. package/src/commands/status.js +275 -0
  19. package/src/commands/sync.js +621 -0
  20. package/src/commands/ui.js +248 -0
  21. package/src/commands/validate-docs.js +529 -0
  22. package/src/index.js +462 -0
  23. package/src/lib/api-client.js +815 -0
  24. package/src/lib/capture-engine.js +1623 -0
  25. package/src/lib/capture-script-runner.js +3120 -0
  26. package/src/lib/ci-detect.js +137 -0
  27. package/src/lib/config.js +1240 -0
  28. package/src/lib/diff-engine.js +642 -0
  29. package/src/lib/hash.js +74 -0
  30. package/src/lib/image-crop.js +396 -0
  31. package/src/lib/matrix.js +89 -0
  32. package/src/lib/output-path-template.js +318 -0
  33. package/src/lib/playwright-runner.js +252 -0
  34. package/src/lib/polished-clip.js +553 -0
  35. package/src/lib/privacy-engine.js +408 -0
  36. package/src/lib/progress-tracker.js +142 -0
  37. package/src/lib/record-browser-injection.js +654 -0
  38. package/src/lib/record-cdp.js +612 -0
  39. package/src/lib/record-clip.js +343 -0
  40. package/src/lib/record-config.js +623 -0
  41. package/src/lib/record-screenshot.js +360 -0
  42. package/src/lib/record-terminal.js +123 -0
  43. package/src/lib/recorder-service.js +781 -0
  44. package/src/lib/secrets.js +51 -0
  45. package/src/lib/selector-strategies.js +859 -0
  46. package/src/lib/standalone-mode.js +400 -0
  47. package/src/lib/storage-providers.js +569 -0
  48. package/src/lib/style-engine.js +684 -0
  49. package/src/lib/ui-api.js +4677 -0
  50. package/src/lib/ui-assets.js +373 -0
  51. package/src/lib/ui-executor.js +587 -0
  52. package/src/lib/variant-injector.js +591 -0
  53. package/src/lib/viewport-presets.js +454 -0
  54. package/src/lib/worker-pool.js +118 -0
  55. package/web/cropper/index.html +436 -0
  56. package/web/manager/dist/assets/index--ZgioErz.js +507 -0
  57. package/web/manager/dist/assets/index-n468W0Wr.css +1 -0
  58. package/web/manager/dist/index.html +27 -0
  59. package/web/subtitle-editor/index.html +295 -0
@@ -0,0 +1,507 @@
1
+ function Hm(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function s(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=s(i);fetch(i.href,a)}})();function Jm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kh={exports:{}},Va={},bh={exports:{}},we={};/**
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 pi=Symbol.for("react.element"),qm=Symbol.for("react.portal"),Gm=Symbol.for("react.fragment"),Qm=Symbol.for("react.strict_mode"),Ym=Symbol.for("react.profiler"),Xm=Symbol.for("react.provider"),Zm=Symbol.for("react.context"),ex=Symbol.for("react.forward_ref"),tx=Symbol.for("react.suspense"),sx=Symbol.for("react.memo"),nx=Symbol.for("react.lazy"),Vd=Symbol.iterator;function rx(e){return e===null||typeof e!="object"?null:(e=Vd&&e[Vd]||e["@@iterator"],typeof e=="function"?e:null)}var Sh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ch=Object.assign,Eh={};function hr(e,t,s){this.props=e,this.context=t,this.refs=Eh,this.updater=s||Sh}hr.prototype.isReactComponent={};hr.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")};hr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Rh(){}Rh.prototype=hr.prototype;function Xl(e,t,s){this.props=e,this.context=t,this.refs=Eh,this.updater=s||Sh}var Zl=Xl.prototype=new Rh;Zl.constructor=Xl;Ch(Zl,hr.prototype);Zl.isPureReactComponent=!0;var Ud=Array.isArray,_h=Object.prototype.hasOwnProperty,ec={current:null},Ph={key:!0,ref:!0,__self:!0,__source:!0};function Th(e,t,s){var r,i={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)_h.call(t,r)&&!Ph.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=s;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:pi,type:e,key:a,ref:o,props:i,_owner:ec.current}}function ix(e,t){return{$$typeof:pi,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function tc(e){return typeof e=="object"&&e!==null&&e.$$typeof===pi}function ax(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(s){return t[s]})}var Bd=/\/+/g;function po(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ax(""+e.key):t.toString(36)}function Ki(e,t,s,r,i){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case pi:case qm:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+po(o,0):r,Ud(i)?(s="",e!=null&&(s=e.replace(Bd,"$&/")+"/"),Ki(i,t,s,"",function(u){return u})):i!=null&&(tc(i)&&(i=ix(i,s+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Bd,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",Ud(e))for(var l=0;l<e.length;l++){a=e[l];var c=r+po(a,l);o+=Ki(a,t,s,c,i)}else if(c=rx(e),typeof c=="function")for(e=c.call(e),l=0;!(a=e.next()).done;)a=a.value,c=r+po(a,l++),o+=Ki(a,t,s,c,i);else if(a==="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 o}function bi(e,t,s){if(e==null)return e;var r=[],i=0;return Ki(e,r,"","",function(a){return t.call(s,a,i++)}),r}function ox(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(s){(e._status===0||e._status===-1)&&(e._status=1,e._result=s)},function(s){(e._status===0||e._status===-1)&&(e._status=2,e._result=s)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var jt={current:null},Hi={transition:null},lx={ReactCurrentDispatcher:jt,ReactCurrentBatchConfig:Hi,ReactCurrentOwner:ec};function Ah(){throw Error("act(...) is not supported in production builds of React.")}we.Children={map:bi,forEach:function(e,t,s){bi(e,function(){t.apply(this,arguments)},s)},count:function(e){var t=0;return bi(e,function(){t++}),t},toArray:function(e){return bi(e,function(t){return t})||[]},only:function(e){if(!tc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};we.Component=hr;we.Fragment=Gm;we.Profiler=Ym;we.PureComponent=Xl;we.StrictMode=Qm;we.Suspense=tx;we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lx;we.act=Ah;we.cloneElement=function(e,t,s){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ch({},e.props),i=e.key,a=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,o=ec.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)_h.call(t,c)&&!Ph.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=s;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:pi,type:e.type,key:i,ref:a,props:r,_owner:o}};we.createContext=function(e){return e={$$typeof:Zm,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Xm,_context:e},e.Consumer=e};we.createElement=Th;we.createFactory=function(e){var t=Th.bind(null,e);return t.type=e,t};we.createRef=function(){return{current:null}};we.forwardRef=function(e){return{$$typeof:ex,render:e}};we.isValidElement=tc;we.lazy=function(e){return{$$typeof:nx,_payload:{_status:-1,_result:e},_init:ox}};we.memo=function(e,t){return{$$typeof:sx,type:e,compare:t===void 0?null:t}};we.startTransition=function(e){var t=Hi.transition;Hi.transition={};try{e()}finally{Hi.transition=t}};we.unstable_act=Ah;we.useCallback=function(e,t){return jt.current.useCallback(e,t)};we.useContext=function(e){return jt.current.useContext(e)};we.useDebugValue=function(){};we.useDeferredValue=function(e){return jt.current.useDeferredValue(e)};we.useEffect=function(e,t){return jt.current.useEffect(e,t)};we.useId=function(){return jt.current.useId()};we.useImperativeHandle=function(e,t,s){return jt.current.useImperativeHandle(e,t,s)};we.useInsertionEffect=function(e,t){return jt.current.useInsertionEffect(e,t)};we.useLayoutEffect=function(e,t){return jt.current.useLayoutEffect(e,t)};we.useMemo=function(e,t){return jt.current.useMemo(e,t)};we.useReducer=function(e,t,s){return jt.current.useReducer(e,t,s)};we.useRef=function(e){return jt.current.useRef(e)};we.useState=function(e){return jt.current.useState(e)};we.useSyncExternalStore=function(e,t,s){return jt.current.useSyncExternalStore(e,t,s)};we.useTransition=function(){return jt.current.useTransition()};we.version="18.3.1";bh.exports=we;var d=bh.exports;const Oh=Jm(d),zh=Hm({__proto__:null,default:Oh},[d]);/**
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 cx=d,dx=Symbol.for("react.element"),ux=Symbol.for("react.fragment"),hx=Object.prototype.hasOwnProperty,fx=cx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,px={key:!0,ref:!0,__self:!0,__source:!0};function Lh(e,t,s){var r,i={},a=null,o=null;s!==void 0&&(a=""+s),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)hx.call(t,r)&&!px.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:dx,type:e,key:a,ref:o,props:i,_owner:fx.current}}Va.Fragment=ux;Va.jsx=Lh;Va.jsxs=Lh;kh.exports=Va;var n=kh.exports,Ho={},Mh={exports:{}},It={},Ih={exports:{}},Dh={};/**
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(E,A){var z=E.length;E.push(A);e:for(;0<z;){var W=z-1>>>1,J=E[W];if(0<i(J,A))E[W]=A,E[z]=J,z=W;else break e}}function s(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var A=E[0],z=E.pop();if(z!==A){E[0]=z;e:for(var W=0,J=E.length,G=J>>>1;W<G;){var fe=2*(W+1)-1,ye=E[fe],ge=fe+1,Re=E[ge];if(0>i(ye,z))ge<J&&0>i(Re,ye)?(E[W]=Re,E[ge]=z,W=ge):(E[W]=ye,E[fe]=z,W=fe);else if(ge<J&&0>i(Re,z))E[W]=Re,E[ge]=z,W=ge;else break e}}return A}function i(E,A){var z=E.sortIndex-A.sortIndex;return z!==0?z:E.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],m=1,f=null,g=3,R=!1,k=!1,C=!1,j=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(E){for(var A=s(u);A!==null;){if(A.callback===null)r(u);else if(A.startTime<=E)r(u),A.sortIndex=A.expirationTime,t(c,A);else break;A=s(u)}}function w(E){if(C=!1,x(E),!k)if(s(c)!==null)k=!0,F(N);else{var A=s(u);A!==null&&$(w,A.startTime-E)}}function N(E,A){k=!1,C&&(C=!1,p(b),b=-1),R=!0;var z=g;try{for(x(A),f=s(c);f!==null&&(!(f.expirationTime>A)||E&&!v());){var W=f.callback;if(typeof W=="function"){f.callback=null,g=f.priorityLevel;var J=W(f.expirationTime<=A);A=e.unstable_now(),typeof J=="function"?f.callback=J:f===s(c)&&r(c),x(A)}else r(c);f=s(c)}if(f!==null)var G=!0;else{var fe=s(u);fe!==null&&$(w,fe.startTime-A),G=!1}return G}finally{f=null,g=z,R=!1}}var S=!1,P=null,b=-1,O=5,D=-1;function v(){return!(e.unstable_now()-D<O)}function L(){if(P!==null){var E=e.unstable_now();D=E;var A=!0;try{A=P(!0,E)}finally{A?V():(S=!1,P=null)}}else S=!1}var V;if(typeof h=="function")V=function(){h(L)};else if(typeof MessageChannel<"u"){var y=new MessageChannel,_=y.port2;y.port1.onmessage=L,V=function(){_.postMessage(null)}}else V=function(){j(L,0)};function F(E){P=E,S||(S=!0,V())}function $(E,A){b=j(function(){E(e.unstable_now())},A)}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(E){E.callback=null},e.unstable_continueExecution=function(){k||R||(k=!0,F(N))},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return s(c)},e.unstable_next=function(E){switch(g){case 1:case 2:case 3:var A=3;break;default:A=g}var z=g;g=A;try{return E()}finally{g=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,A){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var z=g;g=E;try{return A()}finally{g=z}},e.unstable_scheduleCallback=function(E,A,z){var W=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?W+z:W):z=W,E){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=z+J,E={id:m++,callback:A,priorityLevel:E,startTime:z,expirationTime:J,sortIndex:-1},z>W?(E.sortIndex=z,t(u,E),s(c)===null&&E===s(u)&&(C?(p(b),b=-1):C=!0,$(w,z-W))):(E.sortIndex=J,t(c,E),k||R||(k=!0,F(N))),E},e.unstable_shouldYield=v,e.unstable_wrapCallback=function(E){var A=g;return function(){var z=g;g=A;try{return E.apply(this,arguments)}finally{g=z}}}})(Dh);Ih.exports=Dh;var mx=Ih.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 xx=d,Mt=mx;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);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 Fh=new Set,Jr={};function Pn(e,t){rr(e,t),rr(e+"Capture",t)}function rr(e,t){for(Jr[e]=t,e=0;e<t.length;e++)Fh.add(t[e])}var Cs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jo=Object.prototype.hasOwnProperty,gx=/^[: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]*$/,Wd={},Kd={};function vx(e){return Jo.call(Kd,e)?!0:Jo.call(Wd,e)?!1:gx.test(e)?Kd[e]=!0:(Wd[e]=!0,!1)}function yx(e,t,s,r){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function jx(e,t,s,r){if(t===null||typeof t>"u"||yx(e,t,s,r))return!0;if(r)return!1;if(s!==null)switch(s.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 wt(e,t,s,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var dt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){dt[e]=new wt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];dt[t]=new wt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){dt[e]=new wt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){dt[e]=new wt(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){dt[e]=new wt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){dt[e]=new wt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){dt[e]=new wt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){dt[e]=new wt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){dt[e]=new wt(e,5,!1,e.toLowerCase(),null,!1,!1)});var sc=/[\-:]([a-z])/g;function nc(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(sc,nc);dt[t]=new wt(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(sc,nc);dt[t]=new wt(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(sc,nc);dt[t]=new wt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){dt[e]=new wt(e,1,!1,e.toLowerCase(),null,!1,!1)});dt.xlinkHref=new wt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){dt[e]=new wt(e,1,!1,e.toLowerCase(),null,!0,!0)});function rc(e,t,s,r){var i=dt.hasOwnProperty(t)?dt[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(jx(t,s,i,r)&&(s=null),r||i===null?vx(t)&&(s===null?e.removeAttribute(t):e.setAttribute(t,""+s)):i.mustUseProperty?e[i.propertyName]=s===null?i.type===3?!1:"":s:(t=i.attributeName,r=i.attributeNamespace,s===null?e.removeAttribute(t):(i=i.type,s=i===3||i===4&&s===!0?"":""+s,r?e.setAttributeNS(r,t,s):e.setAttribute(t,s))))}var As=xx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Si=Symbol.for("react.element"),Mn=Symbol.for("react.portal"),In=Symbol.for("react.fragment"),ic=Symbol.for("react.strict_mode"),qo=Symbol.for("react.profiler"),$h=Symbol.for("react.provider"),Vh=Symbol.for("react.context"),ac=Symbol.for("react.forward_ref"),Go=Symbol.for("react.suspense"),Qo=Symbol.for("react.suspense_list"),oc=Symbol.for("react.memo"),Ds=Symbol.for("react.lazy"),Uh=Symbol.for("react.offscreen"),Hd=Symbol.iterator;function yr(e){return e===null||typeof e!="object"?null:(e=Hd&&e[Hd]||e["@@iterator"],typeof e=="function"?e:null)}var Ue=Object.assign,mo;function Tr(e){if(mo===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);mo=t&&t[1]||""}return`
34
+ `+mo+e}var xo=!1;function go(e,t){if(!e||xo)return"";xo=!0;var s=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 i=u.stack.split(`
35
+ `),a=r.stack.split(`
36
+ `),o=i.length-1,l=a.length-1;1<=o&&0<=l&&i[o]!==a[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==a[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==a[l]){var c=`
37
+ `+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{xo=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?Tr(e):""}function wx(e){switch(e.tag){case 5:return Tr(e.type);case 16:return Tr("Lazy");case 13:return Tr("Suspense");case 19:return Tr("SuspenseList");case 0:case 2:case 15:return e=go(e.type,!1),e;case 11:return e=go(e.type.render,!1),e;case 1:return e=go(e.type,!0),e;default:return""}}function Yo(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 In:return"Fragment";case Mn:return"Portal";case qo:return"Profiler";case ic:return"StrictMode";case Go:return"Suspense";case Qo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Vh:return(e.displayName||"Context")+".Consumer";case $h:return(e._context.displayName||"Context")+".Provider";case ac:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case oc:return t=e.displayName||null,t!==null?t:Yo(e.type)||"Memo";case Ds:t=e._payload,e=e._init;try{return Yo(e(t))}catch{}}return null}function Nx(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 Yo(t);case 8:return t===ic?"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 sn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kx(e){var t=Bh(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var i=s.get,a=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ci(e){e._valueTracker||(e._valueTracker=kx(e))}function Wh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),r="";return e&&(r=Bh(e)?e.checked?"true":"false":e.value),e=r,e!==s?(t.setValue(e),!0):!1}function da(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 Xo(e,t){var s=t.checked;return Ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Jd(e,t){var s=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;s=sn(t.value!=null?t.value:s),e._wrapperState={initialChecked:r,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Kh(e,t){t=t.checked,t!=null&&rc(e,"checked",t,!1)}function Zo(e,t){Kh(e,t);var s=sn(t.value),r=t.type;if(s!=null)r==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?el(e,t.type,s):t.hasOwnProperty("defaultValue")&&el(e,t.type,sn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function qd(e,t,s){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,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function el(e,t,s){(t!=="number"||da(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ar=Array.isArray;function qn(e,t,s,r){if(e=e.options,t){t={};for(var i=0;i<s.length;i++)t["$"+s[i]]=!0;for(s=0;s<e.length;s++)i=t.hasOwnProperty("$"+e[s].value),e[s].selected!==i&&(e[s].selected=i),i&&r&&(e[s].defaultSelected=!0)}else{for(s=""+sn(s),t=null,i=0;i<e.length;i++){if(e[i].value===s){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function tl(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(K(91));return Ue({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Gd(e,t){var s=t.value;if(s==null){if(s=t.children,t=t.defaultValue,s!=null){if(t!=null)throw Error(K(92));if(Ar(s)){if(1<s.length)throw Error(K(93));s=s[0]}t=s}t==null&&(t=""),s=t}e._wrapperState={initialValue:sn(s)}}function Hh(e,t){var s=sn(t.value),r=sn(t.defaultValue);s!=null&&(s=""+s,s!==e.value&&(e.value=s),t.defaultValue==null&&e.defaultValue!==s&&(e.defaultValue=s)),r!=null&&(e.defaultValue=""+r)}function Qd(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Jh(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 sl(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Jh(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ei,qh=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,s,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,s,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ei=Ei||document.createElement("div"),Ei.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ei.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function qr(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Mr={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},bx=["Webkit","ms","Moz","O"];Object.keys(Mr).forEach(function(e){bx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mr[t]=Mr[e]})});function Gh(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Mr.hasOwnProperty(e)&&Mr[e]?(""+t).trim():t+"px"}function Qh(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var r=s.indexOf("--")===0,i=Gh(s,t[s],r);s==="float"&&(s="cssFloat"),r?e.setProperty(s,i):e[s]=i}}var Sx=Ue({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 nl(e,t){if(t){if(Sx[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function rl(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 il=null;function lc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var al=null,Gn=null,Qn=null;function Yd(e){if(e=gi(e)){if(typeof al!="function")throw Error(K(280));var t=e.stateNode;t&&(t=Ha(t),al(e.stateNode,e.type,t))}}function Yh(e){Gn?Qn?Qn.push(e):Qn=[e]:Gn=e}function Xh(){if(Gn){var e=Gn,t=Qn;if(Qn=Gn=null,Yd(e),t)for(e=0;e<t.length;e++)Yd(t[e])}}function Zh(e,t){return e(t)}function ef(){}var vo=!1;function tf(e,t,s){if(vo)return e(t,s);vo=!0;try{return Zh(e,t,s)}finally{vo=!1,(Gn!==null||Qn!==null)&&(ef(),Xh())}}function Gr(e,t){var s=e.stateNode;if(s===null)return null;var r=Ha(s);if(r===null)return null;s=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(s&&typeof s!="function")throw Error(K(231,t,typeof s));return s}var ol=!1;if(Cs)try{var jr={};Object.defineProperty(jr,"passive",{get:function(){ol=!0}}),window.addEventListener("test",jr,jr),window.removeEventListener("test",jr,jr)}catch{ol=!1}function Cx(e,t,s,r,i,a,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(s,u)}catch(m){this.onError(m)}}var Ir=!1,ua=null,ha=!1,ll=null,Ex={onError:function(e){Ir=!0,ua=e}};function Rx(e,t,s,r,i,a,o,l,c){Ir=!1,ua=null,Cx.apply(Ex,arguments)}function _x(e,t,s,r,i,a,o,l,c){if(Rx.apply(this,arguments),Ir){if(Ir){var u=ua;Ir=!1,ua=null}else throw Error(K(198));ha||(ha=!0,ll=u)}}function Tn(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function sf(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 Xd(e){if(Tn(e)!==e)throw Error(K(188))}function Px(e){var t=e.alternate;if(!t){if(t=Tn(e),t===null)throw Error(K(188));return t!==e?null:e}for(var s=e,r=t;;){var i=s.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){s=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===s)return Xd(i),e;if(a===r)return Xd(i),t;a=a.sibling}throw Error(K(188))}if(s.return!==r.return)s=i,r=a;else{for(var o=!1,l=i.child;l;){if(l===s){o=!0,s=i,r=a;break}if(l===r){o=!0,r=i,s=a;break}l=l.sibling}if(!o){for(l=a.child;l;){if(l===s){o=!0,s=a,r=i;break}if(l===r){o=!0,r=a,s=i;break}l=l.sibling}if(!o)throw Error(K(189))}}if(s.alternate!==r)throw Error(K(190))}if(s.tag!==3)throw Error(K(188));return s.stateNode.current===s?e:t}function nf(e){return e=Px(e),e!==null?rf(e):null}function rf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=rf(e);if(t!==null)return t;e=e.sibling}return null}var af=Mt.unstable_scheduleCallback,Zd=Mt.unstable_cancelCallback,Tx=Mt.unstable_shouldYield,Ax=Mt.unstable_requestPaint,We=Mt.unstable_now,Ox=Mt.unstable_getCurrentPriorityLevel,cc=Mt.unstable_ImmediatePriority,of=Mt.unstable_UserBlockingPriority,fa=Mt.unstable_NormalPriority,zx=Mt.unstable_LowPriority,lf=Mt.unstable_IdlePriority,Ua=null,ms=null;function Lx(e){if(ms&&typeof ms.onCommitFiberRoot=="function")try{ms.onCommitFiberRoot(Ua,e,void 0,(e.current.flags&128)===128)}catch{}}var rs=Math.clz32?Math.clz32:Dx,Mx=Math.log,Ix=Math.LN2;function Dx(e){return e>>>=0,e===0?32:31-(Mx(e)/Ix|0)|0}var Ri=64,_i=4194304;function Or(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 pa(e,t){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=s&268435455;if(o!==0){var l=o&~i;l!==0?r=Or(l):(a&=o,a!==0&&(r=Or(a)))}else o=s&~i,o!==0?r=Or(o):a!==0&&(r=Or(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if(r&4&&(r|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)s=31-rs(t),i=1<<s,r|=e[s],t&=~i;return r}function Fx(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 $x(e,t){for(var s=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-rs(a),l=1<<o,c=i[o];c===-1?(!(l&s)||l&r)&&(i[o]=Fx(l,t)):c<=t&&(e.expiredLanes|=l),a&=~l}}function cl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function cf(){var e=Ri;return Ri<<=1,!(Ri&4194240)&&(Ri=64),e}function yo(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function mi(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-rs(t),e[t]=s}function Vx(e,t){var s=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<s;){var i=31-rs(s),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,s&=~a}}function dc(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var r=31-rs(s),i=1<<r;i&t|e[r]&t&&(e[r]|=t),s&=~i}}var Pe=0;function df(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var uf,uc,hf,ff,pf,dl=!1,Pi=[],Ks=null,Hs=null,Js=null,Qr=new Map,Yr=new Map,$s=[],Ux="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 eu(e,t){switch(e){case"focusin":case"focusout":Ks=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Js=null;break;case"pointerover":case"pointerout":Qr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yr.delete(t.pointerId)}}function wr(e,t,s,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:s,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=gi(t),t!==null&&uc(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Bx(e,t,s,r,i){switch(t){case"focusin":return Ks=wr(Ks,e,t,s,r,i),!0;case"dragenter":return Hs=wr(Hs,e,t,s,r,i),!0;case"mouseover":return Js=wr(Js,e,t,s,r,i),!0;case"pointerover":var a=i.pointerId;return Qr.set(a,wr(Qr.get(a)||null,e,t,s,r,i)),!0;case"gotpointercapture":return a=i.pointerId,Yr.set(a,wr(Yr.get(a)||null,e,t,s,r,i)),!0}return!1}function mf(e){var t=vn(e.target);if(t!==null){var s=Tn(t);if(s!==null){if(t=s.tag,t===13){if(t=sf(s),t!==null){e.blockedOn=t,pf(e.priority,function(){hf(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ji(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=ul(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var r=new s.constructor(s.type,s);il=r,s.target.dispatchEvent(r),il=null}else return t=gi(s),t!==null&&uc(t),e.blockedOn=s,!1;t.shift()}return!0}function tu(e,t,s){Ji(e)&&s.delete(t)}function Wx(){dl=!1,Ks!==null&&Ji(Ks)&&(Ks=null),Hs!==null&&Ji(Hs)&&(Hs=null),Js!==null&&Ji(Js)&&(Js=null),Qr.forEach(tu),Yr.forEach(tu)}function Nr(e,t){e.blockedOn===t&&(e.blockedOn=null,dl||(dl=!0,Mt.unstable_scheduleCallback(Mt.unstable_NormalPriority,Wx)))}function Xr(e){function t(i){return Nr(i,e)}if(0<Pi.length){Nr(Pi[0],e);for(var s=1;s<Pi.length;s++){var r=Pi[s];r.blockedOn===e&&(r.blockedOn=null)}}for(Ks!==null&&Nr(Ks,e),Hs!==null&&Nr(Hs,e),Js!==null&&Nr(Js,e),Qr.forEach(t),Yr.forEach(t),s=0;s<$s.length;s++)r=$s[s],r.blockedOn===e&&(r.blockedOn=null);for(;0<$s.length&&(s=$s[0],s.blockedOn===null);)mf(s),s.blockedOn===null&&$s.shift()}var Yn=As.ReactCurrentBatchConfig,ma=!0;function Kx(e,t,s,r){var i=Pe,a=Yn.transition;Yn.transition=null;try{Pe=1,hc(e,t,s,r)}finally{Pe=i,Yn.transition=a}}function Hx(e,t,s,r){var i=Pe,a=Yn.transition;Yn.transition=null;try{Pe=4,hc(e,t,s,r)}finally{Pe=i,Yn.transition=a}}function hc(e,t,s,r){if(ma){var i=ul(e,t,s,r);if(i===null)_o(e,t,r,xa,s),eu(e,r);else if(Bx(i,e,t,s,r))r.stopPropagation();else if(eu(e,r),t&4&&-1<Ux.indexOf(e)){for(;i!==null;){var a=gi(i);if(a!==null&&uf(a),a=ul(e,t,s,r),a===null&&_o(e,t,r,xa,s),a===i)break;i=a}i!==null&&r.stopPropagation()}else _o(e,t,r,null,s)}}var xa=null;function ul(e,t,s,r){if(xa=null,e=lc(r),e=vn(e),e!==null)if(t=Tn(e),t===null)e=null;else if(s=t.tag,s===13){if(e=sf(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return xa=e,null}function xf(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(Ox()){case cc:return 1;case of:return 4;case fa:case zx:return 16;case lf:return 536870912;default:return 16}default:return 16}}var Us=null,fc=null,qi=null;function gf(){if(qi)return qi;var e,t=fc,s=t.length,r,i="value"in Us?Us.value:Us.textContent,a=i.length;for(e=0;e<s&&t[e]===i[e];e++);var o=s-e;for(r=1;r<=o&&t[s-r]===i[a-r];r++);return qi=i.slice(e,1<r?1-r:void 0)}function Gi(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 Ti(){return!0}function su(){return!1}function Dt(e){function t(s,r,i,a,o){this._reactName=s,this._targetInst=i,this.type=r,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(s=e[l],this[l]=s?s(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Ti:su,this.isPropagationStopped=su,this}return Ue(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Ti)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ti)},persist:function(){},isPersistent:Ti}),t}var fr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pc=Dt(fr),xi=Ue({},fr,{view:0,detail:0}),Jx=Dt(xi),jo,wo,kr,Ba=Ue({},xi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mc,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!==kr&&(kr&&e.type==="mousemove"?(jo=e.screenX-kr.screenX,wo=e.screenY-kr.screenY):wo=jo=0,kr=e),jo)},movementY:function(e){return"movementY"in e?e.movementY:wo}}),nu=Dt(Ba),qx=Ue({},Ba,{dataTransfer:0}),Gx=Dt(qx),Qx=Ue({},xi,{relatedTarget:0}),No=Dt(Qx),Yx=Ue({},fr,{animationName:0,elapsedTime:0,pseudoElement:0}),Xx=Dt(Yx),Zx=Ue({},fr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),eg=Dt(Zx),tg=Ue({},fr,{data:0}),ru=Dt(tg),sg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ng={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"},rg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ig(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rg[e])?!!t[e]:!1}function mc(){return ig}var ag=Ue({},xi,{key:function(e){if(e.key){var t=sg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Gi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ng[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mc,charCode:function(e){return e.type==="keypress"?Gi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Gi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),og=Dt(ag),lg=Ue({},Ba,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),iu=Dt(lg),cg=Ue({},xi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mc}),dg=Dt(cg),ug=Ue({},fr,{propertyName:0,elapsedTime:0,pseudoElement:0}),hg=Dt(ug),fg=Ue({},Ba,{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}),pg=Dt(fg),mg=[9,13,27,32],xc=Cs&&"CompositionEvent"in window,Dr=null;Cs&&"documentMode"in document&&(Dr=document.documentMode);var xg=Cs&&"TextEvent"in window&&!Dr,vf=Cs&&(!xc||Dr&&8<Dr&&11>=Dr),au=" ",ou=!1;function yf(e,t){switch(e){case"keyup":return mg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dn=!1;function gg(e,t){switch(e){case"compositionend":return jf(t);case"keypress":return t.which!==32?null:(ou=!0,au);case"textInput":return e=t.data,e===au&&ou?null:e;default:return null}}function vg(e,t){if(Dn)return e==="compositionend"||!xc&&yf(e,t)?(e=gf(),qi=fc=Us=null,Dn=!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 vf&&t.locale!=="ko"?null:t.data;default:return null}}var yg={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 lu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!yg[e.type]:t==="textarea"}function wf(e,t,s,r){Yh(r),t=ga(t,"onChange"),0<t.length&&(s=new pc("onChange","change",null,s,r),e.push({event:s,listeners:t}))}var Fr=null,Zr=null;function jg(e){Af(e,0)}function Wa(e){var t=Vn(e);if(Wh(t))return e}function wg(e,t){if(e==="change")return t}var Nf=!1;if(Cs){var ko;if(Cs){var bo="oninput"in document;if(!bo){var cu=document.createElement("div");cu.setAttribute("oninput","return;"),bo=typeof cu.oninput=="function"}ko=bo}else ko=!1;Nf=ko&&(!document.documentMode||9<document.documentMode)}function du(){Fr&&(Fr.detachEvent("onpropertychange",kf),Zr=Fr=null)}function kf(e){if(e.propertyName==="value"&&Wa(Zr)){var t=[];wf(t,Zr,e,lc(e)),tf(jg,t)}}function Ng(e,t,s){e==="focusin"?(du(),Fr=t,Zr=s,Fr.attachEvent("onpropertychange",kf)):e==="focusout"&&du()}function kg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Wa(Zr)}function bg(e,t){if(e==="click")return Wa(t)}function Sg(e,t){if(e==="input"||e==="change")return Wa(t)}function Cg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var os=typeof Object.is=="function"?Object.is:Cg;function ei(e,t){if(os(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(r=0;r<s.length;r++){var i=s[r];if(!Jo.call(t,i)||!os(e[i],t[i]))return!1}return!0}function uu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hu(e,t){var s=uu(e);e=0;for(var r;s;){if(s.nodeType===3){if(r=e+s.textContent.length,e<=t&&r>=t)return{node:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=uu(s)}}function bf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sf(){for(var e=window,t=da();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=da(e.document)}return t}function gc(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 Eg(e){var t=Sf(),s=e.focusedElem,r=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&bf(s.ownerDocument.documentElement,s)){if(r!==null&&gc(s)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=s.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=hu(s,a);var o=hu(s,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<t.length;s++)e=t[s],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Rg=Cs&&"documentMode"in document&&11>=document.documentMode,Fn=null,hl=null,$r=null,fl=!1;function fu(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;fl||Fn==null||Fn!==da(r)||(r=Fn,"selectionStart"in r&&gc(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}),$r&&ei($r,r)||($r=r,r=ga(hl,"onSelect"),0<r.length&&(t=new pc("onSelect","select",null,t,s),e.push({event:t,listeners:r}),t.target=Fn)))}function Ai(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var $n={animationend:Ai("Animation","AnimationEnd"),animationiteration:Ai("Animation","AnimationIteration"),animationstart:Ai("Animation","AnimationStart"),transitionend:Ai("Transition","TransitionEnd")},So={},Cf={};Cs&&(Cf=document.createElement("div").style,"AnimationEvent"in window||(delete $n.animationend.animation,delete $n.animationiteration.animation,delete $n.animationstart.animation),"TransitionEvent"in window||delete $n.transitionend.transition);function Ka(e){if(So[e])return So[e];if(!$n[e])return e;var t=$n[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Cf)return So[e]=t[s];return e}var Ef=Ka("animationend"),Rf=Ka("animationiteration"),_f=Ka("animationstart"),Pf=Ka("transitionend"),Tf=new Map,pu="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 cn(e,t){Tf.set(e,t),Pn(t,[e])}for(var Co=0;Co<pu.length;Co++){var Eo=pu[Co],_g=Eo.toLowerCase(),Pg=Eo[0].toUpperCase()+Eo.slice(1);cn(_g,"on"+Pg)}cn(Ef,"onAnimationEnd");cn(Rf,"onAnimationIteration");cn(_f,"onAnimationStart");cn("dblclick","onDoubleClick");cn("focusin","onFocus");cn("focusout","onBlur");cn(Pf,"onTransitionEnd");rr("onMouseEnter",["mouseout","mouseover"]);rr("onMouseLeave",["mouseout","mouseover"]);rr("onPointerEnter",["pointerout","pointerover"]);rr("onPointerLeave",["pointerout","pointerover"]);Pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Pn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Pn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zr="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(" "),Tg=new Set("cancel close invalid load scroll toggle".split(" ").concat(zr));function mu(e,t,s){var r=e.type||"unknown-event";e.currentTarget=s,_x(r,t,void 0,e),e.currentTarget=null}function Af(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var r=e[s],i=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==a&&i.isPropagationStopped())break e;mu(i,l,u),a=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==a&&i.isPropagationStopped())break e;mu(i,l,u),a=c}}}if(ha)throw e=ll,ha=!1,ll=null,e}function Le(e,t){var s=t[vl];s===void 0&&(s=t[vl]=new Set);var r=e+"__bubble";s.has(r)||(Of(t,e,2,!1),s.add(r))}function Ro(e,t,s){var r=0;t&&(r|=4),Of(s,e,r,t)}var Oi="_reactListening"+Math.random().toString(36).slice(2);function ti(e){if(!e[Oi]){e[Oi]=!0,Fh.forEach(function(s){s!=="selectionchange"&&(Tg.has(s)||Ro(s,!1,e),Ro(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Oi]||(t[Oi]=!0,Ro("selectionchange",!1,t))}}function Of(e,t,s,r){switch(xf(t)){case 1:var i=Kx;break;case 4:i=Hx;break;default:i=hc}s=i.bind(null,t,s,e),i=void 0,!ol||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,s,{capture:!0,passive:i}):e.addEventListener(t,s,!0):i!==void 0?e.addEventListener(t,s,{passive:i}):e.addEventListener(t,s,!1)}function _o(e,t,s,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;l!==null;){if(o=vn(l),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue e}l=l.parentNode}}r=r.return}tf(function(){var u=a,m=lc(s),f=[];e:{var g=Tf.get(e);if(g!==void 0){var R=pc,k=e;switch(e){case"keypress":if(Gi(s)===0)break e;case"keydown":case"keyup":R=og;break;case"focusin":k="focus",R=No;break;case"focusout":k="blur",R=No;break;case"beforeblur":case"afterblur":R=No;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":R=nu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":R=Gx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":R=dg;break;case Ef:case Rf:case _f:R=Xx;break;case Pf:R=hg;break;case"scroll":R=Jx;break;case"wheel":R=pg;break;case"copy":case"cut":case"paste":R=eg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":R=iu}var C=(t&4)!==0,j=!C&&e==="scroll",p=C?g!==null?g+"Capture":null:g;C=[];for(var h=u,x;h!==null;){x=h;var w=x.stateNode;if(x.tag===5&&w!==null&&(x=w,p!==null&&(w=Gr(h,p),w!=null&&C.push(si(h,w,x)))),j)break;h=h.return}0<C.length&&(g=new R(g,k,null,s,m),f.push({event:g,listeners:C}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",R=e==="mouseout"||e==="pointerout",g&&s!==il&&(k=s.relatedTarget||s.fromElement)&&(vn(k)||k[Es]))break e;if((R||g)&&(g=m.window===m?m:(g=m.ownerDocument)?g.defaultView||g.parentWindow:window,R?(k=s.relatedTarget||s.toElement,R=u,k=k?vn(k):null,k!==null&&(j=Tn(k),k!==j||k.tag!==5&&k.tag!==6)&&(k=null)):(R=null,k=u),R!==k)){if(C=nu,w="onMouseLeave",p="onMouseEnter",h="mouse",(e==="pointerout"||e==="pointerover")&&(C=iu,w="onPointerLeave",p="onPointerEnter",h="pointer"),j=R==null?g:Vn(R),x=k==null?g:Vn(k),g=new C(w,h+"leave",R,s,m),g.target=j,g.relatedTarget=x,w=null,vn(m)===u&&(C=new C(p,h+"enter",k,s,m),C.target=x,C.relatedTarget=j,w=C),j=w,R&&k)t:{for(C=R,p=k,h=0,x=C;x;x=Ln(x))h++;for(x=0,w=p;w;w=Ln(w))x++;for(;0<h-x;)C=Ln(C),h--;for(;0<x-h;)p=Ln(p),x--;for(;h--;){if(C===p||p!==null&&C===p.alternate)break t;C=Ln(C),p=Ln(p)}C=null}else C=null;R!==null&&xu(f,g,R,C,!1),k!==null&&j!==null&&xu(f,j,k,C,!0)}}e:{if(g=u?Vn(u):window,R=g.nodeName&&g.nodeName.toLowerCase(),R==="select"||R==="input"&&g.type==="file")var N=wg;else if(lu(g))if(Nf)N=Sg;else{N=kg;var S=Ng}else(R=g.nodeName)&&R.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(N=bg);if(N&&(N=N(e,u))){wf(f,N,s,m);break e}S&&S(e,g,u),e==="focusout"&&(S=g._wrapperState)&&S.controlled&&g.type==="number"&&el(g,"number",g.value)}switch(S=u?Vn(u):window,e){case"focusin":(lu(S)||S.contentEditable==="true")&&(Fn=S,hl=u,$r=null);break;case"focusout":$r=hl=Fn=null;break;case"mousedown":fl=!0;break;case"contextmenu":case"mouseup":case"dragend":fl=!1,fu(f,s,m);break;case"selectionchange":if(Rg)break;case"keydown":case"keyup":fu(f,s,m)}var P;if(xc)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Dn?yf(e,s)&&(b="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(b="onCompositionStart");b&&(vf&&s.locale!=="ko"&&(Dn||b!=="onCompositionStart"?b==="onCompositionEnd"&&Dn&&(P=gf()):(Us=m,fc="value"in Us?Us.value:Us.textContent,Dn=!0)),S=ga(u,b),0<S.length&&(b=new ru(b,e,null,s,m),f.push({event:b,listeners:S}),P?b.data=P:(P=jf(s),P!==null&&(b.data=P)))),(P=xg?gg(e,s):vg(e,s))&&(u=ga(u,"onBeforeInput"),0<u.length&&(m=new ru("onBeforeInput","beforeinput",null,s,m),f.push({event:m,listeners:u}),m.data=P))}Af(f,t)})}function si(e,t,s){return{instance:e,listener:t,currentTarget:s}}function ga(e,t){for(var s=t+"Capture",r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Gr(e,s),a!=null&&r.unshift(si(e,a,i)),a=Gr(e,t),a!=null&&r.push(si(e,a,i))),e=e.return}return r}function Ln(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function xu(e,t,s,r,i){for(var a=t._reactName,o=[];s!==null&&s!==r;){var l=s,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,i?(c=Gr(s,a),c!=null&&o.unshift(si(s,c,l))):i||(c=Gr(s,a),c!=null&&o.push(si(s,c,l)))),s=s.return}o.length!==0&&e.push({event:t,listeners:o})}var Ag=/\r\n?/g,Og=/\u0000|\uFFFD/g;function gu(e){return(typeof e=="string"?e:""+e).replace(Ag,`
38
+ `).replace(Og,"")}function zi(e,t,s){if(t=gu(t),gu(e)!==t&&s)throw Error(K(425))}function va(){}var pl=null,ml=null;function xl(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 gl=typeof setTimeout=="function"?setTimeout:void 0,zg=typeof clearTimeout=="function"?clearTimeout:void 0,vu=typeof Promise=="function"?Promise:void 0,Lg=typeof queueMicrotask=="function"?queueMicrotask:typeof vu<"u"?function(e){return vu.resolve(null).then(e).catch(Mg)}:gl;function Mg(e){setTimeout(function(){throw e})}function Po(e,t){var s=t,r=0;do{var i=s.nextSibling;if(e.removeChild(s),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(r===0){e.removeChild(i),Xr(t);return}r--}else s!=="$"&&s!=="$?"&&s!=="$!"||r++;s=i}while(s);Xr(t)}function qs(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 yu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return e;t--}else s==="/$"&&t++}e=e.previousSibling}return null}var pr=Math.random().toString(36).slice(2),fs="__reactFiber$"+pr,ni="__reactProps$"+pr,Es="__reactContainer$"+pr,vl="__reactEvents$"+pr,Ig="__reactListeners$"+pr,Dg="__reactHandles$"+pr;function vn(e){var t=e[fs];if(t)return t;for(var s=e.parentNode;s;){if(t=s[Es]||s[fs]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=yu(e);e!==null;){if(s=e[fs])return s;e=yu(e)}return t}e=s,s=e.parentNode}return null}function gi(e){return e=e[fs]||e[Es],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Vn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(K(33))}function Ha(e){return e[ni]||null}var yl=[],Un=-1;function dn(e){return{current:e}}function Me(e){0>Un||(e.current=yl[Un],yl[Un]=null,Un--)}function Ae(e,t){Un++,yl[Un]=e.current,e.current=t}var nn={},pt=dn(nn),Ct=dn(!1),kn=nn;function ir(e,t){var s=e.type.contextTypes;if(!s)return nn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in s)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Et(e){return e=e.childContextTypes,e!=null}function ya(){Me(Ct),Me(pt)}function ju(e,t,s){if(pt.current!==nn)throw Error(K(168));Ae(pt,t),Ae(Ct,s)}function zf(e,t,s){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return s;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(K(108,Nx(e)||"Unknown",i));return Ue({},s,r)}function ja(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nn,kn=pt.current,Ae(pt,e),Ae(Ct,Ct.current),!0}function wu(e,t,s){var r=e.stateNode;if(!r)throw Error(K(169));s?(e=zf(e,t,kn),r.__reactInternalMemoizedMergedChildContext=e,Me(Ct),Me(pt),Ae(pt,e)):Me(Ct),Ae(Ct,s)}var Ns=null,Ja=!1,To=!1;function Lf(e){Ns===null?Ns=[e]:Ns.push(e)}function Fg(e){Ja=!0,Lf(e)}function un(){if(!To&&Ns!==null){To=!0;var e=0,t=Pe;try{var s=Ns;for(Pe=1;e<s.length;e++){var r=s[e];do r=r(!0);while(r!==null)}Ns=null,Ja=!1}catch(i){throw Ns!==null&&(Ns=Ns.slice(e+1)),af(cc,un),i}finally{Pe=t,To=!1}}return null}var Bn=[],Wn=0,wa=null,Na=0,Ut=[],Bt=0,bn=null,ks=1,bs="";function xn(e,t){Bn[Wn++]=Na,Bn[Wn++]=wa,wa=e,Na=t}function Mf(e,t,s){Ut[Bt++]=ks,Ut[Bt++]=bs,Ut[Bt++]=bn,bn=e;var r=ks;e=bs;var i=32-rs(r)-1;r&=~(1<<i),s+=1;var a=32-rs(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ks=1<<32-rs(t)+i|s<<i|r,bs=a+e}else ks=1<<a|s<<i|r,bs=e}function vc(e){e.return!==null&&(xn(e,1),Mf(e,1,0))}function yc(e){for(;e===wa;)wa=Bn[--Wn],Bn[Wn]=null,Na=Bn[--Wn],Bn[Wn]=null;for(;e===bn;)bn=Ut[--Bt],Ut[Bt]=null,bs=Ut[--Bt],Ut[Bt]=null,ks=Ut[--Bt],Ut[Bt]=null}var Lt=null,zt=null,Fe=!1,ss=null;function If(e,t){var s=Ht(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=e,t=e.deletions,t===null?(e.deletions=[s],e.flags|=16):t.push(s)}function Nu(e,t){switch(e.tag){case 5:var s=e.type;return t=t.nodeType!==1||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Lt=e,zt=qs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Lt=e,zt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=bn!==null?{id:ks,overflow:bs}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=Ht(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,Lt=e,zt=null,!0):!1;default:return!1}}function jl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function wl(e){if(Fe){var t=zt;if(t){var s=t;if(!Nu(e,t)){if(jl(e))throw Error(K(418));t=qs(s.nextSibling);var r=Lt;t&&Nu(e,t)?If(r,s):(e.flags=e.flags&-4097|2,Fe=!1,Lt=e)}}else{if(jl(e))throw Error(K(418));e.flags=e.flags&-4097|2,Fe=!1,Lt=e}}}function ku(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Lt=e}function Li(e){if(e!==Lt)return!1;if(!Fe)return ku(e),Fe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!xl(e.type,e.memoizedProps)),t&&(t=zt)){if(jl(e))throw Df(),Error(K(418));for(;t;)If(e,t),t=qs(t.nextSibling)}if(ku(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"){if(t===0){zt=qs(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}zt=null}}else zt=Lt?qs(e.stateNode.nextSibling):null;return!0}function Df(){for(var e=zt;e;)e=qs(e.nextSibling)}function ar(){zt=Lt=null,Fe=!1}function jc(e){ss===null?ss=[e]:ss.push(e)}var $g=As.ReactCurrentBatchConfig;function br(e,t,s){if(e=s.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(K(309));var r=s.stateNode}if(!r)throw Error(K(147,e));var i=r,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(o){var l=i.refs;o===null?delete l[a]:l[a]=o},t._stringRef=a,t)}if(typeof e!="string")throw Error(K(284));if(!s._owner)throw Error(K(290,e))}return e}function Mi(e,t){throw e=Object.prototype.toString.call(t),Error(K(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function bu(e){var t=e._init;return t(e._payload)}function Ff(e){function t(p,h){if(e){var x=p.deletions;x===null?(p.deletions=[h],p.flags|=16):x.push(h)}}function s(p,h){if(!e)return null;for(;h!==null;)t(p,h),h=h.sibling;return null}function r(p,h){for(p=new Map;h!==null;)h.key!==null?p.set(h.key,h):p.set(h.index,h),h=h.sibling;return p}function i(p,h){return p=Xs(p,h),p.index=0,p.sibling=null,p}function a(p,h,x){return p.index=x,e?(x=p.alternate,x!==null?(x=x.index,x<h?(p.flags|=2,h):x):(p.flags|=2,h)):(p.flags|=1048576,h)}function o(p){return e&&p.alternate===null&&(p.flags|=2),p}function l(p,h,x,w){return h===null||h.tag!==6?(h=Do(x,p.mode,w),h.return=p,h):(h=i(h,x),h.return=p,h)}function c(p,h,x,w){var N=x.type;return N===In?m(p,h,x.props.children,w,x.key):h!==null&&(h.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Ds&&bu(N)===h.type)?(w=i(h,x.props),w.ref=br(p,h,x),w.return=p,w):(w=sa(x.type,x.key,x.props,null,p.mode,w),w.ref=br(p,h,x),w.return=p,w)}function u(p,h,x,w){return h===null||h.tag!==4||h.stateNode.containerInfo!==x.containerInfo||h.stateNode.implementation!==x.implementation?(h=Fo(x,p.mode,w),h.return=p,h):(h=i(h,x.children||[]),h.return=p,h)}function m(p,h,x,w,N){return h===null||h.tag!==7?(h=Nn(x,p.mode,w,N),h.return=p,h):(h=i(h,x),h.return=p,h)}function f(p,h,x){if(typeof h=="string"&&h!==""||typeof h=="number")return h=Do(""+h,p.mode,x),h.return=p,h;if(typeof h=="object"&&h!==null){switch(h.$$typeof){case Si:return x=sa(h.type,h.key,h.props,null,p.mode,x),x.ref=br(p,null,h),x.return=p,x;case Mn:return h=Fo(h,p.mode,x),h.return=p,h;case Ds:var w=h._init;return f(p,w(h._payload),x)}if(Ar(h)||yr(h))return h=Nn(h,p.mode,x,null),h.return=p,h;Mi(p,h)}return null}function g(p,h,x,w){var N=h!==null?h.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return N!==null?null:l(p,h,""+x,w);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Si:return x.key===N?c(p,h,x,w):null;case Mn:return x.key===N?u(p,h,x,w):null;case Ds:return N=x._init,g(p,h,N(x._payload),w)}if(Ar(x)||yr(x))return N!==null?null:m(p,h,x,w,null);Mi(p,x)}return null}function R(p,h,x,w,N){if(typeof w=="string"&&w!==""||typeof w=="number")return p=p.get(x)||null,l(h,p,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Si:return p=p.get(w.key===null?x:w.key)||null,c(h,p,w,N);case Mn:return p=p.get(w.key===null?x:w.key)||null,u(h,p,w,N);case Ds:var S=w._init;return R(p,h,x,S(w._payload),N)}if(Ar(w)||yr(w))return p=p.get(x)||null,m(h,p,w,N,null);Mi(h,w)}return null}function k(p,h,x,w){for(var N=null,S=null,P=h,b=h=0,O=null;P!==null&&b<x.length;b++){P.index>b?(O=P,P=null):O=P.sibling;var D=g(p,P,x[b],w);if(D===null){P===null&&(P=O);break}e&&P&&D.alternate===null&&t(p,P),h=a(D,h,b),S===null?N=D:S.sibling=D,S=D,P=O}if(b===x.length)return s(p,P),Fe&&xn(p,b),N;if(P===null){for(;b<x.length;b++)P=f(p,x[b],w),P!==null&&(h=a(P,h,b),S===null?N=P:S.sibling=P,S=P);return Fe&&xn(p,b),N}for(P=r(p,P);b<x.length;b++)O=R(P,p,b,x[b],w),O!==null&&(e&&O.alternate!==null&&P.delete(O.key===null?b:O.key),h=a(O,h,b),S===null?N=O:S.sibling=O,S=O);return e&&P.forEach(function(v){return t(p,v)}),Fe&&xn(p,b),N}function C(p,h,x,w){var N=yr(x);if(typeof N!="function")throw Error(K(150));if(x=N.call(x),x==null)throw Error(K(151));for(var S=N=null,P=h,b=h=0,O=null,D=x.next();P!==null&&!D.done;b++,D=x.next()){P.index>b?(O=P,P=null):O=P.sibling;var v=g(p,P,D.value,w);if(v===null){P===null&&(P=O);break}e&&P&&v.alternate===null&&t(p,P),h=a(v,h,b),S===null?N=v:S.sibling=v,S=v,P=O}if(D.done)return s(p,P),Fe&&xn(p,b),N;if(P===null){for(;!D.done;b++,D=x.next())D=f(p,D.value,w),D!==null&&(h=a(D,h,b),S===null?N=D:S.sibling=D,S=D);return Fe&&xn(p,b),N}for(P=r(p,P);!D.done;b++,D=x.next())D=R(P,p,b,D.value,w),D!==null&&(e&&D.alternate!==null&&P.delete(D.key===null?b:D.key),h=a(D,h,b),S===null?N=D:S.sibling=D,S=D);return e&&P.forEach(function(L){return t(p,L)}),Fe&&xn(p,b),N}function j(p,h,x,w){if(typeof x=="object"&&x!==null&&x.type===In&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Si:e:{for(var N=x.key,S=h;S!==null;){if(S.key===N){if(N=x.type,N===In){if(S.tag===7){s(p,S.sibling),h=i(S,x.props.children),h.return=p,p=h;break e}}else if(S.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Ds&&bu(N)===S.type){s(p,S.sibling),h=i(S,x.props),h.ref=br(p,S,x),h.return=p,p=h;break e}s(p,S);break}else t(p,S);S=S.sibling}x.type===In?(h=Nn(x.props.children,p.mode,w,x.key),h.return=p,p=h):(w=sa(x.type,x.key,x.props,null,p.mode,w),w.ref=br(p,h,x),w.return=p,p=w)}return o(p);case Mn:e:{for(S=x.key;h!==null;){if(h.key===S)if(h.tag===4&&h.stateNode.containerInfo===x.containerInfo&&h.stateNode.implementation===x.implementation){s(p,h.sibling),h=i(h,x.children||[]),h.return=p,p=h;break e}else{s(p,h);break}else t(p,h);h=h.sibling}h=Fo(x,p.mode,w),h.return=p,p=h}return o(p);case Ds:return S=x._init,j(p,h,S(x._payload),w)}if(Ar(x))return k(p,h,x,w);if(yr(x))return C(p,h,x,w);Mi(p,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,h!==null&&h.tag===6?(s(p,h.sibling),h=i(h,x),h.return=p,p=h):(s(p,h),h=Do(x,p.mode,w),h.return=p,p=h),o(p)):s(p,h)}return j}var or=Ff(!0),$f=Ff(!1),ka=dn(null),ba=null,Kn=null,wc=null;function Nc(){wc=Kn=ba=null}function kc(e){var t=ka.current;Me(ka),e._currentValue=t}function Nl(e,t,s){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===s)break;e=e.return}}function Xn(e,t){ba=e,wc=Kn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(St=!0),e.firstContext=null)}function Gt(e){var t=e._currentValue;if(wc!==e)if(e={context:e,memoizedValue:t,next:null},Kn===null){if(ba===null)throw Error(K(308));Kn=e,ba.dependencies={lanes:0,firstContext:e}}else Kn=Kn.next=e;return t}var yn=null;function bc(e){yn===null?yn=[e]:yn.push(e)}function Vf(e,t,s,r){var i=t.interleaved;return i===null?(s.next=s,bc(t)):(s.next=i.next,i.next=s),t.interleaved=s,Rs(e,r)}function Rs(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Fs=!1;function Sc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Uf(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 Ss(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Gs(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ee&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Rs(e,s)}return i=r.interleaved,i===null?(t.next=t,bc(r)):(t.next=i.next,i.next=t),r.interleaved=t,Rs(e,s)}function Qi(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,dc(e,s)}}function Su(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var i=null,a=null;if(s=s.firstBaseUpdate,s!==null){do{var o={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};a===null?i=a=o:a=a.next=o,s=s.next}while(s!==null);a===null?i=a=t:a=a.next=t}else i=a=t;s={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function Sa(e,t,s,r){var i=e.updateQueue;Fs=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var m=e.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==o&&(l===null?m.firstBaseUpdate=u:l.next=u,m.lastBaseUpdate=c))}if(a!==null){var f=i.baseState;o=0,m=u=c=null,l=a;do{var g=l.lane,R=l.eventTime;if((r&g)===g){m!==null&&(m=m.next={eventTime:R,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var k=e,C=l;switch(g=t,R=s,C.tag){case 1:if(k=C.payload,typeof k=="function"){f=k.call(R,f,g);break e}f=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=C.payload,g=typeof k=="function"?k.call(R,f,g):k,g==null)break e;f=Ue({},f,g);break e;case 2:Fs=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,g=i.effects,g===null?i.effects=[l]:g.push(l))}else R={eventTime:R,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(u=m=R,c=f):m=m.next=R,o|=g;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;g=l,l=g.next,g.next=null,i.lastBaseUpdate=g,i.shared.pending=null}}while(!0);if(m===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=m,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Cn|=o,e.lanes=o,e.memoizedState=f}}function Cu(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=s,typeof i!="function")throw Error(K(191,i));i.call(r)}}}var vi={},xs=dn(vi),ri=dn(vi),ii=dn(vi);function jn(e){if(e===vi)throw Error(K(174));return e}function Cc(e,t){switch(Ae(ii,t),Ae(ri,e),Ae(xs,vi),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:sl(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=sl(t,e)}Me(xs),Ae(xs,t)}function lr(){Me(xs),Me(ri),Me(ii)}function Bf(e){jn(ii.current);var t=jn(xs.current),s=sl(t,e.type);t!==s&&(Ae(ri,e),Ae(xs,s))}function Ec(e){ri.current===e&&(Me(xs),Me(ri))}var $e=dn(0);function Ca(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.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 Ao=[];function Rc(){for(var e=0;e<Ao.length;e++)Ao[e]._workInProgressVersionPrimary=null;Ao.length=0}var Yi=As.ReactCurrentDispatcher,Oo=As.ReactCurrentBatchConfig,Sn=0,Ve=null,Qe=null,tt=null,Ea=!1,Vr=!1,ai=0,Vg=0;function ut(){throw Error(K(321))}function _c(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!os(e[s],t[s]))return!1;return!0}function Pc(e,t,s,r,i,a){if(Sn=a,Ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Yi.current=e===null||e.memoizedState===null?Kg:Hg,e=s(r,i),Vr){a=0;do{if(Vr=!1,ai=0,25<=a)throw Error(K(301));a+=1,tt=Qe=null,t.updateQueue=null,Yi.current=Jg,e=s(r,i)}while(Vr)}if(Yi.current=Ra,t=Qe!==null&&Qe.next!==null,Sn=0,tt=Qe=Ve=null,Ea=!1,t)throw Error(K(300));return e}function Tc(){var e=ai!==0;return ai=0,e}function hs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tt===null?Ve.memoizedState=tt=e:tt=tt.next=e,tt}function Qt(){if(Qe===null){var e=Ve.alternate;e=e!==null?e.memoizedState:null}else e=Qe.next;var t=tt===null?Ve.memoizedState:tt.next;if(t!==null)tt=t,Qe=e;else{if(e===null)throw Error(K(310));Qe=e,e={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},tt===null?Ve.memoizedState=tt=e:tt=tt.next=e}return tt}function oi(e,t){return typeof t=="function"?t(e):t}function zo(e){var t=Qt(),s=t.queue;if(s===null)throw Error(K(311));s.lastRenderedReducer=e;var r=Qe,i=r.baseQueue,a=s.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}r.baseQueue=i=a,s.pending=null}if(i!==null){a=i.next,r=r.baseState;var l=o=null,c=null,u=a;do{var m=u.lane;if((Sn&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?(l=c=f,o=r):c=c.next=f,Ve.lanes|=m,Cn|=m}u=u.next}while(u!==null&&u!==a);c===null?o=r:c.next=l,os(r,t.memoizedState)||(St=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,s.lastRenderedState=r}if(e=s.interleaved,e!==null){i=e;do a=i.lane,Ve.lanes|=a,Cn|=a,i=i.next;while(i!==e)}else i===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function Lo(e){var t=Qt(),s=t.queue;if(s===null)throw Error(K(311));s.lastRenderedReducer=e;var r=s.dispatch,i=s.pending,a=t.memoizedState;if(i!==null){s.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);os(a,t.memoizedState)||(St=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),s.lastRenderedState=a}return[a,r]}function Wf(){}function Kf(e,t){var s=Ve,r=Qt(),i=t(),a=!os(r.memoizedState,i);if(a&&(r.memoizedState=i,St=!0),r=r.queue,Ac(qf.bind(null,s,r,e),[e]),r.getSnapshot!==t||a||tt!==null&&tt.memoizedState.tag&1){if(s.flags|=2048,li(9,Jf.bind(null,s,r,i,t),void 0,null),rt===null)throw Error(K(349));Sn&30||Hf(s,t,i)}return i}function Hf(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ve.updateQueue,t===null?(t={lastEffect:null,stores:null},Ve.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Jf(e,t,s,r){t.value=s,t.getSnapshot=r,Gf(t)&&Qf(e)}function qf(e,t,s){return s(function(){Gf(t)&&Qf(e)})}function Gf(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!os(e,s)}catch{return!0}}function Qf(e){var t=Rs(e,1);t!==null&&is(t,e,1,-1)}function Eu(e){var t=hs();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:oi,lastRenderedState:e},t.queue=e,e=e.dispatch=Wg.bind(null,Ve,e),[t.memoizedState,e]}function li(e,t,s,r){return e={tag:e,create:t,destroy:s,deps:r,next:null},t=Ve.updateQueue,t===null?(t={lastEffect:null,stores:null},Ve.updateQueue=t,t.lastEffect=e.next=e):(s=t.lastEffect,s===null?t.lastEffect=e.next=e:(r=s.next,s.next=e,e.next=r,t.lastEffect=e)),e}function Yf(){return Qt().memoizedState}function Xi(e,t,s,r){var i=hs();Ve.flags|=e,i.memoizedState=li(1|t,s,void 0,r===void 0?null:r)}function qa(e,t,s,r){var i=Qt();r=r===void 0?null:r;var a=void 0;if(Qe!==null){var o=Qe.memoizedState;if(a=o.destroy,r!==null&&_c(r,o.deps)){i.memoizedState=li(t,s,a,r);return}}Ve.flags|=e,i.memoizedState=li(1|t,s,a,r)}function Ru(e,t){return Xi(8390656,8,e,t)}function Ac(e,t){return qa(2048,8,e,t)}function Xf(e,t){return qa(4,2,e,t)}function Zf(e,t){return qa(4,4,e,t)}function ep(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 tp(e,t,s){return s=s!=null?s.concat([e]):null,qa(4,4,ep.bind(null,t,e),s)}function Oc(){}function sp(e,t){var s=Qt();t=t===void 0?null:t;var r=s.memoizedState;return r!==null&&t!==null&&_c(t,r[1])?r[0]:(s.memoizedState=[e,t],e)}function np(e,t){var s=Qt();t=t===void 0?null:t;var r=s.memoizedState;return r!==null&&t!==null&&_c(t,r[1])?r[0]:(e=e(),s.memoizedState=[e,t],e)}function rp(e,t,s){return Sn&21?(os(s,t)||(s=cf(),Ve.lanes|=s,Cn|=s,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,St=!0),e.memoizedState=s)}function Ug(e,t){var s=Pe;Pe=s!==0&&4>s?s:4,e(!0);var r=Oo.transition;Oo.transition={};try{e(!1),t()}finally{Pe=s,Oo.transition=r}}function ip(){return Qt().memoizedState}function Bg(e,t,s){var r=Ys(e);if(s={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null},ap(e))op(t,s);else if(s=Vf(e,t,s,r),s!==null){var i=yt();is(s,e,r,i),lp(s,t,r)}}function Wg(e,t,s){var r=Ys(e),i={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null};if(ap(e))op(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,s);if(i.hasEagerState=!0,i.eagerState=l,os(l,o)){var c=t.interleaved;c===null?(i.next=i,bc(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}s=Vf(e,t,i,r),s!==null&&(i=yt(),is(s,e,r,i),lp(s,t,r))}}function ap(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function op(e,t){Vr=Ea=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function lp(e,t,s){if(s&4194240){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,dc(e,s)}}var Ra={readContext:Gt,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},Kg={readContext:Gt,useCallback:function(e,t){return hs().memoizedState=[e,t===void 0?null:t],e},useContext:Gt,useEffect:Ru,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,Xi(4194308,4,ep.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Xi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xi(4,2,e,t)},useMemo:function(e,t){var s=hs();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var r=hs();return t=s!==void 0?s(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=Bg.bind(null,Ve,e),[r.memoizedState,e]},useRef:function(e){var t=hs();return e={current:e},t.memoizedState=e},useState:Eu,useDebugValue:Oc,useDeferredValue:function(e){return hs().memoizedState=e},useTransition:function(){var e=Eu(!1),t=e[0];return e=Ug.bind(null,e[1]),hs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var r=Ve,i=hs();if(Fe){if(s===void 0)throw Error(K(407));s=s()}else{if(s=t(),rt===null)throw Error(K(349));Sn&30||Hf(r,t,s)}i.memoizedState=s;var a={value:s,getSnapshot:t};return i.queue=a,Ru(qf.bind(null,r,a,e),[e]),r.flags|=2048,li(9,Jf.bind(null,r,a,s,t),void 0,null),s},useId:function(){var e=hs(),t=rt.identifierPrefix;if(Fe){var s=bs,r=ks;s=(r&~(1<<32-rs(r)-1)).toString(32)+s,t=":"+t+"R"+s,s=ai++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=Vg++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Hg={readContext:Gt,useCallback:sp,useContext:Gt,useEffect:Ac,useImperativeHandle:tp,useInsertionEffect:Xf,useLayoutEffect:Zf,useMemo:np,useReducer:zo,useRef:Yf,useState:function(){return zo(oi)},useDebugValue:Oc,useDeferredValue:function(e){var t=Qt();return rp(t,Qe.memoizedState,e)},useTransition:function(){var e=zo(oi)[0],t=Qt().memoizedState;return[e,t]},useMutableSource:Wf,useSyncExternalStore:Kf,useId:ip,unstable_isNewReconciler:!1},Jg={readContext:Gt,useCallback:sp,useContext:Gt,useEffect:Ac,useImperativeHandle:tp,useInsertionEffect:Xf,useLayoutEffect:Zf,useMemo:np,useReducer:Lo,useRef:Yf,useState:function(){return Lo(oi)},useDebugValue:Oc,useDeferredValue:function(e){var t=Qt();return Qe===null?t.memoizedState=e:rp(t,Qe.memoizedState,e)},useTransition:function(){var e=Lo(oi)[0],t=Qt().memoizedState;return[e,t]},useMutableSource:Wf,useSyncExternalStore:Kf,useId:ip,unstable_isNewReconciler:!1};function Zt(e,t){if(e&&e.defaultProps){t=Ue({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function kl(e,t,s,r){t=e.memoizedState,s=s(r,t),s=s==null?t:Ue({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Ga={isMounted:function(e){return(e=e._reactInternals)?Tn(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var r=yt(),i=Ys(e),a=Ss(r,i);a.payload=t,s!=null&&(a.callback=s),t=Gs(e,a,i),t!==null&&(is(t,e,i,r),Qi(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var r=yt(),i=Ys(e),a=Ss(r,i);a.tag=1,a.payload=t,s!=null&&(a.callback=s),t=Gs(e,a,i),t!==null&&(is(t,e,i,r),Qi(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=yt(),r=Ys(e),i=Ss(s,r);i.tag=2,t!=null&&(i.callback=t),t=Gs(e,i,r),t!==null&&(is(t,e,r,s),Qi(t,e,r))}};function _u(e,t,s,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!ei(s,r)||!ei(i,a):!0}function cp(e,t,s){var r=!1,i=nn,a=t.contextType;return typeof a=="object"&&a!==null?a=Gt(a):(i=Et(t)?kn:pt.current,r=t.contextTypes,a=(r=r!=null)?ir(e,i):nn),t=new t(s,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ga,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Pu(e,t,s,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,r),t.state!==e&&Ga.enqueueReplaceState(t,t.state,null)}function bl(e,t,s,r){var i=e.stateNode;i.props=s,i.state=e.memoizedState,i.refs={},Sc(e);var a=t.contextType;typeof a=="object"&&a!==null?i.context=Gt(a):(a=Et(t)?kn:pt.current,i.context=ir(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(kl(e,t,a,s),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Ga.enqueueReplaceState(i,i.state,null),Sa(e,s,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function cr(e,t){try{var s="",r=t;do s+=wx(r),r=r.return;while(r);var i=s}catch(a){i=`
39
+ Error generating stack: `+a.message+`
40
+ `+a.stack}return{value:e,source:t,stack:i,digest:null}}function Mo(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function Sl(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var qg=typeof WeakMap=="function"?WeakMap:Map;function dp(e,t,s){s=Ss(-1,s),s.tag=3,s.payload={element:null};var r=t.value;return s.callback=function(){Pa||(Pa=!0,Ll=r),Sl(e,t)},s}function up(e,t,s){s=Ss(-1,s),s.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;s.payload=function(){return r(i)},s.callback=function(){Sl(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(s.callback=function(){Sl(e,t),typeof r!="function"&&(Qs===null?Qs=new Set([this]):Qs.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),s}function Tu(e,t,s){var r=e.pingCache;if(r===null){r=e.pingCache=new qg;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(s)||(i.add(s),e=lv.bind(null,e,t,s),t.then(e,e))}function Au(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 Ou(e,t,s,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=Ss(-1,1),t.tag=2,Gs(s,t,1))),s.lanes|=1),e)}var Gg=As.ReactCurrentOwner,St=!1;function gt(e,t,s,r){t.child=e===null?$f(t,null,s,r):or(t,e.child,s,r)}function zu(e,t,s,r,i){s=s.render;var a=t.ref;return Xn(t,i),r=Pc(e,t,s,r,a,i),s=Tc(),e!==null&&!St?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,_s(e,t,i)):(Fe&&s&&vc(t),t.flags|=1,gt(e,t,r,i),t.child)}function Lu(e,t,s,r,i){if(e===null){var a=s.type;return typeof a=="function"&&!Vc(a)&&a.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=a,hp(e,t,a,r,i)):(e=sa(s.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&i)){var o=a.memoizedProps;if(s=s.compare,s=s!==null?s:ei,s(o,r)&&e.ref===t.ref)return _s(e,t,i)}return t.flags|=1,e=Xs(a,r),e.ref=t.ref,e.return=t,t.child=e}function hp(e,t,s,r,i){if(e!==null){var a=e.memoizedProps;if(ei(a,r)&&e.ref===t.ref)if(St=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(St=!0);else return t.lanes=e.lanes,_s(e,t,i)}return Cl(e,t,s,r,i)}function fp(e,t,s){var r=t.pendingProps,i=r.children,a=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ae(Jn,Ot),Ot|=s;else{if(!(s&1073741824))return e=a!==null?a.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ae(Jn,Ot),Ot|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a!==null?a.baseLanes:s,Ae(Jn,Ot),Ot|=r}else a!==null?(r=a.baseLanes|s,t.memoizedState=null):r=s,Ae(Jn,Ot),Ot|=r;return gt(e,t,i,s),t.child}function pp(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function Cl(e,t,s,r,i){var a=Et(s)?kn:pt.current;return a=ir(t,a),Xn(t,i),s=Pc(e,t,s,r,a,i),r=Tc(),e!==null&&!St?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,_s(e,t,i)):(Fe&&r&&vc(t),t.flags|=1,gt(e,t,s,i),t.child)}function Mu(e,t,s,r,i){if(Et(s)){var a=!0;ja(t)}else a=!1;if(Xn(t,i),t.stateNode===null)Zi(e,t),cp(t,s,r),bl(t,s,r,i),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=s.contextType;typeof u=="object"&&u!==null?u=Gt(u):(u=Et(s)?kn:pt.current,u=ir(t,u));var m=s.getDerivedStateFromProps,f=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&Pu(t,o,r,u),Fs=!1;var g=t.memoizedState;o.state=g,Sa(t,r,o,i),c=t.memoizedState,l!==r||g!==c||Ct.current||Fs?(typeof m=="function"&&(kl(t,s,m,r),c=t.memoizedState),(l=Fs||_u(t,s,l,r,g,c,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Uf(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Zt(t.type,l),o.props=u,f=t.pendingProps,g=o.context,c=s.contextType,typeof c=="object"&&c!==null?c=Gt(c):(c=Et(s)?kn:pt.current,c=ir(t,c));var R=s.getDerivedStateFromProps;(m=typeof R=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||g!==c)&&Pu(t,o,r,c),Fs=!1,g=t.memoizedState,o.state=g,Sa(t,r,o,i);var k=t.memoizedState;l!==f||g!==k||Ct.current||Fs?(typeof R=="function"&&(kl(t,s,R,r),k=t.memoizedState),(u=Fs||_u(t,s,u,r,g,k,c)||!1)?(m||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,k,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,k,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=k),o.props=r,o.state=k,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),r=!1)}return El(e,t,s,r,a,i)}function El(e,t,s,r,i,a){pp(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&wu(t,s,!1),_s(e,t,a);r=t.stateNode,Gg.current=t;var l=o&&typeof s.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=or(t,e.child,null,a),t.child=or(t,null,l,a)):gt(e,t,l,a),t.memoizedState=r.state,i&&wu(t,s,!0),t.child}function mp(e){var t=e.stateNode;t.pendingContext?ju(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ju(e,t.context,!1),Cc(e,t.containerInfo)}function Iu(e,t,s,r,i){return ar(),jc(i),t.flags|=256,gt(e,t,s,r),t.child}var Rl={dehydrated:null,treeContext:null,retryLane:0};function _l(e){return{baseLanes:e,cachePool:null,transitions:null}}function xp(e,t,s){var r=t.pendingProps,i=$e.current,a=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ae($e,i&1),e===null)return wl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:"hidden",children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Xa(o,r,0,null),e=Nn(e,r,s,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=_l(s),t.memoizedState=Rl,e):zc(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return Qg(e,t,o,r,l,i,s);if(a){a=r.fallback,o=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Xs(i,c),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?a=Xs(l,a):(a=Nn(a,o,s,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?_l(s):{baseLanes:o.baseLanes|s,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~s,t.memoizedState=Rl,r}return a=e.child,e=a.sibling,r=Xs(a,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=s),r.return=t,r.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=r,t.memoizedState=null,r}function zc(e,t){return t=Xa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ii(e,t,s,r){return r!==null&&jc(r),or(t,e.child,null,s),e=zc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qg(e,t,s,r,i,a,o){if(s)return t.flags&256?(t.flags&=-257,r=Mo(Error(K(422))),Ii(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=r.fallback,i=t.mode,r=Xa({mode:"visible",children:r.children},i,0,null),a=Nn(a,i,o,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,t.mode&1&&or(t,e.child,null,o),t.child.memoizedState=_l(o),t.memoizedState=Rl,a);if(!(t.mode&1))return Ii(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,a=Error(K(419)),r=Mo(a,r,void 0),Ii(e,t,o,r)}if(l=(o&e.childLanes)!==0,St||l){if(r=rt,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==a.retryLane&&(a.retryLane=i,Rs(e,i),is(r,e,i,-1))}return $c(),r=Mo(Error(K(421))),Ii(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=cv.bind(null,e),i._reactRetry=t,null):(e=a.treeContext,zt=qs(i.nextSibling),Lt=t,Fe=!0,ss=null,e!==null&&(Ut[Bt++]=ks,Ut[Bt++]=bs,Ut[Bt++]=bn,ks=e.id,bs=e.overflow,bn=t),t=zc(t,r.children),t.flags|=4096,t)}function Du(e,t,s){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Nl(e.return,t,s)}function Io(e,t,s,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:s,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=s,a.tailMode=i)}function gp(e,t,s){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(gt(e,t,r.children,s),r=$e.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&&Du(e,s,t);else if(e.tag===19)Du(e,s,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(Ae($e,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(s=t.child,i=null;s!==null;)e=s.alternate,e!==null&&Ca(e)===null&&(i=s),s=s.sibling;s=i,s===null?(i=t.child,t.child=null):(i=s.sibling,s.sibling=null),Io(t,!1,i,s,a);break;case"backwards":for(s=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ca(e)===null){t.child=i;break}e=i.sibling,i.sibling=s,s=i,i=e}Io(t,!0,s,null,a);break;case"together":Io(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Zi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function _s(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),Cn|=t.lanes,!(s&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,s=Xs(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Xs(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Yg(e,t,s){switch(t.tag){case 3:mp(t),ar();break;case 5:Bf(t);break;case 1:Et(t.type)&&ja(t);break;case 4:Cc(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ae(ka,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ae($e,$e.current&1),t.flags|=128,null):s&t.child.childLanes?xp(e,t,s):(Ae($e,$e.current&1),e=_s(e,t,s),e!==null?e.sibling:null);Ae($e,$e.current&1);break;case 19:if(r=(s&t.childLanes)!==0,e.flags&128){if(r)return gp(e,t,s);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ae($e,$e.current),r)break;return null;case 22:case 23:return t.lanes=0,fp(e,t,s)}return _s(e,t,s)}var vp,Pl,yp,jp;vp=function(e,t){for(var s=t.child;s!==null;){if(s.tag===5||s.tag===6)e.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}};Pl=function(){};yp=function(e,t,s,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,jn(xs.current);var a=null;switch(s){case"input":i=Xo(e,i),r=Xo(e,r),a=[];break;case"select":i=Ue({},i,{value:void 0}),r=Ue({},r,{value:void 0}),a=[];break;case"textarea":i=tl(e,i),r=tl(e,r),a=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=va)}nl(s,r);var o;s=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(s||(s={}),s[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Jr.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in r){var c=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(s||(s={}),s[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(s||(s={}),s[o]=c[o])}else s||(a||(a=[]),a.push(u,s)),s=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(a=a||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Jr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Le("scroll",e),a||l===c||(a=[])):(a=a||[]).push(u,c))}s&&(a=a||[]).push("style",s);var u=a;(t.updateQueue=u)&&(t.flags|=4)}};jp=function(e,t,s,r){s!==r&&(t.flags|=4)};function Sr(e,t){if(!Fe)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ht(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,r=0;if(t)for(var i=e.child;i!==null;)s|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)s|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=s,t}function Xg(e,t,s){var r=t.pendingProps;switch(yc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ht(t),null;case 1:return Et(t.type)&&ya(),ht(t),null;case 3:return r=t.stateNode,lr(),Me(Ct),Me(pt),Rc(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Li(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ss!==null&&(Dl(ss),ss=null))),Pl(e,t),ht(t),null;case 5:Ec(t);var i=jn(ii.current);if(s=t.type,e!==null&&t.stateNode!=null)yp(e,t,s,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(K(166));return ht(t),null}if(e=jn(xs.current),Li(t)){r=t.stateNode,s=t.type;var a=t.memoizedProps;switch(r[fs]=t,r[ni]=a,e=(t.mode&1)!==0,s){case"dialog":Le("cancel",r),Le("close",r);break;case"iframe":case"object":case"embed":Le("load",r);break;case"video":case"audio":for(i=0;i<zr.length;i++)Le(zr[i],r);break;case"source":Le("error",r);break;case"img":case"image":case"link":Le("error",r),Le("load",r);break;case"details":Le("toggle",r);break;case"input":Jd(r,a),Le("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!a.multiple},Le("invalid",r);break;case"textarea":Gd(r,a),Le("invalid",r)}nl(s,a),i=null;for(var o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="children"?typeof l=="string"?r.textContent!==l&&(a.suppressHydrationWarning!==!0&&zi(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&zi(r.textContent,l,e),i=["children",""+l]):Jr.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Le("scroll",r)}switch(s){case"input":Ci(r),qd(r,a,!0);break;case"textarea":Ci(r),Qd(r);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(r.onclick=va)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Jh(s)),e==="http://www.w3.org/1999/xhtml"?s==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(s,{is:r.is}):(e=o.createElement(s),s==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,s),e[fs]=t,e[ni]=r,vp(e,t,!1,!1),t.stateNode=e;e:{switch(o=rl(s,r),s){case"dialog":Le("cancel",e),Le("close",e),i=r;break;case"iframe":case"object":case"embed":Le("load",e),i=r;break;case"video":case"audio":for(i=0;i<zr.length;i++)Le(zr[i],e);i=r;break;case"source":Le("error",e),i=r;break;case"img":case"image":case"link":Le("error",e),Le("load",e),i=r;break;case"details":Le("toggle",e),i=r;break;case"input":Jd(e,r),i=Xo(e,r),Le("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ue({},r,{value:void 0}),Le("invalid",e);break;case"textarea":Gd(e,r),i=tl(e,r),Le("invalid",e);break;default:i=r}nl(s,i),l=i;for(a in l)if(l.hasOwnProperty(a)){var c=l[a];a==="style"?Qh(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&qh(e,c)):a==="children"?typeof c=="string"?(s!=="textarea"||c!=="")&&qr(e,c):typeof c=="number"&&qr(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Jr.hasOwnProperty(a)?c!=null&&a==="onScroll"&&Le("scroll",e):c!=null&&rc(e,a,c,o))}switch(s){case"input":Ci(e),qd(e,r,!1);break;case"textarea":Ci(e),Qd(e);break;case"option":r.value!=null&&e.setAttribute("value",""+sn(r.value));break;case"select":e.multiple=!!r.multiple,a=r.value,a!=null?qn(e,!!r.multiple,a,!1):r.defaultValue!=null&&qn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=va)}switch(s){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 ht(t),null;case 6:if(e&&t.stateNode!=null)jp(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(K(166));if(s=jn(ii.current),jn(xs.current),Li(t)){if(r=t.stateNode,s=t.memoizedProps,r[fs]=t,(a=r.nodeValue!==s)&&(e=Lt,e!==null))switch(e.tag){case 3:zi(r.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&zi(r.nodeValue,s,(e.mode&1)!==0)}a&&(t.flags|=4)}else r=(s.nodeType===9?s:s.ownerDocument).createTextNode(r),r[fs]=t,t.stateNode=r}return ht(t),null;case 13:if(Me($e),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Fe&&zt!==null&&t.mode&1&&!(t.flags&128))Df(),ar(),t.flags|=98560,a=!1;else if(a=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(K(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(K(317));a[fs]=t}else ar(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ht(t),a=!1}else ss!==null&&(Dl(ss),ss=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=s,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||$e.current&1?Ye===0&&(Ye=3):$c())),t.updateQueue!==null&&(t.flags|=4),ht(t),null);case 4:return lr(),Pl(e,t),e===null&&ti(t.stateNode.containerInfo),ht(t),null;case 10:return kc(t.type._context),ht(t),null;case 17:return Et(t.type)&&ya(),ht(t),null;case 19:if(Me($e),a=t.memoizedState,a===null)return ht(t),null;if(r=(t.flags&128)!==0,o=a.rendering,o===null)if(r)Sr(a,!1);else{if(Ye!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Ca(e),o!==null){for(t.flags|=128,Sr(a,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=s,s=t.child;s!==null;)a=s,e=r,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return Ae($e,$e.current&1|2),t.child}e=e.sibling}a.tail!==null&&We()>dr&&(t.flags|=128,r=!0,Sr(a,!1),t.lanes=4194304)}else{if(!r)if(e=Ca(o),e!==null){if(t.flags|=128,r=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),Sr(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Fe)return ht(t),null}else 2*We()-a.renderingStartTime>dr&&s!==1073741824&&(t.flags|=128,r=!0,Sr(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(s=a.last,s!==null?s.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=We(),t.sibling=null,s=$e.current,Ae($e,r?s&1|2:s&1),t):(ht(t),null);case 22:case 23:return Fc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ot&1073741824&&(ht(t),t.subtreeFlags&6&&(t.flags|=8192)):ht(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function Zg(e,t){switch(yc(t),t.tag){case 1:return Et(t.type)&&ya(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lr(),Me(Ct),Me(pt),Rc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ec(t),null;case 13:if(Me($e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));ar()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Me($e),null;case 4:return lr(),null;case 10:return kc(t.type._context),null;case 22:case 23:return Fc(),null;case 24:return null;default:return null}}var Di=!1,ft=!1,ev=typeof WeakSet=="function"?WeakSet:Set,te=null;function Hn(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(r){Be(e,t,r)}else s.current=null}function Tl(e,t,s){try{s()}catch(r){Be(e,t,r)}}var Fu=!1;function tv(e,t){if(pl=ma,e=Sf(),gc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var r=s.getSelection&&s.getSelection();if(r&&r.rangeCount!==0){s=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{s.nodeType,a.nodeType}catch{s=null;break e}var o=0,l=-1,c=-1,u=0,m=0,f=e,g=null;t:for(;;){for(var R;f!==s||i!==0&&f.nodeType!==3||(l=o+i),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(R=f.firstChild)!==null;)g=f,f=R;for(;;){if(f===e)break t;if(g===s&&++u===i&&(l=o),g===a&&++m===r&&(c=o),(R=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=R}s=l===-1||c===-1?null:{start:l,end:c}}else s=null}s=s||{start:0,end:0}}else s=null;for(ml={focusedElem:e,selectionRange:s},ma=!1,te=t;te!==null;)if(t=te,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,te=e;else for(;te!==null;){t=te;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var C=k.memoizedProps,j=k.memoizedState,p=t.stateNode,h=p.getSnapshotBeforeUpdate(t.elementType===t.type?C:Zt(t.type,C),j);p.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(w){Be(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,te=e;break}te=t.return}return k=Fu,Fu=!1,k}function Ur(e,t,s){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Tl(t,s,a)}i=i.next}while(i!==r)}}function Qa(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var r=s.create;s.destroy=r()}s=s.next}while(s!==t)}}function Al(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function wp(e){var t=e.alternate;t!==null&&(e.alternate=null,wp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[fs],delete t[ni],delete t[vl],delete t[Ig],delete t[Dg])),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 Np(e){return e.tag===5||e.tag===3||e.tag===4}function $u(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Np(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 Ol(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=va));else if(r!==4&&(e=e.child,e!==null))for(Ol(e,t,s),e=e.sibling;e!==null;)Ol(e,t,s),e=e.sibling}function zl(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(zl(e,t,s),e=e.sibling;e!==null;)zl(e,t,s),e=e.sibling}var it=null,es=!1;function Ls(e,t,s){for(s=s.child;s!==null;)kp(e,t,s),s=s.sibling}function kp(e,t,s){if(ms&&typeof ms.onCommitFiberUnmount=="function")try{ms.onCommitFiberUnmount(Ua,s)}catch{}switch(s.tag){case 5:ft||Hn(s,t);case 6:var r=it,i=es;it=null,Ls(e,t,s),it=r,es=i,it!==null&&(es?(e=it,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):it.removeChild(s.stateNode));break;case 18:it!==null&&(es?(e=it,s=s.stateNode,e.nodeType===8?Po(e.parentNode,s):e.nodeType===1&&Po(e,s),Xr(e)):Po(it,s.stateNode));break;case 4:r=it,i=es,it=s.stateNode.containerInfo,es=!0,Ls(e,t,s),it=r,es=i;break;case 0:case 11:case 14:case 15:if(!ft&&(r=s.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Tl(s,t,o),i=i.next}while(i!==r)}Ls(e,t,s);break;case 1:if(!ft&&(Hn(s,t),r=s.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=s.memoizedProps,r.state=s.memoizedState,r.componentWillUnmount()}catch(l){Be(s,t,l)}Ls(e,t,s);break;case 21:Ls(e,t,s);break;case 22:s.mode&1?(ft=(r=ft)||s.memoizedState!==null,Ls(e,t,s),ft=r):Ls(e,t,s);break;default:Ls(e,t,s)}}function Vu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new ev),t.forEach(function(r){var i=dv.bind(null,e,r);s.has(r)||(s.add(r),r.then(i,i))})}}function Xt(e,t){var s=t.deletions;if(s!==null)for(var r=0;r<s.length;r++){var i=s[r];try{var a=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:it=l.stateNode,es=!1;break e;case 3:it=l.stateNode.containerInfo,es=!0;break e;case 4:it=l.stateNode.containerInfo,es=!0;break e}l=l.return}if(it===null)throw Error(K(160));kp(a,o,i),it=null,es=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){Be(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)bp(t,e),t=t.sibling}function bp(e,t){var s=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Xt(t,e),ds(e),r&4){try{Ur(3,e,e.return),Qa(3,e)}catch(C){Be(e,e.return,C)}try{Ur(5,e,e.return)}catch(C){Be(e,e.return,C)}}break;case 1:Xt(t,e),ds(e),r&512&&s!==null&&Hn(s,s.return);break;case 5:if(Xt(t,e),ds(e),r&512&&s!==null&&Hn(s,s.return),e.flags&32){var i=e.stateNode;try{qr(i,"")}catch(C){Be(e,e.return,C)}}if(r&4&&(i=e.stateNode,i!=null)){var a=e.memoizedProps,o=s!==null?s.memoizedProps:a,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&Kh(i,a),rl(l,o);var u=rl(l,a);for(o=0;o<c.length;o+=2){var m=c[o],f=c[o+1];m==="style"?Qh(i,f):m==="dangerouslySetInnerHTML"?qh(i,f):m==="children"?qr(i,f):rc(i,m,f,u)}switch(l){case"input":Zo(i,a);break;case"textarea":Hh(i,a);break;case"select":var g=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!a.multiple;var R=a.value;R!=null?qn(i,!!a.multiple,R,!1):g!==!!a.multiple&&(a.defaultValue!=null?qn(i,!!a.multiple,a.defaultValue,!0):qn(i,!!a.multiple,a.multiple?[]:"",!1))}i[ni]=a}catch(C){Be(e,e.return,C)}}break;case 6:if(Xt(t,e),ds(e),r&4){if(e.stateNode===null)throw Error(K(162));i=e.stateNode,a=e.memoizedProps;try{i.nodeValue=a}catch(C){Be(e,e.return,C)}}break;case 3:if(Xt(t,e),ds(e),r&4&&s!==null&&s.memoizedState.isDehydrated)try{Xr(t.containerInfo)}catch(C){Be(e,e.return,C)}break;case 4:Xt(t,e),ds(e);break;case 13:Xt(t,e),ds(e),i=e.child,i.flags&8192&&(a=i.memoizedState!==null,i.stateNode.isHidden=a,!a||i.alternate!==null&&i.alternate.memoizedState!==null||(Ic=We())),r&4&&Vu(e);break;case 22:if(m=s!==null&&s.memoizedState!==null,e.mode&1?(ft=(u=ft)||m,Xt(t,e),ft=u):Xt(t,e),ds(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!m&&e.mode&1)for(te=e,m=e.child;m!==null;){for(f=te=m;te!==null;){switch(g=te,R=g.child,g.tag){case 0:case 11:case 14:case 15:Ur(4,g,g.return);break;case 1:Hn(g,g.return);var k=g.stateNode;if(typeof k.componentWillUnmount=="function"){r=g,s=g.return;try{t=r,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(C){Be(r,s,C)}}break;case 5:Hn(g,g.return);break;case 22:if(g.memoizedState!==null){Bu(f);continue}}R!==null?(R.return=g,te=R):Bu(f)}m=m.sibling}e:for(m=null,f=e;;){if(f.tag===5){if(m===null){m=f;try{i=f.stateNode,u?(a=i.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Gh("display",o))}catch(C){Be(e,e.return,C)}}}else if(f.tag===6){if(m===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(C){Be(e,e.return,C)}}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:Xt(t,e),ds(e),r&4&&Vu(e);break;case 21:break;default:Xt(t,e),ds(e)}}function ds(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(Np(s)){var r=s;break e}s=s.return}throw Error(K(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(qr(i,""),r.flags&=-33);var a=$u(e);zl(e,a,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=$u(e);Ol(e,l,o);break;default:throw Error(K(161))}}catch(c){Be(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function sv(e,t,s){te=e,Sp(e)}function Sp(e,t,s){for(var r=(e.mode&1)!==0;te!==null;){var i=te,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Di;if(!o){var l=i.alternate,c=l!==null&&l.memoizedState!==null||ft;l=Di;var u=ft;if(Di=o,(ft=c)&&!u)for(te=i;te!==null;)o=te,c=o.child,o.tag===22&&o.memoizedState!==null?Wu(i):c!==null?(c.return=o,te=c):Wu(i);for(;a!==null;)te=a,Sp(a),a=a.sibling;te=i,Di=l,ft=u}Uu(e)}else i.subtreeFlags&8772&&a!==null?(a.return=i,te=a):Uu(e)}}function Uu(e){for(;te!==null;){var t=te;if(t.flags&8772){var s=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:ft||Qa(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!ft)if(s===null)r.componentDidMount();else{var i=t.elementType===t.type?s.memoizedProps:Zt(t.type,s.memoizedProps);r.componentDidUpdate(i,s.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&Cu(t,a,r);break;case 3:var o=t.updateQueue;if(o!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}Cu(t,o,s)}break;case 5:var l=t.stateNode;if(s===null&&t.flags&4){s=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&s.focus();break;case"img":c.src&&(s.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&&Xr(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(K(163))}ft||t.flags&512&&Al(t)}catch(g){Be(t,t.return,g)}}if(t===e){te=null;break}if(s=t.sibling,s!==null){s.return=t.return,te=s;break}te=t.return}}function Bu(e){for(;te!==null;){var t=te;if(t===e){te=null;break}var s=t.sibling;if(s!==null){s.return=t.return,te=s;break}te=t.return}}function Wu(e){for(;te!==null;){var t=te;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{Qa(4,t)}catch(c){Be(t,s,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){Be(t,i,c)}}var a=t.return;try{Al(t)}catch(c){Be(t,a,c)}break;case 5:var o=t.return;try{Al(t)}catch(c){Be(t,o,c)}}}catch(c){Be(t,t.return,c)}if(t===e){te=null;break}var l=t.sibling;if(l!==null){l.return=t.return,te=l;break}te=t.return}}var nv=Math.ceil,_a=As.ReactCurrentDispatcher,Lc=As.ReactCurrentOwner,qt=As.ReactCurrentBatchConfig,Ee=0,rt=null,Ke=null,ct=0,Ot=0,Jn=dn(0),Ye=0,ci=null,Cn=0,Ya=0,Mc=0,Br=null,bt=null,Ic=0,dr=1/0,ws=null,Pa=!1,Ll=null,Qs=null,Fi=!1,Bs=null,Ta=0,Wr=0,Ml=null,ea=-1,ta=0;function yt(){return Ee&6?We():ea!==-1?ea:ea=We()}function Ys(e){return e.mode&1?Ee&2&&ct!==0?ct&-ct:$g.transition!==null?(ta===0&&(ta=cf()),ta):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:xf(e.type)),e):1}function is(e,t,s,r){if(50<Wr)throw Wr=0,Ml=null,Error(K(185));mi(e,s,r),(!(Ee&2)||e!==rt)&&(e===rt&&(!(Ee&2)&&(Ya|=s),Ye===4&&Vs(e,ct)),Rt(e,r),s===1&&Ee===0&&!(t.mode&1)&&(dr=We()+500,Ja&&un()))}function Rt(e,t){var s=e.callbackNode;$x(e,t);var r=pa(e,e===rt?ct:0);if(r===0)s!==null&&Zd(s),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(s!=null&&Zd(s),t===1)e.tag===0?Fg(Ku.bind(null,e)):Lf(Ku.bind(null,e)),Lg(function(){!(Ee&6)&&un()}),s=null;else{switch(df(r)){case 1:s=cc;break;case 4:s=of;break;case 16:s=fa;break;case 536870912:s=lf;break;default:s=fa}s=Op(s,Cp.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function Cp(e,t){if(ea=-1,ta=0,Ee&6)throw Error(K(327));var s=e.callbackNode;if(Zn()&&e.callbackNode!==s)return null;var r=pa(e,e===rt?ct:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Aa(e,r);else{t=r;var i=Ee;Ee|=2;var a=Rp();(rt!==e||ct!==t)&&(ws=null,dr=We()+500,wn(e,t));do try{av();break}catch(l){Ep(e,l)}while(!0);Nc(),_a.current=a,Ee=i,Ke!==null?t=0:(rt=null,ct=0,t=Ye)}if(t!==0){if(t===2&&(i=cl(e),i!==0&&(r=i,t=Il(e,i))),t===1)throw s=ci,wn(e,0),Vs(e,r),Rt(e,We()),s;if(t===6)Vs(e,r);else{if(i=e.current.alternate,!(r&30)&&!rv(i)&&(t=Aa(e,r),t===2&&(a=cl(e),a!==0&&(r=a,t=Il(e,a))),t===1))throw s=ci,wn(e,0),Vs(e,r),Rt(e,We()),s;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(K(345));case 2:gn(e,bt,ws);break;case 3:if(Vs(e,r),(r&130023424)===r&&(t=Ic+500-We(),10<t)){if(pa(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){yt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=gl(gn.bind(null,e,bt,ws),t);break}gn(e,bt,ws);break;case 4:if(Vs(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-rs(r);a=1<<o,o=t[o],o>i&&(i=o),r&=~a}if(r=i,r=We()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nv(r/1960))-r,10<r){e.timeoutHandle=gl(gn.bind(null,e,bt,ws),r);break}gn(e,bt,ws);break;case 5:gn(e,bt,ws);break;default:throw Error(K(329))}}}return Rt(e,We()),e.callbackNode===s?Cp.bind(null,e):null}function Il(e,t){var s=Br;return e.current.memoizedState.isDehydrated&&(wn(e,t).flags|=256),e=Aa(e,t),e!==2&&(t=bt,bt=s,t!==null&&Dl(t)),e}function Dl(e){bt===null?bt=e:bt.push.apply(bt,e)}function rv(e){for(var t=e;;){if(t.flags&16384){var s=t.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var r=0;r<s.length;r++){var i=s[r],a=i.getSnapshot;i=i.value;try{if(!os(a(),i))return!1}catch{return!1}}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;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 Vs(e,t){for(t&=~Mc,t&=~Ya,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-rs(t),r=1<<s;e[s]=-1,t&=~r}}function Ku(e){if(Ee&6)throw Error(K(327));Zn();var t=pa(e,0);if(!(t&1))return Rt(e,We()),null;var s=Aa(e,t);if(e.tag!==0&&s===2){var r=cl(e);r!==0&&(t=r,s=Il(e,r))}if(s===1)throw s=ci,wn(e,0),Vs(e,t),Rt(e,We()),s;if(s===6)throw Error(K(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,gn(e,bt,ws),Rt(e,We()),null}function Dc(e,t){var s=Ee;Ee|=1;try{return e(t)}finally{Ee=s,Ee===0&&(dr=We()+500,Ja&&un())}}function En(e){Bs!==null&&Bs.tag===0&&!(Ee&6)&&Zn();var t=Ee;Ee|=1;var s=qt.transition,r=Pe;try{if(qt.transition=null,Pe=1,e)return e()}finally{Pe=r,qt.transition=s,Ee=t,!(Ee&6)&&un()}}function Fc(){Ot=Jn.current,Me(Jn)}function wn(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,zg(s)),Ke!==null)for(s=Ke.return;s!==null;){var r=s;switch(yc(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ya();break;case 3:lr(),Me(Ct),Me(pt),Rc();break;case 5:Ec(r);break;case 4:lr();break;case 13:Me($e);break;case 19:Me($e);break;case 10:kc(r.type._context);break;case 22:case 23:Fc()}s=s.return}if(rt=e,Ke=e=Xs(e.current,null),ct=Ot=t,Ye=0,ci=null,Mc=Ya=Cn=0,bt=Br=null,yn!==null){for(t=0;t<yn.length;t++)if(s=yn[t],r=s.interleaved,r!==null){s.interleaved=null;var i=r.next,a=s.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}s.pending=r}yn=null}return e}function Ep(e,t){do{var s=Ke;try{if(Nc(),Yi.current=Ra,Ea){for(var r=Ve.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Ea=!1}if(Sn=0,tt=Qe=Ve=null,Vr=!1,ai=0,Lc.current=null,s===null||s.return===null){Ye=1,ci=t,Ke=null;break}e:{var a=e,o=s.return,l=s,c=t;if(t=ct,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,m=l,f=m.tag;if(!(m.mode&1)&&(f===0||f===11||f===15)){var g=m.alternate;g?(m.updateQueue=g.updateQueue,m.memoizedState=g.memoizedState,m.lanes=g.lanes):(m.updateQueue=null,m.memoizedState=null)}var R=Au(o);if(R!==null){R.flags&=-257,Ou(R,o,l,a,t),R.mode&1&&Tu(a,u,t),t=R,c=u;var k=t.updateQueue;if(k===null){var C=new Set;C.add(c),t.updateQueue=C}else k.add(c);break e}else{if(!(t&1)){Tu(a,u,t),$c();break e}c=Error(K(426))}}else if(Fe&&l.mode&1){var j=Au(o);if(j!==null){!(j.flags&65536)&&(j.flags|=256),Ou(j,o,l,a,t),jc(cr(c,l));break e}}a=c=cr(c,l),Ye!==4&&(Ye=2),Br===null?Br=[a]:Br.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var p=dp(a,c,t);Su(a,p);break e;case 1:l=c;var h=a.type,x=a.stateNode;if(!(a.flags&128)&&(typeof h.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Qs===null||!Qs.has(x)))){a.flags|=65536,t&=-t,a.lanes|=t;var w=up(a,l,t);Su(a,w);break e}}a=a.return}while(a!==null)}Pp(s)}catch(N){t=N,Ke===s&&s!==null&&(Ke=s=s.return);continue}break}while(!0)}function Rp(){var e=_a.current;return _a.current=Ra,e===null?Ra:e}function $c(){(Ye===0||Ye===3||Ye===2)&&(Ye=4),rt===null||!(Cn&268435455)&&!(Ya&268435455)||Vs(rt,ct)}function Aa(e,t){var s=Ee;Ee|=2;var r=Rp();(rt!==e||ct!==t)&&(ws=null,wn(e,t));do try{iv();break}catch(i){Ep(e,i)}while(!0);if(Nc(),Ee=s,_a.current=r,Ke!==null)throw Error(K(261));return rt=null,ct=0,Ye}function iv(){for(;Ke!==null;)_p(Ke)}function av(){for(;Ke!==null&&!Tx();)_p(Ke)}function _p(e){var t=Ap(e.alternate,e,Ot);e.memoizedProps=e.pendingProps,t===null?Pp(e):Ke=t,Lc.current=null}function Pp(e){var t=e;do{var s=t.alternate;if(e=t.return,t.flags&32768){if(s=Zg(s,t),s!==null){s.flags&=32767,Ke=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ye=6,Ke=null;return}}else if(s=Xg(s,t,Ot),s!==null){Ke=s;return}if(t=t.sibling,t!==null){Ke=t;return}Ke=t=e}while(t!==null);Ye===0&&(Ye=5)}function gn(e,t,s){var r=Pe,i=qt.transition;try{qt.transition=null,Pe=1,ov(e,t,s,r)}finally{qt.transition=i,Pe=r}return null}function ov(e,t,s,r){do Zn();while(Bs!==null);if(Ee&6)throw Error(K(327));s=e.finishedWork;var i=e.finishedLanes;if(s===null)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(K(177));e.callbackNode=null,e.callbackPriority=0;var a=s.lanes|s.childLanes;if(Vx(e,a),e===rt&&(Ke=rt=null,ct=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||Fi||(Fi=!0,Op(fa,function(){return Zn(),null})),a=(s.flags&15990)!==0,s.subtreeFlags&15990||a){a=qt.transition,qt.transition=null;var o=Pe;Pe=1;var l=Ee;Ee|=4,Lc.current=null,tv(e,s),bp(s,e),Eg(ml),ma=!!pl,ml=pl=null,e.current=s,sv(s),Ax(),Ee=l,Pe=o,qt.transition=a}else e.current=s;if(Fi&&(Fi=!1,Bs=e,Ta=i),a=e.pendingLanes,a===0&&(Qs=null),Lx(s.stateNode),Rt(e,We()),t!==null)for(r=e.onRecoverableError,s=0;s<t.length;s++)i=t[s],r(i.value,{componentStack:i.stack,digest:i.digest});if(Pa)throw Pa=!1,e=Ll,Ll=null,e;return Ta&1&&e.tag!==0&&Zn(),a=e.pendingLanes,a&1?e===Ml?Wr++:(Wr=0,Ml=e):Wr=0,un(),null}function Zn(){if(Bs!==null){var e=df(Ta),t=qt.transition,s=Pe;try{if(qt.transition=null,Pe=16>e?16:e,Bs===null)var r=!1;else{if(e=Bs,Bs=null,Ta=0,Ee&6)throw Error(K(331));var i=Ee;for(Ee|=4,te=e.current;te!==null;){var a=te,o=a.child;if(te.flags&16){var l=a.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(te=u;te!==null;){var m=te;switch(m.tag){case 0:case 11:case 15:Ur(8,m,a)}var f=m.child;if(f!==null)f.return=m,te=f;else for(;te!==null;){m=te;var g=m.sibling,R=m.return;if(wp(m),m===u){te=null;break}if(g!==null){g.return=R,te=g;break}te=R}}}var k=a.alternate;if(k!==null){var C=k.child;if(C!==null){k.child=null;do{var j=C.sibling;C.sibling=null,C=j}while(C!==null)}}te=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,te=o;else e:for(;te!==null;){if(a=te,a.flags&2048)switch(a.tag){case 0:case 11:case 15:Ur(9,a,a.return)}var p=a.sibling;if(p!==null){p.return=a.return,te=p;break e}te=a.return}}var h=e.current;for(te=h;te!==null;){o=te;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,te=x;else e:for(o=h;te!==null;){if(l=te,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Qa(9,l)}}catch(N){Be(l,l.return,N)}if(l===o){te=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,te=w;break e}te=l.return}}if(Ee=i,un(),ms&&typeof ms.onPostCommitFiberRoot=="function")try{ms.onPostCommitFiberRoot(Ua,e)}catch{}r=!0}return r}finally{Pe=s,qt.transition=t}}return!1}function Hu(e,t,s){t=cr(s,t),t=dp(e,t,1),e=Gs(e,t,1),t=yt(),e!==null&&(mi(e,1,t),Rt(e,t))}function Be(e,t,s){if(e.tag===3)Hu(e,e,s);else for(;t!==null;){if(t.tag===3){Hu(t,e,s);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qs===null||!Qs.has(r))){e=cr(s,e),e=up(t,e,1),t=Gs(t,e,1),e=yt(),t!==null&&(mi(t,1,e),Rt(t,e));break}}t=t.return}}function lv(e,t,s){var r=e.pingCache;r!==null&&r.delete(t),t=yt(),e.pingedLanes|=e.suspendedLanes&s,rt===e&&(ct&s)===s&&(Ye===4||Ye===3&&(ct&130023424)===ct&&500>We()-Ic?wn(e,0):Mc|=s),Rt(e,t)}function Tp(e,t){t===0&&(e.mode&1?(t=_i,_i<<=1,!(_i&130023424)&&(_i=4194304)):t=1);var s=yt();e=Rs(e,t),e!==null&&(mi(e,t,s),Rt(e,s))}function cv(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Tp(e,s)}function dv(e,t){var s=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(s=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),Tp(e,s)}var Ap;Ap=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ct.current)St=!0;else{if(!(e.lanes&s)&&!(t.flags&128))return St=!1,Yg(e,t,s);St=!!(e.flags&131072)}else St=!1,Fe&&t.flags&1048576&&Mf(t,Na,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Zi(e,t),e=t.pendingProps;var i=ir(t,pt.current);Xn(t,s),i=Pc(null,t,r,e,i,s);var a=Tc();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Et(r)?(a=!0,ja(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Sc(t),i.updater=Ga,t.stateNode=i,i._reactInternals=t,bl(t,r,e,s),t=El(null,t,r,!0,a,s)):(t.tag=0,Fe&&a&&vc(t),gt(null,t,i,s),t=t.child),t;case 16:r=t.elementType;e:{switch(Zi(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=hv(r),e=Zt(r,e),i){case 0:t=Cl(null,t,r,e,s);break e;case 1:t=Mu(null,t,r,e,s);break e;case 11:t=zu(null,t,r,e,s);break e;case 14:t=Lu(null,t,r,Zt(r.type,e),s);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zt(r,i),Cl(e,t,r,i,s);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zt(r,i),Mu(e,t,r,i,s);case 3:e:{if(mp(t),e===null)throw Error(K(387));r=t.pendingProps,a=t.memoizedState,i=a.element,Uf(e,t),Sa(t,r,null,s);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=cr(Error(K(423)),t),t=Iu(e,t,r,s,i);break e}else if(r!==i){i=cr(Error(K(424)),t),t=Iu(e,t,r,s,i);break e}else for(zt=qs(t.stateNode.containerInfo.firstChild),Lt=t,Fe=!0,ss=null,s=$f(t,null,r,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ar(),r===i){t=_s(e,t,s);break e}gt(e,t,r,s)}t=t.child}return t;case 5:return Bf(t),e===null&&wl(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,xl(r,i)?o=null:a!==null&&xl(r,a)&&(t.flags|=32),pp(e,t),gt(e,t,o,s),t.child;case 6:return e===null&&wl(t),null;case 13:return xp(e,t,s);case 4:return Cc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=or(t,null,r,s):gt(e,t,r,s),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zt(r,i),zu(e,t,r,i,s);case 7:return gt(e,t,t.pendingProps,s),t.child;case 8:return gt(e,t,t.pendingProps.children,s),t.child;case 12:return gt(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,Ae(ka,r._currentValue),r._currentValue=o,a!==null)if(os(a.value,o)){if(a.children===i.children&&!Ct.current){t=_s(e,t,s);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=Ss(-1,s&-s),c.tag=2;var u=a.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}}a.lanes|=s,c=a.alternate,c!==null&&(c.lanes|=s),Nl(a.return,s,t),l.lanes|=s;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(K(341));o.lanes|=s,l=o.alternate,l!==null&&(l.lanes|=s),Nl(o,s,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}gt(e,t,i.children,s),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Xn(t,s),i=Gt(i),r=r(i),t.flags|=1,gt(e,t,r,s),t.child;case 14:return r=t.type,i=Zt(r,t.pendingProps),i=Zt(r.type,i),Lu(e,t,r,i,s);case 15:return hp(e,t,t.type,t.pendingProps,s);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zt(r,i),Zi(e,t),t.tag=1,Et(r)?(e=!0,ja(t)):e=!1,Xn(t,s),cp(t,r,i),bl(t,r,i,s),El(null,t,r,!0,e,s);case 19:return gp(e,t,s);case 22:return fp(e,t,s)}throw Error(K(156,t.tag))};function Op(e,t){return af(e,t)}function uv(e,t,s,r){this.tag=e,this.key=s,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 Ht(e,t,s,r){return new uv(e,t,s,r)}function Vc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hv(e){if(typeof e=="function")return Vc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ac)return 11;if(e===oc)return 14}return 2}function Xs(e,t){var s=e.alternate;return s===null?(s=Ht(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function sa(e,t,s,r,i,a){var o=2;if(r=e,typeof e=="function")Vc(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case In:return Nn(s.children,i,a,t);case ic:o=8,i|=8;break;case qo:return e=Ht(12,s,t,i|2),e.elementType=qo,e.lanes=a,e;case Go:return e=Ht(13,s,t,i),e.elementType=Go,e.lanes=a,e;case Qo:return e=Ht(19,s,t,i),e.elementType=Qo,e.lanes=a,e;case Uh:return Xa(s,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $h:o=10;break e;case Vh:o=9;break e;case ac:o=11;break e;case oc:o=14;break e;case Ds:o=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=Ht(o,s,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Nn(e,t,s,r){return e=Ht(7,e,r,t),e.lanes=s,e}function Xa(e,t,s,r){return e=Ht(22,e,r,t),e.elementType=Uh,e.lanes=s,e.stateNode={isHidden:!1},e}function Do(e,t,s){return e=Ht(6,e,null,t),e.lanes=s,e}function Fo(e,t,s){return t=Ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fv(e,t,s,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yo(0),this.expirationTimes=yo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Uc(e,t,s,r,i,a,o,l,c){return e=new fv(e,t,s,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=Ht(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sc(a),e}function pv(e,t,s){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Mn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:s}}function zp(e){if(!e)return nn;e=e._reactInternals;e:{if(Tn(e)!==e||e.tag!==1)throw Error(K(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Et(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(K(171))}if(e.tag===1){var s=e.type;if(Et(s))return zf(e,s,t)}return t}function Lp(e,t,s,r,i,a,o,l,c){return e=Uc(s,r,!0,e,i,a,o,l,c),e.context=zp(null),s=e.current,r=yt(),i=Ys(s),a=Ss(r,i),a.callback=t??null,Gs(s,a,i),e.current.lanes=i,mi(e,i,r),Rt(e,r),e}function Za(e,t,s,r){var i=t.current,a=yt(),o=Ys(i);return s=zp(s),t.context===null?t.context=s:t.pendingContext=s,t=Ss(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Gs(i,t,o),e!==null&&(is(e,i,o,a),Qi(e,i,o)),o}function Oa(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 Ju(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Bc(e,t){Ju(e,t),(e=e.alternate)&&Ju(e,t)}function mv(){return null}var Mp=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wc(e){this._internalRoot=e}eo.prototype.render=Wc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(K(409));Za(e,t,null,null)};eo.prototype.unmount=Wc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;En(function(){Za(null,e,null,null)}),t[Es]=null}};function eo(e){this._internalRoot=e}eo.prototype.unstable_scheduleHydration=function(e){if(e){var t=ff();e={blockedOn:null,target:e,priority:t};for(var s=0;s<$s.length&&t!==0&&t<$s[s].priority;s++);$s.splice(s,0,e),s===0&&mf(e)}};function Kc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function to(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function qu(){}function xv(e,t,s,r,i){if(i){if(typeof r=="function"){var a=r;r=function(){var u=Oa(o);a.call(u)}}var o=Lp(t,r,e,0,null,!1,!1,"",qu);return e._reactRootContainer=o,e[Es]=o.current,ti(e.nodeType===8?e.parentNode:e),En(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var u=Oa(c);l.call(u)}}var c=Uc(e,0,!1,null,null,!1,!1,"",qu);return e._reactRootContainer=c,e[Es]=c.current,ti(e.nodeType===8?e.parentNode:e),En(function(){Za(t,c,s,r)}),c}function so(e,t,s,r,i){var a=s._reactRootContainer;if(a){var o=a;if(typeof i=="function"){var l=i;i=function(){var c=Oa(o);l.call(c)}}Za(t,o,e,i)}else o=xv(s,t,e,i,r);return Oa(o)}uf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=Or(t.pendingLanes);s!==0&&(dc(t,s|1),Rt(t,We()),!(Ee&6)&&(dr=We()+500,un()))}break;case 13:En(function(){var r=Rs(e,1);if(r!==null){var i=yt();is(r,e,1,i)}}),Bc(e,1)}};uc=function(e){if(e.tag===13){var t=Rs(e,134217728);if(t!==null){var s=yt();is(t,e,134217728,s)}Bc(e,134217728)}};hf=function(e){if(e.tag===13){var t=Ys(e),s=Rs(e,t);if(s!==null){var r=yt();is(s,e,t,r)}Bc(e,t)}};ff=function(){return Pe};pf=function(e,t){var s=Pe;try{return Pe=e,t()}finally{Pe=s}};al=function(e,t,s){switch(t){case"input":if(Zo(e,s),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var r=s[t];if(r!==e&&r.form===e.form){var i=Ha(r);if(!i)throw Error(K(90));Wh(r),Zo(r,i)}}}break;case"textarea":Hh(e,s);break;case"select":t=s.value,t!=null&&qn(e,!!s.multiple,t,!1)}};Zh=Dc;ef=En;var gv={usingClientEntryPoint:!1,Events:[gi,Vn,Ha,Yh,Xh,Dc]},Cr={findFiberByHostInstance:vn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vv={bundleType:Cr.bundleType,version:Cr.version,rendererPackageName:Cr.rendererPackageName,rendererConfig:Cr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:As.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=nf(e),e===null?null:e.stateNode},findFiberByHostInstance:Cr.findFiberByHostInstance||mv,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 $i=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$i.isDisabled&&$i.supportsFiber)try{Ua=$i.inject(vv),ms=$i}catch{}}It.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gv;It.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Kc(t))throw Error(K(200));return pv(e,t,null,s)};It.createRoot=function(e,t){if(!Kc(e))throw Error(K(299));var s=!1,r="",i=Mp;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Uc(e,1,!1,null,null,s,!1,r,i),e[Es]=t.current,ti(e.nodeType===8?e.parentNode:e),new Wc(t)};It.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(K(188)):(e=Object.keys(e).join(","),Error(K(268,e)));return e=nf(t),e=e===null?null:e.stateNode,e};It.flushSync=function(e){return En(e)};It.hydrate=function(e,t,s){if(!to(t))throw Error(K(200));return so(null,e,t,!0,s)};It.hydrateRoot=function(e,t,s){if(!Kc(e))throw Error(K(405));var r=s!=null&&s.hydratedSources||null,i=!1,a="",o=Mp;if(s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(a=s.identifierPrefix),s.onRecoverableError!==void 0&&(o=s.onRecoverableError)),t=Lp(t,null,e,1,s??null,i,!1,a,o),e[Es]=t.current,ti(e),r)for(e=0;e<r.length;e++)s=r[e],i=s._getVersion,i=i(s._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[s,i]:t.mutableSourceEagerHydrationData.push(s,i);return new eo(t)};It.render=function(e,t,s){if(!to(t))throw Error(K(200));return so(null,e,t,!1,s)};It.unmountComponentAtNode=function(e){if(!to(e))throw Error(K(40));return e._reactRootContainer?(En(function(){so(null,null,e,!1,function(){e._reactRootContainer=null,e[Es]=null})}),!0):!1};It.unstable_batchedUpdates=Dc;It.unstable_renderSubtreeIntoContainer=function(e,t,s,r){if(!to(s))throw Error(K(200));if(e==null||e._reactInternals===void 0)throw Error(K(38));return so(e,t,s,!1,r)};It.version="18.3.1-next-f1338f8080-20240426";function Ip(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ip)}catch(e){console.error(e)}}Ip(),Mh.exports=It;var yv=Mh.exports,Gu=yv;Ho.createRoot=Gu.createRoot,Ho.hydrateRoot=Gu.hydrateRoot;/**
41
+ * @remix-run/router v1.23.1
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */function di(){return di=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},di.apply(this,arguments)}var Ws;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Ws||(Ws={}));const Qu="popstate";function jv(e){e===void 0&&(e={});function t(r,i){let{pathname:a,search:o,hash:l}=r.location;return Fl("",{pathname:a,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function s(r,i){return typeof i=="string"?i:za(i)}return Nv(t,s,null,e)}function Je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Hc(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function wv(){return Math.random().toString(36).substr(2,8)}function Yu(e,t){return{usr:e.state,key:e.key,idx:t}}function Fl(e,t,s,r){return s===void 0&&(s=null),di({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?mr(t):t,{state:s,key:t&&t.key||r||wv()})}function za(e){let{pathname:t="/",search:s="",hash:r=""}=e;return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function mr(e){let t={};if(e){let s=e.indexOf("#");s>=0&&(t.hash=e.substr(s),e=e.substr(0,s));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Nv(e,t,s,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=Ws.Pop,c=null,u=m();u==null&&(u=0,o.replaceState(di({},o.state,{idx:u}),""));function m(){return(o.state||{idx:null}).idx}function f(){l=Ws.Pop;let j=m(),p=j==null?null:j-u;u=j,c&&c({action:l,location:C.location,delta:p})}function g(j,p){l=Ws.Push;let h=Fl(C.location,j,p);u=m()+1;let x=Yu(h,u),w=C.createHref(h);try{o.pushState(x,"",w)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(w)}a&&c&&c({action:l,location:C.location,delta:1})}function R(j,p){l=Ws.Replace;let h=Fl(C.location,j,p);u=m();let x=Yu(h,u),w=C.createHref(h);o.replaceState(x,"",w),a&&c&&c({action:l,location:C.location,delta:0})}function k(j){let p=i.location.origin!=="null"?i.location.origin:i.location.href,h=typeof j=="string"?j:za(j);return h=h.replace(/ $/,"%20"),Je(p,"No window.location.(origin|href) available to create URL for href: "+h),new URL(h,p)}let C={get action(){return l},get location(){return e(i,o)},listen(j){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Qu,f),c=j,()=>{i.removeEventListener(Qu,f),c=null}},createHref(j){return t(i,j)},createURL:k,encodeLocation(j){let p=k(j);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:g,replace:R,go(j){return o.go(j)}};return C}var Xu;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Xu||(Xu={}));function kv(e,t,s){return s===void 0&&(s="/"),bv(e,t,s)}function bv(e,t,s,r){let i=typeof t=="string"?mr(t):t,a=Jc(i.pathname||"/",s);if(a==null)return null;let o=Dp(e);Sv(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=Iv(a);l=zv(o[c],u)}return l}function Dp(e,t,s,r){t===void 0&&(t=[]),s===void 0&&(s=[]),r===void 0&&(r="");let i=(a,o,l)=>{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Je(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Zs([r,c.relativePath]),m=s.concat(c);a.children&&a.children.length>0&&(Je(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Dp(a.children,t,m,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:Av(u,a.index),routesMeta:m})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let c of Fp(a.path))i(a,o,c)}),t}function Fp(e){let t=e.split("/");if(t.length===0)return[];let[s,...r]=t,i=s.endsWith("?"),a=s.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=Fp(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Sv(e){e.sort((t,s)=>t.score!==s.score?s.score-t.score:Ov(t.routesMeta.map(r=>r.childrenIndex),s.routesMeta.map(r=>r.childrenIndex)))}const Cv=/^:[\w-]+$/,Ev=3,Rv=2,_v=1,Pv=10,Tv=-2,Zu=e=>e==="*";function Av(e,t){let s=e.split("/"),r=s.length;return s.some(Zu)&&(r+=Tv),t&&(r+=Rv),s.filter(i=>!Zu(i)).reduce((i,a)=>i+(Cv.test(a)?Ev:a===""?_v:Pv),r)}function Ov(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function zv(e,t,s){let{routesMeta:r}=e,i={},a="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,m=a==="/"?t:t.slice(a.length)||"/",f=Lv({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},m),g=c.route;if(!f)return null;Object.assign(i,f.params),o.push({params:i,pathname:Zs([a,f.pathname]),pathnameBase:Uv(Zs([a,f.pathnameBase])),route:g}),f.pathnameBase!=="/"&&(a=Zs([a,f.pathnameBase]))}return o}function Lv(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,r]=Mv(e.path,e.caseSensitive,e.end),i=t.match(s);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:r.reduce((u,m,f)=>{let{paramName:g,isOptional:R}=m;if(g==="*"){let C=l[f]||"";o=a.slice(0,a.length-C.length).replace(/(.)\/+$/,"$1")}const k=l[f];return R&&!k?u[g]=void 0:u[g]=(k||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function Mv(e,t,s){t===void 0&&(t=!1),s===void 0&&(s=!0),Hc(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function Iv(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Hc(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Jc(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,r=e.charAt(s);return r&&r!=="/"?null:e.slice(s)||"/"}const Dv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Fv=e=>Dv.test(e);function $v(e,t){t===void 0&&(t="/");let{pathname:s,search:r="",hash:i=""}=typeof e=="string"?mr(e):e,a;if(s)if(Fv(s))a=s;else{if(s.includes("//")){let o=s;s=s.replace(/\/\/+/g,"/"),Hc(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+s))}s.startsWith("/")?a=eh(s.substring(1),"/"):a=eh(s,t)}else a=t;return{pathname:a,search:Bv(r),hash:Wv(i)}}function eh(e,t){let s=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?s.length>1&&s.pop():i!=="."&&s.push(i)}),s.length>1?s.join("/"):"/"}function $o(e,t,s,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+s+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Vv(e){return e.filter((t,s)=>s===0||t.route.path&&t.route.path.length>0)}function $p(e,t){let s=Vv(e);return t?s.map((r,i)=>i===s.length-1?r.pathname:r.pathnameBase):s.map(r=>r.pathnameBase)}function Vp(e,t,s,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=mr(e):(i=di({},e),Je(!i.pathname||!i.pathname.includes("?"),$o("?","pathname","search",i)),Je(!i.pathname||!i.pathname.includes("#"),$o("#","pathname","hash",i)),Je(!i.search||!i.search.includes("#"),$o("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=s;else{let f=t.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),f-=1;i.pathname=g.join("/")}l=f>=0?t[f]:"/"}let c=$v(i,l),u=o&&o!=="/"&&o.endsWith("/"),m=(a||o===".")&&s.endsWith("/");return!c.pathname.endsWith("/")&&(u||m)&&(c.pathname+="/"),c}const Zs=e=>e.join("/").replace(/\/\/+/g,"/"),Uv=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Bv=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Wv=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Kv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Up=["post","put","patch","delete"];new Set(Up);const Hv=["get",...Up];new Set(Hv);/**
50
+ * React Router v6.30.2
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */function ui(){return ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},ui.apply(this,arguments)}const qc=d.createContext(null),Jv=d.createContext(null),An=d.createContext(null),no=d.createContext(null),hn=d.createContext({outlet:null,matches:[],isDataRoute:!1}),Bp=d.createContext(null);function qv(e,t){let{relative:s}=t===void 0?{}:t;yi()||Je(!1);let{basename:r,navigator:i}=d.useContext(An),{hash:a,pathname:o,search:l}=Hp(e,{relative:s}),c=o;return r!=="/"&&(c=o==="/"?r:Zs([r,o])),i.createHref({pathname:c,search:l,hash:a})}function yi(){return d.useContext(no)!=null}function On(){return yi()||Je(!1),d.useContext(no).location}function Wp(e){d.useContext(An).static||d.useLayoutEffect(e)}function Os(){let{isDataRoute:e}=d.useContext(hn);return e?oy():Gv()}function Gv(){yi()||Je(!1);let e=d.useContext(qc),{basename:t,future:s,navigator:r}=d.useContext(An),{matches:i}=d.useContext(hn),{pathname:a}=On(),o=JSON.stringify($p(i,s.v7_relativeSplatPath)),l=d.useRef(!1);return Wp(()=>{l.current=!0}),d.useCallback(function(u,m){if(m===void 0&&(m={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Vp(u,JSON.parse(o),a,m.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Zs([t,f.pathname])),(m.replace?r.replace:r.push)(f,m.state,m)},[t,r,o,a,e])}function Kp(){let{matches:e}=d.useContext(hn),t=e[e.length-1];return t?t.params:{}}function Hp(e,t){let{relative:s}=t===void 0?{}:t,{future:r}=d.useContext(An),{matches:i}=d.useContext(hn),{pathname:a}=On(),o=JSON.stringify($p(i,r.v7_relativeSplatPath));return d.useMemo(()=>Vp(e,JSON.parse(o),a,s==="path"),[e,o,a,s])}function Qv(e,t){return Yv(e,t)}function Yv(e,t,s,r){yi()||Je(!1);let{navigator:i}=d.useContext(An),{matches:a}=d.useContext(hn),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=On(),m;if(t){var f;let j=typeof t=="string"?mr(t):t;c==="/"||(f=j.pathname)!=null&&f.startsWith(c)||Je(!1),m=j}else m=u;let g=m.pathname||"/",R=g;if(c!=="/"){let j=c.replace(/^\//,"").split("/");R="/"+g.replace(/^\//,"").split("/").slice(j.length).join("/")}let k=kv(e,{pathname:R}),C=sy(k&&k.map(j=>Object.assign({},j,{params:Object.assign({},l,j.params),pathname:Zs([c,i.encodeLocation?i.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?c:Zs([c,i.encodeLocation?i.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),a,s,r);return t&&C?d.createElement(no.Provider,{value:{location:ui({pathname:"/",search:"",hash:"",state:null,key:"default"},m),navigationType:Ws.Pop}},C):C}function Xv(){let e=ay(),t=Kv(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),s?d.createElement("pre",{style:i},s):null,null)}const Zv=d.createElement(Xv,null);class ey extends d.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){console.error("React Router caught the following error during render",t,s)}render(){return this.state.error!==void 0?d.createElement(hn.Provider,{value:this.props.routeContext},d.createElement(Bp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ty(e){let{routeContext:t,match:s,children:r}=e,i=d.useContext(qc);return i&&i.static&&i.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=s.route.id),d.createElement(hn.Provider,{value:t},r)}function sy(e,t,s,r){var i;if(t===void 0&&(t=[]),s===void 0&&(s=null),r===void 0&&(r=null),e==null){var a;if(!s)return null;if(s.errors)e=s.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,l=(i=s)==null?void 0:i.errors;if(l!=null){let m=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);m>=0||Je(!1),o=o.slice(0,Math.min(o.length,m+1))}let c=!1,u=-1;if(s&&r&&r.v7_partialHydration)for(let m=0;m<o.length;m++){let f=o[m];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=m),f.route.id){let{loaderData:g,errors:R}=s,k=f.route.loader&&g[f.route.id]===void 0&&(!R||R[f.route.id]===void 0);if(f.route.lazy||k){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((m,f,g)=>{let R,k=!1,C=null,j=null;s&&(R=l&&f.route.id?l[f.route.id]:void 0,C=f.route.errorElement||Zv,c&&(u<0&&g===0?(ly("route-fallback"),k=!0,j=null):u===g&&(k=!0,j=f.route.hydrateFallbackElement||null)));let p=t.concat(o.slice(0,g+1)),h=()=>{let x;return R?x=C:k?x=j:f.route.Component?x=d.createElement(f.route.Component,null):f.route.element?x=f.route.element:x=m,d.createElement(ty,{match:f,routeContext:{outlet:m,matches:p,isDataRoute:s!=null},children:x})};return s&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?d.createElement(ey,{location:s.location,revalidation:s.revalidation,component:C,error:R,children:h(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):h()},null)}var Jp=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Jp||{}),qp=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(qp||{});function ny(e){let t=d.useContext(qc);return t||Je(!1),t}function ry(e){let t=d.useContext(Jv);return t||Je(!1),t}function iy(e){let t=d.useContext(hn);return t||Je(!1),t}function Gp(e){let t=iy(),s=t.matches[t.matches.length-1];return s.route.id||Je(!1),s.route.id}function ay(){var e;let t=d.useContext(Bp),s=ry(),r=Gp();return t!==void 0?t:(e=s.errors)==null?void 0:e[r]}function oy(){let{router:e}=ny(Jp.UseNavigateStable),t=Gp(qp.UseNavigateStable),s=d.useRef(!1);return Wp(()=>{s.current=!0}),d.useCallback(function(i,a){a===void 0&&(a={}),s.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,ui({fromRouteId:t},a)))},[e,t])}const th={};function ly(e,t,s){th[e]||(th[e]=!0)}function cy(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function us(e){Je(!1)}function dy(e){let{basename:t="/",children:s=null,location:r,navigationType:i=Ws.Pop,navigator:a,static:o=!1,future:l}=e;yi()&&Je(!1);let c=t.replace(/^\/*/,"/"),u=d.useMemo(()=>({basename:c,navigator:a,static:o,future:ui({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=mr(r));let{pathname:m="/",search:f="",hash:g="",state:R=null,key:k="default"}=r,C=d.useMemo(()=>{let j=Jc(m,c);return j==null?null:{location:{pathname:j,search:f,hash:g,state:R,key:k},navigationType:i}},[c,m,f,g,R,k,i]);return C==null?null:d.createElement(An.Provider,{value:u},d.createElement(no.Provider,{children:s,value:C}))}function uy(e){let{children:t,location:s}=e;return Qv($l(t),s)}new Promise(()=>{});function $l(e,t){t===void 0&&(t=[]);let s=[];return d.Children.forEach(e,(r,i)=>{if(!d.isValidElement(r))return;let a=[...t,i];if(r.type===d.Fragment){s.push.apply(s,$l(r.props.children,a));return}r.type!==us&&Je(!1),!r.props.index||!r.props.children||Je(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=$l(r.props.children,a)),s.push(o)}),s}/**
59
+ * React Router DOM v6.30.2
60
+ *
61
+ * Copyright (c) Remix Software Inc.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE.md file in the root directory of this source tree.
65
+ *
66
+ * @license MIT
67
+ */function Vl(){return Vl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},Vl.apply(this,arguments)}function hy(e,t){if(e==null)return{};var s={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(s[i]=e[i]);return s}function fy(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function py(e,t){return e.button===0&&(!t||t==="_self")&&!fy(e)}function Ul(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,s)=>{let r=e[s];return t.concat(Array.isArray(r)?r.map(i=>[s,i]):[[s,r]])},[]))}function my(e,t){let s=Ul(e);return t&&t.forEach((r,i)=>{s.has(i)||t.getAll(i).forEach(a=>{s.append(i,a)})}),s}const xy=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gy="6";try{window.__reactRouterVersion=gy}catch{}const vy="startTransition",sh=zh[vy];function yy(e){let{basename:t,children:s,future:r,window:i}=e,a=d.useRef();a.current==null&&(a.current=jv({window:i,v5Compat:!0}));let o=a.current,[l,c]=d.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},m=d.useCallback(f=>{u&&sh?sh(()=>c(f)):c(f)},[c,u]);return d.useLayoutEffect(()=>o.listen(m),[o,m]),d.useEffect(()=>cy(r),[r]),d.createElement(dy,{basename:t,children:s,location:l.location,navigationType:l.action,navigator:o,future:r})}const jy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Kt=d.forwardRef(function(t,s){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:m,viewTransition:f}=t,g=hy(t,xy),{basename:R}=d.useContext(An),k,C=!1;if(typeof u=="string"&&wy.test(u)&&(k=u,jy))try{let x=new URL(window.location.href),w=u.startsWith("//")?new URL(x.protocol+u):new URL(u),N=Jc(w.pathname,R);w.origin===x.origin&&N!=null?u=N+w.search+w.hash:C=!0}catch{}let j=qv(u,{relative:i}),p=Ny(u,{replace:o,state:l,target:c,preventScrollReset:m,relative:i,viewTransition:f});function h(x){r&&r(x),x.defaultPrevented||p(x)}return d.createElement("a",Vl({},g,{href:k||j,onClick:C||a?r:h,ref:s,target:c}))});var nh;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(nh||(nh={}));var rh;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(rh||(rh={}));function Ny(e,t){let{target:s,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=Os(),u=On(),m=Hp(e,{relative:o});return d.useCallback(f=>{if(py(f,s)){f.preventDefault();let g=r!==void 0?r:za(u)===za(m);c(e,{replace:g,state:i,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,m,r,i,s,e,a,o,l])}function ky(e){let t=d.useRef(Ul(e)),s=d.useRef(!1),r=On(),i=d.useMemo(()=>my(r.search,s.current?null:t.current),[r.search]),a=Os(),o=d.useCallback((l,c)=>{const u=Ul(typeof l=="function"?l(i):l);s.current=!0,a("?"+u,c)},[a,i]);return[i,o]}/**
68
+ * @license lucide-react v0.294.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */var by={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
73
+ * @license lucide-react v0.294.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const Sy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),H=(e,t)=>{const s=d.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:a=2,absoluteStrokeWidth:o,className:l="",children:c,...u},m)=>d.createElement("svg",{ref:m,...by,width:i,height:i,stroke:r,strokeWidth:o?Number(a)*24/Number(i):a,className:["lucide",`lucide-${Sy(e)}`,l].join(" "),...u},[...t.map(([f,g])=>d.createElement(f,g)),...Array.isArray(c)?c:[c]]));return s.displayName=`${e}`,s};/**
78
+ * @license lucide-react v0.294.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const Jt=H("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
83
+ * @license lucide-react v0.294.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const Qp=H("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
88
+ * @license lucide-react v0.294.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const Bl=H("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
93
+ * @license lucide-react v0.294.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const Gc=H("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
98
+ * @license lucide-react v0.294.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const Cy=H("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
103
+ * @license lucide-react v0.294.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const Ey=H("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]]);/**
108
+ * @license lucide-react v0.294.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const vt=H("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
113
+ * @license lucide-react v0.294.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const Ry=H("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
118
+ * @license lucide-react v0.294.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const Qc=H("CheckSquare",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]]);/**
123
+ * @license lucide-react v0.294.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const ro=H("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
128
+ * @license lucide-react v0.294.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const zs=H("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
133
+ * @license lucide-react v0.294.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const _y=H("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
138
+ * @license lucide-react v0.294.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const Ps=H("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
143
+ * @license lucide-react v0.294.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const Yc=H("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
148
+ * @license lucide-react v0.294.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const Yp=H("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/**
153
+ * @license lucide-react v0.294.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const na=H("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
158
+ * @license lucide-react v0.294.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const hi=H("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
163
+ * @license lucide-react v0.294.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const Py=H("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
168
+ * @license lucide-react v0.294.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const Ty=H("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
173
+ * @license lucide-react v0.294.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const rn=H("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
178
+ * @license lucide-react v0.294.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const ra=H("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/**
183
+ * @license lucide-react v0.294.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const ih=H("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
188
+ * @license lucide-react v0.294.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const Ay=H("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
193
+ * @license lucide-react v0.294.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const an=H("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]);/**
198
+ * @license lucide-react v0.294.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const Oy=H("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
203
+ * @license lucide-react v0.294.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const ah=H("FileImage",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["circle",{cx:"10",cy:"13",r:"2",key:"6v46hv"}],["path",{d:"m20 17-1.09-1.09a2 2 0 0 0-2.82 0L10 22",key:"17vly1"}]]);/**
208
+ * @license lucide-react v0.294.0 - ISC
209
+ *
210
+ * This source code is licensed under the ISC license.
211
+ * See the LICENSE file in the root directory of this source tree.
212
+ */const zy=H("FileOutput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7.5L14.5 2H6a2 2 0 0 0-2 2v4",key:"702lig"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}]]);/**
213
+ * @license lucide-react v0.294.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */const Rn=H("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]);/**
218
+ * @license lucide-react v0.294.0 - ISC
219
+ *
220
+ * This source code is licensed under the ISC license.
221
+ * See the LICENSE file in the root directory of this source tree.
222
+ */const io=H("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/**
223
+ * @license lucide-react v0.294.0 - ISC
224
+ *
225
+ * This source code is licensed under the ISC license.
226
+ * See the LICENSE file in the root directory of this source tree.
227
+ */const Ly=H("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
228
+ * @license lucide-react v0.294.0 - ISC
229
+ *
230
+ * This source code is licensed under the ISC license.
231
+ * See the LICENSE file in the root directory of this source tree.
232
+ */const My=H("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
233
+ * @license lucide-react v0.294.0 - ISC
234
+ *
235
+ * This source code is licensed under the ISC license.
236
+ * See the LICENSE file in the root directory of this source tree.
237
+ */const Iy=H("FolderMinus",[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
238
+ * @license lucide-react v0.294.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const fi=H("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
243
+ * @license lucide-react v0.294.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */const Dy=H("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
248
+ * @license lucide-react v0.294.0 - ISC
249
+ *
250
+ * This source code is licensed under the ISC license.
251
+ * See the LICENSE file in the root directory of this source tree.
252
+ */const Xp=H("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
253
+ * @license lucide-react v0.294.0 - ISC
254
+ *
255
+ * This source code is licensed under the ISC license.
256
+ * See the LICENSE file in the root directory of this source tree.
257
+ */const Fy=H("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/**
258
+ * @license lucide-react v0.294.0 - ISC
259
+ *
260
+ * This source code is licensed under the ISC license.
261
+ * See the LICENSE file in the root directory of this source tree.
262
+ */const $y=H("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/**
263
+ * @license lucide-react v0.294.0 - ISC
264
+ *
265
+ * This source code is licensed under the ISC license.
266
+ * See the LICENSE file in the root directory of this source tree.
267
+ */const ur=H("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
268
+ * @license lucide-react v0.294.0 - ISC
269
+ *
270
+ * This source code is licensed under the ISC license.
271
+ * See the LICENSE file in the root directory of this source tree.
272
+ */const Vy=H("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["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",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
273
+ * @license lucide-react v0.294.0 - ISC
274
+ *
275
+ * This source code is licensed under the ISC license.
276
+ * See the LICENSE file in the root directory of this source tree.
277
+ */const Uy=H("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
278
+ * @license lucide-react v0.294.0 - ISC
279
+ *
280
+ * This source code is licensed under the ISC license.
281
+ * See the LICENSE file in the root directory of this source tree.
282
+ */const fn=H("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
283
+ * @license lucide-react v0.294.0 - ISC
284
+ *
285
+ * This source code is licensed under the ISC license.
286
+ * See the LICENSE file in the root directory of this source tree.
287
+ */const La=H("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",key:"1kog09"}]]);/**
288
+ * @license lucide-react v0.294.0 - ISC
289
+ *
290
+ * This source code is licensed under the ISC license.
291
+ * See the LICENSE file in the root directory of this source tree.
292
+ */const Kr=H("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
293
+ * @license lucide-react v0.294.0 - ISC
294
+ *
295
+ * This source code is licensed under the ISC license.
296
+ * See the LICENSE file in the root directory of this source tree.
297
+ */const By=H("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
298
+ * @license lucide-react v0.294.0 - ISC
299
+ *
300
+ * This source code is licensed under the ISC license.
301
+ * See the LICENSE file in the root directory of this source tree.
302
+ */const Ma=H("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
303
+ * @license lucide-react v0.294.0 - ISC
304
+ *
305
+ * This source code is licensed under the ISC license.
306
+ * See the LICENSE file in the root directory of this source tree.
307
+ */const _e=H("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
308
+ * @license lucide-react v0.294.0 - ISC
309
+ *
310
+ * This source code is licensed under the ISC license.
311
+ * See the LICENSE file in the root directory of this source tree.
312
+ */const Wy=H("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
313
+ * @license lucide-react v0.294.0 - ISC
314
+ *
315
+ * This source code is licensed under the ISC license.
316
+ * See the LICENSE file in the root directory of this source tree.
317
+ */const Ky=H("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
318
+ * @license lucide-react v0.294.0 - ISC
319
+ *
320
+ * This source code is licensed under the ISC license.
321
+ * See the LICENSE file in the root directory of this source tree.
322
+ */const Hy=H("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
323
+ * @license lucide-react v0.294.0 - ISC
324
+ *
325
+ * This source code is licensed under the ISC license.
326
+ * See the LICENSE file in the root directory of this source tree.
327
+ */const Zp=H("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
328
+ * @license lucide-react v0.294.0 - ISC
329
+ *
330
+ * This source code is licensed under the ISC license.
331
+ * See the LICENSE file in the root directory of this source tree.
332
+ */const oh=H("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
333
+ * @license lucide-react v0.294.0 - ISC
334
+ *
335
+ * This source code is licensed under the ISC license.
336
+ * See the LICENSE file in the root directory of this source tree.
337
+ */const Jy=H("MousePointer2",[["path",{d:"m4 4 7.07 17 2.51-7.39L21 11.07z",key:"1vqm48"}]]);/**
338
+ * @license lucide-react v0.294.0 - ISC
339
+ *
340
+ * This source code is licensed under the ISC license.
341
+ * See the LICENSE file in the root directory of this source tree.
342
+ */const ao=H("Paintbrush",[["path",{d:"M18.37 2.63 14 7l-1.59-1.59a2 2 0 0 0-2.82 0L8 7l9 9 1.59-1.59a2 2 0 0 0 0-2.82L17 10l4.37-4.37a2.12 2.12 0 1 0-3-3Z",key:"m6k5sh"}],["path",{d:"M9 8c-2 3-4 3.5-7 4l8 10c2-1 6-5 6-7",key:"arzq70"}],["path",{d:"M14.5 17.5 4.5 15",key:"s7fvrz"}]]);/**
343
+ * @license lucide-react v0.294.0 - ISC
344
+ *
345
+ * This source code is licensed under the ISC license.
346
+ * See the LICENSE file in the root directory of this source tree.
347
+ */const Xc=H("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",key:"1xcu5"}],["circle",{cx:"17.5",cy:"10.5",r:".5",key:"736e4u"}],["circle",{cx:"8.5",cy:"7.5",r:".5",key:"clrty"}],["circle",{cx:"6.5",cy:"12.5",r:".5",key:"1s4xz9"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
348
+ * @license lucide-react v0.294.0 - ISC
349
+ *
350
+ * This source code is licensed under the ISC license.
351
+ * See the LICENSE file in the root directory of this source tree.
352
+ */const qy=H("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
353
+ * @license lucide-react v0.294.0 - ISC
354
+ *
355
+ * This source code is licensed under the ISC license.
356
+ * See the LICENSE file in the root directory of this source tree.
357
+ */const Gy=H("PenSquare",[["path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1qinfi"}],["path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z",key:"w2jsv5"}]]);/**
358
+ * @license lucide-react v0.294.0 - ISC
359
+ *
360
+ * This source code is licensed under the ISC license.
361
+ * See the LICENSE file in the root directory of this source tree.
362
+ */const Ts=H("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
363
+ * @license lucide-react v0.294.0 - ISC
364
+ *
365
+ * This source code is licensed under the ISC license.
366
+ * See the LICENSE file in the root directory of this source tree.
367
+ */const em=H("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
368
+ * @license lucide-react v0.294.0 - ISC
369
+ *
370
+ * This source code is licensed under the ISC license.
371
+ * See the LICENSE file in the root directory of this source tree.
372
+ */const as=H("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
373
+ * @license lucide-react v0.294.0 - ISC
374
+ *
375
+ * This source code is licensed under the ISC license.
376
+ * See the LICENSE file in the root directory of this source tree.
377
+ */const _t=H("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
378
+ * @license lucide-react v0.294.0 - ISC
379
+ *
380
+ * This source code is licensed under the ISC license.
381
+ * See the LICENSE file in the root directory of this source tree.
382
+ */const Wl=H("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
383
+ * @license lucide-react v0.294.0 - ISC
384
+ *
385
+ * This source code is licensed under the ISC license.
386
+ * See the LICENSE file in the root directory of this source tree.
387
+ */const Qy=H("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
388
+ * @license lucide-react v0.294.0 - ISC
389
+ *
390
+ * This source code is licensed under the ISC license.
391
+ * See the LICENSE file in the root directory of this source tree.
392
+ */const Hr=H("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/**
393
+ * @license lucide-react v0.294.0 - ISC
394
+ *
395
+ * This source code is licensed under the ISC license.
396
+ * See the LICENSE file in the root directory of this source tree.
397
+ */const Zc=H("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
398
+ * @license lucide-react v0.294.0 - ISC
399
+ *
400
+ * This source code is licensed under the ISC license.
401
+ * See the LICENSE file in the root directory of this source tree.
402
+ */const Yy=H("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
403
+ * @license lucide-react v0.294.0 - ISC
404
+ *
405
+ * This source code is licensed under the ISC license.
406
+ * See the LICENSE file in the root directory of this source tree.
407
+ */const Ia=H("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
408
+ * @license lucide-react v0.294.0 - ISC
409
+ *
410
+ * This source code is licensed under the ISC license.
411
+ * See the LICENSE file in the root directory of this source tree.
412
+ */const xr=H("Shield",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}]]);/**
413
+ * @license lucide-react v0.294.0 - ISC
414
+ *
415
+ * This source code is licensed under the ISC license.
416
+ * See the LICENSE file in the root directory of this source tree.
417
+ */const Xy=H("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
418
+ * @license lucide-react v0.294.0 - ISC
419
+ *
420
+ * This source code is licensed under the ISC license.
421
+ * See the LICENSE file in the root directory of this source tree.
422
+ */const ed=H("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
423
+ * @license lucide-react v0.294.0 - ISC
424
+ *
425
+ * This source code is licensed under the ISC license.
426
+ * See the LICENSE file in the root directory of this source tree.
427
+ */const Vo=H("StopCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
428
+ * @license lucide-react v0.294.0 - ISC
429
+ *
430
+ * This source code is licensed under the ISC license.
431
+ * See the LICENSE file in the root directory of this source tree.
432
+ */const Zy=H("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/**
433
+ * @license lucide-react v0.294.0 - ISC
434
+ *
435
+ * This source code is licensed under the ISC license.
436
+ * See the LICENSE file in the root directory of this source tree.
437
+ */const e0=H("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
438
+ * @license lucide-react v0.294.0 - ISC
439
+ *
440
+ * This source code is licensed under the ISC license.
441
+ * See the LICENSE file in the root directory of this source tree.
442
+ */const ps=H("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
443
+ * @license lucide-react v0.294.0 - ISC
444
+ *
445
+ * This source code is licensed under the ISC license.
446
+ * See the LICENSE file in the root directory of this source tree.
447
+ */const t0=H("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
448
+ * @license lucide-react v0.294.0 - ISC
449
+ *
450
+ * This source code is licensed under the ISC license.
451
+ * See the LICENSE file in the root directory of this source tree.
452
+ */const s0=H("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/**
453
+ * @license lucide-react v0.294.0 - ISC
454
+ *
455
+ * This source code is licensed under the ISC license.
456
+ * See the LICENSE file in the root directory of this source tree.
457
+ */const on=H("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
458
+ * @license lucide-react v0.294.0 - ISC
459
+ *
460
+ * This source code is licensed under the ISC license.
461
+ * See the LICENSE file in the root directory of this source tree.
462
+ */const n0=H("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
463
+ * @license lucide-react v0.294.0 - ISC
464
+ *
465
+ * This source code is licensed under the ISC license.
466
+ * See the LICENSE file in the root directory of this source tree.
467
+ */const tm=H("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
468
+ * @license lucide-react v0.294.0 - ISC
469
+ *
470
+ * This source code is licensed under the ISC license.
471
+ * See the LICENSE file in the root directory of this source tree.
472
+ */const _n=H("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]);/**
473
+ * @license lucide-react v0.294.0 - ISC
474
+ *
475
+ * This source code is licensed under the ISC license.
476
+ * See the LICENSE file in the root directory of this source tree.
477
+ */const r0=H("Volume2",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]]);/**
478
+ * @license lucide-react v0.294.0 - ISC
479
+ *
480
+ * This source code is licensed under the ISC license.
481
+ * See the LICENSE file in the root directory of this source tree.
482
+ */const i0=H("VolumeX",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
483
+ * @license lucide-react v0.294.0 - ISC
484
+ *
485
+ * This source code is licensed under the ISC license.
486
+ * See the LICENSE file in the root directory of this source tree.
487
+ */const Da=H("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
488
+ * @license lucide-react v0.294.0 - ISC
489
+ *
490
+ * This source code is licensed under the ISC license.
491
+ * See the LICENSE file in the root directory of this source tree.
492
+ */const ln=H("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
493
+ * @license lucide-react v0.294.0 - ISC
494
+ *
495
+ * This source code is licensed under the ISC license.
496
+ * See the LICENSE file in the root directory of this source tree.
497
+ */const a0=H("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);/**
498
+ * @license lucide-react v0.294.0 - ISC
499
+ *
500
+ * This source code is licensed under the ISC license.
501
+ * See the LICENSE file in the root directory of this source tree.
502
+ */const o0=H("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
503
+ * @license lucide-react v0.294.0 - ISC
504
+ *
505
+ * This source code is licensed under the ISC license.
506
+ * See the LICENSE file in the root directory of this source tree.
507
+ */const l0=H("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function sm(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(s=sm(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function nm(){for(var e,t,s=0,r="",i=arguments.length;s<i;s++)(e=arguments[s])&&(t=sm(e))&&(r&&(r+=" "),r+=t);return r}const td="-",c0=e=>{const t=u0(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(td);return l[0]===""&&l.length!==1&&l.shift(),rm(l,t)||d0(o)},getConflictingClassGroupIds:(o,l)=>{const c=s[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},rm=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const s=e[0],r=t.nextPart.get(s),i=r?rm(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const a=e.join(td);return(o=t.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},lh=/^\[(.+)\]$/,d0=e=>{if(lh.test(e)){const t=lh.exec(e)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},u0=e=>{const{theme:t,prefix:s}=e,r={nextPart:new Map,validators:[]};return f0(Object.entries(e.classGroups),s).forEach(([a,o])=>{Kl(o,r,a,t)}),r},Kl=(e,t,s,r)=>{e.forEach(i=>{if(typeof i=="string"){const a=i===""?t:ch(t,i);a.classGroupId=s;return}if(typeof i=="function"){if(h0(i)){Kl(i(r),t,s,r);return}t.validators.push({validator:i,classGroupId:s});return}Object.entries(i).forEach(([a,o])=>{Kl(o,ch(t,a),s,r)})})},ch=(e,t)=>{let s=e;return t.split(td).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},h0=e=>e.isThemeGetter,f0=(e,t)=>t?e.map(([s,r])=>{const i=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,l])=>[t+o,l])):a);return[s,i]}):e,p0=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,r=new Map;const i=(a,o)=>{s.set(a,o),t++,t>e&&(t=0,r=s,s=new Map)};return{get(a){let o=s.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return i(a,o),o},set(a,o){s.has(a)?s.set(a,o):i(a,o)}}},im="!",m0=e=>{const{separator:t,experimentalParseClassName:s}=e,r=t.length===1,i=t[0],a=t.length,o=l=>{const c=[];let u=0,m=0,f;for(let j=0;j<l.length;j++){let p=l[j];if(u===0){if(p===i&&(r||l.slice(j,j+a)===t)){c.push(l.slice(m,j)),m=j+a;continue}if(p==="/"){f=j;continue}}p==="["?u++:p==="]"&&u--}const g=c.length===0?l:l.substring(m),R=g.startsWith(im),k=R?g.substring(1):g,C=f&&f>m?f-m:void 0;return{modifiers:c,hasImportantModifier:R,baseClassName:k,maybePostfixModifierPosition:C}};return s?l=>s({className:l,parseClassName:o}):o},x0=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(r=>{r[0]==="["?(t.push(...s.sort(),r),s=[]):s.push(r)}),t.push(...s.sort()),t},g0=e=>({cache:p0(e.cacheSize),parseClassName:m0(e),...c0(e)}),v0=/\s+/,y0=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(v0);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:m,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:R}=s(u);let k=!!R,C=r(k?g.substring(0,R):g);if(!C){if(!k){l=u+(l.length>0?" "+l:l);continue}if(C=r(g),!C){l=u+(l.length>0?" "+l:l);continue}k=!1}const j=x0(m).join(":"),p=f?j+im:j,h=p+C;if(a.includes(h))continue;a.push(h);const x=i(C,k);for(let w=0;w<x.length;++w){const N=x[w];a.push(p+N)}l=u+(l.length>0?" "+l:l)}return l};function j0(){let e=0,t,s,r="";for(;e<arguments.length;)(t=arguments[e++])&&(s=am(t))&&(r&&(r+=" "),r+=s);return r}const am=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=am(e[r]))&&(s&&(s+=" "),s+=t);return s};function w0(e,...t){let s,r,i,a=o;function o(c){const u=t.reduce((m,f)=>f(m),e());return s=g0(u),r=s.cache.get,i=s.cache.set,a=l,l(c)}function l(c){const u=r(c);if(u)return u;const m=y0(c,s);return i(c,m),m}return function(){return a(j0.apply(null,arguments))}}const ze=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},om=/^\[(?:([a-z-]+):)?(.+)\]$/i,N0=/^\d+\/\d+$/,k0=new Set(["px","full","screen"]),b0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,S0=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,C0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,E0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,R0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ys=e=>er(e)||k0.has(e)||N0.test(e),Ms=e=>gr(e,"length",M0),er=e=>!!e&&!Number.isNaN(Number(e)),Uo=e=>gr(e,"number",er),Er=e=>!!e&&Number.isInteger(Number(e)),_0=e=>e.endsWith("%")&&er(e.slice(0,-1)),xe=e=>om.test(e),Is=e=>b0.test(e),P0=new Set(["length","size","percentage"]),T0=e=>gr(e,P0,lm),A0=e=>gr(e,"position",lm),O0=new Set(["image","url"]),z0=e=>gr(e,O0,D0),L0=e=>gr(e,"",I0),Rr=()=>!0,gr=(e,t,s)=>{const r=om.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):s(r[2]):!1},M0=e=>S0.test(e)&&!C0.test(e),lm=()=>!1,I0=e=>E0.test(e),D0=e=>R0.test(e),F0=()=>{const e=ze("colors"),t=ze("spacing"),s=ze("blur"),r=ze("brightness"),i=ze("borderColor"),a=ze("borderRadius"),o=ze("borderSpacing"),l=ze("borderWidth"),c=ze("contrast"),u=ze("grayscale"),m=ze("hueRotate"),f=ze("invert"),g=ze("gap"),R=ze("gradientColorStops"),k=ze("gradientColorStopPositions"),C=ze("inset"),j=ze("margin"),p=ze("opacity"),h=ze("padding"),x=ze("saturate"),w=ze("scale"),N=ze("sepia"),S=ze("skew"),P=ze("space"),b=ze("translate"),O=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],v=()=>["auto",xe,t],L=()=>[xe,t],V=()=>["",ys,Ms],y=()=>["auto",er,xe],_=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",xe],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[er,xe];return{cacheSize:500,separator:":",theme:{colors:[Rr],spacing:[ys,Ms],blur:["none","",Is,xe],brightness:W(),borderColor:[e],borderRadius:["none","","full",Is,xe],borderSpacing:L(),borderWidth:V(),contrast:W(),grayscale:A(),hueRotate:W(),invert:A(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[_0,Ms],inset:v(),margin:v(),opacity:W(),padding:L(),saturate:W(),scale:W(),sepia:A(),skew:W(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",xe]}],container:["container"],columns:[{columns:[Is]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[..._(),xe]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Er,xe]}],basis:[{basis:v()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",xe]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",Er,xe]}],"grid-cols":[{"grid-cols":[Rr]}],"col-start-end":[{col:["auto",{span:["full",Er,xe]},xe]}],"col-start":[{"col-start":y()}],"col-end":[{"col-end":y()}],"grid-rows":[{"grid-rows":[Rr]}],"row-start-end":[{row:["auto",{span:[Er,xe]},xe]}],"row-start":[{"row-start":y()}],"row-end":[{"row-end":y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",xe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",xe]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...E()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...E(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...E(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[h]}],px:[{px:[h]}],py:[{py:[h]}],ps:[{ps:[h]}],pe:[{pe:[h]}],pt:[{pt:[h]}],pr:[{pr:[h]}],pb:[{pb:[h]}],pl:[{pl:[h]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",xe,t]}],"min-w":[{"min-w":[xe,t,"min","max","fit"]}],"max-w":[{"max-w":[xe,t,"none","full","min","max","fit","prose",{screen:[Is]},Is]}],h:[{h:[xe,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[xe,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[xe,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[xe,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Is,Ms]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Uo]}],"font-family":[{font:[Rr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",xe]}],"line-clamp":[{"line-clamp":["none",er,Uo]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ys,xe]}],"list-image":[{"list-image":["none",xe]}],"list-style-type":[{list:["none","disc","decimal",xe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[p]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[p]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ys,Ms]}],"underline-offset":[{"underline-offset":["auto",ys,xe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[p]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[..._(),A0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",T0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},z0]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[R]}],"gradient-via":[{via:[R]}],"gradient-to":[{to:[R]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[p]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[p]}],"divide-style":[{divide:F()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[ys,xe]}],"outline-w":[{outline:[ys,Ms]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[p]}],"ring-offset-w":[{"ring-offset":[ys,Ms]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Is,L0]}],"shadow-color":[{shadow:[Rr]}],opacity:[{opacity:[p]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Is,xe]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[p]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",xe]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",xe]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",xe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Er,xe]}],"translate-x":[{"translate-x":[b]}],"translate-y":[{"translate-y":[b]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",xe]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ys,Ms,Uo]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},$0=w0(F0);function Y(...e){return $0(nm(e))}const cm=d.createContext(void 0);function V0({children:e}){const[t,s]=d.useState([]),r=d.useCallback(a=>{const o=Math.random().toString(36).substring(2,9),l={...a,id:o};s(u=>[...u,l]);const c=a.duration??5e3;c>0&&setTimeout(()=>{s(u=>u.filter(m=>m.id!==o))},c)},[]),i=d.useCallback(a=>{s(o=>o.filter(l=>l.id!==a))},[]);return n.jsxs(cm.Provider,{value:{toasts:t,toast:r,dismiss:i},children:[e,n.jsx(U0,{toasts:t,dismiss:i})]})}function Pt(){const e=d.useContext(cm);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function U0({toasts:e,dismiss:t}){return n.jsx("div",{className:"fixed bottom-0 right-0 z-[100] flex flex-col-reverse gap-2 p-4 max-w-sm w-full",children:e.map(s=>n.jsx(B0,{toast:s,onDismiss:()=>t(s.id)},s.id))})}function B0({toast:e,onDismiss:t}){const s={default:"bg-background border-border",destructive:"bg-destructive text-destructive-foreground border-destructive",success:"bg-green-600 text-white border-green-700"},r={default:"text-muted-foreground",destructive:"text-destructive-foreground/90",success:"text-white/90"},i={default:"text-muted-foreground hover:text-foreground",destructive:"text-destructive-foreground hover:text-destructive-foreground/80",success:"text-white/70 hover:text-white"},a=e.variant||"default";return n.jsx("div",{className:Y("rounded-lg border p-4 shadow-lg transition-all",s[a]),children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"flex-1",children:[e.title&&n.jsx("div",{className:"font-semibold",children:e.title}),e.description&&n.jsx("div",{className:Y("text-sm",r[a]),children:e.description})]}),n.jsx("button",{onClick:t,className:i[a],children:"×"})]})})}const vs=Object.create(null);vs.open="0";vs.close="1";vs.ping="2";vs.pong="3";vs.message="4";vs.upgrade="5";vs.noop="6";const ia=Object.create(null);Object.keys(vs).forEach(e=>{ia[vs[e]]=e});const Hl={type:"error",data:"parser error"},dm=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",um=typeof ArrayBuffer=="function",hm=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,sd=({type:e,data:t},s,r)=>dm&&t instanceof Blob?s?r(t):dh(t,r):um&&(t instanceof ArrayBuffer||hm(t))?s?r(t):dh(new Blob([t]),r):r(vs[e]+(t||"")),dh=(e,t)=>{const s=new FileReader;return s.onload=function(){const r=s.result.split(",")[1];t("b"+(r||""))},s.readAsDataURL(e)};function uh(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Bo;function W0(e,t){if(dm&&e.data instanceof Blob)return e.data.arrayBuffer().then(uh).then(t);if(um&&(e.data instanceof ArrayBuffer||hm(e.data)))return t(uh(e.data));sd(e,!1,s=>{Bo||(Bo=new TextEncoder),t(Bo.encode(s))})}const hh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<hh.length;e++)Lr[hh.charCodeAt(e)]=e;const K0=e=>{let t=e.length*.75,s=e.length,r,i=0,a,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),m=new Uint8Array(u);for(r=0;r<s;r+=4)a=Lr[e.charCodeAt(r)],o=Lr[e.charCodeAt(r+1)],l=Lr[e.charCodeAt(r+2)],c=Lr[e.charCodeAt(r+3)],m[i++]=a<<2|o>>4,m[i++]=(o&15)<<4|l>>2,m[i++]=(l&3)<<6|c&63;return u},H0=typeof ArrayBuffer=="function",nd=(e,t)=>{if(typeof e!="string")return{type:"message",data:fm(e,t)};const s=e.charAt(0);return s==="b"?{type:"message",data:J0(e.substring(1),t)}:ia[s]?e.length>1?{type:ia[s],data:e.substring(1)}:{type:ia[s]}:Hl},J0=(e,t)=>{if(H0){const s=K0(e);return fm(s,t)}else return{base64:!0,data:e}},fm=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},pm="",q0=(e,t)=>{const s=e.length,r=new Array(s);let i=0;e.forEach((a,o)=>{sd(a,!1,l=>{r[o]=l,++i===s&&t(r.join(pm))})})},G0=(e,t)=>{const s=e.split(pm),r=[];for(let i=0;i<s.length;i++){const a=nd(s[i],t);if(r.push(a),a.type==="error")break}return r};function Q0(){return new TransformStream({transform(e,t){W0(e,s=>{const r=s.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(s)})}})}let Wo;function Vi(e){return e.reduce((t,s)=>t+s.length,0)}function Ui(e,t){if(e[0].length===t)return e.shift();const s=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)s[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),s}function Y0(e,t){Wo||(Wo=new TextDecoder);const s=[];let r=0,i=-1,a=!1;return new TransformStream({transform(o,l){for(s.push(o);;){if(r===0){if(Vi(s)<1)break;const c=Ui(s,1);a=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Vi(s)<2)break;const c=Ui(s,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Vi(s)<8)break;const c=Ui(s,8),u=new DataView(c.buffer,c.byteOffset,c.length),m=u.getUint32(0);if(m>Math.pow(2,21)-1){l.enqueue(Hl);break}i=m*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Vi(s)<i)break;const c=Ui(s,i);l.enqueue(nd(a?c:Wo.decode(c),t)),r=0}if(i===0||i>e){l.enqueue(Hl);break}}}})}const mm=4;function He(e){if(e)return X0(e)}function X0(e){for(var t in He.prototype)e[t]=He.prototype[t];return e}He.prototype.on=He.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};He.prototype.once=function(e,t){function s(){this.off(e,s),t.apply(this,arguments)}return s.fn=t,this.on(e,s),this};He.prototype.off=He.prototype.removeListener=He.prototype.removeAllListeners=He.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+e];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<s.length;i++)if(r=s[i],r===t||r.fn===t){s.splice(i,1);break}return s.length===0&&delete this._callbacks["$"+e],this};He.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(s){s=s.slice(0);for(var r=0,i=s.length;r<i;++r)s[r].apply(this,t)}return this};He.prototype.emitReserved=He.prototype.emit;He.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};He.prototype.hasListeners=function(e){return!!this.listeners(e).length};const oo=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),Wt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Z0="arraybuffer";function xm(e,...t){return t.reduce((s,r)=>(e.hasOwnProperty(r)&&(s[r]=e[r]),s),{})}const ej=Wt.setTimeout,tj=Wt.clearTimeout;function lo(e,t){t.useNativeTimers?(e.setTimeoutFn=ej.bind(Wt),e.clearTimeoutFn=tj.bind(Wt)):(e.setTimeoutFn=Wt.setTimeout.bind(Wt),e.clearTimeoutFn=Wt.clearTimeout.bind(Wt))}const sj=1.33;function nj(e){return typeof e=="string"?rj(e):Math.ceil((e.byteLength||e.size)*sj)}function rj(e){let t=0,s=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(r++,s+=4);return s}function gm(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function ij(e){let t="";for(let s in e)e.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(e[s]));return t}function aj(e){let t={},s=e.split("&");for(let r=0,i=s.length;r<i;r++){let a=s[r].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class oj extends Error{constructor(t,s,r){super(t),this.description=s,this.context=r,this.type="TransportError"}}class rd extends He{constructor(t){super(),this.writable=!1,lo(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,r){return super.emitReserved("error",new oj(t,s,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=nd(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=ij(t);return s.length?"?"+s:""}}class lj extends rd{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||s()})),this.writable||(r++,this.once("drain",function(){--r||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};G0(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,q0(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=gm()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let vm=!1;try{vm=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const cj=vm;function dj(){}class uj extends lj{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let r=location.port;r||(r=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,s){const r=this.request({method:"POST",data:t});r.on("success",s),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,r)=>{this.onError("xhr poll error",s,r)}),this.pollXhr=t}}class gs extends He{constructor(t,s,r){super(),this.createRequest=t,lo(this,r),this._opts=r,this._method=r.method||"GET",this._uri=s,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const s=xm(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(s);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=gs.requestsCount++,gs.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=dj,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete gs.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}gs.requestsCount=0;gs.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",fh);else if(typeof addEventListener=="function"){const e="onpagehide"in Wt?"pagehide":"unload";addEventListener(e,fh,!1)}}function fh(){for(let e in gs.requests)gs.requests.hasOwnProperty(e)&&gs.requests[e].abort()}const hj=function(){const e=ym({xdomain:!1});return e&&e.responseType!==null}();class fj extends uj{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=hj&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new gs(ym,this.uri(),t)}}function ym(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||cj))return new XMLHttpRequest}catch{}if(!t)try{return new Wt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const jm=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class pj extends rd{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,r=jm?{}:xm(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const r=t[s],i=s===t.length-1;sd(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}i&&oo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=gm()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Ko=Wt.WebSocket||Wt.MozWebSocket;class mj extends pj{createSocket(t,s,r){return jm?new Ko(t,s,r):s?new Ko(t,s):new Ko(t)}doWrite(t,s){this.ws.send(s)}}class xj extends rd{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=Y0(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(s).getReader(),i=Q0();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const a=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),a())}).catch(l=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const r=t[s],i=s===t.length-1;this._writer.write(r).then(()=>{i&&oo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const gj={websocket:mj,webtransport:xj,polling:fj},vj=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yj=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Jl(e){if(e.length>8e3)throw"URI too long";const t=e,s=e.indexOf("["),r=e.indexOf("]");s!=-1&&r!=-1&&(e=e.substring(0,s)+e.substring(s,r).replace(/:/g,";")+e.substring(r,e.length));let i=vj.exec(e||""),a={},o=14;for(;o--;)a[yj[o]]=i[o]||"";return s!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=jj(a,a.path),a.queryKey=wj(a,a.query),a}function jj(e,t){const s=/\/{2,9}/g,r=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function wj(e,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(s[i]=a)}),s}const ql=typeof addEventListener=="function"&&typeof removeEventListener=="function",aa=[];ql&&addEventListener("offline",()=>{aa.forEach(e=>e())},!1);class en extends He{constructor(t,s){if(super(),this.binaryType=Z0,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const r=Jl(t);s.hostname=r.host,s.secure=r.protocol==="https"||r.protocol==="wss",s.port=r.port,r.query&&(s.query=r.query)}else s.host&&(s.hostname=Jl(s.host).host);lo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=aj(this.opts.query)),ql&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},aa.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=mm,s.transport=t,this.id&&(s.sid=this.id);const r=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&en.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",en.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(s+=nj(i)),r>0&&s>this._maxPayload)return this.writeBuffer.slice(0,r);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,oo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,r){return this._sendPacket("message",t,s,r),this}send(t,s,r){return this._sendPacket("message",t,s,r),this}_sendPacket(t,s,r,i){if(typeof s=="function"&&(i=s,s=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:s,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},r=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(en.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ql&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=aa.indexOf(this._offlineEventListener);r!==-1&&aa.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}en.protocol=mm;class Nj extends en{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),r=!1;en.priorWebsocketSuccess=!1;const i=()=>{r||(s.send([{type:"ping",data:"probe"}]),s.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;en.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(m(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=s.name,this.emitReserved("upgradeError",g)}}))};function a(){r||(r=!0,m(),s.close(),s=null)}const o=f=>{const g=new Error("probe error: "+f);g.transport=s.name,a(),this.emitReserved("upgradeError",g)};function l(){o("transport closed")}function c(){o("socket closed")}function u(f){s&&f.name!==s.name&&a()}const m=()=>{s.removeListener("open",i),s.removeListener("error",o),s.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};s.once("open",i),s.once("error",o),s.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&s.push(t[r]);return s}}let kj=class extends Nj{constructor(t,s={}){const r=typeof t=="object"?t:s;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>gj[i]).filter(i=>!!i)),super(t,r)}};function bj(e,t="",s){let r=e;s=s||typeof location<"u"&&location,e==null&&(e=s.protocol+"//"+s.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=s.protocol+e:e=s.host+e),/^(https?|wss?):\/\//.test(e)||(typeof s<"u"?e=s.protocol+"//"+e:e="https://"+e),r=Jl(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(s&&s.port===r.port?"":":"+r.port),r}const Sj=typeof ArrayBuffer=="function",Cj=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,wm=Object.prototype.toString,Ej=typeof Blob=="function"||typeof Blob<"u"&&wm.call(Blob)==="[object BlobConstructor]",Rj=typeof File=="function"||typeof File<"u"&&wm.call(File)==="[object FileConstructor]";function id(e){return Sj&&(e instanceof ArrayBuffer||Cj(e))||Ej&&e instanceof Blob||Rj&&e instanceof File}function oa(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let s=0,r=e.length;s<r;s++)if(oa(e[s]))return!0;return!1}if(id(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return oa(e.toJSON(),!0);for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&oa(e[s]))return!0;return!1}function _j(e){const t=[],s=e.data,r=e;return r.data=Gl(s,t),r.attachments=t.length,{packet:r,buffers:t}}function Gl(e,t){if(!e)return e;if(id(e)){const s={_placeholder:!0,num:t.length};return t.push(e),s}else if(Array.isArray(e)){const s=new Array(e.length);for(let r=0;r<e.length;r++)s[r]=Gl(e[r],t);return s}else if(typeof e=="object"&&!(e instanceof Date)){const s={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=Gl(e[r],t));return s}return e}function Pj(e,t){return e.data=Ql(e.data,t),delete e.attachments,e}function Ql(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let s=0;s<e.length;s++)e[s]=Ql(e[s],t);else if(typeof e=="object")for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(e[s]=Ql(e[s],t));return e}const Tj=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Aj=5;var Ne;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ne||(Ne={}));class Oj{constructor(t){this.replacer=t}encode(t){return(t.type===Ne.EVENT||t.type===Ne.ACK)&&oa(t)?this.encodeAsBinary({type:t.type===Ne.EVENT?Ne.BINARY_EVENT:Ne.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Ne.BINARY_EVENT||t.type===Ne.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=_j(t),r=this.encodeAsString(s.packet),i=s.buffers;return i.unshift(r),i}}function ph(e){return Object.prototype.toString.call(e)==="[object Object]"}class ad extends He{constructor(t){super(),this.reviver=t}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const r=s.type===Ne.BINARY_EVENT;r||s.type===Ne.BINARY_ACK?(s.type=r?Ne.EVENT:Ne.ACK,this.reconstructor=new zj(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(id(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const r={type:Number(t.charAt(0))};if(Ne[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Ne.BINARY_EVENT||r.type===Ne.BINARY_ACK){const a=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const o=t.substring(a,s);if(o!=Number(o)||t.charAt(s)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(t.charAt(s+1)==="/"){const a=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););r.nsp=t.substring(a,s)}else r.nsp="/";const i=t.charAt(s+1);if(i!==""&&Number(i)==i){const a=s+1;for(;++s;){const o=t.charAt(s);if(o==null||Number(o)!=o){--s;break}if(s===t.length)break}r.id=Number(t.substring(a,s+1))}if(t.charAt(++s)){const a=this.tryParse(t.substr(s));if(ad.isPayloadValid(r.type,a))r.data=a;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Ne.CONNECT:return ph(s);case Ne.DISCONNECT:return s===void 0;case Ne.CONNECT_ERROR:return typeof s=="string"||ph(s);case Ne.EVENT:case Ne.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Tj.indexOf(s[0])===-1);case Ne.ACK:case Ne.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class zj{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=Pj(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Lj=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ad,Encoder:Oj,get PacketType(){return Ne},protocol:Aj},Symbol.toStringTag,{value:"Module"}));function ts(e,t,s){return e.on(t,s),function(){e.off(t,s)}}const Mj=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Nm extends He{constructor(t,s,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[ts(t,"open",this.onopen.bind(this)),ts(t,"packet",this.onpacket.bind(this)),ts(t,"error",this.onerror.bind(this)),ts(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var r,i,a;if(Mj.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const o={type:Ne.EVENT,data:s};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const m=this.ids++,f=s.pop();this._registerAckCallback(m,f),o.id=m}const l=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,s){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=s;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);s.call(this,new Error("operation has timed out"))},i),o=(...l)=>{this.io.clearTimeoutFn(a),s.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...s){return new Promise((r,i)=>{const a=(o,l)=>o?i(o):r(l);a.withError=!0,s.push(a),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(i)):(this._queue.shift(),s&&s(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ne.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ne.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ne.EVENT:case Ne.BINARY_EVENT:this.onevent(t);break;case Ne.ACK:case Ne.BINARY_ACK:this.onack(t);break;case Ne.DISCONNECT:this.ondisconnect();break;case Ne.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const r of s)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let r=!1;return function(...i){r||(r=!0,s.packet({type:Ne.ACK,id:t,data:i}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ne.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let r=0;r<s.length;r++)if(t===s[r])return s.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let r=0;r<s.length;r++)if(t===s[r])return s.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const r of s)r.apply(this,t.data)}}}function vr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}vr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+s:e-s}return Math.min(e,this.max)|0};vr.prototype.reset=function(){this.attempts=0};vr.prototype.setMin=function(e){this.ms=e};vr.prototype.setMax=function(e){this.max=e};vr.prototype.setJitter=function(e){this.jitter=e};class Yl extends He{constructor(t,s){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,lo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((r=s.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new vr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const i=s.parser||Lj;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new kj(this.uri,this.opts);const s=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=ts(s,"open",function(){r.onopen(),t&&t()}),a=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=ts(s,"error",a);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),s.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(ts(t,"ping",this.onping.bind(this)),ts(t,"data",this.ondata.bind(this)),ts(t,"error",this.onerror.bind(this)),ts(t,"close",this.onclose.bind(this)),ts(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){oo(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new Nm(this,t,s),this.nsps[t]=r),r}_destroy(t){const s=Object.keys(this.nsps);for(const r of s)if(this.nsps[r].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let r=0;r<s.length;r++)this.engine.write(s[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},s);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const _r={};function la(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const s=bj(e,t.path||"/socket.io"),r=s.source,i=s.id,a=s.path,o=_r[i]&&a in _r[i].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new Yl(r,t):(_r[i]||(_r[i]=new Yl(r,t)),c=_r[i]),s.query&&!t.query&&(t.query=s.queryKey),c.socket(s.path,t)}Object.assign(la,{Manager:Yl,Socket:Nm,io:la,connect:la});const km=d.createContext(void 0);function Ij({children:e}){const[,t]=d.useState(null),[s,r]=d.useState(!1),[i,a]=d.useState({active:!1}),[o,l]=d.useState([]),[c,u]=d.useState(null),[m,f]=d.useState(null),[g,R]=d.useState([]);d.useEffect(()=>{const N=la(window.location.origin,{transports:["websocket","polling"]});return N.on("connect",()=>{r(!0),console.log("[Recorder] Connected to server")}),N.on("disconnect",()=>{r(!1),console.log("[Recorder] Disconnected from server")}),N.on("recorder:status",S=>{console.log("STATUS UPDATE:",S),a(S)}),N.on("recorder:action",S=>{console.log("ACTION RECEIVED:",S),l(P=>[...P,S.step])}),N.on("recorder:steps",S=>{l(S.steps)}),N.on("recorder:event",S=>{switch(console.log("[Recorder] Event:",S),S.type){case"session_started":k();break;case"session_stopped":k(),C();break;case"capture_started":case"capture_completed":case"capture_error":k(),C();break}}),N.on("recorder:diagnostic",S=>{const P={level:S.level,message:S.message,timestamp:new Date().toISOString()};R(b=>[...b,P].slice(-50)),S.level==="error"&&f(S.message)}),t(N),fetch("/api/recorder/status").then(S=>S.json()).then(S=>S.ok&&a(S.status)),fetch("/api/recorder/steps").then(S=>S.json()).then(S=>S.ok&&l(S.steps)),()=>{N.close()}},[]);const k=d.useCallback(async()=>{try{const N=await fetch("/api/recorder/status");if(N.ok){const S=await N.json();a(S.status||{active:!1})}}catch(N){console.error("[Recorder] Failed to refresh status:",N)}},[]),C=d.useCallback(async()=>{try{const N=await fetch("/api/recorder/steps");if(N.ok){const S=await N.json();l(S.steps||[])}}catch(N){console.error("[Recorder] Failed to refresh steps:",N)}},[]),j=d.useCallback(async N=>{l([]);try{f(null);const S=await fetch("/api/recorder/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)});if(!S.ok){const O=(await S.json()).error||"Failed to start recording";throw f(O),new Error(O)}a(b=>({...b,active:!0,visualKey:N.visualKey||b.visualKey}));const P=await fetch("/api/recorder/status");if(P.ok){const b=await P.json();a(b.status||{active:!1})}}catch(S){throw console.error("[Recorder] Failed to start:",S),f(S.message||"Failed to start recording"),S}},[]),p=d.useCallback(async(N=!0)=>{try{f(null);const S=await fetch("/api/recorder/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({save:N})});if(!S.ok){const D=(await S.json()).error||"Failed to stop recording";throw f(D),new Error(D)}const[P,b]=await Promise.all([fetch("/api/recorder/status"),fetch("/api/recorder/steps")]);if(P.ok){const O=await P.json();a(O.status||{active:!1})}if(b.ok){const O=await b.json();l(O.steps||[])}u(null)}catch(S){throw console.error("[Recorder] Failed to stop:",S),f(S.message||"Failed to stop recording"),S}},[]),h=d.useCallback(async(N={})=>{try{const S=await fetch("/api/recorder/capture",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)});if(!S.ok){const O=await S.json();throw new Error(O.error||"Failed to capture")}const[P,b]=await Promise.all([fetch("/api/recorder/status"),fetch("/api/recorder/steps")]);if(P.ok){const O=await P.json();a(O.status||{active:!1})}if(b.ok){const O=await b.json();l(O.steps||[])}}catch(S){throw console.error("[Recorder] Failed to capture:",S),S}},[]),x=d.useCallback(async N=>{try{const S=await fetch(`/api/recorder/steps/${N}`,{method:"DELETE"});if(!S.ok){const P=await S.json();throw new Error(P.error||"Failed to remove step")}l(P=>P.filter((b,O)=>O!==N))}catch(S){throw console.error("[Recorder] Failed to remove step:",S),S}},[]),w=d.useMemo(()=>({status:i,steps:o,isConnected:s,lastEvent:c,error:m,diagnostics:g,start:j,stop:p,capture:h,removeStep:x,refreshStatus:k,refreshSteps:C}),[i,o,s,c,m,g,j,p,h,x,k,C]);return n.jsx(km.Provider,{value:w,children:e})}function bm(){const e=d.useContext(km);if(e===void 0)throw new Error("useRecorder must be used within a RecorderProvider");return e}const he=d.forwardRef(({className:e,...t},s)=>n.jsx("div",{ref:s,className:Y("rounded-lg border border-border/40 bg-card/50 text-card-foreground backdrop-blur-sm",e),...t}));he.displayName="Card";const ke=d.forwardRef(({className:e,...t},s)=>n.jsx("div",{ref:s,className:Y("flex flex-col space-y-1 p-4",e),...t}));ke.displayName="CardHeader";const be=d.forwardRef(({className:e,...t},s)=>n.jsx("h3",{ref:s,className:Y("text-sm font-medium leading-none tracking-tight",e),...t}));be.displayName="CardTitle";const at=d.forwardRef(({className:e,...t},s)=>n.jsx("p",{ref:s,className:Y("text-[13px] text-muted-foreground",e),...t}));at.displayName="CardDescription";const me=d.forwardRef(({className:e,...t},s)=>n.jsx("div",{ref:s,className:Y("p-4 pt-0",e),...t}));me.displayName="CardContent";const Dj=d.forwardRef(({className:e,...t},s)=>n.jsx("div",{ref:s,className:Y("flex items-center p-4 pt-0",e),...t}));Dj.displayName="CardFooter";const mh=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,xh=nm,Sm=(e,t)=>s=>{var r;if((t==null?void 0:t.variants)==null)return xh(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:i,defaultVariants:a}=t,o=Object.keys(i).map(u=>{const m=s==null?void 0:s[u],f=a==null?void 0:a[u];if(m===null)return null;const g=mh(m)||mh(f);return i[u][g]}),l=s&&Object.entries(s).reduce((u,m)=>{let[f,g]=m;return g===void 0||(u[f]=g),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,m)=>{let{class:f,className:g,...R}=m;return Object.entries(R).every(k=>{let[C,j]=k;return Array.isArray(j)?j.includes({...a,...l}[C]):{...a,...l}[C]===j})?[...u,f,g]:u},[]);return xh(e,o,c,s==null?void 0:s.class,s==null?void 0:s.className)},Fj=Sm("inline-flex items-center rounded-md border px-1.5 py-0.5 text-[11px] font-medium transition-colors focus:outline-none",{variants:{variant:{default:"border-transparent bg-primary/20 text-primary",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive/20 text-destructive",success:"border-transparent bg-success/20 text-success",approved:"border-transparent bg-green-500/20 text-green-600 dark:text-green-400",pending:"border-transparent bg-amber-500/20 text-amber-600 dark:text-amber-400",warning:"border-transparent bg-warning/20 text-warning",info:"border-transparent bg-blue-500/20 text-blue-600 dark:text-blue-400",outline:"border-border/60 text-muted-foreground bg-transparent",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function ue({className:e,variant:t,...s}){return n.jsx("div",{className:Y(Fj({variant:t}),e),...s})}const $j=Sm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-[13px] font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 shadow-[0_1px_2px_rgba(0,0,0,0.3),inset_0_1px_0_rgba(255,255,255,0.1)]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-border bg-transparent hover:bg-accent hover:text-accent-foreground hover:border-border/80",secondary:"bg-secondary/80 text-secondary-foreground hover:bg-secondary",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",success:"bg-success text-success-foreground hover:bg-success/90 shadow-[0_1px_2px_rgba(0,0,0,0.3),inset_0_1px_0_rgba(255,255,255,0.1)]"},size:{default:"h-8 px-3 py-1.5",sm:"h-7 rounded-md px-2.5 text-xs",lg:"h-9 rounded-md px-4",icon:"h-8 w-8","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),T=d.forwardRef(({className:e,variant:t,size:s,...r},i)=>n.jsx("button",{className:Y($j({variant:t,size:s,className:e})),ref:i,...r}));T.displayName="Button";const Fa=d.forwardRef(({className:e,value:t=0,...s},r)=>n.jsx("div",{ref:r,className:`relative h-2 w-full overflow-hidden rounded-full bg-gray-700 ${e||""}`,...s,children:n.jsx("div",{className:"h-full bg-blue-500 transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,t))}%`}})}));Fa.displayName="Progress";const Cm=d.createContext(void 0);function st({open:e,onOpenChange:t,children:s}){return d.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?n.jsx(Cm.Provider,{value:{open:e,onOpenChange:t},children:n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[n.jsx("div",{className:"fixed inset-0 bg-black/50",onClick:()=>t(!1)}),n.jsx("div",{className:"relative z-50",children:s})]})}):null}function nt({className:e,children:t,...s}){if(!d.useContext(Cm))throw new Error("DialogContent must be used within Dialog");return n.jsx("div",{...s,className:Y("bg-card/95 backdrop-blur-xl border border-border/50 rounded-xl shadow-2xl p-6 w-full max-w-lg max-h-[90vh] overflow-auto",e),children:t})}function Xe({className:e,...t}){return n.jsx("div",{...t,className:Y("flex flex-col space-y-1.5 mb-4",e)})}function Ze({className:e,...t}){return n.jsx("h2",{...t,className:Y("text-[15px] font-semibold leading-none tracking-tight",e)})}function ot({className:e,...t}){return n.jsx("p",{...t,className:Y("text-[13px] text-muted-foreground mt-1",e)})}function lt({className:e,...t}){return n.jsx("div",{...t,className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-4",e)})}function gh(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Em(...e){return t=>{let s=!1;const r=e.map(i=>{const a=gh(i,t);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():gh(e[i],null)}}}}function od(...e){return d.useCallback(Em(...e),e)}function Vj(e,t=[]){let s=[];function r(a,o){const l=d.createContext(o),c=s.length;s=[...s,o];const u=f=>{var p;const{scope:g,children:R,...k}=f,C=((p=g==null?void 0:g[e])==null?void 0:p[c])||l,j=d.useMemo(()=>k,Object.values(k));return n.jsx(C.Provider,{value:j,children:R})};u.displayName=a+"Provider";function m(f,g){var C;const R=((C=g==null?void 0:g[e])==null?void 0:C[c])||l,k=d.useContext(R);if(k)return k;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,m]}const i=()=>{const a=s.map(o=>d.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,Uj(i,...t)]}function Uj(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return s.scopeName=t.scopeName,s}function vh(e,t,{checkForDefaultPrevented:s=!0}={}){return function(i){if(e==null||e(i),s===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}var $a=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{},Bj=zh[" useInsertionEffect ".trim().toString()]||$a;function Wj({prop:e,defaultProp:t,onChange:s=()=>{},caller:r}){const[i,a,o]=Kj({defaultProp:t,onChange:s}),l=e!==void 0,c=l?e:i;{const m=d.useRef(e!==void 0);d.useEffect(()=>{const f=m.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=l},[l,r])}const u=d.useCallback(m=>{var f;if(l){const g=Hj(m)?m(e):m;g!==e&&((f=o.current)==null||f.call(o,g))}else a(m)},[l,e,a,o]);return[c,u]}function Kj({defaultProp:e,onChange:t}){const[s,r]=d.useState(e),i=d.useRef(s),a=d.useRef(t);return Bj(()=>{a.current=t},[t]),d.useEffect(()=>{var o;i.current!==s&&((o=a.current)==null||o.call(a,s),i.current=s)},[s,i]),[s,r,a]}function Hj(e){return typeof e=="function"}function Jj(e){const t=d.useRef({value:e,previous:e});return d.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function qj(e){const[t,s]=d.useState(void 0);return $a(()=>{if(e){s({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let o,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;s({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else s(void 0)},[e]),t}function Gj(e,t){return d.useReducer((s,r)=>t[s][r]??s,e)}var Rm=e=>{const{present:t,children:s}=e,r=Qj(t),i=typeof s=="function"?s({present:r.isPresent}):d.Children.only(s),a=od(r.ref,Yj(i));return typeof s=="function"||r.isPresent?d.cloneElement(i,{ref:a}):null};Rm.displayName="Presence";function Qj(e){const[t,s]=d.useState(),r=d.useRef(null),i=d.useRef(e),a=d.useRef("none"),o=e?"mounted":"unmounted",[l,c]=Gj(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const u=Bi(r.current);a.current=l==="mounted"?u:"none"},[l]),$a(()=>{const u=r.current,m=i.current;if(m!==e){const g=a.current,R=Bi(u);e?c("MOUNT"):R==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(m&&g!==R?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),$a(()=>{if(t){let u;const m=t.ownerDocument.defaultView??window,f=R=>{const C=Bi(r.current).includes(CSS.escape(R.animationName));if(R.target===t&&C&&(c("ANIMATION_END"),!i.current)){const j=t.style.animationFillMode;t.style.animationFillMode="forwards",u=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=j)})}},g=R=>{R.target===t&&(a.current=Bi(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{m.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(u=>{r.current=u?getComputedStyle(u):null,s(u)},[])}}function Bi(e){return(e==null?void 0:e.animationName)||"none"}function Yj(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}function Xj(e){const t=Zj(e),s=d.forwardRef((r,i)=>{const{children:a,...o}=r,l=d.Children.toArray(a),c=l.find(t1);if(c){const u=c.props.children,m=l.map(f=>f===c?d.Children.count(u)>1?d.Children.only(null):d.isValidElement(u)?u.props.children:null:f);return n.jsx(t,{...o,ref:i,children:d.isValidElement(u)?d.cloneElement(u,void 0,m):null})}return n.jsx(t,{...o,ref:i,children:a})});return s.displayName=`${e}.Slot`,s}function Zj(e){const t=d.forwardRef((s,r)=>{const{children:i,...a}=s;if(d.isValidElement(i)){const o=n1(i),l=s1(a,i.props);return i.type!==d.Fragment&&(l.ref=r?Em(r,o):o),d.cloneElement(i,l)}return d.Children.count(i)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var e1=Symbol("radix.slottable");function t1(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===e1}function s1(e,t){const s={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?s[r]=(...l)=>{const c=a(...l);return i(...l),c}:i&&(s[r]=i):r==="style"?s[r]={...i,...a}:r==="className"&&(s[r]=[i,a].filter(Boolean).join(" "))}return{...e,...s}}function n1(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var r1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ld=r1.reduce((e,t)=>{const s=Xj(`Primitive.${t}`),r=d.forwardRef((i,a)=>{const{asChild:o,...l}=i,c=o?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),co="Checkbox",[i1]=Vj(co),[a1,cd]=i1(co);function o1(e){const{__scopeCheckbox:t,checked:s,children:r,defaultChecked:i,disabled:a,form:o,name:l,onCheckedChange:c,required:u,value:m="on",internal_do_not_use_render:f}=e,[g,R]=Wj({prop:s,defaultProp:i??!1,onChange:c,caller:co}),[k,C]=d.useState(null),[j,p]=d.useState(null),h=d.useRef(!1),x=k?!!o||!!k.closest("form"):!0,w={checked:g,disabled:a,setChecked:R,control:k,setControl:C,name:l,form:o,value:m,hasConsumerStoppedPropagationRef:h,required:u,defaultChecked:tn(i)?!1:i,isFormControl:x,bubbleInput:j,setBubbleInput:p};return n.jsx(a1,{scope:t,...w,children:l1(f)?f(w):r})}var _m="CheckboxTrigger",Pm=d.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:s,...r},i)=>{const{control:a,value:o,disabled:l,checked:c,required:u,setControl:m,setChecked:f,hasConsumerStoppedPropagationRef:g,isFormControl:R,bubbleInput:k}=cd(_m,e),C=od(i,m),j=d.useRef(c);return d.useEffect(()=>{const p=a==null?void 0:a.form;if(p){const h=()=>f(j.current);return p.addEventListener("reset",h),()=>p.removeEventListener("reset",h)}},[a,f]),n.jsx(ld.button,{type:"button",role:"checkbox","aria-checked":tn(c)?"mixed":c,"aria-required":u,"data-state":Lm(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:C,onKeyDown:vh(t,p=>{p.key==="Enter"&&p.preventDefault()}),onClick:vh(s,p=>{f(h=>tn(h)?!0:!h),k&&R&&(g.current=p.isPropagationStopped(),g.current||p.stopPropagation())})})});Pm.displayName=_m;var dd=d.forwardRef((e,t)=>{const{__scopeCheckbox:s,name:r,checked:i,defaultChecked:a,required:o,disabled:l,value:c,onCheckedChange:u,form:m,...f}=e;return n.jsx(o1,{__scopeCheckbox:s,checked:i,defaultChecked:a,disabled:l,required:o,onCheckedChange:u,name:r,form:m,value:c,internal_do_not_use_render:({isFormControl:g})=>n.jsxs(n.Fragment,{children:[n.jsx(Pm,{...f,ref:t,__scopeCheckbox:s}),g&&n.jsx(zm,{__scopeCheckbox:s})]})})});dd.displayName=co;var Tm="CheckboxIndicator",Am=d.forwardRef((e,t)=>{const{__scopeCheckbox:s,forceMount:r,...i}=e,a=cd(Tm,s);return n.jsx(Rm,{present:r||tn(a.checked)||a.checked===!0,children:n.jsx(ld.span,{"data-state":Lm(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Am.displayName=Tm;var Om="CheckboxBubbleInput",zm=d.forwardRef(({__scopeCheckbox:e,...t},s)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:l,disabled:c,name:u,value:m,form:f,bubbleInput:g,setBubbleInput:R}=cd(Om,e),k=od(s,R),C=Jj(a),j=qj(r);d.useEffect(()=>{const h=g;if(!h)return;const x=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(x,"checked").set,S=!i.current;if(C!==a&&N){const P=new Event("click",{bubbles:S});h.indeterminate=tn(a),N.call(h,tn(a)?!1:a),h.dispatchEvent(P)}},[g,C,a,i]);const p=d.useRef(tn(a)?!1:a);return n.jsx(ld.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??p.current,required:l,disabled:c,name:u,value:m,form:f,...t,tabIndex:-1,ref:k,style:{...t.style,...j,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});zm.displayName=Om;function l1(e){return typeof e=="function"}function tn(e){return e==="indeterminate"}function Lm(e){return tn(e)?"indeterminate":e?"checked":"unchecked"}const ns=d.forwardRef(({className:e,indeterminate:t,...s},r)=>n.jsx(dd,{ref:r,className:Y("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t&&"bg-primary text-primary-foreground",e),...s,children:n.jsx(Am,{className:Y("flex items-center justify-center text-current"),children:t?n.jsx(Zp,{className:"h-3 w-3"}):n.jsx(ro,{className:"h-3 w-3"})})}));ns.displayName=dd.displayName;const uo=d.forwardRef(({className:e,...t},s)=>n.jsx("textarea",{className:Y("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...t}));uo.displayName="Textarea";function ho({open:e,onOpenChange:t,scenarioKeys:s,onConfirm:r}){const[i,a]=d.useState([]),[o,l]=d.useState(!0),[c,u]=d.useState(!1),[m,f]=d.useState(""),[g,R]=d.useState(new Set),[k,C]=d.useState({}),j=d.useMemo(()=>JSON.stringify(s||[]),[s]);d.useEffect(()=>{if(!e)return;(async()=>{l(!0);try{const $=(await(await fetch("/api/output?latestJobOnly=true")).json()).groups||[],A=(s?$.filter(J=>s.includes(J.scenarioKey)):$).map(J=>({scenarioKey:J.scenarioKey,variationSlug:J.variationSlug,assets:J.assets||[]}));a(A);const z={};for(const J of A){const G=`${J.scenarioKey}::${J.variationSlug}`;z[G]=!0}C(z),R(new Set);const W=[...new Set(A.map(J=>J.scenarioKey))];W.length===1?f(`Update ${W[0]} visuals`):W.length>1?f(`Update ${W.length} scenarios`):f(""),l(!1)}catch(_){console.error("Failed to load assets:",_),l(!1)}})()},[e,j]);const p=y=>y<1024?`${y} B`:y<1024*1024?`${(y/1024).toFixed(1)} KB`:`${(y/(1024*1024)).toFixed(1)} MB`,h=y=>{const _=i.filter($=>$.scenarioKey===y),F=_.every($=>k[`${$.scenarioKey}::${$.variationSlug}`]);C($=>{const E={...$};for(const A of _)E[`${A.scenarioKey}::${A.variationSlug}`]=!F;return E})},x=y=>{const _=`${y.scenarioKey}::${y.variationSlug}`;C(F=>({...F,[_]:!F[_]}))},w=()=>{C(y=>{const _={...y};for(const F of Object.keys(_))_[F]=!0;return _})},N=()=>{C(y=>{const _={...y};for(const F of Object.keys(_))_[F]=!1;return _})},S=y=>{R(_=>{const F=new Set(_);return F.has(y)?F.delete(y):F.add(y),F})},P=Object.values(k).filter(Boolean).length,b=i.length,O=d.useMemo(()=>{let y=0;for(const _ of i){const F=`${_.scenarioKey}::${_.variationSlug}`;k[F]&&(y+=_.assets.length)}return y},[i,k]),D=d.useMemo(()=>{let y=0;for(const _ of i){const F=`${_.scenarioKey}::${_.variationSlug}`;if(k[F])for(const $ of _.assets)y+=$.size}return y},[i,k]),v=async()=>{u(!0);try{const y=i.filter(_=>{const F=`${_.scenarioKey}::${_.variationSlug}`;return k[F]});await r(y,m.trim()||void 0)}finally{u(!1)}},L=y=>{const _=i.filter($=>$.scenarioKey===y),F=_.filter($=>k[`${$.scenarioKey}::${$.variationSlug}`]).length;return F===0?"none":F===_.length?"all":"some"},V=d.useMemo(()=>{const y=new Map;for(const _ of i){const F=y.get(_.scenarioKey)||[];F.push(_),y.set(_.scenarioKey,F)}return y},[i]);return n.jsx(st,{open:e,onOpenChange:t,children:n.jsxs(nt,{className:"max-w-3xl max-h-[85vh] overflow-y-auto",children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Publish Preview"}),n.jsx(ot,{children:"Select which scenarios to publish to the platform"})]}),o?n.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Loading assets..."}):b===0?n.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[n.jsx("p",{children:"No assets found to publish."}),n.jsx("p",{className:"text-sm mt-2",children:"Run `reshot run` to generate assets first."})]}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs(he,{children:[n.jsxs(ke,{className:"pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Fy,{className:"h-4 w-4 text-muted-foreground"}),n.jsx(be,{className:"text-sm",children:"Commit Message"})]}),n.jsx(at,{className:"text-xs",children:"Describe what changed in this publish for version tracking."})]}),n.jsx(me,{children:n.jsxs("div",{className:"space-y-2",children:[n.jsx(uo,{placeholder:"e.g., Updated dashboard screenshots with new navigation design",value:m,onChange:y=>f(y.target.value),rows:2,className:"resize-none"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:m.length>0?`${m.length} characters`:"Optional but recommended"})]})})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"pb-2",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(be,{className:"text-sm",children:"Summary"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(T,{variant:"outline",size:"sm",onClick:w,className:"text-xs h-7",children:[n.jsx(Qc,{className:"h-3 w-3 mr-1"}),"Select All"]}),n.jsxs(T,{variant:"outline",size:"sm",onClick:N,className:"text-xs h-7",children:[n.jsx(ed,{className:"h-3 w-3 mr-1"}),"Select None"]})]})]})}),n.jsx(me,{children:n.jsxs("div",{className:"grid grid-cols-4 gap-4 text-sm",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-muted-foreground text-xs",children:"Scenarios"}),n.jsx("div",{className:"font-semibold text-lg",children:V.size})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-muted-foreground text-xs",children:"Variations"}),n.jsxs("div",{className:"font-semibold text-lg",children:[P," / ",b]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-muted-foreground text-xs",children:"Assets"}),n.jsx("div",{className:"font-semibold text-lg",children:O})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-muted-foreground text-xs",children:"Size"}),n.jsx("div",{className:"font-semibold text-lg",children:p(D)})]})]})})]}),n.jsx("div",{className:"space-y-2",children:Array.from(V.entries()).map(([y,_])=>{const F=L(y),$=g.has(y),E=_.reduce((z,W)=>z+W.assets.length,0),A=_.filter(z=>k[`${z.scenarioKey}::${z.variationSlug}`]).length;return n.jsxs(he,{className:"overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3 p-3 hover:bg-muted/30 cursor-pointer border-b",onClick:()=>h(y),children:[n.jsx(ns,{checked:F==="all",indeterminate:F==="some",onCheckedChange:()=>h(y),onClick:z=>z.stopPropagation()}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"font-medium text-sm truncate",children:y}),n.jsxs("div",{className:"text-xs text-muted-foreground",children:[A,"/",_.length," variations · ",E," assets"]})]}),n.jsx(T,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:z=>{z.stopPropagation(),S(y)},children:$?n.jsx(zs,{className:"h-4 w-4"}):n.jsx(Ps,{className:"h-4 w-4"})})]}),$&&n.jsx("div",{className:"p-2 space-y-1 bg-muted/10",children:_.map(z=>{const W=`${z.scenarioKey}::${z.variationSlug}`,J=k[W];return n.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-md cursor-pointer transition-colors ${J?"bg-primary/10 border border-primary/20":"hover:bg-muted/50"}`,onClick:()=>x(z),children:[n.jsx(ns,{checked:J,onCheckedChange:()=>x(z),onClick:G=>G.stopPropagation(),className:"ml-4"}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(ue,{variant:"secondary",className:"font-mono text-xs",children:z.variationSlug})}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:[z.assets.length," assets"]})]},W)})})]},y)})})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>t(!1),disabled:c,children:"Cancel"}),n.jsx(T,{onClick:v,disabled:P===0||c,children:c?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Publishing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(on,{className:"h-4 w-4 mr-2"}),"Publish"," ",O>0&&`${O} assets`]})})]})]})})}const Mm=/\u001b\[[0-9;]*m/g;function tr(e){for(let t=e.length-1;t>=0;t--){const s=e[t].message.replace(Mm,""),r=s.match(/\[PROGRESS\]\s*(\d+)\/(\d+)\s*\|\s*active:(\d+)\s*\|\s*last:[^\|]+\|\s*eta:([^\|]+)\|\s*rate:([^\s]+)\/min/);if(r)return{current:parseInt(r[1],10),total:parseInt(r[2],10),activeWorkers:parseInt(r[3],10),eta:r[4].trim(),throughput:r[5].trim()};const i=s.match(/\[(\d+)\/(\d+)\]/)||s.match(/Progress:\s*(\d+)\/(\d+)/);if(i)return{current:parseInt(i[1],10),total:parseInt(i[2],10)}}return null}function Im(e){return e.replace(Mm,"")}const Dm=d.createContext(null);function ji(){const e=d.useContext(Dm);if(!e)throw new Error("useJobMonitor must be used within JobMonitorProvider");return e}function c1({children:e}){const[t,s]=d.useState([]),[r,i]=d.useState(!1),[a,o]=d.useState(0),[l,c]=d.useState(".reshot/output"),[u,m]=d.useState(null);d.useEffect(()=>{fetch("/api/config").then(w=>w.json()).then(w=>{var N,S;(N=w.config)!=null&&N.assetDir&&c(w.config.assetDir),(S=w.settings)!=null&&S.platformUrl&&m(w.settings.platformUrl)}).catch(()=>{})},[]);const f=d.useRef(new Set),g=d.useRef(new Set),[R,k]=d.useState(null),C=d.useCallback(()=>{k(null)},[]),j=d.useCallback(async()=>{try{const S=(await(await fetch("/api/jobs?limit=20")).json()).jobs||[],P=Date.now(),b=S.filter(O=>{if(O.status==="running"||O.status==="pending")return!0;const D=new Date(O.updatedAt).getTime();return P-D<1e4});s(b)}catch(w){console.error("Failed to load jobs:",w)}},[]),p=t.some(w=>w.status==="running"||w.status==="pending");d.useEffect(()=>{if(j(),a===0&&!p)return;const w=setInterval(j,2e3);return()=>clearInterval(w)},[j,p,a]),d.useEffect(()=>{var w;for(const N of t)if(f.current.has(N.id)&&!g.current.has(N.id)){if(N.status==="success"){g.current.add(N.id),k(N);break}if(N.status==="failed"&&((w=N.metadata)!=null&&w.authRequired)){g.current.add(N.id),k(N);break}}},[t]);const h=d.useCallback(w=>{s(N=>[w,...N.filter(S=>S.id!==w.id)]),i(!1)},[]),x=d.useCallback((w,N)=>{f.current.add(w),i(!1),o(S=>S+1),setTimeout(()=>o(0),1e4),j()},[j]);return n.jsx(Dm.Provider,{value:{activeJobs:t,addJob:h,refreshJobs:j,trackJob:x,isMinimized:r,setIsMinimized:i,completedJobForModal:R,dismissCompletionModal:C,outputDir:l,platformUrl:u},children:e})}function d1(){var V;const e=Os(),t=On(),{toast:s}=Pt(),{activeJobs:r,isMinimized:i,setIsMinimized:a,trackJob:o,completedJobForModal:l,dismissCompletionModal:c,outputDir:u,platformUrl:m}=ji(),[f,g]=d.useState(null),[R,k]=d.useState(new Set),[C,j]=d.useState(!1),[p,h]=d.useState([]),[x,w]=d.useState(null);if(d.useEffect(()=>{const y=r.find(_=>_.status==="running"||_.status==="pending");y&&y.id!==x&&(g(y.id),w(y.id)),!y&&x&&w(null)},[r,x]),t.pathname==="/jobs")return null;const N=r.filter(y=>!R.has(y.id));if(N.length===0)return null;const S=N.filter(y=>y.status==="running"||y.status==="pending"),P=N.filter(y=>y.status==="success"||y.status==="failed"||y.status==="cancelled"),b=y=>{y.scenarioKey?e(`/scenarios/${y.scenarioKey}?tab=assets`):e("/assets"),k(_=>new Set([..._,y.id]))},O=y=>{k(_=>new Set([..._,y]))},D=(y,_)=>{if(_==="running"||_==="pending")return n.jsx(_e,{className:"h-3.5 w-3.5 animate-spin"});if(_==="success")return n.jsx(vt,{className:"h-3.5 w-3.5 text-green-500"});if(_==="failed")return n.jsx(Da,{className:"h-3.5 w-3.5 text-red-500"});switch(y){case"run":return n.jsx(Ts,{className:"h-3.5 w-3.5"});case"publish":return n.jsx(on,{className:"h-3.5 w-3.5"});default:return n.jsx(fn,{className:"h-3.5 w-3.5"})}},v=y=>{const _=y.type==="run"?"Capture":y.type==="publish"?"Publish":"Record";return y.scenarioKey?`${_}: ${y.scenarioKey}`:`${_} All`},L=y=>{switch(y.status){case"running":{const _=tr(y.logs);return n.jsx(ue,{variant:"info",className:"text-[10px] px-1.5 py-0",children:_?`${_.current}/${_.total}`:"Running"})}case"pending":return n.jsx(ue,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Queued"});case"success":return n.jsx(ue,{variant:"success",className:"text-[10px] px-1.5 py-0",children:"Done"});case"failed":return n.jsx(ue,{variant:"destructive",className:"text-[10px] px-1.5 py-0",children:"Failed"});case"cancelled":return n.jsx(ue,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Cancelled"});default:return null}};return n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full",children:[i&&n.jsx(he,{className:"cursor-pointer hover:bg-accent transition-colors shadow-lg border-border",onClick:()=>a(!1),children:n.jsxs(me,{className:"p-3 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[S.length>0&&n.jsx(_e,{className:"h-4 w-4 animate-spin text-blue-500"}),S.length===0&&P.length>0&&n.jsx(vt,{className:"h-4 w-4 text-green-500"}),n.jsx("span",{className:"text-sm font-medium",children:S.length>0?(()=>{const y=tr(S[0].logs);if(y){const _=y.eta?` — ETA ${y.eta}`:"";return`Capturing ${y.current}/${y.total}${_}`}return`${S.length} job${S.length>1?"s":""} running`})():`${P.length} completed`})]}),n.jsx(Wy,{className:"h-4 w-4 text-muted-foreground"})]})}),!i&&n.jsxs(he,{className:"shadow-lg border-border overflow-hidden",children:[n.jsxs(ke,{className:"py-2 px-3 border-b bg-muted/30 flex flex-row items-center justify-between",children:[n.jsxs(be,{className:"text-xs font-medium flex items-center gap-2",children:[S.length>0&&n.jsx(_e,{className:"h-3 w-3 animate-spin text-blue-500"}),"Active Jobs (",N.length,")"]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(T,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>e("/jobs"),children:n.jsx(an,{className:"h-3 w-3"})}),n.jsx(T,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>a(!0),children:n.jsx(Hy,{className:"h-3 w-3"})})]})]}),n.jsx(me,{className:"p-0 max-h-80 overflow-y-auto",children:n.jsx("div",{className:"divide-y divide-border",children:N.map(y=>{var _,F;return n.jsxs("div",{className:"p-2 hover:bg-accent/50 transition-colors",children:[n.jsxs("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(f===y.id?null:y.id),children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[D(y.type,y.status),n.jsx("span",{className:"text-xs font-medium truncate",children:v(y)})]}),n.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[L(y),f===y.id?n.jsx(Yc,{className:"h-3 w-3 text-muted-foreground"}):n.jsx(zs,{className:"h-3 w-3 text-muted-foreground"})]})]}),(y.status==="running"||y.status==="pending")&&(()=>{const $=tr(y.logs);if($){const E=Math.round($.current/$.total*100);return n.jsxs("div",{className:"mt-2 space-y-1",children:[n.jsx(Fa,{value:E,className:"h-1"}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[n.jsxs("span",{children:[$.current,"/",$.total," completed",$.activeWorkers&&$.activeWorkers>1?` (${$.activeWorkers} parallel)`:""]}),n.jsxs("span",{children:[E,"%"]})]}),($.eta||$.throughput)&&n.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[$.eta&&n.jsxs("span",{children:["ETA: ",$.eta]}),$.throughput&&n.jsxs("span",{children:[$.throughput,"/min"]})]})]})}return y.status==="running"?n.jsxs("div",{className:"mt-2 text-[10px] text-muted-foreground flex items-center gap-1",children:[n.jsx(_e,{className:"h-3 w-3 animate-spin"}),n.jsx("span",{children:"Processing..."})]}):null})(),y.status==="failed"&&((_=y.metadata)==null?void 0:_.error)&&n.jsxs("div",{className:"mt-2 p-2 bg-red-50 dark:bg-red-950/30 rounded border border-red-200 dark:border-red-900",children:[n.jsx("p",{className:"text-[10px] text-red-600 dark:text-red-400 font-medium",children:y.metadata.error}),((F=y.metadata)==null?void 0:F.authRequired)&&n.jsxs(T,{size:"sm",variant:"outline",className:"h-6 text-xs mt-1.5",onClick:$=>{$.stopPropagation(),e("/connection")},children:[n.jsx(Ma,{className:"h-3 w-3 mr-1"}),"Reconnect"]})]}),f===y.id&&n.jsxs("div",{className:"mt-2 space-y-2",children:[n.jsx("div",{className:"bg-muted/50 rounded p-2 max-h-32 overflow-y-auto",children:n.jsxs("div",{className:"font-mono text-[10px] space-y-0.5",children:[y.logs.slice(-8).map(($,E)=>n.jsxs("div",{className:"text-muted-foreground truncate",children:[n.jsx("span",{className:"text-muted-foreground/40 text-[9px]",children:new Date($.timestamp).toLocaleTimeString()})," ",Im($.message)]},E)),y.logs.length===0&&n.jsx("div",{className:"text-muted-foreground",children:"Waiting to start..."})]})}),n.jsxs("div",{className:"flex items-center gap-2",children:[y.status==="success"&&n.jsx(T,{size:"sm",variant:"default",className:"h-6 text-xs",onClick:$=>{$.stopPropagation(),b(y)},children:"View Assets"}),n.jsx(T,{size:"sm",variant:"ghost",className:"h-6 text-xs ml-auto",onClick:$=>{$.stopPropagation(),O(y.id)},children:n.jsx(ln,{className:"h-3 w-3"})})]})]})]},y.id)})})})]}),n.jsx(st,{open:!!l,onOpenChange:y=>{y||c()},children:n.jsx(nt,{children:(l==null?void 0:l.status)==="failed"&&((V=l==null?void 0:l.metadata)!=null&&V.authRequired)?n.jsxs(n.Fragment,{children:[n.jsxs(Xe,{children:[n.jsxs(Ze,{className:"flex items-center gap-2",children:[n.jsx(Da,{className:"h-5 w-5 text-red-500"}),"Authentication Required"]}),n.jsx(ot,{children:l.metadata.error||"Your API key has expired or is invalid. Please reconnect to publish."})]}),n.jsxs(lt,{className:"gap-2 sm:gap-0",children:[n.jsx(T,{variant:"outline",onClick:c,children:"Close"}),n.jsxs(T,{onClick:()=>{c(),e("/connection")},children:[n.jsx(Ma,{className:"h-4 w-4 mr-2"}),"Reconnect"]})]})]}):(l==null?void 0:l.type)==="publish"?n.jsxs(n.Fragment,{children:[n.jsxs(Xe,{children:[n.jsxs(Ze,{className:"flex items-center gap-2",children:[n.jsx(vt,{className:"h-5 w-5 text-green-500"}),"Publish Complete"]}),n.jsx(ot,{children:l!=null&&l.scenarioKey?`Scenario "${l.scenarioKey}" published successfully.`:"Successfully published to platform."})]}),n.jsxs(lt,{className:"gap-2 sm:gap-0",children:[n.jsx(T,{variant:"outline",onClick:c,children:"Close"}),m&&n.jsxs(T,{onClick:()=>{window.open(m,"_blank"),c()},children:[n.jsx(an,{className:"h-4 w-4 mr-2"}),"View on Platform"]})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs(Xe,{children:[n.jsxs(Ze,{className:"flex items-center gap-2",children:[n.jsx(vt,{className:"h-5 w-5 text-green-500"}),"Capture Complete"]}),n.jsx(ot,{children:l!=null&&l.scenarioKey?`Scenario "${l.scenarioKey}" finished successfully.`:"All scenarios finished successfully."})]}),n.jsx("div",{className:"py-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-md p-3",children:[n.jsx(fi,{className:"h-4 w-4 flex-shrink-0"}),n.jsxs("span",{className:"font-mono text-xs truncate",children:[u,"/"]})]})}),n.jsxs(lt,{className:"gap-2 sm:gap-0",children:[n.jsx(T,{variant:"outline",onClick:c,children:"Close"}),n.jsx(T,{variant:"secondary",onClick:()=>{l!=null&&l.scenarioKey?e(`/scenarios/${l.scenarioKey}?tab=assets`):e("/assets"),c()},children:"Review Assets"}),n.jsxs(T,{onClick:()=>{var _;const y=l!=null&&l.scenarioKey?[l.scenarioKey]:((_=l==null?void 0:l.metadata)==null?void 0:_.scenarioKeys)||[];h(y),c(),j(!0)},children:[n.jsx(on,{className:"h-4 w-4 mr-2"}),"Publish to Platform"]})]})]})})}),n.jsx(ho,{open:C,onOpenChange:j,scenarioKeys:p.length>0?p:void 0,onConfirm:async y=>{var _;try{const F=y.reduce((A,z)=>A+z.assets.length,0),$=await fetch("/api/jobs/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:p,selectedGroups:y})}),E=await $.json();if($.status===401||E.authRequired){j(!1),s({title:"Authentication Required",description:E.error||"Please reconnect to publish.",variant:"destructive"}),e("/connection");return}$.ok&&E.ok?(s({title:"Job Created",description:`Publishing ${F} asset(s). Monitor progress in the panel below.`}),j(!1),(_=E.job)!=null&&_.id&&o(E.job.id)):s({title:"Error",description:E.error||"Failed to create publish job",variant:"destructive"})}catch{s({title:"Error",description:"Failed to connect to server",variant:"destructive"})}}})]})}const u1=[{value:"platform",label:"Reshot Platform",icon:Py,description:"Managed hosting"},{value:"s3",label:"Amazon S3",icon:ih,description:"Your own bucket"},{value:"r2",label:"Cloudflare R2",icon:ih,description:"Your own bucket"},{value:"local",label:"Local Storage",icon:Vy,description:"Offline only"}];function wi({open:e,onOpenChange:t,onAuthenticated:s}){const{toast:r}=Pt(),[i,a]=d.useState("idle"),[o,l]=d.useState("platform"),[c,u]=d.useState(null),[m,f]=d.useState(null),[g,R]=d.useState(null),[k,C]=d.useState(null);d.useEffect(()=>{e&&(a("idle"),u(null),f(null),R(null),C(null))},[e]),d.useEffect(()=>{if(i!=="waiting"||!m)return;const h=setInterval(async()=>{try{const w=await(await fetch(`/api/auth/status?token=${m}`)).json();w.status==="completed"?(a("completed"),C({projectId:w.projectId,projectName:w.projectName,workspaceName:w.workspaceName}),clearInterval(h),setTimeout(()=>{s(),t(!1)},1500)):(w.status==="expired"||w.status==="invalid")&&(a("error"),R(w.error||"Authentication session expired"),clearInterval(h))}catch(x){console.error("Poll error:",x)}},2e3);return()=>clearInterval(h)},[i,m,s,t]);const j=async()=>{a("starting"),R(null);try{const x=await(await fetch("/api/auth/start",{method:"POST",headers:{"Content-Type":"application/json"}})).json();if(x.ok&&x.authUrl){u(x.authUrl),f(x.authToken),a("waiting");try{await fetch("/api/auth/open-browser",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({authUrl:x.authUrl})})}catch{}}else throw new Error(x.error||"Failed to start authentication")}catch(h){a("error"),R(h.message||"Failed to start authentication")}},p=d.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(c),r({title:"Copied",description:"Authentication URL copied to clipboard",variant:"success"})}catch{r({title:"Error",description:"Failed to copy URL",variant:"destructive"})}},[c,r]);return n.jsx(st,{open:e,onOpenChange:t,children:n.jsxs(nt,{className:"max-w-md",children:[n.jsxs(Xe,{children:[n.jsxs(Ze,{className:"flex items-center gap-2",children:[n.jsx(La,{className:"h-5 w-5"}),"Connect to Reshot Platform"]}),n.jsx(ot,{children:"Choose your storage destination and authenticate to sync your assets."})]}),n.jsxs("div",{className:"py-4 space-y-4",children:[i==="idle"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Storage Destination"}),n.jsx("div",{className:"grid grid-cols-2 gap-2",children:u1.map(h=>{const x=h.icon;return n.jsxs("button",{onClick:()=>l(h.value),className:Y("flex flex-col items-start gap-1 p-3 rounded-lg border text-left transition-colors",o===h.value?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(x,{className:"h-4 w-4"}),n.jsx("span",{className:"text-sm font-medium",children:h.label})]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:h.description})]},h.value)})})]}),o==="platform"&&n.jsxs(T,{onClick:j,className:"w-full",children:[n.jsx(La,{className:"h-4 w-4 mr-2"}),"Authenticate with Platform"]}),o==="s3"&&n.jsxs("div",{className:"text-center space-y-2 p-4 bg-muted/50 rounded-lg",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"S3 storage requires configuration in your project settings."}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run ",n.jsx("code",{className:"bg-muted px-1 rounded",children:"reshot config --storage s3"})]})]}),o==="r2"&&n.jsxs("div",{className:"text-center space-y-2 p-4 bg-muted/50 rounded-lg",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Cloudflare R2 storage requires configuration in your project settings."}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run ",n.jsx("code",{className:"bg-muted px-1 rounded",children:"reshot config --storage r2"})]})]}),o==="local"&&n.jsxs("div",{className:"text-center space-y-2 p-4 bg-muted/50 rounded-lg",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Local storage keeps assets only on your machine. Great for testing."}),n.jsx(T,{variant:"outline",onClick:()=>{s(),t(!1),r({title:"Local Mode",description:"Working in local-only mode",variant:"success"})},className:"w-full mt-2",children:"Use Local Storage"})]}),n.jsx("div",{className:"pt-2 border-t border-border",children:n.jsxs("a",{href:"https://docs.reshot.dev/reference/cli",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[n.jsx(an,{className:"h-3 w-3"}),"View CLI Documentation"]})})]}),i==="starting"&&n.jsxs("div",{className:"text-center space-y-4 py-4",children:[n.jsx(_e,{className:"h-8 w-8 animate-spin mx-auto text-primary"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Starting authentication..."})]}),i==="waiting"&&c&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"text-center space-y-2",children:[n.jsx(_e,{className:"h-8 w-8 animate-spin mx-auto text-primary"}),n.jsx("p",{className:"text-sm font-medium",children:"Complete authentication in your browser"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"A browser window should have opened. Select a project to link."})]}),n.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 space-y-2",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:"If the browser didn't open, click below or copy the URL:"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(T,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>window.open(c,"_blank"),children:[n.jsx(an,{className:"h-3 w-3 mr-1"}),"Open in Browser"]}),n.jsx(T,{variant:"outline",size:"sm",onClick:p,children:n.jsx(rn,{className:"h-3 w-3"})})]})]})]}),i==="completed"&&k&&n.jsxs("div",{className:"text-center space-y-4 py-4",children:[n.jsx(Ry,{className:"h-12 w-12 mx-auto text-green-500"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:"Successfully Connected!"}),n.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Linked to"," ",k.workspaceName&&`${k.workspaceName} / `,k.projectName]})]})]}),i==="error"&&n.jsxs("div",{className:"text-center space-y-4 py-4",children:[n.jsx(Jt,{className:"h-12 w-12 mx-auto text-destructive"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:"Authentication Failed"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:g||"Something went wrong"})]}),n.jsx(T,{onClick:j,variant:"outline",children:"Try Again"})]})]})]})})}function h1({status:e,className:t}){const s=()=>{switch(e){case"success":return n.jsx(vt,{className:"h-3 w-3"});case"failed":return n.jsx(Da,{className:"h-3 w-3"});case"running":return n.jsx(_e,{className:"h-3 w-3 animate-spin"});default:return n.jsx(hi,{className:"h-3 w-3"})}},r=()=>{switch(e){case"success":return"default";case"failed":return"destructive";default:return"secondary"}};return n.jsxs(ue,{variant:r(),className:Y("text-[10px] h-5 px-2 font-medium flex items-center gap-1",t),children:[s(),e]})}const ve=d.forwardRef(({className:e,type:t,...s},r)=>n.jsx("input",{type:t,className:Y("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...s}));ve.displayName="Input";function f1({open:e,onOpenChange:t,workspaceScenarios:s,allScenarios:r,onScenariosChange:i}){const{toast:a}=Pt(),[o,l]=d.useState(""),[c,u]=d.useState("name"),[m,f]=d.useState("all"),[g,R]=d.useState(new Set);d.useEffect(()=>{e&&l("")},[e]);const k=N=>s.includes(N),C=d.useMemo(()=>{let N=[...r];if(o){const S=o.toLowerCase();N=N.filter(P=>{var b;return P.name.toLowerCase().includes(S)||P.key.toLowerCase().includes(S)||((b=P.url)==null?void 0:b.toLowerCase().includes(S))})}return m==="in-workspace"?N=N.filter(S=>k(S.key)):m==="not-in-workspace"&&(N=N.filter(S=>!k(S.key))),N.sort((S,P)=>{var b,O;switch(c){case"name":return S.name.localeCompare(P.name);case"key":return S.key.localeCompare(P.key);case"steps":return(((b=P.steps)==null?void 0:b.length)||0)-(((O=S.steps)==null?void 0:O.length)||0);default:return 0}}),N},[r,o,m,c,s]),j=async N=>{const S=k(N);R(P=>new Set(P).add(N));try{if(S){const P=await fetch(`/api/workspace/scenarios/${encodeURIComponent(N)}`,{method:"DELETE"});if(!P.ok){const b=await P.json();throw new Error(b.error||"Failed to remove scenario")}a({title:"Removed",description:`${N} removed from workspace`})}else{const P=await fetch("/api/workspace/scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:[N]})});if(!P.ok){const b=await P.json();throw new Error(b.error||"Failed to add scenario")}a({title:"Added",description:`${N} added to workspace`})}i()}catch(P){const b=P instanceof Error?P.message:"Operation failed";a({title:"Error",description:b,variant:"destructive"})}finally{R(P=>{const b=new Set(P);return b.delete(N),b})}},p=async()=>{const N=C.filter(S=>!k(S.key));if(N.length!==0){R(new Set(N.map(S=>S.key)));try{const S=await fetch("/api/workspace/scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:N.map(P=>P.key)})});if(!S.ok){const P=await S.json();throw new Error(P.error||"Failed to add scenarios")}a({title:"Added",description:`Added ${N.length} scenarios to workspace`}),i()}catch(S){const P=S instanceof Error?S.message:"Operation failed";a({title:"Error",description:P,variant:"destructive"})}finally{R(new Set)}}},h=async()=>{const N=C.filter(S=>k(S.key));if(N.length!==0){R(new Set(N.map(S=>S.key)));try{for(const S of N)await fetch(`/api/workspace/scenarios/${encodeURIComponent(S.key)}`,{method:"DELETE"});a({title:"Removed",description:`Removed ${N.length} scenarios from workspace`}),i()}catch(S){const P=S instanceof Error?S.message:"Operation failed";a({title:"Error",description:P,variant:"destructive"})}finally{R(new Set)}}},x=r.filter(N=>k(N.key)).length,w=r.length-x;return n.jsx(st,{open:e,onOpenChange:t,children:n.jsxs(nt,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Manage Workspace Scenarios"}),n.jsxs(ot,{children:["Add or remove scenarios from your workspace. ",x," of"," ",r.length," scenarios selected."]})]}),n.jsxs("div",{className:"space-y-3 py-2",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Zc,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(ve,{placeholder:"Search scenarios...",value:o,onChange:N=>l(N.target.value),className:"pl-9"})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[n.jsx(Ly,{className:"h-3.5 w-3.5 text-muted-foreground"}),n.jsxs(T,{variant:m==="all"?"secondary":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>f("all"),children:["All (",r.length,")"]}),n.jsxs(T,{variant:m==="in-workspace"?"secondary":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>f("in-workspace"),children:["In Workspace (",x,")"]}),n.jsxs(T,{variant:m==="not-in-workspace"?"secondary":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>f("not-in-workspace"),children:["Available (",w,")"]})]}),n.jsx("div",{className:"flex-1"}),n.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[n.jsx(Gc,{className:"h-3.5 w-3.5 text-muted-foreground"}),n.jsx(T,{variant:c==="name"?"secondary":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>u("name"),children:"Name"}),n.jsx(T,{variant:c==="key"?"secondary":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>u("key"),children:"Key"}),n.jsx(T,{variant:c==="steps"?"secondary":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>u("steps"),children:"Steps"})]})]}),C.length>0&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:p,disabled:C.every(N=>k(N.key))||g.size>0,children:[n.jsx(as,{className:"h-3 w-3 mr-1"}),"Add All Visible"]}),n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:h,disabled:!C.some(N=>k(N.key))||g.size>0,children:[n.jsx(Zp,{className:"h-3 w-3 mr-1"}),"Remove All Visible"]})]})]}),n.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 -mx-6 px-6",children:C.length===0?n.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:o?"No scenarios match your search":"No scenarios available"}):n.jsx("div",{className:"space-y-1 pb-4",children:C.map(N=>{var b;const S=k(N.key),P=g.has(N.key);return n.jsxs("div",{className:Y("flex items-center gap-3 p-3 rounded-lg border transition-colors cursor-pointer",S?"bg-primary/5 border-primary/20 hover:bg-primary/10":"bg-card border-border hover:bg-accent/50"),onClick:()=>!P&&j(N.key),children:[n.jsx("div",{className:Y("w-5 h-5 rounded border flex items-center justify-center transition-colors",S?"bg-primary border-primary":"border-muted-foreground/30"),children:P?n.jsx(_e,{className:"h-3 w-3 animate-spin text-primary-foreground"}):S?n.jsx(ro,{className:"h-3 w-3 text-primary-foreground"}):null}),n.jsx(Rn,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium truncate",children:N.name}),n.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:N.key})]}),N.url&&n.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.url})]}),n.jsxs(ue,{variant:"secondary",className:"text-xs shrink-0",children:[((b=N.steps)==null?void 0:b.length)||0," steps"]})]},N.key)})})}),n.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[n.jsxs("p",{className:"text-sm text-muted-foreground",children:[x," scenario",x!==1?"s":""," in workspace"]}),n.jsx(T,{onClick:()=>t(!1),children:"Done"})]})]})})}function p1(){var V,y,_,F,$;const{toast:e}=Pt(),{trackJob:t}=ji(),[s,r]=d.useState({workspace:null,allScenarios:[],assetGroups:[],jobs:[],settings:null,loading:!0,error:null}),[i,a]=d.useState(new Set),[o,l]=d.useState(!1),[c,u]=d.useState(!1),[m,f]=d.useState(!1),[g,R]=d.useState(new Set),[k,C]=d.useState(!1),[j,p]=d.useState(0),h=d.useCallback(async(E=!1)=>{var A,z;try{E&&C(!0);const[W,J,G,fe]=await Promise.all([fetch("/api/status"),fetch("/api/workspace"),fetch("/api/output"),fetch("/api/config")]);if(!W.ok)throw new Error(`Status API failed: ${W.status}`);const[ye,ge,Re,U]=await Promise.all([W.json(),J.json(),G.json(),fe.json()]);let X=ge.workspace;if(!X){const ce=await fetch("/api/workspace",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"Default Workspace"})});ce.ok&&(X=(await ce.json()).workspace)}const Z=((A=X==null?void 0:X.allScenarios)==null?void 0:A.length)>0?X.allScenarios:((z=U.config)==null?void 0:z.scenarios)||[];r({workspace:X,allScenarios:Z,assetGroups:Re.groups||[],jobs:ye.jobs||[],settings:ye.settings||null,loading:!1,error:null}),E&&e({title:"Refreshed",description:"Data updated successfully"})}catch(W){const J=W instanceof Error?W.message:"Failed to load data";console.error("Failed to load data:",W),r(G=>({...G,loading:!1,error:J})),E&&e({title:"Error",description:J,variant:"destructive"})}finally{C(!1)}},[e]);d.useEffect(()=>{h()},[h]),d.useEffect(()=>{if(!s.jobs.some(z=>z.status==="running"||z.status==="pending")&&j===0)return;const A=setInterval(()=>h(!1),3e3);return()=>clearInterval(A)},[s.jobs,h,j]);const x=async E=>{try{const A=await fetch("/api/workspace/scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:[E]})});if(!A.ok){const W=await A.json();throw new Error(W.error||"Failed to add scenario")}const z=await A.json();z.workspace&&(r(W=>({...W,workspace:z.workspace})),e({title:"Added",description:`Added ${E} to workspace`}))}catch(A){const z=A instanceof Error?A.message:"Failed to add scenario";console.error("Add scenario error:",A),e({title:"Error",description:z,variant:"destructive"})}},w=async E=>{try{const A=await fetch(`/api/workspace/scenarios/${encodeURIComponent(E)}`,{method:"DELETE"});if(!A.ok){const W=await A.json();throw new Error(W.error||"Failed to remove scenario")}const z=await A.json();z.workspace&&(r(W=>({...W,workspace:z.workspace})),e({title:"Removed",description:`Removed ${E} from workspace`}))}catch(A){const z=A instanceof Error?A.message:"Failed to remove scenario";console.error("Remove scenario error:",A),e({title:"Error",description:z,variant:"destructive"})}},N=async E=>{R(A=>new Set(A).add(E));try{const A=await fetch("/api/jobs/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:[E]})}),z=await A.json();if(!A.ok)throw new Error(z.error||`Failed to start capture (${A.status})`);if(z.ok&&z.job)t(z.job.id,E),await h(!1),p(W=>W+1),setTimeout(()=>p(0),1e4);else throw new Error(z.error||"Unknown error starting job")}catch(A){const z=A instanceof Error?A.message:"Failed to start capture";console.error("Run scenario error:",A),e({title:"Capture Failed",description:z,variant:"destructive"})}finally{R(A=>{const z=new Set(A);return z.delete(E),z})}},S=E=>{a(A=>{const z=new Set(A);return z.has(E)?z.delete(E):z.add(E),z})},P=E=>s.assetGroups.filter(A=>A.scenarioKey===E),b=((V=s.workspace)==null?void 0:V.resolvedScenarios)||[],O=s.allScenarios.filter(E=>{var A,z;return!((z=(A=s.workspace)==null?void 0:A.scenarios)!=null&&z.includes(E.key))}),D=((y=s.settings)==null?void 0:y.isAuthenticated)||!1,v=s.assetGroups.length>0,L=s.jobs.filter(E=>E.status==="running"||E.status==="pending");return s.loading?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsxs("div",{className:"text-center",children:[n.jsx(_e,{className:"h-8 w-8 animate-spin text-muted-foreground mx-auto mb-3"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading workspace..."})]})}):s.error&&!s.workspace?n.jsx("div",{className:"flex items-center justify-center h-full p-6",children:n.jsx(he,{className:"max-w-md w-full",children:n.jsxs(me,{className:"pt-6 text-center",children:[n.jsx(Jt,{className:"h-10 w-10 text-destructive mx-auto mb-3"}),n.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Failed to Load"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s.error}),n.jsxs(T,{onClick:()=>h(!0),children:[n.jsx(_t,{className:"h-4 w-4 mr-2"}),"Retry"]})]})})}):n.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[n.jsx("div",{className:"shrink-0 px-6 py-4 border-b border-border bg-background",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-semibold text-foreground",children:((_=s.workspace)==null?void 0:_.name)||"Workspace"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:[b.length," scenario",b.length!==1?"s":"",v&&` • ${s.assetGroups.length} captured variant${s.assetGroups.length!==1?"s":""}`]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T,{variant:"outline",size:"icon",onClick:()=>h(!0),disabled:k,title:"Refresh",children:n.jsx(_t,{className:Y("h-4 w-4",k&&"animate-spin")})}),n.jsxs(T,{variant:"outline",size:"sm",onClick:()=>f(!0),className:"gap-1.5",children:[n.jsx(Yy,{className:"h-3.5 w-3.5"}),"Manage Scenarios"]}),D&&n.jsxs(T,{size:"sm",onClick:()=>u(!0),disabled:!v,className:"gap-1.5",children:[n.jsx(on,{className:"h-3.5 w-3.5"}),"Commit"]})]})]})}),n.jsxs("div",{className:"flex-1 overflow-auto p-6 space-y-6",children:[!D&&n.jsx(he,{className:"border-yellow-500/30 bg-yellow-50/5",children:n.jsx(me,{className:"py-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2 rounded-full bg-yellow-500/10",children:n.jsx(em,{className:"h-4 w-4 text-yellow-500"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Connect to Platform"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Authenticate to publish assets and sync with the platform"})]}),n.jsx(T,{size:"sm",variant:"outline",onClick:()=>l(!0),children:"Connect"})]})})}),L.length>0&&n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsxs(be,{className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(_e,{className:"h-4 w-4 animate-spin"}),"Active Jobs"]})}),n.jsx(me,{className:"px-4 pb-4",children:n.jsx("div",{className:"space-y-2",children:L.map(E=>n.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(h1,{status:E.status}),n.jsxs("span",{className:"text-sm",children:[E.type==="run"?"Capturing":E.type,E.scenarioKey&&`: ${E.scenarioKey}`]})]}),E.progress!==void 0&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:[E.progress,"%"]})]},E.id))})})]}),n.jsxs("section",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(fi,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Workspace Scenarios"})]}),n.jsxs("button",{onClick:()=>f(!0),className:"text-xs text-muted-foreground hover:text-foreground",children:["View all ",s.allScenarios.length," scenarios →"]})]}),b.length===0?n.jsx(he,{className:"border-dashed",children:n.jsxs(me,{className:"py-8 text-center",children:[n.jsx(fi,{className:"h-8 w-8 mx-auto text-muted-foreground/50 mb-3"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"No scenarios in workspace"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Add scenarios to start capturing and publishing visuals"}),n.jsxs(T,{variant:"outline",size:"sm",onClick:()=>f(!0),children:[n.jsx(as,{className:"h-3.5 w-3.5 mr-1.5"}),"Add First Scenario"]})]})}):n.jsx("div",{className:"space-y-2",children:b.map(E=>{const A=P(E.key),z=i.has(E.key),W=g.has(E.key)||L.some(J=>J.scenarioKey===E.key);return n.jsxs(he,{className:"overflow-hidden",children:[n.jsxs("div",{className:Y("flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-accent/50 transition-colors",z&&"bg-accent/30"),onClick:()=>S(E.key),children:[n.jsx("button",{className:"text-muted-foreground",children:z?n.jsx(zs,{className:"h-4 w-4"}):n.jsx(Ps,{className:"h-4 w-4"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:E.name||E.key}),n.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:E.key})]}),E.url&&n.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.url})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[A.length>0&&n.jsxs(ue,{variant:"secondary",className:"text-xs",children:[A.reduce((J,G)=>J+G.assets.length,0)," ","assets"]}),n.jsxs("div",{className:"flex items-center gap-1",onClick:J=>J.stopPropagation(),children:[n.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(E.key),disabled:W,children:W?n.jsx(_e,{className:"h-3.5 w-3.5 animate-spin"}):n.jsx(Ts,{className:"h-3.5 w-3.5"})}),n.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:()=>w(E.key),children:n.jsx(ps,{className:"h-3.5 w-3.5"})})]})]})]}),z&&n.jsxs("div",{className:"border-t border-border bg-muted/30 px-4 py-3",children:[A.length===0?n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx(Jt,{className:"h-3.5 w-3.5"}),"No captures yet. Click play to run this scenario."]}):n.jsx("div",{className:"space-y-3",children:A.map((J,G)=>n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:J.variationSlug==="default"?"Default":J.variationSlug}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",J.assets.length," file",J.assets.length!==1?"s":"",")"]})]}),n.jsxs("div",{className:"grid grid-cols-4 sm:grid-cols-6 md:grid-cols-8 gap-2",children:[J.assets.slice(0,8).map((fe,ye)=>n.jsx(Kt,{to:`/assets/${J.scenarioKey}/${J.variationSlug}/${fe.captureKey}`,className:"aspect-video rounded-md overflow-hidden border border-border hover:border-primary/50 transition-colors",children:fe.filename.endsWith(".mp4")?n.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:n.jsx(io,{className:"h-4 w-4 text-muted-foreground"})}):n.jsx("img",{src:fe.url,alt:fe.captureKey,className:"w-full h-full object-cover"})},ye)),J.assets.length>8&&n.jsx(Kt,{to:"/assets",className:"aspect-video rounded-md overflow-hidden border border-border bg-muted flex items-center justify-center hover:bg-accent transition-colors",children:n.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",J.assets.length-8]})})]})]},`${J.scenarioKey}-${J.variationSlug}-${G}`))}),n.jsx("div",{className:"mt-3 pt-3 border-t border-border",children:n.jsx(Kt,{to:`/scenarios/${E.key}`,className:"text-xs text-primary hover:underline",children:"Edit scenario →"})})]})]},E.key)})})]}),O.length>0&&b.length>0&&n.jsxs("section",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(as,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Quick Add"})]}),n.jsx("button",{onClick:()=>f(!0),className:"text-xs text-muted-foreground hover:text-foreground",children:"Manage all →"})]}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:O.slice(0,3).map(E=>n.jsxs("button",{onClick:()=>x(E.key),className:"flex items-center gap-3 p-3 rounded-lg border border-border bg-card hover:bg-accent/50 transition-colors text-left group",children:[n.jsx("div",{className:"p-1.5 rounded bg-muted group-hover:bg-primary/10 transition-colors",children:n.jsx(as,{className:"h-3.5 w-3.5 text-muted-foreground group-hover:text-primary"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:E.name||E.key}),n.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate",children:E.key})]})]},E.key))})]}),((F=s.workspace)==null?void 0:F.commits)&&s.workspace.commits.length>0&&n.jsxs("section",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(vt,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Recent Commits"})]}),n.jsx("div",{className:"space-y-2",children:s.workspace.commits.slice(-3).reverse().map(E=>n.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border bg-card",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:E.message}),n.jsxs("div",{className:"text-xs text-muted-foreground",children:[E.scenarioKeys.length," scenario",E.scenarioKeys.length!==1?"s":""," • ",E.assetCount," asset",E.assetCount!==1?"s":""," • ",new Date(E.createdAt).toLocaleDateString()]})]}),E.platformCommitId?n.jsx(ue,{variant:"secondary",className:"text-xs bg-green-500/10 text-green-500",children:"Synced"}):n.jsx(ue,{variant:"secondary",className:"text-xs",children:"Local"})]},E.id))})]})]}),n.jsx(wi,{open:o,onOpenChange:l,onAuthenticated:h}),n.jsx(f1,{open:m,onOpenChange:f,workspaceScenarios:(($=s.workspace)==null?void 0:$.scenarios)||[],allScenarios:s.allScenarios,onScenariosChange:h}),n.jsx(ho,{open:c,onOpenChange:u,onConfirm:async(E,A)=>{var z;try{const W=await fetch("/api/jobs/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({selectedGroups:E,commitMessage:A})}),J=await W.json();if(W.status===401||J.authRequired){u(!1),e({title:"Authentication Required",description:"Your API key has expired. Please reconnect.",variant:"destructive"}),l(!0);return}W.ok&&J.ok?(u(!1),(z=J.job)!=null&&z.id&&t(J.job.id),h(),p(G=>G+1),setTimeout(()=>p(0),1e4)):e({title:"Error",description:J.error||"Failed to create publish job",variant:"destructive"})}catch{e({title:"Error",description:"Failed to connect to server",variant:"destructive"})}}})]})}const q=d.forwardRef(({className:e,...t},s)=>n.jsx("label",{ref:s,className:Y("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));q.displayName="Label";function Fm(e){const t=d.useRef(!1);return d.useCallback(async()=>{if(!t.current){t.current=!0;try{await e()}finally{t.current=!1}}},[e])}function yh(e){if(!e)return"Never";const t=new Date(e),r=new Date().getTime()-t.getTime(),i=Math.floor(r/(1e3*60)),a=Math.floor(r/(1e3*60*60)),o=Math.floor(r/(1e3*60*60*24));return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:o<7?`${o}d ago`:t.toLocaleDateString()}function Pr(e){if(e.category)return e.category;const s=(e.key||"").split("-");return s.length>=2?s[0]:"other"}function m1(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function x1(){const e=Os(),{toast:t}=Pt(),{trackJob:s}=ji(),[r,i]=d.useState([]),[a,o]=d.useState(!0),[l,c]=d.useState(!1),[u,m]=d.useState({name:"",key:"",url:""}),[f,g]=d.useState(!1),[R,k]=d.useState(""),[C,j]=d.useState("grouped"),[p,h]=d.useState(new Set),[x,w]=d.useState(new Set),[N,S]=d.useState(!1),[P,b]=d.useState(!1),[O,D]=d.useState(null),[v,L]=d.useState({}),[V,y]=d.useState(!0),[_,F]=d.useState("step-by-step-images"),[$,E]=d.useState(null),[A,z]=d.useState(!0),[W,J]=d.useState(!1),[G,fe]=d.useState("scenarios"),[ye,ge]=d.useState(""),[Re,U]=d.useState("lastRun"),[X,Z]=d.useState(!1),ce=d.useCallback(async()=>{var B,oe,se;o(!0);try{const[re,qe]=await Promise.all([fetch("/api/scenarios/metadata"),fetch("/api/config")]),[De,At]=await Promise.all([re.json(),qe.json()]);if(i(De.scenarios||[]),D(((B=At.config)==null?void 0:B.variants)||null),z(((se=(oe=At.config)==null?void 0:oe.diffing)==null?void 0:se.enabled)!==!1),x.size===0){const I=new Set((De.scenarios||[]).map(ee=>Pr(ee)));w(I)}}catch(re){console.error("Failed to load scenarios:",re)}finally{o(!1)}},[x.size]);d.useEffect(()=>{ce()},[ce]);const ie=Fm(ce),ae=async()=>{try{const oe=await fetch(G==="scenarios"?"/api/config/scenarios":"/api/assets",{method:"DELETE"}),se=await oe.json();oe.ok?(t({title:"Success",description:G==="scenarios"?`Deleted ${se.deleted} scenario(s)`:`Deleted ${se.deleted} asset file(s)`,variant:"success"}),J(!1),G==="scenarios"&&ce()):t({title:"Error",description:se.error||"Failed to delete",variant:"destructive"})}catch(B){console.error("Failed to bulk delete:",B),t({title:"Error",description:"Failed to perform bulk delete",variant:"destructive"})}},Se=d.useMemo(()=>{let B=[...r];if(ye){const oe=ye.toLowerCase();B=B.filter(se=>se.name.toLowerCase().includes(oe)||se.key.toLowerCase().includes(oe)||se.url.toLowerCase().includes(oe)||Pr(se).toLowerCase().includes(oe))}return B.sort((oe,se)=>{var qe,De,At,I,ee,pe;let re=0;switch(Re){case"name":re=oe.name.localeCompare(se.name);break;case"key":re=oe.key.localeCompare(se.key);break;case"steps":re=(((qe=oe.steps)==null?void 0:qe.length)||0)-(((De=se.steps)==null?void 0:De.length)||0);break;case"lastRun":const Ce=((At=oe._metadata)==null?void 0:At.lastRunAt)||((I=oe._metadata)==null?void 0:I.createdAt)||"",Oe=((ee=se._metadata)==null?void 0:ee.lastRunAt)||((pe=se._metadata)==null?void 0:pe.createdAt)||"";re=Ce.localeCompare(Oe);break}return X?re:-re}),B},[r,ye,Re,X]),Ie=d.useMemo(()=>{const B={};for(const se of Se){const re=Pr(se);B[re]||(B[re]=[]),B[re].push(se)}return Object.entries(B).sort(([se],[re])=>se==="other"?1:re==="other"?-1:se.localeCompare(re)).map(([se,re])=>({key:se,name:m1(se),scenarios:re,isExpanded:x.has(se)}))},[Se,x]),mt=B=>{w(oe=>{const se=new Set(oe);return se.has(B)?se.delete(B):se.add(B),se})},Nt=B=>{h(oe=>{const se=new Set(oe);return se.has(B)?se.delete(B):se.add(B),se})},Ft=B=>{const oe=B.scenarios.map(re=>re.key),se=oe.every(re=>p.has(re));h(re=>{const qe=new Set(re);return se?oe.forEach(De=>qe.delete(De)):oe.forEach(De=>qe.add(De)),qe})},Yt=()=>{const B=Se.map(oe=>oe.key);h(new Set(B))},$t=()=>{h(new Set)},kt=async()=>{if(p.size===0){t({title:"No scenarios selected",description:"Please select at least one scenario to run",variant:"destructive"});return}b(!0);try{const oe={scenarioKeys:Array.from(p),format:_,diff:$===null?A:$};!V&&Object.keys(v).length>0&&(oe.variant=v);const se=await fetch("/api/jobs/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)}),re=await se.json();if(!se.ok)throw new Error(re.error||"Failed to start capture job");re.job&&(s(re.job.id,`${p.size} scenarios`),S(!1),$t())}catch(B){const oe=B instanceof Error?B.message:"Failed to start capture";t({title:"Error",description:oe,variant:"destructive"})}finally{b(!1)}},Tt=B=>{Re===B?Z(!X):(U(B),Z(!0))},Vt=async()=>{var B;if(!u.name||!u.key||!u.url){t({title:"Error",description:"Please fill in all required fields",variant:"destructive"});return}if(!/^[a-z0-9-]+$/.test(u.key)){t({title:"Error",description:"Key must contain only lowercase letters, numbers, and hyphens",variant:"destructive"});return}try{const oe=await fetch("/api/config/scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...u,steps:[]})});if(oe.ok){t({title:"Success",description:"Scenario created successfully",variant:"success"}),c(!1),m({name:"",key:"",url:""});const re=await(await fetch("/api/config")).json();i(((B=re.config)==null?void 0:B.scenarios)||[]),e(`/scenarios/${u.key}`)}else{const se=await oe.json();t({title:"Error",description:se.error||"Failed to create scenario",variant:"destructive"})}}catch(oe){console.error("Failed to create scenario:",oe),t({title:"Error",description:"Failed to create scenario",variant:"destructive"})}},je=B=>B.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-");return n.jsxs("div",{"data-testid":"studio-scenarios","data-loaded":"true",className:"p-5 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 pb-3",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Scenarios"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1 font-normal",children:[r.length," scenarios in ",Ie.length," categories"]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(T,{variant:"outline",size:"icon",onClick:ie,title:"Refresh",className:"shadow-sm",disabled:a,children:n.jsx(_t,{className:`h-4 w-4 ${a?"animate-spin":""}`})}),n.jsxs(T,{variant:"outline",size:"sm",onClick:()=>{fe("scenarios"),J(!0)},title:"Delete all scenarios",className:"shadow-sm text-destructive hover:text-destructive",children:[n.jsx(ps,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete All"]}),n.jsxs(T,{size:"sm",onClick:()=>e("/recorder"),className:"shadow-sm",children:[n.jsx(as,{className:"h-3.5 w-3.5 mr-1.5"}),"New Scenario"]})]})]}),r.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[n.jsx(Zc,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(ve,{placeholder:"Search scenarios or categories...",value:ye,onChange:B=>ge(B.target.value),className:"pl-9 h-9"})]}),n.jsxs("div",{className:"flex items-center gap-1 border rounded-md p-0.5",children:[n.jsxs(T,{variant:C==="grouped"?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>j("grouped"),children:[n.jsx(Kr,{className:"h-3 w-3 mr-1"}),"Grouped"]}),n.jsxs(T,{variant:C==="flat"?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>j("flat"),children:[n.jsx(Rn,{className:"h-3 w-3 mr-1"}),"Flat"]})]}),n.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[n.jsx(Gc,{className:"h-3.5 w-3.5 text-muted-foreground mr-1"}),n.jsxs(T,{variant:Re==="lastRun"?"secondary":"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>Tt("lastRun"),children:["Last Run ",Re==="lastRun"&&(X?"↑":"↓")]}),n.jsxs(T,{variant:Re==="name"?"secondary":"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>Tt("name"),children:["Name ",Re==="name"&&(X?"↑":"↓")]})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:p.size>0?$t:Yt,children:p.size>0?n.jsxs(n.Fragment,{children:[n.jsx(ed,{className:"h-3.5 w-3.5 mr-1"}),"Clear (",p.size,")"]}):n.jsxs(n.Fragment,{children:[n.jsx(Qc,{className:"h-3.5 w-3.5 mr-1"}),"Select All"]})}),p.size>0&&n.jsxs(ue,{variant:"secondary",className:"text-xs",children:[p.size," selected"]})]}),p.size>0&&n.jsxs(T,{size:"sm",onClick:()=>S(!0),className:"gap-1.5",children:[n.jsx(Ts,{className:"h-3.5 w-3.5"}),"Run Selected (",p.size,")"]})]})]}),a?n.jsx("div",{className:"text-muted-foreground",children:"Loading scenarios..."}):r.length===0?n.jsxs(he,{children:[n.jsxs(ke,{children:[n.jsx(be,{children:"No Scenarios"}),n.jsx(at,{children:"Create your first scenario to get started"})]}),n.jsx(me,{children:n.jsxs(T,{onClick:()=>c(!0),children:[n.jsx(as,{className:"h-4 w-4 mr-2"}),"Create Scenario"]})})]}):Se.length===0?n.jsx(he,{children:n.jsxs(me,{className:"py-8 text-center",children:[n.jsxs("p",{className:"text-muted-foreground",children:['No scenarios match "',ye,'"']}),n.jsx(T,{variant:"link",onClick:()=>ge(""),children:"Clear search"})]})}):C==="grouped"?n.jsx("div",{className:"space-y-4",children:Ie.map(B=>{const oe=B.scenarios.every(re=>p.has(re.key)),se=B.scenarios.some(re=>p.has(re.key));return n.jsxs(he,{className:"overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 bg-muted/30 border-b cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>mt(B.key),children:[n.jsx(ns,{checked:oe,className:Y("data-[state=indeterminate]:bg-primary/50",se&&!oe&&"data-[state=checked]:bg-primary/50"),onClick:re=>{re.stopPropagation(),Ft(B)}}),n.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.isExpanded?n.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}):n.jsx(Ps,{className:"h-4 w-4 text-muted-foreground"}),n.jsx(fi,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-sm",children:B.name}),n.jsx(ue,{variant:"secondary",className:"text-xs",children:B.scenarios.length})]})]}),B.isExpanded&&n.jsx("div",{className:"divide-y",children:B.scenarios.map(re=>{var qe,De;return n.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 hover:bg-muted/20 transition-colors",children:[n.jsx(ns,{checked:p.has(re.key),onClick:At=>{At.stopPropagation(),Nt(re.key)}}),n.jsx(Kt,{to:`/scenarios/${re.key}`,className:"flex-1 min-w-0 group",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium group-hover:text-primary transition-colors truncate",children:re.name}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:re.key}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:[((qe=re.steps)==null?void 0:qe.length)||0," steps"]}),n.jsx("span",{children:"•"}),n.jsx(hi,{className:"h-3 w-3"}),n.jsx("span",{children:yh(((De=re._metadata)==null?void 0:De.lastRunAt)||null)})]})]}),n.jsx(Ps,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})})]},re.key)})})]},B.key)})}):n.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:Se.map(B=>{var oe,se;return n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute top-3 left-3 z-10",children:n.jsx(ns,{checked:p.has(B.key),onClick:re=>{re.stopPropagation(),Nt(B.key)},className:"bg-background"})}),n.jsx(Kt,{to:`/scenarios/${B.key}`,children:n.jsxs(he,{className:"dagster-card cursor-pointer group",children:[n.jsxs(ke,{className:"px-4 py-3 pl-10",children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsx(be,{className:"text-sm font-semibold group-hover:text-primary transition-colors",children:B.name}),n.jsx(Rn,{className:"h-3.5 w-3.5 text-muted-foreground group-hover:text-primary transition-colors"})]}),n.jsx(at,{className:"font-mono text-[10px] mt-1 text-muted-foreground",children:B.key})]}),n.jsx(me,{className:"px-4 pb-3",children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx(ue,{variant:"outline",className:"text-[10px]",children:Pr(B)}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-medium",children:((oe=B.steps)==null?void 0:oe.length)||0}),n.jsx("span",{children:"steps"})]}),n.jsx("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(hi,{className:"h-3 w-3"}),n.jsx("span",{children:yh(((se=B._metadata)==null?void 0:se.lastRunAt)||null)})]})}),n.jsx("div",{className:"text-[10px] text-muted-foreground truncate font-mono",children:B.url})]})})]})})]},B.key)})}),n.jsx(st,{open:l,onOpenChange:c,children:n.jsxs(nt,{children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Create New Scenario"}),n.jsx(ot,{children:"Create a new visual scenario. You can add steps later."})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx(q,{htmlFor:"name",children:"Name"}),n.jsx(ve,{id:"name",value:u.name,onChange:B=>{m({...u,name:B.target.value,key:u.key||je(B.target.value)})},placeholder:"Admin Dashboard"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"key",children:"Key"}),n.jsx(ve,{id:"key",value:u.key,onChange:B=>m({...u,key:B.target.value}),placeholder:"admin-dashboard",className:"font-mono"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Lowercase letters, numbers, and hyphens only"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"url",children:"URL"}),n.jsx(ve,{id:"url",value:u.url,onChange:B=>m({...u,url:B.target.value}),placeholder:"https://example.com/dashboard"})]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),n.jsx(T,{onClick:Vt,children:"Create Scenario"})]})]})}),n.jsx(st,{open:f,onOpenChange:g,children:n.jsxs(nt,{children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Record New Visual"}),n.jsx(ot,{children:"Create a new visual by recording it. Enter a title and the recorder will start."})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx(q,{htmlFor:"record-title",children:"Visual Title"}),n.jsx(ve,{id:"record-title",value:R,onChange:B=>k(B.target.value),placeholder:"Admin Dashboard"})]}),n.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[n.jsx("p",{children:"This will:"}),n.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[n.jsx("li",{children:"Start a recording job"}),n.jsx("li",{children:"Open Chrome with remote debugging (if not already open)"}),n.jsx("li",{children:"Allow you to capture steps using keyboard shortcuts"})]}),n.jsx("p",{className:"mt-4 font-medium",children:"Keyboard shortcuts:"}),n.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[n.jsxs("li",{children:[n.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-xs",children:"C"})," ","- Capture"]}),n.jsxs("li",{children:[n.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-xs",children:"Q"})," ","- Quit and save"]})]})]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),n.jsx(T,{onClick:async()=>{if(!R.trim()){t({title:"Error",description:"Please enter a title",variant:"destructive"});return}try{const B=await fetch("/api/jobs/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:R})}),oe=await B.json();B.ok?(t({title:"Success",description:"Recording job started. Check Jobs page and your terminal.",variant:"success"}),g(!1),k("")):t({title:"Error",description:oe.error||"Failed to start recording",variant:"destructive"})}catch{t({title:"Error",description:"Failed to start recording",variant:"destructive"})}},children:"Start Recording"})]})]})}),n.jsx(st,{open:N,onOpenChange:S,children:n.jsxs(nt,{className:"max-w-lg",children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Run Selected Scenarios"}),n.jsxs(ot,{children:["Capture assets for ",p.size," selected scenario(s)"]})]}),n.jsxs("div",{className:"space-y-5 py-4",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx(q,{className:"text-sm font-medium",children:"Output Format"}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx("button",{type:"button",onClick:()=>F("step-by-step-images"),className:`p-3 rounded-lg border-2 text-left transition-all ${_==="step-by-step-images"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(fn,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium text-sm",children:"Screenshots"})]})}),n.jsx("button",{type:"button",onClick:()=>F("summary-video"),className:`p-3 rounded-lg border-2 text-left transition-all ${_==="summary-video"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(io,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium text-sm",children:"Video"})]})})]})]}),n.jsx("div",{className:"space-y-2",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(q,{className:"text-sm font-medium",children:"Visual Diffing"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Compare against approved baselines"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[$===null&&A&&n.jsx("span",{className:"text-xs text-muted-foreground",children:"(default: on)"}),$===null&&!A&&n.jsx("span",{className:"text-xs text-muted-foreground",children:"(default: off)"}),n.jsx("input",{type:"checkbox",checked:$===null?A:$,onChange:B=>E(B.target.checked),className:"rounded h-4 w-4"})]})]})}),n.jsx("div",{className:"space-y-2",children:n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(q,{className:"text-sm font-medium",children:"Output Crop"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Crop is configured per-scenario in Details tab"})]})})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Selected Scenarios:"}),n.jsx("div",{className:"max-h-28 overflow-auto border rounded-md p-2 space-y-1",children:Array.from(p).map(B=>{const oe=r.find(re=>re.key===B),se=oe?Pr(oe):B.split("-")[0]||"other";return n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsx(ue,{variant:"outline",className:"text-[10px]",children:se}),n.jsx("span",{className:"font-medium",children:(oe==null?void 0:oe.name)||B})]},B)})})]}),(O==null?void 0:O.dimensions)&&Object.keys(O.dimensions).length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ns,{id:"run-all-variants",checked:V,onCheckedChange:B=>y(!!B)}),n.jsx(q,{htmlFor:"run-all-variants",className:"text-sm",children:"Run all variant combinations"})]}),!V&&n.jsxs("div",{className:"pl-6 space-y-2",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:"Select specific variant:"}),Object.entries(O.dimensions).map(([B,oe])=>n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{className:"text-xs",children:oe.label||B}),n.jsx("div",{className:"flex flex-wrap gap-1",children:oe.options&&Object.entries(oe.options).map(([se,re])=>n.jsx(ue,{variant:v[B]===se?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>L(qe=>({...qe,[B]:se})),children:(re==null?void 0:re.name)||se},se))})]},B))]})]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>S(!1),disabled:P,children:"Cancel"}),n.jsx(T,{onClick:kt,disabled:P,children:P?n.jsxs(n.Fragment,{children:[n.jsx(_t,{className:"h-4 w-4 mr-2 animate-spin"}),"Starting..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Ts,{className:"h-4 w-4 mr-2"}),"Run ",p.size," Scenario(s)"]})})]})]})}),n.jsx(st,{open:W,onOpenChange:J,children:n.jsxs(nt,{children:[n.jsxs(Xe,{children:[n.jsxs(Ze,{className:"text-destructive",children:["Delete All"," ",G==="scenarios"?"Scenarios":"Assets","?"]}),n.jsx(ot,{children:G==="scenarios"?`This will permanently remove all ${r.length} scenarios from your config. This action cannot be undone.`:"This will permanently delete all captured asset files from the output folder. This action cannot be undone."})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>J(!1),children:"Cancel"}),n.jsxs(T,{variant:"destructive",onClick:ae,children:[n.jsx(ps,{className:"h-4 w-4 mr-2"}),"Delete All"]})]})]})})]})}const ud=d.createContext(void 0),hd=d.forwardRef(({className:e,value:t,onValueChange:s,...r},i)=>n.jsx(ud.Provider,{value:{value:t,onValueChange:s},children:n.jsx("div",{ref:i,className:Y("w-full",e),...r})}));hd.displayName="Tabs";const fd=d.forwardRef(({className:e,...t},s)=>n.jsx("div",{ref:s,className:Y("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));fd.displayName="TabsList";const sr=d.forwardRef(({className:e,value:t,...s},r)=>{const i=d.useContext(ud);if(!i)throw new Error("TabsTrigger must be used within Tabs");const a=i.value===t;return n.jsx("button",{ref:r,className:Y("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",a&&"bg-background text-foreground shadow-sm",e),onClick:()=>i.onValueChange(t),...s})});sr.displayName="TabsTrigger";const nr=d.forwardRef(({className:e,value:t,forceMount:s,...r},i)=>{const a=d.useContext(ud);if(!a)throw new Error("TabsContent must be used within Tabs");const o=a.value===t;return!o&&!s?null:n.jsx("div",{ref:i,className:Y("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",!o&&"hidden",e),...r})});nr.displayName="TabsContent";const Ni=d.createContext({open:!1,setOpen:()=>{},containerRef:{current:null}}),$m=({value:e,onValueChange:t,children:s,disabled:r})=>{const[i,a]=d.useState(!1),o=d.useRef(null);return d.useEffect(()=>{if(!i)return;const l=u=>{const m=u.target;o.current&&!o.current.contains(m)&&a(!1)},c=u=>{u.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c)}},[i]),n.jsx(Ni.Provider,{value:{value:e,onValueChange:t,open:i,setOpen:a,containerRef:o},children:n.jsx("div",{ref:o,className:"relative inline-block","data-disabled":r,children:s})})},pd=d.forwardRef(({className:e,children:t,...s},r)=>{const{open:i,setOpen:a}=d.useContext(Ni);return n.jsxs("button",{ref:r,type:"button",onClick:()=>a(!i),className:Y("flex h-9 w-full items-center justify-between rounded-md border border-gray-600 bg-gray-800 px-3 py-2 text-sm text-white ring-offset-background placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...s,children:[t,n.jsx(zs,{className:Y("h-4 w-4 opacity-50 transition-transform ml-2 flex-shrink-0",i&&"rotate-180")})]})});pd.displayName="SelectTrigger";const Vm=({placeholder:e})=>{const{value:t}=d.useContext(Ni);return n.jsx("span",{className:"truncate",children:t||e})},md=d.forwardRef(({className:e,children:t,...s},r)=>{const{open:i}=d.useContext(Ni);return i?n.jsx("div",{ref:r,className:Y("absolute z-[100] mt-1 max-h-60 min-w-full overflow-auto rounded-md border border-gray-600 bg-gray-800 py-1 shadow-lg",e),...s,children:t}):null});md.displayName="SelectContent";const xd=d.forwardRef(({className:e,children:t,value:s,...r},i)=>{const{value:a,onValueChange:o,setOpen:l}=d.useContext(Ni),c=a===s,u=f=>{f.stopPropagation()},m=f=>{f.preventDefault(),f.stopPropagation(),o==null||o(s),l(!1)};return n.jsxs("div",{ref:i,className:Y("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-white outline-none hover:bg-gray-700 focus:bg-gray-700",c&&"bg-gray-700",e),onMouseDown:u,onClick:m,...r,children:[n.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c&&n.jsx(ro,{className:"h-4 w-4"})}),t]})});xd.displayName="SelectItem";function g1({url:e,filename:t,onClose:s}){const[r,i]=d.useState(1),[a,o]=d.useState({x:0,y:0}),[l,c]=d.useState(!1),[u,m]=d.useState({x:0,y:0}),[f,g]=d.useState(0),R=.5,k=5,C=()=>{i(b=>Math.min(b+.25,k))},j=()=>{i(b=>Math.max(b-.25,R))},p=()=>{i(1),o({x:0,y:0}),g(0)},h=()=>{g(b=>(b+90)%360)},x=()=>{const b=document.createElement("a");b.href=e,b.download=t,document.body.appendChild(b),b.click(),document.body.removeChild(b)},w=b=>{r>1&&(c(!0),m({x:b.clientX-a.x,y:b.clientY-a.y}))},N=b=>{l&&r>1&&o({x:b.clientX-u.x,y:b.clientY-u.y})},S=()=>{c(!1)},P=b=>{b.preventDefault();const O=b.deltaY>0?-.1:.1;i(D=>Math.max(R,Math.min(k,D+O)))};return d.useEffect(()=>{const b=O=>{O.key==="Escape"&&s()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[s]),n.jsx(st,{open:!0,onOpenChange:s,children:n.jsx(nt,{className:"max-w-[95vw] max-h-[95vh] p-0 bg-black/95 border-none",children:n.jsxs("div",{className:"relative w-full h-full flex flex-col",children:[n.jsxs("div",{className:"absolute top-0 left-0 right-0 z-10 flex items-center justify-between p-4 bg-black/50 backdrop-blur-sm",children:[n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("span",{className:"text-white text-sm font-medium",children:t})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T,{variant:"ghost",size:"sm",onClick:j,disabled:r<=R,className:"text-white hover:bg-white/20",children:n.jsx(l0,{className:"h-4 w-4"})}),n.jsxs("span",{className:"text-white text-sm min-w-[60px] text-center",children:[Math.round(r*100),"%"]}),n.jsx(T,{variant:"ghost",size:"sm",onClick:C,disabled:r>=k,className:"text-white hover:bg-white/20",children:n.jsx(o0,{className:"h-4 w-4"})}),n.jsx(T,{variant:"ghost",size:"sm",onClick:h,className:"text-white hover:bg-white/20",children:n.jsx(Qy,{className:"h-4 w-4"})}),n.jsx(T,{variant:"ghost",size:"sm",onClick:p,className:"text-white hover:bg-white/20",children:"Reset"}),n.jsx(T,{variant:"ghost",size:"sm",onClick:x,className:"text-white hover:bg-white/20",children:n.jsx(Ay,{className:"h-4 w-4"})}),n.jsx(T,{variant:"ghost",size:"sm",onClick:s,className:"text-white hover:bg-white/20",children:n.jsx(ln,{className:"h-4 w-4"})})]})]}),n.jsx("div",{className:"flex-1 overflow-hidden flex items-center justify-center cursor-move",onMouseDown:w,onMouseMove:N,onMouseUp:S,onMouseLeave:S,onWheel:P,children:n.jsx("img",{src:e,alt:t,className:"max-w-full max-h-full object-contain select-none",style:{transform:`translate(${a.x}px, ${a.y}px) scale(${r}) rotate(${f}deg)`,transition:l?"none":"transform 0.1s"},draggable:!1})})]})})})}function v1({url:e,className:t}){const s=d.useRef(null),[r,i]=d.useState(!1),[a,o]=d.useState(!1),[l,c]=d.useState(!0),u=()=>{s.current&&(r?s.current.pause():s.current.play(),i(!r))},m=()=>{s.current&&(s.current.muted=!a,o(!a))},f=()=>{s.current&&s.current.requestFullscreen&&s.current.requestFullscreen()};return n.jsxs("div",{className:Y("relative group",t),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[n.jsx("video",{ref:s,src:e,className:"w-full h-full object-contain",onPlay:()=>i(!0),onPause:()=>i(!1),onEnded:()=>i(!1),muted:a,playsInline:!0,preload:"metadata"}),l&&n.jsx("div",{className:"absolute inset-0 bg-black/30 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T,{variant:"ghost",size:"sm",onClick:u,className:"text-white hover:bg-white/20",children:r?n.jsx(qy,{className:"h-6 w-6"}):n.jsx(Ts,{className:"h-6 w-6"})}),n.jsx(T,{variant:"ghost",size:"sm",onClick:m,className:"text-white hover:bg-white/20",children:a?n.jsx(i0,{className:"h-4 w-4"}):n.jsx(r0,{className:"h-4 w-4"})}),n.jsx(T,{variant:"ghost",size:"sm",onClick:f,className:"text-white hover:bg-white/20",children:n.jsx(Ky,{className:"h-4 w-4"})})]})})]})}function fo({url:e,filename:t,className:s,size:r="md",showControls:i=!0}){const[a,o]=d.useState(!1),[l,c]=d.useState(!1),[u,m]=d.useState(!0);d.useEffect(()=>{c(!1),m(!0)},[e]);const f=t.toLowerCase().split(".").pop(),g=["png","jpg","jpeg","gif","webp"].includes(f||""),R=["mp4","webm","mov"].includes(f||""),k={sm:"h-16 w-24",md:"h-32 w-48",lg:"h-64 w-96"};return g?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:Y("relative rounded-md border border-border overflow-hidden bg-muted cursor-pointer group",k[r],s),onClick:()=>o(!0),children:[l?n.jsxs("div",{className:"flex items-center justify-center h-full flex-col gap-1",children:[n.jsx(ah,{className:"h-6 w-6 text-muted-foreground"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Failed to load"})]}):n.jsxs(n.Fragment,{children:[u&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted z-10",children:n.jsx(_e,{className:"h-5 w-5 text-muted-foreground animate-spin"})}),n.jsx("img",{src:e,alt:t,className:Y("w-full h-full object-contain transition-opacity",u?"opacity-0":"opacity-100"),loading:"lazy",onLoad:()=>m(!1),onError:()=>{c(!0),m(!1)}})]}),i&&!u&&!l&&n.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center opacity-0 group-hover:opacity-100",children:n.jsx(fn,{className:"h-6 w-6 text-white"})})]}),a&&n.jsx(g1,{url:e,filename:t,onClose:()=>o(!1)})]}):R?r==="sm"?n.jsxs("div",{className:Y("relative rounded-md border border-border overflow-hidden bg-muted group cursor-pointer",k[r],s),children:[n.jsx("video",{src:e,className:"w-full h-full object-contain",preload:"metadata",muted:!0,playsInline:!0}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:n.jsx("div",{className:"rounded-full bg-black/50 p-1",children:n.jsx(Ts,{className:"h-3 w-3 text-white fill-white"})})})]}):n.jsx("div",{className:Y("rounded-md border border-border overflow-hidden bg-muted",k[r],s),children:n.jsx(v1,{url:e,filename:t})}):n.jsx("div",{className:Y("rounded-md border border-border bg-muted flex items-center justify-center",k[r],s),children:n.jsx(ah,{className:"h-8 w-8 text-muted-foreground"})})}const y1=["goto","click","type","hover","wait","waitForSelector","screenshot","clip"];function j1({open:e,onOpenChange:t,step:s,onSave:r,assetUrl:i}){const[a,o]=d.useState({action:"click",selector:"",key:"",text:"",url:"",ms:"",duration:"",clip:null,selectorPadding:null,deviceScaleFactor:null,path:"",order:0});d.useEffect(()=>{o(s?{...a,...s}:{action:"click",selector:"",key:"",text:"",url:"",ms:"",duration:"",clip:null,selectorPadding:null,deviceScaleFactor:null,path:"",order:0})},[s,e]);const l=()=>{const c={action:a.action};if(a.selector&&(c.selector=a.selector),a.key&&(c.key=a.key),a.text&&(c.text=a.text),a.url&&(c.url=a.url),a.ms&&(c.ms=parseInt(a.ms,10)),a.duration&&(c.duration=parseInt(a.duration,10)),a.path&&(c.path=a.path),a.order!==void 0&&(c.order=a.order),a.clip)try{c.clip=typeof a.clip=="string"?JSON.parse(a.clip):a.clip}catch{}a.selectorPadding!==null&&a.selectorPadding!==""&&(c.selectorPadding=parseInt(a.selectorPadding,10)),a.deviceScaleFactor!==null&&a.deviceScaleFactor!==""&&(c.deviceScaleFactor=parseFloat(a.deviceScaleFactor)),r(c)};return n.jsx(st,{open:e,onOpenChange:t,children:n.jsxs(nt,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:s?"Edit Step":"Add Step"}),n.jsx(ot,{children:"Configure the step action and parameters"})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx(q,{htmlFor:"action",children:"Action"}),n.jsx("select",{id:"action",value:a.action,onChange:c=>o({...a,action:c.target.value}),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:y1.map(c=>n.jsx("option",{value:c,children:c},c))})]}),(a.action==="click"||a.action==="type"||a.action==="hover"||a.action==="waitForSelector"||a.action==="screenshot")&&n.jsxs("div",{children:[n.jsx(q,{htmlFor:"selector",children:"Selector"}),n.jsx(ve,{id:"selector",value:a.selector||"",onChange:c=>o({...a,selector:c.target.value}),placeholder:"#id, .class, [data-testid]"})]}),a.action==="type"&&n.jsxs("div",{children:[n.jsx(q,{htmlFor:"text",children:"Text"}),n.jsx(ve,{id:"text",value:a.text||"",onChange:c=>o({...a,text:c.target.value}),placeholder:"Text to type"})]}),a.action==="goto"&&n.jsxs("div",{children:[n.jsx(q,{htmlFor:"url",children:"URL"}),n.jsx(ve,{id:"url",value:a.url||"",onChange:c=>o({...a,url:c.target.value}),placeholder:"https://example.com"})]}),a.action==="wait"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx(q,{htmlFor:"ms",children:"Milliseconds"}),n.jsx(ve,{id:"ms",type:"number",value:a.ms||"",onChange:c=>o({...a,ms:c.target.value}),placeholder:"1000"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"duration",children:"Duration (alternative)"}),n.jsx(ve,{id:"duration",type:"number",value:a.duration||"",onChange:c=>o({...a,duration:c.target.value}),placeholder:"1000"})]})]}),(a.action==="screenshot"||a.action==="clip")&&n.jsxs(n.Fragment,{children:[i&&n.jsxs("div",{children:[n.jsx(q,{children:"Asset Preview"}),n.jsx("div",{className:"mt-2",children:n.jsx(fo,{url:i,filename:a.path||`${a.key||"asset"}.png`,size:"md"})})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"key",children:"Key"}),n.jsx(ve,{id:"key",value:a.key||"",onChange:c=>o({...a,key:c.target.value}),placeholder:"capture-key"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"path",children:"Path"}),n.jsx(ve,{id:"path",value:a.path||"",onChange:c=>o({...a,path:c.target.value}),placeholder:"screenshot.png"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"clip",children:"Clip (JSON)"}),n.jsx(uo,{id:"clip",value:typeof a.clip=="object"?JSON.stringify(a.clip,null,2):a.clip||"",onChange:c=>o({...a,clip:c.target.value}),placeholder:'{"x": 0, "y": 0, "width": 800, "height": 600}',className:"font-mono text-sm"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"selectorPadding",children:"Selector Padding"}),n.jsx(ve,{id:"selectorPadding",type:"number",value:a.selectorPadding||"",onChange:c=>o({...a,selectorPadding:c.target.value}),placeholder:"0"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"deviceScaleFactor",children:"Device Scale Factor"}),n.jsx(ve,{id:"deviceScaleFactor",type:"number",step:"0.1",value:a.deviceScaleFactor||"",onChange:c=>o({...a,deviceScaleFactor:c.target.value}),placeholder:"1.0"})]})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"order",children:"Order"}),n.jsx(ve,{id:"order",type:"number",value:a.order||0,onChange:c=>o({...a,order:parseInt(c.target.value,10)||0})})]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(T,{onClick:l,children:[s?"Update":"Add"," Step"]})]})]})})}const w1=({open:e,children:t})=>(d.useEffect(()=>{if(e){const s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}}},[e]),e?n.jsx(n.Fragment,{children:t}):null),N1={top:"inset-x-0 top-0 border-b animate-in slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t animate-in slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r animate-in slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l animate-in slide-in-from-right sm:max-w-lg"},Um=d.forwardRef(({side:e="right",className:t,children:s,onOpenChange:r},i)=>{const a=d.useCallback(l=>{l.stopPropagation(),r==null||r(!1)},[r]),o=d.useCallback(l=>{l.stopPropagation()},[]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 animate-in fade-in-0",onClick:a}),n.jsxs("div",{ref:i,className:Y("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out duration-300",N1[e],t),onClick:o,children:[s,n.jsxs("button",{onClick:()=>r==null?void 0:r(!1),className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[n.jsx(ln,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});Um.displayName="SheetContent";const Bm=({className:e,...t})=>n.jsx("div",{className:Y("flex flex-col space-y-2 text-center sm:text-left",e),...t});Bm.displayName="SheetHeader";const Wm=({className:e,children:t,...s})=>n.jsx("h2",{className:Y("text-lg font-semibold text-foreground",e),...s,children:t});Wm.displayName="SheetTitle";const Km=({className:e,children:t,...s})=>n.jsx("p",{className:Y("text-sm text-muted-foreground",e),...s,children:t});Km.displayName="SheetDescription";function k1({open:e,onOpenChange:t,asset:s,scenarioKey:r,variationSlug:i,allAssets:a=[],onNavigate:o}){var V;const{toast:l}=Pt(),[c,u]=d.useState(null),[m,f]=d.useState(!1),[g,R]=d.useState(!1),k=d.useRef(a),C=d.useRef(o),j=d.useRef(t);d.useEffect(()=>{k.current=a,C.current=o,j.current=t});const p=(s==null?void 0:s.captureKey)||(s==null?void 0:s.filename.replace(/\.[^/.]+$/,"")),h=a.findIndex(y=>y.filename===(s==null?void 0:s.filename)),x=h>0,w=h<a.length-1&&h>=0,N=d.useRef({currentIndex:h,hasPrev:x,hasNext:w});d.useEffect(()=>{N.current={currentIndex:h,hasPrev:x,hasNext:w}}),d.useEffect(()=>{f(!1),R(!1)},[s==null?void 0:s.url]);const S=d.useRef(null);d.useEffect(()=>{!r||!e||S.current!==r&&(S.current=r,fetch(`/api/config/scenarios/${r}`).then(y=>y.json()).then(y=>{const _=y.scenario;if(_!=null&&_.steps){const F=_.steps.findIndex($=>{var E;return $.key===p||$.captureKey===p||((E=$.path)==null?void 0:E.replace(/\.[^/.]+$/,""))===p});u(F!==-1?{step:_.steps[F],index:F}:null)}}).catch(()=>{u(null)}))},[r,e]);const P=d.useCallback(()=>{const{currentIndex:y,hasPrev:_}=N.current,F=k.current,$=C.current;_&&$&&F[y-1]&&$(F[y-1])},[]),b=d.useCallback(()=>{const{currentIndex:y,hasNext:_}=N.current,F=k.current,$=C.current;_&&$&&F[y+1]&&$(F[y+1])},[]),O=d.useCallback(()=>{var y;(y=j.current)==null||y.call(j,!1)},[]);d.useEffect(()=>{if(!e)return;const y=_=>{if(_.key==="Escape"){_.preventDefault(),_.stopPropagation(),O();return}_.key==="ArrowLeft"?(_.preventDefault(),_.stopPropagation(),P()):_.key==="ArrowRight"&&(_.preventDefault(),_.stopPropagation(),b())};return window.addEventListener("keydown",y,!0),()=>{window.removeEventListener("keydown",y,!0)}},[e,P,b,O]);const D=y=>y<1024?`${y} B`:y<1024*1024?`${(y/1024).toFixed(1)} KB`:`${(y/(1024*1024)).toFixed(1)} MB`,v=()=>{s!=null&&s.path&&(navigator.clipboard.writeText(s.path),l({title:"Copied",description:"File path copied to clipboard",variant:"success"}))},L=()=>{if(s!=null&&s.url){const y=`${window.location.origin}${s.url}`;navigator.clipboard.writeText(y),l({title:"Copied",description:"Asset URL copied to clipboard",variant:"success"})}};return s?n.jsx(w1,{open:e,onOpenChange:t,children:n.jsxs(Um,{side:"right",className:"w-full sm:max-w-2xl overflow-y-auto",onOpenChange:t,children:[n.jsxs(Bm,{children:[n.jsxs(Wm,{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate",children:s.filename}),s.diff&&n.jsxs(n.Fragment,{children:[s.diff.status==="new"&&n.jsx(ue,{variant:"success",className:"text-xs",children:"New"}),s.diff.status==="changed"&&n.jsx(ue,{variant:"warning",className:"text-xs",children:s.diff.score!==void 0?`${(s.diff.score*100).toFixed(1)}% diff`:"Changed"}),s.diff.status==="unchanged"&&n.jsx(ue,{variant:"approved",className:"text-xs",children:"Match"})]})]}),n.jsxs(Km,{children:[r," / ",i,a.length>1&&n.jsxs("span",{className:"ml-2",children:["(",h+1," of ",a.length,")"]})]})]}),a.length>1&&o&&n.jsxs("div",{className:"flex items-center justify-between my-4",children:[n.jsxs(T,{variant:"outline",size:"sm",onClick:P,disabled:!x,children:[n.jsx(_y,{className:"h-4 w-4 mr-1"}),"Previous"]}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Use ← → arrow keys to navigate"}),n.jsxs(T,{variant:"outline",size:"sm",onClick:b,disabled:!w,children:["Next",n.jsx(Ps,{className:"h-4 w-4 ml-1"})]})]}),n.jsxs("div",{className:"mt-4 space-y-4",children:[n.jsxs("div",{className:"relative rounded-lg border bg-muted overflow-hidden",children:[!m&&!g&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Loading..."})}),g?n.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:"Failed to load image"}):n.jsx("img",{src:s.url,alt:s.filename,className:Y("w-full h-auto max-h-[50vh] object-contain transition-opacity",m?"opacity-100":"opacity-0"),onLoad:()=>f(!0),onError:()=>R(!0)})]}),n.jsxs("div",{className:"flex gap-2 flex-wrap",children:[n.jsxs(T,{variant:"outline",size:"sm",onClick:v,children:[n.jsx(rn,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy Path"]}),n.jsxs(T,{variant:"outline",size:"sm",onClick:L,children:[n.jsx(rn,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy URL"]}),n.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground",children:[n.jsx(an,{className:"h-3.5 w-3.5"}),"Open Full Size"]})]}),n.jsxs("div",{className:"space-y-3 border-t pt-4",children:[n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"File Size"}),n.jsx("div",{className:"text-sm font-medium mt-0.5",children:D(s.size)})]}),n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Modified"}),n.jsx("div",{className:"text-sm font-medium mt-0.5",children:new Date(s.mtime).toLocaleString()})]}),p&&n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Capture Key"}),n.jsx("code",{className:"block text-sm font-mono bg-muted px-2 py-1 rounded mt-0.5",children:p})]}),n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"File Path"}),n.jsx("div",{className:"text-xs font-mono bg-muted px-2 py-1 rounded mt-0.5 break-all",children:s.relativePath})]}),c&&n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Linked Step"}),n.jsx("div",{className:"mt-1",children:n.jsxs("div",{className:"inline-flex items-center gap-1.5 text-sm",children:[n.jsx(Rn,{className:"h-3.5 w-3.5 text-primary"}),"Step #",c.index+1,": ",c.step.action]})}),c.step.selector&&n.jsx("div",{className:"text-xs font-mono bg-muted px-2 py-1 rounded mt-1",children:c.step.selector})]})]}),((V=s.diff)==null?void 0:V.diffUrl)&&n.jsxs("div",{className:"space-y-2 border-t pt-4",children:[n.jsxs(q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n.jsx(Qp,{className:"h-3.5 w-3.5 text-yellow-500"}),"Visual Diff"]}),n.jsx("div",{className:"rounded-lg border overflow-hidden",children:n.jsx("img",{src:s.diff.diffUrl,alt:"Visual diff",className:"w-full h-auto"})})]})]})]})}):null}function b1({scenarioKey:e}){const[t,s]=d.useState([]),[r,i]=d.useState([]),[a,o]=d.useState(!0),[l,c]=d.useState(null),[u,m]=d.useState(null),[f,g]=d.useState(null),[R,k]=d.useState(!1),[C,j]=d.useState(new Set);d.useEffect(()=>{if(!e){o(!1);return}fetch(`/api/output/${e}/versions`).then(v=>v.json()).then(v=>{const L=v.versions||[];i(L),L.length>0?c(L[0].timestamp):o(!1)}).catch(v=>{console.error("Failed to load versions:",v),o(!1)})},[e]),d.useEffect(()=>{!e||!l||(o(!0),fetch(`/api/output/${e}/version/${l}`).then(v=>v.json()).then(v=>{s(v.assets||[]),m(v.diffManifest||null),o(!1)}).catch(v=>{console.error("Failed to load assets:",v),o(!1)}))},[e,l]);const p=d.useMemo(()=>t.filter(v=>!v.isSentinel),[t]),{images:h,videos:x,stepsByVariant:w}=d.useMemo(()=>{var y;const v=p.filter(_=>_.filename.endsWith(".png")||_.filename.endsWith(".jpg")||_.filename.endsWith(".jpeg")||_.filename.endsWith(".webp")),L=p.filter(_=>_.filename.endsWith(".mp4")||_.filename.endsWith(".webm")),V={};for(const _ of v){const F=((y=_.assetKey)==null?void 0:y.split("/"))||[];let $="default";F.length>1&&($=F.slice(0,-1).join("/"));const E=_.filename.match(/(step-\d+)/),A=E?E[1]:"other";V[$]||(V[$]={}),V[$][A]||(V[$][A]=[]),V[$][A].push(_)}return{images:v,videos:L,stepsByVariant:V}},[p]),N=Object.keys(w).sort(),S=p.length,P=d.useCallback(v=>{j(L=>{const V=new Set(L);return V.has(v)?V.delete(v):V.add(v),V})},[]),b=d.useCallback(v=>{g(v),k(!0)},[]),O=d.useCallback(v=>{g(v)},[]),D=d.useCallback(v=>{k(v),v||g(null)},[]);return a?n.jsx("div",{className:"text-muted-foreground text-center py-4 text-sm",children:"Loading assets..."}):S===0&&r.length===0?n.jsx("div",{className:"text-center text-muted-foreground py-6 text-sm",children:n.jsx("p",{children:"No assets found. Run the scenario to generate assets."})}):n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Uy,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs($m,{value:l||"",onValueChange:c,children:[n.jsx(pd,{className:"h-8 w-[200px] text-xs",children:n.jsx(Vm,{placeholder:"Select version"})}),n.jsx(md,{children:r.map(v=>n.jsxs(xd,{value:v.timestamp,className:"text-xs",children:[v.label," ",v.isLatest&&"(Latest)"," · ",v.assetCount]},v.timestamp))})]})]}),n.jsxs("div",{className:"flex gap-1.5 flex-wrap",children:[n.jsxs(ue,{variant:"secondary",className:"text-xs h-6",children:[n.jsx(fn,{className:"h-3 w-3 mr-1"}),h.length]}),x.length>0&&n.jsxs(ue,{variant:"secondary",className:"text-xs h-6",children:[n.jsx(_n,{className:"h-3 w-3 mr-1"}),x.length]}),(u==null?void 0:u.summary)&&n.jsxs(n.Fragment,{children:[u.summary.new>0&&n.jsxs(ue,{variant:"info",className:"text-xs h-6",children:["+",u.summary.new]}),u.summary.changed>0&&n.jsxs(ue,{variant:"warning",className:"text-xs h-6",children:["⚠",u.summary.changed]}),u.summary.unchanged>0&&n.jsxs(ue,{variant:"approved",className:"text-xs h-6",children:["✓",u.summary.unchanged]})]})]})]}),l&&h.length>0&&n.jsx("div",{className:"space-y-2",children:N.map(v=>{const L=w[v],V=Object.keys(L).sort((F,$)=>{var z,W;const E=parseInt(((z=F.match(/\d+/))==null?void 0:z[0])||"0"),A=parseInt(((W=$.match(/\d+/))==null?void 0:W[0])||"0");return E-A}),y=C.has(v),_=Object.values(L).flat().length;return n.jsxs("div",{className:"border rounded-lg bg-card",children:[n.jsxs("button",{onClick:()=>P(v),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-accent/50 transition-colors",children:[y?n.jsx(Ps,{className:"h-4 w-4 text-muted-foreground"}):n.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),n.jsx(Xp,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-sm",children:v==="default"?"Default":v.replace(/_/g," / ").replace(/-/g,": ")}),n.jsxs(ue,{variant:"outline",className:"text-xs ml-auto",children:[_," assets"]})]}),!y&&n.jsx("div",{className:"px-3 pb-3",children:n.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:V.map(F=>{const $=L[F];return n.jsxs("div",{className:"flex-shrink-0 space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground text-center",children:F==="other"?"Other":F.replace("-"," ")}),n.jsx("div",{className:"flex gap-1",children:$.map((E,A)=>{const z=E.diff,W=E.filename.includes("after");return n.jsxs("div",{onClick:()=>b(E),className:Y("relative cursor-pointer rounded overflow-hidden border transition-all hover:ring-2 hover:ring-primary",(z==null?void 0:z.status)==="changed"&&"border-yellow-500",(z==null?void 0:z.status)==="new"&&"border-blue-500",(z==null?void 0:z.status)==="unchanged"&&"border-green-500/50"),style:{width:100,height:64},children:[n.jsx("img",{src:E.url,alt:E.filename,className:"w-full h-full object-cover",loading:"lazy"}),z&&n.jsxs("div",{className:"absolute top-0.5 right-0.5",children:[z.status==="new"&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),z.status==="changed"&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-500"})]}),n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[9px] text-center text-white py-0.5",children:W?"after":"before"})]},A)})})]},F)})})})]},v)})}),x.length>0&&n.jsxs("div",{className:"border rounded-lg bg-card p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(_n,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-sm",children:"Videos"}),n.jsx(ue,{variant:"outline",className:"text-xs",children:x.length})]}),n.jsx("div",{className:"flex gap-2 overflow-x-auto",children:x.map((v,L)=>n.jsxs("div",{onClick:()=>b(v),className:"flex-shrink-0 cursor-pointer rounded overflow-hidden border hover:ring-2 hover:ring-primary transition-all",style:{width:160},children:[n.jsx(fo,{url:v.url,filename:v.filename,size:"sm",showControls:!1}),n.jsx("div",{className:"p-1.5 text-xs truncate text-muted-foreground",children:v.filename})]},L))})]}),l&&p.length===0&&n.jsx("div",{className:"text-center text-muted-foreground py-4 text-sm",children:"No assets for this version."}),n.jsx(k1,{open:R,onOpenChange:D,asset:f,scenarioKey:e,variationSlug:l||"default",allAssets:h,onNavigate:O})]})}const S1=d.memo(b1);function C1({stepCount:e,assetCount:t=0,hasAssets:s=!1,lastPublishAt:r}){const i=e>0,a=s,o=!!r;return n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsxs("div",{className:Y("flex items-center gap-1 px-2 py-1 rounded-full border",i?"bg-green-500/10 border-green-500/30 text-green-500":"bg-muted/50 border-border text-muted-foreground"),children:[i?n.jsx(vt,{className:"h-3 w-3"}):n.jsx(na,{className:"h-3 w-3"}),n.jsx(Rn,{className:"h-3 w-3"}),n.jsxs("span",{children:[e," steps"]})]}),n.jsx("span",{className:"text-muted-foreground",children:"→"}),n.jsxs("div",{className:Y("flex items-center gap-1 px-2 py-1 rounded-full border",a?"bg-green-500/10 border-green-500/30 text-green-500":"bg-muted/50 border-border text-muted-foreground"),children:[a?n.jsx(vt,{className:"h-3 w-3"}):n.jsx(na,{className:"h-3 w-3"}),n.jsx(fn,{className:"h-3 w-3"}),n.jsxs("span",{children:[t," assets"]})]}),n.jsx("span",{className:"text-muted-foreground",children:"→"}),n.jsxs("div",{className:Y("flex items-center gap-1 px-2 py-1 rounded-full border",o?"bg-green-500/10 border-green-500/30 text-green-500":"bg-muted/50 border-border text-muted-foreground"),children:[o?n.jsx(vt,{className:"h-3 w-3"}):n.jsx(na,{className:"h-3 w-3"}),n.jsx(on,{className:"h-3 w-3"}),n.jsx("span",{children:o?"Published":"Not published"})]})]})}const E1={locale:n.jsx(ur,{className:"h-4 w-4"}),role:n.jsx(xr,{className:"h-4 w-4"}),theme:n.jsx(Xc,{className:"h-4 w-4"})};function R1({variantsConfig:e,value:t,preset:s,onChange:r}){var x;const[i,a]=d.useState(s?"preset":"custom"),[o,l]=d.useState(!1),c=(e==null?void 0:e.dimensions)||{},u=(e==null?void 0:e.presets)||{},m=Object.keys(c),f=Object.keys(u),g=i==="preset"&&s&&((x=u[s])!=null&&x.values)?u[s].values:t||{},R=()=>{var N,S;const w=[];if(!g||typeof g!="object")return w;for(const[P,b]of Object.entries(g)){const O=(S=(N=c[P])==null?void 0:N.options)==null?void 0:S[b];if(O!=null&&O.inject)for(const D of O.inject)switch(D.method){case"localStorage":w.push({method:"localStorage",details:`${D.key} = "${D.value}"`});break;case"sessionStorage":w.push({method:"sessionStorage",details:`${D.key} = "${D.value}"`});break;case"cookie":w.push({method:"cookie",details:`${D.name} = "${D.value}"`});break;case"urlParam":w.push({method:"URL param",details:`?${D.param}=${D.value}`});break;case"browser":D.locale&&w.push({method:"browser",details:`locale: ${D.locale}`}),D.timezone&&w.push({method:"browser",details:`timezone: ${D.timezone}`});break;case"header":w.push({method:"HTTP header",details:`${D.header}: ${D.value}`});break;case"script":w.push({method:"script",details:"Custom JS"});break}}return w},k=(w,N)=>{const S={...t,[w]:N};a("custom"),r(S,void 0)},C=w=>{a("preset"),r({},w)},j=()=>{a("custom"),r({},void 0)},p=Object.keys(g).length>0||s,h=R();return m.length===0&&f.length===0?n.jsx(he,{className:"bg-gray-800/50 border-gray-700",children:n.jsxs(me,{className:"py-6 text-center text-gray-400",children:[n.jsx(Kr,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),n.jsx("p",{className:"text-sm",children:"No variant dimensions configured."}),n.jsx("p",{className:"text-xs mt-1",children:"Add dimensions in docsync.config.json under variants.dimensions"})]})}):n.jsxs("div",{className:"space-y-4",children:[f.length>0&&n.jsxs(hd,{value:i,onValueChange:w=>a(w),children:[n.jsxs(fd,{className:"grid w-full grid-cols-2",children:[n.jsxs(sr,{value:"preset",children:[n.jsx(a0,{className:"h-3 w-3 mr-1"}),"Preset"]}),n.jsxs(sr,{value:"custom",children:[n.jsx(Kr,{className:"h-3 w-3 mr-1"}),"Custom"]})]}),n.jsx(nr,{value:"preset",className:"mt-4",children:n.jsx("div",{className:"grid gap-2",children:f.map(w=>{const N=u[w];if(!N)return null;const S=s===w,P=N.values||{};return n.jsxs("button",{onClick:()=>C(w),className:`w-full text-left p-3 rounded-lg border transition-colors ${S?"bg-blue-500/20 border-blue-500":"bg-gray-800 border-gray-700 hover:border-gray-600"}`,children:[n.jsx("div",{className:"font-medium text-sm",children:N.name||w}),N.description&&n.jsx("div",{className:"text-xs text-gray-400 mt-1",children:N.description}),n.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:Object.entries(P).map(([b,O])=>{var D,v,L,V;return n.jsxs(ue,{variant:"secondary",className:"text-xs",children:[((D=c[b])==null?void 0:D.label)||b,":"," ",((V=(L=(v=c[b])==null?void 0:v.options)==null?void 0:L[O])==null?void 0:V.name)||O]},b)})})]},w)})})}),n.jsx(nr,{value:"custom",className:"mt-4",children:n.jsx(jh,{dimensions:c,values:t,onChange:k})})]}),f.length===0&&n.jsx(jh,{dimensions:c,values:t,onChange:k}),p&&n.jsxs(he,{className:"bg-gray-800/50 border-gray-700",children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(be,{className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(Kr,{className:"h-4 w-4"}),"Active Variant"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(T,{variant:"ghost",size:"sm",onClick:()=>l(!o),className:"h-7 px-2",children:[o?n.jsx(Yc,{className:"h-3 w-3"}):n.jsx(zs,{className:"h-3 w-3"}),o?"Hide":"Show"," Details"]}),n.jsx(T,{variant:"ghost",size:"sm",onClick:j,className:"h-7 px-2 text-gray-400 hover:text-white",children:"Clear"})]})]})}),o&&h.length>0&&n.jsxs(me,{className:"py-3 px-4 border-t border-gray-700",children:[n.jsx("div",{className:"text-xs text-gray-400 mb-2",children:"Injections that will be applied:"}),n.jsx("div",{className:"space-y-1",children:h.map((w,N)=>n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsx(ue,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:w.method}),n.jsx("code",{className:"text-gray-300",children:w.details})]},N))})]})]})]})}function jh({dimensions:e,values:t,onChange:s}){return!e||typeof e!="object"?null:n.jsx("div",{className:"space-y-4",children:Object.entries(e).map(([r,i])=>!(i!=null&&i.options)||typeof i.options!="object"?null:n.jsxs("div",{children:[n.jsxs(q,{className:"flex items-center gap-2 mb-2",children:[E1[r]||n.jsx(Kr,{className:"h-4 w-4"}),i.label]}),i.description&&n.jsx("p",{className:"text-xs text-gray-400 mb-2",children:i.description}),n.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[n.jsx("button",{onClick:()=>{({...t},s(r,""))},className:`p-2 rounded-md border text-sm transition-colors ${t[r]?"bg-gray-800 border-gray-700 hover:border-gray-600":"bg-gray-700 border-gray-500"}`,children:"Default"}),Object.entries(i.options).map(([a,o])=>n.jsx("button",{onClick:()=>s(r,a),className:`p-2 rounded-md border text-sm transition-colors ${t[r]===a?"bg-blue-500/20 border-blue-500":"bg-gray-800 border-gray-700 hover:border-gray-600"}`,children:(o==null?void 0:o.name)||a},a))]})]},r))})}function _1({scenarioKey:e,className:t,showActions:s=!0,onStatusChange:r}){const[i,a]=d.useState(null),[o,l]=d.useState(!1),c=d.useCallback(async()=>{var m,f;try{const k=((f=(m=(await(await fetch("/api/workspace")).json()).workspace)==null?void 0:m.scenarios)==null?void 0:f.includes(e))||!1;a(k)}catch{a(!1)}},[e]);d.useEffect(()=>{c()},[c]);const u=async()=>{l(!0);try{i?(await fetch(`/api/workspace/scenarios/${encodeURIComponent(e)}`,{method:"DELETE"}),a(!1),r==null||r(!1)):(await fetch("/api/workspace/scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:[e]})}),a(!0),r==null||r(!0))}catch{c()}finally{l(!1)}};return i===null?null:n.jsxs("div",{className:Y("flex items-center gap-1.5",t),children:[n.jsx(ue,{variant:i?"default":"secondary",className:Y("text-[10px] h-5 px-2 font-medium",i&&"bg-primary/90"),children:i?"In Workspace":"Not in Workspace"}),s&&n.jsx(T,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:u,disabled:o,title:i?"Remove from workspace":"Add to workspace",children:o?n.jsx(_e,{className:"h-3.5 w-3.5 animate-spin"}):i?n.jsx(Iy,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-destructive"}):n.jsx(Dy,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})]})}function P1({open:e,onOpenChange:t,imageUrl:s,currentCrop:r,onSave:i,scenarioName:a}){const o=d.useRef(null),l=d.useRef(null),[c,u]=d.useState(!1),[m,f]=d.useState(!1),[g,R]=d.useState(null),[k,C]=d.useState({x:0,y:0}),[j,p]=d.useState(null),[h,x]=d.useState((r==null?void 0:r.region)||null),[w,N]=d.useState(!1),[S,P]=d.useState(!1);d.useEffect(()=>{e&&(N(!1),P(!1),p(null),x((r==null?void 0:r.region)||null))},[e,r]);const b=d.useCallback((_,F)=>{if(!l.current||!o.current)return{x:0,y:0};const $=l.current.getBoundingClientRect(),E=o.current.getBoundingClientRect(),A=l.current.naturalWidth/$.width,z=l.current.naturalHeight/$.height,W=_-($.left-E.left),J=F-($.top-E.top);return{x:Math.round(W*A),y:Math.round(J*z)}},[]);d.useEffect(()=>{if(w&&(r!=null&&r.region)&&l.current&&o.current){const _=l.current.getBoundingClientRect(),F=o.current.getBoundingClientRect(),$=_.width/l.current.naturalWidth,E=_.height/l.current.naturalHeight,A=_.left-F.left,z=_.top-F.top;p({left:A+r.region.x*$,top:z+r.region.y*E,width:r.region.width*$,height:r.region.height*E}),x(r.region)}},[w,r]);const O=_=>{if(!o.current)return;const F=_.target,$=o.current.getBoundingClientRect(),E=_.clientX-$.left,A=_.clientY-$.top;if(F.dataset.handle){f(!0),R(F.dataset.handle),C({x:_.clientX,y:_.clientY});return}u(!0),C({x:E,y:A}),p({left:E,top:A,width:0,height:0})},D=_=>{if(!o.current)return;const F=o.current.getBoundingClientRect();if(c){const $=_.clientX-F.left,E=_.clientY-F.top,A=$-k.x,z=E-k.y;p({left:A<0?$:k.x,top:z<0?E:k.y,width:Math.abs(A),height:Math.abs(z)})}else if(m&&j&&g){const $=_.clientX-k.x,E=_.clientY-k.y;let A={...j};g.includes("e")&&(A.width=Math.max(10,j.width+$)),g.includes("w")&&(A.left=j.left+$,A.width=Math.max(10,j.width-$)),g.includes("s")&&(A.height=Math.max(10,j.height+E)),g.includes("n")&&(A.top=j.top+E,A.height=Math.max(10,j.height-E)),p(A),C({x:_.clientX,y:_.clientY})}},v=()=>{if((c||m)&&j&&j.width>5&&j.height>5){const _=b(j.left,j.top),F=b(j.left+j.width,j.top+j.height);x({x:Math.max(0,_.x),y:Math.max(0,_.y),width:Math.max(1,F.x-_.x),height:Math.max(1,F.y-_.y)})}u(!1),f(!1),R(null)},L=()=>{p(null),x(null)},V=()=>{h&&h.width>0&&h.height>0?i({enabled:!0,region:h}):i(null),t(!1)},y=()=>{i(null),t(!1)};return n.jsx(st,{open:e,onOpenChange:t,children:n.jsxs(nt,{className:"max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[n.jsxs(Xe,{children:[n.jsxs(Ze,{className:"flex items-center gap-2",children:[n.jsx(ra,{className:"h-5 w-5"}),"Configure Crop Region"]}),n.jsx(ot,{children:a?`Drag to select the crop region for "${a}". This will apply to all captures.`:"Drag to select the crop region. This will apply to all captures."})]}),n.jsxs("div",{className:"flex-1 min-h-0 py-4",children:[s?S?n.jsx("div",{className:"flex items-center justify-center h-64 bg-muted rounded-lg",children:n.jsxs("div",{className:"text-center text-muted-foreground",children:[n.jsx(Jt,{className:"h-8 w-8 mx-auto mb-2"}),n.jsx("p",{className:"text-sm",children:"Failed to load image."})]})}):n.jsxs("div",{ref:o,className:"relative mx-auto select-none overflow-auto max-h-[50vh] border rounded-lg bg-zinc-900",style:{cursor:c?"crosshair":"default"},onMouseDown:O,onMouseMove:D,onMouseUp:v,onMouseLeave:v,children:[n.jsx("img",{ref:l,src:s,alt:"Reference screenshot",className:"block max-w-full",style:{maxHeight:"50vh"},onLoad:()=>N(!0),onError:()=>P(!0),draggable:!1}),j&&j.width>0&&j.height>0&&n.jsxs("div",{className:"absolute border-2 border-green-500 bg-green-500/10 pointer-events-none",style:{left:j.left,top:j.top,width:j.width,height:j.height,boxShadow:"0 0 0 9999px rgba(0, 0, 0, 0.5)"},children:[n.jsx("div",{"data-handle":"nw",className:"absolute -left-1.5 -top-1.5 w-3 h-3 bg-green-500 border border-white cursor-nw-resize pointer-events-auto"}),n.jsx("div",{"data-handle":"ne",className:"absolute -right-1.5 -top-1.5 w-3 h-3 bg-green-500 border border-white cursor-ne-resize pointer-events-auto"}),n.jsx("div",{"data-handle":"sw",className:"absolute -left-1.5 -bottom-1.5 w-3 h-3 bg-green-500 border border-white cursor-sw-resize pointer-events-auto"}),n.jsx("div",{"data-handle":"se",className:"absolute -right-1.5 -bottom-1.5 w-3 h-3 bg-green-500 border border-white cursor-se-resize pointer-events-auto"}),n.jsx("div",{"data-handle":"n",className:"absolute left-1/2 -translate-x-1/2 -top-1.5 w-3 h-3 bg-green-500 border border-white cursor-n-resize pointer-events-auto"}),n.jsx("div",{"data-handle":"s",className:"absolute left-1/2 -translate-x-1/2 -bottom-1.5 w-3 h-3 bg-green-500 border border-white cursor-s-resize pointer-events-auto"}),n.jsx("div",{"data-handle":"w",className:"absolute -left-1.5 top-1/2 -translate-y-1/2 w-3 h-3 bg-green-500 border border-white cursor-w-resize pointer-events-auto"}),n.jsx("div",{"data-handle":"e",className:"absolute -right-1.5 top-1/2 -translate-y-1/2 w-3 h-3 bg-green-500 border border-white cursor-e-resize pointer-events-auto"})]})]}):n.jsx("div",{className:"flex items-center justify-center h-64 bg-muted rounded-lg",children:n.jsxs("div",{className:"text-center text-muted-foreground",children:[n.jsx(Jt,{className:"h-8 w-8 mx-auto mb-2"}),n.jsx("p",{className:"text-sm",children:"No reference image available."}),n.jsx("p",{className:"text-xs mt-1",children:"Run the scenario first to capture an image."})]})}),h&&n.jsxs("div",{className:"mt-3 p-2 bg-muted rounded text-xs font-mono text-center",children:["Crop: x=",h.x,", y=",h.y,", ",h.width,"×",h.height,"px"]})]}),n.jsxs(lt,{className:"flex-shrink-0 gap-2",children:[(r==null?void 0:r.enabled)&&n.jsxs(T,{variant:"outline",onClick:y,className:"mr-auto",children:[n.jsx(ln,{className:"h-4 w-4 mr-2"}),"Disable Crop"]}),n.jsxs(T,{variant:"outline",onClick:L,disabled:!j,children:[n.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Reset"]}),n.jsx(T,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),n.jsxs(T,{onClick:V,disabled:!s||!h&&!(r!=null&&r.enabled),children:[n.jsx(ro,{className:"h-4 w-4 mr-2"}),"Save Crop"]})]})]})})}const wh="reshot-scenario-tab";function T1(){var mn,gd,vd,yd,jd,wd,Nd,kd,bd,Sd,Cd,Ed,Rd,_d,Pd,Td,Ad,Od,zd,Ld,Md,Id,Dd,Fd,$d;const{key:e}=Kp(),t=Os(),[s]=ky(),{trackJob:r}=ji(),[i,a]=d.useState(null),[o,l]=d.useState({}),[c,u]=d.useState(!0),[m,f]=d.useState(!1),g=e??"",R=()=>{const M=s.get("tab");if(M&&["details","steps","assets"].includes(M))return M;const Q=localStorage.getItem(wh);return Q&&["details","steps","assets"].includes(Q)?Q:"details"},[k,C]=d.useState(R),[j,p]=d.useState(null),[h,x]=d.useState(!1),[w,N]=d.useState(!1),[S,P]=d.useState(!1),[b,O]=d.useState(!1),[D,v]=d.useState("step-by-step-images"),[L,V]=d.useState({}),[y,_]=d.useState(!1),[F,$]=d.useState(null),[E,A]=d.useState(!0),[z,W]=d.useState(null),[J,G]=d.useState(null),[fe,ye]=d.useState(!1),[ge,Re]=d.useState(!1),[U,X]=d.useState({}),[Z,ce]=d.useState([]),[ie,ae]=d.useState(0),[Se,Ie]=d.useState(!1),[mt,Nt]=d.useState(!1),[Ft,Yt]=d.useState(null),[$t,kt]=d.useState(!1),[Tt,Vt]=d.useState(0),{toast:je}=Pt();d.useEffect(()=>{fetch("/api/settings").then(M=>M.json()).then(M=>{var Q;Yt(((Q=M.settings)==null?void 0:Q.isAuthenticated)||!1)}).catch(()=>Yt(!1)),fetch("/api/config").then(M=>M.json()).then(M=>{var Q,le;A(((le=(Q=M.config)==null?void 0:Q.diffing)==null?void 0:le.enabled)!==!1)}).catch(()=>{}),fetch("/api/privacy").then(M=>M.json()).then(M=>{var Q;return ye(M.enabled&&((Q=M.selectors)==null?void 0:Q.length)>0)}).catch(()=>{}),fetch("/api/style").then(M=>M.json()).then(M=>Re(M.enabled!==!1)).catch(()=>{})},[]);const B=d.useCallback(M=>{C(M),localStorage.setItem(wh,M)},[]);d.useEffect(()=>{const M=s.get("tab");M&&["details","steps","assets"].includes(M)&&C(M)},[]);const oe=d.useCallback(()=>{Ft===!1?Nt(!0):Ie(!0)},[Ft]),se=d.useCallback(()=>{Yt(!0),je({title:"Connected",description:"Successfully connected to Reshot platform. You can now publish.",variant:"success"}),setTimeout(()=>Ie(!0),300)},[je]),re=d.useCallback(()=>{e&&(u(!0),fetch(`/api/config/scenarios/${e}`).then(M=>M.json()).then(M=>{a(M.scenario),u(!1)}).catch(M=>{console.error("Failed to load scenario:",M),u(!1)}),fetch("/api/config").then(M=>M.json()).then(M=>{var ne;const Q=((ne=M.config)==null?void 0:ne.variants)||{};l(Q);const le=(Q==null?void 0:Q.dimensions)||{};Object.keys(le).length>0&&_(!0)}).catch(M=>{console.error("Failed to load config:",M)}))},[e]);d.useEffect(()=>{re()},[re]),d.useEffect(()=>{e&&fetch("/api/output").then(M=>M.json()).then(M=>{const le=(M.groups||[]).filter(Te=>Te.scenarioKey===e),ne={};let de=0;le.forEach(Te=>{fetch(`/api/output/${Te.scenarioKey}/${Te.variationSlug}`).then(cs=>cs.json()).then(cs=>{var et;(et=cs.assets)==null||et.forEach(xt=>{const zn=xt.filename.replace(/\.[^/.]+$/,"");ne[zn]||(ne[zn]=xt.url,de++)}),X({...ne}),ae(de)}).catch(()=>{})})}).catch(()=>{})},[e]);const[qe,De]=d.useState(0),At=d.useRef(new Set);d.useEffect(()=>{const M=()=>{fetch("/api/jobs?limit=10").then(le=>le.json()).then(le=>{const ne=le.jobs||[],de=ne.filter(et=>et.scenarioKey===e&&(et.status==="running"||et.status==="pending")),Te=new Set(de.map(et=>et.id)),cs=At.current;for(const et of cs)if(!Te.has(et)){const xt=ne.find(zn=>zn.id===et);if(xt&&(xt.type==="run"||xt.type==="capture")){Vt(zn=>zn+1);break}}At.current=Te,ce(de)}).catch(()=>{})};if(M(),qe===0&&Z.length===0)return;const Q=setInterval(M,2e3);return()=>clearInterval(Q)},[e,Z.length,qe]);const I=Fm(re),ee=async()=>{if(!(!i||!e)){f(!0);try{const M=await fetch(`/api/config/scenarios/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(M.ok)je({title:"Success",description:"Scenario saved successfully",variant:"success"});else{const Q=await M.json();je({title:"Error",description:Q.error||"Failed to save scenario",variant:"destructive"})}}catch(M){console.error("Failed to save scenario:",M),je({title:"Error",description:"Failed to save scenario",variant:"destructive"})}finally{f(!1)}}},pe=async()=>{if(e)try{const M=await fetch(`/api/config/scenarios/${e}`,{method:"DELETE"});if(M.ok)je({title:"Success",description:"Scenario deleted successfully",variant:"success"}),t("/scenarios");else{const Q=await M.json();je({title:"Error",description:Q.error||"Failed to delete scenario",variant:"destructive"})}}catch(M){console.error("Failed to delete scenario:",M),je({title:"Error",description:"Failed to delete scenario",variant:"destructive"})}},Ce=()=>{p(null),x(!0)},Oe=M=>{p(M),x(!0)},Ge=async M=>{if(!(!e||!i||!i.steps))try{const Q=await fetch(`/api/config/scenarios/${e}/steps/${M}`,{method:"DELETE"});if(Q.ok){const le=i.steps.filter((ne,de)=>de!==M);a({...i,steps:le}),je({title:"Success",description:"Step deleted successfully",variant:"success"})}else{const le=await Q.json();je({title:"Error",description:le.error||"Failed to delete step",variant:"destructive"})}}catch(Q){console.error("Failed to delete step:",Q),je({title:"Error",description:"Failed to delete step",variant:"destructive"})}},ls=async M=>{if(!e||!i||!i.steps)return;const Q=i.steps[M];if(!Q)return;const le={...Q};try{const ne=await fetch(`/api/config/scenarios/${e}/steps`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le)});if(ne.ok){const de=[...i.steps];de.splice(M+1,0,le),a({...i,steps:de}),je({title:"Success",description:"Step duplicated successfully",variant:"success"})}else{const de=await ne.json();je({title:"Error",description:de.error||"Failed to duplicate step",variant:"destructive"})}}catch(ne){console.error("Failed to duplicate step:",ne),je({title:"Error",description:"Failed to duplicate step",variant:"destructive"})}},pn=async(M,Q)=>{if(!e||!i||!i.steps)return;const le=Q==="up"?M-1:M+1;if(le<0||le>=i.steps.length)return;const ne=[...i.steps];[ne[M],ne[le]]=[ne[le],ne[M]],ne.forEach((de,Te)=>{de.order!==void 0&&(de.order=Te)});try{const de=await fetch(`/api/config/scenarios/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({steps:ne})});if(de.ok)a({...i,steps:ne}),je({title:"Success",description:"Step reordered successfully",variant:"success"});else{const Te=await de.json();je({title:"Error",description:Te.error||"Failed to reorder step",variant:"destructive"})}}catch(de){console.error("Failed to reorder step:",de),je({title:"Error",description:"Failed to reorder step",variant:"destructive"})}},ki=async M=>{if(!e||!i)return;const Q=i.steps||[];try{if(j!==null){const le=await fetch(`/api/config/scenarios/${e}/steps/${j}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)});if(le.ok){const ne=[...Q];ne[j]=M,a({...i,steps:ne}),je({title:"Success",description:"Step updated successfully",variant:"success"}),x(!1)}else{const ne=await le.json();je({title:"Error",description:ne.error||"Failed to update step",variant:"destructive"})}}else{const le=await fetch(`/api/config/scenarios/${e}/steps`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)});if(le.ok){const ne=[...Q,M];a({...i,steps:ne}),je({title:"Success",description:"Step added successfully",variant:"success"}),x(!1)}else{const ne=await le.json();je({title:"Error",description:ne.error||"Failed to add step",variant:"destructive"})}}}catch(le){console.error("Failed to save step:",le),je({title:"Error",description:"Failed to save step",variant:"destructive"})}};return c?n.jsx("div",{className:"p-8",children:n.jsx("div",{className:"text-muted-foreground",children:"Loading scenario..."})}):i?n.jsxs("div",{"data-testid":"studio-scenario-detail","data-loaded":"true",className:"p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(T,{variant:"ghost",size:"icon",onClick:()=>t("/scenarios"),className:"h-7 w-7 flex-shrink-0",children:n.jsx(Bl,{className:"h-4 w-4"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h1",{className:"text-lg font-semibold truncate",children:i.name}),e&&n.jsx(_1,{scenarioKey:e})]}),n.jsx("p",{className:"text-[10px] text-muted-foreground font-mono truncate",children:i.key})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[n.jsx(T,{variant:"ghost",size:"icon",onClick:I,disabled:c,className:"h-7 w-7",children:n.jsx(_t,{className:`h-3.5 w-3.5 ${c?"animate-spin":""}`})}),n.jsxs(T,{size:"sm",className:"h-7 text-xs",onClick:()=>{V((i==null?void 0:i.variant)||{}),_(!1),O(!0)},children:[n.jsx(Ts,{className:"h-3 w-3 mr-1"}),"Run"]}),n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:oe,children:[n.jsx(on,{className:"h-3 w-3 mr-1"}),"Publish"]}),n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>t(`/recorder?scenario=${e}`),children:[n.jsx(_n,{className:"h-3 w-3 mr-1"}),"Record"]}),n.jsx(T,{variant:"ghost",size:"icon",onClick:ee,disabled:m,className:"h-7 w-7",children:n.jsx(Hr,{className:"h-3.5 w-3.5"})}),n.jsx(T,{variant:"ghost",size:"icon",onClick:()=>N(!0),className:"h-7 w-7 text-destructive hover:text-destructive",children:n.jsx(ps,{className:"h-3.5 w-3.5"})})]})]}),n.jsx("div",{className:"flex items-center gap-4 flex-wrap",children:n.jsx(C1,{scenarioKey:g,scenarioName:i.name,stepCount:((mn=i.steps)==null?void 0:mn.length)||0,assetCount:ie,hasAssets:ie>0})}),n.jsxs(hd,{value:k,onValueChange:B,children:[n.jsxs(fd,{className:"h-8",children:[n.jsx(sr,{value:"details",className:"text-xs h-7",children:"Details"}),n.jsxs(sr,{value:"steps",className:"text-xs h-7",children:["Steps (",((gd=i.steps)==null?void 0:gd.length)||0,")"]}),n.jsx(sr,{value:"assets",className:"text-xs h-7",children:"Assets"})]}),n.jsx(nr,{value:"details",className:"mt-3",children:n.jsxs("div",{className:"border rounded-lg bg-card p-4 space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[n.jsxs("div",{children:[n.jsx(q,{htmlFor:"scenario-name",className:"text-xs",children:"Name"}),n.jsx(ve,{id:"scenario-name",value:i.name,onChange:M=>a({...i,name:M.target.value}),className:"h-8 text-sm"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"scenario-key",className:"text-xs",children:"Key"}),n.jsx(ve,{id:"scenario-key",value:i.key,disabled:!0,className:"h-8 text-sm font-mono bg-muted"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"scenario-url",className:"text-xs",children:"URL"}),n.jsx(ve,{id:"scenario-url",value:i.url,onChange:M=>a({...i,url:M.target.value}),className:"h-8 text-sm"})]})]}),n.jsxs("details",{className:"group",children:[n.jsxs("summary",{className:"text-xs font-medium cursor-pointer hover:text-primary",children:["Capture Variants"," ",n.jsxs("span",{className:"text-muted-foreground",children:["(",Object.keys(i.variant||{}).length," configured)"]})]}),n.jsx("div",{className:"mt-2 pl-2 border-l-2 border-border",children:n.jsx(R1,{variantsConfig:o,value:i.variant||{},preset:i.variantPreset,onChange:(M,Q)=>{a({...i,variant:Object.keys(M).length>0?M:void 0,variantPreset:Q,locale:void 0,role:void 0})}})})]}),n.jsxs("details",{className:"group",children:[n.jsxs("summary",{className:"text-xs font-medium cursor-pointer hover:text-primary flex items-center gap-1",children:[n.jsx(ra,{className:"h-3 w-3"}),"Output Crop"," ",n.jsxs("span",{className:"text-muted-foreground",children:["(",(yd=(vd=i.output)==null?void 0:vd.crop)!=null&&yd.enabled?"enabled":"disabled",")"]})]}),n.jsxs("div",{className:"mt-2 pl-2 border-l-2 border-border space-y-2",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:"Crop all captures to focus on a specific region of the screen."}),((wd=(jd=i.output)==null?void 0:jd.crop)==null?void 0:wd.enabled)&&((kd=(Nd=i.output)==null?void 0:Nd.crop)==null?void 0:kd.region)&&n.jsxs("div",{className:"text-xs font-mono bg-muted px-2 py-1 rounded",children:["Region: ",i.output.crop.region.x,","," ",i.output.crop.region.y," →"," ",i.output.crop.region.width,"×",i.output.crop.region.height,"px"]}),n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>kt(!0),children:[n.jsx(ra,{className:"h-3 w-3 mr-1"}),(Sd=(bd=i.output)==null?void 0:bd.crop)!=null&&Sd.enabled?"Edit Crop Region":"Configure Crop"]}),((Ed=(Cd=i.output)==null?void 0:Cd.crop)==null?void 0:Ed.enabled)&&n.jsx(T,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground",onClick:()=>{a({...i,output:{...i.output,crop:void 0}})},children:"Disable Crop"})]})]}),n.jsxs("details",{className:"group",children:[n.jsxs("summary",{className:"text-xs font-medium cursor-pointer hover:text-primary flex items-center gap-1",children:[n.jsx(xr,{className:"h-3 w-3"}),"Privacy Override"," ",n.jsxs("span",{className:"text-muted-foreground",children:["(",i.privacy?"overridden":"inheriting global",")"]})]}),n.jsxs("div",{className:"mt-2 pl-2 border-l-2 border-border space-y-2",children:[n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:!!i.privacy,onChange:M=>{if(M.target.checked)a({...i,privacy:{enabled:!0,method:"redact",selectors:[]}});else{const{privacy:Q,...le}=i;a(le)}},className:"rounded h-3.5 w-3.5"}),"Override global privacy config for this scenario"]}),i.privacy&&n.jsxs("div",{className:"space-y-2 pt-1",children:[n.jsx("div",{className:"flex gap-1",children:["redact","blur","hide","remove"].map(M=>{var Q;return n.jsx(T,{variant:((Q=i.privacy)==null?void 0:Q.method)===M?"default":"outline",size:"sm",className:"h-6 text-[10px] flex-1 capitalize",onClick:()=>a({...i,privacy:{...i.privacy,method:M}}),children:M},M)})}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Additional selectors for this scenario (additive with global)"})]})]})]}),n.jsxs("details",{className:"group",children:[n.jsxs("summary",{className:"text-xs font-medium cursor-pointer hover:text-primary flex items-center gap-1",children:[n.jsx(ao,{className:"h-3 w-3"}),"Style Override"," ",n.jsxs("span",{className:"text-muted-foreground",children:["(",i.style?"overridden":"inheriting global",")"]})]}),n.jsxs("div",{className:"mt-2 pl-2 border-l-2 border-border space-y-2",children:[n.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[n.jsx("input",{type:"checkbox",checked:!!i.style,onChange:M=>{if(M.target.checked)a({...i,style:{frame:"none",shadow:"medium",padding:40}});else{const{style:Q,...le}=i;a(le)}},className:"rounded h-3.5 w-3.5"}),"Override global style config for this scenario"]}),i.style&&n.jsxs("div",{className:"space-y-2 pt-1",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Frame"}),n.jsx("div",{className:"flex gap-1",children:["none","macos","windows"].map(M=>{var Q;return n.jsx(T,{variant:((Q=i.style)==null?void 0:Q.frame)===M?"default":"outline",size:"sm",className:"h-6 text-[10px] flex-1 capitalize",onClick:()=>a({...i,style:{...i.style,frame:M}}),children:M==="none"?"None":M==="macos"?"macOS":"Windows"},M)})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Shadow"}),n.jsx("div",{className:"flex gap-1",children:["none","small","medium","large"].map(M=>{var Q;return n.jsx(T,{variant:((Q=i.style)==null?void 0:Q.shadow)===M?"default":"outline",size:"sm",className:"h-6 text-[10px] flex-1 capitalize",onClick:()=>a({...i,style:{...i.style,shadow:M}}),children:M},M)})})]})]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(q,{htmlFor:"scenario-description",className:"text-xs",children:"Description"}),n.jsx(uo,{id:"scenario-description",value:((Rd=i._local)==null?void 0:Rd.description)||"",onChange:M=>a({...i,_local:{...i._local||{},description:M.target.value}}),placeholder:"Optional description",rows:2,className:"text-sm"})]}),n.jsxs("div",{children:[n.jsx(q,{htmlFor:"scenario-tags",className:"text-xs",children:"Tags"}),n.jsx(ve,{id:"scenario-tags",value:((Pd=(_d=i._local)==null?void 0:_d.tags)==null?void 0:Pd.join(", "))||"",onChange:M=>{const Q=M.target.value.split(",").map(le=>le.trim()).filter(Boolean);a({...i,_local:{...i._local||{},tags:Q}})},placeholder:"tag1, tag2",className:"h-8 text-sm"}),((Td=i._local)==null?void 0:Td.tags)&&i._local.tags.length>0&&n.jsx("div",{className:"flex gap-1 flex-wrap mt-1",children:i._local.tags.map(M=>n.jsx(ue,{variant:"secondary",className:"text-[10px] h-5",children:M},M))})]})]})]})}),n.jsxs(nr,{value:"steps",className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between py-1",children:[n.jsxs("span",{className:"text-xs text-muted-foreground",children:[((Ad=i.steps)==null?void 0:Ad.length)||0," steps"]}),n.jsxs(T,{onClick:Ce,size:"sm",className:"h-7 text-xs",children:[n.jsx(as,{className:"h-3 w-3 mr-1"}),"Add"]})]}),n.jsxs("div",{className:"border rounded-md divide-y",children:[(Od=i.steps)==null?void 0:Od.map((M,Q)=>{var Te;const le=M.key||M.captureKey,ne=le?U[le]:null,de=M.action==="screenshot"||M.action==="clip";return n.jsxs("div",{className:"flex items-center gap-2 p-2 hover:bg-accent/30 group",children:[n.jsxs("span",{className:"text-[10px] text-muted-foreground w-4 shrink-0",children:["#",Q+1]}),de&&ne?n.jsx("div",{className:"w-12 h-8 shrink-0 rounded overflow-hidden bg-muted cursor-pointer",onClick:()=>t(`/assets/${e}/default/${le}`),children:n.jsx("img",{src:ne,alt:"",className:"w-full h-full object-cover"})}):n.jsx("div",{className:"w-12 h-8 shrink-0 rounded bg-muted/50 flex items-center justify-center",children:n.jsx("span",{className:"text-[8px] text-muted-foreground",children:"—"})}),n.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[n.jsx(ue,{variant:"outline",className:"text-[10px] h-5 shrink-0",children:M.action}),M.key&&n.jsx(ue,{variant:"secondary",className:"text-[10px] h-5 shrink-0",children:M.key}),M.selector&&n.jsx("code",{className:"text-[10px] text-muted-foreground truncate font-mono",children:M.selector}),M.url&&n.jsx("span",{className:"text-[10px] text-muted-foreground truncate",children:M.url}),M.text&&n.jsxs("span",{className:"text-[10px] text-muted-foreground truncate italic",children:['"',M.text,'"']}),de&&!ne&&n.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"not generated"})]}),n.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[n.jsx(T,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>pn(Q,"up"),disabled:Q===0,title:"Move up",children:n.jsx(Yc,{className:"h-3 w-3"})}),n.jsx(T,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>pn(Q,"down"),disabled:Q===(((Te=i.steps)==null?void 0:Te.length)||0)-1,title:"Move down",children:n.jsx(zs,{className:"h-3 w-3"})}),n.jsx(T,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>Oe(Q),title:"Edit",children:n.jsx(Gy,{className:"h-3 w-3"})}),n.jsx(T,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ls(Q),title:"Duplicate",children:n.jsx(rn,{className:"h-3 w-3"})}),n.jsx(T,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive hover:text-destructive",onClick:()=>Ge(Q),title:"Delete",children:n.jsx(ln,{className:"h-3 w-3"})})]})]},Q)}),(!i.steps||i.steps.length===0)&&n.jsxs("div",{className:"text-center text-muted-foreground py-6",children:[n.jsx("p",{className:"text-sm",children:"No steps yet."}),n.jsxs(T,{onClick:Ce,variant:"outline",size:"sm",className:"mt-2 h-7 text-xs",children:[n.jsx(as,{className:"h-3 w-3 mr-1"}),"Add First Step"]})]})]}),n.jsx(j1,{open:h,onOpenChange:x,step:j!==null?i.steps[j]:null,onSave:ki,assetUrl:j!==null&&i.steps[j]?U[i.steps[j].key||i.steps[j].captureKey||""]:void 0}),n.jsx(st,{open:w,onOpenChange:N,children:n.jsxs(nt,{children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Delete Scenario"}),n.jsx(ot,{children:"Are you sure you want to delete this scenario? This action cannot be undone."})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),n.jsx(T,{variant:"destructive",onClick:()=>{N(!1),pe()},children:"Delete"})]})]})})]}),n.jsx(nr,{value:"assets",className:"space-y-4",forceMount:!0,children:n.jsx(S1,{scenarioKey:g},`assets-${Tt}`)})]}),n.jsx(ho,{open:Se,onOpenChange:Ie,scenarioKeys:e?[e]:[],onConfirm:async M=>{var Q;try{const le=M.reduce((Te,cs)=>Te+cs.assets.length,0),ne=await fetch("/api/jobs/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:e?[e]:[],selectedGroups:M})}),de=await ne.json();if(ne.status===401||de.authRequired){Ie(!1),je({title:"Authentication Required",description:de.error||"Please reconnect to publish.",variant:"destructive"}),Nt(!0);return}ne.ok&&de.ok?(je({title:"Job Created",description:`Publishing ${le} asset(s). Monitor progress in the panel below.`}),Ie(!1),(Q=de.job)!=null&&Q.id&&r(de.job.id,e||void 0),De(Te=>Te+1),setTimeout(()=>De(0),1e4)):je({title:"Error",description:de.error||"Failed to create publish job",variant:"destructive"})}catch{je({title:"Error",description:"Failed to connect to server",variant:"destructive"})}}}),n.jsx(wi,{open:mt,onOpenChange:Nt,onAuthenticated:se}),n.jsx(st,{open:b,onOpenChange:O,children:n.jsxs(nt,{className:"max-w-lg",children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Run Scenario"}),n.jsx(ot,{children:"Choose output format and variant options"})]}),n.jsxs("div",{className:"py-4 space-y-5",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx(q,{className:"text-sm font-medium",children:"Output Format"}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx("button",{type:"button",onClick:()=>v("step-by-step-images"),className:`p-3 rounded-lg border-2 text-left transition-all ${D==="step-by-step-images"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(fn,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium text-sm",children:"Screenshots"})]})}),n.jsx("button",{type:"button",onClick:()=>v("summary-video"),className:`p-3 rounded-lg border-2 text-left transition-all ${D==="summary-video"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(io,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium text-sm",children:"Video"})]})})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(q,{className:"text-sm font-medium",children:"Visual Diffing"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Compare against approved baselines"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[F===null&&E&&n.jsx("span",{className:"text-xs text-muted-foreground",children:"(config default: on)"}),F===null&&!E&&n.jsx("span",{className:"text-xs text-muted-foreground",children:"(config default: off)"}),n.jsx("input",{type:"checkbox",checked:F===null?E:F,onChange:M=>$(M.target.checked),className:"rounded h-4 w-4"})]})]}),(F===!0||F===null&&E)&&n.jsx("div",{className:"text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 rounded-md p-2",children:"Diff results will appear in the job log after completion"})]}),n.jsx("div",{className:"space-y-2",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(q,{className:"text-sm font-medium",children:"Privacy Masking"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide sensitive elements during capture"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[z===null&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:["(config default: ",fe?"on":"off",")"]}),n.jsx("input",{type:"checkbox",checked:z===null?fe:!z,onChange:M=>W(M.target.checked?null:!0),className:"rounded h-4 w-4"})]})]})}),n.jsx("div",{className:"space-y-2",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(q,{className:"text-sm font-medium",children:"Style Processing"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply frames, shadows, and backgrounds"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[J===null&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:["(config default: ",ge?"on":"off",")"]}),n.jsx("input",{type:"checkbox",checked:J===null?ge:!J,onChange:M=>G(M.target.checked?null:!0),className:"rounded h-4 w-4"})]})]})}),n.jsx("div",{className:"space-y-2",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(q,{className:"text-sm font-medium",children:"Output Crop"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:(Ld=(zd=i.output)==null?void 0:zd.crop)!=null&&Ld.enabled?`Cropping to ${(Md=i.output.crop.region)==null?void 0:Md.width}×${(Id=i.output.crop.region)==null?void 0:Id.height}px`:"No crop configured"})]}),n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{O(!1),kt(!0)},children:[n.jsx(ra,{className:"h-3 w-3 mr-1"}),(Fd=(Dd=i.output)==null?void 0:Dd.crop)!=null&&Fd.enabled?"Edit":"Configure"]})]})}),(()=>{const M=(o==null?void 0:o.dimensions)||{},Q=Object.keys(M);if(Q.length===0)return n.jsx("div",{className:"text-sm text-muted-foreground bg-muted/50 rounded-md p-3",children:n.jsx("p",{children:"No variants configured. Will run with default settings."})});let le=1;return Q.forEach(ne=>{var Te;const de=Object.keys(((Te=M[ne])==null?void 0:Te.options)||{});le*=de.length||1}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"border rounded-lg overflow-hidden",children:n.jsxs("div",{className:"flex",children:[n.jsx("button",{type:"button",onClick:()=>_(!0),className:`flex-1 py-3 px-4 text-sm font-medium transition-all ${y?"bg-primary text-primary-foreground":"bg-muted/30 hover:bg-muted/50"}`,children:n.jsxs("div",{className:"flex flex-col items-center gap-1",children:[n.jsx("span",{className:"text-lg",children:"🎯"}),n.jsxs("span",{children:["All ",le," Variants"]}),n.jsx("span",{className:`text-xs ${y?"text-primary-foreground/70":"text-muted-foreground"}`,children:Q.map(ne=>{var de;return((de=M[ne])==null?void 0:de.label)||ne}).join(" × ")})]})}),n.jsx("button",{type:"button",onClick:()=>_(!1),className:`flex-1 py-3 px-4 text-sm font-medium transition-all border-l ${y?"bg-muted/30 hover:bg-muted/50":"bg-primary text-primary-foreground"}`,children:n.jsxs("div",{className:"flex flex-col items-center gap-1",children:[n.jsx("span",{className:"text-lg",children:"☝️"}),n.jsx("span",{children:"Single Variant"}),n.jsx("span",{className:`text-xs ${y?"text-muted-foreground":"text-primary-foreground/70"}`,children:"Choose specific options"})]})})]})}),!y&&n.jsx("div",{className:"space-y-3 p-3 bg-muted/30 rounded-lg",children:Q.map(ne=>{const de=M[ne],Te=(de==null?void 0:de.options)||{},cs=Object.keys(Te);return n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-sm font-medium",children:(de==null?void 0:de.label)||ne}),n.jsxs($m,{value:L[ne]||cs[0]||"",onValueChange:et=>{V(xt=>({...xt,[ne]:et}))},children:[n.jsx(pd,{className:"w-full",children:n.jsx(Vm,{placeholder:`Select ${(de==null?void 0:de.label)||ne}`})}),n.jsx(md,{children:cs.map(et=>{const xt=Te[et];return n.jsx(xd,{value:et,children:(xt==null?void 0:xt.name)||(xt==null?void 0:xt.label)||et},et)})})]})]},ne)})}),y&&n.jsxs("div",{className:"text-sm bg-green-500/10 dark:bg-green-500/20 border border-green-500/30 rounded-md p-3",children:[n.jsxs("p",{className:"font-medium text-green-700 dark:text-green-400 mb-2",children:["✓ Will capture ",le," variant",le>1?"s":"",":"]}),n.jsx("div",{className:"space-y-1 text-xs text-muted-foreground",children:Q.map(ne=>{var Te;const de=Object.keys(((Te=M[ne])==null?void 0:Te.options)||{});return n.jsxs("div",{children:[n.jsx("span",{className:"font-mono",children:ne}),":"," ",de.join(", ")]},ne)})})]})]})})()]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),n.jsxs(T,{onClick:async()=>{const M=(o==null?void 0:o.dimensions)||{},Q=Object.keys(M);if(y&&Q.length>0){const le=await fetch("/api/jobs/run-all-variations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKey:e,dimensions:Q,format:D})});if(le.ok){const ne=await le.json();for(const de of ne.jobs)r(de.id,e);O(!1),De(de=>de+1),setTimeout(()=>De(0),1e4)}else{const ne=await le.json();je({title:"Error",description:ne.error||"Failed to start jobs",variant:"destructive"})}}else{const le=await fetch("/api/jobs/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:[e],format:D,variant:Object.keys(L).length>0?L:void 0,diff:F,noPrivacy:z===!0?!0:void 0,noStyle:J===!0?!0:void 0})});if(le.ok){const ne=await le.json();r(ne.job.id,e),O(!1),De(de=>de+1),setTimeout(()=>De(0),1e4)}else je({title:"Error",description:"Failed to start job",variant:"destructive"})}},children:[n.jsx(Ts,{className:"h-4 w-4 mr-2"}),y?"Run All Variations":"Run"]})]})]})}),n.jsx(st,{open:S,onOpenChange:P,children:n.jsxs(nt,{children:[n.jsxs(Xe,{children:[n.jsx(Ze,{children:"Record Visual"}),n.jsx(ot,{children:"Start a recording session for this scenario. The recorder will open in your terminal."})]}),n.jsx("div",{className:"py-4",children:n.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[n.jsx("p",{children:"This will start a recording job that:"}),n.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[n.jsx("li",{children:"Opens Chrome with remote debugging"}),n.jsx("li",{children:"Connects to the active browser session"}),n.jsx("li",{children:"Allows you to capture steps using keyboard shortcuts"})]}),n.jsx("p",{className:"mt-4 font-medium",children:"Keyboard shortcuts:"}),n.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[n.jsxs("li",{children:[n.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-xs",children:"C"})," ","- Capture screenshot/clip"]}),n.jsxs("li",{children:[n.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded text-xs",children:"Q"})," ","- Quit and save"]})]})]})}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),n.jsx(T,{onClick:async()=>{try{const M=await fetch("/api/jobs/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i==null?void 0:i.name,scenarioKey:e})}),Q=await M.json();M.ok?(je({title:"Success",description:"Recording job started. Check Jobs page and your terminal.",variant:"success"}),P(!1),De(le=>le+1),setTimeout(()=>De(0),1e4)):je({title:"Error",description:Q.error||"Failed to start recording",variant:"destructive"})}catch{je({title:"Error",description:"Failed to start recording",variant:"destructive"})}},children:"Start Recording"})]})]})}),n.jsx(P1,{open:$t,onOpenChange:kt,imageUrl:Object.values(U)[0]||null,currentCrop:($d=i.output)==null?void 0:$d.crop,scenarioName:i.name,onSave:M=>{a({...i,output:{...i.output,crop:M||void 0}})}})]}):n.jsx("div",{className:"p-8",children:n.jsx(he,{children:n.jsx(ke,{children:n.jsx(be,{children:"Scenario Not Found"})})})})}function Nh(e){const t=e.split("-");return t.length>=2?t[0]:"other"}function A1(e){return e==="other"?"Other":e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function O1(){const e=Os(),{toast:t}=Pt(),[,s]=d.useState([]),[r,i]=d.useState(!0),[a,o]=d.useState({}),[l,c]=d.useState(new Set),[u,m]=d.useState(!1),[f,g]=d.useState(new Set),[R,k]=d.useState(!1),[C,j]=d.useState(!1),[p,h]=d.useState(!1),{trackJob:x}=ji(),w=U=>{g(X=>{const Z=new Set(X);return Z.has(U)?Z.delete(U):Z.add(U),Z})},N=U=>{const X=U.every(Z=>f.has(Z));g(Z=>{const ce=new Set(Z);return X?U.forEach(ie=>ce.delete(ie)):U.forEach(ie=>ce.add(ie)),ce})},S=()=>{const U=Object.keys(a);g(new Set(U))},P=()=>{g(new Set)},b=async()=>{if(f.size!==0)try{const U=await fetch("/api/assets/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:Array.from(f)})}),X=await U.json();U.ok?(t({title:"Success",description:`Deleted assets for ${X.deletedScenarios||f.size} scenario(s)`,variant:"success"}),k(!1),P(),D()):t({title:"Error",description:X.error||"Failed to delete selected assets",variant:"destructive"})}catch(U){console.error("Failed to delete selected assets:",U),t({title:"Error",description:"Failed to delete selected assets",variant:"destructive"})}},O=async()=>{try{const U=await fetch("/api/assets",{method:"DELETE"}),X=await U.json();U.ok?(t({title:"Success",description:`Deleted ${X.deleted} asset file(s)`,variant:"success"}),m(!1),D()):t({title:"Error",description:X.error||"Failed to delete assets",variant:"destructive"})}catch(U){console.error("Failed to delete assets:",U),t({title:"Error",description:"Failed to delete assets",variant:"destructive"})}},D=async()=>{i(!0);try{const Z=(await(await fetch("/api/output")).json()).groups||[];s(Z);const ce=[...new Set(Z.map(ae=>ae.scenarioKey))],ie={};if(await Promise.all(ce.map(async ae=>{try{const mt=(await(await fetch(`/api/output/${ae}/versions`)).json()).versions||[];mt.length===0&&mt.push({timestamp:"default",label:"Default",date:new Date().toISOString(),assetCount:0,isLatest:!0});const Nt=mt[0].timestamp,Yt=mt[0].variants||[],$t=Yt.length>0?Yt[0].name:null;let kt=[];try{const Tt=$t?`/api/output/${ae}/version/${Nt}/variant/${$t}`:`/api/output/${ae}/version/${Nt}`;kt=((await(await fetch(Tt)).json()).assets||[]).filter(B=>!B.isSentinel)}catch{const Tt=Z.find(Vt=>Vt.scenarioKey===ae);kt=(Tt==null?void 0:Tt.assets)||[]}ie[ae]={scenarioKey:ae,versions:mt,selectedVersion:Nt,selectedVariant:$t,assets:kt,availableVariants:Yt}}catch(Se){console.error(`Failed to fetch versions for ${ae}:`,Se)}})),o(ie),l.size===0){const ae=new Set;Object.values(ie).forEach(Se=>ae.add(Nh(Se.scenarioKey))),c(ae)}i(!1)}catch(U){console.error("Failed to load assets:",U),i(!1)}};d.useEffect(()=>{D()},[]);const v=async(U,X)=>{o(Se=>({...Se,[U]:{...Se[U],selectedVersion:X}}));const Z=a[U],ce=Z==null?void 0:Z.versions.find(Se=>Se.timestamp===X),ie=(ce==null?void 0:ce.variants)||[],ae=ie.length>0?ie[0].name:null;try{const Se=ae?`/api/output/${U}/version/${X}/variant/${ae}`:`/api/output/${U}/version/${X}`,Nt=((await(await fetch(Se)).json()).assets||[]).filter(Ft=>!Ft.isSentinel);o(Ft=>({...Ft,[U]:{...Ft[U],selectedVersion:X,selectedVariant:ae,availableVariants:ie,assets:Nt}}))}catch(Se){console.error(`Failed to fetch assets for ${U}/${X}:`,Se)}},L=async(U,X)=>{const Z=a[U];if(Z){o(ce=>({...ce,[U]:{...ce[U],selectedVariant:X}}));try{const ce=`/api/output/${U}/version/${Z.selectedVersion}/variant/${X}`,Se=((await(await fetch(ce)).json()).assets||[]).filter(Ie=>!Ie.isSentinel);o(Ie=>({...Ie,[U]:{...Ie[U],selectedVariant:X,assets:Se}}))}catch(ce){console.error(`Failed to fetch assets for ${U}/${Z.selectedVersion}/${X}:`,ce)}}},V=U=>U<1024?`${U} B`:U<1024*1024?`${(U/1024).toFixed(1)} KB`:`${(U/(1024*1024)).toFixed(1)} MB`,y=U=>{if(U==="latest"||U==="default")return U;const X=U.match(/(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})/);return X?new Date(parseInt(X[1]),parseInt(X[2])-1,parseInt(X[3]),parseInt(X[4]),parseInt(X[5]),parseInt(X[6])).toLocaleString():U},_=U=>U.endsWith(".mp4")?n.jsx(io,{className:"h-4 w-4"}):n.jsx(fn,{className:"h-4 w-4"}),F=Object.values(a),[$,E]=d.useState(""),[A,z]=d.useState("name"),[W,J]=d.useState(!0),G=d.useMemo(()=>{let U=[...F];if($){const X=$.toLowerCase();U=U.filter(Z=>Z.scenarioKey.toLowerCase().includes(X)||Z.assets.some(ce=>ce.captureKey.toLowerCase().includes(X)))}return U.sort((X,Z)=>{let ce=0;switch(A){case"name":ce=X.scenarioKey.localeCompare(Z.scenarioKey);break;case"assets":ce=X.assets.length-Z.assets.length;break;case"versions":ce=X.versions.length-Z.versions.length;break}return W?ce:-ce}),U},[F,$,A,W]),fe=d.useMemo(()=>{const U={};for(const Z of G){const ce=Nh(Z.scenarioKey);U[ce]||(U[ce]=[]),U[ce].push(Z)}return Object.entries(U).sort(([Z],[ce])=>Z==="other"?1:ce==="other"?-1:Z.localeCompare(ce)).map(([Z,ce])=>({key:Z,name:A1(Z),scenarios:ce,totalAssets:ce.reduce((ie,ae)=>ie+ae.assets.length,0),isExpanded:l.has(Z)}))},[G,l]),ye=U=>{c(X=>{const Z=new Set(X);return Z.has(U)?Z.delete(U):Z.add(U),Z})},ge=U=>{A===U?J(!W):(z(U),J(!0))},Re=F.reduce((U,X)=>U+X.assets.length,0);return n.jsxs("div",{"data-testid":"studio-assets","data-loaded":"true",className:"p-5 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 pb-3",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Assets"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1 font-normal",children:[F.length," scenario(s) · ",Re," asset(s)"]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(T,{variant:"outline",size:"icon",onClick:D,disabled:r,title:"Refresh",children:n.jsx(_t,{className:`h-4 w-4 ${r?"animate-spin":""}`})}),f.size>0?n.jsxs(n.Fragment,{children:[n.jsxs(T,{variant:"default",size:"sm",onClick:()=>j(!0),children:[n.jsx(on,{className:"h-3.5 w-3.5 mr-1.5"}),"Publish Selected (",f.size,")"]}),n.jsxs(T,{variant:"outline",size:"sm",onClick:()=>k(!0),className:"text-destructive hover:text-destructive",children:[n.jsx(ps,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete Selected (",f.size,")"]})]}):n.jsxs(T,{variant:"outline",size:"sm",onClick:()=>m(!0),title:"Delete all assets",className:"text-destructive hover:text-destructive",children:[n.jsx(ps,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete All"]})]})]}),F.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[n.jsx(Zc,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(ve,{placeholder:"Search assets...",value:$,onChange:U=>E(U.target.value),className:"pl-9 h-9"})]}),n.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[n.jsx(Gc,{className:"h-3.5 w-3.5 text-muted-foreground mr-1"}),n.jsxs(T,{variant:A==="name"?"secondary":"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>ge("name"),children:["Name ",A==="name"&&(W?"↑":"↓")]}),n.jsxs(T,{variant:A==="assets"?"secondary":"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>ge("assets"),children:["Assets ",A==="assets"&&(W?"↑":"↓")]}),n.jsxs(T,{variant:A==="versions"?"secondary":"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>ge("versions"),children:["Versions ",A==="versions"&&(W?"↑":"↓")]})]}),$&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:[G.length," of ",F.length," scenarios"]})]}),n.jsx("div",{className:"flex items-center gap-3 text-xs",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:f.size===F.length?P:S,children:f.size===F.length?n.jsxs(n.Fragment,{children:[n.jsx(Qc,{className:"h-3 w-3 mr-1"}),"Deselect All"]}):n.jsxs(n.Fragment,{children:[n.jsx(ed,{className:"h-3 w-3 mr-1"}),"Select All"]})}),f.size>0&&n.jsxs("span",{className:"text-muted-foreground",children:[f.size," selected"]})]})})]}),r?n.jsx("div",{className:"text-muted-foreground",children:"Loading assets..."}):F.length===0?n.jsx(he,{children:n.jsxs(ke,{children:[n.jsx(be,{children:"No Assets"}),n.jsx(at,{children:"Run a scenario to generate assets"})]})}):G.length===0?n.jsx(he,{children:n.jsxs(me,{className:"py-8 text-center",children:[n.jsxs("p",{className:"text-muted-foreground",children:['No assets match "',$,'"']}),n.jsx(T,{variant:"link",onClick:()=>E(""),children:"Clear search"})]})}):n.jsx("div",{className:"space-y-3",children:fe.map(U=>{const X=U.scenarios.map(ie=>ie.scenarioKey),Z=X.every(ie=>f.has(ie)),ce=X.some(ie=>f.has(ie));return n.jsxs(he,{className:"overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-2 p-4 border-b border-border/50",children:[n.jsx(ns,{checked:Z,indeterminate:ce&&!Z,onCheckedChange:()=>N(X),onClick:ie=>ie.stopPropagation(),className:"h-4 w-4"}),n.jsxs("button",{onClick:()=>ye(U.key),className:"flex-1 flex items-center gap-3 text-left hover:bg-accent/50 transition-colors rounded-md px-2 py-1 -my-1",children:[U.isExpanded?n.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}):n.jsx(Ps,{className:"h-4 w-4 text-muted-foreground"}),U.isExpanded?n.jsx(fi,{className:"h-5 w-5 text-primary"}):n.jsx(Xp,{className:"h-5 w-5 text-muted-foreground"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("span",{className:"font-medium",children:U.name}),n.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[U.scenarios.length," scenario(s) ·"," ",U.totalAssets," asset(s)"]})]})]})]}),U.isExpanded&&n.jsx("div",{className:"divide-y divide-border/50",children:U.scenarios.map(ie=>n.jsxs("div",{className:"p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ns,{checked:f.has(ie.scenarioKey),onCheckedChange:()=>w(ie.scenarioKey),className:"h-4 w-4"}),n.jsx("span",{className:"font-medium text-sm",children:ie.scenarioKey.includes("/")?ie.scenarioKey.split("/").slice(1).join("/"):ie.scenarioKey}),n.jsxs(ue,{variant:"outline",className:"text-[10px]",children:[ie.assets.length," asset(s)"]}),(()=>{var Se,Ie;const ae=ie.versions.find(mt=>mt.timestamp===ie.selectedVersion);return n.jsxs(n.Fragment,{children:[((Se=ae==null?void 0:ae.privacy)==null?void 0:Se.enabled)&&n.jsxs(ue,{variant:"secondary",className:"text-[10px] gap-0.5",children:[n.jsx(xr,{className:"h-2.5 w-2.5"}),ae.privacy.method||"privacy"]}),((Ie=ae==null?void 0:ae.style)==null?void 0:Ie.enabled)&&n.jsxs(ue,{variant:"secondary",className:"text-[10px] gap-0.5",children:[n.jsx(ao,{className:"h-2.5 w-2.5"}),ae.style.frame!=="none"?ae.style.frame:"styled"]})]})})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(hi,{className:"h-3.5 w-3.5 text-muted-foreground"}),n.jsx("select",{value:ie.selectedVersion,onChange:ae=>v(ie.scenarioKey,ae.target.value),className:"h-7 px-2 text-xs rounded-md border border-gray-600 bg-gray-800 text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:ie.versions.map(ae=>n.jsx("option",{value:ae.timestamp,children:ae.timestamp==="latest"?"Latest":ae.timestamp==="default"?"Default":y(ae.timestamp)},ae.timestamp))}),ie.availableVariants.length>0&&ie.selectedVariant&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground text-xs",children:"/"}),n.jsx("select",{value:ie.selectedVariant,onChange:ae=>L(ie.scenarioKey,ae.target.value),className:"h-7 px-2 text-xs rounded-md border border-gray-600 bg-gray-800 text-white focus:outline-none focus:ring-2 focus:ring-blue-500 capitalize",children:ie.availableVariants.map(ae=>n.jsxs("option",{value:ae.name,children:[ae.name," (",ae.assetCount,")"]},ae.name))})]})]})]}),ie.assets.length===0?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-3",children:"No assets in this version"}):n.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:ie.assets.map(ae=>n.jsxs("div",{className:"border rounded-md p-2.5 space-y-1.5 cursor-pointer hover:border-primary transition-colors group",onClick:()=>e(`/assets/${ie.scenarioKey}/${ie.selectedVersion}/${ae.captureKey}`),children:[n.jsx(fo,{url:ae.url,filename:ae.filename,size:"sm",showControls:!1}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[_(ae.filename),n.jsx("span",{className:"font-medium text-xs truncate",children:ae.captureKey})]}),n.jsx(ue,{variant:"outline",className:"text-[9px]",children:V(ae.size)})]})]},ae.captureKey))})]},ie.scenarioKey))})]},U.key)})}),n.jsx(st,{open:R,onOpenChange:k,children:n.jsxs(nt,{children:[n.jsxs(Xe,{children:[n.jsx(Ze,{className:"text-destructive",children:"Delete Selected Assets?"}),n.jsxs(ot,{children:["This will permanently delete all assets for"," ",f.size," selected scenario(s). This action cannot be undone."]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),n.jsxs(T,{variant:"destructive",onClick:b,children:[n.jsx(ps,{className:"h-4 w-4 mr-2"}),"Delete Selected"]})]})]})}),n.jsx(st,{open:u,onOpenChange:m,children:n.jsxs(nt,{children:[n.jsxs(Xe,{children:[n.jsx(Ze,{className:"text-destructive",children:"Delete All Assets?"}),n.jsxs(ot,{children:["This will permanently delete all ",Re," captured asset files from the output folder. This action cannot be undone."]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"outline",onClick:()=>m(!1),children:"Cancel"}),n.jsxs(T,{variant:"destructive",onClick:O,children:[n.jsx(ps,{className:"h-4 w-4 mr-2"}),"Delete All"]})]})]})}),n.jsx(ho,{open:C,onOpenChange:j,scenarioKeys:Array.from(f),onConfirm:async U=>{var X;try{const Z=U.reduce((ae,Se)=>ae+Se.assets.length,0),ce=await fetch("/api/jobs/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioKeys:Array.from(f),selectedGroups:U})}),ie=await ce.json();if(ce.status===401||ie.authRequired){j(!1),t({title:"Authentication Required",description:ie.error||"Please reconnect to publish.",variant:"destructive"}),h(!0);return}ce.ok&&ie.ok?(t({title:"Job Created",description:`Publishing ${Z} asset(s). Monitor progress in the panel below.`}),j(!1),(X=ie.job)!=null&&X.id&&x(ie.job.id)):t({title:"Error",description:ie.error||"Failed to create publish job",variant:"destructive"})}catch{t({title:"Error",description:"Failed to connect to server",variant:"destructive"})}}}),n.jsx(wi,{open:p,onOpenChange:h,onAuthenticated:()=>{t({title:"Connected",description:"Successfully connected. You can now publish.",variant:"success"}),D()}})]})}function z1(){const{toast:e}=Pt(),t=d.useRef(!0),[s,r]=d.useState(null),[i,a]=d.useState(!0),[o,l]=d.useState(!1),[c,u]=d.useState(!1),[m,f]=d.useState(null),[g,R]=d.useState(!1),[k,C]=d.useState(!1);d.useEffect(()=>()=>{t.current=!1},[]);const j=d.useCallback(async(P=!0)=>{try{P&&a(!0);const b=await fetch("/api/settings");if(!b.ok)throw new Error("Failed to fetch settings");const D=(await b.json()).settings||{};if(!t.current)return;r({isAuthenticated:D.isAuthenticated||!1,projectId:D.projectId||null,projectName:D.projectName||null,workspaceName:D.workspaceName||null,platformUrl:D.platformUrl||null,user:D.user||null,linkedAt:D.linkedAt||null,apiKeyValid:!!D.isAuthenticated,apiKeyWarning:void 0})}catch(b){console.error("Failed to load status:",b),t.current&&e({title:"Error",description:"Failed to load connection status",variant:"destructive"})}finally{t.current&&a(!1)}},[e]);d.useEffect(()=>{j()},[j]);const p=async()=>{l(!0);try{const P=await fetch("/api/auth/refresh",{method:"POST"}),b=await P.json();if(!t.current)return;if(P.status===401||b.authRequired){r(O=>O?{...O,apiKeyValid:!1,apiKeyWarning:b.error||"Please re-authenticate"}:null),e({title:"Authentication Required",description:b.error||"Please re-link to platform",variant:"destructive"});return}b.ok?(r(O=>O?{...O,projectId:b.projectId||O.projectId,projectName:b.projectName||O.projectName,workspaceName:b.workspaceName||O.workspaceName,user:b.user||O.user,linkedAt:b.linkedAt||O.linkedAt,apiKeyValid:!0,apiKeyWarning:void 0}:null),e({title:"Refreshed",description:"Connection info updated from platform",variant:"success"})):b.warning&&(r(O=>O?{...O,apiKeyValid:"unknown",apiKeyWarning:b.warning}:null),e({title:"Warning",description:b.warning}))}catch(P){console.error("Refresh failed:",P),e({title:"Refresh Failed",description:"Could not refresh connection info",variant:"destructive"})}finally{t.current&&l(!1)}},h=async()=>{u(!0);try{const P=await fetch("/api/auth/verify"),b=await P.json();if(!t.current)return;P.status===401?(r(O=>O?{...O,apiKeyValid:!1,apiKeyWarning:b.error||"API key is invalid or expired"}:null),e({title:"Connection Invalid",description:b.error||"Please re-authenticate",variant:"destructive"})):b.valid==="unknown"?(r(O=>O?{...O,apiKeyValid:"unknown",apiKeyWarning:b.warning}:null),e({title:"Status Unknown",description:b.warning||"Could not verify - platform may be unreachable"})):(r(O=>O?{...O,projectId:b.projectId||O.projectId,projectName:b.projectName||O.projectName,workspaceName:b.workspaceName||O.workspaceName,user:b.user||O.user,apiKeyValid:!0,apiKeyWarning:void 0}:null),e({title:"Connection Verified",description:"Your connection is active",variant:"success"}))}catch(P){console.error("Verification failed:",P),e({title:"Verification Failed",description:"Could not verify connection",variant:"destructive"})}finally{t.current&&u(!1)}},x=async()=>{C(!0),f(null);try{const P=await fetch("/api/auth/start",{method:"POST"}),b=await P.json();if(!P.ok||!b.ok)throw new Error(b.error||"Failed to start authentication");if(!t.current)return;const O={authUrl:b.authUrl,authToken:b.authToken,expiresAt:b.expiresAt};f(O);try{await fetch("/api/auth/open-browser",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({authUrl:b.authUrl})}),e({title:"Browser Opened",description:"Complete the sign-in in your browser"})}catch{e({title:"Browser Error",description:"Copy the URL below and paste in your browser"})}R(!0)}catch(P){console.error("Auth start failed:",P),e({title:"Error",description:P instanceof Error?P.message:"Failed to start authentication",variant:"destructive"}),C(!1)}};d.useEffect(()=>{if(!g||!m)return;let P=0;const b=150,O=setInterval(async()=>{if(P++,P>b){R(!1),f(null),C(!1),e({title:"Authentication Timeout",description:"Please try again",variant:"destructive"});return}try{const v=await(await fetch(`/api/auth/status?token=${encodeURIComponent(m.authToken)}`)).json();if(!t.current)return;v.status==="completed"?(clearInterval(O),R(!1),f(null),C(!1),await j(!1),e({title:"Connected!",description:`Successfully linked to ${v.projectName||"project"}`,variant:"success"})):(v.status==="expired"||v.status==="invalid")&&(clearInterval(O),R(!1),f(null),C(!1),e({title:"Authentication Failed",description:v.error||"Session expired. Please try again.",variant:"destructive"}))}catch(D){console.error("Polling error:",D)}},2e3);return()=>{clearInterval(O)}},[g,m,j,e]);const w=()=>{R(!1),f(null),C(!1)},N=async()=>{if(m!=null&&m.authUrl)try{await navigator.clipboard.writeText(m.authUrl),e({title:"Copied",description:"Auth URL copied to clipboard"})}catch{e({title:"Error",description:"Failed to copy",variant:"destructive"})}},S=P=>{if(!P)return"Never";try{return new Date(P).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return"Invalid date"}};return i?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsxs("div",{className:"text-center",children:[n.jsx(_e,{className:"h-8 w-8 animate-spin text-muted-foreground mx-auto mb-3"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading connection status..."})]})}):n.jsxs("div",{"data-testid":"studio-connection","data-loaded":"true",className:"p-6 max-w-3xl mx-auto space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Platform Connection"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your connection to the Reshot platform"})]}),n.jsx(T,{variant:"outline",size:"icon",onClick:()=>j(!1),disabled:i,title:"Refresh",children:n.jsx(_t,{className:Y("h-4 w-4",i&&"animate-spin")})})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"pb-3",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(be,{className:"text-base font-medium",children:"Connection Status"}),n.jsx(ue,{variant:s!=null&&s.isAuthenticated?"default":"secondary",className:Y((s==null?void 0:s.isAuthenticated)&&(s==null?void 0:s.apiKeyValid)===!0&&"bg-green-600",(s==null?void 0:s.isAuthenticated)&&(s==null?void 0:s.apiKeyValid)===!1&&"bg-red-600",(s==null?void 0:s.isAuthenticated)&&(s==null?void 0:s.apiKeyValid)==="unknown"&&"bg-yellow-600"),children:s!=null&&s.isAuthenticated?(s==null?void 0:s.apiKeyValid)===!0?n.jsxs(n.Fragment,{children:[n.jsx(vt,{className:"h-3 w-3 mr-1"}),"Connected"]}):(s==null?void 0:s.apiKeyValid)===!1?n.jsxs(n.Fragment,{children:[n.jsx(Jt,{className:"h-3 w-3 mr-1"}),"Invalid"]}):n.jsxs(n.Fragment,{children:[n.jsx(Jt,{className:"h-3 w-3 mr-1"}),"Unverified"]}):n.jsxs(n.Fragment,{children:[n.jsx(s0,{className:"h-3 w-3 mr-1"}),"Not Connected"]})})]})}),n.jsx(me,{className:"space-y-4",children:s!=null&&s.isAuthenticated?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs(q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n.jsx(Cy,{className:"h-3 w-3"}),"Project"]}),n.jsx("p",{className:"text-sm font-medium",children:s.projectName||"Unknown Project"}),s.projectId&&n.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:s.projectId})]}),s.workspaceName&&n.jsxs("div",{className:"space-y-1",children:[n.jsxs(q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n.jsx(ur,{className:"h-3 w-3"}),"Workspace"]}),n.jsx("p",{className:"text-sm font-medium",children:s.workspaceName})]}),s.user&&n.jsxs("div",{className:"space-y-1",children:[n.jsxs(q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n.jsx(n0,{className:"h-3 w-3"}),"Linked User"]}),n.jsx("p",{className:"text-sm font-medium",children:s.user.fullName||s.user.email||"Unknown"}),s.user.fullName&&s.user.email&&n.jsx("p",{className:"text-xs text-muted-foreground",children:s.user.email})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs(q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n.jsx(Ey,{className:"h-3 w-3"}),"Linked On"]}),n.jsx("p",{className:"text-sm",children:S(s.linkedAt)})]})]}),s.apiKeyWarning&&n.jsx("div",{className:"p-3 rounded-md bg-yellow-500/10 border border-yellow-500/30",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Jt,{className:"h-4 w-4 text-yellow-500 mt-0.5 shrink-0"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-yellow-600",children:"Connection Issue"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.apiKeyWarning})]})]})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-2",children:[n.jsxs(T,{variant:"outline",size:"sm",onClick:h,disabled:c,children:[c?n.jsx(_e,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(xr,{className:"h-3.5 w-3.5 mr-1.5"}),"Verify"]}),n.jsxs(T,{variant:"outline",size:"sm",onClick:p,disabled:o,children:[o?n.jsx(_e,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(_t,{className:"h-3.5 w-3.5 mr-1.5"}),"Sync Info"]}),n.jsxs(T,{variant:"outline",size:"sm",onClick:x,disabled:k,children:[n.jsx(Ma,{className:"h-3.5 w-3.5 mr-1.5"}),"Re-link"]}),s.platformUrl&&n.jsxs(T,{variant:"ghost",size:"sm",onClick:()=>window.open(s.platformUrl,"_blank"),children:[n.jsx(an,{className:"h-3.5 w-3.5 mr-1.5"}),"Platform"]})]})]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect to the Reshot platform to publish your captured visuals and sync with your team."}),n.jsxs(T,{onClick:x,disabled:k,children:[k?n.jsx(_e,{className:"h-4 w-4 mr-2 animate-spin"}):n.jsx(Ma,{className:"h-4 w-4 mr-2"}),"Connect to Platform"]})]})})]}),m&&n.jsxs(he,{className:"border-primary/50 bg-primary/5",children:[n.jsxs(ke,{className:"pb-3",children:[n.jsxs(be,{className:"text-base font-medium flex items-center gap-2",children:[n.jsx(_e,{className:"h-4 w-4 animate-spin text-primary"}),"Waiting for Authentication"]}),n.jsx(at,{children:"Complete the sign-in process in your browser window"})]}),n.jsxs(me,{className:"space-y-4",children:[n.jsxs("div",{className:"p-3 rounded-md bg-background border",children:[n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"If the browser didn't open, copy this URL and paste it in your browser:"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ve,{value:m.authUrl,readOnly:!0,className:"text-xs font-mono bg-muted"}),n.jsx(T,{variant:"outline",size:"icon",onClick:N,children:n.jsx(rn,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T,{variant:"outline",size:"sm",onClick:w,children:"Cancel"}),n.jsxs(T,{variant:"outline",size:"sm",onClick:()=>window.open(m.authUrl,"_blank"),children:[n.jsx(an,{className:"h-3.5 w-3.5 mr-1.5"}),"Open Browser"]})]})]})]}),n.jsxs(he,{className:"bg-muted/30",children:[n.jsx(ke,{className:"pb-2",children:n.jsx(be,{className:"text-sm font-medium",children:"How It Works"})}),n.jsxs(me,{className:"text-sm text-muted-foreground space-y-2",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"1. Connect:"})," Link this CLI to your Reshot platform project"]}),n.jsxs("p",{children:[n.jsx("strong",{children:"2. Capture:"})," Record and capture visuals locally in your workspace"]}),n.jsxs("p",{children:[n.jsx("strong",{children:"3. Commit:"})," Bundle scenarios and publish to the platform"]}),n.jsx("p",{className:"pt-2 text-xs",children:"Your captured assets remain local until you publish them. Re-link anytime to switch projects."})]})]})]})}function L1(){const{toast:e}=Pt(),[t,s]=d.useState([]),[r,i]=d.useState(!0),[a,o]=d.useState(null),[l,c]=d.useState("all"),u=d.useRef(null),[m,f]=d.useState(!0),g=d.useRef(0),[R,k]=d.useState(!1),[,C]=d.useState(null);d.useEffect(()=>{fetch("/api/settings").then(v=>v.json()).then(v=>{var L;C(((L=v.settings)==null?void 0:L.isAuthenticated)||!1)}).catch(()=>C(!1))},[]),d.useEffect(()=>{if(a&&u.current&&m){const v=a.logs.length;v>g.current&&(u.current.scrollTop=u.current.scrollHeight),g.current=v}},[a==null?void 0:a.logs,m]);const j=d.useCallback(()=>{if(u.current){const{scrollTop:v,scrollHeight:L,clientHeight:V}=u.current,y=L-v-V<50;f(y)}},[]),p=d.useCallback(async()=>{i(!0);try{const L=await(await fetch("/api/jobs?limit=50")).json();if(s(L.jobs||[]),i(!1),a){const V=L.jobs.find(y=>y.id===a.id);V&&o(V)}}catch(v){console.error("Failed to load jobs:",v),i(!1)}},[a==null?void 0:a.id]);d.useEffect(()=>{if(p(),!t.some(V=>V.status==="running"||V.status==="pending"))return;const L=setInterval(p,2e3);return()=>clearInterval(L)},[p,t.some(v=>v.status==="running")]);const h=d.useCallback(v=>{o(v),g.current=0,f(!0),fetch(`/api/jobs/${v.id}`).then(L=>L.json()).then(L=>{L.job&&o(L.job)}).catch(()=>{})},[]),x=d.useCallback(()=>{C(!0),e({title:"Connected",description:"Successfully connected to Reshot platform. You can now publish.",variant:"success"})},[e]),w=async(v,L)=>{L&&L.stopPropagation();try{const V=await fetch(`/api/jobs/${v}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"}}),y=await V.json();V.ok?(e({title:"Success",description:"Job cancelled",variant:"success"}),p()):e({title:"Error",description:y.error||"Failed to cancel job",variant:"destructive"})}catch{e({title:"Error",description:"Failed to cancel job",variant:"destructive"})}},N=async(v,L)=>{var V;L&&L.stopPropagation();try{const y=v.metadata||{};let _,F;switch(v.type){case"run":_="/api/jobs/run",F={scenarioKeys:y.scenarioKeys,variant:y.variant,format:y.format,diff:y.diff};break;case"publish":_="/api/jobs/publish",F={scenarioKeys:y.scenarioKeys,selectedGroups:y.selectedGroups,commitMessage:y.commitMessage};break;case"record":_="/api/jobs/record",F={...y};break;default:e({title:"Error",description:`Unknown job type: ${v.type}`,variant:"destructive"});return}const $=await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}),E=await $.json();if($.ok)if(e({title:"Retried",description:`New ${v.type} job created`,variant:"success"}),E.jobId||(V=E.job)!=null&&V.id){const A=E.jobId||E.job.id;await p(),s(z=>{const W=z.find(J=>J.id===A);return W&&o(W),z})}else await p();else e({title:"Error",description:E.error||"Failed to retry job",variant:"destructive"})}catch{e({title:"Error",description:"Failed to retry job",variant:"destructive"})}},S=v=>{switch(v){case"running":return n.jsx(_e,{className:"h-3 w-3 animate-spin"});case"success":return n.jsx(vt,{className:"h-3 w-3 text-green-500"});case"failed":return n.jsx(Da,{className:"h-3 w-3 text-destructive"});case"cancelled":return n.jsx(Vo,{className:"h-3 w-3 text-orange-500"});default:return n.jsx(hi,{className:"h-3 w-3 text-muted-foreground"})}},P=v=>{const L={pending:"secondary",running:"default",cancelled:"secondary",success:"default",failed:"destructive"};let V=v.status;if(v.status==="running"){const y=tr(v.logs);y&&(V=`${y.current}/${y.total}`)}return n.jsx(ue,{variant:L[v.status]||"secondary",className:"text-[10px] h-4 px-1.5",children:V})},b=v=>{switch(v){case"run":return n.jsx(Ts,{className:"h-3 w-3"});case"publish":return n.jsx(on,{className:"h-3 w-3"});case"record":return n.jsx(_n,{className:"h-3 w-3"});default:return null}},O=(v,L)=>{if(!L)return"Running...";const V=new Date(L).getTime()-new Date(v).getTime(),y=Math.floor(V/1e3);return y<60?`${y}s`:`${Math.floor(y/60)}m ${y%60}s`},D=l==="all"?t:t.filter(v=>v.type===l);return r&&t.length===0?n.jsx("div",{className:"p-8",children:n.jsx("div",{className:"text-muted-foreground",children:"Loading jobs..."})}):n.jsxs("div",{"data-testid":"studio-jobs","data-loaded":"true",className:"p-5 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 pb-3",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Jobs"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-normal",children:"Execution history and status"})]}),n.jsx(T,{variant:"outline",size:"icon",onClick:p,className:"shadow-sm",title:"Refresh",disabled:r,children:n.jsx(_t,{className:`h-4 w-4 ${r?"animate-spin":""}`})})]}),n.jsx("div",{className:"flex gap-2",children:["all","run","publish","record"].map(v=>n.jsx(T,{variant:l===v?"default":"outline",size:"sm",onClick:()=>c(v),children:v.charAt(0).toUpperCase()+v.slice(1)},v))}),n.jsxs("div",{className:"grid gap-3 lg:grid-cols-3",children:[n.jsx("div",{className:"lg:col-span-2 space-y-2",children:D.length===0?n.jsx(he,{className:"dagster-card",children:n.jsx(me,{className:"py-12 text-center",children:n.jsx("p",{className:"text-muted-foreground",children:"No jobs found"})})}):D.map(v=>n.jsxs(he,{className:Y("dagster-card cursor-pointer group transition-all",(a==null?void 0:a.id)===v.id&&"ring-2 ring-primary bg-primary/5"),onClick:()=>h(v),children:[n.jsx(ke,{className:"pb-2.5 px-4 pt-3",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:Y("p-1.5 rounded-md",v.type==="run"&&"bg-blue-500/10",v.type==="publish"&&"bg-green-500/10",v.type==="record"&&"bg-purple-500/10"),children:b(v.type)}),n.jsxs("div",{children:[n.jsx(be,{className:"text-xs font-semibold",children:v.type.charAt(0).toUpperCase()+v.type.slice(1)}),v.scenarioKey&&n.jsx(at,{className:"text-[10px] font-mono mt-0.5 text-muted-foreground",children:v.scenarioKey})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[v.status==="running"&&n.jsxs(T,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] text-orange-500 hover:text-orange-600 hover:bg-orange-500/10",onClick:L=>w(v.id,L),children:[n.jsx(Vo,{className:"h-3 w-3 mr-1"}),"Cancel"]}),(v.status==="failed"||v.status==="cancelled")&&n.jsxs(T,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] text-blue-500 hover:text-blue-600 hover:bg-blue-500/10",onClick:L=>N(v,L),children:[n.jsx(Wl,{className:"h-3 w-3 mr-1"}),"Retry"]}),S(v.status),P(v)]})]})}),n.jsxs(me,{className:"px-4 pb-3",children:[n.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:new Date(v.createdAt).toLocaleString()}),n.jsx("span",{className:"font-medium",children:O(v.createdAt,v.status==="running"?new Date().toISOString():v.updatedAt)})]}),(v.status==="running"||v.status==="pending")&&(()=>{const L=tr(v.logs);if(!L)return null;const V=Math.round(L.current/L.total*100);return n.jsxs("div",{className:"mt-2 space-y-1",children:[n.jsx(Fa,{value:V,className:"h-1.5"}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[n.jsxs("span",{children:[L.current,"/",L.total," completed"]}),n.jsxs("span",{children:[V,"%"]})]})]})})()]})]},v.id))}),a&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs(he,{className:"dagster-card",children:[n.jsxs(ke,{className:"px-4 py-3 border-b border-border/50 flex flex-row items-center justify-between",children:[n.jsx(be,{className:"text-xs font-semibold",children:"Job Details"}),n.jsxs("div",{className:"flex items-center gap-2",children:[a.status==="running"&&n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-[10px] text-orange-500 border-orange-500/30 hover:bg-orange-500/10",onClick:()=>w(a.id),children:[n.jsx(Vo,{className:"h-3 w-3 mr-1"}),"Cancel Job"]}),(a.status==="failed"||a.status==="cancelled")&&n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-[10px] text-blue-500 border-blue-500/30 hover:bg-blue-500/10",onClick:()=>N(a),children:[n.jsx(Wl,{className:"h-3 w-3 mr-1"}),"Retry Job"]})]})]}),n.jsxs(me,{className:"space-y-3 px-4 py-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Type"}),n.jsx("div",{className:"text-xs font-semibold",children:a.type})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Status"}),n.jsx("div",{className:"mt-1",children:P(a)})]}),(a.status==="running"||a.status==="pending")&&(()=>{const v=tr(a.logs);if(!v)return null;const L=Math.round(v.current/v.total*100);return n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Progress"}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(Fa,{value:L,className:"h-2"}),n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsxs("span",{className:"text-muted-foreground",children:[v.current,"/",v.total," completed"]}),n.jsxs("span",{className:"font-semibold",children:[L,"%"]})]})]})]})})(),a.scenarioKey&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Scenario"}),n.jsx(Kt,{to:`/scenarios/${a.scenarioKey}`,className:"text-xs font-mono text-primary hover:underline font-medium",children:a.scenarioKey})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Started"}),n.jsx("div",{className:"text-xs font-mono",children:new Date(a.createdAt).toLocaleString()})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Duration"}),n.jsx("div",{className:"text-xs font-semibold",children:O(a.createdAt,a.status==="running"?new Date().toISOString():a.updatedAt)})]})]})]}),n.jsxs(he,{className:"dagster-card",children:[n.jsxs(ke,{className:"px-4 py-3 border-b border-border/50 flex flex-row items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(be,{className:"text-xs font-semibold",children:"Logs"}),a.status==="running"&&n.jsxs(ue,{variant:"outline",className:"text-[9px] h-4 animate-pulse",children:[n.jsx(_e,{className:"h-2 w-2 mr-1 animate-spin"}),"Live"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!m&&n.jsx(T,{variant:"ghost",size:"sm",className:"h-6 text-[10px]",onClick:()=>{f(!0),u.current&&(u.current.scrollTop=u.current.scrollHeight)},children:"Jump to bottom"}),n.jsx(T,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>{fetch(`/api/jobs/${a.id}`).then(v=>v.json()).then(v=>{v.job&&o(v.job)})},children:n.jsx(_t,{className:"h-3 w-3"})})]})]}),n.jsx(me,{className:"px-4 py-3",children:n.jsx("div",{ref:u,onScroll:j,className:"bg-background/50 rounded-md p-3 font-mono text-[10px] max-h-80 overflow-y-auto border border-border/30",children:a.logs.length===0?n.jsx("div",{className:"text-muted-foreground text-center py-4",children:a.status==="running"?"Waiting for logs...":"No logs available"}):n.jsx("div",{className:"space-y-0.5",children:a.logs.map((v,L)=>{const V=Im(v.message),y=V.includes("⚠ Diff Detected")||V.includes("% changed"),_=V.includes("✔ No changes"),F=V.includes("Diff Summary:"),$=V.includes("📥 Fetching baselines")||V.includes("baseline"),E=V.includes("🔍 Computing visual diffs");let A="";return V.includes("[error]")?A="text-destructive":V.includes("[stderr]")?A="text-orange-500":y?A="text-amber-500 font-medium":_?A="text-green-500":F||E||$?A="text-cyan-500":V.includes("✔")&&(A="text-green-500"),n.jsxs("div",{className:"text-muted-foreground leading-relaxed",children:[n.jsx("span",{className:"text-muted-foreground/40 text-[9px]",children:new Date(v.timestamp).toLocaleTimeString()})," ",n.jsx("span",{className:A,children:V})]},L)})})})})]})]})]}),n.jsx(wi,{open:R,onOpenChange:k,onAuthenticated:x})]})}function M1(){var b,O,D;const{scenarioKey:e,variationSlug:t,captureKey:s}=Kp(),r=Os(),{toast:i}=Pt(),[a,o]=d.useState(null),[l,c]=d.useState(!0),[u,m]=d.useState(null),[f,g]=d.useState(!1),[R,k]=d.useState(""),[C,j]=d.useState({}),[p,h]=d.useState([]),[x,w]=d.useState(null);d.useEffect(()=>{if(!e||!t||!s){c(!1);return}fetch(`/api/output/${e}/${t}`).then(v=>v.json()).then(v=>{var V;const L=(V=v.assets)==null?void 0:V.find(y=>y.filename.replace(/\.[^/.]+$/,"")===s||y.captureKey===s);L&&(o(L),k(L.captureKey||s)),c(!1)}).catch(v=>{console.error("Failed to load asset:",v),c(!1)})},[e,t,s]),d.useEffect(()=>{!e||!s||fetch(`/api/config/scenarios/${e}`).then(v=>v.json()).then(v=>{const L=v.scenario;if(L!=null&&L.steps){const V=L.steps.findIndex(y=>{var _;return y.key===s||y.captureKey===s||((_=y.path)==null?void 0:_.replace(/\.[^/.]+$/,""))===s});V!==-1&&m({step:L.steps[V],index:V})}}).catch(v=>{console.error("Failed to load scenario:",v)})},[e,s]),d.useEffect(()=>{!e||!t||fetch(`/api/output/${e}/${t}/sentinels`).then(v=>v.json()).then(v=>{if(v.files&&v.files.length>0){const L=v.files.map((V,y)=>{var F,$;const _=($=(F=v.sentinelsManifest)==null?void 0:F.sentinels)==null?void 0:$.find(E=>E.filename===V);return{filename:V,label:(_==null?void 0:_.label)||`Step ${y}`,stepIndex:(_==null?void 0:_.stepIndex)??y,url:`${v.basePath}/${V}`,hasDiff:!1,diffPercent:void 0}});h(L)}}).catch(v=>{console.error("Failed to load sentinels:",v)})},[e,t]),d.useEffect(()=>{e&&fetch(`/api/output/${e}/versions`).then(v=>v.json()).then(v=>{const L=v.versions||[],V=L.find(y=>y.timestamp===t)||L[0];if(V){const y={};V.privacy&&(y.privacy=V.privacy),V.style&&(y.style=V.style),j(y)}}).catch(()=>{})},[e,t]),d.useEffect(()=>{!e||!t||p.length===0||fetch(`/api/output/${e}/versions`).then(v=>v.json()).then(v=>{const L=v.versions||[];if(L.length>0){const V=L[0].timestamp;return fetch(`/api/output/${e}/version/${V}/diff-manifest`)}return null}).then(v=>v==null?void 0:v.json()).then(v=>{var L;(L=v==null?void 0:v.manifest)!=null&&L.assets&&h(V=>V.map(y=>{const _=`${t}/sentinels/${y.filename.replace(".png","")}`,F=v.manifest.assets[_];return{...y,hasDiff:F&&!F.match,diffPercent:F==null?void 0:F.diffPercent}}))}).catch(v=>{console.error("Failed to load diff manifest:",v)})},[e,t,p.length]);const N=v=>v<1024?`${v} B`:v<1024*1024?`${(v/1024).toFixed(1)} KB`:`${(v/(1024*1024)).toFixed(1)} MB`,S=()=>{a!=null&&a.path&&(navigator.clipboard.writeText(a.path),i({title:"Copied",description:"File path copied to clipboard",variant:"success"}))},P=async()=>{i({title:"Info",description:"Capture key editing will be available in a future release",variant:"default"}),g(!1)};return l?n.jsx("div",{className:"p-8",children:n.jsx("div",{className:"text-muted-foreground",children:"Loading asset..."})}):a?n.jsxs("div",{"data-testid":"studio-asset-detail","data-loaded":"true",className:"p-5 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 pb-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs(T,{variant:"ghost",size:"sm",onClick:()=>r("/assets"),className:"shadow-sm",children:[n.jsx(Bl,{className:"h-3.5 w-3.5 mr-1.5"}),"Back"]}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold tracking-tight",children:a.filename}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1 font-mono",children:[e," / ",t]})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(T,{variant:"outline",size:"sm",onClick:S,className:"shadow-sm",children:[n.jsx(rn,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy Path"]}),n.jsxs("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground shadow-sm",children:[n.jsx(an,{className:"h-3.5 w-3.5"}),"Open"]})]})]}),n.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[n.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[n.jsxs(he,{children:[n.jsx(ke,{children:n.jsx(be,{children:"Preview"})}),n.jsx(me,{children:n.jsx("div",{className:"flex items-center justify-center min-h-[400px] bg-muted rounded-md",children:n.jsx(fo,{url:a.url,filename:a.filename,size:"lg"})})})]}),p.length>0&&n.jsxs(he,{children:[n.jsxs(ke,{children:[n.jsxs(be,{className:"text-sm flex items-center gap-2",children:["Sentinel Frames",p.some(v=>v.hasDiff)&&n.jsxs(ue,{variant:"destructive",className:"text-xs",children:[n.jsx(Qp,{className:"h-3 w-3 mr-1"}),"Changes Detected"]})]}),n.jsx(at,{children:"Captured at each step during recording for visual comparison"})]}),n.jsxs(me,{children:[n.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:p.map(v=>{var L;return n.jsxs("button",{onClick:()=>w((x==null?void 0:x.filename)===v.filename?null:v),className:Y("flex-shrink-0 w-24 h-16 rounded border-2 overflow-hidden relative group",v.hasDiff?"border-red-500":"border-transparent",(x==null?void 0:x.filename)===v.filename&&"ring-2 ring-primary"),title:v.label,children:[n.jsx("img",{src:v.url,alt:v.label,className:"w-full h-full object-cover"}),v.hasDiff&&n.jsxs("div",{className:"absolute top-0 right-0 bg-red-500 text-white text-[10px] px-1 rounded-bl",children:[(L=v.diffPercent)==null?void 0:L.toFixed(1),"%"]}),n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-white text-[10px] px-1 py-0.5 opacity-0 group-hover:opacity-100 transition-opacity truncate",children:v.label})]},v.filename)})}),x&&n.jsxs("div",{className:"mt-4 border rounded-lg p-4 bg-muted/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("div",{className:"text-sm font-medium",children:x.label}),x.hasDiff&&n.jsxs(ue,{variant:"destructive",children:[(b=x.diffPercent)==null?void 0:b.toFixed(2),"% different"]})]}),n.jsx("img",{src:x.url,alt:x.label,className:"w-full rounded border"})]})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs(he,{children:[n.jsx(ke,{children:n.jsx(be,{children:"Metadata"})}),n.jsxs(me,{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Capture Key"}),f?n.jsxs("div",{className:"flex gap-2 mt-1",children:[n.jsx(ve,{value:R,onChange:v=>k(v.target.value),className:"font-mono text-sm"}),n.jsx(T,{size:"sm",onClick:P,children:"Save"}),n.jsx(T,{size:"sm",variant:"outline",onClick:()=>{g(!1),k(a.captureKey||s||"")},children:"Cancel"})]}):n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-1 rounded flex-1",children:a.captureKey||s}),n.jsx(T,{variant:"ghost",size:"sm",onClick:()=>g(!0),children:"Edit"})]})]}),n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"File Size"}),n.jsx("div",{className:"text-sm font-medium mt-1",children:N(a.size)})]}),n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Modified"}),n.jsx("div",{className:"text-sm font-medium mt-1",children:new Date(a.mtime).toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"File Path"}),n.jsx("div",{className:"text-xs font-mono bg-muted px-2 py-1 rounded mt-1 break-all",children:a.relativePath})]}),u&&n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Linked Step"}),n.jsx("div",{className:"mt-1",children:n.jsxs(Kt,{to:`/scenarios/${e}?step=${u.index}`,className:"inline-flex items-center gap-1.5 text-sm text-primary hover:underline",children:[n.jsx(Rn,{className:"h-3.5 w-3.5"}),"Step #",u.index+1,": ",u.step.action]})}),u.step.selector&&n.jsx("div",{className:"text-xs font-mono bg-muted px-2 py-1 rounded mt-1",children:u.step.selector}),u.step.clip&&n.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Clip: ",JSON.stringify(u.step.clip)]})]}),n.jsxs("div",{children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Variation Context"}),n.jsx("div",{className:"mt-1",children:n.jsx(ue,{variant:"secondary",children:t})})]}),((O=C.privacy)==null?void 0:O.enabled)&&n.jsxs("div",{children:[n.jsxs(q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n.jsx(xr,{className:"h-3 w-3"}),"Privacy Masking"]}),n.jsxs("div",{className:"text-sm font-medium mt-1 capitalize",children:[C.privacy.method||"redact",C.privacy.selectorCount!=null&&n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(",C.privacy.selectorCount," selector",C.privacy.selectorCount!==1?"s":"",")"]})]})]}),((D=C.style)==null?void 0:D.enabled)&&n.jsxs("div",{children:[n.jsxs(q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[n.jsx(ao,{className:"h-3 w-3"}),"Style Processing"]}),n.jsxs("div",{className:"text-sm font-medium mt-1",children:[C.style.frame!=="none"&&n.jsxs("span",{className:"capitalize",children:[C.style.frame," frame"]}),C.style.shadow!=="none"&&n.jsxs("span",{children:[C.style.frame!=="none"?", ":"",C.style.shadow," shadow"]}),(!C.style.frame||C.style.frame==="none")&&(!C.style.shadow||C.style.shadow==="none")&&n.jsx("span",{children:"Custom style applied"})]})]})]})]}),u&&n.jsxs(he,{children:[n.jsx(ke,{children:n.jsx(be,{children:"Step Details"})}),n.jsxs(me,{className:"space-y-2 text-sm",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground",children:"Action:"})," ",n.jsx(ue,{variant:"outline",children:u.step.action})]}),u.step.selectorPadding!==void 0&&n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground",children:"Selector Padding:"})," ",u.step.selectorPadding,"px"]}),u.step.deviceScaleFactor!==void 0&&n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground",children:"Device Scale Factor:"})," ",u.step.deviceScaleFactor]})]})]})]})]})]}):n.jsx("div",{className:"p-8",children:n.jsxs(he,{children:[n.jsxs(ke,{children:[n.jsx(be,{children:"Asset Not Found"}),n.jsx(at,{children:"The requested asset could not be found."})]}),n.jsx(me,{children:n.jsxs(T,{onClick:()=>r("/assets"),variant:"outline",children:[n.jsx(Bl,{className:"h-4 w-4 mr-2"}),"Back to Assets"]})})]})})}function I1({visualKey:e,visualTitle:t,targetUrl:s,targetId:r,scenarioUrl:i,onRecordingComplete:a}){const{status:o,steps:l,isConnected:c,start:u,stop:m,capture:f,removeStep:g}=bm(),{toast:R}=Pt(),[k,C]=d.useState(!1),[j,p]=d.useState(!1),[h,x]=d.useState(!1),[w,N]=d.useState(null),S=d.useRef(null);d.useEffect(()=>{S.current&&(S.current.scrollTop=S.current.scrollHeight)},[l]);const P=async()=>{C(!0);try{await u({visualKey:e,title:t||"Untitled Visual",targetUrl:s,targetId:r,scenarioUrl:i})}catch(v){R({title:"Error",description:v.message,variant:"destructive"})}finally{C(!1)}},b=async v=>{v?p(!0):x(!0);try{await m(v),R({title:v?"Recording Saved":"Recording Cancelled",description:v?"Your scenario has been saved.":"Recording was discarded.",variant:v?"success":"default"}),v&&a?a(o.visualKey):a&&a()}catch(L){R({title:"Error",description:L.message,variant:"destructive"})}finally{p(!1),x(!1)}},O=async()=>{try{await f({outputFilename:`${o.visualKey}-${Date.now()}.png`}),R({title:"Screenshot Captured",variant:"success"})}catch(v){R({title:"Error",description:v.message,variant:"destructive"})}},D=async v=>{N(v);try{await g(v),R({title:"Step Removed",variant:"success"})}catch(L){R({title:"Error",description:L.message,variant:"destructive"})}finally{N(null)}};return n.jsxs("div",{className:"space-y-4",children:[n.jsxs(he,{className:o.active?"border-green-500/50":"",children:[n.jsx(ke,{className:"pb-3",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(be,{className:"text-sm font-medium",children:o.active?"Recording Active":"Ready to Record"}),o.active&&n.jsx(ue,{variant:"default",className:"animate-pulse bg-red-500",children:"LIVE"})]}),c?n.jsx(ue,{variant:"outline",className:"text-green-500 border-green-500/30",children:"System Connected"}):n.jsx(ue,{variant:"destructive",children:"System Disconnected"})]})}),n.jsx(me,{children:o.active?n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"flex gap-2",children:n.jsxs(T,{onClick:O,variant:"secondary",className:"flex-1",children:[n.jsx(na,{className:"mr-2 h-4 w-4 fill-current"}),"Capture Screen"]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(T,{onClick:()=>b(!1),variant:"outline",disabled:h||j,className:"flex-1",children:[h?n.jsx(_e,{className:"mr-2 h-4 w-4 animate-spin"}):n.jsx(ln,{className:"mr-2 h-4 w-4"}),"Cancel"]}),n.jsxs(T,{onClick:()=>b(!0),variant:"default",disabled:j||h,className:"flex-1 bg-green-600 hover:bg-green-700",children:[j?n.jsx(_e,{className:"mr-2 h-4 w-4 animate-spin"}):n.jsx(Hr,{className:"mr-2 h-4 w-4"}),"Stop & Save"]})]}),n.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[l.length," step",l.length!==1?"s":""," recorded"]})]}):n.jsxs(T,{onClick:P,disabled:k||!c,className:"w-full",children:[k?n.jsx(_e,{className:"mr-2 h-4 w-4 animate-spin"}):n.jsx(_n,{className:"mr-2 h-4 w-4"}),"Start Recording"]})})]}),o.active&&n.jsxs(he,{className:"h-64 flex flex-col",children:[n.jsx(ke,{className:"py-3 border-b bg-muted/30",children:n.jsx(be,{className:"text-xs font-mono uppercase text-muted-foreground",children:"Live Action Log"})}),n.jsxs("div",{ref:S,className:"flex-1 overflow-y-auto p-4 space-y-2 font-mono text-xs",children:[l.length===0&&n.jsx("div",{className:"text-center text-muted-foreground py-8",children:"Interact with the browser window to see actions here..."}),l.map((v,L)=>n.jsxs("div",{className:"group flex items-start gap-2 p-2 rounded bg-muted/50 border border-transparent hover:border-border transition-colors",children:[n.jsxs("div",{className:"mt-0.5 text-muted-foreground",children:[v.action==="click"&&n.jsx(Jy,{className:"h-3 w-3"}),v.action==="type"&&n.jsx(t0,{className:"h-3 w-3"}),v.action==="screenshot"&&n.jsx(Oy,{className:"h-3 w-3"})]}),n.jsxs("div",{className:"flex-1 break-all",children:[n.jsx("span",{className:"font-bold text-primary",children:v.action.toUpperCase()}),n.jsx("span",{className:"mx-2 text-muted-foreground",children:"→"}),n.jsx("span",{className:"bg-background px-1 rounded border",children:v.selector||"page"}),v.text&&n.jsxs("div",{className:"mt-1 text-muted-foreground",children:['Value: "',v.text,'"']})]}),n.jsx("button",{onClick:()=>D(L),disabled:w!==null,className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-red-100 hover:text-red-600 rounded",title:"Remove this step",children:w===L?n.jsx(_e,{className:"h-3 w-3 animate-spin"}):n.jsx(ps,{className:"h-3 w-3"})})]},L))]})]})]})}function D1(){const e=Os(),{status:t,isConnected:s,error:r,diagnostics:i}=bm(),{toast:a}=Pt(),[o,l]=d.useState([]),[c,u]=d.useState(""),[m,f]=d.useState(""),[g,R]=d.useState(""),[k,C]=d.useState("new"),[j,p]=d.useState(null),[h,x]=d.useState(!1),[w,N]=d.useState([]),[S,P]=d.useState(""),[b,O]=d.useState(!1),[D,v]=d.useState(null),[L,V]=d.useState(!1),y=d.useCallback(async()=>{x(!0);try{const fe=await(await fetch("/api/recorder/check-chrome")).json();p(fe)}catch{p({ok:!1,chromeAvailable:!1,error:"Failed to check Chrome status"})}finally{x(!1)}},[]),_=d.useCallback(async()=>{O(!0);try{const fe=await(await fetch("/api/recorder/tabs")).json();if(fe.ok&&fe.tabs){const ye=fe.tabs.filter(ge=>!ge.isOurUI&&!ge.isChrome);N(ye),P(ge=>!ge&&ye.length>0?ye[0].id:ge&&ye.some(Re=>Re.id===ge)?ge:ye.length>0?ye[0].id:"")}}catch(G){console.error("Failed to load tabs:",G)}finally{O(!1)}},[]),F=d.useCallback(async()=>{try{const fe=await(await fetch("/api/recorder/session-status")).json();fe.ok&&v(fe)}catch(G){console.error("Failed to check session status:",G)}},[]),$=d.useCallback(async()=>{V(!0);try{const fe=await(await fetch("/api/recorder/save-session",{method:"POST"})).json();fe.ok?(a({title:"Session Saved",description:"Your authenticated session has been saved. Future captures will use your login state."}),F()):a({title:"Save Failed",description:fe.error||"Could not save session. Make sure Chrome is running with your app logged in.",variant:"destructive"})}catch{a({title:"Error",description:"Failed to connect to server",variant:"destructive"})}finally{V(!1)}},[a,F]),E=d.useCallback(async()=>{var G;try{const ye=await(await fetch("/api/config")).json();(G=ye.config)!=null&&G.scenarios&&l(ye.config.scenarios)}catch(fe){console.error("Failed to load scenarios:",fe)}},[]);d.useEffect(()=>{E(),y(),F()},[y,F]),d.useEffect(()=>{j!=null&&j.chromeAvailable&&_()},[j==null?void 0:j.chromeAvailable,_]);const A=()=>{if(k==="existing"&&c){const G=o.find(fe=>fe.key===c);return{visualKey:c,title:(G==null?void 0:G.name)||c}}return k==="new"&&m.trim()?{visualKey:m.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),title:m.trim()}:{visualKey:void 0,title:void 0}},{visualKey:z,title:W}=A(),J=w.find(G=>G.id===S);return n.jsxs("div",{"data-testid":"studio-recorder","data-loaded":"true",className:"p-8 space-y-6 max-w-4xl mx-auto",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-3xl font-bold",children:"Recording Studio"}),n.jsx("p",{className:"text-muted-foreground mt-2",children:"Capture screenshots and user interactions from your application"})]}),n.jsxs(he,{className:j!=null&&j.hasValidTab?"border-green-500/50 bg-green-500/5":j!=null&&j.chromeAvailable?"border-yellow-500/50 bg-yellow-500/5":"border-red-500/50 bg-red-500/5",children:[n.jsx(ke,{className:"pb-3",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(be,{className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(Yp,{className:"h-4 w-4"}),"Chrome Browser Status"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(T,{variant:"ghost",size:"icon",onClick:y,disabled:h,title:"Refresh",children:n.jsx(_t,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),j&&n.jsx(ue,{variant:j.hasValidTab?"default":j.chromeAvailable?"secondary":"destructive",children:j.hasValidTab?n.jsxs(n.Fragment,{children:[n.jsx(vt,{className:"h-3 w-3 mr-1"}),"Ready"]}):j.chromeAvailable?n.jsxs(n.Fragment,{children:[n.jsx(Jt,{className:"h-3 w-3 mr-1"}),"Needs Tab"]}):n.jsxs(n.Fragment,{children:[n.jsx(Jt,{className:"h-3 w-3 mr-1"}),"Not Running"]})})]})]})}),n.jsxs(me,{className:"space-y-3",children:[!(j!=null&&j.chromeAvailable)&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:n.jsx(ue,{variant:"secondary",children:"Not Connected"})}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"To enable recording, launch a dedicated Chrome instance:"}),n.jsxs("div",{className:"bg-background rounded-md p-3 border space-y-2",children:[n.jsx("p",{className:"text-xs font-medium text-foreground",children:"Run this command in your Terminal:"}),n.jsxs("div",{className:"relative",children:[n.jsx("code",{className:"block bg-muted px-3 py-2 pr-10 rounded text-xs font-mono break-all select-all",children:'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.reshot/chrome-debug"'}),n.jsx(T,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:()=>{navigator.clipboard.writeText('/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.reshot/chrome-debug"'),a({title:"Copied",description:"Command copied to clipboard"})},title:"Copy command",children:n.jsx(rn,{className:"h-3.5 w-3.5"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Note: This launches a separate Chrome profile. You do not need to close your main browser."})]})]}),(j==null?void 0:j.chromeAvailable)&&!j.hasValidTab&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm text-yellow-600 font-medium",children:"Chrome is running, but no valid tabs found."}),n.jsx("p",{className:"text-xs text-muted-foreground",children:'Please open a tab and navigate to your application, then click "Refresh" above.'})]}),(j==null?void 0:j.hasValidTab)&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-green-600 font-medium",children:"✓ Chrome is ready for recording!"}),w.length>0&&n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs font-medium",children:"Select Tab to Record:"}),n.jsx("div",{className:"space-y-1.5",children:w.map(G=>n.jsxs("div",{onClick:()=>P(G.id),className:`flex items-center gap-2 text-xs px-3 py-2 rounded cursor-pointer transition-colors ${S===G.id?"bg-primary text-primary-foreground":"bg-muted/50 hover:bg-muted"}`,children:[n.jsx(ur,{className:"h-3 w-3 flex-shrink-0"}),n.jsxs("div",{className:"truncate flex-1",children:[n.jsx("div",{className:"font-medium truncate",children:G.title||"Untitled"}),n.jsx("div",{className:`text-[10px] truncate ${S===G.id?"text-primary-foreground/70":"text-muted-foreground"}`,children:G.url})]}),S===G.id&&n.jsx(vt,{className:"h-3 w-3 flex-shrink-0"})]},G.id))}),n.jsxs(T,{variant:"ghost",size:"sm",onClick:_,disabled:b,className:"text-xs",children:[n.jsx(_t,{className:`h-3 w-3 mr-1 ${b?"animate-spin":""}`}),"Refresh Tabs"]})]}),w.length===0&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"No recordable tabs found. Open your application in Chrome."})]})]})]}),(j==null?void 0:j.chromeAvailable)&&n.jsxs(he,{className:D!=null&&D.hasSession?"border-blue-500/30":"border-muted",children:[n.jsxs(ke,{className:"pb-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(be,{className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(La,{className:"h-4 w-4"}),"Authentication Session"]}),(D==null?void 0:D.hasSession)&&n.jsx(ue,{variant:D.isStale?"secondary":"default",children:D.isStale?"Stale":"Active"})]}),n.jsx(at,{className:"text-xs",children:"Save your logged-in session so captures can access authenticated pages"})]}),n.jsxs(me,{className:"space-y-3",children:[D!=null&&D.hasSession?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[n.jsx(vt,{className:"h-4 w-4"}),n.jsx("span",{children:"Session saved"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[n.jsxs("p",{children:[D.cookieCount," cookies stored"]}),n.jsxs("p",{children:["Saved"," ",D.ageHours?`${D.ageHours}h ago`:"recently"]}),D.isStale&&n.jsx("p",{className:"text-yellow-600",children:"Session may be expired - consider saving a fresh one"})]})]}):n.jsx("div",{className:"text-xs text-muted-foreground",children:n.jsx("p",{children:"No saved session. Log into your app in Chrome, then save your session."})}),n.jsx(T,{variant:D!=null&&D.hasSession?"outline":"default",size:"sm",onClick:$,disabled:L||!(j!=null&&j.chromeAvailable),className:"w-full",children:L?n.jsxs(n.Fragment,{children:[n.jsx(_t,{className:"h-3 w-3 mr-2 animate-spin"}),"Saving..."]}):n.jsxs(n.Fragment,{children:[n.jsx(La,{className:"h-3 w-3 mr-2"}),D!=null&&D.hasSession?"Update Session":"Save Session"]})})]})]}),n.jsxs(he,{className:s?"border-green-500/30":"border-red-500/30",children:[n.jsx(ke,{className:"pb-3",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(be,{className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(Ia,{className:"h-4 w-4"}),"Server Connection"]}),n.jsx(ue,{variant:s?"default":"destructive",children:s?n.jsxs(n.Fragment,{children:[n.jsx(vt,{className:"h-3 w-3 mr-1"}),"Connected"]}):n.jsxs(n.Fragment,{children:[n.jsx(Jt,{className:"h-3 w-3 mr-1"}),"Disconnected"]})})]})}),n.jsx(me,{children:n.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Real-time events will be captured and displayed.":"Connection lost. Please refresh the page."})})]}),r&&n.jsx(he,{className:"border-red-500/50 bg-red-50/10",children:n.jsx(me,{className:"pt-4",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Jt,{className:"h-5 w-5 text-red-500 mt-0.5"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-red-600",children:"Recording Error"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})]})})}),!t.active&&n.jsxs(he,{children:[n.jsxs(ke,{children:[n.jsxs(be,{className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(_n,{className:"h-4 w-4"}),"Configure Recording Session"]}),n.jsx(at,{children:"Choose to record a new visual or edit an existing scenario"})]}),n.jsxs(me,{className:"space-y-4",children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx(T,{variant:k==="new"?"default":"outline",size:"sm",onClick:()=>C("new"),children:"New Visual"}),n.jsxs(T,{variant:k==="existing"?"default":"outline",size:"sm",onClick:()=>C("existing"),disabled:o.length===0,children:["Edit Existing (",o.length,")"]})]}),k==="new"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{htmlFor:"visual-title",children:"Visual Title"}),n.jsx(ve,{id:"visual-title",placeholder:"e.g., Admin Dashboard View",value:m,onChange:G=>f(G.target.value)}),m&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Key:"," ",n.jsx("code",{className:"bg-muted px-1 rounded",children:z})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(q,{htmlFor:"visual-url",children:["Scenario URL"," ",n.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),n.jsx(ve,{id:"visual-url",placeholder:"https://your-app.com/page (uses tab URL if blank)",value:g,onChange:G=>R(G.target.value)}),n.jsx("p",{className:"text-xs text-muted-foreground",children:g?"This URL will be saved with the scenario.":"Leave blank to use the URL from the selected Chrome tab."})]})]}),k==="existing"&&o.length>0&&n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{children:"Select Scenario"}),n.jsx("div",{className:"grid gap-2",children:o.map(G=>{var fe;return n.jsxs("div",{onClick:()=>u(G.key),className:`p-3 rounded-md border cursor-pointer transition-colors ${c===G.key?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[n.jsx("p",{className:"font-medium text-sm",children:G.name}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:[G.key," • ",((fe=G.steps)==null?void 0:fe.length)||0," steps"]})]},G.key)})})]})]})]}),n.jsx(I1,{visualKey:z,visualTitle:W,targetUrl:J==null?void 0:J.url,targetId:S,scenarioUrl:k==="new"&&g.trim()?g.trim():void 0,onRecordingComplete:G=>{a({title:"Recording Complete",description:"Scenario has been saved.",variant:"success"});const fe=G||z;fe?setTimeout(()=>{e(`/scenarios/${fe}`)},500):fetch("/api/config").then(ye=>ye.json()).then(ye=>{var ge;if((ge=ye.config)!=null&&ge.scenarios){l(ye.config.scenarios);const Re=ye.config.scenarios[ye.config.scenarios.length-1];Re!=null&&Re.key?e(`/scenarios/${Re.key}`):e("/scenarios")}}).catch(()=>{e("/scenarios")})}}),i.length>0&&n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 border-b",children:n.jsxs(be,{className:"text-xs font-mono uppercase text-muted-foreground flex items-center gap-2",children:[n.jsx(e0,{className:"h-3 w-3"}),"Diagnostic Log (",i.length,")"]})}),n.jsx(me,{className:"p-0 max-h-48 overflow-y-auto",children:n.jsx("div",{className:"font-mono text-xs divide-y divide-border",children:i.slice(-20).map((G,fe)=>n.jsxs("div",{className:`px-4 py-2 ${G.level==="error"?"bg-red-50/10 text-red-600":G.level==="warn"?"bg-yellow-50/10 text-yellow-600":"text-muted-foreground"}`,children:[n.jsxs("span",{className:"opacity-50",children:["[",new Date(G.timestamp).toLocaleTimeString(),"]"]})," ",G.message]},fe))})})]}),n.jsxs(he,{className:"bg-muted/30",children:[n.jsx(ke,{children:n.jsx(be,{className:"text-sm font-medium",children:"How to Record"})}),n.jsx(me,{className:"text-sm text-muted-foreground space-y-4",children:n.jsxs("ol",{className:"list-decimal list-inside space-y-3",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Launch a dedicated Chrome instance"})," with debugging enabled:",n.jsxs("div",{className:"relative mt-1",children:[n.jsx("code",{className:"block bg-background px-2 py-1.5 pr-10 rounded text-xs font-mono select-all",children:'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.reshot/chrome-debug"'}),n.jsx(T,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6",onClick:()=>{navigator.clipboard.writeText('/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.reshot/chrome-debug"'),a({title:"Copied",description:"Command copied to clipboard"})},title:"Copy command",children:n.jsx(rn,{className:"h-3 w-3"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1 italic",children:"This uses a separate Chrome profile. Your main browser stays untouched."})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Navigate to your application"})," in the Chrome window that opens"]}),n.jsxs("li",{children:[n.jsx("strong",{children:'Click "Refresh"'})," in the Chrome Status card above to verify connection"]}),n.jsxs("li",{children:["Configure a new visual or select an existing scenario, then click"," ",n.jsx("strong",{children:'"Start Recording"'})]}),n.jsxs("li",{children:["Interact with your app - clicks and inputs will be captured. Click"," ",n.jsx("strong",{children:'"Capture Screen"'})," for screenshots."]}),n.jsxs("li",{children:["Click ",n.jsx("strong",{children:'"Stop & Save"'})," when finished"]})]})})]})]})}const ca=d.forwardRef(({checked:e,onCheckedChange:t,className:s,disabled:r},i)=>n.jsx("button",{ref:i,role:"switch","aria-checked":e,disabled:r,onClick:()=>t(!e),className:Y("inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors duration-150","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50",e?"bg-primary":"bg-muted",s),children:n.jsx("span",{className:Y("pointer-events-none h-5 w-5 rounded-full bg-foreground shadow-lg transition-transform duration-150",e?"translate-x-5":"translate-x-0.5")})}));ca.displayName="Switch";const js=d.forwardRef(({selected:e,onClick:t,label:s,children:r,className:i},a)=>n.jsxs("button",{ref:a,onClick:t,className:Y("group flex flex-col items-center gap-1.5 rounded-lg p-3 cursor-pointer transition-all duration-150","active:scale-[0.98]",e?"ring-2 ring-primary bg-primary/5 border-transparent":"border border-border/40 bg-card/30 hover:bg-card/60 hover:border-border/60 hover:shadow-[0_2px_8px_rgba(0,0,0,0.2)]",i),children:[n.jsx("div",{className:"w-full h-12 flex items-center justify-center",children:r}),n.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors duration-150",children:s})]}));js.displayName="OptionCard";function Wi(e,t,s){const r=(e-t)/(s-t)*100;return`linear-gradient(to right, hsl(262 83% 58%) ${r}%, hsl(217 33% 17%) ${r}%)`}const F1=[{key:"locale",label:"Language",description:"Internationalization (i18n)",icon:ur},{key:"role",label:"User Role",description:"RBAC / Permissions",icon:tm},{key:"theme",label:"Theme",description:"Light/Dark mode",icon:Xc}];function $1(){var je,B,oe,se,re,qe,De,At;const[e,t]=d.useState(null),[s,r]=d.useState(!0),[i,a]=d.useState(!1),[o,l]=d.useState(null),[c,u]=d.useState(!1),[m,f]=d.useState(!1),[g,R]=d.useState(""),[k,C]=d.useState(""),[j,p]=d.useState(""),[h,x]=d.useState({}),[w,N]=d.useState(null),[S,P]=d.useState(!1),[b,O]=d.useState({enabled:!1,method:"redact",blurRadius:8,selectors:[]}),[D,v]=d.useState(""),[L,V]=d.useState(!1),[y,_]=d.useState({enabled:!1,frame:"none",shadow:"medium",padding:40,background:"transparent",borderRadius:0}),[F,$]=d.useState(!1),[E,A]=d.useState(null),[z,W]=d.useState(!1),[J,G]=d.useState([]),[fe,ye]=d.useState([]),[ge,Re]=d.useState(""),[U,X]=d.useState(null),{toast:Z}=Pt(),ce=d.useCallback(async()=>{try{const ee=await(await fetch("/api/config")).json();t(ee.config);const Ce=await(await fetch("/api/viewports")).json();x(Ce.all||{});const Ge=await(await fetch("/api/output-template")).json();G(Ge.presets||[]),ye(Ge.availableVariables||[]),Re(Ge.currentTemplate||"");const pn=await(await fetch("/api/privacy")).json();O(pn);const mn=await(await fetch("/api/style")).json();_(mn)}catch(I){console.error("Failed to load config:",I),Z({title:"Error",description:"Failed to load configuration",variant:"destructive"})}finally{r(!1)}},[Z]);d.useEffect(()=>{ce()},[ce]);const ie=d.useCallback(async I=>{if(!I){X(null);return}try{const pe=await(await fetch("/api/output-template/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({template:I})})).json();X(pe)}catch{X({valid:!1,error:"Failed to validate"})}},[]);d.useEffect(()=>{const I=setTimeout(()=>{ge&&ie(ge)},500);return()=>clearTimeout(I)},[ge,ie]),d.useEffect(()=>{if(!y.enabled)return;const I=setTimeout(async()=>{W(!0);try{const ee=await fetch("/api/style/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({style:y})}),pe=await ee.json();ee.ok&&pe.preview&&A(pe.preview)}catch{}finally{W(!1)}},600);return()=>clearTimeout(I)},[y]);const ae=async()=>{var I;if(e){a(!0);try{const ee=await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(ge&&ge!==((I=e.output)==null?void 0:I.template)&&await fetch("/api/output-template",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({template:ge})}),ee.ok)Z({title:"Saved",description:"Configuration updated successfully",variant:"success"});else throw new Error("Failed to save")}catch{Z({title:"Error",description:"Failed to save configuration",variant:"destructive"})}finally{a(!1)}}},Se=(I,ee)=>{e&&t({...e,[I]:ee})},Ie=(I,ee)=>{e&&t({...e,viewport:{width:I,height:ee}})},mt=(I,ee,pe)=>{var Ge;if(!e||!I.trim())return;const Ce=I.toLowerCase().replace(/\s+/g,"-"),Oe=((Ge=e.variants)==null?void 0:Ge.dimensions)||{};if(Oe[Ce]){Z({title:"Already exists",description:`Dimension "${Ce}" already exists`,variant:"destructive"});return}t({...e,variants:{...e.variants,dimensions:{...Oe,[Ce]:{label:ee||I,description:pe,options:{}}}}}),l(Ce),u(!1),R("")},Nt=I=>{var pe;if(!e)return;const ee={...(pe=e.variants)==null?void 0:pe.dimensions};delete ee[I],t({...e,variants:{...e.variants,dimensions:ee}}),o===I&&l(Object.keys(ee)[0]||null)},Ft=(I,ee,pe)=>{var ls;if(!e||!ee.trim())return;const Ce=ee.toLowerCase().replace(/\s+/g,"-"),Oe=((ls=e.variants)==null?void 0:ls.dimensions)||{},Ge=Oe[I];if(Ge){if(Ge.options[Ce]){Z({title:"Already exists",description:`Option "${Ce}" already exists`,variant:"destructive"});return}t({...e,variants:{...e.variants,dimensions:{...Oe,[I]:{...Ge,options:{...Ge.options,[Ce]:{name:pe||ee,inject:[]}}}}}}),f(!1),C(""),p("")}},Yt=(I,ee)=>{var Ge;if(!e)return;const pe=((Ge=e.variants)==null?void 0:Ge.dimensions)||{},Ce=pe[I];if(!Ce)return;const Oe={...Ce.options};delete Oe[ee],t({...e,variants:{...e.variants,dimensions:{...pe,[I]:{...Ce,options:Oe}}}})},$t=(I,ee,pe,Ce,Oe)=>{var mn;if(!e)return;const Ge=((mn=e.variants)==null?void 0:mn.dimensions)||{},ls=Ge[I];if(!ls)return;const pn=ls.options[ee];if(!pn)return;const ki=Ce||Oe?[{method:pe,key:Ce,value:Oe}]:[];t({...e,variants:{...e.variants,dimensions:{...Ge,[I]:{...ls,options:{...ls.options,[ee]:{...pn,inject:ki}}}}}})};if(s)return n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(_e,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(!e)return n.jsx("div",{className:"p-6",children:n.jsx(he,{children:n.jsxs(me,{className:"py-12 text-center",children:[n.jsx(Ia,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),n.jsx("p",{className:"text-muted-foreground",children:"No configuration found."}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Create a docsync.config.json file to get started."})]})})});const kt=((je=e.variants)==null?void 0:je.dimensions)||{},Tt=Object.keys(kt),Vt=o?kt[o]:null;return n.jsxs("div",{"data-testid":"studio-config","data-loaded":"true",className:"h-full flex flex-col",children:[n.jsxs("div",{className:"shrink-0 px-4 py-3 border-b flex items-center justify-between bg-card",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-sm font-semibold",children:"Configuration"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"docsync.config.json"})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(T,{variant:"ghost",size:"sm",onClick:ce,className:"h-7",children:n.jsx(_t,{className:"h-3 w-3"})}),n.jsxs(T,{size:"sm",onClick:ae,disabled:i,className:"h-7",children:[i?n.jsx(_e,{className:"h-3 w-3 animate-spin"}):n.jsx(Hr,{className:"h-3 w-3 mr-1"}),"Save"]})]})]}),n.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Base URL"}),n.jsx(ve,{value:e.baseUrl,onChange:I=>Se("baseUrl",I.target.value),placeholder:"http://localhost:3000",className:"h-8 text-sm"})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Asset Directory"}),n.jsx(ve,{value:e.assetDir,onChange:I=>Se("assetDir",I.target.value),placeholder:".reshot/output",className:"h-8 text-sm"})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Viewport"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(T,{variant:e.viewport.width===1280?"default":"outline",size:"sm",className:"h-8 text-xs flex-1",onClick:()=>Ie(1280,720),children:"720p"}),n.jsx(T,{variant:e.viewport.width===1920?"default":"outline",size:"sm",className:"h-8 text-xs flex-1",onClick:()=>Ie(1920,1080),children:"1080p"})]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Options"}),n.jsxs("div",{className:"flex items-center gap-3 h-8",children:[n.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[n.jsx(ns,{checked:e.headless,onCheckedChange:I=>Se("headless",!!I)}),"Headless"]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"×"}),n.jsx(ve,{type:"number",value:e.concurrency,onChange:I=>Se("concurrency",parseInt(I.target.value)||1),className:"h-7 w-12 text-xs text-center",min:1,max:8})]})]})]})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx($y,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx(be,{className:"text-sm",children:"Visual Diffing"}),n.jsx(at,{className:"text-xs",children:"Compare generated assets against approved baselines"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:(B=e.diffing)!=null&&B.enabled?"Enabled":"Disabled"}),n.jsx(ca,{checked:((oe=e.diffing)==null?void 0:oe.enabled)??!1,onCheckedChange:I=>{var ee,pe;return t({...e,diffing:{enabled:I,threshold:((ee=e.diffing)==null?void 0:ee.threshold)??.1,includeAA:((pe=e.diffing)==null?void 0:pe.includeAA)??!1}})}})]})]})}),((se=e.diffing)==null?void 0:se.enabled)&&n.jsx(me,{className:"pt-0 pb-4 px-4 space-y-4 border-t",children:n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs(q,{className:"text-xs text-muted-foreground",children:["Sensitivity Threshold:"," ",((((re=e.diffing)==null?void 0:re.threshold)??.1)*100).toFixed(0),"%"]}),n.jsx("input",{type:"range",min:"0",max:"100",value:(((qe=e.diffing)==null?void 0:qe.threshold)??.1)*100,onChange:I=>t({...e,diffing:{...e.diffing,threshold:parseInt(I.target.value)/100}}),className:"slider-primary w-full",style:{background:Wi((((De=e.diffing)==null?void 0:De.threshold)??.1)*100,0,100)}}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Lower = more sensitive. 10% is recommended."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Options"}),n.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[n.jsx(ns,{checked:((At=e.diffing)==null?void 0:At.includeAA)??!1,onCheckedChange:I=>t({...e,diffing:{...e.diffing,includeAA:!!I}})}),"Include anti-aliasing in diff"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"When disabled, minor rendering differences are ignored."})]})]})})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xr,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx(be,{className:"text-sm",children:"Privacy Masking"}),n.jsx(at,{className:"text-xs",children:"Hide or redact sensitive elements before capture"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:b.enabled?"Enabled":"Disabled"}),n.jsx(ca,{checked:b.enabled,onCheckedChange:I=>O({...b,enabled:I})})]})]})}),b.enabled&&n.jsxs(me,{className:"pt-0 pb-4 px-4 space-y-4 border-t",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Default Method"}),n.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[n.jsx(js,{selected:b.method==="redact",onClick:()=>O({...b,method:"redact"}),label:"Redact",children:n.jsxs("div",{className:"w-full flex flex-col gap-1.5 px-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Email"}),n.jsx("div",{className:"w-14 h-2.5 bg-foreground rounded-sm"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Phone"}),n.jsx("div",{className:"w-10 h-2.5 bg-foreground rounded-sm"})]})]})}),n.jsx(js,{selected:b.method==="blur",onClick:()=>O({...b,method:"blur"}),label:"Blur",children:n.jsxs("div",{className:"w-full flex flex-col gap-1.5 px-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Email"}),n.jsx("span",{className:"text-[9px] text-muted-foreground select-none",style:{filter:"blur(3px)"},children:"j@acme.co"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Phone"}),n.jsx("span",{className:"text-[9px] text-muted-foreground select-none",style:{filter:"blur(3px)"},children:"555-0123"})]})]})}),n.jsx(js,{selected:b.method==="hide",onClick:()=>O({...b,method:"hide"}),label:"Hide",children:n.jsxs("div",{className:"w-full flex flex-col gap-1.5 px-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Email"}),n.jsx("div",{className:"w-14 h-3 border border-dashed border-muted-foreground/30 rounded-sm"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Phone"}),n.jsx("div",{className:"w-10 h-3 border border-dashed border-muted-foreground/30 rounded-sm"})]})]})}),n.jsx(js,{selected:b.method==="remove",onClick:()=>O({...b,method:"remove"}),label:"Remove",children:n.jsxs("div",{className:"w-full flex flex-col gap-1.5 px-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Email"}),n.jsx("span",{className:"text-[8px] italic text-muted-foreground/30",children:"removed"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[9px] text-muted-foreground",children:"Phone"}),n.jsx("span",{className:"text-[8px] italic text-muted-foreground/30",children:"removed"})]})]})})]})]}),b.method==="blur"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center justify-center",children:n.jsx("span",{className:"text-sm text-muted-foreground font-mono select-none",style:{filter:`blur(${b.blurRadius}px)`},children:"john@acme.com"})}),n.jsxs(q,{className:"text-xs text-muted-foreground",children:["Blur Radius: ",b.blurRadius,"px"]}),n.jsx("input",{type:"range",min:"1",max:"100",value:b.blurRadius,onChange:I=>O({...b,blurRadius:parseInt(I.target.value)}),className:"slider-primary w-full",style:{background:Wi(b.blurRadius,1,100)}})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(q,{className:"text-xs text-muted-foreground",children:["CSS Selectors (",b.selectors.length,")"]}),b.selectors.length>0&&n.jsx("div",{className:"space-y-1",children:b.selectors.map((I,ee)=>{const pe=typeof I=="string"?I:I.selector,Ce=typeof I=="object"?I.method:void 0;return n.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded px-2 py-1",children:[n.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:pe}),Ce&&n.jsx(ue,{variant:"secondary",className:"text-[10px]",children:Ce}),n.jsx(T,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0 text-muted-foreground hover:text-destructive",onClick:()=>{const Oe=[...b.selectors];Oe.splice(ee,1),O({...b,selectors:Oe})},children:n.jsx(ln,{className:"h-3 w-3"})})]},ee)})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ve,{value:D,onChange:I=>v(I.target.value),placeholder:".pii-email, [data-sensitive], .user-avatar",className:"h-7 text-xs font-mono",onKeyDown:I=>{I.key==="Enter"&&D.trim()&&(O({...b,selectors:[...b.selectors,D.trim()]}),v(""))}}),n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",disabled:!D.trim(),onClick:()=>{D.trim()&&(O({...b,selectors:[...b.selectors,D.trim()]}),v(""))},children:[n.jsx(as,{className:"h-3 w-3 mr-1"}),"Add"]})]})]}),n.jsx("div",{className:"pt-2 border-t border-border/20",children:n.jsxs(T,{size:"sm",className:"h-7 text-xs",disabled:L,onClick:async()=>{V(!0);try{const I=await fetch("/api/privacy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(I.ok)Z({title:"Saved",description:"Privacy configuration updated",variant:"success"});else{const ee=await I.json();Z({title:"Error",description:ee.error||"Failed to save",variant:"destructive"})}}catch{Z({title:"Error",description:"Failed to save privacy config",variant:"destructive"})}finally{V(!1)}},children:[L?n.jsx(_e,{className:"h-3 w-3 animate-spin mr-1"}):n.jsx(Hr,{className:"h-3 w-3 mr-1"}),"Save Privacy Config"]})})]})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ao,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx(be,{className:"text-sm",children:"Style & Framing"}),n.jsx(at,{className:"text-xs",children:"Add frames, shadows, and backgrounds to screenshots"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:y.enabled?"Enabled":"Disabled"}),n.jsx(ca,{checked:y.enabled,onCheckedChange:I=>_({...y,enabled:I})})]})]})}),y.enabled&&n.jsxs(me,{className:"pt-0 pb-4 px-4 space-y-4 border-t",children:[n.jsx("div",{className:"space-y-2 pt-3",children:E?n.jsxs("div",{className:`border rounded-md p-2 bg-muted/30 relative ${z?"opacity-50":""}`,children:[n.jsx("img",{src:E,alt:"Style preview",className:"max-w-full h-auto rounded"}),z&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n.jsx(_e,{className:"h-5 w-5 animate-spin text-primary"})})]}):n.jsxs("div",{className:"rounded-lg border border-border/30 bg-gradient-to-b from-muted/20 to-muted/10 preview-grid-bg flex items-center justify-center relative p-6",style:{minHeight:200},children:[n.jsx("div",{className:"relative overflow-hidden transition-all duration-150",style:{background:y.background,padding:`${Math.min(y.padding,40)*.4}px`,borderRadius:`${y.borderRadius*.5}px`,boxShadow:y.shadow==="small"?"0 1px 2px rgba(0,0,0,0.3)":y.shadow==="medium"?"0 4px 6px -1px rgba(0,0,0,0.3)":y.shadow==="large"?"0 10px 25px -5px rgba(0,0,0,0.4)":"none"},children:n.jsxs("div",{className:"w-64 rounded overflow-hidden",style:{borderRadius:`${Math.max(y.borderRadius*.3,2)}px`},children:[y.frame==="macos"&&n.jsxs("div",{className:"bg-[#2a2a2a] px-2.5 py-1.5 flex items-center gap-1",children:[n.jsx("span",{className:"w-[7px] h-[7px] rounded-full bg-[#ff5f57] inline-block"}),n.jsx("span",{className:"w-[7px] h-[7px] rounded-full bg-[#febc2e] inline-block"}),n.jsx("span",{className:"w-[7px] h-[7px] rounded-full bg-[#28c840] inline-block"})]}),y.frame==="windows"&&n.jsx("div",{className:"bg-[#2a2a2a] px-2 py-1 flex items-center justify-end",children:n.jsxs("span",{className:"text-[8px] text-muted-foreground flex gap-1.5",children:[n.jsx("span",{children:"—"}),n.jsx("span",{children:"□"}),n.jsx("span",{children:"×"})]})}),n.jsxs("div",{className:"bg-[#1e1e2e] p-2.5 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/20"}),n.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/20"}),n.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/20"}),n.jsx("div",{className:"flex-1"}),n.jsx("div",{className:"w-8 h-1.5 rounded bg-muted-foreground/15"})]}),n.jsxs("div",{className:"space-y-1.5 pt-1",children:[n.jsx("div",{className:"w-3/4 h-1.5 rounded bg-muted-foreground/15"}),n.jsx("div",{className:"w-full h-1.5 rounded bg-muted-foreground/10"}),n.jsx("div",{className:"w-5/6 h-1.5 rounded bg-muted-foreground/10"}),n.jsx("div",{className:"w-2/3 h-1.5 rounded bg-muted-foreground/10"})]})]})]})}),z&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg",children:n.jsx(_e,{className:"h-5 w-5 animate-spin text-primary"})})]})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Frame"}),n.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[n.jsx(js,{selected:y.frame==="none",onClick:()=>_({...y,frame:"none"}),label:"None",children:n.jsx("div",{className:"w-full h-10 rounded bg-gradient-to-br from-muted/60 to-muted/30"})}),n.jsx(js,{selected:y.frame==="macos",onClick:()=>_({...y,frame:"macos"}),label:"macOS",children:n.jsxs("div",{className:"w-full rounded overflow-hidden",children:[n.jsxs("div",{className:"bg-[#2a2a2a] px-1.5 py-1 flex items-center gap-[3px]",children:[n.jsx("span",{className:"w-[6px] h-[6px] rounded-full bg-[#ff5f57] inline-block"}),n.jsx("span",{className:"w-[6px] h-[6px] rounded-full bg-[#febc2e] inline-block"}),n.jsx("span",{className:"w-[6px] h-[6px] rounded-full bg-[#28c840] inline-block"})]}),n.jsx("div",{className:"h-6 bg-gradient-to-br from-muted/60 to-muted/30"})]})}),n.jsx(js,{selected:y.frame==="windows",onClick:()=>_({...y,frame:"windows"}),label:"Windows",children:n.jsxs("div",{className:"w-full rounded overflow-hidden",children:[n.jsx("div",{className:"bg-[#2a2a2a] px-1.5 py-1 flex items-center justify-end",children:n.jsxs("span",{className:"text-[9px] text-muted-foreground flex gap-1",children:[n.jsx("span",{children:"—"}),n.jsx("span",{children:"□"}),n.jsx("span",{children:"×"})]})}),n.jsx("div",{className:"h-6 bg-gradient-to-br from-muted/60 to-muted/30"})]})})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Shadow"}),n.jsx("div",{className:"grid grid-cols-4 gap-2",children:[{key:"none",label:"None",shadow:"shadow-none"},{key:"small",label:"Small",shadow:"shadow-sm"},{key:"medium",label:"Medium",shadow:"shadow-md"},{key:"large",label:"Large",shadow:"shadow-xl"}].map(({key:I,label:ee,shadow:pe})=>n.jsx(js,{selected:y.shadow===I,onClick:()=>_({...y,shadow:I}),label:ee,children:n.jsx("div",{className:`w-10 h-7 rounded bg-card border border-border/50 ${pe}`})},I))})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs(q,{className:"text-xs text-muted-foreground",children:["Padding: ",y.padding,"px"]}),n.jsx("input",{type:"range",min:"0",max:"200",value:y.padding,onChange:I=>_({...y,padding:parseInt(I.target.value)||0}),className:"slider-primary w-full",style:{background:Wi(y.padding,0,200)}})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(q,{className:"text-xs text-muted-foreground",children:["Border Radius: ",y.borderRadius,"px"]}),n.jsx("input",{type:"range",min:"0",max:"50",value:y.borderRadius,onChange:I=>_({...y,borderRadius:parseInt(I.target.value)||0}),className:"slider-primary w-full",style:{background:Wi(y.borderRadius,0,50)}})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Background"}),n.jsx("div",{className:"flex gap-2 flex-wrap",children:["transparent","#ffffff","#f5f5f5","#1a1a2e","#0f172a","linear-gradient(135deg, #667eea, #764ba2)","linear-gradient(135deg, #f093fb, #f5576c)","linear-gradient(135deg, #4facfe, #00f2fe)"].map(I=>n.jsx("button",{onClick:()=>_({...y,background:I}),className:`w-8 h-8 rounded-md transition-all duration-150 cursor-pointer shrink-0 hover:scale-110 active:scale-100 ${I==="transparent"?"checkerboard":""} ${y.background===I?"ring-2 ring-primary ring-offset-2 ring-offset-background":"border border-border hover:border-primary/50"}`,style:I!=="transparent"?{background:I}:void 0,title:I},I))}),n.jsx(ve,{value:y.background,onChange:I=>_({...y,background:I.target.value}),placeholder:"transparent, #hex, or linear-gradient(...)",className:"h-7 text-xs font-mono"})]}),n.jsx("div",{className:"pt-2 border-t border-border/20",children:n.jsxs(T,{size:"sm",className:"h-7 text-xs",disabled:F,onClick:async()=>{$(!0);try{const I=await fetch("/api/style",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)});if(I.ok)Z({title:"Saved",description:"Style configuration updated",variant:"success"});else{const ee=await I.json();Z({title:"Error",description:ee.error||"Failed to save",variant:"destructive"})}}catch{Z({title:"Error",description:"Failed to save style config",variant:"destructive"})}finally{$(!1)}},children:[F?n.jsx(_e,{className:"h-3 w-3 animate-spin mr-1"}):n.jsx(Hr,{className:"h-3 w-3 mr-1"}),"Save Style Config"]})})]})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(oh,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx(be,{className:"text-sm",children:"Viewport Presets"}),n.jsx(at,{className:"text-xs",children:"Device sizes for responsive screenshots"})]})]})})}),n.jsx(me,{className:"pt-0 pb-4 px-4 border-t",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"grid grid-cols-4 gap-2",children:Object.entries(h).filter(([I,ee])=>["desktop","tablet","mobile"].includes(ee.category)).slice(0,8).map(([I,ee])=>{const pe=e.viewport.width===ee.width&&e.viewport.height===ee.height,Ce=ee.category==="mobile"?Xy:ee.category==="tablet"?Zy:oh;return n.jsxs(T,{variant:pe?"default":"outline",size:"sm",className:"h-auto py-2 px-3 flex flex-col items-start",onClick:()=>Ie(ee.width,ee.height),children:[n.jsxs("div",{className:"flex items-center gap-1.5 w-full",children:[n.jsx(Ce,{className:"h-3 w-3"}),n.jsx("span",{className:"text-xs font-medium truncate",children:ee.name})]}),n.jsxs("span",{className:"text-[10px] text-muted-foreground mt-0.5",children:[ee.width,"×",ee.height]})]},I)})}),n.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[n.jsx(q,{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Custom:"}),n.jsx(ve,{type:"number",value:e.viewport.width,onChange:I=>Ie(parseInt(I.target.value)||1280,e.viewport.height),className:"h-7 w-20 text-xs",placeholder:"Width"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"×"}),n.jsx(ve,{type:"number",value:e.viewport.height,onChange:I=>Ie(e.viewport.width,parseInt(I.target.value)||720),className:"h-7 w-20 text-xs",placeholder:"Height"}),n.jsx("div",{className:"flex-1"}),n.jsx(q,{className:"text-xs text-muted-foreground",children:"Scale:"}),n.jsxs("select",{value:e.viewport.deviceScaleFactor||2,onChange:I=>t({...e,viewport:{...e.viewport,deviceScaleFactor:parseFloat(I.target.value)}}),className:"h-7 px-2 text-xs border rounded bg-background",children:[n.jsx("option",{value:"1",children:"1x"}),n.jsx("option",{value:"2",children:"2x (Retina)"}),n.jsx("option",{value:"3",children:"3x"})]})]})]})})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(zy,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx(be,{className:"text-sm",children:"Output Path Template"}),n.jsx(at,{className:"text-xs",children:"Customize where captured assets are saved"})]})]})})}),n.jsxs(me,{className:"pt-0 pb-4 px-4 border-t space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Quick Presets"}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:J.slice(0,6).map(I=>n.jsx(T,{variant:ge===I.template?"default":"outline",size:"sm",className:"h-6 text-xs px-2",onClick:()=>Re(I.template),title:I.description,children:I.name},I.name))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Custom Template"}),n.jsxs("div",{className:"relative",children:[n.jsx(ve,{value:ge,onChange:I=>Re(I.target.value),placeholder:"./docs/assets/{{locale}}/{{scenario}}/{{name}}.{{ext}}",className:`h-8 text-sm font-mono pr-8 ${(U==null?void 0:U.valid)===!1?"border-red-500":""}`}),U&&n.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:U.valid?n.jsx("span",{className:"text-green-500 text-xs",children:"✓"}):n.jsx("span",{className:"text-red-500 text-xs",children:"✗"})})]}),(U==null?void 0:U.error)&&n.jsx("p",{className:"text-xs text-red-500",children:U.error}),(U==null?void 0:U.warning)&&n.jsx("p",{className:"text-xs text-yellow-600",children:U.warning})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Available Variables"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:fe.slice(0,12).map(I=>n.jsx(ue,{variant:"secondary",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>Re(ee=>ee+`{{${I.name}}}`),title:I.description,children:`{{${I.name}}}`},I.name))}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Click a variable to insert it into the template"})]})]})]}),n.jsxs(he,{children:[n.jsx(ke,{className:"py-3 px-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx(be,{className:"text-sm",children:"Variants"}),n.jsx(at,{className:"text-xs",children:"Configure locales, roles, themes"})]}),n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>u(!0),children:[n.jsx(as,{className:"h-3 w-3 mr-1"}),"Add"]})]})}),n.jsx(me,{className:"p-0",children:Tt.length===0?n.jsxs("div",{className:"py-8 text-center border-t",children:[n.jsx(ur,{className:"h-8 w-8 mx-auto mb-2 opacity-20"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"No variants configured"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Add locale, role, or theme dimensions"})]}):n.jsxs("div",{className:"flex border-t",children:[n.jsx("div",{className:"w-48 border-r shrink-0",children:Tt.map(I=>{const ee=kt[I],pe=I==="locale"?ur:I==="role"?tm:I==="theme"?Xc:Ia,Ce=Object.keys(ee.options).length;return n.jsxs("button",{onClick:()=>l(I),className:`w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-accent/50 transition-colors ${o===I?"bg-accent":""}`,children:[n.jsx(pe,{className:"h-3.5 w-3.5 shrink-0 opacity-60"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm font-medium truncate",children:ee.label}),n.jsxs("div",{className:"text-xs text-muted-foreground",children:[Ce," option",Ce!==1?"s":""]})]}),n.jsx(Ps,{className:"h-3.5 w-3.5 opacity-40"})]},I)})}),n.jsx("div",{className:"flex-1 min-w-0",children:Vt&&o?n.jsxs("div",{children:[n.jsxs("div",{className:"px-4 py-3 border-b bg-muted/30 flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-sm",children:Vt.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:Vt.description||"No description"})]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>f(!0),children:[n.jsx(as,{className:"h-3 w-3 mr-1"}),"Option"]}),n.jsx(T,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:()=>Nt(o),children:n.jsx(ps,{className:"h-3 w-3"})})]})]}),n.jsx("div",{className:"divide-y",children:Object.keys(Vt.options).length===0?n.jsx("div",{className:"py-6 text-center text-muted-foreground text-sm",children:"No options yet. Add one to get started."}):Object.entries(Vt.options).map(([I,ee])=>{var Ce;const pe=((Ce=ee.inject)==null?void 0:Ce[0])||{method:"localStorage",key:"",value:""};return n.jsx("div",{className:"px-4 py-3",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"shrink-0 pt-0.5",children:n.jsx(ue,{variant:"secondary",className:"text-xs",children:I})}),n.jsxs("div",{className:"flex-1 space-y-2 min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:ee.name}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("select",{value:pe.method,onChange:Oe=>$t(o,I,Oe.target.value,pe.key||"",pe.value||""),className:"h-7 text-xs rounded border bg-background px-2",children:[n.jsx("option",{value:"localStorage",children:"localStorage"}),n.jsx("option",{value:"cookie",children:"cookie"}),n.jsx("option",{value:"urlParam",children:"URL param"}),n.jsx("option",{value:"browser",children:"browser"}),n.jsx("option",{value:"header",children:"header"})]}),n.jsx(ve,{value:pe.key||"",onChange:Oe=>$t(o,I,pe.method,Oe.target.value,pe.value||""),placeholder:"key",className:"h-7 text-xs w-24"}),n.jsx(ve,{value:pe.value||"",onChange:Oe=>$t(o,I,pe.method,pe.key||"",Oe.target.value),placeholder:"value",className:"h-7 text-xs flex-1"})]})]}),n.jsx(T,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Yt(o,I),children:n.jsx(ln,{className:"h-3 w-3"})})]})},I)})})]}):n.jsx("div",{className:"py-12 text-center text-muted-foreground text-sm",children:"Select a dimension to edit"})})]})})]})]}),n.jsx(st,{open:c,onOpenChange:u,children:n.jsxs(nt,{className:"max-w-sm",children:[n.jsx(Xe,{children:n.jsx(Ze,{children:"Add Variant Dimension"})}),n.jsxs("div",{className:"space-y-4 py-2",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs text-muted-foreground",children:"Quick Add"}),n.jsx("div",{className:"grid grid-cols-3 gap-2",children:F1.map(I=>{const ee=kt[I.key],pe=I.icon;return n.jsxs(T,{variant:"outline",size:"sm",disabled:!!ee,onClick:()=>mt(I.key,I.label,I.description),className:"h-auto py-2 flex-col gap-1",children:[n.jsx(pe,{className:"h-4 w-4"}),n.jsx("span",{className:"text-xs",children:I.label})]},I.key)})})]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 flex items-center",children:n.jsx("span",{className:"w-full border-t"})}),n.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:n.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or custom"})})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(q,{className:"text-xs",children:"Custom Dimension Key"}),n.jsx(ve,{value:g,onChange:I=>R(I.target.value),placeholder:"e.g., viewport, env, feature",className:"h-8"})]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"ghost",size:"sm",onClick:()=>u(!1),children:"Cancel"}),n.jsx(T,{size:"sm",onClick:()=>mt(g,g,""),disabled:!g.trim(),children:"Add"})]})]})}),n.jsx(st,{open:m,onOpenChange:f,children:n.jsxs(nt,{className:"max-w-sm",children:[n.jsx(Xe,{children:n.jsx(Ze,{children:"Add Option"})}),n.jsxs("div",{className:"space-y-3 py-2",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(q,{className:"text-xs",children:"Option Key"}),n.jsx(ve,{value:k,onChange:I=>C(I.target.value),placeholder:o==="locale"?"e.g., en, ko, ja":o==="role"?"e.g., admin, user":"e.g., light, dark",className:"h-8"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(q,{className:"text-xs",children:"Display Name"}),n.jsx(ve,{value:j,onChange:I=>p(I.target.value),placeholder:o==="locale"?"e.g., English, 한국어":o==="role"?"e.g., Administrator":"e.g., Light Mode",className:"h-8"})]})]}),n.jsxs(lt,{children:[n.jsx(T,{variant:"ghost",size:"sm",onClick:()=>u(!1),children:"Cancel"}),n.jsx(T,{size:"sm",onClick:()=>o&&Ft(o,k,j),disabled:!k.trim(),children:"Add Option"})]})]})})]})}function V1(){return n.jsx(V0,{children:n.jsx(Ij,{children:n.jsx(yy,{children:n.jsx(c1,{children:n.jsxs("div",{className:"min-h-screen bg-background",children:[n.jsx(U1,{}),n.jsx(d1,{})]})})})})})}function U1(){const e=On(),t=Os(),[s,r]=d.useState("Project"),[i,a]=d.useState(!1),[o,l]=d.useState(!1),[c,u]=d.useState("not-running"),m=d.useRef(null),f=()=>{fetch("/api/status").then(h=>h.json()).then(h=>{var x,w;(x=h.settings)!=null&&x.projectName&&r(h.settings.projectName),a(((w=h.settings)==null?void 0:w.isAuthenticated)||!1)}).catch(()=>{})};d.useEffect(()=>{f()},[]);const g=d.useCallback(()=>{fetch("/api/recorder/check-chrome").then(h=>h.json()).then(h=>{h.chromeAvailable&&h.hasValidTab?u("ready"):h.chromeAvailable?u("no-tabs"):u("not-running")}).catch(()=>u("not-running"))},[]);d.useEffect(()=>(g(),m.current=setInterval(g,12e3),()=>{m.current&&clearInterval(m.current)}),[g]),d.useEffect(()=>{const h=x=>{if((x.metaKey||x.ctrlKey)&&x.key>="1"&&x.key<="9"){x.preventDefault();const w=["/","/recorder","/config"],N=parseInt(x.key)-1;w[N]&&t(w[N])}};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t]);const R=[{path:"/",label:"Home",icon:My,shortcut:"1"}],k=[{path:"/scenarios",label:"All Scenarios",icon:Rn},{path:"/assets",label:"Assets",icon:fn},{path:"/jobs",label:"Jobs",icon:By}],C=()=>{const h=e.pathname;if(h==="/")return{title:"Overview",breadcrumb:null};if(h.startsWith("/scenarios/"))return{title:h.split("/")[2],breadcrumb:"Scenarios"};if(h.startsWith("/assets/"))return{title:"Asset",breadcrumb:"Assets"};const x=[...R,...k,{path:"/config",label:"Settings"}].find(w=>h===w.path||h.startsWith(w.path+"/"));return{title:(x==null?void 0:x.label)||"Page",breadcrumb:null}},{title:j,breadcrumb:p}=C();return n.jsxs("div",{className:"flex h-screen bg-background",children:[n.jsxs("aside",{className:"w-[200px] border-r border-sidebar-border bg-sidebar-background flex flex-col",children:[n.jsx("div",{className:"h-12 flex items-center px-3 border-b border-sidebar-border",children:n.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[n.jsx("div",{className:"w-6 h-6 rounded-md bg-primary/20 flex items-center justify-center",children:n.jsx(Ty,{className:"h-3.5 w-3.5 text-primary"})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("p",{className:"text-[13px] font-medium text-sidebar-foreground truncate",children:s})})]})}),n.jsxs("nav",{className:"flex-1 py-2 px-2 space-y-0.5 overflow-y-auto linear-scrollbar",children:[R.map(h=>{const x=h.icon,w=e.pathname===h.path||h.path!=="/"&&e.pathname.startsWith(h.path);return n.jsxs(Kt,{to:h.path,className:Y("group flex items-center gap-2.5 px-2 py-1.5 rounded-md text-[13px] transition-colors",w?"bg-sidebar-accent text-sidebar-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[n.jsx(x,{className:Y("h-4 w-4 shrink-0",w?"text-primary":"text-muted-foreground group-hover:text-sidebar-foreground")}),n.jsx("span",{className:"flex-1",children:h.label}),h.shortcut&&n.jsxs("span",{className:"kbd opacity-0 group-hover:opacity-100 transition-opacity",children:["⌘",h.shortcut]})]},h.path)}),n.jsx("div",{className:"h-px bg-sidebar-border my-2"}),n.jsxs(Kt,{to:"/recorder",className:Y("flex items-center gap-2.5 px-2 py-2 rounded-md text-[13px] transition-colors border",e.pathname==="/recorder"?"bg-primary text-primary-foreground border-primary":"border-primary/30 text-primary hover:bg-primary/10 hover:border-primary/50"),children:[n.jsx(_n,{className:"h-4 w-4 shrink-0"}),n.jsx("span",{className:"flex-1 font-medium",children:"Record New Scenario"})]}),n.jsx("div",{className:"h-px bg-sidebar-border my-2"}),k.map(h=>{const x=h.icon,w=e.pathname.startsWith(h.path);return n.jsxs(Kt,{to:h.path,className:Y("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-[13px] transition-colors",w?"bg-sidebar-accent/50 text-sidebar-foreground":"text-muted-foreground/70 hover:bg-sidebar-accent/30 hover:text-muted-foreground"),children:[n.jsx(x,{className:"h-4 w-4 shrink-0"}),n.jsx("span",{children:h.label})]},h.path)})]}),n.jsxs("div",{className:"p-2 border-t border-sidebar-border space-y-0.5",children:[n.jsxs(Kt,{to:"/config",className:Y("group flex items-center gap-2.5 px-2 py-1.5 rounded-md text-[13px] transition-colors",e.pathname==="/config"?"bg-sidebar-accent text-sidebar-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[n.jsx(Ia,{className:"h-4 w-4 shrink-0"}),n.jsx("span",{className:"flex-1",children:"Settings"}),n.jsx("span",{className:"kbd opacity-0 group-hover:opacity-100 transition-opacity",children:"⌘5"})]}),n.jsxs("button",{onClick:()=>l(!0),className:Y("w-full flex items-center gap-2.5 px-2 py-1.5 rounded-md text-[13px] transition-colors","text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[n.jsx("div",{className:Y("status-dot",i?"status-dot-success":"status-dot-neutral")}),n.jsx("span",{className:"flex-1 text-left",children:i?"Connected":"Not connected"}),!i&&n.jsx(em,{className:"h-3.5 w-3.5 opacity-50"})]}),n.jsxs("button",{onClick:()=>t("/recorder"),className:Y("w-full flex items-center gap-2.5 px-2 py-1.5 rounded-md text-[13px] transition-colors","text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[n.jsx("div",{className:Y("status-dot",c==="ready"?"status-dot-success":c==="no-tabs"?"status-dot-warning":"status-dot-neutral")}),n.jsx("span",{className:"flex-1 text-left",children:c==="ready"?"Chrome ready":c==="no-tabs"?"Chrome: no tabs":"Chrome: not running"}),n.jsx(Yp,{className:"h-3.5 w-3.5 opacity-50"})]})]}),n.jsx(wi,{open:o,onOpenChange:l,onAuthenticated:f})]}),n.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[n.jsxs("header",{className:"h-12 border-b border-border bg-background/50 backdrop-blur-sm flex items-center justify-between px-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[p&&n.jsxs(n.Fragment,{children:[n.jsx(Kt,{to:`/${p.toLowerCase()}`,className:"text-muted-foreground hover:text-foreground transition-colors",children:p}),n.jsx(Ps,{className:"h-3.5 w-3.5 text-muted-foreground/50"})]}),n.jsx("span",{className:"font-medium text-foreground",children:j})]}),n.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 text-[13px] text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded-md hover:bg-sidebar-accent/50",children:[n.jsx("div",{className:Y("w-2 h-2 rounded-full",i?"bg-green-500":"bg-neutral-400")}),n.jsx("span",{children:s})]})]}),n.jsx("main",{className:"flex-1 overflow-auto bg-background linear-scrollbar",children:n.jsxs(uy,{children:[n.jsx(us,{path:"/",element:n.jsx(p1,{})}),n.jsx(us,{path:"/recorder",element:n.jsx(D1,{})}),n.jsx(us,{path:"/connection",element:n.jsx(z1,{})}),n.jsx(us,{path:"/scenarios",element:n.jsx(x1,{})}),n.jsx(us,{path:"/scenarios/:key",element:n.jsx(T1,{})}),n.jsx(us,{path:"/assets",element:n.jsx(O1,{})}),n.jsx(us,{path:"/assets/:scenarioKey/:variationSlug/:captureKey",element:n.jsx(M1,{})}),n.jsx(us,{path:"/jobs",element:n.jsx(L1,{})}),n.jsx(us,{path:"/config",element:n.jsx($1,{})})]})})]})]})}window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{localStorage.getItem("reshot-theme")||(document.documentElement.classList.toggle("dark",e.matches),document.documentElement.style.colorScheme=e.matches?"dark":"light")});Ho.createRoot(document.getElementById("root")).render(n.jsx(Oh.StrictMode,{children:n.jsx(V1,{})}));