UNPKG

sth-qrcode

Version:

A web component to generate QR codes for SmartHoldem payments.

5 lines 13.1 kB
/*! Built with http://stenciljs.com */ (function(Context,appNamespace,hydratedCssClass,publicPath){"use strict"; var s=document.querySelector("script[data-namespace='sthqrcode']");if(s){publicPath=s.getAttribute('data-path');} (function(n,t,e,o,i){"use strict";function c(n,t,e,o,i){let c=t.is+(e||""),r=t[c];if(r||(r=t[c=t.is]),r){let e=n.n;if(n.t)if("shadow"===t.e)e=o.shadowRoot;else for(;o=n.o(o);)if(o.host&&o.host.shadowRoot){e=o.host.shadowRoot;break}const f=e.i=e.i||{};if(!f[c]){i=r.content.cloneNode(!0);const t=e.querySelector("[data-visibility]");n.c(e,i,t&&t.nextSibling||e.r),f[c]=!0}}}function r(n){return{f:n[0],l:n[1],u:!!n[2],s:!!n[3],a:!!n[4]}}function f(n,t){if(S(t)){if(n===Boolean||3===n)return"false"!==t&&(""===t||!!t);if(n===Number||4===n)return parseFloat(t)}return t}function l(n,t,e){n.d&&((e=n.d.$activeLoading)&&((t=e.indexOf(n))>-1&&e.splice(t,1),!e.length&&n.d.$initLoad()),n.d=null)}function u(n,t,e){for(var o,i=!1,c=!1,r=arguments.length;r-- >2;)L.push(arguments[r]);for(;L.length;)if((e=L.pop())&&void 0!==e.pop)for(r=e.length;r--;)L.push(e[r]);else"boolean"==typeof e&&(e=null),(c="function"!=typeof n)&&(null==e?e="":"number"==typeof e?e=String(e):"string"!=typeof e&&(c=!1)),c&&i?o[o.length-1].p+=e:void 0===o?o=[c?s(e):e]:o.push(c?s(e):e),i=c;const f=new B;if(f.m=n,f.v=o,t&&(f.b=t,f.y=t.g,f.w=t.ref,t.className&&(t.class=t.className),"object"==typeof t.class)){for(r in t.class)t.class[r]&&L.push(r);t.class=L.join(" "),L.length=0}return f}function s(n){const t=new B;return t.p=n,t}function a(n,t){t.C||(t.C=!0,n.N.add(()=>{t.C=!1,d(n,t)}))}function d(n,t){if(!t.j){const e=!t.O;if(e){const e=t.d;if(e&&!e.$rendered)return void(e.$onRender=e.$onRender||[]).push(()=>{d(n,t)});(function e(n,t,o){try{o=n.x(t).k,t.O=new o,function i(n,t,e,o,c,r){o.S=e,e.T=e.T||{},c=Object.assign({mode:{type:String},color:{type:String}},t.properties);for(r in c)m(n,c[r],e,o,r)}(n,o,t,t.O)}catch(e){t.O={},n.A(e,7,t,!0)}})(n,t)}p(n,t,e)}}function p(n,t,e){try{(function o(n,t,e,i){const c=t.O,r=e.host;if(c.render||c.hostData||r){n.M=!0;const o=c.render&&c.render();n.M=!1;const r=t.P||new B;r.B=t,t.P=n.render(r,u(null,void 0,o),i,t.L,e.e)}n.R(n.q,e,c.mode,t),t.$rendered=!0,t.$onRender&&(t.$onRender.forEach(n=>n()),t.$onRender=null)})(n,t,n.x(t).k,!e)}catch(e){n.A(e,8,t,!0)}try{e?t.$initLoad():t.O.componentDidUpdate&&t.O.componentDidUpdate()}catch(e){n.A(e,6,t,!0)}}function m(n,t,e,o,i){function c(n){return(n=this.S)&&n.T&&n.T[i]}function r(e,o){(o=this.S)&&(t.state||t.mutable)&&v(n,o,i,e)}if(t.type||t.state){if(!t.state){if(t.attr&&(void 0===e.T[i]||""===e.T[i])){const o=n.q.D(e,t.attr);null!=o&&(e.T[i]=f(t.type,o))}e.hasOwnProperty(i)&&(void 0===e.T[i]&&(e.T[i]=e[i]),delete e[i])}o.hasOwnProperty(i)&&void 0===e.T[i]&&(e.T[i]=o[i]),t.watchCallbacks&&(e.T[R+i]=t.watchCallbacks.slice()),b(o,i,c,r)}else t.elementRef?h(o,i,e):t.method&&h(e,i,o[i].bind(o))}function v(n,t,e,o,i,c,r){const f=(i=t.T=t.T||{})[e];if(o!==f&&(i[e]=o,c=t.O)){if(r=i[R+e])for(let n=0;n<r.length;n++)try{c[r[n]].call(c,o,f)}catch(n){}n.M||a(n,t)}}function h(n,t,e){Object.defineProperty(n,t,{configurable:!0,value:e})}function b(n,t,e,o){Object.defineProperty(n,t,{configurable:!0,get:e,set:o})}function y(n,t,e,o,i){const c=11===e.B.nodeType&&e.B.host?e.B.host:e.B,r=t&&t.b||E,f=e.b||E;for(i in r)f&&null!=f[i]||null==r[i]||g(n,c,i,r[i],void 0,o);for(i in f)i in r&&f[i]===("value"===i||"checked"===i?c[i]:r[i])||g(n,c,i,r[i],f[i],o)}function g(n,t,e,o,i,c,r,f){if("class"!==e||c)if("style"===e){o=o||E,i=i||E;for(r in o)i[r]||(t.style[r]="");for(r in i)i[r]!==o[r]&&(t.style[r]=i[r])}else if("o"!==e[0]||"n"!==e[1]||e in t)if("list"!==e&&"type"!==e&&!c&&(e in t||-1!==["object","function"].indexOf(typeof i)&&null!==i)){const o=n.x(t);o&&o.H&&o.H[e]?w(t,e,i):"ref"!==e&&(w(t,e,null==i?"":i),null!=i&&!1!==i||t.removeAttribute(e))}else null!=i&&(r=e!==(e=e.replace(/^xlink\:?/,"")),1!==q[e]||i&&"false"!==i?"function"!=typeof i&&(r?t.setAttributeNS(D,A(e),i):t.setAttribute(e,i)):r?t.removeAttributeNS(D,A(e)):t.removeAttribute(e));else e=A(e.substring(2)),i?o||n.q.z(t,e,i):n.q.F(t,e);else if(o!==i){const n=null==o||""===o?k:o.trim().split(/\s+/),e=null==i||""===i?k:i.trim().split(/\s+/);let c=null==t.className||""===t.className?k:t.className.trim().split(/\s+/);for(r=0,f=n.length;r<f;r++)-1===e.indexOf(n[r])&&(c=c.filter(t=>t!==n[r]));for(r=0,f=e.length;r<f;r++)-1===n.indexOf(e[r])&&(c=[...c,e[r]]);t.className=c.join(" ")}}function w(n,t,e){try{n[t]=e}catch(n){}}function $(n,t){n&&(n.w&&n.w(t?null:n.B),n.v&&n.v.forEach(n=>{$(n,t)}))}function C(n,t,e,o,i){var c,r,f,l,u=n.I(t);if(i&&1===u){(r=n.D(t,O))&&(f=r.split("."))[0]===o&&((l=new B).m=n.W(l.B=t),e.v||(e.v=[]),e.v[f[1]]=l,e=l,i=""!==f[2]);for(var a=0;a<t.childNodes.length;a++)C(n,t.childNodes[a],e,o,i)}else 3===u&&(c=t.previousSibling)&&8===n.I(c)&&"s"===(f=n.Z(c).split("."))[0]&&f[1]===o&&((l=s(n.Z(t))).B=t,e.v||(e.v=[]),e.v[f[2]]=l)}function N(n,t,e,o){return function(){const i=arguments;return function c(n,t,e){return new Promise(o=>{let i=t[e];i||(i=n.G.querySelector(e)),i||(i=t[e]=n.J(e),n.K(n.G,i)),i.componentOnReady(o)})}(n,t,e).then(n=>n[o].apply(n,i))}}const j="data-ssrv",O="data-ssrc",E={},k=[],x={enter:13,escape:27,space:32,tab:9,left:37,up:38,right:39,down:40},S=n=>void 0!==n&&null!==n,T=n=>void 0===n||null===n,A=n=>n.toLowerCase(),M=n=>A(n.replace(/([A-Z])/g,n=>" "+n[0]).trim().replace(/ /g,"-")),P=()=>{};class B{}const L=[],R="wc-",q={allowfullscreen:1,async:1,autofocus:1,autoplay:1,checked:1,controls:1,disabled:1,enabled:1,formnovalidate:1,hidden:1,multiple:1,noresize:1,readonly:1,required:1,selected:1,spellcheck:1},D="http://www.w3.org/1999/xlink";let H=!1;const z=n[o]=n[o]||{};{const o=function F(t,e,o,i,s,d){const p={html:{}},m={},g=function w(n,t){const e=new WeakMap,o={Q:t.documentElement,n:t.head,G:t.body,U:!1,I:n=>n.nodeType,J:n=>t.createElement(n),V:(n,e)=>t.createElementNS(n,e),X:n=>t.createTextNode(n),Y:n=>t.createComment(n),c:(n,t,e)=>n.insertBefore(t,e),_:(n,t)=>n.removeChild(t),K:(n,t)=>n.appendChild(t),nn:n=>n.childNodes,o:n=>n.parentNode,tn:n=>n.nextSibling,W:n=>A(n.tagName),Z:n=>n.textContent,en:(n,t)=>n.textContent=t,D:(n,t)=>n.getAttribute(t),on:(n,t,e)=>n.setAttribute(t,e),in:(n,t,e,o)=>n.setAttributeNS(t,e,o),cn:(n,t)=>n.removeAttribute(t),rn:(e,i)=>"child"===i?e.firstElementChild:"parent"===i?o.fn(e):"body"===i?o.G:"document"===i?t:"window"===i?n:e,z:(n,t,i,c,r,f,l,u)=>{const s=t;let a=n,d=e.get(n);if(d&&d[s]&&d[s](),"string"==typeof f?a=o.rn(n,f):"object"==typeof f?a=f:(u=t.split(":")).length>1&&(a=o.rn(n,u[0]),t=u[1]),!a)return;let p=i;(u=t.split(".")).length>1&&(t=u[0],p=(n=>{n.keyCode===x[u[1]]&&i(n)})),l=o.U?{capture:!!c,passive:!!r}:!!c,a.addEventListener(t,p,l),d||e.set(n,d={}),d[s]=(()=>{a&&a.removeEventListener(t,p,l),d[s]=null})},F:(n,t)=>{const o=e.get(n);o&&(t?o[t]&&o[t]():(Object.keys(o).forEach(n=>{o[n]&&o[n]()}),e.delete(n)))}};return o.ln=((n,t)=>n.attachShadow(t)),o.t=!!o.Q.attachShadow,o.fn=((n,t)=>(t=o.o(n))&&11===o.I(t)?t.host:t),o}(o,i);t.isServer=t.isPrerender=!(t.isClient=!0),t.window=o,t.location=o.location,t.document=i,t.publicPath=s,e.h=u,e.Context=t;const O=o.$definedCmps=o.$definedCmps||{},E={un:function k(n,e){e.mode||(e.mode=g.D(e,"mode")||t.mode),g.D(e,j)||function o(n,t){return n&&1===t.e}(g.t,n)||function i(n,t,e){t.$defaultHolder||n.c(t,t.$defaultHolder=n.Y(""),e[0]);let o,i,c,r=0;for(;r<e.length;r++){var f=e[r];1===n.I(f)&&null!=(o=n.D(f,"slot"))?(c=c||{})[o]?c[o].push(f):c[o]=[f]:i?i.push(f):i=[f]}t.L={sn:i,an:c}}(g,e,e.childNodes),g.t||1!==n.e||(e.shadowRoot=e)},q:g,dn:function L(n,t){if(!O[n.pn]){O[n.pn]=!0,function e(n,t,o,i){o.connectedCallback=function(){(function e(n,t,o){o.$connected||(o.$connected=!0,o.j=null,function i(n,t,e){for(e=t;e=n.q.fn(e);)if(n.mn(e)){e.vn||(t.d=e,(e.$activeLoading=e.$activeLoading||[]).push(t));break}}(n,o),n.N.add(()=>{n.un(t,o),n.hn(t,o.mode,()=>a(n,o))},3))})(n,t,this)},o.attributeChangedCallback=function(n,e,o){(function i(n,t,e,o,c,r){if(o!==c&&n){e=A(e);for(r in n)if(n[r].bn===e){t[r]=f(n[r].yn,c);break}}})(t.H,this,n,e,o)},o.disconnectedCallback=function(){(function t(n,e){!n.gn&&function o(n,t){for(;t;){if(!n.o(t))return 9!==n.I(t);t=n.o(t)}}(n.q,e)&&(e.j=!0,l(e),$(e.P,!0),n.q.F(e),e.L&&(e.L=e.L.sn=e.L.an=null),e.O&&(e.O=e.O.S=null),e.$activeLoading=e.$connected=e.$defaultHolder=e.wn=e.T=e.P=e.d=e.vn=e.C=e.$n=null)})(n,this)},o.componentOnReady=function(n,t){return n||(t=new Promise(t=>n=t)),function e(n,t){n.j||(n.vn?t(n):(n.Cn=n.Cn||[]).push(t))}(this,n),t},o.$initLoad=function(){(function t(n,e,o){if(e.O&&!e.j&&(!e.$activeLoading||!e.$activeLoading.length)){e.$activeLoading=null,e.vn=!0;try{$(e.P),e.Cn&&(e.Cn.forEach(n=>n(e)),e.Cn=null),e.O.componentDidLoad&&e.O.componentDidLoad()}catch(t){n.A(t,4,e)}e.classList.add(o),l(e)}})(n,this,i)},o.Nn=function(){a(n,this)},function c(n,t,e){t&&Object.keys(t).forEach(o=>{const i=t[o].jn;1===i||2===i?b(e,o,function n(){return(this.T=this.T||{})[o]},function t(e){v(n,this,o,e)}):6===i&&h(e,o,P)})}(n,t.H,o)}(E,n,t.prototype,d);{const e=[];for(var i in n.H)n.H[i].bn&&e.push(n.H[i].bn),t.observedAttributes=e}o.customElements.define(n.pn,t)}},On:t.emit,x:n=>p[g.W(n)],En:n=>t[n],isClient:!0,mn:n=>!(!O[g.W(n)]&&!E.x(n)),hn:function R(n,t,e){if(n.k)e();else{const o=n.kn[t]||n.kn,c=s+o+(function o(n,t){return 2===t.e||1===t.e&&!n}(g.t,n)?".sc":"")+".js";import(c).then(t=>{try{n.k||(n.k=t[(i=n.pn,A(i).split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(""))]),function o(n,t){const e=t.style;if(e){const o=t.is+(t.styleMode||"");if(!t[o]){const i=n.J("template");t[o]=i,i.innerHTML="<style>"+e+"</style>",n.K(n.n,i)}}}(g,n.k)}catch(t){n.k=class{}}e()}).catch(n=>void 0)}var i},A:(n,t,e)=>void 0,xn:n=>(function t(n,e,o){return{create:N(n,e,o,"create"),componentOnReady:N(n,e,o,"componentOnReady")}})(g,m,n),N:function q(t,e,o){function i(){for(;s.length>0;)s.shift()();e=!1}function c(n){for(n=f(),i();a.length>0&&f()-n<40;)a.shift()();(o=a.length>0)&&l(r)}function r(n){for(i(),n=4+f();a.length>0&&f()<n;)a.shift()();(o=a.length>0)&&l(c)}const f=()=>t.performance.now(),l=t=>n.requestAnimationFrame(t),u=Promise.resolve(),s=[],a=[];return{add:(n,t)=>{3===t?(s.push(n),e||(e=!0,u.then(i))):(a.push(n),o||(o=!0,l(c)))}}}(o),Sn:n=>(n||[]).map(n=>(function t(n,e,o){const i={pn:n[0],H:{color:{bn:"color"}}};i.kn=n[1];const c=n[3];if(c)for(var f=0;f<c.length;f++){var l=c[f];i.H[l[0]]={jn:l[1],bn:l[2]?1===o?A(l[0]):M(l[0]):0,yn:l[3]}}return i.e=n[4],n[5]&&(i.Tn=n[5].map(r)),e[i.pn]=i})(n,p))};E.render=function D(n,t){function e(o,i,c){let r=0;if("function"==typeof o.m&&(o=o.m(Object.assign({},o.b,{An:o.v}))),!s&&"slot"===o.m){if(u){a&&t.on(i,a+"-slot","");let e,c=o.b&&o.b.name;if(e=S(c)?u.an&&u.an[c]:u.sn,S(e)){for(n.gn=!0;r<e.length;r++)t.K(i,t._(t.o(e[r]),e[r]));n.gn=!1}}return null}if(S(o.p))o.B=t.X(o.p);else{const i=o.B=H||"svg"===o.m?t.V("http://www.w3.org/2000/svg",o.m):t.J(o.m);H="svg"===o.m||"foreignObject"!==o.m&&H,y(n,null,o,H),null!==a&&i.Mn!==a&&t.on(i,i.Mn=a,"");const c=o.v;if(c){let n;for(;r<c.length;++r)(n=e(c[r],i))&&t.K(i,n)}}return o.B}function o(n,o,i,c,r){const f=n.$defaultHolder&&t.o(n.$defaultHolder)||n;let l;for(;c<=r;++c){var u=i[c];S(u)&&(l=S(u.p)?t.X(u.p):e(u,n),S(l)&&(u.B=l,t.c(f,l,o)))}}function i(n,e,o,i){for(;o<=i;++o)S(e[o])&&t._(n,e[o].B)}function c(n,t){return n.m===t.m&&n.y===t.y}function r(n,t,e){let o,i,c,r={};for(o=t;o<=e;++o)null!=(c=n[o])&&void 0!==(i=c.y)&&(r.Pn=o);return r}function f(l,u){const s=u.B=l.B,a=l.v,d=u.v;if(H=u.B&&null!=u.B.parentElement&&void 0!==u.B.Bn,H="svg"===u.m||"foreignObject"!==u.m&&H,T(u.p))"slot"!==u.m&&y(n,l,u,H),S(a)&&S(d)?function p(n,l,u){let s,a,d,p,m=0,v=0,h=l.length-1,b=l[0],y=l[h],g=u.length-1,w=u[0],$=u[g];for(;m<=h&&v<=g;)null==b?b=l[++m]:null==y?y=l[--h]:null==w?w=u[++v]:null==$?$=u[--g]:c(b,w)?(f(b,w),b=l[++m],w=u[++v]):c(y,$)?(f(y,$),y=l[--h],$=u[--g]):c(b,$)?(f(b,$),t.c(n,b.B,t.tn(y.B)),b=l[++m],$=u[--g]):c(y,w)?(f(y,w),t.c(n,y.B,b.B),y=l[--h],w=u[++v]):(T(s)&&(s=r(l,m,h)),a=s[w.y],T(a)?(p=e(w,n),w=u[++v]):((d=l[a]).m!==w.m?p=e(w,n):(f(d,w),l[a]=void 0,p=d.B),w=u[++v]),p&&t.c(n,p,b.B));m>h?o(n,null==u[g+1]?null:u[g+1].B,u,v,g):v>g&&i(n,l,m,h)}(s,a,d):S(d)?(S(l.p)&&t.en(s,""),o(s,null,d,0,d.length-1)):S(a)&&i(s,a,0,a.length-1);else if(s.L&&s.L.sn){let n=s.L.sn[0].parentElement;t.en(n,u.p),s.L.sn=[n.childNodes[0]]}else l.p!==u.p&&t.en(s,u.p)}let l,u,s,a;return function n(e,o,i,c,r,d){return l=i,u=c,a="scoped"===r||"shadow"===r&&!t.t?"data-"+t.W(e.B):null,s="shadow"===r&&t.t,l||(s?e.B=t.ln(e.B,{mode:"open"}):a&&t.on(e.B,a+"-host","")),f(e,o),o}}(E,g);const z=g.Q;return z.$rendered=!0,z.$activeLoading=[],z.$initLoad=(()=>z.vn=!0),function F(n,t){var e,o,i,c,r,f,l=t.querySelectorAll(`[${j}]`),u=l.length;if(t.vn=u>0)for(c=0;c<u;c++)for(e=l[c],o=n.D(e,j),(i=e.P=new B).m=n.W(i.B=e),r=0,f=e.childNodes.length;r<f;r++)C(n,e.childNodes[r],i,o,!0)}(g,z),E.R=c,E}(e,z,n,t,i,hydratedCssClass);o.Sn(z.components).forEach(n=>o.dn(n,class extends HTMLElement{}))}})(window,document,Context,appNamespace,publicPath); })({},"sthqrcode","hydrated","/build/sthqrcode/");