@authsignal/react
Version:
React components for [Authsignal](https://authsignal.com).
1 lines • 207 kB
JavaScript
"use strict";var e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var a=r(e),o=r(n);let i;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}('/*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */:host,:root{--as-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--as-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--as-color-red-600:oklch(57.7% 0.245 27.325);--as-color-gray-200:oklch(92.8% 0.006 264.531);--as-color-black:#000;--as-spacing:0.25rem;--as-container-lg:32rem;--as-text-sm:0.875rem;--as-text-sm--line-height:1.42857;--as-text-lg:1.125rem;--as-text-lg--line-height:1.55556;--as-text-xl:1.25rem;--as-text-xl--line-height:1.4;--as-font-weight-medium:500;--as-font-weight-semibold:600;--as-tracking-tight:-0.025em;--as-animate-spin:spin 1s linear infinite;--as-default-transition-duration:150ms;--as-default-transition-timing-function:cubic-bezier(0.4,0,0.2,1);--as-default-font-family:var(--as-font-sans);--as-default-mono-font-family:var(--as-font-mono);--as-color-background:var(--as-color-background);--as-color-foreground:var(--as-color-foreground);--as-color-primary:var(--as-color-primary);--as-color-primary-foreground:var(--as-color-primary-foreground);--as-color-muted:var(--as-color-muted);--as-color-danger:var(--as-color-danger);--as-color-input-border:var(--as-color-input-border);--as-color-ring:var(--as-color-ring)}@layer theme;@layer base{.authsignal{*,::backdrop,::file-selector-button,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:var(--as-default-font-feature-settings,normal);-webkit-tap-highlight-color:transparent;font-family:var(--as-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-variation-settings:var(--as-default-font-variation-settings,normal);line-height:1.5;tab-size:4}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:var(--as-default-mono-font-feature-settings,normal);font-family:var(--as-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-size:1em;font-variation-settings:var(--as-default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}::file-selector-button,button,input,optgroup,select,textarea{font-feature-settings:inherit;background-color:transparent;border-radius:0;color:inherit;font:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::placeholder{color:currentcolor;@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}::file-selector-button,button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,::backdrop,::file-selector-button,:after,:before{border-color:var(--as-color-gray-200,currentcolor)}}}@layer components;@layer utilities{.as\\:pointer-events-none{pointer-events:none}.as\\:sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}.as\\:absolute,.as\\:sr-only{position:absolute}.as\\:fixed{position:fixed}.as\\:relative{position:relative}.as\\:inset-0{inset:calc(var(--as-spacing)*0)}.as\\:inset-x-0{inset-inline:calc(var(--as-spacing)*0)}.as\\:top-1\\/2{top:50%}.as\\:top-4{top:calc(var(--as-spacing-unit, .25rem)*4)}.as\\:right-4{right:calc(var(--as-spacing-unit, .25rem)*4)}.as\\:bottom-0{bottom:calc(var(--as-spacing)*0)}.as\\:left-1\\/2{left:50%}.as\\:z-10{z-index:10}.as\\:z-50{z-index:50}.as\\:mx-auto{margin-inline:auto}.as\\:mt-4{margin-top:calc(var(--as-spacing-unit, .25rem)*4)}.as\\:mt-6{margin-top:calc(var(--as-spacing-unit, .25rem)*6)}.as\\:mt-24{margin-top:calc(var(--as-spacing)*24)}.as\\:ml-auto{margin-left:auto}.as\\:flex{display:flex}.as\\:grid{display:grid}.as\\:inline-flex{display:inline-flex}.as\\:size-4{height:calc(var(--as-spacing-unit, .25rem)*4);width:calc(var(--as-spacing-unit, .25rem)*4)}.as\\:size-6{height:calc(var(--as-spacing-unit, .25rem)*6);width:calc(var(--as-spacing-unit, .25rem)*6)}.as\\:size-8{height:calc(var(--as-spacing-unit, .25rem)*8);width:calc(var(--as-spacing-unit, .25rem)*8)}.as\\:size-10{height:calc(var(--as-spacing-unit, .25rem)*10);width:calc(var(--as-spacing-unit, .25rem)*10)}.as\\:size-\\[1rem\\]{height:1rem;width:1rem}.as\\:size-\\[2rem\\]{height:2rem;width:2rem}.as\\:h-2{height:calc(var(--as-spacing-unit, .25rem)*2)}.as\\:h-4{height:calc(var(--as-spacing-unit, .25rem)*4)}.as\\:h-auto{height:auto}.as\\:w-\\[100px\\]{width:100px}.as\\:w-full{width:100%}.as\\:w-px{width:1px}.as\\:max-w-\\[425px\\]{max-width:425px}.as\\:max-w-lg{max-width:var(--as-container-lg)}.as\\:-translate-x-1\\/2{--tw-translate-x:-50%}.as\\:-translate-x-1\\/2,.as\\:-translate-y-1\\/2{translate:var(--tw-translate-x) var(--tw-translate-y)}.as\\:-translate-y-1\\/2{--tw-translate-y:-50%}.as\\:animate-caret-blink{animation:caret-blink 1.25s ease-out infinite}.as\\:animate-shake{animation:shake .15s ease-in-out 0s 2}.as\\:animate-spin{animation:var(--as-animate-spin)}.as\\:flex-col{flex-direction:column}.as\\:flex-row{flex-direction:row}.as\\:items-center{align-items:center}.as\\:justify-center{justify-content:center}.as\\:justify-end{justify-content:flex-end}.as\\:gap-2{gap:calc(var(--as-spacing-unit, .25rem)*2)}.as\\:gap-4{gap:calc(var(--as-spacing-unit, .25rem)*4)}.as\\:space-y-1\\.5{:where(&>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--as-spacing-unit, .25rem)*1.5*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--as-spacing-unit, .25rem)*1.5*var(--tw-space-y-reverse))}}.as\\:space-y-2{:where(&>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--as-spacing-unit, .25rem)*2*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--as-spacing-unit, .25rem)*2*var(--tw-space-y-reverse))}}.as\\:space-y-3{:where(&>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--as-spacing-unit, .25rem)*3*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--as-spacing-unit, .25rem)*3*var(--tw-space-y-reverse))}}.as\\:space-y-4{:where(&>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--as-spacing-unit, .25rem)*4*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--as-spacing-unit, .25rem)*4*var(--tw-space-y-reverse))}}.as\\:space-y-6{:where(&>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--as-spacing-unit, .25rem)*6*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--as-spacing-unit, .25rem)*6*var(--tw-space-y-reverse))}}.as\\:gap-x-\\[0\\.5rem\\]{column-gap:.5rem}.as\\:space-x-1{:where(&>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-end:calc(var(--as-spacing-unit, .25rem)*1*(1 - var(--tw-space-x-reverse)));margin-inline-start:calc(var(--as-spacing-unit, .25rem)*1*var(--tw-space-x-reverse))}}.as\\:space-x-2{:where(&>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-end:calc(var(--as-spacing-unit, .25rem)*2*(1 - var(--tw-space-x-reverse)));margin-inline-start:calc(var(--as-spacing-unit, .25rem)*2*var(--tw-space-x-reverse))}}.as\\:gap-y-2{row-gap:calc(var(--as-spacing-unit, .25rem)*2)}.as\\:rounded{border-radius:.25rem}.as\\:rounded-full{border-radius:calc(infinity * 1px)}.as\\:rounded-lg{border-radius:var(--as-border-radius)}.as\\:rounded-sm{border-radius:calc(var(--as-border-radius) - 4px)}.as\\:rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.as\\:border{border-style:var(--tw-border-style);border-width:1px}.as\\:border-input-border{border-color:var(--as-color-input-border)}.as\\:border-red-600{border-color:var(--as-color-red-600)}.as\\:bg-background{background-color:var(--as-color-background)}.as\\:bg-black\\/80{background-color:var(--as-color-black);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--as-color-black) 80%,transparent)}}.as\\:bg-foreground{background-color:var(--as-color-foreground)}.as\\:bg-muted{background-color:var(--as-color-muted)}.as\\:bg-primary{background-color:var(--as-color-primary)}.as\\:p-2{padding:calc(var(--as-spacing-unit, .25rem)*2)}.as\\:p-6{padding:calc(var(--as-spacing-unit, .25rem)*6)}.as\\:px-3{padding-inline:calc(var(--as-spacing-unit, .25rem)*3)}.as\\:px-4{padding-inline:calc(var(--as-spacing-unit, .25rem)*4)}.as\\:py-2{padding-block:calc(var(--as-spacing-unit, .25rem)*2)}.as\\:pt-8{padding-top:calc(var(--as-spacing-unit, .25rem)*8)}.as\\:pb-8{padding-bottom:calc(var(--as-spacing-unit, .25rem)*8)}.as\\:pb-10{padding-bottom:calc(var(--as-spacing-unit, .25rem)*10)}.as\\:text-center{text-align:center}.as\\:text-left{text-align:left}.as\\:text-lg{font-size:var(--as-text-lg);line-height:var(--tw-leading,var(--as-text-lg--line-height))}.as\\:text-sm{font-size:var(--as-text-sm);line-height:var(--tw-leading,var(--as-text-sm--line-height))}.as\\:text-xl{font-size:var(--as-text-xl);line-height:var(--tw-leading,var(--as-text-xl--line-height))}.as\\:text-\\[0\\.8rem\\]{font-size:.8rem}.as\\:leading-none{--tw-leading:1;line-height:1}.as\\:font-medium{--tw-font-weight:var(--as-font-weight-medium);font-weight:var(--as-font-weight-medium)}.as\\:font-semibold{--tw-font-weight:var(--as-font-weight-semibold);font-weight:var(--as-font-weight-semibold)}.as\\:tracking-tight{--tw-tracking:var(--as-tracking-tight);letter-spacing:var(--as-tracking-tight)}.as\\:text-\\[\\#5865D6\\]{color:#5865d6}.as\\:text-danger{color:var(--as-color-danger)}.as\\:text-foreground{color:var(--as-color-foreground)}.as\\:text-primary-foreground{color:var(--as-color-primary-foreground)}.as\\:opacity-70{opacity:70%}.as\\:shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,rgba(0,0,0,.1)),0 4px 6px -4px var(--tw-shadow-color,rgba(0,0,0,.1))}.as\\:shadow-lg,.as\\:shadow-sm{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.as\\:shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,rgba(0,0,0,.1)),0 1px 2px -1px var(--tw-shadow-color,rgba(0,0,0,.1))}.as\\:ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.as\\:ring-ring{--tw-ring-color:var(--as-color-ring)}.as\\:ring-offset-background{--tw-ring-offset-color:var(--as-color-background)}.as\\:transition-all{transition-duration:var(--tw-duration,var(--as-default-transition-duration));transition-property:all;transition-timing-function:var(--tw-ease,var(--as-default-transition-timing-function))}.as\\:transition-opacity{transition-duration:var(--tw-duration,var(--as-default-transition-duration));transition-property:opacity;transition-timing-function:var(--tw-ease,var(--as-default-transition-timing-function))}.as\\:duration-1000{--tw-duration:1000ms;transition-duration:1s}.as\\:peer-disabled\\:cursor-not-allowed{&:is(:where(.as\\:peer):disabled~*){cursor:not-allowed}}.as\\:peer-disabled\\:opacity-70{&:is(:where(.as\\:peer):disabled~*){opacity:70%}}.as\\:hover\\:opacity-100{&:hover{@media (hover:hover){opacity:100%}}}.as\\:focus\\:ring-2{&:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.as\\:focus\\:ring-ring{&:focus{--tw-ring-color:var(--as-color-ring)}}.as\\:focus\\:ring-offset-2{&:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}}.as\\:focus\\:outline-hidden{&:focus{--tw-outline-style:none;outline-style:none;@media (forced-colors:active){outline:2px solid transparent;outline-offset:2px}}}.as\\:disabled\\:pointer-events-none{&:disabled{pointer-events:none}}.as\\:disabled\\:cursor-not-allowed{&:disabled{cursor:not-allowed}}.as\\:has-disabled\\:opacity-50{&:has(:disabled){opacity:50%}}.as\\:data-\\[state\\=closed\\]\\:animate-out{&[data-state=closed]{animation:exit var(--tw-duration,.15s)var(--tw-ease,ease)}}.as\\:data-\\[state\\=closed\\]\\:fade-out-0{&[data-state=closed]{--tw-exit-opacity:0}}.as\\:data-\\[state\\=closed\\]\\:zoom-out-95{&[data-state=closed]{--tw-exit-scale:.95}}.as\\:data-\\[state\\=open\\]\\:animate-in{&[data-state=open]{animation:enter var(--tw-duration,.15s)var(--tw-ease,ease)}}.as\\:data-\\[state\\=open\\]\\:text-foreground{&[data-state=open]{color:var(--as-color-foreground)}}.as\\:data-\\[state\\=open\\]\\:fade-in-0{&[data-state=open]{--tw-enter-opacity:0}}.as\\:data-\\[state\\=open\\]\\:zoom-in-95{&[data-state=open]{--tw-enter-scale:.95}}.as\\:xs\\:size-12{@media (width >= 375px){height:calc(var(--as-spacing)*12);width:calc(var(--as-spacing)*12)}}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0))}}@keyframes caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}@keyframes spin{to{transform:rotate(1turn)}}@keyframes shake{25%{transform:translate3d(3px,0,0)}75%{transform:translate3d(-3px,0,0)}}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial}}}');const s=new Uint8Array(16);function l(){if(!i&&(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!i))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(s)}const c=[];for(let e=0;e<256;++e)c.push((e+256).toString(16).slice(1));var u={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function d(e,t,n){if(u.randomUUID&&!t&&!e)return u.randomUUID();const r=(e=e||{}).random||(e.rng||l)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase()}(r)}var f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},f.apply(this,arguments)};function p(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}l((r=r.apply(e,t||[])).next())}))}function h(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function m(e){const t=new Uint8Array(e);let n="";for(const e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function g(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,"="),a=atob(r),o=new ArrayBuffer(a.length),i=new Uint8Array(o);for(let e=0;e<a.length;e++)i[e]=a.charCodeAt(e);return o}function v(){return void 0!==window?.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential}function y(e){const{id:t}=e;return{...e,id:g(t),transports:e.transports}}function b(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}class w extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),this.name=r??n.name,this.code=t}}const E=new class{createNewAbortSignal(){if(this.controller){const e=new Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},x=["cross-platform","platform"];function k(e){if(e&&!(x.indexOf(e)<0))return e}async function R(e){const{optionsJSON:t,useAutoRegister:n=!1}=e;if(!v())throw new Error("WebAuthn is not supported in this browser");const r={...t,challenge:g(t.challenge),user:{...t.user,id:g(t.user.id)},excludeCredentials:t.excludeCredentials?.map(y)},a={};let o;n&&(a.mediation="conditional"),a.publicKey=r,a.signal=E.createNewAbortSignal();try{o=await navigator.credentials.create(a)}catch(e){throw function({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new w({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(!0===n.authenticatorSelection?.requireResidentKey)return new w({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if("conditional"===t.mediation&&"required"===n.authenticatorSelection?.userVerification)return new w({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if("required"===n.authenticatorSelection?.userVerification)return new w({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if("InvalidStateError"===e.name)return new w({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if("NotAllowedError"===e.name)return new w({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("NotSupportedError"===e.name)return 0===n.pubKeyCredParams.filter((e=>"public-key"===e.type)).length?new w({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new w({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if("SecurityError"===e.name){const t=window.location.hostname;if(!b(t))return new w({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(n.rp.id!==t)return new w({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new w({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new w({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}({error:e,options:a})}if(!o)throw new Error("Registration was not completed");const{id:i,rawId:s,response:l,type:c}=o;let u,d,f,p;if("function"==typeof l.getTransports&&(u=l.getTransports()),"function"==typeof l.getPublicKeyAlgorithm)try{d=l.getPublicKeyAlgorithm()}catch(e){C("getPublicKeyAlgorithm()",e)}if("function"==typeof l.getPublicKey)try{const e=l.getPublicKey();null!==e&&(f=m(e))}catch(e){C("getPublicKey()",e)}if("function"==typeof l.getAuthenticatorData)try{p=m(l.getAuthenticatorData())}catch(e){C("getAuthenticatorData()",e)}return{id:i,rawId:m(s),response:{attestationObject:m(l.attestationObject),clientDataJSON:m(l.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:c,clientExtensionResults:o.getClientExtensionResults(),authenticatorAttachment:k(o.authenticatorAttachment)}}function C(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}async function S(e){const{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!v())throw new Error("WebAuthn is not supported in this browser");let a;0!==t.allowCredentials?.length&&(a=t.allowCredentials?.map(y));const o={...t,challenge:g(t.challenge),allowCredentials:a},i={};if(n){if(!await function(){if(!v())return new Promise((e=>e(!1)));const e=window.PublicKeyCredential;return void 0===e.isConditionalMediationAvailable?new Promise((e=>e(!1))):e.isConditionalMediationAvailable()}())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');i.mediation="conditional",o.allowCredentials=[]}let s;i.publicKey=o,i.signal=E.createNewAbortSignal();try{s=await navigator.credentials.get(i)}catch(e){throw function({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new w({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if("NotAllowedError"===e.name)return new w({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("SecurityError"===e.name){const t=window.location.hostname;if(!b(t))return new w({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(n.rpId!==t)return new w({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new w({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}({error:e,options:i})}if(!s)throw new Error("Authentication was not completed");const{id:l,rawId:c,response:u,type:d}=s;let f;return u.userHandle&&(f=m(u.userHandle)),{id:l,rawId:m(c),response:{authenticatorData:m(u.authenticatorData),clientDataJSON:m(u.clientDataJSON),signature:m(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:k(s.authenticatorAttachment)}}function T(e){var t=e.name,n=e.value,r=e.expire,a=e.domain,o=e.secure,i=r===1/0?" expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+r;document.cookie=encodeURIComponent(t)+"="+n+"; path=/;"+i+(a?"; domain="+a:"")+(o?"; secure":"")}function N(e){var t,n=null!==(t=e.errorDescription)&&void 0!==t?t:e.error;return console.error(n),{error:n}}function A(e){var t;if(e&&"object"==typeof e&&"error"in e){var n=null!==(t=e.errorDescription)&&void 0!==t?t:e.error;return console.error(n),{error:n}}if(e&&"object"==typeof e&&"accessToken"in e&&"string"==typeof e.accessToken){var r=e.accessToken,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(e,["accessToken"]);return{data:f(f({},a),{token:r})}}return{data:e}}function O(e){var t,n;if(e instanceof w&&"ERROR_INVALID_RP_ID"===e.code){var r=(null===(n=null===(t=e.message)||void 0===t?void 0:t.match(/"([^"]*)"/))||void 0===n?void 0:n[1])||"";console.error('[Authsignal] The Relying Party ID "'.concat(r,'" is invalid for this domain.\n To learn more, visit https://docs.authsignal.com/scenarios/passkeys-prebuilt-ui#defining-the-relying-party'))}}var I;function P(e){var t=e.token,n=e.tenantId;return{"Content-Type":"application/json",Authorization:t?"Bearer ".concat(t):"Basic ".concat(window.btoa(encodeURIComponent(n)))}}function _(e){var t=e.response,n=e.onTokenExpired;"error"in t&&"expired_token"===t.errorCode&&n&&n()}!function(e){e.AUTHSIGNAL_CLOSE_POPUP="AUTHSIGNAL_CLOSE_POPUP"}(I||(I={}));var D=function(){function e(e){var t=e.baseUrl,n=e.tenantId,r=e.onTokenExpired;this.tenantId=n,this.baseUrl=t,this.onTokenExpired=r}return e.prototype.registrationOptions=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.username,o=e.authenticatorAttachment;return h(this,(function(e){switch(e.label){case 0:return t=Boolean(o)?{username:a,authenticatorAttachment:o}:{username:a},[4,fetch("".concat(this.baseUrl,"/client/user-authenticators/passkey/registration-options"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e.prototype.authenticationOptions=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.challengeId;return h(this,(function(e){switch(e.label){case 0:return t={challengeId:a},[4,fetch("".concat(this.baseUrl,"/client/user-authenticators/passkey/authentication-options"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e.prototype.addAuthenticator=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.challengeId,o=e.registrationCredential;return h(this,(function(e){switch(e.label){case 0:return t={challengeId:a,registrationCredential:o},[4,fetch("".concat(this.baseUrl,"/client/user-authenticators/passkey"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e.prototype.verify=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.challengeId,o=e.authenticationCredential,i=e.deviceId;return h(this,(function(e){switch(e.label){case 0:return t={challengeId:a,authenticationCredential:o,deviceId:i},[4,fetch("".concat(this.baseUrl,"/client/verify/passkey"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e.prototype.getPasskeyAuthenticator=function(e){return p(this,arguments,void 0,(function(e){var t,n=e.credentialIds;return h(this,(function(e){switch(e.label){case 0:return[4,fetch("".concat(this.baseUrl,"/client/user-authenticators/passkey?credentialIds=").concat(n),{method:"GET",headers:P({tenantId:this.tenantId})})];case 1:if(!(t=e.sent()).ok)throw new Error(t.statusText);return[2,t.json()]}}))}))},e.prototype.challenge=function(e){return p(this,void 0,void 0,(function(){var t;return h(this,(function(n){switch(n.label){case 0:return[4,fetch("".concat(this.baseUrl,"/client/challenge"),{method:"POST",headers:P({tenantId:this.tenantId}),body:JSON.stringify({action:e})})];case 1:return[4,n.sent().json()];case 2:return _({response:t=n.sent(),onTokenExpired:this.onTokenExpired}),[2,t]}}))}))},e}(),M=function(){function e(){this.token=null}return e.prototype.handleTokenNotSetError=function(){var e="A token has not been set. Call 'setToken' first.";return console.error("Error: ".concat(e)),{error:"TOKEN_NOT_SET",errorDescription:e}},e.shared=new e,e}(),L=!1,F=function(){function e(e){var t=e.baseUrl,n=e.tenantId,r=e.anonymousId,a=e.onTokenExpired;this.passkeyLocalStorageKey="as_user_passkey_map",this.cache=M.shared,this.api=new D({baseUrl:t,tenantId:n,onTokenExpired:a}),this.anonymousId=r}return e.prototype.signUp=function(e){return p(this,arguments,void 0,(function(e){var t,n,r,a,o,i,s=e.username,l=e.displayName,c=e.token,u=e.authenticatorAttachment,d=void 0===u?"platform":u,p=e.useAutoRegister,m=void 0!==p&&p;return h(this,(function(e){switch(e.label){case 0:return(t=null!=c?c:this.cache.token)?(n={username:s,displayName:l,token:t,authenticatorAttachment:d},[4,this.api.registrationOptions(n)]):[2,this.cache.handleTokenNotSetError()];case 1:if("error"in(r=e.sent()))return[2,N(r)];e.label=2;case 2:return e.trys.push([2,5,,6]),[4,R({optionsJSON:r.options,useAutoRegister:m})];case 3:return a=e.sent(),[4,this.api.addAuthenticator({challengeId:r.challengeId,registrationCredential:a,token:t})];case 4:return"error"in(o=e.sent())?[2,N(o)]:(o.isVerified&&this.storeCredentialAgainstDevice(f(f({},a),{userId:o.userId})),o.accessToken&&(this.cache.token=o.accessToken),[2,{data:{token:o.accessToken,registrationResponse:a}}]);case 5:throw i=e.sent(),L=!1,O(i),i;case 6:return[2]}}))}))},e.prototype.signIn=function(e){return p(this,void 0,void 0,(function(){var t,n,r,a,o,i,s,l,c,u,d,p;return h(this,(function(h){switch(h.label){case 0:if((null==e?void 0:e.token)&&e.autofill)throw new Error("autofill is not supported when providing a token");if((null==e?void 0:e.action)&&e.token)throw new Error("action is not supported when providing a token");if(null==e?void 0:e.autofill){if(L)return[2,{}];L=!0}return(null==e?void 0:e.action)?[4,this.api.challenge(e.action)]:[3,2];case 1:return n=h.sent(),[3,3];case 2:n=null,h.label=3;case 3:return(t=n)&&"error"in t?(L=!1,[2,N(t)]):[4,this.api.authenticationOptions({token:null==e?void 0:e.token,challengeId:null==t?void 0:t.challengeId})];case 4:if("error"in(r=h.sent()))return L=!1,[2,N(r)];h.label=5;case 5:return h.trys.push([5,8,,9]),[4,S({optionsJSON:r.options,useBrowserAutofill:null==e?void 0:e.autofill})];case 6:return a=h.sent(),(null==e?void 0:e.onVerificationStarted)&&e.onVerificationStarted(),[4,this.api.verify({challengeId:r.challengeId,authenticationCredential:a,token:null==e?void 0:e.token,deviceId:this.anonymousId})];case 7:return"error"in(o=h.sent())?(L=!1,[2,N(o)]):(o.isVerified&&this.storeCredentialAgainstDevice(f(f({},a),{userId:o.userId})),o.accessToken&&(this.cache.token=o.accessToken),i=o.accessToken,s=o.userId,l=o.userAuthenticatorId,c=o.username,u=o.userDisplayName,d=o.isVerified,L=!1,[2,{data:{isVerified:d,token:i,userId:s,userAuthenticatorId:l,username:c,displayName:u,authenticationResponse:a}}]);case 8:throw p=h.sent(),L=!1,O(p),p;case 9:return[2]}}))}))},e.prototype.isAvailableOnDevice=function(e){return p(this,arguments,void 0,(function(e){var t,n,r,a,o=e.userId;return h(this,(function(e){switch(e.label){case 0:if(!o)throw new Error("userId is required");if(!(t=localStorage.getItem(this.passkeyLocalStorageKey)))return[2,!1];if(n=JSON.parse(t),0===(r=null!==(a=n[o])&&void 0!==a?a:[]).length)return[2,!1];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.api.getPasskeyAuthenticator({credentialIds:r})];case 2:return e.sent(),[2,!0];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},e.prototype.storeCredentialAgainstDevice=function(e){var t=e.id,n=e.authenticatorAttachment,r=e.userId,a=void 0===r?"":r;if("cross-platform"!==n){var o=localStorage.getItem(this.passkeyLocalStorageKey),i=o?JSON.parse(o):{};i[a]?i[a].includes(t)||i[a].push(t):i[a]=[t],localStorage.setItem(this.passkeyLocalStorageKey,JSON.stringify(i))}},e}(),j=function(){function e(){this.windowRef=null}return e.prototype.show=function(e){var t=e.url,n=e.width,r=void 0===n?400:n,a=e.height,o=function(e){var t=e.url,n=e.width,r=e.height,a=e.win;if(!a.top)return null;var o=a.top.outerHeight/2+a.top.screenY-r/2,i=a.top.outerWidth/2+a.top.screenX-n/2;return window.open(t,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=".concat(n,", height=").concat(r,", top=").concat(o,", left=").concat(i))}({url:t,width:r,height:void 0===a?500:a,win:window});if(!o)throw new Error("Window is not initialized");return this.windowRef=o,o},e.prototype.close=function(){if(!this.windowRef)throw new Error("Window is not initialized");this.windowRef.close()},e}();const U=":not([inert]):not([inert] *)",$=':not([tabindex^="-"])',V=":not(:disabled)";var z=[`a[href]${U}${$}`,`area[href]${U}${$}`,`input:not([type="hidden"]):not([type="radio"])${U}${$}${V}`,`input[type="radio"]${U}${$}${V}`,`select${U}${$}${V}`,`textarea${U}${$}${V}`,`button${U}${$}${V}`,`details${U} > summary:first-of-type${$}`,`iframe${U}${$}`,`audio[controls]${U}${$}`,`video[controls]${U}${$}`,`[contenteditable]${U}${$}`,`[tabindex]${U}${$}`];function B(e){(e.querySelector("[autofocus]")||e).focus()}function W(e,t){if(t&&K(e))return e;if(!((n=e).shadowRoot&&"-1"===n.getAttribute("tabindex")||n.matches(":disabled,[hidden],[inert]")))if(e.shadowRoot){let n=H(e.shadowRoot,t);for(;n;){const e=W(n,t);if(e)return e;n=G(n,t)}}else if("slot"===e.localName){const n=e.assignedElements({flatten:!0});t||n.reverse();for(const e of n){const n=W(e,t);if(n)return n}}else{let n=H(e,t);for(;n;){const e=W(n,t);if(e)return e;n=G(n,t)}}var n;return!t&&K(e)?e:null}function H(e,t){return t?e.firstElementChild:e.lastElementChild}function G(e,t){return t?e.nextElementSibling:e.previousElementSibling}const K=e=>!e.shadowRoot?.delegatesFocus&&(e.matches(z.join(","))&&!(e=>!(!e.matches("details:not([open]) *")||e.matches("details>summary:first-of-type"))||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))(e));function q(e=document){const t=e.activeElement;return t?t.shadowRoot?q(t.shadowRoot)||document.activeElement:t:null}function Y(e,t){const[n,r]=function(e){const t=W(e,!0);return[t,t?W(e,!1)||t:null]}(e);if(!n)return t.preventDefault();const a=q();t.shiftKey&&a===n?(r.focus(),t.preventDefault()):t.shiftKey||a!==r||(n.focus(),t.preventDefault())}class J{$el;id;previouslyFocused;shown;constructor(e){this.$el=e,this.id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0)),this.fire("destroy"),this}show(e){return this.shown||(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=q(),"BODY"===this.previouslyFocused?.tagName&&e?.target&&(this.previouslyFocused=e.target),"focus"===e?.type?this.maintainFocus(e):B(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0),this.fire("show",e)),this}hide(e){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this.previouslyFocused?.focus?.(),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0),this.fire("hide",e),this):this}on(e,t,n){return this.$el.addEventListener(e,t,n),this}off(e,t,n){return this.$el.removeEventListener(e,t,n),this}fire(e,t){this.$el.dispatchEvent(new CustomEvent(e,{detail:t,cancelable:!0}))}handleTriggerClicks(e){const t=e.target;t.closest(`[data-a11y-dialog-show="${this.id}"]`)&&this.show(e),(t.closest(`[data-a11y-dialog-hide="${this.id}"]`)||t.closest("[data-a11y-dialog-hide]")&&t.closest('[aria-modal="true"]')===this.$el)&&this.hide(e)}bindKeypress(e){if(document.activeElement?.closest('[aria-modal="true"]')!==this.$el)return;let t=!1;try{t=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}"Escape"!==e.key||"alertdialog"===this.$el.getAttribute("role")||t||(e.preventDefault(),this.hide(e)),"Tab"===e.key&&Y(this.$el,e)}maintainFocus(e){e.target.closest('[aria-modal="true"], [data-a11y-dialog-ignore-focus-trap]')||B(this.$el)}}function X(){for(const e of document.querySelectorAll("[data-a11y-dialog]"))new J(e)}"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",X):X());var Z="__authsignal-popup-container",Q="__authsignal-popup-content",ee="__authsignal-popup-overlay",te="__authsignal-popup-style",ne="__authsignal-popup-iframe",re="385px",ae=function(){function e(e){var t=e.width,n=e.isClosable;if(this.popup=null,document.querySelector("#".concat(Z)))throw new Error("Multiple instances of Authsignal popup is not supported.");this.create({width:t,isClosable:n})}return e.prototype.create=function(e){var t=this,n=e.width,r=void 0===n?re:n,a=e.isClosable,o=void 0===a||a,i=r;CSS.supports("width",r)||(console.warn("Invalid CSS value for `popupOptions.width`. Using default value instead."),i=re);var s=document.createElement("div");s.setAttribute("id",Z),s.setAttribute("aria-hidden","true"),o||s.setAttribute("role","alertdialog");var l=document.createElement("div");l.setAttribute("id",ee),o&&l.setAttribute("data-a11y-dialog-hide","true");var c=document.createElement("div");c.setAttribute("id",Q),document.body.appendChild(s);var u=document.createElement("style");u.setAttribute("id",te),u.textContent="\n #".concat(Z,",\n #").concat(ee," {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n\n #").concat(Z," {\n z-index: 2147483647;\n display: flex;\n }\n\n #").concat(Z,"[aria-hidden='true'] {\n display: none;\n }\n\n #").concat(ee," {\n background-color: rgba(0, 0, 0, 0.18);\n }\n\n #").concat(Q," {\n margin: auto;\n z-index: 2147483647;\n position: relative;\n background-color: transparent;\n border-radius: 8px;\n width: ").concat(i,";\n }\n\n #").concat(Q," iframe {\n width: 1px;\n min-width: 100%;\n border-radius: inherit;\n max-height: 95vh;\n height: ").concat("384px",";\n }\n "),document.head.insertAdjacentElement("beforeend",u),s.appendChild(l),s.appendChild(c),this.popup=new J(s),s.focus(),this.popup.on("hide",(function(){t.destroy()}))},e.prototype.destroy=function(){var e=document.querySelector("#".concat(Z)),t=document.querySelector("#".concat(te));e&&t&&(document.body.removeChild(e),document.head.removeChild(t)),window.removeEventListener("message",oe)},e.prototype.show=function(e){var t,n=e.url;if(!this.popup)throw new Error("Popup is not initialized");var r=document.createElement("iframe");r.setAttribute("id",ne),r.setAttribute("name","authsignal"),r.setAttribute("title","Authsignal multi-factor authentication"),r.setAttribute("src",n),r.setAttribute("frameborder","0"),r.setAttribute("allow","publickey-credentials-get *; publickey-credentials-create *; clipboard-write");var a=document.querySelector("#".concat(Q));a&&a.appendChild(r),window.addEventListener("message",oe),null===(t=this.popup)||void 0===t||t.show()},e.prototype.close=function(){if(!this.popup)throw new Error("Popup is not initialized");this.popup.hide()},e.prototype.on=function(e,t){if(!this.popup)throw new Error("Popup is not initialized");this.popup.on(e,t)},e}();function oe(e){var t=document.querySelector("#".concat(ne));t&&e.data.height&&(t.style.height=e.data.height+"px")}var ie=function(){function e(e){var t=e.baseUrl,n=e.tenantId,r=e.onTokenExpired;this.tenantId=n,this.baseUrl=t,this.onTokenExpired=r}return e.prototype.enroll=function(e){return p(this,arguments,void 0,(function(e){var t,n=e.token;return h(this,(function(e){switch(e.label){case 0:return[4,fetch("".concat(this.baseUrl,"/client/user-authenticators/totp"),{method:"POST",headers:P({token:n,tenantId:this.tenantId})})];case 1:return[4,e.sent().json()];case 2:return _({response:t=e.sent(),onTokenExpired:this.onTokenExpired}),[2,t]}}))}))},e.prototype.verify=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.code;return h(this,(function(e){switch(e.label){case 0:return t={verificationCode:a},[4,fetch("".concat(this.baseUrl,"/client/verify/totp"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e}(),se=function(){function e(e){var t=e.baseUrl,n=e.tenantId,r=e.onTokenExpired;this.cache=M.shared,this.api=new ie({baseUrl:t,tenantId:n,onTokenExpired:r})}return e.prototype.enroll=function(){return p(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.cache.token?[4,this.api.enroll({token:this.cache.token})]:[2,this.cache.handleTokenNotSetError()];case 1:return[2,A(e.sent())]}}))}))},e.prototype.verify=function(e){return p(this,arguments,void 0,(function(e){var t,n=e.code;return h(this,(function(e){switch(e.label){case 0:return this.cache.token?[4,this.api.verify({token:this.cache.token,code:n})]:[2,this.cache.handleTokenNotSetError()];case 1:return"accessToken"in(t=e.sent())&&t.accessToken&&(this.cache.token=t.accessToken),[2,A(t)]}}))}))},e}(),le=function(){function e(e){var t=e.baseUrl,n=e.tenantId,r=e.onTokenExpired;this.tenantId=n,this.baseUrl=t,this.onTokenExpired=r}return e.prototype.enroll=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.email;return h(this,(function(e){switch(e.label){case 0:return t={email:a},[4,fetch("".concat(this.baseUrl,"/client/user-authenticators/email-otp"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e.prototype.challenge=function(e){return p(this,arguments,void 0,(function(e){var t,n=e.token;return h(this,(function(e){switch(e.label){case 0:return[4,fetch("".concat(this.baseUrl,"/client/challenge/email-otp"),{method:"POST",headers:P({token:n,tenantId:this.tenantId})})];case 1:return[4,e.sent().json()];case 2:return _({response:t=e.sent(),onTokenExpired:this.onTokenExpired}),[2,t]}}))}))},e.prototype.verify=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.code;return h(this,(function(e){switch(e.label){case 0:return t={verificationCode:a},[4,fetch("".concat(this.baseUrl,"/client/verify/email-otp"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e}(),ce=function(){function e(e){var t=e.baseUrl,n=e.tenantId,r=e.onTokenExpired;this.cache=M.shared,this.api=new le({baseUrl:t,tenantId:n,onTokenExpired:r})}return e.prototype.enroll=function(e){return p(this,arguments,void 0,(function(e){var t=e.email;return h(this,(function(e){switch(e.label){case 0:return this.cache.token?[4,this.api.enroll({token:this.cache.token,email:t})]:[2,this.cache.handleTokenNotSetError()];case 1:return[2,A(e.sent())]}}))}))},e.prototype.challenge=function(){return p(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.cache.token?[4,this.api.challenge({token:this.cache.token})]:[2,this.cache.handleTokenNotSetError()];case 1:return[2,A(e.sent())]}}))}))},e.prototype.verify=function(e){return p(this,arguments,void 0,(function(e){var t,n=e.code;return h(this,(function(e){switch(e.label){case 0:return this.cache.token?[4,this.api.verify({token:this.cache.token,code:n})]:[2,this.cache.handleTokenNotSetError()];case 1:return"accessToken"in(t=e.sent())&&t.accessToken&&(this.cache.token=t.accessToken),[2,A(t)]}}))}))},e}(),ue=function(){function e(e){var t=e.baseUrl,n=e.tenantId,r=e.onTokenExpired;this.tenantId=n,this.baseUrl=t,this.onTokenExpired=r}return e.prototype.enroll=function(e){return p(this,arguments,void 0,(function(e){var t,n,r=e.token,a=e.phoneNumber;return h(this,(function(e){switch(e.label){case 0:return t={phoneNumber:a},[4,fetch("".concat(this.baseUrl,"/client/user-authenticators/sms"),{method:"POST",headers:P({token:r,tenantId:this.tenantId}),body:JSON.stringify(t)})];case 1:return[4,e.sent().json()];case 2:return _({response:n=e.sent(),onTokenExpired:this.onTokenExpired}),[2,n]}}))}))},e.prototype.challenge=function(e){return p(this,arguments,void 0,(function(e){var t,n=e.token;re