1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AssetGalleryModal.DBIZWl9v.js","assets/dist.D4237Rk6.js","assets/inertia.BE4YqsTM.js","assets/http.DWpeO7Ui.js","assets/rolldown-runtime.C1f3BsDW.js","assets/icons.ChOq_Y4q.js","assets/dist.CoNAZqlp.js","assets/dist.DxccqHSW.js","assets/react-core.CAMe6Z4j.js","assets/dist.BhzTvz6X.js","assets/dist.D4LCotyC.js","assets/dist.C1cc-Zbw.js","assets/dist.DbqQa_sy.js","assets/es2015.Cr2X04_P.js","assets/select.vYEvBl4E.js","assets/entry-client.DX3aUoe5.js","assets/utils.CgzVjNgC.js","assets/state.L8kQliOB.js","assets/app.BpxBHA-A.css","assets/dist.zmknLG-d.js","assets/input.GzdAc1Aj.js","assets/dist.B-JETxGF.js","assets/AssetGalleryModal.DteaM05Z.js","assets/Tooltip.D5vWPvw2.js","assets/dialog.Bb7MGeDP.js","assets/segmented.DHcH2lTJ.js","assets/characterMention.DcxgzALo.js","assets/imageValidation.BrtKjMLv.js"])))=>i.map(i=>d[i]); 2import{r as B}from"./rolldown-runtime.C1f3BsDW.js";import"./inertia.BE4YqsTM.js";import"./http.DWpeO7Ui.js";import{Qr as Y,S as H,Xt as J,ct as O,m as D}from"./icons.ChOq_Y4q.js";import{t as K}from"./react-core.CAMe6Z4j.js";import"./utils.CgzVjNgC.js";import"./state.L8kQliOB.js";import{A as W,N as Z,P as U,Tt as i,k as $,wt as ee}from"./entry-client.DX3aUoe5.js";import"./segmented.DHcH2lTJ.js";import"./input.GzdAc1Aj.js";import"./dist.CoNAZqlp.js";import"./dist.DxccqHSW.js";import"./dist.D4237Rk6.js";import"./dist.BhzTvz6X.js";import"./dist.B-JETxGF.js";import"./dist.zmknLG-d.js";import"./Tooltip.D5vWPvw2.js";import"./es2015.Cr2X04_P.js";import"./dist.DbqQa_sy.js";import"./dialog.Bb7MGeDP.js";import{s as te}from"./characterMention.DcxgzALo.js";import"./imageValidation.BrtKjMLv.js";import{t as se}from"./badge.CK53iWwP.js";import"./BestPracticeTip.vi3UQdmd.js";import"./bestPractices.CtL0Jx0E.js";import{t as re}from"./CharacterModal.ehp1Mvsj.js";import"./PromptReferencesRow.Dil-fpz5.js";import"./section-label.Cq6cQeLu.js";import{t as ae}from"./DesignSheetPreviewModal.Itvufz0h.js";import{t as ne}from"./usePolling.mKMvMVRm.js";import"./index.es.DWqa0lfv.js";import{n as oe,t as le}from"./CharacterViewModal.Dgj8ZNyJ.js";var s=B(Y(),1),t=B(K(),1),ie=(0,s.lazy)(()=>ee(()=>import("./AssetGalleryModal.DBIZWl9v.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])).then(r=>({default:r.AssetGalleryModal})));function ce(r){const h=(r.references_count??r.references?.length??0)===0,l=(r.frame_count??0)>=2;return r.is_active&&l&&h&&r.sheet_status!=="processing"}const qe=({projectUuid:r,onClose:h,focusCharacterId:l,focusNonce:V})=>{const{characters:a,isLoading:z,fetchCharacters:o,deleteCharacter:w,uploadReference:v,regenerateSheet:C}=U(),{confirm:y}=Z(),[u,f]=(0,s.useState)(!1),[_,p]=(0,s.useState)(null),[N,j]=(0,s.useState)(null),[k,S]=(0,s.useState)(null),[c,x]=(0,s.useState)(null),[L,P]=(0,s.useState)(null),g=(0,s.useRef)(!1);(0,s.useEffect)(()=>{o(r)},[r,o]),(0,s.useEffect)(()=>{if(l==null||!a.some(n=>n.id===l))return;P(l);const e=setTimeout(()=>P(null),3e3);return()=>clearTimeout(e)},[l,V,a.length]),ne(()=>o(r),{enabled:(0,s.useMemo)(()=>a.some(e=>e.sheet_status==="processing"||e.sheet_status==null),[a])});const{blocking:d,ordered:q}=(0,s.useMemo)(()=>{const e=a.filter(ce),n=new Set(e.map(b=>b.id)),m=a.filter(b=>!n.has(b.id));return{blocking:e,ordered:[...e,...m]}},[a]),R=(0,s.useCallback)(e=>{p(e),f(!0)},[]),A=(0,s.useCallback)(()=>{p(null),f(!0)},[]),M=(0,s.useCallback)(async e=>{if(await y({title:"Remove this character?",description:`"${e.name}" is removed from this film.${te(e)} Their photos stay in My files. You can't undo this.`,confirmText:"Remove character",variant:"destructive"}))try{await w(e.id),i.success("Character removed.")}catch{i.error("Could not remove the character. Try again.")}},[y,w]),E=(0,s.useCallback)(e=>{j(e)},[]),G=(0,s.useCallback)(async e=>{const n=c;if(x(null),!!n){try{await v(n.id,{asset_id:e.id})}catch{i.error("Could not add the reference image. Try again.");return}i.success(`Reference added for ${n.name}.`),o(r).catch(()=>{})}},[c,v,o,r]),[I,T]=(0,s.useState)(new Set),Q=(0,s.useCallback)(async e=>{T(n=>new Set(n).add(e.id));try{await C(r,e.id),i.success(`Redrawing ${e.name}'s sheet.`),o(r).catch(()=>{})}catch{i.error("Could not redraw the character sheet. Try again.")}finally{T(n=>{const m=new Set(n);return m.delete(e.id),m})}},[r,C,o]),X=(0,s.useCallback)(e=>{f(e),e||(p(null),g.current&&(o(r),g.current=!1))},[r,o]),F=(0,s.useRef)(a.length);return(0,s.useEffect)(()=>{u&&a.length!==F.current&&(g.current=!0),F.current=a.length},[a.length,u]),(0,t.jsxs)("div",{className:"w-full lg:w-80 bg-card border-l border-border flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(D,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("h3",{className:"font-semibold text-sm",children:"Characters"}),a.length>0&&(0,t.jsx)(se,{className:"tabular-nums",children:a.length})]}),(0,t.jsx)(W,{onClick:h,"aria-label":"Close characters panel"})]}),d.length>0&&(0,t.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 bg-amber-500/10 border-b border-amber-500/20",children:[(0,t.jsx)(H,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-amber-400"}),(0,t.jsxs)("p",{className:"text-[11px] text-amber-100",children:[(0,t.jsxs)("span",{className:"font-medium",children:[d.length," character",d.length>
21?"s":""]})," ","need",d.length>1?"":"s"," a reference face before their shots can be drawn. Add one below to lock their look."]})]}),(0,t.jsx)("div",{className:"px-3 py-2 border-b border-border/50",children:(0,t.jsxs)($,{size:"sm",variant:"outline",className:"w-full justify-center gap-1.5",onClick:A,children:[(0,t.jsx)(O,{className:"h-3.5 w-3.5"}),"Add character"]})}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-3 py-2 space-y-2",children:z&&a.length===0?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(J,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):a.length===0?(0,t.jsxs)("div",{className:"text-center py-8 px-4",children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-xl bg-secondary flex items-center justify-center mx-auto mb-3",children:(0,t.jsx)(D,{className:"h-6 w-6 text-muted-foreground/50"})}),(0,t.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:"No characters yet"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mb-4",children:"Add characters so they look the same in every shot."}),(0,t.jsxs)($,{size:"sm",onClick:A,className:"gap-1.5",children:[(0,t.jsx)(O,{className:"h-3.5 w-3.5"}),"Add first character"]})]}):q.map(e=>(0,t.jsx)(oe,{character:e,isFocused:L===e.id,onView:()=>S(e),onEdit:()=>R(e),onDelete:()=>M(e),onPreviewSheet:e.has_design_sheet||e.sheet_status==="failed"?()=>E(e):void 0,onAddFace:()=>x(e),onRedrawSheet:e.sheet_status==="failed"&&!I.has(e.id)?()=>Q(e):void 0},e.id))}),(0,t.jsx)(le,{open:!!k,onOpenChange:e=>{e||S(null)},character:k,onEdit:e=>R(e),onDelete:e=>M(e),onPreviewSheet:e=>E(e)}),(0,t.jsx)(re,{open:u,onOpenChange:X,projectUuid:r,character:_},_?.id??"new"),(0,t.jsx)(ae,{open:!!N,onOpenChange:e=>{e||j(null)},character:N,projectUuid:r}),c&&(0,t.jsx)(s.Suspense,{fallback:null,children:(0,t.jsx)(ie,{projectUuid:r,isOpen:!!c,onClose:()=>x(null),onAssetSelect:G,categoryFilter:"image"})})]})};export{qe as CharacterPanel};
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.