1var R=Object.defineProperty;var M=(t,e,a)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var T=(t,e,a)=>M(t,typeof e!="symbol"?e+"":e,a);import{da as p,dV as P,df as u,bW as U,dw as z,b$ as m,dW as H,dX as V,dY as Y,cD as j,du as F,c2 as r,cy as C,cb as y,c5 as h,d8 as D,cs as W,cc as Q,c0 as O,bT as G,bQ as q,bV as E,dZ as $,d_ as K,c3 as g,d2 as J,cG as Z,cH as X,cp as v,d9 as ee,cu as te}from"./index-DVg-xzw2.js";import{L as ae}from"./index-Bsb8w_-V.js";import{L as re,A as oe}from"./useMobilePicker-0ABkIBJ1.js";import{D as w}from"./DatePicker-BGuyRlZP.js";import{R as ne}from"./RadioGroup-QyMIj4rE.js";import{L as ie}from"./index-IX0QsJF5.js";import{C as se}from"./ContentCopyOutlined-D1gsN8mq.js";import{D as le}from"./DataGrid-CNiIiZAA.js";import{T as ce}from"./TablePagination-D4-jdgm0.js";import"./Radio-BvCTZhLk.js";import"./InputAdornment-Dnwt-N_z.js";import"./FormGroup-BfIjdZw9.js";import"./Autocomplete-CtB1hJ0K.js";import"./ListSubheader-DLxZg-0u.js";import"./ClickAwayListener-DO5sk5k6.js";import"./ListItemIcon-t1E4jz7i.js";import"./Skeleton-Dg8-OFSX.js";import"./KeyboardArrowRight-CPusPmE1.js";import"./LastPage-Bolyk-hz.js";import"./TableCell-BsY47un6.js";const ue=50,L=[{value:"today",label:"ì¤ë"},{value:"3days",label:"3ì¼"},{value:"1week",label:"1주ì¼"},{value:"1month",label:"1ê°ì"},{value:"3months",label:"3ê°ì"},{value:"6months",label:"6ê°ì"}],N=[{value:void 0,label:"ì ì²´"},{value:"VTON_BATCH-STATUS_BEFORE-REQUEST",label:"ì ì¡ ë기ì¤"},{value:"VTON_BATCH-STATUS_PROCESSING",label:"ìì± ì§íì¤"},{value:"VTON_BATCH-STATUS_COMPLETED-WITH-DISPLAY-FAILURE",label:"ìì± ìë£ (ì ì ë
¸ì¶ ì¤í¨)"},{value:"VTON_BATCH-STATUS_COMPLETED",label:"ìì± ìë£ (ì ì ë
¸ì¶)"}],de=/^(\d{4})-(\d{2})-(\d{2})T/;function he(t){const e=de.exec(t);if(e==null)return!1;const a=Number(e[1]),n=Number(e[2]),s=Number(e[3]),c=new Date(Date.UTC(a,n,0)).getUTCDate();return s>=1&&s<=c}function me(t){return he(t)&&u(t).isValid()}const _=p.string().datetime({offset:!0}).refine(me).optional().catch(void 0),pe=p.object({pageNumber:p.coerce.number().int().min(1).optional().catch(void 0),pageSize:p.coerce.number().int().min(1).optional().catch(void 0),shopName:p.string().optional(),taskName:p.string().optional(),from:_,to:_,status:p.enum(P).optional().catch(void 0),shopID:p.string().optional(),shopTaskID:p.string().optional()});function fe(t=u()){return{pageNumber:1,pageSize:ue,from:t.subtract(1,"month").startOf("day").format(),to:t.endOf("day").format(),status:void 0}}function k(t,e=u()){const a=e.endOf("day").format();switch(t){case"today":return{from:e.startOf("day").format(),to:a};case"3days":return{from:e.subtract(2,"day").startOf("day").format(),to:a};case"1week":return{from:e.subtract(1,"week").startOf("day").format(),to:a};case"1month":return{from:e.subtract(1,"month").startOf("day").format(),to:a};case"3months":return{from:e.subtract(3,"month").startOf("day").format(),to:a};case"6months":return{from:e.subtract(6,"month").startOf("day").format(),to:a}}}function ge(t,e=fe()){const a=pe.safeParse(t);if(!a.success)return e;const n=a.data.from??e.from,s=a.data.to??e.to,c=a.data.from!=null&&a.data.to!=null;return u(n).isAfter(s)?c?{...e,...a.data,from:s,to:n,pageNumber:a.data.pageNumber??e.pageNumber,pageSize:a.data.pageSize??e.pageSize}:{...e,...a.data,pageNumber:a.data.pageNumber??e.pageNumber,pageSize:a.data.pageSize??e.pageSize,from:e.from,to:e.to}:{...e,...a.data,pageNumber:a.data.pageNumber??e.pageNumber,pageSize:a.data.pageSize??e.pageSize,from:n,to:s}}function xe(t){const{status:e,...a}=t;return e===void 0?a:{...a,status:e}}function ye(){const[,t]=U(),e=z(),a=m.useMemo(()=>ge(H(e.search)),[e.search]),n=m.useCallback(s=>{t(V({...a,...s,pageNumber:s.pageNumber??1}))},[t,a]);return{searchParams:a,setSearchParams:n}}const A=Y("ai-model-cut-batches",{list:t=>({queryKey:[t],queryFn:()=>j.shops.vtonBatchesList(t).then(e=>e.data)})});function Ce(t){return F(A.list(t))}function B(t){var e;return(e=L.find(a=>{const n=k(a.value);return u(n.from).isSame(t.from,"day")&&u(n.to).isSame(t.to,"day")}))==null?void 0:e.value}function I({label:t,children:e}){return r.jsxs(C,{alignItems:"center",borderBottom:"1px solid",borderColor:"divider",display:"flex",minHeight:48,px:2,children:[r.jsx(C,{flex:"0 0 88px",children:r.jsx(h,{variant:"Subtitle_Looko",children:t})}),r.jsx(y,{alignItems:"center",flexWrap:"wrap",gap:2,minWidth:0,children:e})]})}function be({searchParams:t,setSearchParams:e}){const[a,n]=m.useState(t),[s,c]=m.useState(()=>B(t));m.useEffect(()=>{n(t),c(B(t))},[t]);const d=()=>{e({...a,pageNumber:1})},x=o=>{n(l=>({...l,...k(o)})),c(o)},i=o=>{const l=N.find(({value:f})=>(f??"")===o.target.value);n(f=>({...f,status:l==null?void 0:l.value}))};return r.jsxs(C,{component:"section","aria-label":"AI 모ë¸ì»· ë°°ì¹ ê²ì",bgcolor:"white",flexShrink:0,children:[r.jsxs(I,{label:"ê²ì",children:[r.jsxs(y,{alignItems:"center",gap:2,children:[r.jsx(h,{variant:"Body_Looko",children:"ìì ëª
"}),r.jsx(D,{inputProps:{"aria-label":"ìì ëª
",style:{fontSize:"14px",height:"16px",margin:"0 12px",padding:"8px 0"}},placeholder:"ìì ëª
",size:"small",sx:{width:240,"& .MuiOutlinedInput-root":{height:32}},value:a.shopName??"",onChange:o=>n(l=>({...l,shopName:o.target.value===""?void 0:o.target.value}))})]}),r.jsxs(y,{alignItems:"center",gap:2,children:[r.jsx(h,{variant:"Body_Looko",children:"ì
ë¡ë í´ëëª
"}),r.jsx(D,{inputProps:{"aria-label":"ì
ë¡ë í´ëëª
",style:{fontSize:"14px",height:"16px",margin:"0 12px",padding:"8px 0"}},placeholder:"ì
ë¡ë í´ëëª
",size:"small",sx:{width:240,"& .MuiOutlinedInput-root":{height:32}},value:a.taskName??"",onChange:o=>n(l=>({...l,taskName:o.target.value===""?void 0:o.target.value}))})]})]}),r.jsxs(I,{label:"ì ì²ì¼",children:[r.jsx(y,{alignItems:"center",flexWrap:"wrap",gap:1.2,children:L.map(o=>r.jsx(W,{color:s===o.value?"primary":"secondary",label:o.label,variant:"outlined",onClick:()=>x(o.value)},o.value))}),r.jsx(re,{dateAdapter:oe,adapterLocale:"ko",children:r.jsxs(y,{alignItems:"center",gap:2,children:[r.jsx(w,{format:"YYYY.MM.DD",maxDate:u(a.to),slotProps:{textField:{size:"small",placeholder:"ì ì²ì¼ ìì",inputProps:{"aria-label":"ì ì²ì¼ ìì",style:{fontSize:"14px",height:"16px",padding:"12px"}},InputProps:{style:{height:32}},sx:{width:160}}},value:u(a.from),onChange:o=>{o!=null&&(n(l=>({...l,from:o.startOf("day").format()})),c(void 0))}}),r.jsx(h,{variant:"Body_Looko",children:"~"}),r.jsx(w,{format:"YYYY.MM.DD",minDate:u(a.from),slotProps:{textField:{size:"small",placeholder:"ì ì²ì¼ ì¢
ë£",inputProps:{"aria-label":"ì ì²ì¼ ì¢
ë£",style:{fontSize:"14px",height:"16px",padding:"12px"}},InputProps:{style:{height:32}},sx:{width:160}}},value:u(a.to),onChange:o=>{o!=null&&(n(l=>({...l,to:o.endOf("day").format()})),c(void 0))}})]})})]}),r.jsx(I,{label:"ë°°ì¹ ì²ë¦¬ ìí",children:r.jsx(ne,{row:!0,"aria-label":"ë°°ì¹ ì²ë¦¬ ìí",value:a.status??"",onChange:i,children:N.map(o=>r.jsx(ae,{label:o.label,value:o.value??""},o.value??"all"))})}),r.jsx(C,{alignItems:"center",display:"flex",height:56,justifyContent:"center",px:2,children:r.jsx(Q,{size:"large",widthSize:"small",onClick:d,children:"ê²ì"})})]})}
1class b extends Error{constructor(a,n,s={}){super(n,{cause:s.cause});T(this,"code");T(this,"stage");this.name="AIModelCutRecoveryError",this.code=s.code,this.stage=a}}function Se(t){var e,a;if(O.isAxiosError(t))return(a=(e=t.response)==null?void 0:e.data)==null?void 0:a.code}function S(t,e,a){return new b(t,e,{cause:a,code:Se(a)})}function Te(t){return`admin/vton-recovery/${t}.jsonl`}function ve(t){let e;try{e=decodeURIComponent(new URL(t).pathname).replace(/^\/+/,"")}catch(a){throw S("upload","AI 모ë¸ì»· 복구 ì
ë¡ë URL íìì´ ì¬ë°ë¥´ì§ ììµëë¤.",a)}if(e.length===0)throw new b("upload","AI 모ë¸ì»· 복구 ì
ë¡ë object keyê° ììµëë¤.");return e}async function Ie(t){var c;const e=Te(t.vtonBatchID);let a;try{a=await j.shops.presignedUrlsCreate(t.shopID,{preSignedURLs:[{path:e,contentType:"application/x-ndjson"}]})}catch(d){throw S("upload","AI 모ë¸ì»· 복구 ì
ë¡ë URL ìì²ì ì¤í¨íìµëë¤.",d)}const n=(c=a.data.preSignedURLs)==null?void 0:c[0];if(n==null)throw new b("upload","AI 모ë¸ì»· 복구 ì
ë¡ë URLì´ ììµëë¤.");const s=ve(n);try{await O.put(n,t.file,{headers:{"Content-Type":"application/x-ndjson"}})}catch(d){throw S("upload","AI 모ë¸ì»· 복구 íì¼ ì
ë¡ëì ì¤í¨íìµëë¤.",d)}try{await j.shops.tasksItemsRecoverVtonCreate(t.shopID,t.shopTaskID,{objectKey:s,vtonBatchID:t.vtonBatchID})}catch(d){throw S("recover","AI 모ë¸ì»· 복구 ìì²ì ì¤í¨íìµëë¤.",d)}}function je(){const t=G();return q({mutationFn:Ie,onSuccess:async()=>{await t.invalidateQueries({queryKey:A.list._def})},onError:async e=>{if(!(!(e instanceof b)||e.stage!=="recover"))switch(e.code){case"VTON_RECOVERY_IN_PROGRESS":await t.refetchQueries({queryKey:A.list._def});return;case"VTON_RECOVERY_OBJECT_INVALID":return;default:return}}})}function Ae({shopID:t,shopTaskID:e,vtonBatchID:a}){const n=m.useRef(null),{enqueueSnackbar:s}=E(),c=je(),d=()=>{n.current!=null&&(n.current.value="")},x=async i=>{var l;const o=(l=i.currentTarget.files)==null?void 0:l[0];if(o!=null){if(!o.name.toLowerCase().endsWith(".jsonl")){d(),s("íì¼ ì
ë¡ë ì¤í¨",{variant:"error"});return}try{await c.mutateAsync({shopID:t,shopTaskID:e,vtonBatchID:a,file:o}),s("복구 ìì² ìë£",{variant:"success"})}catch(f){if(f instanceof b&&f.stage==="recover")switch(f.code){case"VTON_RECOVERY_IN_PROGRESS":s("ëì¼í ë°°ì¹ì ë³µêµ¬ê° ì´ë¯¸ ì§í ì¤ì
ëë¤.",{variant:"warning"});return;case"VTON_RECOVERY_OBJECT_INVALID":s("복구 ìì² ì¤í¨",{variant:"error"});return;default:s("복구 ìì² ì¤í¨",{variant:"error"});return}s("íì¼ ì
ë¡ë ì¤í¨",{variant:"error"})}finally{d()}}};return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:n,accept:".jsonl,application/x-ndjson","aria-label":"복구 JSONL ì
ë¡ë",disabled:c.isPending,style:{display:"none"},type:"file",onChange:x}),r.jsx(ie,{disabled:c.isPending,size:"medium",sx:{color:"text.primary",fontSize:14,fontWeight:700,minWidth:100,p:0,textDecoration:"underline"},onClick:()=>{var i;return(i=n.current)==null?void 0:i.click()},children:"ì
ë¡ë"})]})}function De(t){switch(t){case"VTON_BATCH-STATUS_BEFORE-REQUEST":return{label:"ì ì¡ ë기ì¤",color:"neutral"};case"VTON_BATCH-STATUS_PROCESSING":return{label:"ìì± ì§íì¤",color:"success"};case"VTON_BATCH-STATUS_COMPLETED-WITH-DISPLAY-FAILURE":return{label:"ìì± ìë£ (ì ì ë
¸ì¶ ì¤í¨)",color:"error"};case"VTON_BATCH-STATUS_COMPLETED":return{label:"ìì± ìë£ (ì ì ë
¸ì¶)",color:"info"};default:return{label:t,color:"neutral"}}}function we(t){return t==="VTON_BATCH-STATUS_COMPLETED-WITH-DISPLAY-FAILURE"}u.extend($);u.extend(K);function Ne(t){const e=u(t);return e.isValid()?`(${e.tz("Asia/Seoul").format("YYYY-MM-DD")})`:t}function _e(t){const e=u(t);if(!e.isValid())return{date:t};const a=e.tz("Asia/Seoul");return{date:a.format("YYYY.MM.DD"),time:a.format("HH:mm:ss")}}function Be(t){switch(t){case"success":return"#00AC4C";case"error":return"error.main";case"info":return"primary.main";case"neutral":return"text.disabled"}}function Oe(t){const e=/^(.+?) (\(.+\))$/.exec(t);return e==null?[t]:[e[1],e[2]]}function Ee(t){return((t==null?void 0:t.vtonBatches)??[]).map(e=>({...e,id:e.vtonBatchID,batchID:e.vtonBatchID,requestDate:e.createDate,taskCreateDate:e.createDate,outputN
1ame:e.openAIBatchID}))}function Le({searchParams:t,setSearchParams:e,listResponse:a}){var x;const{enqueueSnackbar:n}=E(),s=m.useMemo(()=>Ee(a),[a]),c=m.useCallback(async i=>{try{await navigator.clipboard.writeText(i),n("ë³µì¬ëììµëë¤",{variant:"success"})}catch{n("ë³µì¬ì ì¤í¨íìµëë¤",{variant:"error"})}},[n]),d=m.useMemo(()=>[{field:"batchID",headerName:"ë°°ì¹ ID",width:80},{field:"requestDate",headerName:"ì ì²ì¼",width:120,renderCell:i=>{const o=_e(i.row.requestDate);return r.jsxs(g,{alignItems:"center",gap:0,height:"100%",justifyContent:"center",width:"100%",children:[r.jsx(h,{component:"span",variant:"Body_Looko",children:o.date}),o.time!=null&&r.jsx(h,{component:"span",variant:"Body_Looko",children:o.time})]})}},{field:"shopName",headerName:"ìì ëª ",width:160},{field:"taskName",headerName:"í´ëëª (ìì±ì¼)",width:200,renderCell:i=>r.jsxs(g,{alignItems:"center",gap:0,height:"100%",justifyContent:"center",width:"100%",children:[r.jsx(h,{component:"span",variant:"Body_Looko",children:i.row.taskName}),r.jsx(h,{component:"span",variant:"Body_Looko",children:Ne(i.row.taskCreateDate)})]})},{field:"requestedCount",headerName:"ìì² ê°ì",width:120},{field:"successFailureCount",headerName:"ì±ê³µ/ì¤í¨ ê°ì",width:120,renderCell:i=>`${i.row.successCount} / ${i.row.failureCount}`},{field:"status",headerName:"ì§í ìí",width:160,renderCell:i=>{const o=De(i.row.status);return r.jsx(g,{alignItems:"center","aria-label":o.label,gap:0,height:"100%",justifyContent:"center",width:"100%",children:Oe(o.label).map(l=>r.jsx(h,{color:Be(o.color),component:"span",fontWeight:700,variant:"Body_Looko",children:l},l))})}},{field:"outputName",headerName:"ë°°ì¹ outputëª ",width:160,renderCell:i=>{const o=i.row.outputName;return o==null?"-":r.jsxs(y,{alignItems:"center",gap:.5,minWidth:0,width:"100%",children:[r.jsx(h,{component:"span",flex:1,minWidth:0,noWrap:!0,overflow:"hidden",textOverflow:"ellipsis",variant:"Body_Looko",children:o}),r.jsx(J,{"aria-label":"ë°°ì¹ outputëª ë³µì¬",size:"small",sx:{p:.25},onClick:()=>void c(o),children:r.jsx(se,{sx:{fontSize:16}})})]})}},{field:"recoveryUpload",headerName:"ì§ì ì ë¡ëí기",sortable:!1,width:120,renderCell:i=>we(i.row.status)?r.jsx(Ae,{shopID:i.row.shopID,shopTaskID:i.row.shopTaskID,vtonBatchID:i.row.vtonBatchID}):"-"}].map(i=>({...i,align:"center",headerAlign:"center",disableColumnMenu:!0,editable:!1,filterable:!1,resizable:!1})),[c]);return r.jsx(g,{component:"section","aria-label":"AI 모ë¸ì»· ë°°ì¹ ëª©ë¡",bgcolor:"grey.100",flex:1,gap:0,minHeight:0,p:2,children:r.jsxs(g,{bgcolor:"white",flex:1,gap:0,minHeight:0,children:[r.jsx(C,{flex:1,minHeight:0,overflow:"auto",children:r.jsx(le,{columnHeaderHeight:32,columns:d,disableColumnFilter:!0,disableColumnMenu:!0,disableColumnSelector:!0,disableColumnSorting:!0,disableDensitySelector:!0,disableRowSelectionOnClick:!0,disableVirtualization:!0,hideFooter:!0,rowHeight:56,rows:s,sx:{"&.MuiDataGrid-root":{border:0,height:"100%",minWidth:1240},"& .MuiDataGrid-cell:focus-within":{outline:"none"},"& .MuiDataGrid-columnHeaderTitle":{fontWeight:700},"& .MuiDataGrid-columnSeparator":{display:"none"},borderRadius:0}})}),r.jsx(ce,{component:"div",count:((x=a==null?void 0:a.pagination)==null?void 0:x.totalCount)??0,labelDisplayedRows:({from:i,to:o,count:l})=>`${i}-${o} of ${l}`,page:t.pageNumber-1,rowsPerPage:t.pageSize,rowsPerPageOptions:[],sx:{flexShrink:0,height:52,"& .MuiTablePagination-displayedRows":{margin:0},"& .MuiTablePagination-toolbar":{minHeight:52,px:1}},onPageChange:(i,o)=>e({pageNumber:o+1})})]})})}function ke(){const{searchParams:t,setSearchParams:e}=ye(),a=m.useMemo(()=>xe(t),[t]),{data:n,isError:s,isPending:c}=Ce(a);return r.jsxs(g,{flex:1,gap:0,minHeight:0,children:[r.jsx(be,{searchParams:t,setSearchParams:e}),c?r.jsxs(g,{alignItems:"center",bgcolor:"grey.100",flex:1,gap:1,justifyContent:"center",children:[r.jsx(ee,{size:24}),r.jsx(h,{role:"status",variant:"Body_Looko",children:"ë°°ì¹ ëª©ë¡ì ë¶ë¬ì¤ë ì¤ì ëë¤."})]}):s?r.jsx(C,{bgcolor:"grey.100",flex:1,p:2,children:r.jsx(te,{severity:"error",children:"ë°°ì¹ ëª©ë¡ì ë¶ë¬ì¤ì§ 못íìµëë¤."})}):r.jsx(Le,{listResponse:n,searchParams:t,setSearchParams:e})]})}function rt(){return r.jsx(Z,{roles:[X],children:r.jsxs(v,{height:"100%",width:"100%",children:[r.jsx(v.Header,{"data-testid":"ai-model-cut-batch-page-header",title:"AI 모ë¸ì»· ë°°ì¹ ìì ê´ë¦¬"}),r.jsx(v.Body,{bgcolor:"grey.100",flex:1,gap:0,minHeight:0,p:0,children:r.jsx(ke,{})})]})})}export{rt as default}; 2//# sourceMappingURL=AIModelCutBatchPage-CAzzXqfA.js.map
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.