(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,75056,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(38149),l=e.i(23975);async function r(t,s){let a=await e.A(25834);a.GlobalWorkerOptions.workerSrc="/pdf.worker.min.js";let l=await t.arrayBuffer(),r=await a.getDocument({data:l}).promise,n=r.numPages,o=[];for(let e=1;e<=n;e++){let t=await r.getPage(e),a=await t.getTextContent(),l=null,d="";for(let e of a.items){if(!("str"in e))continue;let t=e.transform[5];null!==l&&Math.abs(t-l)>5&&(d+="\n"),d+=e.str,l=t}o.push({page:e,text:d.trim()}),s?.(e,n)}return o}var n=e.i(11110);function o(){let[e,o]=(0,s.useState)(null),[i,c]=(0,s.useState)(!1),[x,h]=(0,s.useState)(null),[m,u]=(0,s.useState)([]),[b,p]=(0,s.useState)("all"),[g,k]=(0,s.useState)(0),[j,v]=(0,s.useState)(!1),{tl:f}=(0,n.useLanguage)(),N=f.text.content,w=(0,s.useCallback)(e=>{o(e[0]),u([]),h(null)},[]),y=async()=>{if(e){c(!0),u([]);try{let t=await r(e,(e,t)=>h({current:e,total:t}));u(t)}catch(e){console.error(e),alert(f.text.error)}finally{c(!1),h(null)}}},L=m.length>0?m.map(e=>`=== 페이지 ${e.page} === ${e.text}`).join("\n\n"):"",C=async()=>{let e="all"===b?L:m[g]?.text??"";await navigator.clipboard.writeText(e),v(!0),setTimeout(()=>v(!1),2e3)},B="all"===b?L:m[g]?.text??"",M=m.length>0&&""===B.trim();return(0,t.jsxs)(a.default,{title:f.text.title,description:f.text.desc,color:"blue",icon:(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-7 h-7 text-white",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),children:[e?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-xl px-4 py-3",children:[(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-5 h-5 text-red-500 flex-shrink-0",fill:"currentColor",children:(0,t.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z"})}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)("p",{className:"text-sm font-medium text-slate-700 dark:text-slate-200 truncate",children:e.name})}),(0,t.jsx)("button",{onClick:()=>{o(null),u([])},className:"text-slate-400 hover:text-red-500",children:(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i&&(0,t.jsxs)("div",{className:"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between text-xs text-slate-500 dark:text-slate-400 mb-2",children:[(0,t.jsx)("span",{children:f.text.extracting}),x&&(0,t.jsxs)("span",{children:[x.current," / ",x.total," ",f.common.pages]})]}),(0,t.jsx)("div",{className:"bg-slate-100 dark:bg-slate-700 rounded-full h-2 overflow-hidden",children:(0,t.jsx)("div",{className:"h-2 bg-blue-500 rounded-full transition-all duration-200",style:{width:x?`${x.current/x.total*100}%`:"10%"}})})]}),m.length>0&&(0,t.jsxs)("div",{className:"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-slate-100 dark:border-slate-700 bg-slate-50 dark:bg-slate-900/50",children:[(0,t.jsxs)("div",{className:"flex bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-600 rounded-lg p-0.5 mr-2",children:[(0,t.jsx)("button",{onClick:()=>p("all"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${"all"===b?"bg-blue-600 text-white":"text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,children:f.text.allPages}),(0,t.jsx)("button",{onClick:()=>p("page"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${"page"===b?"bg-blue-600 text-white":"text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,children:f.text.byPage})]}),"page"===b&&(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{onClick:()=>k(e=>Math.max(0,e-1)),disabled:0===g,className:"p-1 rounded hover:bg-slate-200 dark:hover:bg-slate-700 disabled:opacity-30",children:(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),(0,t.jsxs)("span",{className:"text-xs text-slate-600 dark:text-slate-300 min-w-[60px] text-center",children:[g+1," / ",m.length]}),(0,t.jsx)("button",{onClick:()=>k(e=>Math.min(m.length-1,e+1)),disabled:g===m.length-1,className:"p-1 rounded hover:bg-slate-200 dark:hover:bg-slate-700 disabled:opacity-30",children:(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)("button",{onClick:C,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-slate-600 dark:text-slate-300 border border-slate-200 dark:border-slate-600 rounded-lg hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors",children:j?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5 text-green-600",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})," ",f.text.copied]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})," ",f.text.copy]})}),(0,t.jsxs)("button",{onClick:()=>{let t=new Blob([L],{type:"text/plain;charset=utf-8"}),s=URL.createObjectURL(t),a=document.createElement("a");a.href=s,a.download=(e?.name??"extracted").replace(/\.pdf$/i,".txt"),a.click(),URL.revokeObjectURL(s)},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors",children:[(0,t.jsx)("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),f.text.saveTxt]})]}),(0,t.jsx)("div",{className:"relative",children:M?(0,t.jsxs)("div",{className:"p-8 text-center text-slate-400 dark:text-slate-500",children:[(0,t.jsx)("p",{className:"text-sm",children:f.text.noText}),(0,t.jsx)("p",{className:"text-xs mt-1",children:f.text.noTextHint})]}):(0,t.jsx)("textarea",{readOnly:!0,value:B,className:"w-full h-72 px-4 py-3 text-sm text-slate-700 dark:text-slate-200 font-mono resize-none focus:outline-none bg-white dark:bg-slate-800",spellCheck:!1})}),(0,t.jsxs)("div",{className:"px-4 py-2 border-t border-slate-100 dark:border-slate-700 bg-slate-50 dark:bg-slate-900/50 flex gap-4 text-xs text-slate-400 dark:text-slate-500",children:[(0,t.jsxs)("span",{children:[m.length," ",f.common.pages]}),(0,t.jsx)("span",{children:f.text.charCount.replace("{n}",L.length.toLocaleString())}),(0,t.jsx)("span",{children:f.text.wordCount.replace("{n}",L.trim().split(/\s+/).filter(Boolean).length.toLocaleString())})]})]}),0===m.length&&(0,t.jsx)("button",{onClick:y,disabled:i,className:"w-full py-3 bg-blue-600 text-white font-semibold rounded-xl hover:bg-blue-700 disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 12a8 8 0 018-8v8z"})}),f.text.processing]}):f.text.extractBtn}),m.length>0&&(0,t.jsx)("button",{onClick:()=>{o(null),u([])},className:"w-full py-2.5 border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 text-sm rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors",children:f.text.newFile})]}):(0,t.jsx)(l.default,{onFiles:w,label:f.text.dropLabel}),(0,t.jsxs)("div",{className:"space-y-12 mt-12",children:[(0,t.jsx)(d,{title:N.howTo.title,children:(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-5",children:N.howTo.steps.map((e,s)=>(0,t.jsxs)("div",{className:"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl p-5",children:[(0,t.jsxs)("div",{className:"font-bold text-lg text-slate-400 dark:text-slate-500 mb-2",children:["0",s+1]}),(0,t.jsx)("h3",{className:"font-semibold text-slate-800 dark:text-slate-100 mb-1",children:e.title}),(0,t.jsx)("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:e.desc})]},s))})}),(0,t.jsxs)(d,{title:N.about.title,children:[(0,t.jsx)("p",{className:"text-slate-500 dark:text-slate-400 mb-6",children:N.about.description}),(0,t.jsx)("div",{className:"space-y-5",children:N.about.methods.map((e,s)=>(0,t.jsxs)("div",{className:"bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-slate-700 rounded-xl p-5",children:[(0,t.jsx)("h3",{className:"font-semibold text-slate-800 dark:text-slate-100 mb-1",children:e.title}),(0,t.jsx)("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:e.desc})]},s))})]}),(0,t.jsx)(d,{title:N.faq.title,children:(0,t.jsx)("div",{className:"space-y-4",children:N.faq.items.map((e,s)=>(0,t.jsxs)("details",{className:"bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-slate-700 rounded-xl p-4 cursor-pointer",children:[(0,t.jsx)("summary",{className:"font-semibold text-slate-800 dark:text-slate-100",children:e.q}),(0,t.jsx)("p",{className:"text-sm text-slate-500 dark:text-slate-400 mt-2",children:e.a})]},s))})})]})]})}function d({title:e,children:s}){return(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-slate-800 dark:text-slate-100 text-center mb-6",children:e}),s]})}e.s(["default",()=>o],75056)},25834,e=>{e.v(t=>Promise.all(["static/chunks/46b334ca3410349e.js","static/chunks/d125a3694ba40e5d.js"].map(t=>e.l(t))).then(()=>t(18657)))}]);