ima2-gen 3.12.1 → 3.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/docs/migration/runtime-test-inventory.md +9 -1
  2. package/package.json +5 -4
  3. package/ui/dist/.vite/manifest.json +37 -37
  4. package/ui/dist/assets/AgentWorkspace-CW1x4uOl.js +3 -0
  5. package/ui/dist/assets/AssetGenWorkspace-B7tTK0Sx.css +1 -0
  6. package/ui/dist/assets/AssetGenWorkspace-BQkdilsH.js +2 -0
  7. package/ui/dist/assets/AssetsWorkspace-BdptASFf.css +1 -0
  8. package/ui/dist/assets/AssetsWorkspace-CYSkmYU-.js +1 -0
  9. package/ui/dist/assets/{CardNewsWorkspace-DGOw6UH_.js → CardNewsWorkspace-nBKX5TXr.js} +2 -2
  10. package/ui/dist/assets/GenerationRequestLogPanel-CWqbfNis.js +1 -0
  11. package/ui/dist/assets/{HomeWorkspace-CuJY4Jr6.js → HomeWorkspace-CxqIGhb9.js} +1 -1
  12. package/ui/dist/assets/KeyingPanel-CtGvO6-u.js +1 -0
  13. package/ui/dist/assets/NodeCanvas-m41ECrFJ.js +7 -0
  14. package/ui/dist/assets/{PromptBuilderPanel-Dt4gO_Rb.js → PromptBuilderPanel-ChOoMAVA.js} +1 -1
  15. package/ui/dist/assets/PromptImportDialog-8hDG8MeK.js +2 -0
  16. package/ui/dist/assets/{PromptImportDiscoverySection-Bmyt_NVl.js → PromptImportDiscoverySection-D2_TAuLm.js} +1 -1
  17. package/ui/dist/assets/{PromptImportFolderSection-DGqoTx-h.js → PromptImportFolderSection-qv0qhTwq.js} +1 -1
  18. package/ui/dist/assets/PromptLibraryPanel-BPOD61FZ.js +2 -0
  19. package/ui/dist/assets/SettingsWorkspace-BKgXN2l9.js +1 -0
  20. package/ui/dist/assets/SpriteRecipeWorkspace-D8gHgnt8.js +1 -0
  21. package/ui/dist/assets/index-Bzt4YWub.js +5 -0
  22. package/ui/dist/assets/index-DB9EfKr6.css +1 -0
  23. package/ui/dist/assets/index-DTEhasVd.js +30 -0
  24. package/ui/dist/assets/{pptxgen.es-Cza43xx3.js → pptxgen.es-BEVsR2-i.js} +1 -1
  25. package/ui/dist/assets/useAgentDialogFocus-Dyj_bA5Q.js +1 -0
  26. package/ui/dist/index.html +2 -2
  27. package/ui/dist/assets/AgentWorkspace-CKAWZD7U.js +0 -3
  28. package/ui/dist/assets/AssetGenWorkspace-Dkr80l12.css +0 -1
  29. package/ui/dist/assets/AssetGenWorkspace-wsNksO-Q.js +0 -2
  30. package/ui/dist/assets/AssetsWorkspace-Bgk5sj1a.js +0 -1
  31. package/ui/dist/assets/AssetsWorkspace-BkUjPPKU.css +0 -1
  32. package/ui/dist/assets/GenerationRequestLogPanel-BGatd8qE.js +0 -1
  33. package/ui/dist/assets/KeyingPanel-DYJN_oNF.js +0 -1
  34. package/ui/dist/assets/NodeCanvas-fil6cXN8.js +0 -7
  35. package/ui/dist/assets/PromptImportDialog-uyJdrdTs.js +0 -2
  36. package/ui/dist/assets/PromptLibraryPanel-BIi5_Rvq.js +0 -2
  37. package/ui/dist/assets/SettingsWorkspace-CVying69.js +0 -1
  38. package/ui/dist/assets/SpriteRecipeWorkspace-ztdiDwSf.js +0 -1
  39. package/ui/dist/assets/index-BPKt0DUF.css +0 -1
  40. package/ui/dist/assets/index-CumGbxai.js +0 -5
  41. package/ui/dist/assets/index-TU0_IXQH.js +0 -30
  42. package/ui/dist/assets/useAgentDialogFocus-D741d8_6.js +0 -1
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PromptImportDiscoverySection-Bmyt_NVl.js","assets/index-TU0_IXQH.js","assets/index-BPKt0DUF.css","assets/PromptImportFolderSection-DGqoTx-h.js"])))=>i.map(i=>d[i]);
2
- import{u as V,j as e,b as ce,a as o,aQ as K,aR as M,aS as pe,aT as de,aU as me,ag as J}from"./index-TU0_IXQH.js";function ue(i){const t=i.source;if(!t)return"";if(t.owner&&t.repo){const u=t.ref?`@${t.ref}`:"",s=t.path?`:${t.path}`:"";return`${t.owner}/${t.repo}${u}${s}`}return t.filename??t.sourceId??t.kind??""}function he(i,t){const u=i.tags.find(s=>s.toLowerCase().startsWith(t));return u?u.slice(t.length):null}function be(i){return i.tags.includes("attribution-required")||i.warnings?.some(t=>t.toLowerCase().includes("attribution"))===!0}function ge({candidate:i,selected:t,disabled:u=!1,onToggleSelected:s,onImportOne:g}){const{t:n}=V();if(!i)return e.jsx("aside",{className:"prompt-import-dialog__candidate-preview","aria-label":n("promptLibrary.previewPrompt"),children:e.jsx("div",{className:"prompt-import-dialog__empty",children:n("promptLibrary.importPreviewEmpty")})});const x=ue(i),v=he(i,"license:"),h=be(i);return e.jsxs("aside",{className:"prompt-import-dialog__candidate-preview","aria-label":n("promptLibrary.previewPrompt"),children:[e.jsxs("div",{className:"prompt-import-dialog__preview-header",children:[e.jsxs("div",{children:[e.jsx("span",{children:n("promptLibrary.previewPrompt")}),e.jsx("h4",{children:i.name})]}),e.jsx("button",{type:"button",onClick:()=>g(i),disabled:u,children:n("promptLibrary.importThisPrompt")})]}),e.jsxs("label",{className:"prompt-import-dialog__preview-select",children:[e.jsx("input",{type:"checkbox",checked:t,disabled:u,onChange:l=>s(i.id,l.target.checked)}),e.jsx("span",{children:n(t?"promptLibrary.selectedPrompt":"promptLibrary.selectPrompt")})]}),e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.promptText")}),e.jsx("p",{children:i.text})]}),i.tags.length>0?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.tags")}),e.jsx("div",{className:"prompt-import-dialog__preview-chips",children:i.tags.map(l=>e.jsx("em",{children:l},l))})]}):null,i.warnings?.length?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.compatibilityWarnings")}),e.jsx("div",{className:"prompt-import-dialog__preview-chips",children:i.warnings.map(l=>e.jsx("b",{children:l},l))})]}):null,x||v||h?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.sourceDetails")}),x?e.jsx("small",{children:x}):null,v?e.jsxs("small",{children:[n("promptLibrary.license"),": ",v]}):null,h?e.jsx("small",{children:n("promptLibrary.attributionRequired")}):null]}):null]})}function fe(i){const t=i.source;if(!t)return"";if(t.owner&&t.repo){const u=t.path?` · ${t.path}`:"";return`github · ${t.owner}/${t.repo}${u}`}return t.filename?t.filename:t.sourceId?t.sourceId:t.kind??""}function ye(i){const t=i.replace(/\s+/g," ").trim();return t.length>220?`${t.slice(0,220)}...`:t}function xe({candidates:i,selectedIds:t,activeCandidateId:u,busy:s=!1,onSelectCandidate:g,onToggleSelected:n,onSelectAll:x,onClearSelection:v,onImportOne:h}){const{t:l}=V();if(i.length===0)return e.jsx("section",{className:"prompt-import-dialog__results","aria-label":l("promptLibrary.searchResults"),children:e.jsx("div",{className:"prompt-import-dialog__empty",children:l("promptLibrary.importPreviewEmpty")})});const f=i.every(p=>t.has(p.id));return e.jsxs("section",{className:"prompt-import-dialog__results","aria-label":l("promptLibrary.searchResults"),children:[e.jsxs("header",{className:"prompt-import-dialog__results-header",children:[e.jsx("strong",{children:l("promptLibrary.searchResultsHeader",{count:i.length})}),e.jsxs("div",{className:"prompt-import-dialog__results-header-actions",children:[e.jsx("button",{type:"button",onClick:x,disabled:f,children:l("promptLibrary.selectAllCandidates")}),e.jsx("button",{type:"button",onClick:v,disabled:t.size===0,children:l("promptLibrary.clearCandidateSelection")})]})]}),i.map(p=>{const y=t.has(p.id),S=u===p.id,j=fe(p);return e.jsxs("article",{className:`prompt-import-dialog__result-card${S?" active":""}`,children:[e.jsxs("button",{type:"button",className:"prompt-import-dialog__result-main",onClick:()=>g(p),children:[e.jsx("strong",{children:p.name}),e.jsx("span",{children:ye(p.text)}),j?e.jsx("small",{children:j}):null]}),e.jsxs("div",{className:"prompt-import-dialog__result-meta",children:[p.warnings?.slice(0,2).map(b=>e.jsx("b",{className:"prompt-import-dialog__hint-chip",children:b},b)),p.tags.slice(0,4).map(b=>e.jsx("em",{children:b},b))]}),e.jsxs("div",{className:"prompt-import-dialog__result-actions",children:[e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:y,onChange:b=>n(p.id,b.target.checked)}),e.jsx("span",{children:l(y?"promptLibrary.selectedPrompt":"promptLibrary.selectPrompt")})]}),e.jsx("button",{type:"button",onClick:()=>g(p),children:l("promptLibrary.previewPrompt")}),e.jsx("button",{type:"button",onClick:()=>h(p),disabled:s,children:l("promptLibrary.importThisPrompt")})]})]},p.id)})]})}const ve=o.lazy(()=>J(()=>import("./PromptImportDiscoverySection-Bmyt_NVl.js"),__vite__mapDeps([0,1,2])).then(i=>({default:i.PromptImportDiscoverySection}))),je=o.lazy(()=>J(()=>import("./PromptImportFolderSection-DGqoTx-h.js"),__vite__mapDeps([3,1,2])).then(i=>({default:i.PromptImportFolderSection}))),_e=/\.(txt|md|markdown)$/i;function Se({open:i,onClose:t,onImported:u}){const{t:s}=V(),g=ce(r=>r.showToast),n=o.useRef(null),x=o.useRef(null),v=o.useRef(null),[h,l]=o.useState(""),[f,p]=o.useState([]),[y,S]=o.useState(new Set),[j,b]=o.useState(null),[_,L]=o.useState(!1),[W,m]=o.useState(null),[X,N]=o.useState(!1),[Y,A]=o.useState([]),[$,Z]=o.useState(""),[P,z]=o.useState(new Set),[O,E]=o.useState(!1),[q,I]=o.useState([]),[C,B]=o.useState("curated"),[G,ee]=o.useState(!1),H=f.length>0,D=!H||G;o.useEffect(()=>{if(i)return v.current=document.activeElement,window.setTimeout(()=>x.current?.focus(),0),()=>v.current?.focus()},[i]);const re=o.useCallback(async()=>{const r=await K();A(r.sources),z(new Set)},[]);o.useEffect(()=>{if(!i)return;let r=!1;return K().then(a=>{r||(A(a.sources),z(new Set))}).catch(()=>{r||A([])}),()=>{r=!0}},[i]);const w=o.useCallback(r=>{p(a=>{const c=new Set(a.map(k=>k.id)),d=[...a];for(const k of r)c.has(k.id)||d.push(k);return b(k=>k??d[0]?.id??null),d})},[]),R=o.useCallback(async r=>{const a=r.filter(c=>_e.test(c.name));if(a.length===0){m(s("promptLibrary.importNoValidFiles"));return}L(!0),m(null);try{const c=[];for(const d of a)c.push(await M({source:{kind:"local",filename:d.name,text:await d.text()}}));w(c.flatMap(d=>d.candidates))}catch(c){m(c instanceof Error?c.message:s("promptLibrary.importFailed"))}finally{L(!1)}},[w,s]),te=o.useCallback(async()=>{if(h.trim()){L(!0),m(null);try{const r=await M({source:{kind:"github",input:h.trim()}});w(r.candidates)}catch(r){m(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{L(!1)}}},[w,h,s]),se=o.useCallback(async()=>{E(!0),m(null),I([]);try{const r=await pe({q:$.trim(),sourceIds:[...P]});w(r.results),I(r.warnings),r.results.length===0&&m(s("promptLibrary.noCuratedResults"))}catch(r){m(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{E(!1)}},[w,$,P,s]),ie=o.useCallback(async r=>{E(!0),m(null),I([]);try{const a=await de({sourceId:r});I(a.warnings),g(s("promptLibrary.curatedRefreshed",{count:a.candidateCount}))}catch(a){m(a instanceof Error?a.message:s("promptLibrary.importFailed"))}finally{E(!1)}},[g,s]),Q=o.useCallback((r,a)=>{S(c=>{const d=new Set(c);return a?d.add(r):d.delete(r),d})},[]),oe=o.useCallback(()=>{S(new Set(f.map(r=>r.id)))},[f]),ae=o.useCallback(()=>{S(new Set)},[]),T=o.useCallback(async r=>{if(r.length===0){m(s("promptLibrary.importSelectAtLeastOne"));return}L(!0),m(null);try{const a=await me({candidates:r});await u(),g(s("promptLibrary.imported",{count:a.promptsImported})),t()}catch(a){m(a instanceof Error?a.message:s("promptLibrary.importFailed"))}finally{L(!1)}},[t,u,g,s]),le=o.useCallback(async()=>{const r=f.filter(a=>y.has(a.id));await T(r)},[f,T,y]),U=o.useCallback(r=>{S(new Set([r.id])),T([r])},[T]),ne=o.useCallback(r=>{const a=Array.from(r.target.files??[]);a.length>0&&R(a),r.target.value=""},[R]),F=o.useCallback(r=>{r.preventDefault(),r.stopPropagation(),N(!1);const a=Array.from(r.dataTransfer?.files??[]);a.length>0&&R(a)},[R]);return o.useEffect(()=>{if(!i)return;const r=c=>{c.preventDefault(),N(!0)},a=c=>{c.relatedTarget===null&&N(!1)};return window.addEventListener("dragover",r),window.addEventListener("dragleave",a),window.addEventListener("drop",F),()=>{window.removeEventListener("dragover",r),window.removeEventListener("dragleave",a),window.removeEventListener("drop",F)}},[F,i]),i?e.jsxs("div",{className:"prompt-import-dialog",role:"presentation",children:[e.jsx("div",{className:"prompt-import-dialog__backdrop",onClick:t}),e.jsxs("div",{ref:x,className:"prompt-import-dialog__panel",role:"dialog","aria-modal":"true","aria-labelledby":"prompt-import-title",tabIndex:-1,onKeyDown:r=>{r.key==="Escape"&&t()},children:[e.jsxs("div",{className:"prompt-import-dialog__header",children:[e.jsx("h3",{id:"prompt-import-title",children:s("promptLibrary.importTitle")}),e.jsx("button",{type:"button",onClick:t,"aria-label":s("common.close"),children:"×"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`prompt-import-dialog__dropzone${X?" active":""}`,onDragOver:r=>{r.preventDefault(),N(!0)},onDragLeave:()=>N(!1),onDrop:F,children:[e.jsx("strong",{children:s("promptLibrary.importDropTitle")}),e.jsx("span",{children:s("promptLibrary.importDropHint")}),e.jsx("button",{type:"button",onClick:()=>n.current?.click(),children:s("promptLibrary.importChooseFiles")}),e.jsx("input",{ref:n,className:"prompt-library-panel__file-input",type:"file",accept:".txt,.md,.markdown,text/plain,text/markdown",multiple:!0,onChange:ne})]}),e.jsxs("div",{className:"prompt-import-dialog__github",children:[e.jsx("label",{htmlFor:"prompt-import-github",children:s("promptLibrary.importGithubLabel")}),e.jsxs("div",{children:[e.jsx("input",{id:"prompt-import-github",type:"text",value:h,onChange:r=>l(r.target.value),placeholder:"owner/repo:path/to/prompts.md"}),e.jsx("button",{type:"button",onClick:()=>{te()},disabled:_||!h.trim(),children:s("promptLibrary.importPreview")})]})]}),e.jsx(o.Suspense,{fallback:null,children:e.jsx(je,{input:h,disabled:_,onCandidates:w,onError:m})}),e.jsxs("div",{className:"prompt-import-dialog__source-tabs",role:"tablist","aria-label":s("promptLibrary.curatedSources"),children:[e.jsx("button",{type:"button",className:C==="curated"?"active":"",onClick:()=>B("curated"),"aria-pressed":C==="curated",children:s("promptLibrary.curatedSources")}),e.jsx("button",{type:"button",className:C==="discovery"?"active":"",onClick:()=>B("discovery"),"aria-pressed":C==="discovery",children:s("promptLibrary.discovery")})]})]}),(D?C==="curated":!0)&&e.jsxs("div",{className:"prompt-import-dialog__curated",children:[D&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"prompt-import-dialog__section-title",children:[e.jsx("strong",{children:s("promptLibrary.curatedSources")}),e.jsx("span",{children:s("promptLibrary.curatedSourcesHint")})]}),e.jsx("div",{className:"prompt-import-dialog__source-list",children:Y.filter(r=>r.trustTier!=="manual-review").map(r=>e.jsxs("label",{className:"prompt-import-dialog__source",children:[e.jsx("input",{type:"checkbox",checked:P.has(r.id),onChange:a=>{z(c=>{const d=new Set(c);return a.target.checked?d.add(r.id):d.delete(r.id),d})}}),e.jsxs("span",{children:[e.jsx("strong",{children:r.displayName}),e.jsxs("small",{children:[r.licenseSpdx," · ",r.trustTier]})]}),e.jsx("button",{type:"button",onClick:()=>{ie(r.id)},disabled:O,children:s("promptLibrary.refreshSource")})]},r.id))})]}),e.jsxs("div",{className:"prompt-import-dialog__search-results",children:[e.jsx("input",{type:"text",value:$,onChange:r=>Z(r.target.value),placeholder:s("promptLibrary.curatedSearchPlaceholder"),"aria-label":s("promptLibrary.curatedSearch")}),e.jsx("button",{type:"button",onClick:()=>{se()},disabled:O||P.size===0,children:s(O?"common.loading":"promptLibrary.curatedSearch")})]}),q.length>0?e.jsx("div",{className:"prompt-import-dialog__warning",children:q.slice(0,3).join(" · ")}):null]}),D&&C==="discovery"&&e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"prompt-import-dialog__empty",children:s("common.loading")}),children:e.jsx(ve,{disabled:_,onError:m,onSourcesChanged:re})}),H&&!G&&e.jsx("button",{type:"button",className:"prompt-import-dialog__add-source-toggle",onClick:()=>ee(!0),children:s("promptLibrary.addAnotherSource")}),W?e.jsx("div",{className:"prompt-import-dialog__error",role:"alert",children:W}):null,e.jsxs("div",{className:"prompt-import-dialog__workspace","aria-live":"polite",children:[e.jsx(xe,{candidates:f,selectedIds:y,activeCandidateId:j,busy:_,onSelectCandidate:r=>b(r.id),onToggleSelected:Q,onSelectAll:oe,onClearSelection:ae,onImportOne:U}),e.jsx(ge,{candidate:f.find(r=>r.id===j)??null,selected:j?y.has(j):!1,disabled:_,onToggleSelected:Q,onImportOne:U})]}),e.jsxs("div",{className:"prompt-import-dialog__footer",children:[e.jsx("button",{type:"button",onClick:t,children:s("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>{le()},disabled:_||y.size===0,children:_?s("common.loading"):s("promptLibrary.importSelected",{count:y.size})})]})]})]}):null}export{Se as PromptImportDialog};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PromptImportDialog-uyJdrdTs.js","assets/index-TU0_IXQH.js","assets/index-BPKt0DUF.css"])))=>i.map(i=>d[i]);
2
- import{u as v,ax as R,j as e,ay as j,a as i,b as s,S as $,ag as A}from"./index-TU0_IXQH.js";function z({prompt:r,onClose:d,onLoad:c,onInsert:t,onDelete:b,onToggleFavorite:l}){const{t:o}=v(),n=R(!0,d),m=async()=>{try{await navigator.clipboard.writeText(r.text)}catch{}};return e.jsxs("div",{className:"prompt-detail-modal",role:"presentation",children:[e.jsx("div",{className:"prompt-detail-modal__backdrop",onClick:d}),e.jsxs("div",{ref:n,className:"prompt-detail-modal__content",role:"dialog","aria-modal":"true","aria-labelledby":"prompt-detail-title",tabIndex:-1,children:[e.jsxs("div",{className:"prompt-detail-modal__header",children:[e.jsx("h2",{id:"prompt-detail-title",className:"prompt-detail-modal__title",children:r.name||o("promptLibrary.untitled")}),e.jsx("button",{className:"prompt-detail-modal__close",onClick:d,"aria-label":o("common.close"),children:"×"})]}),e.jsxs("div",{className:"prompt-detail-modal__body",children:[e.jsx("div",{className:"prompt-detail-modal__label",children:o("promptLibrary.content")}),e.jsx("div",{className:"prompt-detail-modal__prompt",children:r.text}),r.tags.length>0&&e.jsxs("div",{className:"prompt-detail-modal__tags",children:[e.jsx("div",{className:"prompt-detail-modal__label",children:o("promptLibrary.tags")}),e.jsx("div",{className:"prompt-detail-modal__tag-list",children:r.tags.map(p=>e.jsxs("span",{className:"prompt-detail-modal__tag",children:["#",p]},p))})]})]}),e.jsxs("div",{className:"prompt-detail-modal__footer",children:[e.jsx("button",{className:"prompt-detail-modal__load",onClick:c,children:o("promptLibrary.load")}),e.jsx("button",{className:"prompt-detail-modal__copy",onClick:m,children:o("promptLibrary.copy")}),e.jsxs("button",{className:"prompt-detail-modal__insert",onClick:t,children:["+ ",o("promptLibrary.insert")]}),e.jsxs("button",{className:`prompt-detail-modal__favorite${r.isFavorite?" prompt-detail-modal__favorite--on":""}`,onClick:l,"aria-pressed":r.isFavorite,children:[e.jsx(j,{}),r.isFavorite?o("promptLibrary.unfavorite"):o("promptLibrary.favorite")]}),e.jsx("button",{className:"prompt-detail-modal__delete",onClick:b,children:o("common.delete")})]})]})]})}function M({prompt:r,onLoad:d,onInsert:c,onDelete:t,onToggleFavorite:b}){const{t:l}=v(),[o,n]=i.useState(!1),m=r.text.length>45?r.text.slice(0,45)+"...":r.text;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"prompt-library-row",onClick:()=>n(!0),children:[e.jsxs("div",{className:"prompt-library-row__main",children:[e.jsx("div",{className:"prompt-library-row__title",children:r.name||l("promptLibrary.untitled")}),e.jsx("div",{className:"prompt-library-row__preview",children:m})]}),e.jsxs("div",{className:"prompt-library-row__actions",children:[e.jsx("button",{className:"prompt-library-row__insert",onClick:p=>{p.stopPropagation(),c()},title:l("promptLibrary.insert"),"aria-label":l("promptLibrary.insert"),children:"+"}),e.jsx("button",{className:`prompt-library-row__star${r.isFavorite?" prompt-library-row__star--on":""}`,onClick:p=>{p.stopPropagation(),b()},"aria-label":r.isFavorite?l("promptLibrary.unfavorite"):l("promptLibrary.favorite"),"aria-pressed":r.isFavorite,children:e.jsx(j,{})}),e.jsx("span",{className:"prompt-library-row__chevron",children:"›"})]})]}),o&&e.jsx(z,{prompt:r,onClose:()=>n(!1),onLoad:()=>{d(),n(!1)},onInsert:()=>{c(),n(!1)},onDelete:t,onToggleFavorite:b})]})}const V=i.lazy(()=>A(()=>import("./PromptImportDialog-uyJdrdTs.js"),__vite__mapDeps([0,1,2])).then(r=>({default:r.PromptImportDialog})));function B({variant:r="overlay",forceOpen:d=!1,onRequestClose:c}){const{t}=v(),b=s(a=>a.promptLibraryOpen),l=s(a=>a.togglePromptLibrary),o=s(a=>a.promptLibrary),n=s(a=>a.promptLibraryLoading),m=s(a=>a.loadPromptLibrary),p=s(a=>a.deletePromptFromLibrary),w=s(a=>a.togglePromptFavorite),k=s(a=>a.setPrompt),L=s(a=>a.insertPromptToComposer),F=s(a=>a.clearInsertedPrompts),N=s(a=>a.showToast),[y,I]=i.useState(""),[x,S]=i.useState(!1),[O,f]=i.useState(!1),[g,C]=i.useState(!1),h=d||b,_=c??l;i.useEffect(()=>{h&&m()},[h,m]);const D=i.useCallback(a=>{L({id:a.id,name:a.name||t("promptLibrary.untitled"),text:a.text}),N(t("promptLibrary.inserted")),_()},[_,L,N,t]);if(!h)return null;const P=o.prompts.filter(a=>{if(x&&!a.isFavorite)return!1;if(!y.trim())return!0;const u=y.toLowerCase();return a.name.toLowerCase().includes(u)||a.text.toLowerCase().includes(u)||a.tags.some(E=>E.toLowerCase().includes(u))}),T=e.jsxs("div",{className:"prompt-library-panel__drawer",children:[e.jsxs("div",{className:"prompt-library-panel__header",children:[e.jsx("h3",{children:t("promptLibrary.title")}),e.jsxs("div",{className:"prompt-library-panel__actions",children:[e.jsx("button",{className:"prompt-library-panel__add",onClick:()=>f(a=>!a),title:t("promptLibrary.addNew"),"aria-label":t("promptLibrary.addNew"),children:"+"}),e.jsx("button",{className:"prompt-library-panel__import",onClick:()=>C(!0),title:t("promptLibrary.importFiles"),"aria-label":t("promptLibrary.importFiles"),children:t("promptLibrary.import")}),e.jsx("button",{onClick:_,"aria-label":t("common.close"),children:"×"})]}),O&&e.jsx($,{text:"",onClose:()=>f(!1)})]}),e.jsxs("div",{className:"prompt-library-panel__search",children:[e.jsx("input",{type:"text",placeholder:t("promptLibrary.search"),value:y,onChange:a=>I(a.target.value)}),e.jsxs("button",{type:"button",className:`prompt-library-panel__filter-toggle${x?" active":""}`,"aria-pressed":x,title:t("promptLibrary.favorites"),onClick:()=>S(a=>!a),children:[e.jsx(j,{}),e.jsx("span",{children:t("promptLibrary.favorites")})]})]}),n?e.jsx("div",{className:"prompt-library-panel__loading",children:t("common.loading")}):e.jsx("div",{className:"prompt-library-panel__list",children:P.length===0?e.jsx("div",{className:"prompt-library-panel__empty",children:t("promptLibrary.empty")}):P.map(a=>e.jsx(M,{prompt:a,onLoad:()=>{F(),k(a.text),l()},onInsert:()=>D(a),onDelete:()=>p(a.id),onToggleFavorite:()=>w(a.id)},a.id))}),g?e.jsx(i.Suspense,{fallback:null,children:e.jsx(V,{open:g,onClose:()=>C(!1),onImported:m})}):null]});return e.jsxs("div",{className:`prompt-library-panel prompt-library-panel--${r}`,children:[r==="overlay"?e.jsx("div",{className:"prompt-library-panel__backdrop",onClick:_}):null,T]})}export{B as PromptLibraryPanel};
@@ -1 +0,0 @@
1
- import{a as l,u as K,j as e,t as D,v as ie,x as re,y as le,z as ce,b as S,I as oe,A as H,V as z,B as Q,C as de,O as V,G as X,D as ue,U as ge,E as me,F as he,H as pe,J as fe,K as xe,L as ye,M as je,N as ve,P as be,Q as _e,T as we,W as Ne,X as ke}from"./index-TU0_IXQH.js";function Se(){const[s,a]=l.useState(null);return l.useEffect(()=>{let i=!1;return(async()=>{try{const n=await fetch("/api/agy/status");if(i)return;const m=await n.json();a(m)}catch{i||a({installed:!1})}})(),()=>{i=!0}},[]),s}function B({provider:s,label:a,placeholder:i,maskedKey:t,source:n,configured:m,onSaved:g}){const{t:o}=K(),[y,p]=l.useState(""),[f,v]=l.useState(!1),[_,h]=l.useState(!1),[r,x]=l.useState(null),[j,C]=l.useState(!1),L=n==="env",w=y.trim().length>0,M=m&&!f&&!w,$=l.useCallback(async()=>{if(w){h(!0),x(null),C(!1);try{const b=await(await fetch(`/api/keys/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:y.trim()})})).json();b.ok?(p(""),v(!1),C(!0),g(),setTimeout(()=>C(!1),3e3)):x(b.error||o("settings.apiKeys.saveFailed"))}catch{x(o("settings.apiKeys.networkError"))}finally{h(!1)}}},[y,s,w,g,o]),O=l.useCallback(async()=>{try{if(!(await fetch(`/api/keys/${s}`,{method:"DELETE"})).ok){x(o("settings.apiKeys.removeFailed"));return}p(""),v(!1),g()}catch{x(o("settings.apiKeys.networkError"))}},[s,g,o]),A=l.useCallback(()=>{m&&v(!0)},[m]),P=l.useCallback(()=>{w||v(!1)},[w]);return e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("p",{className:"settings-eyebrow",children:o(L?"settings.apiKeys.envSource":"settings.apiKeys.configSource")}),e.jsx("h4",{children:a}),e.jsxs("div",{className:"api-key-input-group",children:[M?e.jsx("input",{type:"text",className:"api-key-input is-masked",value:t||"●●●●●●",readOnly:!0,onFocus:A,onClick:A}):e.jsx("input",{type:"password",className:`api-key-input${r?" is-invalid":""}`,placeholder:i,value:y,onChange:c=>{p(c.target.value),x(null)},onBlur:P,readOnly:!1,autoComplete:"off",autoFocus:f,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"}),e.jsxs("div",{className:"api-key-actions",children:[e.jsx("button",{type:"button",className:"settings-action-btn",onClick:$,disabled:!w||_,children:o(_?"settings.apiKeys.saving":j?"settings.apiKeys.saved":"settings.apiKeys.save")}),m&&!L&&e.jsx("button",{type:"button",className:"settings-action-btn settings-action-btn--danger",onClick:O,children:o("settings.apiKeys.remove")})]})]}),r&&e.jsx("p",{className:"api-key-error",children:r})]}),e.jsxs("div",{className:`settings-status${m?" is-ok":""}`,children:[e.jsx("span",{"aria-hidden":"true"}),o(m?"settings.apiKeys.status.valid":"settings.apiKeys.status.notConfigured")]})]})}function Ce({configured:s,maskedKey:a,source:i,onSaved:t}){const{t:n}=K(),[m,g]=l.useState(""),[o,y]=l.useState(!1),[p,f]=l.useState(!1),[v,_]=l.useState(null),[h,r]=l.useState(!1),x=i==="env",j=m.trim().length>0,C=s&&!o&&!j,L=l.useCallback(async()=>{if(j){f(!0),_(null),r(!1);try{const A=await(await fetch("/api/keys/vertex",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceAccountJson:m.trim()})})).json();A.ok?(g(""),y(!1),r(!0),t(),setTimeout(()=>r(!1),3e3)):_(A.error||n("settings.apiKeys.saveFailed"))}catch{_(n("settings.apiKeys.networkError"))}finally{f(!1)}}},[m,j,t,n]),w=l.useCallback(async()=>{try{if(!(await fetch("/api/keys/vertex",{method:"DELETE"})).ok){_(n("settings.apiKeys.removeFailed"));return}g(""),y(!1),t()}catch{_(n("settings.apiKeys.networkError"))}},[t,n]),M=l.useCallback(()=>{s&&!x&&y(!0)},[s,x]),$=l.useCallback(()=>{j||y(!1)},[j]);return e.jsxs("div",{className:"vertex-json-section",children:[e.jsx("p",{className:"settings-eyebrow",children:n(x?"settings.apiKeys.envSource":"settings.apiKeys.configSource")}),s&&a&&e.jsx("p",{className:"vertex-project-id",children:a}),C?e.jsx("textarea",{className:"vertex-json-textarea is-masked",value:`●●● (${n("settings.apiKeys.configuredReplace")})`,readOnly:!0,onFocus:M,onClick:M}):e.jsx("textarea",{className:`vertex-json-textarea${v?" is-invalid":""}`,placeholder:n("settings.apiKeys.vertex.placeholder"),value:m,onChange:O=>{g(O.target.value),_(null)},onBlur:$,readOnly:x,autoFocus:o,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"}),e.jsxs("div",{className:"api-key-actions",style:{marginTop:8},children:[!x&&e.jsx("button",{type:"button",className:"settings-action-btn",onClick:L,disabled:!j||p,children:n(p?"settings.apiKeys.saving":h?"settings.apiKeys.saved":"settings.apiKeys.save")}),s&&!x&&e.jsx("button",{type:"button",className:"settings-action-btn settings-action-btn--danger",onClick:w,children:n("settings.apiKeys.remove")})]}),v&&e.jsx("p",{className:"api-key-error",children:v}),e.jsxs("div",{className:`settings-status${s?" is-ok":""}`,style:{marginTop:8},children:[e.jsx("span",{"aria-hidden":"true"}),n(s?"settings.apiKeys.status.valid":"settings.apiKeys.status.notConfigured")]})]})}function Le({keyStatus:s,onSaved:a}){const{t:i}=K(),t=s.vertex?.configured??!1,n=s.gemini?.configured??!1,m=s.geminiAuthMode==="vertex"?"vertex":"apikey",[g,o]=l.useState(m),[y,p]=l.useState(!1);l.useEffect(()=>{y||o(m)},[m,y]);const f=v=>{p(!0),o(v),fetch("/api/keys/gemini-auth-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:v})}).catch(()=>{})};return e.jsxs("div",{className:"gemini-key-section",children:[e.jsxs("div",{className:"gemini-key-section__header",children:[e.jsx("h5",{children:i("settings.apiKeys.gemini.label")}),e.jsx(D,{value:g,onChange:f,items:[{value:"apikey",label:i("settings.apiKeys.vertex.authModeApiKey")},{value:"vertex",label:i("settings.apiKeys.vertex.authModeVertex")}]})]}),g==="apikey"?e.jsx(B,{provider:"gemini",label:"",placeholder:i("settings.apiKeys.gemini.placeholder"),maskedKey:s.gemini?.maskedKey??null,source:s.gemini?.source??"none",configured:n,onSaved:a}):e.jsx(Ce,{configured:t,maskedKey:s.vertex?.maskedKey??null,source:s.vertex?.source??"none",onSaved:a})]})}function Ee(s){return s>80?"var(--error, #e53935)":s>50?"var(--warning, #f59e0b)":"var(--info, #3b82f6)"}function Ke(s){if(!s)return"";const a=new Date(s);return`${a.getMonth()+1}/${a.getDate()} ${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}function te({window:s}){const a=Ke(s.resetsAt);return e.jsxs("div",{className:"quota-bar",children:[e.jsx("span",{className:"quota-bar__label",children:s.label}),e.jsx("div",{className:"quota-bar__track",children:e.jsx("div",{className:"quota-bar__fill",style:{width:`${Math.min(s.percent,100)}%`,background:Ee(s.percent)}})}),e.jsxs("span",{className:"quota-bar__pct",children:[s.percent,"%"]}),a&&e.jsx("span",{className:"quota-bar__reset",children:a})]})}function ne({provider:s,onComplete:a}){const{t:i}=K(),[t,n]=l.useState({phase:"idle"}),[m,g]=l.useState(!1),o=l.useRef(!1),y=l.useCallback(async()=>{if(!o.current){o.current=!0,n({phase:"starting"});try{const p=await fetch("/api/auth/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s})});if(!p.ok){const v=await p.json().catch(()=>({error:i("settings.quota.switchFailed")}));n({phase:"error",error:v.error||`HTTP ${p.status}`});return}const f=await p.json();n({phase:"waiting",...f}),window.open(f.verificationUrl,"_blank")}catch(p){o.current=!1,n({phase:"error",error:p.message})}}},[s]);return l.useEffect(()=>{if(t.phase!=="waiting"||!t.sessionId)return;let p=!1;const f=async()=>{try{const h=await(await fetch(`/api/auth/switch/${t.sessionId}`)).json();if(p)return;if(h.status==="complete"){n({phase:"complete"}),setTimeout(a,1e3);return}if(h.status==="error"||h.status==="expired"){n({phase:"error",error:h.error||h.status});return}}catch{}p||setTimeout(f,3e3)},v=setTimeout(f,3e3);return()=>{p=!0,clearTimeout(v)}},[t.phase,t.sessionId,a]),t.phase==="idle"?e.jsx("button",{type:"button",className:"settings-action-btn",style:{width:"100%",marginTop:"6px"},onClick:y,children:i("settings.quota.switchAccount",{provider:s==="grok"?"Grok":"Codex"})}):t.phase==="starting"?e.jsx("div",{className:"quota-card__hint",style:{textAlign:"center",marginTop:"6px"},children:i("settings.quota.startingLogin")}):t.phase==="waiting"?e.jsxs("div",{style:{marginTop:"6px",padding:"8px",background:"var(--surface, #f5f5f5)",borderRadius:"6px",fontSize:"12px"},children:[e.jsx("div",{style:{textAlign:"center",marginBottom:"4px"},children:i("settings.quota.enterCode")}),e.jsx("div",{style:{textAlign:"center",fontSize:"18px",fontWeight:700,fontFamily:"monospace",letterSpacing:"2px",margin:"6px 0"},children:t.userCode}),t.verificationUrl&&e.jsxs("div",{style:{display:"flex",gap:"4px",margin:"6px 0"},children:[e.jsx("button",{type:"button",className:"settings-action-btn",style:{flex:1,fontSize:"11px"},onClick:()=>{o.current=!1,y()},children:i("settings.quota.retry")}),e.jsx("button",{type:"button",className:"settings-action-btn",style:{flex:1,fontSize:"11px"},onClick:()=>{navigator.clipboard?.writeText(t.verificationUrl).then(()=>{g(!0),setTimeout(()=>g(!1),2e3)})},children:i(m?"settings.quota.copied":"settings.quota.copyLink")})]}),e.jsx("div",{style:{textAlign:"center",color:"var(--text-dim, #888)",fontSize:"11px"},children:i("settings.quota.waitingApproval")})]}):t.phase==="complete"?e.jsx("div",{className:"quota-card__hint",style:{textAlign:"center",marginTop:"6px",color:"var(--success, #22c55e)"},children:i("settings.quota.switchComplete")}):t.phase==="error"?e.jsxs("div",{style:{marginTop:"6px"},children:[e.jsx("div",{className:"quota-card__hint",style:{color:"var(--error, #e53935)",marginBottom:"4px"},children:t.error||i("settings.quota.switchFailed")}),e.jsx("button",{type:"button",className:"settings-action-btn",style:{width:"100%",fontSize:"11px"},onClick:()=>{o.current=!1,n({phase:"idle"})},children:i("settings.quota.tryAgain")})]}):null}function Te(){const[s,a]=l.useState(null),[i,t]=l.useState(!0),n=l.useCallback(()=>{t(!0),fetch("/api/quota").then(m=>m.json()).then(a).catch(()=>a(null)).finally(()=>t(!1))},[]);return l.useEffect(()=>{const m=setTimeout(n,1500);return()=>clearTimeout(m)},[n]),{data:s,loading:i,refreshQuota:n}}function Ie({data:s,loading:a,onRefresh:i}){const{t}=K(),n=s?.codex,m=n?.windows&&n.windows.length>0,g=n?.account?[n.account.email,n.account.plan].filter(Boolean).join(" · "):null;return e.jsxs("div",{className:"quota-card",children:[g?e.jsx("div",{className:"quota-card__header",children:e.jsx("span",{className:"quota-card__account",children:g})}):null,a?e.jsx("span",{className:"quota-card__loading",children:t("common.loading")}):m?n.windows.map(o=>e.jsx(te,{window:o},o.label)):n?.authenticated===!1?e.jsx("span",{className:"quota-card__hint",children:t("settings.quota.codexNotLoggedIn")}):n?.error?e.jsx("span",{className:"quota-card__hint",children:t("settings.quota.fetchError")}):e.jsx("span",{className:"quota-card__hint",children:t("settings.quota.noData")}),e.jsx(ne,{provider:"codex",onComplete:i})]})}function Me({data:s,loading:a,onRefresh:i}){const{t}=K(),n=s?.grok,m=n?.windows&&n.windows.length>0,g=n?.account?[n.account.email,n.account.plan].filter(Boolean).join(" · "):null;return e.jsxs("div",{className:"quota-card",children:[g||n?.billing?e.jsxs("div",{className:"quota-card__header",style:{display:"flex",alignItems:"center"},children:[g&&e.jsx("span",{className:"quota-card__account",children:g}),n?.billing&&e.jsxs("span",{style:{marginLeft:"auto",fontSize:"11px",color:"var(--text-dim, #888)",whiteSpace:"nowrap"},children:["$",n.billing.usedUsd.toFixed(1),"/$",n.billing.limitUsd]})]}):null,a?e.jsx("span",{className:"quota-card__loading",children:t("common.loading")}):m?n.windows.map(o=>e.jsx(te,{window:o},o.label)):n?.authenticated===!1?e.jsx("span",{className:"quota-card__hint",children:t("settings.quota.codexNotLoggedIn")}):e.jsx("a",{href:"https://grok.com/?_s=usage",target:"_blank",rel:"noopener noreferrer",className:"settings-action-btn",children:t("settings.quota.grokUsageLink")}),e.jsx(ne,{provider:"grok",onComplete:i})]})}function Y(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.998 5.998 0 0 0-3.998 2.9 6.049 6.049 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.815 3.355-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.393.681zm1.097-2.365l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.612-1.5z"})})}function Oe(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:e.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function Ae(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 24A14.304 14.304 0 0 0 0 12 14.304 14.304 0 0 0 12 0a14.305 14.305 0 0 0 12 12 14.305 14.305 0 0 0-12 12"})})}function Z(s,a){return s(a==="ready"?"settings.account.status.ready":a==="auth_required"?"settings.account.status.authRequired":a==="starting"?"settings.account.status.starting":a==="offline"?"settings.account.status.offline":a==="no_image_model"?"settings.account.status.noImageModel":a==="error"?"settings.account.status.error":"settings.account.status.checking")}function ee(s){return s==="ready"?"ok":s==="error"||s==="offline"?"err":"warn"}function Re(){const{t:s}=K(),a=ie(),i=re(),t=Se(),{data:n,error:m}=le(),{data:g,mutate:o}=ce(),y=Te(),[p,f]=l.useState(!1),v=n?.apiKeySource==="env"||n?.apiKeySource==="config"||n?.apiKeyValid===!0,_=n?.apiKeySource==="config"?s("settings.account.apiSourceConfig"):s("settings.account.apiSourceEnv"),h=n?.apiKeyValid===!0;return e.jsxs(e.Fragment,{children:[e.jsxs("article",{className:"provider-card",children:[e.jsxs("div",{className:"provider-card__head",children:[e.jsx("span",{className:"provider-card__brand",children:e.jsx(Y,{})}),e.jsx("h4",{children:s("settings.account.oauthTitle")}),e.jsx("span",{className:"provider-card__eyebrow",children:s("settings.account.primaryEyebrow")}),e.jsx("span",{className:`provider-chip provider-chip--${ee(a?.status)}`,children:Z(s,a?.status)})]}),e.jsx("div",{className:"settings-row__copy",children:e.jsx("p",{children:s("settings.account.oauthBody")})}),e.jsx(Ie,{data:y.data,loading:y.loading,onRefresh:y.refreshQuota})]}),v?e.jsxs("article",{className:"provider-card",children:[e.jsxs("div",{className:"provider-card__head",children:[e.jsx("span",{className:"provider-card__brand",children:e.jsx(Y,{})}),e.jsx("h4",{children:s("settings.account.apiTitle")}),e.jsx("span",{className:"provider-card__eyebrow",children:_}),e.jsx("span",{className:`provider-chip provider-chip--${m?"err":h?"ok":"warn"}`,children:s(m?"settings.account.apiUnknown":h?"settings.account.apiReady":"settings.account.apiUnavailable")})]}),e.jsx("div",{className:"settings-row__copy",children:e.jsx("p",{children:s("settings.account.apiBody")})})]}):null,e.jsxs("article",{className:"provider-card",children:[e.jsxs("div",{className:"provider-card__head",children:[e.jsx("span",{className:"provider-card__brand",children:e.jsx(Oe,{})}),e.jsx("h4",{children:s("settings.account.grokTitle")}),e.jsx("span",{className:"provider-card__eyebrow",children:s("settings.account.grokEyebrow")}),e.jsx("span",{className:`provider-chip provider-chip--${ee(i?.status)}`,children:Z(s,i?.status)})]}),e.jsx("div",{className:"settings-row__copy",children:e.jsx("p",{children:s("settings.account.grokBody")})}),e.jsx(Me,{data:y.data,loading:y.loading,onRefresh:y.refreshQuota})]}),e.jsxs("article",{className:"provider-card",children:[e.jsxs("div",{className:"provider-card__head",children:[e.jsx("span",{className:"provider-card__brand",children:e.jsx(Ae,{})}),e.jsx("h4",{children:s("settings.account.agyTitle")}),e.jsx("span",{className:"provider-card__eyebrow",children:s("settings.account.agyEyebrow")}),e.jsx("span",{className:`provider-chip provider-chip--${t?.installed?"ok":"warn"}`,children:t?.installed?s("settings.account.agyInstalled"):s("settings.account.agyMissing")})]}),e.jsxs("div",{className:"settings-row__copy",children:[t?.installed?e.jsx("p",{children:s("settings.account.agyInstalledBody")}):e.jsxs("p",{children:[s("settings.account.agyMissingBody")," ",e.jsx("a",{href:"https://antigravity.google/docs/cli-install",target:"_blank",rel:"noopener noreferrer",children:s("settings.account.agyMissingLink")})]}),e.jsx("p",{style:{fontSize:"12px",color:"var(--text-dim, #888)",marginTop:"4px"},children:s("settings.account.agyFineprint")})]})]}),g&&e.jsxs("article",{className:"settings-row settings-accordion",children:[e.jsxs("button",{type:"button",className:"settings-accordion__trigger",onClick:()=>f(!p),children:[e.jsx("h4",{children:s("settings.apiKeys.accordionTitle")}),e.jsx("span",{className:`settings-accordion__arrow${p?" is-open":""}`,children:"▼"})]}),p&&e.jsxs("div",{className:"settings-accordion__body",children:[e.jsx(B,{provider:"openai",label:s("settings.apiKeys.openai.label"),placeholder:s("settings.apiKeys.openai.placeholder"),maskedKey:g.openai?.maskedKey??null,source:g.openai?.source??"none",configured:g.openai?.configured??!1,onSaved:o}),e.jsx(B,{provider:"xai",label:s("settings.apiKeys.xai.label"),placeholder:s("settings.apiKeys.xai.placeholder"),maskedKey:g.xai?.maskedKey??null,source:g.xai?.source??"none",configured:g.xai?.configured??!1,onSaved:o}),e.jsx(B,{provider:"atlascloud",label:s("settings.apiKeys.atlascloud.label"),placeholder:s("settings.apiKeys.atlascloud.placeholder"),maskedKey:g.atlascloud?.maskedKey??null,source:g.atlascloud?.source??"none",configured:g.atlascloud?.configured??!1,onSaved:o}),e.jsx(B,{provider:"minimax",label:s("settings.apiKeys.minimax.label"),placeholder:s("settings.apiKeys.minimax.placeholder"),maskedKey:g.minimax?.maskedKey??null,source:g.minimax?.source??"none",configured:g.minimax?.configured??!1,onSaved:o}),e.jsx(B,{provider:"nai",label:s("settings.apiKeys.nai.label"),placeholder:s("settings.apiKeys.nai.placeholder"),maskedKey:g.nai?.maskedKey??null,source:g.nai?.source??"none",configured:g.nai?.configured??!1,onSaved:o}),e.jsx(Le,{keyStatus:g,onSaved:o})]})]})]})}function $e({variant:s}){const{t:a}=K(),[i,t]=l.useState(!1),n=l.useRef(null),m=l.useRef(null),g=l.useRef(null),o=l.useRef([]),[y,p]=l.useState({top:0,left:12,width:280,maxHeight:480}),f=S(c=>c.imageModel),v=S(c=>c.provider),_=S(c=>c.setImageModel),h=S(c=>c.setProvider),r=S(c=>c.videoModelSelected),x=S(c=>c.selectVideoModel),j=S(c=>c.reasoningEffort),C=S(c=>c.setReasoningEffort),L=s==="settings"?"settings-image-model":"sidebar-image-model",w=oe,M=w.find(c=>c.value===f&&(!c.providerHint||c.providerHint===v))??w.find(c=>c.value===f)??w[0],$=H.find(c=>c.value===j)??H[0],O=()=>o.current.filter(c=>c!==null),A=c=>{const b=O();if(b.length===0)return;const u=(c+b.length)%b.length;b[u]?.focus()},P=c=>{const b=O();if(b.length===0)return;const u=b.findIndex(T=>T===document.activeElement),N=b.length-1;if(c.key==="ArrowDown"||c.key==="ArrowRight"){c.preventDefault(),A(u>=0?u+1:0);return}if(c.key==="ArrowUp"||c.key==="ArrowLeft"){c.preventDefault(),A(u>=0?u-1:N);return}if(c.key==="Home"){c.preventDefault(),A(0);return}if(c.key==="End"){c.preventDefault(),A(N);return}c.key==="Escape"&&(c.preventDefault(),t(!1),m.current?.focus())};if(l.useEffect(()=>{if(s!=="sidebar"||!i)return;const c=u=>{const N=u.target;N instanceof Node&&(n.current?.contains(N)||g.current?.contains(N)||t(!1))},b=u=>{u.key==="Escape"&&t(!1)};return document.addEventListener("pointerdown",c),document.addEventListener("keydown",b),()=>{document.removeEventListener("pointerdown",c),document.removeEventListener("keydown",b)}},[i,s]),l.useLayoutEffect(()=>{if(s!=="sidebar"||!i)return;(()=>{const N=m.current?.getBoundingClientRect();if(N){const R=Math.min(280,Math.max(218,window.innerWidth-24)),F=N.right-R,W=window.innerWidth-R-12,d=Math.max(12,Math.min(F,W)),k=N.bottom+7,E=Math.max(160,window.innerHeight-k-12);p({top:k,left:d,width:R,maxHeight:E})}})();const b=N=>{N&&g.current?.contains(N.target)||t(!1)},u=document.querySelector(".sidebar__scroll");return u?.addEventListener("scroll",b,{passive:!0}),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{u?.removeEventListener("scroll",b),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[i,s]),l.useEffect(()=>{if(s!=="sidebar"||!i)return;const c=w.findIndex(u=>u.value===f),b=requestAnimationFrame(()=>{A(c>=0?c:0)});return()=>cancelAnimationFrame(b)},[f,w,i,s]),s==="sidebar"){const c=r?z.find(u=>u.value===r)?.shortLabel??z[0].shortLabel:M.shortLabel.split(" ")[0],b=Q(f)?M.shortLabel.split(" ")[1]||"":$.shortLabel;return e.jsxs("div",{ref:n,className:"image-model-select image-model-select--sidebar",children:[e.jsxs("button",{ref:m,id:L,type:"button",className:"image-model-select__trigger image-model-select__trigger--pill","aria-haspopup":"menu","aria-expanded":i,"aria-label":a("sidebar.quickSettingsAria",{model:c,effort:b}),onClick:()=>t(u=>!u),children:[e.jsxs("span",{className:"image-model-select__trigger-top",children:[e.jsx("span",{className:"image-model-select__trigger-model",children:c}),e.jsx("span",{className:"image-model-select__trigger-chevron","aria-hidden":"true",children:"▾"})]}),e.jsx("span",{className:"image-model-select__trigger-effort",children:b})]}),i?de.createPortal(e.jsxs("div",{ref:g,className:"image-model-select__menu",role:"menu","aria-label":a("sidebar.quickSettingsMenu"),onKeyDown:P,style:{position:"fixed",top:y.top,left:y.left,width:y.width,maxHeight:y.maxHeight,overflowY:"auto",zIndex:160},children:[e.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":a("sidebar.imageSectionLabel"),children:[e.jsx("div",{className:"image-model-select__section-title",children:a("sidebar.imageSectionLabel")}),e.jsx("div",{className:"image-model-select__subsection-title",children:a("sidebar.gptImageSubLabel")}),V.map((u,N)=>e.jsxs("button",{ref:T=>{o.current[N]=T},type:"button",className:`image-model-select__item${u.value===f&&!r?" is-active":""}`,role:"menuitemradio","aria-checked":u.value===f&&!r,tabIndex:-1,onClick:()=>{_(u.value),t(!1)},children:[e.jsx("span",{children:u.shortLabel}),e.jsx("small",{children:a(u.fullLabelKey)})]},u.value)),e.jsx("div",{className:"image-model-select__subsection-title",children:a("sidebar.grokImageSubLabel")}),X.map((u,N)=>e.jsxs("button",{ref:T=>{o.current[V.length+N]=T},type:"button",className:`image-model-select__item${u.value===f&&!r?" is-active":""}`,role:"menuitemradio","aria-checked":u.value===f&&!r,tabIndex:-1,onClick:()=>{_(u.value),t(!1)},children:[e.jsx("span",{children:u.shortLabel}),e.jsx("small",{children:a(u.fullLabelKey)})]},u.value)),e.jsx("div",{className:"image-model-select__subsection-title",children:a("sidebar.geminiImageSubLabel")}),ue.map((u,N)=>{const T=u.providerHint,R=u.value===f&&T===v&&!r;return e.jsxs("button",{ref:F=>{o.current[V.length+X.length+N]=F},type:"button",className:`image-model-select__item${R?" is-active":""}`,role:"menuitemradio","aria-checked":R,tabIndex:-1,onClick:()=>{T&&h(T),_(u.value),t(!1)},children:[e.jsx("span",{children:u.shortLabel}),e.jsx("small",{children:a(u.fullLabelKey)})]},`${u.value}-${T||N}`)})]}),e.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":a("sidebar.videoSectionLabel"),children:[e.jsx("div",{className:"image-model-select__section-title",children:a("sidebar.videoSectionLabel")}),z.map((u,N)=>e.jsxs("button",{ref:T=>{o.current[w.length+N]=T},type:"button",className:`image-model-select__item${r===u.value?" is-active":""}`,role:"menuitemradio","aria-checked":r===u.value,tabIndex:-1,onClick:()=>{x(u.value),t(!1)},children:[e.jsx("span",{children:u.shortLabel}),e.jsx("small",{children:a(u.fullLabelKey)})]},u.value))]}),!Q(f)&&e.jsxs("details",{className:"image-model-select__section image-model-select__collapsible",children:[e.jsxs("summary",{className:"image-model-select__section-title image-model-select__section-title--toggle",children:[a("sidebar.reasoningLabel"),e.jsx("span",{className:"image-model-select__chevron","aria-hidden":"true",children:"▸"})]}),e.jsx("div",{role:"group","aria-label":a("sidebar.reasoningLabel"),children:H.map((u,N)=>e.jsxs("button",{ref:T=>{o.current[w.length+z.length+N]=T},type:"button",className:`image-model-select__item${u.value===j?" is-active":""}`,role:"menuitemradio","aria-checked":u.value===j,tabIndex:-1,onClick:()=>{C(u.value),t(!1)},children:[e.jsx("span",{children:u.shortLabel}),e.jsx("small",{children:a(u.fullLabelKey)})]},u.value))})]})]}),document.body):null]})}return e.jsx("div",{className:"image-model-select image-model-select--settings",children:e.jsx(D,{id:L,value:f,onChange:c=>_(c),items:[...w.map(c=>({value:c.value,label:a(c.fullLabelKey)})),...ge.map(c=>({value:c.value,label:a(c.fullLabelKey),disabled:!0}))]})})}function Pe(){const{t:s}=K(),a=S(n=>n.reasoningEffort),i=S(n=>n.setReasoningEffort),t=H.map(n=>({value:n.value,label:s(n.fullLabelKey)}));return e.jsx("div",{className:"ctl-select-wrap settings-reasoning-effort",children:e.jsx(D,{id:"settings-reasoning-effort",items:t,value:a,onChange:i})})}const qe={ko:"KO",en:"EN","zh-Hant":"正體","zh-Hans":"简体"};function Be(){const{t:s,locale:a}=K(),i=S(t=>t.setLocale);return e.jsx("div",{className:"lang-toggle",role:"group","aria-label":s("language.label"),children:me.map(t=>e.jsx("button",{type:"button",className:`lang-toggle__btn ${a===t?"is-active":""}`,onClick:()=>i(t),"aria-pressed":a===t,title:s(`language.${t}`),children:e.jsx("span",{className:"lang-toggle__label",children:qe[t]})},t))})}const De=["light","dark","system"];function Fe(){const{t:s}=K(),{mode:a,setMode:i}=he();return e.jsx("div",{className:"lang-toggle",role:"group","aria-label":s("settings.theme.label"),children:De.map(t=>e.jsx("button",{type:"button",className:`lang-toggle__btn ${a===t?"is-active":""}`,onClick:()=>i(t),"aria-pressed":a===t,title:s(`settings.theme.${t}`),children:e.jsx("span",{className:"lang-toggle__label",children:s(`settings.theme.${t}`)})},t))})}const ze=["rail","horizontal","sidebar"];function Ge(){const{t:s}=K(),a=S(t=>t.historyStripLayout),i=S(t=>t.setHistoryStripLayout);return e.jsx(pe,{className:"history-layout-toggle",items:ze.map(t=>({value:t,label:s(`settings.appearance.historyStripLayout.${t}`)})),value:a,onChange:i})}const Ue=[{value:"default",labelKey:"workspace.defaultLabel",descKey:"workspace.defaultDesc"},{value:"prompt-studio",labelKey:"workspace.promptStudioLabel",descKey:"workspace.promptStudioDesc"}];function He(){const s=S(t=>t.workspaceProfile),a=S(t=>t.setWorkspaceProfile),{t:i}=K();return e.jsx("div",{className:"settings-field",children:e.jsx(D,{id:"workspace-profile-select",value:s,onChange:t=>a(t),ariaLabel:i("workspace.profileLabel"),items:Ue.map(t=>({value:t.value,label:i(t.labelKey)}))})})}function We(){const{t:s}=K(),[a,i]=l.useState(null);l.useEffect(()=>{fetch("/api/config/grok-planner").then(n=>n.json()).then(i).catch(()=>{})},[]);const t=async n=>{try{await fetch("/api/config/grok-planner",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:n})}),i(m=>m?{...m,model:n}:null)}catch{}};return a?e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.grokPlanner.title")}),e.jsx("p",{children:s("settings.grokPlanner.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(D,{items:a.options.map(n=>({value:n,label:n})),value:a.model,onChange:n=>{t(n)},ariaLabel:s("settings.grokPlanner.title")})})]}):null}function Ve(s){return s==="connected"?"ok":s==="error"||s==="offline"?"err":"warn"}function Je(s){const a=s.status.snapshotDiff;return a?a.drifted.length+a.missing.length+a.added.length:0}function Qe(){const{t:s}=K(),{providers:a,loading:i,error:t,refresh:n}=fe(),[m,g]=l.useState(null),[o,y]=l.useState(!1),[p,f]=l.useState(null),v=async()=>{if(!o){y(!0);try{await n()}finally{y(!1)}}},_=async(h,r)=>{g({provider:h.id,action:r}),f(null);try{r==="connect"?await xe(h.id):r==="refresh"?await ye(h.id):await je(h.id),await n()}catch(x){const j=x instanceof Error&&x.message==="MCP_POPUP_BLOCKED"?s("mcp.popupBlocked"):s("mcp.connectionActionFailed");f({provider:h.id,message:j})}finally{g(null)}};return e.jsxs("div",{"aria-labelledby":"mcp-provider-connections-title",children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{id:"mcp-provider-connections-title",children:s("mcp.connectionsTitle")}),e.jsx("p",{children:s("mcp.connectionsBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx("button",{type:"button",className:"settings-action-btn",onClick:()=>{v()},disabled:i||o,"aria-busy":i||o,children:s(i||o?"mcp.loadingProviders":"mcp.refreshList")})})]}),t?e.jsx("p",{role:"alert",className:"settings-row__microcopy",children:s("mcp.providersLoadFailed")}):null,a.map(h=>{const r=h.status.state,x=!h.enabled||h.executable===!1,j=m?.provider===h.id?m.action:null,C=j!==null,L=Je(h);return e.jsxs("article",{className:"provider-card",children:[e.jsxs("div",{className:"provider-card__head",children:[e.jsx("h4",{children:h.id}),e.jsx("span",{className:"provider-card__eyebrow",children:"MCP"}),e.jsx("span",{className:`provider-chip provider-chip--${Ve(r)}`,children:s(`mcp.status.${r}`)})]}),e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("p",{children:h.endpoint}),e.jsxs("p",{children:[typeof h.status.toolCount=="number"?s("mcp.toolCount",{count:h.status.toolCount}):s("mcp.toolCountUnknown"),L>0?` · ${s("mcp.snapshotChanges",{count:L})}`:""]}),x?e.jsx("p",{className:"settings-row__microcopy",children:h.enabled?h.lockReason??s("mcp.higgsfieldLocked"):s("mcp.disabledProvider")}):h.status.detail?e.jsx("p",{className:"settings-row__microcopy",children:h.status.detail}):null,p?.provider===h.id?e.jsx("p",{role:"alert",className:"settings-row__microcopy",children:p.message}):null]}),e.jsxs("div",{className:"provider-card__head",children:[e.jsx("span",{className:"provider-card__eyebrow",children:s("mcp.billingLabel")}),e.jsx("span",{className:"provider-chip provider-chip--warn",children:s("mcp.billingUnknown")})]}),e.jsx("div",{className:"settings-row__control","aria-live":"polite",children:r==="connected"&&!x?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"settings-action-btn",onClick:()=>{_(h,"refresh")},disabled:C,"aria-busy":j==="refresh",children:s(j==="refresh"?"mcp.refreshingConnection":"mcp.refreshConnection")}),e.jsx("button",{type:"button",className:"settings-action-btn settings-action-btn--danger",onClick:()=>{_(h,"disconnect")},disabled:C,"aria-busy":j==="disconnect",children:s("mcp.disconnect")})]}):e.jsx("button",{type:"button",className:"settings-action-btn",onClick:()=>{_(h,"connect")},disabled:C||x,"aria-busy":j==="connect",title:s(x?"mcp.higgsfieldLocked":"mcp.connectOpensBrowser"),children:s(j==="connect"?"mcp.connecting":"mcp.connect")})})]},h.id)})]})}const Xe=[137,80,78,71,13,10,26,10];async function Ye(s){const a=new Uint8Array(await s.arrayBuffer());if(Xe.every((t,n)=>a[n]===t)){let t="";for(const n of a)t+=String.fromCharCode(n);return{pngBase64:btoa(t)}}return{graph:JSON.parse(new TextDecoder().decode(a))}}const se=["prompt","negativePrompt","width","height","seed","refImage","output"];function G(s){return s.input?`${s.node}.${s.input}`:s.node}function Ze(){const{t:s}=K(),[a,i]=l.useState([]),[t,n]=l.useState(!0),[m,g]=l.useState(null),[o,y]=l.useState(null),[p,f]=l.useState({}),[v,_]=l.useState(""),[h,r]=l.useState(""),[x,j]=l.useState("image"),[C,L]=l.useState("http://127.0.0.1:8188"),[w,M]=l.useState({kind:"idle"}),[$,O]=l.useState(null),[A,P]=l.useState(!1),c=l.useRef(null),b=l.useCallback(async()=>{n(!0);try{const d=await ve();i(d.workflows)}catch{i([])}finally{n(!1)}},[]);l.useEffect(()=>{b()},[b]);const u=async d=>{if(d){O(null);try{const k=await Ye(d),E=await _e(k);y(k),g(E),j(E.mediaKind??"image");const q={};for(const I of E.candidates)I.unambiguous&&(q[I.field]=G(I));f(q),v||_(d.name.replace(/\.[^.]+$/,"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").slice(0,64))}catch(k){g(null),y(null),O(k instanceof Error?k.message:s("comfy.inspectFailed"))}}},N=async()=>{M({kind:"idle"});try{const d=await we(C);M(d.health.ok?{kind:"ok",...d.health.version?{detail:d.health.version}:{}}:{kind:"unreachable"})}catch(d){M({kind:"invalid",detail:d instanceof Error?d.message:void 0})}},T=(m?.candidates??[]).filter(d=>!d.unambiguous).map(d=>d.field).filter((d,k,E)=>E.indexOf(d)===k).filter(d=>!p[d]),R=!!(m&&v&&p.prompt&&p.output&&T.length===0&&!A),F=async()=>{if(!(!R||!o)){P(!0),O(null);try{const d={};for(const k of se){const E=p[k];if(!E)continue;if(k==="output"){d.output={node:E};continue}const q=E.indexOf(".");d[k]={node:E.slice(0,q),input:E.slice(q+1)}}await Ne({...o,id:v,...h?{label:h}:{},origin:C,mediaKind:x,bind:d}),g(null),y(null),f({}),_(""),r(""),j("image"),c.current&&(c.current.value=""),await b()}catch(d){O(d instanceof Error?d.message:s("comfy.registerFailed"))}finally{P(!1)}}},W=async d=>{P(!0);try{await be(d),await b()}catch(k){O(k instanceof Error?k.message:s("comfy.removeFailed"))}finally{P(!1)}};return e.jsxs("div",{"aria-labelledby":"comfy-workflow-manager-title",children:[e.jsx("article",{className:"settings-row",children:e.jsxs("div",{className:"settings-row-main",children:[e.jsx("div",{className:"section-title",id:"comfy-workflow-manager-title",children:s("comfy.workflowsTitle")}),t?e.jsx("div",{className:"muted",children:s("comfy.loading")}):null,!t&&a.length===0?e.jsx("div",{className:"muted",children:s("comfy.empty")}):null,a.length>0?e.jsxs("table",{className:"comfy-workflow-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:s("comfy.colId")}),e.jsx("th",{scope:"col",children:s("comfy.colKind")}),e.jsx("th",{scope:"col",children:s("comfy.colOrigin")}),e.jsx("th",{scope:"col",children:s("comfy.colStatus")}),e.jsx("th",{scope:"col",children:e.jsx("span",{className:"sr-only",children:s("comfy.colActions")})})]})}),e.jsx("tbody",{children:a.map(d=>{const k=d.health?.ok===!0,E=`comfy-status-${d.id}`;return e.jsxs("tr",{children:[e.jsx("td",{children:d.label||d.id}),e.jsx("td",{children:s(d.mediaKind==="video"?"comfy.kindVideo":"comfy.kindImage")}),e.jsx("td",{className:"mono",children:d.origin}),e.jsx("td",{id:E,children:e.jsx("span",{className:k?"status-ok":"status-warn",children:s(k?"comfy.statusReady":"comfy.statusOffline")})}),e.jsx("td",{children:e.jsx("button",{type:"button",onClick:()=>{W(d.id)},disabled:A,"aria-describedby":E,children:s("comfy.remove")})})]},d.id)})})]}):null]})}),e.jsx("article",{className:"settings-row",children:e.jsxs("div",{className:"settings-row-main",children:[e.jsx("div",{className:"section-title",children:s("comfy.addTitle")}),e.jsxs("div",{className:"comfy-field",children:[e.jsx("label",{htmlFor:"comfy-file",children:s("comfy.fileLabel")}),e.jsx("input",{id:"comfy-file",ref:c,type:"file",accept:".json,.png,application/json,image/png",onChange:d=>{u(d.target.files?.[0])}})]}),e.jsxs("div",{className:"comfy-field",children:[e.jsx("label",{htmlFor:"comfy-origin",children:s("comfy.originLabel")}),e.jsxs("div",{className:"comfy-origin-row",children:[e.jsx("input",{id:"comfy-origin",value:C,onChange:d=>{L(d.target.value),M({kind:"idle"})},spellCheck:!1}),e.jsx("button",{type:"button",onClick:()=>{N()},children:s("comfy.checkOrigin")})]})]}),w.kind==="ok"?e.jsxs("div",{className:"status-ok",children:[s("comfy.originReachable"),w.detail?` (${w.detail})`:""]}):null,w.kind==="unreachable"?e.jsx("div",{className:"status-warn",children:s("comfy.originUnreachable")}):null,w.kind==="invalid"?e.jsx("div",{className:"status-err",children:s("comfy.originInvalid")}):null,m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"comfy-field",children:[e.jsx("label",{htmlFor:"comfy-id",children:s("comfy.idLabel")}),e.jsx("input",{id:"comfy-id",value:v,onChange:d=>_(d.target.value),spellCheck:!1})]}),e.jsxs("div",{className:"comfy-field",children:[e.jsx("label",{htmlFor:"comfy-label",children:s("comfy.labelLabel")}),e.jsx("input",{id:"comfy-label",value:h,onChange:d=>r(d.target.value)})]}),e.jsxs("div",{className:"comfy-field",children:[e.jsx("label",{htmlFor:"comfy-kind",children:s("comfy.kindLabel")}),e.jsxs("select",{id:"comfy-kind",value:x,onChange:d=>j(d.target.value),children:[e.jsx("option",{value:"image",children:s("comfy.kindImage")}),e.jsx("option",{value:"video",children:s("comfy.kindVideo")})]}),x==="video"?e.jsx("div",{className:"muted",children:s("comfy.videoKindHint")}):null]}),e.jsx("div",{className:"section-title",children:s("comfy.bindTitle")}),m.needsConfirmation?e.jsx("div",{className:"muted",children:s("comfy.bindAmbiguous")}):null,se.map(d=>{const k=m.candidates.filter(I=>I.field===d);if(k.length===0)return null;const E=k.some(I=>!I.unambiguous),q=`comfy-bind-${d}`;return e.jsxs("div",{className:"comfy-bind-row",children:[e.jsx("label",{htmlFor:q,children:s(`comfy.field.${d}`)}),e.jsxs("select",{id:q,value:p[d]??"",onChange:I=>f(ae=>({...ae,[d]:I.target.value})),"aria-invalid":E&&!p[d],children:[e.jsx("option",{value:"",children:s("comfy.choose")}),k.map(I=>e.jsxs("option",{value:G(I),children:[G(I)," — ",I.classType,I.title?` "${I.title}"`:""]},G(I)))]})]},d)}),e.jsx("button",{type:"button",onClick:()=>{F()},disabled:!R,children:s("comfy.register")})]}):null,$?e.jsx("div",{className:"status-err",role:"alert",children:$}):null]})})]})}const U=["providers","workspace","general"];function J({id:s,setRef:a,children:i}){const{t}=K();return e.jsxs("section",{id:s,ref:n=>a(s,n),className:"settings-section","aria-labelledby":`settings-section-${s}`,children:[e.jsx("header",{className:"settings-section__header",children:e.jsx("h3",{id:`settings-section-${s}`,children:t(`settings.sections.${s}.title`)})}),e.jsx("div",{className:"settings-section__body",children:i})]})}function ss(){const{t:s}=K(),a=S(r=>r.activeSettingsSection),i=S(r=>r.setActiveSettingsSection),t=S(r=>r.closeSettings),n=S(r=>r.openReadinessPopup),m=S(r=>r.galleryDefaultScope),g=S(r=>r.setGalleryDefaultScope),o=S(r=>r.provider),y=l.useRef(null),p=l.useRef(null),f=l.useRef(!1),v=l.useRef({providers:null,workspace:null,general:null}),_=(r,x)=>{v.current[r]=x},h=r=>{i(r),f.current=!0;const x=y.current,j=v.current[r];if(x&&j){const C=x.getBoundingClientRect().top,L=j.getBoundingClientRect().top,w=Number.parseFloat(window.getComputedStyle(j).scrollMarginTop)||0;x.scrollTo({top:x.scrollTop+L-C-w,behavior:"auto"})}p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{f.current=!1,p.current=null},120)};return l.useEffect(()=>{const r=x=>{x.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]),l.useEffect(()=>{const r=y.current;if(!r||typeof IntersectionObserver!="function")return;const x=new IntersectionObserver(j=>{if(f.current)return;const L=j.filter(w=>w.isIntersecting).sort((w,M)=>M.intersectionRatio-w.intersectionRatio)[0]?.target.id;L&&U.includes(L)&&i(L)},{root:r,threshold:[.35,.6]});for(const j of U){const C=v.current[j];C&&x.observe(C)}return()=>x.disconnect()},[i]),l.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current)},[]),e.jsx("main",{className:"settings-workspace","aria-labelledby":"settings-title",children:e.jsxs("div",{className:"settings-shell",children:[e.jsxs("header",{className:"settings-header",children:[e.jsx("div",{children:e.jsx("h2",{id:"settings-title",children:s("settings.title")})}),e.jsx("button",{type:"button",className:"settings-close",onClick:t,"aria-label":s("settings.closeAria"),title:s("settings.closeTitle"),children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]}),e.jsxs("div",{className:"settings-layout",children:[e.jsx("nav",{className:"settings-nav settings-nav--mobile","aria-label":s("settings.navAria"),children:e.jsx("div",{className:"settings-mobile-nav",role:"list",children:U.map(r=>e.jsxs("button",{type:"button",className:`settings-mobile-nav__item${a===r?" is-active":""}`,onClick:()=>h(r),"aria-current":a===r?"true":void 0,children:[e.jsx("span",{children:s(`settings.sections.${r}.title`)}),e.jsx("small",{children:s(`settings.sections.${r}.hint`)})]},r))})}),e.jsx("nav",{className:"settings-nav","aria-label":s("settings.navAria"),children:U.map(r=>e.jsxs("button",{type:"button",className:`settings-nav__item${a===r?" is-active":""}`,onClick:()=>h(r),"aria-label":s("settings.jumpTo",{section:s(`settings.sections.${r}.title`)}),children:[e.jsx("span",{children:s(`settings.sections.${r}.title`)}),e.jsx("small",{children:s(`settings.sections.${r}.hint`)})]},r))}),e.jsxs("section",{ref:y,className:"settings-content","aria-label":s("settings.contentAria"),children:[e.jsxs(J,{id:"providers",setRef:_,children:[e.jsx(Re,{}),e.jsx(Qe,{}),e.jsx(Ze,{}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("readiness.settingsTitle")}),e.jsx("p",{children:s("readiness.settingsBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx("button",{type:"button",className:"settings-action-btn",onClick:n,children:s("readiness.open")})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.imageModel.title")}),e.jsx("p",{children:s("settings.imageModel.body")}),e.jsx("p",{className:"settings-row__microcopy",children:s("settings.imageModel.unsupportedHelp")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx($e,{variant:"settings"})})]}),o==="grok"?e.jsxs(e.Fragment,{children:[e.jsx("article",{className:"settings-row",children:e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.grokCompatibility.title")}),e.jsx("p",{children:s("settings.grokCompatibility.body")})]})}),e.jsx(We,{})]}):o==="agy"||o==="gemini-api"?e.jsx("article",{className:"settings-row",children:e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s(o==="gemini-api"?"provider.geminiApiCompatTitle":"provider.agyCompatTitle")}),e.jsx("p",{children:s(o==="gemini-api"?"provider.geminiApiCompatBodyLong":"provider.agyCompatBodyLong")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.reasoning.title")}),e.jsx("p",{children:s("settings.reasoning.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(Pe,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.webSearch.title")}),e.jsx("p",{children:s("settings.webSearch.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(ke,{})})]})]})]}),e.jsxs(J,{id:"workspace",setRef:_,children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("workspace.sectionTitle")}),e.jsx("p",{children:s("workspace.sectionBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(He,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.appearance.historyStripLayoutTitle")}),e.jsx("p",{children:s("settings.appearance.historyStripLayoutBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(Ge,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.gallery.defaultScopeTitle")}),e.jsx("p",{children:s("settings.gallery.defaultScopeBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(D,{ariaLabel:s("settings.gallery.defaultScopeTitle"),value:m,onChange:r=>g(r),items:[{value:"current-session",label:s("gallery.scope.current")},{value:"all",label:s("gallery.scope.all")}]})})]})]}),e.jsxs(J,{id:"general",setRef:_,children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.language.title")}),e.jsx("p",{children:s("settings.language.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(Be,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.theme.title")}),e.jsx("p",{children:s("settings.theme.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(Fe,{})})]})]})]})]})]})})}export{ss as SettingsWorkspace};
@@ -1 +0,0 @@
1
- import{u as h,j as e,a as m,b as x}from"./index-TU0_IXQH.js";import{P as j}from"./AssetGenWorkspace-wsNksO-Q.js";import"./KeyingPanel-DYJN_oNF.js";import"./useAgentDialogFocus-D741d8_6.js";function v({draft:i,disabled:s,errors:l,onChange:a,onSubmit:n}){const{t:r}=h(),c=t=>e.jsxs("label",{children:[r(`sprite.recipe.${t}`),e.jsx("input",{value:i[t],disabled:s,"aria-invalid":!!l[t],onChange:p=>a({[t]:p.target.value})}),l[t]?e.jsx("span",{role:"alert",children:l[t]}):null]});return e.jsxs("form",{className:"sprite-recipe-form",onSubmit:t=>{t.preventDefault(),n()},children:[c("name"),c("characterId"),c("description"),c("style"),c("baseAssetId"),e.jsxs("fieldset",{children:[e.jsx("legend",{children:r("sprite.cell.title")}),["width","height","safeMarginX","safeMarginY"].map(t=>e.jsxs("label",{children:[r(`sprite.cell.${t}`),e.jsx("input",{type:"number",min:"0",value:i.cell[t],onChange:p=>a({cell:{...i.cell,[t]:Number(p.target.value)}})})]},t))]}),e.jsxs("label",{children:[r("sprite.chroma.hex"),e.jsx("input",{type:"color",value:i.chroma.hex,onChange:t=>a({chroma:{...i.chroma,hex:t.target.value}})})]}),e.jsxs("fieldset",{children:[e.jsx("legend",{children:r("sprite.states.title")}),i.states.map((t,p)=>e.jsxs("div",{className:"sprite-state",children:[e.jsx("input",{"aria-label":r("sprite.states.key"),value:t.key,onChange:d=>a({states:i.states.map((o,u)=>u===p?{...o,key:d.target.value}:o)})}),e.jsx("input",{"aria-label":r("sprite.states.frames"),type:"number",min:"1",value:t.frames,onChange:d=>a({states:i.states.map((o,u)=>u===p?{...o,frames:Number(d.target.value)}:o)})}),e.jsx("button",{type:"button",onClick:()=>a({states:i.states.filter((d,o)=>o!==p)}),children:r("sprite.states.remove")})]},`${t.key}-${p}`)),e.jsx("button",{type:"button",onClick:()=>a({states:[...i.states,{key:"",frames:4,fps:8,loop:!0,action:""}]}),children:r("sprite.states.add")})]}),e.jsx("button",{className:"assetgen-generate",disabled:s||!i.name.trim()||!i.characterId.trim(),children:r(s?"sprite.recipe.saving":"sprite.recipe.save")})]})}function g({recipe:i,candidate:s,generating:l,onGenerate:a,onApprove:n}){const{t:r}=h(),[c,t]=m.useState(!1);return e.jsxs("section",{className:"sprite-anchor-gate","aria-labelledby":"sprite-anchor-title",children:[e.jsx("h2",{id:"sprite-anchor-title",children:r("sprite.anchor.title")}),s?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:s.url,alt:""}),e.jsx("p",{children:r("sprite.anchor.candidate")}),e.jsx("button",{onClick:a,disabled:l,children:r("sprite.anchor.regenerate")}),e.jsx("button",{onClick:()=>t(!0),children:r("sprite.anchor.approve")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{children:r(i.anchorStatus==="approved"?"sprite.anchor.approved":"sprite.anchor.missing")}),e.jsx("button",{onClick:a,disabled:l,children:r(l?"sprite.anchor.generating":"sprite.anchor.generate")})]}),c?e.jsxs("div",{className:"sprite-anchor-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sprite-confirm-title",children:[e.jsx("h3",{id:"sprite-confirm-title",children:r("sprite.anchor.confirmTitle")}),e.jsx("p",{children:r("sprite.anchor.confirmBody")}),e.jsx("button",{onClick:()=>t(!1),children:r("sprite.anchor.cancel")}),e.jsx("button",{onClick:()=>{n(s.assetId),t(!1)},children:r("sprite.anchor.confirm")})]}):null]})}function b({recipe:i,selected:s,onSelectionChange:l,onGenerate:a,onCancel:n,onPreview:r}){const{t:c}=h();return e.jsxs("section",{className:"sprite-row-list","aria-live":"polite",children:[e.jsx("h2",{children:c("sprite.rows.title")}),e.jsxs("div",{className:"sprite-row-actions",children:[e.jsx("button",{onClick:()=>a(),children:c("sprite.rows.generateAll")}),e.jsx("button",{disabled:!s.length,onClick:()=>a(s),children:c("sprite.rows.generateSelected")})]}),i.rows.map(t=>e.jsxs("article",{children:[e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:s.includes(t.stateKey),onChange:()=>l(s.includes(t.stateKey)?s.filter(p=>p!==t.stateKey):[...s,t.stateKey])}),t.stateKey]}),e.jsx("span",{children:c(`sprite.rows.status.${t.status}`)}),t.progress!=null?e.jsx("progress",{value:t.progress,max:"100"}):null,t.imageUrl||t.previewUrl?e.jsxs("button",{onClick:()=>r(t),children:[e.jsx("img",{src:t.imageUrl||t.previewUrl,alt:""}),c("sprite.rows.preview")]}):null,t.status==="error"?e.jsx("button",{onClick:()=>a([t.stateKey]),children:c("sprite.rows.regenerate")}):null,t.requestId&&(t.status==="running"||t.status==="queued")?e.jsx("button",{onClick:()=>n(t.requestId),children:c("sprite.rows.cancel")}):null,t.error?e.jsx("p",{role:"alert",children:t.error}):null]},t.stateKey))]})}function C(){const{t:i}=h(),s=x();m.useEffect(()=>{s.loadSpriteRecipes()},[]);const l=s.activeSpriteRecipe,a=s.spriteRecipeDraft.name.trim()?{}:{name:i("sprite.error.INVALID_SPRITE_RECIPE")};return e.jsxs("section",{className:"sprite-recipe-workspace",children:[e.jsxs("aside",{children:[e.jsx(j,{}),e.jsxs("label",{children:[i("sprite.recipe.select"),e.jsxs("select",{value:s.activeSpriteRecipeId??"",onChange:n=>{s.selectSpriteRecipe(n.target.value||null)},children:[e.jsx("option",{value:"",children:i("sprite.recipe.new")}),s.spriteRecipes.map(n=>e.jsx("option",{value:n.id,children:n.name},n.id))]})]}),e.jsx(v,{draft:s.spriteRecipeDraft,disabled:s.spriteRecipeSaving,errors:a,onChange:s.updateSpriteRecipeDraft,onSubmit:()=>{s.saveSpriteRecipe()}})]}),e.jsxs("main",{children:[s.spriteRecipeError?e.jsxs("div",{role:"alert",children:[s.spriteRecipeError,e.jsx("button",{onClick:()=>{s.loadSpriteRecipes()},children:i("sprite.retry")})]}):null,s.spriteRecipeLoading?e.jsx("p",{role:"status",children:i("sprite.loading")}):l?l.anchorStatus!=="approved"?e.jsx(g,{recipe:l,candidate:l.candidate??null,generating:s.spriteRecipeGenerating,onGenerate:()=>{s.generateSpriteAnchor()},onApprove:n=>{s.approveSpriteAnchor(n)}}):e.jsx(b,{recipe:l,selected:s.spriteSelectedStates,onSelectionChange:n=>x.setState({spriteSelectedStates:n}),onGenerate:n=>{s.generateSpriteRows(n)},onCancel:n=>{s.cancelSpriteJob(n)},onPreview:()=>{}}):e.jsxs("div",{className:"sprite-empty",children:[e.jsx("h2",{children:i("sprite.empty.title")}),e.jsx("p",{children:i("sprite.empty.body")})]})]})]})}export{C as SpriteRecipeWorkspace};