PageSourceSearch

https://crppr.org.br/assets/CartaServicos-ChGVc8Rl.js

js crppr.org.br collected 2026-09-25 02:53:19 UTC 5,420 bytes, 1 lines download raw bytes

1import{j as e,o as T}from"./index-BCp-6lKF.js";import{r}from"./vendor-react-CpRvMXaC.js";import{H as M,p}from"./vendor-pdf-CLXYJc0c.js";import{r as U}from"./pdfReader-C724x6d1.js";import{F as V}from"./ChevronLeftIcon-BvZhC08K.js";import"./vendor-ui-5rZvml82.js";import"./vendor-editor-DoAMYjM7.js";p.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${p.version}/build/pdf.worker.min.js`;const h=U("biblioteca/6FxtAzhVaeuhaj3rBzSGqGpz7zDZzH3aiqhyQFZi.pdf");function _(){const[n,j]=r.useState([]),[d,F]=r.useState(0),[N,f]=r.useState(!0),[P,u]=r.useState(0),[x,k]=r.useState(!1),[S,E]=r.useState(!1),[z,C]=r.useState({width:500,height:707}),m=r.useRef(null),w=r.useRef(null);r.useEffect(()=>{(async()=>{try{f(!0),u(0);const a=await fetch(h,{method:"GET",cache:"no-store",credentials:"omit"});if(!a.ok)throw new Error(`HTTP ${a.status}`);const b=await a.arrayBuffer(),i=await p.getDocument({data:new Uint8Array(b),disableStream:!0,disableRange:!0,disableAutoFetch:!0}).promise,o=i.numPages,s=[];for(let l=1;l<=o;l++){const v=await i.getPage(l),g=v.getViewport({scale:1.6}),c=document.createElement("canvas"),A=c.getContext("2d");c.height=g.height,c.width=g.width,await v.render({canvasContext:A,viewport:g}).promise,s.push(c.toDataURL("image/png")),u(l)}j(s)}catch(a){console.error("Erro ao carregar PDF:",a),k(!0)}finally{f(!1)}})()},[]),r.useEffect(()=>{const t=()=>{const y=window.innerWidth-8,i=window.innerHeight-64;let o=Math.floor(y/2),s=Math.floor(o*1.414);s>i&&(s=i,o=Math.floor(s/1.414)),C({width:o,height:s})};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),r.useEffect(()=>{const t=()=>E(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]);const B=async()=>{var t;try{document.fullscreenElement?await document.exitFullscreen():await((t=w.current)==null?void 0:t.requestFullscreen())}catch(a){console.warn("Fullscreen não disponível:",a)}},H=()=>{var t,a;return(a=(t=m.current)==null?void 0:t.pageFlip())==null?void 0:a.flipNext()},L=()=>{var t,a;return(a=(t=m.current)==null?void 0:t.pageFlip())==null?void 0:a.flipPrev()},{width:D,height:R}=z;return e.jsxs("div",{ref:w,className:"h-screen w-screen overflow-hidden flex flex-col bg-gray-900",children:[e.jsxs("div",{className:"flex-shrink-0 flex flex-wrap items-center justify-between gap-2 px-3 py-2 bg-gray-800",children:[e.jsx("div",{className:"flex items-center gap-3 min-w-0",children:e.jsx("h1",{className:"text-sm font-bold text-white truncate",children:"Carta de Serviços"})}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.length>0&&!x&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:L,disabled:d===0,className:"inline-flex items-center gap-1 px-3 py-1.5 bg-gray-700 text-gray-200 rounded-lg hover:bg-gray-600 disabled:opacity-40 disabled:cursor-not-allowed text-sm",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),e.jsxs("span",{className:"px-3 py-1.5 bg-gray-700 text-gray-200 rounded-lg text-sm",children:["Pág ",d+1," / ",n.length]}),e.jsxs("button",{onClick:H,disabled:d>=n.length-1,className:"inline-flex items-center gap-1 px-3 py-1.5 bg-gray-700 text-gray-200 rounded-lg hover:bg-gray-600 disabled:opacity-40 disabled:cursor-not-allowed text-sm",children:[e.jsx("span",{className:"hidden sm:inline",children:"Próxima"}),e.jsx(T,{className:"h-4 w-4"})]})]}),e.jsx("button",{type:"button",onClick:B,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors",children:S?"Sair da tela cheia":"Tela cheia"})]})]}),e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-shrink-0 px-4 py-2 bg-gray-800 border-t border-gray-700 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"text-sm text-gray-300",children:"Modo de leitura alternativo ativado para garantir a abertura do PDF."}),e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors",children:"Abrir em nova aba"})]}),e.jsx("iframe",{src:h,title:"Carta de Serviços",className:"flex-1 w-full border-0"})]}):n.length>0?e.jsx("div",{className:"flex-1 flex items-center justify-center overflow-hidden",children:e.jsx(M,{ref:m,width:D,height:R,size:"fixed",minWidth:200,maxWidth:2e3,minHeight:300,maxHeight:4e3,maxShadowOpacity:.45,showCover:!0,mobileScrollSupport:!0,onFlip:t=>F((t==null?void 0:t.data)||0),className:"flipbook-container",children:n.map((t,a)=>e.jsx("div",{className:"page bg-white flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:t,alt:`Página ${a+1}`,style:{width:"100%",height:"100%",objectFit:"contain",display:"block"},draggable:!1})},a))})}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-12 w-12 border-b-2 border-primary-400 mb-4"}),e.jsx("p",{className:"text-gray-300 font-medium",children:N?`Processando páginas... (${P} processadas)`:"Aguardando processamento do PDF..."})]})})})]})}export{_ as default};

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.