@postnord/web-components
Version:
PostNord Web Components
6 lines • 3.12 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
const n=[];for(let t=0;t<256;++t){n.push((t+256).toString(16).slice(1))}function t(t,o=0){return(n[t[o+0]]+n[t[o+1]]+n[t[o+2]]+n[t[o+3]]+"-"+n[t[o+4]]+n[t[o+5]]+"-"+n[t[o+6]]+n[t[o+7]]+"-"+n[t[o+8]]+n[t[o+9]]+"-"+n[t[o+10]]+n[t[o+11]]+n[t[o+12]]+n[t[o+13]]+n[t[o+14]]+n[t[o+15]]).toLowerCase()}let o;const e=new Uint8Array(16);function r(){if(!o){if(typeof crypto==="undefined"||!crypto.getRandomValues){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}o=crypto.getRandomValues.bind(crypto)}return o(e)}const s=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const c={randomUUID:s};function u(n,o,e){if(c.randomUUID&&!o&&!n){return c.randomUUID()}n=n||{};const s=n.random??n.rng?.()??r();if(s.length<16){throw new Error("Random bytes length must be >= 16")}s[6]=s[6]&15|64;s[8]=s[8]&63|128;if(o){e=e||0;if(e<0||e+16>o.length){throw new RangeError(`UUID byte range ${e}:${e+15} is out of buffer bounds`)}for(let n=0;n<16;++n){o[e+n]=s[n]}return o}return t(s)}const i="SE";const a="DK";const d="FI";const f="NO";const p="sv";const w="en";const m="da";const y="fi";const l="no";const h=[i,a,d,f];const b=[p,w,m,y,l];const g={SE:[p,w],DK:[m,w],FI:[y,p,w],NO:[l,w]};const $={KB:1024,MB:1024*1024,GB:1024*1024,TB:1024*1024*1024};const x=function(n){const t=/(\d+\.?\d*)\s?([a-zA-Z]{2})?$/;if(t.test(n)){const o=n.match(t);const e=(o[2]||"").toLocaleUpperCase();const r=parseInt(o[1]);if(e&&$[e]){const n=$[e];return r*n}return r}return 0};function D(){return window.innerWidth/16<55}function E(){const{matches:n}=window.matchMedia("(prefers-reduced-motion: reduce)");return n}const I=()=>u();function U(){return document?.querySelector("pn-topbar")?.offsetHeight||0}function B(){return D()?document?.querySelector("pn-side-menu")?.offsetHeight||0:0}function S(){return D()?0:document?.querySelector("pn-side-menu")?.offsetWidth||0}function v(){const n=U()+B();return n>window.scrollY?n-window.scrollY:0}async function F(n){const t=()=>window.pnTopbar;function o(o){const e=o||t();n.market=e.market;n.language=e.language;if(e.hasLoaded){t().onChangeMarket=t=>n.market=t;t().onChangeLanguage=t=>n.language=t}return e}return await new Promise((e=>{if(!document.querySelector("pn-topbar"))return e(o({hasLoaded:false,market:n.market||i,language:n.language||w}));if(t()?.hasLoaded)return e(o());window.addEventListener("topbarLoaded",(()=>e(o())))}))}const K=(n,t,o)=>{if(E())return;const{left:e,top:r,width:s,height:c}=t.getBoundingClientRect();const{clientX:u=0,clientY:i=0}=n||{};const a=s>c?s:c;const d=document.createElement("div");d.classList.add("pn-ripple");d.style.height=`${a*2}px`;d.style.width=`${a*2}px`;d.style.left=u>0?`${u-e}px`:`50%`;d.style.top=i>0?`${i-r}px`:`50%`;if(o)t.querySelector(o).appendChild(d);else t.appendChild(d);setTimeout((()=>d.remove()),400)};export{a as D,d as F,f as N,i as S,g as a,U as b,B as c,m as d,w as e,y as f,x as g,S as h,D as i,v as j,F as k,b as l,h as m,l as n,K as o,E as r,p as s,I as u};
//# sourceMappingURL=p-f64d17a6.js.map