1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8920],{4035:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/offline",function(){return n(6240)}])},6240:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return j}});var a=n(5893),i=n(7294),s=n(9008),o=n.n(s),l=n(1664),r=n.n(l),c=n(5675),d=n.n(c),f=n(8945),h=n(8858),_=n(1637),m=n(5287),u=n(4214),g=n.n(u);async function p(e){if(!("caches"in window))return!1;try{let t=new URL(e,window.location.origin);if(t.origin!==window.location.origin)return!1;let n=[t.href,"".concat(t.pathname).concat(t.search).concat(t.hash),"".concat(t.pathname).concat(t.search),t.pathname].filter((e,t,n)=>e&&n.indexOf(e)===t),a=await caches.open("tsp-editions-offline");for(let e of n){let n=await a.match(e)||await a.match(e,{ignoreSearch:!0});if(n){let e=(0,m.Kj)(await n.text(),t.href);return window.history.pushState(null,"","".concat(t.pathname).concat(t.search).concat(t.hash)),document.open(),document.write(e),document.close(),!0}}}catch(t){console.warn("Offline page: failed to open cached document",e,t)}return!1}function x(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(1)," ").concat(["B","KB","MB","GB"][t])}function j(){let{offlineEditions:e,removeEdition:t,removeAll:n,downloadEdition:s,storageEstimate:l,isSupported:c}=(0,f.q)(),{savedArticles:m,removeSaved:u}=(0,h.g)(),[j,v]=(0,i.useState)(null),[N,w]=(0,i.useState)(null),[y,C]=(0,i.useState)(!1),b=m.filter(e=>e.path&&e.title),k=(0,i.useCallback)(e=>{w(e),setTimeout(()=>{u(e),w(null)},350)},[u]),B=(0,i.useCallback)(async e=>{v(e),setTimeout(async()=>{await t(e),v(null)},350)},[t]),I=(0,i.useCallback)(async()=>{if(!y){C(!0),setTimeout(()=>C(!1),4e3);return}await n(),C(!1)},[y,n]),M=(0,i.useCallback)(async e=>{await s({editionId:e.editionId,nid:e.nid,title:e.title,issueNumber:e.issueNumber,editionPath:e.editionPath,coverImageUrl:e.coverImageUrl,articleUrls:e.articleUrls})},[s]),A=(0,i.useCallback)(async(e,t)=>{if(e.preventDefault(),!await p(t)){if("undefined"!=typeof navigator&&navigator.onLine){window.location.href=t;return}window.alert("This item is not available offline yet. Open it once while online, then try again.")}},[]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o(),{children:(0,a.jsx)("title",{children:"Offline Reading | The Saturday Paper"})}),(0,a.jsxs)("div",{className:g().page,children:[(0,a.jsx)("header",{className:g().header,children:(0,a.jsx)(r(),{href:"/",className:g().homeLink,children:"The Saturday Paper"})}),(0,a.jsxs)("div",{className:g().container,children:[(0,a.jsx)("h1",{className:g().heading,children:"Offline Editions"}),(0,a.jsx)("p",{className:g().intro,children:"Editions saved for offline reading. Open any article while offline and it will load from your device."}),c?0===e.length?(0,a.jsxs)("div",{className:g().empty,children:[(0,a.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),(0,a.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,a.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),(0,a.jsx)("p",{children:"No editions saved offline"}),(0,a.jsxs)("p",{className:g().emptyHint,children:["Visit an ",(0,a.jsx)(r(),{href:"/editions",children:"edition page"})," and tap âSave offlineâ to download it for offline reading."]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:g().list,children:e.map(e=>(0,a.jsxs)("div",{className:"".concat(g().item," ").concat(j===e.editionId?g().removing:""),children:[e.coverImageUrl&&(0,a.jsx)(r(),{href:e.editionPath,className:g().itemImage,children:(0,a.jsx)(d(),{src:(0,_.LL)(e.coverImageUrl),alt:"",width:100,height:143,sizes:"100px"})}),(0,a.jsxs)("div",{className:g().itemContent,children:[(0,a.jsxs)("span",{className:g().issueNumber,children:["No. ",e.issueNumber]}),(0,a.jsx)(r(),{href:e.editionPath,className:g().itemTitle,onClick:t=>A(t,e.editionPath),children:e.title}),(0,a.jsxs)("span",{className:g().itemMeta,children:[function(e){switch(e.status){case"complete":return"".concat(e.articleCount," articles");case"partial":return"".concat(e.downloadedCount,"/").concat(e.articleCount," articles");case"error":return"Download failed";case"downloading":return"Downloading...";default:return""}}(e),"complete"===e.status&&(0,a.jsx)("span",{className:g().statusDot})]})]}),(0,a.jsxs)("div",{className:g().itemActions,children:[(0,a.jsx)(r(),{href:e.editionPath,className:g().readBtn,onClick:t=>A(t,e.editionPath),children:"Read"}),("partial"===e.status||"error"===e.status)&&(0,a.jsx)("button",{className:g().retryBtn,onClick:()=>M(e),children:"Retry"}),(0,a.jsx)("button",{className:g().removeBtn,onClick:()=>B(e.editionId),"aria-label":'Remove "'.concat(e.title,'" from offline editions'),children:"Remove"})]})]},e.editionId))}),l&&l.quota>0&&(0,a.jsxs)("div",{className:g().storage,children:[(0,a.jsx)("div",{className:g().storageBar,children:(0,a.jsx)("div",{className:g().storageUsed,style:{width:"".concat(Math.min(100,l.used/l.quota*100),"%")}})}),(0,a.jsxs)("span",{className:g().storageLabel,children:[x(l.used)," of ",x(l.quota)," used"]})]}),(0,a.jsx)("div",{className:g().clearAllWrap,children:(0,a.jsx)("button",{className:g().clearAllBtn,onClick:I,onBlur:()=>C(!1),children:y?"Are you sure?":"Remove all offline editions"})})]}):(0,a.jsx)("div",{className:g().empty,children:(0,a.jsx)("p",{children:"Offline reading is not supported in this browser."})}),b.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h2",{className:g().sectionHeading,children:"Saved Articles"}),(0,a.jsxs)("p",{className:g().intro,children:[b.length," article",1!==b.length?"s":""," saved to your reading list."]}),(0,a.jsx)("div",{className:g().list,children:b.map(e=>(0,a.jsxs)("div",{className:"".concat(g().savedItem," ").concat(N===e.nid?g().removing:""),children:[(0,a.jsxs)("div",{className:g().itemContent,children:[e.category&&(0,a.jsx)("span",{className:g().savedCategory,children:e.category}),(0,a.jsx)(r(),{href:e.path,className:g().itemTitle,onClick:t=>A(t,e.path),children:e.title}),(0,a.jsxs)("span",{className:g().itemMeta,children:["Saved ",function(e){let t=Math.floor((Date.now()-e)/6e4);if(t<1)return"Just now";if(t<60)return"".concat(t,"m ago");let n=Math.floor(t/60);if(n<24)return"".concat(n,"h ago");let a=Math.floor(n/24);return a<30?"".concat(a,"d ago"):"".concat(Math.floor(a/30),"mo ago")}(e.savedAt)]})]}),(0,a.jsxs)("div",{className:g().itemActions,children:[(0,a.jsx)(r(),{href:e.path,className:g().readBtn,onClick:t=>A(t,e.path),children:"Read"}),(0,a.jsx)("button",{className:g().removeBtn,onClick:()=>k(e.nid),children:"Remove"})]})]},e.nid))})]})]})]})]})}},4214:function(e){e.exports={page:"_offline_page__IgiXO",header:"_offline_header__Q4Rk4",homeLink:"_offline_homeLink__N_WNo",container:"_offline_container__Jj2jn",heading:"_offline_heading__Z6w6e",intro:"_offline_intro__MKVoa",empty:"_offline_empty__BJ21f",emptyHint:"_offline_emptyHint__05_W9",list:"_offline_list__uwbrz",item:"_offline_item__XE28Q",itemImage:"_offline_itemImage__1keCZ",itemActions:"_offline_itemActions__Oria8",removing:"_offline_remov
1ing__o2UIC",itemContent:"_offline_itemContent__1rwCe",issueNumber:"_offline_issueNumber__37tFT",itemTitle:"_offline_itemTitle__B5daF",itemMeta:"_offline_itemMeta__8gMit",statusDot:"_offline_statusDot__L2C2H",readBtn:"_offline_readBtn__IbF1h",retryBtn:"_offline_retryBtn__pPhm_",removeBtn:"_offline_removeBtn__XnGxY",storage:"_offline_storage___bnbg",storageBar:"_offline_storageBar__zidYE",storageUsed:"_offline_storageUsed__pH8wf",storageLabel:"_offline_storageLabel__LX8E4",clearAllWrap:"_offline_clearAllWrap__VAXjF",sectionHeading:"_offline_sectionHeading__POdWH",savedItem:"_offline_savedItem__wRWem",savedCategory:"_offline_savedCategory__XO1aX",clearAllBtn:"_offline_clearAllBtn__4EKSd"}}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=4035)}),_N_E=e.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.