@microblink/blinkid-in-browser-sdk
Version:
A simple ID scanning library for WebAssembly-enabled browsers.
1 lines • 8.07 kB
JavaScript
let e,t,n=!1,l=!1;const s="undefined"!=typeof window?window:{},o=s.document||{head:{}},r={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),a=new WeakMap,u=e=>"sc-"+e.o,f={},d=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!d(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?p(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=p(e,null);return i.u=t,r.length>0&&(i.$=r),i},p=(e,t)=>({t:0,p:e,i:t,h:null,$:null,u:null}),h={},m=(e,t,n,l,o,c)=>{if(n!==l){let i=G(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,s=w(n),o=w(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const s=d(l);if((i||s&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&c||o)&&!s&&e.setAttribute(t,l=!0===l?"":l)}else t="-"===t[2]?t.slice(3):G(s,a)?a.slice(2):a[2]+t.slice(3),n&&r.rel(e,t,n,!1),l&&r.ael(e,t,l,!1)}},b=/\s/,w=e=>e?e.split(b):[],y=(e,t,n,l)=>{const s=11===t.h.nodeType&&t.h.host?t.h.host:t.h,o=e&&e.u||f,r=t.u||f;for(l in o)l in r||m(s,l,o[l],void 0,n,t.t);for(l in r)m(s,l,o[l],r[l],n,t.t)},g=(t,l,s)=>{let r,c,i=l.$[s],a=0;if(null!==i.i)r=i.h=o.createTextNode(i.i);else{if(n||(n="svg"===i.p),r=i.h=o.createElementNS(n?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.p),n&&"foreignObject"===i.p&&(n=!1),y(null,i,n),null!=e&&r["s-si"]!==e&&r.classList.add(r["s-si"]=e),i.$)for(a=0;a<i.$.length;++a)c=g(t,i,a),c&&r.appendChild(c);"svg"===i.p?n=!1:"foreignObject"===r.tagName&&(n=!0)}return r},j=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=g(null,l,o),c&&(s[o].h=c,i.insertBefore(c,n)))},v=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.h,k(l),s.remove())},O=(e,t)=>e.p===t.p,S=(e,t)=>{const l=t.h=e.h,s=e.$,o=t.$,r=t.p,c=t.i;null===c?(n="svg"===r||"foreignObject"!==r&&n,"slot"===r||y(e,t,n),null!==s&&null!==o?((e,t,n,l)=>{let s,o=0,r=0,c=t.length-1,i=t[0],a=t[c],u=l.length-1,f=l[0],d=l[u];for(;o<=c&&r<=u;)null==i?i=t[++o]:null==a?a=t[--c]:null==f?f=l[++r]:null==d?d=l[--u]:O(i,f)?(S(i,f),i=t[++o],f=l[++r]):O(a,d)?(S(a,d),a=t[--c],d=l[--u]):O(i,d)?(S(i,d),e.insertBefore(i.h,a.h.nextSibling),i=t[++o],d=l[--u]):O(a,f)?(S(a,f),e.insertBefore(a.h,i.h),a=t[--c],f=l[++r]):(s=g(t&&t[r],n,r),f=l[++r],s&&i.h.parentNode.insertBefore(s,i.h));o>c?j(e,null==l[u+1]?null:l[u+1].h,n,l,r,u):r>u&&v(t,o,c)})(l,s,t,o):null!==o?(null!==e.i&&(l.textContent=""),j(l,null,t,o,0,o.length-1)):null!==s&&v(s,0,s.length-1),n&&"svg"===r&&(n=!1)):e.i!==c&&(l.data=c)},k=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(k)},M=e=>_(e).m,C=(e,t,n)=>{const l=M(e);return{emit:e=>P(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},P=(e,t,n)=>{const l=r.ce(t,n);return e.dispatchEvent(l),l},x=(e,t)=>{t&&!e.g&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.g=t)))},R=(e,t)=>{if(e.t|=16,!(4&e.t))return x(e,e.j),le((()=>E(e,t)));e.t|=512},E=(e,t)=>{const n=e.v;let l;return l=L(l,(()=>H(n,"componentWillRender"))),L(l,(()=>T(e,n,t)))},T=async(n,l,s)=>{const r=n.m,c=r["s-rc"];s&&(e=>{const t=e.O,n=e.m,l=t.t,s=((e,t)=>{let n=u(t),l=Q.get(n);if(e=11===e.nodeType?e:o,l)if("string"==typeof l){let t,s=a.get(e=e.head||e);s||a.set(e,s=new Set),s.has(n)||(t=o.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),s&&s.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(n);((n,l)=>{const s=n.m,o=n.S||p(null,null),r=(e=>e&&e.p===h)(l)?l:$(null,null,l);t=s.tagName,r.p=null,r.t|=4,n.S=r,r.h=o.h=s.shadowRoot||s,e=s["s-sc"],S(o,r)})(n,W(n,l)),c&&(c.map((e=>e())),r["s-rc"]=void 0);{const e=r["s-p"],t=()=>A(n);0===e.length?t():(Promise.all(e).then(t),n.t|=4,e.length=0)}},W=(e,t)=>{try{t=t.render(),e.t&=-17,e.t|=2}catch(t){I(t,e.m)}return t},A=e=>{const t=e.m,n=e.j;H(e.v,"componentDidRender"),64&e.t||(e.t|=64,U(t),e.k(t),n||F()),e.M(t),e.g&&(e.g(),e.g=void 0),512&e.t&&ne((()=>R(e,!1))),e.t&=-517},F=()=>{U(o.documentElement),ne((()=>P(s,"appload",{detail:{namespace:"blinkid-in-browser"}})))},H=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){I(e)}},L=(e,t)=>e&&e.then?e.then(t):t(),U=e=>e.classList.add("hydrated"),q=(e,t,n)=>{if(t.C){e.watchers&&(t.P=e.watchers);const l=Object.entries(t.C),s=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(s,e,{get(){return((e,t)=>_(this).R.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=_(e),o=s.m,r=s.R.get(t),c=s.t,i=s.v;if(n=((e,t)=>null==e||d(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.C[t][0]),!(8&c&&void 0!==r||n===r)&&(s.R.set(t,n),i)){if(l.P&&128&c){const e=l.P[t];e&&e.map((e=>{try{i[e](n,r,t)}catch(e){I(e,o)}}))}2==(18&c)&&R(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(s,e,{value(...t){const n=_(this);return n.T.then((()=>n.v[e](...t)))}})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){r.jmp((()=>{const n=t.get(e);this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},D=e=>{H(e,"connectedCallback")},N=(e,t={})=>{const n=[],l=t.exclude||[],c=s.customElements,a=o.head,f=a.querySelector("meta[charset]"),d=o.createElement("style"),$=[];let p,h=!0;Object.assign(r,t),r.l=new URL(t.resourcesUrl||"./",o.baseURI).href,e.map((e=>e[1].map((t=>{const s={t:t[0],o:t[1],C:t[2],W:t[3]};s.C=t[2],s.P={};const o=s.o,a=class extends HTMLElement{constructor(e){super(e),B(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){p&&(clearTimeout(p),p=null),h?$.push(this):r.jmp((()=>(e=>{if(0==(1&r.t)){const t=_(e),n=t.O,l=()=>{};if(1&t.t)D(t.v);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){x(t,t.j=n);break}}n.C&&Object.entries(n.C).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=K(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.P=s.watchers,q(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){I(e)}t.t&=-9,t.t|=128,e(),D(t.v)}if(s.style){let e=s.style;const t=u(n);if(!Q.has(t)){const l=()=>{};((e,t,n)=>{let l=Q.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Q.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.j,r=()=>R(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){r.jmp((()=>{}))}componentOnReady(){return _(this).A}};s.F=e[0],l.includes(o)||c.get(o)||(n.push(o),c.define(o,q(a,s,1)))})))),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),a.insertBefore(d,f?f.nextSibling:a.firstChild),h=!1,$.length?$.map((e=>e.connectedCallback())):r.jmp((()=>p=setTimeout(F,30)))},V=new WeakMap,_=e=>V.get(e),z=(e,t)=>V.set(t.v=e,t),B=(e,t)=>{const n={t:0,m:e,O:t,R:new Map};return n.T=new Promise((e=>n.M=e)),n.A=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],V.set(e,n)},G=(e,t)=>t in e,I=(e,t)=>(0,console.error)(e,t),J=new Map,K=e=>{const t=e.o.replace(/-/g,"_"),n=e.F,l=J.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(J.set(n,e),e[t])),I)},Q=new Map,X=[],Y=[],Z=(e,t)=>n=>{e.push(n),l||(l=!0,t&&4&r.t?ne(te):r.raf(te))},ee=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){I(e)}e.length=0},te=()=>{ee(X),ee(Y),(l=X.length>0)&&r.raf(te)},ne=e=>c().then(e),le=Z(Y,!0);export{h as H,N as b,C as c,M as g,$ as h,c as p,z as r}