1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44549],{7747:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let n=r(46650)._(r(41939));function l(e,t){var r;let l={};"function"==typeof e&&(l.loader=e);let s={...l,...t};return(0,n.default)({...s,modules:null==(r=s.loadableGenerated)?void 0:r.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},15623:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(28620).A)("file-code",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]])},21599:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(28620).A)("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])},33741:(e,t,r)=>{"use strict";function n(e){let{moduleIds:t}=e;return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return n}}),r(79858),r(33159),r(85590),r(61515)},41939:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let n=r(79858),l=r(16314),s=r(62352);function a(e){return{default:e&&"default"in e?e.default:e}}r(33741);let o={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},i=function(e){let t={...o,...e},r=(0,l.lazy)(()=>t.loader().then(a)),i=t.loading;function d(e){let a=i?(0,n.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?l.Suspense:l.Fragment,c=t.ssr?(0,n.jsxs)(n.Fragment,{children:[null,(0,n.jsx)(r,{...e})]}):(0,n.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(r,{...e})});return(0,n.jsx)(d,{...o?{fallback:a}:{},children:c})}return d.displayName="LoadableComponent",d}},44549:(e,t,r)=>{Promise.resolve().then(r.bind(r,56749)),Promise.resolve().then(r.bind(r,93394)),Promise.resolve().then(r.bind(r,81103)),Promise.resolve().then(r.bind(r,60363)),Promise.resolve().then(r.bind(r,83493)),Promise.resolve().then(r.bind(r,78273)),Promise.resolve().then(r.bind(r,25803)),Promise.resolve().then(r.bind(r,54488)),Promise.resolve().then(r.bind(r,22316)),Promise.resolve().then(r.bind(r,22568)),Promise.resolve().then(r.bind(r,50136)),Promise.resolve().then(r.t.bind(r,16781,23)),Promise.resolve().then(r.t.bind(r,41897,23))},62352:(e,t,r)=>{"use strict";function n(e){let{reason:t,children:r}=e;return r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return n}}),r(61892)},66325:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,r(94515).createAsyncLocalStorage)()},78014:(e,t,r)=>{"use strict";r.d(t,{default:()=>l.a});var n=r(7747),l=r.n(n)},78995:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(28620).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},83493:(e,t,r)=>{"use strict";r.d(t,{default:()=>C});var n=r(79858),l=r(60053),s=r(83858),a=r(31328),o=r(3509),i=r(64962),d=r(80746),c=r(24225),u=r(62092),f=r(16314),h=r(66004),x=r(79537),m=r(51431),b=r(54488),p=r(18372),j=r(43709),v=r(35529),w=r(8972),y=r(93877),g=r(78995),k=r(21599),_=r(15623),A=r(96933);let P=(0,r(78014).default)(()=>Promise.all([r.e(20603),r.e(93391),r.e(76244),r.e(63921),r.e(27935),r.e(2694),r.e(31797)]).then(r.bind(r,31797)),{loadableGenerated:{webpack:()=>[31797]},ssr:!1,loading:()=>(0,n.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,n.jsx)(j.A,{className:"h-8 w-8 animate-spin text-muted-foreground"})})});function N(e){let{text:t,isLoading:l,isMobile:s,onNew:a}=e,o=(0,u.c)("ocr"),[i,d]=(0,f.useState)(!1),x=async e=>{(0,c.J)("event","copyToClipboard"),await (0,p.wC)(e)?h.oR.success(o("result.copySuccess")):h.oR.error(o("result.copyFailed"))},N=async e=>{(0,c.J)("event","downloadAsTxt"),d(!0);try{let{convertMarkdownToText:t}=await Promise.all([r.e(31254),r.e(27935),r.e(80399)]).then(r.bind(r,80399)),n=t(e),l=new Blob([n],{type:"text/plain"});(0,p.WN)(l,"ocr-result.txt")}catch(e){console.error("Text conversion error:",e),h.oR.error(o("result.downloadTxtError"))}finally{d(!1)}},M=e=>{(0,c.J)("event","downloadAsMarkdown");let t=new Blob([e],{type:"text/markdown"});(0,p.WN)(t,"ocr-result.md")},C=async e=>{(0,c.J)("event","downloadAsDocx"),d(!0);try{let{convertMarkdownToDocx:t}=await Promise.all([r.e(93391),r.e(48817),r.e(27935),r.e(59447),r.e(97862)]).then(r.bind(r,97862)),n=await t(e);(0,p.WN)(n,"ocr-result.docx")}catch(e){console.error("Docx conversion error:",e),h.oR.error(o("result.downloadDocxError"))}finally{d(!1)}};return(0,n.jsxs)("div",{className:"flex flex-col gap-4 w-full h-full",children:[(0,n.jsx)("div",{className:(0,p.cn)("border rounded-sm p-4 min-h-[300px] flex-1 overflow-y-auto",t?"bg-background":"bg-
1accent"),children:l?(0,n.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,n.jsx)(j.A,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t?(0,n.jsx)(P,{children:t}):(0,n.jsx)("div",{className:"flex items-center justify-center text-muted-foreground h-full",children:(0,n.jsx)("p",{children:o("result.emptyPlaceholder")})})}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:a&&(0,n.jsxs)(m.$,{onClick:a,children:[(0,n.jsx)(v.A,{}),o("new")]})}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 justify-end ml-auto",children:[(0,n.jsxs)(m.$,{variant:"outline",disabled:!t,onClick:()=>t&&x(t),children:[(0,n.jsx)(w.A,{}),o("result.copy")]}),s?(0,n.jsxs)(b.DropdownMenu,{children:[(0,n.jsx)(b.DropdownMenuTrigger,{asChild:!0,children:(0,n.jsxs)(m.$,{variant:"outline",disabled:!t,children:[(0,n.jsx)(y.A,{}),o("result.download"),(0,n.jsx)(g.A,{className:"ml-2 h-4 w-4"})]})}),(0,n.jsxs)(b.DropdownMenuContent,{align:"end",children:[(0,n.jsxs)(b._2,{onClick:()=>t&&N(t),disabled:i,children:[i?(0,n.jsx)(j.A,{className:"h-4 w-4 animate-spin"}):(0,n.jsx)(k.A,{className:"h-4 w-4"}),o("result.downloadTxt")]}),(0,n.jsxs)(b._2,{onClick:()=>t&&M(t),children:[(0,n.jsx)(_.A,{className:"h-4 w-4"}),o("result.downloadMarkdown")]}),(0,n.jsxs)(b._2,{onClick:()=>t&&C(t),disabled:i,children:[i?(0,n.jsx)(j.A,{className:"h-4 w-4 animate-spin"}):(0,n.jsx)(A.A,{className:"h-4 w-4"}),o("result.downloadDocx")]})]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(m.$,{variant:"outline",disabled:!t||i,onClick:()=>t&&N(t),children:[i?(0,n.jsx)(j.A,{className:"animate-spin"}):(0,n.jsx)(k.A,{}),o("result.downloadTxt")]}),(0,n.jsxs)(m.$,{variant:"outline",disabled:!t,onClick:()=>t&&M(t),children:[(0,n.jsx)(_.A,{}),o("result.downloadMarkdown")]}),(0,n.jsxs)(m.$,{variant:"outline",disabled:!t||i,onClick:()=>t&&C(t),children:[i?(0,n.jsx)(j.A,{className:"animate-spin"}):(0,n.jsx)(A.A,{}),o("result.downloadDocx")]})]})]})]})]})}var M=r(52974);function C(){let e=(0,u.c)("ocr"),t=(0,u.c)("toolActions"),r=(0,s.a)(),{isProcessing:m,isPending:b,processFile:p,verificationFailed:j}=(0,i.S)("/api/v1/ocr"),{remaining:v,closeDialog:w}=(0,a.v)(),[y,g]=(0,f.useState)(null),[k,_]=(0,f.useState)(null),A=(0,f.useRef)(null),P=(0,f.useRef)(null),C=null!==k,O=m||b||C;(0,f.useEffect)(()=>{if(m){var e;null==(e=P.current)||e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[m]);let S=async r=>{if(!y)return void h.oR.error(t("no_image_error"));try{(0,c.J)("event","submit"),(0,c.t)("free_ocr_submit");let e=new FormData;e.append("image",y),e.append("cf_token",r);let t=await p(e);if(!t)return;_(t.text)}catch(t){h.oR.error(e("upload.processing_error"))}};return(0,n.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,n.jsxs)(l.Zp,{className:"mx-auto w-[64rem] max-w-full",children:[(0,n.jsx)(l.aR,{children:(0,n.jsx)(l.ZB,{children:e("upload.title")})}),(0,n.jsx)(l.Wu,{ref:A,children:(0,n.jsx)(x.A,{bulkHref:"/app/ocr/bulk",image:y,disabled:O,onImageChange:g,showDeleteButton:!O})}),!C&&(0,n.jsx)(l.wL,{children:(0,n.jsx)(o.c,{remaining:v,disabled:O,ready:!!y,isProcessing:m,verificationFailed:j,onSubmit:S,submitLabel:e("upload.extract_text")})})]}),(C||m)&&(0,n.jsxs)(l.Zp,{id:"results-section",ref:P,className:"mx-auto w-[64rem] max-w-full",children:[(0,n.jsx)(l.aR,{children:(0,n.jsx)(l.ZB,{children:e("result.title")})}),(0,n.jsx)(l.Wu,{children:(0,n.jsx)(N,{text:k,isLoading:m,onNew:C&&!m?()=>{var e;w(),(0,c.J)("event","newOCR"),(0,c.t)("free_ocr_new"),null==(e=A.current)||e.scrollIntoView({behavior:"smooth",block:"center"}),g(null),_(null)}:void 0,isMobile:r})})]}),C&&!m&&(0,n.jsx)(M.x,{tool:"ocr",image:y,result:k}),C&&!m&&(0,n.jsx)(d.H,{tool:"ocr"})]})}},83858:(e,t,r)=>{"use strict";r.d(t,{a:()=>l});var n=r(16314);function l(){let[e,t]=n.useState(void 0);return n.useEffect(()=>{let e=window.matchMedia("(max-width: ".concat(767,"px)")),r=()=>{t(window.innerWidth<768)};return e.addEventListener("change",r),t(window.innerWidth<768),()=>e.removeEventListener("change",r)},[]),!!e}},85590:(e,t,r)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return n.workAsyncStorageInstance}});let n=r(66325)},94515:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{bindSnapshot:function(){return a},createAsyncLocalStorage:function(){return s},createSnapshot:function(){return o}});let r=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class n{disable(){throw r}getStore(){}run(){throw r}exit(){throw r}enterWith(){throw r}static bind(e){return e}}let l="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function s(){return l?new l:new n}function a(e){return l?l.bind(e):n.bind(e)}function o(){return l?l.snapshot():function(e,...t){return e(...t)}}},96933:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(28620).A)("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])}}]);
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.