1function __vite__mapDeps(indexes) { 2 if (!__vite__mapDeps.viteFileDeps) { 3 __vite__mapDeps.viteFileDeps = ["assets/downloadOkayPickCertificate-DNHrUHev.js","assets/HeaderLogoLetters-CMLHzChc.js","assets/HeaderLogoLetters-DngiwBoB.css","assets/projectCredits-5PjutgUg.js","assets/ProfileAvatarTilt-Bo42N5sg.js","assets/stepTilt-Cn-xzgMk.js"] 4 } 5 return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) 6} 7import{aq as t,s as e,ar as i,as as s,H as o,f as r,_ as a}from"./HeaderLogoLetters-CMLHzChc.js";import{p as n,n as l}from"./projectCredits-5PjutgUg.js";import{P as c}from"./ProfileAvatarTilt-Bo42N5sg.js";const d=t=>"function"==typeof Intl.Segmenter?Array.from(new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(t),(t=>t.segment)):Array.from(t);function h(t,e,i){const s=s=>{var o,r,a,n,l,c;const h=[],u=s*(null!=(o=e.leading)?o:1.12);for(const w of t){let t={runs:[],width:0};const o=(o,r)=>{const a=i(o,s*r,e).width,n=t.runs.at(-1);(null==n?void 0:n.scale)===r?n.text+=o:t.runs.push({text:o,scale:r}),t.width+=a},n=()=>{for(;t.runs.length;){const e=t.runs.at(-1);if(e.text=e.text.trimEnd(),e.text)break;t.runs.pop()}t.width=t.runs.reduce(((t,o)=>t+i(o.text,s*o.scale,e).width),0),t.runs.length&&h.push(t),t={runs:[],width:0}};for(const l of w){const c=null!=(r=l.scale)?r:1,h=null!=(a=l.text.replace(/\s+/gu," ").match(/\S+\s*|\s+/gu))?a:[];for(let r of h){t.runs.length||(r=r.trimStart());const a=i(r.trimEnd(),s*c,e).width;if(t.width+a>e.width&&t.runs.length&&(n(),r=r.trimStart()),a<=e.width)o(r,c);else for(const l of d(r))t.width+i(l,s*c,e).width>e.width&&t.runs.length&&n(),o(l,c)}}n()}const f=i("Mg",s,e),g=null!=(n=f.fontBoundingBoxAscent)?n:.8*s,p=(u-g-(null!=(l=f.fontBoundingBoxDescent)?l:.2*s))/2+g;let y=h.length*u,m=0;for(const[t,d]of h.entries()){let o=0;for(const r of d.runs){const a=i(r.text,s*r.scale,e);r.x=o,o+=a.width,y=Math.max(y,t*u+p+(null!=(c=a.actualBoundingBoxDescent)?c:0))}m=Math.max(m,o)}return{...e,size:s,lineHeight:u,baseline:p,lines:h,contentHeight:y,fits:y<=e.height&&m<=e.width}},o=Math.max(0,...t.flatMap((t=>t.flatMap((t=>t.text.split(/\s+/u).map((s=>{var o;return i(s,e.size*(null!=(o=t.scale)?o:1),e).width}))))))),r=!e.wrapWords&&o>e.width?e.size*e.width/o:e.size,a=s(r);if(a.fits)return a;let n=0,l=r;for(let c=0;c<24;c++){const t=(n+l)/2;s(t).fits?n=t:l=t}return s(n)}class u{constructor({maxEntries:t=3,maxBytes:e=1/0,dispose:i=(()=>{})}={}){this.entries=new Map,this.maxEntries=t,this.maxBytes=e,this.dispose=i,this.bytes=0}delete(t){const e=String(t),i=this.entries.get(e);i&&(this.entries.delete(e),this.bytes-=i.bytes,this.dispose(i.value))}get(t,e){const i=String(t),s=this.entries.get(i);return s?s.key!==e?(this.delete(i),null):(this.entries.delete(i),this.entries.set(i,s),s.value):null}take(t,e){const i=this.get(t,e);if(null===i)return null;const s=String(t);return this.bytes-=this.entries.get(s).bytes,this.entries.delete(s),i}set(t,e,i,s=0){if(this.delete(t),s>this.maxBytes)this.dispose(i);else for(this.entries.set(String(t),{key:e,value:i,bytes:s}),this.bytes+=s;this.entries.size>this.maxEntries||this.bytes>this.maxBytes;)this.delete(this.entries.keys().next().value)}}const f=(t,e,i=null)=>JSON.stringify([import.meta.url,t,e,i]),g=new u({dispose:t=>t.destroy()}),p=134217728;function y(t){return new Promise((e=>{let i,s=!1;const o=t=>{null==i||i.close(),s||(s=!0,e(t))};try{const e=indexedDB.open("okay-pick-certificates-v1",1);e.onupgradeneeded=()=>{e.result.createObjectStore("files",{keyPath:"id"}),e.result.createObjectStore("metadata",{keyPath:"id"})},e.onerror=e.onblocked=()=>o(null),e.onsuccess=()=>{if(i=e.result,s)return void i.close();const r=i.transaction(["files","metadata"],"readwrite");let a=null;r.oncomplete=()=>o(a),r.onerror=r.onabort=()=>o(null);try{t(r.objectStore("files"),r.objectStore("metadata"),(t=>{a=t}))}catch{r.abort(),o(null)}}}catch{o(null)}}))}class m{constructor(t){this.type=t,this.memory=new u({maxEntries:2,maxBytes:67108864})}id(t){return`${this.type}:${t}`}async get(t,e){const i=this.memory.get(t,e);if(i)return i;try{const i=this.id(t),s=await y(((t,s,o)=>{const r=s.get(i);r.onsuccess=()=>{const a=r.result;if(!a)return;if(a.key!==e)return t.delete(i),void s.delete(i);s.put({...a,lastUsed:Date.now()});const n=t.get(i);n.onsuccess=()=>o(n.result)}}));if(!s)return null;const o=new Blob([s.data],{type:s.type});return this.memory.set(t,e,o,o.size),o}
7catch{return null}}async set(t,e,i){if(this.memory.set(t,e,i,i.size),!(i.size>p))try{const s=this.id(t),o=await i.arrayBuffer();await y(((t,r)=>{const a=r.getAll();a.onsuccess=()=>{const n=a.result.filter((t=>t.id!==s)).sort(((t,e)=>t.lastUsed-e.lastUsed));let l=n.reduce(((t,e)=>t+e.bytes),i.size);for(;l>p&&n.length;){const e=n.shift();t.delete(e.id),r.delete(e.id),l-=e.bytes}t.put({id:s,data:o,type:i.type}),r.put({id:s,key:e,bytes:i.size,lastUsed:Date.now()})}}))}catch{}}async delete(t){this.memory.delete(t),await y(((e,i)=>{e.delete(this.id(t)),i.delete(this.id(t))}))}}const w=new m("png"),b=new m("zip");function v(t){g.delete(t),w.delete(t),b.delete(t)}const k={grid:[0,0,612,792],badge:[30,30,248,248],signature:[306,552,101.4,23],logo:[54,650,504,94]},x={badge:190,signature:625,logo:750},S=(t,e)=>`${e.weight} ${t}px "${e.family}"`;function A(t){return new Promise(((e,i)=>t.toBlob((t=>t?e(t):i(new Error("The image could not be prepared. Please try again."))),"image/png")))}async function O(t,e,i){if(i){const e=(new DOMParser).parseFromString(t,"image/svg+xml");e.documentElement.setAttribute("width",String(i)),e.documentElement.setAttribute("height",String(i)),t=(new XMLSerializer).serializeToString(e)}const s=URL.createObjectURL(new Blob([t],{type:"image/svg+xml"}));try{const t=new Image;return t.src=s,await t.decode(),null==e||e.throwIfAborted(),t}finally{URL.revokeObjectURL(s)}}class j{constructor(t,e){this.root=t,this.signal=e,this.data=JSON.parse(t.dataset.certificateModel),this.urls=JSON.parse(t.dataset.certificateArtwork),this.images={},this.objectUrls=[],this.measureContext=document.createElement("canvas").getContext("2d"),this.viewport=t.querySelector("[data-certificate-viewport]"),this.reveal=t.querySelector("[data-certificate-reveal]"),this.gloss=t.querySelector("[data-certificate-gloss]"),this.canvas=t.querySelector("[data-certificate-canvas]"),this.observer=new ResizeObserver((()=>this.resize())),this.observer.observe(this.viewport)}
7async init(){const t=this.signal,e=(await Promise.allSettled(Object.keys(k).map((async e=>{const i=await fetch(this.urls[e],{signal:t});if(!i.ok)throw new Error("Certificate artwork could not load. Please try again.");let s=await i.blob();if("badge"===e){const t=(new DOMParser).parseFromString(await s.text(),"image/svg+xml");for(const i of t.querySelectorAll("filter"))if(i.querySelector("feTurbulence")){for(const e of t.querySelectorAll("[filter]"))e.getAttribute("filter")===`url(#${i.id})`&&e.removeAttribute("filter");i.remove()}const e=Math.ceil(2550*k.badge[2]/612);t.documentElement.setAttribute("width",String(e)),t.documentElement.setAttribute("height",String(e)),s=new Blob([(new XMLSerializer).serializeToString(t)],{type:"image/svg+xml"})}null==t||t.throwIfAborted();const o=URL.createObjectURL(s);this.objectUrls.push(o);const r=new Image;r.src=o,await r.decode(),this.images[e]=r})))).find((t=>"rejected"===t.status));if(e)throw e.reason;null==t||t.throwIfAborted();const i=this.root.querySelector(".okay-pick-certificate__artwork");for(const[s,[o,r,a,n]]of Object.entries(k)){const t=this.images[s].cloneNode();t.alt="",t.dataset.certificateArtworkPart=s,"grid"!==s&&t.style.setProperty("--certificate-content-delay",`${x[s]}ms`),Object.assign(t.style,{left:`${o}px`,top:`${r}px`,width:`${a}px`,height:`${n}px`}),i.append(t)}await this.update(this.data),this.ready=!0}async update(t){var e,i,s;const o=this.signal;if(null==o||o.throwIfAborted(),this.blocks&&JSON.stringify(t)===JSON.stringify(this.data))return;if(this.blocks&&t.artworkVersion!==this.data.artworkVersion){this.objectUrls.forEach((t=>URL.revokeObjectURL(t))),this.objectUrls=[],this.images={},this.blocks=null,this.pngBlob=null,this.ready=!1,this.root.classList.remove("is-ready"),this.root.querySelector(".okay-pick-certificate__artwork").replaceChildren();for(const[e,i]of Object.entries(this.urls))this.urls[e]=i.replace(/([?&])v=[^&]*/,`$1v=${encodeURIComponent(t.artworkVersion)}`);return this.data=t,this.root.dataset.certificateArtwork=JSON.stringify(this.urls),void(await this.init())}await Promise.all([document.fonts.load("900 64px Aeonik",`${t.title} ${null!=(e=t.author)?e:""} ${t.collaborators.join(" ")}`),document.fonts.load("400 14px Aeonik",t.credits||"Credits"),document.fonts.load('400 10px "Aeonik Mono"',t.badge.primary)]),await document.fonts.ready,null==o||o.throwIfAborted(),this.pngBlob=null,this.data=t,this.root.dataset.certificateModel=JSON.stringify(t),this.canvas.setAttribute("aria-label",`Okay Pick certificate for ${t.title}`);const r=(t,e,i)=>(this.measureContext.font=S(e,i),this.measureContext.measureText(t));this.blocks=function(t,e){const i=[],s=(t,s,o,r,a,n,l,c={})=>{if(!s||Array.isArray(s)&&!s.length)return;const d={id:t,...h("string"==typeof s?[[{text:s}]]:s,{x:o,y:r,width:a,height:n,size:l,family:"Aeonik",weight:400,color:"#ece5ff",...c},e)};return i.push(d),d},o=(t,e,i,o)=>s(t,e,i,o,239,10,8,{family:"Aeonik Mono"});s("title",t.title.toUpperCase(),306,85,239,150,64,{weight:900,leading:63/64,color:"#fff"}),s("badge-date",t.badge.primary,115,82,86,15,10,{family:"Aeonik Mono",color:"#000",align:"center"});const r=[];t.author&&(o("author-label","By",58,288),r.push(s("author",t.author.toUpperCase(),58,299,216,201,24,{weight:900,color:"#fff",wrapWords:!0}))),o("date-label","Awarded On",306,288),r.push(s("date",t.awardedOn.toUpperCase(),306,299,246,201,24,{weight:900,wrapWords:!0}));const a=Math.min(...r.map((t=>t.size)));for(const n of r){const i="author"===n.id?t.author:t.awardedOn;Object.assign(n,h([[{text:i.toUpperCase()}]],{...n,size:a},e)),n.height=n.contentHeight}const c=Math.max(350,...r.map((t=>t.y+t.height+14))),d=540-c-11;t.collaborators.length&&(o("collaborators-label","Collaborators",58,c),s("collaborators",t.collaborators.map((t=>[{text:t.toUpperCase()}])),58,c+11,216,d,18,{weight:900,leading:21/18,color:"#fff"}));const u=n(t.credits).map((t=>{const e=l(t.suffix);return[{text:t.name},...e?[{text:` â ${e}`,scale:12/14}]:[]]}));return u.length&&(o("credits-label","Additional Credits",306,c),s("credits",u,306,c+11,239,d,14,{leading:16/14})),s("recognition","Awarded an Okay Pick for outstanding creativity, craftsmanship, and execution. This recognition celebrates the projectâs author and all credited contributors.",58,559,200,48,10,{leading:1.1}),s("certification",[[{text:"Certified by Eric Van Holtz, OkayDev Founder"}],[{text:"okaydev.co"}]],306,581,200,28,10,{leading:1.1}),i}(t,r);const a=this.root.querySelector("[data-certificate-text]");a.replaceChildren();for(const n of this.blocks){const t=document.createElement("div");t.dataset.certificateField=n.id;const e="badge-date"===n.id?x.badge:200+Math.round(n.y/792*625);t.style.setProperty("--certificate-content-delay",`${e}ms`),Object.assign(t.style,{left:`${n.x}px`,top:`${n.y}px`,width:`${n.width}px`,height:`${n.height}px`});
7for(const[o,a]of n.lines.entries()){const e="center"===n.align?(n.width-a.width)/2:0,l=document.createElement("span");l.className="okay-pick-certificate__line";for(const t of a.runs){const a=document.createElement("span"),c=n.size*t.scale,d=r("Mg",c,n),h=null!=(i=d.fontBoundingBoxAscent)?i:.8*c,u=null!=(s=d.fontBoundingBoxDescent)?s:.2*c,f=(n.lineHeight-h-u)/2+h;a.textContent=t.text,Object.assign(a.style,{left:`${e+t.x}px`,top:o*n.lineHeight+n.baseline-f+"px",font:S(c,n),lineHeight:`${n.lineHeight}px`,color:n.color}),l.append(a)}l.append(document.createTextNode("\n")),t.append(l)}a.append(t)}this.prepareGloss(),this.root.querySelector("[data-certificate-download]").hidden=!t.canDownload,this.root.querySelector("[data-certificate-download-motion]").hidden=!t.canDownload,this.root.classList.add("is-ready"),this.resize()}prepareGloss(){const t=document.createElement("canvas");t.width=1836,t.height=2376;try{const e=t.getContext("2d");e.scale(3,3);for(const[t,i]of Object.entries(k))"grid"!==t&&e.drawImage(this.images[t],...i);e.fillStyle="#fff",e.fillRect(306,577,200,.25);for(const t of this.blocks)for(const[i,s]of t.lines.entries()){const o="center"===t.align?(t.width-s.width)/2:0;for(const r of s.runs)e.font=S(t.size*r.scale,t),e.fillText(r.text,t.x+o+r.x,t.y+i*t.lineHeight+t.baseline)}this.gloss.style.setProperty("--certificate-gloss-mask",`url("${t.toDataURL("image/png")}")`)}finally{t.width=0,t.height=0}}reflectGloss(t){var e,i;this.gloss.style.opacity=t?Math.min(1,5*t.currentShineOpacity):0,this.gloss.style.setProperty("--gloss-x",50+4*(null!=(e=null==t?void 0:t.currentShineX)?e:0)+"%"),this.gloss.style.setProperty("--gloss-y",50+4*(null!=(i=null==t?void 0:t.currentShineY)?i:0)+"%")}resize(){const t=this.viewport.clientWidth;this.canvas.style.transform=`scale(${t/612})`,this.viewport.style.height=792*t/612+"px"}async png(){const t=this.signal;if(null==t||t.throwIfAborted(),this.pngBlob)return this.pngBlob;const e=f(this.data,this.urls),i=await w.get(this.data.projectId,e);if(null==t||t.throwIfAborted(),i)return this.pngBlob=i,i;const s=document.createElement("canvas");s.width=2550,s.height=3300;try{const i=s.getContext("2d");i.scale(2550/612,3300/792),i.fillStyle="#6d42ed",i.fillRect(0,0,612,792);const o=i.createLinearGradient(0,0,0,792);o.addColorStop(0,"rgba(0,0,0,0)"),o.addColorStop(1,"rgba(0,0,0,0.25)"),i.fillStyle=o,i.fillRect(0,0,612,792);for(const[t,e]of Object.entries(k))i.drawImage(this.images[t],...e);i.fillStyle="#ece5ff",i.fillRect(306,577,200,.25),i.strokeStyle="#000",i.lineWidth=12,i.strokeRect(0,0,612,792);for(const t of this.blocks)for(const[e,s]of t.lines.entries()){const o="center"===t.align?(t.width-s.width)/2:0;for(const r of s.runs)i.font=S(t.size*r.scale,t),i.fillStyle=t.color,i.fillText(r.text,t.x+o+r.x,t.y+e*t.lineHeight+t.baseline)}const r=await A(s);return null==t||t.throwIfAborted(),this.pngBlob=r,await w.set(this.data.projectId,e,r),null==t||t.throwIfAborted(),r}finally{s.width=0,s.height=0}}suspend(){this.stopHover(),this.observer.disconnect(),this.root.remove(),this.root.classList.remove("is-entering","is-revealed");const t=this.root.querySelector("[data-certificate-download-motion]");t.classList.remove("is-visible"),t.inert=!0;const e=this.root.querySelector("[data-certificate-download]");e.disabled=!1,e.removeAttribute("aria-busy"),this.root.querySelector("[data-certificate-status]").textContent=""}resume(t){this.signal=t,this.observer.observe(this.viewport),this.resize()}startHover(){this.stopHover(),this.hover=new c(this.root,{interactionQuery:"(hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference)",measureOnPointerMove:!0,onTilt:t=>this.reflectGloss(t)})}stopHover(){var t;null==(t=this.hover)||t.destroy(),this.hover=null,this.reflectGloss(null)}destroy(){this.stopHover(),this.observer.disconnect(),this.objectUrls.forEach((t=>URL.revokeObjectURL(t))),this.objectUrls=[],this.images={},this.pngBlob=null}}const P=new class{constructor(){var i;this.motion=0,this.host=document.createElement("dialog"),this.host.className="okay-dialog okay-pick-certificate-dialog",this.host.dataset.dialog="okay-pick-certificate",this.host.setAttribute("aria-label","Okay Pick certificate"),this.host.innerHTML=`<div class="okay-pick-certificate-dialog__backdrop" aria-hidden="true"></div>\n <div class="okay-pick-certificate-dialog__surface">\n <header>${t("Close certificate","data-certificate-close autofocus")}</header>\n <div data-certificate-body></div>\n </div>`,document.body.append(this.host),this.body=this.host.querySelector("[data-certificate-body]"),this.surface=this.host.querySelector(".okay-pick-certificate-dialog__surface"),this.host.addEventListener("click",(t=>{this.closing||(t.target===this.host||t.target.closest("[data-certificate-close]")?this.close():t.target.closest("[data-certificate-download]")?this.download():t.target.closest("[data-certificate-refresh]")?window.location.reload():t.target.closest("[data-certificate-retry]")&&this.load())})),this.host.addEventListener("keydown",(t=>{if("Escape"===t.key&&t.stopPropagation(),"Tab"===t.key){const e=[...this.host.querySelectorAll("button:not([disabled]), a[href]")].filter((t=>!t.closest("[inert]")&&t.getClientRects().length>
70&&"hidden"!==getComputedStyle(t).visibility));if(!e.length)return;t.preventDefault(),t.stopPropagation();const i=e.indexOf(document.activeElement);e[(i+(t.shiftKey?-1:1)+e.length)%e.length].focus()}})),this.host.addEventListener("cancel",(t=>{t.preventDefault(),t.stopPropagation(),this.close()})),this.host.addEventListener("close",(()=>this.cleanup())),null==(i=e.pjax)||i.addEventListener("NAVIGATE_OUT",(()=>{this.close({immediate:!0})})),window.addEventListener("popstate",(()=>{this.close({immediate:!0})}))}open(t){if(this.motion++,this.closing=!1,this.host.classList.remove("is-closing"),this.trigger=t,this.projectId=t.dataset.okayPickProject,!this.host.open){const t=document.documentElement;t.dataset.dialogScrollLockOwner||(this.scroll={x:window.scrollX,y:window.scrollY,overflow:t.style.overflow,position:document.body.style.position,top:document.body.style.top,width:document.body.style.width},t.dataset.dialogScrollLockOwner="okay-pick-certificate",t.style.overflow="hidden",Object.assign(document.body.style,{position:"fixed",top:`-${this.scroll.y}px`,width:"100%"})),window.dispatchEvent(new CustomEvent("okaydev:dialog-opened",{detail:{dialog:this.host,dialogType:"okay-pick-certificate"}})),this.host.showModal()}this.load()}async close({immediate:t=!1}={}){var e,i,s,o;if(!this.host.open||this.closing&&!t)return;const r=++this.motion;this.closing=!0,null==(e=this.controller)||e.abort(),null==(s=null==(i=this.certificate)?void 0:i.hover)||s.onPointerLeave();const a=null==(o=this.certificate)?void 0:o.root.querySelector("[data-certificate-download-motion]");(null==a?void 0:a.contains(document.activeElement))&&this.host.querySelector("[data-certificate-close]").focus({preventScroll:!0}),a&&(a.inert=!0),this.host.classList.add("is-closing"),t||window.matchMedia("(prefers-reduced-motion: reduce)").matches||await function(t,{subtree:e=!1,timeoutMs:i=800}={}){const s=t&&"function"==typeof t.getAnimations?t.getAnimations({subtree:e}):[];if(!s.length)return Promise.resolve();let o=0;return Promise.race([Promise.allSettled(s.map((t=>t.finished))),new Promise((t=>{o=globalThis.setTimeout(t,i)}))]).finally((()=>{o&&globalThis.clearTimeout(o)}))}(this.surface,{timeoutMs:800}),r===this.motion&&this.host.open&&this.host.close()}async load(){var t,e;null==(t=this.controller)||t.abort(),this.releaseCertificate(),i([this.body]),this.downloading=!1;const r=new AbortController;this.controller=r,this.body.classList.add("is-loading"),this.body.innerHTML=s("Loading certificateâ¦"),this.body.querySelector("[data-bento-overlay-loading]").setAttribute("role","status");let a=!1;try{const t=await fetch(`/api/okay-pick-certificate?projectId=${encodeURIComponent(this.projectId)}`,{credentials:"same-origin",cache:"no-store",signal:r.signal});if(!t.ok)throw a=404===t.status,a&&v(this.projectId),new Error(404===t.status?"This Okay Pick certificate is no longer available.":"The certificate could not load. Please try again.");const e=await t.text();r.signal.throwIfAborted();const i=document.createElement("template");i.innerHTML=e;const s=i.content.querySelector("[data-certificate-model]");if(!s)throw new Error("The certificate could not load. Please try again.");const o=f(JSON.parse(s.dataset.certificateModel),JSON.parse(s.dataset.certificateArtwork)),n=g.take(this.projectId,o),l=null!=n?n:new j(s,r.signal);this.certificate=l,this.body.append(l.root),n?l.resume(r.signal):await l.init(),r.signal.throwIfAborted(),this.revealCertificate(l,r.signal)}catch(n){if(r.signal.aborted)return;null==(e=this.certificate)||e.destroy(),this.certificate=null,console.error("Certificate preview failed:",n);const t=n instanceof TypeError&&/null|undefined/.test(n.message),i=a?"close":t?"refresh":"retry",s=a?"Close":t?"Refresh page":"Try again";this.body.innerHTML=`<div class="okay-pick-certificate-message">\n <p role="status"></p>\n <button class="okay-pick-certificate-message__button" type="button" data-certificate-${i}>${s}</button>\n <p class="okay-pick-certificate-message__help">If the problem persists, <a href="/contact">contact us</a> and describe what went wrong.</p>\n </div>`,this.body.querySelector('[role="status"]').textContent=a?"This certificate is no longer available.":t?"We couldnât display this certificate. Please refresh the page and try again.":"We couldnât load this certificate. Please try again in a moment.",o(this.body,{local:!0})}finally{this.controller!==r||r.signal.aborted||this.body.classList.remove("is-loading")}}async revealCertificate(t,e){var i;const s=t.root,o=s.querySelector("[data-certificate-download-motion]");await Promise.allSettled(this.surface.getAnimations().map((t=>t.finished))),e.aborted||(null==(i=this.body.querySelector("[data-bento-overlay-loading]"))||i.remove(),s.classList.add("is-entering"),await Promise.allSettled(t.reveal.getAnimations({subtree:!0}).map((t=>t.finished))),e.aborted||(s.classList.add("is-revealed"),s.classList.remove("is-entering"),t.startHover(),o.classList.add("is-visible"),await Promise.allSettled(o.getAnimations().map((t=>t.finished))),e.aborted||(o.inert=!1)))}async download(){if(!this.certificate||this.downloading||this.closing||this.certificate.root.querySelector("[data-certificate-download-motion]").inert)return;this.downloading=!0;const t=this.certificate,e=this.controller.signal,i=t.root.querySelector("[data-certificate-download]"),s=t.root.querySelector("[data-certificate-status]"),o=t=>{s.textContent=t};i.disabled=!0,i.setAttribute("aria-busy","true"),o("Preparing certificateâ¦");try{const s=await r();if(e.throwIfAborted(),!s)throw new Error("Your session could not be verified. Please try again.");const n=await fetch("/api/okay-pick-certificate/export",{method:"POST",credentials:"same-origin",cache:"no-store",signal:e,headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":s},body:JSON.stringify({projectId:t.data.projectId})});if(!n.ok)throw 403!==n.status&&404!==n.status||(v(t.data.projectId),t.cacheable=!1),403===n.status&&(t.data.canDownload=!1,i.hidden=!0,t.root.querySelector("[data-certificate-download-motion]").hidden=!0),new Error(404===n.status?"This Okay Pick certificate is no longer available.":403===n.status?"This download is no longer available.":"The download could not be prepared. Please try again.");const l=await n.json();e.throwIfAborted(),await t.update(l.certificate);const{default:c}=await a((()=>import("./downloadOkayPickCertificate-DNHrUHev.js")),__vite__mapDeps([0,1,2,3,4,5]));await c(t,l.assets,e,o),o("")}catch(n){e.aborted||o(n.message)}finally{e.aborted||(i.disabled=!1,i.removeAttribute("aria-busy"),this.downloading=!1)}}releaseCertificate(){const t=this.certificate;this.certificate=null,t&&(t.ready&&!1!==t.cacheable?(t.suspend(),g.set(t.data.projectId,f(t.data,t.urls),t)):t.destroy())}cleanup(){var t;
7if(this.host.open)return;this.motion++,this.closing=!1,this.host.classList.remove("is-closing"),null==(t=this.controller)||t.abort(),this.releaseCertificate(),i([this.body]),this.body.replaceChildren(),this.body.classList.remove("is-loading");const e=document.documentElement;this.scroll&&"okay-pick-certificate"===e.dataset.dialogScrollLockOwner&&(e.style.overflow=this.scroll.overflow,Object.assign(document.body.style,{position:this.scroll.position,top:this.scroll.top,width:this.scroll.width}),delete e.dataset.dialogScrollLockOwner,window.scrollTo({left:this.scroll.x,top:this.scroll.y,behavior:"auto"})),this.scroll=null,window.dispatchEvent(new CustomEvent("okaydev:dialog-closed",{detail:{dialog:this.host,dialogType:"okay-pick-certificate"}}));const s=this.trigger;window.setTimeout((()=>{!this.host.open&&this.trigger===s&&(null==s?void 0:s.isConnected)&&s.focus({preventScroll:!0})}),0)}},L=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"}));export{L as O,b as a,A as b,f as c,O as l};
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.