PageSourceSearch

https://textilevaluechain.in/_next/static/chunks/5841.bec278d4e8396f87.js

js textilevaluechain.in collected 2026-10-02 06:19:35 UTC 5,548 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5841],{95841:(e,t,a)=>{a.r(t),a.d(t,{default:()=>w});var i=a(95155),r=a(12115),n=a(16145);let l=new Set(["tvc.s3.ap-south-1.amazonaws.com","textilevaluechain.s3.ap-south-1.amazonaws.com","textilevaluechain.s3.amazonaws.com","textilevaluechain.in"]),s=e=>{try{let t=new URL(e);return l.has(t.hostname)}catch(e){return!1}},o=e=>e?e.startsWith("/api/magazine-proxy")||e.startsWith("data:")||e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("//")?"".concat(window.location.protocol).concat(e):e.startsWith("/")?"".concat(window.location.origin).concat(e):"".concat(window.location.origin,"/").concat(e):"",h=e=>!e||e.startsWith("/api/magazine-proxy")||e.startsWith("data:")?null:s(e)?"/api/magazine-proxy?url=".concat(encodeURIComponent(e)):null;async function c(){if(window.pdfjsLib)return window.pdfjsLib;await new Promise((e,t)=>{let a=document.createElement("script");a.src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js",a.async=!0,a.onload=()=>e(),a.onerror=()=>t(Error("Failed to load pdf.js")),document.head.appendChild(a)});let e=window.pdfjsLib;return e&&(e.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js"),e}let d=()=>({w:window.innerWidth,h:window.innerHeight}),u=(e,t)=>{let a=d(),i=e.w>0?e.w:a.w,r=e.h>0?e.h:a.h,n=Math.max(100,t.w||720),l=Math.max(100,t.h||920),s=Math.min(i/n,r/l),o=Number.isFinite(s)&&s>0?s:1;return{width:Math.round(n*o),height:Math.round(l*o),maxWidth:i,maxHeight:r}};function w(e){let{file:t}=e,[a,l]=(0,r.useState)(null),[s,w]=(0,r.useState)(!0),[m,f]=(0,r.useState)(0),[p,g]=(0,r.useState)(0),x=(0,r.useRef)(null),v=(0,r.useRef)(null),[b,j]=(0,r.useState)(()=>d()),[y,N]=(0,r.useState)({w:720,h:920});(0,r.useEffect)(()=>{let e=!1;return(async()=>{l(null),w(!0),f(0),g(0);try{let a,i=await c();if(!i)throw Error("pdf.js unavailable");let r=o(t),n=h(r);try{a=await i.getDocument({url:r,withCredentials:!1,rangeChunkSize:65536}).promise}catch(e){if(console.warn("Direct PDF load failed, trying fallback:",e),n)try{a=await i.getDocument({url:n,withCredentials:!1,rangeChunkSize:65536}).promise}catch(n){console.warn("Proxy fallback failed, trying ArrayBuffer fetch:",n);let e=await fetch(r,{mode:"cors"});if(!e.ok)throw Error("Failed to load PDF: ".concat(e.status));let t=await e.arrayBuffer();a=await i.getDocument({data:t}).promise}else{let e=await fetch(r,{mode:"cors"});if(!e.ok)throw Error("Failed to load PDF: ".concat(e.status));let t=await e.arrayBuffer();a=await i.getDocument({data:t}).promise}}if(e)return;let s=[],d=Math.max(1.35,Math.min(1.8,window.devicePixelRatio||1.5));for(let t=1;t<=a.numPages;t++){let i=await a.getPage(t),r=i.getViewport({scale:d}),n=document.createElement("canvas"),o=n.getContext("2d");if(n.width=r.width,n.height=r.height,await i.render({canvasContext:o,viewport:r}).promise,s.push(n.toDataURL("image/jpeg",.92)),1===t?(N({w:r.width,h:r.height}),l([...s]),w(!1)):(t%3==0||t===a.numPages)&&l([...s]),e)return;f(Math.round(t/a.numPages*100))}l(s)}finally{e||w(!1)}})(),()=>{e=!0}},[t]),(0,r.useEffect)(()=>{if(!v.current)return;let e=()=>{let e=v.current;if(!e)return;let t=d(),a=e.getBoundingClientRect(),i=a.width||t.w,r=window.innerHeight||t.h,n=Math.max(240,r-Math.max(0,Math.min(a.top,80))-12);j({w:i>0?i:t.w,h:n>0?n:t.h})},t=v.current,a=new ResizeObserver(e);return a.observe(t),t.parentElement&&a.observe(t.parentElement),e(),window.addEventListener("resize",e),()=>{a.disconnect(),window.removeEventListener("resize",e)}},[]);let W=(0,r.useMemo)(()=>u(b,y),[b,y]),k=b.w<=820,C=k?1:2,E=Math.min(W.width*C,W.maxWidth),M=(null==a?void 0:a.length)||0,z=(0,r.useMemo)(()=>(0,i.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-2 z-20 flex items-center gap-3 px-3 py-1 bg-white/90 rounded shadow text-sm",children:(0,i.jsxs)("span",{children:[M>0?p+1:0,"/",M]})}),[p,M]);return s?(0,i.jsx)("div",{className:"w-full h-full flex items-center justify-center text-gray-100",children:(0,i.jsxs)("div",{className:"px-4 py-2 bg-black/50 rounded",children:["Loading ",m,"%"]})}):a&&0!==a.length?(0,i.jsxs)("div",{ref:v,className:"relative w-full overflow-auto",style:{height:W.maxHeight},children:[z,(0,i.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,i.jsx)("div",{className:"mx-auto",style:{width:E,height:W.height,maxWidth:W.maxWidth,maxHeight:W.maxHeight},children:(0,i.jsx)(n.A,{ref:x,width:W.width,height:W.height,size:"fixed",maxShadowOpacity:.6,showCover:!0,usePortrait:k,mobileScrollSupport:!0,minWidth:220,minHeight:300,maxWidth:W.maxWidth,maxHeight:W.maxHeight,onFlip:e=>g(e.data),className:"h-full w-full",children:a.map((e,t)=>(0,i.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-white",children:(0,i.jsx)("img",{src:e,alt:"page-".concat(t+1),className:"max-w-full max-h-full"})},t))})})}),(0,i.jsx)("button",{"aria-label":"Prev",onClick:()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.pageFlip().flipPrev()},className:"absolute left-2 top-1/2 -translate-y-1/2 bg-white/70 hover:bg-white rounded-full w-9 h-9 flex items-center justify-center shadow",children:"‹"}),(0,i.jsx)("button",{"aria-label":"Next",onClick:()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.pageFlip().flipNext()},className:"absolute right-2 top-1/2 -translate-y-1/2 bg-white/70 hover:bg-white rounded-full w-9 h-9 flex items-center justify-center shadow",children:"›"})]}):(0,i.jsx)("div",{className:"p-4",children:"No pages"})}}}]);

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.