@arcblock/did-connect-service 4.1.53 → 4.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,878 @@
1
+ "use strict";var __LoginBundle=(()=>{var ce=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Oe=(t,e)=>{for(var r in e)ce(t,r,{get:e[r],enumerable:!0})},Me=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ne(e))!Pe.call(t,i)&&i!==r&&ce(t,i,{get:()=>e[i],enumerable:!(n=Re(e,i))||n.enumerable});return t};var $e=t=>Me(ce({},"__esModule",{value:!0}),t);var pt={};Oe(pt,{FetchHttpAdapter:()=>ee,LoginDialog:()=>Le,LoginPage:()=>me,runPasskeyAuth:()=>le});var K={CREATED:"created",SCANNED:"scanned",SUCCEED:"succeed",ERROR:"error",TIMEOUT:"timeout",BUSY:"busy",FORBIDDEN:"forbidden"};var U={API_PREFIX:"/api/did",SERVICE_PREFIX:"/.well-known/service",ACTION:"login",TOKEN_TIMEOUT:3e5,CHECK_INTERVAL:2e3,TOKEN_KEY:"_t_",TOKEN_DELIVERY:"cookie",CREATE_THROTTLE:500,AUTO_CHECK_INTERVAL:6e4};var ue="did:abt:";function ye(t){if(!t||typeof t!="string")return!1;let e=t.replace(ue,"");return/^(0x)?[0-9a-f]{40}$/i.test(e)}function be(t,e=8,r=6){return!t||typeof t!="string"?"":t.length<=e+r+3?t:`${t.slice(0,e)}...${t.slice(-r)}`}function de(t,e={}){if(!t||typeof t!="string")return{prefix:"DID: ABT:",chainLabel:"ABT",address:"",compact:"",copyText:""};let{startChars:r=8,endChars:n=6}=e,i=ye(t),a=t.replace(ue,""),s=i?"ETH":"ABT",o=e.includePrefix??!i;return{prefix:`DID: ${s}:`,chainLabel:s,address:a,compact:be(a,r,n),copyText:o?`${ue}${a}`:a}}var M={TOKEN_EXPIRED:"TOKEN_EXPIRED",TOKEN_NOT_FOUND:"TOKEN_NOT_FOUND",TOKEN_TIMEOUT:"TOKEN_TIMEOUT",ALREADY_EXIST:"ALREADY_EXIST",ALREADY_BIND:"ALREADY_BIND",NETWORK_ERROR:"NETWORK_ERROR",INVALID_RESPONSE:"INVALID_RESPONSE",UNAUTHORIZED:"UNAUTHORIZED",FORBIDDEN:"FORBIDDEN"},O=class extends Error{code;constructor(e,r){super(r),this.name="ConnectError",this.code=e}};var ee=class{_defaultHeaders;_onRequest;constructor(e){this._defaultHeaders=e?.headers??{},this._onRequest=e?.onRequest}async get(e,r){this._validateUrl(e);let n=r?.params?this._serializeParams(r.params):"",i=n?`${e}${e.includes("?")?"&":"?"}${n}`:e,s={method:"GET",headers:{...this._defaultHeaders,...r?.headers},signal:r?.signal};return this._onRequest&&(s=this._onRequest(i,s)),this._execute(i,s)}async post(e,r,n){this._validateUrl(e);let i=n?.params?this._serializeParams(n.params):"",a=i?`${e}${e.includes("?")?"&":"?"}${i}`:e,o={method:"POST",headers:{"Content-Type":"application/json",...this._defaultHeaders,...n?.headers},body:r!==void 0?JSON.stringify(r):void 0,signal:n?.signal};return this._onRequest&&(o=this._onRequest(a,o)),this._execute(a,o)}_validateUrl(e){if(!e?.trim())throw new O(M.NETWORK_ERROR,"Request URL must not be empty");if(e.trim().toLowerCase().startsWith("javascript:"))throw new O(M.NETWORK_ERROR,"Invalid URL protocol")}async _execute(e,r){let n;try{n=await globalThis.fetch(e,r)}catch(s){throw s?.name==="AbortError"?s:new O(M.NETWORK_ERROR,`Network request failed: ${s?.message??"Unknown error"}`)}if(!n.ok){let s="",o="";try{let u=await n.text();try{let f=JSON.parse(u);f.error&&(s=f.error),f.code&&(o=f.code)}catch{s=u}}catch{}let c=o==="FORBIDDEN"?M.FORBIDDEN:M.NETWORK_ERROR;throw new O(c,s||`HTTP ${n.status} ${n.statusText||"Error"}`)}if(n.status===204)return null;let i=await n.text();if(!i.trim())return null;let a=n.headers.get("content-type")??"";if(!a.includes("application/json")&&!a.includes("+json"))throw new O(M.INVALID_RESPONSE,`Expected JSON response but received: ${a||"unknown content type"}`);try{return JSON.parse(i)}catch{throw new O(M.INVALID_RESPONSE,"Failed to parse JSON response")}}_serializeParams(e){let r=[];for(let n of Object.keys(e)){let i=e[n];if(i!=null)if(Array.isArray(i))for(let a of i)a!=null&&r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(a))}`);else typeof i=="boolean"?r.push(`${encodeURIComponent(n)}=${i?"true":"false"}`):r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`)}return r.join("&")}};var Ee=["en","zh","zh-TW","ja"],vt=new Set(Ee);function te(t){let e=t.apiPrefix??U.API_PREFIX,r=t.action??U.ACTION,n=e.replace(/\/+$/,""),i=r.replace(/^\/+/,"");return`${n}/${i}`}function Ce(){return{token:null,url:null,status:null,error:null,appInfo:null,memberAppInfo:null,loading:!1}}var ne=class{_state;_config;_http;_pollTimer=null;_checkCount=0;_maxCheckCount;_realtimeUnsub=null;_realtime;_storage;_lastCreateTime=0;_listeners=new Map;_destroyed=!1;constructor(e,r,n){this._config=this._fillDefaults(e),this._http=r,this._realtime=n?.realtime,this._storage=n?.storage,this._state=Ce(),this._config.checkInterval<=0?this._maxCheckCount=1/0:this._maxCheckCount=Math.ceil(this._config.tokenTimeout/this._config.checkInterval)}get state(){return Object.freeze({...this._state})}async create(e){if(Date.now()-this._lastCreateTime<U.CREATE_THROTTLE)return this.state;(this._pollTimer!==null||this._realtimeUnsub!==null)&&this.stopPolling(),this._state.loading=!0,this._emit("statusChange",this.state);let r=`${te(this._config)}/token`,n={};e?(e.locale!=null&&(n.locale=e.locale),e.provider!=null?n.provider=e.provider:n.provider="wallet",e.encKey!=null&&(n.__encKey=e.encKey),e.autoConnect!=null&&(n.autoConnect=e.autoConnect),e.visitorId!=null&&(n.visitorId=e.visitorId),e.sourceToken!=null&&(n.sourceToken=e.sourceToken),e.forceConnected!=null&&(n.forceConnected=e.forceConnected),e.connectUrl!=null&&(n.connectUrl=e.connectUrl),e.extraParams&&Object.assign(n,e.extraParams)):n.provider="wallet";try{let i=await this._http.get(r,{params:n});return this._state.token=i.token??null,this._state.url=i.url??null,this._state.status=K.CREATED,this._state.appInfo=i.appInfo??null,this._state.memberAppInfo=i.memberAppInfo??null,this._state.loading=!1,this._state.error=null,this._state.successResult=void 0,this._state.connectedDid=void 0,this._state.mfaCode=void 0,this._state.saveConnect=void 0,this._lastCreateTime=Date.now(),this._emit("statusChange",this.state),this.state}catch(i){throw this._state.loading=!1,this._state.error=i?.message??"Failed to create token",this._state.status=K.ERROR,this._emit("statusChange",this.state),this._emit("error",new O(M.NETWORK_ERROR,this._state.error)),i}}async checkStatus(){if(!this._state.token)throw new O(M.TOKEN_NOT_FOUND,"No token available. Call create() first.");let e=`${te(this._config)}/status`,r={[U.TOKEN_KEY]:this._state.token};this._config.appPid;try{let n=await this._http.get(e,{params:r}),i=n.status;return i&&(this._state.status=i),n.error!==void 0&&(this._state.error=n.error),n.connectedDid!==void 0&&(this._state.connectedDid=n.connectedDid),n.mfaCode!==void 0&&(this._state.mfaCode=n.mfaCode),n.saveConnect!==void 0&&(this._state.saveConnect=n.saveConnect),i===K.FORBIDDEN?(this._state.status=K.ERROR,this._state.error=n.error||"Access forbidden",this._emit("error",new O(M.UNAUTHORIZED,this._state.error)),this.stopPolling()):i===K.SUCCEED?(this._config.tokenDelivery==="response"&&(this._state.successResult=n),this._emit("succeed",this.state),this.stopPolling()):i===K.ERROR?(this._emit("error",new O(M.INVALID_RESPONSE,this._state.error||"Unknown error")),this.stopPolling()):i===K.TIMEOUT&&(this._emit("timeout",this.state),this.stopPolling()),this._emit("statusChange",this.state),this.state}catch(n){throw n}}async cancel(){if(!this._state.token)return;let e=`${te(this._config)}/timeout`,r={[U.TOKEN_KEY]:this._state.token};try{await this._http.get(e,{params:r})}catch{}this.stopPolling()}startPolling(){if(this._state.token){if(this._checkCount=0,this._realtime)try{let e=`relay:${this._config.appPid}:${this._state.token}`;this._realtimeUnsub=this._realtime.subscribe(e,r=>{this._handleRealtimeMessage(r)});return}catch{this._realtimeUnsub=null}this._config.checkInterval>0&&(this._pollTimer=setInterval(()=>{this._pollOnce()},this._config.checkInterval))}}stopPolling(){this._pollTimer!==null&&(clearInterval(this._pollTimer),this._pollTimer=null),this._realtimeUnsub&&(this._realtimeUnsub(),this._realtimeUnsub=null)}reset(){this.stopPolling(),this._state=Ce(),this._checkCount=0}destroy(){this._destroyed||(this.stopPolling(),this._state.token=null,this._state.successResult=void 0,this._listeners.clear(),this._destroyed=!0)}on(e,r){let n=this._listeners.get(e);return n||(n=new Set,this._listeners.set(e,n)),n.add(r),this}off(e,r){let n=this._listeners.get(e);return n&&(n.delete(r),n.size===0&&this._listeners.delete(e)),this}_emit(e,...r){let n=this._listeners.get(e);if(!(!n||n.size===0))for(let i of[...n])try{i(...r)}catch{}}_pollOnce(){if(this._checkCount++,this._checkCount>=this._maxCheckCount){this._handleTimeout();return}this.checkStatus().catch(()=>{})}_handleTimeout(){this.stopPolling(),this._state.status=K.TIMEOUT,this._emit("timeout",this.state),this._emit("statusChange",this.state)}_handleRealtimeMessage(e){if(!e||typeof e!="object")return;let r=e.status;r&&(this._state.status=r,e.error!==void 0&&(this._state.error=e.error),e.connectedDid!==void 0&&(this._state.connectedDid=e.connectedDid),e.mfaCode!==void 0&&(this._state.mfaCode=e.mfaCode),e.saveConnect!==void 0&&(this._state.saveConnect=e.saveConnect),r===K.FORBIDDEN?(this._state.status=K.ERROR,this._state.error=e.error||"Access forbidden",this._emit("error",new O(M.UNAUTHORIZED,this._state.error)),this.stopPolling()):r===K.SUCCEED?(this._config.tokenDelivery==="response"&&(this._state.successResult=e),this._emit("succeed",this.state),this.stopPolling()):r===K.ERROR?(this._emit("error",new O(M.INVALID_RESPONSE,this._state.error||"Unknown error")),this.stopPolling()):r===K.TIMEOUT&&(this._emit("timeout",this.state),this.stopPolling()),this._emit("statusChange",this.state))}_fillDefaults(e){return{appPid:e.appPid,appName:e.appName,appDescription:e.appDescription??"",appIcon:e.appIcon??"",appUrl:e.appUrl??"",apiPrefix:e.apiPrefix??U.API_PREFIX,action:e.action??U.ACTION,servicePrefix:e.servicePrefix??U.SERVICE_PREFIX,tokenTimeout:e.tokenTimeout??U.TOKEN_TIMEOUT,checkInterval:e.checkInterval??U.CHECK_INTERVAL,tokenDelivery:e.tokenDelivery??U.TOKEN_DELIVERY}}};var _={bg:{root:"#0a0a0b",surface:"#141416",card:"#1c1c20",elevated:"#232328",hover:"#2b2b34",active:"#33333e",input:"rgba(255,255,255,0.06)"},border:{default:"rgba(255,255,255,0.10)",subtle:"rgba(255,255,255,0.06)",strong:"rgba(255,255,255,0.15)",focus:"rgba(255,255,255,0.25)"},text:{primary:"#f5f5f7",secondary:"#9394a1",tertiary:"#767684",placeholder:"#5e5f6e",white:"#ffffff"},color:{blue:"#6c47ff",blueHover:"#5f15fe",blueLight:"rgba(108,71,255,0.15)",blueMuted:"#9280ff",red:"#e02e2e",redLight:"rgba(224,46,46,0.15)",redText:"#f98a8a",green:"#15892b",greenLight:"rgba(21,137,43,0.15)",greenText:"#49dc6e",yellow:"#fd7224",yellowLight:"rgba(253,114,36,0.15)",yellowText:"#fd9357",info:"#236dd7",infoLight:"rgba(35,109,215,0.15)",infoText:"#73acfa"},radius:{xs:"4px",sm:"6px",md:"8px",lg:"12px",full:"9999px"},shadow:{sm:"0 1px 3px rgba(0,0,0,0.3), 0 1px 2px -1px rgba(0,0,0,0.2)",md:"0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3)",lg:"0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4)",focus:"0 0 0 1px rgba(255,255,255,0.12), 0 0 0 3px rgba(108,71,255,0.3)"},font:{family:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",mono:"'JetBrains Mono', 'SF Mono', monospace",sizeBase:"14px",lineHeight:"1.43"}},$={bg:{root:"#f8f9fa",surface:"#ffffff",card:"#ffffff",elevated:"#f0f1f3",hover:"#e9eaec",active:"#dddee1",input:"rgba(0,0,0,0.04)"},border:{default:"rgba(0,0,0,0.10)",subtle:"rgba(0,0,0,0.06)",strong:"rgba(0,0,0,0.15)",focus:"rgba(0,0,0,0.25)"},text:{primary:"#1a1a1a",secondary:"#6b7280",tertiary:"#9ca3af",placeholder:"#c0c5ce",white:"#1a1a1a"},shadow:{sm:"0 1px 3px rgba(0,0,0,0.08), 0 1px 2px -1px rgba(0,0,0,0.06)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.06)",lg:"0 10px 15px -3px rgba(0,0,0,0.12), 0 4px 6px -4px rgba(0,0,0,0.08)",focus:"0 0 0 1px rgba(0,0,0,0.08), 0 0 0 3px rgba(108,71,255,0.2)"}},Te=`
2
+ :root, :host {
3
+ /* Backgrounds \u2014 layered depth */
4
+ --bg-root: ${_.bg.root};
5
+ --bg-surface: ${_.bg.surface};
6
+ --bg-card: ${_.bg.card};
7
+ --bg-elevated: ${_.bg.elevated};
8
+ --bg-hover: ${_.bg.hover};
9
+ --bg-active: ${_.bg.active};
10
+ --bg-input: ${_.bg.input};
11
+
12
+ /* Borders \u2014 semi-transparent for adaptability */
13
+ --border: ${_.border.default};
14
+ --border-subtle:${_.border.subtle};
15
+ --border-strong:${_.border.strong};
16
+ --border-focus: ${_.border.focus};
17
+
18
+ /* Text hierarchy */
19
+ --text: ${_.text.primary};
20
+ --text-secondary:${_.text.secondary};
21
+ --text-tertiary:${_.text.tertiary};
22
+ --text-placeholder:${_.text.placeholder};
23
+ --text-white: ${_.text.white};
24
+
25
+ /* Accents */
26
+ --blue: ${_.color.blue};
27
+ --blue-hover: ${_.color.blueHover};
28
+ --blue-light: ${_.color.blueLight};
29
+ --blue-muted: ${_.color.blueMuted};
30
+ --red: ${_.color.red};
31
+ --red-light: ${_.color.redLight};
32
+ --red-text: ${_.color.redText};
33
+ --green: ${_.color.green};
34
+ --green-light: ${_.color.greenLight};
35
+ --green-text: ${_.color.greenText};
36
+ --yellow: ${_.color.yellow};
37
+ --yellow-light: ${_.color.yellowLight};
38
+ --yellow-text: ${_.color.yellowText};
39
+ --info: ${_.color.info};
40
+ --info-light: ${_.color.infoLight};
41
+ --info-text: ${_.color.infoText};
42
+
43
+ /* Radii */
44
+ --radius-xs: ${_.radius.xs};
45
+ --radius-sm: ${_.radius.sm};
46
+ --radius: ${_.radius.md};
47
+ --radius-lg: ${_.radius.lg};
48
+ --radius-full: ${_.radius.full};
49
+
50
+ /* Shadows */
51
+ --shadow-sm: ${_.shadow.sm};
52
+ --shadow-md: ${_.shadow.md};
53
+ --shadow-lg: ${_.shadow.lg};
54
+ --shadow-focus: ${_.shadow.focus};
55
+ }
56
+ `,Se=`
57
+ [data-theme="light"], :host([data-theme="light"]) {
58
+ --bg-root: ${$.bg.root};
59
+ --bg-surface: ${$.bg.surface};
60
+ --bg-card: ${$.bg.card};
61
+ --bg-elevated: ${$.bg.elevated};
62
+ --bg-hover: ${$.bg.hover};
63
+ --bg-active: ${$.bg.active};
64
+ --bg-input: ${$.bg.input};
65
+
66
+ --border: ${$.border.default};
67
+ --border-subtle:${$.border.subtle};
68
+ --border-strong:${$.border.strong};
69
+ --border-focus: ${$.border.focus};
70
+
71
+ --text: ${$.text.primary};
72
+ --text-secondary:${$.text.secondary};
73
+ --text-tertiary:${$.text.tertiary};
74
+ --text-placeholder:${$.text.placeholder};
75
+ --text-white: ${$.text.white};
76
+
77
+ --shadow-sm: ${$.shadow.sm};
78
+ --shadow-md: ${$.shadow.md};
79
+ --shadow-lg: ${$.shadow.lg};
80
+ --shadow-focus: ${$.shadow.focus};
81
+ }
82
+ `,Ue=`
83
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
84
+ html, :host { color-scheme: dark; }
85
+ html[data-theme="light"], :host([data-theme="light"]) { color-scheme: light; }
86
+ body {
87
+ font-family: ${_.font.family};
88
+ background: var(--bg-root);
89
+ color: var(--text);
90
+ -webkit-font-smoothing: antialiased;
91
+ -moz-osx-font-smoothing: grayscale;
92
+ font-size: ${_.font.sizeBase};
93
+ line-height: ${_.font.lineHeight};
94
+ }
95
+ a { color: var(--blue-muted); text-decoration: none; }
96
+ a:hover { text-decoration: underline; }
97
+ .hidden { display: none; }
98
+ `,We=typeof HTMLElement<"u"?HTMLElement:class{},we='<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>',He='<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>',Ke=`
99
+ :host {
100
+ display: inline-flex;
101
+ align-items: center;
102
+ max-width: 100%;
103
+ overflow: hidden;
104
+ font-family: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
105
+ line-height: 1.5;
106
+ }
107
+ :host([block]) { display: flex; }
108
+ .prefix {
109
+ flex-shrink: 0;
110
+ opacity: 0.6;
111
+ margin-right: 4px;
112
+ white-space: nowrap;
113
+ }
114
+ .address {
115
+ white-space: nowrap;
116
+ overflow: hidden;
117
+ text-overflow: ellipsis;
118
+ color: var(--did-text-color, currentColor);
119
+ }
120
+ .address-compact {
121
+ white-space: nowrap;
122
+ color: var(--did-text-color, currentColor);
123
+ cursor: default;
124
+ }
125
+ .clickable { cursor: pointer; }
126
+ .clickable:hover { opacity: 0.8; }
127
+ .copy-btn {
128
+ flex-shrink: 0;
129
+ display: inline-flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ width: 1em;
133
+ height: 1em;
134
+ margin-left: 6px;
135
+ padding: 0;
136
+ border: none;
137
+ background: none;
138
+ color: inherit;
139
+ opacity: 0.5;
140
+ cursor: pointer;
141
+ transition: opacity 0.15s;
142
+ }
143
+ .copy-btn:hover { opacity: 1; }
144
+ .copy-btn.copied { opacity: 1; color: var(--did-copy-success-color, #22c55e); }
145
+ `,ze=class extends We{static observedAttributes=["did","compact","copyable","start-chars","end-chars","show-prefix","no-tooltip","no-copy","block","size"];shadow;copyTimer=null;constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}disconnectedCallback(){this.copyTimer&&clearTimeout(this.copyTimer)}get parts(){let t=Number(this.getAttribute("start-chars")),e=Number(this.getAttribute("end-chars"));return de(this.getAttribute("did")||"",{startChars:t>0?t:void 0,endChars:e>0?e:void 0})}render(){if(!(this.getAttribute("did")||"")){this.shadow.innerHTML="";return}let e=this.parts,r=this.hasAttribute("compact"),n=!this.hasAttribute("no-copy")&&this.getAttribute("copyable")!=="false",i=this.hasAttribute("show-prefix"),a=this.hasAttribute("no-tooltip"),s=Number(this.getAttribute("size"))||0,o=s>=12?`${s}px`:"inherit",c=r?e.compact:e.address,u=!a&&r?` title="${e.address}"`:"",f=i?`<span class="prefix">${e.prefix} </span>`:"",p=r?"address-compact":"address",l=n?" clickable":"",E=n?`<button class="copy-btn" aria-label="Copy DID">${we}</button>`:"";if(this.shadow.innerHTML=`
146
+ <style>${Ke}:host { font-size: ${o}; }</style>
147
+ ${f}<span class="${p}${l}"${u}>${c}</span>${E}
148
+ `,n){let v=this.shadow.querySelector(`.${p}`);v&&v.addEventListener("click",C=>{C.stopPropagation(),this.copyToClipboard(e.copyText)});let D=this.shadow.querySelector(".copy-btn");D&&D.addEventListener("click",C=>{C.stopPropagation(),this.copyToClipboard(e.copyText)})}}copyToClipboard(t){navigator.clipboard?.writeText?navigator.clipboard.writeText(t).catch(()=>this.fallbackCopy(t)):this.fallbackCopy(t),this.showCopied()}fallbackCopy(t){try{let e=document.createElement("input");e.value=t,document.body.appendChild(e),e.select(),document.execCommand?.("copy"),e.remove()}catch{}}showCopied(){let t=this.shadow.querySelector(".copy-btn");t&&(t.classList.add("copied"),t.innerHTML=He,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{t.classList.remove("copied"),t.innerHTML=we},1500))}};typeof customElements<"u"&&!customElements.get("did-address")&&customElements.define("did-address",ze);var he={en:{emailExplanation:"We will send you a verification code. No password needed.",otherMethods:"Other ways to sign in",passkeyCreateAccount:"Create an account with Passkey",lastUsed:"Last used",passkeyExplanation:"Create a new account using your fingerprint, face, or device unlock. Your device will ask you to save a Passkey. Already have an account? Go back to sign in.",continueWith:"Continue with {provider}",oauthWaiting:"Continue in the {provider} window",oauthIncomplete:"Sign-in is not complete. Reopen the window or choose another method.",oauthReopen:"Reopen window",oauthUnconfirmed:"We could not confirm sign-in. Reload this page to check your session before trying again.",oauthCheckSession:"Reload and check sign-in",oauthCancelled:"Stopped waiting for sign-in. If the provider window is still open, close it before retrying.",oauthDenied:"Authorization was declined. Try again or choose another sign-in method.",oauthBlocked:"Your browser blocked the sign-in window. Reopen it or continue on this page.",oauthTimedOut:"Sign-in timed out. Reopen the window to start again.",oauthFailed:"We could not complete sign-in. Try again or choose another method.",oauthFullPage:"Continue on this page",emailEdit:"Change email",emailCooldown:"Resend in {seconds}s",walletRetry:"Wallet did not open? Try again or scan the QR code.",tryAgain:"Try again",signIn:"Sign in or create an account",signInTo:"Sign in or join {appName}",passkeyButton:"Continue with Passkey",passkeySignIn:"Sign in with Passkey",passkeyCreate:"Create Passkey",passkeyFirstTime:"First time? Create an account",passkeyBackToSignIn:"Back to sign in",passkeyWaiting:"Waiting for passkey\u2026",passkeyCreating:"Creating your passkey\u2026",passkeyNoLocal:"Passkey verification was not completed. Retry, use another device, or choose another method.",passkeyUseAnotherDevice:"Use another device",passkeyCreateInstead:"First time? Create an account",didWalletButton:"Continue with DID Wallet",didWalletButtonShort:"DID Wallet",scanWithWallet:"Scan with your DID Wallet",waitingWallet:"Requesting connection",walletContinue:"Please continue in DID Wallet",noPasskey:"No existing passkey found. Enter a name and create one.",success:"Success!",timeout:"Session timed out. Try again.",refreshQR:"Refresh",namePlaceholder:"Your name (optional)",or:"or",emailPlaceholder:"Email address",emailButton:"Email",passkeyUnsupported:"Your browser does not support Passkey authentication.",connecting:"Connecting...",verifying:"Verifying...",openInWallet:"Open in DID Wallet",authFailed:"Authentication failed",registrationFailed:"Registration failed",passkeySetupFailed:"Passkey setup failed",accessDenied:"Access denied: your account is not permitted to log in to this site.",regClosed:"Registration requires an invitation.",federatedBy:"Authentication provided by {masterName}",securedBy:"Secured by DID Connect",privacy:"Privacy",terms:"Terms",back:"Back",cancel:"Cancel",scanTitle:"Scan with DID Wallet",emailTitle:"Continue with Email",emailSubmit:"Send Code",emailSending:"Sending code...",emailSent:"We sent an 8-digit code to {email}",emailCodePlaceholder:"8-digit code",emailVerify:"Verify",emailResend:"Resend code",emailInvalid:"Please enter a valid email address.",emailCodeInvalid:"Please enter the 8-digit code."},zh:{emailExplanation:"\u6211\u4EEC\u4F1A\u53D1\u9001\u9A8C\u8BC1\u7801\uFF0C\u65E0\u9700\u5BC6\u7801\u3002",otherMethods:"\u5176\u4ED6\u767B\u5F55\u65B9\u5F0F",passkeyCreateAccount:"\u4F7F\u7528 Passkey \u521B\u5EFA\u8D26\u6237",lastUsed:"\u4E0A\u6B21\u4F7F\u7528",passkeyExplanation:"\u4F7F\u7528\u6307\u7EB9\u3001\u9762\u5BB9\u6216\u8BBE\u5907\u89E3\u9501\u65B9\u5F0F\u521B\u5EFA\u65B0\u8D26\u6237\uFF0C\u65E0\u9700\u5BC6\u7801\u3002\u8BBE\u5907\u4F1A\u63D0\u793A\u4FDD\u5B58 Passkey\u3002\u5DF2\u6709\u8D26\u6237\uFF1F\u8BF7\u8FD4\u56DE\u767B\u5F55\u3002",continueWith:"\u4F7F\u7528 {provider} \u7EE7\u7EED",oauthWaiting:"\u8BF7\u5728 {provider} \u7A97\u53E3\u4E2D\u7EE7\u7EED",oauthIncomplete:"\u767B\u5F55\u5C1A\u672A\u5B8C\u6210\u3002\u60A8\u53EF\u4EE5\u91CD\u65B0\u6253\u5F00\u7A97\u53E3\u6216\u9009\u62E9\u5176\u4ED6\u65B9\u5F0F\u3002",oauthReopen:"\u91CD\u65B0\u6253\u5F00\u7A97\u53E3",oauthUnconfirmed:"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u767B\u5F55\u7ED3\u679C\u3002\u8BF7\u5148\u91CD\u65B0\u52A0\u8F7D\u9875\u9762\u68C0\u67E5\u767B\u5F55\u72B6\u6001\uFF0C\u518D\u51B3\u5B9A\u662F\u5426\u91CD\u8BD5\u3002",oauthCheckSession:"\u91CD\u65B0\u52A0\u8F7D\u5E76\u68C0\u67E5\u767B\u5F55\u72B6\u6001",oauthCancelled:"\u5DF2\u505C\u6B62\u7B49\u5F85\u767B\u5F55\u3002\u82E5\u6388\u6743\u7A97\u53E3\u4ECD\u7136\u6253\u5F00\uFF0C\u8BF7\u5173\u95ED\u540E\u518D\u91CD\u8BD5\u3002",oauthDenied:"\u60A8\u672A\u540C\u610F\u6388\u6743\u3002\u53EF\u4EE5\u91CD\u8BD5\u6216\u9009\u62E9\u5176\u4ED6\u767B\u5F55\u65B9\u5F0F\u3002",oauthBlocked:"\u6D4F\u89C8\u5668\u62E6\u622A\u4E86\u767B\u5F55\u7A97\u53E3\u3002\u8BF7\u91CD\u65B0\u6253\u5F00\uFF0C\u6216\u5728\u5F53\u524D\u9875\u9762\u7EE7\u7EED\u3002",oauthTimedOut:"\u767B\u5F55\u7B49\u5F85\u5DF2\u8D85\u65F6\u3002\u8BF7\u91CD\u65B0\u6253\u5F00\u7A97\u53E3\u518D\u8BD5\u3002",oauthFailed:"\u672A\u80FD\u5B8C\u6210\u767B\u5F55\u3002\u8BF7\u91CD\u8BD5\u6216\u9009\u62E9\u5176\u4ED6\u65B9\u5F0F\u3002",oauthFullPage:"\u5728\u5F53\u524D\u9875\u9762\u7EE7\u7EED",emailEdit:"\u4FEE\u6539\u90AE\u7BB1",emailCooldown:"{seconds} \u79D2\u540E\u91CD\u53D1",walletRetry:"\u94B1\u5305\u672A\u6253\u5F00\uFF1F\u8BF7\u91CD\u8BD5\u6216\u626B\u63CF\u4E8C\u7EF4\u7801\u3002",tryAgain:"\u91CD\u8BD5",signIn:"\u767B\u5F55\u6216\u521B\u5EFA\u8D26\u6237",signInTo:"\u767B\u5F55\u6216\u52A0\u5165 {appName}",passkeyButton:"\u4F7F\u7528 Passkey \u7EE7\u7EED",passkeySignIn:"\u4F7F\u7528 Passkey \u767B\u5F55",passkeyCreate:"\u521B\u5EFA Passkey",passkeyFirstTime:"\u9996\u6B21\u4F7F\u7528\uFF1F\u521B\u5EFA\u8D26\u6237",passkeyBackToSignIn:"\u8FD4\u56DE\u767B\u5F55",passkeyWaiting:"\u6B63\u5728\u7B49\u5F85 Passkey\u2026",passkeyCreating:"\u6B63\u5728\u521B\u5EFA Passkey\u2026",passkeyNoLocal:"\u8FD9\u6B21\u672A\u5B8C\u6210 Passkey \u9A8C\u8BC1\u3002\u8BF7\u91CD\u8BD5\u3001\u4F7F\u7528\u5176\u4ED6\u8BBE\u5907\uFF0C\u6216\u9009\u62E9\u5176\u4ED6\u767B\u5F55\u65B9\u5F0F\u3002",passkeyUseAnotherDevice:"\u7528\u5176\u4ED6\u8BBE\u5907\u767B\u5F55",passkeyCreateInstead:"\u9996\u6B21\u4F7F\u7528\uFF1F\u521B\u5EFA\u8D26\u6237",didWalletButton:"\u4F7F\u7528 DID Wallet \u7EE7\u7EED",didWalletButtonShort:"DID Wallet",scanWithWallet:"\u8BF7\u4F7F\u7528 DID Wallet \u626B\u7801",waitingWallet:"\u6B63\u5728\u8BF7\u6C42\u8FDE\u63A5",walletContinue:"\u8BF7\u5728 DID Wallet \u4E2D\u7EE7\u7EED\u5B8C\u6210\u60A8\u7684\u64CD\u4F5C",noPasskey:"\u672A\u627E\u5230\u5DF2\u6709 Passkey\u3002\u8F93\u5165\u540D\u79F0\u5E76\u521B\u5EFA\u4E00\u4E2A\u3002",success:"\u6210\u529F",timeout:"\u4F1A\u8BDD\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002",refreshQR:"\u5237\u65B0",namePlaceholder:"\u60A8\u7684\u540D\u5B57\uFF08\u53EF\u9009\uFF09",or:"\u6216",emailPlaceholder:"\u90AE\u7BB1\u5730\u5740",emailButton:"\u90AE\u7BB1",passkeyUnsupported:"\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Passkey \u8BA4\u8BC1\u3002",connecting:"\u8FDE\u63A5\u4E2D...",verifying:"\u9A8C\u8BC1\u4E2D...",openInWallet:"\u5728 DID Wallet \u4E2D\u6253\u5F00",authFailed:"\u8BA4\u8BC1\u5931\u8D25",registrationFailed:"\u6CE8\u518C\u5931\u8D25",passkeySetupFailed:"Passkey \u8BBE\u7F6E\u5931\u8D25",accessDenied:"\u8BBF\u95EE\u88AB\u62D2\u7EDD\uFF1A\u60A8\u7684\u8D26\u6237\u65E0\u6743\u767B\u5F55\u6B64\u7AD9\u70B9\u3002",regClosed:"\u6CE8\u518C\u9700\u8981\u9080\u8BF7\u3002",federatedBy:"\u8BA4\u8BC1\u670D\u52A1\u7531 {masterName} \u63D0\u4F9B",securedBy:"\u7531 DID Connect \u63D0\u4F9B\u5B89\u5168\u4FDD\u969C",privacy:"\u9690\u79C1",terms:"\u6761\u6B3E",back:"\u8FD4\u56DE",cancel:"\u53D6\u6D88",scanTitle:"\u4F7F\u7528 DID Wallet \u626B\u7801",emailTitle:"\u4F7F\u7528\u90AE\u7BB1\u7EE7\u7EED",emailSubmit:"\u53D1\u9001\u9A8C\u8BC1\u7801",emailSending:"\u6B63\u5728\u53D1\u9001\u9A8C\u8BC1\u7801...",emailSent:"\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 {email}",emailCodePlaceholder:"8 \u4F4D\u9A8C\u8BC1\u7801",emailVerify:"\u9A8C\u8BC1",emailResend:"\u91CD\u65B0\u53D1\u9001",emailInvalid:"\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740\u3002",emailCodeInvalid:"\u8BF7\u8F93\u5165 8 \u4F4D\u9A8C\u8BC1\u7801\u3002"},"zh-TW":{emailExplanation:"\u6211\u5011\u6703\u50B3\u9001\u9A57\u8B49\u78BC\uFF0C\u7121\u9700\u5BC6\u78BC\u3002",otherMethods:"\u5176\u4ED6\u767B\u5165\u65B9\u5F0F",passkeyCreateAccount:"\u4F7F\u7528 Passkey \u5EFA\u7ACB\u5E33\u6236",lastUsed:"\u4E0A\u6B21\u4F7F\u7528",passkeyExplanation:"\u4F7F\u7528\u6307\u7D0B\u3001\u9762\u5BB9\u6216\u88DD\u7F6E\u89E3\u9396\u65B9\u5F0F\u5EFA\u7ACB\u65B0\u5E33\u6236\uFF0C\u7121\u9700\u5BC6\u78BC\u3002\u88DD\u7F6E\u6703\u63D0\u793A\u5132\u5B58 Passkey\u3002\u5DF2\u6709\u5E33\u6236\uFF1F\u8ACB\u8FD4\u56DE\u767B\u5165\u3002",continueWith:"\u4F7F\u7528 {provider} \u7E7C\u7E8C",oauthWaiting:"\u8ACB\u5728 {provider} \u8996\u7A97\u4E2D\u7E7C\u7E8C",oauthIncomplete:"\u767B\u5165\u5C1A\u672A\u5B8C\u6210\u3002\u60A8\u53EF\u4EE5\u91CD\u65B0\u958B\u555F\u8996\u7A97\u6216\u9078\u64C7\u5176\u4ED6\u65B9\u5F0F\u3002",oauthReopen:"\u91CD\u65B0\u958B\u555F\u8996\u7A97",oauthUnconfirmed:"\u66AB\u6642\u7121\u6CD5\u78BA\u8A8D\u767B\u5165\u7D50\u679C\u3002\u8ACB\u5148\u91CD\u65B0\u8F09\u5165\u9801\u9762\u6AA2\u67E5\u767B\u5165\u72C0\u614B\uFF0C\u518D\u6C7A\u5B9A\u662F\u5426\u91CD\u8A66\u3002",oauthCheckSession:"\u91CD\u65B0\u8F09\u5165\u4E26\u6AA2\u67E5\u767B\u5165\u72C0\u614B",oauthCancelled:"\u5DF2\u505C\u6B62\u7B49\u5F85\u767B\u5165\u3002\u82E5\u6388\u6B0A\u8996\u7A97\u4ECD\u7136\u958B\u555F\uFF0C\u8ACB\u95DC\u9589\u5F8C\u518D\u91CD\u8A66\u3002",oauthDenied:"\u60A8\u672A\u540C\u610F\u6388\u6B0A\u3002\u53EF\u4EE5\u91CD\u8A66\u6216\u9078\u64C7\u5176\u4ED6\u767B\u5165\u65B9\u5F0F\u3002",oauthBlocked:"\u700F\u89BD\u5668\u5C01\u9396\u4E86\u767B\u5165\u8996\u7A97\u3002\u8ACB\u91CD\u65B0\u958B\u555F\uFF0C\u6216\u5728\u76EE\u524D\u9801\u9762\u7E7C\u7E8C\u3002",oauthTimedOut:"\u767B\u5165\u7B49\u5F85\u5DF2\u903E\u6642\u3002\u8ACB\u91CD\u65B0\u958B\u555F\u8996\u7A97\u518D\u8A66\u3002",oauthFailed:"\u672A\u80FD\u5B8C\u6210\u767B\u5165\u3002\u8ACB\u91CD\u8A66\u6216\u9078\u64C7\u5176\u4ED6\u65B9\u5F0F\u3002",oauthFullPage:"\u5728\u76EE\u524D\u9801\u9762\u7E7C\u7E8C",emailEdit:"\u4FEE\u6539\u96FB\u5B50\u90F5\u4EF6",emailCooldown:"{seconds} \u79D2\u5F8C\u91CD\u65B0\u50B3\u9001",walletRetry:"\u9322\u5305\u672A\u958B\u555F\uFF1F\u8ACB\u91CD\u8A66\u6216\u6383\u78BC\u3002",tryAgain:"\u91CD\u8A66",signIn:"\u767B\u5165\u6216\u5EFA\u7ACB\u5E33\u6236",signInTo:"\u767B\u5165\u6216\u52A0\u5165 {appName}",passkeyButton:"\u4F7F\u7528 Passkey \u7E7C\u7E8C",passkeySignIn:"\u4F7F\u7528 Passkey \u767B\u5165",passkeyCreate:"\u5EFA\u7ACB Passkey",passkeyFirstTime:"\u7B2C\u4E00\u6B21\u4F7F\u7528\uFF1F\u5EFA\u7ACB\u5E33\u6236",passkeyBackToSignIn:"\u8FD4\u56DE\u767B\u5165",passkeyWaiting:"\u6B63\u5728\u7B49\u5F85 Passkey\u2026",passkeyCreating:"\u6B63\u5728\u5EFA\u7ACB Passkey\u2026",passkeyNoLocal:"\u9019\u6B21\u672A\u5B8C\u6210 Passkey \u9A57\u8B49\u3002\u8ACB\u91CD\u8A66\u3001\u4F7F\u7528\u5176\u4ED6\u88DD\u7F6E\uFF0C\u6216\u9078\u64C7\u5176\u4ED6\u767B\u5165\u65B9\u5F0F\u3002",passkeyUseAnotherDevice:"\u7528\u5176\u4ED6\u88DD\u7F6E\u767B\u5165",passkeyCreateInstead:"\u7B2C\u4E00\u6B21\u4F7F\u7528\uFF1F\u5EFA\u7ACB\u5E33\u6236",didWalletButton:"\u4F7F\u7528 DID Wallet \u7E7C\u7E8C",didWalletButtonShort:"DID Wallet",scanWithWallet:"\u8ACB\u4F7F\u7528 DID Wallet \u6383\u78BC",waitingWallet:"\u6B63\u5728\u8981\u6C42\u9023\u7DDA",walletContinue:"\u8ACB\u5728 DID Wallet \u4E2D\u7E7C\u7E8C\u5B8C\u6210\u60A8\u7684\u64CD\u4F5C",noPasskey:"\u672A\u627E\u5230\u5DF2\u6709 Passkey\u3002\u8F38\u5165\u540D\u7A31\u4E26\u5EFA\u7ACB\u4E00\u500B\u3002",success:"\u6210\u529F",timeout:"\u5DE5\u4F5C\u968E\u6BB5\u903E\u6642\uFF0C\u8ACB\u91CD\u8A66\u3002",refreshQR:"\u91CD\u65B0\u6574\u7406",namePlaceholder:"\u60A8\u7684\u540D\u5B57\uFF08\u9078\u586B\uFF09",or:"\u6216",emailPlaceholder:"\u96FB\u5B50\u90F5\u4EF6\u5730\u5740",emailButton:"\u96FB\u5B50\u90F5\u4EF6",passkeyUnsupported:"\u60A8\u7684\u700F\u89BD\u5668\u4E0D\u652F\u63F4 Passkey \u8A8D\u8B49\u3002",connecting:"\u9023\u7DDA\u4E2D...",verifying:"\u9A57\u8B49\u4E2D...",openInWallet:"\u5728 DID Wallet \u4E2D\u958B\u555F",authFailed:"\u8A8D\u8B49\u5931\u6557",registrationFailed:"\u8A3B\u518A\u5931\u6557",passkeySetupFailed:"Passkey \u8A2D\u5B9A\u5931\u6557",accessDenied:"\u5B58\u53D6\u88AB\u62D2\u7D55\uFF1A\u60A8\u7684\u5E33\u865F\u7121\u6B0A\u767B\u5165\u6B64\u7DB2\u7AD9\u3002",regClosed:"\u8A3B\u518A\u9700\u8981\u9080\u8ACB\u3002",federatedBy:"\u8A8D\u8B49\u670D\u52D9\u7531 {masterName} \u63D0\u4F9B",securedBy:"\u7531 DID Connect \u63D0\u4F9B\u5B89\u5168\u4FDD\u969C",privacy:"\u96B1\u79C1",terms:"\u689D\u6B3E",back:"\u8FD4\u56DE",cancel:"\u53D6\u6D88",scanTitle:"\u4F7F\u7528 DID Wallet \u6383\u78BC",emailTitle:"\u4F7F\u7528\u96FB\u5B50\u90F5\u4EF6\u7E7C\u7E8C",emailSubmit:"\u50B3\u9001\u9A57\u8B49\u78BC",emailSending:"\u6B63\u5728\u50B3\u9001\u9A57\u8B49\u78BC...",emailSent:"\u9A57\u8B49\u78BC\u5DF2\u50B3\u9001\u81F3 {email}",emailCodePlaceholder:"8 \u4F4D\u6578\u9A57\u8B49\u78BC",emailVerify:"\u9A57\u8B49",emailResend:"\u91CD\u65B0\u50B3\u9001",emailInvalid:"\u8ACB\u8F38\u5165\u6709\u6548\u7684\u96FB\u5B50\u90F5\u4EF6\u5730\u5740\u3002",emailCodeInvalid:"\u8ACB\u8F38\u5165 8 \u4F4D\u6578\u9A57\u8B49\u78BC\u3002"},ja:{emailExplanation:"\u78BA\u8A8D\u30B3\u30FC\u30C9\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u4E0D\u8981\u3067\u3059\u3002",otherMethods:"\u4ED6\u306E\u30ED\u30B0\u30A4\u30F3\u65B9\u6CD5",passkeyCreateAccount:"Passkey \u3067\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F5C\u6210",lastUsed:"\u524D\u56DE\u4F7F\u7528",passkeyExplanation:"\u6307\u7D0B\u3001\u9854\u8A8D\u8A3C\u3001\u307E\u305F\u306F\u30C7\u30D0\u30A4\u30B9\u306E\u30ED\u30C3\u30AF\u89E3\u9664\u3067\u65B0\u3057\u3044\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F5C\u6210\u3057\u307E\u3059\u3002\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u4E0D\u8981\u3067\u3059\u3002\u30C7\u30D0\u30A4\u30B9\u304C Passkey \u306E\u4FDD\u5B58\u3092\u6C42\u3081\u307E\u3059\u3002\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u304A\u6301\u3061\u3067\u3059\u304B\uFF1F\u30ED\u30B0\u30A4\u30F3\u306B\u623B\u3063\u3066\u304F\u3060\u3055\u3044\u3002",continueWith:"{provider} \u3067\u7D9A\u3051\u308B",oauthWaiting:"{provider} \u306E\u30A6\u30A3\u30F3\u30C9\u30A6\u3067\u7D9A\u3051\u3066\u304F\u3060\u3055\u3044",oauthIncomplete:"\u30ED\u30B0\u30A4\u30F3\u306F\u307E\u3060\u5B8C\u4E86\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u958B\u304D\u76F4\u3059\u304B\u3001\u5225\u306E\u65B9\u6CD5\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",oauthReopen:"\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u958B\u304D\u76F4\u3059",oauthUnconfirmed:"\u30ED\u30B0\u30A4\u30F3\u7D50\u679C\u3092\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u306E\u524D\u306B\u30DA\u30FC\u30B8\u3092\u518D\u8AAD\u307F\u8FBC\u307F\u3057\u3066\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",oauthCheckSession:"\u518D\u8AAD\u307F\u8FBC\u307F\u3057\u3066\u30ED\u30B0\u30A4\u30F3\u3092\u78BA\u8A8D",oauthCancelled:"\u30ED\u30B0\u30A4\u30F3\u306E\u5F85\u6A5F\u3092\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002\u8A8D\u8A3C\u30A6\u30A3\u30F3\u30C9\u30A6\u304C\u958B\u3044\u3066\u3044\u308B\u5834\u5408\u306F\u3001\u9589\u3058\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",oauthDenied:"\u8A8D\u8A3C\u304C\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u3059\u308B\u304B\u3001\u5225\u306E\u65B9\u6CD5\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",oauthBlocked:"\u30D6\u30E9\u30A6\u30B6\u304C\u30ED\u30B0\u30A4\u30F3\u753B\u9762\u3092\u30D6\u30ED\u30C3\u30AF\u3057\u307E\u3057\u305F\u3002\u958B\u304D\u76F4\u3059\u304B\u3001\u3053\u306E\u30DA\u30FC\u30B8\u3067\u7D9A\u3051\u3066\u304F\u3060\u3055\u3044\u3002",oauthTimedOut:"\u30ED\u30B0\u30A4\u30F3\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\u3002\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u958B\u304D\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",oauthFailed:"\u30ED\u30B0\u30A4\u30F3\u3092\u5B8C\u4E86\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u3059\u308B\u304B\u3001\u5225\u306E\u65B9\u6CD5\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",oauthFullPage:"\u3053\u306E\u30DA\u30FC\u30B8\u3067\u7D9A\u3051\u308B",emailEdit:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5909\u66F4",emailCooldown:"{seconds} \u79D2\u5F8C\u306B\u518D\u9001\u4FE1",walletRetry:"\u30A6\u30A9\u30EC\u30C3\u30C8\u304C\u958B\u304B\u306A\u3044\u5834\u5408\u306F\u3001\u518D\u8A66\u884C\u3059\u308B\u304B QR \u30B3\u30FC\u30C9\u3092\u30B9\u30AD\u30E3\u30F3\u3057\u3066\u304F\u3060\u3055\u3044\u3002",tryAgain:"\u518D\u8A66\u884C",signIn:"\u30ED\u30B0\u30A4\u30F3\u307E\u305F\u306F\u30A2\u30AB\u30A6\u30F3\u30C8\u4F5C\u6210",signInTo:"{appName} \u306B\u30ED\u30B0\u30A4\u30F3\u307E\u305F\u306F\u53C2\u52A0",passkeyButton:"Passkey \u3067\u7D9A\u3051\u308B",passkeySignIn:"Passkey \u3067\u30ED\u30B0\u30A4\u30F3",passkeyCreate:"Passkey \u3092\u4F5C\u6210",passkeyFirstTime:"\u521D\u3081\u3066\u3067\u3059\u304B\uFF1F\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F5C\u6210",passkeyBackToSignIn:"\u30ED\u30B0\u30A4\u30F3\u306B\u623B\u308B",passkeyWaiting:"Passkey \u3092\u5F85\u3063\u3066\u3044\u307E\u3059\u2026",passkeyCreating:"Passkey \u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059\u2026",passkeyNoLocal:"\u4ECA\u56DE\u306F Passkey \u306E\u78BA\u8A8D\u304C\u5B8C\u4E86\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u3059\u308B\u304B\u3001\u5225\u306E\u30C7\u30D0\u30A4\u30B9\u3092\u4F7F\u3046\u304B\u3001\u5225\u306E\u65B9\u6CD5\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",passkeyUseAnotherDevice:"\u5225\u306E\u30C7\u30D0\u30A4\u30B9\u3092\u4F7F\u7528",passkeyCreateInstead:"\u521D\u3081\u3066\u3067\u3059\u304B\uFF1F\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F5C\u6210",didWalletButton:"DID Wallet \u3067\u7D9A\u3051\u308B",didWalletButtonShort:"DID Wallet",scanWithWallet:"DID Wallet \u3067\u30B9\u30AD\u30E3\u30F3\u3057\u3066\u304F\u3060\u3055\u3044",waitingWallet:"\u63A5\u7D9A\u3092\u8981\u6C42\u3057\u3066\u3044\u307E\u3059",walletContinue:"DID Wallet \u3067\u64CD\u4F5C\u3092\u7D9A\u3051\u3066\u304F\u3060\u3055\u3044",noPasskey:"\u65E2\u5B58\u306E Passkey \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u540D\u524D\u3092\u5165\u529B\u3057\u3066\u4F5C\u6210\u3057\u3066\u304F\u3060\u3055\u3044\u3002",success:"\u6210\u529F\u3057\u307E\u3057\u305F",timeout:"\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",refreshQR:"\u66F4\u65B0",namePlaceholder:"\u304A\u540D\u524D\uFF08\u4EFB\u610F\uFF09",or:"\u307E\u305F\u306F",emailPlaceholder:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",emailButton:"\u30E1\u30FC\u30EB",passkeyUnsupported:"\u304A\u4F7F\u3044\u306E\u30D6\u30E9\u30A6\u30B6\u30FC\u306F Passkey \u8A8D\u8A3C\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093\u3002",connecting:"\u63A5\u7D9A\u3057\u3066\u3044\u307E\u3059...",verifying:"\u78BA\u8A8D\u3057\u3066\u3044\u307E\u3059...",openInWallet:"DID Wallet \u3067\u958B\u304F",authFailed:"\u8A8D\u8A3C\u306B\u5931\u6557\u3057\u307E\u3057\u305F",registrationFailed:"\u767B\u9332\u306B\u5931\u6557\u3057\u307E\u3057\u305F",passkeySetupFailed:"Passkey \u306E\u8A2D\u5B9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F",accessDenied:"\u30A2\u30AF\u30BB\u30B9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\uFF1A\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30ED\u30B0\u30A4\u30F3\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",regClosed:"\u767B\u9332\u306B\u306F\u62DB\u5F85\u304C\u5FC5\u8981\u3067\u3059\u3002",federatedBy:"\u8A8D\u8A3C\u30B5\u30FC\u30D3\u30B9\u306F {masterName} \u304C\u63D0\u4F9B\u3057\u3066\u3044\u307E\u3059",securedBy:"DID Connect \u306B\u3088\u308A\u4FDD\u8B77\u3055\u308C\u3066\u3044\u307E\u3059",privacy:"\u30D7\u30E9\u30A4\u30D0\u30B7\u30FC",terms:"\u5229\u7528\u898F\u7D04",back:"\u623B\u308B",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",scanTitle:"DID Wallet \u3067\u30B9\u30AD\u30E3\u30F3",emailTitle:"\u30E1\u30FC\u30EB\u3067\u7D9A\u3051\u308B",emailSubmit:"\u30B3\u30FC\u30C9\u3092\u9001\u4FE1",emailSending:"\u30B3\u30FC\u30C9\u3092\u9001\u4FE1\u3057\u3066\u3044\u307E\u3059...",emailSent:"{email} \u306B 8 \u6841\u306E\u30B3\u30FC\u30C9\u3092\u9001\u4FE1\u3057\u307E\u3057\u305F",emailCodePlaceholder:"8 \u6841\u306E\u30B3\u30FC\u30C9",emailVerify:"\u78BA\u8A8D",emailResend:"\u30B3\u30FC\u30C9\u3092\u518D\u9001\u4FE1",emailInvalid:"\u6709\u52B9\u306A\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",emailCodeInvalid:"8 \u6841\u306E\u30B3\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}},pe=[{code:"en",label:"English"},{code:"zh",label:"\u4E2D\u6587"}];function b(t,e,r){let n=e&&he[e]?e:"en",i=he[n][t]??he.en[t]??t;if(r)for(let[a,s]of Object.entries(r))i=i.replace(new RegExp(`\\{${a}\\}`,"g"),s);return i}var fe='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M3 20v-2.8q0-.85.438-1.562T4.6 14.55q1.55-.775 3.15-1.162T11 13q.5 0 1 .038t1 .112q-.1 1.45.525 2.738T15.35 18v2zm16 3l-1.5-1.5v-4.65q-1.1-.325-1.8-1.237T15 13.5q0-1.45 1.025-2.475T18.5 10t2.475 1.025T22 13.5q0 1.125-.638 2t-1.612 1.25L21 18l-1.5 1.5L21 21zm-8-11q-1.65 0-2.825-1.175T7 8t1.175-2.825T11 4t2.825 1.175T15 8t-1.175 2.825T11 12m7.5 2q.425 0 .713-.288T19.5 13t-.288-.712T18.5 12t-.712.288T17.5 13t.288.713t.712.287"/></svg>',ve='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><rect x="2" y="4" width="20" height="16" rx="3" fill="#4598FA"/><rect x="3" y="6" width="18" height="12" rx="2" fill="white" opacity="0.9"/><rect x="0" y="14" width="24" height="10" rx="0" fill="url(#dw_g)"/><path d="M5.5 9.5h4.5c.3 0 .5.2.5.5v2.5c0 .3-.2.5-.5.5H5.5c-.3 0-.5-.2-.5-.5V10c0-.3.2-.5.5-.5z" fill="#4598FA"/><defs><linearGradient id="dw_g" x1="12" y1="14" x2="12" y2="24" gradientUnits="userSpaceOnUse"><stop stop-color="#77B2F6"/><stop offset="1" stop-color="#4598FA"/></linearGradient></defs></svg>',qe='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M22 7.535V17a3 3 0 0 1-2.824 2.995L19 20H5a3 3 0 0 1-2.995-2.824L2 17V7.535l9.445 6.297l.116.066a1 1 0 0 0 .878 0l.116-.066z"/><path fill="currentColor" d="M19 4c1.08 0 2.027.57 2.555 1.427L12 11.797l-9.555-6.37a2.999 2.999 0 0 1 2.354-1.42L5 4z"/></svg>',Ve='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12c5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z"/></svg>',ke='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M20 11H7.83l5.59-5.59L12 4l-8 8l8 8l1.41-1.41L7.83 13H20z"/></svg>',je={google:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 262"><path fill="#4285F4" d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"/><path fill="#34A853" d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"/><path fill="#FBBC05" d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"/><path fill="#EB4335" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"/></svg>',github:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 250" fill="currentColor"><path d="M128.001 0C57.317 0 0 57.307 0 128.001c0 56.554 36.676 104.535 87.535 121.46c6.397 1.185 8.746-2.777 8.746-6.158c0-3.052-.12-13.135-.174-23.83c-35.61 7.742-43.124-15.103-43.124-15.103c-5.823-14.795-14.213-18.73-14.213-18.73c-11.613-7.944.876-7.78.876-7.78c12.853.902 19.621 13.19 19.621 13.19c11.417 19.568 29.945 13.911 37.249 10.64c1.149-8.272 4.466-13.92 8.127-17.116c-28.431-3.236-58.318-14.212-58.318-63.258c0-13.975 5-25.394 13.188-34.358c-1.329-3.224-5.71-16.242 1.24-33.874c0 0 10.749-3.44 35.21 13.121c10.21-2.836 21.16-4.258 32.038-4.307c10.878.049 21.837 1.47 32.066 4.307c24.431-16.56 35.165-13.12 35.165-13.12c6.967 17.63 2.584 30.65 1.255 33.873c8.207 8.964 13.173 20.383 13.173 34.358c0 49.163-29.944 59.988-58.447 63.157c4.591 3.972 8.682 11.762 8.682 23.704c0 17.126-.148 30.91-.148 35.126c0 3.407 2.304 7.398 8.792 6.14C219.37 232.5 256 184.537 256 128.002C256 57.307 198.691 0 128.001 0"/></svg>',apple:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 315" fill="currentColor"><path d="M213.803 167.03c.442 47.58 41.74 63.413 42.197 63.615c-.35 1.116-6.599 22.563-21.757 44.716c-13.104 19.153-26.705 38.235-48.13 38.63c-21.05.388-27.82-12.483-51.888-12.483c-24.061 0-31.582 12.088-51.51 12.871c-20.68.783-36.428-20.71-49.64-39.793c-27-39.033-47.633-110.3-19.928-158.406c13.763-23.89 38.36-39.017 65.056-39.405c20.307-.388 39.475 13.675 51.889 13.675c12.406 0 35.699-16.895 60.186-14.414c10.25.427 39.026 4.14 57.503 31.186c-1.49.923-34.335 20.044-33.978 59.808M174.24 50.199c10.98-13.29 18.369-31.79 16.353-50.199c-15.826.636-34.962 10.546-46.314 23.828c-10.173 11.763-19.082 30.589-16.678 48.633c17.64 1.365 35.66-8.964 46.639-22.262"/></svg>',twitter:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 256" fill="currentColor"><path d="M149.079 108.399L242.33 0h-22.098l-80.97 94.12L74.59 0H0l97.796 142.328L0 256h22.1l85.507-99.395L175.905 256h74.59L149.073 108.399zM118.81 143.58l-9.909-14.172l-78.84-112.773h33.943l63.625 91.011l9.909 14.173l82.705 118.3H186.3l-67.49-96.533z"/></svg>',auth0:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 256"><path fill="#EB5424" d="M203.97 200.38L167.47 88l-39.5 112.38h75.98zm0-144.76L167.47 168l75.97-26.16l19.76-60.82c6.64-20.4-1.94-42.72-21.18-52.76l-38.06 27.36zM52.03 55.62L88.54 168l39.5-112.38H52.02zM52.03 200.38L88.54 88L12.56 114.16l-5.92 18.2c-6.64 20.4 1.94 42.72 21.18 52.76l24.2-17.38l.01.01v-.01l-.01.01.01-.37z"/></svg>',facebook:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 256"><path fill="#1877F2" d="M256 128C256 57.308 198.692 0 128 0S0 57.308 0 128c0 63.888 46.808 116.843 108 126.445V165H75.5v-37H108V99.8c0-32.08 19.11-49.8 48.348-49.8C170.352 50 185 52.5 185 52.5V84h-16.14C152.959 84 148 93.867 148 103.99V128h35.5l-5.675 37H148v89.445c61.192-9.602 108-62.556 108-126.445"/></svg>'},Be='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2m-1 17.93c-3.95-.49-7-3.85-7-7.93c0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41c0 2.08-.8 3.97-2.1 5.39"/></svg>';function Ye(t){return je[t.toLowerCase()]??""}var Z=function(t,e){let i=t,a=re[e],s=null,o=0,c=null,u=[],f={},p=function(d,m){o=i*4+17,s=(function(h){let g=new Array(h);for(let y=0;y<h;y+=1){g[y]=new Array(h);for(let x=0;x<h;x+=1)g[y][x]=null}return g})(o),l(0,0),l(o-7,0),l(0,o-7),D(),v(),F(d,m),i>=7&&C(d),c==null&&(c=W(i,a,u)),B(c,m)},l=function(d,m){for(let h=-1;h<=7;h+=1)if(!(d+h<=-1||o<=d+h))for(let g=-1;g<=7;g+=1)m+g<=-1||o<=m+g||(0<=h&&h<=6&&(g==0||g==6)||0<=g&&g<=6&&(h==0||h==6)||2<=h&&h<=4&&2<=g&&g<=4?s[d+h][m+g]=!0:s[d+h][m+g]=!1)},E=function(){let d=0,m=0;for(let h=0;h<8;h+=1){p(!0,h);let g=Q.getLostPoint(f);(h==0||d>g)&&(d=g,m=h)}return m},v=function(){for(let d=8;d<o-8;d+=1)s[d][6]==null&&(s[d][6]=d%2==0);for(let d=8;d<o-8;d+=1)s[6][d]==null&&(s[6][d]=d%2==0)},D=function(){let d=Q.getPatternPosition(i);for(let m=0;m<d.length;m+=1)for(let h=0;h<d.length;h+=1){let g=d[m],y=d[h];if(s[g][y]==null)for(let x=-2;x<=2;x+=1)for(let w=-2;w<=2;w+=1)x==-2||x==2||w==-2||w==2||x==0&&w==0?s[g+x][y+w]=!0:s[g+x][y+w]=!1}},C=function(d){let m=Q.getBCHTypeNumber(i);for(let h=0;h<18;h+=1){let g=!d&&(m>>h&1)==1;s[Math.floor(h/3)][h%3+o-8-3]=g}for(let h=0;h<18;h+=1){let g=!d&&(m>>h&1)==1;s[h%3+o-8-3][Math.floor(h/3)]=g}},F=function(d,m){let h=a<<3|m,g=Q.getBCHTypeInfo(h);for(let y=0;y<15;y+=1){let x=!d&&(g>>y&1)==1;y<6?s[y][8]=x:y<8?s[y+1][8]=x:s[o-15+y][8]=x}for(let y=0;y<15;y+=1){let x=!d&&(g>>y&1)==1;y<8?s[8][o-y-1]=x:y<9?s[8][15-y-1+1]=x:s[8][15-y-1]=x}s[o-8][8]=!d},B=function(d,m){let h=-1,g=o-1,y=7,x=0,w=Q.getMaskFunction(m);for(let T=o-1;T>0;T-=2)for(T==6&&(T-=1);;){for(let S=0;S<2;S+=1)if(s[g][T-S]==null){let P=!1;x<d.length&&(P=(d[x]>>>y&1)==1),w(g,T-S)&&(P=!P),s[g][T-S]=P,y-=1,y==-1&&(x+=1,y=7)}if(g+=h,g<0||o<=g){g-=h,h=-h;break}}},R=function(d,m){let h=0,g=0,y=0,x=new Array(m.length),w=new Array(m.length);for(let k=0;k<m.length;k+=1){let N=m[k].dataCount,A=m[k].totalCount-N;g=Math.max(g,N),y=Math.max(y,A),x[k]=new Array(N);for(let j=0;j<x[k].length;j+=1)x[k][j]=255&d.getBuffer()[j+h];h+=N;let z=Q.getErrorCorrectPolynomial(A),V=ie(x[k],z.getLength()-1).mod(z);w[k]=new Array(z.getLength()-1);for(let j=0;j<w[k].length;j+=1){let ae=j+V.getLength()-w[k].length;w[k][j]=ae>=0?V.getAt(ae):0}}let T=0;for(let k=0;k<m.length;k+=1)T+=m[k].totalCount;let S=new Array(T),P=0;for(let k=0;k<g;k+=1)for(let N=0;N<m.length;N+=1)k<x[N].length&&(S[P]=x[N][k],P+=1);for(let k=0;k<y;k+=1)for(let N=0;N<m.length;N+=1)k<w[N].length&&(S[P]=w[N][k],P+=1);return S},W=function(d,m,h){let g=Ae.getRSBlocks(d,m),y=De();for(let w=0;w<h.length;w+=1){let T=h[w];y.put(T.getMode(),4),y.put(T.getLength(),Q.getLengthInBits(T.getMode(),d)),T.write(y)}let x=0;for(let w=0;w<g.length;w+=1)x+=g[w].dataCount;if(y.getLengthInBits()>x*8)throw"code length overflow. ("+y.getLengthInBits()+">"+x*8+")";for(y.getLengthInBits()+4<=x*8&&y.put(0,4);y.getLengthInBits()%8!=0;)y.putBit(!1);for(;!(y.getLengthInBits()>=x*8||(y.put(236,8),y.getLengthInBits()>=x*8));)y.put(17,8);return R(y,g)};f.addData=function(d,m){m=m||"Byte";let h=null;switch(m){case"Numeric":h=Qe(d);break;case"Alphanumeric":h=Ge(d);break;case"Byte":h=Je(d);break;case"Kanji":h=Xe(d);break;default:throw"mode:"+m}u.push(h),c=null},f.isDark=function(d,m){if(d<0||o<=d||m<0||o<=m)throw d+","+m;return s[d][m]},f.getModuleCount=function(){return o},f.make=function(){if(i<1){let d=1;for(;d<40;d++){let m=Ae.getRSBlocks(d,a),h=De();for(let y=0;y<u.length;y++){let x=u[y];h.put(x.getMode(),4),h.put(x.getLength(),Q.getLengthInBits(x.getMode(),d)),x.write(h)}let g=0;for(let y=0;y<m.length;y++)g+=m[y].dataCount;if(h.getLengthInBits()<=g*8)break}i=d}p(!1,E())},f.createTableTag=function(d,m){d=d||2,m=typeof m>"u"?d*4:m;let h="";h+='<table style="',h+=" border-width: 0px; border-style: none;",h+=" border-collapse: collapse;",h+=" padding: 0px; margin: "+m+"px;",h+='">',h+="<tbody>";for(let g=0;g<f.getModuleCount();g+=1){h+="<tr>";for(let y=0;y<f.getModuleCount();y+=1)h+='<td style="',h+=" border-width: 0px; border-style: none;",h+=" border-collapse: collapse;",h+=" padding: 0px; margin: 0px;",h+=" width: "+d+"px;",h+=" height: "+d+"px;",h+=" background-color: ",h+=f.isDark(g,y)?"#000000":"#ffffff",h+=";",h+='"/>';h+="</tr>"}return h+="</tbody>",h+="</table>",h},f.createSvgTag=function(d,m,h,g){let y={};typeof arguments[0]=="object"&&(y=arguments[0],d=y.cellSize,m=y.margin,h=y.alt,g=y.title),d=d||2,m=typeof m>"u"?d*4:m,h=typeof h=="string"?{text:h}:h||{},h.text=h.text||null,h.id=h.text?h.id||"qrcode-description":null,g=typeof g=="string"?{text:g}:g||{},g.text=g.text||null,g.id=g.text?g.id||"qrcode-title":null;let x=f.getModuleCount()*d+m*2,w,T,S,P,k="",N;for(N="l"+d+",0 0,"+d+" -"+d+",0 0,-"+d+"z ",k+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',k+=y.scalable?"":' width="'+x+'px" height="'+x+'px"',k+=' viewBox="0 0 '+x+" "+x+'" ',k+=' preserveAspectRatio="xMinYMin meet"',k+=g.text||h.text?' role="img" aria-labelledby="'+L([g.id,h.id].join(" ").trim())+'"':"",k+=">",k+=g.text?'<title id="'+L(g.id)+'">'+L(g.text)+"</title>":"",k+=h.text?'<description id="'+L(h.id)+'">'+L(h.text)+"</description>":"",k+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',k+='<path d="',S=0;S<f.getModuleCount();S+=1)for(P=S*d+m,w=0;w<f.getModuleCount();w+=1)f.isDark(S,w)&&(T=w*d+m,k+="M"+T+","+P+N);return k+='" stroke="transparent" fill="black"/>',k+="</svg>",k},f.createDataURL=function(d,m){d=d||2,m=typeof m>"u"?d*4:m;let h=f.getModuleCount()*d+m*2,g=m,y=h-m;return nt(h,h,function(x,w){if(g<=x&&x<y&&g<=w&&w<y){let T=Math.floor((x-g)/d),S=Math.floor((w-g)/d);return f.isDark(S,T)?0:1}else return 1})},f.createImgTag=function(d,m,h){d=d||2,m=typeof m>"u"?d*4:m;let g=f.getModuleCount()*d+m*2,y="";return y+="<img",y+=' src="',y+=f.createDataURL(d,m),y+='"',y+=' width="',y+=g,y+='"',y+=' height="',y+=g,y+='"',h&&(y+=' alt="',y+=L(h),y+='"'),y+="/>",y};let L=function(d){let m="";for(let h=0;h<d.length;h+=1){let g=d.charAt(h);switch(g){case"<":m+="&lt;";break;case">":m+="&gt;";break;case"&":m+="&amp;";break;case'"':m+="&quot;";break;default:m+=g;break}}return m},I=function(d){d=typeof d>"u"?2:d;let h=f.getModuleCount()*1+d*2,g=d,y=h-d,x,w,T,S,P,k={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},N={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},A="";for(x=0;x<h;x+=2){for(T=Math.floor((x-g)/1),S=Math.floor((x+1-g)/1),w=0;w<h;w+=1)P="\u2588",g<=w&&w<y&&g<=x&&x<y&&f.isDark(T,Math.floor((w-g)/1))&&(P=" "),g<=w&&w<y&&g<=x+1&&x+1<y&&f.isDark(S,Math.floor((w-g)/1))?P+=" ":P+="\u2588",A+=d<1&&x+1>=y?N[P]:k[P];A+=`
149
+ `}return h%2&&d>0?A.substring(0,A.length-h-1)+Array(h+1).join("\u2580"):A.substring(0,A.length-1)};return f.createASCII=function(d,m){if(d=d||1,d<2)return I(m);d-=1,m=typeof m>"u"?d*2:m;let h=f.getModuleCount()*d+m*2,g=m,y=h-m,x,w,T,S,P=Array(d+1).join("\u2588\u2588"),k=Array(d+1).join(" "),N="",A="";for(x=0;x<h;x+=1){for(T=Math.floor((x-g)/d),A="",w=0;w<h;w+=1)S=1,g<=w&&w<y&&g<=x&&x<y&&f.isDark(T,Math.floor((w-g)/d))&&(S=0),A+=S?P:k;for(T=0;T<d;T+=1)N+=A+`
150
+ `}return N.substring(0,N.length-1)},f.renderTo2dContext=function(d,m){m=m||2;let h=f.getModuleCount();for(let g=0;g<h;g++)for(let y=0;y<h;y++)d.fillStyle=f.isDark(g,y)?"black":"white",d.fillRect(y*m,g*m,m,m)},f};Z.stringToBytes=function(t){let e=[];for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);e.push(n&255)}return e};Z.createStringToBytes=function(t,e){let r=(function(){let i=et(t),a=function(){let c=i.read();if(c==-1)throw"eof";return c},s=0,o={};for(;;){let c=i.read();if(c==-1)break;let u=a(),f=a(),p=a(),l=String.fromCharCode(c<<8|u),E=f<<8|p;o[l]=E,s+=1}if(s!=e)throw s+" != "+e;return o})(),n=63;return function(i){let a=[];for(let s=0;s<i.length;s+=1){let o=i.charCodeAt(s);if(o<128)a.push(o);else{let c=r[i.charAt(s)];typeof c=="number"?(c&255)==c?a.push(c):(a.push(c>>>8),a.push(c&255)):a.push(n)}}return a}};var H={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},re={L:1,M:0,Q:3,H:2},Y={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Q=(function(){let t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],e=1335,r=7973,n=21522,i={},a=function(s){let o=0;for(;s!=0;)o+=1,s>>>=1;return o};return i.getBCHTypeInfo=function(s){let o=s<<10;for(;a(o)-a(e)>=0;)o^=e<<a(o)-a(e);return(s<<10|o)^n},i.getBCHTypeNumber=function(s){let o=s<<12;for(;a(o)-a(r)>=0;)o^=r<<a(o)-a(r);return s<<12|o},i.getPatternPosition=function(s){return t[s-1]},i.getMaskFunction=function(s){switch(s){case Y.PATTERN000:return function(o,c){return(o+c)%2==0};case Y.PATTERN001:return function(o,c){return o%2==0};case Y.PATTERN010:return function(o,c){return c%3==0};case Y.PATTERN011:return function(o,c){return(o+c)%3==0};case Y.PATTERN100:return function(o,c){return(Math.floor(o/2)+Math.floor(c/3))%2==0};case Y.PATTERN101:return function(o,c){return o*c%2+o*c%3==0};case Y.PATTERN110:return function(o,c){return(o*c%2+o*c%3)%2==0};case Y.PATTERN111:return function(o,c){return(o*c%3+(o+c)%2)%2==0};default:throw"bad maskPattern:"+s}},i.getErrorCorrectPolynomial=function(s){let o=ie([1],0);for(let c=0;c<s;c+=1)o=o.multiply(ie([1,G.gexp(c)],0));return o},i.getLengthInBits=function(s,o){if(1<=o&&o<10)switch(s){case H.MODE_NUMBER:return 10;case H.MODE_ALPHA_NUM:return 9;case H.MODE_8BIT_BYTE:return 8;case H.MODE_KANJI:return 8;default:throw"mode:"+s}else if(o<27)switch(s){case H.MODE_NUMBER:return 12;case H.MODE_ALPHA_NUM:return 11;case H.MODE_8BIT_BYTE:return 16;case H.MODE_KANJI:return 10;default:throw"mode:"+s}else if(o<41)switch(s){case H.MODE_NUMBER:return 14;case H.MODE_ALPHA_NUM:return 13;case H.MODE_8BIT_BYTE:return 16;case H.MODE_KANJI:return 12;default:throw"mode:"+s}else throw"type:"+o},i.getLostPoint=function(s){let o=s.getModuleCount(),c=0;for(let p=0;p<o;p+=1)for(let l=0;l<o;l+=1){let E=0,v=s.isDark(p,l);for(let D=-1;D<=1;D+=1)if(!(p+D<0||o<=p+D))for(let C=-1;C<=1;C+=1)l+C<0||o<=l+C||D==0&&C==0||v==s.isDark(p+D,l+C)&&(E+=1);E>5&&(c+=3+E-5)}for(let p=0;p<o-1;p+=1)for(let l=0;l<o-1;l+=1){let E=0;s.isDark(p,l)&&(E+=1),s.isDark(p+1,l)&&(E+=1),s.isDark(p,l+1)&&(E+=1),s.isDark(p+1,l+1)&&(E+=1),(E==0||E==4)&&(c+=3)}for(let p=0;p<o;p+=1)for(let l=0;l<o-6;l+=1)s.isDark(p,l)&&!s.isDark(p,l+1)&&s.isDark(p,l+2)&&s.isDark(p,l+3)&&s.isDark(p,l+4)&&!s.isDark(p,l+5)&&s.isDark(p,l+6)&&(c+=40);for(let p=0;p<o;p+=1)for(let l=0;l<o-6;l+=1)s.isDark(l,p)&&!s.isDark(l+1,p)&&s.isDark(l+2,p)&&s.isDark(l+3,p)&&s.isDark(l+4,p)&&!s.isDark(l+5,p)&&s.isDark(l+6,p)&&(c+=40);let u=0;for(let p=0;p<o;p+=1)for(let l=0;l<o;l+=1)s.isDark(l,p)&&(u+=1);let f=Math.abs(100*u/o/o-50)/5;return c+=f*10,c},i})(),G=(function(){let t=new Array(256),e=new Array(256);for(let n=0;n<8;n+=1)t[n]=1<<n;for(let n=8;n<256;n+=1)t[n]=t[n-4]^t[n-5]^t[n-6]^t[n-8];for(let n=0;n<255;n+=1)e[t[n]]=n;let r={};return r.glog=function(n){if(n<1)throw"glog("+n+")";return e[n]},r.gexp=function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return t[n]},r})(),ie=function(t,e){if(typeof t.length>"u")throw t.length+"/"+e;let r=(function(){let i=0;for(;i<t.length&&t[i]==0;)i+=1;let a=new Array(t.length-i+e);for(let s=0;s<t.length-i;s+=1)a[s]=t[s+i];return a})(),n={};return n.getAt=function(i){return r[i]},n.getLength=function(){return r.length},n.multiply=function(i){let a=new Array(n.getLength()+i.getLength()-1);for(let s=0;s<n.getLength();s+=1)for(let o=0;o<i.getLength();o+=1)a[s+o]^=G.gexp(G.glog(n.getAt(s))+G.glog(i.getAt(o)));return ie(a,0)},n.mod=function(i){if(n.getLength()-i.getLength()<0)return n;let a=G.glog(n.getAt(0))-G.glog(i.getAt(0)),s=new Array(n.getLength());for(let o=0;o<n.getLength();o+=1)s[o]=n.getAt(o);for(let o=0;o<i.getLength();o+=1)s[o]^=G.gexp(G.glog(i.getAt(o))+a);return ie(s,0).mod(i)},n},Ae=(function(){let t=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e=function(i,a){let s={};return s.totalCount=i,s.dataCount=a,s},r={},n=function(i,a){switch(a){case re.L:return t[(i-1)*4+0];case re.M:return t[(i-1)*4+1];case re.Q:return t[(i-1)*4+2];case re.H:return t[(i-1)*4+3];default:return}};return r.getRSBlocks=function(i,a){let s=n(i,a);if(typeof s>"u")throw"bad rs block @ typeNumber:"+i+"/errorCorrectionLevel:"+a;let o=s.length/3,c=[];for(let u=0;u<o;u+=1){let f=s[u*3+0],p=s[u*3+1],l=s[u*3+2];for(let E=0;E<f;E+=1)c.push(e(p,l))}return c},r})(),De=function(){let t=[],e=0,r={};return r.getBuffer=function(){return t},r.getAt=function(n){let i=Math.floor(n/8);return(t[i]>>>7-n%8&1)==1},r.put=function(n,i){for(let a=0;a<i;a+=1)r.putBit((n>>>i-a-1&1)==1)},r.getLengthInBits=function(){return e},r.putBit=function(n){let i=Math.floor(e/8);t.length<=i&&t.push(0),n&&(t[i]|=128>>>e%8),e+=1},r},Qe=function(t){let e=H.MODE_NUMBER,r=t,n={};n.getMode=function(){return e},n.getLength=function(s){return r.length},n.write=function(s){let o=r,c=0;for(;c+2<o.length;)s.put(i(o.substring(c,c+3)),10),c+=3;c<o.length&&(o.length-c==1?s.put(i(o.substring(c,c+1)),4):o.length-c==2&&s.put(i(o.substring(c,c+2)),7))};let i=function(s){let o=0;for(let c=0;c<s.length;c+=1)o=o*10+a(s.charAt(c));return o},a=function(s){if("0"<=s&&s<="9")return s.charCodeAt(0)-48;throw"illegal char :"+s};return n},Ge=function(t){let e=H.MODE_ALPHA_NUM,r=t,n={};n.getMode=function(){return e},n.getLength=function(a){return r.length},n.write=function(a){let s=r,o=0;for(;o+1<s.length;)a.put(i(s.charAt(o))*45+i(s.charAt(o+1)),11),o+=2;o<s.length&&a.put(i(s.charAt(o)),6)};let i=function(a){if("0"<=a&&a<="9")return a.charCodeAt(0)-48;if("A"<=a&&a<="Z")return a.charCodeAt(0)-65+10;switch(a){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+a}};return n},Je=function(t){let e=H.MODE_8BIT_BYTE,r=t,n=Z.stringToBytes(t),i={};return i.getMode=function(){return e},i.getLength=function(a){return n.length},i.write=function(a){for(let s=0;s<n.length;s+=1)a.put(n[s],8)},i},Xe=function(t){let e=H.MODE_KANJI,r=t,n=Z.stringToBytes;(function(s,o){let c=n(s);if(c.length!=2||(c[0]<<8|c[1])!=o)throw"sjis not supported."})("\u53CB",38726);let i=n(t),a={};return a.getMode=function(){return e},a.getLength=function(s){return~~(i.length/2)},a.write=function(s){let o=i,c=0;for(;c+1<o.length;){let u=(255&o[c])<<8|255&o[c+1];if(33088<=u&&u<=40956)u-=33088;else if(57408<=u&&u<=60351)u-=49472;else throw"illegal char at "+(c+1)+"/"+u;u=(u>>>8&255)*192+(u&255),s.put(u,13),c+=2}if(c<o.length)throw"illegal char at "+(c+1)},a},Ie=function(){let t=[],e={};return e.writeByte=function(r){t.push(r&255)},e.writeShort=function(r){e.writeByte(r),e.writeByte(r>>>8)},e.writeBytes=function(r,n,i){n=n||0,i=i||r.length;for(let a=0;a<i;a+=1)e.writeByte(r[a+n])},e.writeString=function(r){for(let n=0;n<r.length;n+=1)e.writeByte(r.charCodeAt(n))},e.toByteArray=function(){return t},e.toString=function(){let r="";r+="[";for(let n=0;n<t.length;n+=1)n>0&&(r+=","),r+=t[n];return r+="]",r},e},Ze=function(){let t=0,e=0,r=0,n="",i={},a=function(o){n+=String.fromCharCode(s(o&63))},s=function(o){if(o<0)throw"n:"+o;if(o<26)return 65+o;if(o<52)return 97+(o-26);if(o<62)return 48+(o-52);if(o==62)return 43;if(o==63)return 47;throw"n:"+o};return i.writeByte=function(o){for(t=t<<8|o&255,e+=8,r+=1;e>=6;)a(t>>>e-6),e-=6},i.flush=function(){if(e>0&&(a(t<<6-e),t=0,e=0),r%3!=0){let o=3-r%3;for(let c=0;c<o;c+=1)n+="="}},i.toString=function(){return n},i},et=function(t){let e=t,r=0,n=0,i=0,a={};a.read=function(){for(;i<8;){if(r>=e.length){if(i==0)return-1;throw"unexpected end of file./"+i}let c=e.charAt(r);if(r+=1,c=="=")return i=0,-1;if(c.match(/^\s$/))continue;n=n<<6|s(c.charCodeAt(0)),i+=6}let o=n>>>i-8&255;return i-=8,o};let s=function(o){if(65<=o&&o<=90)return o-65;if(97<=o&&o<=122)return o-97+26;if(48<=o&&o<=57)return o-48+52;if(o==43)return 62;if(o==47)return 63;throw"c:"+o};return a},tt=function(t,e){let r=t,n=e,i=new Array(t*e),a={};a.setPixel=function(u,f,p){i[f*r+u]=p},a.write=function(u){u.writeString("GIF87a"),u.writeShort(r),u.writeShort(n),u.writeByte(128),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(255),u.writeByte(255),u.writeByte(255),u.writeString(","),u.writeShort(0),u.writeShort(0),u.writeShort(r),u.writeShort(n),u.writeByte(0);let f=2,p=o(f);u.writeByte(f);let l=0;for(;p.length-l>255;)u.writeByte(255),u.writeBytes(p,l,255),l+=255;u.writeByte(p.length-l),u.writeBytes(p,l,p.length-l),u.writeByte(0),u.writeString(";")};let s=function(u){let f=u,p=0,l=0,E={};return E.write=function(v,D){if(v>>>D)throw"length over";for(;p+D>=8;)f.writeByte(255&(v<<p|l)),D-=8-p,v>>>=8-p,l=0,p=0;l=v<<p|l,p=p+D},E.flush=function(){p>0&&f.writeByte(l)},E},o=function(u){let f=1<<u,p=(1<<u)+1,l=u+1,E=c();for(let B=0;B<f;B+=1)E.add(String.fromCharCode(B));E.add(String.fromCharCode(f)),E.add(String.fromCharCode(p));let v=Ie(),D=s(v);D.write(f,l);let C=0,F=String.fromCharCode(i[C]);for(C+=1;C<i.length;){let B=String.fromCharCode(i[C]);C+=1,E.contains(F+B)?F=F+B:(D.write(E.indexOf(F),l),E.size()<4095&&(E.size()==1<<l&&(l+=1),E.add(F+B)),F=B)}return D.write(E.indexOf(F),l),D.write(p,l),D.flush(),v.toByteArray()},c=function(){let u={},f=0,p={};return p.add=function(l){if(p.contains(l))throw"dup key:"+l;u[l]=f,f+=1},p.size=function(){return f},p.indexOf=function(l){return u[l]},p.contains=function(l){return typeof u[l]<"u"},p};return a},nt=function(t,e,r){let n=tt(t,e);for(let o=0;o<e;o+=1)for(let c=0;c<t;c+=1)n.setPixel(c,o,r(c,o));let i=Ie();n.write(i);let a=Ze(),s=i.toByteArray();for(let o=0;o<s.length;o+=1)a.writeByte(s[o]);return a.flush(),"data:image/gif;base64,"+a},ot=Z,vn=Z.stringToBytes,rt="#e8e8e8",it="#ffffff";function st(t){let e=t.getRootNode(),r=e instanceof ShadowRoot?e.host:document.documentElement;return(r instanceof Element?r.getAttribute("data-theme"):null)==="light"?it:rt}function Fe(t,e,r=200){ge(t),t.dataset.qrUrl=e;let n=document.createElement("canvas"),i=n.getContext?.("2d")??null;if(!i){let p=document.createElement("a");p.href=e,p.textContent="Open in DID Wallet",p.target="_blank",p.rel="noopener",t.appendChild(p);return}let a=ot(0,"M");a.addData(e),a.make();let s=a.getModuleCount(),o=Math.floor(r/s),c=o*s;n.width=c,n.height=c,n.style.display="block",n.style.width=`${r}px`,n.style.height=`${r}px`,n.style.imageRendering="pixelated";let u=st(t);i.fillStyle=u,i.fillRect(0,0,c,c),i.fillStyle="#000000";for(let p=0;p<s;p++)for(let l=0;l<s;l++)a.isDark(p,l)&&i.fillRect(l*o,p*o,o,o);let f=document.createElement("div");f.className="qr-plate",f.style.display="inline-block",f.style.padding="10px",f.style.backgroundColor=u,f.style.borderRadius="8px",f.style.lineHeight="0",f.appendChild(n),t.appendChild(f)}function ge(t){t.innerHTML="",delete t.dataset.qrUrl}var at=`
151
+ ${Te}
152
+ ${Se}
153
+ ${Ue}
154
+
155
+ /* Layout */
156
+ body {
157
+ min-height: 100vh;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.08) 0%, transparent 60%);
162
+ }
163
+ /* The body rule does not apply inside a shadow tree. The host page must
164
+ give the LoginPage container a height for this centering to show. */
165
+ :host {
166
+ display: flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ min-height: 100%;
170
+ }
171
+
172
+ /* Card \u2014 fixed width prevents shrinking when views switch */
173
+ .card {
174
+ background: var(--bg-card);
175
+ border: 1px solid var(--border);
176
+ border-radius: var(--radius-lg);
177
+ padding: 48px 40px;
178
+ width: min(400px, calc(100vw - 32px));
179
+ text-align: center;
180
+ box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.15);
181
+ }
182
+
183
+ /* Brand header */
184
+ .brand-header { margin-bottom: 24px; }
185
+ .app-logo {
186
+ width: 48px;
187
+ height: 48px;
188
+ border-radius: var(--radius-sm);
189
+ object-fit: contain;
190
+ margin-bottom: 16px;
191
+ }
192
+ h1 {
193
+ font-size: 24px;
194
+ font-weight: 600;
195
+ margin-bottom: 8px;
196
+ color: var(--text-white);
197
+ letter-spacing: -0.01em;
198
+ line-height: 1.25;
199
+ /* Never let a long "Sign in to {appName}" blow past two lines \u2014 clamp with
200
+ an ellipsis so the card height stays stable. */
201
+ display: -webkit-box;
202
+ -webkit-line-clamp: 2;
203
+ line-clamp: 2;
204
+ -webkit-box-orient: vertical;
205
+ overflow: hidden;
206
+ }
207
+ .subtitle {
208
+ font-size: 14px;
209
+ color: var(--text-secondary);
210
+ margin-bottom: 0;
211
+ line-height: 1.5;
212
+ }
213
+ .federated-hint {
214
+ font-size: 12px;
215
+ color: var(--text-secondary);
216
+ margin-top: 6px;
217
+ margin-bottom: 0;
218
+ opacity: 0.7;
219
+ }
220
+
221
+ /* Input */
222
+ .input {
223
+ width: 100%;
224
+ height: 36px;
225
+ padding: 0 12px;
226
+ font-size: 14px;
227
+ color: var(--text);
228
+ background: var(--bg-input);
229
+ border: 1px solid var(--border-strong);
230
+ border-radius: var(--radius-sm);
231
+ outline: none;
232
+ margin-bottom: 16px;
233
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
234
+ }
235
+ .input:focus { border-color: var(--blue); box-shadow: var(--shadow-focus); }
236
+ .input::placeholder { color: var(--text-placeholder); }
237
+
238
+ /* Button */
239
+ .btn {
240
+ display: inline-flex;
241
+ align-items: center;
242
+ justify-content: center;
243
+ gap: 6px;
244
+ width: 100%;
245
+ height: 36px;
246
+ padding: 0 16px;
247
+ font-size: 14px;
248
+ font-weight: 500;
249
+ color: #fff;
250
+ background: var(--blue);
251
+ border: none;
252
+ border-radius: var(--radius-sm);
253
+ cursor: pointer;
254
+ transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
255
+ line-height: 1;
256
+ }
257
+ .btn:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(108,71,255,0.3); }
258
+ .btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; transform: none; box-shadow: none; }
259
+ .btn:focus-visible { box-shadow: var(--shadow-focus); }
260
+ .btn svg { width: 18px; height: 18px; flex-shrink: 0; }
261
+ .btn-secondary {
262
+ background: transparent;
263
+ border: 1px solid var(--border-strong);
264
+ color: var(--text);
265
+ }
266
+ .btn-secondary:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.20); }
267
+
268
+ /* Status */
269
+ .status {
270
+ margin-top: 16px;
271
+ font-size: 13px;
272
+ min-height: 20px;
273
+ color: var(--text-secondary);
274
+ }
275
+ .status.error { color: var(--red-text); }
276
+
277
+ /* Name row (passkey registration) */
278
+ .name-row { display: none; }
279
+ .name-row.visible { display: block; }
280
+
281
+ /* Passkey section + secondary text action ("First time? Create a passkey") */
282
+ .passkey-section > .btn + .passkey-alt,
283
+ .passkey-section > .name-row + .btn { margin-top: 10px; }
284
+ .passkey-alt {
285
+ display: block;
286
+ width: 100%;
287
+ margin-top: 10px;
288
+ padding: 4px;
289
+ background: none;
290
+ border: none;
291
+ font-size: 13px;
292
+ color: var(--text-secondary);
293
+ cursor: pointer;
294
+ text-align: center;
295
+ transition: color 0.15s ease;
296
+ }
297
+ .passkey-alt:hover { color: var(--text); text-decoration: underline; }
298
+ .passkey-alt:focus-visible { box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); outline: none; }
299
+
300
+ /* Divider */
301
+ .divider {
302
+ display: flex;
303
+ align-items: center;
304
+ margin: 20px 0;
305
+ color: var(--text-secondary);
306
+ font-size: 13px;
307
+ }
308
+ .divider::before, .divider::after {
309
+ content: '';
310
+ flex: 1;
311
+ border-bottom: 1px solid var(--border);
312
+ }
313
+ .divider::before { margin-right: 12px; }
314
+ .divider::after { margin-left: 12px; }
315
+
316
+ /* DID Wallet section (methods view) */
317
+ .did-wallet-section { margin-top: 8px; }
318
+
319
+ /* QR view */
320
+ .qr-view {
321
+ position: relative;
322
+ margin: 20px auto;
323
+ display: flex;
324
+ justify-content: center;
325
+ min-height: 220px;
326
+ align-items: center;
327
+ }
328
+ .qr-placeholder {
329
+ width: 220px;
330
+ height: 220px;
331
+ display: flex;
332
+ align-items: center;
333
+ justify-content: center;
334
+ border: 1px solid var(--border-subtle);
335
+ border-radius: var(--radius);
336
+ background: var(--bg-elevated);
337
+ }
338
+ .qr-spinner {
339
+ display: inline-block;
340
+ width: 32px; height: 32px;
341
+ border: 3px solid var(--border-strong);
342
+ border-top-color: var(--blue-muted);
343
+ border-radius: 50%;
344
+ animation: spin 0.6s linear infinite;
345
+ }
346
+ #did-connect-status {
347
+ font-size: 13px;
348
+ color: var(--text-secondary);
349
+ }
350
+
351
+ /* Connect result state */
352
+ .connect-result {
353
+ display: flex;
354
+ justify-content: center;
355
+ align-items: center;
356
+ min-height: 120px;
357
+ margin: 32px 0;
358
+ animation: fadeIn 200ms ease-out;
359
+ }
360
+ .result-icon {
361
+ width: 64px;
362
+ height: 64px;
363
+ border-radius: 50%;
364
+ display: flex;
365
+ align-items: center;
366
+ justify-content: center;
367
+ font-size: 28px;
368
+ font-weight: bold;
369
+ }
370
+ .result-error {
371
+ background: rgba(239, 68, 68, 0.15);
372
+ color: var(--red-text);
373
+ border: 2px solid rgba(239, 68, 68, 0.3);
374
+ }
375
+ .result-loading {
376
+ background: transparent;
377
+ }
378
+ .result-loading .qr-spinner {
379
+ width: 36px;
380
+ height: 36px;
381
+ }
382
+ .result-back-btn {
383
+ margin-top: 16px;
384
+ }
385
+ @keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
386
+
387
+ /* QR timeout overlay. It sits on the code, not across the card. Dark keeps a
388
+ dim scrim so the expired plate stays readable as "inactive". */
389
+ .qr-plate { position: relative; }
390
+ .qr-timeout-overlay {
391
+ position: absolute;
392
+ inset: 0;
393
+ display: flex;
394
+ flex-direction: column;
395
+ align-items: center;
396
+ justify-content: center;
397
+ gap: 12px;
398
+ padding: 16px;
399
+ text-align: center;
400
+ background: rgba(0, 0, 0, 0.65);
401
+ border-radius: inherit;
402
+ backdrop-filter: blur(2px);
403
+ }
404
+ .qr-timeout-overlay .timeout-text {
405
+ font-size: 13px;
406
+ line-height: 1.4;
407
+ color: #fff;
408
+ }
409
+ [data-theme="light"] .qr-timeout-overlay,
410
+ :host([data-theme="light"]) .qr-timeout-overlay {
411
+ background: rgba(255, 255, 255, 0.94);
412
+ border: 1px solid var(--border);
413
+ box-shadow: var(--shadow-sm);
414
+ backdrop-filter: blur(8px);
415
+ }
416
+ [data-theme="light"] .qr-timeout-overlay .timeout-text,
417
+ :host([data-theme="light"]) .qr-timeout-overlay .timeout-text {
418
+ color: var(--text-secondary);
419
+ }
420
+ .qr-timeout-overlay .refresh-btn {
421
+ display: inline-flex;
422
+ align-items: center;
423
+ justify-content: center;
424
+ gap: 6px;
425
+ padding: 6px 20px;
426
+ font-size: 14px;
427
+ font-weight: 500;
428
+ color: #fff;
429
+ background: var(--blue);
430
+ border: none;
431
+ border-radius: var(--radius-sm);
432
+ cursor: pointer;
433
+ transition: background-color 0.15s ease;
434
+ }
435
+ .qr-timeout-overlay .refresh-btn:hover {
436
+ background: var(--blue-hover);
437
+ }
438
+ /* Connect status views (scanned / success) */
439
+ .connect-status-icon {
440
+ position: relative;
441
+ width: 72px;
442
+ height: 72px;
443
+ margin: 16px auto;
444
+ display: flex;
445
+ align-items: center;
446
+ justify-content: center;
447
+ }
448
+ @keyframes connectSpin { to { transform: rotate(360deg); } }
449
+ .connect-spinner-ring {
450
+ position: absolute;
451
+ inset: 0;
452
+ width: 72px;
453
+ height: 72px;
454
+ border-radius: 50%;
455
+ border: 3px solid rgba(255,255,255,0.1);
456
+ border-top-color: var(--blue, #6c47ff);
457
+ animation: connectSpin 0.8s linear infinite;
458
+ }
459
+ .connect-status-badge {
460
+ position: relative;
461
+ display: flex;
462
+ align-items: center;
463
+ justify-content: center;
464
+ width: 44px;
465
+ height: 44px;
466
+ }
467
+ .connect-status-badge svg { width: 36px; height: 36px; }
468
+ .connect-status-icon.connect-success svg { animation: fadeIn 0.3s ease; }
469
+ .connect-subtitle {
470
+ font-size: 13px;
471
+ color: var(--text-secondary, #9394a1);
472
+ text-align: center;
473
+ margin: 4px 0 0;
474
+ }
475
+ .status.success { color: #49dc6e; font-weight: 500; }
476
+ .deep-link-btn {
477
+ margin-top: 12px;
478
+ text-decoration: none;
479
+ }
480
+
481
+ /* Email section (methods view) */
482
+ .email-section { margin-top: 8px; }
483
+
484
+ /* Back button \u2014 same top row as Cancel and the locale/theme tools.
485
+ A float sat inside the 48px content padding, so Back landed below the
486
+ absolute locale pill. */
487
+ .back-btn {
488
+ position: absolute;
489
+ top: 16px;
490
+ left: 40px;
491
+ display: inline-flex;
492
+ align-items: center;
493
+ gap: 4px;
494
+ height: 28px;
495
+ background: none;
496
+ border: none;
497
+ color: var(--text-secondary);
498
+ font-size: 14px;
499
+ line-height: 1;
500
+ cursor: pointer;
501
+ padding: 0;
502
+ margin: 0;
503
+ }
504
+ .back-btn:hover { color: var(--text); }
505
+ .back-btn svg { width: 18px; height: 18px; }
506
+ /* Escape hatch \u2014 a quiet "Cancel" link, top-left of the card, mirroring the
507
+ locale switcher (top-right). Conventional spot for a standalone auth card.
508
+ Low in the hierarchy (tertiary color, small) so it never competes with the
509
+ auth methods; it's an exit, not an action. */
510
+ .home-link {
511
+ position: absolute;
512
+ top: 16px;
513
+ /* Align the arrow's left edge to the content column (card's 40px padding), so
514
+ Cancel sits on the same left line as the title and buttons \u2014 no left padding
515
+ of its own, which would push it off that line. */
516
+ left: 40px;
517
+ display: inline-flex;
518
+ align-items: center;
519
+ gap: 3px;
520
+ background: none;
521
+ border: none;
522
+ color: var(--text-tertiary);
523
+ font-size: 13px;
524
+ line-height: 1;
525
+ text-decoration: none;
526
+ cursor: pointer;
527
+ height: 28px;
528
+ padding: 2px 4px 2px 0;
529
+ transition: color 0.15s ease;
530
+ }
531
+ .home-link:hover { color: var(--text-secondary); }
532
+ .home-link svg { width: 16px; height: 16px; }
533
+
534
+ /* View title */
535
+ .view-title {
536
+ font-size: 20px;
537
+ font-weight: 600;
538
+ color: var(--text-white);
539
+ margin-bottom: 8px;
540
+ padding-top: 8px;
541
+ }
542
+
543
+ /* OAuth section \u2014 single provider (legacy) */
544
+ .oauth-section { margin-top: 0; }
545
+
546
+ /* OAuth grid \u2014 2+ providers in 2-column layout (legacy) */
547
+ .oauth-grid {
548
+ display: grid;
549
+ grid-template-columns: 1fr 1fr;
550
+ gap: 8px;
551
+ margin-bottom: 8px;
552
+ }
553
+ .oauth-grid .oauth-btn:last-child:nth-child(odd) {
554
+ grid-column: 1 / -1;
555
+ }
556
+
557
+ /* Unified secondary methods grid \u2014 2-column layout */
558
+ .methods-grid {
559
+ display: grid;
560
+ grid-template-columns: 1fr 1fr;
561
+ gap: 8px;
562
+ }
563
+ /* Odd last child (e.g. DID Wallet when total is odd) spans full width */
564
+ .methods-grid .method-btn:last-child:nth-child(odd) {
565
+ grid-column: 1 / -1;
566
+ }
567
+
568
+ .method-btn {
569
+ display: inline-flex;
570
+ align-items: center;
571
+ justify-content: center;
572
+ gap: 8px;
573
+ width: 100%;
574
+ min-height: 36px;
575
+ padding: 6px 16px;
576
+ font-size: 14px;
577
+ font-weight: 500;
578
+ color: var(--text);
579
+ background: var(--bg-elevated);
580
+ border: 1px solid var(--border-strong);
581
+ border-radius: var(--radius-sm);
582
+ cursor: pointer;
583
+ transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.2s ease;
584
+ white-space: normal;
585
+ }
586
+ .method-btn:hover { background: var(--bg-hover); border-color: var(--blue-muted); }
587
+ .method-btn:disabled { cursor: default; pointer-events: none; }
588
+ .method-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
589
+
590
+ .oauth-btn {
591
+ display: inline-flex;
592
+ align-items: center;
593
+ justify-content: center;
594
+ gap: 8px;
595
+ width: 100%;
596
+ height: 36px;
597
+ padding: 0 16px;
598
+ font-size: 14px;
599
+ font-weight: 500;
600
+ color: var(--text);
601
+ background: var(--bg-card);
602
+ border: 1px solid var(--border);
603
+ border-radius: var(--radius-sm);
604
+ cursor: pointer;
605
+ transition: background-color 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;
606
+ margin-bottom: 0;
607
+ }
608
+ .oauth-section .oauth-btn { margin-bottom: 8px; }
609
+ .oauth-btn:hover { background: var(--bg-hover); }
610
+ .oauth-btn:disabled { cursor: default; pointer-events: none; }
611
+ .oauth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
612
+ .oauth-btn-loading {
613
+ opacity: 0.8;
614
+ border-color: var(--blue);
615
+ color: var(--text-secondary);
616
+ }
617
+ @keyframes oauth-spin { to { transform: rotate(360deg); } }
618
+ .oauth-spinner {
619
+ display: inline-block;
620
+ width: 14px; height: 14px;
621
+ border: 2px solid var(--border-strong);
622
+ border-top-color: var(--blue-muted);
623
+ border-radius: 50%;
624
+ animation: oauth-spin 0.6s linear infinite;
625
+ }
626
+ .oauth-check { color: var(--green-text); font-size: 16px; }
627
+
628
+ /* Browser compatibility warning */
629
+ .compat-warning {
630
+ font-size: 13px;
631
+ color: var(--text-tertiary);
632
+ padding: 12px;
633
+ background: var(--bg-elevated);
634
+ border-radius: var(--radius-sm);
635
+ margin-bottom: 16px;
636
+ }
637
+
638
+ /* Trust footer */
639
+ .login-footer {
640
+ margin-top: 24px;
641
+ padding-top: 20px;
642
+ border-top: 1px solid var(--border);
643
+ }
644
+ .secured-badge {
645
+ display: flex;
646
+ align-items: center;
647
+ justify-content: center;
648
+ gap: 6px;
649
+ font-size: 12px;
650
+ color: var(--text-tertiary);
651
+ }
652
+ .secured-badge svg { width: 14px; height: 14px; flex-shrink: 0; }
653
+ .footer-links {
654
+ margin-top: 8px;
655
+ font-size: 12px;
656
+ color: var(--text-tertiary);
657
+ }
658
+ .footer-links a {
659
+ color: var(--text-secondary);
660
+ text-decoration: none;
661
+ }
662
+ .footer-links a:hover { text-decoration: underline; }
663
+
664
+ /* \u2500\u2500\u2500 Animations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
665
+ @keyframes fadeIn {
666
+ from { opacity: 0; transform: translateY(4px); }
667
+ to { opacity: 1; transform: translateY(0); }
668
+ }
669
+ @keyframes fadeOut {
670
+ from { opacity: 1; }
671
+ to { opacity: 0; }
672
+ }
673
+ .card[data-view] { animation: fadeIn 200ms ease-out; }
674
+
675
+ /* QR code scale-in */
676
+ .qr-view { animation: qrScaleIn 300ms ease-out; }
677
+ @keyframes qrScaleIn {
678
+ from { opacity: 0; transform: scale(0.95); }
679
+ to { opacity: 1; transform: scale(1); }
680
+ }
681
+
682
+ /* Button loading spinner */
683
+ @keyframes spin { to { transform: rotate(360deg); } }
684
+ .btn-spinner {
685
+ display: inline-block;
686
+ width: 16px; height: 16px;
687
+ border: 2px solid rgba(255,255,255,0.3);
688
+ border-top-color: #fff;
689
+ border-radius: 50%;
690
+ animation: spin 0.6s linear infinite;
691
+ }
692
+
693
+ /* Success checkmark */
694
+ @keyframes checkDraw {
695
+ from { stroke-dashoffset: 24; }
696
+ to { stroke-dashoffset: 0; }
697
+ }
698
+ .success-check {
699
+ display: inline-block;
700
+ width: 20px; height: 20px;
701
+ vertical-align: middle;
702
+ }
703
+ .success-check path {
704
+ stroke-dasharray: 24;
705
+ stroke-dashoffset: 24;
706
+ animation: checkDraw 400ms ease-out forwards;
707
+ }
708
+
709
+ /* Light theme background gradient adjustment */
710
+ [data-theme="light"] body {
711
+ background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.05) 0%, transparent 60%);
712
+ }
713
+ [data-theme="light"] .card,
714
+ :host([data-theme="light"]) .card {
715
+ box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.08);
716
+ }
717
+ [data-theme="light"] .btn:hover,
718
+ :host([data-theme="light"]) .btn:hover {
719
+ box-shadow: 0 2px 8px rgba(108,71,255,0.15);
720
+ }
721
+
722
+ /* Language sits on the same top row as Back / Cancel. */
723
+ .card-tools {
724
+ position: absolute;
725
+ top: 16px;
726
+ right: 16px;
727
+ z-index: 2;
728
+ display: flex;
729
+ align-items: flex-start;
730
+ }
731
+ .locale-switcher {
732
+ position: relative;
733
+ }
734
+ .locale-btn {
735
+ display: inline-flex;
736
+ align-items: center;
737
+ gap: 4px;
738
+ height: 28px;
739
+ padding: 4px 10px;
740
+ font-size: 12px;
741
+ color: var(--text-secondary);
742
+ background: var(--bg-elevated);
743
+ border: 1px solid var(--border-subtle);
744
+ border-radius: var(--radius-full);
745
+ cursor: pointer;
746
+ transition: color 0.15s, border-color 0.15s;
747
+ }
748
+ .locale-btn:hover {
749
+ color: var(--text);
750
+ border-color: var(--border-strong);
751
+ }
752
+ .locale-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
753
+ .locale-trigger {
754
+ display: inline-flex;
755
+ align-items: center;
756
+ gap: 4px;
757
+ height: 28px;
758
+ padding: 4px 10px;
759
+ font-size: 12px;
760
+ color: var(--text-secondary);
761
+ background: var(--bg-elevated);
762
+ border: 1px solid var(--border-subtle);
763
+ border-radius: var(--radius-full);
764
+ cursor: pointer;
765
+ }
766
+ .locale-trigger:hover {
767
+ color: var(--text);
768
+ border-color: var(--border-strong);
769
+ }
770
+ .locale-trigger svg { width: 14px; height: 14px; flex-shrink: 0; }
771
+ /* One compact menu surface; rows are choices, not nested pill buttons. */
772
+ .locale-menu {
773
+ display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 4;
774
+ min-width: 144px; width: max-content; max-width: min(240px,calc(100vw - 64px));
775
+ padding: 4px; background: var(--bg-card); border: 1px solid var(--border);
776
+ border-radius: 10px; box-shadow: var(--shadow-lg);
777
+ }
778
+ .locale-switcher.open .locale-menu { display: flex; flex-direction: column; }
779
+ .locale-menu .locale-btn {
780
+ width: 100%; min-height: 36px; height: auto; padding: 7px 10px; gap: 8px;
781
+ border: 0; border-radius: 6px; background: transparent; text-align: left;
782
+ font-size: 13px; line-height: 1.4; overflow-wrap: anywhere;
783
+ }
784
+ .locale-menu .locale-btn:hover, .locale-menu .locale-btn:focus-visible { background: var(--bg-hover); color: var(--text); }
785
+ .locale-menu .locale-btn[aria-checked="true"] { color: var(--text); font-weight: 600; }
786
+ .locale-check { width: 14px; flex: 0 0 14px; font-size: 12px; line-height: 1; }
787
+ @media (pointer: coarse) { .locale-menu .locale-btn { min-height: 44px; } }
788
+ .has-last-used { flex-wrap: wrap; }
789
+ .last-used { display: inline-block; font-size: 11px; font-weight: 400; line-height: 1.4;
790
+ padding: 2px 6px; border: 1px solid currentColor; border-radius: 4px; opacity: .72; white-space: nowrap; }
791
+ .card { position: relative; }
792
+
793
+ /* Long localized method labels remain readable on narrow screens. */
794
+ .methods-grid { grid-template-columns: 1fr; }
795
+ .method-btn { min-height: 48px; white-space: normal; }
796
+ .passkey-alt { min-height: 44px; font-weight: 600; }
797
+ .oauth-recovery { font-size: 14px; line-height: 1.5; margin: 12px 0; padding: 12px;
798
+ border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-secondary); text-align: left; }
799
+ .oauth-recovery p { margin: 0 0 8px; overflow-wrap: anywhere; }
800
+ .oauth-recovery-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
801
+ .oauth-recovery-actions button, .oauth-recovery-actions a { font: inherit; font-size: 13px; min-height: 44px;
802
+ display: inline-flex; align-items: center; padding: 4px 0; color: var(--text); border: 0; background: none; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
803
+ .oauth-recovery-actions[hidden], .oauth-recovery-actions [hidden] { display: none; }
804
+ .oauth-recovery-actions :focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
805
+
806
+ @media (max-width: 480px) { .card { padding: 24px 20px; width: 100%; box-sizing: border-box; } h1 { font-size: 24px; } }
807
+
808
+ .passkey-create-entry { display: flex; justify-content: center; align-items: center; width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); color: var(--text); padding: 10px 14px; }
809
+ .passkey-create-entry:hover { background: var(--bg-hover); text-decoration: none; }
810
+ .status:empty { min-height: 0; padding: 0; margin: 0; }
811
+ .passkey-section .subtitle { margin: 8px 0 16px; font-size: 14px; line-height: 1.5; }
812
+ @media (max-width: 480px) { .card { padding: 20px 18px; } .brand-header { margin-bottom: 20px; } }
813
+
814
+ .card-modal .card-tools { left: 20px; right: 80px; top: 12px; }
815
+ .card-modal .locale-switcher { min-width: 0; max-width: 100%; }
816
+ .card-modal .locale-trigger { max-width: 100%; height: 36px; }
817
+ .locale-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
818
+ .card-modal .locale-menu { left: 0; right: auto; }
819
+
820
+ .card { padding: 52px 24px 24px; box-sizing: border-box; }
821
+ .card-modal { width: 100%; }
822
+ .card-modal { padding-top: 68px; border: 0; border-radius: 0; }
823
+ /* The dialog frame owns the shadow in both palettes. */
824
+ .card.card-modal, :host([data-theme="light"]) .card.card-modal { box-shadow: none; }
825
+ /* A translateY entrance expands an auto scroller by 4px until it finishes. */
826
+ .card-modal[data-view] { animation: none; }
827
+ /* Sub-step navigation shares the close button's center line in both modes. */
828
+ .back-btn { top: 8px; left: 24px; height: 44px; max-width: calc(100% - 160px); line-height: 1.4; text-align: left; }
829
+ .back-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
830
+ .card-modal .back-btn { position: absolute; top: 8px; left: 24px; margin: 0; }
831
+ .card-modal:has(.back-btn) .card-tools { left: auto; right: 64px; max-width: calc(100% - 160px); }
832
+ .passkey-creating > .home-link { display: none; }
833
+ @media (max-width:480px) { .back-btn, .card-modal .back-btn { left: 18px; } }
834
+ .card-modal h1 { display: block; overflow: visible; -webkit-line-clamp: unset; line-clamp: unset; line-height: 1.4; padding-block: 2px; }
835
+ .card-modal h1[tabindex="-1"]:focus { outline: none; }
836
+ .card-modal h1, .card-modal h2, .card-modal .subtitle, .card-modal .status { overflow-wrap: anywhere; }
837
+ .card-modal .btn { height: auto; min-height: 44px; line-height: 1.4; padding-block: 10px; white-space: normal; }
838
+ .card-modal button, .card-modal a { overflow-wrap: anywhere; }
839
+ .social-first .divider { margin: 14px 0; }
840
+ .social-first .app-logo { width: 32px; height: 32px; margin-bottom: 12px; }
841
+ .social-first .login-footer { margin-top: 16px; padding-top: 12px; }
842
+ .other-methods { margin-top: 8px; color: var(--text-secondary); font-size: 14px; }
843
+ .other-methods summary { min-height: 44px; padding: 12px 0; cursor: pointer; }
844
+ .other-methods summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
845
+ @media (max-width:480px) { .card { padding: 52px 18px 24px; } }
846
+ @media (max-width:480px) { .card-modal { padding-top: 68px; } .card-modal .card-tools { left: 18px; } }
847
+ @media (prefers-reduced-motion: reduce) { .card[data-view], .qr-view { animation: none; } }
848
+
849
+ .passkey-creating > .methods-grid, .passkey-creating > .divider, .passkey-creating > .other-methods { display: none; }
850
+
851
+ .input-label { display: block; text-align: left; margin: 8px 0; color: var(--text); font-size: 14px; font-weight: 500; }
852
+ .input-label[hidden], .email-help[hidden] { display: none; }
853
+ .email-help { text-align: left; font-size: 13px; line-height: 1.5; color: var(--text-secondary); margin: 0 0 12px; }
854
+ `;function J(t){let e=new Uint8Array(t),r="";for(let n=0;n<e.length;n++)r+=String.fromCharCode(e[n]);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function oe(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r=atob(e),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return n.buffer}function ut(t){let e=t.response;return{id:t.id,rawId:J(t.rawId),type:t.type,response:{attestationObject:J(e.attestationObject),clientDataJSON:J(e.clientDataJSON)},clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:t.authenticatorAttachment}}function lt(t){let e=t.response;return{id:t.id,rawId:J(t.rawId),type:t.type,response:{authenticatorData:J(e.authenticatorData),clientDataJSON:J(e.clientDataJSON),signature:J(e.signature),userHandle:e.userHandle?J(e.userHandle):void 0},clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:t.authenticatorAttachment}}async function le(t){let e=t.prefix||"/.well-known/service/api/passkey",r=t.onStatus||(()=>{}),n=t.authOnly||!1,i=t.registerOnly||!1,a=t.invitationId||void 0,s=t.locale,o=t.texts||{},c=o.waiting||b("passkeyWaiting",s),u=o.creating||b("passkeyCreating",s),f=o.verifying||b("verifying",s);async function p(){let C=await fetch(`${e}/auth`,{method:"GET",signal:t.signal});if(!C.ok)throw new Error(b("authFailed",s));return C.json()}async function l(C){let F=[];C&&F.push(`name=${encodeURIComponent(C)}`),a&&F.push(`invitationId=${encodeURIComponent(a)}`);let B=F.length?`?${F.join("&")}`:"",R=await fetch(`${e}/register${B}`,{method:"GET",signal:t.signal});if(!R.ok)throw new Error(b("registrationFailed",s));return R.json()}function E(C,F){let B=new Error(C);throw F&&(B.code=F),B}async function v(C,F){let B=await fetch(`${e}/auth`,{method:"POST",signal:t.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({challengeId:C,credential:F})});if(!B.ok){let R=await B.json().catch(()=>({}));E(R.error||b("authFailed",s),R.code)}return B.json()}async function D(C,F,B){let R=await fetch(`${e}/register`,{method:"POST",signal:t.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({challengeId:C,credential:F,name:B||void 0})});if(!R.ok){let W=await R.json().catch(()=>({}));E(W.error||b("registrationFailed",s),W.code)}return R.json()}if(!i){r(c,!1);try{let C=await p(),{challengeId:F}=C,B=C.authentication||C,R={signal:t.signal,publicKey:{...B,challenge:oe(B.challenge),allowCredentials:(B.allowCredentials||[]).map(L=>({...L,id:oe(L.id)}))}},W;try{W=await navigator.credentials.get(R)}catch{if(n)return{success:!1,error:"no_passkey"}}if(!W&&n)return{success:!1,error:"no_passkey"};if(t.signal?.aborted)return{success:!1,error:"cancelled"};if(W){let L=lt(W);return r(f,!1),await v(F,L),{success:!0}}}catch(C){let F=C instanceof Error?C.message:b("authFailed",s),B=C instanceof Error?C.code:void 0;return r(F,!0),{success:!1,error:F,code:B}}}try{let C=await l(t.name||"");if(C.registrationAllowed===!1)return r(b("regClosed",s),!0),{success:!1,error:"registration_closed"};r(u,!1);let F=C.registration||C,B={signal:t.signal,publicKey:{...F,challenge:oe(F.challenge),user:{...F.user,id:oe(F.user.id)},excludeCredentials:(F.excludeCredentials||[]).map(L=>({...L,id:oe(L.id)}))}},R=await navigator.credentials.create(B);if(!R||t.signal?.aborted)return{success:!1,error:b("passkeyNoLocal",s)};let W=ut(R);return r(f,!1),await D(C.challengeId,W,t.name||""),{success:!0}}catch(C){let F=C instanceof Error&&(C.name==="NotAllowedError"||C.name==="AbortError")?b("passkeyNoLocal",s):C instanceof Error?C.message:b("passkeySetupFailed",s),B=C instanceof Error?C.code:void 0;return r(F,!0),{success:!1,error:F,code:B}}}function X(t,e){let r=t instanceof Error?t.message:"",n=t instanceof Error&&"code"in t?t.code:"";return n==="FORBIDDEN"?b("accessDenied",e):r==="registration_closed"||n==="registration_closed"?b("regClosed",e):r||b("authFailed",e)}var ct="https://web.abtwallet.io/";function _e(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function dt(){return typeof window>"u"?null:window.ABT_DEV??window.ABT??null}function q(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}var me=class{container;config;http;options;tokenSession=null;styleEl=null;mounted=!1;completed=!1;generation=0;activeMethod;activeProvider;oauthCleanup;emailTimer;emailDraft="";abort;emit(t){try{this.options.onEvent?.({name:t,method:this.activeMethod,mode:this.options.mode??"page"})}catch{}}select(t){this.generation++,this.oauthCleanup?.(),this.abort?.abort(),this.abort=new AbortController,this.activeMethod=t,this.activeProvider=void 0,this.emit("method_selected")}currentView="methods";cardEl=null;mediaQuery=null;mediaListener=null;localeOutsideClick=null;shadow=null;isolate;constructor(t,e,r,n){if(this.container=t,this.config=e,this.http=r,this.isolate=n?.isolate===!0,this.options={methods:["passkey","did-connect"],locale:"en",...n},!this.options.invitationId&&typeof document<"u"){let i=document.cookie.match(/(?:^|;\s*)pending_invitation=([^;]*)/);if(i)try{this.options.invitationId=decodeURIComponent(i[1])}catch{}}}mount(){if(this.mounted)return;this.mounted=!0,this.completed=!1,this.emit("view"),this.styleEl=document.createElement("style"),this.styleEl.textContent=at,this.mountRoot().appendChild(this.styleEl),this.adoptStoredTheme(),this.applyTheme();let t=this.filterMethods(this.options.methods);this.renderCard(t)}destroy(){if(this.generation++,this.oauthCleanup?.(),this.abort?.abort(),clearInterval(this.emailTimer),this.detachLocaleMenu(),this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.detachMedia(),this.isolate){let t=this.shadow??this.container.shadowRoot;t&&(t.innerHTML=""),this.container.removeAttribute("data-theme")}else document.documentElement.removeAttribute("data-theme"),this.container.innerHTML="";this.styleEl=null,this.cardEl=null,this.currentView="methods",this.mounted=!1}setTheme(t){this.options.theme=t,this.applyTheme()}update(t){Object.assign(this.options,t),this.mounted&&(this.destroy(),this.mount())}themeTarget(){return this.isolate?this.container:document.documentElement}mountRoot(){return this.isolate?this.shadow?this.shadow:(this.shadow=this.container.shadowRoot??this.container.attachShadow({mode:"open"}),this.shadow):this.container}detachMedia(){this.mediaQuery&&this.mediaListener&&this.mediaQuery.removeEventListener("change",this.mediaListener),this.mediaQuery=null,this.mediaListener=null}adoptStoredTheme(){if(this.options.mode==="dialog"||typeof window>"u")return;let t=new URLSearchParams(window.location.search).get("theme");if(t==="light"||t==="dark"||t==="auto"){this.options.theme=t;return}try{let e=localStorage.getItem("web-mode");(e==="light"||e==="dark"||e==="auto")&&(this.options.theme=e)}catch{}}applyTheme(){this.detachMedia();let t=this.options.theme??"dark",e=this.themeTarget();if(t==="light")e.dataset.theme="light";else if(t==="auto"&&typeof window.matchMedia=="function"){let r=window.matchMedia("(prefers-color-scheme: light)");this.mediaQuery=r;let n=i=>{i?e.dataset.theme="light":e.removeAttribute("data-theme"),this.repaintQRPlate()};n(r.matches),this.mediaListener=i=>n(i.matches),r.addEventListener("change",this.mediaListener);return}else e.removeAttribute("data-theme");this.repaintQRPlate()}repaintQRPlate(){let t=this.mountRoot().querySelector("#did-connect-qr");if(!(t instanceof HTMLElement))return;let e=t.dataset.qrUrl;!e||!t.querySelector("canvas")||t.querySelector(".qr-timeout-overlay")||Fe(t,e)}filterMethods(t){return t.filter(e=>e==="passkey"?typeof window<"u"&&window.PublicKeyCredential!==void 0&&typeof window.PublicKeyCredential=="function":!0)}renderCard(t){let e=document.createElement("div");e.className=this.options.mode==="dialog"?"card card-modal":"card",this.cardEl=e,this.mountRoot().appendChild(e),this.switchView("methods",t)}renderCardTools(t){if(!(this.options.showLocaleSelector??this.options.mode!=="dialog"))return;let e=document.createElement("div");e.className="card-tools",this.renderLocaleSwitcher(e),t.appendChild(e)}renderLocaleSwitcher(t){let e=this.options.locales;if(e){this.renderLocaleMenu(t,e);return}if(pe.length<2)return;let r=document.createElement("div");r.className="locale-switcher";let n=this.options.locale,i=pe.find(s=>s.code!==n)??pe[0],a=document.createElement("button");a.type="button",a.className="locale-btn",a.innerHTML=`${Be} ${q(i.label)}`,a.title=i.label,a.addEventListener("click",()=>{this.options.onLocaleChange?.(i.code),this.update({locale:i.code})}),r.appendChild(a),t.appendChild(r)}renderLocaleMenu(t,e){if(e.length<2)return;this.detachLocaleMenu();let r=this.options.locale,n=e.find(u=>u.code===r)??e[0],i=document.createElement("div");i.className="locale-switcher";let a=document.createElement("button");a.type="button",a.className="locale-trigger",a.setAttribute("aria-haspopup","menu"),a.setAttribute("aria-expanded","false"),a.innerHTML=`${Be} <span class="locale-label">${q(n.label)}</span>`,a.title=n.label;let s=document.createElement("div");s.className="locale-menu",s.setAttribute("role","menu"),s.hidden=!0;let o=u=>{i.classList.toggle("open",u),s.hidden=!u,a.setAttribute("aria-expanded",u?"true":"false")};a.addEventListener("click",u=>{u.stopPropagation(),o(s.hidden),s.hidden||s.querySelector('[aria-checked="true"]')?.focus()});for(let u of e){let f=u.code===n.code,p=document.createElement("button");p.type="button",p.className="locale-btn",p.setAttribute("role","menuitemradio"),p.setAttribute("aria-checked",f?"true":"false"),p.dataset.locale=u.code,p.tabIndex=-1,p.title=u.label;{let E=document.createElement("span");E.className="locale-check",E.setAttribute("aria-hidden","true"),E.textContent=f?"\u2713":"",p.appendChild(E)}let l=document.createElement("span");l.textContent=u.label,p.appendChild(l),p.addEventListener("click",()=>{this.options.onLocaleChange?.(u.code),this.update({locale:u.code})}),s.appendChild(p)}i.addEventListener("keydown",u=>{let f=[...s.querySelectorAll(".locale-btn")],p=this.shadow?.activeElement??document.activeElement,l=f.indexOf(p);if(u.key==="Escape")u.preventDefault(),u.stopPropagation(),o(!1),a.focus();else if(u.key==="Tab")o(!1);else if(["ArrowDown","ArrowUp","Home","End"].includes(u.key)){u.preventDefault(),o(!0);let E=u.key==="Home"?0:u.key==="End"?f.length-1:l<0?u.key==="ArrowUp"?f.length-1:0:(l+(u.key==="ArrowUp"?-1:1)+f.length)%f.length;f[E]?.focus()}});let c=u=>{let f=u.composedPath();f.includes(i)||this.isolate&&f.includes(this.container)||o(!1)};document.addEventListener("click",c),this.localeOutsideClick=c,i.append(a,s),t.appendChild(i)}detachLocaleMenu(){this.localeOutsideClick&&(document.removeEventListener("click",this.localeOutsideClick),this.localeOutsideClick=null)}switchView(t,e){if(!this.cardEl)return;let r=this.options.locale;switch(this.currentView==="qr"&&t!=="qr"&&this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.generation++,this.oauthCleanup?.(),this.abort?.abort(),clearInterval(this.emailTimer),this.currentView=t,this.cardEl.innerHTML="",this.cardEl.dataset.view=t,this.renderCardTools(this.cardEl),t){case"methods":this.renderMethodsView(this.cardEl,r,e??this.filterMethods(this.options.methods));break;case"qr":this.renderQRView(this.cardEl,r);break;case"email":this.renderEmailView(this.cardEl,r);break}}markLastUsed(t,e,r){if(this.options.preferenceKey)try{if(localStorage.getItem(`did-login-method:${this.options.preferenceKey}`)!==e)return;let n=document.createElement("span");n.className="last-used",n.textContent=b("lastUsed",r),t.classList.add("has-last-used"),t.appendChild(n)}catch{}}renderMethodsView(t,e,r){this.options.mode!=="dialog"&&this.renderHomeLink(t,e),this.renderBrandHeader(t,e);let n=this.options.methods.includes("passkey");if(n&&!r.includes("passkey")){let o=document.createElement("div");o.className="compat-warning",o.textContent=b("passkeyUnsupported",e),t.appendChild(o)}let i=this.options.preferredLayout!=="passkey-first"&&r.includes("oauth")&&this.options.oauthProviders?.some(o=>o.enabled&&["google","apple"].includes(o.id));t.classList.toggle("social-first",!!i),i&&(this.renderSecondaryGrid(t,e,["oauth"],"primary"),this.renderDivider(t,e));let a=r.includes("passkey");a&&this.renderPasskeySection(t,e);let s=r.filter(o=>o!=="passkey");if(a&&s.length>0&&this.renderDivider(t,e),s.length>0)if(i){r.includes("email")&&this.renderSecondaryGrid(t,e,["email"]);let o=document.createElement("details");o.className="other-methods";let c=document.createElement("summary");c.textContent=b("otherMethods",e),o.appendChild(c),this.renderSecondaryGrid(o,e,r.filter(u=>u!=="email"),"secondary"),o.querySelector("button")&&t.appendChild(o)}else this.renderSecondaryGrid(t,e,r);if(r.length===0&&!n){let o=document.createElement("p");o.className="subtitle",o.textContent="No authentication methods available.",t.appendChild(o)}this.renderTrustFooter(t,e)}renderQRView(t,e){this.renderBackButton(t,e);let r=document.createElement("h2");r.className="view-title",r.textContent=b("scanTitle",e),t.appendChild(r);let n=document.createElement("div");n.id="did-connect-qr",n.className="qr-view",n.innerHTML='<div class="qr-placeholder"><span class="qr-spinner"></span></div>',t.appendChild(n);let i=document.createElement("button");i.className="btn btn-secondary deep-link-btn",i.id="did-wallet-open-btn",i.textContent=b("openInWallet",e),i.disabled=!0,_e()?t.insertBefore(i,n):t.appendChild(i);let a=document.createElement("div");a.id="did-connect-status",a.className="status",a.setAttribute("role","status"),t.appendChild(a),this.renderTrustFooter(t,e),this.startDIDConnectInView(a,n,i,e)}renderEmailView(t,e){this.renderBackButton(t,e);let r=document.createElement("h2");r.className="view-title",r.textContent=b("emailTitle",e),t.appendChild(r);let n=document.createElement("label");n.className="input-label",n.htmlFor="login-email-address",n.textContent=b("emailPlaceholder",e),t.appendChild(n);let i=document.createElement("p");i.className="email-help",i.textContent=b("emailExplanation",e),t.appendChild(i);let a=document.createElement("input");a.className="input",a.id="login-email-address",a.type="email",a.required=!0,a.autocomplete="email",a.value=this.emailDraft,a.setAttribute("aria-label",b("emailPlaceholder",e)),a.addEventListener("input",()=>{this.emailDraft=a.value}),a.placeholder=b("emailPlaceholder",e),t.appendChild(a);let s=document.createElement("button");s.className="btn",s.textContent=b("emailSubmit",e),t.appendChild(s);let o=document.createElement("div");o.className="status",o.setAttribute("role","status"),t.appendChild(o);let c=document.createElement("div");c.className="email-code-section",c.style.display="none";let u=document.createElement("label");u.className="input-label",u.htmlFor="login-email-code",u.textContent=b("emailCodePlaceholder",e),c.appendChild(u);let f=document.createElement("input");f.id="login-email-code",f.className="input",f.type="text",f.inputMode="numeric",f.maxLength=8,f.setAttribute("aria-label",b("emailCodePlaceholder",e)),f.autocomplete="one-time-code",f.placeholder=b("emailCodePlaceholder",e),c.appendChild(f);let p=document.createElement("button");p.className="btn",p.textContent=b("emailVerify",e),c.appendChild(p);let l=document.createElement("button");l.className="btn btn-secondary",l.textContent=b("emailResend",e),l.style.marginTop="8px",c.appendChild(l),t.insertBefore(c,o),this.renderTrustFooter(t,e);let E=this.generation,v=()=>this.mounted&&E===this.generation,D=document.createElement("button");D.className="passkey-alt",D.textContent=b("emailEdit",e),c.appendChild(D),D.addEventListener("click",()=>this.switchView("email"));let C=()=>{let I=60;clearInterval(this.emailTimer),l.disabled=!0,l.textContent=b("emailCooldown",e,{seconds:String(I)}),this.emailTimer=setInterval(()=>{I--,l.textContent=I>0?b("emailCooldown",e,{seconds:String(I)}):b("emailResend",e),I<=0&&(clearInterval(this.emailTimer),l.disabled=!1)},1e3)},F="",B,R=this.config.servicePrefix??"/.well-known/service",W=async()=>{if(s.disabled)return;let I=a.value.trim();if(!a.checkValidity()){o.textContent=b("emailInvalid",e),o.className="status error";return}s.disabled=!0,o.textContent=b("emailSending",e),o.className="status",o.setAttribute("role","status");try{let d=await this.http.post(`${R}/api/email/sendCode`,{email:I,locale:e});if(!v())return;C(),F=I,B=d?.id,a.style.display="none",n.hidden=!0,i.hidden=!0,s.style.display="none",c.style.display="",r.textContent=b("emailVerify",e),o.textContent=b("emailSent",e,{email:I}),o.className="status",f.focus()}catch(d){if(!v())return;let m=d instanceof Error?d.message:"Failed to send email";o.textContent=m,o.className="status error",s.disabled=!1}},L=async()=>{if(p.disabled)return;let I=f.value.trim();if(!/^\d{8}$/.test(I)){o.textContent=b("emailCodeInvalid",e),o.className="status error";return}p.disabled=!0,o.textContent=b("verifying",e),o.className="status";try{if(await this.http.post(`${R}/api/email/login`,{code:I,id:B}),!v())return;o.textContent=b("success",e),o.className="status",this.handleSuccess()}catch(d){if(!v())return;d instanceof Error&&"code"in d&&d.code==="FORBIDDEN"?this.showFullError(X(d,e)):(o.textContent=X(d,e),o.className="status error",p.disabled=!1,f.value="",f.focus())}};s.addEventListener("click",W),a.addEventListener("keydown",I=>{I.key==="Enter"&&W()}),p.addEventListener("click",L),f.addEventListener("keydown",I=>{I.key==="Enter"&&L()}),l.addEventListener("click",async()=>{if(!l.disabled){l.disabled=!0,o.textContent=b("emailSending",e),o.className="status";try{let I=await this.http.post(`${R}/api/email/sendCode`,{email:F,locale:e});if(!v())return;C(),B=I?.id,o.textContent=b("emailSent",e,{email:F}),o.className="status"}catch(I){if(!v())return;l.disabled=!1;let d=I instanceof Error?I.message:"Failed to resend";o.textContent=d,o.className="status error"}}})}renderBackButton(t,e,r=()=>this.switchView("methods")){let n=document.createElement("button");n.type="button",n.className="back-btn",n.innerHTML=`${ke} ${q(b("back",e))}`,n.addEventListener("click",r),t.appendChild(n)}renderHomeLink(t,e){if(this.options.dismissible===!1)return;let{homeUrl:r,onCancel:n}=this.options;if(!n&&!r)return;let i=`${ke} ${q(b("cancel",e))}`;if(n){let a=document.createElement("button");a.type="button",a.className="home-link",a.innerHTML=i,a.addEventListener("click",()=>{this.emit("cancel"),this.options.onCancel?.()}),t.appendChild(a)}else{let a=document.createElement("a");a.className="home-link",a.href=r,a.innerHTML=i,t.appendChild(a)}}renderBrandHeader(t,e){let r=document.createElement("div");if(r.className="brand-header",this.options.appLogo){let i=document.createElement("img");i.className="app-logo",i.src=q(this.options.appLogo),i.alt=this.options.appName?q(this.options.appName):"",i.width=48,i.height=48,r.appendChild(i)}let n=document.createElement("h1");if(this.options.appName?n.textContent=b("signInTo",e,{appName:this.options.appName}):n.textContent=b("signIn",e),this.options.purpose&&(n.textContent=this.options.purpose.title),n.id="login-title",r.appendChild(n),this.options.purpose?.description){let i=document.createElement("p");i.className="subtitle",i.textContent=this.options.purpose.description,r.appendChild(i)}if(this.options.masterAppName){let i=document.createElement("p");i.className="federated-hint",i.textContent=b("federatedBy",e,{masterName:this.options.masterAppName}),r.appendChild(i)}t.appendChild(r)}renderTrustFooter(t,e){let r=document.createElement("div");r.className="login-footer";let n=document.createElement("div");n.className="secured-badge",n.innerHTML=`${Ve} ${q(b("securedBy",e))}`,r.appendChild(n);let{privacyUrl:i,termsUrl:a}=this.options;if(i||a){let s=document.createElement("div");if(s.className="footer-links",i){let o=document.createElement("a");o.href=i,o.target="_blank",o.rel="noopener noreferrer",o.textContent=b("privacy",e),s.appendChild(o)}if(i&&a&&s.appendChild(document.createTextNode(" \xB7 ")),a){let o=document.createElement("a");o.href=a,o.target="_blank",o.rel="noopener noreferrer",o.textContent=b("terms",e),s.appendChild(o)}r.appendChild(s)}t.appendChild(r)}renderDivider(t,e){let r=document.createElement("div");r.className="divider",r.textContent=b("or",e),t.appendChild(r)}renderPasskeySection(t,e){let r=document.createElement("div");r.className="passkey-section",t.appendChild(r);let n=document.createElement("div");n.className="status",n.id="passkey-status",t.appendChild(n);let i=(l,E)=>{n.textContent=l,n.className=`status${E?" error":""}`},a=()=>i("",!1),s={waiting:b("passkeyWaiting",e),creating:b("passkeyCreating",e),verifying:b("verifying",e)},o=l=>l.success?(i(b("success",e),!1),this.handleSuccess(),!0):l.code==="FORBIDDEN"||l.error==="registration_closed"?(this.showFullError(X({message:l.error,code:l.code||l.error},e)),!0):!1,c=()=>{r.innerHTML="",i(b("passkeyNoLocal",e),!1);let l=document.createElement("button");l.className="btn",l.id="passkey-btn",l.innerHTML=`${fe} ${q(b("passkeyUseAnotherDevice",e))}`,r.appendChild(l),l.addEventListener("click",()=>f());let E=document.createElement("button");E.type="button",E.className="passkey-alt passkey-create-entry",E.textContent=b("passkeyCreateInstead",e),r.appendChild(E),E.addEventListener("click",()=>u())},u=()=>{this.cardEl?.classList.add("passkey-creating"),this.abort?.abort(),this.generation++,r.innerHTML="",a();let l=this.cardEl?.querySelector("h1");l&&(l.textContent=b("passkeyCreateAccount",e));let E=document.createElement("p");E.className="subtitle",E.textContent=b("passkeyExplanation",e),r.appendChild(E);let v=document.createElement("div");v.className="name-row visible",v.id="passkey-name-row";let D=document.createElement("input");D.className="input",D.id="passkey-name-input",D.type="text",D.setAttribute("aria-label",b("namePlaceholder",e)),D.placeholder=b("namePlaceholder",e),D.autocomplete="name",v.appendChild(D),r.appendChild(v);let C=document.createElement("button");C.className="btn",C.id="passkey-btn",C.innerHTML=`${fe} ${q(b("passkeyCreate",e))}`,r.appendChild(C),t.querySelector(".back-btn")?.remove(),this.renderBackButton(t,e,()=>p());let F=async()=>{if(C.disabled)return;C.disabled=!0,this.select("passkey");let B=this.generation,R=await le({registerOnly:!0,signal:this.abort?.signal,name:D.value.trim(),onStatus:i,texts:s,locale:e,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId});!this.mounted||B!==this.generation||this.abort?.signal.aborted||o(R)||(R.error&&i(R.error,!0),C.disabled=!1)};C.addEventListener("click",F),D.addEventListener("keydown",B=>{B.key==="Enter"&&F()}),C.focus()},f=async()=>{let l=r.querySelector("#passkey-btn");if(l?.disabled)return;l&&(l.disabled=!0),this.select("passkey");let E=this.generation,v=await le({authOnly:!0,signal:this.abort?.signal,onStatus:i,texts:s,locale:e,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId});if(!(!this.mounted||E!==this.generation||this.abort?.signal.aborted)&&!o(v)){if(v.error&&v.error!=="no_passkey"){i(v.error,!0),l&&(l.disabled=!1);return}this.emit("incomplete"),c()}},p=()=>{this.cardEl?.classList.remove("passkey-creating"),t.querySelector(".back-btn")?.remove(),this.abort?.abort(),this.generation++;let l=this.cardEl?.querySelector("h1");l&&(l.textContent=this.options.purpose?.title??(this.options.appName?b("signInTo",e,{appName:this.options.appName}):b("signIn",e))),r.innerHTML="",a();let E=document.createElement("button");E.className=this.cardEl?.classList.contains("social-first")?"btn btn-secondary":"btn",E.id="passkey-btn",E.innerHTML=`${fe} ${q(b("passkeySignIn",e))}`,this.markLastUsed(E,"passkey",e),r.appendChild(E),E.addEventListener("click",()=>f());let v=document.createElement("button");v.type="button",v.className="passkey-alt passkey-create-entry",v.textContent=b("passkeyFirstTime",e),r.appendChild(v),v.addEventListener("click",()=>u())};this.options.invitationId?u():p()}startOAuthPopup(t,e){this.oauthCleanup?.();let r=this.generation,n=this.options.locale,i=this.config.servicePrefix??"/.well-known/service",a=this.options.masterOAuthOrigin?`${this.options.masterOAuthOrigin}${i}`:i,s=new URL(a,window.location.href).origin,o=window.location.href;if(this.options.mode!=="dialog"&&window.location.pathname===`${i}/login`){let A=new URLSearchParams(window.location.search).get("return_to");try{let z=new URL(A||"/",window.location.origin);o=z.origin===window.location.origin&&!/^\/[/\\]/.test(z.pathname)?z.href:`${window.location.origin}/`}catch{o=`${window.location.origin}/`}}let c=`${a}/api/oauth/${encodeURIComponent(t)}/login?returnUrl=${encodeURIComponent(o)}`,u=this.options.oauthProviders?.find(A=>A.id===t)?.name??t,f=e.innerHTML,p=null,l=!1,E=!1,v=!1,D,C,F,B=()=>!l&&this.mounted&&r===this.generation,R=[],W=()=>{for(let A of this.cardEl?.querySelectorAll(".method-btn, .passkey-create-entry, #passkey-btn, .locale-trigger, .locale-btn")??[])R.push({button:A,disabled:A.disabled}),A.disabled=!0},L=document.createElement("div");L.className="oauth-recovery",L.setAttribute("role","status");let I=document.createElement("p"),d=document.createElement("div");d.className="oauth-recovery-actions";let m=document.createElement("button");m.type="button",m.className="oauth-retry",m.textContent=b("oauthReopen",n),m.hidden=!0,m.onclick=()=>{this.select("oauth"),this.activeProvider=t,this.startOAuthPopup(t,e)};let h=document.createElement("a");h.href=c,h.textContent=b("oauthFullPage",n),h.addEventListener("click",A=>{let z=L.dataset.state==="oauthUnconfirmed";if(E&&!l){A.preventDefault();return}z&&A.preventDefault(),this.options.onBeforeRedirect?.(),this.oauthCleanup?.(),z&&window.location.reload()});let g=document.createElement("button");g.type="button",g.className="oauth-cancel",g.textContent=b("cancel",n),d.append(m,h,g),L.append(I,d),e.parentElement?.after(L);let y=()=>{e.innerHTML=f,e.disabled=!1,e.classList.remove("oauth-btn-loading")},x=()=>{try{p?.close()}catch{}},w=()=>{l=!0,clearInterval(D),clearInterval(C),clearTimeout(F),window.removeEventListener("message",k);for(let A of R.splice(0))A.button.disabled=A.disabled;y()},T=A=>{I.textContent=b(A,n,{provider:u}),L.dataset.state=A,d.hidden=!1,m.hidden=!1,g.hidden=!0,y()},S=A=>{B()&&(w(),x(),T(A),this.emit("incomplete"))},P=()=>{B()&&(w(),x(),L.remove(),e.textContent=b("success",n),e.disabled=!0,this.handleSuccess())};g.onclick=()=>{E||(S("oauthCancelled"),e.focus())};let k=async A=>{if(A.origin!==s||A.source!==p||!p||!A.data||A.data.type!=="authorization_response"||!B()||E)return;if(clearInterval(D),clearInterval(C),A.data.error){S(A.data.error==="access_denied"?"oauthDenied":A.data.error==="cancelled"?"oauthCancelled":"oauthFailed");return}let{code:z,state:se}=A.data.response??A.data;if(typeof z!="string"||!z||typeof se!="string"||!se){S("oauthFailed");return}E=!0,W(),d.hidden=!0,x(),I.textContent=b("verifying",n),e.textContent=b("verifying",n),e.disabled=!0;try{let V={provider:t,code:z,state:se};this.options.invitationId&&(V.invitationId=this.options.invitationId),await this.http.post(`${i}/api/oauth/login`,V,{signal:this.abort?.signal}),P()}catch(V){if(!B())return;let j=V instanceof Error&&"code"in V?String(V.code):"",ae=V instanceof Error?V.message:"";j==="FORBIDDEN"||j==="registration_closed"||ae==="registration_closed"?(w(),L.remove(),this.showFullError(X(V,n))):S("oauthFailed")}};this.oauthCleanup=()=>{w(),L.remove(),x()},window.addEventListener("message",k);try{p=window.open(c,"oauth-login:popup",`left=${window.screenX+(window.innerWidth-500)/2},top=${window.screenY+(window.innerHeight-620)/2},width=500,height=620,resizable,scrollbars=yes,status=1,popup`)}catch{}if(!p){S("oauthBlocked");return}I.textContent=b("oauthWaiting",n,{provider:u}),e.textContent=b("oauthWaiting",n,{provider:u}),e.disabled=!0,e.classList.add("oauth-btn-loading");let N=async()=>{if(!(!B()||E||v)){v=!0;try{let A=await this.http.get(`${i}/api/did/session`);B()&&!E&&A?.authenticated===!0&&P()}catch{}finally{v=!1}}};D=setInterval(()=>{let A=!1;try{A=!!p?.closed}catch{return}!A||!B()||(clearInterval(D),T("oauthIncomplete"),g.hidden=!1,N(),C=setInterval(()=>{N()},2e3))},500),F=setTimeout(()=>{if(B()){if(!E){S("oauthTimedOut");return}this.abort?.abort(),w(),x(),W(),I.textContent=b("oauthUnconfirmed",n),L.dataset.state="oauthUnconfirmed",d.hidden=!1,m.hidden=!0,g.hidden=!0,h.href=window.location.href,h.textContent=b("oauthCheckSession",n),this.emit("incomplete")}},300*1e3)}renderSecondaryGrid(t,e,r,n){let i=document.createElement("div");if(i.className="methods-grid",r.includes("oauth")&&this.options.oauthProviders?.length){let a=this.options.oauthProviderOrder??["google","apple","github"],s=u=>a.includes(u)?a.indexOf(u):a.length,o=!!this.options.oauthProviderOrder||this.options.oauthProviders?.some(u=>u.order!==void 0&&u.order!==999),c=(this.options.oauthProviders??[]).filter(u=>u.enabled&&(!n||(o||["google","apple"].includes(u.id))===(n==="primary"))).sort((u,f)=>this.options.oauthProviderOrder?s(u.id)-s(f.id):(u.order??999)-(f.order??999)||s(u.id)-s(f.id));for(let u of c){let f=document.createElement("button");f.className="method-btn",f.dataset.provider=u.id;let p=Ye(u.id);f.innerHTML=`${p} ${q(b("continueWith",e,{provider:u.name}))}`,this.markLastUsed(f,`oauth:${u.id}`,e),i.appendChild(f),f.addEventListener("click",()=>{this.select("oauth"),this.activeProvider=u.id,this.startOAuthPopup(u.id,f)})}}if(r.includes("email")){let a=document.createElement("button");a.className="method-btn",a.id="email-btn",a.innerHTML=`${qe} ${q(b("emailButton",e))}`,this.markLastUsed(a,"email",e),i.appendChild(a),a.addEventListener("click",()=>{this.select("email"),this.switchView("email")})}if(r.includes("did-connect")){let a=document.createElement("button");a.className="method-btn",a.id="did-wallet-btn";let s=i.children.length>0?b("didWalletButtonShort",e):b("didWalletButton",e);a.innerHTML=`${ve} ${q(s)}`,this.markLastUsed(a,"did-connect",e),i.appendChild(a),a.addEventListener("click",()=>{this.select("did-connect"),this.switchView("qr")})}t.appendChild(i)}async startDIDConnectInView(t,e,r,n){t.textContent=b("connecting",n);let i=this.generation,a=()=>this.mounted&&i===this.generation;try{this.tokenSession?.destroy(),this.tokenSession=new ne(this.config,this.http),this.tokenSession.on("succeed",async()=>{if(a()){this.showConnectResult(e,r,t,b("verifying",n));try{let o=this.config.servicePrefix??"/.well-known/service";if(await this.http.post(`${o}/api/did/connect/complete`,{token:this.tokenSession.state.token}),!a())return;this.showConnectSuccess(e,r,t,n),this.handleSuccess()}catch(o){if(!a())return;this.showConnectResult(e,r,t,X(o,n),!0)}}}),this.tokenSession.on("timeout",()=>{t.textContent="";let o=document.createElement("div");o.className="qr-timeout-overlay",o.innerHTML=`<span class="timeout-text">${q(b("timeout",n))}</span>`;let c=document.createElement("button");c.className="refresh-btn",c.textContent=b("refreshQR",n),c.addEventListener("click",()=>{o.remove(),ge(e),e.innerHTML='<div class="qr-placeholder"><span class="qr-spinner"></span></div>',r.disabled=!0,this.startDIDConnectInView(t,e,r,n)}),o.appendChild(c),(e.querySelector(".qr-plate")??e).appendChild(o)}),this.tokenSession.on("error",o=>{this.showConnectResult(e,r,t,X(o,n),!0)}),this.tokenSession.on("statusChange",o=>{o.status==="scanned"&&this.showConnectScanned(e,r,t,n)});let s=await this.tokenSession.create({locale:n});if(!a())return;s.url&&(Fe(e,s.url),r.disabled=!1,r.addEventListener("click",()=>{t.textContent=b("walletRetry",n),this.openInWallet(s.url,n)})),t.textContent=b("scanWithWallet",n),this.tokenSession.startPolling()}catch(s){if(!a())return;t.textContent=X(s,n),ge(e)}}showFullError(t){if(!this.cardEl)return;let e=this.options.locale;this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.cardEl.innerHTML="",this.cardEl.dataset.view="error",this.renderCardTools(this.cardEl);let r=document.createElement("div");r.className="connect-result",r.innerHTML='<div class="result-icon result-error">\u2715</div>',this.cardEl.appendChild(r);let n=document.createElement("div");n.className="status error",n.textContent=t,this.cardEl.appendChild(n);let i=document.createElement("button");i.className="btn btn-secondary result-back-btn",i.textContent=b("back",e),i.addEventListener("click",()=>this.switchView("methods")),this.cardEl.appendChild(i),this.renderTrustFooter(this.cardEl,e)}showConnectScanned(t,e,r,n="en"){t.style.display="none",e.style.display="none";let i=t.parentElement?.querySelector(".connect-result");i||(i=document.createElement("div"),i.className="connect-result",t.parentElement?.insertBefore(i,r)),i.innerHTML=`<div class="connect-status-icon">
855
+ <div class="connect-spinner-ring"></div>
856
+ <span class="connect-status-badge">${ve}</span>
857
+ </div>`,r.textContent=b("waitingWallet",n),r.className="status";let a=r.parentElement?.querySelector(".connect-subtitle");a||(a=document.createElement("p"),a.className="connect-subtitle",r.parentElement?.insertBefore(a,r.nextSibling)),a.textContent=b("walletContinue",n);let s=r.parentElement?.querySelector(".result-back-btn");s||(s=document.createElement("button"),s.className="btn btn-secondary result-back-btn",s.textContent=b("back",n),s.addEventListener("click",()=>this.switchView("methods")),a.parentElement?.insertBefore(s,a.nextSibling))}showConnectSuccess(t,e,r,n="en"){t.style.display="none",e.style.display="none";let i=t.parentElement?.querySelector(".connect-result");i||(i=document.createElement("div"),i.className="connect-result",t.parentElement?.insertBefore(i,r)),i.innerHTML=`<div class="connect-status-icon connect-success">
858
+ <svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="28" fill="none" stroke="#49dc6e" stroke-width="3"/><polyline points="20 33 28 41 44 25" fill="none" stroke="#49dc6e" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg>
859
+ </div>`,r.textContent=b("success",n),r.className="status success";let a=r.parentElement?.querySelector(".connect-subtitle"),s=r.parentElement?.querySelector(".result-back-btn");a?.remove(),s?.remove()}showConnectResult(t,e,r,n,i=!1){let a=this.options.locale;t.style.display="none",e.style.display="none";let s=t.parentElement?.querySelector(".connect-result");if(s||(s=document.createElement("div"),s.className="connect-result",t.parentElement?.insertBefore(s,r)),i){s.innerHTML='<div class="result-icon result-error">\u2715</div>',r.textContent=n,r.className="status error";let o=r.parentElement?.querySelector(".result-back-btn");o||(o=document.createElement("button"),o.className="btn btn-secondary result-back-btn",o.textContent=b("back",a),o.addEventListener("click",()=>this.switchView("methods")),r.parentElement?.insertBefore(o,r.nextSibling))}else s.innerHTML='<div class="result-icon result-loading"><span class="qr-spinner"></span></div>',r.textContent=n,r.className="status"}openInWallet(t,e="en"){let r=_e(),n=dt();if(r){let i=t.replace(/^https?:\/\//,"abt://");window.location.href=i}else if(n&&typeof n.open=="function"){let i=this.tokenSession?.state;n.open({action:this.config.action??"login",locale:e,url:encodeURIComponent(t),appInfo:i?.appInfo??{},memberAppInfo:i?.memberAppInfo??{}})}else{let i=`${ct}?action=requestAuth&url=${encodeURIComponent(t)}`,a=414,s=736,o=window.screenX+window.innerWidth-a,c=window.screenY;window.open(i,"did-wallet:popup",`left=${o},top=${c},width=${a},height=${s},resizable,scrollbars=yes,status=1,popup`)}}handleSuccess(){if(!(!this.mounted||this.completed)){if(this.completed=!0,this.emit("success"),this.options.preferenceKey&&this.activeMethod)try{localStorage.setItem(`did-login-method:${this.options.preferenceKey}`,this.activeMethod==="oauth"&&this.activeProvider?`oauth:${this.activeProvider}`:this.activeMethod)}catch{}if(this.options.onSuccess){let t=this.generation;Promise.resolve().then(()=>{if(this.mounted&&t===this.generation)return this.options.onSuccess?.()}).catch(()=>{!this.mounted||t!==this.generation||(this.completed=!1,this.showFullError(b("authFailed",this.options.locale)))})}else setTimeout(()=>location.reload(),300)}}},ht=`${Te}${Se}
860
+ :host { color-scheme: dark; }
861
+ :host([data-theme="light"]) { color-scheme: light; }
862
+ dialog { box-sizing:border-box; position:fixed; inset:0; margin:auto; padding:0;
863
+ width:min(420px,calc(100vw - 32px)); max-width:none; max-height:calc(100dvh - 32px);
864
+ border:1px solid var(--border); border-radius:16px; background:var(--bg-card);
865
+ color:var(--text); color-scheme:inherit; overflow:hidden; box-shadow:var(--shadow-lg); }
866
+ dialog::backdrop { background:rgba(8,10,18,.56); }
867
+ :host(:not([data-theme="light"])) dialog::backdrop { background:rgba(0,0,0,.68); }
868
+ [data-dialog-scroll] { max-height:calc(100dvh - 34px); overflow:auto; overscroll-behavior:contain; }
869
+ .close { position:absolute; top:8px; right:8px; z-index:3; display:grid; place-items:center;
870
+ box-sizing:border-box; width:44px; height:44px; padding:0; border:1px solid transparent;
871
+ border-radius:10px; background:var(--bg-card); color:var(--text-secondary);
872
+ font:400 24px/1 system-ui,sans-serif; cursor:pointer; }
873
+ .close:hover { color:var(--text); background:var(--bg-hover); }
874
+ .close:focus-visible { outline:2px solid var(--blue); outline-offset:-3px; }
875
+ .host-error { padding:16px 20px; font:14px/1.5 system-ui,sans-serif; overflow-wrap:anywhere; }
876
+ .retry { padding:10px 16px; margin:0 20px 20px; color:var(--text); background:var(--bg-elevated);
877
+ border:1px solid var(--border); border-radius:8px; font:inherit; cursor:pointer; }
878
+ `,Le=class{config;http;options;host;dialog;page;previous;themeObserver;systemTheme;syncTheme=()=>this.applyTheme(this.hostTheme());constructor(t,e,r={}){this.config=t,this.http=e,this.options=r}mount(){if(this.dialog)return;let t=document.documentElement.lang;t&&(this.options.locale=t);let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;this.previous=this.options.returnFocus??(e instanceof HTMLElement?e:void 0);let r=document.createElement("div");r.dataset.didLoginDialogHost="",r.style.cssText="position:fixed;width:0;height:0;",this.host=r;let n=r.attachShadow({mode:"open"}),i=document.createElement("style");i.textContent=ht,n.append(i);let a=document.createElement("dialog");this.dialog=a,a.setAttribute("aria-label",this.options.purpose?.title??b("signIn",this.options.locale)),n.append(a);let s=document.createElement("button");s.type="button",s.className="close",s.textContent="\xD7",s.setAttribute("aria-label",b("cancel",this.options.locale));let o=()=>{if(!(this.options.dismissible===!1||this.dialog!==a)){try{this.options.onEvent?.({name:"cancel",mode:"dialog"})}catch{}this.destroy(),this.options.onCancel?.()}};s.addEventListener("click",o),this.options.dismissible!==!1&&a.append(s);let c=document.createElement("div");c.dataset.dialogScroll="",a.append(c);let u=document.createElement("div");u.dataset.loginDialogMount="",c.append(u),a.addEventListener("cancel",l=>{l.preventDefault(),o()}),document.body.append(r);let f=this.hostTheme();r.dataset.theme=f,this.page=new me(u,this.config,this.http,{...this.options,theme:f,isolate:!0,mode:"dialog",onCancel:o,onLocaleChange:l=>{this.options.locale=l,s.setAttribute("aria-label",b("cancel",l)),a.setAttribute("aria-label",this.options.purpose?.title??b("signIn",l)),this.options.onLocaleChange?.(l)},onSuccess:async()=>{let l=()=>{if(!a.isConnected||this.dialog!==a)return;for(let D of c.querySelectorAll(".host-error, .retry"))D.remove();let E=document.createElement("p");E.className="host-error",E.setAttribute("role","alert"),E.textContent=b("authFailed",this.options.locale);let v=document.createElement("button");v.type="button",v.className="retry",v.textContent=b("tryAgain",this.options.locale),v.onclick=async()=>{v.disabled=!0;try{await this.options.onSuccess?.(),this.dialog===a&&this.destroy()}catch{l()}},c.append(E,v)};try{await this.options.onSuccess?.(),this.dialog===a&&this.destroy()}catch{l()}}}),this.page.mount(),this.themeObserver=new MutationObserver(this.syncTheme);for(let l of[document.documentElement,document.body])this.themeObserver.observe(l,{attributes:!0,attributeFilter:["data-theme","data-mode","class","style"]});typeof window.matchMedia=="function"&&(this.systemTheme=window.matchMedia("(prefers-color-scheme: dark)"),this.systemTheme.addEventListener("change",this.syncTheme)),a.showModal();let p=u.shadowRoot?.querySelector("h1, h2");p&&(p.tabIndex=-1,p.focus({preventScroll:!0}))}hostTheme(){for(let t of[document.documentElement,document.body])for(let e of["data-mode","data-theme"]){let r=t.getAttribute(e);if(r==="light"||r==="dark")return r;if(r==="system"||r==="auto")return window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}for(let t of[document.documentElement,document.body]){if(t.classList.contains("dark"))return"dark";if(t.classList.contains("light"))return"light"}for(let t of[document.body,document.documentElement]){let e=getComputedStyle(t).colorScheme.split(/\s+/);if(e.includes("light")&&e.includes("dark"))return window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light";if(e.includes("light"))return"light";if(e.includes("dark"))return"dark"}return this.options.theme==="light"||this.options.theme==="dark"?this.options.theme:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}setTheme(t){this.options.theme=t,this.applyTheme(t)}applyTheme(t){this.host&&(this.host.dataset.theme=t),this.page?.setTheme(t)}destroy(){this.themeObserver?.disconnect(),this.themeObserver=void 0,this.systemTheme?.removeEventListener("change",this.syncTheme),this.systemTheme=void 0,this.page?.destroy(),this.page=void 0,this.dialog?.close(),this.dialog?.remove(),this.dialog=void 0,this.host?.remove(),this.host=void 0,this.previous?.isConnected&&this.previous.focus({preventScroll:!0})}};return $e(pt);})();