/*! For license information please see 4713.47aa8ddc.js.LICENSE.txt */ "use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["4713"],{56743:function(e,t,n){n.d(t,{Z:()=>i});let i=(0,n(36150).Z)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},2563:function(e,t,n){n.r(t),n.d(t,{ImageViewerContents:()=>Z,ImageViewerModal:()=>f});var i=n(16584),o=n(30396),a=n(94184),r=n.n(a),l=n(2564),d=n(56743),s=n(71375),c=n(71212);n(98661);var u=n(98914),m=n(15771),p=n(19081),g=n(6490),v=n(98248),w=n(60308);let h={chrome:"chrome-_LLvs8",inactive:"inactive-_Lk_xA",modalImageButtonContainer:"modalImageButtonContainer-gaFoGh",modalImageSidebar:"modalImageSidebar-WtdDRF",imgContainer:"imgContainer-_cFpip",img:"img-nwpk1x",isLoading:"isLoading-siuKfF"};function f(e){let{showModal:t,modalContent:n,onClose:o,step:a,includeDownloadButton:r=!0}=e;return(0,i.tZ)(g.u_,{isOpen:t,onClose:o,position:"full",children:(0,i.tZ)(Z,{modalContent:n,onClose:o,stepDefault:a,includeDownloadButton:r})})}function Z(e){let{modalContent:t=[],onClose:n,stepDefault:a,includeDownloadButton:m}=e,[p,g]=(0,o.eJ)(a),[f,Z]=(0,o.eJ)(!0),k=(0,u.K1)(),C=e=>{e.currentTarget===e.target&&n()},[y,L]=(0,o.eJ)(!1);(0,o.d4)(()=>{if(!k){let e;let t=e=>{let{key:t}=e;["ArrowRight","ArrowDown"].includes(t)?(F(),e.stopPropagation()):["ArrowLeft","ArrowUp"].includes(t)&&(I(),e.stopPropagation())},n=n=>{(null==n?void 0:n.type)==="keydown"&&t(n),clearTimeout(e),L(!1),e=setTimeout(()=>{L(!0)},2e3)};return window.addEventListener("pointermove",n,{capture:!0,passive:!0}),window.addEventListener("pointerdown",n,{capture:!0,passive:!0}),window.addEventListener("keydown",n,{capture:!0,passive:!0}),n(),()=>{clearTimeout(e),window.removeEventListener("pointermove",n,{capture:!0}),window.removeEventListener("pointerdown",n,{capture:!0}),window.removeEventListener("keydown",n,{capture:!0})}}},[k,p]);let I=()=>{0!==p&&(g(p-1),Z(!0))},F=()=>{p!==t.length-1&&(g(p+1),Z(!0))},{attrs:{src:E,alt:S,title:z}}=t[p];(0,o.d4)(()=>{if(!f){var e;let n=null===(e=t[p+1])||void 0===e?void 0:e.attrs.src;n&&(new Image().src=(0,w.zF4)(n,void 0,{quality:"auto:good"}))}},[p,f]);let B=k?8:16;return(0,i.BX)(i.HY,{children:[(0,i.BX)("div",{className:r()(h.chrome,y&&h.inactive),children:[p0&&(0,i.tZ)(b,{buttonFunction:I,style:{left:0,padding:B},isSidebar:!0,icon:(0,i.tZ)(d.Z,{size:20,strokeWidth:2})}),(0,i.tZ)(b,{buttonFunction:n,style:{position:"absolute",right:B,top:B},isSidebar:!1,icon:(0,i.tZ)(s.Z,{size:20})}),m&&(0,i.tZ)(b,{buttonFunction:e=>{e.stopPropagation(),function(e,t){let n=document.createElement("a");document.body.appendChild(n),n.href=t,n.target="_blank",n.click(),document.body.removeChild(n)}(0,E)},style:{position:"absolute",left:B,top:B},isSidebar:!1,icon:(0,i.tZ)(c.Z,{size:20})})]}),(0,i.tZ)("div",{className:h.imgContainer,onClick:C,children:(0,i.tZ)("img",{className:r()(h.img,f&&h.isLoading),onLoad:()=>{Z(!1)},alt:null!=S?S:void 0,title:null!=z?z:void 0,src:(0,w.zF4)(E,void 0,{quality:"auto:good"}),onClick:C},E)}),f&&(0,i.tZ)("div",{style:{position:"absolute",top:"50%",left:"50%"},children:(0,i.tZ)(v.$j,{})})]})}function b(e){let{buttonFunction:t,style:n,isSidebar:o,icon:a,tetherRef:l}=e;return(0,i.tZ)(p.hs,{className:r()(h.modalImageButtonContainer,o?h.modalImageSidebar:null),style:n,alignItems:"center",justifyContent:"center",onClick:t,ref:l,children:(0,i.tZ)(m.GI,{priority:"secondary",rounded:!0,children:a})})}}}]);