importmap-rails 1.0.3 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
- (function(){const noop=()=>{};const e=document.querySelector("script[type=esms-options]");const r=e?JSON.parse(e.innerHTML):self.esmsInitOptions?self.esmsInitOptions:{};let t=!!r.shimMode;const s=globalHook(t&&r.resolve);const a=r.skip?new RegExp(r.skip):null;let i=r.nonce;const c=r.mapOverrides;if(!i){const e=document.querySelector("script[nonce]");e&&(i=e.nonce||e.getAttribute("nonce"))}const f=globalHook(r.onerror||noop);const oe=r.onpolyfill?globalHook(r.onpolyfill):()=>console.info("OK: ^ TypeError module failure has been polyfilled");const{revokeBlobURLs:le,noLoadEventRetriggers:de,enforceIntegrity:pe}=r;const he=r.fetch?globalHook(r.fetch):fetch;function globalHook(e){return"string"===typeof e?self[e]:e}const ke=Array.isArray(r.polyfillEnable)?r.polyfillEnable:[];const me=ke.includes("css-modules");const we=ke.includes("json-modules");function setShimMode(){t=true}const ve=!!navigator.userAgent.match(/Edge\/\d+\.\d+/);const ye=document.baseURI;function createBlob(e,r="text/javascript"){return URL.createObjectURL(new Blob([e],{type:r}))}const eoop=e=>setTimeout((()=>{throw e}));const throwError=e=>{(window.reportError||window.safari&&console.error||eoop)(e),void f(e)};function isURL(e){try{new URL(e);return true}catch(e){return false}}const ge=/\\/g;function resolveUrl(e,r){return resolveIfNotPlainOrUrl(e,r)||(-1!==e.indexOf(":")?e:resolveIfNotPlainOrUrl("./"+e,r))}function resolveIfNotPlainOrUrl(e,r){r=r&&r.split("#")[0].split("?")[0];-1!==e.indexOf("\\")&&(e=e.replace(ge,"/"));if("/"===e[0]&&"/"===e[1])return r.slice(0,r.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const t=r.slice(0,r.indexOf(":")+1);let s;if("/"===r[t.length+1])if("file:"!==t){s=r.slice(t.length+2);s=s.slice(s.indexOf("/")+1)}else s=r.slice(8);else s=r.slice(t.length+("/"===r[t.length]));if("/"===e[0])return r.slice(0,r.length-s.length-1)+e;const a=s.slice(0,s.lastIndexOf("/")+1)+e;const i=[];let c=-1;for(let e=0;e<a.length;e++)if(-1===c){if("."===a[e]){if("."===a[e+1]&&("/"===a[e+2]||e+2===a.length)){i.pop();e+=2;continue}if("/"===a[e+1]||e+1===a.length){e+=1;continue}}while("/"===a[e])e++;c=e}else if("/"===a[e]){i.push(a.slice(c,e+1));c=-1}-1!==c&&i.push(a.slice(c));return r.slice(0,r.length-s.length)+i.join("")}}function resolveAndComposeImportMap(e,r,t){const s={imports:Object.assign({},t.imports),scopes:Object.assign({},t.scopes)};e.imports&&resolveAndComposePackages(e.imports,s.imports,r,t);if(e.scopes)for(let a in e.scopes){const i=resolveUrl(a,r);resolveAndComposePackages(e.scopes[a],s.scopes[i]||(s.scopes[i]={}),r,t)}return s}function getMatch(e,r){if(r[e])return e;let t=e.length;do{const s=e.slice(0,t+1);if(s in r)return s}while(-1!==(t=e.lastIndexOf("/",t-1)))}function applyPackages(e,r){const t=getMatch(e,r);if(t){const s=r[t];if(null===s)return;return s+e.slice(t.length)}}function resolveImportMap(e,r,t){let s=t&&getMatch(t,e.scopes);while(s){const t=applyPackages(r,e.scopes[s]);if(t)return t;s=getMatch(s.slice(0,s.lastIndexOf("/")),e.scopes)}return applyPackages(r,e.imports)||-1!==r.indexOf(":")&&r}function resolveAndComposePackages(e,r,s,a){for(let i in e){const f=resolveIfNotPlainOrUrl(i,s)||i;if((!t||!c)&&r[f]&&r[f]!==e[f])throw Error(`Rejected map override "${f}" from ${r[f]} to ${e[f]}.`);let oe=e[i];if("string"!==typeof oe)continue;const le=resolveImportMap(a,resolveIfNotPlainOrUrl(oe,s)||oe,s);le?r[f]=le:console.warn(`Mapping "${i}" -> "${e[i]}" does not resolve`)}}let $e;window.addEventListener("error",(e=>$e=e));function dynamicImportScript(e,{errUrl:r=e}={}){$e=void 0;const t=createBlob(`import*as m from'${e}';self._esmsi=m`);const s=Object.assign(document.createElement("script"),{type:"module",src:t});s.setAttribute("nonce",i);s.setAttribute("noshim","");const a=new Promise(((e,a)=>{s.addEventListener("error",cb);s.addEventListener("load",cb);function cb(i){document.head.removeChild(s);if(self._esmsi){e(self._esmsi,ye);self._esmsi=void 0}else{a(!(i instanceof Event)&&i||$e&&$e.error||new Error(`Error loading or executing the graph of ${r} (check the console for ${t}).`));$e=void 0}}}));document.head.appendChild(s);return a}let Se=dynamicImportScript;const Ae=dynamicImportScript(createBlob("export default u=>import(u)")).then((e=>{e&&(Se=e.default);return!!e}),noop);let Ce=false;let Oe=false;let Ie=false;let Le=false;let Ue=false;const Pe=Promise.resolve(Ae).then((e=>{if(e){Ue=true;return Promise.all([Se(createBlob("import.meta")).then((()=>Ie=true),noop),me&&Se(createBlob('import"data:text/css,{}"assert{type:"css"}')).then((()=>Oe=true),noop),we&&Se(createBlob('import"data:text/json,{}"assert{type:"json"}')).then((()=>Ce=true),noop),new Promise((e=>{self._$s=t=>{document.head.removeChild(r);t&&(Le=true);delete self._$s;e()};const r=document.createElement("iframe");r.style.display="none";document.head.appendChild(r);r.src=createBlob(`<script type=importmap nonce="${i}">{"imports":{"x":"data:text/javascript,"}}<\/script><script nonce="${i}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<\/script>`,"text/html")}))])}}));let Me,xe,Ee,je=4194304;const Re=1===new Uint8Array(new Uint16Array([1]).buffer)[0];let _e,Fe,Be;function parse(e,r="@"){if(_e=e,Fe=r,_e.length>je||!Me){for(;_e.length>je;)je*=2;xe=new ArrayBuffer(4*je),Me=function(e,r,t){"use asm";var s=new e.Int8Array(t),a=new e.Int16Array(t),i=new e.Int32Array(t),c=new e.Uint8Array(t),f=new e.Uint16Array(t),oe=816;function b(e){e=e|0;var r=0,t=0,c=0,le=0,de=0;de=oe;oe=oe+14336|0;le=de;s[589]=1;a[291]=0;a[292]=0;a[293]=-1;i[15]=i[2];s[590]=0;i[14]=0;s[588]=0;i[16]=de+10240;i[17]=de+2048;s[591]=0;e=(i[3]|0)+-2|0;i[18]=e;r=e+(i[12]<<1)|0;i[19]=r;e:while(1){t=e+2|0;i[18]=t;if(e>>>0>=r>>>0){c=18;break}r:do{switch(a[t>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if((((a[292]|0)==0?R(t)|0:0)?B(e+4|0,120,112,111,114,116)|0:0)?(u(),(s[589]|0)==0):0){c=9;break e}else c=17;break}case 105:{if(R(t)|0?B(e+4|0,109,112,111,114,116)|0:0){k();c=17}else c=17;break}case 59:{c=17;break}case 47:switch(a[e+4>>1]|0){case 47:{G();break r}case 42:{p(1);break r}default:{c=16;break e}}default:{c=16;break e}}}while(0);if((c|0)==17){c=0;i[15]=i[18]}e=i[18]|0;r=i[19]|0}if((c|0)==9){e=i[18]|0;i[15]=e;c=19}else if((c|0)==16){s[589]=0;i[18]=e;c=19}else if((c|0)==18)if(!(s[588]|0)){e=t;c=19}else e=0;do{if((c|0)==19){e:while(1){r=e+2|0;i[18]=r;t=r;if(e>>>0>=(i[19]|0)>>>0){c=75;break}r:do{switch(a[r>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if(((a[292]|0)==0?R(r)|0:0)?B(e+4|0,120,112,111,114,116)|0:0){u();c=74}else c=74;break}case 105:{if(R(r)|0?B(e+4|0,109,112,111,114,116)|0:0){k();c=74}else c=74;break}case 99:{if((R(r)|0?z(e+4|0,108,97,115,115)|0:0)?Z(a[e+12>>1]|0)|0:0){s[591]=1;c=74}else c=74;break}case 40:{r=i[15]|0;t=i[17]|0;c=a[292]|0;a[292]=c+1<<16>>16;i[t+((c&65535)<<2)>>2]=r;c=74;break}case 41:{e=a[292]|0;if(!(e<<16>>16)){c=36;break e}c=e+-1<<16>>16;a[292]=c;e=i[11]|0;if((e|0)!=0?(i[e+20>>2]|0)==(i[(i[17]|0)+((c&65535)<<2)>>2]|0):0){r=e+4|0;if(!(i[r>>2]|0))i[r>>2]=t;i[e+12>>2]=t;i[11]=0;c=74}else c=74;break}case 123:{c=i[15]|0;t=i[8]|0;e=c;do{if((a[c>>1]|0)==41&(t|0)!=0?(i[t+4>>2]|0)==(c|0):0){r=i[9]|0;i[8]=r;if(!r){i[4]=0;break}else{i[r+28>>2]=0;break}}}while(0);r=a[292]|0;c=r&65535;s[le+c>>0]=s[591]|0;s[591]=0;t=i[17]|0;a[292]=r+1<<16>>16;i[t+(c<<2)>>2]=e;c=74;break}case 125:{e=a[292]|0;if(!(e<<16>>16)){c=49;break e}t=e+-1<<16>>16;a[292]=t;r=a[293]|0;if(e<<16>>16!=r<<16>>16)if(r<<16>>16!=-1&(t&65535)<(r&65535)){c=53;break e}else{c=74;break r}else{t=i[16]|0;c=(a[291]|0)+-1<<16>>16;a[291]=c;a[293]=a[t+((c&65535)<<1)>>1]|0;h();c=74;break r}}case 39:{d(39);c=74;break}case 34:{d(34);c=74;break}case 47:switch(a[e+4>>1]|0){case 47:{G();break r}case 42:{p(1);break r}default:{r=i[15]|0;t=a[r>>1]|0;t:do{if(!(x(t)|0)){switch(t<<16>>16){case 41:if(L(i[(i[17]|0)+(f[292]<<2)>>2]|0)|0){c=71;break t}else{c=68;break t}case 125:break;default:{c=68;break t}}e=f[292]|0;if(!(y(i[(i[17]|0)+(e<<2)>>2]|0)|0)?(s[le+e>>0]|0)==0:0)c=68;else c=71}else switch(t<<16>>16){case 46:if(((a[r+-2>>1]|0)+-48&65535)<10){c=68;break t}else{c=71;break t}case 43:if((a[r+-2>>1]|0)==43){c=68;break t}else{c=71;break t}case 45:if((a[r+-2>>1]|0)==45){c=68;break t}else{c=71;break t}default:{c=71;break t}}}while(0);t:do{if((c|0)==68){c=0;if(!(o(r)|0)){switch(t<<16>>16){case 0:{c=71;break t}case 47:break;default:{e=1;break t}}if(!(s[590]|0))e=1;else c=71}else c=71}}while(0);if((c|0)==71){I();e=0}s[590]=e;c=74;break r}}case 96:{h();c=74;break}default:c=74}}while(0);if((c|0)==74){c=0;i[15]=i[18]}e=i[18]|0}if((c|0)==36){Y();e=0;break}else if((c|0)==49){Y();e=0;break}else if((c|0)==53){Y();e=0;break}else if((c|0)==75){e=(a[293]|0)==-1&(a[292]|0)==0&(s[588]|0)==0;break}}}while(0);oe=de;return e|0}function u(){var e=0,r=0,t=0,c=0,f=0,oe=0;f=i[18]|0;oe=f+12|0;i[18]=oe;r=w(1)|0;e=i[18]|0;if(!((e|0)==(oe|0)?!(S(r)|0):0))c=3;e:do{if((c|0)==3){r:do{switch(r<<16>>16){case 100:{J(e,e+14|0);break e}case 97:{i[18]=e+10;w(1)|0;e=i[18]|0;c=6;break}case 102:{c=6;break}case 99:{if(z(e+2|0,108,97,115,115)|0?(t=e+10|0,F(a[t>>1]|0)|0):0){i[18]=t;f=w(1)|0;oe=i[18]|0;H(f)|0;J(oe,i[18]|0);i[18]=(i[18]|0)+-2;break e}e=e+4|0;i[18]=e;c=13;break}case 108:case 118:{c=13;break}case 123:{i[18]=e+2;e=w(1)|0;t=i[18]|0;while(1){if(_(e)|0){d(e);e=(i[18]|0)+2|0;i[18]=e}else{H(e)|0;e=i[18]|0}w(1)|0;e=g(t,e)|0;if(e<<16>>16==44){i[18]=(i[18]|0)+2;e=w(1)|0}r=t;t=i[18]|0;if(e<<16>>16==125){c=32;break}if((t|0)==(r|0)){c=29;break}if(t>>>0>(i[19]|0)>>>0){c=31;break}}if((c|0)==29){Y();break e}else if((c|0)==31){Y();break e}else if((c|0)==32){i[18]=t+2;c=34;break r}break}case 42:{i[18]=e+2;w(1)|0;c=i[18]|0;g(c,c)|0;c=34;break}default:{}}}while(0);if((c|0)==6){i[18]=e+16;e=w(1)|0;if(e<<16>>16==42){i[18]=(i[18]|0)+2;e=w(1)|0}oe=i[18]|0;H(e)|0;J(oe,i[18]|0);i[18]=(i[18]|0)+-2;break}else if((c|0)==13){e=e+4|0;i[18]=e;s[589]=0;r:while(1){i[18]=e+2;oe=w(1)|0;e=i[18]|0;switch((H(oe)|0)<<16>>16){case 91:case 123:{c=15;break r}default:{}}r=i[18]|0;if((r|0)==(e|0))break e;J(e,r);switch((w(1)|0)<<16>>16){case 61:{c=19;break r}case 44:break;default:{c=20;break r}}e=i[18]|0}if((c|0)==15){i[18]=(i[18]|0)+-2;break}else if((c|0)==19){i[18]=(i[18]|0)+-2;break}else if((c|0)==20){i[18]=(i[18]|0)+-2;break}}else if((c|0)==34)r=w(1)|0;e=i[18]|0;if(r<<16>>16==102?K(e+2|0,114,111,109)|0:0){i[18]=e+8;l(f,w(1)|0);break}i[18]=e+-2}}while(0);return}function k(){var e=0,r=0,t=0,c=0,f=0;f=i[18]|0;r=f+12|0;i[18]=r;e:do{switch((w(1)|0)<<16>>16){case 40:{r=i[17]|0;t=a[292]|0;a[292]=t+1<<16>>16;i[r+((t&65535)<<2)>>2]=f;if((a[i[15]>>1]|0)!=46){v(f,(i[18]|0)+2|0,0,f);i[11]=i[8];i[18]=(i[18]|0)+2;switch((w(1)|0)<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{i[18]=(i[18]|0)+-2;break e}}i[18]=(i[18]|0)+2;switch((w(1)|0)<<16>>16){case 44:{f=i[18]|0;i[(i[8]|0)+4>>2]=f;i[18]=f+2;w(1)|0;f=i[18]|0;t=i[8]|0;i[t+16>>2]=f;s[t+24>>0]=1;i[18]=f+-2;break e}case 41:{a[292]=(a[292]|0)+-1<<16>>16;t=i[18]|0;f=i[8]|0;i[f+4>>2]=t;i[f+12>>2]=t;s[f+24>>0]=1;break e}default:{i[18]=(i[18]|0)+-2;break e}}}break}case 46:{i[18]=(i[18]|0)+2;if(((w(1)|0)<<16>>16==109?(e=i[18]|0,K(e+2|0,101,116,97)|0):0)?(a[i[15]>>1]|0)!=46:0)v(f,f,e+8|0,2);break}case 42:case 39:case 34:{c=16;break}case 123:{e=i[18]|0;if(a[292]|0){i[18]=e+-2;break e}while(1){if(e>>>0>=(i[19]|0)>>>0)break;e=w(1)|0;if(!(_(e)|0)){if(e<<16>>16==125){c=31;break}}else d(e);e=(i[18]|0)+2|0;i[18]=e}if((c|0)==31)i[18]=(i[18]|0)+2;w(1)|0;e=i[18]|0;if(!(z(e,102,114,111,109)|0)){Y();break e}i[18]=e+8;e=w(1)|0;if(_(e)|0){l(f,e);break e}else{Y();break e}}default:if((i[18]|0)!=(r|0))c=16}}while(0);do{if((c|0)==16){if(a[292]|0){i[18]=(i[18]|0)+-2;break}e=i[19]|0;r=i[18]|0;while(1){if(r>>>0>=e>>>0){c=23;break}t=a[r>>1]|0;if(_(t)|0){c=21;break}c=r+2|0;i[18]=c;r=c}if((c|0)==21){l(f,t);break}else if((c|0)==23){Y();break}}}while(0);return}function l(e,r){e=e|0;r=r|0;var t=0,s=0;t=(i[18]|0)+2|0;switch(r<<16>>16){case 39:{d(39);s=5;break}case 34:{d(34);s=5;break}default:Y()}do{if((s|0)==5){v(e,t,i[18]|0,1);i[18]=(i[18]|0)+2;s=(w(0)|0)<<16>>16==97;r=i[18]|0;if(s?B(r+2|0,115,115,101,114,116)|0:0){i[18]=r+12;if((w(1)|0)<<16>>16!=123){i[18]=r;break}e=i[18]|0;t=e;e:while(1){i[18]=t+2;t=w(1)|0;switch(t<<16>>16){case 39:{d(39);i[18]=(i[18]|0)+2;t=w(1)|0;break}case 34:{d(34);i[18]=(i[18]|0)+2;t=w(1)|0;break}default:t=H(t)|0}if(t<<16>>16!=58){s=16;break}i[18]=(i[18]|0)+2;switch((w(1)|0)<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{s=20;break e}}i[18]=(i[18]|0)+2;switch((w(1)|0)<<16>>16){case 125:{s=25;break e}case 44:break;default:{s=24;break e}}i[18]=(i[18]|0)+2;if((w(1)|0)<<16>>16==125){s=25;break}t=i[18]|0}if((s|0)==16){i[18]=r;break}else if((s|0)==20){i[18]=r;break}else if((s|0)==24){i[18]=r;break}else if((s|0)==25){s=i[8]|0;i[s+16>>2]=e;i[s+12>>2]=(i[18]|0)+2;break}}i[18]=r+-2}}while(0);return}function o(e){e=e|0;e:do{switch(a[e>>1]|0){case 100:switch(a[e+-2>>1]|0){case 105:{e=q(e+-4|0,118,111)|0;break e}case 108:{e=P(e+-4|0,121,105,101)|0;break e}default:{e=0;break e}}case 101:{switch(a[e+-2>>1]|0){case 115:break;case 116:{e=E(e+-4|0,100,101,108,101)|0;break e}default:{e=0;break e}}switch(a[e+-4>>1]|0){case 108:{e=D(e+-6|0,101)|0;break e}case 97:{e=D(e+-6|0,99)|0;break e}default:{e=0;break e}}}case 102:{if((a[e+-2>>1]|0)==111?(a[e+-4>>1]|0)==101:0)switch(a[e+-6>>1]|0){case 99:{e=O(e+-8|0,105,110,115,116,97,110)|0;break e}case 112:{e=q(e+-8|0,116,121)|0;break e}default:{e=0;break e}}else e=0;break}case 110:{e=e+-2|0;if(D(e,105)|0)e=1;else e=$(e,114,101,116,117,114)|0;break}case 111:{e=D(e+-2|0,100)|0;break}case 114:{e=m(e+-2|0,100,101,98,117,103,103,101)|0;break}case 116:{e=E(e+-2|0,97,119,97,105)|0;break}case 119:switch(a[e+-2>>1]|0){case 101:{e=D(e+-4|0,110)|0;break e}case 111:{e=P(e+-4|0,116,104,114)|0;break e}default:{e=0;break e}}default:e=0}}while(0);return e|0}function h(){var e=0,r=0,t=0;r=i[19]|0;t=i[18]|0;e:while(1){e=t+2|0;if(t>>>0>=r>>>0){r=8;break}switch(a[e>>1]|0){case 96:{r=9;break e}case 36:{if((a[t+4>>1]|0)==123){r=6;break e}break}case 92:{e=t+4|0;break}default:{}}t=e}if((r|0)==6){i[18]=t+4;e=a[293]|0;r=i[16]|0;t=a[291]|0;a[291]=t+1<<16>>16;a[r+((t&65535)<<1)>>1]=e;t=(a[292]|0)+1<<16>>16;a[292]=t;a[293]=t}else if((r|0)==8){i[18]=e;Y()}else if((r|0)==9)i[18]=e;return}function w(e){e=e|0;var r=0,t=0,s=0;t=i[18]|0;e:do{r=a[t>>1]|0;r:do{if(r<<16>>16!=47)if(e)if(Z(r)|0)break;else break e;else if(Q(r)|0)break;else break e;else switch(a[t+2>>1]|0){case 47:{G();break r}case 42:{p(e);break r}default:{r=47;break e}}}while(0);s=i[18]|0;t=s+2|0;i[18]=t}while(s>>>0<(i[19]|0)>>>0);return r|0}function d(e){e=e|0;var r=0,t=0,s=0,c=0;c=i[19]|0;r=i[18]|0;while(1){s=r+2|0;if(r>>>0>=c>>>0){r=9;break}t=a[s>>1]|0;if(t<<16>>16==e<<16>>16){r=10;break}if(t<<16>>16==92){t=r+4|0;if((a[t>>1]|0)==13){r=r+6|0;r=(a[r>>1]|0)==10?r:t}else r=t}else if(ae(t)|0){r=9;break}else r=s}if((r|0)==9){i[18]=s;Y()}else if((r|0)==10)i[18]=s;return}function v(e,r,t,a){e=e|0;r=r|0;t=t|0;a=a|0;var c=0,f=0;c=i[13]|0;i[13]=c+32;f=i[8]|0;i[((f|0)==0?16:f+28|0)>>2]=c;i[9]=f;i[8]=c;i[c+8>>2]=e;do{if(2!=(a|0))if(1==(a|0)){i[c+12>>2]=t+2;break}else{i[c+12>>2]=i[3];break}else i[c+12>>2]=t}while(0);i[c>>2]=r;i[c+4>>2]=t;i[c+16>>2]=0;i[c+20>>2]=a;s[c+24>>0]=1==(a|0)&1;i[c+28>>2]=0;return}function A(){var e=0,r=0,t=0;t=i[19]|0;r=i[18]|0;e:while(1){e=r+2|0;if(r>>>0>=t>>>0){r=6;break}switch(a[e>>1]|0){case 13:case 10:{r=6;break e}case 93:{r=7;break e}case 92:{e=r+4|0;break}default:{}}r=e}if((r|0)==6){i[18]=e;Y();e=0}else if((r|0)==7){i[18]=e;e=93}return e|0}function C(e,r,t,s,i,c,f,oe){e=e|0;r=r|0;t=t|0;s=s|0;i=i|0;c=c|0;f=f|0;oe=oe|0;if((((((a[e+12>>1]|0)==oe<<16>>16?(a[e+10>>1]|0)==f<<16>>16:0)?(a[e+8>>1]|0)==c<<16>>16:0)?(a[e+6>>1]|0)==i<<16>>16:0)?(a[e+4>>1]|0)==s<<16>>16:0)?(a[e+2>>1]|0)==t<<16>>16:0)r=(a[e>>1]|0)==r<<16>>16;else r=0;return r|0}function y(e){e=e|0;switch(a[e>>1]|0){case 62:{e=(a[e+-2>>1]|0)==61;break}case 41:case 59:{e=1;break}case 104:{e=E(e+-2|0,99,97,116,99)|0;break}case 121:{e=O(e+-2|0,102,105,110,97,108,108)|0;break}case 101:{e=P(e+-2|0,101,108,115)|0;break}default:e=0}return e|0}function g(e,r){e=e|0;r=r|0;var t=0,s=0;t=i[18]|0;s=a[t>>1]|0;if(s<<16>>16==97){i[18]=t+4;t=w(1)|0;e=i[18]|0;if(_(t)|0){d(t);r=(i[18]|0)+2|0;i[18]=r}else{H(t)|0;r=i[18]|0}s=w(1)|0;t=i[18]|0}if((t|0)!=(e|0))J(e,r);return s|0}function I(){var e=0,r=0,t=0;e:while(1){e=i[18]|0;r=e+2|0;i[18]=r;if(e>>>0>=(i[19]|0)>>>0){t=7;break}switch(a[r>>1]|0){case 13:case 10:{t=7;break e}case 47:break e;case 91:{A()|0;break}case 92:{i[18]=e+4;break}default:{}}}if((t|0)==7)Y();return}function p(e){e=e|0;var r=0,t=0,s=0,c=0,f=0;c=(i[18]|0)+2|0;i[18]=c;t=i[19]|0;while(1){r=c+2|0;if(c>>>0>=t>>>0)break;s=a[r>>1]|0;if(!e?ae(s)|0:0)break;if(s<<16>>16==42?(a[c+4>>1]|0)==47:0){f=8;break}c=r}if((f|0)==8){i[18]=r;r=c+4|0}i[18]=r;return}function U(e,r,t,s,i,c,f){e=e|0;r=r|0;t=t|0;s=s|0;i=i|0;c=c|0;f=f|0;if(((((a[e+10>>1]|0)==f<<16>>16?(a[e+8>>1]|0)==c<<16>>16:0)?(a[e+6>>1]|0)==i<<16>>16:0)?(a[e+4>>1]|0)==s<<16>>16:0)?(a[e+2>>1]|0)==t<<16>>16:0)r=(a[e>>1]|0)==r<<16>>16;else r=0;return r|0}function m(e,r,t,s,c,f,oe,le){e=e|0;r=r|0;t=t|0;s=s|0;c=c|0;f=f|0;oe=oe|0;le=le|0;var de=0,pe=0;pe=e+-12|0;de=i[3]|0;if(pe>>>0>=de>>>0?C(pe,r,t,s,c,f,oe,le)|0:0)if((pe|0)==(de|0))de=1;else de=F(a[e+-14>>1]|0)|0;else de=0;return de|0}function S(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:{e=1;break}default:if((e&-8)<<16>>16==40|(e+-58&65535)<6)e=1;else{switch(e<<16>>16){case 91:case 93:case 94:{e=1;break e}default:{}}e=(e+-123&65535)<4}}}while(0);return e|0}function x(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:break;default:if(!((e+-58&65535)<6|(e+-40&65535)<7&e<<16>>16!=41)){switch(e<<16>>16){case 91:case 94:break e;default:{}}return e<<16>>16!=125&(e+-123&65535)<4|0}}}while(0);return 1}function O(e,r,t,s,c,f,oe){e=e|0;r=r|0;t=t|0;s=s|0;c=c|0;f=f|0;oe=oe|0;var le=0,de=0;de=e+-10|0;le=i[3]|0;if(de>>>0>=le>>>0?U(de,r,t,s,c,f,oe)|0:0)if((de|0)==(le|0))le=1;else le=F(a[e+-12>>1]|0)|0;else le=0;return le|0}function $(e,r,t,s,c,f){e=e|0;r=r|0;t=t|0;s=s|0;c=c|0;f=f|0;var oe=0,le=0;le=e+-8|0;oe=i[3]|0;if(le>>>0>=oe>>>0?B(le,r,t,s,c,f)|0:0)if((le|0)==(oe|0))oe=1;else oe=F(a[e+-10>>1]|0)|0;else oe=0;return oe|0}function j(e){e=e|0;var r=0,t=0,s=0,c=0;t=oe;oe=oe+16|0;s=t;i[s>>2]=0;i[12]=e;r=i[3]|0;c=r+(e<<1)|0;e=c+2|0;a[c>>1]=0;i[s>>2]=e;i[13]=e;i[4]=0;i[8]=0;i[6]=0;i[5]=0;i[10]=0;i[7]=0;oe=t;return r|0}function B(e,r,t,s,i,c){e=e|0;r=r|0;t=t|0;s=s|0;i=i|0;c=c|0;if((((a[e+8>>1]|0)==c<<16>>16?(a[e+6>>1]|0)==i<<16>>16:0)?(a[e+4>>1]|0)==s<<16>>16:0)?(a[e+2>>1]|0)==t<<16>>16:0)r=(a[e>>1]|0)==r<<16>>16;else r=0;return r|0}function E(e,r,t,s,c){e=e|0;r=r|0;t=t|0;s=s|0;c=c|0;var f=0,oe=0;oe=e+-6|0;f=i[3]|0;if(oe>>>0>=f>>>0?z(oe,r,t,s,c)|0:0)if((oe|0)==(f|0))f=1;else f=F(a[e+-8>>1]|0)|0;else f=0;return f|0}function P(e,r,t,s){e=e|0;r=r|0;t=t|0;s=s|0;var c=0,f=0;f=e+-4|0;c=i[3]|0;if(f>>>0>=c>>>0?K(f,r,t,s)|0:0)if((f|0)==(c|0))c=1;else c=F(a[e+-6>>1]|0)|0;else c=0;return c|0}function q(e,r,t){e=e|0;r=r|0;t=t|0;var s=0,c=0;c=e+-2|0;s=i[3]|0;if(c>>>0>=s>>>0?N(c,r,t)|0:0)if((c|0)==(s|0))s=1;else s=F(a[e+-4>>1]|0)|0;else s=0;return s|0}function z(e,r,t,s,i){e=e|0;r=r|0;t=t|0;s=s|0;i=i|0;if(((a[e+6>>1]|0)==i<<16>>16?(a[e+4>>1]|0)==s<<16>>16:0)?(a[e+2>>1]|0)==t<<16>>16:0)r=(a[e>>1]|0)==r<<16>>16;else r=0;return r|0}function D(e,r){e=e|0;r=r|0;var t=0;t=i[3]|0;if(t>>>0<=e>>>0?(a[e>>1]|0)==r<<16>>16:0)if((t|0)==(e|0))t=1;else t=F(a[e+-2>>1]|0)|0;else t=0;return t|0}function F(e){e=e|0;e:do{if((e+-9&65535)<5)e=1;else{switch(e<<16>>16){case 32:case 160:{e=1;break e}default:{}}e=e<<16>>16!=46&(S(e)|0)}}while(0);return e|0}function G(){var e=0,r=0,t=0;e=i[19]|0;t=i[18]|0;e:while(1){r=t+2|0;if(t>>>0>=e>>>0)break;switch(a[r>>1]|0){case 13:case 10:break e;default:t=r}}i[18]=r;return}function H(e){e=e|0;while(1){if(Z(e)|0)break;if(S(e)|0)break;e=(i[18]|0)+2|0;i[18]=e;e=a[e>>1]|0;if(!(e<<16>>16)){e=0;break}}return e|0}function J(e,r){e=e|0;r=r|0;var t=0,s=0;t=i[13]|0;i[13]=t+12;s=i[10]|0;i[((s|0)==0?20:s+8|0)>>2]=t;i[10]=t;i[t>>2]=e;i[t+4>>2]=r;i[t+8>>2]=0;return}function K(e,r,t,s){e=e|0;r=r|0;t=t|0;s=s|0;if((a[e+4>>1]|0)==s<<16>>16?(a[e+2>>1]|0)==t<<16>>16:0)r=(a[e>>1]|0)==r<<16>>16;else r=0;return r|0}function L(e){e=e|0;if(!($(e,119,104,105,108,101)|0)?!(P(e,102,111,114)|0):0)e=q(e,105,102)|0;else e=1;return e|0}function M(){var e=0;e=i[(i[6]|0)+20>>2]|0;switch(e|0){case 1:{e=-1;break}case 2:{e=-2;break}default:e=e-(i[3]|0)>>1}return e|0}function N(e,r,t){e=e|0;r=r|0;t=t|0;if((a[e+2>>1]|0)==t<<16>>16)r=(a[e>>1]|0)==r<<16>>16;else r=0;return r|0}function Q(e){e=e|0;switch(e<<16>>16){case 160:case 32:case 12:case 11:case 9:{e=1;break}default:e=0}return e|0}function R(e){e=e|0;if((i[3]|0)==(e|0))e=1;else e=F(a[e+-2>>1]|0)|0;return e|0}function T(){var e=0;e=i[(i[6]|0)+16>>2]|0;if(!e)e=-1;else e=e-(i[3]|0)>>1;return e|0}function V(){var e=0;e=i[6]|0;e=i[((e|0)==0?16:e+28|0)>>2]|0;i[6]=e;return(e|0)!=0|0}function W(){var e=0;e=i[7]|0;e=i[((e|0)==0?20:e+8|0)>>2]|0;i[7]=e;return(e|0)!=0|0}function X(e){e=e|0;var r=0;r=oe;oe=oe+e|0;oe=oe+15&-16;return r|0}function Y(){s[588]=1;i[14]=(i[18]|0)-(i[3]|0)>>1;i[18]=(i[19]|0)+2;return}function Z(e){e=e|0;return(e|128)<<16>>16==160|(e+-9&65535)<5|0}function _(e){e=e|0;return e<<16>>16==39|e<<16>>16==34|0}function ee(){return(i[(i[6]|0)+12>>2]|0)-(i[3]|0)>>1|0}function re(){return(i[(i[6]|0)+8>>2]|0)-(i[3]|0)>>1|0}function ae(e){e=e|0;return e<<16>>16==13|e<<16>>16==10|0}function ie(){return(i[(i[6]|0)+4>>2]|0)-(i[3]|0)>>1|0}function se(){return(i[(i[7]|0)+4>>2]|0)-(i[3]|0)>>1|0}function te(){return(i[i[6]>>2]|0)-(i[3]|0)>>1|0}function fe(){return(i[i[7]>>2]|0)-(i[3]|0)>>1|0}function ce(){return c[(i[6]|0)+24>>0]|0|0}function ne(e){e=e|0;i[3]=e;return}function be(){return(s[589]|0)!=0|0}function ue(){return i[14]|0}return{ai:T,e:ue,ee:se,es:fe,f:be,id:M,ie:ie,ip:ce,is:te,p:b,re:W,ri:V,sa:j,se:ee,ses:ne,ss:re,sta:X}}({Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},{},xe),Ee=Me.sta(2*je)}const t=_e.length+1;Me.ses(Ee),Me.sa(t-1),(Re?b:n)(_e,new Uint16Array(xe,Ee,t)),Me.p()||(Be=Me.e(),h());const s=[],a=[];for(;Me.ri();){const e=Me.is(),r=Me.ie(),t=Me.ai(),a=Me.id(),i=Me.ss(),c=Me.se();let f;Me.ip()&&(f=u(-1===a?e:e+1,_e.charCodeAt(-1===a?e-1:e))),s.push({n:f,s:e,e:r,ss:i,se:c,d:a,a:t})}for(;Me.re();){const e=Me.es(),r=_e.charCodeAt(e);a.push(34===r||39===r?u(e+1,r):_e.slice(Me.es(),Me.ee()))}return[s,a,!!Me.f()]}function n(e,r){const t=e.length;let s=0;for(;s<t;){const t=e.charCodeAt(s);r[s++]=(255&t)<<8|t>>>8}}function b(e,r){const t=e.length;let s=0;for(;s<t;)r[s]=e.charCodeAt(s++)}function u(e,r){Be=e;let t="",s=Be;for(;;){Be>=_e.length&&h();const e=_e.charCodeAt(Be);if(e===r)break;92===e?(t+=_e.slice(s,Be),t+=k(),s=Be):(8232===e||8233===e||o(e)&&h(),++Be)}return t+=_e.slice(s,Be++),t}function k(){let e=_e.charCodeAt(++Be);switch(++Be,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(l(2));case 117:return function(){let e;123===_e.charCodeAt(Be)?(++Be,e=l(_e.indexOf("}",Be)-Be),++Be,e>1114111&&h()):e=l(4);return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}();case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===_e.charCodeAt(Be)&&++Be;case 10:return"";case 56:case 57:h();default:if(e>=48&&e<=55){let r=_e.substr(Be-1,3).match(/^[0-7]+/)[0],t=parseInt(r,8);return t>255&&(r=r.slice(0,-1),t=parseInt(r,8)),Be+=r.length-1,e=_e.charCodeAt(Be),"0"===r&&56!==e&&57!==e||h(),String.fromCharCode(t)}return o(e)?"":String.fromCharCode(e)}}function l(e){const r=Be;let t=0,s=0;for(let r=0;r<e;++r,++Be){let e,a=_e.charCodeAt(Be);if(95!==a){if(a>=97)e=a-97+10;else if(a>=65)e=a-65+10;else{if(!(a>=48&&a<=57))break;e=a-48}if(e>=16)break;s=a,t=16*t+e}else 95!==s&&0!==r||h(),s=a}return 95!==s&&Be-r===e||h(),t}function o(e){return 13===e||10===e}function h(){throw Object.assign(new Error(`Parse error ${Fe}:${_e.slice(0,Be).split("\n").length}:${Be-_e.lastIndexOf("\n",Be-1)}`),{idx:Be})}async function defaultResolve(e,r){return resolveImportMap(Je,resolveIfNotPlainOrUrl(e,r)||e,r)}async function _resolve(e,r){const t=resolveIfNotPlainOrUrl(e,r);return{r:resolveImportMap(Je,t||e,r),b:!t&&!isURL(e)}}const Ne=s?async(e,r)=>({r:await s(e,r,defaultResolve),b:false}):_resolve;const He={};async function loadAll(e,r){if(!e.b&&!r[e.u]){r[e.u]=1;await e.L;await Promise.all(e.d.map((e=>loadAll(e,r))));e.n||(e.n=e.d.some((e=>e.n)))}}let Je={imports:{},scopes:{}};let qe=false;let Ye;const Te=Pe.then((()=>{if(!t)if(document.querySelectorAll("script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]").length)setShimMode();else{let e=false;for(const r of document.querySelectorAll("script[type=module],script[type=importmap]"))if(e){if("importmap"===r.type){qe=true;break}}else"module"===r.type&&(e=true)}Ye=Ue&&Ie&&Le&&(!we||Ce)&&(!me||Oe)&&!qe&&true;if(!t&&Ye);else{new MutationObserver((e=>{for(const r of e)if("childList"===r.type)for(const e of r.addedNodes)if("SCRIPT"===e.tagName){e.type===(t?"module-shim":"module")&&processScript(e);e.type===(t?"importmap-shim":"importmap")&&processImportMap(e)}else"LINK"===e.tagName&&e.rel===(t?"modulepreload-shim":"modulepreload")&&processPreload(e)})).observe(document,{childList:true,subtree:true});processImportMaps();processScriptsAndPreloads()}}));let De=Te;let Ke=true;let ze=true;async function topLevelLoad(e,r,s,a,i){t||(ze=false);await De;if(!t&&Ye){if(a)return null;await i;return Se(s?createBlob(s):e,{errUrl:e||s})}const c=getOrCreateLoad(e,r,null,s);const f={};await loadAll(c,f);Ze=void 0;resolveDeps(c,f);await i;if(s&&!t&&!c.n&&true){const e=await Se(createBlob(s),{errUrl:s});le&&revokeObjectURLs(Object.keys(f));return e}if(Ke&&!t&&c.n&&a){oe();Ke=false}const de=await Se(t||c.n||!a?c.b:c.u,{errUrl:c.u});c.s&&(await Se(c.s)).u$_(de);le&&revokeObjectURLs(Object.keys(f));return de}function revokeObjectURLs(e){let r=0;const t=e.length;const s=self.requestIdleCallback?self.requestIdleCallback:self.requestAnimationFrame;s(cleanup);function cleanup(){const a=100*r;if(!(a>t)){for(const r of e.slice(a,a+100)){const e=He[r];e&&URL.revokeObjectURL(e.b)}r++;s(cleanup)}}}async function importShim(e,...r){let s=r[r.length-1];"string"!==typeof s&&(s=ye);await Te;if(ze||t||!Ye){processImportMaps();t||(ze=false)}await De;return topLevelLoad((await Ne(e,s)).r||throwUnresolved(e,s),{credentials:"same-origin"})}self.importShim=importShim;t&&(importShim.getImportMap=()=>JSON.parse(JSON.stringify(Je)));const Ge={};async function importMetaResolve(e,r=this.url){return(await Ne(e,`${r}`)).r||throwUnresolved(e,r)}self._esmsm=Ge;function urlJsString(e){return`'${e.replace(/'/g,"\\'")}'`}let Ze;function resolveDeps(e,r){if(e.b||!r[e.u])return;r[e.u]=0;for(const t of e.d)resolveDeps(t,r);const[t]=e.a;const s=e.S;let a=ve&&Ze?`import '${Ze}';`:"";if(t.length){let r=0,i=0;for(const{s:c,e:f,se:oe,d:le}of t)if(-1===le){const t=e.d[i++];let f=t.b;if(f){if(t.s){a+=`${s.slice(r,c-1)}/*${s.slice(c-1,oe)}*/${urlJsString(f)};import*as m$_${i} from'${t.b}';import{u$_ as u$_${i}}from'${t.s}';u$_${i}(m$_${i})`;r=oe;t.s=void 0;continue}}else(f=t.s)||(f=t.s=createBlob(`export function u$_(m){${t.a[1].map((e=>"default"===e?"$_default=m.default":`${e}=m.${e}`)).join(",")}}${t.a[1].map((e=>"default"===e?"let $_default;export{$_default as default}":`export let ${e}`)).join(";")}\n//# sourceURL=${t.r}?cycle`));a+=`${s.slice(r,c-1)}/*${s.slice(c-1,oe)}*/${urlJsString(f)}`;r=oe}else if(-2===le){Ge[e.r]={url:e.r,resolve:importMetaResolve};a+=`${s.slice(r,c)}self._esmsm[${urlJsString(e.r)}]`;r=oe}else{a+=`${s.slice(r,le+6)}Shim(${s.slice(c,oe)}, ${urlJsString(e.r)}`;r=oe}a+=s.slice(r)}else a+=s;let i=false;a=a.replace(Qe,((r,t,s)=>(i=!t,r.replace(s,(()=>new URL(s,e.r))))));i||(a+="\n//# sourceURL="+e.r);e.b=Ze=createBlob(a);e.S=void 0}const Qe=/\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;const Ve=/^(text|application)\/(x-)?javascript(;|$)/;const We=/^(text|application)\/json(;|$)/;const Xe=/^(text|application)\/css(;|$)/;const er=/url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;let rr=[];let tr=0;function pushFetchPool(){if(++tr>100)return new Promise((e=>rr.push(e)))}function popFetchPool(){tr--;rr.length&&rr.shift()()}function fromParent(e){return e?` imported from ${e}`:""}async function doFetch(e,r,t){if(pe&&!r.integrity)throw Error(`No integrity for ${e}${fromParent(t)}.`);const s=pushFetchPool();s&&await s;try{var a=await he(e,r)}catch(r){r.message=`Unable to fetch ${e}${fromParent(t)} - see network log for details.\n`+r.message;throw r}finally{popFetchPool()}if(!a.ok)throw Error(`${a.status} ${a.statusText} ${a.url}${fromParent(t)}`);return a}async function fetchModule(e,r,t){const s=await doFetch(e,r,t);const a=s.headers.get("content-type");if(Ve.test(a))return{r:s.url,s:await s.text(),t:"js"};if(We.test(a))return{r:s.url,s:`export default ${await s.text()}`,t:"json"};if(Xe.test(a))return{r:s.url,s:`var s=new CSSStyleSheet();s.replaceSync(${JSON.stringify((await s.text()).replace(er,((r,t="",s,a)=>`url(${t}${resolveUrl(s||a,e)}${t})`)))});export default s;`,t:"css"};throw Error(`Unsupported Content-Type "${a}" loading ${e}${fromParent(t)}. Modules must be served with a valid MIME type like application/javascript.`)}function getOrCreateLoad(e,r,s,i){let c=He[e];if(c&&!i)return c;c={u:e,r:i?e:void 0,f:void 0,S:void 0,L:void 0,a:void 0,d:void 0,b:void 0,s:void 0,n:false,t:null};if(He[e]){let e=0;while(He[c.u+ ++e]);c.u+=e}He[c.u]=c;c.f=(async()=>{if(!i){let a;({r:c.r,s:i,t:a}=await(ir[e]||fetchModule(e,r,s)));if(a&&!t){if("css"===a&&!me||"json"===a&&!we)throw Error(`${a}-modules require <script type="esms-options">{ "polyfillEnable": ["${a}-modules"] }<\/script>`);("css"===a&&!Oe||"json"===a&&!Ce)&&(c.n=true)}}try{c.a=parse(i,c.u)}catch(e){console.warn(e);c.a=[[],[]]}c.S=i;return c})();c.L=c.f.then((async()=>{let e=r;c.d=(await Promise.all(c.a[0].map((async({n:r,d:t})=>{(t>=0&&!Ue||2===t&&!Ie)&&(c.n=true);if(!r)return;const{r:s,b:i}=await Ne(r,c.r||c.u);!i||Le&&!qe||(c.n=true);if(-1===t){s||throwUnresolved(r,c.r||c.u);if(a&&a.test(s))return{b:s};e.integrity&&(e=Object.assign({},e,{integrity:void 0}));return getOrCreateLoad(s,e,c.r).f}})))).filter((e=>e))}));return c}function processScriptsAndPreloads(){for(const e of document.querySelectorAll(t?"script[type=module-shim]":"script[type=module]"))processScript(e);for(const e of document.querySelectorAll(t?"link[rel=modulepreload-shim]":"link[rel=modulepreload]"))processPreload(e)}function processImportMaps(){for(const e of document.querySelectorAll(t?'script[type="importmap-shim"]':'script[type="importmap"]'))processImportMap(e)}function getFetchOpts(e){const r={};e.integrity&&(r.integrity=e.integrity);e.referrerpolicy&&(r.referrerPolicy=e.referrerpolicy);"use-credentials"===e.crossorigin?r.credentials="include":"anonymous"===e.crossorigin?r.credentials="omit":r.credentials="same-origin";return r}let sr=Promise.resolve();let ar=1;function domContentLoadedCheck(){0!==--ar||de||document.dispatchEvent(new Event("DOMContentLoaded"))}document.addEventListener("DOMContentLoaded",(async()=>{await Te;domContentLoadedCheck();if(t||!Ye){processImportMaps();processScriptsAndPreloads()}}));let nr=1;"complete"===document.readyState?readyStateCompleteCheck():document.addEventListener("readystatechange",(async()=>{processImportMaps();await Te;readyStateCompleteCheck()}));function readyStateCompleteCheck(){0!==--nr||de||document.dispatchEvent(new Event("readystatechange"))}function processImportMap(e){if(!e.ep&&(e.src||e.innerHTML)){e.ep=true;if(e.src){if(!t)return;qe=true}if(ze){De=De.then((async()=>{Je=resolveAndComposeImportMap(e.src?await(await doFetch(e.src,getFetchOpts(e))).json():JSON.parse(e.innerHTML),e.src||ye,Je)})).catch(throwError);t||(ze=false)}}}function processScript(e){if(e.ep)return;if(null!==e.getAttribute("noshim"))return;if(!e.src&&!e.innerHTML)return;e.ep=true;const r=nr>0;const s=ar>0;r&&nr++;s&&ar++;const a=null===e.getAttribute("async")&&r;const i=topLevelLoad(e.src||ye,getFetchOpts(e),!e.src&&e.innerHTML,!t,a&&sr).catch(throwError);a&&(sr=i.then(readyStateCompleteCheck));s&&i.then(domContentLoadedCheck)}const ir={};function processPreload(e){if(!e.ep){e.ep=true;ir[e.href]||(ir[e.href]=fetchModule(e.href,getFetchOpts(e)))}}function throwUnresolved(e,r){throw Error(`Unable to resolve specifier '${e}'${fromParent(r)}`)}})();
1
+ (function(){const e="undefined"!==typeof window;const t="undefined"!==typeof document;const noop=()=>{};const r=t?document.querySelector("script[type=esms-options]"):void 0;const s=r?JSON.parse(r.innerHTML):{};Object.assign(s,self.esmsInitOptions||{});let a=!t||!!s.shimMode;const n=globalHook(a&&s.onimport);const i=globalHook(a&&s.resolve);let c=s.fetch?globalHook(s.fetch):fetch;const f=s.meta?globalHook(shimModule&&s.meta):noop;const te=s.skip?new RegExp(s.skip):null;const re=s.mapOverrides;let se=s.nonce;if(!se&&t){const e=document.querySelector("script[nonce]");e&&(se=e.nonce||e.getAttribute("nonce"))}const ae=globalHook(s.onerror||noop);const ne=s.onpolyfill?globalHook(s.onpolyfill):()=>{console.log("%c^^ Module TypeError above is polyfilled and can be ignored ^^","font-weight:900;color:#391")};const{revokeBlobURLs:oe,noLoadEventRetriggers:ie,enforceIntegrity:ce}=s;function globalHook(e){return"string"===typeof e?self[e]:e}const le=Array.isArray(s.polyfillEnable)?s.polyfillEnable:[];const fe=le.includes("css-modules");const ue=le.includes("json-modules");function setShimMode(){a=true}const de=!navigator.userAgentData&&!!navigator.userAgent.match(/Edge\/\d+\.\d+/);const pe=t?document.baseURI:`${location.protocol}//${location.host}${location.pathname.includes("/")?location.pathname.slice(0,location.pathname.lastIndexOf("/")+1):location.pathname}`;function createBlob(e,t="text/javascript"){return URL.createObjectURL(new Blob([e],{type:t}))}const eoop=e=>setTimeout((()=>{throw e}));const throwError=t=>{(self.reportError||e&&window.safari&&console.error||eoop)(t),void ae(t)};function fromParent(e){return e?` imported from ${e}`:""}const he=/\\/g;function isURL(e){if(-1===e.indexOf(":"))return false;try{new URL(e);return true}catch(e){return false}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isURL(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function resolveIfNotPlainOrUrl(e,t){const r=t.indexOf("?",-1===t.indexOf("#")?t.indexOf("#"):t.length);-1!==r&&(t=t.slice(0,r));-1!==e.indexOf("\\")&&(e=e.replace(he,"/"));if("/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let s;if("/"===t[r.length+1])if("file:"!==r){s=t.slice(r.length+2);s=s.slice(s.indexOf("/")+1)}else s=t.slice(8);else s=t.slice(r.length+("/"===t[r.length]));if("/"===e[0])return t.slice(0,t.length-s.length-1)+e;const a=s.slice(0,s.lastIndexOf("/")+1)+e;const n=[];let i=-1;for(let e=0;e<a.length;e++)if(-1===i){if("."===a[e]){if("."===a[e+1]&&("/"===a[e+2]||e+2===a.length)){n.pop();e+=2;continue}if("/"===a[e+1]||e+1===a.length){e+=1;continue}}while("/"===a[e])e++;i=e}else if("/"===a[e]){n.push(a.slice(i,e+1));i=-1}-1!==i&&n.push(a.slice(i));return t.slice(0,t.length-s.length)+n.join("")}}function resolveAndComposeImportMap(e,t,r){const s={imports:Object.assign({},r.imports),scopes:Object.assign({},r.scopes)};e.imports&&resolveAndComposePackages(e.imports,s.imports,t,r);if(e.scopes)for(let a in e.scopes){const n=resolveUrl(a,t);resolveAndComposePackages(e.scopes[a],s.scopes[n]||(s.scopes[n]={}),t,r)}return s}function getMatch(e,t){if(t[e])return e;let r=e.length;do{const s=e.slice(0,r+1);if(s in t)return s}while(-1!==(r=e.lastIndexOf("/",r-1)))}function applyPackages(e,t){const r=getMatch(e,t);if(r){const s=t[r];if(null===s)return;return s+e.slice(r.length)}}function resolveImportMap(e,t,r){let s=r&&getMatch(r,e.scopes);while(s){const r=applyPackages(t,e.scopes[s]);if(r)return r;s=getMatch(s.slice(0,s.lastIndexOf("/")),e.scopes)}return applyPackages(t,e.imports)||-1!==t.indexOf(":")&&t}function resolveAndComposePackages(e,t,r,s){for(let n in e){const i=resolveIfNotPlainOrUrl(n,r)||n;if((!a||!re)&&t[i]&&t[i]!==e[i])throw Error(`Rejected map override "${i}" from ${t[i]} to ${e[i]}.`);let c=e[n];if("string"!==typeof c)continue;const f=resolveImportMap(s,resolveIfNotPlainOrUrl(c,r)||c,r);f?t[i]=f:console.warn(`Mapping "${n}" -> "${e[n]}" does not resolve`)}}let be;window.addEventListener("error",(e=>be=e));function dynamicImportScript(e,{errUrl:t=e}={}){be=void 0;const r=createBlob(`import*as m from'${e}';self._esmsi=m`);const s=Object.assign(document.createElement("script"),{type:"module",src:r});s.setAttribute("nonce",se);s.setAttribute("noshim","");const a=new Promise(((e,a)=>{s.addEventListener("error",cb);s.addEventListener("load",cb);function cb(n){document.head.removeChild(s);if(self._esmsi){e(self._esmsi,pe);self._esmsi=void 0}else{a(!(n instanceof Event)&&n||be&&be.error||new Error(`Error loading or executing the graph of ${t} (check the console for ${r}).`));be=void 0}}}));document.head.appendChild(s);return a}let me=dynamicImportScript;const ke=dynamicImportScript(createBlob("export default u=>import(u)")).then((e=>{e&&(me=e.default);return!!e}),noop);let we=false;let ge=false;let ve=!(!t||!HTMLScriptElement.supports)&&HTMLScriptElement.supports("importmap");let ye=ve;let Se=false;const $e=Promise.resolve(ve||ke).then((e=>{if(e){Se=true;return Promise.all([ve||me(createBlob("import.meta")).then((()=>ye=true),noop),fe&&me(createBlob(`import"${createBlob("","text/css")}"assert{type:"css"}`)).then((()=>ge=true),noop),ue&&me(createBlob(`import"${createBlob("{}","text/json")}"assert{type:"json"}`)).then((()=>we=true),noop),ve||t&&(HTMLScriptElement.supports||new Promise((e=>{const t=document.createElement("iframe");t.style.display="none";t.setAttribute("nonce",se);t.srcdoc=`<!doctype html><script nonce="${se}"><\/script>`;document.head.appendChild(t);t.onload=()=>{self._$s=r=>{document.head.removeChild(t);ve=r;delete self._$s;e()};const r=t.contentDocument.head.childNodes.length>0;const s=`<!doctype html><script type=importmap nonce="${se}">{"imports":{"x":"${createBlob("")}"}<\/script><script nonce="${se}">import('x').catch(() => {}).then(v=>parent._$s(!!v))<\/script>`;r?t.srcdoc=s:t.contentDocument.write(s)}})))])}}));let Le,Oe,Ce,Me=2<<19;const Ae=1===new Uint8Array(new Uint16Array([1]).buffer)[0]?function(e,t){const r=e.length;let s=0;for(;s<r;)t[s]=e.charCodeAt(s++)}:function(e,t){const r=e.length;let s=0;for(;s<r;){const r=e.charCodeAt(s);t[s++]=(255&r)<<8|r>>>8}},Ie="xportmportlassetafromssertvoyiedeleinstantyreturdebuggeawaithrwhileforifcatcfinallels";let Ue,Ee,Pe;function parse(e,t="@"){Ue=e,Ee=t;const r=2*Ue.length+(2<<18);if(r>Me||!Le){for(;r>Me;)Me*=2;Oe=new ArrayBuffer(Me),Ae(Ie,new Uint16Array(Oe,16,85)),Le=function(e,t,r){"use asm";var s=new e.Int8Array(r),a=new e.Int16Array(r),n=new e.Int32Array(r),i=new e.Uint8Array(r),c=new e.Uint16Array(r),f=992;function b(e){e=e|0;var t=0,r=0,i=0,te=0,re=0,se=0,ae=0;ae=f;f=f+11520|0;re=ae+2048|0;s[763]=1;a[377]=0;a[378]=0;a[379]=0;a[380]=-1;n[57]=n[2];s[764]=0;n[56]=0;s[762]=0;n[58]=ae+10496;n[59]=ae+2304;n[60]=ae;s[765]=0;e=(n[3]|0)+-2|0;n[61]=e;t=e+(n[54]<<1)|0;n[62]=t;e:while(1){r=e+2|0;n[61]=r;if(e>>>0>=t>>>0){te=18;break}t:do{switch(a[r>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if((((a[379]|0)==0?D(r)|0:0)?(m(e+4|0,16,10)|0)==0:0)?(k(),(s[763]|0)==0):0){te=9;break e}else te=17;break}case 105:{if(D(r)|0?(m(e+4|0,26,10)|0)==0:0){l();te=17}else te=17;break}case 59:{te=17;break}case 47:switch(a[e+4>>1]|0){case 47:{j();break t}case 42:{y(1);break t}default:{te=16;break e}}default:{te=16;break e}}}while(0);if((te|0)==17){te=0;n[57]=n[61]}e=n[61]|0;t=n[62]|0}if((te|0)==9){e=n[61]|0;n[57]=e;te=19}else if((te|0)==16){s[763]=0;n[61]=e;te=19}else if((te|0)==18)if(!(s[762]|0)){e=r;te=19}else e=0;do{if((te|0)==19){e:while(1){t=e+2|0;n[61]=t;i=t;if(e>>>0>=(n[62]|0)>>>0){te=75;break}t:do{switch(a[t>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if(((a[379]|0)==0?D(t)|0:0)?(m(e+4|0,16,10)|0)==0:0){k();te=74}else te=74;break}case 105:{if(D(t)|0?(m(e+4|0,26,10)|0)==0:0){l();te=74}else te=74;break}case 99:{if((D(t)|0?(m(e+4|0,36,8)|0)==0:0)?M(a[e+12>>1]|0)|0:0){s[765]=1;te=74}else te=74;break}case 40:{r=n[57]|0;i=n[59]|0;te=a[379]|0;a[379]=te+1<<16>>16;n[i+((te&65535)<<2)>>2]=r;te=74;break}case 41:{t=a[379]|0;if(!(t<<16>>16)){te=36;break e}t=t+-1<<16>>16;a[379]=t;r=a[378]|0;if(r<<16>>16!=0?(se=n[(n[60]|0)+((r&65535)+-1<<2)>>2]|0,(n[se+20>>2]|0)==(n[(n[59]|0)+((t&65535)<<2)>>2]|0)):0){t=se+4|0;if(!(n[t>>2]|0))n[t>>2]=i;n[se+12>>2]=e+4;a[378]=r+-1<<16>>16;te=74}else te=74;break}case 123:{te=n[57]|0;i=n[51]|0;e=te;do{if((a[te>>1]|0)==41&(i|0)!=0?(n[i+4>>2]|0)==(te|0):0){t=n[52]|0;n[51]=t;if(!t){n[47]=0;break}else{n[t+28>>2]=0;break}}}while(0);r=a[379]|0;te=r&65535;s[re+te>>0]=s[765]|0;s[765]=0;i=n[59]|0;a[379]=r+1<<16>>16;n[i+(te<<2)>>2]=e;te=74;break}case 125:{e=a[379]|0;if(!(e<<16>>16)){te=49;break e}r=e+-1<<16>>16;a[379]=r;t=a[380]|0;if(e<<16>>16!=t<<16>>16)if(t<<16>>16!=-1&(r&65535)<(t&65535)){te=53;break e}else{te=74;break t}else{i=n[58]|0;te=(a[377]|0)+-1<<16>>16;a[377]=te;a[380]=a[i+((te&65535)<<1)>>1]|0;h();te=74;break t}}case 39:{d(39);te=74;break}case 34:{d(34);te=74;break}case 47:switch(a[e+4>>1]|0){case 47:{j();break t}case 42:{y(1);break t}default:{t=n[57]|0;r=a[t>>1]|0;r:do{if(!(U(r)|0)){switch(r<<16>>16){case 41:if(q(n[(n[59]|0)+(c[379]<<2)>>2]|0)|0){te=71;break r}else{te=68;break r}case 125:break;default:{te=68;break r}}e=c[379]|0;if(!(p(n[(n[59]|0)+(e<<2)>>2]|0)|0)?(s[re+e>>0]|0)==0:0)te=68;else te=71}else switch(r<<16>>16){case 46:if(((a[t+-2>>1]|0)+-48&65535)<10){te=68;break r}else{te=71;break r}case 43:if((a[t+-2>>1]|0)==43){te=68;break r}else{te=71;break r}case 45:if((a[t+-2>>1]|0)==45){te=68;break r}else{te=71;break r}default:{te=71;break r}}}while(0);r:do{if((te|0)==68){te=0;if(!(o(t)|0)){switch(r<<16>>16){case 0:{te=71;break r}case 47:break;default:{e=1;break r}}if(!(s[764]|0))e=1;else te=71}else te=71}}while(0);if((te|0)==71){g();e=0}s[764]=e;te=74;break t}}case 96:{h();te=74;break}default:te=74}}while(0);if((te|0)==74){te=0;n[57]=n[61]}e=n[61]|0}if((te|0)==36){L();e=0;break}else if((te|0)==49){L();e=0;break}else if((te|0)==53){L();e=0;break}else if((te|0)==75){e=(a[380]|0)==-1&(a[379]|0)==0&(s[762]|0)==0&(a[378]|0)==0;break}}}while(0);f=ae;return e|0}function k(){var e=0,t=0,r=0,i=0,c=0,f=0;c=n[61]|0;f=c+12|0;n[61]=f;t=w(1)|0;e=n[61]|0;if(!((e|0)==(f|0)?!(I(t)|0):0))i=3;e:do{if((i|0)==3){t:do{switch(t<<16>>16){case 100:{B(e,e+14|0);break e}case 97:{n[61]=e+10;w(1)|0;e=n[61]|0;i=6;break}case 102:{i=6;break}case 99:{if((m(e+2|0,36,8)|0)==0?(r=e+10|0,$(a[r>>1]|0)|0):0){n[61]=r;c=w(1)|0;f=n[61]|0;E(c)|0;B(f,n[61]|0);n[61]=(n[61]|0)+-2;break e}e=e+4|0;n[61]=e;i=13;break}case 108:case 118:{i=13;break}case 123:{n[61]=e+2;e=w(1)|0;r=n[61]|0;while(1){if(N(e)|0){d(e);e=(n[61]|0)+2|0;n[61]=e}else{E(e)|0;e=n[61]|0}w(1)|0;e=C(r,e)|0;if(e<<16>>16==44){n[61]=(n[61]|0)+2;e=w(1)|0}t=r;r=n[61]|0;if(e<<16>>16==125){i=32;break}if((r|0)==(t|0)){i=29;break}if(r>>>0>(n[62]|0)>>>0){i=31;break}}if((i|0)==29){L();break e}else if((i|0)==31){L();break e}else if((i|0)==32){n[61]=r+2;i=34;break t}break}case 42:{n[61]=e+2;w(1)|0;i=n[61]|0;C(i,i)|0;i=34;break}default:{}}}while(0);if((i|0)==6){n[61]=e+16;e=w(1)|0;if(e<<16>>16==42){n[61]=(n[61]|0)+2;e=w(1)|0}f=n[61]|0;E(e)|0;B(f,n[61]|0);n[61]=(n[61]|0)+-2;break}else if((i|0)==13){e=e+4|0;n[61]=e;s[763]=0;t:while(1){n[61]=e+2;f=w(1)|0;e=n[61]|0;switch((E(f)|0)<<16>>16){case 91:case 123:{i=15;break t}default:{}}t=n[61]|0;if((t|0)==(e|0))break e;B(e,t);switch((w(1)|0)<<16>>16){case 61:{i=19;break t}case 44:break;default:{i=20;break t}}e=n[61]|0}if((i|0)==15){n[61]=(n[61]|0)+-2;break}else if((i|0)==19){n[61]=(n[61]|0)+-2;break}else if((i|0)==20){n[61]=(n[61]|0)+-2;break}}else if((i|0)==34)t=w(1)|0;e=n[61]|0;if(t<<16>>16==102?(m(e+2|0,52,6)|0)==0:0){n[61]=e+8;u(c,w(1)|0);break}n[61]=e+-2}}while(0);return}function l(){var e=0,t=0,r=0,i=0,c=0;c=n[61]|0;t=c+12|0;n[61]=t;e:do{switch((w(1)|0)<<16>>16){case 40:{e=n[61]|0;t=n[59]|0;r=a[379]|0;a[379]=r+1<<16>>16;n[t+((r&65535)<<2)>>2]=e;if((a[n[57]>>1]|0)!=46){e=n[61]|0;n[61]=e+2;r=w(1)|0;v(c,n[61]|0,0,e);e=n[51]|0;t=n[60]|0;c=a[378]|0;a[378]=c+1<<16>>16;n[t+((c&65535)<<2)>>2]=e;switch(r<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{n[61]=(n[61]|0)+-2;break e}}e=(n[61]|0)+2|0;n[61]=e;switch((w(1)|0)<<16>>16){case 44:{n[61]=(n[61]|0)+2;w(1)|0;r=n[51]|0;n[r+4>>2]=e;c=n[61]|0;n[r+16>>2]=c;s[r+24>>0]=1;n[61]=c+-2;break e}case 41:{a[379]=(a[379]|0)+-1<<16>>16;c=n[51]|0;n[c+4>>2]=e;n[c+12>>2]=(n[61]|0)+2;s[c+24>>0]=1;a[378]=(a[378]|0)+-1<<16>>16;break e}default:{n[61]=(n[61]|0)+-2;break e}}}break}case 46:{n[61]=(n[61]|0)+2;if(((w(1)|0)<<16>>16==109?(e=n[61]|0,(m(e+2|0,44,6)|0)==0):0)?(a[n[57]>>1]|0)!=46:0)v(c,c,e+8|0,2);break}case 42:case 39:case 34:{i=16;break}case 123:{e=n[61]|0;if(a[379]|0){n[61]=e+-2;break e}while(1){if(e>>>0>=(n[62]|0)>>>0)break;e=w(1)|0;if(!(N(e)|0)){if(e<<16>>16==125){i=31;break}}else d(e);e=(n[61]|0)+2|0;n[61]=e}if((i|0)==31)n[61]=(n[61]|0)+2;w(1)|0;e=n[61]|0;if(m(e,50,8)|0){L();break e}n[61]=e+8;e=w(1)|0;if(N(e)|0){u(c,e);break e}else{L();break e}}default:if((n[61]|0)!=(t|0))i=16}}while(0);do{if((i|0)==16){if(a[379]|0){n[61]=(n[61]|0)+-2;break}e=n[62]|0;t=n[61]|0;while(1){if(t>>>0>=e>>>0){i=23;break}r=a[t>>1]|0;if(N(r)|0){i=21;break}i=t+2|0;n[61]=i;t=i}if((i|0)==21){u(c,r);break}else if((i|0)==23){L();break}}}while(0);return}function u(e,t){e=e|0;t=t|0;var r=0,s=0;r=(n[61]|0)+2|0;switch(t<<16>>16){case 39:{d(39);s=5;break}case 34:{d(34);s=5;break}default:L()}do{if((s|0)==5){v(e,r,n[61]|0,1);n[61]=(n[61]|0)+2;s=(w(0)|0)<<16>>16==97;t=n[61]|0;if(s?(m(t+2|0,58,10)|0)==0:0){n[61]=t+12;if((w(1)|0)<<16>>16!=123){n[61]=t;break}e=n[61]|0;r=e;e:while(1){n[61]=r+2;r=w(1)|0;switch(r<<16>>16){case 39:{d(39);n[61]=(n[61]|0)+2;r=w(1)|0;break}case 34:{d(34);n[61]=(n[61]|0)+2;r=w(1)|0;break}default:r=E(r)|0}if(r<<16>>16!=58){s=16;break}n[61]=(n[61]|0)+2;switch((w(1)|0)<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{s=20;break e}}n[61]=(n[61]|0)+2;switch((w(1)|0)<<16>>16){case 125:{s=25;break e}case 44:break;default:{s=24;break e}}n[61]=(n[61]|0)+2;if((w(1)|0)<<16>>16==125){s=25;break}r=n[61]|0}if((s|0)==16){n[61]=t;break}else if((s|0)==20){n[61]=t;break}else if((s|0)==24){n[61]=t;break}else if((s|0)==25){s=n[51]|0;n[s+16>>2]=e;n[s+12>>2]=(n[61]|0)+2;break}}n[61]=t+-2}}while(0);return}function o(e){e=e|0;e:do{switch(a[e>>1]|0){case 100:switch(a[e+-2>>1]|0){case 105:{e=S(e+-4|0,68,2)|0;break e}case 108:{e=S(e+-4|0,72,3)|0;break e}default:{e=0;break e}}case 101:{switch(a[e+-2>>1]|0){case 115:break;case 116:{e=S(e+-4|0,78,4)|0;break e}default:{e=0;break e}}switch(a[e+-4>>1]|0){case 108:{e=O(e+-6|0,101)|0;break e}case 97:{e=O(e+-6|0,99)|0;break e}default:{e=0;break e}}}case 102:{if((a[e+-2>>1]|0)==111?(a[e+-4>>1]|0)==101:0)switch(a[e+-6>>1]|0){case 99:{e=S(e+-8|0,86,6)|0;break e}case 112:{e=S(e+-8|0,98,2)|0;break e}default:{e=0;break e}}else e=0;break}case 110:{e=e+-2|0;if(O(e,105)|0)e=1;else e=S(e,102,5)|0;break}case 111:{e=O(e+-2|0,100)|0;break}case 114:{e=S(e+-2|0,112,7)|0;break}case 116:{e=S(e+-2|0,126,4)|0;break}case 119:switch(a[e+-2>>1]|0){case 101:{e=O(e+-4|0,110)|0;break e}case 111:{e=S(e+-4|0,134,3)|0;break e}default:{e=0;break e}}default:e=0}}while(0);return e|0}function h(){var e=0,t=0,r=0;t=n[62]|0;r=n[61]|0;e:while(1){e=r+2|0;if(r>>>0>=t>>>0){t=8;break}switch(a[e>>1]|0){case 96:{t=9;break e}case 36:{if((a[r+4>>1]|0)==123){t=6;break e}break}case 92:{e=r+4|0;break}default:{}}r=e}if((t|0)==6){n[61]=r+4;e=a[380]|0;t=n[58]|0;r=a[377]|0;a[377]=r+1<<16>>16;a[t+((r&65535)<<1)>>1]=e;r=(a[379]|0)+1<<16>>16;a[379]=r;a[380]=r}else if((t|0)==8){n[61]=e;L()}else if((t|0)==9)n[61]=e;return}function w(e){e=e|0;var t=0,r=0,s=0;r=n[61]|0;e:do{t=a[r>>1]|0;t:do{if(t<<16>>16!=47)if(e)if(M(t)|0)break;else break e;else if(z(t)|0)break;else break e;else switch(a[r+2>>1]|0){case 47:{j();break t}case 42:{y(e);break t}default:{t=47;break e}}}while(0);s=n[61]|0;r=s+2|0;n[61]=r}while(s>>>0<(n[62]|0)>>>0);return t|0}function d(e){e=e|0;var t=0,r=0,s=0,i=0;i=n[62]|0;t=n[61]|0;while(1){s=t+2|0;if(t>>>0>=i>>>0){t=9;break}r=a[s>>1]|0;if(r<<16>>16==e<<16>>16){t=10;break}if(r<<16>>16==92){r=t+4|0;if((a[r>>1]|0)==13){t=t+6|0;t=(a[t>>1]|0)==10?t:r}else t=r}else if(T(r)|0){t=9;break}else t=s}if((t|0)==9){n[61]=s;L()}else if((t|0)==10)n[61]=s;return}function v(e,t,r,a){e=e|0;t=t|0;r=r|0;a=a|0;var i=0,c=0;i=n[55]|0;n[55]=i+32;c=n[51]|0;n[((c|0)==0?188:c+28|0)>>2]=i;n[52]=c;n[51]=i;n[i+8>>2]=e;if(2==(a|0))e=r;else e=1==(a|0)?r+2|0:0;n[i+12>>2]=e;n[i>>2]=t;n[i+4>>2]=r;n[i+16>>2]=0;n[i+20>>2]=a;s[i+24>>0]=1==(a|0)&1;n[i+28>>2]=0;return}function A(){var e=0,t=0,r=0;r=n[62]|0;t=n[61]|0;e:while(1){e=t+2|0;if(t>>>0>=r>>>0){t=6;break}switch(a[e>>1]|0){case 13:case 10:{t=6;break e}case 93:{t=7;break e}case 92:{e=t+4|0;break}default:{}}t=e}if((t|0)==6){n[61]=e;L();e=0}else if((t|0)==7){n[61]=e;e=93}return e|0}function C(e,t){e=e|0;t=t|0;var r=0,s=0;r=n[61]|0;s=a[r>>1]|0;if(s<<16>>16==97){n[61]=r+4;r=w(1)|0;e=n[61]|0;if(N(r)|0){d(r);t=(n[61]|0)+2|0;n[61]=t}else{E(r)|0;t=n[61]|0}s=w(1)|0;r=n[61]|0}if((r|0)!=(e|0))B(e,t);return s|0}function g(){var e=0,t=0,r=0;e:while(1){e=n[61]|0;t=e+2|0;n[61]=t;if(e>>>0>=(n[62]|0)>>>0){r=7;break}switch(a[t>>1]|0){case 13:case 10:{r=7;break e}case 47:break e;case 91:{A()|0;break}case 92:{n[61]=e+4;break}default:{}}}if((r|0)==7)L();return}function p(e){e=e|0;switch(a[e>>1]|0){case 62:{e=(a[e+-2>>1]|0)==61;break}case 41:case 59:{e=1;break}case 104:{e=S(e+-2|0,160,4)|0;break}case 121:{e=S(e+-2|0,168,6)|0;break}case 101:{e=S(e+-2|0,180,3)|0;break}default:e=0}return e|0}function y(e){e=e|0;var t=0,r=0,s=0,i=0,c=0;i=(n[61]|0)+2|0;n[61]=i;r=n[62]|0;while(1){t=i+2|0;if(i>>>0>=r>>>0)break;s=a[t>>1]|0;if(!e?T(s)|0:0)break;if(s<<16>>16==42?(a[i+4>>1]|0)==47:0){c=8;break}i=t}if((c|0)==8){n[61]=t;t=i+4|0}n[61]=t;return}function m(e,t,r){e=e|0;t=t|0;r=r|0;var a=0,n=0;e:do{if(!r)e=0;else{while(1){a=s[e>>0]|0;n=s[t>>0]|0;if(a<<24>>24!=n<<24>>24)break;r=r+-1|0;if(!r){e=0;break e}else{e=e+1|0;t=t+1|0}}e=(a&255)-(n&255)|0}}while(0);return e|0}function I(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:{e=1;break}default:if((e&-8)<<16>>16==40|(e+-58&65535)<6)e=1;else{switch(e<<16>>16){case 91:case 93:case 94:{e=1;break e}default:{}}e=(e+-123&65535)<4}}}while(0);return e|0}function U(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:break;default:if(!((e+-58&65535)<6|(e+-40&65535)<7&e<<16>>16!=41)){switch(e<<16>>16){case 91:case 94:break e;default:{}}return e<<16>>16!=125&(e+-123&65535)<4|0}}}while(0);return 1}function x(e){e=e|0;var t=0,r=0,s=0,i=0;r=f;f=f+16|0;s=r;n[s>>2]=0;n[54]=e;t=n[3]|0;i=t+(e<<1)|0;e=i+2|0;a[i>>1]=0;n[s>>2]=e;n[55]=e;n[47]=0;n[51]=0;n[49]=0;n[48]=0;n[53]=0;n[50]=0;f=r;return t|0}function S(e,t,r){e=e|0;t=t|0;r=r|0;var s=0,i=0;s=e+(0-r<<1)|0;i=s+2|0;e=n[3]|0;if(i>>>0>=e>>>0?(m(i,t,r<<1)|0)==0:0)if((i|0)==(e|0))e=1;else e=$(a[s>>1]|0)|0;else e=0;return e|0}function O(e,t){e=e|0;t=t|0;var r=0;r=n[3]|0;if(r>>>0<=e>>>0?(a[e>>1]|0)==t<<16>>16:0)if((r|0)==(e|0))r=1;else r=$(a[e+-2>>1]|0)|0;else r=0;return r|0}function $(e){e=e|0;e:do{if((e+-9&65535)<5)e=1;else{switch(e<<16>>16){case 32:case 160:{e=1;break e}default:{}}e=e<<16>>16!=46&(I(e)|0)}}while(0);return e|0}function j(){var e=0,t=0,r=0;e=n[62]|0;r=n[61]|0;e:while(1){t=r+2|0;if(r>>>0>=e>>>0)break;switch(a[t>>1]|0){case 13:case 10:break e;default:r=t}}n[61]=t;return}function B(e,t){e=e|0;t=t|0;var r=0,s=0;r=n[55]|0;n[55]=r+12;s=n[53]|0;n[((s|0)==0?192:s+8|0)>>2]=r;n[53]=r;n[r>>2]=e;n[r+4>>2]=t;n[r+8>>2]=0;return}function E(e){e=e|0;while(1){if(M(e)|0)break;if(I(e)|0)break;e=(n[61]|0)+2|0;n[61]=e;e=a[e>>1]|0;if(!(e<<16>>16)){e=0;break}}return e|0}function P(){var e=0;e=n[(n[49]|0)+20>>2]|0;switch(e|0){case 1:{e=-1;break}case 2:{e=-2;break}default:e=e-(n[3]|0)>>1}return e|0}function q(e){e=e|0;if(!(S(e,140,5)|0)?!(S(e,150,3)|0):0)e=S(e,156,2)|0;else e=1;return e|0}function z(e){e=e|0;switch(e<<16>>16){case 160:case 32:case 12:case 11:case 9:{e=1;break}default:e=0}return e|0}function D(e){e=e|0;if((n[3]|0)==(e|0))e=1;else e=$(a[e+-2>>1]|0)|0;return e|0}function F(){var e=0;e=n[(n[49]|0)+12>>2]|0;if(!e)e=-1;else e=e-(n[3]|0)>>1;return e|0}function G(){var e=0;e=n[(n[49]|0)+16>>2]|0;if(!e)e=-1;else e=e-(n[3]|0)>>1;return e|0}function H(){var e=0;e=n[(n[49]|0)+4>>2]|0;if(!e)e=-1;else e=e-(n[3]|0)>>1;return e|0}function J(){var e=0;e=n[49]|0;e=n[((e|0)==0?188:e+28|0)>>2]|0;n[49]=e;return(e|0)!=0|0}function K(){var e=0;e=n[50]|0;e=n[((e|0)==0?192:e+8|0)>>2]|0;n[50]=e;return(e|0)!=0|0}function L(){s[762]=1;n[56]=(n[61]|0)-(n[3]|0)>>1;n[61]=(n[62]|0)+2;return}function M(e){e=e|0;return(e|128)<<16>>16==160|(e+-9&65535)<5|0}function N(e){e=e|0;return e<<16>>16==39|e<<16>>16==34|0}function Q(){return(n[(n[49]|0)+8>>2]|0)-(n[3]|0)>>1|0}function R(){return(n[(n[50]|0)+4>>2]|0)-(n[3]|0)>>1|0}function T(e){e=e|0;return e<<16>>16==13|e<<16>>16==10|0}function V(){return(n[n[49]>>2]|0)-(n[3]|0)>>1|0}function W(){return(n[n[50]>>2]|0)-(n[3]|0)>>1|0}function X(){return i[(n[49]|0)+24>>0]|0|0}function Y(e){e=e|0;n[3]=e;return}function Z(){return(s[763]|0)!=0|0}function _(){return n[56]|0}function ee(e){e=e|0;f=e+992+15&-16;return 992}return{su:ee,ai:G,e:_,ee:R,es:W,f:Z,id:P,ie:H,ip:X,is:V,p:b,re:K,ri:J,sa:x,se:F,ses:Y,ss:Q}}("undefined"!=typeof self?self:global,{},Oe),Ce=Le.su(Me-(2<<17))}const s=Ue.length+1;Le.ses(Ce),Le.sa(s-1),Ae(Ue,new Uint16Array(Oe,Ce,s)),Le.p()||(Pe=Le.e(),o());const a=[],n=[];for(;Le.ri();){const e=Le.is(),t=Le.ie(),r=Le.ai(),s=Le.id(),n=Le.ss(),i=Le.se();let c;Le.ip()&&(c=b(-1===s?e:e+1,Ue.charCodeAt(-1===s?e-1:e))),a.push({n:c,s:e,e:t,ss:n,se:i,d:s,a:r})}for(;Le.re();){const e=Le.es(),t=Ue.charCodeAt(e);n.push(34===t||39===t?b(e+1,t):Ue.slice(Le.es(),Le.ee()))}return[a,n,!!Le.f()]}function b(e,t){Pe=e;let r="",s=Pe;for(;;){Pe>=Ue.length&&o();const e=Ue.charCodeAt(Pe);if(e===t)break;92===e?(r+=Ue.slice(s,Pe),r+=k(),s=Pe):(8232===e||8233===e||u(e)&&o(),++Pe)}return r+=Ue.slice(s,Pe++),r}function k(){let e=Ue.charCodeAt(++Pe);switch(++Pe,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(l(2));case 117:return function(){let e;123===Ue.charCodeAt(Pe)?(++Pe,e=l(Ue.indexOf("}",Pe)-Pe),++Pe,e>1114111&&o()):e=l(4);return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}();case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===Ue.charCodeAt(Pe)&&++Pe;case 10:return"";case 56:case 57:o();default:if(e>=48&&e<=55){let t=Ue.substr(Pe-1,3).match(/^[0-7]+/)[0],r=parseInt(t,8);return r>255&&(t=t.slice(0,-1),r=parseInt(t,8)),Pe+=t.length-1,e=Ue.charCodeAt(Pe),"0"===t&&56!==e&&57!==e||o(),String.fromCharCode(r)}return u(e)?"":String.fromCharCode(e)}}function l(e){const t=Pe;let r=0,s=0;for(let t=0;t<e;++t,++Pe){let e,a=Ue.charCodeAt(Pe);if(95!==a){if(a>=97)e=a-97+10;else if(a>=65)e=a-65+10;else{if(!(a>=48&&a<=57))break;e=a-48}if(e>=16)break;s=a,r=16*r+e}else 95!==s&&0!==t||o(),s=a}return 95!==s&&Pe-t===e||o(),r}function u(e){return 13===e||10===e}function o(){throw Object.assign(Error(`Parse error ${Ee}:${Ue.slice(0,Pe).split("\n").length}:${Pe-Ue.lastIndexOf("\n",Pe-1)}`),{idx:Pe})}async function _resolve(e,t){const r=resolveIfNotPlainOrUrl(e,t);return{r:resolveImportMap(Re,r||e,t)||throwUnresolved(e,t),b:!r&&!isURL(e)}}const xe=i?async(e,t)=>{let r=i(e,t,defaultResolve);r&&r.then&&(r=await r);return r?{r:r,b:!resolveIfNotPlainOrUrl(e,t)&&!isURL(e)}:_resolve(e,t)}:_resolve;async function importShim(e,...r){let s=r[r.length-1];"string"!==typeof s&&(s=pe);await Te;n&&await n(e,"string"!==typeof r[1]?r[1]:{},s);if(De||a||!_e){t&&processImportMaps();a||(De=false)}await Be;return topLevelLoad((await xe(e,s)).r,{credentials:"same-origin"})}self.importShim=importShim;function defaultResolve(e,t){return resolveImportMap(Re,resolveIfNotPlainOrUrl(e,t)||e,t)||throwUnresolved(e,t)}function throwUnresolved(e,t){throw Error(`Unable to resolve specifier '${e}'${fromParent(t)}`)}const resolveSync=(e,t=pe)=>{t=`${t}`;const r=i&&i(e,t,defaultResolve);return r&&!r.then?r:defaultResolve(e,t)};function metaResolve(e,t=this.url){return resolveSync(e,t)}importShim.resolve=resolveSync;importShim.getImportMap=()=>JSON.parse(JSON.stringify(Re));importShim.addImportMap=e=>{if(!a)throw new Error("Unsupported in polyfill mode.");Re=resolveAndComposeImportMap(e,pe,Re)};const je=importShim._r={};async function loadAll(e,t){if(!e.b&&!t[e.u]){t[e.u]=1;await e.L;await Promise.all(e.d.map((e=>loadAll(e,t))));e.n||(e.n=e.d.some((e=>e.n)))}}let Re={imports:{},scopes:{}};let Ne=false;let _e;const Te=$e.then((()=>{if(!a)if(document.querySelectorAll("script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]").length)setShimMode();else{let e=false;for(const r of document.querySelectorAll("script[type=module],script[type=importmap]"))if(e){if("importmap"===r.type){Ne=true;break}}else"module"===r.type&&(e=true)}_e=true!==s.polyfillEnable&&Se&&ye&&ve&&(!ue||we)&&(!fe||ge)&&!Ne&&true;if(t){if(!ve){const n=HTMLScriptElement.supports||(e=>"classic"===e||"module"===e);HTMLScriptElement.supports=e=>"importmap"===e||n(e)}if(a||!_e){new MutationObserver((e=>{for(const t of e)if("childList"===t.type)for(const e of t.addedNodes)if("SCRIPT"===e.tagName){e.type===(a?"module-shim":"module")&&processScript(e);e.type===(a?"importmap-shim":"importmap")&&processImportMap(e)}else"LINK"===e.tagName&&e.rel===(a?"modulepreload-shim":"modulepreload")&&processPreload(e)})).observe(document,{childList:true,subtree:true});processImportMaps();processScriptsAndPreloads();if("complete"===document.readyState)readyStateCompleteCheck();else{async function readyListener(){await Te;processImportMaps();if("complete"===document.readyState){readyStateCompleteCheck();document.removeEventListener("readystatechange",readyListener)}}document.addEventListener("readystatechange",readyListener)}}}}));let Be=Te;let He=true;let De=true;async function topLevelLoad(e,t,r,s,i){a||(De=false);await Be;n&&await n(id,"string"!==typeof args[1]?args[1]:{},parentUrl);if(!a&&_e){if(s)return null;await i;return me(r?createBlob(r):e,{errUrl:e||r})}const c=getOrCreateLoad(e,t,null,r);const f={};await loadAll(c,f);Fe=void 0;resolveDeps(c,f);await i;if(r&&!a&&!c.n&&true){const e=await me(createBlob(r),{errUrl:r});oe&&revokeObjectURLs(Object.keys(f));return e}if(He&&!a&&c.n&&s){ne();He=false}const te=await me(a||c.n||!s?c.b:c.u,{errUrl:c.u});c.s&&(await me(c.s)).u$_(te);oe&&revokeObjectURLs(Object.keys(f));return te}function revokeObjectURLs(e){let t=0;const r=e.length;const s=self.requestIdleCallback?self.requestIdleCallback:self.requestAnimationFrame;s(cleanup);function cleanup(){const a=100*t;if(!(a>r)){for(const t of e.slice(a,a+100)){const e=je[t];e&&URL.revokeObjectURL(e.b)}t++;s(cleanup)}}}function urlJsString(e){return`'${e.replace(/'/g,"\\'")}'`}let Fe;function resolveDeps(e,t){if(e.b||!t[e.u])return;t[e.u]=0;for(const i of e.d)resolveDeps(i,t);const[r]=e.a;const s=e.S;let a=de&&Fe?`import '${Fe}';`:"";if(r.length){let c=0,te=0,re=[];function pushStringTo(t){while(re[re.length-1]<t){const t=re.pop();a+=`${s.slice(c,t)}, ${urlJsString(e.r)}`;c=t}a+=s.slice(c,t);c=t}for(const{s:se,ss:ae,se:ne,d:oe}of r)if(-1===oe){let ie=e.d[te++],ce=ie.b,le=!ce;le&&((ce=ie.s)||(ce=ie.s=createBlob(`export function u$_(m){${ie.a[1].map((e=>"default"===e?"d$_=m.default":`${e}=m.${e}`)).join(",")}}${ie.a[1].map((e=>"default"===e?"let d$_;export{d$_ as default}":`export let ${e}`)).join(";")}\n//# sourceURL=${ie.r}?cycle`)));pushStringTo(se-1);a+=`/*${s.slice(se-1,ne)}*/${urlJsString(ce)}`;if(!le&&ie.s){a+=`;import*as m$_${te} from'${ie.b}';import{u$_ as u$_${te}}from'${ie.s}';u$_${te}(m$_${te})`;ie.s=void 0}c=ne}else if(-2===oe){e.m={url:e.r,resolve:metaResolve};f(e.m,e.u);pushStringTo(se);a+=`importShim._r[${urlJsString(e.u)}].m`;c=ne}else{pushStringTo(ae+6);a+="Shim(";re.push(ne-1);c=se}pushStringTo(s.length)}else a+=s;let n=false;a=a.replace(qe,((t,r,s)=>(n=!r,t.replace(s,(()=>new URL(s,e.r))))));n||(a+="\n//# sourceURL="+e.r);e.b=Fe=createBlob(a);e.S=void 0}const qe=/\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;const Je=/^(text|application)\/(x-)?javascript(;|$)/;const Ke=/^(text|application)\/json(;|$)/;const ze=/^(text|application)\/css(;|$)/;const Ge=/url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;let Qe=[];let Ve=0;function pushFetchPool(){if(++Ve>100)return new Promise((e=>Qe.push(e)))}function popFetchPool(){Ve--;Qe.length&&Qe.shift()()}async function doFetch(e,t,r){if(ce&&!t.integrity)throw Error(`No integrity for ${e}${fromParent(r)}.`);const s=pushFetchPool();s&&await s;try{var a=await c(e,t)}catch(t){t.message=`Unable to fetch ${e}${fromParent(r)} - see network log for details.\n`+t.message;throw t}finally{popFetchPool()}if(!a.ok)throw Error(`${a.status} ${a.statusText} ${a.url}${fromParent(r)}`);return a}async function fetchModule(e,t,r){const s=await doFetch(e,t,r);const a=s.headers.get("content-type");if(Je.test(a))return{r:s.url,s:await s.text(),t:"js"};if(Ke.test(a))return{r:s.url,s:`export default ${await s.text()}`,t:"json"};if(ze.test(a))return{r:s.url,s:`var s=new CSSStyleSheet();s.replaceSync(${JSON.stringify((await s.text()).replace(Ge,((t,r="",s,a)=>`url(${r}${resolveUrl(s||a,e)}${r})`)))});export default s;`,t:"css"};throw Error(`Unsupported Content-Type "${a}" loading ${e}${fromParent(r)}. Modules must be served with a valid MIME type like application/javascript.`)}function getOrCreateLoad(e,t,r,s){let n=je[e];if(n&&!s)return n;n={u:e,r:s?e:void 0,f:void 0,S:void 0,L:void 0,a:void 0,d:void 0,b:void 0,s:void 0,n:false,t:null,m:null};if(je[e]){let e=0;while(je[n.u+ ++e]);n.u+=e}je[n.u]=n;n.f=(async()=>{if(!s){let i;({r:n.r,s:s,t:i}=await(Ze[e]||fetchModule(e,t,r)));if(i&&!a){if("css"===i&&!fe||"json"===i&&!ue)throw Error(`${i}-modules require <script type="esms-options">{ "polyfillEnable": ["${i}-modules"] }<\/script>`);("css"===i&&!ge||"json"===i&&!we)&&(n.n=true)}}try{n.a=parse(s,n.u)}catch(e){throwError(e);n.a=[[],[],false]}n.S=s;return n})();n.L=n.f.then((async()=>{let e=t;n.d=(await Promise.all(n.a[0].map((async({n:t,d:r})=>{(r>=0&&!Se||-2===r&&!ye)&&(n.n=true);if(-1!==r||!t)return;const{r:s,b:a}=await xe(t,n.r||n.u);!a||ve&&!Ne||(n.n=true);if(te&&te.test(s))return{b:s};e.integrity&&(e=Object.assign({},e,{integrity:void 0}));return getOrCreateLoad(s,e,n.r).f})))).filter((e=>e))}));return n}function processScriptsAndPreloads(){for(const e of document.querySelectorAll(a?"script[type=module-shim]":"script[type=module]"))processScript(e);for(const e of document.querySelectorAll(a?"link[rel=modulepreload-shim]":"link[rel=modulepreload]"))processPreload(e)}function processImportMaps(){for(const e of document.querySelectorAll(a?'script[type="importmap-shim"]':'script[type="importmap"]'))processImportMap(e)}function getFetchOpts(e){const t={};e.integrity&&(t.integrity=e.integrity);e.referrerpolicy&&(t.referrerPolicy=e.referrerpolicy);"use-credentials"===e.crossorigin?t.credentials="include":"anonymous"===e.crossorigin?t.credentials="omit":t.credentials="same-origin";return t}let We=Promise.resolve();let Xe=1;function domContentLoadedCheck(){0!==--Xe||ie||document.dispatchEvent(new Event("DOMContentLoaded"))}t&&document.addEventListener("DOMContentLoaded",(async()=>{await Te;domContentLoadedCheck();if(a||!_e){processImportMaps();processScriptsAndPreloads()}}));let Ye=1;function readyStateCompleteCheck(){0!==--Ye||ie||document.dispatchEvent(new Event("readystatechange"))}function processImportMap(e){if(!e.ep&&(e.src||e.innerHTML)){e.ep=true;if(e.src){if(!a)return;Ne=true}if(De){Be=Be.then((async()=>{Re=resolveAndComposeImportMap(e.src?await(await doFetch(e.src,getFetchOpts(e))).json():JSON.parse(e.innerHTML),e.src||pe,Re)})).catch(throwError);a||(De=false)}}}function processScript(e){if(e.ep)return;if(null!==e.getAttribute("noshim"))return;if(!e.src&&!e.innerHTML)return;e.ep=true;const t=null===e.getAttribute("async")&&Ye>0;const r=Xe>0;t&&Ye++;r&&Xe++;const s=topLevelLoad(e.src||pe,getFetchOpts(e),!e.src&&e.innerHTML,!a,t&&We).catch(throwError);t&&(We=s.then(readyStateCompleteCheck));r&&s.then(domContentLoadedCheck)}const Ze={};function processPreload(e){if(!e.ep){e.ep=true;Ze[e.href]||(Ze[e.href]=fetchModule(e.href,getFetchOpts(e)))}}})();
2
2
 
3
3
  //# sourceMappingURL=es-module-shims.js.map
@@ -1,5 +1,6 @@
1
1
  require "thor"
2
2
  require "importmap/packager"
3
+ require "importmap/npm"
3
4
 
4
5
  class Importmap::Commands < Thor
5
6
  include Thor::Actions
@@ -63,11 +64,54 @@ class Importmap::Commands < Thor
63
64
  puts Rails.application.importmap.to_json(resolver: ActionController::Base.helpers)
64
65
  end
65
66
 
67
+ desc "audit", "Run a security audit"
68
+ def audit
69
+ vulnerable_packages = npm.vulnerable_packages
70
+
71
+ if vulnerable_packages.any?
72
+ table = [["Package", "Severity", "Vulnerable versions", "Vulnerability"]]
73
+ vulnerable_packages.each { |p| table << [p.name, p.severity, p.vulnerable_versions, p.vulnerability] }
74
+
75
+ puts_table(table)
76
+ vulnerabilities = 'vulnerability'.pluralize(vulnerable_packages.size)
77
+ severities = vulnerable_packages.map(&:severity).tally.sort_by(&:last).reverse
78
+ .map { |severity, count| "#{count} #{severity}" }
79
+ .join(", ")
80
+ puts " #{vulnerable_packages.size} #{vulnerabilities} found: #{severities}"
81
+
82
+ exit 1
83
+ else
84
+ puts "No vulnerable packages found"
85
+ end
86
+ end
87
+
88
+ desc "outdated", "Check for outdated packages"
89
+ def outdated
90
+ outdated_packages = npm.outdated_packages
91
+
92
+ if outdated_packages.any?
93
+ table = [["Package", "Current", "Latest"]]
94
+ outdated_packages.each { |p| table << [p.name, p.current_version, p.latest_version || p.error] }
95
+
96
+ puts_table(table)
97
+ packages = 'package'.pluralize(outdated_packages.size)
98
+ puts " #{outdated_packages.size} outdated #{packages} found"
99
+
100
+ exit 1
101
+ else
102
+ puts "No outdated packages found"
103
+ end
104
+ end
105
+
66
106
  private
67
107
  def packager
68
108
  @packager ||= Importmap::Packager.new
69
109
  end
70
110
 
111
+ def npm
112
+ @npm ||= Importmap::Npm.new
113
+ end
114
+
71
115
  def remove_line_from_file(path, pattern)
72
116
  path = File.expand_path(path, destination_root)
73
117
 
@@ -78,6 +122,21 @@ class Importmap::Commands < Thor
78
122
  with_lines_removed.each { |line| file.write(line) }
79
123
  end
80
124
  end
125
+
126
+ def puts_table(array)
127
+ column_sizes = array.reduce([]) do |lengths, row|
128
+ row.each_with_index.map{ |iterand, index| [lengths[index] || 0, iterand.to_s.length].max }
129
+ end
130
+
131
+ puts head = "+" + (column_sizes.map { |s| "-" * (s + 2) }.join('+')) + '+'
132
+ array.each_with_index do |row, row_number|
133
+ row = row.fill(nil, row.size..(column_sizes.size - 1))
134
+ row = row.each_with_index.map { |v, i| v.to_s + " " * (column_sizes[i] - v.to_s.length) }
135
+ puts "| " + row.join(" | ") + " |"
136
+ puts head if row_number == 0
137
+ end
138
+ puts head
139
+ end
81
140
  end
82
141
 
83
142
  Importmap::Commands.start(ARGV)
data/lib/importmap/map.rb CHANGED
@@ -7,6 +7,7 @@ class Importmap::Map
7
7
 
8
8
  def initialize
9
9
  @packages, @directories = {}, {}
10
+ @cache = {}
10
11
  end
11
12
 
12
13
  def draw(path = nil, &block)
@@ -87,24 +88,15 @@ class Importmap::Map
87
88
  MappedFile = Struct.new(:name, :path, :preload, keyword_init: true)
88
89
 
89
90
  def cache_as(name)
90
- if result = instance_variable_get("@cached_#{name}")
91
+ if result = @cache[name.to_s]
91
92
  result
92
93
  else
93
- remember_cache_key(name)
94
- instance_variable_set("@cached_#{name}", yield)
94
+ @cache[name.to_s] = yield
95
95
  end
96
96
  end
97
97
 
98
- def remember_cache_key(name)
99
- @cache_keys ||= Set.new
100
- @cache_keys.add name
101
- end
102
-
103
-
104
98
  def clear_cache
105
- @cache_keys&.each do |name|
106
- instance_variable_set("@cached_#{name}", nil)
107
- end
99
+ @cache.clear
108
100
  end
109
101
 
110
102
  def rescuable_asset_error?(error)
@@ -0,0 +1,120 @@
1
+ require "net/http"
2
+ require "uri"
3
+ require "json"
4
+
5
+ class Importmap::Npm
6
+ Error = Class.new(StandardError)
7
+ HTTPError = Class.new(Error)
8
+
9
+ singleton_class.attr_accessor :base_uri
10
+ self.base_uri = URI("https://registry.npmjs.org")
11
+
12
+ def initialize(importmap_path = "config/importmap.rb")
13
+ @importmap_path = Pathname.new(importmap_path)
14
+ end
15
+
16
+ def outdated_packages
17
+ packages_with_versions.each.with_object([]) do |(package, current_version), outdated_packages|
18
+ outdated_package = OutdatedPackage.new(name: package,
19
+ current_version: current_version)
20
+
21
+ if !(response = get_package(package))
22
+ outdated_package.error = 'Response error'
23
+ elsif (error = response['error'])
24
+ outdated_package.error = error
25
+ else
26
+ latest_version = find_latest_version(response)
27
+ next unless outdated?(current_version, latest_version)
28
+
29
+ outdated_package.latest_version = latest_version
30
+ end
31
+
32
+ outdated_packages << outdated_package
33
+ end.sort_by(&:name)
34
+ end
35
+
36
+ def vulnerable_packages
37
+ get_audit.flat_map do |package, vulnerabilities|
38
+ vulnerabilities.map do |vulnerability|
39
+ VulnerablePackage.new(name: package,
40
+ severity: vulnerability['severity'],
41
+ vulnerable_versions: vulnerability['vulnerable_versions'],
42
+ vulnerability: vulnerability['title'])
43
+ end
44
+ end.sort_by { |p| [p.name, p.severity] }
45
+ end
46
+
47
+ private
48
+ OutdatedPackage = Struct.new(:name, :current_version, :latest_version, :error, keyword_init: true)
49
+ VulnerablePackage = Struct.new(:name, :severity, :vulnerable_versions, :vulnerability, keyword_init: true)
50
+
51
+ def packages_with_versions
52
+ # We cannot use the name after "pin" because some dependencies are loaded from inside packages
53
+ # Eg. pin "buffer", to: "https://ga.jspm.io/npm:@jspm/core@2.0.0-beta.19/nodelibs/browser/buffer.js"
54
+
55
+ importmap.scan(/^pin .*(?<=npm:|npm\/|skypack\.dev\/|unpkg\.com\/)(.*)(?=@\d+\.\d+\.\d+)@(\d+\.\d+\.\d+(?:[^\/\s"]*)).*$/) |
56
+ importmap.scan(/^pin "([^"]*)".* #.*@(\d+\.\d+\.\d+(?:[^\s]*)).*$/)
57
+ end
58
+
59
+ def importmap
60
+ @importmap ||= File.read(@importmap_path)
61
+ end
62
+
63
+ def get_package(package)
64
+ uri = self.class.base_uri.dup
65
+ uri.path = "/" + package
66
+ response = get_json(uri)
67
+
68
+ JSON.parse(response)
69
+ rescue JSON::ParserError
70
+ nil
71
+ end
72
+
73
+ def get_json(uri)
74
+ request = Net::HTTP::Get.new(uri)
75
+ request["Content-Type"] = "application/json"
76
+
77
+ response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
78
+ http.request(request)
79
+ }
80
+
81
+ response.body
82
+ rescue => error
83
+ raise HTTPError, "Unexpected transport error (#{error.class}: #{error.message})"
84
+ end
85
+
86
+ def find_latest_version(response)
87
+ latest_version = response.dig('dist-tags', 'latest')
88
+ return latest_version if latest_version
89
+
90
+ return unless response['versions']
91
+
92
+ response['versions'].keys.map { |v| Gem::Version.new(v) rescue nil }.compact.sort.last
93
+ end
94
+
95
+ def outdated?(current_version, latest_version)
96
+ Gem::Version.new(current_version) < Gem::Version.new(latest_version)
97
+ rescue ArgumentError
98
+ current_version.to_s < latest_version.to_s
99
+ end
100
+
101
+ def get_audit
102
+ uri = self.class.base_uri.dup
103
+ uri.path = "/-/npm/v1/security/advisories/bulk"
104
+
105
+ body = packages_with_versions.each.with_object({}) { |(package, version), data|
106
+ data[package] ||= []
107
+ data[package] << version
108
+ }
109
+ return {} if body.empty?
110
+
111
+ response = post_json(uri, body)
112
+ JSON.parse(response.body)
113
+ end
114
+
115
+ def post_json(uri, body)
116
+ Net::HTTP.post(uri, body.to_json, "Content-Type" => "application/json")
117
+ rescue => error
118
+ raise HTTPError, "Unexpected transport error (#{error.class}: #{error.message})"
119
+ end
120
+ end
@@ -1,3 +1,3 @@
1
1
  module Importmap
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: importmap-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-19 00:00:00.000000000 Z
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -55,6 +55,7 @@ files:
55
55
  - lib/importmap/commands.rb
56
56
  - lib/importmap/engine.rb
57
57
  - lib/importmap/map.rb
58
+ - lib/importmap/npm.rb
58
59
  - lib/importmap/packager.rb
59
60
  - lib/importmap/reloader.rb
60
61
  - lib/importmap/version.rb
@@ -84,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
85
  - !ruby/object:Gem::Version
85
86
  version: '0'
86
87
  requirements: []
87
- rubygems_version: 3.2.32
88
+ rubygems_version: 3.3.14
88
89
  signing_key:
89
90
  specification_version: 4
90
91
  summary: Use ESM with importmap to manage modern JavaScript in Rails without transpiling