@postnord/web-components
Version:
PostNord Web Components
6 lines • 2.92 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 s=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(s)}const e=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const c={randomUUID:e};function u(n,o,s){if(c.randomUUID&&!o&&!n){return c.randomUUID()}n=n||{};const e=n.random??n.rng?.()??r();if(e.length<16){throw new Error("Random bytes length must be >= 16")}e[6]=e[6]&15|64;e[8]=e[8]&63|128;if(o){s=s||0;if(s<0||s+16>o.length){throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`)}for(let n=0;n<16;++n){o[s+n]=e[n]}return o}return t(e)}const a="SE";const i="DK";const f="FI";const d="NO";const p="sv";const w="en";const m="da";const y="fi";const l="no";const h=[a,i,f,d];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 s=(o[2]||"").toLocaleUpperCase();const r=parseInt(o[1]);if(s&&$[s]){const n=$[s];return r*n}return r}return 0};function D(){return window.innerWidth/16<55}const E=()=>u();function I(){return document?.querySelector("pn-topbar")?.offsetHeight||0}function U(){return D()?document?.querySelector("pn-side-menu")?.offsetHeight||0:0}function B(){const n=I()+U();return n>window.scrollY?n-window.scrollY:0}async function S(n){const t=()=>window.pnTopbar;function o(o){const s=o||t();n.market=s.market;n.language=s.language;if(s.hasLoaded){t().onChangeMarket=t=>n.market=t;t().onChangeLanguage=t=>n.language=t}return s}return await new Promise((s=>{if(!document.querySelector("pn-topbar"))return s(o({hasLoaded:false,market:n.market||a,language:n.language||w}));if(t()?.hasLoaded)return s(o());window.addEventListener("topbarLoaded",(()=>s(o())))}))}const v=(n,t,o)=>{const{left:s,top:r,width:e,height:c}=t.getBoundingClientRect();const{clientX:u=0,clientY:a=0}=n||{};const i=e>c?e:c;const f=document.createElement("div");f.classList.add("pn-ripple");f.style.height=`${i*2}px`;f.style.width=`${i*2}px`;f.style.left=u>0?`${u-s}px`:`50%`;f.style.top=a>0?`${a-r}px`:`50%`;if(o)t.querySelector(o).appendChild(f);else t.appendChild(f);setTimeout((()=>f.remove()),400)};export{i as D,f as F,d as N,a as S,g as a,I as b,U as c,m as d,w as e,y as f,x as g,B as h,D as i,S as j,b as l,h as m,l as n,v as r,p as s,E as u};
//# sourceMappingURL=p-c511b4fb.js.map