var $e=Object.defineProperty;var _e=(e,n,t)=>n in e?$e(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var N=(e,n,t)=>_e(e,typeof n!="symbol"?n+"":n,t);function L(e,n){if(typeof e=="string")return ke(e);if(typeof e=="number")return Me(e,n);throw new Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(e)}`)}function ke(e){if(typeof e!="string"||e.length===0||e.length>100)throw new Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(e)}`);let n=/^(?-?\d*\.?\d+) *(?milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(e);if(!n?.groups)return NaN;let{value:t,unit:r="ms"}=n.groups,o=parseFloat(t),i=r.toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return o*315576e5;case"months":case"month":case"mo":return o*26298e5;case"weeks":case"week":case"w":return o*6048e5;case"days":case"day":case"d":return o*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return o*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return o*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return o*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:throw new Error(`Unknown unit "${i}" provided to ms.parse(). value=${JSON.stringify(e)}`)}}function Ne(e){let n=Math.abs(e);return n>=315576e5?`${Math.round(e/315576e5)}y`:n>=26298e5?`${Math.round(e/26298e5)}mo`:n>=6048e5?`${Math.round(e/6048e5)}w`:n>=864e5?`${Math.round(e/864e5)}d`:n>=36e5?`${Math.round(e/36e5)}h`:n>=6e4?`${Math.round(e/6e4)}m`:n>=1e3?`${Math.round(e/1e3)}s`:`${e}ms`}function Te(e){let n=Math.abs(e);return n>=315576e5?b(e,n,315576e5,"year"):n>=26298e5?b(e,n,26298e5,"month"):n>=6048e5?b(e,n,6048e5,"week"):n>=864e5?b(e,n,864e5,"day"):n>=36e5?b(e,n,36e5,"hour"):n>=6e4?b(e,n,6e4,"minute"):n>=1e3?b(e,n,1e3,"second"):`${e} ms`}function Me(e,n){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Value provided to ms.format() must be of type number.");return n?.long?Te(e):Ne(e)}function b(e,n,t,r){let o=n>=t*1.5;return`${Math.round(e/t)} ${r}${o?"s":""}`}function T(e){t.debug=t,t.default=t,t.coerce=f,t.disable=i,t.enable=o,t.enabled=s,t.humanize=L,t.destroy=h,Object.keys(e).forEach(a=>{t[a]=e[a]}),t.names=[],t.skips=[],t.formatters={};function n(a){let l=0;for(let d=0;d{if(k==="%%")return"%";v++;let ee=t.formatters[De];if(typeof ee=="function"){let Se=u[v];k=ee.call(m,Se),u.splice(v,1),v--}return k}),t.formatArgs.call(m,u),l?.onLog!=null&&l.onLog(...u),(m.log||t.log).apply(m,u)}return p.namespace=a,p.useColors=t.useColors(),p.color=t.selectColor(a),p.extend=r,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>C!==null?C:(Y!==t.namespaces&&(Y=t.namespaces,q=t.enabled(a)),q),set:u=>{C=u}}),typeof t.init=="function"&&t.init(p),p}function r(a,l){let d=t(this.namespace+(typeof l>"u"?":":l)+a);return d.log=this.log,d}function o(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let l,d=(typeof a=="string"?a:"").split(/[\s,]+/),C=d.length;for(l=0;l"-"+l)].join(",");return t.enable(""),a}function s(a){if(a[a.length-1]==="*")return!0;let l,d;for(l=0,d=t.skips.length;l=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function We(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+L(this.diff),!this.useColors)return;let n="color: "+this.color;e.splice(1,0,n,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(r=t))}),e.splice(r,0,n)}var He=console.debug??console.log??(()=>{});function ze(e){try{e?F?.setItem("debug",e):F?.removeItem("debug")}catch{}}function je(){let e;try{e=F?.getItem("debug")}catch{}return!e&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(e=globalThis.process.env.DEBUG),e}function Ge(){try{return localStorage}catch{}}function Ve(e){e.j=function(n){try{return JSON.stringify(n)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var te=T({formatArgs:We,save:ze,load:je,useColors:Oe,setupFormatters:Ve,colors:Be,storage:F,log:He});var ne=te;var re={gateways:["https://trustless-gateway.link"],routers:["https://delegated-ipfs.dev"],dnsResolvers:{".":"https://delegated-ipfs.dev/dns-query"},fetchTimeout:3e4,serviceWorkerTTL:864e5,debug:globalThis?.location?.hostname?.search(/localhost|inbrowser\.dev|127\.0\.0\.1/)===-1?"":"*,*:trace"};var M={UNREGISTER_SERVICE_WORKER:"ipfs-sw-unregister",URI_ROUTER:"uri"};var P=class{constructor(){N(this,"index",0);N(this,"input","")}new(n){return this.index=0,this.input=n,this}readAtomically(n){let t=this.index,r=n();return r===void 0&&(this.index=t),r}parseWith(n){let t=n();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(n){return this.readAtomically(()=>{let t=this.readChar();if(t===n)return t})}readSeparator(n,t,r){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(n)===void 0))return r()})}readNumber(n,t,r,o){return this.readAtomically(()=>{let i=0,s=0,c=this.peekChar();if(c===void 0)return;let f=c==="0",h=2**(8*o)-1;for(;;){let a=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let d=Number.parseInt(l,n);if(!Number.isNaN(d))return d});if(a===void 0)break;if(i*=n,i+=a,i>h||(s+=1,t!==void 0&&s>t))return}if(s!==0)return!r&&f&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let n=new Uint8Array(4);for(let t=0;tthis.readNumber(10,3,!1,1));if(r===void 0)return;n[t]=r}return n})}readIPv6Addr(){let n=t=>{for(let r=0;rthis.readIPv4Addr());if(s!==void 0)return t[o]=s[0],t[o+1]=s[1],t[o+2]=s[2],t[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",r,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];t[o]=i>>8,t[o+1]=i&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[r,o]=n(t);if(r===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),s=16-(r+2),[c]=n(i.subarray(0,s));return t.set(i.subarray(0,c),16-c),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Je=45;var oe=new P;function ie(e,n=!1){if(e.includes("%")&&(e=e.split("%")[0]),e.length>Je)return;let t=oe.new(e).parseWith(()=>oe.readIPAddr());if(t)return n&&t.length===4?Uint8Array.from([0,0,0,0,0,0,0,0,0,0,255,255,t[0],t[1],t[2],t[3]]):t}function E(e){return!!ie(e)}function R(e,n){let t=0,r=0,o=n;for(;oNumber.MAX_SAFE_INTEGER)throw new Error("varint value is too large to decode safely");if(o++,(i&128)===0)return[t,o-n];if(r+=7,r>49)throw new Error("varint has too many bytes (max is 9)")}throw new Error("varint input ended early (more bytes expected)")}function W(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new Error(`varint value must be a whole number from 0 to ${Number.MAX_SAFE_INTEGER}, got ${e}`);let n=[];for(;e>127;)n.push(e%128|128),e=Math.floor(e/128);return n.push(e&127),new Uint8Array(n)}var B=255;function w(e){let n=new Uint8Array(128).fill(B);for(let t=0;t=0;f--)c+=58*r[f],r[f]=c&255,c>>>=8}let o=0;for(;o=5;)t-=5,n+=O[r>>>t&31];return t>0&&(n+=O[r<<5-t&31]),n}function A(e){e=e.toLowerCase();let n=[],t=0,r=0;for(let o=0;o=8&&(t-=8,n.push(r>>>t&255))}return new Uint8Array(n)}var ce="0123456789abcdefghijklmnopqrstuvwxyz",Qe=w(ce);function le(e){let n=0;for(;n=0;f--)c+=256*r[f],r[f]=c%36,c=c/36|0}let o=0;for(;o=0;f--)c+=36*r[f],r[f]=c&255,c>>>=8}let o=0;for(;o=8&&(t-=8,n.push(r>>>t&255))}return new Uint8Array(n)}var U=e=>e.replace(/[=]+$/,""),fe=e=>A(e.toLowerCase()),de=e=>A(U(e)),ue=e=>A(U(e).toLowerCase()),tt="0123456789abcdefghijklmnopqrstuv",nt=w(tt);function I(e){e=e.toLowerCase();let n=[],t=0,r=0;for(let o=0;o=8&&(t-=8,n.push(r>>>t&255))}return new Uint8Array(n)}var he=e=>I(e.toLowerCase()),pe=e=>I(U(e)),ge=e=>I(U(e).toLowerCase()),me=e=>z(e.toLowerCase()),be=e=>H(e.toLowerCase()),rt="123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ",ot=w(rt);function we(e){let n=0;for(;n=0;f--)c+=58*r[f],r[f]=c&255,c>>>=8}let o=0;for(;oe.replace(/\+/g,"-").replace(/\//g,"_"),j=e=>S(it(e)),Ue=e=>j(U(e)),ye=e=>S(U(e)),st=48,at=49;function Ce(e){let n=[],t=0,r=0;for(let o=0;o=8&&(t-=8,n.push(r>>>t&255))}return new Uint8Array(n)}var ct="\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}",Re=new Map;{let e=0;for(let n of ct)Re.set(n.codePointAt(0),e),e++}var Ae=128640;function Ie(e){let n=[];for(let t of e){let r=Re.get(t.codePointAt(0));if(r===void 0)throw new Error("invalid base256emoji char");n.push(r)}return new Uint8Array(n)}function G(e){if(e.length<2)throw new Error("Could not parse CID: input too short");if(e.includes("."))throw new Error("Could not parse CID: probably a domain name");let n;if(e.length===46&&e.startsWith("Qm"))return n=D(e),{version:0,codec:112,multihash:n,raw:n};let t=e[0],r=e.substring(1),o=0;if(t==="b"?n=A(r):t==="k"?n=H(r):e.codePointAt(0)===Ae?n=Ie(e.slice(2)):t==="0"?n=Ce(r):t==="B"?n=fe(r):t==="c"?n=de(r):t==="C"?n=ue(r):t==="v"?n=I(r):t==="V"?n=he(r):t==="t"?n=pe(r):t==="T"?n=ge(r):t==="K"?n=be(r):t==="z"?n=D(r):t==="Z"?n=we(r):t==="f"?n=z(r):t==="F"?n=me(r):t==="m"?n=j(r):t==="M"?n=Ue(r):t==="u"?n=S(r):t==="U"?n=ye(r):n=D(e),e.startsWith("12D3K"))return{version:0,codec:114,multihash:n,raw:n};let i=R(n,o),s=i[0];if(o+=i[1],s!==1)throw new Error(`Could not parse CID: unsupported version ${s}`);let c=R(n,o),f=c[0];o+=c[1];let h=n.slice(o),a=R(n,o);o+=a[1];let l=R(n,o);o+=l[1];let d=n.slice(o);if(d.byteLength!==l[0])throw new Error(`Could not parse CID: invalid multihash length - expected ${l[0]} got ${d.byteLength}`);return{version:s,codec:f,multihash:h,raw:n}}function V(e,n){let t=W(1),r=W(e),o=new Uint8Array(t.length+r.length+n.length);return o.set(t,0),o.set(r,t.length),o.set(n,t.length+r.length),o}var lt=/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;function ft(e){return lt.test(e)}function xe(e){return ft(e)&&e.includes("-")&&!e.includes(".")}function ve(e){return e.replace(/--/g,"%").replace(/-/g,".").replace(/%/g,"-")}function Le(e){return e.replace(/-/g,"--").replace(/\./g,"-")}var $=".ipfs.",_=".ipns.";function J(e,n,t,r,o,i,s){if(n==null||n==="")return;let c;try{let h=G(n),a=h.version===0?V(h.codec,h.multihash):h.raw;c=`b${ae(a)}`}catch(h){if(t===s.host)throw h;return}return{type:e,protocol:"ipfs",subdomainURL:new URL(`${s.protocol}//${c}.ipfs.${s.host}${r}${o}${i}`),pathURL:new URL(`${s.protocol}//${s.host}/ipfs/${n}${r}${o}${i}`),nativeURL:new URL(`ipfs://${n}${r}${o}${i}`)}}function X(e,n,t,r,o,i){if(n==null||n==="")return;let s=gt(n);return{type:e,protocol:"ipns",subdomainURL:new URL(`${i.protocol}//${s}.ipns.${i.host}${t}${r}${o}`),pathURL:new URL(`${i.protocol}//${i.host}/ipns/${n}${t}${r}${o}`),nativeURL:new URL(`ipns://${n}${t}${r}${o}`)}}function Z(e,n,t,r,o,i){return{type:e,protocol:"dnslink",domain:n,subdomainURL:new URL(`${i.protocol}//${Le(n)}.ipns.${i.host}${t}${r}${o}`),pathURL:new URL(`${i.protocol}//${i.host}/ipns/${n}${t}${r}${o}`),nativeURL:new URL(`ipns://${n}${t}${r}${o}`)}}function dt(e,n){if(e.protocol!=="http:"&&e.protocol!=="https:"||E(e.hostname))return;if(e.host.indexOf($)!==-1){let[o,i]=e.host.split($);return J("subdomain",o,i,e.pathname,e.search,e.hash,n)}if(e.hostname.indexOf(_)!==-1){let[o]=e.host.split(_);try{return X("subdomain",o,e.pathname,e.search,e.hash,n)}catch{if(!xe(o))return;let i=ve(o);return Z("subdomain",i,e.pathname,e.search,e.hash,n)}}}function ut(e,n){if(!(e.protocol!=="http:"&&e.protocol!=="https:")){if(e.pathname.startsWith("/ipfs")){let[,,t,...r]=e.pathname.split("/");return J("path",t,e.host,`/${r.join("/")}`,e.search,e.hash,n)}if(e.pathname.startsWith("/ipns")){let[,,t,...r]=e.pathname.split("/"),o=`/${r.join("/")}`;try{return X("path",t,o,e.search,e.hash,n)}catch{return Z("path",t,o,e.search,e.hash,n)}}}}function ht(e,n){if(e.protocol==="ipfs:")return J("native",e.hostname,"",e.pathname,e.search,e.hash,n);if(e.protocol==="ipns:")try{return X("native",e.hostname,e.pathname,e.search,e.hash,n)}catch{return Z("native",e.hostname,e.pathname,e.search,e.hash,n)}}function pt(e,n){return{url:e,type:e.host===n.host?"internal":"external"}}function gt(e){if(e.includes("."))throw new Error("Probably a domain name?");let n=G(e),t=V(114,n.multihash);return"k"+le(t)}function K(e,n){return(e instanceof String||typeof e=="string")&&(e.startsWith("/ipfs/")?e=new URL(`ipfs://${e.substring(6)}`):e.startsWith("/ipns/")?e=new URL(`ipns://${e.substring(6)}`):e=new URL(e)),n.host.includes($)&&(n=new URL(`${n.protocol}//${n.host.split($).pop()}`)),n.host.includes(_)&&(n=new URL(`${n.protocol}//${n.host.split(_).pop()}`)),dt(e,n)??ut(e,n)??ht(e,n)??pt(e,n)}var Fe=e=>!E(e.hostname);async function Pe(){let e=await navigator.serviceWorker.register(new URL("ipfs-sw-sw.js",import.meta.url),{scope:"/"});return e.active?.state==="activated"?e:new Promise((n,t)=>{e.addEventListener("updatefound",()=>{let r=e.installing;r?.addEventListener("statechange",()=>{r.state==="activated"&&n(e)})})})}ne.enable(re.debug);async function mt(){if(!("serviceWorker"in navigator)){await y();return}let e=new URL(window.location.href);if(e.hostname==="127.0.0.1"){e.hostname="localhost",window.location.href=e.href;return}if(!Fe(e)){globalThis.originIsolationWarning={location:window.location.href},await y();return}if(bt(`ipfs-sw-${window.location.href}-redirects`)){globalThis.serverError={url:window.location.href,title:"310 Too many redirects",description:["The initialization page reloaded itself too many times.","This can mean the service worker failed to install, it was invalid or it cannot run."],error:{name:"TooManyRedirects",message:"The current page redirected too many times"},logs:[]},await y();return}let n;try{n=K(e,new URL(globalThis.location.href))}catch(t){globalThis.serverError={url:document.location.href,title:"Bad request",description:"An error occurred while trying to parse the URL.",error:{name:t.name,message:t.message,stack:t.stack,reason:t.reason,code:t.code,cause:t.cause,errors:t.errors},logs:[]},await y();return}try{if(n.type==="path"||n.type==="native"){window.location.href=n.subdomainURL.href,Q(n);return}if(n.type==="internal"){try{navigator.registerProtocolHandler("ipfs",`${e.protocol}//${e.host}/ipfs/?uri=%s`),navigator.registerProtocolHandler("ipns",`${e.protocol}//${e.host}/ipns/?uri=%s`)}catch(t){console.error("could not register protocol handlers",t)}if((e.pathname.startsWith("/ipfs")||e.pathname.startsWith("/ipns"))&&e.searchParams.has(M.URI_ROUTER))try{let t=new URL(e.searchParams.get(M.URI_ROUTER)??""),r=K(t,new URL(globalThis.location.href));if(r.type==="subdomain"||r.type==="path"||r.type==="native"){window.location.href=r.subdomainURL.href,Q(r);return}return}catch(t){globalThis.serverError={url:document.location.href,title:"Invalid URI",description:"Could not parse a valid URI from the passed argument",error:{name:t.name,message:t.message,stack:t.stack,reason:t.reason,code:t.code,cause:t.cause,errors:t.errors},logs:[]}}}else{(await navigator.serviceWorker.getRegistration())?.active!=null||await Pe(),window.location.hash.startsWith("#/ipfs-sw")&&(e.hash="",window.location.hash=""),e.hash===""?window.location.href=e.toString():window.location.reload(),Q(n);return}}catch(t){globalThis.serverError={url:document.location.href,title:"Installation Error",description:"An error occurred while trying to install the service worker.",error:{name:t.name,message:t.message,stack:t.stack,reason:t.reason,code:t.code,cause:t.cause,errors:t.errors},logs:[]}}await y()}async function y(){try{let e=document.createElement("script");e.type="module",e.src="/ipfs-sw-index-X2QAYUKG.js",document.body.appendChild(e)}catch(e){throw console.error("Failed to load app chunk config:",e),e}}function bt(e,n=5,t=5e3){if(document.referrer!==document.location.href)return!1;let r=localStorage.getItem(e),o=[];if(r!=null)try{let c=JSON.parse(r);Array.isArray(c)&&c.forEach(f=>{isNaN(f)||o.push(f)})}catch{}let i=Date.now()-t,s=o.filter(c=>c>i);return s.push(Date.now()),localStorage.setItem(e,JSON.stringify(s)),s.length>n}function Q(e){setTimeout(()=>{let n;e.type==="native"&&e.protocol==="ipfs"?n=e.nativeURL.hostname:e.type==="path"&&e.protocol==="ipfs"?n=e.pathURL.pathname.split("/")[2]:e.type==="subdomain"&&e.protocol==="ipfs"&&(n=e.subdomainURL.hostname.split(".ipfs.")[0]),globalThis.downloadingPage={request:e,cid:n},y()},500)}mt().catch(e=>{console.error("helia:sw-gateway:index: error rendering ui",e)}); //# sourceMappingURL=ipfs-sw-index-4UE4PO5C.js.map