ima2-gen 1.1.21 → 1.1.23

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 (214) hide show
  1. package/README.md +44 -7
  2. package/bin/commands/video.js +14 -0
  3. package/bin/ima2.js +14 -4
  4. package/bin/lib/platform.js +34 -5
  5. package/docs/README.ko.md +43 -2
  6. package/lib/agentQueueWorker.js +6 -0
  7. package/lib/agentRuntime.js +3 -2
  8. package/lib/atomicWrite.js +14 -0
  9. package/lib/grokImageAdapter.js +6 -0
  10. package/lib/grokProxyLauncher.js +5 -3
  11. package/lib/grokVideoAdapter.js +1 -1
  12. package/lib/grokVideoPlannerPrompt.js +10 -0
  13. package/lib/inflight.js +1 -1
  14. package/lib/oauthLauncher.js +5 -0
  15. package/lib/videoFrameExtract.js +3 -3
  16. package/package.json +5 -7
  17. package/routes/capabilities.js +13 -0
  18. package/routes/edit.js +2 -1
  19. package/routes/generate.js +32 -6
  20. package/routes/health.js +4 -3
  21. package/routes/multimode.js +2 -1
  22. package/routes/video.js +35 -3
  23. package/server.js +29 -2
  24. package/skills/ima2/SKILL.md +48 -6
  25. package/ui/dist/.vite/manifest.json +12 -12
  26. package/ui/dist/assets/{AgentWorkspace-B_hq9CLg.js → AgentWorkspace-C21zqdTZ.js} +1 -1
  27. package/ui/dist/assets/{CardNewsWorkspace-wD12J7qk.js → CardNewsWorkspace-BN-ga1lG.js} +1 -1
  28. package/ui/dist/assets/{NodeCanvas-CI_wuPMf.js → NodeCanvas-BbMa4IhI.js} +1 -1
  29. package/ui/dist/assets/{PromptBuilderPanel-CUTujJUV.js → PromptBuilderPanel-DRwBJRDQ.js} +1 -1
  30. package/ui/dist/assets/{PromptImportDialog-CUi66jPK.js → PromptImportDialog-Dp85kHCq.js} +2 -2
  31. package/ui/dist/assets/{PromptImportDiscoverySection-Cm3vrjY4.js → PromptImportDiscoverySection-BE8Q8MLD.js} +1 -1
  32. package/ui/dist/assets/{PromptImportFolderSection-DOtWTD9n.js → PromptImportFolderSection-PtH5x0sc.js} +1 -1
  33. package/ui/dist/assets/{PromptLibraryPanel-BMjQegRa.js → PromptLibraryPanel-FnM9tHI9.js} +2 -2
  34. package/ui/dist/assets/SettingsWorkspace-MARPGyBL.js +1 -0
  35. package/ui/dist/assets/index-BAFI6htx.js +42 -0
  36. package/ui/dist/assets/{index-31uVIdt4.js → index-BSXxr_Bt.js} +1 -1
  37. package/ui/dist/assets/index-DS-ADE7U.css +1 -0
  38. package/ui/dist/index.html +2 -2
  39. package/bin/commands/annotate.ts +0 -119
  40. package/bin/commands/cancel.ts +0 -48
  41. package/bin/commands/canvas-versions.ts +0 -80
  42. package/bin/commands/capabilities.ts +0 -110
  43. package/bin/commands/cardnews.ts +0 -249
  44. package/bin/commands/comfy.ts +0 -54
  45. package/bin/commands/config.ts +0 -186
  46. package/bin/commands/defaults.ts +0 -192
  47. package/bin/commands/doctor.ts +0 -202
  48. package/bin/commands/edit.ts +0 -150
  49. package/bin/commands/gen.ts +0 -214
  50. package/bin/commands/grok.ts +0 -90
  51. package/bin/commands/history.ts +0 -146
  52. package/bin/commands/ls.ts +0 -64
  53. package/bin/commands/metadata.ts +0 -39
  54. package/bin/commands/multimode.ts +0 -196
  55. package/bin/commands/node.ts +0 -166
  56. package/bin/commands/observability.ts +0 -176
  57. package/bin/commands/ping.ts +0 -31
  58. package/bin/commands/prompt-sub/build.ts +0 -101
  59. package/bin/commands/prompt.ts +0 -492
  60. package/bin/commands/ps.ts +0 -81
  61. package/bin/commands/session.ts +0 -266
  62. package/bin/commands/show.ts +0 -72
  63. package/bin/commands/skill.ts +0 -70
  64. package/bin/commands/video.ts +0 -442
  65. package/bin/ima2.ts +0 -430
  66. package/bin/lib/args.ts +0 -92
  67. package/bin/lib/browser-id.ts +0 -16
  68. package/bin/lib/client.ts +0 -122
  69. package/bin/lib/config-store.ts +0 -120
  70. package/bin/lib/destructive-confirm.ts +0 -19
  71. package/bin/lib/doctor-checks.ts +0 -91
  72. package/bin/lib/error-hints.ts +0 -23
  73. package/bin/lib/files.ts +0 -39
  74. package/bin/lib/output.ts +0 -73
  75. package/bin/lib/platform.ts +0 -99
  76. package/bin/lib/recover-output.ts +0 -139
  77. package/bin/lib/sse.ts +0 -73
  78. package/bin/lib/star-prompt.ts +0 -97
  79. package/bin/lib/storage-doctor.ts +0 -39
  80. package/bin/lib/ui-build.ts +0 -85
  81. package/config.ts +0 -354
  82. package/lib/agentCommandParser.ts +0 -69
  83. package/lib/agentGenerationPlanner.ts +0 -273
  84. package/lib/agentQuestionResponder.ts +0 -266
  85. package/lib/agentQueueStore.ts +0 -270
  86. package/lib/agentQueueWorker.ts +0 -89
  87. package/lib/agentRuntime.ts +0 -604
  88. package/lib/agentSettings.ts +0 -72
  89. package/lib/agentStore.ts +0 -422
  90. package/lib/agentStoreRows.ts +0 -136
  91. package/lib/agentTypes.ts +0 -154
  92. package/lib/apiCachePolicy.ts +0 -11
  93. package/lib/assetLifecycle.ts +0 -146
  94. package/lib/canvasVersionStore.ts +0 -223
  95. package/lib/capabilities.ts +0 -126
  96. package/lib/cardNewsGenerator.ts +0 -271
  97. package/lib/cardNewsJobStore.ts +0 -142
  98. package/lib/cardNewsManifestStore.ts +0 -154
  99. package/lib/cardNewsPlanner.ts +0 -236
  100. package/lib/cardNewsPlannerClient.ts +0 -155
  101. package/lib/cardNewsPlannerPrompt.ts +0 -62
  102. package/lib/cardNewsPlannerSchema.ts +0 -321
  103. package/lib/cardNewsRoleTemplateStore.ts +0 -47
  104. package/lib/cardNewsTemplateStore.ts +0 -252
  105. package/lib/codexDetect.ts +0 -71
  106. package/lib/comfyBridge.ts +0 -235
  107. package/lib/composerSnapshot.ts +0 -33
  108. package/lib/configKeys.ts +0 -62
  109. package/lib/db.ts +0 -295
  110. package/lib/errInfo.ts +0 -43
  111. package/lib/errorClassify.ts +0 -100
  112. package/lib/generationCancel.ts +0 -28
  113. package/lib/generationErrors.ts +0 -238
  114. package/lib/grokImageAdapter.ts +0 -513
  115. package/lib/grokMultimodeAdapter.ts +0 -84
  116. package/lib/grokProxyLauncher.ts +0 -153
  117. package/lib/grokRuntime.ts +0 -23
  118. package/lib/grokSizeMapper.ts +0 -71
  119. package/lib/grokVideoAdapter.ts +0 -458
  120. package/lib/grokVideoCanvas.ts +0 -26
  121. package/lib/grokVideoDownload.ts +0 -59
  122. package/lib/grokVideoPlannerPrompt.ts +0 -67
  123. package/lib/historyIndex.ts +0 -51
  124. package/lib/historyList.ts +0 -181
  125. package/lib/imageMetadata.ts +0 -113
  126. package/lib/imageMetadataStore.ts +0 -67
  127. package/lib/imageModels.ts +0 -165
  128. package/lib/inflight.ts +0 -281
  129. package/lib/localImportStore.ts +0 -114
  130. package/lib/logger.ts +0 -161
  131. package/lib/nodeStore.ts +0 -91
  132. package/lib/oauthLauncher.ts +0 -94
  133. package/lib/oauthNormalize.ts +0 -30
  134. package/lib/oauthProxy/errors.ts +0 -128
  135. package/lib/oauthProxy/generators.ts +0 -494
  136. package/lib/oauthProxy/index.ts +0 -28
  137. package/lib/oauthProxy/prompts.ts +0 -123
  138. package/lib/oauthProxy/references.ts +0 -45
  139. package/lib/oauthProxy/runtime.ts +0 -115
  140. package/lib/oauthProxy/streams.ts +0 -232
  141. package/lib/oauthProxy/types.ts +0 -9
  142. package/lib/oauthProxy.ts +0 -3
  143. package/lib/openDirectory.ts +0 -47
  144. package/lib/pngInfo.ts +0 -26
  145. package/lib/promptBuilder/attachments.ts +0 -74
  146. package/lib/promptBuilder/client.ts +0 -130
  147. package/lib/promptBuilder/constants.ts +0 -9
  148. package/lib/promptBuilder/context.ts +0 -36
  149. package/lib/promptBuilder/errors.ts +0 -12
  150. package/lib/promptBuilder/requestSchema.ts +0 -56
  151. package/lib/promptBuilder/responseParser.ts +0 -219
  152. package/lib/promptBuilder/systemPrompt.ts +0 -135
  153. package/lib/promptBuilder/transport.ts +0 -94
  154. package/lib/promptBuilder/types.ts +0 -109
  155. package/lib/promptImport/curatedSources.ts +0 -141
  156. package/lib/promptImport/discoveryRegistry.ts +0 -329
  157. package/lib/promptImport/errors.ts +0 -18
  158. package/lib/promptImport/githubDiscovery.ts +0 -309
  159. package/lib/promptImport/githubFolder.ts +0 -397
  160. package/lib/promptImport/githubSource.ts +0 -257
  161. package/lib/promptImport/gptImageHints.ts +0 -70
  162. package/lib/promptImport/parsePromptCandidates.ts +0 -179
  163. package/lib/promptImport/promptIndex.ts +0 -326
  164. package/lib/promptImport/rankPromptCandidates.ts +0 -65
  165. package/lib/promptImport/types.ts +0 -103
  166. package/lib/promptSafetyPolicy.ts +0 -5
  167. package/lib/providerOptions.ts +0 -56
  168. package/lib/referenceImageCompress.ts +0 -84
  169. package/lib/refs.ts +0 -133
  170. package/lib/requestLogger.ts +0 -49
  171. package/lib/responsesDoctor.ts +0 -456
  172. package/lib/responsesErrors.ts +0 -83
  173. package/lib/responsesFallback.ts +0 -114
  174. package/lib/responsesImageAdapter.ts +0 -466
  175. package/lib/responsesParse.ts +0 -452
  176. package/lib/responsesTools.ts +0 -28
  177. package/lib/runtimeContext.ts +0 -146
  178. package/lib/runtimePorts.ts +0 -105
  179. package/lib/sessionStore.ts +0 -308
  180. package/lib/storageMigration.ts +0 -310
  181. package/lib/styleSheet.ts +0 -139
  182. package/lib/systemTrash.ts +0 -20
  183. package/lib/videoContinuity.ts +0 -180
  184. package/lib/videoFrameExtract.ts +0 -78
  185. package/lib/videoSeriesChain.ts +0 -29
  186. package/lib/visibleTextLanguagePolicy.ts +0 -7
  187. package/routes/agent.ts +0 -308
  188. package/routes/annotations.ts +0 -118
  189. package/routes/canvasVersions.ts +0 -69
  190. package/routes/capabilities.ts +0 -18
  191. package/routes/cardNews.ts +0 -211
  192. package/routes/comfy.ts +0 -43
  193. package/routes/edit.ts +0 -352
  194. package/routes/generate.ts +0 -492
  195. package/routes/grok.ts +0 -24
  196. package/routes/health.ts +0 -123
  197. package/routes/history.ts +0 -221
  198. package/routes/imageImport.ts +0 -37
  199. package/routes/index.ts +0 -52
  200. package/routes/metadata.ts +0 -77
  201. package/routes/multimode.ts +0 -499
  202. package/routes/nodes.ts +0 -578
  203. package/routes/promptBuilder.ts +0 -37
  204. package/routes/promptImport.ts +0 -379
  205. package/routes/prompts.ts +0 -428
  206. package/routes/quota.ts +0 -89
  207. package/routes/sessions.ts +0 -317
  208. package/routes/storage.ts +0 -47
  209. package/routes/video.ts +0 -300
  210. package/routes/videoExtended.ts +0 -284
  211. package/server.ts +0 -293
  212. package/ui/dist/assets/SettingsWorkspace-PiaVnsdA.js +0 -1
  213. package/ui/dist/assets/index-CjgnNtgt.css +0 -1
  214. package/ui/dist/assets/index-Da2s4_-5.js +0 -36
@@ -1,36 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NodeCanvas-CI_wuPMf.js","assets/NodeCanvas-BZV40eAE.css"])))=>i.map(i=>d[i]);
2
- (function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))r(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&r(p)}).observe(document,{childList:!0,subtree:!0});function i(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function r(u){if(u.ep)return;u.ep=!0;const f=i(u);fetch(u.href,f)}})();function Eb(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Kc={exports:{}},vi={};var jp;function Nb(){if(jp)return vi;jp=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function i(r,u,f){var p=null;if(f!==void 0&&(p=""+f),u.key!==void 0&&(p=""+u.key),"key"in u){f={};for(var m in u)m!=="key"&&(f[m]=u[m])}else f=u;return u=f.ref,{$$typeof:n,type:r,key:p,ref:u!==void 0?u:null,props:f}}return vi.Fragment=o,vi.jsx=i,vi.jsxs=i,vi}var Ip;function _b(){return Ip||(Ip=1,Kc.exports=Nb()),Kc.exports}var d=_b(),Xc={exports:{}},fe={};var zp;function wb(){if(zp)return fe;zp=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),p=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),S=Symbol.iterator;function T(A){return A===null||typeof A!="object"?null:(A=S&&A[S]||A["@@iterator"],typeof A=="function"?A:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,O={};function P(A,U,J){this.props=A,this.context=U,this.refs=O,this.updater=J||E}P.prototype.isReactComponent={},P.prototype.setState=function(A,U){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,U,"setState")},P.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function Y(){}Y.prototype=P.prototype;function Z(A,U,J){this.props=A,this.context=U,this.refs=O,this.updater=J||E}var k=Z.prototype=new Y;k.constructor=Z,M(k,P.prototype),k.isPureReactComponent=!0;var ne=Array.isArray;function F(){}var ee={H:null,A:null,T:null,S:null},Ee=Object.prototype.hasOwnProperty;function Ie(A,U,J){var te=J.ref;return{$$typeof:n,type:A,key:U,ref:te!==void 0?te:null,props:J}}function K(A,U){return Ie(A.type,U,A.props)}function $(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function le(A){var U={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(J){return U[J]})}var Ae=/\/+/g;function we(A,U){return typeof A=="object"&&A!==null&&A.key!=null?le(""+A.key):U.toString(36)}function Q(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(F,F):(A.status="pending",A.then(function(U){A.status==="pending"&&(A.status="fulfilled",A.value=U)},function(U){A.status==="pending"&&(A.status="rejected",A.reason=U)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function w(A,U,J,te,ce){var de=typeof A;(de==="undefined"||de==="boolean")&&(A=null);var L=!1;if(A===null)L=!0;else switch(de){case"bigint":case"string":case"number":L=!0;break;case"object":switch(A.$$typeof){case n:case o:L=!0;break;case x:return L=A._init,w(L(A._payload),U,J,te,ce)}}if(L)return ce=ce(A),L=te===""?"."+we(A,0):te,ne(ce)?(J="",L!=null&&(J=L.replace(Ae,"$&/")+"/"),w(ce,U,J,"",function(nt){return nt})):ce!=null&&($(ce)&&(ce=K(ce,J+(ce.key==null||A&&A.key===ce.key?"":(""+ce.key).replace(Ae,"$&/")+"/")+L)),U.push(ce)),1;L=0;var ue=te===""?".":te+":";if(ne(A))for(var me=0;me<A.length;me++)te=A[me],de=ue+we(te,me),L+=w(te,U,J,de,ce);else if(me=T(A),typeof me=="function")for(A=me.call(A),me=0;!(te=A.next()).done;)te=te.value,de=ue+we(te,me++),L+=w(te,U,J,de,ce);else if(de==="object"){if(typeof A.then=="function")return w(Q(A),U,J,te,ce);throw U=String(A),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return L}function X(A,U,J){if(A==null)return A;var te=[],ce=0;return w(A,te,"","",function(de){return U.call(J,de,ce++)}),te}function ie(A){if(A._status===-1){var U=A._result;U=U(),U.then(function(J){(A._status===0||A._status===-1)&&(A._status=1,A._result=J)},function(J){(A._status===0||A._status===-1)&&(A._status=2,A._result=J)}),A._status===-1&&(A._status=0,A._result=U)}if(A._status===1)return A._result.default;throw A._result}var Ne=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},Oe={map:X,forEach:function(A,U,J){X(A,function(){U.apply(this,arguments)},J)},count:function(A){var U=0;return X(A,function(){U++}),U},toArray:function(A){return X(A,function(U){return U})||[]},only:function(A){if(!$(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return fe.Activity=b,fe.Children=Oe,fe.Component=P,fe.Fragment=i,fe.Profiler=u,fe.PureComponent=Z,fe.StrictMode=r,fe.Suspense=y,fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ee,fe.__COMPILER_RUNTIME={__proto__:null,c:function(A){return ee.H.useMemoCache(A)}},fe.cache=function(A){return function(){return A.apply(null,arguments)}},fe.cacheSignal=function(){return null},fe.cloneElement=function(A,U,J){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var te=M({},A.props),ce=A.key;if(U!=null)for(de in U.key!==void 0&&(ce=""+U.key),U)!Ee.call(U,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&U.ref===void 0||(te[de]=U[de]);var de=arguments.length-2;if(de===1)te.children=J;else if(1<de){for(var L=Array(de),ue=0;ue<de;ue++)L[ue]=arguments[ue+2];te.children=L}return Ie(A.type,ce,te)},fe.createContext=function(A){return A={$$typeof:p,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:f,_context:A},A},fe.createElement=function(A,U,J){var te,ce={},de=null;if(U!=null)for(te in U.key!==void 0&&(de=""+U.key),U)Ee.call(U,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(ce[te]=U[te]);var L=arguments.length-2;if(L===1)ce.children=J;else if(1<L){for(var ue=Array(L),me=0;me<L;me++)ue[me]=arguments[me+2];ce.children=ue}if(A&&A.defaultProps)for(te in L=A.defaultProps,L)ce[te]===void 0&&(ce[te]=L[te]);return Ie(A,de,ce)},fe.createRef=function(){return{current:null}},fe.forwardRef=function(A){return{$$typeof:m,render:A}},fe.isValidElement=$,fe.lazy=function(A){return{$$typeof:x,_payload:{_status:-1,_result:A},_init:ie}},fe.memo=function(A,U){return{$$typeof:h,type:A,compare:U===void 0?null:U}},fe.startTransition=function(A){var U=ee.T,J={};ee.T=J;try{var te=A(),ce=ee.S;ce!==null&&ce(J,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(F,Ne)}catch(de){Ne(de)}finally{U!==null&&J.types!==null&&(U.types=J.types),ee.T=U}},fe.unstable_useCacheRefresh=function(){return ee.H.useCacheRefresh()},fe.use=function(A){return ee.H.use(A)},fe.useActionState=function(A,U,J){return ee.H.useActionState(A,U,J)},fe.useCallback=function(A,U){return ee.H.useCallback(A,U)},fe.useContext=function(A){return ee.H.useContext(A)},fe.useDebugValue=function(){},fe.useDeferredValue=function(A,U){return ee.H.useDeferredValue(A,U)},fe.useEffect=function(A,U){return ee.H.useEffect(A,U)},fe.useEffectEvent=function(A){return ee.H.useEffectEvent(A)},fe.useId=function(){return ee.H.useId()},fe.useImperativeHandle=function(A,U,J){return ee.H.useImperativeHandle(A,U,J)},fe.useInsertionEffect=function(A,U){return ee.H.useInsertionEffect(A,U)},fe.useLayoutEffect=function(A,U){return ee.H.useLayoutEffect(A,U)},fe.useMemo=function(A,U){return ee.H.useMemo(A,U)},fe.useOptimistic=function(A,U){return ee.H.useOptimistic(A,U)},fe.useReducer=function(A,U,J){return ee.H.useReducer(A,U,J)},fe.useRef=function(A){return ee.H.useRef(A)},fe.useState=function(A){return ee.H.useState(A)},fe.useSyncExternalStore=function(A,U,J){return ee.H.useSyncExternalStore(A,U,J)},fe.useTransition=function(){return ee.H.useTransition()},fe.version="19.2.5",fe}var Dp;function Eu(){return Dp||(Dp=1,Xc.exports=wb()),Xc.exports}var D=Eu();const ar=Eb(D);var Qc={exports:{}},bi={},Zc={exports:{}},Jc={};var kp;function Cb(){return kp||(kp=1,(function(n){function o(w,X){var ie=w.length;w.push(X);e:for(;0<ie;){var Ne=ie-1>>>1,Oe=w[Ne];if(0<u(Oe,X))w[Ne]=X,w[ie]=Oe,ie=Ne;else break e}}function i(w){return w.length===0?null:w[0]}function r(w){if(w.length===0)return null;var X=w[0],ie=w.pop();if(ie!==X){w[0]=ie;e:for(var Ne=0,Oe=w.length,A=Oe>>>1;Ne<A;){var U=2*(Ne+1)-1,J=w[U],te=U+1,ce=w[te];if(0>u(J,ie))te<Oe&&0>u(ce,J)?(w[Ne]=ce,w[te]=ie,Ne=te):(w[Ne]=J,w[U]=ie,Ne=U);else if(te<Oe&&0>u(ce,ie))w[Ne]=ce,w[te]=ie,Ne=te;else break e}}return X}function u(w,X){var ie=w.sortIndex-X.sortIndex;return ie!==0?ie:w.id-X.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var p=Date,m=p.now();n.unstable_now=function(){return p.now()-m}}var y=[],h=[],x=1,b=null,S=3,T=!1,E=!1,M=!1,O=!1,P=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;function k(w){for(var X=i(h);X!==null;){if(X.callback===null)r(h);else if(X.startTime<=w)r(h),X.sortIndex=X.expirationTime,o(y,X);else break;X=i(h)}}function ne(w){if(M=!1,k(w),!E)if(i(y)!==null)E=!0,F||(F=!0,le());else{var X=i(h);X!==null&&Q(ne,X.startTime-w)}}var F=!1,ee=-1,Ee=5,Ie=-1;function K(){return O?!0:!(n.unstable_now()-Ie<Ee)}function $(){if(O=!1,F){var w=n.unstable_now();Ie=w;var X=!0;try{e:{E=!1,M&&(M=!1,Y(ee),ee=-1),T=!0;var ie=S;try{t:{for(k(w),b=i(y);b!==null&&!(b.expirationTime>w&&K());){var Ne=b.callback;if(typeof Ne=="function"){b.callback=null,S=b.priorityLevel;var Oe=Ne(b.expirationTime<=w);if(w=n.unstable_now(),typeof Oe=="function"){b.callback=Oe,k(w),X=!0;break t}b===i(y)&&r(y),k(w)}else r(y);b=i(y)}if(b!==null)X=!0;else{var A=i(h);A!==null&&Q(ne,A.startTime-w),X=!1}}break e}finally{b=null,S=ie,T=!1}X=void 0}}finally{X?le():F=!1}}}var le;if(typeof Z=="function")le=function(){Z($)};else if(typeof MessageChannel<"u"){var Ae=new MessageChannel,we=Ae.port2;Ae.port1.onmessage=$,le=function(){we.postMessage(null)}}else le=function(){P($,0)};function Q(w,X){ee=P(function(){w(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(w){w.callback=null},n.unstable_forceFrameRate=function(w){0>w||125<w?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Ee=0<w?Math.floor(1e3/w):5},n.unstable_getCurrentPriorityLevel=function(){return S},n.unstable_next=function(w){switch(S){case 1:case 2:case 3:var X=3;break;default:X=S}var ie=S;S=X;try{return w()}finally{S=ie}},n.unstable_requestPaint=function(){O=!0},n.unstable_runWithPriority=function(w,X){switch(w){case 1:case 2:case 3:case 4:case 5:break;default:w=3}var ie=S;S=w;try{return X()}finally{S=ie}},n.unstable_scheduleCallback=function(w,X,ie){var Ne=n.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?Ne+ie:Ne):ie=Ne,w){case 1:var Oe=-1;break;case 2:Oe=250;break;case 5:Oe=1073741823;break;case 4:Oe=1e4;break;default:Oe=5e3}return Oe=ie+Oe,w={id:x++,callback:X,priorityLevel:w,startTime:ie,expirationTime:Oe,sortIndex:-1},ie>Ne?(w.sortIndex=ie,o(h,w),i(y)===null&&w===i(h)&&(M?(Y(ee),ee=-1):M=!0,Q(ne,ie-Ne))):(w.sortIndex=Oe,o(y,w),E||T||(E=!0,F||(F=!0,le()))),w},n.unstable_shouldYield=K,n.unstable_wrapCallback=function(w){var X=S;return function(){var ie=S;S=X;try{return w.apply(this,arguments)}finally{S=ie}}}})(Jc)),Jc}var Lp;function Ab(){return Lp||(Lp=1,Zc.exports=Cb()),Zc.exports}var $c={exports:{}},ut={};var qp;function Mb(){if(qp)return ut;qp=1;var n=Eu();function o(y){var h="https://react.dev/errors/"+y;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)h+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+y+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(o(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 f(y,h,x){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:b==null?null:""+b,children:y,containerInfo:h,implementation:x}}var p=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,h){if(y==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return ut.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ut.createPortal=function(y,h){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(o(299));return f(y,h,null,x)},ut.flushSync=function(y){var h=p.T,x=r.p;try{if(p.T=null,r.p=2,y)return y()}finally{p.T=h,r.p=x,r.d.f()}},ut.preconnect=function(y,h){typeof y=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(y,h))},ut.prefetchDNS=function(y){typeof y=="string"&&r.d.D(y)},ut.preinit=function(y,h){if(typeof y=="string"&&h&&typeof h.as=="string"){var x=h.as,b=m(x,h.crossOrigin),S=typeof h.integrity=="string"?h.integrity:void 0,T=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;x==="style"?r.d.S(y,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:b,integrity:S,fetchPriority:T}):x==="script"&&r.d.X(y,{crossOrigin:b,integrity:S,fetchPriority:T,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},ut.preinitModule=function(y,h){if(typeof y=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var x=m(h.as,h.crossOrigin);r.d.M(y,{crossOrigin:x,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(y)},ut.preload=function(y,h){if(typeof y=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var x=h.as,b=m(x,h.crossOrigin);r.d.L(y,x,{crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},ut.preloadModule=function(y,h){if(typeof y=="string")if(h){var x=m(h.as,h.crossOrigin);r.d.m(y,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:x,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(y)},ut.requestFormReset=function(y){r.d.r(y)},ut.unstable_batchedUpdates=function(y,h){return y(h)},ut.useFormState=function(y,h,x){return p.H.useFormState(y,h,x)},ut.useFormStatus=function(){return p.H.useHostTransitionStatus()},ut.version="19.2.5",ut}var Gp;function Bh(){if(Gp)return $c.exports;Gp=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),$c.exports=Mb(),$c.exports}var Hp;function Rb(){if(Hp)return bi;Hp=1;var n=Ab(),o=Eu(),i=Bh();function r(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 f(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(f(e)!==e)throw Error(r(188))}function h(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(r(188));return t!==e?null:e}for(var a=e,l=t;;){var s=a.return;if(s===null)break;var c=s.alternate;if(c===null){if(l=s.return,l!==null){a=l;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===a)return y(s),e;if(c===l)return y(s),t;c=c.sibling}throw Error(r(188))}if(a.return!==l.return)a=s,l=c;else{for(var g=!1,v=s.child;v;){if(v===a){g=!0,a=s,l=c;break}if(v===l){g=!0,l=s,a=c;break}v=v.sibling}if(!g){for(v=c.child;v;){if(v===a){g=!0,a=c,l=s;break}if(v===l){g=!0,l=c,a=s;break}v=v.sibling}if(!g)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,S=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),Ee=Symbol.for("react.lazy"),Ie=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var Ae=Symbol.for("react.client.reference");function we(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case P:return"Profiler";case O:return"StrictMode";case ne:return"Suspense";case F:return"SuspenseList";case Ie:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case Z:return e.displayName||"Context";case Y:return(e._context.displayName||"Context")+".Consumer";case k:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return t=e.displayName||null,t!==null?t:we(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return we(e(t))}catch{}}return null}var Q=Array.isArray,w=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},Ne=[],Oe=-1;function A(e){return{current:e}}function U(e){0>Oe||(e.current=Ne[Oe],Ne[Oe]=null,Oe--)}function J(e,t){Oe++,Ne[Oe]=e.current,e.current=t}var te=A(null),ce=A(null),de=A(null),L=A(null);function ue(e,t){switch(J(de,t),J(ce,e),J(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?tp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=tp(t),e=ap(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(te),J(te,e)}function me(){U(te),U(ce),U(de)}function nt(e){e.memoizedState!==null&&J(L,e);var t=te.current,a=ap(t,e.type);t!==a&&(J(ce,e),J(te,a))}function la(e){ce.current===e&&(U(te),U(ce)),L.current===e&&(U(L),pi._currentValue=ie)}var tn,ki;function ia(e){if(tn===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);tn=t&&t[1]||"",ki=-1<a.stack.indexOf(`
3
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
4
- `+tn+e+ki}var El=!1;function Nl(e,t){if(!e||El)return"";El=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var B=function(){throw Error()};if(Object.defineProperty(B.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(B,[])}catch(q){var z=q}Reflect.construct(e,[],B)}else{try{B.call()}catch(q){z=q}e.call(B.prototype)}}else{try{throw Error()}catch(q){z=q}(B=e())&&typeof B.catch=="function"&&B.catch(function(){})}}catch(q){if(q&&z&&typeof q.stack=="string")return[q.stack,z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=l.DetermineComponentFrameRoot(),g=c[0],v=c[1];if(g&&v){var N=g.split(`
5
- `),I=v.split(`
6
- `);for(s=l=0;l<N.length&&!N[l].includes("DetermineComponentFrameRoot");)l++;for(;s<I.length&&!I[s].includes("DetermineComponentFrameRoot");)s++;if(l===N.length||s===I.length)for(l=N.length-1,s=I.length-1;1<=l&&0<=s&&N[l]!==I[s];)s--;for(;1<=l&&0<=s;l--,s--)if(N[l]!==I[s]){if(l!==1||s!==1)do if(l--,s--,0>s||N[l]!==I[s]){var G=`
7
- `+N[l].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=l&&0<=s);break}}}finally{El=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ia(a):""}function Li(e,t){switch(e.tag){case 26:case 27:case 5:return ia(e.type);case 16:return ia("Lazy");case 13:return e.child!==t&&t!==null?ia("Suspense Fallback"):ia("Suspense");case 19:return ia("SuspenseList");case 0:case 15:return Nl(e.type,!1);case 11:return Nl(e.type.render,!1);case 1:return Nl(e.type,!0);case 31:return ia("Activity");default:return""}}function Ca(e){try{var t="",a=null;do t+=Li(e,a),a=e,e=e.return;while(e);return t}catch(l){return`
8
- Error generating stack: `+l.message+`
9
- `+l.stack}}var _l=Object.prototype.hasOwnProperty,V=n.unstable_scheduleCallback,Ce=n.unstable_cancelCallback,dt=n.unstable_shouldYield,ve=n.unstable_requestPaint,Be=n.unstable_now,An=n.unstable_getCurrentPriorityLevel,Qt=n.unstable_ImmediatePriority,Iu=n.unstable_UserBlockingPriority,qi=n.unstable_NormalPriority,ly=n.unstable_LowPriority,zu=n.unstable_IdlePriority,iy=n.log,oy=n.unstable_setDisableYieldValue,wl=null,Tt=null;function Aa(e){if(typeof iy=="function"&&oy(e),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(wl,e)}catch{}}var Et=Math.clz32?Math.clz32:cy,ry=Math.log,sy=Math.LN2;function cy(e){return e>>>=0,e===0?32:31-(ry(e)/sy|0)|0}var Gi=256,Hi=262144,Ui=4194304;function an(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 Bi(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var s=0,c=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var v=l&134217727;return v!==0?(l=v&~c,l!==0?s=an(l):(g&=v,g!==0?s=an(g):a||(a=v&~e,a!==0&&(s=an(a))))):(v=l&~c,v!==0?s=an(v):g!==0?s=an(g):a||(a=l&~e,a!==0&&(s=an(a)))),s===0?0:t!==0&&t!==s&&(t&c)===0&&(c=s&-s,a=t&-t,c>=a||c===32&&(a&4194048)!==0)?t:s}function Cl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function uy(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 Du(){var e=Ui;return Ui<<=1,(Ui&62914560)===0&&(Ui=4194304),e}function Dr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Al(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function dy(e,t,a,l,s,c){var g=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,N=e.expirationTimes,I=e.hiddenUpdates;for(a=g&~a;0<a;){var G=31-Et(a),B=1<<G;v[G]=0,N[G]=-1;var z=I[G];if(z!==null)for(I[G]=null,G=0;G<z.length;G++){var q=z[G];q!==null&&(q.lane&=-536870913)}a&=~B}l!==0&&ku(e,l,0),c!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=c&~(g&~t))}function ku(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Et(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Lu(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-Et(a),s=1<<l;s&t|e[l]&t&&(e[l]|=t),a&=~s}}function qu(e,t){var a=t&-t;return a=(a&42)!==0?1:kr(a),(a&(e.suspendedLanes|t))!==0?0:a}function kr(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 Lr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Gu(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:_p(e.type))}function Hu(e,t){var a=X.p;try{return X.p=e,t()}finally{X.p=a}}var Ma=Math.random().toString(36).slice(2),lt="__reactFiber$"+Ma,mt="__reactProps$"+Ma,Mn="__reactContainer$"+Ma,qr="__reactEvents$"+Ma,fy="__reactListeners$"+Ma,my="__reactHandles$"+Ma,Uu="__reactResources$"+Ma,Ml="__reactMarker$"+Ma;function Gr(e){delete e[lt],delete e[mt],delete e[qr],delete e[fy],delete e[my]}function Rn(e){var t=e[lt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[Mn]||a[lt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=cp(e);e!==null;){if(a=e[lt])return a;e=cp(e)}return t}e=a,a=e.parentNode}return null}function On(e){if(e=e[lt]||e[Mn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Rl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function jn(e){var t=e[Uu];return t||(t=e[Uu]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function et(e){e[Ml]=!0}var Bu=new Set,Pu={};function nn(e,t){In(e,t),In(e+"Capture",t)}function In(e,t){for(Pu[e]=t,e=0;e<t.length;e++)Bu.add(t[e])}var py=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]*$"),Fu={},Vu={};function hy(e){return _l.call(Vu,e)?!0:_l.call(Fu,e)?!1:py.test(e)?Vu[e]=!0:(Fu[e]=!0,!1)}function Pi(e,t,a){if(hy(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Fi(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 oa(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+l)}}function jt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gy(e,t,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var s=l.get,c=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(g){a=""+g,c.call(this,g)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(g){a=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hr(e){if(!e._valueTracker){var t=Yu(e)?"checked":"value";e._valueTracker=gy(e,t,""+e[t])}}function Ku(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=Yu(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}function Vi(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 yy=/[\n"\\]/g;function It(e){return e.replace(yy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ur(e,t,a,l,s,c,g,v){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+jt(t)):e.value!==""+jt(t)&&(e.value=""+jt(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?Br(e,g,jt(t)):a!=null?Br(e,g,jt(a)):l!=null&&e.removeAttribute("value"),s==null&&c!=null&&(e.defaultChecked=!!c),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+jt(v):e.removeAttribute("name")}function Xu(e,t,a,l,s,c,g,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)){Hr(e);return}a=a!=null?""+jt(a):"",t=t!=null?""+jt(t):a,v||t===e.value||(e.value=t),e.defaultValue=t}l=l??s,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=v?e.checked:!!l,e.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),Hr(e)}function Br(e,t,a){t==="number"&&Vi(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function zn(e,t,a,l){if(e=e.options,t){t={};for(var s=0;s<a.length;s++)t["$"+a[s]]=!0;for(a=0;a<e.length;a++)s=t.hasOwnProperty("$"+e[a].value),e[a].selected!==s&&(e[a].selected=s),s&&l&&(e[a].defaultSelected=!0)}else{for(a=""+jt(a),t=null,s=0;s<e.length;s++){if(e[s].value===a){e[s].selected=!0,l&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Qu(e,t,a){if(t!=null&&(t=""+jt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+jt(a):""}function Zu(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(r(92));if(Q(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=jt(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Hr(e)}function Dn(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var vy=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 Ju(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||vy.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function $u(e,t,a){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var s in t)l=t[s],t.hasOwnProperty(s)&&a[s]!==l&&Ju(e,s,l)}else for(var c in t)t.hasOwnProperty(c)&&Ju(e,c,t[c])}function Pr(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 by=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"]]),Sy=/^[\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 Yi(e){return Sy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ra(){}var Fr=null;function Vr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var kn=null,Ln=null;function Wu(e){var t=On(e);if(t&&(e=t.stateNode)){var a=e[mt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ur(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="'+It(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var s=l[mt]||null;if(!s)throw Error(r(90));Ur(l,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&Ku(l)}break e;case"textarea":Qu(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&zn(e,!!a.multiple,t,!1)}}}var Yr=!1;function ed(e,t,a){if(Yr)return e(t,a);Yr=!0;try{var l=e(t);return l}finally{if(Yr=!1,(kn!==null||Ln!==null)&&(zo(),kn&&(t=kn,e=Ln,Ln=kn=null,Wu(t),e)))for(t=0;t<e.length;t++)Wu(e[t])}}function Ol(e,t){var a=e.stateNode;if(a===null)return null;var l=a[mt]||null;if(l===null)return null;a=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,t,typeof a));return a}var sa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kr=!1;if(sa)try{var jl={};Object.defineProperty(jl,"passive",{get:function(){Kr=!0}}),window.addEventListener("test",jl,jl),window.removeEventListener("test",jl,jl)}catch{Kr=!1}var Ra=null,Xr=null,Ki=null;function td(){if(Ki)return Ki;var e,t=Xr,a=t.length,l,s="value"in Ra?Ra.value:Ra.textContent,c=s.length;for(e=0;e<a&&t[e]===s[e];e++);var g=a-e;for(l=1;l<=g&&t[a-l]===s[c-l];l++);return Ki=s.slice(e,1<l?1-l:void 0)}function Xi(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 Qi(){return!0}function ad(){return!1}function pt(e){function t(a,l,s,c,g){this._reactName=a,this._targetInst=s,this.type=l,this.nativeEvent=c,this.target=g,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)?Qi:ad,this.isPropagationStopped=ad,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=Qi)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Qi)},persist:function(){},isPersistent:Qi}),t}var ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zi=pt(ln),Il=b({},ln,{view:0,detail:0}),xy=pt(Il),Qr,Zr,zl,Ji=b({},Il,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$r,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!==zl&&(zl&&e.type==="mousemove"?(Qr=e.screenX-zl.screenX,Zr=e.screenY-zl.screenY):Zr=Qr=0,zl=e),Qr)},movementY:function(e){return"movementY"in e?e.movementY:Zr}}),nd=pt(Ji),Ty=b({},Ji,{dataTransfer:0}),Ey=pt(Ty),Ny=b({},Il,{relatedTarget:0}),Jr=pt(Ny),_y=b({},ln,{animationName:0,elapsedTime:0,pseudoElement:0}),wy=pt(_y),Cy=b({},ln,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ay=pt(Cy),My=b({},ln,{data:0}),ld=pt(My),Ry={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"},jy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Iy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=jy[e])?!!t[e]:!1}function $r(){return Iy}var zy=b({},Il,{key:function(e){if(e.key){var t=Ry[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Xi(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:$r,charCode:function(e){return e.type==="keypress"?Xi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Xi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Dy=pt(zy),ky=b({},Ji,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),id=pt(ky),Ly=b({},Il,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$r}),qy=pt(Ly),Gy=b({},ln,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hy=pt(Gy),Uy=b({},Ji,{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}),By=pt(Uy),Py=b({},ln,{newState:0,oldState:0}),Fy=pt(Py),Vy=[9,13,27,32],Wr=sa&&"CompositionEvent"in window,Dl=null;sa&&"documentMode"in document&&(Dl=document.documentMode);var Yy=sa&&"TextEvent"in window&&!Dl,od=sa&&(!Wr||Dl&&8<Dl&&11>=Dl),rd=" ",sd=!1;function cd(e,t){switch(e){case"keyup":return Vy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ud(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qn=!1;function Ky(e,t){switch(e){case"compositionend":return ud(t);case"keypress":return t.which!==32?null:(sd=!0,rd);case"textInput":return e=t.data,e===rd&&sd?null:e;default:return null}}function Xy(e,t){if(qn)return e==="compositionend"||!Wr&&cd(e,t)?(e=td(),Ki=Xr=Ra=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 od&&t.locale!=="ko"?null:t.data;default:return null}}var Qy={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 dd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Qy[e.type]:t==="textarea"}function fd(e,t,a,l){kn?Ln?Ln.push(l):Ln=[l]:kn=l,t=Uo(t,"onChange"),0<t.length&&(a=new Zi("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var kl=null,Ll=null;function Zy(e){Qm(e,0)}function $i(e){var t=Rl(e);if(Ku(t))return e}function md(e,t){if(e==="change")return t}var pd=!1;if(sa){var es;if(sa){var ts="oninput"in document;if(!ts){var hd=document.createElement("div");hd.setAttribute("oninput","return;"),ts=typeof hd.oninput=="function"}es=ts}else es=!1;pd=es&&(!document.documentMode||9<document.documentMode)}function gd(){kl&&(kl.detachEvent("onpropertychange",yd),Ll=kl=null)}function yd(e){if(e.propertyName==="value"&&$i(Ll)){var t=[];fd(t,Ll,e,Vr(e)),ed(Zy,t)}}function Jy(e,t,a){e==="focusin"?(gd(),kl=t,Ll=a,kl.attachEvent("onpropertychange",yd)):e==="focusout"&&gd()}function $y(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $i(Ll)}function Wy(e,t){if(e==="click")return $i(t)}function ev(e,t){if(e==="input"||e==="change")return $i(t)}function tv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nt=typeof Object.is=="function"?Object.is:tv;function ql(e,t){if(Nt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var s=a[l];if(!_l.call(t,s)||!Nt(e[s],t[s]))return!1}return!0}function vd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function bd(e,t){var a=vd(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=vd(a)}}function Sd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Vi(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=Vi(e.document)}return t}function as(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 av=sa&&"documentMode"in document&&11>=document.documentMode,Gn=null,ns=null,Gl=null,ls=!1;function Td(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ls||Gn==null||Gn!==Vi(l)||(l=Gn,"selectionStart"in l&&as(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Gl&&ql(Gl,l)||(Gl=l,l=Uo(ns,"onSelect"),0<l.length&&(t=new Zi("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=Gn)))}function on(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Hn={animationend:on("Animation","AnimationEnd"),animationiteration:on("Animation","AnimationIteration"),animationstart:on("Animation","AnimationStart"),transitionrun:on("Transition","TransitionRun"),transitionstart:on("Transition","TransitionStart"),transitioncancel:on("Transition","TransitionCancel"),transitionend:on("Transition","TransitionEnd")},is={},Ed={};sa&&(Ed=document.createElement("div").style,"AnimationEvent"in window||(delete Hn.animationend.animation,delete Hn.animationiteration.animation,delete Hn.animationstart.animation),"TransitionEvent"in window||delete Hn.transitionend.transition);function rn(e){if(is[e])return is[e];if(!Hn[e])return e;var t=Hn[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Ed)return is[e]=t[a];return e}var Nd=rn("animationend"),_d=rn("animationiteration"),wd=rn("animationstart"),nv=rn("transitionrun"),lv=rn("transitionstart"),iv=rn("transitioncancel"),Cd=rn("transitionend"),Ad=new Map,os="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(" ");os.push("scrollEnd");function Bt(e,t){Ad.set(e,t),nn(t,[e])}var Wi=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)},zt=[],Un=0,rs=0;function eo(){for(var e=Un,t=rs=Un=0;t<e;){var a=zt[t];zt[t++]=null;var l=zt[t];zt[t++]=null;var s=zt[t];zt[t++]=null;var c=zt[t];if(zt[t++]=null,l!==null&&s!==null){var g=l.pending;g===null?s.next=s:(s.next=g.next,g.next=s),l.pending=s}c!==0&&Md(a,s,c)}}function to(e,t,a,l){zt[Un++]=e,zt[Un++]=t,zt[Un++]=a,zt[Un++]=l,rs|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function ss(e,t,a,l){return to(e,t,a,l),ao(e)}function sn(e,t){return to(e,null,null,t),ao(e)}function Md(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var s=!1,c=e.return;c!==null;)c.childLanes|=a,l=c.alternate,l!==null&&(l.childLanes|=a),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(s=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,s&&t!==null&&(s=31-Et(a),e=c.hiddenUpdates,l=e[s],l===null?e[s]=[t]:l.push(t),t.lane=a|536870912),c):null}function ao(e){if(50<ri)throw ri=0,yc=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Bn={};function ov(e,t,a,l){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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _t(e,t,a,l){return new ov(e,t,a,l)}function cs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ca(e,t){var a=e.alternate;return a===null?(a=_t(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 Rd(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 no(e,t,a,l,s,c){var g=0;if(l=e,typeof e=="function")cs(e)&&(g=1);else if(typeof e=="string")g=db(e,a,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ie:return e=_t(31,a,t,s),e.elementType=Ie,e.lanes=c,e;case M:return cn(a.children,s,c,t);case O:g=8,s|=24;break;case P:return e=_t(12,a,t,s|2),e.elementType=P,e.lanes=c,e;case ne:return e=_t(13,a,t,s),e.elementType=ne,e.lanes=c,e;case F:return e=_t(19,a,t,s),e.elementType=F,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Z:g=10;break e;case Y:g=9;break e;case k:g=11;break e;case ee:g=14;break e;case Ee:g=16,l=null;break e}g=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=_t(g,a,t,s),t.elementType=e,t.type=l,t.lanes=c,t}function cn(e,t,a,l){return e=_t(7,e,l,t),e.lanes=a,e}function us(e,t,a){return e=_t(6,e,null,t),e.lanes=a,e}function Od(e){var t=_t(18,null,null,0);return t.stateNode=e,t}function ds(e,t,a){return t=_t(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var jd=new WeakMap;function Dt(e,t){if(typeof e=="object"&&e!==null){var a=jd.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Ca(t)},jd.set(e,t),t)}return{value:e,source:t,stack:Ca(t)}}var Pn=[],Fn=0,lo=null,Hl=0,kt=[],Lt=0,Oa=null,Zt=1,Jt="";function ua(e,t){Pn[Fn++]=Hl,Pn[Fn++]=lo,lo=e,Hl=t}function Id(e,t,a){kt[Lt++]=Zt,kt[Lt++]=Jt,kt[Lt++]=Oa,Oa=e;var l=Zt;e=Jt;var s=32-Et(l)-1;l&=~(1<<s),a+=1;var c=32-Et(t)+s;if(30<c){var g=s-s%5;c=(l&(1<<g)-1).toString(32),l>>=g,s-=g,Zt=1<<32-Et(t)+s|a<<s|l,Jt=c+e}else Zt=1<<c|a<<s|l,Jt=e}function fs(e){e.return!==null&&(ua(e,1),Id(e,1,0))}function ms(e){for(;e===lo;)lo=Pn[--Fn],Pn[Fn]=null,Hl=Pn[--Fn],Pn[Fn]=null;for(;e===Oa;)Oa=kt[--Lt],kt[Lt]=null,Jt=kt[--Lt],kt[Lt]=null,Zt=kt[--Lt],kt[Lt]=null}function zd(e,t){kt[Lt++]=Zt,kt[Lt++]=Jt,kt[Lt++]=Oa,Zt=t.id,Jt=t.overflow,Oa=e}var it=null,He=null,_e=!1,ja=null,qt=!1,ps=Error(r(519));function Ia(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ul(Dt(t,e)),ps}function Dd(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[lt]=e,t[mt]=l,a){case"dialog":Se("cancel",t),Se("close",t);break;case"iframe":case"object":case"embed":Se("load",t);break;case"video":case"audio":for(a=0;a<ci.length;a++)Se(ci[a],t);break;case"source":Se("error",t);break;case"img":case"image":case"link":Se("error",t),Se("load",t);break;case"details":Se("toggle",t);break;case"input":Se("invalid",t),Xu(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Se("invalid",t);break;case"textarea":Se("invalid",t),Zu(t,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||Wm(t.textContent,a)?(l.popover!=null&&(Se("beforetoggle",t),Se("toggle",t)),l.onScroll!=null&&Se("scroll",t),l.onScrollEnd!=null&&Se("scrollend",t),l.onClick!=null&&(t.onclick=ra),t=!0):t=!1,t||Ia(e,!0)}function kd(e){for(it=e.return;it;)switch(it.tag){case 5:case 31:case 13:qt=!1;return;case 27:case 3:qt=!0;return;default:it=it.return}}function Vn(e){if(e!==it)return!1;if(!_e)return kd(e),_e=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||jc(e.type,e.memoizedProps)),a=!a),a&&He&&Ia(e),kd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=sp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=sp(e)}else t===27?(t=He,Ka(e.type)?(e=Lc,Lc=null,He=e):He=t):He=it?Ht(e.stateNode.nextSibling):null;return!0}function un(){He=it=null,_e=!1}function hs(){var e=ja;return e!==null&&(vt===null?vt=e:vt.push.apply(vt,e),ja=null),e}function Ul(e){ja===null?ja=[e]:ja.push(e)}var gs=A(null),dn=null,da=null;function za(e,t,a){J(gs,t._currentValue),t._currentValue=a}function fa(e){e._currentValue=gs.current,U(gs)}function ys(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function vs(e,t,a,l){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var c=s.dependencies;if(c!==null){var g=s.child;c=c.firstContext;e:for(;c!==null;){var v=c;c=s;for(var N=0;N<t.length;N++)if(v.context===t[N]){c.lanes|=a,v=c.alternate,v!==null&&(v.lanes|=a),ys(c.return,a,e),l||(g=null);break e}c=v.next}}else if(s.tag===18){if(g=s.return,g===null)throw Error(r(341));g.lanes|=a,c=g.alternate,c!==null&&(c.lanes|=a),ys(g,a,e),g=null}else g=s.child;if(g!==null)g.return=s;else for(g=s;g!==null;){if(g===e){g=null;break}if(s=g.sibling,s!==null){s.return=g.return,g=s;break}g=g.return}s=g}}function Yn(e,t,a,l){e=null;for(var s=t,c=!1;s!==null;){if(!c){if((s.flags&524288)!==0)c=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var g=s.alternate;if(g===null)throw Error(r(387));if(g=g.memoizedProps,g!==null){var v=s.type;Nt(s.pendingProps.value,g.value)||(e!==null?e.push(v):e=[v])}}else if(s===L.current){if(g=s.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(pi):e=[pi])}s=s.return}e!==null&&vs(t,e,a,l),t.flags|=262144}function io(e){for(e=e.firstContext;e!==null;){if(!Nt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function fn(e){dn=e,da=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ot(e){return Ld(dn,e)}function oo(e,t){return dn===null&&fn(e),Ld(e,t)}function Ld(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},da===null){if(e===null)throw Error(r(308));da=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else da=da.next=t;return a}var rv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},sv=n.unstable_scheduleCallback,cv=n.unstable_NormalPriority,Xe={$$typeof:Z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bs(){return{controller:new rv,data:new Map,refCount:0}}function Bl(e){e.refCount--,e.refCount===0&&sv(cv,function(){e.controller.abort()})}var Pl=null,Ss=0,Kn=0,Xn=null;function uv(e,t){if(Pl===null){var a=Pl=[];Ss=0,Kn=Ec(),Xn={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Ss++,t.then(qd,qd),t}function qd(){if(--Ss===0&&Pl!==null){Xn!==null&&(Xn.status="fulfilled");var e=Pl;Pl=null,Kn=0,Xn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function dv(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(s){a.push(s)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var s=0;s<a.length;s++)(0,a[s])(t)},function(s){for(l.status="rejected",l.reason=s,s=0;s<a.length;s++)(0,a[s])(void 0)}),l}var Gd=w.S;w.S=function(e,t){Em=Be(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&uv(e,t),Gd!==null&&Gd(e,t)};var mn=A(null);function xs(){var e=mn.current;return e!==null?e:Ge.pooledCache}function ro(e,t){t===null?J(mn,mn.current):J(mn,t.pool)}function Hd(){var e=xs();return e===null?null:{parent:Xe._currentValue,pool:e}}var Qn=Error(r(460)),Ts=Error(r(474)),so=Error(r(542)),co={then:function(){}};function Ud(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Bd(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(ra,ra),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Fd(e),e;default:if(typeof t.status=="string")t.then(ra,ra);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=l}},function(l){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Fd(e),e}throw hn=t,Qn}}function pn(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(hn=a,Qn):a}}var hn=null;function Pd(){if(hn===null)throw Error(r(459));var e=hn;return hn=null,e}function Fd(e){if(e===Qn||e===so)throw Error(r(483))}var Zn=null,Fl=0;function uo(e){var t=Fl;return Fl+=1,Zn===null&&(Zn=[]),Bd(Zn,e,t)}function Vl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function fo(e,t){throw t.$$typeof===S?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Vd(e){function t(R,C){if(e){var j=R.deletions;j===null?(R.deletions=[C],R.flags|=16):j.push(C)}}function a(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(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 s(R,C){return R=ca(R,C),R.index=0,R.sibling=null,R}function c(R,C,j){return R.index=j,e?(j=R.alternate,j!==null?(j=j.index,j<C?(R.flags|=67108866,C):j):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function g(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function v(R,C,j,H){return C===null||C.tag!==6?(C=us(j,R.mode,H),C.return=R,C):(C=s(C,j),C.return=R,C)}function N(R,C,j,H){var re=j.type;return re===M?G(R,C,j.props.children,H,j.key):C!==null&&(C.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Ee&&pn(re)===C.type)?(C=s(C,j.props),Vl(C,j),C.return=R,C):(C=no(j.type,j.key,j.props,null,R.mode,H),Vl(C,j),C.return=R,C)}function I(R,C,j,H){return C===null||C.tag!==4||C.stateNode.containerInfo!==j.containerInfo||C.stateNode.implementation!==j.implementation?(C=ds(j,R.mode,H),C.return=R,C):(C=s(C,j.children||[]),C.return=R,C)}function G(R,C,j,H,re){return C===null||C.tag!==7?(C=cn(j,R.mode,H,re),C.return=R,C):(C=s(C,j),C.return=R,C)}function B(R,C,j){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=us(""+C,R.mode,j),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case T:return j=no(C.type,C.key,C.props,null,R.mode,j),Vl(j,C),j.return=R,j;case E:return C=ds(C,R.mode,j),C.return=R,C;case Ee:return C=pn(C),B(R,C,j)}if(Q(C)||le(C))return C=cn(C,R.mode,j,null),C.return=R,C;if(typeof C.then=="function")return B(R,uo(C),j);if(C.$$typeof===Z)return B(R,oo(R,C),j);fo(R,C)}return null}function z(R,C,j,H){var re=C!==null?C.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return re!==null?null:v(R,C,""+j,H);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case T:return j.key===re?N(R,C,j,H):null;case E:return j.key===re?I(R,C,j,H):null;case Ee:return j=pn(j),z(R,C,j,H)}if(Q(j)||le(j))return re!==null?null:G(R,C,j,H,null);if(typeof j.then=="function")return z(R,C,uo(j),H);if(j.$$typeof===Z)return z(R,C,oo(R,j),H);fo(R,j)}return null}function q(R,C,j,H,re){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return R=R.get(j)||null,v(C,R,""+H,re);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case T:return R=R.get(H.key===null?j:H.key)||null,N(C,R,H,re);case E:return R=R.get(H.key===null?j:H.key)||null,I(C,R,H,re);case Ee:return H=pn(H),q(R,C,j,H,re)}if(Q(H)||le(H))return R=R.get(j)||null,G(C,R,H,re,null);if(typeof H.then=="function")return q(R,C,j,uo(H),re);if(H.$$typeof===Z)return q(R,C,j,oo(C,H),re);fo(C,H)}return null}function ae(R,C,j,H){for(var re=null,Me=null,oe=C,he=C=0,Te=null;oe!==null&&he<j.length;he++){oe.index>he?(Te=oe,oe=null):Te=oe.sibling;var Re=z(R,oe,j[he],H);if(Re===null){oe===null&&(oe=Te);break}e&&oe&&Re.alternate===null&&t(R,oe),C=c(Re,C,he),Me===null?re=Re:Me.sibling=Re,Me=Re,oe=Te}if(he===j.length)return a(R,oe),_e&&ua(R,he),re;if(oe===null){for(;he<j.length;he++)oe=B(R,j[he],H),oe!==null&&(C=c(oe,C,he),Me===null?re=oe:Me.sibling=oe,Me=oe);return _e&&ua(R,he),re}for(oe=l(oe);he<j.length;he++)Te=q(oe,R,he,j[he],H),Te!==null&&(e&&Te.alternate!==null&&oe.delete(Te.key===null?he:Te.key),C=c(Te,C,he),Me===null?re=Te:Me.sibling=Te,Me=Te);return e&&oe.forEach(function($a){return t(R,$a)}),_e&&ua(R,he),re}function se(R,C,j,H){if(j==null)throw Error(r(151));for(var re=null,Me=null,oe=C,he=C=0,Te=null,Re=j.next();oe!==null&&!Re.done;he++,Re=j.next()){oe.index>he?(Te=oe,oe=null):Te=oe.sibling;var $a=z(R,oe,Re.value,H);if($a===null){oe===null&&(oe=Te);break}e&&oe&&$a.alternate===null&&t(R,oe),C=c($a,C,he),Me===null?re=$a:Me.sibling=$a,Me=$a,oe=Te}if(Re.done)return a(R,oe),_e&&ua(R,he),re;if(oe===null){for(;!Re.done;he++,Re=j.next())Re=B(R,Re.value,H),Re!==null&&(C=c(Re,C,he),Me===null?re=Re:Me.sibling=Re,Me=Re);return _e&&ua(R,he),re}for(oe=l(oe);!Re.done;he++,Re=j.next())Re=q(oe,R,he,Re.value,H),Re!==null&&(e&&Re.alternate!==null&&oe.delete(Re.key===null?he:Re.key),C=c(Re,C,he),Me===null?re=Re:Me.sibling=Re,Me=Re);return e&&oe.forEach(function(Tb){return t(R,Tb)}),_e&&ua(R,he),re}function qe(R,C,j,H){if(typeof j=="object"&&j!==null&&j.type===M&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case T:e:{for(var re=j.key;C!==null;){if(C.key===re){if(re=j.type,re===M){if(C.tag===7){a(R,C.sibling),H=s(C,j.props.children),H.return=R,R=H;break e}}else if(C.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Ee&&pn(re)===C.type){a(R,C.sibling),H=s(C,j.props),Vl(H,j),H.return=R,R=H;break e}a(R,C);break}else t(R,C);C=C.sibling}j.type===M?(H=cn(j.props.children,R.mode,H,j.key),H.return=R,R=H):(H=no(j.type,j.key,j.props,null,R.mode,H),Vl(H,j),H.return=R,R=H)}return g(R);case E:e:{for(re=j.key;C!==null;){if(C.key===re)if(C.tag===4&&C.stateNode.containerInfo===j.containerInfo&&C.stateNode.implementation===j.implementation){a(R,C.sibling),H=s(C,j.children||[]),H.return=R,R=H;break e}else{a(R,C);break}else t(R,C);C=C.sibling}H=ds(j,R.mode,H),H.return=R,R=H}return g(R);case Ee:return j=pn(j),qe(R,C,j,H)}if(Q(j))return ae(R,C,j,H);if(le(j)){if(re=le(j),typeof re!="function")throw Error(r(150));return j=re.call(j),se(R,C,j,H)}if(typeof j.then=="function")return qe(R,C,uo(j),H);if(j.$$typeof===Z)return qe(R,C,oo(R,j),H);fo(R,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,C!==null&&C.tag===6?(a(R,C.sibling),H=s(C,j),H.return=R,R=H):(a(R,C),H=us(j,R.mode,H),H.return=R,R=H),g(R)):a(R,C)}return function(R,C,j,H){try{Fl=0;var re=qe(R,C,j,H);return Zn=null,re}catch(oe){if(oe===Qn||oe===so)throw oe;var Me=_t(29,oe,null,R.mode);return Me.lanes=H,Me.return=R,Me}}}var gn=Vd(!0),Yd=Vd(!1),Da=!1;function Es(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ns(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 ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(je&2)!==0){var s=l.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),l.pending=t,t=ao(e),Md(e,null,a),t}return to(e,l,t,a),ao(e)}function Yl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Lu(e,a)}}function _s(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var s=null,c=null;if(a=a.firstBaseUpdate,a!==null){do{var g={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};c===null?s=c=g:c=c.next=g,a=a.next}while(a!==null);c===null?s=c=t:c=c.next=t}else s=c=t;a={baseState:l.baseState,firstBaseUpdate:s,lastBaseUpdate:c,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var ws=!1;function Kl(){if(ws){var e=Xn;if(e!==null)throw e}}function Xl(e,t,a,l){ws=!1;var s=e.updateQueue;Da=!1;var c=s.firstBaseUpdate,g=s.lastBaseUpdate,v=s.shared.pending;if(v!==null){s.shared.pending=null;var N=v,I=N.next;N.next=null,g===null?c=I:g.next=I,g=N;var G=e.alternate;G!==null&&(G=G.updateQueue,v=G.lastBaseUpdate,v!==g&&(v===null?G.firstBaseUpdate=I:v.next=I,G.lastBaseUpdate=N))}if(c!==null){var B=s.baseState;g=0,G=I=N=null,v=c;do{var z=v.lane&-536870913,q=z!==v.lane;if(q?(xe&z)===z:(l&z)===z){z!==0&&z===Kn&&(ws=!0),G!==null&&(G=G.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ae=e,se=v;z=t;var qe=a;switch(se.tag){case 1:if(ae=se.payload,typeof ae=="function"){B=ae.call(qe,B,z);break e}B=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=se.payload,z=typeof ae=="function"?ae.call(qe,B,z):ae,z==null)break e;B=b({},B,z);break e;case 2:Da=!0}}z=v.callback,z!==null&&(e.flags|=64,q&&(e.flags|=8192),q=s.callbacks,q===null?s.callbacks=[z]:q.push(z))}else q={lane:z,tag:v.tag,payload:v.payload,callback:v.callback,next:null},G===null?(I=G=q,N=B):G=G.next=q,g|=z;if(v=v.next,v===null){if(v=s.shared.pending,v===null)break;q=v,v=q.next,q.next=null,s.lastBaseUpdate=q,s.shared.pending=null}}while(!0);G===null&&(N=B),s.baseState=N,s.firstBaseUpdate=I,s.lastBaseUpdate=G,c===null&&(s.shared.lanes=0),Ba|=g,e.lanes=g,e.memoizedState=B}}function Kd(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Xd(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Kd(a[e],t)}var Jn=A(null),mo=A(0);function Qd(e,t){e=xa,J(mo,e),J(Jn,t),xa=e|t.baseLanes}function Cs(){J(mo,xa),J(Jn,Jn.current)}function As(){xa=mo.current,U(Jn),U(mo)}var wt=A(null),Gt=null;function qa(e){var t=e.alternate;J(Ye,Ye.current&1),J(wt,e),Gt===null&&(t===null||Jn.current!==null||t.memoizedState!==null)&&(Gt=e)}function Ms(e){J(Ye,Ye.current),J(wt,e),Gt===null&&(Gt=e)}function Zd(e){e.tag===22?(J(Ye,Ye.current),J(wt,e),Gt===null&&(Gt=e)):Ga()}function Ga(){J(Ye,Ye.current),J(wt,wt.current)}function Ct(e){U(wt),Gt===e&&(Gt=null),U(Ye)}var Ye=A(0);function po(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Dc(a)||kc(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 ma=0,pe=null,ke=null,Qe=null,ho=!1,$n=!1,yn=!1,go=0,Ql=0,Wn=null,fv=0;function Fe(){throw Error(r(321))}function Rs(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Nt(e[a],t[a]))return!1;return!0}function Os(e,t,a,l,s,c){return ma=c,pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,w.H=e===null||e.memoizedState===null?zf:Ys,yn=!1,c=a(l,s),yn=!1,$n&&(c=$d(t,a,l,s)),Jd(e),c}function Jd(e){w.H=$l;var t=ke!==null&&ke.next!==null;if(ma=0,Qe=ke=pe=null,ho=!1,Ql=0,Wn=null,t)throw Error(r(300));e===null||Ze||(e=e.dependencies,e!==null&&io(e)&&(Ze=!0))}function $d(e,t,a,l){pe=e;var s=0;do{if($n&&(Wn=null),Ql=0,$n=!1,25<=s)throw Error(r(301));if(s+=1,Qe=ke=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}w.H=Df,c=t(a,l)}while($n);return c}function mv(){var e=w.H,t=e.useState()[0];return t=typeof t.then=="function"?Zl(t):t,e=e.useState()[0],(ke!==null?ke.memoizedState:null)!==e&&(pe.flags|=1024),t}function js(){var e=go!==0;return go=0,e}function Is(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function zs(e){if(ho){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ho=!1}ma=0,Qe=ke=pe=null,$n=!1,Ql=go=0,Wn=null}function ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qe===null?pe.memoizedState=Qe=e:Qe=Qe.next=e,Qe}function Ke(){if(ke===null){var e=pe.alternate;e=e!==null?e.memoizedState:null}else e=ke.next;var t=Qe===null?pe.memoizedState:Qe.next;if(t!==null)Qe=t,ke=e;else{if(e===null)throw pe.alternate===null?Error(r(467)):Error(r(310));ke=e,e={memoizedState:ke.memoizedState,baseState:ke.baseState,baseQueue:ke.baseQueue,queue:ke.queue,next:null},Qe===null?pe.memoizedState=Qe=e:Qe=Qe.next=e}return Qe}function yo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Zl(e){var t=Ql;return Ql+=1,Wn===null&&(Wn=[]),e=Bd(Wn,e,t),t=pe,(Qe===null?t.memoizedState:Qe.next)===null&&(t=t.alternate,w.H=t===null||t.memoizedState===null?zf:Ys),e}function vo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Zl(e);if(e.$$typeof===Z)return ot(e)}throw Error(r(438,String(e)))}function Ds(e){var t=null,a=pe.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=pe.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=yo(),pe.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=K;return t.index++,a}function pa(e,t){return typeof t=="function"?t(e):t}function bo(e){var t=Ke();return ks(t,ke,e)}function ks(e,t,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var s=e.baseQueue,c=l.pending;if(c!==null){if(s!==null){var g=s.next;s.next=c.next,c.next=g}t.baseQueue=s=c,l.pending=null}if(c=e.baseState,s===null)e.memoizedState=c;else{t=s.next;var v=g=null,N=null,I=t,G=!1;do{var B=I.lane&-536870913;if(B!==I.lane?(xe&B)===B:(ma&B)===B){var z=I.revertLane;if(z===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null}),B===Kn&&(G=!0);else if((ma&z)===z){I=I.next,z===Kn&&(G=!0);continue}else B={lane:0,revertLane:I.revertLane,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},N===null?(v=N=B,g=c):N=N.next=B,pe.lanes|=z,Ba|=z;B=I.action,yn&&a(c,B),c=I.hasEagerState?I.eagerState:a(c,B)}else z={lane:B,revertLane:I.revertLane,gesture:I.gesture,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},N===null?(v=N=z,g=c):N=N.next=z,pe.lanes|=B,Ba|=B;I=I.next}while(I!==null&&I!==t);if(N===null?g=c:N.next=v,!Nt(c,e.memoizedState)&&(Ze=!0,G&&(a=Xn,a!==null)))throw a;e.memoizedState=c,e.baseState=g,e.baseQueue=N,l.lastRenderedState=c}return s===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ls(e){var t=Ke(),a=t.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,s=a.pending,c=t.memoizedState;if(s!==null){a.pending=null;var g=s=s.next;do c=e(c,g.action),g=g.next;while(g!==s);Nt(c,t.memoizedState)||(Ze=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),a.lastRenderedState=c}return[c,l]}function Wd(e,t,a){var l=pe,s=Ke(),c=_e;if(c){if(a===void 0)throw Error(r(407));a=a()}else a=t();var g=!Nt((ke||s).memoizedState,a);if(g&&(s.memoizedState=a,Ze=!0),s=s.queue,Hs(af.bind(null,l,s,e),[e]),s.getSnapshot!==t||g||Qe!==null&&Qe.memoizedState.tag&1){if(l.flags|=2048,el(9,{destroy:void 0},tf.bind(null,l,s,a,t),null),Ge===null)throw Error(r(349));c||(ma&127)!==0||ef(l,t,a)}return a}function ef(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=pe.updateQueue,t===null?(t=yo(),pe.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function tf(e,t,a,l){t.value=a,t.getSnapshot=l,nf(t)&&lf(e)}function af(e,t,a){return a(function(){nf(t)&&lf(e)})}function nf(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Nt(e,a)}catch{return!0}}function lf(e){var t=sn(e,2);t!==null&&bt(t,e,2)}function qs(e){var t=ft();if(typeof e=="function"){var a=e;if(e=a(),yn){Aa(!0);try{a()}finally{Aa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:e},t}function of(e,t,a,l){return e.baseState=a,ks(e,ke,typeof l=="function"?l:pa)}function pv(e,t,a,l,s){if(To(e))throw Error(r(485));if(e=t.action,e!==null){var c={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){c.listeners.push(g)}};w.T!==null?a(!0):c.isTransition=!1,l(c),a=t.pending,a===null?(c.next=t.pending=c,rf(t,c)):(c.next=a.next,t.pending=a.next=c)}}function rf(e,t){var a=t.action,l=t.payload,s=e.state;if(t.isTransition){var c=w.T,g={};w.T=g;try{var v=a(s,l),N=w.S;N!==null&&N(g,v),sf(e,t,v)}catch(I){Gs(e,t,I)}finally{c!==null&&g.types!==null&&(c.types=g.types),w.T=c}}else try{c=a(s,l),sf(e,t,c)}catch(I){Gs(e,t,I)}}function sf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){cf(e,t,l)},function(l){return Gs(e,t,l)}):cf(e,t,a)}function cf(e,t,a){t.status="fulfilled",t.value=a,uf(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,rf(e,a)))}function Gs(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,uf(t),t=t.next;while(t!==l)}e.action=null}function uf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function df(e,t){return t}function ff(e,t){if(_e){var a=Ge.formState;if(a!==null){e:{var l=pe;if(_e){if(He){t:{for(var s=He,c=qt;s.nodeType!==8;){if(!c){s=null;break t}if(s=Ht(s.nextSibling),s===null){s=null;break t}}c=s.data,s=c==="F!"||c==="F"?s:null}if(s){He=Ht(s.nextSibling),l=s.data==="F!";break e}}Ia(l)}l=!1}l&&(t=a[0])}}return a=ft(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:df,lastRenderedState:t},a.queue=l,a=Of.bind(null,pe,l),l.dispatch=a,l=qs(!1),c=Vs.bind(null,pe,!1,l.queue),l=ft(),s={state:t,dispatch:null,action:e,pending:null},l.queue=s,a=pv.bind(null,pe,s,c,a),s.dispatch=a,l.memoizedState=e,[t,a,!1]}function mf(e){var t=Ke();return pf(t,ke,e)}function pf(e,t,a){if(t=ks(e,t,df)[0],e=bo(pa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Zl(t)}catch(g){throw g===Qn?so:g}else l=t;t=Ke();var s=t.queue,c=s.dispatch;return a!==t.memoizedState&&(pe.flags|=2048,el(9,{destroy:void 0},hv.bind(null,s,a),null)),[l,c,e]}function hv(e,t){e.action=t}function hf(e){var t=Ke(),a=ke;if(a!==null)return pf(t,a,e);Ke(),t=t.memoizedState,a=Ke();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function el(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=pe.updateQueue,t===null&&(t=yo(),pe.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function gf(){return Ke().memoizedState}function So(e,t,a,l){var s=ft();pe.flags|=e,s.memoizedState=el(1|t,{destroy:void 0},a,l===void 0?null:l)}function xo(e,t,a,l){var s=Ke();l=l===void 0?null:l;var c=s.memoizedState.inst;ke!==null&&l!==null&&Rs(l,ke.memoizedState.deps)?s.memoizedState=el(t,c,a,l):(pe.flags|=e,s.memoizedState=el(1|t,c,a,l))}function yf(e,t){So(8390656,8,e,t)}function Hs(e,t){xo(2048,8,e,t)}function gv(e){pe.flags|=4;var t=pe.updateQueue;if(t===null)t=yo(),pe.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function vf(e){var t=Ke().memoizedState;return gv({ref:t,nextImpl:e}),function(){if((je&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function bf(e,t){return xo(4,2,e,t)}function Sf(e,t){return xo(4,4,e,t)}function xf(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 Tf(e,t,a){a=a!=null?a.concat([e]):null,xo(4,4,xf.bind(null,t,e),a)}function Us(){}function Ef(e,t){var a=Ke();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&Rs(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function Nf(e,t){var a=Ke();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&Rs(t,l[1]))return l[0];if(l=e(),yn){Aa(!0);try{e()}finally{Aa(!1)}}return a.memoizedState=[l,t],l}function Bs(e,t,a){return a===void 0||(ma&1073741824)!==0&&(xe&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=_m(),pe.lanes|=e,Ba|=e,a)}function _f(e,t,a,l){return Nt(a,t)?a:Jn.current!==null?(e=Bs(e,a,l),Nt(e,t)||(Ze=!0),e):(ma&42)===0||(ma&1073741824)!==0&&(xe&261930)===0?(Ze=!0,e.memoizedState=a):(e=_m(),pe.lanes|=e,Ba|=e,t)}function wf(e,t,a,l,s){var c=X.p;X.p=c!==0&&8>c?c:8;var g=w.T,v={};w.T=v,Vs(e,!1,t,a);try{var N=s(),I=w.S;if(I!==null&&I(v,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var G=dv(N,l);Jl(e,t,G,Rt(e))}else Jl(e,t,l,Rt(e))}catch(B){Jl(e,t,{then:function(){},status:"rejected",reason:B},Rt())}finally{X.p=c,g!==null&&v.types!==null&&(g.types=v.types),w.T=g}}function yv(){}function Ps(e,t,a,l){if(e.tag!==5)throw Error(r(476));var s=Cf(e).queue;wf(e,s,t,ie,a===null?yv:function(){return Af(e),a(l)})}function Cf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:ie},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Af(e){var t=Cf(e);t.next===null&&(t=e.alternate.memoizedState),Jl(e,t.next.queue,{},Rt())}function Fs(){return ot(pi)}function Mf(){return Ke().memoizedState}function Rf(){return Ke().memoizedState}function vv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Rt();e=ka(a);var l=La(t,e,a);l!==null&&(bt(l,t,a),Yl(l,t,a)),t={cache:bs()},e.payload=t;return}t=t.return}}function bv(e,t,a){var l=Rt();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(e)?jf(t,a):(a=ss(e,t,a,l),a!==null&&(bt(a,e,l),If(a,t,l)))}function Of(e,t,a){var l=Rt();Jl(e,t,a,l)}function Jl(e,t,a,l){var s={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(e))jf(t,s);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var g=t.lastRenderedState,v=c(g,a);if(s.hasEagerState=!0,s.eagerState=v,Nt(v,g))return to(e,t,s,0),Ge===null&&eo(),!1}catch{}if(a=ss(e,t,s,l),a!==null)return bt(a,e,l),If(a,t,l),!0}return!1}function Vs(e,t,a,l){if(l={lane:2,revertLane:Ec(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},To(e)){if(t)throw Error(r(479))}else t=ss(e,a,l,2),t!==null&&bt(t,e,2)}function To(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function jf(e,t){$n=ho=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function If(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Lu(e,a)}}var $l={readContext:ot,use:vo,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};$l.useEffectEvent=Fe;var zf={readContext:ot,use:vo,useCallback:function(e,t){return ft().memoizedState=[e,t===void 0?null:t],e},useContext:ot,useEffect:yf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,So(4194308,4,xf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return So(4194308,4,e,t)},useInsertionEffect:function(e,t){So(4,2,e,t)},useMemo:function(e,t){var a=ft();t=t===void 0?null:t;var l=e();if(yn){Aa(!0);try{e()}finally{Aa(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=ft();if(a!==void 0){var s=a(t);if(yn){Aa(!0);try{a(t)}finally{Aa(!1)}}}else s=t;return l.memoizedState=l.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},l.queue=e,e=e.dispatch=bv.bind(null,pe,e),[l.memoizedState,e]},useRef:function(e){var t=ft();return e={current:e},t.memoizedState=e},useState:function(e){e=qs(e);var t=e.queue,a=Of.bind(null,pe,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Us,useDeferredValue:function(e,t){var a=ft();return Bs(a,e,t)},useTransition:function(){var e=qs(!1);return e=wf.bind(null,pe,e.queue,!0,!1),ft().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=pe,s=ft();if(_e){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),Ge===null)throw Error(r(349));(xe&127)!==0||ef(l,t,a)}s.memoizedState=a;var c={value:a,getSnapshot:t};return s.queue=c,yf(af.bind(null,l,c,e),[e]),l.flags|=2048,el(9,{destroy:void 0},tf.bind(null,l,c,a,t),null),a},useId:function(){var e=ft(),t=Ge.identifierPrefix;if(_e){var a=Jt,l=Zt;a=(l&~(1<<32-Et(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=go++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=fv++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Fs,useFormState:ff,useActionState:ff,useOptimistic:function(e){var t=ft();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Vs.bind(null,pe,!0,a),a.dispatch=t,[e,t]},useMemoCache:Ds,useCacheRefresh:function(){return ft().memoizedState=vv.bind(null,pe)},useEffectEvent:function(e){var t=ft(),a={impl:e};return t.memoizedState=a,function(){if((je&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Ys={readContext:ot,use:vo,useCallback:Ef,useContext:ot,useEffect:Hs,useImperativeHandle:Tf,useInsertionEffect:bf,useLayoutEffect:Sf,useMemo:Nf,useReducer:bo,useRef:gf,useState:function(){return bo(pa)},useDebugValue:Us,useDeferredValue:function(e,t){var a=Ke();return _f(a,ke.memoizedState,e,t)},useTransition:function(){var e=bo(pa)[0],t=Ke().memoizedState;return[typeof e=="boolean"?e:Zl(e),t]},useSyncExternalStore:Wd,useId:Mf,useHostTransitionStatus:Fs,useFormState:mf,useActionState:mf,useOptimistic:function(e,t){var a=Ke();return of(a,ke,e,t)},useMemoCache:Ds,useCacheRefresh:Rf};Ys.useEffectEvent=vf;var Df={readContext:ot,use:vo,useCallback:Ef,useContext:ot,useEffect:Hs,useImperativeHandle:Tf,useInsertionEffect:bf,useLayoutEffect:Sf,useMemo:Nf,useReducer:Ls,useRef:gf,useState:function(){return Ls(pa)},useDebugValue:Us,useDeferredValue:function(e,t){var a=Ke();return ke===null?Bs(a,e,t):_f(a,ke.memoizedState,e,t)},useTransition:function(){var e=Ls(pa)[0],t=Ke().memoizedState;return[typeof e=="boolean"?e:Zl(e),t]},useSyncExternalStore:Wd,useId:Mf,useHostTransitionStatus:Fs,useFormState:hf,useActionState:hf,useOptimistic:function(e,t){var a=Ke();return ke!==null?of(a,ke,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Ds,useCacheRefresh:Rf};Df.useEffectEvent=vf;function Ks(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Xs={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=Rt(),s=ka(l);s.payload=t,a!=null&&(s.callback=a),t=La(e,s,l),t!==null&&(bt(t,e,l),Yl(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=Rt(),s=ka(l);s.tag=1,s.payload=t,a!=null&&(s.callback=a),t=La(e,s,l),t!==null&&(bt(t,e,l),Yl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Rt(),l=ka(a);l.tag=2,t!=null&&(l.callback=t),t=La(e,l,a),t!==null&&(bt(t,e,a),Yl(t,e,a))}};function kf(e,t,a,l,s,c,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,c,g):t.prototype&&t.prototype.isPureReactComponent?!ql(a,l)||!ql(s,c):!0}function Lf(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&Xs.enqueueReplaceState(t,t.state,null)}function vn(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var s in e)a[s]===void 0&&(a[s]=e[s])}return a}function qf(e){Wi(e)}function Gf(e){console.error(e)}function Hf(e){Wi(e)}function Eo(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Uf(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Qs(e,t,a){return a=ka(a),a.tag=3,a.payload={element:null},a.callback=function(){Eo(e,t)},a}function Bf(e){return e=ka(e),e.tag=3,e}function Pf(e,t,a,l){var s=a.type.getDerivedStateFromError;if(typeof s=="function"){var c=l.value;e.payload=function(){return s(c)},e.callback=function(){Uf(t,a,l)}}var g=a.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){Uf(t,a,l),typeof s!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var v=l.stack;this.componentDidCatch(l.value,{componentStack:v!==null?v:""})})}function Sv(e,t,a,l,s){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&Yn(t,a,s,!0),a=wt.current,a!==null){switch(a.tag){case 31:case 13:return Gt===null?Do():a.alternate===null&&Ve===0&&(Ve=3),a.flags&=-257,a.flags|=65536,a.lanes=s,l===co?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),Sc(e,l,s)),!1;case 22:return a.flags|=65536,l===co?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),Sc(e,l,s)),!1}throw Error(r(435,a.tag))}return Sc(e,l,s),Do(),!1}if(_e)return t=wt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,l!==ps&&(e=Error(r(422),{cause:l}),Ul(Dt(e,a)))):(l!==ps&&(t=Error(r(423),{cause:l}),Ul(Dt(t,a))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,l=Dt(l,a),s=Qs(e.stateNode,l,s),_s(e,s),Ve!==4&&(Ve=2)),!1;var c=Error(r(520),{cause:l});if(c=Dt(c,a),oi===null?oi=[c]:oi.push(c),Ve!==4&&(Ve=2),t===null)return!0;l=Dt(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=s&-s,a.lanes|=e,e=Qs(a.stateNode,l,e),_s(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"&&(Pa===null||!Pa.has(c))))return a.flags|=65536,s&=-s,a.lanes|=s,s=Bf(s),Pf(s,e,a,l),_s(a,s),!1}a=a.return}while(a!==null);return!1}var Zs=Error(r(461)),Ze=!1;function rt(e,t,a,l){t.child=e===null?Yd(t,null,a,l):gn(t,e.child,a,l)}function Ff(e,t,a,l,s){a=a.render;var c=t.ref;if("ref"in l){var g={};for(var v in l)v!=="ref"&&(g[v]=l[v])}else g=l;return fn(t),l=Os(e,t,a,g,c,s),v=js(),e!==null&&!Ze?(Is(e,t,s),ha(e,t,s)):(_e&&v&&fs(t),t.flags|=1,rt(e,t,l,s),t.child)}function Vf(e,t,a,l,s){if(e===null){var c=a.type;return typeof c=="function"&&!cs(c)&&c.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=c,Yf(e,t,c,l,s)):(e=no(a.type,null,l,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!lc(e,s)){var g=c.memoizedProps;if(a=a.compare,a=a!==null?a:ql,a(g,l)&&e.ref===t.ref)return ha(e,t,s)}return t.flags|=1,e=ca(c,l),e.ref=t.ref,e.return=t,t.child=e}function Yf(e,t,a,l,s){if(e!==null){var c=e.memoizedProps;if(ql(c,l)&&e.ref===t.ref)if(Ze=!1,t.pendingProps=l=c,lc(e,s))(e.flags&131072)!==0&&(Ze=!0);else return t.lanes=e.lanes,ha(e,t,s)}return Js(e,t,a,l,s)}function Kf(e,t,a,l){var s=l.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|a:a,e!==null){for(l=t.child=e.child,s=0;l!==null;)s=s|l.lanes|l.childLanes,l=l.sibling;l=s&~c}else l=0,t.child=null;return Xf(e,t,c,a,l)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ro(t,c!==null?c.cachePool:null),c!==null?Qd(t,c):Cs(),Zd(t);else return l=t.lanes=536870912,Xf(e,t,c!==null?c.baseLanes|a:a,a,l)}else c!==null?(ro(t,c.cachePool),Qd(t,c),Ga(),t.memoizedState=null):(e!==null&&ro(t,null),Cs(),Ga());return rt(e,t,s,a),t.child}function Wl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Xf(e,t,a,l,s){var c=xs();return c=c===null?null:{parent:Xe._currentValue,pool:c},t.memoizedState={baseLanes:a,cachePool:c},e!==null&&ro(t,null),Cs(),Zd(t),e!==null&&Yn(e,t,l,!0),t.childLanes=s,null}function No(e,t){return t=wo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Qf(e,t,a){return gn(t,e.child,null,a),e=No(t,t.pendingProps),e.flags|=2,Ct(t),t.memoizedState=null,e}function xv(e,t,a){var l=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(_e){if(l.mode==="hidden")return e=No(t,l),t.lanes=536870912,Wl(null,e);if(Ms(t),(e=He)?(e=rp(e,qt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Oa!==null?{id:Zt,overflow:Jt}:null,retryLane:536870912,hydrationErrors:null},a=Od(e),a.return=t,t.child=a,it=t,He=null)):e=null,e===null)throw Ia(t);return t.lanes=536870912,null}return No(t,l)}var c=e.memoizedState;if(c!==null){var g=c.dehydrated;if(Ms(t),s)if(t.flags&256)t.flags&=-257,t=Qf(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Ze||Yn(e,t,a,!1),s=(a&e.childLanes)!==0,Ze||s){if(l=Ge,l!==null&&(g=qu(l,a),g!==0&&g!==c.retryLane))throw c.retryLane=g,sn(e,g),bt(l,e,g),Zs;Do(),t=Qf(e,t,a)}else e=c.treeContext,He=Ht(g.nextSibling),it=t,_e=!0,ja=null,qt=!1,e!==null&&zd(t,e),t=No(t,l),t.flags|=4096;return t}return e=ca(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function _o(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(r(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Js(e,t,a,l,s){return fn(t),a=Os(e,t,a,l,void 0,s),l=js(),e!==null&&!Ze?(Is(e,t,s),ha(e,t,s)):(_e&&l&&fs(t),t.flags|=1,rt(e,t,a,s),t.child)}function Zf(e,t,a,l,s,c){return fn(t),t.updateQueue=null,a=$d(t,l,a,s),Jd(e),l=js(),e!==null&&!Ze?(Is(e,t,c),ha(e,t,c)):(_e&&l&&fs(t),t.flags|=1,rt(e,t,a,c),t.child)}function Jf(e,t,a,l,s){if(fn(t),t.stateNode===null){var c=Bn,g=a.contextType;typeof g=="object"&&g!==null&&(c=ot(g)),c=new a(l,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Xs,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=l,c.state=t.memoizedState,c.refs={},Es(t),g=a.contextType,c.context=typeof g=="object"&&g!==null?ot(g):Bn,c.state=t.memoizedState,g=a.getDerivedStateFromProps,typeof g=="function"&&(Ks(t,a,g,l),c.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(g=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),g!==c.state&&Xs.enqueueReplaceState(c,c.state,null),Xl(t,l,c,s),Kl(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){c=t.stateNode;var v=t.memoizedProps,N=vn(a,v);c.props=N;var I=c.context,G=a.contextType;g=Bn,typeof G=="object"&&G!==null&&(g=ot(G));var B=a.getDerivedStateFromProps;G=typeof B=="function"||typeof c.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,G||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(v||I!==g)&&Lf(t,c,l,g),Da=!1;var z=t.memoizedState;c.state=z,Xl(t,l,c,s),Kl(),I=t.memoizedState,v||z!==I||Da?(typeof B=="function"&&(Ks(t,a,B,l),I=t.memoizedState),(N=Da||kf(t,a,N,l,z,I,g))?(G||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=l,t.memoizedState=I),c.props=l,c.state=I,c.context=g,l=N):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{c=t.stateNode,Ns(e,t),g=t.memoizedProps,G=vn(a,g),c.props=G,B=t.pendingProps,z=c.context,I=a.contextType,N=Bn,typeof I=="object"&&I!==null&&(N=ot(I)),v=a.getDerivedStateFromProps,(I=typeof v=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(g!==B||z!==N)&&Lf(t,c,l,N),Da=!1,z=t.memoizedState,c.state=z,Xl(t,l,c,s),Kl();var q=t.memoizedState;g!==B||z!==q||Da||e!==null&&e.dependencies!==null&&io(e.dependencies)?(typeof v=="function"&&(Ks(t,a,v,l),q=t.memoizedState),(G=Da||kf(t,a,G,l,z,q,N)||e!==null&&e.dependencies!==null&&io(e.dependencies))?(I||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(l,q,N),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(l,q,N)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=q),c.props=l,c.state=q,c.context=N,l=G):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),l=!1)}return c=l,_o(e,t),l=(t.flags&128)!==0,c||l?(c=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&l?(t.child=gn(t,e.child,null,s),t.child=gn(t,null,a,s)):rt(e,t,a,s),t.memoizedState=c.state,e=t.child):e=ha(e,t,s),e}function $f(e,t,a,l){return un(),t.flags|=256,rt(e,t,a,l),t.child}var $s={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ws(e){return{baseLanes:e,cachePool:Hd()}}function ec(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Mt),e}function Wf(e,t,a){var l=t.pendingProps,s=!1,c=(t.flags&128)!==0,g;if((g=c)||(g=e!==null&&e.memoizedState===null?!1:(Ye.current&2)!==0),g&&(s=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(_e){if(s?qa(t):Ga(),(e=He)?(e=rp(e,qt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Oa!==null?{id:Zt,overflow:Jt}:null,retryLane:536870912,hydrationErrors:null},a=Od(e),a.return=t,t.child=a,it=t,He=null)):e=null,e===null)throw Ia(t);return kc(e)?t.lanes=32:t.lanes=536870912,null}var v=l.children;return l=l.fallback,s?(Ga(),s=t.mode,v=wo({mode:"hidden",children:v},s),l=cn(l,s,a,null),v.return=t,l.return=t,v.sibling=l,t.child=v,l=t.child,l.memoizedState=Ws(a),l.childLanes=ec(e,g,a),t.memoizedState=$s,Wl(null,l)):(qa(t),tc(t,v))}var N=e.memoizedState;if(N!==null&&(v=N.dehydrated,v!==null)){if(c)t.flags&256?(qa(t),t.flags&=-257,t=ac(e,t,a)):t.memoizedState!==null?(Ga(),t.child=e.child,t.flags|=128,t=null):(Ga(),v=l.fallback,s=t.mode,l=wo({mode:"visible",children:l.children},s),v=cn(v,s,a,null),v.flags|=2,l.return=t,v.return=t,l.sibling=v,t.child=l,gn(t,e.child,null,a),l=t.child,l.memoizedState=Ws(a),l.childLanes=ec(e,g,a),t.memoizedState=$s,t=Wl(null,l));else if(qa(t),kc(v)){if(g=v.nextSibling&&v.nextSibling.dataset,g)var I=g.dgst;g=I,l=Error(r(419)),l.stack="",l.digest=g,Ul({value:l,source:null,stack:null}),t=ac(e,t,a)}else if(Ze||Yn(e,t,a,!1),g=(a&e.childLanes)!==0,Ze||g){if(g=Ge,g!==null&&(l=qu(g,a),l!==0&&l!==N.retryLane))throw N.retryLane=l,sn(e,l),bt(g,e,l),Zs;Dc(v)||Do(),t=ac(e,t,a)}else Dc(v)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,He=Ht(v.nextSibling),it=t,_e=!0,ja=null,qt=!1,e!==null&&zd(t,e),t=tc(t,l.children),t.flags|=4096);return t}return s?(Ga(),v=l.fallback,s=t.mode,N=e.child,I=N.sibling,l=ca(N,{mode:"hidden",children:l.children}),l.subtreeFlags=N.subtreeFlags&65011712,I!==null?v=ca(I,v):(v=cn(v,s,a,null),v.flags|=2),v.return=t,l.return=t,l.sibling=v,t.child=l,Wl(null,l),l=t.child,v=e.child.memoizedState,v===null?v=Ws(a):(s=v.cachePool,s!==null?(N=Xe._currentValue,s=s.parent!==N?{parent:N,pool:N}:s):s=Hd(),v={baseLanes:v.baseLanes|a,cachePool:s}),l.memoizedState=v,l.childLanes=ec(e,g,a),t.memoizedState=$s,Wl(e.child,l)):(qa(t),a=e.child,e=a.sibling,a=ca(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=a,t.memoizedState=null,a)}function tc(e,t){return t=wo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function wo(e,t){return e=_t(22,e,null,t),e.lanes=0,e}function ac(e,t,a){return gn(t,e.child,null,a),e=tc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function em(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ys(e.return,t,a)}function nc(e,t,a,l,s,c){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:s,treeForkCount:c}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=a,g.tailMode=s,g.treeForkCount=c)}function tm(e,t,a){var l=t.pendingProps,s=l.revealOrder,c=l.tail;l=l.children;var g=Ye.current,v=(g&2)!==0;if(v?(g=g&1|2,t.flags|=128):g&=1,J(Ye,g),rt(e,t,l,a),l=_e?Hl:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&em(e,a,t);else if(e.tag===19)em(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(s){case"forwards":for(a=t.child,s=null;a!==null;)e=a.alternate,e!==null&&po(e)===null&&(s=a),a=a.sibling;a=s,a===null?(s=t.child,t.child=null):(s=a.sibling,a.sibling=null),nc(t,!1,s,a,c,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&po(e)===null){t.child=s;break}e=s.sibling,s.sibling=a,a=s,s=e}nc(t,!0,a,null,c,l);break;case"together":nc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function ha(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ba|=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(r(153));if(t.child!==null){for(e=t.child,a=ca(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=ca(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function lc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&io(e)))}function Tv(e,t,a){switch(t.tag){case 3:ue(t,t.stateNode.containerInfo),za(t,Xe,e.memoizedState.cache),un();break;case 27:case 5:nt(t);break;case 4:ue(t,t.stateNode.containerInfo);break;case 10:za(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ms(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(qa(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Wf(e,t,a):(qa(t),e=ha(e,t,a),e!==null?e.sibling:null);qa(t);break;case 19:var s=(e.flags&128)!==0;if(l=(a&t.childLanes)!==0,l||(Yn(e,t,a,!1),l=(a&t.childLanes)!==0),s){if(l)return tm(e,t,a);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),J(Ye,Ye.current),l)break;return null;case 22:return t.lanes=0,Kf(e,t,a,t.pendingProps);case 24:za(t,Xe,e.memoizedState.cache)}return ha(e,t,a)}function am(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ze=!0;else{if(!lc(e,a)&&(t.flags&128)===0)return Ze=!1,Tv(e,t,a);Ze=(e.flags&131072)!==0}else Ze=!1,_e&&(t.flags&1048576)!==0&&Id(t,Hl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=pn(t.elementType),t.type=e,typeof e=="function")cs(e)?(l=vn(e,l),t.tag=1,t=Jf(null,t,e,l,a)):(t.tag=0,t=Js(null,t,e,l,a));else{if(e!=null){var s=e.$$typeof;if(s===k){t.tag=11,t=Ff(null,t,e,l,a);break e}else if(s===ee){t.tag=14,t=Vf(null,t,e,l,a);break e}}throw t=we(e)||e,Error(r(306,t,""))}}return t;case 0:return Js(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,s=vn(l,t.pendingProps),Jf(e,t,l,s,a);case 3:e:{if(ue(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var c=t.memoizedState;s=c.element,Ns(e,t),Xl(t,l,null,a);var g=t.memoizedState;if(l=g.cache,za(t,Xe,l),l!==c.cache&&vs(t,[Xe],a,!0),Kl(),l=g.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=$f(e,t,l,a);break e}else if(l!==s){s=Dt(Error(r(424)),t),Ul(s),t=$f(e,t,l,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,He=Ht(e.firstChild),it=t,_e=!0,ja=null,qt=!0,a=Yd(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(un(),l===s){t=ha(e,t,a);break e}rt(e,t,l,a)}t=t.child}return t;case 26:return _o(e,t),e===null?(a=mp(t.type,null,t.pendingProps,null))?t.memoizedState=a:_e||(a=t.type,e=t.pendingProps,l=Bo(de.current).createElement(a),l[lt]=t,l[mt]=e,st(l,a,e),et(l),t.stateNode=l):t.memoizedState=mp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return nt(t),e===null&&_e&&(l=t.stateNode=up(t.type,t.pendingProps,de.current),it=t,qt=!0,s=He,Ka(t.type)?(Lc=s,He=Ht(l.firstChild)):He=s),rt(e,t,t.pendingProps.children,a),_o(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&_e&&((s=l=He)&&(l=$v(l,t.type,t.pendingProps,qt),l!==null?(t.stateNode=l,it=t,He=Ht(l.firstChild),qt=!1,s=!0):s=!1),s||Ia(t)),nt(t),s=t.type,c=t.pendingProps,g=e!==null?e.memoizedProps:null,l=c.children,jc(s,c)?l=null:g!==null&&jc(s,g)&&(t.flags|=32),t.memoizedState!==null&&(s=Os(e,t,mv,null,null,a),pi._currentValue=s),_o(e,t),rt(e,t,l,a),t.child;case 6:return e===null&&_e&&((e=a=He)&&(a=Wv(a,t.pendingProps,qt),a!==null?(t.stateNode=a,it=t,He=null,e=!0):e=!1),e||Ia(t)),null;case 13:return Wf(e,t,a);case 4:return ue(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=gn(t,null,l,a):rt(e,t,l,a),t.child;case 11:return Ff(e,t,t.type,t.pendingProps,a);case 7:return rt(e,t,t.pendingProps,a),t.child;case 8:return rt(e,t,t.pendingProps.children,a),t.child;case 12:return rt(e,t,t.pendingProps.children,a),t.child;case 10:return l=t.pendingProps,za(t,t.type,l.value),rt(e,t,l.children,a),t.child;case 9:return s=t.type._context,l=t.pendingProps.children,fn(t),s=ot(s),l=l(s),t.flags|=1,rt(e,t,l,a),t.child;case 14:return Vf(e,t,t.type,t.pendingProps,a);case 15:return Yf(e,t,t.type,t.pendingProps,a);case 19:return tm(e,t,a);case 31:return xv(e,t,a);case 22:return Kf(e,t,a,t.pendingProps);case 24:return fn(t),l=ot(Xe),e===null?(s=xs(),s===null&&(s=Ge,c=bs(),s.pooledCache=c,c.refCount++,c!==null&&(s.pooledCacheLanes|=a),s=c),t.memoizedState={parent:l,cache:s},Es(t),za(t,Xe,s)):((e.lanes&a)!==0&&(Ns(e,t),Xl(t,null,null,a),Kl()),s=e.memoizedState,c=t.memoizedState,s.parent!==l?(s={parent:l,cache:l},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),za(t,Xe,l)):(l=c.cache,za(t,Xe,l),l!==s.cache&&vs(t,[Xe],a,!0))),rt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function ga(e){e.flags|=4}function ic(e,t,a,l,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(Mm())e.flags|=8192;else throw hn=co,Ts}else e.flags&=-16777217}function nm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!vp(t))if(Mm())e.flags|=8192;else throw hn=co,Ts}function Co(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Du():536870912,e.lanes|=t,ll|=t)}function ei(e,t){if(!_e)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 l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Ue(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var s=e.child;s!==null;)a|=s.lanes|s.childLanes,l|=s.subtreeFlags&65011712,l|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)a|=s.lanes|s.childLanes,l|=s.subtreeFlags,l|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function Ev(e,t,a){var l=t.pendingProps;switch(ms(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ue(t),null;case 1:return Ue(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),fa(Xe),me(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Vn(t)?ga(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,hs())),Ue(t),null;case 26:var s=t.type,c=t.memoizedState;return e===null?(ga(t),c!==null?(Ue(t),nm(t,c)):(Ue(t),ic(t,s,null,l,a))):c?c!==e.memoizedState?(ga(t),Ue(t),nm(t,c)):(Ue(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ga(t),Ue(t),ic(t,s,e,l,a)),null;case 27:if(la(t),a=de.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ga(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Ue(t),null}e=te.current,Vn(t)?Dd(t):(e=up(s,l,a),t.stateNode=e,ga(t))}return Ue(t),null;case 5:if(la(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ga(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Ue(t),null}if(c=te.current,Vn(t))Dd(t);else{var g=Bo(de.current);switch(c){case 1:c=g.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:c=g.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":c=g.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":c=g.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":c=g.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?c.multiple=!0:l.size&&(c.size=l.size);break;default:c=typeof l.is=="string"?g.createElement(s,{is:l.is}):g.createElement(s)}}c[lt]=t,c[mt]=l;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)c.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=c;e:switch(st(c,s,l),s){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ga(t)}}return Ue(t),ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ga(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=de.current,Vn(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,s=it,s!==null)switch(s.tag){case 27:case 5:l=s.memoizedProps}e[lt]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Wm(e.nodeValue,a)),e||Ia(t,!0)}else e=Bo(e).createTextNode(l),e[lt]=t,t.stateNode=e}return Ue(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=Vn(t),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[lt]=t}else un(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ue(t),e=!1}else a=hs(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Ct(t),t):(Ct(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Ue(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Vn(t),l!==null&&l.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));s[lt]=t}else un(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ue(t),s=!1}else s=hs(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Ct(t),t):(Ct(t),null)}return Ct(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,s=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(s=l.alternate.memoizedState.cachePool.pool),c=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(c=l.memoizedState.cachePool.pool),c!==s&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Co(t,t.updateQueue),Ue(t),null);case 4:return me(),e===null&&Cc(t.stateNode.containerInfo),Ue(t),null;case 10:return fa(t.type),Ue(t),null;case 19:if(U(Ye),l=t.memoizedState,l===null)return Ue(t),null;if(s=(t.flags&128)!==0,c=l.rendering,c===null)if(s)ei(l,!1);else{if(Ve!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=po(e),c!==null){for(t.flags|=128,ei(l,!1),e=c.updateQueue,t.updateQueue=e,Co(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Rd(a,e),a=a.sibling;return J(Ye,Ye.current&1|2),_e&&ua(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&Be()>jo&&(t.flags|=128,s=!0,ei(l,!1),t.lanes=4194304)}else{if(!s)if(e=po(c),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Co(t,e),ei(l,!0),l.tail===null&&l.tailMode==="hidden"&&!c.alternate&&!_e)return Ue(t),null}else 2*Be()-l.renderingStartTime>jo&&a!==536870912&&(t.flags|=128,s=!0,ei(l,!1),t.lanes=4194304);l.isBackwards?(c.sibling=t.child,t.child=c):(e=l.last,e!==null?e.sibling=c:t.child=c,l.last=c)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Be(),e.sibling=null,a=Ye.current,J(Ye,s?a&1|2:a&1),_e&&ua(t,l.treeForkCount),e):(Ue(t),null);case 22:case 23:return Ct(t),As(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(Ue(t),t.subtreeFlags&6&&(t.flags|=8192)):Ue(t),a=t.updateQueue,a!==null&&Co(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&U(mn),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),fa(Xe),Ue(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Nv(e,t){switch(ms(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fa(Xe),me(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return la(t),null;case 31:if(t.memoizedState!==null){if(Ct(t),t.alternate===null)throw Error(r(340));un()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ct(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));un()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(Ye),null;case 4:return me(),null;case 10:return fa(t.type),null;case 22:case 23:return Ct(t),As(),e!==null&&U(mn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fa(Xe),null;case 25:return null;default:return null}}function lm(e,t){switch(ms(t),t.tag){case 3:fa(Xe),me();break;case 26:case 27:case 5:la(t);break;case 4:me();break;case 31:t.memoizedState!==null&&Ct(t);break;case 13:Ct(t);break;case 19:U(Ye);break;case 10:fa(t.type);break;case 22:case 23:Ct(t),As(),e!==null&&U(mn);break;case 24:fa(Xe)}}function ti(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var s=l.next;a=s;do{if((a.tag&e)===e){l=void 0;var c=a.create,g=a.inst;l=c(),g.destroy=l}a=a.next}while(a!==s)}}catch(v){De(t,t.return,v)}}function Ha(e,t,a){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){var g=l.inst,v=g.destroy;if(v!==void 0){g.destroy=void 0,s=t;var N=a,I=v;try{I()}catch(G){De(s,N,G)}}}l=l.next}while(l!==c)}}catch(G){De(t,t.return,G)}}function im(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Xd(t,a)}catch(l){De(e,e.return,l)}}}function om(e,t,a){a.props=vn(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){De(e,t,l)}}function ai(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(s){De(e,t,s)}}function $t(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(s){De(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(s){De(e,t,s)}else a.current=null}function rm(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(s){De(e,e.return,s)}}function oc(e,t,a){try{var l=e.stateNode;Yv(l,e.type,a,t),l[mt]=t}catch(s){De(e,e.return,s)}}function sm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ka(e.type)||e.tag===4}function rc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sm(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&&Ka(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 sc(e,t,a){var l=e.tag;if(l===5||l===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=ra));else if(l!==4&&(l===27&&Ka(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(sc(e,t,a),e=e.sibling;e!==null;)sc(e,t,a),e=e.sibling}function Ao(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&Ka(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Ao(e,t,a),e=e.sibling;e!==null;)Ao(e,t,a),e=e.sibling}function cm(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);st(t,l,a),t[lt]=e,t[mt]=a}catch(c){De(e,e.return,c)}}var ya=!1,Je=!1,cc=!1,um=typeof WeakSet=="function"?WeakSet:Set,tt=null;function _v(e,t){if(e=e.containerInfo,Rc=Qo,e=xd(e),as(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var s=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var g=0,v=-1,N=-1,I=0,G=0,B=e,z=null;t:for(;;){for(var q;B!==a||s!==0&&B.nodeType!==3||(v=g+s),B!==c||l!==0&&B.nodeType!==3||(N=g+l),B.nodeType===3&&(g+=B.nodeValue.length),(q=B.firstChild)!==null;)z=B,B=q;for(;;){if(B===e)break t;if(z===a&&++I===s&&(v=g),z===c&&++G===l&&(N=g),(q=B.nextSibling)!==null)break;B=z,z=B.parentNode}B=q}a=v===-1||N===-1?null:{start:v,end:N}}else a=null}a=a||{start:0,end:0}}else a=null;for(Oc={focusedElem:e,selectionRange:a},Qo=!1,tt=t;tt!==null;)if(t=tt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,tt=e;else for(;tt!==null;){switch(t=tt,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++)s=e[a],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,a=t,s=c.memoizedProps,c=c.memoizedState,l=a.stateNode;try{var ae=vn(a.type,s);e=l.getSnapshotBeforeUpdate(ae,c),l.__reactInternalSnapshotBeforeUpdate=e}catch(se){De(a,a.return,se)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)zc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zc(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(r(163))}if(e=t.sibling,e!==null){e.return=t.return,tt=e;break}tt=t.return}}function dm(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:ba(e,a),l&4&&ti(5,a);break;case 1:if(ba(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(g){De(a,a.return,g)}else{var s=vn(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){De(a,a.return,g)}}l&64&&im(a),l&512&&ai(a,a.return);break;case 3:if(ba(e,a),l&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{Xd(e,t)}catch(g){De(a,a.return,g)}}break;case 27:t===null&&l&4&&cm(a);case 26:case 5:ba(e,a),t===null&&l&4&&rm(a),l&512&&ai(a,a.return);break;case 12:ba(e,a);break;case 31:ba(e,a),l&4&&pm(e,a);break;case 13:ba(e,a),l&4&&hm(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=zv.bind(null,a),eb(e,a))));break;case 22:if(l=a.memoizedState!==null||ya,!l){t=t!==null&&t.memoizedState!==null||Je,s=ya;var c=Je;ya=l,(Je=t)&&!c?Sa(e,a,(a.subtreeFlags&8772)!==0):ba(e,a),ya=s,Je=c}break;case 30:break;default:ba(e,a)}}function fm(e){var t=e.alternate;t!==null&&(e.alternate=null,fm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Gr(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 Pe=null,ht=!1;function va(e,t,a){for(a=a.child;a!==null;)mm(e,t,a),a=a.sibling}function mm(e,t,a){if(Tt&&typeof Tt.onCommitFiberUnmount=="function")try{Tt.onCommitFiberUnmount(wl,a)}catch{}switch(a.tag){case 26:Je||$t(a,t),va(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Je||$t(a,t);var l=Pe,s=ht;Ka(a.type)&&(Pe=a.stateNode,ht=!1),va(e,t,a),di(a.stateNode),Pe=l,ht=s;break;case 5:Je||$t(a,t);case 6:if(l=Pe,s=ht,Pe=null,va(e,t,a),Pe=l,ht=s,Pe!==null)if(ht)try{(Pe.nodeType===9?Pe.body:Pe.nodeName==="HTML"?Pe.ownerDocument.body:Pe).removeChild(a.stateNode)}catch(c){De(a,t,c)}else try{Pe.removeChild(a.stateNode)}catch(c){De(a,t,c)}break;case 18:Pe!==null&&(ht?(e=Pe,ip(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),fl(e)):ip(Pe,a.stateNode));break;case 4:l=Pe,s=ht,Pe=a.stateNode.containerInfo,ht=!0,va(e,t,a),Pe=l,ht=s;break;case 0:case 11:case 14:case 15:Ha(2,a,t),Je||Ha(4,a,t),va(e,t,a);break;case 1:Je||($t(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&om(a,t,l)),va(e,t,a);break;case 21:va(e,t,a);break;case 22:Je=(l=Je)||a.memoizedState!==null,va(e,t,a),Je=l;break;default:va(e,t,a)}}function pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{fl(e)}catch(a){De(t,t.return,a)}}}function hm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{fl(e)}catch(a){De(t,t.return,a)}}function wv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new um),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new um),t;default:throw Error(r(435,e.tag))}}function Mo(e,t){var a=wv(e);t.forEach(function(l){if(!a.has(l)){a.add(l);var s=Dv.bind(null,e,l);l.then(s,s)}})}function gt(e,t){var a=t.deletions;if(a!==null)for(var l=0;l<a.length;l++){var s=a[l],c=e,g=t,v=g;e:for(;v!==null;){switch(v.tag){case 27:if(Ka(v.type)){Pe=v.stateNode,ht=!1;break e}break;case 5:Pe=v.stateNode,ht=!1;break e;case 3:case 4:Pe=v.stateNode.containerInfo,ht=!0;break e}v=v.return}if(Pe===null)throw Error(r(160));mm(c,g,s),Pe=null,ht=!1,c=s.alternate,c!==null&&(c.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gm(t,e),t=t.sibling}var Pt=null;function gm(e,t){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:gt(t,e),yt(e),l&4&&(Ha(3,e,e.return),ti(3,e),Ha(5,e,e.return));break;case 1:gt(t,e),yt(e),l&512&&(Je||a===null||$t(a,a.return)),l&64&&ya&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var s=Pt;if(gt(t,e),yt(e),l&512&&(Je||a===null||$t(a,a.return)),l&4){var c=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,s=s.ownerDocument||s;t:switch(l){case"title":c=s.getElementsByTagName("title")[0],(!c||c[Ml]||c[lt]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=s.createElement(l),s.head.insertBefore(c,s.querySelector("head > title"))),st(c,l,a),c[lt]=e,et(c),l=c;break e;case"link":var g=gp("link","href",s).get(l+(a.href||""));if(g){for(var v=0;v<g.length;v++)if(c=g[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)){g.splice(v,1);break t}}c=s.createElement(l),st(c,l,a),s.head.appendChild(c);break;case"meta":if(g=gp("meta","content",s).get(l+(a.content||""))){for(v=0;v<g.length;v++)if(c=g[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)){g.splice(v,1);break t}}c=s.createElement(l),st(c,l,a),s.head.appendChild(c);break;default:throw Error(r(468,l))}c[lt]=e,et(c),l=c}e.stateNode=l}else yp(s,e.type,e.stateNode);else e.stateNode=hp(s,l,e.memoizedProps);else c!==l?(c===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):c.count--,l===null?yp(s,e.type,e.stateNode):hp(s,l,e.memoizedProps)):l===null&&e.stateNode!==null&&oc(e,e.memoizedProps,a.memoizedProps)}break;case 27:gt(t,e),yt(e),l&512&&(Je||a===null||$t(a,a.return)),a!==null&&l&4&&oc(e,e.memoizedProps,a.memoizedProps);break;case 5:if(gt(t,e),yt(e),l&512&&(Je||a===null||$t(a,a.return)),e.flags&32){s=e.stateNode;try{Dn(s,"")}catch(ae){De(e,e.return,ae)}}l&4&&e.stateNode!=null&&(s=e.memoizedProps,oc(e,s,a!==null?a.memoizedProps:s)),l&1024&&(cc=!0);break;case 6:if(gt(t,e),yt(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ae){De(e,e.return,ae)}}break;case 3:if(Vo=null,s=Pt,Pt=Po(t.containerInfo),gt(t,e),Pt=s,yt(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{fl(t.containerInfo)}catch(ae){De(e,e.return,ae)}cc&&(cc=!1,ym(e));break;case 4:l=Pt,Pt=Po(e.stateNode.containerInfo),gt(t,e),yt(e),Pt=l;break;case 12:gt(t,e),yt(e);break;case 31:gt(t,e),yt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Mo(e,l)));break;case 13:gt(t,e),yt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Oo=Be()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Mo(e,l)));break;case 22:s=e.memoizedState!==null;var N=a!==null&&a.memoizedState!==null,I=ya,G=Je;if(ya=I||s,Je=G||N,gt(t,e),Je=G,ya=I,yt(e),l&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(a===null||N||ya||Je||bn(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){N=a=t;try{if(c=N.stateNode,s)g=c.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{v=N.stateNode;var B=N.memoizedProps.style,z=B!=null&&B.hasOwnProperty("display")?B.display:null;v.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ae){De(N,N.return,ae)}}}else if(t.tag===6){if(a===null){N=t;try{N.stateNode.nodeValue=s?"":N.memoizedProps}catch(ae){De(N,N.return,ae)}}}else if(t.tag===18){if(a===null){N=t;try{var q=N.stateNode;s?op(q,!0):op(N.stateNode,!1)}catch(ae){De(N,N.return,ae)}}}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}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Mo(e,a))));break;case 19:gt(t,e),yt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Mo(e,l)));break;case 30:break;case 21:break;default:gt(t,e),yt(e)}}function yt(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(sm(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var s=a.stateNode,c=rc(e);Ao(e,c,s);break;case 5:var g=a.stateNode;a.flags&32&&(Dn(g,""),a.flags&=-33);var v=rc(e);Ao(e,v,g);break;case 3:case 4:var N=a.stateNode.containerInfo,I=rc(e);sc(e,I,N);break;default:throw Error(r(161))}}catch(G){De(e,e.return,G)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ym(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ym(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ba(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)dm(e,t.alternate,t),t=t.sibling}function bn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ha(4,t,t.return),bn(t);break;case 1:$t(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&om(t,t.return,a),bn(t);break;case 27:di(t.stateNode);case 26:case 5:$t(t,t.return),bn(t);break;case 22:t.memoizedState===null&&bn(t);break;case 30:bn(t);break;default:bn(t)}e=e.sibling}}function Sa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,s=e,c=t,g=c.flags;switch(c.tag){case 0:case 11:case 15:Sa(s,c,a),ti(4,c);break;case 1:if(Sa(s,c,a),l=c,s=l.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(I){De(l,l.return,I)}if(l=c,s=l.updateQueue,s!==null){var v=l.stateNode;try{var N=s.shared.hiddenCallbacks;if(N!==null)for(s.shared.hiddenCallbacks=null,s=0;s<N.length;s++)Kd(N[s],v)}catch(I){De(l,l.return,I)}}a&&g&64&&im(c),ai(c,c.return);break;case 27:cm(c);case 26:case 5:Sa(s,c,a),a&&l===null&&g&4&&rm(c),ai(c,c.return);break;case 12:Sa(s,c,a);break;case 31:Sa(s,c,a),a&&g&4&&pm(s,c);break;case 13:Sa(s,c,a),a&&g&4&&hm(s,c);break;case 22:c.memoizedState===null&&Sa(s,c,a),ai(c,c.return);break;case 30:break;default:Sa(s,c,a)}t=t.sibling}}function uc(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&&Bl(a))}function dc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Bl(e))}function Ft(e,t,a,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vm(e,t,a,l),t=t.sibling}function vm(e,t,a,l){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Ft(e,t,a,l),s&2048&&ti(9,t);break;case 1:Ft(e,t,a,l);break;case 3:Ft(e,t,a,l),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Bl(e)));break;case 12:if(s&2048){Ft(e,t,a,l),e=t.stateNode;try{var c=t.memoizedProps,g=c.id,v=c.onPostCommit;typeof v=="function"&&v(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){De(t,t.return,N)}}else Ft(e,t,a,l);break;case 31:Ft(e,t,a,l);break;case 13:Ft(e,t,a,l);break;case 23:break;case 22:c=t.stateNode,g=t.alternate,t.memoizedState!==null?c._visibility&2?Ft(e,t,a,l):ni(e,t):c._visibility&2?Ft(e,t,a,l):(c._visibility|=2,tl(e,t,a,l,(t.subtreeFlags&10256)!==0||!1)),s&2048&&uc(g,t);break;case 24:Ft(e,t,a,l),s&2048&&dc(t.alternate,t);break;default:Ft(e,t,a,l)}}function tl(e,t,a,l,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,g=t,v=a,N=l,I=g.flags;switch(g.tag){case 0:case 11:case 15:tl(c,g,v,N,s),ti(8,g);break;case 23:break;case 22:var G=g.stateNode;g.memoizedState!==null?G._visibility&2?tl(c,g,v,N,s):ni(c,g):(G._visibility|=2,tl(c,g,v,N,s)),s&&I&2048&&uc(g.alternate,g);break;case 24:tl(c,g,v,N,s),s&&I&2048&&dc(g.alternate,g);break;default:tl(c,g,v,N,s)}t=t.sibling}}function ni(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,s=l.flags;switch(l.tag){case 22:ni(a,l),s&2048&&uc(l.alternate,l);break;case 24:ni(a,l),s&2048&&dc(l.alternate,l);break;default:ni(a,l)}t=t.sibling}}var li=8192;function al(e,t,a){if(e.subtreeFlags&li)for(e=e.child;e!==null;)bm(e,t,a),e=e.sibling}function bm(e,t,a){switch(e.tag){case 26:al(e,t,a),e.flags&li&&e.memoizedState!==null&&fb(a,Pt,e.memoizedState,e.memoizedProps);break;case 5:al(e,t,a);break;case 3:case 4:var l=Pt;Pt=Po(e.stateNode.containerInfo),al(e,t,a),Pt=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=li,li=16777216,al(e,t,a),li=l):al(e,t,a));break;default:al(e,t,a)}}function Sm(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 ii(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];tt=l,Tm(l,e)}Sm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xm(e),e=e.sibling}function xm(e){switch(e.tag){case 0:case 11:case 15:ii(e),e.flags&2048&&Ha(9,e,e.return);break;case 3:ii(e);break;case 12:ii(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ro(e)):ii(e);break;default:ii(e)}}function Ro(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];tt=l,Tm(l,e)}Sm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ha(8,t,t.return),Ro(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Ro(t));break;default:Ro(t)}e=e.sibling}}function Tm(e,t){for(;tt!==null;){var a=tt;switch(a.tag){case 0:case 11:case 15:Ha(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Bl(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,tt=l;else e:for(a=e;tt!==null;){l=tt;var s=l.sibling,c=l.return;if(fm(l),l===a){tt=null;break e}if(s!==null){s.return=c,tt=s;break e}tt=c}}}var Cv={getCacheForType:function(e){var t=ot(Xe),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return ot(Xe).controller.signal}},Av=typeof WeakMap=="function"?WeakMap:Map,je=0,Ge=null,be=null,xe=0,ze=0,At=null,Ua=!1,nl=!1,fc=!1,xa=0,Ve=0,Ba=0,Sn=0,mc=0,Mt=0,ll=0,oi=null,vt=null,pc=!1,Oo=0,Em=0,jo=1/0,Io=null,Pa=null,$e=0,Fa=null,il=null,Ta=0,hc=0,gc=null,Nm=null,ri=0,yc=null;function Rt(){return(je&2)!==0&&xe!==0?xe&-xe:w.T!==null?Ec():Gu()}function _m(){if(Mt===0)if((xe&536870912)===0||_e){var e=Hi;Hi<<=1,(Hi&3932160)===0&&(Hi=262144),Mt=e}else Mt=536870912;return e=wt.current,e!==null&&(e.flags|=32),Mt}function bt(e,t,a){(e===Ge&&(ze===2||ze===9)||e.cancelPendingCommit!==null)&&(ol(e,0),Va(e,xe,Mt,!1)),Al(e,a),((je&2)===0||e!==Ge)&&(e===Ge&&((je&2)===0&&(Sn|=a),Ve===4&&Va(e,xe,Mt,!1)),Wt(e))}function wm(e,t,a){if((je&6)!==0)throw Error(r(327));var l=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Cl(e,t),s=l?Ov(e,t):bc(e,t,!0),c=l;do{if(s===0){nl&&!l&&Va(e,t,0,!1);break}else{if(a=e.current.alternate,c&&!Mv(a)){s=bc(e,t,!1),c=!1;continue}if(s===2){if(c=t,e.errorRecoveryDisabledLanes&c)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var v=e;s=oi;var N=v.current.memoizedState.isDehydrated;if(N&&(ol(v,g).flags|=256),g=bc(v,g,!1),g!==2){if(fc&&!N){v.errorRecoveryDisabledLanes|=c,Sn|=c,s=4;break e}c=vt,vt=s,c!==null&&(vt===null?vt=c:vt.push.apply(vt,c))}s=g}if(c=!1,s!==2)continue}}if(s===1){ol(e,0),Va(e,t,0,!0);break}e:{switch(l=e,c=s,c){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Va(l,t,Mt,!Ua);break e;case 2:vt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(s=Oo+300-Be(),10<s)){if(Va(l,t,Mt,!Ua),Bi(l,0,!0)!==0)break e;Ta=t,l.timeoutHandle=np(Cm.bind(null,l,a,vt,Io,pc,t,Mt,Sn,ll,Ua,c,"Throttled",-0,0),s);break e}Cm(l,a,vt,Io,pc,t,Mt,Sn,ll,Ua,c,null,-0,0)}}break}while(!0);Wt(e)}function Cm(e,t,a,l,s,c,g,v,N,I,G,B,z,q){if(e.timeoutHandle=-1,B=t.subtreeFlags,B&8192||(B&16785408)===16785408){B={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ra},bm(t,c,B);var ae=(c&62914560)===c?Oo-Be():(c&4194048)===c?Em-Be():0;if(ae=mb(B,ae),ae!==null){Ta=c,e.cancelPendingCommit=ae(Dm.bind(null,e,t,c,a,l,s,g,v,N,G,B,null,z,q)),Va(e,c,g,!I);return}}Dm(e,t,c,a,l,s,g,v,N)}function Mv(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 l=0;l<a.length;l++){var s=a[l],c=s.getSnapshot;s=s.value;try{if(!Nt(c(),s))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 Va(e,t,a,l){t&=~mc,t&=~Sn,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var s=t;0<s;){var c=31-Et(s),g=1<<c;l[c]=-1,s&=~g}a!==0&&ku(e,a,t)}function zo(){return(je&6)===0?(si(0),!1):!0}function vc(){if(be!==null){if(ze===0)var e=be.return;else e=be,da=dn=null,zs(e),Zn=null,Fl=0,e=be;for(;e!==null;)lm(e.alternate,e),e=e.return;be=null}}function ol(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Qv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ta=0,vc(),Ge=e,be=a=ca(e.current,null),xe=t,ze=0,At=null,Ua=!1,nl=Cl(e,t),fc=!1,ll=Mt=mc=Sn=Ba=Ve=0,vt=oi=null,pc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var s=31-Et(l),c=1<<s;t|=e[s],l&=~c}return xa=t,eo(),a}function Am(e,t){pe=null,w.H=$l,t===Qn||t===so?(t=Pd(),ze=3):t===Ts?(t=Pd(),ze=4):ze=t===Zs?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,At=t,be===null&&(Ve=1,Eo(e,Dt(t,e.current)))}function Mm(){var e=wt.current;return e===null?!0:(xe&4194048)===xe?Gt===null:(xe&62914560)===xe||(xe&536870912)!==0?e===Gt:!1}function Rm(){var e=w.H;return w.H=$l,e===null?$l:e}function Om(){var e=w.A;return w.A=Cv,e}function Do(){Ve=4,Ua||(xe&4194048)!==xe&&wt.current!==null||(nl=!0),(Ba&134217727)===0&&(Sn&134217727)===0||Ge===null||Va(Ge,xe,Mt,!1)}function bc(e,t,a){var l=je;je|=2;var s=Rm(),c=Om();(Ge!==e||xe!==t)&&(Io=null,ol(e,t)),t=!1;var g=Ve;e:do try{if(ze!==0&&be!==null){var v=be,N=At;switch(ze){case 8:vc(),g=6;break e;case 3:case 2:case 9:case 6:wt.current===null&&(t=!0);var I=ze;if(ze=0,At=null,rl(e,v,N,I),a&&nl){g=0;break e}break;default:I=ze,ze=0,At=null,rl(e,v,N,I)}}Rv(),g=Ve;break}catch(G){Am(e,G)}while(!0);return t&&e.shellSuspendCounter++,da=dn=null,je=l,w.H=s,w.A=c,be===null&&(Ge=null,xe=0,eo()),g}function Rv(){for(;be!==null;)jm(be)}function Ov(e,t){var a=je;je|=2;var l=Rm(),s=Om();Ge!==e||xe!==t?(Io=null,jo=Be()+500,ol(e,t)):nl=Cl(e,t);e:do try{if(ze!==0&&be!==null){t=be;var c=At;t:switch(ze){case 1:ze=0,At=null,rl(e,t,c,1);break;case 2:case 9:if(Ud(c)){ze=0,At=null,Im(t);break}t=function(){ze!==2&&ze!==9||Ge!==e||(ze=7),Wt(e)},c.then(t,t);break e;case 3:ze=7;break e;case 4:ze=5;break e;case 7:Ud(c)?(ze=0,At=null,Im(t)):(ze=0,At=null,rl(e,t,c,7));break;case 5:var g=null;switch(be.tag){case 26:g=be.memoizedState;case 5:case 27:var v=be;if(g?vp(g):v.stateNode.complete){ze=0,At=null;var N=v.sibling;if(N!==null)be=N;else{var I=v.return;I!==null?(be=I,ko(I)):be=null}break t}}ze=0,At=null,rl(e,t,c,5);break;case 6:ze=0,At=null,rl(e,t,c,6);break;case 8:vc(),Ve=6;break e;default:throw Error(r(462))}}jv();break}catch(G){Am(e,G)}while(!0);return da=dn=null,w.H=l,w.A=s,je=a,be!==null?0:(Ge=null,xe=0,eo(),Ve)}function jv(){for(;be!==null&&!dt();)jm(be)}function jm(e){var t=am(e.alternate,e,xa);e.memoizedProps=e.pendingProps,t===null?ko(e):be=t}function Im(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Zf(a,t,t.pendingProps,t.type,void 0,xe);break;case 11:t=Zf(a,t,t.pendingProps,t.type.render,t.ref,xe);break;case 5:zs(t);default:lm(a,t),t=be=Rd(t,xa),t=am(a,t,xa)}e.memoizedProps=e.pendingProps,t===null?ko(e):be=t}function rl(e,t,a,l){da=dn=null,zs(t),Zn=null,Fl=0;var s=t.return;try{if(Sv(e,s,t,a,xe)){Ve=1,Eo(e,Dt(a,e.current)),be=null;return}}catch(c){if(s!==null)throw be=s,c;Ve=1,Eo(e,Dt(a,e.current)),be=null;return}t.flags&32768?(_e||l===1?e=!0:nl||(xe&536870912)!==0?e=!1:(Ua=e=!0,(l===2||l===9||l===3||l===6)&&(l=wt.current,l!==null&&l.tag===13&&(l.flags|=16384))),zm(t,e)):ko(t)}function ko(e){var t=e;do{if((t.flags&32768)!==0){zm(t,Ua);return}e=t.return;var a=Ev(t.alternate,t,xa);if(a!==null){be=a;return}if(t=t.sibling,t!==null){be=t;return}be=t=e}while(t!==null);Ve===0&&(Ve=5)}function zm(e,t){do{var a=Nv(e.alternate,e);if(a!==null){a.flags&=32767,be=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){be=e;return}be=e=a}while(e!==null);Ve=6,be=null}function Dm(e,t,a,l,s,c,g,v,N){e.cancelPendingCommit=null;do Lo();while($e!==0);if((je&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(c=t.lanes|t.childLanes,c|=rs,dy(e,a,c,g,v,N),e===Ge&&(be=Ge=null,xe=0),il=t,Fa=e,Ta=a,hc=c,gc=s,Nm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,kv(qi,function(){return Hm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=w.T,w.T=null,s=X.p,X.p=2,g=je,je|=4;try{_v(e,t,a)}finally{je=g,X.p=s,w.T=l}}$e=1,km(),Lm(),qm()}}function km(){if($e===1){$e=0;var e=Fa,t=il,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=w.T,w.T=null;var l=X.p;X.p=2;var s=je;je|=4;try{gm(t,e);var c=Oc,g=xd(e.containerInfo),v=c.focusedElem,N=c.selectionRange;if(g!==v&&v&&v.ownerDocument&&Sd(v.ownerDocument.documentElement,v)){if(N!==null&&as(v)){var I=N.start,G=N.end;if(G===void 0&&(G=I),"selectionStart"in v)v.selectionStart=I,v.selectionEnd=Math.min(G,v.value.length);else{var B=v.ownerDocument||document,z=B&&B.defaultView||window;if(z.getSelection){var q=z.getSelection(),ae=v.textContent.length,se=Math.min(N.start,ae),qe=N.end===void 0?se:Math.min(N.end,ae);!q.extend&&se>qe&&(g=qe,qe=se,se=g);var R=bd(v,se),C=bd(v,qe);if(R&&C&&(q.rangeCount!==1||q.anchorNode!==R.node||q.anchorOffset!==R.offset||q.focusNode!==C.node||q.focusOffset!==C.offset)){var j=B.createRange();j.setStart(R.node,R.offset),q.removeAllRanges(),se>qe?(q.addRange(j),q.extend(C.node,C.offset)):(j.setEnd(C.node,C.offset),q.addRange(j))}}}}for(B=[],q=v;q=q.parentNode;)q.nodeType===1&&B.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<B.length;v++){var H=B[v];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}Qo=!!Rc,Oc=Rc=null}finally{je=s,X.p=l,w.T=a}}e.current=t,$e=2}}function Lm(){if($e===2){$e=0;var e=Fa,t=il,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=w.T,w.T=null;var l=X.p;X.p=2;var s=je;je|=4;try{dm(e,t.alternate,t)}finally{je=s,X.p=l,w.T=a}}$e=3}}function qm(){if($e===4||$e===3){$e=0,ve();var e=Fa,t=il,a=Ta,l=Nm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?$e=5:($e=0,il=Fa=null,Gm(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Pa=null),Lr(a),t=t.stateNode,Tt&&typeof Tt.onCommitFiberRoot=="function")try{Tt.onCommitFiberRoot(wl,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=w.T,s=X.p,X.p=2,w.T=null;try{for(var c=e.onRecoverableError,g=0;g<l.length;g++){var v=l[g];c(v.value,{componentStack:v.stack})}}finally{w.T=t,X.p=s}}(Ta&3)!==0&&Lo(),Wt(e),s=e.pendingLanes,(a&261930)!==0&&(s&42)!==0?e===yc?ri++:(ri=0,yc=e):ri=0,si(0)}}function Gm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Bl(t)))}function Lo(){return km(),Lm(),qm(),Hm()}function Hm(){if($e!==5)return!1;var e=Fa,t=hc;hc=0;var a=Lr(Ta),l=w.T,s=X.p;try{X.p=32>a?32:a,w.T=null,a=gc,gc=null;var c=Fa,g=Ta;if($e=0,il=Fa=null,Ta=0,(je&6)!==0)throw Error(r(331));var v=je;if(je|=4,xm(c.current),vm(c,c.current,g,a),je=v,si(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(wl,c)}catch{}return!0}finally{X.p=s,w.T=l,Gm(e,t)}}function Um(e,t,a){t=Dt(a,t),t=Qs(e.stateNode,t,2),e=La(e,t,2),e!==null&&(Al(e,2),Wt(e))}function De(e,t,a){if(e.tag===3)Um(e,e,a);else for(;t!==null;){if(t.tag===3){Um(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Pa===null||!Pa.has(l))){e=Dt(a,e),a=Bf(2),l=La(t,a,2),l!==null&&(Pf(a,l,t,e),Al(l,2),Wt(l));break}}t=t.return}}function Sc(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Av;var s=new Set;l.set(t,s)}else s=l.get(t),s===void 0&&(s=new Set,l.set(t,s));s.has(a)||(fc=!0,s.add(a),e=Iv.bind(null,e,t,a),t.then(e,e))}function Iv(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ge===e&&(xe&a)===a&&(Ve===4||Ve===3&&(xe&62914560)===xe&&300>Be()-Oo?(je&2)===0&&ol(e,0):mc|=a,ll===xe&&(ll=0)),Wt(e)}function Bm(e,t){t===0&&(t=Du()),e=sn(e,t),e!==null&&(Al(e,t),Wt(e))}function zv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Bm(e,a)}function Dv(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,s=e.memoizedState;s!==null&&(a=s.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),Bm(e,a)}function kv(e,t){return V(e,t)}var qo=null,sl=null,xc=!1,Go=!1,Tc=!1,Ya=0;function Wt(e){e!==sl&&e.next===null&&(sl===null?qo=sl=e:sl=sl.next=e),Go=!0,xc||(xc=!0,qv())}function si(e,t){if(!Tc&&Go){Tc=!0;do for(var a=!1,l=qo;l!==null;){if(e!==0){var s=l.pendingLanes;if(s===0)var c=0;else{var g=l.suspendedLanes,v=l.pingedLanes;c=(1<<31-Et(42|e)+1)-1,c&=s&~(g&~v),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(a=!0,Ym(l,c))}else c=xe,c=Bi(l,l===Ge?c:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(c&3)===0||Cl(l,c)||(a=!0,Ym(l,c));l=l.next}while(a);Tc=!1}}function Lv(){Pm()}function Pm(){Go=xc=!1;var e=0;Ya!==0&&Xv()&&(e=Ya);for(var t=Be(),a=null,l=qo;l!==null;){var s=l.next,c=Fm(l,t);c===0?(l.next=null,a===null?qo=s:a.next=s,s===null&&(sl=a)):(a=l,(e!==0||(c&3)!==0)&&(Go=!0)),l=s}$e!==0&&$e!==5||si(e),Ya!==0&&(Ya=0)}function Fm(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,s=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var g=31-Et(c),v=1<<g,N=s[g];N===-1?((v&a)===0||(v&l)!==0)&&(s[g]=uy(v,t)):N<=t&&(e.expiredLanes|=v),c&=~v}if(t=Ge,a=xe,a=Bi(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(ze===2||ze===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Ce(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Cl(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&Ce(l),Lr(a)){case 2:case 8:a=Iu;break;case 32:a=qi;break;case 268435456:a=zu;break;default:a=qi}return l=Vm.bind(null,e),a=V(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&Ce(l),e.callbackPriority=2,e.callbackNode=null,2}function Vm(e,t){if($e!==0&&$e!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Lo()&&e.callbackNode!==a)return null;var l=xe;return l=Bi(e,e===Ge?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(wm(e,l,t),Fm(e,Be()),e.callbackNode!=null&&e.callbackNode===a?Vm.bind(null,e):null)}function Ym(e,t){if(Lo())return null;wm(e,t,!0)}function qv(){Zv(function(){(je&6)!==0?V(Qt,Lv):Pm()})}function Ec(){if(Ya===0){var e=Kn;e===0&&(e=Gi,Gi<<=1,(Gi&261888)===0&&(Gi=256)),Ya=e}return Ya}function Km(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Yi(""+e)}function Xm(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 Gv(e,t,a,l,s){if(t==="submit"&&a&&a.stateNode===s){var c=Km((s[mt]||null).action),g=l.submitter;g&&(t=(t=g[mt]||null)?Km(t.formAction):g.getAttribute("formAction"),t!==null&&(c=t,g=null));var v=new Zi("action","action",null,l,s);e.push({event:v,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ya!==0){var N=g?Xm(s,g):new FormData(s);Ps(a,{pending:!0,data:N,method:s.method,action:c},null,N)}}else typeof c=="function"&&(v.preventDefault(),N=g?Xm(s,g):new FormData(s),Ps(a,{pending:!0,data:N,method:s.method,action:c},c,N))},currentTarget:s}]})}}for(var Nc=0;Nc<os.length;Nc++){var _c=os[Nc],Hv=_c.toLowerCase(),Uv=_c[0].toUpperCase()+_c.slice(1);Bt(Hv,"on"+Uv)}Bt(Nd,"onAnimationEnd"),Bt(_d,"onAnimationIteration"),Bt(wd,"onAnimationStart"),Bt("dblclick","onDoubleClick"),Bt("focusin","onFocus"),Bt("focusout","onBlur"),Bt(nv,"onTransitionRun"),Bt(lv,"onTransitionStart"),Bt(iv,"onTransitionCancel"),Bt(Cd,"onTransitionEnd"),In("onMouseEnter",["mouseout","mouseover"]),In("onMouseLeave",["mouseout","mouseover"]),In("onPointerEnter",["pointerout","pointerover"]),In("onPointerLeave",["pointerout","pointerover"]),nn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),nn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),nn("onBeforeInput",["compositionend","keypress","textInput","paste"]),nn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),nn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),nn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ci="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(" "),Bv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ci));function Qm(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],s=l.event;l=l.listeners;e:{var c=void 0;if(t)for(var g=l.length-1;0<=g;g--){var v=l[g],N=v.instance,I=v.currentTarget;if(v=v.listener,N!==c&&s.isPropagationStopped())break e;c=v,s.currentTarget=I;try{c(s)}catch(G){Wi(G)}s.currentTarget=null,c=N}else for(g=0;g<l.length;g++){if(v=l[g],N=v.instance,I=v.currentTarget,v=v.listener,N!==c&&s.isPropagationStopped())break e;c=v,s.currentTarget=I;try{c(s)}catch(G){Wi(G)}s.currentTarget=null,c=N}}}}function Se(e,t){var a=t[qr];a===void 0&&(a=t[qr]=new Set);var l=e+"__bubble";a.has(l)||(Zm(t,e,2,!1),a.add(l))}function wc(e,t,a){var l=0;t&&(l|=4),Zm(a,e,l,t)}var Ho="_reactListening"+Math.random().toString(36).slice(2);function Cc(e){if(!e[Ho]){e[Ho]=!0,Bu.forEach(function(a){a!=="selectionchange"&&(Bv.has(a)||wc(a,!1,e),wc(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ho]||(t[Ho]=!0,wc("selectionchange",!1,t))}}function Zm(e,t,a,l){switch(_p(t)){case 2:var s=gb;break;case 8:s=yb;break;default:s=Bc}a=s.bind(null,t,a,e),s=void 0,!Kr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),l?s!==void 0?e.addEventListener(t,a,{capture:!0,passive:s}):e.addEventListener(t,a,!0):s!==void 0?e.addEventListener(t,a,{passive:s}):e.addEventListener(t,a,!1)}function Ac(e,t,a,l,s){var c=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var g=l.tag;if(g===3||g===4){var v=l.stateNode.containerInfo;if(v===s)break;if(g===4)for(g=l.return;g!==null;){var N=g.tag;if((N===3||N===4)&&g.stateNode.containerInfo===s)return;g=g.return}for(;v!==null;){if(g=Rn(v),g===null)return;if(N=g.tag,N===5||N===6||N===26||N===27){l=c=g;continue e}v=v.parentNode}}l=l.return}ed(function(){var I=c,G=Vr(a),B=[];e:{var z=Ad.get(e);if(z!==void 0){var q=Zi,ae=e;switch(e){case"keypress":if(Xi(a)===0)break e;case"keydown":case"keyup":q=Dy;break;case"focusin":ae="focus",q=Jr;break;case"focusout":ae="blur",q=Jr;break;case"beforeblur":case"afterblur":q=Jr;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=nd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=Ey;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=qy;break;case Nd:case _d:case wd:q=wy;break;case Cd:q=Hy;break;case"scroll":case"scrollend":q=xy;break;case"wheel":q=By;break;case"copy":case"cut":case"paste":q=Ay;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=id;break;case"toggle":case"beforetoggle":q=Fy}var se=(t&4)!==0,qe=!se&&(e==="scroll"||e==="scrollend"),R=se?z!==null?z+"Capture":null:z;se=[];for(var C=I,j;C!==null;){var H=C;if(j=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||j===null||R===null||(H=Ol(C,R),H!=null&&se.push(ui(C,H,j))),qe)break;C=C.return}0<se.length&&(z=new q(z,ae,null,a,G),B.push({event:z,listeners:se}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",z&&a!==Fr&&(ae=a.relatedTarget||a.fromElement)&&(Rn(ae)||ae[Mn]))break e;if((q||z)&&(z=G.window===G?G:(z=G.ownerDocument)?z.defaultView||z.parentWindow:window,q?(ae=a.relatedTarget||a.toElement,q=I,ae=ae?Rn(ae):null,ae!==null&&(qe=f(ae),se=ae.tag,ae!==qe||se!==5&&se!==27&&se!==6)&&(ae=null)):(q=null,ae=I),q!==ae)){if(se=nd,H="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(se=id,H="onPointerLeave",R="onPointerEnter",C="pointer"),qe=q==null?z:Rl(q),j=ae==null?z:Rl(ae),z=new se(H,C+"leave",q,a,G),z.target=qe,z.relatedTarget=j,H=null,Rn(G)===I&&(se=new se(R,C+"enter",ae,a,G),se.target=j,se.relatedTarget=qe,H=se),qe=H,q&&ae)t:{for(se=Pv,R=q,C=ae,j=0,H=R;H;H=se(H))j++;H=0;for(var re=C;re;re=se(re))H++;for(;0<j-H;)R=se(R),j--;for(;0<H-j;)C=se(C),H--;for(;j--;){if(R===C||C!==null&&R===C.alternate){se=R;break t}R=se(R),C=se(C)}se=null}else se=null;q!==null&&Jm(B,z,q,se,!1),ae!==null&&qe!==null&&Jm(B,qe,ae,se,!0)}}e:{if(z=I?Rl(I):window,q=z.nodeName&&z.nodeName.toLowerCase(),q==="select"||q==="input"&&z.type==="file")var Me=md;else if(dd(z))if(pd)Me=ev;else{Me=$y;var oe=Jy}else q=z.nodeName,!q||q.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?I&&Pr(I.elementType)&&(Me=md):Me=Wy;if(Me&&(Me=Me(e,I))){fd(B,Me,a,G);break e}oe&&oe(e,z,I),e==="focusout"&&I&&z.type==="number"&&I.memoizedProps.value!=null&&Br(z,"number",z.value)}switch(oe=I?Rl(I):window,e){case"focusin":(dd(oe)||oe.contentEditable==="true")&&(Gn=oe,ns=I,Gl=null);break;case"focusout":Gl=ns=Gn=null;break;case"mousedown":ls=!0;break;case"contextmenu":case"mouseup":case"dragend":ls=!1,Td(B,a,G);break;case"selectionchange":if(av)break;case"keydown":case"keyup":Td(B,a,G)}var he;if(Wr)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else qn?cd(e,a)&&(Te="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Te="onCompositionStart");Te&&(od&&a.locale!=="ko"&&(qn||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&qn&&(he=td()):(Ra=G,Xr="value"in Ra?Ra.value:Ra.textContent,qn=!0)),oe=Uo(I,Te),0<oe.length&&(Te=new ld(Te,e,null,a,G),B.push({event:Te,listeners:oe}),he?Te.data=he:(he=ud(a),he!==null&&(Te.data=he)))),(he=Yy?Ky(e,a):Xy(e,a))&&(Te=Uo(I,"onBeforeInput"),0<Te.length&&(oe=new ld("onBeforeInput","beforeinput",null,a,G),B.push({event:oe,listeners:Te}),oe.data=he)),Gv(B,e,I,a,G)}Qm(B,t)})}function ui(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Uo(e,t){for(var a=t+"Capture",l=[];e!==null;){var s=e,c=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||c===null||(s=Ol(e,a),s!=null&&l.unshift(ui(e,s,c)),s=Ol(e,t),s!=null&&l.push(ui(e,s,c))),e.tag===3)return l;e=e.return}return[]}function Pv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Jm(e,t,a,l,s){for(var c=t._reactName,g=[];a!==null&&a!==l;){var v=a,N=v.alternate,I=v.stateNode;if(v=v.tag,N!==null&&N===l)break;v!==5&&v!==26&&v!==27||I===null||(N=I,s?(I=Ol(a,c),I!=null&&g.unshift(ui(a,I,N))):s||(I=Ol(a,c),I!=null&&g.push(ui(a,I,N)))),a=a.return}g.length!==0&&e.push({event:t,listeners:g})}var Fv=/\r\n?/g,Vv=/\u0000|\uFFFD/g;function $m(e){return(typeof e=="string"?e:""+e).replace(Fv,`
10
- `).replace(Vv,"")}function Wm(e,t){return t=$m(t),$m(e)===t}function Le(e,t,a,l,s,c){switch(a){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Dn(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Dn(e,""+l);break;case"className":Fi(e,"class",l);break;case"tabIndex":Fi(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Fi(e,a,l);break;case"style":$u(e,l,c);break;case"data":if(t!=="object"){Fi(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Yi(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="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"&&Le(e,t,"name",s.name,s,null),Le(e,t,"formEncType",s.formEncType,s,null),Le(e,t,"formMethod",s.formMethod,s,null),Le(e,t,"formTarget",s.formTarget,s,null)):(Le(e,t,"encType",s.encType,s,null),Le(e,t,"method",s.method,s,null),Le(e,t,"target",s.target,s,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Yi(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=ra);break;case"onScroll":l!=null&&Se("scroll",e);break;case"onScrollEnd":l!=null&&Se("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(s.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=Yi(""+l),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":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Se("beforetoggle",e),Se("toggle",e),Pi(e,"popover",l);break;case"xlinkActuate":oa(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":oa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":oa(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":oa(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":oa(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":oa(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":oa(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":oa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":oa(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Pi(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=by.get(a)||a,Pi(e,a,l))}}function Mc(e,t,a,l,s,c){switch(a){case"style":$u(e,l,c);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(s.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Dn(e,l):(typeof l=="number"||typeof l=="bigint")&&Dn(e,""+l);break;case"onScroll":l!=null&&Se("scroll",e);break;case"onScrollEnd":l!=null&&Se("scrollend",e);break;case"onClick":l!=null&&(e.onclick=ra);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pu.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(s=a.endsWith("Capture"),t=a.slice(2,s?a.length-7:void 0),c=e[mt]||null,c=c!=null?c[a]:null,typeof c=="function"&&e.removeEventListener(t,c,s),typeof l=="function")){typeof c!="function"&&c!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,l,s);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Pi(e,a,l)}}}function st(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Se("error",e),Se("load",e);var l=!1,s=!1,c;for(c in a)if(a.hasOwnProperty(c)){var g=a[c];if(g!=null)switch(c){case"src":l=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Le(e,t,c,g,a,null)}}s&&Le(e,t,"srcSet",a.srcSet,a,null),l&&Le(e,t,"src",a.src,a,null);return;case"input":Se("invalid",e);var v=c=g=s=null,N=null,I=null;for(l in a)if(a.hasOwnProperty(l)){var G=a[l];if(G!=null)switch(l){case"name":s=G;break;case"type":g=G;break;case"checked":N=G;break;case"defaultChecked":I=G;break;case"value":c=G;break;case"defaultValue":v=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,t));break;default:Le(e,t,l,G,a,null)}}Xu(e,c,v,N,I,g,s,!1);return;case"select":Se("invalid",e),l=g=c=null;for(s in a)if(a.hasOwnProperty(s)&&(v=a[s],v!=null))switch(s){case"value":c=v;break;case"defaultValue":g=v;break;case"multiple":l=v;default:Le(e,t,s,v,a,null)}t=c,a=g,e.multiple=!!l,t!=null?zn(e,!!l,t,!1):a!=null&&zn(e,!!l,a,!0);return;case"textarea":Se("invalid",e),c=s=l=null;for(g in a)if(a.hasOwnProperty(g)&&(v=a[g],v!=null))switch(g){case"value":l=v;break;case"defaultValue":s=v;break;case"children":c=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:Le(e,t,g,v,a,null)}Zu(e,l,s,c);return;case"option":for(N in a)a.hasOwnProperty(N)&&(l=a[N],l!=null)&&(N==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":Le(e,t,N,l,a,null));return;case"dialog":Se("beforetoggle",e),Se("toggle",e),Se("cancel",e),Se("close",e);break;case"iframe":case"object":Se("load",e);break;case"video":case"audio":for(l=0;l<ci.length;l++)Se(ci[l],e);break;case"image":Se("error",e),Se("load",e);break;case"details":Se("toggle",e);break;case"embed":case"source":case"link":Se("error",e),Se("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(I in a)if(a.hasOwnProperty(I)&&(l=a[I],l!=null))switch(I){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Le(e,t,I,l,a,null)}return;default:if(Pr(t)){for(G in a)a.hasOwnProperty(G)&&(l=a[G],l!==void 0&&Mc(e,t,G,l,a,void 0));return}}for(v in a)a.hasOwnProperty(v)&&(l=a[v],l!=null&&Le(e,t,v,l,a,null))}function Yv(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,c=null,g=null,v=null,N=null,I=null,G=null;for(q in a){var B=a[q];if(a.hasOwnProperty(q)&&B!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":N=B;default:l.hasOwnProperty(q)||Le(e,t,q,null,l,B)}}for(var z in l){var q=l[z];if(B=a[z],l.hasOwnProperty(z)&&(q!=null||B!=null))switch(z){case"type":c=q;break;case"name":s=q;break;case"checked":I=q;break;case"defaultChecked":G=q;break;case"value":g=q;break;case"defaultValue":v=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,t));break;default:q!==B&&Le(e,t,z,q,l,B)}}Ur(e,g,v,N,I,G,c,s);return;case"select":q=g=v=z=null;for(c in a)if(N=a[c],a.hasOwnProperty(c)&&N!=null)switch(c){case"value":break;case"multiple":q=N;default:l.hasOwnProperty(c)||Le(e,t,c,null,l,N)}for(s in l)if(c=l[s],N=a[s],l.hasOwnProperty(s)&&(c!=null||N!=null))switch(s){case"value":z=c;break;case"defaultValue":v=c;break;case"multiple":g=c;default:c!==N&&Le(e,t,s,c,l,N)}t=v,a=g,l=q,z!=null?zn(e,!!a,z,!1):!!l!=!!a&&(t!=null?zn(e,!!a,t,!0):zn(e,!!a,a?[]:"",!1));return;case"textarea":q=z=null;for(v in a)if(s=a[v],a.hasOwnProperty(v)&&s!=null&&!l.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Le(e,t,v,null,l,s)}for(g in l)if(s=l[g],c=a[g],l.hasOwnProperty(g)&&(s!=null||c!=null))switch(g){case"value":z=s;break;case"defaultValue":q=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(r(91));break;default:s!==c&&Le(e,t,g,s,l,c)}Qu(e,z,q);return;case"option":for(var ae in a)z=a[ae],a.hasOwnProperty(ae)&&z!=null&&!l.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:Le(e,t,ae,null,l,z));for(N in l)z=l[N],q=a[N],l.hasOwnProperty(N)&&z!==q&&(z!=null||q!=null)&&(N==="selected"?e.selected=z&&typeof z!="function"&&typeof z!="symbol":Le(e,t,N,z,l,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 se in a)z=a[se],a.hasOwnProperty(se)&&z!=null&&!l.hasOwnProperty(se)&&Le(e,t,se,null,l,z);for(I in l)if(z=l[I],q=a[I],l.hasOwnProperty(I)&&z!==q&&(z!=null||q!=null))switch(I){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(137,t));break;default:Le(e,t,I,z,l,q)}return;default:if(Pr(t)){for(var qe in a)z=a[qe],a.hasOwnProperty(qe)&&z!==void 0&&!l.hasOwnProperty(qe)&&Mc(e,t,qe,void 0,l,z);for(G in l)z=l[G],q=a[G],!l.hasOwnProperty(G)||z===q||z===void 0&&q===void 0||Mc(e,t,G,z,l,q);return}}for(var R in a)z=a[R],a.hasOwnProperty(R)&&z!=null&&!l.hasOwnProperty(R)&&Le(e,t,R,null,l,z);for(B in l)z=l[B],q=a[B],!l.hasOwnProperty(B)||z===q||z==null&&q==null||Le(e,t,B,z,l,q)}function ep(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Kv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var s=a[l],c=s.transferSize,g=s.initiatorType,v=s.duration;if(c&&v&&ep(g)){for(g=0,v=s.responseEnd,l+=1;l<a.length;l++){var N=a[l],I=N.startTime;if(I>v)break;var G=N.transferSize,B=N.initiatorType;G&&ep(B)&&(N=N.responseEnd,g+=G*(N<v?1:(v-I)/(N-I)))}if(--l,t+=8*(c+g)/(s.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 Rc=null,Oc=null;function Bo(e){return e.nodeType===9?e:e.ownerDocument}function tp(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 ap(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 jc(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 Ic=null;function Xv(){var e=window.event;return e&&e.type==="popstate"?e===Ic?!1:(Ic=e,!0):(Ic=null,!1)}var np=typeof setTimeout=="function"?setTimeout:void 0,Qv=typeof clearTimeout=="function"?clearTimeout:void 0,lp=typeof Promise=="function"?Promise:void 0,Zv=typeof queueMicrotask=="function"?queueMicrotask:typeof lp<"u"?function(e){return lp.resolve(null).then(e).catch(Jv)}:np;function Jv(e){setTimeout(function(){throw e})}function Ka(e){return e==="head"}function ip(e,t){var a=t,l=0;do{var s=a.nextSibling;if(e.removeChild(a),s&&s.nodeType===8)if(a=s.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(s),fl(t);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")di(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,di(a);for(var c=a.firstChild;c;){var g=c.nextSibling,v=c.nodeName;c[Ml]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&c.rel.toLowerCase()==="stylesheet"||a.removeChild(c),c=g}}else a==="body"&&di(e.ownerDocument.body);a=s}while(a);fl(t)}function op(e,t){var a=e;e=0;do{var l=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||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function zc(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":zc(a),Gr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function $v(e,t,a,l){for(;e.nodeType===1;){var s=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Ml])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!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=Ht(e.nextSibling),e===null)break}return null}function Wv(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Ht(e.nextSibling),e===null))return null;return e}function rp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ht(e.nextSibling),e===null))return null;return e}function Dc(e){return e.data==="$?"||e.data==="$~"}function kc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function eb(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Ht(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 Lc=null;function sp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Ht(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function cp(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 up(e,t,a){switch(t=Bo(a),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function di(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Gr(e)}var Ut=new Map,dp=new Set;function Po(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ea=X.d;X.d={f:tb,r:ab,D:nb,C:lb,L:ib,m:ob,X:sb,S:rb,M:cb};function tb(){var e=Ea.f(),t=zo();return e||t}function ab(e){var t=On(e);t!==null&&t.tag===5&&t.type==="form"?Af(t):Ea.r(e)}var cl=typeof document>"u"?null:document;function fp(e,t,a){var l=cl;if(l&&typeof t=="string"&&t){var s=It(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof a=="string"&&(s+='[crossorigin="'+a+'"]'),dp.has(s)||(dp.add(s),e={rel:e,crossOrigin:a,href:t},l.querySelector(s)===null&&(t=l.createElement("link"),st(t,"link",e),et(t),l.head.appendChild(t)))}}function nb(e){Ea.D(e),fp("dns-prefetch",e,null)}function lb(e,t){Ea.C(e,t),fp("preconnect",e,t)}function ib(e,t,a){Ea.L(e,t,a);var l=cl;if(l&&e&&t){var s='link[rel="preload"][as="'+It(t)+'"]';t==="image"&&a&&a.imageSrcSet?(s+='[imagesrcset="'+It(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(s+='[imagesizes="'+It(a.imageSizes)+'"]')):s+='[href="'+It(e)+'"]';var c=s;switch(t){case"style":c=ul(e);break;case"script":c=dl(e)}Ut.has(c)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Ut.set(c,e),l.querySelector(s)!==null||t==="style"&&l.querySelector(fi(c))||t==="script"&&l.querySelector(mi(c))||(t=l.createElement("link"),st(t,"link",e),et(t),l.head.appendChild(t)))}}function ob(e,t){Ea.m(e,t);var a=cl;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+It(l)+'"][href="'+It(e)+'"]',c=s;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=dl(e)}if(!Ut.has(c)&&(e=b({rel:"modulepreload",href:e},t),Ut.set(c,e),a.querySelector(s)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(mi(c)))return}l=a.createElement("link"),st(l,"link",e),et(l),a.head.appendChild(l)}}}function rb(e,t,a){Ea.S(e,t,a);var l=cl;if(l&&e){var s=jn(l).hoistableStyles,c=ul(e);t=t||"default";var g=s.get(c);if(!g){var v={loading:0,preload:null};if(g=l.querySelector(fi(c)))v.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Ut.get(c))&&qc(e,a);var N=g=l.createElement("link");et(N),st(N,"link",e),N._p=new Promise(function(I,G){N.onload=I,N.onerror=G}),N.addEventListener("load",function(){v.loading|=1}),N.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Fo(g,t,l)}g={type:"stylesheet",instance:g,count:1,state:v},s.set(c,g)}}}function sb(e,t){Ea.X(e,t);var a=cl;if(a&&e){var l=jn(a).hoistableScripts,s=dl(e),c=l.get(s);c||(c=a.querySelector(mi(s)),c||(e=b({src:e,async:!0},t),(t=Ut.get(s))&&Gc(e,t),c=a.createElement("script"),et(c),st(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(s,c))}}function cb(e,t){Ea.M(e,t);var a=cl;if(a&&e){var l=jn(a).hoistableScripts,s=dl(e),c=l.get(s);c||(c=a.querySelector(mi(s)),c||(e=b({src:e,async:!0,type:"module"},t),(t=Ut.get(s))&&Gc(e,t),c=a.createElement("script"),et(c),st(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(s,c))}}function mp(e,t,a,l){var s=(s=de.current)?Po(s):null;if(!s)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=ul(a.href),a=jn(s).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ul(a.href);var c=jn(s).hoistableStyles,g=c.get(e);if(g||(s=s.ownerDocument||s,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,g),(c=s.querySelector(fi(e)))&&!c._p&&(g.instance=c,g.state.loading=5),Ut.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},Ut.set(e,a),c||ub(s,e,a,g.state))),t&&l===null)throw Error(r(528,""));return g}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dl(a),a=jn(s).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function ul(e){return'href="'+It(e)+'"'}function fi(e){return'link[rel="stylesheet"]['+e+"]"}function pp(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function ub(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),st(t,"link",a),et(t),e.head.appendChild(t))}function dl(e){return'[src="'+It(e)+'"]'}function mi(e){return"script[async]"+e}function hp(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+It(a.href)+'"]');if(l)return t.instance=l,et(l),l;var s=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),et(l),st(l,"style",s),Fo(l,a.precedence,e),t.instance=l;case"stylesheet":s=ul(a.href);var c=e.querySelector(fi(s));if(c)return t.state.loading|=4,t.instance=c,et(c),c;l=pp(a),(s=Ut.get(s))&&qc(l,s),c=(e.ownerDocument||e).createElement("link"),et(c);var g=c;return g._p=new Promise(function(v,N){g.onload=v,g.onerror=N}),st(c,"link",l),t.state.loading|=4,Fo(c,a.precedence,e),t.instance=c;case"script":return c=dl(a.src),(s=e.querySelector(mi(c)))?(t.instance=s,et(s),s):(l=a,(s=Ut.get(c))&&(l=b({},a),Gc(l,s)),e=e.ownerDocument||e,s=e.createElement("script"),et(s),st(s,"link",l),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Fo(l,a.precedence,e));return t.instance}function Fo(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=l.length?l[l.length-1]:null,c=s,g=0;g<l.length;g++){var v=l[g];if(v.dataset.precedence===t)c=v;else if(c!==s)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function qc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Gc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Vo=null;function gp(e,t,a){if(Vo===null){var l=new Map,s=Vo=new Map;s.set(a,l)}else s=Vo,l=s.get(a),l||(l=new Map,s.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),s=0;s<a.length;s++){var c=a[s];if(!(c[Ml]||c[lt]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var g=c.getAttribute(t)||"";g=e+g;var v=l.get(g);v?v.push(c):l.set(g,[c])}}return l}function yp(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function db(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 vp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function fb(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var s=ul(l.href),c=t.querySelector(fi(s));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Yo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,et(c);return}c=t.ownerDocument||t,l=pp(l),(s=Ut.get(s))&&qc(l,s),c=c.createElement("link"),et(c);var g=c;g._p=new Promise(function(v,N){g.onload=v,g.onerror=N}),st(c,"link",l),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=Yo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Hc=0;function mb(e,t){return e.stylesheets&&e.count===0&&Xo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Xo(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&Hc===0&&(Hc=62500*Kv());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xo(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>Hc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(s)}}:null}function Yo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ko=null;function Xo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ko=new Map,t.forEach(pb,e),Ko=null,Yo.call(e))}function pb(e,t){if(!(t.state.loading&4)){var a=Ko.get(e);if(a)var l=a.get(null);else{a=new Map,Ko.set(e,a);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<s.length;c++){var g=s[c];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(a.set(g.dataset.precedence,g),l=g)}l&&a.set(null,l)}s=t.instance,g=s.getAttribute("data-precedence"),c=a.get(g)||l,c===l&&a.set(null,s),a.set(g,s),this.count++,l=Yo.bind(this),s.addEventListener("load",l),s.addEventListener("error",l),c?c.parentNode.insertBefore(s,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var pi={$$typeof:Z,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function hb(e,t,a,l,s,c,g,v,N){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=Dr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dr(0),this.hiddenUpdates=Dr(null),this.identifierPrefix=l,this.onUncaughtError=s,this.onCaughtError=c,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function bp(e,t,a,l,s,c,g,v,N,I,G,B){return e=new hb(e,t,a,g,N,I,G,B,v),t=1,c===!0&&(t|=24),c=_t(3,null,null,t),e.current=c,c.stateNode=e,t=bs(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:l,isDehydrated:a,cache:t},Es(c),e}function Sp(e){return e?(e=Bn,e):Bn}function xp(e,t,a,l,s,c){s=Sp(s),l.context===null?l.context=s:l.pendingContext=s,l=ka(t),l.payload={element:a},c=c===void 0?null:c,c!==null&&(l.callback=c),a=La(e,l,t),a!==null&&(bt(a,e,t),Yl(a,e,t))}function Tp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Uc(e,t){Tp(e,t),(e=e.alternate)&&Tp(e,t)}function Ep(e){if(e.tag===13||e.tag===31){var t=sn(e,67108864);t!==null&&bt(t,e,67108864),Uc(e,67108864)}}function Np(e){if(e.tag===13||e.tag===31){var t=Rt();t=kr(t);var a=sn(e,t);a!==null&&bt(a,e,t),Uc(e,t)}}var Qo=!0;function gb(e,t,a,l){var s=w.T;w.T=null;var c=X.p;try{X.p=2,Bc(e,t,a,l)}finally{X.p=c,w.T=s}}function yb(e,t,a,l){var s=w.T;w.T=null;var c=X.p;try{X.p=8,Bc(e,t,a,l)}finally{X.p=c,w.T=s}}function Bc(e,t,a,l){if(Qo){var s=Pc(l);if(s===null)Ac(e,t,l,Zo,a),wp(e,l);else if(bb(s,e,t,a,l))l.stopPropagation();else if(wp(e,l),t&4&&-1<vb.indexOf(e)){for(;s!==null;){var c=On(s);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var g=an(c.pendingLanes);if(g!==0){var v=c;for(v.pendingLanes|=2,v.entangledLanes|=2;g;){var N=1<<31-Et(g);v.entanglements[1]|=N,g&=~N}Wt(c),(je&6)===0&&(jo=Be()+500,si(0))}}break;case 31:case 13:v=sn(c,2),v!==null&&bt(v,c,2),zo(),Uc(c,2)}if(c=Pc(l),c===null&&Ac(e,t,l,Zo,a),c===s)break;s=c}s!==null&&l.stopPropagation()}else Ac(e,t,l,null,a)}}function Pc(e){return e=Vr(e),Fc(e)}var Zo=null;function Fc(e){if(Zo=null,e=Rn(e),e!==null){var t=f(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 Zo=e,null}function _p(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(An()){case Qt:return 2;case Iu:return 8;case qi:case ly:return 32;case zu:return 268435456;default:return 32}default:return 32}}var Vc=!1,Xa=null,Qa=null,Za=null,hi=new Map,gi=new Map,Ja=[],vb="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 wp(e,t){switch(e){case"focusin":case"focusout":Xa=null;break;case"dragenter":case"dragleave":Qa=null;break;case"mouseover":case"mouseout":Za=null;break;case"pointerover":case"pointerout":hi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":gi.delete(t.pointerId)}}function yi(e,t,a,l,s,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:c,targetContainers:[s]},t!==null&&(t=On(t),t!==null&&Ep(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function bb(e,t,a,l,s){switch(t){case"focusin":return Xa=yi(Xa,e,t,a,l,s),!0;case"dragenter":return Qa=yi(Qa,e,t,a,l,s),!0;case"mouseover":return Za=yi(Za,e,t,a,l,s),!0;case"pointerover":var c=s.pointerId;return hi.set(c,yi(hi.get(c)||null,e,t,a,l,s)),!0;case"gotpointercapture":return c=s.pointerId,gi.set(c,yi(gi.get(c)||null,e,t,a,l,s)),!0}return!1}function Cp(e){var t=Rn(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=p(a),t!==null){e.blockedOn=t,Hu(e.priority,function(){Np(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,Hu(e.priority,function(){Np(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 Jo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Pc(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Fr=l,a.target.dispatchEvent(l),Fr=null}else return t=On(a),t!==null&&Ep(t),e.blockedOn=a,!1;t.shift()}return!0}function Ap(e,t,a){Jo(e)&&a.delete(t)}function Sb(){Vc=!1,Xa!==null&&Jo(Xa)&&(Xa=null),Qa!==null&&Jo(Qa)&&(Qa=null),Za!==null&&Jo(Za)&&(Za=null),hi.forEach(Ap),gi.forEach(Ap)}function $o(e,t){e.blockedOn===t&&(e.blockedOn=null,Vc||(Vc=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Sb)))}var Wo=null;function Mp(e){Wo!==e&&(Wo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Wo===e&&(Wo=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],s=e[t+2];if(typeof l!="function"){if(Fc(l||a)===null)continue;break}var c=On(a);c!==null&&(e.splice(t,3),t-=3,Ps(c,{pending:!0,data:s,method:a.method,action:l},l,s))}}))}function fl(e){function t(N){return $o(N,e)}Xa!==null&&$o(Xa,e),Qa!==null&&$o(Qa,e),Za!==null&&$o(Za,e),hi.forEach(t),gi.forEach(t);for(var a=0;a<Ja.length;a++){var l=Ja[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ja.length&&(a=Ja[0],a.blockedOn===null);)Cp(a),a.blockedOn===null&&Ja.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var s=a[l],c=a[l+1],g=s[mt]||null;if(typeof c=="function")g||Mp(a);else if(g){var v=null;if(c&&c.hasAttribute("formAction")){if(s=c,g=c[mt]||null)v=g.formAction;else if(Fc(s)!==null)continue}else v=g.action;typeof v=="function"?a[l+1]=v:(a.splice(l,3),l-=3),Mp(a)}}}function Rp(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(g){return s=g})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),l||setTimeout(a,20)}function a(){if(!l&&!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 l=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Yc(e){this._internalRoot=e}er.prototype.render=Yc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var a=t.current,l=Rt();xp(a,l,e,t,null,null)},er.prototype.unmount=Yc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;xp(e.current,2,null,e,null,null),zo(),t[Mn]=null}};function er(e){this._internalRoot=e}er.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gu();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ja.length&&t!==0&&t<Ja[a].priority;a++);Ja.splice(a,0,e),a===0&&Cp(e)}};var Op=o.version;if(Op!=="19.2.5")throw Error(r(527,Op,"19.2.5"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=h(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var xb={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:w,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tr.isDisabled&&tr.supportsFiber)try{wl=tr.inject(xb),Tt=tr}catch{}}return bi.createRoot=function(e,t){if(!u(e))throw Error(r(299));var a=!1,l="",s=qf,c=Gf,g=Hf;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=bp(e,1,!1,null,null,a,l,null,s,c,g,Rp),e[Mn]=t.current,Cc(e),new Yc(t)},bi.hydrateRoot=function(e,t,a){if(!u(e))throw Error(r(299));var l=!1,s="",c=qf,g=Gf,v=Hf,N=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(s=a.identifierPrefix),a.onUncaughtError!==void 0&&(c=a.onUncaughtError),a.onCaughtError!==void 0&&(g=a.onCaughtError),a.onRecoverableError!==void 0&&(v=a.onRecoverableError),a.formState!==void 0&&(N=a.formState)),t=bp(e,1,!0,t,a??null,l,s,N,c,g,v,Rp),t.context=Sp(null),a=t.current,l=Rt(),l=kr(l),s=ka(l),s.callback=null,La(a,s,l),a=l,t.current.lanes=a,Al(t,a),Wt(t),e[Mn]=t.current,Cc(e),new er(t)},bi.version="19.2.5",bi}var Up;function Ob(){if(Up)return Qc.exports;Up=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),Qc.exports=Rb(),Qc.exports}var jb=Ob();const Ib="modulepreload",zb=function(n){return"/"+n},Bp={},wa=function(o,i,r){let u=Promise.resolve();if(i&&i.length>0){let y=function(h){return Promise.all(h.map(x=>Promise.resolve(x).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(h=>{if(h=zb(h),h in Bp)return;Bp[h]=!0;const x=h.endsWith(".css"),b=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${b}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":Ib,x||(S.as="script"),S.crossOrigin="",S.href=h,m&&S.setAttribute("nonce",m),document.head.appendChild(S),x)return new Promise((T,E)=>{S.addEventListener("load",T),S.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${h}`)))})}))}function f(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"&&f(m.reason);return o().catch(f)})},Pp=n=>{let o;const i=new Set,r=(h,x)=>{const b=typeof h=="function"?h(o):h;if(!Object.is(b,o)){const S=o;o=x??(typeof b!="object"||b===null)?b:Object.assign({},o,b),i.forEach(T=>T(o,S))}},u=()=>o,m={setState:r,getState:u,getInitialState:()=>y,subscribe:h=>(i.add(h),()=>i.delete(h))},y=o=n(r,u,m);return m},Db=(n=>n?Pp(n):Pp),kb=n=>n;function Lb(n,o=kb){const i=ar.useSyncExternalStore(n.subscribe,ar.useCallback(()=>o(n.getState()),[n,o]),ar.useCallback(()=>o(n.getInitialState()),[n,o]));return ar.useDebugValue(i),i}const Fp=n=>{const o=Db(n),i=r=>Lb(o,r);return Object.assign(i,o),i},Ph=(n=>n?Fp(n):Fp),qb=["default","gpt","claude","gemini","grok"];function Vp(n){return Array.isArray(n.images)}function Gb(n){let o="message";const i=[];for(const u of n.split(`
11
- `))u.startsWith("event:")&&(o=u.slice(6).trim()),u.startsWith("data:")&&i.push(u.slice(5).trimStart());if(i.length===0)return null;const r=i.join(`
12
- `);return!r||r==="[DONE]"?null:{event:o,data:JSON.parse(r)}}async function Hb(n,o={}){const i=await fetch("/api/node/generate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(n)});if(!(i.headers.get("content-type")??"").includes("text/event-stream")){const y=await i.json().catch(()=>({}));if(!i.ok){const h=y,x=h?.error?.message??`Request failed: ${i.status}`,b=new Error(x);throw b.code=h?.error?.code,b.status=h?.status??i.status,b}return y}if(!i.ok||!i.body)throw new Error(`Request failed: ${i.status}`);const u=i.body.getReader(),f=new TextDecoder;let p="",m=null;for(;;){const{done:y,value:h}=await u.read();if(y)break;p+=f.decode(h,{stream:!0});let x=p.indexOf(`
13
-
14
- `);for(;x!==-1;){const b=p.slice(0,x);p=p.slice(x+2);const S=Gb(b);if(S){if(S.event==="partial")o.onPartial?.(S.data);else if(S.event==="phase")o.onPhase?.(S.data);else if(S.event==="done")m=S.data;else if(S.event==="error"){const T=S.data,E=T?.error?.message??"Node generation failed",M=new Error(E);throw M.code=T?.error?.code,M.status=T?.status,M}}x=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 ge(n,o){const i=await fetch(n,o),r=await i.json().catch(()=>({}));if(!i.ok){const u=r.error,f=r.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:f&&(m.code=f),typeof r.currentVersion=="number"&&(m.currentVersion=r.currentVersion),m}return r}function Fh(n){const o=new URLSearchParams;n?.kind&&o.set("kind",n.kind),n?.sessionId&&o.set("sessionId",n.sessionId),n?.includeTerminal&&o.set("includeTerminal","1");const i=o.size>0?`?${o.toString()}`:"";return ge(`/api/inflight${i}`)}function Wc(n){return ge(`/api/inflight/${encodeURIComponent(n)}`,{method:"DELETE"})}function Ub(){return ge("/api/oauth/status")}function Bb(){return ge("/api/billing")}function Pb(n){return ge("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function Vh(n){let o=null;const i=[];for(const u of n.split(`
17
- `))u.startsWith("event:")&&(o=u.slice(6).trim()),u.startsWith("data:")&&i.push(u.slice(5).trimStart());if(i.length===0)return null;const r=i.join(`
18
- `);return!r||r==="[DONE]"?null:{event:o,data:JSON.parse(r)}}async function Fb(n,o={},i={}){const r=await fetch("/api/generate/multimode",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(n),signal:i.signal});if(!(r.headers.get("content-type")??"").includes("text/event-stream")){const h=await r.json().catch(()=>({}));if(!r.ok){const x=h,b=new Error(x.error??`Request failed: ${r.status}`);throw b.code=x.code,b.status=x.status??r.status,b}return h}if(!r.ok||!r.body)throw new Error(`Request failed: ${r.status}`);const f=r.body.getReader(),p=new TextDecoder;let m="",y=null;for(;;){const{done:h,value:x}=await f.read();if(h)break;m+=p.decode(x,{stream:!0});let b=m.indexOf(`
19
-
20
- `);for(;b!==-1;){const S=m.slice(0,b);m=m.slice(b+2);const T=Vh(S);if(T){if(T.event==="partial")o.onPartial?.(T.data);else if(T.event==="image")o.onImage?.(T.data);else if(T.event==="phase")o.onPhase?.(T.data);else if(T.event==="done")y=T.data;else if(T.event==="error"){const E=T.data,M=new Error(E.error??"Multimode generation failed");throw M.code=E.code,M.status=E.status,M}}b=m.indexOf(`
21
-
22
- `)}}if(!y){const h=new Error("No image data returned from the multimode stream");throw h.code="EMPTY_RESPONSE",h.status=422,h}if(!Array.isArray(y.images)||y.images.length===0){const h=new Error("No image data returned from the multimode stream");throw h.code="EMPTY_RESPONSE",h.status=422,h}return y}function IE(n){return ge("/api/edit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}let Si=null;function Yh(){if(!Si){const n=localStorage.getItem("ima2.browserId");n?Si=n:(Si=`${Date.now().toString(36)}_${Math.random().toString(36).slice(2,9)}`,localStorage.setItem("ima2.browserId",Si))}return Si}function xl(n,o){const i={...o?.headers,"X-Ima2-Browser-Id":Yh()};return ge(n,{...o,headers:i})}function yl(n={}){const o=new URLSearchParams;return o.set("limit",String(n.limit??50)),n.since!=null&&o.set("since",String(n.since)),n.cursor&&(o.set("before",String(n.cursor.before)),o.set("beforeFilename",n.cursor.beforeFilename)),n.sessionId&&o.set("sessionId",n.sessionId),n.favoritesOnly&&o.set("favoritesOnly","1"),xl(`/api/history?${o.toString()}`)}function Vb(n={}){const o=new URLSearchParams;return o.set("groupBy","session"),o.set("limit",String(n.limit??200)),n.cursor&&(o.set("before",String(n.cursor.before)),o.set("beforeFilename",n.cursor.beforeFilename)),n.sessionId&&o.set("sessionId",n.sessionId),xl(`/api/history?${o.toString()}`)}function Yb(n){return xl("/api/history/favorite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n})})}async function Kb(){return(await ge("/api/storage/status")).data}function Xb(){return ge("/api/storage/open-generated-dir",{method:"POST"})}function Yp(n){return ge(`/api/history/${encodeURIComponent(n)}`,{method:"DELETE"})}function Qb(n){return ge(`/api/history/${encodeURIComponent(n)}/permanent`,{method:"DELETE"})}function Zb(n,o){return ge(`/api/history/${encodeURIComponent(n)}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trashId:o})})}function Jb(n){return ge("/api/comfy/export-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n.filename})})}function $b(n){return ge("/api/metadata/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function zE(n){return xl(`/api/annotations/${encodeURIComponent(n)}`)}async function DE(n,o){await xl(`/api/annotations/${encodeURIComponent(n)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotations:o})})}async function kE(n){await xl(`/api/annotations/${encodeURIComponent(n)}`,{method:"DELETE"})}function LE(n){const o=new URLSearchParams({sourceFilename:n.sourceFilename});return ge(`/api/canvas-versions?${o.toString()}`,{method:"POST",headers:{"Content-Type":"image/png"},body:n.image})}function qE(n,o){const i=new URLSearchParams;o.sourceFilename&&i.set("sourceFilename",o.sourceFilename);const r=i.size>0?`?${i.toString()}`:"";return ge(`/api/canvas-versions/${encodeURIComponent(n)}${r}`,{method:"PUT",headers:{"Content-Type":"image/png"},body:o.image})}function Wb(){return ge("/api/sessions")}function eS(n){return ge("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n})})}function Kh(n){return ge(`/api/sessions/${encodeURIComponent(n)}`)}function tS(n,o){return ge(`/api/sessions/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o})})}function aS(n){return ge(`/api/sessions/${encodeURIComponent(n)}`,{method:"DELETE"})}function nS(n,o,i,r,u={}){const f={"Content-Type":"application/json","If-Match":String(o)};return u.saveId&&(f["X-Ima2-Graph-Save-Id"]=u.saveId),u.saveReason&&(f["X-Ima2-Graph-Save-Reason"]=u.saveReason),u.tabId&&(f["X-Ima2-Tab-Id"]=u.tabId),ge(`/api/sessions/${encodeURIComponent(n)}/graph`,{method:"PUT",headers:f,body:JSON.stringify({nodes:i,edges:r})})}function lS(n){const o=new URLSearchParams;return ge(`/api/prompts?${o.toString()}`)}function iS(n){return ge("/api/prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function oS(n){return ge(`/api/prompts/${encodeURIComponent(n)}`,{method:"DELETE"})}function rS(n){return ge(`/api/prompts/${encodeURIComponent(n)}/favorite`,{method:"POST"})}function sS(n){return ge("/api/prompts/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function GE(n){return ge("/api/prompts/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function HE(n){return ge("/api/prompts/import/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function UE(){return ge("/api/prompts/import/curated-sources")}function BE(n){return ge("/api/prompts/import/curated-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function PE(n){return ge("/api/prompts/import/curated-refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function FE(n){const o=new URLSearchParams,i=o.size>0?`?${o.toString()}`:"";return ge(`/api/prompts/import/discovery${i}`)}function VE(n){return ge("/api/prompts/import/discovery-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:n.q,seeds:n.seeds,limit:n.limit})})}function YE(n){return ge("/api/prompts/import/discovery-review",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function KE(n){return ge("/api/prompts/import/folder-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:{kind:"github-folder",input:n.source.input}})})}function XE(n){return ge("/api/prompts/import/folder-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:{kind:"github-folder",input:n.source.input},paths:n.paths})})}async function cS(n){const o=await n.arrayBuffer(),i=await fetch("/api/history/import-local",{method:"POST",headers:{"Content-Type":n.type||"image/png","X-Ima2-Original-Filename":encodeURIComponent(n.name)},body:o});if(!i.ok){let u={};try{u=await i.json()}catch{}const f=new Error(u.error||`Import failed (${i.status})`);throw f.code=u.code||"IMPORT_FAILED",f}return(await i.json()).item}function QE(n){return ge("/api/prompt-builder/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function Kp(n,o={},i={}){const r=await fetch("/api/video/generate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({provider:"grok",...n}),signal:i.signal});if(!(r.headers.get("content-type")??"").includes("text/event-stream")){const x=await r.json().catch(()=>({})),b=new Error(x.error??`Request failed: ${r.status}`);throw b.code=x.code,b.status=x.status??r.status,b}if(!r.ok||!r.body)throw new Error(`Request failed: ${r.status}`);const f=r.body.getReader(),p=new TextDecoder;let m="",y=null;for(;;){const{done:h,value:x}=await f.read();if(h)break;m+=p.decode(x,{stream:!0});let b=m.indexOf(`
23
-
24
- `);for(;b!==-1;){const S=m.slice(0,b);m=m.slice(b+2);const T=Vh(S);if(T){if(T.event==="planning")o.onPlanning?.();else if(T.event==="submitted")o.onSubmitted?.(T.data);else if(T.event==="progress")o.onProgress?.(T.data);else if(T.event==="done")y=T.data;else if(T.event==="error"){const E=T.data,M=new Error(E.error??"Video generation failed");throw M.code=E.code,M.status=E.status,M}}b=m.indexOf(`
25
-
26
- `)}}if(!y){const h=new Error("No video returned from the stream");throw h.code="EMPTY_RESPONSE",h.status=422,h}return y}function uS(n){return new Promise((o,i)=>{const r=new FileReader;r.onload=()=>o(String(r.result)),r.onerror=()=>i(r.error),r.readAsDataURL(n)})}function dS(n,o=256){return new Promise(i=>{const r=new Image;r.onload=()=>{const u=Math.min(1,o/Math.max(r.width,r.height)),f=document.createElement("canvas");f.width=r.width*u,f.height=r.height*u;const p=f.getContext("2d");if(!p)return i(n);p.drawImage(r,0,0,f.width,f.height),i(f.toDataURL("image/jpeg",.6))},r.onerror=()=>i(n),r.src=n})}const fS={maxB64Bytes:6e6,preserveTransparency:!1,maxEdge:4096,qualityLadder:[.85,.7,.55]},Xp=16777216;function mS(n,o,i){let r=n,u=o;if(r<=0||u<=0)return{w:1,h:1};const f=Math.max(r,u);if(f>i){const p=i/f;r=Math.round(r*p),u=Math.round(u*p)}if(r*u>Xp){const p=Math.sqrt(Xp/(r*u));r=Math.max(1,Math.floor(r*p)),u=Math.max(1,Math.floor(u*p))}return{w:r,h:u}}function eu(n){return new Promise((o,i)=>{const r=new FileReader;r.onload=()=>{typeof r.result=="string"?o(r.result):i(new Error("FileReader returned non-string"))},r.onerror=()=>i(r.error??new Error("FileReader failed")),r.readAsDataURL(n)})}function Qp(n,o,i){return new Promise((r,u)=>{n.toBlob(f=>f?r(f):u(new Error("canvas.toBlob returned null")),o,i)})}function tu(n){const o=n.indexOf(",");return o<0?n.length:n.length-o-1}async function fu(n,o={}){const i={...fS,...o},r=await eu(n);if(tu(r)<=i.maxB64Bytes)return r;let u;try{u=await createImageBitmap(n)}catch(f){throw new Error("이미지 디코드 실패. JPEG/PNG로 변환 후 다시 시도해 주세요.",{cause:f})}try{const{w:f,h:p}=mS(u.width,u.height,i.maxEdge),m=document.createElement("canvas");m.width=f,m.height=p;const y=m.getContext("2d");if(!y)throw new Error("canvas 2d context unavailable");if(y.drawImage(u,0,0,f,p),i.preserveTransparency){const h=await Qp(m,"image/png"),x=await eu(h);if(tu(x)>i.maxB64Bytes)throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.");return x}for(const h of i.qualityLadder){const x=await Qp(m,"image/jpeg",h),b=await eu(x);if(tu(b)<=i.maxB64Bytes)return b}throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.")}finally{u.close?.()}}function nr(n){const o=(n.type||"").toLowerCase();if(o.includes("heic")||o.includes("heif"))return!0;const i=(n.name||"").toLowerCase();return i.endsWith(".heic")||i.endsWith(".heif")}function Zp(n){return(n.type||"").toLowerCase()==="image/png"}const pS={ok:"확인",cancel:"취소",delete:"삭제",close:"닫기",saving:"저장 중...",loading:"불러오는 중..."},hS={modeImage:"이미지",settings:"설정",controls:"생성 옵션",generate:"생성",generateAria:"이미지 생성을 위한 프롬프트 시트 열기"},gS={close:"프롬프트 시트 닫기",generate:"이미지 생성",controlsOpen:"생성 옵션 열기",tabs:{prompt:"프롬프트",controls:"옵션",library:"라이브러리"}},yS={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:"이 이미지를 첫 노드로 만들었습니다.",animateStarted:"이미지를 비디오로 변환 중…",animateProgress:"비디오 렌더링 중… {n}%",animateDone:"비디오가 준비됐어요. 히스토리를 확인하세요.",animateFailed:"비디오 생성에 실패했습니다.",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:"생성을 취소하지 못했습니다."},vS={queued:"대기 중",planning:"프롬프트 생성 중",streaming:"생성 중",decoding:"마무리 중",canceling:"취소 중",noPrompt:"프롬프트 없음",cancelAria:"생성 취소: {prompt}"},bS={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:"픽셀 제한"}},SS={title:"크기 조정이 필요합니다",body:"입력한 크기가 이미지 생성 제한을 벗어나 자동 조정이 필요합니다.",requested:"요청한 크기",adjusted:"조정될 크기",approve:"승인 후 생성",cancel:"취소",reasonRatio:"비율 제한 3:1을 초과했습니다.",reasonPixels:"최대 픽셀 수 제한을 초과했습니다.",reasonMinPixels:"요청한 이미지의 픽셀 수가 너무 적습니다.",reasonMin:"최소 크기보다 작습니다.",reasonMax:"최대 크기보다 큽니다.",reasonSnap:"16px 단위에 맞춰야 합니다."},xS={title:"품질",grokTitle:"Grok 품질",lowLabel:"낮음",lowSub:"빠름",mediumLabel:"중간",mediumSub:"균형",highLabel:"높음",highSub:"최상"},TS={title:"모더레이션",autoLabel:"자동",autoSub:"표준 필터",lowLabel:"낮음",lowSub:"완화 필터",explain:"자동은 표준 안전 필터를 사용합니다. 낮음은 제한을 조금 완화해 경계선 프롬프트가 더 통과할 수 있습니다."},ES={title:"포맷"},NS={title:"개수",customPlus:"+n",customLabel:"직접 입력 개수",highCountHint:"고품질이나 참조 이미지에서는 시간이 더 걸릴 수 있습니다.",minMaxHint:"1-8장까지 가능합니다.",decrease:"개수 줄이기",increase:"개수 늘리기"},_S={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:"취소"},wS={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:"출처"},CS={title:"생성 준비 상태",open:"준비 상태 확인",openTitle:"프로바이더, 인증, 모델, 웹 검색 준비 상태 확인",settingsTitle:"생성 준비 상태",settingsBody:"프로바이더, 인증, 모델, 추론, 웹 검색 상태를 팝업으로 확인합니다.",ready:"생성 준비 완료",readyBody:"선택한 프로바이더를 사용할 수 있습니다.",blocked:"프로바이더 확인 필요",provider:"프로바이더",model:"모델",reasoning:"추론",webSearch:"웹 검색",grokApi:"Grok API",grokApiBody:"번들된 progrok에서 필수 검색 → grok-4.3 이미지+텍스트 tool planning(영어 프롬프트) → xAI Images API 순서로 실행됩니다. 첨부 레퍼런스는 xAI 이미지 편집으로 보내 i2i 맥락을 보존합니다.",openAccount:"계정 설정 열기"},AS={button:"생성",buttonLoading:"생성 중 ({n})"},MS={label:"API 상태",checking:"확인 중...",offline:"오프라인",remaining:"${remaining} 남음",thisMonth:"이번 달 ${amount}",oauthFree:"GPT OAuth 무료 사용 가능",apiDisabled:"API 키 사용 가능",apiReady:"API 키 사용 가능",oauthMode:"GPT OAuth 모드"},RS={openGalleryAria:"갤러리 열기",openGalleryTitle:"전체 갤러리 열기",openGalleryShort:"전체",galleryCard:"갤러리 열기",recentTitle:"최근 생성",collapseRecent:"최근 생성 접기",expandRecent:"최근 생성 펼치기",collapseRecentShort:"접기",expandRecentShort:"펼치기",emptyRecent:"생성 히스토리가 여기에 표시됩니다.",selectRecent:"생성 히스토리 선택",deleteImageAria:"이미지 기록 삭제",deleteSequenceAria:"{count}장 시퀀스 삭제",deleteSequenceConfirm:"이 멀티모드 시퀀스의 이미지 {count}장을 삭제할까요?",sequenceDeleted:"시퀀스 이미지 {count}장을 히스토리에서 삭제했습니다"},OS={closeSettings:"설정 닫기",detailSettings:"세부 설정",toggleShow:"세부 설정 보기",toggleHide:"세부 설정 숨기기",open:"열기",close:"닫기"},jS={label:"프롬프트",refCount:"참조 {count}/{max}",refChipTitle:"참조 이미지 {n}",refChipAlt:"참조 이미지 {n}",refRemoveAria:"참조 이미지 {n} 제거",placeholder:"원하는 이미지를 설명하고, 드래그 앤 드롭이나 붙여넣기로 참조 이미지를 추가할 수 있어요...",placeholderWithRefs:"첨부한 이미지로 무엇을 만들지 설명해 주세요...",attach:"첨부",attachTitle:"참조 이미지 첨부",useCurrent:"현재 결과 사용",useCurrentTitle:"현재 결과를 참조로 사용",continue:"이어가기",continueTitle:"현재 결과를 참조로 이어서 작업",videoToggleTitle:"비디오 모드 전환 (Grok 1.5)",directMode:"Direct",directModeActive:"1:1 Direct 켜짐",directModeTitle:"프롬프트를 원문 그대로 전달 (Direct 모드)",moveBlockUp:"{name} 위로 이동",moveBlockDown:"{name} 아래로 이동",afterBlocks:"본문 프롬프트 뒤",hint:"Ctrl + Enter로 생성",dropHere:"놓아서 참조 이미지로 추가 ({max}장까지)"},IS={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:"캔버스 버전을 참조 이미지로 사용할 수 있습니다"}},zS={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:"보관된 참조 비우기"},kS={selectionOn:"선택중",selectionOff:"선택",selectAll:"전체",summary:"선택 {selected} · 미생성 {missing} · 영향 {stale}",generateMissing:"미생성",regenerateSelected:"재생성",stopRemaining:"중단",stopping:"중단중",clear:"해제",noneSelected:"선택된 노드가 없습니다.",parentRequired:"부모 이미지가 준비되지 않은 선택 노드가 {count}개 있습니다.",nothingToRun:"생성할 선택 노드가 없습니다.",stopQueued:"현재 노드가 끝나면 남은 작업을 중단합니다.",failed:"{done}/{total} 완료 후 중단되었습니다.",finished:"{done}/{total} 노드 작업 완료",staleBecauseParentChanged:"상위 노드가 재생성되어 다시 확인이 필요합니다."},LS={disconnect:"끊기",disconnectTitle:"선택한 연결선 끊기",disconnected:"연결선을 끊었습니다.",parentConflict:"한 노드에는 부모 연결을 하나만 둘 수 있습니다."},qS={authTitle:"공급자",apiLabel:"API 키",oauthNotReady:"GPT OAuth 프록시가 아직 준비되지 않았습니다.",codexLoginRequired:"Codex 로그인이 필요합니다.",codexLoginHint:"터미널에서 `codex login`을 실행한 뒤 이 페이지를 새로고침하세요.",oauthStarting:"GPT OAuth 프록시가 시작 중입니다. 몇 초 후 다시 시도하세요.",serverUnreachable:"서버에 연결할 수 없습니다. 백엔드가 실행 중인지 확인하세요.",apiInvalid:"API 키가 없거나 유효하지 않습니다. 서버의 .env 파일에서 OPENAI_API_KEY를 확인하세요.",grokOffline:"Grok 프록시가 실행되지 않고 있습니다.",grokNoImageModel:"Grok 이미지 생성 모델을 찾을 수 없습니다.",grokNotReady:"Grok을 사용할 수 없습니다.",grokOfflineHint:"필요하면 `ima2 grok login`을 한 번 실행한 뒤 `ima2 serve`를 시작하세요. ima2가 번들된 Grok 프록시를 자동으로 띄웁니다.",grokManagedByIma2:"Grok은 `ima2 serve` 안에서 번들된 progrok 프록시(127.0.0.1:18645)로 로컬 실행됩니다.",grokClassicOnly:"이 화면에서는 Grok 이미지 생성을 사용할 수 없습니다.",grokClassicOnlyHint:"Grok이 켜진 생성 화면에서 사용하세요.",grokCompatTitle:"Grok 이미지 API",grokCompatBody:"ima2 serve가 번들된 progrok 프록시(127.0.0.1:18645)를 관리합니다. Grok은 검색을 항상 사용한 뒤 첨부 레퍼런스를 grok-4.3 planner에 함께 보내고, xAI 이미지 편집으로 유지하며, 크기는 xAI aspect ratio/resolution으로 매핑됩니다. 출력 포맷, 모더레이션, 추론은 OpenAI 공급자에서만 설정됩니다.",settingsBody:"앞으로 생성 요청에 사용할 공급자를 선택합니다.",availableTitle:"{name} 사용 가능",availableAria:"{name}: 사용 가능",unavailableAria:"{name}: 사용 불가",availableSr:"(사용 가능)",unavailableSr:"(사용 불가)"},GS={free:"무료",approx:"약 ${amount}",multimodeApprox:"최대 약 ${amount} ({count}장)",label:"예상 비용"},HS={download:"다운로드",copyImage:"이미지 복사",copyPrompt:"프롬프트 복사",continueHere:"여기서 이어서",continueHereTitle:"이 이미지의 프롬프트를 가져와 이어서 작업",animate:"애니메이트",animating:"애니메이트 중…",animateTitle:"이 이미지로 Grok 비디오 생성 (이미지→비디오)",firstNode:"첫 노드",firstNodeTitle:"이 이미지를 Node Mode의 준비된 첫 노드로 보냅니다",delete:"삭제",deleteTitle:"휴지통으로 이동",more:"더보기",sendToComfyUI:"ComfyUI로 보내기",sendToComfyUITitle:"이 저장된 이미지를 로컬 ComfyUI로 업로드",permanentDelete:"완전 삭제",permanentDeleteConfirm:'"{filename}" 이미지를 완전히 삭제할까요? 이 작업은 되돌릴 수 없습니다.'},US={switchTitle:"세션 전환",loading:"불러오는 중...",newSession:"새 세션",newSessionTitle:"새 세션",renameTitle:"이름 변경",renamePrompt:"세션 이름",deleteTitle:"삭제",deleteConfirm:'"{title}" 세션을 삭제할까요? 이 작업은 되돌릴 수 없습니다.',empty:"아직 세션이 없습니다",firstGraph:"첫 번째 그래프",untitled:"제목 없는 세션",assetAbortedError:"생성이 정상적으로 끝나지 않았습니다. 이 노드에서 다시 시도하세요."},BS={ariaLabel:"UI 모드",classic:"기본",node:"노드",cardNews:"카드뉴스",agent:"에이전트"},PS={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:"프롬프트"},FS={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:"초안 생성 실패"}},VS={modeLabel:"비디오 모드",mode:{"text-to-video":"텍스트 → 비디오 (참조 이미지 없음)","image-to-video":"이미지 → 비디오 (참조 1장)","reference-to-video":"레퍼런스 → 비디오 (참조 {n}장)"},seriesTopicTitle:"시리즈 주제",seriesTopicPlaceholder:"예: 한국 여행 브이로그",durationTitle:"길이",resolutionTitle:"해상도",aspectTitle:"비율"},YS={appName:"이미지 생성기",imageModelLabel:"모델",imageModelAria:"이미지 모델 선택",quickSettingsAria:"모델과 추론 강도 선택. 현재 모델 {model}, 추론 {effort}",quickSettingsModelOnlyAria:"이미지 모델 선택. 현재 모델 {model}",quickSettingsMenu:"모델 및 추론 빠른 설정",reasoningLabel:"추론",videoModelLabel:"비디오",nodeModeHint:"노드 모드에서는 노드를 눌러 프롬프트를 수정한 뒤 생성하세요. 오른쪽 패널의 설정 (품질/크기)은 새로 만드는 모든 결과에 적용됩니다."},KS={openAria:"설정 열기",openTitle:"설정",closeAria:"설정 닫기",closeTitle:"캔버스로 돌아가기",navAria:"설정 섹션",contentAria:"설정 내용",jumpTo:"{section} 섹션으로 이동",eyebrow:"작업공간 설정",title:"설정",subtitle:"계정, 화면, 앞으로 늘어날 작업공간 옵션을 이곳에 모아 생성 흐름은 가볍게 유지합니다.",sections:{account:{title:"계정",hint:"GPT OAuth 상태"},generation:{title:"생성",hint:"모델 기본값"},appearance:{title:"화면",hint:"라이트/다크"},workspace:{title:"작업공간",hint:"프로필"},language:{title:"언어",hint:"UI 문구"},future:{title:"예정",hint:"확장 공간"}},account:{primaryEyebrow:"현재 공급자",oauthTitle:"GPT OAuth 사용 중",oauthBody:"GPT 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:"상태 불명",grokEyebrow:"로컬 xAI 프록시",grokTitle:"Grok 이미지 공급자",grokBody:"설정된 로컬 포트의 progrok을 통해 xAI Images API 생성을 사용합니다.",status:{ready:"준비됨",authRequired:"로그인 필요",starting:"시작 중",offline:"오프라인",noImageModel:"이미지 모델 없음",error:"오류",checking:"확인 중"}},quota:{eyebrow:"사용량 쿼타",title:"속도 제한",codexNotLoggedIn:"로그인 필요",fetchError:"쿼타를 불러올 수 없음",noData:"사용량 데이터 없음",grokUsageLink:"Grok 사용량 보기 →"},imageModel:{title:"이미지 모델",body:"앞으로 생성 요청에 사용할 이미지 모델을 선택합니다. Grok 모델을 선택하면 공급자도 Grok으로 전환됩니다.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",grokImagine:"Grok Imagine",grokImagineQuality:"Grok Imagine Quality",gpt53CodexSpark:"GPT-5.3 Codex Spark — 이미지 생성 미지원",unsupportedHelp:"Grok 모델은 번들된 로컬 프록시를 통해 xAI Images API를 사용합니다. GPT 모델은 OpenAI Responses 이미지 생성을 사용합니다."},videoModel:{grokImagine:"Grok Imagine Video",grokImagine15:"Grok Imagine Video 1.5"},reasoning:{title:"추론 강도",body:"값이 높을수록 생성 전에 plan/검색/프롬프트 보강에 더 많은 reasoning 토큰을 사용합니다.",none:"Off — 추가 추론 없음",low:"Low — 가장 빠름, 추론 최소",medium:"Medium — 기본 균형값",high:"High — 더 깊은 리서치와 통합",xhigh:"Xhigh — 최대 추론, 가장 느림"},webSearch:{title:"웹서치",body:"실존 인물, 브랜드, 제품, 장소, 최신 이벤트를 생성 전에 실시간 검색해서 반영합니다.",on:"검색 켬",off:"검색 끔"},grokCompatibility:{title:"Grok 호환성",body:"Grok 이미지 생성은 grok-4.3이 먼저 필수 웹 검색을 수행하고, 그 다음 텍스트와 첨부 이미지를 함께 보는 image-tool planner가 최종 이미지 프롬프트를 영어로 작성한 뒤 xAI Images API로 실행됩니다. 첨부 레퍼런스는 xAI 이미지 편집 경로로 유지되고, 크기는 aspect ratio/resolution으로 매핑됩니다. 출력 포맷·모더레이션·추론은 GPT OAuth/API 키 공급자에서만 사용됩니다."},gallery:{defaultScopeTitle:"기본 갤러리 보기",defaultScopeBody:"갤러리를 열 때 처음 보여줄 범위를 선택합니다."},appearance:{themeTitle:"테마",themeBody:"이 기기에서 사용할 테마 스타일과 밝기를 선택합니다.",historyStripLayoutTitle:"히스토리 썸네일",historyStripLayoutBody:"작업공간 옆 작은 히스토리 배열 방식을 고릅니다.",historyStripLayout:{rail:"세로",horizontal:"상단 가로",sidebar:"사이드바"}},language:{title:"언어",body:"생성 프롬프트와 무관하게 인터페이스 언어만 바꿉니다."},future:{title:"나중을 위한 자리",body:"GPT OAuth 복구 도구나 작업공간 옵션이 실제로 필요해지면 이곳에 추가합니다."}},XS={loading:"세션 불러오는 중...",addFirst:"+ 첫 노드 추가",addRootTitle:"루트 노드 추가",hint:"핸들을 빈 공간으로 드래그하면 새 브랜치가 생깁니다. Delete 또는 Backspace로 삭제할 수 있습니다."},QS={title:"{provider} 사용 불가",ariaLabel:"{provider} 사용 불가"},ZS={label:"언어",ko:"한국어",en:"English"},JS={label:"테마",modeLabel:"밝기",styleLabel:"테마 스타일",system:"시스템",dark:"다크",light:"라이트",family:{default:"기본",gpt:"GPT",claude:"Claude",gemini:"Gemini",grok:"Grok"}},$S={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:"GPT OAuth 로그인은 되어 있지만, 이 계정/모델 조합에서 이미지 생성 도구 권한이 없을 수 있어요. API-Key 모드나 다른 모델로 확인해 주세요.",cta:"확인"},responsesStreamError:{title:"이미지 응답 스트림이 오류로 종료됐어요",body:"OpenAI 응답 스트림에서 오류 이벤트가 반환됐어요. 잠시 후 다시 시도하고, 반복되면 원본 오류 세부 정보를 확인해 주세요.",cta:"다시 시도"},upstream5xx:{title:"OpenAI 서버가 혼잡합니다",body:"잠시 후 다시 시도하면 대부분 해결돼요. 상태 페이지(status.openai.com)도 확인해 보세요.",cta:"다시 시도"},authChatgptExpired:{title:"Codex ChatGPT 로그인이 만료됐어요",body:"터미널에서 `ima2 setup`을 다시 실행한 뒤(옵션 1) 앱을 새로고침해 주세요.",cta:"새로고침"},authApiKeyInvalid:{title:"API 키 인증 실패",body:"키가 없거나 잘못됐거나, 한도/조직 권한 문제가 있을 수 있어요. GPT OAuth로 전환하거나 설정된 API 키를 갱신해 주세요.",cta:"확인"},networkFailed:{title:"네트워크 연결 실패",body:"OpenAI 또는 로컬 런타임 서비스에 연결하지 못했어요. 먼저 새로고침하고, 계속되면 VPN/방화벽과 `ima2 doctor`에 표시되는 포트를 확인해 주세요.",cta:"새로고침"},oauthUnavailable:{title:"GPT OAuth 프록시를 사용할 수 없어요",body:"GPT OAuth 프록시가 아직 시작 중이거나, 사용할 수 없거나, fallback 포트로 이동했을 수 있어요. 먼저 새로고침하고, 계속되면 `ima2 doctor`의 GPT OAuth URL을 확인해 주세요.",cta:"새로고침"},invalidRequest:{title:"이미지 요청을 수정해야 해요",body:"생성 요청의 일부 값이 올바르지 않습니다. 아래 원본 오류를 확인한 뒤 프롬프트나 크기를 수정해 다시 시도해 주세요.",cta:"입력 수정"},apikeyDisabled:{title:"API-Key 모드를 사용할 수 없어요",body:"이 빌드는 API-Key 생성을 지원하지만 현재 요청에서 설정된 키를 사용할 수 없었습니다. GPT OAuth로 전환하거나 API 키를 갱신해 주세요.",cta:"확인"}},WS={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 폴더만 지원합니다"},e0={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:"첨부한 파일을 참고해서 프롬프트를 도와줘"},t0={sectionTitle:"작업 공간",sectionBody:"작업 공간 레이아웃 프로필을 선택합니다.",profileLabel:"작업 공간 프로필",defaultLabel:"기본",defaultDesc:"사이드바 컴포저가 있는 기본 생성 흐름.",promptStudioLabel:"프롬프트 스튜디오",promptStudioDesc:"프롬프트 빌더 패널, 그룹 히스토리, 향상된 뷰어."},a0={controls:"이미지 확대 컨트롤",zoomIn:"확대",zoomOut:"축소",reset:"확대 초기화"},n0={common:pS,appBar:hS,sheet:gS,toast:yS,inflight:vS,size:bS,sizeConfirm:SS,quality:xS,moderation:TS,format:ES,count:NS,multimode:_S,metadata:wS,readiness:CS,generate:AS,billing:MS,history:RS,panel:OS,prompt:jS,canvas:IS,gallery:zS,node:DS,nodeBatch:kS,edge:LS,provider:qS,cost:GS,result:HS,session:US,uiMode:BS,agent:PS,cardNews:FS,video:VS,sidebar:YS,settings:KS,nodeCanvas:XS,apiDisabled:QS,language:ZS,theme:JS,errorCard:$S,promptLibrary:WS,promptBuilder:e0,workspace:t0,viewer:a0},l0={ok:"OK",cancel:"Cancel",delete:"Delete",close:"Close",saving:"Saving...",loading:"Loading..."},i0={modeImage:"Image",settings:"Settings",controls:"Generation controls",generate:"Generate",generateAria:"Open prompt sheet to generate an image"},o0={close:"Close prompt sheet",generate:"Generate image",controlsOpen:"Open generation controls",tabs:{prompt:"Prompt",controls:"Controls",library:"Library"}},r0={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.",animateStarted:"Animating image to video…",animateProgress:"Rendering video… {n}%",animateDone:"Video ready. Check your history.",animateFailed:"Video generation failed.",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."},s0={queued:"Queued",planning:"Planning",streaming:"Generating",decoding:"Finalizing",canceling:"Canceling",noPrompt:"No prompt",cancelAria:"Cancel generation: {prompt}"},c0={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"}},u0={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."},d0={title:"Quality",grokTitle:"Grok quality",lowLabel:"Low",lowSub:"Fast",mediumLabel:"Medium",mediumSub:"Balanced",highLabel:"High",highSub:"Best"},f0={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."},m0={title:"Format"},p0={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"},h0={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"},g0={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"},y0={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",grokApi:"Grok API",grokApiBody:"Runs through bundled progrok: mandatory search, grok-4.3 image+text tool planning in English, then xAI Images API. Attached references use xAI image editing so i2i context is preserved.",openAccount:"Open account settings"},v0={button:"Generate",buttonLoading:"Generating ({n})"},b0={label:"API Status",checking:"Checking...",offline:"Offline",remaining:"${remaining} remaining",thisMonth:"${amount} this month",oauthFree:"GPT OAuth · free via codex",apiDisabled:"API key ready",apiReady:"API key ready",oauthMode:"GPT OAuth mode"},S0={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"},x0={closeSettings:"Close settings",detailSettings:"Settings",toggleShow:"Show settings",toggleHide:"Hide settings",open:"Open",close:"Close"},T0={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",continue:"Continue",continueTitle:"Continue from current result as reference",videoToggleTitle:"Toggle video mode (Grok 1.5)",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})"},E0={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"}},N0={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."}},_0={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"},w0={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."},C0={disconnect:"Disconnect",disconnectTitle:"Disconnect selected edge",disconnected:"Connection removed.",parentConflict:"A node can only have one parent connection."},A0={authTitle:"Provider",apiLabel:"API Key",oauthNotReady:"GPT OAuth proxy is not ready yet.",codexLoginRequired:"Codex login required.",codexLoginHint:"Run `codex login` in your terminal, then refresh this page.",oauthStarting:"GPT 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.",grokOffline:"Grok proxy is not running.",grokNoImageModel:"No Grok image generation model found.",grokNotReady:"Grok is not available.",grokOfflineHint:"Run `ima2 grok login` once if needed, then start `ima2 serve`; ima2 starts the bundled Grok proxy automatically.",grokManagedByIma2:"Grok runs locally inside `ima2 serve` through the bundled progrok proxy at 127.0.0.1:18645.",grokClassicOnly:"Grok image generation is not available in this surface.",grokClassicOnlyHint:"Use a generation surface with Grok enabled.",grokCompatTitle:"Grok image API",grokCompatBody:"ima2 serve manages the bundled progrok proxy at 127.0.0.1:18645. Grok always searches before image generation, sends attached references into the grok-4.3 planner, keeps them through xAI image editing, and maps size to xAI aspect ratio/resolution. Output format, moderation, and reasoning are OpenAI-provider settings only.",settingsBody:"Choose which provider future generation requests use.",availableTitle:"{name} available",availableAria:"{name}: available",unavailableAria:"{name}: unavailable",availableSr:"(available)",unavailableSr:"(unavailable)"},M0={free:"free",approx:"~${amount}",multimodeApprox:"up to ~${amount} ({count})",label:"Est. cost"},R0={download:"Download",copyImage:"Copy image",copyPrompt:"Copy prompt",continueHere:"Continue here",continueHereTitle:"Import this image's prompt and keep working",animate:"Animate",animating:"Animating…",animateTitle:"Generate a Grok video from this image (image-to-video)",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."},j0={ariaLabel:"UI mode",classic:"Classic",node:"Node",cardNews:"Card News",agent:"Agent"},I0={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"},z0={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"}},D0={modeLabel:"Video mode",mode:{"text-to-video":"Text → video (no reference images)","image-to-video":"Image → video (1 reference)","reference-to-video":"Reference → video ({n} references)"},seriesTopicTitle:"Series topic",seriesTopicPlaceholder:"e.g. Korean travel vlog",durationTitle:"Length",resolutionTitle:"Resolution",aspectTitle:"Aspect ratio"},k0={appName:"Image Generator",imageModelLabel:"Model",imageModelAria:"Choose image model",quickSettingsAria:"Choose model and reasoning effort. Current model {model}, reasoning {effort}",quickSettingsModelOnlyAria:"Choose image model. Current model {model}",quickSettingsMenu:"Model and reasoning quick settings",reasoningLabel:"Reasoning",videoModelLabel:"Video",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."},L0={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:"GPT 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:"GPT OAuth is active",oauthBody:"GPT 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",grokEyebrow:"Local xAI proxy",grokTitle:"Grok image provider",grokBody:"Uses progrok at the configured local port for xAI Images API generation.",status:{ready:"Ready",authRequired:"Login required",starting:"Starting",offline:"Offline",noImageModel:"No image model",error:"Error",checking:"Checking"}},quota:{eyebrow:"Usage quota",title:"Rate limits",codexNotLoggedIn:"Not logged in",fetchError:"Could not load quota",noData:"No usage data",grokUsageLink:"View Grok usage →"},imageModel:{title:"Image model",body:"Choose the image model used for future generations. Selecting a Grok model switches the provider to Grok.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",grokImagine:"Grok Imagine",grokImagineQuality:"Grok Imagine Quality",gpt53CodexSpark:"GPT-5.3 Codex Spark — unsupported for images",unsupportedHelp:"Grok models use xAI's Images API through the bundled local proxy. GPT models use OpenAI Responses image generation."},videoModel:{grokImagine:"Grok Imagine Video",grokImagine15:"Grok Imagine Video 1.5"},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"},grokCompatibility:{title:"Grok compatibility",body:"Grok image generation first runs mandatory web search with grok-4.3, then sends text and attached images to a local image-tool planner that writes the final image prompt in English. Attached references route through xAI image editing; size is mapped to aspect ratio/resolution. Output format, moderation, and reasoning are only used by GPT OAuth and API key providers."},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."}},q0={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."},G0={title:"{provider} unavailable",ariaLabel:"{provider} unavailable"},H0={label:"Language",ko:"한국어",en:"English"},U0={label:"Theme",modeLabel:"Brightness",styleLabel:"Theme style",system:"System",dark:"Dark",light:"Light",family:{default:"Default",gpt:"GPT",claude:"Claude",gemini:"Gemini",grok:"Grok"}},B0={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:"GPT 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 `ima2 setup` in your terminal (option 1), 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 GPT 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:"GPT OAuth proxy unavailable",body:"The GPT OAuth proxy is starting, unavailable, or moved to a fallback port. Reload first; if it persists, run `ima2 doctor` and check the reported GPT 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 GPT OAuth or update the API key.",cta:"OK"}},P0={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."},F0={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"},V0={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."},Y0={controls:"Image zoom controls",zoomIn:"Zoom in",zoomOut:"Zoom out",reset:"Reset zoom"},K0={common:l0,appBar:i0,sheet:o0,toast:r0,inflight:s0,size:c0,sizeConfirm:u0,quality:d0,moderation:f0,format:m0,count:p0,multimode:h0,metadata:g0,readiness:y0,generate:v0,billing:b0,history:S0,panel:x0,prompt:T0,canvas:E0,gallery:N0,node:_0,nodeBatch:w0,edge:C0,provider:A0,cost:M0,result:R0,session:O0,uiMode:j0,agent:I0,cardNews:z0,video:D0,sidebar:k0,settings:L0,nodeCanvas:q0,apiDisabled:G0,language:H0,theme:U0,errorCard:B0,promptLibrary:P0,promptBuilder:F0,workspace:V0,viewer:Y0},Jp={ko:n0,en:K0};function $p(n,o){return o.split(".").reduce((i,r)=>{if(i!=null)return i[r]},n)}function X0(n,o){return n.replace(/\{(\w+)\}/g,(i,r)=>r in o?String(o[r]):`{${r}}`)}function W(n,o){const i=_.getState().locale;return Xh(i,n,o)}function Xh(n,o,i){const r=$p(Jp[n],o),u=typeof r=="string"?r:$p(Jp.en,o),f=typeof u=="string"?u:o;return i?X0(f,i):f}function ye(){const n=_(o=>o.locale);return{locale:n,t:(o,i)=>Xh(n,o,i)}}const ZE=["ko","en"];function Q0(){try{const n=localStorage.getItem("ima2.locale");if(n==="ko"||n==="en")return n}catch{}return typeof navigator<"u"&&(navigator.language||"").toLowerCase().startsWith("ko")?"ko":"en"}function Z0(n){try{localStorage.setItem("ima2.locale",n)}catch{}}function J0(n){return Math.round(n/16)*16}const En=16,Nu=3840,au=655360,br=8294400,$0=3,vl=3,Wp=Math.floor(Math.sqrt(br)/En)*En,Qh=En,W0=Nu,lr=$0;function eh(n){return Math.floor(n/16)*16}function Rr(n){return Math.ceil(n/16)*16}function Kt(n){return Math.min(W0,Math.max(Qh,n))}function na(n,o){const i=typeof n=="number"?n:Number.parseInt(n,10);return Number.isFinite(i)?i:o}function wn(n,o){n.includes(o)||n.push(o)}function th(n,o){const i=J0(n);return i!==n&&wn(o,"snap"),i}function ah(n,o){return n<Qh&&wn(o,"min"),n>Nu&&wn(o,"maxEdge"),Kt(n)}function nh(n,o,i){return n>o*lr?(wn(i,"ratio"),{w:n,h:Kt(Rr(n/lr))}):o>n*lr?(wn(i,"ratio"),{w:Kt(Rr(o/lr)),h:o}):{w:n,h:o}}function ex(n,o,i){if(n*o<au){wn(i,"minPixels");const p=Math.sqrt(au/(n*o));let m=Kt(Rr(n*p)),y=Kt(Rr(o*p));for(;m*y<au;)m<=y?m=Kt(m+En):y=Kt(y+En);return{w:m,h:y}}if(n*o<=br)return{w:n,h:o};wn(i,"maxPixels");const r=Math.sqrt(br/(n*o));let u=Kt(eh(n*r)),f=Kt(eh(o*r));for(;u*f>br;)u>=f?u=Kt(u-En):f=Kt(f-En);return{w:u,h:f}}function _u(n,o,i,r){const u=[],f=na(n,i),p=na(o,r);let m=ah(th(f,u),u),y=ah(th(p,u),u);return{w:m,h:y}=nh(m,y,u),{w:m,h:y}=ex(m,y,u),{w:m,h:y}=nh(m,y,u),{requestedW:f,requestedH:p,w:m,h:y,adjusted:m!==f||y!==p,reasons:u}}function Zh(n,o,i,r){const u=_u(n,o,i,r);return{w:u.w,h:u.h}}const tx=[{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 ax(n,o){return`${n}x${o}`}function nx(n,o=1024){if(n.id==="free")return null;const i=o,r=n.w>=n.h,u=r?Math.round(i*n.w/n.h):i,f=r?i:Math.round(i*n.h/n.w);return Zh(u,f,u,f)}function zr(n){const o=Zh(n.w,n.h,2400,1024);return{...n,w:o.w,h:o.h,label:n.label||`${o.w}×${o.h}`}}function bl(n){return n.slice(0,vl).map(zr)}function lx(n,o){const i=zr(o),r=n.findIndex(u=>u.id===i.id);return r>=0?bl(n.map((u,f)=>f===r?i:u)):n.length>=vl?bl(n):bl([...n,i])}function ix(n,o,i){const r=zr({...i,id:o});return bl(n.map(u=>u.id===o?r:u))}const ox=[{value:"1024x1024",label:"1024×1024",sub:"1:1"},{value:"1536x1024",label:"1536×1024",sub:"3:2"},{value:"1024x1536",label:"1024×1536",sub:"2:3"}],rx=[{value:"1360x1024",label:"1360×1024",sub:"4:3"},{value:"1024x1360",label:"1024×1360",sub:"3:4"},{value:"1824x1024",label:"1824×1024",sub:"16:9"}],sx=[{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"}],cx=[{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 ux(){return[{value:"auto",label:W("size.autoLabel"),sub:W("size.autoSub")},{value:"custom",label:W("size.customLabel"),sub:W("size.customSub")}]}const mu="gpt-5.4-mini",Tl=[{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"},{value:"grok-imagine-image",shortLabel:"grok",fullLabelKey:"settings.imageModel.grokImagine"},{value:"grok-imagine-image-quality",shortLabel:"grok+",fullLabelKey:"settings.imageModel.grokImagineQuality"}];Tl.filter(n=>!n.value.startsWith("grok-"));Tl.filter(n=>n.value.startsWith("grok-"));const dx=[{value:"gpt-5.3-codex-spark",fullLabelKey:"settings.imageModel.gpt53CodexSpark"}];function Jh(n){return Tl.some(o=>o.value===n)}function Sr(n){return typeof n=="string"&&n.startsWith("grok-")}function fx(n){return n?Tl.find(o=>o.value===n)?.shortLabel??n:null}const ir=[{value:"grok-imagine-video",shortLabel:"grokv",fullLabelKey:"settings.videoModel.grokImagine"},{value:"grok-imagine-video-1.5-preview",shortLabel:"grokv1.5",fullLabelKey:"settings.videoModel.grokImagine15"}],$h=10;function Wh(n){return n>=2?"reference-to-video":n===1?"image-to-video":"text-to-video"}function mx(n,o){return o==="reference-to-video"?Math.min(n,$h):n}const px="none",xr=[{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 eg(n){return xr.some(o=>o.value===n)}const hx={low:"l",medium:"m",high:"h",xhigh:"x"};function gx(n){return!eg(n)||n==="none"?null:`R:${hx[n]}`}const ct=["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","ima2.videoDefaults"],tg=ct[0],ag=ct[1],ng=ct[2],lg=ct[3],ig=ct[4],og=ct[5],rg=ct[6],sg=ct[7],cg=ct[8],ug=ct[9],dg=ct[10],pu=ct[11],hu=ct[12],lh=ct[13],nu=ct[14],ih=ct[15],fg=ct[19],yx=!0,xn=()=>"nc_"+Math.random().toString(36).slice(2,10);function oh(n,o){return{x:n*360,y:o*320}}function vx(n,o){return n.find(i=>i.target===o)??null}function bx(n,o,i){return n.some(r=>r.target===i&&r.source!==o)}function Wa(n,o){const i=new Map(n.map(r=>[r.id,r]));return n.map(r=>{const u=vx(o,r.id),p=(u?i.get(u.source):null)?.data.serverNodeId??null;return r.data.parentServerNodeId===p?r:{...r,data:{...r.data,parentServerNodeId:p}}})}const Sx=360,mg=320;function xx(n,o,i){const r=new Set(i.filter(u=>u.source===n).map(u=>u.target));return o.filter(u=>r.has(u.id))}function lu(n){const o=n.filter(r=>!r.data.parentServerNodeId);if(o.length===0)return oh(0,0);const i=Math.max(...o.map(r=>r.position.y));return{x:oh(0,0).x,y:i+mg}}function rh(n,o,i){const r=xx(n.id,o,i),u=n.position.x+Sx;if(r.length===0)return{x:u,y:n.position.y};const f=Math.max(...r.map(p=>p.position.y));return{x:u,y:f+mg}}const pg="ima2.nodeRefs.v1";function wu(){try{const n=localStorage.getItem(pg);if(!n)return{};const o=JSON.parse(n);return o&&typeof o=="object"?o:{}}catch{return{}}}function hg(n){try{localStorage.setItem(pg,JSON.stringify(n))}catch{}}function Tx(n,o){if(!n)return[];const i=wu()[n]?.[o];return Array.isArray(i)?i.filter(r=>typeof r=="string"):[]}function Tr(n,o,i){if(!n)return;const r=wu(),u={...r[n]??{}};i.length===0?delete u[o]:u[o]=i,r[n]=u,hg(r)}function iu(n,o){Tr(n,o,[])}function Ex(n,o){if(!n)return;const i=wu(),r=i[n];if(!r)return;const u=new Set(o);for(const f of Object.keys(r))u.has(f)||delete r[f];i[n]=r,hg(i)}function Nx(n,o,i){const r=new Set(n.map(m=>m.id));if(!r.has(i))return[];const u=new Map;for(const m of r)u.set(m,new Set);for(const m of o)!r.has(m.source)||!r.has(m.target)||(u.get(m.source)?.add(m.target),u.get(m.target)?.add(m.source));const f=new Set,p=[i];for(let m=0;m<p.length;m++){const y=p[m];if(!f.has(y)){f.add(y);for(const h of u.get(y)??[])f.has(h)||p.push(h)}}return n.filter(m=>f.has(m.id)).map(m=>m.id)}function gu(n){return n.filter(o=>o.selected).map(o=>o.id)}function Ci(n,o){const i=new Set(o);return n.map(r=>({...r,selected:i.has(r.id)}))}function _x(n,o,i,r){const u=new Set(Nx(n,o,i));if(!u.size)return n;if(!r)return Ci(n,u);const f=n.find(y=>y.id===i),p=n.some(y=>u.has(y.id)&&y.selected),m=new Set(gu(n));if(p)f?.selected?m.delete(i):m.add(i);else for(const y of u)m.add(y);return Ci(n,m)}function wx(n){return n.data.status==="ready"&&!!n.data.imageUrl}function Cx(n,o,i){const r=new Set(i),u=new Set(n.map(b=>b.id)),f=new Map,p=new Map;for(const b of r)u.has(b)&&(f.set(b,0),p.set(b,[]));for(const b of o)!r.has(b.source)||!r.has(b.target)||(p.get(b.source)?.push(b.target),f.set(b.target,(f.get(b.target)??0)+1));const m=n.map(b=>b.id),y=m.filter(b=>r.has(b)&&(f.get(b)??0)===0),h=[];for(let b=0;b<y.length;b++){const S=y[b];h.push(S);for(const T of p.get(S)??[])f.set(T,(f.get(T)??0)-1),(f.get(T)??0)===0&&y.push(T)}const x=new Set(h);return h.concat(m.filter(b=>r.has(b)&&!x.has(b)))}function Ax(n,o){const i=new Set(o),r=new Set,u=new Map;for(const p of n){const m=u.get(p.source)??[];m.push(p.target),u.set(p.source,m)}const f=[...i];for(let p=0;p<f.length;p++)for(const m of u.get(f[p])??[])i.has(m)||r.has(m)||(r.add(m),f.push(m));return[...r]}function Mx(n,o,i){const r=new Set(i);return n.filter(u=>u.source===o&&!r.has(u.target)).map(u=>u.target)}function Rx(n,o,i){const r=new Set(i),u=new Map(n.map(p=>[p.id,p])),f=[];for(const p of o){if(!r.has(p.target)||r.has(p.source))continue;u.get(p.source)?.data.serverNodeId||f.push(p.target)}return f}const Ai={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 Ox(n){const o=(n||"").toLowerCase();return o?o.includes("moderation_blocked")||o.includes("moderation refused")?"MODERATION_REFUSED":o.includes("no image data returned")?"EMPTY_RESPONSE":o.includes("stream could not be parsed")?"STREAM_PARSE_FAILED":o.includes("web search but not the image tool")?"WEB_SEARCH_ONLY_RESPONSE":o.includes("without calling the image tool")?"IMAGE_TOOL_NOT_CALLED":o.includes("image tool call failed")?"IMAGE_TOOL_FAILED":o.includes("image tool completed without image data")?"IMAGE_TOOL_COMPLETED_WITHOUT_RESULT":o.includes("token is expired")||o.includes("sign in again")||o.includes("access token")&&o.includes("expired")||o.includes("token")&&o.includes("expired")&&!o.includes("api key")?"AUTH_CHATGPT_EXPIRED":o.includes("incorrect api key")||o.includes("invalid authentication")||o.includes("exceeded your current quota")||o.includes("incorrect organization")?"AUTH_API_KEY_INVALID":o.includes("failed to fetch")||o.includes("econnrefused")||o.includes("econnreset")||o.includes("enotfound")||o.includes("etimedout")||o.includes("network error")?"NETWORK_FAILED":o.includes("oauth")&&(o.includes("not running")||o.includes("unavailable")||o.includes("not ready"))?"OAUTH_UNAVAILABLE":o.includes("invalid_request_error")||o.includes("invalid_value")||o.includes("invalid size")||o.includes("invalid request")||o.includes("requested resolution")||o.includes("minimum pixel budget")||o.includes("unsupported value")?"INVALID_REQUEST":o.includes("an error occurred while processing")||/\b5\d\d\b/.test(o)?"UPSTREAM_5XX":"UNKNOWN":"UNKNOWN"}function jx(n){const o=n,i=typeof o?.message=="string"?o.message:String(n??""),r=typeof o?.code=="string"?o.code:"",u=r&&r in Ai?r:Ox(i),f=Ai[u]??Ai.UNKNOWN;return{code:u,spec:f,message:i}}function xi(n,o){const{code:i,spec:r,message:u}=jx(n);if(r.surface==="card")o.showErrorCard(i,{fallbackMessage:u});else{const f=r.toastKey?W(r.toastKey):u||W("toast.generateFailed");o.showToast(f,!0)}return{code:i,message:u}}const Ii=!0,gg=!1,yg=!1,sh=10;function vg(n,o){return o?o.filename&&n.filename===o.filename?!0:n.image===o.image:!1}function Ix(n){return[n.canvasSourceFilename,n.canvasEditableFilename].filter(o=>!!o)}function _n(n){return n.filter(o=>!o.canvasVersion)}function ea(n,o){if(!o)return null;const i=_n(n);if(!o.canvasVersion)return i.find(f=>vg(f,o))??null;const r=Ix(o);return i.find(f=>f.filename?r.includes(f.filename):!1)??null}function zx(n,o){const i=_n(n),r=ea(n,o);return i.findIndex(u=>vg(u,r))}function Dx(n,o,i){const r=_n(n);if(r.length===0)return null;if(i==="first")return r[0]??null;if(i==="last")return r[r.length-1]??null;const u=zx(n,o);if(u<0)return null;if(i==="pagePrevious"||i==="pageNext"){const p=i==="pagePrevious"?-sh:sh,m=Math.max(0,Math.min(r.length-1,u+p));return r[m]??null}const f=i==="previous"?u-1:u+1;return r[f]??null}function ch(n,o){const i=_n(n),r=i.findIndex(u=>u.filename===o);return r<0?null:i[r+1]??i[r-1]??null}function Ot(n){return n.filename||n.image}function Mi(n){return!n.canvasVersion}function Er(n){const o=new Set;return n.filter(i=>{const r=Ot(i);return o.has(r)?!1:(o.add(r),!0)})}const bg=72,uh=10;function Sg(n,o){const i=n.sequenceIndex??Number.MAX_SAFE_INTEGER,r=o.sequenceIndex??Number.MAX_SAFE_INTEGER;return i!==r?i-r:(n.createdAt??0)-(o.createdAt??0)}function kx(n){return n<=1?1:n===2?2:4}function xg(n){const o=new Set,i=new Map,r=[];for(const u of n){if(!Mi(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),r.push(m)),m.items.push(u);continue}const f=Ot(u);o.has(f)||(o.add(f),r.push({type:"image",key:f,item:u}))}for(const u of i.values())u.items.sort(Sg);return r}function Tg(n,o){return o?`sequence:${o}`:n?.sequenceId?`sequence:${n.sequenceId}`:n?Ot(n):null}function ou(n){return n.type==="sequence"?{type:"sequence",sequenceId:n.sequenceId}:{type:"image",item:n.item}}function Lx(n,o,i,r,u=bg){const f=xg(n).slice(0,u);if(f.length===0)return null;const p=f[0],m=f[f.length-1];if(!p||!m)return null;if(i==="first")return ou(p);if(i==="last")return ou(m);const y=Tg(o,r),h=y?f.findIndex(T=>T.key===y):-1;if(h<0)return null;const x=i==="pagePrevious"?-uh:i==="pageNext"?uh:i==="previous"?-1:1,b=Math.max(0,Math.min(f.length-1,h+x));if(b===h)return null;const S=f[b];return S?ou(S):null}const Eg={promptBuilderSurface:"off",composerPlacement:"sidebar",multimodeHistoryGrouping:"individual",restoreComposerFromHistory:!0,viewerTools:"basic"},qx={promptBuilderSurface:"right-panel",composerPlacement:"bottom",multimodeHistoryGrouping:"sequence",restoreComposerFromHistory:!1,viewerTools:"zoom-pan"},Gx={default:Eg,"prompt-studio":qx};function ji(n,o){return Gx[n]??Eg}function Hx(n,o){return ji(n).promptBuilderSurface!=="off"}const Ux=/\.(mp4|webm|mov)$/i;function Sl(n){if(!n||n.startsWith("data:image/"))return!1;const o=n.split("?")[0];return Ux.test(o)||n.startsWith("data:video/")}function _a(n){return n?Sl(n.filename)||Sl(n.url)||Sl(n.image):!1}function yu(n){return new Promise((o,i)=>{const r=document.createElement("video");r.crossOrigin="anonymous",r.preload="auto",r.muted=!0,r.onloadedmetadata=()=>{r.currentTime=Math.max(0,r.duration-.1)},r.onseeked=()=>{try{const u=document.createElement("canvas");u.width=r.videoWidth,u.height=r.videoHeight;const f=u.getContext("2d");if(!f){i(new Error("canvas 2d context unavailable"));return}f.drawImage(r,0,0);const p=u.toDataURL("image/jpeg",.85);o(p)}catch(u){i(u)}finally{r.src="",r.load()}},r.onerror=()=>{i(new Error("Failed to load video for frame extraction"))},r.src=n})}const Nr="영상 생성 프롬프트에는 화면 흐름, 동작 흐름, 소리/무음, 대사/무대사, 마지막 프레임 의도를 입력해야 합니다. 선택한 초수 전체를 자연스럽게 쓰도록 초반 구도, 이어지는 동작/감정 변화, 안정된 마지막 화면까지 확장해 주세요.";function Bx(n){const o=n.length<=4?n:[n[0],...n.slice(-3)];return o.map((i,r)=>({...i,ordinal:r+1,role:r===0?"start":r===o.length-1?"parent":"ancestor"}))}function or(n){return typeof n=="string"&&n.trim()?n.trim():null}function Ng(n){if(n.videoContinuity?.entries?.length)return{...n.videoContinuity,parentFilename:n.filename??n.videoContinuity.parentFilename??null,sourceFrame:"last",entries:Bx(n.videoContinuity.entries)};const o=or(n.revisedPrompt)??or(n.prompt);if(!o)return null;const i=n.filename??null;return{lineageId:`lineage:${i??Date.now()}`,parentFilename:i,sourceFrame:"last",maxEntries:4,retention:"keep-start-plus-latest-3",entries:[{id:`clip:${i??"unknown"}`,ordinal:1,role:"start",filename:i,userPrompt:or(n.userPrompt)??or(n.prompt),revisedPrompt:o,createdAt:n.createdAt??Date.now()}]}}function Cu(n){return{image:n.url||n.image,url:n.url,filename:n.filename,prompt:n.prompt??null,userPrompt:n.userPrompt??null,revisedPrompt:n.revisedPrompt??null,createdAt:n.createdAt,mediaType:n.mediaType,videoContinuity:n.videoContinuity??null}}function Px(n){const o=n.entries[n.entries.length-1];return{id:`video-continuity:${n.lineageId}`,name:"Video Continuity",text:["Video continuity context:","The attached image is the last frame of the previous video.",o?`Continue from previous revisedPrompt #${o.ordinal}: ${o.revisedPrompt}`:null,"The new prompt must define next motion, camera, sound/music/no-music, dialogue/no-dialogue, and ending frame.","Pace the new clip to naturally fill the selected duration with a production-level sequence from the last-frame anchor."].filter(Boolean).join(`
27
- `)}}function _g(n){if(!n?.entries?.length)return null;const o=n.entries[n.entries.length-1];return`${n.entries.length}/4 clips · last frame · ${o?.filename??"unsaved source"}`}function Fx(){try{const n=localStorage.getItem(tg);return n===null?!0:JSON.parse(n)===!0}catch{return!0}}function Vx(){try{const n=localStorage.getItem(ag);if(n==="agent")return yg?n:"classic";if(n==="card-news")return gg?n:"classic";if(n==="node")return Ii?n:"classic";if(n==="classic")return n}catch{}return"classic"}function ru(){try{const n=localStorage.getItem(lg);if(n==="system"||n==="dark"||n==="light")return n}catch{}return"system"}function dh(){try{const n=localStorage.getItem(ig);if(n&&qb.includes(n))return n}catch{}return"default"}function Yx(){try{const n=localStorage.getItem(ng);if(n==="rail"||n==="horizontal"||n==="sidebar")return n}catch{}return"rail"}function fh(n){try{const o=localStorage.getItem(n);if(o==="current-session"||o==="all")return o}catch{}return"current-session"}function mh(){if(typeof window>"u")return{mode:"alpha",matteColor:"#ffffff"};try{const n=window.localStorage.getItem(og);if(!n)return{mode:"alpha",matteColor:"#ffffff"};const o=JSON.parse(n),i=o.mode==="matte"?"matte":"alpha",r=typeof o.matteColor=="string"&&/^#[0-9a-fA-F]{6}$/.test(o.matteColor)?o.matteColor:"#ffffff";return{mode:i,matteColor:r}}catch{return{mode:"alpha",matteColor:"#ffffff"}}}function ph(n,o){if(!(typeof window>"u"))try{window.localStorage.setItem(og,JSON.stringify({mode:n,matteColor:o}))}catch{}}function wg(){try{const n=localStorage.getItem(rg);if(Jh(n))return n}catch{}return mu}function rr(n){try{localStorage.setItem(rg,n)}catch{}}function Kx(){try{const n=localStorage.getItem(sg);if(eg(n))return n}catch{}return px}function Xx(n){try{localStorage.setItem(sg,n)}catch{}}function Qx(){try{const n=localStorage.getItem(cg);if(n==="false")return!1;if(n==="true")return!0}catch{}return yx}function Zx(n){try{localStorage.setItem(cg,String(n))}catch{}}const hh={model:!1,duration:5,resolution:"480p",aspectRatio:"auto"};function Au(){try{const n=localStorage.getItem(fg);if(!n)return hh;const o=JSON.parse(n);return{model:typeof o.model=="string"?o.model:!1,duration:typeof o.duration=="number"?o.duration:5,resolution:o.resolution==="480p"||o.resolution==="720p"?o.resolution:"480p",aspectRatio:typeof o.aspectRatio=="string"?o.aspectRatio:"auto"}}catch{return hh}}function Ti(n){try{const o=Au();localStorage.setItem(fg,JSON.stringify({...o,...n}))}catch{}}function sr(n){return n==="dark"||n==="light"?n:typeof window>"u"||typeof window.matchMedia!="function"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}const Cg=18e4,ml=new Set;function gh(n){const o=n.uiMode==="node"?[{kind:"node",sessionId:n.activeSessionId??void 0}]:[{kind:"classic"}];return n.inFlight.some(i=>i.kind==="multimode")&&o.push({kind:"multimode"}),o.push({kind:"video"}),o}function yh(n,o){const i=n.kind??"classic";return o.some(r=>i===r.kind&&(r.kind!=="node"||(n.sessionId??null)===(r.sessionId??null)))}async function vh(n){const o=await Promise.all(n.map(i=>Fh({kind:i.kind,sessionId:i.sessionId,includeTerminal:!0})));return{jobs:o.flatMap(i=>i.jobs),terminalJobs:o.flatMap(i=>i.terminalJobs??[])}}function cr(n,o){const i=o.filter(u=>u.placement!=="after"),r=o.filter(u=>u.placement==="after");return[...i.map(u=>u.text.trim()).filter(Boolean),n.trim(),...r.map(u=>u.text.trim()).filter(Boolean)].filter(Boolean).join(`
28
-
29
- `)}function Jx(n){if(!n||typeof n!="object")return null;const o=n;return typeof o.id!="string"||typeof o.name!="string"||typeof o.text!="string"?null:{id:o.id,name:o.name,text:o.text,placement:o.placement==="after"?"after":"before"}}function zi(n){if(!Array.isArray(n))return null;const o=n.map(Jx);return o.every(i=>i!==null)?o:null}function vu(n){return n.map(o=>({id:o.id,name:o.name,text:o.text,placement:o.placement==="after"?"after":"before"}))}function $x(n){const o=zi(n.composerInsertedPrompts);return typeof n.composerPrompt=="string"?{prompt:n.composerPrompt,insertedPrompts:o??[]}:o?{insertedPrompts:o}:{}}function ur(n){const o=n.meta??{},i=n.kind==="classic"||n.kind==="node"||n.kind==="multimode"?n.kind:o.kind==="classic"||o.kind==="node"||o.kind==="multimode"?o.kind:void 0;return{id:n.requestId,prompt:typeof n.prompt=="string"?n.prompt:"",startedAt:n.startedAt,composerPrompt:typeof o.composerPrompt=="string"?o.composerPrompt:void 0,composerInsertedPrompts:zi(o.composerInsertedPrompts)??void 0,phase:typeof n.phase=="string"?n.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:i}}function bh(n){const o=typeof n.errorCode=="string"&&n.errorCode?n.errorCode:"UNKNOWN",i=new Error(o==="EMPTY_RESPONSE"?"No image data returned from the image backend.":"Generation failed on the server.");return i.code=o,i.status=typeof n.httpStatus=="number"?n.httpStatus:void 0,i}function Sh(n){if(!n||typeof n!="object")return!1;const o=n;return o.code==="GENERATION_CANCELED"||o.status===499}function xh(n){return n.filename||n.image}function Th(n,o){const i=new Map(n.map(r=>[xh(r),r]));for(const r of o)i.set(xh(r),r);return[...i.values()].sort((r,u)=>(r.sequenceIndex??Number.MAX_SAFE_INTEGER)-(u.sequenceIndex??Number.MAX_SAFE_INTEGER))}function Eh(){try{const n=localStorage.getItem(dg);if(!n)return[];const o=JSON.parse(n);if(!Array.isArray(o))return[];const i=Date.now();return o.filter(r=>r&&typeof r.id=="string"&&typeof r.prompt=="string"&&typeof r.startedAt=="number"&&i-r.startedAt<Cg).map(r=>({id:r.id,prompt:r.prompt,startedAt:r.startedAt,composerPrompt:typeof r.composerPrompt=="string"?r.composerPrompt:void 0,composerInsertedPrompts:zi(r.composerInsertedPrompts)??void 0,phase:typeof r.phase=="string"?r.phase:void 0,sessionId:typeof r.sessionId=="string"?r.sessionId:null,parentNodeId:typeof r.parentNodeId=="string"?r.parentNodeId:null,clientNodeId:typeof r.clientNodeId=="string"?r.clientNodeId:null,kind:r.kind==="classic"||r.kind==="node"||r.kind==="multimode"||r.kind==="video"?r.kind:void 0}))}catch{return[]}}function St(n){try{localStorage.setItem(dg,JSON.stringify(n))}catch(o){const i=window;if(!i.__ima2QuotaWarned){i.__ima2QuotaWarned=!0,console.warn("[ima2] localStorage write failed:",o);try{_.getState().showToast(W("toast.localStorageFull"),!0)}catch{}}}}function Nh(){try{const n=localStorage.getItem(pu);return typeof n=="string"&&n.length>0?n:null}catch{return null}}function ta(n){try{n?localStorage.setItem(pu,n):localStorage.removeItem(pu)}catch{}}function Wx(){try{const n=localStorage.getItem(hu);return typeof n=="string"&&n.length>0?n:null}catch{return null}}function su(n){try{n?localStorage.setItem(hu,n):localStorage.removeItem(hu)}catch{}}const Yt=500,Vt=5;function e1(n){return n==="classic"||n==="edit"||n==="generate"||n==="card-news-card"||n==="card-news-set"?n:null}function Ei(n){const o=zi(n.composerInsertedPrompts);return{image:n.url,url:n.url,mediaType:n.mediaType,video:n.video??null,videoSeries:n.videoSeries??null,videoContinuity:n.videoContinuity??null,filename:n.filename,thumb:n.url,prompt:n.prompt??void 0,userPrompt:n.userPrompt??null,revisedPrompt:n.revisedPrompt??null,promptMode:n.promptMode??null,composerPrompt:n.composerPrompt??null,composerInsertedPrompts:o?vu(o):null,size:n.size??void 0,quality:n.quality??void 0,format:n.format,model:n.model??void 0,reasoningEffort:n.reasoningEffort??void 0,elapsed:n.elapsed??void 0,provider:n.provider,usage:n.usage??void 0,createdAt:n.createdAt,sessionId:n.sessionId??null,nodeId:n.nodeId??null,clientNodeId:n.clientNodeId??null,requestId:n.requestId??null,kind:e1(n.kind),canvasVersion:!!n.canvasVersion,canvasSourceFilename:n.canvasSourceFilename??null,canvasEditableFilename:n.canvasEditableFilename??null,canvasMergedAt:n.canvasMergedAt??void 0,setId:n.setId??null,cardId:n.cardId??null,cardOrder:n.cardOrder??null,headline:n.headline??null,body:n.body??null,cards:n.cards,refsCount:n.refsCount??0,isFavorite:n.isFavorite??!1,sequenceId:n.sequenceId??null,sequenceIndex:n.sequenceIndex??null,sequenceTotalRequested:n.sequenceTotalRequested??null,sequenceTotalReturned:n.sequenceTotalReturned??null,sequenceStatus:n.sequenceStatus??null}}function Xt(n){return n.filename??n.image}function Ag(n,o){const i=Xt(o);return n.filter(r=>Xt(r)!==i)}function Mg(n,o){const i=Xt(o);return n.find(r=>Xt(r)===i)}function Rg(n,o){return o?{...o,...n,createdAt:n.createdAt??o.createdAt,requestId:n.requestId??o.requestId,sessionId:n.sessionId??o.sessionId,kind:n.kind??o.kind,refsCount:n.refsCount??o.refsCount,isFavorite:n.isFavorite??o.isFavorite}:n}function _h(n,o){const i=new Map(n.map(r=>[Xt(r),r]));for(const r of o)i.set(Xt(r),r);return[...n.map(r=>i.get(Xt(r))??r),...o.filter(r=>!n.some(u=>Xt(u)===Xt(r)))]}function _r(n,o){return n.slice(0,Math.max(Yt,o))}function cu(n){return n.replace(/^data:[^;]+;base64,/,"")}async function dr(n,o="reference.png"){const i=await fetch(n);if(!i.ok)throw new Error(`reference fetch failed: ${i.status}`);const r=await i.blob(),u=new File([r],o,{type:r.type||"image/png"});return fu(u,{preserveTransparency:!1})}const pl="source-right",Ni="target-left";function fr(n,o,i,r){return`${n}:${i??"auto"}->${o}:${r??"auto"}`}function t1(n,o){return n&&n.startsWith(`${o}-`)?n:null}function a1(n){switch(n){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 Og(n){const o=n.nodes.map(r=>{const u=r.data??{},f=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=f??p,y={clientId:r.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,reasoningEffort:u.reasoningEffort,webSearchCalls:u.webSearchCalls,model:u.model??null,size:u.size??null,referenceImages:Tx(n.id,r.id),video:u.video??null};return{id:r.id,type:"imageNode",position:{x:r.x,y:r.y},data:y}}),i=n.edges.map(r=>{const u=r.data??{};return{id:r.id,source:r.source,target:r.target,sourceHandle:typeof u.sourceHandle=="string"?u.sourceHandle:null,targetHandle:typeof u.targetHandle=="string"?u.targetHandle:null}});return{graphNodes:Wa(o,i),graphEdges:i,graphVersion:n.graphVersion}}function n1(n,o){let i=!1;const r={};for(const[u,f]of Object.entries(n)){const p=f.images.filter(m=>m.filename!==o);if(p.length===f.images.length){r[u]=f;continue}i=!0,p.length!==0&&(r[u]={...f,images:p,returned:p.length,status:f.status==="complete"&&p.length<f.requested?"partial":f.status})}return i?r:n}function l1(n){const o=n.multimodePreviewFlightId;return o?o.startsWith("history:")?o.slice(8):n.multimodeSequences[o]?.sequenceId??null:null}function i1(n,o){return`${n}x${o}`}function Ri(n){return Math.min(8,Math.max(1,Math.trunc(n||1)))}const jg=new Set(["1024x1024","1536x1024","1024x1536","1360x1024","1024x1360","1824x1024","1024x1824","2048x2048","2048x1152","1152x2048","3840x2160","2160x3840","auto","custom"]);function o1(n){if(typeof n!="string")return{};if(jg.has(n))return{preset:n};const o=/^(\d+)x(\d+)$/.exec(n);if(!o)return{};const i=Number(o[1]),r=Number(o[2]);return!Number.isFinite(i)||!Number.isFinite(r)?{}:{preset:"custom",w:i,h:r}}function Ig(n){return n==="low"||n==="medium"||n==="high"}function zg(n){return n==="png"||n==="jpeg"||n==="webp"}function Dg(n){return n==="low"||n==="auto"}function r1(n){return n==="oauth"||n==="api"||n==="grok"}function s1(n){return n==="auto"||n==="direct"}function c1(n){return typeof n=="string"&&jg.has(n)}function kg(){try{const n=localStorage.getItem(ug);if(!n)return{};const o=JSON.parse(n),i={};r1(o.provider)&&(i.provider=o.provider),Ig(o.quality)&&(i.quality=o.quality),c1(o.sizePreset)&&(i.sizePreset=o.sizePreset),typeof o.customW=="number"&&Number.isFinite(o.customW)&&(i.customW=na(o.customW,1920)),typeof o.customH=="number"&&Number.isFinite(o.customH)&&(i.customH=na(o.customH,1088)),zg(o.format)&&(i.format=o.format),Dg(o.moderation)&&(i.moderation=o.moderation),typeof o.count=="number"&&(i.count=Ri(o.count)),typeof o.multimode=="boolean"&&(i.multimode=o.multimode),typeof o.multimodeMaxImages=="number"&&(i.multimodeMaxImages=Ri(o.multimodeMaxImages)),s1(o.promptMode)&&(i.promptMode=o.promptMode),typeof o.prompt=="string"&&(i.prompt=o.prompt);const r=zi(o.insertedPrompts);return r&&(i.insertedPrompts=r),i}catch{return{}}}function We(n){try{const o=kg();localStorage.setItem(ug,JSON.stringify({...o,...n}))}catch{}}function u1(n,o){const i={},r=o.userPrompt||o.prompt;typeof r=="string"&&(i.prompt=r),Ig(o.quality)&&(i.quality=o.quality),zg(o.format)&&(i.format=o.format),Dg(o.moderation)&&(i.moderation=o.moderation),(o.promptMode==="auto"||o.promptMode==="direct")&&(i.promptMode=o.promptMode),o.model&&Jh(o.model)&&(i.imageModel=o.model);const u=o1(o.size);return u.preset&&(i.sizePreset=u.preset),u.preset==="custom"&&u.w&&u.h&&(i.customW=na(u.w,n.customW),i.customH=na(u.h,n.customH)),i}function mr(n,o){if(n.sizePreset!=="custom")return null;const i=_u(n.customW,n.customH,n.customW,n.customH);return i.adjusted?{requestedW:i.requestedW,requestedH:i.requestedH,adjustedW:i.w,adjustedH:i.h,reasons:i.reasons,continuation:o}:null}const xt=kg(),Lg=wg(),wi=Au(),d1=wi.model||Sr(Lg)?"grok":(xt.provider??"oauth")==="grok"?"oauth":xt.provider??"oauth",_=Ph((n,o)=>({provider:d1,quality:xt.quality??"medium",sizePreset:xt.sizePreset??"1024x1024",customW:xt.customW??1920,customH:xt.customH??1088,format:xt.format??"png",moderation:xt.moderation??"low",count:xt.count??1,multimode:xt.multimode??!1,multimodeMaxImages:xt.multimodeMaxImages??4,multimodeSequences:{},multimodeAbortControllers:{},multimodePreviewFlightId:null,promptMode:xt.promptMode??"auto",prompt:xt.prompt??"",insertedPrompts:xt.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:Yh(),canvasOpen:!1,canvasZoom:1,canvasPanX:0,canvasPanY:0,canvasExportBackground:mh().mode,canvasExportMatteColor:mh().matteColor,addReferences:async i=>{const r=Vt-o().referenceImages.length,u=i.slice(0,Math.max(0,r)),f=u.filter(nr),p=u.filter(x=>!nr(x)),y=(await Promise.all(p.map(async x=>{try{return await fu(x,{preserveTransparency:Zp(x)})}catch(b){return console.warn("[addReferences] compress failed",b),null}}))).filter(x=>!!x);n(x=>({referenceImages:[...x.referenceImages,...y].slice(0,Vt)})),f.length>0&&o().showToast(W("toast.refHeicUnsupported"),!0),p.length-y.length>0&&o().showToast(W("toast.refTooLarge"),!0),i.length>r&&o().showToast(W("toast.refLimitExceeded"),!0)},addReferenceDataUrl:i=>{n(r=>r.referenceImages.length>=Vt?r:{referenceImages:[...r.referenceImages,i]})},metadataRestore:null,readDroppedImageMetadata:async(i,r=null)=>{if(!i.type.startsWith("image/"))return!1;let u="";try{u=await uS(i);const f=await $b({filename:i.name,dataUrl:u});return f.metadata?(n({metadataRestore:{filename:i.name,image:u,metadata:f.metadata,source:f.source??"xmp",targetNodeId:r}}),!0):!1}catch{return o().showToast(W("metadata.readFailed"),!0),!1}},applyMetadataRestore:()=>{const i=o().metadataRestore;if(!i)return;const r=u1(o(),i.metadata);if(r.imageModel&&rr(r.imageModel),i.targetNodeId&&typeof r.prompt=="string"){const u=r.prompt;n({...r,metadataRestore:null,graphNodes:o().graphNodes.map(f=>f.id===i.targetNodeId?{...f,data:{...f.data,prompt:u}}:f)}),o().scheduleGraphSave()}else n({...r,metadataRestore:null});o().showToast(W("metadata.applied"))},cancelMetadataRestore:()=>n({metadataRestore:null}),addMetadataRestoreAsReference:()=>{const i=o().metadataRestore;i&&(i.targetNodeId?o().addNodeReferenceDataUrl(i.targetNodeId,i.image):o().addReferenceDataUrl(i.image),n({metadataRestore:null}))},removeReference:i=>{n(r=>{const u=r.referenceImages.filter((m,y)=>y!==i),f=u.length===0,p=f?r.insertedPrompts.filter(m=>!m.id.startsWith("video-continuity:")):r.insertedPrompts;return p.length!==r.insertedPrompts.length&&We({insertedPrompts:p}),{referenceImages:u,insertedPrompts:p,videoContinuityLineage:f?null:r.videoContinuityLineage,canvasReferenceImage:r.referenceImages[i]===r.canvasReferenceImage?null:r.canvasReferenceImage}})},clearReferences:()=>{const i=o().insertedPrompts.filter(r=>!r.id.startsWith("video-continuity:"));i.length!==o().insertedPrompts.length&&We({insertedPrompts:i}),n({referenceImages:[],canvasReferenceImage:null,videoContinuityLineage:null,insertedPrompts:i})},attachCanvasVersionReference:async i=>{let r;try{r=await dr(i.image,i.filename||"canvas-version-reference.png")}catch{throw o().showToast(W("toast.currentImageLoadFailed"),!0),new Error("canvas_reference_attach_failed")}n(u=>{const p=(u.canvasReferenceImage?u.referenceImages.filter(m=>m!==u.canvasReferenceImage):u.referenceImages).filter(m=>m!==r);return{canvasReferenceImage:r,referenceImages:[r,...p].slice(0,Vt)}}),o().showToast(W("canvas.version.usingAsReference"))},useCurrentAsReference:async()=>{const i=o().currentImage;if(!i){o().showToast(W("toast.noCurrentImageForRef"),!0);return}if(o().referenceImages.length>=Vt){o().showToast(W("toast.refSlotFull"),!0);return}let r;try{r=await dr(i.image,i.filename||"current-reference.png")}catch{o().showToast(W("toast.currentImageLoadFailed"),!0);return}n(u=>({referenceImages:[...u.referenceImages,r].slice(0,Vt)})),o().showToast(W("toast.addedCurrentAsRef"))},useImageAsReference:async i=>{if(o().referenceImages.length>=Vt){o().showToast(W("toast.refSlotFull"),!0);return}let r;try{r=await dr(i.image,i.filename||"canvas-reference.png")}catch{o().showToast(W("toast.currentImageLoadFailed"),!0);return}n(u=>({referenceImages:[...u.referenceImages,r].slice(0,Vt)})),o().showToast(W("toast.addedCurrentAsRef"))},activeGenerations:0,unseenGeneratedCount:0,inFlight:[],cancelInFlightJob:async i=>{if(i){n(r=>{const u=r.inFlight.map(f=>f.id===i?{...f,phase:"canceling"}:f);return St(u),{inFlight:u}});try{await Wc(i),o().startInFlightPolling()}catch{o().showToast(W("toast.cancelFailed"),!0)}}},startInFlightPolling:()=>{if(typeof window>"u")return;const i=window;if(i.__ima2InflightTimer)return;const r=async()=>{if(o().inFlight.length===0&&o().activeGenerations===0){i.__ima2InflightTimer&&(clearInterval(i.__ima2InflightTimer),i.__ima2InflightTimer=void 0);return}let f=new Set;try{const p=gh(o()),{jobs:m,terminalJobs:y=[]}=await vh(p);f=new Set(m.map(P=>P.requestId));const h=new Map(m.map(P=>[P.requestId,P])),x=new Map(y.map(P=>[P.requestId,P])),b=[];let S=!1;const T=Date.now(),E=5e3,M=[];for(const P of o().inFlight){if(!yh(P,p)){M.push(P);continue}const Y=x.get(P.id);if(Y){S=!0,Y.status==="error"&&b.push(bh(Y));continue}if(!h.has(P.id)&&T-P.startedAt>E){S=!0;continue}const Z=h.get(P.id);if(Z){const k=ur(Z),ne={...P,phase:k.phase,sessionId:k.sessionId,parentNodeId:k.parentNodeId,clientNodeId:k.clientNodeId,kind:k.kind};(ne.phase!==P.phase||ne.sessionId!==P.sessionId||ne.parentNodeId!==P.parentNodeId||ne.clientNodeId!==P.clientNodeId||ne.kind!==P.kind)&&(S=!0),M.push(ne)}else M.push(P)}const O=new Set(M.map(P=>P.id));for(const P of m)O.has(P.requestId)||(M.push(ur(P)),S=!0);S&&(St(M),n({inFlight:M,activeGenerations:M.length}));for(const P of b)xi(P,o())}catch{}try{const p=o().history.reduce((b,S)=>S.createdAt&&S.createdAt>b?S.createdAt:b,0),{items:m}=await yl({limit:Yt,since:p}),y=m.map(Ei);y.length>0&&n(b=>{const S=new Set(b.history.map(Xt)),T=y.filter(M=>{const O=Xt(M);return S.has(O)?!1:(S.add(O),!0)});if(T.length===0)return{};const E=b.currentImage??T[0];return!b.currentImage&&T[0]?.filename&&ta(T[0].filename),{history:_r([...T,...b.history],Math.max(Yt,b.history.length+T.length)),currentImage:E,loadedHistoryRetainLimit:Math.max(b.loadedHistoryRetainLimit,b.history.length+T.length)}});const h=Date.now(),x=o().inFlight.filter(b=>f.has(b.id)||h-b.startedAt<Cg);x.length!==o().inFlight.length&&(St(x),n({inFlight:x,activeGenerations:x.length}))}catch{}};i.__ima2InflightTimer=window.setInterval(r,1500)},reconcileInflight:async()=>{try{const i=gh(o()),{jobs:r,terminalJobs:u=[]}=await vh(i),f=new Map(r.map(T=>[T.requestId,T])),p=new Map(u.map(T=>[T.requestId,T])),m=[],y=Date.now(),h=o().inFlight,b=(h.length>0?h:Eh()).flatMap(T=>{const E=f.get(T.id);if(E){const O=ur(E);return[{...T,...O,prompt:T.prompt||O.prompt,phase:T.phase||O.phase}]}if(!yh(T,i))return[T];const M=p.get(T.id);return M?(M.status==="error"&&m.push(bh(M)),[]):y-T.startedAt<1e4?[T]:[]}),S=new Set(b.map(T=>T.id));for(const T of r)S.has(T.requestId)||b.push(ur(T));St(b),n({inFlight:b,activeGenerations:b.length});for(const T of m)xi(T,o());b.length>0&&o().startInFlightPolling()}catch{}},syncFromStorage:()=>{const i=Eh(),r=Nh(),u=wg(),f=Au();n(p=>{const m=r?p.history.find(b=>b.filename===r)??null:null,y=m?ea(p.history,m):null,h=_n(p.history)[0]??null,x=p.currentImage?.canvasVersion?ea(p.history,p.currentImage)??h:p.currentImage;return{inFlight:i,activeGenerations:i.length,imageModel:u,videoModelSelected:f.model,videoDuration:f.duration,videoResolution:f.resolution,videoAspectRatio:f.aspectRatio,currentImage:r&&x?.filename!==r?y??x:x}}),i.length>0&&o().startInFlightPolling()},currentImage:null,applyMergedCanvasImage:i=>{n(r=>({history:i.filename?r.history.some(u=>u.filename===i.filename)?r.history.map(u=>u.filename===i.filename?i:u):_r([i,...r.history],r.loadedHistoryRetainLimit+1):r.history,loadedHistoryRetainLimit:Math.max(r.loadedHistoryRetainLimit,Math.min(r.history.length+1,r.loadedHistoryRetainLimit+1))}))},addGeneratedHistoryItem:async i=>{await pr(i,n,o)},history:[],historyNextCursor:null,historyLoadingOlder:!1,favoriteHistoryNextCursor:null,favoriteHistoryLoadingOlder:!1,loadedHistoryRetainLimit:Yt,loadOlderHistory:async()=>{const i=o().historyNextCursor;if(!(!i||o().historyLoadingOlder)){n({historyLoadingOlder:!0});try{const r=await yl({limit:Yt,cursor:i}),u=r.items.map(Ei);n(f=>{const p=new Set(f.history.map(y=>y.filename??y.image)),m=u.filter(y=>{const h=y.filename??y.image;return p.has(h)?!1:(p.add(h),!0)});return{history:[...f.history,...m],historyNextCursor:r.nextCursor,historyLoadingOlder:!1,loadedHistoryRetainLimit:Math.max(f.loadedHistoryRetainLimit,f.history.length+m.length)}})}catch{n({historyLoadingOlder:!1}),o().showToast(W("gallery.loadOlderFailed"),!0)}}},loadFavoriteHistory:async()=>{try{const i=await yl({limit:Yt,favoritesOnly:!0}),r=i.items.map(Ei);n(u=>{const f=_h(u.history,r);return{history:f,favoriteHistoryNextCursor:i.nextCursor,loadedHistoryRetainLimit:Math.max(u.loadedHistoryRetainLimit,f.length),galleryFavorites:new Set([...Array.from(u.galleryFavorites),...r.filter(p=>p.filename).map(p=>p.filename)])}})}catch{o().showToast(W("gallery.loadOlderFailed"),!0)}},loadOlderFavoriteHistory:async()=>{const i=o().favoriteHistoryNextCursor;if(!(!i||o().favoriteHistoryLoadingOlder)){n({favoriteHistoryLoadingOlder:!0});try{const r=await yl({limit:Yt,cursor:i,favoritesOnly:!0}),u=r.items.map(Ei);n(f=>{const p=_h(f.history,u);return{history:p,favoriteHistoryNextCursor:r.nextCursor,favoriteHistoryLoadingOlder:!1,loadedHistoryRetainLimit:Math.max(f.loadedHistoryRetainLimit,p.length),galleryFavorites:new Set([...Array.from(f.galleryFavorites),...u.filter(m=>m.filename).map(m=>m.filename)])}})}catch{n({favoriteHistoryLoadingOlder:!1}),o().showToast(W("gallery.loadOlderFailed"),!0)}}},trashPending:null,toast:null,toastLog:[],customSizeConfirm:null,errorCard:null,errorCardLog:[],rightPanelOpen:Fx(),toggleRightPanel:()=>n(i=>{const r=!i.rightPanelOpen;try{localStorage.setItem(tg,JSON.stringify(r))}catch{}return{rightPanelOpen:r}}),composeSheetOpen:!1,composeSheetTab:"prompt",openComposeSheet:(i="prompt")=>n({composeSheetOpen:!0,composeSheetTab:i}),setComposeSheetTab:i=>n({composeSheetTab:i}),closeComposeSheet:()=>n({composeSheetOpen:!1}),galleryOpen:!1,openGallery:()=>n(i=>({galleryOpen:!0,galleryScope:i.galleryDefaultScope})),closeGallery:()=>n({galleryOpen:!1}),galleryScope:fh(nu),galleryDefaultScope:fh(ih),setGalleryScope:i=>{try{localStorage.setItem(nu,i)}catch{}n({galleryScope:i})},setGalleryDefaultScope:i=>{try{localStorage.setItem(ih,i),localStorage.setItem(nu,i)}catch{}n({galleryDefaultScope:i,galleryScope:i})},imageModel:Lg,reasoningEffort:Kx(),webSearchEnabled:Qx(),settingsOpen:!1,activeSettingsSection:"account",readinessPopupOpen:!1,openSettings:(i="account")=>n({settingsOpen:!0,activeSettingsSection:i}),closeSettings:()=>n({settingsOpen:!1}),toggleSettings:()=>n(i=>({settingsOpen:!i.settingsOpen,activeSettingsSection:i.settingsOpen?i.activeSettingsSection:"account"})),setActiveSettingsSection:i=>n({activeSettingsSection:i}),openReadinessPopup:()=>n({readinessPopupOpen:!0}),closeReadinessPopup:()=>n({readinessPopupOpen:!1}),uiMode:Vx(),setUIMode:i=>{const r=i==="agent"&&!yg||i==="card-news"&&!gg?"classic":i;try{localStorage.setItem(ag,r)}catch{}n({uiMode:r})},theme:ru(),resolvedTheme:sr(ru()),themeFamily:dh(),historyStripLayout:Yx(),setTheme:i=>{try{localStorage.setItem(lg,i)}catch{}n({theme:i,resolvedTheme:sr(i)})},setThemeFamily:i=>{try{localStorage.setItem(ig,i)}catch{}n({themeFamily:i})},setHistoryStripLayout:i=>{try{localStorage.setItem(ng,i)}catch{}n({historyStripLayout:i})},syncThemeFromStorage:()=>{const i=ru();n({theme:i,resolvedTheme:sr(i)})},syncThemeFamilyFromStorage:()=>{n({themeFamily:dh()})},refreshResolvedTheme:()=>{n(i=>({resolvedTheme:sr(i.theme)}))},locale:Q0(),setLocale:i=>{Z0(i),n({locale:i})},graphNodes:[],graphEdges:[],setGraphNodes:i=>{n({graphNodes:Wa(i,o().graphEdges)}),o().scheduleGraphSave()},setGraphEdges:i=>{n({graphEdges:i,graphNodes:Wa(o().graphNodes,i)}),o().scheduleGraphSave()},disconnectEdge:i=>{o().disconnectEdges([i])},disconnectEdges:i=>{const r=new Set(i);if(r.size===0)return;const u=o().graphEdges.filter(y=>r.has(y.id));if(u.length===0)return;const f=o().graphEdges.filter(y=>!r.has(y.id)),p=new Set(u.map(y=>y.target)),m=o().graphNodes.map(y=>{if(!p.has(y.id))return y;const h=f.find(b=>b.target===y.id),x=h?o().graphNodes.find(b=>b.id===h.source):null;return{...y,data:{...y.data,parentServerNodeId:x?.data.serverNodeId??null}}});n({graphNodes:Wa(m,f),graphEdges:f}),o().scheduleGraphSave(),o().flushGraphSave("edge-disconnect"),o().showToast(W("edge.disconnected"))},nodeSelectionMode:!1,nodeBatchRunning:!1,nodeBatchStopping:!1,toggleNodeSelectionMode:()=>{const i=!o().nodeSelectionMode;n({nodeSelectionMode:i,...i?{}:{graphNodes:Ci(o().graphNodes,[])}})},selectAllGraphNodes:()=>{n({graphNodes:Ci(o().graphNodes,o().graphNodes.map(i=>i.id))})},selectNodeGraph:(i,r)=>{n({graphNodes:_x(o().graphNodes,o().graphEdges,i,r)})},clearNodeSelection:()=>{n({graphNodes:Ci(o().graphNodes,[])})},cancelNodeBatch:()=>{o().nodeBatchRunning&&(n({nodeBatchStopping:!0}),o().showToast(W("nodeBatch.stopQueued")))},sessions:[],activeSessionId:null,activeSessionGraphVersion:null,sessionLoading:!1,async loadSessions(){try{const{sessions:i}=await Wb();if(n({sessions:i}),!o().activeSessionId){const u=Wx(),f=u?i.some(p=>p.id===u):!1;u&&f?await o().switchSession(u):await o().createAndSwitchSession(W("session.firstGraph"))}}catch(i){console.warn("[sessions] load failed:",i)}},async switchSession(i){n({sessionLoading:!0}),await o().flushGraphSave("switch-session");try{const{session:r}=await Kh(i),{graphNodes:u,graphEdges:f,graphVersion:p}=Og(r);n({activeSessionId:i,activeSessionGraphVersion:p,graphNodes:u,graphEdges:f,sessionLoading:!1}),su(i),await o().reconcileGraphPending().catch(()=>{})}catch(r){console.warn("[sessions] switch failed:",r),n({sessionLoading:!1}),o().showToast(W("toast.sessionLoadFailed"),!0)}},async reconcileGraphPending(){const i=o().activeSessionId;if(!i)return;if(o().graphNodes.filter(u=>u.data?.pendingRequestId&&(u.data.status==="pending"||u.data.status==="reconciling")).length>0){let u=[];try{u=(await Fh({kind:"node",sessionId:i})).jobs}catch{u=[]}const f=new Map(u.map(h=>[h.requestId,h.phase])),p=Date.now(),m=1e4,y=o().graphNodes.map(h=>{const x=h.data?.pendingRequestId;if(!x||h.data.status!=="pending"&&h.data.status!=="reconciling")return h;if(f.has(x)){const T=f.get(x)??null;return{...h,data:{...h.data,status:"reconciling",pendingPhase:T}}}const b=h.data.pendingStartedAt??0;if(b&&p-b<m)return{...h,data:{...h.data,status:"reconciling"}};const S=!!h.data.imageUrl||!!h.data.serverNodeId;return{...h,data:{...h.data,pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,status:S?"ready":"stale",error:S?void 0:W("session.assetAbortedError")}}});n({graphNodes:y})}await Bg(o,n).catch(()=>{})},async createAndSwitchSession(i){i==null&&(i=W("session.untitled"));try{const{session:r}=await eS(i);n({sessions:[r,...o().sessions],activeSessionId:r.id,activeSessionGraphVersion:r.graphVersion,graphNodes:[],graphEdges:[]}),su(r.id)}catch(r){console.warn("[sessions] create failed:",r),o().showToast(W("toast.sessionCreateFailed"),!0)}},async renameCurrentSession(i){const r=o().activeSessionId;if(r)try{await tS(r,i),n({sessions:o().sessions.map(u=>u.id===r?{...u,title:i,updatedAt:Date.now()}:u)})}catch{o().showToast(W("toast.sessionRenameFailed"),!0)}},async deleteSessionById(i){try{await aS(i);const r=o().sessions.filter(u=>u.id!==i);n({sessions:r}),o().activeSessionId===i&&(n({activeSessionId:null,activeSessionGraphVersion:null,graphNodes:[],graphEdges:[]}),su(null),r.length>0?await o().switchSession(r[0].id):await o().createAndSwitchSession(W("session.firstGraph")))}catch{o().showToast(W("toast.sessionDeleteFailed"),!0)}},scheduleGraphSave(){Fg(o,n)},async flushGraphSave(i="manual"){await h1(o,n,i)},addRootNode:()=>{const i=xn(),r={id:i,type:"imageNode",position:lu(o().graphNodes),data:{clientId:i,serverNodeId:null,parentServerNodeId:null,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return n({graphNodes:[...o().graphNodes,r]}),o().scheduleGraphSave(),i},createRootNodeFromHistoryItem:i=>{const r=xn(),u={id:r,type:"imageNode",position:lu(o().graphNodes),data:{clientId:r,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,elapsed:i.elapsed??void 0,video:i.video??null}};return n({uiMode:"node",graphNodes:[...o().graphNodes,u]}),o().scheduleGraphSave(),r},addChildNode:i=>{const r=o().graphNodes.find(m=>m.id===i);if(!r)return i;const u=xn(),f={id:u,type:"imageNode",position:rh(r,o().graphNodes,o().graphEdges),data:{clientId:u,serverNodeId:null,parentServerNodeId:r.data.serverNodeId,prompt:Sl(r.data.imageUrl)&&r.data.prompt||"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},p={id:fr(i,u,pl,Ni),source:i,target:u,sourceHandle:pl,targetHandle:Ni};if(n({graphNodes:[...o().graphNodes,f],graphEdges:[...o().graphEdges,p]}),o().scheduleGraphSave(),r.data.imageUrl&&Sl(r.data.imageUrl)){const m=r.data.imageUrl;r.data.video&&r.data.video.topic&&o().setVideoTopic(r.data.video.topic),(async()=>{try{const y=await yu(m);n({graphNodes:o().graphNodes.map(h=>h.id===u?{...h,data:{...h.data,referenceImages:[y]}}:h)}),o().scheduleGraphSave()}catch{}})()}return u},addSiblingNode:i=>{const r=o().graphNodes.find(x=>x.id===i);if(!r)return i;const u=o().graphEdges.find(x=>x.target===i);if(!u){const x=xn(),b={id:x,type:"imageNode",position:lu(o().graphNodes),data:{clientId:x,serverNodeId:null,parentServerNodeId:null,prompt:r.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return n({graphNodes:[...o().graphNodes,b]}),o().scheduleGraphSave(),x}const f=u.source,p=o().graphNodes.find(x=>x.id===f);if(!p)return i;const m=xn(),y={id:m,type:"imageNode",position:rh(p,o().graphNodes,o().graphEdges),data:{clientId:m,serverNodeId:null,parentServerNodeId:r.data.parentServerNodeId,prompt:r.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},h={id:fr(f,m,pl,Ni),source:f,target:m,sourceHandle:pl,targetHandle:Ni};return n({graphNodes:[...o().graphNodes,y],graphEdges:[...o().graphEdges,h]}),o().scheduleGraphSave(),m},updateNodePrompt:(i,r)=>{n({graphNodes:o().graphNodes.map(u=>u.id===i?{...u,data:{...u.data,prompt:r}}:u)}),o().scheduleGraphSave()},addNodeReferences:async(i,r)=>{const u=o().graphNodes.find(T=>T.id===i);if(!u)return;const f=u.data.referenceImages??[],p=Vt-f.length;if(p<=0){o().showToast(W("toast.refLimitExceeded"),!0);return}const m=r.slice(0,Math.max(0,p)),y=m.filter(nr),h=m.filter(T=>!nr(T)),b=(await Promise.all(h.map(async T=>{try{return await fu(T,{preserveTransparency:Zp(T)})}catch(E){return console.warn("[addNodeReferences] compress failed",E),null}}))).filter(T=>!!T);if(b.length>0){const T=o().activeSessionId;n({graphNodes:o().graphNodes.map(E=>{if(E.id!==i)return E;const M=[...E.data.referenceImages??[],...b].slice(0,Vt);return Tr(T,i,M),{...E,data:{...E.data,referenceImages:M}}})}),o().scheduleGraphSave()}y.length>0&&o().showToast(W("toast.refHeicUnsupported"),!0),h.length-b.length>0&&o().showToast(W("toast.refTooLarge"),!0),r.length>p&&o().showToast(W("toast.refLimitExceeded"),!0)},addNodeReferenceDataUrl:(i,r)=>{o().graphNodes.find(f=>f.id===i)&&(n({graphNodes:o().graphNodes.map(f=>{if(f.id!==i)return f;const p=f.data.referenceImages??[];if(p.length>=Vt)return f;const m=[...p,r];return Tr(o().activeSessionId,i,m),{...f,data:{...f.data,referenceImages:m}}})}),o().scheduleGraphSave())},removeNodeReference:(i,r)=>{n({graphNodes:o().graphNodes.map(u=>{if(u.id!==i)return u;const f=(u.data.referenceImages??[]).filter((p,m)=>m!==r);return Tr(o().activeSessionId,i,f),{...u,data:{...u.data,referenceImages:f}}})}),o().scheduleGraphSave()},clearNodeReferences:i=>{iu(o().activeSessionId,i),n({graphNodes:o().graphNodes.map(r=>r.id===i?{...r,data:{...r.data,referenceImages:void 0}}:r)}),o().scheduleGraphSave()},duplicateBranchRoot:i=>{const r=o().graphNodes.find(p=>p.id===i);if(!r)return i;const u=xn();o().graphNodes.filter(p=>!p.data.parentServerNodeId).length;const f={id:u,type:"imageNode",position:{x:r.position.x+420,y:r.position.y+40},data:{clientId:u,serverNodeId:null,parentServerNodeId:null,prompt:r.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};if(n({graphNodes:[...o().graphNodes,f]}),o().scheduleGraphSave(),r.data.imageUrl){const p=r.data.imageUrl;(async()=>{try{const m=await dr(p,"node-reference.png");n({graphNodes:o().graphNodes.map(y=>y.id===u?{...y,data:{...y.data,referenceImages:[m]}}:y)})}catch{}})()}return u},async generateNode(i){const r=o().graphNodes.find(p=>p.id===i);if(!r)return;const{prompt:u}=r.data;if(!u.trim()){o().showToast(W("toast.promptRequired"),!0);return}if(o().videoModelSelected)return o().runVideoGenerate(i);const f=mr(o(),{kind:"node",clientId:i});if(f){n({customSizeConfirm:f});return}await o().runGenerateNode(i)},async generateNodeInPlace(i){const r=o().graphNodes.find(f=>f.id===i);if(!r)return;if(!r.data.prompt.trim()){o().showToast(W("toast.promptRequired"),!0);return}if(o().videoModelSelected)return o().runVideoGenerate(i);const u=mr(o(),{kind:"node-in-place",clientId:i});if(u){n({customSizeConfirm:u});return}await o().runGenerateNodeInPlace(i)},async generateNodeVariation(i,r){const u=o().graphNodes.find(p=>p.id===i);if(!u)return;if(!u.data.prompt.trim()){o().showToast(W("toast.promptRequired"),!0);return}if(o().videoModelSelected){const p=o().addSiblingNode(i);return o().runVideoGenerate(p)}if(!r){const p=mr(o(),{kind:"node-variation",clientId:i});if(p){n({customSizeConfirm:p});return}}const f=o().addSiblingNode(i);await o().runGenerateNodeInPlace(f,{sizeOverride:r})},async runGenerateNode(i,r){const f=o().graphNodes.find(p=>p.id===i)?.data.status==="ready"?o().addSiblingNode(i):i;await o().runGenerateNodeInPlace(f,{sizeOverride:r})},async runGenerateNodeInPlace(i,r={}){if(ml.has(i))return null;ml.add(i);const u=o().graphNodes,f=Wa(u,o().graphEdges);f.some((k,ne)=>k.data.parentServerNodeId!==u[ne]?.data.parentServerNodeId)&&n({graphNodes:f});const p=f.find(k=>k.id===i);if(!p)return ml.delete(i),null;const{prompt:m,parentServerNodeId:y}=p.data;if(!m.trim())return o().showToast(W("toast.promptRequired"),!0),ml.delete(i),null;const h=p.data.referenceImages??[],x=o(),b=r.sizeOverride??x.getResolvedSize(),S=r.parentServerNodeIdOverride!==void 0?r.parentServerNodeIdOverride:y;if(o().graphEdges.find(k=>k.target===i)&&!S)return o().showToast(W("node.parentImageRequired"),!0),ml.delete(i),null;const E=x.activeSessionId,M=Date.now(),O=Math.random().toString(36).slice(2,6),P=`fn_${i}_${M}_${O}`,Y=[...x.inFlight,{id:P,prompt:m,startedAt:M,kind:"node",sessionId:E,clientNodeId:i}];St(Y),n({graphNodes:o().graphNodes.map(k=>k.id===i?{...k,data:{...k.data,status:"pending",pendingRequestId:P,recoveryRequestId:P,pendingPhase:"queued",pendingStartedAt:M,partialImageUrl:null,error:void 0,size:b}}:k),activeGenerations:x.activeGenerations+1,inFlight:Y}),o().startInFlightPolling();let Z=!0;try{const k=await Hb({parentNodeId:S,prompt:m,quality:x.quality,size:b,format:x.format,moderation:x.moderation,provider:x.provider,model:x.imageModel,reasoningEffort:x.reasoningEffort,requestId:P,sessionId:E,clientNodeId:i,contextMode:"parent-plus-refs",searchMode:x.webSearchEnabled?"on":"off",webSearchEnabled:x.webSearchEnabled,...h.length?{references:h.map(cu)}:{}},{onPartial:ne=>{o().activeSessionId===E&&n({graphNodes:o().graphNodes.map(F=>F.id===i?{...F,data:{...F.data,status:"pending",partialImageUrl:ne.image,pendingPhase:"partial"}}:F)})},onPhase:ne=>{o().activeSessionId===E&&ne.phase&&n({graphNodes:o().graphNodes.map(F=>F.id===i?{...F,data:{...F.data,pendingPhase:ne.phase??F.data.pendingPhase}}:F)})}});return o().activeSessionId===E&&(n({graphNodes:o().graphNodes.map(ne=>{if(ne.id!==i)return ne;const F={...ne.data};return delete F.partialImageUrl,{...ne,data:{...F,serverNodeId:k.nodeId,imageUrl:k.url,status:"ready",pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,elapsed:k.elapsed,reasoningEffort:k.reasoningEffort,webSearchCalls:k.webSearchCalls,model:k.model??null,size:k.size??b}}})}),Z=!0,r.suppressToast||o().showToast(W("toast.nodeCreated",{id:k.nodeId.slice(0,8),elapsed:k.elapsed}))),k.nodeId}catch(k){const ne=k instanceof Error?k.message:W("toast.nodeCreateFailed");return o().activeSessionId===E&&(n({graphNodes:o().graphNodes.map(F=>F.id===i?{...F,data:{...F.data,status:"error",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:ne}}:F)}),Z=!0,xi(k,o())),null}finally{ml.delete(i);const k=o().inFlight.filter(ne=>ne.id!==P);St(k),n({activeGenerations:Math.max(0,o().activeGenerations-1),inFlight:k}),o().activeSessionId===E&&Z&&(o().scheduleGraphSave(),o().flushGraphSave("node-complete"))}},async runNodeBatch(i){if(o().nodeBatchRunning)return;const r=gu(o().graphNodes);if(r.length===0){o().showToast(W("nodeBatch.noneSelected"),!0);return}const u=Rx(o().graphNodes,o().graphEdges,r);if(u.length>0){o().showToast(W("nodeBatch.parentRequired",{count:u.length}),!0);return}const f=Cx(o().graphNodes,o().graphEdges,r),p=new Set(r),m=f.filter(x=>{if(i==="regenerate-all")return!0;const b=o().graphNodes.find(S=>S.id===x);return b?!wx(b):!1});if(m.length===0){o().showToast(W("nodeBatch.nothingToRun"));return}n({nodeBatchRunning:!0,nodeBatchStopping:!1});const y=new Map;let h=0;try{for(const x of m){if(o().nodeBatchStopping)break;const b=o().graphEdges.find(O=>O.target===x),S=b?y.get(b.source)??o().graphNodes.find(O=>O.id===x)?.data.parentServerNodeId??null:null,T=o().videoModelSelected?await o().runVideoGenerate(x).then(()=>o().graphNodes.find(P=>P.id===x)?.data.serverNodeId??null):await o().runGenerateNodeInPlace(x,{parentServerNodeIdOverride:S,suppressToast:!0});if(!T){o().showToast(W("nodeBatch.failed",{done:h,total:m.length}),!0);break}h+=1,y.set(x,T);const E=Mx(o().graphEdges,x,p),M=new Set(Ax(o().graphEdges,p));n({graphNodes:o().graphNodes.map(O=>M.has(O.id)?{...O,data:{...O.data,status:"stale",parentServerNodeId:E.includes(O.id)?T:O.data.parentServerNodeId,error:W("nodeBatch.staleBecauseParentChanged")}}:O)})}o().showToast(W("nodeBatch.finished",{done:h,total:m.length})),o().scheduleGraphSave()}finally{n({nodeBatchRunning:!1,nodeBatchStopping:!1})}},deleteNode:i=>{const u=o().graphNodes.find(m=>m.id===i)?.data?.pendingRequestId;u&&Wc(u),iu(o().activeSessionId,i);const f=o().graphNodes.filter(m=>m.id!==i),p=o().graphEdges.filter(m=>m.source!==i&&m.target!==i);n({graphNodes:Wa(f,p),graphEdges:p}),o().scheduleGraphSave()},deleteNodes:i=>{const r=new Set(i);for(const p of r)iu(o().activeSessionId,p);for(const p of o().graphNodes)r.has(p.id)&&p.data?.pendingRequestId&&Wc(p.data.pendingRequestId);const u=o().graphNodes.filter(p=>!r.has(p.id)),f=o().graphEdges.filter(p=>!r.has(p.source)&&!r.has(p.target));n({graphNodes:Wa(u,f),graphEdges:f}),o().scheduleGraphSave()},addChildNodeAt:(i,r,u=pl)=>{const f=o().graphNodes.find(b=>b.id===i);if(!f)return i;const p=xn(),m=t1(u,"source")??pl,y=a1(m)??Ni,h={id:p,type:"imageNode",position:r,data:{clientId:p,serverNodeId:null,parentServerNodeId:f.data.serverNodeId,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},x={id:fr(i,p,m,y),source:i,target:p,sourceHandle:m,targetHandle:y};return n({graphNodes:[...o().graphNodes,h],graphEdges:[...o().graphEdges,x]}),o().scheduleGraphSave(),p},connectNodes:(i,r,u=null,f=null)=>{if(i===r||o().graphEdges.find(h=>h.source===i&&h.target===r))return;if(bx(o().graphEdges,i,r)){o().showToast(W("edge.parentConflict"),!0);return}if(!o().graphNodes.find(h=>h.id===i))return;const y=[...o().graphEdges,{id:fr(i,r,u,f),source:i,target:r,sourceHandle:u,targetHandle:f}];n({graphNodes:Wa(o().graphNodes,y),graphEdges:y}),o().scheduleGraphSave()},setProvider:i=>{We({provider:i});const r=o().imageModel;if(i==="grok"&&!Sr(r)){const u="grok-imagine-image";rr(u),n({provider:i,imageModel:u})}else i!=="grok"&&Sr(r)?(n({provider:i,imageModel:mu}),rr(mu)):n({provider:i})},setQuality:i=>{We({quality:i}),n({quality:i})},setSizePreset:i=>{We({sizePreset:i}),n({sizePreset:i})},setCustomSize:(i,r)=>n(u=>{const f=na(i,u.customW),p=na(r,u.customH);return We({customW:f,customH:p}),{customW:f,customH:p}}),setFormat:i=>{We({format:i}),n({format:i})},setModeration:i=>{We({moderation:i}),n({moderation:i})},setImageModel:i=>{if(rr(i),n({videoModelSelected:!1}),Ti({model:!1}),Sr(i)){We({provider:"grok"}),n({provider:"grok",imageModel:i});return}if(o().provider==="grok"){We({provider:"oauth"}),n({provider:"oauth",imageModel:i});return}n({imageModel:i})},videoModelSelected:wi.model,videoDuration:wi.duration,videoResolution:wi.resolution,videoAspectRatio:wi.aspectRatio,videoTopic:"",videoContinuityLineage:null,videoProgress:null,selectVideoModel:i=>{const r=i||"grok-imagine-video";n({videoModelSelected:r}),Ti({model:r}),o().provider!=="grok"&&o().setProvider("grok")},setVideoDuration:i=>{n({videoDuration:i}),Ti({duration:i})},setVideoResolution:i=>{n({videoResolution:i}),Ti({resolution:i})},setVideoAspectRatio:i=>{n({videoAspectRatio:i}),Ti({aspectRatio:i})},setVideoTopic:i=>n({videoTopic:i}),setVideoContinuityLineage:i=>n({videoContinuityLineage:i}),activeVideoRefCount:()=>{const i=o();if(i.uiMode==="node"){const r=gu(i.graphNodes)[0];return i.graphNodes.find(f=>f.id===r)?.data.referenceImages?.length??0}return i.referenceImages.length},runVideoGenerate:async i=>{const r=i?o().graphNodes.find(M=>M.id===i):null,u=r?r.data.referenceImages??[]:o().referenceImages,f=Wh(u.length),p=r?r.data.prompt.trim():cr(o().prompt,o().insertedPrompts);if(!p.trim()){o().showToast(Nr,!0);return}let m,y,h=r?r.data.videoContinuity??null:o().videoContinuityLineage,x;if(r&&u.length===0&&r.data.parentServerNodeId){const M=o().graphNodes.find(O=>O.data.serverNodeId===r.data.parentServerNodeId);if(M?.data.imageUrl)if(Sl(M.data.imageUrl))try{y=await yu(M.data.imageUrl),h=M.data.videoContinuity??Ng({filename:M.data.imageUrl.replace(/^\/generated\//,""),prompt:M.data.prompt,userPrompt:M.data.prompt,revisedPrompt:M.data.prompt,createdAt:Date.now(),videoContinuity:null}),x=M.data.imageUrl.replace(/^\/generated\//,"")}catch{}else m=M.data.imageUrl.replace(/^\/generated\//,"")}const b=Date.now(),S=`vid_${b}_${Math.random().toString(36).slice(2,6)}`,T=o().activeSessionId,E=[...o().inFlight,{id:S,prompt:p,startedAt:b,kind:"video",sessionId:T,clientNodeId:i??null}];St(E),r&&n({graphNodes:o().graphNodes.map(M=>M.id===i?{...M,data:{...M.data,status:"pending",pendingRequestId:S,pendingPhase:"queued",pendingStartedAt:b,partialImageUrl:null,error:void 0}}:M)}),n({inFlight:E,activeGenerations:E.length,videoProgress:0}),o().startInFlightPolling();try{const M=await Kp({prompt:p,requestId:S,model:typeof o().videoModelSelected=="string"&&o().videoModelSelected||void 0,referenceImages:u.length>=2?u:void 0,sourceImage:u.length===1?u[0]:y,sourceFilename:u.length===0&&!y?m:void 0,continueFromVideo:x,continuityLineage:h,duration:mx(o().videoDuration,f),resolution:o().videoResolution,aspectRatio:o().videoAspectRatio,topic:o().videoTopic||void 0,sessionId:T,clientNodeId:i??null},{onPlanning:()=>n({inFlight:o().inFlight.map(O=>O.id===S?{...O,phase:"planning"}:O)}),onSubmitted:()=>n({inFlight:o().inFlight.map(O=>O.id===S?{...O,phase:"streaming"}:O)}),onProgress:({progress:O})=>n({videoProgress:O??null})});r&&M&&o().activeSessionId===T&&(n({graphNodes:o().graphNodes.map(O=>O.id===i?{...O,data:{...O.data,serverNodeId:M.filename.replace(/\.[^.]+$/,""),imageUrl:M.url,status:"ready",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,elapsed:M.elapsed??void 0,model:null,videoContinuity:M.videoContinuity??h,video:{...M.video??{},...M.videoSeries?.topic?{topic:M.videoSeries.topic}:{}}}}:O)}),o().scheduleGraphSave(),o().flushGraphSave("video-node-complete"))}catch(M){const O=M instanceof Error?M.message:"Video generation failed";r&&o().activeSessionId===T&&n({graphNodes:o().graphNodes.map(P=>P.id===i?{...P,data:{...P.data,status:"error",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,error:O}}:P)}),o().showToast(O,!0)}finally{const M=o().inFlight.filter(O=>O.id!==S);St(M),n({inFlight:M,activeGenerations:M.length,videoProgress:null}),o().startInFlightPolling()}},animateImage:async(i,r)=>{const u=r?.trim();if(!u)throw o().showToast(Nr,!0),new Error(Nr);const f=Date.now(),p=`vid_${f}_${Math.random().toString(36).slice(2,6)}`,m=[...o().inFlight,{id:p,prompt:u,startedAt:f,kind:"video",sessionId:o().activeSessionId,clientNodeId:null}];St(m),n({inFlight:m,activeGenerations:m.length,videoProgress:0}),o().startInFlightPolling();try{await Kp({prompt:u,requestId:p,mode:"image-to-video",sourceFilename:i,duration:5,resolution:"480p",aspectRatio:"auto"},{onPlanning:()=>n({inFlight:o().inFlight.map(y=>y.id===p?{...y,phase:"planning"}:y)}),onSubmitted:()=>n({inFlight:o().inFlight.map(y=>y.id===p?{...y,phase:"streaming"}:y)}),onProgress:({progress:y})=>n({videoProgress:y??null})})}catch(y){const h=y instanceof Error?y.message:"Video generation failed";o().showToast(h,!0)}finally{const y=o().inFlight.filter(h=>h.id!==p);St(y),n({inFlight:y,activeGenerations:y.length,videoProgress:null}),o().startInFlightPolling()}},setReasoningEffort:i=>{Xx(i),n({reasoningEffort:i})},setWebSearchEnabled:i=>{Zx(i),n({webSearchEnabled:i})},setCount:i=>{const r=Ri(i);We({count:r}),n({count:r})},setMultimode:i=>{if(i&&o().uiMode!=="classic")return;We({multimode:i});const r=o();n({multimode:i,multimodeSequences:i?r.multimodeSequences:{},multimodePreviewFlightId:i?r.multimodePreviewFlightId:null})},setMultimodeMaxImages:i=>{const r=Ri(i);We({multimodeMaxImages:r}),n({multimodeMaxImages:r})},setPromptMode:i=>{We({promptMode:i}),n({promptMode:i})},setPrompt:i=>{We({prompt:i}),n({prompt:i})},insertPromptToComposer:i=>n(r=>{const u=r.insertedPrompts.some(m=>m.id===i.id),f={...i,placement:i.placement==="after"?"after":"before"},p=u?r.insertedPrompts:[...r.insertedPrompts,f];return We({insertedPrompts:p}),{insertedPrompts:p}}),removeInsertedPromptFromComposer:i=>n(r=>{const u=r.insertedPrompts.filter(f=>f.id!==i);return We({insertedPrompts:u}),{insertedPrompts:u,videoContinuityLineage:i.startsWith("video-continuity:")?null:r.videoContinuityLineage}}),moveInsertedPromptInComposer:(i,r)=>n(u=>{const f=u.insertedPrompts.filter(T=>T.placement!=="after"),p=u.insertedPrompts.filter(T=>T.placement==="after"),m=[...f.map(T=>({kind:"prompt",prompt:T})),{kind:"main"},...p.map(T=>({kind:"prompt",prompt:T}))],y=m.findIndex(T=>T.kind==="prompt"&&T.prompt.id===i);if(y<0)return{};const h=r==="up"?y-1:y+1;if(h<0||h>=m.length)return{};const[x]=m.splice(y,1);m.splice(h,0,x);const b=m.findIndex(T=>T.kind==="main"),S=m.filter(T=>T.kind==="prompt").map((T,E)=>({...T.prompt,placement:E<b?"before":"after"}));return We({insertedPrompts:S}),{insertedPrompts:S}}),clearInsertedPrompts:()=>{We({insertedPrompts:[]}),n({insertedPrompts:[],videoContinuityLineage:null})},selectHistory:i=>{const r=o().history,u=i.canvasVersion?ea(r,i)??_n(r)[0]??null:ea(r,i)??i;ta(u?.filename??null);const f=ji(o().workspaceProfile).restoreComposerFromHistory,p=o().prompt,m=o().insertedPrompts,y=p.trim()!==""||m.length>0,h=f&&u&&!y?$x(u):{};n({currentImage:u,unseenGeneratedCount:0,multimodePreviewFlightId:null,...h})},showHistorySequence:i=>{const r=o().history.filter(y=>y.sequenceId===i&&!y.canvasVersion).sort(Sg);if(r.length===0)return;const u=`history:${i}`,f=Math.max(r.length,...r.map(y=>y.sequenceTotalRequested??0)),p=r.length,m=r[0]?.sequenceStatus==="empty"?"empty":p>=f?"complete":"partial";ta(null),n(y=>({currentImage:null,unseenGeneratedCount:0,canvasOpen:!1,multimodePreviewFlightId:u,multimodeSequences:{...y.multimodeSequences,[u]:{sequenceId:i,requestId:u,requested:f,returned:p,images:r,partials:[],status:m}}}))},markGeneratedResultsSeen:()=>n({unseenGeneratedCount:0}),selectHistoryShortcutTarget:i=>{const r=o(),u=ji(r.workspaceProfile);if(r.uiMode==="classic"&&u.multimodeHistoryGrouping==="sequence"){const p=Lx(r.history,r.currentImage,i,l1(r));if(!p)return;if(p.type==="sequence"){o().showHistorySequence(p.sequenceId);return}o().selectHistory(p.item);return}const f=Dx(r.history,r.currentImage,i);f&&o().selectHistory(f)},trashHistoryItem:async i=>{const r=i.canvasVersion?ea(o().history,i):i;if(!r||r.canvasVersion||!r.filename){o().showToast(W("gallery.deleteFailed"),!0);return}const u=r.filename,f=o().currentImage,m=(f?ea(o().history,f)??f:null)?.filename===u,y=m?ch(o().history,u):f;try{await Yp(u),n(h=>{const x=n1(h.multimodeSequences,u),b=h.multimodePreviewFlightId&&!x[h.multimodePreviewFlightId]?null:h.multimodePreviewFlightId;return{history:h.history.filter(S=>S.filename!==u),currentImage:y,multimodePreviewFlightId:b,multimodeSequences:x,trashPending:null}}),m&&ta(y?.filename??null),o().showToast(W("gallery.movedToSystemTrash",{filename:u}))}catch(h){console.error("[history] trash failed",h),o().showToast(W("gallery.deleteFailed"),!0)}},trashHistorySequence:async i=>{const r=o().history.filter(h=>h.sequenceId===i&&!h.canvasVersion&&!!h.filename);if(r.length===0){o().showToast(W("gallery.deleteFailed"),!0);return}if(!window.confirm(W("history.deleteSequenceConfirm",{count:r.length})))return;const f=new Set(r.map(h=>h.filename).filter(h=>!!h)),p=o().currentImage,m=!!(p?.filename&&f.has(p.filename)),y=o().multimodePreviewFlightId===`history:${i}`||o().multimodePreviewFlightId===i;try{for(const h of f)await Yp(h);n(h=>{const x={...h.multimodeSequences};return delete x[`history:${i}`],delete x[i],{history:h.history.filter(b=>!b.filename||!f.has(b.filename)),currentImage:m?null:h.currentImage,multimodePreviewFlightId:y?null:h.multimodePreviewFlightId,multimodeSequences:x,trashPending:null}}),m&&ta(null),o().showToast(W("history.sequenceDeleted",{count:f.size}))}catch(h){console.error("[history] sequence trash failed",h),o().showToast(W("gallery.deleteFailed"),!0)}},restorePendingTrash:async()=>{const i=o().trashPending;if(i)try{await Zb(i.filename,i.trashId),o().addHistoryItem(i.item),n({trashPending:null})}catch(r){console.error("[history] restore failed",r),o().showToast(W("gallery.restoreFailed"),!0)}},clearPendingTrash:()=>n({trashPending:null}),permanentlyDeleteHistoryItemByClick:async i=>{await o().permanentlyDeleteHistoryItemByShortcut(i)},permanentlyDeleteHistoryItemByShortcut:async i=>{const r=i.canvasVersion?ea(o().history,i):i;if(!r||r.canvasVersion||!r.filename){o().showToast(W("gallery.deleteFailed"),!0);return}const u=r.filename;if(!window.confirm(W("result.permanentDeleteConfirm",{filename:u})))return;const p=o().currentImage,y=(p?ea(o().history,p)??p:null)?.filename===u,h=y?ch(o().history,u):p;try{await Qb(u),n(x=>({history:x.history.filter(b=>b.filename!==u),currentImage:h,trashPending:x.trashPending?.filename===u?null:x.trashPending})),y&&ta(h?.filename??null),o().showToast(W("gallery.permanentDeleted",{filename:u}))}catch(x){console.error("[history] permanent delete failed",x),o().showToast(W("gallery.deleteFailed"),!0)}},removeFromHistory:i=>{const r=o(),u=r.history.filter(p=>p.filename!==i),f=r.currentImage&&r.currentImage.filename===i?null:r.currentImage;n({history:u,currentImage:f}),f===null&&ta(null)},addHistoryItem:i=>{const r=o(),u={...i,createdAt:i.createdAt||Date.now()},f=Mg(r.history,u),p=Rg(u,f),m=Ag(r.history,p);n({history:_r([p,...m],r.loadedHistoryRetainLimit+1),loadedHistoryRetainLimit:Math.max(r.loadedHistoryRetainLimit,Math.min(r.history.length+1,r.loadedHistoryRetainLimit+1))})},importLocalImageToHistory:async i=>{if(!i.type||!/^image\/(png|jpeg|webp)$/.test(i.type))return o().showToast(W("toast.localImportInvalid"),!0),null;try{const r=await cS(i);return o().addHistoryItem(r),n({currentImage:r,unseenGeneratedCount:0}),r.filename&&ta(r.filename),o().showToast(W("toast.localImportSuccess")),r}catch{return o().showToast(W("toast.localImportFailed"),!0),null}},getResolvedSize:()=>{const{sizePreset:i,customW:r,customH:u}=o();return i==="custom"?`${r}x${u}`:i},async generate(){const i=o();if(!cr(i.prompt,i.insertedPrompts))return;if(i.videoModelSelected)return o().runVideoGenerate();const u=i.uiMode==="classic"&&i.multimode,f=mr(i,{kind:u?"multimode":"classic"});if(f){n({customSizeConfirm:f});return}if(u){await o().generateMultimode();return}await o().runGenerate()},async generateMultimode(i){const r=o();if(r.uiMode!=="classic")return;const u=cr(r.prompt,r.insertedPrompts);if(!u)return;const f=r.prompt,p=vu(r.insertedPrompts),m=i??r.getResolvedSize(),y=`mm_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,h=new AbortController,x=Date.now(),b=Ri(r.multimodeMaxImages),S=[...r.inFlight,{id:y,prompt:u,startedAt:x,kind:"multimode",composerPrompt:f,composerInsertedPrompts:p}],T={sequenceId:y,requestId:y,requested:b,returned:0,images:[],partials:[],status:"pending"};St(S),n({activeGenerations:r.activeGenerations+1,inFlight:S,multimodeAbortControllers:{...r.multimodeAbortControllers,[y]:h},multimodeSequences:{...r.multimodeSequences,[y]:T},multimodePreviewFlightId:y}),o().startInFlightPolling();try{const E=await Fb({prompt:u,quality:r.quality,size:m,format:r.format,moderation:r.moderation,provider:r.provider,maxImages:b,model:r.imageModel,reasoningEffort:r.reasoningEffort,webSearchEnabled:r.webSearchEnabled,requestId:y,mode:r.promptMode,composerPrompt:f,composerInsertedPrompts:p,...r.referenceImages.length?{references:r.referenceImages.map(cu)}:{}},{onPartial:P=>{n(Y=>{const Z=Y.multimodeSequences[y];return Z?{multimodeSequences:{...Y.multimodeSequences,[y]:{...Z,partials:[...Z.partials,{image:P.image,index:P.index??null}].slice(-b)}}}:{}})},onImage:P=>{n(Y=>{const Z=Y.multimodeSequences[y];if(!Z)return{};const k=Th(Z.images,[P]);return k.length===Z.images.length?{}:{multimodeSequences:{...Y.multimodeSequences,[y]:{...Z,sequenceId:P.sequenceId??Z.sequenceId,returned:k.length,images:k,status:"partial"}}}})}},{signal:h.signal}),M=E.images.map(P=>({...P,prompt:u,elapsed:Number.parseFloat(E.elapsed),provider:E.provider,usage:E.usage,requestId:P.requestId??E.requestId??y,composerPrompt:f,composerInsertedPrompts:p,quality:E.quality??r.quality,size:E.size??m,model:E.model??r.imageModel}));for(const P of M)await pr(P,n,o);n(P=>({multimodeSequences:{...P.multimodeSequences,[y]:(()=>{const Y=P.multimodeSequences[y],Z=Th(Y?.images??[],M);return{sequenceId:E.sequenceId,requestId:y,requested:E.requested,returned:Z.length,images:Z,partials:[],status:E.status,elapsed:E.elapsed}})()}}));const O=E.status==="complete"?"multimode.complete":"multimode.partial";o().showToast(W(O,{returned:E.returned,requested:E.requested,elapsed:E.elapsed}))}catch(E){E.name==="AbortError"||Sh(E)?n(M=>{const O=M.multimodeSequences[y];return O?{multimodeSequences:{...M.multimodeSequences,[y]:{...O,status:"canceled"}}}:{}}):(n(M=>{const O=M.multimodeSequences[y];return O?{multimodeSequences:{...M.multimodeSequences,[y]:{...O,status:"error",error:E.message}}}:{}}),xi(E,o()))}finally{const E=o().inFlight.filter(M=>M.id!==y);St(E),n(M=>{const O={...M.multimodeAbortControllers};delete O[y];let P=M.multimodePreviewFlightId;if(P===y){const Y=M.multimodeSequences[y]?.status;if(!(Y==="complete"||Y==="partial")){const k=Object.keys(O);P=k.length>0?k[k.length-1]:null}}return{activeGenerations:Math.max(0,M.activeGenerations-1),inFlight:E,multimodeAbortControllers:O,multimodePreviewFlightId:P}})}},cancelMultimode:()=>{const i=o().multimodePreviewFlightId;i&&(o().multimodeAbortControllers[i]?.abort(),o().cancelInFlightJob(i),n(r=>{const u=r.multimodeSequences[i];return u?{multimodeSequences:{...r.multimodeSequences,[i]:{...u,status:"canceled"}}}:{}}))},async runGenerate(i){const r=o(),u=cr(r.prompt,r.insertedPrompts);if(!u)return;const f=r.prompt,p=vu(r.insertedPrompts),m=i??r.getResolvedSize(),y=`f_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,h=Date.now(),x=[...r.inFlight,{id:y,prompt:u,startedAt:h,composerPrompt:f,composerInsertedPrompts:p}];St(x),n({activeGenerations:r.activeGenerations+1,inFlight:x}),o().startInFlightPolling();try{const b={prompt:u,quality:r.quality,size:m,format:r.format,moderation:r.moderation,provider:r.provider,n:r.count,model:r.imageModel,reasoningEffort:r.reasoningEffort,webSearchEnabled:r.webSearchEnabled,requestId:y,mode:r.promptMode,composerPrompt:f,composerInsertedPrompts:p,...r.referenceImages.length?{references:r.referenceImages.map(cu)}:{}},S=await Pb(b);if(Vp(S)&&S.images.length>1){for(const T of S.images){const E={image:T.image,filename:T.filename,reasoningEffort:S.reasoningEffort??r.reasoningEffort,prompt:u,composerPrompt:f,composerInsertedPrompts:p,elapsed:S.elapsed,provider:S.provider,usage:S.usage,requestId:S.requestId??y,quality:S.quality??r.quality,size:S.size??m,model:S.model??r.imageModel};await pr(E,n,o)}o().showToast(W("toast.generatedBatch",{count:S.images.length,elapsed:S.elapsed}))}else{let T;if(Vp(S)){const E=S.images[0];T={image:E.image,filename:E.filename,reasoningEffort:S.reasoningEffort??r.reasoningEffort,prompt:u,composerPrompt:f,composerInsertedPrompts:p,elapsed:S.elapsed,provider:S.provider,usage:S.usage,requestId:S.requestId??y,quality:S.quality??r.quality,size:S.size??m,model:S.model??r.imageModel}}else T={image:S.image,filename:S.filename,reasoningEffort:S.reasoningEffort??r.reasoningEffort,prompt:u,composerPrompt:f,composerInsertedPrompts:p,elapsed:S.elapsed,provider:S.provider,usage:S.usage,requestId:S.requestId??y,quality:S.quality??r.quality,size:S.size??m,model:S.model??r.imageModel};await pr(T,n,o),o().showToast(W("toast.generatedSingle",{elapsed:S.elapsed}))}}catch(b){Sh(b)||xi(b,o())}finally{const b=o().inFlight.filter(S=>S.id!==y);St(b),n({activeGenerations:Math.max(0,o().activeGenerations-1),inFlight:b})}},async confirmCustomSizeAdjustment(){const i=o().customSizeConfirm;if(!i)return;const r=i1(i.adjustedW,i.adjustedH);if(n({customW:i.adjustedW,customH:i.adjustedH,customSizeConfirm:null}),i.continuation.kind==="classic"){await o().runGenerate(r);return}if(i.continuation.kind==="multimode"){await o().generateMultimode(r);return}if(i.continuation.kind==="node-in-place"){await o().runGenerateNodeInPlace(i.continuation.clientId,{sizeOverride:r});return}if(i.continuation.kind==="node-variation"){await o().generateNodeVariation(i.continuation.clientId,r);return}await o().runGenerateNode(i.continuation.clientId,r)},cancelCustomSizeAdjustment:()=>n({customSizeConfirm:null}),hydrateHistory(){(async()=>{try{const i=await yl({limit:Yt}),r=i.items.map(Ei);if(n({historyNextCursor:i.nextCursor,loadedHistoryRetainLimit:Yt}),r.length>0){const u=Nh(),f=u?r.find(y=>y.filename===u):null,p=_n(r),m=(f?ea(r,f):null)??p[0]??null;n({history:r,currentImage:m,historyNextCursor:i.nextCursor,loadedHistoryRetainLimit:Math.max(Yt,r.length)}),m?.filename!==u&&ta(m?.filename??null)}}catch(i){console.warn("[history] load failed:",i)}})()},showToast(i,r=!1){const u=Date.now(),f={message:i,error:r,id:u+Math.random(),createdAt:u};n(p=>({toast:f,toastLog:[...p.toastLog,f]}))},dismissToast(i){n(r=>{const u=r.toastLog.filter(f=>f.id!==i);return{toastLog:u,toast:r.toast?.id===i?u[u.length-1]??null:r.toast}})},showErrorCard(i,r){const u=Date.now(),f={code:i,fallbackMessage:r?.fallbackMessage,id:u+Math.random(),createdAt:u};n(p=>({errorCard:f,errorCardLog:[...p.errorCardLog,f]}))},dismissErrorCard(i){n(r=>{if(i==null)return{errorCard:null,errorCardLog:[]};const u=r.errorCardLog.filter(f=>f.id!==i);return{errorCardLog:u,errorCard:r.errorCard?.id===i?u[u.length-1]??null:r.errorCard}})},setWorkspaceProfile(i){n({workspaceProfile:i});try{localStorage.setItem("ima2.workspaceProfile",i)}catch{}},togglePromptBuilder(){n(i=>({promptBuilderOpen:!i.promptBuilderOpen}))},setPromptLibraryOpen(i){n({promptLibraryOpen:i})},togglePromptLibrary(){n(i=>({promptLibraryOpen:!i.promptLibraryOpen}))},async loadPromptLibrary(){n({promptLibraryLoading:!0});try{const i=await lS();n({promptLibrary:{prompts:i.prompts,folders:i.folders},promptLibraryLoading:!1})}catch(i){console.error("[PromptLibrary] load failed",i),n({promptLibraryLoading:!1})}},async savePromptToLibrary(i){try{await iS(i),await o().loadPromptLibrary(),o().showToast(W("promptLibrary.saved"))}catch(r){console.error("[PromptLibrary] save failed",r),o().showToast(W("promptLibrary.saveFailed"),!0)}},async deletePromptFromLibrary(i){try{await oS(i),await o().loadPromptLibrary()}catch(r){console.error("[PromptLibrary] delete failed",r)}},async togglePromptFavorite(i){try{await rS(i),await o().loadPromptLibrary()}catch(r){console.error("[PromptLibrary] favorite toggle failed",r)}},async importPromptsToLibrary(i){try{const r=[];for(const f of i){if(!/\.(txt|md|markdown)$/i.test(f.name))continue;const p=await f.text();if(!p.trim())continue;const m=f.name.replace(/\.(txt|md|markdown)$/i,"");r.push({name:m.trim()||W("promptLibrary.untitled"),text:p.trim(),tags:[]})}if(r.length===0){o().showToast(W("promptLibrary.importNoValidFiles"),!0);return}const u=await sS({prompts:r});await o().loadPromptLibrary(),o().showToast(W("promptLibrary.imported",{count:u.promptsImported}))}catch(r){console.error("[PromptLibrary] import failed",r),o().showToast(W("promptLibrary.importFailed"),!0)}},async toggleGalleryFavorite(i){try{const r=await Yb(i);n(u=>{const f=new Set(u.galleryFavorites);return r.isFavorite?f.add(i):f.delete(i),{galleryFavorites:f}}),n(u=>({history:u.history.map(f=>f.filename===i?{...f,isFavorite:r.isFavorite}:f)}))}catch(r){console.error("[GalleryFavorite] toggle failed",r)}},openCanvas:()=>n({canvasOpen:!0,canvasZoom:1,canvasPanX:0,canvasPanY:0}),closeCanvas:()=>n({canvasOpen:!1}),setCanvasZoom:i=>n({canvasZoom:Math.max(.5,Math.min(3,i))}),resetCanvasZoom:()=>n({canvasZoom:1,canvasPanX:0,canvasPanY:0}),setCanvasPan:(i,r)=>{n({canvasPanX:Math.max(-4e3,Math.min(4e3,i)),canvasPanY:Math.max(-4e3,Math.min(4e3,r))})},resetCanvasPan:()=>n({canvasPanX:0,canvasPanY:0}),setCanvasExportBackground:i=>{n({canvasExportBackground:i}),ph(i,o().canvasExportMatteColor)},setCanvasExportMatteColor:i=>{n({canvasExportMatteColor:i}),ph(o().canvasExportBackground,i)}})),f1=800;let aa=null,wr=!1,Cr=!1,Tn=null,qg=0;function Gg(){try{const n=sessionStorage.getItem(lh);if(n)return n;const o=`tab_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`;return sessionStorage.setItem(lh,o),o}catch{return"tab_unavailable"}}function Hg(n){const o={...n};return delete o.referenceImages,delete o.partialImageUrl,n.status==="pending"||n.status==="reconciling"?{...o,status:"empty",pendingRequestId:null,recoveryRequestId:n.pendingRequestId??n.recoveryRequestId??null,pendingPhase:null,pendingStartedAt:null,error:void 0}:o}function Ug(n){return n.map(o=>({id:o.id,source:o.source,target:o.target,data:{sourceHandle:o.sourceHandle??null,targetHandle:o.targetHandle??null}}))}async function Bg(n,o){const i=n().activeSessionId;if(!i||n().graphNodes.filter(m=>!m.data.imageUrl&&!m.data.serverNodeId).length===0)return;let u=[];try{u=(await yl({sessionId:i,limit:Yt})).items}catch{return}let f=!1;const p=n().graphNodes.map(m=>{if(m.data.imageUrl||m.data.serverNodeId)return m;const y=m.data.pendingStartedAt??0,h=m.data.pendingRequestId??m.data.recoveryRequestId??null,b=(h?u.find(S=>(S.sessionId??null)===i&&(S.requestId??null)===h):null)??u.find(S=>(S.sessionId??null)===i&&(S.clientNodeId??null)===m.id&&(!y||(S.createdAt??0)>=y));return b?(f=!0,{...m,data:{...m.data,status:"ready",imageUrl:b.url,serverNodeId:b.nodeId??m.data.serverNodeId,size:b.size??m.data.size??null,elapsed:b.elapsed??m.data.elapsed,reasoningEffort:b.reasoningEffort??m.data.reasoningEffort,video:b.video??m.data.video??null,pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:void 0}}):m});f&&(o({graphNodes:p}),Fg(n,o,"recovery"))}async function m1(n,o){const i=n().activeSessionId;if(!i)return;const{session:r}=await Kh(i),{graphNodes:u,graphEdges:f,graphVersion:p}=Og(r);o({graphNodes:u,graphEdges:f,activeSessionGraphVersion:p}),n().showToast(W("toast.sessionReloadedElsewhere"),!0),await Bg(n,o).catch(()=>{})}async function p1(n,o,i){const r=n().activeSessionId,u=n().activeSessionGraphVersion;if(!r||u==null)return"skipped";const{graphNodes:f,graphEdges:p}=n(),m=f.map(x=>({id:x.id,x:x.position.x,y:x.position.y,data:Hg(x.data)})),y=Ug(p),h=`gs_${Date.now().toString(36)}_${++qg}`;try{const x=await nS(r,u,m,y,{saveId:h,saveReason:i,tabId:Gg()});return n().activeSessionId!==r?"skipped":(Ex(r,n().graphNodes.map(b=>b.id)),o({activeSessionGraphVersion:x.graphVersion}),"saved")}catch(x){return x.status===409?(await m1(n,o),"conflict"):(console.warn("[sessions] save failed:",x),"failed")}}async function Pg(n,o,i){if(wr){Cr=!0,Tn&&await Tn;return}wr=!0,Tn=(async()=>{let r=i;do{Cr=!1;const u=await p1(n,o,r);if(u==="conflict"||u==="failed")break;r="queued"}while(Cr)})().finally(()=>{wr=!1,Tn=null}),await Tn}function Fg(n,o,i="debounced"){const r=n();r.activeSessionId&&(r.sessionLoading||(aa&&clearTimeout(aa),aa=setTimeout(()=>{aa=null,Pg(n,o,i)},f1)))}async function h1(n,o,i="manual"){let r=!1;if(aa&&(clearTimeout(aa),aa=null,r=!0),wr){Cr=!0,Tn&&await Tn;return}r&&await Pg(n,o,i)}function g1(n){const o=n();if(!o.activeSessionId||o.activeSessionGraphVersion==null)return;aa&&(clearTimeout(aa),aa=null);const i=o.graphNodes.map(p=>({id:p.id,x:p.position.x,y:p.position.y,data:Hg(p.data)})),r=Ug(o.graphEdges),u=`/api/sessions/${encodeURIComponent(o.activeSessionId)}/graph`,f=JSON.stringify({nodes:i,edges:r});try{fetch(u,{method:"PUT",headers:{"Content-Type":"application/json","If-Match":String(o.activeSessionGraphVersion),"X-Ima2-Graph-Save-Id":`gs_${Date.now().toString(36)}_${++qg}`,"X-Ima2-Graph-Save-Reason":"beforeunload","X-Ima2-Tab-Id":Gg()},body:f,keepalive:!0})}catch{}}async function pr(n,o,i){const r=await dS(n.image).catch(()=>n.image),u=n.filename?`/generated/${n.filename}`:n.image,f={...n,thumb:r,url:u,createdAt:n.createdAt||Date.now()},p=i(),m=Mg(p.history,f),y=Rg(f,m),h=Ag(p.history,y),x=_r([y,...h],p.loadedHistoryRetainLimit+1);ta(y.filename??null),o({history:x,currentImage:y,loadedHistoryRetainLimit:Math.max(p.loadedHistoryRetainLimit,Math.min(p.history.length+1,p.loadedHistoryRetainLimit+1)),unseenGeneratedCount:i().unseenGeneratedCount+1})}function y1(n){for(const o of n.history)if(o.sessionId)return o.sessionId;return null}function v1(){const{t:n}=ye(),o=_(r=>r.uiMode),i=_(r=>r.setUIMode);return d.jsxs("div",{className:"ui-mode-switch",role:"tablist","aria-label":n("uiMode.ariaLabel"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":o==="classic",className:`ui-mode-switch__tab${o==="classic"?" active":""}`,onClick:()=>i("classic"),children:n("uiMode.classic")}),d.jsx("button",{type:"button",role:"tab","aria-selected":o==="node",className:`ui-mode-switch__tab${o==="node"?" active":""}`,onClick:()=>i("node"),children:n("uiMode.node")}),null,null]})}function b1({text:n,mode:o,onClose:i}){const{t:r}=ye(),u=_(E=>E.savePromptToLibrary),[f,p]=D.useState(n.slice(0,30)),[m,y]=D.useState(n),[h,x]=D.useState(""),[b,S]=D.useState(!1),T=async()=>{m.trim()&&(S(!0),await u({name:f.trim()||m.slice(0,30),text:m.trim(),tags:h.split(",").map(E=>E.trim()).filter(Boolean),mode:o||void 0}),S(!1),i())};return d.jsxs("div",{className:"save-prompt-popover",onClick:E=>E.stopPropagation(),children:[d.jsxs("div",{className:"save-prompt-popover__header",children:[d.jsx("span",{children:r("promptLibrary.saveTitle")}),d.jsx("button",{className:"save-prompt-popover__close",onClick:i,"aria-label":r("common.close"),children:"×"})]}),d.jsxs("div",{className:"save-prompt-popover__body",children:[d.jsxs("label",{children:[r("promptLibrary.name"),d.jsx("input",{type:"text",value:f,onChange:E=>p(E.target.value),placeholder:m.slice(0,30)})]}),d.jsxs("label",{children:[r("promptLibrary.content"),d.jsx("textarea",{value:m,onChange:E=>y(E.target.value),placeholder:"Enter prompt...",rows:4,autoFocus:!0})]}),d.jsxs("label",{children:[r("promptLibrary.tags"),d.jsx("input",{type:"text",value:h,onChange:E=>x(E.target.value),placeholder:"cta, product, summer"})]})]}),d.jsx("div",{className:"save-prompt-popover__footer",children:d.jsx("button",{onClick:T,disabled:b||!m.trim(),className:"save-prompt-popover__save",children:r(b?"common.saving":"promptLibrary.save")})})]})}function S1({variant:n="label"}){const{t:o}=ye(),i=_(f=>f.webSearchEnabled),r=_(f=>f.setWebSearchEnabled),u=o(i?"settings.webSearch.on":"settings.webSearch.off");return d.jsx("button",{type:"button",className:`web-search-toggle web-search-toggle--${n}${i?" is-active":""}`,onClick:()=>r(!i),"aria-pressed":i,"aria-label":u,title:u,children:n==="compact"?d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("path",{d:"M2 12h20"}),d.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 0 20"}),d.jsx("path",{d:"M12 2a15.3 15.3 0 0 0 0 20"})]}):d.jsx("span",{children:u})})}async function bu(n){const o=_.getState(),i=_a(n),r=!!n.prompt;if(r&&!i&&o.setPrompt(n.prompt),i){const u=n.url||n.image,f=await yu(u);o.addReferenceDataUrl(f);const p=Ng(n);o.setVideoContinuityLineage(p),p&&o.insertPromptToComposer(Px(p)),n.videoSeries?.topic&&o.setVideoTopic(n.videoSeries.topic),o.videoModelSelected||o.selectVideoModel("grok-imagine-video-1.5-preview")}else await o.useImageAsReference(n);return{ok:!0,isVideo:i,hasPrompt:r}}const hl=5;function x1(n){const o=Number.parseFloat(n);return Number.isFinite(o)&&o>0?o:null}function Mu({variant:n="sidebar"}){const o=_(L=>L.prompt),i=_(L=>L.setPrompt),r=_(L=>L.insertedPrompts),u=_(L=>L.removeInsertedPromptFromComposer),f=_(L=>L.moveInsertedPromptInComposer),p=_(L=>L.generate),{t:m}=ye(),y=_(L=>L.referenceImages),h=_(L=>L.addReferences),x=_(L=>L.readDroppedImageMetadata),b=_(L=>L.removeReference),S=_(L=>L.currentImage),T=_(L=>L.videoModelSelected),E=_(L=>L.selectVideoModel),M=_(L=>L.setImageModel),O=D.useRef(null),P=D.useRef(null),[Y,Z]=D.useState(!1),[k,ne]=D.useState(!1),F=_(L=>L.promptMode),ee=_(L=>L.setPromptMode),Ee=_(L=>L.multimode),Ie=_(L=>L.multimodeMaxImages),K=F==="direct",$=r.filter(L=>L.placement!=="after"),le=r.filter(L=>L.placement==="after"),Ae=[...$.map(L=>L.id),"__main_prompt__",...le.map(L=>L.id)],we=y.length<hl,Q=Ee?y.length>0?m("multimode.promptPlaceholderWithRefs"):m("multimode.promptPlaceholder"):y.length>0?m("prompt.placeholderWithRefs"):m("prompt.placeholder"),w=async L=>{L.length!==0&&(L.length===1&&await x(L[0])||await h(L))},X=async L=>{try{await bu(L)}catch{}},ie=L=>{L.preventDefault(),Z(!1);const ue=L.dataTransfer.getData("application/ima2-ref");if(ue){try{const nt=JSON.parse(ue);X(nt)}catch{}return}const me=Array.from(L.dataTransfer.files).filter(nt=>nt.type.startsWith("image/"));me.length>0&&w(me)},Ne=L=>{L.preventDefault(),Y||Z(!0)},Oe=L=>{L.currentTarget.contains(L.relatedTarget)||Z(!1)},A=L=>{if(!L)return[];const ue=[];for(const me of Array.from(L)){if(me.kind!=="file"||!me.type.startsWith("image/"))continue;const nt=me.getAsFile();nt&&ue.push(nt)}return ue},U=L=>{if(!we)return;const ue=A(L.clipboardData?.items??null);if(ue.length===0)return;L.preventDefault();const me=hl-y.length;h(ue.slice(0,me))},J=D.useRef(null),te=D.useRef(n);D.useLayoutEffect(()=>{const L=P.current;if(!L)return;(J.current===null||te.current!==n)&&(J.current=x1(window.getComputedStyle(L).maxHeight)??0,te.current=n),L.style.height="auto";const ue=J.current,me=ue?Math.min(L.scrollHeight,ue):L.scrollHeight;L.style.height=`${me}px`},[o,n]),D.useEffect(()=>{const L=ue=>{const me=ue.target,nt=me?.tagName;if(nt==="INPUT"||nt==="TEXTAREA"||me?.isContentEditable)return;const la=A(ue.clipboardData?.items??null);if(la.length===0||y.length>=hl)return;ue.preventDefault();const tn=hl-y.length;h(la.slice(0,tn))};return window.addEventListener("paste",L),()=>window.removeEventListener("paste",L)},[y.length,h]);const ce=(L,ue)=>{const me=Ae.indexOf(L);return me<0?!1:ue==="up"?me>0:me<Ae.length-1},de=L=>d.jsxs("div",{className:"composer__prompt-chip",title:L.name,children:[d.jsx("span",{className:"composer__prompt-chip-plus","aria-hidden":"true",children:"+"}),d.jsx("span",{className:"composer__prompt-chip-title",children:L.name}),d.jsxs("div",{className:"composer__prompt-chip-actions",children:[d.jsx("button",{type:"button",className:"composer__prompt-chip-move",onClick:()=>f(L.id,"up"),disabled:!ce(L.id,"up"),"aria-label":m("prompt.moveBlockUp",{name:L.name}),title:m("prompt.moveBlockUp",{name:L.name}),children:"^"}),d.jsx("button",{type:"button",className:"composer__prompt-chip-move",onClick:()=>f(L.id,"down"),disabled:!ce(L.id,"down"),"aria-label":m("prompt.moveBlockDown",{name:L.name}),title:m("prompt.moveBlockDown",{name:L.name}),children:"v"}),d.jsx("button",{type:"button",className:"composer__prompt-chip-remove",onClick:()=>u(L.id),"aria-label":m("promptLibrary.removeInserted",{name:L.name}),children:"x"})]})]},L.id);return d.jsxs("div",{className:`composer composer--${n}${Y?" composer--drag":""}${K?" composer--direct":""}${Ee?" composer--multimode":""}${K&&Ee?" composer--combined-modes":""}`,role:"group","aria-label":Ee?m("multimode.composerAriaLabel",{count:Ie}):m("prompt.label"),onDrop:ie,onDragOver:Ne,onDragLeave:Oe,onPaste:U,children:[d.jsxs("div",{className:"composer__header",children:[d.jsx("span",{className:"section-title composer__label",children:m("prompt.label")}),d.jsxs("div",{className:"composer__header-meta",children:[Ee&&d.jsx("span",{className:"composer__mode-badge",children:m("multimode.composerBadge",{count:Ie})}),K&&d.jsx("span",{className:"composer__direct-badge",children:m("prompt.directModeActive")}),y.length>0&&d.jsx("span",{className:"composer__count",children:m("prompt.refCount",{count:y.length,max:hl})})]})]}),y.length>0&&d.jsx("div",{className:"composer__chips",children:y.map((L,ue)=>d.jsxs("div",{className:"composer__chip",title:m("prompt.refChipTitle",{n:ue+1}),children:[d.jsx("img",{src:L,alt:m("prompt.refChipAlt",{n:ue+1}),loading:"lazy",decoding:"async"}),d.jsx("button",{type:"button",className:"composer__chip-remove",onClick:()=>b(ue),"aria-label":m("prompt.refRemoveAria",{n:ue+1}),children:"×"})]},ue))}),$.length>0&&d.jsx("div",{className:"composer__prompt-chips",children:$.map(de)}),d.jsx("textarea",{ref:P,className:"prompt-area composer__textarea",value:o,placeholder:Q,onChange:L=>i(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),p())}}),le.length>0&&d.jsxs("div",{className:"composer__prompt-chips composer__prompt-chips--after",children:[d.jsx("span",{className:"composer__prompt-chips-label",children:m("prompt.afterBlocks")}),le.map(de)]}),d.jsxs("div",{className:"composer__toolbar",children:[d.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>we&&O.current?.click(),disabled:!we,title:m("prompt.attachTitle"),"aria-label":m("prompt.attachTitle"),children:[d.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:d.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"})}),d.jsx("span",{children:m("prompt.attach")})]}),d.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>S&&void bu(S).catch(()=>{}),disabled:!S||!we,title:m("prompt.continueTitle"),children:[d.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:[d.jsx("polyline",{points:"23 4 23 10 17 10"}),d.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}),d.jsx("span",{children:m("prompt.continue")})]}),d.jsxs("button",{type:"button",className:`composer__tool${T?" composer__tool--on":""}`,onClick:()=>{T?M("gpt-5.5"):E("grok-imagine-video-1.5-preview")},title:m("prompt.videoToggleTitle"),"aria-label":m("prompt.videoToggleTitle"),"aria-pressed":!!T,children:[d.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:[d.jsx("polygon",{points:"23 7 16 12 23 17 23 7"}),d.jsx("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})]}),d.jsx("span",{className:"sr-only",children:"Video"})]}),d.jsxs("button",{type:"button",className:`composer__tool${K?" composer__tool--on":""}`,onClick:()=>ee(K?"auto":"direct"),title:m("prompt.directModeTitle"),"aria-label":m("prompt.directModeTitle"),"aria-pressed":K,children:[d.jsx("span",{"aria-hidden":"true",style:{fontWeight:700,fontSize:11},children:"1:1"}),d.jsx("span",{children:m("prompt.directMode")})]}),d.jsx(S1,{variant:"compact"}),d.jsxs("div",{style:{position:"relative"},children:[d.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>ne(L=>!L),disabled:!o.trim(),title:m("promptLibrary.saveTitle"),"aria-label":m("promptLibrary.saveTitle"),children:[d.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:d.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),d.jsx("span",{children:m("promptLibrary.save")})]}),k&&d.jsx(b1,{text:o,mode:F,onClose:()=>ne(!1)})]}),d.jsx("span",{className:"composer__hint",children:m("prompt.hint")})]}),Y&&d.jsx("div",{className:"composer__dropzone","aria-hidden":"true",children:m("prompt.dropHere",{max:hl})}),d.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:L=>{const ue=Array.from(L.target.files??[]);ue.length>0&&w(ue),L.target.value=""}})]})}function Ru(){const n=_(p=>p.activeGenerations),o=_(p=>p.generate),i=_(p=>p.openReadinessPopup),{t:r}=ye(),u=n>0,f=u?r("generate.buttonLoading",{n}):r("generate.button");return d.jsxs("div",{className:"generate-row",children:[d.jsx("button",{type:"button",className:`generate-btn${u?" loading":""}`,onClick:()=>{o()},children:f}),d.jsx("button",{type:"button",className:"generate-row__readiness",onClick:i,title:r("readiness.openTitle"),"aria-label":r("readiness.openTitle"),children:"?"})]})}function T1(n,o=28){const i=n.trim().replace(/\s+/g," ");return i.length>o?`${i.slice(0,o)}...`:i}function Ar(){const n=_(f=>f.inFlight),o=_(f=>f.cancelInFlightJob),i=_(f=>f.videoProgress),{t:r}=ye(),u={queued:r("inflight.queued"),planning:r("inflight.planning"),streaming:r("inflight.streaming"),decoding:r("inflight.decoding"),canceling:r("inflight.canceling")};return n.length===0?null:d.jsx("ul",{className:"in-flight-list",children:n.map(f=>{const p=f.phase?u[f.phase]??f.phase:r("inflight.queued"),y=f.prompt.trim().replace(/\s+/g," ")||r("inflight.noPrompt");return d.jsxs("li",{className:"in-flight-item","data-phase":f.phase??"queued",title:y,"aria-label":`${p}: ${y}`,children:[d.jsx("span",{className:"in-flight-prompt",children:T1(f.prompt)}),d.jsx("span",{className:"in-flight-phase",children:f.kind==="video"&&i!=null&&i>0?`${Math.round(i*100)}%`:p}),d.jsx("button",{type:"button",className:"in-flight-cancel",onClick:()=>{o(f.id)},disabled:f.phase==="canceling","aria-label":r("inflight.cancelAria",{prompt:y}),title:r("common.cancel"),children:"×"}),d.jsx("span",{className:"in-flight-spinner","aria-hidden":"true"})]},f.id)})})}function E1(){const{t:n}=ye(),o=_(S=>S.sessions),i=_(S=>S.activeSessionId),r=_(S=>S.switchSession),u=_(S=>S.createAndSwitchSession),f=_(S=>S.renameCurrentSession),p=_(S=>S.deleteSessionById),[m,y]=D.useState(!1),h=o.find(S=>S.id===i),x=()=>{const S=window.prompt(n("session.renamePrompt"),h?.title??n("session.newSession"));S&&S.trim()&&f(S.trim())},b=(S,T)=>{window.confirm(n("session.deleteConfirm",{title:T}))&&p(S)};return d.jsxs("div",{className:"session-picker",children:[d.jsxs("div",{className:"session-picker-row",children:[d.jsxs("button",{type:"button",className:"session-current",onClick:()=>y(S=>!S),title:n("session.switchTitle"),children:[d.jsx("span",{className:"session-title",children:h?.title??n("session.loading")}),d.jsx("span",{className:"session-caret",children:m?"▴":"▾"})]}),d.jsx("button",{type:"button",className:"session-btn",onClick:()=>{u(n("session.newSession"))},title:n("session.newSessionTitle"),children:"+"}),d.jsx("button",{type:"button",className:"session-btn",onClick:x,title:n("session.renameTitle"),disabled:!h,children:"✎"})]}),m&&d.jsxs("ul",{className:"session-list",children:[o.map(S=>d.jsxs("li",{className:S.id===i?"is-active":"",children:[d.jsxs("button",{type:"button",className:"session-item",onClick:()=>{y(!1),r(S.id)},children:[d.jsx("span",{className:"session-item-title",children:S.title}),d.jsx("span",{className:"session-item-count",children:S.nodeCount})]}),d.jsx("button",{type:"button",className:"session-del",onClick:()=>b(S.id,S.title),title:n("session.deleteTitle"),children:"×"})]},S.id)),o.length===0&&d.jsx("li",{className:"session-empty",children:n("session.empty")})]})]})}function N1(){const{t:n}=ye(),o=_(r=>r.settingsOpen),i=_(r=>r.toggleSettings);return d.jsx("button",{type:"button",className:`settings-button${o?" is-active":""}`,onClick:i,"aria-label":n("settings.openAria"),"aria-pressed":o,title:n("settings.openTitle"),children:d.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[d.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"}),d.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"})]})})}var Vg=Bh();function Yg({variant:n}){const{t:o}=ye(),[i,r]=D.useState(!1),u=D.useRef(null),f=D.useRef(null),p=D.useRef(null),m=D.useRef([]),[y,h]=D.useState({top:0,left:12,width:280}),x=_(K=>K.imageModel),b=_(K=>K.setImageModel),S=_(K=>K.videoModelSelected),T=_(K=>K.selectVideoModel),E=_(K=>K.provider),M=_(K=>K.reasoningEffort),O=_(K=>K.setReasoningEffort),P=n==="settings"?"settings-image-model":"sidebar-image-model",Y=Tl,Z=Y.find(K=>K.value===x)??Y[0],k=xr.find(K=>K.value===M)??xr[0],ne=E==="grok",F=K=>{b(K.target.value)},ee=()=>m.current.filter(K=>K!==null),Ee=K=>{const $=ee();if($.length===0)return;const le=(K+$.length)%$.length;$[le]?.focus()},Ie=K=>{const $=ee();if($.length===0)return;const le=$.findIndex(we=>we===document.activeElement),Ae=$.length-1;if(K.key==="ArrowDown"||K.key==="ArrowRight"){K.preventDefault(),Ee(le>=0?le+1:0);return}if(K.key==="ArrowUp"||K.key==="ArrowLeft"){K.preventDefault(),Ee(le>=0?le-1:Ae);return}if(K.key==="Home"){K.preventDefault(),Ee(0);return}if(K.key==="End"){K.preventDefault(),Ee(Ae);return}K.key==="Escape"&&(K.preventDefault(),r(!1),f.current?.focus())};return D.useEffect(()=>{if(n!=="sidebar"||!i)return;const K=le=>{const Ae=le.target;Ae instanceof Node&&(u.current?.contains(Ae)||p.current?.contains(Ae)||r(!1))},$=le=>{le.key==="Escape"&&r(!1)};return document.addEventListener("pointerdown",K),document.addEventListener("keydown",$),()=>{document.removeEventListener("pointerdown",K),document.removeEventListener("keydown",$)}},[i,n]),D.useLayoutEffect(()=>{if(n!=="sidebar"||!i)return;(()=>{const Ae=f.current?.getBoundingClientRect();if(Ae){const Q=Math.min(280,Math.max(218,window.innerWidth-24)),w=Ae.right-Q,X=window.innerWidth-Q-12,ie=Math.max(12,Math.min(w,X));h({top:Ae.bottom+7,left:ie,width:Q})}})();const $=()=>r(!1),le=document.querySelector(".sidebar__scroll");return le?.addEventListener("scroll",$,{passive:!0}),window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{le?.removeEventListener("scroll",$),window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[i,n]),D.useEffect(()=>{if(n!=="sidebar"||!i)return;const K=Y.findIndex(le=>le.value===x),$=requestAnimationFrame(()=>{Ee(K>=0?K:0)});return()=>cancelAnimationFrame($)},[x,Y,i,n]),n==="sidebar"?d.jsxs("div",{ref:u,className:"image-model-select image-model-select--sidebar",children:[d.jsxs("button",{ref:f,id:P,type:"button",className:"image-model-select__trigger image-model-select__trigger--pill","aria-haspopup":"menu","aria-expanded":i,"aria-label":ne?o("sidebar.quickSettingsModelOnlyAria",{model:Z.shortLabel}):o("sidebar.quickSettingsAria",{model:Z.shortLabel,effort:k.shortLabel}),onClick:()=>r(K=>!K),children:[d.jsxs("span",{className:"image-model-select__trigger-top",children:[d.jsx("span",{className:"image-model-select__trigger-model",children:S?ir.find(K=>K.value===S)?.shortLabel??ir[0].shortLabel:Z.shortLabel}),d.jsx("span",{className:"image-model-select__trigger-chevron","aria-hidden":"true",children:"▾"})]}),ne?null:d.jsx("span",{className:"image-model-select__trigger-effort",children:k.shortLabel})]}),i?Vg.createPortal(d.jsxs("div",{ref:p,className:"image-model-select__menu",role:"menu","aria-label":o("sidebar.quickSettingsMenu"),onKeyDown:Ie,style:{position:"fixed",top:y.top,left:y.left,width:y.width,zIndex:160},children:[d.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":o("sidebar.imageModelLabel"),children:[d.jsx("div",{className:"image-model-select__section-title",children:o("sidebar.imageModelLabel")}),Y.map((K,$)=>d.jsxs("button",{ref:le=>{m.current[$]=le},type:"button",className:`image-model-select__item${K.value===x&&!S?" is-active":""}`,role:"menuitemradio","aria-checked":K.value===x&&!S,tabIndex:-1,onClick:()=>{b(K.value),r(!1)},children:[d.jsx("span",{children:K.shortLabel}),d.jsx("small",{children:o(K.fullLabelKey)})]},K.value))]}),d.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":o("sidebar.videoModelLabel"),children:[d.jsx("div",{className:"image-model-select__section-title",children:o("sidebar.videoModelLabel")}),ir.map((K,$)=>d.jsxs("button",{ref:le=>{m.current[Y.length+$]=le},type:"button",className:`image-model-select__item${S===K.value?" is-active":""}`,role:"menuitemradio","aria-checked":S===K.value,tabIndex:-1,onClick:()=>{T(K.value),r(!1)},children:[d.jsx("span",{children:K.shortLabel}),d.jsx("small",{children:o(K.fullLabelKey)})]},K.value))]}),ne?null:d.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":o("sidebar.reasoningLabel"),children:[d.jsx("div",{className:"image-model-select__section-title",children:o("sidebar.reasoningLabel")}),xr.map((K,$)=>d.jsxs("button",{ref:le=>{m.current[Y.length+ir.length+$]=le},type:"button",className:`image-model-select__item${K.value===M?" is-active":""}`,role:"menuitemradio","aria-checked":K.value===M,tabIndex:-1,onClick:()=>{O(K.value),r(!1)},children:[d.jsx("span",{children:K.shortLabel}),d.jsx("small",{children:o(K.fullLabelKey)})]},K.value))]})]}),document.body):null]}):d.jsx("div",{className:"image-model-select image-model-select--settings",children:d.jsxs("select",{id:P,value:x,onChange:F,children:[Y.map(K=>d.jsx("option",{value:K.value,children:o(K.fullLabelKey)},K.value)),dx.map(K=>d.jsx("option",{value:K.value,disabled:!0,children:o(K.fullLabelKey)},K.value))]})})}function Kg(n){return{...n,textFields:Array.isArray(n.textFields)?n.textFields:[]}}function Oi(n){return{...n,cards:Array.isArray(n.cards)?n.cards.map(Kg):[]}}async function Cn(n,o){const i=await fetch(n,o),r=await i.json().catch(()=>({}));if(!i.ok){const u=r,f=typeof u.error=="string"?u.error:u.error?.message||`Request failed: ${i.status}`,p=new Error(f);throw typeof u.error!="string"&&(p.code=u.error?.code),p}return r}function _1(){return Cn("/api/cardnews/image-templates")}function w1(){return Cn("/api/cardnews/role-templates")}async function C1(n){const o=await Cn("/api/cardnews/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return{...o,plan:Oi(o.plan)}}function A1(n){return Cn("/api/cardnews/jobs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function M1(n){return Cn(`/api/cardnews/jobs/${encodeURIComponent(n)}`)}async function R1(n){const i=(await Cn(`/api/cardnews/cards/${encodeURIComponent(n.card.id)}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,cards:[n.card]})})).cards.find(r=>r.id===n.card.id);if(!i)throw new Error("Regenerated card not found");return{card:i}}function wh(n){return Cn(`/api/cardnews/sets/${encodeURIComponent(n)}`).then(o=>({...o,plan:Oi(o.plan)}))}function O1(n){return`/api/cardnews/sets/${encodeURIComponent(n)}/manifest?download=1`}function j1(n){return n[0]?.id||"academy-lesson-square"}function I1(n){return n.find(o=>o.id==="mid-5")?.id||n[0]?.id||"mid-5"}function z1(n){return Math.round(n/16)*16}function Or(n){return Math.min(Nu,Math.max(1024,z1(n)))}function Ch(n){return n.outputSizePreset!=="custom"?n.outputSizePreset:`${Or(n.customW)}x${Or(n.customH)}`}function Xg(n){if(n){if(typeof n=="string")return n;if(typeof n=="object"&&"message"in n){const o=n.message;return typeof o=="string"?o:void 0}return String(n)}}function D1(n,o){const i=o.status||"generated";return{...n,...o,textFields:Array.isArray(o.textFields)?o.textFields:n.textFields,status:i,error:i==="error"?Xg(o.error)||W("cardNews.error"):void 0}}function k1(n){return new Promise(o=>setTimeout(o,n))}function uu(n,o){const i=new Map(o.cards.map(r=>[r.id,r]));return{...n,cards:n.cards.map(r=>{const u=i.get(r.id);return u?{...r,...u,textFields:Array.isArray(u.textFields)?u.textFields:r.textFields,status:u.status||r.status,error:Xg(u.error)}:r})}}const at=Ph((n,o)=>({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(!(o().loading||o().templates.length>0)){n({loading:!0,error:null});try{const[i,r]=await Promise.all([_1(),w1()]);n({templates:i.templates,roleTemplates:r.templates,imageTemplateId:j1(i.templates),roleTemplateId:I1(r.templates),loading:!1})}catch(i){n({loading:!1,error:i instanceof Error?i.message:String(i)})}}},setBriefField(i,r){n({[i]:r})},setImageTemplate(i){n({imageTemplateId:i})},setRoleTemplate(i){n({roleTemplateId:i})},setOutputSizePreset(i){n({outputSizePreset:i})},setCustomSize(i,r){n({customW:Or(i),customH:Or(r)})},async draft(){const i=o();n({loading:!0,error:null,draftError:null});try{const{plan:r,planner:u}=await C1({topic:i.topic,audience:i.audience,goal:i.goal,contentBrief:i.contentBrief,imageTemplateId:i.imageTemplateId,roleTemplateId:i.roleTemplateId,size:Ch(i)});n({activePlan:Oi(r),selectedCardId:r.cards[0]?.id||null,selectedTextFieldId:null,plannerMeta:u||null,loading:!1})}catch(r){const u=r instanceof Error?r.message:String(r);n({loading:!1,draftError:u,error:u})}},updateCard(i,r){n(u=>({activePlan:u.activePlan?{...u.activePlan,cards:u.activePlan.cards.map(f=>f.id===i?{...f,...r}:f)}:null}))},updateTextField(i,r,u){n(f=>({activePlan:f.activePlan?{...f.activePlan,cards:f.activePlan.cards.map(p=>p.id!==i||p.locked?p:{...p,textFields:p.textFields.map(m=>m.id===r?{...m,...u,source:u.source||"user"}:m)})}:null}))},addTextField(i,r){n(u=>({activePlan:u.activePlan?{...u.activePlan,cards:u.activePlan.cards.map(f=>f.id===i&&!f.locked?{...f,textFields:[...f.textFields,{...r,source:"user"}]}:f)}:null,selectedTextFieldId:r.id}))},removeTextField(i,r){n(u=>({activePlan:u.activePlan?{...u.activePlan,cards:u.activePlan.cards.map(f=>f.id===i&&!f.locked?{...f,textFields:f.textFields.filter(p=>p.id!==r)}:f)}:null,selectedTextFieldId:u.selectedTextFieldId===r?null:u.selectedTextFieldId}))},selectCard(i){n({selectedCardId:i,selectedTextFieldId:null})},selectTextField(i){n({selectedTextFieldId:i})},getGenerationSummary(){const i=o().activePlan?.cards||[];return{total:i.length,done:i.filter(r=>r.status==="generated").length,queued:i.filter(r=>r.status==="queued").length,generating:i.filter(r=>r.status==="generating").length,errors:i.filter(r=>r.status==="error").length,skipped:i.filter(r=>r.locked||r.status==="skipped").length}},async generateSet(){const i=o();if(!i.activePlan)return;const r=_.getState();n({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=o().activePlan||i.activePlan;let p=await A1({...u,size:Ch(i),quality:r.quality,moderation:r.moderation,model:r.imageModel,sessionId:r.activeSessionId});for(n(y=>({activePlan:y.activePlan?uu(y.activePlan,p):y.activePlan}));["queued","running"].includes(p.status);)await k1(900),p=await M1(p.jobId),n(y=>({activePlan:y.activePlan?uu(y.activePlan,p):y.activePlan}));const m=await wh(p.setId).catch(()=>null);n(y=>({generating:!1,activePlan:m?.plan?Oi(m.plan):y.activePlan?uu(y.activePlan,p):y.activePlan,selectedTextFieldId:null})),r.showToast(W("cardNews.generated",{count:p.generated}))}catch(u){const f=u instanceof Error?u.message:String(u);n(p=>({generating:!1,error:f,activePlan:p.activePlan?{...p.activePlan,cards:p.activePlan.cards.map(m=>m.status==="queued"||m.status==="generating"?{...m,status:"error",error:f}:m)}:p.activePlan}))}},async retryCard(i){const u=o().activePlan,f=u?.cards.find(m=>m.id===i);if(!u||!f||f.locked||!["draft","error"].includes(f.status))return;const p=_.getState();n({error:null,activePlan:{...u,cards:u.cards.map(m=>m.id===i?{...m,status:"generating",error:void 0}:m)}});try{const{card:m}=await R1({setId:u.setId,card:f,quality:p.quality,moderation:p.moderation,model:p.imageModel});n(y=>({activePlan:y.activePlan?{...y.activePlan,cards:y.activePlan.cards.map(h=>h.id===i?D1(h,Kg(m)):h)}:y.activePlan}))}catch(m){const y=m instanceof Error?m.message:String(m);n(h=>({error:y,activePlan:h.activePlan?{...h.activePlan,cards:h.activePlan.cards.map(x=>x.id===i?{...x,status:"error",error:y}:x)}:h.activePlan}))}},async loadSet(i){n({loading:!0,error:null,selectedTextFieldId:null});try{const{plan:r}=await wh(i);n({activePlan:Oi(r),selectedCardId:r.cards[0]?.id||null,selectedTextFieldId:null,loading:!1})}catch(r){n({loading:!1,error:r instanceof Error?r.message:String(r)})}}}));function L1(){const{t:n}=ye(),o=at(k=>k.hydrate),i=at(k=>k.topic),r=at(k=>k.audience),u=at(k=>k.goal),f=at(k=>k.contentBrief),p=at(k=>k.outputSizePreset),m=at(k=>k.customW),y=at(k=>k.customH),h=at(k=>k.setBriefField),x=at(k=>k.setOutputSizePreset),b=at(k=>k.setCustomSize),S=at(k=>k.draft),T=at(k=>k.loading),E=at(k=>k.generating),M=at(k=>k.draftError),O=at(k=>k.generateSet),P=at(k=>k.activePlan),Y=P?.cards||[],Z={total:Y.length,done:Y.filter(k=>k.status==="generated").length};return D.useEffect(()=>{o()},[o]),d.jsxs("section",{className:"card-news-composer","aria-label":n("cardNews.composer"),children:[d.jsx("div",{className:"card-news-composer__head",children:d.jsxs("div",{children:[d.jsx("div",{className:"section-title",children:n("cardNews.composer")}),d.jsx("p",{children:n("cardNews.composerHint")})]})}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.topic")}),d.jsx("input",{value:i,placeholder:n("cardNews.topicPlaceholder"),onChange:k=>h("topic",k.target.value)})]}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.audience")}),d.jsx("input",{value:r,placeholder:n("cardNews.audiencePlaceholder"),onChange:k=>h("audience",k.target.value)})]}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.goal")}),d.jsx("input",{value:u,placeholder:n("cardNews.goalPlaceholder"),onChange:k=>h("goal",k.target.value)})]}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.brief")}),d.jsx("textarea",{value:f,placeholder:n("cardNews.briefPlaceholder"),onChange:k=>h("contentBrief",k.target.value)})]}),d.jsxs("div",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.outputSize")}),d.jsx("div",{className:"card-news-size-row",role:"group","aria-label":n("cardNews.outputSize"),children:["1024x1024","2048x2048","custom"].map(k=>d.jsx("button",{type:"button",className:`option-btn${p===k?" active":""}`,onClick:()=>x(k),children:k==="custom"?n("cardNews.customSize"):k==="1024x1024"?"1024²":"2048²"},k))}),p==="custom"?d.jsxs("div",{className:"card-news-custom-size",children:[d.jsx("input",{className:"custom-size-input",type:"text",inputMode:"numeric",value:m,onChange:k=>b(Number.parseInt(k.target.value,10)||m,y),"aria-label":n("size.width")}),d.jsx("span",{children:"×"}),d.jsx("input",{className:"custom-size-input",type:"text",inputMode:"numeric",value:y,onChange:k=>b(m,Number.parseInt(k.target.value,10)||y),"aria-label":n("size.height")})]}):null]}),d.jsxs("button",{type:"button",className:"generate-btn card-news-draft-btn",onClick:()=>{S()},disabled:T||!i.trim(),children:[T?d.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,n(T?"cardNews.drafting":"cardNews.draft")]}),M?d.jsx("div",{className:"card-news-error",role:"alert",children:M}):null,T?d.jsxs("div",{className:"card-news-inline-status",role:"status",children:[d.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}),d.jsx("span",{children:n("cardNews.drafting")})]}):null,d.jsxs("button",{type:"button",className:"composer__tool card-news-generate-btn",onClick:()=>{O()},disabled:!P||E||P.cards.every(k=>k.locked),children:[E?d.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,E?n("cardNews.progress.generating",{done:Z.done,total:Z.total}):n("cardNews.batchGenerate")]})]})}function q1({item:n,active:o,selectLabel:i,deleteLabel:r,setRef:u,onSelect:f,onDelete:p}){const m=Ot(n),y=_a(n),h=x=>{x.dataTransfer.setData("application/ima2-ref",JSON.stringify(y?Cu(n):{image:n.url||n.image,filename:n.filename})),x.dataTransfer.effectAllowed="copy"};return d.jsxs("div",{className:"sidebar-history__item",children:[d.jsx("button",{ref:x=>u(m,x),type:"button",className:`sidebar-history__thumb${o?" active":""}${y?" sidebar-history__thumb--video":""}`,onClick:()=>f(n),"aria-label":i,title:n.prompt??"",draggable:!0,onDragStart:h,children:y?d.jsx("video",{src:n.url||n.image,muted:!0,playsInline:!0,preload:"metadata"}):d.jsx("img",{src:n.thumb||n.url||n.image,alt:"",loading:"lazy",decoding:"async"})}),d.jsx("button",{type:"button",className:"sidebar-history__delete",onClick:x=>{x.preventDefault(),x.stopPropagation(),p(n)},"aria-label":r,title:r,children:"x"})]})}function G1({entry:n,active:o,selectLabel:i,deleteLabel:r,setRef:u,onSelect:f,onDelete:p}){const m=kx(n.items.length);return d.jsxs("div",{className:"sidebar-history__item",children:[d.jsxs("button",{ref:y=>u(n.key,y),type:"button",className:`sidebar-history__sequence${o?" active":""}`,onClick:()=>f(n.sequenceId),"aria-label":i,children:[d.jsx("span",{className:`sidebar-history__sequence-grid count-${m}`,"aria-hidden":"true",children:Array.from({length:m}).map((y,h)=>{const x=n.items[h];return x?_a(x)?d.jsx("video",{src:x.url||x.image,muted:!0,playsInline:!0,preload:"metadata"},Ot(x)):d.jsx("img",{src:x.thumb||x.url||x.image,alt:"",loading:"lazy",decoding:"async"},Ot(x)):d.jsx("span",{className:"sidebar-history__sequence-placeholder"},`sequence-placeholder-${n.sequenceId}-${h}`)})}),d.jsx("span",{className:"sidebar-history__sequence-badge",children:n.items.length})]}),d.jsx("button",{type:"button",className:"sidebar-history__delete",onClick:y=>{y.preventDefault(),y.stopPropagation(),p(n.sequenceId)},"aria-label":r,title:r,children:"x"})]})}const Ah="ima2.sidebarHistoryCollapsed";function H1(){const n=_(M=>M.history),o=_(M=>M.currentImage),i=_(M=>M.selectHistory),r=_(M=>M.showHistorySequence),u=_(M=>M.trashHistoryItem),f=_(M=>M.trashHistorySequence),p=_(M=>{const O=M.multimodePreviewFlightId;return O?O.startsWith("history:")?O.slice(8):M.multimodeSequences[O]?.sequenceId??null:null}),m=_(M=>M.openGallery),y=D.useRef({}),[h,x]=D.useState(()=>{try{return localStorage.getItem(Ah)==="1"}catch{return!1}}),{t:b}=ye(),S=Tg(o,p),T=D.useMemo(()=>xg(n).slice(0,bg),[n]);D.useEffect(()=>{!S||h||y.current[S]?.scrollIntoView({block:"nearest",inline:"nearest"})},[S,h,T]),D.useEffect(()=>{try{localStorage.setItem(Ah,h?"1":"0")}catch{}},[h]);const E=(M,O)=>{y.current[M]=O};return d.jsxs("section",{className:`sidebar-history${h?" sidebar-history--collapsed":""}`,"aria-label":b("history.recentTitle"),children:[d.jsxs("div",{className:"sidebar-history__header",children:[d.jsx("span",{className:"section-title",children:b("history.recentTitle")}),d.jsxs("div",{className:"sidebar-history__header-actions",children:[d.jsx("button",{type:"button",className:"sidebar-history__gallery-button",onClick:m,"aria-label":b("history.galleryCard"),title:b("history.openGalleryTitle"),children:d.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:[d.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),d.jsx("button",{type:"button",className:"sidebar-history__toggle",onClick:()=>x(M=>!M),title:b(h?"history.expandRecent":"history.collapseRecent"),"aria-expanded":!h,children:b(h?"history.expandRecentShort":"history.collapseRecentShort")})]})]}),h?null:d.jsxs("div",{className:"sidebar-history__grid",children:[T.length===0?d.jsx("button",{type:"button",className:"sidebar-history__empty",onClick:m,children:b("history.emptyRecent")}):null,T.map(M=>M.type==="sequence"?d.jsx(G1,{entry:M,active:S===M.key,selectLabel:b("history.selectRecent"),deleteLabel:b("history.deleteSequenceAria",{count:M.items.length}),setRef:E,onSelect:r,onDelete:O=>{f(O)}},M.key):d.jsx(q1,{item:M.item,active:S===M.key,selectLabel:b("history.selectRecent"),deleteLabel:b("history.deleteImageAria"),setRef:E,onSelect:i,onDelete:O=>{u(O)}},M.key))]})]})}const Mh="(max-width: 800px)";function Di(){const[n,o]=D.useState(()=>typeof window<"u"?window.matchMedia(Mh).matches:!1);return D.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(Mh),r=()=>o(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),n}function U1(){const{t:n}=ye(),o=_(h=>h.uiMode),i=_(h=>h.workspaceProfile),r=_(h=>h.referenceImages),u=_(h=>h.clearReferences),f=Di(),p=o==="node"&&Ii?"node":"classic",m=ji(i),y=!f&&p==="classic"&&m.composerPlacement==="bottom"&&m.multimodeHistoryGrouping==="sequence";return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"logo",children:[d.jsx("div",{className:"logo-mark","aria-hidden":"true"}),d.jsxs("div",{className:"logo-copy",children:[d.jsx("div",{className:"logo-title",children:"ima2"}),d.jsx("div",{className:"logo-title logo-title--gen",children:"gen"})]}),d.jsxs("div",{className:"logo-actions",children:[d.jsx(P1,{}),d.jsx(Yg,{variant:"sidebar"}),d.jsx(N1,{})]})]}),d.jsx(v1,{}),p==="classic"?y?d.jsxs(d.Fragment,{children:[d.jsx(H1,{}),d.jsx(Ar,{})]}):d.jsxs(d.Fragment,{children:[d.jsx(Mu,{}),d.jsx(Ru,{}),d.jsx(Ar,{})]}):p==="card-news"?d.jsx(d.Fragment,{children:d.jsx(L1,{})}):p==="node"?d.jsxs(d.Fragment,{children:[d.jsx(E1,{}),r.length>0?d.jsxs("div",{className:"node-mode-ref-warning",role:"status",children:[d.jsx("strong",{children:n("node.classicRefsParkedTitle")}),d.jsx("span",{children:n("node.classicRefsParkedBody")}),d.jsx("button",{type:"button",onClick:u,children:n("node.clearParkedRefs")})]}):null,d.jsx("div",{className:"sidebar__node-hint",children:n("sidebar.nodeModeHint")}),d.jsx(Ar,{})]}):null]})}function B1(){return d.jsx("aside",{className:"sidebar",children:d.jsx("div",{className:"sidebar__scroll",children:d.jsx(U1,{})})})}function P1(){const{t:n}=ye(),o=_(p=>p.togglePromptLibrary),i=_(p=>p.promptLibraryOpen),r=_(p=>p.rightPanelOpen),u=_(p=>p.toggleRightPanel),f=()=>{!i&&!r&&u(),o()};return d.jsx("button",{type:"button",className:"settings-button",onClick:f,title:n("promptLibrary.title"),"aria-label":n("promptLibrary.title"),children:d.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:d.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})})}const F1=1024,V1=1024,Y1="blank-canvas.png";function Rh(n,o){return typeof n!="number"||!Number.isFinite(n)||n<=0?o:Math.max(1,Math.round(n))}async function K1(n){const o=Rh(n?.width,F1),i=Rh(n?.height,V1),r=document.createElement("canvas");r.width=o,r.height=i;const u=r.getContext("2d");if(!u)throw new Error("blank_canvas_context_unavailable");u.fillStyle="#ffffff",u.fillRect(0,0,r.width,r.height);const f=await new Promise((p,m)=>{r.toBlob(y=>{y?p(y):m(new Error("blank_canvas_blob_unavailable"))},"image/png")});return new File([f],Y1,{type:"image/png"})}const hr=1024;function X1(n){const o=/^(\d+)x(\d+)$/.exec(n);if(!o)return{width:hr,height:hr};const i=Number.parseInt(o[1]??"",10),r=Number.parseInt(o[2]??"",10);return!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0?{width:hr,height:hr}:{width:i,height:r}}function Q1(){const n=_(y=>y.importLocalImageToHistory),o=_(y=>y.openCanvas),i=_(y=>y.showToast),r=_(y=>y.getResolvedSize),{t:u}=ye(),[f,p]=D.useState(!1),m=D.useCallback(async()=>{if(!f){p(!0);try{const y=X1(r()),h=await K1(y);await n(h)&&o()}catch{i(u("canvas.blank.failed"),!0)}finally{p(!1)}}},[f,r,n,o,i,u]);return{creatingBlankCanvas:f,createBlankCanvas:m}}const Z1="canvas-mode-context",J1="Canvas Mode",$1=["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(`
30
- `);function W1({imageOverride:n=null,onAfterDeleteFocus:o}){const{t:i}=ye(),r=_($=>$.currentImage),u=_($=>$.showToast),f=_($=>$.insertPromptToComposer),p=_($=>$.createRootNodeFromHistoryItem),m=_($=>$.trashHistoryItem),y=_($=>$.permanentlyDeleteHistoryItemByClick),h=_($=>$.canvasOpen),x=_($=>$.openCanvas),[b,S]=D.useState(!1),[T,E]=D.useState(!1),M=n??r;if(!M)return null;const O=!!M.filename,P=!!M.filename&&!_a(M),Y=async()=>{if(!(!M.filename||T)){E(!0);try{await _.getState().animateImage(M.filename,M.prompt??void 0),u(i("toast.animateDone"))}catch($){const le=$ instanceof Error?$.message:i("toast.animateFailed");u(le,!0)}finally{E(!1)}}},Z=()=>{const $=document.createElement("a");$.href=M.image,$.download=M.filename||"generated.png",$.click()},k=async()=>{try{const le=await(await fetch(M.image)).blob();let Ae;if(le.type==="image/png")Ae=le;else{const we=new Image;we.crossOrigin="anonymous";const Q=URL.createObjectURL(le);await new Promise((X,ie)=>{we.onload=()=>X(),we.onerror=ie,we.src=Q});const w=document.createElement("canvas");w.width=we.naturalWidth,w.height=we.naturalHeight,w.getContext("2d").drawImage(we,0,0),URL.revokeObjectURL(Q),Ae=await new Promise((X,ie)=>w.toBlob(Ne=>Ne?X(Ne):ie(),"image/png"))}await navigator.clipboard.write([new ClipboardItem({"image/png":Ae})]),u(i("toast.imageCopied"))}catch{u(i("toast.copyFailed"),!0)}},ne=()=>{M.prompt&&(navigator.clipboard.writeText(M.prompt),u(i("toast.promptCopied")))},F=async()=>{let $={ok:!1,isVideo:!1,hasPrompt:!1};try{$=await bu(M)}catch{}h&&n&&f({id:Z1,name:J1,text:$1});const le=document.querySelector('textarea[name="prompt"], textarea#prompt, .sidebar textarea');le&&(le.focus(),le.setSelectionRange(le.value.length,le.value.length)),u(i($.hasPrompt?"toast.forkStarted":"toast.forkStartedNoPrompt"))},ee=async()=>{if(!(!M.filename||b)){S(!0);try{const $=await Jb({filename:M.filename});u(i("toast.comfyExported",{filename:$.uploadedFilename}))}catch($){const le=$ instanceof Error?$.code:void 0;u(i(le==="COMFY_URL_NOT_LOCAL"?"toast.comfyExportInvalidUrl":le==="COMFY_IMAGE_INVALID"?"toast.comfyExportInvalidImage":le==="COMFY_IMAGE_NOT_FOUND"?"toast.comfyExportImageNotFound":"toast.comfyExportFailed"),!0)}finally{S(!1)}}},Ee=()=>{p(M),u(i("toast.nodeRootCreated"))},Ie=async()=>{try{await m(M)}finally{o?.()}},K=async()=>{try{await y(M)}finally{o?.()}};return d.jsxs("div",{className:"result-actions",children:[d.jsx("button",{type:"button",className:"action-btn",onClick:Z,children:i("result.download")}),d.jsx("button",{type:"button",className:"action-btn",onClick:k,children:i("result.copyImage")}),d.jsx("button",{type:"button",className:"action-btn",onClick:ne,children:i("result.copyPrompt")}),d.jsx("button",{type:"button",className:"action-btn action-btn--primary",onClick:F,title:i("result.continueHereTitle"),children:i("result.continueHere")}),P&&d.jsx("button",{type:"button",className:"action-btn",onClick:()=>{Y()},disabled:T,title:i("result.animateTitle"),children:i(T?"result.animating":"result.animate")}),d.jsx("button",{type:"button",className:"action-btn",onClick:Ee,title:i("result.firstNodeTitle"),children:i("result.firstNode")}),!h&&d.jsx("button",{type:"button",className:"action-btn",onClick:x,title:i("canvas.open"),"aria-label":i("canvas.openAria"),children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:d.jsx("path",{d:"M4 4h8v8M12 4l-8 8"})})}),M.filename&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"action-btn action-btn--danger",onClick:()=>{Ie()},title:i("result.deleteTitle"),children:i("result.delete")}),d.jsxs("details",{className:"result-actions__more",children:[d.jsx("summary",{className:"action-btn",children:i("result.more")}),d.jsxs("div",{className:"result-actions__menu",children:[O&&d.jsx("button",{type:"button",className:"result-actions__menu-item",onClick:()=>{ee()},title:i("result.sendToComfyUITitle"),disabled:b,children:i("result.sendToComfyUI")}),d.jsx("button",{type:"button",className:"result-actions__menu-item result-actions__danger-item",onClick:()=>{K()},children:i("result.permanentDelete")})]})]})]})]})}function eT({prompt:n,onCopy:o}){const{t:i}=ye(),r=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),o())};return d.jsx("div",{className:"result-prompt",onClick:o,onKeyDown:r,role:"button",tabIndex:0,title:i("result.copyPrompt"),"aria-label":i("result.copyPrompt"),children:d.jsx("span",{className:"result-prompt__text",children:n})})}function tT(){const n=_(S=>{const T=S.multimodePreviewFlightId;return T?S.multimodeSequences[T]??null:null}),o=_(S=>S.cancelMultimode),i=_(S=>{const T=S.multimodePreviewFlightId;return!!(T&&(S.multimodeAbortControllers[T]||S.inFlight.some(E=>E.id===T)))}),r=_(S=>S.selectHistory),u=_(S=>S.currentImage),f=_(S=>S.openCanvas),{t:p}=ye(),m=S=>{r(S)},y=S=>{r(S),f()};if(!n)return null;const h=new Map,x=n.partials.filter(S=>S.index==null);for(const S of n.partials)S.index!=null&&h.set(S.index,S);const b=Array.from({length:n.requested},(S,T)=>{const E=n.images[T],M=h.get(T)??(E?void 0:x.shift());return{index:T,image:E,partial:M}});return d.jsxs("section",{className:"multimode-sequence","aria-live":"polite",children:[d.jsxs("div",{className:"multimode-sequence__header",children:[d.jsxs("div",{children:[d.jsx("div",{className:"multimode-sequence__title",children:p("multimode.sequenceTitle")}),d.jsx("div",{className:"multimode-sequence__meta",children:p("multimode.sequenceProgress",{returned:n.returned,requested:n.requested})})]}),i?d.jsx("button",{type:"button",className:"secondary-btn",onClick:o,children:p("multimode.cancel")}):null]}),d.jsx("div",{className:`multimode-sequence__grid count-${Math.min(n.requested,4)}`,children:b.map(({index:S,image:T,partial:E})=>{const M=T&&u?.filename&&T.filename===u.filename;return d.jsxs("article",{className:`multimode-sequence__slot${T?" done":""}${M?" active":""}`,onClick:T?()=>m(T):void 0,onDoubleClick:T?()=>y(T):void 0,role:T?"button":void 0,tabIndex:T?0:void 0,onKeyDown:T?O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),m(T))}:void 0,children:[d.jsx("div",{className:"multimode-sequence__badge",children:p("multimode.stageLabel",{index:S+1})}),T?d.jsx("img",{src:T.url??T.image,alt:p("canvas.resultAlt"),loading:"lazy",decoding:"async"}):E?d.jsx("img",{src:E.image,alt:p("multimode.partialAlt"),loading:"lazy",decoding:"async"}):d.jsx("div",{className:"multimode-sequence__empty",children:n.status==="error"?p("multimode.error"):n.status==="empty"?p("multimode.empty"):n.status==="canceled"?p("multimode.canceled"):n.status==="partial"?p("multimode.notReturned"):p("multimode.generating")})]},T?.filename??S)})})]})}function aT({zoom:n,minZoom:o,maxZoom:i,onZoomIn:r,onZoomOut:u,onReset:f,labels:p}){return d.jsxs("div",{className:"viewer-controls","aria-label":p.controls,onPointerDown:m=>m.stopPropagation(),onDoubleClick:m=>m.stopPropagation(),onWheel:m=>m.stopPropagation(),children:[d.jsx("button",{type:"button",className:"viewer-control-btn",onClick:m=>{m.stopPropagation(),u()},disabled:n<=o,"aria-label":p.zoomOut,children:"-"}),d.jsxs("button",{type:"button",className:"viewer-control-btn viewer-control-btn--label",onClick:m=>{m.stopPropagation(),f()},"aria-label":p.reset,children:[Math.round(n*100),"%"]}),d.jsx("button",{type:"button",className:"viewer-control-btn",onClick:m=>{m.stopPropagation(),r()},disabled:n>=i,"aria-label":p.zoomIn,children:"+"})]})}function Mr(n){return n instanceof HTMLElement?n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement||n instanceof HTMLButtonElement||n.isContentEditable:!1}const Nn=1,Qg=5,gr=.22;function nT(n){return Math.min(Qg,Math.max(Nn,n))}function lT(n){const[o,i]=D.useState(1),[r,u]=D.useState({x:0,y:0}),[f,p]=D.useState(null),m=D.useRef(0),y=D.useRef(null),h=D.useCallback(()=>{cancelAnimationFrame(m.current),m.current=0,y.current=null,i(1),u({x:0,y:0}),p(null)},[]);D.useEffect(()=>{h()},[h,n]),D.useEffect(()=>()=>{cancelAnimationFrame(m.current)},[]);const x=D.useCallback(O=>{i(P=>{const Y=nT(P+O);return Y<=Nn?(u({x:0,y:0}),Nn):Number(Y.toFixed(2))})},[]),b=D.useCallback(O=>{O.preventDefault(),x(O.deltaY<0?gr:-gr)},[x]),S=D.useCallback(()=>{if(o>Nn){h();return}i(2)},[h,o]),T=D.useCallback(O=>{o<=Nn||O.button!==0||(O.preventDefault(),O.currentTarget.setPointerCapture(O.pointerId),p({pointerId:O.pointerId,startX:O.clientX,startY:O.clientY,baseX:r.x,baseY:r.y}))},[r.x,r.y,o]),E=D.useCallback(O=>{if(!f||f.pointerId!==O.pointerId)return;const P={x:f.baseX+O.clientX-f.startX,y:f.baseY+O.clientY-f.startY};y.current=P,cancelAnimationFrame(m.current),m.current=requestAnimationFrame(()=>{u(P),y.current=null})},[f]),M=D.useCallback(O=>{!f||f.pointerId!==O.pointerId||(cancelAnimationFrame(m.current),m.current=0,y.current&&(u(y.current),y.current=null),p(null),O.currentTarget.releasePointerCapture(O.pointerId))},[f]);return{zoom:o,pan:r,reset:h,zoomIn:()=>x(gr),zoomOut:()=>x(-gr),handleWheel:b,handleDoubleClick:S,handlePointerDown:T,handlePointerMove:E,handlePointerUp:M}}const iT=D.lazy(()=>wa(()=>import("./index-31uVIdt4.js"),[]).then(n=>({default:n.CanvasModeWorkspace})));function oT(n){return n==="low"?"l":n==="medium"?"m":n==="high"?"h":n??null}function rT(n){if(!n)return null;const o=n.match(/^(\d+)x\1$/);return o?`${o[1]}²`:n.replace("x","×")}function sT(n){const o=n.url??n.image;if(!n.canvasVersion||!n.canvasMergedAt||o.startsWith("data:"))return o;const i=o.includes("?")?"&":"?";return`${o}${i}canvasMergedAt=${n.canvasMergedAt}`}function Su(){const n=_(w=>w.currentImage),o=_(w=>w.importLocalImageToHistory),i=_(w=>{const X=w.multimodePreviewFlightId;return X?w.multimodeSequences[X]??null:null}),r=_(w=>w.selectHistoryShortcutTarget),u=_(w=>w.trashHistoryItem),f=_(w=>w.permanentlyDeleteHistoryItemByShortcut),p=_(w=>w.markGeneratedResultsSeen),m=_(w=>w.activeGenerations),y=_(w=>w.quality),h=_(w=>w.getResolvedSize),x=_(w=>w.canvasOpen),b=_(w=>w.openCanvas),S=_(w=>w.showToast),{t:T}=ye(),[E,M]=D.useState(!1),{creatingBlankCanvas:O,createBlankCanvas:P}=Q1(),Y=D.useRef(null),Z=n?`${n.filename??n.url??n.image}:${n.canvasMergedAt??""}`:null,k=lT(Z),ne=()=>{n?.prompt&&(navigator.clipboard.writeText(n.prompt),S(T("toast.promptCopied")))},F=w=>{if(w.key==="Delete"||w.key==="Backspace"){if(!n||w.target!==w.currentTarget||Mr(w.target))return;if(w.preventDefault(),w.shiftKey){f(n);return}u(n);return}w.key!=="ArrowLeft"&&w.key!=="ArrowRight"&&w.key!=="Home"&&w.key!=="End"||w.target===w.currentTarget&&(Mr(w.target)||(w.preventDefault(),w.key==="ArrowLeft"?r("previous"):w.key==="ArrowRight"?r("next"):w.key==="Home"?r("first"):w.key==="End"&&r("last")))},ee=w=>{Mr(w.target)||(p(),w.currentTarget.focus())},Ee=D.useCallback(()=>{window.requestAnimationFrame(()=>Y.current?.focus())},[]),Ie=D.useCallback(w=>{Array.from(w.dataTransfer.types).includes("Files")&&(w.preventDefault(),M(X=>X||!0))},[]),K=D.useCallback(w=>{w.currentTarget.contains(w.relatedTarget)||M(!1)},[]),$=D.useCallback(async w=>{if(!Array.from(w.dataTransfer.types).includes("Files"))return;w.preventDefault(),M(!1);const X=Array.from(w.dataTransfer.files).filter(ie=>/^image\/(png|jpeg|webp)$/.test(ie.type));X.length!==0&&await o(X[0])},[o]);if(x&&n)return d.jsx(D.Suspense,{fallback:d.jsx("main",{className:"canvas canvas--mode-open","aria-busy":"true"}),children:d.jsx(iT,{currentImage:n})});const le=oT(n?.quality??y),Ae=rT(n?.size??h()),we=fx(n?.model),Q=n?sT(n):null;return d.jsxs("main",{className:`canvas${E?" canvas--drop-active":""}`,onDragOver:Ie,onDragLeave:K,onDrop:$,children:[E?d.jsx("div",{className:"canvas__drop-overlay","aria-hidden":!0,children:d.jsx("span",{className:"canvas__drop-hint",children:T("canvas.drop.hint")})}):null,d.jsx("div",{className:`progress-bar${m>0?" active":""}`}),i?d.jsx(tT,{}):n&&Q?d.jsxs("div",{ref:Y,className:"result-container visible",tabIndex:0,onMouseDown:ee,onKeyDown:F,"aria-label":T("canvas.imageViewerAria"),children:[d.jsxs("div",{className:`result-preview-frame canvas-annotation-frame${k.zoom>Nn?" canvas-annotation-frame--zoomed":""}`,onWheel:k.handleWheel,onDoubleClick:k.handleDoubleClick,onPointerDown:k.handlePointerDown,onPointerMove:k.handlePointerMove,onPointerUp:k.handlePointerUp,onPointerCancel:k.handlePointerUp,children:[_a(n)?d.jsx("video",{className:"result-img",src:Q,controls:!0,autoPlay:!0,loop:!0,playsInline:!0,style:{transform:`translate(${k.pan.x}px, ${k.pan.y}px) scale(${k.zoom})`}},Z??void 0):d.jsx("img",{className:"result-img",src:Q,alt:T("canvas.resultAlt"),decoding:"async",style:{transform:`translate(${k.pan.x}px, ${k.pan.y}px) scale(${k.zoom})`},onDoubleClick:w=>{w.stopPropagation(),b()}},Z??void 0),d.jsx(aT,{zoom:k.zoom,minZoom:Nn,maxZoom:Qg,onZoomIn:k.zoomIn,onZoomOut:k.zoomOut,onReset:k.reset,labels:{controls:T("viewer.controls"),zoomIn:T("viewer.zoomIn"),zoomOut:T("viewer.zoomOut"),reset:T("viewer.reset")}})]}),d.jsx("div",{className:"result-meta",children:(_a(n)?[n.elapsed!=null?`${n.elapsed}s`:null,n.video?.duration?`${n.video.duration}s clip`:null,n.video?.resolution??null,n.video?.aspectRatio??null,_g(n.videoContinuity),we,n.provider??null]:[n.elapsed!=null?`${n.elapsed}s`:null,n.usage?T("canvas.tokens",{n:n.usage.total_tokens??"?"}):null,gx(n.reasoningEffort),le,Ae,we,n.provider??null]).filter(w=>!!w).join(" · ")}),d.jsx(W1,{onAfterDeleteFocus:Ee}),n.prompt?d.jsx(eT,{prompt:n.prompt,onCopy:ne}):null]}):n?null:d.jsxs("div",{className:"canvas__blank-entry",children:[d.jsx("div",{className:"canvas__blank-sheet","aria-hidden":!0}),d.jsxs("div",{className:"canvas__blank-copy",children:[d.jsx("strong",{children:T("canvas.blank.title")}),d.jsx("span",{children:T("canvas.blank.subtitle")})]}),d.jsx("button",{type:"button",className:"canvas__blank-button",onClick:()=>{P()},disabled:O,children:T(O?"canvas.blank.creating":"canvas.blank.create")})]})]})}function cT(){return d.jsxs("div",{className:"classic-workspace",children:[d.jsx("div",{className:"classic-workspace__stage",children:d.jsx(Su,{})}),d.jsxs("div",{className:"classic-workspace__dock",children:[d.jsx(Mu,{variant:"bottom"}),d.jsx(Ru,{})]})]})}function Na({title:n,help:o,items:i,value:r,onChange:u}){return d.jsxs("div",{className:"option-group",children:[n?d.jsx("div",{className:"section-title",children:n}):null,d.jsx("div",{className:"option-row",children:i.map(f=>d.jsxs("button",{className:`option-btn${f.value===r?" active":""}`,style:f.color?{color:f.color}:void 0,disabled:f.disabled,onClick:()=>u(f.value),type:"button",children:[f.label,f.sub?d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:f.sub})]}):null]},f.value))}),o?d.jsx("p",{className:"option-help",children:o}):null]})}const Zg="ima2.customSizeSlots";function uT(n){if(!n||typeof n!="object")return!1;const o=n;return typeof o.id=="string"&&typeof o.w=="number"&&typeof o.h=="number"&&typeof o.updatedAt=="number"}function dT(){try{const n=localStorage.getItem(Zg);if(!n)return[];const o=JSON.parse(n);return Array.isArray(o)?bl(o.filter(uT)):[]}catch{return[]}}function fT(n){try{localStorage.setItem(Zg,JSON.stringify(bl(n)))}catch{}}function mT(n,o,i){return zr({id:`slot_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,w:n,h:o,ratio:i,updatedAt:Date.now()})}function _i(n){return n.map(o=>({value:o.value,label:o.label,sub:o.sub}))}function pT(){const n=_(Q=>Q.sizePreset),o=_(Q=>Q.setSizePreset),i=_(Q=>Q.customW),r=_(Q=>Q.customH),u=_(Q=>Q.setCustomSize),{t:f}=ye(),[p,m]=D.useState(String(i)),[y,h]=D.useState(String(r)),[x,b]=D.useState(n==="custom"),[S,T]=D.useState(()=>dT()),[E,M]=D.useState(null),[O,P]=D.useState("free"),Y=n==="custom",Z=_u(p,y,i,r),k=ux().filter(Q=>Q.value==="auto");D.useEffect(()=>{m(String(i)),h(String(r))},[i,r]),D.useEffect(()=>{Y||(b(!1),M(null))},[Y]);function ne(Q){T(Q),fT(Q)}function F(){const Q=na(p,i),w=na(y,r);u(Q,w),m(String(Q)),h(String(w))}function ee(Q){Q.key==="Enter"&&(Q.preventDefault(),F())}function Ee(){o("custom"),b(!0),M(S.length>=vl?S[0]?.id??null:null)}function Ie(Q){o(Q),Q!=="custom"&&(b(!1),M(null))}function K(Q){o("custom"),u(Q.w,Q.h),m(String(Q.w)),h(String(Q.h)),b(!1),M(Q.id)}function $(Q){P(Q.id);const w=nx(Q);w&&(m(String(w.w)),h(String(w.h)))}function le(){const Q=mT(Z.w,Z.h,O),w=S.length>=vl&&E?ix(S,E,Q):lx(S,Q);ne(w),o("custom"),u(Z.w,Z.h),m(String(Z.w)),h(String(Z.h)),M(Q.id),b(!1)}const Ae=Z.reasons.length>0?Z.reasons.map(Q=>f(`size.adjustedReasons.${Q}`)).join(", "):f("size.noAdjustment"),we=Z.reasons.includes("maxPixels")&&Z.requestedW===Z.requestedH&&Z.w===Z.h?f("size.squareMaxHint",{size:`${Wp}×${Wp}`}):null;return d.jsxs("div",{className:"option-group size-picker",children:[d.jsx("div",{className:"section-title",children:f("size.title")}),d.jsx(Na,{title:"",items:_i(ox),value:n,onChange:Ie}),d.jsx(Na,{title:"",items:_i(rx),value:n,onChange:Ie}),d.jsx(Na,{title:"",items:_i(sx),value:n,onChange:Ie}),d.jsx(Na,{title:"",items:_i(cx),value:n,onChange:Ie}),d.jsxs("div",{className:"option-row size-picker__quick-row",children:[_i(k).map(Q=>d.jsxs("button",{type:"button",className:`option-btn${n===Q.value?" active":""}`,onClick:()=>Ie(Q.value),children:[Q.label,Q.sub?d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:Q.sub})]}):null]},Q.value)),d.jsxs("button",{type:"button",className:`option-btn${Y?" active":""}`,onClick:Ee,children:[f("size.customPlus"),d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:f("size.customSub")})]})]}),S.length>0?d.jsx("div",{className:"option-row size-picker__slot-row",children:S.map(Q=>d.jsxs("button",{type:"button",className:`option-btn size-picker__slot${Y&&i===Q.w&&r===Q.h?" active":""}`,onClick:()=>K(Q),children:[Q.w,"×",Q.h,d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:Q.ratio||f("size.customSlot")})]},Q.id))}):null,x?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"size-picker__ratio-row",children:tx.map(Q=>d.jsx("button",{type:"button",className:`size-picker__ratio${O===Q.id?" active":""}`,onClick:()=>$(Q),children:Q.id==="free"?f("size.ratioFree"):Q.label},Q.id))}),d.jsxs("div",{className:"option-row size-picker__custom-row",children:[d.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:F,onKeyDown:ee,placeholder:f("size.width")}),d.jsx("span",{className:"size-picker__dimension-separator","aria-hidden":"true",children:"×"}),d.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"custom-size-input",value:y,onChange:Q=>h(Q.target.value.replace(/\D/g,"")),onBlur:F,onKeyDown:ee,placeholder:f("size.height")})]}),d.jsxs("div",{className:"size-picker__preview",children:[d.jsx("span",{children:f("size.normalizedPreview")}),d.jsx("strong",{children:ax(Z.w,Z.h)})]}),d.jsx("div",{className:"size-picker__preview size-picker__preview--reason",children:Ae}),we?d.jsx("div",{className:"size-picker__preview size-picker__preview--detail",children:we}):null,S.length>=vl?d.jsxs("div",{className:"size-picker__replace-row",children:[d.jsx("span",{children:f("size.replaceCustomSlot")}),S.map(Q=>d.jsxs("button",{type:"button",className:`size-picker__replace${E===Q.id?" active":""}`,onClick:()=>M(Q.id),children:[Q.w,"×",Q.h]},Q.id))]}):null,d.jsx("button",{type:"button",className:"size-picker__save",onClick:le,children:S.length>=vl?f("size.replaceCustomSlot"):f("size.saveCustomSlot")}),d.jsx("div",{className:"size-hint",children:f("size.hint")})]}):null]})}const du=[1,2,4];function Oh(n){return Math.min(8,Math.max(1,Math.trunc(n||1)))}function hT(){const n=_(Y=>Y.count),o=_(Y=>Y.setCount),i=_(Y=>Y.uiMode),r=_(Y=>Y.multimode),u=_(Y=>Y.multimodeMaxImages),f=_(Y=>Y.setMultimodeMaxImages),{t:p}=ye(),m=i==="classic"&&r,y=m?u:n,h=m?f:o,[x,b]=D.useState(!du.includes(y)),[S,T]=D.useState(String(y));D.useEffect(()=>{b(!du.includes(y)),T(String(y))},[m,y]);function E(Y=S){const Z=Oh(Number.parseInt(Y,10));h(Z),T(String(Z))}function M(Y){b(!1),T(String(Y)),h(Y)}function O(Y){const Z=Oh(y+Y);b(!0),T(String(Z)),h(Z)}function P(Y){Y.key==="Enter"&&(Y.preventDefault(),E())}return d.jsxs("div",{className:"option-group count-picker",children:[d.jsx("div",{className:"section-title",children:p(m?"multimode.maxStages":"count.title")}),d.jsxs("div",{className:"option-row",children:[du.map(Y=>d.jsx("button",{type:"button",className:`option-btn${y===Y&&!x?" active":""}`,onClick:()=>M(Y),children:Y},Y)),d.jsx("button",{type:"button",className:`option-btn${x?" active":""}`,onClick:()=>{b(Y=>!Y),T(String(y))},children:p("count.customPlus")})]}),x?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"count-picker__custom",children:[d.jsx("button",{type:"button",className:"count-picker__step",onClick:()=>O(-1),"aria-label":p("count.decrease"),children:"-"}),d.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"count-picker__input",value:S,onChange:Y=>T(Y.target.value.replace(/\D/g,"")),onBlur:()=>E(),onKeyDown:P,"aria-label":p("count.customLabel")}),d.jsx("button",{type:"button",className:"count-picker__step",onClick:()=>O(1),"aria-label":p("count.increase"),children:"+"})]}),d.jsx("p",{className:"option-help",children:y>=5?p(m?"multimode.highCountHint":"count.highCountHint"):p(m?"multimode.minMaxHint":"count.minMaxHint")})]}):null]})}const gT={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 yT(n,o){return gT[n]?.[o]??0}function vT(){const{t:n}=ye(),o=_(b=>b.provider),i=_(b=>b.quality),r=_(b=>b.multimode),u=_(b=>b.multimodeMaxImages),p=_(b=>b.getResolvedSize)(),m=o==="oauth"||o==="grok",y=yT(i,p),h=m?n("cost.free"):r?n("cost.multimodeApprox",{amount:(y*u).toFixed(3),count:u}):n("cost.approx",{amount:y.toFixed(3)}),x=m?"var(--green)":void 0;return d.jsxs("div",{className:"cost-estimate",children:[d.jsx("span",{children:n("cost.label")}),d.jsx("span",{className:"price",style:x?{color:x}:void 0,children:h})]})}function bT(){const[n,o]=D.useState(null);return D.useEffect(()=>{let i=!1,r=null;const u=async()=>{try{const f=await Ub();if(i)return;o(f),f.status==="starting"&&(r=setTimeout(u,3e3))}catch{i||o(null)}};return u(),()=>{i=!0,r&&clearTimeout(r)}},[]),n}function ST(){const[n,o]=D.useState(null),[i,r]=D.useState(!1);return D.useEffect(()=>{let u=!1;return Bb().then(f=>{u||o(f)}).catch(()=>{u||r(!0)}),()=>{u=!0}},[]),{data:n,error:i}}function xT(){const[n,o]=D.useState(null);return D.useEffect(()=>{let i=!1,r=null;const u=async()=>{try{const f=await fetch("/api/grok/status");if(i)return;const p=await f.json();o(p),p.status!=="ready"&&(r=setTimeout(u,1e4))}catch{i||o({status:"offline"})}};return u(),()=>{i=!0,r&&clearTimeout(r)}},[]),n}function TT({open:n,providerLabel:o,reason:i,hint:r,onClose:u}){const{t:f}=ye();if(D.useEffect(()=>{if(!n)return;const m=y=>{y.key==="Escape"&&u()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,u]),!n)return null;const p=f("apiDisabled.title",{provider:o});return d.jsx("div",{className:"modal-backdrop",onClick:u,role:"presentation",children:d.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p,onClick:m=>m.stopPropagation(),children:[d.jsx("div",{className:"modal__title",children:p}),d.jsxs("div",{className:"modal__body",children:[d.jsx("p",{children:i}),r?d.jsx("p",{className:"modal__hint",children:r}):null]}),d.jsx("div",{className:"modal__actions",children:d.jsx("button",{type:"button",className:"modal__btn",onClick:u,children:f("common.ok")})})]})})}function Jg(){const{t:n}=ye(),o=bT(),{data:i}=ST(),r=xT(),u=o?.status==="ready";let f=n("provider.oauthNotReady"),p;o?.status==="auth_required"?(f=n("provider.codexLoginRequired"),p=n("provider.codexLoginHint")):o?.status==="starting"?f=n("provider.oauthStarting"):o||(f=n("provider.serverUnreachable"));const m=i?.apiKeyValid===!0,y=r?.status==="ready",h=r?r.status==="offline"?n("provider.grokOffline"):r.status==="no_image_model"?n("provider.grokNoImageModel"):r.status==="error"?n("provider.grokNotReady"):"":n("provider.grokNotReady");return{oauth:{ok:u,reason:f,hint:p},api:{ok:m,reason:m?"":n("provider.apiInvalid")},grok:{ok:y,reason:h,hint:y?void 0:n("provider.grokOfflineHint")}}}function ET({allowGrok:n=!0}){const{t:o}=ye(),i=_(b=>b.provider),r=_(b=>b.setProvider),u=Jg(),[f,p]=D.useState(null),m=[{value:"oauth",label:`GPT
31
- OAuth`},{value:"api",label:`GPT
32
- API`},{value:"grok",label:`Grok
33
- OAuth`}],y={...u,grok:n?u.grok:{ok:!1,reason:o("provider.grokClassicOnly"),hint:o("provider.grokClassicOnlyHint")}},h=b=>{y[b].ok?r(b):p(b)},x=f?{label:m.find(b=>b.value===f).label,...y[f]}:null;return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"section-title",children:o("provider.authTitle")}),d.jsx("div",{className:"provider-row",children:m.map(b=>{const S=i===b.value,T=y[b.value].ok;return d.jsxs("button",{type:"button",className:`provider-pill${S?" selected":""}`,onClick:()=>h(b.value),title:T?o("provider.availableTitle",{name:b.label}):y[b.value].reason,"aria-label":T?o("provider.availableAria",{name:b.label}):o("provider.unavailableAria",{name:b.label}),"aria-pressed":S,children:[d.jsx("span",{className:`status-dot ${T?"status-dot--ok":"status-dot--bad"}`,"aria-hidden":"true"}),d.jsx("span",{children:b.label}),d.jsx("span",{className:"sr-only",children:o(T?"provider.availableSr":"provider.unavailableSr")})]},b.value)})}),i==="grok"?d.jsx("p",{className:"provider-helper",children:o("provider.grokManagedByIma2")}):null,d.jsx(TT,{open:!!x,providerLabel:x?.label??"",reason:x?.reason??"",hint:x?.hint,onClose:()=>p(null)})]})}const NT=[{value:"480p",label:"480p"},{value:"720p",label:"720p"}],_T=["auto","1:1","16:9","9:16","4:3","3:4","3:2","2:3"].map(n=>({value:n,label:n})),wT=[3,5,8,10,12,15];function CT(){const{t:n}=ye(),o=_(E=>E.activeVideoRefCount()),i=_(E=>E.videoDuration),r=_(E=>E.setVideoDuration),u=_(E=>E.videoResolution),f=_(E=>E.setVideoResolution),p=_(E=>E.videoAspectRatio),m=_(E=>E.setVideoAspectRatio),y=_(E=>E.videoTopic),h=_(E=>E.setVideoTopic),x=_(E=>E.videoContinuityLineage),b=o>=2?$h:15,S=Wh(o),T=_g(x);return d.jsxs("div",{className:"right-panel-settings video-controls",children:[d.jsxs("div",{className:"provider-compat-note",role:"note",children:[d.jsx("strong",{children:n("video.modeLabel")}),d.jsx("span",{children:n(`video.mode.${S}`,{n:o})})]}),d.jsxs("div",{className:"provider-compat-note",role:"note",children:[d.jsx("strong",{children:"Active prompt"}),d.jsx("span",{children:Nr})]}),T?d.jsxs("div",{className:"provider-compat-note",role:"note",children:[d.jsx("strong",{children:"Continuity"}),d.jsx("span",{children:T})]}):null,d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("video.seriesTopicTitle")??"시리즈 주제"}),d.jsx("input",{type:"text",className:"video-topic-input",placeholder:n("video.seriesTopicPlaceholder")??"예: 한국 여행 브이로그",value:y,onChange:E=>h(E.target.value)})]}),d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("video.durationTitle")}),d.jsx("div",{className:"option-row",children:wT.filter(E=>E<=b).map(E=>d.jsxs("button",{type:"button",className:`option-btn${i===E?" active":""}`,onClick:()=>r(E),children:[E,"s"]},E))})]}),d.jsx(Na,{title:n("video.resolutionTitle"),items:NT,value:u,onChange:f}),d.jsx(Na,{title:n("video.aspectTitle"),items:_T,value:p,onChange:m})]})}const AT=[{value:"png",label:"PNG"},{value:"jpeg",label:"JPEG"},{value:"webp",label:"WebP"}];function $g(){const{t:n}=ye(),o=_(O=>O.provider),i=_(O=>O.quality),r=_(O=>O.setQuality),u=_(O=>O.format),f=_(O=>O.setFormat),p=_(O=>O.moderation),m=_(O=>O.setModeration),y=_(O=>O.multimode),h=_(O=>O.setMultimode),x=_(O=>O.uiMode),b=_(O=>O.videoModelSelected),S=x==="classic",T=o==="grok",E=[{value:"low",label:n("quality.lowLabel"),sub:n("quality.lowSub")},{value:"medium",label:n("quality.mediumLabel"),sub:n("quality.mediumSub")},{value:"high",label:n("quality.highLabel"),sub:n("quality.highSub")}],M=[{value:"auto",label:n("moderation.autoLabel"),sub:n("moderation.autoSub")},{value:"low",label:n("moderation.lowLabel"),sub:n("moderation.lowSub"),color:"var(--amber)"}];return d.jsxs("div",{className:"right-panel-settings",role:"tabpanel",children:[d.jsx(ET,{allowGrok:!0}),b?d.jsx(CT,{}):d.jsxs(d.Fragment,{children:[T?d.jsxs("div",{className:"provider-compat-note",role:"note",children:[d.jsx("strong",{children:n("provider.grokCompatTitle")}),d.jsx("span",{children:n("provider.grokCompatBody")})]}):null,d.jsx(Na,{title:n(T?"quality.grokTitle":"quality.title"),items:E,value:i,onChange:r}),d.jsx(pT,{}),T?null:d.jsxs(d.Fragment,{children:[d.jsx(Na,{title:n("format.title"),items:AT,value:u,onChange:f}),d.jsx(Na,{title:n("moderation.title"),items:M,value:p,onChange:m}),d.jsx("p",{className:"option-help",children:n("moderation.explain")})]}),S&&d.jsx("div",{className:"option-group multimode-toggle",children:d.jsxs("button",{type:"button",className:`multimode-toggle__button${y?" active":""}`,"aria-pressed":y,title:n("multimode.tooltip"),onClick:()=>h(!y),children:[d.jsx("span",{children:n("multimode.label")}),d.jsx("span",{children:n("multimode.shortHint")})]})}),d.jsx(hT,{}),d.jsx(vT,{})]})]})}const MT=D.lazy(()=>wa(()=>import("./PromptLibraryPanel-BMjQegRa.js"),[]).then(n=>({default:n.PromptLibraryPanel}))),RT=D.lazy(()=>wa(()=>import("./PromptBuilderPanel-CUTujJUV.js"),[]).then(n=>({default:n.PromptBuilderPanel})));function OT(){const n=_(E=>E.rightPanelOpen),o=_(E=>E.toggleRightPanel),i=_(E=>E.promptLibraryOpen),r=_(E=>E.setPromptLibraryOpen),u=_(E=>E.promptBuilderOpen),f=_(E=>E.togglePromptBuilder),p=_(E=>E.workspaceProfile),{t:m}=ye(),[y,h]=D.useState(typeof window<"u"?window.matchMedia("(max-width: 800px)").matches:!1);D.useEffect(()=>{if(typeof window>"u")return;const E=window.matchMedia("(max-width: 800px)"),M=()=>h(E.matches);return E.addEventListener("change",M),()=>E.removeEventListener("change",M)},[]);const x=Hx(p)&&!y,b=y?n:!0,S=u&&x?"builder":i?"library":"settings",T=E=>{E==="builder"?(u||f(),i&&r(!1)):E==="library"?(u&&f(),i||r(!0)):(u&&f(),i&&r(!1))};return d.jsxs(d.Fragment,{children:[y&&n?d.jsx("div",{className:"right-panel-backdrop",role:"button","aria-label":m("panel.closeSettings"),onClick:o}):null,d.jsxs("aside",{className:`right-panel${n?"":" collapsed"}${y&&b?" drawer-open":""}`,"aria-label":m("panel.detailSettings"),children:[!y&&d.jsx("button",{type:"button",className:"right-panel-toggle","aria-expanded":n,"aria-controls":"right-panel-body",onClick:o,title:m(n?"panel.toggleHide":"panel.toggleShow"),children:n?">":"<"}),d.jsxs("div",{id:"right-panel-body",className:"right-panel-body",hidden:!n,children:[d.jsxs("div",{className:"right-panel-tabs",role:"tablist","aria-label":m("panel.detailSettings"),children:[x?d.jsx("button",{type:"button",role:"tab","aria-selected":S==="builder",className:`right-panel-tabs__button${S==="builder"?" active":""}`,onClick:()=>T("builder"),children:m("promptBuilder.title")}):null,d.jsx("button",{type:"button",role:"tab","aria-selected":S==="settings",className:`right-panel-tabs__button${S==="settings"?" active":""}`,onClick:()=>T("settings"),children:m("panel.detailSettings")}),d.jsx("button",{type:"button",role:"tab","aria-selected":S==="library",className:`right-panel-tabs__button${S==="library"?" active":""}`,onClick:()=>T("library"),children:m("promptLibrary.title")})]}),S==="builder"&&x?d.jsx(D.Suspense,{fallback:d.jsx("div",{className:"prompt-library-panel__loading",children:m("common.loading")}),children:d.jsx(RT,{variant:"sidebar"})}):S==="library"?d.jsx(D.Suspense,{fallback:d.jsx("div",{className:"prompt-library-panel__loading",children:m("common.loading")}),children:d.jsx(MT,{variant:"embedded"})}):d.jsx($g,{})]})]})]})}function jT(n){const o=n.currentTarget;if(o.scrollWidth<=o.clientWidth||!(Math.abs(n.deltaY)>Math.abs(n.deltaX)))return;const r=o.scrollLeft<=0,u=o.scrollLeft+o.clientWidth>=o.scrollWidth-1,f=n.deltaY<0,p=n.deltaY>0;f&&r||p&&u||(n.preventDefault(),o.scrollLeft+=n.deltaY)}function IT(){const n=_(h=>h.history),o=_(h=>h.currentImage),i=_(h=>h.historyStripLayout),r=_(h=>h.selectHistory),u=_(h=>h.openGallery),f=D.useRef({}),{t:p}=ye(),m=o?Ot(o):null,y=D.useMemo(()=>Er(n.filter(Mi)),[n]);return D.useEffect(()=>{m&&f.current[m]?.scrollIntoView({block:"nearest",inline:"nearest"})},[m,y]),d.jsxs("div",{className:`history-strip${i==="horizontal"?" history-strip--horizontal":""}${i==="sidebar"?" history-strip--sidebar":""}`,onWheel:jT,"data-layout":i,children:[d.jsx("button",{type:"button",className:"history-thumb history-thumb--add",onClick:u,"aria-label":p("history.openGalleryAria"),title:p("history.openGalleryTitle"),children:d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),y.map(h=>{const x=Ot(h),b=m===x;return _a(h)?d.jsx("video",{ref:S=>{f.current[x]=S},src:h.url||h.image,muted:!0,playsInline:!0,preload:"metadata",className:`history-thumb history-thumb--video${b?" active":""}`,onClick:()=>r(h),draggable:!0,onDragStart:S=>{S.dataTransfer.setData("application/ima2-ref",JSON.stringify(Cu(h))),S.dataTransfer.effectAllowed="copy"}},x):d.jsx("img",{ref:S=>{f.current[x]=S},src:h.thumb||h.url||h.image,alt:"",className:`history-thumb${b?" active":""}`,loading:"lazy",decoding:"async",onClick:()=>r(h),draggable:!0,onDragStart:S=>{S.dataTransfer.setData("application/ima2-ref",JSON.stringify({image:h.url||h.image,filename:h.filename})),S.dataTransfer.effectAllowed="copy"}},x)})]})}const jh=3e4;function zT(){const{t:n}=ye(),o=_(h=>h.toastLog),i=_(h=>h.errorCardLog),r=_(h=>h.dismissToast),u=_(h=>h.dismissErrorCard),[f,p]=D.useState(()=>typeof document>"u"?!0:document.visibilityState==="visible"),m=D.useRef(new Map);D.useEffect(()=>{const h=()=>p(document.visibilityState==="visible");return document.addEventListener("visibilitychange",h),window.addEventListener("focus",h),window.addEventListener("blur",h),()=>{document.removeEventListener("visibilitychange",h),window.removeEventListener("focus",h),window.removeEventListener("blur",h)}},[]),D.useEffect(()=>{const h=m.current,x=new Set([...o.map(b=>`toast-${b.id}`),...i.map(b=>`error-card-${b.id}`)]);for(const[b,S]of h)(!x.has(b)||!f)&&(clearTimeout(S),h.delete(b));if(f){for(const b of o){const S=`toast-${b.id}`;if(h.has(S))continue;const T=setTimeout(()=>{h.delete(S),r(b.id)},jh);h.set(S,T)}for(const b of i){const S=`error-card-${b.id}`;if(h.has(S))continue;const T=setTimeout(()=>{h.delete(S),u(b.id)},jh);h.set(S,T)}}},[u,r,i,f,o]),D.useEffect(()=>()=>{for(const h of m.current.values())clearTimeout(h);m.current.clear()},[]);const y=[...o.map(h=>({kind:"toast",id:h.id,key:`toast-${h.id}`,message:h.message,error:h.error,createdAt:h.createdAt})),...i.map(h=>{const x=Ai[h.code]??Ai.UNKNOWN,b=n(`${x.cardKey??"errorCard.unknown"}.title`),S=n(`${x.cardKey??"errorCard.unknown"}.body`);return{kind:"error-card",id:h.id,key:`error-card-${h.id}`,message:h.fallbackMessage?`${b}: ${S} ${h.fallbackMessage}`:`${b}: ${S}`,error:!0,createdAt:h.createdAt}})].sort((h,x)=>h.createdAt-x.createdAt);return y.length===0?null:d.jsx("div",{className:"toast-stack","aria-live":"polite","aria-relevant":"additions removals",children:y.map(h=>{const x=["toast","visible",h.error?"error":"",h.kind==="error-card"?"toast--card":""].filter(Boolean).join(" ");return d.jsxs("div",{className:x,role:h.error?"alert":"status",children:[d.jsx("span",{className:"toast__message",children:h.message}),d.jsx("button",{type:"button",className:"toast__dismiss","aria-label":"Dismiss notification",onClick:()=>h.kind==="error-card"?u(h.id):r(h.id),children:"x"})]},h.key)})})}function DT(){return null}function kT(n){if(!n)return"earlier";const o=new Date(n);if(Number.isNaN(o.getTime()))return"earlier";const r=Math.floor((new Date().getTime()-o.getTime())/864e5);return r===0?"today":r===1?"yesterday":r<7?"thisWeek":o.toLocaleDateString("ko-KR",{year:"numeric",month:"short",day:"numeric"})}function LT({item:n,onOpen:o,onCopyPath:i,onDownloadManifest:r}){const{t:u}=ye(),p=n.cards?.find(m=>m.headline)?.headline||n.headline||u("gallery.cardNewsSet");return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"gallery__tile",onClick:()=>o(n),title:p,children:[n.image?d.jsx("img",{src:n.image,alt:p,loading:"lazy"}):null,d.jsxs("div",{className:"gallery__caption",children:[d.jsx("small",{children:u("gallery.cardNewsSet")}),d.jsx("span",{className:"gallery__caption-text",children:p})]}),d.jsx("div",{className:"gallery-card-news-strip",children:(n.cards||[]).slice(0,5).map((m,y)=>d.jsxs("span",{children:[m.url?d.jsx("img",{src:m.url,alt:m.headline??"",loading:"lazy"}):null,d.jsx("em",{children:m.cardOrder??y+1})]},`${m.url}-${y}`))})]}),d.jsxs("div",{className:"gallery-card-news-actions",children:[d.jsx("span",{children:u("gallery.cardNewsCount",{n:n.cards?.length??0})}),d.jsx("button",{type:"button",onClick:()=>o(n),children:u("gallery.openCardNewsSet")}),d.jsx("button",{type:"button",onClick:m=>i(n,m),children:u("gallery.copyCardNewsSetPath")}),d.jsx("button",{type:"button",onClick:m=>r(n,m),children:u("gallery.downloadCardNewsManifest")})]})]})}function qT({item:n,active:o,itemRef:i,onSelect:r,onDelete:u,onToggleFavorite:f,t:p}){const m=y=>{y.dataTransfer.setData("application/ima2-ref",JSON.stringify(_a(n)?Cu(n):{image:n.url||n.image,filename:n.filename})),y.dataTransfer.effectAllowed="copy"};return d.jsxs("div",{ref:i,className:`gallery__tile-wrap${o?" gallery__tile-wrap--active":""}${n.isFavorite?" gallery__tile-wrap--favorite":""}`,children:[d.jsxs("button",{type:"button",className:`gallery__tile${o?" gallery__tile--active":""}`,onClick:()=>r(n),title:n.prompt??"",draggable:!0,onDragStart:m,children:[_a(n)?d.jsx("video",{src:n.url||n.image,muted:!0,playsInline:!0,preload:"metadata",className:"gallery__tile-video"}):d.jsx("img",{src:n.thumb||n.image,alt:n.prompt??p("gallery.imageAltFallback"),loading:"lazy",decoding:"async"}),n.prompt&&d.jsx("div",{className:"gallery__caption",children:d.jsx("span",{className:"gallery__caption-text",children:n.prompt})})]}),n.filename&&f&&d.jsx("button",{type:"button",className:`gallery__favorite${n.isFavorite?" gallery__favorite--on":""}`,onClick:y=>{y.stopPropagation(),f(n)},title:n.isFavorite?p("gallery.unfavoriteTitle"):p("gallery.favoriteTitle"),"aria-label":n.isFavorite?p("gallery.unfavoriteAria"):p("gallery.favoriteAria"),children:n.isFavorite?"★":"☆"}),n.filename&&d.jsx("button",{type:"button",className:"gallery__delete",onClick:y=>u(n,y),title:p("gallery.deleteTitle"),"aria-label":p("gallery.deleteAria"),children:"×"})]})}function gl(n,o,i){let r=i.initialDeps??[],u,f=!0;function p(){var m,y,h;let x;i.key&&((m=i.debug)!=null&&m.call(i))&&(x=Date.now());const b=n();if(!(b.length!==r.length||b.some((E,M)=>r[M]!==E)))return u;r=b;let T;if(i.key&&((y=i.debug)!=null&&y.call(i))&&(T=Date.now()),u=o(...b),i.key&&((h=i.debug)!=null&&h.call(i))){const E=Math.round((Date.now()-x)*100)/100,M=Math.round((Date.now()-T)*100)/100,O=M/16,P=(Y,Z)=>{for(Y=String(Y);Y.length<Z;)Y=" "+Y;return Y};console.info(`%c⏱ ${P(M,5)} /${P(E,5)} ms`,`
34
- font-size: .6rem;
35
- font-weight: bold;
36
- color: hsl(${Math.max(0,Math.min(120-120*O,120))}deg 100% 31%);`,i?.key)}return i?.onChange&&!(f&&i.skipInitialOnChange)&&i.onChange(u),f=!1,u}return p.updateDeps=m=>{r=m},p}function Ih(n,o){if(n===void 0)throw new Error("Unexpected undefined");return n}const GT=(n,o)=>Math.abs(n-o)<1.01,HT=(n,o,i)=>{let r;return function(...u){n.clearTimeout(r),r=n.setTimeout(()=>o.apply(this,u),i)}},zh=n=>{const{offsetWidth:o,offsetHeight:i}=n;return{width:o,height:i}},UT=n=>n,BT=n=>{const o=Math.max(n.startIndex-n.overscan,0),i=Math.min(n.endIndex+n.overscan,n.count-1),r=[];for(let u=o;u<=i;u++)r.push(u);return r},PT=(n,o)=>{const i=n.scrollElement;if(!i)return;const r=n.targetWindow;if(!r)return;const u=p=>{const{width:m,height:y}=p;o({width:Math.round(m),height:Math.round(y)})};if(u(zh(i)),!r.ResizeObserver)return()=>{};const f=new r.ResizeObserver(p=>{const m=()=>{const y=p[0];if(y?.borderBoxSize){const h=y.borderBoxSize[0];if(h){u({width:h.inlineSize,height:h.blockSize});return}}u(zh(i))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(m):m()});return f.observe(i,{box:"border-box"}),()=>{f.unobserve(i)}},Dh={passive:!0},kh=typeof window>"u"?!0:"onscrollend"in window,FT=(n,o)=>{const i=n.scrollElement;if(!i)return;const r=n.targetWindow;if(!r)return;let u=0;const f=n.options.useScrollendEvent&&kh?()=>{}:HT(r,()=>{o(u,!1)},n.options.isScrollingResetDelay),p=x=>()=>{const{horizontal:b,isRtl:S}=n.options;u=b?i.scrollLeft*(S&&-1||1):i.scrollTop,f(),o(u,x)},m=p(!0),y=p(!1);i.addEventListener("scroll",m,Dh);const h=n.options.useScrollendEvent&&kh;return h&&i.addEventListener("scrollend",y,Dh),()=>{i.removeEventListener("scroll",m),h&&i.removeEventListener("scrollend",y)}},VT=(n,o,i)=>{if(o?.borderBoxSize){const r=o.borderBoxSize[0];if(r)return Math.round(r[i.options.horizontal?"inlineSize":"blockSize"])}return n[i.options.horizontal?"offsetWidth":"offsetHeight"]},YT=(n,{adjustments:o=0,behavior:i},r)=>{var u,f;const p=n+o;(f=(u=r.scrollElement)==null?void 0:u.scrollTo)==null||f.call(u,{[r.options.horizontal?"left":"top"]:p,behavior:i})};class KT{constructor(o){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,r,u;return((u=(r=(i=this.targetWindow)==null?void 0:i.performance)==null?void 0:r.now)==null?void 0:u.call(r))??Date.now()},this.observer=(()=>{let i=null;const r=()=>i||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:i=new this.targetWindow.ResizeObserver(u=>{u.forEach(f=>{const p=()=>{const m=f.target,y=this.indexFromElement(m);if(!m.isConnected){this.observer.unobserve(m);return}this.shouldMeasureDuringScroll(y)&&this.resizeItem(y,this.options.measureElement(m,f,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(p):p()})}));return{disconnect:()=>{var u;(u=r())==null||u.disconnect(),i=null},observe:u=>{var f;return(f=r())==null?void 0:f.observe(u,{box:"border-box"})},unobserve:u=>{var f;return(f=r())==null?void 0:f.unobserve(u)}}})(),this.range=null,this.setOptions=i=>{Object.entries(i).forEach(([r,u])=>{typeof u>"u"&&delete i[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:UT,rangeExtractor:BT,onChange:()=>{},measureElement:VT,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 r,u;(u=(r=this.options).onChange)==null||u.call(r,this,i)},this.maybeNotify=gl(()=>(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 r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,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,f)=>{this.scrollAdjustments=0,this.scrollDirection=f?this.getScrollOffset()<u?"forward":"backward":null,this.scrollOffset=u,this.isScrolling=f,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,r)=>{const u=new Map,f=new Map;for(let p=r-1;p>=0;p--){const m=i[p];if(u.has(m.lane))continue;const y=f.get(m.lane);if(y==null||m.end>y.end?f.set(m.lane,m):m.end<y.end&&u.set(m.lane,!0),u.size===this.options.lanes)break}return f.size===this.options.lanes?Array.from(f.values()).sort((p,m)=>p.end===m.end?p.index-m.index:p.end-m.end)[0]:void 0},this.getMeasurementOptions=gl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(i,r,u,f,p,m,y)=>(this.prevLanes!==void 0&&this.prevLanes!==m&&(this.lanesChangedFlag=!0),this.prevLanes=m,this.pendingMeasuredCacheIndexes=[],{count:i,paddingStart:r,scrollMargin:u,getItemKey:f,enabled:p,lanes:m,laneAssignmentMode:y}),{key:!1}),this.getMeasurements=gl(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:i,paddingStart:r,scrollMargin:u,getItemKey:f,enabled:p,lanes:m,laneAssignmentMode:y},h)=>{if(!p)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>i)for(const T of this.laneAssignments.keys())T>=i&&this.laneAssignments.delete(T);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(T=>{this.itemSizeCache.set(T.key,T.size)}));const x=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,x),S=new Array(m).fill(void 0);for(let T=0;T<x;T++){const E=b[T];E&&(S[E.lane]=T)}for(let T=x;T<i;T++){const E=f(T),M=this.laneAssignments.get(T);let O,P;const Y=y==="estimate"||h.has(E);if(M!==void 0&&this.options.lanes>1){O=M;const F=S[O],ee=F!==void 0?b[F]:void 0;P=ee?ee.end+this.options.gap:r+u}else{const F=this.options.lanes===1?b[T-1]:this.getFurthestMeasurement(b,T);P=F?F.end+this.options.gap:r+u,O=F?F.lane:T%this.options.lanes,this.options.lanes>1&&Y&&this.laneAssignments.set(T,O)}const Z=h.get(E),k=typeof Z=="number"?Z:this.options.estimateSize(T),ne=P+k;b[T]={index:T,start:P,size:k,end:ne,key:E,lane:O},S[O]=T}return this.measurementsCache=b,b},{key:!1,debug:()=>this.options.debug}),this.calculateRange=gl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(i,r,u,f)=>this.range=i.length>0&&r>0?XT({measurements:i,outerSize:r,scrollOffset:u,lanes:f}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=gl(()=>{let i=null,r=null;const u=this.calculateRange();return u&&(i=u.startIndex,r=u.endIndex),this.maybeNotify.updateDeps([this.isScrolling,i,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,i,r]},(i,r,u,f,p)=>f===null||p===null?[]:i({startIndex:f,endIndex:p,overscan:r,count:u}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=i=>{const r=this.options.indexAttribute,u=i.getAttribute(r);return u?parseInt(u,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=i=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const u=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(u!==void 0&&this.range){const f=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),p=Math.max(0,u-f),m=Math.min(this.options.count-1,u+f);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 r=this.indexFromElement(i),u=this.options.getItemKey(r),f=this.elementsCache.get(u);f!==i&&(f&&this.observer.unobserve(f),this.observer.observe(i),this.elementsCache.set(u,i)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(i,void 0,this))},this.resizeItem=(i,r)=>{var u;const f=this.measurementsCache[i];if(!f)return;const p=this.itemSizeCache.get(f.key)??f.size,m=r-p;m!==0&&(((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(f,m,this):f.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=m,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(f.index),this.itemSizeCache=new Map(this.itemSizeCache.set(f.key,r)),this.notify(!1))},this.getVirtualItems=gl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(i,r)=>{const u=[];for(let f=0,p=i.length;f<p;f++){const m=i[f],y=r[m];u.push(y)}return u},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=i=>{const r=this.getMeasurements();if(r.length!==0)return Ih(r[Wg(0,r.length-1,u=>Ih(r[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,r,u=0)=>{if(!this.scrollElement)return 0;const f=this.getSize(),p=this.getScrollOffset();r==="auto"&&(r=i>=p+f?"end":"start"),r==="center"?i+=(u-f)/2:r==="end"&&(i-=f);const m=this.getMaxScrollOffset();return Math.max(Math.min(m,i),0)},this.getOffsetForIndex=(i,r="auto")=>{i=Math.max(0,Math.min(i,this.options.count-1));const u=this.getSize(),f=this.getScrollOffset(),p=this.measurementsCache[i];if(!p)return;if(r==="auto")if(p.end>=f+u-this.options.scrollPaddingEnd)r="end";else if(p.start<=f+this.options.scrollPaddingStart)r="start";else return[f,r];if(r==="end"&&i===this.options.count-1)return[this.getMaxScrollOffset(),r];const m=r==="end"?p.end+this.options.scrollPaddingEnd:p.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(m,r,p.size),r]},this.scrollToOffset=(i,{align:r="start",behavior:u="auto"}={})=>{const f=this.getOffsetForAlignment(i,r),p=this.now();this.scrollState={index:null,align:r,behavior:u,startedAt:p,lastTargetOffset:f,stableFrames:0},this._scrollToOffset(f,{adjustments:void 0,behavior:u}),this.scheduleScrollReconcile()},this.scrollToIndex=(i,{align:r="auto",behavior:u="auto"}={})=>{i=Math.max(0,Math.min(i,this.options.count-1));const f=this.getOffsetForIndex(i,r);if(!f)return;const[p,m]=f,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:r="auto"}={})=>{const u=this.getScrollOffset()+i,f=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:f,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var i;const r=this.getMeasurements();let u;if(r.length===0)u=this.options.paddingStart;else if(this.options.lanes===1)u=((i=r[r.length-1])==null?void 0:i.end)??0;else{const f=Array(this.options.lanes).fill(null);let p=r.length-1;for(;p>=0&&f.some(m=>m===null);){const m=r[p];f[m.lane]===null&&(f[m.lane]=m.end),p--}u=Math.max(...f.filter(m=>m!==null))}return Math.max(u-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(i,{adjustments:r,behavior:u})=>{this.options.scrollToFn(i,{behavior:u,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(o)}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 r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,u=r?r[0]:this.scrollState.lastTargetOffset,f=1,p=u!==this.scrollState.lastTargetOffset;if(!p&&GT(u,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=f){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 Wg=(n,o,i,r)=>{for(;n<=o;){const u=(n+o)/2|0,f=i(u);if(f<r)n=u+1;else if(f>r)o=u-1;else return u}return n>0?n-1:0};function XT({measurements:n,outerSize:o,scrollOffset:i,lanes:r}){const u=n.length-1,f=y=>n[y].start;if(n.length<=r)return{startIndex:0,endIndex:u};let p=Wg(0,u,f,i),m=p;if(r===1)for(;m<u&&n[m].end<i+o;)m++;else if(r>1){const y=Array(r).fill(0);for(;m<u&&y.some(x=>x<i+o);){const x=n[m];y[x.lane]=x.end,m++}const h=Array(r).fill(i+o);for(;p>=0&&h.some(x=>x>=i);){const x=n[p];h[x.lane]=x.start,p--}p=Math.max(0,p-p%r),m=Math.min(u,m+(r-1-m%r))}return{startIndex:p,endIndex:m}}const Lh=typeof document<"u"?D.useLayoutEffect:D.useEffect;function QT({useFlushSync:n=!0,...o}){const i=D.useReducer(()=>({}),{})[1],r={...o,onChange:(f,p)=>{var m;n&&p?Vg.flushSync(i):i(),(m=o.onChange)==null||m.call(o,f,p)}},[u]=D.useState(()=>new KT(r));return u.setOptions(r),Lh(()=>u._didMount(),[]),Lh(()=>u._willUpdate()),u}function ZT(n){return QT({observeElementRect:PT,observeElementOffset:FT,scrollToFn:YT,...n})}const jr=170,Ir=10,ey=36,JT=44;function $T(n){const o=Math.max(jr,n-ey);return Math.max(1,Math.floor((o+Ir)/(jr+Ir)))}function WT(n,o){const i=Math.max(jr,n-ey);return Math.max(jr,Math.floor((i-Ir*Math.max(0,o-1))/o))+Ir}function eE(n,o){const i=[];for(const[r,u]of n){i.push({type:"header",id:`h-${r}`,label:r,count:u.length});for(let f=0;f<u.length;f+=o)i.push({type:"items",id:`r-${r}-${f}`,items:u.slice(f,f+o)})}return i}function tE({dateGroups:n,selectedKey:o,scrollElement:i,localizeBucket:r,renderTile:u}){const f=D.useRef(null),[p,m]=D.useState(0),y=D.useMemo(()=>$T(p||960),[p]),h=D.useMemo(()=>WT(p||960,y),[p,y]),x=D.useMemo(()=>eE(n,y),[n,y]);D.useEffect(()=>{const S=f.current;if(!S)return;const T=()=>m(S.clientWidth);T();const E=new ResizeObserver(T);return E.observe(S),()=>E.disconnect()},[]);const b=ZT({count:x.length,getScrollElement:()=>i,estimateSize:S=>x[S]?.type==="header"?JT:h,overscan:6});return D.useEffect(()=>{if(!o)return;const S=x.findIndex(T=>T.type==="items"&&T.items.some(E=>Ot(E)===o));S>=0&&b.scrollToIndex(S,{align:"center"})},[x,o,b]),d.jsx("div",{ref:f,className:"gallery__virtual",style:{height:b.getTotalSize()},children:b.getVirtualItems().map(S=>{const T=x[S.index];return T?d.jsx("div",{className:"gallery__virtual-row",style:{transform:`translateY(${S.start}px)`},children:T.type==="header"?d.jsxs("header",{className:"gallery__group-header gallery__group-header--virtual",children:[d.jsx("span",{className:"gallery__group-label",children:r(T.label)}),d.jsx("span",{className:"gallery__group-count",children:T.count})]}):d.jsx("div",{className:"gallery__grid gallery__grid--virtual",children:T.items.map((E,M)=>u(E,T.id,M))})},T.id):null})})}function qh({showSessions:n,favoritesOnly:o,query:i,historyNextCursor:r,favoriteHistoryNextCursor:u,historyLoadingOlder:f,favoriteHistoryLoadingOlder:p,onLoadOlder:m,onLoadOlderFavorites:y,t:h}){return n?d.jsx("div",{className:"gallery__load-more gallery__load-more--hint",children:h("gallery.sessionPaginationHint")}):i.trim()?null:o?u?d.jsx("div",{className:"gallery__load-more",children:d.jsx("button",{type:"button",onClick:y,disabled:p,children:h(p?"gallery.loadingOlderFavorites":"gallery.loadOlderFavorites")})}):null:r?d.jsx("div",{className:"gallery__load-more",children:d.jsx("button",{type:"button",onClick:m,disabled:f,children:h(f?"gallery.loadingOlder":"gallery.loadOlder")})}):null}function aE({groups:n,loose:o,favoritesOnly:i,galleryScope:r,setGalleryScope:u,renderTile:f,t:p}){return n.length===0&&o.length===0?d.jsx("div",{className:"gallery__empty",children:i?p("gallery.emptyFavorites"):r==="current-session"?d.jsxs(d.Fragment,{children:[d.jsx("p",{children:p("gallery.empty.currentSession")}),d.jsx("button",{type:"button",onClick:()=>u("all"),children:p("gallery.scope.all")})]}):p("gallery.emptySessions")}):d.jsxs(d.Fragment,{children:[n.map(m=>d.jsxs("section",{className:"gallery__group",children:[d.jsxs("header",{className:"gallery__group-header",children:[d.jsx("span",{className:"gallery__group-label",title:m.sessionId,children:m.title?m.displayLabel:p("gallery.sessionLabel",{name:m.displayLabel})}),d.jsx("span",{className:"gallery__group-count",children:m.items.length})]}),d.jsx("div",{className:"gallery__grid",children:m.items.map((y,h)=>f(y,m.sessionId,h))})]},m.sessionId)),o.length>0&&d.jsxs("section",{className:"gallery__group",children:[d.jsxs("header",{className:"gallery__group-header",children:[d.jsx("span",{className:"gallery__group-label",children:p("gallery.standalone")}),d.jsx("span",{className:"gallery__group-count",children:o.length})]}),d.jsx("div",{className:"gallery__grid",children:o.map((m,y)=>f(m,"loose",y))})]})]})}function nE({status:n,dismissed:o,onOpenFolder:i,onDismiss:r,t:u}){const f=n!=null&&n.state!=="ok"&&!o,p=n?.state==="recoverable"?"gallery.storageNoticeRecoverable":n?.state==="not_found"?"gallery.storageNoticeNotFound":"gallery.storageNoticeUnknown";return d.jsxs("div",{className:`gallery__storage-bar${f?" gallery__storage-bar--notice":""}`,children:[f?d.jsxs("div",{className:"gallery__storage-copy",children:[d.jsx("div",{className:"gallery__storage-title",children:u("gallery.storageNoticeTitle")}),d.jsx("div",{className:"gallery__storage-text",children:u(p)})]}):d.jsx("div",{className:"gallery__storage-copy gallery__storage-copy--quiet",children:n?.generatedDirLabel??"~/.ima2/generated"}),d.jsxs("div",{className:"gallery__storage-actions",children:[d.jsx("button",{type:"button",className:"gallery__storage-button",onClick:i,title:u("gallery.openGeneratedDirTitle"),children:u("gallery.openGeneratedDir")}),f&&d.jsx("button",{type:"button",className:"gallery__storage-button gallery__storage-button--ghost",onClick:r,children:u("common.close")})]})]})}const Gh="ima2.storageNoticeDismissed.0.09.23";function lE(){const{t:n}=ye(),o=_(V=>V.galleryOpen),i=_(V=>V.closeGallery),r=_(V=>V.history),u=_(V=>V.selectHistory),f=_(V=>V.currentImage),p=_(V=>V.trashHistoryItem),m=_(V=>V.showToast),y=_(V=>V.toggleGalleryFavorite),h=_(V=>V.galleryScope),x=_(V=>V.setGalleryScope),b=_(V=>V.historyNextCursor),S=_(V=>V.historyLoadingOlder),T=_(V=>V.favoriteHistoryNextCursor),E=_(V=>V.favoriteHistoryLoadingOlder),M=_(V=>V.loadOlderHistory),O=_(V=>V.loadFavoriteHistory),P=_(V=>V.loadOlderFavoriteHistory),Y=_(y1),[Z,k]=D.useState(""),[ne,F]=D.useState("date"),[ee,Ee]=D.useState(!1),[Ie,K]=D.useState([]),[$,le]=D.useState([]),[Ae,we]=D.useState(null),[Q,w]=D.useState(()=>{try{return localStorage.getItem(Gh)==="1"}catch{return!1}}),X=D.useRef(null),ie=D.useRef({}),[Ne,Oe]=D.useState(null),A=D.useRef(0),U=D.useRef({open:!1,selectedKey:null}),J=D.useMemo(()=>Er(r.filter(Mi)),[r]),te=D.useCallback(V=>{X.current=V,Oe(V)},[]);D.useEffect(()=>{if(!o)return;const V=Ce=>{Ce.key==="Escape"&&i()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[o,i]),D.useEffect(()=>{o||k("")},[o]),D.useEffect(()=>{if(!o)return;let V=!1;return(async()=>{try{const Ce=await Kb();V||we(Ce)}catch{V||we({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}})}})(),()=>{V=!0}},[o]),D.useEffect(()=>{if(!o||ne!=="session")return;let V=!1;return(async()=>{try{const Ce=await Vb({limit:500,sessionId:h==="current-session"?Y:void 0});if(V)return;const dt=ve=>{const Be=ve.kind,An=Be==="classic"||Be==="edit"||Be==="generate"||Be==="card-news-card"||Be==="card-news-set"?Be:null;return{image:ve.url,url:ve.url,filename:ve.filename,prompt:ve.prompt??void 0,size:ve.size??void 0,quality:ve.quality??void 0,model:ve.model??void 0,provider:ve.provider,createdAt:ve.createdAt,sessionId:ve.sessionId??null,nodeId:ve.nodeId??null,clientNodeId:ve.clientNodeId??null,kind:An,setId:ve.setId??null,cardId:ve.cardId??null,cardOrder:ve.cardOrder??null,headline:ve.headline??null,body:ve.body??null,cards:ve.cards,isFavorite:ve.isFavorite??!1}};K(Ce.sessions.map(ve=>({sessionId:ve.sessionId,title:ve.title??null,label:ve.label??null,displayLabel:ve.title||ve.label||ve.sessionId.slice(0,8),items:Er(ve.items.filter(Mi).map(dt))})).filter(ve=>ve.items.length>0)),le(Er(Ce.loose.filter(Mi).map(dt)))}catch{}})(),()=>{V=!0}},[o,ne,h,Y]),D.useEffect(()=>{!o||ne==="session"||!ee||O()},[o,ne,ee,O]);const ce=D.useMemo(()=>{const V=Z.trim().toLowerCase().normalize("NFC");return J.filter(Ce=>ee&&!Ce.isFavorite?!1:V?(Ce.prompt??"").toLowerCase().normalize("NFC").includes(V)||(Ce.filename??"").toLowerCase().normalize("NFC").includes(V):!0)},[J,Z,ee]),de=D.useMemo(()=>ee?Ie.map(V=>({...V,items:V.items.filter(Ce=>Ce.isFavorite)})).filter(V=>V.items.length>0):Ie,[Ie,ee]),L=D.useMemo(()=>ee?$.filter(V=>V.isFavorite):$,[$,ee]),ue=D.useMemo(()=>{const V=new Map;for(const Ce of ce){const dt=kT(Ce.createdAt);V.has(dt)||V.set(dt,[]),V.get(dt).push(Ce)}return Array.from(V.entries())},[ce]),me=ne==="session"?de.reduce((V,Ce)=>V+Ce.items.length,0)+L.length:ce.length;D.useLayoutEffect(()=>{const V=f?Ot(f):null;if(!o){U.current={open:!1,selectedKey:V};return}const Ce=U.current,dt=!Ce.open||Ce.selectedKey!==V;U.current={open:!0,selectedKey:V};const ve=V?ie.current[V]:null;if(dt&&ve){ve.scrollIntoView({block:"center"});return}X.current&&(X.current.scrollTop=A.current)},[o,f?.filename,f?.image,ne,me,ue.length,de.length,L.length]);async function nt(V,Ce){Ce.stopPropagation();const dt=Ot(V);await p(V),delete ie.current[dt],window.requestAnimationFrame(()=>X.current?.focus())}async function la(){try{await Xb(),m(n("toast.openGeneratedDirOpened"))}catch{m(n("toast.openGeneratedDirFailed"),!0)}}async function tn(V){if(V.setId)try{await at.getState().loadSet(V.setId),_.getState().setUIMode("card-news"),i()}catch{m(n("gallery.openCardNewsSetFailed"),!0)}}async function ki(V,Ce){if(Ce.stopPropagation(),!V.setId)return;const dt=`generated/cardnews/${V.setId}`;try{await navigator.clipboard?.writeText(dt),m(n("gallery.cardNewsPathCopied"))}catch{m(n("toast.copyFailed"),!0)}}function ia(V,Ce){Ce.stopPropagation(),V.setId&&window.open(O1(V.setId),"_blank","noopener,noreferrer")}function El(){w(!0);try{localStorage.setItem(Gh,"1")}catch{}}if(!o)return null;const Nl=V=>V==="earlier"||V==="today"||V==="yesterday"||V==="thisWeek"?n(`gallery.${V}`):V,Li=(V,Ce,dt)=>{const ve=f?.image===V.image,Be=Ot(V),An=Qt=>{ie.current[Be]=Qt};return V.kind==="card-news-set"?d.jsx("div",{ref:An,className:"gallery__tile-wrap gallery-card-news-set",children:d.jsx(LT,{item:V,onOpen:Qt=>{tn(Qt)},onCopyPath:ki,onDownloadManifest:ia})},`${Ce}-${Be}`):d.jsx(qT,{item:V,active:ve,itemRef:An,onSelect:Qt=>{u(Qt),i()},onDelete:nt,onToggleFavorite:Qt=>{y(Qt.filename)},t:n},`${Ce}-${Be}`)},Ca=ne==="session",_l=f?Ot(f):null;return d.jsx("div",{className:"gallery-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{className:"gallery",role:"dialog","aria-modal":"true","aria-label":n("gallery.ariaLabel"),onClick:V=>V.stopPropagation(),children:[d.jsxs("div",{className:"gallery__header",children:[d.jsxs("div",{className:"gallery__title-row",children:[d.jsx("div",{className:"gallery__title",children:n("gallery.title")}),d.jsxs("div",{className:"gallery__meta",children:[n("gallery.total",{n:me}),Z||ee?n("gallery.totalFiltered",{n:J.length}):""]}),d.jsxs("div",{className:"gallery__favorite-filter",role:"tablist","aria-label":n("gallery.favoriteFilterAria"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":!ee,className:ee?"":"active",onClick:()=>Ee(!1),children:n("gallery.filterAll")}),d.jsx("button",{type:"button",role:"tab","aria-selected":ee,className:ee?"active":"",onClick:()=>Ee(!0),children:n("gallery.filterFavorites")})]}),d.jsxs("div",{className:"gallery__group-toggle",role:"tablist","aria-label":n("gallery.sortByAria"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":ne==="date",className:ne==="date"?"active":"",onClick:()=>F("date"),children:n("gallery.sortByDate")}),d.jsx("button",{type:"button",role:"tab","aria-selected":ne==="session",className:ne==="session"?"active":"",onClick:()=>F("session"),children:n("gallery.sortBySession")})]}),d.jsxs("div",{className:"gallery__scope",role:"tablist","aria-label":n("gallery.scopeAria"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":h==="current-session",className:h==="current-session"?"active":"",onClick:()=>x("current-session"),disabled:!Y,children:n("gallery.scope.current")}),d.jsx("button",{type:"button",role:"tab","aria-selected":h==="all",className:h==="all"?"active":"",onClick:()=>x("all"),children:n("gallery.scope.all")})]})]}),d.jsx("input",{type:"text",className:"gallery__search",placeholder:n(Ca?"gallery.searchDisabledPlaceholder":"gallery.searchPlaceholder"),value:Z,onChange:V=>k(V.target.value),autoFocus:!0,disabled:Ca}),d.jsx("button",{type:"button",className:"gallery__close",onClick:i,"aria-label":n("gallery.closeAria"),title:n("gallery.closeTitle"),children:"×"})]}),d.jsx(nE,{status:Ae,dismissed:Q,onOpenFolder:la,onDismiss:El,t:n}),d.jsx("div",{className:"gallery__scroll",ref:te,tabIndex:-1,onScroll:()=>{A.current=X.current?.scrollTop??0},children:Ca?d.jsxs(d.Fragment,{children:[d.jsx(aE,{groups:de,loose:L,favoritesOnly:ee,galleryScope:h,setGalleryScope:x,renderTile:Li,t:n}),d.jsx(qh,{showSessions:Ca,favoritesOnly:ee,query:Z,historyNextCursor:b,favoriteHistoryNextCursor:T,historyLoadingOlder:S,favoriteHistoryLoadingOlder:E,onLoadOlder:()=>{M()},onLoadOlderFavorites:()=>{P()},t:n})]}):ce.length===0?d.jsx("div",{className:"gallery__empty",children:J.length===0?n("gallery.emptyAll"):n(ee?"gallery.emptyFavorites":"gallery.noResults")}):d.jsxs(d.Fragment,{children:[d.jsx(tE,{dateGroups:ue,selectedKey:_l,scrollElement:Ne,localizeBucket:Nl,renderTile:Li}),d.jsx(qh,{showSessions:Ca,favoritesOnly:ee,query:Z,historyNextCursor:b,favoriteHistoryNextCursor:T,historyLoadingOlder:S,favoriteHistoryLoadingOlder:E,onLoadOlder:()=>{M()},onLoadOlderFavorites:()=>{P()},t:n})]})})]})})}function iE(n){return n.includes("ratio")?"sizeConfirm.reasonRatio":n.includes("maxPixels")||n.includes("pixels")?"sizeConfirm.reasonPixels":n.includes("minPixels")?"sizeConfirm.reasonMinPixels":n.includes("min")?"sizeConfirm.reasonMin":n.includes("maxEdge")||n.includes("max")?"sizeConfirm.reasonMax":"sizeConfirm.reasonSnap"}function oE(){const n=_(m=>m.customSizeConfirm),o=_(m=>m.confirmCustomSizeAdjustment),i=_(m=>m.cancelCustomSizeAdjustment),r=D.useRef(null),{t:u}=ye();if(D.useEffect(()=>{if(!n)return;r.current?.focus();const m=y=>{y.key==="Escape"&&i()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[i,n]),!n)return null;const f=`${n.requestedW}x${n.requestedH}`,p=`${n.adjustedW}x${n.adjustedH}`;return d.jsx("div",{className:"modal-backdrop custom-size-confirm-backdrop",role:"presentation",children:d.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:[d.jsx("div",{id:"custom-size-confirm-title",className:"modal__title",children:u("sizeConfirm.title")}),d.jsxs("div",{id:"custom-size-confirm-body",className:"modal__body",children:[d.jsx("p",{children:u("sizeConfirm.body")}),d.jsxs("dl",{className:"size-confirm__pairs",children:[d.jsxs("div",{className:"size-confirm__pair",children:[d.jsx("dt",{children:u("sizeConfirm.requested")}),d.jsx("dd",{children:f})]}),d.jsxs("div",{className:"size-confirm__pair",children:[d.jsx("dt",{children:u("sizeConfirm.adjusted")}),d.jsx("dd",{children:p})]})]}),d.jsx("p",{className:"size-confirm__reason",children:u(iE(n.reasons))})]}),d.jsxs("div",{className:"modal__actions",children:[d.jsx("button",{ref:r,type:"button",className:"modal__btn modal__btn--secondary",onClick:i,children:u("sizeConfirm.cancel")}),d.jsx("button",{type:"button",className:"modal__btn",onClick:()=>{o()},children:u("sizeConfirm.approve")})]})]})})}function yr(n){return n==null||n===""?"-":String(n)}function rE(){const{t:n}=ye(),o=_(m=>m.metadataRestore),i=_(m=>m.applyMetadataRestore),r=_(m=>m.addMetadataRestoreAsReference),u=_(m=>m.cancelMetadataRestore);if(!o)return null;const f=o.metadata,p=f.userPrompt||f.prompt||f.revisedPrompt||"";return d.jsx("div",{className:"modal-backdrop metadata-restore-backdrop",role:"presentation",children:d.jsxs("div",{className:"modal metadata-restore",role:"dialog","aria-modal":"true","aria-labelledby":"metadata-restore-title",children:[d.jsx("div",{id:"metadata-restore-title",className:"modal__title",children:n("metadata.restoreTitle")}),d.jsxs("div",{className:"modal__body metadata-restore__body",children:[d.jsx("p",{children:n("metadata.restoreBody")}),d.jsxs("div",{className:"metadata-restore__preview",children:[d.jsx("img",{src:o.image,alt:n("metadata.imageAlt")}),d.jsxs("div",{className:"metadata-restore__details",children:[d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.prompt")}),d.jsx("strong",{title:p,children:yr(p)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.size")}),d.jsx("strong",{children:yr(f.size)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.quality")}),d.jsx("strong",{children:yr(f.quality)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.model")}),d.jsx("strong",{children:yr(f.model)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.source")}),d.jsx("strong",{children:o.source==="png-comment"?n("metadata.sourcePngComment"):n("metadata.sourceXmp")})]})]})]})]}),d.jsxs("div",{className:"modal__actions",children:[d.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:u,children:n("common.cancel")}),d.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:r,children:n("metadata.useAsReferenceOnly")}),d.jsx("button",{type:"button",className:"modal__btn",onClick:i,children:n("metadata.applySettings")})]})]})})}function sE(){const{t:n}=ye(),o=_(E=>E.readinessPopupOpen),i=_(E=>E.closeReadinessPopup),r=_(E=>E.openSettings),u=_(E=>E.provider),f=_(E=>E.imageModel),p=_(E=>E.reasoningEffort),m=_(E=>E.webSearchEnabled),y=Jg(),h=u==="grok",x=Tl.find(E=>E.value===f);if(!o)return null;const b=y[u],S=b.ok,T=()=>{i(),r("account")};return d.jsx("div",{className:"modal-backdrop provider-readiness-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{className:"modal provider-readiness",role:"dialog","aria-modal":"true","aria-labelledby":"provider-readiness-title",onClick:E=>E.stopPropagation(),children:[d.jsx("div",{id:"provider-readiness-title",className:"modal__title",children:n("readiness.title")}),d.jsxs("div",{className:"modal__body provider-readiness__body",children:[d.jsxs("div",{className:`provider-readiness__status${S?" is-ok":" is-blocked"}`,children:[d.jsx("span",{"aria-hidden":"true"}),d.jsx("strong",{children:n(S?"readiness.ready":"readiness.blocked")}),d.jsx("small",{children:S?n("readiness.readyBody"):b.reason})]}),b.hint?d.jsx("p",{className:"modal__hint",children:b.hint}):null,d.jsxs("dl",{className:"provider-readiness__facts",children:[d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.provider")}),d.jsx("dd",{children:u==="grok"?"Grok OAuth":u==="oauth"?"GPT OAuth":"GPT API"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.model")}),d.jsx("dd",{children:x?n(x.fullLabelKey):f})]}),h?d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.grokApi")}),d.jsx("dd",{children:n("readiness.grokApiBody")})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.reasoning")}),d.jsx("dd",{children:p})]}),d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.webSearch")}),d.jsx("dd",{children:n(m?"settings.webSearch.on":"settings.webSearch.off")})]})]})]})]}),d.jsxs("div",{className:"modal__actions",children:[d.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:i,children:n("common.close")}),d.jsx("button",{type:"button",className:"modal__btn",onClick:T,children:n("readiness.openAccount")})]})]})})}function cE(){const n=_(p=>p.trashPending),o=_(p=>p.restorePendingTrash),i=_(p=>p.clearPendingTrash),{t:r}=ye(),[u,f]=D.useState(Date.now());return D.useEffect(()=>{if(!n)return;f(Date.now());const p=window.setInterval(()=>{const m=Date.now();f(m),m>=n.expiresAt&&i()},500);return()=>window.clearInterval(p)},[i,n]),n?d.jsxs("div",{className:"trash-undo-toast",children:[d.jsx("span",{children:r("gallery.deleted",{filename:n.filename})}),d.jsx("button",{type:"button",onClick:()=>{o()},children:r("gallery.undo")}),d.jsx("span",{className:"trash-undo-toast__timer",children:r("gallery.secondsSuffix",{n:Math.max(0,Math.ceil((n.expiresAt-u)/1e3))})})]}):null}function uE(){return d.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:[d.jsx("line",{x1:"4",y1:"6",x2:"14",y2:"6"}),d.jsx("circle",{cx:"17",cy:"6",r:"2.2"}),d.jsx("line",{x1:"4",y1:"12",x2:"8",y2:"12"}),d.jsx("circle",{cx:"11",cy:"12",r:"2.2"}),d.jsx("line",{x1:"14",y1:"12",x2:"20",y2:"12"}),d.jsx("line",{x1:"4",y1:"18",x2:"14",y2:"18"}),d.jsx("circle",{cx:"17",cy:"18",r:"2.2"})]})}function dE(){const n=_(h=>h.composeSheetOpen),o=_(h=>h.composeSheetTab),i=_(h=>h.openComposeSheet),r=_(h=>h.settingsOpen),u=_(h=>h.uiMode),{t:f}=ye();if(!Di()||r||u==="card-news"||u==="agent")return null;const m=n&&o==="controls",y=f("sheet.controlsOpen");return d.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:d.jsx(uE,{})})}function fE(){const{t:n}=ye(),o=_(p=>p.openComposeSheet),i=_(p=>p.settingsOpen),u=_(p=>p.uiMode)==="node"&&Ii?"node":"classic";return!Di()||i||u!=="classic"?null:d.jsxs("header",{className:"mobile-app-bar",role:"banner",children:[d.jsxs("div",{className:"mobile-app-bar__brand",children:[d.jsx("div",{className:"logo-mark","aria-hidden":"true"}),d.jsxs("div",{className:"mobile-app-bar__brand-copy",children:[d.jsx("span",{className:"mobile-app-bar__title",children:"ima2-gen"}),d.jsx("span",{className:"mobile-app-bar__mode",children:n("appBar.modeImage")})]})]}),d.jsxs("div",{className:"mobile-app-bar__actions",children:[d.jsx(Yg,{variant:"sidebar"}),d.jsx("button",{type:"button",className:"mobile-app-bar__icon-button",onClick:()=>o("library"),"aria-label":n("promptLibrary.title"),title:n("promptLibrary.title"),children:d.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:d.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})}),d.jsx("button",{type:"button",className:"mobile-app-bar__icon-button",onClick:()=>o("controls"),"aria-label":n("appBar.controls"),title:n("appBar.controls"),children:d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"3"}),d.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"})]})}),d.jsxs("button",{type:"button",className:"mobile-app-bar__generate",onClick:()=>o("prompt"),"aria-label":n("appBar.generateAria"),children:[d.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:[d.jsx("path",{d:"M12 3l1.8 5.4L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.6L12 3z"}),d.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z"})]}),d.jsx("span",{children:n("appBar.generate")})]})]})]})}const mE=D.lazy(()=>wa(()=>import("./PromptLibraryPanel-BMjQegRa.js"),[]).then(n=>({default:n.PromptLibraryPanel}))),pE=["prompt","controls","library"];function hE(){const{t:n}=ye(),o=_(h=>h.composeSheetOpen),i=_(h=>h.composeSheetTab),r=_(h=>h.setComposeSheetTab),u=_(h=>h.closeComposeSheet),f=_(h=>h.settingsOpen),m=_(h=>h.uiMode)==="node"&&Ii?"node":"classic",y=Di();return D.useEffect(()=>{if(!o)return;const h=x=>{x.key==="Escape"&&u()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[o,u]),!y||f||m!=="classic"?null:d.jsxs(d.Fragment,{children:[o?d.jsx("div",{className:"compose-sheet-backdrop",role:"button","aria-label":n("sheet.close"),onClick:u}):null,d.jsxs("section",{id:"mobile-generate-sheet",className:`compose-sheet${o?" compose-sheet--open":""}`,role:"dialog","aria-modal":o?"true":"false","aria-label":n("sheet.generate"),"aria-hidden":!o,children:[d.jsx("button",{type:"button",className:"compose-sheet__handle",onClick:u,"aria-label":n("sheet.close")}),d.jsx("div",{className:"mobile-sheet-tabs",role:"tablist","aria-label":n("sheet.generate"),children:pE.map(h=>d.jsx("button",{type:"button",role:"tab","aria-selected":i===h,className:`mobile-sheet-tabs__button${i===h?" active":""}`,onClick:()=>r(h),children:n(`sheet.tabs.${h}`)},h))}),d.jsx("div",{className:"compose-sheet__body",children:i==="prompt"?d.jsxs("div",{className:"compose-sheet__panel compose-sheet__panel--prompt",role:"tabpanel",children:[d.jsx(Mu,{}),d.jsx(Ru,{}),d.jsx(Ar,{})]}):i==="controls"?d.jsx("div",{className:"compose-sheet__panel compose-sheet__panel--controls",role:"tabpanel",children:d.jsx($g,{})}):d.jsx("div",{className:"compose-sheet__panel compose-sheet__panel--library",role:"tabpanel",children:d.jsx(D.Suspense,{fallback:d.jsx("div",{className:"prompt-library-panel__loading",children:n("common.loading")}),children:d.jsx(mE,{variant:"embedded",forceOpen:!0,onRequestClose:()=>r("prompt")})})})})]})]})}const gE={ArrowLeft:"previous",ArrowRight:"next",Home:"first",End:"last",PageUp:"pagePrevious",PageDown:"pageNext"};function yE(){const n=_(r=>r.uiMode),o=_(r=>!!r.currentImage||!!r.multimodePreviewFlightId),i=_(r=>r.selectHistoryShortcutTarget);D.useEffect(()=>{if(n!=="classic")return;const r=u=>{const f=gE[u.key];f&&(u.defaultPrevented||Mr(u.target)||o&&(u.preventDefault(),i(f)))};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[o,i,n])}const vr=64,ty="Image Gen";let Ou=ty,xu=!1,en=null,ju="",Tu=!1;function ay(){return navigator}function ny(){if(typeof document>"u")return null;if(en)return en;const n=document.querySelector('link[rel~="icon"]');if(n)return en=n,ju=n.href||n.getAttribute("href")||"",n;const o=document.createElement("link");return o.rel="icon",document.head.appendChild(o),en=o,Tu=!0,o}function vE(n){const o=document.createElement("canvas");o.width=vr,o.height=vr;const i=o.getContext("2d");return i?(i.clearRect(0,0,vr,vr),i.fillStyle="#0a0a0a",bE(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,n>1?13:10,0,Math.PI*2),i.fillStyle="#ff335f",i.fill(),i.lineWidth=4,i.strokeStyle="#ffffff",i.stroke(),n>1&&(i.fillStyle="#ffffff",i.font="bold 15px sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText(String(Math.min(n,9)),48,17)),o.toDataURL("image/png")):ju}function bE(n,o,i,r,u,f){n.beginPath(),n.moveTo(o+f,i),n.arcTo(o+r,i,o+r,i+u,f),n.arcTo(o+r,i+u,o,i+u,f),n.arcTo(o,i+u,o,i,f),n.arcTo(o,i,o+r,i,f),n.closePath()}async function SE(n){const o=ay();if(typeof o.setAppBadge=="function")try{await o.setAppBadge(n)}catch{}}async function xE(){const n=ay();if(typeof n.clearAppBadge=="function")try{await n.clearAppBadge()}catch{}}function TE(n){document.title=`(${n}) ${Ou}`;const o=ny();o&&(o.href=vE(n)),SE(n)}function Hh(){document.title=Ou,en&&(Tu?(en.remove(),en=null,Tu=!1):en.href=ju),xE()}function Uh(){xu||typeof document>"u"||(xu=!0,Ou=document.title||ty,ny())}function EE(n){D.useEffect(()=>(Uh(),()=>{xu&&Hh()}),[]),D.useEffect(()=>{Uh(),n>0?TE(n):Hh()},[n])}function NE(){D.useEffect(()=>{if(typeof window>"u")return;const n=window.visualViewport;if(!n)return;const o=()=>{const i=Math.round(n.height),r=Math.round(n.offsetTop);document.documentElement.style.setProperty("--vv-h",`${i}px`),document.documentElement.style.setProperty("--vv-offset-top",`${r}px`)};return o(),n.addEventListener("resize",o),n.addEventListener("scroll",o),()=>{n.removeEventListener("resize",o),n.removeEventListener("scroll",o)}},[])}const _E=D.lazy(()=>wa(()=>import("./NodeCanvas-CI_wuPMf.js"),__vite__mapDeps([0,1])).then(n=>({default:n.NodeCanvas}))),wE=D.lazy(()=>wa(()=>import("./SettingsWorkspace-PiaVnsdA.js"),[]).then(n=>({default:n.SettingsWorkspace}))),CE=D.lazy(()=>wa(()=>import("./CardNewsWorkspace-wD12J7qk.js"),[]).then(n=>({default:n.CardNewsWorkspace}))),AE=D.lazy(()=>wa(()=>import("./AgentWorkspace-B_hq9CLg.js"),[]).then(n=>({default:n.AgentWorkspace}))),ME=D.lazy(()=>wa(()=>import("./PromptLibraryPanel-BMjQegRa.js"),[]).then(n=>({default:n.PromptLibraryPanel})));function RE(){return d.jsx("main",{className:"canvas canvas--lazy-loading","aria-busy":"true"})}function OE(){yE(),NE();const n=_(F=>F.hydrateHistory),o=_(F=>F.loadSessions),i=_(F=>F.startInFlightPolling),r=_(F=>F.reconcileInflight),u=_(F=>F.syncFromStorage),f=_(F=>F.theme),p=_(F=>F.resolvedTheme),m=_(F=>F.themeFamily),y=_(F=>F.settingsOpen),h=_(F=>F.unseenGeneratedCount),x=_(F=>F.historyStripLayout),b=_(F=>F.workspaceProfile),S=_(F=>F.syncThemeFromStorage),T=_(F=>F.syncThemeFamilyFromStorage),E=_(F=>F.refreshResolvedTheme),O=_(F=>F.uiMode)==="node"&&Ii?"node":"classic",P=O==="agent",Y=Di(),Z=ji(b),k=!Y&&O==="classic"&&Z.composerPlacement==="bottom"&&Z.multimodeHistoryGrouping==="sequence",ne=!k&&!P;return EE(h),D.useEffect(()=>{n(),r(),i()},[n,o,r,i]),D.useEffect(()=>{const F=ee=>{ee.key&&(ee.key==="ima2.inFlight"||ee.key==="ima2.selectedFilename"?u():ee.key==="ima2:theme"?S():ee.key==="ima2:themeFamily"&&T())};return window.addEventListener("storage",F),()=>window.removeEventListener("storage",F)},[u,S,T]),D.useEffect(()=>{const F=document.documentElement;F.dataset.theme=p,F.dataset.themeMode=p,F.dataset.themeFamily=m,F.style.colorScheme=p},[p,m]),D.useEffect(()=>{if(f!=="system")return;const F=window.matchMedia("(prefers-color-scheme: light)");return F.addEventListener("change",E),()=>F.removeEventListener("change",E)},[E,f]),D.useEffect(()=>{const F=()=>{g1(_.getState)};return window.addEventListener("beforeunload",F),()=>{window.removeEventListener("beforeunload",F)}},[]),d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`app${b==="prompt-studio"?" app--prompt-studio":""}${y?" app--settings-open":""}${ne&&x==="horizontal"?" app--history-horizontal":""}${ne&&x==="sidebar"?" app--history-sidebar":""}`,"data-theme-mode":p,"data-theme-family":m,"data-history-strip-layout":x,"data-mobile":Y?"1":void 0,"data-ui-mode":O,children:[d.jsx(B1,{}),d.jsx(fE,{}),ne?d.jsx(IT,{}):null,d.jsx(D.Suspense,{fallback:d.jsx(RE,{}),children:y?d.jsx(wE,{}):O==="classic"?k?d.jsx(cT,{}):d.jsx(Su,{}):O==="node"?d.jsx(_E,{}):O==="card-news"?d.jsx(CE,{}):O==="agent"?d.jsx(AE,{}):d.jsx(Su,{})}),O==="agent"||O==="card-news"?null:d.jsx(OT,{})]}),d.jsx(oE,{}),d.jsx(cE,{}),d.jsx(zT,{}),d.jsx(DT,{}),d.jsx(lE,{}),d.jsx(rE,{}),d.jsx(sE,{}),d.jsx(hE,{}),d.jsx(dE,{}),O==="card-news"?d.jsx(D.Suspense,{fallback:null,children:d.jsx(ME,{})}):null]})}function jE(){if(window.location.protocol!=="http:"||window.location.hostname!=="localhost")return!1;const n=new URL(window.location.href);return n.hostname="127.0.0.1",window.location.replace(n.toString()),!0}jE()||jb.createRoot(document.getElementById("root")).render(d.jsx(D.StrictMode,{children:d.jsx(OE,{})}));export{qE as A,kE as B,IE as C,mu as D,Q1 as E,zE as F,DE as G,Ph as H,Yg as I,QE as J,UE as K,GE as L,tT as M,BE as N,PE as O,HE as P,FE as Q,ar as R,b1 as S,qb as T,v1 as U,VE as V,S1 as W,YE as X,KE as Y,XE as Z,wa as _,D as a,_ as b,fx as c,Ax as d,Di as e,gx as f,Eb as g,bT as h,Sl as i,d as j,xT as k,ST as l,xr as m,wx as n,ZE as o,at as p,jT as q,Eu as r,Tl as s,Sr as t,ye as u,W1 as v,eT as w,Vp as x,LE as y,Mr as z};