ima2-gen 1.1.13 → 1.1.14

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 (53) hide show
  1. package/README.md +10 -1
  2. package/bin/commands/doctor.js +195 -0
  3. package/bin/commands/doctor.ts +202 -0
  4. package/bin/ima2.js +3 -105
  5. package/bin/ima2.ts +3 -109
  6. package/config.js +1 -0
  7. package/config.ts +5 -0
  8. package/docs/CLI.md +36 -0
  9. package/docs/FAQ.ko.md +82 -2
  10. package/docs/FAQ.md +85 -2
  11. package/docs/PROMPT_STUDIO.ko.md +111 -0
  12. package/docs/PROMPT_STUDIO.md +115 -0
  13. package/docs/README.ko.md +8 -1
  14. package/docs/migration/runtime-test-inventory.md +6 -1
  15. package/lib/agentRuntime.js +9 -2
  16. package/lib/agentRuntime.ts +8 -2
  17. package/lib/errorClassify.js +1 -1
  18. package/lib/errorClassify.ts +1 -1
  19. package/lib/generationErrors.js +121 -23
  20. package/lib/generationErrors.ts +100 -13
  21. package/lib/responsesDoctor.js +386 -0
  22. package/lib/responsesDoctor.ts +456 -0
  23. package/lib/responsesErrors.js +57 -0
  24. package/lib/responsesErrors.ts +83 -0
  25. package/lib/responsesFallback.js +72 -0
  26. package/lib/responsesFallback.ts +114 -0
  27. package/lib/responsesImageAdapter.js +121 -174
  28. package/lib/responsesImageAdapter.ts +136 -211
  29. package/lib/responsesParse.js +324 -0
  30. package/lib/responsesParse.ts +452 -0
  31. package/lib/responsesTools.js +15 -0
  32. package/lib/responsesTools.ts +28 -0
  33. package/package.json +1 -1
  34. package/routes/edit.js +26 -1
  35. package/routes/edit.ts +26 -1
  36. package/routes/generate.js +40 -0
  37. package/routes/generate.ts +47 -0
  38. package/ui/dist/.vite/manifest.json +12 -12
  39. package/ui/dist/assets/{AgentWorkspace-BJe9yxPA.js → AgentWorkspace-B6YNOZHi.js} +1 -1
  40. package/ui/dist/assets/{CardNewsWorkspace-BBLdwzYU.js → CardNewsWorkspace-EFVeg4l_.js} +1 -1
  41. package/ui/dist/assets/{NodeCanvas-BSZ527J4.js → NodeCanvas-iM6yjHvO.js} +1 -1
  42. package/ui/dist/assets/{PromptBuilderPanel-Y2VygFc0.js → PromptBuilderPanel-C3GdLDCl.js} +1 -1
  43. package/ui/dist/assets/{PromptImportDialog-C6lFV-LL.js → PromptImportDialog-DS9vrc_w.js} +2 -2
  44. package/ui/dist/assets/{PromptImportDiscoverySection-D8YJFhND.js → PromptImportDiscoverySection-DHFEt_FA.js} +1 -1
  45. package/ui/dist/assets/{PromptImportFolderSection-ywfcQolW.js → PromptImportFolderSection-BQxb1zs5.js} +1 -1
  46. package/ui/dist/assets/{PromptLibraryPanel-fk4KmrGy.js → PromptLibraryPanel-NhMKVGfU.js} +2 -2
  47. package/ui/dist/assets/{SettingsWorkspace-DL5vhAHQ.js → SettingsWorkspace-FjKjaDqj.js} +1 -1
  48. package/ui/dist/assets/index-BAN6lKgf.js +28 -0
  49. package/ui/dist/assets/{index-BLx55BOg.js → index-BbFZyM92.js} +1 -1
  50. package/ui/dist/assets/index-DK1faG9Z.css +1 -0
  51. package/ui/dist/index.html +2 -2
  52. package/ui/dist/assets/index-ByViUJfx.css +0 -1
  53. package/ui/dist/assets/index-Ci36vcFD.js +0 -28
@@ -0,0 +1,28 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NodeCanvas-iM6yjHvO.js","assets/NodeCanvas-BZV40eAE.css"])))=>i.map(i=>d[i]);
2
+ (function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))o(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const p of d.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&o(p)}).observe(document,{childList:!0,subtree:!0});function i(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(u){if(u.ep)return;u.ep=!0;const d=i(u);fetch(u.href,d)}})();function $v(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Hc={exports:{}},gi={};var vp;function Wv(){if(vp)return gi;vp=1;var l=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function i(o,u,d){var p=null;if(d!==void 0&&(p=""+d),u.key!==void 0&&(p=""+u.key),"key"in u){d={};for(var m in u)m!=="key"&&(d[m]=u[m])}else d=u;return u=d.ref,{$$typeof:l,type:o,key:p,ref:u!==void 0?u:null,props:d}}return gi.Fragment=s,gi.jsx=i,gi.jsxs=i,gi}var bp;function eb(){return bp||(bp=1,Hc.exports=Wv()),Hc.exports}var f=eb(),kc={exports:{}},re={};var Sp;function tb(){if(Sp)return re;Sp=1;var l=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),p=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),S=Symbol.iterator;function x(w){return w===null||typeof w!="object"?null:(w=S&&w[S]||w["@@iterator"],typeof w=="function"?w:null)}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I=Object.assign,B={};function V(w,N,F){this.props=w,this.context=N,this.refs=B,this.updater=F||M}V.prototype.isReactComponent={},V.prototype.setState=function(w,N){if(typeof w!="object"&&typeof w!="function"&&w!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,w,N,"setState")},V.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function L(){}L.prototype=V.prototype;function Y(w,N,F){this.props=w,this.context=N,this.refs=B,this.updater=F||M}var j=Y.prototype=new L;j.constructor=Y,I(j,V.prototype),j.isPureReactComponent=!0;var W=Array.isArray;function P(){}var $={H:null,A:null,T:null,S:null},Ce=Object.prototype.hasOwnProperty;function ae(w,N,F){var Z=F.ref;return{$$typeof:l,type:w,key:N,ref:Z!==void 0?Z:null,props:F}}function we(w,N){return ae(w.type,N,w.props)}function Ge(w){return typeof w=="object"&&w!==null&&w.$$typeof===l}function Ie(w){var N={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(F){return N[F]})}var ct=/\/+/g;function Ye(w,N){return typeof w=="object"&&w!==null&&w.key!=null?Ie(""+w.key):N.toString(36)}function Q(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(P,P):(w.status="pending",w.then(function(N){w.status==="pending"&&(w.status="fulfilled",w.value=N)},function(N){w.status==="pending"&&(w.status="rejected",w.reason=N)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function A(w,N,F,Z,ie){var se=typeof w;(se==="undefined"||se==="boolean")&&(w=null);var he=!1;if(w===null)he=!0;else switch(se){case"bigint":case"string":case"number":he=!0;break;case"object":switch(w.$$typeof){case l:case s:he=!0;break;case E:return he=w._init,A(he(w._payload),N,F,Z,ie)}}if(he)return ie=ie(w),he=Z===""?"."+Ye(w,0):Z,W(ie)?(F="",he!=null&&(F=he.replace(ct,"$&/")+"/"),A(ie,N,F,"",function($a){return $a})):ie!=null&&(Ge(ie)&&(ie=we(ie,F+(ie.key==null||w&&w.key===ie.key?"":(""+ie.key).replace(ct,"$&/")+"/")+he)),N.push(ie)),1;he=0;var Je=Z===""?".":Z+":";if(W(w))for(var qe=0;qe<w.length;qe++)Z=w[qe],se=Je+Ye(Z,qe),he+=A(Z,N,F,se,ie);else if(qe=x(w),typeof qe=="function")for(w=qe.call(w),qe=0;!(Z=w.next()).done;)Z=Z.value,se=Je+Ye(Z,qe++),he+=A(Z,N,F,se,ie);else if(se==="object"){if(typeof w.then=="function")return A(Q(w),N,F,Z,ie);throw N=String(w),Error("Objects are not valid as a React child (found: "+(N==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":N)+"). If you meant to render a collection of children, use an array instead.")}return he}function X(w,N,F){if(w==null)return w;var Z=[],ie=0;return A(w,Z,"","",function(se){return N.call(F,se,ie++)}),Z}function ne(w){if(w._status===-1){var N=w._result;N=N(),N.then(function(F){(w._status===0||w._status===-1)&&(w._status=1,w._result=F)},function(F){(w._status===0||w._status===-1)&&(w._status=2,w._result=F)}),w._status===-1&&(w._status=0,w._result=N)}if(w._status===1)return w._result.default;throw w._result}var xe=typeof reportError=="function"?reportError:function(w){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var N=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof w=="object"&&w!==null&&typeof w.message=="string"?String(w.message):String(w),error:w});if(!window.dispatchEvent(N))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",w);return}console.error(w)},Ee={map:X,forEach:function(w,N,F){X(w,function(){N.apply(this,arguments)},F)},count:function(w){var N=0;return X(w,function(){N++}),N},toArray:function(w){return X(w,function(N){return N})||[]},only:function(w){if(!Ge(w))throw Error("React.Children.only expected to receive a single React element child.");return w}};return re.Activity=b,re.Children=Ee,re.Component=V,re.Fragment=i,re.Profiler=u,re.PureComponent=Y,re.StrictMode=o,re.Suspense=y,re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,re.__COMPILER_RUNTIME={__proto__:null,c:function(w){return $.H.useMemoCache(w)}},re.cache=function(w){return function(){return w.apply(null,arguments)}},re.cacheSignal=function(){return null},re.cloneElement=function(w,N,F){if(w==null)throw Error("The argument must be a React element, but you passed "+w+".");var Z=I({},w.props),ie=w.key;if(N!=null)for(se in N.key!==void 0&&(ie=""+N.key),N)!Ce.call(N,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&N.ref===void 0||(Z[se]=N[se]);var se=arguments.length-2;if(se===1)Z.children=F;else if(1<se){for(var he=Array(se),Je=0;Je<se;Je++)he[Je]=arguments[Je+2];Z.children=he}return ae(w.type,ie,Z)},re.createContext=function(w){return w={$$typeof:p,_currentValue:w,_currentValue2:w,_threadCount:0,Provider:null,Consumer:null},w.Provider=w,w.Consumer={$$typeof:d,_context:w},w},re.createElement=function(w,N,F){var Z,ie={},se=null;if(N!=null)for(Z in N.key!==void 0&&(se=""+N.key),N)Ce.call(N,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(ie[Z]=N[Z]);var he=arguments.length-2;if(he===1)ie.children=F;else if(1<he){for(var Je=Array(he),qe=0;qe<he;qe++)Je[qe]=arguments[qe+2];ie.children=Je}if(w&&w.defaultProps)for(Z in he=w.defaultProps,he)ie[Z]===void 0&&(ie[Z]=he[Z]);return ae(w,se,ie)},re.createRef=function(){return{current:null}},re.forwardRef=function(w){return{$$typeof:m,render:w}},re.isValidElement=Ge,re.lazy=function(w){return{$$typeof:E,_payload:{_status:-1,_result:w},_init:ne}},re.memo=function(w,N){return{$$typeof:g,type:w,compare:N===void 0?null:N}},re.startTransition=function(w){var N=$.T,F={};$.T=F;try{var Z=w(),ie=$.S;ie!==null&&ie(F,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(P,xe)}catch(se){xe(se)}finally{N!==null&&F.types!==null&&(N.types=F.types),$.T=N}},re.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},re.use=function(w){return $.H.use(w)},re.useActionState=function(w,N,F){return $.H.useActionState(w,N,F)},re.useCallback=function(w,N){return $.H.useCallback(w,N)},re.useContext=function(w){return $.H.useContext(w)},re.useDebugValue=function(){},re.useDeferredValue=function(w,N){return $.H.useDeferredValue(w,N)},re.useEffect=function(w,N){return $.H.useEffect(w,N)},re.useEffectEvent=function(w){return $.H.useEffectEvent(w)},re.useId=function(){return $.H.useId()},re.useImperativeHandle=function(w,N,F){return $.H.useImperativeHandle(w,N,F)},re.useInsertionEffect=function(w,N){return $.H.useInsertionEffect(w,N)},re.useLayoutEffect=function(w,N){return $.H.useLayoutEffect(w,N)},re.useMemo=function(w,N){return $.H.useMemo(w,N)},re.useOptimistic=function(w,N){return $.H.useOptimistic(w,N)},re.useReducer=function(w,N,F){return $.H.useReducer(w,N,F)},re.useRef=function(w){return $.H.useRef(w)},re.useState=function(w){return $.H.useState(w)},re.useSyncExternalStore=function(w,N,F){return $.H.useSyncExternalStore(w,N,F)},re.useTransition=function(){return $.H.useTransition()},re.version="19.2.5",re}var xp;function du(){return xp||(xp=1,kc.exports=tb()),kc.exports}var H=du();const Wo=$v(H);var Gc={exports:{}},yi={},Uc={exports:{}},Bc={};var Ep;function ab(){return Ep||(Ep=1,(function(l){function s(A,X){var ne=A.length;A.push(X);e:for(;0<ne;){var xe=ne-1>>>1,Ee=A[xe];if(0<u(Ee,X))A[xe]=X,A[ne]=Ee,ne=xe;else break e}}function i(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var X=A[0],ne=A.pop();if(ne!==X){A[0]=ne;e:for(var xe=0,Ee=A.length,w=Ee>>>1;xe<w;){var N=2*(xe+1)-1,F=A[N],Z=N+1,ie=A[Z];if(0>u(F,ne))Z<Ee&&0>u(ie,F)?(A[xe]=ie,A[Z]=ne,xe=Z):(A[xe]=F,A[N]=ne,xe=N);else if(Z<Ee&&0>u(ie,ne))A[xe]=ie,A[Z]=ne,xe=Z;else break e}}return X}function u(A,X){var ne=A.sortIndex-X.sortIndex;return ne!==0?ne:A.id-X.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;l.unstable_now=function(){return d.now()}}else{var p=Date,m=p.now();l.unstable_now=function(){return p.now()-m}}var y=[],g=[],E=1,b=null,S=3,x=!1,M=!1,I=!1,B=!1,V=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,Y=typeof setImmediate<"u"?setImmediate:null;function j(A){for(var X=i(g);X!==null;){if(X.callback===null)o(g);else if(X.startTime<=A)o(g),X.sortIndex=X.expirationTime,s(y,X);else break;X=i(g)}}function W(A){if(I=!1,j(A),!M)if(i(y)!==null)M=!0,P||(P=!0,Ie());else{var X=i(g);X!==null&&Q(W,X.startTime-A)}}var P=!1,$=-1,Ce=5,ae=-1;function we(){return B?!0:!(l.unstable_now()-ae<Ce)}function Ge(){if(B=!1,P){var A=l.unstable_now();ae=A;var X=!0;try{e:{M=!1,I&&(I=!1,L($),$=-1),x=!0;var ne=S;try{t:{for(j(A),b=i(y);b!==null&&!(b.expirationTime>A&&we());){var xe=b.callback;if(typeof xe=="function"){b.callback=null,S=b.priorityLevel;var Ee=xe(b.expirationTime<=A);if(A=l.unstable_now(),typeof Ee=="function"){b.callback=Ee,j(A),X=!0;break t}b===i(y)&&o(y),j(A)}else o(y);b=i(y)}if(b!==null)X=!0;else{var w=i(g);w!==null&&Q(W,w.startTime-A),X=!1}}break e}finally{b=null,S=ne,x=!1}X=void 0}}finally{X?Ie():P=!1}}}var Ie;if(typeof Y=="function")Ie=function(){Y(Ge)};else if(typeof MessageChannel<"u"){var ct=new MessageChannel,Ye=ct.port2;ct.port1.onmessage=Ge,Ie=function(){Ye.postMessage(null)}}else Ie=function(){V(Ge,0)};function Q(A,X){$=V(function(){A(l.unstable_now())},X)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(A){A.callback=null},l.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Ce=0<A?Math.floor(1e3/A):5},l.unstable_getCurrentPriorityLevel=function(){return S},l.unstable_next=function(A){switch(S){case 1:case 2:case 3:var X=3;break;default:X=S}var ne=S;S=X;try{return A()}finally{S=ne}},l.unstable_requestPaint=function(){B=!0},l.unstable_runWithPriority=function(A,X){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var ne=S;S=A;try{return X()}finally{S=ne}},l.unstable_scheduleCallback=function(A,X,ne){var xe=l.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?xe+ne:xe):ne=xe,A){case 1:var Ee=-1;break;case 2:Ee=250;break;case 5:Ee=1073741823;break;case 4:Ee=1e4;break;default:Ee=5e3}return Ee=ne+Ee,A={id:E++,callback:X,priorityLevel:A,startTime:ne,expirationTime:Ee,sortIndex:-1},ne>xe?(A.sortIndex=ne,s(g,A),i(y)===null&&A===i(g)&&(I?(L($),$=-1):I=!0,Q(W,ne-xe))):(A.sortIndex=Ee,s(y,A),M||x||(M=!0,P||(P=!0,Ie()))),A},l.unstable_shouldYield=we,l.unstable_wrapCallback=function(A){var X=S;return function(){var ne=S;S=X;try{return A.apply(this,arguments)}finally{S=ne}}}})(Bc)),Bc}var Tp;function nb(){return Tp||(Tp=1,Uc.exports=ab()),Uc.exports}var Pc={exports:{}},ot={};var Np;function lb(){if(Np)return ot;Np=1;var l=du();function s(y){var g="https://react.dev/errors/"+y;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)g+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+y+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(s(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},u=Symbol.for("react.portal");function d(y,g,E){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:b==null?null:""+b,children:y,containerInfo:g,implementation:E}}var p=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,g){if(y==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return ot.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,ot.createPortal=function(y,g){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(s(299));return d(y,g,null,E)},ot.flushSync=function(y){var g=p.T,E=o.p;try{if(p.T=null,o.p=2,y)return y()}finally{p.T=g,o.p=E,o.d.f()}},ot.preconnect=function(y,g){typeof y=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,o.d.C(y,g))},ot.prefetchDNS=function(y){typeof y=="string"&&o.d.D(y)},ot.preinit=function(y,g){if(typeof y=="string"&&g&&typeof g.as=="string"){var E=g.as,b=m(E,g.crossOrigin),S=typeof g.integrity=="string"?g.integrity:void 0,x=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;E==="style"?o.d.S(y,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:S,fetchPriority:x}):E==="script"&&o.d.X(y,{crossOrigin:b,integrity:S,fetchPriority:x,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},ot.preinitModule=function(y,g){if(typeof y=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var E=m(g.as,g.crossOrigin);o.d.M(y,{crossOrigin:E,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&o.d.M(y)},ot.preload=function(y,g){if(typeof y=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var E=g.as,b=m(E,g.crossOrigin);o.d.L(y,E,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},ot.preloadModule=function(y,g){if(typeof y=="string")if(g){var E=m(g.as,g.crossOrigin);o.d.m(y,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:E,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else o.d.m(y)},ot.requestFormReset=function(y){o.d.r(y)},ot.unstable_batchedUpdates=function(y,g){return y(g)},ot.useFormState=function(y,g,E){return p.H.useFormState(y,g,E)},ot.useFormStatus=function(){return p.H.useHostTransitionStatus()},ot.version="19.2.5",ot}var _p;function Ah(){if(_p)return Pc.exports;_p=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(s){console.error(s)}}return l(),Pc.exports=lb(),Pc.exports}var Cp;function ib(){if(Cp)return yi;Cp=1;var l=nb(),s=du(),i=Ah();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}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."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function p(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 m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(d(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(o(188));return t!==e?null:e}for(var a=e,n=t;;){var r=a.return;if(r===null)break;var c=r.alternate;if(c===null){if(n=r.return,n!==null){a=n;continue}break}if(r.child===c.child){for(c=r.child;c;){if(c===a)return y(r),e;if(c===n)return y(r),t;c=c.sibling}throw Error(o(188))}if(a.return!==n.return)a=r,n=c;else{for(var h=!1,v=r.child;v;){if(v===a){h=!0,a=r,n=c;break}if(v===n){h=!0,n=r,a=c;break}v=v.sibling}if(!h){for(v=c.child;v;){if(v===a){h=!0,a=c,n=r;break}if(v===n){h=!0,n=c,a=r;break}v=v.sibling}if(!h)throw Error(o(189))}}if(a.alternate!==n)throw Error(o(190))}if(a.tag!==3)throw Error(o(188));return a.stateNode.current===a?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,S=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),Ce=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),we=Symbol.for("react.memo_cache_sentinel"),Ge=Symbol.iterator;function Ie(e){return e===null||typeof e!="object"?null:(e=Ge&&e[Ge]||e["@@iterator"],typeof e=="function"?e:null)}var ct=Symbol.for("react.client.reference");function Ye(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ct?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case I:return"Fragment";case V:return"Profiler";case B:return"StrictMode";case W:return"Suspense";case P:return"SuspenseList";case ae:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case Y:return e.displayName||"Context";case L:return(e._context.displayName||"Context")+".Consumer";case j:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return t=e.displayName||null,t!==null?t:Ye(e.type)||"Memo";case Ce:t=e._payload,e=e._init;try{return Ye(e(t))}catch{}}return null}var Q=Array.isArray,A=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},xe=[],Ee=-1;function w(e){return{current:e}}function N(e){0>Ee||(e.current=xe[Ee],xe[Ee]=null,Ee--)}function F(e,t){Ee++,xe[Ee]=e.current,e.current=t}var Z=w(null),ie=w(null),se=w(null),he=w(null);function Je(e,t){switch(F(se,t),F(ie,e),F(Z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Um(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Um(t),e=Bm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}N(Z),F(Z,e)}function qe(){N(Z),N(ie),N(se)}function $a(e){e.memoizedState!==null&&F(he,e);var t=Z.current,a=Bm(t,e.type);t!==a&&(F(ie,e),F(Z,a))}function Cn(e){ie.current===e&&(N(Z),N(ie)),he.current===e&&(N(he),fi._currentValue=ne)}var Sl,zi;function na(e){if(Sl===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Sl=t&&t[1]||"",zi=-1<a.stack.indexOf(`
3
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
4
+ `+Sl+e+zi}var xl=!1;function El(e,t){if(!e||xl)return"";xl=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var U=function(){throw Error()};if(Object.defineProperty(U.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(U,[])}catch(q){var D=q}Reflect.construct(e,[],U)}else{try{U.call()}catch(q){D=q}e.call(U.prototype)}}else{try{throw Error()}catch(q){D=q}(U=e())&&typeof U.catch=="function"&&U.catch(function(){})}}catch(q){if(q&&D&&typeof q.stack=="string")return[q.stack,D.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=n.DetermineComponentFrameRoot(),h=c[0],v=c[1];if(h&&v){var T=h.split(`
5
+ `),z=v.split(`
6
+ `);for(r=n=0;n<T.length&&!T[n].includes("DetermineComponentFrameRoot");)n++;for(;r<z.length&&!z[r].includes("DetermineComponentFrameRoot");)r++;if(n===T.length||r===z.length)for(n=T.length-1,r=z.length-1;1<=n&&0<=r&&T[n]!==z[r];)r--;for(;1<=n&&0<=r;n--,r--)if(T[n]!==z[r]){if(n!==1||r!==1)do if(n--,r--,0>r||T[n]!==z[r]){var k=`
7
+ `+T[n].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),k}while(1<=n&&0<=r);break}}}finally{xl=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?na(a):""}function Ii(e,t){switch(e.tag){case 26:case 27:case 5:return na(e.type);case 16:return na("Lazy");case 13:return e.child!==t&&t!==null?na("Suspense Fallback"):na("Suspense");case 19:return na("SuspenseList");case 0:case 15:return El(e.type,!1);case 11:return El(e.type.render,!1);case 1:return El(e.type,!0);case 31:return na("Activity");default:return""}}function Ta(e){try{var t="",a=null;do t+=Ii(e,a),a=e,e=e.return;while(e);return t}catch(n){return`
8
+ Error generating stack: `+n.message+`
9
+ `+n.stack}}var Tl=Object.prototype.hasOwnProperty,K=l.unstable_scheduleCallback,Se=l.unstable_cancelCallback,ut=l.unstable_shouldYield,fe=l.unstable_requestPaint,He=l.unstable_now,wn=l.unstable_getCurrentPriorityLevel,Vt=l.unstable_ImmediatePriority,bu=l.unstable_UserBlockingPriority,Di=l.unstable_NormalPriority,zg=l.unstable_LowPriority,Su=l.unstable_IdlePriority,Ig=l.log,Dg=l.unstable_setDisableYieldValue,Nl=null,bt=null;function Na(e){if(typeof Ig=="function"&&Dg(e),bt&&typeof bt.setStrictMode=="function")try{bt.setStrictMode(Nl,e)}catch{}}var St=Math.clz32?Math.clz32:Hg,Lg=Math.log,qg=Math.LN2;function Hg(e){return e>>>=0,e===0?32:31-(Lg(e)/qg|0)|0}var Li=256,qi=262144,Hi=4194304;function Wa(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ki(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var r=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var v=n&134217727;return v!==0?(n=v&~c,n!==0?r=Wa(n):(h&=v,h!==0?r=Wa(h):a||(a=v&~e,a!==0&&(r=Wa(a))))):(v=n&~c,v!==0?r=Wa(v):h!==0?r=Wa(h):a||(a=n&~e,a!==0&&(r=Wa(a)))),r===0?0:t!==0&&t!==r&&(t&c)===0&&(c=r&-r,a=t&-t,c>=a||c===32&&(a&4194048)!==0)?t:r}function _l(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function kg(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xu(){var e=Hi;return Hi<<=1,(Hi&62914560)===0&&(Hi=4194304),e}function Cs(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Cl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Gg(e,t,a,n,r,c){var h=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var v=e.entanglements,T=e.expirationTimes,z=e.hiddenUpdates;for(a=h&~a;0<a;){var k=31-St(a),U=1<<k;v[k]=0,T[k]=-1;var D=z[k];if(D!==null)for(z[k]=null,k=0;k<D.length;k++){var q=D[k];q!==null&&(q.lane&=-536870913)}a&=~U}n!==0&&Eu(e,n,0),c!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=c&~(h&~t))}function Eu(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-St(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|a&261930}function Tu(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var n=31-St(a),r=1<<n;r&t|e[n]&t&&(e[n]|=t),a&=~r}}function Nu(e,t){var a=t&-t;return a=(a&42)!==0?1:ws(a),(a&(e.suspendedLanes|t))!==0?0:a}function ws(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function As(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function _u(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:dp(e.type))}function Cu(e,t){var a=X.p;try{return X.p=e,t()}finally{X.p=a}}var _a=Math.random().toString(36).slice(2),tt="__reactFiber$"+_a,ft="__reactProps$"+_a,An="__reactContainer$"+_a,Ms="__reactEvents$"+_a,Ug="__reactListeners$"+_a,Bg="__reactHandles$"+_a,wu="__reactResources$"+_a,wl="__reactMarker$"+_a;function Rs(e){delete e[tt],delete e[ft],delete e[Ms],delete e[Ug],delete e[Bg]}function Mn(e){var t=e[tt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[An]||a[tt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Qm(e);e!==null;){if(a=e[tt])return a;e=Qm(e)}return t}e=a,a=e.parentNode}return null}function Rn(e){if(e=e[tt]||e[An]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Al(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function On(e){var t=e[wu];return t||(t=e[wu]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function $e(e){e[wl]=!0}var Au=new Set,Mu={};function en(e,t){jn(e,t),jn(e+"Capture",t)}function jn(e,t){for(Mu[e]=t,e=0;e<t.length;e++)Au.add(t[e])}var Pg=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ru={},Ou={};function Fg(e){return Tl.call(Ou,e)?!0:Tl.call(Ru,e)?!1:Pg.test(e)?Ou[e]=!0:(Ru[e]=!0,!1)}function Gi(e,t,a){if(Fg(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Ui(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function la(e,t,a,n){if(n===null)e.removeAttribute(a);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+n)}}function Mt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ju(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yg(e,t,a){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,c=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(h){a=""+h,c.call(this,h)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(h){a=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Os(e){if(!e._valueTracker){var t=ju(e)?"checked":"value";e._valueTracker=Yg(e,t,""+e[t])}}function zu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=ju(e)?e.checked?"true":"false":e.value),e=n,e!==a?(t.setValue(e),!0):!1}function Bi(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}}var Kg=/[\n"\\]/g;function Rt(e){return e.replace(Kg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function js(e,t,a,n,r,c,h,v){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Mt(t)):e.value!==""+Mt(t)&&(e.value=""+Mt(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?zs(e,h,Mt(t)):a!=null?zs(e,h,Mt(a)):n!=null&&e.removeAttribute("value"),r==null&&c!=null&&(e.defaultChecked=!!c),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+Mt(v):e.removeAttribute("name")}function Iu(e,t,a,n,r,c,h,v){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||a!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){Os(e);return}a=a!=null?""+Mt(a):"",t=t!=null?""+Mt(t):a,v||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=v?e.checked:!!n,e.defaultChecked=!!n,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Os(e)}function zs(e,t,a){t==="number"&&Bi(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function zn(e,t,a,n){if(e=e.options,t){t={};for(var r=0;r<a.length;r++)t["$"+a[r]]=!0;for(a=0;a<e.length;a++)r=t.hasOwnProperty("$"+e[a].value),e[a].selected!==r&&(e[a].selected=r),r&&n&&(e[a].defaultSelected=!0)}else{for(a=""+Mt(a),t=null,r=0;r<e.length;r++){if(e[r].value===a){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Du(e,t,a){if(t!=null&&(t=""+Mt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Mt(a):""}function Lu(e,t,a,n){if(t==null){if(n!=null){if(a!=null)throw Error(o(92));if(Q(n)){if(1<n.length)throw Error(o(93));n=n[0]}a=n}a==null&&(a=""),t=a}a=Mt(t),e.defaultValue=a,n=e.textContent,n===a&&n!==""&&n!==null&&(e.value=n),Os(e)}function In(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Vg=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function qu(e,t,a){var n=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,a):typeof a!="number"||a===0||Vg.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Hu(e,t,a){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,a!=null){for(var n in a)!a.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var r in t)n=t[r],t.hasOwnProperty(r)&&a[r]!==n&&qu(e,r,n)}else for(var c in t)t.hasOwnProperty(c)&&qu(e,c,t[c])}function Is(e){if(e.indexOf("-")===-1)return!1;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 Xg=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Qg=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Pi(e){return Qg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ia(){}var Ds=null;function Ls(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dn=null,Ln=null;function ku(e){var t=Rn(e);if(t&&(e=t.stateNode)){var a=e[ft]||null;e:switch(e=t.stateNode,t.type){case"input":if(js(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Rt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var r=n[ft]||null;if(!r)throw Error(o(90));js(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<a.length;t++)n=a[t],n.form===e.form&&zu(n)}break e;case"textarea":Du(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&zn(e,!!a.multiple,t,!1)}}}var qs=!1;function Gu(e,t,a){if(qs)return e(t,a);qs=!0;try{var n=e(t);return n}finally{if(qs=!1,(Dn!==null||Ln!==null)&&(Oo(),Dn&&(t=Dn,e=Ln,Ln=Dn=null,ku(t),e)))for(t=0;t<e.length;t++)ku(e[t])}}function Ml(e,t){var a=e.stateNode;if(a===null)return null;var n=a[ft]||null;if(n===null)return null;a=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(o(231,t,typeof a));return a}var oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hs=!1;if(oa)try{var Rl={};Object.defineProperty(Rl,"passive",{get:function(){Hs=!0}}),window.addEventListener("test",Rl,Rl),window.removeEventListener("test",Rl,Rl)}catch{Hs=!1}var Ca=null,ks=null,Fi=null;function Uu(){if(Fi)return Fi;var e,t=ks,a=t.length,n,r="value"in Ca?Ca.value:Ca.textContent,c=r.length;for(e=0;e<a&&t[e]===r[e];e++);var h=a-e;for(n=1;n<=h&&t[a-n]===r[c-n];n++);return Fi=r.slice(e,1<n?1-n:void 0)}function Yi(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 Ki(){return!0}function Bu(){return!1}function mt(e){function t(a,n,r,c,h){this._reactName=a,this._targetInst=r,this.type=n,this.nativeEvent=c,this.target=h,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(a=e[v],this[v]=a?a(c):c[v]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?Ki:Bu,this.isPropagationStopped=Bu,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ki)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ki)},persist:function(){},isPersistent:Ki}),t}var tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vi=mt(tn),Ol=b({},tn,{view:0,detail:0}),Zg=mt(Ol),Gs,Us,jl,Xi=b({},Ol,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ps,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!==jl&&(jl&&e.type==="mousemove"?(Gs=e.screenX-jl.screenX,Us=e.screenY-jl.screenY):Us=Gs=0,jl=e),Gs)},movementY:function(e){return"movementY"in e?e.movementY:Us}}),Pu=mt(Xi),Jg=b({},Xi,{dataTransfer:0}),$g=mt(Jg),Wg=b({},Ol,{relatedTarget:0}),Bs=mt(Wg),ey=b({},tn,{animationName:0,elapsedTime:0,pseudoElement:0}),ty=mt(ey),ay=b({},tn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ny=mt(ay),ly=b({},tn,{data:0}),Fu=mt(ly),iy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oy={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"},sy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ry(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=sy[e])?!!t[e]:!1}function Ps(){return ry}var cy=b({},Ol,{key:function(e){if(e.key){var t=iy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Yi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?oy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ps,charCode:function(e){return e.type==="keypress"?Yi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Yi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),uy=mt(cy),dy=b({},Xi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yu=mt(dy),fy=b({},Ol,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ps}),my=mt(fy),py=b({},tn,{propertyName:0,elapsedTime:0,pseudoElement:0}),hy=mt(py),gy=b({},Xi,{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}),yy=mt(gy),vy=b({},tn,{newState:0,oldState:0}),by=mt(vy),Sy=[9,13,27,32],Fs=oa&&"CompositionEvent"in window,zl=null;oa&&"documentMode"in document&&(zl=document.documentMode);var xy=oa&&"TextEvent"in window&&!zl,Ku=oa&&(!Fs||zl&&8<zl&&11>=zl),Vu=" ",Xu=!1;function Qu(e,t){switch(e){case"keyup":return Sy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qn=!1;function Ey(e,t){switch(e){case"compositionend":return Zu(t);case"keypress":return t.which!==32?null:(Xu=!0,Vu);case"textInput":return e=t.data,e===Vu&&Xu?null:e;default:return null}}function Ty(e,t){if(qn)return e==="compositionend"||!Fs&&Qu(e,t)?(e=Uu(),Fi=ks=Ca=null,qn=!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 Ku&&t.locale!=="ko"?null:t.data;default:return null}}var Ny={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 Ju(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ny[e.type]:t==="textarea"}function $u(e,t,a,n){Dn?Ln?Ln.push(n):Ln=[n]:Dn=n,t=Ho(t,"onChange"),0<t.length&&(a=new Vi("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var Il=null,Dl=null;function _y(e){Dm(e,0)}function Qi(e){var t=Al(e);if(zu(t))return e}function Wu(e,t){if(e==="change")return t}var ed=!1;if(oa){var Ys;if(oa){var Ks="oninput"in document;if(!Ks){var td=document.createElement("div");td.setAttribute("oninput","return;"),Ks=typeof td.oninput=="function"}Ys=Ks}else Ys=!1;ed=Ys&&(!document.documentMode||9<document.documentMode)}function ad(){Il&&(Il.detachEvent("onpropertychange",nd),Dl=Il=null)}function nd(e){if(e.propertyName==="value"&&Qi(Dl)){var t=[];$u(t,Dl,e,Ls(e)),Gu(_y,t)}}function Cy(e,t,a){e==="focusin"?(ad(),Il=t,Dl=a,Il.attachEvent("onpropertychange",nd)):e==="focusout"&&ad()}function wy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qi(Dl)}function Ay(e,t){if(e==="click")return Qi(t)}function My(e,t){if(e==="input"||e==="change")return Qi(t)}function Ry(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xt=typeof Object.is=="function"?Object.is:Ry;function Ll(e,t){if(xt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++){var r=a[n];if(!Tl.call(t,r)||!xt(e[r],t[r]))return!1}return!0}function ld(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function id(e,t){var a=ld(e);e=0;for(var n;a;){if(a.nodeType===3){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=ld(a)}}function od(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?od(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bi(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Bi(e.document)}return t}function Vs(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")}var Oy=oa&&"documentMode"in document&&11>=document.documentMode,Hn=null,Xs=null,ql=null,Qs=!1;function rd(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Qs||Hn==null||Hn!==Bi(n)||(n=Hn,"selectionStart"in n&&Vs(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),ql&&Ll(ql,n)||(ql=n,n=Ho(Xs,"onSelect"),0<n.length&&(t=new Vi("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=Hn)))}function an(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var kn={animationend:an("Animation","AnimationEnd"),animationiteration:an("Animation","AnimationIteration"),animationstart:an("Animation","AnimationStart"),transitionrun:an("Transition","TransitionRun"),transitionstart:an("Transition","TransitionStart"),transitioncancel:an("Transition","TransitionCancel"),transitionend:an("Transition","TransitionEnd")},Zs={},cd={};oa&&(cd=document.createElement("div").style,"AnimationEvent"in window||(delete kn.animationend.animation,delete kn.animationiteration.animation,delete kn.animationstart.animation),"TransitionEvent"in window||delete kn.transitionend.transition);function nn(e){if(Zs[e])return Zs[e];if(!kn[e])return e;var t=kn[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in cd)return Zs[e]=t[a];return e}var ud=nn("animationend"),dd=nn("animationiteration"),fd=nn("animationstart"),jy=nn("transitionrun"),zy=nn("transitionstart"),Iy=nn("transitioncancel"),md=nn("transitionend"),pd=new Map,Js="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Js.push("scrollEnd");function Gt(e,t){pd.set(e,t),en(t,[e])}var Zi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ot=[],Gn=0,$s=0;function Ji(){for(var e=Gn,t=$s=Gn=0;t<e;){var a=Ot[t];Ot[t++]=null;var n=Ot[t];Ot[t++]=null;var r=Ot[t];Ot[t++]=null;var c=Ot[t];if(Ot[t++]=null,n!==null&&r!==null){var h=n.pending;h===null?r.next=r:(r.next=h.next,h.next=r),n.pending=r}c!==0&&hd(a,r,c)}}function $i(e,t,a,n){Ot[Gn++]=e,Ot[Gn++]=t,Ot[Gn++]=a,Ot[Gn++]=n,$s|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function Ws(e,t,a,n){return $i(e,t,a,n),Wi(e)}function ln(e,t){return $i(e,null,null,t),Wi(e)}function hd(e,t,a){e.lanes|=a;var n=e.alternate;n!==null&&(n.lanes|=a);for(var r=!1,c=e.return;c!==null;)c.childLanes|=a,n=c.alternate,n!==null&&(n.childLanes|=a),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(r=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,r&&t!==null&&(r=31-St(a),e=c.hiddenUpdates,n=e[r],n===null?e[r]=[t]:n.push(t),t.lane=a|536870912),c):null}function Wi(e){if(50<ii)throw ii=0,rc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Un={};function Dy(e,t,a,n){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Et(e,t,a,n){return new Dy(e,t,a,n)}function er(e){return e=e.prototype,!(!e||!e.isReactComponent)}function sa(e,t){var a=e.alternate;return a===null?(a=Et(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function gd(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function eo(e,t,a,n,r,c){var h=0;if(n=e,typeof e=="function")er(e)&&(h=1);else if(typeof e=="string")h=Gv(e,a,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ae:return e=Et(31,a,t,r),e.elementType=ae,e.lanes=c,e;case I:return on(a.children,r,c,t);case B:h=8,r|=24;break;case V:return e=Et(12,a,t,r|2),e.elementType=V,e.lanes=c,e;case W:return e=Et(13,a,t,r),e.elementType=W,e.lanes=c,e;case P:return e=Et(19,a,t,r),e.elementType=P,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Y:h=10;break e;case L:h=9;break e;case j:h=11;break e;case $:h=14;break e;case Ce:h=16,n=null;break e}h=29,a=Error(o(130,e===null?"null":typeof e,"")),n=null}return t=Et(h,a,t,r),t.elementType=e,t.type=n,t.lanes=c,t}function on(e,t,a,n){return e=Et(7,e,n,t),e.lanes=a,e}function tr(e,t,a){return e=Et(6,e,null,t),e.lanes=a,e}function yd(e){var t=Et(18,null,null,0);return t.stateNode=e,t}function ar(e,t,a){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var vd=new WeakMap;function jt(e,t){if(typeof e=="object"&&e!==null){var a=vd.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Ta(t)},vd.set(e,t),t)}return{value:e,source:t,stack:Ta(t)}}var Bn=[],Pn=0,to=null,Hl=0,zt=[],It=0,wa=null,Xt=1,Qt="";function ra(e,t){Bn[Pn++]=Hl,Bn[Pn++]=to,to=e,Hl=t}function bd(e,t,a){zt[It++]=Xt,zt[It++]=Qt,zt[It++]=wa,wa=e;var n=Xt;e=Qt;var r=32-St(n)-1;n&=~(1<<r),a+=1;var c=32-St(t)+r;if(30<c){var h=r-r%5;c=(n&(1<<h)-1).toString(32),n>>=h,r-=h,Xt=1<<32-St(t)+r|a<<r|n,Qt=c+e}else Xt=1<<c|a<<r|n,Qt=e}function nr(e){e.return!==null&&(ra(e,1),bd(e,1,0))}function lr(e){for(;e===to;)to=Bn[--Pn],Bn[Pn]=null,Hl=Bn[--Pn],Bn[Pn]=null;for(;e===wa;)wa=zt[--It],zt[It]=null,Qt=zt[--It],zt[It]=null,Xt=zt[--It],zt[It]=null}function Sd(e,t){zt[It++]=Xt,zt[It++]=Qt,zt[It++]=wa,Xt=t.id,Qt=t.overflow,wa=e}var at=null,De=null,ve=!1,Aa=null,Dt=!1,ir=Error(o(519));function Ma(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw kl(jt(t,e)),ir}function xd(e){var t=e.stateNode,a=e.type,n=e.memoizedProps;switch(t[tt]=e,t[ft]=n,a){case"dialog":pe("cancel",t),pe("close",t);break;case"iframe":case"object":case"embed":pe("load",t);break;case"video":case"audio":for(a=0;a<si.length;a++)pe(si[a],t);break;case"source":pe("error",t);break;case"img":case"image":case"link":pe("error",t),pe("load",t);break;case"details":pe("toggle",t);break;case"input":pe("invalid",t),Iu(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":pe("invalid",t);break;case"textarea":pe("invalid",t),Lu(t,n.value,n.defaultValue,n.children)}a=n.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||n.suppressHydrationWarning===!0||km(t.textContent,a)?(n.popover!=null&&(pe("beforetoggle",t),pe("toggle",t)),n.onScroll!=null&&pe("scroll",t),n.onScrollEnd!=null&&pe("scrollend",t),n.onClick!=null&&(t.onclick=ia),t=!0):t=!1,t||Ma(e,!0)}function Ed(e){for(at=e.return;at;)switch(at.tag){case 5:case 31:case 13:Dt=!1;return;case 27:case 3:Dt=!0;return;default:at=at.return}}function Fn(e){if(e!==at)return!1;if(!ve)return Ed(e),ve=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Tc(e.type,e.memoizedProps)),a=!a),a&&De&&Ma(e),Ed(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));De=Xm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));De=Xm(e)}else t===27?(t=De,Pa(e.type)?(e=Ac,Ac=null,De=e):De=t):De=at?qt(e.stateNode.nextSibling):null;return!0}function sn(){De=at=null,ve=!1}function or(){var e=Aa;return e!==null&&(yt===null?yt=e:yt.push.apply(yt,e),Aa=null),e}function kl(e){Aa===null?Aa=[e]:Aa.push(e)}var sr=w(null),rn=null,ca=null;function Ra(e,t,a){F(sr,t._currentValue),t._currentValue=a}function ua(e){e._currentValue=sr.current,N(sr)}function rr(e,t,a){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===a)break;e=e.return}}function cr(e,t,a,n){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var c=r.dependencies;if(c!==null){var h=r.child;c=c.firstContext;e:for(;c!==null;){var v=c;c=r;for(var T=0;T<t.length;T++)if(v.context===t[T]){c.lanes|=a,v=c.alternate,v!==null&&(v.lanes|=a),rr(c.return,a,e),n||(h=null);break e}c=v.next}}else if(r.tag===18){if(h=r.return,h===null)throw Error(o(341));h.lanes|=a,c=h.alternate,c!==null&&(c.lanes|=a),rr(h,a,e),h=null}else h=r.child;if(h!==null)h.return=r;else for(h=r;h!==null;){if(h===e){h=null;break}if(r=h.sibling,r!==null){r.return=h.return,h=r;break}h=h.return}r=h}}function Yn(e,t,a,n){e=null;for(var r=t,c=!1;r!==null;){if(!c){if((r.flags&524288)!==0)c=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var h=r.alternate;if(h===null)throw Error(o(387));if(h=h.memoizedProps,h!==null){var v=r.type;xt(r.pendingProps.value,h.value)||(e!==null?e.push(v):e=[v])}}else if(r===he.current){if(h=r.alternate,h===null)throw Error(o(387));h.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(fi):e=[fi])}r=r.return}e!==null&&cr(t,e,a,n),t.flags|=262144}function ao(e){for(e=e.firstContext;e!==null;){if(!xt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function cn(e){rn=e,ca=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function nt(e){return Td(rn,e)}function no(e,t){return rn===null&&cn(e),Td(e,t)}function Td(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ca===null){if(e===null)throw Error(o(308));ca=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ca=ca.next=t;return a}var Ly=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},qy=l.unstable_scheduleCallback,Hy=l.unstable_NormalPriority,Ke={$$typeof:Y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ur(){return{controller:new Ly,data:new Map,refCount:0}}function Gl(e){e.refCount--,e.refCount===0&&qy(Hy,function(){e.controller.abort()})}var Ul=null,dr=0,Kn=0,Vn=null;function ky(e,t){if(Ul===null){var a=Ul=[];dr=0,Kn=pc(),Vn={status:"pending",value:void 0,then:function(n){a.push(n)}}}return dr++,t.then(Nd,Nd),t}function Nd(){if(--dr===0&&Ul!==null){Vn!==null&&(Vn.status="fulfilled");var e=Ul;Ul=null,Kn=0,Vn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Gy(e,t){var a=[],n={status:"pending",value:null,reason:null,then:function(r){a.push(r)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var r=0;r<a.length;r++)(0,a[r])(t)},function(r){for(n.status="rejected",n.reason=r,r=0;r<a.length;r++)(0,a[r])(void 0)}),n}var _d=A.S;A.S=function(e,t){cm=He(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ky(e,t),_d!==null&&_d(e,t)};var un=w(null);function fr(){var e=un.current;return e!==null?e:ze.pooledCache}function lo(e,t){t===null?F(un,un.current):F(un,t.pool)}function Cd(){var e=fr();return e===null?null:{parent:Ke._currentValue,pool:e}}var Xn=Error(o(460)),mr=Error(o(474)),io=Error(o(542)),oo={then:function(){}};function wd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ad(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(ia,ia),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Rd(e),e;default:if(typeof t.status=="string")t.then(ia,ia);else{if(e=ze,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=n}},function(n){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Rd(e),e}throw fn=t,Xn}}function dn(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(fn=a,Xn):a}}var fn=null;function Md(){if(fn===null)throw Error(o(459));var e=fn;return fn=null,e}function Rd(e){if(e===Xn||e===io)throw Error(o(483))}var Qn=null,Bl=0;function so(e){var t=Bl;return Bl+=1,Qn===null&&(Qn=[]),Ad(Qn,e,t)}function Pl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ro(e,t){throw t.$$typeof===S?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Od(e){function t(R,C){if(e){var O=R.deletions;O===null?(R.deletions=[C],R.flags|=16):O.push(C)}}function a(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function n(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function r(R,C){return R=sa(R,C),R.index=0,R.sibling=null,R}function c(R,C,O){return R.index=O,e?(O=R.alternate,O!==null?(O=O.index,O<C?(R.flags|=67108866,C):O):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function h(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function v(R,C,O,G){return C===null||C.tag!==6?(C=tr(O,R.mode,G),C.return=R,C):(C=r(C,O),C.return=R,C)}function T(R,C,O,G){var le=O.type;return le===I?k(R,C,O.props.children,G,O.key):C!==null&&(C.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===Ce&&dn(le)===C.type)?(C=r(C,O.props),Pl(C,O),C.return=R,C):(C=eo(O.type,O.key,O.props,null,R.mode,G),Pl(C,O),C.return=R,C)}function z(R,C,O,G){return C===null||C.tag!==4||C.stateNode.containerInfo!==O.containerInfo||C.stateNode.implementation!==O.implementation?(C=ar(O,R.mode,G),C.return=R,C):(C=r(C,O.children||[]),C.return=R,C)}function k(R,C,O,G,le){return C===null||C.tag!==7?(C=on(O,R.mode,G,le),C.return=R,C):(C=r(C,O),C.return=R,C)}function U(R,C,O){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=tr(""+C,R.mode,O),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case x:return O=eo(C.type,C.key,C.props,null,R.mode,O),Pl(O,C),O.return=R,O;case M:return C=ar(C,R.mode,O),C.return=R,C;case Ce:return C=dn(C),U(R,C,O)}if(Q(C)||Ie(C))return C=on(C,R.mode,O,null),C.return=R,C;if(typeof C.then=="function")return U(R,so(C),O);if(C.$$typeof===Y)return U(R,no(R,C),O);ro(R,C)}return null}function D(R,C,O,G){var le=C!==null?C.key:null;if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return le!==null?null:v(R,C,""+O,G);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case x:return O.key===le?T(R,C,O,G):null;case M:return O.key===le?z(R,C,O,G):null;case Ce:return O=dn(O),D(R,C,O,G)}if(Q(O)||Ie(O))return le!==null?null:k(R,C,O,G,null);if(typeof O.then=="function")return D(R,C,so(O),G);if(O.$$typeof===Y)return D(R,C,no(R,O),G);ro(R,O)}return null}function q(R,C,O,G,le){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return R=R.get(O)||null,v(C,R,""+G,le);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case x:return R=R.get(G.key===null?O:G.key)||null,T(C,R,G,le);case M:return R=R.get(G.key===null?O:G.key)||null,z(C,R,G,le);case Ce:return G=dn(G),q(R,C,O,G,le)}if(Q(G)||Ie(G))return R=R.get(O)||null,k(C,R,G,le,null);if(typeof G.then=="function")return q(R,C,O,so(G),le);if(G.$$typeof===Y)return q(R,C,O,no(C,G),le);ro(C,G)}return null}function ee(R,C,O,G){for(var le=null,Te=null,te=C,ue=C=0,ye=null;te!==null&&ue<O.length;ue++){te.index>ue?(ye=te,te=null):ye=te.sibling;var Ne=D(R,te,O[ue],G);if(Ne===null){te===null&&(te=ye);break}e&&te&&Ne.alternate===null&&t(R,te),C=c(Ne,C,ue),Te===null?le=Ne:Te.sibling=Ne,Te=Ne,te=ye}if(ue===O.length)return a(R,te),ve&&ra(R,ue),le;if(te===null){for(;ue<O.length;ue++)te=U(R,O[ue],G),te!==null&&(C=c(te,C,ue),Te===null?le=te:Te.sibling=te,Te=te);return ve&&ra(R,ue),le}for(te=n(te);ue<O.length;ue++)ye=q(te,R,ue,O[ue],G),ye!==null&&(e&&ye.alternate!==null&&te.delete(ye.key===null?ue:ye.key),C=c(ye,C,ue),Te===null?le=ye:Te.sibling=ye,Te=ye);return e&&te.forEach(function(Xa){return t(R,Xa)}),ve&&ra(R,ue),le}function oe(R,C,O,G){if(O==null)throw Error(o(151));for(var le=null,Te=null,te=C,ue=C=0,ye=null,Ne=O.next();te!==null&&!Ne.done;ue++,Ne=O.next()){te.index>ue?(ye=te,te=null):ye=te.sibling;var Xa=D(R,te,Ne.value,G);if(Xa===null){te===null&&(te=ye);break}e&&te&&Xa.alternate===null&&t(R,te),C=c(Xa,C,ue),Te===null?le=Xa:Te.sibling=Xa,Te=Xa,te=ye}if(Ne.done)return a(R,te),ve&&ra(R,ue),le;if(te===null){for(;!Ne.done;ue++,Ne=O.next())Ne=U(R,Ne.value,G),Ne!==null&&(C=c(Ne,C,ue),Te===null?le=Ne:Te.sibling=Ne,Te=Ne);return ve&&ra(R,ue),le}for(te=n(te);!Ne.done;ue++,Ne=O.next())Ne=q(te,R,ue,Ne.value,G),Ne!==null&&(e&&Ne.alternate!==null&&te.delete(Ne.key===null?ue:Ne.key),C=c(Ne,C,ue),Te===null?le=Ne:Te.sibling=Ne,Te=Ne);return e&&te.forEach(function(Jv){return t(R,Jv)}),ve&&ra(R,ue),le}function je(R,C,O,G){if(typeof O=="object"&&O!==null&&O.type===I&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case x:e:{for(var le=O.key;C!==null;){if(C.key===le){if(le=O.type,le===I){if(C.tag===7){a(R,C.sibling),G=r(C,O.props.children),G.return=R,R=G;break e}}else if(C.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===Ce&&dn(le)===C.type){a(R,C.sibling),G=r(C,O.props),Pl(G,O),G.return=R,R=G;break e}a(R,C);break}else t(R,C);C=C.sibling}O.type===I?(G=on(O.props.children,R.mode,G,O.key),G.return=R,R=G):(G=eo(O.type,O.key,O.props,null,R.mode,G),Pl(G,O),G.return=R,R=G)}return h(R);case M:e:{for(le=O.key;C!==null;){if(C.key===le)if(C.tag===4&&C.stateNode.containerInfo===O.containerInfo&&C.stateNode.implementation===O.implementation){a(R,C.sibling),G=r(C,O.children||[]),G.return=R,R=G;break e}else{a(R,C);break}else t(R,C);C=C.sibling}G=ar(O,R.mode,G),G.return=R,R=G}return h(R);case Ce:return O=dn(O),je(R,C,O,G)}if(Q(O))return ee(R,C,O,G);if(Ie(O)){if(le=Ie(O),typeof le!="function")throw Error(o(150));return O=le.call(O),oe(R,C,O,G)}if(typeof O.then=="function")return je(R,C,so(O),G);if(O.$$typeof===Y)return je(R,C,no(R,O),G);ro(R,O)}return typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint"?(O=""+O,C!==null&&C.tag===6?(a(R,C.sibling),G=r(C,O),G.return=R,R=G):(a(R,C),G=tr(O,R.mode,G),G.return=R,R=G),h(R)):a(R,C)}return function(R,C,O,G){try{Bl=0;var le=je(R,C,O,G);return Qn=null,le}catch(te){if(te===Xn||te===io)throw te;var Te=Et(29,te,null,R.mode);return Te.lanes=G,Te.return=R,Te}}}var mn=Od(!0),jd=Od(!1),Oa=!1;function pr(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hr(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(_e&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Wi(e),hd(e,null,a),t}return $i(e,n,t,a),Wi(e)}function Fl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Tu(e,a)}}function gr(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var r=null,c=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};c===null?r=c=h:c=c.next=h,a=a.next}while(a!==null);c===null?r=c=t:c=c.next=t}else r=c=t;a={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:c,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var yr=!1;function Yl(){if(yr){var e=Vn;if(e!==null)throw e}}function Kl(e,t,a,n){yr=!1;var r=e.updateQueue;Oa=!1;var c=r.firstBaseUpdate,h=r.lastBaseUpdate,v=r.shared.pending;if(v!==null){r.shared.pending=null;var T=v,z=T.next;T.next=null,h===null?c=z:h.next=z,h=T;var k=e.alternate;k!==null&&(k=k.updateQueue,v=k.lastBaseUpdate,v!==h&&(v===null?k.firstBaseUpdate=z:v.next=z,k.lastBaseUpdate=T))}if(c!==null){var U=r.baseState;h=0,k=z=T=null,v=c;do{var D=v.lane&-536870913,q=D!==v.lane;if(q?(ge&D)===D:(n&D)===D){D!==0&&D===Kn&&(yr=!0),k!==null&&(k=k.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ee=e,oe=v;D=t;var je=a;switch(oe.tag){case 1:if(ee=oe.payload,typeof ee=="function"){U=ee.call(je,U,D);break e}U=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=oe.payload,D=typeof ee=="function"?ee.call(je,U,D):ee,D==null)break e;U=b({},U,D);break e;case 2:Oa=!0}}D=v.callback,D!==null&&(e.flags|=64,q&&(e.flags|=8192),q=r.callbacks,q===null?r.callbacks=[D]:q.push(D))}else q={lane:D,tag:v.tag,payload:v.payload,callback:v.callback,next:null},k===null?(z=k=q,T=U):k=k.next=q,h|=D;if(v=v.next,v===null){if(v=r.shared.pending,v===null)break;q=v,v=q.next,q.next=null,r.lastBaseUpdate=q,r.shared.pending=null}}while(!0);k===null&&(T=U),r.baseState=T,r.firstBaseUpdate=z,r.lastBaseUpdate=k,c===null&&(r.shared.lanes=0),Ha|=h,e.lanes=h,e.memoizedState=U}}function zd(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Id(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)zd(a[e],t)}var Zn=w(null),co=w(0);function Dd(e,t){e=ba,F(co,e),F(Zn,t),ba=e|t.baseLanes}function vr(){F(co,ba),F(Zn,Zn.current)}function br(){ba=co.current,N(Zn),N(co)}var Tt=w(null),Lt=null;function Ia(e){var t=e.alternate;F(Pe,Pe.current&1),F(Tt,e),Lt===null&&(t===null||Zn.current!==null||t.memoizedState!==null)&&(Lt=e)}function Sr(e){F(Pe,Pe.current),F(Tt,e),Lt===null&&(Lt=e)}function Ld(e){e.tag===22?(F(Pe,Pe.current),F(Tt,e),Lt===null&&(Lt=e)):Da()}function Da(){F(Pe,Pe.current),F(Tt,Tt.current)}function Nt(e){N(Tt),Lt===e&&(Lt=null),N(Pe)}var Pe=w(0);function uo(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Cc(a)||wc(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)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 da=0,ce=null,Re=null,Ve=null,fo=!1,Jn=!1,pn=!1,mo=0,Vl=0,$n=null,Uy=0;function Ue(){throw Error(o(321))}function xr(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!xt(e[a],t[a]))return!1;return!0}function Er(e,t,a,n,r,c){return da=c,ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Sf:qr,pn=!1,c=a(n,r),pn=!1,Jn&&(c=Hd(t,a,n,r)),qd(e),c}function qd(e){A.H=Zl;var t=Re!==null&&Re.next!==null;if(da=0,Ve=Re=ce=null,fo=!1,Vl=0,$n=null,t)throw Error(o(300));e===null||Xe||(e=e.dependencies,e!==null&&ao(e)&&(Xe=!0))}function Hd(e,t,a,n){ce=e;var r=0;do{if(Jn&&($n=null),Vl=0,Jn=!1,25<=r)throw Error(o(301));if(r+=1,Ve=Re=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}A.H=xf,c=t(a,n)}while(Jn);return c}function By(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?Xl(t):t,e=e.useState()[0],(Re!==null?Re.memoizedState:null)!==e&&(ce.flags|=1024),t}function Tr(){var e=mo!==0;return mo=0,e}function Nr(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function _r(e){if(fo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}fo=!1}da=0,Ve=Re=ce=null,Jn=!1,Vl=mo=0,$n=null}function dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ve===null?ce.memoizedState=Ve=e:Ve=Ve.next=e,Ve}function Fe(){if(Re===null){var e=ce.alternate;e=e!==null?e.memoizedState:null}else e=Re.next;var t=Ve===null?ce.memoizedState:Ve.next;if(t!==null)Ve=t,Re=e;else{if(e===null)throw ce.alternate===null?Error(o(467)):Error(o(310));Re=e,e={memoizedState:Re.memoizedState,baseState:Re.baseState,baseQueue:Re.baseQueue,queue:Re.queue,next:null},Ve===null?ce.memoizedState=Ve=e:Ve=Ve.next=e}return Ve}function po(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xl(e){var t=Vl;return Vl+=1,$n===null&&($n=[]),e=Ad($n,e,t),t=ce,(Ve===null?t.memoizedState:Ve.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Sf:qr),e}function ho(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Xl(e);if(e.$$typeof===Y)return nt(e)}throw Error(o(438,String(e)))}function Cr(e){var t=null,a=ce.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var n=ce.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=po(),ce.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),n=0;n<e;n++)a[n]=we;return t.index++,a}function fa(e,t){return typeof t=="function"?t(e):t}function go(e){var t=Fe();return wr(t,Re,e)}function wr(e,t,a){var n=e.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=a;var r=e.baseQueue,c=n.pending;if(c!==null){if(r!==null){var h=r.next;r.next=c.next,c.next=h}t.baseQueue=r=c,n.pending=null}if(c=e.baseState,r===null)e.memoizedState=c;else{t=r.next;var v=h=null,T=null,z=t,k=!1;do{var U=z.lane&-536870913;if(U!==z.lane?(ge&U)===U:(da&U)===U){var D=z.revertLane;if(D===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),U===Kn&&(k=!0);else if((da&D)===D){z=z.next,D===Kn&&(k=!0);continue}else U={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},T===null?(v=T=U,h=c):T=T.next=U,ce.lanes|=D,Ha|=D;U=z.action,pn&&a(c,U),c=z.hasEagerState?z.eagerState:a(c,U)}else D={lane:U,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},T===null?(v=T=D,h=c):T=T.next=D,ce.lanes|=U,Ha|=U;z=z.next}while(z!==null&&z!==t);if(T===null?h=c:T.next=v,!xt(c,e.memoizedState)&&(Xe=!0,k&&(a=Vn,a!==null)))throw a;e.memoizedState=c,e.baseState=h,e.baseQueue=T,n.lastRenderedState=c}return r===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Ar(e){var t=Fe(),a=t.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=e;var n=a.dispatch,r=a.pending,c=t.memoizedState;if(r!==null){a.pending=null;var h=r=r.next;do c=e(c,h.action),h=h.next;while(h!==r);xt(c,t.memoizedState)||(Xe=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),a.lastRenderedState=c}return[c,n]}function kd(e,t,a){var n=ce,r=Fe(),c=ve;if(c){if(a===void 0)throw Error(o(407));a=a()}else a=t();var h=!xt((Re||r).memoizedState,a);if(h&&(r.memoizedState=a,Xe=!0),r=r.queue,Or(Bd.bind(null,n,r,e),[e]),r.getSnapshot!==t||h||Ve!==null&&Ve.memoizedState.tag&1){if(n.flags|=2048,Wn(9,{destroy:void 0},Ud.bind(null,n,r,a,t),null),ze===null)throw Error(o(349));c||(da&127)!==0||Gd(n,t,a)}return a}function Gd(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ce.updateQueue,t===null?(t=po(),ce.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Ud(e,t,a,n){t.value=a,t.getSnapshot=n,Pd(t)&&Fd(e)}function Bd(e,t,a){return a(function(){Pd(t)&&Fd(e)})}function Pd(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!xt(e,a)}catch{return!0}}function Fd(e){var t=ln(e,2);t!==null&&vt(t,e,2)}function Mr(e){var t=dt();if(typeof e=="function"){var a=e;if(e=a(),pn){Na(!0);try{a()}finally{Na(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:e},t}function Yd(e,t,a,n){return e.baseState=a,wr(e,Re,typeof n=="function"?n:fa)}function Py(e,t,a,n,r){if(bo(e))throw Error(o(485));if(e=t.action,e!==null){var c={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){c.listeners.push(h)}};A.T!==null?a(!0):c.isTransition=!1,n(c),a=t.pending,a===null?(c.next=t.pending=c,Kd(t,c)):(c.next=a.next,t.pending=a.next=c)}}function Kd(e,t){var a=t.action,n=t.payload,r=e.state;if(t.isTransition){var c=A.T,h={};A.T=h;try{var v=a(r,n),T=A.S;T!==null&&T(h,v),Vd(e,t,v)}catch(z){Rr(e,t,z)}finally{c!==null&&h.types!==null&&(c.types=h.types),A.T=c}}else try{c=a(r,n),Vd(e,t,c)}catch(z){Rr(e,t,z)}}function Vd(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(n){Xd(e,t,n)},function(n){return Rr(e,t,n)}):Xd(e,t,a)}function Xd(e,t,a){t.status="fulfilled",t.value=a,Qd(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Kd(e,a)))}function Rr(e,t,a){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=a,Qd(t),t=t.next;while(t!==n)}e.action=null}function Qd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zd(e,t){return t}function Jd(e,t){if(ve){var a=ze.formState;if(a!==null){e:{var n=ce;if(ve){if(De){t:{for(var r=De,c=Dt;r.nodeType!==8;){if(!c){r=null;break t}if(r=qt(r.nextSibling),r===null){r=null;break t}}c=r.data,r=c==="F!"||c==="F"?r:null}if(r){De=qt(r.nextSibling),n=r.data==="F!";break e}}Ma(n)}n=!1}n&&(t=a[0])}}return a=dt(),a.memoizedState=a.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zd,lastRenderedState:t},a.queue=n,a=yf.bind(null,ce,n),n.dispatch=a,n=Mr(!1),c=Lr.bind(null,ce,!1,n.queue),n=dt(),r={state:t,dispatch:null,action:e,pending:null},n.queue=r,a=Py.bind(null,ce,r,c,a),r.dispatch=a,n.memoizedState=e,[t,a,!1]}function $d(e){var t=Fe();return Wd(t,Re,e)}function Wd(e,t,a){if(t=wr(e,t,Zd)[0],e=go(fa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Xl(t)}catch(h){throw h===Xn?io:h}else n=t;t=Fe();var r=t.queue,c=r.dispatch;return a!==t.memoizedState&&(ce.flags|=2048,Wn(9,{destroy:void 0},Fy.bind(null,r,a),null)),[n,c,e]}function Fy(e,t){e.action=t}function ef(e){var t=Fe(),a=Re;if(a!==null)return Wd(t,a,e);Fe(),t=t.memoizedState,a=Fe();var n=a.queue.dispatch;return a.memoizedState=e,[t,n,!1]}function Wn(e,t,a,n){return e={tag:e,create:a,deps:n,inst:t,next:null},t=ce.updateQueue,t===null&&(t=po(),ce.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function tf(){return Fe().memoizedState}function yo(e,t,a,n){var r=dt();ce.flags|=e,r.memoizedState=Wn(1|t,{destroy:void 0},a,n===void 0?null:n)}function vo(e,t,a,n){var r=Fe();n=n===void 0?null:n;var c=r.memoizedState.inst;Re!==null&&n!==null&&xr(n,Re.memoizedState.deps)?r.memoizedState=Wn(t,c,a,n):(ce.flags|=e,r.memoizedState=Wn(1|t,c,a,n))}function af(e,t){yo(8390656,8,e,t)}function Or(e,t){vo(2048,8,e,t)}function Yy(e){ce.flags|=4;var t=ce.updateQueue;if(t===null)t=po(),ce.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function nf(e){var t=Fe().memoizedState;return Yy({ref:t,nextImpl:e}),function(){if((_e&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function lf(e,t){return vo(4,2,e,t)}function of(e,t){return vo(4,4,e,t)}function sf(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function rf(e,t,a){a=a!=null?a.concat([e]):null,vo(4,4,sf.bind(null,t,e),a)}function jr(){}function cf(e,t){var a=Fe();t=t===void 0?null:t;var n=a.memoizedState;return t!==null&&xr(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function uf(e,t){var a=Fe();t=t===void 0?null:t;var n=a.memoizedState;if(t!==null&&xr(t,n[1]))return n[0];if(n=e(),pn){Na(!0);try{e()}finally{Na(!1)}}return a.memoizedState=[n,t],n}function zr(e,t,a){return a===void 0||(da&1073741824)!==0&&(ge&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=dm(),ce.lanes|=e,Ha|=e,a)}function df(e,t,a,n){return xt(a,t)?a:Zn.current!==null?(e=zr(e,a,n),xt(e,t)||(Xe=!0),e):(da&42)===0||(da&1073741824)!==0&&(ge&261930)===0?(Xe=!0,e.memoizedState=a):(e=dm(),ce.lanes|=e,Ha|=e,t)}function ff(e,t,a,n,r){var c=X.p;X.p=c!==0&&8>c?c:8;var h=A.T,v={};A.T=v,Lr(e,!1,t,a);try{var T=r(),z=A.S;if(z!==null&&z(v,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var k=Gy(T,n);Ql(e,t,k,wt(e))}else Ql(e,t,n,wt(e))}catch(U){Ql(e,t,{then:function(){},status:"rejected",reason:U},wt())}finally{X.p=c,h!==null&&v.types!==null&&(h.types=v.types),A.T=h}}function Ky(){}function Ir(e,t,a,n){if(e.tag!==5)throw Error(o(476));var r=mf(e).queue;ff(e,r,t,ne,a===null?Ky:function(){return pf(e),a(n)})}function mf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:ne},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function pf(e){var t=mf(e);t.next===null&&(t=e.alternate.memoizedState),Ql(e,t.next.queue,{},wt())}function Dr(){return nt(fi)}function hf(){return Fe().memoizedState}function gf(){return Fe().memoizedState}function Vy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=wt();e=ja(a);var n=za(t,e,a);n!==null&&(vt(n,t,a),Fl(n,t,a)),t={cache:ur()},e.payload=t;return}t=t.return}}function Xy(e,t,a){var n=wt();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},bo(e)?vf(t,a):(a=Ws(e,t,a,n),a!==null&&(vt(a,e,n),bf(a,t,n)))}function yf(e,t,a){var n=wt();Ql(e,t,a,n)}function Ql(e,t,a,n){var r={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(bo(e))vf(t,r);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,v=c(h,a);if(r.hasEagerState=!0,r.eagerState=v,xt(v,h))return $i(e,t,r,0),ze===null&&Ji(),!1}catch{}if(a=Ws(e,t,r,n),a!==null)return vt(a,e,n),bf(a,t,n),!0}return!1}function Lr(e,t,a,n){if(n={lane:2,revertLane:pc(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},bo(e)){if(t)throw Error(o(479))}else t=Ws(e,a,n,2),t!==null&&vt(t,e,2)}function bo(e){var t=e.alternate;return e===ce||t!==null&&t===ce}function vf(e,t){Jn=fo=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function bf(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Tu(e,a)}}var Zl={readContext:nt,use:ho,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useLayoutEffect:Ue,useInsertionEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useSyncExternalStore:Ue,useId:Ue,useHostTransitionStatus:Ue,useFormState:Ue,useActionState:Ue,useOptimistic:Ue,useMemoCache:Ue,useCacheRefresh:Ue};Zl.useEffectEvent=Ue;var Sf={readContext:nt,use:ho,useCallback:function(e,t){return dt().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:af,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,yo(4194308,4,sf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return yo(4194308,4,e,t)},useInsertionEffect:function(e,t){yo(4,2,e,t)},useMemo:function(e,t){var a=dt();t=t===void 0?null:t;var n=e();if(pn){Na(!0);try{e()}finally{Na(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=dt();if(a!==void 0){var r=a(t);if(pn){Na(!0);try{a(t)}finally{Na(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=Xy.bind(null,ce,e),[n.memoizedState,e]},useRef:function(e){var t=dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Mr(e);var t=e.queue,a=yf.bind(null,ce,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:jr,useDeferredValue:function(e,t){var a=dt();return zr(a,e,t)},useTransition:function(){var e=Mr(!1);return e=ff.bind(null,ce,e.queue,!0,!1),dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=ce,r=dt();if(ve){if(a===void 0)throw Error(o(407));a=a()}else{if(a=t(),ze===null)throw Error(o(349));(ge&127)!==0||Gd(n,t,a)}r.memoizedState=a;var c={value:a,getSnapshot:t};return r.queue=c,af(Bd.bind(null,n,c,e),[e]),n.flags|=2048,Wn(9,{destroy:void 0},Ud.bind(null,n,c,a,t),null),a},useId:function(){var e=dt(),t=ze.identifierPrefix;if(ve){var a=Qt,n=Xt;a=(n&~(1<<32-St(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=mo++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Uy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Dr,useFormState:Jd,useActionState:Jd,useOptimistic:function(e){var t=dt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Lr.bind(null,ce,!0,a),a.dispatch=t,[e,t]},useMemoCache:Cr,useCacheRefresh:function(){return dt().memoizedState=Vy.bind(null,ce)},useEffectEvent:function(e){var t=dt(),a={impl:e};return t.memoizedState=a,function(){if((_e&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}},qr={readContext:nt,use:ho,useCallback:cf,useContext:nt,useEffect:Or,useImperativeHandle:rf,useInsertionEffect:lf,useLayoutEffect:of,useMemo:uf,useReducer:go,useRef:tf,useState:function(){return go(fa)},useDebugValue:jr,useDeferredValue:function(e,t){var a=Fe();return df(a,Re.memoizedState,e,t)},useTransition:function(){var e=go(fa)[0],t=Fe().memoizedState;return[typeof e=="boolean"?e:Xl(e),t]},useSyncExternalStore:kd,useId:hf,useHostTransitionStatus:Dr,useFormState:$d,useActionState:$d,useOptimistic:function(e,t){var a=Fe();return Yd(a,Re,e,t)},useMemoCache:Cr,useCacheRefresh:gf};qr.useEffectEvent=nf;var xf={readContext:nt,use:ho,useCallback:cf,useContext:nt,useEffect:Or,useImperativeHandle:rf,useInsertionEffect:lf,useLayoutEffect:of,useMemo:uf,useReducer:Ar,useRef:tf,useState:function(){return Ar(fa)},useDebugValue:jr,useDeferredValue:function(e,t){var a=Fe();return Re===null?zr(a,e,t):df(a,Re.memoizedState,e,t)},useTransition:function(){var e=Ar(fa)[0],t=Fe().memoizedState;return[typeof e=="boolean"?e:Xl(e),t]},useSyncExternalStore:kd,useId:hf,useHostTransitionStatus:Dr,useFormState:ef,useActionState:ef,useOptimistic:function(e,t){var a=Fe();return Re!==null?Yd(a,Re,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Cr,useCacheRefresh:gf};xf.useEffectEvent=nf;function Hr(e,t,a,n){t=e.memoizedState,a=a(n,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var kr={enqueueSetState:function(e,t,a){e=e._reactInternals;var n=wt(),r=ja(n);r.payload=t,a!=null&&(r.callback=a),t=za(e,r,n),t!==null&&(vt(t,e,n),Fl(t,e,n))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=wt(),r=ja(n);r.tag=1,r.payload=t,a!=null&&(r.callback=a),t=za(e,r,n),t!==null&&(vt(t,e,n),Fl(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=wt(),n=ja(a);n.tag=2,t!=null&&(n.callback=t),t=za(e,n,a),t!==null&&(vt(t,e,a),Fl(t,e,a))}};function Ef(e,t,a,n,r,c,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,c,h):t.prototype&&t.prototype.isPureReactComponent?!Ll(a,n)||!Ll(r,c):!0}function Tf(e,t,a,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&kr.enqueueReplaceState(t,t.state,null)}function hn(e,t){var a=t;if("ref"in t){a={};for(var n in t)n!=="ref"&&(a[n]=t[n])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var r in e)a[r]===void 0&&(a[r]=e[r])}return a}function Nf(e){Zi(e)}function _f(e){console.error(e)}function Cf(e){Zi(e)}function So(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function wf(e,t,a){try{var n=e.onCaughtError;n(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Gr(e,t,a){return a=ja(a),a.tag=3,a.payload={element:null},a.callback=function(){So(e,t)},a}function Af(e){return e=ja(e),e.tag=3,e}function Mf(e,t,a,n){var r=a.type.getDerivedStateFromError;if(typeof r=="function"){var c=n.value;e.payload=function(){return r(c)},e.callback=function(){wf(t,a,n)}}var h=a.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){wf(t,a,n),typeof r!="function"&&(ka===null?ka=new Set([this]):ka.add(this));var v=n.stack;this.componentDidCatch(n.value,{componentStack:v!==null?v:""})})}function Qy(e,t,a,n,r){if(a.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=a.alternate,t!==null&&Yn(t,a,r,!0),a=Tt.current,a!==null){switch(a.tag){case 31:case 13:return Lt===null?jo():a.alternate===null&&Be===0&&(Be=3),a.flags&=-257,a.flags|=65536,a.lanes=r,n===oo?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([n]):t.add(n),dc(e,n,r)),!1;case 22:return a.flags|=65536,n===oo?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([n]):a.add(n)),dc(e,n,r)),!1}throw Error(o(435,a.tag))}return dc(e,n,r),jo(),!1}if(ve)return t=Tt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,n!==ir&&(e=Error(o(422),{cause:n}),kl(jt(e,a)))):(n!==ir&&(t=Error(o(423),{cause:n}),kl(jt(t,a))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,n=jt(n,a),r=Gr(e.stateNode,n,r),gr(e,r),Be!==4&&(Be=2)),!1;var c=Error(o(520),{cause:n});if(c=jt(c,a),li===null?li=[c]:li.push(c),Be!==4&&(Be=2),t===null)return!0;n=jt(n,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=r&-r,a.lanes|=e,e=Gr(a.stateNode,n,e),gr(a,e),!1;case 1:if(t=a.type,c=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(ka===null||!ka.has(c))))return a.flags|=65536,r&=-r,a.lanes|=r,r=Af(r),Mf(r,e,a,n),gr(a,r),!1}a=a.return}while(a!==null);return!1}var Ur=Error(o(461)),Xe=!1;function lt(e,t,a,n){t.child=e===null?jd(t,null,a,n):mn(t,e.child,a,n)}function Rf(e,t,a,n,r){a=a.render;var c=t.ref;if("ref"in n){var h={};for(var v in n)v!=="ref"&&(h[v]=n[v])}else h=n;return cn(t),n=Er(e,t,a,h,c,r),v=Tr(),e!==null&&!Xe?(Nr(e,t,r),ma(e,t,r)):(ve&&v&&nr(t),t.flags|=1,lt(e,t,n,r),t.child)}function Of(e,t,a,n,r){if(e===null){var c=a.type;return typeof c=="function"&&!er(c)&&c.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=c,jf(e,t,c,n,r)):(e=eo(a.type,null,n,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Qr(e,r)){var h=c.memoizedProps;if(a=a.compare,a=a!==null?a:Ll,a(h,n)&&e.ref===t.ref)return ma(e,t,r)}return t.flags|=1,e=sa(c,n),e.ref=t.ref,e.return=t,t.child=e}function jf(e,t,a,n,r){if(e!==null){var c=e.memoizedProps;if(Ll(c,n)&&e.ref===t.ref)if(Xe=!1,t.pendingProps=n=c,Qr(e,r))(e.flags&131072)!==0&&(Xe=!0);else return t.lanes=e.lanes,ma(e,t,r)}return Br(e,t,a,n,r)}function zf(e,t,a,n){var r=n.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|a:a,e!==null){for(n=t.child=e.child,r=0;n!==null;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~c}else n=0,t.child=null;return If(e,t,c,a,n)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&lo(t,c!==null?c.cachePool:null),c!==null?Dd(t,c):vr(),Ld(t);else return n=t.lanes=536870912,If(e,t,c!==null?c.baseLanes|a:a,a,n)}else c!==null?(lo(t,c.cachePool),Dd(t,c),Da(),t.memoizedState=null):(e!==null&&lo(t,null),vr(),Da());return lt(e,t,r,a),t.child}function Jl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function If(e,t,a,n,r){var c=fr();return c=c===null?null:{parent:Ke._currentValue,pool:c},t.memoizedState={baseLanes:a,cachePool:c},e!==null&&lo(t,null),vr(),Ld(t),e!==null&&Yn(e,t,n,!0),t.childLanes=r,null}function xo(e,t){return t=To({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Df(e,t,a){return mn(t,e.child,null,a),e=xo(t,t.pendingProps),e.flags|=2,Nt(t),t.memoizedState=null,e}function Zy(e,t,a){var n=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ve){if(n.mode==="hidden")return e=xo(t,n),t.lanes=536870912,Jl(null,e);if(Sr(t),(e=De)?(e=Vm(e,Dt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wa!==null?{id:Xt,overflow:Qt}:null,retryLane:536870912,hydrationErrors:null},a=yd(e),a.return=t,t.child=a,at=t,De=null)):e=null,e===null)throw Ma(t);return t.lanes=536870912,null}return xo(t,n)}var c=e.memoizedState;if(c!==null){var h=c.dehydrated;if(Sr(t),r)if(t.flags&256)t.flags&=-257,t=Df(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Xe||Yn(e,t,a,!1),r=(a&e.childLanes)!==0,Xe||r){if(n=ze,n!==null&&(h=Nu(n,a),h!==0&&h!==c.retryLane))throw c.retryLane=h,ln(e,h),vt(n,e,h),Ur;jo(),t=Df(e,t,a)}else e=c.treeContext,De=qt(h.nextSibling),at=t,ve=!0,Aa=null,Dt=!1,e!==null&&Sd(t,e),t=xo(t,n),t.flags|=4096;return t}return e=sa(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Eo(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(o(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Br(e,t,a,n,r){return cn(t),a=Er(e,t,a,n,void 0,r),n=Tr(),e!==null&&!Xe?(Nr(e,t,r),ma(e,t,r)):(ve&&n&&nr(t),t.flags|=1,lt(e,t,a,r),t.child)}function Lf(e,t,a,n,r,c){return cn(t),t.updateQueue=null,a=Hd(t,n,a,r),qd(e),n=Tr(),e!==null&&!Xe?(Nr(e,t,c),ma(e,t,c)):(ve&&n&&nr(t),t.flags|=1,lt(e,t,a,c),t.child)}function qf(e,t,a,n,r){if(cn(t),t.stateNode===null){var c=Un,h=a.contextType;typeof h=="object"&&h!==null&&(c=nt(h)),c=new a(n,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=kr,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=n,c.state=t.memoizedState,c.refs={},pr(t),h=a.contextType,c.context=typeof h=="object"&&h!==null?nt(h):Un,c.state=t.memoizedState,h=a.getDerivedStateFromProps,typeof h=="function"&&(Hr(t,a,h,n),c.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(h=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),h!==c.state&&kr.enqueueReplaceState(c,c.state,null),Kl(t,n,c,r),Yl(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){c=t.stateNode;var v=t.memoizedProps,T=hn(a,v);c.props=T;var z=c.context,k=a.contextType;h=Un,typeof k=="object"&&k!==null&&(h=nt(k));var U=a.getDerivedStateFromProps;k=typeof U=="function"||typeof c.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,k||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(v||z!==h)&&Tf(t,c,n,h),Oa=!1;var D=t.memoizedState;c.state=D,Kl(t,n,c,r),Yl(),z=t.memoizedState,v||D!==z||Oa?(typeof U=="function"&&(Hr(t,a,U,n),z=t.memoizedState),(T=Oa||Ef(t,a,T,n,D,z,h))?(k||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=z),c.props=n,c.state=z,c.context=h,n=T):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{c=t.stateNode,hr(e,t),h=t.memoizedProps,k=hn(a,h),c.props=k,U=t.pendingProps,D=c.context,z=a.contextType,T=Un,typeof z=="object"&&z!==null&&(T=nt(z)),v=a.getDerivedStateFromProps,(z=typeof v=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(h!==U||D!==T)&&Tf(t,c,n,T),Oa=!1,D=t.memoizedState,c.state=D,Kl(t,n,c,r),Yl();var q=t.memoizedState;h!==U||D!==q||Oa||e!==null&&e.dependencies!==null&&ao(e.dependencies)?(typeof v=="function"&&(Hr(t,a,v,n),q=t.memoizedState),(k=Oa||Ef(t,a,k,n,D,q,T)||e!==null&&e.dependencies!==null&&ao(e.dependencies))?(z||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(n,q,T),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(n,q,T)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||h===e.memoizedProps&&D===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&D===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=q),c.props=n,c.state=q,c.context=T,n=k):(typeof c.componentDidUpdate!="function"||h===e.memoizedProps&&D===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&D===e.memoizedState||(t.flags|=1024),n=!1)}return c=n,Eo(e,t),n=(t.flags&128)!==0,c||n?(c=t.stateNode,a=n&&typeof a.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&n?(t.child=mn(t,e.child,null,r),t.child=mn(t,null,a,r)):lt(e,t,a,r),t.memoizedState=c.state,e=t.child):e=ma(e,t,r),e}function Hf(e,t,a,n){return sn(),t.flags|=256,lt(e,t,a,n),t.child}var Pr={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fr(e){return{baseLanes:e,cachePool:Cd()}}function Yr(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Ct),e}function kf(e,t,a){var n=t.pendingProps,r=!1,c=(t.flags&128)!==0,h;if((h=c)||(h=e!==null&&e.memoizedState===null?!1:(Pe.current&2)!==0),h&&(r=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(ve){if(r?Ia(t):Da(),(e=De)?(e=Vm(e,Dt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wa!==null?{id:Xt,overflow:Qt}:null,retryLane:536870912,hydrationErrors:null},a=yd(e),a.return=t,t.child=a,at=t,De=null)):e=null,e===null)throw Ma(t);return wc(e)?t.lanes=32:t.lanes=536870912,null}var v=n.children;return n=n.fallback,r?(Da(),r=t.mode,v=To({mode:"hidden",children:v},r),n=on(n,r,a,null),v.return=t,n.return=t,v.sibling=n,t.child=v,n=t.child,n.memoizedState=Fr(a),n.childLanes=Yr(e,h,a),t.memoizedState=Pr,Jl(null,n)):(Ia(t),Kr(t,v))}var T=e.memoizedState;if(T!==null&&(v=T.dehydrated,v!==null)){if(c)t.flags&256?(Ia(t),t.flags&=-257,t=Vr(e,t,a)):t.memoizedState!==null?(Da(),t.child=e.child,t.flags|=128,t=null):(Da(),v=n.fallback,r=t.mode,n=To({mode:"visible",children:n.children},r),v=on(v,r,a,null),v.flags|=2,n.return=t,v.return=t,n.sibling=v,t.child=n,mn(t,e.child,null,a),n=t.child,n.memoizedState=Fr(a),n.childLanes=Yr(e,h,a),t.memoizedState=Pr,t=Jl(null,n));else if(Ia(t),wc(v)){if(h=v.nextSibling&&v.nextSibling.dataset,h)var z=h.dgst;h=z,n=Error(o(419)),n.stack="",n.digest=h,kl({value:n,source:null,stack:null}),t=Vr(e,t,a)}else if(Xe||Yn(e,t,a,!1),h=(a&e.childLanes)!==0,Xe||h){if(h=ze,h!==null&&(n=Nu(h,a),n!==0&&n!==T.retryLane))throw T.retryLane=n,ln(e,n),vt(h,e,n),Ur;Cc(v)||jo(),t=Vr(e,t,a)}else Cc(v)?(t.flags|=192,t.child=e.child,t=null):(e=T.treeContext,De=qt(v.nextSibling),at=t,ve=!0,Aa=null,Dt=!1,e!==null&&Sd(t,e),t=Kr(t,n.children),t.flags|=4096);return t}return r?(Da(),v=n.fallback,r=t.mode,T=e.child,z=T.sibling,n=sa(T,{mode:"hidden",children:n.children}),n.subtreeFlags=T.subtreeFlags&65011712,z!==null?v=sa(z,v):(v=on(v,r,a,null),v.flags|=2),v.return=t,n.return=t,n.sibling=v,t.child=n,Jl(null,n),n=t.child,v=e.child.memoizedState,v===null?v=Fr(a):(r=v.cachePool,r!==null?(T=Ke._currentValue,r=r.parent!==T?{parent:T,pool:T}:r):r=Cd(),v={baseLanes:v.baseLanes|a,cachePool:r}),n.memoizedState=v,n.childLanes=Yr(e,h,a),t.memoizedState=Pr,Jl(e.child,n)):(Ia(t),a=e.child,e=a.sibling,a=sa(a,{mode:"visible",children:n.children}),a.return=t,a.sibling=null,e!==null&&(h=t.deletions,h===null?(t.deletions=[e],t.flags|=16):h.push(e)),t.child=a,t.memoizedState=null,a)}function Kr(e,t){return t=To({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function To(e,t){return e=Et(22,e,null,t),e.lanes=0,e}function Vr(e,t,a){return mn(t,e.child,null,a),e=Kr(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gf(e,t,a){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),rr(e.return,t,a)}function Xr(e,t,a,n,r,c){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:r,treeForkCount:c}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=n,h.tail=a,h.tailMode=r,h.treeForkCount=c)}function Uf(e,t,a){var n=t.pendingProps,r=n.revealOrder,c=n.tail;n=n.children;var h=Pe.current,v=(h&2)!==0;if(v?(h=h&1|2,t.flags|=128):h&=1,F(Pe,h),lt(e,t,n,a),n=ve?Hl:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gf(e,a,t);else if(e.tag===19)Gf(e,a,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}switch(r){case"forwards":for(a=t.child,r=null;a!==null;)e=a.alternate,e!==null&&uo(e)===null&&(r=a),a=a.sibling;a=r,a===null?(r=t.child,t.child=null):(r=a.sibling,a.sibling=null),Xr(t,!1,r,a,c,n);break;case"backwards":case"unstable_legacy-backwards":for(a=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&uo(e)===null){t.child=r;break}e=r.sibling,r.sibling=a,a=r,r=e}Xr(t,!0,a,null,c,n);break;case"together":Xr(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function ma(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ha|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Yn(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,a=sa(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=sa(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Qr(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ao(e)))}function Jy(e,t,a){switch(t.tag){case 3:Je(t,t.stateNode.containerInfo),Ra(t,Ke,e.memoizedState.cache),sn();break;case 27:case 5:$a(t);break;case 4:Je(t,t.stateNode.containerInfo);break;case 10:Ra(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Sr(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Ia(t),t.flags|=128,null):(a&t.child.childLanes)!==0?kf(e,t,a):(Ia(t),e=ma(e,t,a),e!==null?e.sibling:null);Ia(t);break;case 19:var r=(e.flags&128)!==0;if(n=(a&t.childLanes)!==0,n||(Yn(e,t,a,!1),n=(a&t.childLanes)!==0),r){if(n)return Uf(e,t,a);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),F(Pe,Pe.current),n)break;return null;case 22:return t.lanes=0,zf(e,t,a,t.pendingProps);case 24:Ra(t,Ke,e.memoizedState.cache)}return ma(e,t,a)}function Bf(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xe=!0;else{if(!Qr(e,a)&&(t.flags&128)===0)return Xe=!1,Jy(e,t,a);Xe=(e.flags&131072)!==0}else Xe=!1,ve&&(t.flags&1048576)!==0&&bd(t,Hl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=dn(t.elementType),t.type=e,typeof e=="function")er(e)?(n=hn(e,n),t.tag=1,t=qf(null,t,e,n,a)):(t.tag=0,t=Br(null,t,e,n,a));else{if(e!=null){var r=e.$$typeof;if(r===j){t.tag=11,t=Rf(null,t,e,n,a);break e}else if(r===$){t.tag=14,t=Of(null,t,e,n,a);break e}}throw t=Ye(e)||e,Error(o(306,t,""))}}return t;case 0:return Br(e,t,t.type,t.pendingProps,a);case 1:return n=t.type,r=hn(n,t.pendingProps),qf(e,t,n,r,a);case 3:e:{if(Je(t,t.stateNode.containerInfo),e===null)throw Error(o(387));n=t.pendingProps;var c=t.memoizedState;r=c.element,hr(e,t),Kl(t,n,null,a);var h=t.memoizedState;if(n=h.cache,Ra(t,Ke,n),n!==c.cache&&cr(t,[Ke],a,!0),Yl(),n=h.element,c.isDehydrated)if(c={element:n,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Hf(e,t,n,a);break e}else if(n!==r){r=jt(Error(o(424)),t),kl(r),t=Hf(e,t,n,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,De=qt(e.firstChild),at=t,ve=!0,Aa=null,Dt=!0,a=jd(t,null,n,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(sn(),n===r){t=ma(e,t,a);break e}lt(e,t,n,a)}t=t.child}return t;case 26:return Eo(e,t),e===null?(a=Wm(t.type,null,t.pendingProps,null))?t.memoizedState=a:ve||(a=t.type,e=t.pendingProps,n=ko(se.current).createElement(a),n[tt]=t,n[ft]=e,it(n,a,e),$e(n),t.stateNode=n):t.memoizedState=Wm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return $a(t),e===null&&ve&&(n=t.stateNode=Zm(t.type,t.pendingProps,se.current),at=t,Dt=!0,r=De,Pa(t.type)?(Ac=r,De=qt(n.firstChild)):De=r),lt(e,t,t.pendingProps.children,a),Eo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ve&&((r=n=De)&&(n=wv(n,t.type,t.pendingProps,Dt),n!==null?(t.stateNode=n,at=t,De=qt(n.firstChild),Dt=!1,r=!0):r=!1),r||Ma(t)),$a(t),r=t.type,c=t.pendingProps,h=e!==null?e.memoizedProps:null,n=c.children,Tc(r,c)?n=null:h!==null&&Tc(r,h)&&(t.flags|=32),t.memoizedState!==null&&(r=Er(e,t,By,null,null,a),fi._currentValue=r),Eo(e,t),lt(e,t,n,a),t.child;case 6:return e===null&&ve&&((e=a=De)&&(a=Av(a,t.pendingProps,Dt),a!==null?(t.stateNode=a,at=t,De=null,e=!0):e=!1),e||Ma(t)),null;case 13:return kf(e,t,a);case 4:return Je(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=mn(t,null,n,a):lt(e,t,n,a),t.child;case 11:return Rf(e,t,t.type,t.pendingProps,a);case 7:return lt(e,t,t.pendingProps,a),t.child;case 8:return lt(e,t,t.pendingProps.children,a),t.child;case 12:return lt(e,t,t.pendingProps.children,a),t.child;case 10:return n=t.pendingProps,Ra(t,t.type,n.value),lt(e,t,n.children,a),t.child;case 9:return r=t.type._context,n=t.pendingProps.children,cn(t),r=nt(r),n=n(r),t.flags|=1,lt(e,t,n,a),t.child;case 14:return Of(e,t,t.type,t.pendingProps,a);case 15:return jf(e,t,t.type,t.pendingProps,a);case 19:return Uf(e,t,a);case 31:return Zy(e,t,a);case 22:return zf(e,t,a,t.pendingProps);case 24:return cn(t),n=nt(Ke),e===null?(r=fr(),r===null&&(r=ze,c=ur(),r.pooledCache=c,c.refCount++,c!==null&&(r.pooledCacheLanes|=a),r=c),t.memoizedState={parent:n,cache:r},pr(t),Ra(t,Ke,r)):((e.lanes&a)!==0&&(hr(e,t),Kl(t,null,null,a),Yl()),r=e.memoizedState,c=t.memoizedState,r.parent!==n?(r={parent:n,cache:n},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Ra(t,Ke,n)):(n=c.cache,Ra(t,Ke,n),n!==r.cache&&cr(t,[Ke],a,!0))),lt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function pa(e){e.flags|=4}function Zr(e,t,a,n,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(hm())e.flags|=8192;else throw fn=oo,mr}else e.flags&=-16777217}function Pf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!lp(t))if(hm())e.flags|=8192;else throw fn=oo,mr}function No(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?xu():536870912,e.lanes|=t,nl|=t)}function $l(e,t){if(!ve)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Le(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,n=0;if(t)for(var r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags&65011712,n|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=a,t}function $y(e,t,a){var n=t.pendingProps;switch(lr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Le(t),null;case 1:return Le(t),null;case 3:return a=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ua(Ke),qe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Fn(t)?pa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,or())),Le(t),null;case 26:var r=t.type,c=t.memoizedState;return e===null?(pa(t),c!==null?(Le(t),Pf(t,c)):(Le(t),Zr(t,r,null,n,a))):c?c!==e.memoizedState?(pa(t),Le(t),Pf(t,c)):(Le(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&pa(t),Le(t),Zr(t,r,e,n,a)),null;case 27:if(Cn(t),a=se.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&pa(t);else{if(!n){if(t.stateNode===null)throw Error(o(166));return Le(t),null}e=Z.current,Fn(t)?xd(t):(e=Zm(r,n,a),t.stateNode=e,pa(t))}return Le(t),null;case 5:if(Cn(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&pa(t);else{if(!n){if(t.stateNode===null)throw Error(o(166));return Le(t),null}if(c=Z.current,Fn(t))xd(t);else{var h=ko(se.current);switch(c){case 1:c=h.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:c=h.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":c=h.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":c=h.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":c=h.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof n.is=="string"?h.createElement("select",{is:n.is}):h.createElement("select"),n.multiple?c.multiple=!0:n.size&&(c.size=n.size);break;default:c=typeof n.is=="string"?h.createElement(r,{is:n.is}):h.createElement(r)}}c[tt]=t,c[ft]=n;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)c.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=c;e:switch(it(c,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&pa(t)}}return Le(t),Zr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&pa(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(o(166));if(e=se.current,Fn(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,r=at,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[tt]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||km(e.nodeValue,a)),e||Ma(t,!0)}else e=ko(e).createTextNode(n),e[tt]=t,t.stateNode=e}return Le(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=Fn(t),a!==null){if(e===null){if(!n)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[tt]=t}else sn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Le(t),e=!1}else a=or(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Nt(t),t):(Nt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Le(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Fn(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(o(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(317));r[tt]=t}else sn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Le(t),r=!1}else r=or(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Nt(t),t):(Nt(t),null)}return Nt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==r&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),No(t,t.updateQueue),Le(t),null);case 4:return qe(),e===null&&vc(t.stateNode.containerInfo),Le(t),null;case 10:return ua(t.type),Le(t),null;case 19:if(N(Pe),n=t.memoizedState,n===null)return Le(t),null;if(r=(t.flags&128)!==0,c=n.rendering,c===null)if(r)$l(n,!1);else{if(Be!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=uo(e),c!==null){for(t.flags|=128,$l(n,!1),e=c.updateQueue,t.updateQueue=e,No(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)gd(a,e),a=a.sibling;return F(Pe,Pe.current&1|2),ve&&ra(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&He()>Mo&&(t.flags|=128,r=!0,$l(n,!1),t.lanes=4194304)}else{if(!r)if(e=uo(c),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,No(t,e),$l(n,!0),n.tail===null&&n.tailMode==="hidden"&&!c.alternate&&!ve)return Le(t),null}else 2*He()-n.renderingStartTime>Mo&&a!==536870912&&(t.flags|=128,r=!0,$l(n,!1),t.lanes=4194304);n.isBackwards?(c.sibling=t.child,t.child=c):(e=n.last,e!==null?e.sibling=c:t.child=c,n.last=c)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=He(),e.sibling=null,a=Pe.current,F(Pe,r?a&1|2:a&1),ve&&ra(t,n.treeForkCount),e):(Le(t),null);case 22:case 23:return Nt(t),br(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Le(t),t.subtreeFlags&6&&(t.flags|=8192)):Le(t),a=t.updateQueue,a!==null&&No(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&N(un),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ua(Ke),Le(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Wy(e,t){switch(lr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ua(Ke),qe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Cn(t),null;case 31:if(t.memoizedState!==null){if(Nt(t),t.alternate===null)throw Error(o(340));sn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Nt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));sn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(Pe),null;case 4:return qe(),null;case 10:return ua(t.type),null;case 22:case 23:return Nt(t),br(),e!==null&&N(un),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ua(Ke),null;case 25:return null;default:return null}}function Ff(e,t){switch(lr(t),t.tag){case 3:ua(Ke),qe();break;case 26:case 27:case 5:Cn(t);break;case 4:qe();break;case 31:t.memoizedState!==null&&Nt(t);break;case 13:Nt(t);break;case 19:N(Pe);break;case 10:ua(t.type);break;case 22:case 23:Nt(t),br(),e!==null&&N(un);break;case 24:ua(Ke)}}function Wl(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var r=n.next;a=r;do{if((a.tag&e)===e){n=void 0;var c=a.create,h=a.inst;n=c(),h.destroy=n}a=a.next}while(a!==r)}}catch(v){Me(t,t.return,v)}}function La(e,t,a){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var c=r.next;n=c;do{if((n.tag&e)===e){var h=n.inst,v=h.destroy;if(v!==void 0){h.destroy=void 0,r=t;var T=a,z=v;try{z()}catch(k){Me(r,T,k)}}}n=n.next}while(n!==c)}}catch(k){Me(t,t.return,k)}}function Yf(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Id(t,a)}catch(n){Me(e,e.return,n)}}}function Kf(e,t,a){a.props=hn(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){Me(e,t,n)}}function ei(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(r){Me(e,t,r)}}function Zt(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(r){Me(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(r){Me(e,t,r)}else a.current=null}function Vf(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(r){Me(e,e.return,r)}}function Jr(e,t,a){try{var n=e.stateNode;xv(n,e.type,a,t),n[ft]=t}catch(r){Me(e,e.return,r)}}function Xf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Pa(e.type)||e.tag===4}function $r(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xf(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.tag===27&&Pa(e.type)||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 Wr(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=ia));else if(n!==4&&(n===27&&Pa(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Wr(e,t,a),e=e.sibling;e!==null;)Wr(e,t,a),e=e.sibling}function _o(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&Pa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(_o(e,t,a),e=e.sibling;e!==null;)_o(e,t,a),e=e.sibling}function Qf(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);it(t,n,a),t[tt]=e,t[ft]=a}catch(c){Me(e,e.return,c)}}var ha=!1,Qe=!1,ec=!1,Zf=typeof WeakSet=="function"?WeakSet:Set,We=null;function ev(e,t){if(e=e.containerInfo,xc=Ko,e=sd(e),Vs(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var r=n.anchorOffset,c=n.focusNode;n=n.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var h=0,v=-1,T=-1,z=0,k=0,U=e,D=null;t:for(;;){for(var q;U!==a||r!==0&&U.nodeType!==3||(v=h+r),U!==c||n!==0&&U.nodeType!==3||(T=h+n),U.nodeType===3&&(h+=U.nodeValue.length),(q=U.firstChild)!==null;)D=U,U=q;for(;;){if(U===e)break t;if(D===a&&++z===r&&(v=h),D===c&&++k===n&&(T=h),(q=U.nextSibling)!==null)break;U=D,D=U.parentNode}U=q}a=v===-1||T===-1?null:{start:v,end:T}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ec={focusedElem:e,selectionRange:a},Ko=!1,We=t;We!==null;)if(t=We,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,We=e;else for(;We!==null;){switch(t=We,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)r=e[a],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,a=t,r=c.memoizedProps,c=c.memoizedState,n=a.stateNode;try{var ee=hn(a.type,r);e=n.getSnapshotBeforeUpdate(ee,c),n.__reactInternalSnapshotBeforeUpdate=e}catch(oe){Me(a,a.return,oe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)_c(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":_c(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,We=e;break}We=t.return}}function Jf(e,t,a){var n=a.flags;switch(a.tag){case 0:case 11:case 15:ya(e,a),n&4&&Wl(5,a);break;case 1:if(ya(e,a),n&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(h){Me(a,a.return,h)}else{var r=hn(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){Me(a,a.return,h)}}n&64&&Yf(a),n&512&&ei(a,a.return);break;case 3:if(ya(e,a),n&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Id(e,t)}catch(h){Me(a,a.return,h)}}break;case 27:t===null&&n&4&&Qf(a);case 26:case 5:ya(e,a),t===null&&n&4&&Vf(a),n&512&&ei(a,a.return);break;case 12:ya(e,a);break;case 31:ya(e,a),n&4&&em(e,a);break;case 13:ya(e,a),n&4&&tm(e,a),n&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=cv.bind(null,a),Mv(e,a))));break;case 22:if(n=a.memoizedState!==null||ha,!n){t=t!==null&&t.memoizedState!==null||Qe,r=ha;var c=Qe;ha=n,(Qe=t)&&!c?va(e,a,(a.subtreeFlags&8772)!==0):ya(e,a),ha=r,Qe=c}break;case 30:break;default:ya(e,a)}}function $f(e){var t=e.alternate;t!==null&&(e.alternate=null,$f(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Rs(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ke=null,pt=!1;function ga(e,t,a){for(a=a.child;a!==null;)Wf(e,t,a),a=a.sibling}function Wf(e,t,a){if(bt&&typeof bt.onCommitFiberUnmount=="function")try{bt.onCommitFiberUnmount(Nl,a)}catch{}switch(a.tag){case 26:Qe||Zt(a,t),ga(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Qe||Zt(a,t);var n=ke,r=pt;Pa(a.type)&&(ke=a.stateNode,pt=!1),ga(e,t,a),ci(a.stateNode),ke=n,pt=r;break;case 5:Qe||Zt(a,t);case 6:if(n=ke,r=pt,ke=null,ga(e,t,a),ke=n,pt=r,ke!==null)if(pt)try{(ke.nodeType===9?ke.body:ke.nodeName==="HTML"?ke.ownerDocument.body:ke).removeChild(a.stateNode)}catch(c){Me(a,t,c)}else try{ke.removeChild(a.stateNode)}catch(c){Me(a,t,c)}break;case 18:ke!==null&&(pt?(e=ke,Ym(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),dl(e)):Ym(ke,a.stateNode));break;case 4:n=ke,r=pt,ke=a.stateNode.containerInfo,pt=!0,ga(e,t,a),ke=n,pt=r;break;case 0:case 11:case 14:case 15:La(2,a,t),Qe||La(4,a,t),ga(e,t,a);break;case 1:Qe||(Zt(a,t),n=a.stateNode,typeof n.componentWillUnmount=="function"&&Kf(a,t,n)),ga(e,t,a);break;case 21:ga(e,t,a);break;case 22:Qe=(n=Qe)||a.memoizedState!==null,ga(e,t,a),Qe=n;break;default:ga(e,t,a)}}function em(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dl(e)}catch(a){Me(t,t.return,a)}}}function tm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dl(e)}catch(a){Me(t,t.return,a)}}function tv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zf),t;default:throw Error(o(435,e.tag))}}function Co(e,t){var a=tv(e);t.forEach(function(n){if(!a.has(n)){a.add(n);var r=uv.bind(null,e,n);n.then(r,r)}})}function ht(e,t){var a=t.deletions;if(a!==null)for(var n=0;n<a.length;n++){var r=a[n],c=e,h=t,v=h;e:for(;v!==null;){switch(v.tag){case 27:if(Pa(v.type)){ke=v.stateNode,pt=!1;break e}break;case 5:ke=v.stateNode,pt=!1;break e;case 3:case 4:ke=v.stateNode.containerInfo,pt=!0;break e}v=v.return}if(ke===null)throw Error(o(160));Wf(c,h,r),ke=null,pt=!1,c=r.alternate,c!==null&&(c.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)am(t,e),t=t.sibling}var Ut=null;function am(e,t){var a=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ht(t,e),gt(e),n&4&&(La(3,e,e.return),Wl(3,e),La(5,e,e.return));break;case 1:ht(t,e),gt(e),n&512&&(Qe||a===null||Zt(a,a.return)),n&64&&ha&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:var r=Ut;if(ht(t,e),gt(e),n&512&&(Qe||a===null||Zt(a,a.return)),n&4){var c=a!==null?a.memoizedState:null;if(n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null){e:{n=e.type,a=e.memoizedProps,r=r.ownerDocument||r;t:switch(n){case"title":c=r.getElementsByTagName("title")[0],(!c||c[wl]||c[tt]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=r.createElement(n),r.head.insertBefore(c,r.querySelector("head > title"))),it(c,n,a),c[tt]=e,$e(c),n=c;break e;case"link":var h=ap("link","href",r).get(n+(a.href||""));if(h){for(var v=0;v<h.length;v++)if(c=h[v],c.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&c.getAttribute("rel")===(a.rel==null?null:a.rel)&&c.getAttribute("title")===(a.title==null?null:a.title)&&c.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){h.splice(v,1);break t}}c=r.createElement(n),it(c,n,a),r.head.appendChild(c);break;case"meta":if(h=ap("meta","content",r).get(n+(a.content||""))){for(v=0;v<h.length;v++)if(c=h[v],c.getAttribute("content")===(a.content==null?null:""+a.content)&&c.getAttribute("name")===(a.name==null?null:a.name)&&c.getAttribute("property")===(a.property==null?null:a.property)&&c.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&c.getAttribute("charset")===(a.charSet==null?null:a.charSet)){h.splice(v,1);break t}}c=r.createElement(n),it(c,n,a),r.head.appendChild(c);break;default:throw Error(o(468,n))}c[tt]=e,$e(c),n=c}e.stateNode=n}else np(r,e.type,e.stateNode);else e.stateNode=tp(r,n,e.memoizedProps);else c!==n?(c===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):c.count--,n===null?np(r,e.type,e.stateNode):tp(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&Jr(e,e.memoizedProps,a.memoizedProps)}break;case 27:ht(t,e),gt(e),n&512&&(Qe||a===null||Zt(a,a.return)),a!==null&&n&4&&Jr(e,e.memoizedProps,a.memoizedProps);break;case 5:if(ht(t,e),gt(e),n&512&&(Qe||a===null||Zt(a,a.return)),e.flags&32){r=e.stateNode;try{In(r,"")}catch(ee){Me(e,e.return,ee)}}n&4&&e.stateNode!=null&&(r=e.memoizedProps,Jr(e,r,a!==null?a.memoizedProps:r)),n&1024&&(ec=!0);break;case 6:if(ht(t,e),gt(e),n&4){if(e.stateNode===null)throw Error(o(162));n=e.memoizedProps,a=e.stateNode;try{a.nodeValue=n}catch(ee){Me(e,e.return,ee)}}break;case 3:if(Bo=null,r=Ut,Ut=Go(t.containerInfo),ht(t,e),Ut=r,gt(e),n&4&&a!==null&&a.memoizedState.isDehydrated)try{dl(t.containerInfo)}catch(ee){Me(e,e.return,ee)}ec&&(ec=!1,nm(e));break;case 4:n=Ut,Ut=Go(e.stateNode.containerInfo),ht(t,e),gt(e),Ut=n;break;case 12:ht(t,e),gt(e);break;case 31:ht(t,e),gt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Co(e,n)));break;case 13:ht(t,e),gt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Ao=He()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Co(e,n)));break;case 22:r=e.memoizedState!==null;var T=a!==null&&a.memoizedState!==null,z=ha,k=Qe;if(ha=z||r,Qe=k||T,ht(t,e),Qe=k,ha=z,gt(e),n&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(a===null||T||ha||Qe||gn(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){T=a=t;try{if(c=T.stateNode,r)h=c.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{v=T.stateNode;var U=T.memoizedProps.style,D=U!=null&&U.hasOwnProperty("display")?U.display:null;v.style.display=D==null||typeof D=="boolean"?"":(""+D).trim()}}catch(ee){Me(T,T.return,ee)}}}else if(t.tag===6){if(a===null){T=t;try{T.stateNode.nodeValue=r?"":T.memoizedProps}catch(ee){Me(T,T.return,ee)}}}else if(t.tag===18){if(a===null){T=t;try{var q=T.stateNode;r?Km(q,!0):Km(T.stateNode,!1)}catch(ee){Me(T,T.return,ee)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,Co(e,a))));break;case 19:ht(t,e),gt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Co(e,n)));break;case 30:break;case 21:break;default:ht(t,e),gt(e)}}function gt(e){var t=e.flags;if(t&2){try{for(var a,n=e.return;n!==null;){if(Xf(n)){a=n;break}n=n.return}if(a==null)throw Error(o(160));switch(a.tag){case 27:var r=a.stateNode,c=$r(e);_o(e,c,r);break;case 5:var h=a.stateNode;a.flags&32&&(In(h,""),a.flags&=-33);var v=$r(e);_o(e,v,h);break;case 3:case 4:var T=a.stateNode.containerInfo,z=$r(e);Wr(e,z,T);break;default:throw Error(o(161))}}catch(k){Me(e,e.return,k)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function nm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;nm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ya(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Jf(e,t.alternate,t),t=t.sibling}function gn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:La(4,t,t.return),gn(t);break;case 1:Zt(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Kf(t,t.return,a),gn(t);break;case 27:ci(t.stateNode);case 26:case 5:Zt(t,t.return),gn(t);break;case 22:t.memoizedState===null&&gn(t);break;case 30:gn(t);break;default:gn(t)}e=e.sibling}}function va(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,r=e,c=t,h=c.flags;switch(c.tag){case 0:case 11:case 15:va(r,c,a),Wl(4,c);break;case 1:if(va(r,c,a),n=c,r=n.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(z){Me(n,n.return,z)}if(n=c,r=n.updateQueue,r!==null){var v=n.stateNode;try{var T=r.shared.hiddenCallbacks;if(T!==null)for(r.shared.hiddenCallbacks=null,r=0;r<T.length;r++)zd(T[r],v)}catch(z){Me(n,n.return,z)}}a&&h&64&&Yf(c),ei(c,c.return);break;case 27:Qf(c);case 26:case 5:va(r,c,a),a&&n===null&&h&4&&Vf(c),ei(c,c.return);break;case 12:va(r,c,a);break;case 31:va(r,c,a),a&&h&4&&em(r,c);break;case 13:va(r,c,a),a&&h&4&&tm(r,c);break;case 22:c.memoizedState===null&&va(r,c,a),ei(c,c.return);break;case 30:break;default:va(r,c,a)}t=t.sibling}}function tc(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Gl(a))}function ac(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gl(e))}function Bt(e,t,a,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)lm(e,t,a,n),t=t.sibling}function lm(e,t,a,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Bt(e,t,a,n),r&2048&&Wl(9,t);break;case 1:Bt(e,t,a,n);break;case 3:Bt(e,t,a,n),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gl(e)));break;case 12:if(r&2048){Bt(e,t,a,n),e=t.stateNode;try{var c=t.memoizedProps,h=c.id,v=c.onPostCommit;typeof v=="function"&&v(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(T){Me(t,t.return,T)}}else Bt(e,t,a,n);break;case 31:Bt(e,t,a,n);break;case 13:Bt(e,t,a,n);break;case 23:break;case 22:c=t.stateNode,h=t.alternate,t.memoizedState!==null?c._visibility&2?Bt(e,t,a,n):ti(e,t):c._visibility&2?Bt(e,t,a,n):(c._visibility|=2,el(e,t,a,n,(t.subtreeFlags&10256)!==0||!1)),r&2048&&tc(h,t);break;case 24:Bt(e,t,a,n),r&2048&&ac(t.alternate,t);break;default:Bt(e,t,a,n)}}function el(e,t,a,n,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,h=t,v=a,T=n,z=h.flags;switch(h.tag){case 0:case 11:case 15:el(c,h,v,T,r),Wl(8,h);break;case 23:break;case 22:var k=h.stateNode;h.memoizedState!==null?k._visibility&2?el(c,h,v,T,r):ti(c,h):(k._visibility|=2,el(c,h,v,T,r)),r&&z&2048&&tc(h.alternate,h);break;case 24:el(c,h,v,T,r),r&&z&2048&&ac(h.alternate,h);break;default:el(c,h,v,T,r)}t=t.sibling}}function ti(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,n=t,r=n.flags;switch(n.tag){case 22:ti(a,n),r&2048&&tc(n.alternate,n);break;case 24:ti(a,n),r&2048&&ac(n.alternate,n);break;default:ti(a,n)}t=t.sibling}}var ai=8192;function tl(e,t,a){if(e.subtreeFlags&ai)for(e=e.child;e!==null;)im(e,t,a),e=e.sibling}function im(e,t,a){switch(e.tag){case 26:tl(e,t,a),e.flags&ai&&e.memoizedState!==null&&Uv(a,Ut,e.memoizedState,e.memoizedProps);break;case 5:tl(e,t,a);break;case 3:case 4:var n=Ut;Ut=Go(e.stateNode.containerInfo),tl(e,t,a),Ut=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=ai,ai=16777216,tl(e,t,a),ai=n):tl(e,t,a));break;default:tl(e,t,a)}}function om(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ni(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];We=n,rm(n,e)}om(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sm(e),e=e.sibling}function sm(e){switch(e.tag){case 0:case 11:case 15:ni(e),e.flags&2048&&La(9,e,e.return);break;case 3:ni(e);break;case 12:ni(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,wo(e)):ni(e);break;default:ni(e)}}function wo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];We=n,rm(n,e)}om(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:La(8,t,t.return),wo(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,wo(t));break;default:wo(t)}e=e.sibling}}function rm(e,t){for(;We!==null;){var a=We;switch(a.tag){case 0:case 11:case 15:La(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var n=a.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Gl(a.memoizedState.cache)}if(n=a.child,n!==null)n.return=a,We=n;else e:for(a=e;We!==null;){n=We;var r=n.sibling,c=n.return;if($f(n),n===a){We=null;break e}if(r!==null){r.return=c,We=r;break e}We=c}}}var av={getCacheForType:function(e){var t=nt(Ke),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return nt(Ke).controller.signal}},nv=typeof WeakMap=="function"?WeakMap:Map,_e=0,ze=null,me=null,ge=0,Ae=0,_t=null,qa=!1,al=!1,nc=!1,ba=0,Be=0,Ha=0,yn=0,lc=0,Ct=0,nl=0,li=null,yt=null,ic=!1,Ao=0,cm=0,Mo=1/0,Ro=null,ka=null,Ze=0,Ga=null,ll=null,Sa=0,oc=0,sc=null,um=null,ii=0,rc=null;function wt(){return(_e&2)!==0&&ge!==0?ge&-ge:A.T!==null?pc():_u()}function dm(){if(Ct===0)if((ge&536870912)===0||ve){var e=qi;qi<<=1,(qi&3932160)===0&&(qi=262144),Ct=e}else Ct=536870912;return e=Tt.current,e!==null&&(e.flags|=32),Ct}function vt(e,t,a){(e===ze&&(Ae===2||Ae===9)||e.cancelPendingCommit!==null)&&(il(e,0),Ua(e,ge,Ct,!1)),Cl(e,a),((_e&2)===0||e!==ze)&&(e===ze&&((_e&2)===0&&(yn|=a),Be===4&&Ua(e,ge,Ct,!1)),Jt(e))}function fm(e,t,a){if((_e&6)!==0)throw Error(o(327));var n=!a&&(t&127)===0&&(t&e.expiredLanes)===0||_l(e,t),r=n?ov(e,t):uc(e,t,!0),c=n;do{if(r===0){al&&!n&&Ua(e,t,0,!1);break}else{if(a=e.current.alternate,c&&!lv(a)){r=uc(e,t,!1),c=!1;continue}if(r===2){if(c=t,e.errorRecoveryDisabledLanes&c)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var v=e;r=li;var T=v.current.memoizedState.isDehydrated;if(T&&(il(v,h).flags|=256),h=uc(v,h,!1),h!==2){if(nc&&!T){v.errorRecoveryDisabledLanes|=c,yn|=c,r=4;break e}c=yt,yt=r,c!==null&&(yt===null?yt=c:yt.push.apply(yt,c))}r=h}if(c=!1,r!==2)continue}}if(r===1){il(e,0),Ua(e,t,0,!0);break}e:{switch(n=e,c=r,c){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Ua(n,t,Ct,!qa);break e;case 2:yt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(r=Ao+300-He(),10<r)){if(Ua(n,t,Ct,!qa),ki(n,0,!0)!==0)break e;Sa=t,n.timeoutHandle=Pm(mm.bind(null,n,a,yt,Ro,ic,t,Ct,yn,nl,qa,c,"Throttled",-0,0),r);break e}mm(n,a,yt,Ro,ic,t,Ct,yn,nl,qa,c,null,-0,0)}}break}while(!0);Jt(e)}function mm(e,t,a,n,r,c,h,v,T,z,k,U,D,q){if(e.timeoutHandle=-1,U=t.subtreeFlags,U&8192||(U&16785408)===16785408){U={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ia},im(t,c,U);var ee=(c&62914560)===c?Ao-He():(c&4194048)===c?cm-He():0;if(ee=Bv(U,ee),ee!==null){Sa=c,e.cancelPendingCommit=ee(xm.bind(null,e,t,c,a,n,r,h,v,T,k,U,null,D,q)),Ua(e,c,h,!z);return}}xm(e,t,c,a,n,r,h,v,T)}function lv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var n=0;n<a.length;n++){var r=a[n],c=r.getSnapshot;r=r.value;try{if(!xt(c(),r))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 Ua(e,t,a,n){t&=~lc,t&=~yn,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var c=31-St(r),h=1<<c;n[c]=-1,r&=~h}a!==0&&Eu(e,a,t)}function Oo(){return(_e&6)===0?(oi(0),!1):!0}function cc(){if(me!==null){if(Ae===0)var e=me.return;else e=me,ca=rn=null,_r(e),Qn=null,Bl=0,e=me;for(;e!==null;)Ff(e.alternate,e),e=e.return;me=null}}function il(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Nv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Sa=0,cc(),ze=e,me=a=sa(e.current,null),ge=t,Ae=0,_t=null,qa=!1,al=_l(e,t),nc=!1,nl=Ct=lc=yn=Ha=Be=0,yt=li=null,ic=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-St(n),c=1<<r;t|=e[r],n&=~c}return ba=t,Ji(),a}function pm(e,t){ce=null,A.H=Zl,t===Xn||t===io?(t=Md(),Ae=3):t===mr?(t=Md(),Ae=4):Ae=t===Ur?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,_t=t,me===null&&(Be=1,So(e,jt(t,e.current)))}function hm(){var e=Tt.current;return e===null?!0:(ge&4194048)===ge?Lt===null:(ge&62914560)===ge||(ge&536870912)!==0?e===Lt:!1}function gm(){var e=A.H;return A.H=Zl,e===null?Zl:e}function ym(){var e=A.A;return A.A=av,e}function jo(){Be=4,qa||(ge&4194048)!==ge&&Tt.current!==null||(al=!0),(Ha&134217727)===0&&(yn&134217727)===0||ze===null||Ua(ze,ge,Ct,!1)}function uc(e,t,a){var n=_e;_e|=2;var r=gm(),c=ym();(ze!==e||ge!==t)&&(Ro=null,il(e,t)),t=!1;var h=Be;e:do try{if(Ae!==0&&me!==null){var v=me,T=_t;switch(Ae){case 8:cc(),h=6;break e;case 3:case 2:case 9:case 6:Tt.current===null&&(t=!0);var z=Ae;if(Ae=0,_t=null,ol(e,v,T,z),a&&al){h=0;break e}break;default:z=Ae,Ae=0,_t=null,ol(e,v,T,z)}}iv(),h=Be;break}catch(k){pm(e,k)}while(!0);return t&&e.shellSuspendCounter++,ca=rn=null,_e=n,A.H=r,A.A=c,me===null&&(ze=null,ge=0,Ji()),h}function iv(){for(;me!==null;)vm(me)}function ov(e,t){var a=_e;_e|=2;var n=gm(),r=ym();ze!==e||ge!==t?(Ro=null,Mo=He()+500,il(e,t)):al=_l(e,t);e:do try{if(Ae!==0&&me!==null){t=me;var c=_t;t:switch(Ae){case 1:Ae=0,_t=null,ol(e,t,c,1);break;case 2:case 9:if(wd(c)){Ae=0,_t=null,bm(t);break}t=function(){Ae!==2&&Ae!==9||ze!==e||(Ae=7),Jt(e)},c.then(t,t);break e;case 3:Ae=7;break e;case 4:Ae=5;break e;case 7:wd(c)?(Ae=0,_t=null,bm(t)):(Ae=0,_t=null,ol(e,t,c,7));break;case 5:var h=null;switch(me.tag){case 26:h=me.memoizedState;case 5:case 27:var v=me;if(h?lp(h):v.stateNode.complete){Ae=0,_t=null;var T=v.sibling;if(T!==null)me=T;else{var z=v.return;z!==null?(me=z,zo(z)):me=null}break t}}Ae=0,_t=null,ol(e,t,c,5);break;case 6:Ae=0,_t=null,ol(e,t,c,6);break;case 8:cc(),Be=6;break e;default:throw Error(o(462))}}sv();break}catch(k){pm(e,k)}while(!0);return ca=rn=null,A.H=n,A.A=r,_e=a,me!==null?0:(ze=null,ge=0,Ji(),Be)}function sv(){for(;me!==null&&!ut();)vm(me)}function vm(e){var t=Bf(e.alternate,e,ba);e.memoizedProps=e.pendingProps,t===null?zo(e):me=t}function bm(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Lf(a,t,t.pendingProps,t.type,void 0,ge);break;case 11:t=Lf(a,t,t.pendingProps,t.type.render,t.ref,ge);break;case 5:_r(t);default:Ff(a,t),t=me=gd(t,ba),t=Bf(a,t,ba)}e.memoizedProps=e.pendingProps,t===null?zo(e):me=t}function ol(e,t,a,n){ca=rn=null,_r(t),Qn=null,Bl=0;var r=t.return;try{if(Qy(e,r,t,a,ge)){Be=1,So(e,jt(a,e.current)),me=null;return}}catch(c){if(r!==null)throw me=r,c;Be=1,So(e,jt(a,e.current)),me=null;return}t.flags&32768?(ve||n===1?e=!0:al||(ge&536870912)!==0?e=!1:(qa=e=!0,(n===2||n===9||n===3||n===6)&&(n=Tt.current,n!==null&&n.tag===13&&(n.flags|=16384))),Sm(t,e)):zo(t)}function zo(e){var t=e;do{if((t.flags&32768)!==0){Sm(t,qa);return}e=t.return;var a=$y(t.alternate,t,ba);if(a!==null){me=a;return}if(t=t.sibling,t!==null){me=t;return}me=t=e}while(t!==null);Be===0&&(Be=5)}function Sm(e,t){do{var a=Wy(e.alternate,e);if(a!==null){a.flags&=32767,me=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){me=e;return}me=e=a}while(e!==null);Be=6,me=null}function xm(e,t,a,n,r,c,h,v,T){e.cancelPendingCommit=null;do Io();while(Ze!==0);if((_e&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(c=t.lanes|t.childLanes,c|=$s,Gg(e,a,c,h,v,T),e===ze&&(me=ze=null,ge=0),ll=t,Ga=e,Sa=a,oc=c,sc=r,um=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,dv(Di,function(){return Cm(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=A.T,A.T=null,r=X.p,X.p=2,h=_e,_e|=4;try{ev(e,t,a)}finally{_e=h,X.p=r,A.T=n}}Ze=1,Em(),Tm(),Nm()}}function Em(){if(Ze===1){Ze=0;var e=Ga,t=ll,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=A.T,A.T=null;var n=X.p;X.p=2;var r=_e;_e|=4;try{am(t,e);var c=Ec,h=sd(e.containerInfo),v=c.focusedElem,T=c.selectionRange;if(h!==v&&v&&v.ownerDocument&&od(v.ownerDocument.documentElement,v)){if(T!==null&&Vs(v)){var z=T.start,k=T.end;if(k===void 0&&(k=z),"selectionStart"in v)v.selectionStart=z,v.selectionEnd=Math.min(k,v.value.length);else{var U=v.ownerDocument||document,D=U&&U.defaultView||window;if(D.getSelection){var q=D.getSelection(),ee=v.textContent.length,oe=Math.min(T.start,ee),je=T.end===void 0?oe:Math.min(T.end,ee);!q.extend&&oe>je&&(h=je,je=oe,oe=h);var R=id(v,oe),C=id(v,je);if(R&&C&&(q.rangeCount!==1||q.anchorNode!==R.node||q.anchorOffset!==R.offset||q.focusNode!==C.node||q.focusOffset!==C.offset)){var O=U.createRange();O.setStart(R.node,R.offset),q.removeAllRanges(),oe>je?(q.addRange(O),q.extend(C.node,C.offset)):(O.setEnd(C.node,C.offset),q.addRange(O))}}}}for(U=[],q=v;q=q.parentNode;)q.nodeType===1&&U.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<U.length;v++){var G=U[v];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}Ko=!!xc,Ec=xc=null}finally{_e=r,X.p=n,A.T=a}}e.current=t,Ze=2}}function Tm(){if(Ze===2){Ze=0;var e=Ga,t=ll,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=A.T,A.T=null;var n=X.p;X.p=2;var r=_e;_e|=4;try{Jf(e,t.alternate,t)}finally{_e=r,X.p=n,A.T=a}}Ze=3}}function Nm(){if(Ze===4||Ze===3){Ze=0,fe();var e=Ga,t=ll,a=Sa,n=um;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ze=5:(Ze=0,ll=Ga=null,_m(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(ka=null),As(a),t=t.stateNode,bt&&typeof bt.onCommitFiberRoot=="function")try{bt.onCommitFiberRoot(Nl,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=A.T,r=X.p,X.p=2,A.T=null;try{for(var c=e.onRecoverableError,h=0;h<n.length;h++){var v=n[h];c(v.value,{componentStack:v.stack})}}finally{A.T=t,X.p=r}}(Sa&3)!==0&&Io(),Jt(e),r=e.pendingLanes,(a&261930)!==0&&(r&42)!==0?e===rc?ii++:(ii=0,rc=e):ii=0,oi(0)}}function _m(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Gl(t)))}function Io(){return Em(),Tm(),Nm(),Cm()}function Cm(){if(Ze!==5)return!1;var e=Ga,t=oc;oc=0;var a=As(Sa),n=A.T,r=X.p;try{X.p=32>a?32:a,A.T=null,a=sc,sc=null;var c=Ga,h=Sa;if(Ze=0,ll=Ga=null,Sa=0,(_e&6)!==0)throw Error(o(331));var v=_e;if(_e|=4,sm(c.current),lm(c,c.current,h,a),_e=v,oi(0,!1),bt&&typeof bt.onPostCommitFiberRoot=="function")try{bt.onPostCommitFiberRoot(Nl,c)}catch{}return!0}finally{X.p=r,A.T=n,_m(e,t)}}function wm(e,t,a){t=jt(a,t),t=Gr(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Cl(e,2),Jt(e))}function Me(e,t,a){if(e.tag===3)wm(e,e,a);else for(;t!==null;){if(t.tag===3){wm(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(ka===null||!ka.has(n))){e=jt(a,e),a=Af(2),n=za(t,a,2),n!==null&&(Mf(a,n,t,e),Cl(n,2),Jt(n));break}}t=t.return}}function dc(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new nv;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(a)||(nc=!0,r.add(a),e=rv.bind(null,e,t,a),t.then(e,e))}function rv(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ze===e&&(ge&a)===a&&(Be===4||Be===3&&(ge&62914560)===ge&&300>He()-Ao?(_e&2)===0&&il(e,0):lc|=a,nl===ge&&(nl=0)),Jt(e)}function Am(e,t){t===0&&(t=xu()),e=ln(e,t),e!==null&&(Cl(e,t),Jt(e))}function cv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Am(e,a)}function uv(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(a=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(o(314))}n!==null&&n.delete(t),Am(e,a)}function dv(e,t){return K(e,t)}var Do=null,sl=null,fc=!1,Lo=!1,mc=!1,Ba=0;function Jt(e){e!==sl&&e.next===null&&(sl===null?Do=sl=e:sl=sl.next=e),Lo=!0,fc||(fc=!0,mv())}function oi(e,t){if(!mc&&Lo){mc=!0;do for(var a=!1,n=Do;n!==null;){if(e!==0){var r=n.pendingLanes;if(r===0)var c=0;else{var h=n.suspendedLanes,v=n.pingedLanes;c=(1<<31-St(42|e)+1)-1,c&=r&~(h&~v),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(a=!0,jm(n,c))}else c=ge,c=ki(n,n===ze?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(c&3)===0||_l(n,c)||(a=!0,jm(n,c));n=n.next}while(a);mc=!1}}function fv(){Mm()}function Mm(){Lo=fc=!1;var e=0;Ba!==0&&Tv()&&(e=Ba);for(var t=He(),a=null,n=Do;n!==null;){var r=n.next,c=Rm(n,t);c===0?(n.next=null,a===null?Do=r:a.next=r,r===null&&(sl=a)):(a=n,(e!==0||(c&3)!==0)&&(Lo=!0)),n=r}Ze!==0&&Ze!==5||oi(e),Ba!==0&&(Ba=0)}function Rm(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var h=31-St(c),v=1<<h,T=r[h];T===-1?((v&a)===0||(v&n)!==0)&&(r[h]=kg(v,t)):T<=t&&(e.expiredLanes|=v),c&=~v}if(t=ze,a=ge,a=ki(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,a===0||e===t&&(Ae===2||Ae===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&Se(n),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||_l(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(n!==null&&Se(n),As(a)){case 2:case 8:a=bu;break;case 32:a=Di;break;case 268435456:a=Su;break;default:a=Di}return n=Om.bind(null,e),a=K(a,n),e.callbackPriority=t,e.callbackNode=a,t}return n!==null&&n!==null&&Se(n),e.callbackPriority=2,e.callbackNode=null,2}function Om(e,t){if(Ze!==0&&Ze!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Io()&&e.callbackNode!==a)return null;var n=ge;return n=ki(e,e===ze?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(fm(e,n,t),Rm(e,He()),e.callbackNode!=null&&e.callbackNode===a?Om.bind(null,e):null)}function jm(e,t){if(Io())return null;fm(e,t,!0)}function mv(){_v(function(){(_e&6)!==0?K(Vt,fv):Mm()})}function pc(){if(Ba===0){var e=Kn;e===0&&(e=Li,Li<<=1,(Li&261888)===0&&(Li=256)),Ba=e}return Ba}function zm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Pi(""+e)}function Im(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function pv(e,t,a,n,r){if(t==="submit"&&a&&a.stateNode===r){var c=zm((r[ft]||null).action),h=n.submitter;h&&(t=(t=h[ft]||null)?zm(t.formAction):h.getAttribute("formAction"),t!==null&&(c=t,h=null));var v=new Vi("action","action",null,n,r);e.push({event:v,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Ba!==0){var T=h?Im(r,h):new FormData(r);Ir(a,{pending:!0,data:T,method:r.method,action:c},null,T)}}else typeof c=="function"&&(v.preventDefault(),T=h?Im(r,h):new FormData(r),Ir(a,{pending:!0,data:T,method:r.method,action:c},c,T))},currentTarget:r}]})}}for(var hc=0;hc<Js.length;hc++){var gc=Js[hc],hv=gc.toLowerCase(),gv=gc[0].toUpperCase()+gc.slice(1);Gt(hv,"on"+gv)}Gt(ud,"onAnimationEnd"),Gt(dd,"onAnimationIteration"),Gt(fd,"onAnimationStart"),Gt("dblclick","onDoubleClick"),Gt("focusin","onFocus"),Gt("focusout","onBlur"),Gt(jy,"onTransitionRun"),Gt(zy,"onTransitionStart"),Gt(Iy,"onTransitionCancel"),Gt(md,"onTransitionEnd"),jn("onMouseEnter",["mouseout","mouseover"]),jn("onMouseLeave",["mouseout","mouseover"]),jn("onPointerEnter",["pointerout","pointerover"]),jn("onPointerLeave",["pointerout","pointerover"]),en("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),en("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),en("onBeforeInput",["compositionend","keypress","textInput","paste"]),en("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),en("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),en("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var si="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(" "),yv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(si));function Dm(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var n=e[a],r=n.event;n=n.listeners;e:{var c=void 0;if(t)for(var h=n.length-1;0<=h;h--){var v=n[h],T=v.instance,z=v.currentTarget;if(v=v.listener,T!==c&&r.isPropagationStopped())break e;c=v,r.currentTarget=z;try{c(r)}catch(k){Zi(k)}r.currentTarget=null,c=T}else for(h=0;h<n.length;h++){if(v=n[h],T=v.instance,z=v.currentTarget,v=v.listener,T!==c&&r.isPropagationStopped())break e;c=v,r.currentTarget=z;try{c(r)}catch(k){Zi(k)}r.currentTarget=null,c=T}}}}function pe(e,t){var a=t[Ms];a===void 0&&(a=t[Ms]=new Set);var n=e+"__bubble";a.has(n)||(Lm(t,e,2,!1),a.add(n))}function yc(e,t,a){var n=0;t&&(n|=4),Lm(a,e,n,t)}var qo="_reactListening"+Math.random().toString(36).slice(2);function vc(e){if(!e[qo]){e[qo]=!0,Au.forEach(function(a){a!=="selectionchange"&&(yv.has(a)||yc(a,!1,e),yc(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qo]||(t[qo]=!0,yc("selectionchange",!1,t))}}function Lm(e,t,a,n){switch(dp(t)){case 2:var r=Yv;break;case 8:r=Kv;break;default:r=zc}a=r.bind(null,t,a,e),r=void 0,!Hs||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),n?r!==void 0?e.addEventListener(t,a,{capture:!0,passive:r}):e.addEventListener(t,a,!0):r!==void 0?e.addEventListener(t,a,{passive:r}):e.addEventListener(t,a,!1)}function bc(e,t,a,n,r){var c=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var h=n.tag;if(h===3||h===4){var v=n.stateNode.containerInfo;if(v===r)break;if(h===4)for(h=n.return;h!==null;){var T=h.tag;if((T===3||T===4)&&h.stateNode.containerInfo===r)return;h=h.return}for(;v!==null;){if(h=Mn(v),h===null)return;if(T=h.tag,T===5||T===6||T===26||T===27){n=c=h;continue e}v=v.parentNode}}n=n.return}Gu(function(){var z=c,k=Ls(a),U=[];e:{var D=pd.get(e);if(D!==void 0){var q=Vi,ee=e;switch(e){case"keypress":if(Yi(a)===0)break e;case"keydown":case"keyup":q=uy;break;case"focusin":ee="focus",q=Bs;break;case"focusout":ee="blur",q=Bs;break;case"beforeblur":case"afterblur":q=Bs;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=Pu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=$g;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=my;break;case ud:case dd:case fd:q=ty;break;case md:q=hy;break;case"scroll":case"scrollend":q=Zg;break;case"wheel":q=yy;break;case"copy":case"cut":case"paste":q=ny;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=Yu;break;case"toggle":case"beforetoggle":q=by}var oe=(t&4)!==0,je=!oe&&(e==="scroll"||e==="scrollend"),R=oe?D!==null?D+"Capture":null:D;oe=[];for(var C=z,O;C!==null;){var G=C;if(O=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||O===null||R===null||(G=Ml(C,R),G!=null&&oe.push(ri(C,G,O))),je)break;C=C.return}0<oe.length&&(D=new q(D,ee,null,a,k),U.push({event:D,listeners:oe}))}}if((t&7)===0){e:{if(D=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",D&&a!==Ds&&(ee=a.relatedTarget||a.fromElement)&&(Mn(ee)||ee[An]))break e;if((q||D)&&(D=k.window===k?k:(D=k.ownerDocument)?D.defaultView||D.parentWindow:window,q?(ee=a.relatedTarget||a.toElement,q=z,ee=ee?Mn(ee):null,ee!==null&&(je=d(ee),oe=ee.tag,ee!==je||oe!==5&&oe!==27&&oe!==6)&&(ee=null)):(q=null,ee=z),q!==ee)){if(oe=Pu,G="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(oe=Yu,G="onPointerLeave",R="onPointerEnter",C="pointer"),je=q==null?D:Al(q),O=ee==null?D:Al(ee),D=new oe(G,C+"leave",q,a,k),D.target=je,D.relatedTarget=O,G=null,Mn(k)===z&&(oe=new oe(R,C+"enter",ee,a,k),oe.target=O,oe.relatedTarget=je,G=oe),je=G,q&&ee)t:{for(oe=vv,R=q,C=ee,O=0,G=R;G;G=oe(G))O++;G=0;for(var le=C;le;le=oe(le))G++;for(;0<O-G;)R=oe(R),O--;for(;0<G-O;)C=oe(C),G--;for(;O--;){if(R===C||C!==null&&R===C.alternate){oe=R;break t}R=oe(R),C=oe(C)}oe=null}else oe=null;q!==null&&qm(U,D,q,oe,!1),ee!==null&&je!==null&&qm(U,je,ee,oe,!0)}}e:{if(D=z?Al(z):window,q=D.nodeName&&D.nodeName.toLowerCase(),q==="select"||q==="input"&&D.type==="file")var Te=Wu;else if(Ju(D))if(ed)Te=My;else{Te=wy;var te=Cy}else q=D.nodeName,!q||q.toLowerCase()!=="input"||D.type!=="checkbox"&&D.type!=="radio"?z&&Is(z.elementType)&&(Te=Wu):Te=Ay;if(Te&&(Te=Te(e,z))){$u(U,Te,a,k);break e}te&&te(e,D,z),e==="focusout"&&z&&D.type==="number"&&z.memoizedProps.value!=null&&zs(D,"number",D.value)}switch(te=z?Al(z):window,e){case"focusin":(Ju(te)||te.contentEditable==="true")&&(Hn=te,Xs=z,ql=null);break;case"focusout":ql=Xs=Hn=null;break;case"mousedown":Qs=!0;break;case"contextmenu":case"mouseup":case"dragend":Qs=!1,rd(U,a,k);break;case"selectionchange":if(Oy)break;case"keydown":case"keyup":rd(U,a,k)}var ue;if(Fs)e:{switch(e){case"compositionstart":var ye="onCompositionStart";break e;case"compositionend":ye="onCompositionEnd";break e;case"compositionupdate":ye="onCompositionUpdate";break e}ye=void 0}else qn?Qu(e,a)&&(ye="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ye="onCompositionStart");ye&&(Ku&&a.locale!=="ko"&&(qn||ye!=="onCompositionStart"?ye==="onCompositionEnd"&&qn&&(ue=Uu()):(Ca=k,ks="value"in Ca?Ca.value:Ca.textContent,qn=!0)),te=Ho(z,ye),0<te.length&&(ye=new Fu(ye,e,null,a,k),U.push({event:ye,listeners:te}),ue?ye.data=ue:(ue=Zu(a),ue!==null&&(ye.data=ue)))),(ue=xy?Ey(e,a):Ty(e,a))&&(ye=Ho(z,"onBeforeInput"),0<ye.length&&(te=new Fu("onBeforeInput","beforeinput",null,a,k),U.push({event:te,listeners:ye}),te.data=ue)),pv(U,e,z,a,k)}Dm(U,t)})}function ri(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Ho(e,t){for(var a=t+"Capture",n=[];e!==null;){var r=e,c=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||c===null||(r=Ml(e,a),r!=null&&n.unshift(ri(e,r,c)),r=Ml(e,t),r!=null&&n.push(ri(e,r,c))),e.tag===3)return n;e=e.return}return[]}function vv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function qm(e,t,a,n,r){for(var c=t._reactName,h=[];a!==null&&a!==n;){var v=a,T=v.alternate,z=v.stateNode;if(v=v.tag,T!==null&&T===n)break;v!==5&&v!==26&&v!==27||z===null||(T=z,r?(z=Ml(a,c),z!=null&&h.unshift(ri(a,z,T))):r||(z=Ml(a,c),z!=null&&h.push(ri(a,z,T)))),a=a.return}h.length!==0&&e.push({event:t,listeners:h})}var bv=/\r\n?/g,Sv=/\u0000|\uFFFD/g;function Hm(e){return(typeof e=="string"?e:""+e).replace(bv,`
10
+ `).replace(Sv,"")}function km(e,t){return t=Hm(t),Hm(e)===t}function Oe(e,t,a,n,r,c){switch(a){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||In(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&In(e,""+n);break;case"className":Ui(e,"class",n);break;case"tabIndex":Ui(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Ui(e,a,n);break;case"style":Hu(e,n,c);break;case"data":if(t!=="object"){Ui(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=Pi(""+n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof c=="function"&&(a==="formAction"?(t!=="input"&&Oe(e,t,"name",r.name,r,null),Oe(e,t,"formEncType",r.formEncType,r,null),Oe(e,t,"formMethod",r.formMethod,r,null),Oe(e,t,"formTarget",r.formTarget,r,null)):(Oe(e,t,"encType",r.encType,r,null),Oe(e,t,"method",r.method,r,null),Oe(e,t,"target",r.target,r,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=Pi(""+n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=ia);break;case"onScroll":n!=null&&pe("scroll",e);break;case"onScrollEnd":n!=null&&pe("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(o(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=Pi(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""+n):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":pe("beforetoggle",e),pe("toggle",e),Gi(e,"popover",n);break;case"xlinkActuate":la(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":la(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":la(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":la(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":la(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":la(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":la(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":la(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":la(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Gi(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xg.get(a)||a,Gi(e,a,n))}}function Sc(e,t,a,n,r,c){switch(a){case"style":Hu(e,n,c);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(o(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"children":typeof n=="string"?In(e,n):(typeof n=="number"||typeof n=="bigint")&&In(e,""+n);break;case"onScroll":n!=null&&pe("scroll",e);break;case"onScrollEnd":n!=null&&pe("scrollend",e);break;case"onClick":n!=null&&(e.onclick=ia);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Mu.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(r=a.endsWith("Capture"),t=a.slice(2,r?a.length-7:void 0),c=e[ft]||null,c=c!=null?c[a]:null,typeof c=="function"&&e.removeEventListener(t,c,r),typeof n=="function")){typeof c!="function"&&c!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,n,r);break e}a in e?e[a]=n:n===!0?e.setAttribute(a,""):Gi(e,a,n)}}}function it(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":pe("error",e),pe("load",e);var n=!1,r=!1,c;for(c in a)if(a.hasOwnProperty(c)){var h=a[c];if(h!=null)switch(c){case"src":n=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Oe(e,t,c,h,a,null)}}r&&Oe(e,t,"srcSet",a.srcSet,a,null),n&&Oe(e,t,"src",a.src,a,null);return;case"input":pe("invalid",e);var v=c=h=r=null,T=null,z=null;for(n in a)if(a.hasOwnProperty(n)){var k=a[n];if(k!=null)switch(n){case"name":r=k;break;case"type":h=k;break;case"checked":T=k;break;case"defaultChecked":z=k;break;case"value":c=k;break;case"defaultValue":v=k;break;case"children":case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(137,t));break;default:Oe(e,t,n,k,a,null)}}Iu(e,c,v,T,z,h,r,!1);return;case"select":pe("invalid",e),n=h=c=null;for(r in a)if(a.hasOwnProperty(r)&&(v=a[r],v!=null))switch(r){case"value":c=v;break;case"defaultValue":h=v;break;case"multiple":n=v;default:Oe(e,t,r,v,a,null)}t=c,a=h,e.multiple=!!n,t!=null?zn(e,!!n,t,!1):a!=null&&zn(e,!!n,a,!0);return;case"textarea":pe("invalid",e),c=r=n=null;for(h in a)if(a.hasOwnProperty(h)&&(v=a[h],v!=null))switch(h){case"value":n=v;break;case"defaultValue":r=v;break;case"children":c=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(o(91));break;default:Oe(e,t,h,v,a,null)}Lu(e,n,r,c);return;case"option":for(T in a)a.hasOwnProperty(T)&&(n=a[T],n!=null)&&(T==="selected"?e.selected=n&&typeof n!="function"&&typeof n!="symbol":Oe(e,t,T,n,a,null));return;case"dialog":pe("beforetoggle",e),pe("toggle",e),pe("cancel",e),pe("close",e);break;case"iframe":case"object":pe("load",e);break;case"video":case"audio":for(n=0;n<si.length;n++)pe(si[n],e);break;case"image":pe("error",e),pe("load",e);break;case"details":pe("toggle",e);break;case"embed":case"source":case"link":pe("error",e),pe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(z in a)if(a.hasOwnProperty(z)&&(n=a[z],n!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Oe(e,t,z,n,a,null)}return;default:if(Is(t)){for(k in a)a.hasOwnProperty(k)&&(n=a[k],n!==void 0&&Sc(e,t,k,n,a,void 0));return}}for(v in a)a.hasOwnProperty(v)&&(n=a[v],n!=null&&Oe(e,t,v,n,a,null))}function xv(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,c=null,h=null,v=null,T=null,z=null,k=null;for(q in a){var U=a[q];if(a.hasOwnProperty(q)&&U!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":T=U;default:n.hasOwnProperty(q)||Oe(e,t,q,null,n,U)}}for(var D in n){var q=n[D];if(U=a[D],n.hasOwnProperty(D)&&(q!=null||U!=null))switch(D){case"type":c=q;break;case"name":r=q;break;case"checked":z=q;break;case"defaultChecked":k=q;break;case"value":h=q;break;case"defaultValue":v=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(o(137,t));break;default:q!==U&&Oe(e,t,D,q,n,U)}}js(e,h,v,T,z,k,c,r);return;case"select":q=h=v=D=null;for(c in a)if(T=a[c],a.hasOwnProperty(c)&&T!=null)switch(c){case"value":break;case"multiple":q=T;default:n.hasOwnProperty(c)||Oe(e,t,c,null,n,T)}for(r in n)if(c=n[r],T=a[r],n.hasOwnProperty(r)&&(c!=null||T!=null))switch(r){case"value":D=c;break;case"defaultValue":v=c;break;case"multiple":h=c;default:c!==T&&Oe(e,t,r,c,n,T)}t=v,a=h,n=q,D!=null?zn(e,!!a,D,!1):!!n!=!!a&&(t!=null?zn(e,!!a,t,!0):zn(e,!!a,a?[]:"",!1));return;case"textarea":q=D=null;for(v in a)if(r=a[v],a.hasOwnProperty(v)&&r!=null&&!n.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Oe(e,t,v,null,n,r)}for(h in n)if(r=n[h],c=a[h],n.hasOwnProperty(h)&&(r!=null||c!=null))switch(h){case"value":D=r;break;case"defaultValue":q=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(o(91));break;default:r!==c&&Oe(e,t,h,r,n,c)}Du(e,D,q);return;case"option":for(var ee in a)D=a[ee],a.hasOwnProperty(ee)&&D!=null&&!n.hasOwnProperty(ee)&&(ee==="selected"?e.selected=!1:Oe(e,t,ee,null,n,D));for(T in n)D=n[T],q=a[T],n.hasOwnProperty(T)&&D!==q&&(D!=null||q!=null)&&(T==="selected"?e.selected=D&&typeof D!="function"&&typeof D!="symbol":Oe(e,t,T,D,n,q));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var oe in a)D=a[oe],a.hasOwnProperty(oe)&&D!=null&&!n.hasOwnProperty(oe)&&Oe(e,t,oe,null,n,D);for(z in n)if(D=n[z],q=a[z],n.hasOwnProperty(z)&&D!==q&&(D!=null||q!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(o(137,t));break;default:Oe(e,t,z,D,n,q)}return;default:if(Is(t)){for(var je in a)D=a[je],a.hasOwnProperty(je)&&D!==void 0&&!n.hasOwnProperty(je)&&Sc(e,t,je,void 0,n,D);for(k in n)D=n[k],q=a[k],!n.hasOwnProperty(k)||D===q||D===void 0&&q===void 0||Sc(e,t,k,D,n,q);return}}for(var R in a)D=a[R],a.hasOwnProperty(R)&&D!=null&&!n.hasOwnProperty(R)&&Oe(e,t,R,null,n,D);for(U in n)D=n[U],q=a[U],!n.hasOwnProperty(U)||D===q||D==null&&q==null||Oe(e,t,U,D,n,q)}function Gm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ev(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var r=a[n],c=r.transferSize,h=r.initiatorType,v=r.duration;if(c&&v&&Gm(h)){for(h=0,v=r.responseEnd,n+=1;n<a.length;n++){var T=a[n],z=T.startTime;if(z>v)break;var k=T.transferSize,U=T.initiatorType;k&&Gm(U)&&(T=T.responseEnd,h+=k*(T<v?1:(v-z)/(T-z)))}if(--n,t+=8*(c+h)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var xc=null,Ec=null;function ko(e){return e.nodeType===9?e:e.ownerDocument}function Um(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Bm(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Tc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Nc=null;function Tv(){var e=window.event;return e&&e.type==="popstate"?e===Nc?!1:(Nc=e,!0):(Nc=null,!1)}var Pm=typeof setTimeout=="function"?setTimeout:void 0,Nv=typeof clearTimeout=="function"?clearTimeout:void 0,Fm=typeof Promise=="function"?Promise:void 0,_v=typeof queueMicrotask=="function"?queueMicrotask:typeof Fm<"u"?function(e){return Fm.resolve(null).then(e).catch(Cv)}:Pm;function Cv(e){setTimeout(function(){throw e})}function Pa(e){return e==="head"}function Ym(e,t){var a=t,n=0;do{var r=a.nextSibling;if(e.removeChild(a),r&&r.nodeType===8)if(a=r.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(r),dl(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")ci(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ci(a);for(var c=a.firstChild;c;){var h=c.nextSibling,v=c.nodeName;c[wl]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&c.rel.toLowerCase()==="stylesheet"||a.removeChild(c),c=h}}else a==="body"&&ci(e.ownerDocument.body);a=r}while(a);dl(t)}function Km(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function _c(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":_c(a),Rs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function wv(e,t,a,n){for(;e.nodeType===1;){var r=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[wl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=qt(e.nextSibling),e===null)break}return null}function Av(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=qt(e.nextSibling),e===null))return null;return e}function Vm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=qt(e.nextSibling),e===null))return null;return e}function Cc(e){return e.data==="$?"||e.data==="$~"}function wc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Mv(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function qt(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==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Ac=null;function Xm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return qt(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Qm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Zm(e,t,a){switch(t=ko(a),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ci(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Rs(e)}var Ht=new Map,Jm=new Set;function Go(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xa=X.d;X.d={f:Rv,r:Ov,D:jv,C:zv,L:Iv,m:Dv,X:qv,S:Lv,M:Hv};function Rv(){var e=xa.f(),t=Oo();return e||t}function Ov(e){var t=Rn(e);t!==null&&t.tag===5&&t.type==="form"?pf(t):xa.r(e)}var rl=typeof document>"u"?null:document;function $m(e,t,a){var n=rl;if(n&&typeof t=="string"&&t){var r=Rt(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof a=="string"&&(r+='[crossorigin="'+a+'"]'),Jm.has(r)||(Jm.add(r),e={rel:e,crossOrigin:a,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),it(t,"link",e),$e(t),n.head.appendChild(t)))}}function jv(e){xa.D(e),$m("dns-prefetch",e,null)}function zv(e,t){xa.C(e,t),$m("preconnect",e,t)}function Iv(e,t,a){xa.L(e,t,a);var n=rl;if(n&&e&&t){var r='link[rel="preload"][as="'+Rt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(r+='[imagesrcset="'+Rt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(r+='[imagesizes="'+Rt(a.imageSizes)+'"]')):r+='[href="'+Rt(e)+'"]';var c=r;switch(t){case"style":c=cl(e);break;case"script":c=ul(e)}Ht.has(c)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Ht.set(c,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(ui(c))||t==="script"&&n.querySelector(di(c))||(t=n.createElement("link"),it(t,"link",e),$e(t),n.head.appendChild(t)))}}function Dv(e,t){xa.m(e,t);var a=rl;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Rt(n)+'"][href="'+Rt(e)+'"]',c=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=ul(e)}if(!Ht.has(c)&&(e=b({rel:"modulepreload",href:e},t),Ht.set(c,e),a.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(di(c)))return}n=a.createElement("link"),it(n,"link",e),$e(n),a.head.appendChild(n)}}}function Lv(e,t,a){xa.S(e,t,a);var n=rl;if(n&&e){var r=On(n).hoistableStyles,c=cl(e);t=t||"default";var h=r.get(c);if(!h){var v={loading:0,preload:null};if(h=n.querySelector(ui(c)))v.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Ht.get(c))&&Mc(e,a);var T=h=n.createElement("link");$e(T),it(T,"link",e),T._p=new Promise(function(z,k){T.onload=z,T.onerror=k}),T.addEventListener("load",function(){v.loading|=1}),T.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Uo(h,t,n)}h={type:"stylesheet",instance:h,count:1,state:v},r.set(c,h)}}}function qv(e,t){xa.X(e,t);var a=rl;if(a&&e){var n=On(a).hoistableScripts,r=ul(e),c=n.get(r);c||(c=a.querySelector(di(r)),c||(e=b({src:e,async:!0},t),(t=Ht.get(r))&&Rc(e,t),c=a.createElement("script"),$e(c),it(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},n.set(r,c))}}function Hv(e,t){xa.M(e,t);var a=rl;if(a&&e){var n=On(a).hoistableScripts,r=ul(e),c=n.get(r);c||(c=a.querySelector(di(r)),c||(e=b({src:e,async:!0,type:"module"},t),(t=Ht.get(r))&&Rc(e,t),c=a.createElement("script"),$e(c),it(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},n.set(r,c))}}function Wm(e,t,a,n){var r=(r=se.current)?Go(r):null;if(!r)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=cl(a.href),a=On(r).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=cl(a.href);var c=On(r).hoistableStyles,h=c.get(e);if(h||(r=r.ownerDocument||r,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,h),(c=r.querySelector(ui(e)))&&!c._p&&(h.instance=c,h.state.loading=5),Ht.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ht.set(e,a),c||kv(r,e,a,h.state))),t&&n===null)throw Error(o(528,""));return h}if(t&&n!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ul(a),a=On(r).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function cl(e){return'href="'+Rt(e)+'"'}function ui(e){return'link[rel="stylesheet"]['+e+"]"}function ep(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function kv(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),it(t,"link",a),$e(t),e.head.appendChild(t))}function ul(e){return'[src="'+Rt(e)+'"]'}function di(e){return"script[async]"+e}function tp(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Rt(a.href)+'"]');if(n)return t.instance=n,$e(n),n;var r=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),$e(n),it(n,"style",r),Uo(n,a.precedence,e),t.instance=n;case"stylesheet":r=cl(a.href);var c=e.querySelector(ui(r));if(c)return t.state.loading|=4,t.instance=c,$e(c),c;n=ep(a),(r=Ht.get(r))&&Mc(n,r),c=(e.ownerDocument||e).createElement("link"),$e(c);var h=c;return h._p=new Promise(function(v,T){h.onload=v,h.onerror=T}),it(c,"link",n),t.state.loading|=4,Uo(c,a.precedence,e),t.instance=c;case"script":return c=ul(a.src),(r=e.querySelector(di(c)))?(t.instance=r,$e(r),r):(n=a,(r=Ht.get(c))&&(n=b({},a),Rc(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),$e(r),it(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Uo(n,a.precedence,e));return t.instance}function Uo(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,c=r,h=0;h<n.length;h++){var v=n[h];if(v.dataset.precedence===t)c=v;else if(c!==r)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Mc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Rc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Bo=null;function ap(e,t,a){if(Bo===null){var n=new Map,r=Bo=new Map;r.set(a,n)}else r=Bo,n=r.get(a),n||(n=new Map,r.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),r=0;r<a.length;r++){var c=a[r];if(!(c[wl]||c[tt]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var h=c.getAttribute(t)||"";h=e+h;var v=n.get(h);v?v.push(c):n.set(h,[c])}}return n}function np(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Gv(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function lp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Uv(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var r=cl(n.href),c=t.querySelector(ui(r));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Po.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,$e(c);return}c=t.ownerDocument||t,n=ep(n),(r=Ht.get(r))&&Mc(n,r),c=c.createElement("link"),$e(c);var h=c;h._p=new Promise(function(v,T){h.onload=v,h.onerror=T}),it(c,"link",n),a.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Po.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Oc=0;function Bv(e,t){return e.stylesheets&&e.count===0&&Yo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&Yo(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&Oc===0&&(Oc=62500*Ev());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Yo(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>Oc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function Po(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Fo=null;function Yo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Fo=new Map,t.forEach(Pv,e),Fo=null,Po.call(e))}function Pv(e,t){if(!(t.state.loading&4)){var a=Fo.get(e);if(a)var n=a.get(null);else{a=new Map,Fo.set(e,a);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<r.length;c++){var h=r[c];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(a.set(h.dataset.precedence,h),n=h)}n&&a.set(null,n)}r=t.instance,h=r.getAttribute("data-precedence"),c=a.get(h)||n,c===n&&a.set(null,r),a.set(h,r),this.count++,n=Po.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),c?c.parentNode.insertBefore(r,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var fi={$$typeof:Y,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function Fv(e,t,a,n,r,c,h,v,T){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Cs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cs(0),this.hiddenUpdates=Cs(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=c,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function ip(e,t,a,n,r,c,h,v,T,z,k,U){return e=new Fv(e,t,a,h,T,z,k,U,v),t=1,c===!0&&(t|=24),c=Et(3,null,null,t),e.current=c,c.stateNode=e,t=ur(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:n,isDehydrated:a,cache:t},pr(c),e}function op(e){return e?(e=Un,e):Un}function sp(e,t,a,n,r,c){r=op(r),n.context===null?n.context=r:n.pendingContext=r,n=ja(t),n.payload={element:a},c=c===void 0?null:c,c!==null&&(n.callback=c),a=za(e,n,t),a!==null&&(vt(a,e,t),Fl(a,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function jc(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function cp(e){if(e.tag===13||e.tag===31){var t=ln(e,67108864);t!==null&&vt(t,e,67108864),jc(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=wt();t=ws(t);var a=ln(e,t);a!==null&&vt(a,e,t),jc(e,t)}}var Ko=!0;function Yv(e,t,a,n){var r=A.T;A.T=null;var c=X.p;try{X.p=2,zc(e,t,a,n)}finally{X.p=c,A.T=r}}function Kv(e,t,a,n){var r=A.T;A.T=null;var c=X.p;try{X.p=8,zc(e,t,a,n)}finally{X.p=c,A.T=r}}function zc(e,t,a,n){if(Ko){var r=Ic(n);if(r===null)bc(e,t,n,Vo,a),fp(e,n);else if(Xv(r,e,t,a,n))n.stopPropagation();else if(fp(e,n),t&4&&-1<Vv.indexOf(e)){for(;r!==null;){var c=Rn(r);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var h=Wa(c.pendingLanes);if(h!==0){var v=c;for(v.pendingLanes|=2,v.entangledLanes|=2;h;){var T=1<<31-St(h);v.entanglements[1]|=T,h&=~T}Jt(c),(_e&6)===0&&(Mo=He()+500,oi(0))}}break;case 31:case 13:v=ln(c,2),v!==null&&vt(v,c,2),Oo(),jc(c,2)}if(c=Ic(n),c===null&&bc(e,t,n,Vo,a),c===r)break;r=c}r!==null&&n.stopPropagation()}else bc(e,t,n,null,a)}}function Ic(e){return e=Ls(e),Dc(e)}var Vo=null;function Dc(e){if(Vo=null,e=Mn(e),e!==null){var t=d(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=p(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vo=e,null}function dp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(wn()){case Vt:return 2;case bu:return 8;case Di:case zg:return 32;case Su:return 268435456;default:return 32}default:return 32}}var Lc=!1,Fa=null,Ya=null,Ka=null,mi=new Map,pi=new Map,Va=[],Vv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function fp(e,t){switch(e){case"focusin":case"focusout":Fa=null;break;case"dragenter":case"dragleave":Ya=null;break;case"mouseover":case"mouseout":Ka=null;break;case"pointerover":case"pointerout":mi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pi.delete(t.pointerId)}}function hi(e,t,a,n,r,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:c,targetContainers:[r]},t!==null&&(t=Rn(t),t!==null&&cp(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Xv(e,t,a,n,r){switch(t){case"focusin":return Fa=hi(Fa,e,t,a,n,r),!0;case"dragenter":return Ya=hi(Ya,e,t,a,n,r),!0;case"mouseover":return Ka=hi(Ka,e,t,a,n,r),!0;case"pointerover":var c=r.pointerId;return mi.set(c,hi(mi.get(c)||null,e,t,a,n,r)),!0;case"gotpointercapture":return c=r.pointerId,pi.set(c,hi(pi.get(c)||null,e,t,a,n,r)),!0}return!1}function mp(e){var t=Mn(e.target);if(t!==null){var a=d(t);if(a!==null){if(t=a.tag,t===13){if(t=p(a),t!==null){e.blockedOn=t,Cu(e.priority,function(){up(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,Cu(e.priority,function(){up(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Xo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Ic(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);Ds=n,a.target.dispatchEvent(n),Ds=null}else return t=Rn(a),t!==null&&cp(t),e.blockedOn=a,!1;t.shift()}return!0}function pp(e,t,a){Xo(e)&&a.delete(t)}function Qv(){Lc=!1,Fa!==null&&Xo(Fa)&&(Fa=null),Ya!==null&&Xo(Ya)&&(Ya=null),Ka!==null&&Xo(Ka)&&(Ka=null),mi.forEach(pp),pi.forEach(pp)}function Qo(e,t){e.blockedOn===t&&(e.blockedOn=null,Lc||(Lc=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,Qv)))}var Zo=null;function hp(e){Zo!==e&&(Zo=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){Zo===e&&(Zo=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],r=e[t+2];if(typeof n!="function"){if(Dc(n||a)===null)continue;break}var c=Rn(a);c!==null&&(e.splice(t,3),t-=3,Ir(c,{pending:!0,data:r,method:a.method,action:n},n,r))}}))}function dl(e){function t(T){return Qo(T,e)}Fa!==null&&Qo(Fa,e),Ya!==null&&Qo(Ya,e),Ka!==null&&Qo(Ka,e),mi.forEach(t),pi.forEach(t);for(var a=0;a<Va.length;a++){var n=Va[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Va.length&&(a=Va[0],a.blockedOn===null);)mp(a),a.blockedOn===null&&Va.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var r=a[n],c=a[n+1],h=r[ft]||null;if(typeof c=="function")h||hp(a);else if(h){var v=null;if(c&&c.hasAttribute("formAction")){if(r=c,h=c[ft]||null)v=h.formAction;else if(Dc(r)!==null)continue}else v=h.action;typeof v=="function"?a[n+1]=v:(a.splice(n,3),n-=3),hp(a)}}}function gp(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(h){return r=h})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function qc(e){this._internalRoot=e}Jo.prototype.render=qc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var a=t.current,n=wt();sp(a,n,e,t,null,null)},Jo.prototype.unmount=qc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sp(e.current,2,null,e,null,null),Oo(),t[An]=null}};function Jo(e){this._internalRoot=e}Jo.prototype.unstable_scheduleHydration=function(e){if(e){var t=_u();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Va.length&&t!==0&&t<Va[a].priority;a++);Va.splice(a,0,e),a===0&&mp(e)}};var yp=s.version;if(yp!=="19.2.5")throw Error(o(527,yp,"19.2.5"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var Zv={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$o.isDisabled&&$o.supportsFiber)try{Nl=$o.inject(Zv),bt=$o}catch{}}return yi.createRoot=function(e,t){if(!u(e))throw Error(o(299));var a=!1,n="",r=Nf,c=_f,h=Cf;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=ip(e,1,!1,null,null,a,n,null,r,c,h,gp),e[An]=t.current,vc(e),new qc(t)},yi.hydrateRoot=function(e,t,a){if(!u(e))throw Error(o(299));var n=!1,r="",c=Nf,h=_f,v=Cf,T=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(r=a.identifierPrefix),a.onUncaughtError!==void 0&&(c=a.onUncaughtError),a.onCaughtError!==void 0&&(h=a.onCaughtError),a.onRecoverableError!==void 0&&(v=a.onRecoverableError),a.formState!==void 0&&(T=a.formState)),t=ip(e,1,!0,t,a??null,n,r,T,c,h,v,gp),t.context=op(null),a=t.current,n=wt(),n=ws(n),r=ja(n),r.callback=null,za(a,r,n),a=n,t.current.lanes=a,Cl(t,a),Jt(t),e[An]=t.current,vc(e),new Jo(t)},yi.version="19.2.5",yi}var wp;function ob(){if(wp)return Gc.exports;wp=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(s){console.error(s)}}return l(),Gc.exports=ib(),Gc.exports}var sb=ob();const rb="modulepreload",cb=function(l){return"/"+l},Ap={},Ea=function(s,i,o){let u=Promise.resolve();if(i&&i.length>0){let y=function(g){return Promise.all(g.map(E=>Promise.resolve(E).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=p?.nonce||p?.getAttribute("nonce");u=y(i.map(g=>{if(g=cb(g),g in Ap)return;Ap[g]=!0;const E=g.endsWith(".css"),b=E?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const S=document.createElement("link");if(S.rel=E?"stylesheet":rb,E||(S.as="script"),S.crossOrigin="",S.href=g,m&&S.setAttribute("nonce",m),document.head.appendChild(S),E)return new Promise((x,M)=>{S.addEventListener("load",x),S.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(p){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=p,window.dispatchEvent(m),!m.defaultPrevented)throw p}return u.then(p=>{for(const m of p||[])m.status==="rejected"&&d(m.reason);return s().catch(d)})},Mp=l=>{let s;const i=new Set,o=(g,E)=>{const b=typeof g=="function"?g(s):g;if(!Object.is(b,s)){const S=s;s=E??(typeof b!="object"||b===null)?b:Object.assign({},s,b),i.forEach(x=>x(s,S))}},u=()=>s,m={setState:o,getState:u,getInitialState:()=>y,subscribe:g=>(i.add(g),()=>i.delete(g))},y=s=l(o,u,m);return m},ub=(l=>l?Mp(l):Mp),db=l=>l;function fb(l,s=db){const i=Wo.useSyncExternalStore(l.subscribe,Wo.useCallback(()=>s(l.getState()),[l,s]),Wo.useCallback(()=>s(l.getInitialState()),[l,s]));return Wo.useDebugValue(i),i}const Rp=l=>{const s=ub(l),i=o=>fb(s,o);return Object.assign(i,s),i},Mh=(l=>l?Rp(l):Rp),mb=["default","gpt","claude","gemini","grok"];function Op(l){return Array.isArray(l.images)}function pb(l){let s="message";const i=[];for(const u of l.split(`
11
+ `))u.startsWith("event:")&&(s=u.slice(6).trim()),u.startsWith("data:")&&i.push(u.slice(5).trimStart());if(i.length===0)return null;const o=i.join(`
12
+ `);return!o||o==="[DONE]"?null:{event:s,data:JSON.parse(o)}}async function hb(l,s={}){const i=await fetch("/api/node/generate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(l)});if(!(i.headers.get("content-type")??"").includes("text/event-stream")){const y=await i.json().catch(()=>({}));if(!i.ok){const g=y,E=g?.error?.message??`Request failed: ${i.status}`,b=new Error(E);throw b.code=g?.error?.code,b.status=g?.status??i.status,b}return y}if(!i.ok||!i.body)throw new Error(`Request failed: ${i.status}`);const u=i.body.getReader(),d=new TextDecoder;let p="",m=null;for(;;){const{done:y,value:g}=await u.read();if(y)break;p+=d.decode(g,{stream:!0});let E=p.indexOf(`
13
+
14
+ `);for(;E!==-1;){const b=p.slice(0,E);p=p.slice(E+2);const S=pb(b);if(S){if(S.event==="partial")s.onPartial?.(S.data);else if(S.event==="phase")s.onPhase?.(S.data);else if(S.event==="done")m=S.data;else if(S.event==="error"){const x=S.data,M=x?.error?.message??"Node generation failed",I=new Error(M);throw I.code=x?.error?.code,I.status=x?.status,I}}E=p.indexOf(`
15
+
16
+ `)}}if(!m){const y=new Error("No image data returned from the node stream");throw y.code="EMPTY_RESPONSE",y.status=422,y}return m}async function de(l,s){const i=await fetch(l,s),o=await i.json().catch(()=>({}));if(!i.ok){const u=o.error,d=o.code,p=typeof u=="string"?u:u?.message??`Request failed: ${i.status}`,m=new Error(p);throw m.status=i.status,typeof u!="string"&&u?.code?m.code=u.code:d&&(m.code=d),typeof o.currentVersion=="number"&&(m.currentVersion=o.currentVersion),m}return o}function Rh(l){const s=new URLSearchParams;l?.kind&&s.set("kind",l.kind),l?.sessionId&&s.set("sessionId",l.sessionId),l?.includeTerminal&&s.set("includeTerminal","1");const i=s.size>0?`?${s.toString()}`:"";return de(`/api/inflight${i}`)}function Fc(l){return de(`/api/inflight/${encodeURIComponent(l)}`,{method:"DELETE"})}function gb(){return de("/api/oauth/status")}function yb(){return de("/api/billing")}function vb(l){return de("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function bb(l){let s=null;const i=[];for(const u of l.split(`
17
+ `))u.startsWith("event:")&&(s=u.slice(6).trim()),u.startsWith("data:")&&i.push(u.slice(5).trimStart());if(i.length===0)return null;const o=i.join(`
18
+ `);return!o||o==="[DONE]"?null:{event:s,data:JSON.parse(o)}}async function Sb(l,s={},i={}){const o=await fetch("/api/generate/multimode",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(l),signal:i.signal});if(!(o.headers.get("content-type")??"").includes("text/event-stream")){const g=await o.json().catch(()=>({}));if(!o.ok){const E=g,b=new Error(E.error??`Request failed: ${o.status}`);throw b.code=E.code,b.status=E.status??o.status,b}return g}if(!o.ok||!o.body)throw new Error(`Request failed: ${o.status}`);const d=o.body.getReader(),p=new TextDecoder;let m="",y=null;for(;;){const{done:g,value:E}=await d.read();if(g)break;m+=p.decode(E,{stream:!0});let b=m.indexOf(`
19
+
20
+ `);for(;b!==-1;){const S=m.slice(0,b);m=m.slice(b+2);const x=bb(S);if(x){if(x.event==="partial")s.onPartial?.(x.data);else if(x.event==="image")s.onImage?.(x.data);else if(x.event==="phase")s.onPhase?.(x.data);else if(x.event==="done")y=x.data;else if(x.event==="error"){const M=x.data,I=new Error(M.error??"Multimode generation failed");throw I.code=M.code,I.status=M.status,I}}b=m.indexOf(`
21
+
22
+ `)}}if(!y){const g=new Error("No image data returned from the multimode stream");throw g.code="EMPTY_RESPONSE",g.status=422,g}return y}function ZE(l){return de("/api/edit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}let vi=null;function Oh(){if(!vi){const l=localStorage.getItem("ima2.browserId");l?vi=l:(vi=`${Date.now().toString(36)}_${Math.random().toString(36).slice(2,9)}`,localStorage.setItem("ima2.browserId",vi))}return vi}function bl(l,s){const i={...s?.headers,"X-Ima2-Browser-Id":Oh()};return de(l,{...s,headers:i})}function gl(l={}){const s=new URLSearchParams;return s.set("limit",String(l.limit??50)),l.since!=null&&s.set("since",String(l.since)),l.cursor&&(s.set("before",String(l.cursor.before)),s.set("beforeFilename",l.cursor.beforeFilename)),l.sessionId&&s.set("sessionId",l.sessionId),l.favoritesOnly&&s.set("favoritesOnly","1"),bl(`/api/history?${s.toString()}`)}function xb(l={}){const s=new URLSearchParams;return s.set("groupBy","session"),s.set("limit",String(l.limit??200)),l.cursor&&(s.set("before",String(l.cursor.before)),s.set("beforeFilename",l.cursor.beforeFilename)),l.sessionId&&s.set("sessionId",l.sessionId),bl(`/api/history?${s.toString()}`)}function Eb(l){return bl("/api/history/favorite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:l})})}async function Tb(){return(await de("/api/storage/status")).data}function Nb(){return de("/api/storage/open-generated-dir",{method:"POST"})}function jp(l){return de(`/api/history/${encodeURIComponent(l)}`,{method:"DELETE"})}function _b(l){return de(`/api/history/${encodeURIComponent(l)}/permanent`,{method:"DELETE"})}function Cb(l,s){return de(`/api/history/${encodeURIComponent(l)}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trashId:s})})}function wb(l){return de("/api/comfy/export-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:l.filename})})}function Ab(l){return de("/api/metadata/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function JE(l){return bl(`/api/annotations/${encodeURIComponent(l)}`)}async function $E(l,s){await bl(`/api/annotations/${encodeURIComponent(l)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotations:s})})}async function WE(l){await bl(`/api/annotations/${encodeURIComponent(l)}`,{method:"DELETE"})}function eT(l){const s=new URLSearchParams({sourceFilename:l.sourceFilename});return de(`/api/canvas-versions?${s.toString()}`,{method:"POST",headers:{"Content-Type":"image/png"},body:l.image})}function tT(l,s){const i=new URLSearchParams;s.sourceFilename&&i.set("sourceFilename",s.sourceFilename);const o=i.size>0?`?${i.toString()}`:"";return de(`/api/canvas-versions/${encodeURIComponent(l)}${o}`,{method:"PUT",headers:{"Content-Type":"image/png"},body:s.image})}function Mb(){return de("/api/sessions")}function Rb(l){return de("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:l})})}function jh(l){return de(`/api/sessions/${encodeURIComponent(l)}`)}function Ob(l,s){return de(`/api/sessions/${encodeURIComponent(l)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:s})})}function jb(l){return de(`/api/sessions/${encodeURIComponent(l)}`,{method:"DELETE"})}function zb(l,s,i,o,u={}){const d={"Content-Type":"application/json","If-Match":String(s)};return u.saveId&&(d["X-Ima2-Graph-Save-Id"]=u.saveId),u.saveReason&&(d["X-Ima2-Graph-Save-Reason"]=u.saveReason),u.tabId&&(d["X-Ima2-Tab-Id"]=u.tabId),de(`/api/sessions/${encodeURIComponent(l)}/graph`,{method:"PUT",headers:d,body:JSON.stringify({nodes:i,edges:o})})}function Ib(l){const s=new URLSearchParams;return de(`/api/prompts?${s.toString()}`)}function Db(l){return de("/api/prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function Lb(l){return de(`/api/prompts/${encodeURIComponent(l)}`,{method:"DELETE"})}function qb(l){return de(`/api/prompts/${encodeURIComponent(l)}/favorite`,{method:"POST"})}function Hb(l){return de("/api/prompts/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function aT(l){return de("/api/prompts/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function nT(l){return de("/api/prompts/import/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function lT(){return de("/api/prompts/import/curated-sources")}function iT(l){return de("/api/prompts/import/curated-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function oT(l){return de("/api/prompts/import/curated-refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function sT(l){const s=new URLSearchParams,i=s.size>0?`?${s.toString()}`:"";return de(`/api/prompts/import/discovery${i}`)}function rT(l){return de("/api/prompts/import/discovery-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:l.q,seeds:l.seeds,limit:l.limit})})}function cT(l){return de("/api/prompts/import/discovery-review",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function uT(l){return de("/api/prompts/import/folder-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:{kind:"github-folder",input:l.source.input}})})}function dT(l){return de("/api/prompts/import/folder-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:{kind:"github-folder",input:l.source.input},paths:l.paths})})}async function kb(l){const s=await l.arrayBuffer(),i=await fetch("/api/history/import-local",{method:"POST",headers:{"Content-Type":l.type||"image/png","X-Ima2-Original-Filename":encodeURIComponent(l.name)},body:s});if(!i.ok){let u={};try{u=await i.json()}catch{}const d=new Error(u.error||`Import failed (${i.status})`);throw d.code=u.code||"IMPORT_FAILED",d}return(await i.json()).item}function fT(l){return de("/api/prompt-builder/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function Gb(l){return new Promise((s,i)=>{const o=new FileReader;o.onload=()=>s(String(o.result)),o.onerror=()=>i(o.error),o.readAsDataURL(l)})}function Ub(l,s=256){return new Promise(i=>{const o=new Image;o.onload=()=>{const u=Math.min(1,s/Math.max(o.width,o.height)),d=document.createElement("canvas");d.width=o.width*u,d.height=o.height*u;const p=d.getContext("2d");if(!p)return i(l);p.drawImage(o,0,0,d.width,d.height),i(d.toDataURL("image/jpeg",.6))},o.onerror=()=>i(l),o.src=l})}const Bb={maxB64Bytes:6e6,preserveTransparency:!1,maxEdge:4096,qualityLadder:[.85,.7,.55]},zp=16777216;function Pb(l,s,i){let o=l,u=s;if(o<=0||u<=0)return{w:1,h:1};const d=Math.max(o,u);if(d>i){const p=i/d;o=Math.round(o*p),u=Math.round(u*p)}if(o*u>zp){const p=Math.sqrt(zp/(o*u));o=Math.max(1,Math.floor(o*p)),u=Math.max(1,Math.floor(u*p))}return{w:o,h:u}}function Yc(l){return new Promise((s,i)=>{const o=new FileReader;o.onload=()=>{typeof o.result=="string"?s(o.result):i(new Error("FileReader returned non-string"))},o.onerror=()=>i(o.error??new Error("FileReader failed")),o.readAsDataURL(l)})}function Ip(l,s,i){return new Promise((o,u)=>{l.toBlob(d=>d?o(d):u(new Error("canvas.toBlob returned null")),s,i)})}function Kc(l){const s=l.indexOf(",");return s<0?l.length:l.length-s-1}async function lu(l,s={}){const i={...Bb,...s},o=await Yc(l);if(Kc(o)<=i.maxB64Bytes)return o;let u;try{u=await createImageBitmap(l)}catch(d){throw new Error("이미지 디코드 실패. JPEG/PNG로 변환 후 다시 시도해 주세요.",{cause:d})}try{const{w:d,h:p}=Pb(u.width,u.height,i.maxEdge),m=document.createElement("canvas");m.width=d,m.height=p;const y=m.getContext("2d");if(!y)throw new Error("canvas 2d context unavailable");if(y.drawImage(u,0,0,d,p),i.preserveTransparency){const g=await Ip(m,"image/png"),E=await Yc(g);if(Kc(E)>i.maxB64Bytes)throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.");return E}for(const g of i.qualityLadder){const E=await Ip(m,"image/jpeg",g),b=await Yc(E);if(Kc(b)<=i.maxB64Bytes)return b}throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.")}finally{u.close?.()}}function es(l){const s=(l.type||"").toLowerCase();if(s.includes("heic")||s.includes("heif"))return!0;const i=(l.name||"").toLowerCase();return i.endsWith(".heic")||i.endsWith(".heif")}function Dp(l){return(l.type||"").toLowerCase()==="image/png"}const Fb={ok:"확인",cancel:"취소",delete:"삭제",close:"닫기",saving:"저장 중...",loading:"불러오는 중..."},Yb={modeImage:"이미지",settings:"설정",controls:"생성 옵션",generate:"생성",generateAria:"이미지 생성을 위한 프롬프트 시트 열기"},Kb={close:"프롬프트 시트 닫기",generate:"이미지 생성",controlsOpen:"생성 옵션 열기",tabs:{prompt:"프롬프트",controls:"옵션",library:"라이브러리"}},Vb={localImportSuccess:"이미지가 갤러리에 추가됐어요",localImportFailed:"이미지 가져오기 실패",localImportInvalid:"PNG, JPEG, WebP만 지원해요",localStorageFull:"로컬 저장소가 가득 차서 최근 상태가 저장되지 않을 수 있습니다.",refLimitExceeded:"참조 이미지는 최대 5장까지 추가할 수 있습니다. 초과한 이미지는 제외되었습니다.",refTooLarge:"이미지가 너무 큽니다. JPEG/PNG로 미리 변환하거나 해상도를 낮춰 다시 시도해 주세요.",refNotBase64:"이미지 파일이 손상되었거나 지원하지 않는 형식입니다.",refEmpty:"빈 이미지 파일입니다. 다른 파일을 선택해 주세요.",refHeicUnsupported:"HEIC/HEIF는 지원하지 않습니다. JPEG 또는 PNG로 변환 후 다시 시도해 주세요.",noCurrentImageForRef:"참조로 사용할 현재 이미지가 없습니다.",refSlotFull:"참조 이미지 슬롯이 가득 찼습니다. 최대 5장까지 가능합니다.",currentImageLoadFailed:"현재 이미지를 불러오지 못했습니다.",addedCurrentAsRef:"현재 이미지를 참조에 추가했습니다.",sessionLoadFailed:"세션을 불러오지 못했습니다.",sessionCreateFailed:"세션을 만들지 못했습니다.",sessionRenameFailed:"세션 이름을 바꾸지 못했습니다.",sessionDeleteFailed:"세션을 삭제하지 못했습니다.",promptRequired:"프롬프트를 입력하세요.",nodeCreated:"노드 {id} 생성 완료 ({elapsed}초)",nodeRootCreated:"이 이미지를 첫 노드로 만들었습니다.",nodeCreateFailed:"노드 생성에 실패했습니다.",generatedBatch:"{count}장을 {elapsed}초 만에 생성했습니다.",generatedSingle:"{elapsed}초 만에 생성했습니다.",generateFailed:"생성에 실패했습니다.",sessionReloadedElsewhere:"그래프 버전이 달라져 최신 그래프를 다시 불러왔습니다.",promptCopied:"프롬프트를 복사했습니다",imageCopied:"클립보드에 복사했습니다",copyFailed:"복사에 실패했습니다",openGeneratedDirFailed:"이미지 폴더를 열지 못했습니다. ima2 doctor로 저장 경로를 확인해 주세요.",openGeneratedDirOpened:"생성 이미지 폴더를 열었습니다.",noPromptToFork:"가져올 프롬프트가 없습니다",forkStarted:"이 이미지의 프롬프트를 가져왔습니다. 수정 후 다시 생성하세요",forkStartedNoPrompt:"이미지를 참조로 첨부했어요. 프롬프트 입력 후 생성하세요",comfyExported:"ComfyUI로 보냈습니다: {filename}",comfyExportInvalidUrl:"ComfyUI URL은 로컬 HTTP 주소여야 합니다.",comfyExportInvalidImage:"이 저장 이미지는 ComfyUI로 보낼 수 없습니다.",comfyExportImageNotFound:"저장된 이미지 파일을 찾지 못했습니다.",comfyExportFailed:"ComfyUI로 이미지를 업로드하지 못했습니다.",cancelFailed:"생성을 취소하지 못했습니다."},Xb={queued:"대기 중",streaming:"생성 중",decoding:"마무리 중",canceling:"취소 중",noPrompt:"프롬프트 없음",cancelAria:"생성 취소: {prompt}"},Qb={title:"크기",width:"가로",height:"세로",hint:"16px 단위, 최대 변 3840, 비율 3:1 이하, 65.5만-829만 픽셀",autoLabel:"자동",autoSub:"모델 추천",customLabel:"직접 입력",customSub:"자유 설정",customPlus:"+ 직접",customSlots:"저장 크기",customSlot:"커스텀",customSlotLimit:"커스텀 크기는 최대 3개",saveCustomSlot:"커스텀 크기 저장",replaceCustomSlot:"슬롯 교체",ratioFree:"자유",ratio21x9:"21:9",normalizedPreview:"전송 크기",noAdjustment:"조정 없음",squareMaxHint:"829만 픽셀 제한 때문에 정사각형 최대는 {size}입니다.",adjustedReasons:{snap:"16px 보정",maxEdge:"최대 변",ratio:"비율 제한",minPixels:"최소 픽셀",maxPixels:"최대 픽셀",min:"최소 변",max:"최대 변",pixels:"픽셀 제한"}},Zb={title:"크기 조정이 필요합니다",body:"입력한 크기가 이미지 생성 제한을 벗어나 자동 조정이 필요합니다.",requested:"요청한 크기",adjusted:"조정될 크기",approve:"승인 후 생성",cancel:"취소",reasonRatio:"비율 제한 3:1을 초과했습니다.",reasonPixels:"최대 픽셀 수 제한을 초과했습니다.",reasonMinPixels:"요청한 이미지의 픽셀 수가 너무 적습니다.",reasonMin:"최소 크기보다 작습니다.",reasonMax:"최대 크기보다 큽니다.",reasonSnap:"16px 단위에 맞춰야 합니다."},Jb={title:"품질",lowLabel:"낮음",lowSub:"빠름",mediumLabel:"중간",mediumSub:"균형",highLabel:"높음",highSub:"최상"},$b={title:"모더레이션",autoLabel:"자동",autoSub:"표준 필터",lowLabel:"낮음",lowSub:"완화 필터",explain:"자동은 표준 안전 필터를 사용합니다. 낮음은 제한을 조금 완화해 경계선 프롬프트가 더 통과할 수 있습니다."},Wb={title:"포맷"},eS={title:"개수",customPlus:"+n",customLabel:"직접 입력 개수",highCountHint:"고품질이나 참조 이미지에서는 시간이 더 걸릴 수 있습니다.",minMaxHint:"1-8장까지 가능합니다.",decrease:"개수 줄이기",increase:"개수 늘리기"},tS={label:"멀티모드",tooltip:"한 프롬프트로 단계별 시퀀스를 생성합니다",shortHint:"단계별 생성",maxStages:"최대 단계",highCountHint:"단계가 많으면 몇 분 걸릴 수 있습니다.",minMaxHint:"1-8단계까지 가능합니다.",composerBadge:"시퀀스 · 최대 {count}장",composerAriaLabel:"멀티모드 프롬프트 입력창, 최대 {count}개의 별도 이미지",promptPlaceholder:"단계별로 만들 장면을 입력하세요. 콜라주가 아니라 별도 이미지로 요청합니다.",promptPlaceholderWithRefs:"첨부한 참조를 바탕으로 단계별 시퀀스를 입력하세요.",toggleDisabledGenerating:"현재 생성이 끝난 뒤 변경할 수 있습니다",sequenceTitle:"멀티모드 시퀀스",sequenceProgress:"{returned}/{requested}장",stageLabel:"{index}단계",generating:"생성 중...",partialAlt:"멀티모드 중간 미리보기",partial:"{requested}장 중 {returned}장을 {elapsed}초 만에 생성했습니다.",complete:"{requested}장 중 {returned}장을 {elapsed}초 만에 생성했습니다.",notReturned:"반환되지 않음",empty:"반환된 이미지 없음",error:"생성 실패",canceled:"취소됨",cancel:"취소"},aS={restoreTitle:"이미지 설정 복원",restoreBody:"이 이미지에 ima2 생성 정보가 있습니다. 프롬프트와 설정을 적용하거나 참조 이미지만 추가할 수 있습니다.",applySettings:"설정 적용",useAsReferenceOnly:"참조만 추가",noMetadata:"ima2 메타데이터가 없습니다.",invalidMetadata:"이미지 메타데이터가 올바르지 않습니다.",unsupportedFormat:"PNG, JPEG, WebP 메타데이터만 복원할 수 있습니다.",readFailed:"메타데이터를 읽지 못했습니다.",applied:"이미지 설정을 복원했습니다.",sourceXmp:"XMP",sourcePngComment:"PNG comment",imageAlt:"드롭한 이미지 미리보기",prompt:"프롬프트",size:"크기",quality:"품질",model:"모델",source:"출처"},nS={title:"생성 준비 상태",open:"준비 상태 확인",openTitle:"프로바이더, 인증, 모델, 웹 검색 준비 상태 확인",settingsTitle:"생성 준비 상태",settingsBody:"프로바이더, 인증, 모델, 추론, 웹 검색 상태를 팝업으로 확인합니다.",ready:"생성 준비 완료",readyBody:"선택한 프로바이더를 사용할 수 있습니다.",blocked:"프로바이더 확인 필요",provider:"프로바이더",model:"모델",reasoning:"추론",webSearch:"웹 검색",openAccount:"계정 설정 열기"},lS={button:"생성",buttonLoading:"생성 중 ({n})"},iS={label:"API 상태",checking:"확인 중...",offline:"오프라인",remaining:"${remaining} 남음",thisMonth:"이번 달 ${amount}",oauthFree:"OAuth 무료 사용 가능",apiDisabled:"API 키 사용 가능",apiReady:"API 키 사용 가능",oauthMode:"OAuth 모드"},oS={openGalleryAria:"갤러리 열기",openGalleryTitle:"전체 갤러리 열기",openGalleryShort:"전체",galleryCard:"갤러리 열기",recentTitle:"최근 생성",collapseRecent:"최근 생성 접기",expandRecent:"최근 생성 펼치기",collapseRecentShort:"접기",expandRecentShort:"펼치기",emptyRecent:"생성 히스토리가 여기에 표시됩니다.",selectRecent:"생성 히스토리 선택",deleteImageAria:"이미지 기록 삭제",deleteSequenceAria:"{count}장 시퀀스 삭제",deleteSequenceConfirm:"이 멀티모드 시퀀스의 이미지 {count}장을 삭제할까요?",sequenceDeleted:"시퀀스 이미지 {count}장을 히스토리에서 삭제했습니다"},sS={closeSettings:"설정 닫기",detailSettings:"세부 설정",toggleShow:"세부 설정 보기",toggleHide:"세부 설정 숨기기",open:"열기",close:"닫기"},rS={label:"프롬프트",refCount:"참조 {count}/{max}",refChipTitle:"참조 이미지 {n}",refChipAlt:"참조 이미지 {n}",refRemoveAria:"참조 이미지 {n} 제거",placeholder:"원하는 이미지를 설명하고, 드래그 앤 드롭이나 붙여넣기로 참조 이미지를 추가할 수 있어요...",placeholderWithRefs:"첨부한 이미지로 무엇을 만들지 설명해 주세요...",attach:"첨부",attachTitle:"참조 이미지 첨부",useCurrent:"현재 결과 사용",useCurrentTitle:"현재 결과를 참조로 사용",directMode:"Direct",directModeActive:"1:1 Direct 켜짐",directModeTitle:"프롬프트를 원문 그대로 전달 (Direct 모드)",moveBlockUp:"{name} 위로 이동",moveBlockDown:"{name} 아래로 이동",afterBlocks:"본문 프롬프트 뒤",hint:"Ctrl + Enter로 생성",dropHere:"놓아서 참조 이미지로 추가 ({max}장까지)"},cS={resultAlt:"생성 결과",imageViewerAria:"생성 이미지 뷰어. 좌우 방향키로 이전 또는 다음 이미지를 볼 수 있습니다.",tokens:"{n} 토큰",open:"캔버스 열기",openAria:"캔버스 모드에서 이미지 열기",close:"캔버스 닫기",blank:{title:"흰 캔버스",subtitle:"흰 종이에 그린 뒤 여기서 이어가세요.",create:"흰 캔버스 만들기",creating:"만드는 중...",failed:"흰 캔버스를 만들 수 없습니다"},drop:{hint:"이미지를 떨어뜨려 갤러리에 추가"},toolbar:{label:"캔버스 주석 도구",select:"선택",bgGroup:"내보내기 배경",bgAlpha:"투명",bgMatte:"단색",bgMatteColor:"단색 색상",cleanup:"배경 정리",cleanupMark:"표시",cleanupRemove:"제거",cleanupPreserve:"보존",cleanupInput:"입력",cleanupClick:"클릭",cleanupBrush:"브러시",cleanupBrushSize:"브러시",cleanupTolerance:"감도",cleanupAutoSample:"모서리",cleanupPickSeed:"배경 찍기",cleanupPickingSeed:"배경 클릭",cleanupActive:"활성",cleanupPreview:"미리보기",cleanupPreviewing:"미리보기 중...",cleanupApply:"PNG 적용",cleanupApplying:"적용 중...",cleanupReset:"초기화",cleanupSeedCount:"{n}개 seed",cleanupRemoved:"{n}% 제거",cleanupPickHint:"이미지 위 배경을 클릭하세요",cleanupBrushHint:"표시할 영역을 칠하세요",cleanupMaskHint:"보라색 영역이 제거 예정",cleanupApplied:"투명 PNG 생성됨",cleanupFailed:"배경 정리 실패",zoomGroup:"캔버스 확대/축소",zoomIn:"확대",zoomOut:"축소",zoomReset:"확대 초기화",zoomShortcutHint:"핀치 확대 · 두손가락 이동 · [ / ] · 0",pen:"펜",box:"박스",arrow:"화살표",memo:"메모",eraser:"지우개",eraserMenu:"지우개 옵션",objectEraser:"객체 지우개",brushEraser:"브러시 지우개",apply:"캔버스 버전 저장",applyDone:"캔버스 버전 저장됨",applyFailed:"캔버스 버전 저장 실패",export:"이미지 내보내기",exporting:"내보내는 중...",exportFailed:"내보내기 실패",undo:"실행 취소",redo:"다시 실행",deleteSelected:"선택 삭제",editMask:"박스 영역 편집",editMaskDisabled:"먼저 박스를 그려주세요",editMaskFailed:"마스크 편집 실패",editMaskUnsupported:"현재 이미지 제공자는 마스크 편집을 지원하지 않습니다",style:"스타일",color:"색상",strokeWidth:"선 굵기",clear:"모두 지우기"},version:{saving:"캔버스 버전 저장 중...",saved:"캔버스 버전 저장됨",failed:"캔버스 버전 저장 실패",usingAsReference:"캔버스 버전을 참조 이미지로 사용할 수 있습니다"}},uS={today:"오늘",yesterday:"어제",thisWeek:"이번 주",earlier:"이전",imageAltFallback:"생성 이미지",deleteTitle:"시스템 휴지통으로 이동",deleteAria:"이미지 삭제",ariaLabel:"이미지 갤러리",title:"갤러리",total:"총 {n}장",totalFiltered:" / 전체 {n}장",sortByAria:"정렬 기준",sortByDate:"날짜",sortBySession:"세션",favoriteFilterAria:"즐겨찾기 필터",filterAll:"전체",filterFavorites:"즐겨찾기",searchPlaceholder:"프롬프트나 파일명을 검색",searchDisabledPlaceholder:"세션 보기에서는 검색이 비활성화됩니다",closeAria:"갤러리 닫기",closeTitle:"닫기 (Esc)",sessionLabel:"세션 {name}",standalone:"독립 이미지",emptySessions:"아직 저장된 세션이 없습니다.",emptyAll:"아직 생성된 이미지가 없습니다. 먼저 하나 만들어보세요.",emptyFavorites:"아직 즐겨찾기한 이미지가 없습니다.",noResults:"검색 결과가 없습니다.",loadOlder:"이전 이미지 더 불러오기",loadingOlder:"이전 이미지 불러오는 중...",loadOlderFavorites:"이전 즐겨찾기 더 불러오기",loadingOlderFavorites:"이전 즐겨찾기 불러오는 중...",sessionPaginationHint:"세션 보기는 현재 페이지 기준입니다. 이전 이미지를 더 보려면 날짜 보기로 전환해 주세요.",loadOlderFailed:"이전 갤러리 항목을 불러오지 못했습니다.",storageNoticeTitle:"저장 위치 안내",storageNoticeRecoverable:"놀라게 해드려 죄송합니다. 최근 버전에서 갤러리 저장 위치가 설치 폴더에서 사용자 데이터 폴더로 바뀌었습니다. 예전 이미지가 이전 generated 폴더에 남아 있을 수 있어요. ima2 doctor를 실행하거나 복구 안내를 확인해 주세요.",storageNoticeNotFound:"놀라게 해드려 죄송합니다. 현재 이 컴퓨터에서 이전 generated 폴더를 찾지 못했습니다. 업데이트 중 예전 전역 설치 폴더가 교체된 경우 자동 복구가 어려울 수 있습니다. ima2 doctor와 복구 안내의 수동 검색 방법을 확인해 주세요.",storageNoticeUnknown:"저장 위치 상태를 확인하지 못했습니다. 업데이트 후 갤러리가 비어 보인다면 ima2 doctor로 이미지 폴더를 확인해 주세요.",openGeneratedDir:"폴더 열기",openGeneratedDirTitle:"생성 이미지 폴더 열기",cardNewsSet:"카드뉴스 세트",cardNewsCard:"카드뉴스 카드",openCardNewsSet:"세트 열기",openCardNewsSetFailed:"카드뉴스 세트를 열지 못했습니다.",copyCardNewsSetPath:"경로 복사",cardNewsPathCopied:"카드뉴스 세트 경로를 복사했습니다.",downloadCardNewsManifest:"매니페스트",cardNewsCount:"{n}장",deleted:"삭제됨: {filename}",undo:"되돌리기",secondsSuffix:"{n}초",permanentDeleted:"완전 삭제됨: {filename}",movedToSystemTrash:"시스템 휴지통으로 이동됨: {filename}",deleteFailed:"이미지를 삭제하지 못했습니다.",restoreFailed:"이미지를 복구하지 못했습니다.",favoriteTitle:"즐겨찾기 추가",unfavoriteTitle:"즐겨찾기 해제",favoriteAria:"즐겨찾기 추가",unfavoriteAria:"즐겨찾기 해제",scopeAria:"갤러리 범위",scope:{current:"현재 세션",all:"전체 이미지"},empty:{currentSession:"이번 세션에는 아직 이미지가 없습니다."}},dS={empty:"비어 있음",pending:"생성 중",reconciling:"동기화 중",reconcilingPhase:"동기화 중 · {phase}",ready:"완료 · {elapsed}s",readyWithSearch:"완료 · {elapsed}s · 검색 {searches}",stale:"오래된 상태",staleWithError:"오래된 상태: {error}",assetMissing:"에셋 누락",assetMissingWithError:"에셋 누락: {error}",error:"오류: {error}",errorUnknown:"알 수 없음",nodeImageAlt:"노드 이미지",partialImageAlt:"노드 중간 이미지 미리보기",noAsset:"에셋 없음",stateStale:"상태 오래됨",noImage:"이미지 없음",editPromptPlaceholder:"수정 프롬프트...",promptPlaceholder:"프롬프트...",regenerate:"재생성",newVariation:"새 변형",generate:"생성",generateTitle:"노드 이미지 생성",addChild:"자식",addChildTitle:"자식 노드 추가",duplicateBranch:"복제",duplicateBranchTitle:"새 브랜치 루트로 복제",deleteTitle:"삭제",regenerateTitle:"현재 노드 이미지를 제자리에서 다시 생성",newVariationTitle:"같은 부모 아래 새 변형 노드를 생성",parentImageRequired:"부모 이미지를 먼저 생성해야 합니다.",attachRef:"첨부",attachRefTitle:"노드 참조 이미지 첨부",refAlt:"노드 참조 이미지 {n}",removeRef:"참조 이미지 {n} 제거",dropRefs:"이미지를 여기에 놓기",nodeRefsUnsupportedForEdit:"추가 참조 이미지는 현재 루트 노드에서만 지원합니다.",nodeRefsUsedWithParent:"부모 이미지와 함께 참조로 사용됩니다.",classicRefsParkedTitle:"클래식 참조 이미지가 보관 중입니다",classicRefsParkedBody:"이 이미지는 클래식 작성창용이라 노드 모드 생성에는 사용되지 않습니다.",clearParkedRefs:"보관된 참조 비우기"},fS={selectionOn:"선택중",selectionOff:"선택",selectAll:"전체",summary:"선택 {selected} · 미생성 {missing} · 영향 {stale}",generateMissing:"미생성",regenerateSelected:"재생성",stopRemaining:"중단",stopping:"중단중",clear:"해제",noneSelected:"선택된 노드가 없습니다.",parentRequired:"부모 이미지가 준비되지 않은 선택 노드가 {count}개 있습니다.",nothingToRun:"생성할 선택 노드가 없습니다.",stopQueued:"현재 노드가 끝나면 남은 작업을 중단합니다.",failed:"{done}/{total} 완료 후 중단되었습니다.",finished:"{done}/{total} 노드 작업 완료",staleBecauseParentChanged:"상위 노드가 재생성되어 다시 확인이 필요합니다."},mS={disconnect:"끊기",disconnectTitle:"선택한 연결선 끊기",disconnected:"연결선을 끊었습니다.",parentConflict:"한 노드에는 부모 연결을 하나만 둘 수 있습니다."},pS={authTitle:"인증 방식",apiLabel:"API 키",oauthNotReady:"OAuth 프록시가 아직 준비되지 않았습니다.",codexLoginRequired:"Codex 로그인이 필요합니다.",codexLoginHint:"터미널에서 `codex login`을 실행한 뒤 이 페이지를 새로고침하세요.",oauthStarting:"OAuth 프록시가 시작 중입니다. 몇 초 후 다시 시도하세요.",serverUnreachable:"서버에 연결할 수 없습니다. 백엔드가 실행 중인지 확인하세요.",apiInvalid:"API 키가 없거나 유효하지 않습니다. 서버의 .env 파일에서 OPENAI_API_KEY를 확인하세요.",availableTitle:"{name} 사용 가능",availableAria:"{name}: 사용 가능",unavailableAria:"{name}: 사용 불가",availableSr:"(사용 가능)",unavailableSr:"(사용 불가)"},hS={free:"무료",approx:"약 ${amount}",multimodeApprox:"최대 약 ${amount} ({count}장)",label:"예상 비용"},gS={download:"다운로드",copyImage:"이미지 복사",copyPrompt:"프롬프트 복사",continueHere:"여기서 이어서",continueHereTitle:"이 이미지의 프롬프트를 가져와 이어서 작업",firstNode:"첫 노드",firstNodeTitle:"이 이미지를 Node Mode의 준비된 첫 노드로 보냅니다",delete:"삭제",deleteTitle:"휴지통으로 이동",more:"더보기",sendToComfyUI:"ComfyUI로 보내기",sendToComfyUITitle:"이 저장된 이미지를 로컬 ComfyUI로 업로드",permanentDelete:"완전 삭제",permanentDeleteConfirm:'"{filename}" 이미지를 완전히 삭제할까요? 이 작업은 되돌릴 수 없습니다.'},yS={switchTitle:"세션 전환",loading:"불러오는 중...",newSession:"새 세션",newSessionTitle:"새 세션",renameTitle:"이름 변경",renamePrompt:"세션 이름",deleteTitle:"삭제",deleteConfirm:'"{title}" 세션을 삭제할까요? 이 작업은 되돌릴 수 없습니다.',empty:"아직 세션이 없습니다",firstGraph:"첫 번째 그래프",untitled:"제목 없는 세션",assetAbortedError:"생성이 정상적으로 끝나지 않았습니다. 이 노드에서 다시 시도하세요."},vS={ariaLabel:"UI 모드",classic:"기본",node:"노드",cardNews:"카드뉴스",agent:"에이전트"},bS={workspace:"에이전트 작업공간",title:"에이전트",newSession:"새 에이전트",sessions:"세션",openSessions:"세션 열기",closeSessions:"세션 닫기",sessionSearch:"세션 검색",renameSession:"세션 이름 바꾸기",deleteSession:"세션 삭제",deleteConfirm:'"{title}" 세션을 삭제할까요?',imageCount:"{count}장",compacted:"컴팩트됨",web:"웹",chat:"채팅",user:"사용자",assistant:"에이전트",tool:"도구",toolExpand:"도구 상세 펼치기",toolCollapse:"도구 상세 접기",toolImageCount:"{count}장",toolCallCount:"{count}개 호출",toolGroup:"도구 실행",toolInput:"입력",toolOutput:"출력",toolArtifacts:"결과물",requestId:"요청 ID",duration:"소요 시간",toolStatus:{queued:"대기",running:"실행 중",complete:"완료",error:"오류"},rightSidebar:"에이전트 사이드 도구",sidebarTabs:{image:"이미지",library:"라이브러리",forms:"양식",quality:"품질",model:"모델",queue:"큐"},modelSettings:"모델 설정",closeModelSettings:"모델 설정 닫기",openModelSettings:"모델 설정 열기",model:"모델",provider:"프로바이더",reasoningEffort:"추론",generationStrategy:"생성 계획",generationStrategyAuto:"사용자 요청 기준",generationStrategyManual:"고정 개수",quality:"품질",size:"크기",format:"포맷",moderation:"모더레이션",variantsCount:"변형 수",maxAutoVariants:"자동 최대",parallelism:"병렬 수",promptLibrary:"프롬프트 라이브러리",forms:"양식",noForms:"양식 템플릿이 없습니다",insertPrompt:"삽입",queue:"큐",runningShort:"실행",queuedShort:"대기",queueEmpty:"대기 중인 에이전트 작업이 없습니다.",cancelQueue:"취소",retryQueue:"재시도",sessionRunning:"생성 실행 중",sessionQueued:"{count}개 대기",sessionError:"생성 오류",queueStatus:{queued:"대기",running:"실행 중",succeeded:"완료",failed:"실패",canceled:"취소됨"},statusReady:"준비됨",statusGenerating:"생성 중",statusReconnecting:"연결 복구 중",pending:"이미지를 생성하는 중...",composerPlaceholder:"만들 이미지를 입력하세요",slashCommands:"에이전트 슬래시 명령",slashDesc_question:"이미지 생성 없이 질문",slashDesc_variants:"N개 이미지 변형 생성 (1-8)",slashDesc_generate:"bounded fanout 생성 (1-8)",slashDesc_parallelism:"동시 실행 제한",slashDesc_help:"사용 가능한 명령어 도움말",attachReference:"참조 첨부",send:"전송",webSearch:"검색 사용",emptyChat:"메시지를 입력하면 이미지 작업이 시작됩니다.",imagePane:"이미지",currentImage:"현재 이미지",openImage:"이미지 열기",closeImage:"이미지 닫기",selectImage:"이미지 포커스",variants:"변형",contextTabs:"이미지 컨텍스트",imageTab:"이미지",refsTab:"참조",webTab:"웹 근거",memoryTab:"기억",noImage:"현재 이미지 없음",noRefs:"참조 없음",noWeb:"웹 근거 없음",memoryItemStyle:"스타일 잠금은 이미지 컨텍스트에 보존됩니다.",memoryItemSubject:"피사체 잠금은 재개 후에도 복원됩니다.",imageAlt:"에이전트 이미지",filename:"파일",prompt:"프롬프트"},SS={workspace:"카드뉴스 작업공간",composer:"카드뉴스",composerHint:"템플릿은 스냅샷 기준이고, 출력 크기는 별도로 지정합니다.",topic:"주제",topicPlaceholder:"예: 중간고사 역전 플랜",audience:"대상",audiencePlaceholder:"예: 학부모",goal:"목표",goalPlaceholder:"예: 상담 신청",brief:"내용",briefPlaceholder:"카드뉴스에 들어갈 핵심 내용과 금지사항을 적어주세요.",outputSize:"출력 크기",customSize:"직접",draft:"초안 만들기",drafting:"초안 작성 중...",generateSet:"세트 생성",batchGenerate:"일괄 생성",generating:"생성 중...",generated:"{count}장 생성 완료.",missingGeneratedCard:"생성 응답에 이 카드가 포함되지 않았습니다.",error:"카드 생성에 실패했습니다.",imageTemplate:"이미지 템플릿",roleTemplate:"카드 구조",newTemplateLater:"커스텀 템플릿은 dev MVP 이후에 지원합니다",emptyTitle:"초안 대기 중",emptyBody:"왼쪽 설정으로 카드 덱을 준비합니다.",inspector:"카드 편집",cardTitle:"카드 제목",headline:"제목",body:"본문",visualPrompt:"이미지 프롬프트",summaryCopy:"요약 문구",designPrompt:"장면 / 디자인 프롬프트",textFields:"텍스트 박스",addTextField:"텍스트 박스 추가",removeTextField:"삭제",noTextFields:"아직 텍스트 박스가 없습니다.",textFieldText:"텍스트",textKind:"종류",placement:"위치",renderMode:"표시 방식",hierarchyLabel:"위계",textTooLong:"권장 길이를 초과했습니다.",selectTextField:"텍스트 박스 선택: {text}",textKinds:{headline:"제목",body:"설명 텍스트",caption:"캡션",cta:"행동 유도",badge:"배지",number:"숫자"},renderModes:{"in-image":"이미지에 표시","ui-only":"메모만"},hierarchy:{primary:"주요",secondary:"보조",supporting:"부가"},placements:{"top-left":"좌측 상단","top-center":"상단 중앙","top-right":"우측 상단","center-left":"좌측 중앙",center:"중앙","center-right":"우측 중앙","bottom-left":"좌측 하단","bottom-center":"하단 중앙","bottom-right":"우측 하단",free:"직접 지정"},roles:{cover:"표지",hook:"후킹",problem:"문제",insight:"인사이트",example:"예시",data:"데이터",summary:"요약",cta:"행동 유도"},locked:"잠김",unlocked:"열림",noCard:"선택된 카드 없음",generatedMeta:"생성 메타데이터",lockedHelp:"잠긴 카드는 일괄 생성과 재시도에서 제외됩니다.",retryCard:"이 카드 재시도",actions:{copyPrompt:"프롬프트 복사",copyCopy:"문구 복사",openImage:"이미지 열기",downloadCard:"다운로드"},status:{draft:"초안",queued:"대기",generating:"생성 중",generated:"완료",error:"오류",skipped:"제외",locked:"잠김"},progress:{generating:"생성 중 {done}/{total}",summary:"완료 {done}/{total}",detail:"대기 {queued} · 오류 {errors} · 제외 {skipped}",cardGenerating:"이 카드를 생성 중입니다."},planner:{structured:"구조화 JSON",jsonMode:"JSON 모드",repaired:"보정됨",fallback:"기본 초안",jsonOnlyHelp:"초안은 JSON만 만들고 이미지는 나중에 생성합니다.",error:"초안 생성 실패"}},xS={appName:"이미지 생성기",imageModelLabel:"모델",imageModelAria:"이미지 모델 선택",quickSettingsAria:"모델과 추론 강도 선택. 현재 모델 {model}, 추론 {effort}",quickSettingsMenu:"모델 및 추론 빠른 설정",reasoningLabel:"추론",nodeModeHint:"노드 모드에서는 노드를 눌러 프롬프트를 수정한 뒤 생성하세요. 오른쪽 패널의 설정 (품질/크기)은 새로 만드는 모든 결과에 적용됩니다."},ES={openAria:"설정 열기",openTitle:"설정",closeAria:"설정 닫기",closeTitle:"캔버스로 돌아가기",navAria:"설정 섹션",contentAria:"설정 내용",jumpTo:"{section} 섹션으로 이동",eyebrow:"작업공간 설정",title:"설정",subtitle:"계정, 화면, 앞으로 늘어날 작업공간 옵션을 이곳에 모아 생성 흐름은 가볍게 유지합니다.",sections:{account:{title:"계정",hint:"OAuth 상태"},generation:{title:"생성",hint:"모델 기본값"},appearance:{title:"화면",hint:"라이트/다크"},workspace:{title:"작업공간",hint:"프로필"},language:{title:"언어",hint:"UI 문구"},future:{title:"예정",hint:"확장 공간"}},account:{primaryEyebrow:"현재 공급자",oauthTitle:"OAuth 사용 중",oauthBody:"OAuth 생성은 Codex OAuth 세션으로 실행됩니다. 유효한 키가 설정되어 있으면 API-Key 모드로 전환할 수 있습니다.",apiSourceEnv:"OPENAI_API_KEY 감지됨",apiSourceConfig:"config.json API 키 감지됨",apiTitle:"API 키 공급자 사용 가능",apiBody:"ima2-gen은 이 API 키로 Responses API 기반 생성, 편집, 멀티모드, 노드 요청을 처리할 수 있습니다.",apiDisabled:"사용 불가",apiReady:"준비됨",apiUnavailable:"사용 불가",apiUnknown:"상태 불명"},imageModel:{title:"이미지 모델",body:"앞으로 생성 요청에 사용할 OAuth 이미지 모델을 선택합니다.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",gpt53CodexSpark:"GPT-5.3 Codex Spark — 이미지 생성 미지원",unsupportedHelp:"기본값은 GPT-5.4 Mini입니다. GPT-5.3 Codex Spark는 OAuth 모델 상태에 보일 수 있지만 image_generation 도구를 지원하지 않습니다."},reasoning:{title:"추론 강도",body:"값이 높을수록 생성 전에 plan/검색/프롬프트 보강에 더 많은 reasoning 토큰을 사용합니다.",none:"Off — 추가 추론 없음",low:"Low — 가장 빠름, 추론 최소",medium:"Medium — 기본 균형값",high:"High — 더 깊은 리서치와 통합",xhigh:"Xhigh — 최대 추론, 가장 느림"},webSearch:{title:"웹서치",body:"실존 인물, 브랜드, 제품, 장소, 최신 이벤트를 생성 전에 실시간 검색해서 반영합니다.",on:"검색 켬",off:"검색 끔"},gallery:{defaultScopeTitle:"기본 갤러리 보기",defaultScopeBody:"갤러리를 열 때 처음 보여줄 범위를 선택합니다."},appearance:{themeTitle:"테마",themeBody:"이 기기에서 사용할 테마 스타일과 밝기를 선택합니다.",historyStripLayoutTitle:"히스토리 썸네일",historyStripLayoutBody:"작업공간 옆 작은 히스토리 배열 방식을 고릅니다.",historyStripLayout:{rail:"세로",horizontal:"상단 가로",sidebar:"사이드바"}},language:{title:"언어",body:"생성 프롬프트와 무관하게 인터페이스 언어만 바꿉니다."},future:{title:"나중을 위한 자리",body:"OAuth 복구 도구나 작업공간 옵션이 실제로 필요해지면 이곳에 추가합니다."}},TS={loading:"세션 불러오는 중...",addFirst:"+ 첫 노드 추가",addRootTitle:"루트 노드 추가",hint:"핸들을 빈 공간으로 드래그하면 새 브랜치가 생깁니다. Delete 또는 Backspace로 삭제할 수 있습니다."},NS={title:"{provider} 사용 불가",ariaLabel:"{provider} 사용 불가"},_S={label:"언어",ko:"한국어",en:"English"},CS={label:"테마",modeLabel:"밝기",styleLabel:"테마 스타일",system:"시스템",dark:"다크",light:"라이트",family:{default:"기본",gpt:"GPT",claude:"Claude",gemini:"Gemini",grok:"Grok"}},wS={close:"닫기",details:"자세한 원본 오류 보기",unknown:{title:"알 수 없는 오류가 발생했어요",body:"잠시 후 다시 시도해 주세요. 문제가 계속되면 원본 오류 메시지를 복사해 제보해 주세요."},moderationRefused:{title:"프롬프트가 모더레이션에 걸렸어요",body:"표현 수위를 낮추거나 다른 문구로 바꿔 보세요. 레퍼런스 이미지의 선정적/폭력적 요소도 영향을 줄 수 있어요.",cta:"프롬프트 수정"},emptyResponse:{title:"이미지가 돌아오지 않았어요",body:"Codex가 응답을 보냈지만 이미지 데이터가 비어 있었어요. 모더레이션 문제가 아니라 일시적 오류이거나 지원되지 않는 옵션 조합일 수 있어요. 다시 시도하거나 크기·품질·모델을 바꿔 보세요.",cta:"다시 시도"},streamParseFailed:{title:"이미지 응답 스트림을 해석하지 못했어요",body:"응답 데이터는 도착했지만 앱이 이미지 스트림을 끝까지 읽지 못했어요. 네트워크 프록시나 일시적인 스트림 오류일 수 있어요.",cta:"다시 시도"},imageToolNotCalled:{title:"이미지 도구가 호출되지 않았어요",body:"응답은 완료됐지만 이미지 생성 도구 호출이 확인되지 않았어요. 같은 프롬프트로 다시 시도하거나 모델/검색 옵션을 바꿔 보세요.",cta:"다시 시도"},webSearchOnlyResponse:{title:"이미지 도구가 호출되지 않았어요",body:"웹 검색 도구만 호출되고 이미지 생성 도구가 실행되지 않았어요. 검색 옵션을 끄거나 다시 시도해 주세요.",cta:"다시 시도"},imageToolFailed:{title:"이미지 도구 호출이 실패했어요",body:"이미지 생성 도구가 호출됐지만 실패 상태로 끝났어요. 문제가 반복되면 `ima2 doctor image-probe --json` 결과와 함께 제보해 주세요.",cta:"다시 시도"},imageToolNoResult:{title:"이미지 데이터가 비어 있었어요",body:"이미지 도구 호출은 완료됐지만 결과 이미지가 포함되지 않았어요. 옵션 조합이나 계정 권한 문제일 수 있어요.",cta:"다시 시도"},oauthImageCapabilityUnavailable:{title:"현재 계정에서 이미지 도구를 사용할 수 없는 것 같아요",body:"OAuth 로그인은 되어 있지만, 이 계정/모델 조합에서 이미지 생성 도구 권한이 없을 수 있어요. API-Key 모드나 다른 모델로 확인해 주세요.",cta:"확인"},responsesStreamError:{title:"이미지 응답 스트림이 오류로 종료됐어요",body:"OpenAI 응답 스트림에서 오류 이벤트가 반환됐어요. 잠시 후 다시 시도하고, 반복되면 원본 오류 세부 정보를 확인해 주세요.",cta:"다시 시도"},upstream5xx:{title:"OpenAI 서버가 혼잡합니다",body:"잠시 후 다시 시도하면 대부분 해결돼요. 상태 페이지(status.openai.com)도 확인해 보세요.",cta:"다시 시도"},authChatgptExpired:{title:"Codex ChatGPT 로그인이 만료됐어요",body:"터미널에서 `npx @openai/codex login`을 다시 실행한 뒤 앱을 새로고침해 주세요.",cta:"새로고침"},authApiKeyInvalid:{title:"API 키 인증 실패",body:"키가 없거나 잘못됐거나, 한도/조직 권한 문제가 있을 수 있어요. OAuth로 전환하거나 설정된 API 키를 갱신해 주세요.",cta:"확인"},networkFailed:{title:"네트워크 연결 실패",body:"OpenAI 또는 로컬 런타임 서비스에 연결하지 못했어요. 먼저 새로고침하고, 계속되면 VPN/방화벽과 `ima2 doctor`에 표시되는 포트를 확인해 주세요.",cta:"새로고침"},oauthUnavailable:{title:"OAuth 프록시를 사용할 수 없어요",body:"OAuth 프록시가 아직 시작 중이거나, 사용할 수 없거나, fallback 포트로 이동했을 수 있어요. 먼저 새로고침하고, 계속되면 `ima2 doctor`의 OAuth URL을 확인해 주세요.",cta:"새로고침"},invalidRequest:{title:"이미지 요청을 수정해야 해요",body:"생성 요청의 일부 값이 올바르지 않습니다. 아래 원본 오류를 확인한 뒤 프롬프트나 크기를 수정해 다시 시도해 주세요.",cta:"입력 수정"},apikeyDisabled:{title:"API-Key 모드를 사용할 수 없어요",body:"이 빌드는 API-Key 생성을 지원하지만 현재 요청에서 설정된 키를 사용할 수 없었습니다. OAuth로 전환하거나 API 키를 갱신해 주세요.",cta:"확인"}},AS={title:"프롬프트 라이브러리",saveTitle:"프롬프트 라이브러리에 저장",save:"저장",saved:"프롬프트를 저장했습니다",saveFailed:"저장에 실패했습니다",name:"이름",tags:"태그",search:"프롬프트 검색...",favorites:"즐겨찾기",load:"불러오기",insert:"삽입",inserted:"프롬프트를 삽입했습니다",removeInserted:"삽입한 프롬프트 {name} 제거",favorite:"즐겨찾기",unfavorite:"즐겨찾기 해제",empty:"저장된 프롬프트가 없어요.",content:"내용",copy:"복사",untitled:"제목 없음",addNew:"새 프롬프트 추가",import:"불러오기",importFiles:".txt, .md, .markdown 또는 GitHub 파일 불러오기",dropImport:".txt, .md, .markdown 파일을 놓으면 프롬프트로 가져옵니다",importTitle:"프롬프트 가져오기",importDropTitle:"파일을 여기에 드래그하세요",importDropHint:".txt, .md, .markdown 파일을 preview한 뒤 저장합니다",importChooseFiles:"파일 선택",importGithubLabel:"GitHub 파일 URL 또는 경로",importPreview:"미리보기",importPreviewEmpty:"파일을 드래그하거나 GitHub 경로를 입력하면 후보가 표시됩니다.",importCommit:"선택 항목 저장",importSelected:"선택한 프롬프트 불러오기 ({count})",importThisPrompt:"이 프롬프트 불러오기",previewPrompt:"내용 보기",selectPrompt:"선택",selectedPrompt:"선택됨",selectedCount:"{count}개 선택됨",selectAllCandidates:"전체 선택",clearCandidateSelection:"선택 해제",addAnotherSource:"다른 소스 추가",searchResultsHeader:"검색 결과 ({count}개)",searchResults:"검색 결과",promptText:"프롬프트 내용",importSelectAtLeastOne:"저장할 프롬프트를 하나 이상 선택하세요.",imported:"프롬프트 {count}개를 가져왔습니다",importFailed:"가져오기에 실패했습니다",importNoValidFiles:".txt, .md, .markdown 프롬프트 파일이 없습니다.",curatedSources:"추천 소스",curatedSourcesHint:"검토된 공개 프롬프트 소스 검색",curatedSearch:"검색",curatedSearchPlaceholder:"nano banana, gpt-image-2, typography...",refreshSource:"갱신",curatedRefreshed:"프롬프트 후보 {count}개를 인덱싱했습니다",sourceTrustTier:"소스 신뢰도",requiresAttribution:"출처 표시 필요",sourceDetails:"출처",license:"라이선스",attributionRequired:"출처 표기 필요",modelHints:"모델 힌트",taskHints:"작업 힌트",warnings:"경고",compatibilityWarnings:"호환성 경고",transparentUnsupportedGptImage2:"gpt-image-2는 투명 배경을 지원하지 않습니다",noCuratedResults:"추천 소스에서 프롬프트 후보를 찾지 못했습니다.",discovery:"발견",discoverySearch:"GitHub 검색",discoverySearchPlaceholder:"프롬프트 저장소 검색...",discoveryCandidates:"발견 후보",discoveryApprove:"승인",discoveryReject:"거절",discoveryApproved:"승인됨",discoveryRejected:"거절됨",discoveryScore:"점수",discoveryWarnings:"발견 경고",discoveryRateLimited:"GitHub discovery가 rate limit에 걸렸습니다.",discoveryNoResults:"발견 후보가 없습니다.",discoveryReviewQueue:"검토 대기열",discoveryRequiresPaths:"기본 검색 전에 검토된 파일 경로를 추가하세요.",folderBrowse:"폴더 보기",folderBrowseHint:"GitHub 폴더의 지원 파일만 불러옵니다",folderFiles:"폴더 파일",folderFilesEmpty:"가져올 수 있는 .md / .markdown / .txt 파일이 없습니다",folderPreviewSelected:"선택 파일 미리보기",folderSelectedCount:"{count}개 선택됨",folderWarnings:"폴더 경고",folderTooManyFiles:"파일이 너무 많아 일부만 표시했습니다",folderNoSelection:"미리볼 파일을 선택하세요",folderUnsupported:"GitHub 폴더만 지원합니다"},MS={title:"프롬프트 빌더",subtitle:"맥락을 이어가며 최종 프롬프트를 정리합니다.",scopeDraft:"새 작업",scopeImage:"선택 이미지: {name}",scopeImageFallback:"현재 이미지",newWorkTitle:"이미지 컨텍스트 없이 새 작업 시작",model:"빌더 모델",empty:"원하는 방향을 말해보세요. 현재 프롬프트와 설정을 함께 참고합니다.",user:"나",assistant:"빌더",placeholder:"어떤 이미지를 만들어볼까요?",send:"전송",sending:"작성 중",thinking:"프롬프트를 정리하는 중...",clear:"비우기",applyToPrompt:"본문에 적용",insertAsBlock:"블록 삽입",finalKoreanPrompt:"한국어 프롬프트",finalEnglishPrompt:"영어 프롬프트",blockName:"빌더 제안",applied:"빌더 제안을 본문 프롬프트에 적용했습니다",inserted:"빌더 제안을 프롬프트 블록으로 삽입했습니다",failed:"프롬프트 빌더 호출에 실패했습니다",removeScopeImage:"빌더에서 선택 이미지 제외",removeAttachment:"첨부 {name} 제거",attach:"파일 첨부",attachmentOnlyMessage:"첨부한 파일을 참고해서 프롬프트를 도와줘"},RS={sectionTitle:"작업 공간",sectionBody:"작업 공간 레이아웃 프로필을 선택합니다.",profileLabel:"작업 공간 프로필",defaultLabel:"기본",defaultDesc:"사이드바 컴포저가 있는 기본 생성 흐름.",promptStudioLabel:"프롬프트 스튜디오",promptStudioDesc:"프롬프트 빌더 패널, 그룹 히스토리, 향상된 뷰어."},OS={controls:"이미지 확대 컨트롤",zoomIn:"확대",zoomOut:"축소",reset:"확대 초기화"},jS={common:Fb,appBar:Yb,sheet:Kb,toast:Vb,inflight:Xb,size:Qb,sizeConfirm:Zb,quality:Jb,moderation:$b,format:Wb,count:eS,multimode:tS,metadata:aS,readiness:nS,generate:lS,billing:iS,history:oS,panel:sS,prompt:rS,canvas:cS,gallery:uS,node:dS,nodeBatch:fS,edge:mS,provider:pS,cost:hS,result:gS,session:yS,uiMode:vS,agent:bS,cardNews:SS,sidebar:xS,settings:ES,nodeCanvas:TS,apiDisabled:NS,language:_S,theme:CS,errorCard:wS,promptLibrary:AS,promptBuilder:MS,workspace:RS,viewer:OS},zS={ok:"OK",cancel:"Cancel",delete:"Delete",close:"Close",saving:"Saving...",loading:"Loading..."},IS={modeImage:"Image",settings:"Settings",controls:"Generation controls",generate:"Generate",generateAria:"Open prompt sheet to generate an image"},DS={close:"Close prompt sheet",generate:"Generate image",controlsOpen:"Open generation controls",tabs:{prompt:"Prompt",controls:"Controls",library:"Library"}},LS={localImportSuccess:"Image added to gallery",localImportFailed:"Failed to import image",localImportInvalid:"Only PNG, JPEG, or WebP is supported",localStorageFull:"Local storage is full — recent state may not persist.",refLimitExceeded:"References are capped at 5. Extra images were dropped.",refTooLarge:"Image is too large. Convert to JPEG/PNG or lower the resolution and try again.",refNotBase64:"Image file is corrupted or uses an unsupported encoding.",refEmpty:"Empty image file. Please pick a different file.",refHeicUnsupported:"HEIC/HEIF is not supported. Convert to JPEG or PNG and try again.",noCurrentImageForRef:"No current image to use as reference.",refSlotFull:"Reference slots are full (max 5).",currentImageLoadFailed:"Failed to load current image.",addedCurrentAsRef:"Added current image as a reference.",sessionLoadFailed:"Failed to load session.",sessionCreateFailed:"Failed to create session.",sessionRenameFailed:"Failed to rename session.",sessionDeleteFailed:"Failed to delete session.",promptRequired:"Enter a prompt.",nodeCreated:"Node {id} created ({elapsed}s)",nodeRootCreated:"Created a first node from this image.",nodeCreateFailed:"Node generation failed.",generatedBatch:"Generated {count} images in {elapsed}s.",generatedSingle:"Generated in {elapsed}s.",generateFailed:"Generation failed.",sessionReloadedElsewhere:"Graph version changed, so the latest graph was reloaded.",promptCopied:"Prompt copied",imageCopied:"Copied to clipboard",copyFailed:"Copy failed",openGeneratedDirFailed:"Could not open the image folder. Run ima2 doctor to check the storage path.",openGeneratedDirOpened:"Opened the generated image folder.",noPromptToFork:"No prompt to fork",forkStarted:"Prompt imported. Edit and generate again.",forkStartedNoPrompt:"Image attached as reference. Type a prompt and generate.",comfyExported:"Sent to ComfyUI as {filename}.",comfyExportInvalidUrl:"ComfyUI URL must be a local HTTP address.",comfyExportInvalidImage:"This saved image cannot be sent to ComfyUI.",comfyExportImageNotFound:"Saved image file was not found.",comfyExportFailed:"Could not upload image to ComfyUI.",cancelFailed:"Could not cancel generation."},qS={queued:"Queued",streaming:"Generating",decoding:"Finalizing",canceling:"Canceling",noPrompt:"No prompt",cancelAria:"Cancel generation: {prompt}"},HS={title:"Size",width:"Width",height:"Height",hint:"16px steps, max edge 3840, ratio up to 3:1, 655K–8.29M pixels",autoLabel:"Auto",autoSub:"Model pick",customLabel:"Custom",customSub:"Free form",customPlus:"+ Custom",customSlots:"Saved sizes",customSlot:"Custom",customSlotLimit:"Up to 3 custom sizes",saveCustomSlot:"Save custom size",replaceCustomSlot:"Replace slot",ratioFree:"Free",ratio21x9:"21:9",normalizedPreview:"Will send",noAdjustment:"No adjustment",squareMaxHint:"Square maximum is {size} because of the 8.29M pixel limit.",adjustedReasons:{snap:"snapped to 16px",maxEdge:"max edge",ratio:"ratio limit",minPixels:"minimum pixels",maxPixels:"maximum pixels",min:"minimum edge",max:"maximum edge",pixels:"pixel limit"}},kS={title:"Size adjustment required",body:"The requested size is outside the image generation limits.",requested:"Requested size",adjusted:"Adjusted size",approve:"Approve and generate",cancel:"Cancel",reasonRatio:"The ratio exceeds the 3:1 limit.",reasonPixels:"The maximum pixel limit is exceeded.",reasonMinPixels:"The requested image has too few pixels.",reasonMin:"The size is below the minimum.",reasonMax:"The size is above the maximum.",reasonSnap:"The size must align to 16px increments."},GS={title:"Quality",lowLabel:"Low",lowSub:"Fast",mediumLabel:"Medium",mediumSub:"Balanced",highLabel:"High",highSub:"Best"},US={title:"Moderation",autoLabel:"Auto",autoSub:"Standard filter",lowLabel:"Low",lowSub:"Relaxed filter",explain:"Auto uses the standard safety filter. Low relaxes limits so borderline prompts may pass through."},BS={title:"Format"},PS={title:"Count",customPlus:"+n",customLabel:"Custom count",highCountHint:"Higher counts can take longer with references or high quality.",minMaxHint:"Use 1–8 images.",decrease:"Decrease count",increase:"Increase count"},FS={label:"Multimode",tooltip:"Generate a staged sequence from one prompt",shortHint:"one prompt sequence",maxStages:"Max stages",highCountHint:"Higher stage counts can take several minutes.",minMaxHint:"Use 1–8 stages.",composerBadge:"Sequence · up to {count}",composerAriaLabel:"Multimode prompt composer, up to {count} separate images",promptPlaceholder:"Describe the sequence. The app will ask for separate images, not a collage.",promptPlaceholderWithRefs:"Describe the staged sequence using the attached references.",toggleDisabledGenerating:"Wait for the current generation to finish",sequenceTitle:"Multimode sequence",sequenceProgress:"{returned}/{requested} images",stageLabel:"Stage {index}",generating:"Generating...",partialAlt:"Partial multimode preview",partial:"Generated {returned}/{requested} images in {elapsed}s.",complete:"Generated {returned}/{requested} images in {elapsed}s.",notReturned:"Not returned",empty:"No image returned",error:"Generation failed",canceled:"Canceled",cancel:"Cancel"},YS={restoreTitle:"Restore image settings",restoreBody:"This image contains ima2 generation metadata. Apply its prompt and settings, or attach it as a reference only.",applySettings:"Apply settings",useAsReferenceOnly:"Reference only",noMetadata:"No ima2 metadata found.",invalidMetadata:"Invalid image metadata.",unsupportedFormat:"Only PNG, JPEG, and WebP metadata can be restored.",readFailed:"Could not read image metadata.",applied:"Image settings restored.",sourceXmp:"XMP",sourcePngComment:"PNG comment",imageAlt:"Dropped image preview",prompt:"Prompt",size:"Size",quality:"Quality",model:"Model",source:"Source"},KS={title:"Generation readiness",open:"Check readiness",openTitle:"Check provider, auth, model, and web-search readiness",settingsTitle:"Generation readiness",settingsBody:"Open a compact popup with provider, auth, model, reasoning, and web-search state.",ready:"Ready to generate",readyBody:"The selected provider is available.",blocked:"Provider needs attention",provider:"Provider",model:"Model",reasoning:"Reasoning",webSearch:"Web search",openAccount:"Open account settings"},VS={button:"Generate",buttonLoading:"Generating ({n})"},XS={label:"API Status",checking:"Checking...",offline:"Offline",remaining:"${remaining} remaining",thisMonth:"${amount} this month",oauthFree:"OAuth · free via codex",apiDisabled:"API key ready",apiReady:"API key ready",oauthMode:"OAuth mode"},QS={openGalleryAria:"Open gallery",openGalleryTitle:"Open full gallery",openGalleryShort:"All",galleryCard:"Open gallery",recentTitle:"Recent Generations",collapseRecent:"Collapse recent generations",expandRecent:"Expand recent generations",collapseRecentShort:"Hide",expandRecentShort:"Show",emptyRecent:"Generated images will appear here.",selectRecent:"Select generated image",deleteImageAria:"Delete image from history",deleteSequenceAria:"Delete {count}-image sequence",deleteSequenceConfirm:"Delete all {count} images in this multimode sequence?",sequenceDeleted:"Deleted {count} sequence images from history"},ZS={closeSettings:"Close settings",detailSettings:"Settings",toggleShow:"Show settings",toggleHide:"Hide settings",open:"Open",close:"Close"},JS={label:"Prompt",refCount:"Refs {count}/{max}",refChipTitle:"Reference {n}",refChipAlt:"Reference {n}",refRemoveAria:"Remove reference {n}",placeholder:"Describe the image you want. Drag & drop or paste to attach reference images...",placeholderWithRefs:"Describe what to do with the attached images...",attach:"Attach",attachTitle:"Attach reference images",useCurrent:"Use current",useCurrentTitle:"Use current result as a reference",directMode:"Direct",directModeActive:"1:1 Direct on",directModeTitle:"Pass prompt through verbatim (Direct mode)",moveBlockUp:"Move {name} up",moveBlockDown:"Move {name} down",afterBlocks:"After main prompt",hint:"Ctrl + Enter to generate",dropHere:"Drop to attach as reference (up to {max})"},$S={resultAlt:"result",imageViewerAria:"Generated image viewer. Use left and right arrow keys to move between images.",tokens:"{n} tokens",open:"Open Canvas",openAria:"Open image in canvas mode",close:"Close Canvas",blank:{title:"Blank canvas",subtitle:"Sketch on white paper, then continue from it.",create:"Create blank canvas",creating:"Creating...",failed:"Could not create blank canvas"},drop:{hint:"Drop image to add to gallery"},toolbar:{label:"Canvas annotation tools",select:"Select",bgGroup:"Export background",bgAlpha:"Alpha",bgMatte:"Matte",bgMatteColor:"Matte color",cleanup:"Clean background",cleanupMark:"Mark",cleanupRemove:"Remove",cleanupPreserve:"Preserve",cleanupInput:"Input",cleanupClick:"Click",cleanupBrush:"Brush",cleanupBrushSize:"Brush",cleanupTolerance:"Tolerance",cleanupAutoSample:"Corners",cleanupPickSeed:"Pick seed",cleanupPickingSeed:"Click background",cleanupActive:"Active",cleanupPreview:"Preview",cleanupPreviewing:"Previewing...",cleanupApply:"Apply PNG",cleanupApplying:"Applying...",cleanupReset:"Reset",cleanupSeedCount:"{n} seeds",cleanupRemoved:"{n}% removed",cleanupPickHint:"Click the background on the image",cleanupBrushHint:"Paint the area to mark",cleanupMaskHint:"Purple mask will be removed",cleanupApplied:"Transparent PNG created",cleanupFailed:"Background cleanup failed",zoomGroup:"Canvas zoom",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomReset:"Reset zoom",zoomShortcutHint:"Pinch zoom · two-finger pan · [ / ] · 0",pen:"Pen",box:"Box",arrow:"Arrow",memo:"Sticky memo",eraser:"Eraser",eraserMenu:"Eraser options",objectEraser:"Object eraser",brushEraser:"Brush eraser",apply:"Save canvas version",applyDone:"Canvas version saved",applyFailed:"Could not save canvas version",export:"Export image",exporting:"Exporting...",exportFailed:"Export failed",undo:"Undo",redo:"Redo",deleteSelected:"Delete selected",editMask:"Edit boxed areas",editMaskDisabled:"Draw a box first",editMaskFailed:"Masked edit failed",editMaskUnsupported:"Masked edit is not supported by the current image provider",style:"Style",color:"Color",strokeWidth:"Stroke width",clear:"Clear all"},version:{saving:"Saving canvas version...",saved:"Canvas version saved",failed:"Could not save canvas version",usingAsReference:"Canvas version is ready as a reference"}},WS={today:"Today",yesterday:"Yesterday",thisWeek:"This week",earlier:"Earlier",imageAltFallback:"Generated image",deleteTitle:"Move to system trash",deleteAria:"Delete image",ariaLabel:"Image gallery",title:"Gallery",total:"{n} total",totalFiltered:" / {n} total",sortByAria:"Sort by",sortByDate:"Date",sortBySession:"Session",favoriteFilterAria:"Favorite filter",filterAll:"All",filterFavorites:"Favorites",searchPlaceholder:"Search prompts or filenames",searchDisabledPlaceholder:"Search is disabled in session view",closeAria:"Close gallery",closeTitle:"Close (Esc)",sessionLabel:"Session {name}",standalone:"Standalone images",emptySessions:"No sessions saved yet.",emptyAll:"No images yet. Create one first.",emptyFavorites:"No favorite images yet.",noResults:"No results.",loadOlder:"Load older",loadingOlder:"Loading older...",loadOlderFavorites:"Load older favorites",loadingOlderFavorites:"Loading older favorites...",sessionPaginationHint:"Session view uses the current page. Switch to Date view to load older images.",loadOlderFailed:"Could not load older gallery items.",storageNoticeTitle:"Storage notice",storageNoticeRecoverable:"Sorry for the scare. Recent versions moved the gallery folder from the installed package to your user data folder. Your old images may still be in the previous generated folder. Run ima2 doctor or open the recovery guide.",storageNoticeNotFound:"Sorry for the scare. We could not find a previous generated folder on this machine. If the old global install folder was replaced during update, automatic recovery may not be possible. Run ima2 doctor and check the recovery guide for manual search steps.",storageNoticeUnknown:"Storage status could not be checked. If the gallery looks empty after an update, run ima2 doctor to inspect the image folder.",openGeneratedDir:"Open folder",openGeneratedDirTitle:"Open generated image folder",cardNewsSet:"Card News set",cardNewsCard:"Card News card",openCardNewsSet:"Open set",openCardNewsSetFailed:"Could not open the Card News set.",copyCardNewsSetPath:"Copy path",cardNewsPathCopied:"Card News set path copied.",downloadCardNewsManifest:"Manifest",cardNewsCount:"{n} cards",deleted:"Deleted: {filename}",undo:"Undo",secondsSuffix:"{n}s",permanentDeleted:"Permanently deleted: {filename}",movedToSystemTrash:"Moved to system trash: {filename}",deleteFailed:"Could not delete image.",restoreFailed:"Could not restore image.",favoriteTitle:"Add to favorites",unfavoriteTitle:"Remove from favorites",favoriteAria:"Add to favorites",unfavoriteAria:"Remove from favorites",scopeAria:"Gallery scope",scope:{current:"Current session",all:"All images"},empty:{currentSession:"No images in this session yet."}},e0={empty:"Empty",pending:"Generating",reconciling:"Syncing",reconcilingPhase:"Syncing · {phase}",ready:"Done · {elapsed}s",readyWithSearch:"Done · {elapsed}s · searched {searches}",stale:"Stale",staleWithError:"Stale: {error}",assetMissing:"Asset missing",assetMissingWithError:"Asset missing: {error}",error:"Error: {error}",errorUnknown:"unknown",nodeImageAlt:"Node image",partialImageAlt:"Partial node image preview",noAsset:"No asset",stateStale:"State stale",noImage:"No image",editPromptPlaceholder:"Edit prompt...",promptPlaceholder:"Prompt...",regenerate:"Regen",newVariation:"New variant",generate:"Gen",generateTitle:"Generate node image",addChild:"Child",addChildTitle:"Add child node",duplicateBranch:"Branch",duplicateBranchTitle:"Duplicate as a new branch root",deleteTitle:"Delete",regenerateTitle:"Regenerate this node in place",newVariationTitle:"Create a new sibling variant under the same parent",parentImageRequired:"Generate the parent image first.",attachRef:"Attach",attachRefTitle:"Attach node reference images",refAlt:"Node reference {n}",removeRef:"Remove reference {n}",dropRefs:"Drop images here",nodeRefsUnsupportedForEdit:"Extra references are only supported on root nodes for now.",nodeRefsUsedWithParent:"Used together with the parent image.",classicRefsParkedTitle:"Classic references are parked",classicRefsParkedBody:"These images belong to the classic composer and are inactive in node mode.",clearParkedRefs:"Clear parked references"},t0={selectionOn:"Selecting",selectionOff:"Select",selectAll:"Select all",summary:"{selected} selected · {missing} missing · {stale} affected",generateMissing:"Generate missing",regenerateSelected:"Regenerate selected",stopRemaining:"Stop remaining",stopping:"Stopping",clear:"Clear",noneSelected:"No nodes selected.",parentRequired:"{count} selected node(s) need a ready parent image first.",nothingToRun:"No selected nodes need generation.",stopQueued:"The current node will finish, then the remaining queue will stop.",failed:"Stopped after {done}/{total} node(s).",finished:"Finished {done}/{total} node(s).",staleBecauseParentChanged:"An upstream node was regenerated; refresh this node when needed."},a0={disconnect:"Disconnect",disconnectTitle:"Disconnect selected edge",disconnected:"Connection removed.",parentConflict:"A node can only have one parent connection."},n0={authTitle:"Authentication",apiLabel:"API Key",oauthNotReady:"OAuth proxy is not ready yet.",codexLoginRequired:"Codex login required.",codexLoginHint:"Run `codex login` in your terminal, then refresh this page.",oauthStarting:"OAuth proxy is starting. Try again in a few seconds.",serverUnreachable:"Cannot reach the server. Make sure the backend is running.",apiInvalid:"API key is missing or invalid. Check OPENAI_API_KEY in the server's .env.",availableTitle:"{name} available",availableAria:"{name}: available",unavailableAria:"{name}: unavailable",availableSr:"(available)",unavailableSr:"(unavailable)"},l0={free:"free",approx:"~${amount}",multimodeApprox:"up to ~${amount} ({count})",label:"Est. cost"},i0={download:"Download",copyImage:"Copy image",copyPrompt:"Copy prompt",continueHere:"Continue here",continueHereTitle:"Import this image's prompt and keep working",firstNode:"First node",firstNodeTitle:"Send this image to Node Mode as a ready first node",delete:"Delete",deleteTitle:"Move to trash",more:"More",sendToComfyUI:"Send to ComfyUI",sendToComfyUITitle:"Upload this saved image to local ComfyUI",permanentDelete:"Permanently delete",permanentDeleteConfirm:'Permanently delete "{filename}"? This cannot be undone.'},o0={switchTitle:"Switch session",loading:"Loading...",newSession:"New session",newSessionTitle:"New session",renameTitle:"Rename",renamePrompt:"Session name",deleteTitle:"Delete",deleteConfirm:'Delete session "{title}"? This cannot be undone.',empty:"No sessions yet",firstGraph:"My first graph",untitled:"Untitled session",assetAbortedError:"Generation did not finish cleanly. Retry from this node."},s0={ariaLabel:"UI mode",classic:"Classic",node:"Node",cardNews:"Card News",agent:"Agent"},r0={workspace:"Agent workspace",title:"Agent",newSession:"New Agent",sessions:"Sessions",openSessions:"Open sessions",closeSessions:"Close sessions",sessionSearch:"Search sessions",renameSession:"Rename session",deleteSession:"Delete session",deleteConfirm:'Delete "{title}"?',imageCount:"{count} images",compacted:"Compacted",web:"Web",chat:"Chat",user:"User",assistant:"Agent",tool:"Tool",toolExpand:"Show tool details",toolCollapse:"Hide tool details",toolImageCount:"{count} img",toolCallCount:"{count} calls",toolGroup:"Tool run",toolInput:"Input",toolOutput:"Output",toolArtifacts:"Artifacts",requestId:"Request ID",duration:"Duration",toolStatus:{queued:"Queued",running:"Running",complete:"Complete",error:"Error"},rightSidebar:"Agent side tools",sidebarTabs:{image:"Image",library:"Library",forms:"Forms",quality:"Quality",model:"Model",queue:"Queue"},modelSettings:"Model settings",closeModelSettings:"Close model settings",openModelSettings:"Open model settings",model:"Model",provider:"Provider",reasoningEffort:"Reasoning",generationStrategy:"Generation plan",generationStrategyAuto:"Based on user request",generationStrategyManual:"Fixed count",quality:"Quality",size:"Size",format:"Format",moderation:"Moderation",variantsCount:"Variants",maxAutoVariants:"Auto max",parallelism:"Parallelism",promptLibrary:"Prompt library",forms:"Forms",noForms:"No form templates",insertPrompt:"Insert",queue:"Queue",runningShort:"run",queuedShort:"wait",queueEmpty:"No queued Agent work.",cancelQueue:"Cancel",retryQueue:"Retry",sessionRunning:"Generation running",sessionQueued:"{count} queued",sessionError:"Generation error",queueStatus:{queued:"Queued",running:"Running",succeeded:"Done",failed:"Failed",canceled:"Canceled"},statusReady:"Ready",statusGenerating:"Generating",statusReconnecting:"Reconnecting",pending:"Generating image...",composerPlaceholder:"Describe the image to create",slashCommands:"Agent slash commands",slashDesc_question:"Ask a question without generating images",slashDesc_variants:"Generate N image variants (1-8)",slashDesc_generate:"Bounded fanout generation (1-8)",slashDesc_parallelism:"Limit concurrent tool calls",slashDesc_help:"Show available commands",attachReference:"Attach reference",send:"Send",webSearch:"Use search",emptyChat:"Enter a message to start image work.",imagePane:"Image",currentImage:"Current image",openImage:"Open image",closeImage:"Close image",selectImage:"Focus image",variants:"Variants",contextTabs:"Image context",imageTab:"Image",refsTab:"Refs",webTab:"Web",memoryTab:"Memory",noImage:"No current image",noRefs:"No references",noWeb:"No web evidence",memoryItemStyle:"Style locks are retained in image context.",memoryItemSubject:"Subject locks are restored after resume.",imageAlt:"Agent image",filename:"File",prompt:"Prompt"},c0={workspace:"Card News workspace",composer:"Card News",composerHint:"Templates are visual snapshots; output size is set separately.",topic:"Topic",topicPlaceholder:"e.g. Exam comeback plan",audience:"Audience",audiencePlaceholder:"e.g. Parents",goal:"Goal",goalPlaceholder:"e.g. Book a consultation",brief:"Brief",briefPlaceholder:"Describe the card news content, required points, and exclusions.",outputSize:"Output size",customSize:"Custom",draft:"Draft outline",drafting:"Drafting...",generateSet:"Generate set",batchGenerate:"Batch generate",generating:"Generating...",generated:"Generated {count} cards.",missingGeneratedCard:"The generation response did not include this card.",error:"Card generation failed.",imageTemplate:"Image template",roleTemplate:"Card structure",newTemplateLater:"Custom templates are planned after the dev MVP",emptyTitle:"Waiting for a draft",emptyBody:"Use the left setup panel to prepare the card deck.",inspector:"Card inspector",cardTitle:"Card title",headline:"Headline",body:"Body",visualPrompt:"Image prompt",summaryCopy:"Summary copy",designPrompt:"Scene / design prompt",textFields:"Text boxes",addTextField:"Add text box",removeTextField:"Remove",noTextFields:"No text boxes yet.",textFieldText:"Text",textKind:"Kind",placement:"Placement",renderMode:"Render mode",hierarchyLabel:"Hierarchy",textTooLong:"Text exceeds the suggested length.",selectTextField:"Select text box: {text}",textKinds:{headline:"Headline",body:"Supporting text",caption:"Caption",cta:"CTA",badge:"Badge",number:"Number"},renderModes:{"in-image":"In image","ui-only":"UI only"},hierarchy:{primary:"Primary",secondary:"Secondary",supporting:"Supporting"},placements:{"top-left":"Top-left","top-center":"Top-center","top-right":"Top-right","center-left":"Center-left",center:"Center","center-right":"Center-right","bottom-left":"Bottom-left","bottom-center":"Bottom-center","bottom-right":"Bottom-right",free:"Free"},roles:{cover:"Cover",hook:"Hook",problem:"Problem",insight:"Insight",example:"Example",data:"Data",summary:"Summary",cta:"CTA"},locked:"Locked",unlocked:"Unlocked",noCard:"No card selected",generatedMeta:"Generated metadata",lockedHelp:"Locked cards are excluded from batch generation and retry.",retryCard:"Retry this card",actions:{copyPrompt:"Copy prompt",copyCopy:"Copy copy",openImage:"Open image",downloadCard:"Download"},status:{draft:"Draft",queued:"Queued",generating:"Generating",generated:"Done",error:"Error",skipped:"Skipped",locked:"Locked"},progress:{generating:"Generating {done}/{total}",summary:"Done {done}/{total}",detail:"{queued} queued · {errors} errors · {skipped} skipped",cardGenerating:"Generating this card."},planner:{structured:"Structured JSON",jsonMode:"JSON mode",repaired:"Repaired",fallback:"Fallback draft",jsonOnlyHelp:"Draft creates JSON only. Images are generated later.",error:"Draft failed"}},u0={appName:"Image Generator",imageModelLabel:"Model",imageModelAria:"Choose image model",quickSettingsAria:"Choose model and reasoning effort. Current model {model}, reasoning {effort}",quickSettingsMenu:"Model and reasoning quick settings",reasoningLabel:"Reasoning",nodeModeHint:"In node mode, click a node to edit its prompt and generate. Settings on the right panel (quality/size) apply to every new result."},d0={openAria:"Open settings",openTitle:"Settings",closeAria:"Close settings",closeTitle:"Return to canvas",navAria:"Settings sections",contentAria:"Settings content",jumpTo:"Jump to {section}",eyebrow:"Workspace settings",title:"Settings",subtitle:"Account, display, and future workspace controls live here so the generator stays focused.",sections:{account:{title:"Account",hint:"OAuth status"},generation:{title:"Generation",hint:"Model defaults"},appearance:{title:"Appearance",hint:"Light and dark"},workspace:{title:"Workspace",hint:"Profile"},language:{title:"Language",hint:"Interface copy"},future:{title:"Future",hint:"Reserved"}},account:{primaryEyebrow:"Active provider",oauthTitle:"OAuth is active",oauthBody:"OAuth generation runs through your Codex OAuth session. You can switch to API-key mode when a valid key is configured.",apiSourceEnv:"OPENAI_API_KEY detected",apiSourceConfig:"config.json API key detected",apiTitle:"API key provider available",apiBody:"ima2-gen can use this API key for generation, edit, multimode, and node requests through the Responses API.",apiDisabled:"Unavailable",apiReady:"Ready",apiUnavailable:"Unavailable",apiUnknown:"Status unknown"},imageModel:{title:"Image model",body:"Choose the OAuth model used for future image generations.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",gpt53CodexSpark:"GPT-5.3 Codex Spark — unsupported for images",unsupportedHelp:"Default is GPT-5.4 Mini. GPT-5.3 Codex Spark may appear in OAuth model status, but it does not support the image_generation tool."},reasoning:{title:"Reasoning effort",body:"Higher effort spends more reasoning tokens on planning, web search, and prompt enrichment before generating.",none:"Off — no extra reasoning",low:"Low — fastest, minimal reasoning",medium:"Medium — balanced default",high:"High — deeper research and synthesis",xhigh:"Xhigh — maximum reasoning, slowest"},webSearch:{title:"Web search",body:"Use live search before generation for real people, brands, products, places, and recent events.",on:"Search on",off:"Search off"},gallery:{defaultScopeTitle:"Default gallery view",defaultScopeBody:"Choose what the gallery shows when you open it."},appearance:{themeTitle:"Theme",themeBody:"Pick a theme style and brightness for this device.",historyStripLayoutTitle:"History thumbnails",historyStripLayoutBody:"Choose how the compact history strip sits beside the workspace.",historyStripLayout:{rail:"Rail",horizontal:"Top row",sidebar:"Sidebar"}},language:{title:"Language",body:"Switch the UI language without changing generated content."},future:{title:"Reserved for later",body:"Future provider repair and workspace controls will appear here when they become useful."}},f0={loading:"Loading session...",addFirst:"+ Add first node",addRootTitle:"Add root node",hint:"Drag a handle into empty space to branch. Press Delete or Backspace to remove."},m0={title:"{provider} unavailable",ariaLabel:"{provider} unavailable"},p0={label:"Language",ko:"한국어",en:"English"},h0={label:"Theme",modeLabel:"Brightness",styleLabel:"Theme style",system:"System",dark:"Dark",light:"Light",family:{default:"Default",gpt:"GPT",claude:"Claude",gemini:"Gemini",grok:"Grok"}},g0={close:"Close",details:"Show raw error details",unknown:{title:"An unexpected error occurred",body:"Please try again shortly. If it persists, copy the raw error message below and report it."},moderationRefused:{title:"Prompt blocked by moderation",body:"Soften the wording or rephrase. Sensitive/violent content in reference images can also trigger this.",cta:"Edit prompt"},emptyResponse:{title:"No image was returned",body:"Codex responded but didn't include image data. This isn't a moderation block — it's likely a transient hiccup or an unsupported size/quality/model combination. Retry, or try a different size or model.",cta:"Retry"},streamParseFailed:{title:"Could not parse the image response stream",body:"Response data arrived, but the app could not read the image stream cleanly. This can happen with a proxy or transient stream transport issue.",cta:"Retry"},imageToolNotCalled:{title:"The image tool was not called",body:"The response completed, but no image-generation tool call was observed. Retry the same prompt, or try another model/search setting.",cta:"Retry"},webSearchOnlyResponse:{title:"The image tool was not called",body:"Only web search ran; the image-generation tool did not. Turn off search or retry the request.",cta:"Retry"},imageToolFailed:{title:"The image tool call failed",body:"The image-generation tool was called, but it ended in a failed state. If this repeats, report it with `ima2 doctor image-probe --json` output.",cta:"Retry"},imageToolNoResult:{title:"The image result was empty",body:"The image tool call completed but did not include image data. This can point to an unsupported option combination or account capability issue.",cta:"Retry"},oauthImageCapabilityUnavailable:{title:"This account may not have image-tool access",body:"OAuth is connected, but this account/model combination may not be entitled to use image generation. Compare with API-key mode or another model.",cta:"OK"},responsesStreamError:{title:"The image response stream ended with an error",body:"OpenAI returned an error event inside the response stream. Retry shortly, and check the raw error details if it persists.",cta:"Retry"},upstream5xx:{title:"OpenAI is currently busy",body:"Retrying usually resolves this. Check status.openai.com if it persists.",cta:"Retry"},authChatgptExpired:{title:"Codex ChatGPT session expired",body:"Run `npx @openai/codex login` in your terminal, then reload this app.",cta:"Reload"},authApiKeyInvalid:{title:"API key authentication failed",body:"The key is missing, invalid, revoked, out of quota, or tied to the wrong org. Switch to OAuth or update the configured API key.",cta:"OK"},networkFailed:{title:"Network connection failed",body:"Could not reach OpenAI or the local runtime service. Reload first; if it persists, check VPN/firewall and the port shown by `ima2 doctor`.",cta:"Reload"},oauthUnavailable:{title:"OAuth proxy unavailable",body:"The OAuth proxy is starting, unavailable, or moved to a fallback port. Reload first; if it persists, run `ima2 doctor` and check the reported OAuth URL.",cta:"Reload"},invalidRequest:{title:"Image request needs changes",body:"One or more generation parameters are invalid. Check the raw error details below, then edit the prompt or size and try again.",cta:"Edit input"},apikeyDisabled:{title:"API-key mode is unavailable",body:"This build supports API-key generation, but the current request could not use a configured key. Switch to OAuth or update the API key.",cta:"OK"}},y0={title:"Prompt Library",saveTitle:"Save to Prompt Library",save:"Save",saved:"Prompt saved",saveFailed:"Save failed",name:"Name",tags:"Tags",search:"Search prompts...",favorites:"Favorites",load:"Load",insert:"Insert",inserted:"Prompt inserted",removeInserted:"Remove inserted prompt {name}",favorite:"Favorite",unfavorite:"Unfavorite",empty:"No saved prompts yet.",content:"Content",copy:"Copy",untitled:"Untitled",addNew:"Add new prompt",import:"Import",importFiles:"Import .txt, .md, .markdown, or GitHub files",dropImport:"Drop .txt, .md, or .markdown files to import prompts",importTitle:"Import prompts",importDropTitle:"Drag files here",importDropHint:"Preview .txt, .md, and .markdown files before saving",importChooseFiles:"Choose files",importGithubLabel:"GitHub file URL or path",importPreview:"Preview",importPreviewEmpty:"Drop files or enter a GitHub path to preview candidates.",importCommit:"Save selected",importSelected:"Import selected ({count})",importThisPrompt:"Import this prompt",previewPrompt:"Preview",selectPrompt:"Select",selectedPrompt:"Selected",selectedCount:"{count} selected",selectAllCandidates:"Select all",clearCandidateSelection:"Clear",addAnotherSource:"Add another source",searchResultsHeader:"Search results ({count})",searchResults:"Search results",promptText:"Prompt text",importSelectAtLeastOne:"Select at least one prompt to save.",imported:"Imported {count} prompt(s)",importFailed:"Import failed",importNoValidFiles:"No .txt, .md, or .markdown prompt files found.",curatedSources:"Curated sources",curatedSourcesHint:"Search indexed public prompt sources",curatedSearch:"Search",curatedSearchPlaceholder:"nano banana, gpt-image-2, typography...",refreshSource:"Refresh",curatedRefreshed:"Indexed {count} prompt candidate(s)",sourceTrustTier:"Source trust",requiresAttribution:"Attribution required",sourceDetails:"Source",license:"License",attributionRequired:"Attribution required",modelHints:"Model hints",taskHints:"Task hints",warnings:"Warnings",compatibilityWarnings:"Compatibility warnings",transparentUnsupportedGptImage2:"Transparent background is not supported by gpt-image-2",noCuratedResults:"No curated prompt candidates found.",discovery:"Discovery",discoverySearch:"Search GitHub",discoverySearchPlaceholder:"Search prompt repositories...",discoveryCandidates:"Discovery candidates",discoveryApprove:"Approve",discoveryReject:"Reject",discoveryApproved:"Approved",discoveryRejected:"Rejected",discoveryScore:"Score",discoveryWarnings:"Discovery warnings",discoveryRateLimited:"GitHub discovery is rate limited.",discoveryNoResults:"No discovery candidates found.",discoveryReviewQueue:"Review queue",discoveryRequiresPaths:"Add reviewed file paths before default search.",folderBrowse:"Browse folder",folderBrowseHint:"Loads supported files from a GitHub folder",folderFiles:"Folder files",folderFilesEmpty:"No importable .md, .markdown, or .txt files found.",folderPreviewSelected:"Preview selected files",folderSelectedCount:"{count} selected",folderWarnings:"Folder warnings",folderTooManyFiles:"Too many files; showing a limited set.",folderNoSelection:"Select files to preview.",folderUnsupported:"Only GitHub folders are supported."},v0={title:"Prompt Builder",subtitle:"Refine prompts through multi-turn context.",scopeDraft:"New work",scopeImage:"Selected image: {name}",scopeImageFallback:"Current image",newWorkTitle:"Start a new work without image context",model:"Builder model",empty:"Describe the direction you want. I will include your current prompt and settings as context.",user:"You",assistant:"Builder",placeholder:"What kind of image should we make?",send:"Send",sending:"Writing",thinking:"Refining the prompt...",clear:"Clear",applyToPrompt:"Apply to prompt",insertAsBlock:"Insert block",finalKoreanPrompt:"Korean prompt",finalEnglishPrompt:"English prompt",blockName:"Builder suggestion",applied:"Builder suggestion applied to the main prompt",inserted:"Builder suggestion inserted as a prompt block",failed:"Prompt builder request failed",removeScopeImage:"Remove selected image from builder context",removeAttachment:"Remove attachment {name}",attach:"Attach file",attachmentOnlyMessage:"Use the attached file as context and help with the prompt"},b0={sectionTitle:"Workspace",sectionBody:"Choose a workspace layout profile.",profileLabel:"Workspace profile",defaultLabel:"Default",defaultDesc:"Standard generation workflow with sidebar composer.",promptStudioLabel:"Prompt Studio",promptStudioDesc:"Prompt builder panel, grouped history, and enhanced viewer."},S0={controls:"Image zoom controls",zoomIn:"Zoom in",zoomOut:"Zoom out",reset:"Reset zoom"},x0={common:zS,appBar:IS,sheet:DS,toast:LS,inflight:qS,size:HS,sizeConfirm:kS,quality:GS,moderation:US,format:BS,count:PS,multimode:FS,metadata:YS,readiness:KS,generate:VS,billing:XS,history:QS,panel:ZS,prompt:JS,canvas:$S,gallery:WS,node:e0,nodeBatch:t0,edge:a0,provider:n0,cost:l0,result:i0,session:o0,uiMode:s0,agent:r0,cardNews:c0,sidebar:u0,settings:d0,nodeCanvas:f0,apiDisabled:m0,language:p0,theme:h0,errorCard:g0,promptLibrary:y0,promptBuilder:v0,workspace:b0,viewer:S0},Lp={ko:jS,en:x0};function qp(l,s){return s.split(".").reduce((i,o)=>{if(i!=null)return i[o]},l)}function E0(l,s){return l.replace(/\{(\w+)\}/g,(i,o)=>o in s?String(s[o]):`{${o}}`)}function J(l,s){const i=_.getState().locale;return zh(i,l,s)}function zh(l,s,i){const o=qp(Lp[l],s),u=typeof o=="string"?o:qp(Lp.en,s),d=typeof u=="string"?u:s;return i?E0(d,i):d}function be(){const l=_(s=>s.locale);return{locale:l,t:(s,i)=>zh(l,s,i)}}const mT=["ko","en"];function T0(){try{const l=localStorage.getItem("ima2.locale");if(l==="ko"||l==="en")return l}catch{}return typeof navigator<"u"&&(navigator.language||"").toLowerCase().startsWith("ko")?"ko":"en"}function N0(l){try{localStorage.setItem("ima2.locale",l)}catch{}}function _0(l){return Math.round(l/16)*16}const Sn=16,fu=3840,Vc=655360,fs=8294400,C0=3,yl=3,Hp=Math.floor(Math.sqrt(fs)/Sn)*Sn,Ih=Sn,w0=fu,ts=C0;function kp(l){return Math.floor(l/16)*16}function xs(l){return Math.ceil(l/16)*16}function Yt(l){return Math.min(w0,Math.max(Ih,l))}function aa(l,s){const i=typeof l=="number"?l:Number.parseInt(l,10);return Number.isFinite(i)?i:s}function Nn(l,s){l.includes(s)||l.push(s)}function Gp(l,s){const i=_0(l);return i!==l&&Nn(s,"snap"),i}function Up(l,s){return l<Ih&&Nn(s,"min"),l>fu&&Nn(s,"maxEdge"),Yt(l)}function Bp(l,s,i){return l>s*ts?(Nn(i,"ratio"),{w:l,h:Yt(xs(l/ts))}):s>l*ts?(Nn(i,"ratio"),{w:Yt(xs(s/ts)),h:s}):{w:l,h:s}}function A0(l,s,i){if(l*s<Vc){Nn(i,"minPixels");const p=Math.sqrt(Vc/(l*s));let m=Yt(xs(l*p)),y=Yt(xs(s*p));for(;m*y<Vc;)m<=y?m=Yt(m+Sn):y=Yt(y+Sn);return{w:m,h:y}}if(l*s<=fs)return{w:l,h:s};Nn(i,"maxPixels");const o=Math.sqrt(fs/(l*s));let u=Yt(kp(l*o)),d=Yt(kp(s*o));for(;u*d>fs;)u>=d?u=Yt(u-Sn):d=Yt(d-Sn);return{w:u,h:d}}function mu(l,s,i,o){const u=[],d=aa(l,i),p=aa(s,o);let m=Up(Gp(d,u),u),y=Up(Gp(p,u),u);return{w:m,h:y}=Bp(m,y,u),{w:m,h:y}=A0(m,y,u),{w:m,h:y}=Bp(m,y,u),{requestedW:d,requestedH:p,w:m,h:y,adjusted:m!==d||y!==p,reasons:u}}function Dh(l,s,i,o){const u=mu(l,s,i,o);return{w:u.w,h:u.h}}const M0=[{id:"free",label:"Free",w:0,h:0},{id:"1:1",label:"1:1",w:1,h:1},{id:"3:2",label:"3:2",w:3,h:2},{id:"2:3",label:"2:3",w:2,h:3},{id:"16:9",label:"16:9",w:16,h:9},{id:"9:16",label:"9:16",w:9,h:16},{id:"21:9",label:"21:9",w:21,h:9},{id:"9:21",label:"9:21",w:9,h:21}];function R0(l,s){return`${l}x${s}`}function O0(l,s=1024){if(l.id==="free")return null;const i=s,o=l.w>=l.h,u=o?Math.round(i*l.w/l.h):i,d=o?i:Math.round(i*l.h/l.w);return Dh(u,d,u,d)}function _s(l){const s=Dh(l.w,l.h,2400,1024);return{...l,w:s.w,h:s.h,label:l.label||`${s.w}×${s.h}`}}function vl(l){return l.slice(0,yl).map(_s)}function j0(l,s){const i=_s(s),o=l.findIndex(u=>u.id===i.id);return o>=0?vl(l.map((u,d)=>d===o?i:u)):l.length>=yl?vl(l):vl([...l,i])}function z0(l,s,i){const o=_s({...i,id:s});return vl(l.map(u=>u.id===s?o:u))}const I0=[{value:"1024x1024",label:"1024×1024",sub:"1:1"},{value:"1536x1024",label:"1536×1024",sub:"3:2"},{value:"1024x1536",label:"1024×1536",sub:"2:3"}],D0=[{value:"1360x1024",label:"1360×1024",sub:"4:3"},{value:"1024x1360",label:"1024×1360",sub:"3:4"},{value:"1824x1024",label:"1824×1024",sub:"16:9"}],L0=[{value:"1024x1824",label:"1024×1824",sub:"9:16"},{value:"2048x2048",label:"2048×2048",sub:"2K 1:1"},{value:"2048x1152",label:"2048×1152",sub:"2K 16:9"}],q0=[{value:"1152x2048",label:"1152×2048",sub:"2K 9:16"},{value:"3840x2160",label:"3840×2160",sub:"4K 16:9"},{value:"2160x3840",label:"2160×3840",sub:"4K 9:16"}];function H0(){return[{value:"auto",label:J("size.autoLabel"),sub:J("size.autoSub")},{value:"custom",label:J("size.customLabel"),sub:J("size.customSub")}]}const k0="gpt-5.4-mini",Za=[{value:"gpt-5.4-mini",shortLabel:"5.4m",fullLabelKey:"settings.imageModel.gpt54Mini"},{value:"gpt-5.4",shortLabel:"5.4",fullLabelKey:"settings.imageModel.gpt54"},{value:"gpt-5.5",shortLabel:"5.5",fullLabelKey:"settings.imageModel.gpt55"}],G0=[{value:"gpt-5.3-codex-spark",fullLabelKey:"settings.imageModel.gpt53CodexSpark"}];function Lh(l){return Za.some(s=>s.value===l)}function U0(l){return l?Za.find(s=>s.value===l)?.shortLabel??l:null}const B0="none",ms=[{value:"none",shortLabel:"off",fullLabelKey:"settings.reasoning.none"},{value:"low",shortLabel:"low",fullLabelKey:"settings.reasoning.low"},{value:"medium",shortLabel:"med",fullLabelKey:"settings.reasoning.medium"},{value:"high",shortLabel:"high",fullLabelKey:"settings.reasoning.high"},{value:"xhigh",shortLabel:"xhigh",fullLabelKey:"settings.reasoning.xhigh"}];function P0(l){return ms.some(s=>s.value===l)}const rt=["ima2.rightPanelOpen","ima2.uiMode","ima2.historyStripLayout","ima2:theme","ima2:themeFamily","ima2.canvas.exportBackground.v1","ima2.imageModel","ima2.reasoningEffort","ima2.webSearchEnabled","ima2.generationDefaults","ima2.inFlight","ima2.selectedFilename","ima2.activeSessionId","ima2.graphTabId","ima2.galleryScope","ima2.galleryDefaultScope","ima2.locale","ima2.workspaceProfile","ima2.workspaceOverrides"],qh=rt[0],Hh=rt[1],kh=rt[2],Gh=rt[3],Uh=rt[4],Bh=rt[5],Ph=rt[6],Fh=rt[7],Yh=rt[8],Kh=rt[9],Vh=rt[10],iu=rt[11],ou=rt[12],Pp=rt[13],Xc=rt[14],Fp=rt[15],F0=!0,vn=()=>"nc_"+Math.random().toString(36).slice(2,10);function Yp(l,s){return{x:l*360,y:s*320}}function Y0(l,s){return l.find(i=>i.target===s)??null}function K0(l,s,i){return l.some(o=>o.target===i&&o.source!==s)}function Qa(l,s){const i=new Map(l.map(o=>[o.id,o]));return l.map(o=>{const u=Y0(s,o.id),p=(u?i.get(u.source):null)?.data.serverNodeId??null;return o.data.parentServerNodeId===p?o:{...o,data:{...o.data,parentServerNodeId:p}}})}const V0=360,Xh=320;function X0(l,s,i){const o=new Set(i.filter(u=>u.source===l).map(u=>u.target));return s.filter(u=>o.has(u.id))}function Qc(l){const s=l.filter(o=>!o.data.parentServerNodeId);if(s.length===0)return Yp(0,0);const i=Math.max(...s.map(o=>o.position.y));return{x:Yp(0,0).x,y:i+Xh}}function Kp(l,s,i){const o=X0(l.id,s,i),u=l.position.x+V0;if(o.length===0)return{x:u,y:l.position.y};const d=Math.max(...o.map(p=>p.position.y));return{x:u,y:d+Xh}}const Qh="ima2.nodeRefs.v1";function pu(){try{const l=localStorage.getItem(Qh);if(!l)return{};const s=JSON.parse(l);return s&&typeof s=="object"?s:{}}catch{return{}}}function Zh(l){try{localStorage.setItem(Qh,JSON.stringify(l))}catch{}}function Q0(l,s){if(!l)return[];const i=pu()[l]?.[s];return Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}function ps(l,s,i){if(!l)return;const o=pu(),u={...o[l]??{}};i.length===0?delete u[s]:u[s]=i,o[l]=u,Zh(o)}function Zc(l,s){ps(l,s,[])}function Z0(l,s){if(!l)return;const i=pu(),o=i[l];if(!o)return;const u=new Set(s);for(const d of Object.keys(o))u.has(d)||delete o[d];i[l]=o,Zh(i)}function J0(l,s,i){const o=new Set(l.map(m=>m.id));if(!o.has(i))return[];const u=new Map;for(const m of o)u.set(m,new Set);for(const m of s)!o.has(m.source)||!o.has(m.target)||(u.get(m.source)?.add(m.target),u.get(m.target)?.add(m.source));const d=new Set,p=[i];for(let m=0;m<p.length;m++){const y=p[m];if(!d.has(y)){d.add(y);for(const g of u.get(y)??[])d.has(g)||p.push(g)}}return l.filter(m=>d.has(m.id)).map(m=>m.id)}function Jh(l){return l.filter(s=>s.selected).map(s=>s.id)}function Ti(l,s){const i=new Set(s);return l.map(o=>({...o,selected:i.has(o.id)}))}function $0(l,s,i,o){const u=new Set(J0(l,s,i));if(!u.size)return l;if(!o)return Ti(l,u);const d=l.find(y=>y.id===i),p=l.some(y=>u.has(y.id)&&y.selected),m=new Set(Jh(l));if(p)d?.selected?m.delete(i):m.add(i);else for(const y of u)m.add(y);return Ti(l,m)}function W0(l){return l.data.status==="ready"&&!!l.data.imageUrl}function e1(l,s,i){const o=new Set(i),u=new Set(l.map(b=>b.id)),d=new Map,p=new Map;for(const b of o)u.has(b)&&(d.set(b,0),p.set(b,[]));for(const b of s)!o.has(b.source)||!o.has(b.target)||(p.get(b.source)?.push(b.target),d.set(b.target,(d.get(b.target)??0)+1));const m=l.map(b=>b.id),y=m.filter(b=>o.has(b)&&(d.get(b)??0)===0),g=[];for(let b=0;b<y.length;b++){const S=y[b];g.push(S);for(const x of p.get(S)??[])d.set(x,(d.get(x)??0)-1),(d.get(x)??0)===0&&y.push(x)}const E=new Set(g);return g.concat(m.filter(b=>o.has(b)&&!E.has(b)))}function t1(l,s){const i=new Set(s),o=new Set,u=new Map;for(const p of l){const m=u.get(p.source)??[];m.push(p.target),u.set(p.source,m)}const d=[...i];for(let p=0;p<d.length;p++)for(const m of u.get(d[p])??[])i.has(m)||o.has(m)||(o.add(m),d.push(m));return[...o]}function a1(l,s,i){const o=new Set(i);return l.filter(u=>u.source===s&&!o.has(u.target)).map(u=>u.target)}function n1(l,s,i){const o=new Set(i),u=new Map(l.map(p=>[p.id,p])),d=[];for(const p of s){if(!o.has(p.target)||o.has(p.source))continue;u.get(p.source)?.data.serverNodeId||d.push(p.target)}return d}const Ni={REF_TOO_LARGE:{surface:"toast",toastKey:"toast.refTooLarge"},REF_NOT_BASE64:{surface:"toast",toastKey:"toast.refNotBase64"},REF_EMPTY:{surface:"toast",toastKey:"toast.refEmpty"},REF_TOO_MANY:{surface:"toast",toastKey:"toast.refLimitExceeded"},MODERATION_REFUSED:{surface:"card",cardKey:"errorCard.moderationRefused",cta:"dismiss"},SAFETY_REFUSAL:{surface:"card",cardKey:"errorCard.moderationRefused",cta:"dismiss"},EMPTY_RESPONSE:{surface:"card",cardKey:"errorCard.emptyResponse",cta:"dismiss"},STREAM_PARSE_FAILED:{surface:"card",cardKey:"errorCard.streamParseFailed",cta:"retry"},IMAGE_TOOL_NOT_CALLED:{surface:"card",cardKey:"errorCard.imageToolNotCalled",cta:"retry"},WEB_SEARCH_ONLY_RESPONSE:{surface:"card",cardKey:"errorCard.webSearchOnlyResponse",cta:"retry"},IMAGE_TOOL_FAILED:{surface:"card",cardKey:"errorCard.imageToolFailed",cta:"retry"},IMAGE_TOOL_COMPLETED_WITHOUT_RESULT:{surface:"card",cardKey:"errorCard.imageToolNoResult",cta:"retry"},OAUTH_IMAGE_CAPABILITY_UNAVAILABLE:{surface:"card",cardKey:"errorCard.oauthImageCapabilityUnavailable",cta:"dismiss"},RESPONSES_STREAM_ERROR:{surface:"card",cardKey:"errorCard.responsesStreamError",cta:"retry"},UPSTREAM_5XX:{surface:"card",cardKey:"errorCard.upstream5xx",cta:"retry"},AUTH_CHATGPT_EXPIRED:{surface:"card",cardKey:"errorCard.authChatgptExpired",cta:"reauth"},AUTH_API_KEY_INVALID:{surface:"card",cardKey:"errorCard.authApiKeyInvalid",cta:"dismiss"},NETWORK_FAILED:{surface:"card",cardKey:"errorCard.networkFailed",cta:"reload"},OAUTH_UNAVAILABLE:{surface:"card",cardKey:"errorCard.oauthUnavailable",cta:"reload"},INVALID_REQUEST:{surface:"card",cardKey:"errorCard.invalidRequest",cta:"dismiss"},INVALID_MODERATION:{surface:"toast",toastKey:"toast.generateFailed"},APIKEY_DISABLED:{surface:"card",cardKey:"errorCard.apikeyDisabled",cta:"dismiss"},DB_ERROR:{surface:"toast",toastKey:"toast.generateFailed"},UNKNOWN:{surface:"toast",toastKey:"toast.generateFailed"}};function l1(l){const s=(l||"").toLowerCase();return s?s.includes("moderation_blocked")||s.includes("moderation refused")?"MODERATION_REFUSED":s.includes("no image data returned")?"EMPTY_RESPONSE":s.includes("stream could not be parsed")?"STREAM_PARSE_FAILED":s.includes("web search but not the image tool")?"WEB_SEARCH_ONLY_RESPONSE":s.includes("without calling the image tool")?"IMAGE_TOOL_NOT_CALLED":s.includes("image tool call failed")?"IMAGE_TOOL_FAILED":s.includes("image tool completed without image data")?"IMAGE_TOOL_COMPLETED_WITHOUT_RESULT":s.includes("token is expired")||s.includes("sign in again")||s.includes("access token")&&s.includes("expired")||s.includes("token")&&s.includes("expired")&&!s.includes("api key")?"AUTH_CHATGPT_EXPIRED":s.includes("incorrect api key")||s.includes("invalid authentication")||s.includes("exceeded your current quota")||s.includes("incorrect organization")?"AUTH_API_KEY_INVALID":s.includes("failed to fetch")||s.includes("econnrefused")||s.includes("econnreset")||s.includes("enotfound")||s.includes("etimedout")||s.includes("network error")?"NETWORK_FAILED":s.includes("oauth")&&(s.includes("not running")||s.includes("unavailable")||s.includes("not ready"))?"OAUTH_UNAVAILABLE":s.includes("invalid_request_error")||s.includes("invalid_value")||s.includes("invalid size")||s.includes("invalid request")||s.includes("requested resolution")||s.includes("minimum pixel budget")||s.includes("unsupported value")?"INVALID_REQUEST":s.includes("an error occurred while processing")||/\b5\d\d\b/.test(s)?"UPSTREAM_5XX":"UNKNOWN":"UNKNOWN"}function i1(l){const s=l,i=typeof s?.message=="string"?s.message:String(l??""),o=typeof s?.code=="string"?s.code:"",u=o&&o in Ni?o:l1(i),d=Ni[u]??Ni.UNKNOWN;return{code:u,spec:d,message:i}}function bi(l,s){const{code:i,spec:o,message:u}=i1(l);if(o.surface==="card")s.showErrorCard(i,{fallbackMessage:u});else{const d=o.toastKey?J(o.toastKey):u||J("toast.generateFailed");s.showToast(d,!0)}return{code:i,message:u}}const Mi=!0,$h=!1,Ri=!0,Vp=10;function Wh(l,s){return s?s.filename&&l.filename===s.filename?!0:l.image===s.image:!1}function o1(l){return[l.canvasSourceFilename,l.canvasEditableFilename].filter(s=>!!s)}function Tn(l){return l.filter(s=>!s.canvasVersion)}function Wt(l,s){if(!s)return null;const i=Tn(l);if(!s.canvasVersion)return i.find(d=>Wh(d,s))??null;const o=o1(s);return i.find(d=>d.filename?o.includes(d.filename):!1)??null}function s1(l,s){const i=Tn(l),o=Wt(l,s);return i.findIndex(u=>Wh(u,o))}function r1(l,s,i){const o=Tn(l);if(o.length===0)return null;if(i==="first")return o[0]??null;if(i==="last")return o[o.length-1]??null;const u=s1(l,s);if(u<0)return null;if(i==="pagePrevious"||i==="pageNext"){const p=i==="pagePrevious"?-Vp:Vp,m=Math.max(0,Math.min(o.length-1,u+p));return o[m]??null}const d=i==="previous"?u-1:u+1;return o[d]??null}function Xp(l,s){const i=Tn(l),o=i.findIndex(u=>u.filename===s);return o<0?null:i[o+1]??i[o-1]??null}function kt(l){return l.filename||l.image}function _i(l){return!l.canvasVersion}function hs(l){const s=new Set;return l.filter(i=>{const o=kt(i);return s.has(o)?!1:(s.add(o),!0)})}const eg=72,Qp=10;function tg(l,s){const i=l.sequenceIndex??Number.MAX_SAFE_INTEGER,o=s.sequenceIndex??Number.MAX_SAFE_INTEGER;return i!==o?i-o:(l.createdAt??0)-(s.createdAt??0)}function c1(l){return l<=1?1:l===2?2:4}function ag(l){const s=new Set,i=new Map,o=[];for(const u of l){if(!_i(u))continue;if(u.sequenceId){const p=`sequence:${u.sequenceId}`;let m=i.get(u.sequenceId);m||(m={type:"sequence",key:p,sequenceId:u.sequenceId,items:[]},i.set(u.sequenceId,m),o.push(m)),m.items.push(u);continue}const d=kt(u);s.has(d)||(s.add(d),o.push({type:"image",key:d,item:u}))}for(const u of i.values())u.items.sort(tg);return o}function ng(l,s){return s?`sequence:${s}`:l?.sequenceId?`sequence:${l.sequenceId}`:l?kt(l):null}function Jc(l){return l.type==="sequence"?{type:"sequence",sequenceId:l.sequenceId}:{type:"image",item:l.item}}function u1(l,s,i,o,u=eg){const d=ag(l).slice(0,u);if(d.length===0)return null;const p=d[0],m=d[d.length-1];if(!p||!m)return null;if(i==="first")return Jc(p);if(i==="last")return Jc(m);const y=ng(s,o),g=y?d.findIndex(x=>x.key===y):-1;if(g<0)return null;const E=i==="pagePrevious"?-Qp:i==="pageNext"?Qp:i==="previous"?-1:1,b=Math.max(0,Math.min(d.length-1,g+E));if(b===g)return null;const S=d[b];return S?Jc(S):null}const lg={promptBuilderSurface:"off",composerPlacement:"sidebar",multimodeHistoryGrouping:"individual",restoreComposerFromHistory:!0,viewerTools:"basic"},d1={promptBuilderSurface:"right-panel",composerPlacement:"bottom",multimodeHistoryGrouping:"sequence",restoreComposerFromHistory:!1,viewerTools:"zoom-pan"},f1={default:lg,"prompt-studio":d1};function Ai(l,s){return f1[l]??lg}function m1(l,s){return Ai(l).promptBuilderSurface!=="off"}function p1(){try{const l=localStorage.getItem(qh);return l===null?!0:JSON.parse(l)===!0}catch{return!0}}function h1(){try{const l=localStorage.getItem(Hh);if(l==="agent")return Ri?l:"classic";if(l==="card-news")return $h?l:"classic";if(l==="node")return Mi?l:"classic";if(l==="classic")return l}catch{}return"agent"}function $c(){try{const l=localStorage.getItem(Gh);if(l==="system"||l==="dark"||l==="light")return l}catch{}return"system"}function Zp(){try{const l=localStorage.getItem(Uh);if(l&&mb.includes(l))return l}catch{}return"default"}function g1(){try{const l=localStorage.getItem(kh);if(l==="rail"||l==="horizontal"||l==="sidebar")return l}catch{}return"rail"}function Jp(l){try{const s=localStorage.getItem(l);if(s==="current-session"||s==="all")return s}catch{}return"current-session"}function $p(){if(typeof window>"u")return{mode:"alpha",matteColor:"#ffffff"};try{const l=window.localStorage.getItem(Bh);if(!l)return{mode:"alpha",matteColor:"#ffffff"};const s=JSON.parse(l),i=s.mode==="matte"?"matte":"alpha",o=typeof s.matteColor=="string"&&/^#[0-9a-fA-F]{6}$/.test(s.matteColor)?s.matteColor:"#ffffff";return{mode:i,matteColor:o}}catch{return{mode:"alpha",matteColor:"#ffffff"}}}function Wp(l,s){if(!(typeof window>"u"))try{window.localStorage.setItem(Bh,JSON.stringify({mode:l,matteColor:s}))}catch{}}function eh(){try{const l=localStorage.getItem(Ph);if(Lh(l))return l}catch{}return k0}function th(l){try{localStorage.setItem(Ph,l)}catch{}}function y1(){try{const l=localStorage.getItem(Fh);if(P0(l))return l}catch{}return B0}function v1(l){try{localStorage.setItem(Fh,l)}catch{}}function b1(){try{const l=localStorage.getItem(Yh);if(l==="false")return!1;if(l==="true")return!0}catch{}return F0}function S1(l){try{localStorage.setItem(Yh,String(l))}catch{}}function as(l){return l==="dark"||l==="light"?l:typeof window>"u"||typeof window.matchMedia!="function"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}const ig=18e4,fl=new Set;function ah(l){const s=l.uiMode==="node"?[{kind:"node",sessionId:l.activeSessionId??void 0}]:[{kind:"classic"}];return l.inFlight.some(i=>i.kind==="multimode")&&s.push({kind:"multimode"}),s}function nh(l,s){const i=l.kind??"classic";return s.some(o=>i===o.kind&&(o.kind!=="node"||(l.sessionId??null)===(o.sessionId??null)))}async function lh(l){const s=await Promise.all(l.map(i=>Rh({kind:i.kind,sessionId:i.sessionId,includeTerminal:!0})));return{jobs:s.flatMap(i=>i.jobs),terminalJobs:s.flatMap(i=>i.terminalJobs??[])}}function Wc(l,s){const i=s.filter(u=>u.placement!=="after"),o=s.filter(u=>u.placement==="after");return[...i.map(u=>u.text.trim()).filter(Boolean),l.trim(),...o.map(u=>u.text.trim()).filter(Boolean)].filter(Boolean).join(`
23
+
24
+ `)}function x1(l){if(!l||typeof l!="object")return null;const s=l;return typeof s.id!="string"||typeof s.name!="string"||typeof s.text!="string"?null:{id:s.id,name:s.name,text:s.text,placement:s.placement==="after"?"after":"before"}}function Oi(l){if(!Array.isArray(l))return null;const s=l.map(x1);return s.every(i=>i!==null)?s:null}function su(l){return l.map(s=>({id:s.id,name:s.name,text:s.text,placement:s.placement==="after"?"after":"before"}))}function E1(l){const s=Oi(l.composerInsertedPrompts);return typeof l.composerPrompt=="string"?{prompt:l.composerPrompt,insertedPrompts:s??[]}:s?{insertedPrompts:s}:{}}function ns(l){const s=l.meta??{},i=l.kind==="classic"||l.kind==="node"||l.kind==="multimode"?l.kind:s.kind==="classic"||s.kind==="node"||s.kind==="multimode"?s.kind:void 0;return{id:l.requestId,prompt:typeof l.prompt=="string"?l.prompt:"",startedAt:l.startedAt,composerPrompt:typeof s.composerPrompt=="string"?s.composerPrompt:void 0,composerInsertedPrompts:Oi(s.composerInsertedPrompts)??void 0,phase:typeof l.phase=="string"?l.phase:void 0,sessionId:typeof s.sessionId=="string"?s.sessionId:null,parentNodeId:typeof s.parentNodeId=="string"?s.parentNodeId:null,clientNodeId:typeof s.clientNodeId=="string"?s.clientNodeId:null,kind:i}}function ih(l){const s=typeof l.errorCode=="string"&&l.errorCode?l.errorCode:"UNKNOWN",i=new Error(s==="EMPTY_RESPONSE"?"No image data returned from the image backend.":"Generation failed on the server.");return i.code=s,i.status=typeof l.httpStatus=="number"?l.httpStatus:void 0,i}function oh(l){if(!l||typeof l!="object")return!1;const s=l;return s.code==="GENERATION_CANCELED"||s.status===499}function sh(l){return l.filename||l.image}function rh(l,s){const i=new Map(l.map(o=>[sh(o),o]));for(const o of s)i.set(sh(o),o);return[...i.values()].sort((o,u)=>(o.sequenceIndex??Number.MAX_SAFE_INTEGER)-(u.sequenceIndex??Number.MAX_SAFE_INTEGER))}function ch(){try{const l=localStorage.getItem(Vh);if(!l)return[];const s=JSON.parse(l);if(!Array.isArray(s))return[];const i=Date.now();return s.filter(o=>o&&typeof o.id=="string"&&typeof o.prompt=="string"&&typeof o.startedAt=="number"&&i-o.startedAt<ig).map(o=>({id:o.id,prompt:o.prompt,startedAt:o.startedAt,composerPrompt:typeof o.composerPrompt=="string"?o.composerPrompt:void 0,composerInsertedPrompts:Oi(o.composerInsertedPrompts)??void 0,phase:typeof o.phase=="string"?o.phase:void 0,sessionId:typeof o.sessionId=="string"?o.sessionId:null,parentNodeId:typeof o.parentNodeId=="string"?o.parentNodeId:null,clientNodeId:typeof o.clientNodeId=="string"?o.clientNodeId:null,kind:o.kind==="classic"||o.kind==="node"||o.kind==="multimode"?o.kind:void 0}))}catch{return[]}}function $t(l){try{localStorage.setItem(Vh,JSON.stringify(l))}catch(s){const i=window;if(!i.__ima2QuotaWarned){i.__ima2QuotaWarned=!0,console.warn("[ima2] localStorage write failed:",s);try{_.getState().showToast(J("toast.localStorageFull"),!0)}catch{}}}}function uh(){try{const l=localStorage.getItem(iu);return typeof l=="string"&&l.length>0?l:null}catch{return null}}function ea(l){try{l?localStorage.setItem(iu,l):localStorage.removeItem(iu)}catch{}}function T1(){try{const l=localStorage.getItem(ou);return typeof l=="string"&&l.length>0?l:null}catch{return null}}function eu(l){try{l?localStorage.setItem(ou,l):localStorage.removeItem(ou)}catch{}}const Ft=500,Pt=5;function N1(l){return l==="classic"||l==="edit"||l==="generate"||l==="card-news-card"||l==="card-news-set"?l:null}function Si(l){const s=Oi(l.composerInsertedPrompts);return{image:l.url,url:l.url,filename:l.filename,thumb:l.url,prompt:l.prompt??void 0,userPrompt:l.userPrompt??null,revisedPrompt:l.revisedPrompt??null,promptMode:l.promptMode??null,composerPrompt:l.composerPrompt??null,composerInsertedPrompts:s?su(s):null,size:l.size??void 0,quality:l.quality??void 0,format:l.format,model:l.model??void 0,provider:l.provider,usage:l.usage??void 0,createdAt:l.createdAt,sessionId:l.sessionId??null,nodeId:l.nodeId??null,clientNodeId:l.clientNodeId??null,requestId:l.requestId??null,kind:N1(l.kind),canvasVersion:!!l.canvasVersion,canvasSourceFilename:l.canvasSourceFilename??null,canvasEditableFilename:l.canvasEditableFilename??null,canvasMergedAt:l.canvasMergedAt??void 0,setId:l.setId??null,cardId:l.cardId??null,cardOrder:l.cardOrder??null,headline:l.headline??null,body:l.body??null,cards:l.cards,refsCount:l.refsCount??0,isFavorite:l.isFavorite??!1,sequenceId:l.sequenceId??null,sequenceIndex:l.sequenceIndex??null,sequenceTotalRequested:l.sequenceTotalRequested??null,sequenceTotalReturned:l.sequenceTotalReturned??null,sequenceStatus:l.sequenceStatus??null}}function Kt(l){return l.filename??l.image}function og(l,s){const i=Kt(s);return l.filter(o=>Kt(o)!==i)}function sg(l,s){const i=Kt(s);return l.find(o=>Kt(o)===i)}function rg(l,s){return s?{...s,...l,createdAt:l.createdAt??s.createdAt,requestId:l.requestId??s.requestId,sessionId:l.sessionId??s.sessionId,kind:l.kind??s.kind,refsCount:l.refsCount??s.refsCount,isFavorite:l.isFavorite??s.isFavorite}:l}function dh(l,s){const i=new Map(l.map(o=>[Kt(o),o]));for(const o of s)i.set(Kt(o),o);return[...l.map(o=>i.get(Kt(o))??o),...s.filter(o=>!l.some(u=>Kt(u)===Kt(o)))]}function gs(l,s){return l.slice(0,Math.max(Ft,s))}function tu(l){return l.replace(/^data:[^;]+;base64,/,"")}async function ls(l,s="reference.png"){const i=await fetch(l);if(!i.ok)throw new Error(`reference fetch failed: ${i.status}`);const o=await i.blob(),u=new File([o],s,{type:o.type||"image/png"});return lu(u,{preserveTransparency:!1})}const ml="source-right",xi="target-left";function is(l,s,i,o){return`${l}:${i??"auto"}->${s}:${o??"auto"}`}function _1(l,s){return l&&l.startsWith(`${s}-`)?l:null}function C1(l){switch(l){case"source-top":return"target-bottom";case"source-right":return"target-left";case"source-bottom":return"target-top";case"source-left":return"target-right";default:return null}}function cg(l){const s=l.nodes.map(o=>{const u=o.data??{},d=typeof u.imageUrl=="string"&&u.imageUrl.length>0?u.imageUrl:null,p=typeof u.serverNodeId=="string"&&u.serverNodeId.length>0?`/generated/${u.serverNodeId}.png`:null,m=d??p,y={clientId:o.id,serverNodeId:u.serverNodeId??null,parentServerNodeId:u.parentServerNodeId??null,prompt:typeof u.prompt=="string"?u.prompt:"",imageUrl:m,status:u.status??(m?"ready":"empty"),pendingRequestId:u.pendingRequestId??null,recoveryRequestId:u.recoveryRequestId??null,pendingPhase:u.pendingPhase??null,pendingStartedAt:typeof u.pendingStartedAt=="number"?u.pendingStartedAt:null,partialImageUrl:null,error:u.error,elapsed:u.elapsed,webSearchCalls:u.webSearchCalls,model:u.model??null,size:u.size??null,referenceImages:Q0(l.id,o.id)};return{id:o.id,type:"imageNode",position:{x:o.x,y:o.y},data:y}}),i=l.edges.map(o=>{const u=o.data??{};return{id:o.id,source:o.source,target:o.target,sourceHandle:typeof u.sourceHandle=="string"?u.sourceHandle:null,targetHandle:typeof u.targetHandle=="string"?u.targetHandle:null}});return{graphNodes:Qa(s,i),graphEdges:i,graphVersion:l.graphVersion}}function w1(l,s){let i=!1;const o={};for(const[u,d]of Object.entries(l)){const p=d.images.filter(m=>m.filename!==s);if(p.length===d.images.length){o[u]=d;continue}i=!0,p.length!==0&&(o[u]={...d,images:p,returned:p.length,status:d.status==="complete"&&p.length<d.requested?"partial":d.status})}return i?o:l}function A1(l){const s=l.multimodePreviewFlightId;return s?s.startsWith("history:")?s.slice(8):l.multimodeSequences[s]?.sequenceId??null:null}function M1(l,s){return`${l}x${s}`}function Ci(l){return Math.min(8,Math.max(1,Math.trunc(l||1)))}const ug=new Set(["1024x1024","1536x1024","1024x1536","1360x1024","1024x1360","1824x1024","1024x1824","2048x2048","2048x1152","1152x2048","3840x2160","2160x3840","auto","custom"]);function R1(l){if(typeof l!="string")return{};if(ug.has(l))return{preset:l};const s=/^(\d+)x(\d+)$/.exec(l);if(!s)return{};const i=Number(s[1]),o=Number(s[2]);return!Number.isFinite(i)||!Number.isFinite(o)?{}:{preset:"custom",w:i,h:o}}function dg(l){return l==="low"||l==="medium"||l==="high"}function fg(l){return l==="png"||l==="jpeg"||l==="webp"}function mg(l){return l==="low"||l==="auto"}function O1(l){return l==="oauth"||l==="api"}function j1(l){return l==="auto"||l==="direct"}function z1(l){return typeof l=="string"&&ug.has(l)}function pg(){try{const l=localStorage.getItem(Kh);if(!l)return{};const s=JSON.parse(l),i={};O1(s.provider)&&(i.provider=s.provider),dg(s.quality)&&(i.quality=s.quality),z1(s.sizePreset)&&(i.sizePreset=s.sizePreset),typeof s.customW=="number"&&Number.isFinite(s.customW)&&(i.customW=aa(s.customW,1920)),typeof s.customH=="number"&&Number.isFinite(s.customH)&&(i.customH=aa(s.customH,1088)),fg(s.format)&&(i.format=s.format),mg(s.moderation)&&(i.moderation=s.moderation),typeof s.count=="number"&&(i.count=Ci(s.count)),typeof s.multimode=="boolean"&&(i.multimode=s.multimode),typeof s.multimodeMaxImages=="number"&&(i.multimodeMaxImages=Ci(s.multimodeMaxImages)),j1(s.promptMode)&&(i.promptMode=s.promptMode),typeof s.prompt=="string"&&(i.prompt=s.prompt);const o=Oi(s.insertedPrompts);return o&&(i.insertedPrompts=o),i}catch{return{}}}function st(l){try{const s=pg();localStorage.setItem(Kh,JSON.stringify({...s,...l}))}catch{}}function I1(l,s){const i={},o=s.userPrompt||s.prompt;typeof o=="string"&&(i.prompt=o),dg(s.quality)&&(i.quality=s.quality),fg(s.format)&&(i.format=s.format),mg(s.moderation)&&(i.moderation=s.moderation),(s.promptMode==="auto"||s.promptMode==="direct")&&(i.promptMode=s.promptMode),s.model&&Lh(s.model)&&(i.imageModel=s.model);const u=R1(s.size);return u.preset&&(i.sizePreset=u.preset),u.preset==="custom"&&u.w&&u.h&&(i.customW=aa(u.w,l.customW),i.customH=aa(u.h,l.customH)),i}function os(l,s){if(l.sizePreset!=="custom")return null;const i=mu(l.customW,l.customH,l.customW,l.customH);return i.adjusted?{requestedW:i.requestedW,requestedH:i.requestedH,adjustedW:i.w,adjustedH:i.h,reasons:i.reasons,continuation:s}:null}const At=pg(),_=Mh((l,s)=>({provider:At.provider??"oauth",quality:At.quality??"medium",sizePreset:At.sizePreset??"1024x1024",customW:At.customW??1920,customH:At.customH??1088,format:At.format??"png",moderation:At.moderation??"low",count:At.count??1,multimode:At.multimode??!1,multimodeMaxImages:At.multimodeMaxImages??4,multimodeSequences:{},multimodeAbortControllers:{},multimodePreviewFlightId:null,promptMode:At.promptMode??"auto",prompt:At.prompt??"",insertedPrompts:At.insertedPrompts??[],referenceImages:[],canvasReferenceImage:null,workspaceProfile:(()=>{try{return localStorage.getItem("ima2.workspaceProfile")==="prompt-studio"?"prompt-studio":"default"}catch{return"default"}})(),promptBuilderOpen:!1,promptLibraryOpen:!1,promptLibrary:{prompts:[],folders:[]},promptLibraryLoading:!1,galleryFavorites:new Set,browserId:Oh(),canvasOpen:!1,canvasZoom:1,canvasPanX:0,canvasPanY:0,canvasExportBackground:$p().mode,canvasExportMatteColor:$p().matteColor,addReferences:async i=>{const o=Pt-s().referenceImages.length,u=i.slice(0,Math.max(0,o)),d=u.filter(es),p=u.filter(E=>!es(E)),y=(await Promise.all(p.map(async E=>{try{return await lu(E,{preserveTransparency:Dp(E)})}catch(b){return console.warn("[addReferences] compress failed",b),null}}))).filter(E=>!!E);l(E=>({referenceImages:[...E.referenceImages,...y].slice(0,Pt)})),d.length>0&&s().showToast(J("toast.refHeicUnsupported"),!0),p.length-y.length>0&&s().showToast(J("toast.refTooLarge"),!0),i.length>o&&s().showToast(J("toast.refLimitExceeded"),!0)},addReferenceDataUrl:i=>{l(o=>o.referenceImages.length>=Pt?o:{referenceImages:[...o.referenceImages,i]})},metadataRestore:null,readDroppedImageMetadata:async(i,o=null)=>{if(!i.type.startsWith("image/"))return!1;let u="";try{u=await Gb(i);const d=await Ab({filename:i.name,dataUrl:u});return d.metadata?(l({metadataRestore:{filename:i.name,image:u,metadata:d.metadata,source:d.source??"xmp",targetNodeId:o}}),!0):!1}catch{return s().showToast(J("metadata.readFailed"),!0),!1}},applyMetadataRestore:()=>{const i=s().metadataRestore;if(!i)return;const o=I1(s(),i.metadata);if(o.imageModel&&th(o.imageModel),i.targetNodeId&&typeof o.prompt=="string"){const u=o.prompt;l({...o,metadataRestore:null,graphNodes:s().graphNodes.map(d=>d.id===i.targetNodeId?{...d,data:{...d.data,prompt:u}}:d)}),s().scheduleGraphSave()}else l({...o,metadataRestore:null});s().showToast(J("metadata.applied"))},cancelMetadataRestore:()=>l({metadataRestore:null}),addMetadataRestoreAsReference:()=>{const i=s().metadataRestore;i&&(i.targetNodeId?s().addNodeReferenceDataUrl(i.targetNodeId,i.image):s().addReferenceDataUrl(i.image),l({metadataRestore:null}))},removeReference:i=>{l(o=>({referenceImages:o.referenceImages.filter((u,d)=>d!==i),canvasReferenceImage:o.referenceImages[i]===o.canvasReferenceImage?null:o.canvasReferenceImage}))},clearReferences:()=>l({referenceImages:[],canvasReferenceImage:null}),attachCanvasVersionReference:async i=>{let o;try{o=await ls(i.image,i.filename||"canvas-version-reference.png")}catch{throw s().showToast(J("toast.currentImageLoadFailed"),!0),new Error("canvas_reference_attach_failed")}l(u=>{const p=(u.canvasReferenceImage?u.referenceImages.filter(m=>m!==u.canvasReferenceImage):u.referenceImages).filter(m=>m!==o);return{canvasReferenceImage:o,referenceImages:[o,...p].slice(0,Pt)}}),s().showToast(J("canvas.version.usingAsReference"))},useCurrentAsReference:async()=>{const i=s().currentImage;if(!i){s().showToast(J("toast.noCurrentImageForRef"),!0);return}if(s().referenceImages.length>=Pt){s().showToast(J("toast.refSlotFull"),!0);return}let o;try{o=await ls(i.image,i.filename||"current-reference.png")}catch{s().showToast(J("toast.currentImageLoadFailed"),!0);return}l(u=>({referenceImages:[...u.referenceImages,o].slice(0,Pt)})),s().showToast(J("toast.addedCurrentAsRef"))},useImageAsReference:async i=>{if(s().referenceImages.length>=Pt){s().showToast(J("toast.refSlotFull"),!0);return}let o;try{o=await ls(i.image,i.filename||"canvas-reference.png")}catch{s().showToast(J("toast.currentImageLoadFailed"),!0);return}l(u=>({referenceImages:[...u.referenceImages,o].slice(0,Pt)})),s().showToast(J("toast.addedCurrentAsRef"))},activeGenerations:0,unseenGeneratedCount:0,inFlight:[],cancelInFlightJob:async i=>{if(i){l(o=>{const u=o.inFlight.map(d=>d.id===i?{...d,phase:"canceling"}:d);return $t(u),{inFlight:u}});try{await Fc(i),s().startInFlightPolling()}catch{s().showToast(J("toast.cancelFailed"),!0)}}},startInFlightPolling:()=>{if(typeof window>"u")return;const i=window;if(i.__ima2InflightTimer)return;const o=async()=>{if(s().inFlight.length===0&&s().activeGenerations===0){i.__ima2InflightTimer&&(clearInterval(i.__ima2InflightTimer),i.__ima2InflightTimer=void 0);return}let d=new Set;try{const p=ah(s()),{jobs:m,terminalJobs:y=[]}=await lh(p);d=new Set(m.map(V=>V.requestId));const g=new Map(m.map(V=>[V.requestId,V])),E=new Map(y.map(V=>[V.requestId,V])),b=[];let S=!1;const x=Date.now(),M=5e3,I=[];for(const V of s().inFlight){if(!nh(V,p)){I.push(V);continue}const L=E.get(V.id);if(L){S=!0,L.status==="error"&&b.push(ih(L));continue}if(!g.has(V.id)&&x-V.startedAt>M){S=!0;continue}const Y=g.get(V.id);if(Y){const j=ns(Y),W={...V,phase:j.phase,sessionId:j.sessionId,parentNodeId:j.parentNodeId,clientNodeId:j.clientNodeId,kind:j.kind};(W.phase!==V.phase||W.sessionId!==V.sessionId||W.parentNodeId!==V.parentNodeId||W.clientNodeId!==V.clientNodeId||W.kind!==V.kind)&&(S=!0),I.push(W)}else I.push(V)}const B=new Set(I.map(V=>V.id));for(const V of m)B.has(V.requestId)||(I.push(ns(V)),S=!0);S&&($t(I),l({inFlight:I,activeGenerations:I.length}));for(const V of b)bi(V,s())}catch{}try{const p=s().history.reduce((b,S)=>S.createdAt&&S.createdAt>b?S.createdAt:b,0),{items:m}=await gl({limit:Ft,since:p}),y=m.map(Si);y.length>0&&l(b=>{const S=new Set(b.history.map(Kt)),x=y.filter(I=>{const B=Kt(I);return S.has(B)?!1:(S.add(B),!0)});if(x.length===0)return{};const M=b.currentImage??x[0];return!b.currentImage&&x[0]?.filename&&ea(x[0].filename),{history:gs([...x,...b.history],Math.max(Ft,b.history.length+x.length)),currentImage:M,loadedHistoryRetainLimit:Math.max(b.loadedHistoryRetainLimit,b.history.length+x.length)}});const g=Date.now(),E=s().inFlight.filter(b=>d.has(b.id)||g-b.startedAt<ig);E.length!==s().inFlight.length&&($t(E),l({inFlight:E,activeGenerations:E.length}))}catch{}};i.__ima2InflightTimer=window.setInterval(o,1500)},reconcileInflight:async()=>{try{const i=ah(s()),{jobs:o,terminalJobs:u=[]}=await lh(i),d=new Map(o.map(x=>[x.requestId,x])),p=new Map(u.map(x=>[x.requestId,x])),m=[],y=Date.now(),g=s().inFlight,b=(g.length>0?g:ch()).flatMap(x=>{const M=d.get(x.id);if(M){const B=ns(M);return[{...x,...B,prompt:x.prompt||B.prompt}]}if(!nh(x,i))return[x];const I=p.get(x.id);return I?(I.status==="error"&&m.push(ih(I)),[]):y-x.startedAt<1e4?[x]:[]}),S=new Set(b.map(x=>x.id));for(const x of o)S.has(x.requestId)||b.push(ns(x));$t(b),l({inFlight:b,activeGenerations:b.length});for(const x of m)bi(x,s());b.length>0&&s().startInFlightPolling()}catch{}},syncFromStorage:()=>{const i=ch(),o=uh(),u=eh();l(d=>{const p=o?d.history.find(E=>E.filename===o)??null:null,m=p?Wt(d.history,p):null,y=Tn(d.history)[0]??null,g=d.currentImage?.canvasVersion?Wt(d.history,d.currentImage)??y:d.currentImage;return{inFlight:i,activeGenerations:i.length,imageModel:u,currentImage:o&&g?.filename!==o?m??g:g}}),i.length>0&&s().startInFlightPolling()},currentImage:null,applyMergedCanvasImage:i=>{l(o=>({history:i.filename?o.history.some(u=>u.filename===i.filename)?o.history.map(u=>u.filename===i.filename?i:u):gs([i,...o.history],o.loadedHistoryRetainLimit+1):o.history,loadedHistoryRetainLimit:Math.max(o.loadedHistoryRetainLimit,Math.min(o.history.length+1,o.loadedHistoryRetainLimit+1))}))},addGeneratedHistoryItem:async i=>{await ss(i,l,s)},history:[],historyNextCursor:null,historyLoadingOlder:!1,favoriteHistoryNextCursor:null,favoriteHistoryLoadingOlder:!1,loadedHistoryRetainLimit:Ft,loadOlderHistory:async()=>{const i=s().historyNextCursor;if(!(!i||s().historyLoadingOlder)){l({historyLoadingOlder:!0});try{const o=await gl({limit:Ft,cursor:i}),u=o.items.map(Si);l(d=>{const p=new Set(d.history.map(y=>y.filename??y.image)),m=u.filter(y=>{const g=y.filename??y.image;return p.has(g)?!1:(p.add(g),!0)});return{history:[...d.history,...m],historyNextCursor:o.nextCursor,historyLoadingOlder:!1,loadedHistoryRetainLimit:Math.max(d.loadedHistoryRetainLimit,d.history.length+m.length)}})}catch{l({historyLoadingOlder:!1}),s().showToast(J("gallery.loadOlderFailed"),!0)}}},loadFavoriteHistory:async()=>{try{const i=await gl({limit:Ft,favoritesOnly:!0}),o=i.items.map(Si);l(u=>{const d=dh(u.history,o);return{history:d,favoriteHistoryNextCursor:i.nextCursor,loadedHistoryRetainLimit:Math.max(u.loadedHistoryRetainLimit,d.length),galleryFavorites:new Set([...Array.from(u.galleryFavorites),...o.filter(p=>p.filename).map(p=>p.filename)])}})}catch{s().showToast(J("gallery.loadOlderFailed"),!0)}},loadOlderFavoriteHistory:async()=>{const i=s().favoriteHistoryNextCursor;if(!(!i||s().favoriteHistoryLoadingOlder)){l({favoriteHistoryLoadingOlder:!0});try{const o=await gl({limit:Ft,cursor:i,favoritesOnly:!0}),u=o.items.map(Si);l(d=>{const p=dh(d.history,u);return{history:p,favoriteHistoryNextCursor:o.nextCursor,favoriteHistoryLoadingOlder:!1,loadedHistoryRetainLimit:Math.max(d.loadedHistoryRetainLimit,p.length),galleryFavorites:new Set([...Array.from(d.galleryFavorites),...u.filter(m=>m.filename).map(m=>m.filename)])}})}catch{l({favoriteHistoryLoadingOlder:!1}),s().showToast(J("gallery.loadOlderFailed"),!0)}}},trashPending:null,toast:null,toastLog:[],customSizeConfirm:null,errorCard:null,errorCardLog:[],rightPanelOpen:p1(),toggleRightPanel:()=>l(i=>{const o=!i.rightPanelOpen;try{localStorage.setItem(qh,JSON.stringify(o))}catch{}return{rightPanelOpen:o}}),composeSheetOpen:!1,composeSheetTab:"prompt",openComposeSheet:(i="prompt")=>l({composeSheetOpen:!0,composeSheetTab:i}),setComposeSheetTab:i=>l({composeSheetTab:i}),closeComposeSheet:()=>l({composeSheetOpen:!1}),galleryOpen:!1,openGallery:()=>l(i=>({galleryOpen:!0,galleryScope:i.galleryDefaultScope})),closeGallery:()=>l({galleryOpen:!1}),galleryScope:Jp(Xc),galleryDefaultScope:Jp(Fp),setGalleryScope:i=>{try{localStorage.setItem(Xc,i)}catch{}l({galleryScope:i})},setGalleryDefaultScope:i=>{try{localStorage.setItem(Fp,i),localStorage.setItem(Xc,i)}catch{}l({galleryDefaultScope:i,galleryScope:i})},imageModel:eh(),reasoningEffort:y1(),webSearchEnabled:b1(),settingsOpen:!1,activeSettingsSection:"account",readinessPopupOpen:!1,openSettings:(i="account")=>l({settingsOpen:!0,activeSettingsSection:i}),closeSettings:()=>l({settingsOpen:!1}),toggleSettings:()=>l(i=>({settingsOpen:!i.settingsOpen,activeSettingsSection:i.settingsOpen?i.activeSettingsSection:"account"})),setActiveSettingsSection:i=>l({activeSettingsSection:i}),openReadinessPopup:()=>l({readinessPopupOpen:!0}),closeReadinessPopup:()=>l({readinessPopupOpen:!1}),uiMode:h1(),setUIMode:i=>{const o=i==="card-news"&&!$h?"classic":i;try{localStorage.setItem(Hh,o)}catch{}l({uiMode:o})},theme:$c(),resolvedTheme:as($c()),themeFamily:Zp(),historyStripLayout:g1(),setTheme:i=>{try{localStorage.setItem(Gh,i)}catch{}l({theme:i,resolvedTheme:as(i)})},setThemeFamily:i=>{try{localStorage.setItem(Uh,i)}catch{}l({themeFamily:i})},setHistoryStripLayout:i=>{try{localStorage.setItem(kh,i)}catch{}l({historyStripLayout:i})},syncThemeFromStorage:()=>{const i=$c();l({theme:i,resolvedTheme:as(i)})},syncThemeFamilyFromStorage:()=>{l({themeFamily:Zp()})},refreshResolvedTheme:()=>{l(i=>({resolvedTheme:as(i.theme)}))},locale:T0(),setLocale:i=>{N0(i),l({locale:i})},graphNodes:[],graphEdges:[],setGraphNodes:i=>{l({graphNodes:Qa(i,s().graphEdges)}),s().scheduleGraphSave()},setGraphEdges:i=>{l({graphEdges:i,graphNodes:Qa(s().graphNodes,i)}),s().scheduleGraphSave()},disconnectEdge:i=>{s().disconnectEdges([i])},disconnectEdges:i=>{const o=new Set(i);if(o.size===0)return;const u=s().graphEdges.filter(y=>o.has(y.id));if(u.length===0)return;const d=s().graphEdges.filter(y=>!o.has(y.id)),p=new Set(u.map(y=>y.target)),m=s().graphNodes.map(y=>{if(!p.has(y.id))return y;const g=d.find(b=>b.target===y.id),E=g?s().graphNodes.find(b=>b.id===g.source):null;return{...y,data:{...y.data,parentServerNodeId:E?.data.serverNodeId??null}}});l({graphNodes:Qa(m,d),graphEdges:d}),s().scheduleGraphSave(),s().flushGraphSave("edge-disconnect"),s().showToast(J("edge.disconnected"))},nodeSelectionMode:!1,nodeBatchRunning:!1,nodeBatchStopping:!1,toggleNodeSelectionMode:()=>{const i=!s().nodeSelectionMode;l({nodeSelectionMode:i,...i?{}:{graphNodes:Ti(s().graphNodes,[])}})},selectAllGraphNodes:()=>{l({graphNodes:Ti(s().graphNodes,s().graphNodes.map(i=>i.id))})},selectNodeGraph:(i,o)=>{l({graphNodes:$0(s().graphNodes,s().graphEdges,i,o)})},clearNodeSelection:()=>{l({graphNodes:Ti(s().graphNodes,[])})},cancelNodeBatch:()=>{s().nodeBatchRunning&&(l({nodeBatchStopping:!0}),s().showToast(J("nodeBatch.stopQueued")))},sessions:[],activeSessionId:null,activeSessionGraphVersion:null,sessionLoading:!1,async loadSessions(){try{const{sessions:i}=await Mb();if(l({sessions:i}),!s().activeSessionId){const u=T1(),d=u?i.some(p=>p.id===u):!1;u&&d?await s().switchSession(u):await s().createAndSwitchSession(J("session.firstGraph"))}}catch(i){console.warn("[sessions] load failed:",i)}},async switchSession(i){l({sessionLoading:!0}),await s().flushGraphSave("switch-session");try{const{session:o}=await jh(i),{graphNodes:u,graphEdges:d,graphVersion:p}=cg(o);l({activeSessionId:i,activeSessionGraphVersion:p,graphNodes:u,graphEdges:d,sessionLoading:!1}),eu(i),await s().reconcileGraphPending().catch(()=>{})}catch(o){console.warn("[sessions] switch failed:",o),l({sessionLoading:!1}),s().showToast(J("toast.sessionLoadFailed"),!0)}},async reconcileGraphPending(){const i=s().activeSessionId;if(!i)return;if(s().graphNodes.filter(u=>u.data?.pendingRequestId&&(u.data.status==="pending"||u.data.status==="reconciling")).length>0){let u=[];try{u=(await Rh({kind:"node",sessionId:i})).jobs}catch{u=[]}const d=new Map(u.map(g=>[g.requestId,g.phase])),p=Date.now(),m=1e4,y=s().graphNodes.map(g=>{const E=g.data?.pendingRequestId;if(!E||g.data.status!=="pending"&&g.data.status!=="reconciling")return g;if(d.has(E)){const x=d.get(E)??null;return{...g,data:{...g.data,status:"reconciling",pendingPhase:x}}}const b=g.data.pendingStartedAt??0;if(b&&p-b<m)return{...g,data:{...g.data,status:"reconciling"}};const S=!!g.data.imageUrl||!!g.data.serverNodeId;return{...g,data:{...g.data,pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,status:S?"ready":"stale",error:S?void 0:J("session.assetAbortedError")}}});l({graphNodes:y})}await bg(s,l).catch(()=>{})},async createAndSwitchSession(i){i==null&&(i=J("session.untitled"));try{const{session:o}=await Rb(i);l({sessions:[o,...s().sessions],activeSessionId:o.id,activeSessionGraphVersion:o.graphVersion,graphNodes:[],graphEdges:[]}),eu(o.id)}catch(o){console.warn("[sessions] create failed:",o),s().showToast(J("toast.sessionCreateFailed"),!0)}},async renameCurrentSession(i){const o=s().activeSessionId;if(o)try{await Ob(o,i),l({sessions:s().sessions.map(u=>u.id===o?{...u,title:i,updatedAt:Date.now()}:u)})}catch{s().showToast(J("toast.sessionRenameFailed"),!0)}},async deleteSessionById(i){try{await jb(i);const o=s().sessions.filter(u=>u.id!==i);l({sessions:o}),s().activeSessionId===i&&(l({activeSessionId:null,activeSessionGraphVersion:null,graphNodes:[],graphEdges:[]}),eu(null),o.length>0?await s().switchSession(o[0].id):await s().createAndSwitchSession(J("session.firstGraph")))}catch{s().showToast(J("toast.sessionDeleteFailed"),!0)}},scheduleGraphSave(){xg(s,l)},async flushGraphSave(i="manual"){await H1(s,l,i)},addRootNode:()=>{const i=vn(),o={id:i,type:"imageNode",position:Qc(s().graphNodes),data:{clientId:i,serverNodeId:null,parentServerNodeId:null,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return l({graphNodes:[...s().graphNodes,o]}),s().scheduleGraphSave(),i},createRootNodeFromHistoryItem:i=>{const o=vn(),u={id:o,type:"imageNode",position:Qc(s().graphNodes),data:{clientId:o,serverNodeId:i.nodeId??null,parentServerNodeId:null,prompt:i.prompt??"",imageUrl:i.image,status:"ready",pendingRequestId:null,pendingPhase:null,model:i.model??null,size:i.size??null}};return l({uiMode:"node",graphNodes:[...s().graphNodes,u]}),s().scheduleGraphSave(),o},addChildNode:i=>{const o=s().graphNodes.find(m=>m.id===i);if(!o)return i;const u=vn(),d={id:u,type:"imageNode",position:Kp(o,s().graphNodes,s().graphEdges),data:{clientId:u,serverNodeId:null,parentServerNodeId:o.data.serverNodeId,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},p={id:is(i,u,ml,xi),source:i,target:u,sourceHandle:ml,targetHandle:xi};return l({graphNodes:[...s().graphNodes,d],graphEdges:[...s().graphEdges,p]}),s().scheduleGraphSave(),u},addSiblingNode:i=>{const o=s().graphNodes.find(E=>E.id===i);if(!o)return i;const u=s().graphEdges.find(E=>E.target===i);if(!u){const E=vn(),b={id:E,type:"imageNode",position:Qc(s().graphNodes),data:{clientId:E,serverNodeId:null,parentServerNodeId:null,prompt:o.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return l({graphNodes:[...s().graphNodes,b]}),s().scheduleGraphSave(),E}const d=u.source,p=s().graphNodes.find(E=>E.id===d);if(!p)return i;const m=vn(),y={id:m,type:"imageNode",position:Kp(p,s().graphNodes,s().graphEdges),data:{clientId:m,serverNodeId:null,parentServerNodeId:o.data.parentServerNodeId,prompt:o.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},g={id:is(d,m,ml,xi),source:d,target:m,sourceHandle:ml,targetHandle:xi};return l({graphNodes:[...s().graphNodes,y],graphEdges:[...s().graphEdges,g]}),s().scheduleGraphSave(),m},updateNodePrompt:(i,o)=>{l({graphNodes:s().graphNodes.map(u=>u.id===i?{...u,data:{...u.data,prompt:o}}:u)}),s().scheduleGraphSave()},addNodeReferences:async(i,o)=>{const u=s().graphNodes.find(x=>x.id===i);if(!u)return;const d=u.data.referenceImages??[],p=Pt-d.length;if(p<=0){s().showToast(J("toast.refLimitExceeded"),!0);return}const m=o.slice(0,Math.max(0,p)),y=m.filter(es),g=m.filter(x=>!es(x)),b=(await Promise.all(g.map(async x=>{try{return await lu(x,{preserveTransparency:Dp(x)})}catch(M){return console.warn("[addNodeReferences] compress failed",M),null}}))).filter(x=>!!x);if(b.length>0){const x=s().activeSessionId;l({graphNodes:s().graphNodes.map(M=>{if(M.id!==i)return M;const I=[...M.data.referenceImages??[],...b].slice(0,Pt);return ps(x,i,I),{...M,data:{...M.data,referenceImages:I}}})}),s().scheduleGraphSave()}y.length>0&&s().showToast(J("toast.refHeicUnsupported"),!0),g.length-b.length>0&&s().showToast(J("toast.refTooLarge"),!0),o.length>p&&s().showToast(J("toast.refLimitExceeded"),!0)},addNodeReferenceDataUrl:(i,o)=>{s().graphNodes.find(d=>d.id===i)&&(l({graphNodes:s().graphNodes.map(d=>{if(d.id!==i)return d;const p=d.data.referenceImages??[];if(p.length>=Pt)return d;const m=[...p,o];return ps(s().activeSessionId,i,m),{...d,data:{...d.data,referenceImages:m}}})}),s().scheduleGraphSave())},removeNodeReference:(i,o)=>{l({graphNodes:s().graphNodes.map(u=>{if(u.id!==i)return u;const d=(u.data.referenceImages??[]).filter((p,m)=>m!==o);return ps(s().activeSessionId,i,d),{...u,data:{...u.data,referenceImages:d}}})}),s().scheduleGraphSave()},clearNodeReferences:i=>{Zc(s().activeSessionId,i),l({graphNodes:s().graphNodes.map(o=>o.id===i?{...o,data:{...o.data,referenceImages:void 0}}:o)}),s().scheduleGraphSave()},duplicateBranchRoot:i=>{const o=s().graphNodes.find(p=>p.id===i);if(!o)return i;const u=vn();s().graphNodes.filter(p=>!p.data.parentServerNodeId).length;const d={id:u,type:"imageNode",position:{x:o.position.x+420,y:o.position.y+40},data:{clientId:u,serverNodeId:null,parentServerNodeId:null,prompt:o.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};if(l({graphNodes:[...s().graphNodes,d]}),s().scheduleGraphSave(),o.data.imageUrl){const p=o.data.imageUrl;(async()=>{try{const m=await ls(p,"node-reference.png");l({graphNodes:s().graphNodes.map(y=>y.id===u?{...y,data:{...y.data,referenceImages:[m]}}:y)})}catch{}})()}return u},async generateNode(i){const o=s().graphNodes.find(p=>p.id===i);if(!o)return;const{prompt:u}=o.data;if(!u.trim()){s().showToast(J("toast.promptRequired"),!0);return}const d=os(s(),{kind:"node",clientId:i});if(d){l({customSizeConfirm:d});return}await s().runGenerateNode(i)},async generateNodeInPlace(i){const o=s().graphNodes.find(d=>d.id===i);if(!o)return;if(!o.data.prompt.trim()){s().showToast(J("toast.promptRequired"),!0);return}const u=os(s(),{kind:"node-in-place",clientId:i});if(u){l({customSizeConfirm:u});return}await s().runGenerateNodeInPlace(i)},async generateNodeVariation(i,o){const u=s().graphNodes.find(p=>p.id===i);if(!u)return;if(!u.data.prompt.trim()){s().showToast(J("toast.promptRequired"),!0);return}if(!o){const p=os(s(),{kind:"node-variation",clientId:i});if(p){l({customSizeConfirm:p});return}}const d=s().addSiblingNode(i);await s().runGenerateNodeInPlace(d,{sizeOverride:o})},async runGenerateNode(i,o){const d=s().graphNodes.find(p=>p.id===i)?.data.status==="ready"?s().addSiblingNode(i):i;await s().runGenerateNodeInPlace(d,{sizeOverride:o})},async runGenerateNodeInPlace(i,o={}){if(fl.has(i))return null;fl.add(i);const u=s().graphNodes,d=Qa(u,s().graphEdges);d.some((j,W)=>j.data.parentServerNodeId!==u[W]?.data.parentServerNodeId)&&l({graphNodes:d});const p=d.find(j=>j.id===i);if(!p)return fl.delete(i),null;const{prompt:m,parentServerNodeId:y}=p.data;if(!m.trim())return s().showToast(J("toast.promptRequired"),!0),fl.delete(i),null;const g=p.data.referenceImages??[],E=s(),b=o.sizeOverride??E.getResolvedSize(),S=o.parentServerNodeIdOverride!==void 0?o.parentServerNodeIdOverride:y;if(s().graphEdges.find(j=>j.target===i)&&!S)return s().showToast(J("node.parentImageRequired"),!0),fl.delete(i),null;const M=E.activeSessionId,I=Date.now(),B=Math.random().toString(36).slice(2,6),V=`fn_${i}_${I}_${B}`,L=[...E.inFlight,{id:V,prompt:m,startedAt:I,kind:"node",sessionId:M,clientNodeId:i}];$t(L),l({graphNodes:s().graphNodes.map(j=>j.id===i?{...j,data:{...j.data,status:"pending",pendingRequestId:V,recoveryRequestId:V,pendingPhase:"queued",pendingStartedAt:I,partialImageUrl:null,error:void 0,size:b}}:j),activeGenerations:E.activeGenerations+1,inFlight:L}),s().startInFlightPolling();let Y=!0;try{const j=await hb({parentNodeId:S,prompt:m,quality:E.quality,size:b,format:E.format,moderation:E.moderation,model:E.imageModel,reasoningEffort:E.reasoningEffort,requestId:V,sessionId:M,clientNodeId:i,contextMode:"parent-plus-refs",searchMode:E.webSearchEnabled?"on":"off",webSearchEnabled:E.webSearchEnabled,...g.length?{references:g.map(tu)}:{}},{onPartial:W=>{s().activeSessionId===M&&l({graphNodes:s().graphNodes.map(P=>P.id===i?{...P,data:{...P.data,status:"pending",partialImageUrl:W.image,pendingPhase:"partial"}}:P)})},onPhase:W=>{s().activeSessionId===M&&W.phase&&l({graphNodes:s().graphNodes.map(P=>P.id===i?{...P,data:{...P.data,pendingPhase:W.phase??P.data.pendingPhase}}:P)})}});return s().activeSessionId===M&&(l({graphNodes:s().graphNodes.map(W=>{if(W.id!==i)return W;const P={...W.data};return delete P.partialImageUrl,{...W,data:{...P,serverNodeId:j.nodeId,imageUrl:j.url,status:"ready",pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,elapsed:j.elapsed,webSearchCalls:j.webSearchCalls,model:j.model??null,size:j.size??b}}})}),Y=!0,o.suppressToast||s().showToast(J("toast.nodeCreated",{id:j.nodeId.slice(0,8),elapsed:j.elapsed}))),j.nodeId}catch(j){const W=j instanceof Error?j.message:J("toast.nodeCreateFailed");return s().activeSessionId===M&&(l({graphNodes:s().graphNodes.map(P=>P.id===i?{...P,data:{...P.data,status:"error",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:W}}:P)}),Y=!0,bi(j,s())),null}finally{fl.delete(i);const j=s().inFlight.filter(W=>W.id!==V);$t(j),l({activeGenerations:Math.max(0,s().activeGenerations-1),inFlight:j}),s().activeSessionId===M&&Y&&(s().scheduleGraphSave(),s().flushGraphSave("node-complete"))}},async runNodeBatch(i){if(s().nodeBatchRunning)return;const o=Jh(s().graphNodes);if(o.length===0){s().showToast(J("nodeBatch.noneSelected"),!0);return}const u=n1(s().graphNodes,s().graphEdges,o);if(u.length>0){s().showToast(J("nodeBatch.parentRequired",{count:u.length}),!0);return}const d=e1(s().graphNodes,s().graphEdges,o),p=new Set(o),m=d.filter(E=>{if(i==="regenerate-all")return!0;const b=s().graphNodes.find(S=>S.id===E);return b?!W0(b):!1});if(m.length===0){s().showToast(J("nodeBatch.nothingToRun"));return}l({nodeBatchRunning:!0,nodeBatchStopping:!1});const y=new Map;let g=0;try{for(const E of m){if(s().nodeBatchStopping)break;const b=s().graphEdges.find(B=>B.target===E),S=b?y.get(b.source)??s().graphNodes.find(B=>B.id===E)?.data.parentServerNodeId??null:null,x=await s().runGenerateNodeInPlace(E,{parentServerNodeIdOverride:S,suppressToast:!0});if(!x){s().showToast(J("nodeBatch.failed",{done:g,total:m.length}),!0);break}g+=1,y.set(E,x);const M=a1(s().graphEdges,E,p),I=new Set(t1(s().graphEdges,p));l({graphNodes:s().graphNodes.map(B=>I.has(B.id)?{...B,data:{...B.data,status:"stale",parentServerNodeId:M.includes(B.id)?x:B.data.parentServerNodeId,error:J("nodeBatch.staleBecauseParentChanged")}}:B)})}s().showToast(J("nodeBatch.finished",{done:g,total:m.length})),s().scheduleGraphSave()}finally{l({nodeBatchRunning:!1,nodeBatchStopping:!1})}},deleteNode:i=>{const u=s().graphNodes.find(m=>m.id===i)?.data?.pendingRequestId;u&&Fc(u),Zc(s().activeSessionId,i);const d=s().graphNodes.filter(m=>m.id!==i),p=s().graphEdges.filter(m=>m.source!==i&&m.target!==i);l({graphNodes:Qa(d,p),graphEdges:p}),s().scheduleGraphSave()},deleteNodes:i=>{const o=new Set(i);for(const p of o)Zc(s().activeSessionId,p);for(const p of s().graphNodes)o.has(p.id)&&p.data?.pendingRequestId&&Fc(p.data.pendingRequestId);const u=s().graphNodes.filter(p=>!o.has(p.id)),d=s().graphEdges.filter(p=>!o.has(p.source)&&!o.has(p.target));l({graphNodes:Qa(u,d),graphEdges:d}),s().scheduleGraphSave()},addChildNodeAt:(i,o,u=ml)=>{const d=s().graphNodes.find(b=>b.id===i);if(!d)return i;const p=vn(),m=_1(u,"source")??ml,y=C1(m)??xi,g={id:p,type:"imageNode",position:o,data:{clientId:p,serverNodeId:null,parentServerNodeId:d.data.serverNodeId,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},E={id:is(i,p,m,y),source:i,target:p,sourceHandle:m,targetHandle:y};return l({graphNodes:[...s().graphNodes,g],graphEdges:[...s().graphEdges,E]}),s().scheduleGraphSave(),p},connectNodes:(i,o,u=null,d=null)=>{if(i===o||s().graphEdges.find(g=>g.source===i&&g.target===o))return;if(K0(s().graphEdges,i,o)){s().showToast(J("edge.parentConflict"),!0);return}if(!s().graphNodes.find(g=>g.id===i))return;const y=[...s().graphEdges,{id:is(i,o,u,d),source:i,target:o,sourceHandle:u,targetHandle:d}];l({graphNodes:Qa(s().graphNodes,y),graphEdges:y}),s().scheduleGraphSave()},setProvider:i=>{st({provider:i}),l({provider:i})},setQuality:i=>{st({quality:i}),l({quality:i})},setSizePreset:i=>{st({sizePreset:i}),l({sizePreset:i})},setCustomSize:(i,o)=>l(u=>{const d=aa(i,u.customW),p=aa(o,u.customH);return st({customW:d,customH:p}),{customW:d,customH:p}}),setFormat:i=>{st({format:i}),l({format:i})},setModeration:i=>{st({moderation:i}),l({moderation:i})},setImageModel:i=>{th(i),l({imageModel:i})},setReasoningEffort:i=>{v1(i),l({reasoningEffort:i})},setWebSearchEnabled:i=>{S1(i),l({webSearchEnabled:i})},setCount:i=>{const o=Ci(i);st({count:o}),l({count:o})},setMultimode:i=>{if(i&&s().uiMode!=="classic")return;st({multimode:i});const o=s();l({multimode:i,multimodeSequences:i?o.multimodeSequences:{},multimodePreviewFlightId:i?o.multimodePreviewFlightId:null})},setMultimodeMaxImages:i=>{const o=Ci(i);st({multimodeMaxImages:o}),l({multimodeMaxImages:o})},setPromptMode:i=>{st({promptMode:i}),l({promptMode:i})},setPrompt:i=>{st({prompt:i}),l({prompt:i})},insertPromptToComposer:i=>l(o=>{const u=o.insertedPrompts.some(m=>m.id===i.id),d={...i,placement:i.placement==="after"?"after":"before"},p=u?o.insertedPrompts:[...o.insertedPrompts,d];return st({insertedPrompts:p}),{insertedPrompts:p}}),removeInsertedPromptFromComposer:i=>l(o=>{const u=o.insertedPrompts.filter(d=>d.id!==i);return st({insertedPrompts:u}),{insertedPrompts:u}}),moveInsertedPromptInComposer:(i,o)=>l(u=>{const d=u.insertedPrompts.filter(x=>x.placement!=="after"),p=u.insertedPrompts.filter(x=>x.placement==="after"),m=[...d.map(x=>({kind:"prompt",prompt:x})),{kind:"main"},...p.map(x=>({kind:"prompt",prompt:x}))],y=m.findIndex(x=>x.kind==="prompt"&&x.prompt.id===i);if(y<0)return{};const g=o==="up"?y-1:y+1;if(g<0||g>=m.length)return{};const[E]=m.splice(y,1);m.splice(g,0,E);const b=m.findIndex(x=>x.kind==="main"),S=m.filter(x=>x.kind==="prompt").map((x,M)=>({...x.prompt,placement:M<b?"before":"after"}));return st({insertedPrompts:S}),{insertedPrompts:S}}),clearInsertedPrompts:()=>{st({insertedPrompts:[]}),l({insertedPrompts:[]})},selectHistory:i=>{const o=s().history,u=i.canvasVersion?Wt(o,i)??Tn(o)[0]??null:Wt(o,i)??i;ea(u?.filename??null);const p=Ai(s().workspaceProfile).restoreComposerFromHistory&&u?E1(u):{};Object.keys(p).length>0&&st(p),l({currentImage:u,unseenGeneratedCount:0,multimodePreviewFlightId:null,...p})},showHistorySequence:i=>{const o=s().history.filter(y=>y.sequenceId===i&&!y.canvasVersion).sort(tg);if(o.length===0)return;const u=`history:${i}`,d=Math.max(o.length,...o.map(y=>y.sequenceTotalRequested??0)),p=o.length,m=o[0]?.sequenceStatus==="empty"?"empty":p>=d?"complete":"partial";ea(null),l(y=>({currentImage:null,unseenGeneratedCount:0,canvasOpen:!1,multimodePreviewFlightId:u,multimodeSequences:{...y.multimodeSequences,[u]:{sequenceId:i,requestId:u,requested:d,returned:p,images:o,partials:[],status:m}}}))},markGeneratedResultsSeen:()=>l({unseenGeneratedCount:0}),selectHistoryShortcutTarget:i=>{const o=s(),u=Ai(o.workspaceProfile);if(o.uiMode==="classic"&&u.multimodeHistoryGrouping==="sequence"){const p=u1(o.history,o.currentImage,i,A1(o));if(!p)return;if(p.type==="sequence"){s().showHistorySequence(p.sequenceId);return}s().selectHistory(p.item);return}const d=r1(o.history,o.currentImage,i);d&&s().selectHistory(d)},trashHistoryItem:async i=>{const o=i.canvasVersion?Wt(s().history,i):i;if(!o||o.canvasVersion||!o.filename){s().showToast(J("gallery.deleteFailed"),!0);return}const u=o.filename,d=s().currentImage,m=(d?Wt(s().history,d)??d:null)?.filename===u,y=m?Xp(s().history,u):d;try{await jp(u),l(g=>{const E=w1(g.multimodeSequences,u),b=g.multimodePreviewFlightId&&!E[g.multimodePreviewFlightId]?null:g.multimodePreviewFlightId;return{history:g.history.filter(S=>S.filename!==u),currentImage:y,multimodePreviewFlightId:b,multimodeSequences:E,trashPending:null}}),m&&ea(y?.filename??null),s().showToast(J("gallery.movedToSystemTrash",{filename:u}))}catch(g){console.error("[history] trash failed",g),s().showToast(J("gallery.deleteFailed"),!0)}},trashHistorySequence:async i=>{const o=s().history.filter(g=>g.sequenceId===i&&!g.canvasVersion&&!!g.filename);if(o.length===0){s().showToast(J("gallery.deleteFailed"),!0);return}if(!window.confirm(J("history.deleteSequenceConfirm",{count:o.length})))return;const d=new Set(o.map(g=>g.filename).filter(g=>!!g)),p=s().currentImage,m=!!(p?.filename&&d.has(p.filename)),y=s().multimodePreviewFlightId===`history:${i}`||s().multimodePreviewFlightId===i;try{for(const g of d)await jp(g);l(g=>{const E={...g.multimodeSequences};return delete E[`history:${i}`],delete E[i],{history:g.history.filter(b=>!b.filename||!d.has(b.filename)),currentImage:m?null:g.currentImage,multimodePreviewFlightId:y?null:g.multimodePreviewFlightId,multimodeSequences:E,trashPending:null}}),m&&ea(null),s().showToast(J("history.sequenceDeleted",{count:d.size}))}catch(g){console.error("[history] sequence trash failed",g),s().showToast(J("gallery.deleteFailed"),!0)}},restorePendingTrash:async()=>{const i=s().trashPending;if(i)try{await Cb(i.filename,i.trashId),s().addHistoryItem(i.item),l({trashPending:null})}catch(o){console.error("[history] restore failed",o),s().showToast(J("gallery.restoreFailed"),!0)}},clearPendingTrash:()=>l({trashPending:null}),permanentlyDeleteHistoryItemByClick:async i=>{await s().permanentlyDeleteHistoryItemByShortcut(i)},permanentlyDeleteHistoryItemByShortcut:async i=>{const o=i.canvasVersion?Wt(s().history,i):i;if(!o||o.canvasVersion||!o.filename){s().showToast(J("gallery.deleteFailed"),!0);return}const u=o.filename;if(!window.confirm(J("result.permanentDeleteConfirm",{filename:u})))return;const p=s().currentImage,y=(p?Wt(s().history,p)??p:null)?.filename===u,g=y?Xp(s().history,u):p;try{await _b(u),l(E=>({history:E.history.filter(b=>b.filename!==u),currentImage:g,trashPending:E.trashPending?.filename===u?null:E.trashPending})),y&&ea(g?.filename??null),s().showToast(J("gallery.permanentDeleted",{filename:u}))}catch(E){console.error("[history] permanent delete failed",E),s().showToast(J("gallery.deleteFailed"),!0)}},removeFromHistory:i=>{const o=s(),u=o.history.filter(p=>p.filename!==i),d=o.currentImage&&o.currentImage.filename===i?null:o.currentImage;l({history:u,currentImage:d}),d===null&&ea(null)},addHistoryItem:i=>{const o=s(),u={...i,createdAt:i.createdAt||Date.now()},d=sg(o.history,u),p=rg(u,d),m=og(o.history,p);l({history:gs([p,...m],o.loadedHistoryRetainLimit+1),loadedHistoryRetainLimit:Math.max(o.loadedHistoryRetainLimit,Math.min(o.history.length+1,o.loadedHistoryRetainLimit+1))})},importLocalImageToHistory:async i=>{if(!i.type||!/^image\/(png|jpeg|webp)$/.test(i.type))return s().showToast(J("toast.localImportInvalid"),!0),null;try{const o=await kb(i);return s().addHistoryItem(o),l({currentImage:o,unseenGeneratedCount:0}),o.filename&&ea(o.filename),s().showToast(J("toast.localImportSuccess")),o}catch{return s().showToast(J("toast.localImportFailed"),!0),null}},getResolvedSize:()=>{const{sizePreset:i,customW:o,customH:u}=s();return i==="custom"?`${o}x${u}`:i},async generate(){const i=s();if(!Wc(i.prompt,i.insertedPrompts))return;const u=i.uiMode==="classic"&&i.multimode,d=os(i,{kind:u?"multimode":"classic"});if(d){l({customSizeConfirm:d});return}if(u){await s().generateMultimode();return}await s().runGenerate()},async generateMultimode(i){const o=s();if(o.uiMode!=="classic")return;const u=Wc(o.prompt,o.insertedPrompts);if(!u)return;const d=o.prompt,p=su(o.insertedPrompts),m=i??o.getResolvedSize(),y=`mm_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,g=new AbortController,E=Date.now(),b=Ci(o.multimodeMaxImages),S=[...o.inFlight,{id:y,prompt:u,startedAt:E,kind:"multimode",composerPrompt:d,composerInsertedPrompts:p}],x={sequenceId:y,requestId:y,requested:b,returned:0,images:[],partials:[],status:"pending"};$t(S),l({activeGenerations:o.activeGenerations+1,inFlight:S,multimodeAbortControllers:{...o.multimodeAbortControllers,[y]:g},multimodeSequences:{...o.multimodeSequences,[y]:x},multimodePreviewFlightId:y}),s().startInFlightPolling();try{const M=await Sb({prompt:u,quality:o.quality,size:m,format:o.format,moderation:o.moderation,provider:o.provider,maxImages:b,model:o.imageModel,reasoningEffort:o.reasoningEffort,webSearchEnabled:o.webSearchEnabled,requestId:y,mode:o.promptMode,composerPrompt:d,composerInsertedPrompts:p,...o.referenceImages.length?{references:o.referenceImages.map(tu)}:{}},{onPartial:V=>{l(L=>{const Y=L.multimodeSequences[y];return Y?{multimodeSequences:{...L.multimodeSequences,[y]:{...Y,partials:[...Y.partials,{image:V.image,index:V.index??null}].slice(-b)}}}:{}})},onImage:V=>{l(L=>{const Y=L.multimodeSequences[y];if(!Y)return{};const j=rh(Y.images,[V]);return j.length===Y.images.length?{}:{multimodeSequences:{...L.multimodeSequences,[y]:{...Y,sequenceId:V.sequenceId??Y.sequenceId,returned:j.length,images:j,status:"partial"}}}})}},{signal:g.signal}),I=M.images.map(V=>({...V,prompt:u,elapsed:Number.parseFloat(M.elapsed),provider:M.provider,usage:M.usage,requestId:V.requestId??M.requestId??y,composerPrompt:d,composerInsertedPrompts:p,quality:M.quality??o.quality,size:M.size??m,model:M.model??o.imageModel}));for(const V of I)await ss(V,l,s);l(V=>({multimodeSequences:{...V.multimodeSequences,[y]:(()=>{const L=V.multimodeSequences[y],Y=rh(L?.images??[],I);return{sequenceId:M.sequenceId,requestId:y,requested:M.requested,returned:Y.length,images:Y,partials:[],status:M.status,elapsed:M.elapsed}})()}}));const B=M.status==="complete"?"multimode.complete":"multimode.partial";s().showToast(J(B,{returned:M.returned,requested:M.requested,elapsed:M.elapsed}))}catch(M){M.name==="AbortError"||oh(M)?l(I=>{const B=I.multimodeSequences[y];return B?{multimodeSequences:{...I.multimodeSequences,[y]:{...B,status:"canceled"}}}:{}}):(l(I=>{const B=I.multimodeSequences[y];return B?{multimodeSequences:{...I.multimodeSequences,[y]:{...B,status:"error",error:M.message}}}:{}}),bi(M,s()))}finally{const M=s().inFlight.filter(I=>I.id!==y);$t(M),l(I=>{const B={...I.multimodeAbortControllers};delete B[y];let V=I.multimodePreviewFlightId;if(V===y){const L=I.multimodeSequences[y]?.status;if(!(L==="complete"||L==="partial")){const j=Object.keys(B);V=j.length>0?j[j.length-1]:null}}return{activeGenerations:Math.max(0,I.activeGenerations-1),inFlight:M,multimodeAbortControllers:B,multimodePreviewFlightId:V}})}},cancelMultimode:()=>{const i=s().multimodePreviewFlightId;i&&(s().multimodeAbortControllers[i]?.abort(),s().cancelInFlightJob(i),l(o=>{const u=o.multimodeSequences[i];return u?{multimodeSequences:{...o.multimodeSequences,[i]:{...u,status:"canceled"}}}:{}}))},async runGenerate(i){const o=s(),u=Wc(o.prompt,o.insertedPrompts);if(!u)return;const d=o.prompt,p=su(o.insertedPrompts),m=i??o.getResolvedSize(),y=`f_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,g=Date.now(),E=[...o.inFlight,{id:y,prompt:u,startedAt:g,composerPrompt:d,composerInsertedPrompts:p}];$t(E),l({activeGenerations:o.activeGenerations+1,inFlight:E}),s().startInFlightPolling();try{const b={prompt:u,quality:o.quality,size:m,format:o.format,moderation:o.moderation,provider:o.provider,n:o.count,model:o.imageModel,reasoningEffort:o.reasoningEffort,webSearchEnabled:o.webSearchEnabled,requestId:y,mode:o.promptMode,composerPrompt:d,composerInsertedPrompts:p,...o.referenceImages.length?{references:o.referenceImages.map(tu)}:{}},S=await vb(b);if(Op(S)&&S.images.length>1){for(const x of S.images){const M={image:x.image,filename:x.filename,prompt:u,composerPrompt:d,composerInsertedPrompts:p,elapsed:S.elapsed,provider:S.provider,usage:S.usage,requestId:S.requestId??y,quality:S.quality??o.quality,size:S.size??m,model:S.model??o.imageModel};await ss(M,l,s)}s().showToast(J("toast.generatedBatch",{count:S.images.length,elapsed:S.elapsed}))}else{let x;if(Op(S)){const M=S.images[0];x={image:M.image,filename:M.filename,prompt:u,composerPrompt:d,composerInsertedPrompts:p,elapsed:S.elapsed,provider:S.provider,usage:S.usage,requestId:S.requestId??y,quality:S.quality??o.quality,size:S.size??m,model:S.model??o.imageModel}}else x={image:S.image,filename:S.filename,prompt:u,composerPrompt:d,composerInsertedPrompts:p,elapsed:S.elapsed,provider:S.provider,usage:S.usage,requestId:S.requestId??y,quality:S.quality??o.quality,size:S.size??m,model:S.model??o.imageModel};await ss(x,l,s),s().showToast(J("toast.generatedSingle",{elapsed:S.elapsed}))}}catch(b){oh(b)||bi(b,s())}finally{const b=s().inFlight.filter(S=>S.id!==y);$t(b),l({activeGenerations:Math.max(0,s().activeGenerations-1),inFlight:b})}},async confirmCustomSizeAdjustment(){const i=s().customSizeConfirm;if(!i)return;const o=M1(i.adjustedW,i.adjustedH);if(l({customW:i.adjustedW,customH:i.adjustedH,customSizeConfirm:null}),i.continuation.kind==="classic"){await s().runGenerate(o);return}if(i.continuation.kind==="multimode"){await s().generateMultimode(o);return}if(i.continuation.kind==="node-in-place"){await s().runGenerateNodeInPlace(i.continuation.clientId,{sizeOverride:o});return}if(i.continuation.kind==="node-variation"){await s().generateNodeVariation(i.continuation.clientId,o);return}await s().runGenerateNode(i.continuation.clientId,o)},cancelCustomSizeAdjustment:()=>l({customSizeConfirm:null}),hydrateHistory(){(async()=>{try{const i=await gl({limit:Ft}),o=i.items.map(Si);if(l({historyNextCursor:i.nextCursor,loadedHistoryRetainLimit:Ft}),o.length>0){const u=uh(),d=u?o.find(y=>y.filename===u):null,p=Tn(o),m=(d?Wt(o,d):null)??p[0]??null;l({history:o,currentImage:m,historyNextCursor:i.nextCursor,loadedHistoryRetainLimit:Math.max(Ft,o.length)}),m?.filename!==u&&ea(m?.filename??null)}}catch(i){console.warn("[history] load failed:",i)}})()},showToast(i,o=!1){const u=Date.now(),d={message:i,error:o,id:u+Math.random(),createdAt:u};l(p=>({toast:d,toastLog:[...p.toastLog,d]}))},dismissToast(i){l(o=>{const u=o.toastLog.filter(d=>d.id!==i);return{toastLog:u,toast:o.toast?.id===i?u[u.length-1]??null:o.toast}})},showErrorCard(i,o){const u=Date.now(),d={code:i,fallbackMessage:o?.fallbackMessage,id:u+Math.random(),createdAt:u};l(p=>({errorCard:d,errorCardLog:[...p.errorCardLog,d]}))},dismissErrorCard(i){l(o=>{if(i==null)return{errorCard:null,errorCardLog:[]};const u=o.errorCardLog.filter(d=>d.id!==i);return{errorCardLog:u,errorCard:o.errorCard?.id===i?u[u.length-1]??null:o.errorCard}})},setWorkspaceProfile(i){l({workspaceProfile:i});try{localStorage.setItem("ima2.workspaceProfile",i)}catch{}},togglePromptBuilder(){l(i=>({promptBuilderOpen:!i.promptBuilderOpen}))},setPromptLibraryOpen(i){l({promptLibraryOpen:i})},togglePromptLibrary(){l(i=>({promptLibraryOpen:!i.promptLibraryOpen}))},async loadPromptLibrary(){l({promptLibraryLoading:!0});try{const i=await Ib();l({promptLibrary:{prompts:i.prompts,folders:i.folders},promptLibraryLoading:!1})}catch(i){console.error("[PromptLibrary] load failed",i),l({promptLibraryLoading:!1})}},async savePromptToLibrary(i){try{await Db(i),await s().loadPromptLibrary(),s().showToast(J("promptLibrary.saved"))}catch(o){console.error("[PromptLibrary] save failed",o),s().showToast(J("promptLibrary.saveFailed"),!0)}},async deletePromptFromLibrary(i){try{await Lb(i),await s().loadPromptLibrary()}catch(o){console.error("[PromptLibrary] delete failed",o)}},async togglePromptFavorite(i){try{await qb(i),await s().loadPromptLibrary()}catch(o){console.error("[PromptLibrary] favorite toggle failed",o)}},async importPromptsToLibrary(i){try{const o=[];for(const d of i){if(!/\.(txt|md|markdown)$/i.test(d.name))continue;const p=await d.text();if(!p.trim())continue;const m=d.name.replace(/\.(txt|md|markdown)$/i,"");o.push({name:m.trim()||J("promptLibrary.untitled"),text:p.trim(),tags:[]})}if(o.length===0){s().showToast(J("promptLibrary.importNoValidFiles"),!0);return}const u=await Hb({prompts:o});await s().loadPromptLibrary(),s().showToast(J("promptLibrary.imported",{count:u.promptsImported}))}catch(o){console.error("[PromptLibrary] import failed",o),s().showToast(J("promptLibrary.importFailed"),!0)}},async toggleGalleryFavorite(i){try{const o=await Eb(i);l(u=>{const d=new Set(u.galleryFavorites);return o.isFavorite?d.add(i):d.delete(i),{galleryFavorites:d}}),l(u=>({history:u.history.map(d=>d.filename===i?{...d,isFavorite:o.isFavorite}:d)}))}catch(o){console.error("[GalleryFavorite] toggle failed",o)}},openCanvas:()=>l({canvasOpen:!0,canvasZoom:1,canvasPanX:0,canvasPanY:0}),closeCanvas:()=>l({canvasOpen:!1}),setCanvasZoom:i=>l({canvasZoom:Math.max(.5,Math.min(3,i))}),resetCanvasZoom:()=>l({canvasZoom:1,canvasPanX:0,canvasPanY:0}),setCanvasPan:(i,o)=>{l({canvasPanX:Math.max(-4e3,Math.min(4e3,i)),canvasPanY:Math.max(-4e3,Math.min(4e3,o))})},resetCanvasPan:()=>l({canvasPanX:0,canvasPanY:0}),setCanvasExportBackground:i=>{l({canvasExportBackground:i}),Wp(i,s().canvasExportMatteColor)},setCanvasExportMatteColor:i=>{l({canvasExportMatteColor:i}),Wp(s().canvasExportBackground,i)}})),D1=800;let ta=null,ys=!1,vs=!1,bn=null,hg=0;function gg(){try{const l=sessionStorage.getItem(Pp);if(l)return l;const s=`tab_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`;return sessionStorage.setItem(Pp,s),s}catch{return"tab_unavailable"}}function yg(l){const s={...l};return delete s.referenceImages,delete s.partialImageUrl,l.status==="pending"||l.status==="reconciling"?{...s,status:"empty",pendingRequestId:null,recoveryRequestId:l.pendingRequestId??l.recoveryRequestId??null,pendingPhase:null,pendingStartedAt:null,error:void 0}:s}function vg(l){return l.map(s=>({id:s.id,source:s.source,target:s.target,data:{sourceHandle:s.sourceHandle??null,targetHandle:s.targetHandle??null}}))}async function bg(l,s){const i=l().activeSessionId;if(!i||l().graphNodes.filter(m=>!m.data.imageUrl&&!m.data.serverNodeId).length===0)return;let u=[];try{u=(await gl({sessionId:i,limit:Ft})).items}catch{return}let d=!1;const p=l().graphNodes.map(m=>{if(m.data.imageUrl||m.data.serverNodeId)return m;const y=m.data.pendingStartedAt??0,g=m.data.pendingRequestId??m.data.recoveryRequestId??null,b=(g?u.find(S=>(S.sessionId??null)===i&&(S.requestId??null)===g):null)??u.find(S=>(S.sessionId??null)===i&&(S.clientNodeId??null)===m.id&&(!y||(S.createdAt??0)>=y));return b?(d=!0,{...m,data:{...m.data,status:"ready",imageUrl:b.url,serverNodeId:b.nodeId??m.data.serverNodeId,size:b.size??m.data.size??null,pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:void 0}}):m});d&&(s({graphNodes:p}),xg(l,s,"recovery"))}async function L1(l,s){const i=l().activeSessionId;if(!i)return;const{session:o}=await jh(i),{graphNodes:u,graphEdges:d,graphVersion:p}=cg(o);s({graphNodes:u,graphEdges:d,activeSessionGraphVersion:p}),l().showToast(J("toast.sessionReloadedElsewhere"),!0),await bg(l,s).catch(()=>{})}async function q1(l,s,i){const o=l().activeSessionId,u=l().activeSessionGraphVersion;if(!o||u==null)return"skipped";const{graphNodes:d,graphEdges:p}=l(),m=d.map(E=>({id:E.id,x:E.position.x,y:E.position.y,data:yg(E.data)})),y=vg(p),g=`gs_${Date.now().toString(36)}_${++hg}`;try{const E=await zb(o,u,m,y,{saveId:g,saveReason:i,tabId:gg()});return l().activeSessionId!==o?"skipped":(Z0(o,l().graphNodes.map(b=>b.id)),s({activeSessionGraphVersion:E.graphVersion}),"saved")}catch(E){return E.status===409?(await L1(l,s),"conflict"):(console.warn("[sessions] save failed:",E),"failed")}}async function Sg(l,s,i){if(ys){vs=!0,bn&&await bn;return}ys=!0,bn=(async()=>{let o=i;do{vs=!1;const u=await q1(l,s,o);if(u==="conflict"||u==="failed")break;o="queued"}while(vs)})().finally(()=>{ys=!1,bn=null}),await bn}function xg(l,s,i="debounced"){const o=l();o.activeSessionId&&(o.sessionLoading||(ta&&clearTimeout(ta),ta=setTimeout(()=>{ta=null,Sg(l,s,i)},D1)))}async function H1(l,s,i="manual"){let o=!1;if(ta&&(clearTimeout(ta),ta=null,o=!0),ys){vs=!0,bn&&await bn;return}o&&await Sg(l,s,i)}function k1(l){const s=l();if(!s.activeSessionId||s.activeSessionGraphVersion==null)return;ta&&(clearTimeout(ta),ta=null);const i=s.graphNodes.map(p=>({id:p.id,x:p.position.x,y:p.position.y,data:yg(p.data)})),o=vg(s.graphEdges),u=`/api/sessions/${encodeURIComponent(s.activeSessionId)}/graph`,d=JSON.stringify({nodes:i,edges:o});try{fetch(u,{method:"PUT",headers:{"Content-Type":"application/json","If-Match":String(s.activeSessionGraphVersion),"X-Ima2-Graph-Save-Id":`gs_${Date.now().toString(36)}_${++hg}`,"X-Ima2-Graph-Save-Reason":"beforeunload","X-Ima2-Tab-Id":gg()},body:d,keepalive:!0})}catch{}}async function ss(l,s,i){const o=await Ub(l.image).catch(()=>l.image),u=l.filename?`/generated/${l.filename}`:l.image,d={...l,thumb:o,url:u,createdAt:l.createdAt||Date.now()},p=i(),m=sg(p.history,d),y=rg(d,m),g=og(p.history,y),E=gs([y,...g],p.loadedHistoryRetainLimit+1);ea(y.filename??null),s({history:E,currentImage:y,loadedHistoryRetainLimit:Math.max(p.loadedHistoryRetainLimit,Math.min(p.history.length+1,p.loadedHistoryRetainLimit+1)),unseenGeneratedCount:i().unseenGeneratedCount+1})}function G1(l){for(const s of l.history)if(s.sessionId)return s.sessionId;return null}function U1(){const{t:l}=be(),s=_(o=>o.uiMode),i=_(o=>o.setUIMode);return f.jsxs("div",{className:"ui-mode-switch",role:"tablist","aria-label":l("uiMode.ariaLabel"),children:[f.jsx("button",{type:"button",role:"tab","aria-selected":s==="classic",className:`ui-mode-switch__tab${s==="classic"?" active":""}`,onClick:()=>i("classic"),children:l("uiMode.classic")}),f.jsx("button",{type:"button",role:"tab","aria-selected":s==="node",className:`ui-mode-switch__tab${s==="node"?" active":""}`,onClick:()=>i("node"),children:l("uiMode.node")}),null,f.jsx("button",{type:"button",role:"tab","aria-selected":s==="agent",className:`ui-mode-switch__tab${s==="agent"?" active":""}`,onClick:()=>i("agent"),children:l("uiMode.agent")})]})}function B1({text:l,mode:s,onClose:i}){const{t:o}=be(),u=_(M=>M.savePromptToLibrary),[d,p]=H.useState(l.slice(0,30)),[m,y]=H.useState(l),[g,E]=H.useState(""),[b,S]=H.useState(!1),x=async()=>{m.trim()&&(S(!0),await u({name:d.trim()||m.slice(0,30),text:m.trim(),tags:g.split(",").map(M=>M.trim()).filter(Boolean),mode:s||void 0}),S(!1),i())};return f.jsxs("div",{className:"save-prompt-popover",onClick:M=>M.stopPropagation(),children:[f.jsxs("div",{className:"save-prompt-popover__header",children:[f.jsx("span",{children:o("promptLibrary.saveTitle")}),f.jsx("button",{className:"save-prompt-popover__close",onClick:i,"aria-label":o("common.close"),children:"×"})]}),f.jsxs("div",{className:"save-prompt-popover__body",children:[f.jsxs("label",{children:[o("promptLibrary.name"),f.jsx("input",{type:"text",value:d,onChange:M=>p(M.target.value),placeholder:m.slice(0,30)})]}),f.jsxs("label",{children:[o("promptLibrary.content"),f.jsx("textarea",{value:m,onChange:M=>y(M.target.value),placeholder:"Enter prompt...",rows:4,autoFocus:!0})]}),f.jsxs("label",{children:[o("promptLibrary.tags"),f.jsx("input",{type:"text",value:g,onChange:M=>E(M.target.value),placeholder:"cta, product, summer"})]})]}),f.jsx("div",{className:"save-prompt-popover__footer",children:f.jsx("button",{onClick:x,disabled:b||!m.trim(),className:"save-prompt-popover__save",children:o(b?"common.saving":"promptLibrary.save")})})]})}function P1({variant:l="label"}){const{t:s}=be(),i=_(d=>d.webSearchEnabled),o=_(d=>d.setWebSearchEnabled),u=s(i?"settings.webSearch.on":"settings.webSearch.off");return f.jsx("button",{type:"button",className:`web-search-toggle web-search-toggle--${l}${i?" is-active":""}`,onClick:()=>o(!i),"aria-pressed":i,"aria-label":u,title:u,children:l==="compact"?f.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[f.jsx("circle",{cx:"12",cy:"12",r:"10"}),f.jsx("path",{d:"M2 12h20"}),f.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 0 20"}),f.jsx("path",{d:"M12 2a15.3 15.3 0 0 0 0 20"})]}):f.jsx("span",{children:u})})}const pl=5;function F1(l){const s=Number.parseFloat(l);return Number.isFinite(s)&&s>0?s:null}function hu({variant:l="sidebar"}){const s=_(N=>N.prompt),i=_(N=>N.setPrompt),o=_(N=>N.insertedPrompts),u=_(N=>N.removeInsertedPromptFromComposer),d=_(N=>N.moveInsertedPromptInComposer),p=_(N=>N.generate),{t:m}=be(),y=_(N=>N.referenceImages),g=_(N=>N.addReferences),E=_(N=>N.readDroppedImageMetadata),b=_(N=>N.removeReference),S=_(N=>N.useCurrentAsReference),x=_(N=>N.currentImage),M=H.useRef(null),I=H.useRef(null),[B,V]=H.useState(!1),[L,Y]=H.useState(!1),j=_(N=>N.promptMode),W=_(N=>N.setPromptMode),P=_(N=>N.multimode),$=_(N=>N.multimodeMaxImages),Ce=j==="direct",ae=o.filter(N=>N.placement!=="after"),we=o.filter(N=>N.placement==="after"),Ge=[...ae.map(N=>N.id),"__main_prompt__",...we.map(N=>N.id)],Ie=y.length<pl,ct=P?y.length>0?m("multimode.promptPlaceholderWithRefs"):m("multimode.promptPlaceholder"):y.length>0?m("prompt.placeholderWithRefs"):m("prompt.placeholder"),Ye=async N=>{N.length!==0&&(N.length===1&&await E(N[0])||await g(N))},Q=N=>{N.preventDefault(),V(!1);const F=Array.from(N.dataTransfer.files).filter(Z=>Z.type.startsWith("image/"));F.length>0&&Ye(F)},A=N=>{N.preventDefault(),B||V(!0)},X=N=>{N.currentTarget.contains(N.relatedTarget)||V(!1)},ne=N=>{if(!N)return[];const F=[];for(const Z of Array.from(N)){if(Z.kind!=="file"||!Z.type.startsWith("image/"))continue;const ie=Z.getAsFile();ie&&F.push(ie)}return F},xe=N=>{if(!Ie)return;const F=ne(N.clipboardData?.items??null);if(F.length===0)return;N.preventDefault();const Z=pl-y.length;g(F.slice(0,Z))};H.useLayoutEffect(()=>{const N=I.current;if(!N)return;N.style.height="auto";const F=F1(window.getComputedStyle(N).maxHeight),Z=F?Math.min(N.scrollHeight,F):N.scrollHeight;N.style.height=`${Z}px`},[s,l]),H.useEffect(()=>{const N=F=>{const Z=F.target,ie=Z?.tagName;if(ie==="INPUT"||ie==="TEXTAREA"||Z?.isContentEditable)return;const se=ne(F.clipboardData?.items??null);if(se.length===0||y.length>=pl)return;F.preventDefault();const he=pl-y.length;g(se.slice(0,he))};return window.addEventListener("paste",N),()=>window.removeEventListener("paste",N)},[y.length,g]);const Ee=(N,F)=>{const Z=Ge.indexOf(N);return Z<0?!1:F==="up"?Z>0:Z<Ge.length-1},w=N=>f.jsxs("div",{className:"composer__prompt-chip",title:N.name,children:[f.jsx("span",{className:"composer__prompt-chip-plus","aria-hidden":"true",children:"+"}),f.jsx("span",{className:"composer__prompt-chip-title",children:N.name}),f.jsxs("div",{className:"composer__prompt-chip-actions",children:[f.jsx("button",{type:"button",className:"composer__prompt-chip-move",onClick:()=>d(N.id,"up"),disabled:!Ee(N.id,"up"),"aria-label":m("prompt.moveBlockUp",{name:N.name}),title:m("prompt.moveBlockUp",{name:N.name}),children:"^"}),f.jsx("button",{type:"button",className:"composer__prompt-chip-move",onClick:()=>d(N.id,"down"),disabled:!Ee(N.id,"down"),"aria-label":m("prompt.moveBlockDown",{name:N.name}),title:m("prompt.moveBlockDown",{name:N.name}),children:"v"}),f.jsx("button",{type:"button",className:"composer__prompt-chip-remove",onClick:()=>u(N.id),"aria-label":m("promptLibrary.removeInserted",{name:N.name}),children:"x"})]})]},N.id);return f.jsxs("div",{className:`composer composer--${l}${B?" composer--drag":""}${Ce?" composer--direct":""}${P?" composer--multimode":""}${Ce&&P?" composer--combined-modes":""}`,role:"group","aria-label":P?m("multimode.composerAriaLabel",{count:$}):m("prompt.label"),onDrop:Q,onDragOver:A,onDragLeave:X,onPaste:xe,children:[f.jsxs("div",{className:"composer__header",children:[f.jsx("span",{className:"section-title composer__label",children:m("prompt.label")}),f.jsxs("div",{className:"composer__header-meta",children:[P&&f.jsx("span",{className:"composer__mode-badge",children:m("multimode.composerBadge",{count:$})}),Ce&&f.jsx("span",{className:"composer__direct-badge",children:m("prompt.directModeActive")}),y.length>0&&f.jsx("span",{className:"composer__count",children:m("prompt.refCount",{count:y.length,max:pl})})]})]}),y.length>0&&f.jsx("div",{className:"composer__chips",children:y.map((N,F)=>f.jsxs("div",{className:"composer__chip",title:m("prompt.refChipTitle",{n:F+1}),children:[f.jsx("img",{src:N,alt:m("prompt.refChipAlt",{n:F+1})}),f.jsx("button",{type:"button",className:"composer__chip-remove",onClick:()=>b(F),"aria-label":m("prompt.refRemoveAria",{n:F+1}),children:"×"})]},F))}),ae.length>0&&f.jsx("div",{className:"composer__prompt-chips",children:ae.map(w)}),f.jsx("textarea",{ref:I,className:"prompt-area composer__textarea",value:s,placeholder:ct,onChange:N=>i(N.target.value),onKeyDown:N=>{N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),p())}}),we.length>0&&f.jsxs("div",{className:"composer__prompt-chips composer__prompt-chips--after",children:[f.jsx("span",{className:"composer__prompt-chips-label",children:m("prompt.afterBlocks")}),we.map(w)]}),f.jsxs("div",{className:"composer__toolbar",children:[f.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>Ie&&M.current?.click(),disabled:!Ie,title:m("prompt.attachTitle"),"aria-label":m("prompt.attachTitle"),children:[f.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:f.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),f.jsx("span",{children:m("prompt.attach")})]}),f.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>{S()},disabled:!x||!Ie,title:m("prompt.useCurrentTitle"),children:[f.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[f.jsx("polyline",{points:"23 4 23 10 17 10"}),f.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}),f.jsx("span",{children:m("prompt.useCurrent")})]}),f.jsxs("button",{type:"button",className:`composer__tool${Ce?" composer__tool--on":""}`,onClick:()=>W(Ce?"auto":"direct"),title:m("prompt.directModeTitle"),"aria-label":m("prompt.directModeTitle"),"aria-pressed":Ce,children:[f.jsx("span",{"aria-hidden":"true",style:{fontWeight:700,fontSize:11},children:"1:1"}),f.jsx("span",{children:m("prompt.directMode")})]}),f.jsx(P1,{variant:"compact"}),f.jsxs("div",{style:{position:"relative"},children:[f.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>Y(N=>!N),disabled:!s.trim(),title:m("promptLibrary.saveTitle"),"aria-label":m("promptLibrary.saveTitle"),children:[f.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:f.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),f.jsx("span",{children:m("promptLibrary.save")})]}),L&&f.jsx(B1,{text:s,mode:j,onClose:()=>Y(!1)})]}),f.jsx("span",{className:"composer__hint",children:m("prompt.hint")})]}),B&&f.jsx("div",{className:"composer__dropzone","aria-hidden":"true",children:m("prompt.dropHere",{max:pl})}),f.jsx("input",{ref:M,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:N=>{const F=Array.from(N.target.files??[]);F.length>0&&Ye(F),N.target.value=""}})]})}function gu(){const l=_(p=>p.activeGenerations),s=_(p=>p.generate),i=_(p=>p.openReadinessPopup),{t:o}=be(),u=l>0,d=u?o("generate.buttonLoading",{n:l}):o("generate.button");return f.jsxs("div",{className:"generate-row",children:[f.jsx("button",{type:"button",className:`generate-btn${u?" loading":""}`,onClick:()=>{s()},children:d}),f.jsx("button",{type:"button",className:"generate-row__readiness",onClick:i,title:o("readiness.openTitle"),"aria-label":o("readiness.openTitle"),children:"?"})]})}function Y1(l,s=28){const i=l.trim().replace(/\s+/g," ");return i.length>s?`${i.slice(0,s)}...`:i}function bs(){const l=_(u=>u.inFlight),s=_(u=>u.cancelInFlightJob),{t:i}=be(),o={queued:i("inflight.queued"),streaming:i("inflight.streaming"),decoding:i("inflight.decoding"),canceling:i("inflight.canceling")};return l.length===0?null:f.jsx("ul",{className:"in-flight-list",children:l.map(u=>{const d=u.phase?o[u.phase]??u.phase:i("inflight.queued"),m=u.prompt.trim().replace(/\s+/g," ")||i("inflight.noPrompt");return f.jsxs("li",{className:"in-flight-item","data-phase":u.phase??"queued",title:m,"aria-label":`${d}: ${m}`,children:[f.jsx("span",{className:"in-flight-prompt",children:Y1(u.prompt)}),f.jsx("span",{className:"in-flight-phase",children:d}),f.jsx("button",{type:"button",className:"in-flight-cancel",onClick:()=>{s(u.id)},disabled:u.phase==="canceling","aria-label":i("inflight.cancelAria",{prompt:m}),title:i("common.cancel"),children:"×"}),f.jsx("span",{className:"in-flight-spinner","aria-hidden":"true"})]},u.id)})})}function K1(){const{t:l}=be(),s=_(S=>S.sessions),i=_(S=>S.activeSessionId),o=_(S=>S.switchSession),u=_(S=>S.createAndSwitchSession),d=_(S=>S.renameCurrentSession),p=_(S=>S.deleteSessionById),[m,y]=H.useState(!1),g=s.find(S=>S.id===i),E=()=>{const S=window.prompt(l("session.renamePrompt"),g?.title??l("session.newSession"));S&&S.trim()&&d(S.trim())},b=(S,x)=>{window.confirm(l("session.deleteConfirm",{title:x}))&&p(S)};return f.jsxs("div",{className:"session-picker",children:[f.jsxs("div",{className:"session-picker-row",children:[f.jsxs("button",{type:"button",className:"session-current",onClick:()=>y(S=>!S),title:l("session.switchTitle"),children:[f.jsx("span",{className:"session-title",children:g?.title??l("session.loading")}),f.jsx("span",{className:"session-caret",children:m?"▴":"▾"})]}),f.jsx("button",{type:"button",className:"session-btn",onClick:()=>{u(l("session.newSession"))},title:l("session.newSessionTitle"),children:"+"}),f.jsx("button",{type:"button",className:"session-btn",onClick:E,title:l("session.renameTitle"),disabled:!g,children:"✎"})]}),m&&f.jsxs("ul",{className:"session-list",children:[s.map(S=>f.jsxs("li",{className:S.id===i?"is-active":"",children:[f.jsxs("button",{type:"button",className:"session-item",onClick:()=>{y(!1),o(S.id)},children:[f.jsx("span",{className:"session-item-title",children:S.title}),f.jsx("span",{className:"session-item-count",children:S.nodeCount})]}),f.jsx("button",{type:"button",className:"session-del",onClick:()=>b(S.id,S.title),title:l("session.deleteTitle"),children:"×"})]},S.id)),s.length===0&&f.jsx("li",{className:"session-empty",children:l("session.empty")})]})]})}function V1(){const{t:l}=be(),s=_(o=>o.settingsOpen),i=_(o=>o.toggleSettings);return f.jsx("button",{type:"button",className:`settings-button${s?" is-active":""}`,onClick:i,"aria-label":l("settings.openAria"),"aria-pressed":s,title:l("settings.openTitle"),children:f.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[f.jsx("path",{d:"M12 8.2a3.8 3.8 0 1 0 0 7.6 3.8 3.8 0 0 0 0-7.6Zm0 5.7a1.9 1.9 0 1 1 0-3.8 1.9 1.9 0 0 1 0 3.8Z"}),f.jsx("path",{d:"m20.3 13.4.1-1.4-.1-1.4-2.2-.5a6.9 6.9 0 0 0-.6-1.3l1.2-1.9a9.6 9.6 0 0 0-2-2l-1.9 1.2c-.4-.2-.9-.4-1.3-.6L13 3.3a9.5 9.5 0 0 0-2.8 0l-.5 2.2c-.5.2-.9.3-1.3.6L6.5 4.9a9.6 9.6 0 0 0-2 2l1.2 1.9c-.2.4-.4.9-.6 1.3l-2.2.5a9.5 9.5 0 0 0 0 2.8l2.2.5c.2.5.3.9.6 1.3l-1.2 1.9a9.6 9.6 0 0 0 2 2l1.9-1.2c.4.2.9.4 1.3.6l.5 2.2a9.5 9.5 0 0 0 2.8 0l.5-2.2c.5-.2.9-.3 1.3-.6l1.9 1.2a9.6 9.6 0 0 0 2-2l-1.2-1.9c.2-.4.4-.9.6-1.3l2.2-.5Z"})]})})}function Eg({variant:l}){const{t:s}=be(),[i,o]=H.useState(!1),u=H.useRef(null),d=H.useRef(null),p=H.useRef([]),m=_(L=>L.imageModel),y=_(L=>L.setImageModel),g=_(L=>L.reasoningEffort),E=_(L=>L.setReasoningEffort),b=l==="settings"?"settings-image-model":"sidebar-image-model",S=Za.find(L=>L.value===m)??Za[0],x=ms.find(L=>L.value===g)??ms[0],M=L=>{y(L.target.value)},I=()=>p.current.filter(L=>L!==null),B=L=>{const Y=I();if(Y.length===0)return;const j=(L+Y.length)%Y.length;Y[j]?.focus()},V=L=>{const Y=I();if(Y.length===0)return;const j=Y.findIndex(P=>P===document.activeElement),W=Y.length-1;if(L.key==="ArrowDown"||L.key==="ArrowRight"){L.preventDefault(),B(j>=0?j+1:0);return}if(L.key==="ArrowUp"||L.key==="ArrowLeft"){L.preventDefault(),B(j>=0?j-1:W);return}if(L.key==="Home"){L.preventDefault(),B(0);return}if(L.key==="End"){L.preventDefault(),B(W);return}L.key==="Escape"&&(L.preventDefault(),o(!1),d.current?.focus())};return H.useEffect(()=>{if(l!=="sidebar"||!i)return;const L=j=>{const W=j.target;W instanceof Node&&(u.current?.contains(W)||o(!1))},Y=j=>{j.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",L),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",L),document.removeEventListener("keydown",Y)}},[i,l]),H.useEffect(()=>{if(l!=="sidebar"||!i)return;const L=Za.findIndex(j=>j.value===m),Y=requestAnimationFrame(()=>{B(L>=0?L:0)});return()=>cancelAnimationFrame(Y)},[m,i,l]),l==="sidebar"?f.jsxs("div",{ref:u,className:"image-model-select image-model-select--sidebar",children:[f.jsxs("button",{ref:d,id:b,type:"button",className:"image-model-select__trigger","aria-haspopup":"menu","aria-expanded":i,"aria-label":s("sidebar.quickSettingsAria",{model:S.shortLabel,effort:x.shortLabel}),onClick:()=>o(L=>!L),children:[f.jsx("span",{className:"image-model-select__trigger-model",children:S.shortLabel}),f.jsx("span",{className:"image-model-select__trigger-separator","aria-hidden":"true",children:"·"}),f.jsx("span",{className:"image-model-select__trigger-effort",children:x.shortLabel})]}),i?f.jsxs("div",{className:"image-model-select__menu",role:"menu","aria-label":s("sidebar.quickSettingsMenu"),onKeyDown:V,children:[f.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":s("sidebar.imageModelLabel"),children:[f.jsx("div",{className:"image-model-select__section-title",children:s("sidebar.imageModelLabel")}),Za.map((L,Y)=>f.jsxs("button",{ref:j=>{p.current[Y]=j},type:"button",className:`image-model-select__item${L.value===m?" is-active":""}`,role:"menuitemradio","aria-checked":L.value===m,tabIndex:-1,onClick:()=>{y(L.value),o(!1)},children:[f.jsx("span",{children:L.shortLabel}),f.jsx("small",{children:s(L.fullLabelKey)})]},L.value))]}),f.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":s("sidebar.reasoningLabel"),children:[f.jsx("div",{className:"image-model-select__section-title",children:s("sidebar.reasoningLabel")}),ms.map((L,Y)=>f.jsxs("button",{ref:j=>{p.current[Za.length+Y]=j},type:"button",className:`image-model-select__item${L.value===g?" is-active":""}`,role:"menuitemradio","aria-checked":L.value===g,tabIndex:-1,onClick:()=>{E(L.value),o(!1)},children:[f.jsx("span",{children:L.shortLabel}),f.jsx("small",{children:s(L.fullLabelKey)})]},L.value))]})]}):null]}):f.jsx("div",{className:"image-model-select image-model-select--settings",children:f.jsxs("select",{id:b,value:m,onChange:M,children:[Za.map(L=>f.jsx("option",{value:L.value,children:s(L.fullLabelKey)},L.value)),G0.map(L=>f.jsx("option",{value:L.value,disabled:!0,children:s(L.fullLabelKey)},L.value))]})})}function Tg(l){return{...l,textFields:Array.isArray(l.textFields)?l.textFields:[]}}function wi(l){return{...l,cards:Array.isArray(l.cards)?l.cards.map(Tg):[]}}async function _n(l,s){const i=await fetch(l,s),o=await i.json().catch(()=>({}));if(!i.ok){const u=o,d=typeof u.error=="string"?u.error:u.error?.message||`Request failed: ${i.status}`,p=new Error(d);throw typeof u.error!="string"&&(p.code=u.error?.code),p}return o}function X1(){return _n("/api/cardnews/image-templates")}function Q1(){return _n("/api/cardnews/role-templates")}async function Z1(l){const s=await _n("/api/cardnews/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});return{...s,plan:wi(s.plan)}}function J1(l){return _n("/api/cardnews/jobs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}function $1(l){return _n(`/api/cardnews/jobs/${encodeURIComponent(l)}`)}async function W1(l){const i=(await _n(`/api/cardnews/cards/${encodeURIComponent(l.card.id)}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...l,cards:[l.card]})})).cards.find(o=>o.id===l.card.id);if(!i)throw new Error("Regenerated card not found");return{card:i}}function fh(l){return _n(`/api/cardnews/sets/${encodeURIComponent(l)}`).then(s=>({...s,plan:wi(s.plan)}))}function ex(l){return`/api/cardnews/sets/${encodeURIComponent(l)}/manifest?download=1`}function tx(l){return l[0]?.id||"academy-lesson-square"}function ax(l){return l.find(s=>s.id==="mid-5")?.id||l[0]?.id||"mid-5"}function nx(l){return Math.round(l/16)*16}function Es(l){return Math.min(fu,Math.max(1024,nx(l)))}function mh(l){return l.outputSizePreset!=="custom"?l.outputSizePreset:`${Es(l.customW)}x${Es(l.customH)}`}function Ng(l){if(l){if(typeof l=="string")return l;if(typeof l=="object"&&"message"in l){const s=l.message;return typeof s=="string"?s:void 0}return String(l)}}function lx(l,s){const i=s.status||"generated";return{...l,...s,textFields:Array.isArray(s.textFields)?s.textFields:l.textFields,status:i,error:i==="error"?Ng(s.error)||J("cardNews.error"):void 0}}function ix(l){return new Promise(s=>setTimeout(s,l))}function au(l,s){const i=new Map(s.cards.map(o=>[o.id,o]));return{...l,cards:l.cards.map(o=>{const u=i.get(o.id);return u?{...o,...u,textFields:Array.isArray(u.textFields)?u.textFields:o.textFields,status:u.status||o.status,error:Ng(u.error)}:o})}}const et=Mh((l,s)=>({templates:[],roleTemplates:[],activePlan:null,selectedCardId:null,selectedTextFieldId:null,topic:"",audience:"",goal:"",contentBrief:"",imageTemplateId:"academy-lesson-square",roleTemplateId:"mid-5",outputSizePreset:"2048x2048",customW:2048,customH:2048,loading:!1,generating:!1,error:null,draftError:null,plannerMeta:null,async hydrate(){if(!(s().loading||s().templates.length>0)){l({loading:!0,error:null});try{const[i,o]=await Promise.all([X1(),Q1()]);l({templates:i.templates,roleTemplates:o.templates,imageTemplateId:tx(i.templates),roleTemplateId:ax(o.templates),loading:!1})}catch(i){l({loading:!1,error:i instanceof Error?i.message:String(i)})}}},setBriefField(i,o){l({[i]:o})},setImageTemplate(i){l({imageTemplateId:i})},setRoleTemplate(i){l({roleTemplateId:i})},setOutputSizePreset(i){l({outputSizePreset:i})},setCustomSize(i,o){l({customW:Es(i),customH:Es(o)})},async draft(){const i=s();l({loading:!0,error:null,draftError:null});try{const{plan:o,planner:u}=await Z1({topic:i.topic,audience:i.audience,goal:i.goal,contentBrief:i.contentBrief,imageTemplateId:i.imageTemplateId,roleTemplateId:i.roleTemplateId,size:mh(i)});l({activePlan:wi(o),selectedCardId:o.cards[0]?.id||null,selectedTextFieldId:null,plannerMeta:u||null,loading:!1})}catch(o){const u=o instanceof Error?o.message:String(o);l({loading:!1,draftError:u,error:u})}},updateCard(i,o){l(u=>({activePlan:u.activePlan?{...u.activePlan,cards:u.activePlan.cards.map(d=>d.id===i?{...d,...o}:d)}:null}))},updateTextField(i,o,u){l(d=>({activePlan:d.activePlan?{...d.activePlan,cards:d.activePlan.cards.map(p=>p.id!==i||p.locked?p:{...p,textFields:p.textFields.map(m=>m.id===o?{...m,...u,source:u.source||"user"}:m)})}:null}))},addTextField(i,o){l(u=>({activePlan:u.activePlan?{...u.activePlan,cards:u.activePlan.cards.map(d=>d.id===i&&!d.locked?{...d,textFields:[...d.textFields,{...o,source:"user"}]}:d)}:null,selectedTextFieldId:o.id}))},removeTextField(i,o){l(u=>({activePlan:u.activePlan?{...u.activePlan,cards:u.activePlan.cards.map(d=>d.id===i&&!d.locked?{...d,textFields:d.textFields.filter(p=>p.id!==o)}:d)}:null,selectedTextFieldId:u.selectedTextFieldId===o?null:u.selectedTextFieldId}))},selectCard(i){l({selectedCardId:i,selectedTextFieldId:null})},selectTextField(i){l({selectedTextFieldId:i})},getGenerationSummary(){const i=s().activePlan?.cards||[];return{total:i.length,done:i.filter(o=>o.status==="generated").length,queued:i.filter(o=>o.status==="queued").length,generating:i.filter(o=>o.status==="generating").length,errors:i.filter(o=>o.status==="error").length,skipped:i.filter(o=>o.locked||o.status==="skipped").length}},async generateSet(){const i=s();if(!i.activePlan)return;const o=_.getState();l({generating:!0,error:null,activePlan:{...i.activePlan,cards:i.activePlan.cards.map(u=>u.locked?{...u,status:"skipped"}:{...u,status:"queued",error:void 0})}});try{const u=s().activePlan||i.activePlan;let p=await J1({...u,size:mh(i),quality:o.quality,moderation:o.moderation,model:o.imageModel,sessionId:o.activeSessionId});for(l(y=>({activePlan:y.activePlan?au(y.activePlan,p):y.activePlan}));["queued","running"].includes(p.status);)await ix(900),p=await $1(p.jobId),l(y=>({activePlan:y.activePlan?au(y.activePlan,p):y.activePlan}));const m=await fh(p.setId).catch(()=>null);l(y=>({generating:!1,activePlan:m?.plan?wi(m.plan):y.activePlan?au(y.activePlan,p):y.activePlan,selectedTextFieldId:null})),o.showToast(J("cardNews.generated",{count:p.generated}))}catch(u){const d=u instanceof Error?u.message:String(u);l(p=>({generating:!1,error:d,activePlan:p.activePlan?{...p.activePlan,cards:p.activePlan.cards.map(m=>m.status==="queued"||m.status==="generating"?{...m,status:"error",error:d}:m)}:p.activePlan}))}},async retryCard(i){const u=s().activePlan,d=u?.cards.find(m=>m.id===i);if(!u||!d||d.locked||!["draft","error"].includes(d.status))return;const p=_.getState();l({error:null,activePlan:{...u,cards:u.cards.map(m=>m.id===i?{...m,status:"generating",error:void 0}:m)}});try{const{card:m}=await W1({setId:u.setId,card:d,quality:p.quality,moderation:p.moderation,model:p.imageModel});l(y=>({activePlan:y.activePlan?{...y.activePlan,cards:y.activePlan.cards.map(g=>g.id===i?lx(g,Tg(m)):g)}:y.activePlan}))}catch(m){const y=m instanceof Error?m.message:String(m);l(g=>({error:y,activePlan:g.activePlan?{...g.activePlan,cards:g.activePlan.cards.map(E=>E.id===i?{...E,status:"error",error:y}:E)}:g.activePlan}))}},async loadSet(i){l({loading:!0,error:null,selectedTextFieldId:null});try{const{plan:o}=await fh(i);l({activePlan:wi(o),selectedCardId:o.cards[0]?.id||null,selectedTextFieldId:null,loading:!1})}catch(o){l({loading:!1,error:o instanceof Error?o.message:String(o)})}}}));function ox(){const{t:l}=be(),s=et(j=>j.hydrate),i=et(j=>j.topic),o=et(j=>j.audience),u=et(j=>j.goal),d=et(j=>j.contentBrief),p=et(j=>j.outputSizePreset),m=et(j=>j.customW),y=et(j=>j.customH),g=et(j=>j.setBriefField),E=et(j=>j.setOutputSizePreset),b=et(j=>j.setCustomSize),S=et(j=>j.draft),x=et(j=>j.loading),M=et(j=>j.generating),I=et(j=>j.draftError),B=et(j=>j.generateSet),V=et(j=>j.activePlan),L=V?.cards||[],Y={total:L.length,done:L.filter(j=>j.status==="generated").length};return H.useEffect(()=>{s()},[s]),f.jsxs("section",{className:"card-news-composer","aria-label":l("cardNews.composer"),children:[f.jsx("div",{className:"card-news-composer__head",children:f.jsxs("div",{children:[f.jsx("div",{className:"section-title",children:l("cardNews.composer")}),f.jsx("p",{children:l("cardNews.composerHint")})]})}),f.jsxs("label",{className:"card-news-field",children:[f.jsx("span",{children:l("cardNews.topic")}),f.jsx("input",{value:i,placeholder:l("cardNews.topicPlaceholder"),onChange:j=>g("topic",j.target.value)})]}),f.jsxs("label",{className:"card-news-field",children:[f.jsx("span",{children:l("cardNews.audience")}),f.jsx("input",{value:o,placeholder:l("cardNews.audiencePlaceholder"),onChange:j=>g("audience",j.target.value)})]}),f.jsxs("label",{className:"card-news-field",children:[f.jsx("span",{children:l("cardNews.goal")}),f.jsx("input",{value:u,placeholder:l("cardNews.goalPlaceholder"),onChange:j=>g("goal",j.target.value)})]}),f.jsxs("label",{className:"card-news-field",children:[f.jsx("span",{children:l("cardNews.brief")}),f.jsx("textarea",{value:d,placeholder:l("cardNews.briefPlaceholder"),onChange:j=>g("contentBrief",j.target.value)})]}),f.jsxs("div",{className:"card-news-field",children:[f.jsx("span",{children:l("cardNews.outputSize")}),f.jsx("div",{className:"card-news-size-row",role:"group","aria-label":l("cardNews.outputSize"),children:["1024x1024","2048x2048","custom"].map(j=>f.jsx("button",{type:"button",className:`option-btn${p===j?" active":""}`,onClick:()=>E(j),children:j==="custom"?l("cardNews.customSize"):j==="1024x1024"?"1024²":"2048²"},j))}),p==="custom"?f.jsxs("div",{className:"card-news-custom-size",children:[f.jsx("input",{className:"custom-size-input",type:"text",inputMode:"numeric",value:m,onChange:j=>b(Number.parseInt(j.target.value,10)||m,y),"aria-label":l("size.width")}),f.jsx("span",{children:"×"}),f.jsx("input",{className:"custom-size-input",type:"text",inputMode:"numeric",value:y,onChange:j=>b(m,Number.parseInt(j.target.value,10)||y),"aria-label":l("size.height")})]}):null]}),f.jsxs("button",{type:"button",className:"generate-btn card-news-draft-btn",onClick:()=>{S()},disabled:x||!i.trim(),children:[x?f.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,l(x?"cardNews.drafting":"cardNews.draft")]}),I?f.jsx("div",{className:"card-news-error",role:"alert",children:I}):null,x?f.jsxs("div",{className:"card-news-inline-status",role:"status",children:[f.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}),f.jsx("span",{children:l("cardNews.drafting")})]}):null,f.jsxs("button",{type:"button",className:"composer__tool card-news-generate-btn",onClick:()=>{B()},disabled:!V||M||V.cards.every(j=>j.locked),children:[M?f.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,M?l("cardNews.progress.generating",{done:Y.done,total:Y.total}):l("cardNews.batchGenerate")]})]})}function sx({item:l,active:s,selectLabel:i,deleteLabel:o,setRef:u,onSelect:d,onDelete:p}){const m=kt(l);return f.jsxs("div",{className:"sidebar-history__item",children:[f.jsx("button",{ref:y=>u(m,y),type:"button",className:`sidebar-history__thumb${s?" active":""}`,onClick:()=>d(l),"aria-label":i,children:f.jsx("img",{src:l.thumb||l.url||l.image,alt:"",loading:"lazy",decoding:"async"})}),f.jsx("button",{type:"button",className:"sidebar-history__delete",onClick:y=>{y.preventDefault(),y.stopPropagation(),p(l)},"aria-label":o,title:o,children:"x"})]})}function rx({entry:l,active:s,selectLabel:i,deleteLabel:o,setRef:u,onSelect:d,onDelete:p}){const m=c1(l.items.length);return f.jsxs("div",{className:"sidebar-history__item",children:[f.jsxs("button",{ref:y=>u(l.key,y),type:"button",className:`sidebar-history__sequence${s?" active":""}`,onClick:()=>d(l.sequenceId),"aria-label":i,children:[f.jsx("span",{className:`sidebar-history__sequence-grid count-${m}`,"aria-hidden":"true",children:Array.from({length:m}).map((y,g)=>{const E=l.items[g];return E?f.jsx("img",{src:E.thumb||E.url||E.image,alt:"",loading:"lazy",decoding:"async"},kt(E)):f.jsx("span",{className:"sidebar-history__sequence-placeholder"},`sequence-placeholder-${l.sequenceId}-${g}`)})}),f.jsx("span",{className:"sidebar-history__sequence-badge",children:l.items.length})]}),f.jsx("button",{type:"button",className:"sidebar-history__delete",onClick:y=>{y.preventDefault(),y.stopPropagation(),p(l.sequenceId)},"aria-label":o,title:o,children:"x"})]})}const ph="ima2.sidebarHistoryCollapsed";function cx(){const l=_(I=>I.history),s=_(I=>I.currentImage),i=_(I=>I.selectHistory),o=_(I=>I.showHistorySequence),u=_(I=>I.trashHistoryItem),d=_(I=>I.trashHistorySequence),p=_(I=>{const B=I.multimodePreviewFlightId;return B?B.startsWith("history:")?B.slice(8):I.multimodeSequences[B]?.sequenceId??null:null}),m=_(I=>I.openGallery),y=H.useRef({}),[g,E]=H.useState(()=>{try{return localStorage.getItem(ph)==="1"}catch{return!1}}),{t:b}=be(),S=ng(s,p),x=H.useMemo(()=>ag(l).slice(0,eg),[l]);H.useEffect(()=>{!S||g||y.current[S]?.scrollIntoView({block:"nearest",inline:"nearest"})},[S,g,x]),H.useEffect(()=>{try{localStorage.setItem(ph,g?"1":"0")}catch{}},[g]);const M=(I,B)=>{y.current[I]=B};return f.jsxs("section",{className:`sidebar-history${g?" sidebar-history--collapsed":""}`,"aria-label":b("history.recentTitle"),children:[f.jsxs("div",{className:"sidebar-history__header",children:[f.jsx("span",{className:"section-title",children:b("history.recentTitle")}),f.jsxs("div",{className:"sidebar-history__header-actions",children:[f.jsx("button",{type:"button",className:"sidebar-history__gallery-button",onClick:m,"aria-label":b("history.galleryCard"),title:b("history.openGalleryTitle"),children:f.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[f.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),f.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),f.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),f.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),f.jsx("button",{type:"button",className:"sidebar-history__toggle",onClick:()=>E(I=>!I),title:b(g?"history.expandRecent":"history.collapseRecent"),"aria-expanded":!g,children:b(g?"history.expandRecentShort":"history.collapseRecentShort")})]})]}),g?null:f.jsxs("div",{className:"sidebar-history__grid",children:[x.length===0?f.jsx("button",{type:"button",className:"sidebar-history__empty",onClick:m,children:b("history.emptyRecent")}):null,x.map(I=>I.type==="sequence"?f.jsx(rx,{entry:I,active:S===I.key,selectLabel:b("history.selectRecent"),deleteLabel:b("history.deleteSequenceAria",{count:I.items.length}),setRef:M,onSelect:o,onDelete:B=>{d(B)}},I.key):f.jsx(sx,{item:I.item,active:S===I.key,selectLabel:b("history.selectRecent"),deleteLabel:b("history.deleteImageAria"),setRef:M,onSelect:i,onDelete:B=>{u(B)}},I.key))]})]})}const hh="(max-width: 800px)";function ji(){const[l,s]=H.useState(()=>typeof window<"u"?window.matchMedia(hh).matches:!1);return H.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(hh),o=()=>s(i.matches);return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]),l}function ux(){const{t:l}=be(),s=_(g=>g.uiMode),i=_(g=>g.workspaceProfile),o=_(g=>g.referenceImages),u=_(g=>g.clearReferences),d=ji(),p=s==="agent"&&Ri?"agent":s==="node"&&Mi?"node":"classic",m=Ai(i),y=!d&&p==="classic"&&m.composerPlacement==="bottom"&&m.multimodeHistoryGrouping==="sequence";return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"logo",children:[f.jsx("div",{className:"logo-mark","aria-hidden":"true"}),f.jsxs("div",{className:"logo-copy",children:[f.jsx("div",{className:"logo-title",children:"ima2-gen"}),f.jsx("div",{className:"logo-subtitle",children:"gpt-image-2 studio"})]}),f.jsxs("div",{className:"logo-actions",children:[f.jsx(fx,{}),f.jsx(Eg,{variant:"sidebar"}),f.jsx(V1,{})]})]}),f.jsx(U1,{}),p==="classic"?y?f.jsxs(f.Fragment,{children:[f.jsx(cx,{}),f.jsx(bs,{})]}):f.jsxs(f.Fragment,{children:[f.jsx(hu,{}),f.jsx(gu,{}),f.jsx(bs,{})]}):p==="card-news"?f.jsx(f.Fragment,{children:f.jsx(ox,{})}):p==="node"?f.jsxs(f.Fragment,{children:[f.jsx(K1,{}),o.length>0?f.jsxs("div",{className:"node-mode-ref-warning",role:"status",children:[f.jsx("strong",{children:l("node.classicRefsParkedTitle")}),f.jsx("span",{children:l("node.classicRefsParkedBody")}),f.jsx("button",{type:"button",onClick:u,children:l("node.clearParkedRefs")})]}):null,f.jsx("div",{className:"sidebar__node-hint",children:l("sidebar.nodeModeHint")}),f.jsx(bs,{})]}):null]})}function dx(){return f.jsx("aside",{className:"sidebar",children:f.jsx("div",{className:"sidebar__scroll",children:f.jsx(ux,{})})})}function fx(){const{t:l}=be(),s=_(p=>p.togglePromptLibrary),i=_(p=>p.promptLibraryOpen),o=_(p=>p.rightPanelOpen),u=_(p=>p.toggleRightPanel),d=()=>{!i&&!o&&u(),s()};return f.jsx("button",{type:"button",className:"settings-button",onClick:d,title:l("promptLibrary.title"),"aria-label":l("promptLibrary.title"),children:f.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:f.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})})}const mx=1024,px=1024,hx="blank-canvas.png";function gh(l,s){return typeof l!="number"||!Number.isFinite(l)||l<=0?s:Math.max(1,Math.round(l))}async function gx(l){const s=gh(l?.width,mx),i=gh(l?.height,px),o=document.createElement("canvas");o.width=s,o.height=i;const u=o.getContext("2d");if(!u)throw new Error("blank_canvas_context_unavailable");u.fillStyle="#ffffff",u.fillRect(0,0,o.width,o.height);const d=await new Promise((p,m)=>{o.toBlob(y=>{y?p(y):m(new Error("blank_canvas_blob_unavailable"))},"image/png")});return new File([d],hx,{type:"image/png"})}const rs=1024;function yx(l){const s=/^(\d+)x(\d+)$/.exec(l);if(!s)return{width:rs,height:rs};const i=Number.parseInt(s[1]??"",10),o=Number.parseInt(s[2]??"",10);return!Number.isFinite(i)||!Number.isFinite(o)||i<=0||o<=0?{width:rs,height:rs}:{width:i,height:o}}function vx(){const l=_(y=>y.importLocalImageToHistory),s=_(y=>y.openCanvas),i=_(y=>y.showToast),o=_(y=>y.getResolvedSize),{t:u}=be(),[d,p]=H.useState(!1),m=H.useCallback(async()=>{if(!d){p(!0);try{const y=yx(o()),g=await gx(y);await l(g)&&s()}catch{i(u("canvas.blank.failed"),!0)}finally{p(!1)}}},[d,o,l,s,i,u]);return{creatingBlankCanvas:d,createBlankCanvas:m}}const bx="canvas-mode-context",Sx="Canvas Mode",xx=["Canvas Mode context:","The user edited or annotated the reference image on a canvas.","If the image is a blank white canvas or paper with user-drawn strokes, treat those strokes as source content and preserve/complete them.","If the image is an existing picture with circles, arrows, sticky notes, handwritten marks, or memo notes over it, treat those marks as edit instructions. Apply the instruction, then remove the marks from the final image unless explicitly asked to keep them.","Infer the intended edit from the canvas marks and memo text. Preserve unrelated image content."].join(`
25
+ `);function Ex({imageOverride:l=null,onAfterDeleteFocus:s}){const{t:i}=be(),o=_(ae=>ae.currentImage),u=_(ae=>ae.showToast),d=_(ae=>ae.setPrompt),p=_(ae=>ae.insertPromptToComposer),m=_(ae=>ae.useImageAsReference),y=_(ae=>ae.createRootNodeFromHistoryItem),g=_(ae=>ae.trashHistoryItem),E=_(ae=>ae.permanentlyDeleteHistoryItemByClick),b=_(ae=>ae.canvasOpen),S=_(ae=>ae.openCanvas),[x,M]=H.useState(!1),I=l??o;if(!I)return null;const B=!!I.filename,V=()=>{const ae=document.createElement("a");ae.href=I.image,ae.download=I.filename||"generated.png",ae.click()},L=async()=>{try{const we=await(await fetch(I.image)).blob();await navigator.clipboard.write([new ClipboardItem({[we.type]:we})]),u(i("toast.imageCopied"))}catch{u(i("toast.copyFailed"),!0)}},Y=()=>{I.prompt&&(navigator.clipboard.writeText(I.prompt),u(i("toast.promptCopied")))},j=async()=>{const ae=!!I.prompt;ae&&d(I.prompt);try{await m(I)}catch{}b&&l&&p({id:bx,name:Sx,text:xx});const we=document.querySelector('textarea[name="prompt"], textarea#prompt, .sidebar textarea');we&&(we.focus(),we.setSelectionRange(we.value.length,we.value.length)),u(i(ae?"toast.forkStarted":"toast.forkStartedNoPrompt"))},W=async()=>{if(!(!I.filename||x)){M(!0);try{const ae=await wb({filename:I.filename});u(i("toast.comfyExported",{filename:ae.uploadedFilename}))}catch(ae){const we=ae instanceof Error?ae.code:void 0;u(i(we==="COMFY_URL_NOT_LOCAL"?"toast.comfyExportInvalidUrl":we==="COMFY_IMAGE_INVALID"?"toast.comfyExportInvalidImage":we==="COMFY_IMAGE_NOT_FOUND"?"toast.comfyExportImageNotFound":"toast.comfyExportFailed"),!0)}finally{M(!1)}}},P=()=>{y(I),u(i("toast.nodeRootCreated"))},$=async()=>{try{await g(I)}finally{s?.()}},Ce=async()=>{try{await E(I)}finally{s?.()}};return f.jsxs("div",{className:"result-actions",children:[f.jsx("button",{type:"button",className:"action-btn",onClick:V,children:i("result.download")}),f.jsx("button",{type:"button",className:"action-btn",onClick:L,children:i("result.copyImage")}),f.jsx("button",{type:"button",className:"action-btn",onClick:Y,children:i("result.copyPrompt")}),f.jsx("button",{type:"button",className:"action-btn action-btn--primary",onClick:j,title:i("result.continueHereTitle"),children:i("result.continueHere")}),f.jsx("button",{type:"button",className:"action-btn",onClick:P,title:i("result.firstNodeTitle"),children:i("result.firstNode")}),!b&&f.jsx("button",{type:"button",className:"action-btn",onClick:S,title:i("canvas.open"),"aria-label":i("canvas.openAria"),children:f.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:f.jsx("path",{d:"M4 4h8v8M12 4l-8 8"})})}),I.filename&&f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button",className:"action-btn action-btn--danger",onClick:()=>{$()},title:i("result.deleteTitle"),children:i("result.delete")}),f.jsxs("details",{className:"result-actions__more",children:[f.jsx("summary",{className:"action-btn",children:i("result.more")}),f.jsxs("div",{className:"result-actions__menu",children:[B&&f.jsx("button",{type:"button",className:"result-actions__menu-item",onClick:()=>{W()},title:i("result.sendToComfyUITitle"),disabled:x,children:i("result.sendToComfyUI")}),f.jsx("button",{type:"button",className:"result-actions__menu-item result-actions__danger-item",onClick:()=>{Ce()},children:i("result.permanentDelete")})]})]})]})]})}function Tx(){const l=_(S=>{const x=S.multimodePreviewFlightId;return x?S.multimodeSequences[x]??null:null}),s=_(S=>S.cancelMultimode),i=_(S=>{const x=S.multimodePreviewFlightId;return!!(x&&(S.multimodeAbortControllers[x]||S.inFlight.some(M=>M.id===x)))}),o=_(S=>S.selectHistory),u=_(S=>S.currentImage),d=_(S=>S.openCanvas),{t:p}=be(),m=S=>{o(S)},y=S=>{o(S),d()};if(!l)return null;const g=new Map,E=l.partials.filter(S=>S.index==null);for(const S of l.partials)S.index!=null&&g.set(S.index,S);const b=Array.from({length:l.requested},(S,x)=>{const M=l.images[x],I=g.get(x)??(M?void 0:E.shift());return{index:x,image:M,partial:I}});return f.jsxs("section",{className:"multimode-sequence","aria-live":"polite",children:[f.jsxs("div",{className:"multimode-sequence__header",children:[f.jsxs("div",{children:[f.jsx("div",{className:"multimode-sequence__title",children:p("multimode.sequenceTitle")}),f.jsx("div",{className:"multimode-sequence__meta",children:p("multimode.sequenceProgress",{returned:l.returned,requested:l.requested})})]}),i?f.jsx("button",{type:"button",className:"secondary-btn",onClick:s,children:p("multimode.cancel")}):null]}),f.jsx("div",{className:`multimode-sequence__grid count-${Math.min(l.requested,4)}`,children:b.map(({index:S,image:x,partial:M})=>{const I=x&&u?.filename&&x.filename===u.filename;return f.jsxs("article",{className:`multimode-sequence__slot${x?" done":""}${I?" active":""}`,onClick:x?()=>m(x):void 0,onDoubleClick:x?()=>y(x):void 0,role:x?"button":void 0,tabIndex:x?0:void 0,onKeyDown:x?B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),m(x))}:void 0,children:[f.jsx("div",{className:"multimode-sequence__badge",children:p("multimode.stageLabel",{index:S+1})}),x?f.jsx("img",{src:x.url??x.image,alt:p("canvas.resultAlt")}):M?f.jsx("img",{src:M.image,alt:p("multimode.partialAlt")}):f.jsx("div",{className:"multimode-sequence__empty",children:l.status==="error"?p("multimode.error"):l.status==="empty"?p("multimode.empty"):l.status==="canceled"?p("multimode.canceled"):l.status==="partial"?p("multimode.notReturned"):p("multimode.generating")})]},x?.filename??S)})})]})}function Nx({zoom:l,minZoom:s,maxZoom:i,onZoomIn:o,onZoomOut:u,onReset:d,labels:p}){return f.jsxs("div",{className:"viewer-controls","aria-label":p.controls,onPointerDown:m=>m.stopPropagation(),onDoubleClick:m=>m.stopPropagation(),onWheel:m=>m.stopPropagation(),children:[f.jsx("button",{type:"button",className:"viewer-control-btn",onClick:m=>{m.stopPropagation(),u()},disabled:l<=s,"aria-label":p.zoomOut,children:"-"}),f.jsxs("button",{type:"button",className:"viewer-control-btn viewer-control-btn--label",onClick:m=>{m.stopPropagation(),d()},"aria-label":p.reset,children:[Math.round(l*100),"%"]}),f.jsx("button",{type:"button",className:"viewer-control-btn",onClick:m=>{m.stopPropagation(),o()},disabled:l>=i,"aria-label":p.zoomIn,children:"+"})]})}function Ss(l){return l instanceof HTMLElement?l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement||l instanceof HTMLButtonElement||l.isContentEditable:!1}const xn=1,_g=5,cs=.22;function _x(l){return Math.min(_g,Math.max(xn,l))}function Cx(l){const[s,i]=H.useState(1),[o,u]=H.useState({x:0,y:0}),[d,p]=H.useState(null),m=H.useCallback(()=>{i(1),u({x:0,y:0}),p(null)},[]);H.useEffect(()=>{m()},[m,l]);const y=H.useCallback(M=>{i(I=>{const B=_x(I+M);return B<=xn?(u({x:0,y:0}),xn):Number(B.toFixed(2))})},[]),g=H.useCallback(M=>{M.preventDefault(),y(M.deltaY<0?cs:-cs)},[y]),E=H.useCallback(()=>{if(s>xn){m();return}i(2)},[m,s]),b=H.useCallback(M=>{s<=xn||M.button!==0||(M.preventDefault(),M.currentTarget.setPointerCapture(M.pointerId),p({pointerId:M.pointerId,startX:M.clientX,startY:M.clientY,baseX:o.x,baseY:o.y}))},[o.x,o.y,s]),S=H.useCallback(M=>{!d||d.pointerId!==M.pointerId||u({x:d.baseX+M.clientX-d.startX,y:d.baseY+M.clientY-d.startY})},[d]),x=H.useCallback(M=>{!d||d.pointerId!==M.pointerId||(p(null),M.currentTarget.releasePointerCapture(M.pointerId))},[d]);return{zoom:s,pan:o,reset:m,zoomIn:()=>y(cs),zoomOut:()=>y(-cs),handleWheel:g,handleDoubleClick:E,handlePointerDown:b,handlePointerMove:S,handlePointerUp:x}}const wx=H.lazy(()=>Ea(()=>import("./index-BbFZyM92.js"),[]).then(l=>({default:l.CanvasModeWorkspace})));function Ax(l){return l==="low"?"l":l==="medium"?"m":l==="high"?"h":l??null}function Mx(l){if(!l)return null;const s=l.match(/^(\d+)x\1$/);return s?`${s[1]}²`:l.replace("x","×")}function Rx(l){const s=l.url??l.image;if(!l.canvasVersion||!l.canvasMergedAt||s.startsWith("data:"))return s;const i=s.includes("?")?"&":"?";return`${s}${i}canvasMergedAt=${l.canvasMergedAt}`}function ru(){const l=_(A=>A.currentImage),s=_(A=>A.importLocalImageToHistory),i=_(A=>{const X=A.multimodePreviewFlightId;return X?A.multimodeSequences[X]??null:null}),o=_(A=>A.selectHistoryShortcutTarget),u=_(A=>A.trashHistoryItem),d=_(A=>A.permanentlyDeleteHistoryItemByShortcut),p=_(A=>A.markGeneratedResultsSeen),m=_(A=>A.activeGenerations),y=_(A=>A.quality),g=_(A=>A.getResolvedSize),E=_(A=>A.canvasOpen),b=_(A=>A.openCanvas),S=_(A=>A.showToast),{t:x}=be(),[M,I]=H.useState(!1),{creatingBlankCanvas:B,createBlankCanvas:V}=vx(),L=H.useRef(null),Y=l?`${l.filename??l.url??l.image}:${l.canvasMergedAt??""}`:null,j=Cx(Y),W=()=>{l?.prompt&&(navigator.clipboard.writeText(l.prompt),S(x("toast.promptCopied")))},P=A=>{if(A.key==="Delete"||A.key==="Backspace"){if(!l||A.target!==A.currentTarget||Ss(A.target))return;if(A.preventDefault(),A.shiftKey){d(l);return}u(l);return}A.key!=="ArrowLeft"&&A.key!=="ArrowRight"&&A.key!=="Home"&&A.key!=="End"||A.target===A.currentTarget&&(Ss(A.target)||(A.preventDefault(),A.key==="ArrowLeft"?o("previous"):A.key==="ArrowRight"?o("next"):A.key==="Home"?o("first"):A.key==="End"&&o("last")))},$=A=>{Ss(A.target)||(p(),A.currentTarget.focus())},Ce=H.useCallback(()=>{window.requestAnimationFrame(()=>L.current?.focus())},[]),ae=H.useCallback(A=>{Array.from(A.dataTransfer.types).includes("Files")&&(A.preventDefault(),I(X=>X||!0))},[]),we=H.useCallback(A=>{A.currentTarget.contains(A.relatedTarget)||I(!1)},[]),Ge=H.useCallback(async A=>{if(!Array.from(A.dataTransfer.types).includes("Files"))return;A.preventDefault(),I(!1);const X=Array.from(A.dataTransfer.files).filter(ne=>/^image\/(png|jpeg|webp)$/.test(ne.type));X.length!==0&&await s(X[0])},[s]);if(E&&l)return f.jsx(H.Suspense,{fallback:f.jsx("main",{className:"canvas canvas--mode-open","aria-busy":"true"}),children:f.jsx(wx,{currentImage:l})});const Ie=Ax(l?.quality??y),ct=Mx(l?.size??g()),Ye=U0(l?.model),Q=l?Rx(l):null;return f.jsxs("main",{className:`canvas${M?" canvas--drop-active":""}`,onDragOver:ae,onDragLeave:we,onDrop:Ge,children:[M?f.jsx("div",{className:"canvas__drop-overlay","aria-hidden":!0,children:f.jsx("span",{className:"canvas__drop-hint",children:x("canvas.drop.hint")})}):null,f.jsx("div",{className:`progress-bar${m>0?" active":""}`}),i?f.jsx(Tx,{}):l&&Q?f.jsxs("div",{ref:L,className:"result-container visible",tabIndex:0,onMouseDown:$,onKeyDown:P,"aria-label":x("canvas.imageViewerAria"),children:[f.jsxs("div",{className:`canvas-annotation-frame${j.zoom>xn?" canvas-annotation-frame--zoomed":""}`,onWheel:j.handleWheel,onDoubleClick:j.handleDoubleClick,onPointerDown:j.handlePointerDown,onPointerMove:j.handlePointerMove,onPointerUp:j.handlePointerUp,onPointerCancel:j.handlePointerUp,children:[f.jsx("img",{className:"result-img",src:Q,alt:x("canvas.resultAlt"),style:{transform:`translate(${j.pan.x}px, ${j.pan.y}px) scale(${j.zoom})`},onDoubleClick:A=>{A.stopPropagation(),b()}},Y??void 0),f.jsx(Nx,{zoom:j.zoom,minZoom:xn,maxZoom:_g,onZoomIn:j.zoomIn,onZoomOut:j.zoomOut,onReset:j.reset,labels:{controls:x("viewer.controls"),zoomIn:x("viewer.zoomIn"),zoomOut:x("viewer.zoomOut"),reset:x("viewer.reset")}})]}),f.jsx("div",{className:"result-meta",children:[l.elapsed!=null?`${l.elapsed}s`:null,l.usage?x("canvas.tokens",{n:l.usage.total_tokens??"?"}):null,Ie,ct,Ye,l.provider??null].filter(A=>!!A).join(" · ")}),f.jsx(Ex,{onAfterDeleteFocus:Ce}),l.prompt?f.jsx("div",{className:"result-prompt",onClick:W,children:l.prompt}):null]}):l?null:f.jsxs("div",{className:"canvas__blank-entry",children:[f.jsx("div",{className:"canvas__blank-sheet","aria-hidden":!0}),f.jsxs("div",{className:"canvas__blank-copy",children:[f.jsx("strong",{children:x("canvas.blank.title")}),f.jsx("span",{children:x("canvas.blank.subtitle")})]}),f.jsx("button",{type:"button",className:"canvas__blank-button",onClick:()=>{V()},disabled:B,children:x(B?"canvas.blank.creating":"canvas.blank.create")})]})]})}function Ox(){return f.jsxs("div",{className:"classic-workspace",children:[f.jsx("div",{className:"classic-workspace__stage",children:f.jsx(ru,{})}),f.jsxs("div",{className:"classic-workspace__dock",children:[f.jsx(hu,{variant:"bottom"}),f.jsx(gu,{})]})]})}function En({title:l,help:s,items:i,value:o,onChange:u}){return f.jsxs("div",{className:"option-group",children:[l?f.jsx("div",{className:"section-title",children:l}):null,f.jsx("div",{className:"option-row",children:i.map(d=>f.jsxs("button",{className:`option-btn${d.value===o?" active":""}`,style:d.color?{color:d.color}:void 0,disabled:d.disabled,onClick:()=>u(d.value),type:"button",children:[d.label,d.sub?f.jsxs(f.Fragment,{children:[f.jsx("br",{}),f.jsx("span",{className:"option-sub",children:d.sub})]}):null]},d.value))}),s?f.jsx("p",{className:"option-help",children:s}):null]})}const Cg="ima2.customSizeSlots";function jx(l){if(!l||typeof l!="object")return!1;const s=l;return typeof s.id=="string"&&typeof s.w=="number"&&typeof s.h=="number"&&typeof s.updatedAt=="number"}function zx(){try{const l=localStorage.getItem(Cg);if(!l)return[];const s=JSON.parse(l);return Array.isArray(s)?vl(s.filter(jx)):[]}catch{return[]}}function Ix(l){try{localStorage.setItem(Cg,JSON.stringify(vl(l)))}catch{}}function Dx(l,s,i){return _s({id:`slot_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,w:l,h:s,ratio:i,updatedAt:Date.now()})}function Ei(l){return l.map(s=>({value:s.value,label:s.label,sub:s.sub}))}function Lx(){const l=_(Q=>Q.sizePreset),s=_(Q=>Q.setSizePreset),i=_(Q=>Q.customW),o=_(Q=>Q.customH),u=_(Q=>Q.setCustomSize),{t:d}=be(),[p,m]=H.useState(String(i)),[y,g]=H.useState(String(o)),[E,b]=H.useState(l==="custom"),[S,x]=H.useState(()=>zx()),[M,I]=H.useState(null),[B,V]=H.useState("free"),L=l==="custom",Y=mu(p,y,i,o),j=H0().filter(Q=>Q.value==="auto");H.useEffect(()=>{m(String(i)),g(String(o))},[i,o]),H.useEffect(()=>{L||(b(!1),I(null))},[L]);function W(Q){x(Q),Ix(Q)}function P(){const Q=aa(p,i),A=aa(y,o);u(Q,A),m(String(Q)),g(String(A))}function $(Q){Q.key==="Enter"&&(Q.preventDefault(),P())}function Ce(){s("custom"),b(!0),I(S.length>=yl?S[0]?.id??null:null)}function ae(Q){s(Q),Q!=="custom"&&(b(!1),I(null))}function we(Q){s("custom"),u(Q.w,Q.h),m(String(Q.w)),g(String(Q.h)),b(!1),I(Q.id)}function Ge(Q){V(Q.id);const A=O0(Q);A&&(m(String(A.w)),g(String(A.h)))}function Ie(){const Q=Dx(Y.w,Y.h,B),A=S.length>=yl&&M?z0(S,M,Q):j0(S,Q);W(A),s("custom"),u(Y.w,Y.h),m(String(Y.w)),g(String(Y.h)),I(Q.id),b(!1)}const ct=Y.reasons.length>0?Y.reasons.map(Q=>d(`size.adjustedReasons.${Q}`)).join(", "):d("size.noAdjustment"),Ye=Y.reasons.includes("maxPixels")&&Y.requestedW===Y.requestedH&&Y.w===Y.h?d("size.squareMaxHint",{size:`${Hp}×${Hp}`}):null;return f.jsxs("div",{className:"option-group size-picker",children:[f.jsx("div",{className:"section-title",children:d("size.title")}),f.jsx(En,{title:"",items:Ei(I0),value:l,onChange:ae}),f.jsx(En,{title:"",items:Ei(D0),value:l,onChange:ae}),f.jsx(En,{title:"",items:Ei(L0),value:l,onChange:ae}),f.jsx(En,{title:"",items:Ei(q0),value:l,onChange:ae}),f.jsxs("div",{className:"option-row size-picker__quick-row",children:[Ei(j).map(Q=>f.jsxs("button",{type:"button",className:`option-btn${l===Q.value?" active":""}`,onClick:()=>ae(Q.value),children:[Q.label,Q.sub?f.jsxs(f.Fragment,{children:[f.jsx("br",{}),f.jsx("span",{className:"option-sub",children:Q.sub})]}):null]},Q.value)),f.jsxs("button",{type:"button",className:`option-btn${L?" active":""}`,onClick:Ce,children:[d("size.customPlus"),f.jsx("br",{}),f.jsx("span",{className:"option-sub",children:d("size.customSub")})]})]}),S.length>0?f.jsx("div",{className:"option-row size-picker__slot-row",children:S.map(Q=>f.jsxs("button",{type:"button",className:`option-btn size-picker__slot${L&&i===Q.w&&o===Q.h?" active":""}`,onClick:()=>we(Q),children:[Q.w,"×",Q.h,f.jsx("br",{}),f.jsx("span",{className:"option-sub",children:Q.ratio||d("size.customSlot")})]},Q.id))}):null,E?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"size-picker__ratio-row",children:M0.map(Q=>f.jsx("button",{type:"button",className:`size-picker__ratio${B===Q.id?" active":""}`,onClick:()=>Ge(Q),children:Q.id==="free"?d("size.ratioFree"):Q.label},Q.id))}),f.jsxs("div",{className:"option-row size-picker__custom-row",children:[f.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"custom-size-input",value:p,onChange:Q=>m(Q.target.value.replace(/\D/g,"")),onBlur:P,onKeyDown:$,placeholder:d("size.width")}),f.jsx("span",{className:"size-picker__dimension-separator","aria-hidden":"true",children:"×"}),f.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"custom-size-input",value:y,onChange:Q=>g(Q.target.value.replace(/\D/g,"")),onBlur:P,onKeyDown:$,placeholder:d("size.height")})]}),f.jsxs("div",{className:"size-picker__preview",children:[f.jsx("span",{children:d("size.normalizedPreview")}),f.jsx("strong",{children:R0(Y.w,Y.h)})]}),f.jsx("div",{className:"size-picker__preview size-picker__preview--reason",children:ct}),Ye?f.jsx("div",{className:"size-picker__preview size-picker__preview--detail",children:Ye}):null,S.length>=yl?f.jsxs("div",{className:"size-picker__replace-row",children:[f.jsx("span",{children:d("size.replaceCustomSlot")}),S.map(Q=>f.jsxs("button",{type:"button",className:`size-picker__replace${M===Q.id?" active":""}`,onClick:()=>I(Q.id),children:[Q.w,"×",Q.h]},Q.id))]}):null,f.jsx("button",{type:"button",className:"size-picker__save",onClick:Ie,children:S.length>=yl?d("size.replaceCustomSlot"):d("size.saveCustomSlot")}),f.jsx("div",{className:"size-hint",children:d("size.hint")})]}):null]})}const nu=[1,2,4];function yh(l){return Math.min(8,Math.max(1,Math.trunc(l||1)))}function qx(){const l=_(L=>L.count),s=_(L=>L.setCount),i=_(L=>L.uiMode),o=_(L=>L.multimode),u=_(L=>L.multimodeMaxImages),d=_(L=>L.setMultimodeMaxImages),{t:p}=be(),m=i==="classic"&&o,y=m?u:l,g=m?d:s,[E,b]=H.useState(!nu.includes(y)),[S,x]=H.useState(String(y));H.useEffect(()=>{b(!nu.includes(y)),x(String(y))},[m,y]);function M(L=S){const Y=yh(Number.parseInt(L,10));g(Y),x(String(Y))}function I(L){b(!1),x(String(L)),g(L)}function B(L){const Y=yh(y+L);b(!0),x(String(Y)),g(Y)}function V(L){L.key==="Enter"&&(L.preventDefault(),M())}return f.jsxs("div",{className:"option-group count-picker",children:[f.jsx("div",{className:"section-title",children:p(m?"multimode.maxStages":"count.title")}),f.jsxs("div",{className:"option-row",children:[nu.map(L=>f.jsx("button",{type:"button",className:`option-btn${y===L&&!E?" active":""}`,onClick:()=>I(L),children:L},L)),f.jsx("button",{type:"button",className:`option-btn${E?" active":""}`,onClick:()=>{b(L=>!L),x(String(y))},children:p("count.customPlus")})]}),E?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"count-picker__custom",children:[f.jsx("button",{type:"button",className:"count-picker__step",onClick:()=>B(-1),"aria-label":p("count.decrease"),children:"-"}),f.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"count-picker__input",value:S,onChange:L=>x(L.target.value.replace(/\D/g,"")),onBlur:()=>M(),onKeyDown:V,"aria-label":p("count.customLabel")}),f.jsx("button",{type:"button",className:"count-picker__step",onClick:()=>B(1),"aria-label":p("count.increase"),children:"+"})]}),f.jsx("p",{className:"option-help",children:y>=5?p(m?"multimode.highCountHint":"count.highCountHint"):p(m?"multimode.minMaxHint":"count.minMaxHint")})]}):null]})}const Hx={low:{"1024x1024":.006,"1024x1536":.005,"1536x1024":.005,"1024x1360":.005,"1360x1024":.005,"1024x1824":.006,"1824x1024":.006,"2048x2048":.012,"2048x1152":.009,"1152x2048":.009,"3840x2160":.023,"2160x3840":.023,auto:.006},medium:{"1024x1024":.053,"1024x1536":.041,"1536x1024":.041,"1024x1360":.041,"1360x1024":.041,"1024x1824":.05,"1824x1024":.05,"2048x2048":.106,"2048x1152":.08,"1152x2048":.08,"3840x2160":.2,"2160x3840":.2,auto:.053},high:{"1024x1024":.211,"1024x1536":.165,"1536x1024":.165,"1024x1360":.165,"1360x1024":.165,"1024x1824":.2,"1824x1024":.2,"2048x2048":.422,"2048x1152":.32,"1152x2048":.32,"3840x2160":.8,"2160x3840":.8,auto:.211}};function kx(l,s){return Hx[l]?.[s]??0}function Gx(){const{t:l}=be(),s=_(b=>b.provider),i=_(b=>b.quality),o=_(b=>b.multimode),u=_(b=>b.multimodeMaxImages),p=_(b=>b.getResolvedSize)(),m=s==="oauth",y=kx(i,p),g=m?l("cost.free"):o?l("cost.multimodeApprox",{amount:(y*u).toFixed(3),count:u}):l("cost.approx",{amount:y.toFixed(3)}),E=m?"var(--green)":void 0;return f.jsxs("div",{className:"cost-estimate",children:[f.jsx("span",{children:l("cost.label")}),f.jsx("span",{className:"price",style:E?{color:E}:void 0,children:g})]})}const Ux=[{value:"png",label:"PNG"},{value:"jpeg",label:"JPEG"},{value:"webp",label:"WebP"}];function wg(){const{t:l}=be(),s=_(x=>x.quality),i=_(x=>x.setQuality),o=_(x=>x.format),u=_(x=>x.setFormat),d=_(x=>x.moderation),p=_(x=>x.setModeration),m=_(x=>x.multimode),y=_(x=>x.setMultimode),E=_(x=>x.uiMode)==="classic",b=[{value:"low",label:l("quality.lowLabel"),sub:l("quality.lowSub")},{value:"medium",label:l("quality.mediumLabel"),sub:l("quality.mediumSub")},{value:"high",label:l("quality.highLabel"),sub:l("quality.highSub")}],S=[{value:"auto",label:l("moderation.autoLabel"),sub:l("moderation.autoSub")},{value:"low",label:l("moderation.lowLabel"),sub:l("moderation.lowSub"),color:"var(--amber)"}];return f.jsxs("div",{className:"right-panel-settings",role:"tabpanel",children:[f.jsx(En,{title:l("quality.title"),items:b,value:s,onChange:i}),f.jsx(Lx,{}),f.jsx(En,{title:l("format.title"),items:Ux,value:o,onChange:u}),f.jsx(En,{title:l("moderation.title"),items:S,value:d,onChange:p}),f.jsx("p",{className:"option-help",children:l("moderation.explain")}),E&&f.jsx("div",{className:"option-group multimode-toggle",children:f.jsxs("button",{type:"button",className:`multimode-toggle__button${m?" active":""}`,"aria-pressed":m,title:l("multimode.tooltip"),onClick:()=>y(!m),children:[f.jsx("span",{children:l("multimode.label")}),f.jsx("span",{children:l("multimode.shortHint")})]})}),f.jsx(qx,{}),f.jsx(Gx,{})]})}const Bx=H.lazy(()=>Ea(()=>import("./PromptLibraryPanel-NhMKVGfU.js"),[]).then(l=>({default:l.PromptLibraryPanel}))),Px=H.lazy(()=>Ea(()=>import("./PromptBuilderPanel-C3GdLDCl.js"),[]).then(l=>({default:l.PromptBuilderPanel})));function Fx(){const l=_(M=>M.rightPanelOpen),s=_(M=>M.toggleRightPanel),i=_(M=>M.promptLibraryOpen),o=_(M=>M.setPromptLibraryOpen),u=_(M=>M.promptBuilderOpen),d=_(M=>M.togglePromptBuilder),p=_(M=>M.workspaceProfile),{t:m}=be(),[y,g]=H.useState(typeof window<"u"?window.matchMedia("(max-width: 800px)").matches:!1);H.useEffect(()=>{if(typeof window>"u")return;const M=window.matchMedia("(max-width: 800px)"),I=()=>g(M.matches);return M.addEventListener("change",I),()=>M.removeEventListener("change",I)},[]);const E=m1(p)&&!y,b=y?l:!0,S=u&&E?"builder":i?"library":"settings",x=M=>{M==="builder"?(u||d(),i&&o(!1)):M==="library"?(u&&d(),i||o(!0)):(u&&d(),i&&o(!1))};return f.jsxs(f.Fragment,{children:[y&&l?f.jsx("div",{className:"right-panel-backdrop",role:"button","aria-label":m("panel.closeSettings"),onClick:s}):null,f.jsxs("aside",{className:`right-panel${l?"":" collapsed"}${y&&b?" drawer-open":""}`,"aria-label":m("panel.detailSettings"),children:[!y&&f.jsx("button",{type:"button",className:"right-panel-toggle","aria-expanded":l,"aria-controls":"right-panel-body",onClick:s,title:m(l?"panel.toggleHide":"panel.toggleShow"),children:l?">":"<"}),f.jsxs("div",{id:"right-panel-body",className:"right-panel-body",hidden:!l,children:[f.jsxs("div",{className:"right-panel-tabs",role:"tablist","aria-label":m("panel.detailSettings"),children:[E?f.jsx("button",{type:"button",role:"tab","aria-selected":S==="builder",className:`right-panel-tabs__button${S==="builder"?" active":""}`,onClick:()=>x("builder"),children:m("promptBuilder.title")}):null,f.jsx("button",{type:"button",role:"tab","aria-selected":S==="settings",className:`right-panel-tabs__button${S==="settings"?" active":""}`,onClick:()=>x("settings"),children:m("panel.detailSettings")}),f.jsx("button",{type:"button",role:"tab","aria-selected":S==="library",className:`right-panel-tabs__button${S==="library"?" active":""}`,onClick:()=>x("library"),children:m("promptLibrary.title")})]}),S==="builder"&&E?f.jsx(H.Suspense,{fallback:f.jsx("div",{className:"prompt-library-panel__loading",children:m("common.loading")}),children:f.jsx(Px,{variant:"sidebar"})}):S==="library"?f.jsx(H.Suspense,{fallback:f.jsx("div",{className:"prompt-library-panel__loading",children:m("common.loading")}),children:f.jsx(Bx,{variant:"embedded"})}):f.jsx(wg,{})]})]})]})}function Yx(l){const s=l.currentTarget;if(s.scrollWidth<=s.clientWidth||!(Math.abs(l.deltaY)>Math.abs(l.deltaX)))return;const o=s.scrollLeft<=0,u=s.scrollLeft+s.clientWidth>=s.scrollWidth-1,d=l.deltaY<0,p=l.deltaY>0;d&&o||p&&u||(l.preventDefault(),s.scrollLeft+=l.deltaY)}function Kx(){const l=_(g=>g.history),s=_(g=>g.currentImage),i=_(g=>g.historyStripLayout),o=_(g=>g.selectHistory),u=_(g=>g.openGallery),d=H.useRef({}),{t:p}=be(),m=s?kt(s):null,y=H.useMemo(()=>hs(l.filter(_i)),[l]);return H.useEffect(()=>{m&&d.current[m]?.scrollIntoView({block:"nearest",inline:"nearest"})},[m,y]),f.jsxs("div",{className:`history-strip${i==="horizontal"?" history-strip--horizontal":""}${i==="sidebar"?" history-strip--sidebar":""}`,onWheel:Yx,"data-layout":i,children:[f.jsx("button",{type:"button",className:"history-thumb history-thumb--add",onClick:u,"aria-label":p("history.openGalleryAria"),title:p("history.openGalleryTitle"),children:f.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),f.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),f.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),f.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),y.map(g=>{const E=kt(g),b=m===E;return f.jsx("img",{ref:S=>{d.current[E]=S},src:g.thumb||g.url||g.image,alt:"",className:`history-thumb${b?" active":""}`,onClick:()=>o(g)},E)})]})}const vh=3e4;function Vx(){const{t:l}=be(),s=_(g=>g.toastLog),i=_(g=>g.errorCardLog),o=_(g=>g.dismissToast),u=_(g=>g.dismissErrorCard),[d,p]=H.useState(()=>typeof document>"u"?!0:document.visibilityState==="visible"),m=H.useRef(new Map);H.useEffect(()=>{const g=()=>p(document.visibilityState==="visible");return document.addEventListener("visibilitychange",g),window.addEventListener("focus",g),window.addEventListener("blur",g),()=>{document.removeEventListener("visibilitychange",g),window.removeEventListener("focus",g),window.removeEventListener("blur",g)}},[]),H.useEffect(()=>{const g=m.current,E=new Set([...s.map(b=>`toast-${b.id}`),...i.map(b=>`error-card-${b.id}`)]);for(const[b,S]of g)(!E.has(b)||!d)&&(clearTimeout(S),g.delete(b));if(d){for(const b of s){const S=`toast-${b.id}`;if(g.has(S))continue;const x=setTimeout(()=>{g.delete(S),o(b.id)},vh);g.set(S,x)}for(const b of i){const S=`error-card-${b.id}`;if(g.has(S))continue;const x=setTimeout(()=>{g.delete(S),u(b.id)},vh);g.set(S,x)}}},[u,o,i,d,s]),H.useEffect(()=>()=>{for(const g of m.current.values())clearTimeout(g);m.current.clear()},[]);const y=[...s.map(g=>({kind:"toast",id:g.id,key:`toast-${g.id}`,message:g.message,error:g.error,createdAt:g.createdAt})),...i.map(g=>{const E=Ni[g.code]??Ni.UNKNOWN,b=l(`${E.cardKey??"errorCard.unknown"}.title`),S=l(`${E.cardKey??"errorCard.unknown"}.body`);return{kind:"error-card",id:g.id,key:`error-card-${g.id}`,message:g.fallbackMessage?`${b}: ${S} ${g.fallbackMessage}`:`${b}: ${S}`,error:!0,createdAt:g.createdAt}})].sort((g,E)=>g.createdAt-E.createdAt);return y.length===0?null:f.jsx("div",{className:"toast-stack","aria-live":"polite","aria-relevant":"additions removals",children:y.map(g=>{const E=["toast","visible",g.error?"error":"",g.kind==="error-card"?"toast--card":""].filter(Boolean).join(" ");return f.jsxs("div",{className:E,role:g.error?"alert":"status",children:[f.jsx("span",{className:"toast__message",children:g.message}),f.jsx("button",{type:"button",className:"toast__dismiss","aria-label":"Dismiss notification",onClick:()=>g.kind==="error-card"?u(g.id):o(g.id),children:"x"})]},g.key)})})}function Xx(){return null}function Qx(l){if(!l)return"earlier";const s=new Date(l);if(Number.isNaN(s.getTime()))return"earlier";const o=Math.floor((new Date().getTime()-s.getTime())/864e5);return o===0?"today":o===1?"yesterday":o<7?"thisWeek":s.toLocaleDateString("ko-KR",{year:"numeric",month:"short",day:"numeric"})}function Zx({item:l,onOpen:s,onCopyPath:i,onDownloadManifest:o}){const{t:u}=be(),p=l.cards?.find(m=>m.headline)?.headline||l.headline||u("gallery.cardNewsSet");return f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"gallery__tile",onClick:()=>s(l),title:p,children:[l.image?f.jsx("img",{src:l.image,alt:p,loading:"lazy"}):null,f.jsxs("div",{className:"gallery__caption",children:[f.jsx("small",{children:u("gallery.cardNewsSet")}),f.jsx("span",{className:"gallery__caption-text",children:p})]}),f.jsx("div",{className:"gallery-card-news-strip",children:(l.cards||[]).slice(0,5).map((m,y)=>f.jsxs("span",{children:[m.url?f.jsx("img",{src:m.url,alt:m.headline??"",loading:"lazy"}):null,f.jsx("em",{children:m.cardOrder??y+1})]},`${m.url}-${y}`))})]}),f.jsxs("div",{className:"gallery-card-news-actions",children:[f.jsx("span",{children:u("gallery.cardNewsCount",{n:l.cards?.length??0})}),f.jsx("button",{type:"button",onClick:()=>s(l),children:u("gallery.openCardNewsSet")}),f.jsx("button",{type:"button",onClick:m=>i(l,m),children:u("gallery.copyCardNewsSetPath")}),f.jsx("button",{type:"button",onClick:m=>o(l,m),children:u("gallery.downloadCardNewsManifest")})]})]})}function Jx({item:l,active:s,itemRef:i,onSelect:o,onDelete:u,onToggleFavorite:d,t:p}){return f.jsxs("div",{ref:i,className:`gallery__tile-wrap${s?" gallery__tile-wrap--active":""}${l.isFavorite?" gallery__tile-wrap--favorite":""}`,children:[f.jsxs("button",{type:"button",className:`gallery__tile${s?" gallery__tile--active":""}`,onClick:()=>o(l),title:l.prompt??"",children:[f.jsx("img",{src:l.thumb||l.image,alt:l.prompt??p("gallery.imageAltFallback"),loading:"lazy",decoding:"async"}),l.prompt&&f.jsx("div",{className:"gallery__caption",children:f.jsx("span",{className:"gallery__caption-text",children:l.prompt})})]}),l.filename&&d&&f.jsx("button",{type:"button",className:`gallery__favorite${l.isFavorite?" gallery__favorite--on":""}`,onClick:m=>{m.stopPropagation(),d(l)},title:l.isFavorite?p("gallery.unfavoriteTitle"):p("gallery.favoriteTitle"),"aria-label":l.isFavorite?p("gallery.unfavoriteAria"):p("gallery.favoriteAria"),children:l.isFavorite?"★":"☆"}),l.filename&&f.jsx("button",{type:"button",className:"gallery__delete",onClick:m=>u(l,m),title:p("gallery.deleteTitle"),"aria-label":p("gallery.deleteAria"),children:"×"})]})}var $x=Ah();function hl(l,s,i){let o=i.initialDeps??[],u,d=!0;function p(){var m,y,g;let E;i.key&&((m=i.debug)!=null&&m.call(i))&&(E=Date.now());const b=l();if(!(b.length!==o.length||b.some((M,I)=>o[I]!==M)))return u;o=b;let x;if(i.key&&((y=i.debug)!=null&&y.call(i))&&(x=Date.now()),u=s(...b),i.key&&((g=i.debug)!=null&&g.call(i))){const M=Math.round((Date.now()-E)*100)/100,I=Math.round((Date.now()-x)*100)/100,B=I/16,V=(L,Y)=>{for(L=String(L);L.length<Y;)L=" "+L;return L};console.info(`%c⏱ ${V(I,5)} /${V(M,5)} ms`,`
26
+ font-size: .6rem;
27
+ font-weight: bold;
28
+ color: hsl(${Math.max(0,Math.min(120-120*B,120))}deg 100% 31%);`,i?.key)}return i?.onChange&&!(d&&i.skipInitialOnChange)&&i.onChange(u),d=!1,u}return p.updateDeps=m=>{o=m},p}function bh(l,s){if(l===void 0)throw new Error("Unexpected undefined");return l}const Wx=(l,s)=>Math.abs(l-s)<1.01,eE=(l,s,i)=>{let o;return function(...u){l.clearTimeout(o),o=l.setTimeout(()=>s.apply(this,u),i)}},Sh=l=>{const{offsetWidth:s,offsetHeight:i}=l;return{width:s,height:i}},tE=l=>l,aE=l=>{const s=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1),o=[];for(let u=s;u<=i;u++)o.push(u);return o},nE=(l,s)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=p=>{const{width:m,height:y}=p;s({width:Math.round(m),height:Math.round(y)})};if(u(Sh(i)),!o.ResizeObserver)return()=>{};const d=new o.ResizeObserver(p=>{const m=()=>{const y=p[0];if(y?.borderBoxSize){const g=y.borderBoxSize[0];if(g){u({width:g.inlineSize,height:g.blockSize});return}}u(Sh(i))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(m):m()});return d.observe(i,{box:"border-box"}),()=>{d.unobserve(i)}},xh={passive:!0},Eh=typeof window>"u"?!0:"onscrollend"in window,lE=(l,s)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;let u=0;const d=l.options.useScrollendEvent&&Eh?()=>{}:eE(o,()=>{s(u,!1)},l.options.isScrollingResetDelay),p=E=>()=>{const{horizontal:b,isRtl:S}=l.options;u=b?i.scrollLeft*(S&&-1||1):i.scrollTop,d(),s(u,E)},m=p(!0),y=p(!1);i.addEventListener("scroll",m,xh);const g=l.options.useScrollendEvent&&Eh;return g&&i.addEventListener("scrollend",y,xh),()=>{i.removeEventListener("scroll",m),g&&i.removeEventListener("scrollend",y)}},iE=(l,s,i)=>{if(s?.borderBoxSize){const o=s.borderBoxSize[0];if(o)return Math.round(o[i.options.horizontal?"inlineSize":"blockSize"])}return l[i.options.horizontal?"offsetWidth":"offsetHeight"]},oE=(l,{adjustments:s=0,behavior:i},o)=>{var u,d;const p=l+s;(d=(u=o.scrollElement)==null?void 0:u.scrollTo)==null||d.call(u,{[o.options.horizontal?"left":"top"]:p,behavior:i})};class sE{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var i,o,u;return((u=(o=(i=this.targetWindow)==null?void 0:i.performance)==null?void 0:o.now)==null?void 0:u.call(o))??Date.now()},this.observer=(()=>{let i=null;const o=()=>i||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:i=new this.targetWindow.ResizeObserver(u=>{u.forEach(d=>{const p=()=>{const m=d.target,y=this.indexFromElement(m);if(!m.isConnected){this.observer.unobserve(m);return}this.shouldMeasureDuringScroll(y)&&this.resizeItem(y,this.options.measureElement(m,d,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(p):p()})}));return{disconnect:()=>{var u;(u=o())==null||u.disconnect(),i=null},observe:u=>{var d;return(d=o())==null?void 0:d.observe(u,{box:"border-box"})},unobserve:u=>{var d;return(d=o())==null?void 0:d.unobserve(u)}}})(),this.range=null,this.setOptions=i=>{Object.entries(i).forEach(([o,u])=>{typeof u>"u"&&delete i[o]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:tE,rangeExtractor:aE,onChange:()=>{},measureElement:iE,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...i}},this.notify=i=>{var o,u;(u=(o=this.options).onChange)==null||u.call(o,this,i)},this.maybeNotify=hl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),i=>{this.notify(i)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(i=>i()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var i;const o=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==o){if(this.cleanup(),!o){this.maybeNotify();return}this.scrollElement=o,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((i=this.scrollElement)==null?void 0:i.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,d)=>{this.scrollAdjustments=0,this.scrollDirection=d?this.getScrollOffset()<u?"forward":"backward":null,this.scrollOffset=u,this.isScrolling=d,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(i,o)=>{const u=new Map,d=new Map;for(let p=o-1;p>=0;p--){const m=i[p];if(u.has(m.lane))continue;const y=d.get(m.lane);if(y==null||m.end>y.end?d.set(m.lane,m):m.end<y.end&&u.set(m.lane,!0),u.size===this.options.lanes)break}return d.size===this.options.lanes?Array.from(d.values()).sort((p,m)=>p.end===m.end?p.index-m.index:p.end-m.end)[0]:void 0},this.getMeasurementOptions=hl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(i,o,u,d,p,m,y)=>(this.prevLanes!==void 0&&this.prevLanes!==m&&(this.lanesChangedFlag=!0),this.prevLanes=m,this.pendingMeasuredCacheIndexes=[],{count:i,paddingStart:o,scrollMargin:u,getItemKey:d,enabled:p,lanes:m,laneAssignmentMode:y}),{key:!1}),this.getMeasurements=hl(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:i,paddingStart:o,scrollMargin:u,getItemKey:d,enabled:p,lanes:m,laneAssignmentMode:y},g)=>{if(!p)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>i)for(const x of this.laneAssignments.keys())x>=i&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const E=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===i&&(this.lanesSettling=!1);const b=this.measurementsCache.slice(0,E),S=new Array(m).fill(void 0);for(let x=0;x<E;x++){const M=b[x];M&&(S[M.lane]=x)}for(let x=E;x<i;x++){const M=d(x),I=this.laneAssignments.get(x);let B,V;const L=y==="estimate"||g.has(M);if(I!==void 0&&this.options.lanes>1){B=I;const P=S[B],$=P!==void 0?b[P]:void 0;V=$?$.end+this.options.gap:o+u}else{const P=this.options.lanes===1?b[x-1]:this.getFurthestMeasurement(b,x);V=P?P.end+this.options.gap:o+u,B=P?P.lane:x%this.options.lanes,this.options.lanes>1&&L&&this.laneAssignments.set(x,B)}const Y=g.get(M),j=typeof Y=="number"?Y:this.options.estimateSize(x),W=V+j;b[x]={index:x,start:V,size:j,end:W,key:M,lane:B},S[B]=x}return this.measurementsCache=b,b},{key:!1,debug:()=>this.options.debug}),this.calculateRange=hl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(i,o,u,d)=>this.range=i.length>0&&o>0?rE({measurements:i,outerSize:o,scrollOffset:u,lanes:d}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=hl(()=>{let i=null,o=null;const u=this.calculateRange();return u&&(i=u.startIndex,o=u.endIndex),this.maybeNotify.updateDeps([this.isScrolling,i,o]),[this.options.rangeExtractor,this.options.overscan,this.options.count,i,o]},(i,o,u,d,p)=>d===null||p===null?[]:i({startIndex:d,endIndex:p,overscan:o,count:u}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=i=>{const o=this.options.indexAttribute,u=i.getAttribute(o);return u?parseInt(u,10):(console.warn(`Missing attribute name '${o}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=i=>{var o;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const u=this.scrollState.index??((o=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:o.index);if(u!==void 0&&this.range){const d=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),p=Math.max(0,u-d),m=Math.min(this.options.count-1,u+d);return i>=p&&i<=m}return!0},this.measureElement=i=>{if(!i){this.elementsCache.forEach((p,m)=>{p.isConnected||(this.observer.unobserve(p),this.elementsCache.delete(m))});return}const o=this.indexFromElement(i),u=this.options.getItemKey(o),d=this.elementsCache.get(u);d!==i&&(d&&this.observer.unobserve(d),this.observer.observe(i),this.elementsCache.set(u,i)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(o)&&this.resizeItem(o,this.options.measureElement(i,void 0,this))},this.resizeItem=(i,o)=>{var u;const d=this.measurementsCache[i];if(!d)return;const p=this.itemSizeCache.get(d.key)??d.size,m=o-p;m!==0&&(((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(d,m,this):d.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=m,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(d.index),this.itemSizeCache=new Map(this.itemSizeCache.set(d.key,o)),this.notify(!1))},this.getVirtualItems=hl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(i,o)=>{const u=[];for(let d=0,p=i.length;d<p;d++){const m=i[d],y=o[m];u.push(y)}return u},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=i=>{const o=this.getMeasurements();if(o.length!==0)return bh(o[Ag(0,o.length-1,u=>bh(o[u]).start,i)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const i=this.scrollElement.document.documentElement;return this.options.horizontal?i.scrollWidth-this.scrollElement.innerWidth:i.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(i,o,u=0)=>{if(!this.scrollElement)return 0;const d=this.getSize(),p=this.getScrollOffset();o==="auto"&&(o=i>=p+d?"end":"start"),o==="center"?i+=(u-d)/2:o==="end"&&(i-=d);const m=this.getMaxScrollOffset();return Math.max(Math.min(m,i),0)},this.getOffsetForIndex=(i,o="auto")=>{i=Math.max(0,Math.min(i,this.options.count-1));const u=this.getSize(),d=this.getScrollOffset(),p=this.measurementsCache[i];if(!p)return;if(o==="auto")if(p.end>=d+u-this.options.scrollPaddingEnd)o="end";else if(p.start<=d+this.options.scrollPaddingStart)o="start";else return[d,o];if(o==="end"&&i===this.options.count-1)return[this.getMaxScrollOffset(),o];const m=o==="end"?p.end+this.options.scrollPaddingEnd:p.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(m,o,p.size),o]},this.scrollToOffset=(i,{align:o="start",behavior:u="auto"}={})=>{const d=this.getOffsetForAlignment(i,o),p=this.now();this.scrollState={index:null,align:o,behavior:u,startedAt:p,lastTargetOffset:d,stableFrames:0},this._scrollToOffset(d,{adjustments:void 0,behavior:u}),this.scheduleScrollReconcile()},this.scrollToIndex=(i,{align:o="auto",behavior:u="auto"}={})=>{i=Math.max(0,Math.min(i,this.options.count-1));const d=this.getOffsetForIndex(i,o);if(!d)return;const[p,m]=d,y=this.now();this.scrollState={index:i,align:m,behavior:u,startedAt:y,lastTargetOffset:p,stableFrames:0},this._scrollToOffset(p,{adjustments:void 0,behavior:u}),this.scheduleScrollReconcile()},this.scrollBy=(i,{behavior:o="auto"}={})=>{const u=this.getScrollOffset()+i,d=this.now();this.scrollState={index:null,align:"start",behavior:o,startedAt:d,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var i;const o=this.getMeasurements();let u;if(o.length===0)u=this.options.paddingStart;else if(this.options.lanes===1)u=((i=o[o.length-1])==null?void 0:i.end)??0;else{const d=Array(this.options.lanes).fill(null);let p=o.length-1;for(;p>=0&&d.some(m=>m===null);){const m=o[p];d[m.lane]===null&&(d[m.lane]=m.end),p--}u=Math.max(...d.filter(m=>m!==null))}return Math.max(u-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(i,{adjustments:o,behavior:u})=>{this.options.scrollToFn(i,{behavior:u,adjustments:o},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const o=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,u=o?o[0]:this.scrollState.lastTargetOffset,d=1,p=u!==this.scrollState.lastTargetOffset;if(!p&&Wx(u,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=d){this.scrollState=null;return}}else this.scrollState.stableFrames=0,p&&(this.scrollState.lastTargetOffset=u,this.scrollState.behavior="auto",this._scrollToOffset(u,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Ag=(l,s,i,o)=>{for(;l<=s;){const u=(l+s)/2|0,d=i(u);if(d<o)l=u+1;else if(d>o)s=u-1;else return u}return l>0?l-1:0};function rE({measurements:l,outerSize:s,scrollOffset:i,lanes:o}){const u=l.length-1,d=y=>l[y].start;if(l.length<=o)return{startIndex:0,endIndex:u};let p=Ag(0,u,d,i),m=p;if(o===1)for(;m<u&&l[m].end<i+s;)m++;else if(o>1){const y=Array(o).fill(0);for(;m<u&&y.some(E=>E<i+s);){const E=l[m];y[E.lane]=E.end,m++}const g=Array(o).fill(i+s);for(;p>=0&&g.some(E=>E>=i);){const E=l[p];g[E.lane]=E.start,p--}p=Math.max(0,p-p%o),m=Math.min(u,m+(o-1-m%o))}return{startIndex:p,endIndex:m}}const Th=typeof document<"u"?H.useLayoutEffect:H.useEffect;function cE({useFlushSync:l=!0,...s}){const i=H.useReducer(()=>({}),{})[1],o={...s,onChange:(d,p)=>{var m;l&&p?$x.flushSync(i):i(),(m=s.onChange)==null||m.call(s,d,p)}},[u]=H.useState(()=>new sE(o));return u.setOptions(o),Th(()=>u._didMount(),[]),Th(()=>u._willUpdate()),u}function uE(l){return cE({observeElementRect:nE,observeElementOffset:lE,scrollToFn:oE,...l})}const Ts=170,Ns=10,Mg=36,dE=44;function fE(l){const s=Math.max(Ts,l-Mg);return Math.max(1,Math.floor((s+Ns)/(Ts+Ns)))}function mE(l,s){const i=Math.max(Ts,l-Mg);return Math.max(Ts,Math.floor((i-Ns*Math.max(0,s-1))/s))+Ns}function pE(l,s){const i=[];for(const[o,u]of l){i.push({type:"header",id:`h-${o}`,label:o,count:u.length});for(let d=0;d<u.length;d+=s)i.push({type:"items",id:`r-${o}-${d}`,items:u.slice(d,d+s)})}return i}function hE({dateGroups:l,selectedKey:s,scrollElement:i,localizeBucket:o,renderTile:u}){const d=H.useRef(null),[p,m]=H.useState(0),y=H.useMemo(()=>fE(p||960),[p]),g=H.useMemo(()=>mE(p||960,y),[p,y]),E=H.useMemo(()=>pE(l,y),[l,y]);H.useEffect(()=>{const S=d.current;if(!S)return;const x=()=>m(S.clientWidth);x();const M=new ResizeObserver(x);return M.observe(S),()=>M.disconnect()},[]);const b=uE({count:E.length,getScrollElement:()=>i,estimateSize:S=>E[S]?.type==="header"?dE:g,overscan:6});return H.useEffect(()=>{if(!s)return;const S=E.findIndex(x=>x.type==="items"&&x.items.some(M=>kt(M)===s));S>=0&&b.scrollToIndex(S,{align:"center"})},[E,s,b]),f.jsx("div",{ref:d,className:"gallery__virtual",style:{height:b.getTotalSize()},children:b.getVirtualItems().map(S=>{const x=E[S.index];return x?f.jsx("div",{className:"gallery__virtual-row",style:{transform:`translateY(${S.start}px)`},children:x.type==="header"?f.jsxs("header",{className:"gallery__group-header gallery__group-header--virtual",children:[f.jsx("span",{className:"gallery__group-label",children:o(x.label)}),f.jsx("span",{className:"gallery__group-count",children:x.count})]}):f.jsx("div",{className:"gallery__grid gallery__grid--virtual",children:x.items.map((M,I)=>u(M,x.id,I))})},x.id):null})})}function Nh({showSessions:l,favoritesOnly:s,query:i,historyNextCursor:o,favoriteHistoryNextCursor:u,historyLoadingOlder:d,favoriteHistoryLoadingOlder:p,onLoadOlder:m,onLoadOlderFavorites:y,t:g}){return l?f.jsx("div",{className:"gallery__load-more gallery__load-more--hint",children:g("gallery.sessionPaginationHint")}):i.trim()?null:s?u?f.jsx("div",{className:"gallery__load-more",children:f.jsx("button",{type:"button",onClick:y,disabled:p,children:g(p?"gallery.loadingOlderFavorites":"gallery.loadOlderFavorites")})}):null:o?f.jsx("div",{className:"gallery__load-more",children:f.jsx("button",{type:"button",onClick:m,disabled:d,children:g(d?"gallery.loadingOlder":"gallery.loadOlder")})}):null}function gE({groups:l,loose:s,favoritesOnly:i,galleryScope:o,setGalleryScope:u,renderTile:d,t:p}){return l.length===0&&s.length===0?f.jsx("div",{className:"gallery__empty",children:i?p("gallery.emptyFavorites"):o==="current-session"?f.jsxs(f.Fragment,{children:[f.jsx("p",{children:p("gallery.empty.currentSession")}),f.jsx("button",{type:"button",onClick:()=>u("all"),children:p("gallery.scope.all")})]}):p("gallery.emptySessions")}):f.jsxs(f.Fragment,{children:[l.map(m=>f.jsxs("section",{className:"gallery__group",children:[f.jsxs("header",{className:"gallery__group-header",children:[f.jsx("span",{className:"gallery__group-label",title:m.sessionId,children:m.title?m.displayLabel:p("gallery.sessionLabel",{name:m.displayLabel})}),f.jsx("span",{className:"gallery__group-count",children:m.items.length})]}),f.jsx("div",{className:"gallery__grid",children:m.items.map((y,g)=>d(y,m.sessionId,g))})]},m.sessionId)),s.length>0&&f.jsxs("section",{className:"gallery__group",children:[f.jsxs("header",{className:"gallery__group-header",children:[f.jsx("span",{className:"gallery__group-label",children:p("gallery.standalone")}),f.jsx("span",{className:"gallery__group-count",children:s.length})]}),f.jsx("div",{className:"gallery__grid",children:s.map((m,y)=>d(m,"loose",y))})]})]})}function yE({status:l,dismissed:s,onOpenFolder:i,onDismiss:o,t:u}){const d=l!=null&&l.state!=="ok"&&!s,p=l?.state==="recoverable"?"gallery.storageNoticeRecoverable":l?.state==="not_found"?"gallery.storageNoticeNotFound":"gallery.storageNoticeUnknown";return f.jsxs("div",{className:`gallery__storage-bar${d?" gallery__storage-bar--notice":""}`,children:[d?f.jsxs("div",{className:"gallery__storage-copy",children:[f.jsx("div",{className:"gallery__storage-title",children:u("gallery.storageNoticeTitle")}),f.jsx("div",{className:"gallery__storage-text",children:u(p)})]}):f.jsx("div",{className:"gallery__storage-copy gallery__storage-copy--quiet",children:l?.generatedDirLabel??"~/.ima2/generated"}),f.jsxs("div",{className:"gallery__storage-actions",children:[f.jsx("button",{type:"button",className:"gallery__storage-button",onClick:i,title:u("gallery.openGeneratedDirTitle"),children:u("gallery.openGeneratedDir")}),d&&f.jsx("button",{type:"button",className:"gallery__storage-button gallery__storage-button--ghost",onClick:o,children:u("common.close")})]})]})}const _h="ima2.storageNoticeDismissed.0.09.23";function vE(){const{t:l}=be(),s=_(K=>K.galleryOpen),i=_(K=>K.closeGallery),o=_(K=>K.history),u=_(K=>K.selectHistory),d=_(K=>K.currentImage),p=_(K=>K.trashHistoryItem),m=_(K=>K.showToast),y=_(K=>K.toggleGalleryFavorite),g=_(K=>K.galleryScope),E=_(K=>K.setGalleryScope),b=_(K=>K.historyNextCursor),S=_(K=>K.historyLoadingOlder),x=_(K=>K.favoriteHistoryNextCursor),M=_(K=>K.favoriteHistoryLoadingOlder),I=_(K=>K.loadOlderHistory),B=_(K=>K.loadFavoriteHistory),V=_(K=>K.loadOlderFavoriteHistory),L=_(G1),[Y,j]=H.useState(""),[W,P]=H.useState("date"),[$,Ce]=H.useState(!1),[ae,we]=H.useState([]),[Ge,Ie]=H.useState([]),[ct,Ye]=H.useState(null),[Q,A]=H.useState(()=>{try{return localStorage.getItem(_h)==="1"}catch{return!1}}),X=H.useRef(null),ne=H.useRef({}),[xe,Ee]=H.useState(null),w=H.useRef(0),N=H.useRef({open:!1,selectedKey:null}),F=H.useMemo(()=>hs(o.filter(_i)),[o]),Z=H.useCallback(K=>{X.current=K,Ee(K)},[]);H.useEffect(()=>{if(!s)return;const K=Se=>{Se.key==="Escape"&&i()};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[s,i]),H.useEffect(()=>{s||j("")},[s]),H.useEffect(()=>{if(!s)return;let K=!1;return(async()=>{try{const Se=await Tb();K||Ye(Se)}catch{K||Ye({generatedDirLabel:"~/.ima2/generated",generatedCount:0,legacyCandidatesScanned:0,legacySourcesFound:0,legacyFilesFound:0,state:"unknown",messageKind:"unknown",recoveryDocsPath:"docs/RECOVER_OLD_IMAGES.md",doctorCommand:"ima2 doctor",overrides:{generatedDir:!1,configDir:!1}})}})(),()=>{K=!0}},[s]),H.useEffect(()=>{if(!s||W!=="session")return;let K=!1;return(async()=>{try{const Se=await xb({limit:500,sessionId:g==="current-session"?L:void 0});if(K)return;const ut=fe=>{const He=fe.kind,wn=He==="classic"||He==="edit"||He==="generate"||He==="card-news-card"||He==="card-news-set"?He:null;return{image:fe.url,url:fe.url,filename:fe.filename,prompt:fe.prompt??void 0,size:fe.size??void 0,quality:fe.quality??void 0,model:fe.model??void 0,provider:fe.provider,createdAt:fe.createdAt,sessionId:fe.sessionId??null,nodeId:fe.nodeId??null,clientNodeId:fe.clientNodeId??null,kind:wn,setId:fe.setId??null,cardId:fe.cardId??null,cardOrder:fe.cardOrder??null,headline:fe.headline??null,body:fe.body??null,cards:fe.cards,isFavorite:fe.isFavorite??!1}};we(Se.sessions.map(fe=>({sessionId:fe.sessionId,title:fe.title??null,label:fe.label??null,displayLabel:fe.title||fe.label||fe.sessionId.slice(0,8),items:hs(fe.items.filter(_i).map(ut))})).filter(fe=>fe.items.length>0)),Ie(hs(Se.loose.filter(_i).map(ut)))}catch{}})(),()=>{K=!0}},[s,W,g,L]),H.useEffect(()=>{!s||W==="session"||!$||B()},[s,W,$,B]);const ie=H.useMemo(()=>{const K=Y.trim().toLowerCase().normalize("NFC");return F.filter(Se=>$&&!Se.isFavorite?!1:K?(Se.prompt??"").toLowerCase().normalize("NFC").includes(K)||(Se.filename??"").toLowerCase().normalize("NFC").includes(K):!0)},[F,Y,$]),se=H.useMemo(()=>$?ae.map(K=>({...K,items:K.items.filter(Se=>Se.isFavorite)})).filter(K=>K.items.length>0):ae,[ae,$]),he=H.useMemo(()=>$?Ge.filter(K=>K.isFavorite):Ge,[Ge,$]),Je=H.useMemo(()=>{const K=new Map;for(const Se of ie){const ut=Qx(Se.createdAt);K.has(ut)||K.set(ut,[]),K.get(ut).push(Se)}return Array.from(K.entries())},[ie]),qe=W==="session"?se.reduce((K,Se)=>K+Se.items.length,0)+he.length:ie.length;H.useLayoutEffect(()=>{const K=d?kt(d):null;if(!s){N.current={open:!1,selectedKey:K};return}const Se=N.current,ut=!Se.open||Se.selectedKey!==K;N.current={open:!0,selectedKey:K};const fe=K?ne.current[K]:null;if(ut&&fe){fe.scrollIntoView({block:"center"});return}X.current&&(X.current.scrollTop=w.current)},[s,d?.filename,d?.image,W,qe,Je.length,se.length,he.length]);async function $a(K,Se){Se.stopPropagation();const ut=kt(K);await p(K),delete ne.current[ut],window.requestAnimationFrame(()=>X.current?.focus())}async function Cn(){try{await Nb(),m(l("toast.openGeneratedDirOpened"))}catch{m(l("toast.openGeneratedDirFailed"),!0)}}async function Sl(K){if(K.setId)try{await et.getState().loadSet(K.setId),_.getState().setUIMode("card-news"),i()}catch{m(l("gallery.openCardNewsSetFailed"),!0)}}async function zi(K,Se){if(Se.stopPropagation(),!K.setId)return;const ut=`generated/cardnews/${K.setId}`;try{await navigator.clipboard?.writeText(ut),m(l("gallery.cardNewsPathCopied"))}catch{m(l("toast.copyFailed"),!0)}}function na(K,Se){Se.stopPropagation(),K.setId&&window.open(ex(K.setId),"_blank","noopener,noreferrer")}function xl(){A(!0);try{localStorage.setItem(_h,"1")}catch{}}if(!s)return null;const El=K=>K==="earlier"||K==="today"||K==="yesterday"||K==="thisWeek"?l(`gallery.${K}`):K,Ii=(K,Se,ut)=>{const fe=d?.image===K.image,He=kt(K),wn=Vt=>{ne.current[He]=Vt};return K.kind==="card-news-set"?f.jsx("div",{ref:wn,className:"gallery__tile-wrap gallery-card-news-set",children:f.jsx(Zx,{item:K,onOpen:Vt=>{Sl(Vt)},onCopyPath:zi,onDownloadManifest:na})},`${Se}-${He}`):f.jsx(Jx,{item:K,active:fe,itemRef:wn,onSelect:Vt=>{u(Vt),i()},onDelete:$a,onToggleFavorite:Vt=>{y(Vt.filename)},t:l},`${Se}-${He}`)},Ta=W==="session",Tl=d?kt(d):null;return f.jsx("div",{className:"gallery-backdrop",onClick:i,role:"presentation",children:f.jsxs("div",{className:"gallery",role:"dialog","aria-modal":"true","aria-label":l("gallery.ariaLabel"),onClick:K=>K.stopPropagation(),children:[f.jsxs("div",{className:"gallery__header",children:[f.jsxs("div",{className:"gallery__title-row",children:[f.jsx("div",{className:"gallery__title",children:l("gallery.title")}),f.jsxs("div",{className:"gallery__meta",children:[l("gallery.total",{n:qe}),Y||$?l("gallery.totalFiltered",{n:F.length}):""]}),f.jsxs("div",{className:"gallery__favorite-filter",role:"tablist","aria-label":l("gallery.favoriteFilterAria"),children:[f.jsx("button",{type:"button",role:"tab","aria-selected":!$,className:$?"":"active",onClick:()=>Ce(!1),children:l("gallery.filterAll")}),f.jsx("button",{type:"button",role:"tab","aria-selected":$,className:$?"active":"",onClick:()=>Ce(!0),children:l("gallery.filterFavorites")})]}),f.jsxs("div",{className:"gallery__group-toggle",role:"tablist","aria-label":l("gallery.sortByAria"),children:[f.jsx("button",{type:"button",role:"tab","aria-selected":W==="date",className:W==="date"?"active":"",onClick:()=>P("date"),children:l("gallery.sortByDate")}),f.jsx("button",{type:"button",role:"tab","aria-selected":W==="session",className:W==="session"?"active":"",onClick:()=>P("session"),children:l("gallery.sortBySession")})]}),f.jsxs("div",{className:"gallery__scope",role:"tablist","aria-label":l("gallery.scopeAria"),children:[f.jsx("button",{type:"button",role:"tab","aria-selected":g==="current-session",className:g==="current-session"?"active":"",onClick:()=>E("current-session"),disabled:!L,children:l("gallery.scope.current")}),f.jsx("button",{type:"button",role:"tab","aria-selected":g==="all",className:g==="all"?"active":"",onClick:()=>E("all"),children:l("gallery.scope.all")})]})]}),f.jsx("input",{type:"text",className:"gallery__search",placeholder:l(Ta?"gallery.searchDisabledPlaceholder":"gallery.searchPlaceholder"),value:Y,onChange:K=>j(K.target.value),autoFocus:!0,disabled:Ta}),f.jsx("button",{type:"button",className:"gallery__close",onClick:i,"aria-label":l("gallery.closeAria"),title:l("gallery.closeTitle"),children:"×"})]}),f.jsx(yE,{status:ct,dismissed:Q,onOpenFolder:Cn,onDismiss:xl,t:l}),f.jsx("div",{className:"gallery__scroll",ref:Z,tabIndex:-1,onScroll:()=>{w.current=X.current?.scrollTop??0},children:Ta?f.jsxs(f.Fragment,{children:[f.jsx(gE,{groups:se,loose:he,favoritesOnly:$,galleryScope:g,setGalleryScope:E,renderTile:Ii,t:l}),f.jsx(Nh,{showSessions:Ta,favoritesOnly:$,query:Y,historyNextCursor:b,favoriteHistoryNextCursor:x,historyLoadingOlder:S,favoriteHistoryLoadingOlder:M,onLoadOlder:()=>{I()},onLoadOlderFavorites:()=>{V()},t:l})]}):ie.length===0?f.jsx("div",{className:"gallery__empty",children:F.length===0?l("gallery.emptyAll"):l($?"gallery.emptyFavorites":"gallery.noResults")}):f.jsxs(f.Fragment,{children:[f.jsx(hE,{dateGroups:Je,selectedKey:Tl,scrollElement:xe,localizeBucket:El,renderTile:Ii}),f.jsx(Nh,{showSessions:Ta,favoritesOnly:$,query:Y,historyNextCursor:b,favoriteHistoryNextCursor:x,historyLoadingOlder:S,favoriteHistoryLoadingOlder:M,onLoadOlder:()=>{I()},onLoadOlderFavorites:()=>{V()},t:l})]})})]})})}function bE(l){return l.includes("ratio")?"sizeConfirm.reasonRatio":l.includes("maxPixels")||l.includes("pixels")?"sizeConfirm.reasonPixels":l.includes("minPixels")?"sizeConfirm.reasonMinPixels":l.includes("min")?"sizeConfirm.reasonMin":l.includes("maxEdge")||l.includes("max")?"sizeConfirm.reasonMax":"sizeConfirm.reasonSnap"}function SE(){const l=_(m=>m.customSizeConfirm),s=_(m=>m.confirmCustomSizeAdjustment),i=_(m=>m.cancelCustomSizeAdjustment),o=H.useRef(null),{t:u}=be();if(H.useEffect(()=>{if(!l)return;o.current?.focus();const m=y=>{y.key==="Escape"&&i()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[i,l]),!l)return null;const d=`${l.requestedW}x${l.requestedH}`,p=`${l.adjustedW}x${l.adjustedH}`;return f.jsx("div",{className:"modal-backdrop custom-size-confirm-backdrop",role:"presentation",children:f.jsxs("div",{className:"modal custom-size-confirm",role:"dialog","aria-modal":"true","aria-labelledby":"custom-size-confirm-title","aria-describedby":"custom-size-confirm-body",children:[f.jsx("div",{id:"custom-size-confirm-title",className:"modal__title",children:u("sizeConfirm.title")}),f.jsxs("div",{id:"custom-size-confirm-body",className:"modal__body",children:[f.jsx("p",{children:u("sizeConfirm.body")}),f.jsxs("dl",{className:"size-confirm__pairs",children:[f.jsxs("div",{className:"size-confirm__pair",children:[f.jsx("dt",{children:u("sizeConfirm.requested")}),f.jsx("dd",{children:d})]}),f.jsxs("div",{className:"size-confirm__pair",children:[f.jsx("dt",{children:u("sizeConfirm.adjusted")}),f.jsx("dd",{children:p})]})]}),f.jsx("p",{className:"size-confirm__reason",children:u(bE(l.reasons))})]}),f.jsxs("div",{className:"modal__actions",children:[f.jsx("button",{ref:o,type:"button",className:"modal__btn modal__btn--secondary",onClick:i,children:u("sizeConfirm.cancel")}),f.jsx("button",{type:"button",className:"modal__btn",onClick:()=>{s()},children:u("sizeConfirm.approve")})]})]})})}function us(l){return l==null||l===""?"-":String(l)}function xE(){const{t:l}=be(),s=_(m=>m.metadataRestore),i=_(m=>m.applyMetadataRestore),o=_(m=>m.addMetadataRestoreAsReference),u=_(m=>m.cancelMetadataRestore);if(!s)return null;const d=s.metadata,p=d.userPrompt||d.prompt||d.revisedPrompt||"";return f.jsx("div",{className:"modal-backdrop metadata-restore-backdrop",role:"presentation",children:f.jsxs("div",{className:"modal metadata-restore",role:"dialog","aria-modal":"true","aria-labelledby":"metadata-restore-title",children:[f.jsx("div",{id:"metadata-restore-title",className:"modal__title",children:l("metadata.restoreTitle")}),f.jsxs("div",{className:"modal__body metadata-restore__body",children:[f.jsx("p",{children:l("metadata.restoreBody")}),f.jsxs("div",{className:"metadata-restore__preview",children:[f.jsx("img",{src:s.image,alt:l("metadata.imageAlt")}),f.jsxs("div",{className:"metadata-restore__details",children:[f.jsxs("div",{children:[f.jsx("span",{children:l("metadata.prompt")}),f.jsx("strong",{title:p,children:us(p)})]}),f.jsxs("div",{children:[f.jsx("span",{children:l("metadata.size")}),f.jsx("strong",{children:us(d.size)})]}),f.jsxs("div",{children:[f.jsx("span",{children:l("metadata.quality")}),f.jsx("strong",{children:us(d.quality)})]}),f.jsxs("div",{children:[f.jsx("span",{children:l("metadata.model")}),f.jsx("strong",{children:us(d.model)})]}),f.jsxs("div",{children:[f.jsx("span",{children:l("metadata.source")}),f.jsx("strong",{children:s.source==="png-comment"?l("metadata.sourcePngComment"):l("metadata.sourceXmp")})]})]})]})]}),f.jsxs("div",{className:"modal__actions",children:[f.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:u,children:l("common.cancel")}),f.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:o,children:l("metadata.useAsReferenceOnly")}),f.jsx("button",{type:"button",className:"modal__btn",onClick:i,children:l("metadata.applySettings")})]})]})})}function EE(){const[l,s]=H.useState(null);return H.useEffect(()=>{let i=!1,o=null;const u=async()=>{try{const d=await gb();if(i)return;s(d),d.status==="starting"&&(o=setTimeout(u,3e3))}catch{i||s(null)}};return u(),()=>{i=!0,o&&clearTimeout(o)}},[]),l}function TE(){const[l,s]=H.useState(null),[i,o]=H.useState(!1);return H.useEffect(()=>{let u=!1;return yb().then(d=>{u||s(d)}).catch(()=>{u||o(!0)}),()=>{u=!0}},[]),{data:l,error:i}}function NE(){const{t:l}=be(),s=EE(),{data:i}=TE(),o=s?.status==="ready";let u=l("provider.oauthNotReady"),d;s?.status==="auth_required"?(u=l("provider.codexLoginRequired"),d=l("provider.codexLoginHint")):s?.status==="starting"?u=l("provider.oauthStarting"):s||(u=l("provider.serverUnreachable"));const p=i?.apiKeyValid===!0;return{oauth:{ok:o,reason:u,hint:d},api:{ok:p,reason:p?"":l("provider.apiInvalid")}}}function _E(){const{t:l}=be(),s=_(S=>S.readinessPopupOpen),i=_(S=>S.closeReadinessPopup),o=_(S=>S.openSettings),u=_(S=>S.provider),d=_(S=>S.imageModel),p=_(S=>S.reasoningEffort),m=_(S=>S.webSearchEnabled),y=NE();if(!s)return null;const g=y[u],E=g.ok,b=()=>{i(),o("account")};return f.jsx("div",{className:"modal-backdrop provider-readiness-backdrop",onClick:i,role:"presentation",children:f.jsxs("div",{className:"modal provider-readiness",role:"dialog","aria-modal":"true","aria-labelledby":"provider-readiness-title",onClick:S=>S.stopPropagation(),children:[f.jsx("div",{id:"provider-readiness-title",className:"modal__title",children:l("readiness.title")}),f.jsxs("div",{className:"modal__body provider-readiness__body",children:[f.jsxs("div",{className:`provider-readiness__status${E?" is-ok":" is-blocked"}`,children:[f.jsx("span",{"aria-hidden":"true"}),f.jsx("strong",{children:l(E?"readiness.ready":"readiness.blocked")}),f.jsx("small",{children:E?l("readiness.readyBody"):g.reason})]}),g.hint?f.jsx("p",{className:"modal__hint",children:g.hint}):null,f.jsxs("dl",{className:"provider-readiness__facts",children:[f.jsxs("div",{children:[f.jsx("dt",{children:l("readiness.provider")}),f.jsx("dd",{children:u==="oauth"?"OAuth":l("provider.apiLabel")})]}),f.jsxs("div",{children:[f.jsx("dt",{children:l("readiness.model")}),f.jsx("dd",{children:d})]}),f.jsxs("div",{children:[f.jsx("dt",{children:l("readiness.reasoning")}),f.jsx("dd",{children:p})]}),f.jsxs("div",{children:[f.jsx("dt",{children:l("readiness.webSearch")}),f.jsx("dd",{children:l(m?"settings.webSearch.on":"settings.webSearch.off")})]})]})]}),f.jsxs("div",{className:"modal__actions",children:[f.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:i,children:l("common.close")}),f.jsx("button",{type:"button",className:"modal__btn",onClick:b,children:l("readiness.openAccount")})]})]})})}function CE(){const l=_(p=>p.trashPending),s=_(p=>p.restorePendingTrash),i=_(p=>p.clearPendingTrash),{t:o}=be(),[u,d]=H.useState(Date.now());return H.useEffect(()=>{if(!l)return;d(Date.now());const p=window.setInterval(()=>{const m=Date.now();d(m),m>=l.expiresAt&&i()},500);return()=>window.clearInterval(p)},[i,l]),l?f.jsxs("div",{className:"trash-undo-toast",children:[f.jsx("span",{children:o("gallery.deleted",{filename:l.filename})}),f.jsx("button",{type:"button",onClick:()=>{s()},children:o("gallery.undo")}),f.jsx("span",{className:"trash-undo-toast__timer",children:o("gallery.secondsSuffix",{n:Math.max(0,Math.ceil((l.expiresAt-u)/1e3))})})]}):null}function wE(){return f.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[f.jsx("line",{x1:"4",y1:"6",x2:"14",y2:"6"}),f.jsx("circle",{cx:"17",cy:"6",r:"2.2"}),f.jsx("line",{x1:"4",y1:"12",x2:"8",y2:"12"}),f.jsx("circle",{cx:"11",cy:"12",r:"2.2"}),f.jsx("line",{x1:"14",y1:"12",x2:"20",y2:"12"}),f.jsx("line",{x1:"4",y1:"18",x2:"14",y2:"18"}),f.jsx("circle",{cx:"17",cy:"18",r:"2.2"})]})}function AE(){const l=_(g=>g.composeSheetOpen),s=_(g=>g.composeSheetTab),i=_(g=>g.openComposeSheet),o=_(g=>g.settingsOpen),u=_(g=>g.uiMode),{t:d}=be();if(!ji()||o||u==="card-news"||u==="agent")return null;const m=l&&s==="controls",y=d("sheet.controlsOpen");return f.jsx("button",{type:"button",className:"mobile-settings-toggle","aria-expanded":m,"aria-controls":"mobile-generate-sheet","aria-label":y,title:y,onClick:()=>i("controls"),children:f.jsx(wE,{})})}function ME(){const{t:l}=be(),s=_(p=>p.openComposeSheet),i=_(p=>p.settingsOpen),o=_(p=>p.uiMode),u=o==="agent"&&Ri?"agent":o==="node"&&Mi?"node":"classic";return!ji()||i||u!=="classic"?null:f.jsxs("header",{className:"mobile-app-bar",role:"banner",children:[f.jsxs("div",{className:"mobile-app-bar__brand",children:[f.jsx("div",{className:"logo-mark","aria-hidden":"true"}),f.jsxs("div",{className:"mobile-app-bar__brand-copy",children:[f.jsx("span",{className:"mobile-app-bar__title",children:"ima2-gen"}),f.jsx("span",{className:"mobile-app-bar__mode",children:l("appBar.modeImage")})]})]}),f.jsxs("div",{className:"mobile-app-bar__actions",children:[f.jsx(Eg,{variant:"sidebar"}),f.jsx("button",{type:"button",className:"mobile-app-bar__icon-button",onClick:()=>s("library"),"aria-label":l("promptLibrary.title"),title:l("promptLibrary.title"),children:f.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:f.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})}),f.jsx("button",{type:"button",className:"mobile-app-bar__icon-button",onClick:()=>s("controls"),"aria-label":l("appBar.controls"),title:l("appBar.controls"),children:f.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),f.jsxs("button",{type:"button",className:"mobile-app-bar__generate",onClick:()=>s("prompt"),"aria-label":l("appBar.generateAria"),children:[f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[f.jsx("path",{d:"M12 3l1.8 5.4L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.6L12 3z"}),f.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z"})]}),f.jsx("span",{children:l("appBar.generate")})]})]})]})}const RE=H.lazy(()=>Ea(()=>import("./PromptLibraryPanel-NhMKVGfU.js"),[]).then(l=>({default:l.PromptLibraryPanel}))),OE=["prompt","controls","library"];function jE(){const{t:l}=be(),s=_(g=>g.composeSheetOpen),i=_(g=>g.composeSheetTab),o=_(g=>g.setComposeSheetTab),u=_(g=>g.closeComposeSheet),d=_(g=>g.settingsOpen),p=_(g=>g.uiMode),m=p==="agent"&&Ri?"agent":p==="node"&&Mi?"node":"classic",y=ji();return H.useEffect(()=>{if(!s)return;const g=E=>{E.key==="Escape"&&u()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[s,u]),!y||d||m!=="classic"?null:f.jsxs(f.Fragment,{children:[s?f.jsx("div",{className:"compose-sheet-backdrop",role:"button","aria-label":l("sheet.close"),onClick:u}):null,f.jsxs("section",{id:"mobile-generate-sheet",className:`compose-sheet${s?" compose-sheet--open":""}`,role:"dialog","aria-modal":s?"true":"false","aria-label":l("sheet.generate"),"aria-hidden":!s,children:[f.jsx("button",{type:"button",className:"compose-sheet__handle",onClick:u,"aria-label":l("sheet.close")}),f.jsx("div",{className:"mobile-sheet-tabs",role:"tablist","aria-label":l("sheet.generate"),children:OE.map(g=>f.jsx("button",{type:"button",role:"tab","aria-selected":i===g,className:`mobile-sheet-tabs__button${i===g?" active":""}`,onClick:()=>o(g),children:l(`sheet.tabs.${g}`)},g))}),f.jsx("div",{className:"compose-sheet__body",children:i==="prompt"?f.jsxs("div",{className:"compose-sheet__panel compose-sheet__panel--prompt",role:"tabpanel",children:[f.jsx(hu,{}),f.jsx(gu,{}),f.jsx(bs,{})]}):i==="controls"?f.jsx("div",{className:"compose-sheet__panel compose-sheet__panel--controls",role:"tabpanel",children:f.jsx(wg,{})}):f.jsx("div",{className:"compose-sheet__panel compose-sheet__panel--library",role:"tabpanel",children:f.jsx(H.Suspense,{fallback:f.jsx("div",{className:"prompt-library-panel__loading",children:l("common.loading")}),children:f.jsx(RE,{variant:"embedded",forceOpen:!0,onRequestClose:()=>o("prompt")})})})})]})]})}const zE={ArrowLeft:"previous",ArrowRight:"next",Home:"first",End:"last",PageUp:"pagePrevious",PageDown:"pageNext"};function IE(){const l=_(o=>o.uiMode),s=_(o=>!!o.currentImage||!!o.multimodePreviewFlightId),i=_(o=>o.selectHistoryShortcutTarget);H.useEffect(()=>{if(l!=="classic")return;const o=u=>{const d=zE[u.key];d&&(u.defaultPrevented||Ss(u.target)||s&&(u.preventDefault(),i(d)))};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[s,i,l])}const ds=64,Rg="Image Gen";let yu=Rg,cu=!1,Ja=null,vu="",uu=!1;function Og(){return navigator}function jg(){if(typeof document>"u")return null;if(Ja)return Ja;const l=document.querySelector('link[rel~="icon"]');if(l)return Ja=l,vu=l.href||l.getAttribute("href")||"",l;const s=document.createElement("link");return s.rel="icon",document.head.appendChild(s),Ja=s,uu=!0,s}function DE(l){const s=document.createElement("canvas");s.width=ds,s.height=ds;const i=s.getContext("2d");return i?(i.clearRect(0,0,ds,ds),i.fillStyle="#0a0a0a",LE(i,6,6,52,52,12),i.fill(),i.strokeStyle="#ffffff",i.lineWidth=5,i.beginPath(),i.arc(30,32,14,0,Math.PI*2),i.stroke(),i.fillStyle="#ffffff",i.beginPath(),i.arc(30,32,5,0,Math.PI*2),i.fill(),i.beginPath(),i.arc(48,16,l>1?13:10,0,Math.PI*2),i.fillStyle="#ff335f",i.fill(),i.lineWidth=4,i.strokeStyle="#ffffff",i.stroke(),l>1&&(i.fillStyle="#ffffff",i.font="bold 15px sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText(String(Math.min(l,9)),48,17)),s.toDataURL("image/png")):vu}function LE(l,s,i,o,u,d){l.beginPath(),l.moveTo(s+d,i),l.arcTo(s+o,i,s+o,i+u,d),l.arcTo(s+o,i+u,s,i+u,d),l.arcTo(s,i+u,s,i,d),l.arcTo(s,i,s+o,i,d),l.closePath()}async function qE(l){const s=Og();if(typeof s.setAppBadge=="function")try{await s.setAppBadge(l)}catch{}}async function HE(){const l=Og();if(typeof l.clearAppBadge=="function")try{await l.clearAppBadge()}catch{}}function kE(l){document.title=`(${l}) ${yu}`;const s=jg();s&&(s.href=DE(l)),qE(l)}function Ch(){document.title=yu,Ja&&(uu?(Ja.remove(),Ja=null,uu=!1):Ja.href=vu),HE()}function wh(){cu||typeof document>"u"||(cu=!0,yu=document.title||Rg,jg())}function GE(l){H.useEffect(()=>(wh(),()=>{cu&&Ch()}),[]),H.useEffect(()=>{wh(),l>0?kE(l):Ch()},[l])}function UE(){H.useEffect(()=>{if(typeof window>"u")return;const l=window.visualViewport;if(!l)return;const s=()=>{const i=Math.round(l.height),o=Math.round(l.offsetTop);document.documentElement.style.setProperty("--vv-h",`${i}px`),document.documentElement.style.setProperty("--vv-offset-top",`${o}px`)};return s(),l.addEventListener("resize",s),l.addEventListener("scroll",s),()=>{l.removeEventListener("resize",s),l.removeEventListener("scroll",s)}},[])}const BE=H.lazy(()=>Ea(()=>import("./NodeCanvas-iM6yjHvO.js"),__vite__mapDeps([0,1])).then(l=>({default:l.NodeCanvas}))),PE=H.lazy(()=>Ea(()=>import("./SettingsWorkspace-FjKjaDqj.js"),[]).then(l=>({default:l.SettingsWorkspace}))),FE=H.lazy(()=>Ea(()=>import("./CardNewsWorkspace-EFVeg4l_.js"),[]).then(l=>({default:l.CardNewsWorkspace}))),YE=H.lazy(()=>Ea(()=>import("./AgentWorkspace-B6YNOZHi.js"),[]).then(l=>({default:l.AgentWorkspace}))),KE=H.lazy(()=>Ea(()=>import("./PromptLibraryPanel-NhMKVGfU.js"),[]).then(l=>({default:l.PromptLibraryPanel})));function VE(){return f.jsx("main",{className:"canvas canvas--lazy-loading","aria-busy":"true"})}function XE(){IE(),UE();const l=_(P=>P.hydrateHistory),s=_(P=>P.loadSessions),i=_(P=>P.startInFlightPolling),o=_(P=>P.reconcileInflight),u=_(P=>P.syncFromStorage),d=_(P=>P.theme),p=_(P=>P.resolvedTheme),m=_(P=>P.themeFamily),y=_(P=>P.settingsOpen),g=_(P=>P.unseenGeneratedCount),E=_(P=>P.historyStripLayout),b=_(P=>P.workspaceProfile),S=_(P=>P.syncThemeFromStorage),x=_(P=>P.syncThemeFamilyFromStorage),M=_(P=>P.refreshResolvedTheme),I=_(P=>P.uiMode),B=I==="agent"&&Ri?"agent":I==="node"&&Mi?"node":"classic",V=B==="agent",L=ji(),Y=Ai(b),j=!L&&B==="classic"&&Y.composerPlacement==="bottom"&&Y.multimodeHistoryGrouping==="sequence",W=!j&&!V;return GE(g),H.useEffect(()=>{l(),s(),o(),i()},[l,s,o,i]),H.useEffect(()=>{const P=$=>{$.key&&($.key==="ima2.inFlight"||$.key==="ima2.selectedFilename"?u():$.key==="ima2:theme"?S():$.key==="ima2:themeFamily"&&x())};return window.addEventListener("storage",P),()=>window.removeEventListener("storage",P)},[u,S,x]),H.useEffect(()=>{const P=document.documentElement;P.dataset.theme=p,P.dataset.themeMode=p,P.dataset.themeFamily=m,P.style.colorScheme=p},[p,m]),H.useEffect(()=>{if(d!=="system")return;const P=window.matchMedia("(prefers-color-scheme: light)");return P.addEventListener("change",M),()=>P.removeEventListener("change",M)},[M,d]),H.useEffect(()=>{const P=()=>{k1(_.getState)};return window.addEventListener("beforeunload",P),()=>{window.removeEventListener("beforeunload",P)}},[]),f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:`app${b==="prompt-studio"?" app--prompt-studio":""}${y?" app--settings-open":""}${W&&E==="horizontal"?" app--history-horizontal":""}${W&&E==="sidebar"?" app--history-sidebar":""}`,"data-theme-mode":p,"data-theme-family":m,"data-history-strip-layout":E,"data-mobile":L?"1":void 0,"data-ui-mode":B,children:[f.jsx(dx,{}),f.jsx(ME,{}),W?f.jsx(Kx,{}):null,f.jsx(H.Suspense,{fallback:f.jsx(VE,{}),children:y?f.jsx(PE,{}):B==="classic"?j?f.jsx(Ox,{}):f.jsx(ru,{}):B==="node"?f.jsx(BE,{}):B==="card-news"?f.jsx(FE,{}):B==="agent"?f.jsx(YE,{}):f.jsx(ru,{})}),B==="agent"||B==="card-news"?null:f.jsx(Fx,{})]}),f.jsx(SE,{}),f.jsx(CE,{}),f.jsx(Vx,{}),f.jsx(Xx,{}),f.jsx(vE,{}),f.jsx(xE,{}),f.jsx(_E,{}),f.jsx(jE,{}),f.jsx(AE,{}),B==="card-news"?f.jsx(H.Suspense,{fallback:null,children:f.jsx(KE,{})}):null]})}function QE(){if(window.location.protocol!=="http:"||window.location.hostname!=="localhost")return!1;const l=new URL(window.location.href);return l.hostname="127.0.0.1",window.location.replace(l.toString()),!0}QE()||sb.createRoot(document.getElementById("root")).render(f.jsx(H.StrictMode,{children:f.jsx(XE,{})}));export{$E as A,Mh as B,fT as C,lT as D,aT as E,iT as F,oT as G,nT as H,Eg as I,sT as J,rT as K,cT as L,Tx as M,uT as N,dT as O,Wo as R,B1 as S,mb as T,U1 as U,P1 as W,Ea as _,H as a,_ as b,U0 as c,t1 as d,ji as e,EE as f,$v as g,TE as h,ms as i,f as j,mT as k,et as l,Yx as m,W0 as n,Za as o,Ex as p,Op as q,du as r,eT as s,Ss as t,be as u,tT as v,WE as w,ZE as x,vx as y,JE as z};