import{a as l}from"./chunk-SSSSNVF5.js";import{Ra as u,e as p}from"./chunk-RISKGE32.js";import{o as m}from"./chunk-6O6MLDWR.js";import{g as a,n as s}from"./chunk-CLPINNGF.js";s();a();s();a();var h=async r=>{try{return p("/ocr/ocr-image",{content:r})}catch(e){console.error(e)}},f=h;s();a();var b=async r=>{let{fullTextAnnotation:e}=r[0];if(!e)return[];let[t]=e.pages.map(o=>o.blocks),n=t.map(o=>o.paragraphs).flat();return v(n)},v=r=>r.map(e=>{let t=e.words.map(n=>{let o=n.symbols.reduce((c,i)=>c+i.text+(i.property?.detectedBreak?" ":""),"");return{type:"word",text:o,vertices:n.boundingBox.vertices}});return{type:"paragraph",vertices:e.boundingBox.vertices,children:t,text:t.reduce((n,o)=>n+o.text,"")}});var E=m((r,e)=>e.then(r)),O=(r,e,t)=>({x:r.x/window.devicePixelRatio+t-2,y:r.y/window.devicePixelRatio+e-2}),x=(r,e,t)=>r.map(n=>O(n,e,t)),A=(r,e)=>async t=>t.map(n=>({...n,vertices:x(n.vertices,r,e),children:(n.children??[]).map(o=>({...o,vertices:x(o.vertices,r,e)}))}));async function P(r,e=0,t=0){return E([async()=>r,f,b,A(e,t)])()}async function I(r,e=0,t=0,n="Screenshot",o){return{getContent:await u(async()=>{let c=await P(r,e,t);return o?.(),{content:c,chunksBefore:0,chunksAfter:0}}),converter:c=>({text:l(c),ref:{ref:c}}),options:{autoplay:!0,sideEffects:!1},metadata:{source:n}}}export{P as a,I as b};
//# sourceMappingURL=chunk-TYN6FJD3.js.map
