"use strict";(()=>{function dt(){let t=navigator.deviceMemory,e=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,i=Math.min(screen.width,screen.height)<=820;return t!==void 0&&t<=4||e&&i?120*1048576:250*1048576}var U=class{constructor(t){this.budget=t;this.entries=new Map;this.used=0}get(t){let e=this.entries.get(t);return e&&(this.entries.delete(t),this.entries.set(t,e)),e}has(t){return this.entries.has(t)}put(t,e){let i=this.entries.get(t);if(i){i.bitmap!==e&&e.close();return}let s=e.width*e.height*4;this.entries.set(t,{bitmap:e,bytes:s,at:performance.now()}),this.used+=s,this.evict()}evict(){for(;this.used>this.budget&&this.entries.size>1;){let t=this.entries.keys().next();if(t.done)return;let e=this.entries.get(t.value);this.entries.delete(t.value),e&&(this.used-=e.bytes,e.bitmap.close())}}};(function(a){let t={from:"Guoliang",to:"Lucio",letters:[{ch:"G",kind:"keep",shared:"M8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50",fullA:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",fullB:"M8.50 0.00L8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50L80.00 91.50",out:[{d:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00",P:79.21,j:"end"},{d:"M58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",P:73.21,j:"start"}],in:[{d:"M8.50 22.00L8.50 0.00",P:22,j:"start"},{d:"M58.00 91.50L80.00 91.50",P:22,j:"start"}],x0:0,x1:0,dot:null},{ch:"u",kind:"keep",shared:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullA:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullB:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",out:[],in:[],x0:88.8,x1:88,dot:null},{ch:"o",kind:"keep",shared:"M38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullB:"M60.00 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50L60.00 91.50",out:[{d:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50",P:60.41,j:"both"}],in:[{d:"M38.00 46.50L60.00 46.50",P:22,j:"start"},{d:"M38.00 91.50L60.00 91.50",P:22,j:"start"}],x0:159,x1:158.2,dot:null},{ch:"l",kind:"fade",d:"M8.50 0.00L8.50 100.00",x0:230.8,x1:230.8,dot:null},{ch:"i",kind:"keep",shared:"M8.50 38.00L8.50 100.00",fullA:"M8.50 38.00L8.50 100.00",fullB:"M8.50 38.00L8.50 100.00",out:[],in:[],x0:262.8,x1:227.9,dot:[0,14,17]},{ch:"a",kind:"fade",d:"M38.00 91.50L51.50 91.50L51.50 78.00L51.50 60.00L51.50 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",x0:291.6,x1:291.6,dot:null},{ch:"n",kind:"fade",d:"M51.50 100.00L51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00L8.50 100.00",x0:362.7,x1:362.7,dot:null},{ch:"g",kind:"keep",shared:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M0.00 127.50L38.00 127.50A13.50 13.50 0 0 0 51.50 114.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00",fullB:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",out:[{d:"M51.50 60.00L51.50 114.00A13.50 13.50 0 0 1 38.00 127.50L0.00 127.50",P:113.21,j:"start"}],in:[],x0:432.9,x1:256.7,dot:null}],pad:17,vbw:526.9,vbh:170,stroke:17,raysT:"translate(0.000 22.727) scale(0.7727)"},e="M47.6 70.7L71.9 61.1L71.1 58.2L45.2 62.0ZM44.9 61.5L61.2 40.9L59.1 38.8L38.5 55.1ZM38.0 54.8L41.8 28.9L38.9 28.1L29.3 52.4Z",i="http://www.w3.org/2000/svg",s=(c,w)=>{let l=document.createElementNS(i,c);for(let u in w)l.setAttribute(u,w[u]);return l},n=()=>a.matchMedia&&a.matchMedia("(prefers-reduced-motion: reduce)").matches,r=c=>Math.max(0,Math.min(1,c)),o=c=>c*c*(3-2*c),d=.5;function h(c,w){let l=0,u=0,p=null,b=0;function C(y){let v=(y-b)/w;b=y,l=lf(1),reverse:()=>f(0),toggle:()=>f(u?0:1),set:y=>{cancelAnimationFrame(p),p=null,u=l=y,c(l)},stop:()=>{cancelAnimationFrame(p),p=null},get t(){return l}}}function g(c,w,l,u){let p=r(u)*w;if(c.style.visibility=p<.05?"hidden":"visible",l==="both"){let b=p/2;c.setAttribute("stroke-dasharray",b.toFixed(2)+" "+Math.max(0,w-2*b).toFixed(2)+" "+b.toFixed(2)),c.setAttribute("stroke-dashoffset","0")}else l==="end"?(c.setAttribute("stroke-dasharray",p.toFixed(2)+" "+(2*w+20).toFixed(2)),c.setAttribute("stroke-dashoffset",(-(w-p)).toFixed(2))):(c.setAttribute("stroke-dasharray",p.toFixed(2)+" "+(2*w+20).toFixed(2)),c.setAttribute("stroke-dashoffset","0"))}function k(c,w={}){let l=Object.assign({trigger:"hover",color:"currentColor",rays:"#FFF3CF",duration:450,autoDelay:1800},w),u=s("svg",{viewBox:"0 0 "+t.vbw+" "+t.vbh,role:"img","aria-label":"Guoliang Chen, Lucio"});u.style.display="block",u.style.width="100%",u.style.height="auto";let p=s("g",{transform:"translate("+t.pad+" "+t.pad+")",fill:"none",stroke:l.color,"stroke-width":t.stroke,"stroke-linejoin":"miter","stroke-linecap":"butt"});u.appendChild(p);let b=t.letters.map(v=>{let x=s("g",{transform:"translate("+v.x0+" 0)"});p.appendChild(x);let E=Object.assign({g:x,outEls:[],inEls:[]},v);if(v.kind==="fade")E.fadeEl=s("path",{d:v.d}),x.appendChild(E.fadeEl);else{E.fullA=s("path",{d:v.fullA}),x.appendChild(E.fullA),E.fullB=s("path",{d:v.fullB}),x.appendChild(E.fullB),v.shared&&x.appendChild(s("path",{d:v.shared}));for(let M of v.out){let A=s("path",{d:M.d});x.appendChild(A),E.outEls.push([A,M])}for(let M of v.in){let A=s("path",{d:M.d});x.appendChild(A),E.inEls.push([A,M])}}return v.dot&&(E.dotEl=s("rect",{x:v.dot[0],y:v.dot[1],width:v.dot[2],height:v.dot[2],rx:v.dot[2]*.22,fill:l.color,stroke:"none"}),x.appendChild(E.dotEl)),E}),C=s("path",{d:e,fill:l.rays,stroke:"none",opacity:0});p.appendChild(C),c.appendChild(u);function f(v){let x=o(r(v/d)),E=o(r((v-d)/(1-d)));for(let M of b){if(M.kind==="fade")M.fadeEl.setAttribute("opacity",(1-x).toFixed(3)),M.dotEl&&M.dotEl.setAttribute("opacity",(1-x).toFixed(3));else{for(let[A,S]of M.outEls)g(A,S.P,S.j,1-x);for(let[A,S]of M.inEls)g(A,S.P,S.j,x);M.fullA.style.visibility=x<=.001?"visible":"hidden",M.fullB.style.visibility=x>=.999?"visible":"hidden"}M.g.setAttribute("transform","translate("+(M.x0+(M.x1-M.x0)*E).toFixed(2)+" 0)")}C.setAttribute("transform","translate("+(b[0].x0+(b[0].x1-b[0].x0)*E).toFixed(2)+" 0) "+t.raysT),C.setAttribute("opacity",r((v-.8)/.2).toFixed(3))}let y=h(f,l.duration);return f(0),l.trigger==="hover"&&(c.addEventListener("mouseenter",y.play),c.addEventListener("mouseleave",y.reverse),c.addEventListener("focus",y.play),c.addEventListener("blur",y.reverse)),l.trigger==="click"&&c.addEventListener("click",y.toggle),l.trigger==="auto"&&setInterval(y.toggle,l.autoDelay+l.duration),Object.assign(y,{svg:u})}let L={C:[0,.75],L:[.25,.75],U:[.25,1],I:[.75,1],O:[.75,1.75]};function m(c,w,l){let u=w/2,p=l-u,b=u+p,C=p*Math.SQRT1_2,f=v=>v.toFixed(3);return{d:"M"+f(c-b+C)+" "+f(b-C)+"A"+f(p)+" "+f(p)+" 0 0 0 "+f(c-b)+" "+f(u)+"H"+f(b)+"A"+f(p)+" "+f(p)+" 0 0 0 "+f(u)+" "+f(b)+"V"+f(c-b)+"A"+f(p)+" "+f(p)+" 0 0 0 "+f(b)+" "+f(c-u)+"H"+f(c-b)+"A"+f(p)+" "+f(p)+" 0 0 0 "+f(c-u)+" "+f(c-b)+"V"+f(b)+"A"+f(p)+" "+f(p)+" 0 0 0 "+f(c-b+C)+" "+f(b-C)+"Z",P:4*(c-2*b)+2*Math.PI*p}}function T(c,w={}){let l=Object.assign({sequence:"LUCIO",color:"#F3F1EC",track:"#26262D",rays:"#FFF3CF",hold:480,morph:640,size:96,stroke:.17,radius:.22},w),u=120,p=u*l.stroke,b=u*l.radius,C=m(u,p,b),f=s("svg",{viewBox:"0 0 "+u+" "+u,width:l.size,height:l.size,role:"img","aria-label":"Loading"});l.track&&f.appendChild(s("path",{d:C.d,fill:"none",stroke:l.track,"stroke-width":p}));let y=s("path",{d:C.d,fill:"none",stroke:l.color,"stroke-width":p,"stroke-linecap":"butt"}),v=p/22,x=s("path",{d:e,fill:l.rays,transform:"translate("+(p-22*v).toFixed(3)+" "+(u-p-78*v).toFixed(3)+") scale("+v.toFixed(4)+")",opacity:0});f.appendChild(y),f.appendChild(x);let E=(R,H)=>{let I=Math.min(1,Math.max(0,H-R))*C.P;y.setAttribute("stroke-dasharray",I.toFixed(3)+" "+Math.max(0,C.P-I).toFixed(3)),y.setAttribute("stroke-dashoffset",(-R*C.P).toFixed(3))},M=(R,H)=>{let[I,B]=L[H];for(let F=-1;F<6;F++)if(I+F>=R[0]-1e-6&&B+F>=R[1]-1e-6)return[I+F,B+F];return[I,B]},A=l.sequence.split(""),S=0,P=L[A[0]].slice(),et,it,rt=!1;E(P[0],P[1]),x.setAttribute("opacity",A[0]==="L"?1:0);function ot(){if(rt)return;let R=(S+1)%A.length,H=M(P,A[R]),I=P.slice(),B=A[S]==="L",F=A[R]==="L",at=()=>{P=H;let _=Math.floor(P[0]);P[0]-=_,P[1]-=_,S=R,E(P[0],P[1]),x.setAttribute("opacity",F?1:0),it=setTimeout(ot,l.hold)};if(n()){at();return}let At=performance.now(),ht=_=>{let q=Math.min(1,(_-At)/l.morph),lt=q<.5?4*q*q*q:1-Math.pow(-2*q+2,3)/2;E(I[0]+(H[0]-I[0])*lt,I[1]+(H[1]-I[1])*lt),x.setAttribute("opacity",F?Math.max(0,(q-.6)/.4).toFixed(3):B?Math.max(0,1-q*2.5).toFixed(3):0),q<1?et=requestAnimationFrame(ht):at()};et=requestAnimationFrame(ht)}return it=setTimeout(ot,l.hold),c.appendChild(f),{svg:f,stop:()=>{rt=!0,cancelAnimationFrame(et),clearTimeout(it)}}}a.LucioMorph={wordmark:k,loader:T}})(window);var N={graphite:"#111114",graphite3:"#26262D",paper:"#F3F1EC",beam:"#FFF3CF"};function st(){return window.LucioMorph??null}function V(a,t){let e=st();if(!e)return null;let i=document.createElement("span");i.className="wordmark-svg",i.setAttribute("aria-hidden","true"),a.appendChild(i);let s=e.wordmark(i,{trigger:"manual",color:N.paper,rays:N.beam});return s.svg.setAttribute("aria-hidden","true"),s.svg.removeAttribute("role"),t||s.set(1),a.classList.add("has-svg"),s}function ct(){let a=document.getElementById("chop-template");if(!(a instanceof HTMLTemplateElement))return null;let t=a.content.firstElementChild;return t?t.cloneNode(!0):null}var Ct=400,D=class{constructor(t,e=()=>!0){this.canShow=e;this.handle=null;this.loader=null;this.timer=0;this.hideTimer=0;this.visible=!1;this.element=document.createElement("div"),this.element.className="busy",this.element.setAttribute("role","status"),this.element.setAttribute("aria-label","Loading"),t.appendChild(this.element)}watch(t){if(t===this.loader){this.update(t);return}this.loader=t,clearTimeout(this.timer),this.timer=0,this.hide(),this.update(t)}update(t){if(!t||t!==this.loader)return;let e=t.status;if(!e.active||e.sharp){clearTimeout(this.timer),this.timer=0,this.hide();return}if(!this.visible&&this.timer===0){let i=Math.max(0,Ct-(performance.now()-e.started));this.timer=window.setTimeout(()=>this.check(),i)}}check(){this.timer=0;let t=this.loader;if(!(!t||!t.status.active||t.status.sharp)){if(!this.canShow()){this.timer=window.setTimeout(()=>this.check(),100);return}this.show()}}show(){if(!this.visible){if(clearTimeout(this.hideTimer),this.visible=!0,!this.handle){let t=st();t&&(this.handle=t.loader(this.element,{size:56,color:N.paper,track:N.graphite3,rays:N.beam}),this.handle.svg.setAttribute("aria-hidden","true"))}this.element.classList.add("is-visible")}}hide(){this.visible&&(this.visible=!1,this.element.classList.remove("is-visible"),clearTimeout(this.hideTimer),this.hideTimer=window.setTimeout(()=>{!this.visible&&this.handle&&(this.handle.stop(),this.handle.svg.remove(),this.handle=null)},300))}},Y=class{constructor(t){this.loader=null;this.shown=!1;this.value=-1;this.element=document.createElement("div"),this.element.className="progress",this.element.setAttribute("aria-hidden","true"),t.appendChild(this.element)}watch(t){this.loader=t,this.value=-1,this.update(t)}update(t){if(!t||t!==this.loader)return;let e=t.status,i=e.active&&!e.sharp&&e.planned>0,s=e.planned>0?Math.min(1,e.done/e.planned):0;i!==this.shown&&(this.shown=i,this.element.classList.toggle("is-visible",i));let n=Math.round(s*1e3)/1e3;n!==this.value&&(this.value=n,this.element.style.transform="scaleX("+(i?n:1)+")")}};function X(a,t,e){let i=t*e;for(let s=0;s=i)return s;return a.levels.length-1}function K(a,t,e){let i=Math.max(0,t.u0*a.width),s=Math.min(a.width,t.u1*a.width),n=Math.max(0,t.v0*a.height),r=Math.min(a.height,t.v1*a.height);return s<=i||r<=n?null:{x0:Math.min(a.cols-1,Math.floor(i/e)),x1:Math.min(a.cols-1,Math.ceil(s/e)-1),y0:Math.min(a.rows-1,Math.floor(n/e)),y1:Math.min(a.rows-1,Math.ceil(r/e)-1)}}function ut(a,t,e,i){let s=a.levels[t],n=K(s,e,i);if(!n)return[];let r=(e.u0+e.u1)/2*s.width,o=(e.v0+e.v1)/2*s.height,d=[];for(let h=n.y0;h<=n.y1;h++)for(let g=n.x0;g<=n.x1;g++){let k=(g*i+Math.min((g+1)*i,s.width))/2,L=(h*i+Math.min((h+1)*i,s.height))/2;d.push({level:t,x:g,y:h,index:h*s.cols+g,distance:(k-r)**2+(L-o)**2})}return d.sort((h,g)=>h.distance-g.distance),d.map(({level:h,x:g,y:k,index:L})=>({level:h,x:g,y:k,index:L}))}function pt(a,t,e,i,s,n,r,o,d,h){let g=i*n,k=Math.min((i+1)*n,e.width),L=s*n,m=Math.min((s+1)*n,e.height),T=i>0?g-r:0,c=s>0?L-r:0,w=Math.round(o+g*h),l=Math.round(o+k*h),u=Math.round(d+L*h),p=Math.round(d+m*h);if(l<=w||p<=u)return;let b=Math.max(T,(w-o)/h),C=Math.min(T+t.width,(l-o)/h),f=Math.max(c,(u-d)/h),y=Math.min(c+t.height,(p-d)/h);C<=b||y<=f||a.drawImage(t,b-T,f-c,C-b,y-f,w,u,l-w,p-u)}var z=class extends Error{constructor(){super("aborted"),this.name="AbortError"}},Z=class{constructor(t,e){this.concurrency=t;this.byId=new Map;this.byKey=new Map;this.queue=[];this.workers=[];this.running=0;this.nextKey=1;this.nextSeq=1;this.nextWorker=0;if(typeof Worker>"u"||e==="")return;let i=(navigator.hardwareConcurrency??2)>=4?2:1;for(let s=0;sthis.onReply(o.data),n.onerror=()=>this.dropWorker(r),this.workers.push(n)}catch{break}}request(t,e,i,s){return s.aborted?Promise.reject(new z):new Promise((n,r)=>{let o=this.byId.get(t);o?i{h.waiters.delete(d)&&(r(new z),h.waiters.size===0&&setTimeout(()=>{h.waiters.size===0&&this.byKey.get(h.key)===h&&this.cancel(h)},0))},{once:!0}),this.pump()})}cancel(t){if(this.forget(t),!t.running){let e=this.queue.indexOf(t);e>=0&&this.queue.splice(e,1);return}t.running=!1,this.running--,t.controller?t.controller.abort():t.worker>=0&&this.workers[t.worker]&&this.workers[t.worker].postMessage({type:"abort",key:t.key}),this.pump()}forget(t){this.byId.get(t.id)===t&&this.byId.delete(t.id),this.byKey.delete(t.key)}pump(){for(;this.running0;){let t=0;for(let i=1;i0){let i=e[this.nextWorker++%e.length];t.worker=i,this.workers[i].postMessage({type:"fetch",key:t.key,url:t.url});return}t.worker=-1,t.controller=new AbortController,this.fetchOnMainThread(t,t.controller.signal)}liveWorkers(){let t=[];return this.workers.forEach((e,i)=>{e&&t.push(i)}),t}dropWorker(t){let e=this.workers[t];if(e){e.terminate(),delete this.workers[t];for(let i of this.byKey.values())i.running&&i.worker===t&&(i.worker=-1,i.controller=new AbortController,this.fetchOnMainThread(i,i.controller.signal))}}async fetchOnMainThread(t,e){let i=performance.now();try{let s=await fetch(t.url,{signal:e,credentials:"same-origin"});if(!s.ok)throw new Error("HTTP "+s.status);let n=await s.blob(),r=performance.now()-i,o=await createImageBitmap(n);this.onReply({key:t.key,ok:!0,bitmap:o,bytes:n.size,ms:r})}catch(s){this.onReply({key:t.key,ok:!1,bytes:0,ms:0,error:String(s)})}}onReply(t){let e=this.byKey.get(t.key);if(!e||!e.running){t.bitmap?.close();return}e.running=!1,this.running--,this.forget(e);let i=[...e.waiters];if(e.waiters.clear(),t.ok&&t.bitmap){let s={bitmap:t.bitmap,bytes:t.bytes,ms:t.ms};for(let n of i)n.resolve(s);i.length===0&&t.bitmap.close()}else{let s=new Error(t.error??"tile failed");for(let n of i)n.reject(s)}this.pump()}};var mt="luphoto.throughput";function ft(){try{let a=Number(sessionStorage.getItem(mt));return Number.isFinite(a)&&a>0?a:null}catch{return null}}function vt(){return ft()??1e3}function gt(a){let t=ft(),e=t===null?a:t*(1-.5)+a*.5;try{sessionStorage.setItem(mt,String(e))}catch{return e}return e}var nt=180,yt=3,G=4,W=class{constructor(t,e){this.pyramid=t;this.env=e;this.seedImage=null;this.seedPromise=null;this.session=null;this.prefetchController=null;this.finalLevel=-1;this.targetLevel=-1;this.status={active:!1,started:0,planned:0,done:0,sharp:!1}}tileUrl(t){let e=this.env.tiles;return e.path+this.pyramid.hash+"/"+t+"."+e.format}ensureSeed(){return this.seedPromise||(this.seedPromise=this.decodeSeed().then(()=>this.env.requestDraw(),()=>{})),this.seedPromise}async decodeSeed(){if(!this.pyramid.seed)return;let t=atob(this.pyramid.seed),e=new Uint8Array(t.length);for(let o=0;o(this.env.cache.put(s,n.bitmap),this.env.requestDraw(),n))}uncached(t,e){let i=this.pyramid.levels[t].tiles;return ut(this.pyramid,t,e,this.env.tiles.tile_size).filter(s=>!this.env.cache.has(i[s.index]))}uncachedBytes(t,e){let i=this.pyramid.levels[t].bytes,s=0;for(let n of this.uncached(t,e))s+=i[n.index];return s}fetchAll(t,e,i){return Promise.allSettled(t.map(s=>this.fetchTile(s,e,i)))}probeLevel(t,e){return Math.max(0,X(this.pyramid,t.displayWidth,e)-yt)}notify(){this.env.onStatus?.(this)}track(t,e,i){return this.status.planned+=t.length,this.notify(),Promise.allSettled(t.map(s=>this.fetchTile(s,0,i).finally(()=>{this.session===e&&(this.status.done++,this.notify())})))}start(t,e,i){this.stopSession();let s=new AbortController;this.session=s,this.targetLevel=-1,this.status.active=!0,this.status.started=performance.now(),this.status.planned=0,this.status.done=0,this.status.sharp=!1,this.notify(),this.run(t,e,s).then(()=>{this.session===s&&(this.session=null,this.status.active=!1,this.notify()),(!s.signal.aborted||s.signal.reason==="deadline")&&i()})}async run(t,e,i){let s=i.signal,n=performance.now(),r=this.env.settings.budgetMs,o=setTimeout(()=>i.abort("deadline"),r);try{if(await this.ensureSeed(),s.aborted)return;let d=X(this.pyramid,t.displayWidth,e),h=Math.max(0,d-yt),g=this.uncached(h,t).slice(0,2);if(g.length>0){let c=await this.track(g,i,s),w=0,l=0;for(let u of c)u.status==="fulfilled"&&(w+=u.value.bytes,l=Math.max(l,u.value.ms));w>0&&l>0&>(w/l)}if(s.aborted)return;this.finalLevel=Math.max(this.finalLevel,h);let k=vt(),L=r-(performance.now()-n),m=h;for(let c=d;c>h;c--)if(this.uncachedBytes(c,t)/k<=L*.8){m=c;break}let T=[];m-h>=2&&T.push(Math.floor((h+m)/2)),m>h&&T.push(m),this.finalLevel=m,this.targetLevel=m,this.env.requestDraw();for(let c of T)if(await this.track(this.uncached(c,t),i,s),s.aborted)return}finally{clearTimeout(o)}}prefetchProbe(t,e){let i=this.resetPrefetch();this.ensureSeed().then(()=>{i.signal.aborted||this.fetchAll(this.uncached(this.probeLevel(t,e),t),1,i.signal)})}prefetchLevel(t,e){if(e<0)return;let i=this.resetPrefetch();this.fetchAll(this.uncached(e,t),1,i.signal)}resetPrefetch(){return this.prefetchController?.abort(),this.prefetchController=new AbortController,this.prefetchController}stopPrefetch(){this.prefetchController?.abort(),this.prefetchController=null}stopSession(){this.session&&(this.session.abort("superseded"),this.session=null,this.status.active=!1,this.notify())}stop(){this.stopSession(),this.stopPrefetch()}draw(t){let{g:e,originX:i,originY:s,width:n,height:r,canvasWidth:o,canvasHeight:d}=t,h=Math.max(0,i),g=Math.max(0,s),k=Math.min(o,i+n),L=Math.min(d,s+r);if(k<=h||L<=g)return!1;this.seedPromise||this.ensureSeed();let m={displayWidth:t.displayWidth,u0:(h-i)/n,u1:(k-i)/n,v0:(g-s)/r,v1:(L-s)/r},T=this.env.tiles.tile_size,c=this.env.tiles.overlap,w=this.env.cache,l=this.pyramid.levels,u=X(this.pyramid,t.displayWidth,t.dpr),p=-1;for(let y=u;y>=0&&p<0;y--){let v=K(l[y],m,T);if(!v)continue;let x=!0;for(let E=v.y0;E<=v.y1&&x;E++)for(let M=v.x0;M<=v.x1;M++){let A=w.get(l[y].tiles[E*l[y].cols+M]);if(!A||t.now-A.at=0?Math.min(this.targetLevel,u):u,C=p>=b;C!==this.status.sharp&&(this.status.sharp=C,queueMicrotask(()=>this.notify()));let f=!1;for(let y=Math.max(0,p);y<=u;y++){let v=l[y],x=K(v,m,T);if(!x)continue;let E=n/v.width;e.imageSmoothingEnabled=!0,e.imageSmoothingQuality=E<1?"high":"medium";for(let M=x.y0;M<=x.y1;M++)for(let A=x.x0;A<=x.x1;A++){let S=w.get(v.tiles[M*v.cols+A]);if(!S)continue;let P=t.now-S.at;Pthis.requestDraw(),onStatus:()=>this.onStatus(this)})}get isOpen(){return this.expanded}layout(t){let e=this.cover,i=Math.max(t.width/e.width,t.open/e.height),s=e.width*i,n=e.height*i,r=(t.open-n)/2,o=r+this.focusY*n,d=Math.max(0,Math.min(t.open-t.closed,o-t.closed/2)),h=this.geometry;this.geometry={width:t.width,closed:t.closed,open:t.open,dpr:t.dpr,coverWidth:s,coverHeight:n,x:(t.width-s)/2,y:r,band:d},this.canvas&&(this.sizeCanvas(this.canvasOpen),this.drawNow()),this.near&&h&&(h.width!==t.width||h.closed!==t.closed||h.open!==t.open||h.dpr!==t.dpr)&&this.startSession()}attach(){if(this.canvas)return;let t=document.createElement("canvas");t.className="strip-canvas",t.setAttribute("aria-hidden","true");let e=t.getContext("2d",{alpha:!1});e&&(this.canvas=t,this.g=e,this.element.prepend(t),this.sizeCanvas(this.expanded),this.drawNow())}detach(){this.canvas&&(cancelAnimationFrame(this.frame),this.frame=0,this.canvas.width=0,this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.g=null)}setNear(t){t!==this.near&&(this.near=t,t?this.startSession():this.loader.stop())}setOpen(t){if(t===this.expanded)return;this.expanded=t,this.element.classList.toggle("is-open",t),clearTimeout(this.settleTimer);let e=this.geometry,i=this.canvas;t?i&&this.canvasOpen?(i.style.transition="",i.style.transform="translate3d(0,0,0)"):i&&e&&(this.sizeCanvas(!0),i.style.transition="none",i.style.transform="translate3d(0,"+-e.band+"px,0)",this.drawNow(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.expanded&&this.canvas===i&&(i.style.transition="",i.style.transform="translate3d(0,0,0)")})})):i&&e&&(i.style.transition="",i.style.transform="translate3d(0,"+-e.band+"px,0)",this.settleTimer=window.setTimeout(()=>{!this.expanded&&this.canvas===i&&(this.sizeCanvas(!1),this.drawNow())},Pt)),this.near&&this.startSession()}sizeCanvas(t){let e=this.canvas,i=this.geometry;if(!e||!i)return;this.canvasOpen=t;let s=t?i.open:i.closed,n=Math.max(1,Math.round(i.width*i.dpr)),r=Math.max(1,Math.round(s*i.dpr));(e.width!==n||e.height!==r)&&(e.width=n,e.height=r),e.style.height=s+"px",t||(e.style.transition="none",e.style.transform="translate3d(0,0,0)")}view(){let t=this.geometry;if(!t)return null;let e=this.expanded?0:t.band,i=this.expanded?t.open:t.closed;return{displayWidth:t.coverWidth,u0:Math.max(0,-t.x/t.coverWidth),u1:Math.min(1,(t.width-t.x)/t.coverWidth),v0:Math.max(0,(e-t.y)/t.coverHeight),v1:Math.min(1,(e+i-t.y)/t.coverHeight)}}startSession(){let t=this.view();!t||!this.geometry||this.loader.start(t,this.geometry.dpr,()=>{})}requestDraw(){this.frame===0&&this.canvas&&(this.frame=requestAnimationFrame(t=>{this.frame=0,this.draw(t)&&this.requestDraw()}))}drawNow(){this.draw(performance.now())&&this.requestDraw()}draw(t){let e=this.g,i=this.canvas,s=this.geometry;if(!e||!i||!s)return!1;e.setTransform(1,0,0,1,0,0),e.globalAlpha=1,e.fillStyle="#111114",e.fillRect(0,0,i.width,i.height);let n=this.canvasOpen?0:-s.band;return this.loader.draw({g:e,originX:s.x*s.dpr,originY:(s.y+n)*s.dpr,width:s.coverWidth*s.dpr,height:s.coverHeight*s.dpr,canvasWidth:i.width,canvasHeight:i.height,displayWidth:s.coverWidth,dpr:s.dpr,now:t})}};var It=24,J=class{constructor(t,e,i,s){this.root=t;this.settings=i;this.strips=[];this.onScreen=new Set;this.wordmark=null;this.opened=null;this.scrollFrame=0;this.sizeKey="";let n=Array.from(t.querySelectorAll("a.strip")),r=new Map(e.albums.map(d=>[d.slug,d]));for(let d of n){let h=r.get(d.dataset.slug??"");!h||!h.cover||this.strips.push(new O(d,h.cover,h.collapsed_focus_y??.5,s,g=>this.onStripStatus(g)))}this.hoverMode=matchMedia("(hover: hover) and (pointer: fine)");let o=document.querySelector(".site-header .wordmark");if(this.indicator=new D(document.body,()=>!this.wordmarkMoving()),o){this.wordmark=V(o,!0);let d=()=>{this.wordmark&&!this.indicator.visible&&this.wordmark.play()},h=()=>this.wordmark?.reverse();o.addEventListener("mouseenter",d),o.addEventListener("mouseleave",h),o.addEventListener("focus",d),o.addEventListener("blur",h)}document.documentElement.classList.add("has-strips"),this.measure(),this.observe(),this.bind()}wordmarkMoving(){let t=this.wordmark?.t??0;return t>0&&t<1}measure(){let t=this.root.clientWidth||window.innerWidth,e=window.innerHeight,i=Math.round(Math.min(t*6/32,e*.28)),s=Math.round(Math.min(t*9/32,e*.62)),n=Math.min(window.devicePixelRatio||1,this.settings.maxDpr),r=t+"x"+i+"x"+s+"@"+n;if(r!==this.sizeKey){this.sizeKey=r,this.root.style.setProperty("--strip-closed",i+"px"),this.root.style.setProperty("--strip-open",s+"px");for(let o of this.strips)o.layout({width:t,closed:i,open:s,dpr:n})}}observe(){let t=new Map(this.strips.map(n=>[n.element,n])),e=new IntersectionObserver(n=>{for(let r of n)t.get(r.target)?.setNear(r.isIntersecting)},{rootMargin:"100% 0px"}),i=new IntersectionObserver(n=>{for(let r of n){let o=t.get(r.target);o&&(r.isIntersecting?o.attach():o.detach())}},{rootMargin:"25% 0px"}),s=new IntersectionObserver(n=>{for(let r of n){let o=t.get(r.target);o&&(r.isIntersecting?this.onScreen.add(o):this.onScreen.delete(o))}this.watchFirst(),this.scheduleCentre()});for(let n of this.strips)e.observe(n.element),i.observe(n.element),s.observe(n.element)}watchFirst(){let t=this.strips.find(e=>this.onScreen.has(e))??null;this.indicator.watch(t?t.loader:null)}onStripStatus(t){this.indicator.update(t.loader)}bind(){for(let t of this.strips){let e=t.element;e.addEventListener("mouseenter",()=>{this.hoverMode.matches&&this.open(t)}),e.addEventListener("mouseleave",()=>{this.hoverMode.matches&&this.opened===t&&this.open(null)}),e.addEventListener("focus",()=>this.open(t)),e.addEventListener("blur",()=>{this.opened===t&&!this.hoverMode.matches?this.scheduleCentre():this.opened===t&&this.open(null)}),e.addEventListener("dragstart",i=>i.preventDefault()),this.settings.blockContextMenu&&e.addEventListener("contextmenu",i=>i.preventDefault())}window.addEventListener("scroll",()=>this.scheduleCentre(),{passive:!0}),new ResizeObserver(()=>{this.measure(),this.scheduleCentre()}).observe(this.root)}open(t){t!==this.opened&&(this.opened?.setOpen(!1),this.opened=t,t?.setOpen(!0))}scheduleCentre(){this.hoverMode.matches||this.scrollFrame!==0||(this.scrollFrame=requestAnimationFrame(()=>{this.scrollFrame=0,this.pickCentre()}))}pickCentre(){if(this.hoverMode.matches)return;let t=window.innerHeight/2,e=null,i=1/0,s=1/0;for(let n of this.onScreen){let r=n.element.getBoundingClientRect(),o=Math.abs(r.top+r.height/2-t);o{let n=Number(i);return Number.isFinite(n)&&n>0?n:s};return{page:t.page??"",build:t.build??"",slug:t.album??"",manifestUrl:t.manifest??"",indexUrl:t.index??"",workerUrl:t.worker??"",budgetMs:e(t.budgetMs,3e3),maxDpr:e(t.maxDpr,2),concurrency:Math.max(1,Math.round(e(t.concurrency,6))),blockContextMenu:t.blockContextMenu!=="false"}}function xt(a){return a<10?"0"+a:String(a)}function Rt(a){let t=(a.model??"").trim(),e=(a.make??"").trim(),i=e.split(/\s+/)[0]??"";i&&t.toLowerCase().startsWith(i.toLowerCase()+" ")&&(t=t.slice(i.length+1).trim());let s=/^([A-Za-z]{1,3}) (\d+[A-Za-z0-9]*)$/.exec(t);return s&&(t=s[1]+s[2]),t||e}function Ft(a){let t=/(\d+(?:\.\d+)?(?:-\d+(?:\.\d+)?)?)\s*mm\s*(?:F|f\/?)\s*([\d.]+(?:-[\d.]+)?)/.exec(a);return t?t[1]+" f/"+t[2]:a.trim()}function j(a){return String(Math.round(a*10)/10)}function qt(a){let t=a.trim();if(t.includes("/")||t.endsWith("s"))return t;let e=Number(t);if(!Number.isFinite(e)||e<=0)return t;if(e>=1)return j(e)+"s";let i=1/e;return i<10&&Math.abs(i-Math.round(i))>.05?"1/"+j(i):"1/"+Math.round(i)}function Ht(a,t,e,i){let s=[xt(a+1)+" / "+xt(t)],n=e.exif;if(i&&n){let r=Rt(n);r&&s.push(r),n.lens&&s.push(Ft(n.lens)),n.focal_length&&s.push(j(n.focal_length)+"mm"),n.f_number&&s.push("f/"+j(n.f_number)),n.exposure&&s.push(qt(n.exposure)),n.iso&&s.push("ISO "+n.iso)}return s.join(" \xB7 ")}function Nt(a,t){a.textContent="",t.split(/\r?\n/).forEach((e,i)=>{i>0&&a.appendChild(document.createElement("br"));let s=e.split("*"),n=(s.length-1)%2===0;s.forEach((r,o)=>{let d=o%2===1;if(d&&(n||o!==s.length-1)){let h=document.createElement("em");h.textContent=r,a.appendChild(h)}else a.appendChild(document.createTextNode((d?"*":"")+r))})})}var Q=class{constructor(t){this.visible=!1;this.placement="";this.element=document.createElement("section"),this.element.className="caption",this.element.setAttribute("aria-live","polite"),this.meta=document.createElement("p"),this.meta.className="caption-meta",this.title=document.createElement("h2"),this.title.className="caption-title",this.text=document.createElement("p"),this.text.className="caption-text",this.alt=document.createElement("p"),this.alt.className="visually-hidden",this.element.append(this.meta,this.title,this.text,this.alt),t.appendChild(this.element)}set(t,e,i,s){this.meta.textContent=Ht(e,i,t,s),this.title.textContent=t.title??"",this.title.hidden=!t.title,Nt(this.text,t.caption??""),this.text.hidden=!t.caption,this.alt.textContent=t.alt??""}show(t){t!==this.visible&&(this.visible=t,this.element.classList.toggle("is-visible",t))}place(t,e,i){let s=Math.round(t)+","+Math.round(e)+","+Math.round(i);if(s===this.placement)return;this.placement=s;let n=this.element.style;n.width=Math.round(e)+"px",n.transform="translate3d("+Math.round(t)+"px,"+-Math.round(i)+"px,0)"}};var $=24,Mt=10,Dt=300,Wt=.35,Lt=.35,Ot=.2,Bt=2500;function _t(a,t,e,i){let s=3*a,n=3*(e-a)-s,r=1-s-n,o=3*t,d=3*(i-t)-o,h=1-o-d,g=m=>((r*m+n)*m+s)*m,k=m=>((h*m+d)*m+o)*m,L=m=>(3*r*m+2*n)*m+s;return m=>{if(m<=0)return 0;if(m>=1)return 1;let T=m;for(let l=0;l<8;l++){let u=g(T)-m,p=L(T);if(Math.abs(u)<1e-5)return k(T);if(Math.abs(p)<1e-6)break;T-=u/p}let c=0,w=1;T=m;for(let l=0;l<24;l++){let u=g(T);if(Math.abs(u-m)<1e-5)break;uthis.requestDraw(),onStatus:i=>{this.indicator.update(i),this.progress.update(i)}}),this.loaders[t]=e),e}measure(){let t=this.stage.getBoundingClientRect();this.vw=Math.max(1,t.width),this.vh=Math.max(1,t.height),this.dpr=Math.min(window.devicePixelRatio||1,this.settings.maxDpr);let e=Math.max(1,Math.round(this.vw*this.dpr)),i=Math.max(1,Math.round(this.vh*this.dpr));(this.canvas.width!==e||this.canvas.height!==i)&&(this.canvas.width=e,this.canvas.height=i),this.layouts=[],this.stops=[];let s=0;this.manifest.photos.forEach((n,r)=>{let o=Math.max(1,n.slides||1),d=Math.min(this.vw/(n.width/o),this.vh/n.height),h=n.width*d,g=n.height*d,k=h/o,L=s+$/2+(this.vw-k)/2;this.layouts.push({scale:d,width:h,height:g,section:k,slides:o,start:s,left:L,top:(this.vh-g)/2});for(let m=0;m{this.pointerId===null&&document.body.classList.add("is-idle")},Bt)}stopForHash(){let t=/^#(\d+)$/.exec(location.hash);if(!t)return 0;let e=Math.min(this.manifest.photos.length,Math.max(1,Number(t[1])))-1,i=this.stops.findIndex(s=>s.photo===e);return i<0?0:i}bind(){let t=this.stage;t.addEventListener("pointerdown",e=>this.onPointerDown(e)),t.addEventListener("pointermove",e=>this.onPointerMove(e)),t.addEventListener("pointerup",e=>this.onPointerUp(e,!1)),t.addEventListener("pointercancel",e=>this.onPointerUp(e,!0)),t.addEventListener("pointerleave",e=>{e.pointerType==="mouse"&&this.pointerId===null&&(this.hover=!1,this.updateCaption())}),t.addEventListener("dragstart",e=>e.preventDefault()),t.addEventListener("selectstart",e=>e.preventDefault()),this.settings.blockContextMenu&&t.addEventListener("contextmenu",e=>e.preventDefault()),window.addEventListener("keydown",e=>this.onKey(e)),window.addEventListener("hashchange",()=>{let e=this.stopForHash();this.stops[e].photo!==this.stops[this.current].photo&&this.jump(e)}),new ResizeObserver(()=>this.onResize()).observe(t),this.fade.addEventListener("transitionend",()=>{this.fade.style.opacity==="0"&&(this.fade.width=1,this.fade.height=1)})}onResize(){let t=this.vw+"x"+this.vh+"@"+this.dpr;this.measure(),t!==this.vw+"x"+this.vh+"@"+this.dpr&&(this.tween=null,this.camera=this.stops[this.current].camera,this.requestDraw(),clearTimeout(this.resizeTimer),this.resizeTimer=window.setTimeout(()=>this.startSession(),200))}onKey(t){if(t.altKey||t.ctrlKey||t.metaKey)return;this.wake();let e=t.target;if(!(e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)))){switch(t.key){case"ArrowRight":this.go(this.current+1);break;case"ArrowLeft":this.go(this.current-1);break;case"Home":this.go(0);break;case"End":this.go(this.stops.length-2);break;case"Escape":location.assign("/");break;case"i":case"I":this.pinned=!this.pinned,this.updateCaption();break;default:return}t.preventDefault()}}onPointerDown(t){this.pointerId!==null||t.pointerType==="mouse"&&t.button!==0||t.target.closest("a, button")||(this.pointerId=t.pointerId,this.pointerType=t.pointerType,this.dragging=!1,this.downX=t.clientX,this.downY=t.clientY,this.downT=t.timeStamp,this.tween=null,this.downCamera=this.camera,this.samples=[{t:t.timeStamp,x:t.clientX}],this.stage.setPointerCapture(t.pointerId))}onPointerMove(t){if(t.pointerType==="mouse"&&this.wake(),this.pointerId===null){t.pointerType==="mouse"&&(this.hover=this.inCaptionZone(t.clientX,t.clientY),this.updateCaption());return}if(t.pointerId!==this.pointerId)return;let e=t.clientX-this.downX,i=t.clientY-this.downY;if(!this.dragging&&Math.hypot(e,i)>=Mt&&(this.dragging=!0,this.stage.classList.add("is-dragging"),this.updateCaption()),!!this.dragging){for(this.samples.push({t:t.timeStamp,x:t.clientX});this.samples.length>2&&t.timeStamp-this.samples[0].t>100;)this.samples.shift();this.camera=this.rubber(this.downCamera-e),this.requestDraw()}}onPointerUp(t,e){if(t.pointerId!==this.pointerId)return;this.stage.hasPointerCapture(t.pointerId)&&this.stage.releasePointerCapture(t.pointerId),this.pointerId=null;let i=this.dragging;this.dragging=!1,this.stage.classList.remove("is-dragging");let s=Math.hypot(t.clientX-this.downX,t.clientY-this.downY);if(!e&&!i&&sr.t&&t.timeStamp-o.t<100&&(n=(o.x-r.x)/(o.t-r.t));let d=this.nearestStop(this.camera);if(!e&&Math.abs(n)>Wt)if(n<0){let h=this.stops.findIndex(g=>g.camera>this.camera+1);d=h<0?this.stops.length-1:h}else{let h=0;this.stops.forEach((g,k)=>{g.camera=i.left&&t.clientX<=i.right&&t.clientY>=i.top&&t.clientY<=i.bottom&&(this.pinned=!this.pinned,this.updateCaption())}rubber(t){let e=this.stops[0].camera,i=this.stops[this.stops.length-1].camera;return ti?i+(t-i)*Lt:t}nearestStop(t){let e=0;return this.stops.forEach((i,s)=>{Math.abs(i.camera-t){this.current=e,this.camera=s});else{let n=Math.abs(s-this.camera);n>.5?this.tween={from:this.camera,to:s,start:performance.now(),duration:240+200*Math.min(1,n/this.vw)}:this.camera=s,this.current=e}e!==i?this.activate(i):this.updateCaption(),this.requestDraw()}jump(t){let e=this.current;this.tween=null,this.crossfade(()=>{this.current=t,this.camera=this.stops[t].camera}),this.activate(e),this.requestDraw()}crossfade(t){let e=this.fade;(e.width!==this.canvas.width||e.height!==this.canvas.height)&&(e.width=this.canvas.width,e.height=this.canvas.height);let i=e.getContext("2d");i&&i.drawImage(this.canvas,0,0),e.style.transition="none",e.style.opacity="1",t(),this.render(performance.now()),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transition="",e.style.opacity="0"})})}activate(t){let e=this.stops[this.current],i=t>=0?this.stops[t]:null;if(i&&i.photo>=0&&i.photo!==e.photo&&this.loaders[i.photo]?.stop(),this.loaders.forEach((s,n)=>{s&&n!==e.photo&&n!==e.photo+1&&s.stopPrefetch()}),e.photo<0&&(this.indicator.watch(null),this.progress.watch(null)),e.photo>=0){let s=this.manifest.photos[e.photo];this.caption.set(s,e.photo,this.manifest.photos.length,this.manifest.show_exif),(t>=0||location.hash!=="")&&location.hash!=="#"+(e.photo+1)&&history.replaceState(history.state,"","#"+(e.photo+1)),this.startSession()}this.syncNextStrip(),this.updateCaption()}startSession(){let t=this.stops[this.current];if(t.photo<0)return;let e=this.current,i=this.loader(t.photo);i.start(this.viewAt(t),this.dpr,()=>{this.current===e&&this.prefetchAround(e)}),this.indicator.watch(i),this.progress.watch(i)}prefetchAround(t){let e=this.stops[t],i=this.stops[t+1];if(!(!i||i.photo<0)){if(i.photo===e.photo){let s=this.loader(e.photo);s.prefetchLevel(this.viewAt(i),s.finalLevel);let n=this.stops.find(r=>r.photo===e.photo+1);n&&this.loader(n.photo).prefetchProbe(this.viewAt(n),this.dpr);return}this.loader(i.photo).prefetchProbe(this.viewAt(i),this.dpr)}}viewAt(t){let e=this.layouts[t.photo],i=t.camera-this.vw/2,s=Math.max(i,e.left),n=Math.min(i+this.vw,e.left+e.width),r=Math.max(0,e.top),o=Math.min(this.vh,e.top+e.height);return{displayWidth:e.width,u0:(s-e.left)/e.width,u1:(n-e.left)/e.width,v0:(r-e.top)/e.height,v1:(o-e.top)/e.height}}photoRect(t){let e=this.layouts[t],i=e.left-(this.camera-this.vw/2);return{left:Math.max(0,i),right:Math.min(this.vw,i+e.width),top:Math.max(0,e.top),bottom:Math.min(this.vh,e.top+e.height)}}inCaptionZone(t,e){let i=this.stops[this.current];if(i.photo<0)return!1;let s=this.stage.getBoundingClientRect(),n=t-s.left,r=e-s.top,o=this.layouts[i.photo],d=this.photoRect(i.photo),h=o.top+o.height*(1-Ot);return n>=d.left&&n<=d.right&&r>=h&&r<=d.bottom}updateCaption(){let t=this.stops[this.current],e=t.photo>=0&&!this.dragging&&(this.pinned||this.hover);if(e){let i=this.photoRect(t.photo);this.caption.place(i.left,i.right-i.left,this.vh-i.bottom)}this.caption.show(e),document.body.classList.toggle("has-caption",e)}loadNextAlbum(){this.indexRequested||!this.settings.indexUrl||(this.indexRequested=!0,fetch(this.settings.indexUrl,{credentials:"same-origin"}).then(t=>t.ok?t.json():Promise.reject(new Error("index"))).then(t=>this.showNextAlbum(t)).catch(()=>{this.indexRequested=!1}))}showNextAlbum(t){let e=t.albums;if(e.length===0)return;let i=e.findIndex(o=>o.slug===this.manifest.slug),s=e[(i+1)%e.length];if(!s||s.slug===this.manifest.slug)return;this.nextLink.href="/a/"+encodeURIComponent(s.slug)+"/";let n=this.nextLink.querySelector(".next-eyebrow"),r=this.nextLink.querySelector(".next-title");n&&(n.textContent="Next album"+(s.date?" \xB7 "+s.date:"")),r&&(r.textContent=s.title),s.cover&&(this.nextStrip=new O(this.nextFrame,s.cover,s.collapsed_focus_y??.5,{...this.env,tiles:t.tiles},()=>{}),this.nextLink.classList.add("has-strip"),this.layoutNextStrip(),this.syncNextStrip())}requestDraw(){this.frame===0&&(this.frame=requestAnimationFrame(t=>{this.frame=0,this.render(t)}))}render(t){let e=!1;if(this.tween){let L=Math.min(1,(t-this.tween.start)/this.tween.duration);this.camera=this.tween.from+(this.tween.to-this.tween.from)*Ut(L),L>=1?(this.tween=null,this.updateCaption()):e=!0}let i=this.g,s=this.canvas.width,n=this.canvas.height;i.setTransform(1,0,0,1,0,0),i.globalAlpha=1,i.fillStyle="#111114",i.fillRect(0,0,s,n);let r=this.camera-this.vw/2,o=r+this.vw,d=this.dpr,h=this.stops[this.current].photo,g=Math.max(0,(h<0?this.layouts.length-1:h)-2),k=Math.min(this.layouts.length-1,(h<0?this.layouts.length-1:h)+2);for(let L=g;L<=k;L++){let m=this.layouts[L];m.left+m.widtho||this.loader(L).draw({g:i,originX:(m.left-r)*d,originY:m.top*d,width:m.width*d,height:m.height*d,canvasWidth:s,canvasHeight:n,displayWidth:m.width,dpr:d,now:t})&&(e=!0)}this.endCard.style.transform="translate3d("+Math.round(this.endLeft-r)+"px,0,0)",this.caption.element.classList.contains("is-visible")&&this.tween&&this.updateCaption(),e&&this.requestDraw()}};async function Et(a){let t=await fetch(a,{credentials:"same-origin"});if(!t.ok)throw new Error(a+" "+t.status);return await t.json()}function Tt(a){return{scheduler:new Z(a.concurrency,a.workerUrl),cache:new U(dt())}}async function Vt(a,t){let e=await Et(t.manifestUrl);if(e.photos.length===0)return;let{scheduler:i,cache:s}=Tt(t);document.documentElement.classList.add("has-viewer"),new tt(a,e,t,{scheduler:i,cache:s,settings:t,tiles:e.tiles})}async function Yt(a,t){let e=await Et(t.indexUrl),{scheduler:i,cache:s}=Tt(t);new J(a,e,t,{scheduler:i,cache:s,settings:t,tiles:e.tiles})}function kt(){let a=wt(document.body);if(a.page==="album"){let t=document.getElementById("stage");t&&Vt(t,a).catch(e=>{t.dataset.error=String(e),document.documentElement.classList.remove("has-viewer")})}else if(a.page==="index"){let t=document.getElementById("strips");t&&Yt(t,a).catch(e=>{t.dataset.error=String(e)})}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",kt,{once:!0}):kt();})();