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