vendor: 4,237 bytes, line 1
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1126],{93162:function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__,b;void 0!==(__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof(b=function(){"use strict";function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c)},d.onerror=function(){console.error("could not download file")},d.send()}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send()}catch(a1){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof __webpack_require__.g&&__webpack_require__.g.global===__webpack_require__.g?__webpack_require__.g:void 0,a=f.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4e4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f){var b;navigator.msSaveOrOpenBlob((void 0===(b=h)?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(f.type)?new Blob(["\uFEFF",f],{type:f.type}):f),g)}else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(b,d,e,g){if((g=g||open("","_blank"))&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null},k.readAsDataURL(b)}else{var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m)},4e4)}});f.saveAs=g.saveAs=g,module.exports=g})?b.apply(exports,[]):b)&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},37604:function(__unused_webpack_module,__unused_webpack_exports,__webpack_require__){(window.__NEXT_P=window.__NEXT_P||[]).push(["/external-file-pack/[publicId]",function(){return __webpack_require__(48427)}])},48427:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:function(){return ExternalFilePackPage}});var jsx_runtime=__webpack_require__(85893),useQuery=__webpack_require__(6388),next_router=__webpack_require__(11163),_tagged_template_literal=__webpack_require__(7297),lib=__webpack_require__(68806);function _templateObject(){let data=(0,_tagged_template_literal.Z)(["\n query ExternalFilePack($publicId: String!) {\n externalFilePack(publicId: $publicId) {\n description\n files {\n category\n resource\n thumbnail\n }\n publicId\n title\n }\n }\n"]);return _templateObject=function(){return data},data}let EXTERNAL_FILE_PACK_QUERY=(0,lib.Ps)(_templateObject());var react=__webpack_require__(67294),Box=__webpack_require__(9258),CircularProgress=__webpack_require__(53020),Typography=__webpack_require__(77046),Button=__webpack_require__(67398),Accordion=__webpack_require__(38163),AccordionSummary=__webpack_require__(12269),AccordionDetail
1s=__webpack_require__(6113),Dialog=__webpack_require__(1889),DialogContent=__webpack_require__(84697),IconButton=__webpack_require__(41266),Tooltip=__webpack_require__(71395),Close=__webpack_require__(40567),Download=__webpack_require__(75481),ExpandMore=__webpack_require__(62478),FileSaver_min=__webpack_require__(93162),jszip_min=__webpack_require__(55733),jszip_min_default=__webpack_require__.n(jszip_min),sortUtils=__webpack_require__(61455);let styles={thumbnailBox:{width:200,height:200,flexShrink:0,position:"relative",cursor:"pointer",border:"1px solid #ccc",borderRadius:2,overflow:"hidden"},downloadButton:{position:"absolute",bottom:10,right:10,zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.5)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.7)"}},dialogContent:{position:"relative",p:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#000"},closeButton:{position:"absolute",top:10,right:10,zIndex:10,color:"white"},fullPreview:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain"},horizontalScrollBox:{display:"flex",gap:2,overflowX:"auto",pb:1,"&::-webkit-scrollbar":{height:8},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:4},"&::-webkit-scrollbar-thumb":{backgroundColor:"#c1c1c1",borderRadius:4},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:"#a0a0a0"},scrollbarColor:"#c1c1c1 #f1f1f1",scrollbarWidth:"thin"},centeredLoaderBox:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1}},groupFilesByCategory=files=>{let grouped={};for(let file of files){let key=file.category||"Uncategorized";grouped[key]||(grouped[key]=[]),grouped[key].push(file)}return grouped},mapCategoryToName=category=>{switch(category){case"POP_Signature":return"POP Signature";case"POD_Signature":return"POD Signature";default:return category}},preferredOrder=["POP","POP_Signature","POD","POD_Signature"],sortCategories=entries=>entries.sort((param,param1)=>{let[a]=param,[b]=param1,indexA=preferredOrder.indexOf(a),indexB=preferredOrder.indexOf(b);return -1===indexA&&-1===indexB?(0,sortUtils.A5)(a,b):-1===indexA?1:-1===indexB?-1:(0,sortUtils.z6)(indexA,indexB)}),downloadZip=async function(groupedFiles){let category=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,zip=new(jszip_min_default()),filesToDownload=category?{[category]:groupedFiles[category]}:groupedFiles;await Promise.all(Object.entries(filesToDownload).map(async param=>{let[cat,files]=param,folder=zip.folder(cat);folder&&await Promise.all(files.map(async(file,index)=>{try{let res=await fetch("/api/fetch-file?url=".concat(encodeURIComponent(file.resource))),blob=await res.blob(),ext=blob.type.includes("png")?"png":blob.type.includes("jpeg")?"jpg":"img";folder.file("file-".concat(index+1,".").concat(ext),blob)}catch(err){console.error("Failed to fetch file:",file.resource)}}))}));let blob=await zip.generateAsync({type:"blob"});(0,FileSaver_min.saveAs)(blob,category?"".concat(category,".zip"):"file-pack.zip")};function FileCategoryBlock(param){let{category,files,onPreview}
1=param,[loadingMap,setLoadingMap]=(0,react.useState)({});(0,react.useEffect)(()=>{let initialMap=Object.fromEntries(files.map(file=>[file.thumbnail,!0]));setLoadingMap(initialMap)},[files]);let handleImageLoad=key=>{setLoadingMap(prev=>({...prev,[key]:!1}))};return(0,jsx_runtime.jsxs)(Box.Z,{sx:{mb:4,borderBottom:"1px solid rgba(0,0,0,0.2)",pb:2},children:[(0,jsx_runtime.jsxs)(Box.Z,{sx:{display:"flex",alignItems:"center",mb:1},children:[(0,jsx_runtime.jsx)(Typography.Z,{variant:"h6",sx:{mr:1},children:mapCategoryToName(category)}),(0,jsx_runtime.jsx)(Tooltip.Z,{title:"Download ".concat(category," as ZIP"),children:(0,jsx_runtime.jsx)(IconButton.Z,{onClick:()=>downloadZip({[category]:files},category),children:(0,jsx_runtime.jsx)(Download.Z,{fontSize:"small"})})})]}),(0,jsx_runtime.jsx)(Box.Z,{sx:styles.horizontalScrollBox,children:files.map((file,index)=>{let key=file.thumbnail,isLoading=loadingMap[key];return(0,jsx_runtime.jsxs)(Box.Z,{sx:styles.thumbnailBox,onClick:()=>onPreview(file.resource),children:[isLoading&&(0,jsx_runtime.jsx)(Box.Z,{sx:styles.centeredLoaderBox,children:(0,jsx_runtime.jsx)(CircularProgress.Z,{size:24})}),(0,jsx_runtime.jsx)("img",{src:file.thumbnail,alt:"File ".concat(index+1),loading:"lazy",onLoad:()=>handleImageLoad(key),onError:()=>handleImageLoad(key),style:{width:"100%",height:"100%",display:isLoading?"none":"block"}})]},index)})})]})}var i18next=__webpack_require__(66304),nullSafety=__webpack_require__(10219);function ExternalFilePackPage(){var ref;let router=(0,next_router.useRouter)(),queryParam=null===(ref=router.query.resource)||void 0===ref?void 0:ref.toUpperCase(),{publicId}=router.query,{data,loading,error}=(0,useQuery.aM)(EXTERNAL_FILE_PACK_QUERY,{variables:{publicId},skip:!publicId}),[expandedCategory,setExpandedCategory]=(0,react.useState)(null),[previewImage,setPreviewImage]=(0,react.useState)(null),filteredDocuments=(0,react.useMemo)(()=>{var ref;let allFiles=(null==data?void 0:null===(ref=data.externalFilePack)||void 0===ref?void 0:ref.files)||[];return queryParam?"POP"===queryParam?allFiles.filter(doc=>"POP"===doc.category||"POP_Signature"===doc.category):"POD"===queryParam?allFiles.filter(doc=>"POD"===doc.category||"POD_Signature"===doc.category):[]:allFiles},[data,queryParam]),filePack={files:filteredDocuments},groupedFiles=(0,react.useMemo)(()=>groupFilesByCategory((0,nullSafety.Wc)(null==filePack?void 0:filePack.files,[])),[null==filePack?void 0:filePack.files]);return((0,react.useEffect)(()=>{var ref;let firstCategory=null===(ref=sortCategories(Object.entries(groupedFiles))[0])||void 0===ref?void 0:ref[0];firstCategory&&!expandedCategory&&setExpandedCategory(firstCategory)},[groupedFiles]),loading)?(0,jsx_runtime.jsx)(Box.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",p:6},children:(0,jsx_runtime.jsx)(CircularProgress.Z,{})}):(loading||!error)&&filePack?(0,jsx_runtime.jsxs)(Box.Z,{sx:{minHeight:953,maxWidth:1200,mx:"auto",p:4,color:"gray"},children:[(0,jsx_runtime.jsx)(Typography.Z,{variant:"h4",gutterBottom:!0,children:filePack.title}),filePack.description&&(0,jsx_runtime.jsx)(Typography.Z,{variant:"body1",sx:{mb:4,color:"gray"},children:filePack.description}),(0,jsx_runtime.jsx)(Box.Z,{sx:{display:"flex",justifyContent:"flex-end",mb:3},children:(0,jsx_runtime.jsx)(Button.Z,{variant:"contained",color:"primary",onClick:()=>downloadZip(groupedFiles),children:(0,i18next.t)("filePacks.details.downloadAll")})}),sortCategories(Object.entries(groupedFiles)).map(param=>{let[category,files]=param;return(0,jsx_runtime.jsxs)(Accordion.Z,{expanded:expandedCategory===category,onChange:(_,isExpanded)=>setExpandedCategory(isExpanded?category:null),sx:{mb:2},children:[(0,jsx_runtime.jsx)(AccordionSummary.Z,{expandIcon:(0,jsx_runtime.jsx)(ExpandMore.Z,{}),children:(0,jsx_runtime.jsx)(Typography.Z,{variant:"subtitle1",children:mapCategoryToName(category)})}),(0,jsx_runtime.jsx)(AccordionDetails.Z,{children:(0,jsx_runtime.jsx)(FileCategoryBlock,{category:category,files:files,onPreview:setPreviewImage})})]},category)}),(0,jsx_runtime.jsx)(Dialog.Z,{open:!!previewImage,onClose:()=>setPreviewImage(null),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{maxHeight:"90vh",overflow:"hidden"}},children:(0,jsx_runtime.jsxs)(DialogContent.Z,{sx:{...styles.dialogContent,overflow:"hidden",p:0,backgroundColor:"#fff"},children:[(0,jsx_runtime.jsx)(IconButton.Z,{onClick:()=>setPreviewImage(null),sx:styles.closeButton,children:(0,jsx_runtime.jsx)(Close.Z,{})}),previewImage&&(0,jsx_runtime.jsx)(Tooltip.Z,{title:(0,i18next.t)("filePacks.details.downloadImage"),children:(0,jsx_runtime.jsx)(IconButton.Z,{component:"a",href:previewImage,download:!0,sx:styles.downloadButton,children:(0,jsx_runtime.jsx)(Download.Z,{})})}),previewImage&&(0,jsx_runtime.jsx)(Box.Z,{sx:{maxWidth:"90vw",maxHeight:"90vh",overflow:"hidden",backgroundColor:"#fff"},children:(0,jsx_runtime.jsx)("img",{src:previewImage,alt:"Full Preview",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain"}})})]})})]}):(0,jsx_runtime.jsx)(Typography.Z,{color:"error",align:"center",sx:{p:6},children:(0,i18next.t)("filePacks.details.InvalidFilePack")})}}},function(__webpack_require__){__webpack_require__.O(0,[5733,9774,2888,179],function(){return __webpack_require__(__webpack_require__.s=37604)}),_N_E=__webpack_require__.O()}]);
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.