1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[65397],{65397:(e,a,i)=>{i.r(a),i.d(a,{RawMakerArchiveDialog:()=>f});var s=i(18756),t=i(57802),r=i(26760),l=i(53897),n=i(95662),d=i(26565),c=i(7394),o=i(18889),m=i(47970),h=i(45094),x=i(95128);let u=new Intl.DateTimeFormat("ko-KR",{dateStyle:"medium",timeStyle:"short"});function f(e){let{onReuse:a,history:i=!1,disabled:f=!1}=e,[j,g]=(0,r.useState)(!1),[p,v]=(0,r.useState)([]),[w,y]=(0,r.useState)(null),[N,k]=(0,r.useState)(!1),[C,b]=(0,r.useState)(""),[S,E]=(0,r.useState)(null),z=(0,r.useCallback)(async e=>{k(!0),b("");try{let a=new URLSearchParams(i?"history=1":"");void 0!==e&&a.set("cursor",String(e));let s=await fetch("/api/threads/raw-maker/images?".concat(a)),t=await s.json().catch(()=>null);if(!s.ok||!Array.isArray(null==t?void 0:t.images))throw Error("load_failed");v(a=>e?[...a,...t.images]:t.images),y("number"==typeof t.nextCursor||"string"==typeof t.nextCursor?t.nextCursor:null)}catch(e){b("ì ì¥í ì¬ì§ì ë¶ë¬ì¤ì§ 못íì´ì.")}finally{k(!1)}},[i]);(0,r.useEffect)(()=>{j&&z()},[z,j]);let $=async e=>{var a;let i=null==(a=window.prompt("ì¬ì§ ì´ë¦",e.title||"ë ê² ì´ë¯¸ì§"))?void 0:a.trim();if(i&&i!==e.title){E(e.id);try{let a=await fetch("/api/threads/raw-maker/images/".concat(e.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})}),s=await a.json().catch(()=>null);if(!a.ok||!(null==s?void 0:s.image))throw Error("rename_failed");v(a=>a.map(a=>a.id===e.id?s.image:a)),x.o.success("ì¬ì§ ì´ë¦ì ë°ê¿¨ì´ì")}catch(e){x.o.error("ì¬ì§ ì´ë¦ì ë°ê¾¸ì§ 못íì´ì.")}finally{E(null)}}},_=async e=>{if(window.confirm("ì´ ì¬ì§ì ë³´ê´í¨ìì ìì í ê¹ì? ëë릴 ì ìì´ì.")){E(e.id);try{if(!(await fetch("/api/threads/raw-maker/images/".concat(e.id),{method:"DELETE"})).ok)throw Error("delete_failed");v(a=>a.filter(a=>a.id!==e.id)),x.o.success("ì¬ì§ì ìì íì´ì")}catch(e){x.o.error("ì¬ì§ì ìì íì§ ëª»íì´ì.")}finally{E(null)}}},R=async e=>{E(e.id);try{await a(e.imageUrl),g(!1)}catch(e){x.o.error(e instanceof Error?e.message:"ì¬ì§ì ìì
ì¤ë¡ ë¶ë¬ì¤ì§ 못íì´ì.")}finally{E(null)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(m.$,{variant:"outline",size:"sm",disabled:f,onClick:()=>g(!0),children:[(0,s.jsx)(l.T,{"aria-hidden":!0}),i?"ì´ì ì ë§ë ì¬ì§":"ìì±í ì¬ì§ë¤ 보기"]}),(0,s.jsx)(h.lG,{open:j,onOpenChange:g,children:(0,s.jsxs)(h.Cf,{className:"flex max-h-[88dvh] flex-col overflow-hidden rounded-[20px] sm:max-w-5xl",children:[(0,s.jsxs)(h.c7,{children:[(0,s.jsx)(h.L3,{children:i?"ì´ì ì ë§ë ì¬ì§":"ìì±í ì¬ì§ë¤"}),(0,s.jsx)(h.rr,{children:i?"ì¤íëì¤ì ë ê² ë©ì´ì»¤ìì ìì±í ì¬ì§ì ë¤ì 첨ë¶í´ì. í¬ë ë§ì ë¤ì§ ììì.":"ë ê² ë©ì´ì»¤ë¡ ë§ë ì¬ì§ì ìëì¼ë¡ ì¬ê¸°ì ì ì¥ë¼ì."})]}),(0,s.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[C?(0,s.jsxs)("div",{className:"flex min-h-48 flex-col items-center justify-center gap-3 text-center",role:"alert",children:[(0,s.jsx)("p",{className:"text-sm text-destructive",children:C}),(0,s.jsxs)(m.$,{variant:"outline",onClick:()=>void z(),children:[(0,s.jsx)(n.P,{"aria-hidden":!0}),"ë¤ì ìë"]})]}):0!==p.length||N?(0,s.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:p.map(e=>{let a=e.title||(i?"ìì±í ì¬ì§":"ë ê² ì´ë¯¸ì§"),r="/api/reels/download?url=".concat(encodeURIComponent(e.imageUrl),"&filename=").concat(encodeURIComponent("".concat(a,".jpg")));return(0,s.jsxs)("article",{className:"overflow-hidden rounded-xl border border-border bg-card",children:[(0,s.jsx)("div",{className:"relative aspect-square bg-muted",children:(0,s.jsx)(t.default,{src:e.imageUrl,alt:a,fill:!0,unoptimized:!0,className:"object-cover"})}),(0,s.jsxs)("div",{className:"space-y-3 p-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h3",{className:"truncate text-sm font-bold text-foreground",children:a}),(0,s.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:[u.format(new Date(e.createdAt))," \xb7 ",e.aspectRatio]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsx)(m.$,{size:"sm",disabled:null!==S,onClick:()=>void R(e),children:"ë¤ì ì¬ì©í기"}),(0,s.jsx)(m.$,{asChild:!0,size:"sm",variant:"outline",children:(0,s.jsxs)("a",{href:r,children:[(0,s.jsx)(d.z,{"aria-hidden":!0}),"ë¤ì´ë¡ë"]})}),!i&&(0,s.jsxs)(m.$,{size:"sm",variant:"ghost",disabled:null!==S,onClick:()=>void $(e),children:[(0,s.jsx)(c.g,{"aria-hidden":!0}),"ì´ë¦ ë³ê²½"]}),!i&&(0,s.jsxs)(m.$,{size:"sm",variant:"destructive",disabled:null!==S,onClick:()=>void _(e),children:[(0,s.jsx)(o.l,{"aria-hidden":!0}),"ìì "]})]})]})]},e.id)})}):(0,s.jsxs)("div",{className:"flex min-h-48 flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[(0,s.jsx)(l.T,{className:"size-8","aria-hidden":!0}),(0,s.jsx)("p",{className:"text-sm",children:"ìì§ ì ì¥ë ì¬ì§ì´ ìì´ì."})]}),null!==w&&!C&&(0,s.jsx)("div",{className:"flex justify-center pt-5",children:(0,s.jsx)(m.$,{variant:"outline",disabled:N,onClick:()=>void z(w),children:N?"ë¶ë¬ì¤ë ì¤":"ë 보기"})}),N&&0===p.length&&(0,s.jsx)("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"ì ì¥í ì¬ì§ì ë¶ë¬ì¤ë ì¤ì´ìì."})]})]})})]})}}}]);
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.