PageSourceSearch

https://imagesplitter.tools/_next/static/chunks/6958.ecd96b5b88c1f227.js

js imagesplitter.tools collected 2026-10-08 17:08:07 UTC 17,204 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6958],{18298:(e,t,n)=>{n.d(t,{s:()=>s,t:()=>l});var r=n(68786);function a(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function l(...e){return t=>{let n=!1,r=e.map(e=>{let r=a(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():a(e[t],null)}}}}function s(...e){return r.useCallback(l(...e),e)}},33154:(e,t,n)=>{n.d(t,{DX:()=>i,Dc:()=>c,TL:()=>s});var r=n(68786),a=n(18298),l=n(58682);function s(e){let t=function(e){let t=r.forwardRef((e,t)=>{let{children:n,...l}=e;if(r.isValidElement(n)){var s;let e,i,o=(s=n,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),c=function(e,t){let n={...t};for(let r in t){let a=e[r],l=t[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...e)=>{let t=l(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...l}:"className"===r&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}(l,n.props);return n.type!==r.Fragment&&(c.ref=t?(0,a.t)(t,o):o),r.cloneElement(n,c)}return r.Children.count(n)>1?r.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}(e),n=r.forwardRef((e,n)=>{let{children:a,...s}=e,i=r.Children.toArray(a),o=i.find(d);if(o){let e=o.props.children,a=i.map(t=>t!==o?t:r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null);return(0,l.jsx)(t,{...s,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,a):null})}return(0,l.jsx)(t,{...s,ref:n,children:a})});return n.displayName=`${e}.Slot`,n}var i=s("Slot"),o=Symbol("radix.slottable");function c(e){let t=({children:e})=>(0,l.jsx)(l.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=o,t}function d(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===o}},56958:(e,t,n)=>{n.r(t),n.d(t,{PdfMetadataRemover:()=>M,default:()=>T});var r=n(58682),a=n(68786),l=n(96243),s=n(44801),i=n.n(s),o=n(1715),c=n(84498),d=n(38356),u=n(33350),f=n(61132),m=n(72047),p=n(53694),x=n(17309),g=n(29461),h=n(97692),v=n(17845),y=n(80806),b=n(5960);let j=["Title","Author","Subject","Keywords","Creator","Producer"],N=["Producer","CreationDate","ModDate","Creator"],D=["Producer","Creator","Author","Subject","Keywords","CreationDate","ModDate","Title"],k=/^(AIPDFPrivateData|AIMetaData|PieceInfo)/i,w=["Adobe Illustrator","Adobe Photoshop","CorelDRAW"],P=e=>new TextDecoder("latin1").decode(e);function F(e){let t=e.keys().map(e=>e.asString().replace("/",""));return N.filter(e=>t.includes(e)).length>=2}function _(e){let t=e.context,n=new Set,r=0,a=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!(e instanceof b.PDFRef)||l>200)return;let s=e.toString();if(n.has(s))return;n.add(s);let i=t.lookup(e);i instanceof b.PDFDict&&(i.get(b.PDFName.of("Title"))&&(r+=1),a(i.get(b.PDFName.of("First")),l+1),a(i.get(b.PDFName.of("Next")),l+1))},l=e.catalog.get(b.PDFName.of("Outlines"));if(l instanceof b.PDFRef){let e=t.lookup(l);e instanceof b.PDFDict&&a(e.get(b.PDFName.of("First")))}return r}async function C(e){let t,n={entries:[],pageCount:0,outlineCount:0,streamResidue:!1,failed:!0};if(e.length<5||"%PDF-"!==P(e.subarray(0,5)))return{...n,reason:"invalid"};try{t=await b.PDFDocument.load(e,{updateMetadata:!1})}catch(t){let e=String(t);return{...n,reason:/encrypt/i.test(e)?"encrypted":"invalid"}}let r=[];for(let e of j){let n;try{n=t["get".concat(e)]()}catch(e){n=void 0}null!=n&&""!==String(n)&&r.push({key:e,value:String(n),scope:"document"})}for(let e of["CreationDate","ModificationDate"]){let n;try{n=t["get".concat(e)]()}catch(e){n=void 0}n instanceof Date&&!Number.isNaN(n.getTime())&&r.push({key:e,value:n.toISOString().replace("T"," ").slice(0,19),scope:"document"})}for(let[,e]of t.context.enumerateIndirectObjects())if(e instanceof b.PDFDict){if(F(e))for(let t of e.keys()){let n=t.asString().replace("/","");if(!D.includes(n))continue;let a=function(e){var t,n;return(null!=(n=null==e||null==(t=e.toString)?void 0:t.call(e))?n:"").replace(/^\(|\)$/g,"").trim()}(e.get(t));a&&r.push({key:n,value:a,scope:"embedded"})}for(let t of e.keys()){let e=t.asString().replace("/","");k.test(e)&&r.push({key:e,value:"",scope:"private"})}}let a=P(e),l=w.some(e=>a.includes(e));return{entries:r,pageCount:t.getPageCount(),outlineCount:_(t),streamResidue:l,failed:!1}}async function A(e){let t;if(e.length<5||"%PDF-"!==P(e.subarray(0,5)))return null;try{t=await b.PDFDocument.load(e,{updateMetadata:!1})}catch(e){return null}let n=t.context,r=new Set;for(let[,e]of n.enumerateIndirectObjects()){if(!(e instanceof b.PDFDict))continue;if(F(e))for(let t of e.keys())D.includes(t.asString().replace("/",""))&&e.delete(t);for(let t of e.keys())k.test(t.asString().replace("/",""))&&(!function e(t,n,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(n&&!(a>40)){if(n instanceof b.PDFRef){r.add(n.toString()),e(t,t.lookup(n),r,a+1);return}if(n instanceof b.PDFArray){for(let l=0;l<n.size();l+=1)e(t,n.get(l),r,a+1);return}if(n instanceof b.PDFDict)for(let l of n.keys())e(t,n.get(l),r,a+1)}}(n,e.get(t),r),e.delete(t));let t=e.get(b.PDFName.of("Type"));(null==t?void 0:t.toString())==="/Annot"&&e.get(b.PDFName.of("T"))&&e.delete(b.PDFName.of("T"))}t.catalog.delete(b.PDFName.of("Metadata"));let a=n.trailerInfo.Info;for(let[e]of(a&&(n.delete(a),delete n.trailerInfo.Info),n.enumerateIndirectObjects()))r.has(e.toString())&&n.delete(e);try{return await t.save()}catch(e){return null}}async function S(e){let t,n={data:e,bytesRemoved:0,ok:!1};try{t=await b.PDFDocument.load(e,{updateMetadata:!1})}catch(e){return n}let r=t.getPageCount(),a=_(t),l=await A(e);if(!l||0===l.length)return n;try{let e=await b.PDFDocument.load(l,{updateMetadata:!1});if(e.getPageCount()!==r||_(e)!==a||0!==function(e){let t=0;for(let[,n]of e.context.enumerateIndirectObjects())if(n instanceof b.PDFDict)for(let r of n.keys()){let a=n.get(r);a instanceof b.PDFRef&&!e.context.lookup(a)&&(t+=1)}return t}(e))return n}catch(e){return n}return{data:l,bytesRemoved:Math.max(0,e.length-l.length),ok:!0}}function R(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(2*(0!==t))," ").concat(["B","KB","MB","GB"][t])}function I(e,t){let n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function O(e){let t=e.lastIndexOf(".");return t<=0?"".concat(e,"-cleaned"):"".concat(e.slice(0,t),"-cleaned").concat(e.slice(t))}function M(){let e=(0,l.c3)("remove_pdf_metadata"),[t,n]=a.useState([]),[s,f]=a.useState(!1),[m,p]=a.useState(!1),[x,g]=a.useState(null),h=a.useRef(null),b=a.useCallback(async r=>{g(null);let a=Array.from(r);if(0===a.length)return;let l=[];for(let t of a){if(t.size>0x3200000){g(e("error.file_too_large",{size:50}));continue}l.push(t)}if(0===l.length)return;let s=20-t.length;if(s<=0)return void g(e("error.too_many_files",{count:20}));let i=l.slice(0,s);l.length>s&&g(e("error.too_many_files",{count:20}));let o=i.map((e,t)=>({id:"".concat(Date.now(),"-").concat(t,"-").concat(e.name),file:e,status:"scanning",scan:null,cleanedBlob:null,bytesRemoved:0,expanded:!1}));n(e=>[...e,...o]),await Promise.all(o.map(async e=>{let t=new Uint8Array(await e.file.arrayBuffer()),r=await C(t);n(t=>t.map(t=>t.id===e.id?{...t,scan:r,status:"ready"}:t))}))},[t.length,e]),j=async()=>{if(0===t.length||m)return;p(!0),g(null);let r=[];for(let e of t){var a;if(null==(a=e.scan)?void 0:a.failed){n(t=>t.map(t=>t.id===e.id?{...t,status:"failed"}:t));continue}try{let t=new Uint8Array(await e.file.arrayBuffer()),a=await S(t);if(!a.ok){n(t=>t.map(t=>t.id===e.id?{...t,status:"failed"}:t));continue}let l=new Blob([a.data],{type:"application/pdf"});r.push({item:e,blob:l}),n(t=>t.map(t=>t.id===e.id?{...t,status:"cleaned",cleanedBlob:l,bytesRemoved:a.bytesRemoved}:t))}catch(t){n(t=>t.map(t=>t.id===e.id?{...t,status:"failed"}:t))}}try{if(1===r.length)I(r[0].blob,O(r[0].item.file.name));else if(r.length>1){let e=new(i());for(let{item:t,blob:n}of r)e.file(O(t.file.name),n);let t=await e.generateAsync({type:"blob"});I(t,"imagesplitter.tools-pdf-cleaned.zip")}}catch(t){g(e("error.download_failed"))}finally{p(!1)}};return(0,r.jsxs)("div",{className:"container mx-auto px-4 py-8",children:[(0,r.jsxs)("div",{onDragOver:e=>{e.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:e=>{var t;e.preventDefault(),f(!1),(null==(t=e.dataTransfer.files)?void 0:t.length)&&b(e.dataTransfer.files)},onClick:()=>{var e;return null==(e=h.current)?void 0:e.click()},className:(0,v.cn)("flex cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed px-6 py-12 transition-colors",s?"border-primary bg-primary/5":"border-border/60 hover:border-primary/60 hover:bg-accent/40"),children:[(0,r.jsx)(o.A,{className:"text-muted-foreground mb-3 h-8 w-8"}),(0,r.jsx)("p",{className:"text-sm font-medium",children:s?e("upload.drop_here"):e("upload.title")}),(0,r.jsx)("p",{className:"text-muted-foreground mt-1 text-xs",children:e("upload.description")}),(0,r.jsxs)("p",{className:"text-muted-foreground mt-3 text-xs",children:["PDF \xb7 ",e("upload.max_size",{size:50})]}),(0,r.jsx)("input",{ref:h,type:"file",accept:"application/pdf,.pdf",multiple:!0,className:"hidden",onChange:e=>{var t;(null==(t=e.target.files)?void 0:t.length)&&b(e.target.files),e.target.value=""}})]}),x&&(0,r.jsx)("p",{className:"text-destructive mt-3 text-sm",children:x}),(0,r.jsxs)("div",{className:"text-muted-foreground mt-4 flex items-center justify-center gap-2 text-xs",children:[(0,r.jsx)(c.A,{className:"h-4 w-4 shrink-0 text-emerald-600"}),(0,r.jsx)("span",{children:e("privacy_note")})]}),t.length>0&&(0,r.jsxs)("div",{className:"mt-8 flex flex-col gap-4",children:[t.map(e=>(0,r.jsx)(z,{item:e,onRemove:()=>{let t;return t=e.id,n(e=>e.filter(e=>e.id!==t))},onToggle:()=>{let t;return t=e.id,n(e=>e.map(e=>e.id===t?{...e,expanded:!e.expanded}:e))}},e.id)),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 pt-2",children:[(0,r.jsxs)(y.$,{size:"lg",onClick:j,disabled:m||t.some(e=>"scanning"===e.status),children:[m?(0,r.jsx)(d.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,r.jsx)(u.A,{className:"mr-2 h-4 w-4"}),t.length>1?e("action.clean_all",{count:t.length}):e("action.clean_one")]}),(0,r.jsx)("p",{className:"text-muted-foreground text-xs",children:e("action.verified_note")})]})]})]})}function z(e){var t,n,a;let{item:s,onRemove:i,onToggle:o}=e,u=(0,l.c3)("remove_pdf_metadata"),y=s.scan,b=null!=(t=null==y?void 0:y.entries.filter(e=>"document"===e.scope))?t:[],j=null!=(n=null==y?void 0:y.entries.filter(e=>"embedded"===e.scope))?n:[],N=null!=(a=null==y?void 0:y.entries.filter(e=>"private"===e.scope).length)?a:0,D=s.expanded?j:j.slice(0,4);return(0,r.jsxs)("div",{className:"rounded-xl border border-border/60 p-4",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,r.jsx)(f.A,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,r.jsx)("span",{className:"truncate text-sm font-medium",children:s.file.name}),(0,r.jsx)("span",{className:"text-muted-foreground shrink-0 text-xs",children:R(s.file.size)})]}),(0,r.jsx)("button",{onClick:i,className:"text-muted-foreground hover:text-destructive shrink-0 transition-colors","aria-label":u("action.remove"),children:(0,r.jsx)(m.A,{className:"h-4 w-4"})})]}),(0,r.jsxs)("div",{className:"mt-3 space-y-3",children:["scanning"===s.status&&(0,r.jsxs)("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[(0,r.jsx)(d.A,{className:"h-4 w-4 animate-spin"}),u("status.scanning")]}),"failed"===s.status&&(0,r.jsx)("p",{className:"text-destructive text-sm",children:u("status.clean_failed")}),"cleaned"===s.status&&(0,r.jsxs)("p",{className:"flex items-center gap-2 text-sm text-emerald-600",children:[(0,r.jsx)(p.A,{className:"h-4 w-4"}),u("status.cleaned",{bytes:R(s.bytesRemoved)})]}),(null==y?void 0:y.failed)&&"failed"!==s.status&&(0,r.jsxs)("p",{className:"flex items-center gap-2 text-sm text-amber-600",children:[(0,r.jsx)(x.A,{className:"h-4 w-4"}),u("encrypted"===y.reason?"status.encrypted":"status.invalid")]}),"ready"===s.status&&!(null==y?void 0:y.failed)&&(0,r.jsxs)(r.Fragment,{children:[0===y.entries.length?(0,r.jsxs)("p",{className:"flex items-center gap-2 text-sm text-emerald-600",children:[(0,r.jsx)(c.A,{className:"h-4 w-4"}),u("status.already_clean")]}):(0,r.jsxs)("p",{className:"flex items-center gap-2 text-sm text-amber-600",children:[(0,r.jsx)(g.A,{className:"h-4 w-4"}),u("status.found",{count:y.entries.length})]}),(0,r.jsx)("p",{className:"text-muted-foreground text-xs",children:u("info.structure",{pages:y.pageCount,outline:y.outlineCount})}),b.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium",children:u("group.document")}),(0,r.jsx)("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-2",children:b.map(e=>(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-border/30 py-1",children:[(0,r.jsx)("dt",{className:"shrink-0 text-xs font-medium text-amber-600",children:e.key}),(0,r.jsx)("dd",{className:"truncate text-right font-mono text-xs",children:e.value})]},"d-".concat(e.key)))})]}),j.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium",children:u("group.embedded",{count:j.length})}),(0,r.jsx)("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-2",children:D.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3 border-b border-border/30 py-1",children:[(0,r.jsx)("dt",{className:"text-muted-foreground shrink-0 text-xs",children:e.key}),(0,r.jsx)("dd",{className:"truncate text-right font-mono text-xs",children:e.value})]},"e-".concat(t,"-").concat(e.key)))}),j.length>4&&(0,r.jsxs)("button",{onClick:o,className:"text-muted-foreground hover:text-foreground mt-2 inline-flex items-center gap-1 text-xs transition-colors",children:[(0,r.jsx)(h.A,{className:(0,v.cn)("h-3.5 w-3.5 transition-transform",s.expanded&&"rotate-180")}
1),s.expanded?u("action.collapse"):u("action.expand_all",{count:j.length})]})]}),N>0&&(0,r.jsx)("p",{className:"text-muted-foreground text-xs",children:u("group.private",{count:N})}),y.streamResidue&&(0,r.jsx)("div",{className:"rounded-lg bg-amber-500/10 p-3",children:(0,r.jsxs)("p",{className:"flex items-start gap-2 text-xs text-amber-700 dark:text-amber-500",children:[(0,r.jsx)(g.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,r.jsx)("span",{children:u("status.stream_residue")})]})})]})]})]})}let T=M},60605:(e,t,n)=>{n.d(t,{F:()=>s});var r=n(21189);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=r.$,s=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return l(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(e=>{let t=null==n?void 0:n[e],r=null==i?void 0:i[e];if(null===t)return null;let l=a(t)||a(r);return s[e][l]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return l(e,o,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...c}[t]):({...i,...c})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}},80806:(e,t,n)=>{n.d(t,{$:()=>o,r:()=>i});var r=n(58682);n(68786);var a=n(33154),l=n(60605),s=n(17845);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-7"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:n,size:l,asChild:o=!1,...c}=e,d=o?a.DX:"button";return(0,r.jsx)(d,{"data-slot":"button",className:(0,s.cn)(i({variant:n,size:l,className:t})),...c})}}}]);

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.