1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BawMCgu8.js","assets/locale-en-B8Z5F_o1.js","assets/locale-zh-CN-CFdD1mPv.js","assets/locale-fr-j4CMJpfE.js","assets/locale-de-DuE2gagy.js","assets/locale-it-C6yb6RzN.js","assets/locale-ja-VjZBy5eF.js","assets/locale-ko-Cl0W-Az5.js","assets/locale-es-DwboUZze.js","assets/locale-zh-Hant-uT5aTnfX.js","assets/locale-ru-DEr1xfTZ.js","assets/locale-id-Buh3Uolz.js","assets/locale-pt-BR-CqD5J4_0.js","assets/index-BpvGeALH.css","assets/PoseEditor3D-qnOQP0Sb.js","assets/OrbitControls-DYqG4YG1.js","assets/three.module-ClqPj1K9.js","assets/pipeline-BcFGB0IF.js","assets/zoom-in-CWl6FHRb.js","assets/utensils-crossed-DkdXdCqk.js","assets/focus-B2P-yv9L.js","assets/rotate-cw-Cs8sg7VG.js","assets/pen-line-Fq8TC4Qi.js","assets/html2canvas.esm-CBrSDip1.js","assets/save-BInnCtLF.js","assets/jszip.min-CCODYnd_.js","assets/_commonjs-dynamic-modules-TDtrdbi3.js","assets/table-DvUKeEob.js"])))=>i.map(i=>d[i]); 2import{a as Be,de as Ti,c9 as Ei,p as Et,af as Le,df as Ki,bm as me,ag as Si,be as ai,o as li,S as mt,dg as pt,b7 as st,b as re,j as e,C as fe,b6 as Pi,dh as je,cb as Ri,r as u,c0 as Kt,c1 as St,b3 as xe,ar as Ue,L as ee,X as Re,c4 as Pt,bf as nt,aT as he,di as _e,c3 as pe,T as Ke,g as we,ak as Rt,D as Fe,M as gt,cd as Ve,k as vt,ab as Ai,O as zi,w as $i,_ as At,d as Li,cf as Oi,I as oi,dj as Hi,F as Mi,aV as Fi,aW as Bi,cq as Wi,b_ as Ht}from"./index-BawMCgu8.js";import{M as kt,S as It,V as Ie,w as Gi}from"./three.module-ClqPj1K9.js";import{u as ae,p as $e,C as qi}from"./pipeline-BcFGB0IF.js";import{Z as Vi}from"./zoom-in-CWl6FHRb.js";import{U as Di}from"./utensils-crossed-DkdXdCqk.js";import{F as Xi}from"./focus-B2P-yv9L.js";import{R as ci}from"./rotate-cw-Cs8sg7VG.js";import{P as zt}from"./pen-line-Fq8TC4Qi.js";import di from"./html2canvas.esm-CBrSDip1.js";import{S as $t}from"./save-BInnCtLF.js";import{J as Yi}from"./jszip.min-CCODYnd_.js";import{T as Ji}from"./table-DvUKeEob.js";/** 3 * @license lucide-react v0.309.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const Zi=Be("Apple",[["path",{d:"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z",key:"3s7exb"}],["path",{d:"M10 2c1 .5 2 2 2 5",key:"fcco2y"}]]);/** 8 * @license lucide-react v0.309.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const Qi=Be("Combine",[["rect",{width:"8",height:"8",x:"2",y:"2",rx:"2",key:"z1hh3n"}],["path",{d:"M14 2c1.1 0 2 .9 2 2v4c0 1.1-.9 2-2 2",key:"83orz6"}],["path",{d:"M20 2c1.1 0 2 .9 2 2v4c0 1.1-.9 2-2 2",key:"k86dmt"}],["path",{d:"M10 18H5c-1.7 0-3-1.3-3-3v-1",key:"6vokjl"}],["polyline",{points:"7 21 10 18 7 15",key:"1k02g0"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]]);/** 13 * @license lucide-react v0.309.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const es=Be("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** 18 * @license lucide-react v0.309.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const ts=Be("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** 23 * @license lucide-react v0.309.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const pi=Be("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** 28 * @license lucide-react v0.309.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const mi=Be("PackageOpen",[["path",{d:"M20.91 8.84 8.56 2.23a1.93 1.93 0 0 0-1.81 0L3.1 4.13a2.12 2.12 0 0 0-.05 3.69l12.22 6.93a2 2 0 0 0 1.94 0L21 12.51a2.12 2.12 0 0 0-.09-3.67Z",key:"1vy178"}],["path",{d:"m3.09 8.84 12.35-6.61a1.93 1.93 0 0 1 1.81 0l3.65 1.9a2.12 2.12 0 0 1 .1 3.69L8.73 14.75a2 2 0 0 1-1.94 0L3 12.51a2.12 2.12 0 0 1 .09-3.67Z",key:"s3bv25"}],["line",{x1:"12",x2:"12",y1:"22",y2:"13",key:"1o4xyi"}],["path",{d:"M20 13.5v3.37a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13.5",key:"1na2nq"}]]);/** 33 * @license lucide-react v0.309.0 - ISC 34 * 35 * This source code is licensed under the ISC license. 36 * See the LICENSE file in the root directory of this source tree. 37 */const is=Be("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** 38 * @license lucide-react v0.309.0 - ISC 39 * 40 * This source code is licensed under the ISC license. 41 * See the LICENSE file in the root directory of this source tree. 42 */const ui=Be("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}
42],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** 43 * @license lucide-react v0.309.0 - ISC 44 * 45 * This source code is licensed under the ISC license. 46 * See the LICENSE file in the root directory of this source tree. 47 */const xi=Be("Watch",[["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["polyline",{points:"12 10 12 12 13 13",key:"19dquz"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}]]),Ae={upload:st,removebg:It,tryon:pt,scene:kt,detail_img:mt,size:ui,caption:li,desc:zt,video:ai,export:mi,angles:ci,feature:Xi,specs:Si,rotate:me,unbox:Ki,texture:Le,swatch:Et,ingredient:es,plating:Di,nutrition:Zi,room:ts,dimension:pi,material:Ei,combo:Qi,macro:Vi,wearing:xi,sizeref:Ti};function ss(i,t,r){return i!=null&&i.status&&i.status!=="locked"?i.status:t<=r?"active":"locked"}function rs({stepDefs:i,stepStates:t,currentStep:r,onSelect:s}){const{t:l}=re();return e.jsxs("aside",{className:"w-56 shrink-0 border-r border-ui-border bg-[var(--bg-secondary)] overflow-y-auto hidden md:flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 pb-2 text-[10px] uppercase tracking-widest text-[var(--text-tertiary)] font-medium",children:l("pipeline.ui.stepsLabel")}),e.jsx("nav",{className:"flex-1 pb-4",children:i.map((a,o)=>{const n=t.find(I=>I.id===a.id),c=ss(n,o,r),d=o===r,p=c==="locked"&&a.id!=="export";return e.jsxs("button",{onClick:()=>!p&&s(o),disabled:p,className:` 48 w-full flex items-center gap-2.5 px-4 py-2 text-left text-[13px] transition-all 49 ${d?"bg-ui-accent/10 border-r-2 border-r-ui-accent":"border-r-2 border-r-transparent"} 50 ${p?"opacity-25 cursor-not-allowed":"hover:bg-[var(--bg-tertiary)] cursor-pointer"} 51 `,children:[e.jsx(ns,{index:o,stepId:a.id,status:c,isActive:d}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`font-medium truncate leading-tight ${d?"text-[var(--text-primary)]":"text-[var(--text-secondary)]"}`,children:l(a.nameKey)}),d&&e.jsx("div",{className:"text-[11px] text-[var(--text-tertiary)] truncate mt-0.5 leading-tight",children:l(a.descKey)})]}),a.core&&!["completed","skipped"].includes(c)&&e.jsx("span",{className:"text-[9px] px-1 py-px rounded bg-ui-accent/10 text-ui-accent font-medium shrink-0",children:l("pipeline.ui.core")}),c==="skipped"&&e.jsx("span",{className:"text-[9px] px-1 py-px rounded bg-[var(--warning)]/10 text-[var(--warning)] font-medium shrink-0",children:l("pipeline.ui.skipped")})]},a.id)})})]})}function ns({stepId:i,status:t,isActive:r}){const s="w-6 h-6 rounded-md flex items-center justify-center text-[11px] font-bold shrink-0 transition-all",l=Ae[i]||Le;return t==="completed"?e.jsx("div",{className:`${s} bg-[var(--success)] text-white`,children:e.jsx(fe,{className:"w-3 h-3"})}):t==="skipped"?e.jsx("div",{className:`${s} bg-[var(--warning)] text-white`,children:e.jsx(Pi,{className:"w-3 h-3"})}):t==="error"?e.jsx("div",{className:`${s} bg-[var(--error)] text-white`,children:e.jsx(je,{className:"w-3 h-3"})}):r?e.jsx("div",{className:`${s} bg-ui-accent text-white shadow-sm shadow-ui-accent/30`,children:e.jsx(l,{className:"w-3.5 h-3.5"})}):t==="locked"?e.jsx("div",{className:`${s} bg-[var(--bg-tertiary)] text-[var(--text-tertiary)]`,children:e.jsx(Ri,{className:"w-3 h-3"})}):e.jsx("div",{className:`${s} bg-[var(--bg-tertiary)] text-[var(--text-secondary)]`,children:e.jsx(l,{className:"w-3.5 h-3.5"})})}function hi({stepDef:i,stepState:t,isLoading:r,onExecute:s,onNext:l}){var X,W,ne;const{t:a}=re(),o=u.useRef(null),[n,c]=u.useState([]),[d,p]=u.useState(!1),[I,N]=u.useState(""),[k,K]=u.useState(!1),{openPicker:C,PickerElement:A}=Kt(),{showSourceChoice:_,sourceChoiceOpen:E,pickSource:P}=St(),z=async()=>{var O;const V=await _();if(V==="local")(O=o.current)==null||O.click();else if(V==="library"){const $=await C("image","upload");$&&c(Y=>[...Y,{url:$.url,preview:$.url,fromLibrary:!0}])}},f=async V=>{if(!V)return;N("");const O=Array.from(V).slice(0,10-n.length);if(O.length!==0){p(!0);try{const $=await Promise.all(O.map(async Y=>{const R=URL.createObjectURL(Y);return{url:(await nt.uploadImage(Y)).data.url,preview:R,fromLibrary:!1}}));c(Y=>[...Y,...$].slice(0,10))}catch{N(a("pipeline.common.uploadFailed"))}finally{p(!1)}}},U=V=>{c(O=>(O[V].fromLibrary||URL.revokeObjectURL(O[V].preview),O.filter(($,Y)=>Y!==V)))},L=()=>
51{if(n.length===0)return;const V=n.map(O=>O.url);s(i.id,"generate",{files:V})},S=()=>{c(V=>(V.forEach(O=>{O.fromLibrary||URL.revokeObjectURL(O.preview)}),[])),N(""),K(!0)},D=(t==null?void 0:t.status)==="completed",q=u.useRef(t==null?void 0:t.status);return u.useEffect(()=>{const V=q.current,O=t==null?void 0:t.status;k&&V==="active"&&O==="completed"&&(K(!1),c($=>($.forEach(Y=>{Y.fromLibrary||URL.revokeObjectURL(Y.preview)}),[]))),q.current=O},[t==null?void 0:t.status,k]),e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(st,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),a(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-6",children:a(i.descKey)}),D&&!k?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[var(--success)] font-medium mb-3",children:[e.jsx(st,{className:"w-4 h-4"})," ",a("pipeline.common.uploadedCount",{count:((W=(X=t==null?void 0:t.result)==null?void 0:X.files)==null?void 0:W.length)||0})]}),((ne=t==null?void 0:t.result)==null?void 0:ne.files)&&e.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 lg:grid-cols-5 gap-3",children:t.result.files.map((V,O)=>e.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-[var(--bg-tertiary)]",children:e.jsx("img",{src:V,alt:"",crossOrigin:xe(V),className:"w-full h-full object-cover"})},O))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:S,disabled:r,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",a("pipeline.common.reupload")]}),l&&e.jsxs("button",{onClick:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[a("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):e.jsxs(e.Fragment,{children:[n.length===0&&e.jsx("div",{onClick:d?void 0:z,"aria-busy":d,className:`border-2 border-dashed rounded-xl p-12 text-center transition-all ${d?"border-ui-accent/60 bg-ui-accent/[0.04] cursor-wait pointer-events-none":"border-ui-border cursor-pointer hover:border-ui-accent/50 hover:bg-ui-accent/[0.02]"}`,children:d?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-10 h-10 mx-auto mb-3 text-ui-accent animate-spin"}),e.jsxs("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:[a("pipeline.common.uploading"),"..."]}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:a("pipeline.common.pleaseWait")})]}):e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-10 h-10 mx-auto mb-3 text-[var(--text-tertiary)]"}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)]",children:a("pipeline.common.clickToUpload")}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:a("pipeline.common.supportedFormats")})]})}),e.jsx("input",{ref:o,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:V=>{f(V.target.files),V.target.value=""}}),I&&e.jsx("div",{className:"text-[var(--error)] text-sm mt-3",children:I}),n.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 lg:grid-cols-5 gap-3",children:[n.map((V,O)=>e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-[var(--bg-tertiary)] group",children:[e.jsx("img",{src:V.preview,alt:"",crossOrigin:xe(V.preview),className:"w-full h-full object-cover"}),V.fromLibrary&&e.jsx("span",{className:"absolute bottom-1 left-1 text-[9px] px-1 py-px rounded bg-black/60 text-white",children:a("pipeline.common.library")}),e.jsx("button",{onClick:()=>U(O),className:"absolute top-1 right-1 w-5 h-5 rounded-full bg-black/70 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:e.jsx(Re,{className:"w-3 h-3"})})]},O)),n.length<10&&e.jsx("button",{onClick:z,disabled:d,"aria-busy":d,className:`aspect-square rounded-lg border-2 border-dashed flex flex-col items-center justify-center transition-all ${d?"border-ui-accent/60 bg-ui-accent/[0.04] text-ui-accent cursor-wait":"border-ui-border text-[var(--text-tertiary)] hover:border-ui-accent/50 hover:text-ui-accent cursor-pointer"}`,children:d?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-5 h-5 mb-1 animate-spin"}),e.jsx("span",{className:"text-[10px]",children:a("pipeline.common.uploadingShort")})]}):e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-5 h-5 mb-1"}),e.jsx("span",{className:"text-[10px]",children:a("pipeline.common.add")})]})})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[e.jsx("button",{onClick:L,disabled:r||d,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:a("pipeline.common.confirmUpload",{count:n.length})}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[n.length,"/10"]})]})]})]}),e.jsx(Pt,{open:E,onClose:()=>P(null),onLocal:()=>P("local"),onLibrary:()=>P("library")}),A]})}function as({stepDef:i,stepState:t,allStepStates:r,isLoading:s,onExecute:l,onNext:a}){var k,K;const{t:o}=re(),n=t==null?void 0:t.status,c=ae(C=>
51C.executingStepId),d=r.find(C=>C.id==="upload"),p=((k=d==null?void 0:d.result)==null?void 0:k.files)||[],I=((K=t==null?void 0:t.result)==null?void 0:K.files)||[],N=c===i.id;return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(It,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),o(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-4",children:o(i.descKey)}),e.jsxs("div",{className:"rounded-lg bg-[var(--bg-secondary)] border border-ui-border p-4 mb-5 text-sm text-[var(--text-secondary)] space-y-2",children:[e.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:o("pipeline.stepUI.removebg.benefitTitle")}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-tertiary)]",children:[e.jsxs("li",{children:["⢠",e.jsx("b",{className:"text-[var(--text-secondary)]",children:o("pipeline.stepUI.removebg.benefit1Bold")})," â ",o("pipeline.stepUI.removebg.benefit1Detail")]}),e.jsxs("li",{children:["⢠",e.jsx("b",{className:"text-[var(--text-secondary)]",children:o("pipeline.stepUI.removebg.benefit2Bold")})," â ",o("pipeline.stepUI.removebg.benefit2Detail")]}),e.jsxs("li",{children:["⢠",e.jsx("b",{className:"text-[var(--text-secondary)]",children:o("pipeline.stepUI.removebg.benefit3Bold")})," â ",o("pipeline.stepUI.removebg.benefit3Detail")]})]}),n!=="completed"&&n!=="skipped"&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] pt-1",children:o("pipeline.stepUI.removebg.skipHint")})]}),p.length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 mb-5",children:p.map((C,A)=>{const _=I[A],E=n==="completed"&&_;return e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden border border-ui-border",children:[e.jsx("img",{src:C,alt:"",crossOrigin:xe(C),className:"w-full h-full object-cover"}),E&&e.jsxs("div",{className:"absolute inset-0",style:{background:"repeating-conic-gradient(#e2e8f0 0% 25%, #fff 0% 50%) 50% / 16px 16px"},children:[e.jsx("img",{src:_,alt:"",crossOrigin:xe(_),className:"w-full h-full object-contain"}),e.jsx("div",{className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-[var(--success)] text-white flex items-center justify-center",children:e.jsx(fe,{className:"w-3 h-3"})})]}),N&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",style:{backgroundColor:"rgba(255,255,255,0.55)",backdropFilter:"blur(6px)"},children:[e.jsx("div",{className:"absolute inset-0 animate-shimmer",style:{background:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%)",backgroundSize:"200% 100%"}}),e.jsx("div",{className:"relative w-8 h-8 border-[3px] border-[var(--accent-primary)]/30 border-t-[var(--accent-primary)] rounded-full animate-spin"})]})]},A)})}),n==="completed"&&e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm text-[var(--success)] flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",o("pipeline.stepUI.removebg.completedTitle")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[o("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:()=>l(i.id,"generate"),disabled:s,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",o("pipeline.common.regenerate")]}),e.jsxs("button",{onClick:a,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[o("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}),n==="error"&&e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||o("pipeline.common.processingFailed")]}),e.jsxs("button",{onClick:()=>l(i.id,"retry"),disabled:s,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[s?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3.5 h-3.5 inline mr-1"}),o("pipeline.common.retry")]})]}),n!=="completed"&&n!=="error"&&e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>l(i.id,"generate"),disabled:s,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:N?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1.5"}),o("pipeline.common.processing")]}):e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-4 h-4 inline mr-1.5"}),o("pipeline.stepUI.removebg.startAction"),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]})}),!i.required&&!N&&e.jsxs("button",{onClick:()=>{l(i.id,"skip"),a()},disabled:s,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",o("pipeline.common.skipNext")]})]})]})}const ls={tryon:{_desc:"è¯ç©¿/è¯ç¨æ¥éª¤çé¢ç½®æ¨¡ç¹å¾",legacyBaseUrl:"https://uniai-pri.uniai.one/4a5b088d-bade-499a-aebc-47b1fefde43f/images/2026-04-13",publicPrefix:"pipeline-preset
51s/tryon",assets:[{id:"asian_female",file:"e7350a14-8d76-4ebc-a9c7-de90e7dc6a54.png"},{id:"asian_male",file:"9023a276-b841-4f60-a592-f76a9800a953.png"},{id:"western_female",file:"f3b51e19-1845-4ef1-9a97-4ba4638dd65a.png"},{id:"western_male",file:"c39e19d7-0fa0-4e56-a9db-19c8510c3ae8.png"},{id:"asian_female_2",file:"f0be2b82-b49d-4b7c-babb-9b166b8773b5.png"},{id:"asian_female_3",file:"1a176583-cc3e-4512-962d-266570dad2ba.png"},{id:"western_female_2",file:"a6ae2e0a-4a08-4f49-9689-b33731c3c9d2.png"},{id:"plus_size_female",file:"40787ad9-5dfd-4c93-bf38-ac2767364daf.png"}]},scene:{_desc:"æ¢åºæ¯æ¥éª¤çé¢ç½®åºæ¯å¾ï¼ç± nano-banana-pro çæï¼",legacyBaseUrl:"https://uniai-pri.uniai.one/4a5b088d-bade-499a-aebc-47b1fefde43f/generated/2026-04-14",publicPrefix:"pipeline-presets/scene",assets:[{id:"business_office",file:"d8aab972-b81f-4ecf-a2cf-274e36c57591.png"},{id:"luxury_marble",file:"96c8fcf2-63d2-45c7-9226-295d86269f7f.png"},{id:"natural_wood",file:"8f2b90b3-4f2c-457e-a86e-e090f2a7a3b0.png"},{id:"urban_street",file:"f969c171-4242-4fc4-9f8d-40c7069fef62.png"},{id:"beach_sunset",file:"0c0b3a2d-ce28-428c-b2d6-96f7cf898d5c.png"},{id:"minimal_white",file:"14fd5674-d5a0-48e4-a54b-83870f34099f.png"},{id:"cafe_warm",file:"a0a35d60-8427-4d89-afc0-3ef31b84121e.png"},{id:"studio_grey",file:"8c0435e1-6a52-49f9-868d-fcb6dc008763.png"},{id:"forest_green",file:"99044e36-ccf1-4018-b014-2bd63957ca71.png"},{id:"rooftop_night",file:"514a9585-3690-4413-8a0e-dba9f641a38c.png"},{id:"snow_winter",file:"beb9b526-31cb-4af5-936c-a0377bb54179.png"},{id:"industrial_loft",file:"1f9d1b47-c22d-4935-b4a8-025cc47b88b8.png"}]}},os={groups:ls},gi=os;function cs(i,t){return`${gi.groups[i].legacyBaseUrl}/${t.file}`}function ve(i,t){var s;const r=(s=gi.groups[i])==null?void 0:s.assets.find(l=>l.id===t);return r?cs(i,r):(console.error(`[preset-assets] æªç¥é¢ç½®ç´ æ ${i}/${t}ï¼preset-assets.json ä¸ç»ä»¶å¸¸éä¸åæ¥ï¼`),"")}const ds="nano-banana-pro",ps=195,ms=[{id:"business_office",labelKey:"pipeline.stepUI.scene.presets.default.business_office",prompt:"modern minimalist office interior, clean white desk, large floor-to-ceiling window with natural daylight",image:ve("scene","business_office")},{id:"luxury_marble",labelKey:"pipeline.stepUI.scene.presets.default.luxury_marble",prompt:"polished white Carrara marble surface with subtle gold veins, elegant luxury product display platform, soft studio lighting",image:ve("scene","luxury_marble")},{id:"natural_wood",labelKey:"pipeline.stepUI.scene.presets.default.natural_wood",prompt:"warm oak wooden tabletop with green potted plants in background, soft diffused daylight",image:ve("scene","natural_wood")},{id:"urban_street",labelKey:"pipeline.stepUI.scene.presets.default.urban_street",prompt:"urban Tokyo street at dusk with subtle neon signs, cinematic wet pavement reflection",image:ve("scene","urban_street")},{id:"beach_sunset",labelKey:"pipeline.stepUI.scene.presets.default.beach_sunset",prompt:"tropical sandy beach at golden hour sunset, warm orange and pink sky, gentle ocean waves",image:ve("scene","beach_sunset")},{id:"minimal_white",labelKey:"pipeline.stepUI.scene.presets.default.minimal_white",prompt:"pure seamless white paper studio backdrop, cyclorama infinity curve, clean minimal aesthetic, soft even overhead lighting",image:ve("scene","minimal_white")},{id:"cafe_warm",labelKey:"pipeline.stepUI.scene.presets.default.cafe_warm",prompt:"cozy cafe interior with warm amber tungsten lighting, wooden furniture, soft bokeh background",image:ve("scene","cafe_warm")},{id:"studio_grey",labelKey:"pipeline.stepUI.scene.presets.default.studio_grey",prompt:"professional photography studio grey seamless backdrop, soft diffused key light from the front",image:ve("scene","studio_grey")},{id:"forest_green",labelKey:"pipeline.stepUI.scene.presets.default.forest_green",prompt:"lush green forest clearing with tall trees, soft dappled sunlight filtering through leaves, mossy ground",image:ve("scene","forest_green")},{id:"rooftop_night",labelKey:"pipeline.stepUI.scene.presets.default.rooftop_night",prompt:"rooftop terrace at night with city skyline and twinkling lights, modern minimalist railing, cinematic moody blue hour",image:ve("scene","rooftop_night")},{id:"snow_winter",labelKey:"pipeline.stepUI.scene.presets.default.snow_winter",prompt:"serene winter snow landscape, soft cool blue daylight, pristine untouched white snow, bare birch trees",image:ve("scene","snow_winter")},{id:"industrial_loft",labelKey:"pipeline.stepUI.scene.presets.default.industrial_loft",prompt:"industrial loft interior with exposed red brick wall, polished concrete floor, large iron-frame windows, soft natural light",image:ve("scene","industrial_loft")}],us=[{id:"compare_hand_hold",labelKey:"pipeline.stepUI.scene.presets.specCompare.compare_hand_hold",prompt:"human hand naturally holding the product from the side, realistic skin tone, clean white studio background, demonstrating real-world size, product photography lifestyle shot"},{id:"compare_two_hands",labelKey:"pipeline.stepUI.scene.presets.specCompare.compare_two_hands",prompt:"both human hands gently cupping the product, natural skin tone, clean light grey background, showing scale and ergonomics"},{id:"compare_a4_paper",labelKey:"pipeline.stepUI.scene.presets.specCompare.compare_a4_paper",prompt:"product placed on white A4 paper sheet on a clean desk, top-down 90-degree view, demonstrating clear size reference against known object"},{id:"compare_coin",labelKey:"pipeline.stepUI.scene.presets.specCompare.compare_coin",prompt:"product next to a one-dollar US coin on clean white surface, top-down view, providing absolute size reference"},{id:"compare_desk_laptop",labelKey:"pipeline.stepUI.scene.presets.specCompare.compare_desk_laptop",prompt:"product placed next to a closed modern laptop on a wooden desk, showing relative size to everyday tech item, soft natural light"},{id:"compare_pocket",labelKey:"pipeline.stepUI.scene.presets.specCompare.compare_pocket",prompt:"product partially visible inside a jeans front pocket, demonstrating portability and pocketability, clean background"}],xs=[{id:"scene_desk_work",labelKey:"pipeline.stepUI.scene.presets.3c.scene_desk_work",prompt:"modern wooden desk with open laptop, notebook, plants, coffee cup, product placed in foreground, soft natural morning daylight, productivity aesthetic"},{id:"scene_gaming",labelKey:"pipeline.stepUI.scene.presets.3c.scene_gaming",prompt:"RGB-lit gaming setup with mechanical keyboard and dual curved monitors, neon purple and cyan ambient lighting, cyberpunk style, product as hero item"},{id:"scene_business_trip",labelKey:"pipeline.stepUI.scene.presets.3c.scene_business_trip",prompt:"airport lounge or business class seat with leather armrest, premium leather luggage, product placed beside, warm tungsten evening light"},{id:"scene_cafe",labelKey:"pipeline.stepUI.scene.presets.3c.scene_cafe",prompt:"cozy specialty coffee shop with wood tables, soft bokeh of window light and plants, product next to latte art cup, relaxed lifestyle vibe"},{id:"scene_meeting",labelKey:"pipeline.stepUI.scene.presets.3c.scene_meeting",prompt:"modern corporate meeting room with glass walls, long wooden conference table, product in foreground, cool professional lighting"},{id:"scene_outdoor_hike",labelKey:"pipeline.stepUI.scene.presets.3c.scene_outdoor_hike",prompt:"outdoor mountain hiking trail with scenic background, product held or placed on a rock, golden hour natural light, adventure lifestyle"},{id:"scene_gym",labelKey:"pipeline.stepUI.scene.presets.3c.scene_gym",prompt:"modern gym interior with dumbbells and exercise equipment in soft background blur, product placed on bench, energetic fitness lifestyle"},{id:"scene_living_room",labelKey:"pipeline.stepUI.scene.presets.3c.scene_living_room",prompt:"warm modern Scandinavian living room with grey sofa, plants, floor lamp, product on coffee table, cozy evening ambient light"}],hs=[{id:"beauty_vanity",labelKey:"pipeline.stepUI.scene.presets.beauty.beauty_vanity",prompt:"elegant dressing vanity with vintage tri-fold mirror, velvet chair, soft tulle curtains, morning window light, arranged cosmetics aesthetic, feminine interior"},{id:"beauty_bathroom",labelKey:"pipeline.stepUI.scene.presets.beauty.beauty_bathroom",prompt:"modern bright bathroom counter with white marble surface, glass shelves, rolled towels, natural daylight from window, clean luxury spa aesthetic"},{id:"beauty_bedroom_morning",labelKey:"pipeline.stepUI.scene.presets.beauty.beauty_bedroom_morning",prompt:"soft silk sheets and fluffy pillows on bed in morning sunlight, cozy feminine bedroom, sheer curtains, warm golden daylight, lifestyle beauty"},{id:"beauty_afternoon_tea",labelKey:"pipeline.stepUI.scene.presets.beauty.beauty_afternoon_tea",prompt:"elegant afternoon tea setup with porcelain teacup, delicate pastries, silk scarf draped on chair, golden afternoon light, Parisian feminine aesthetic"},{id:"beauty_makeup_studio",labelKey:"pipeline.stepUI.scene.presets.beauty.beauty_makeup_studio",prompt:"professional makeup studio with large Hollywood vanity mirror, round warm LED bulbs, organized brushes, soft pink walls, backstage beauty atmosphere"},{id:"beauty_spa_natural",labelKey:"pipeline.stepUI.scene.presets.beauty.beauty_spa_natural",prompt:"natural SPA setting with eucalyptus plants, wooden tray, folded white towels, soft candles, zen bamboo aesthetic, warm natural lighting"}],gs=[{id:"food_family_table",labelKey:"pipeline.stepUI.scene.presets.food.food_family_table",prompt:"warm family dining table with wooden surface, vintage plates, natural golden daylight from window, homely cozy atmosphere, inviting home-cooked meal aesthetic"},{id:"food_morning_breakfast",labelKey:"pipeline.stepUI.scene.presets.food.food_morning_breakfast",prompt:"bright morning breakfast table with linen napkin, coffee cup, orange juice, soft sunrise daylight, fresh Scandinavian minimalist kitchen aesthetic"},{id:"food_picnic_outdoor",labelKey:"pipeline.stepUI.scene.presets.food.food_picnic_outdoor",prompt:"outdoor picnic blanket on green grass, wicker basket, wildflowers, warm afternoon sunshine, summertime lifestyle food photography"},{id:"food_afternoon_tea",labelKey:"pipeline.stepUI.scene.presets.food.food_afternoon_tea",prompt:"elegant afternoon tea spread with tiered stand, porcelain teacups, macarons, lace tablecloth, Parisian boutique aesthetic, soft natural light"},{id:"food_office_snack",labelKey:"pipeline.stepUI.scene.presets.food.food_office_snack",prompt:"modern office desk with laptop, notebook, coffee cup, snack food placed beside, productive daytime lighting, professional lifestyle setting"},{id:"food_late_night",labelKey:"pipeline.stepUI.scene.presets.food.food_late_night",prompt:"cozy late-night kitchen counter with warm amber tungsten lighting, steaming food, urban
51night ambiance, indulgent midnight snack aesthetic"},{id:"food_camping_fire",labelKey:"pipeline.stepUI.scene.presets.food.food_camping_fire",prompt:"outdoor camping scene with cast iron pan over campfire, wooden logs, soft dusk light, natural outdoor cooking lifestyle, adventure food photography"}],bs=[{id:"jewelry_vanity",labelKey:"pipeline.stepUI.scene.presets.jewelry.jewelry_vanity",prompt:"elegant feminine vanity table with vintage tri-fold mirror, perfume bottles, silk scarf draped, soft morning window light, luxury boudoir aesthetic"},{id:"jewelry_gift_box",labelKey:"pipeline.stepUI.scene.presets.jewelry.jewelry_gift_box",prompt:"opened luxury jewelry gift box with satin ribbon, love letter card, rose petals scattered, warm romantic candlelight, proposal / Valentine context"},{id:"jewelry_wedding",labelKey:"pipeline.stepUI.scene.presets.jewelry.jewelry_wedding",prompt:"elegant wedding preparation scene with white lace veil, wedding bouquet, champagne flute, soft bridal suite lighting, dreamy romantic atmosphere"},{id:"jewelry_valentine",labelKey:"pipeline.stepUI.scene.presets.jewelry.jewelry_valentine",prompt:"romantic Valentine setup with red roses, silk ribbon, heart-shaped candles, warm ambient lighting, deep red accent palette, luxurious romantic evening aesthetic"},{id:"jewelry_haute_couture",labelKey:"pipeline.stepUI.scene.presets.jewelry.jewelry_haute_couture",prompt:"haute couture fashion backdrop with silk gown fabric, designer studio mood, dramatic editorial lighting, Vogue magazine high-fashion aesthetic"},{id:"jewelry_afternoon_tea",labelKey:"pipeline.stepUI.scene.presets.jewelry.jewelry_afternoon_tea",prompt:"elegant afternoon tea setup with porcelain teacup, pastel macarons, silk napkin, golden afternoon sunlight, refined Parisian boutique vibe"}],ys=[{id:"home_living_room",labelKey:"pipeline.stepUI.scene.presets.home.home_living_room",prompt:"modern Scandinavian living room with L-shape grey sofa, wooden coffee table, large area rug, floor-to-ceiling window with sheer curtains, potted plants, soft natural daylight"},{id:"home_bedroom",labelKey:"pipeline.stepUI.scene.presets.home.home_bedroom",prompt:"cozy warm bedroom with queen bed, linen bedding, woven headboard, bedside nightstand with table lamp, large window, morning golden sunlight"},{id:"home_kitchen",labelKey:"pipeline.stepUI.scene.presets.home.home_kitchen",prompt:"modern farmhouse kitchen with marble countertop, white cabinetry, stainless steel appliances, pendant lights, fresh herbs on windowsill, bright clean aesthetic"},{id:"home_balcony",labelKey:"pipeline.stepUI.scene.presets.home.home_balcony",prompt:"urban balcony with green potted plants, rattan lounge chair, wooden side table, sheer curtain, warm afternoon sunshine, relaxed outdoor living aesthetic"},{id:"home_study",labelKey:"pipeline.stepUI.scene.presets.home.home_study",prompt:"quiet study with wooden desk, ergonomic chair, tall bookshelf full of books, green banker lamp, large window with soft light, scholarly atmosphere"},{id:"home_dining",labelKey:"pipeline.stepUI.scene.presets.home.home_dining",prompt:"elegant dining room with long wooden table, pendant lamp hanging above, cushioned dining chairs, decorative wall art, warm evening ambient lighting"},{id:"home_entryway",labelKey:"pipeline.stepUI.scene.presets.home.home_entryway",prompt:"welcoming entryway foyer with console table, decorative mirror, coat rack, ceramic vase with dried flowers, soft natural light from adjacent hallway"},{id:"home_kids_room",labelKey:"pipeline.stepUI.scene.presets.home.home_kids_room",prompt:"bright cheerful kids bedroom with colorful rug, small wooden bed, toy storage baskets, plush animals, playful decor, warm friendly atmosphere"}];function fs(i,t){if(t==="3c"){if(i==="spec_compare")return us;if(i==="scene")return xs}return t==="beauty"&&i==="scene"?hs:t==="food"&&i==="scene"?gs:t==="home"&&i==="room"?ys:t==="jewelry"&&i==="scene"?bs:ms}const jt=[{id:"natural",labelKey:"pipeline.stepUI.scene.lighting.natural",prompt:"natural daylight, soft diffused shadows, realistic"},{id:"soft",labelKey:"pipeline.stepUI.scene.lighting.soft",prompt:"soft diffused lighting, even illumination, minimal shadows"},{id:"dramatic",labelKey:"pipeline.stepUI.scene.lighting.dramatic",prompt:"dramatic high-contrast lighting, strong shadows, moody"},{id:"backlit",labelKey:"pipeline.stepUI.scene.lighting.backlit",prompt:"backlit with rim light edge highlights, glowing silhouette"},{id:"golden",labelKey:"pipeline.stepUI.scene.lighting.golden",prompt:"warm golden hour light, amber glow, soft long shadows"},{id:"cool",labelKey:"pipeline.stepUI.scene.lighting.cool",prompt:"cool blue daylight, crisp clean look"},{id:"studio",labelKey:"pipeline.stepUI.scene.lighting.studio",prompt:"studio key light with fill, professional product photography lighting"},{id:"neon",labelKey:"pipeline.stepUI.scene.lighting.neon",prompt:"neon accent lighting, cyberpunk color palette, vibrant"}],vs=[{id:"3:4",label:"3:4"},{id:"1:1",label:"1:1"},{id:"4:3",label:"4:3"},{id:"9:16",label:"9:16"}];let js=0;function ws({stepDef:i,stepState:t,allStepStates:r,category:s,isLoading:l,onExecute:a,onNext:o}){var w,te,ce,ye;const{t:n}=re(),c=fs(i.id,s),d=t==null?void 0:t.status,p=ae(m=>
51m.executingStepId),I=ae(m=>m.project),N=p===i.id,k=I?`pipeline-scene-tasks:${I.id}`:null,K=Ae[i.id]||kt,C=r.find(m=>m.id==="tryon"),A=r.find(m=>m.id==="removebg"),_=r.find(m=>m.id==="upload"),E=((C==null?void 0:C.status)==="completed"?(w=C==null?void 0:C.result)==null?void 0:w.files:[])||[],P=((A==null?void 0:A.status)==="completed"?(te=A==null?void 0:A.result)==null?void 0:te.files:[])||[],z=((_==null?void 0:_.status)==="completed"?(ce=_==null?void 0:_.result)==null?void 0:ce.files:[])||[],f=[...E.map(m=>({url:m,kind:"model"})),...P.map(m=>({url:m,kind:"product"})),...z.map(m=>({url:m,kind:"product"}))],[U,L]=u.useState([]),[S,D]=u.useState(!1),[q,X]=u.useState(""),[W,ne]=u.useState(!1),V=u.useRef(null),{openPicker:O,PickerElement:$}=Kt(),{showSourceChoice:Y,sourceChoiceOpen:R,pickSource:ie}=St();u.useEffect(()=>{$e.getCustomScenes().then(m=>{L(m.map(G=>({id:G.id,label:G.label,image:G.imageUrl,prompt:G.prompt,isCustom:!0})))}).catch(()=>{})},[]);const le=[...c,...U],[Z,be]=u.useState([]),[v,T]=u.useState(!1);u.useEffect(()=>{if(!(!k||v)){try{const m=localStorage.getItem(k);if(m){const G=JSON.parse(m);Array.isArray(G)&&be(G)}}catch{}T(!0)}},[k,v]),u.useEffect(()=>{if(!(!k||!v))try{Z.length===0?localStorage.removeItem(k):localStorage.setItem(k,JSON.stringify(Z))}catch{}},[k,Z,v]);const[H,B]=u.useState(null);u.useEffect(()=>{if(!H)return;const m=Q=>{Q.key==="Escape"&&B(null)};document.addEventListener("keydown",m);const G=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",m),document.body.style.overflow=G}},[H]);const[y,x]=u.useState(!1),[j,h]=u.useState(0),[g,M]=u.useState("business_office"),[b,F]=u.useState("natural"),[oe,ge]=u.useState("3:4"),ue=()=>{h(0),M("business_office"),F("natural"),ge("3:4"),x(!0)},Ne=(m,G)=>{const Q=le.find(de=>de.id===m);return Q!=null&&Q.labelKey?n(Q.labelKey):(Q==null?void 0:Q.label)||G},ke=(m,G)=>{const Q=jt.find(de=>de.id===m);return Q?n(Q.labelKey):G},qe=()=>{const m=le.find(de=>de.id===g),G=jt.find(de=>de.id===b),Q=f[j];!m||!G||!Q||(be(de=>[...de,{id:`s${++js}_${Date.now()}`,inputImage:Q.url,inputKind:Q.kind,sceneId:m.id,sceneImage:m.image,sceneLabel:m.labelKey?n(m.labelKey):m.label||"",scenePrompt:m.prompt,lightingId:G.id,lightingLabel:n(G.labelKey),lightingPrompt:G.prompt,aspectRatio:oe}]),x(!1))},at=()=>{if(Z.length===0)return;const m=Z.map(G=>({inputImage:G.inputImage,inputKind:G.inputKind,sceneId:G.sceneId,sceneImage:G.sceneImage,sce
51nePrompt:G.scenePrompt,lightingId:G.lightingId,lightingPrompt:G.lightingPrompt,aspectRatio:G.aspectRatio}));a(i.id,"generate",{tasks:m})},lt=(m,G)=>{const Q=`/api/v1/image/download?url=${encodeURIComponent(m)}`,de=document.createElement("a");de.href=Q,de.download=`${i.id}-${Date.now()}-${G+1}.png`,document.body.appendChild(de),de.click(),document.body.removeChild(de)},yt=async()=>{var G;const m=await Y();if(m==="local")(G=V.current)==null||G.click();else if(m==="library"){const Q=await O("image","upload");Q&&await Ye(Q.url,n("pipeline.stepUI.scene.customSceneDefaultLabel"),"","upload",Q.id)}},ft=async m=>{if(m!=null&&m.length)try{const G=await nt.uploadImage(m[0]);await Ye(G.data.url,n("pipeline.stepUI.scene.customSceneDefaultLabel"),"","upload",G.data.id)}catch{}},Ye=async(m,G,Q,de,Te)=>{try{const Oe=await $e.createCustomScene({label:G,imageUrl:m,imageAssetId:Te,prompt:Q,source:de}),Je={id:Oe.id,label:Oe.label,image:Oe.imageUrl,prompt:Oe.prompt,isCustom:!0};L(Ci=>[...Ci,Je]),M(Je.id)}catch{}},ot=async m=>{try{await $e.deleteCustomScene(m),L(G=>G.filter(Q=>Q.id!==m)),g===m&&M("business_office")}catch{}},ct=async()=>{var m,G;if(!(!q.trim()||W)){ne(!0);try{const Q=`Product photography background scene, ${q}, no people, empty scene, atmospheric, professional, 4K`,de=await Ve.post("/image/generate",{prompt:Q,model:ds,count:1,aspectRatio:"4:3"});for(let Te=0;Te<30;Te++){await new Promise(Je=>setTimeout(Je,3e3));const Oe=await Ve.get(`/image/task/${de.data.taskId}`);if(Oe.data.status==="completed"&&((m=Oe.data.images)!=null&&m[0])){const Je=((G=Oe.data.assetIds)==null?void 0:G[0])??void 0;await Ye(Oe.data.images[0],q.slice(0,12)||n("pipeline.stepUI.scene.aiSceneDefaultLabel"),q,"ai_generated",Je),D(!1),X("");break}if(Oe.data.status==="failed")break}}catch{}finally{ne(!1)}}};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(K,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),n(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:n(i.descKey)}),e.jsxs("div",{className:"space-y-5 mt-4",children:[f.length===0&&e.jsxs("div",{className:"rounded-lg border border-[var(--warning)]/30 bg-[var(--warning)]/5 p-3 text-sm text-[var(--warning)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",n("pipeline.stepUI.scene.noInputImagesWarning")]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.scene.taskListTitle")}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:n("pipeline.stepUI.scene.taskCount",{count:Z.length})})]}),Z.length===0?e.jsxs("div",{className:"rounded-xl border-2 border-dashed border-ui-border p-8 text-center",children:[e.jsx(kt,{className:"w-8 h-8 mx-auto mb-2 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:n("pipeline.stepUI.scene.emptyTitle")}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:n("pipeline.stepUI.scene.emptyHint")})]}):e.jsx("div",{className:"space-y-2",children:Z.map((m,G)=>{var Q;return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-ui-border bg-[var(--bg-secondary)]",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)] w-5 text-center",children:G+1}),e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-[var(--bg-tertiary)] shrink-0",children:e.jsx(pe,{url:m.inputImage,alt:"",crossOrigin:xe(m.inputImage),className:"w-full h-full object-cover"})}),e.jsx("span",{className:"text-[var(--text-tertiary)] text-xs",children:"+"}),e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-[var(--bg-tertiary)] shrink-0 flex items-center justify-center text-lg",children:m.sceneImage?e.jsx(pe,{url:m.sceneImage,alt:"",crossOrigin:xe(m.sceneImage),className:"w-full h-full object-cover"}):e.jsx("span",{children:((Q=le.find(de=>de.id===m.sceneId))==null?void 0:Q.emoji)??"ð¨"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-[var(--text-primary)] truncate",children:Ne(m.sceneId,m.sceneLabel)}),e.jsxs("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:[ke(m.lightingId,m.lightingLabel)," · ",m.aspectRatio]})]}),e.jsx("button",{onClick:()=>be(de=>de.filter(Te=>Te.id!==m.id)),className:"p-1 rounded-md hover:bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer transition-colors shrink-0",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},m.id)})}),Z.length<6&&f.length>0&&e.jsxs("button",{onClick:ue,className:"mt-3 w-full flex items-center justify-center gap-2 py-2.5 rounded-xl border border-dashed border-ui-border text-sm text-[var(--text-secondary)] hover:border-ui-accent/50 hover:text-ui-accent transition-all cursor-pointer",children:[e.jsx(we,{className:"w-4 h-4"})," ",n("pipeline.stepUI.scene.addCombo",{count:Z.length})]}),Z.length>=6&&e.jsx("p",{className:"mt-2 text-xs text-[var(--text-tertiary)] text-center",children:n("pipeline.stepUI.scene.maxReached")})]}),y&&e.jsxs("div",{className:"rounded-xl border border-ui-accent/30 bg-ui-accent/[0.03] p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.scene.configTitle")}),e.jsx("button",{onClick:()=>x(!1),className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer",children:e.jsx(Re,{className:"w-4 h-4"})})]}),f.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.scene.selectInputImage")}),e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1",children:f.map((m,G)=>
51e.jsxs("button",{onClick:()=>h(G),className:`relative w-14 h-14 rounded-lg overflow-hidden shrink-0 border-2 transition-all cursor-pointer ${j===G?"border-ui-accent ring-1 ring-ui-accent/30":"border-transparent hover:border-ui-border"}`,children:[e.jsx(pe,{url:m.url,alt:"",className:"w-full h-full object-cover"}),e.jsx("span",{className:`absolute bottom-0 left-0 right-0 text-[9px] text-white text-center leading-[12px] ${m.kind==="model"?"bg-blue-600/80":"bg-gray-700/80"}`,children:m.kind==="model"?n("pipeline.stepUI.scene.kindModel"):n("pipeline.stepUI.scene.kindProduct")})]},G))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.scene.selectScene")}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-2",children:[le.map(m=>{const G=m.labelKey?n(m.labelKey):m.label;return e.jsxs("button",{onClick:()=>M(m.id),className:`relative rounded-lg overflow-hidden transition-all cursor-pointer ${g===m.id?"ring-2 ring-ui-accent":"hover:ring-1 hover:ring-ui-border"}`,children:[e.jsx("div",{className:"aspect-[4/3] bg-gradient-to-br from-[var(--bg-tertiary)] to-[var(--bg-secondary)] flex items-center justify-center relative",children:m.image?e.jsx(pe,{url:m.image,alt:G,className:"absolute inset-0 w-full h-full object-cover"}):e.jsx("span",{className:"text-2xl",children:m.emoji})}),e.jsx("div",{className:"text-[10px] text-center py-0.5 bg-[var(--bg-secondary)] truncate px-1",children:G}),g===m.id&&e.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-ui-accent text-white flex items-center justify-center",children:e.jsx(fe,{className:"w-2.5 h-2.5"})}),m.isCustom&&e.jsx("button",{onClick:Q=>{Q.stopPropagation(),ot(m.id)},className:"absolute top-1 left-1 w-4 h-4 rounded-full bg-black/60 text-white flex items-center justify-center cursor-pointer",children:e.jsx(Re,{className:"w-2.5 h-2.5"})})]},m.id)}),e.jsxs("button",{onClick:()=>D(!0),className:"rounded-lg border border-dashed border-ui-border flex flex-col items-center justify-center aspect-[4/3] text-[var(--text-tertiary)] hover:text-ui-accent cursor-pointer text-[10px]",children:[e.jsx(Le,{className:"w-4 h-4 mb-0.5"}),n("pipeline.stepUI.scene.aiGenerate")]}),e.jsxs("button",{onClick:yt,className:"rounded-lg border border-dashed border-ui-border flex flex-col items-center justify-center aspect-[4/3] text-[var(--text-tertiary)] hover:text-ui-accent cursor-pointer text-[10px]",children:[e.jsx(Rt,{className:"w-4 h-4 mb-0.5"}),n("pipeline.stepUI.scene.upload")]})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-ui-accent/20 bg-[var(--bg-secondary)] p-3 space-y-2",children:[e.jsx("input",{type:"text",value:q,onChange:m=>X(m.target.value),placeholder:n("pipeline.stepUI.scene.aiPromptPlaceholder"),className:"w-full px-3 py-1.5 rounded-lg bg-[var(--bg-primary)] border border-ui-border text-xs text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] focus:outline-none focus:border-ui-accent"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:ct,disabled:W||!q.trim(),className:"inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-lg bg-ui-accent text-white text-xs hover:opacity-90 disabled:opacity-50 cursor-pointer",children:[W?e.jsx(ee,{className:"w-3 h-3 animate-spin"}):e.jsx(Le,{className:"w-3 h-3"}),W?e.jsx("span",{children:n("pipeline.stepUI.scene.generating")}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n("pipeline.common.generate")}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 opacity-70",children:[e.jsx(he,{className:"w-3 h-3"}),ps]})]})]}),e.jsx("button",{onClick:()=>D(!1),className:"text-xs text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer",children:n("pipeline.stepUI.scene.cancel")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.scene.lightingEffect")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:jt.map(m=>e.jsx("button",{onClick:()=>F(m.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${b===m.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:n(m.labelKey)},m.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.scene.outputSize")}),e.jsx("div",{className:"flex gap-1.5",children:vs.map(m=>e.jsx("button",{onClick:()=>ge(m.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${oe===m.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:m.label},m.id))})]}),e.jsxs("button",{onClick:qe,className:"w-full py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 cursor-pointer transition-all flex items-center justify-center gap-1.5",children:[e.jsx(we,{className:"w-4 h-4"})," ",n("pipeline.stepUI.scene.addToList")]})]}),d==="completed"&&((ye=t==null?void 0:t.result)==null?void 0:ye.files)&&t.result.files.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium flex items-center gap-2 text-sm",children:[e.jsx(fe,{className:"w-4 h-4"})," ",n("pipeline.stepUI.scene.fullResult",{count:t.result.files.length}),t.creditsUsed!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[n("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),(()=>{const m=t.result.files,G=m.length<=2?420:m.length<=4?300:220;return e.jsx("div",{className:"flex flex-wrap gap-3",children:m.map((Q,de)=>e.jsxs("div",{className:"relative group rounded-lg overflow-hidden cursor-zoom-in",onClick:()=>B(Q),children:[e.jsx(pe,{url:Q,alt:"",className:"block w-auto h-auto object-contain",style:{maxHeight:`${G}px`}}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors pointer-events-none"}),e.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1",children:[e.jsx("button",{type:"button",onClick:Te=>{Te.stopPropagation(),lt(Q,de)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.scene.download"),children:e.jsx(Fe,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:Te=>{Te.stopPropagation(),B(Q)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.scene.zoomView"),children:e.jsx(gt,{className:"w-4 h-4"})})]})]},de))})})()]}),d==="error"&&e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||n("pipeline.stepUI.scene.generationFailed")]}),e.jsx("div",{className:"flex gap-3",children:d==="completed"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:at,disabled:l||Z.length===0,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[N?e.jsx(ee,{className:"w-3 h-3 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3 h-3 inline mr-1"}),n(N?"pipeline.stepUI.scene.generating":"pipeline.common.regenerate")]}),e.jsxs("button",{onClick:o,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[n("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]}):d==="error"?e.jsxs("button",{onClick:()=>a(i.id,"retry"),disabled:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[N?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.retry")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:at,disabled:l||Z.length===0,className:"inline-flex items-center justify-center gap-1.5 px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[N?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:n("pipeline.stepUI.scene.startGenerate",{count:Z.length})}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost*Z.length]})]}),!i.required&&e.jsxs("button",{onClick:()=>{a(i.id,"skip"),o()},disabled:l,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.skipNext")]})]})})]}),e.jsx("input",{ref:V,type:"file",accept:"image/*",className:"hidden",onChange:m=>{ft(m.target.files),m.target.value=""}}),e.jsx(Pt,{open:R,onClose:()=>ie(null),onLocal:()=>ie("local"),onLibrary:()=>ie("library")}),$,H&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-8 cursor-zoom-out",onClick:()=>B(null),role:"dialog","aria-modal":"true",children:[e.jsx(pe,{url:H,alt:"",onClick:m=>m.stopPropagation(),crossOrigin:xe(H),className:"max-w-[90vw] max-h-[90vh] object-contain cursor-default select-none rounded-lg shadow-2xl"}),e.jsx("button",{type:"button",onClick:m=>{m.stopPropagation(),B(null)},className:"absolute top-4 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/25 backdrop-blur text-white flex items-center justify-center cursor-pointer transition-colors","aria-label":n("pipeline.stepUI.scene.close"),children:e.jsx(Re,{className:"w-5 h-5"})})]})]})}const Ns=[2,4];function ks({stepDef:i,stepState:t,allStepStates:r,isLoading:s,onExecute:l,onNext:a}){var P,z;const{t:o}=re(),n=t==null?void 0:t.status,d=ae(f=>
51f.executingStepId)===i.id,p=Ae[i.id]||mt,I=r.find(f=>f.id==="upload"),N=((P=I==null?void 0:I.result)==null?void 0:P.files)||[],[k,K]=u.useState(()=>N.map((f,U)=>U)),[C,A]=u.useState(2),_=f=>{K(U=>U.includes(f)?U.filter(L=>L!==f):[...U,f])},E=()=>{l(i.id,"generate",{selectedIndices:k,scale:C})};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:o(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:o(i.descKey)}),n==="completed"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",o("pipeline.stepUI.cropUpscale.completedTitle")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[o("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),((z=t==null?void 0:t.result)==null?void 0:z.files)&&t.result.files.length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:t.result.files.map((f,U)=>e.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-[var(--bg-tertiary)]",children:e.jsx("img",{src:f,alt:"",crossOrigin:xe(f),className:"w-full h-full object-cover"})},U))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:E,disabled:s,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",o("pipeline.common.regenerate")]}),e.jsxs("button",{onClick:a,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[o("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):n==="error"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--error)]/30 bg-[var(--error)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--error)] font-medium mb-2 flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",o("pipeline.common.error")]}),e.jsx("div",{className:"text-sm text-[var(--error)]",children:(t==null?void 0:t.error)||o("pipeline.common.unknownError")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>l(i.id,"retry"),disabled:s,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[s?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-4 h-4 inline mr-1"}),o("pipeline.common.retry")]})})]}):e.jsxs("div",{className:"space-y-6",children:[N.length>0?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.cropUpscale.selectImagesLabel")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:N.map((f,U)=>e.jsxs("button",{type:"button",onClick:()=>_(U),className:`relative aspect-square rounded-xl overflow-hidden border-2 transition-all cursor-pointer ${k.includes(U)?"border-ui-accent ring-2 ring-ui-accent/30":"border-ui-border hover:border-[var(--text-tertiary)]"}`,children:[e.jsx("img",{src:f,alt:"",crossOrigin:xe(f),className:"w-full h-full object-cover"}),k.includes(U)&&e.jsx("div",{className:"absolute top-2 right-2 w-6 h-6 rounded-full bg-ui-accent text-white flex items-center justify-center",children:e.jsx(fe,{className:"w-3.5 h-3.5"})})]},U))}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-2",children:o("pipeline.stepUI.cropUpscale.selectionCount",{selected:k.length,total:N.length})})]}):e.jsxs("div",{className:"rounded-xl border border-ui-border bg-[var(--bg-secondary)] p-8 text-center",children:[e.jsx(p,{className:"w-12 h-12 mx-auto mb-3 text-[var(--text-tertiary)]"}),e.jsx("div",{className:"text-[var(--text-secondary)] text-sm",children:o("pipeline.stepUI.cropUpscale.pleaseUploadFirst")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.cropUpscale.factorLabel")}),e.jsx("div",{className:"flex gap-2",children:Ns.map(f=>e.jsxs("button",{onClick:()=>A(f),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${C===f?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:[f,"x"]},f))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:E,disabled:s||k.length===0,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[d?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(p,{className:"w-4 h-4 inline mr-1"}),o("pipeline.stepUI.cropUpscale.upscaleAction",{count:k.length}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{l(i.id,"skip"),a()},disabled:s,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",o("pipeline.common.skipNext")]})]})]})]})}const dt=1,Ze=4,Is=[{id:"fabric",labelKey:"pipeline.stepUI.detail.types.clothing.fabric.label",descKey:"pipeline.stepUI.detail.types.clothing.fabric.desc",emoji:"ð§µ"},{id:"stitching",labelKey:"pipeline.stepUI.detail.types.clothing.stitching.label",descKey:"pipeline.stepUI.detail.types.clothing.stitching.desc",emoji:"âï¸"},{id:"branding",labelKey:"pipeline.stepUI.detail.types.clothing.branding.label",descKey:"pipeline.stepUI.detail.types.clothing.branding.desc",emoji:"ð·ï¸"},{id:"hardware",labelKey:"pipeline.stepUI.detail.types.clothing.hardware.label",descKey:"pipeline.stepUI.detail.types.clothing.hardware.desc",emoji:"ð"},{id:"trim",labelKey:"pipeline.stepUI.detail.types.clothing.trim.label",descKey:"pipeline.stepUI.detail.types.clothing.trim.desc",emoji:"ð"},{id:"pattern",labelKey:"pipeline.stepUI.detail.types.clothing.pattern.label",descKey:"pipeline.stepUI.detail.types.clothing.pattern.desc",emoji:"ð¸"}],_s=[{id:"port",labelKey:"pipeline.stepUI.detail.types.3c.port.label",descKey:"pipeline.stepUI.detail.types.3c.port.desc",emoji:"ð"},{id:"button",labelKey:"pipeline.stepUI.detail.types.3c.button.label",descKey:"pipeline.stepUI.detail.types.3c.button.desc",emoji:"âºï¸"}
51,{id:"tech_logo",labelKey:"pipeline.stepUI.detail.types.3c.tech_logo.label",descKey:"pipeline.stepUI.detail.types.3c.tech_logo.desc",emoji:"ð·ï¸"},{id:"material_tech",labelKey:"pipeline.stepUI.detail.types.3c.material_tech.label",descKey:"pipeline.stepUI.detail.types.3c.material_tech.desc",emoji:"â¨"},{id:"screen_ui",labelKey:"pipeline.stepUI.detail.types.3c.screen_ui.label",descKey:"pipeline.stepUI.detail.types.3c.screen_ui.desc",emoji:"ð±"},{id:"hinge_joint",labelKey:"pipeline.stepUI.detail.types.3c.hinge_joint.label",descKey:"pipeline.stepUI.detail.types.3c.hinge_joint.desc",emoji:"ð©"},{id:"speaker_mesh",labelKey:"pipeline.stepUI.detail.types.3c.speaker_mesh.label",descKey:"pipeline.stepUI.detail.types.3c.speaker_mesh.desc",emoji:"ð"},{id:"indicator_led",labelKey:"pipeline.stepUI.detail.types.3c.indicator_led.label",descKey:"pipeline.stepUI.detail.types.3c.indicator_led.desc",emoji:"ð¡"}],Us=[{id:"cream_gloss",labelKey:"pipeline.stepUI.detail.types.beauty.cream_gloss.label",descKey:"pipeline.stepUI.detail.types.beauty.cream_gloss.desc",emoji:"ð§"},{id:"liquid_flow",labelKey:"pipeline.stepUI.detail.types.beauty.liquid_flow.label",descKey:"pipeline.stepUI.detail.types.beauty.liquid_flow.desc",emoji:"ð¦"},{id:"powder_burst",labelKey:"pipeline.stepUI.detail.types.beauty.powder_burst.label",descKey:"pipeline.stepUI.detail.types.beauty.powder_burst.desc",emoji:"â¨"},{id:"foam_rich",labelKey:"pipeline.stepUI.detail.types.beauty.foam_rich.label",descKey:"pipeline.stepUI.detail.types.beauty.foam_rich.desc",emoji:"ð«§"},{id:"serum_drop",labelKey:"pipeline.stepUI.detail.types.beauty.serum_drop.label",descKey:"pipeline.stepUI.detail.types.beauty.serum_drop.desc",emoji:"ð"},{id:"lipstick_swatch",labelKey:"pipeline.stepUI.detail.types.beauty.lipstick_swatch.label",descKey:"pipeline.stepUI.detail.types.beauty.lipstick_swatch.desc",emoji:"ð"}],Cs=[{id:"cross_section",labelKey:"pipeline.stepUI.detail.types.food.cross_section.label",descKey:"pipeline.stepUI.detail.types.food.cross_section.desc",emoji:"ðª"},{id:"texture_shine",labelKey:"pipeline.stepUI.detail.types.food.texture_shine.label",descKey:"pipeline.stepUI.detail.types.food.texture_shine.desc",emoji:"â¨"},{id:"portion_size",labelKey:"pipeline.stepUI.detail.types.food.portion_size.label",descKey:"pipeline.stepUI.detail.types.food.portion_size.desc",emoji:"ð½"},{id:"steam_rising",labelKey:"pipeline.stepUI.detail.types.food.steam_rising.label",descKey:"pipeline.stepUI.detail.types.food.steam_rising.desc",emoji:"â¨ï¸"},{id:"garnish_detail",labelKey:"pipeline.stepUI.detail.types.food.garnish_detail.label",descKey:"pipeline.stepUI.detail.types.food.garnish_detail.desc",emoji:"ð¿"},{id:"sauce_drizzle",labelKey:"pipeline.stepUI.detail.types.food.sauce_drizzle.label",descKey:"pipeline.stepUI.detail.types.food.sauce_drizzle.desc",emoji:"ð«"}],Ts=[{id:"fabric_texture",labelKey:"pipeline.stepUI.detail.types.home.fabric_texture.label",descKey:"pipeline.stepUI.detail.types.home.fabric_texture.desc",emoji:"ð§µ"},{id:"joint_craft",labelKey:"pipeline.stepUI.detail.types.home.joint_craft.label",descKey:"pipeline.stepUI.detail.types.home.joint_craft.desc",emoji:"ðª"},{id:"hardware_fitting",labelKey:"pipeline.stepUI.detail.types.home.hardware_fitting.label",descKey:"pipeline.stepUI.detail.types.home.hardware_fitting.desc",emoji:"ð©"},{id:"edge_finish",labelKey:"pipeline.stepUI.detail.types.home.edge_finish.label",descKey:"pipeline.stepUI.detail.types.home.edge_finish.desc",emoji:"ð"},{id:"inner_filling",labelKey:"pipeline.stepUI.detail.types.home.inner_filling.label",descKey:"pipeline.stepUI.detail.types.home.inner_filling.desc",emoji:"ðï¸"},{id:"surface_coating",labelKey:"pipeline.stepUI.detail.types.home.surface_coating.label",descKey:"pipeline.stepUI.detail.types.home.surface_coating.desc",emoji:"ð¨"}],Es=[{id:"prong_setting",labelKey:"pipeline.stepUI.detail.types.jewelry.prong_setting.label",descKey:"pipeline.stepUI.detail.types.jewelry.prong_setting.desc",emoji:"ð "},{id:"bezel_setting",labelKey:"pipeline.stepUI.detail.types.jewelry.bezel_setting.label",descKey:"pipeline.stepUI.detail.types.jewelry.bezel_setting.desc",emoji:"âª"},{id:"chain_weave",labelKey:"pipeline.stepUI.detail.types.jewelry.chain_weave.label",descKey:"pipeline.stepUI.detail.types.jewelry.chain_weave.desc",emoji:"ð"},{id:"clasp_detail",labelKey:"pipeline.stepUI.detail.types.jewelry.clasp_detail.label",descKey:"pipeline.stepUI.detail.types.jewelry.clasp_detail.desc",emoji:"ðª"},{id:"logo_engraving",labelKey:"pipeline.stepUI.detail.types.jewelry.logo_engraving.label",descKey:"pipeline.stepUI.detail.types.jewelry.logo_engraving.desc",emoji:"ð·ï¸"},{id:"polish_face",labelKey:"pipeline.stepUI.detail.types.jewelry.polish_face.label",descKey:"pipeline.stepUI.detail.types.jewelry.polish_face.desc",emoji:"â¨"}];function Ks(i,t){return i==="detail"?t==="beauty"?{types:Us,defaults:["cream_gloss","liquid_flow","serum_drop","lipstick_swatch"]}:t==="food"?{types:Cs,defaults:["cross_section","texture_shine","garnish_detail","sauce_drizzle"]}:t==="home"?{types:Ts,defaults:["fabric_texture","joint_craft","hardware_fitting","edge_finish"]}:t==="jewelry"?{types:Es,defaults:["prong_setting","chain_weave","clasp_detail","polish_face"]}:{types:_s,defaults:["port","button","material_tech","tech_logo"]}:{types:Is,defaults:["fabric","stitching","hardware","pattern"]}}const Ss=[{id:"1:1",label:"1:1"},{id:"4:3",label:"4:3"},{id:"3:4",label:"3:4"}];let Ps=0;function Rs({stepDef:i,stepState:t,allStepStates:r,category:s,isLoading:l,onExecute:a,onNext:o}){var H,B,y;const{t:n}=re(),c=t==null?void 0:t.status,d=ae(x=>
51x.executingStepId),p=ae(x=>x.project),I=d===i.id,N=p?`pipeline-detail-tasks:${p.id}`:null,k=Ae[i.id]||mt,{types:K,defaults:C}=Ks(i.id,s),A=r.find(x=>x.id==="removebg"),_=r.find(x=>x.id==="upload"),E=((A==null?void 0:A.status)==="completed"?(H=A==null?void 0:A.result)==null?void 0:H.files:[])||[],P=((_==null?void 0:_.status)==="completed"?(B=_==null?void 0:_.result)==null?void 0:B.files:[])||[],z=E.length>0?E:P,[f,U]=u.useState([]),[L,S]=u.useState(!1);u.useEffect(()=>{if(!(!N||L)){try{const x=localStorage.getItem(N);if(x){const j=JSON.parse(x);if(Array.isArray(j)){const h=j.filter(g=>g&&typeof g.inputImage=="string").map(g=>{if(Array.isArray(g.detailTypes)&&g.detailTypes.length>=dt&&g.detailTypes.length<=Ze&&Array.isArray(g.detailLabels))return g;const M=Array.isArray(g.detailTypes)?g.detailTypes:typeof g.detailType=="string"?[g.detailType]:[],b=M.length>=dt?M.slice(0,Ze):C.slice(0,Ze),F=b.map(oe=>{const ge=K.find(ue=>ue.id===oe);return ge?g(ge.labelKey):oe});return{id:typeof g.id=="string"?g.id:`d_migrated_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,inputImage:g.inputImage,detailTypes:b,detailLabels:F,aspectRatio:typeof g.aspectRatio=="string"?g.aspectRatio:"1:1"}});U(h)}}}catch{}S(!0)}},[N,L]),u.useEffect(()=>{if(!(!N||!L))try{f.length===0?localStorage.removeItem(N):localStorage.setItem(N,JSON.stringify(f))}catch{}},[N,f,L]);const[D,q]=u.useState(null);u.useEffect(()=>{if(!D)return;const x=h=>{h.key==="Escape"&&q(null)};document.addEventListener("keydown",x);const j=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",x),document.body.style.overflow=j}},[D]);const[X,W]=u.useState(!1),[ne,V]=u.useState(0),[O,$]=u.useState(C),[Y,R]=u.useState("1:1"),ie=()=>{V(0),$(C),R("1:1"),W(!0)},le=x=>{$(j=>j.includes(x)?j.filter(h=>h!==x):j.length>=Ze?[...j.slice(1),x]:[...j,x])},Z=O.length>=dt&&O.length<=Ze,be=()=>{const x=z[ne];if(!x||!Z)return;const j=O.map(g=>{const M=K.find(b=>b.id===g);return M?n(M.labelKey):g}),h={id:`d${++Ps}_${Date.now()}`,inputImage:x,detailTypes:[...O],detailLabels:j,aspectRatio:Y};U(g=>[...g,h].slice(0,6)),W(!1)},v=()=>{if(f.length===0)return;const x=f.map(j=>({inputImage:j.inputImage,detailTypes:j.detailTypes,aspectRatio:j.aspectRatio}));a(i.id,"generate",{tasks:x})},T=(x,j)=>{const h=`/api/v1/image/download?url=${encodeURIComponent(x)}`,g=document.createElement("a");g.href=h,g.download=`${i.id}-${Date.now()}-${j+1}.png`,document.body.appendChild(g),g.click(),document.body.removeChild(g)};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(k,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),n(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:n(i.descKey)}),e.jsxs("div",{className:"space-y-5 mt-4",children:[z.length===0&&e.jsxs("div",{className:"rounded-lg border border-[var(--warning)]/30 bg-[var(--warning)]/5 p-3 text-sm text-[var(--warning)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",n("pipeline.stepUI.detail.noInputImagesWarning")]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.detail.taskListTitle")}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:n("pipeline.stepUI.detail.taskCount",{count:f.length})})]}),f.length===0?e.jsxs("div",{className:"rounded-xl border-2 border-dashed border-ui-border p-8 text-center",children:[e.jsx(mt,{className:"w-8 h-8 mx-auto mb-2 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:n("pipeline.stepUI.detail.emptyTitle")}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:n("pipeline.stepUI.detail.emptyHint")})]}):e.jsx("div",{className:"space-y-2",children:f.map((x,j)=>{const h=Array.isArray(x.detailTypes)?x.detailTypes:[],g=h.map(M=>{const b=K.find(F=>F.id===M);return b?n(b.labelKey):M});return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-ui-border bg-[var(--bg-secondary)]",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)] w-5 text-center",children:j+1}),e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-[var(--bg-tertiary)] shrink-0",children:e.jsx(pe,{url:x.inputImage,alt:"",className:"w-full h-full object-cover"})}),e.jsx("span",{className:"text-[var(--text-tertiary)] text-xs",children:"â"}),e.jsx("div",{className:"w-10 h-10 rounded-lg bg-[var(--bg-tertiary)] shrink-0 grid grid-cols-2 grid-rows-2 gap-px p-0.5",children:h.slice(0,4).map((M,b)=>{const F=K.find(oe=>oe.id===M);return e.jsx("span",{className:"bg-[var(--bg-primary)] rounded flex items-center justify-center text-[10px]",children:(F==null?void 0:F.emoji)??"â¢"},b)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-xs font-medium text-[var(--text-primary)] truncate",children:[h.length===1?n("pipeline.stepUI.detail.singleImage"):n("pipeline.stepUI.detail.gridLayout",{count:h.length}),n("pipeline.stepUI.detail.colon"),g.join(" · ")]}),e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:x.aspectRatio})]}),e.jsx("button",{onClick:()=>U(M=>M.filter(b=>b.id!==x.id)),className:"p-1 rounded-md hover:bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer transition-colors shrink-0",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},x.id)})}),f.length<6&&z.length>0&&e.jsxs("button",{onClick:ie,className:"mt-3 w-full flex items-center justify-center gap-2 py-2.5 rounded-xl border border-dashed border-ui-border text-sm text-[var(--text-secondary)] hover:border-ui-accent/50 hover:text-ui-accent transition-all cursor-pointer",children:[e.jsx(we,{className:"w-4 h-4"})," ",n("pipeline.stepUI.detail.addTask",{count:f.length})]}),f.length>=6&&e.jsx("p",{className:"mt-2 text-xs text-[var(--text-tertiary)] text-center",children:n("pipeline.stepUI.detail.maxReached")})]}),X&&e.jsxs("div",{className:"rounded-xl border border-ui-accent/30 bg-ui-accent/[0.03] p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.detail.configTitle")}),e.jsx("button",{onClick:()=>W(!1),className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer",children:e.jsx(Re,{className:"w-4 h-4"})})]}),z.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.detail.selectProductImage")}),e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1",children:z.map((x,j)=>e.jsx("button",{onClick:()=>
51V(j),className:`w-14 h-14 rounded-lg overflow-hidden shrink-0 border-2 transition-all cursor-pointer ${ne===j?"border-ui-accent ring-1 ring-ui-accent/30":"border-transparent hover:border-ui-border"}`,children:e.jsx(pe,{url:x,alt:"",className:"w-full h-full object-cover"})},j))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("label",{className:"text-xs font-medium text-[var(--text-secondary)]",children:[n("pipeline.stepUI.detail.detailContentLabel.prefix"),e.jsx("span",{className:Z?"text-ui-accent":"text-[var(--warning)]",children:O.length}),n("pipeline.stepUI.detail.detailContentLabel.suffix",{max:Ze})]}),e.jsx("button",{onClick:()=>$(C),className:"text-[10px] text-ui-accent hover:underline cursor-pointer",children:n("pipeline.stepUI.detail.restoreDefault")})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:K.map(x=>{const j=O.includes(x.id),h=O.indexOf(x.id);return e.jsxs("button",{onClick:()=>le(x.id),className:`relative rounded-lg border p-2.5 text-left transition-all cursor-pointer ${j?"border-ui-accent bg-ui-accent/10":"border-ui-border bg-[var(--bg-secondary)] hover:border-[var(--text-tertiary)]"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx("span",{className:"text-base",children:x.emoji}),e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)]",children:n(x.labelKey)}),j&&e.jsx("span",{className:"ml-auto w-4 h-4 rounded-full bg-ui-accent text-white flex items-center justify-center text-[9px] font-bold",children:h+1})]}),e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)] leading-snug",children:n(x.descKey)})]},x.id)})}),e.jsx("p",{className:"mt-2 text-[10px] text-[var(--text-tertiary)]",children:n("pipeline.stepUI.detail.gridHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.detail.outputSize")}),e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Ss.map(x=>e.jsx("button",{onClick:()=>R(x.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${Y===x.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:x.label},x.id))})]}),e.jsxs("button",{onClick:be,disabled:!Z,className:"w-full py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 disabled:opacity-50 cursor-pointer transition-all flex items-center justify-center gap-1.5",children:[e.jsx(we,{className:"w-4 h-4"})," ",Z?O.length===1?n("pipeline.stepUI.detail.confirmSingle"):n("pipeline.stepUI.detail.confirmGrid",{count:O.length}):n("pipeline.stepUI.detail.minSelect",{min:dt})]})]}),c==="completed"&&((y=t==null?void 0:t.result)==null?void 0:y.files)&&t.result.files.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium flex items-center gap-2 text-sm flex-wrap",children:[e.jsx(fe,{className:"w-4 h-4"}),(()=>{var h,g,M,b;const x=(g=(h=t.result)==null?void 0:h.metadata)==null?void 0:g.totalCount,j=((b=(M=t.result)==null?void 0:M.metadata)==null?void 0:b.successCount)??t.result.files.length;return typeof x=="number"&&x>j?e.jsxs("span",{children:[n("pipeline.stepUI.detail.partialResult.prefix"),e.jsxs("span",{className:"text-[var(--warning)]",children:[j,"/",x]}),n("pipeline.stepUI.detail.partialResult.suffix",{failed:x-j})]}):e.jsx("span",{children:n("pipeline.stepUI.detail.fullResult",{count:t.result.files.length})})})(),t.creditsUsed!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[n("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),(()=>{const x=t.result.files,j=x.length===1?"flex":x.length===2?"grid grid-cols-2 gap-3":x.length<=4?"grid grid-cols-2 sm:grid-cols-3 gap-3":"grid grid-cols-3 sm:grid-cols-4 gap-3";return e.jsx("div",{className:j,children:x.map((h,g)=>e.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-[var(--bg-tertiary)] cursor-zoom-in",onClick:()=>q(h),children:[e.jsx(pe,{url:h,alt:"",className:"block w-full h-auto object-contain"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors pointer-events-none"}),e.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1",children:[e.jsx("button",{type:"button",onClick:M=>{M.stopPropagation(),T(h,g)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.detail.download"),children:e.jsx(Fe,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:M=>{M.stopPropagation(),q(h)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.detail.zoomView"),children:e.jsx(gt,{className:"w-4 h-4"})})]})]},g))})})()]}),c==="error"&&e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||n("pipeline.stepUI.detail.generationFailed")]}),e.jsx("div",{className:"flex gap-3",children:c==="completed"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:v,disabled:l||f.length===0,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[I?e.jsx(ee,{className:"w-3 h-3 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3 h-3 inline mr-1"}),n(I?"pipeline.stepUI.detail.generating":"pipeline.common.regenerate")]}),e.jsxs("button",{onClick:o,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[n("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]}):c==="error"?e.jsxs("button",{onClick:()=>a(i.id,"retry"),disabled:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[I?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.retry")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:v,disabled:l||f.length===0,className:"inline-flex items-center justify-center gap-1.5 px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[I?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(k,{className:"w-4 h-4"}),e.jsx("span",{children:n("pipeline.stepUI.detail.startGenerate",{count:f.length})}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost*f.length]})]}),!i.required&&e.jsxs("button",{onClick:()=>{a(i.id,"skip"),o()},disabled:l,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.skipNext")]})]})})]}),D&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-8 cursor-zoom-out",onClick:()=>q(null),role:"dialog","aria-modal":"true",children:[e.jsx(pe,{url:D,alt:"",onClick:x=>x.stopPropagation(),className:"max-w-[90vw] max-h-[90vh] object-contain cursor-default select-none rounded-lg shadow-2xl"}),e.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),q(null)},className:"absolute top-4 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/25 backdrop-blur text-white flex items-center justify-center cursor-pointer transition-colors","aria-label":n("pipeline.stepUI.detail.close"),children:e.jsx(Re,{className:"w-5 h-5"})})]})]})}
51const As={top:{id:"top",name:"ä¸è£
ï¼Tæ¤ / 衬衫ï¼",nameKey:"pipeline.stepUI.sizeTable.templates.top",columns:["å°ºç ","è¸å´","è©å®½","è¡£é¿","è¢é¿"],rows:[["XS",86,38,62,57],["S",90,39,64,58],["M",94,40,66,59],["L",98,41,68,60],["XL",102,42,70,61],["XXL",106,43,72,62]],unitScope:[1,2,3,4]},outerwear:{id:"outerwear",name:"å¤å¥ / 大衣 / ç¾½ç»æ",nameKey:"pipeline.stepUI.sizeTable.templates.outerwear",columns:["å°ºç ","è¸å´","è©å®½","è¡£é¿","è¢é¿","䏿å´"],rows:[["XS",94,41,72,60,90],["S",98,42,74,61,94],["M",102,43,76,62,98],["L",106,44,78,63,102],["XL",110,45,80,64,106],["XXL",114,46,82,65,110]],unitScope:[1,2,3,4,5]},bottom:{id:"bottom",name:"ä¸è£
ï¼è£¤ / å身è£ï¼",nameKey:"pipeline.stepUI.sizeTable.templates.bottom",columns:["å°ºç ","è
°å´","èå´","裤é¿","大è
¿å´"],rows:[["26",68,92,98,52],["27",70,94,99,53],["28",72,96,100,54],["29",74,98,101,55],["30",76,100,102,56],["31",78,102,103,57],["32",80,104,104,58]],unitScope:[1,2,3,4]},jeans:{id:"jeans",name:"çä»è£¤ï¼æè
°å´å¯¸ï¼",nameKey:"pipeline.stepUI.sizeTable.templates.jeans",columns:["è
°å´(inch)","è
°å´(cm)","èå´","裤é¿","裤èå´"],rows:[[25,63,86,100,32],[26,66,90,101,33],[27,68,93,102,34],[28,71,96,103,34],[29,74,99,104,35],[30,76,102,105,36],[31,79,104,106,36],[32,81,106,107,37],[34,86,111,109,38]],unitScope:[1,2,3,4]},dress:{id:"dress",name:"è¿è¡£è£",nameKey:"pipeline.stepUI.sizeTable.templates.dress",columns:["å°ºç ","è¸å´","è
°å´","èå´","è£é¿","è©å®½"],rows:[["XS",84,66,90,85,37],["S",88,70,94,87,38],["M",92,74,98,89,39],["L",96,78,102,91,40],["XL",100,82,106,93,41],["XXL",104,86,110,95,42]],unitScope:[1,2,3,4,5]},suit:{id:"suit",name:"西è£
å¥è£
",nameKey:"pipeline.stepUI.sizeTable.templates.suit",columns:["å°ºç ","è¸å´","è©å®½","è¡£é¿","è¢é¿","è
°å´","裤é¿"],rows:[["46",92,42,70,60,74,100],["48",96,43,72,61,78,101],["50",100,44,74,62,82,102],["52",104,45,76,63,86,103],["54",108,46,78,64,90,104],["56",112,47,80,65,94,105]],unitScope:[1,2,3,4,5,6]},activewear:{id:"activewear",name:"è¿å¨æï¼ç´§èº«çåï¼",nameKey:"pipeline.stepUI.sizeTable.templates.activewear",columns:["å°ºç ","è¸å´","è
°å´","èå´","è¡£é¿","裤é¿"],rows:[["XS",80,62,84,58,94],["S",84,66,88,60,96],["M",88,70,92,62,98],["L",92,74,96,64,100],["XL",96,78,100,66,102],["XXL",100,82,104,68,104]],unitScope:[1,2,3,4,5]},underwear:{id:"underwear",name:"å
è¡£ / æè¸ï¼ä¸è¸å´ + 罩æ¯ï¼",nameKey:"pipeline.stepUI.sizeTable.templates.underwear",columns:["å°ºç ","ä¸è¸å´","ä¸è¸å´","罩æ¯","éåè¸å´"],rows:[["70A",70,82,"A","82-84"],["70B",70,85,"B","85-87"],["75A",75,86,"A","86-88"],["75B",75,88,"B","88-90"],["75C",75,90,"C","90-92"],["80A",80,90,"A","90-92"],["80B",80,93,"B","93-95"],["80C",80,95,"C","95-97"],["85B",85,98,"B","98-100"],["85C",85,100,"C","100-102"]],unitScope:[1,2]},swimwear:{id:"swimwear",name:"æ³³è£
",nameKey:"pipeline.stepUI.sizeTable.templates.swimwear",columns:["å°ºç ","è¸å´","è
°å´","èå´","è£é¿"],rows:[["S",80,62,84,60],["M",84,66,88,62],["L",88,70,92,64],["XL",92,74,96,66]],unitScope:[1,2,3,4]},shoe:{id:"shoe",name:"éåï¼EU / å
é¿ï¼",nameKey:"pipeline.stepUI.sizeTable.templates.shoe",columns:["EU","å
é¿","UK","US"],rows:[[35,22.5,3,5],[36,23,3.5,5.5],[37,23.5,4,6],[38,24,5,7],[39,24.5,5.5,7.5],[40,25,6,8],[41,25.5,7,9],[42,26,8,10],[43,26.5,9,11],[44,27,10,12]],unitScope:[1]},kids:{id:"kids",name:"ç«¥è£
ï¼æèº«é«ï¼",nameKey:"pipeline.stepUI.sizeTable.templates.kids",columns:["å°ºç ","身é«","ä½é(kg)","è¸å´","è¡£é¿"],rows:[["90",90,13,52,38],["100",100,16,54,42],["110",110,19,56,46],["120",120,22,58,50],["130",130,26,60,54],["140",140,31,62,58],["150",150,36,64,62]],unitScope:[1,3,4]},accessory:{id:"accessory",name:"é
饰ï¼è
°å¸¦ / å´å·¾ / 帽åï¼",nameKey:"pipeline.stepUI.sizeTable.templates.accessory",columns:["è§æ ¼","é¿åº¦","宽度","å¨é¿"],rows:[["å° S",90,3,55],["ä¸ M",100,3.5,58],["大 L",110,4,60],["å 大 XL",120,4,62]],unitScope:[1,2,3]}},zs=["top","outerwear","bottom","jeans","dress","suit","activewear","underwear","swimwear","shoe","kids","accessory"],$s={phone:{id:"phone",name:"ææº",nameKey:"pipeline.stepUI.sizeTable.templates.phone",columns:["忰项","è§æ ¼"],rows:[["å±å¹","6.7 è±å¯¸ AMOLED / 120Hz / 2796Ã1290"],["å¤çå¨","Snapdragon 8 Gen 3 / 4nm"],["è¿è¡å
å","12GB LPDDR5X"],["æºèº«åå¨","256GB / 512GB / 1TB"],["åç½®ç¸æº","主æ 50MP + è¶
å¹¿è§ 12MP + é¿ç¦ 64MP 5Ã"],["åç½®ç¸æº","32MP"],["çµæ± 容é","5000mAh"],["å
çµ","æçº¿ 100W / æ 线 50W"],["æä½ç³»ç»","Android 14"],["æºèº«","161.3 à 75.1 à 8.2mm / 228g"],["鲿¤","IP68 鲿°´é²å°"],["æ¥å£","USB-C 3.2 Gen2"]],unitScope:[]},earphone:{id:"earphone",name:"è³æº",nameKey:"pipeline.stepUI.sizeTable.templates.earphone",columns:["忰项","è§æ ¼"],rows:[["ç±»å","çæ çº¿å
¥è³å¼"],["驱å¨åå
","11mm å¨å + 6mm å¹³æ¿æ¯è"],["é¢åèå´","20Hz â 40kHz"],["主å¨éåª","-48dB èªéåºä¸éº¦å
é£"],["èççæ¬","5.3 / LE Audio / Auracast"],["ç¼è§£ç ","AAC / LDAC / LHDC 5.0"],["忬¡ç»èª","8 å°æ¶ï¼ANC å¼ï¼/ 12 å°æ¶ï¼ANC å
³ï¼"],["æ»ç»èª","40 å°æ¶ï¼å«å
çµçï¼"],["å
çµ","æçº¿ USB-C / æ 线 Qi"],["鲿°´ç级","IPX4"],["éé","åè³ 4.5g / å
çµç 45g"]],unitScope:[]},camera:{id:"camera",name:"ç¸æº",nameKey:"pipeline.stepUI.sizeTable.templates.camera",columns:["忰项","è§æ ¼"],rows:[["ä¼ æå¨","å
¨ç»å¹
CMOS 45MP èç
§å¼"],["é头å¡å£","E å¡å£"],["ISO èå´","100 â 51200ï¼å¯æ©å± 50 â 204800ï¼"],["è¿æé度","æé« 30fps çµåå¿«é¨"],["èªå¨å¯¹ç¦","693 ç¹ç¸ä½æ£æµ + AI è¯å«"],["è§é¢è§æ ¼","8K 30p / 4K 120p / 10-bit 4:2:2"],["鲿","æºèº« 5 è½´ 8 æ¡£"],["忝å¨","944 ä¸åç´ OLED EVF"],["å±å¹","3.2 è±å¯¸ 翻转触æ¸å±"],["å塿§½","CFexpress Type-A + SD UHS-II"],["ç»èª","约 640 å¼ ï¼åæ¯å¨ï¼"],["éé","约 737gï¼å«çµæ± ï¼"]],unitScope:[]},tablet:{id:"tablet",name:"å¹³æ¿",nameKey:"pipeline.stepUI.sizeTable.templates.tablet",columns:["忰项","è§æ ¼"],rows:[["å±å¹","12.9 è±å¯¸ Liquid Retina XDR / 120Hz"],["å¤çå¨","M2 è¯ç / 8 æ ¸ CPU / 10 æ ¸ GPU"],["è¿è¡å
å","8GB / 16GB"],["åå¨","128GB / 256GB / 512GB / 1TB / 2TB"],["åç½®ç¸æº","12MP å¹¿è§ + LiDAR"],["åç½®ç¸æº","12MP è¶
广è§"],["çµæ± ","10758mAh / æé¿ 10 å°æ¶"],["æ¥å£","USB-C (Thunderbolt / USB 4)"],["æ¬å£°å¨","忬声å¨é³åç³»ç»"],["çç©è¯å«","Face ID"],["éé","682g (Wi-Fi) / 685g (èçª)"]],unitScope:[]},laptop:{id:"laptop",name:"ç¬è®°æ¬",nameKey:"pipeline.stepUI.sizeTable.templates.laptop",columns:["忰项","è§æ ¼"],rows:[["CPU","Apple M3 Pro 12 æ ¸"],["GPU","18 æ ¸éææ¾å¡"],["å±å¹",'14.2" Liquid Retina XDR / 3024Ã1964 / 120Hz'],["å
å","18GB / 36GB ç»ä¸å
å"],["åå¨","512GB / 1TB / 2TB / 4TB SSD"],["çµæ± ","72.4 Wh / æé¿ 18 å°æ¶"],["æ¥å£","3à Thunderbolt 4 / HDMI / SD 塿§½ / MagSafe"],["æ 线","Wi-Fi 6E / èç 5.3"],["æå头","1080p FaceTime HD"],["é®ç","èå
åªåè / Touch ID"],["æºèº«","312 à 221 à 15.5mm"],["éé","1.61 kg"]],unitScope:[]},keyboard:{id:"keyboard",name:"é®ç",nameKey:"pipeline.stepUI.sizeTable.templates.keyboard",columns:["忰项","è§æ ¼"],rows:[["ç±»å","æºæ¢°é®ç TKLï¼87 é®ï¼"],["è½´ä½","Cherry MX 红轴ï¼å¯æ¢ï¼"],["é®ç¨ / 触å","4.0mm / 2.0mm åå 45g"],["è¿æ¥æ¹å¼","æçº¿ USB-C / èç 5.1 / 2.4G 䏿¨¡"],["èå
","RGB 16.8 ç¾ä¸è² å
¨é®å¯å®å¶"],["忥ç","1000Hz"],["N 鮿 å²","æ¯æ"],["é®å¸½","PBT åè²æ³¨å¡"],["çµæ± ","4000mAh / 150 å°æ¶"],["尺寸","356 à 128 à 38mm"],["éé","0.85 kg"]],unitScope:[]},mouse:{id:"mouse",name:"é¼ æ ",nameKey:"pipeline.stepUI.sizeTable.templates.mouse",columns:["忰项","è§æ ¼"],rows:[["ä¼ æå¨","PixArt PAW3395"],["æé« DPI","26000"],["æå¤§è¿½è¸ªé度","650 IPS"],["æå¤§å é度","50G"],["忥ç","1000Hzï¼å¯å 125/500/1000ï¼"],["æé®æ°","6 é®å¯ç¼ç¨"],["主æé®","å
å¦å¾®å¨ 9000 䏿¬¡"],["è¿æ¥æ¹å¼","æçº¿ USB-C / 2.4G æ 线 / èç"],["çµæ± ","70 å°æ¶ï¼RGB å
³ï¼"],["éé","63g"],["尺寸","125 à 64 à 39mm"]],unitScope:[]},speaker:{id:"speaker",name:"é³ç®±",nameKey:"pipeline.stepUI.sizeTable.templates.speaker",columns:["忰项","è§æ ¼"],rows:[["ç±»å","èç便æºé³ç®±"],["驱å¨åå
","2Ã å
¨é¢ 50mm + 1à ä½é³è¾å°å¨"],["é¢å®åç","20W RMS"],["é¢åèå´","60Hz â 20kHz"],["èççæ¬","5.3 / å¤ç¹è¿æ¥"],["æ¯æåè®®","AAC / SBC"],["ç»èª","24 å°æ¶"],["å
çµ","USB-C å¿«å
/ 15W"],["鲿¤ç级","IP67 鲿°´é²å°"],["æ©å±","ç«ä½å£°é
对 / 派对串è"],["尺寸","180 à 80 à 80mm"],["éé","680g"]],unitScope:[]},charger:{id:"charger",name:"å
çµå¨",nameKey:"pipeline.stepUI.sizeTable.templates.charger",columns:["忰项","è§æ ¼"],rows:[["ç±»å","GaN æ°®åéå¿«å
"],["æå¤§è¾åº","100W"],["è¾åºæ¥å£","2à USB-C + 1à USB-A"],["USB-C1 æå¤§","100W (PD 3.1 / PPS)"],["USB-C2 æå¤§","65W"],["USB-A æå¤§","22.5W"],["è¾å
¥çµå","100 â 240V 宽å"],["åè®®","PD 3.1 / QC 4+ / PPS / SCP / FCP"],["认è¯","CCC / FCC / CE / RoHS"],["尺寸","62 à 62 à 30mm"],["éé","170g"]],unitScope:[]},smartwatch:{id:"smartwatch",name:"æºè½æè¡¨",nameKey:"pipeline.stepUI.sizeTable.templates.smartwatch",columns:["忰项","è§æ ¼"],rows:[["å±å¹","1.9 è±å¯¸ AMOLED / 常亮æ¾ç¤º"],["å辨ç","466 à 466 / 326ppi"],["å¤çå¨","åæ ¸ Apple S9 SiP"],["åå¨","64GB"],["ä¼ æå¨","å¿ç / è¡æ°§ / 使¸© / ECG / GPS"],["çµæ± ","36 å°æ¶å
¸å / ä½åè 72 å°æ¶"],["å
çµ","ç£å¸æ 线快å
"],["è¿æ¥","èç 5.3 / Wi-Fi / NFC / 4G"],["鲿°´","50m (5 ATM) + IP6X"],["表壳","èªç©ºçº§éåé / ééå±å¯é"],["表带","è¿å¨ / ç¼ç» / ç®é© / ç±³å
°å°¼æ¯"],["éé","38gï¼ä¸å«è¡¨å¸¦ï¼"]],unitScope:[]}},Ls=["phone","earphone","camera","tablet","laptop","keyboard","mouse","speaker","charger","smartwatch"],Os={skincare:{id:"skincare",name:"é¢é¨æ¤è¤",nameKey:"pipeline.stepUI.sizeTable.templates.skincare",columns:["忰项","è§æ ¼"],rows:[["åå","çé
°èºçç½ç²¾å"],["éç¨è¤è´¨","å
¨è¤è´¨ / ææèå¯ç¨"],["容é","30ml / 1 fl.oz"],["æ ¸å¿æå","10% çé
°èº + ä¼ æé
¸ + 积éªèæåç©"],["主è¦åæ","æäº®è¤è² / ååè¤è² / æ·¡åçå°"],["使ç¨é¢æ¬¡","æ©æå 1 次"],["è´¨å°","è½»çæ°´æ¶¦ / å¿«é叿¶"],["è¤æ","æ¸
ç½ä¸é»è
»"],["ä¿è´¨æ","æªå¼å° 36 个æ / å¼å°å 6 个æ"],["产å°","é©å½ / æ¥æ¬ / æ³å½"],["夿¡å·","å½å¦ç¹è¿å J2024XXXX"]],unitScope:[]},lip:{id:"lip",name:"åé¨å½©å¦",nameKey:"pipeline.stepUI.sizeTable.templates.lip",columns:["忰项","è§æ ¼"],rows:[["åå","ä¸ç»æå
åé"],["è´¨å°","ä¸ç»åå
/ æé¾æ"],["è²å·æ°","å
± 12 è²å¯é"],["容é","3.5ml"],["æ ¸å¿æå","鳿¢¨æ²¹ + ç»´çç´ E + ç»å°¿é
¸"],["æ¾è²åº¦","â
51
â
â
â
â
䏿¹æ¾è²"],["æä¹
度","8 å°æ¶ä¸æè²ä¸æ¾å纹"],["鲿°´é²å»","æ¯"],["æ»æ¶¦åº¦","â
â
â
â
â 䏿干"],["ä¿è´¨æ","3 å¹´"],["产å°","æ³å½ / æå¤§å©"]],unitScope:[]},eye:{id:"eye",name:"ç¼é¨å½©å¦",nameKey:"pipeline.stepUI.sizeTable.templates.eye",columns:["忰项","è§æ ¼"],rows:[["åå","12 è²å¤§å°ç¼å½±ç"],["ç±»å","äºå
+ ç å
+ äº®ç æ··å"],["è²å·æ°","12 è²"],["åå«é","12 à 1.2g"],["è´¨å°","ç»è
»ææ» / ç²è´¨ç»µå¯"],["æ¾è²åº¦","â
â
â
â
â
"],["延屿§","æææ / ä¸é£ç²"],["鲿°´æ§","æ¯"],["éç¨ç¼å","å/å/å
å åéç¨"],["ä¿è´¨æ","3 å¹´"],["产å°","ç¾å½"]],unitScope:[]},foundation:{id:"foundation",name:"åºå¦ç²åº",nameKey:"pipeline.stepUI.sizeTable.templates.foundation",columns:["忰项","è§æ ¼"],rows:[["åå","æä¹
æ§æ²¹åå
ç²åºæ¶²"],["ç±»å","æ¶²ä½ç²åº / åå
妿"],["è²å·æ°","30 è²å
¨è¤è²è¦ç"],["容é","30ml"],["SPF / PA","SPF15 / PA++"],["é®ç度","â
â
â
â
â ä¸é«é®ç"],["æå¦æ¶é¿","24 å°æ¶"],["éç¨è¤è´¨","æ²¹ç® / æ··æ²¹ / çè"],["妿","ä¸é¾åå
/ é¾é¢ä¼ªç´ é¢"],["æ ¸å¿æå","çé
°èº + æ¤°åæ°´ + ç»´çç´ B5"],["ä¿è´¨æ","3 å¹´"],["产å°","ç¾å½"]],unitScope:[]},fragrance:{id:"fragrance",name:"馿°´",nameKey:"pipeline.stepUI.sizeTable.templates.fragrance",columns:["忰项","è§æ ¼"],rows:[["åå","ç«ç°ç½è¶æ·¡é¦æ°´"],["馿°´æµåº¦","Eau de Parfumï¼EDPï¼"],["容é","50ml / 100ml"],["é¦è°å®¶æ","è±é¦è°"],["åè°","ææ© / ç½è¶ / 使æ"],["ä¸è°","ä¿å å©äºç«ç° / èè / ç¡ä¸¹"],["åè°","ç½éºé¦ / éªæ¾ / 广è¿é¦"],["ç馿¶é¿","6-8 å°æ¶"],["éç¨åºæ¯","çº¦ä¼ / æ¥å¸¸ / åå
¬"],["éç¨å£è","åå£éç¨"],["ä¿è´¨æ","æªå¼å° 5 å¹´ / å¼å°å 3 å¹´"],["产å°","æ³å½"]],unitScope:[]},tool:{id:"tool",name:"ç¾å¦å·¥å
·",nameKey:"pipeline.stepUI.sizeTable.templates.tool",columns:["忰项","è§æ ¼"],rows:[["åå","ä¸ä¸åå¦å· 12 ä»¶å¥"],["ç±»å","åå¦å·å¥ç»"],["å·æ¯æè´¨","人é çº¤æ¯ / å¨ç©æ¯ï¼å±±ç¾ + æ¾é¼ æ¯ï¼"],["å·ææè´¨","èªç©ºé + æ¨æ"],["å
å«ä»¶æ°","12 æ¯ï¼å«ç²åº / ç¼å½± / è
®çº¢ / 修容å·ï¼"],["æ»é¿åº¦","16 â 20cm / æ¯"],["éç¨å¦å®¹","æ¥å¸¸ / èå° / å©ç¤¼ / ä¸ä¸åå¦"],["æ¸
æ´æ¹å¼","䏿§çæ¶² + 温水"],["ä¿å
»å¨æ","æ¯å¨ä¸æ¬¡æ·±å±æ¸
æ´"],["é
ä»¶","æ¶çº³å·å
+ å妿µ·ç»µ"],["产å°","æ¥æ¬ / ä¸å½"]],unitScope:[]}},Hs=["skincare","lip","eye","foundation","fragrance","tool"],Ms={snack:{id:"snack",name:"é¶é£",nameKey:"pipeline.stepUI.sizeTable.templates.snack",columns:["忰项","æ¯ 100g å«é","NRV%"],rows:[["è½é","1890 kJ","22%"],["èç½è´¨","6.2 g","10%"],["èèª","24.5 g","41%"],["â 饱åèèª","10.2 g","51%"],["碳水ååç©","58.3 g","19%"],["â ç³","22.5 g","â"],["è³é£çº¤ç»´","2.1 g","8%"],["é ","320 mg","16%"],["é","85 mg","11%"],["é","1.8 mg","12%"]],unitScope:[]},beverage:{id:"beverage",name:"饮æ",nameKey:"pipeline.stepUI.sizeTable.templates.beverage",columns:["忰项","æ¯ 100ml å«é","NRV%"],rows:[["è½é","195 kJ","2%"],["èç½è´¨","0 g","0%"],["èèª","0 g","0%"],["碳水ååç©","11.2 g","4%"],["â ç³","10.8 g","â"],["é ","15 mg","1%"],["ç»´çç´ C","12 mg","12%"],["åå¡å ","30 mg","â"],["ææ±å«é","15%","â"],["碳é
¸åç¨åº¦","ä¸ç","â"]],unitScope:[]},staple:{id:"staple",name:"主é£",nameKey:"pipeline.stepUI.sizeTable.templates.staple",columns:["忰项","æ¯ 100g å«é","NRV%"],rows:[["è½é","1460 kJ","17%"],["èç½è´¨","10.8 g","18%"],["èèª","1.2 g","2%"],["碳水ååç©","74.5 g","25%"],["è³é£çº¤ç»´","3.6 g","14%"],["é ","8 mg","0%"],["é","25 mg","3%"],["é","2.8 mg","19%"],["é","92 mg","31%"],["磷","206 mg","29%"]],unitScope:[]},fresh:{id:"fresh",name:"çé²",nameKey:"pipeline.stepUI.sizeTable.templates.fresh",columns:["忰项","è§æ ¼"],rows:[["åå","åçå¤å°ç½è¾ 31/40 è§æ ¼"],["åå«é","500g / ç"],["产å°","åçå¤å° Santa Elena"],["éææ¹å¼","æ·±æµ·ææ / å¯æç»æ¸ä¸"],["è§æ ¼ï¼åª/ç£
ï¼","31-40"],["ä¿é²æ¹å¼","-18â å·å» / å°é²ç´é"],["ä¿è´¨æ","å·å» 12 个æ / è§£å»å 24 å°æ¶"],["å¨åæ¡ä»¶","-18â 以ä¸å·å»"],["é£ç¨æ¹å¼","ç½ç¼ / èè / æ¤ç / åºèº«çº§"],["è¿æåæç¤º","è¾ / ç²å£³ç±»"],["è´¨éç级","SC è®¤è¯ / HACCP / MSC"]],unitScope:[]},health:{id:"health",name:"ä¿å¥é£å",nameKey:"pipeline.stepUI.sizeTable.templates.health",columns:["忰项","è§æ ¼"],rows:[["åå","深海鱼油è¶å"],["ä¿å¥åè½","è°èè¡è / è¾
å©éè¡è"],["ä¸»è¦æå","EPA 180mg / DHA 120mg æ¯ç²"],["éç¨äººç¾¤","æå¹´äººï¼18 å²ä»¥ä¸ï¼"],["ä¸éå®äººç¾¤","å°å¹´å¿ç«¥ / åå¦ / ä¹³æ¯"],["é£ç¨æ¹æ³","æ¯æ¥ 2 次 / æ¯æ¬¡ 2 ç² / 温水éæ"],["产åè§æ ¼","1000mg à 100 ç²"],["ä¿è´¨æ","36 个æ"],["å¨åæ¹æ³","常温é´åå¹²ç¥å¤"],["注æäºé¡¹","æ¬åä¸è½ä»£æ¿è¯ç©"],["ä¿å¥é£åæ¹å·","å½é£å¥å G20240XXXX"],["åææ¥æº","åæç£·è¾ / 深海鱼类"]],unitScope:[]},baby:{id:"baby",name:"å©´å¹¼é£å",nameKey:"pipeline.stepUI.sizeTable.templates.baby",columns:["忰项","è§æ ¼"],rows:[["åå","ææºç±³ç²ï¼é«éï¼"],["éç¨æé¾","6 个æä»¥ä¸"],["åå«é","225gï¼7.5g à 30 è¢
51ï¼"],["åæ","ææºå¤§ç±³ / ææºç麦"],["强åè¥å
»ç´ ","é / é / é / ç»´çç´ D"],["éå«é","6.5mg / 100gï¼å½æ â¥2.5ï¼"],["æ·»å å","æ èç³ / æ ç / æ é¦ç²¾"],["è¿æå","ä¸å«éº¸è´¨ / ä¸å«ä¹³"],["ææºè®¤è¯","ä¸å½ææºäº§åè®¤è¯ / æ¬§çææº"],["å²è°æ¹æ³","60-70â æ¸©æ°´è°è³ç³ç¶"],["ä¿è´¨æ","18 个æ"],["å¨åæ¡ä»¶","å¸¸æ¸©å¹²ç¥ / å¼å°åå·è 7 天å
"]],unitScope:[]}},Fs=["snack","beverage","staple","fresh","health","baby"],Bs={sofa:{id:"sofa",name:"æ²å",nameKey:"pipeline.stepUI.sizeTable.templates.sofa",columns:["忰项","è§æ ¼"],rows:[["åå","å¸èºä¸äººä½æ²å"],["æ´ä½å°ºå¯¸","2100 à 950 à 850mmï¼é¿å®½é«ï¼"],["åæ·± / åé«","600mm / 430mm"],["主æ","宿¨æ¡æ¶ï¼åç¾ç½è¡æ¨ï¼"],["颿","å¾·å½ç§æå¸ / 100% èé
¯çº¤ç»´"],["åå«å¡«å
","é«å¯åº¦å弹海绵 + ä¹³è¶å¤å"],["é èå¡«å
","ç¾½ç»çº¤ç»´ + è®°å¿æ£"],["æ¿é","æ¯ä½ ⥠150kg"],["è
¿é¨æè´¨","éå±ç¤æ¼ / 碳é¢"],["éç¨ç©ºé´","20-50㡠客å
"],["ä¿ä¿®æ","5 å¹´æ¡æ¶ / 3 年颿"],["å®è£
æ¹å¼","å°å®¶å
å®è£
ï¼å
å·¥å
·ï¼"]],unitScope:[]},bed:{id:"bed",name:"åº",nameKey:"pipeline.stepUI.sizeTable.templates.bed",columns:["忰项","è§æ ¼"],rows:[["åå","å人软å
大åº"],["åºå«å°ºå¯¸","1800 à 2000mm"],["å¤å½¢å°ºå¯¸","2100 à 2100 à 1100mm"],["åºé«ï¼å«å«ï¼","550mm"],["åºæ¶æè´¨","宿¨å¤å±æ¿ + ç¯ä¿æ¿æ E0"],["软å
颿","ç§æå¸ / 头å±çç®å¯é"],["åºå¤´å¡«å
","å弹海绵 + ç»å¸è¡¬"],["åºæ¿","15mm æéª¨æ¶ / 22 æ ¹"],["å¨ç©ç©ºé´","åºé¨å¨ç©æ½å± / å¯éæ°ååé"],["æ¿é","⥠600kg"],["ä¿ä¿®æ","10 å¹´ä¸»æ¡æ¶ / 5 年颿"],["å®è£
æ¹å¼","å¸å
ä¸é¨å
è´¹å®è£
"]],unitScope:[]},coffee_table:{id:"coffee_table",name:"è¶å ",nameKey:"pipeline.stepUI.sizeTable.templates.coffee_table",columns:["忰项","è§æ ¼"],rows:[["åå","岩æ¿å¤§çç³è¶å "],["尺寸","1200 à 600 à 430mm"],["æ¡é¢æè´¨","12mm æå¤§å©è¿å£å²©æ¿"],["åºåº§æè´¨","碳é¢ç¤æ¼ / éè²æä¸"],["é²å®ç级","Mohs 8 级"],["èæ¸©","-40â è³ 300â"],["èæ±¡","鲿²¹é²æ±¡ï¼åå¡ / 红é
æ¦ææ çï¼"],["æ¿é","⥠200kg"],["åé","45 kg"],["éç¨ç©ºé´","⥠15㡠客å
"],["ä¿ä¿®æ","5 å¹´"]],unitScope:[]},lamp:{id:"lamp",name:"ç¯å
·",nameKey:"pipeline.stepUI.sizeTable.templates.lamp",columns:["忰项","è§æ ¼"],rows:[["åå","忬§é£è½å°ç¯"],["ç¯é«","1600mm"],["ç¯ç½©ç´å¾","400mm"],["ç¯ç½©æè´¨","äºéº»å¸èº / PVC å
衬"],["ç¯ææè´¨","éå±ç¤æ¼é» / è¡æ¡æ¨"],["ç¯æ³¡","E27 æ¥å£ / 建议 LED 12W"],["æå¤§åç","60W"],["è²æ¸©","3000K æç½ï¼å¯é 4000K / 5500Kï¼"],["æ¾è²ææ°","CRI ⥠90"],["å¼å
³æ¹å¼","èè¸å¼å
³ / è°å
æé®"],["çµå","220V AC / 50Hz"],["认è¯","CCC / CE"]],unitScope:[]},storage:{id:"storage",name:"å¨ç©æ",nameKey:"pipeline.stepUI.sizeTable.templates.storage",columns:["忰项","è§æ ¼"],rows:[["åå","宿¨å¨ç©è¾¹æ"],["æ´ä½å°ºå¯¸","1800 à 450 à 850mm"],["æä½æè´¨","E0 çº§å®æ¨å¤å±æ¿"],["鍿¿æè´¨","宿¨è´´ç® / å¯é UV ç¤æ¼"],["屿¿","å¯è°è 3 å± / æ¿é 20kg/å±"],["äºéä»¶","æå¤§å©ç¾éæ¶²åç¼å²é°é¾"],["ææ","é»éææ"],["éç¨ç©ºé´","客å
/ é¤å
/ çå
³"],["åé","52 kg"],["ç¯ä¿ç级","E0ï¼ç²ééæ¾ ⤠0.05mg/m³ï¼"],["ä¿ä¿®æ","10 å¹´"]],unitScope:[]},chair:{id:"chair",name:"æ¤
å",nameKey:"pipeline.stepUI.sizeTable.templates.chair",columns:["忰项","è§æ ¼"],rows:[["åå","人ä½å·¥å¦é¤æ¤
"],["æ´ä½å°ºå¯¸","480 à 520 à 870mm"],["åé¢é« / 宽","440mm / 450mm"],["æ¤
æ¶æè´¨","宿¨ï¼åç¾ç½è¡æ¨ / æ©¡æ¨ï¼"],["åé¢æè´¨","é«å¯åº¦æµ·ç»µ + ç§æå¸"],["æ¿é","⥠150kg"],["é è徿","105° 符å人ä½å·¥å¦"],["åé","5.2 kg / åª"],["å
è£
","ååªç¬ç«å
è£
/ å¯å å "],["ä¿ä¿®æ","3 å¹´"]],unitScope:[]},kitchenware:{id:"kitchenware",name:"å¨å
·",nameKey:"pipeline.stepUI.sizeTable.templates.kitchenware",columns:["忰项","è§æ ¼"],rows:[["åå","å åä¸ç²çé
"],["å£å¾ / 深度","32cm / 8.5cm"],["é
ä½æè´¨","ç²¾é¸éåé / 5.5mm å å"],["æ¶å±","å¾·å½è¿å£ä¸ç²æ¶å±ï¼ä¸å« PFOAï¼"],["æææè´¨","è髿¸©çµæ¨ + ä¸éé¢"],["åºé¨ç»æ","å¤åèçªç£å¯¼åº"],["éç¨çç¶","çæ° / çµç£ / é¶ç· å
¨éç¨"],["æ¸
æ´æ¹å¼","æ´ç¢æºå¯ç¨"],["åé","1.85 kg"],["ä¿ä¿®æ","3 å¹´æ¶å±ä¿åº"]],unitScope:[]},home_textile:{id:"home_textile",name:"家纺",nameKey:"pipeline.stepUI.sizeTable.templates.home_textile",columns:["忰项","è§æ ¼"],rows:[["åå","é¿ç»æ£åä»¶å¥"],["è§æ ¼","1.8m åºï¼è¢«å¥ 200Ã230ï¼"],["å«ä»¶æ°","4 ä»¶ï¼è¢«å¥ + åºå + 2 æå¥ï¼"],["颿","æ°çé¿ç»æ£ 100%"],["æ¯æ° / ç»æ³","60 æ¯ / 13372 è´¡ç¼"],["å
é","140g/ã¡"],["æè²å·¥èº","æ´»æ§ç¯ä¿æ"],["缩水ç","⤠3%"],["èµ·çç级","4 级以ä¸"],["æ´æ¶¤","å·æ°´æºæ´ / åé¢è½»æ"],["ä¿ä¿®","30 天æ å¿§éæ¢"]],unitScope:[]}},Ws=["sofa","bed","coffee_table","lamp","storage","chair","kitchenware","home_textile"],Gs={diamond:{id:"diamond",name:"é»ç³",nameKey:"pipeline.stepUI.sizeTable.templates.diamond",columns:["忰项","è§æ ¼"],rows:[["åå","18K ç½éé»ç³ææ"],["主ç³","天ç¶é»ç³ 1 é¢"],["å
ææ°","0.50 ct"],["å度","VS1"],["é¢è²","G è²ï¼ä¼ç½ï¼"],["åå·¥","3EXï¼æä¼åå·¥ / æå
/ 对称ï¼"],["è§å
","Noneï¼æ è§å
ï¼"],["å½¢ç¶","åå½¢æäº®å¼ï¼57 å»é¢ï¼"],["è¯ä¹¦","GIA è¯ä¹¦ / ç¼å·å¯æ¥"],["主ç³é¶åµ","6 çªé¶åµ"],["éå±","18K ç½é Au750"],["éé","3.8g"]],unitScope:[]},colored_gem:{id:"colored_gem",name:"彩è²å®ç³",nameKey:"pipeline.stepUI.sizeTable.templates.colored_gem",columns:["忰项","è§æ ¼"],rows:[["åå","18K ç«ç°é红å®ç³åå "],["主ç³","天ç¶çº¢å®ç³"],["å
ææ°","1.20 ct"],["产å°","ç¼
ç¸ Mogok"],["é¢è²","鸽è¡çº¢ Pigeon Blood"],["å度","VVS å¹²å"],["ä¼åå¤ç","æ ç§ unheated"],["é
ç³","é»ç³ 0.30ct å
± 20 é¢"],["å½¢ç¶","æ¤åæä
51º®å¼"],["è¯ä¹¦","GRS / AIGS"],["éå±","18K ç«ç°é Au750"],["éé","4.5g"]],unitScope:[]},gold:{id:"gold",name:"é»é",nameKey:"pipeline.stepUI.sizeTable.templates.gold",columns:["忰项","è§æ ¼"],rows:[["åå","è¶³é夿³æé¯"],["é屿è²","è¶³é 999ï¼å«éé ⥠99.9%ï¼"],["å·¥èº","夿³é¾å» / æä¸ / 磨ç "],["å¾è
¾","ç¼ æè²çº¹ / 祥äºçº¹ / èè 纹"],["å
é","42.5gï¼æ¯ä»¶ç§°é计价ï¼"],["æé¯å
å¾","55mmï¼å¯é 52/55/58ï¼"],["æé¯å®½åº¦","8.5mm"],["å¼å£æ¹å¼","æ´»å£æ¨æ"],["å½å®¶é´å®","彿£ NGTC è¯ä¹¦"],["工费","æ¯å
Â¥30"],["ä»¥æ§æ¢æ°","æ¯æååçä»¥æ§æ¢æ°"]],unitScope:[]},platinum:{id:"platinum",name:"éé",nameKey:"pipeline.stepUI.sizeTable.templates.platinum",columns:["忰项","è§æ ¼"],rows:[["åå","PT950 éé对æ"],["é屿è²","PT950ï¼å«éé ⥠95%ï¼"],["é¶åµæ¹å¼","è±è±æ¬¾ / æç®å¼¯å¼§"],["é»ç³éªè¡¬","女æé¶ 0.05ct à 3 é¢ / ç·æç´ å"],["ææå®½åº¦","女æ 2.5mm / ç·æ 3.5mm"],["ææå度","1.5mm"],["æå尺寸","港ç 8-22 å·"],["女æéé","2.8g"],["ç·æéé","4.2g"],["å
å£å»å","æ¯ææ¿å
å»åï¼å
è´¹ï¼"],["å½å®¶é´å®","彿£ NGTC è¯ä¹¦"]],unitScope:[]},pearl:{id:"pearl",name:"çç ",nameKey:"pipeline.stepUI.sizeTable.templates.pearl",columns:["忰项","è§æ ¼"],rows:[["åå","Akoko æµ·æ°´çç 项é¾"],["çç ç±»å","æ¥æ¬ Akoya æµ·æ°´çç "],["é¢ç²æ°","45 é¢"],["尺寸","7.0 â 7.5mm"],["å
æ³½","强å
ï¼æµ·æ°´çç 顶级ï¼"],["ç®å
é¢è²","ç½åºç²å
/ ç½åºç»¿å
"],["å½¢ç¶","æ£å"],["ççµç级","å¾®çï¼AAA 级ï¼"],["æ´ä¸²é¿åº¦","42cm / å¯è°è"],["æ£å¤´","S925 é¶é 18K ç½é"],["è¯ä¹¦","GIC çç é´å®è¯ä¹¦"]],unitScope:[]},silver:{id:"silver",name:"é¶é¥°",nameKey:"pipeline.stepUI.sizeTable.templates.silver",columns:["忰项","è§æ ¼"],rows:[["åå","S925 é骨é¾"],["é屿è²","è¶³é¶ S925"],["çµé","18K ç½éçµéï¼é²æ°§åï¼"],["主ç³","åæç«æ¹æ°§åé"],["主ç³å°ºå¯¸","4.0 à 4.0mm"],["é
ç³","å
«å¿å
«ç®åå·¥"],["é¾é¿","40cm + 5cm å»¶é¿é¾"],["龿¡æ¬¾å¼","水波纹é¾"],["æ»é","3.2g"],["å½å®¶é´å®","彿£ NGTC è¯ä¹¦"],["é²è¿æ","ä½æäººç¾¤å¯ç¨"]],unitScope:[]}},qs=["diamond","colored_gem","gold","platinum","pearl","silver"];function Vs(i,t){return i==="specs"?t==="beauty"?{templates:Os,order:Hs,defaultId:"skincare"}:t==="food"?{templates:Ms,order:Fs,defaultId:"snack"}:t==="home"?{templates:Bs,order:Ws,defaultId:"sofa"}:t==="jewelry"?{templates:Gs,order:qs,defaultId:"diamond"}:{templates:$s,order:Ls,defaultId:"phone"}:{templates:As,order:zs,defaultId:"top"}}const Ds=1/2.54,_t={headerBg:"#f3f4f6",headerText:"#374151",cellBg:"#ffffff",cellText:"#1f2937",border:"#d1d5db",titleText:"#111827",tableBg:"#ffffff"},Xs=[{id:"clean",name:"ç®æ´ç°",nameKey:"pipeline.stepUI.sizeTable.themes.clean",style:_t},{id:"rose",name:"ç«ç°ç²",nameKey:"pipeline.stepUI.sizeTable.themes.rose",style:{headerBg:"#fce7f3",headerText:"#9d174d",cellBg:"#ffffff",cellText:"#500724",border:"#f9a8d4",titleText:"#831843",tableBg:"#fff1f2"}},{id:"navy",name:"åå¡è",nameKey:"pipeline.stepUI.sizeTable.themes.navy",style:{headerBg:"#1e3a8a",headerText:"#ffffff",cellBg:"#ffffff",cellText:"#1e293b",border:"#cbd5e1",titleText:"#0f172a",tableBg:"#ffffff"}},{id:"luxury",name:"奢åé",nameKey:"pipeline.stepUI.sizeTable.themes.luxury",style:{headerBg:"#111827",headerText:"#fbbf24",cellBg:"#0b1220",cellText:"#f3e8a7",border:"#3f3f46",titleText:"#fbbf24",tableBg:"#0b1220"}},{id:"nature",name:"èªç¶ç»¿",nameKey:"pipeline.stepUI.sizeTable.themes.nature",style:{headerBg:"#d1fae5",headerText:"#065f46",cellBg:"#ffffff",cellText:"#064e3b",border:"#a7f3d0",titleText:"#065f46",tableBg:"#ecfdf5"}}],Ys={å°ºç :"Size",è¸å´:"Bust",è©å®½:"Shoulder",è¡£é¿:"Length",è¢é¿:"Sleeve",䏿å´:"Hem",è
°å´:"Waist",èå´:"Hip",裤é¿:"Pants length",大è
¿å´:"Thigh",裤èå´:"Leg opening","è
°å´(inch)":"Waist (inch)","è
°å´(cm)":"Waist (cm)",è£é¿:"Skirt length",ä¸è¸å´:"Over-bust",ä¸è¸å´:"Under-bust",éåè¸å´:"Fits bust",罩æ¯:"Cup",身é«:"Height","ä½é(kg)":"Weight (kg)",å
é¿:"Insole length",è£é¿:"Rise",忰项:"Parameter",è§æ ¼:"Spec",宽度:"Width",é¿åº¦:"Length",å¨é¿:"Circumference","æ¯ 100g å«é":"Per 100g","æ¯ 100ml å«é":"Per 100ml"},Mt=(i,t)=>t?i:i.map(r=>Ys[r]||r);function Js({stepDef:i,stepState:t,category:r,isLoading:s,onExecute:l,onNext:a}){const{t:o,i18n:n}=re(),c=(n.language||"").startsWith("zh"),d=t==null?void 0:t.status,p=ae(h=>
51h.executingStepId),I=ae(h=>h.project),N=p===i.id,k=I?`pipeline-size-table:${I.id}`:null,K=Ae[i.id]||ui,{templates:C,order:A,defaultId:_}=Vs(i.id,r),[E,P]=u.useState(_),[z,f]=u.useState("cm"),[U,L]=u.useState(Mt(C[_].columns,c)),[S,D]=u.useState(C[_].rows),[q,X]=u.useState(C[_].unitScope),[W,ne]=u.useState(_t),[V,O]=u.useState(!1);u.useEffect(()=>{var M,b;if(V)return;const g=((b=(M=t==null?void 0:t.result)==null?void 0:M.metadata)==null?void 0:b.table)||(()=>{if(!k)return null;try{const F=localStorage.getItem(k);return F?JSON.parse(F):null}catch{return null}})();g&&Array.isArray(g.columns)&&Array.isArray(g.rows)&&(P(typeof g.category=="string"?g.category:_),f(g.unit==="in"?"in":"cm"),L(g.columns),D(g.rows),X(Array.isArray(g.unitScope)?g.unitScope:[]),g.style&&typeof g.style=="object"&&ne({..._t,...g.style})),O(!0)},[V,k,t==null?void 0:t.result]),u.useEffect(()=>{if(!(!k||!V))try{localStorage.setItem(k,JSON.stringify({category:E,unit:z,columns:U,rows:S,unitScope:q,style:W}))}catch{}},[k,V,E,z,U,S,q,W]);const $=h=>{const g=C[h];g&&(P(h),L(Mt(g.columns,c)),D(g.rows.map(M=>[...M])),X([...g.unitScope]),f("cm"))},Y=()=>{const h=z==="cm"?"in":"cm",g=h==="in"?Ds:2.54;D(M=>M.map(b=>b.map((F,oe)=>{if(!q.includes(oe))return F;const ge=Number(F);return Number.isFinite(ge)?Math.round(ge*g*10)/10:F}))),f(h)},R=(h,g,M)=>{D(b=>b.map((F,oe)=>oe===h?F.map((ge,ue)=>ue===g?M:ge):F))},ie=(h,g)=>{L(M=>M.map((b,F)=>F===h?g:b))},le=()=>D(h=>[...h,U.map((g,M)=>M===0?o("pipeline.stepUI.sizeTable.newSizeRow"):0)]),Z=h=>D(g=>g.filter((M,b)=>b!==h)),be=()=>{L(h=>[...h,o("pipeline.stepUI.sizeTable.newDimension")]),D(h=>h.map(g=>[...g,0])),X(h=>[...h,U.length])},v=h=>{U.length<=2||(L(g=>g.filter((M,b)=>b!==h)),D(g=>g.map(M=>M.filter((b,F)=>F!==h))),X(g=>g.filter(M=>M!==h).map(M=>M>h?M-1:M)))},T=()=>$(E),H=()=>{l(i.id,"generate",{table:{category:E,unit:z,columns:U,rows:S,unitScope:q,style:W}})},B=u.useRef(null),[y,x]=u.useState(!1),j=async()=>{if(y)return;x(!0);const h=document.createElement("div");
51Object.assign(h.style,{position:"fixed",left:"-99999px",top:"0",padding:"24px",background:W.tableBg,border:`1px solid ${W.border}`,borderRadius:"12px",fontFamily:getComputedStyle(document.body).fontFamily,width:"820px",boxSizing:"border-box"});const g=document.createElement("div"),M=(()=>{const ue=C[E];return((ue!=null&&ue.nameKey?o(ue.nameKey):ue==null?void 0:ue.name)||o("pipeline.stepUI.sizeTable.defaultTitle")).split("ï¼")[0].split("(")[0]})();g.textContent=o("pipeline.stepUI.sizeTable.titleFormat",{name:M,unit:z}),Object.assign(g.style,{textAlign:"center",fontWeight:"700",fontSize:"16px",marginBottom:"14px",color:W.titleText}),h.appendChild(g);const b=document.createElement("table");Object.assign(b.style,{width:"100%",borderCollapse:"collapse",fontSize:"14px"});const F=document.createElement("thead"),oe=document.createElement("tr");U.forEach(ue=>{const Ne=document.createElement("th");Object.assign(Ne.style,{border:`1px solid ${W.border}`,background:W.headerBg,color:W.headerText,padding:"10px 8px",fontWeight:"500",textAlign:"center"}),Ne.textContent=ue,oe.appendChild(Ne)}),F.appendChild(oe),b.appendChild(F);const ge=document.createElement("tbody");S.forEach(ue=>{const Ne=document.createElement("tr");ue.forEach(ke=>{const qe=document.createElement("td");Object.assign(qe.style,{border:`1px solid ${W.border}`,background:W.cellBg,color:W.cellText,padding:"8px",textAlign:"center"}),qe.textContent=String(ke),Ne.appendChild(qe)}),ge.appendChild(Ne)}),b.appendChild(ge),h.appendChild(b),document.body.appendChild(h);try{const Ne=(await di(h,{backgroundColor:null,scale:2,useCORS:!0,logging:!1})).toDataURL("image/png"),ke=document.createElement("a");ke.href=Ne,ke.download=`size-table-${E}-${Date.now()}.png`,document.body.appendChild(ke),ke.click(),document.body.removeChild(ke)}catch(ue){console.error("[SizeTable] export failed",ue)}finally{h.parentNode&&h.parentNode.removeChild(h),x(!1)}};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(K,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),o(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:o(i.descKey)}),e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:A.map(h=>{const g=C[h],M=g.nameKey?o(g.nameKey):g.name;return e.jsx("button",{onClick:()=>$(h),className:`px-3 py-1 rounded-md text-xs transition-all cursor-pointer ${E===h?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:M},h)})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs("button",{onClick:Y,className:"px-3 py-1 rounded-md text-xs border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] cursor-pointer inline-flex items-center gap-1",children:[e.jsx(is,{className:"w-3 h-3"})," ",o(z==="cm"?"pipeline.stepUI.sizeTable.unitToInch":"pipeline.stepUI.sizeTable.unitToCm")," ",o("pipeline.stepUI.sizeTable.currentUnit",{unit:z})]}),e.jsxs("button",{onClick:T,className:"px-3 py-1 rounded-md text-xs border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] cursor-pointer inline-flex items-center gap-1",children:[e.jsx(me,{className:"w-3 h-3"})," ",o("pipeline.stepUI.sizeTable.resetTemplate")]})]})]}),e.jsxs("div",{className:"rounded-xl border border-ui-border bg-[var(--bg-secondary)] p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:o("pipeline.stepUI.sizeTable.colorScheme")}),e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Xs.map(h=>e.jsxs("button",{onClick:()=>ne(h.style),className:"px-2.5 py-1 rounded-md text-[10px] border border-ui-border hover:bg-[var(--bg-tertiary)] cursor-pointer inline-flex items-center gap-1",children:[e.jsx("span",{className:"w-3 h-3 rounded-sm border border-ui-border",style:{background:h.style.headerBg}}),o(h.nameKey)]}
51,h.id))})]}),e.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-7 gap-2 text-[10px] text-[var(--text-tertiary)]",children:[["tableBg","pipeline.stepUI.sizeTable.colorTableBg"],["headerBg","pipeline.stepUI.sizeTable.colorHeaderBg"],["headerText","pipeline.stepUI.sizeTable.colorHeaderText"],["cellBg","pipeline.stepUI.sizeTable.colorCellBg"],["cellText","pipeline.stepUI.sizeTable.colorCellText"],["border","pipeline.stepUI.sizeTable.colorBorder"],["titleText","pipeline.stepUI.sizeTable.colorTitle"]].map(([h,g])=>e.jsxs("label",{className:"flex flex-col items-center gap-1 cursor-pointer",children:[e.jsx("span",{children:o(g)}),e.jsx("input",{type:"color",value:W[h],onChange:M=>ne(b=>({...b,[h]:M.target.value})),className:"w-10 h-6 rounded border border-ui-border cursor-pointer"})]},h))})]}),e.jsxs("div",{ref:B,className:"rounded-xl p-5",style:{background:W.tableBg,border:`1px solid ${W.border}`},children:[e.jsx("div",{className:"text-center font-bold text-base mb-3",style:{color:W.titleText},contentEditable:!0,suppressContentEditableWarning:!0,onBlur:h=>{},dangerouslySetInnerHTML:{__html:(()=>{const h=C[E],M=((h!=null&&h.nameKey?o(h.nameKey):h==null?void 0:h.name)||o("pipeline.stepUI.sizeTable.defaultTitle")).split("ï¼")[0].split("(")[0];return o("pipeline.stepUI.sizeTable.titleFormat",{name:M,unit:z})})()}}),e.jsxs("table",{className:"w-full text-sm",style:{borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[U.map((h,g)=>e.jsx("th",{style:{border:`1px solid ${W.border}`,background:W.headerBg,color:W.headerText,padding:"8px",fontWeight:500},children:e.jsx("div",{contentEditable:!0,suppressContentEditableWarning:!0,onBlur:M=>ie(g,M.currentTarget.textContent??""),className:"outline-none focus:ring-1 focus:ring-ui-accent rounded",style:{textAlign:"center",minHeight:"1.2em"},dangerouslySetInnerHTML:{__html:h}})},`h-${g}-${h}`)),e.jsx("th",{"data-html2canvas-ignore":"true",style:{border:"none",width:"32px"}})]})}),e.jsx("tbody",{children:S.map((h,g)=>e.jsxs("tr",{children:[h.map((M,b)=>e.jsx("td",{style:{border:`1px solid ${W.border}`,background:W.cellBg,color:W.cellText,padding:"6px",textAlign:"center"},children:e.jsx("div",{contentEditable:!0,suppressContentEditableWarning:!0,onBlur:F=>R(g,b,F.currentTarget.textContent??""),className:"outline-none focus:ring-1 focus:ring-ui-accent rounded",style:{textAlign:"center",minHeight:"1.2em"},dangerouslySetInnerHTML:{__html:String(M)}})},`c-${g}-${b}-${String(M)}`)),e.jsx("td",{"data-html2canvas-ignore":"true",style:{border:"none",padding:"4px",width:"32px",textAlign:"center"},children:e.jsx("button",{onClick:()=>Z(g),className:"text-gray-400 hover:text-[var(--error)] cursor-pointer",title:o("pipeline.stepUI.sizeTable.removeRowTitle"),children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})})]},g))})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{onClick:le,className:"px-3 py-1.5 rounded-md text-xs border border-dashed border-ui-border text-[var(--text-secondary)] hover:border-ui-accent hover:text-ui-accent cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",o("pipeline.stepUI.sizeTable.addRow")]}),e.jsxs("button",{onClick:be,className:"px-3 py-1.5 rounded-md text-xs border border-dashed border-ui-border text-[var(--text-secondary)] hover:border-ui-accent hover:text-ui-accent cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",o("pipeline.stepUI.sizeTable.addColumn")]}),U.length>2&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 text-xs text-[var(--text-tertiary)]",children:[o("pipeline.stepUI.sizeTable.removeColumnLabel"),U.map((h,g)=>e.jsx("button",{onClick:()=>v(g),className:"px-1.5 py-0.5 rounded border border-ui-border hover:border-[var(--error)] hover:text-[var(--error)] cursor-pointer",title:o("pipeline.stepUI.sizeTable.removeColumnTitle",{col:h}),children:h},g))]})]}),d==="completed"&&e.jsxs("div",{className:"text-[var(--success)] text-sm flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}
51)," ",o("pipeline.stepUI.sizeTable.savedToProject")]}),d==="error"&&e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||o("pipeline.stepUI.sizeTable.saveFailed")]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs("button",{onClick:H,disabled:s,className:"inline-flex items-center justify-center gap-1.5 px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[N?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx($t,{className:"w-4 h-4"}),o(d==="completed"?"pipeline.stepUI.sizeTable.updateAndSave":"pipeline.stepUI.sizeTable.saveToProject")]}),e.jsxs("button",{onClick:j,disabled:y,className:"inline-flex items-center justify-center gap-1.5 px-5 py-2 rounded-lg border border-ui-border text-[var(--text-primary)] text-sm hover:bg-[var(--bg-tertiary)] disabled:opacity-50 transition-all cursor-pointer",children:[y?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(Fe,{className:"w-4 h-4"}),o(y?"pipeline.stepUI.sizeTable.exporting":"pipeline.stepUI.sizeTable.exportImage")]}),d==="completed"&&e.jsxs("button",{onClick:a,className:"ml-auto px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer inline-flex items-center gap-1.5",children:[o("pipeline.stepUI.sizeTable.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]}),d!=="completed"&&!i.required&&e.jsxs("button",{onClick:()=>{l(i.id,"skip"),a()},disabled:s,className:"ml-auto px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",o("pipeline.stepUI.sizeTable.skipNext")]})]})]})]})}const Ft=[{id:"taobao",labelKey:"pipeline.stepUI.descCopy.platforms.taobao"},{id:"jd",labelKey:"pipeline.stepUI.descCopy.platforms.jd"},{id:"pdd",labelKey:"pipeline.stepUI.descCopy.platforms.pdd"},{id:"douyin",labelKey:"pipeline.stepUI.descCopy.platforms.douyin"},{id:"xiaohongshu",labelKey:"pipeline.stepUI.descCopy.platforms.xiaohongshu"},{id:"amazon",labelKey:"pipeline.stepUI.descCopy.platforms.amazon"}],Zs=[{id:"professional",labelKey:"pipeline.stepUI.descCopy.styles.default.professional"},{id:"lively",labelKey:"pipeline.stepUI.descCopy.styles.default.lively"},{id:"concise",labelKey:"pipeline.stepUI.descCopy.styles.default.concise"},{id:"luxury",labelKey:"pipeline.stepUI.descCopy.styles.default.luxury"}],Qs=[{id:"tech_geek",labelKey:"pipeline.stepUI.descCopy.styles.3c.tech_geek"},{id:"business_premium",labelKey:"pipeline.stepUI.descCopy.styles.3c.business_premium"},{id:"youth_trendy",labelKey:"pipeline.stepUI.descCopy.styles.3c.youth_trendy"},{id:"hardcore_fan",labelKey:"pipeline.stepUI.descCopy.styles.3c.hardcore_fan"},{id:"value_buyer",labelKey:"pipeline.stepUI.descCopy.styles.3c.value_buyer"},{id:"professional",labelKey:"pipeline.stepUI.descCopy.styles.3c.professional"}],er=[{id:"soft_seeding",labelKey:"pipeline.stepUI.descCopy.styles.beauty.soft_seeding"},{id:"ingredient_geek",labelKey:"pipeline.stepUI.descCopy.styles.beauty.ingredient_geek"},{id:"petite_luxury",labelKey:"pipeline.stepUI.descCopy.styles.beauty.petite_luxury"},{id:"fairy_mommy",labelKey:"pipeline.stepUI.descCopy.styles.beauty.fairy_mommy"},{id:"hardcore_review",labelKey:"pipeline.stepUI.descCopy.styles.beauty.hardcore_review"},{id:"professional",labelKey:"pipeline.stepUI.descCopy.styles.beauty.professional"}],tr=[{id:"yummy_share",labelKey:"pipeline.stepUI.descCopy.styles.food.yummy_share"},{id:"healthy_nutrition",labelKey:"pipeline.stepUI.descCopy.styles.food.healthy_nutrition"},{id:"family_warm",labelKey:"pipeline.stepUI.descCopy.styles.food.family_warm"},{id:"imported_premium",labelKey:"pipeline.stepUI.descCopy.styles.food.imported_premium"},{id:"internet_famous",labelKey:"pipeline.stepUI.descCopy.styles.food.internet_famous"},{id:"professional",labelKey:"pipeline.stepUI.descCopy.styles.food.professional"}],ir=[{id:"new_chinese",labelKey:"pipeline.stepUI.descCopy.styles.home.new_chinese"},{id:"nordic_simple",labelKey:"pipeline.stepUI.descCopy.styles.home.nordic_simple"},{id:"japanese_wood",labelKey:"pipeline.stepUI.descCopy.styles.home.japanese_wood"},{id:"cream_luxury",labelKey:"pipeline.stepUI.descCopy.styles.home.cream_luxury"},{id:"industrial_hard",labelKey:"pipeline.stepUI.descCopy.styles.home.industrial_hard"},{id:"professional",labelKey:"pipeline.stepUI.descCopy.styles.home.professional"}],sr=[{id:"haute_luxury",labelKey:"pipeline.stepUI.descCopy.styles.jewelry.haute_luxury"},{id:"valentine_gift",labelKey:"pipeline.stepUI.descCopy.styles.jewelry.valentine_gift"},{id:"heirloom_classic",labelKey:"pipeline.stepUI.descCopy.styles.jewelry.heirloom_classic"}
51,{id:"everyday_versatile",labelKey:"pipeline.stepUI.descCopy.styles.jewelry.everyday_versatile"},{id:"collector_level",labelKey:"pipeline.stepUI.descCopy.styles.jewelry.collector_level"},{id:"professional",labelKey:"pipeline.stepUI.descCopy.styles.jewelry.professional"}];function rr(i){return i==="3c"?Qs:i==="beauty"?er:i==="food"?tr:i==="home"?ir:i==="jewelry"?sr:Zs}const it=12,Bt=[{id:"zh",label:"ç®ä½ä¸æ",nativeName:"ç®ä½ä¸æ"},{id:"zh-TW",label:"ç¹é«ä¸æ",nativeName:"ç¹é«ä¸æ"},{id:"en",label:"English",nativeName:"English"},{id:"ja",label:"æ¥æ¬èª",nativeName:"æ¥æ¬èª"},{id:"ko",label:"íêµì´",nativeName:"íêµì´"},{id:"es",label:"Español",nativeName:"Español"},{id:"fr",label:"Français",nativeName:"Français"},{id:"de",label:"Deutsch",nativeName:"Deutsch"},{id:"vi",label:"Tiếng Viá»t",nativeName:"Tiếng Viá»t"},{id:"th",label:"ภาษาà¹à¸à¸¢",nativeName:"ภาษาà¹à¸à¸¢"}];function Wt(i){if(!i)return null;try{return JSON.parse(i)}catch{}const t=i.match(/```(?:json)?\s*\n?([\s\S]*?)\n?\s*```/);if(t)try{return JSON.parse(t[1])}catch{}const r=i.match(/\{[\s\S]*\}/);if(r)try{return JSON.parse(r[0])}catch{}return null}function nr({stepDef:i,stepState:t,allStepStates:r,category:s,isLoading:l,onExecute:a,onNext:o}){var h,g,M;const{t:n}=re(),c=rr(s),d=t==null?void 0:t.status,p=ae(b=>b.executingStepId),I=ae(b=>b.project),N=p===i.id,k=I?`pipeline-desc-copy:${I.id}`:null,K=Ae[i.id]||zt,C=[];for(const b of r)if(!(b.status!=="completed"||!((h=b.result)!=null&&h.files)))for(const F of b.result.files)C.push({url:F,source:b.id});const[A,_]=u.useState([]),[E,P]=u.useState("taobao"),[z,f]=u.useState("professional"),[U,L]=u.useState("zh"),[S,D]=u.useState(""),[q,X]=u.useState(!1);u.useEffect(()=>{if(q||!k){q||X(!0);return}try{const b=localStorage.getItem(k);if(b){const F=JSON.parse(b);typeof F.platformId=="string"&&P(F.platformId),typeof F.styleId=="string"&&f(F.styleId),typeof F.languageId=="string"&&L(F.languageId),typeof F.notes=="string"&&D(F.notes)}}catch{}X(!0)},[q,k]),u.useEffect(()=>{if(!(!k||!q))try{localStorage.setItem(k,JSON.stringify({platformId:E,styleId:z,languageId:U,notes:S}))}catch{}},[k,q,E,z,U,S]);const W=b=>{_(F=>F.includes(b)?F.filter(oe=>oe!==b):F.length>=it?[...F.slice(1),b]:[...F,b])},ne=()=>{var Ne;if(A.length===0)return;const b=Ft.find(ke=>ke.id===E),F=n(b?b.labelKey:"pipeline.stepUI.descCopy.platforms.taobao"),oe=c.find(ke=>ke.id===z),ge=n(oe?oe.labelKey:"pipeline.stepUI.descCopy.styles.default.professional"),ue=((Ne=Bt.find(ke=>ke.id===U))==null?void 0:Ne.label)||"ç®ä½ä¸æ";a(i.id,"generate",{imageUrls:A,platform:F,style:ge,language:ue,notes:S.trim()})},V=Wt((g=t==null?void 0:t.result)==null?void 0:g.text),[O,$]=u.useState(""),[Y,R]=u.useState([]),[ie,le]=u.useState(""),[Z,be]=u.useState(!1),v=(M=t==null?void 0:t.result)==null?void 0:M.text;u.useEffect(()=>{const b=Wt(v);$(typeof(b==null?void 0:b.title)=="string"?b.title:""),R(Array.isArray(b==null?void 0:b.highlights)?b.highlights:[]),le(typeof(b==null?void 0:b.description)=="string"?b.description:""),be(!1)},[v]);const T=()=>{Z||be(!0)},H=(b,F)=>{R(oe=>oe.map((ge,ue)=>ue===b?F:ge)),T()},B=()=>{R(b=>[...b,""]),T()},y=b=>{R(F=>F.filter((oe,ge)=>ge!==b)),T()},x=()=>{a(i.id,"generate",{preRendered:{title:O,highlights:Y.filter(b=>b.trim()!==""),description:ie},imageUrls:A}),be(!1)},j=b=>{navigator.clipboard.writeText(b).catch(()=>{})};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(K,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),n(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:n(i.descKey)}),e.jsxs("div",{className:"space-y-5 mt-4",children:[C.length===0&&e.jsxs("div",{className:"rounded-lg border border-[var(--warning)]/30 bg-[var(--warning)]/5 p-3 text-sm text-[var(--warning)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",n("pipeline.stepUI.descCopy.noInputImagesWarning")]}),C.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("label",{className:"text-sm font-medium text-[var(--text-primary)]",children:[n("pipeline.stepUI.descCopy.referenceImagesLabel.prefix"),e.jsx("span",{className:A.length>=it?"text-[var(--warning)]":"text-ui-accent",children:A.length}),n("pipeline.stepUI.descCopy.referenceImagesLabel.suffix",{max:it})]}),e.jsxs("div",{className:"flex gap-2 text-[10px]",children:[e.jsx("button",{onClick:()=>_(C.slice(0,it).map(b=>b.url)),className:"text-ui-accent hover:underline cursor-pointer",children:n("pipeline.stepUI.descCopy.selectAll",{count:it})}),e.jsx("span",{className:"text-[var(--text-tertiary)]",children:"·"}),e.jsx("button",{onClick:()=>_([]),className:"text-[var(--text-tertiary)] hover:underline cursor-pointer",children:n("pipeline.stepUI.descCopy.clearSelection")})]})]}),e.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:C.map(({url:b,source:F},oe)=>{const ge=A.includes(b),ue=A.indexOf(b);return e.jsxs("button",{onClick:()=>W(b),className:`relative rounded-lg overflow-hidden aspect-square border-2 cursor-pointer transition-all ${ge?"border-ui-accent ring-1 ring-ui-accent/30":"border-transparent hover:border-ui-border"}`,children:[e.jsx("img",{src:b,alt:"",crossOrigin:xe(b),className:"absolute inset-0 w-full h-full object-cover"}),e.jsx("span",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-white text-[9px] text-center leading-[14px]",children:F}),ge&&e.jsx("span",{className:"absolute top-1 right-1 w-5 h-5 rounded-full bg-ui-accent text-white flex items-center justify-center text-[10px] font-bold",children:ue+1})]},`${b}-${oe}`)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.descCopy.targetPlatform")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ft.map(b=>e.jsx("button",{onClick:()=>
51P(b.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${E===b.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:n(b.labelKey)},b.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.descCopy.languageStyle")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.map(b=>e.jsx("button",{onClick:()=>f(b.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${z===b.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:n(b.labelKey)},b.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.descCopy.outputLanguage")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Bt.map(b=>e.jsx("button",{onClick:()=>L(b.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${U===b.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:b.nativeName},b.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.descCopy.notesLabel")}),e.jsx("textarea",{value:S,onChange:b=>D(b.target.value),rows:2,placeholder:n("pipeline.stepUI.descCopy.notesPlaceholder"),className:"w-full px-3 py-2 rounded-lg bg-[var(--bg-primary)] border border-ui-border text-xs text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] focus:outline-none focus:border-ui-accent resize-none"})]}),d==="completed"&&V&&e.jsxs("div",{className:"rounded-xl border border-ui-border bg-[var(--bg-secondary)] p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[var(--success)] text-sm font-medium",children:[e.jsx(fe,{className:"w-4 h-4"})," ",n("pipeline.stepUI.descCopy.generatedTitle"),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[n("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]}),Z&&e.jsx("span",{className:"text-[10px] text-[var(--warning)]",children:n("pipeline.stepUI.descCopy.unsavedChanges")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:n("pipeline.stepUI.descCopy.productTitle",{count:O.length})}),e.jsxs("button",{onClick:()=>j(O),className:"text-[10px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-0.5",children:[e.jsx(vt,{className:"w-3 h-3"})," ",n("pipeline.stepUI.descCopy.copy")]})]}),e.jsx("input",{type:"text",value:O,onChange:b=>{$(b.target.value),T()},className:"w-full text-sm text-[var(--text-primary)] bg-[var(--bg-primary)] rounded p-2 border border-ui-border focus:outline-none focus:border-ui-accent"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:n("pipeline.stepUI.descCopy.highlights",{count:Y.length})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:B,className:"text-[10px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-0.5",children:[e.jsx(we,{className:"w-3 h-3"})," ",n("pipeline.stepUI.descCopy.addOne")]}),e.jsxs("button",{onClick:()=>j(Y.map((b,F)=>`${F+1}. ${b}`).join(` 52`)),className:"text-[10px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-0.5",children:[e.jsx(vt,{className:"w-3 h-3"})," ",n("pipeline.stepUI.descCopy.copyAll")]})]})]}),e.jsxs("div",{className:"space-y-1 bg-[var(--bg-primary)] rounded p-2 border border-ui-border",children:[Y.map((b,F)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-ui-accent font-medium text-sm w-5 text-center shrink-0",children:[F+1,"."]}
52),e.jsx("input",{type:"text",value:b,onChange:oe=>H(F,oe.target.value),className:"flex-1 text-sm text-[var(--text-primary)] bg-transparent border-b border-transparent hover:border-ui-border focus:outline-none focus:border-ui-accent px-1 py-0.5"}),e.jsx("button",{onClick:()=>y(F),className:"p-1 rounded text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer shrink-0",title:n("pipeline.stepUI.descCopy.delete"),children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},F)),Y.length===0&&e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] text-center py-2",children:n("pipeline.stepUI.descCopy.noHighlights")})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:n("pipeline.stepUI.descCopy.descriptionLabel",{count:ie.length})}),e.jsxs("button",{onClick:()=>j(ie),className:"text-[10px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-0.5",children:[e.jsx(vt,{className:"w-3 h-3"})," ",n("pipeline.stepUI.descCopy.copy")]})]}),e.jsx("textarea",{value:ie,onChange:b=>{le(b.target.value),T()},rows:Math.max(6,Math.ceil(ie.length/50)),className:"w-full text-sm text-[var(--text-primary)] bg-[var(--bg-primary)] rounded p-2 border border-ui-border focus:outline-none focus:border-ui-accent resize-y leading-relaxed whitespace-pre-wrap"})]}),Z&&e.jsxs("button",{onClick:x,disabled:l,className:"inline-flex items-center justify-center gap-1.5 px-4 py-2 rounded-lg bg-[var(--success)] text-white text-sm font-medium hover:opacity-90 disabled:opacity-50 cursor-pointer",children:[e.jsx($t,{className:"w-4 h-4"})," ",n("pipeline.stepUI.descCopy.saveEdit")]})]}),d==="error"&&e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||n("pipeline.stepUI.descCopy.generationFailed")]}),e.jsx("div",{className:"flex gap-3",children:d==="completed"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ne,disabled:l||A.length===0,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] cursor-pointer disabled:opacity-50",children:[N?e.jsx(ee,{className:"w-3 h-3 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3 h-3 inline mr-1"}),n(N?"pipeline.stepUI.descCopy.generating":"pipeline.common.regenerate")]}),e.jsxs("button",{onClick:o,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 cursor-pointer inline-flex items-center gap-1.5",children:[n("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]}):d==="error"?e.jsxs("button",{onClick:()=>a(i.id,"retry"),disabled:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm hover:opacity-90 disabled:opacity-50 cursor-pointer",children:[N?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.retry")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:ne,disabled:l||A.length===0,className:"inline-flex items-center justify-center gap-1.5 px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 cursor-pointer",children:[N?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:n("pipeline.stepUI.descCopy.generateCopyWithCount",{count:A.length})}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{a(i.id,"skip"),o()},disabled:l,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.skipNext")]})]})})]})]})}function ar(i,t){if(i.match(/^[a-z]+:\/\//i))return i;if(i.match(/^\/\//))return window.location.protocol+i;if(i.match(/^[a-z]+:/i))return i;const r=document.implementation.createHTMLDocument(),s=r.createElement("base"),l=r.createElement("a");return r.head.appendChild(s),r.body.appendChild(l),t&&(s.href=t),l.href=i,l.href}const lr=(()=>{let i=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(i+=1,`u${t()}${i}`)})();function We(i){const t=[];for(let r=0,s=i.length;r<s;r++)t.push(i[r]);return t}let Qe=null;function bi(i={}){return Qe||(i.includeStyleProperties?(Qe=i.includeStyleProperties,Qe):(Qe=We(window.getComputedStyle(document.documentElement)),Qe))}function ut(i,t){const s=(i.ownerDocument.defaultView||window).getComputedStyle(i).getPropertyValue(t);return s?parseFloat(s.replace("px","")):0}function or(i){const t=ut(i,"border-left-width"),r=ut(i,"border-right-width");return i.clientWidth+t+r}function cr(i){const t=ut(i,"border-top-width"),r=ut(i,"border-bottom-width");return i.clientHeight+t+r}function yi(i,t={}){const r=t.width||or(i),s=t.height||cr(i);return{width:r,height:s}}function dr(){let i,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(i=parseInt(r,10),Number.isNaN(i)&&(i=1)),i||window.devicePixelRatio||1}const Se=16384;function pr(i){(i.width>Se||i.height>Se)&&(i.width>Se&&i.height>Se?i.width>i.height?(i.height*=Se/i.width,i.width=Se):(i.width*=Se/i.height,i.height=Se):i.width>Se?(i.height*=Se/i.width,i.width=Se):(i.width*=Se/i.height,i.height=Se))}function xt(i){return new Promise((t,r)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=r,s.crossOrigin="anonymous",s.decoding="async",s.src=i})}async function mr(i){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function ur(i,t,r){const s="http://www.w3.org/2000/svg",l=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return l.setAttribute("width",`${t}`),l.setAttribute("height",`${r}`),l.setAttribute("viewBox",`0 0 ${t} ${r}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),l.appendChild(a),a.appendChild(i),mr(l)}const Ee=(i,t)=>{if(i instanceof t)return!0;const r=Object.getPrototypeOf(i);return r===null?!1:r.constructor.name===t.name||Ee(r,t)};function xr(i){const t=i.getPropertyValue("content");return`${i.cssText} content: '${t.replace(/'|"/g,"")}';`}function hr(i,t){return bi(t).map(r=>{const s=i.getPropertyValue(r),l=i.getPropertyPriority(r);return`${r}: ${s}${l?" !important":""};`}).join(" ")}function gr(i,t,r,s){const l=`.${i}:${t}`,a=r.cssText?xr(r):hr(r,s);return document.createTextNode(`${l}{${a}}`)}function Gt(i,t,r,s){const l=window.getComputedStyle(i,r),a=l.getPropertyValue("content");
52if(a===""||a==="none")return;const o=lr();try{t.className=`${t.className} ${o}`}catch{return}const n=document.createElement("style");n.appendChild(gr(o,r,l,s)),t.appendChild(n)}function br(i,t,r){Gt(i,t,":before",r),Gt(i,t,":after",r)}const qt="application/font-woff",Vt="image/jpeg",yr={woff:qt,woff2:qt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Vt,jpeg:Vt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function fr(i){const t=/\.([^./]*?)$/g.exec(i);return t?t[1]:""}function Lt(i){const t=fr(i).toLowerCase();return yr[t]||""}function vr(i){return i.split(/,/)[1]}function Ut(i){return i.search(/^(data:)/)!==-1}function jr(i,t){return`data:${t};base64,${i}`}async function fi(i,t,r){const s=await fetch(i,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const l=await s.blob();return new Promise((a,o)=>{const n=new FileReader;n.onerror=o,n.onloadend=()=>{try{a(r({res:s,result:n.result}))}catch(c){o(c)}},n.readAsDataURL(l)})}const wt={};function wr(i,t,r){let s=i.replace(/\?.*/,"");return r&&(s=i),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function Ot(i,t,r){const s=wr(i,t,r.includeQueryParams);if(wt[s]!=null)return wt[s];r.cacheBust&&(i+=(/\?/.test(i)?"&":"?")+new Date().getTime());let l;try{const a=await fi(i,r.fetchRequestInit,({res:o,result:n})=>(t||(t=o.headers.get("Content-Type")||""),vr(n)));l=jr(a,t)}catch(a){l=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${i}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return wt[s]=l,l}async function Nr(i){const t=i.toDataURL();return t==="data:,"?i.cloneNode(!1):xt(t)}async function kr(i,t){if(i.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=i.clientWidth,a.height=i.clientHeight,o==null||o.drawImage(i,0,0,a.width,a.height);const n=a.toDataURL();return xt(n)}const r=i.poster,s=Lt(r),l=await Ot(r,s,t);return xt(l)}async function Ir(i,t){var r;try{if(!((r=i==null?void 0:i.contentDocument)===null||r===void 0)&&r.body)return await bt(i.contentDocument.body,t,!0)}catch{}return i.cloneNode(!1)}async function _r(i,t){return Ee(i,HTMLCanvasElement)?Nr(i):Ee(i,HTMLVideoElement)?kr(i,t):Ee(i,HTMLIFrameElement)?Ir(i,t):i.cloneNode(vi(i))}const Ur=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SLOT",vi=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SVG";async function Cr(i,t,r){var s,l;if(vi(t))return t;let a=[];return Ur(i)&&i.assignedNodes?a=We(i.assignedNodes()):Ee(i,HTMLIFrameElement)&&(!((s=i.contentDocument)===null||s===void 0)&&s.body)?a=We(i.contentDocument.body.childNodes):a=We(((l=i.shadowRoot)!==null&&l!==void 0?l:i).childNodes),a.length===0||Ee(i,HTMLVideoElement)||await a.reduce((o,n)=>o.then(()=>bt(n,r)).then(c=>{c&&t.appendChild(c)}),Promise.resolve()),t}function Tr(i,t,r){const s=t.style;if(!s)return;const l=window.getComputedStyle(i);l.cssText?(s.cssText=l.cssText,s.transformOrigin=l.transformOrigin):bi(r).forEach(a=>{let o=l.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),Ee(i,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),s.setProperty(a,o,l.getPropertyPriority(a))})}function Er(i,t){Ee(i,HTMLTextAreaElement)&&(t.innerHTML=i.value),Ee(i,HTMLInputElement)&&t.setAttribute("value",i.value)}function Kr(i,t){if(Ee(i,HTMLSelectElement)){const r=t,s=Array.from(r.children).find(l=>i.value===l.getAttribute("value"));s&&s.setAttribute("selected","")}}function Sr(i,t,r){return Ee(t,Element)&&(Tr(i,t,r),br(i,t,r),Er(i,t),Kr(i,t)),t}async function Pr(i,t){const r=i.querySelectorAll?i.querySelectorAll("use"):[];if(r.length===0)return i;const s={};for(let a=0;a<r.length;a++){const n=r[a].getAttribute("xlink:href");if(n){const c=i.querySelector(n),d=document.querySelector(n);!c&&d&&!s[n]&&(s[n]=await bt(d,t,!0))}}const l=Object.values(s);if(l.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const n=document.createElementNS(a,"defs");o.appendChild(n);for(let c=0;c<l.length;c++)n.appendChild(l[c]);i.appendChild(o)}return i}async function bt(i,t,r){return!r&&t.filter&&!t.filter(i)?null:Promise.resolve(i).then(s=>_r(s,t)).then(s=>Cr(i,s,t)).then(s=>Sr(i,s,t)).then(s=>Pr(s,t))}const ji=/url\((['"]?)([^'"]+?)\1\)/g,Rr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ar=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function zr(i){const t=i.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function $r(i){const t=[];return i.replace(ji,(r,s,l)=>(t.push(l),r)),t.filter(r=>!Ut(r))}async function Lr(i,t,r,s,l){try{const a=r?ar(t,r):t,o=Lt(t);let n;return l||(n=await Ot(a,o,s)),i.replace(zr(t),`$1${n}$3`)}catch{}return i}function Or(i,{preferredFontFormat:t}){return t?i.replace(Ar,r=>{for(;;){const[s,,l]=Rr.exec(r)||[];if(!l)return"";if(l===t)return`src: ${s};`}}):i}function wi(i){return i.search(ji)!==-1}async function Ni(i,t,r){if(!wi(i))return i;const s=Or(i,r);return $r(s).reduce((a,o)=>a.then(n=>Lr(n,o,t,r)),Promise.resolve(s))}async function et(i,t,r){var s;const l=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(i);if(l){const a=await Ni(l,null,r);return t.style.setProperty(i,a,t.style.getPropertyPriority(i)),!0}return!1}async function Hr(i,t){await et("background",i,t)||await et("background-image",i,t),await et("mask",i,t)||await et("-webkit-mask",i,t)||await et("mask-image",i,t)||await et("-webkit-mask-image",i,t)}async function Mr(i,t){const r=Ee(i,HTMLImageElement);if(!(r&&!Ut(i.src))&&!(Ee(i,SVGImageElement)&&!Ut(i.href.baseVal)))return;const s=r?i.src:i.href.baseVal,l=await Ot(s,Lt(s),t);await new Promise((a,o)=>{i.onload=a,i.onerror=t.onImageErrorHandler?(...c)=>{try{a(t.onImageErrorHandler(...c))}catch(d){o(d)}}:o;const n=i;n.decode&&(n.decode=a),n.loading==="lazy"&&(n.loading="eager"),r?(i.srcset="",i.src=l):i.href.baseVal=l})}async function Fr(i,t){const s=We(i.childNodes).map(l=>ki(l,t));await Promise.all(s).then(()=>i)}async function ki(i,t){Ee(i,Element)&&(await Hr(i,t),await Mr(i,t),await Fr(i,t))}function Br(i,t){const{style:r}=i;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const s=t.style;
52return s!=null&&Object.keys(s).forEach(l=>{r[l]=s[l]}),i}const Dt={};async function Xt(i){let t=Dt[i];if(t!=null)return t;const s=await(await fetch(i)).text();return t={url:i,cssText:s},Dt[i]=t,t}async function Yt(i,t){let r=i.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,a=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let n=o.replace(s,"$1");return n.startsWith("https://")||(n=new URL(n,i.url).href),fi(n,t.fetchRequestInit,({result:c})=>(r=r.replace(o,`url(${c})`),[o,c]))});return Promise.all(a).then(()=>r)}function Jt(i){if(i==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let s=i.replace(r,"");const l=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const c=l.exec(s);if(c===null)break;t.push(c[0])}s=s.replace(l,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",n=new RegExp(o,"gi");for(;;){let c=a.exec(s);if(c===null){if(c=n.exec(s),c===null)break;a.lastIndex=n.lastIndex}else n.lastIndex=a.lastIndex;t.push(c[0])}return t}async function Wr(i,t){const r=[],s=[];return i.forEach(l=>{if("cssRules"in l)try{We(l.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let n=o+1;const c=a.href,d=Xt(c).then(p=>Yt(p,t)).then(p=>Jt(p).forEach(I=>{try{l.insertRule(I,I.startsWith("@import")?n+=1:l.cssRules.length)}catch(N){console.error("Error inserting rule from remote css",{rule:I,error:N})}})).catch(p=>{console.error("Error loading remote css",p.toString())});s.push(d)}})}catch(a){const o=i.find(n=>n.href==null)||document.styleSheets[0];l.href!=null&&s.push(Xt(l.href).then(n=>Yt(n,t)).then(n=>Jt(n).forEach(c=>{o.insertRule(c,o.cssRules.length)})).catch(n=>{console.error("Error loading remote stylesheet",n)})),console.error("Error inlining remote css file",a)}}),Promise.all(s).then(()=>(i.forEach(l=>{if("cssRules"in l)try{We(l.cssRules||[]).forEach(a=>{r.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${l.href}`,a)}}),r))}function Gr(i){return i.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>wi(t.style.getPropertyValue("src")))}async function qr(i,t){if(i.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=We(i.ownerDocument.styleSheets),s=await Wr(r,t);return Gr(s)}function Ii(i){return i.trim().replace(/["']/g,"")}function Vr(i){const t=new Set;function r(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(a=>{t.add(Ii(a))}),Array.from(s.children).forEach(a=>{a instanceof HTMLElement&&r(a)})}return r(i),t}async function Dr(i,t){const r=await qr(i,t),s=Vr(i);return(await Promise.all(r.filter(a=>s.has(Ii(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return Ni(a.cssText,o,t)}))).join(` 53`)}async function Xr(i,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Dr(i,t);if(r){const s=document.createElement("style"),l=document.createTextNode(r);s.appendChild(l),i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s)}}async function Yr(i,t={}){const{width:r,height:s}=yi(i,t),l=await bt(i,t,!0);return await Xr(l,t),await ki(l,t),Br(l,t),await ur(l,r,s)}async function Jr(i,t={}){const{width:r,height:s}=yi(i,t),l=await Yr(i,t),a=await xt(l),o=document.createElement("canvas"),n=o.getContext("2d"),c=t.pixelRatio||dr(),d=t.canvasWidth||r,p=t.canvasHeight||s;return o.width=d*c,o.height=p*c,t.skipAutoScale||pr(o),o.style.width=`${d}`,o.style.height=`${p}`,t.backgroundColor&&(n.fillStyle=t.backgroundColor,n.fillRect(0,0,o.width,o.height)),n.drawImage(a,0,0,o.width,o.height),o}async function Ct(i,t={}){return(await Jr(i,t)).toDataURL()}const ze={white:{id:"white",name:"ç®æ´ç½",bg:"#ffffff",surface:"#f9fafb",text:"#0f172a",textSecondary:"#475569",accent:"#0ea5e9",accentText:"#ffffff",border:"#e2e8f0",muted:"#94a3b8"},black:{id:"black",name:"é«ç«¯é»",bg:"#0b0b10",surface:"#15151c",text:"#f5f5f5",textSecondary:"#a1a1aa",accent:"#fafafa",accentText:"#0b0b10",border:"#27272a",muted:"#52525b"},gold:{id:"gold",name:"奢åé",bg:"#0e0e10",surface:"#1a1814",text:"#fde68a",textSecondary:"#e5d27a",accent:"#fbbf24",accentText:"#1a1814",border:"#3f3f46",muted:"#78716c"},pink:{id:"pink",name:"æ´»åç²",bg:"#fff1f2",surface:"#ffffff",text:"#831843",textSecondary:"#9d174d",accent:"#ec4899",accentText:"#ffffff",border:"#fbcfe8",muted:"#f9a8d4"},navy:{id:"navy",name:"åå¡è",bg:"#eff6ff",surface:"#ffffff",text:"#1e3a8a",textSecondary:"#1e40af",accent:"#3b82f6",accentText:"#ffffff",border:"#bfdbfe",muted:"#93c5fd"},green:{id:"green",name:"èªç¶ç»¿",bg:"#ecfdf5",surface:"#ffffff",text:"#064e3b",textSecondary:"#047857",accent:"#10b981",accentText:"#ffffff",border:"#a7f3d0",muted:"#6ee7b7"},beige:{id:"beige",name:"æè°ç±³",bg:"#fef7e0",surface:"#ffffff",text:"#78350f",textSecondary:"#92400e",accent:"#d97706",accentText:"#ffffff",border:"#fde68a",muted:"#fcd34d"},gray:{id:"gray",name:"æç®ç°",bg:"#f3f4f6",surface:"#ffffff",text:"#111827",textSecondary:"#4b5563",accent:"#6b7280",accentText:"#ffffff",border:"#d1d5db",muted:"#9ca3af"}},Zr=["white","black","gold","pink","navy","green","beige","gray"],He={sm:{kicker:10,title:20,subtitle:14,body:12,small:10},md:{kicker:12,title:28,subtitle:16,body:14,small:11},lg:{kicker:14,title:36,subtitle:20,body:16,small:12}},ht=[{id:"hero-overlay",name:"大å¾å å",desc:"é¦å±è¥é Bannerï¼å¤§å¾ + å¯èªç±å®ä½çæ 颿®µè½"}
53,{id:"grid-labeled",name:"åå®«æ ¼æ æ³¨",desc:"4 å¼ ç»èå¾ï¼æ¯æ ¼é 䏻坿 é¢"},{id:"feature-row",name:"åè½ç¹æ§è¡",desc:"3-5 ä¸ªå¾æ + æåï¼æ¨ªåå±ç¤ºäº§ååç¹"},{id:"numbered-list",name:"æ°åå表",desc:"1 å¾ + å³ä¾§ 1/2/3 æ°åæ¡ç®"},{id:"before-after",name:"åå对æ¯",desc:'å·¦å³ä¸¤å¼ å¾ + éç®"æ®é vs æä»¬ç"æ ç¾'},{id:"scene-matrix",name:"åºæ¯ç©éµ",desc:"3-4 ä¸ªåºæ¯å¾ + åºæ¯åï¼éå¤/约ä¼/è¿å¨ï¼"},{id:"detail-callout",name:"ç»èç®å¤´",desc:"ååå¾ä¸ç¨åç¹ + æåæ æ³¨åé¨ä½å·¥èº"},{id:"color-badge",name:"è²å·æ ç¾",desc:"ååå¾ + å·¦ä¸è§ä¸è±æè²å·è¶å"},{id:"bold-quote",name:"åçæ è¯",desc:"纯æå大念·æ¥ï¼åçæåº¦å®£è¨ï¼"},{id:"spec-list",name:"è§æ ¼åæ°",desc:"åæ°è¡¨æ ·å¼ï¼åç§° + å¼ï¼å¤è¡ï¼"},{id:"testimonial",name:"客æ·å¥½è¯",desc:"头å + å§å + æçº§ + è¯è¯å¡ç"},{id:"timeline-steps",name:"å·¥èºæ¶é´çº¿",desc:"3-4 æ¥å·¥èºæµç¨ step1 â step4"},{id:"vs-table",name:"对æ¯è¡¨æ ¼",desc:"ãæä»¬ vs æ®éãåè½å¯¹æ¯äºé䏿å¾"}];function Qr(i){switch(i){case"hero-overlay":return{heroUrl:"",title:`è磨æ°ç§æ 54æ æ§å®ç£¨`,description:`é«å¯åº¦çººç»ææ¯ï¼æ¯æ®é颿æ´è磨ãèæè£ 55æ·å¤ç¬å±±ãéå¤è®ç»å®è¹æ¯«æ åå`,position:"tl",kicker:"TECHNOLOGY",cornerTag:"NEW · 2026 S/S",seriesTag:"M-SPORT PRO · æ·å¤ç³»å"};case"grid-labeled":return{sectionTag:"å·¥èºç»è",title:"æ¯ä¸å¤é½è§çç« ",items:[{url:"",title:"æ¾ç´§è¢å£",subtitle:"鲿¢çé£"},{url:"",title:"åç LOGO",subtitle:"å质彰æ¾"},{url:"",title:"ç«é¢è®¾è®¡",subtitle:"ç©¿çèé"},{url:"",title:"é屿é¾",subtitle:"ç©¿è±ä¾¿æ·"}]};case"color-badge":return{imageUrl:"",cn:"å¡å ¶",en:"KHAKI"};case"numbered-list":return{heroUrl:"",title:"ä¸å¤§æ ¸å¿ä¼å¿",imageTag:"产å宿",sectionTag:"æ ¸å¿åç¹",items:[{title:"鲿°´é¢æ",description:"é¨å¤©æ·å¤ä¸æ¹¿èº«ï¼èç¨æä¹ "},{title:"åé¢å¼¹å",description:"顺åºèº«ä½æ´»å¨ï¼ä¸ç´§ç»·ä¸æç¼"},{title:"éæ°éå¹²",description:"åºæ±å³æ£ï¼ä¿æå¹²ç½èé"}]};case"feature-row":return{sectionTag:"åè½äº®ç¹",title:"å ¨æ¹ä½åè½ä¿é",items:[{emoji:"ð§",label:"鲿³¼æ°´",sublabel:"IPX4 级"},{emoji:"ð¬",label:"éæ°",sublabel:"èå·¢ç»æ"},{emoji:"ð¡",label:"æè",sublabel:"99%"},{emoji:"â¡",label:"éå¹²",sublabel:"3 åå é"}]};case"before-after":return{sectionTag:"宿坹æ¯",beforeUrl:"",beforeLabel:"æ®é颿",afterUrl:"",afterLabel:"æ¬å",title:"å¯¹æ¯æç¥éå·®è·",summary:"åæ ·å®è¹å¼ºåº¦ä¸ï¼æ®é颿åºç°ææ¾ç£¨æï¼æ¬å纹çå®å¥½å¦åã"};case"scene-matrix":return{sectionTag:"åºæ¯ç©¿æ",title:"ä¸è¡£å¤ç©¿ï¼ç¾æåºæ¯",items:[{url:"",label:"é夿¥å¸¸"},{url:"",label:"卿«åºè¡"},{url:"",label:"æ·å¤è¿å¨"}]};case"detail-callout":return{sectionTag:"å·¥èºæ 注",imageUrl:"",title:"ç»èå¤è§çç« ",callouts:[{xPct:20,yPct:25,title:"å åºçº¿è¿¹",text:"åæéè¾¹é迹ï¼ç»ä¹ èç¨"},{xPct:70,yPct:40,title:"é²é£æé¾",text:"YKK é屿é¾ï¼é¡ºæ»ä¸å¡é¡¿"},{xPct:45,yPct:75,title:"ç«ä½åªè£",text:"符å人ä½å·¥å¦ççå设计"}]};case"bold-quote":return{kicker:"FOR EXPLORERS",title:"为æ¢ç´¢èç",subtitle:"䏿¢æ¯è¡£æï¼æ´æ¯ä½ èµ°åæªç¥æ¶çè£ å¤"};case"spec-list":return{sectionTag:"产ååæ°",title:"产åè§æ ¼",rows:[{key:"åå",value:"æ·å¤å²éè¡£ M-Sport Pro"},{key:"颿",value:"300D é«å¯åº¦å°¼é¾"},{key:"å é",value:"320 g/ã¡"},{key:"鲿°´çº§å«",value:"IPX4 æ¥å¸¸é²æ³¼æ°´"},{key:"éç¨å£è",value:"æ¥ / ç§ / å¬"},{key:"æ´æ¶¤æ¹å¼",value:"æºæ´ / ææ´åå¯"}]};case"testimonial":return{avatar:"",name:"æåå¦",stars:5,quote:"ç©¿å»é²è¥è¢«é¨æ·äºæ²¡äºï¼é¢æææä¹å¾å¥½ï¼æ¬¾å¼æ¾ç¦ï¼ä¼åè´ä¸ä»¶å ¶ä»è²ã",meta:"4 æ 3 æ¥",badgeText:"çå®å¥½è¯",verifiedText:"已认è¯ä¹°å®¶"};case"timeline-steps":return{sectionTag:"å·¥èºæµç¨",title:"åéå·¥èºç²¾å¿æé ",items:[{url:"",step:"01",title:"éæ",desc:"ç²¾éæ°çé¿ç»æ£"},{url:"",step:"02",title:"æè²",desc:"ç¯ä¿æ´»æ§ææ"},{url:"",step:"03",title:"ç»é ",desc:"40S 精梳纱线"},{url:"",step:"04",title:"æè¡£",desc:"å·¥åå ¨æ£éªåº"}]};case"vs-table":return{title:"为ä»ä¹éæä»¬",sectionTag:"å¯¹æ¯æ¸ å",ourLabel:"æ¬å",theirLabel:"æ®é款",rows:[{label:"è磨æ§",our:"é«å¯åº¦ 300D",their:"ä» 150D"},{label:"鲿°´",our:"IPX4 级",their:"ä¸é²æ°´"},{label:"ææè£",our:"èå·¢ç»æ",their:"ä¸è¬éç»"},{label:"ä¿ææ§",our:"åå±å 衬",their:"åå±"},{label:"å®å",our:"30 天æ çç±",their:"7 天"}]}}}function Zt(i){return{id:`card_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,template:i,themeId:"white",align:"left",fontScale:"md",data:Qr(i)}}function _i(i,t,r){if(!i)return r;const s=t[i];return!s||!s.w||!s.h?r:Math.round(De*s.h/s.w)}const De=760;function en(i){if(!i)return null;const t=i.split("/").map(r=>parseFloat(r.trim()));
55return t.length!==2||!t[0]||!t[1]?null:Math.round(De*t[1]/t[0])}function Pe({theme:i,children:t,height:r,aspect:s}){const l=r??en(s);return e.jsx("div",{style:{width:`${De}px`,background:i.bg,color:i.text,overflow:"hidden"},children:e.jsx("div",{style:{position:"relative",width:`${De}px`,...l?{height:`${l}px`}:{}},children:t})})}function Ge({theme:i,label:t}){return e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:i.surface,color:i.muted,fontSize:"13px"},children:t??Ai.t("captionRenderer.noImageSelected")})}function Xe({theme:i,fs:t,align:r,title:s,kicker:l,mb:a}){if(!s&&!l)return null;const o=r==="center"?"center":r==="right"?"flex-end":"flex-start";return e.jsxs("div",{style:{marginBottom:`${a??24}px`,textAlign:r,display:"flex",flexDirection:"column",alignItems:o},children:[l&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 12px",background:`${i.accent}1A`,color:i.accent,borderRadius:"999px",fontSize:`${t.small}px`,fontWeight:700,marginBottom:s?"12px":"0",letterSpacing:"0.05em",lineHeight:1},children:[e.jsx("span",{style:{width:"4px",height:"4px",borderRadius:"999px",background:i.accent,display:"inline-block",flexShrink:0}}),l]}),s&&e.jsx("div",{style:{fontSize:`${t.title}px`,fontWeight:800,color:i.text,lineHeight:1.25,letterSpacing:"-0.005em"},children:s})]})}function tn(i,t,r,s){const l=i.data,a="40px",o={tl:{top:a,left:a,textAlign:"left"},tr:{top:a,right:a,textAlign:"right"},bl:{bottom:a,left:a,textAlign:"left"},br:{bottom:a,right:a,textAlign:"right"},c:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"}},n=_i(l.heroUrl,s,Math.round(De*3/4)),c=l.position==="tl"||l.position==="bl",d=l.position==="tr"||l.position==="br";return e.jsxs(Pe,{theme:t,height:n,children:[l.heroUrl?e.jsx(pe,{url:l.heroUrl,alt:"",crossOrigin:xe(l.heroUrl),style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ge,{theme:t}),e.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 45%, rgba(0,0,0,0) 100%)"}}),l.cornerTag&&(c||l.position==="c")&&e.jsx("div",{style:{position:"absolute",top:"20px",right:"20px",padding:"7px 10px",background:"rgba(0,0,0,0.65)",borderRadius:"6px",color:"#ffffff",fontSize:`${r.small}px`,fontWeight:600,letterSpacing:"0.12em",lineHeight:1},children:l.cornerTag}),e.jsxs("div",{style:{position:"absolute",maxWidth:"72%",color:"#ffffff",textAlign:i.align,...o[l.position]},children:[l.kicker&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px 8px 10px",background:t.accent,color:t.accentText,borderRadius:"999px",marginBottom:"18px",fontSize:`${r.kicker}px`,fontWeight:700,letterSpacing:"0.15em",textTransform:"uppercase",lineHeight:1},children:[e.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"999px",background:t.accentText,opacity:.75,display:"inline-block",flexShrink:0}}),l.kicker]}),e.jsx("div",{style:{fontSize:`${r.title+2}px`,fontWeight:800,lineHeight:1.18,whiteSpace:"pre-line",textShadow:"0 2px 12px rgba(0,0,0,0.55)"},children:l.title}),l.description&&e.jsx("div",{style:{marginTop:"18px",fontSize:`${r.body}px`,lineHeight:1.7,whiteSpace:"pre-line",maxWidth:"520px",textShadow:"0 1px 4px rgba(0,0,0,0.4)",opacity:.94,textAlign:i.align},children:l.description})]}),l.seriesTag&&(l.position==="tl"||l.position==="tr")&&e.jsxs("div",{style:{position:"absolute",bottom:"20px",left:d?"auto":"20px",right:d?"20px":"auto",display:"inline-flex",alignItems:"center",gap:"10px",padding:"9px 14px",background:"rgba(17,17,17,0.82)",borderRadius:"999px",color:"#ffffff",fontSize:`${r.small}px`,fontWeight:600,letterSpacing:"0.08em",lineHeight:1},children:[e.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"999px",background:t.accent,display:"inline-block",flexShrink:0}}),l.seriesTag]})]})}function sn(i,t,r){const s=i.data;return e.jsx(Pe,{theme:t,height:720,children:e.jsxs("div",{style:{padding:"26px 28px",height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[e.jsx(Xe,{theme:t,fs:r,align:i.align,kicker:s.sectionTag,title:s.title,mb:14}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px",flex:1},children:s.items.slice(0,4).map((l,a)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",background:t.surface,borderRadius:"14px",overflow:"hidden"},children:[e.jsxs("div",{style:{position:"relative",flex:"1 1 auto",background:t.surface,overflow:"hidden"},children:[l.url?e.jsx(pe,{url:l.url,alt:"",crossOrigin:xe(l.url),style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ge,{theme:t}),e.jsxs("div",{style:{position:"absolute",top:"12px",left:"12px",fontSize:`${r.small}px`,fontWeight:700,color:t.accentText,background:t.accent,padding:"5px 10px",borderRadius:"999px",letterSpacing:"0.1em",lineHeight:1},children:["0",a+1]})]}),e.jsxs("div",{style:{padding:"10px 14px 12px"},children:[e.jsx("div",{style:{fontSize:`${r.subtitle-1}px`,fontWeight:700,color:t.text,marginBottom:"2px"},children:l.title}),e.jsx("div",{style:{fontSize:`${r.small}px`,color:t.textSecondary}
55,children:l.subtitle})]})]},a))})]})})}function rn(i,t,r,s){const l=i.data,a=_i(l.imageUrl,s,De);return e.jsxs(Pe,{theme:t,height:a,children:[l.imageUrl?e.jsx(pe,{url:l.imageUrl,alt:"",crossOrigin:xe(l.imageUrl),style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ge,{theme:t}),e.jsxs("div",{style:{position:"absolute",top:"24px",left:"24px",display:"inline-flex",alignItems:"center",gap:"12px",background:"rgba(17,17,17,0.88)",padding:"10px 16px 10px 14px",borderRadius:"999px"},children:[e.jsx("span",{style:{width:"14px",height:"14px",borderRadius:"999px",background:t.accent,flexShrink:0}}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"8px"},children:[e.jsx("span",{style:{fontSize:`${r.subtitle}px`,fontWeight:800,color:"#ffffff"},children:l.cn}),l.en&&e.jsx("span",{style:{fontSize:`${r.small+1}px`,fontWeight:500,color:"rgba(255,255,255,0.6)",letterSpacing:"0.14em"},children:l.en})]})]})]})}function nn(i,t,r){const s=i.data,l=i.align==="center"?"center":i.align==="right"?"flex-end":"flex-start";return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",minHeight:"560px"},children:[e.jsxs("div",{style:{background:t.surface,position:"relative"},children:[s.heroUrl?e.jsx(pe,{url:s.heroUrl,alt:"",crossOrigin:xe(s.heroUrl),style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ge,{theme:t}),s.imageTag&&e.jsxs("div",{style:{position:"absolute",bottom:"16px",left:"16px",display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 12px",background:"#ffffff",borderRadius:"999px",fontSize:`${r.small}px`,fontWeight:700,color:t.text,letterSpacing:"0.05em",lineHeight:1},children:[e.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"999px",background:t.accent,display:"inline-block",flexShrink:0}}),s.imageTag]})]}),e.jsxs("div",{style:{padding:"30px 28px",background:t.bg,display:"flex",flexDirection:"column",justifyContent:"center",textAlign:i.align},children:[s.sectionTag&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 12px",background:`${t.accent}1A`,color:t.accent,borderRadius:"999px",fontSize:`${r.small}px`,fontWeight:700,marginBottom:"14px",alignSelf:l,letterSpacing:"0.05em",lineHeight:1},children:[e.jsx("span",{style:{width:"4px",height:"4px",borderRadius:"999px",background:t.accent,display:"inline-block",flexShrink:0}}),s.sectionTag]}),e.jsx("div",{style:{fontSize:`${r.title}px`,fontWeight:800,color:t.text,lineHeight:1.25,marginBottom:"24px",letterSpacing:"-0.005em"},children:s.title}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:s.items.map((a,o)=>e.jsxs("div",{style:{display:"flex",gap:"14px",padding:"16px",background:t.surface,borderRadius:"12px",textAlign:"left"},children:[e.jsx("div",{style:{flexShrink:0,width:"38px",height:"38px",borderRadius:"10px",background:t.accent,color:t.accentText,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${r.body+2}px`,fontWeight:800,letterSpacing:"-0.02em",lineHeight:1},children:String(o+1).padStart(2,"0")}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:`${r.subtitle-2}px`,fontWeight:700,color:t.text,marginBottom:"3px",letterSpacing:"-0.005em"},children:a.title}),e.jsx("div",{style:{fontSize:`${r.small+1}px`,color:t.textSecondary,lineHeight:1.65},children:a.description})]})]},o))})]})]})})}function an(i,t,r){const s=i.data,l=s.items.length;return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 24px"},children:[e.jsx(Xe,{theme:t,fs:r,align:i.align,kicker:s.sectionTag,title:s.title,mb:18}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${Math.min(l,5)}, 1fr)`,gap:"10px"},children:s.items.map((a,o)=>e.jsxs("div",{style:{padding:"16px 10px",background:t.surface,borderRadius:"14px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:`${t.accent}1A`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.round(r.title*.7)}px`,lineHeight:1},children:a.emoji}),e.jsx("div",{style:{fontSize:`${r.subtitle-1}px`,fontWeight:800,color:t.text,letterSpacing:"-0.005em"},children:a.label}),e.jsx("div",{style:{fontSize:`${r.small}px`,color:t.accent,fontWeight:700,padding:"4px 8px",background:`${t.accent}14`,borderRadius:"999px",lineHeight:1},children:a.sublabel})]},o))})]})})}function ln(i,t,r){const s=i.data;return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 28px"},children:[e.jsx(Xe,{theme:t,fs:r,align:i.align,kicker:s.sectionTag,title:s.title,mb:16}),e.jsxs("div",{style:{position:"relative",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px"},children:[[{label:s.beforeLabel,url:s.beforeUrl,dim:!0},{label:s.afterLabel,url:s.afterUrl,dim:!1}].map((l,a)=>e.jsxs("div",{style:{position:"relative",aspectRatio:"1 / 1",background:t.surface,borderRadius:"14px",overflow:"hidden"},children:[l.url?e.jsx(pe,{url:l.url,alt:"",crossOrigin:xe(l.url),style:{width:"100%",height:"100%",objectFit:"cover",filter:l.dim?"grayscale(70%) brightness(0.9)":"none"}}):e.jsx(Ge,{theme:t}),e.jsx("div",{style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",padding:"9px 12px",background:l.dim?"rgba(17,17,17,0.78)":t.accent,color:l.dim?"#ffffff"
55:t.accentText,fontSize:`${r.small+1}px`,fontWeight:700,letterSpacing:"0.08em",textAlign:"center",borderRadius:"999px",lineHeight:1},children:l.label})]},a)),e.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"52px",height:"52px",borderRadius:"999px",background:t.accent,color:t.accentText,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${r.body+2}px`,fontWeight:900,letterSpacing:"-0.02em",zIndex:2,boxShadow:"0 6px 20px rgba(0,0,0,0.2)",lineHeight:1},children:"VS"})]}),s.summary&&e.jsx("div",{style:{marginTop:"18px",padding:"16px 20px",background:t.surface,borderRadius:"12px",fontSize:`${r.body}px`,color:t.textSecondary,textAlign:i.align,lineHeight:1.75},children:s.summary})]})})}function on(i,t,r){const s=i.data,l=s.items.length,a=l<=2?l:l===3?3:2;return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 24px"},children:[e.jsx(Xe,{theme:t,fs:r,align:i.align,kicker:s.sectionTag,title:s.title,mb:16}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${a}, 1fr)`,gap:"14px"},children:s.items.map((o,n)=>e.jsxs("div",{style:{position:"relative",aspectRatio:"3 / 4",background:t.surface,borderRadius:"14px",overflow:"hidden"},children:[o.url?e.jsx(pe,{url:o.url,alt:"",crossOrigin:xe(o.url),style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ge,{theme:t}),e.jsx("div",{style:{position:"absolute",top:"12px",left:"12px",width:"28px",height:"28px",borderRadius:"999px",background:t.accent,color:t.accentText,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${r.small}px`,fontWeight:800,lineHeight:1},children:n+1}),e.jsx("div",{style:{position:"absolute",left:"12px",right:"12px",bottom:"12px",padding:"10px 14px",background:"rgba(17,17,17,0.85)",borderRadius:"10px",color:"#ffffff",lineHeight:1},children:e.jsx("div",{style:{fontSize:`${r.subtitle-2}px`,fontWeight:700},children:o.label})})]},n))})]})})}function cn(i,t,r,s){const l=i.data,a=De-64,o=l.imageUrl?s[l.imageUrl]:null,n=o&&o.w&&o.h?Math.round(a*o.h/o.w):Math.round(a*3/4);return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 24px"},children:[e.jsx(Xe,{theme:t,fs:r,align:i.align,kicker:l.sectionTag,title:l.title,mb:16}),e.jsxs("div",{style:{position:"relative",width:`${a}px`,height:`${n}px`,background:t.surface,borderRadius:"14px",overflow:"hidden"},children:[l.imageUrl?e.jsx(pe,{url:l.imageUrl,alt:"",crossOrigin:xe(l.imageUrl),style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ge,{theme:t}),l.callouts.map((c,d)=>{const p=Math.max(0,Math.min(95,c.xPct)),I=p>50,N=r.small+14;return e.jsxs("div",{style:{position:"absolute",top:`${Math.max(0,Math.min(95,c.yPct))}%`,left:`${p}%`,transform:"translate(-50%, -50%)"},children:[e.jsx("div",{style:{width:`${N}px`,height:`${N}px`,borderRadius:"999px",background:t.accent,color:t.accentText,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${r.small}px`,fontWeight:800,boxShadow:"0 3px 10px rgba(0,0,0,0.25)",lineHeight:1},children:d+1}),e.jsxs("div",{style:{position:"absolute",top:"-6px",[I?"right":"left"]:`${N+10}px`,minWidth:"200px",maxWidth:"220px",padding:"12px 16px",background:"#ffffff",borderRadius:"10px",boxShadow:"0 10px 28px rgba(0,0,0,0.18)"},children:[e.jsx("div",{style:{fontSize:`${r.small+1}px`,fontWeight:800,color:t.text,marginBottom:"4px"},children:c.title}),e.jsx("div",{style:{fontSize:`${r.small}px`,color:t.textSecondary,lineHeight:1.6},children:c.text})]})]},d)})]})]})})}function dn(i,t,r){const s=i.data,l=i.align==="left"?"flex-start":i.align==="right"?"flex-end":"center";return e.jsx(Pe,{theme:t,height:480,children:e.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",alignItems:l,justifyContent:"center",padding:"36px 44px",textAlign:i.align},children:[s.kicker&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px",background:`${t.accent}1A`,color:t.accent,borderRadius:"999px",marginBottom:"20px",fontSize:`${r.kicker+1}px`,fontWeight:700,letterSpacing:"0.18em",lineHeight:1}
55,children:[e.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"999px",background:t.accent,display:"inline-block",flexShrink:0}}),s.kicker]}),e.jsx("div",{style:{fontSize:`${r.title+16}px`,fontWeight:800,color:t.text,lineHeight:1.15,whiteSpace:"pre-line",maxWidth:"640px"},children:s.title}),s.subtitle&&e.jsx("div",{style:{marginTop:"22px",fontSize:`${r.body+1}px`,color:t.textSecondary,maxWidth:"540px",lineHeight:1.75},children:s.subtitle})]})})}function pn(i,t,r){const s=i.data;return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 28px"},children:[e.jsx(Xe,{theme:t,fs:r,align:i.align,kicker:s.sectionTag,title:s.title,mb:14}),e.jsx("div",{style:{borderRadius:"14px",overflow:"hidden"},children:s.rows.map((l,a)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"14px 20px",gap:"16px",background:a%2===0?t.surface:"transparent"},children:[e.jsx("div",{style:{fontSize:`${r.body}px`,color:t.textSecondary,fontWeight:500,flexShrink:0,minWidth:"120px"},children:l.key}),e.jsx("div",{style:{flex:1,fontSize:`${r.body}px`,color:t.text,fontWeight:700,textAlign:"right"},children:l.value})]},a))})]})})}function mn(i,t,r){const s=i.data,l=Math.max(0,Math.min(5,s.stars));return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 28px",background:t.bg},children:[e.jsxs("div",{style:{display:"flex",justifyContent:s.badgeText?"space-between":"flex-end",alignItems:"center",marginBottom:"22px",flexWrap:"wrap",gap:"12px"},children:[s.badgeText&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 12px",background:`${t.accent}1A`,color:t.accent,borderRadius:"999px",fontSize:`${r.small}px`,fontWeight:700,letterSpacing:"0.05em",lineHeight:1},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),s.badgeText]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx("span",{style:{color:"#fbbf24",fontSize:`${r.body+2}px`,letterSpacing:"2px"},children:"â
".repeat(l)}
55),e.jsx("span",{style:{color:t.border,fontSize:`${r.body+2}px`,letterSpacing:"2px"},children:"â
".repeat(5-l)}),e.jsxs("span",{style:{marginLeft:"10px",fontSize:`${r.body+1}px`,fontWeight:800,color:t.text},children:[l,".0"]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"14px",alignItems:"center",marginBottom:"18px"},children:[e.jsx("div",{style:{flexShrink:0,width:"48px",height:"48px",borderRadius:"999px",background:t.surface,overflow:"hidden"},children:s.avatar?e.jsx(pe,{url:s.avatar,alt:"",crossOrigin:xe(s.avatar),style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",fontWeight:700,color:t.textSecondary},children:s.name.slice(0,1)||"?"})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginBottom:"3px"},children:[e.jsx("span",{style:{fontSize:`${r.subtitle-2}px`,fontWeight:700,color:t.text,letterSpacing:"-0.005em"},children:s.name}),s.verifiedText&&e.jsx("span",{style:{fontSize:`${r.small-1}px`,padding:"3px 7px",background:t.surface,color:t.textSecondary,borderRadius:"4px",fontWeight:600,letterSpacing:"0.02em",lineHeight:1,display:"inline-block"},children:s.verifiedText})]}),s.meta&&e.jsx("div",{style:{fontSize:`${r.small}px`,color:t.muted,letterSpacing:"0.02em"},children:s.meta})]})]}),e.jsx("div",{style:{padding:"22px 24px",background:t.surface,borderRadius:"14px",fontSize:`${r.body+1}px`,color:t.text,lineHeight:1.8,letterSpacing:"0.005em"},children:s.quote})]})})}function un(i,t,r){const s=i.data,l=s.items.length,a=104;return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 24px"},children:[e.jsx(Xe,{theme:t,fs:r,align:i.align,kicker:s.sectionTag,title:s.title,mb:20}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${l}, 1fr)`,gap:"14px"},children:s.items.map((o,n)=>e.jsxs("div",{style:{padding:"20px 14px",background:t.surface,borderRadius:"16px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{style:{width:`${a}px`,height:`${a}px`,borderRadius:"999px",background:t.bg,overflow:"hidden"},children:o.url?e.jsx(pe,{url:o.url,alt:"",crossOrigin:xe(o.url),style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ge,{theme:t})}),e.jsx("div",{style:{position:"absolute",top:"-6px",right:"-6px",minWidth:"30px",height:"30px",padding:"0 10px",borderRadius:"999px",background:t.accent,color:t.accentText,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${r.small}px`,fontWeight:800,boxShadow:"0 3px 8px rgba(0,0,0,0.18)",lineHeight:1},children:o.step})]}),e.jsx("div",{style:{fontSize:`${r.subtitle-1}px`,fontWeight:700,color:t.text},children:o.title}),e.jsx("div",{style:{fontSize:`${r.small}px`,color:t.textSecondary,lineHeight:1.6},children:o.desc})]},n))})]})})}function xn(i,t,r){const s=i.data,l=a=>a.replace(/^[ââÃâ]\s*/,"").trim();return e.jsx(Pe,{theme:t,children:e.jsxs("div",{style:{padding:"26px 28px"},children:[e.jsxs("div",{style:{textAlign:i.align,marginBottom:"26px"},children:[s.sectionTag&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 12px",background:`${t.accent}1A`,color:t.accent,borderRadius:"999px",fontSize:`${r.small}px`,fontWeight:700,marginBottom:"10px",letterSpacing:"0.05em",lineHeight:1},children:[e.jsx("span",{style:{width:"4px",height:"4px",borderRadius:"999px",background:t.accent,display:"inline-block",flexShrink:0}}),s.sectionTag]}),e.jsx("div",{style:{fontSize:`${r.title}px`,fontWeight:800,color:t.text,lineHeight:1.25,letterSpacing:"-0.005em"},children:s.title})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",marginBottom:"10px"},children:[e.jsxs("div",{style:{padding:"14px 16px",background:t.accent,color:t.accentText,borderRadius:"12px 12px 0 0",fontSize:`${r.body}px`,fontWeight:800,textAlign:"center",letterSpacing:"0.01em",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",lineHeight:1},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),s.ourLabel]}),e.jsx("div",{style:{padding:"14px 16px",background:t.surface,color:t.textSecondary,borderRadius:"12px 12px 0 0",fontSize:`${r.body}px`,fontWeight:600,textAlign:"center",letterSpacing:"0.01em",lineHeight:1},children:s.theirLabel})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:s.rows.map((a,o)=>e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:`${r.small}px`,color:t.muted,fontWeight:700,letterSpacing:"0.08em",marginBottom:"6px",paddingLeft:"2px"},children:["· ",a.label]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{style:{padding:"14px 16px",background:`${t.accent}1A`,borderRadius:"10px",fontSize:`${r.body}px`,color:t.text,fontWeight:700,display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("div",{style:{flexShrink:0,width:"20px",height:"20px",borderRadius:"999px",background:t.accent,color:t.accentText,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsx("span",{style:{flex:1,minWidth:0},children:l(a.our)}
55)]}),e.jsxs("div",{style:{padding:"14px 16px",background:t.surface,borderRadius:"10px",fontSize:`${r.body}px`,color:t.textSecondary,fontWeight:500,display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("div",{style:{flexShrink:0,width:"20px",height:"20px",borderRadius:"999px",background:t.bg,display:"flex",alignItems:"center",justifyContent:"center",color:t.muted},children:e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("span",{style:{flex:1,minWidth:0},children:l(a.their)})]})]})]},o))})]})})}function rt(i,t,r,s={}){switch(i.template){case"hero-overlay":return tn(i,t,r,s);case"grid-labeled":return sn(i,t,r);case"color-badge":return rn(i,t,r,s);case"numbered-list":return nn(i,t,r);case"feature-row":return an(i,t,r);case"before-after":return ln(i,t,r);case"scene-matrix":return on(i,t,r);case"detail-callout":return cn(i,t,r,s);case"bold-quote":return dn(i,t,r);case"spec-list":return pn(i,t,r);case"testimonial":return mn(i,t,r);case"timeline-steps":return un(i,t,r);case"vs-table":return xn(i,t,r)}}function se({label:i,children:t}){return e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-[var(--text-secondary)] mb-1.5",children:i}),t]})}function J(i){return e.jsx("input",{...i,className:"w-full text-xs px-2 py-1.5 rounded border border-ui-border bg-[var(--bg-primary)] text-[var(--text-primary)] focus:outline-none focus:border-ui-accent"})}function tt(i){return e.jsx("textarea",{...i,className:"w-full text-xs px-2 py-1.5 rounded border border-ui-border bg-[var(--bg-primary)] text-[var(--text-primary)] focus:outline-none focus:border-ui-accent resize-none"})}function Me({value:i,onChange:t,label:r,images:s}){const{t:l}=re();return e.jsxs("div",{children:[r&&e.jsx("label",{className:"block text-[11px] font-medium text-[var(--text-secondary)] mb-1.5",children:r}),s.length===0?e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)] p-2 rounded border border-dashed border-ui-border",children:l("captionEditor.completeUpstreamForImages")}):e.jsxs("div",{className:"flex gap-1.5 overflow-x-auto pb-1",children:[s.map((a,o)=>e.jsx("button",{onClick:()=>t(a.url),className:`w-12 h-12 rounded overflow-hidden shrink-0 border-2 cursor-pointer transition-all ${i===a.url?"border-ui-accent ring-1 ring-ui-accent/30":"border-transparent hover:border-ui-border"}`,children:e.jsx("img",{src:a.url,alt:"",crossOrigin:xe(a.url),className:"w-full h-full object-cover"})},o)),i&&e.jsx("button",{onClick:()=>t(""),title:l("captionEditor.clear"),className:"w-12 h-12 rounded border border-dashed border-ui-border text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer shrink-0 flex items-center justify-center",children:"â"})]})]})}function hn({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data,a=[{id:"tl",label:s("captionEditor.posTopLeft")},{id:"tr",label:s("captionEditor.posTopRight")},{id:"bl",label:s("captionEditor.posBottomLeft")},{id:"br",label:s("captionEditor.posBottomRight")},{id:"c",label:s("captionEditor.posCenter")}];return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Me,{label:s("captionEditor.mainImage"),value:l.heroUrl,onChange:o=>t({heroUrl:o}),images:r}),e.jsx(se,{label:s("captionEditor.kickerUppercase"),children:e.jsx(J,{value:l.kicker,onChange:o=>t({kicker:o.target.value}),placeholder:"TECHNOLOGY"})}),e.jsx(se,{label:s("captionEditor.titleMultiline"),children:e.jsx(tt,{value:l.title,onChange:o=>t({title:o.target.value}),rows:2})}),e.jsx(se,{label:s("captionEditor.descriptionMultiline"),children:e.jsx(tt,{value:l.description,onChange:o=>t({description:o.target.value}),rows:3})}),e.jsx(se,{label:s("captionEditor.textPosition"),children:e.jsx("div",{className:"flex flex-wrap gap-1",children:a.map(o=>e.jsx("button",{onClick:()=>t({position:o.id}),className:`px-2.5 py-1 rounded text-[11px] cursor-pointer ${l.position===o.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)]"}`,children:o.label},o.id))})}),e.jsx(se,{label:s("captionEditor.cornerTag"),children:e.jsx(J,{value:l.cornerTag||"",onChange:o=>t({cornerTag:o.target.value}),placeholder:"NEW · 2026 S/S"})}),e.jsx(se,{label:s("captionEditor.seriesTag"),children:e.jsx(J,{value:l.seriesTag||"",onChange:o=>t({seriesTag:o.target.value}),placeholder:s("captionEditor.phSeriesTag")})})]})}function gn({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data,a=(o,n,c)=>{t({items:l.items.map((d,p)=>p===o?{...d,[n]:c}:d)})};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.sectionTag"),children:e.jsx(J,{value:l.sectionTag||"",onChange:o=>t({sectionTag:o.target.value}),placeholder:s("captionEditor.phCraftDetail")})}),e.jsx(se,{label:s("captionEditor.topTitle"),children:e.jsx(J,{value:l.title||"",onChange:o=>t({title:o.target.value}),placeholder:s("captionEditor.phEveryDetailShows")})})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:l.items.slice(0,4).map((o,n)=>e.jsxs("div",{className:"rounded bg-[var(--bg-secondary)] p-2 space-y-1.5",children:[e.jsxs("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:[s("captionEditor.cell")," ",n+1]}),e.jsx(Me,{value:o.url,onChange:c=>a(n,"url",c),images:r}),e.jsx(J,{value:o.title,placeholder:s("captionEditor.phGridTitle"),onChange:c=>a(n,"title",c.target.value)}),e.jsx(J,{value:o.subtitle,placeholder:s("captionEditor.phGridSubtitle"),onChange:c=>a(n,"subtitle",c.target.value)})]},n))})]})}function bn({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data;return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Me,{label:s("captionEditor.productImage"),value:l.imageUrl,onChange:a=>t({imageUrl:a}),images:r}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.colorCn"),children:e.jsx(J,{value:l.cn,onChange:a=>t({cn:a.target.value}),placeholder:s("captionEditor.phColorCn")})}),e.jsx(se,{label:s("captionEditor.colorEn"),children:e.jsx(J,{value:l.en,onChange:a=>t({en:a.target.value}),placeholder:"KHAKI"})})]})]})}function yn({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data,a=(c,d,p)=>{t({items:l.items.map((I,N)=>N===c?{...I,[d]:p}:I)})},o=()=>t({items:[...l.items,{title:s("captionEditor.newItem","New item"),description:""}].slice(0,6)}),n=c=>t({items:l.items.filter((d,p)=>p!==c)});return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Me,{label:s("captionEditor.leftImage"),value:l.heroUrl,onChange:c=>t({heroUrl:c}),images:r}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.imageBottomLeftPill"),children:e.jsx(J,{value:l.imageTag||"",onChange:c=>t({imageTag:c.target.value}),placeholder:s("captionEditor.phRealShot")})}),e.jsx(se,{label:s("captionEditor.rightTopTag"),children:e.jsx(J,{value:l.sectionTag||"",onChange:c=>t({sectionTag:c.target.value}),placeholder:s("captionEditor.phKeySellingPoints")})})]}),e.jsx(se,{label:s("captionEditor.overallTitle"),children:e.jsx(J,{value:l.title,onChange:c=>t({title:c.target.value})})}),e.jsxs("div",{className:"space-y-2",children:[l.items.map((c,d)=>e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-ui-accent text-white text-[11px] flex items-center justify-center shrink-0 mt-1",children:d+1}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(J,{value:c.title,onChange:p=>a(d,"title",p.target.value),placeholder:s("captionEditor.phItemTitle")}),e.jsx(J,{value:c.description,onChange:p=>a(d,"description",p.target.value),placeholder:s("captionEditor.phItemDescription")})]}),e.jsx("button",{onClick:()=>n(d),className:"p-1 text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer mt-1",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},d)),l.items.length<6&&e.jsxs("button",{onClick:o,className:"text-[11px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",s("captionEditor.addItem")]})]})]})}function fn({card:i,onChange:t}){const{t:r}=re(),s=i.data,l=(n,c,d)=>{t({items:s.items.map((p,I)=>I===n?{...p,[c]:d}:p)})},a=()=>t({items:[...s.items,{emoji:"â¨",label:r("captionEditor.newFeature","New feature"),sublabel:""}].slice(0,5)}),o=n=>t({items:s.items.filter((c,d)=>d!==n)});return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:r("captionEditor.sectionTag"),children:e.jsx(J,{value:s.sectionTag||"",onChange:n=>
55t({sectionTag:n.target.value}),placeholder:r("captionEditor.phFeatureHighlights")})}),e.jsx(se,{label:r("captionEditor.overallTitle"),children:e.jsx(J,{value:s.title,onChange:n=>t({title:n.target.value})})})]}),e.jsxs("div",{className:"space-y-2",children:[s.items.map((n,c)=>e.jsxs("div",{className:"grid grid-cols-[auto_80px_1fr_1fr_auto] gap-2 items-center",children:[e.jsx("span",{className:"text-[10px] text-[var(--text-tertiary)] w-5 text-center",children:c+1}),e.jsx(J,{value:n.emoji,onChange:d=>l(c,"emoji",d.target.value),placeholder:"ð§"}),e.jsx(J,{value:n.label,onChange:d=>l(c,"label",d.target.value),placeholder:r("captionEditor.phWaterproof")}),e.jsx(J,{value:n.sublabel,onChange:d=>l(c,"sublabel",d.target.value),placeholder:r("captionEditor.phIpx4")}),e.jsx("button",{onClick:()=>o(c),className:"p-1 text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},c)),s.items.length<5&&e.jsxs("button",{onClick:a,className:"text-[11px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",r("captionEditor.addFeature")]})]})]})}function vn({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.sectionTag"),children:e.jsx(J,{value:l.sectionTag||"",onChange:a=>t({sectionTag:a.target.value}),placeholder:s("captionEditor.phRealComparison")})}),e.jsx(se,{label:s("captionEditor.overallTitle"),children:e.jsx(J,{value:l.title,onChange:a=>t({title:a.target.value})})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Me,{label:s("captionEditor.beforeImage"),value:l.beforeUrl,onChange:a=>t({beforeUrl:a}),images:r}),e.jsx(J,{value:l.beforeLabel,onChange:a=>t({beforeLabel:a.target.value}),placeholder:s("captionEditor.phOrdinaryFabric")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Me,{label:s("captionEditor.afterImage"),value:l.afterUrl,onChange:a=>t({afterUrl:a}),images:r}),e.jsx(J,{value:l.afterLabel,onChange:a=>t({afterLabel:a.target.value}),placeholder:s("captionEditor.phThisProduct")})]})]}),e.jsx(se,{label:s("captionEditor.bottomSummary"),children:e.jsx(tt,{value:l.summary,onChange:a=>t({summary:a.target.value}),rows:2})})]})}function jn({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data,a=(c,d,p)=>{t({items:l.items.map((I,N)=>N===c?{...I,[d]:p}:I)})},o=()=>t({items:[...l.items,{url:"",label:s("captionEditor.newScene","New scene")}].slice(0,4)}),n=c=>t({items:l.items.filter((d,p)=>p!==c)});return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.sectionTag"),children:e.jsx(J,{value:l.sectionTag||"",onChange:c=>t({sectionTag:c.target.value}),placeholder:s("captionEditor.phSceneOutfit")})}),e.jsx(se,{label:s("captionEditor.overallTitle"),children:e.jsx(J,{value:l.title,onChange:c=>t({title:c.target.value})})})]}),e.jsxs("div",{className:"space-y-2",children:[l.items.map((c,d)=>e.jsxs("div",{className:"rounded bg-[var(--bg-secondary)] p-2 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:[s("captionEditor.scene")," ",d+1]}),e.jsx("button",{onClick:()=>n(d),className:"p-0.5 text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer",children:e.jsx(Ke,{className:"w-3 h-3"})})]}),e.jsx(Me,{value:c.url,onChange:p=>a(d,"url",p),images:r}),e.jsx(J,{value:c.label,onChange:p=>a(d,"label",p.target.value),placeholder:s("captionEditor.phSceneName")})]},d)),l.items.length<4&&e.jsxs("button",{onClick:o,className:"text-[11px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",s("captionEditor.addScene")]})]})]})}function wn({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data,a=(c,d,p)=>{t({callouts:l.callouts.map((I,N)=>N===c?{...I,[d]:p}:I)})},o=()=>t({callouts:[...l.callouts,{xPct:50,yPct:50,title:s("captionEditor.newCallout","New callout"),text:""}].slice(0,6)}),n=c=>t({callouts:l.callouts.filter((d,p)=>p!==c)});return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Me,{label:s("captionEditor.productImage"),value:l.imageUrl,onChange:c=>t({imageUrl:c}),images:r}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.sectionTag"),children:e.jsx(J,{value:l.sectionTag||"",onChange:c=>t({sectionTag:c.target.value}),placeholder:s("captionEditor.phCraftCallout")})}),e.jsx(se,{label:s("captionEditor.overallTitle"),children:e.jsx(J,{value:l.title,onChange:c=>t({title:c.target.value})})})]}),e.jsxs("div",{className:"space-y-2",children:[l.callouts.map((c,d)=>e.jsxs("div",{className:"rounded bg-[var(--bg-secondary)] p-2 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:[s("captionEditor.calloutPoint")," ",d+1]}),e.jsx("button",{onClick:()=>n(d),className:"p-0.5 text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer",children:e.jsx(Ke,{className:"w-3 h-3"})})]}),e.jsx(J,{value:c.title,onChange:p=>a(d,"title",p.target.value),placeholder:s("captionEditor.phCalloutTitle")}),e.jsx(J,{value:c.text,onChange:p=>a(d,"text",p.target.value),placeholder:s("captionEditor.phCalloutText")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("label",{className:"text-[10px] text-[var(--text-tertiary)] flex items-center gap-2",children:["X%",e.jsx("input",{type:"range",min:0,max:100,value:c.xPct,onChange:p=>a(d,"xPct",Number(p.target.value)),className:"flex-1"}),e.jsx("span",{className:"w-8 text-right",children:c.xPct})]}),e.jsxs("label",{className:"text-[10px] text-[var(--text-tertiary)] flex items-center gap-2",children:["Y%",e.jsx("input",{type:"range",min:0,max:100,value:c.yPct,onChange:p=>a(d,"yPct",Number(p.target.value)),className:"flex-1"}),e.jsx("span",{className:"w-8 text-right",children:c.yPct})]})]})]},d)),l.callouts.length<6&&e.jsxs("button",{onClick:o,className:"text-[11px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",s("captionEditor.addCallout")]})]})]})}function Nn({card:i,onChange:t}){const{t:r}=re(),s=i.data;return e.jsxs("div",{className:"space-y-3",children:[e.jsx(se,{label:r("captionEditor.kickerAny"),children:e.jsx(J,{value:s.kicker,onChange:l=>t({kicker:l.target.value}),placeholder:"FOR EXPLORERS"})}),e.jsx(se,{label:r("captionEditor.titleMultiline"),children:e.jsx(tt,{value:s.title,onChange:l=>t({title:l.target.value}),rows:2})}),e.jsx(se,{label:r("captionEditor.subtitle"),children:e.jsx(tt,{value:s.subtitle,onChange:l=>t({subtitle:l.target.value}),rows:2})})]})}function kn({card:i,onChange:t}){const{t:r}=re(),s=i.data,l=(n,c,d)=>{t({rows:s.rows.map((p,I)=>I===n?{...p,[c]:d}:p)})},a=()=>t({rows:[...s.rows,{key:"",value:""}]}),o=n=>t({rows:s.rows.filter((c,d)=>d!==n)});return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:r("captionEditor.sectionTag"),children:e.jsx(J,{value:s.sectionTag||"",onChange:n=>
55t({sectionTag:n.target.value}),placeholder:r("captionEditor.phProductSpecs")})}),e.jsx(se,{label:r("captionEditor.overallTitle"),children:e.jsx(J,{value:s.title,onChange:n=>t({title:n.target.value})})})]}),e.jsxs("div",{className:"space-y-1.5",children:[s.rows.map((n,c)=>e.jsxs("div",{className:"grid grid-cols-[140px_1fr_auto] gap-2",children:[e.jsx(J,{value:n.key,onChange:d=>l(c,"key",d.target.value),placeholder:r("captionEditor.phSpecKey")}),e.jsx(J,{value:n.value,onChange:d=>l(c,"value",d.target.value),placeholder:r("captionEditor.phSpecValue")}),e.jsx("button",{onClick:()=>o(c),className:"p-1 text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},c)),e.jsxs("button",{onClick:a,className:"text-[11px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",r("captionEditor.addRow")]})]})]})}function In({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data;return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Me,{label:s("captionEditor.avatarOptional"),value:l.avatar,onChange:a=>t({avatar:a}),images:r}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.name"),children:e.jsx(J,{value:l.name,onChange:a=>t({name:a.target.value}),placeholder:s("captionEditor.phName")})}),e.jsx(se,{label:s("captionEditor.stars"),children:e.jsx("input",{type:"number",min:0,max:5,value:l.stars,onChange:a=>t({stars:Math.max(0,Math.min(5,Number(a.target.value)||0))}),className:"w-full text-xs px-2 py-1.5 rounded border border-ui-border bg-[var(--bg-primary)] text-[var(--text-primary)] focus:outline-none focus:border-ui-accent"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.topLeftBadge"),children:e.jsx(J,{value:l.badgeText||"",onChange:a=>t({badgeText:a.target.value}),placeholder:s("captionEditor.phRealReview")})}),e.jsx(se,{label:s("captionEditor.verifiedTag"),children:e.jsx(J,{value:l.verifiedText||"",onChange:a=>t({verifiedText:a.target.value}),placeholder:s("captionEditor.phVerifiedBuyer")})})]}),e.jsx(se,{label:s("captionEditor.metaInfo"),children:e.jsx(J,{value:l.meta,onChange:a=>t({meta:a.target.value}),placeholder:s("captionEditor.phDateExample")})}),e.jsx(se,{label:s("captionEditor.reviewContent"),children:e.jsx(tt,{value:l.quote,onChange:a=>t({quote:a.target.value}),rows:3})})]})}function _n({card:i,onChange:t,inputImages:r}){const{t:s}=re(),l=i.data,a=(c,d,p)=>{t({items:l.items.map((I,N)=>N===c?{...I,[d]:p}:I)})},o=()=>t({items:[...l.items,{url:"",step:`0${l.items.length+1}`,title:s("captionEditor.newStep","New step"),desc:""}].slice(0,5)}),n=c=>t({items:l.items.filter((d,p)=>p!==c)});return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:s("captionEditor.sectionTag"),children:e.jsx(J,{value:l.sectionTag||"",onChange:c=>t({sectionTag:c.target.value}),placeholder:s("captionEditor.phCraftProcess")})}),e.jsx(se,{label:s("captionEditor.overallTitle"),children:e.jsx(J,{value:l.title,onChange:c=>t({title:c.target.value})})})]}),e.jsxs("div",{className:"space-y-2",children:[l.items.map((c,d)=>e.jsxs("div",{className:"rounded bg-[var(--bg-secondary)] p-2 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:[s("captionEditor.step")," ",d+1]}),e.jsx("button",{onClick:()=>n(d),className:"p-0.5 text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer",children:e.jsx(Ke,{className:"w-3 h-3"})})]}),e.jsx(Me,{value:c.url,onChange:p=>a(d,"url",p),images:r}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] gap-2",children:[e.jsx(J,{value:c.step,onChange:p=>a(d,"step",p.target.value),placeholder:"01"}),e.jsx(J,{value:c.title,onChange:p=>a(d,"title",p.target.value),placeholder:s("captionEditor.phStepName")})]}),e.jsx(J,{value:c.desc,onChange:p=>a(d,"desc",p.target.value),placeholder:s("captionEditor.phStepDescription")})]},d)),l.items.length<5&&e.jsxs("button",{onClick:o,className:"text-[11px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",s("captionEditor.addStep")]})]})]})}function Un({card:i,onChange:t}){const{t:r}=re(),s=i.data,l=(n,c,d)=>{t({rows:s.rows.map((p,I)=>I===n?{...p,[c]:d}:p)})},a=()=>t({rows:[...s.rows,{label:r("captionEditor.newRow","New row"),our:"â",their:"â"}]}),o=n=>t({rows:s.rows.filter((c,d)=>d!==n)});return e.jsxs("div",{className:"space-y-3",children:[e.jsx(se,{label:r("captionEditor.sectionTagCn"),children:e.jsx(J,{value:s.sectionTag||"",onChange:n=>
55t({sectionTag:n.target.value}),placeholder:r("captionEditor.phComparisonList")})}),e.jsx(se,{label:r("captionEditor.overallTitle"),children:e.jsx(J,{value:s.title,onChange:n=>t({title:n.target.value})})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(se,{label:r("captionEditor.ourColumnName"),children:e.jsx(J,{value:s.ourLabel,onChange:n=>t({ourLabel:n.target.value})})}),e.jsx(se,{label:r("captionEditor.theirColumnName"),children:e.jsx(J,{value:s.theirLabel,onChange:n=>t({theirLabel:n.target.value})})})]}),e.jsxs("div",{className:"space-y-1.5",children:[s.rows.map((n,c)=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_auto] gap-2",children:[e.jsx(J,{value:n.label,onChange:d=>l(c,"label",d.target.value),placeholder:r("captionEditor.phComparisonItem")}),e.jsx(J,{value:n.our,onChange:d=>l(c,"our",d.target.value),placeholder:r("captionEditor.phOurDesc")}),e.jsx(J,{value:n.their,onChange:d=>l(c,"their",d.target.value),placeholder:r("captionEditor.phTheirDesc")}),e.jsx("button",{onClick:()=>o(c),className:"p-1 text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},c)),e.jsxs("button",{onClick:a,className:"text-[11px] text-ui-accent hover:underline cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",r("captionEditor.addRow")]})]})]})}function Cn(i){switch(i.card.template){case"hero-overlay":return e.jsx(hn,{...i});case"grid-labeled":return e.jsx(gn,{...i});case"color-badge":return e.jsx(bn,{...i});case"numbered-list":return e.jsx(yn,{...i});case"feature-row":return e.jsx(fn,{...i});case"before-after":return e.jsx(vn,{...i});case"scene-matrix":return e.jsx(jn,{...i});case"detail-callout":return e.jsx(wn,{...i});case"bold-quote":return e.jsx(Nn,{...i});case"spec-list":return e.jsx(kn,{...i});case"testimonial":return e.jsx(In,{...i});case"timeline-steps":return e.jsx(_n,{...i});case"vs-table":return e.jsx(Un,{...i})}}function Tn({stepDef:i,stepState:t,allStepStates:r,isLoading:s,onExecute:l,onNext:a}){var be;const{t:o}=re(),n=t==null?void 0:t.status,c=ae(v=>v.executingStepId),d=ae(v=>v.project),p=c===i.id,I=d?`pipeline-caption:${d.id}`:null,N=Ae[i.id]||li,k=[];for(const v of r)if(!(v.status!=="completed"||!((be=v.result)!=null&&be.files)))for(const T of v.result.files)k.push({url:T,source:v.id});const[K,C]=u.useState([]),[A,_]=u.useState(null),[E,P]=u.useState(!1),[z,f]=u.useState(!1),[U,L]=u.useState({});u.useEffect(()=>{var H,B;if(E)return;const T=((B=(H=t==null?void 0:t.result)==null?void 0:H.metadata)==null?void 0:B.caption)||(()=>{if(!I)return null;try{const y=localStorage.getItem(I);return y?JSON.parse(y):null}catch{return null}})();if(T&&Array.isArray(T.cards)&&T.cards.length>0)C(T.cards),_(T.cards[0].id);else{const y=Zt("hero-overlay");C([y]),_(y.id)}P(!0)},[E,I,t==null?void 0:t.result]),u.useEffect(()=>{if(!(!I||!E))try{localStorage.setItem(I,JSON.stringify({cards:K}))}catch{}},[I,E,K]),u.useEffect(()=>{const v=new Set;k.forEach(({url:T})=>{T&&v.add(T)}),K.forEach(T=>{const H=T.data,B=y=>{if(y){if(typeof y=="string"){/^https?:\/\//.test(y)&&v.add(y);return}if(Array.isArray(y)){y.forEach(B);return}
55typeof y=="object"&&Object.values(y).forEach(B)}};B(H)}),v.forEach(T=>{L(H=>{if(H[T])return H;const B=new Image;return B.crossOrigin="anonymous",B.onload=()=>{B.naturalWidth>0&&B.naturalHeight>0&&L(y=>({...y,[T]:{w:B.naturalWidth,h:B.naturalHeight}}))},B.onerror=()=>{},B.src=T,H})})},[k,K]);const S=v=>{const T=Zt(v);C(H=>[...H,T]),_(T.id),f(!1)},D=v=>C(T=>T.filter(H=>H.id!==v)),q=(v,T)=>{C(H=>{const B=H.findIndex(j=>j.id===v);if(B<0)return H;const y=B+T;if(y<0||y>=H.length)return H;const x=[...H];return[x[B],x[y]]=[x[y],x[B]],x})},X=(v,T,H)=>{C(B=>B.map(y=>y.id===v?{...y,[T]:H}:y))},W=(v,T)=>{C(H=>H.map(B=>B.id===v?{...B,data:{...B.data,...T}}:B))},ne=()=>{l(i.id,"generate",{caption:{cards:K}})},V=u.useRef(null),[O,$]=u.useState("none"),Y=(v,T)=>{const H=document.createElement("a");H.href=v,H.download=T,document.body.appendChild(H),H.click(),document.body.removeChild(H)},R=async v=>{const T=Array.from(v.querySelectorAll("img"));await Promise.all(T.map(H=>H.complete&&H.naturalHeight>0?Promise.resolve():new Promise(B=>{const y=()=>B();H.addEventListener("load",y,{once:!0}),H.addEventListener("error",y,{once:!0})}))),await new Promise(H=>requestAnimationFrame(()=>H(null)))},ie=async v=>{const T=Array.from(v.querySelectorAll("img"));await Promise.all(T.map(async H=>{const B=H.src;if(!(!B||B.startsWith("data:")||B.startsWith("blob:"))&&/^https?:\/\//.test(B))try{const y=await Ve.get("/pipeline/image-proxy",{params:{url:B},responseType:"blob"}),x=await new Promise((j,h)=>{const g=new FileReader;g.onload=()=>j(g.result),g.onerror=h,g.readAsDataURL(y.data)});H.src=x}catch(y){console.warn("[inlineRemoteImages] proxy failed for",B,y)}})),await R(v)},le=async v=>{if(O!=="none")return;$("card");const T=document.createElement("div");T.style.cssText="position:fixed;left:-10000px;top:0;width:760px;background:#ffffff;",document.body.appendChild(T);const{createRoot:H}=await At(async()=>{const{createRoot:j}=await import("./index-BawMCgu8.js").then(h=>h.c);return{createRoot:j}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),B=H(T),y=ze[v.themeId]||ze.white,x=He[v.fontScale]||He.md;B.render(e.jsx("div",{children:rt(v,y,x,U)}));try{await new Promise(g=>setTimeout(g,80)),console.log("[exportCard] root size after mount:",{w:T.offsetWidth,h:T.offsetHeight,children:T.children.length}),await R(T),await ie(T),console.log("[exportCard] root size after inlineImages:",{w:T.offsetWidth,h:T.offsetHeight}),await new Promise(g=>requestAnimationFrame(()=>g(null)));const j=T.firstElementChild||T,h=await Ct(j,{pixelRatio:2,cacheBust:!1,width:760,height:j.offsetHeight||void 0,skipFonts:!0});if(console.log("[exportCard] dataUrl length:",h.length),h.length<500)throw new Error(o("pipeline.stepUI.caption.exportEmptyError"));Y(h,`caption-${v.template}-${Date.now()}.png`)}catch(j){console.error("[exportCard]",j),alert(o("pipeline.stepUI.caption.exportFailed")+j.message)}finally{B.unmount(),T.parentNode&&T.parentNode.removeChild(T),$("none")}},Z=async()=>{if(!(O!=="none"||!V.current)){$("all");try{await R(V.current),await ie(V.current);const v=await Ct(V.current,{pixelRatio:2,cacheBust:!1,width:760,backgroundColor:"#ffffff",skipFonts:!0});Y(v,`caption-all-${Date.now()}.png`)}catch(v){console.error("[exportAll]",v)}finally{$("none")}}};return e.jsxs("div",{className:"max-w-[1080px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(N,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),o(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:o(i.descKey)}),e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:o("pipeline.stepUI.caption.cardListTitle",{count:K.length})}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:()=>f(!0),className:"px-3 py-1.5 rounded-md text-xs bg-ui-accent text-white cursor-pointer inline-flex items-center gap-1",children:[e.jsx(we,{className:"w-3.5 h-3.5"})," ",o("pipeline.stepUI.caption.addCard")]})})]}),z&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-6",onClick:()=>f(!1),children:e.jsxs("div",{className:"bg-[var(--bg-primary)] rounded-xl border border-ui-border p-5 max-w-[920px] w-full max-h-[80vh] overflow-y-auto",onClick:v=>v.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"text-base font-bold text-[var(--text-primary)]",children:o("pipeline.stepUI.caption.selectTemplate")}),e.jsx("button",{onClick:()=>f(!1),className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer",children:e.jsx(Re,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3",children:ht.map(v=>e.jsxs("button",{onClick:()=>S(v.id),className:"text-left p-3 rounded-lg border border-ui-border bg-[var(--bg-secondary)] hover:border-ui-accent hover:bg-ui-accent/5 cursor-pointer transition-all",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text-primary)] mb-1",children:o(`captionTheme.${v.id}.name`)}),e.jsx("div",{className:"text-[11px] text-[var(--text-tertiary)] leading-relaxed",children:o(`captionTheme.${v.id}.desc`)})]},v.id))})]})}),e.jsx("div",{className:"space-y-3",children:K.map((v,T)=>{const H=ze[v.themeId]||ze.white,B=He[v.fontScale]||He.md,y=ht.find(j=>j.id===v.template),x=A===v.id;return e.jsxs("div",{className:"rounded-xl border border-ui-border overflow-hidden bg-[var(--bg-secondary)]",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-[var(--bg-tertiary)]",children:[e.jsx("span",{className:"text-[10px] text-[var(--text-tertiary)] w-5 text-center",children:T+1}),e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)]",children:y?o(`captionTheme.${y.id}.name`):v.template}),e.jsxs("span",{className:"ml-auto flex items-center gap-0.5",children:[e.jsx("button",{title:o("pipeline.stepUI.caption.moveUp"),disabled:T===0,onClick:()=>q(v.id,-1),className:"p-1 rounded hover:bg-[var(--bg-secondary)] text-[var(--text-secondary)] disabled:opacity-30 curs
55or-pointer",children:e.jsx(zi,{className:"w-3.5 h-3.5"})}),e.jsx("button",{title:o("pipeline.stepUI.caption.moveDown"),disabled:T===K.length-1,onClick:()=>q(v.id,1),className:"p-1 rounded hover:bg-[var(--bg-secondary)] text-[var(--text-secondary)] disabled:opacity-30 cursor-pointer",children:e.jsx($i,{className:"w-3.5 h-3.5"})}),e.jsx("button",{title:o(x?"pipeline.stepUI.caption.collapse":"pipeline.stepUI.caption.expandEdit"),onClick:()=>_(x?null:v.id),className:"px-2 py-0.5 rounded text-[10px] border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-secondary)] cursor-pointer",children:o(x?"pipeline.stepUI.caption.fold":"pipeline.stepUI.caption.edit")}),e.jsx("button",{title:o("pipeline.stepUI.caption.exportThis"),onClick:()=>le(v),disabled:O!=="none",className:"p-1 rounded hover:bg-[var(--bg-secondary)] text-[var(--text-secondary)] cursor-pointer disabled:opacity-30",children:e.jsx(Fe,{className:"w-3.5 h-3.5"})}),e.jsx("button",{title:o("pipeline.stepUI.caption.deleteCard"),onClick:()=>D(v.id),className:"p-1 rounded hover:bg-[var(--bg-secondary)] text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]})]}),e.jsx("div",{className:"flex justify-center bg-[var(--bg-tertiary)] py-4 overflow-auto",children:e.jsx("div",{style:{zoom:.7},children:rt(v,H,B,U)})}),x&&e.jsxs("div",{className:"border-t border-ui-border p-4 space-y-3 bg-[var(--bg-secondary)]",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-[11px] font-medium text-[var(--text-secondary)] mb-1.5 inline-flex items-center gap-1",children:[e.jsx(Et,{className:"w-3 h-3"}),o("pipeline.stepUI.caption.themeLabel")]}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:Zr.map(j=>{const h=ze[j],g=v.themeId===j;return e.jsx("button",{onClick:()=>X(v.id,"themeId",j),title:o(`captionTheme.${j}.name`),className:`w-7 h-7 rounded border-2 cursor-pointer flex items-center justify-center transition-all ${g?"border-ui-accent ring-1 ring-ui-accent/30":"border-ui-border"}`,style:{background:h.bg},children:e.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"2px",background:h.accent}})},j)})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-secondary)] mb-1.5",children:o("pipeline.stepUI.caption.fontSizeLabel")}),e.jsx("div",{className:"flex gap-1",children:["sm","md","lg"].map(j=>e.jsx("button",{onClick:()=>X(v.id,"fontScale",j),className:`px-2.5 py-1 rounded text-[11px] cursor-pointer ${v.fontScale===j?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)]"}`,children:o(j==="sm"?"pipeline.stepUI.caption.fontSm":j==="md"?"pipeline.stepUI.caption.fontMd":"pipeline.stepUI.caption.fontLg")},j))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-secondary)] mb-1.5",children:o("pipeline.stepUI.caption.alignLabel")}),e.jsx("div",{className:"flex gap-1",children:["left","center","right"].map(j=>e.jsx("button",{onClick:()=>X(v.id,"align",j),className:`px-2.5 py-1 rounded text-[11px] cursor-pointer ${v.align===j?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)]"}`,children:o(j==="left"?"pipeline.stepUI.caption.alignLeft":j==="center"?"pipeline.stepUI.caption.alignCenter":"pipeline.stepUI.caption.alignRight")},j))})]})]}),e.jsx("div",{className:"pt-2 border-t border-ui-border/50",children:Cn({card:v,inputImages:k,onChange:j=>W(v.id,j)})}),e.jsx("div",{className:"pt-3 flex justify-end border-t border-ui-border/50",children:e.jsxs("button",{onClick:()=>le(v),disabled:O!=="none",className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 disabled:opacity-50 cursor-pointer",children:[O==="card"?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(Fe,{className:"w-4 h-4"}),o("pipeline.stepUI.caption.exportThisImage")]})})]})]},v.id)})})]}),e.jsx("div",{style:{position:"fixed",left:"-10000px",top:0},children:e.jsx("div",{ref:V,style:{width:"760px",background:"#ffffff"},children:K.map(v=>{const T=ze[v.themeId]||ze.white,H=He[v.fontScale]||He.md;return e.jsx("div",{children:rt(v,T,H,U)},v.id)})})}),n==="completed"&&e.jsxs("div",{className:"text-[var(--success)] text-sm flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}
55)," ",o("pipeline.stepUI.caption.savedToProject")]}),n==="error"&&e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||o("pipeline.stepUI.caption.saveFailed")]}),e.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[e.jsxs("button",{onClick:ne,disabled:s,className:"inline-flex items-center justify-center gap-1.5 px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 disabled:opacity-50 cursor-pointer",children:[p?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx($t,{className:"w-4 h-4"}),o(n==="completed"?"pipeline.stepUI.caption.updateAndSave":"pipeline.stepUI.caption.saveToProject")]}),e.jsxs("button",{onClick:Z,disabled:O!=="none"||K.length===0,className:"inline-flex items-center justify-center gap-1.5 px-5 py-2 rounded-lg border border-ui-border text-[var(--text-primary)] text-sm hover:bg-[var(--bg-tertiary)] disabled:opacity-50 cursor-pointer",children:[O==="all"?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(Fe,{className:"w-4 h-4"}),o("pipeline.stepUI.caption.exportAll",{count:K.length})]}),n==="completed"&&e.jsxs("button",{onClick:a,className:"ml-auto px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 cursor-pointer inline-flex items-center gap-1.5",children:[o("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]}),n!=="completed"&&!i.required&&e.jsxs("button",{onClick:()=>{l(i.id,"skip"),a()},disabled:s,className:"ml-auto px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",o("pipeline.common.skipNext")]})]})]})]})}const Qt=[{id:"taobao",labelKey:"pipeline.stepUI.description.platforms.taobao"},{id:"jd",labelKey:"pipeline.stepUI.description.platforms.jd"},{id:"pdd",labelKey:"pipeline.stepUI.description.platforms.pdd"},{id:"douyin",labelKey:"pipeline.stepUI.description.platforms.douyin"},{id:"xiaohongshu",labelKey:"pipeline.stepUI.description.platforms.xiaohongshu"},{id:"amazon",labelKey:"pipeline.stepUI.description.platforms.amazon"}],ei=[{id:"professional",labelKey:"pipeline.stepUI.description.styles.professional"},{id:"lively",labelKey:"pipeline.stepUI.description.styles.lively"},{id:"concise",labelKey:"pipeline.stepUI.description.styles.concise"},{id:"luxury",labelKey:"pipeline.stepUI.description.styles.luxury"}];function En(i){if(!i)return null;try{return JSON.parse(i)}catch{const t=i.match(/```(?:json)?\s*\n?([\s\S]*?)\n?\s*```/);if(t)try{return JSON.parse(t[1].trim())}catch{return null}const r=i.match(/\{[\s\S]*\}/);if(r)try{return JSON.parse(r[0])}catch{return null}return null}}function Kn({data:i,t}){return e.jsxs("div",{className:"space-y-4",children:[i.title&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-[var(--text-tertiary)] mb-1",children:t("pipeline.stepUI.description.fields.title")}),e.jsx("div",{className:"text-lg font-semibold text-[var(--text-primary)]",children:i.title})]}),i.highlights&&Array.isArray(i.highlights)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-[var(--text-tertiary)] mb-2",children:t("pipeline.stepUI.description.fields.highlights")}),e.jsx("ul",{className:"space-y-1",children:i.highlights.map((r,s)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-ui-accent mt-0.5",children:"â¢"}),r]},s))})]}),i.description&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-[var(--text-tertiary)] mb-1",children:t("pipeline.stepUI.description.fields.description")}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)] whitespace-pre-wrap",children:i.description})]})]})}function Nt({rows:i,columns:t}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-ui-border",children:t.map(r=>e.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--text-tertiary)]",children:r},r))})}),e.jsx("tbody",{children:i.map((r,s)=>e.jsx("tr",{className:"border-b border-ui-border/50",children:t.map(l=>e.jsx("td",{className:"px-3 py-2 text-[var(--text-secondary)]",children:String(r[l]??"")},l))},s))})]})})}function Sn({items:i,fields:t}){return e.jsx("div",{className:"space-y-3",children:i.map((r,s)=>e.jsx("div",{className:"rounded-lg border border-ui-border bg-[var(--bg-tertiary)] p-4",children:t.map(l=>r[l]!=null?e.jsxs("div",{className:"mb-1 last:mb-0",children:[e.jsxs("span",{className:"text-xs font-medium text-[var(--text-tertiary)]",children:[l,": "]}),e.jsx("span",{className:"text-sm text-[var(--text-secondary)]",children:String(r[l])})]},l):null)},s))})}function Pn({stepId:i,data:t,t:r}
55){switch(i){case"desc":return e.jsx(Kn,{data:t,t:r});case"specs":return e.jsxs("div",{className:"space-y-3",children:[t.name&&e.jsx("div",{className:"text-base font-medium text-[var(--text-primary)]",children:t.name}),t.dimensions&&e.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--text-tertiary)]",children:r("pipeline.stepUI.description.fields.dimensionsLabel")}),t.dimensions]}),t.weight&&e.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--text-tertiary)]",children:r("pipeline.stepUI.description.fields.weightLabel")}),t.weight]}),t.specs&&Array.isArray(t.specs)&&e.jsx(Nt,{rows:t.specs,columns:["key","value"]})]});case"nutrition":return e.jsxs("div",{className:"space-y-3",children:[t.serving&&e.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--text-tertiary)]",children:r("pipeline.stepUI.description.fields.servingLabel")}),t.serving]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:["calories","protein","fat","carbs","sodium"].map(s=>t[s]!=null?e.jsxs("div",{className:"rounded-lg border border-ui-border bg-[var(--bg-tertiary)] p-3 text-center",children:[e.jsx("div",{className:"text-lg font-semibold text-[var(--text-primary)]",children:t[s]}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)]",children:r(s==="calories"?"pipeline.stepUI.description.units.kcal":s==="sodium"?"pipeline.stepUI.description.units.mg":"pipeline.stepUI.description.units.g")}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] capitalize",children:s})]},s):null)}),t.highlights&&Array.isArray(t.highlights)&&e.jsx("div",{className:"flex flex-wrap gap-2",children:t.highlights.map((s,l)=>e.jsx("span",{className:"px-2 py-1 rounded-full text-xs bg-ui-accent/10 text-ui-accent",children:s},l))}),e.jsx("div",{className:"text-xs text-[var(--warning)] mt-2",children:r("pipeline.stepUI.description.nutritionDisclaimer")})]});case"dimension":return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"grid grid-cols-3 gap-3",children:["length","width","height"].map(s=>t[s]!=null?e.jsxs("div",{className:"rounded-lg border border-ui-border bg-[var(--bg-tertiary)] p-3 text-center",children:[e.jsx("div",{className:"text-lg font-semibold text-[var(--text-primary)]",children:t[s]}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)]",children:r("pipeline.stepUI.description.units.cm")}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] capitalize",children:s})]},s):null)}),t.details&&Array.isArray(t.details)&&e.jsx(Nt,{rows:t.details,columns:["part","size"]})]});case"ingredient":{if(t.ingredients&&Array.isArray(t.ingredients)){const s=Object.keys(t.ingredients[0]||{});return e.jsx(Nt,{rows:t.ingredients,columns:s})}break}case"combo":if(t.combos&&Array.isArray(t.combos))return e.jsx(Sn,{items:t.combos,fields:["style","items","tips"]});break;case"sizeref":return e.jsx("div",{className:"space-y-2",children:Object.entries(t).map(([s,l])=>e.jsxs("div",{className:"text-sm",children:[e.jsxs("span",{className:"font-medium text-[var(--text-tertiary)]",children:[s,": "]}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:String(l)})]},s))})}return e.jsx("pre",{className:"text-sm text-[var(--text-secondary)] whitespace-pre-wrap bg-[var(--bg-tertiary)] rounded-lg p-4 overflow-x-auto",children:JSON.stringify(t,null,2)})}function Rn({stepDef:i,stepState:t,category:r,isLoading:s,onExecute:l,onNext:a}){var U,L;const{t:o}=re(),n=t==null?void 0:t.status,d=ae(S=>S.executingStepId)===i.id,p=i.id==="desc",I=Ae[i.id]||zt,[N,k]=u.useState("taobao"),[K,C]=u.useState("professional"),[A,_]=u.useState(""),[E,P]=u.useState(!1),z=u.useMemo(()=>{var D;const S=(D=t==null?void 0:t.result)==null?void 0:D.text;return En(S)},[(U=t==null?void 0:t.result)==null?void 0:U.text]),f=()=>{const S={};if(r&&(S.category=r),p){const D=Qt.find(X=>X.id===N);S.platform=o(D?D.labelKey:"pipeline.stepUI.description.platforms.taobao");const q=ei.find(X=>X.id===K);S.style=o(q?q.labelKey:"pipeline.stepUI.description.styles.professional")}l(i.id,"generate",S)};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:o(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:o(i.descKey)}),n==="completed"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",o("pipeline.stepUI.description.generatedTitle")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[o("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),E?e.jsxs("div",{className:"space-y-3",children:[e.jsx("textarea",{value:A,onChange:S=>_(S.target.value),rows:12,className:"w-full px-4 py-3 rounded-xl border border-ui-border bg-[var(--bg-secondary)] text-[var(--text-primary)] text-sm resize-none font-mono placeholder:text-[var(--text-tertiary)] focus:outline-none focus:border-ui-accent transition-colors"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>P(!1),className:"px-4 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer",children:o("pipeline.stepUI.description.done")}),e.jsx("button",{onClick:()=>P(!1),className:"px-4 py-2 rounded-lg border border-ui-border text-sm text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer",children:o("pipeline.stepUI.description.cancel")})]})]}):e.jsx("div",{children:z?e.jsx(Pn,{stepId:i.id,data:z,t:o}):e.jsx("div",{className:"text-sm text-[var(--text-secondary)] whitespace-pre-wrap bg-[var(--bg-tertiary)] rounded-lg p-4",children:(L=t==null?void 0:t.result)==null?void 0:L.text})})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:f,disabled:s,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",o("pipeline.common.regenerate")]}),!E&&e.jsx("button",{onClick:()=>{var S;_(((S=t==null?void 0:t.result)==null?void 0:S.text)||""),P(!0)},className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer",children:o("pipeline.stepUI.description.edit")}),e.jsxs("button",{onClick:a,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[o("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):n==="error"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--error)]/30 bg-[var(--error)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--error)] font-medium mb-2 flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",o("pipeline.common.error")]}),e.jsx("div",{className:"text-sm text-[var(--error)]",children:(t==null?void 0:t.error)||o("pipeline.common.unknownError")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>l(i.id,"retry"),disabled:s,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[s?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-4 h-4 inline mr-1"}),o("pipeline.common.retry")]})})]}):e.jsxs("div",{className:"space-y-6",children:[p&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.description.targetPlatform")}),e.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2",children:Qt.map(S=>e.jsx("button",{onClick:()=>k(S.id),className:`px-3 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${N===S.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:o(S.labelKey)},S.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.description.writingStyle")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:ei.map(S=>e.jsx("button",{onClick:()=>C(S.id),className:`px-3 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${K===S.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:o(S.labelKey)},S.id))})]})]}),!p&&e.jsxs("div",{className:"rounded-xl border border-ui-border bg-[var(--bg-secondary)] p-8 text-center",children:[e.jsx(I,{className:"w-12 h-12 mx-auto mb-3 text-[var(--text-tertiary)]"}),e.jsx("div",{className:"text-[var(--text-secondary)] text-sm",children:o(i.descKey)})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:f,disabled:s,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[d?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(I,{className:"w-4 h-4 inline mr-1"}),o("pipeline.stepUI.description.generateCopy"),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{l(i.id,"skip"),a()},disabled:s,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",o("pipeline.common.skipNext")]})]})]})]})}function tl(){return{joints:[{id:"head",name:"头",position:new Ie(0,1.7,0),parent:"neck",color:"#6366f1"},{id:"neck",name:"é¢",position:new Ie(0,1.5,0),parent:"spine",color:"#6366f1"}
55,{id:"spine",name:"è¸",position:new Ie(0,1.25,0),parent:"hips",color:"#3b82f6"},{id:"hips",name:"è",position:new Ie(0,.92,0),parent:null,color:"#3b82f6"},{id:"l_shoulder",name:"å·¦è©",position:new Ie(-.22,1.43,0),parent:"spine",color:"#22c55e"},{id:"l_elbow",name:"å·¦è",position:new Ie(-.22,1.13,0),parent:"l_shoulder",color:"#22c55e"},{id:"l_wrist",name:"å·¦è
",position:new Ie(-.22,.83,0),parent:"l_elbow",color:"#22c55e"},{id:"r_shoulder",name:"å³è©",position:new Ie(.22,1.43,0),parent:"spine",color:"#f59e0b"},{id:"r_elbow",name:"å³è",position:new Ie(.22,1.13,0),parent:"r_shoulder",color:"#f59e0b"},{id:"r_wrist",name:"å³è
",position:new Ie(.22,.83,0),parent:"r_elbow",color:"#f59e0b"},{id:"l_hip",name:"å·¦é«",position:new Ie(-.1,.92,0),parent:"hips",color:"#ec4899"},{id:"l_knee",name:"å·¦è",position:new Ie(-.1,.5,0),parent:"l_hip",color:"#ec4899"},{id:"l_ankle",name:"å·¦è¸",position:new Ie(-.1,.05,0),parent:"l_knee",color:"#ec4899"},{id:"r_hip",name:"å³é«",position:new Ie(.1,.92,0),parent:"hips",color:"#8b5cf6"},{id:"r_knee",name:"å³è",position:new Ie(.1,.5,0),parent:"r_hip",color:"#8b5cf6"},{id:"r_ankle",name:"å³è¸",position:new Ie(.1,.05,0),parent:"r_knee",color:"#8b5cf6"}],bones:[{from:"head",to:"neck"},{from:"neck",to:"spine"},{from:"spine",to:"hips"},{from:"spine",to:"l_shoulder"},{from:"l_shoulder",to:"l_elbow"},{from:"l_elbow",to:"l_wrist"},{from:"spine",to:"r_shoulder"},{from:"r_shoulder",to:"r_elbow"},{from:"r_elbow",to:"r_wrist"},{from:"hips",to:"l_hip"},{from:"l_hip",to:"l_knee"},{from:"l_knee",to:"l_ankle"},{from:"hips",to:"r_hip"},{from:"r_hip",to:"r_knee"},{from:"r_knee",to:"r_ankle"}]}}const Ce={head:[0,1.7,0],neck:[0,1.5,0],spine:[0,1.25,0],hips:[0,.92,0]},An={id:"standing",name:"ç«ç«",group:"daily",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.22,1.13,0],l_wrist:[-.22,.83,0],r_shoulder:[.22,1.43,0],r_elbow:[.22,1.13,0],r_wrist:[.22,.83,0],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}},zn={id:"hands_on_hips",name:"åè
°",group:"daily",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.3,1.15,.05],l_wrist:[-.14,.95,.05],r_shoulder:[.22,1.43,0],r_elbow:[.3,1.15,.05],r_wrist:[.14,.95,.05],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}},$n={id:"walking",name:"èµ°è·¯",group:"daily",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.24,1.17,-.17],l_wrist:[-.18,.95,-.3],r_shoulder:[.22,1.43,0],r_elbow:[.24,1.17,.17],r_wrist:[.18,.95,.3],l_hip:[-.1,.92,0],l_knee:[-.12,.52,.22],l_ankle:[-.14,.08,.4],r_hip:[.1,.92,0],r_knee:[.12,.48,-.22],r_ankle:[.14,.08,-.35]}},Ln={id:"running",name:"è·æ¥",group:"daily",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.28,1.25,-.15],l_wrist:[-.22,1.1,.18],r_shoulder:[.22,1.43,0],r_elbow:[.28,1.25,.15],r_wrist:[.22,1.1,-.18],l_hip:[-.1,.92,0],l_knee:[-.14,.62,.3],l_ankle:[-.18,.3,.55],r_hip:[.1,.92,0],r_knee:[.14,.52,-.22],r_ankle:[.18,.18,-.48]}},On={id:"fashion_pose",name:"æ¶å°å§¿å¿",group:"fashion",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.35,1.18,.05],l_wrist:[-.26,1,.12],r_shoulder:[.22,1.43,0],r_elbow:[.32,1.14,.02],r_wrist:[.38,.84,0],l_hip:[-.1,.92,0],l_knee:[-.14,.5,.06],l_ankle:[-.16,.06,.1],r_hip:[.1,.92,0],r_knee:[.15,.5,-.04],r_ankle:[.12,.05,-.04]}},Hn={id:"crossed_legs_stand",name:"交åè
¿ç«",group:"fashion",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.24,1.14,0],l_wrist:[-.2,.84,.02],r_shoulder:[.22,1.43,0],r_elbow:[.24,1.14,0],r_wrist:[.2,.84,.02],l_hip:[-.1,.92,0],l_knee:[-.08,.5,0],l_ankle:[.05,.05,.02],r_hip:[.1,.92,0],r_knee:[.08,.5,0],r_ankle:[-.05,.06,.04]}},Mn={id:"hand_on_hip_one",name:"åæåè
°",group:"fashion",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.3,1.15,.05],l_wrist:[-.14,.95,.05],r_shoulder:[.22,1.43,0],r_elbow:[.26,1.13,0],r_wrist:[.3,.85,0],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.12,.5,0],r_ankle:[.15,.05,.02]}},Fn={id:"arms_crossed",name:"交åè",group:"fashion",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.18,1.15,.2],l_wrist:[.14,1.12,.22],r_shoulder:[.22,1.43,0],r_elbow:[.18,1.15,.2],r_wrist:[-.14,1.12,.22],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}},Bn={id:"waving",name:"æ¥æ",group:"gesture",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.22,1.13,0],l_wrist:[-.22,.83,0],r_shoulder:[.22,1.43,0],r_elbow:[.38,1.62,0],r_wrist:[.28,1.88,.05],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}},Wn={id:"hands_up",name:"åæä¸¾é«",group:"gesture",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.3,1.7,0],l_wrist:[-.34,2,0],r_shoulder:[.22,1.43,0],r_elbow:[.3,1.7,0],r_wrist:[.34,2,0],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}},Gn={id:"hands_on_head",name:"åææ±å¤´",group:"gesture",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.38,1.58,.05],l_wrist:[-.14,1.72,.05],r_shoulder:[.22,1.43,0],r_elbow:[.38,1.58,.05],r_wrist:[.14,1.72,.05],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}},qn={id:"peace_sign",name:"æ¯è¶",group:"gesture",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.22,1.13,0],l_wrist:[-.22,.83,0],r_shoulder:[.22,1.43,0],r_elbow:[.38,1.5,0],r_wrist:[.3,1.78,.05],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}},Vn={id:"sitting",name:"åå§¿",group:"sit_squat",positions:{head:[0,1.38,0],neck:[0,1.18,0],spine:[0,.93,0],hips:[0,.6,0],l_shoulder:[-.22,1.11,0],l_elbow:[-.32,.88,.08],l_wrist:[-.22,.7,.22],r_shoulder:[.22,1.11,0],r_elbow:[.32,.88,.08],r_wrist:[.22,.7,.22],l_hip:[-.1,.6,0],l_knee:[-.12,.42,.38],l_ankle:[-.12,.05,.38],r_hip:[.1,.6,0],r_knee:[.12,.42,.38],r_ankle:[.12,.05,.38]}},Dn={id:"squat",name:"蹲姿",group:"sit_squat",positions:{head:[0,1.2,.05],neck:[0,1,.05],spine:[0,.76,.04],hips:[0,.45,0],l_shoulder:[-.22,.94,.04],l_elbow:[-.24,.78,.24],l_wrist:[-.18,.62,.45],r_shoulder:[.22,.94,.04],r_elbow:[.24,.78,.24],r_wrist:[.18,.62,.45],l_hip:[-.12,.45,0],l_knee:[-.2,.22,.28],l_ankle:[-.14,.05,.18],r_hip:[.12,.45,0],r_knee:[.2,.22,.28],r_ankle:[.14,.05,.18]}},Xn={id:"lunge",name:"弿¥",group:"sit_squat",positions:{head:[0,1.6,0],neck:[0,1.4,0],spine:[0,1.15,0],hips:[0,.8,.05],l_shoulder:[-.22,1.33,.05],l_elbow:[-.3,1.08,.12],l_wrist:[-.18,.9,.22],r_shoulder:[.22,1.33,.05],r_elbow:[.3,1.08,.12],r_wrist:[.18,.9,.22],l_hip:[-.12,.8,.05],l_knee:[-.12,.4,.3],l_ankle:[-.12,.05,.5],r_hip:[.1,.8,.05],r_knee:[.14,.42,-.22],r_ankle:[.16,.05,-.35]}},Yn={id:"stretching",name:"伸å±",group:"sport",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.28,1.7,-.1],l_wrist:[-.1,1.92,-.16],r_shoulder:[.22,1.43,0],r_elbow:[.42,1.2,0],r_wrist:[.52,.92,0],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.12,.5,0],r_ankle:[.12,.05,0]}},Jn={id:"yoga_tree",name:"ç伽·æ å¼",group:"sport",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.18,1.72,0],l_wrist:[-.04,1.96,0],r_shoulder:[.22,1.43,0],r_elbow:[.18,1.72,0],r_wrist:[.04,1.96,0],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.3,.76,.1],r_ankle:[.02,.62,.18]}},Zn={id:"kick",name:"踢è
¿",group:"sport",positions:{...Ce,l_shoulder:[-.22,1.43,0],l_elbow:[-.26,1.16,-.05],l_wrist:[-.22,.9,.12],r_shoulder:[.22,1.43,0],r_elbow:[.26,1.16,-.05],r_wrist:[.22,.9,-.18],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,1.12,.35],r_ankle:[.1,1.1,.8]}},Qn={id:"bowing",name:"é 躬",group:"art",positions:{head:[0,1.38,.4],neck:[0,1.32,.28],spine:[0,1.22,.14],hips:[0,.92,0],l_shoulder:[-.22,1.28,.12],l_elbow:[-.22,1,.1],l_wrist:[-.22,.72,.08],r_shoulder:[.22,1.28,.12],r_elbow:[.22,1,.1],r_wrist:[.22,.72,.08],l_hip:[-.1,.92,0],l_knee:[-.1,.5,0],l_ankle:[-.1,.05,0],r_hip:[.1,.92,0],r_knee:[.1,.5,0],r_ankle:[.1,.05,0]}}
55,ea={id:"looking_back",name:"åç¸",group:"art",positions:{head:[.06,1.7,-.02],neck:[.02,1.5,0],spine:[0,1.25,0],hips:[0,.92,0],l_shoulder:[-.22,1.43,0],l_elbow:[-.26,1.15,.02],l_wrist:[-.24,.86,.04],r_shoulder:[.22,1.43,0],r_elbow:[.26,1.15,.02],r_wrist:[.24,.86,.04],l_hip:[-.1,.92,0],l_knee:[-.1,.5,.02],l_ankle:[-.1,.05,.02],r_hip:[.1,.92,0],r_knee:[.1,.5,-.02],r_ankle:[.1,.05,-.02]}},ti=[An,zn,$n,Ln,On,Hn,Mn,Fn,Bn,Wn,Gn,qn,Vn,Dn,Xn,Yn,Jn,Zn,Qn,ea],il=["daily","fashion","gesture","sit_squat","sport","art"],ta=u.lazy(()=>At(()=>import("./PoseEditor3D-qnOQP0Sb.js"),__vite__mapDeps([14,0,1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27]))),ia=195,sa=[{id:"asian_female",labelKey:"pipeline.stepUI.tryon.presetModels.asian_female",image:ve("tryon","asian_female")},{id:"asian_male",labelKey:"pipeline.stepUI.tryon.presetModels.asian_male",image:ve("tryon","asian_male")},{id:"western_female",labelKey:"pipeline.stepUI.tryon.presetModels.western_female",image:ve("tryon","western_female")},{id:"western_male",labelKey:"pipeline.stepUI.tryon.presetModels.western_male",image:ve("tryon","western_male")},{id:"asian_female_2",labelKey:"pipeline.stepUI.tryon.presetModels.asian_female_2",image:ve("tryon","asian_female_2")},{id:"asian_female_3",labelKey:"pipeline.stepUI.tryon.presetModels.asian_female_3",image:ve("tryon","asian_female_3")},{id:"western_female_2",labelKey:"pipeline.stepUI.tryon.presetModels.western_female_2",image:ve("tryon","western_female_2")},{id:"plus_size_female",labelKey:"pipeline.stepUI.tryon.presetModels.plus_size_female",image:ve("tryon","plus_size_female")}],ra=[{id:"3:4",label:"3:4"},{id:"1:1",label:"1:1"},{id:"4:3",label:"4:3"},{id:"9:16",label:"9:16"}];let na=0;function aa({stepDef:i,stepState:t,allStepStates:r,category:s,isLoading:l,onExecute:a,onNext:o}){var Ye,ot,ct;const{t:n}=re(),c=s==="3c",d={subjectSingular:n(c?"pipeline.stepUI.tryon.subjectProduct":"pipeline.stepUI.tryon.subjectClothing"),actionVerb:n(c?"pipeline.stepUI.tryon.actionUse":"pipeline.stepUI.tryon.actionTryOn"),resultNoun:n(c?"pipeline.stepUI.tryon.resultUse":"pipeline.stepUI.tryon.resultTryOn")},p=t==null?void 0:t.status,I=ae(w=>w.executingStepId),N=ae(w=>w.project),k=I===i.id,K=N?`pipeline-tryon-tasks:${N.id}`:null,C=r.find(w=>w.id==="removebg"),A=r.find(w=>w.id==="upload"),_=((C==null?void 0:C.status)==="completed"?(Ye=C==null?void 0:C.result)==null?void 0:Ye.files:(ot=A==null?void 0:A.result)==null?void 0:ot.files)||[],[E,P]=u.useState([]),[z,f]=u.useState(!1),[U,L]=u.useState(""),[S,D]=u.useState(!1),q=u.useRef(null),{openPicker:X,PickerElement:W}=Kt(),{showSourceChoice:ne,sourceChoiceOpen:V,pickSource:O}=St();u.useEffect(()=>{$e.getCustomModels().then(w=>{P(w.map(te=>({id:te.id,label:te.label,image:te.imageUrl,isCustom:!0})))}).catch(()=>{})},[]);const $=[...sa,...E],[Y,R]=u.useState([]),[ie,le]=u.useState(null);u.useEffect(()=>{if(!ie)return;const w=ce=>{ce.key==="Escape"&&le(null)};document.addEventListener("keydown",w);const te=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",w),document.body.style.overflow=te}},[ie]);const[Z,be]=u.useState(!1);u.useEffect(()=>{if(!(!K||Z)){try{const w=localStorage.getItem(K);if(w){const te=JSON.parse(w);Array.isArray(te)&&R(te)}}catch{}be(!0)}},[K,Z]),u.useEffect(()=>{if(!(!K||!Z))try{Y.length===0?localStorage.removeItem(K):localStorage.setItem(K,JSON.stringify(Y))}catch{}},[K,Y,Z]);const[v,T]=u.useState(!1),[H,B]=u.useState(0),[y,x]=u.useState("asian_female"),[j,h]=u.useState("3:4"),[g,M]=u.useState("standing"),[b,F]=u.useState(!0),oe=u.useRef(null),ge=()=>{B(0),x("asian_female"),h("3:4"),M("standing"),F(!0),T(!0)},ue=async()=>{var ye;const w=$.find(m=>m.id===y);if(!w||!_[H])return;let te,ce=n("pipeline.stepUI.tryon.poseAuto");if(!c){if(b&&oe.current){const m=await oe.current.exportImage();if(m){const G=await fetch(m).then(Te=>Te.blob()),Q=new File([G],"pose.png",{type:"image/png"});te=(await nt.uploadImage(Q)).data.url}}ce=b?n("pipeline.stepUI.tryon.poseCustom"):g&&n(`poseEditor.pose.${g}`,((ye=ti.find(m=>m.id===g))==null?void 0:ye.name)||g)}R(m=>[...m,{id:`t${++na}`,productImage:_[H],modelId:w.id,modelImage:w.image,modelLabel:w.labelKey?n(w.labelKey):w.label||"",aspectRatio:j,poseName:ce,poseImageUrl:te}]),T(!1)},Ne=()=>{if(Y.length===0)return;const w=Y.map(te=>({productImageIndex:Math.max(0,_.indexOf(te.productImage)),modelImageUrl:te.modelImage,poseImageUrl:te.poseImageUrl,aspectRatio:te.as
55pectRatio}));console.log("[TryOnStep] generate tasks:",w.length,w),a(i.id,"generate",{tasks:w})},ke=(w,te)=>{const ce=`/api/v1/image/download?url=${encodeURIComponent(w)}`,ye=document.createElement("a");ye.href=ce,ye.download=`${i.id}-${Date.now()}-${te+1}.png`,document.body.appendChild(ye),ye.click(),document.body.removeChild(ye)},qe=async()=>{var te;const w=await ne();if(w==="local")(te=q.current)==null||te.click();else if(w==="library"){const ce=await X("image","upload");ce&<(ce.url,ce.id)}},at=async w=>{if(w!=null&&w.length)try{const te=await nt.uploadImage(w[0]);lt(te.data.url,te.data.id)}catch{}},lt=async(w,te,ce,ye="upload")=>{ce=ce??n("pipeline.stepUI.tryon.customModelDefaultLabel");try{const m=await $e.createCustomModel({label:ce,imageUrl:w,imageAssetId:te,source:ye}),G={id:m.id,label:m.label,image:m.imageUrl,isCustom:!0};P(Q=>[...Q,G]),x(G.id)}catch{}},yt=async w=>{try{await $e.deleteCustomModel(w),P(te=>te.filter(ce=>ce.id!==w)),y===w&&x("asian_female")}catch{}},ft=async()=>{var w,te;if(!(!U.trim()||S)){D(!0);try{const ce=await Ve.post("/image/generate",{prompt:`Professional fashion model photo, ${U}, full body shot, standing pose, clean white studio background, professional lighting, 4K`,model:"nano-banana-pro",count:1,aspectRatio:"3:4"});for(let ye=0;ye<30;ye++){await new Promise(G=>setTimeout(G,3e3));const m=await Ve.get(`/image/task/${ce.data.taskId}`);if(m.data.status==="completed"&&((w=m.data.images)!=null&&w[0])){const G=((te=m.data.assetIds)==null?void 0:te[0])??void 0,Q=await $e.createCustomModel({label:U.slice(0,15)||n("pipeline.stepUI.tryon.aiModelDefaultLabel"),imageUrl:m.data.images[0],imageAssetId:G,source:"ai_generated"}),de={id:Q.id,label:Q.label,image:Q.imageUrl,isCustom:!0};P(Te=>[...Te,de]),x(de.id),f(!1),L("");break}if(m.data.status==="failed")break}}catch{}finally{D(!1)}}};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(pt,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),n(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:n(i.descKey)}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.tryon.taskListTitle",{action:d.actionVerb})}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:n("pipeline.stepUI.tryon.taskCount",{count:Y.length})})]}),Y.length===0?e.jsxs("div",{className:"rounded-xl border-2 border-dashed border-ui-border p-8 text-center",children:[e.jsx(pt,{className:"w-8 h-8 mx-auto mb-2 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:n("pipeline.stepUI.tryon.emptyTitle",{action:d.actionVerb})}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:c?n("pipeline.stepUI.tryon.emptyHintNoPose",{subject:d.subjectSingular}):n("pipeline.stepUI.tryon.emptyHintWithPose",{subject:d.subjectSingular})})]}):e.jsx("div",{className:"space-y-2",children:Y.map((w,te)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-ui-border bg-[var(--bg-secondary)]",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)] w-5 text-center",children:te+1}),e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-[var(--bg-tertiary)] shrink-0",children:e.jsx(pe,{url:w.productImage,alt:"",className:"w-full h-full object-cover"})}),e.jsx("span",{className:"text-[var(--text-tertiary)] text-xs",children:"+"}),e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-[var(--bg-tertiary)] shrink-0",children:e.jsx(pe,{url:w.modelImage,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-[var(--text-primary)] truncate",children:w.modelLabel}),e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:c?w.aspectRatio:`${w.poseName} · ${w.aspectRatio}`})]}),e.jsx("button",{onClick:()=>R(ce=>ce.filter(ye=>ye.id!==w.id)),className:"p-1 rounded-md hover:bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer transition-colors shrink-0",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},w.id))}),Y.length<6&&e.jsxs("button",{onClick:ge,className:"mt-3 w-full flex items-center justify-center gap-2 py-2.5 rounded-xl border border-dashed border-ui-border text-sm text-[var(--text-secondary)] hover:border-ui-accent/50 hover:text-ui-accent transition-all cursor-pointer",children:[e.jsx(we,{className:"w-4 h-4"})," ",n("pipeline.stepUI.tryon.addCombo",{action:d.actionVerb,count:Y.length})]}),Y.length>=6&&e.jsx("p",{className:"mt-2 text-xs text-[var(--text-tertiary)] text-center",children:n("pipeline.stepUI.tryon.maxReached")})]}),v&&e.jsxs("div",{className:"rounded-xl border border-ui-accent/30 bg-ui-accent/[0.03] p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.tryon.configTitle",{action:d.actionVerb})}),e.jsx("button",{onClick:()=>T(!1),className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer",children:e.jsx(Re,{className:"w-4 h-4"})})]}),_.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.tryon.selectProductImage")}),e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1",children:_.map((w,te)=>e.jsx("button",{onClick:()=>
55B(te),className:`w-14 h-14 rounded-lg overflow-hidden shrink-0 border-2 transition-all cursor-pointer ${H===te?"border-ui-accent ring-1 ring-ui-accent/30":"border-transparent hover:border-ui-border"}`,children:e.jsx(pe,{url:w,alt:"",className:"w-full h-full object-cover"})},te))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.tryon.selectModel")}),e.jsxs("div",{className:"grid grid-cols-4 sm:grid-cols-5 gap-2",children:[$.map(w=>{const te=w.labelKey?n(w.labelKey):w.label;return e.jsxs("button",{onClick:()=>x(w.id),className:`relative rounded-lg overflow-hidden transition-all cursor-pointer ${y===w.id?"ring-2 ring-ui-accent":"hover:ring-1 hover:ring-ui-border"}`,children:[e.jsx("div",{className:"aspect-[3/4] bg-[var(--bg-tertiary)]",children:e.jsx(pe,{url:w.image,alt:te,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"text-[10px] text-center py-0.5 bg-[var(--bg-secondary)] truncate px-1",children:te}),y===w.id&&e.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-ui-accent text-white flex items-center justify-center",children:e.jsx(fe,{className:"w-2.5 h-2.5"})}),w.isCustom&&e.jsx("button",{onClick:ce=>{ce.stopPropagation(),yt(w.id)},className:"absolute top-1 left-1 w-4 h-4 rounded-full bg-black/60 text-white flex items-center justify-center cursor-pointer",children:e.jsx(Re,{className:"w-2.5 h-2.5"})})]},w.id)}),e.jsxs("button",{onClick:()=>f(!0),className:"rounded-lg border border-dashed border-ui-border flex flex-col items-center justify-center aspect-[3/4] text-[var(--text-tertiary)] hover:text-ui-accent cursor-pointer text-[10px]",children:[e.jsx(Le,{className:"w-4 h-4 mb-0.5"}),n("pipeline.stepUI.tryon.aiGenerate")]}),e.jsxs("button",{onClick:qe,className:"rounded-lg border border-dashed border-ui-border flex flex-col items-center justify-center aspect-[3/4] text-[var(--text-tertiary)] hover:text-ui-accent cursor-pointer text-[10px]",children:[e.jsx(Rt,{className:"w-4 h-4 mb-0.5"}),n("pipeline.stepUI.tryon.upload")]})]})]}),z&&e.jsxs("div",{className:"rounded-lg border border-ui-accent/20 bg-[var(--bg-secondary)] p-3 space-y-2",children:[e.jsx("input",{type:"text",value:U,onChange:w=>L(w.target.value),placeholder:n("pipeline.stepUI.tryon.aiPromptPlaceholder"),className:"w-full px-3 py-1.5 rounded-lg bg-[var(--bg-primary)] border border-ui-border text-xs text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] focus:outline-none focus:border-ui-accent"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:ft,disabled:S||!U.trim(),className:"inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-lg bg-ui-accent text-white text-xs hover:opacity-90 disabled:opacity-50 cursor-pointer",children:[S?e.jsx(ee,{className:"w-3 h-3 animate-spin"}):e.jsx(Le,{className:"w-3 h-3"}),S?e.jsx("span",{children:n("pipeline.stepUI.tryon.generating")}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n("pipeline.common.generate")}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 opacity-70",children:[e.jsx(he,{className:"w-3 h-3"}),ia]})]})]}),e.jsx("button",{onClick:()=>f(!1),className:"text-xs text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer",children:n("pipeline.stepUI.tryon.cancel")})]})]}),!c&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-xs font-medium text-[var(--text-secondary)]",children:n("pipeline.stepUI.tryon.poseLabel")}),e.jsxs("button",{onClick:()=>F(!b),className:`text-[10px] px-2 py-0.5 rounded-md cursor-pointer transition-all flex items-center gap-1 ${b?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-tertiary)] hover:text-ui-accent"}`,children:[e.jsx(pi,{className:"w-3 h-3"})," ",n("pipeline.stepUI.tryon.poseEditor3D")]})]}),b?e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"h-[350px] rounded-lg border border-ui-border flex items-center justify-center",children:e.jsx(ee,{className:"w-5 h-5 animate-spin text-[var(--text-tertiary)]"})}),children:e.jsx(ta,{ref:oe,width:460,height:350})}):e.jsx("div",{className:"flex flex-wrap gap-1.5",children:ti.map(w=>e.jsx("button",{onClick:()=>M(w.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${g===w.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:n(`poseEditor.pose.${w.id}`,w.name)},w.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.tryon.outputSize")}),e.jsx("div",{className:"flex gap-1.5",children:ra.map(w=>e.jsx("button",{onClick:()=>h(w.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${j===w.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:w.label},w.id))})]}),e.jsxs("button",{onClick:ue,className:"w-full py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 cursor-pointer transition-all flex items-center justify-center gap-1.5",children:[e.jsx(we,{className:"w-4 h-4"})," ",n("pipeline.stepUI.tryon.addToList")]})]}),p==="completed"&&((ct=t==null?void 0:t.result)==null?void 0:ct.files)&&t.result.files.length>0&&e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-5",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-2 text-sm",children:[e.jsx(fe,{className:"w-4 h-4"})," ",n("pipeline.stepUI.tryon.fullResult",{count:t.result.files.length,noun:d.resultNoun}),t.creditsUsed!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[n("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),(()=>{const w=t.result.files,te=w.length<=2?420:w.length<=4?300:220;return e.jsx("div",{className:"flex flex-wrap gap-3",children:w.map((ce,ye)=>e.jsxs("div",{className:"relative group rounded-lg overflow-hidden cursor-zoom-in",onClick:()=>le(ce),children:[e.jsx(pe,{url:ce,alt:"",className:"block w-auto h-auto object-contain",style:{maxHeight:`${te}px`}}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors pointer-events-none"}),e.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1",children:[e.jsx("button",{type:"button",onClick:m=>{m.stopPropagation(),ke(ce,ye)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.tryon.download"),children:e.jsx(Fe,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:m=>{m.stopPropagation(),le(ce)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.tryon.zoomView"),children:e.jsx(gt,{className:"w-4 h-4"})})]})]},ye))})})()]}),p==="error"&&e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||n("pipeline.stepUI.tryon.generationFailed")]}),e.jsx("div",{className:"flex gap-3",children:p==="completed"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Ne,disabled:l||Y.length===0,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[k?e.jsx(ee,{className:"w-3 h-3 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3 h-3 inline mr-1"}),n(k?"pipeline.stepUI.tryon.generating":"pipeline.common.regenerate")]}),e.jsxs("button",{onClick:o,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[n("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]}):p==="error"?e.jsxs("button",{onClick:()=>a(i.id,"retry"),disabled:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[k?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.retry")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Ne,disabled:l||Y.length===0,className:"inline-flex items-center justify-center gap-1.5 px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[k?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(pt,{className:"w-4 h-4"}),e.jsx("span",{children:n("pipeline.stepUI.tryon.startGenerate",{count:Y.length})}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost*Y.length]})]}),!i.required&&e.jsxs("button",{onClick:()=>{a(i.id,"skip"),o()},disabled:l,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.skipNext")]})]})})]}),e.jsx("input",{ref:q,type:"file",accept:"image/*",className:"hidden",onChange:w=>{at(w.target.files),w.target.value=""}}),e.jsx(Pt,{open:V,onClose:()=>O(null),onLocal:()=>O("local"),onLibrary:()=>O("library")}),W,ie&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-8 cursor-zoom-out",onClick:()=>le(null),role:"dialog","aria-modal":"true",children:[e.jsx(pe,{url:ie,alt:"",onClick:w=>w.stopPropagation(),className:"max-w-[90vw] max-h-[90vh] object-contain cursor-default select-none rounded-lg shadow-2xl"}),e.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),le(null)},className:"absolute top-4 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/25 backdrop-blur text-white flex items-center justify-center cursor-pointer transition-colors","aria-label":n("pipeline.stepUI.tryon.close"),children:e.jsx(Re,{className:"w-5 h-5"})})]})]})}const la=[{id:"finger",labelKey:"pipeline.stepUI.wearing.fingerLabel",emoji:"ð"},{id:"wrist",labelKey:"pipeline.stepUI.wearing.wristLabel",emoji:"â"},{id:"neck",labelKey:"pipeline.stepUI.wearing.neckLabel",emoji:"ð¿"},{id:"ear",labelKey:"pipeline.stepUI.wearing.earLabel",emoji:"ð"}];function oa({stepDef:i,stepState:t,isLoading:r,onExecute:s,onNext:l}){var K,C,A;const{t:a}=re(),o=t==null?void 0:t.status,c=ae(_=>
55_.executingStepId)===i.id,d=((C=(K=t==null?void 0:t.result)==null?void 0:K.metadata)==null?void 0:C.aiSimulated)===!0,[p,I]=u.useState(["finger"]),N=_=>{I(E=>E.includes(_)?E.filter(P=>P!==_):[...E,_])},k=()=>{p.length!==0&&s(i.id,"generate",{bodyParts:p})};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:a(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:a(i.descKey)}),o==="completed"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",a("pipeline.stepUI.wearing.completedTitle")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[a("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),d&&e.jsx("div",{className:"mb-3 px-3 py-1.5 rounded-lg bg-[var(--warning)]/10 border border-[var(--warning)]/30 text-[var(--warning)] text-xs font-medium inline-block",children:a("pipeline.stepUI.wearing.aiSimulatedNote")}),((A=t==null?void 0:t.result)==null?void 0:A.files)&&t.result.files.length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:t.result.files.map((_,E)=>e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-[var(--bg-tertiary)]",children:[e.jsx("img",{src:_,alt:"",crossOrigin:xe(_),className:"w-full h-full object-cover"}),d&&e.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-0.5 rounded bg-[var(--warning)]/80 text-white text-[10px] font-medium",children:a("pipeline.stepUI.wearing.aiSimulatedBadge")})]},E))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:k,disabled:r,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",a("pipeline.common.regenerate")]}),e.jsxs("button",{onClick:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[a("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):o==="error"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--error)]/30 bg-[var(--error)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--error)] font-medium mb-2 flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",a("pipeline.common.error")]}),e.jsx("div",{className:"text-sm text-[var(--error)]",children:(t==null?void 0:t.error)||a("pipeline.common.unknownError")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>s(i.id,"retry"),disabled:r,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[r?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-4 h-4 inline mr-1"}),a("pipeline.common.retry")]})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:a("pipeline.stepUI.wearing.positionLabel")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:la.map(_=>e.jsxs("button",{onClick:()=>N(_.id),className:`p-4 rounded-xl border text-center transition-all cursor-pointer ${p.includes(_.id)?"border-ui-accent bg-ui-accent/10":"border-ui-border bg-[var(--bg-secondary)] hover:border-[var(--text-tertiary)]"}`,children:[e.jsx("div",{className:"text-2xl mb-1",children:_.emoji}),e.jsx("div",{className:`text-sm font-medium ${p.includes(_.id)?"text-ui-accent":"text-[var(--text-primary)]"}`,children:a(_.labelKey)})]},_.id))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:k,disabled:r||p.length===0,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[c?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(xi,{className:"w-4 h-4 inline mr-1"}),a("pipeline.stepUI.wearing.generateAction"),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{s(i.id,"skip"),l()},disabled:r,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",a("pipeline.common.skipNext")]})]})]})]})}const ca=[{id:"arm",labelKey:"pipeline.stepUI.swatch.armLabel",emoji:"ðª"},{id:"lips",labelKey:"pipeline.stepUI.swatch.lipsLabel",emoji:"ð"},{id:"eyes",labelKey:"pipeline.stepUI.swatch.eyesLabel",emoji:"ð"}];function da({stepDef:i,stepState:t,isLoading:r,onExecute:s,onNext:l}){var A,_,E;const{t:a}=re(),o=t==null?void 0:t.status,c=ae(P=>
55P.executingStepId)===i.id,d=((_=(A=t==null?void 0:t.result)==null?void 0:A.metadata)==null?void 0:_.aiSimulated)===!0,[p,I]=u.useState(["arm"]),[N,k]=u.useState(""),K=P=>{I(z=>z.includes(P)?z.filter(f=>f!==P):[...z,P])},C=()=>{p.length!==0&&s(i.id,"generate",{swatchModes:p,colorDesc:N.trim()||void 0})};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:a(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:a(i.descKey)}),o==="completed"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",a("pipeline.stepUI.swatch.completedTitle")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[a("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),d&&e.jsx("div",{className:"mb-3 px-3 py-1.5 rounded-lg bg-[var(--warning)]/10 border border-[var(--warning)]/30 text-[var(--warning)] text-xs font-medium inline-block",children:a("pipeline.stepUI.swatch.aiSimulatedNote")}),((E=t==null?void 0:t.result)==null?void 0:E.files)&&t.result.files.length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:t.result.files.map((P,z)=>e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-[var(--bg-tertiary)]",children:[e.jsx("img",{src:P,alt:"",crossOrigin:xe(P),className:"w-full h-full object-cover"}),d&&e.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-0.5 rounded bg-[var(--warning)]/80 text-white text-[10px] font-medium",children:a("pipeline.stepUI.swatch.aiSimulatedBadge")})]},z))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:C,disabled:r,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",a("pipeline.common.regenerate")]}),e.jsxs("button",{onClick:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[a("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):o==="error"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--error)]/30 bg-[var(--error)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--error)] font-medium mb-2 flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",a("pipeline.common.error")]}),e.jsx("div",{className:"text-sm text-[var(--error)]",children:(t==null?void 0:t.error)||a("pipeline.common.unknownError")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>s(i.id,"retry"),disabled:r,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[r?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-4 h-4 inline mr-1"}),a("pipeline.common.retry")]})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:a("pipeline.stepUI.swatch.modeLabel")}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:ca.map(P=>e.jsxs("button",{onClick:()=>K(P.id),className:`p-4 rounded-xl border text-center transition-all cursor-pointer ${p.includes(P.id)?"border-ui-accent bg-ui-accent/10":"border-ui-border bg-[var(--bg-secondary)] hover:border-[var(--text-tertiary)]"}`,children:[e.jsx("div",{className:"text-2xl mb-1",children:P.emoji}),e.jsx("div",{className:`text-sm font-medium ${p.includes(P.id)?"text-ui-accent":"text-[var(--text-primary)]"}`,children:a(P.labelKey)})]},P.id))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-2",children:[a("pipeline.stepUI.swatch.colorDescLabel")," ",e.jsx("span",{className:"text-[var(--text-tertiary)] font-normal",children:a("pipeline.stepUI.swatch.optional")})]}),e.jsx("input",{type:"text",value:N,onChange:P=>k(P.target.value),placeholder:a("pipeline.stepUI.swatch.colorDescPlaceholder"),className:"w-full px-4 py-3 rounded-xl border border-ui-border bg-[var(--bg-secondary)] text-[var(--text-primary)] text-sm placeholder:text-[var(--text-tertiary)] focus:outline-none focus:border-ui-accent transition-colors"})]}),e.jsx("div",{className:"px-4 py-3 rounded-lg bg-[var(--warning)]/5 border border-[var(--warning)]/20 text-[var(--warning)] text-xs",children:a("pipeline.stepUI.swatch.notice")}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:C,disabled:r||p.length===0,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[c?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(Et,{className:"w-4 h-4 inline mr-1"}),a("pipeline.stepUI.swatch.generateAction"),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{s(i.id,"skip"),l()},disabled:r,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",a("pipeline.common.skipNext")]})]})]})]})}const pa=[{id:"front",labelKey:"pipeline.stepUI.angles.frontLabel"},{id:"back",labelKey:"pipeline.stepUI.angles.backLabel"},{id:"side",labelKey:"pipeline.stepUI.angles.sideLabel"},{id:"angle45",labelKey:"pipeline.stepUI.angles.angle45Label"},{id:"top",labelKey:"pipeline.stepUI.angles.topLabel"}];function ma({stepDef:i,stepState:t,isLoading:r,onExecute:s,onNext:l}){var P,z,f;const{t:a}=re(),o=t==null?void 0:t.status,c=ae(U=>
55U.executingStepId)===i.id,d=((z=(P=t==null?void 0:t.result)==null?void 0:P.metadata)==null?void 0:z.aiSimulated)===!0,[p,I]=u.useState("generate"),[N,k]=u.useState(["front","side","back"]),K=U=>{k(L=>L.includes(U)?L.filter(S=>S!==U):[...L,U])},C=()=>{if(p==="generate"){if(N.length===0)return;s(i.id,"generate",{mode:"generate",angles:N})}},[A,_]=u.useState(!1),E=async U=>{const L=U.target.files;if(!(!L||L.length===0)){_(!0);try{const D=(await Promise.all(Array.from(L).map(q=>nt.uploadImage(q)))).map(q=>q.data.url);s(i.id,"generate",{mode:"upload",files:D})}catch(S){console.error("Upload failed:",S)}finally{_(!1)}}};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:a(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:a(i.descKey)}),o==="completed"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",a("pipeline.stepUI.angles.completedTitle")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[a("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),d&&e.jsx("div",{className:"mb-3 px-3 py-1.5 rounded-lg bg-[var(--warning)]/10 border border-[var(--warning)]/30 text-[var(--warning)] text-xs font-medium inline-block",children:a("pipeline.stepUI.angles.aiSimulatedNote")}),((f=t==null?void 0:t.result)==null?void 0:f.files)&&t.result.files.length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:t.result.files.map((U,L)=>e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-[var(--bg-tertiary)]",children:[e.jsx("img",{src:U,alt:"",crossOrigin:xe(U),className:"w-full h-full object-cover"}),d&&e.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-0.5 rounded bg-[var(--warning)]/80 text-white text-[10px] font-medium",children:a("pipeline.stepUI.angles.aiSimulatedBadge")})]},L))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:C,disabled:r,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",a("pipeline.common.regenerate")]}),e.jsxs("button",{onClick:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[a("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):o==="error"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--error)]/30 bg-[var(--error)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--error)] font-medium mb-2 flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",a("pipeline.common.error")]}),e.jsx("div",{className:"text-sm text-[var(--error)]",children:(t==null?void 0:t.error)||a("pipeline.common.unknownError")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>s(i.id,"retry"),disabled:r,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[r?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-4 h-4 inline mr-1"}),a("pipeline.common.retry")]})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:a("pipeline.stepUI.angles.modeLabel")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>I("generate"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${p==="generate"?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:a("pipeline.stepUI.angles.modeAi")}),e.jsx("button",{onClick:()=>I("upload"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${p==="upload"?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:a("pipeline.stepUI.angles.modeUpload")})]})]}),p==="generate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:a("pipeline.stepUI.angles.anglesLabel")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:pa.map(U=>e.jsx("button",{onClick:()=>K(U.id),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${N.includes(U.id)?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:a(U.labelKey)},U.id))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:C,disabled:r||N.length===0,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[c?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(ci,{className:"w-4 h-4 inline mr-1"}),a("pipeline.stepUI.angles.generateAngles"),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{s(i.id,"skip"),l()},disabled:r,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",a("pipeline.common.skipNext")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:a("pipeline.stepUI.angles.uploadLabel")}),e.jsxs("label",{className:`block ${A?"pointer-events-none opacity-60":"cursor-pointer"}`,children:[e.jsxs("div",{className:"rounded-xl border-2 border-dashed border-ui-border bg-[var(--bg-secondary)] p-8 text-center hover:border-ui-accent transition-colors",children:[A?e.jsx(ee,{className:"w-10 h-10 mx-auto mb-2 text-ui-accent animate-spin"}):e.jsx(Rt,{className:"w-10 h-10 mx-auto mb-2 text-[var(--text-tertiary)]"}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)]",children:A?`${a("pipeline.common.uploading")}...`:a("pipeline.stepUI.angles.clickToSelect")}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:a("pipeline.stepUI.angles.selectMultiple")}
55)]}),e.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:E,disabled:A,className:"hidden"})]})]}),!i.required&&e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>{s(i.id,"skip"),l()},disabled:r,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",a("pipeline.common.skipNext")]})})]})]})]})}const ii=[{id:"pure_white",labelKey:"pipeline.stepUI.productHero.presets.3c.pure_white",prompt:"pure seamless white studio background, product floating with soft ambient shadow directly underneath, minimal clean aesthetic, commercial product photography, 3-point softbox lighting filling product, no environment, no people, product fills 85% of frame"},{id:"deep_space",labelKey:"pipeline.stepUI.productHero.presets.3c.deep_space",prompt:"matte black seamless studio backdrop, dramatic rim lighting highlighting product edges, premium tech product showcase, subtle cool blue glow behind, cinematic high-end advertisement, no environment, no people, product fills 85% of frame"},{id:"gradient_cyber",labelKey:"pipeline.stepUI.productHero.presets.3c.gradient_cyber",prompt:"abstract purple-to-blue gradient background with subtle noise texture, floating product with colored rim light, futuristic cyberpunk aesthetic, neon accent reflections on product surface, no environment, no people"},{id:"mirror_reflection",labelKey:"pipeline.stepUI.productHero.presets.3c.mirror_reflection",prompt:"polished glossy surface with product reflection below, subtle studio fog, deep black upper half with gradient to reflective floor, hero shot for premium electronics, no environment, no people"},{id:"particle_light",labelKey:"pipeline.stepUI.productHero.presets.3c.particle_light",prompt:"dark gradient background with glowing dust particles and volumetric light rays, product as centerpiece with soft blue glow, dramatic tech advertisement style, no environment, no people"},{id:"product_array",labelKey:"pipeline.stepUI.productHero.presets.3c.product_array",prompt:"multiple identical product units arranged in a clean repeating pattern on minimal gradient background, commercial tech display photography, flat-lay or isometric view, no environment, no people"},{id:"hologram_blue",labelKey:"pipeline.stepUI.productHero.presets.3c.hologram_blue",prompt:"dark moody studio with cyan teal holographic glow behind product, sci-fi aesthetic, thin light grid pattern on floor, premium gadget showcase, no environment, no people"},{id:"lab_clean",labelKey:"pipeline.stepUI.productHero.presets.3c.lab_clean",prompt:"bright clean laboratory background with subtle hexagon pattern on wall, soft clinical white lighting, product centered, precision engineering aesthetic, no environment, no people, product fills 80% of frame"}],ua=[{id:"pink_halo",labelKey:"pipeline.stepUI.productHero.presets.beauty.pink_halo",prompt:"soft pink-to-peach gradient background with glowing bokeh halo behind product, dreamy feminine beauty advertisement, soft romantic lighting, no environment, no people, product fills 80% of frame"},{id:"luxury_gold",labelKey:"pipeline.stepUI.productHero.presets.beauty.luxury_gold",prompt:"deep gold satin silk fabric backdrop with subtle wrinkles and reflective highlights, luxury beauty campaign, warm amber glow, high-end cosmetic advertisement, no environment, no people"},{id:"mirror_water",labelKey:"pipeline.stepUI.productHero.presets.beauty.mirror_water",prompt:"glossy wet reflective surface with scattered crystal clear water droplets, product floating above, dewy fresh beauty aesthetic, soft blue cool tones, no environment, no people"},{id:"botanical_leaf",labelKey:"pipeline.stepUI.productHero.presets.beauty.botanical_leaf",prompt:"soft green eucalyptus leaves and delicate branches arranged around product, natural botanical skincare aesthetic, soft daylight, clean white marble surface, no environment, no people"},{id:"marble_rose",labelKey:"pipeline.stepUI.productHero.presets.beauty.marble_rose",prompt:"polished pink Portoro marble surface with subtle white veins, product placed on stone with soft rose petal scattering, luxury spa aesthetic, warm natural lighting, no environment, no people"},{id:"pearl_shimmer",labelKey:"pipeline.stepUI.productHero.presets.beauty.pearl_shimmer",prompt:"pearl white gradient background with subtle iridescent shimmer dust particles, soft shimmering light reflections, high-end luxury beauty hero shot, no environment, no people"}],xa=[{id:"appetite_glow",labelKey:"pipeline.stepUI.productHero.presets.food.appetite_glow",prompt:"warm orange-to-red gradient background with soft golden glow behind food product, appetizing commercial food photography, enhances hunger cue, no environment, no people, product fills 80% of frame"},{id:"black_kraft",labelKey:"pipeline.stepUI.productHero.presets.food.black_kraft",prompt:"textured matte black kraft paper backdrop with subtle grain, high-end food advertisement, dramatic side lighting, premium packaged food showcase, no environment, no people"},{id:"wood_board",labelKey:"pipeline.stepUI.productHero.presets.food.wood_board",prompt:"rustic natural oak wood cutting board surface, warm homemade aesthetic, soft diffused daylight, artisanal bakery aesthetic, no environment, no people"},{id:"white_porcelain",labelKey:"pipeline.stepUI.productHero.presets.food.white_porcelain",prompt:"pristine white fine-bone porcelain plate as backdrop with soft shadow, fine-dining restaurant aesthetic, clean minimal gourmet presentation, overhead soft daylight, no environment, no people"},{id:"watercolor_hand",labelKey:"pipeline.stepUI.productHero.presets.food.watercolor_hand",prompt:"artistic watercolor paper backdrop with soft pastel washes and hand-drawn illustration elements around product, gourmet illustration style, boutique food brand aesthetic, no environment, no people"},{id:"oil_painting",labelKey:"pipeline.stepUI.productHero.presets.food.oil_painting",prompt:"classical oil-painting-style dark moody background with rich color tones like Dutch still life, product lit with single directional light, luxurious gourmet artistry, no environment, no people"}],ha=[{id:"nordic_white",labelKey:"pipeline.stepUI.productHero.presets.home.nordic_white",prompt:"clean white background with subtle light beige gradient, minimal Scandinavian ae
55sthetic, soft natural daylight, one plant or wooden prop in corner, no environment, no people, product fills 80% of frame"},{id:"wood_warm",labelKey:"pipeline.stepUI.productHero.presets.home.wood_warm",prompt:"warm natural oak wood background with soft grain visible, cozy homely aesthetic, golden afternoon lighting, slight earth-tone accent, no environment, no people"},{id:"bw_minimal",labelKey:"pipeline.stepUI.productHero.presets.home.bw_minimal",prompt:"pure seamless white backdrop with strong black shadows, high-contrast monochrome editorial style, sharp minimalist interior design magazine aesthetic, no environment, no people"},{id:"japanese_zen",labelKey:"pipeline.stepUI.productHero.presets.home.japanese_zen",prompt:"neutral beige tatami-tone background with subtle paper texture, soft diffused natural light, zen minimalist wabi-sabi aesthetic, hint of bamboo element, no environment, no people"},{id:"industrial",labelKey:"pipeline.stepUI.productHero.presets.home.industrial",prompt:"matte concrete gray backdrop with subtle texture, exposed minimal aesthetic, dramatic directional lighting, loft industrial photography, raw architectural mood, no environment, no people"},{id:"cream_cozy",labelKey:"pipeline.stepUI.productHero.presets.home.cream_cozy",prompt:"soft cream-ivory gradient background with warm diffused glow, cozy luxury aesthetic, subtle silk texture, contemporary high-end residential photography, no environment, no people"}],ga=[{id:"velvet_black",labelKey:"pipeline.stepUI.productHero.presets.jewelry.velvet_black",prompt:"deep black velvet fabric backdrop with subtle pile texture, luxury jewelry box interior aesthetic, dramatic spotlight highlighting gemstone sparkle, high-end Tiffany-style product photography, no environment, no people, jewelry fills 70% of frame"},{id:"silk_sheet",labelKey:"pipeline.stepUI.productHero.presets.jewelry.silk_sheet",prompt:"cream or blush pink silk fabric draped smoothly as backdrop with soft folds, luxury dressing ambiance, soft diffused daylight, haute joaillerie aesthetic, no environment, no people"},{id:"jade_tray",labelKey:"pipeline.stepUI.productHero.presets.jewelry.jade_tray",prompt:"polished white jade or alabaster stone tray as display surface, museum-quality precious gem presentation, minimal clean tabletop, soft museum spotlight, no environment, no people"},{id:"mirror_luxury",labelKey:"pipeline.stepUI.productHero.presets.jewelry.mirror_luxury",prompt:"highly polished reflective dark surface with perfect mirror reflection of jewelry, art gallery installation aesthetic, subtle gradient shadow, minimal luxury brand showcase, no environment, no people"},{id:"star_bokeh",labelKey:"pipeline.stepUI.productHero.presets.jewelry.star_bokeh",prompt:"dark deep blue background with tiny glowing bokeh star particles, cosmic ethereal aesthetic, dramatic lighting on jewelry with sparkle effect, high-end celestial advertisement, no environment, no people"},{id:"gift_box",labelKey:"pipeline.stepUI.productHero.presets.jewelry.gift_box",prompt:"opened luxury jewelry gift box interior with ivory satin lining and gold embossed logo, romantic gift presentation, soft directional warm light, Valentine or proposal context, no environment, no people"}];function ba(i){switch(i){case"3c":return ii;case"beauty":return ua;case"food":return xa;case"home":return ha;case"jewelry":return ga;default:return i&&console.warn(`[ProductHeroStep] no HERO_STYLES defined for category="${i}", falling back to 3C`),ii}}const ya=[{id:"1:1",label:"1:1"},{id:"3:4",label:"3:4"},{id:"4:3",label:"4:3"},{id:"9:16",label:"9:16"}];let fa=0;function va({stepDef:i,stepState:t,allStepStates:r,category:s,isLoading:l,onExecute:a,onNext:o}){var v,T,H,B;const{t:n}=re(),c=ba(s),d=((v=c[0])==null?void 0:v.id)||"pure_white",p=t==null?void 0:t.status,I=ae(y=>y.executingStepId),N=ae(y=>y.project),k=I===i.id,K=N?`pipeline-hero-tasks:${N.id}`:null,C=Ae[i.id]||Le,A=r.find(y=>y.id==="removebg"),_=r.find(y=>y.id==="upload"),E=((A==null?void 0:A.status)==="completed"?(T=A==null?void 0:A.result)==null?void 0:T.files:[])||[],P=((_==null?void 0:_.status)==="completed"?(H=_==null?void 0:_.result)==null?void 0:H.files:[])||[],z=[...E,...P],[f,U]=u.useState([]),[L,S]=u.useState(!1);u.useEffect(()=>{if(!(!K||L)){try{const y=localStorage.getItem(K);if(y){const x=JSON.parse(y);Array.isArray(x)&&U(x)}}catch{}S(!0)}},[K,L]),u.useEffect(()=>{if(!(!K||!L))try{f.length===0?localStorage.removeItem(K):localStorage.setItem(K,JSON.stringify(f))}catch{}},[K,f,L]);const[D,q]=u.useState(null);u.useEffect(()=>{if(!D)return;const y=j=>{j.key==="Escape"&&q(null)};document.addEventListener("keydown",y);const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",y),document.body.style.overflow=x}},[D]);const[X,W]=u.useState(!1),[ne,V]=u.useState(0),[O,$]=u.useState(d),[Y,R]=u.useState("1:1"),ie=()=>{V(0),$(d),R("1:1"),W(!0)},le=()=>{const y=c.find(j=>j.id===O),x=z[ne];!y||!x||(U(j=>[...j,{id:`h${++fa}_${Date.now()}
55`,inputImage:x,styleId:y.id,styleLabel:y.labelKey?n(y.labelKey):y.label||"",stylePrompt:y.prompt,aspectRatio:Y}]),W(!1))},Z=()=>{if(f.length===0)return;const y=f.map(x=>({inputImage:x.inputImage,inputKind:"product",sceneId:x.styleId,sceneLabel:x.styleLabel,scenePrompt:x.stylePrompt,lightingId:"",lightingPrompt:"",aspectRatio:x.aspectRatio}));a(i.id,"generate",{tasks:y})},be=(y,x)=>{const j=`/api/v1/image/download?url=${encodeURIComponent(y)}`,h=document.createElement("a");h.href=j,h.download=`${i.id}-${Date.now()}-${x+1}.png`,document.body.appendChild(h),h.click(),document.body.removeChild(h)};return e.jsxs("div",{className:"max-w-[1080px] mx-auto",children:[e.jsxs("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:[e.jsx(C,{className:"w-5 h-5 inline mr-2 -mt-0.5"}),n(i.nameKey)]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-5",children:n(i.descKey)}),z.length===0?e.jsxs("div",{className:"rounded-xl border-2 border-dashed border-ui-border p-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:n("pipeline.stepUI.productHero.noProductImages")}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:n("pipeline.stepUI.productHero.noProductImagesHint")})]}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.productHero.taskListTitle")}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:n("pipeline.stepUI.productHero.taskCount",{count:f.length})})]}),f.length===0?e.jsxs("div",{className:"rounded-xl border-2 border-dashed border-ui-border p-8 text-center",children:[e.jsx(Le,{className:"w-8 h-8 mx-auto mb-2 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:n("pipeline.stepUI.productHero.emptyTitle")}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:n("pipeline.stepUI.productHero.emptyHint")})]}):e.jsx("div",{className:"space-y-2",children:f.map((y,x)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-ui-border bg-[var(--bg-secondary)]",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)] w-5 text-center",children:x+1}),e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden bg-[var(--bg-tertiary)] shrink-0",children:e.jsx(pe,{url:y.inputImage,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-[var(--text-primary)] truncate",children:y.styleLabel}),e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)]",children:y.aspectRatio})]}),e.jsx("button",{onClick:()=>U(j=>j.filter(h=>h.id!==y.id)),className:"p-1 rounded-md hover:bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] hover:text-[var(--error)] cursor-pointer transition-colors shrink-0",children:e.jsx(Ke,{className:"w-3.5 h-3.5"})})]},y.id))}),f.length<8&&e.jsxs("button",{onClick:ie,className:"mt-3 w-full flex items-center justify-center gap-2 py-2.5 rounded-xl border border-dashed border-ui-border text-sm text-[var(--text-secondary)] hover:border-ui-accent/50 hover:text-ui-accent transition-all cursor-pointer",children:[e.jsx(we,{className:"w-4 h-4"})," ",n("pipeline.stepUI.productHero.addCombo",{count:f.length})]}),f.length>=8&&e.jsx("p",{className:"mt-2 text-xs text-[var(--text-tertiary)] text-center",children:n("pipeline.stepUI.productHero.maxReached")})]}),X&&e.jsxs("div",{className:"rounded-xl border border-ui-accent/30 bg-ui-accent/[0.03] p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:n("pipeline.stepUI.productHero.configTitle")}),e.jsx("button",{onClick:()=>W(!1),className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] cursor-pointer",children:e.jsx(Re,{className:"w-4 h-4"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.productHero.selectProductImage")}),e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1",children:z.map((y,x)=>e.jsx("button",{onClick:()=>
55V(x),className:`relative w-14 h-14 rounded-lg overflow-hidden shrink-0 border-2 transition-all cursor-pointer ${ne===x?"border-ui-accent ring-1 ring-ui-accent/30":"border-transparent hover:border-ui-border"}`,children:e.jsx(pe,{url:y,alt:"",className:"w-full h-full object-cover"})},x))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.productHero.styleLabel")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:c.map(y=>{const x=y.labelKey?n(y.labelKey):y.label;return e.jsxs("button",{onClick:()=>$(y.id),className:`relative rounded-lg transition-all cursor-pointer overflow-hidden text-left ${O===y.id?"ring-2 ring-ui-accent":"hover:ring-1 hover:ring-ui-border"}`,children:[e.jsx("div",{className:"aspect-[4/3] bg-gradient-to-br from-[var(--bg-tertiary)] to-[var(--bg-secondary)] flex items-center justify-center",children:e.jsx(Le,{className:"w-5 h-5 text-[var(--text-tertiary)]"})}),e.jsx("div",{className:"text-[11px] font-medium text-center py-1 bg-[var(--bg-secondary)] truncate px-1",children:x}),O===y.id&&e.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-ui-accent text-white flex items-center justify-center",children:e.jsx(fe,{className:"w-2.5 h-2.5"})})]},y.id)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--text-secondary)] mb-2",children:n("pipeline.stepUI.productHero.outputAspect")}),e.jsx("div",{className:"flex gap-1.5",children:ya.map(y=>e.jsx("button",{onClick:()=>R(y.id),className:`px-3 py-1 rounded-md text-xs cursor-pointer transition-all ${Y===y.id?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:y.label},y.id))})]}),e.jsxs("button",{onClick:le,className:"w-full py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 cursor-pointer transition-all flex items-center justify-center gap-1.5",children:[e.jsx(we,{className:"w-4 h-4"})," ",n("pipeline.stepUI.productHero.addToList")]})]}),p==="completed"&&((B=t==null?void 0:t.result)==null?void 0:B.files)&&t.result.files.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium flex items-center gap-2 text-sm",children:[e.jsx(fe,{className:"w-4 h-4"})," ",n("pipeline.stepUI.productHero.fullResult",{count:t.result.files.length}),t.creditsUsed!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[n("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),(()=>{const y=t.result.files,x=y.length<=2?420:y.length<=4?300:220;return e.jsx("div",{className:"flex flex-wrap gap-3",children:y.map((j,h)=>e.jsxs("div",{className:"relative group rounded-lg overflow-hidden cursor-zoom-in",onClick:()=>q(j),children:[e.jsx(pe,{url:j,alt:"",className:"block w-auto h-auto object-contain",style:{maxHeight:`${x}px`}}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors pointer-events-none"}),e.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1",children:[e.jsx("button",{type:"button",onClick:g=>{g.stopPropagation(),be(j,h)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.productHero.download"),children:e.jsx(Fe,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:g=>{g.stopPropagation(),q(j)},className:"w-8 h-8 rounded-lg bg-black/60 hover:bg-black/80 text-white flex items-center justify-center cursor-pointer",title:n("pipeline.stepUI.productHero.zoomView"),children:e.jsx(gt,{className:"w-4 h-4"})})]})]},h))})})()]}),p==="error"&&e.jsxs("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 text-sm text-[var(--error)] flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 shrink-0"}),(t==null?void 0:t.error)||n("pipeline.stepUI.productHero.generationFailed")]}),e.jsx("div",{className:"flex gap-3",children:p==="completed"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Z,disabled:l||f.length===0,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[k?e.jsx(ee,{className:"w-3 h-3 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3 h-3 inline mr-1"}),n(k?"pipeline.stepUI.productHero.generating":"pipeline.common.regenerate")]}),e.jsxs("button",{onClick:o,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[n("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]}):p==="error"?e.jsxs("button",{onClick:()=>a(i.id,"retry"),disabled:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[k?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.retry")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Z,disabled:l||f.length===0,className:"inline-flex items-center justify-center gap-1.5 px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[k?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(C,{className:"w-4 h-4"}),e.jsx("span",{children:n("pipeline.stepUI.productHero.startGenerate",{count:f.length})}),e.jsxs("span",{className:"inline-flex items-center gap-0.5 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost*f.length]})]}),!i.required&&e.jsxs("button",{onClick:()=>{a(i.id,"skip"),o()},disabled:l,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",n("pipeline.common.skipNext")]})]})})]}),D&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center cursor-zoom-out p-4",onClick:()=>q(null),children:[e.jsx(pe,{url:D,alt:"",className:"max-w-full max-h-full object-contain",onClick:y=>y.stopPropagation()}),e.jsx("button",{onClick:()=>q(null),className:"absolute top-4 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center cursor-pointer",children:e.jsx(Re,{className:"w-5 h-5"})})]})]})}const si={clothing:[{id:"model_walk",labelKey:"pipeline.stepUI.video.types.clothing.model_walk.label",descriptionKey:"pipeline.stepUI.video.types.clothing.model_walk.description"},{id:"rotation",labelKey:"pipeline.stepUI.video.types.clothing.rotation.label",descriptionKey:"pipeline.stepUI.video.types.clothing.rotation.description"},{id:"showcase",labelKey:"pipeline.stepUI.video.types.clothing.showcase.label",descriptionKey:"pipeline.stepUI.video.types.clothing.showcase.description"}],"3c":[{id:"rotation",labelKey:"pipeline.stepUI.video.types.3c.rotation.label",descriptionKey:"pipeline.stepUI.video.types.3c.rotation.description"},{id:"showcase",labelKey:"pipeline.stepUI.video.types.3c.showcase.label",descriptionKey:"pipeline.stepUI.video.types.3c.showcase.description"},{id:"unboxing",labelKey:"pipeline.stepUI.video.types.3c.unboxing.label",descriptionKey:"pipeline.stepUI.video.types.3c.unboxing.description"}],beauty:[{id:"swatch_process",labelKey:"pipeline.stepUI.video.types.beauty.swatch_process.label",descriptionKey:"pipeline.stepUI.video.types.beauty.swatch_process.description"},{id:"showcase",labelKey:"pipeline.stepUI.video.types.beauty.showcase.label",descriptionKey:"pipeline.stepUI.video.types.beauty.showcase.description"},{id:"rotation",labelKey:"pipeline.stepUI.video.types.beauty.rotation.label",descriptionKey:"pipeline.stepUI.video.types.beauty.rotation.description"}],food:[{id:"food_serving",labelKey:"pipeline.stepUI.video.types.food.food_serving.label",descriptionKey:"pipeline.stepUI.video.types.food.food_serving.description"},{id:"showcase",labelKey:"pipeline.stepUI.video.types.food.showcase.label",descriptionKey:"pipeline.stepUI.video.types.food.showcase.description"},{id:"unboxing",labelKey:"pipeline.stepUI.video.types.food.unboxing.label",descriptionKey:"pipeline.stepUI.video.types.food.unboxing.description"}],home:[{id:"room_tour",labelKey:"pipeline.stepUI.video.types.home.room_tour.label",descriptionKey:"pipeline.stepUI.video.types.home.room_tour.description"},{id:"showcase",labelKey:"pipeline.stepUI.video.types.home.showcase.label",descriptionKey:"pipeline.stepUI.video.types.home.showcase.description"},{id:"rotation",labelKey:"pipeline.stepUI.video.types.home.rotation.label",descriptionKey:"pipeline.stepUI.video.types.home.rotation.description"}],jewelry:[{id:"jewelry_sparkle",labelKey:"pipeline.stepUI.video.types.jewelry.jewelry_sparkle.label",descriptionKey:"pipeline.stepUI.video.types.jewelry.jewelry_sparkle.description"},{id:"rotation",labelKey:"pipeline.stepUI.video.types.jewelry.rotation.label",descriptionKey:"pipeline.stepUI.video.types.jewelry.rotation.description"},{id:"showcase",labelKey:"pipeline.stepUI.video.types.jewelry.showcase.label",descriptionKey:"pipeline.stepUI.video.types.jewelry.showcase.description"}]},ja=[{id:"showcase",labelKey:"pipeline.stepUI.video.types.default.showcase.label",descriptionKey:"pipeline.stepUI.video.types.default.showcase.description"},{id:"rotation",labelKey:"pipeline.stepUI.video.types.default.rotation.label",descriptionKey:"pipeline.stepUI.video.types.default.rotation.description"}];function wa(i,t){return i==="rotate"?[{id:"rotation",labelKey:"pipeline.stepUI.video.types.rotate.rotation.label",descriptionKey:"pipeline.stepUI.video.types.rotate.rotation.description"}]:i==="unbox"?[{id:"unboxing",labelKey:"pipeline.stepUI.video.types.unbox.unboxing.label",descriptionKey:"pipeline.stepUI.video.types.unbox.unboxing.description"}]:t&&si[t]?si[t]:ja}const Na=[{value:5,label:"5s"},{value:10,label:"10s"},{value:15,label:"15s"}],ka=[{value:"1:1",label:"1:1"},{value:"9:16",label:"9:16"},{value:"16:9",label:"16:9"}],Ia=[{value:"silent",labelKey:"pipeline.stepUI.video.audio.silent"},{value:"bgm",labelKey:"pipeline.stepUI.video.audio.bgm"},{value:"narration",labelKey:"pipeline.stepUI.video.audio.narration",hintKey:"pipeline.stepUI.video.audio.narrationRequiresDesc"}
55];function ri(i){return/\.(mp4|webm|mov)(\?|$)/i.test(i)}function _a({stepDef:i,stepState:t,category:r,isLoading:s,onExecute:l,onNext:a}){var L,S,D,q,X,W,ne,V,O;const{t:o}=re(),n=t==null?void 0:t.status,d=ae($=>$.executingStepId)===i.id,p=wa(i.id,r),I=i.id==="rotate"||i.id==="unbox",N=(S=(L=t==null?void 0:t.result)==null?void 0:L.metadata)==null?void 0:S.videoUrl,k=Ae[i.id]||ai,[K,C]=u.useState(((D=p[0])==null?void 0:D.id)||"showcase"),[A,_]=u.useState(5),[E,P]=u.useState("1:1"),[z,f]=u.useState("silent"),U=()=>{l(i.id,"generate",{videoType:K,duration:A,aspectRatio:E,audioMode:z})};return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:o(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:o(i.descKey)}),n==="active"&&((X=(q=t==null?void 0:t.result)==null?void 0:q.metadata)==null?void 0:X.processing)&&e.jsxs("div",{className:"rounded-xl border border-ui-accent/30 bg-ui-accent/5 p-6 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(ee,{className:"w-5 h-5 text-ui-accent animate-spin"}),e.jsx("span",{className:"text-ui-accent font-medium",children:o("pipeline.stepUI.video.processingTitle")})]}),e.jsx("p",{className:"text-sm opacity-60",children:t.result.metadata.message||o("pipeline.stepUI.video.processingDefault")}),e.jsx("p",{className:"text-xs opacity-40 mt-2",children:o("pipeline.stepUI.video.taskId",{id:t.result.metadata.taskId})})]}),n==="completed"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",o("pipeline.stepUI.video.completedTitle")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[o("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),N&&ri(N)?e.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-black",children:e.jsx("video",{src:N,controls:!0,className:"w-full h-full object-contain",poster:(ne=(W=t==null?void 0:t.result)==null?void 0:W.metadata)==null?void 0:ne.coverUrl})}):(V=t==null?void 0:t.result)!=null&&V.files&&t.result.files.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:t.result.files.map(($,Y)=>ri($)?e.jsx("div",{className:"relative aspect-video rounded-lg overflow-hidden bg-black",children:e.jsx("video",{src:$,controls:!0,crossOrigin:xe($),className:"w-full h-full object-contain"})},Y):e.jsxs("div",{className:"relative aspect-video rounded-lg overflow-hidden bg-black",children:[e.jsx("img",{src:$,alt:"",crossOrigin:xe($),className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"w-14 h-14 rounded-full bg-white/20 backdrop-blur-sm flex items-center justify-center",children:e.jsx(Li,{className:"w-6 h-6 text-white ml-0.5"})})})]},Y))}):null,((O=t==null?void 0:t.result)==null?void 0:O.metadata)&&e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[t.result.metadata.duration&&e.jsxs("span",{className:"px-2 py-0.5 rounded bg-[var(--bg-tertiary)] text-xs text-[var(--text-secondary)]",children:[t.result.metadata.duration,"s"]}),t.result.metadata.aspectRatio&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-[var(--bg-tertiary)] text-xs text-[var(--text-secondary)]",children:t.result.metadata.aspectRatio}),t.result.metadata.audioMode&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-[var(--bg-tertiary)] text-xs text-[var(--text-secondary)]",children:t.result.metadata.audioMode})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:U,disabled:s,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",o("pipeline.common.regenerate")]}),e.jsxs("button",{onClick:a,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[o("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):n==="error"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--error)]/30 bg-[var(--error)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--error)] font-medium mb-2 flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",o("pipeline.common.error")]}),e.jsx("div",{className:"text-sm text-[var(--error)]",children:(t==null?void 0:t.error)||o("pipeline.common.unknownError")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>l(i.id,"retry"),disabled:s,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[s?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-4 h-4 inline mr-1"}),o("pipeline.common.retry")]})})]}):e.jsxs("div",{className:"space-y-6",children:[!I&&p.length>1&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.video.typeLabel")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:p.map($=>e.jsxs("button",{onClick:()=>C($.id),className:`p-4 rounded-xl border text-left transition-all cursor-pointer ${K===$.id?"border-ui-accent bg-ui-accent/10":"border-ui-border bg-[var(--bg-secondary)] hover:border-[var(--text-tertiary)]"}`,children:[e.jsx("div",{className:`text-sm font-medium mb-1 ${K===$.id?"text-ui-accent":"text-[var(--text-primary)]"}`,children:o($.labelKey)}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)]",children:o($.descriptionKey)})]},$.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.video.durationLabel")}),e.jsx("div",{className:"flex gap-2",children:Na.map($=>e.jsx("button",{onClick:()=>_($.value),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${A===$.value?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:$.label},$.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.video.aspectLabel")}),e.jsx("div",{className:"flex gap-2",children:ka.map($=>e.jsx("button",{onClick:()=>P($.value),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${E===$.value?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:$.label},$.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--text-primary)] mb-3",children:o("pipeline.stepUI.video.audioLabel")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Ia.map($=>e.jsxs("button",{onClick:()=>f($.value),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all cursor-pointer ${z===$.value?"bg-ui-accent text-white":"border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:[o($.labelKey),$.hintKey&&z!==$.value&&e.jsx("span",{className:"ml-1 text-[10px] text-[var(--text-tertiary)]",children:"*"})]},$.value))}),e.jsx("p",{className:"mt-2 text-xs text-[var(--text-tertiary)]",children:z==="narration"?o("pipeline.stepUI.video.narrationHint"):null}),z!=="silent"&&e.jsx("p",{className:"mt-1 text-xs text-[var(--warning)]/80",children:o("pipeline.stepUI.video.audioComingSoon")})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:U,disabled:s,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[d?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(k,{className:"w-4 h-4 inline mr-1"}),o("pipeline.stepUI.video.generateAction"),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{l(i.id,"skip"),a()},disabled:s,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",o("pipeline.common.skipNext")]})]})]})]})}async function Ua(i){const t=Array.from(i.querySelectorAll("img"));await Promise.all(t.map(async r=>{const s=r.src;if(!(!s||s.startsWith("data:")||s.startsWith("blob:"))&&/^https?:\/\//.test(s))try{const l=await Ve.get("/pipeline/image-proxy",{params:{url:s},responseType:"blob"}),a=await new Promise((o,n)=>{const c=new FileReader;c.onload=()=>o(c.result),c.onerror=n,c.readAsDataURL(l.data)});r.src=a}
55catch(l){console.warn("[export-helpers:inlineRemoteImages] skip",s,l)}})),await Promise.all(Array.from(i.querySelectorAll("img")).map(r=>r.complete&&r.naturalHeight>0?Promise.resolve():new Promise(s=>{r.addEventListener("load",()=>s(),{once:!0}),r.addEventListener("error",()=>s(),{once:!0})}))),await new Promise(r=>requestAnimationFrame(()=>r(null)))}function Ca(i){const t=i.data,r=[];for(const s of["heroUrl","imageUrl","beforeUrl","afterUrl","avatar"])typeof t[s]=="string"&&t[s]&&r.push(t[s]);if(Array.isArray(t.items))for(const s of t.items)s&&typeof s.url=="string"&&s.url&&r.push(s.url);return r}async function Ta(i){const t=Ca(i),r={};return await Promise.all(t.map(s=>new Promise(l=>{const a=new Image;Oi(s)&&(a.crossOrigin="anonymous"),a.onload=()=>{r[s]={w:a.naturalWidth,h:a.naturalHeight},l()},a.onerror=()=>l(),a.src=s}))),r}async function Ea(i,t){const r=await Ta(i),s=document.createElement("div");s.style.cssText="position:fixed;left:-10000px;top:0;width:760px;background:#ffffff;",document.body.appendChild(s);const{createRoot:l}=await At(async()=>{const{createRoot:c}=await import("./index-BawMCgu8.js").then(d=>d.c);return{createRoot:c}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),a=l(s),o=ze[i.themeId]||ze.white,n=He[i.fontScale]||He.md;try{a.render(rt(i,o,n,r)),await new Promise(I=>setTimeout(I,80)),await Ua(s),await new Promise(I=>requestAnimationFrame(()=>I(null)));const c=s.firstElementChild||s,d=await Ct(c,{pixelRatio:2,cacheBust:!1,width:760,height:c.offsetHeight||void 0,skipFonts:!0});return(await fetch(d)).blob()}finally{a.unmount(),s.parentNode&&s.parentNode.removeChild(s)}}async function Ka(i,t){var k,K,C,A,_,E,P;const r=i.unit||"cm",s=i.columns||[],l=i.rows||[],a={tableBg:((k=i.style)==null?void 0:k.tableBg)||"#ffffff",headerBg:((K=i.style)==null?void 0:K.headerBg)||"#f3f4f6",headerText:((C=i.style)==null?void 0:C.headerText)||"#111827",cellBg:((A=i.style)==null?void 0:A.cellBg)||"#ffffff",cellText:((_=i.style)==null?void 0:_.cellText)||"#111827",border:((E=i.style)==null?void 0:E.border)||"#e5e7eb",titleText:((P=i.style)==null?void 0:P.titleText)||"#111827"},o=i.title||(t?t("pipelineExport.sizeTableTitle",{unit:r,defaultValue:`Size Chart · Unit: ${r}`}):`Size Chart · Unit: ${r}`),n=document.createElement("div");Object.assign(n.style,{position:"absolute",left:"-10000px",top:"0",padding:"24px",background:a.tableBg,border:`1px solid ${a.border}`,borderRadius:"12px",fontFamily:getComputedStyle(document.body).fontFamily,width:"820px",boxSizing:"border-box"});const c=document.createElement("div");c.textContent=o,Object.assign(c.style,{textAlign:"center",fontWeight:"700",fontSize:"16px",marginBottom:"14px",color:a.titleText}),n.appendChild(c);const d=document.createElement("table");Object.assign(d.style,{width:"100%",borderCollapse:"collapse",fontSize:"14px"});const p=document.createElement("thead"),I=document.createElement("tr");s.forEach(z=>{const f=document.createElement("th");Object.assign(f.style,{border:`1px solid ${a.border}`,background:a.headerBg,color:a.headerText,padding:"10px 8px",fontWeight:"500",textAlign:"center"}),f.textContent=z,I.appendChild(f)}),p.appendChild(I),d.appendChild(p);const N=document.createElement("tbody");l.forEach(z=>{const f=document.createElement("tr");z.forEach(U=>{const L=document.createElement("td");Object.assign(L.style,{border:`1px solid ${a.border}`,background:a.cellBg,color:a.cellText,padding:"8px",textAlign:"center"}),L.textContent=String(U),f.appendChild(L)}),N.appendChild(f)}),d.appendChild(N),n.appendChild(d),document.body.appendChild(n);try{await new Promise(L=>requestAnimationFrame(()=>L(null))),await new Promise(L=>setTimeout(L,30));const f=(await di(n,{backgroundColor:null,scale:2,useCORS:!0,logging:!1})).toDataURL("image/png");return(await fetch(f)).blob()}finally{n.parentNode&&n.parentNode.removeChild(n)}}function Sa(i){if(!i)return null;try{const t=JSON.parse(i);return{title:typeof t.title=="string"?t.title:"",highlights:Array.isArray(t.highlights)?t.highlights.filter(r=>typeof r=="string"):[],description:typeof t.description=="string"?t.description:""}}catch{return null}}function Pa(i,t){const r=(l,a)=>t?t(l,{defaultValue:a}):a,s=[];return i.title&&s.push(`${r("pipelineExport.titleLabel","[Title]")} 56${i.title}`),i.highlights.length>0&&s.push(`${r("pipelineExport.sellingPointsLabel","[Key Selling Points]")} 57${i.highlights.map((l,a)=>`${a+1}. ${l}`).join(` 58`)}`),i.description&&s.push(`${r("pipelineExport.descriptionLabel","[Description]")} 59${i.description}`),s.join(` 60 61`)}async function ni(i){return i.startsWith("data:")||i.startsWith("blob:")?(await fetch(i)).blob():/^https?:\/\//.test(i)?(await Ve.get("/pipeline/image-proxy",{params:{url:i},responseType:"blob"})).data:(await fetch(i)).blob()}function Ui(i){var t;try{const s=(t=new URL(i).pathname.split(".").pop())==null?void 0:t.toLowerCase();if(s&&["jpg","jpeg","png","webp","gif","mp4","mov"].includes(s))return s}catch{}return"jpg"}function Tt(i){return i.replace(/[\\/:*?"<>|]/g,"_").trim()||"step"}function Ra({url:i,onClose:t}){const{t:r}=re();return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:t,children:e.jsxs("div",{className:"max-w-[90vw] max-h-[90vh]",onClick:s=>s.stopPropagation(),children:[e.jsx("img",{src:i,alt:"",crossOrigin:xe(i),className:"max-w-full max-h-[85vh] rounded-xl"}),e.jsx("div",{className:"text-center mt-3",children:e.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg bg-white/10 text-white text-sm hover:bg-white/20 transition-all cursor-pointer",children:r("pipeline.stepUI.export.close")})})]})})}function Aa(i,t){var a,o,n,c;const r=((a=t==null?void 0:t.result)==null?void 0:a.metadata)||{},s=(o=t==null?void 0:t.result)==null?void 0:o.text,l=(((n=t==null?void 0:t.result)==null?void 0:n.files)||[]).filter(
61Boolean);if(i.id==="caption"){const d=Array.isArray((c=r.caption)==null?void 0:c.cards)?r.caption.cards:[];return{def:i,state:t,kind:d.length>0?"caption":"empty",imgFiles:[],captionCards:d,sizeTable:null,descParsed:null,count:d.length}}if(i.id==="size"){const d=r.table,p=!!d&&Array.isArray(d.rows)&&d.rows.length>0;return{def:i,state:t,kind:p?"size":"empty",imgFiles:[],captionCards:[],sizeTable:p?d:null,descParsed:null,count:p?1:0}}if(i.id==="desc"){const d=Sa(s);return{def:i,state:t,kind:d?"desc":"empty",imgFiles:[],captionCards:[],sizeTable:null,descParsed:d,count:d?1:0}}return{def:i,state:t,kind:l.length>0?"img":"empty",imgFiles:l,captionCards:[],sizeTable:null,descParsed:null,count:l.length}}function za({stepDef:i,stepState:t,allStepDefs:r,allStepStates:s,isLoading:l,onExecute:a,onNext:o}){const{t:n}=re(),[c,d]=u.useState(null),[p,I]=u.useState(!1),[N,k]=u.useState(null),K=u.useMemo(()=>r.filter(E=>E.id!=="export").map(E=>Aa(E,s.find(P=>P.id===E.id))).filter(E=>{var P;return E.kind!=="empty"||((P=E.state)==null?void 0:P.status)==="skipped"}),[r,s]),C=u.useMemo(()=>K.reduce((E,P)=>E+P.count,0),[K]),A=async(E,P)=>{try{const z=await ni(E),f=URL.createObjectURL(z),U=document.createElement("a");U.href=f,U.download=P,document.body.appendChild(U),U.click(),document.body.removeChild(U),URL.revokeObjectURL(f)}catch(z){console.error("[downloadSingleOriginal]",z),alert(n("pipeline.stepUI.export.downloadFailed")+z.message)}},_=async()=>{if(!(p||C===0)){I(!0),k({done:0,total:C});try{const E=new Yi;let P=0;const z=()=>{P+=1,k({done:P,total:C})};for(const S of K){if(S.kind==="empty")continue;const D=Tt(n(S.def.nameKey)),q=E.folder(D)||E;if(S.kind==="img")for(let X=0;X<S.imgFiles.length;X++){const W=S.imgFiles[X];try{const ne=await ni(W),V=Ui(W);q.file(`${D}_${X+1}.${V}`,ne)}catch(ne){console.warn("[zip:img]",W,ne)}z()}else if(S.kind==="caption")for(let X=0;X<S.captionCards.length;X++){const W=S.captionCards[X];try{const ne=ht.find($=>$.id===W.template),V=`${D}_${X+1}_${Tt(ne?n(`captionTheme.${ne.id}.name`):W.template)}.png`,O=await Ea(W);q.file(V,O)}catch(ne){console.warn("[zip:caption]",W.id,ne)}z()}else if(S.kind==="size"&&S.sizeTable){try{const X=await Ka(S.sizeTable,n);q.file(`${D}.png`,X)}catch(X){console.warn("[zip:size]",X)}z()}else if(S.kind==="desc"&&S.descParsed){const X=Pa(S.descParsed,n);q.file(`${D}.txt`,X),z()}}const f=await E.generateAsync({type:"blob",compression:"STORE"}),U=URL.createObjectURL(f),L=document.createElement("a");L.href=U,L.download=`${n("pipeline.stepUI.export.zipFilenamePrefix")}-${Date.now()}.zip`,document.body.appendChild(L),L.click(),document.body.removeChild(L),URL.revokeObjectURL(U)}catch(E){console.error("[downloadZip]",E),alert(n("pipeline.stepUI.export.zipFailed")+E.message)}finally{I(!1),k(null)}}};return e.jsxs("div",{className:"max-w-[960px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:n(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-6",children:n(i.descKey)}),e.jsxs("div",{className:"rounded-xl bg-[var(--bg-secondary)] p-4 mb-6 flex flex-wrap items-center gap-3",children:[e.jsxs("button",{onClick:_,disabled:p||C===0,className:"px-5 py-2.5 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 disabled:opacity-50 cursor-pointer inline-flex items-center gap-1.5",children:[p?e.jsx(ee,{className:"w-4 h-4 animate-spin"}):e.jsx(mi,{className:"w-4 h-4"}),p&&N?n("pipeline.stepUI.export.zippingProgress",{done:N.done,total:N.total}):n("pipeline.stepUI.export.zipAction",{count:C})]}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)] inline-flex items-center gap-1",children:[e.jsx(oi,{className:"w-3 h-3"}),n("pipeline.stepUI.export.qualityNote")]})]}),C===0?e.jsx("div",{className:"rounded-xl bg-[var(--bg-secondary)] p-10 text-center text-sm text-[var(--text-tertiary)]",children:n("pipeline.stepUI.export.empty")}):e.jsx("div",{className:"space-y-4",children:K.map(E=>e.jsx($a,{item:E,onPreview:d,onDownloadSingle:A},E.def.id))}),c&&e.jsx(Ra,{url:c,onClose:()=>d(null)})]})}function $a({item:i,onPreview:t,onDownloadSingle:r}){const{t:s}=re(),{def:l,state:a,kind:o}=i,n=(a==null?void 0:a.status)==="completed",c=(a==null?void 0:a.status)==="skipped",d=Ae[l.id]||Le,p=s(n?"pipeline.stepUI.export.statusCompleted":c?"pipeline.stepUI.export.statusSkipped":"pipeline.stepUI.export.statusPending"),I=n?"text-[var(--success)] bg-[var(--success)]/10":c?"text-[var(--warning)] bg-[var(--warning)]/10":"text-[var(--text-tertiary)] bg-[var(--bg-tertiary)]",N=o==="img"?{label:s("pipeline.stepUI.export.kindImg",{count:i.count}),Icon:oi}:o==="caption"?{label:s("pipeline.stepUI.export.kindCaption",{count:i.count}),Icon:Hi}:o==="size"?{label:s("pipeline.stepUI.export.kindSize"),Icon:Ji}:o==="desc"?{label:s("pipeline.stepUI.export.kindDesc"),Icon:Mi}:null;return e.jsxs("div",{className:"rounded-xl bg-[var(--bg-secondary)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3 flex-wrap",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center bg-[var(--bg-tertiary)] shrink-0",children:e.jsx(d,{className:"w-4 h-4 text-[var(--text-secondary)]"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-[var(--text-primary)]",children:s(l.nameKey)}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] mt-0.5 truncate",children:s(l.descKey)})]}),e.jsx("span",{className:`text-xs font-medium px-2 py-1 rounded ${I}`,children:p}),N&&e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)] inline-flex items-center gap-1",children:[e.jsx(N.Icon,{className:"w-3 h-3"})," ",N.label]})]}),o==="img"&&i.imgFiles.length>
610&&e.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:i.imgFiles.map((k,K)=>e.jsxs("div",{className:"group relative",children:[e.jsx("button",{onClick:()=>t(k),className:"aspect-square w-full rounded-lg overflow-hidden bg-[var(--bg-tertiary)] cursor-pointer hover:ring-2 hover:ring-ui-accent transition-all",children:e.jsx("img",{src:k,alt:"",crossOrigin:xe(k),className:"w-full h-full object-cover"})}),e.jsx("button",{onClick:()=>r(k,`${Tt(s(l.nameKey))}_${K+1}.${Ui(k)}`),className:"absolute bottom-1 right-1 w-6 h-6 rounded-md bg-black/60 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",title:s("pipeline.stepUI.export.downloadOriginal"),children:e.jsx(Fe,{className:"w-3 h-3"})})]},K))}),o==="caption"&&i.captionCards.length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:i.captionCards.map((k,K)=>{const C=ze[k.themeId]||ze.white,A=He[k.fontScale]||He.md,_=ht.find(E=>E.id===k.template);return e.jsxs("div",{className:"rounded-lg overflow-hidden bg-[var(--bg-tertiary)]",children:[e.jsxs("div",{className:"px-2 py-1 text-[11px] text-[var(--text-tertiary)] flex items-center justify-between",children:[e.jsxs("span",{children:[K+1,". ",_?s(`captionTheme.${_.id}.name`):k.template]}),e.jsxs("span",{className:"text-[var(--text-tertiary)]",children:[s(`captionTheme.${C.id}.name`)," · ",k.fontScale]})]}),e.jsx("div",{className:"bg-white overflow-hidden",style:{height:"200px"},children:e.jsx("div",{style:{zoom:.3},children:rt(k,C,A,{})})})]},k.id)})}),o==="size"&&i.sizeTable&&e.jsx(La,{table:i.sizeTable}),o==="desc"&&i.descParsed&&e.jsx(Oa,{parsed:i.descParsed})]})}function La({table:i}){const{t}=re(),r=i.style||{};return e.jsxs("div",{className:"overflow-x-auto rounded-lg",style:{background:r.tableBg||"#ffffff",padding:"12px"},children:[e.jsx("div",{className:"text-center text-sm font-bold mb-2",style:{color:r.titleText||"#111827"},children:t("pipeline.stepUI.export.sizeTableTitle",{unit:i.unit||"cm"})}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsx("tr",{children:(i.columns||[]).map((s,l)=>e.jsx("th",{style:{border:`1px solid ${r.border||"#e5e7eb"}`,background:r.headerBg||"#f3f4f6",color:r.headerText||"#111827",padding:"6px 8px",textAlign:"center",fontWeight:500},children:s},l))})}),e.jsx("tbody",{children:(i.rows||[]).map((s,l)=>e.jsx("tr",{children:s.map((a,o)=>e.jsx("td",{style:{border:`1px solid ${r.border||"#e5e7eb"}`,background:r.cellBg||"#ffffff",color:r.cellText||"#111827",padding:"6px 8px",textAlign:"center"},children:String(a)},o))},l))})]})]})}function Oa({parsed:i}){const{t}=re();return e.jsxs("div",{className:"space-y-3",children:[i.title&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-tertiary)] mb-1 uppercase tracking-wider",children:t("pipeline.stepUI.export.descTitle")}),e.jsx("div",{className:"text-base font-bold text-[var(--text-primary)] leading-snug",children:i.title})]}),i.highlights.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-tertiary)] mb-1 uppercase tracking-wider",children:t("pipeline.stepUI.export.descHighlights")}),e.jsx("ul",{className:"space-y-1",children:i.highlights.map((r,s)=>e.jsxs("li",{className:"flex gap-2 text-sm text-[var(--text-primary)]",children:[e.jsx("span",{className:"shrink-0 w-5 h-5 rounded-full bg-ui-accent/15 text-ui-accent text-[11px] font-bold inline-flex items-center justify-center",children:s+1}),e.jsx("span",{className:"leading-relaxed",children:r})]},s))})]}),i.description&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-tertiary)] mb-1 uppercase tracking-wider",children:t("pipeline.stepUI.export.descDetail")}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)] leading-relaxed whitespace-pre-wrap",children:i.description})]})]})}function Ha({stepDef:i,stepState:t,isLoading:r,onExecute:s,onNext:l}){var p,I;const{t:a}=re(),o=t==null?void 0:t.status,c=ae(N=>
61N.executingStepId)===i.id,d=Ae[i.id]||Le;return e.jsxs("div",{className:"max-w-[860px] mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-1",children:a(i.nameKey)}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-1",children:a(i.descKey)}),o==="completed"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--success)]/30 bg-[var(--success)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--success)] font-medium mb-3 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-4 h-4"})," ",a("pipeline.common.completed")]}),(t==null?void 0:t.creditsUsed)!=null&&t.creditsUsed>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--text-tertiary)] font-normal",children:[a("pipeline.common.consumed")," ",e.jsx(he,{className:"w-3 h-3"}),t.creditsUsed]})]}),((p=t==null?void 0:t.result)==null?void 0:p.files)&&t.result.files.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-3",children:t.result.files.map((N,k)=>e.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-[var(--bg-tertiary)]",children:e.jsx("img",{src:N,alt:"",crossOrigin:xe(N),className:"w-full h-full object-cover"})},k))}),((I=t==null?void 0:t.result)==null?void 0:I.text)&&e.jsx("div",{className:"text-sm text-[var(--text-secondary)] whitespace-pre-wrap bg-[var(--bg-tertiary)] rounded-lg p-4",children:t.result.text})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:()=>s(i.id,"generate"),disabled:r,className:"text-xs px-3 py-1.5 rounded-lg border border-ui-border text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(me,{className:"w-3 h-3 inline mr-1"})," ",a("pipeline.common.regenerate")]}),e.jsxs("button",{onClick:l,className:"px-5 py-2 rounded-lg bg-ui-accent text-white text-sm font-medium hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[a("pipeline.common.nextStep")," ",e.jsx(Ue,{className:"w-3.5 h-3.5"})]})]})]}):o==="error"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-[var(--error)]/30 bg-[var(--error)]/5 p-6",children:[e.jsxs("div",{className:"text-[var(--error)] font-medium mb-2 flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4"})," ",a("pipeline.common.error")]}),e.jsx("div",{className:"text-sm text-[var(--error)]",children:(t==null?void 0:t.error)||a("pipeline.common.unknownError")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>s(i.id,"retry"),disabled:r,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[r?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(me,{className:"w-4 h-4 inline mr-1"}),a("pipeline.common.retry")]})})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-ui-border bg-[var(--bg-secondary)] p-8 text-center",children:[e.jsx(d,{className:"w-12 h-12 mx-auto mb-3 text-[var(--text-tertiary)]"}),e.jsx("div",{className:"text-[var(--text-secondary)] text-sm",children:a(i.descKey)})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:()=>s(i.id,"generate"),disabled:r,className:"px-6 py-2.5 rounded-lg bg-ui-accent text-white font-medium text-sm hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[c?e.jsx(ee,{className:"w-4 h-4 animate-spin inline mr-1"}):e.jsx(d,{className:"w-4 h-4 inline mr-1"}),a("pipeline.common.generate"),e.jsxs("span",{className:"inline-flex items-center gap-0.5 ml-1 opacity-70",children:[e.jsx(he,{className:"w-3.5 h-3.5"}),i.cost]})]}),!i.required&&e.jsxs("button",{onClick:()=>{s(i.id,"skip"),l()},disabled:r,className:"px-4 py-2 rounded-lg border border-[var(--warning)]/30 text-[var(--warning)] text-sm bg-[var(--warning)]/5 hover:bg-[var(--warning)]/10 transition-all cursor-pointer disabled:opacity-50",children:[e.jsx(_e,{className:"w-3.5 h-3.5 inline mr-1"})," ",a("pipeline.common.skipNext")]})]})]})]})}function Ma({stepDef:i,stepState:t,allStepDefs:r,allStepStates:s,category:l,isLoading:a,onExecute:o,onNext:n}){switch(i.id){case"upload":return e.jsx(hi,{stepDef:i,stepState:t,isLoading:a,onExecute:o,onNext:n});case"removebg":return e.jsx(as,{stepDef:i,stepState:t,allStepStates:s,isLoading:a,onExecute:o,onNext:n});case"hero":return e.jsx(va,{stepDef:i,stepState:t,allStepStates:s,category:l,isLoading:a,onExecute:o,onNext:n});case"scene":case"plating":case"room":case"spec_compare":return e.jsx(ws,{stepDef:i,stepState:t,allStepStates:s,category:l,isLoading:a,onExecute:o,onNext:n});case"tryon":return e.jsx(aa,{stepDef:i,stepState:t,allStepStates:s,category:l,isLoading:a,onExecute:o,onNext:n});case"wearing":return e.jsx(oa,{stepDef:i,stepState:t,isLoading:a,onExecute:o,onNext:n});case"swatch":return e.jsx(da,{stepDef:i,stepState:t,isLoading:a,onExecute:o,onNext:n});case"angles":return e.jsx(ma,{stepDef:i,stepState:t,isLoading:a,onExecute:o,onNext:n});case"video":case"rotate":case"unbox":return e.jsx(_a,{stepDef:i,stepState:t,category:l,isLoading:a,onExecute:o,onNext:n});case"detail_img":case"detail":return e.jsx(Rs,{stepDef:i,stepState:t,allStepStates:s,category:l,isLoading:a,onExecute:o,onNext:n});case"texture":case"macro":case"feature":case"material":return e.jsx(ks,{stepDef:i,stepState:t,allStepStates:s,isLoading:a,onExecute:o,onNext:n});case"size":case"specs":return e.jsx(Js,{stepDef:i,stepState:t,category:l,isLoading:a,onExecute:o,onNext:n});case"caption":return e.jsx(Tn,{stepDef:i,stepState:t,allStepStates:s,isLoading:a,onExecute:o,onNext:n});
61case"desc":return e.jsx(nr,{stepDef:i,stepState:t,allStepStates:s,category:l,isLoading:a,onExecute:o,onNext:n});case"nutrition":case"dimension":case"ingredient":case"combo":case"sizeref":return e.jsx(Rn,{stepDef:i,stepState:t,category:l,isLoading:a,onExecute:o,onNext:n});case"export":return e.jsx(za,{stepDef:i,stepState:t,allStepDefs:r,allStepStates:s,isLoading:a,onExecute:o,onNext:n});default:return e.jsx(Ha,{stepDef:i,stepState:t,isLoading:a,onExecute:o,onNext:n})}}function Fa(){const{category:i,projectId:t}=Fi(),r=Bi(),{t:s,i18n:l}=re(),a=l.language||"en",o=ae(R=>R.project),n=ae(R=>R.isLoading),c=ae(R=>R.error),d=ae(R=>R.currentStep),p=ae(R=>R.loadProject),I=ae(R=>R.createProject),N=ae(R=>R.setCurrentStep),k=ae(R=>R.executeStep),K=ae(R=>R.getStepDefs),C=ae(R=>R.getStepStates),A=ae(R=>R.getCategoryDef),_=ae(R=>R.fetchCategories),P=ae(R=>R.runtimeCategories)??qi;u.useEffect(()=>{t&&p(t),_()},[t,p,_]);const z=async R=>{if(!i||!(i in P))return;const ie=P[i],le=s("pipeline.ui.defaultProjectName",{name:s(ie.nameKey),date:new Date().toLocaleDateString()}),Z=await I(le,i);await $e.executeStep(Z,"upload",{action:"generate",params:{files:R}}),r(`/${a}/app/pipeline/${i}/${Z}`,{replace:!0})},f=u.useRef(null),U=u.useCallback(R=>{const ie=(R==null?void 0:R.data)||R;if((ie==null?void 0:ie.projectId)!==t)return;const le=ie==null?void 0:ie.status;le!=="completed"&&le!=="error"&&le!=="skipped"||(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,p(t)},300))},[t,p]);u.useEffect(()=>{if(!t)return;const R=Wi.on("pipeline:step_update",U);return()=>{R(),f.current&&(clearTimeout(f.current),f.current=null)}},[t,U]);const L=u.useRef([]),S=u.useRef(new Set);u.useEffect(()=>{var ie,le,Z,be;if(!o||!t)return;const R=o.steps;for(const v of R){if(v.status!=="active")continue;const T=(le=(ie=v.result)==null?void 0:ie.metadata)==null?void 0:le.taskId,H=(be=(Z=v.result)==null?void 0:Z.metadata)==null?void 0:be.processing;if(!T||!H||S.current.has(T))continue;S.current.add(T);const B=v.id,y=Gi({taskId:T,pollFn:()=>$e.getVideoTaskStatus(T),onCompleted:async x=>{await $e.completeAsyncStep(t,B,{videoUrl:x.videoUrl,coverUrl:x.coverUrl,creditsUsed:x.creditsUsed}),p(t)},onFailed:async x=>{var j;await $e.completeAsyncStep(t,B,{error:(x==null?void 0:x.message)||((j=x==null?void 0:x.error)==null?void 0:j.message)||"Video generation failed"}),p(t)}});L.current.push(y)}return()=>{L.current.forEach(v=>v()),L.current=[],S.current.clear()}},[o,t,p]);const D=K(),q=C(),X=A(),W=D[d],ne=q.find(R=>R.id===(W==null?void 0:W.id)),V=u.useMemo(()=>{if(D.length===0)return 0;const R=q.filter(ie=>ie.status==="completed"||ie.status==="skipped").length;return Math.round(R/D.length*100)},[D,q]),O=()=>{r(`/${a}/app/pipeline`)},$=()=>{const R=d+1;R<D.length&&N(R)},Y=(R,ie,le)=>{k(R,ie,le)};if(n&&!o)return e.jsx("div",{className:"h-full flex items-center justify-center bg-[var(--bg-primary)]",children:e.jsx(ee,{className:"w-8 h-8 animate-spin text-ui-accent"})});if(c)return e.jsx("div",{className:"h-full flex items-center justify-center bg-[var(--bg-primary)]",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-sm text-[var(--error)]",children:c}),e.jsx("button",{onClick:O,className:"text-sm text-ui-accent hover:underline cursor-pointer",children:s("pipeline.ui.backToPipeline")})]})});if(!t&&i&&i in P){const R=P[i];return e.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg-primary)]",children:[e.jsxs("header",{className:"h-12 shrink-0 border-b border-ui-border bg-[var(--bg-secondary)] flex items-center px-4 gap-3",children:[e.jsx("button",{onClick:O,className:"p-1.5 rounded-lg text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors cursor-pointer",children:e.jsx(Ht,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-sm font-semibold text-[var(--text-primary)]",children:[R.emoji," ",s("pipeline.ui.productionLine",{name:s(R.nameKey)})]})]}),e.jsx("main",{className:"flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-4xl mx-auto px-6 py-8",children:e.jsx(hi,{stepDef:R.steps[0],stepState:void 0,isLoading:n,onExecute:(ie,le,Z)=>{Z!=null&&Z.files&&z(Z.files)}})})})]})}return!o||!W?e.jsx("div",{className:"h-full flex items-center justify-center bg-[var(--bg-primary)]",children:e.jsx(ee,{className:"w-8 h-8 animate-spin text-ui-accent"})}):e.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg-primary)]",children:[e.jsxs("header",{className:"h-12 shrink-0 border-b border-ui-border bg-[var(--bg-secondary)] flex items-center px-4 gap-3",children:[e.jsx("button",{onClick:O,className:"p-1.5 rounded-lg text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors cursor-pointer",children:e.jsx(Ht,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-sm font-semibold text-[var(--text-primary)] truncate flex-1",children:[X==null?void 0:X.emoji," ",X?s("pipeline.ui.productionLine",{name:s(X.nameKey)}):""]})]}),e.jsx("div",{className:"h-[2px] bg-[var(--bg-tertiary)] shrink-0",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${V}%`,background:"linear-gradient(90deg, var(--accent-primary), var(--success))"}})}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(rs,{stepDefs:D,stepStates:q,currentStep:d,onSelect:N}),e.jsx("main",{className:"flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-4xl mx-auto px-6 py-8",children:e.jsx(Ma,{stepDef:W,stepState:ne,allStepDefs:D,allStepStates:q,category:X==null?void 0:X.key,isLoading:n,onExecute:Y,onNext:$})})})]})]})}const sl=Object.freeze(Object.defineProperty({__proto__:null,default:Fa},Symbol.toStringTag,{value:"Module"}));
61export{il as P,ti as a,sl as b,tl as c};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.