@arcblock/did-connect-service 4.0.1-beta.0 → 4.0.1-beta.2
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.
- package/dist/_generated/login-bundle-string.d.ts +1 -1
- package/dist/_generated/login-bundle-string.d.ts.map +1 -1
- package/dist/_generated/login-bundle-string.js +1 -1
- package/dist/_generated/login-bundle-string.js.map +1 -1
- package/dist/blocklet-service-rpc-types.d.ts +19 -0
- package/dist/blocklet-service-rpc-types.d.ts.map +1 -1
- package/dist/blocklet-service-rpc.d.ts +5 -1
- package/dist/blocklet-service-rpc.d.ts.map +1 -1
- package/dist/blocklet-service-rpc.js +13 -0
- package/dist/blocklet-service-rpc.js.map +1 -1
- package/dist/handlers/admin-instance-handler.d.ts +7 -1
- package/dist/handlers/admin-instance-handler.d.ts.map +1 -1
- package/dist/handlers/admin-instance-handler.js +51 -3
- package/dist/handlers/admin-instance-handler.js.map +1 -1
- package/dist/pages/admin-instances-page.d.ts.map +1 -1
- package/dist/pages/admin-instances-page.js +10 -0
- package/dist/pages/admin-instances-page.js.map +1 -1
- package/dist/store/d1-store.d.ts +16 -0
- package/dist/store/d1-store.d.ts.map +1 -1
- package/dist/store/d1-store.js +97 -0
- package/dist/store/d1-store.js.map +1 -1
- package/migrations/0007_instance_hosts.sql +9 -0
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default: "\"use strict\";var __LoginBundle=(()=>{var ie=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ae=(o,e)=>{for(var r in e)ie(o,r,{get:e[r],enumerable:!0})},Ie=(o,e,r,t)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let n of Te(e))!De.call(o,n)&&n!==r&&ie(o,n,{get:()=>e[n],enumerable:!(t=ke(e,n))||t.enumerable});return o};var Re=o=>Ie(ie({},\"__esModule\",{value:!0}),o);var it={};Ae(it,{FetchHttpAdapter:()=>G,LoginPage:()=>ve,runPasskeyAuth:()=>re});var M={CREATED:\"created\",SCANNED:\"scanned\",SUCCEED:\"succeed\",ERROR:\"error\",TIMEOUT:\"timeout\",BUSY:\"busy\",FORBIDDEN:\"forbidden\"};var O={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 ne=\"did:abt:\";function he(o){if(!o||typeof o!=\"string\")return!1;let e=o.replace(ne,\"\");return/^(0x)?[0-9a-f]{40}$/i.test(e)}function fe(o,e=8,r=6){return!o||typeof o!=\"string\"?\"\":o.length<=e+r+3?o:`${o.slice(0,e)}...${o.slice(-r)}`}function ae(o,e={}){if(!o||typeof o!=\"string\")return{prefix:\"DID: ABT:\",chainLabel:\"ABT\",address:\"\",compact:\"\",copyText:\"\"};let{startChars:r=8,endChars:t=6}=e,n=he(o),a=o.replace(ne,\"\"),i=n?\"ETH\":\"ABT\",s=e.includePrefix??!n;return{prefix:`DID: ${i}:`,chainLabel:i,address:a,compact:fe(a,r,t),copyText:s?`${ne}${a}`:a}}var B={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\"},N=class extends Error{code;constructor(e,r){super(r),this.name=\"ConnectError\",this.code=e}};var G=class{_defaultHeaders;_onRequest;constructor(e){this._defaultHeaders=e?.headers??{},this._onRequest=e?.onRequest}async get(e,r){this._validateUrl(e);let t=r?.params?this._serializeParams(r.params):\"\",n=t?`${e}${e.includes(\"?\")?\"&\":\"?\"}${t}`:e,i={method:\"GET\",headers:{...this._defaultHeaders,...r?.headers},signal:r?.signal};return this._onRequest&&(i=this._onRequest(n,i)),this._execute(n,i)}async post(e,r,t){this._validateUrl(e);let n=t?.params?this._serializeParams(t.params):\"\",a=n?`${e}${e.includes(\"?\")?\"&\":\"?\"}${n}`:e,s={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...this._defaultHeaders,...t?.headers},body:r!==void 0?JSON.stringify(r):void 0,signal:t?.signal};return this._onRequest&&(s=this._onRequest(a,s)),this._execute(a,s)}_validateUrl(e){if(!e?.trim())throw new N(B.NETWORK_ERROR,\"Request URL must not be empty\");if(e.trim().toLowerCase().startsWith(\"javascript:\"))throw new N(B.NETWORK_ERROR,\"Invalid URL protocol\")}async _execute(e,r){let t;try{t=await globalThis.fetch(e,r)}catch(i){throw i?.name===\"AbortError\"?i:new N(B.NETWORK_ERROR,`Network request failed: ${i?.message??\"Unknown error\"}`)}if(!t.ok){let i=\"\",s=\"\";try{let h=await t.text();try{let b=JSON.parse(h);b.error&&(i=b.error),b.code&&(s=b.code)}catch{i=h}}catch{}let l=s===\"FORBIDDEN\"?B.FORBIDDEN:B.NETWORK_ERROR;throw new N(l,i||`HTTP ${t.status} ${t.statusText||\"Error\"}`)}if(t.status===204)return null;let n=await t.text();if(!n.trim())return null;let a=t.headers.get(\"content-type\")??\"\";if(!a.includes(\"application/json\")&&!a.includes(\"+json\"))throw new N(B.INVALID_RESPONSE,`Expected JSON response but received: ${a||\"unknown content type\"}`);try{return JSON.parse(n)}catch{throw new N(B.INVALID_RESPONSE,\"Failed to parse JSON response\")}}_serializeParams(e){let r=[];for(let t of Object.keys(e)){let n=e[t];if(n!=null)if(Array.isArray(n))for(let a of n)a!=null&&r.push(`${encodeURIComponent(t)}=${encodeURIComponent(String(a))}`);else typeof n==\"boolean\"?r.push(`${encodeURIComponent(t)}=${n?\"true\":\"false\"}`):r.push(`${encodeURIComponent(t)}=${encodeURIComponent(String(n))}`)}return r.join(\"&\")}};function Q(o){let e=o.apiPrefix??O.API_PREFIX,r=o.action??O.ACTION,t=e.replace(/\\/+$/,\"\"),n=r.replace(/^\\/+/,\"\");return`${t}/${n}`}function ge(){return{token:null,url:null,status:null,error:null,appInfo:null,memberAppInfo:null,loading:!1}}var J=class{_state;_config;_http;_pollTimer=null;_checkCount=0;_maxCheckCount;_realtimeUnsub=null;_realtime;_storage;_lastCreateTime=0;_listeners=new Map;_destroyed=!1;constructor(e,r,t){this._config=this._fillDefaults(e),this._http=r,this._realtime=t?.realtime,this._storage=t?.storage,this._state=ge(),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<O.CREATE_THROTTLE)return this.state;(this._pollTimer!==null||this._realtimeUnsub!==null)&&this.stopPolling(),this._state.loading=!0,this._emit(\"statusChange\",this.state);let r=`${Q(this._config)}/token`,t={};e?(e.locale!=null&&(t.locale=e.locale),e.provider!=null?t.provider=e.provider:t.provider=\"wallet\",e.encKey!=null&&(t.__encKey=e.encKey),e.autoConnect!=null&&(t.autoConnect=e.autoConnect),e.visitorId!=null&&(t.visitorId=e.visitorId),e.sourceToken!=null&&(t.sourceToken=e.sourceToken),e.forceConnected!=null&&(t.forceConnected=e.forceConnected),e.connectUrl!=null&&(t.connectUrl=e.connectUrl),e.extraParams&&Object.assign(t,e.extraParams)):t.provider=\"wallet\";try{let n=await this._http.get(r,{params:t});return this._state.token=n.token??null,this._state.url=n.url??null,this._state.status=M.CREATED,this._state.appInfo=n.appInfo??null,this._state.memberAppInfo=n.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(n){throw this._state.loading=!1,this._state.error=n?.message??\"Failed to create token\",this._state.status=M.ERROR,this._emit(\"statusChange\",this.state),this._emit(\"error\",new N(B.NETWORK_ERROR,this._state.error)),n}}async checkStatus(){if(!this._state.token)throw new N(B.TOKEN_NOT_FOUND,\"No token available. Call create() first.\");let e=`${Q(this._config)}/status`,r={[O.TOKEN_KEY]:this._state.token};this._config.appPid;try{let t=await this._http.get(e,{params:r}),n=t.status;return n&&(this._state.status=n),t.error!==void 0&&(this._state.error=t.error),t.connectedDid!==void 0&&(this._state.connectedDid=t.connectedDid),t.mfaCode!==void 0&&(this._state.mfaCode=t.mfaCode),t.saveConnect!==void 0&&(this._state.saveConnect=t.saveConnect),n===M.FORBIDDEN?(this._state.status=M.ERROR,this._state.error=t.error||\"Access forbidden\",this._emit(\"error\",new N(B.UNAUTHORIZED,this._state.error)),this.stopPolling()):n===M.SUCCEED?(this._config.tokenDelivery===\"response\"&&(this._state.successResult=t),this._emit(\"succeed\",this.state),this.stopPolling()):n===M.ERROR?(this._emit(\"error\",new N(B.INVALID_RESPONSE,this._state.error||\"Unknown error\")),this.stopPolling()):n===M.TIMEOUT&&(this._emit(\"timeout\",this.state),this.stopPolling()),this._emit(\"statusChange\",this.state),this.state}catch(t){throw t}}async cancel(){if(!this._state.token)return;let e=`${Q(this._config)}/timeout`,r={[O.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=ge(),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 t=this._listeners.get(e);return t||(t=new Set,this._listeners.set(e,t)),t.add(r),this}off(e,r){let t=this._listeners.get(e);return t&&(t.delete(r),t.size===0&&this._listeners.delete(e)),this}_emit(e,...r){let t=this._listeners.get(e);if(!(!t||t.size===0))for(let n of[...t])try{n(...r)}catch{}}_pollOnce(){if(this._checkCount++,this._checkCount>=this._maxCheckCount){this._handleTimeout();return}this.checkStatus().catch(()=>{})}_handleTimeout(){this.stopPolling(),this._state.status=M.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===M.FORBIDDEN?(this._state.status=M.ERROR,this._state.error=e.error||\"Access forbidden\",this._emit(\"error\",new N(B.UNAUTHORIZED,this._state.error)),this.stopPolling()):r===M.SUCCEED?(this._config.tokenDelivery===\"response\"&&(this._state.successResult=e),this._emit(\"succeed\",this.state),this.stopPolling()):r===M.ERROR?(this._emit(\"error\",new N(B.INVALID_RESPONSE,this._state.error||\"Unknown error\")),this.stopPolling()):r===M.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??O.API_PREFIX,action:e.action??O.ACTION,servicePrefix:e.servicePrefix??O.SERVICE_PREFIX,tokenTimeout:e.tokenTimeout??O.TOKEN_TIMEOUT,checkInterval:e.checkInterval??O.CHECK_INTERVAL,tokenDelivery:e.tokenDelivery??O.TOKEN_DELIVERY}}};var k={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\"}},P={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)\"}},Ne=`\n :root {\n /* Backgrounds \\u2014 layered depth */\n --bg-root: ${k.bg.root};\n --bg-surface: ${k.bg.surface};\n --bg-card: ${k.bg.card};\n --bg-elevated: ${k.bg.elevated};\n --bg-hover: ${k.bg.hover};\n --bg-active: ${k.bg.active};\n --bg-input: ${k.bg.input};\n\n /* Borders \\u2014 semi-transparent for adaptability */\n --border: ${k.border.default};\n --border-subtle:${k.border.subtle};\n --border-strong:${k.border.strong};\n --border-focus: ${k.border.focus};\n\n /* Text hierarchy */\n --text: ${k.text.primary};\n --text-secondary:${k.text.secondary};\n --text-tertiary:${k.text.tertiary};\n --text-placeholder:${k.text.placeholder};\n --text-white: ${k.text.white};\n\n /* Accents */\n --blue: ${k.color.blue};\n --blue-hover: ${k.color.blueHover};\n --blue-light: ${k.color.blueLight};\n --blue-muted: ${k.color.blueMuted};\n --red: ${k.color.red};\n --red-light: ${k.color.redLight};\n --red-text: ${k.color.redText};\n --green: ${k.color.green};\n --green-light: ${k.color.greenLight};\n --green-text: ${k.color.greenText};\n --yellow: ${k.color.yellow};\n --yellow-light: ${k.color.yellowLight};\n --yellow-text: ${k.color.yellowText};\n --info: ${k.color.info};\n --info-light: ${k.color.infoLight};\n --info-text: ${k.color.infoText};\n\n /* Radii */\n --radius-xs: ${k.radius.xs};\n --radius-sm: ${k.radius.sm};\n --radius: ${k.radius.md};\n --radius-lg: ${k.radius.lg};\n --radius-full: ${k.radius.full};\n\n /* Shadows */\n --shadow-sm: ${k.shadow.sm};\n --shadow-md: ${k.shadow.md};\n --shadow-lg: ${k.shadow.lg};\n --shadow-focus: ${k.shadow.focus};\n }\n`,Se=`\n [data-theme=\"light\"] {\n --bg-root: ${P.bg.root};\n --bg-surface: ${P.bg.surface};\n --bg-card: ${P.bg.card};\n --bg-elevated: ${P.bg.elevated};\n --bg-hover: ${P.bg.hover};\n --bg-active: ${P.bg.active};\n --bg-input: ${P.bg.input};\n\n --border: ${P.border.default};\n --border-subtle:${P.border.subtle};\n --border-strong:${P.border.strong};\n --border-focus: ${P.border.focus};\n\n --text: ${P.text.primary};\n --text-secondary:${P.text.secondary};\n --text-tertiary:${P.text.tertiary};\n --text-placeholder:${P.text.placeholder};\n --text-white: ${P.text.white};\n\n --shadow-sm: ${P.shadow.sm};\n --shadow-md: ${P.shadow.md};\n --shadow-lg: ${P.shadow.lg};\n --shadow-focus: ${P.shadow.focus};\n }\n`,Be=`\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n html { color-scheme: dark; }\n html[data-theme=\"light\"] { color-scheme: light; }\n body {\n font-family: ${k.font.family};\n background: var(--bg-root);\n color: var(--text);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n font-size: ${k.font.sizeBase};\n line-height: ${k.font.lineHeight};\n }\n a { color: var(--blue-muted); text-decoration: none; }\n a:hover { text-decoration: underline; }\n .hidden { display: none; }\n`,Pe=typeof HTMLElement<\"u\"?HTMLElement:class{},me='<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>',Oe='<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>',Le=`\n:host {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n overflow: hidden;\n font-family: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;\n line-height: 1.5;\n}\n:host([block]) { display: flex; }\n.prefix {\n flex-shrink: 0;\n opacity: 0.6;\n margin-right: 4px;\n white-space: nowrap;\n}\n.address {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: var(--did-text-color, currentColor);\n}\n.address-compact {\n white-space: nowrap;\n color: var(--did-text-color, currentColor);\n cursor: default;\n}\n.clickable { cursor: pointer; }\n.clickable:hover { opacity: 0.8; }\n.copy-btn {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1em;\n height: 1em;\n margin-left: 6px;\n padding: 0;\n border: none;\n background: none;\n color: inherit;\n opacity: 0.5;\n cursor: pointer;\n transition: opacity 0.15s;\n}\n.copy-btn:hover { opacity: 1; }\n.copy-btn.copied { opacity: 1; color: var(--did-copy-success-color, #22c55e); }\n`,$e=class extends Pe{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 o=Number(this.getAttribute(\"start-chars\")),e=Number(this.getAttribute(\"end-chars\"));return ae(this.getAttribute(\"did\")||\"\",{startChars:o>0?o: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\"),t=!this.hasAttribute(\"no-copy\")&&this.getAttribute(\"copyable\")!==\"false\",n=this.hasAttribute(\"show-prefix\"),a=this.hasAttribute(\"no-tooltip\"),i=Number(this.getAttribute(\"size\"))||0,s=i>=12?`${i}px`:\"inherit\",l=r?e.compact:e.address,h=!a&&r?` title=\"${e.address}\"`:\"\",b=n?`<span class=\"prefix\">${e.prefix} </span>`:\"\",p=r?\"address-compact\":\"address\",u=t?\" clickable\":\"\",y=t?`<button class=\"copy-btn\" aria-label=\"Copy DID\">${me}</button>`:\"\";if(this.shadow.innerHTML=`\n <style>${Le}:host { font-size: ${s}; }</style>\n ${b}<span class=\"${p}${u}\"${h}>${l}</span>${y}\n `,t){let x=this.shadow.querySelector(`.${p}`);x&&x.addEventListener(\"click\",T=>{T.stopPropagation(),this.copyToClipboard(e.copyText)});let _=this.shadow.querySelector(\".copy-btn\");_&&_.addEventListener(\"click\",T=>{T.stopPropagation(),this.copyToClipboard(e.copyText)})}}copyToClipboard(o){navigator.clipboard?.writeText?navigator.clipboard.writeText(o).catch(()=>this.fallbackCopy(o)):this.fallbackCopy(o),this.showCopied()}fallbackCopy(o){try{let e=document.createElement(\"input\");e.value=o,document.body.appendChild(e),e.select(),document.execCommand?.(\"copy\"),e.remove()}catch{}}showCopied(){let o=this.shadow.querySelector(\".copy-btn\");o&&(o.classList.add(\"copied\"),o.innerHTML=Oe,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{o.classList.remove(\"copied\"),o.innerHTML=me},1500))}};typeof customElements<\"u\"&&!customElements.get(\"did-address\")&&customElements.define(\"did-address\",$e);var be={en:{signIn:\"Sign in\",signInTo:\"Sign in to {appName}\",subtitle:\"Sign in to continue\",passkeyButton:\"Continue with Passkey\",passkeyCreate:\"Create New Passkey\",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\",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\",scanTitle:\"Scan with DID Wallet\",emailTitle:\"Continue with Email\",emailSubmit:\"Send Code\",emailSending:\"Sending code...\",emailSent:\"We sent a 6-digit code to {email}\",emailCodePlaceholder:\"6-digit code\",emailVerify:\"Verify\",emailResend:\"Resend code\",emailInvalid:\"Please enter a valid email address.\",emailCodeInvalid:\"Please enter the 6-digit code.\"},zh:{signIn:\"\\u767B\\u5F55\",signInTo:\"\\u767B\\u5F55\\u5230 {appName}\",subtitle:\"\\u767B\\u5F55\\u4EE5\\u7EE7\\u7EED\",passkeyButton:\"\\u4F7F\\u7528 Passkey \\u7EE7\\u7EED\",passkeyCreate:\"\\u521B\\u5EFA\\u65B0\\u7684 Passkey\",didWalletButton:\"\\u4F7F\\u7528 DID \\u94B1\\u5305\\u7EE7\\u7EED\",didWalletButtonShort:\"DID \\u94B1\\u5305\",scanWithWallet:\"\\u8BF7\\u4F7F\\u7528 DID \\u94B1\\u5305\\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:\"\\u4F60\\u7684\\u540D\\u5B57\\uFF08\\u53EF\\u9009\\uFF09\",or:\"\\u6216\",emailPlaceholder:\"\\u90AE\\u7BB1\\u5730\\u5740\",emailButton:\"\\u90AE\\u7BB1\",passkeyUnsupported:\"\\u4F60\\u7684\\u6D4F\\u89C8\\u5668\\u4E0D\\u652F\\u6301 Passkey \\u8BA4\\u8BC1\\u3002\",connecting:\"\\u8FDE\\u63A5\\u4E2D...\",verifying:\"\\u9A8C\\u8BC1\\u4E2D...\",openInWallet:\"\\u5728 DID \\u94B1\\u5305\\u4E2D\\u6253\\u5F00\",authFailed:\"\\u8BA4\\u8BC1\\u5931\\u8D25\",accessDenied:\"\\u8BBF\\u95EE\\u88AB\\u62D2\\u7EDD\\uFF1A\\u4F60\\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\",scanTitle:\"\\u4F7F\\u7528 DID \\u94B1\\u5305\\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:\"6 \\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 6 \\u4F4D\\u9A8C\\u8BC1\\u7801\\u3002\"}},ce=[{code:\"en\",label:\"English\"},{code:\"zh\",label:\"\\u4E2D\\u6587\"}];function v(o,e,r){let t=e&&be[e]?e:\"en\",n=be[t][o]??o;if(r)for(let[a,i]of Object.entries(r))n=n.replace(new RegExp(`\\\\{${a}\\\\}`,\"g\"),i);return n}var we='<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>',ye='<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>',Me='<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>',Fe='<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>',Ue='<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>',He={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>'},Ke='<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 Ve(o){return He[o.toLowerCase()]??\"\"}var Y=function(o,e){let n=o,a=Z[e],i=null,s=0,l=null,h=[],b={},p=function(d,m){s=n*4+17,i=(function(c){let g=new Array(c);for(let f=0;f<c;f+=1){g[f]=new Array(c);for(let w=0;w<c;w+=1)g[f][w]=null}return g})(s),u(0,0),u(s-7,0),u(0,s-7),_(),x(),L(d,m),n>=7&&T(d),l==null&&(l=te(n,a,h)),S(l,m)},u=function(d,m){for(let c=-1;c<=7;c+=1)if(!(d+c<=-1||s<=d+c))for(let g=-1;g<=7;g+=1)m+g<=-1||s<=m+g||(0<=c&&c<=6&&(g==0||g==6)||0<=g&&g<=6&&(c==0||c==6)||2<=c&&c<=4&&2<=g&&g<=4?i[d+c][m+g]=!0:i[d+c][m+g]=!1)},y=function(){let d=0,m=0;for(let c=0;c<8;c+=1){p(!0,c);let g=V.getLostPoint(b);(c==0||d>g)&&(d=g,m=c)}return m},x=function(){for(let d=8;d<s-8;d+=1)i[d][6]==null&&(i[d][6]=d%2==0);for(let d=8;d<s-8;d+=1)i[6][d]==null&&(i[6][d]=d%2==0)},_=function(){let d=V.getPatternPosition(n);for(let m=0;m<d.length;m+=1)for(let c=0;c<d.length;c+=1){let g=d[m],f=d[c];if(i[g][f]==null)for(let w=-2;w<=2;w+=1)for(let E=-2;E<=2;E+=1)w==-2||w==2||E==-2||E==2||w==0&&E==0?i[g+w][f+E]=!0:i[g+w][f+E]=!1}},T=function(d){let m=V.getBCHTypeNumber(n);for(let c=0;c<18;c+=1){let g=!d&&(m>>c&1)==1;i[Math.floor(c/3)][c%3+s-8-3]=g}for(let c=0;c<18;c+=1){let g=!d&&(m>>c&1)==1;i[c%3+s-8-3][Math.floor(c/3)]=g}},L=function(d,m){let c=a<<3|m,g=V.getBCHTypeInfo(c);for(let f=0;f<15;f+=1){let w=!d&&(g>>f&1)==1;f<6?i[f][8]=w:f<8?i[f+1][8]=w:i[s-15+f][8]=w}for(let f=0;f<15;f+=1){let w=!d&&(g>>f&1)==1;f<8?i[8][s-f-1]=w:f<9?i[8][15-f-1+1]=w:i[8][15-f-1]=w}i[s-8][8]=!d},S=function(d,m){let c=-1,g=s-1,f=7,w=0,E=V.getMaskFunction(m);for(let D=s-1;D>0;D-=2)for(D==6&&(D-=1);;){for(let A=0;A<2;A+=1)if(i[g][D-A]==null){let R=!1;w<d.length&&(R=(d[w]>>>f&1)==1),E(g,D-A)&&(R=!R),i[g][D-A]=R,f-=1,f==-1&&(w+=1,f=7)}if(g+=c,g<0||s<=g){g-=c,c=-c;break}}},oe=function(d,m){let c=0,g=0,f=0,w=new Array(m.length),E=new Array(m.length);for(let C=0;C<m.length;C+=1){let I=m[C].dataCount,F=m[C].totalCount-I;g=Math.max(g,I),f=Math.max(f,F),w[C]=new Array(I);for(let H=0;H<w[C].length;H+=1)w[C][H]=255&d.getBuffer()[H+c];c+=I;let se=V.getErrorCorrectPolynomial(F),ue=ee(w[C],se.getLength()-1).mod(se);E[C]=new Array(se.getLength()-1);for(let H=0;H<E[C].length;H+=1){let de=H+ue.getLength()-E[C].length;E[C][H]=de>=0?ue.getAt(de):0}}let D=0;for(let C=0;C<m.length;C+=1)D+=m[C].totalCount;let A=new Array(D),R=0;for(let C=0;C<g;C+=1)for(let I=0;I<m.length;I+=1)C<w[I].length&&(A[R]=w[I][C],R+=1);for(let C=0;C<f;C+=1)for(let I=0;I<m.length;I+=1)C<E[I].length&&(A[R]=E[I][C],R+=1);return A},te=function(d,m,c){let g=xe.getRSBlocks(d,m),f=_e();for(let E=0;E<c.length;E+=1){let D=c[E];f.put(D.getMode(),4),f.put(D.getLength(),V.getLengthInBits(D.getMode(),d)),D.write(f)}let w=0;for(let E=0;E<g.length;E+=1)w+=g[E].dataCount;if(f.getLengthInBits()>w*8)throw\"code length overflow. (\"+f.getLengthInBits()+\">\"+w*8+\")\";for(f.getLengthInBits()+4<=w*8&&f.put(0,4);f.getLengthInBits()%8!=0;)f.putBit(!1);for(;!(f.getLengthInBits()>=w*8||(f.put(236,8),f.getLengthInBits()>=w*8));)f.put(17,8);return oe(f,g)};b.addData=function(d,m){m=m||\"Byte\";let c=null;switch(m){case\"Numeric\":c=We(d);break;case\"Alphanumeric\":c=je(d);break;case\"Byte\":c=qe(d);break;case\"Kanji\":c=ze(d);break;default:throw\"mode:\"+m}h.push(c),l=null},b.isDark=function(d,m){if(d<0||s<=d||m<0||s<=m)throw d+\",\"+m;return i[d][m]},b.getModuleCount=function(){return s},b.make=function(){if(n<1){let d=1;for(;d<40;d++){let m=xe.getRSBlocks(d,a),c=_e();for(let f=0;f<h.length;f++){let w=h[f];c.put(w.getMode(),4),c.put(w.getLength(),V.getLengthInBits(w.getMode(),d)),w.write(c)}let g=0;for(let f=0;f<m.length;f++)g+=m[f].dataCount;if(c.getLengthInBits()<=g*8)break}n=d}p(!1,y())},b.createTableTag=function(d,m){d=d||2,m=typeof m>\"u\"?d*4:m;let c=\"\";c+='<table style=\"',c+=\" border-width: 0px; border-style: none;\",c+=\" border-collapse: collapse;\",c+=\" padding: 0px; margin: \"+m+\"px;\",c+='\">',c+=\"<tbody>\";for(let g=0;g<b.getModuleCount();g+=1){c+=\"<tr>\";for(let f=0;f<b.getModuleCount();f+=1)c+='<td style=\"',c+=\" border-width: 0px; border-style: none;\",c+=\" border-collapse: collapse;\",c+=\" padding: 0px; margin: 0px;\",c+=\" width: \"+d+\"px;\",c+=\" height: \"+d+\"px;\",c+=\" background-color: \",c+=b.isDark(g,f)?\"#000000\":\"#ffffff\",c+=\";\",c+='\"/>';c+=\"</tr>\"}return c+=\"</tbody>\",c+=\"</table>\",c},b.createSvgTag=function(d,m,c,g){let f={};typeof arguments[0]==\"object\"&&(f=arguments[0],d=f.cellSize,m=f.margin,c=f.alt,g=f.title),d=d||2,m=typeof m>\"u\"?d*4:m,c=typeof c==\"string\"?{text:c}:c||{},c.text=c.text||null,c.id=c.text?c.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 w=b.getModuleCount()*d+m*2,E,D,A,R,C=\"\",I;for(I=\"l\"+d+\",0 0,\"+d+\" -\"+d+\",0 0,-\"+d+\"z \",C+='<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"',C+=f.scalable?\"\":' width=\"'+w+'px\" height=\"'+w+'px\"',C+=' viewBox=\"0 0 '+w+\" \"+w+'\" ',C+=' preserveAspectRatio=\"xMinYMin meet\"',C+=g.text||c.text?' role=\"img\" aria-labelledby=\"'+z([g.id,c.id].join(\" \").trim())+'\"':\"\",C+=\">\",C+=g.text?'<title id=\"'+z(g.id)+'\">'+z(g.text)+\"</title>\":\"\",C+=c.text?'<description id=\"'+z(c.id)+'\">'+z(c.text)+\"</description>\":\"\",C+='<rect width=\"100%\" height=\"100%\" fill=\"white\" cx=\"0\" cy=\"0\"/>',C+='<path d=\"',A=0;A<b.getModuleCount();A+=1)for(R=A*d+m,E=0;E<b.getModuleCount();E+=1)b.isDark(A,E)&&(D=E*d+m,C+=\"M\"+D+\",\"+R+I);return C+='\" stroke=\"transparent\" fill=\"black\"/>',C+=\"</svg>\",C},b.createDataURL=function(d,m){d=d||2,m=typeof m>\"u\"?d*4:m;let c=b.getModuleCount()*d+m*2,g=m,f=c-m;return Je(c,c,function(w,E){if(g<=w&&w<f&&g<=E&&E<f){let D=Math.floor((w-g)/d),A=Math.floor((E-g)/d);return b.isDark(A,D)?0:1}else return 1})},b.createImgTag=function(d,m,c){d=d||2,m=typeof m>\"u\"?d*4:m;let g=b.getModuleCount()*d+m*2,f=\"\";return f+=\"<img\",f+=' src=\"',f+=b.createDataURL(d,m),f+='\"',f+=' width=\"',f+=g,f+='\"',f+=' height=\"',f+=g,f+='\"',c&&(f+=' alt=\"',f+=z(c),f+='\"'),f+=\"/>\",f};let z=function(d){let m=\"\";for(let c=0;c<d.length;c+=1){let g=d.charAt(c);switch(g){case\"<\":m+=\"<\";break;case\">\":m+=\">\";break;case\"&\":m+=\"&\";break;case'\"':m+=\""\";break;default:m+=g;break}}return m},Ce=function(d){d=typeof d>\"u\"?2:d;let c=b.getModuleCount()*1+d*2,g=d,f=c-d,w,E,D,A,R,C={\"\\u2588\\u2588\":\"\\u2588\",\"\\u2588 \":\"\\u2580\",\" \\u2588\":\"\\u2584\",\" \":\" \"},I={\"\\u2588\\u2588\":\"\\u2580\",\"\\u2588 \":\"\\u2580\",\" \\u2588\":\" \",\" \":\" \"},F=\"\";for(w=0;w<c;w+=2){for(D=Math.floor((w-g)/1),A=Math.floor((w+1-g)/1),E=0;E<c;E+=1)R=\"\\u2588\",g<=E&&E<f&&g<=w&&w<f&&b.isDark(D,Math.floor((E-g)/1))&&(R=\" \"),g<=E&&E<f&&g<=w+1&&w+1<f&&b.isDark(A,Math.floor((E-g)/1))?R+=\" \":R+=\"\\u2588\",F+=d<1&&w+1>=f?I[R]:C[R];F+=`\n`}return c%2&&d>0?F.substring(0,F.length-c-1)+Array(c+1).join(\"\\u2580\"):F.substring(0,F.length-1)};return b.createASCII=function(d,m){if(d=d||1,d<2)return Ce(m);d-=1,m=typeof m>\"u\"?d*2:m;let c=b.getModuleCount()*d+m*2,g=m,f=c-m,w,E,D,A,R=Array(d+1).join(\"\\u2588\\u2588\"),C=Array(d+1).join(\" \"),I=\"\",F=\"\";for(w=0;w<c;w+=1){for(D=Math.floor((w-g)/d),F=\"\",E=0;E<c;E+=1)A=1,g<=E&&E<f&&g<=w&&w<f&&b.isDark(D,Math.floor((E-g)/d))&&(A=0),F+=A?R:C;for(D=0;D<d;D+=1)I+=F+`\n`}return I.substring(0,I.length-1)},b.renderTo2dContext=function(d,m){m=m||2;let c=b.getModuleCount();for(let g=0;g<c;g++)for(let f=0;f<c;f++)d.fillStyle=b.isDark(g,f)?\"black\":\"white\",d.fillRect(f*m,g*m,m,m)},b};Y.stringToBytes=function(o){let e=[];for(let r=0;r<o.length;r+=1){let t=o.charCodeAt(r);e.push(t&255)}return e};Y.createStringToBytes=function(o,e){let r=(function(){let n=Ge(o),a=function(){let l=n.read();if(l==-1)throw\"eof\";return l},i=0,s={};for(;;){let l=n.read();if(l==-1)break;let h=a(),b=a(),p=a(),u=String.fromCharCode(l<<8|h),y=b<<8|p;s[u]=y,i+=1}if(i!=e)throw i+\" != \"+e;return s})(),t=63;return function(n){let a=[];for(let i=0;i<n.length;i+=1){let s=n.charCodeAt(i);if(s<128)a.push(s);else{let l=r[n.charAt(i)];typeof l==\"number\"?(l&255)==l?a.push(l):(a.push(l>>>8),a.push(l&255)):a.push(t)}}return a}};var $={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Z={L:1,M:0,Q:3,H:2},K={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},V=(function(){let o=[[],[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,t=21522,n={},a=function(i){let s=0;for(;i!=0;)s+=1,i>>>=1;return s};return n.getBCHTypeInfo=function(i){let s=i<<10;for(;a(s)-a(e)>=0;)s^=e<<a(s)-a(e);return(i<<10|s)^t},n.getBCHTypeNumber=function(i){let s=i<<12;for(;a(s)-a(r)>=0;)s^=r<<a(s)-a(r);return i<<12|s},n.getPatternPosition=function(i){return o[i-1]},n.getMaskFunction=function(i){switch(i){case K.PATTERN000:return function(s,l){return(s+l)%2==0};case K.PATTERN001:return function(s,l){return s%2==0};case K.PATTERN010:return function(s,l){return l%3==0};case K.PATTERN011:return function(s,l){return(s+l)%3==0};case K.PATTERN100:return function(s,l){return(Math.floor(s/2)+Math.floor(l/3))%2==0};case K.PATTERN101:return function(s,l){return s*l%2+s*l%3==0};case K.PATTERN110:return function(s,l){return(s*l%2+s*l%3)%2==0};case K.PATTERN111:return function(s,l){return(s*l%3+(s+l)%2)%2==0};default:throw\"bad maskPattern:\"+i}},n.getErrorCorrectPolynomial=function(i){let s=ee([1],0);for(let l=0;l<i;l+=1)s=s.multiply(ee([1,j.gexp(l)],0));return s},n.getLengthInBits=function(i,s){if(1<=s&&s<10)switch(i){case $.MODE_NUMBER:return 10;case $.MODE_ALPHA_NUM:return 9;case $.MODE_8BIT_BYTE:return 8;case $.MODE_KANJI:return 8;default:throw\"mode:\"+i}else if(s<27)switch(i){case $.MODE_NUMBER:return 12;case $.MODE_ALPHA_NUM:return 11;case $.MODE_8BIT_BYTE:return 16;case $.MODE_KANJI:return 10;default:throw\"mode:\"+i}else if(s<41)switch(i){case $.MODE_NUMBER:return 14;case $.MODE_ALPHA_NUM:return 13;case $.MODE_8BIT_BYTE:return 16;case $.MODE_KANJI:return 12;default:throw\"mode:\"+i}else throw\"type:\"+s},n.getLostPoint=function(i){let s=i.getModuleCount(),l=0;for(let p=0;p<s;p+=1)for(let u=0;u<s;u+=1){let y=0,x=i.isDark(p,u);for(let _=-1;_<=1;_+=1)if(!(p+_<0||s<=p+_))for(let T=-1;T<=1;T+=1)u+T<0||s<=u+T||_==0&&T==0||x==i.isDark(p+_,u+T)&&(y+=1);y>5&&(l+=3+y-5)}for(let p=0;p<s-1;p+=1)for(let u=0;u<s-1;u+=1){let y=0;i.isDark(p,u)&&(y+=1),i.isDark(p+1,u)&&(y+=1),i.isDark(p,u+1)&&(y+=1),i.isDark(p+1,u+1)&&(y+=1),(y==0||y==4)&&(l+=3)}for(let p=0;p<s;p+=1)for(let u=0;u<s-6;u+=1)i.isDark(p,u)&&!i.isDark(p,u+1)&&i.isDark(p,u+2)&&i.isDark(p,u+3)&&i.isDark(p,u+4)&&!i.isDark(p,u+5)&&i.isDark(p,u+6)&&(l+=40);for(let p=0;p<s;p+=1)for(let u=0;u<s-6;u+=1)i.isDark(u,p)&&!i.isDark(u+1,p)&&i.isDark(u+2,p)&&i.isDark(u+3,p)&&i.isDark(u+4,p)&&!i.isDark(u+5,p)&&i.isDark(u+6,p)&&(l+=40);let h=0;for(let p=0;p<s;p+=1)for(let u=0;u<s;u+=1)i.isDark(u,p)&&(h+=1);let b=Math.abs(100*h/s/s-50)/5;return l+=b*10,l},n})(),j=(function(){let o=new Array(256),e=new Array(256);for(let t=0;t<8;t+=1)o[t]=1<<t;for(let t=8;t<256;t+=1)o[t]=o[t-4]^o[t-5]^o[t-6]^o[t-8];for(let t=0;t<255;t+=1)e[o[t]]=t;let r={};return r.glog=function(t){if(t<1)throw\"glog(\"+t+\")\";return e[t]},r.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return o[t]},r})(),ee=function(o,e){if(typeof o.length>\"u\")throw o.length+\"/\"+e;let r=(function(){let n=0;for(;n<o.length&&o[n]==0;)n+=1;let a=new Array(o.length-n+e);for(let i=0;i<o.length-n;i+=1)a[i]=o[i+n];return a})(),t={};return t.getAt=function(n){return r[n]},t.getLength=function(){return r.length},t.multiply=function(n){let a=new Array(t.getLength()+n.getLength()-1);for(let i=0;i<t.getLength();i+=1)for(let s=0;s<n.getLength();s+=1)a[i+s]^=j.gexp(j.glog(t.getAt(i))+j.glog(n.getAt(s)));return ee(a,0)},t.mod=function(n){if(t.getLength()-n.getLength()<0)return t;let a=j.glog(t.getAt(0))-j.glog(n.getAt(0)),i=new Array(t.getLength());for(let s=0;s<t.getLength();s+=1)i[s]=t.getAt(s);for(let s=0;s<n.getLength();s+=1)i[s]^=j.gexp(j.glog(n.getAt(s))+a);return ee(i,0).mod(n)},t},xe=(function(){let o=[[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(n,a){let i={};return i.totalCount=n,i.dataCount=a,i},r={},t=function(n,a){switch(a){case Z.L:return o[(n-1)*4+0];case Z.M:return o[(n-1)*4+1];case Z.Q:return o[(n-1)*4+2];case Z.H:return o[(n-1)*4+3];default:return}};return r.getRSBlocks=function(n,a){let i=t(n,a);if(typeof i>\"u\")throw\"bad rs block @ typeNumber:\"+n+\"/errorCorrectionLevel:\"+a;let s=i.length/3,l=[];for(let h=0;h<s;h+=1){let b=i[h*3+0],p=i[h*3+1],u=i[h*3+2];for(let y=0;y<b;y+=1)l.push(e(p,u))}return l},r})(),_e=function(){let o=[],e=0,r={};return r.getBuffer=function(){return o},r.getAt=function(t){let n=Math.floor(t/8);return(o[n]>>>7-t%8&1)==1},r.put=function(t,n){for(let a=0;a<n;a+=1)r.putBit((t>>>n-a-1&1)==1)},r.getLengthInBits=function(){return e},r.putBit=function(t){let n=Math.floor(e/8);o.length<=n&&o.push(0),t&&(o[n]|=128>>>e%8),e+=1},r},We=function(o){let e=$.MODE_NUMBER,r=o,t={};t.getMode=function(){return e},t.getLength=function(i){return r.length},t.write=function(i){let s=r,l=0;for(;l+2<s.length;)i.put(n(s.substring(l,l+3)),10),l+=3;l<s.length&&(s.length-l==1?i.put(n(s.substring(l,l+1)),4):s.length-l==2&&i.put(n(s.substring(l,l+2)),7))};let n=function(i){let s=0;for(let l=0;l<i.length;l+=1)s=s*10+a(i.charAt(l));return s},a=function(i){if(\"0\"<=i&&i<=\"9\")return i.charCodeAt(0)-48;throw\"illegal char :\"+i};return t},je=function(o){let e=$.MODE_ALPHA_NUM,r=o,t={};t.getMode=function(){return e},t.getLength=function(a){return r.length},t.write=function(a){let i=r,s=0;for(;s+1<i.length;)a.put(n(i.charAt(s))*45+n(i.charAt(s+1)),11),s+=2;s<i.length&&a.put(n(i.charAt(s)),6)};let n=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 t},qe=function(o){let e=$.MODE_8BIT_BYTE,r=o,t=Y.stringToBytes(o),n={};return n.getMode=function(){return e},n.getLength=function(a){return t.length},n.write=function(a){for(let i=0;i<t.length;i+=1)a.put(t[i],8)},n},ze=function(o){let e=$.MODE_KANJI,r=o,t=Y.stringToBytes;(function(i,s){let l=t(i);if(l.length!=2||(l[0]<<8|l[1])!=s)throw\"sjis not supported.\"})(\"\\u53CB\",38726);let n=t(o),a={};return a.getMode=function(){return e},a.getLength=function(i){return~~(n.length/2)},a.write=function(i){let s=n,l=0;for(;l+1<s.length;){let h=(255&s[l])<<8|255&s[l+1];if(33088<=h&&h<=40956)h-=33088;else if(57408<=h&&h<=60351)h-=49472;else throw\"illegal char at \"+(l+1)+\"/\"+h;h=(h>>>8&255)*192+(h&255),i.put(h,13),l+=2}if(l<s.length)throw\"illegal char at \"+(l+1)},a},Ee=function(){let o=[],e={};return e.writeByte=function(r){o.push(r&255)},e.writeShort=function(r){e.writeByte(r),e.writeByte(r>>>8)},e.writeBytes=function(r,t,n){t=t||0,n=n||r.length;for(let a=0;a<n;a+=1)e.writeByte(r[a+t])},e.writeString=function(r){for(let t=0;t<r.length;t+=1)e.writeByte(r.charCodeAt(t))},e.toByteArray=function(){return o},e.toString=function(){let r=\"\";r+=\"[\";for(let t=0;t<o.length;t+=1)t>0&&(r+=\",\"),r+=o[t];return r+=\"]\",r},e},Ye=function(){let o=0,e=0,r=0,t=\"\",n={},a=function(s){t+=String.fromCharCode(i(s&63))},i=function(s){if(s<0)throw\"n:\"+s;if(s<26)return 65+s;if(s<52)return 97+(s-26);if(s<62)return 48+(s-52);if(s==62)return 43;if(s==63)return 47;throw\"n:\"+s};return n.writeByte=function(s){for(o=o<<8|s&255,e+=8,r+=1;e>=6;)a(o>>>e-6),e-=6},n.flush=function(){if(e>0&&(a(o<<6-e),o=0,e=0),r%3!=0){let s=3-r%3;for(let l=0;l<s;l+=1)t+=\"=\"}},n.toString=function(){return t},n},Ge=function(o){let e=o,r=0,t=0,n=0,a={};a.read=function(){for(;n<8;){if(r>=e.length){if(n==0)return-1;throw\"unexpected end of file./\"+n}let l=e.charAt(r);if(r+=1,l==\"=\")return n=0,-1;if(l.match(/^\\s$/))continue;t=t<<6|i(l.charCodeAt(0)),n+=6}let s=t>>>n-8&255;return n-=8,s};let i=function(s){if(65<=s&&s<=90)return s-65;if(97<=s&&s<=122)return s-97+26;if(48<=s&&s<=57)return s-48+52;if(s==43)return 62;if(s==47)return 63;throw\"c:\"+s};return a},Qe=function(o,e){let r=o,t=e,n=new Array(o*e),a={};a.setPixel=function(h,b,p){n[b*r+h]=p},a.write=function(h){h.writeString(\"GIF87a\"),h.writeShort(r),h.writeShort(t),h.writeByte(128),h.writeByte(0),h.writeByte(0),h.writeByte(0),h.writeByte(0),h.writeByte(0),h.writeByte(255),h.writeByte(255),h.writeByte(255),h.writeString(\",\"),h.writeShort(0),h.writeShort(0),h.writeShort(r),h.writeShort(t),h.writeByte(0);let b=2,p=s(b);h.writeByte(b);let u=0;for(;p.length-u>255;)h.writeByte(255),h.writeBytes(p,u,255),u+=255;h.writeByte(p.length-u),h.writeBytes(p,u,p.length-u),h.writeByte(0),h.writeString(\";\")};let i=function(h){let b=h,p=0,u=0,y={};return y.write=function(x,_){if(x>>>_)throw\"length over\";for(;p+_>=8;)b.writeByte(255&(x<<p|u)),_-=8-p,x>>>=8-p,u=0,p=0;u=x<<p|u,p=p+_},y.flush=function(){p>0&&b.writeByte(u)},y},s=function(h){let b=1<<h,p=(1<<h)+1,u=h+1,y=l();for(let S=0;S<b;S+=1)y.add(String.fromCharCode(S));y.add(String.fromCharCode(b)),y.add(String.fromCharCode(p));let x=Ee(),_=i(x);_.write(b,u);let T=0,L=String.fromCharCode(n[T]);for(T+=1;T<n.length;){let S=String.fromCharCode(n[T]);T+=1,y.contains(L+S)?L=L+S:(_.write(y.indexOf(L),u),y.size()<4095&&(y.size()==1<<u&&(u+=1),y.add(L+S)),L=S)}return _.write(y.indexOf(L),u),_.write(p,u),_.flush(),x.toByteArray()},l=function(){let h={},b=0,p={};return p.add=function(u){if(p.contains(u))throw\"dup key:\"+u;h[u]=b,b+=1},p.size=function(){return b},p.indexOf=function(u){return h[u]},p.contains=function(u){return typeof h[u]<\"u\"},p};return a},Je=function(o,e,r){let t=Qe(o,e);for(let s=0;s<e;s+=1)for(let l=0;l<o;l+=1)t.setPixel(l,s,r(l,s));let n=Ee();t.write(n);let a=Ye(),i=n.toByteArray();for(let s=0;s<i.length;s+=1)a.writeByte(i[s]);return a.flush(),\"data:image/gif;base64,\"+a},Xe=Y,ln=Y.stringToBytes;function Ze(o,e,r=200){le(o);let t=document.createElement(\"canvas\"),n=t.getContext?.(\"2d\")??null;if(!n){let p=document.createElement(\"a\");p.href=e,p.textContent=\"Open in DID Wallet\",p.target=\"_blank\",p.rel=\"noopener\",o.appendChild(p);return}let a=Xe(0,\"M\");a.addData(e),a.make();let i=a.getModuleCount(),s=Math.floor(r/i),l=s*i;t.width=l,t.height=l,t.style.display=\"block\",t.style.width=`${r}px`,t.style.height=`${r}px`,t.style.imageRendering=\"pixelated\";let h=\"#e8e8e8\";n.fillStyle=h,n.fillRect(0,0,l,l),n.fillStyle=\"#000000\";for(let p=0;p<i;p++)for(let u=0;u<i;u++)a.isDark(p,u)&&n.fillRect(u*s,p*s,s,s);let b=document.createElement(\"div\");b.style.cssText=\"display:inline-block;padding:10px;background:#e8e8e8;border-radius:8px;line-height:0\",b.appendChild(t),o.appendChild(b)}function le(o){o.innerHTML=\"\"}var et=`\n${Ne}\n${Se}\n${Be}\n\n/* Layout */\nbody {\n min-height: 100vh;\n display: flex;\n align-items: center;\n justify-content: center;\n background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.08) 0%, transparent 60%);\n}\n\n/* Card \\u2014 fixed width prevents shrinking when views switch */\n.card {\n background: var(--bg-card);\n border: 1px solid var(--border);\n border-radius: var(--radius-lg);\n padding: 48px 40px;\n width: min(400px, calc(100vw - 32px));\n text-align: center;\n box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.15);\n}\n\n/* Brand header */\n.brand-header { margin-bottom: 24px; }\n.app-logo {\n width: 48px;\n height: 48px;\n border-radius: var(--radius-sm);\n object-fit: contain;\n margin-bottom: 16px;\n}\nh1 {\n font-size: 24px;\n font-weight: 600;\n margin-bottom: 8px;\n color: var(--text-white);\n letter-spacing: -0.01em;\n line-height: 1.25;\n}\n.subtitle {\n font-size: 14px;\n color: var(--text-secondary);\n margin-bottom: 0;\n line-height: 1.5;\n}\n.federated-hint {\n font-size: 12px;\n color: var(--text-secondary);\n margin-top: 6px;\n margin-bottom: 0;\n opacity: 0.7;\n}\n\n/* Input */\n.input {\n width: 100%;\n height: 36px;\n padding: 0 12px;\n font-size: 14px;\n color: var(--text);\n background: var(--bg-input);\n border: 1px solid var(--border-strong);\n border-radius: var(--radius-sm);\n outline: none;\n margin-bottom: 16px;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.input:focus { border-color: var(--blue); box-shadow: var(--shadow-focus); }\n.input::placeholder { color: var(--text-placeholder); }\n\n/* Button */\n.btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n width: 100%;\n height: 36px;\n padding: 0 16px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background: var(--blue);\n border: none;\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;\n line-height: 1;\n}\n.btn:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(108,71,255,0.3); }\n.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; transform: none; box-shadow: none; }\n.btn:focus-visible { box-shadow: var(--shadow-focus); }\n.btn svg { width: 18px; height: 18px; flex-shrink: 0; }\n.btn-secondary {\n background: transparent;\n border: 1px solid var(--border-strong);\n color: var(--text);\n}\n.btn-secondary:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.20); }\n\n/* Status */\n.status {\n margin-top: 16px;\n font-size: 13px;\n min-height: 20px;\n color: var(--text-secondary);\n}\n.status.error { color: var(--red-text); }\n\n/* Name row (passkey registration) */\n.name-row { display: none; }\n.name-row.visible { display: block; }\n\n/* Divider */\n.divider {\n display: flex;\n align-items: center;\n margin: 20px 0;\n color: var(--text-secondary);\n font-size: 13px;\n}\n.divider::before, .divider::after {\n content: '';\n flex: 1;\n border-bottom: 1px solid var(--border);\n}\n.divider::before { margin-right: 12px; }\n.divider::after { margin-left: 12px; }\n\n/* DID Wallet section (methods view) */\n.did-wallet-section { margin-top: 8px; }\n\n/* QR view */\n.qr-view {\n position: relative;\n margin: 20px auto;\n display: flex;\n justify-content: center;\n min-height: 220px;\n align-items: center;\n}\n.qr-placeholder {\n width: 220px;\n height: 220px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--border-subtle);\n border-radius: var(--radius);\n background: var(--bg-elevated);\n}\n.qr-spinner {\n display: inline-block;\n width: 32px; height: 32px;\n border: 3px solid var(--border-strong);\n border-top-color: var(--blue-muted);\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n}\n#did-connect-status {\n font-size: 13px;\n color: var(--text-secondary);\n}\n\n/* Connect result state */\n.connect-result {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 120px;\n margin: 32px 0;\n animation: fadeIn 200ms ease-out;\n}\n.result-icon {\n width: 64px;\n height: 64px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 28px;\n font-weight: bold;\n}\n.result-error {\n background: rgba(239, 68, 68, 0.15);\n color: var(--red-text);\n border: 2px solid rgba(239, 68, 68, 0.3);\n}\n.result-loading {\n background: transparent;\n}\n.result-loading .qr-spinner {\n width: 36px;\n height: 36px;\n}\n.result-back-btn {\n margin-top: 16px;\n}\n@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }\n\n/* QR timeout overlay */\n.qr-timeout-overlay {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n background: rgba(0, 0, 0, 0.65);\n border-radius: var(--radius);\n backdrop-filter: blur(2px);\n}\n.qr-timeout-overlay .timeout-text {\n font-size: 13px;\n color: #fff;\n}\n.qr-timeout-overlay .refresh-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 6px 20px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background: var(--blue);\n border: none;\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease;\n}\n.qr-timeout-overlay .refresh-btn:hover {\n background: var(--blue-hover);\n}\n/* Connect status views (scanned / success) */\n.connect-status-icon {\n position: relative;\n width: 72px;\n height: 72px;\n margin: 16px auto;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n@keyframes connectSpin { to { transform: rotate(360deg); } }\n.connect-spinner-ring {\n position: absolute;\n inset: 0;\n width: 72px;\n height: 72px;\n border-radius: 50%;\n border: 3px solid rgba(255,255,255,0.1);\n border-top-color: var(--blue, #6c47ff);\n animation: connectSpin 0.8s linear infinite;\n}\n.connect-status-badge {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n}\n.connect-status-badge svg { width: 36px; height: 36px; }\n.connect-status-icon.connect-success svg { animation: fadeIn 0.3s ease; }\n.connect-subtitle {\n font-size: 13px;\n color: var(--text-secondary, #9394a1);\n text-align: center;\n margin: 4px 0 0;\n}\n.status.success { color: #49dc6e; font-weight: 500; }\n.deep-link-btn {\n margin-top: 12px;\n text-decoration: none;\n}\n\n/* Email section (methods view) */\n.email-section { margin-top: 8px; }\n\n/* Back button */\n.back-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n color: var(--text-secondary);\n font-size: 14px;\n cursor: pointer;\n padding: 0;\n margin-bottom: 16px;\n float: left;\n}\n.back-btn:hover { color: var(--text); }\n.back-btn svg { width: 18px; height: 18px; }\n\n/* View title */\n.view-title {\n font-size: 20px;\n font-weight: 600;\n color: var(--text-white);\n margin-bottom: 8px;\n clear: both;\n padding-top: 8px;\n}\n\n/* OAuth section \\u2014 single provider (legacy) */\n.oauth-section { margin-top: 0; }\n\n/* OAuth grid \\u2014 2+ providers in 2-column layout (legacy) */\n.oauth-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n margin-bottom: 8px;\n}\n.oauth-grid .oauth-btn:last-child:nth-child(odd) {\n grid-column: 1 / -1;\n}\n\n/* Unified secondary methods grid \\u2014 2-column layout */\n.methods-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n}\n/* Odd last child (e.g. DID Wallet when total is odd) spans full width */\n.methods-grid .method-btn:last-child:nth-child(odd) {\n grid-column: 1 / -1;\n}\n\n.method-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n min-height: 36px;\n padding: 6px 16px;\n font-size: 14px;\n font-weight: 500;\n color: var(--text);\n background: var(--bg-card);\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;\n white-space: normal;\n}\n.method-btn:hover { background: var(--bg-hover); }\n.method-btn:disabled { cursor: default; pointer-events: none; }\n.method-btn svg { width: 18px; height: 18px; flex-shrink: 0; }\n\n.oauth-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n height: 36px;\n padding: 0 16px;\n font-size: 14px;\n font-weight: 500;\n color: var(--text);\n background: var(--bg-card);\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;\n margin-bottom: 0;\n}\n.oauth-section .oauth-btn { margin-bottom: 8px; }\n.oauth-btn:hover { background: var(--bg-hover); }\n.oauth-btn:disabled { cursor: default; pointer-events: none; }\n.oauth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }\n.oauth-btn-loading {\n opacity: 0.8;\n border-color: var(--blue);\n color: var(--text-secondary);\n}\n@keyframes oauth-spin { to { transform: rotate(360deg); } }\n.oauth-spinner {\n display: inline-block;\n width: 14px; height: 14px;\n border: 2px solid var(--border-strong);\n border-top-color: var(--blue-muted);\n border-radius: 50%;\n animation: oauth-spin 0.6s linear infinite;\n}\n.oauth-check { color: var(--green-text); font-size: 16px; }\n\n/* Browser compatibility warning */\n.compat-warning {\n font-size: 13px;\n color: var(--text-tertiary);\n padding: 12px;\n background: var(--bg-elevated);\n border-radius: var(--radius-sm);\n margin-bottom: 16px;\n}\n\n/* Trust footer */\n.login-footer {\n margin-top: 24px;\n padding-top: 20px;\n border-top: 1px solid var(--border);\n}\n.secured-badge {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n font-size: 12px;\n color: var(--text-tertiary);\n}\n.secured-badge svg { width: 14px; height: 14px; flex-shrink: 0; }\n.footer-links {\n margin-top: 8px;\n font-size: 12px;\n color: var(--text-tertiary);\n}\n.footer-links a {\n color: var(--text-secondary);\n text-decoration: none;\n}\n.footer-links a:hover { text-decoration: underline; }\n\n/* \\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 */\n@keyframes fadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes fadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n.card[data-view] { animation: fadeIn 200ms ease-out; }\n\n/* QR code scale-in */\n.qr-view { animation: qrScaleIn 300ms ease-out; }\n@keyframes qrScaleIn {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n}\n\n/* Button loading spinner */\n@keyframes spin { to { transform: rotate(360deg); } }\n.btn-spinner {\n display: inline-block;\n width: 16px; height: 16px;\n border: 2px solid rgba(255,255,255,0.3);\n border-top-color: #fff;\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n}\n\n/* Success checkmark */\n@keyframes checkDraw {\n from { stroke-dashoffset: 24; }\n to { stroke-dashoffset: 0; }\n}\n.success-check {\n display: inline-block;\n width: 20px; height: 20px;\n vertical-align: middle;\n}\n.success-check path {\n stroke-dasharray: 24;\n stroke-dashoffset: 24;\n animation: checkDraw 400ms ease-out forwards;\n}\n\n/* Light theme background gradient adjustment */\n[data-theme=\"light\"] body {\n background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.05) 0%, transparent 60%);\n}\n[data-theme=\"light\"] .card {\n box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.08);\n}\n[data-theme=\"light\"] .btn:hover {\n box-shadow: 0 2px 8px rgba(108,71,255,0.15);\n}\n\n/* Language switcher */\n.locale-switcher {\n position: absolute;\n top: 16px;\n right: 16px;\n}\n.locale-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 10px;\n font-size: 12px;\n color: var(--text-secondary);\n background: var(--bg-elevated);\n border: 1px solid var(--border-subtle);\n border-radius: var(--radius-full);\n cursor: pointer;\n transition: color 0.15s, border-color 0.15s;\n}\n.locale-btn:hover {\n color: var(--text);\n border-color: var(--border-strong);\n}\n.locale-btn svg { width: 14px; height: 14px; flex-shrink: 0; }\n.card { position: relative; }\n`;function q(o){let e=new Uint8Array(o),r=\"\";for(let t=0;t<e.length;t++)r+=String.fromCharCode(e[t]);return btoa(r).replace(/\\+/g,\"-\").replace(/\\//g,\"_\").replace(/=+$/,\"\")}function X(o){let e=o.replace(/-/g,\"+\").replace(/_/g,\"/\"),r=atob(e),t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t.buffer}function tt(o){let e=o.response;return{id:o.id,rawId:q(o.rawId),type:o.type,response:{attestationObject:q(e.attestationObject),clientDataJSON:q(e.clientDataJSON)},clientExtensionResults:o.getClientExtensionResults(),authenticatorAttachment:o.authenticatorAttachment}}function nt(o){let e=o.response;return{id:o.id,rawId:q(o.rawId),type:o.type,response:{authenticatorData:q(e.authenticatorData),clientDataJSON:q(e.clientDataJSON),signature:q(e.signature),userHandle:e.userHandle?q(e.userHandle):void 0},clientExtensionResults:o.getClientExtensionResults(),authenticatorAttachment:o.authenticatorAttachment}}async function re(o){let e=o.prefix||\"/.well-known/service/api/passkey\",r=o.onStatus||(()=>{}),t=o.authOnly||!1,n=o.registerOnly||!1,a=o.invitationId||void 0;async function i(){let u=await fetch(`${e}/auth`,{method:\"GET\"});if(!u.ok)throw new Error(\"Failed to get auth challenge\");return u.json()}async function s(u){let y=[];u&&y.push(`name=${encodeURIComponent(u)}`),a&&y.push(`invitationId=${encodeURIComponent(a)}`);let x=y.length?`?${y.join(\"&\")}`:\"\",_=await fetch(`${e}/register${x}`,{method:\"GET\"});if(!_.ok)throw new Error(\"Failed to get register challenge\");return _.json()}function l(u,y){let x=new Error(u);throw y&&(x.code=y),x}async function h(u,y){let x=await fetch(`${e}/auth`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({challengeId:u,credential:y})});if(!x.ok){let _=await x.json().catch(()=>({}));l(_.error||\"Authentication failed\",_.code)}return x.json()}async function b(u,y,x){let _=await fetch(`${e}/register`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({challengeId:u,credential:y,name:x||void 0})});if(!_.ok){let T=await _.json().catch(()=>({}));l(T.error||\"Registration failed\",T.code)}return _.json()}if(!n){r(\"Waiting for passkey...\",!1);try{let u=await i(),{challengeId:y}=u,x=u.authentication||u,_={publicKey:{...x,challenge:X(x.challenge),allowCredentials:(x.allowCredentials||[]).map(L=>({...L,id:X(L.id)}))}},T;try{T=await navigator.credentials.get(_)}catch{if(t)return{success:!1,error:\"no_passkey\"}}if(T){let L=nt(T);return r(\"Verifying...\",!1),await h(y,L),{success:!0}}}catch(u){let y=u instanceof Error?u.message:\"Authentication failed\",x=u instanceof Error?u.code:void 0;return r(y,!0),{success:!1,error:y,code:x}}}let p=await s(o.name||\"\");if(p.registrationAllowed===!1)return r(\"Registration requires an invitation.\",!0),{success:!1,error:\"registration_closed\"};r(\"No existing passkey found. Creating new one...\",!1);try{let u=p.registration||p,y={publicKey:{...u,challenge:X(u.challenge),user:{...u.user,id:X(u.user.id)},excludeCredentials:(u.excludeCredentials||[]).map(T=>({...T,id:X(T.id)}))}},x=await navigator.credentials.create(y),_=tt(x);return r(\"Verifying...\",!1),await b(p.challengeId,_,o.name||\"\"),{success:!0}}catch(u){let y=u instanceof Error?u.message:\"Passkey setup failed\",x=u instanceof Error?u.code:void 0;return r(y,!0),{success:!1,error:y,code:x}}}function W(o,e){let r=o instanceof Error?o.message:\"\",t=o instanceof Error&&\"code\"in o?o.code:\"\";return t===\"FORBIDDEN\"?v(\"accessDenied\",e):r===\"registration_closed\"||t===\"registration_closed\"?v(\"regClosed\",e):r||v(\"authFailed\",e)}var rt=\"https://web.abtwallet.io/\";function ot(){return typeof navigator>\"u\"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function st(){return typeof window>\"u\"?null:window.ABT_DEV??window.ABT??null}function U(o){return o.replace(/&/g,\"&\").replace(/</g,\"<\").replace(/>/g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\")}var ve=class{container;config;http;options;tokenSession=null;styleEl=null;mounted=!1;currentView=\"methods\";cardEl=null;mediaQuery=null;mediaListener=null;constructor(o,e,r,t){if(this.container=o,this.config=e,this.http=r,this.options={methods:[\"passkey\",\"did-connect\"],locale:\"en\",...t},!this.options.invitationId&&typeof document<\"u\"){let n=document.cookie.match(/(?:^|;\\s*)pending_invitation=([^;]*)/);if(n)try{this.options.invitationId=decodeURIComponent(n[1])}catch{}}}mount(){if(this.mounted)return;this.mounted=!0,this.styleEl=document.createElement(\"style\"),this.styleEl.textContent=et,this.container.appendChild(this.styleEl),this.applyTheme();let o=this.filterMethods(this.options.methods);this.renderCard(o)}destroy(){this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.mediaQuery&&this.mediaListener&&(this.mediaQuery.removeEventListener(\"change\",this.mediaListener),this.mediaQuery=null,this.mediaListener=null),document.documentElement.removeAttribute(\"data-theme\"),this.container.innerHTML=\"\",this.styleEl=null,this.cardEl=null,this.currentView=\"methods\",this.mounted=!1}update(o){Object.assign(this.options,o),this.mounted&&(this.destroy(),this.mount())}applyTheme(){let o=this.options.theme??\"dark\";if(o===\"light\")document.documentElement.dataset.theme=\"light\";else if(o===\"auto\"&&typeof window.matchMedia==\"function\"){let e=window.matchMedia(\"(prefers-color-scheme: light)\");this.mediaQuery=e;let r=t=>{t?document.documentElement.dataset.theme=\"light\":document.documentElement.removeAttribute(\"data-theme\")};r(e.matches),this.mediaListener=t=>r(t.matches),e.addEventListener(\"change\",this.mediaListener)}}filterMethods(o){return o.filter(e=>e===\"passkey\"?typeof window<\"u\"&&window.PublicKeyCredential!==void 0&&typeof window.PublicKeyCredential==\"function\":!0)}renderCard(o){let e=document.createElement(\"div\");e.className=\"card\",this.cardEl=e,this.container.appendChild(e),this.renderLocaleSwitcher(e),this.switchView(\"methods\",o)}renderLocaleSwitcher(o){if(ce.length<2)return;let e=document.createElement(\"div\");e.className=\"locale-switcher\";let r=this.options.locale,t=ce.find(a=>a.code!==r)??ce[0],n=document.createElement(\"button\");n.type=\"button\",n.className=\"locale-btn\",n.innerHTML=`${Ke} ${U(t.label)}`,n.title=t.label,n.addEventListener(\"click\",()=>{this.update({locale:t.code})}),e.appendChild(n),o.appendChild(e)}switchView(o,e){if(!this.cardEl)return;let r=this.options.locale;switch(this.currentView===\"qr\"&&o!==\"qr\"&&this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.currentView=o,this.cardEl.innerHTML=\"\",this.cardEl.dataset.view=o,o){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}}renderMethodsView(o,e,r){this.renderBrandHeader(o,e);let t=this.options.methods.includes(\"passkey\");if(t&&!r.includes(\"passkey\")){let i=document.createElement(\"div\");i.className=\"compat-warning\",i.textContent=v(\"passkeyUnsupported\",e),o.appendChild(i)}let n=r.includes(\"passkey\");n&&this.renderPasskeySection(o,e);let a=r.filter(i=>i!==\"passkey\");if(n&&a.length>0&&this.renderDivider(o,e),a.length>0&&this.renderSecondaryGrid(o,e,r),r.length===0&&!t){let i=document.createElement(\"p\");i.className=\"subtitle\",i.textContent=\"No authentication methods available.\",o.appendChild(i)}this.renderTrustFooter(o,e)}renderQRView(o,e){this.renderBackButton(o,e);let r=document.createElement(\"h2\");r.className=\"view-title\",r.textContent=v(\"scanTitle\",e),o.appendChild(r);let t=document.createElement(\"div\");t.id=\"did-connect-qr\",t.className=\"qr-view\",t.innerHTML='<div class=\"qr-placeholder\"><span class=\"qr-spinner\"></span></div>',o.appendChild(t);let n=document.createElement(\"button\");n.className=\"btn btn-secondary deep-link-btn\",n.id=\"did-wallet-open-btn\",n.textContent=v(\"openInWallet\",e),n.disabled=!0,o.appendChild(n);let a=document.createElement(\"div\");a.id=\"did-connect-status\",a.className=\"status\",o.appendChild(a),this.renderTrustFooter(o,e),this.startDIDConnectInView(a,t,n,e)}renderEmailView(o,e){this.renderBackButton(o,e);let r=document.createElement(\"h2\");r.className=\"view-title\",r.textContent=v(\"emailTitle\",e),o.appendChild(r);let t=document.createElement(\"input\");t.className=\"input\",t.type=\"email\",t.placeholder=v(\"emailPlaceholder\",e),o.appendChild(t);let n=document.createElement(\"button\");n.className=\"btn\",n.textContent=v(\"emailSubmit\",e),o.appendChild(n);let a=document.createElement(\"div\");a.className=\"status\",o.appendChild(a);let i=document.createElement(\"div\");i.className=\"email-code-section\",i.style.display=\"none\";let s=document.createElement(\"input\");s.className=\"input\",s.type=\"text\",s.inputMode=\"numeric\",s.maxLength=6,s.autocomplete=\"one-time-code\",s.placeholder=v(\"emailCodePlaceholder\",e),i.appendChild(s);let l=document.createElement(\"button\");l.className=\"btn\",l.textContent=v(\"emailVerify\",e),i.appendChild(l);let h=document.createElement(\"button\");h.className=\"btn btn-secondary\",h.textContent=v(\"emailResend\",e),h.style.marginTop=\"8px\",i.appendChild(h),o.insertBefore(i,a),this.renderTrustFooter(o,e);let b=\"\",p=this.config.servicePrefix??\"/.well-known/service\",u=async()=>{let x=t.value.trim();if(!x?.includes(\"@\")){a.textContent=v(\"emailInvalid\",e),a.className=\"status error\";return}n.disabled=!0,a.textContent=v(\"emailSending\",e),a.className=\"status\";try{await this.http.post(`${p}/api/email/sendCode`,{email:x}),b=x,t.style.display=\"none\",n.style.display=\"none\",i.style.display=\"\",r.textContent=v(\"emailVerify\",e),a.textContent=v(\"emailSent\",e,{email:x}),a.className=\"status\",s.focus()}catch(_){let T=_ instanceof Error?_.message:\"Failed to send email\";a.textContent=T,a.className=\"status error\",n.disabled=!1}},y=async()=>{let x=s.value.trim();if(!x||x.length!==6){a.textContent=v(\"emailCodeInvalid\",e),a.className=\"status error\";return}l.disabled=!0,a.textContent=v(\"verifying\",e),a.className=\"status\";try{await this.http.post(`${p}/api/email/login`,{code:x}),a.textContent=v(\"success\",e),a.className=\"status\",this.handleSuccess()}catch(_){_ instanceof Error&&\"code\"in _&&_.code===\"FORBIDDEN\"?this.showFullError(W(_,e)):(a.textContent=W(_,e),a.className=\"status error\",l.disabled=!1,s.value=\"\",s.focus())}};n.addEventListener(\"click\",u),t.addEventListener(\"keydown\",x=>{x.key===\"Enter\"&&u()}),l.addEventListener(\"click\",y),s.addEventListener(\"keydown\",x=>{x.key===\"Enter\"&&y()}),h.addEventListener(\"click\",async()=>{h.disabled=!0,a.textContent=v(\"emailSending\",e),a.className=\"status\";try{await this.http.post(`${p}/api/email/sendCode`,{email:b}),a.textContent=v(\"emailSent\",e,{email:b}),a.className=\"status\"}catch(x){let _=x instanceof Error?x.message:\"Failed to resend\";a.textContent=_,a.className=\"status error\"}h.disabled=!1})}renderBackButton(o,e){let r=document.createElement(\"button\");r.className=\"back-btn\",r.innerHTML=`${Ue} ${U(v(\"back\",e))}`,r.addEventListener(\"click\",()=>this.switchView(\"methods\")),o.appendChild(r)}renderBrandHeader(o,e){let r=document.createElement(\"div\");if(r.className=\"brand-header\",this.options.appLogo){let a=document.createElement(\"img\");a.className=\"app-logo\",a.src=U(this.options.appLogo),a.alt=this.options.appName?U(this.options.appName):\"\",a.width=48,a.height=48,r.appendChild(a)}let t=document.createElement(\"h1\");this.options.appName?t.textContent=v(\"signInTo\",e,{appName:this.options.appName}):t.textContent=v(\"signIn\",e),r.appendChild(t);let n=document.createElement(\"p\");this.options.masterAppName?(n.className=\"federated-hint\",n.textContent=v(\"federatedBy\",e,{masterName:this.options.masterAppName})):(n.className=\"subtitle\",n.textContent=v(\"subtitle\",e)),r.appendChild(n),o.appendChild(r)}renderTrustFooter(o,e){let r=document.createElement(\"div\");r.className=\"login-footer\";let t=document.createElement(\"div\");t.className=\"secured-badge\",t.innerHTML=`${Fe} ${U(v(\"securedBy\",e))}`,r.appendChild(t);let{privacyUrl:n,termsUrl:a}=this.options;if(n||a){let i=document.createElement(\"div\");if(i.className=\"footer-links\",n){let s=document.createElement(\"a\");s.href=n,s.target=\"_blank\",s.rel=\"noopener noreferrer\",s.textContent=v(\"privacy\",e),i.appendChild(s)}if(n&&a&&i.appendChild(document.createTextNode(\" \\xB7 \")),a){let s=document.createElement(\"a\");s.href=a,s.target=\"_blank\",s.rel=\"noopener noreferrer\",s.textContent=v(\"terms\",e),i.appendChild(s)}r.appendChild(i)}o.appendChild(r)}renderDivider(o,e){let r=document.createElement(\"div\");r.className=\"divider\",r.textContent=v(\"or\",e),o.appendChild(r)}renderPasskeySection(o,e){let r=document.createElement(\"div\");r.className=\"name-row\",r.id=\"passkey-name-row\";let t=document.createElement(\"input\");t.className=\"input\",t.id=\"passkey-name-input\",t.type=\"text\",t.placeholder=v(\"namePlaceholder\",e),t.autocomplete=\"name\",r.appendChild(t),o.appendChild(r);let n=document.createElement(\"button\");n.className=\"btn\",n.id=\"passkey-btn\",n.innerHTML=`${we} ${U(v(\"passkeyButton\",e))}`,o.appendChild(n);let a=document.createElement(\"div\");a.className=\"status\",a.id=\"passkey-status\",o.appendChild(a);let i=\"auth\";n.addEventListener(\"click\",async()=>{n.disabled=!0;let s=(l,h)=>{a.textContent=l,a.className=`status${h?\" error\":\"\"}`};if(i===\"auth\"){let l={authOnly:!0,onStatus:s,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId},h=await re(l);h.success?(s(v(\"success\",e),!1),this.handleSuccess()):h.code===\"FORBIDDEN\"||h.error===\"registration_closed\"?this.showFullError(W({message:h.error,code:h.code||h.error},e)):h.error&&h.error!==\"no_passkey\"?(s(h.error,!0),n.disabled=!1):(i=\"register\",r.className=\"name-row visible\",n.innerHTML=`${we} ${U(v(\"passkeyCreate\",e))}`,t.focus(),s(v(\"noPasskey\",e),!1),n.disabled=!1)}else{let l={registerOnly:!0,name:t.value.trim(),onStatus:s,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId},h=await re(l);h.success?(s(v(\"success\",e),!1),this.handleSuccess()):h.code===\"FORBIDDEN\"||h.error===\"registration_closed\"?this.showFullError(W({message:h.error,code:h.code||h.error},e)):(h.error&&s(h.error,!0),n.disabled=!1)}})}startOAuthPopup(o,e){let r=this.config.servicePrefix??\"/.well-known/service\",n=`${this.options.masterOAuthOrigin?`${this.options.masterOAuthOrigin}${r}`:r}/api/oauth/${encodeURIComponent(o)}/login?returnUrl=${encodeURIComponent(window.location.href)}`,a=500,i=620,s=window.screenX+(window.innerWidth-a)/2,l=window.screenY+(window.innerHeight-i)/2,h=window.open(n,\"oauth-login:popup\",`left=${s},top=${l},width=${a},height=${i},resizable,scrollbars=yes,status=1,popup`);if(!h){window.location.href=n;return}let b=e.innerHTML;e.innerHTML='<span class=\"oauth-spinner\"></span> Authorizing...',e.disabled=!0,e.classList.add(\"oauth-btn-loading\");let p=()=>{e.innerHTML=b,e.disabled=!1,e.classList.remove(\"oauth-btn-loading\")},u=async _=>{if(!_.data||_.data.type!==\"authorization_response\")return;if(x(),h.close(),_.data.error){p();return}let{code:T,state:L}=_.data.response??_.data;if(!T){p();return}e.innerHTML='<span class=\"oauth-spinner\"></span> Signing in...';try{let S={provider:o,code:T,state:L};this.options.invitationId&&(S.invitationId=this.options.invitationId),await this.http.post(`${r}/api/oauth/login`,S),e.innerHTML='<span class=\"oauth-check\">\\u2713</span> Success',this.handleSuccess()}catch(S){let oe=S instanceof Error?S.message:\"\",te=S instanceof Error&&\"code\"in S?S.code:\"\";te===\"FORBIDDEN\"||oe===\"registration_closed\"||te===\"registration_closed\"?this.showFullError(W(S,this.options.locale)):p()}},y=setInterval(()=>{h.closed&&(x(),p())},500),x=()=>{clearInterval(y),window.removeEventListener(\"message\",u)};window.addEventListener(\"message\",u)}renderSecondaryGrid(o,e,r){let t=document.createElement(\"div\");if(t.className=\"methods-grid\",r.includes(\"oauth\")&&this.options.oauthProviders?.length){let n=(this.options.oauthProviders??[]).filter(a=>a.enabled);for(let a of n){let i=document.createElement(\"button\");i.className=\"method-btn\",i.dataset.provider=a.id;let s=Ve(a.id);i.innerHTML=`${s} ${U(a.name)}`,t.appendChild(i),i.addEventListener(\"click\",()=>{this.startOAuthPopup(a.id,i)})}}if(r.includes(\"email\")){let n=document.createElement(\"button\");n.className=\"method-btn\",n.id=\"email-btn\",n.innerHTML=`${Me} ${U(v(\"emailButton\",e))}`,t.appendChild(n),n.addEventListener(\"click\",()=>{this.switchView(\"email\")})}if(r.includes(\"did-connect\")){let n=document.createElement(\"button\");n.className=\"method-btn\",n.id=\"did-wallet-btn\";let a=t.children.length>0?v(\"didWalletButtonShort\",e):v(\"didWalletButton\",e);n.innerHTML=`${ye} ${U(a)}`,t.appendChild(n),n.addEventListener(\"click\",()=>{this.switchView(\"qr\")})}o.appendChild(t)}async startDIDConnectInView(o,e,r,t){o.textContent=v(\"connecting\",t);try{this.tokenSession?.destroy(),this.tokenSession=new J(this.config,this.http),this.tokenSession.on(\"succeed\",async()=>{this.showConnectResult(e,r,o,v(\"verifying\",t));try{let a=this.config.servicePrefix??\"/.well-known/service\";await this.http.post(`${a}/api/did/connect/complete`,{token:this.tokenSession.state.token}),this.showConnectSuccess(e,r,o,t),this.handleSuccess()}catch(a){this.showConnectResult(e,r,o,W(a,t),!0)}}),this.tokenSession.on(\"timeout\",()=>{o.textContent=v(\"timeout\",t);let a=document.createElement(\"div\");a.className=\"qr-timeout-overlay\",a.innerHTML=`<span class=\"timeout-text\">${U(v(\"timeout\",t))}</span>`;let i=document.createElement(\"button\");i.className=\"refresh-btn\",i.textContent=v(\"refreshQR\",t),i.addEventListener(\"click\",()=>{a.remove(),le(e),e.innerHTML='<div class=\"qr-placeholder\"><span class=\"qr-spinner\"></span></div>',r.disabled=!0,this.startDIDConnectInView(o,e,r,t)}),a.appendChild(i),e.appendChild(a)}),this.tokenSession.on(\"error\",a=>{this.showConnectResult(e,r,o,W(a,t),!0)}),this.tokenSession.on(\"statusChange\",a=>{a.status===\"scanned\"&&this.showConnectScanned(e,r,o,t)});let n=await this.tokenSession.create();n.url&&(Ze(e,n.url),r.disabled=!1,r.addEventListener(\"click\",()=>{this.showConnectScanned(e,r,o,t),this.openInWallet(n.url,t)})),o.textContent=v(\"scanWithWallet\",t),this.tokenSession.startPolling()}catch(n){o.textContent=W(n,t),le(e)}}showFullError(o){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.renderLocaleSwitcher(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 t=document.createElement(\"div\");t.className=\"status error\",t.textContent=o,this.cardEl.appendChild(t);let n=document.createElement(\"button\");n.className=\"btn btn-secondary result-back-btn\",n.textContent=v(\"back\",e),n.addEventListener(\"click\",()=>this.switchView(\"methods\")),this.cardEl.appendChild(n),this.renderTrustFooter(this.cardEl,e)}showConnectScanned(o,e,r,t=\"en\"){o.style.display=\"none\",e.style.display=\"none\";let n=o.parentElement?.querySelector(\".connect-result\");n||(n=document.createElement(\"div\"),n.className=\"connect-result\",o.parentElement?.insertBefore(n,r)),n.innerHTML=`<div class=\"connect-status-icon\">\n <div class=\"connect-spinner-ring\"></div>\n <span class=\"connect-status-badge\">${ye}</span>\n </div>`,r.textContent=v(\"waitingWallet\",t),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=v(\"walletContinue\",t);let i=r.parentElement?.querySelector(\".result-back-btn\");i||(i=document.createElement(\"button\"),i.className=\"btn btn-secondary result-back-btn\",i.textContent=v(\"back\",t),i.addEventListener(\"click\",()=>this.switchView(\"methods\")),a.parentElement?.insertBefore(i,a.nextSibling))}showConnectSuccess(o,e,r,t=\"en\"){o.style.display=\"none\",e.style.display=\"none\";let n=o.parentElement?.querySelector(\".connect-result\");n||(n=document.createElement(\"div\"),n.className=\"connect-result\",o.parentElement?.insertBefore(n,r)),n.innerHTML=`<div class=\"connect-status-icon connect-success\">\n <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>\n </div>`,r.textContent=v(\"success\",t),r.className=\"status success\";let a=r.parentElement?.querySelector(\".connect-subtitle\"),i=r.parentElement?.querySelector(\".result-back-btn\");a?.remove(),i?.remove()}showConnectResult(o,e,r,t,n=!1){let a=this.options.locale;o.style.display=\"none\",e.style.display=\"none\";let i=o.parentElement?.querySelector(\".connect-result\");if(i||(i=document.createElement(\"div\"),i.className=\"connect-result\",o.parentElement?.insertBefore(i,r)),n){i.innerHTML='<div class=\"result-icon result-error\">\\u2715</div>',r.textContent=t,r.className=\"status error\";let s=r.parentElement?.querySelector(\".result-back-btn\");s||(s=document.createElement(\"button\"),s.className=\"btn btn-secondary result-back-btn\",s.textContent=v(\"back\",a),s.addEventListener(\"click\",()=>this.switchView(\"methods\")),r.parentElement?.insertBefore(s,r.nextSibling))}else i.innerHTML='<div class=\"result-icon result-loading\"><span class=\"qr-spinner\"></span></div>',r.textContent=t,r.className=\"status\"}openInWallet(o,e=\"en\"){let r=ot(),t=st();if(r){let n=o.replace(/^https?:\\/\\//,\"abt://\");window.location.href=n}else if(t&&typeof t.open==\"function\"){let n=this.tokenSession?.state;t.open({action:this.config.action??\"login\",locale:e,url:encodeURIComponent(o),appInfo:n?.appInfo??{},memberAppInfo:n?.memberAppInfo??{}})}else{let n=`${rt}?action=requestAuth&url=${encodeURIComponent(o)}`,a=414,i=736,s=window.screenX+window.innerWidth-a,l=window.screenY;window.open(n,\"did-wallet:popup\",`left=${s},top=${l},width=${a},height=${i},resizable,scrollbars=yes,status=1,popup`)}}handleSuccess(){this.options.onSuccess?this.options.onSuccess():setTimeout(()=>location.reload(),300)}};return Re(it);})();\n";
|
|
1
|
+
declare const _default: "\"use strict\";var __LoginBundle=(()=>{var ie=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ae=(s,e)=>{for(var r in e)ie(s,r,{get:e[r],enumerable:!0})},Ie=(s,e,r,t)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let n of Te(e))!De.call(s,n)&&n!==r&&ie(s,n,{get:()=>e[n],enumerable:!(t=Ce(e,n))||t.enumerable});return s};var Re=s=>Ie(ie({},\"__esModule\",{value:!0}),s);var it={};Ae(it,{FetchHttpAdapter:()=>J,LoginPage:()=>ve,runPasskeyAuth:()=>se});var F={CREATED:\"created\",SCANNED:\"scanned\",SUCCEED:\"succeed\",ERROR:\"error\",TIMEOUT:\"timeout\",BUSY:\"busy\",FORBIDDEN:\"forbidden\"};var O={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 re=\"did:abt:\";function pe(s){if(!s||typeof s!=\"string\")return!1;let e=s.replace(re,\"\");return/^(0x)?[0-9a-f]{40}$/i.test(e)}function fe(s,e=8,r=6){return!s||typeof s!=\"string\"?\"\":s.length<=e+r+3?s:`${s.slice(0,e)}...${s.slice(-r)}`}function ae(s,e={}){if(!s||typeof s!=\"string\")return{prefix:\"DID: ABT:\",chainLabel:\"ABT\",address:\"\",compact:\"\",copyText:\"\"};let{startChars:r=8,endChars:t=6}=e,n=pe(s),a=s.replace(re,\"\"),o=n?\"ETH\":\"ABT\",i=e.includePrefix??!n;return{prefix:`DID: ${o}:`,chainLabel:o,address:a,compact:fe(a,r,t),copyText:i?`${re}${a}`:a}}var L={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\"},B=class extends Error{code;constructor(e,r){super(r),this.name=\"ConnectError\",this.code=e}};var J=class{_defaultHeaders;_onRequest;constructor(e){this._defaultHeaders=e?.headers??{},this._onRequest=e?.onRequest}async get(e,r){this._validateUrl(e);let t=r?.params?this._serializeParams(r.params):\"\",n=t?`${e}${e.includes(\"?\")?\"&\":\"?\"}${t}`:e,o={method:\"GET\",headers:{...this._defaultHeaders,...r?.headers},signal:r?.signal};return this._onRequest&&(o=this._onRequest(n,o)),this._execute(n,o)}async post(e,r,t){this._validateUrl(e);let n=t?.params?this._serializeParams(t.params):\"\",a=n?`${e}${e.includes(\"?\")?\"&\":\"?\"}${n}`:e,i={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...this._defaultHeaders,...t?.headers},body:r!==void 0?JSON.stringify(r):void 0,signal:t?.signal};return this._onRequest&&(i=this._onRequest(a,i)),this._execute(a,i)}_validateUrl(e){if(!e?.trim())throw new B(L.NETWORK_ERROR,\"Request URL must not be empty\");if(e.trim().toLowerCase().startsWith(\"javascript:\"))throw new B(L.NETWORK_ERROR,\"Invalid URL protocol\")}async _execute(e,r){let t;try{t=await globalThis.fetch(e,r)}catch(o){throw o?.name===\"AbortError\"?o:new B(L.NETWORK_ERROR,`Network request failed: ${o?.message??\"Unknown error\"}`)}if(!t.ok){let o=\"\",i=\"\";try{let m=await t.text();try{let y=JSON.parse(m);y.error&&(o=y.error),y.code&&(i=y.code)}catch{o=m}}catch{}let d=i===\"FORBIDDEN\"?L.FORBIDDEN:L.NETWORK_ERROR;throw new B(d,o||`HTTP ${t.status} ${t.statusText||\"Error\"}`)}if(t.status===204)return null;let n=await t.text();if(!n.trim())return null;let a=t.headers.get(\"content-type\")??\"\";if(!a.includes(\"application/json\")&&!a.includes(\"+json\"))throw new B(L.INVALID_RESPONSE,`Expected JSON response but received: ${a||\"unknown content type\"}`);try{return JSON.parse(n)}catch{throw new B(L.INVALID_RESPONSE,\"Failed to parse JSON response\")}}_serializeParams(e){let r=[];for(let t of Object.keys(e)){let n=e[t];if(n!=null)if(Array.isArray(n))for(let a of n)a!=null&&r.push(`${encodeURIComponent(t)}=${encodeURIComponent(String(a))}`);else typeof n==\"boolean\"?r.push(`${encodeURIComponent(t)}=${n?\"true\":\"false\"}`):r.push(`${encodeURIComponent(t)}=${encodeURIComponent(String(n))}`)}return r.join(\"&\")}};function X(s){let e=s.apiPrefix??O.API_PREFIX,r=s.action??O.ACTION,t=e.replace(/\\/+$/,\"\"),n=r.replace(/^\\/+/,\"\");return`${t}/${n}`}function me(){return{token:null,url:null,status:null,error:null,appInfo:null,memberAppInfo:null,loading:!1}}var Z=class{_state;_config;_http;_pollTimer=null;_checkCount=0;_maxCheckCount;_realtimeUnsub=null;_realtime;_storage;_lastCreateTime=0;_listeners=new Map;_destroyed=!1;constructor(e,r,t){this._config=this._fillDefaults(e),this._http=r,this._realtime=t?.realtime,this._storage=t?.storage,this._state=me(),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<O.CREATE_THROTTLE)return this.state;(this._pollTimer!==null||this._realtimeUnsub!==null)&&this.stopPolling(),this._state.loading=!0,this._emit(\"statusChange\",this.state);let r=`${X(this._config)}/token`,t={};e?(e.locale!=null&&(t.locale=e.locale),e.provider!=null?t.provider=e.provider:t.provider=\"wallet\",e.encKey!=null&&(t.__encKey=e.encKey),e.autoConnect!=null&&(t.autoConnect=e.autoConnect),e.visitorId!=null&&(t.visitorId=e.visitorId),e.sourceToken!=null&&(t.sourceToken=e.sourceToken),e.forceConnected!=null&&(t.forceConnected=e.forceConnected),e.connectUrl!=null&&(t.connectUrl=e.connectUrl),e.extraParams&&Object.assign(t,e.extraParams)):t.provider=\"wallet\";try{let n=await this._http.get(r,{params:t});return this._state.token=n.token??null,this._state.url=n.url??null,this._state.status=F.CREATED,this._state.appInfo=n.appInfo??null,this._state.memberAppInfo=n.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(n){throw this._state.loading=!1,this._state.error=n?.message??\"Failed to create token\",this._state.status=F.ERROR,this._emit(\"statusChange\",this.state),this._emit(\"error\",new B(L.NETWORK_ERROR,this._state.error)),n}}async checkStatus(){if(!this._state.token)throw new B(L.TOKEN_NOT_FOUND,\"No token available. Call create() first.\");let e=`${X(this._config)}/status`,r={[O.TOKEN_KEY]:this._state.token};this._config.appPid;try{let t=await this._http.get(e,{params:r}),n=t.status;return n&&(this._state.status=n),t.error!==void 0&&(this._state.error=t.error),t.connectedDid!==void 0&&(this._state.connectedDid=t.connectedDid),t.mfaCode!==void 0&&(this._state.mfaCode=t.mfaCode),t.saveConnect!==void 0&&(this._state.saveConnect=t.saveConnect),n===F.FORBIDDEN?(this._state.status=F.ERROR,this._state.error=t.error||\"Access forbidden\",this._emit(\"error\",new B(L.UNAUTHORIZED,this._state.error)),this.stopPolling()):n===F.SUCCEED?(this._config.tokenDelivery===\"response\"&&(this._state.successResult=t),this._emit(\"succeed\",this.state),this.stopPolling()):n===F.ERROR?(this._emit(\"error\",new B(L.INVALID_RESPONSE,this._state.error||\"Unknown error\")),this.stopPolling()):n===F.TIMEOUT&&(this._emit(\"timeout\",this.state),this.stopPolling()),this._emit(\"statusChange\",this.state),this.state}catch(t){throw t}}async cancel(){if(!this._state.token)return;let e=`${X(this._config)}/timeout`,r={[O.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=me(),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 t=this._listeners.get(e);return t||(t=new Set,this._listeners.set(e,t)),t.add(r),this}off(e,r){let t=this._listeners.get(e);return t&&(t.delete(r),t.size===0&&this._listeners.delete(e)),this}_emit(e,...r){let t=this._listeners.get(e);if(!(!t||t.size===0))for(let n of[...t])try{n(...r)}catch{}}_pollOnce(){if(this._checkCount++,this._checkCount>=this._maxCheckCount){this._handleTimeout();return}this.checkStatus().catch(()=>{})}_handleTimeout(){this.stopPolling(),this._state.status=F.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===F.FORBIDDEN?(this._state.status=F.ERROR,this._state.error=e.error||\"Access forbidden\",this._emit(\"error\",new B(L.UNAUTHORIZED,this._state.error)),this.stopPolling()):r===F.SUCCEED?(this._config.tokenDelivery===\"response\"&&(this._state.successResult=e),this._emit(\"succeed\",this.state),this.stopPolling()):r===F.ERROR?(this._emit(\"error\",new B(L.INVALID_RESPONSE,this._state.error||\"Unknown error\")),this.stopPolling()):r===F.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??O.API_PREFIX,action:e.action??O.ACTION,servicePrefix:e.servicePrefix??O.SERVICE_PREFIX,tokenTimeout:e.tokenTimeout??O.TOKEN_TIMEOUT,checkInterval:e.checkInterval??O.CHECK_INTERVAL,tokenDelivery:e.tokenDelivery??O.TOKEN_DELIVERY}}};var C={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\"}},P={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)\"}},Se=`\n :root {\n /* Backgrounds \\u2014 layered depth */\n --bg-root: ${C.bg.root};\n --bg-surface: ${C.bg.surface};\n --bg-card: ${C.bg.card};\n --bg-elevated: ${C.bg.elevated};\n --bg-hover: ${C.bg.hover};\n --bg-active: ${C.bg.active};\n --bg-input: ${C.bg.input};\n\n /* Borders \\u2014 semi-transparent for adaptability */\n --border: ${C.border.default};\n --border-subtle:${C.border.subtle};\n --border-strong:${C.border.strong};\n --border-focus: ${C.border.focus};\n\n /* Text hierarchy */\n --text: ${C.text.primary};\n --text-secondary:${C.text.secondary};\n --text-tertiary:${C.text.tertiary};\n --text-placeholder:${C.text.placeholder};\n --text-white: ${C.text.white};\n\n /* Accents */\n --blue: ${C.color.blue};\n --blue-hover: ${C.color.blueHover};\n --blue-light: ${C.color.blueLight};\n --blue-muted: ${C.color.blueMuted};\n --red: ${C.color.red};\n --red-light: ${C.color.redLight};\n --red-text: ${C.color.redText};\n --green: ${C.color.green};\n --green-light: ${C.color.greenLight};\n --green-text: ${C.color.greenText};\n --yellow: ${C.color.yellow};\n --yellow-light: ${C.color.yellowLight};\n --yellow-text: ${C.color.yellowText};\n --info: ${C.color.info};\n --info-light: ${C.color.infoLight};\n --info-text: ${C.color.infoText};\n\n /* Radii */\n --radius-xs: ${C.radius.xs};\n --radius-sm: ${C.radius.sm};\n --radius: ${C.radius.md};\n --radius-lg: ${C.radius.lg};\n --radius-full: ${C.radius.full};\n\n /* Shadows */\n --shadow-sm: ${C.shadow.sm};\n --shadow-md: ${C.shadow.md};\n --shadow-lg: ${C.shadow.lg};\n --shadow-focus: ${C.shadow.focus};\n }\n`,Ne=`\n [data-theme=\"light\"] {\n --bg-root: ${P.bg.root};\n --bg-surface: ${P.bg.surface};\n --bg-card: ${P.bg.card};\n --bg-elevated: ${P.bg.elevated};\n --bg-hover: ${P.bg.hover};\n --bg-active: ${P.bg.active};\n --bg-input: ${P.bg.input};\n\n --border: ${P.border.default};\n --border-subtle:${P.border.subtle};\n --border-strong:${P.border.strong};\n --border-focus: ${P.border.focus};\n\n --text: ${P.text.primary};\n --text-secondary:${P.text.secondary};\n --text-tertiary:${P.text.tertiary};\n --text-placeholder:${P.text.placeholder};\n --text-white: ${P.text.white};\n\n --shadow-sm: ${P.shadow.sm};\n --shadow-md: ${P.shadow.md};\n --shadow-lg: ${P.shadow.lg};\n --shadow-focus: ${P.shadow.focus};\n }\n`,Be=`\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n html { color-scheme: dark; }\n html[data-theme=\"light\"] { color-scheme: light; }\n body {\n font-family: ${C.font.family};\n background: var(--bg-root);\n color: var(--text);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n font-size: ${C.font.sizeBase};\n line-height: ${C.font.lineHeight};\n }\n a { color: var(--blue-muted); text-decoration: none; }\n a:hover { text-decoration: underline; }\n .hidden { display: none; }\n`,Le=typeof HTMLElement<\"u\"?HTMLElement:class{},ye='<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>',Pe='<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>',Oe=`\n:host {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n overflow: hidden;\n font-family: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;\n line-height: 1.5;\n}\n:host([block]) { display: flex; }\n.prefix {\n flex-shrink: 0;\n opacity: 0.6;\n margin-right: 4px;\n white-space: nowrap;\n}\n.address {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: var(--did-text-color, currentColor);\n}\n.address-compact {\n white-space: nowrap;\n color: var(--did-text-color, currentColor);\n cursor: default;\n}\n.clickable { cursor: pointer; }\n.clickable:hover { opacity: 0.8; }\n.copy-btn {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1em;\n height: 1em;\n margin-left: 6px;\n padding: 0;\n border: none;\n background: none;\n color: inherit;\n opacity: 0.5;\n cursor: pointer;\n transition: opacity 0.15s;\n}\n.copy-btn:hover { opacity: 1; }\n.copy-btn.copied { opacity: 1; color: var(--did-copy-success-color, #22c55e); }\n`,$e=class extends Le{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 s=Number(this.getAttribute(\"start-chars\")),e=Number(this.getAttribute(\"end-chars\"));return ae(this.getAttribute(\"did\")||\"\",{startChars:s>0?s: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\"),t=!this.hasAttribute(\"no-copy\")&&this.getAttribute(\"copyable\")!==\"false\",n=this.hasAttribute(\"show-prefix\"),a=this.hasAttribute(\"no-tooltip\"),o=Number(this.getAttribute(\"size\"))||0,i=o>=12?`${o}px`:\"inherit\",d=r?e.compact:e.address,m=!a&&r?` title=\"${e.address}\"`:\"\",y=n?`<span class=\"prefix\">${e.prefix} </span>`:\"\",p=r?\"address-compact\":\"address\",l=t?\" clickable\":\"\",b=t?`<button class=\"copy-btn\" aria-label=\"Copy DID\">${ye}</button>`:\"\";if(this.shadow.innerHTML=`\n <style>${Oe}:host { font-size: ${i}; }</style>\n ${y}<span class=\"${p}${l}\"${m}>${d}</span>${b}\n `,t){let T=this.shadow.querySelector(`.${p}`);T&&T.addEventListener(\"click\",x=>{x.stopPropagation(),this.copyToClipboard(e.copyText)});let v=this.shadow.querySelector(\".copy-btn\");v&&v.addEventListener(\"click\",x=>{x.stopPropagation(),this.copyToClipboard(e.copyText)})}}copyToClipboard(s){navigator.clipboard?.writeText?navigator.clipboard.writeText(s).catch(()=>this.fallbackCopy(s)):this.fallbackCopy(s),this.showCopied()}fallbackCopy(s){try{let e=document.createElement(\"input\");e.value=s,document.body.appendChild(e),e.select(),document.execCommand?.(\"copy\"),e.remove()}catch{}}showCopied(){let s=this.shadow.querySelector(\".copy-btn\");s&&(s.classList.add(\"copied\"),s.innerHTML=Pe,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{s.classList.remove(\"copied\"),s.innerHTML=ye},1500))}};typeof customElements<\"u\"&&!customElements.get(\"did-address\")&&customElements.define(\"did-address\",$e);var be={en:{signIn:\"Sign in\",signInTo:\"Sign in to {appName}\",subtitle:\"Sign in to continue\",passkeyButton:\"Continue with Passkey\",passkeySignIn:\"Sign in with Passkey\",passkeyCreate:\"Create Passkey\",passkeyFirstTime:\"First time? Create a passkey\",passkeyBackToSignIn:\"Back to sign in\",passkeyWaiting:\"Waiting for passkey\\u2026\",passkeyCreating:\"Creating your passkey\\u2026\",passkeyNoLocal:\"No passkey found on this device.\",passkeyUseAnotherDevice:\"Use another device\",passkeyCreateInstead:\"Create a new passkey instead\",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\",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\",scanTitle:\"Scan with DID Wallet\",emailTitle:\"Continue with Email\",emailSubmit:\"Send Code\",emailSending:\"Sending code...\",emailSent:\"We sent a 6-digit code to {email}\",emailCodePlaceholder:\"6-digit code\",emailVerify:\"Verify\",emailResend:\"Resend code\",emailInvalid:\"Please enter a valid email address.\",emailCodeInvalid:\"Please enter the 6-digit code.\"},zh:{signIn:\"\\u767B\\u5F55\",signInTo:\"\\u767B\\u5F55\\u5230 {appName}\",subtitle:\"\\u767B\\u5F55\\u4EE5\\u7EE7\\u7EED\",passkeyButton:\"\\u4F7F\\u7528 Passkey \\u7EE7\\u7EED\",passkeySignIn:\"\\u4F7F\\u7528 Passkey \\u767B\\u5F55\",passkeyCreate:\"\\u521B\\u5EFA Passkey\",passkeyFirstTime:\"\\u7B2C\\u4E00\\u6B21\\u4F7F\\u7528\\uFF1F\\u521B\\u5EFA Passkey\",passkeyBackToSignIn:\"\\u8FD4\\u56DE\\u767B\\u5F55\",passkeyWaiting:\"\\u6B63\\u5728\\u7B49\\u5F85 Passkey\\u2026\",passkeyCreating:\"\\u6B63\\u5728\\u521B\\u5EFA Passkey\\u2026\",passkeyNoLocal:\"\\u6B64\\u8BBE\\u5907\\u4E0A\\u6CA1\\u6709\\u627E\\u5230 Passkey\\u3002\",passkeyUseAnotherDevice:\"\\u7528\\u5176\\u4ED6\\u8BBE\\u5907\\u767B\\u5F55\",passkeyCreateInstead:\"\\u6539\\u4E3A\\u521B\\u5EFA\\u65B0\\u7684 Passkey\",didWalletButton:\"\\u4F7F\\u7528 DID \\u94B1\\u5305\\u7EE7\\u7EED\",didWalletButtonShort:\"DID \\u94B1\\u5305\",scanWithWallet:\"\\u8BF7\\u4F7F\\u7528 DID \\u94B1\\u5305\\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:\"\\u4F60\\u7684\\u540D\\u5B57\\uFF08\\u53EF\\u9009\\uFF09\",or:\"\\u6216\",emailPlaceholder:\"\\u90AE\\u7BB1\\u5730\\u5740\",emailButton:\"\\u90AE\\u7BB1\",passkeyUnsupported:\"\\u4F60\\u7684\\u6D4F\\u89C8\\u5668\\u4E0D\\u652F\\u6301 Passkey \\u8BA4\\u8BC1\\u3002\",connecting:\"\\u8FDE\\u63A5\\u4E2D...\",verifying:\"\\u9A8C\\u8BC1\\u4E2D...\",openInWallet:\"\\u5728 DID \\u94B1\\u5305\\u4E2D\\u6253\\u5F00\",authFailed:\"\\u8BA4\\u8BC1\\u5931\\u8D25\",accessDenied:\"\\u8BBF\\u95EE\\u88AB\\u62D2\\u7EDD\\uFF1A\\u4F60\\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\",scanTitle:\"\\u4F7F\\u7528 DID \\u94B1\\u5305\\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:\"6 \\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 6 \\u4F4D\\u9A8C\\u8BC1\\u7801\\u3002\"}},ce=[{code:\"en\",label:\"English\"},{code:\"zh\",label:\"\\u4E2D\\u6587\"}];function E(s,e,r){let t=e&&be[e]?e:\"en\",n=be[t][s]??s;if(r)for(let[a,o]of Object.entries(r))n=n.replace(new RegExp(`\\\\{${a}\\\\}`,\"g\"),o);return n}var le='<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>',we='<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>',Me='<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>',Fe='<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>',Ue='<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>',He={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>'},Ke='<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 Ve(s){return He[s.toLowerCase()]??\"\"}var Q=function(s,e){let n=s,a=te[e],o=null,i=0,d=null,m=[],y={},p=function(u,g){i=n*4+17,o=(function(c){let f=new Array(c);for(let h=0;h<c;h+=1){f[h]=new Array(c);for(let w=0;w<c;w+=1)f[h][w]=null}return f})(i),l(0,0),l(i-7,0),l(0,i-7),v(),T(),A(u,g),n>=7&&x(u),d==null&&(d=U(n,a,m)),D(d,g)},l=function(u,g){for(let c=-1;c<=7;c+=1)if(!(u+c<=-1||i<=u+c))for(let f=-1;f<=7;f+=1)g+f<=-1||i<=g+f||(0<=c&&c<=6&&(f==0||f==6)||0<=f&&f<=6&&(c==0||c==6)||2<=c&&c<=4&&2<=f&&f<=4?o[u+c][g+f]=!0:o[u+c][g+f]=!1)},b=function(){let u=0,g=0;for(let c=0;c<8;c+=1){p(!0,c);let f=q.getLostPoint(y);(c==0||u>f)&&(u=f,g=c)}return g},T=function(){for(let u=8;u<i-8;u+=1)o[u][6]==null&&(o[u][6]=u%2==0);for(let u=8;u<i-8;u+=1)o[6][u]==null&&(o[6][u]=u%2==0)},v=function(){let u=q.getPatternPosition(n);for(let g=0;g<u.length;g+=1)for(let c=0;c<u.length;c+=1){let f=u[g],h=u[c];if(o[f][h]==null)for(let w=-2;w<=2;w+=1)for(let _=-2;_<=2;_+=1)w==-2||w==2||_==-2||_==2||w==0&&_==0?o[f+w][h+_]=!0:o[f+w][h+_]=!1}},x=function(u){let g=q.getBCHTypeNumber(n);for(let c=0;c<18;c+=1){let f=!u&&(g>>c&1)==1;o[Math.floor(c/3)][c%3+i-8-3]=f}for(let c=0;c<18;c+=1){let f=!u&&(g>>c&1)==1;o[c%3+i-8-3][Math.floor(c/3)]=f}},A=function(u,g){let c=a<<3|g,f=q.getBCHTypeInfo(c);for(let h=0;h<15;h+=1){let w=!u&&(f>>h&1)==1;h<6?o[h][8]=w:h<8?o[h+1][8]=w:o[i-15+h][8]=w}for(let h=0;h<15;h+=1){let w=!u&&(f>>h&1)==1;h<8?o[8][i-h-1]=w:h<9?o[8][15-h-1+1]=w:o[8][15-h-1]=w}o[i-8][8]=!u},D=function(u,g){let c=-1,f=i-1,h=7,w=0,_=q.getMaskFunction(g);for(let I=i-1;I>0;I-=2)for(I==6&&(I-=1);;){for(let R=0;R<2;R+=1)if(o[f][I-R]==null){let N=!1;w<u.length&&(N=(u[w]>>>h&1)==1),_(f,I-R)&&(N=!N),o[f][I-R]=N,h-=1,h==-1&&(w+=1,h=7)}if(f+=c,f<0||i<=f){f-=c,c=-c;break}}},$=function(u,g){let c=0,f=0,h=0,w=new Array(g.length),_=new Array(g.length);for(let k=0;k<g.length;k+=1){let S=g[k].dataCount,H=g[k].totalCount-S;f=Math.max(f,S),h=Math.max(h,H),w[k]=new Array(S);for(let W=0;W<w[k].length;W+=1)w[k][W]=255&u.getBuffer()[W+c];c+=S;let oe=q.getErrorCorrectPolynomial(H),de=ne(w[k],oe.getLength()-1).mod(oe);_[k]=new Array(oe.getLength()-1);for(let W=0;W<_[k].length;W+=1){let he=W+de.getLength()-_[k].length;_[k][W]=he>=0?de.getAt(he):0}}let I=0;for(let k=0;k<g.length;k+=1)I+=g[k].totalCount;let R=new Array(I),N=0;for(let k=0;k<f;k+=1)for(let S=0;S<g.length;S+=1)k<w[S].length&&(R[N]=w[S][k],N+=1);for(let k=0;k<h;k+=1)for(let S=0;S<g.length;S+=1)k<_[S].length&&(R[N]=_[S][k],N+=1);return R},U=function(u,g,c){let f=xe.getRSBlocks(u,g),h=Ee();for(let _=0;_<c.length;_+=1){let I=c[_];h.put(I.getMode(),4),h.put(I.getLength(),q.getLengthInBits(I.getMode(),u)),I.write(h)}let w=0;for(let _=0;_<f.length;_+=1)w+=f[_].dataCount;if(h.getLengthInBits()>w*8)throw\"code length overflow. (\"+h.getLengthInBits()+\">\"+w*8+\")\";for(h.getLengthInBits()+4<=w*8&&h.put(0,4);h.getLengthInBits()%8!=0;)h.putBit(!1);for(;!(h.getLengthInBits()>=w*8||(h.put(236,8),h.getLengthInBits()>=w*8));)h.put(17,8);return $(h,f)};y.addData=function(u,g){g=g||\"Byte\";let c=null;switch(g){case\"Numeric\":c=We(u);break;case\"Alphanumeric\":c=je(u);break;case\"Byte\":c=qe(u);break;case\"Kanji\":c=ze(u);break;default:throw\"mode:\"+g}m.push(c),d=null},y.isDark=function(u,g){if(u<0||i<=u||g<0||i<=g)throw u+\",\"+g;return o[u][g]},y.getModuleCount=function(){return i},y.make=function(){if(n<1){let u=1;for(;u<40;u++){let g=xe.getRSBlocks(u,a),c=Ee();for(let h=0;h<m.length;h++){let w=m[h];c.put(w.getMode(),4),c.put(w.getLength(),q.getLengthInBits(w.getMode(),u)),w.write(c)}let f=0;for(let h=0;h<g.length;h++)f+=g[h].dataCount;if(c.getLengthInBits()<=f*8)break}n=u}p(!1,b())},y.createTableTag=function(u,g){u=u||2,g=typeof g>\"u\"?u*4:g;let c=\"\";c+='<table style=\"',c+=\" border-width: 0px; border-style: none;\",c+=\" border-collapse: collapse;\",c+=\" padding: 0px; margin: \"+g+\"px;\",c+='\">',c+=\"<tbody>\";for(let f=0;f<y.getModuleCount();f+=1){c+=\"<tr>\";for(let h=0;h<y.getModuleCount();h+=1)c+='<td style=\"',c+=\" border-width: 0px; border-style: none;\",c+=\" border-collapse: collapse;\",c+=\" padding: 0px; margin: 0px;\",c+=\" width: \"+u+\"px;\",c+=\" height: \"+u+\"px;\",c+=\" background-color: \",c+=y.isDark(f,h)?\"#000000\":\"#ffffff\",c+=\";\",c+='\"/>';c+=\"</tr>\"}return c+=\"</tbody>\",c+=\"</table>\",c},y.createSvgTag=function(u,g,c,f){let h={};typeof arguments[0]==\"object\"&&(h=arguments[0],u=h.cellSize,g=h.margin,c=h.alt,f=h.title),u=u||2,g=typeof g>\"u\"?u*4:g,c=typeof c==\"string\"?{text:c}:c||{},c.text=c.text||null,c.id=c.text?c.id||\"qrcode-description\":null,f=typeof f==\"string\"?{text:f}:f||{},f.text=f.text||null,f.id=f.text?f.id||\"qrcode-title\":null;let w=y.getModuleCount()*u+g*2,_,I,R,N,k=\"\",S;for(S=\"l\"+u+\",0 0,\"+u+\" -\"+u+\",0 0,-\"+u+\"z \",k+='<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"',k+=h.scalable?\"\":' width=\"'+w+'px\" height=\"'+w+'px\"',k+=' viewBox=\"0 0 '+w+\" \"+w+'\" ',k+=' preserveAspectRatio=\"xMinYMin meet\"',k+=f.text||c.text?' role=\"img\" aria-labelledby=\"'+V([f.id,c.id].join(\" \").trim())+'\"':\"\",k+=\">\",k+=f.text?'<title id=\"'+V(f.id)+'\">'+V(f.text)+\"</title>\":\"\",k+=c.text?'<description id=\"'+V(c.id)+'\">'+V(c.text)+\"</description>\":\"\",k+='<rect width=\"100%\" height=\"100%\" fill=\"white\" cx=\"0\" cy=\"0\"/>',k+='<path d=\"',R=0;R<y.getModuleCount();R+=1)for(N=R*u+g,_=0;_<y.getModuleCount();_+=1)y.isDark(R,_)&&(I=_*u+g,k+=\"M\"+I+\",\"+N+S);return k+='\" stroke=\"transparent\" fill=\"black\"/>',k+=\"</svg>\",k},y.createDataURL=function(u,g){u=u||2,g=typeof g>\"u\"?u*4:g;let c=y.getModuleCount()*u+g*2,f=g,h=c-g;return Je(c,c,function(w,_){if(f<=w&&w<h&&f<=_&&_<h){let I=Math.floor((w-f)/u),R=Math.floor((_-f)/u);return y.isDark(R,I)?0:1}else return 1})},y.createImgTag=function(u,g,c){u=u||2,g=typeof g>\"u\"?u*4:g;let f=y.getModuleCount()*u+g*2,h=\"\";return h+=\"<img\",h+=' src=\"',h+=y.createDataURL(u,g),h+='\"',h+=' width=\"',h+=f,h+='\"',h+=' height=\"',h+=f,h+='\"',c&&(h+=' alt=\"',h+=V(c),h+='\"'),h+=\"/>\",h};let V=function(u){let g=\"\";for(let c=0;c<u.length;c+=1){let f=u.charAt(c);switch(f){case\"<\":g+=\"<\";break;case\">\":g+=\">\";break;case\"&\":g+=\"&\";break;case'\"':g+=\""\";break;default:g+=f;break}}return g},ke=function(u){u=typeof u>\"u\"?2:u;let c=y.getModuleCount()*1+u*2,f=u,h=c-u,w,_,I,R,N,k={\"\\u2588\\u2588\":\"\\u2588\",\"\\u2588 \":\"\\u2580\",\" \\u2588\":\"\\u2584\",\" \":\" \"},S={\"\\u2588\\u2588\":\"\\u2580\",\"\\u2588 \":\"\\u2580\",\" \\u2588\":\" \",\" \":\" \"},H=\"\";for(w=0;w<c;w+=2){for(I=Math.floor((w-f)/1),R=Math.floor((w+1-f)/1),_=0;_<c;_+=1)N=\"\\u2588\",f<=_&&_<h&&f<=w&&w<h&&y.isDark(I,Math.floor((_-f)/1))&&(N=\" \"),f<=_&&_<h&&f<=w+1&&w+1<h&&y.isDark(R,Math.floor((_-f)/1))?N+=\" \":N+=\"\\u2588\",H+=u<1&&w+1>=h?S[N]:k[N];H+=`\n`}return c%2&&u>0?H.substring(0,H.length-c-1)+Array(c+1).join(\"\\u2580\"):H.substring(0,H.length-1)};return y.createASCII=function(u,g){if(u=u||1,u<2)return ke(g);u-=1,g=typeof g>\"u\"?u*2:g;let c=y.getModuleCount()*u+g*2,f=g,h=c-g,w,_,I,R,N=Array(u+1).join(\"\\u2588\\u2588\"),k=Array(u+1).join(\" \"),S=\"\",H=\"\";for(w=0;w<c;w+=1){for(I=Math.floor((w-f)/u),H=\"\",_=0;_<c;_+=1)R=1,f<=_&&_<h&&f<=w&&w<h&&y.isDark(I,Math.floor((_-f)/u))&&(R=0),H+=R?N:k;for(I=0;I<u;I+=1)S+=H+`\n`}return S.substring(0,S.length-1)},y.renderTo2dContext=function(u,g){g=g||2;let c=y.getModuleCount();for(let f=0;f<c;f++)for(let h=0;h<c;h++)u.fillStyle=y.isDark(f,h)?\"black\":\"white\",u.fillRect(h*g,f*g,g,g)},y};Q.stringToBytes=function(s){let e=[];for(let r=0;r<s.length;r+=1){let t=s.charCodeAt(r);e.push(t&255)}return e};Q.createStringToBytes=function(s,e){let r=(function(){let n=Ge(s),a=function(){let d=n.read();if(d==-1)throw\"eof\";return d},o=0,i={};for(;;){let d=n.read();if(d==-1)break;let m=a(),y=a(),p=a(),l=String.fromCharCode(d<<8|m),b=y<<8|p;i[l]=b,o+=1}if(o!=e)throw o+\" != \"+e;return i})(),t=63;return function(n){let a=[];for(let o=0;o<n.length;o+=1){let i=n.charCodeAt(o);if(i<128)a.push(i);else{let d=r[n.charAt(o)];typeof d==\"number\"?(d&255)==d?a.push(d):(a.push(d>>>8),a.push(d&255)):a.push(t)}}return a}};var M={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},te={L:1,M:0,Q:3,H:2},j={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},q=(function(){let s=[[],[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,t=21522,n={},a=function(o){let i=0;for(;o!=0;)i+=1,o>>>=1;return i};return n.getBCHTypeInfo=function(o){let i=o<<10;for(;a(i)-a(e)>=0;)i^=e<<a(i)-a(e);return(o<<10|i)^t},n.getBCHTypeNumber=function(o){let i=o<<12;for(;a(i)-a(r)>=0;)i^=r<<a(i)-a(r);return o<<12|i},n.getPatternPosition=function(o){return s[o-1]},n.getMaskFunction=function(o){switch(o){case j.PATTERN000:return function(i,d){return(i+d)%2==0};case j.PATTERN001:return function(i,d){return i%2==0};case j.PATTERN010:return function(i,d){return d%3==0};case j.PATTERN011:return function(i,d){return(i+d)%3==0};case j.PATTERN100:return function(i,d){return(Math.floor(i/2)+Math.floor(d/3))%2==0};case j.PATTERN101:return function(i,d){return i*d%2+i*d%3==0};case j.PATTERN110:return function(i,d){return(i*d%2+i*d%3)%2==0};case j.PATTERN111:return function(i,d){return(i*d%3+(i+d)%2)%2==0};default:throw\"bad maskPattern:\"+o}},n.getErrorCorrectPolynomial=function(o){let i=ne([1],0);for(let d=0;d<o;d+=1)i=i.multiply(ne([1,z.gexp(d)],0));return i},n.getLengthInBits=function(o,i){if(1<=i&&i<10)switch(o){case M.MODE_NUMBER:return 10;case M.MODE_ALPHA_NUM:return 9;case M.MODE_8BIT_BYTE:return 8;case M.MODE_KANJI:return 8;default:throw\"mode:\"+o}else if(i<27)switch(o){case M.MODE_NUMBER:return 12;case M.MODE_ALPHA_NUM:return 11;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 10;default:throw\"mode:\"+o}else if(i<41)switch(o){case M.MODE_NUMBER:return 14;case M.MODE_ALPHA_NUM:return 13;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 12;default:throw\"mode:\"+o}else throw\"type:\"+i},n.getLostPoint=function(o){let i=o.getModuleCount(),d=0;for(let p=0;p<i;p+=1)for(let l=0;l<i;l+=1){let b=0,T=o.isDark(p,l);for(let v=-1;v<=1;v+=1)if(!(p+v<0||i<=p+v))for(let x=-1;x<=1;x+=1)l+x<0||i<=l+x||v==0&&x==0||T==o.isDark(p+v,l+x)&&(b+=1);b>5&&(d+=3+b-5)}for(let p=0;p<i-1;p+=1)for(let l=0;l<i-1;l+=1){let b=0;o.isDark(p,l)&&(b+=1),o.isDark(p+1,l)&&(b+=1),o.isDark(p,l+1)&&(b+=1),o.isDark(p+1,l+1)&&(b+=1),(b==0||b==4)&&(d+=3)}for(let p=0;p<i;p+=1)for(let l=0;l<i-6;l+=1)o.isDark(p,l)&&!o.isDark(p,l+1)&&o.isDark(p,l+2)&&o.isDark(p,l+3)&&o.isDark(p,l+4)&&!o.isDark(p,l+5)&&o.isDark(p,l+6)&&(d+=40);for(let p=0;p<i;p+=1)for(let l=0;l<i-6;l+=1)o.isDark(l,p)&&!o.isDark(l+1,p)&&o.isDark(l+2,p)&&o.isDark(l+3,p)&&o.isDark(l+4,p)&&!o.isDark(l+5,p)&&o.isDark(l+6,p)&&(d+=40);let m=0;for(let p=0;p<i;p+=1)for(let l=0;l<i;l+=1)o.isDark(l,p)&&(m+=1);let y=Math.abs(100*m/i/i-50)/5;return d+=y*10,d},n})(),z=(function(){let s=new Array(256),e=new Array(256);for(let t=0;t<8;t+=1)s[t]=1<<t;for(let t=8;t<256;t+=1)s[t]=s[t-4]^s[t-5]^s[t-6]^s[t-8];for(let t=0;t<255;t+=1)e[s[t]]=t;let r={};return r.glog=function(t){if(t<1)throw\"glog(\"+t+\")\";return e[t]},r.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return s[t]},r})(),ne=function(s,e){if(typeof s.length>\"u\")throw s.length+\"/\"+e;let r=(function(){let n=0;for(;n<s.length&&s[n]==0;)n+=1;let a=new Array(s.length-n+e);for(let o=0;o<s.length-n;o+=1)a[o]=s[o+n];return a})(),t={};return t.getAt=function(n){return r[n]},t.getLength=function(){return r.length},t.multiply=function(n){let a=new Array(t.getLength()+n.getLength()-1);for(let o=0;o<t.getLength();o+=1)for(let i=0;i<n.getLength();i+=1)a[o+i]^=z.gexp(z.glog(t.getAt(o))+z.glog(n.getAt(i)));return ne(a,0)},t.mod=function(n){if(t.getLength()-n.getLength()<0)return t;let a=z.glog(t.getAt(0))-z.glog(n.getAt(0)),o=new Array(t.getLength());for(let i=0;i<t.getLength();i+=1)o[i]=t.getAt(i);for(let i=0;i<n.getLength();i+=1)o[i]^=z.gexp(z.glog(n.getAt(i))+a);return ne(o,0).mod(n)},t},xe=(function(){let s=[[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(n,a){let o={};return o.totalCount=n,o.dataCount=a,o},r={},t=function(n,a){switch(a){case te.L:return s[(n-1)*4+0];case te.M:return s[(n-1)*4+1];case te.Q:return s[(n-1)*4+2];case te.H:return s[(n-1)*4+3];default:return}};return r.getRSBlocks=function(n,a){let o=t(n,a);if(typeof o>\"u\")throw\"bad rs block @ typeNumber:\"+n+\"/errorCorrectionLevel:\"+a;let i=o.length/3,d=[];for(let m=0;m<i;m+=1){let y=o[m*3+0],p=o[m*3+1],l=o[m*3+2];for(let b=0;b<y;b+=1)d.push(e(p,l))}return d},r})(),Ee=function(){let s=[],e=0,r={};return r.getBuffer=function(){return s},r.getAt=function(t){let n=Math.floor(t/8);return(s[n]>>>7-t%8&1)==1},r.put=function(t,n){for(let a=0;a<n;a+=1)r.putBit((t>>>n-a-1&1)==1)},r.getLengthInBits=function(){return e},r.putBit=function(t){let n=Math.floor(e/8);s.length<=n&&s.push(0),t&&(s[n]|=128>>>e%8),e+=1},r},We=function(s){let e=M.MODE_NUMBER,r=s,t={};t.getMode=function(){return e},t.getLength=function(o){return r.length},t.write=function(o){let i=r,d=0;for(;d+2<i.length;)o.put(n(i.substring(d,d+3)),10),d+=3;d<i.length&&(i.length-d==1?o.put(n(i.substring(d,d+1)),4):i.length-d==2&&o.put(n(i.substring(d,d+2)),7))};let n=function(o){let i=0;for(let d=0;d<o.length;d+=1)i=i*10+a(o.charAt(d));return i},a=function(o){if(\"0\"<=o&&o<=\"9\")return o.charCodeAt(0)-48;throw\"illegal char :\"+o};return t},je=function(s){let e=M.MODE_ALPHA_NUM,r=s,t={};t.getMode=function(){return e},t.getLength=function(a){return r.length},t.write=function(a){let o=r,i=0;for(;i+1<o.length;)a.put(n(o.charAt(i))*45+n(o.charAt(i+1)),11),i+=2;i<o.length&&a.put(n(o.charAt(i)),6)};let n=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 t},qe=function(s){let e=M.MODE_8BIT_BYTE,r=s,t=Q.stringToBytes(s),n={};return n.getMode=function(){return e},n.getLength=function(a){return t.length},n.write=function(a){for(let o=0;o<t.length;o+=1)a.put(t[o],8)},n},ze=function(s){let e=M.MODE_KANJI,r=s,t=Q.stringToBytes;(function(o,i){let d=t(o);if(d.length!=2||(d[0]<<8|d[1])!=i)throw\"sjis not supported.\"})(\"\\u53CB\",38726);let n=t(s),a={};return a.getMode=function(){return e},a.getLength=function(o){return~~(n.length/2)},a.write=function(o){let i=n,d=0;for(;d+1<i.length;){let m=(255&i[d])<<8|255&i[d+1];if(33088<=m&&m<=40956)m-=33088;else if(57408<=m&&m<=60351)m-=49472;else throw\"illegal char at \"+(d+1)+\"/\"+m;m=(m>>>8&255)*192+(m&255),o.put(m,13),d+=2}if(d<i.length)throw\"illegal char at \"+(d+1)},a},_e=function(){let s=[],e={};return e.writeByte=function(r){s.push(r&255)},e.writeShort=function(r){e.writeByte(r),e.writeByte(r>>>8)},e.writeBytes=function(r,t,n){t=t||0,n=n||r.length;for(let a=0;a<n;a+=1)e.writeByte(r[a+t])},e.writeString=function(r){for(let t=0;t<r.length;t+=1)e.writeByte(r.charCodeAt(t))},e.toByteArray=function(){return s},e.toString=function(){let r=\"\";r+=\"[\";for(let t=0;t<s.length;t+=1)t>0&&(r+=\",\"),r+=s[t];return r+=\"]\",r},e},Ye=function(){let s=0,e=0,r=0,t=\"\",n={},a=function(i){t+=String.fromCharCode(o(i&63))},o=function(i){if(i<0)throw\"n:\"+i;if(i<26)return 65+i;if(i<52)return 97+(i-26);if(i<62)return 48+(i-52);if(i==62)return 43;if(i==63)return 47;throw\"n:\"+i};return n.writeByte=function(i){for(s=s<<8|i&255,e+=8,r+=1;e>=6;)a(s>>>e-6),e-=6},n.flush=function(){if(e>0&&(a(s<<6-e),s=0,e=0),r%3!=0){let i=3-r%3;for(let d=0;d<i;d+=1)t+=\"=\"}},n.toString=function(){return t},n},Ge=function(s){let e=s,r=0,t=0,n=0,a={};a.read=function(){for(;n<8;){if(r>=e.length){if(n==0)return-1;throw\"unexpected end of file./\"+n}let d=e.charAt(r);if(r+=1,d==\"=\")return n=0,-1;if(d.match(/^\\s$/))continue;t=t<<6|o(d.charCodeAt(0)),n+=6}let i=t>>>n-8&255;return n-=8,i};let o=function(i){if(65<=i&&i<=90)return i-65;if(97<=i&&i<=122)return i-97+26;if(48<=i&&i<=57)return i-48+52;if(i==43)return 62;if(i==47)return 63;throw\"c:\"+i};return a},Qe=function(s,e){let r=s,t=e,n=new Array(s*e),a={};a.setPixel=function(m,y,p){n[y*r+m]=p},a.write=function(m){m.writeString(\"GIF87a\"),m.writeShort(r),m.writeShort(t),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(\",\"),m.writeShort(0),m.writeShort(0),m.writeShort(r),m.writeShort(t),m.writeByte(0);let y=2,p=i(y);m.writeByte(y);let l=0;for(;p.length-l>255;)m.writeByte(255),m.writeBytes(p,l,255),l+=255;m.writeByte(p.length-l),m.writeBytes(p,l,p.length-l),m.writeByte(0),m.writeString(\";\")};let o=function(m){let y=m,p=0,l=0,b={};return b.write=function(T,v){if(T>>>v)throw\"length over\";for(;p+v>=8;)y.writeByte(255&(T<<p|l)),v-=8-p,T>>>=8-p,l=0,p=0;l=T<<p|l,p=p+v},b.flush=function(){p>0&&y.writeByte(l)},b},i=function(m){let y=1<<m,p=(1<<m)+1,l=m+1,b=d();for(let D=0;D<y;D+=1)b.add(String.fromCharCode(D));b.add(String.fromCharCode(y)),b.add(String.fromCharCode(p));let T=_e(),v=o(T);v.write(y,l);let x=0,A=String.fromCharCode(n[x]);for(x+=1;x<n.length;){let D=String.fromCharCode(n[x]);x+=1,b.contains(A+D)?A=A+D:(v.write(b.indexOf(A),l),b.size()<4095&&(b.size()==1<<l&&(l+=1),b.add(A+D)),A=D)}return v.write(b.indexOf(A),l),v.write(p,l),v.flush(),T.toByteArray()},d=function(){let m={},y=0,p={};return p.add=function(l){if(p.contains(l))throw\"dup key:\"+l;m[l]=y,y+=1},p.size=function(){return y},p.indexOf=function(l){return m[l]},p.contains=function(l){return typeof m[l]<\"u\"},p};return a},Je=function(s,e,r){let t=Qe(s,e);for(let i=0;i<e;i+=1)for(let d=0;d<s;d+=1)t.setPixel(d,i,r(d,i));let n=_e();t.write(n);let a=Ye(),o=n.toByteArray();for(let i=0;i<o.length;i+=1)a.writeByte(o[i]);return a.flush(),\"data:image/gif;base64,\"+a},Xe=Q,ln=Q.stringToBytes;function Ze(s,e,r=200){ue(s);let t=document.createElement(\"canvas\"),n=t.getContext?.(\"2d\")??null;if(!n){let p=document.createElement(\"a\");p.href=e,p.textContent=\"Open in DID Wallet\",p.target=\"_blank\",p.rel=\"noopener\",s.appendChild(p);return}let a=Xe(0,\"M\");a.addData(e),a.make();let o=a.getModuleCount(),i=Math.floor(r/o),d=i*o;t.width=d,t.height=d,t.style.display=\"block\",t.style.width=`${r}px`,t.style.height=`${r}px`,t.style.imageRendering=\"pixelated\";let m=\"#e8e8e8\";n.fillStyle=m,n.fillRect(0,0,d,d),n.fillStyle=\"#000000\";for(let p=0;p<o;p++)for(let l=0;l<o;l++)a.isDark(p,l)&&n.fillRect(l*i,p*i,i,i);let y=document.createElement(\"div\");y.style.cssText=\"display:inline-block;padding:10px;background:#e8e8e8;border-radius:8px;line-height:0\",y.appendChild(t),s.appendChild(y)}function ue(s){s.innerHTML=\"\"}var et=`\n${Se}\n${Ne}\n${Be}\n\n/* Layout */\nbody {\n min-height: 100vh;\n display: flex;\n align-items: center;\n justify-content: center;\n background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.08) 0%, transparent 60%);\n}\n\n/* Card \\u2014 fixed width prevents shrinking when views switch */\n.card {\n background: var(--bg-card);\n border: 1px solid var(--border);\n border-radius: var(--radius-lg);\n padding: 48px 40px;\n width: min(400px, calc(100vw - 32px));\n text-align: center;\n box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.15);\n}\n\n/* Brand header */\n.brand-header { margin-bottom: 24px; }\n.app-logo {\n width: 48px;\n height: 48px;\n border-radius: var(--radius-sm);\n object-fit: contain;\n margin-bottom: 16px;\n}\nh1 {\n font-size: 24px;\n font-weight: 600;\n margin-bottom: 8px;\n color: var(--text-white);\n letter-spacing: -0.01em;\n line-height: 1.25;\n}\n.subtitle {\n font-size: 14px;\n color: var(--text-secondary);\n margin-bottom: 0;\n line-height: 1.5;\n}\n.federated-hint {\n font-size: 12px;\n color: var(--text-secondary);\n margin-top: 6px;\n margin-bottom: 0;\n opacity: 0.7;\n}\n\n/* Input */\n.input {\n width: 100%;\n height: 36px;\n padding: 0 12px;\n font-size: 14px;\n color: var(--text);\n background: var(--bg-input);\n border: 1px solid var(--border-strong);\n border-radius: var(--radius-sm);\n outline: none;\n margin-bottom: 16px;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.input:focus { border-color: var(--blue); box-shadow: var(--shadow-focus); }\n.input::placeholder { color: var(--text-placeholder); }\n\n/* Button */\n.btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n width: 100%;\n height: 36px;\n padding: 0 16px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background: var(--blue);\n border: none;\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;\n line-height: 1;\n}\n.btn:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(108,71,255,0.3); }\n.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; transform: none; box-shadow: none; }\n.btn:focus-visible { box-shadow: var(--shadow-focus); }\n.btn svg { width: 18px; height: 18px; flex-shrink: 0; }\n.btn-secondary {\n background: transparent;\n border: 1px solid var(--border-strong);\n color: var(--text);\n}\n.btn-secondary:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.20); }\n\n/* Status */\n.status {\n margin-top: 16px;\n font-size: 13px;\n min-height: 20px;\n color: var(--text-secondary);\n}\n.status.error { color: var(--red-text); }\n\n/* Name row (passkey registration) */\n.name-row { display: none; }\n.name-row.visible { display: block; }\n\n/* Passkey section + secondary text action (\"First time? Create a passkey\") */\n.passkey-section > .btn + .passkey-alt,\n.passkey-section > .name-row + .btn { margin-top: 10px; }\n.passkey-alt {\n display: block;\n width: 100%;\n margin-top: 10px;\n padding: 4px;\n background: none;\n border: none;\n font-size: 13px;\n color: var(--text-secondary);\n cursor: pointer;\n text-align: center;\n transition: color 0.15s ease;\n}\n.passkey-alt:hover { color: var(--text); text-decoration: underline; }\n.passkey-alt:focus-visible { box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); outline: none; }\n\n/* Divider */\n.divider {\n display: flex;\n align-items: center;\n margin: 20px 0;\n color: var(--text-secondary);\n font-size: 13px;\n}\n.divider::before, .divider::after {\n content: '';\n flex: 1;\n border-bottom: 1px solid var(--border);\n}\n.divider::before { margin-right: 12px; }\n.divider::after { margin-left: 12px; }\n\n/* DID Wallet section (methods view) */\n.did-wallet-section { margin-top: 8px; }\n\n/* QR view */\n.qr-view {\n position: relative;\n margin: 20px auto;\n display: flex;\n justify-content: center;\n min-height: 220px;\n align-items: center;\n}\n.qr-placeholder {\n width: 220px;\n height: 220px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--border-subtle);\n border-radius: var(--radius);\n background: var(--bg-elevated);\n}\n.qr-spinner {\n display: inline-block;\n width: 32px; height: 32px;\n border: 3px solid var(--border-strong);\n border-top-color: var(--blue-muted);\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n}\n#did-connect-status {\n font-size: 13px;\n color: var(--text-secondary);\n}\n\n/* Connect result state */\n.connect-result {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 120px;\n margin: 32px 0;\n animation: fadeIn 200ms ease-out;\n}\n.result-icon {\n width: 64px;\n height: 64px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 28px;\n font-weight: bold;\n}\n.result-error {\n background: rgba(239, 68, 68, 0.15);\n color: var(--red-text);\n border: 2px solid rgba(239, 68, 68, 0.3);\n}\n.result-loading {\n background: transparent;\n}\n.result-loading .qr-spinner {\n width: 36px;\n height: 36px;\n}\n.result-back-btn {\n margin-top: 16px;\n}\n@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }\n\n/* QR timeout overlay */\n.qr-timeout-overlay {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n background: rgba(0, 0, 0, 0.65);\n border-radius: var(--radius);\n backdrop-filter: blur(2px);\n}\n.qr-timeout-overlay .timeout-text {\n font-size: 13px;\n color: #fff;\n}\n.qr-timeout-overlay .refresh-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 6px 20px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background: var(--blue);\n border: none;\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease;\n}\n.qr-timeout-overlay .refresh-btn:hover {\n background: var(--blue-hover);\n}\n/* Connect status views (scanned / success) */\n.connect-status-icon {\n position: relative;\n width: 72px;\n height: 72px;\n margin: 16px auto;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n@keyframes connectSpin { to { transform: rotate(360deg); } }\n.connect-spinner-ring {\n position: absolute;\n inset: 0;\n width: 72px;\n height: 72px;\n border-radius: 50%;\n border: 3px solid rgba(255,255,255,0.1);\n border-top-color: var(--blue, #6c47ff);\n animation: connectSpin 0.8s linear infinite;\n}\n.connect-status-badge {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n}\n.connect-status-badge svg { width: 36px; height: 36px; }\n.connect-status-icon.connect-success svg { animation: fadeIn 0.3s ease; }\n.connect-subtitle {\n font-size: 13px;\n color: var(--text-secondary, #9394a1);\n text-align: center;\n margin: 4px 0 0;\n}\n.status.success { color: #49dc6e; font-weight: 500; }\n.deep-link-btn {\n margin-top: 12px;\n text-decoration: none;\n}\n\n/* Email section (methods view) */\n.email-section { margin-top: 8px; }\n\n/* Back button */\n.back-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n color: var(--text-secondary);\n font-size: 14px;\n cursor: pointer;\n padding: 0;\n margin-bottom: 16px;\n float: left;\n}\n.back-btn:hover { color: var(--text); }\n.back-btn svg { width: 18px; height: 18px; }\n\n/* View title */\n.view-title {\n font-size: 20px;\n font-weight: 600;\n color: var(--text-white);\n margin-bottom: 8px;\n clear: both;\n padding-top: 8px;\n}\n\n/* OAuth section \\u2014 single provider (legacy) */\n.oauth-section { margin-top: 0; }\n\n/* OAuth grid \\u2014 2+ providers in 2-column layout (legacy) */\n.oauth-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n margin-bottom: 8px;\n}\n.oauth-grid .oauth-btn:last-child:nth-child(odd) {\n grid-column: 1 / -1;\n}\n\n/* Unified secondary methods grid \\u2014 2-column layout */\n.methods-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n}\n/* Odd last child (e.g. DID Wallet when total is odd) spans full width */\n.methods-grid .method-btn:last-child:nth-child(odd) {\n grid-column: 1 / -1;\n}\n\n.method-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n min-height: 36px;\n padding: 6px 16px;\n font-size: 14px;\n font-weight: 500;\n color: var(--text);\n background: var(--bg-card);\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;\n white-space: normal;\n}\n.method-btn:hover { background: var(--bg-hover); }\n.method-btn:disabled { cursor: default; pointer-events: none; }\n.method-btn svg { width: 18px; height: 18px; flex-shrink: 0; }\n\n.oauth-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n height: 36px;\n padding: 0 16px;\n font-size: 14px;\n font-weight: 500;\n color: var(--text);\n background: var(--bg-card);\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;\n margin-bottom: 0;\n}\n.oauth-section .oauth-btn { margin-bottom: 8px; }\n.oauth-btn:hover { background: var(--bg-hover); }\n.oauth-btn:disabled { cursor: default; pointer-events: none; }\n.oauth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }\n.oauth-btn-loading {\n opacity: 0.8;\n border-color: var(--blue);\n color: var(--text-secondary);\n}\n@keyframes oauth-spin { to { transform: rotate(360deg); } }\n.oauth-spinner {\n display: inline-block;\n width: 14px; height: 14px;\n border: 2px solid var(--border-strong);\n border-top-color: var(--blue-muted);\n border-radius: 50%;\n animation: oauth-spin 0.6s linear infinite;\n}\n.oauth-check { color: var(--green-text); font-size: 16px; }\n\n/* Browser compatibility warning */\n.compat-warning {\n font-size: 13px;\n color: var(--text-tertiary);\n padding: 12px;\n background: var(--bg-elevated);\n border-radius: var(--radius-sm);\n margin-bottom: 16px;\n}\n\n/* Trust footer */\n.login-footer {\n margin-top: 24px;\n padding-top: 20px;\n border-top: 1px solid var(--border);\n}\n.secured-badge {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n font-size: 12px;\n color: var(--text-tertiary);\n}\n.secured-badge svg { width: 14px; height: 14px; flex-shrink: 0; }\n.footer-links {\n margin-top: 8px;\n font-size: 12px;\n color: var(--text-tertiary);\n}\n.footer-links a {\n color: var(--text-secondary);\n text-decoration: none;\n}\n.footer-links a:hover { text-decoration: underline; }\n\n/* \\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 */\n@keyframes fadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes fadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n.card[data-view] { animation: fadeIn 200ms ease-out; }\n\n/* QR code scale-in */\n.qr-view { animation: qrScaleIn 300ms ease-out; }\n@keyframes qrScaleIn {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n}\n\n/* Button loading spinner */\n@keyframes spin { to { transform: rotate(360deg); } }\n.btn-spinner {\n display: inline-block;\n width: 16px; height: 16px;\n border: 2px solid rgba(255,255,255,0.3);\n border-top-color: #fff;\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n}\n\n/* Success checkmark */\n@keyframes checkDraw {\n from { stroke-dashoffset: 24; }\n to { stroke-dashoffset: 0; }\n}\n.success-check {\n display: inline-block;\n width: 20px; height: 20px;\n vertical-align: middle;\n}\n.success-check path {\n stroke-dasharray: 24;\n stroke-dashoffset: 24;\n animation: checkDraw 400ms ease-out forwards;\n}\n\n/* Light theme background gradient adjustment */\n[data-theme=\"light\"] body {\n background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.05) 0%, transparent 60%);\n}\n[data-theme=\"light\"] .card {\n box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.08);\n}\n[data-theme=\"light\"] .btn:hover {\n box-shadow: 0 2px 8px rgba(108,71,255,0.15);\n}\n\n/* Language switcher */\n.locale-switcher {\n position: absolute;\n top: 16px;\n right: 16px;\n}\n.locale-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 10px;\n font-size: 12px;\n color: var(--text-secondary);\n background: var(--bg-elevated);\n border: 1px solid var(--border-subtle);\n border-radius: var(--radius-full);\n cursor: pointer;\n transition: color 0.15s, border-color 0.15s;\n}\n.locale-btn:hover {\n color: var(--text);\n border-color: var(--border-strong);\n}\n.locale-btn svg { width: 14px; height: 14px; flex-shrink: 0; }\n.card { position: relative; }\n`;function Y(s){let e=new Uint8Array(s),r=\"\";for(let t=0;t<e.length;t++)r+=String.fromCharCode(e[t]);return btoa(r).replace(/\\+/g,\"-\").replace(/\\//g,\"_\").replace(/=+$/,\"\")}function ee(s){let e=s.replace(/-/g,\"+\").replace(/_/g,\"/\"),r=atob(e),t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t.buffer}function tt(s){let e=s.response;return{id:s.id,rawId:Y(s.rawId),type:s.type,response:{attestationObject:Y(e.attestationObject),clientDataJSON:Y(e.clientDataJSON)},clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:s.authenticatorAttachment}}function nt(s){let e=s.response;return{id:s.id,rawId:Y(s.rawId),type:s.type,response:{authenticatorData:Y(e.authenticatorData),clientDataJSON:Y(e.clientDataJSON),signature:Y(e.signature),userHandle:e.userHandle?Y(e.userHandle):void 0},clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:s.authenticatorAttachment}}async function se(s){let e=s.prefix||\"/.well-known/service/api/passkey\",r=s.onStatus||(()=>{}),t=s.authOnly||!1,n=s.registerOnly||!1,a=s.invitationId||void 0,o=s.texts||{},i=o.waiting||\"Waiting for passkey...\",d=o.creating||\"Creating your passkey...\",m=o.verifying||\"Verifying...\";async function y(){let x=await fetch(`${e}/auth`,{method:\"GET\"});if(!x.ok)throw new Error(\"Failed to get auth challenge\");return x.json()}async function p(x){let A=[];x&&A.push(`name=${encodeURIComponent(x)}`),a&&A.push(`invitationId=${encodeURIComponent(a)}`);let D=A.length?`?${A.join(\"&\")}`:\"\",$=await fetch(`${e}/register${D}`,{method:\"GET\"});if(!$.ok)throw new Error(\"Failed to get register challenge\");return $.json()}function l(x,A){let D=new Error(x);throw A&&(D.code=A),D}async function b(x,A){let D=await fetch(`${e}/auth`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({challengeId:x,credential:A})});if(!D.ok){let $=await D.json().catch(()=>({}));l($.error||\"Authentication failed\",$.code)}return D.json()}async function T(x,A,D){let $=await fetch(`${e}/register`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({challengeId:x,credential:A,name:D||void 0})});if(!$.ok){let U=await $.json().catch(()=>({}));l(U.error||\"Registration failed\",U.code)}return $.json()}if(!n){r(i,!1);try{let x=await y(),{challengeId:A}=x,D=x.authentication||x,$={publicKey:{...D,challenge:ee(D.challenge),allowCredentials:(D.allowCredentials||[]).map(V=>({...V,id:ee(V.id)}))}},U;try{U=await navigator.credentials.get($)}catch{if(t)return{success:!1,error:\"no_passkey\"}}if(U){let V=nt(U);return r(m,!1),await b(A,V),{success:!0}}}catch(x){let A=x instanceof Error?x.message:\"Authentication failed\",D=x instanceof Error?x.code:void 0;return r(A,!0),{success:!1,error:A,code:D}}}let v=await p(s.name||\"\");if(v.registrationAllowed===!1)return r(\"Registration requires an invitation.\",!0),{success:!1,error:\"registration_closed\"};r(d,!1);try{let x=v.registration||v,A={publicKey:{...x,challenge:ee(x.challenge),user:{...x.user,id:ee(x.user.id)},excludeCredentials:(x.excludeCredentials||[]).map(U=>({...U,id:ee(U.id)}))}},D=await navigator.credentials.create(A),$=tt(D);return r(m,!1),await T(v.challengeId,$,s.name||\"\"),{success:!0}}catch(x){let A=x instanceof Error?x.message:\"Passkey setup failed\",D=x instanceof Error?x.code:void 0;return r(A,!0),{success:!1,error:A,code:D}}}function G(s,e){let r=s instanceof Error?s.message:\"\",t=s instanceof Error&&\"code\"in s?s.code:\"\";return t===\"FORBIDDEN\"?E(\"accessDenied\",e):r===\"registration_closed\"||t===\"registration_closed\"?E(\"regClosed\",e):r||E(\"authFailed\",e)}var rt=\"https://web.abtwallet.io/\";function st(){return typeof navigator>\"u\"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function ot(){return typeof window>\"u\"?null:window.ABT_DEV??window.ABT??null}function K(s){return s.replace(/&/g,\"&\").replace(/</g,\"<\").replace(/>/g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\")}var ve=class{container;config;http;options;tokenSession=null;styleEl=null;mounted=!1;currentView=\"methods\";cardEl=null;mediaQuery=null;mediaListener=null;constructor(s,e,r,t){if(this.container=s,this.config=e,this.http=r,this.options={methods:[\"passkey\",\"did-connect\"],locale:\"en\",...t},!this.options.invitationId&&typeof document<\"u\"){let n=document.cookie.match(/(?:^|;\\s*)pending_invitation=([^;]*)/);if(n)try{this.options.invitationId=decodeURIComponent(n[1])}catch{}}}mount(){if(this.mounted)return;this.mounted=!0,this.styleEl=document.createElement(\"style\"),this.styleEl.textContent=et,this.container.appendChild(this.styleEl),this.applyTheme();let s=this.filterMethods(this.options.methods);this.renderCard(s)}destroy(){this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.mediaQuery&&this.mediaListener&&(this.mediaQuery.removeEventListener(\"change\",this.mediaListener),this.mediaQuery=null,this.mediaListener=null),document.documentElement.removeAttribute(\"data-theme\"),this.container.innerHTML=\"\",this.styleEl=null,this.cardEl=null,this.currentView=\"methods\",this.mounted=!1}update(s){Object.assign(this.options,s),this.mounted&&(this.destroy(),this.mount())}applyTheme(){let s=this.options.theme??\"dark\";if(s===\"light\")document.documentElement.dataset.theme=\"light\";else if(s===\"auto\"&&typeof window.matchMedia==\"function\"){let e=window.matchMedia(\"(prefers-color-scheme: light)\");this.mediaQuery=e;let r=t=>{t?document.documentElement.dataset.theme=\"light\":document.documentElement.removeAttribute(\"data-theme\")};r(e.matches),this.mediaListener=t=>r(t.matches),e.addEventListener(\"change\",this.mediaListener)}}filterMethods(s){return s.filter(e=>e===\"passkey\"?typeof window<\"u\"&&window.PublicKeyCredential!==void 0&&typeof window.PublicKeyCredential==\"function\":!0)}renderCard(s){let e=document.createElement(\"div\");e.className=\"card\",this.cardEl=e,this.container.appendChild(e),this.renderLocaleSwitcher(e),this.switchView(\"methods\",s)}renderLocaleSwitcher(s){if(ce.length<2)return;let e=document.createElement(\"div\");e.className=\"locale-switcher\";let r=this.options.locale,t=ce.find(a=>a.code!==r)??ce[0],n=document.createElement(\"button\");n.type=\"button\",n.className=\"locale-btn\",n.innerHTML=`${Ke} ${K(t.label)}`,n.title=t.label,n.addEventListener(\"click\",()=>{this.update({locale:t.code})}),e.appendChild(n),s.appendChild(e)}switchView(s,e){if(!this.cardEl)return;let r=this.options.locale;switch(this.currentView===\"qr\"&&s!==\"qr\"&&this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.currentView=s,this.cardEl.innerHTML=\"\",this.cardEl.dataset.view=s,s){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}}renderMethodsView(s,e,r){this.renderBrandHeader(s,e);let t=this.options.methods.includes(\"passkey\");if(t&&!r.includes(\"passkey\")){let o=document.createElement(\"div\");o.className=\"compat-warning\",o.textContent=E(\"passkeyUnsupported\",e),s.appendChild(o)}let n=r.includes(\"passkey\");n&&this.renderPasskeySection(s,e);let a=r.filter(o=>o!==\"passkey\");if(n&&a.length>0&&this.renderDivider(s,e),a.length>0&&this.renderSecondaryGrid(s,e,r),r.length===0&&!t){let o=document.createElement(\"p\");o.className=\"subtitle\",o.textContent=\"No authentication methods available.\",s.appendChild(o)}this.renderTrustFooter(s,e)}renderQRView(s,e){this.renderBackButton(s,e);let r=document.createElement(\"h2\");r.className=\"view-title\",r.textContent=E(\"scanTitle\",e),s.appendChild(r);let t=document.createElement(\"div\");t.id=\"did-connect-qr\",t.className=\"qr-view\",t.innerHTML='<div class=\"qr-placeholder\"><span class=\"qr-spinner\"></span></div>',s.appendChild(t);let n=document.createElement(\"button\");n.className=\"btn btn-secondary deep-link-btn\",n.id=\"did-wallet-open-btn\",n.textContent=E(\"openInWallet\",e),n.disabled=!0,s.appendChild(n);let a=document.createElement(\"div\");a.id=\"did-connect-status\",a.className=\"status\",s.appendChild(a),this.renderTrustFooter(s,e),this.startDIDConnectInView(a,t,n,e)}renderEmailView(s,e){this.renderBackButton(s,e);let r=document.createElement(\"h2\");r.className=\"view-title\",r.textContent=E(\"emailTitle\",e),s.appendChild(r);let t=document.createElement(\"input\");t.className=\"input\",t.type=\"email\",t.placeholder=E(\"emailPlaceholder\",e),s.appendChild(t);let n=document.createElement(\"button\");n.className=\"btn\",n.textContent=E(\"emailSubmit\",e),s.appendChild(n);let a=document.createElement(\"div\");a.className=\"status\",s.appendChild(a);let o=document.createElement(\"div\");o.className=\"email-code-section\",o.style.display=\"none\";let i=document.createElement(\"input\");i.className=\"input\",i.type=\"text\",i.inputMode=\"numeric\",i.maxLength=6,i.autocomplete=\"one-time-code\",i.placeholder=E(\"emailCodePlaceholder\",e),o.appendChild(i);let d=document.createElement(\"button\");d.className=\"btn\",d.textContent=E(\"emailVerify\",e),o.appendChild(d);let m=document.createElement(\"button\");m.className=\"btn btn-secondary\",m.textContent=E(\"emailResend\",e),m.style.marginTop=\"8px\",o.appendChild(m),s.insertBefore(o,a),this.renderTrustFooter(s,e);let y=\"\",p=this.config.servicePrefix??\"/.well-known/service\",l=async()=>{let T=t.value.trim();if(!T?.includes(\"@\")){a.textContent=E(\"emailInvalid\",e),a.className=\"status error\";return}n.disabled=!0,a.textContent=E(\"emailSending\",e),a.className=\"status\";try{await this.http.post(`${p}/api/email/sendCode`,{email:T}),y=T,t.style.display=\"none\",n.style.display=\"none\",o.style.display=\"\",r.textContent=E(\"emailVerify\",e),a.textContent=E(\"emailSent\",e,{email:T}),a.className=\"status\",i.focus()}catch(v){let x=v instanceof Error?v.message:\"Failed to send email\";a.textContent=x,a.className=\"status error\",n.disabled=!1}},b=async()=>{let T=i.value.trim();if(!T||T.length!==6){a.textContent=E(\"emailCodeInvalid\",e),a.className=\"status error\";return}d.disabled=!0,a.textContent=E(\"verifying\",e),a.className=\"status\";try{await this.http.post(`${p}/api/email/login`,{code:T}),a.textContent=E(\"success\",e),a.className=\"status\",this.handleSuccess()}catch(v){v instanceof Error&&\"code\"in v&&v.code===\"FORBIDDEN\"?this.showFullError(G(v,e)):(a.textContent=G(v,e),a.className=\"status error\",d.disabled=!1,i.value=\"\",i.focus())}};n.addEventListener(\"click\",l),t.addEventListener(\"keydown\",T=>{T.key===\"Enter\"&&l()}),d.addEventListener(\"click\",b),i.addEventListener(\"keydown\",T=>{T.key===\"Enter\"&&b()}),m.addEventListener(\"click\",async()=>{m.disabled=!0,a.textContent=E(\"emailSending\",e),a.className=\"status\";try{await this.http.post(`${p}/api/email/sendCode`,{email:y}),a.textContent=E(\"emailSent\",e,{email:y}),a.className=\"status\"}catch(T){let v=T instanceof Error?T.message:\"Failed to resend\";a.textContent=v,a.className=\"status error\"}m.disabled=!1})}renderBackButton(s,e){let r=document.createElement(\"button\");r.className=\"back-btn\",r.innerHTML=`${Ue} ${K(E(\"back\",e))}`,r.addEventListener(\"click\",()=>this.switchView(\"methods\")),s.appendChild(r)}renderBrandHeader(s,e){let r=document.createElement(\"div\");if(r.className=\"brand-header\",this.options.appLogo){let a=document.createElement(\"img\");a.className=\"app-logo\",a.src=K(this.options.appLogo),a.alt=this.options.appName?K(this.options.appName):\"\",a.width=48,a.height=48,r.appendChild(a)}let t=document.createElement(\"h1\");this.options.appName?t.textContent=E(\"signInTo\",e,{appName:this.options.appName}):t.textContent=E(\"signIn\",e),r.appendChild(t);let n=document.createElement(\"p\");this.options.masterAppName?(n.className=\"federated-hint\",n.textContent=E(\"federatedBy\",e,{masterName:this.options.masterAppName})):(n.className=\"subtitle\",n.textContent=E(\"subtitle\",e)),r.appendChild(n),s.appendChild(r)}renderTrustFooter(s,e){let r=document.createElement(\"div\");r.className=\"login-footer\";let t=document.createElement(\"div\");t.className=\"secured-badge\",t.innerHTML=`${Fe} ${K(E(\"securedBy\",e))}`,r.appendChild(t);let{privacyUrl:n,termsUrl:a}=this.options;if(n||a){let o=document.createElement(\"div\");if(o.className=\"footer-links\",n){let i=document.createElement(\"a\");i.href=n,i.target=\"_blank\",i.rel=\"noopener noreferrer\",i.textContent=E(\"privacy\",e),o.appendChild(i)}if(n&&a&&o.appendChild(document.createTextNode(\" \\xB7 \")),a){let i=document.createElement(\"a\");i.href=a,i.target=\"_blank\",i.rel=\"noopener noreferrer\",i.textContent=E(\"terms\",e),o.appendChild(i)}r.appendChild(o)}s.appendChild(r)}renderDivider(s,e){let r=document.createElement(\"div\");r.className=\"divider\",r.textContent=E(\"or\",e),s.appendChild(r)}renderPasskeySection(s,e){let r=document.createElement(\"div\");r.className=\"passkey-section\",s.appendChild(r);let t=document.createElement(\"div\");t.className=\"status\",t.id=\"passkey-status\",s.appendChild(t);let n=(l,b)=>{t.textContent=l,t.className=`status${b?\" error\":\"\"}`},a=()=>n(\"\",!1),o={waiting:E(\"passkeyWaiting\",e),creating:E(\"passkeyCreating\",e),verifying:E(\"verifying\",e)},i=l=>l.success?(n(E(\"success\",e),!1),this.handleSuccess(),!0):l.code===\"FORBIDDEN\"||l.error===\"registration_closed\"?(this.showFullError(G({message:l.error,code:l.code||l.error},e)),!0):!1,d=()=>{r.innerHTML=\"\",n(E(\"passkeyNoLocal\",e),!1);let l=document.createElement(\"button\");l.className=\"btn\",l.id=\"passkey-btn\",l.innerHTML=`${le} ${K(E(\"passkeyUseAnotherDevice\",e))}`,r.appendChild(l),l.addEventListener(\"click\",()=>y());let b=document.createElement(\"button\");b.type=\"button\",b.className=\"passkey-alt\",b.textContent=E(\"passkeyCreateInstead\",e),r.appendChild(b),b.addEventListener(\"click\",()=>m())},m=()=>{r.innerHTML=\"\",a();let l=document.createElement(\"div\");l.className=\"name-row visible\",l.id=\"passkey-name-row\";let b=document.createElement(\"input\");b.className=\"input\",b.id=\"passkey-name-input\",b.type=\"text\",b.placeholder=E(\"namePlaceholder\",e),b.autocomplete=\"name\",l.appendChild(b),r.appendChild(l);let T=document.createElement(\"button\");T.className=\"btn\",T.id=\"passkey-btn\",T.innerHTML=`${le} ${K(E(\"passkeyCreate\",e))}`,r.appendChild(T);let v=document.createElement(\"button\");v.type=\"button\",v.className=\"passkey-alt\",v.textContent=E(\"passkeyBackToSignIn\",e),r.appendChild(v);let x=async()=>{T.disabled=!0;let A=await se({registerOnly:!0,name:b.value.trim(),onStatus:n,texts:o,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId});i(A)||(A.error&&n(A.error,!0),T.disabled=!1)};T.addEventListener(\"click\",x),b.addEventListener(\"keydown\",A=>{A.key===\"Enter\"&&x()}),v.addEventListener(\"click\",()=>p()),b.focus()},y=async()=>{let l=r.querySelector(\"#passkey-btn\");l&&(l.disabled=!0);let b=await se({authOnly:!0,onStatus:n,texts:o,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId});if(!i(b)){if(b.error&&b.error!==\"no_passkey\"){n(b.error,!0),l&&(l.disabled=!1);return}d()}},p=()=>{r.innerHTML=\"\",a();let l=document.createElement(\"button\");l.className=\"btn\",l.id=\"passkey-btn\",l.innerHTML=`${le} ${K(E(\"passkeySignIn\",e))}`,r.appendChild(l),l.addEventListener(\"click\",()=>y());let b=document.createElement(\"button\");b.type=\"button\",b.className=\"passkey-alt\",b.textContent=E(\"passkeyFirstTime\",e),r.appendChild(b),b.addEventListener(\"click\",()=>m())};this.options.invitationId?m():p()}startOAuthPopup(s,e){let r=this.config.servicePrefix??\"/.well-known/service\",n=`${this.options.masterOAuthOrigin?`${this.options.masterOAuthOrigin}${r}`:r}/api/oauth/${encodeURIComponent(s)}/login?returnUrl=${encodeURIComponent(window.location.href)}`,a=500,o=620,i=window.screenX+(window.innerWidth-a)/2,d=window.screenY+(window.innerHeight-o)/2,m=window.open(n,\"oauth-login:popup\",`left=${i},top=${d},width=${a},height=${o},resizable,scrollbars=yes,status=1,popup`);if(!m){window.location.href=n;return}let y=e.innerHTML;e.innerHTML='<span class=\"oauth-spinner\"></span> Authorizing...',e.disabled=!0,e.classList.add(\"oauth-btn-loading\");let p=()=>{e.innerHTML=y,e.disabled=!1,e.classList.remove(\"oauth-btn-loading\")},l=async v=>{if(!v.data||v.data.type!==\"authorization_response\")return;if(T(),m.close(),v.data.error){p();return}let{code:x,state:A}=v.data.response??v.data;if(!x){p();return}e.innerHTML='<span class=\"oauth-spinner\"></span> Signing in...';try{let D={provider:s,code:x,state:A};this.options.invitationId&&(D.invitationId=this.options.invitationId),await this.http.post(`${r}/api/oauth/login`,D),e.innerHTML='<span class=\"oauth-check\">\\u2713</span> Success',this.handleSuccess()}catch(D){let $=D instanceof Error?D.message:\"\",U=D instanceof Error&&\"code\"in D?D.code:\"\";U===\"FORBIDDEN\"||$===\"registration_closed\"||U===\"registration_closed\"?this.showFullError(G(D,this.options.locale)):p()}},b=setInterval(()=>{m.closed&&(T(),p())},500),T=()=>{clearInterval(b),window.removeEventListener(\"message\",l)};window.addEventListener(\"message\",l)}renderSecondaryGrid(s,e,r){let t=document.createElement(\"div\");if(t.className=\"methods-grid\",r.includes(\"oauth\")&&this.options.oauthProviders?.length){let n=(this.options.oauthProviders??[]).filter(a=>a.enabled);for(let a of n){let o=document.createElement(\"button\");o.className=\"method-btn\",o.dataset.provider=a.id;let i=Ve(a.id);o.innerHTML=`${i} ${K(a.name)}`,t.appendChild(o),o.addEventListener(\"click\",()=>{this.startOAuthPopup(a.id,o)})}}if(r.includes(\"email\")){let n=document.createElement(\"button\");n.className=\"method-btn\",n.id=\"email-btn\",n.innerHTML=`${Me} ${K(E(\"emailButton\",e))}`,t.appendChild(n),n.addEventListener(\"click\",()=>{this.switchView(\"email\")})}if(r.includes(\"did-connect\")){let n=document.createElement(\"button\");n.className=\"method-btn\",n.id=\"did-wallet-btn\";let a=t.children.length>0?E(\"didWalletButtonShort\",e):E(\"didWalletButton\",e);n.innerHTML=`${we} ${K(a)}`,t.appendChild(n),n.addEventListener(\"click\",()=>{this.switchView(\"qr\")})}s.appendChild(t)}async startDIDConnectInView(s,e,r,t){s.textContent=E(\"connecting\",t);try{this.tokenSession?.destroy(),this.tokenSession=new Z(this.config,this.http),this.tokenSession.on(\"succeed\",async()=>{this.showConnectResult(e,r,s,E(\"verifying\",t));try{let a=this.config.servicePrefix??\"/.well-known/service\";await this.http.post(`${a}/api/did/connect/complete`,{token:this.tokenSession.state.token}),this.showConnectSuccess(e,r,s,t),this.handleSuccess()}catch(a){this.showConnectResult(e,r,s,G(a,t),!0)}}),this.tokenSession.on(\"timeout\",()=>{s.textContent=E(\"timeout\",t);let a=document.createElement(\"div\");a.className=\"qr-timeout-overlay\",a.innerHTML=`<span class=\"timeout-text\">${K(E(\"timeout\",t))}</span>`;let o=document.createElement(\"button\");o.className=\"refresh-btn\",o.textContent=E(\"refreshQR\",t),o.addEventListener(\"click\",()=>{a.remove(),ue(e),e.innerHTML='<div class=\"qr-placeholder\"><span class=\"qr-spinner\"></span></div>',r.disabled=!0,this.startDIDConnectInView(s,e,r,t)}),a.appendChild(o),e.appendChild(a)}),this.tokenSession.on(\"error\",a=>{this.showConnectResult(e,r,s,G(a,t),!0)}),this.tokenSession.on(\"statusChange\",a=>{a.status===\"scanned\"&&this.showConnectScanned(e,r,s,t)});let n=await this.tokenSession.create();n.url&&(Ze(e,n.url),r.disabled=!1,r.addEventListener(\"click\",()=>{this.showConnectScanned(e,r,s,t),this.openInWallet(n.url,t)})),s.textContent=E(\"scanWithWallet\",t),this.tokenSession.startPolling()}catch(n){s.textContent=G(n,t),ue(e)}}showFullError(s){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.renderLocaleSwitcher(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 t=document.createElement(\"div\");t.className=\"status error\",t.textContent=s,this.cardEl.appendChild(t);let n=document.createElement(\"button\");n.className=\"btn btn-secondary result-back-btn\",n.textContent=E(\"back\",e),n.addEventListener(\"click\",()=>this.switchView(\"methods\")),this.cardEl.appendChild(n),this.renderTrustFooter(this.cardEl,e)}showConnectScanned(s,e,r,t=\"en\"){s.style.display=\"none\",e.style.display=\"none\";let n=s.parentElement?.querySelector(\".connect-result\");n||(n=document.createElement(\"div\"),n.className=\"connect-result\",s.parentElement?.insertBefore(n,r)),n.innerHTML=`<div class=\"connect-status-icon\">\n <div class=\"connect-spinner-ring\"></div>\n <span class=\"connect-status-badge\">${we}</span>\n </div>`,r.textContent=E(\"waitingWallet\",t),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=E(\"walletContinue\",t);let o=r.parentElement?.querySelector(\".result-back-btn\");o||(o=document.createElement(\"button\"),o.className=\"btn btn-secondary result-back-btn\",o.textContent=E(\"back\",t),o.addEventListener(\"click\",()=>this.switchView(\"methods\")),a.parentElement?.insertBefore(o,a.nextSibling))}showConnectSuccess(s,e,r,t=\"en\"){s.style.display=\"none\",e.style.display=\"none\";let n=s.parentElement?.querySelector(\".connect-result\");n||(n=document.createElement(\"div\"),n.className=\"connect-result\",s.parentElement?.insertBefore(n,r)),n.innerHTML=`<div class=\"connect-status-icon connect-success\">\n <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>\n </div>`,r.textContent=E(\"success\",t),r.className=\"status success\";let a=r.parentElement?.querySelector(\".connect-subtitle\"),o=r.parentElement?.querySelector(\".result-back-btn\");a?.remove(),o?.remove()}showConnectResult(s,e,r,t,n=!1){let a=this.options.locale;s.style.display=\"none\",e.style.display=\"none\";let o=s.parentElement?.querySelector(\".connect-result\");if(o||(o=document.createElement(\"div\"),o.className=\"connect-result\",s.parentElement?.insertBefore(o,r)),n){o.innerHTML='<div class=\"result-icon result-error\">\\u2715</div>',r.textContent=t,r.className=\"status error\";let i=r.parentElement?.querySelector(\".result-back-btn\");i||(i=document.createElement(\"button\"),i.className=\"btn btn-secondary result-back-btn\",i.textContent=E(\"back\",a),i.addEventListener(\"click\",()=>this.switchView(\"methods\")),r.parentElement?.insertBefore(i,r.nextSibling))}else o.innerHTML='<div class=\"result-icon result-loading\"><span class=\"qr-spinner\"></span></div>',r.textContent=t,r.className=\"status\"}openInWallet(s,e=\"en\"){let r=st(),t=ot();if(r){let n=s.replace(/^https?:\\/\\//,\"abt://\");window.location.href=n}else if(t&&typeof t.open==\"function\"){let n=this.tokenSession?.state;t.open({action:this.config.action??\"login\",locale:e,url:encodeURIComponent(s),appInfo:n?.appInfo??{},memberAppInfo:n?.memberAppInfo??{}})}else{let n=`${rt}?action=requestAuth&url=${encodeURIComponent(s)}`,a=414,o=736,i=window.screenX+window.innerWidth-a,d=window.screenY;window.open(n,\"did-wallet:popup\",`left=${i},top=${d},width=${a},height=${o},resizable,scrollbars=yes,status=1,popup`)}}handleSuccess(){this.options.onSuccess?this.options.onSuccess():setTimeout(()=>location.reload(),300)}};return Re(it);})();\n";
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=login-bundle-string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-bundle-string.d.ts","sourceRoot":"","sources":["../../src/_generated/login-bundle-string.ts"],"names":[],"mappings":"wBACe,
|
|
1
|
+
{"version":3,"file":"login-bundle-string.d.ts","sourceRoot":"","sources":["../../src/_generated/login-bundle-string.ts"],"names":[],"mappings":"wBACe,i+wFAAi+wF;AAAh/wF,wBAAi/wF"}
|