ima2-gen 3.13.0 → 3.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/migration/runtime-test-inventory.md +2 -1
- package/package.json +5 -2
- package/ui/dist/.vite/manifest.json +39 -39
- package/ui/dist/assets/{AgentWorkspace-CBwn1WUC.js → AgentWorkspace-PbBytTeV.js} +1 -1
- package/ui/dist/assets/{AssetGenWorkspace-CleWSwPz.js → AssetGenWorkspace-B-TGlvVb.js} +2 -2
- package/ui/dist/assets/{AssetsWorkspace-DdjXb45L.js → AssetsWorkspace-LnGaW151.js} +1 -1
- package/ui/dist/assets/{CardNewsWorkspace-BaNpBvJw.js → CardNewsWorkspace-BS3jKOja.js} +1 -1
- package/ui/dist/assets/{GenerationRequestLogPanel-Cd2ArsWr.js → GenerationRequestLogPanel-DuDWD_ic.js} +1 -1
- package/ui/dist/assets/{HomeWorkspace-nKDhivwR.js → HomeWorkspace-DVP7UG6O.js} +1 -1
- package/ui/dist/assets/{KeyingPanel-DT8zsqpi.js → KeyingPanel-5bRUFQaq.js} +1 -1
- package/ui/dist/assets/{NodeCanvas-DcKs0w36.js → NodeCanvas-BBEpERTb.js} +1 -1
- package/ui/dist/assets/{PromptBuilderPanel-e6BSRAdj.js → PromptBuilderPanel-D97A4pwB.js} +1 -1
- package/ui/dist/assets/{PromptImportDialog-CLkjHz7L.js → PromptImportDialog-C89MN5JY.js} +2 -2
- package/ui/dist/assets/{PromptImportDiscoverySection-DoQw4zcd.js → PromptImportDiscoverySection-BgRfDOs2.js} +1 -1
- package/ui/dist/assets/{PromptImportFolderSection-CcLiliAZ.js → PromptImportFolderSection-zTMyriT1.js} +1 -1
- package/ui/dist/assets/{PromptLibraryPanel-BjxzL7t5.js → PromptLibraryPanel-BD96qZu_.js} +2 -2
- package/ui/dist/assets/{SettingsWorkspace-Ctu_usKk.js → SettingsWorkspace-BAOk3X_8.js} +1 -1
- package/ui/dist/assets/{SpriteRecipeWorkspace-DZjsabce.js → SpriteRecipeWorkspace-ClIM5QRo.js} +1 -1
- package/ui/dist/assets/{index-ICf98ZcU.js → index-BFciPGTn.js} +3 -3
- package/ui/dist/assets/{index-DueH_AmZ.js → index-BbykeXR9.js} +17 -17
- package/ui/dist/assets/{pptxgen.es-C--aL3JM.js → pptxgen.es-D4pedbwM.js} +1 -1
- package/ui/dist/assets/{promptBuilderStore-CkwnWMbR.js → promptBuilderStore-Do7M8g7J.js} +1 -1
- package/ui/dist/assets/useAgentDialogFocus-B6-QgEVI.js +1 -0
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/useAgentDialogFocus-DPB8JITN.js +0 -1
|
@@ -4,7 +4,7 @@ Generated by `npm run test:inventory` (script: `scripts/classify-tests.mjs`).
|
|
|
4
4
|
|
|
5
5
|
_Tests considered "runtime-importing" if they import from `../lib/`, `../routes/`, `../bin/`, `../server`, or `../config`._
|
|
6
6
|
|
|
7
|
-
Total:
|
|
7
|
+
Total: 416 (runtime: 191, contract: 225)
|
|
8
8
|
|
|
9
9
|
## Runtime-importing tests
|
|
10
10
|
- `tests/agent-image-reference-contract.test.ts`
|
|
@@ -334,6 +334,7 @@ Total: 415 (runtime: 191, contract: 224)
|
|
|
334
334
|
- `tests/mobile-compose-sheet-accessibility-contract.test.js`
|
|
335
335
|
- `tests/mobile-composer-tray-contract.test.js`
|
|
336
336
|
- `tests/mobile-generate-entry-contract.test.js`
|
|
337
|
+
- `tests/model-select-lane-gating.test.ts`
|
|
337
338
|
- `tests/multimode-backend-contract.test.js`
|
|
338
339
|
- `tests/multimode-concurrent-store-contract.test.js`
|
|
339
340
|
- `tests/multimode-ui-contract.test.js`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ima2-gen",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.1",
|
|
4
4
|
"packageManager": "npm@11.18.0",
|
|
5
5
|
"description": "Local-first visual generation runtime and studio for people and coding agents, with reproducible image and video workflows across multiple providers.",
|
|
6
6
|
"type": "module",
|
|
@@ -103,6 +103,9 @@
|
|
|
103
103
|
"ulid": "^3.0.2",
|
|
104
104
|
"zod": "4.4.3"
|
|
105
105
|
},
|
|
106
|
+
"overrides": {
|
|
107
|
+
"fast-uri": "3.1.7"
|
|
108
|
+
},
|
|
106
109
|
"bundleDependencies": [
|
|
107
110
|
"progrok",
|
|
108
111
|
"openai-oauth",
|
|
@@ -121,5 +124,5 @@
|
|
|
121
124
|
"typescript": "^5.9.3",
|
|
122
125
|
"yaml": "2.9.0"
|
|
123
126
|
},
|
|
124
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "d2afe6b2aa7d006e2cd9765aa632714f96435db2"
|
|
125
128
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_AssetGenWorkspace-
|
|
3
|
-
"file": "assets/AssetGenWorkspace-
|
|
4
|
-
"src": "_AssetGenWorkspace-B7tTK0Sx.css"
|
|
5
|
-
},
|
|
6
|
-
"_AssetGenWorkspace-CleWSwPz.js": {
|
|
7
|
-
"file": "assets/AssetGenWorkspace-CleWSwPz.js",
|
|
2
|
+
"_AssetGenWorkspace-B-TGlvVb.js": {
|
|
3
|
+
"file": "assets/AssetGenWorkspace-B-TGlvVb.js",
|
|
8
4
|
"name": "AssetGenWorkspace",
|
|
9
5
|
"isDynamicEntry": true,
|
|
10
6
|
"imports": [
|
|
11
7
|
"index.html",
|
|
12
|
-
"_KeyingPanel-
|
|
8
|
+
"_KeyingPanel-5bRUFQaq.js"
|
|
13
9
|
],
|
|
14
10
|
"dynamicImports": [
|
|
15
11
|
"src/components/assetgen/SpriteRecipeWorkspace.tsx"
|
|
@@ -18,12 +14,16 @@
|
|
|
18
14
|
"assets/AssetGenWorkspace-B7tTK0Sx.css"
|
|
19
15
|
]
|
|
20
16
|
},
|
|
21
|
-
"
|
|
22
|
-
"file": "assets/
|
|
17
|
+
"_AssetGenWorkspace-B7tTK0Sx.css": {
|
|
18
|
+
"file": "assets/AssetGenWorkspace-B7tTK0Sx.css",
|
|
19
|
+
"src": "_AssetGenWorkspace-B7tTK0Sx.css"
|
|
20
|
+
},
|
|
21
|
+
"_KeyingPanel-5bRUFQaq.js": {
|
|
22
|
+
"file": "assets/KeyingPanel-5bRUFQaq.js",
|
|
23
23
|
"name": "KeyingPanel",
|
|
24
24
|
"imports": [
|
|
25
25
|
"index.html",
|
|
26
|
-
"_useAgentDialogFocus-
|
|
26
|
+
"_useAgentDialogFocus-B6-QgEVI.js"
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"__vite-browser-external": {
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
"src": "__vite-browser-external",
|
|
33
33
|
"isDynamicEntry": true
|
|
34
34
|
},
|
|
35
|
-
"_promptBuilderStore-
|
|
36
|
-
"file": "assets/promptBuilderStore-
|
|
35
|
+
"_promptBuilderStore-Do7M8g7J.js": {
|
|
36
|
+
"file": "assets/promptBuilderStore-Do7M8g7J.js",
|
|
37
37
|
"name": "promptBuilderStore",
|
|
38
38
|
"imports": [
|
|
39
39
|
"index.html"
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
|
-
"_useAgentDialogFocus-
|
|
43
|
-
"file": "assets/useAgentDialogFocus-
|
|
42
|
+
"_useAgentDialogFocus-B6-QgEVI.js": {
|
|
43
|
+
"file": "assets/useAgentDialogFocus-B6-QgEVI.js",
|
|
44
44
|
"name": "useAgentDialogFocus",
|
|
45
45
|
"imports": [
|
|
46
46
|
"index.html"
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
"index.html": {
|
|
50
|
-
"file": "assets/index-
|
|
50
|
+
"file": "assets/index-BbykeXR9.js",
|
|
51
51
|
"name": "index",
|
|
52
52
|
"src": "index.html",
|
|
53
53
|
"isEntry": true,
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"src/components/card-news/CardNewsWorkspace.tsx",
|
|
63
63
|
"src/components/agent/AgentWorkspace.tsx",
|
|
64
64
|
"src/components/assets/AssetsWorkspace.tsx",
|
|
65
|
-
"_AssetGenWorkspace-
|
|
65
|
+
"_AssetGenWorkspace-B-TGlvVb.js",
|
|
66
66
|
"src/components/home/HomeWorkspace.tsx",
|
|
67
67
|
"src/components/PromptLibraryPanel.tsx"
|
|
68
68
|
],
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
73
|
"node_modules/pptxgenjs/dist/pptxgen.es.js": {
|
|
74
|
-
"file": "assets/pptxgen.es-
|
|
74
|
+
"file": "assets/pptxgen.es-D4pedbwM.js",
|
|
75
75
|
"name": "pptxgen.es",
|
|
76
76
|
"src": "node_modules/pptxgenjs/dist/pptxgen.es.js",
|
|
77
77
|
"isDynamicEntry": true,
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
]
|
|
86
86
|
},
|
|
87
87
|
"src/components/GenerationRequestLogPanel.tsx": {
|
|
88
|
-
"file": "assets/GenerationRequestLogPanel-
|
|
88
|
+
"file": "assets/GenerationRequestLogPanel-DuDWD_ic.js",
|
|
89
89
|
"name": "GenerationRequestLogPanel",
|
|
90
90
|
"src": "src/components/GenerationRequestLogPanel.tsx",
|
|
91
91
|
"isDynamicEntry": true,
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
96
|
"src/components/NodeCanvas.tsx": {
|
|
97
|
-
"file": "assets/NodeCanvas-
|
|
97
|
+
"file": "assets/NodeCanvas-BBEpERTb.js",
|
|
98
98
|
"name": "NodeCanvas",
|
|
99
99
|
"src": "src/components/NodeCanvas.tsx",
|
|
100
100
|
"isDynamicEntry": true,
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
]
|
|
107
107
|
},
|
|
108
108
|
"src/components/PromptImportDialog.tsx": {
|
|
109
|
-
"file": "assets/PromptImportDialog-
|
|
109
|
+
"file": "assets/PromptImportDialog-C89MN5JY.js",
|
|
110
110
|
"name": "PromptImportDialog",
|
|
111
111
|
"src": "src/components/PromptImportDialog.tsx",
|
|
112
112
|
"isDynamicEntry": true,
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
]
|
|
120
120
|
},
|
|
121
121
|
"src/components/PromptImportDiscoverySection.tsx": {
|
|
122
|
-
"file": "assets/PromptImportDiscoverySection-
|
|
122
|
+
"file": "assets/PromptImportDiscoverySection-BgRfDOs2.js",
|
|
123
123
|
"name": "PromptImportDiscoverySection",
|
|
124
124
|
"src": "src/components/PromptImportDiscoverySection.tsx",
|
|
125
125
|
"isDynamicEntry": true,
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
]
|
|
129
129
|
},
|
|
130
130
|
"src/components/PromptImportFolderSection.tsx": {
|
|
131
|
-
"file": "assets/PromptImportFolderSection-
|
|
131
|
+
"file": "assets/PromptImportFolderSection-zTMyriT1.js",
|
|
132
132
|
"name": "PromptImportFolderSection",
|
|
133
133
|
"src": "src/components/PromptImportFolderSection.tsx",
|
|
134
134
|
"isDynamicEntry": true,
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
]
|
|
138
138
|
},
|
|
139
139
|
"src/components/PromptLibraryPanel.tsx": {
|
|
140
|
-
"file": "assets/PromptLibraryPanel-
|
|
140
|
+
"file": "assets/PromptLibraryPanel-BD96qZu_.js",
|
|
141
141
|
"name": "PromptLibraryPanel",
|
|
142
142
|
"src": "src/components/PromptLibraryPanel.tsx",
|
|
143
143
|
"isDynamicEntry": true,
|
|
@@ -149,53 +149,53 @@
|
|
|
149
149
|
]
|
|
150
150
|
},
|
|
151
151
|
"src/components/SettingsWorkspace.tsx": {
|
|
152
|
-
"file": "assets/SettingsWorkspace-
|
|
152
|
+
"file": "assets/SettingsWorkspace-BAOk3X_8.js",
|
|
153
153
|
"name": "SettingsWorkspace",
|
|
154
154
|
"src": "src/components/SettingsWorkspace.tsx",
|
|
155
155
|
"isDynamicEntry": true,
|
|
156
156
|
"imports": [
|
|
157
157
|
"index.html",
|
|
158
|
-
"_promptBuilderStore-
|
|
158
|
+
"_promptBuilderStore-Do7M8g7J.js"
|
|
159
159
|
]
|
|
160
160
|
},
|
|
161
161
|
"src/components/agent/AgentWorkspace.tsx": {
|
|
162
|
-
"file": "assets/AgentWorkspace-
|
|
162
|
+
"file": "assets/AgentWorkspace-PbBytTeV.js",
|
|
163
163
|
"name": "AgentWorkspace",
|
|
164
164
|
"src": "src/components/agent/AgentWorkspace.tsx",
|
|
165
165
|
"isDynamicEntry": true,
|
|
166
166
|
"imports": [
|
|
167
167
|
"index.html",
|
|
168
|
-
"_useAgentDialogFocus-
|
|
168
|
+
"_useAgentDialogFocus-B6-QgEVI.js"
|
|
169
169
|
]
|
|
170
170
|
},
|
|
171
171
|
"src/components/assetgen/SpriteRecipeWorkspace.tsx": {
|
|
172
|
-
"file": "assets/SpriteRecipeWorkspace-
|
|
172
|
+
"file": "assets/SpriteRecipeWorkspace-ClIM5QRo.js",
|
|
173
173
|
"name": "SpriteRecipeWorkspace",
|
|
174
174
|
"src": "src/components/assetgen/SpriteRecipeWorkspace.tsx",
|
|
175
175
|
"isDynamicEntry": true,
|
|
176
176
|
"imports": [
|
|
177
177
|
"index.html",
|
|
178
|
-
"_AssetGenWorkspace-
|
|
179
|
-
"_KeyingPanel-
|
|
180
|
-
"_useAgentDialogFocus-
|
|
178
|
+
"_AssetGenWorkspace-B-TGlvVb.js",
|
|
179
|
+
"_KeyingPanel-5bRUFQaq.js",
|
|
180
|
+
"_useAgentDialogFocus-B6-QgEVI.js"
|
|
181
181
|
]
|
|
182
182
|
},
|
|
183
183
|
"src/components/assets/AssetsWorkspace.tsx": {
|
|
184
|
-
"file": "assets/AssetsWorkspace-
|
|
184
|
+
"file": "assets/AssetsWorkspace-LnGaW151.js",
|
|
185
185
|
"name": "AssetsWorkspace",
|
|
186
186
|
"src": "src/components/assets/AssetsWorkspace.tsx",
|
|
187
187
|
"isDynamicEntry": true,
|
|
188
188
|
"imports": [
|
|
189
189
|
"index.html",
|
|
190
|
-
"_KeyingPanel-
|
|
191
|
-
"_useAgentDialogFocus-
|
|
190
|
+
"_KeyingPanel-5bRUFQaq.js",
|
|
191
|
+
"_useAgentDialogFocus-B6-QgEVI.js"
|
|
192
192
|
],
|
|
193
193
|
"css": [
|
|
194
194
|
"assets/AssetsWorkspace-BdptASFf.css"
|
|
195
195
|
]
|
|
196
196
|
},
|
|
197
197
|
"src/components/canvas-mode/index.ts": {
|
|
198
|
-
"file": "assets/index-
|
|
198
|
+
"file": "assets/index-BFciPGTn.js",
|
|
199
199
|
"name": "index",
|
|
200
200
|
"src": "src/components/canvas-mode/index.ts",
|
|
201
201
|
"isDynamicEntry": true,
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
]
|
|
208
208
|
},
|
|
209
209
|
"src/components/card-news/CardNewsWorkspace.tsx": {
|
|
210
|
-
"file": "assets/CardNewsWorkspace-
|
|
210
|
+
"file": "assets/CardNewsWorkspace-BS3jKOja.js",
|
|
211
211
|
"name": "CardNewsWorkspace",
|
|
212
212
|
"src": "src/components/card-news/CardNewsWorkspace.tsx",
|
|
213
213
|
"isDynamicEntry": true,
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
]
|
|
217
217
|
},
|
|
218
218
|
"src/components/home/HomeWorkspace.tsx": {
|
|
219
|
-
"file": "assets/HomeWorkspace-
|
|
219
|
+
"file": "assets/HomeWorkspace-DVP7UG6O.js",
|
|
220
220
|
"name": "HomeWorkspace",
|
|
221
221
|
"src": "src/components/home/HomeWorkspace.tsx",
|
|
222
222
|
"isDynamicEntry": true,
|
|
@@ -225,13 +225,13 @@
|
|
|
225
225
|
]
|
|
226
226
|
},
|
|
227
227
|
"src/components/prompt-builder/PromptBuilderPanel.tsx": {
|
|
228
|
-
"file": "assets/PromptBuilderPanel-
|
|
228
|
+
"file": "assets/PromptBuilderPanel-D97A4pwB.js",
|
|
229
229
|
"name": "PromptBuilderPanel",
|
|
230
230
|
"src": "src/components/prompt-builder/PromptBuilderPanel.tsx",
|
|
231
231
|
"isDynamicEntry": true,
|
|
232
232
|
"imports": [
|
|
233
233
|
"index.html",
|
|
234
|
-
"_promptBuilderStore-
|
|
234
|
+
"_promptBuilderStore-Do7M8g7J.js"
|
|
235
235
|
]
|
|
236
236
|
}
|
|
237
237
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{$ as Fe,a as m,j as t,u as x,i as we,B as ye,a0 as Nt,b as E}from"./index-
|
|
1
|
+
import{$ as Fe,a as m,j as t,u as x,i as we,B as ye,a0 as Nt,b as E}from"./index-BbykeXR9.js";import{u as de}from"./useAgentDialogFocus-B6-QgEVI.js";async function B(e,n){const a=await fetch(e,n);if(!a.ok){const s=await a.json().catch(()=>({})),r=s.error,l=typeof r=="string"?r:r?.message??`Request failed: ${a.status}`,o=new Error(l);throw o.status=a.status,o.code=typeof r=="object"?r?.code:s.code,o}return await a.json()}function Ct(e){return e.filename?`/generated/${e.filename}`:typeof e.url=="string"&&e.url?e.url:typeof e.thumb=="string"&&e.thumb?e.thumb:null}function Ge(e){const n=Ct(e);if(!n)return null;const a=e.filename??e.canvasEditableFilename??"current-image.png";return{id:`current-${a}`,filename:a,url:n,thumbUrl:e.thumb??n,prompt:e.prompt??e.userPrompt??null,revisedPrompt:e.revisedPrompt??null,createdAt:e.createdAt??Date.now()}}async function Re(e){const n=e?`?selectedSessionId=${encodeURIComponent(e)}`:"";return B(`/api/agent/sessions${n}`)}async function $e(e){const n=e.currentImage?Ge(e.currentImage):null;return B("/api/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,currentImage:n,webSearchEnabled:e.webSearchEnabled??!0})})}async function ce(e,n){return B(`/api/agent/sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function kt(e){return B(`/api/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function It(e,n,a){return B(`/api/agent/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:n,options:a})})}async function At(e){return B(`/api/agent/queue/${encodeURIComponent(e)}/cancel`,{method:"POST"})}async function Lt(e){return B(`/api/agent/queue/${encodeURIComponent(e)}/retry`,{method:"POST"})}const _e=Fe,Tt=Fe,Mt={provider:"oauth",model:"gpt-5.6-luna",quality:"medium",size:"1024x1024",format:"png",moderation:"low",reasoningEffort:"none",webSearchEnabled:!0,generationStrategy:"auto",variants:1,maxAutoVariants:_e,parallelism:2};function Pe(e){return{...Mt,...e??{}}}function De(e){const{width:n,height:a}=e;return n>=1280?"desktop-three-pane":a<560&&n<1280?n>=768?"tablet-stacked":"mobile-chat-image-sheet":n>=960&&a>=560?"desktop-rail":n>=768&&a>=700?"tablet-stacked":"mobile-chat-image-sheet"}function Et(){return typeof window>"u"?1440:window.innerWidth}function Be(){return typeof window>"u"?900:window.innerHeight}function qt(){if(typeof window>"u"||typeof document>"u")return 1440;const e=document.querySelector('.app[data-ui-mode="agent"] .sidebar');if(!e)return window.innerWidth;const n=window.getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden")return window.innerWidth;const a=e.getBoundingClientRect().width;return Math.max(0,window.innerWidth-a)}function Rt(){const[e,n]=m.useState(()=>De({width:Et(),height:Be()}));return m.useEffect(()=>{const a=()=>n(De({width:qt(),height:Be()}));return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),e}function C({size:e=16,children:n}){return t.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n})}function Ue(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M12 5v14"}),t.jsx("path",{d:"M5 12h14"})]})}function $t(e){return t.jsxs(C,{...e,children:[t.jsx("circle",{cx:"11",cy:"11",r:"7"}),t.jsx("path",{d:"M21 21l-4.3-4.3"})]})}function O(e){return t.jsxs(C,{...e,children:[t.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),t.jsx("circle",{cx:"8",cy:"10",r:"1.5"}),t.jsx("path",{d:"M21 16l-5-5L5 19"})]})}function ge(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M18 6L6 18"}),t.jsx("path",{d:"M6 6l12 12"})]})}function Pt(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M22 2L11 13"}),t.jsx("path",{d:"M22 2l-7 20-4-9-9-4 20-7z"})]})}function Dt(e){return t.jsx(C,{...e,children:t.jsx("path",{d:"M21.4 11.1l-9.2 9.1a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"})})}function Bt(e){return t.jsxs(C,{...e,children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M2 12h20"}),t.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 0 20"}),t.jsx("path",{d:"M12 2a15.3 15.3 0 0 0 0 20"})]})}function He(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M4 6h16"}),t.jsx("path",{d:"M4 12h16"}),t.jsx("path",{d:"M4 18h16"})]})}function Ot(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M19 12H5"}),t.jsx("path",{d:"M12 19l-7-7 7-7"})]})}function zt(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M8 6h13"}),t.jsx("path",{d:"M8 12h13"}),t.jsx("path",{d:"M8 18h13"}),t.jsx("circle",{cx:"3",cy:"6",r:"1"}),t.jsx("circle",{cx:"3",cy:"12",r:"1"}),t.jsx("circle",{cx:"3",cy:"18",r:"1"})]})}function Wt(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M3 6h18"}),t.jsx("path",{d:"M8 6V4h8v2"}),t.jsx("path",{d:"M19 6l-1 14H6L5 6"})]})}function Kt(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M12 20h9"}),t.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function Ve(e){return t.jsx(C,{...e,children:t.jsx("path",{d:"M6 9l6 6 6-6"})})}function Ne(e){return t.jsx(C,{...e,children:t.jsx("path",{d:"M9 6l6 6-6 6"})})}function Qt(e){return t.jsxs(C,{...e,children:[t.jsx("path",{d:"M4 8h16"}),t.jsx("circle",{cx:"9",cy:"8",r:"2.5"}),t.jsx("path",{d:"M4 16h16"}),t.jsx("circle",{cx:"15",cy:"16",r:"2.5"})]})}const Oe=[{name:"question",display:"/question",aliases:["question","ask","q"],descriptionKey:"agent.slashDesc_question"},{name:"variants",display:"/variants <N>",aliases:["variants","variant","v","n"],descriptionKey:"agent.slashDesc_variants",hasValue:!0},{name:"generate",display:"/generate <N>",aliases:["generate","gen","g"],descriptionKey:"agent.slashDesc_generate",hasValue:!0},{name:"parallelism",display:"/parallelism <N>",aliases:["parallelism","parallel","p"],descriptionKey:"agent.slashDesc_parallelism",hasValue:!0},{name:"help",display:"/help",aliases:["help","h"],descriptionKey:"agent.slashDesc_help"}];function Je(e){const n=e.toLowerCase();return n?Oe.filter(a=>a.aliases.some(s=>s.startsWith(n))):Oe}function Ft({listboxId:e,query:n,highlightIndex:a,onSelect:s,onHighlightChange:r}){const{t:l}=x(),o=Je(n);return o.length===0?null:t.jsx("ul",{id:e,className:"slash-command-menu",role:"listbox","aria-label":l("agent.slashCommands"),children:o.map((d,c)=>t.jsxs("li",{id:`${e}-opt-${c}`,role:"option","aria-selected":c===a,className:`slash-command-menu__item${c===a?" is-highlighted":""}`,onMouseDown:i=>i.preventDefault(),onClick:()=>s(d),onMouseEnter:()=>r(c),children:[t.jsx("span",{className:"slash-command-menu__name",children:d.display}),t.jsx("span",{className:"slash-command-menu__desc",children:l(d.descriptionKey)})]},d.name))})}function Gt(e){return Array.from(e).filter(n=>n.type.startsWith("image/"))}function Ut(e){return Array.from(e.clipboardData?.items??[]).filter(n=>n.kind==="file"&&n.type.startsWith("image/")).map(n=>n.getAsFile()).filter(n=>!!n)}function Ht({webSearchEnabled:e,insertedPrompt:n,onWebSearchChange:a,onAttachFiles:s,onSend:r}){const{t:l}=x(),[o,d]=m.useState(""),[c,i]=m.useState(0),[g,u]=m.useState(!1),p=m.useRef(null),f=m.useRef(null),b=m.useId(),v=o.trim().length>0,w=o.trimStart().match(/^\/([a-z]*)$/i),q=w!==null,G=q&&!g,U=w?.[1]??"",L=Je(U),z=G&&L.length>0,A=L.length>0?Math.min(c,L.length-1):0,he=z?`${b}-opt-${A}`:void 0;m.useEffect(()=>{i(0),u(!1)},[U]),m.useEffect(()=>{q&&u(!1)},[q]),m.useEffect(()=>{n?.text&&d(j=>j.trim()?`${j.trim()}
|
|
2
2
|
|
|
3
3
|
${n.text}`:n.text)},[n]);const H=()=>{const j=o.trim();j&&(r(j),d(""))},V=j=>{d(`/${j.name} `),p.current?.focus()},J=j=>{const M=Ut(j);M.length!==0&&(j.preventDefault(),s(M))};return t.jsxs("div",{className:"agent-composer",children:[z&&t.jsx(Ft,{listboxId:b,query:U,highlightIndex:A,onSelect:V,onHighlightChange:i}),t.jsx("textarea",{ref:p,value:o,"aria-autocomplete":"list","aria-haspopup":"listbox","aria-label":l("agent.composerPlaceholder"),...z?{"aria-controls":b}:{},"aria-activedescendant":he,autoCapitalize:"off",autoCorrect:"off",placeholder:l("agent.composerPlaceholder"),onChange:j=>d(j.target.value),onPaste:J,onKeyDown:j=>{if(j.key==="Enter"&&(j.metaKey||j.ctrlKey)){j.preventDefault(),H();return}if(z)switch(j.key){case"Tab":{j.preventDefault(),V(L[A]);return}case"ArrowDown":{j.preventDefault(),i((A+1)%L.length);return}case"ArrowUp":{j.preventDefault(),i((A-1+L.length)%L.length);return}case"Enter":{j.preventDefault(),V(L[A]);return}case"Escape":{j.preventDefault(),u(!0);return}}}}),t.jsx("input",{ref:f,type:"file",accept:"image/png,image/jpeg,image/webp",multiple:!0,hidden:!0,onChange:j=>{const M=Gt(j.target.files??[]);M.length>0&&s(M),j.target.value=""}}),t.jsxs("div",{className:"agent-composer__actions",children:[t.jsx("button",{type:"button",onClick:()=>f.current?.click(),"aria-label":l("agent.attachReference"),title:l("agent.attachReference"),children:t.jsx(Dt,{size:16})}),t.jsx("button",{type:"button",className:e?"is-active":"","aria-pressed":e,onClick:()=>a(!e),"aria-label":l("agent.webSearch"),title:l("agent.webSearch"),children:t.jsx(Bt,{size:16})}),t.jsxs("button",{type:"button",className:"agent-composer__send",onClick:H,disabled:!v,"aria-label":l("agent.send"),children:[t.jsx(Pt,{size:16}),t.jsx("span",{children:l("agent.send")})]})]})]})}function Q({src:e,alt:n,className:a,fallbackClassName:s,iconSize:r=18}){const[l,o]=m.useState(!1);return!e||l?t.jsx("span",{className:s??"agent-image-fallback","aria-label":n,role:"img",children:t.jsx(O,{size:r})}):we(e)?t.jsx("video",{className:a,src:e,preload:"metadata",playsInline:!0,muted:!0,onError:()=>o(!0),"aria-label":n}):t.jsx("img",{className:a,src:e,alt:n,onError:()=>o(!0)})}const F=m.forwardRef(function({image:n,selected:a=!1,compact:s=!1,onSelect:r},l){const{t:o}=x(),d=`${o("agent.mediaSelect")}: ${n.prompt??n.filename}`,c=`${s?"agent-result-thumb agent-result-thumb--compact":"agent-result-thumb"}${a?" is-selected":""}`;return t.jsx("button",{ref:l,type:"button",className:c,"aria-label":d,"aria-current":a?"true":void 0,onClick:()=>r(n.id),title:o("agent.mediaSelect"),children:t.jsx(Q,{src:n.thumbUrl??n.url,alt:n.prompt??o("agent.imageAlt"),iconSize:s?14:18})})});function Vt({turn:e,imagesById:n,currentImageId:a,onImageSelect:s}){const{t:r}=x(),l=e.role==="user"?r("agent.user"):e.status==="error"?r("agent.errorRole"):r("agent.assistant"),o=e.imageIds??[],d=e.status==="streaming"?" is-streaming":e.status==="error"?" is-error":"",c=`agent-message agent-message--${e.role}${d}`;return t.jsxs("article",{className:c,"aria-busy":e.status==="streaming"?"true":void 0,children:[t.jsx("div",{className:"agent-message__role",children:l}),t.jsx("p",{children:e.text}),o.length>0?t.jsx("div",{className:"agent-message__images",children:o.map(i=>{const g=n[i];return g?t.jsx(F,{image:g,selected:i===a,compact:!1,onSelect:s},i):null})}):null]})}const Jt=["ima2.get_image_context","ima2.web_search","ima2.generate_image","ima2.generate_video","ima2.get_generation_errors"];function Xt(e){return e.replace(/\s+/g," ").trim()||"tool"}function Yt(e){if(e.toolCalls?.length)return e.toolCalls;const n=Xt(e.text);return Jt.filter(a=>n.includes(a)).map((a,s)=>({id:`${e.id}-fallback-${s}`,name:a,status:e.status==="error"?"error":e.status==="streaming"?"running":"complete",outputSummary:n,imageIds:a==="ima2.generate_image"||a==="ima2.generate_video"?e.imageIds??[]:[],webFindingIds:a==="ima2.web_search"?e.webFindingIds??[]:[]}))}function Xe(e){return!e||e<0?null:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Zt={"ima2.get_image_context":"agent.toolLabel.getImageContext","ima2.web_search":"agent.toolLabel.webSearch","ima2.generate_image":"agent.toolLabel.generateImage","ima2.generate_video":"agent.toolLabel.generateVideo","ima2.get_generation_errors":"agent.toolLabel.getGenerationErrors"};function Ye(e){return Zt[e]??null}const en=72;function tn(e,n=en){const a=(e??"").replace(/\s+/g," ").trim();if(!a)return null;if(a.length<=n)return a;const s=a.slice(0,n),r=s.lastIndexOf(" ");return`${(r>n*.6?s.slice(0,r):s).trimEnd()}…`}function nn({call:e,imagesById:n,currentImageId:a,onImageSelect:s}){const{t:r}=x(),l=e.imageIds??[],o=Xe(e.durationMs),[d,c]=m.useState({input:!1,output:!1}),i=(g,u)=>t.jsxs("dd",{className:d[g]?"is-expanded":void 0,children:[t.jsx("span",{children:u}),t.jsx("button",{type:"button",onClick:()=>c(p=>({...p,[g]:!p[g]})),children:r(d[g]?"agent.toolsShowLess":"agent.toolsShowMore")})]});return t.jsxs("div",{className:"agent-tool-call-details",children:[t.jsxs("dl",{children:[t.jsxs("div",{children:[t.jsx("dt",{children:r("agent.toolInput")}),i("input",e.inputSummary??"-")]}),t.jsxs("div",{children:[t.jsx("dt",{children:r("agent.toolOutput")}),i("output",e.errorMessage??e.outputSummary??"-")]}),e.requestId?t.jsxs("div",{children:[t.jsx("dt",{children:r("agent.requestId")}),t.jsx("dd",{children:e.requestId})]}):null,o?t.jsxs("div",{children:[t.jsx("dt",{children:r("agent.duration")}),t.jsx("dd",{children:o})]}):null]}),l.length>0?t.jsx("div",{className:"agent-tool-call-details__artifacts","aria-label":r("agent.toolArtifacts"),children:l.map(g=>{const u=n[g];return u?t.jsx(F,{image:u,selected:g===a,compact:!0,onSelect:s},g):null})}):null]})}function an({call:e,imagesById:n,currentImageId:a,onImageSelect:s}){const{t:r}=x(),l=m.useId(),[o,d]=m.useState(!1),c=Xe(e.durationMs),i=Ye(e.name),g=i?r(i):e.name,u=tn(e.status==="error"?e.errorMessage??e.inputSummary:e.inputSummary),p=r(`agent.toolStatus.${e.status}`);return t.jsxs("li",{className:`agent-tool-call-row agent-tool-call-row--${e.status}`,children:[t.jsxs("button",{type:"button",className:"agent-tool-call-row__toggle","aria-expanded":o,"aria-controls":l,"aria-busy":e.status==="running"?"true":void 0,onClick:()=>d(f=>!f),children:[t.jsx("span",{className:"agent-tool-call-row__status","aria-hidden":"true"}),t.jsx("span",{className:"agent-tool-call-row__name",children:g}),t.jsx("span",{className:"agent-sr-only",children:p}),e.imageIds?.length?t.jsx("span",{className:"agent-tool-call-row__meta",children:r("agent.toolImageCount",{count:e.imageIds.length})}):null,c?t.jsx("span",{className:"agent-tool-call-row__meta agent-tool-call-row__meta--duration",children:c}):null,o?t.jsx(Ve,{size:13}):t.jsx(Ne,{size:13}),u?t.jsx("span",{className:"agent-tool-call-row__preview",title:u,children:u}):null]}),t.jsx("div",{id:l,hidden:!o,children:t.jsx(nn,{call:e,imagesById:n,currentImageId:a,onImageSelect:s})})]})}function sn(e){const n=[],a=new Set;let s=!1;const r=[];for(const l of e){const o=Yt(l);n.push(...o);for(const d of l.imageIds??[])a.add(d);for(const d of o)for(const c of d.imageIds??[])a.add(c);l.status==="streaming"&&(s=!0);for(const d of o)r.includes(d.name)||r.push(d.name)}return{toolCalls:n,imageIds:[...a],isStreaming:s,names:r}}function rn({turns:e,imagesById:n,currentImageId:a,onImageSelect:s}){const{t:r}=x(),l=m.useId(),[o,d]=m.useState(!1),{toolCalls:c,imageIds:i,isStreaming:g,names:u}=m.useMemo(()=>sn(e),[e]),p=r(o?"agent.toolCollapse":"agent.toolExpand"),f=m.useMemo(()=>u.map(v=>{const w=Ye(v);return w?r(w):v}).join(" · ")||r("agent.toolGroup"),[u,r]);return t.jsxs("article",{className:`agent-message agent-message--tool is-collapsible${g?" is-streaming":""}`,"aria-busy":g?"true":void 0,children:[t.jsx("div",{className:"agent-message__tool-summary",children:t.jsx("button",{type:"button",className:"agent-message__tool-toggle","aria-expanded":o,"aria-controls":l,"aria-label":`${p}: ${f}`,onClick:()=>d(b=>!b),children:t.jsxs("span",{className:"agent-message__tool-summary-line",children:[t.jsx("span",{className:"agent-message__tool-dot","aria-hidden":"true"}),t.jsx("span",{className:"agent-message__role",children:r("agent.toolGroup")}),t.jsx("span",{className:"agent-message__tool-label",children:f}),i.length>0?t.jsx("span",{className:"agent-message__tool-count",children:r("agent.toolImageCount",{count:i.length})}):null,c.length>0?t.jsx("span",{className:"agent-message__tool-count",children:r("agent.toolCallCount",{count:c.length})}):null,o?t.jsx(Ve,{size:14}):t.jsx(Ne,{size:14})]})})}),t.jsxs("div",{id:l,className:"agent-message__tool-details",hidden:!o,children:[c.length>0?t.jsx("ul",{className:"agent-tool-call-list",children:c.map(b=>t.jsx(an,{call:b,imagesById:n,currentImageId:a,onImageSelect:s},b.id))}):null,i.length>0?t.jsx("div",{className:"agent-message__tool-thumbs",children:i.map(b=>{const v=n[b];return v?t.jsx(F,{image:v,selected:b===a,compact:!0,onSelect:s},b):null})}):null]})]})}function ln(e){return e.role!=="tool"&&(e.text.trim().length>0||(e.imageIds?.length??0)>0)}function on({turns:e,imagesById:n,currentImageId:a,onImageSelect:s}){const{t:r}=x(),l=e.filter(u=>u.role==="tool"),o=e.filter(ln),d=e.some(u=>u.status==="streaming"),c=e.some(u=>u.status==="error"),i=d?" is-streaming":c?" is-error":"",g=r(c?"agent.errorRole":"agent.assistant");return t.jsxs("article",{className:`agent-message agent-message--assistant-run${i}`,"aria-busy":d?"true":void 0,children:[t.jsxs("div",{className:"agent-run__header",children:[t.jsx("div",{className:"agent-message__role",children:g}),l.length>0?t.jsx("div",{className:"agent-run__header-tool",children:t.jsx(rn,{turns:l,imagesById:n,currentImageId:a,onImageSelect:s})}):null]}),o.length>0?t.jsx("ol",{className:"agent-run__steps","aria-label":g,children:o.map(u=>{const p=u.imageIds??[],f=u.status==="streaming"?" is-streaming":u.status==="error"?" is-error":"";return t.jsxs("li",{className:`agent-run__step${f}`,children:[t.jsx("span",{className:"agent-run__step-marker","aria-hidden":"true"}),t.jsxs("div",{className:"agent-run__step-body",children:[u.text.trim().length>0?t.jsx("p",{children:u.text}):null,p.length>0?t.jsx("div",{className:"agent-message__images",children:p.map(b=>{const v=n[b];return v?t.jsx(F,{image:v,selected:b===a,compact:!1,onSelect:s},b):null})}):null]})]},u.id)})}):null]})}function cn(e){const n=[];let a=[];const s=()=>{a.length!==0&&(n.push({kind:"run",turns:a,key:`run-${a[0].id}`}),a=[])};for(const r of e)r.role==="user"?(s(),n.push({kind:"single",turn:r})):a.push(r);return s(),n}function un({turns:e,imagesById:n,currentImageId:a,onImageSelect:s}){const{t:r}=x(),l=m.useRef(null),o=m.useRef(!0),[d,c]=m.useState(!1),i=m.useMemo(()=>cn(e),[e]),g=m.useCallback(()=>{const p=l.current;p&&(o.current=p.scrollHeight-p.scrollTop-p.clientHeight<=120,o.current&&c(!1))},[]),u=m.useCallback(()=>{const p=l.current;p&&(p.scrollTo({top:p.scrollHeight,behavior:"smooth"}),o.current=!0,c(!1))},[]);return m.useEffect(()=>{const p=l.current;p&&(o.current?p.scrollTop=p.scrollHeight:c(!0))},[e.length]),t.jsxs("div",{className:"agent-message-list-wrap",children:[t.jsxs("div",{ref:l,className:"agent-message-list",role:"log","aria-label":r("agent.workspace"),onScroll:g,children:[e.length===0?t.jsx("div",{className:"agent-message-list__empty",children:r("agent.emptyChat")}):null,i.map(p=>p.kind==="run"?t.jsx(on,{turns:p.turns,imagesById:n,currentImageId:a,onImageSelect:s},p.key):t.jsx(Vt,{turn:p.turn,imagesById:n,currentImageId:a,onImageSelect:s},p.turn.id))]}),d?t.jsx("button",{type:"button",className:"agent-message-list__jump",onClick:u,children:r("agent.emptyJumpLatest")}):null]})}const ue=[{value:"gpt-5.6-luna",shortLabel:"5.6l",fullLabel:"GPT-5.6 Luna",provider:"oauth"},{value:"gpt-5.6-terra",shortLabel:"5.6t",fullLabel:"GPT-5.6 Terra",provider:"oauth"},{value:"gpt-5.6-sol",shortLabel:"5.6s",fullLabel:"GPT-5.6 Sol",provider:"oauth"},{value:"gpt-5.5",shortLabel:"5.5",fullLabel:"GPT-5.5",provider:"oauth"},{value:"gpt-5.4",shortLabel:"5.4",fullLabel:"GPT-5.4",provider:"oauth"},{value:"gpt-5.4-mini",shortLabel:"5.4m",fullLabel:"GPT-5.4 mini",provider:"oauth"},{value:"grok-4.6",shortLabel:"4.6",fullLabel:"Grok 4.6",provider:"grok"},{value:"grok-4.5",shortLabel:"4.5",fullLabel:"Grok 4.5",provider:"grok"},{value:"grok-4.3",shortLabel:"4.3",fullLabel:"Grok 4.3",provider:"grok"}];function dn(e){return ue.find(n=>n.value===e.model)??ue.find(n=>n.provider===e.provider)??ue[0]}function Ze({settings:e,onChange:n,onOpenModelTab:a}){const{t:s}=x(),[r,l]=m.useState(!1),o=m.useRef(null),d=dn(e),c=ye.find(i=>i.value===e.reasoningEffort)??ye[0];return m.useEffect(()=>{if(!r)return;const i=u=>{o.current?.contains(u.target)||l(!1)},g=u=>{u.key==="Escape"&&l(!1)};return window.addEventListener("pointerdown",i),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",i),window.removeEventListener("keydown",g)}},[r]),t.jsxs("div",{ref:o,className:"image-model-select image-model-select--sidebar agent-model-select",children:[t.jsxs("button",{type:"button",className:"image-model-select__trigger image-model-select__trigger--pill","aria-haspopup":"menu","aria-expanded":r,"aria-label":s("sidebar.quickSettingsAria",{model:d.shortLabel,effort:c.shortLabel}),onClick:()=>l(i=>!i),children:[t.jsxs("span",{className:"image-model-select__trigger-top",children:[t.jsx("span",{className:"image-model-select__trigger-model",children:d.shortLabel}),t.jsx("span",{className:"image-model-select__trigger-chevron","aria-hidden":"true",children:"▾"})]}),t.jsx("span",{className:"image-model-select__trigger-effort",children:c.shortLabel})]}),a?t.jsx("button",{type:"button",className:"agent-model-select__open-tab",onClick:a,"aria-label":s("agent.modelTabView"),title:s("agent.modelTabView"),children:t.jsx(Ne,{size:13})}):null,r?t.jsxs("div",{className:"image-model-select__menu agent-model-select__menu",role:"menu","aria-label":s("sidebar.quickSettingsMenu"),children:[t.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":s("agent.model"),children:[t.jsx("div",{className:"image-model-select__section-title",children:s("agent.model")}),ue.map(i=>t.jsxs("button",{type:"button",className:`image-model-select__item${i.value===d.value?" is-active":""}`,role:"menuitemradio","aria-checked":i.value===d.value,onClick:()=>{n({model:i.value,provider:i.provider}),l(!1)},children:[t.jsx("span",{children:i.shortLabel}),t.jsx("small",{children:i.fullLabel})]},i.value))]}),t.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":s("sidebar.reasoningLabel"),children:[t.jsx("div",{className:"image-model-select__section-title",children:s("sidebar.reasoningLabel")}),ye.map(i=>t.jsxs("button",{type:"button",className:`image-model-select__item${i.value===e.reasoningEffort?" is-active":""}`,role:"menuitemradio","aria-checked":i.value===e.reasoningEffort,onClick:()=>{n({reasoningEffort:i.value}),l(!1)},children:[t.jsx("span",{children:i.shortLabel}),t.jsx("small",{children:s(i.fullLabelKey)})]},i.value))]})]}):null]})}function gn(e,n){if(!e)return null;const a=Math.max(0,Math.floor((n-e)/1e3));return`${String(Math.floor(a/60)).padStart(2,"0")}:${String(a%60).padStart(2,"0")}`}function hn({progress:e,queueSummary:n,onQueueOpen:a,onRetry:s}){const{t:r}=x(),[l,o]=m.useState(Date.now());m.useEffect(()=>{if(!e?.startedAt)return;o(Date.now());const p=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(p)},[e?.startedAt]);const d=n?.activeCount??(e?.queuedCount??0)+(e?.runningCount??0),c=n?.failedCount??e?.failedCount??0;if(!e?.active&&!n)return null;const i=e?.status==="queued"?"agent.progressQueued":e?.progressStage==="downloading"?"agent.progressDownloading":e?.status==="running"||e?.progressStage==="requesting"||e?.progressStage==="polling"?"agent.progressGenerating":e?.status==="error"?"agent.progressFailed":"agent.progressPlanning",g=gn(e?.startedAt,l),u=e?.jobKind?r("agent.progressJob",{kind:r(`agent.mediaKind.${e.jobKind}`),count:e.variantCount??1}):null;return t.jsxs("div",{className:`agent-run-status agent-run-status--${e?.status??"idle"}`,role:"status","aria-live":"polite",children:[e?.active?t.jsx("span",{className:"agent-run-status__indicator","aria-hidden":"true"}):null,e?.active?t.jsx("span",{className:"agent-run-status__label",children:r(i)}):null,u?t.jsx("span",{className:"agent-run-status__meta",children:u}):null,g?t.jsx("time",{className:"agent-run-status__elapsed",dateTime:`PT${Math.floor((l-(e?.startedAt??l))/1e3)}S`,children:g}):null,e?.status==="error"&&e.lastError?t.jsx("span",{className:"agent-run-status__meta",children:e.lastError}):null,e?.status==="error"&&s?t.jsx("button",{type:"button",className:"agent-run-status__retry",onClick:s,children:r("agent.retryQueue")}):null,t.jsx("button",{type:"button",className:"agent-run-status__queue",onClick:a,disabled:!a,children:r("agent.queueSummary",{active:d,failed:c})})]})}function mn({status:e,compacted:n=!1}){const{t:a}=x(),s=a(e==="generating"?"agent.statusGenerating":e==="reconnecting"?"agent.statusReconnecting":"agent.statusReady");return t.jsxs("span",{className:`agent-status agent-status--${e}`,"aria-live":e==="ready"?void 0:"polite",children:[e==="generating"?t.jsx("span",{className:"agent-status__dot","aria-hidden":"true"}):null,t.jsx("span",{children:s}),n?t.jsx("em",{children:a("agent.compacted")}):null]})}function pn({session:e,turns:n,imagesById:a,currentImageId:s,runtimeStatus:r,runProgress:l,settings:o,insertedPrompt:d,onSettingsChange:c,onOpenModelTab:i,onWebSearchChange:g,onAttachFiles:u,onImageSelect:p,onSend:f,onRetryRun:b}){const{t:v}=x();return t.jsxs("section",{className:"agent-chat","aria-label":v("agent.chat"),children:[t.jsxs("header",{className:"agent-pane-header",children:[t.jsxs("div",{className:"agent-pane-header__title",children:[t.jsx("span",{children:v("agent.chat")}),t.jsx("strong",{children:e?.title??v("agent.newSession")})]}),t.jsxs("div",{className:"agent-pane-header__actions",children:[o&&c?t.jsx(Ze,{settings:o,onChange:c,onOpenModelTab:i}):null,t.jsx(mn,{status:r,compacted:e?.compacted})]})]}),t.jsx(un,{turns:n,imagesById:a,currentImageId:s,onImageSelect:p}),t.jsx(hn,{progress:l,onRetry:b}),t.jsx(Ht,{webSearchEnabled:e?.webSearchEnabled??!1,insertedPrompt:d,onWebSearchChange:g,onAttachFiles:u,onSend:f})]})}const fn=["image","refs","web","memory"];function xn({activeTab:e,onChange:n}){const{t:a}=x(),s={image:a("agent.imageTab"),refs:a("agent.refsTab"),web:a("agent.webTab"),memory:a("agent.memoryTab")};return t.jsx("div",{className:"agent-context-tabs",role:"tablist","aria-label":a("agent.contextTabs"),children:fn.map(r=>t.jsx("button",{type:"button",role:"tab","aria-selected":e===r,className:e===r?"active":"",onClick:()=>n(r),children:s[r]},r))})}function bn({activeTab:e,currentImage:n}){const{t:a}=x();return e==="refs"?t.jsx("div",{className:"agent-tab-empty",children:a("agent.noRefs")}):e==="web"?t.jsx("div",{className:"agent-tab-empty",children:a("agent.noWeb")}):e==="memory"?t.jsxs("ul",{className:"agent-memory-list",children:[t.jsx("li",{children:a("agent.memoryItemStyle")}),t.jsx("li",{children:a("agent.memoryItemSubject")})]}):t.jsxs("dl",{className:"agent-image-meta",children:[t.jsxs("div",{children:[t.jsx("dt",{children:a("agent.filename")}),t.jsx("dd",{children:n?.filename??"-"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:a("agent.prompt")}),t.jsx("dd",{children:n?.prompt??n?.revisedPrompt??"-"})]})]})}function jn(e){const n=Math.max(0,Math.round(e));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function et({image:e}){const{t:n}=x(),[a,s]=m.useState("loading"),[r,l]=m.useState(null),[o,d]=m.useState(0),c=g=>{const u=g.currentTarget.duration;l(Number.isFinite(u)?u:null),s("ready")},i=()=>{s("loading"),l(null),d(g=>g+1)};return t.jsxs("div",{className:"agent-video-preview",children:[a==="loading"?t.jsx("div",{className:"agent-video-preview__skeleton",role:"status",children:n("agent.mediaLoading")}):null,a==="error"?t.jsxs("div",{className:"agent-video-preview__error",role:"alert",children:[t.jsx(O,{size:34}),t.jsx("span",{children:n("agent.mediaLoadFailed")}),t.jsx("button",{type:"button",onClick:i,children:n("agent.mediaRetry")})]}):t.jsx("video",{src:e.url,controls:!0,playsInline:!0,preload:"metadata","aria-label":e.prompt??n("agent.mediaVideoLabel"),onLoadedMetadata:c,onError:()=>s("error")},o),t.jsxs("div",{className:"agent-video-preview__toolbar",children:[t.jsx("span",{children:r==null?n("agent.mediaDurationUnknown"):n("agent.mediaDuration",{duration:jn(r)})}),t.jsx("a",{href:e.url,download:e.filename,children:n("agent.mediaDownload")})]})]})}function tt({currentImage:e,images:n,activeTab:a,onTabChange:s,onImageSelect:r,headerAction:l}){const{t:o}=x(),d=m.useRef({}),c=m.useMemo(()=>n.findIndex(u=>u.id===e?.id),[e?.id,n]);m.useEffect(()=>{e?.id&&d.current[e.id]?.scrollIntoView({block:"nearest",inline:"nearest"})},[e?.id]);const i=m.useCallback(u=>{const p=n[u];p&&r(p.id)},[n,r]),g=m.useCallback(u=>{if(n.length===0)return;const p=c>=0?c:0;let f=null;(u.key==="ArrowLeft"||u.key==="ArrowUp")&&(f=Math.max(0,p-1)),(u.key==="ArrowRight"||u.key==="ArrowDown")&&(f=Math.min(n.length-1,p+1)),u.key==="Home"&&(f=0),u.key==="End"&&(f=n.length-1),!(f===null||f===p)&&(u.preventDefault(),i(f))},[c,n.length,i]);return t.jsxs("section",{className:"agent-image","aria-label":o("agent.imagePane"),children:[t.jsxs("header",{className:"agent-pane-header",children:[t.jsxs("div",{className:"agent-pane-header__title",children:[t.jsx("span",{children:o("agent.imagePane")}),t.jsx("strong",{children:o("agent.currentImage")})]}),l]}),t.jsx("div",{className:"agent-image__preview",tabIndex:n.length>1?0:void 0,onKeyDown:g,"aria-label":n.length>1?o("agent.variants"):void 0,children:e?we(e.url)?t.jsx(et,{image:e},e.id):t.jsx(Q,{src:e.url,alt:e.prompt??o("agent.imageAlt"),fallbackClassName:"agent-image__empty",iconSize:34}):t.jsxs("div",{className:"agent-image__empty",children:[t.jsx(O,{size:34}),t.jsx("span",{children:o("agent.noImage")})]})}),t.jsx("div",{className:"agent-image__variants","aria-label":o("agent.variants"),onKeyDown:g,children:n.map(u=>t.jsx(F,{ref:p=>{d.current[u.id]=p},image:u,selected:u.id===e?.id,onSelect:r},u.id))}),t.jsx(xn,{activeTab:a,onChange:s}),t.jsx(bn,{activeTab:a,currentImage:e})]})}function yn({open:e,currentImage:n,images:a,activeTab:s,onTabChange:r,onImageSelect:l,onClose:o}){const{t:d}=x(),c=m.useCallback(()=>o(),[o]),i=de(e,c);return e?t.jsxs("div",{className:"agent-dialog agent-dialog--image",role:"presentation",children:[t.jsx("button",{type:"button",className:"agent-dialog__backdrop",onClick:o,"aria-label":d("agent.closeImage")}),t.jsx("section",{ref:i,className:"agent-image-sheet",role:"dialog","aria-modal":"true","aria-label":d("agent.imagePane"),children:t.jsx(tt,{currentImage:n,images:a,activeTab:s,onTabChange:r,onImageSelect:l,headerAction:t.jsx("button",{type:"button",onClick:o,"aria-label":d("agent.closeImage"),children:t.jsx(ge,{size:17})})})})]}):null}function vn(e){return e.status==="queued"?`#${e.position}`:e.status==="succeeded"?String(e.resultImageIds.length):""}function Sn(e,n){if(!e)return"-";const a=Math.max(1,Math.round((Date.now()-e)/1e3));if(a<60)return n(a,"second");const s=Math.round(a/60);return s<60?n(s,"minute"):n(Math.round(s/60),"hour")}function _n(e){return!e.errorCode&&!e.errorClass&&!e.errorMessage?null:Nt({code:e.errorCode,errorClass:e.errorClass,rawCode:e.errorRawCode,message:e.errorMessage})}function wn(e,n){return e?.errorClass?e.spec.cardKey?n(`${e.spec.cardKey}.title`):e.spec.toastKey?n(e.spec.toastKey):null:null}function Nn({item:e,onCancel:n,onRetry:a}){const{t:s}=x(),r=e.status==="queued"||e.status==="running",l=e.status==="failed"||e.status==="canceled",o=e.plan.plannedVariants||e.plan.prompts.length||1,d=e.plan.plannedParallelism||e.options.parallelism,c=vn(e),i=Sn(e.createdAt,(u,p)=>s("agent.queueTimeAgo",{value:u,unit:s(`agent.queueTimeUnit.${p}`)})),g=wn(_n(e),s);return t.jsxs("div",{className:`agent-queue-row agent-queue-row--${e.status}`,children:[t.jsxs("div",{className:"agent-queue-row__main",children:[t.jsx("strong",{children:e.prompt}),t.jsx("span",{className:`agent-queue-row__badge agent-queue-row__badge--${e.status}`,children:s(`agent.queueStatus.${e.status}`)}),t.jsx("span",{children:[c,g,s("agent.queuePlanSummary",{variants:o,parallel:d}),i].filter(Boolean).join(" · ")}),e.plan.reason||e.errorCode||e.errorMessage?t.jsxs("details",{className:"agent-queue-row__details",children:[t.jsx("summary",{children:s("agent.queueDetails")}),e.plan.reason?t.jsx("small",{children:e.plan.reason}):null,e.errorCode?t.jsx("small",{children:e.errorCode}):null,e.errorMessage?t.jsx("small",{children:e.errorMessage}):null]}):null]}),t.jsxs("div",{className:"agent-queue-row__actions",children:[r?t.jsx("button",{type:"button",onClick:()=>n(e.id),children:s("agent.cancelQueue")}):null,l?t.jsx("button",{type:"button",onClick:()=>a(e.id),children:s("agent.retryQueue")}):null]})]})}function nt({items:e,summary:n,onCancel:a,onRetry:s}){const{t:r}=x(),l=r("agent.queueAnnouncement",{running:n?.runningCount??0,queued:n?.queuedCount??0,failed:e.filter(o=>o.status==="failed").length});return t.jsxs("section",{className:"agent-sidebar-section","aria-label":r("agent.queue"),children:[t.jsx("header",{children:t.jsxs("div",{children:[t.jsx("span",{children:r("agent.queue")}),t.jsxs("strong",{children:[n?.runningCount??0," ",r("agent.runningShort")," · ",n?.queuedCount??0," ",r("agent.queuedShort")]})]})}),t.jsxs("div",{className:"agent-queue-list",children:[t.jsx("span",{className:"agent-sr-only","aria-live":"polite","aria-atomic":"true",children:l}),e.length===0?t.jsx("div",{className:"agent-tab-empty",children:r("agent.queueEmpty")}):e.map(o=>t.jsx(Nn,{item:o,onCancel:a,onRetry:s},o.id))]})]})}function Cn({open:e,items:n,summary:a,onCancel:s,onRetry:r,onClose:l}){const{t:o}=x(),d=m.useCallback(()=>l(),[l]),c=de(e,d);return e?t.jsxs("div",{className:"agent-dialog agent-dialog--queue",role:"presentation",children:[t.jsx("button",{type:"button",className:"agent-dialog__backdrop",onClick:l,"aria-label":o("agent.topbarCloseQueue")}),t.jsxs("section",{ref:c,className:"agent-queue-sheet",role:"dialog","aria-modal":"true","aria-label":o("agent.topbarQueueSheet"),children:[t.jsxs("header",{children:[t.jsx("strong",{children:o("agent.topbarQueueSheet")}),t.jsx("button",{type:"button",onClick:l,"aria-label":o("agent.topbarCloseQueue"),children:t.jsx(ge,{size:17})})]}),t.jsx(nt,{items:n,summary:a,onCancel:s,onRetry:r})]})]}):null}function at({mode:e,onInsert:n}){const{t:a}=x(),s=E(i=>i.promptLibrary),r=E(i=>i.promptLibraryLoading),l=E(i=>i.loadPromptLibrary),[o,d]=m.useState("");m.useEffect(()=>{l()},[l]);const c=m.useMemo(()=>{const i=o.trim().toLowerCase();return s.prompts.filter(g=>{const u=g.tags.map(p=>p.toLowerCase());return e==="forms"&&!u.includes("agent:form")?!1:i?g.name.toLowerCase().includes(i)||g.text.toLowerCase().includes(i)||u.some(p=>p.includes(i)):!0})},[s.prompts,e,o]);return t.jsxs("section",{className:"agent-sidebar-section","aria-label":a(e==="forms"?"agent.forms":"agent.promptLibrary"),children:[t.jsx("header",{children:t.jsxs("div",{children:[t.jsx("span",{children:a(e==="forms"?"agent.forms":"agent.promptLibrary")}),t.jsx("strong",{children:c.length})]})}),t.jsxs("label",{className:"agent-sidebar-search",children:[t.jsx("span",{children:a("promptLibrary.search")}),t.jsx("input",{value:o,onChange:i=>d(i.target.value),placeholder:a("promptLibrary.search")})]}),t.jsxs("div",{className:"agent-prompt-library-list",children:[r?t.jsx("div",{className:"agent-tab-empty",children:a("common.loading")}):null,!r&&c.length===0?t.jsx("div",{className:"agent-tab-empty",children:a(e==="forms"?"agent.noForms":"promptLibrary.empty")}):null,c.map(i=>t.jsxs("article",{className:"agent-prompt-library-row",children:[t.jsx("strong",{children:i.name||a("promptLibrary.untitled")}),t.jsx("p",{children:i.text}),t.jsx("button",{type:"button",onClick:()=>n(i.text),children:a("agent.insertPrompt")})]},i.id))]})]})}function kn({onInsert:e}){return t.jsx(at,{mode:"forms",onInsert:e})}function ne({label:e,value:n,options:a,onChange:s}){return t.jsxs("div",{className:"agent-settings-grid__field",children:[t.jsx("span",{children:e}),t.jsx("div",{className:"agent-segment-control",role:"group","aria-label":e,children:a.map(r=>t.jsx("button",{type:"button","aria-pressed":r.value===n,onClick:()=>s(r.value),children:r.label},r.value))})]})}function ve({label:e,value:n,max:a,onChange:s}){return t.jsxs("div",{className:"agent-settings-grid__field",children:[t.jsx("span",{children:e}),t.jsxs("div",{className:"agent-stepper",role:"group","aria-label":e,children:[t.jsx("button",{type:"button","aria-label":`${e} -`,disabled:n<=1,onClick:()=>s(Math.max(1,n-1)),children:"-"}),t.jsx("output",{"aria-live":"polite",children:n}),t.jsx("button",{type:"button","aria-label":`${e} +`,disabled:n>=a,onClick:()=>s(Math.min(a,n+1)),children:"+"})]})]})}function In({settings:e,onChange:n}){const{t:a}=x();return t.jsxs("section",{className:"agent-settings-grid","aria-label":a("agent.quality"),children:[t.jsx(ne,{label:a("agent.generationStrategy"),value:e.generationStrategy,options:[{value:"auto",label:a("agent.generationStrategyAuto")},{value:"manual",label:a("agent.generationStrategyManual")}],onChange:s=>n({generationStrategy:s})}),t.jsx(ne,{label:a("agent.quality"),value:e.quality,options:[{value:"low",label:"low"},{value:"medium",label:"medium"},{value:"high",label:"high"}],onChange:s=>n({quality:s})}),t.jsx(ne,{label:a("agent.size"),value:e.size,options:[{value:"1024x1024",label:"1:1"},{value:"1536x1024",label:"3:2"},{value:"1024x1536",label:"2:3"},{value:"2048x2048",label:"2K"}],onChange:s=>n({size:s})}),t.jsx(ne,{label:a("agent.format"),value:e.format,options:[{value:"png",label:"PNG"},{value:"jpeg",label:"JPEG"},{value:"webp",label:"WebP"}],onChange:s=>n({format:s})}),t.jsx(ne,{label:a("agent.moderation"),value:e.moderation,options:[{value:"auto",label:"auto"},{value:"low",label:"low"}],onChange:s=>n({moderation:s})}),e.generationStrategy==="manual"?t.jsx(ve,{label:a("agent.variantsCount"),value:e.variants,max:_e,onChange:s=>n({variants:s})}):t.jsx(ve,{label:a("agent.maxAutoVariants"),value:e.maxAutoVariants,max:_e,onChange:s=>n({maxAutoVariants:s})}),t.jsx(ve,{label:a("agent.parallelism"),value:e.parallelism,max:Tt,onChange:s=>n({parallelism:s})})]})}const D=["image","library","forms","quality","model","queue"];function An({activeTab:e,onChange:n}){const{t:a}=x(),s=m.useRef({}),r=m.useCallback(l=>{const o=D.indexOf(e),d=o>=0?o:0;let c=null;if((l.key==="ArrowRight"||l.key==="ArrowDown")&&(c=(d+1)%D.length),(l.key==="ArrowLeft"||l.key==="ArrowUp")&&(c=(d-1+D.length)%D.length),l.key==="Home"&&(c=0),l.key==="End"&&(c=D.length-1),c===null)return;l.preventDefault();const i=D[c];n(i),s.current[i]?.focus()},[e,n]);return t.jsx("div",{className:"agent-sidebar-tabs",role:"tablist","aria-label":a("agent.rightSidebar"),children:D.map(l=>t.jsx("button",{type:"button",role:"tab",id:`agent-sidebar-tab-${l}`,ref:o=>{s.current[l]=o},"aria-controls":`agent-sidebar-panel-${l}`,className:e===l?"active":"","aria-selected":e===l,tabIndex:e===l?0:-1,onKeyDown:r,onClick:()=>n(l),children:a(`agent.sidebarTabs.${l}`)},l))})}function ze({currentImage:e,images:n,contextTab:a,sidebarTab:s,queueItems:r,runSummary:l,settings:o,onContextTabChange:d,onSidebarTabChange:c,onImageSelect:i,onSettingsChange:g,onInsertPrompt:u,onCancelQueue:p,onRetryQueue:f}){const{t:b}=x(),v=w=>({id:`agent-sidebar-panel-${w}`,role:"tabpanel","aria-labelledby":`agent-sidebar-tab-${w}`});return t.jsxs(t.Fragment,{children:[t.jsx(An,{activeTab:s,onChange:c}),s==="image"?t.jsx("div",{...v("image"),className:"agent-sidebar-panel",children:t.jsx(tt,{currentImage:e,images:n,activeTab:a,onTabChange:d,onImageSelect:i})}):null,s==="library"?t.jsx("div",{...v("library"),className:"agent-sidebar-panel",children:t.jsx(at,{mode:"library",onInsert:u})}):null,s==="forms"?t.jsx("div",{...v("forms"),className:"agent-sidebar-panel",children:t.jsx(kn,{onInsert:u})}):null,s==="quality"?t.jsxs("section",{...v("quality"),className:"agent-sidebar-panel agent-sidebar-section","aria-label":b("agent.quality"),children:[t.jsx("header",{children:t.jsxs("div",{children:[t.jsx("span",{children:b("agent.quality")}),t.jsx("strong",{children:o.generationStrategy==="auto"?b("agent.generationStrategyAuto"):b("agent.generationStrategyManual")})]})}),t.jsx(In,{settings:o,onChange:g})]}):null,s==="model"?t.jsxs("section",{...v("model"),className:"agent-sidebar-panel agent-sidebar-section","aria-label":b("agent.modelSettings"),children:[t.jsx("header",{children:t.jsxs("div",{children:[t.jsx("span",{children:b("agent.modelSettings")}),t.jsx("strong",{children:o.model})]})}),t.jsx(Ze,{settings:o,onChange:g})]}):null,s==="queue"?t.jsx("div",{...v("queue"),className:"agent-sidebar-panel",children:t.jsx(nt,{items:r,summary:l,onCancel:p,onRetry:f})}):null]})}const Ln=()=>{};function We({overlay:e,onClose:n,...a}){const{t:s}=x(),r=de(e===!0,n??Ln,{modal:!1});return e?t.jsxs("section",{ref:r,id:"agent-tools-panel",className:"agent-right-sidebar agent-right-sidebar--overlay",role:"dialog","aria-labelledby":"agent-tools-panel-title",children:[t.jsxs("header",{className:"agent-right-sidebar__overlay-header",children:[t.jsx("h2",{id:"agent-tools-panel-title",tabIndex:-1,"data-autofocus":!0,children:s("agent.toolsPanel")}),t.jsx("button",{type:"button",onClick:n,"aria-label":s("agent.closeTools"),children:t.jsx(ge,{size:17})})]}),t.jsx(ze,{...a})]}):t.jsx("aside",{className:"agent-right-sidebar",children:t.jsx(ze,{...a})})}function st({summary:e}){const{t:n}=x();if(!e||e.status==="idle")return null;const a=e.status==="running"?n("agent.sessionRunning"):e.status==="queued"?n("agent.sessionQueued",{count:e.queuedCount}):n("agent.sessionError");return t.jsxs("span",{className:`agent-session-spinner agent-session-spinner--${e.status}`,"data-motion-essential":!0,"aria-label":a,title:a,children:[t.jsx("span",{"aria-hidden":"true"}),e.queuedCount>0?t.jsx("em",{children:e.queuedCount}):null]})}function Tn(e){const n=Math.max(1,Math.round((Date.now()-e)/6e4));if(n<60)return`${n}m`;const a=Math.round(n/60);return a<24?`${a}h`:`${Math.round(a/24)}d`}function Mn({sessions:e,selectedId:n,imagesById:a,runSummaryBySession:s={},onSelect:r,onRename:l,onDelete:o}){const{t:d}=x();return t.jsx("div",{className:"agent-session-list",children:e.map(c=>{const i=c.lastImageId?a[c.lastImageId]:null;return t.jsxs("div",{className:`agent-session-row${c.id===n?" is-active":""}`,children:[t.jsxs("button",{type:"button","aria-current":c.id===n?"page":void 0,onClick:()=>r(c.id),children:[t.jsx("span",{className:"agent-session-row__thumb",children:i?t.jsx(Q,{src:i.thumbUrl??i.url,alt:"",iconSize:17}):t.jsx(O,{size:17})}),t.jsxs("span",{className:"agent-session-row__body",children:[t.jsx("strong",{children:c.title}),t.jsxs("span",{children:[d("agent.imageCount",{count:c.imageCount})," · ",Tn(c.updatedAt)]})]}),t.jsxs("span",{className:"agent-session-row__badges",children:[t.jsx(st,{summary:s[c.id]}),c.webSearchEnabled?t.jsx("em",{title:d("agent.web"),children:"W"}):null,c.compacted?t.jsx("em",{title:d("agent.compacted"),children:"C"}):null]})]}),t.jsxs("div",{className:"agent-session-row__actions",children:[t.jsx("button",{type:"button",onClick:()=>l(c.id),"aria-label":d("agent.renameSession"),title:d("agent.renameSession"),children:t.jsx(Kt,{size:14})}),t.jsx("button",{type:"button",onClick:()=>o(c.id),"aria-label":d("agent.deleteSession"),title:d("agent.deleteSession"),children:t.jsx(Wt,{size:14})})]})]},c.id)})})}function En({open:e,sessions:n,selectedId:a,imagesById:s,runSummaryBySession:r,onClose:l,onCreate:o,onSelect:d,onRename:c,onDelete:i}){const{t:g}=x(),[u,p]=m.useState(""),f=m.useCallback(()=>l(),[l]),b=de(e,f),v=m.useMemo(()=>{const w=u.trim().toLowerCase();return w?n.filter(q=>q.title.toLowerCase().includes(w)):n},[u,n]);return e?t.jsxs("div",{className:"agent-dialog agent-dialog--drawer",role:"presentation",children:[t.jsx("button",{type:"button",className:"agent-dialog__backdrop",onClick:l,"aria-label":g("agent.closeSessions")}),t.jsxs("section",{ref:b,className:"agent-session-drawer",role:"dialog","aria-modal":"true","aria-label":g("agent.sessions"),children:[t.jsxs("header",{children:[t.jsx("strong",{children:g("agent.sessions")}),t.jsx("button",{type:"button",onClick:l,"aria-label":g("agent.closeSessions"),children:t.jsx(ge,{size:17})})]}),t.jsxs("button",{type:"button",className:"agent-sessions__create",onClick:o,children:[t.jsx(Ue,{size:16}),t.jsx("span",{children:g("agent.newSession")})]}),t.jsxs("label",{className:"agent-sessions__search",children:[t.jsx($t,{size:15}),t.jsx("input",{value:u,onChange:w=>p(w.target.value),placeholder:g("agent.sessionSearch")})]}),t.jsx(Mn,{sessions:v,selectedId:a,imagesById:s,runSummaryBySession:r,onSelect:d,onRename:c,onDelete:i})]})]}):null}function qn({sessions:e,selectedId:n,imagesById:a,runSummaryBySession:s={},onCreate:r,onSelect:l,onOpenDrawer:o}){const{t:d}=x();return t.jsxs("aside",{className:"agent-rail","aria-label":d("agent.sessions"),children:[t.jsx("button",{type:"button",onClick:o,"aria-label":d("agent.openSessions"),title:d("agent.openSessions"),children:t.jsx(He,{size:17})}),t.jsx("button",{type:"button",onClick:r,"aria-label":d("agent.newSession"),title:d("agent.newSession"),children:t.jsx(Ue,{size:17})}),t.jsx("div",{className:"agent-rail__sessions",children:e.map(c=>{const i=c.lastImageId?a[c.lastImageId]:null,g=`${c.title} — ${d("agent.imageCount",{count:c.imageCount})}`;return t.jsxs("button",{type:"button",className:c.id===n?"is-active":"",onClick:()=>l(c.id),title:g,"aria-label":g,"aria-current":c.id===n?"true":void 0,children:[i?t.jsx(Q,{src:i.thumbUrl??i.url,alt:"",iconSize:17}):t.jsx(O,{size:17}),t.jsx(st,{summary:s[c.id]}),c.compacted?t.jsx("span",{"aria-label":d("agent.compacted")}):null]},c.id)})})]})}function Rn({currentImage:e,images:n,onImageSelect:a,onOpenPanel:s,toolsPanelOpen:r}){const{t:l}=x(),o=m.useRef({}),d=m.useMemo(()=>n.findIndex(g=>g.id===e?.id),[e?.id,n]);m.useEffect(()=>{e?.id&&o.current[e.id]?.scrollIntoView({block:"nearest",inline:"nearest"})},[e?.id]);const c=m.useCallback(g=>{const u=n[g];u&&a(u.id)},[n,a]),i=m.useCallback(g=>{if(n.length===0)return;const u=d>=0?d:0;let p=null;(g.key==="ArrowLeft"||g.key==="ArrowUp")&&(p=Math.max(0,u-1)),(g.key==="ArrowRight"||g.key==="ArrowDown")&&(p=Math.min(n.length-1,u+1)),g.key==="Home"&&(p=0),g.key==="End"&&(p=n.length-1),!(p===null||p===u)&&(g.preventDefault(),c(p))},[d,n.length,c]);return t.jsxs("section",{className:"agent-stage","aria-label":l("agent.imagePane"),children:[t.jsxs("header",{className:"agent-pane-header",children:[t.jsxs("div",{className:"agent-pane-header__title",children:[t.jsx("span",{children:l("agent.imagePane")}),t.jsx("strong",{children:l("agent.currentImage")})]}),t.jsx("button",{type:"button",className:"agent-stage__tools",onClick:s,"aria-expanded":r===!0,"aria-controls":"agent-tools-panel","aria-label":l(r?"agent.closeTools":"agent.openTools"),title:l(r?"agent.closeTools":"agent.openTools"),children:t.jsx(Qt,{size:16})})]}),t.jsx("div",{className:"agent-stage__viewport",tabIndex:n.length>1?0:void 0,onKeyDown:i,"aria-label":n.length>1?l("agent.variants"):void 0,children:e?we(e.url)?t.jsx(et,{image:e},e.id):t.jsx(Q,{src:e.url,alt:e.prompt??l("agent.imageAlt"),fallbackClassName:"agent-stage__empty",iconSize:34}):t.jsxs("div",{className:"agent-stage__empty",children:[t.jsx(O,{size:34}),t.jsx("span",{children:l("agent.noImage")}),t.jsx("small",{children:l("agent.stageEmptyHint")})]})}),t.jsxs("div",{className:"agent-stage__caption",children:[t.jsx("strong",{children:e?.filename??"-"}),t.jsx("span",{children:e?.prompt??e?.revisedPrompt??""})]}),t.jsx("div",{className:"agent-stage__filmstrip","aria-label":l("agent.variants"),onKeyDown:i,children:n.map(g=>t.jsx(F,{ref:u=>{o.current[g.id]=u},image:g,selected:g.id===e?.id,onSelect:a},g.id))})]})}function Ke({layoutMode:e,session:n,currentImage:a,activeJobCount:s,onOpenSessions:r,onOpenImage:l,onOpenQueue:o}){const{t:d}=x(),c=E(g=>g.setUIMode),i=e==="mobile-chat-image-sheet";return t.jsxs("header",{className:"agent-topbar",children:[t.jsxs("button",{type:"button",className:"agent-topbar__back",onClick:()=>c("classic"),"aria-label":d("agent.topbarBackToStudio"),title:d("agent.topbarBackToStudio"),children:[t.jsx(Ot,{size:18}),t.jsx("span",{children:d("agent.topbarStudio")})]}),t.jsx("button",{type:"button",className:"agent-topbar__icon",onClick:r,"aria-label":d("agent.openSessions"),title:d("agent.openSessions"),children:t.jsx(He,{size:18})}),t.jsxs("div",{className:"agent-topbar__title",children:[t.jsx("span",{children:d("agent.title")}),t.jsx("strong",{children:n?.title??d("agent.newSession")})]}),i?t.jsxs("div",{className:"agent-topbar__actions",children:[t.jsxs("button",{type:"button",className:"agent-topbar__queue",onClick:o,"aria-label":d("agent.topbarOpenQueue",{count:s}),title:d("agent.topbarOpenQueue",{count:s}),children:[t.jsx(zt,{size:17}),t.jsx("span",{children:s})]}),t.jsx("button",{type:"button",className:"agent-topbar__image",onClick:l,"aria-label":d("agent.openImage"),title:d("agent.openImage"),children:a?t.jsx(Q,{src:a.thumbUrl??a.url,alt:"",iconSize:18}):t.jsx(O,{size:18})})]}):null]})}async function $n({sessionId:e,files:n,importLocalImageToHistory:a,applyWorkspace:s}){for(const r of n){const l=await a(r),o=l?Ge(l):null;if(!o)continue;const d=await ce(e,{currentImage:o});s(d)}}const Ce="agent-local-",Pn=`${Ce}pending-`;let Qe=0;function ke(e){return Qe+=1,`${Ce}${e}-${Date.now()}-${Qe}`}function rt(e){return e.id.startsWith(Ce)}function ie(e){return e.id.startsWith(Pn)}function Dn(e,n){return{id:ke("user"),role:"user",text:e,imageIds:[],webFindingIds:[],status:"complete",createdAt:n}}function Bn(e,n){return{id:ke("pending"),role:"assistant",text:e,imageIds:[],webFindingIds:[],status:"streaming",createdAt:n}}function On(e){return{id:ke("error"),role:"assistant",text:e,imageIds:[],webFindingIds:[],status:"error",createdAt:Date.now()}}function zn({turns:e,queueItems:n,runSummary:a,localPendingCount:s}){const r=n.filter(d=>d.status==="failed").length,l=Wn(n),o=l?Kn(l):{};if(a?.status==="error"&&a.lastError)return{active:!0,status:"error",labelKey:"runError",queuedCount:a.queuedCount,runningCount:a.runningCount,failedCount:r,lastError:a.lastError};if(a?.status==="queued")return{active:!0,status:"queued",labelKey:"pendingQueued",queuedCount:a.queuedCount,runningCount:a.runningCount,failedCount:r,...o};if(a?.status==="running"){const d=l?.startedAt??l?.createdAt??null,c=e.some(i=>!rt(i)&&i.role==="tool"&&(!d||(i.createdAt??0)>=d));return{active:!0,status:c?"running":"planning",labelKey:c?"pendingGenerating":"pendingPlanning",queuedCount:a.queuedCount,runningCount:a.runningCount,failedCount:r,...o}}return s>0?{active:!0,status:"planning",labelKey:"pendingPlanning",queuedCount:a?.queuedCount??0,runningCount:a?.runningCount??0,failedCount:r}:null}function Wn(e){return[...e].filter(n=>n.status==="running"||n.status==="queued").sort((n,a)=>n.status!==a.status?n.status==="running"?-1:1:(n.startedAt??n.createdAt)-(a.startedAt??a.createdAt))[0]??null}function Kn(e){return{startedAt:e.startedAt??null,progressStage:e.progressStage??null,jobKind:e.plan.mode==="video"||e.plan.videoParams?"video":"image",variantCount:e.plan.plannedVariants||e.plan.prompts.length||1}}function Se(){return{sessions:[],turnsBySession:{},imagesById:{},imageIdsBySession:{},selectedSessionId:null,currentImageId:null,allowedTools:["ima2.get_image_context","ima2.web_search","ima2.generate_image","ima2.generate_video","ima2.get_generation_errors"],manifest:null,queueBySession:{},runSummaryBySession:{}}}function Qn(e){const n=e.filename.endsWith(".mp4");return{image:e.url,url:e.url,filename:e.filename,thumb:e.thumbUrl??void 0,prompt:e.prompt??void 0,revisedPrompt:e.revisedPrompt??null,createdAt:e.createdAt,mediaType:n?"video":"image",kind:"agent"}}function Fn(e,n,a){return{...e,turnsBySession:{...e.turnsBySession,[n]:[...e.turnsBySession[n]??[],...a]}}}function Gn(e,n,a,s){const r=e.turnsBySession[n]??[];return{...e,turnsBySession:{...e.turnsBySession,[n]:[...r.filter(l=>l.id!==a),On(s)]}}}function Un(e,n,a){const s={...n.turnsBySession};for(const[r,l]of Object.entries(e.turnsBySession)){const o=s[r]??[],d=new Set(o.map(g=>g.id)),c=Math.max(0,...o.map(g=>g.createdAt??0)),i=l.filter(g=>a.has(g.id)||d.has(g.id)?!1:rt(g)||g.status==="streaming"?!0:(g.createdAt??0)>=c);i.length>0&&(s[r]=[...o,...i])}return{...n,turnsBySession:s}}function Jn(){const{t:e}=x(),n=Rt(),a=E(h=>h.currentImage),s=E(h=>h.importLocalImageToHistory),r=E(h=>h.addHistoryItem),l=E(h=>h.selectHistory),o=E(h=>h.showToast),d=m.useRef(!1),c=m.useRef(0),i=m.useRef(0),g=m.useRef(null),[u,p]=m.useState(()=>Se()),[f,b]=m.useState(null),[v,w]=m.useState("image"),[q,G]=m.useState("image"),[U,L]=m.useState(null),[z,A]=m.useState(!1),[he,H]=m.useState(!1),[V,J]=m.useState(!1),[j,M]=m.useState(!1),[lt,R]=m.useState("reconnecting"),[me,pe]=m.useState(null),W=m.useCallback(h=>h instanceof Error?h.message:String(h),[]),ot=m.useCallback(()=>M(!1),[]),it=m.useCallback(()=>M(h=>!h),[]),T=m.useCallback(h=>{o(e("agent.workspaceActionFailed",{reason:W(h)}),!0)},[W,o,e]),X=m.useCallback(h=>{p({...Se(),...h}),b(h.selectedSessionId??null)},[]),ae=m.useCallback((h,y)=>{const S={...Se(),...h};p(_=>Un(_,S,y)),b(h.selectedSessionId??null)},[]),$=m.useCallback(h=>{c.current+=1,X(h)},[X]),ct=m.useCallback((h,y)=>{c.current+=1,ae(h,y)},[ae]),ut=()=>{i.current+=1,R("generating")},dt=()=>{i.current=Math.max(0,i.current-1),i.current===0&&R("ready")},se=m.useCallback(async h=>{const y=++c.current;R("reconnecting"),pe(null);const S=await Re(h);if(y!==c.current)return;if(S.sessions.length>0){X(S),R("ready");return}const _=await $e({title:e("agent.newSession"),currentImage:a});y===c.current&&(X(_),R("ready"))},[X,a,e]),Ie=m.useCallback(async h=>{const y=++c.current,S=await Re(h);y===c.current&&(ae(S,new Set),R("ready"))},[ae]);m.useEffect(()=>{d.current||(d.current=!0,se().catch(h=>{pe(W(h)),R("reconnecting")}))},[W,se]);const Y=u.sessions.find(h=>h.id===f)??null,Z=u.currentImageId?u.imagesById[u.currentImageId]??null:null,re=f?(u.imageIdsBySession[f]??[]).map(h=>u.imagesById[h]).filter(h=>!!h):[],fe=Y?u.turnsBySession[Y.id]??[]:[],gt=fe.filter(ie).length,ht=fe.filter(h=>!ie(h)),K=f?u.queueBySession[f]??[]:[],k=f?u.runSummaryBySession[f]:void 0,mt=K.filter(h=>h.status==="queued"||h.status==="running").length,pt=zn({turns:fe,queueItems:K,runSummary:k,localPendingCount:gt}),ee=Pe(Y?.generationSettings),ft=lt==="reconnecting"?"reconnecting":i.current>0||k?.status==="queued"||k?.status==="running"?"generating":"ready",xt=n!=="mobile-chat-image-sheet",xe=n==="desktop-three-pane"||n==="desktop-rail",Ae=n==="tablet-stacked"||n==="mobile-chat-image-sheet",bt=n==="desktop-three-pane"||n==="desktop-rail";m.useEffect(()=>{const h=Object.keys(u.imagesById);if(!g.current){(h.length>0||u.sessions.length>0)&&(g.current=new Set(h));return}const y=g.current,S=h.filter(N=>!y.has(N)).map(N=>u.imagesById[N]).filter(N=>!!N);if(S.length===0)return;for(const N of h)y.add(N);const _=S.map(Qn);for(const N of _)r(N);const P=_.reduce((N,I)=>(I.createdAt??0)>(N.createdAt??0)?I:N);l(P)},[u.imagesById,u.sessions.length,r,l]),m.useEffect(()=>{p(h=>{if(i.current>0)return h;let y=!1;const S={...h.turnsBySession};for(const[_,P]of Object.entries(S)){if(P.filter(ie).length===0)continue;const I=h.runSummaryBySession[_];I?.status==="queued"||I?.status==="running"||(S[_]=P.filter(je=>!ie(je)),y=!0)}return y?{...h,turnsBySession:S}:h})},[u.turnsBySession,u.runSummaryBySession]),m.useEffect(()=>{if(!f)return;const h=k?.status==="queued"||k?.status==="running",y=window.setInterval(()=>{Ie(f).catch(()=>R("reconnecting"))},h?1500:4e3);return()=>window.clearInterval(y)},[Ie,f,k?.queuedCount,k?.runningCount,k?.status]);const Le=h=>{A(!1),J(!1),se(h).catch(T)},Te=()=>{$e({title:e("agent.newSession"),currentImage:null}).then($).catch(T)},jt=h=>{const y=u.sessions.find(_=>_.id===h),S=window.prompt(e("agent.renameSession"),y?.title??"");S?.trim()&&ce(h,{title:S.trim()}).then($).catch(T)},yt=h=>{const y=u.sessions.find(S=>S.id===h);!y||!window.confirm(e("agent.deleteConfirm",{title:y.title}))||kt(h).then($).catch(T)},le=h=>{if(!f)return;const y=Pe({...ee,...h});p(S=>({...S,sessions:S.sessions.map(_=>_.id===f?{..._,generationSettings:y,webSearchEnabled:y.webSearchEnabled}:_)})),ce(f,{generationSettings:h}).then($).catch(T)},vt=h=>{le({webSearchEnabled:h})},te=h=>{if(!f||u.currentImageId===h)return;const y=f;p(S=>({...S,currentImageId:h})),ce(y,{currentImageId:h}).then($).catch(T)},Me=h=>{L({id:Date.now(),text:h})},be=h=>{At(h).then($).catch(T)},oe=h=>{Lt(h).then($).catch(T)},Ee=k?.status==="error"?K.find(h=>h.status==="failed")?.id:void 0,St=Ee?()=>oe(Ee):void 0,_t=h=>{!f||h.length===0||$n({sessionId:f,files:h,importLocalImageToHistory:s,applyWorkspace:$}).catch(T)},wt=h=>{if(!f)return;const y=f,S=Date.now(),_=Dn(h,S),P=Bn(e("agent.pending"),S+1),N=new Set([_.id]);ut(),p(I=>Fn(I,y,[_,P])),It(y,h,ee).then(I=>ct(I.workspace,N)).catch(I=>{const qe=W(I);p(je=>Gn(je,y,P.id,qe)),T(I)}).finally(dt)};return me?t.jsxs("main",{className:`agent-workspace agent-workspace--${n} agent-workspace--boot-error`,"data-layout":n,"aria-label":e("agent.workspace"),children:[Ae?t.jsx(Ke,{layoutMode:n,session:null,currentImage:null,activeJobCount:0,onOpenSessions:()=>{},onOpenImage:()=>{},onOpenQueue:()=>{}}):null,t.jsxs("section",{className:"agent-workspace__boot-error",role:"alert",children:[t.jsx("strong",{children:e("agent.bootFailed")}),t.jsx("span",{title:me,children:me}),t.jsx("button",{type:"button",onClick:()=>{se().catch(h=>pe(W(h)))},children:e("agent.bootRetry")})]})]}):t.jsxs("main",{className:`agent-workspace agent-workspace--${n}${xe&&j?" agent-workspace--tools-docked":""}`,"data-layout":n,"aria-label":e("agent.workspace"),children:[bt?t.jsx("div",{className:"agent-session-rail-wrap",children:t.jsx(qn,{sessions:u.sessions,selectedId:f??"",imagesById:u.imagesById,runSummaryBySession:u.runSummaryBySession,onCreate:Te,onSelect:Le,onOpenDrawer:()=>A(!0)})}):null,Ae?t.jsx(Ke,{layoutMode:n,session:Y,currentImage:Z,activeJobCount:mt,onOpenSessions:()=>A(!0),onOpenImage:()=>H(!0),onOpenQueue:()=>J(!0)}):null,t.jsxs("div",{className:"agent-workspace__body",children:[t.jsx(pn,{session:Y,turns:ht,imagesById:u.imagesById,currentImageId:u.currentImageId,runtimeStatus:ft,runProgress:pt,settings:ee,insertedPrompt:U,onSettingsChange:le,onOpenModelTab:()=>{G("model"),M(!0)},onWebSearchChange:vt,onAttachFiles:_t,onImageSelect:te,onSend:wt,onRetryRun:St}),xe?t.jsx(Rn,{currentImage:Z,images:re,onImageSelect:te,onOpenPanel:it,toolsPanelOpen:j}):xt?t.jsx(We,{currentImage:Z,images:re,contextTab:v,sidebarTab:q,queueItems:K,runSummary:k,settings:ee,onContextTabChange:w,onSidebarTabChange:G,onImageSelect:te,onSettingsChange:le,onInsertPrompt:Me,onCancelQueue:be,onRetryQueue:oe}):null,xe&&j?t.jsx(We,{overlay:!0,onClose:ot,currentImage:Z,images:re,contextTab:v,sidebarTab:q,queueItems:K,runSummary:k,settings:ee,onContextTabChange:w,onSidebarTabChange:G,onImageSelect:te,onSettingsChange:le,onInsertPrompt:Me,onCancelQueue:be,onRetryQueue:oe}):null]}),t.jsx(En,{open:z,sessions:u.sessions,selectedId:f??"",imagesById:u.imagesById,runSummaryBySession:u.runSummaryBySession,onClose:()=>A(!1),onCreate:Te,onSelect:Le,onRename:jt,onDelete:yt}),t.jsx(yn,{open:he,currentImage:Z,images:re,activeTab:v,onTabChange:w,onImageSelect:te,onClose:()=>H(!1)}),t.jsx(Cn,{open:V,items:K,summary:k,onCancel:be,onRetry:oe,onClose:()=>J(!1)})]})}export{Jn as AgentWorkspace};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SpriteRecipeWorkspace-
|
|
2
|
-
import{u as G,b as n,a as p,ae as U,j as e,af as Q,ac as Z,p as J,ag as X,ah as Y,ad as ee,ai as se}from"./index-DueH_AmZ.js";import{K as te,A as ae}from"./KeyingPanel-DT8zsqpi.js";const ne=48;function le({selectedAssetId:t,onPreview:g,onAssetsLoaded:c}){const{t:r}=G(),l=n(d=>d.selectedProjectId),i=n(d=>d.assetGenItems.length),[m,h]=p.useState([]),[v,u]=p.useState(!1);return p.useEffect(()=>{let d=!1;return U({kind:null,folderId:l,tag:null,q:"",limit:ne}).then(b=>{if(d)return;const o=b.assets.filter(j=>j.filePath&&(j.kind==="image"||j.kind==="video"));h(o),c?.(o.length),u(!1)}).catch(()=>{d||u(!0)}),()=>{d=!0}},[l,i]),e.jsxs("aside",{className:"assetgen-rail","aria-label":r("assetGen.railTitle"),children:[e.jsx("h2",{className:"assetgen-rail__title",children:r("assetGen.railTitle")}),v?e.jsx("p",{className:"assetgen-rail__empty",children:r("assetGen.railError")}):m.length===0?e.jsx("p",{className:"assetgen-rail__empty",children:r("assetGen.railEmpty")}):e.jsx("div",{className:"assetgen-rail__list",role:"listbox","aria-label":r("assetGen.railTitle"),children:(()=>{const d=new Map;for(const o of m)d.set(o.name,(d.get(o.name)??0)+1);const b=new Map;return m.map(o=>{const j=o.filePath?Q(o.filePath):null;if(!j)return null;const a=t===o.id,k=d.get(o.name)??1,x=(b.get(o.name)??0)+1;b.set(o.name,x);const f=k>1?`#${x} ${o.name}`:o.name;return e.jsxs("button",{type:"button",role:"option","aria-selected":a,className:`assetgen-rail__tile${a?" is-selected":""}`,title:f,onClick:()=>g(Z(o),o.id),children:[o.kind==="video"?e.jsx("video",{src:j,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}):e.jsx("img",{src:j,alt:"",loading:"lazy",decoding:"async"}),e.jsx("span",{className:"assetgen-rail__name",children:f})]},o.id)})})()})]})}const re=[{value:"chroma-green",swatch:"#00c853",labelKey:"assetGen.bgChroma"},{value:"white",swatch:"#ffffff",labelKey:"assetGen.bgWhite"},{value:"black",swatch:"#111111",labelKey:"assetGen.bgBlack"},{value:"transparent",swatch:null,labelKey:"assetGen.bgTransparent"}];function ie(){const{t}=G(),g=n(i=>i.assetGenBackground),c=n(i=>i.setAssetGenBackground),r=n(i=>i.assetGenProvider),l=r!=="grok"&&r!=="grok-api";return e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-bg-label",children:t("assetGen.background")}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-labelledby":"assetgen-bg-label",children:re.map(i=>{const m=i.value==="transparent"&&!l;return e.jsxs("button",{type:"button",className:g===i.value?"is-active":"","aria-pressed":g===i.value,disabled:m,...m?{title:t("assetGen.bgTransparentGptOnly")}:{},onClick:()=>c(i.value),children:[e.jsx("span",{className:i.swatch===null?"assetgen-bg-picker__swatch assetgen-bg-picker__swatch--alpha":"assetgen-bg-picker__swatch",...i.swatch===null?{}:{style:{background:i.swatch}},"aria-hidden":"true"}),t(i.labelKey)]},i.value)})}),e.jsx("p",{className:"assetgen-field__hint",children:t(l?g==="transparent"?"assetGen.backgroundHintTransparent":"assetGen.backgroundHint":"assetGen.bgTransparentGptOnly")})]})}const oe=[{value:"oauth",labelKey:"assetGen.modelGpt"},{value:"grok",labelKey:"assetGen.modelGrok"}];function ce(){const{t}=G(),g=n(l=>l.assetGenProvider),c=n(l=>l.setAssetGenProvider),r=g==="grok"||g==="grok-api"?"grok":"oauth";return e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-model-label",children:t("assetGen.model")}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-labelledby":"assetgen-model-label",children:oe.map(l=>e.jsx("button",{type:"button",className:r===l.value?"is-active":"","aria-pressed":r===l.value,onClick:()=>c(l.value),children:t(l.labelKey)},l.value))})]})}function de({onClose:t,onSelect:g}){const{t:c}=G(),r=n(u=>u.assetsFolders),[l,i]=p.useState(""),m=p.useRef(null),h=J(!0,t),v=p.useMemo(()=>{const u=r.filter(b=>b.parentId===null),d=l.trim().toLowerCase();return d?u.filter(b=>b.name.toLowerCase().includes(d)):u},[r,l]);return e.jsx("div",{className:"assetgen-popup-backdrop",onClick:t,children:e.jsxs("div",{ref:h,className:"assetgen-popup",role:"dialog","aria-modal":"true","aria-label":c("project.search"),onClick:u=>u.stopPropagation(),children:[e.jsx("input",{ref:m,type:"search",value:l,placeholder:c("project.searchPlaceholder"),"aria-label":c("project.search"),onChange:u=>i(u.target.value)}),e.jsxs("ul",{role:"listbox","aria-label":c("project.select"),children:[e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{g(null),t()},children:c("project.unassigned")})}),v.map(u=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{g(u.id),t()},children:u.name})},u.id)),v.length===0&&l.trim()?e.jsx("li",{className:"assetgen-popup__empty",children:c("project.searchEmpty")}):null]}),e.jsx("button",{type:"button",className:"assetgen-popup__close",onClick:t,children:c("project.close")})]})})}function ue(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})})}function pe(){const{t}=G(),g=n(a=>a.assetsFolders),c=n(a=>a.selectedProjectId),r=n(a=>a.setSelectedProject),l=n(a=>a.loadAssetFolders),i=n(a=>a.createAssetFolder),[m,h]=p.useState(!1),[v,u]=p.useState(!1),d=p.useRef(null);p.useEffect(()=>{l()},[l]),p.useEffect(()=>{c&&g.length>0&&!g.some(a=>a.id===c)&&r(null)},[g,c,r]),p.useEffect(()=>{if(!m)return;const a=x=>{d.current&&!d.current.contains(x.target)&&h(!1)},k=x=>{x.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",a),window.addEventListener("keydown",k),()=>{window.removeEventListener("mousedown",a),window.removeEventListener("keydown",k)}},[m]);const b=g.filter(a=>a.parentId===null),o=b.find(a=>a.id===c),j=async()=>{const a=window.prompt(t("project.newPrompt"));if(!a||!a.trim())return;if(await i(a.trim(),null)){await l();const x=n.getState().assetsFolders.find(f=>f.parentId===null&&f.name===a.trim());x&&r(x.id)}h(!1)};return e.jsxs("div",{className:"assetgen-field assetgen-project",ref:d,children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-project-label",children:t("project.select")}),e.jsxs("button",{type:"button",className:"assetgen-project__trigger","aria-haspopup":"listbox","aria-expanded":m,"aria-labelledby":"assetgen-project-label",onClick:()=>h(a=>!a),children:[e.jsx(ue,{}),o?o.name:t("project.unassigned"),e.jsx("span",{className:"assetgen-project__caret","aria-hidden":"true",children:"▾"})]}),m?e.jsxs("ul",{className:"assetgen-project__menu",role:"listbox","aria-labelledby":"assetgen-project-label",children:[e.jsx("li",{children:e.jsx("button",{type:"button","aria-selected":c===null,onClick:()=>{r(null),h(!1)},children:t("project.unassigned")})}),b.map(a=>e.jsx("li",{children:e.jsx("button",{type:"button","aria-selected":c===a.id,onClick:()=>{r(a.id),h(!1)},children:a.name})},a.id)),e.jsx("li",{className:"assetgen-project__menu-divider","aria-hidden":"true"}),e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{j()},children:t("project.new")})}),e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{h(!1),u(!0)},children:t("project.search")})})]}):null,v?e.jsx(de,{onClose:()=>u(!1),onSelect:a=>r(a)}):null]})}const ge=p.lazy(()=>se(()=>import("./SpriteRecipeWorkspace-DZjsabce.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.SpriteRecipeWorkspace})));function me(){const{t}=G(),g=n(s=>s.assetGenPrompt),c=n(s=>s.setAssetGenPrompt),r=n(s=>s.assetGenKind),l=n(s=>s.setAssetGenKind),i=n(s=>s.assetGenProvider),m=n(s=>s.assetGenVideoDuration),h=n(s=>s.setAssetGenVideoDuration),v=n(s=>s.assetGenVideoResolution),u=n(s=>s.setAssetGenVideoResolution),d=n(s=>s.assetGenVideoAspect),b=n(s=>s.setAssetGenVideoAspect),o=n(s=>s.activeGenerations),j=n(s=>s.assetGenItems),a=n(s=>s.generateAssetGen),k=n(s=>s.assetGenSaveFailures),x=n(s=>s.retryAssetGenSave),f=n(s=>s.setKeyingTarget),F=n(s=>s.setVectorizeTarget),A=n(s=>s.assetGenLastError),V=n(s=>s.setAssetGenLastError),I=n(s=>s.setUIMode),_=n(s=>s.assetGenWorkflow),S=n(s=>s.setAssetGenWorkflow),M=X(),[T,C]=p.useState(null),[O,E]=p.useState(null),[D,W]=p.useState(0),z=p.useCallback(()=>{C(null),E(null)},[]),B=p.useCallback((s,y)=>{E(y),C(s)},[]),H=p.useCallback(()=>{document.getElementById("assetgen-prompt")?.focus()},[]),P=i==="grok"||i==="grok-api",N=r==="video"&&!P?"image":r,K=g.trim().length>0,L=e.jsxs("div",{className:"assetgen-workflow-tabs",role:"tablist","aria-label":t("sprite.tabs.label"),onKeyDown:M,children:[e.jsx("button",{type:"button",role:"tab","aria-selected":_==="generate",tabIndex:_==="generate"?0:-1,onClick:()=>S("generate"),children:t("sprite.tabs.generate")}),e.jsx("button",{type:"button",role:"tab","aria-selected":_==="sprite",tabIndex:_==="sprite"?0:-1,onClick:()=>S("sprite"),children:t("sprite.tabs.sprite")})]});return _==="sprite"?e.jsxs("section",{className:"assetgen-workspace","aria-labelledby":"assetgen-title",children:[e.jsxs("aside",{className:"assetgen-form",children:[e.jsx("h1",{id:"assetgen-title",children:t("sprite.title")}),e.jsx("p",{className:"assetgen-form__lede",children:t("sprite.lede")}),L]}),e.jsx("main",{className:"assetgen-results",children:e.jsx(p.Suspense,{fallback:e.jsx("p",{role:"status",children:t("sprite.loading")}),children:e.jsx(ge,{})})})]}):e.jsxs("section",{className:"assetgen-workspace","aria-labelledby":"assetgen-title",children:[e.jsxs("aside",{className:"assetgen-form",children:[e.jsx("h1",{id:"assetgen-title",children:t("assetGen.title")}),e.jsx("p",{className:"assetgen-form__lede",children:t("assetGen.lede")}),L,e.jsx(pe,{}),e.jsxs("div",{className:"assetgen-field",children:[e.jsx("label",{className:"assetgen-field__label",htmlFor:"assetgen-prompt",children:t("assetGen.prompt")}),e.jsx("textarea",{id:"assetgen-prompt",value:g,rows:4,placeholder:t("assetGen.promptPlaceholder"),onChange:s=>c(s.target.value)})]}),e.jsx(ie,{}),e.jsx(ce,{}),e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-kind-label",children:t("assetGen.kind")}),e.jsxs("div",{className:"assetgen-bg-picker",role:"group","aria-labelledby":"assetgen-kind-label",children:[e.jsx("button",{type:"button",className:N==="image"?"is-active":"","aria-pressed":N==="image",onClick:()=>l("image"),children:t("assetGen.kindImage")}),e.jsx("button",{type:"button",className:N==="video"?"is-active":"","aria-pressed":N==="video",disabled:!P,title:P?void 0:t("assetGen.videoGrokOnly"),onClick:()=>l("video"),children:t("assetGen.kindVideo")})]}),P?null:e.jsx("p",{className:"assetgen-field__hint",children:t("assetGen.videoGrokOnly")})]}),N==="video"?e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-video-label",children:t("assetGen.videoOptions")}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-label":t("assetGen.videoDuration"),children:[3,5,8].map(s=>e.jsxs("button",{type:"button",className:m===s?"is-active":"","aria-pressed":m===s,onClick:()=>h(s),children:[s,"s"]},s))}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-label":t("assetGen.videoResolution"),children:["480p","720p"].map(s=>e.jsx("button",{type:"button",className:v===s?"is-active":"","aria-pressed":v===s,onClick:()=>u(s),children:s},s))}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-label":t("assetGen.videoAspect"),children:["1:1","16:9","9:16"].map(s=>e.jsx("button",{type:"button",className:d===s?"is-active":"","aria-pressed":d===s,onClick:()=>b(s),children:s},s))})]}):null,e.jsx("button",{type:"button",className:"assetgen-generate",disabled:!K,onClick:()=>{a()},children:o>0?t("assetGen.generating"):t("assetGen.generate")}),K?null:e.jsx("p",{className:"assetgen-generate__hint",children:t("assetGen.generateHint")}),e.jsx(Y,{})]}),e.jsxs("main",{className:"assetgen-results",children:[e.jsxs("div",{className:"assetgen-results__main",children:[A?e.jsxs("div",{className:"assetgen-error",role:"alert",children:[e.jsxs("div",{className:"assetgen-error__text",children:[e.jsx("strong",{children:t("assetGen.errorTitle")}),e.jsx("span",{children:A}),e.jsx("span",{className:"assetgen-error__hint",children:t("assetGen.errorHint")})]}),e.jsx("button",{type:"button",className:"assetgen-error__dismiss",onClick:()=>V(null),children:t("assetGen.errorDismiss")})]}):null,j.length===0?e.jsx("div",{className:"assetgen-empty",children:D>0?e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t("assetGen.emptySessionTitle")}),e.jsx("p",{children:t("assetGen.emptySessionBody")}),e.jsx("button",{type:"button",className:"assetgen-empty__cta",onClick:()=>I("assets"),children:t("assetGen.emptySessionCta")})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t("assetGen.emptyTitle")}),e.jsx("p",{children:t("assetGen.emptyBody")}),e.jsx("button",{type:"button",className:"assetgen-empty__cta",onClick:H,children:t("assetGen.emptyCta")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"assetgen-saved-hint",children:[t("assetGen.savedHint")," ",e.jsx("button",{type:"button",className:"assetgen-saved-hint__link",onClick:()=>I("assets"),children:t("assetGen.savedLink")})]}),e.jsx("div",{className:"assetgen-grid",children:j.map(s=>{const y=s.kind==="edit",R=s.backgroundPreset==="transparent",w=s.mediaType==="video",$=t(w?"assetGen.videoFallback":"assetGen.imageFallback"),q=t(w?"assetGen.previewVideo":"assetGen.previewImage",{prompt:s.prompt?.trim()||$});return e.jsxs("figure",{className:`assetgen-tile${y?" is-keyed":""}${R?" is-alpha":""}`,children:[y?e.jsx("span",{className:"assetgen-tile__badge",children:t("keying.resultBadge")}):null,e.jsxs("button",{type:"button",className:"assetgen-tile__media","aria-label":q,onClick:()=>C(s),children:[w?e.jsx("video",{src:s.url||s.image,poster:s.thumb||void 0,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}):e.jsx("img",{src:s.url||s.image,alt:"",loading:"lazy"}),e.jsx("span",{className:"assetgen-tile__open-hint","aria-hidden":"true",children:t(w?"assetGen.openHintVideo":"assetGen.openHintImage")})]}),e.jsx("figcaption",{title:s.prompt,children:s.prompt}),!y&&!R?e.jsx("button",{type:"button",className:"assetgen-tile__key",onClick:()=>f(s),children:t("keying.open")}):null,w?null:e.jsx("button",{type:"button",className:"assetgen-tile__key",onClick:()=>F(s),children:t("vectorize.open")}),!y&&s.requestId&&k.includes(s.requestId)?e.jsx("button",{type:"button",className:"assetgen-tile__retry",onClick:()=>{x(s.requestId)},children:t("project.saveRetry")}):null]},`${s.requestId}-${s.filename??s.createdAt}`)})})]})]}),e.jsx(le,{selectedAssetId:O,onPreview:B,onAssetsLoaded:W})]}),e.jsx(te,{}),e.jsx(ee,{}),T?e.jsx(ae,{item:T,onClose:z}):null]})}const xe=Object.freeze(Object.defineProperty({__proto__:null,AssetGenWorkspace:me},Symbol.toStringTag,{value:"Module"}));export{xe as A,pe as P};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SpriteRecipeWorkspace-ClIM5QRo.js","assets/index-BbykeXR9.js","assets/index-0fpfY8vu.css","assets/KeyingPanel-5bRUFQaq.js","assets/useAgentDialogFocus-B6-QgEVI.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as G,b as n,a as p,ae as U,j as e,af as Q,ac as Z,p as J,ag as X,ah as Y,ad as ee,ai as se}from"./index-BbykeXR9.js";import{K as te,A as ae}from"./KeyingPanel-5bRUFQaq.js";const ne=48;function le({selectedAssetId:t,onPreview:g,onAssetsLoaded:c}){const{t:r}=G(),l=n(d=>d.selectedProjectId),i=n(d=>d.assetGenItems.length),[m,h]=p.useState([]),[v,u]=p.useState(!1);return p.useEffect(()=>{let d=!1;return U({kind:null,folderId:l,tag:null,q:"",limit:ne}).then(b=>{if(d)return;const o=b.assets.filter(j=>j.filePath&&(j.kind==="image"||j.kind==="video"));h(o),c?.(o.length),u(!1)}).catch(()=>{d||u(!0)}),()=>{d=!0}},[l,i]),e.jsxs("aside",{className:"assetgen-rail","aria-label":r("assetGen.railTitle"),children:[e.jsx("h2",{className:"assetgen-rail__title",children:r("assetGen.railTitle")}),v?e.jsx("p",{className:"assetgen-rail__empty",children:r("assetGen.railError")}):m.length===0?e.jsx("p",{className:"assetgen-rail__empty",children:r("assetGen.railEmpty")}):e.jsx("div",{className:"assetgen-rail__list",role:"listbox","aria-label":r("assetGen.railTitle"),children:(()=>{const d=new Map;for(const o of m)d.set(o.name,(d.get(o.name)??0)+1);const b=new Map;return m.map(o=>{const j=o.filePath?Q(o.filePath):null;if(!j)return null;const a=t===o.id,k=d.get(o.name)??1,x=(b.get(o.name)??0)+1;b.set(o.name,x);const f=k>1?`#${x} ${o.name}`:o.name;return e.jsxs("button",{type:"button",role:"option","aria-selected":a,className:`assetgen-rail__tile${a?" is-selected":""}`,title:f,onClick:()=>g(Z(o),o.id),children:[o.kind==="video"?e.jsx("video",{src:j,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}):e.jsx("img",{src:j,alt:"",loading:"lazy",decoding:"async"}),e.jsx("span",{className:"assetgen-rail__name",children:f})]},o.id)})})()})]})}const re=[{value:"chroma-green",swatch:"#00c853",labelKey:"assetGen.bgChroma"},{value:"white",swatch:"#ffffff",labelKey:"assetGen.bgWhite"},{value:"black",swatch:"#111111",labelKey:"assetGen.bgBlack"},{value:"transparent",swatch:null,labelKey:"assetGen.bgTransparent"}];function ie(){const{t}=G(),g=n(i=>i.assetGenBackground),c=n(i=>i.setAssetGenBackground),r=n(i=>i.assetGenProvider),l=r!=="grok"&&r!=="grok-api";return e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-bg-label",children:t("assetGen.background")}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-labelledby":"assetgen-bg-label",children:re.map(i=>{const m=i.value==="transparent"&&!l;return e.jsxs("button",{type:"button",className:g===i.value?"is-active":"","aria-pressed":g===i.value,disabled:m,...m?{title:t("assetGen.bgTransparentGptOnly")}:{},onClick:()=>c(i.value),children:[e.jsx("span",{className:i.swatch===null?"assetgen-bg-picker__swatch assetgen-bg-picker__swatch--alpha":"assetgen-bg-picker__swatch",...i.swatch===null?{}:{style:{background:i.swatch}},"aria-hidden":"true"}),t(i.labelKey)]},i.value)})}),e.jsx("p",{className:"assetgen-field__hint",children:t(l?g==="transparent"?"assetGen.backgroundHintTransparent":"assetGen.backgroundHint":"assetGen.bgTransparentGptOnly")})]})}const oe=[{value:"oauth",labelKey:"assetGen.modelGpt"},{value:"grok",labelKey:"assetGen.modelGrok"}];function ce(){const{t}=G(),g=n(l=>l.assetGenProvider),c=n(l=>l.setAssetGenProvider),r=g==="grok"||g==="grok-api"?"grok":"oauth";return e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-model-label",children:t("assetGen.model")}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-labelledby":"assetgen-model-label",children:oe.map(l=>e.jsx("button",{type:"button",className:r===l.value?"is-active":"","aria-pressed":r===l.value,onClick:()=>c(l.value),children:t(l.labelKey)},l.value))})]})}function de({onClose:t,onSelect:g}){const{t:c}=G(),r=n(u=>u.assetsFolders),[l,i]=p.useState(""),m=p.useRef(null),h=J(!0,t),v=p.useMemo(()=>{const u=r.filter(b=>b.parentId===null),d=l.trim().toLowerCase();return d?u.filter(b=>b.name.toLowerCase().includes(d)):u},[r,l]);return e.jsx("div",{className:"assetgen-popup-backdrop",onClick:t,children:e.jsxs("div",{ref:h,className:"assetgen-popup",role:"dialog","aria-modal":"true","aria-label":c("project.search"),onClick:u=>u.stopPropagation(),children:[e.jsx("input",{ref:m,type:"search",value:l,placeholder:c("project.searchPlaceholder"),"aria-label":c("project.search"),onChange:u=>i(u.target.value)}),e.jsxs("ul",{role:"listbox","aria-label":c("project.select"),children:[e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{g(null),t()},children:c("project.unassigned")})}),v.map(u=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{g(u.id),t()},children:u.name})},u.id)),v.length===0&&l.trim()?e.jsx("li",{className:"assetgen-popup__empty",children:c("project.searchEmpty")}):null]}),e.jsx("button",{type:"button",className:"assetgen-popup__close",onClick:t,children:c("project.close")})]})})}function ue(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})})}function pe(){const{t}=G(),g=n(a=>a.assetsFolders),c=n(a=>a.selectedProjectId),r=n(a=>a.setSelectedProject),l=n(a=>a.loadAssetFolders),i=n(a=>a.createAssetFolder),[m,h]=p.useState(!1),[v,u]=p.useState(!1),d=p.useRef(null);p.useEffect(()=>{l()},[l]),p.useEffect(()=>{c&&g.length>0&&!g.some(a=>a.id===c)&&r(null)},[g,c,r]),p.useEffect(()=>{if(!m)return;const a=x=>{d.current&&!d.current.contains(x.target)&&h(!1)},k=x=>{x.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",a),window.addEventListener("keydown",k),()=>{window.removeEventListener("mousedown",a),window.removeEventListener("keydown",k)}},[m]);const b=g.filter(a=>a.parentId===null),o=b.find(a=>a.id===c),j=async()=>{const a=window.prompt(t("project.newPrompt"));if(!a||!a.trim())return;if(await i(a.trim(),null)){await l();const x=n.getState().assetsFolders.find(f=>f.parentId===null&&f.name===a.trim());x&&r(x.id)}h(!1)};return e.jsxs("div",{className:"assetgen-field assetgen-project",ref:d,children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-project-label",children:t("project.select")}),e.jsxs("button",{type:"button",className:"assetgen-project__trigger","aria-haspopup":"listbox","aria-expanded":m,"aria-labelledby":"assetgen-project-label",onClick:()=>h(a=>!a),children:[e.jsx(ue,{}),o?o.name:t("project.unassigned"),e.jsx("span",{className:"assetgen-project__caret","aria-hidden":"true",children:"▾"})]}),m?e.jsxs("ul",{className:"assetgen-project__menu",role:"listbox","aria-labelledby":"assetgen-project-label",children:[e.jsx("li",{children:e.jsx("button",{type:"button","aria-selected":c===null,onClick:()=>{r(null),h(!1)},children:t("project.unassigned")})}),b.map(a=>e.jsx("li",{children:e.jsx("button",{type:"button","aria-selected":c===a.id,onClick:()=>{r(a.id),h(!1)},children:a.name})},a.id)),e.jsx("li",{className:"assetgen-project__menu-divider","aria-hidden":"true"}),e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{j()},children:t("project.new")})}),e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{h(!1),u(!0)},children:t("project.search")})})]}):null,v?e.jsx(de,{onClose:()=>u(!1),onSelect:a=>r(a)}):null]})}const ge=p.lazy(()=>se(()=>import("./SpriteRecipeWorkspace-ClIM5QRo.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.SpriteRecipeWorkspace})));function me(){const{t}=G(),g=n(s=>s.assetGenPrompt),c=n(s=>s.setAssetGenPrompt),r=n(s=>s.assetGenKind),l=n(s=>s.setAssetGenKind),i=n(s=>s.assetGenProvider),m=n(s=>s.assetGenVideoDuration),h=n(s=>s.setAssetGenVideoDuration),v=n(s=>s.assetGenVideoResolution),u=n(s=>s.setAssetGenVideoResolution),d=n(s=>s.assetGenVideoAspect),b=n(s=>s.setAssetGenVideoAspect),o=n(s=>s.activeGenerations),j=n(s=>s.assetGenItems),a=n(s=>s.generateAssetGen),k=n(s=>s.assetGenSaveFailures),x=n(s=>s.retryAssetGenSave),f=n(s=>s.setKeyingTarget),F=n(s=>s.setVectorizeTarget),A=n(s=>s.assetGenLastError),V=n(s=>s.setAssetGenLastError),I=n(s=>s.setUIMode),_=n(s=>s.assetGenWorkflow),S=n(s=>s.setAssetGenWorkflow),M=X(),[T,C]=p.useState(null),[O,E]=p.useState(null),[D,W]=p.useState(0),z=p.useCallback(()=>{C(null),E(null)},[]),B=p.useCallback((s,y)=>{E(y),C(s)},[]),H=p.useCallback(()=>{document.getElementById("assetgen-prompt")?.focus()},[]),P=i==="grok"||i==="grok-api",N=r==="video"&&!P?"image":r,K=g.trim().length>0,L=e.jsxs("div",{className:"assetgen-workflow-tabs",role:"tablist","aria-label":t("sprite.tabs.label"),onKeyDown:M,children:[e.jsx("button",{type:"button",role:"tab","aria-selected":_==="generate",tabIndex:_==="generate"?0:-1,onClick:()=>S("generate"),children:t("sprite.tabs.generate")}),e.jsx("button",{type:"button",role:"tab","aria-selected":_==="sprite",tabIndex:_==="sprite"?0:-1,onClick:()=>S("sprite"),children:t("sprite.tabs.sprite")})]});return _==="sprite"?e.jsxs("section",{className:"assetgen-workspace","aria-labelledby":"assetgen-title",children:[e.jsxs("aside",{className:"assetgen-form",children:[e.jsx("h1",{id:"assetgen-title",children:t("sprite.title")}),e.jsx("p",{className:"assetgen-form__lede",children:t("sprite.lede")}),L]}),e.jsx("main",{className:"assetgen-results",children:e.jsx(p.Suspense,{fallback:e.jsx("p",{role:"status",children:t("sprite.loading")}),children:e.jsx(ge,{})})})]}):e.jsxs("section",{className:"assetgen-workspace","aria-labelledby":"assetgen-title",children:[e.jsxs("aside",{className:"assetgen-form",children:[e.jsx("h1",{id:"assetgen-title",children:t("assetGen.title")}),e.jsx("p",{className:"assetgen-form__lede",children:t("assetGen.lede")}),L,e.jsx(pe,{}),e.jsxs("div",{className:"assetgen-field",children:[e.jsx("label",{className:"assetgen-field__label",htmlFor:"assetgen-prompt",children:t("assetGen.prompt")}),e.jsx("textarea",{id:"assetgen-prompt",value:g,rows:4,placeholder:t("assetGen.promptPlaceholder"),onChange:s=>c(s.target.value)})]}),e.jsx(ie,{}),e.jsx(ce,{}),e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-kind-label",children:t("assetGen.kind")}),e.jsxs("div",{className:"assetgen-bg-picker",role:"group","aria-labelledby":"assetgen-kind-label",children:[e.jsx("button",{type:"button",className:N==="image"?"is-active":"","aria-pressed":N==="image",onClick:()=>l("image"),children:t("assetGen.kindImage")}),e.jsx("button",{type:"button",className:N==="video"?"is-active":"","aria-pressed":N==="video",disabled:!P,title:P?void 0:t("assetGen.videoGrokOnly"),onClick:()=>l("video"),children:t("assetGen.kindVideo")})]}),P?null:e.jsx("p",{className:"assetgen-field__hint",children:t("assetGen.videoGrokOnly")})]}),N==="video"?e.jsxs("div",{className:"assetgen-field",children:[e.jsx("span",{className:"assetgen-field__label",id:"assetgen-video-label",children:t("assetGen.videoOptions")}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-label":t("assetGen.videoDuration"),children:[3,5,8].map(s=>e.jsxs("button",{type:"button",className:m===s?"is-active":"","aria-pressed":m===s,onClick:()=>h(s),children:[s,"s"]},s))}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-label":t("assetGen.videoResolution"),children:["480p","720p"].map(s=>e.jsx("button",{type:"button",className:v===s?"is-active":"","aria-pressed":v===s,onClick:()=>u(s),children:s},s))}),e.jsx("div",{className:"assetgen-bg-picker",role:"group","aria-label":t("assetGen.videoAspect"),children:["1:1","16:9","9:16"].map(s=>e.jsx("button",{type:"button",className:d===s?"is-active":"","aria-pressed":d===s,onClick:()=>b(s),children:s},s))})]}):null,e.jsx("button",{type:"button",className:"assetgen-generate",disabled:!K,onClick:()=>{a()},children:o>0?t("assetGen.generating"):t("assetGen.generate")}),K?null:e.jsx("p",{className:"assetgen-generate__hint",children:t("assetGen.generateHint")}),e.jsx(Y,{})]}),e.jsxs("main",{className:"assetgen-results",children:[e.jsxs("div",{className:"assetgen-results__main",children:[A?e.jsxs("div",{className:"assetgen-error",role:"alert",children:[e.jsxs("div",{className:"assetgen-error__text",children:[e.jsx("strong",{children:t("assetGen.errorTitle")}),e.jsx("span",{children:A}),e.jsx("span",{className:"assetgen-error__hint",children:t("assetGen.errorHint")})]}),e.jsx("button",{type:"button",className:"assetgen-error__dismiss",onClick:()=>V(null),children:t("assetGen.errorDismiss")})]}):null,j.length===0?e.jsx("div",{className:"assetgen-empty",children:D>0?e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t("assetGen.emptySessionTitle")}),e.jsx("p",{children:t("assetGen.emptySessionBody")}),e.jsx("button",{type:"button",className:"assetgen-empty__cta",onClick:()=>I("assets"),children:t("assetGen.emptySessionCta")})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:t("assetGen.emptyTitle")}),e.jsx("p",{children:t("assetGen.emptyBody")}),e.jsx("button",{type:"button",className:"assetgen-empty__cta",onClick:H,children:t("assetGen.emptyCta")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"assetgen-saved-hint",children:[t("assetGen.savedHint")," ",e.jsx("button",{type:"button",className:"assetgen-saved-hint__link",onClick:()=>I("assets"),children:t("assetGen.savedLink")})]}),e.jsx("div",{className:"assetgen-grid",children:j.map(s=>{const y=s.kind==="edit",R=s.backgroundPreset==="transparent",w=s.mediaType==="video",$=t(w?"assetGen.videoFallback":"assetGen.imageFallback"),q=t(w?"assetGen.previewVideo":"assetGen.previewImage",{prompt:s.prompt?.trim()||$});return e.jsxs("figure",{className:`assetgen-tile${y?" is-keyed":""}${R?" is-alpha":""}`,children:[y?e.jsx("span",{className:"assetgen-tile__badge",children:t("keying.resultBadge")}):null,e.jsxs("button",{type:"button",className:"assetgen-tile__media","aria-label":q,onClick:()=>C(s),children:[w?e.jsx("video",{src:s.url||s.image,poster:s.thumb||void 0,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}):e.jsx("img",{src:s.url||s.image,alt:"",loading:"lazy"}),e.jsx("span",{className:"assetgen-tile__open-hint","aria-hidden":"true",children:t(w?"assetGen.openHintVideo":"assetGen.openHintImage")})]}),e.jsx("figcaption",{title:s.prompt,children:s.prompt}),!y&&!R?e.jsx("button",{type:"button",className:"assetgen-tile__key",onClick:()=>f(s),children:t("keying.open")}):null,w?null:e.jsx("button",{type:"button",className:"assetgen-tile__key",onClick:()=>F(s),children:t("vectorize.open")}),!y&&s.requestId&&k.includes(s.requestId)?e.jsx("button",{type:"button",className:"assetgen-tile__retry",onClick:()=>{x(s.requestId)},children:t("project.saveRetry")}):null]},`${s.requestId}-${s.filename??s.createdAt}`)})})]})]}),e.jsx(le,{selectedAssetId:O,onPreview:B,onAssetsLoaded:W})]}),e.jsx(te,{}),e.jsx(ee,{}),T?e.jsx(ae,{item:T,onClose:z}):null]})}const xe=Object.freeze(Object.defineProperty({__proto__:null,AssetGenWorkspace:me},Symbol.toStringTag,{value:"Module"}));export{xe as A,pe as P};
|