UNPKG

@humanmark/sdk-js

Version:

Browser-native JavaScript SDK for Humanmark human verification challenges

2 lines 73.4 kB
!function(){"use strict";try{if("undefined"!=typeof document){var a=document.createElement("style");a.appendChild(document.createTextNode('.humanmark-modal-overlay{--humanmark-sdk-primary-50: #f0edff;--humanmark-sdk-primary-400: #9580ff;--humanmark-sdk-primary-500: #7c63ff;--humanmark-sdk-primary-600: #6b52e5;--humanmark-sdk-primary-700: #5a42c7;--humanmark-sdk-gray-50: #f7f6f9;--humanmark-sdk-gray-200: #e5e2f0;--humanmark-sdk-gray-300: #d0cce0;--humanmark-sdk-gray-400: #a8a3b8;--humanmark-sdk-gray-500: #807a90;--humanmark-sdk-gray-600: #6b6575;--humanmark-sdk-gray-700: #4d4a58;--humanmark-sdk-gray-800: #3d3a48;--humanmark-sdk-gray-900: #322f3d;--humanmark-sdk-gray-950: #282533;--humanmark-sdk-gray-1000: #1c1a26;--humanmark-sdk-success-400: #4ade80;--humanmark-sdk-error-400: #ff6b6b;--humanmark-sdk-white: #ffffff;--humanmark-sdk-transparent: transparent;--humanmark-sdk-primary-alpha-10: rgba(124, 99, 255, .1);--humanmark-sdk-primary-alpha-20: rgba(124, 99, 255, .2);--humanmark-sdk-white-alpha-10: rgba(255, 255, 255, .1);--humanmark-sdk-white-alpha-20: rgba(255, 255, 255, .2);--humanmark-sdk-black-alpha-5: rgba(0, 0, 0, .05);--humanmark-sdk-black-alpha-10: rgba(0, 0, 0, .1);--humanmark-sdk-black-alpha-50: rgba(0, 0, 0, .5);--humanmark-sdk-focus-ring-primary: rgba(124, 99, 255, .4);--humanmark-sdk-shadow-xl: 0 12px 24px rgba(0, 0, 0, .4);--humanmark-sdk-shadow-primary: 0 4px 16px rgba(124, 99, 255, .3);--humanmark-sdk-shadow-success: 0 4px 16px rgba(74, 222, 128, .3)}.humanmark-modal-overlay,:root[data-hm-theme=dark] .humanmark-modal-overlay,:root[data-hm-theme=auto] .humanmark-modal-overlay{--humanmark-sdk-bg-primary: var(--humanmark-sdk-gray-1000);--humanmark-sdk-bg-secondary: var(--humanmark-sdk-gray-950);--humanmark-sdk-bg-elevated: var(--humanmark-sdk-gray-900);--humanmark-sdk-surface-0: var(--humanmark-sdk-gray-1000);--humanmark-sdk-surface-1: var(--humanmark-sdk-gray-950);--humanmark-sdk-surface-2: var(--humanmark-sdk-gray-900);--humanmark-sdk-surface-3: var(--humanmark-sdk-gray-800);--humanmark-sdk-text-primary: var(--humanmark-sdk-white);--humanmark-sdk-text-secondary: var(--humanmark-sdk-gray-200);--humanmark-sdk-text-tertiary: var(--humanmark-sdk-gray-400);--humanmark-sdk-text-disabled: var(--humanmark-sdk-gray-600);--humanmark-sdk-border-default: var(--humanmark-sdk-gray-800);--humanmark-sdk-border-hover: var(--humanmark-sdk-gray-700);--humanmark-sdk-border-subtle: var(--humanmark-sdk-primary-alpha-20);--humanmark-sdk-modal-bg: var(--humanmark-sdk-surface-2);--humanmark-sdk-modal-overlay: var(--humanmark-sdk-black-alpha-50);--humanmark-sdk-qr-container-bg: var(--humanmark-sdk-surface-1);--humanmark-sdk-progress-track: var(--humanmark-sdk-surface-3);--humanmark-sdk-progress-fill: linear-gradient( 135deg, var(--humanmark-sdk-primary-500) 0%, var(--humanmark-sdk-primary-400) 100% );--humanmark-sdk-overlay-light: var(--humanmark-sdk-white-alpha-10);--humanmark-sdk-overlay-medium: var(--humanmark-sdk-white-alpha-20)}:root[data-hm-theme=light] .humanmark-modal-overlay{--humanmark-sdk-bg-primary: var(--humanmark-sdk-white);--humanmark-sdk-bg-secondary: var(--humanmark-sdk-gray-50);--humanmark-sdk-bg-elevated: var(--humanmark-sdk-white);--humanmark-sdk-surface-0: var(--humanmark-sdk-white);--humanmark-sdk-surface-1: var(--humanmark-sdk-white);--humanmark-sdk-surface-2: var(--humanmark-sdk-gray-50);--humanmark-sdk-surface-3: var(--humanmark-sdk-primary-50);--humanmark-sdk-text-primary: var(--humanmark-sdk-gray-1000);--humanmark-sdk-text-secondary: var(--humanmark-sdk-gray-700);--humanmark-sdk-text-tertiary: var(--humanmark-sdk-gray-500);--humanmark-sdk-text-disabled: var(--humanmark-sdk-gray-400);--humanmark-sdk-border-default: var(--humanmark-sdk-gray-200);--humanmark-sdk-border-hover: var(--humanmark-sdk-gray-300);--humanmark-sdk-border-subtle: var(--humanmark-sdk-primary-alpha-10);--humanmark-sdk-modal-bg: var(--humanmark-sdk-white);--humanmark-sdk-modal-overlay: rgba(0, 0, 0, .32);--humanmark-sdk-qr-container-bg: var(--humanmark-sdk-gray-50);--humanmark-sdk-progress-track: var(--humanmark-sdk-gray-200);--humanmark-sdk-progress-fill: linear-gradient( 135deg, var(--humanmark-sdk-primary-500) 0%, var(--humanmark-sdk-primary-400) 100% );--humanmark-sdk-overlay-light: var(--humanmark-sdk-black-alpha-5);--humanmark-sdk-overlay-medium: var(--humanmark-sdk-black-alpha-10);--humanmark-sdk-shadow-xl: 0 12px 24px rgba(0, 0, 0, .12)}@media (prefers-color-scheme: light){:root[data-hm-theme=auto] .humanmark-modal-overlay{--humanmark-sdk-bg-primary: var(--humanmark-sdk-white);--humanmark-sdk-bg-secondary: var(--humanmark-sdk-gray-50);--humanmark-sdk-bg-elevated: var(--humanmark-sdk-white);--humanmark-sdk-surface-0: var(--humanmark-sdk-white);--humanmark-sdk-surface-1: var(--humanmark-sdk-white);--humanmark-sdk-surface-2: var(--humanmark-sdk-gray-50);--humanmark-sdk-surface-3: var(--humanmark-sdk-primary-50);--humanmark-sdk-text-primary: var(--humanmark-sdk-gray-1000);--humanmark-sdk-text-secondary: var(--humanmark-sdk-gray-700);--humanmark-sdk-text-tertiary: var(--humanmark-sdk-gray-500);--humanmark-sdk-text-disabled: var(--humanmark-sdk-gray-400);--humanmark-sdk-border-default: var(--humanmark-sdk-gray-200);--humanmark-sdk-border-hover: var(--humanmark-sdk-gray-300);--humanmark-sdk-border-subtle: var(--humanmark-sdk-primary-alpha-10);--humanmark-sdk-modal-bg: var(--humanmark-sdk-white);--humanmark-sdk-modal-overlay: rgba(0, 0, 0, .32);--humanmark-sdk-qr-container-bg: var(--humanmark-sdk-gray-50);--humanmark-sdk-progress-track: var(--humanmark-sdk-gray-200);--humanmark-sdk-progress-fill: linear-gradient( 135deg, var(--humanmark-sdk-primary-500) 0%, var(--humanmark-sdk-primary-400) 100% );--humanmark-sdk-overlay-light: var(--humanmark-sdk-black-alpha-5);--humanmark-sdk-overlay-medium: var(--humanmark-sdk-black-alpha-10);--humanmark-sdk-shadow-xl: 0 12px 24px rgba(0, 0, 0, .12)}}.humanmark-modal-overlay{all:initial;position:fixed!important;inset:0!important;display:flex!important;justify-content:center!important;align-items:center!important;z-index:2147483647!important;isolation:isolate!important;background:var(--humanmark-sdk-modal-overlay, rgba(0, 0, 0, .5))!important;backdrop-filter:blur(8px)!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important;font-size:16px!important;line-height:1.5!important;color:var(--humanmark-sdk-text-primary, #1c1a26)!important;box-sizing:border-box!important;overflow:auto!important;overscroll-behavior:contain!important}.humanmark-modal-overlay *,.humanmark-modal-overlay *:before,.humanmark-modal-overlay *:after{box-sizing:border-box!important}.humanmark-modal-content{background:var(--humanmark-sdk-modal-bg, #322f3d)!important;border-radius:16px!important;padding:32px!important;width:min(450px,90vw)!important;max-height:90vh!important;overflow-y:auto!important;overscroll-behavior:contain!important;position:relative!important;box-shadow:var(--humanmark-sdk-shadow-xl)!important;border:1px solid var(--humanmark-sdk-border-subtle)!important;pointer-events:auto!important;margin:0!important;-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale!important}.humanmark-modal-close{position:absolute!important;top:16px!important;right:16px!important;background:transparent!important;border:none!important;cursor:pointer!important;color:var(--humanmark-sdk-text-tertiary, #a8a3b8)!important;width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:8px!important;transition:all .2s ease!important;padding:0!important;margin:0!important;box-shadow:none!important;transform:none!important;font-size:inherit!important;font-weight:400!important}.humanmark-modal-close svg{width:20px!important;height:20px!important}.humanmark-modal-close:hover{background-color:var( --humanmark-sdk-overlay-light, rgba(255, 255, 255, .1) )!important;color:var(--humanmark-sdk-text-secondary, #e5e2f0)!important}.humanmark-modal-close:active{background-color:var( --humanmark-sdk-overlay-medium, rgba(255, 255, 255, .2) )!important}.humanmark-modal-close:focus{outline:none!important;box-shadow:0 0 0 2px var(--humanmark-sdk-focus-ring-primary, rgba(124, 99, 255, .4))!important}.humanmark-modal-close:focus:not(:focus-visible){box-shadow:none!important}.humanmark-modal-title{margin:0 0 16px!important;padding:0!important;font-size:24px!important;font-weight:600!important;font-style:normal!important;text-align:center!important;text-transform:none!important;color:var(--humanmark-sdk-primary-400)!important;letter-spacing:-.02em!important;line-height:1.2!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:8px!important}.humanmark-modal-title .humanmark-icon{width:1em!important;height:1em!important;display:inline-block!important;flex-shrink:0!important}.humanmark-modal-description{margin:0 0 24px!important;padding:0!important;text-align:center!important;text-transform:none!important;color:var(--humanmark-sdk-text-secondary)!important;font-size:16px!important;font-weight:400!important;font-style:normal!important;line-height:1.5!important;letter-spacing:normal!important}.humanmark-qr-container{text-align:center!important;margin:0 0 24px!important}.humanmark-qr-wrapper{display:inline-block!important;padding:24px!important;background:var(--humanmark-sdk-qr-container-bg)!important;border-radius:12px!important;margin-bottom:16px!important;border:1px solid var(--humanmark-sdk-border-subtle)!important;position:relative!important;overflow:hidden!important}.humanmark-qr-wrapper:before{content:""!important;position:absolute!important;inset:-1px!important;background:linear-gradient(135deg,var(--humanmark-sdk-primary-alpha-10) 0%,transparent 50%,var(--humanmark-sdk-primary-alpha-10) 100%)!important;border-radius:12px!important;opacity:0;animation:humanmark-sdk-gentle-pulse 4s ease-in-out infinite!important;z-index:0!important}.humanmark-qr-wrapper img,.humanmark-qr-wrapper canvas{display:block!important;margin:0 auto!important;border-radius:8px!important;background:var(--humanmark-sdk-transparent)!important;position:relative!important;z-index:1!important}.humanmark-modal-instructions{margin:0!important;text-align:center!important;color:var(--humanmark-sdk-text-tertiary)!important;font-size:14px!important;line-height:1.4!important}.humanmark-verify-button{appearance:none!important;-webkit-appearance:none!important;text-decoration:none!important;text-transform:none!important;font-family:inherit!important;line-height:1.2!important;letter-spacing:normal!important;background:var(--humanmark-sdk-primary-500)!important;color:var(--humanmark-sdk-white)!important;border:none!important;padding:14px 28px!important;border-radius:12px!important;font-size:16px!important;font-weight:500!important;cursor:pointer!important;width:100%!important;min-height:44px!important;margin:16px 0!important;position:relative!important;transition:all .2s ease!important;box-shadow:var(--humanmark-sdk-shadow-primary)!important}.humanmark-verify-button:hover{background:var(--humanmark-sdk-primary-600)!important;transform:translateY(-2px)!important;box-shadow:var(--humanmark-sdk-shadow-primary),0 8px 24px #7c63ff66!important}.humanmark-verify-button:active{transform:translateY(0)!important;background:var(--humanmark-sdk-primary-700)!important;box-shadow:0 2px 8px #7c63ff4d!important}.humanmark-verify-button:focus{outline:none!important;box-shadow:0 0 0 3px var(--humanmark-sdk-focus-ring-primary)!important}.humanmark-error{color:var(--humanmark-sdk-error-400)!important;text-align:center!important;font-size:14px!important;margin-top:12px!important}.humanmark-sr-only{position:absolute!important;left:-10000px!important;top:auto!important;width:1px!important;height:1px!important;overflow:hidden!important}.humanmark-modal-overlay *:focus-visible{outline:none!important;box-shadow:0 0 0 3px var(--humanmark-sdk-focus-ring-primary)!important}body.humanmark-modal-open{overflow:hidden!important}.humanmark-progress-container{position:absolute!important;bottom:0!important;left:0!important;right:0!important;height:8px!important;background:var(--humanmark-sdk-progress-track)!important;border-radius:0 0 16px 16px!important;overflow:hidden!important}.humanmark-progress-bar{height:100%!important;background:var(--humanmark-sdk-progress-fill)!important;width:100%;transform-origin:right center!important;transition:width .1s linear!important;position:relative!important;box-shadow:0 0 12px #7c63ff99!important}.humanmark-progress-bar:after{content:""!important;position:absolute!important;top:0!important;left:-100%;right:0!important;bottom:0!important;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.3) 50%,transparent 100%)!important;animation:humanmark-sdk-progress-shimmer 1.5s ease-in-out infinite!important}.humanmark-success-container{text-align:center!important;padding:40px 0!important;display:none!important}.humanmark-success-container.humanmark-success-visible{display:block!important;animation:humanmark-sdk-fade-in .3s ease-out!important}.humanmark-success-checkmark{width:80px!important;height:80px!important;margin:0 auto 24px!important;filter:drop-shadow(var(--humanmark-sdk-shadow-success))!important}.humanmark-success-checkmark svg{width:100%!important;height:100%!important}.humanmark-success-checkmark .checkmark-circle{stroke-dasharray:166!important;stroke-dashoffset:166;stroke-width:2!important;stroke-miterlimit:10!important;stroke:var(--humanmark-sdk-success-400)!important;fill:none!important;animation:humanmark-sdk-circle .6s cubic-bezier(.65,0,.45,1) forwards!important}.humanmark-success-checkmark .checkmark-check{transform-origin:50% 50%!important;stroke-dasharray:48!important;stroke-dashoffset:48;stroke:var(--humanmark-sdk-success-400)!important;stroke-width:3!important;stroke-linecap:round!important;stroke-linejoin:round!important;fill:none!important;animation:humanmark-sdk-check .3s cubic-bezier(.65,0,.45,1) .6s forwards!important}.humanmark-success-message{font-size:20px!important;font-weight:600!important;color:var(--humanmark-sdk-text-primary)!important;margin-bottom:8px!important}.humanmark-success-submessage{font-size:16px!important;color:var(--humanmark-sdk-text-secondary)!important}.humanmark-modal-body{transition:opacity .3s ease-out!important}.humanmark-modal-body.humanmark-fade-out{opacity:0!important}@keyframes humanmark-sdk-fade-in{0%{opacity:0}to{opacity:1}}@keyframes humanmark-sdk-fade-in-scale{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes humanmark-sdk-fade-out{0%{opacity:1}to{opacity:0}}@keyframes humanmark-sdk-fade-out-scale{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes humanmark-sdk-gentle-pulse{0%,to{opacity:0}50%{opacity:.6}}@keyframes humanmark-sdk-progress-shimmer{to{left:100%}}@keyframes humanmark-sdk-circle{to{stroke-dashoffset:0}}@keyframes humanmark-sdk-check{to{stroke-dashoffset:0}}.humanmark-modal-overlay{animation:humanmark-sdk-fade-in .3s ease-out!important}.humanmark-modal-content{animation:humanmark-sdk-fade-in-scale .3s ease-out!important}.humanmark-modal-overlay.humanmark-closing{animation:humanmark-sdk-fade-out .3s ease-out forwards!important}.humanmark-modal-overlay.humanmark-closing .humanmark-modal-content{animation:humanmark-sdk-fade-out-scale .3s ease-out forwards!important}@media (max-width: 480px){.humanmark-modal-content{padding:24px!important;width:min(400px,calc(100vw - 32px))!important;max-height:calc(100vh - 32px)!important;border-radius:20px!important;margin:16px!important}.humanmark-modal-close{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;top:12px!important;right:12px!important}.humanmark-progress-container{border-radius:0 0 20px 20px!important}.humanmark-modal-title{font-size:20px!important;gap:6px!important}.humanmark-modal-description{font-size:15px!important}.humanmark-qr-wrapper{padding:20px!important}}.humanmark-hidden{display:none!important}.humanmark-qr-image{display:block!important;margin:0 auto!important}.humanmark-what-is-this{display:block!important;text-align:center!important;margin-top:16px!important;color:var(--humanmark-sdk-primary-400)!important;font-size:14px!important;text-decoration:underline!important;transition:opacity .2s ease!important}.humanmark-what-is-this:hover{opacity:.8!important}.humanmark-what-is-this:focus{outline:none!important;opacity:.8!important}@media (prefers-reduced-motion: reduce){.humanmark-modal-overlay,.humanmark-modal-content,.humanmark-success-container,.humanmark-qr-wrapper:before,.humanmark-progress-bar:after{animation:none!important}.humanmark-modal-close,.humanmark-verify-button,.humanmark-modal-body,.humanmark-progress-bar,.humanmark-what-is-this{transition:none!important}.humanmark-success-checkmark .checkmark-circle,.humanmark-success-checkmark .checkmark-check{animation:none!important;stroke-dashoffset:0!important}}')),document.head.appendChild(a)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}}(); var HumanmarkSdk=function(t){"use strict";const e="/api/v1/challenge/wait",n="https://humanmark.io";function r(t){return function(t){let e={};t:for(;!c(t);){let n=h(t);switch(n>>>3){case 0:break t;case 1:e.version=h(t)>>>0;break;case 2:e.key_id=h(t)>>>0;break;case 3:e.issued_at=h(t)>>>0;break;case 4:e.expires_at=h(t)>>>0;break;case 5:e.challenge=u(t,h(t));break;case 6:e.shard=u(t,h(t));break;case 7:e.domain=u(t,h(t));break;default:o(t,7&n)}}return e}({bytes:e=t,offset:0,limit:e.length});var e}function o(t,e){switch(e){case 0:for(;128&d(t););break;case 2:s(t,h(t));break;case 5:s(t,4);break;case 1:s(t,8);break;default:throw new Error("Unimplemented type: "+e)}}let i=new Float32Array(1);new Uint8Array(i.buffer);let a=new Float64Array(1);function s(t,e){if(t.offset+e>t.limit)throw new Error("Skip past limit");t.offset+=e}function c(t){return t.offset>=t.limit}function l(t,e){let n=t.offset;if(n+e>t.limit)throw new Error("Read past limit");return t.offset+=e,n}function u(t,e){let n=l(t,e),r=String.fromCharCode,o=t.bytes,i="�",a="";for(let s=0;s<e;s++){let t,c,l,u,d=o[s+n];128&d?192==(224&d)?s+1>=e?a+=i:(t=o[s+n+1],128!=(192&t)?a+=i:(u=(31&d)<<6|63&t,u<128?a+=i:(a+=r(u),s++))):224==(240&d)?s+2>=e?a+=i:(t=o[s+n+1],c=o[s+n+2],32896!=(49344&(t|c<<8))?a+=i:(u=(15&d)<<12|(63&t)<<6|63&c,u<2048||u>=55296&&u<=57343?a+=i:(a+=r(u),s+=2))):240==(248&d)?s+3>=e?a+=i:(t=o[s+n+1],c=o[s+n+2],l=o[s+n+3],8421504!=(12632256&(t|c<<8|l<<16))?a+=i:(u=(7&d)<<18|(63&t)<<12|(63&c)<<6|63&l,u<65536||u>1114111?a+=i:(u-=65536,a+=r(55296+(u>>10),56320+(1023&u)),s+=3))):a+=i:a+=r(d)}return a}function d(t){return t.bytes[l(t,1)]}function h(t){let e,n=0,r=0;do{e=d(t),n<32&&(r|=(127&e)<<n),n+=7}while(128&e);return r}new Uint8Array(a.buffer);const f=400,m=401,g=403,p=408,E=410,C=429,w=500,A="GET",T="hm-api-key";var y=(t=>(t.INVALID_API_KEY="invalid_api_key",t.INVALID_CONFIG="invalid_config",t.NETWORK_ERROR="network_error",t.TIMEOUT="timeout",t.INVALID_RESPONSE="invalid_response",t.RATE_LIMITED="rate_limited",t.SERVER_ERROR="server_error",t.CHALLENGE_EXPIRED="challenge_expired",t.CHALLENGE_NOT_FOUND="challenge_not_found",t.INVALID_CHALLENGE_FORMAT="invalid_challenge_format",t.NO_ACTIVE_CHALLENGE="no_active_challenge",t.VERIFICATION_FAILED="verification_failed",t.NO_RECEIPT_RECEIVED="no_receipt_received",t.MODULE_LOAD_FAILED="module_load_failed",t.QR_CODE_GENERATION_FAILED="qr_code_generation_failed",t.USER_CANCELLED="user_cancelled",t))(y||{});class I extends Error{constructor(t,e,n,r){super(t),this.name="HumanmarkError",this.code=e,void 0!==n&&(this.statusCode=n),void 0!==r&&(this.metadata=r),this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,code:this.code,timestamp:this.timestamp.toISOString(),...this.stack&&{stack:this.stack},...this.metadata&&{metadata:{...this.metadata,...this.statusCode&&{statusCode:this.statusCode}}}}}}class v extends I{constructor(t,e,n){super(t,e,f,n),this.name="HumanmarkConfigError"}}class N extends I{constructor(t,e,n,r){super(t,e,n,r),this.name="HumanmarkNetworkError",this.errorCategory=r?.errorCategory??"unknown",this.isTemporary="temporary"===this.errorCategory}}class b extends I{constructor(t,e,n,r){super(t,e,n??f,r),this.name="HumanmarkApiError"}}class R extends I{constructor(t,e,n){super(t,e,f,n),this.name="HumanmarkVerificationError"}}class k extends I{constructor(t,e,n,r){super(t,e,f,{...r,challenge:n}),this.name="HumanmarkChallengeError",void 0!==n&&(this.challenge=n)}}function _(t){try{const n=t.split(".");if(2!==n.length)throw new Error("Invalid token format");const o=n[0];if(!o)throw new Error("Invalid token format: missing payload");const i=function(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=(4-e.length%4)%4,r=e+"=".repeat(n),o=atob(r),i=new Uint8Array(o.length);for(let a=0;a<o.length;a++)i[a]=o.charCodeAt(a);return i}(o);try{const e=r(i),n=e.challenge,o=e.shard,a=e.domain,s=e.expires_at,c=e.issued_at;if(!o||!n||!s)throw new Error("Missing required token claims");const l=c??void 0;return{token:t,claims:{shard:o,challenge:n,exp:s,...l&&{iat:l},...a&&{domain:a}}}}catch(e){try{const e=(new TextDecoder).decode(i),n=JSON.parse(e);if(n.shard&&n.challenge&&(n.exp??n.expiresAt??n.expires_at)){return{token:t,claims:{shard:n.shard,challenge:n.challenge,exp:n.exp??n.expires_at??(n.expiresAt?n.expiresAt/1e3:0),...n.iat&&{iat:n.iat},...n.issued_at&&!n.iat&&{iat:n.issued_at},...n.issuedAt&&!n.iat&&!n.issued_at&&{iat:n.issuedAt/1e3},...n.domain&&{domain:n.domain}}}}}catch{throw e}throw new Error("Invalid token format")}}catch(n){throw new k(`Invalid challenge token: ${n instanceof Error?n.message:"Unknown error"}`,y.INVALID_CHALLENGE_FORMAT)}}function L(t){return 1e3*_(t).claims.exp}const S=1e3,M=20,O=S,P=2,D=.1,B={WAIT_CHALLENGE_TOTAL_MS:10*6e4,SINGLE_REQUEST_MS:30*S},x=-1,U=0;function F(t){return function(t){return t>=w&&t<600}(t)||t===C}function H(t,e,n,r){return{method:t,headers:e}}class V extends I{constructor(t="User cancelled verification"){super(t,y.USER_CANCELLED),this.name="HumanmarkVerificationCancelledError"}}function K(t){return new N(t?`${t} timed out`:"Request timed out",y.TIMEOUT)}function Y(t){if(t instanceof I)return t;const e=t instanceof Error?t.message:"Network error occurred",n=function(t){return t instanceof Error?"AbortError"===t.name?"permanent":t.message?.includes("Failed to fetch")||t.message?.includes("Network request failed")||t.message?.includes("ERR_NETWORK")||t.message?.includes("ERR_INTERNET_DISCONNECTED")||t.message?.includes("ECONNREFUSED")||t.message?.includes("ETIMEDOUT")||t.message?.includes("ENOTFOUND")?"temporary":t.message?.includes("ERR_CERT")||t.message?.includes("SSL")||t.message?.includes("TLS")||t.message?.includes("CORS")?"permanent":"unknown":"unknown"}(t);return new N(e,y.NETWORK_ERROR,void 0,{errorCategory:n})}function $(t,e){let n,r;switch(t){case m:case g:n=y.INVALID_API_KEY,r=`HTTP ${t}: ${e}`;break;case C:n=y.RATE_LIMITED,r=`HTTP ${t}: ${e}`;break;case E:n=y.CHALLENGE_EXPIRED,r="Challenge expired";break;default:n=y.SERVER_ERROR,r=`HTTP ${t}: ${e}`}return new b(r,n,t)}function Q(){return new V("User cancelled verification")}function q(){return new k("No active challenge available",y.NO_ACTIVE_CHALLENGE)}class z{constructor(t=n){this.abortController=null,this.baseUrl=t}cancelPendingRequests(){this.abortController&&(this.abortController.abort(),this.abortController=null)}async waitForChallengeToken(t,n,r){if(this.abortController=new AbortController,r?.signal){const t=()=>this.abortController?.abort();r.signal.addEventListener("abort",t,{once:!0})}try{const i=Date.now(),a=r?.timeout??B.WAIT_CHALLENGE_TOTAL_MS,s=function(t){return _(t).claims.shard}(t),c=function(t){return _(t).claims.challenge}(t),l=function(t,e){try{const n=new URL(t);n.hostname=`${e}.${n.hostname}`;const r=n.toString();return r.endsWith("/")&&!n.search&&"/"===n.pathname?r.slice(0,-1):r}catch(n){throw new N(`Failed to construct shard URL: ${n instanceof Error?n.message:"Unknown error"}`,y.NETWORK_ERROR)}}(this.baseUrl,s);let u=0;for(;;)try{const t=this.performPreRequestChecks(i,a);u>0&&await this.waitForRetry(u,i,a);const r=Math.min(t,B.SINGLE_REQUEST_MS),o=await this.makeRequest(`${l}${e}/${c}`,H(A,{[T]:n[T]}),r),s=await this.handleWaitResponse(o);if("retry"===s){u=0;continue}return s}catch(o){if(!this.shouldRetryError(o,u,i,a))throw this.mapNetworkError(o);u++}}finally{this.abortController=null}}checkCancellation(){if(this.abortController?.signal.aborted)throw Y(new DOMException("Request cancelled","AbortError"))}checkTimeout(t,e){const n=e-(Date.now()-t);if(n<=0)throw K("Client request");return n}async waitForRetry(t,e,n){const r=function(t){const e=O*Math.pow(P,t),n=e*D*(2*Math.random()-1);return Math.max(0,e+n)}(t),o=Date.now()-e;if(r>0&&r+o>n)throw K("Client request");r>0&&await async function(t,e){return new Promise((n,r)=>{if(e?.aborted)return void r(new DOMException("Aborted","AbortError"));const o=setTimeout(n,t);e?.addEventListener("abort",()=>{clearTimeout(o),r(new DOMException("Aborted","AbortError"))},{once:!0})})}(r,this.abortController?.signal)}createLinkedAbortController(t){const e=new AbortController,n=setTimeout(()=>e.abort(),t);return this.abortController?.signal.addEventListener("abort",()=>e.abort(),{once:!0}),e.timeoutId=n,e}async handleWaitResponse(t){if(t.status===p)return"retry";if(t.ok)return await this.parseJsonResponse(t);if(F(t.status))throw $(t.status,t.statusText);this.handleResponseError(t)}async makeRequest(t,e,n){const r=this.createLinkedAbortController(n);try{return await fetch(t,{...e,signal:r.signal})}finally{clearTimeout(r.timeoutId)}}performPreRequestChecks(t,e){if(this.checkCancellation(),"undefined"!=typeof navigator&&!navigator.onLine)throw new N("No internet connection",y.NETWORK_ERROR,void 0,{isTemporary:!0,errorCategory:"temporary"});return this.checkTimeout(t,e)}shouldRetryError(t,e,n,r){return!!(Date.now()-n<r&&e<M-1)&&(t instanceof I?!!(t instanceof N&&t.isTemporary)||!!(t instanceof b&&t.statusCode)&&F(t.statusCode):function(t){return t instanceof Error&&"AbortError"!==t.name&&("TypeError"===t.name||t.message?.includes("Failed to fetch")||t.message?.includes("Network request failed")||t.message?.includes("ERR_NETWORK")||t.message?.includes("ERR_INTERNET_DISCONNECTED")||t.message?.includes("ECONNREFUSED")||t.message?.includes("ETIMEDOUT")||t.message?.includes("ENOTFOUND"))}(t))}mapNetworkError(t){return t instanceof I?t:t instanceof Error&&"AbortError"===t.name?K():Y(t)}handleResponseError(t){throw $(t.status,t.statusText)}async parseJsonResponse(t){try{return await t.json()}catch{throw new N("Invalid JSON response from server",y.INVALID_RESPONSE,t.status)}}}class G{constructor(){this.token=null}setChallengeToken(t){try{_(t)}catch{throw e=t,new k("Invalid challenge ID format",y.INVALID_CHALLENGE_FORMAT,e)}var e;this.token=t}getCurrentToken(){return!this.token||this.isExpired()?null:this.token}isExpired(){if(!this.token)return!0;try{return function(t){const e=L(t);return Date.now()>=e}(this.token)}catch{return!0}}getTimeRemaining(){if(!this.token)return x;try{const t=L(this.token)-Date.now();return Math.max(U,t)}catch{return U}}clearChallengeToken(){this.token=null}}class W{static initialize(t="dark"){document.documentElement.setAttribute("data-hm-theme",t??"dark")}}const j=new Map;async function J(t,e){if(j.has(e))return j.get(e);try{const n=await t();return j.set(e,n),n}catch(n){throw new I(`Failed to load module '${e}': ${n instanceof Error?n.message:"Unknown error"}`,y.MODULE_LOAD_FAILED)}}const X=Object.freeze(Object.defineProperty({__proto__:null,loadUIManager:async function(){return(await J(()=>Promise.resolve().then(()=>Rn),"UIManager")).UIManager},preloadUIComponents:async function(){return async function(t){const e=t.map(({loader:t,key:e})=>J(t,e).catch(()=>{}));await Promise.all(e)}([{loader:()=>Promise.resolve().then(()=>Rn),key:"UIManager"},{loader:()=>Promise.resolve().then(()=>fn),key:"QRCodeGenerator"},{loader:()=>Promise.resolve().then(()=>un),key:"DeepLinkHandler"}])}},Symbol.toStringTag,{value:"Module"}));function Z(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tt,et,nt={};var rt,ot={},it={};function at(){if(rt)return it;let t;rt=1;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return it.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},it.getSymbolTotalCodewords=function(t){return e[t]},it.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},it.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');t=e},it.isKanjiModeEnabled=function(){return void 0!==t},it.toSJIS=function(e){return t(e)},it}var st,ct,lt,ut,dt,ht={};function ft(){return st||(st=1,(t=ht).L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(r){return n}}),ht;var t}var mt,gt={};var pt,Et={};var Ct,wt={};var At,Tt={};function yt(){if(At)return Tt;At=1;const t=ft(),e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Tt.getBlocksCount=function(n,r){switch(r){case t.L:return e[4*(n-1)+0];case t.M:return e[4*(n-1)+1];case t.Q:return e[4*(n-1)+2];case t.H:return e[4*(n-1)+3];default:return}},Tt.getTotalCodewordsCount=function(e,r){switch(r){case t.L:return n[4*(e-1)+0];case t.M:return n[4*(e-1)+1];case t.Q:return n[4*(e-1)+2];case t.H:return n[4*(e-1)+3];default:return}},Tt}var It,vt,Nt,bt,Rt={},kt={};function _t(){return vt||(vt=1,function(t){const e=function(){if(It)return kt;It=1;const t=new Uint8Array(512),e=new Uint8Array(256);return function(){let n=1;for(let r=0;r<255;r++)t[r]=n,e[n]=r,n<<=1,256&n&&(n^=285);for(let e=255;e<512;e++)t[e]=t[e-255]}(),kt.log=function(t){if(t<1)throw new Error("log("+t+")");return e[t]},kt.exp=function(e){return t[e]},kt.mul=function(n,r){return 0===n||0===r?0:t[e[n]+e[r]]},kt}();t.mul=function(t,n){const r=new Uint8Array(t.length+n.length-1);for(let o=0;o<t.length;o++)for(let i=0;i<n.length;i++)r[o+i]^=e.mul(t[o],n[i]);return r},t.mod=function(t,n){let r=new Uint8Array(t);for(;r.length-n.length>=0;){const t=r[0];for(let i=0;i<n.length;i++)r[i]^=e.mul(n[i],t);let o=0;for(;o<r.length&&0===r[o];)o++;r=r.slice(o)}return r},t.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let o=0;o<n;o++)r=t.mul(r,new Uint8Array([1,e.exp(o)]));return r}}(Rt)),Rt}var Lt,St={},Mt={},Ot={};function Pt(){return Lt||(Lt=1,Ot.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ot}var Dt,Bt,xt,Ut={};function Ft(){if(Dt)return Ut;Dt=1;const t="[0-9]+";let e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";e=e.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+e+")(?:.|[\r\n]))+";Ut.KANJI=new RegExp(e,"g"),Ut.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ut.BYTE=new RegExp(n,"g"),Ut.NUMERIC=new RegExp(t,"g"),Ut.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const r=new RegExp("^"+e+"$"),o=new RegExp("^"+t+"$"),i=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ut.testKanji=function(t){return r.test(t)},Ut.testNumeric=function(t){return o.test(t)},Ut.testAlphanumeric=function(t){return i.test(t)},Ut}function Ht(){return Bt||(Bt=1,function(t){const e=Pt(),n=Ft();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(r){return n}}}(Mt)),Mt}function Vt(){return xt||(xt=1,function(t){const e=at(),n=yt(),r=ft(),o=Ht(),i=Pt(),a=e.getBCHDigit(7973);function s(t,e){return o.getCharCountIndicator(t,e)+4}function c(t,e){let n=0;return t.forEach(function(t){const r=s(t.mode,e);n+=r+t.getBitsLength()}),n}t.from=function(t,e){return i.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,r,a){if(!i.isValid(t))throw new Error("Invalid QR Code version");void 0===a&&(a=o.BYTE);const c=8*(e.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,r));if(a===o.MIXED)return c;const l=c-s(a,t);switch(a){case o.NUMERIC:return Math.floor(l/10*3);case o.ALPHANUMERIC:return Math.floor(l/11*2);case o.KANJI:return Math.floor(l/13);case o.BYTE:default:return Math.floor(l/8)}},t.getBestVersionForData=function(e,n){let i;const a=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(c(e,r)<=t.getCapacity(r,n,o.MIXED))return r}(e,a);if(0===e.length)return 1;i=e[0]}else i=e;return function(e,n,r){for(let o=1;o<=40;o++)if(n<=t.getCapacity(o,r,e))return o}(i.mode,i.getLength(),a)},t.getEncodedBits=function(t){if(!i.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-a>=0;)n^=7973<<e.getBCHDigit(n)-a;return t<<12|n}}(St)),St}var Kt,Yt={};var $t,Qt,qt,zt,Gt,Wt,jt,Jt,Xt={};var Zt,te,ee,ne={exports:{}};function re(){return te||(te=1,function(t){const e=Ht(),n=function(){if(Qt)return $t;Qt=1;const t=Ht();function e(e){this.mode=t.NUMERIC,this.data=e.toString()}return e.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(t){let e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);const o=this.data.length-e;o>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*o+1))},$t=e}(),r=function(){if(zt)return qt;zt=1;const t=Ht(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(e){this.mode=t.ALPHANUMERIC,this.data=e}return n.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let r=45*e.indexOf(this.data[n]);r+=e.indexOf(this.data[n+1]),t.put(r,11)}this.data.length%2&&t.put(e.indexOf(this.data[n]),6)},qt=n}(),o=function(){if(Wt)return Gt;Wt=1;const t=Ht();function e(e){this.mode=t.BYTE,this.data="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}return e.getBitsLength=function(t){return 8*t},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)},Gt=e}(),i=function(){if(Jt)return jt;Jt=1;const t=Ht(),e=at();function n(e){this.mode=t.KANJI,this.data=e}return n.getBitsLength=function(t){return 13*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){let n;for(n=0;n<this.data.length;n++){let r=e.toSJIS(this.data[n]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[n]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),t.put(r,13)}},jt=n}(),a=Ft(),s=at(),c=function(){return Zt||(Zt=1,ne.exports=t={single_source_shortest_paths:function(e,n,r){var o={},i={};i[n]=0;var a,s,c,l,u,d,h,f=t.PriorityQueue.make();for(f.push(n,0);!f.empty();)for(c in s=(a=f.pop()).value,l=a.cost,u=e[s]||{})u.hasOwnProperty(c)&&(d=l+u[c],h=i[c],(void 0===i[c]||h>d)&&(i[c]=d,f.push(c,d),o[c]=s));if(void 0!==r&&void 0===i[r]){var m=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(m)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(e,n,r){var o=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,o={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(o[n]=r[n]);return o.queue=[],o.sorter=e.sorter||r.default_sorter,o},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}}),ne.exports;var t}();function l(t){return unescape(encodeURIComponent(t)).length}function u(t,e,n){const r=[];let o;for(;null!==(o=t.exec(n));)r.push({data:o[0],index:o.index,mode:e,length:o[0].length});return r}function d(t){const n=u(a.NUMERIC,e.NUMERIC,t),r=u(a.ALPHANUMERIC,e.ALPHANUMERIC,t);let o,i;s.isKanjiModeEnabled()?(o=u(a.BYTE,e.BYTE,t),i=u(a.KANJI,e.KANJI,t)):(o=u(a.BYTE_KANJI,e.BYTE,t),i=[]);return n.concat(r,o,i).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function h(t,a){switch(a){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return i.getBitsLength(t);case e.BYTE:return o.getBitsLength(t)}}function f(t,a){let c;const l=e.getBestModeForData(t);if(c=e.from(a,l),c!==e.BYTE&&c.bit<l.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(c)+".\n Suggested mode is: "+e.toString(l));switch(c!==e.KANJI||s.isKanjiModeEnabled()||(c=e.BYTE),c){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new i(t);case e.BYTE:return new o(t)}}t.fromArray=function(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(f(e,null)):e.data&&t.push(f(e.data,e.mode)),t},[])},t.fromString=function(n,r){const o=function(t){const n=[];for(let r=0;r<t.length;r++){const o=t[r];switch(o.mode){case e.NUMERIC:n.push([o,{data:o.data,mode:e.ALPHANUMERIC,length:o.length},{data:o.data,mode:e.BYTE,length:o.length}]);break;case e.ALPHANUMERIC:n.push([o,{data:o.data,mode:e.BYTE,length:o.length}]);break;case e.KANJI:n.push([o,{data:o.data,mode:e.BYTE,length:l(o.data)}]);break;case e.BYTE:n.push([{data:o.data,mode:e.BYTE,length:l(o.data)}])}}return n}(d(n,s.isKanjiModeEnabled())),i=function(t,n){const r={},o={start:{}};let i=["start"];for(let a=0;a<t.length;a++){const s=t[a],c=[];for(let t=0;t<s.length;t++){const l=s[t],u=""+a+t;c.push(u),r[u]={node:l,lastCount:0},o[u]={};for(let t=0;t<i.length;t++){const a=i[t];r[a]&&r[a].node.mode===l.mode?(o[a][u]=h(r[a].lastCount+l.length,l.mode)-h(r[a].lastCount,l.mode),r[a].lastCount+=l.length):(r[a]&&(r[a].lastCount=l.length),o[a][u]=h(l.length,l.mode)+4+e.getCharCountIndicator(l.mode,n))}}i=c}for(let e=0;e<i.length;e++)o[i[e]].end=0;return{map:o,table:r}}(o,r),a=c.find_path(i.map,"start","end"),u=[];for(let t=1;t<a.length-1;t++)u.push(i.table[a[t]].node);return t.fromArray(function(t){return t.reduce(function(t,e){const n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[])}(u))},t.rawSplit=function(e){return t.fromArray(d(e,s.isKanjiModeEnabled()))}}(Xt)),Xt}function oe(){if(ee)return ot;ee=1;const t=at(),e=ft(),n=function(){if(lt)return ct;function t(){this.buffer=[],this.length=0}return lt=1,t.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},ct=t}(),r=function(){if(dt)return ut;function t(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return dt=1,t.prototype.set=function(t,e,n,r){const o=t*this.size+e;this.data[o]=n,r&&(this.reservedBit[o]=!0)},t.prototype.get=function(t,e){return this.data[t*this.size+e]},t.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},t.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},ut=t}(),o=(mt||(mt=1,function(t){const e=at().getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),o=145===r?26:2*Math.ceil((r-13)/(2*n-2)),i=[r-7];for(let e=1;e<n-1;e++)i[e]=i[e-1]-o;return i.push(6),i.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),o=r.length;for(let t=0;t<o;t++)for(let e=0;e<o;e++)0===t&&0===e||0===t&&e===o-1||t===o-1&&0===e||n.push([r[t],r[e]]);return n}}(gt)),gt),i=function(){if(pt)return Et;pt=1;const t=at().getSymbolSize;return Et.getPositions=function(e){const n=t(e);return[[0,0],[n-7,0],[0,n-7]]},Et}(),a=(Ct||(Ct=1,function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e=3,n=3,r=40,o=10;function i(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,o=0,i=0,a=null,s=null;for(let c=0;c<n;c++){o=i=0,a=s=null;for(let l=0;l<n;l++){let n=t.get(c,l);n===a?o++:(o>=5&&(r+=e+(o-5)),a=n,o=1),n=t.get(l,c),n===s?i++:(i>=5&&(r+=e+(i-5)),s=n,i=1)}o>=5&&(r+=e+(o-5)),i>=5&&(r+=e+(i-5))}return r},t.getPenaltyN2=function(t){const e=t.size;let r=0;for(let n=0;n<e-1;n++)for(let o=0;o<e-1;o++){const e=t.get(n,o)+t.get(n,o+1)+t.get(n+1,o)+t.get(n+1,o+1);4!==e&&0!==e||r++}return r*n},t.getPenaltyN3=function(t){const e=t.size;let n=0,o=0,i=0;for(let r=0;r<e;r++){o=i=0;for(let a=0;a<e;a++)o=o<<1&2047|t.get(r,a),a>=10&&(1488===o||93===o)&&n++,i=i<<1&2047|t.get(a,r),a>=10&&(1488===i||93===i)&&n++}return n*r},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*o},t.applyMask=function(t,e){const n=e.size;for(let r=0;r<n;r++)for(let o=0;o<n;o++)e.isReserved(o,r)||e.xor(o,r,i(t,o,r))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let o=0,i=1/0;for(let a=0;a<r;a++){n(a),t.applyMask(a,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(a,e),r<i&&(i=r,o=a)}return o}}(wt)),wt),s=yt(),c=function(){if(bt)return Nt;bt=1;const t=_t();function e(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}return e.prototype.initialize=function(e){this.degree=e,this.genPoly=t.generateECPolynomial(this.degree)},e.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(e.length+this.degree);n.set(e);const r=t.mod(n,this.genPoly),o=this.degree-r.length;if(o>0){const t=new Uint8Array(this.degree);return t.set(r,o),t}return r},Nt=e}(),l=Vt(),u=function(){if(Kt)return Yt;Kt=1;const t=at(),e=t.getBCHDigit(1335);return Yt.getEncodedBits=function(n,r){const o=n.bit<<3|r;let i=o<<10;for(;t.getBCHDigit(i)-e>=0;)i^=1335<<t.getBCHDigit(i)-e;return 21522^(o<<10|i)},Yt}(),d=Ht(),h=re();function f(t,e,n){const r=t.size,o=u.getEncodedBits(e,n);let i,a;for(i=0;i<15;i++)a=1==(o>>i&1),i<6?t.set(i,8,a,!0):i<8?t.set(i+1,8,a,!0):t.set(r-15+i,8,a,!0),i<8?t.set(8,r-i-1,a,!0):i<9?t.set(8,15-i-1+1,a,!0):t.set(8,15-i-1,a,!0);t.set(r-8,8,1,!0)}function m(e,r,o){const i=new n;o.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),d.getCharCountIndicator(t.mode,e)),t.write(i)});const a=8*(t.getSymbolTotalCodewords(e)-s.getTotalCodewordsCount(e,r));for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(a-i.getLengthInBits())/8;for(let t=0;t<l;t++)i.put(t%2?17:236,8);return function(e,n,r){const o=t.getSymbolTotalCodewords(n),i=s.getTotalCodewordsCount(n,r),a=o-i,l=s.getBlocksCount(n,r),u=o%l,d=l-u,h=Math.floor(o/l),f=Math.floor(a/l),m=f+1,g=h-f,p=new c(g);let E=0;const C=new Array(l),w=new Array(l);let A=0;const T=new Uint8Array(e.buffer);for(let t=0;t<l;t++){const e=t<d?f:m;C[t]=T.slice(E,E+e),w[t]=p.encode(C[t]),E+=e,A=Math.max(A,e)}const y=new Uint8Array(o);let I,v,N=0;for(I=0;I<A;I++)for(v=0;v<l;v++)I<C[v].length&&(y[N++]=C[v][I]);for(I=0;I<g;I++)for(v=0;v<l;v++)y[N++]=w[v][I];return y}(i,e,r)}function g(e,n,s,c){let u;if(Array.isArray(e))u=h.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let t=n;if(!t){const n=h.rawSplit(e);t=l.getBestVersionForData(n,s)}u=h.fromString(e,t||40)}}const d=l.getBestVersionForData(u,s);if(!d)throw new Error("The amount of data is too big to be stored in a QR Code");if(n){if(n<d)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+d+".\n")}else n=d;const g=m(n,s,u),p=t.getSymbolSize(n),E=new r(p);return function(t,e){const n=t.size,r=i.getPositions(e);for(let o=0;o<r.length;o++){const e=r[o][0],i=r[o][1];for(let r=-1;r<=7;r++)if(!(e+r<=-1||n<=e+r))for(let o=-1;o<=7;o++)i+o<=-1||n<=i+o||(r>=0&&r<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===r||6===r)||r>=2&&r<=4&&o>=2&&o<=4?t.set(e+r,i+o,!0,!0):t.set(e+r,i+o,!1,!0))}}(E,n),function(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2==0;t.set(n,6,e,!0),t.set(6,n,e,!0)}}(E),function(t,e){const n=o.getPositions(e);for(let r=0;r<n.length;r++){const e=n[r][0],o=n[r][1];for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)-2===n||2===n||-2===r||2===r||0===n&&0===r?t.set(e+n,o+r,!0,!0):t.set(e+n,o+r,!1,!0)}}(E,n),f(E,s,0),n>=7&&function(t,e){const n=t.size,r=l.getEncodedBits(e);let o,i,a;for(let s=0;s<18;s++)o=Math.floor(s/3),i=s%3+n-8-3,a=1==(r>>s&1),t.set(o,i,a,!0),t.set(i,o,a,!0)}(E,n),function(t,e){const n=t.size;let r=-1,o=n-1,i=7,a=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!t.isReserved(o,s-n)){let r=!1;a<e.length&&(r=1==(e[a]>>>i&1)),t.set(o,s-n,r),i--,-1===i&&(a++,i=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}(E,g),isNaN(c)&&(c=a.getBestMask(E,f.bind(null,E,s))),a.applyMask(c,E),f(E,s,c),{modules:E,version:n,errorCorrectionLevel:s,maskPattern:c,segments:u}}return ot.create=function(n,r){if(void 0===n||""===n)throw new Error("No input text");let o,i,s=e.M;return void 0!==r&&(s=e.from(r.errorCorrectionLevel,e.M),o=l.from(r.version),i=a.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),g(n,o,s,i)},ot}var ie,ae,se={},ce={};function le(){return ie||(ie=1,function(t){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:r,scale:r?4:o,margin:n,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getSc