(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,939824,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(438149),l=e.i(623975),s=e.i(621274),d=e.i(185665);e.i(989308);var i=e.i(575954),n=e.i(376071),o=e.i(27003),c=e.i(788477);async function x(e,t){let a,r,l=await e.arrayBuffer(),s=await i.PDFDocument.load(l),d=s.getPages();for(let e of("text"===t.type?a=await s.embedFont(n.StandardFonts.HelveticaBold):r="png"===t.imageFormat?await s.embedPng(t.imageBytes):await s.embedJpg(t.imageBytes),d))!function(e,t,a,r){let{width:l,height:s}=e.getSize(),d=function(e,t,a,r){if("text"===t.type&&a)return{w:a.widthOfTextAtSize(t.text,t.fontSize),h:t.fontSize};if("image"===t.type&&r){let a=e.getWidth()*t.scale,l=r.height/r.width*a;return{w:a,h:l}}return{w:0,h:0}}(e,t,a,r);if("center"===t.arrangement)return m(e,l/2,s/2,t,a,r,d);let i=Math.max(1.6*d.w,10),n=Math.max(1.6*d.h,10);for(let o=n/2;o{o(e[0]),I(!1),W(null),D(null)},[]),q=(0,a.useCallback)(e=>{B(e[0]),I(!1),W(null)},[]),U=async()=>{if(n){if("text"===c&&!h.trim())return void W(e.watermark.needText);if("image"===c&&!L)return void W(e.watermark.needImage);F(!0),W(null);try{let e;if("text"===c){let t;e=await x(n,{type:"text",text:h,fontSize:p,color:{r:((t=parseInt(j.replace("#",""),16))>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255},opacity:w/100,rotation:N,arrangement:C})}else{let t=new Uint8Array(await L.arrayBuffer()),a="image/png"===L.type?"png":"jpg";e=await x(n,{type:"image",imageBytes:t,imageFormat:a,scale:M/100,opacity:w/100,rotation:N,arrangement:C})}D(e),I(!0)}catch(a){console.error(a);let t=a instanceof Error?a.message:String(a);W(t?`${e.watermark.error} (${t})`:e.watermark.error)}finally{F(!1)}}},E=()=>{o(null),B(null),I(!1),W(null),D(null)};return(0,t.jsxs)(r.default,{title:e.watermark.title,description:e.watermark.desc,color:"blue",icon:(0,t.jsxs)("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:"M12 4l8 4v6c0 4.4-3.4 8-8 8s-8-3.6-8-8V8l8-4z"}),(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]}),children:[n?(0,t.jsxs)("div",{className:"space-y-5",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:n.name})}),(0,t.jsx)("button",{onClick:E,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"})})})]}),!P&&(0,t.jsxs)("div",{className:"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl p-4 space-y-4",children:[(0,t.jsx)("div",{className:"flex gap-2",children:["text","image"].map(a=>(0,t.jsx)("button",{onClick:()=>m(a),className:`flex-1 py-2 text-sm font-medium rounded-lg border transition-colors ${c===a?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"border-slate-200 dark:border-slate-600 text-slate-500 dark:text-slate-400 hover:border-slate-300"}`,children:"text"===a?e.watermark.modeText:e.watermark.modeImage},a))}),"text"===c?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-slate-700 dark:text-slate-200 mb-1.5",children:e.watermark.textLabel}),(0,t.jsx)("input",{type:"text",value:h,onChange:e=>g(e.target.value),placeholder:e.watermark.textPlaceholder,className:"w-full border border-slate-300 dark:border-slate-600 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-slate-700 text-slate-700 dark:text-slate-200"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs text-slate-500 dark:text-slate-400 mb-1.5",children:[e.watermark.fontSizeLabel,": ",p]}),(0,t.jsx)("input",{type:"range",min:12,max:120,value:p,onChange:e=>k(Number(e.target.value)),className:"w-full"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-slate-500 dark:text-slate-400 mb-1.5",children:e.watermark.colorLabel}),(0,t.jsx)("input",{type:"color",value:j,onChange:e=>f(e.target.value),className:"w-full h-9 rounded-lg border border-slate-300 dark:border-slate-600"})]})]})]}):(0,t.jsxs)("div",{className:"space-y-3",children:[L?(0,t.jsxs)("div",{className:"flex items-center gap-3 bg-slate-50 dark:bg-slate-700 border border-slate-200 dark:border-slate-600 rounded-lg px-3 py-2",children:[(0,t.jsx)("p",{className:"text-sm text-slate-700 dark:text-slate-200 truncate flex-1",children:L.name}),(0,t.jsx)("button",{onClick:()=>B(null),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"})})})]}):(0,t.jsx)(l.default,{onFiles:q,accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg"]},label:e.watermark.imageDropLabel,color:"blue"}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs text-slate-500 dark:text-slate-400 mb-1.5",children:[e.watermark.imageSizeLabel,": ",M,"%"]}),(0,t.jsx)("input",{type:"range",min:5,max:80,value:M,onChange:e=>T(Number(e.target.value)),className:"w-full"})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs text-slate-500 dark:text-slate-400 mb-1.5",children:[e.watermark.opacityLabel,": ",w,"%"]}),(0,t.jsx)("input",{type:"range",min:5,max:100,value:w,onChange:e=>v(Number(e.target.value)),className:"w-full"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs text-slate-500 dark:text-slate-400 mb-1.5",children:[e.watermark.rotationLabel,": ",N,"°"]}),(0,t.jsx)("input",{type:"range",min:-90,max:90,value:N,onChange:e=>y(Number(e.target.value)),className:"w-full"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-400 mb-1.5",children:e.watermark.arrangementLabel}),(0,t.jsx)("div",{className:"flex gap-2",children:["center","tile"].map(a=>(0,t.jsx)("button",{onClick:()=>S(a),className:`flex-1 py-2 text-sm font-medium rounded-lg border transition-colors ${C===a?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"border-slate-200 dark:border-slate-600 text-slate-500 dark:text-slate-400 hover:border-slate-300"}`,children:"center"===a?e.watermark.arrangementCenter:e.watermark.arrangementTile},a))})]})]}),A&&(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg px-3 py-2",children:A}),(0,t.jsx)("div",{className:"flex gap-3",children:P?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>{$&&n&&(0,u.downloadBytes)($,n.name.replace(/\.pdf$/i,"_watermarked.pdf"))},className:"flex-1 py-3 bg-blue-600 text-white font-semibold rounded-xl hover:bg-blue-700 transition-colors whitespace-nowrap",children:e.watermark.downloadBtn}),(0,t.jsx)("button",{onClick:E,className:"px-4 py-3 border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors",children:e.watermark.reset})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:U,disabled:z,className:"flex-1 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 whitespace-nowrap",children:z?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("svg",{className:"w-4 h-4 animate-spin flex-shrink-0",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"})}),e.watermark.processing]}):e.watermark.applyBtn}),(0,t.jsx)("button",{onClick:E,className:"px-4 py-3 border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors",children:e.watermark.reset})]})}),P&&(0,t.jsx)(s.default,{})]}):(0,t.jsx)(l.default,{onFiles:O,label:e.watermark.dropLabel,color:"blue"}),(0,t.jsxs)("div",{className:"space-y-12 mt-12",children:[(0,t.jsx)(d.default,{title:i.howTo.title,children:(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-5",children:i.howTo.steps.map((e,a)=>(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",a+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})]},a))})}),(0,t.jsxs)(d.default,{title:i.about.title,children:[(0,t.jsx)("p",{className:"text-slate-500 dark:text-slate-400 mb-6",children:i.about.description}),(0,t.jsx)("div",{className:"space-y-5",children:i.about.methods.map((e,a)=>(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})]},a))})]}),(0,t.jsx)(d.default,{title:i.faq.title,children:(0,t.jsx)("div",{className:"space-y-4",children:i.faq.items.map((e,a)=>(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})]},a))})})]})]})}e.s(["default",()=>h],939824)},495004,e=>{e.v(t=>Promise.all(["static/chunks/6e8c2bde32d332ac.js","static/chunks/d77cd27b31cfaf9d.js"].map(t=>e.l(t))).then(()=>t(871315)))}]);