PageSourceSearch

https://www.chatgrid.ai/assets/PdfRenderer-BW7ZnWKZ.js

js chatgrid.ai collected 2026-10-05 11:55:32 UTC 9,349 bytes, 6 lines download raw bytes

1import{r as c,j as n}from"./index-CCG9MGz0.js";import{g as E,T as j,G as C}from"./Response-DwD38_jg.js";import{u as k}from"./useDeliverableContent-tC71K_e8.js";import{V as R,a as A,b as S}from"./CompanyBrainExperiment-ChE-CJRt.js";import{M as O}from"./minus-B3hFNsNz.js";import{P as _}from"./plus-CtL5uaTS.js";import{c as N}from"./createLucideIcon-BNie9-yg.js";import"./index-BAd2GUFv.js";import"./companyBrainApi-CrDzGhub.js";import"./serverApi-QuCfAnKQ.js";import"./types-BC6WDqr1.js";import"./ProfileModal-CrjOGBYn.js";import"./useActionPoints-CDPFea5R.js";import"./CreditModal-DjwbWnX-.js";import"./creditPacks-8l7MffHt.js";import"./zap-BQgRhSai.js";import"./crown-DfZB9dyK.js";import"./star-DJBVjYDR.js";import"./index-C8GGNDku.js";import"./proxy-DCcAtm3e.js";import"./x-B90hvd2h.js";import"./eye-off-C5VUZPw7.js";import"./eye-Q6TnMbDD.js";import"./circle-alert-B_9MDH1R.js";import"./check-DpxvuY1B.js";import"./sun-DO0WX0m6.js";import"./credit-card-B-LS2_Vm.js";import"./IntegrationsModal-JhSbznqy.js";import"./search-bFUysiSs.js";import"./loader-circle-D1HdQVTP.js";import"./upload-DMPPaHWe.js";import"./circle-check-DdEYu8Ii.js";import"./xlsx-DHg_MbFl.js";import"./arrow-right-B1S3KjUv.js";import"./darkSidebarPrimitives-WYA5Xfg0.js";import"./agentBuildReplay-B7wiZA5l.js";import"./file-text-Bb28mgmh.js";import"./chevron-down-BkupgjqY.js";import"./triangle-alert-IwRw8WUz.js";import"./arrow-left-CcFLG1c6.js";import"./style-CnSLJGqi.js";import"./clsx-B-dksMZM.js";import"./download-CSYECM8Z.js";import"./clipboard-list-CCHcYkwq.js";import"./terminal-95uvLlXP.js";import"./activity-CcQ6AHnk.js";import"./share-2-DpRQL9XK.js";import"./minimize-2-EZE6tBh3.js";import"./sparkles-CTgZB_rD.js";import"./earth-BRpdVrHq.js";import"./Toast-OwPIshW0.js";import"./globe-DsFaVgLl.js";import"./shield-B3TDQ5Vy.js";import"./film-CPTWxwud.js";import"./mouse-pointer-click-BJ_wrDfg.js";import"./modelCategories-CLRrvYvq.js";import"./clock-C3m9i-ce.js";import"./chevron-right-DiFWwGWb.js";import"./trash-2-CtdTlm-l.js";import"./list-GQvnb7Ci.js";import"./layout-grid-r7b0xkTH.js";import"./ellipsis-DWIPiRvt.js";import"./arrow-up-Kqsv5KY0.js";import"./refresh-cw-B4u4dn-X.js";import"./image-C6RdTz96.js";import"./CursorAgent-BuNh2nyN.js";import"./spreadsheetExtraction-CR3StDVC.js";import"./youtube-Cw30aRrf.js";import"./link-2-BHizDc4l.js";import"./brain-DbxNhOEe.js";import"./message-square-B9PZZ-XB.js";import"./use-reduced-motion-m11mlRrx.js";import"./square-C4s3Anyb.js";import"./boardOperations-DUkzIMp9.js";import"./layers-Cfhp7pij.js";import"./video-DwcDf_GS.js";import"./square-check-big-Cb850sm6.js";import"./briefcase-business-CNmjz1yL.js";import"./send-D8LswkWg.js";/**
2 * @license lucide-react v0.548.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const T=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]],I=N("scan-line",T),L="/assets/pdf.worker.min-LyOxJPrg.mjs",V=16e6,M=5e6;function W(o,t,i){return!(o.width*o.height*t*t>i)||!(o.width>0&&o.height>0)?t:Math.sqrt(i/(o.width*o.height))}const D="0px",G=[0,.1,.25,.5,.75,1];function Z(o,t){let i=t,s=0;for(const[h,d]of o)d>0&&(d>s||d===s&&h<i)&&(i=h,s=d);return i}function $(o,t,i,s=typeof IntersectionObserver>"u"?void 0:IntersectionObserver){if(!o||!s||!t.length)return()=>{};const h=new Map;for(const{el:f,page:m}of t)h.set(f,m);const d=new Map;let u=t[0].page;const x=new s(f=>{var g;for(const v of f){const e=h.get(v.target);if(e===void 0)continue;const a=v.isIntersecting&&((g=v.intersectionRect)==null?void 0:g.height)||0;a>0?d.set(e,a):d.delete(e)}const m=Z(d,u);m!==u&&(u=m,i(m))},{root:o,rootMargin:D,threshold:G});for(const{el:f}of t)x.observe(f);return()=>x.disconnect()}C.workerSrc=L;const P=[.5,.67,.8,1,1.25,1.5,2,3],q=500,X="600px 0px";function F(){var o,t;try{return(t=(o=window.matchMedia)==null?void 0:o.call(window,"(pointer: coarse)"))!=null&&t.matches?M:V}catch(i){return console.error("[PdfRenderer] could not read the pointer type:",i),M}}function we({item:o}){const t=k(o,"arrayBuffer"),i=t.status==="ready"?t.data:null,[s,h]=c.useState(null),[d,u]=c.useState([]),[x,f]=c.useState(null);return c.useEffect(()=>{if(!i)return;let m=!1,g=null;h(null),u([]),f(null);const v=E({data:new Uint8Array(i.slice(0)),isEvalSupported:!1,enableXfa:!1});return(async()=>{try{g=await v.promise;const e=Math.min(g.numPages,q),a=[];for(let l=1;l<=e;l+=1){const p=(await g.getPage(l)).getViewport({scale:1});if(a.push({width:p.width,height:p.height}),m)return}if(m)return;h(g),u(a)}catch(e){if(m)return;console.error(`[PdfRenderer] could not open ${o.name}:`,e),f(String((e==null?void 0:e.name)||"")==="PasswordException"?"This PDF is password protected.":"The PDF could not be read.")}})(),()=>{m=!0,v.destroy().catch(e=>console.error("[PdfRenderer] cleanup failed:",e));try{j.cleanup()}catch(e){console.error("[PdfRenderer] text layer cleanup failed:",e)}}},[i,o.name]),t.status==="loading"?n.jsx(R,{label:`Opening ${o.name}`}):t.status==="too-large"?n.jsx(A,{limitBytes:t.limitBytes}):t.status==="error"?n.jsx(S,{message:t.message,onRetry:t.retry}):x?n.jsx(S,{message:x}):!s||!d.length?n.jsx(R,{label:"Preparing pages"}):n.jsx(H,{doc:s,sizes:d,totalPages:s.numPages})}function H({doc:o,sizes:t,totalPages:i}){const s=c.useRef(null),[h,d]=c.useState(0),[u,x]=c.useState("fit"),[f,m]=c.useState(1);c.useEffect(()=>{const r=s.current;if(!r||typeof ResizeObserver>"u")return;const p=new ResizeObserver(b=>{var y;const w=((y=b[0])==null?void 0:y.contentRect.width)||0;d(w)});return p.observe(r),d(r.clientWidth),()=>p.disconnect()},[]);const g=c.useMemo(()=>Math.max(...t.map(r=>r.width)),[t]),v=h>0?Math.max(.2,(h-24)/g):1,e=u==="fit"?v:u,a=r=>{const p=u==="fit"?v:u,b=r>0?P.find(w=>w>p+.01)??P[P.length-1]:[...P].reverse().find(w=>w<p-.01)??P[0];x(b)},l=t.length;return c.useEffect(()=>{const r=s.current;if(!r)return;const p=Array.from(r.querySelectorAll(".dlv-pdf-page[data-page]")).map(b=>({el:b,page:Number(b.dataset.page)||1}));return $(r,p,m)},[l]),n.jsxs("div",{className:"dlv-pdf","data-testid":"deliverable-pdf",children:[n.jsxs("div",{className:"dlv-pdf-toolbar",children:[n.jsxs("span",{"aria-live":"polite",children:["Page ",f," of ",i]}),n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("button",{type:"button",className:"dlv-button dlv-button-icon",onClick:()=>a(-1),"aria-label":"Zoom out",title:"Zoom out",children:n.jsx(O,{size:13,strokeWidth:2.4,"aria-hidden":"true"})}),n.jsxs("span",{children:[Math.round(e*100),"%"]}),n.jsx("button",{type:"button",className:"dlv-button dlv-button-icon",onClick:()=>a(1),"aria-label":"Zoom in",title:"Zoom in",children:n.jsx(_,{size:13,strokeWidth:2.4,"aria-hidden":"true"})}),n.jsxs("button",{type:"button",className:"dlv-button",onClick:()=>x("fit"),"aria-pressed":u==="fit",title:"Fit to width",children:[n.jsx(I,{size:13,strokeWidth:2.4,"aria-hidden":"true"}),n.jsx("span",{className:"dlv-button-label",children:"Fit"})]})]}),n.jsxs("div",{className:"dlv-pdf-pages",ref:s,children:[t.map((r,p)=>n.jsx(U,{doc:o,pageNumber:p+1,size:r,scale:e,root:s},p)),i>t.length?n.jsxs("div",{className:"dlv-notice",children:["Showing the first ",t.length," of ",i," pages. Download for the rest."]}):null]})]})}function U({doc:o,pageNumber:t,size:i,scale:s,root:h}){const d=c.useRef(null),u=c.useRef(null),x=c.useRef(null),[f,m]=c.useState(t<=2);c.useEffect(()=>{const e=d.current;if(!e||typeof IntersectionObserver>"u"){m(!0);return}const a=new IntersectionObserver(l=>{for(const r of l)m(r.isIntersecting)},{root:h.current,rootMargin:X,threshold:0});return a.observe(e),()=>a.disconnect()},[h]),c.useEffect(()=>{const e=u.current;if(!f){e&&(e.width||e.height)&&(e.width=0,e.height=0);return}let a=!1,l=null;return(async()=>{try{const r=await o.getPage(t);if(a||!e)return;const p=Math.min(2,window.devicePixelRatio||1),b=W(i,s*p,F()),w=r.getViewport({scale:b});e.width=Math.floor(w.width),e.height=Math.floor(w.height);const y=e.getContext("2d");if(!y)return;l=r.render({canvas:e,canvasContext:y,viewport:w}),await l.promise}catch(r){if(a||(r==null?void 0:r.name)==="RenderingCancelledException")return;console.error(`[PdfRenderer] page ${t} failed to render:`,r)}})(),()=>{a=!0,l==null||l.cancel()}},[o,f,t,s,i]);const[g,v]=c.useState(!1);return c.useEffect(()=>{f&&v(!0)},[f]),c.useEffect(()=>{const e=x.current;if(!g||!e)return;let a=!1,l=null;return(async()=>{try{const r=await o.getPage(t);if(a)return;const p=await r.getTextContent();if(a)return;e.replaceChildren(),l=new j({textContentSource:p,container:e,viewport:r.getViewport({scale:1})}),await l.render()}catch(r){if(a||(r==null?void 0:r.name)==="AbortException")return;console.error(`[PdfRenderer] page ${t} text could not be laid out:`,r)}})(),()=>{a=!0,l==null||l.cancel()}},[o,t,g]),n.jsxs("div",{ref:d,className:"dlv-pdf-page","data-page":t,role:"group","aria-label":`Page ${t}`,style:{"--dlv-page-w":`${Math.round(i.width*s)}px`,"--dlv-page-h":`${Math.round(i.height*s)}px`,"--total-scale-factor":String(s)},children:[n.jsx("canvas",{ref:u,"aria-hidden":"true"}),n.jsx("div",{ref:x,className:"textLayer dlv-pdf-text","data-testid":"deliverable-pdf-text"})]})}
6export{we 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.