@alviere/ui 0.8.2 → 0.9.1

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.
@@ -1,2 +1,2 @@
1
- var AlviereWebComponents=function(e){"use strict";var t,r,a,o,n,i,l,s,c,u,v,d,p,f,h,g,m,b,y,_=Object.defineProperty,w=e=>{throw TypeError(e)},C=(e,t,r)=>((e,t,r)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),x=(e,t,r)=>t.has(e)||w("Cannot "+r),E=(e,t,r)=>(x(e,t,"read from private field"),r?r.call(e):t.get(e)),S=(e,t,r)=>t.has(e)?w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),k=(e,t,r,a)=>(x(e,t,"write to private field"),a?a.call(e,r):t.set(e,r),r),A=(e,t,r)=>(x(e,t,"access private method"),r),T="undefined"!=typeof document?document.currentScript:null;const I={};function B(){return!("undefined"==typeof window||!window.location.search.includes("debug=true"))||(void 0==={url:T&&"SCRIPT"===T.tagName.toUpperCase()&&T.src||new URL("web-components.js",document.baseURI).href}||!I)&&(!("undefined"==typeof process||!process.env)&&"true"===process.env.VITE_DEBUG)}const N={logger:"UI_LOGGER",debug:(e,...t)=>{B()},info:(e,...t)=>{B()},warn:(e,...t)=>{B()},error:(e,...t)=>{B()}};function R(e){return e&&"function"==typeof e.getLogger?e.getLogger():N}let z=null,L=!1,D={};function U(){if(D.disableAutoInject||window.ALVIERE_DISABLE_AUTO_TOKENS)return void N.debug("[Alviere] Auto-token injection disabled");if(L||document.querySelector("style[data-alviere-tokens]"))return;const e='@layer alviere-defaults {\n :root {\n --alv-color-primary: #227e9e;\n --alv-color-primary-hover: #1b6680;\n --alv-color-primary-active: #145164;\n --alv-color-primary-light: #e8f4f8;\n --alv-color-primary-light-hover: #d1e8f0;\n --alv-color-on-primary: #ffffff;\n --alv-color-success: #436b1d;\n --alv-color-success-light: #d4edda;\n --alv-color-success-border: #c3e6cb;\n --alv-color-success-text: #155724;\n --alv-color-on-success: #ffffff;\n --alv-color-success-rgb: 67, 107, 29;\n --alv-color-error: #b3311f;\n --alv-color-error-light: #f8d7da;\n --alv-color-error-border: #f5c6cb;\n --alv-color-error-text: #721c24;\n --alv-color-on-error: #ffffff;\n --alv-color-error-rgb: 179, 49, 31;\n --alv-color-warning: #ffc107;\n --alv-color-warning-light: #fff3cd;\n --alv-color-warning-border: #ffeaa7;\n --alv-color-warning-text: #856404;\n --alv-color-on-warning: #000000;\n --alv-color-info: #175db8;\n --alv-color-info-light: #d1ecf1;\n --alv-color-info-border: #bee5eb;\n --alv-color-info-text: #0c5460;\n --alv-color-on-info: #ffffff;\n --alv-color-gray-50: #fafafa;\n --alv-color-gray-100: #f4f4f5;\n --alv-color-gray-200: #e4e4e7;\n --alv-color-gray-300: #d4d4d8;\n --alv-color-gray-400: #a1a1aa;\n --alv-color-gray-500: #71717a;\n --alv-color-gray-600: #52525b;\n --alv-color-gray-700: #3f3f46;\n --alv-color-gray-800: #27272a;\n --alv-color-gray-900: #18181b;\n --alv-color-surface: #ffffff;\n --alv-color-surface-secondary: #f9fafb;\n --alv-color-surface-tertiary: #f4f4f5;\n --alv-color-surface-elevated: #ffffff;\n --alv-color-text-primary: #18181b;\n --alv-color-text-secondary: #52525b;\n --alv-color-text-tertiary: #71717a;\n --alv-color-text-disabled: #a1a1aa;\n --alv-color-text-on-primary: #ffffff;\n --alv-color-text-on-surface: #18181b;\n --alv-color-border: #e4e4e7;\n --alv-color-border-hover: #d4d4d8;\n --alv-color-border-focus: #227e9e;\n --alv-color-border-error: #b3311f;\n --alv-color-border-success: #436b1d;\n --alv-color-background: #ffffff;\n --alv-color-background-disabled: #f4f4f5;\n --alv-color-background-hover: #f9fafb;\n --alv-color-background-active: #f4f4f5;\n}\n\n:root {\n --alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n --alv-font-family-grotesque: "Darker Grotesque", sans-serif;\n --alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;\n --alv-font-size-3xs: 0.625rem;\n --alv-font-size-2xs: 0.75rem;\n --alv-font-size-xs: 1rem;\n --alv-font-size-sm: 1.125rem;\n --alv-font-size-base: 1.25rem;\n --alv-font-size-lg: 1.5rem;\n --alv-font-size-xl: 1.75rem;\n --alv-font-weight-light: 300;\n --alv-font-weight-normal: 400;\n --alv-font-weight-medium: 500;\n --alv-font-weight-semibold: 600;\n --alv-font-weight-bold: 700;\n --alv-line-height-tight: 1.25;\n --alv-line-height-normal: 1.5;\n --alv-line-height-relaxed: 1.75;\n}\n\n:root {\n --alv-spacing-xs: 0.25rem;\n --alv-spacing-sm: 0.5rem;\n --alv-spacing-md: 1rem;\n --alv-spacing-lg: 1.5rem;\n --alv-spacing-xl: 2rem;\n --alv-spacing-2xl: 3rem;\n --alv-spacing-3xl: 4rem;\n}\n\n:root {\n --alv-border-radius-none: 0;\n --alv-border-radius-sm: 0.125rem;\n --alv-border-radius: 0.25rem;\n --alv-border-radius-md: 0.375rem;\n --alv-border-radius-lg: 0.5rem;\n --alv-border-radius-xl: 0.75rem;\n --alv-border-radius-2xl: 1rem;\n --alv-border-radius-full: 9999px;\n}\n\n:root {\n --alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n --alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n --alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n --alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n --alv-shadow-none: none;\n}\n\n:root {\n --alv-transition-fast: 150ms ease-in-out;\n --alv-transition-normal: 250ms ease-in-out;\n --alv-transition-slow: 350ms ease-in-out;\n --alv-transition-none: none;\n}\n\n:root {\n --alv-input-height-sm: 2.5rem;\n --alv-input-height: 3.25rem;\n --alv-input-height-lg: 3.75rem;\n --alv-input-padding-x: 0.75rem;\n --alv-input-padding-y: 0.5rem;\n --alv-input-border-color: var(--alv-color-border);\n --alv-input-border-hover: var(--alv-color-border-hover);\n --alv-input-border-focus: var(--alv-color-border-focus);\n --alv-input-bg: var(--alv-color-background);\n --alv-input-bg-disabled: var(--alv-color-background-disabled);\n}\n\n:root {\n --alv-z-dropdown: 1000;\n --alv-z-sticky: 1020;\n --alv-z-fixed: 1030;\n --alv-z-modal-backdrop: 1040;\n --alv-z-modal: 1050;\n --alv-z-popover: 1060;\n --alv-z-tooltip: 1070;\n}\n\n:root {\n --alv-button-primary-bg: var(--alv-color-primary);\n --alv-button-primary-bg-hover: var(--alv-color-primary-hover);\n --alv-button-primary-bg-active: var(--alv-color-primary-active);\n --alv-button-primary-text: var(--alv-color-on-primary);\n --alv-button-primary-border: var(--alv-color-primary);\n --alv-button-secondary-bg: transparent;\n --alv-button-secondary-bg-hover: var(--alv-color-primary-light);\n --alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);\n --alv-button-secondary-text: var(--alv-color-primary);\n --alv-button-secondary-border: var(--alv-color-primary);\n --alv-button-tertiary-bg: transparent;\n --alv-button-tertiary-bg-hover: var(--alv-color-gray-100);\n --alv-button-tertiary-bg-active: var(--alv-color-gray-200);\n --alv-button-tertiary-text: var(--alv-color-text-primary);\n --alv-button-tertiary-border: transparent;\n --alv-button-link-bg: transparent;\n --alv-button-link-bg-hover: transparent;\n --alv-button-link-bg-active: transparent;\n --alv-button-link-text: var(--alv-color-primary);\n --alv-button-link-text-hover: var(--alv-color-primary-hover);\n --alv-button-link-border: transparent;\n}\n\n:root {\n --alv-spinner-color: var(--alv-color-text-primary);\n --alv-spinner-size-sm: 1rem;\n --alv-spinner-size-md: 1.5rem;\n --alv-spinner-size-lg: 4rem;\n --alv-spinner-stroke-width: 2px;\n}\n\n:root {\n --alv-timeline-color: var(--alv-color-gray-600);\n --alv-timeline-completed-color: var(--alv-color-success);\n --alv-timeline-error-color: var(--alv-color-error);\n --alv-timeline-pending-color: var(--alv-color-gray-400);\n --alv-timeline-step-size-sm: 1.25rem;\n --alv-timeline-step-size-md: 2rem;\n --alv-timeline-step-size-lg: 2.5rem;\n --alv-timeline-connector-width: 3px;\n --alv-timeline-font-size: var(--alv-font-size-base);\n}\n\n:root {\n --alv-badge-primary-bg: var(--alv-color-primary);\n --alv-badge-primary-text: var(--alv-color-on-primary);\n --alv-badge-secondary-bg: var(--alv-color-gray-200);\n --alv-badge-secondary-text: var(--alv-color-text-primary);\n --alv-badge-success-bg: var(--alv-color-success);\n --alv-badge-success-text: var(--alv-color-on-success);\n --alv-badge-error-bg: var(--alv-color-error);\n --alv-badge-error-text: var(--alv-color-on-error);\n --alv-badge-warning-bg: var(--alv-color-warning);\n --alv-badge-warning-text: var(--alv-color-on-warning);\n --alv-badge-info-bg: var(--alv-color-info);\n --alv-badge-info-text: var(--alv-color-on-info);\n}\n\n:root {\n --alv-list-bg: var(--alv-color-surface);\n --alv-list-border: var(--alv-color-border);\n --alv-list-item-bg: transparent;\n --alv-list-item-bg-hover: var(--alv-color-background-hover);\n --alv-list-item-bg-active: var(--alv-color-background-active);\n --alv-list-item-text: var(--alv-color-text-primary);\n --alv-list-item-text-secondary: var(--alv-color-text-secondary);\n}\n\n:root {\n --alv-radio-border: var(--alv-color-border);\n --alv-radio-border-hover: var(--alv-color-border-hover);\n --alv-radio-border-focus: var(--alv-color-border-focus);\n --alv-radio-bg: var(--alv-color-background);\n --alv-radio-checked-bg: var(--alv-color-primary);\n --alv-radio-checked-border: var(--alv-color-primary);\n --alv-radio-text: var(--alv-color-text-primary);\n --alv-radio-text-disabled: var(--alv-color-text-disabled);\n}\n}';try{if(!("adoptedStyleSheets"in document))throw new Error("Constructable Stylesheets not supported");{z=new CSSStyleSheet,z.replaceSync(e);const t=document.adoptedStyleSheets||[];document.adoptedStyleSheets=[...t,z],N.debug("[Alviere] Design tokens injected via Constructable Stylesheets (layered)")}}catch(t){const r=document.createElement("style");r.setAttribute("data-alviere-tokens",""),r.textContent=e,document.head.appendChild(r),N.debug("[Alviere] Design tokens injected via <style> tag (layered fallback)")}L=!0}function P(e){if(z&&"adoptedStyleSheets"in e)try{const t=e.adoptedStyleSheets||[];e.adoptedStyleSheets=[...t,z]}catch(t){N.warn("[Alviere] Failed to adopt tokens in Shadow DOM:",t)}}var V;"undefined"!=typeof window&&(window.ALVIERE_TOKENS_CONFIG&&(V=window.ALVIERE_TOKENS_CONFIG,D={...D,...V},V.customTokens&&"undefined"!=typeof document&&(Object.entries(V.customTokens).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)}),N.debug("[Alviere] Applied custom tokens:",Object.keys(V.customTokens))),L&&(V.customTokens||V.theme)&&(N.debug("[Alviere] Re-injecting tokens with new configuration"),function(){const e=document.querySelector("style[data-alviere-tokens]");if(e&&e.remove(),z&&"adoptedStyleSheets"in document){const e=document.adoptedStyleSheets||[];document.adoptedStyleSheets=e.filter(e=>e!==z)}z=null,L=!1}(),U())),U());class M{constructor(){this.registered=new Set,this.components=new Map}static getInstance(){return this.instance||(this.instance=new M),this.instance}wrapWithTokenAdoption(e){return class extends e{constructor(){if(super(),this.shadowRoot)P(this.shadowRoot);else{const e=new MutationObserver(()=>{this.shadowRoot&&(P(this.shadowRoot),e.disconnect())});e.observe(this,{childList:!0,subtree:!0})}}}}register(e,t){if(N.debug(`🔍 Registering web component ${e}`,this.registered),this.registered.has(e))return N.warn(`Web Component ${e} is already registered by Alviere, skipping...`),!1;if(window.customElements.get(e))return N.warn(`Web component '${e}' is already registered globally, skipping...`),!1;if("undefined"==typeof window||!window.customElements)return N.warn("Web Components not supported in this environment"),!1;if(this.registered.has(e))return N.warn(`Web component ${e} is already registered`),!1;if(!t.element)return N.warn(`Component ${e} does not have an element property`),!1;try{const r=this.wrapWithTokenAdoption(t.element);return window.customElements.define(e,r),this.registered.add(e),this.components.set(e,t),N.debug(`✅ Web component ${e} registered successfully with token adoption`),!0}catch(r){return N.error(`❌ Failed to register web component ${e}:`,r),!1}}registerAll(e){e.forEach(({name:e,component:t})=>{this.register(e,t)})}isRegistered(e){return this.registered.has(e)}getRegisteredComponents(){return Array.from(this.registered)}getComponent(e){return this.components.get(e)}clear(){this.registered.clear(),this.components.clear()}}const O=M.getInstance();"undefined"!=typeof window&&((t=window.__svelte??(window.__svelte={})).v??(t.v=new Set)).add("5");const j="[!",q={},F=Symbol(),K=!1;var $=Array.isArray,H=Array.prototype.indexOf,G=Array.from,W=Object.keys,Y=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,J=Object.getOwnPropertyDescriptors,X=Object.prototype,Z=Array.prototype,ee=Object.getPrototypeOf,te=Object.isExtensible;const re=()=>{};function ae(e){for(var t=0;t<e.length;t++)e[t]()}const oe=16,ne=32,ie=64,le=256,se=512,ce=1024,ue=2048,ve=4096,de=8192,pe=16384,fe=32768,he=65536,ge=1<<17,me=1<<19,be=1<<20,ye=1<<21,_e=1<<22,we=1<<23,Ce=Symbol("$state"),xe=Symbol("legacy props"),Ee=Symbol(""),Se=new class extends Error{constructor(){super(...arguments),C(this,"name","StaleReactionError"),C(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function ke(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Ae,Te=!1;function Ie(e){Te=e}function Be(e){if(null===e)throw q;return Ae=e}function Ne(){return Be($t(Ae))}function Re(e){if(Te){if(null!==$t(Ae))throw q;Ae=e}}function ze(e=1){if(Te){for(var t=e,r=Ae;t--;)r=$t(r);Ae=r}}function Le(){for(var e=0,t=Ae;;){if(8===t.nodeType){var r=t.data;if("]"===r){if(0===e)return t;e-=1}else"["!==r&&r!==j||(e+=1)}var a=$t(t);t.remove(),t=a}}function De(e){if(!e||8!==e.nodeType)throw q;return e.data}function Ue(e){return e===this.v}function Pe(e,t){return e!=e?t==t:e!==t||null!==e&&"object"==typeof e||"function"==typeof e}function Ve(e){return!Pe(e,this.v)}let Me=null;function Oe(e){Me=e}function je(e,t=!1,r){Me={p:Me,c:null,e:null,s:e,x:null,l:null}}function qe(e){var t=Me,r=t.e;if(null!==r)for(var a of(t.e=null,r))er(a);return void 0!==e&&(t.x=e),Me=t.p,e??{}}const Fe=new WeakMap;function Ke(e,t){for(;null!==t;){if(128&t.f)try{return void t.b.error(e)}catch(r){e=r}t=t.parent}throw e instanceof Error&&$e(e),e}function $e(e){const t=Fe.get(e);t&&(Y(e,"message",{value:t.message}),Y(e,"stack",{value:t.stack}))}const He="undefined"==typeof requestIdleCallback?e=>setTimeout(e,1):requestIdleCallback;let Ge=[],We=[];function Ye(){var e=Ge;Ge=[],ae(e)}function Qe(){var e=We;We=[],ae(e)}function Je(e){0===Ge.length&&queueMicrotask(Ye),Ge.push(e)}function Xe(){Ge.length>0&&Ye(),We.length>0&&Qe()}function Ze(){for(var e=xr.b;null!==e&&!e.has_pending_snippet();)e=e.parent;return null===e&&function(){throw new Error("https://svelte.dev/e/await_outside_boundary")}(),e}function et(e){var t=2050,r=null!==_r&&2&_r.f?_r:null;null===xr||null!==r&&0!==(r.f&le)?t|=le:xr.f|=me;return{ctx:Me,deps:null,effects:null,equals:Ue,f:t,fn:e,reactions:null,rv:0,v:F,wv:0,parent:r??xr,ac:null}}function tt(e,t){let r=xr;null===r&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var a=r.b,o=void 0,n=At(F),i=null,l=!_r;return function(e){Jt(4718592,e,!0)}(()=>{try{var t=e()}catch(v){t=Promise.reject(v)}var r=()=>t;o=(null==i?void 0:i.then(r,r))??Promise.resolve(t),i=o;var s=ut,c=a.pending;l&&(a.update_pending_count(1),c||s.increment());const u=(e,t=void 0)=>{i=null,c||s.activate(),t?t!==Se&&(n.f|=we,Nt(n,t)):(0!==(n.f&we)&&(n.f^=we),Nt(n,e)),l&&(a.update_pending_count(-1),c||s.decrement()),st()};if(o.then(u,e=>u(null,e||"unknown")),s)return()=>{queueMicrotask(()=>s.neuter())}}),new Promise(e=>{!function t(r){function a(){r===o?e(n):t(o)}r.then(a,a)}(o)})}function rt(e){const t=et(e);return kr(t),t}function at(e){const t=et(e);return t.equals=Ve,t}function ot(e){var t=e.effects;if(null!==t){e.effects=null;for(var r=0;r<t.length;r+=1)sr(t[r])}}function nt(e){var t,r=xr;Er(function(e){for(var t=e.parent;null!==t;){if(!(2&t.f))return t;t=t.parent}return null}(e));try{ot(e),t=Vr(e)}finally{Er(r)}return t}function it(e){var t=nt(e);(e.equals(t)||(e.v=t,e.wv=Dr()),br)||(null!==dt?dt.set(e,e.v):Hr(e,!Lr&&0===(e.f&le)||null===e.deps?ce:ve))}function lt(e,t,r){const a=et;if(0!==t.length){var o,n,i,l=ut,s=xr,c=(o=xr,n=_r,i=Me,function(){Er(o),Cr(n),Oe(i)}),u=Ze();Promise.all(t.map(e=>tt(e))).then(t=>{null==l||l.activate(),c();try{r([...e.map(a),...t])}catch(o){0===(s.f&pe)&&Ke(o,s)}null==l||l.deactivate(),st()}).catch(e=>{u.error(e)})}else r(e.map(a))}function st(){Er(null),Cr(null),Oe(null)}const ct=new Set;let ut=null,vt=null,dt=null,pt=new Set,ft=[];function ht(){const e=ft.shift();ft.length>0&&queueMicrotask(ht),e()}let gt=[],mt=null,bt=!1,yt=!1;r=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakMap,i=new WeakMap,l=new WeakMap,s=new WeakMap,c=new WeakMap,u=new WeakMap,v=new WeakMap,d=new WeakMap,p=new WeakMap,f=new WeakSet,h=function(e){var t;e.f^=ce;for(var r=e.first;null!==r;){var a=r.f,o=!!(96&a);if(!(o&&0!==(a&ce)||0!==(a&de)||this.skipped_effects.has(r))&&null!==r.fn){if(o)r.f^=ce;else if(0===(a&ce))if(4&a)E(this,u).push(r);else if(0!==(a&_e)){((null==(t=r.b)?void 0:t.pending)?E(this,s):E(this,l)).push(r)}else Ur(r)&&(0!==(r.f&oe)&&E(this,v).push(r),jr(r));var n=r.first;if(null!==n){r=n;continue}}var i=r.parent;for(r=r.next;null===r&&null!==i;)r=i.next,i=i.parent}},g=function(e){for(const t of e){(0!==(t.f&ue)?E(this,d):E(this,p)).push(t),Hr(t,ce)}e.length=0},m=function(){if(!E(this,i))for(const e of E(this,a))e();E(this,a).clear()};let _t=class e{constructor(){S(this,f),C(this,"current",new Map),S(this,r,new Map),S(this,a,new Set),S(this,o,0),S(this,n,null),S(this,i,!1),S(this,l,[]),S(this,s,[]),S(this,c,[]),S(this,u,[]),S(this,v,[]),S(this,d,[]),S(this,p,[]),C(this,"skipped_effects",new Set)}process(e){var t;gt=[],vt=null;var a=null;if(ct.size>1){a=new Map,dt=new Map;for(const[e,t]of this.current)a.set(e,{v:e.v,wv:e.wv}),e.v=t;for(const e of ct)if(e!==this)for(const[t,o]of E(e,r))a.has(t)||(a.set(t,{v:t.v,wv:t.wv}),t.v=o)}for(const r of e)A(this,f,h).call(this,r);if(0===E(this,l).length&&0===E(this,o)){A(this,f,m).call(this);var i=E(this,c),d=E(this,u);k(this,c,[]),k(this,u,[]),k(this,v,[]),vt=ut,ut=null,Et(i),Et(d),null===ut?ut=this:ct.delete(this),null==(t=E(this,n))||t.resolve()}else A(this,f,g).call(this,E(this,c)),A(this,f,g).call(this,E(this,u)),A(this,f,g).call(this,E(this,v));if(a){for(const[e,{v:t,wv:r}]of a)e.wv<=r&&(e.v=t);dt=null}for(const r of E(this,l))jr(r);for(const r of E(this,s))jr(r);k(this,l,[]),k(this,s,[])}capture(e,t){E(this,r).has(e)||E(this,r).set(e,t),this.current.set(e,e.v)}activate(){ut=this}deactivate(){ut=null,vt=null;for(const e of pt)if(pt.delete(e),e(),null!==ut)break}neuter(){k(this,i,!0)}flush(){gt.length>0?Ct():A(this,f,m).call(this),ut===this&&(0===E(this,o)&&ct.delete(this),this.deactivate())}increment(){k(this,o,E(this,o)+1)}decrement(){if(k(this,o,E(this,o)-1),0===E(this,o)){for(const e of E(this,d))Hr(e,ue),St(e);for(const e of E(this,p))Hr(e,ve),St(e);k(this,c,[]),k(this,u,[]),this.flush()}else this.deactivate()}add_callback(e){E(this,a).add(e)}settled(){return(E(this,n)??k(this,n,{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t})).promise;var e,t}static ensure(){if(null===ut){const t=ut=new e;ct.add(ut),yt||e.enqueue(()=>{ut===t&&t.flush()})}return ut}static enqueue(e){0===ft.length&&queueMicrotask(ht),ft.unshift(e)}};function wt(e){var t=yt;yt=!0;try{for(;;){if(Xe(),0===gt.length&&(null==ut||ut.flush(),0===gt.length))return void(mt=null);Ct()}}finally{yt=t}}function Ct(){var e=gr;bt=!0;try{var t=0;for(mr(!0);gt.length>0;){var r=_t.ensure();if(t++>1e3)K,xt();r.process(gt),kt.clear()}}finally{bt=!1,mr(e),mt=null}}function xt(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(e){Ke(e,mt)}}function Et(e){var t=e.length;if(0!==t){for(var r=0;r<t;){var a=e[r++];if(!(24576&a.f)&&Ur(a)){var o=ut?ut.current.size:0;if(jr(a),null===a.deps&&null===a.first&&null===a.nodes_start&&(null===a.teardown&&null===a.ac?ur(a):a.fn=null),null!==ut&&ut.current.size>o&&0!==(a.f&be))break}}for(;r<t;)St(e[r++])}}function St(e){for(var t=mt=e;null!==t.parent;){var r=(t=t.parent).f;if(bt&&t===xr&&0!==(r&oe))return;if(96&r){if(0===(r&ce))return;t.f^=ce}}gt.push(t)}const kt=new Map;function At(e,t){return{f:0,v:e,reactions:null,equals:Ue,rv:0,wv:0}}function Tt(e,t){const r=At(e);return kr(r),r}function It(e,t=!1,r=!0){const a=At(e);return t||(a.equals=Ve),a}function Bt(e,t,r=!1){return null===_r||wr&&0===(_r.f&ge)||!(4325394&_r.f)||(null==Sr?void 0:Sr.includes(e))||function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),Nt(e,r?Dt(t):t)}function Nt(e,t){if(!e.equals(t)){var r=e.v;br?kt.set(e,t):kt.set(e,r),e.v=t,_t.ensure().capture(e,r),2&e.f&&(0!==(e.f&ue)&&nt(e),Hr(e,0===(e.f&le)?ce:ve)),e.wv=Dr(),Lt(e,ue),null===xr||0===(xr.f&ce)||96&xr.f||(null===Ir?function(e){Ir=e}([e]):Ir.push(e))}return t}function Rt(e,t=1){var r=qr(e),a=1===t?r++:r--;return Bt(e,r),a}function zt(e){Bt(e,e.v+1)}function Lt(e,t){var r=e.reactions;if(null!==r)for(var a=r.length,o=0;o<a;o++){var n=r[o],i=n.f,l=0===(i&ue);l&&Hr(n,t),2&i?Lt(n,ve):l&&St(n)}}function Dt(e){if("object"!=typeof e||null===e||Ce in e)return e;const t=ee(e);if(t!==X&&t!==Z)return e;var r=new Map,a=$(e),o=Tt(0),n=Rr,i=e=>{if(Rr===n)return e();var t=_r,r=Rr;Cr(null),zr(n);var a=e();return Cr(t),zr(r),a};return a&&r.set("length",Tt(e.length)),new Proxy(e,{defineProperty(e,t,a){"value"in a&&!1!==a.configurable&&!1!==a.enumerable&&!1!==a.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var o=r.get(t);return void 0===o?o=i(()=>{var e=Tt(a.value);return r.set(t,e),e}):Bt(o,a.value,!0),!0},deleteProperty(e,t){var a=r.get(t);if(void 0===a){if(t in e){const e=i(()=>Tt(F));r.set(t,e),zt(o)}}else Bt(a,F),zt(o);return!0},get(t,a,o){var n;if(a===Ce)return e;var l=r.get(a),s=a in t;if(void 0!==l||s&&!(null==(n=Q(t,a))?void 0:n.writable)||(l=i(()=>Tt(Dt(s?t[a]:F))),r.set(a,l)),void 0!==l){var c=qr(l);return c===F?void 0:c}return Reflect.get(t,a,o)},getOwnPropertyDescriptor(e,t){var a=Reflect.getOwnPropertyDescriptor(e,t);if(a&&"value"in a){var o=r.get(t);o&&(a.value=qr(o))}else if(void 0===a){var n=r.get(t),i=null==n?void 0:n.v;if(void 0!==n&&i!==F)return{enumerable:!0,configurable:!0,value:i,writable:!0}}return a},has(e,t){var a;if(t===Ce)return!0;var o=r.get(t),n=void 0!==o&&o.v!==F||Reflect.has(e,t);if((void 0!==o||null!==xr&&(!n||(null==(a=Q(e,t))?void 0:a.writable)))&&(void 0===o&&(o=i(()=>Tt(n?Dt(e[t]):F)),r.set(t,o)),qr(o)===F))return!1;return n},set(e,t,n,l){var s,c=r.get(t),u=t in e;if(a&&"length"===t)for(var v=n;v<c.v;v+=1){var d=r.get(v+"");void 0!==d?Bt(d,F):v in e&&(d=i(()=>Tt(F)),r.set(v+"",d))}void 0===c?u&&!(null==(s=Q(e,t))?void 0:s.writable)||(Bt(c=i(()=>Tt(void 0)),Dt(n)),r.set(t,c)):(u=c.v!==F,Bt(c,i(()=>Dt(n))));var p=Reflect.getOwnPropertyDescriptor(e,t);if((null==p?void 0:p.set)&&p.set.call(l,n),!u){if(a&&"string"==typeof t){var f=r.get("length"),h=Number(t);Number.isInteger(h)&&h>=f.v&&Bt(f,h+1)}zt(o)}return!0},ownKeys(e){qr(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return void 0===t||t.v!==F});for(var[a,n]of r)n.v===F||a in e||t.push(a);return t},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function Ut(e){try{if(null!==e&&"object"==typeof e&&Ce in e)return e[Ce]}catch{}return e}function Pt(e,t){return Object.is(Ut(e),Ut(t))}var Vt,Mt,Ot,jt;function qt(){if(void 0===Vt){Vt=window,Mt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Ot=Q(t,"firstChild").get,jt=Q(t,"nextSibling").get,te(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),te(r)&&(r.__t=void 0)}}function Ft(e=""){return document.createTextNode(e)}function Kt(e){return Ot.call(e)}function $t(e){return jt.call(e)}function Ht(e,t){if(!Te)return Kt(e);var r=Kt(Ae);if(null===r)r=Ae.appendChild(Ft());else if(t&&3!==r.nodeType){var a=Ft();return null==r||r.before(a),Be(a),a}return Be(r),r}function Gt(e,t){if(!Te){var r=Kt(e);return r instanceof Comment&&""===r.data?$t(r):r}return Ae}function Wt(e,t=1,r=!1){let a=Te?Ae:e;for(var o;t--;)o=a,a=$t(a);if(!Te)return a;if(r&&3!==(null==a?void 0:a.nodeType)){var n=Ft();return null===a?null==o||o.after(n):a.before(n),Be(n),n}return Be(a),a}function Yt(e){e.textContent=""}function Qt(e){null===xr&&null===_r&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),null!==_r&&0!==(_r.f&le)&&null===xr&&function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}(),br&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function Jt(e,t,r,a=!0){var o=xr;null!==o&&0!==(o.f&de)&&(e|=de);var n={ctx:Me,deps:null,nodes_start:null,nodes_end:null,f:e|ue,first:null,fn:t,last:null,next:null,parent:o,b:o&&o.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{jr(n),n.f|=fe}catch(l){throw sr(n),l}else null!==t&&St(n);if(!(r&&null===n.deps&&null===n.first&&null===n.nodes_start&&null===n.teardown&&0===(n.f&me))&&a&&(null!==o&&function(e,t){var r=t.last;null===r?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}(n,o),null!==_r&&2&_r.f&&0===(e&ie))){var i=_r;(i.effects??(i.effects=[])).push(n)}return n}function Xt(e){const t=Jt(8,null,!1);return Hr(t,ce),t.teardown=e,t}function Zt(e){Qt();var t=xr.f;if(!(!_r&&0!==(t&ne)&&0===(t&fe)))return er(e);var r=Me;(r.e??(r.e=[])).push(e)}function er(e){return Jt(1048580,e,!1)}function tr(e){return Jt(4,e,!1)}function rr(e,t=0){return Jt(8|t,e,!0)}function ar(e,t=[],r=[]){lt(t,r,t=>{Jt(8,()=>e(...t.map(qr)),!0)})}function or(e,t=0){return Jt(oe|t,e,!0)}function nr(e,t=!0){return Jt(ne,e,!0,t)}function ir(e){var t=e.teardown;if(null!==t){const e=br,r=_r;yr(!0),Cr(null);try{t.call(null)}finally{yr(e),Cr(r)}}}function lr(e,t=!1){var r,a=e.first;for(e.first=e.last=null;null!==a;){null==(r=a.ac)||r.abort(Se);var o=a.next;0!==(a.f&ie)?a.parent=null:sr(a,t),a=o}}function sr(e,t=!0){var r=!1;(t||262144&e.f)&&null!==e.nodes_start&&null!==e.nodes_end&&(cr(e.nodes_start,e.nodes_end),r=!0),lr(e,t&&!r),Or(e,0),Hr(e,pe);var a=e.transitions;if(null!==a)for(const n of a)n.stop();ir(e);var o=e.parent;null!==o&&null!==o.first&&ur(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function cr(e,t){for(;null!==e;){var r=e===t?null:$t(e);e.remove(),e=r}}function ur(e){var t=e.parent,r=e.prev,a=e.next;null!==r&&(r.next=a),null!==a&&(a.prev=r),null!==t&&(t.first===e&&(t.first=a),t.last===e&&(t.last=r))}function vr(e,t){var r=[];pr(e,r,!0),dr(r,()=>{sr(e),t&&t()})}function dr(e,t){var r=e.length;if(r>0){var a=()=>--r||t();for(var o of e)o.out(a)}else t()}function pr(e,t,r){if(0===(e.f&de)){if(e.f^=de,null!==e.transitions)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var a=e.first;null!==a;){var o=a.next;pr(a,t,!!(0!==(a.f&he)||0!==(a.f&ne))&&r),a=o}}}function fr(e){hr(e,!0)}function hr(e,t){if(0!==(e.f&de)){e.f^=de,0===(e.f&ce)&&(Hr(e,ue),St(e));for(var r=e.first;null!==r;){var a=r.next;hr(r,!!(0!==(r.f&he)||0!==(r.f&ne))&&t),r=a}if(null!==e.transitions)for(const r of e.transitions)(r.is_global||t)&&r.in()}}let gr=!1;function mr(e){gr=e}let br=!1;function yr(e){br=e}let _r=null,wr=!1;function Cr(e){_r=e}let xr=null;function Er(e){xr=e}let Sr=null;function kr(e){null!==_r&&(null===Sr?Sr=[e]:Sr.push(e))}let Ar=null,Tr=0,Ir=null;let Br=1,Nr=0,Rr=Nr;function zr(e){Rr=e}let Lr=!1;function Dr(){return++Br}function Ur(e){var t,r=e.f;if(0!==(r&ue))return!0;if(0!==(r&ve)){var a=e.deps,o=0!==(r&le);if(null!==a){var n,i,l=0!==(r&se),s=o&&null!==xr&&!Lr,c=a.length;if((l||s)&&(null===xr||0===(xr.f&pe))){var u=e,v=u.parent;for(n=0;n<c;n++)i=a[n],!l&&(null==(t=null==i?void 0:i.reactions)?void 0:t.includes(u))||(i.reactions??(i.reactions=[])).push(u);l&&(u.f^=se),s&&null!==v&&0===(v.f&le)&&(u.f^=le)}for(n=0;n<c;n++)if(Ur(i=a[n])&&it(i),i.wv>e.wv)return!0}o&&(null===xr||Lr)||Hr(e,ce)}return!1}function Pr(e,t,r=!0){var a=e.reactions;if(null!==a&&!(null==Sr?void 0:Sr.includes(e)))for(var o=0;o<a.length;o++){var n=a[o];2&n.f?Pr(n,t,!1):t===n&&(r?Hr(n,ue):0!==(n.f&ce)&&Hr(n,ve),St(n))}}function Vr(e){var t,r=Ar,a=Tr,o=Ir,n=_r,i=Lr,l=Sr,s=Me,c=wr,u=Rr,v=e.f;Ar=null,Tr=0,Ir=null,Lr=0!==(v&le)&&(wr||!gr||null===_r),_r=96&v?null:e,Sr=null,Oe(e.ctx),wr=!1,Rr=++Nr,null!==e.ac&&(e.ac.abort(Se),e.ac=null);try{e.f|=ye;var d=(0,e.fn)(),p=e.deps;if(null!==Ar){var f;if(Or(e,Tr),null!==p&&Tr>0)for(p.length=Tr+Ar.length,f=0;f<Ar.length;f++)p[Tr+f]=Ar[f];else e.deps=p=Ar;if(!Lr||2&v&&null!==e.reactions)for(f=Tr;f<p.length;f++)((t=p[f]).reactions??(t.reactions=[])).push(e)}else null!==p&&Tr<p.length&&(Or(e,Tr),p.length=Tr);if(!(null===Ir||wr||null===p||6146&e.f))for(f=0;f<Ir.length;f++)Pr(Ir[f],e);return null!==n&&n!==e&&(Nr++,null!==Ir&&(null===o?o=Ir:o.push(...Ir))),0!==(e.f&we)&&(e.f^=we),d}catch(h){return function(e){var t=xr;if(null===t)return _r.f|=we,e;if(0===(t.f&fe)){if(!(128&t.f))throw!t.parent&&e instanceof Error&&$e(e),e;t.b.error(e)}else Ke(e,t)}(h)}finally{e.f^=ye,Ar=r,Tr=a,Ir=o,_r=n,Lr=i,Sr=l,Oe(s),wr=c,Rr=u}}function Mr(e,t){let r=t.reactions;if(null!==r){var a=H.call(r,e);if(-1!==a){var o=r.length-1;0===o?r=t.reactions=null:(r[a]=r[o],r.pop())}}null===r&&2&t.f&&(null===Ar||!Ar.includes(t))&&(Hr(t,ve),768&t.f||(t.f^=se),ot(t),Or(t,0))}function Or(e,t){var r=e.deps;if(null!==r)for(var a=t;a<r.length;a++)Mr(e,r[a])}function jr(e){var t=e.f;if(0===(t&pe)){Hr(e,ce);var r=xr,a=gr;xr=e,gr=!0;try{0!==(t&oe)?function(e){for(var t=e.first;null!==t;){var r=t.next;0===(t.f&ne)&&sr(t),t=r}}(e):lr(e),ir(e);var o=Vr(e);e.teardown="function"==typeof o?o:null,e.wv=Br}finally{gr=a,xr=r}}}function qr(e){var t=!!(2&e.f);if(null===_r||wr){if(t&&null===e.deps&&null===e.effects){var r=e,a=r.parent;null!==a&&0===(a.f&le)&&(r.f^=le)}}else if(!(null!==xr&&0!==(xr.f&pe))&&!(null==Sr?void 0:Sr.includes(e))){var o=_r.deps;if(0!==(_r.f&ye))e.rv<Nr&&(e.rv=Nr,null===Ar&&null!==o&&o[Tr]===e?Tr++:null===Ar?Ar=[e]:Lr&&Ar.includes(e)||Ar.push(e));else{(_r.deps??(_r.deps=[])).push(e);var n=e.reactions;null===n?e.reactions=[_r]:n.includes(_r)||n.push(_r)}}if(br){if(kt.has(e))return kt.get(e);if(t){var i=(r=e).v;return(0===(r.f&ce)&&null!==r.reactions||Fr(r))&&(i=nt(r)),kt.set(r,i),i}}else if(t){if(r=e,null==dt?void 0:dt.has(r))return dt.get(r);Ur(r)&&it(r)}if(0!==(e.f&we))throw e.v;return e.v}function Fr(e){if(e.v===F)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(kt.has(t))return!0;if(2&t.f&&Fr(t))return!0}return!1}function Kr(e){var t=wr;try{return wr=!0,e()}finally{wr=t}}const $r=-7169;function Hr(e,t){e.f=e.f&$r|t}function Gr(e,t){if(t){const t=document.body;e.autofocus=!0,Je(()=>{document.activeElement===t&&e.focus()})}}let Wr=!1;function Yr(){Wr||(Wr=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)null==(t=r.__on_r)||t.call(r)})},{capture:!0}))}function Qr(e){var t=_r,r=xr;Cr(null),Er(null);try{return e()}finally{Cr(t),Er(r)}}function Jr(e,t,r,a=r){e.addEventListener(t,()=>Qr(r));const o=e.__on_r;e.__on_r=o?()=>{o(),a(!0)}:()=>a(!0),Yr()}const Xr=new Set,Zr=new Set;function ea(e,t,r,a={}){function o(e){if(a.capture||aa.call(t,e),!e.cancelBubble)return Qr(()=>null==r?void 0:r.call(this,e))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?Je(()=>{t.addEventListener(e,o,a)}):t.addEventListener(e,o,a),o}function ta(e,t,r,a,o){var n={capture:a,passive:o},i=ea(e,t,r,n);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Xt(()=>{t.removeEventListener(e,i,n)})}function ra(e){for(var t=0;t<e.length;t++)Xr.add(e[t]);for(var r of Zr)r(e)}function aa(e){var t,r=this,a=r.ownerDocument,o=e.type,n=(null==(t=e.composedPath)?void 0:t.call(e))||[],i=n[0]||e.target,l=0,s=e.__root;if(s){var c=n.indexOf(s);if(-1!==c&&(r===document||r===window))return void(e.__root=r);var u=n.indexOf(r);if(-1===u)return;c<=u&&(l=c)}if((i=n[l]||e.target)!==r){Y(e,"currentTarget",{configurable:!0,get:()=>i||a});var v=_r,d=xr;Cr(null),Er(null);try{for(var p,f=[];null!==i;){var h=i.assignedSlot||i.parentNode||i.host||null;try{var g=i["__"+o];if(null!=g&&(!i.disabled||e.target===i))if($(g)){var[m,...b]=g;m.apply(i,[e,...b])}else g.call(i,e)}catch(y){p?f.push(y):p=y}if(e.cancelBubble||h===r||null===h)break;i=h}if(p){for(let e of f)queueMicrotask(()=>{throw e});throw p}}finally{e.__root=r,delete e.currentTarget,Cr(v),Er(d)}}}function oa(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),t.content}function na(e,t){var r=xr;null===r.nodes_start&&(r.nodes_start=e,r.nodes_end=t)}function ia(e,t){var r,a=!!(1&t),o=!!(2&t),n=!e.startsWith("<!>");return()=>{if(Te)return na(Ae,null),Ae;void 0===r&&(r=oa(n?e:"<!>"+e),a||(r=Kt(r)));var t=o||Mt?document.importNode(r,!0):r.cloneNode(!0);a?na(Kt(t),t.lastChild):na(t,t);return t}}function la(e,t,r="svg"){var a,o=`<${r}>${!e.startsWith("<!>")?e:"<!>"+e}</${r}>`;return()=>{if(Te)return na(Ae,null),Ae;if(!a){var e=oa(o);a=Kt(Kt(e))}var t=a.cloneNode(!0);return na(t,t),t}}function sa(e,t){return la(e,0,"svg")}function ca(e=""){if(!Te){var t=Ft(e+"");return na(t,t),t}var r=Ae;return 3!==r.nodeType&&(r.before(r=Ft()),Be(r)),na(r,r),r}function ua(){if(Te)return na(Ae,null),Ae;var e=document.createDocumentFragment(),t=document.createComment(""),r=Ft();return e.append(t,r),na(t,r),e}function va(e,t){if(Te)return xr.nodes_end=Ae,void Ne();null!==e&&e.before(t)}function da(e){return e.endsWith("capture")&&"gotpointercapture"!==e&&"lostpointercapture"!==e}const pa=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function fa(e){return pa.includes(e)}const ha={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function ga(e){return e=e.toLowerCase(),ha[e]??e}const ma=["touchstart","touchmove"];function ba(e){return ma.includes(e)}const ya=["textarea","script","style","title"];let _a=!0;function wa(e){_a=e}function Ca(e,t){var r=null==t?"":"object"==typeof t?t+"":t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=r+"")}function xa(e,t){return ka(e,t)}function Ea(e,t){qt(),t.intro=t.intro??!1;const r=t.target,a=Te,o=Ae;try{for(var n=Kt(r);n&&(8!==n.nodeType||"["!==n.data);)n=$t(n);if(!n)throw q;Ie(!0),Be(n),Ne();const a=ka(e,{...t,anchor:n});if(null===Ae||8!==Ae.nodeType||"]"!==Ae.data)throw q;return Ie(!1),a}catch(i){if(i===q)return!1===t.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),qt(),Yt(r),Ie(!1),xa(e,t);throw i}finally{Ie(a),Be(o)}}const Sa=new Map;function ka(e,{target:t,anchor:r,props:a={},events:o,context:n,intro:i=!0}){qt();var l=new Set,s=e=>{for(var r=0;r<e.length;r++){var a=e[r];if(!l.has(a)){l.add(a);var o=ba(a);t.addEventListener(a,aa,{passive:o});var n=Sa.get(a);void 0===n?(document.addEventListener(a,aa,{passive:o}),Sa.set(a,1)):Sa.set(a,n+1)}}};s(G(Xr)),Zr.add(s);var c=void 0,u=function(e){_t.ensure();const t=Jt(ie,e,!0);return(e={})=>new Promise(r=>{e.outro?vr(t,()=>{sr(t),r(void 0)}):(sr(t),r(void 0))})}(()=>{var u=r??t.appendChild(Ft());return nr(()=>{n&&(je({}),Me.c=n);o&&(a.$$events=o),Te&&na(u,null),_a=i,c=e(u,a)||{},_a=!0,Te&&(xr.nodes_end=Ae),n&&qe()}),()=>{var e;for(var a of l){t.removeEventListener(a,aa);var o=Sa.get(a);0===--o?(document.removeEventListener(a,aa),Sa.delete(a)):Sa.set(a,o)}Zr.delete(s),u!==r&&(null==(e=u.parentNode)||e.removeChild(u))}});return Aa.set(c,u),c}let Aa=new WeakMap;function Ta(e){null===Me&&ke(),Zt(()=>{const t=Kr(e);if("function"==typeof t)return t})}function Ia(){const e=Me;return null===e&&ke(),(t,r,a)=>{var o;const n=null==(o=e.s.$$events)?void 0:o[t];if(n){const o=$(n)?n.slice():[n],i=function(e,t,{bubbles:r=!1,cancelable:a=!1}={}){return new CustomEvent(e,{detail:t,bubbles:r,cancelable:a})}(t,r,a);for(const t of o)t.call(e.x,i);return!i.defaultPrevented}return!0}}function Ba(e,t,r=!1){Te&&Ne();var a=e,o=null,n=null,i=F,l=!1;const s=(e,t=!0)=>{l=!0,v(t,e)};var c=null;function u(){null!==c&&(c.lastChild.remove(),a.before(c),c=null);var e=i?o:n,t=i?n:o;e&&fr(e),t&&vr(t,()=>{i?n=null:o=null})}const v=(e,t)=>{if(i===(i=e))return;let r=!1;if(Te){const e=De(a)===j;!!i===e&&(Be(a=Le()),Ie(!1),r=!0)}var l=!1,s=a;i?o??(o=t&&nr(()=>t(s))):n??(n=t&&nr(()=>t(s))),u(),r&&Ie(!0)};or(()=>{l=!1,t(s),l||v(null,null)},r?he:0),Te&&(a=Ae)}function Na(e,t){return t}function Ra(e,t,r,a,o,n=null){var i=e,l={flags:t,items:new Map,first:null};if(!!(4&t)){var s=e;i=Te?Be(Kt(s)):s.appendChild(Ft())}Te&&Ne();var c,u,v=null,d=!1,p=new Map,f=at(()=>{var e=r();return $(e)?e:null==e?[]:G(e)});function h(){!function(e,t,r,a,o,n,i,l,s){var c,u,v,d,p,f,h,g,m,b,y=!!(8&i),_=!!(3&i),w=t.length,C=r.items,x=r.first,E=x,S=null,k=[],A=[];if(y)for(b=0;b<w;b+=1)g=l(h=t[b],b),void 0!==(m=C.get(g))&&(null==(c=m.a)||c.measure(),(f??(f=new Set)).add(m));for(b=0;b<w;b+=1)if(g=l(h=t[b],b),void 0!==(m=C.get(g))){if(_&&za(m,h,b,i),0!==(m.e.f&de)&&(fr(m.e),y&&(null==(u=m.a)||u.unfix(),(f??(f=new Set)).delete(m))),m!==E){if(void 0!==p&&p.has(m)){if(k.length<A.length){var T,I=A[0];S=I.prev;var B=k[0],N=k[k.length-1];for(T=0;T<k.length;T+=1)Da(k[T],I,o);for(T=0;T<A.length;T+=1)p.delete(A[T]);Ua(r,B.prev,N.next),Ua(r,S,B),Ua(r,N,I),E=I,S=N,b-=1,k=[],A=[]}else p.delete(m),Da(m,E,o),Ua(r,m.prev,m.next),Ua(r,m,null===S?r.first:S.next),Ua(r,S,m),S=m;continue}for(k=[],A=[];null!==E&&E.k!==g;)0===(E.e.f&de)&&(p??(p=new Set)).add(E),A.push(E),E=E.next;if(null===E)continue;m=E}k.push(m),S=m,E=m.next}else{var R=a.get(g);if(void 0!==R){a.delete(g),C.set(g,R);var z=S?S.next:E;Ua(r,S,R),Ua(r,R,z),Da(R,z,o),S=R}else{S=La(E?E.e.nodes_start:o,r,S,null===S?r.first:S.next,h,g,b,n,i,s)}C.set(g,S),k=[],A=[],E=S.next}if(null!==E||void 0!==p){for(var L=void 0===p?[]:G(p);null!==E;)0===(E.e.f&de)&&L.push(E),E=E.next;var D=L.length;if(D>0){var U=4&i&&0===w?o:null;if(y){for(b=0;b<D;b+=1)null==(v=L[b].a)||v.measure();for(b=0;b<D;b+=1)null==(d=L[b].a)||d.fix()}!function(e,t,r){for(var a=e.items,o=[],n=t.length,i=0;i<n;i++)pr(t[i].e,o,!0);var l=n>0&&0===o.length&&null!==r;if(l){var s=r.parentNode;Yt(s),s.append(r),a.clear(),Ua(e,t[0].prev,t[n-1].next)}dr(o,()=>{for(var r=0;r<n;r++){var o=t[r];l||(a.delete(o.k),Ua(e,o.prev,o.next)),sr(o.e,!l)}})}(r,L,U)}}y&&Je(()=>{var e;if(void 0!==f)for(m of f)null==(e=m.a)||e.apply()});for(var P of(e.first=r.first&&r.first.e,e.last=S&&S.e,a.values()))sr(P.e);a.clear()}(u,c,l,p,i,o,t,a,r),null!==n&&(0===c.length?v?fr(v):v=nr(()=>n(i)):null!==v&&vr(v,()=>{v=null}))}or(()=>{u??(u=xr);var e=(c=qr(f)).length;if(d&&0===e)return;d=0===e;let s=!1;Te&&(De(i)===j!==(0===e)&&(Be(i=Le()),Ie(!1),s=!0));if(Te){for(var p,g=null,m=0;m<e;m++){if(8===Ae.nodeType&&"]"===Ae.data){i=Ae,s=!0,Ie(!1);break}var b=c[m],y=a(b,m);p=La(Ae,l,g,null,b,y,m,o,t,r),l.items.set(y,p),g=p}e>0&&Be(Le())}Te?0===e&&n&&(v=nr(()=>n(i))):h();s&&Ie(!0),qr(f)}),Te&&(i=Ae)}function za(e,t,r,a){1&a&&Nt(e.v,t),2&a?Nt(e.i,r):e.i=r}function La(e,t,r,a,o,n,i,l,s,c,u){var v=!!(1&s)?!(16&s)?It(o,!1,!1):At(o):o,d=2&s?At(i):i,p={i:d,v:v,k:n,a:null,e:null,prev:r,next:a};try{if(null===e)document.createDocumentFragment().append(e=Ft());return p.e=nr(()=>l(e,v,d,c),Te),p.e.prev=r&&r.e,p.e.next=a&&a.e,null===r?u||(t.first=p):(r.next=p,r.e.next=p.e),null!==a&&(a.prev=p,a.e.prev=p.e),p}finally{}}function Da(e,t,r){for(var a=e.next?e.next.e.nodes_start:r,o=t?t.e.nodes_start:r,n=e.e.nodes_start;null!==n&&n!==a;){var i=$t(n);o.before(n),n=i}}function Ua(e,t,r){null===t?e.first=r:(t.next=r,t.e.next=r&&r.e),null!==r&&(r.prev=t,r.e.prev=t&&t.e)}function Pa(e,t,r=!1,a=!1,o=!1){var n=e,i="";ar(()=>{var e=xr;if(i!==(i=t()??"")){if(null!==e.nodes_start&&(cr(e.nodes_start,e.nodes_end),e.nodes_start=e.nodes_end=null),""!==i){if(Te){Ae.data;for(var o=Ne(),l=o;null!==o&&(8!==o.nodeType||""!==o.data);)l=o,o=$t(o);if(null===o)throw q;return na(Ae,l),void(n=Be(o))}var s=i+"";r?s=`<svg>${s}</svg>`:a&&(s=`<math>${s}</math>`);var c=oa(s);if((r||a)&&(c=Kt(c)),na(Kt(c),c.lastChild),r||a)for(;Kt(c);)n.before(Kt(c));else n.before(c)}}else Te&&Ne()})}function Va(e,t,r,a,o){var n;Te&&Ne();var i=null==(n=t.$$slots)?void 0:n[r],l=!1;!0===i&&(i=t["default"===r?"children":r],l=!0),void 0===i||i(e,l?()=>a:a)}function Ma(e,t,r,a,o,n){let i=Te;var l,s;Te&&Ne();var c=null;Te&&1===Ae.nodeType&&(c=Ae,Ne());var u,v=Te?Ae:e;or(()=>{const e=t()||null;var r="svg"===e?"http://www.w3.org/2000/svg":null;e!==l&&(u&&(null===e?vr(u,()=>{u=null,s=null}):e===s?fr(u):(sr(u),wa(!1))),e&&e!==s&&(u=nr(()=>{if(na(c=Te?c:r?document.createElementNS(r,e):document.createElement(e),c),a){Te&&(o=e,ya.includes(o))&&c.append(document.createComment(""));var t=Te?Kt(c):c.appendChild(Ft());Te&&(null===t?Ie(!1):Be(t)),a(c,t)}var o;xr.nodes_end=c,v.before(c)})),(l=e)&&(s=l),wa(!0))},he),i&&(Ie(!0),Be(v))}function Oa(e,t){tr(()=>{var r=e.getRootNode(),a=r.host?r:r.head??r.ownerDocument.head;if(!a.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,a.appendChild(e)}})}function ja(e,t){var r,a=void 0;or(()=>{a!==(a=t())&&(r&&(sr(r),r=null),a&&(r=nr(()=>{tr(()=>a(e))})))})}function qa(e){var t,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=qa(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function Fa(e){return"object"==typeof e?function(){for(var e,t,r=0,a="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=qa(e))&&(a&&(a+=" "),a+=t);return a}(e):e??""}const Ka=[..." \t\n\r\f \v\ufeff"];function $a(e,t=!1){var r=t?" !important;":";",a="";for(var o in e){var n=e[o];null!=n&&""!==n&&(a+=" "+o+": "+n+r)}return a}function Ha(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function Ga(e,t,r,a,o,n){var i=e.__className;if(Te||i!==r||void 0===i){var l=function(e,t,r){var a=null==e?"":""+e;if(t&&(a=a?a+" "+t:t),r)for(var o in r)if(r[o])a=a?a+" "+o:o;else if(a.length)for(var n=o.length,i=0;(i=a.indexOf(o,i))>=0;){var l=i+n;0!==i&&!Ka.includes(a[i-1])||l!==a.length&&!Ka.includes(a[l])?i=l:a=(0===i?"":a.substring(0,i))+a.substring(l+1)}return""===a?null:a}(r,a,n);Te&&l===e.getAttribute("class")||(null==l?e.removeAttribute("class"):t?e.className=l:e.setAttribute("class",l)),e.__className=r}else if(n&&o!==n)for(var s in n){var c=!!n[s];null!=o&&c===!!o[s]||e.classList.toggle(s,c)}return n}function Wa(e,t={},r,a){for(var o in r){var n=r[o];t[o]!==n&&(null==r[o]?e.style.removeProperty(o):e.style.setProperty(o,n,a))}}function Ya(e,t,r,a){var o=e.__style;if(Te||o!==t){var n=function(e,t){if(t){var r,a,o="";if(Array.isArray(t)?(r=t[0],a=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var n=!1,i=0,l=!1,s=[];r&&s.push(...Object.keys(r).map(Ha)),a&&s.push(...Object.keys(a).map(Ha));var c=0,u=-1;const t=e.length;for(var v=0;v<t;v++){var d=e[v];if(l?"/"===d&&"*"===e[v-1]&&(l=!1):n?n===d&&(n=!1):"/"===d&&"*"===e[v+1]?l=!0:'"'===d||"'"===d?n=d:"("===d?i++:")"===d&&i--,!l&&!1===n&&0===i)if(":"===d&&-1===u)u=v;else if(";"===d||v===t-1){if(-1!==u){var p=Ha(e.substring(c,u).trim());s.includes(p)||(";"!==d&&v++,o+=" "+e.substring(c,v).trim()+";")}c=v+1,u=-1}}}return r&&(o+=$a(r)),a&&(o+=$a(a,!0)),""===(o=o.trim())?null:o}return null==e?null:String(e)}(t,a);Te&&n===e.getAttribute("style")||(null==n?e.removeAttribute("style"):e.style.cssText=n),e.__style=t}else a&&(Array.isArray(a)?(Wa(e,null==r?void 0:r[0],a[0]),Wa(e,null==r?void 0:r[1],a[1],"important")):Wa(e,r,a));return a}function Qa(e,t,r=!1){if(e.multiple){if(null==t)return;if(!$(t))return;for(var a of e.options)a.selected=t.includes(Xa(a))}else{for(a of e.options){if(Pt(Xa(a),t))return void(a.selected=!0)}r&&void 0===t||(e.selectedIndex=-1)}}function Ja(e){var t=new MutationObserver(()=>{Qa(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Xt(()=>{t.disconnect()})}function Xa(e){return"__value"in e?e.__value:e.value}const Za=Symbol("class"),eo=Symbol("style"),to=Symbol("is custom element"),ro=Symbol("is html");function ao(e){if(Te){var t,r=!1,a=()=>{if(!r){if(r=!0,e.hasAttribute("value")){var t=e.value;lo(e,"value",null),e.value=t}if(e.hasAttribute("checked")){var a=e.checked;lo(e,"checked",null),e.checked=a}}};e.__on_r=a,t=a,0===We.length&&He(Qe),We.push(t),Yr()}}function oo(e,t){var r=uo(e);r.value!==(r.value=t??void 0)&&(e.value!==t||0===t&&"PROGRESS"===e.nodeName)&&(e.value=t??"")}function no(e,t){var r=uo(e);r.checked!==(r.checked=t??void 0)&&(e.checked=t)}function io(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function lo(e,t,r,a){var o=uo(e);Te&&(o[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)||o[t]!==(o[t]=r)&&("loading"===t&&(e[Ee]=r),null==r?e.removeAttribute(t):"string"!=typeof r&&po(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function so(e,t,r){var a=_r,o=xr;let n=Te;Te&&Ie(!1),Cr(null),Er(null);try{"style"!==t&&(vo.has(e.nodeName)||!customElements||customElements.get(e.tagName.toLowerCase())?po(e).includes(t):r&&"object"==typeof r)?e[t]=r:lo(e,t,null==r?r:String(r))}finally{Cr(a),Er(o),n&&Ie(!0)}}function co(e,t,r=[],a=[],o,n=!1){lt(r,a,r=>{var a=void 0,i={},l="SELECT"===e.nodeName,s=!1;if(or(()=>{var c=t(...r.map(qr)),u=function(e,t,r,a){var o=uo(e),n=o[to],i=!o[ro];let l=Te&&n;l&&Ie(!1);var s=t||{},c="OPTION"===e.tagName;for(var u in t)u in r||(r[u]=null);r.class?r.class=Fa(r.class):r.class=null,r[eo]&&(r.style??(r.style=null));var v=po(e);for(const m in r){let l=r[m];if(c&&"value"===m&&null==l)e.value=e.__value="",s[m]=l;else if("class"!==m)if("style"!==m){var d=s[m];if(l!==d||void 0===l&&e.hasAttribute(m)){s[m]=l;var p=m[0]+m[1];if("$$"!==p)if("on"===p){const t={},r="$$"+m;let a=m.slice(2);var f=fa(a);if(da(a)&&(a=a.slice(0,-7),t.capture=!0),!f&&d){if(null!=l)continue;e.removeEventListener(a,s[r],t),s[r]=null}if(null!=l)if(f)e[`__${a}`]=l,ra([a]);else{let o=function(e){s[m].call(this,e)};s[r]=ea(a,e,o,t)}else f&&(e[`__${a}`]=void 0)}else if("style"===m)lo(e,m,l);else if("autofocus"===m)Gr(e,Boolean(l));else if(n||"__value"!==m&&("value"!==m||null==l))if("selected"===m&&c)io(e,l);else{var h=m;i||(h=ga(h));var g="defaultValue"===h||"defaultChecked"===h;if(null!=l||n||g)g||v.includes(h)&&(n||"string"!=typeof l)?e[h]=l:"function"!=typeof l&&lo(e,h,l);else if(o[m]=null,"value"===h||"checked"===h){let r=e;const a=void 0===t;if("value"===h){let e=r.defaultValue;r.removeAttribute(h),r.defaultValue=e,r.value=r.__value=a?e:null}else{let e=r.defaultChecked;r.removeAttribute(h),r.defaultChecked=e,r.checked=!!a&&e}}else e.removeAttribute(m)}else e.value=e.__value=l}}else Ya(e,l,null==t?void 0:t[eo],r[eo]),s[m]=l,s[eo]=r[eo];else Ga(e,"http://www.w3.org/1999/xhtml"===e.namespaceURI,l,a,null==t?void 0:t[Za],r[Za]),s[m]=l,s[Za]=r[Za]}return l&&Ie(!0),s}(e,a,c,o,n);s&&l&&"value"in c&&Qa(e,c.value);for(let e of Object.getOwnPropertySymbols(i))c[e]||sr(i[e]);for(let t of Object.getOwnPropertySymbols(c)){var v=c[t];"@attach"!==t.description||a&&v===a[t]||(i[t]&&sr(i[t]),i[t]=nr(()=>ja(e,()=>v))),u[t]=v}a=u}),l){var c=e;tr(()=>{Qa(c,a.value,!0),Ja(c)})}s=!0})}function uo(e){return e.__attributes??(e.__attributes={[to]:e.nodeName.includes("-"),[ro]:"http://www.w3.org/1999/xhtml"===e.namespaceURI})}var vo=new Map;function po(e){var t,r=vo.get(e.nodeName);if(r)return r;vo.set(e.nodeName,r=[]);for(var a=e,o=Element.prototype;o!==a;){for(var n in t=J(a))t[n].set&&r.push(n);a=ee(a)}return r}const fo={tick:e=>requestAnimationFrame(e),now:()=>performance.now(),tasks:new Set};function ho(){const e=fo.now();fo.tasks.forEach(t=>{t.c(e)||(fo.tasks.delete(t),t.f())}),0!==fo.tasks.size&&fo.tick(ho)}function go(e,t){Qr(()=>{e.dispatchEvent(new CustomEvent(t))})}function mo(e){if("float"===e)return"cssFloat";if("offset"===e)return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return 1===t.length?t[0]:t[0]+t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function bo(e){const t={},r=e.split(";");for(const a of r){const[e,r]=a.split(":");if(!e||void 0===r)break;t[mo(e.trim())]=r.trim()}return t}const yo=e=>e;function _o(e,t,r,a){var o,n,i,l=!!(1&e),s=!!(2&e),c=!!(4&e),u=l&&s?"both":l?"in":"out",v=t.inert,d=t.style.overflow;function p(){return Qr(()=>o??(o=r()(t,(null==a?void 0:a())??{},{direction:u})))}var f={is_global:c,in(){var e;if(t.inert=v,!l)return null==i||i.abort(),void(null==(e=null==i?void 0:i.reset)||e.call(i));s||null==n||n.abort(),go(t,"introstart"),n=wo(t,p(),i,1,()=>{go(t,"introend"),null==n||n.abort(),n=o=void 0,t.style.overflow=d})},out(e){if(!s)return null==e||e(),void(o=void 0);t.inert=!0,go(t,"outrostart"),i=wo(t,p(),n,0,()=>{go(t,"outroend"),null==e||e()})},stop:()=>{null==n||n.abort(),null==i||i.abort()}},h=xr;if((h.transitions??(h.transitions=[])).push(f),l&&_a){var g=c;if(!g){for(var m=h.parent;m&&0!==(m.f&he);)for(;(m=m.parent)&&0===(m.f&oe););g=!m||0!==(m.f&fe)}g&&tr(()=>{Kr(()=>f.in())})}}function wo(e,t,r,a,o){var n=1===a;if("function"==typeof t){var i,l=!1;return Je(()=>{if(!l){var s=t({direction:n?"in":"out"});i=wo(e,s,r,a,o)}}),{abort:()=>{l=!0,null==i||i.abort()},deactivate:()=>i.deactivate(),reset:()=>i.reset(),t:()=>i.t()}}if(null==r||r.deactivate(),!(null==t?void 0:t.duration))return o(),{abort:re,deactivate:re,reset:re,t:()=>a};const{delay:s=0,css:c,tick:u,easing:v=yo}=t;var d=[];if(n&&void 0===r&&(u&&u(0,1),c)){var p=bo(c(0,1));d.push(p,p)}var f=()=>1-a,h=e.animate(d,{duration:s,fill:"forwards"});return h.onfinish=()=>{h.cancel();var n=(null==r?void 0:r.t())??1-a;null==r||r.abort();var i=a-n,l=t.duration*Math.abs(i),s=[];if(l>0){var d=!1;if(c)for(var p=Math.ceil(l/(1e3/60)),g=0;g<=p;g+=1){var m=n+i*v(g/p),b=bo(c(m,1-m));s.push(b),d||(d="hidden"===b.overflow)}d&&(e.style.overflow="hidden"),f=()=>{var e=h.currentTime;return n+i*v(e/l)},u&&function(e){let t;0===fo.tasks.size&&fo.tick(ho),new Promise(r=>{fo.tasks.add(t={c:e,f:r})})}(()=>{if("running"!==h.playState)return!1;var e=f();return u(e,1-e),!0})}(h=e.animate(s,{duration:l,fill:"forwards"})).onfinish=()=>{f=()=>a,null==u||u(a,1-a),o()}},{abort:()=>{h&&(h.cancel(),h.effect=null,h.onfinish=re)},deactivate:()=>{o=re},reset:()=>{0===a&&(null==u||u(1,0))},t:()=>f()}}function Co(e,t,r=t){var a=new WeakSet;Jr(e,"input",o=>{var n=o?e.defaultValue:e.value;if(n=xo(e)?Eo(n):n,r(n),null!==ut&&a.add(ut),n!==(n=t())){var i=e.selectionStart,l=e.selectionEnd;e.value=n??"",null!==l&&(e.selectionStart=i,e.selectionEnd=Math.min(l,e.value.length))}}),(Te&&e.defaultValue!==e.value||null==Kr(t)&&e.value)&&(r(xo(e)?Eo(e.value):e.value),null!==ut&&a.add(ut)),rr(()=>{var r=t();if(e===document.activeElement){var o=vt??ut;if(a.has(o))return}xo(e)&&r===Eo(e.value)||("date"!==e.type||r||e.value)&&r!==e.value&&(e.value=r??"")})}function xo(e){var t=e.type;return"number"===t||"range"===t}function Eo(e){return""===e?null:+e}function So(e,t){return e===t||(null==e?void 0:e[Ce])===t}function ko(e={},t,r,a){return tr(()=>{var a,o;return rr(()=>{a=o,o=[],Kr(()=>{e!==r(...o)&&(t(e,...o),a&&So(r(...a),e)&&t(null,...a))})}),()=>{Je(()=>{o&&So(r(...o),e)&&t(null,...o)})}}),e}function Ao(e,t,r){if(null==e)return t(void 0),re;const a=Kr(()=>e.subscribe(t,r));return a.unsubscribe?()=>a.unsubscribe():a}const To=[];let Io,Bo=!1,No=Symbol();function Ro(e,t,r){const a=r[t]??(r[t]={store:null,source:It(void 0),unsubscribe:re});if(a.store!==e&&!(No in r))if(a.unsubscribe(),a.store=e??null,null==e)a.source.v=void 0,a.unsubscribe=re;else{var o=!0;a.unsubscribe=Ao(e,e=>{o?a.source.v=e:Bt(a.source,e)}),o=!1}return e&&No in r?function(e){let t;return Ao(e,e=>t=e)(),t}(e):qr(a.source)}function zo(e,t,r,a){var o,n,i,l=!!(8&r),s=!!(16&r),c=a,u=!0,v=()=>(u&&(u=!1,c=s?Kr(a):a),c);if(l){var d=Ce in e||xe in e;n=(null==(o=Q(e,t))?void 0:o.set)??(d&&t in e?r=>e[t]=r:void 0)}var p,f=!1;if(l?[i,f]=function(e){var t=Bo;try{return Bo=!1,[e(),Bo]}finally{Bo=t}}(()=>e[t]):i=e[t],void 0===i&&void 0!==a&&(i=v(),n&&(!function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),n(i))),p=()=>{var r=e[t];return void 0===r?v():(u=!0,r)},!(4&r))return p;if(n){var h=e.$$legacy;return function(e,t){return arguments.length>0?((!t||h||f)&&n(t?p():e),e):p()}}var g=!1,m=(1&r?et:at)(()=>(g=!1,p()));l&&qr(m);var b=xr;return function(e,t){if(arguments.length>0){const r=t?qr(m):l?Dt(e):e;return Bt(m,r),g=!0,void 0!==c&&(c=r),e}return br&&g||0!==(b.f&pe)?m.v:qr(m)}}class Lo{constructor(e){var t;S(this,b),S(this,y);var r=new Map,a=(e,t)=>{var a=It(t,!1,!1);return r.set(e,a),a};const o=new Proxy({...e.props||{},$$events:{}},{get:(e,t)=>qr(r.get(t)??a(t,Reflect.get(e,t))),has:(e,t)=>t===xe||(qr(r.get(t)??a(t,Reflect.get(e,t))),Reflect.has(e,t)),set:(e,t,o)=>(Bt(r.get(t)??a(t,o),o),Reflect.set(e,t,o))});k(this,y,(e.hydrate?Ea:xa)(e.component,{target:e.target,anchor:e.anchor,props:o,context:e.context,intro:e.intro??!1,recover:e.recover})),(null==(t=null==e?void 0:e.props)?void 0:t.$$host)&&!1!==e.sync||wt(),k(this,b,o.$$events);for(const n of Object.keys(E(this,y)))"$set"!==n&&"$destroy"!==n&&"$on"!==n&&Y(this,n,{get(){return E(this,y)[n]},set(e){E(this,y)[n]=e},enumerable:!0});E(this,y).$set=e=>{Object.assign(o,e)},E(this,y).$destroy=()=>{!function(e,t){const r=Aa.get(e);r?(Aa.delete(e),r(t)):Promise.resolve()}(E(this,y))}}$set(e){E(this,y).$set(e)}$on(e,t){E(this,b)[e]=E(this,b)[e]||[];const r=(...e)=>t.call(this,...e);return E(this,b)[e].push(r),()=>{E(this,b)[e]=E(this,b)[e].filter(e=>e!==r)}}$destroy(){E(this,y).$destroy()}}function Do(e,t,r,a){var o;const n=null==(o=r[e])?void 0:o.type;if(t="Boolean"===n&&"boolean"!=typeof t?null!=t:t,!a||!r[e])return t;if("toAttribute"===a)switch(n){case"Object":case"Array":return null==t?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return null==t?null:t;default:return t}else switch(n){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":default:return t;case"Number":return null!=t?+t:t}}function Uo(e,t,r,a,o,n){let i=class extends Io{constructor(){super(e,r,o),this.$$p_d=t}static get observedAttributes(){return W(t).map(e=>(t[e].attribute||e).toLowerCase())}};return W(t).forEach(e=>{Y(i.prototype,e,{get(){return this.$$c&&e in this.$$c?this.$$c[e]:this.$$d[e]},set(r){var a;r=Do(e,r,t),this.$$d[e]=r;var o=this.$$c;o&&((null==(a=Q(o,e))?void 0:a.get)?o[e]=r:o.$set({[e]:r}))}})}),a.forEach(e=>{Y(i.prototype,e,{get(){var t;return null==(t=this.$$c)?void 0:t[e]}})}),e.element=i,i}b=new WeakMap,y=new WeakMap,"function"==typeof HTMLElement&&(Io=class extends HTMLElement{constructor(e,t,r){super(),C(this,"$$ctor"),C(this,"$$s"),C(this,"$$c"),C(this,"$$cn",!1),C(this,"$$d",{}),C(this,"$$r",!1),C(this,"$$p_d",{}),C(this,"$$l",{}),C(this,"$$l_u",new Map),C(this,"$$me"),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const e=this.$$l_u.get(t);e&&(e(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(e){return t=>{const r=document.createElement("slot");"default"!==e&&(r.name=e),va(t,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},a=function(e){const t={};return e.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}(this);for(const e of this.$$s)e in a&&("default"!==e||this.$$d.children?r[e]=t(e):(this.$$d.children=t(e),r.default=!0));for(const e of this.attributes){const t=this.$$g_p(e.name);t in this.$$d||(this.$$d[t]=Do(t,e.value,this.$$p_d,"toProp"))}for(const e in this.$$p_d)e in this.$$d||void 0===this[e]||(this.$$d[e]=this[e],delete this[e]);this.$$c=(e={component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}},new Lo(e)),this.$$me=function(e){_t.ensure();const t=Jt(ie,e,!0);return()=>{sr(t)}}(()=>{rr(()=>{var e;this.$$r=!0;for(const t of W(this.$$c)){if(!(null==(e=this.$$p_d[t])?void 0:e.reflect))continue;this.$$d[t]=this.$$c[t];const r=Do(t,this.$$d[t],this.$$p_d,"toAttribute");null==r?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,r)}this.$$r=!1})});for(const e in this.$$l)for(const t of this.$$l[e]){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}this.$$l={}}var e}attributeChangedCallback(e,t,r){var a;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Do(e,r,this.$$p_d,"toProp"),null==(a=this.$$c)||a.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return W(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});var Po,Vo,Mo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Oo(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}),r}function jo(){return Vo?Po:(Vo=1,Po={options:{usePureJavaScript:!1}})}var qo,Fo,Ko,$o,Ho,Go={exports:{}};function Wo(){if(Ko)return Go.exports;Ko=1;var e=jo(),t=function(){if(Fo)return qo;Fo=1;var e={};qo=e;var t={};return e.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var o=0,n=t.length,i=t.charAt(0),l=[0];for(o=0;o<e.length;++o){for(var s=0,c=e[o];s<l.length;++s)c+=l[s]<<8,l[s]=c%n,c=c/n|0;for(;c>0;)l.push(c%n),c=c/n|0}for(o=0;0===e[o]&&o<e.length-1;++o)a+=i;for(o=l.length-1;o>=0;--o)a+=t[l[o]]}else a=function(e,t){var r=0,a=t.length,o=t.charAt(0),n=[0];for(r=0;r<e.length();++r){for(var i=0,l=e.at(r);i<n.length;++i)l+=n[i]<<8,n[i]=l%a,l=l/a|0;for(;l>0;)n.push(l%a),l=l/a|0}var s="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)s+=o;for(r=n.length-1;r>=0;--r)s+=t[n[r]];return s}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");a=a.match(u).join("\r\n")}return a},e.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var a=t[r];if(!a){a=t[r]=[];for(var o=0;o<r.length;++o)a[r.charCodeAt(o)]=o}e=e.replace(/\s/g,"");var n=r.length,i=r.charAt(0),l=[0];for(o=0;o<e.length;o++){var s=a[e.charCodeAt(o)];if(void 0===s)return;for(var c=0,u=s;c<l.length;++c)u+=l[c]*n,l[c]=255&u,u>>=8;for(;u>0;)l.push(255&u),u>>=8}for(var v=0;e[v]===i&&v<e.length-1;++v)l.push(0);return"undefined"!=typeof Buffer?Buffer.from(l.reverse()):new Uint8Array(l.reverse())},qo}(),r=Go.exports=e.util=e.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(r.isArrayBuffer(e)||r.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof o||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return r.nextTick=process.nextTick,void("function"==typeof setImmediate?r.setImmediate=setImmediate:r.setImmediate=r.nextTick);if("function"==typeof setImmediate)return r.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(r.nextTick=function(e){return setImmediate(e)});if(r.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){let a=function(r){if(r.source===window&&r.data===e){r.stopPropagation();var a=t.slice();t.length=0,a.forEach(function(e){e()})}};var e="forge.setImmediate",t=[];r.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",a,!0)}if("undefined"!=typeof MutationObserver){var a=Date.now(),o=!0,n=document.createElement("div");t=[];new MutationObserver(function(){var e=t.slice();t.length=0,e.forEach(function(e){e()})}).observe(n,{attributes:!0});var i=r.setImmediate;r.setImmediate=function(e){Date.now()-a>15?(a=Date.now(),i(e)):(t.push(e),1===t.length&&n.setAttribute("a",o=!o))}}r.nextTick=r.setImmediate}(),r.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,r.globalScope=r.isNodejs?Mo:"undefined"==typeof self?window:self,r.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},r.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},r.isArrayBufferView=function(e){return e&&r.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},r.ByteBuffer=o,r.ByteStringBuffer=o;r.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},r.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},r.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},r.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},r.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},r.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},r.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(r.encodeUtf8(e))},r.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},r.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},r.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},r.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},r.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},r.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},r.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},r.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},r.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},r.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},r.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},r.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},r.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},r.ByteStringBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},r.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},r.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},r.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},r.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},r.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},r.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},r.ByteStringBuffer.prototype.copy=function(){var e=r.createBuffer(this.data);return e.read=this.read,e},r.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},r.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},r.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},r.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},r.ByteStringBuffer.prototype.toString=function(){return r.decodeUtf8(this.bytes())},r.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=r.isArrayBuffer(e),o=r.isArrayBufferView(e);if(a||o)return this.data=a?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},r.DataBuffer.prototype.length=function(){return this.write-this.read},r.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},r.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),a=new Uint8Array(this.length()+t);return a.set(r),this.data=new DataView(a.buffer),this},r.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},r.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},r.DataBuffer.prototype.putBytes=function(e,t){if(r.isArrayBufferView(e)){var a=(o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-o.byteOffset;return this.accommodate(a),new Uint8Array(this.data.buffer,this.write).set(o),this.write+=a,this}if(r.isArrayBuffer(e)){var o=new Uint8Array(e);return this.accommodate(o.byteLength),new Uint8Array(this.data.buffer).set(o,this.write),this.write+=o.byteLength,this}if(e instanceof r.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&r.isArrayBufferView(e.data)){o=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(o.byteLength),new Uint8Array(e.data.byteLength,this.write).set(o),this.write+=o.byteLength,this}if(e instanceof r.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var n;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),n=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.hex.decode(e,n,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),n=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.base64.decode(e,n,this.write),this;if("utf8"===t&&(e=r.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),n=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.raw.decode(n),this;if("utf16"===t)return this.accommodate(2*e.length),n=new Uint16Array(this.data.buffer,this.write),this.write+=r.text.utf16.encode(n),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},r.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},r.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},r.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},r.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},r.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},r.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},r.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},r.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},r.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},r.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},r.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},r.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},r.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},r.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},r.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},r.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},r.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},r.DataBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},r.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},r.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},r.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},r.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},r.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},r.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},r.DataBuffer.prototype.copy=function(){return new r.DataBuffer(this)},r.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},r.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},r.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},r.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},r.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return r.binary.raw.encode(t);if("hex"===e)return r.binary.hex.encode(t);if("base64"===e)return r.binary.base64.encode(t);if("utf8"===e)return r.text.utf8.decode(t);if("utf16"===e)return r.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},r.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=r.encodeUtf8(e)),new r.ByteBuffer(e)},r.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},r.xorBytes=function(e,t,r){for(var a="",o="",n="",i=0,l=0;r>0;--r,++i)o=e.charCodeAt(i)^t.charCodeAt(i),l>=10&&(a+=n,n="",l=0),n+=String.fromCharCode(o),++l;return a+=n},r.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},r.bytesToHex=function(e){return r.createBuffer(e).toHex()},r.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";r.encode64=function(e,t){for(var r,a,o,i="",l="",s=0;s<e.length;)r=e.charCodeAt(s++),a=e.charCodeAt(s++),o=e.charCodeAt(s++),i+=n.charAt(r>>2),i+=n.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=n.charAt((15&a)<<2|o>>6),i+=isNaN(o)?"=":n.charAt(63&o)),t&&i.length>t&&(l+=i.substr(0,t)+"\r\n",i=i.substr(t));return l+=i},r.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,a,o,n="",l=0;l<e.length;)t=i[e.charCodeAt(l++)-43],r=i[e.charCodeAt(l++)-43],a=i[e.charCodeAt(l++)-43],o=i[e.charCodeAt(l++)-43],n+=String.fromCharCode(t<<2|r>>4),64!==a&&(n+=String.fromCharCode((15&r)<<4|a>>2),64!==o&&(n+=String.fromCharCode((3&a)<<6|o)));return n},r.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},r.decodeUtf8=function(e){return decodeURIComponent(escape(e))},r.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:t.encode,decode:t.decode}},r.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},r.binary.raw.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(e.length));for(var o=r=r||0,n=0;n<e.length;++n)a[o++]=e.charCodeAt(n);return t?o-r:a},r.binary.hex.encode=r.bytesToHex,r.binary.hex.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(Math.ceil(e.length/2)));var o=0,n=r=r||0;for(1&e.length&&(o=1,a[n++]=parseInt(e[0],16));o<e.length;o+=2)a[n++]=parseInt(e.substr(o,2),16);return t?n-r:a},r.binary.base64.encode=function(e,t){for(var r,a,o,i="",l="",s=0;s<e.byteLength;)r=e[s++],a=e[s++],o=e[s++],i+=n.charAt(r>>2),i+=n.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=n.charAt((15&a)<<2|o>>6),i+=isNaN(o)?"=":n.charAt(63&o)),t&&i.length>t&&(l+=i.substr(0,t)+"\r\n",i=i.substr(t));return l+=i},r.binary.base64.decode=function(e,t,r){var a,o,n,l,s=t;s||(s=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)a=i[e.charCodeAt(c++)-43],o=i[e.charCodeAt(c++)-43],n=i[e.charCodeAt(c++)-43],l=i[e.charCodeAt(c++)-43],s[u++]=a<<2|o>>4,64!==n&&(s[u++]=(15&o)<<4|n>>2,64!==l&&(s[u++]=(3&n)<<6|l));return t?u-r:s.subarray(0,u)},r.binary.base58.encode=function(e,t){return r.binary.baseN.encode(e,l,t)},r.binary.base58.decode=function(e,t){return r.binary.baseN.decode(e,l,t)},r.text={utf8:{},utf16:{}},r.text.utf8.encode=function(e,t,a){e=r.encodeUtf8(e);var o=t;o||(o=new Uint8Array(e.length));for(var n=a=a||0,i=0;i<e.length;++i)o[n++]=e.charCodeAt(i);return t?n-a:o},r.text.utf8.decode=function(e){return r.decodeUtf8(String.fromCharCode.apply(null,e))},r.text.utf16.encode=function(e,t,r){var a=t;a||(a=new Uint8Array(2*e.length));for(var o=new Uint16Array(a.buffer),n=r=r||0,i=r,l=0;l<e.length;++l)o[i++]=e.charCodeAt(l),n+=2;return t?n-r:a},r.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},r.deflate=function(e,t,a){if(t=r.decode64(e.deflate(r.encode64(t)).rval),a){var o=2;32&t.charCodeAt(1)&&(o=6),t=t.substring(o,t.length-4)}return t},r.inflate=function(e,t,a){var o=e.inflate(r.encode64(t)).rval;return null===o?null:r.decode64(o)};var s=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var o;if(null===a?o=e.removeItem(t):(a=r.encode64(JSON.stringify(a)),o=e.setItem(t,a)),void 0!==o&&!0!==o.rval){var n=new Error(o.error.message);throw n.id=o.error.id,n.name=o.error.name,n}},c=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(null===a.rval){if(a.error){var o=new Error(a.error.message);throw o.id=a.error.id,o.name=a.error.name,o}a=null}else a=a.rval;return null!==a&&(a=JSON.parse(r.decode64(a))),a},u=function(e,t,r,a){var o=c(e,t);null===o&&(o={}),o[r]=a,s(e,t,o)},v=function(e,t,r){var a=c(e,t);return null!==a&&(a=r in a?a[r]:null),a},d=function(e,t,r){var a=c(e,t);if(null!==a&&r in a){delete a[r];var o=!0;for(var n in a){o=!1;break}o&&(a=null),s(e,t,a)}},p=function(e,t){s(e,t,null)},f=function(e,t,r){var a,o=null;void 0===r&&(r=["web","flash"]);var n=!1,i=null;for(var l in r){a=r[l];try{if("flash"===a||"both"===a){if(null===t[0])throw new Error("Flash local storage not available.");o=e.apply(this,t),n="flash"===a}"web"!==a&&"both"!==a||(t[0]=localStorage,o=e.apply(this,t),n=!0)}catch(s){i=s}if(n)break}if(!n)throw i;return o};return r.setItem=function(e,t,r,a,o){f(u,arguments,o)},r.getItem=function(e,t,r,a){return f(v,arguments,a)},r.removeItem=function(e,t,r,a){f(d,arguments,a)},r.clearItems=function(e,t,r){f(p,arguments,r)},r.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},r.format=function(e){for(var t,r,a=/%./g,o=0,n=[],i=0;t=a.exec(e);){(r=e.substring(i,a.lastIndex-2)).length>0&&n.push(r),i=a.lastIndex;var l=t[0][1];switch(l){case"s":case"o":o<arguments.length?n.push(arguments[1+o++]):n.push("<?>");break;case"%":n.push("%");break;default:n.push("<%"+l+"?>")}}return n.push(e.substring(i)),n.join("")},r.formatNumber=function(e,t,r,a){var o=e,n=isNaN(t=Math.abs(t))?2:t,i=void 0===r?",":r,l=void 0===a?".":a,s=o<0?"-":"",c=parseInt(o=Math.abs(+o||0).toFixed(n),10)+"",u=c.length>3?c.length%3:0;return s+(u?c.substr(0,u)+l:"")+c.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+l)+(n?i+Math.abs(o-c).toFixed(n).slice(2):"")},r.formatSize=function(e){return e=e>=1073741824?r.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?r.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?r.formatNumber(e/1024,0)+" KiB":r.formatNumber(e,0)+" bytes"},r.bytesFromIP=function(e){return-1!==e.indexOf(".")?r.bytesFromIPv4(e):-1!==e.indexOf(":")?r.bytesFromIPv6(e):null},r.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=r.createBuffer(),a=0;a<e.length;++a){var o=parseInt(e[a],10);if(isNaN(o))return null;t.putByte(o)}return t.getBytes()},r.bytesFromIPv6=function(e){for(var t=0,a=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).length+t),o=r.createBuffer(),n=0;n<8;++n)if(e[n]&&0!==e[n].length){var i=r.hexToBytes(e[n]);i.length<2&&o.putByte(0),o.putBytes(i)}else o.fillWithByte(0,a),a=0;return o.getBytes()},r.bytesToIP=function(e){return 4===e.length?r.bytesToIPv4(e):16===e.length?r.bytesToIPv6(e):null},r.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},r.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],a=[],o=0,n=0;n<e.length;n+=2){for(var i=r.bytesToHex(e[n]+e[n+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var l=a[a.length-1],s=t.length;l&&s===l.end+1?(l.end=s,l.end-l.start>a[o].end-a[o].start&&(o=a.length-1)):a.push({start:s,end:s})}t.push(i)}if(a.length>0){var c=a[o];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},r.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in r&&!e.update)return t(null,r.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return r.cores=navigator.hardwareConcurrency,t(null,r.cores);if("undefined"==typeof Worker)return r.cores=1,t(null,r.cores);if("undefined"==typeof Blob)return r.cores=2,t(null,r.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})})}.toString(),")()"],{type:"application/javascript"}));!function e(o,n,i){if(0===n){var l=Math.floor(o.reduce(function(e,t){return e+t},0)/o.length);return r.cores=Math.max(1,l),URL.revokeObjectURL(a),t(null,r.cores)}!function(e,t){for(var r=[],o=[],n=0;n<e;++n){var i=new Worker(a);i.addEventListener("message",function(a){if(o.push(a.data),o.length===e){for(var n=0;n<e;++n)r[n].terminate();t(null,o)}}),r.push(i)}for(n=0;n<e;++n)r[n].postMessage(n)}(i,function(t,r){o.push(function(e,t){for(var r=[],a=0;a<e;++a)for(var o=t[a],n=r[a]=[],i=0;i<e;++i)if(a!==i){var l=t[i];(o.st>l.st&&o.st<l.et||l.st>o.st&&l.st<o.et)&&n.push(i)}return r.reduce(function(e,t){return Math.max(e,t.length)},0)}(i,r)),e(o,n-1,i)})}([],5,16)},Go.exports}function Yo(){if(Ho)return $o;Ho=1;var e=jo();Wo(),$o=e.cipher=e.cipher||{},e.cipher.algorithms=e.cipher.algorithms||{},e.cipher.createCipher=function(t,r){var a=t;if("string"==typeof a&&(a=e.cipher.getAlgorithm(a))&&(a=a()),!a)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:a,key:r,decrypt:!1})},e.cipher.createDecipher=function(t,r){var a=t;if("string"==typeof a&&(a=e.cipher.getAlgorithm(a))&&(a=a()),!a)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:a,key:r,decrypt:!0})},e.cipher.registerAlgorithm=function(t,r){t=t.toUpperCase(),e.cipher.algorithms[t]=r},e.cipher.getAlgorithm=function(t){return(t=t.toUpperCase())in e.cipher.algorithms?e.cipher.algorithms[t]:null};var t=e.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};return t.prototype.start=function(t){t=t||{};var r={};for(var a in t)r[a]=t[a];r.decrypt=this._decrypt,this._finish=!1,this._input=e.util.createBuffer(),this.output=t.output||e.util.createBuffer(),this.mode.start(r)},t.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},t.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},$o}var Qo,Jo,Xo,Zo={exports:{}};function en(){if(Qo)return Zo.exports;Qo=1;var e=jo();Wo(),e.cipher=e.cipher||{};var t=Zo.exports=e.cipher.modes=e.cipher.modes||{};function r(t,r){if("string"==typeof t&&(t=e.util.createBuffer(t)),e.util.isArray(t)&&t.length>4){var a=t;t=e.util.createBuffer();for(var o=0;o<a.length;++o)t.putByte(a[o])}if(t.length()<r)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+r+" bytes.");if(!e.util.isArray(t)){var n=[],i=r/4;for(o=0;o<i;++o)n.push(t.getInt32());t=n}return t}function a(e){e[e.length-1]=e[e.length-1]+1&4294967295}function o(e){return[e/4294967296|0,4294967295&e]}return t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=this._prev[a]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._prev[a]^this._outBlock[a]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},t.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32()^this._outBlock[o],t.putInt32(this._inBlock[o]);else{var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32()^this._outBlock[o],this._partialOutput.putInt32(this._partialBlock[o]);if(n>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32(),t.putInt32(this._inBlock[o]^this._outBlock[o]);else{var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[o]^this._outBlock[o]);if(n>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]),this._inBlock[o]=this._outBlock[o];else{var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(n>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._outBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var o=e.length();if(0===o)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&o>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]);else{var i=(this.blockSize-o)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(i>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var r,n=e.util.createBuffer(t.iv);if(this._cipherLength=0,r="additionalData"in t?e.util.createBuffer(t.additionalData):e.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=e.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=n.length();if(12===i)this._j0=[n.getInt32(),n.getInt32(),n.getInt32(),1];else{for(this._j0=[0,0,0,0];n.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[n.getInt32(),n.getInt32(),n.getInt32(),n.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*i)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=e.util.createBuffer(r),this._aDataLength=o(8*r.length());var l=r.length()%this.blockSize;for(l&&r.fillWithByte(0,this.blockSize-l),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var o=e.length();if(0===o)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&o>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^=e.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-o)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(i<=0||r){if(r){var l=o%this.blockSize;this._cipherLength+=l,this._partialOutput.truncate(this.blockSize-l)}else this._cipherLength+=this.blockSize;for(n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var o=e.length();if(o<this.blockSize&&!(r&&o>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^this._hashBlock[n]);o<this.blockSize?this._cipherLength+=o%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(t,r){var a=!0;r.decrypt&&r.overflow&&t.truncate(this.blockSize-r.overflow),this.tag=e.util.createBuffer();var n=this._aDataLength.concat(o(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var l=0;l<this._ints;++l)this.tag.putInt32(this._s[l]^i[l]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),r.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],a=t.slice(0),o=0;o<128;++o){e[o/32|0]&1<<31-o%32&&(r[0]^=a[0],r[1]^=a[1],r[2]^=a[2],r[3]^=a[3]),this.pow(a,a)}return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],a=3;a>0;--a)t[a]=e[a]>>>1|(1&e[a-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var a=e[r/8|0]>>>4*(7-r%8)&15,o=this._m[r][a];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,a=4*r,o=16*r,n=new Array(o),i=0;i<o;++i){var l=[0,0,0,0],s=(a-1-i%a)*t;l[i/a|0]=1<<t-1<<s,n[i]=this.generateSubHashTable(this.multiply(l,e),t)}return n},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,a=r>>>1,o=new Array(r);o[a]=e.slice(0);for(var n=a>>>1;n>0;)this.pow(o[2*n],o[n]=[]),n>>=1;for(n=2;n<a;){for(var i=1;i<n;++i){var l=o[n],s=o[i];o[n+i]=[l[0]^s[0],l[1]^s[1],l[2]^s[2],l[3]^s[3]]}n*=2}for(o[0]=[0,0,0,0],n=a+1;n<r;++n){var c=o[n^a];o[n]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return o},Zo.exports}function tn(){if(Xo)return Jo;Xo=1;var e=jo();function t(t,r){e.cipher.registerAlgorithm(t,function(){return new e.aes.Algorithm(t,r)})}Yo(),en(),Wo(),Jo=e.aes=e.aes||{},e.aes.startEncrypting=function(e,t,r,a){var o=d({key:e,output:r,decrypt:!1,mode:a});return o.start(t),o},e.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},e.aes.startDecrypting=function(e,t,r,a){var o=d({key:e,output:r,decrypt:!0,mode:a});return o.start(t),o},e.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},e.aes.Algorithm=function(e,t){l||c();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return v(r._w,e,t,!1)},decrypt:function(e,t){return v(r._w,e,t,!0)}}}),r._init=!1},e.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var r,a=t.key;if("string"!=typeof a||16!==a.length&&24!==a.length&&32!==a.length){if(e.util.isArray(a)&&(16===a.length||24===a.length||32===a.length)){r=a,a=e.util.createBuffer();for(var o=0;o<r.length;++o)a.putByte(r[o])}}else a=e.util.createBuffer(a);if(!e.util.isArray(a)){r=a,a=[];var n=r.length();if(16===n||24===n||32===n){n>>>=2;for(o=0;o<n;++o)a.push(r.getInt32())}}if(!e.util.isArray(a)||4!==a.length&&6!==a.length&&8!==a.length)throw new Error("Invalid key parameter.");var i=this.mode.name,l=-1!==["CFB","OFB","CTR","GCM"].indexOf(i);this._w=u(a,t.decrypt&&!l),this._init=!0}},e.aes._expandKey=function(e,t){return l||c(),u(e,t)},e.aes._updateBlock=v,t("AES-ECB",e.cipher.modes.ecb),t("AES-CBC",e.cipher.modes.cbc),t("AES-CFB",e.cipher.modes.cfb),t("AES-OFB",e.cipher.modes.ofb),t("AES-CTR",e.cipher.modes.ctr),t("AES-GCM",e.cipher.modes.gcm);var r,a,o,n,i,l=!1,s=4;function c(){l=!0,o=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;r=new Array(256),a=new Array(256),n=new Array(4),i=new Array(4);for(t=0;t<4;++t)n[t]=new Array(256),i[t]=new Array(256);var s,c,u,v,d,p,f,h=0,g=0;for(t=0;t<256;++t){v=(v=g^g<<1^g<<2^g<<3^g<<4)>>8^255&v^99,r[h]=v,a[v]=h,p=(d=e[v])<<24^v<<16^v<<8^v^d,f=((s=e[h])^(c=e[s])^(u=e[c]))<<24^(h^u)<<16^(h^c^u)<<8^h^s^u;for(var m=0;m<4;++m)n[m][h]=p,i[m][v]=f,p=p<<24|p>>>8,f=f<<24|f>>>8;0===h?h=g=1:(h=s^e[e[e[s^u]]],g^=e[e[g]])}}function u(e,t){for(var a,n=e.slice(0),l=1,c=n.length,u=s*(c+6+1),v=c;v<u;++v)a=n[v-1],v%c===0?(a=r[a>>>16&255]<<24^r[a>>>8&255]<<16^r[255&a]<<8^r[a>>>24]^o[l]<<24,l++):c>6&&v%c===4&&(a=r[a>>>24]<<24^r[a>>>16&255]<<16^r[a>>>8&255]<<8^r[255&a]),n[v]=n[v-c]^a;if(t){for(var d,p=i[0],f=i[1],h=i[2],g=i[3],m=n.slice(0),b=(v=0,(u=n.length)-s);v<u;v+=s,b-=s)if(0===v||v===u-s)m[v]=n[b],m[v+1]=n[b+3],m[v+2]=n[b+2],m[v+3]=n[b+1];else for(var y=0;y<s;++y)d=n[b+y],m[v+(3&-y)]=p[r[d>>>24]]^f[r[d>>>16&255]]^h[r[d>>>8&255]]^g[r[255&d]];n=m}return n}function v(e,t,o,l){var s,c,u,v,d,p,f,h,g,m,b,y,_=e.length/4-1;l?(s=i[0],c=i[1],u=i[2],v=i[3],d=a):(s=n[0],c=n[1],u=n[2],v=n[3],d=r),p=t[0]^e[0],f=t[l?3:1]^e[1],h=t[2]^e[2],g=t[l?1:3]^e[3];for(var w=3,C=1;C<_;++C)m=s[p>>>24]^c[f>>>16&255]^u[h>>>8&255]^v[255&g]^e[++w],b=s[f>>>24]^c[h>>>16&255]^u[g>>>8&255]^v[255&p]^e[++w],y=s[h>>>24]^c[g>>>16&255]^u[p>>>8&255]^v[255&f]^e[++w],g=s[g>>>24]^c[p>>>16&255]^u[f>>>8&255]^v[255&h]^e[++w],p=m,f=b,h=y;o[0]=d[p>>>24]<<24^d[f>>>16&255]<<16^d[h>>>8&255]<<8^d[255&g]^e[++w],o[l?3:1]=d[f>>>24]<<24^d[h>>>16&255]<<16^d[g>>>8&255]<<8^d[255&p]^e[++w],o[2]=d[h>>>24]<<24^d[g>>>16&255]<<16^d[p>>>8&255]<<8^d[255&f]^e[++w],o[l?1:3]=d[g>>>24]<<24^d[p>>>16&255]<<16^d[f>>>8&255]<<8^d[255&h]^e[++w]}function d(t){var r,a="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),o=(r=t.decrypt?e.cipher.createDecipher(a,t.key):e.cipher.createCipher(a,t.key)).start;return r.start=function(t,a){var n=null;a instanceof e.util.ByteBuffer&&(n=a,a={}),(a=a||{}).output=n,a.iv=t,o.call(r,a)},r}return Jo}var rn,an,on={exports:{}},nn={exports:{}},ln={exports:{}};function sn(){if(rn)return ln.exports;rn=1;var e=jo();e.pki=e.pki||{};var t=ln.exports=e.pki.oids=e.oids=e.oids||{};function r(e,r){t[e]=r,t[r]=e}function a(e,r){t[e]=r}return r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("1.3.14.3.2.29","sha1WithRSASignature"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("2.16.840.1.101.3.4.2.4","sha224"),r("2.16.840.1.101.3.4.2.5","sha512-224"),r("2.16.840.1.101.3.4.2.6","sha512-256"),r("1.2.840.113549.2.2","md2"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.4","surname"),r("2.5.4.5","serialNumber"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.12","title"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("2.5.4.42","givenName"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),a("2.5.29.1","authorityKeyIdentifier"),a("2.5.29.2","keyAttributes"),a("2.5.29.3","certificatePolicies"),a("2.5.29.4","keyUsageRestriction"),a("2.5.29.5","policyMapping"),a("2.5.29.6","subtreesConstraint"),a("2.5.29.7","subjectAltName"),a("2.5.29.8","issuerAltName"),a("2.5.29.9","subjectDirectoryAttributes"),a("2.5.29.10","basicConstraints"),a("2.5.29.11","nameConstraints"),a("2.5.29.12","policyConstraints"),a("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),a("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),a("2.5.29.20","cRLNumber"),a("2.5.29.21","cRLReason"),a("2.5.29.22","expirationDate"),a("2.5.29.23","instructionCode"),a("2.5.29.24","invalidityDate"),a("2.5.29.25","cRLDistributionPoints"),a("2.5.29.26","issuingDistributionPoint"),a("2.5.29.27","deltaCRLIndicator"),a("2.5.29.28","issuingDistributionPoint"),a("2.5.29.29","certificateIssuer"),a("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),a("2.5.29.33","policyMappings"),a("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),a("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),a("2.5.29.46","freshestCRL"),a("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping"),ln.exports}function cn(){if(an)return nn.exports;an=1;var e=jo();Wo(),sn();var t=nn.exports=e.asn1=e.asn1||{};function r(e,t,r){if(r>t){var a=new Error("Too few bytes to parse DER.");throw a.available=e.length(),a.remaining=t,a.requested=r,a}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},t.create=function(r,a,o,n,i){if(e.util.isArray(n)){for(var l=[],s=0;s<n.length;++s)void 0!==n[s]&&l.push(n[s]);n=l}var c={tagClass:r,type:a,constructed:o,composed:o||e.util.isArray(n),value:n};return i&&"bitStringContents"in i&&(c.bitStringContents=i.bitStringContents,c.original=t.copy(c)),c},t.copy=function(r,a){var o;if(e.util.isArray(r)){o=[];for(var n=0;n<r.length;++n)o.push(t.copy(r[n],a));return o}return"string"==typeof r?r:(o={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:t.copy(r.value,a)},a&&!a.excludeBitStringContents&&(o.bitStringContents=r.bitStringContents),o)},t.equals=function(r,a,o){if(e.util.isArray(r)){if(!e.util.isArray(a))return!1;if(r.length!==a.length)return!1;for(var n=0;n<r.length;++n)if(!t.equals(r[n],a[n]))return!1;return!0}if(typeof r!=typeof a)return!1;if("string"==typeof r)return r===a;var i=r.tagClass===a.tagClass&&r.type===a.type&&r.constructed===a.constructed&&r.composed===a.composed&&t.equals(r.value,a.value);return o&&o.includeBitStringContents&&(i=i&&r.bitStringContents===a.bitStringContents),i},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function a(e,o,n,i){var l;r(e,o,2);var s=e.getByte();o--;var c=192&s,u=31&s;l=e.length();var v,d,p=function(e,t){var a=e.getByte();if(t--,128!==a){var o;if(128&a){var n=127&a;r(e,t,n),o=e.getInt(n<<3)}else o=a;if(o<0)throw new Error("Negative length: "+o);return o}}(e,o);if(o-=l-e.length(),void 0!==p&&p>o){if(i.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=e.length(),f.remaining=o,f.requested=p,f}p=o}var h=!(32&~s);if(h)if(v=[],void 0===p)for(;;){if(r(e,o,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),o-=2;break}l=e.length(),v.push(a(e,o,n+1,i)),o-=l-e.length()}else for(;p>0;)l=e.length(),v.push(a(e,p,n+1,i)),o-=l-e.length(),p-=l-e.length();if(void 0===v&&c===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&(d=e.bytes(p)),void 0===v&&i.decodeBitStrings&&c===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&p>1){var g=e.read,m=o,b=0;if(u===t.Type.BITSTRING&&(r(e,o,1),b=e.getByte(),o--),0===b)try{l=e.length();var y=a(e,o,n+1,{strict:!0,decodeBitStrings:!0}),_=l-e.length();o-=_,u==t.Type.BITSTRING&&_++;var w=y.tagClass;_!==p||w!==t.Class.UNIVERSAL&&w!==t.Class.CONTEXT_SPECIFIC||(v=[y])}catch(x){}void 0===v&&(e.read=g,o=m)}if(void 0===v){if(void 0===p){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=o}if(u===t.Type.BMPSTRING)for(v="";p>0;p-=2)r(e,o,2),v+=String.fromCharCode(e.getInt16()),o-=2;else v=e.getBytes(p),o-=p}var C=void 0===d?null:{bitStringContents:d};return t.create(c,u,h,v,C)}t.fromDer=function(t,r){void 0===r&&(r={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof r&&(r={strict:r,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"parseAllBytes"in r||(r.parseAllBytes=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"string"==typeof t&&(t=e.util.createBuffer(t));var o=t.length(),n=a(t,t.length(),0,r);if(r.parseAllBytes&&0!==t.length()){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=o,i.remaining=t.length(),i}return n},t.toDer=function(r){var a=e.util.createBuffer(),o=r.tagClass|r.type,n=e.util.createBuffer(),i=!1;if("bitStringContents"in r&&(i=!0,r.original&&(i=t.equals(r,r.original))),i)n.putBytes(r.bitStringContents);else if(r.composed){r.constructed?o|=32:n.putByte(0);for(var l=0;l<r.value.length;++l)void 0!==r.value[l]&&n.putBuffer(t.toDer(r.value[l]))}else if(r.type===t.Type.BMPSTRING)for(l=0;l<r.value.length;++l)n.putInt16(r.value.charCodeAt(l));else!(r.type===t.Type.INTEGER&&r.value.length>1)||(0!==r.value.charCodeAt(0)||128&r.value.charCodeAt(1))&&(255!==r.value.charCodeAt(0)||128&~r.value.charCodeAt(1))?n.putBytes(r.value):n.putBytes(r.value.substr(1));if(a.putByte(o),n.length()<=127)a.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);a.putByte(128|c.length);for(l=c.length-1;l>=0;--l)a.putByte(c.charCodeAt(l))}return a.putBuffer(n),a},t.oidToDer=function(t){var r,a,o,n,i=t.split("."),l=e.util.createBuffer();l.putByte(40*parseInt(i[0],10)+parseInt(i[1],10));for(var s=2;s<i.length;++s){r=!0,a=[],o=parseInt(i[s],10);do{n=127&o,o>>>=7,r||(n|=128),a.push(n),r=!1}while(o>0);for(var c=a.length-1;c>=0;--c)l.putByte(a[c])}return l},t.derToOid=function(t){var r;"string"==typeof t&&(t=e.util.createBuffer(t));var a=t.getByte();r=Math.floor(a/40)+"."+a%40;for(var o=0;t.length()>0;)o<<=7,128&(a=t.getByte())?o+=127&a:(r+="."+(o+a),o=0);return r},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var a=parseInt(e.substr(2,2),10)-1,o=parseInt(e.substr(4,2),10),n=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),l=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(l=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,a,o),t.setUTCHours(n,i,l,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var u=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10);u*=6e4,"+"===s?t.setTime(+t-u):t.setTime(+t+u)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),a=parseInt(e.substr(4,2),10)-1,o=parseInt(e.substr(6,2),10),n=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),l=parseInt(e.substr(12,2),10),s=0,c=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var v=e.length-5,d=e.charAt(v);"+"!==d&&"-"!==d||(c=60*parseInt(e.substr(v+1,2),10)+parseInt(e.substr(v+4,2),10),c*=6e4,"+"===d&&(c*=-1),u=!0);return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,a,o),t.setUTCHours(n,i,l,s),t.setTime(+t+c)):(t.setFullYear(r,a,o),t.setHours(n,i,l,s)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z"},t.integerToDer=function(t){var r=e.util.createBuffer();if(t>=-128&&t<128)return r.putSignedInt(t,8);if(t>=-32768&&t<32768)return r.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return r.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return r.putSignedInt(t,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=t,a},t.derToInteger=function(t){"string"==typeof t&&(t=e.util.createBuffer(t));var r=8*t.length();if(r>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(r)},t.validate=function(r,a,o,n){var i=!1;if(r.tagClass!==a.tagClass&&void 0!==a.tagClass||r.type!==a.type&&void 0!==a.type)n&&(r.tagClass!==a.tagClass&&n.push("["+a.name+'] Expected tag class "'+a.tagClass+'", got "'+r.tagClass+'"'),r.type!==a.type&&n.push("["+a.name+'] Expected type "'+a.type+'", got "'+r.type+'"'));else if(r.constructed===a.constructed||void 0===a.constructed){if(i=!0,a.value&&e.util.isArray(a.value))for(var l=0,s=0;i&&s<a.value.length;++s)i=a.value[s].optional||!1,r.value[l]&&((i=t.validate(r.value[l],a.value[s],o,n))?++l:a.value[s].optional&&(i=!0)),!i&&n&&n.push("["+a.name+'] Tag class "'+a.tagClass+'", type "'+a.type+'" expected value length "'+a.value.length+'", got "'+r.value.length+'"');if(i&&o&&(a.capture&&(o[a.capture]=r.value),a.captureAsn1&&(o[a.captureAsn1]=r),a.captureBitStringContents&&"bitStringContents"in r&&(o[a.captureBitStringContents]=r.bitStringContents),a.captureBitStringValue&&"bitStringContents"in r))if(r.bitStringContents.length<2)o[a.captureBitStringValue]="";else{if(0!==r.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");o[a.captureBitStringValue]=r.bitStringContents.slice(1)}}else n&&n.push("["+a.name+'] Expected constructed "'+a.constructed+'", got "'+r.constructed+'"');return i};var o=/[^\\u0000-\\u00ff]/;return t.prettyPrint=function(r,a,n){var i="";n=n||2,(a=a||0)>0&&(i+="\n");for(var l="",s=0;s<a*n;++s)l+=" ";switch(i+=l+"Tag: ",r.tagClass){case t.Class.UNIVERSAL:i+="Universal:";break;case t.Class.APPLICATION:i+="Application:";break;case t.Class.CONTEXT_SPECIFIC:i+="Context-Specific:";break;case t.Class.PRIVATE:i+="Private:"}if(r.tagClass===t.Class.UNIVERSAL)switch(i+=r.type,r.type){case t.Type.NONE:i+=" (None)";break;case t.Type.BOOLEAN:i+=" (Boolean)";break;case t.Type.INTEGER:i+=" (Integer)";break;case t.Type.BITSTRING:i+=" (Bit string)";break;case t.Type.OCTETSTRING:i+=" (Octet string)";break;case t.Type.NULL:i+=" (Null)";break;case t.Type.OID:i+=" (Object Identifier)";break;case t.Type.ODESC:i+=" (Object Descriptor)";break;case t.Type.EXTERNAL:i+=" (External or Instance of)";break;case t.Type.REAL:i+=" (Real)";break;case t.Type.ENUMERATED:i+=" (Enumerated)";break;case t.Type.EMBEDDED:i+=" (Embedded PDV)";break;case t.Type.UTF8:i+=" (UTF8)";break;case t.Type.ROID:i+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:i+=" (Sequence)";break;case t.Type.SET:i+=" (Set)";break;case t.Type.PRINTABLESTRING:i+=" (Printable String)";break;case t.Type.IA5String:i+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:i+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:i+=" (Generalized time)";break;case t.Type.BMPSTRING:i+=" (BMP String)"}else i+=r.type;if(i+="\n",i+=l+"Constructed: "+r.constructed+"\n",r.composed){var c=0,u="";for(s=0;s<r.value.length;++s)void 0!==r.value[s]&&(c+=1,u+=t.prettyPrint(r.value[s],a+1,n),s+1<r.value.length&&(u+=","));i+=l+"Sub values: "+c+u}else{if(i+=l+"Value: ",r.type===t.Type.OID){var v=t.derToOid(r.value);i+=v,e.pki&&e.pki.oids&&v in e.pki.oids&&(i+=" ("+e.pki.oids[v]+") ")}if(r.type===t.Type.INTEGER)try{i+=t.derToInteger(r.value)}catch(p){i+="0x"+e.util.bytesToHex(r.value)}else if(r.type===t.Type.BITSTRING){if(r.value.length>1?i+="0x"+e.util.bytesToHex(r.value.slice(1)):i+="(none)",r.value.length>0){var d=r.value.charCodeAt(0);1==d?i+=" (1 unused bit shown)":d>1&&(i+=" ("+d+" unused bits shown)")}}else if(r.type===t.Type.OCTETSTRING)o.test(r.value)||(i+="("+r.value+") "),i+="0x"+e.util.bytesToHex(r.value);else if(r.type===t.Type.UTF8)try{i+=e.util.decodeUtf8(r.value)}catch(f){if("URI malformed"!==f.message)throw f;i+="0x"+e.util.bytesToHex(r.value)+" (malformed UTF8)"}else r.type===t.Type.PRINTABLESTRING||r.type===t.Type.IA5String?i+=r.value:o.test(r.value)?i+="0x"+e.util.bytesToHex(r.value):0===r.value.length?i+="[null]":i+=r.value}return i},nn.exports}var un,vn,dn,pn={exports:{}};function fn(){if(vn)return un;vn=1;var e=jo();return un=e.md=e.md||{},e.md.algorithms=e.md.algorithms||{},un}function hn(){if(dn)return pn.exports;dn=1;var e=jo();return fn(),Wo(),(pn.exports=e.hmac=e.hmac||{}).create=function(){var t=null,r=null,a=null,o=null,n={start:function(n,i){if(null!==n)if("string"==typeof n){if(!((n=n.toLowerCase())in e.md.algorithms))throw new Error('Unknown hash algorithm "'+n+'"');r=e.md.algorithms[n].create()}else r=n;if(null===i)i=t;else{if("string"==typeof i)i=e.util.createBuffer(i);else if(e.util.isArray(i)){var l=i;i=e.util.createBuffer();for(var s=0;s<l.length;++s)i.putByte(l[s])}var c=i.length();c>r.blockLength&&(r.start(),r.update(i.bytes()),i=r.digest()),a=e.util.createBuffer(),o=e.util.createBuffer(),c=i.length();for(s=0;s<c;++s){l=i.at(s);a.putByte(54^l),o.putByte(92^l)}if(c<r.blockLength)for(l=r.blockLength-c,s=0;s<l;++s)a.putByte(54),o.putByte(92);t=i,a=a.bytes(),o=o.bytes()}r.start(),r.update(a)},update:function(e){r.update(e)},getMac:function(){var e=r.digest().bytes();return r.start(),r.update(o),r.update(e),r.digest()}};return n.digest=n.getMac,n},pn.exports}var gn,mn={exports:{}};function bn(){if(gn)return mn.exports;gn=1;var e=jo();fn(),Wo();var t=mn.exports=e.md5=e.md5||{};e.md.md5=e.md.algorithms.md5=t,t.create=function(){i||function(){r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],o=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],n=new Array(64);for(var t=0;t<64;++t)n[t]=Math.floor(4294967296*Math.abs(Math.sin(t+1)));i=!0}();var t=null,s=e.util.createBuffer(),c=new Array(16),u={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){u.messageLength=0,u.fullMessageLength=u.messageLength64=[];for(var r=u.messageLengthSize/4,a=0;a<r;++a)u.fullMessageLength.push(0);return s=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},u}};return u.start(),u.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var o=r.length;u.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var n=u.fullMessageLength.length-1;n>=0;--n)u.fullMessageLength[n]+=o[1],o[1]=o[0]+(u.fullMessageLength[n]/4294967296>>>0),u.fullMessageLength[n]=u.fullMessageLength[n]>>>0,o[0]=o[1]/4294967296>>>0;return s.putBytes(r),l(t,c,s),(s.read>2048||0===s.length())&&s.compact(),u},u.digest=function(){var a=e.util.createBuffer();a.putBytes(s.bytes());var o=u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize&u.blockLength-1;a.putBytes(r.substr(0,u.blockLength-o));for(var n,i=0,v=u.fullMessageLength.length-1;v>=0;--v)i=(n=8*u.fullMessageLength[v]+i)/4294967296>>>0,a.putInt32Le(n>>>0);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};l(d,c,a);var p=e.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},u};var r=null,a=null,o=null,n=null,i=!1;function l(e,t,r){for(var i,l,s,c,u,v,d,p=r.length();p>=64;){for(l=e.h0,s=e.h1,c=e.h2,u=e.h3,d=0;d<16;++d)t[d]=r.getInt32Le(),i=l+(u^s&(c^u))+n[d]+t[d],l=u,u=c,c=s,s+=i<<(v=o[d])|i>>>32-v;for(;d<32;++d)i=l+(c^u&(s^c))+n[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=o[d])|i>>>32-v;for(;d<48;++d)i=l+(s^c^u)+n[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=o[d])|i>>>32-v;for(;d<64;++d)i=l+(c^(s|~u))+n[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=o[d])|i>>>32-v;e.h0=e.h0+l|0,e.h1=e.h1+s|0,e.h2=e.h2+c|0,e.h3=e.h3+u|0,p-=64}}return mn.exports}var yn,_n={exports:{}};function wn(){if(yn)return _n.exports;yn=1;var e=jo();Wo();var t=_n.exports=e.pem=e.pem||{};function r(e){for(var t=e.name+": ",r=[],a=function(e,t){return" "+t},o=0;o<e.values.length;++o)r.push(e.values[o].replace(/^(\S+\r\n)/,a));t+=r.join(",")+"\r\n";var n=0,i=-1;for(o=0;o<t.length;++o,++n)if(n>65&&-1!==i){var l=t[i];","===l?(++i,t=t.substr(0,i)+"\r\n "+t.substr(i)):t=t.substr(0,i)+"\r\n"+l+t.substr(i+1),n=o-i-1,i=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(i=o);return t}function a(e){return e.replace(/^\s+/,"")}return t.encode=function(t,a){a=a||{};var o,n="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(n+=r(o={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(n+=r(o={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(o={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&o.values.push(t.dekInfo.parameters),n+=r(o)),t.headers)for(var i=0;i<t.headers.length;++i)n+=r(t.headers[i]);return t.procType&&(n+="\r\n"),n+=e.util.encode64(t.body,a.maxline||64)+"\r\n",n+="-----END "+t.type+"-----\r\n"},t.decode=function(t){for(var r,o=[],n=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,i=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,l=/\r?\n/;r=n.exec(t);){var s=r[1];"NEW CERTIFICATE REQUEST"===s&&(s="CERTIFICATE REQUEST");var c={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(r[3])};if(o.push(c),r[2]){for(var u=r[2].split(l),v=0;r&&v<u.length;){for(var d=u[v].replace(/\s+$/,""),p=v+1;p<u.length;++p){var f=u[p];if(!/\s/.test(f[0]))break;d+=f,v=p}if(r=d.match(i)){for(var h={name:r[1],values:[]},g=r[2].split(","),m=0;m<g.length;++m)h.values.push(a(g[m]));if(c.procType)if(c.contentDomain||"Content-Domain"!==h.name)if(c.dekInfo||"DEK-Info"!==h.name)c.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:g[0],parameters:g[1]||null}}else c.contentDomain=g[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:g[0],type:g[1]}}}++v}if("ENCRYPTED"===c.procType&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===o.length)throw new Error("Invalid PEM formatted message.");return o},_n.exports}var Cn,xn,En={exports:{}};function Sn(){if(xn)return Cn;xn=1;var e=jo();function t(t,r){e.cipher.registerAlgorithm(t,function(){return new e.des.Algorithm(t,r)})}Yo(),en(),Wo(),Cn=e.des=e.des||{},e.des.startEncrypting=function(e,t,r,a){var o=v({key:e,output:r,decrypt:!1,mode:a||(null===t?"ECB":"CBC")});return o.start(t),o},e.des.createEncryptionCipher=function(e,t){return v({key:e,output:null,decrypt:!1,mode:t})},e.des.startDecrypting=function(e,t,r,a){var o=v({key:e,output:r,decrypt:!0,mode:a||(null===t?"ECB":"CBC")});return o.start(t),o},e.des.createDecryptionCipher=function(e,t){return v({key:e,output:null,decrypt:!0,mode:t})},e.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return u(r._keys,e,t,!1)},decrypt:function(e,t){return u(r._keys,e,t,!0)}}}),r._init=!1},e.des.Algorithm.prototype.initialize=function(t){if(!this._init){var r=e.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==r.length())throw new Error("Invalid Triple-DES key size: "+8*r.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],o=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],s=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],v=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],f=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],y=0,_=0;_<g;_++){var w=e.getInt32(),C=e.getInt32();w^=(t=252645135&(w>>>4^C))<<4,w^=t=65535&((C^=t)>>>-16^w),w^=(t=858993459&(w>>>2^(C^=t<<-16)))<<2,w^=t=65535&((C^=t)>>>-16^w),w^=(t=1431655765&(w>>>1^(C^=t<<-16)))<<1,w^=t=16711935&((C^=t)>>>8^w),t=(w^=(t=1431655765&(w>>>1^(C^=t<<8)))<<1)<<8|(C^=t)>>>20&240,w=C<<24|C<<8&16711680|C>>>8&65280|C>>>24&240,C=t;for(var x=0;x<b.length;++x){b[x]?(w=w<<2|w>>>26,C=C<<2|C>>>26):(w=w<<1|w>>>27,C=C<<1|C>>>27),C&=-15;var E=r[(w&=-15)>>>28]|a[w>>>24&15]|o[w>>>20&15]|n[w>>>16&15]|i[w>>>12&15]|l[w>>>8&15]|s[w>>>4&15],S=c[C>>>28]|u[C>>>24&15]|v[C>>>20&15]|d[C>>>16&15]|p[C>>>12&15]|f[C>>>8&15]|h[C>>>4&15];t=65535&(S>>>16^E),m[y++]=E^t,m[y++]=S^t<<16}}return m}(r),this._init=!0}},t("DES-ECB",e.cipher.modes.ecb),t("DES-CBC",e.cipher.modes.cbc),t("DES-CFB",e.cipher.modes.cfb),t("DES-OFB",e.cipher.modes.ofb),t("DES-CTR",e.cipher.modes.ctr),t("3DES-ECB",e.cipher.modes.ecb),t("3DES-CBC",e.cipher.modes.cbc),t("3DES-CFB",e.cipher.modes.cfb),t("3DES-OFB",e.cipher.modes.ofb),t("3DES-CTR",e.cipher.modes.ctr);var r=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],n=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],i=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],s=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],c=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function u(e,t,u,v){var d,p,f=32===e.length?3:9;d=3===f?v?[30,-2,-2]:[0,32,2]:v?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var h=t[0],g=t[1];h^=(p=252645135&(h>>>4^g))<<4,h^=(p=65535&(h>>>16^(g^=p)))<<16,h^=p=858993459&((g^=p)>>>2^h),h^=p=16711935&((g^=p<<2)>>>8^h),h=(h^=(p=1431655765&(h>>>1^(g^=p<<8)))<<1)<<1|h>>>31,g=(g^=p)<<1|g>>>31;for(var m=0;m<f;m+=3){for(var b=d[m+1],y=d[m+2],_=d[m];_!=b;_+=y){var w=g^e[_],C=(g>>>4|g<<28)^e[_+1];p=h,h=g,g=p^(a[w>>>24&63]|n[w>>>16&63]|l[w>>>8&63]|c[63&w]|r[C>>>24&63]|o[C>>>16&63]|i[C>>>8&63]|s[63&C])}p=h,h=g,g=p}g=g>>>1|g<<31,g^=p=1431655765&((h=h>>>1|h<<31)>>>1^g),g^=(p=16711935&(g>>>8^(h^=p<<1)))<<8,g^=(p=858993459&(g>>>2^(h^=p)))<<2,g^=p=65535&((h^=p)>>>16^g),g^=p=252645135&((h^=p<<16)>>>4^g),h^=p<<4,u[0]=h,u[1]=g}function v(t){var r,a="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),o=(r=t.decrypt?e.cipher.createDecipher(a,t.key):e.cipher.createCipher(a,t.key)).start;return r.start=function(t,a){var n=null;a instanceof e.util.ByteBuffer&&(n=a,a={}),(a=a||{}).output=n,a.iv=t,o.call(r,a)},r}return Cn}const kn=Oo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var An,Tn;function In(){if(Tn)return An;Tn=1;var e=jo();hn(),fn(),Wo();var t,r=e.pkcs5=e.pkcs5||{};return e.util.isNodejs&&!e.options.usePureJavaScript&&(t=kn),An=e.pbkdf2=r.pbkdf2=function(r,a,o,n,i,l){if("function"==typeof i&&(l=i,i=null),e.util.isNodejs&&!e.options.usePureJavaScript&&t.pbkdf2&&(null===i||"object"!=typeof i)&&(t.pbkdf2Sync.length>4||!i||"sha1"===i))return"string"!=typeof i&&(i="sha1"),r=Buffer.from(r,"binary"),a=Buffer.from(a,"binary"),l?4===t.pbkdf2Sync.length?t.pbkdf2(r,a,o,n,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):t.pbkdf2(r,a,o,n,i,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):4===t.pbkdf2Sync.length?t.pbkdf2Sync(r,a,o,n).toString("binary"):t.pbkdf2Sync(r,a,o,n,i).toString("binary");if(null==i&&(i="sha1"),"string"==typeof i){if(!(i in e.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=e.md[i].create()}var s=i.digestLength;if(n>4294967295*s){var c=new Error("Derived key is too long.");if(l)return l(c);throw c}var u=Math.ceil(n/s),v=n-(u-1)*s,d=e.hmac.create();d.start(i,r);var p,f,h,g="";if(!l){for(var m=1;m<=u;++m){d.start(null,null),d.update(a),d.update(e.util.int32ToBytes(m)),p=h=d.digest().getBytes();for(var b=2;b<=o;++b)d.start(null,null),d.update(h),f=d.digest().getBytes(),p=e.util.xorBytes(p,f,s),h=f;g+=m<u?p:p.substr(0,v)}return g}m=1;function y(){if(m>u)return l(null,g);d.start(null,null),d.update(a),d.update(e.util.int32ToBytes(m)),p=h=d.digest().getBytes(),b=2,_()}function _(){if(b<=o)return d.start(null,null),d.update(h),f=d.digest().getBytes(),p=e.util.xorBytes(p,f,s),h=f,++b,e.util.setImmediate(_);g+=m<u?p:p.substr(0,v),++m,y()}y()}}var Bn,Nn={exports:{}},Rn={exports:{}};function zn(){if(Bn)return Rn.exports;Bn=1;var e=jo();fn(),Wo();var t=Rn.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=t,t.create=function(){a||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=!0);var t=null,i=e.util.createBuffer(),l=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,a=0;a<r;++a)s.fullMessageLength.push(0);return i=e.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var o=r.length;s.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=o[1],o[1]=o[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(r),n(t,l,i),(i.read>2048||0===i.length())&&i.compact(),s},s.digest=function(){var a=e.util.createBuffer();a.putBytes(i.bytes());var o,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;a.putBytes(r.substr(0,s.blockLength-c));for(var u=8*s.fullMessageLength[0],v=0;v<s.fullMessageLength.length-1;++v)u+=(o=8*s.fullMessageLength[v+1])/4294967296>>>0,a.putInt32(u>>>0),u=o>>>0;a.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};n(d,l,a);var p=e.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p.putInt32(d.h5),p.putInt32(d.h6),p.putInt32(d.h7),p},s};var r=null,a=!1,o=null;function n(e,t,r){for(var a,n,i,l,s,c,u,v,d,p,f,h,g,m=r.length();m>=64;){for(s=0;s<16;++s)t[s]=r.getInt32();for(;s<64;++s)a=((a=t[s-2])>>>17|a<<15)^(a>>>19|a<<13)^a>>>10,n=((n=t[s-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[s]=a+t[s-7]+n+t[s-16]|0;for(c=e.h0,u=e.h1,v=e.h2,d=e.h3,p=e.h4,f=e.h5,h=e.h6,g=e.h7,s=0;s<64;++s)i=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),l=c&u|v&(c^u),a=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(h^p&(f^h))+o[s]+t[s],g=h,h=f,f=p,p=d+a>>>0,d=v,v=u,u=c,c=a+(n=i+l)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+u|0,e.h2=e.h2+v|0,e.h3=e.h3+d|0,e.h4=e.h4+p|0,e.h5=e.h5+f|0,e.h6=e.h6+h|0,e.h7=e.h7+g|0,m-=64}}return Rn.exports}var Ln,Dn,Un,Pn,Vn,Mn,On={exports:{}};function jn(){if(Ln)return On.exports;Ln=1;var e=jo();Wo();var t=null;return!e.util.isNodejs||e.options.usePureJavaScript||process.versions["node-webkit"]||(t=kn),(On.exports=e.prng=e.prng||{}).create=function(r){for(var a={plugin:r,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},o=r.md,n=new Array(32),i=0;i<32;++i)n[i]=o.create();function l(){if(a.pools[0].messageLength>=32)return s();var e=32-a.pools[0].messageLength<<5;a.collect(a.seedFileSync(e)),s()}function s(){a.reseeds=4294967295===a.reseeds?0:a.reseeds+1;var e=a.plugin.md.create();e.update(a.keyBytes);for(var t=1,r=0;r<32;++r)a.reseeds%t===0&&(e.update(a.pools[r].digest().getBytes()),a.pools[r].start()),t<<=1;a.keyBytes=e.digest().getBytes(),e.start(),e.update(a.keyBytes);var o=e.digest().getBytes();a.key=a.plugin.formatKey(a.keyBytes),a.seed=a.plugin.formatSeed(o),a.generated=0}function c(t){var r=null,a=e.util.globalScope,o=a.crypto||a.msCrypto;o&&o.getRandomValues&&(r=function(e){return o.getRandomValues(e)});var n=e.util.createBuffer();if(r)for(;n.length()<t;){var i=Math.max(1,Math.min(t-n.length(),65536)/4),l=new Uint32Array(Math.floor(i));try{r(l);for(var s=0;s<l.length;++s)n.putInt32(l[s])}catch(p){if(!("undefined"!=typeof QuotaExceededError&&p instanceof QuotaExceededError))throw p}}if(n.length()<t)for(var c,u,v,d=Math.floor(65536*Math.random());n.length()<t;){u=16807*(65535&d),u+=(32767&(c=16807*(d>>16)))<<16,d=4294967295&(u=(2147483647&(u+=c>>15))+(u>>31));for(s=0;s<3;++s)v=d>>>(s<<3),v^=Math.floor(256*Math.random()),n.putByte(255&v)}return n.getBytes(t)}return a.pools=n,a.pool=0,a.generate=function(t,r){if(!r)return a.generateSync(t);var o=a.plugin.cipher,n=a.plugin.increment,i=a.plugin.formatKey,l=a.plugin.formatSeed,c=e.util.createBuffer();a.key=null,function u(v){if(v)return r(v);if(c.length()>=t)return r(null,c.getBytes(t));a.generated>1048575&&(a.key=null);if(null===a.key)return e.util.nextTick(function(){!function(e){if(a.pools[0].messageLength>=32)return s(),e();var t=32-a.pools[0].messageLength<<5;a.seedFile(t,function(t,r){if(t)return e(t);a.collect(r),s(),e()})}(u)});var d=o(a.key,a.seed);a.generated+=d.length,c.putBytes(d),a.key=i(o(a.key,n(a.seed))),a.seed=l(o(a.key,a.seed)),e.util.setImmediate(u)}()},a.generateSync=function(t){var r=a.plugin.cipher,o=a.plugin.increment,n=a.plugin.formatKey,i=a.plugin.formatSeed;a.key=null;for(var s=e.util.createBuffer();s.length()<t;){a.generated>1048575&&(a.key=null),null===a.key&&l();var c=r(a.key,a.seed);a.generated+=c.length,s.putBytes(c),a.key=n(r(a.key,o(a.seed))),a.seed=i(r(a.key,a.seed))}return s.getBytes(t)},t?(a.seedFile=function(e,r){t.randomBytes(e,function(e,t){if(e)return r(e);r(null,t.toString())})},a.seedFileSync=function(e){return t.randomBytes(e).toString()}):(a.seedFile=function(e,t){try{t(null,c(e))}catch(r){t(r)}},a.seedFileSync=c),a.collect=function(e){for(var t=e.length,r=0;r<t;++r)a.pools[a.pool].update(e.substr(r,1)),a.pool=31===a.pool?0:a.pool+1},a.collectInt=function(e,t){for(var r="",o=0;o<t;o+=8)r+=String.fromCharCode(e>>o&255);a.collect(r)},a.registerWorker=function(e){if(e===self)a.seedFile=function(e,t){self.addEventListener("message",function e(r){var a=r.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",e),t(a.forge.prng.err,a.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",function(t){var r=t.data;r.forge&&r.forge.prng&&a.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})})}},a},On.exports}function qn(){if(Dn)return Nn.exports;Dn=1;var e=jo();return tn(),zn(),jn(),Wo(),e.random&&e.random.getBytes?Nn.exports=e.random:function(t){var r={},a=new Array(4),o=e.util.createBuffer();function n(){var t=e.prng.create(r);return t.getBytes=function(e,r){return t.generate(e,r)},t.getBytesSync=function(e){return t.generate(e)},t}r.formatKey=function(t){var r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),e.aes._expandKey(t,!1)},r.formatSeed=function(t){var r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),t},r.cipher=function(t,r){return e.aes._updateBlock(t,r,a,!1),o.putInt32(a[0]),o.putInt32(a[1]),o.putInt32(a[2]),o.putInt32(a[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=e.md.sha256;var i=n(),l=null,s=e.util.globalScope,c=s.crypto||s.msCrypto;if(c&&c.getRandomValues&&(l=function(e){return c.getRandomValues(e)}),e.options.usePureJavaScript||!e.util.isNodejs&&!l){if(i.collectInt(+new Date,32),"undefined"!=typeof navigator){var u="";for(var v in navigator)try{"string"==typeof navigator[v]&&(u+=navigator[v])}catch(d){}i.collect(u),u=null}t&&(t().mousemove(function(e){i.collectInt(e.clientX,16),i.collectInt(e.clientY,16)}),t().keypress(function(e){i.collectInt(e.charCode,8)}))}if(e.random)for(var v in i)e.random[v]=i[v];else e.random=i;e.random.createInstance=n,Nn.exports=e.random}("undefined"!=typeof jQuery?jQuery:null),Nn.exports}function Fn(){if(Pn)return Un;Pn=1;var e=jo();Wo();var t=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],r=[1,2,3,5],a=function(e,t){return e<<t&65535|(65535&e)>>16-t},o=function(e,t){return(65535&e)>>t|e<<16-t&65535};Un=e.rc2=e.rc2||{},e.rc2.expandKey=function(r,a){"string"==typeof r&&(r=e.util.createBuffer(r)),a=a||128;var o,n=r,i=r.length(),l=a,s=Math.ceil(l/8),c=255>>(7&l);for(o=i;o<128;o++)n.putByte(t[n.at(o-1)+n.at(o-i)&255]);for(n.setAt(128-s,t[n.at(128-s)&c]),o=127-s;o>=0;o--)n.setAt(o,t[n.at(o+1)^n.at(o+s)]);return n};var n=function(t,n,i){var l,s,c,u,v=!1,d=null,p=null,f=null,h=[];for(t=e.rc2.expandKey(t,n),c=0;c<64;c++)h.push(t.getInt16Le());i?(l=function(e){for(c=0;c<4;c++)e[c]+=h[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=a(e[c],r[c]),u++},s=function(e){for(c=0;c<4;c++)e[c]+=h[63&e[(c+3)%4]]}):(l=function(e){for(c=3;c>=0;c--)e[c]=o(e[c],r[c]),e[c]-=h[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),u--},s=function(e){for(c=3;c>=0;c--)e[c]-=h[63&e[(c+3)%4]]});var g=function(e){var t=[];for(c=0;c<4;c++){var r=d.getInt16Le();null!==f&&(i?r^=f.getInt16Le():f.putInt16Le(r)),t.push(65535&r)}u=i?0:63;for(var a=0;a<e.length;a++)for(var o=0;o<e[a][0];o++)e[a][1](t);for(c=0;c<4;c++)null!==f&&(i?f.putInt16Le(t[c]):t[c]^=f.getInt16Le()),p.putInt16Le(t[c])},m=null;return m={start:function(t,r){t&&"string"==typeof t&&(t=e.util.createBuffer(t)),v=!1,d=e.util.createBuffer(),p=r||new e.util.createBuffer,f=t,m.output=p},update:function(e){for(v||d.putBuffer(e);d.length()>=8;)g([[5,l],[1,s],[6,l],[1,s],[5,l]])},finish:function(e){var t=!0;if(i)if(e)t=e(8,d,!i);else{var r=8===d.length()?8:8-d.length();d.fillWithByte(r,r)}if(t&&(v=!0,m.update()),!i&&(t=0===d.length()))if(e)t=e(8,p,!i);else{var a=p.length(),o=p.at(a-1);o>a?t=!1:p.truncate(o)}return t}}};return e.rc2.startEncrypting=function(t,r,a){var o=e.rc2.createEncryptionCipher(t,128);return o.start(r,a),o},e.rc2.createEncryptionCipher=function(e,t){return n(e,t,!0)},e.rc2.startDecrypting=function(t,r,a){var o=e.rc2.createDecryptionCipher(t,128);return o.start(r,a),o},e.rc2.createDecryptionCipher=function(e,t){return n(e,t,!1)},Un}function Kn(){if(Mn)return Vn;Mn=1;var e,t=jo();function r(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new r(null)}function o(e,t,r,a,o,n){for(var i=16383&t,l=t>>14;--n>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,u=l*s+c*i;o=((s=i*s+((16383&u)<<14)+r.data[a]+o)>>28)+(u>>14)+l*c,r.data[a++]=268435455&s}return o}Vn=t.jsbn=t.jsbn||{},t.jsbn.BigInteger=r,"undefined"==typeof navigator?(r.prototype.am=o,e=28):"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,a,o,n){for(var i=32767&t,l=t>>15;--n>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,u=l*s+c*i;o=((s=i*s+((32767&u)<<15)+r.data[a]+(1073741823&o))>>>30)+(u>>>15)+l*c+(o>>>30),r.data[a++]=1073741823&s}return o},e=30):"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,a,o,n){for(;--n>=0;){var i=t*this.data[e++]+r.data[a]+o;o=Math.floor(i/67108864),r.data[a++]=67108863&i}return o},e=26):(r.prototype.am=o,e=28),r.prototype.DB=e,r.prototype.DM=(1<<e)-1,r.prototype.DV=1<<e;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-e,r.prototype.F2=2*e-52;var n,i,l=new Array;for(n="0".charCodeAt(0),i=0;i<=9;++i)l[n++]=i;for(n="a".charCodeAt(0),i=10;i<36;++i)l[n++]=i;for(n="A".charCodeAt(0),i=10;i<36;++i)l[n++]=i;function s(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function c(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function u(e){var t=a();return t.fromInt(e),t}function v(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function d(e){this.m=e}function p(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function f(e,t){return e&t}function h(e,t){return e|t}function g(e,t){return e^t}function m(e,t){return e&~t}function b(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function y(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function w(e){return e}function C(e){this.r2=a(),this.q3=a(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},p.prototype.convert=function(e){var t=a();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},p.prototype.revert=function(e){var t=a();return e.copyTo(t),this.reduce(t),t},p.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],a=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,a,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},p.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},p.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var a;if(16==t)a=4;else if(8==t)a=3;else if(256==t)a=8;else if(2==t)a=1;else if(32==t)a=5;else{if(4!=t)return void this.fromRadix(e,t);a=2}this.t=0,this.s=0;for(var o=e.length,n=!1,i=0;--o>=0;){var l=8==a?255&e[o]:c(e,o);l<0?"-"==e.charAt(o)&&(n=!0):(n=!1,0==i?this.data[this.t++]=l:i+a>this.DB?(this.data[this.t-1]|=(l&(1<<this.DB-i)-1)<<i,this.data[this.t++]=l>>this.DB-i):this.data[this.t-1]|=l<<i,(i+=a)>=this.DB&&(i-=this.DB))}8==a&&128&e[0]&&(this.s=-1,i>0&&(this.data[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),n&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,a=e%this.DB,o=this.DB-a,n=(1<<o)-1,i=Math.floor(e/this.DB),l=this.s<<a&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+i+1]=this.data[r]>>o|l,l=(this.data[r]&n)<<a;for(r=i-1;r>=0;--r)t.data[r]=0;t.data[i]=l,t.t=this.t+i+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var a=e%this.DB,o=this.DB-a,n=(1<<a)-1;t.data[0]=this.data[r]>>a;for(var i=r+1;i<this.t;++i)t.data[i-r-1]|=(this.data[i]&n)<<o,t.data[i-r]=this.data[i]>>a;a>0&&(t.data[this.t-r-1]|=(this.s&n)<<o),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,a=0,o=Math.min(e.t,this.t);r<o;)a+=this.data[r]-e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a-=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a-=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a-=e.s}t.s=a<0?-1:0,a<-1?t.data[r++]=this.DV+a:a>0&&(t.data[r++]=a),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var a=this.abs(),o=e.abs(),n=a.t;for(t.t=n+o.t;--n>=0;)t.data[n]=0;for(n=0;n<o.t;++n)t.data[n+a.t]=a.am(0,o.data[n],t,n,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var a=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,a,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,o){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=o&&this.copyTo(o));null==o&&(o=a());var l=a(),s=this.s,c=e.s,u=this.DB-v(n.data[n.t-1]);u>0?(n.lShiftTo(u,l),i.lShiftTo(u,o)):(n.copyTo(l),i.copyTo(o));var d=l.t,p=l.data[d-1];if(0!=p){var f=p*(1<<this.F1)+(d>1?l.data[d-2]>>this.F2:0),h=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,b=o.t,y=b-d,_=null==t?a():t;for(l.dlShiftTo(y,_),o.compareTo(_)>=0&&(o.data[o.t++]=1,o.subTo(_,o)),r.ONE.dlShiftTo(d,_),_.subTo(l,l);l.t<d;)l.data[l.t++]=0;for(;--y>=0;){var w=o.data[--b]==p?this.DM:Math.floor(o.data[b]*h+(o.data[b-1]+m)*g);if((o.data[b]+=l.am(0,w,o,y,0,d))<w)for(l.dlShiftTo(y,_),o.subTo(_,o);o.data[b]<--w;)o.subTo(_,o)}null!=t&&(o.drShiftTo(d,t),s!=c&&r.ZERO.subTo(t,t)),o.t=d,o.clamp(),u>0&&o.rShiftTo(u,o),s<0&&r.ZERO.subTo(o,o)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var o=a(),n=a(),i=t.convert(this),l=v(e)-1;for(i.copyTo(o);--l>=0;)if(t.sqrTo(o,n),(e&1<<l)>0)t.mulTo(n,i,o);else{var s=o;o=n,n=s}return t.revert(o)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,a=(1<<t)-1,o=!1,n="",i=this.t,l=this.DB-i*this.DB%t;if(i-- >0)for(l<this.DB&&(r=this.data[i]>>l)>0&&(o=!0,n=s(r));i>=0;)l<t?(r=(this.data[i]&(1<<l)-1)<<t-l,r|=this.data[--i]>>(l+=this.DB-t)):(r=this.data[i]>>(l-=t)&a,l<=0&&(l+=this.DB,--i)),r>0&&(o=!0),o&&(n+=s(r));return o?n:"0"},r.prototype.negate=function(){var e=a();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+v(this.data[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new d(t):new p(t),this.exp(e,r)},r.ZERO=u(0),r.ONE=u(1),_.prototype.convert=w,_.prototype.revert=w,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.prototype.sqrTo=function(e,t){e.squareTo(t)},C.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t},C.prototype.revert=function(e){return e},C.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},C.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],E=(1<<26)/x[x.length-1];return r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),o=u(r),n=a(),i=a(),l="";for(this.divRemTo(o,n,i);n.signum()>0;)l=(r+i.intValue()).toString(e).substr(1)+l,n.divRemTo(o,n,i);return i.intValue().toString(e)+l},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var a=this.chunkSize(t),o=Math.pow(t,a),n=!1,i=0,l=0,s=0;s<e.length;++s){var u=c(e,s);u<0?"-"==e.charAt(s)&&0==this.signum()&&(n=!0):(l=t*l+u,++i>=a&&(this.dMultiply(o),this.dAddOffset(l,0),i=0,l=0))}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(l,0)),n&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,a){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),h,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var o=new Array,n=7&e;o.length=1+(e>>3),t.nextBytes(o),n>0?o[0]&=(1<<n)-1:o[0]=0,this.fromString(o,256)}},r.prototype.bitwiseTo=function(e,t,r){var a,o,n=Math.min(e.t,this.t);for(a=0;a<n;++a)r.data[a]=t(this.data[a],e.data[a]);if(e.t<this.t){for(o=e.s&this.DM,a=n;a<this.t;++a)r.data[a]=t(this.data[a],o);r.t=this.t}else{for(o=this.s&this.DM,a=n;a<e.t;++a)r.data[a]=t(o,e.data[a]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var a=r.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a},r.prototype.addTo=function(e,t){for(var r=0,a=0,o=Math.min(e.t,this.t);r<o;)a+=this.data[r]+e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a+=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a+=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=e.s}t.s=a<0?-1:0,a>0?t.data[r++]=a:a<-1&&(t.data[r++]=this.DV+a),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var a,o=Math.min(this.t+e.t,t);for(r.s=0,r.t=o;o>0;)r.data[--o]=0;for(a=r.t-this.t;o<a;++o)r.data[o+this.t]=this.am(0,e.data[o],r,o,0,this.t);for(a=Math.min(e.t,t);o<a;++o)this.am(0,e.data[o],r,o,0,t-o);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var a=r.t=this.t+e.t-t;for(r.s=0;--a>=0;)r.data[a]=0;for(a=Math.max(t-this.t,0);a<e.t;++a)r.data[this.t+a-t]=this.am(t-a,e.data[a],r,0,0,this.t+a-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var a=this.t-1;a>=0;--a)r=(t*r+this.data[a])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var o,n=t.shiftRight(a),i={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},l=0;l<e;++l){do{o=new r(this.bitLength(),i)}while(o.compareTo(r.ONE)<=0||o.compareTo(t)>=0);var s=o.modPow(n,this);if(0!=s.compareTo(r.ONE)&&0!=s.compareTo(t)){for(var c=1;c++<a&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=a();return this.copyTo(e),e},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,a=this.DB-e*this.DB%8,o=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[o++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),128&r&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=a();return this.bitwiseTo(e,f,t),t},r.prototype.or=function(e){var t=a();return this.bitwiseTo(e,h,t),t},r.prototype.xor=function(e){var t=a();return this.bitwiseTo(e,g,t),t},r.prototype.andNot=function(e){var t=a();return this.bitwiseTo(e,m,t),t},r.prototype.not=function(){for(var e=a(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=a();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=a();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+b(this.data[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=y(this.data[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this.data[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,h)},r.prototype.clearBit=function(e){return this.changeBit(e,m)},r.prototype.flipBit=function(e){return this.changeBit(e,g)},r.prototype.add=function(e){var t=a();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=a();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=a();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=a();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=a();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,o,n=e.bitLength(),i=u(1);if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,o=n<8?new d(t):t.isEven()?new C(t):new p(t);var l=new Array,s=3,c=r-1,f=(1<<r)-1;if(l[1]=o.convert(this),r>1){var h=a();for(o.sqrTo(l[1],h);s<=f;)l[s]=a(),o.mulTo(h,l[s-2],l[s]),s+=2}var g,m,b=e.t-1,y=!0,_=a();for(n=v(e.data[b])-1;b>=0;){for(n>=c?g=e.data[b]>>n-c&f:(g=(e.data[b]&(1<<n+1)-1)<<c-n,b>0&&(g|=e.data[b-1]>>this.DB+n-c)),s=r;!(1&g);)g>>=1,--s;if((n-=s)<0&&(n+=this.DB,--b),y)l[g].copyTo(i),y=!1;else{for(;s>1;)o.sqrTo(i,_),o.sqrTo(_,i),s-=2;s>0?o.sqrTo(i,_):(m=i,i=_,_=m),o.mulTo(_,l[g],i)}for(;b>=0&&!(e.data[b]&1<<n);)o.sqrTo(i,_),m=i,i=_,_=m,--n<0&&(n=this.DB-1,--b)}return o.revert(i)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var a=e.clone(),o=this.clone(),n=u(1),i=u(0),l=u(0),s=u(1);0!=a.signum();){for(;a.isEven();)a.rShiftTo(1,a),t?(n.isEven()&&i.isEven()||(n.addTo(this,n),i.subTo(e,i)),n.rShiftTo(1,n)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;o.isEven();)o.rShiftTo(1,o),t?(l.isEven()&&s.isEven()||(l.addTo(this,l),s.subTo(e,s)),l.rShiftTo(1,l)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);a.compareTo(o)>=0?(a.subTo(o,a),t&&n.subTo(l,n),i.subTo(s,i)):(o.subTo(a,o),t&&l.subTo(n,l),s.subTo(i,s))}return 0!=o.compareTo(r.ONE)?r.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},r.prototype.pow=function(e){return this.exp(e,new _)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var a=t;t=r,r=a}var o=t.getLowestSetBit(),n=r.getLowestSetBit();if(n<0)return t;for(o<n&&(n=o),n>0&&(t.rShiftTo(n,t),r.rShiftTo(n,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return n>0&&r.lShiftTo(n,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=x[x.length-1]){for(t=0;t<x.length;++t)if(r.data[0]==x[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<x.length;){for(var a=x[t],o=t+1;o<x.length&&a<E;)a*=x[o++];for(a=r.modInt(a);t<o;)if(a%x[t++]==0)return!1}return r.millerRabin(e)},Vn}var $n,Hn,Gn={exports:{}},Wn={exports:{}};function Yn(){if($n)return Wn.exports;$n=1;var e=jo();fn(),Wo();var t=Wn.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=t,t.create=function(){a||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),a=!0);var t=null,n=e.util.createBuffer(),i=new Array(80),l={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,a=0;a<r;++a)l.fullMessageLength.push(0);return n=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},l}};return l.start(),l.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var s=r.length;l.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=l.fullMessageLength.length-1;c>=0;--c)l.fullMessageLength[c]+=s[1],s[1]=s[0]+(l.fullMessageLength[c]/4294967296>>>0),l.fullMessageLength[c]=l.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return n.putBytes(r),o(t,i,n),(n.read>2048||0===n.length())&&n.compact(),l},l.digest=function(){var a=e.util.createBuffer();a.putBytes(n.bytes());var s,c=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;a.putBytes(r.substr(0,l.blockLength-c));for(var u=8*l.fullMessageLength[0],v=0;v<l.fullMessageLength.length-1;++v)u+=(s=8*l.fullMessageLength[v+1])/4294967296>>>0,a.putInt32(u>>>0),u=s>>>0;a.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};o(d,i,a);var p=e.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p},l};var r=null,a=!1;function o(e,t,r){for(var a,o,n,i,l,s,c,u=r.length();u>=64;){for(o=e.h0,n=e.h1,i=e.h2,l=e.h3,s=e.h4,c=0;c<16;++c)a=r.getInt32(),t[c]=a,a=(o<<5|o>>>27)+(l^n&(i^l))+s+1518500249+a,s=l,l=i,i=(n<<30|n>>>2)>>>0,n=o,o=a;for(;c<20;++c)a=(a=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|a>>>31,t[c]=a,a=(o<<5|o>>>27)+(l^n&(i^l))+s+1518500249+a,s=l,l=i,i=(n<<30|n>>>2)>>>0,n=o,o=a;for(;c<32;++c)a=(a=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|a>>>31,t[c]=a,a=(o<<5|o>>>27)+(n^i^l)+s+1859775393+a,s=l,l=i,i=(n<<30|n>>>2)>>>0,n=o,o=a;for(;c<40;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(o<<5|o>>>27)+(n^i^l)+s+1859775393+a,s=l,l=i,i=(n<<30|n>>>2)>>>0,n=o,o=a;for(;c<60;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(o<<5|o>>>27)+(n&i|l&(n^i))+s+2400959708+a,s=l,l=i,i=(n<<30|n>>>2)>>>0,n=o,o=a;for(;c<80;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(o<<5|o>>>27)+(n^i^l)+s+3395469782+a,s=l,l=i,i=(n<<30|n>>>2)>>>0,n=o,o=a;e.h0=e.h0+o|0,e.h1=e.h1+n|0,e.h2=e.h2+i|0,e.h3=e.h3+l|0,e.h4=e.h4+s|0,u-=64}}return Wn.exports}function Qn(){if(Hn)return Gn.exports;Hn=1;var e=jo();Wo(),qn(),Yn();var t=Gn.exports=e.pkcs1=e.pkcs1||{};function r(t,r,a){a||(a=e.md.sha1.create());for(var o="",n=Math.ceil(r/a.digestLength),i=0;i<n;++i){var l=String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,255&i);a.start(),a.update(t+l),o+=a.digest().getBytes()}return o.substring(0,r)}return t.encode_rsa_oaep=function(t,a,o){var n,i,l,s;"string"==typeof o?(n=o,i=arguments[3]||void 0,l=arguments[4]||void 0):o&&(n=o.label||void 0,i=o.seed||void 0,l=o.md||void 0,o.mgf1&&o.mgf1.md&&(s=o.mgf1.md)),l?l.start():l=e.md.sha1.create(),s||(s=l);var c=Math.ceil(t.n.bitLength()/8),u=c-2*l.digestLength-2;if(a.length>u)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=a.length,g.maxLength=u,g;n||(n=""),l.update(n,"raw");for(var v=l.digest(),d="",p=u-a.length,f=0;f<p;f++)d+="\0";var h=v.getBytes()+d+""+a;if(i){if(i.length!==l.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=i.length,g.digestLength=l.digestLength,g}}else i=e.random.getBytes(l.digestLength);var m=r(i,c-l.digestLength-1,s),b=e.util.xorBytes(h,m,h.length),y=r(b,l.digestLength,s);return"\0"+e.util.xorBytes(i,y,i.length)+b},t.decode_rsa_oaep=function(t,a,o){var n,i,l;"string"==typeof o?(n=o,i=arguments[3]||void 0):o&&(n=o.label||void 0,i=o.md||void 0,o.mgf1&&o.mgf1.md&&(l=o.mgf1.md));var s=Math.ceil(t.n.bitLength()/8);if(a.length!==s)throw(m=new Error("RSAES-OAEP encoded message length is invalid.")).length=a.length,m.expectedLength=s,m;if(void 0===i?i=e.md.sha1.create():i.start(),l||(l=i),s<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),i.update(n,"raw");for(var c=i.digest().getBytes(),u=a.charAt(0),v=a.substring(1,i.digestLength+1),d=a.substring(1+i.digestLength),p=r(d,i.digestLength,l),f=r(e.util.xorBytes(v,p,v.length),s-i.digestLength-1,l),h=e.util.xorBytes(d,f,d.length),g=h.substring(0,i.digestLength),m="\0"!==u,b=0;b<i.digestLength;++b)m|=c.charAt(b)!==g.charAt(b);for(var y=1,_=i.digestLength,w=i.digestLength;w<h.length;w++){var C=h.charCodeAt(w);m|=C&(y?65534:0),_+=y&=1&C^1}if(m||1!==h.charCodeAt(_))throw new Error("Invalid RSAES-OAEP padding.");return h.substring(_+1)},Gn.exports}var Jn,Xn,Zn,ei,ti,ri={exports:{}};function ai(){if(Jn)return ri.exports;Jn=1;var e=jo();return Wo(),Kn(),qn(),function(){if(e.prime)ri.exports=e.prime;else{var t=ri.exports=e.prime=e.prime||{},r=e.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var n=function(e,t){return e|t};t.generateProbablePrime=function(t,a,o){"function"==typeof a&&(o=a,a={});var n=(a=a||{}).algorithm||"PRIMEINC";"string"==typeof n&&(n={name:n}),n.options=n.options||{};var l=a.prng||e.random,c={nextBytes:function(e){for(var t=l.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===n.name)return function(t,a,o,n){if("workers"in o)return function(t,a,o,n){if("undefined"==typeof Worker)return i(t,a,o,n);var l=s(t,a),c=o.workers,u=o.workLoad||100,v=30*u/8,d=o.workerScript||"forge/prime.worker.js";if(-1===c)return e.util.estimateCores(function(e,t){e&&(t=2),c=t-1,p()});function p(){c=Math.max(1,c);for(var e=[],o=0;o<c;++o)e[o]=new Worker(d);for(o=0;o<c;++o)e[o].addEventListener("message",p);var i=!1;function p(o){if(!i){var c=o.data;if(c.found){for(var d=0;d<e.length;++d)e[d].terminate();return i=!0,n(null,new r(c.prime,16))}l.bitLength()>t&&(l=s(t,a));var p=l.toString(16);o.target.postMessage({hex:p,workLoad:u}),l.dAddOffset(v,0)}}}p()}(t,a,o,n);return i(t,a,o,n)}(t,c,n.options,o);throw new Error("Invalid prime generation algorithm: "+n.name)}}function i(e,t,r,a){var o=s(e,t),n=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(o.bitLength());"millerRabinTests"in r&&(n=r.millerRabinTests);var i=10;"maxBlockTime"in r&&(i=r.maxBlockTime),l(o,e,t,0,n,i,a)}function l(t,r,o,n,i,c,u){var v=+new Date;do{if(t.bitLength()>r&&(t=s(r,o)),t.isProbablePrime(i))return u(null,t);t.dAddOffset(a[n++%8],0)}while(c<0||+new Date-v<c);e.util.setImmediate(function(){l(t,r,o,n,i,c,u)})}function s(e,t){var a=new r(e,t),i=e-1;return a.testBit(i)||a.bitwiseTo(r.ONE.shiftLeft(i),n,a),a.dAddOffset(31-a.mod(o).byteValue(),0),a}}(),ri.exports}function oi(){if(Zn)return Xn;Zn=1;var e=jo();if(cn(),Kn(),sn(),Qn(),ai(),qn(),Wo(),void 0===t)var t=e.jsbn.BigInteger;var r=e.util.isNodejs?kn:null,a=e.asn1,o=e.util;e.pki=e.pki||{},Xn=e.pki.rsa=e.rsa=e.rsa||{};var n=e.pki,i=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},s={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},c={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},u=e.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},v={name:"DigestInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},d=function(e){var t;if(!(e.algorithm in n.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=n.oids[e.algorithm];var o=a.oidToDer(t).getBytes(),i=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),l=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);l.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,o)),l.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var s=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(l),i.value.push(s),a.toDer(i).getBytes()},p=function(r,a,o){if(o)return r.modPow(a.e,a.n);if(!a.p||!a.q)return r.modPow(a.d,a.n);var n;a.dP||(a.dP=a.d.mod(a.p.subtract(t.ONE))),a.dQ||(a.dQ=a.d.mod(a.q.subtract(t.ONE))),a.qInv||(a.qInv=a.q.modInverse(a.p));do{n=new t(e.util.bytesToHex(e.random.getBytes(a.n.bitLength()/8)),16)}while(n.compareTo(a.n)>=0||!n.gcd(a.n).equals(t.ONE));for(var i=(r=r.multiply(n.modPow(a.e,a.n)).mod(a.n)).mod(a.p).modPow(a.dP,a.p),l=r.mod(a.q).modPow(a.dQ,a.q);i.compareTo(l)<0;)i=i.add(a.p);var s=i.subtract(l).multiply(a.qInv).mod(a.p).multiply(a.q).add(l);return s=s.multiply(n.modInverse(a.n)).mod(a.n)};function f(t,r,a){var o=e.util.createBuffer(),n=Math.ceil(r.n.bitLength()/8);if(t.length>n-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=t.length,i.max=n-11,i}o.putByte(0),o.putByte(a);var l,s=n-3-t.length;if(0===a||1===a){l=0===a?0:255;for(var c=0;c<s;++c)o.putByte(l)}else for(;s>0;){var u=0,v=e.random.getBytes(s);for(c=0;c<s;++c)0===(l=v.charCodeAt(c))?++u:o.putByte(l);s=u}return o.putByte(0),o.putBytes(t),o}function h(t,r,a,o){var n=Math.ceil(r.n.bitLength()/8),i=e.util.createBuffer(t),l=i.getByte(),s=i.getByte();if(0!==l||a&&0!==s&&1!==s||!a&&2!=s||a&&0===s&&void 0===o)throw new Error("Encryption block is invalid.");var c=0;if(0===s){c=n-3-o;for(var u=0;u<c;++u)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(c=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++c}else if(2===s)for(c=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++c}if(0!==i.getByte()||c!==n-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function g(t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var a=e.util.hexToBytes(r);return!(a.length>1)||(0!==a.charCodeAt(0)||128&a.charCodeAt(1))&&(255!==a.charCodeAt(0)||128&~a.charCodeAt(1))?a:a.substr(1)}function m(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function b(t){return e.util.isNodejs&&"function"==typeof r[t]}function y(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function _(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function w(t){for(var r=e.util.hexToBytes(t.toString(16)),a=new Uint8Array(r.length),o=0;o<r.length;++o)a[o]=r.charCodeAt(o);return a}return n.rsa.encrypt=function(r,a,o){var n,i=o,l=Math.ceil(a.n.bitLength()/8);!1!==o&&!0!==o?(i=2===o,n=f(r,a,o)):(n=e.util.createBuffer()).putBytes(r);for(var s=new t(n.toHex(),16),c=p(s,a,i).toString(16),u=e.util.createBuffer(),v=l-Math.ceil(c.length/2);v>0;)u.putByte(0),--v;return u.putBytes(e.util.hexToBytes(c)),u.getBytes()},n.rsa.decrypt=function(r,a,o,n){var i=Math.ceil(a.n.bitLength()/8);if(r.length!==i){var l=new Error("Encrypted message length is invalid.");throw l.length=r.length,l.expected=i,l}var s=new t(e.util.createBuffer(r).toHex(),16);if(s.compareTo(a.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=p(s,a,o).toString(16),u=e.util.createBuffer(),v=i-Math.ceil(c.length/2);v>0;)u.putByte(0),--v;return u.putBytes(e.util.hexToBytes(c)),!1!==n?h(u.getBytes(),a,o):u.getBytes()},n.rsa.createKeyPairGenerationState=function(r,a,o){"string"==typeof r&&(r=parseInt(r,10)),r=r||2048;var n,i=(o=o||{}).prng||e.random,l={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},s=o.algorithm||"PRIMEINC";if("PRIMEINC"!==s)throw new Error("Invalid key generation algorithm: "+s);return(n={algorithm:s,state:0,bits:r,rng:l,eInt:a||65537,e:new t(null),p:null,q:null,qBits:r>>1,pBits:r-(r>>1),pqState:0,num:null,keys:null}).e.fromInt(n.eInt),n},n.rsa.stepKeyPairGenerationState=function(e,r){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new t(null);a.fromInt(30);for(var o,l=0,s=function(e,t){return e|t},c=+new Date,u=0;null===e.keys&&(r<=0||u<r);){if(0===e.state){var v=null===e.p?e.pBits:e.qBits,d=v-1;0===e.pqState?(e.num=new t(v,e.rng),e.num.testBit(d)||e.num.bitwiseTo(t.ONE.shiftLeft(d),s,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),l=0,++e.pqState):1===e.pqState?e.num.bitLength()>v?e.pqState=0:e.num.isProbablePrime(m(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(i[l++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(t.ONE).gcd(e.e).compareTo(t.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(t.ONE),e.q1=e.q.subtract(t.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(t.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:n.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:n.rsa.setPublicKey(e.n,e.e)}}u+=(o=+new Date)-c,c=o}return null!==e.keys},n.rsa.generateKeyPair=function(i,l,s,c){if(1===arguments.length?"object"==typeof i?(s=i,i=void 0):"function"==typeof i&&(c=i,i=void 0):2===arguments.length?"number"==typeof i?"function"==typeof l?(c=l,l=void 0):"number"!=typeof l&&(s=l,l=void 0):(s=i,c=l,i=void 0,l=void 0):3===arguments.length&&("number"==typeof l?"function"==typeof s&&(c=s,s=void 0):(c=s,s=l,l=void 0)),s=s||{},void 0===i&&(i=s.bits||2048),void 0===l&&(l=s.e||65537),!e.options.usePureJavaScript&&!s.prng&&i>=256&&i<=16384&&(65537===l||3===l))if(c){if(b("generateKeyPair"))return r.generateKeyPair("rsa",{modulusLength:i,publicExponent:l,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return c(e);c(null,{privateKey:n.privateKeyFromPem(r),publicKey:n.publicKeyFromPem(t)})});if(y("generateKey")&&y("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:w(l),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){c(e)}).then(function(t){if(t){var r=n.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(t)));c(null,{privateKey:r,publicKey:n.setRsaPublicKey(r.n,r.e)})}});if(_("generateKey")&&_("exportKey")){var u=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:w(l),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(t){var r=t.target.result,i=o.globalScope.msCrypto.subtle.exportKey("pkcs8",r.privateKey);i.oncomplete=function(t){var r=t.target.result,o=n.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(r)));c(null,{privateKey:o,publicKey:n.setRsaPublicKey(o.n,o.e)})},i.onerror=function(e){c(e)}},void(u.onerror=function(e){c(e)})}}else if(b("generateKeyPairSync")){var v=r.generateKeyPairSync("rsa",{modulusLength:i,publicExponent:l,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:n.privateKeyFromPem(v.privateKey),publicKey:n.publicKeyFromPem(v.publicKey)}}var d=n.rsa.createKeyPairGenerationState(i,l,s);if(!c)return n.rsa.stepKeyPairGenerationState(d,0),d.keys;!function(r,a,o){"function"==typeof a&&(o=a,a={});a=a||{};var i={algorithm:{name:a.algorithm||"PRIMEINC",options:{workers:a.workers||2,workLoad:a.workLoad||100,workerScript:a.workerScript}}};"prng"in a&&(i.prng=a.prng);function l(){s(r.pBits,function(e,t){return e?o(e):(r.p=t,null!==r.q?c(e,r.q):void s(r.qBits,c))})}function s(t,r){e.prime.generateProbablePrime(t,i,r)}function c(e,a){if(e)return o(e);if(r.q=a,r.p.compareTo(r.q)<0){var i=r.p;r.p=r.q,r.q=i}if(0!==r.p.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.p=null,void l();if(0!==r.q.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.q=null,void s(r.qBits,c);if(r.p1=r.p.subtract(t.ONE),r.q1=r.q.subtract(t.ONE),r.phi=r.p1.multiply(r.q1),0!==r.phi.gcd(r.e).compareTo(t.ONE))return r.p=r.q=null,void l();if(r.n=r.p.multiply(r.q),r.n.bitLength()!==r.bits)return r.q=null,void s(r.qBits,c);var u=r.e.modInverse(r.phi);r.keys={privateKey:n.rsa.setPrivateKey(r.n,r.e,u,r.p,r.q,u.mod(r.p1),u.mod(r.q1),r.q.modInverse(r.p)),publicKey:n.rsa.setPublicKey(r.n,r.e)},o(null,r.keys)}l()}(d,s,c)},n.setRsaPublicKey=n.rsa.setPublicKey=function(t,r){var o={n:t,e:r,encrypt:function(t,r,a){if("string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===r)r={encode:function(e,t,r){return f(e,t,2).getBytes()}};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={encode:function(t,r){return e.pkcs1.encode_rsa_oaep(r,t,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(r))r={encode:function(e){return e}};else if("string"==typeof r)throw new Error('Unsupported encryption scheme: "'+r+'".');var i=r.encode(t,o,!0);return n.rsa.encrypt(i,o,!0)},verify:function(t,r,i,l){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===l&&(l={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in l||(l._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(t,r){r=h(r,o,!0);var n=a.fromDer(r,{parseAllBytes:l._parseAllDigestBytes}),i={},s=[];if(!a.validate(n,v,i,s))throw(c=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=s,c;var c,u=a.derToOid(i.algorithmIdentifier);if(u!==e.oids.md2&&u!==e.oids.md5&&u!==e.oids.sha1&&u!==e.oids.sha224&&u!==e.oids.sha256&&u!==e.oids.sha384&&u!==e.oids.sha512&&u!==e.oids["sha512-224"]&&u!==e.oids["sha512-256"])throw(c=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,c;if((u===e.oids.md2||u===e.oids.md5)&&!("parameters"in i))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return t===i.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=h(t,o,!0))}});var s=n.rsa.decrypt(r,o,!0,!1);return i.verify(t,s,o.n.bitLength())}};return o},n.setRsaPrivateKey=n.rsa.setPrivateKey=function(t,r,a,o,i,l,s,c){var u={n:t,e:r,d:a,p:o,q:i,dP:l,dQ:s,qInv:c,decrypt:function(t,r,a){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5");var o=n.rsa.decrypt(t,u,!1,!1);if("RSAES-PKCS1-V1_5"===r)r={decode:h};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={decode:function(t,r){return e.pkcs1.decode_rsa_oaep(r,t,a)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(r))throw new Error('Unsupported encryption scheme: "'+r+'".');r={decode:function(e){return e}}}return r.decode(o,u,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var a=t.encode(e,u.n.bitLength());return n.rsa.encrypt(a,u,r)}};return u},n.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(n.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},n.privateKeyFromAsn1=function(r){var o,i,c,u,v,d,p,f,h={},g=[];if(a.validate(r,l,h,g)&&(r=a.fromDer(e.util.createBuffer(h.privateKey))),h={},g=[],!a.validate(r,s,h,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return o=e.util.createBuffer(h.privateKeyModulus).toHex(),i=e.util.createBuffer(h.privateKeyPublicExponent).toHex(),c=e.util.createBuffer(h.privateKeyPrivateExponent).toHex(),u=e.util.createBuffer(h.privateKeyPrime1).toHex(),v=e.util.createBuffer(h.privateKeyPrime2).toHex(),d=e.util.createBuffer(h.privateKeyExponent1).toHex(),p=e.util.createBuffer(h.privateKeyExponent2).toHex(),f=e.util.createBuffer(h.privateKeyCoefficient).toHex(),n.setRsaPrivateKey(new t(o,16),new t(i,16),new t(c,16),new t(u,16),new t(v,16),new t(d,16),new t(p,16),new t(f,16))},n.privateKeyToAsn1=n.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.qInv))])},n.publicKeyFromAsn1=function(r){var o={},i=[];if(a.validate(r,u,o,i)){var l,s=a.derToOid(o.publicKeyOid);if(s!==n.oids.rsaEncryption)throw(l=new Error("Cannot read public key. Unknown OID.")).oid=s,l;r=o.rsaPublicKey}if(i=[],!a.validate(r,c,o,i))throw(l=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=i,l;var v=e.util.createBuffer(o.publicKeyModulus).toHex(),d=e.util.createBuffer(o.publicKeyExponent).toHex();return n.setRsaPublicKey(new t(v,16),new t(d,16))},n.publicKeyToAsn1=n.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(n.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[n.publicKeyToRSAPublicKey(e)])])},n.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.e))])},Xn}function ni(){if(ti)return ei;ti=1;var e=jo();if(tn(),cn(),Sn(),fn(),sn(),In(),wn(),qn(),Fn(),oi(),Wo(),void 0===t)var t=e.jsbn.BigInteger;var r=e.asn1,a=e.pki=e.pki||{};ei=a.pbe=e.pbe=e.pbe||{};var o=a.oids,n={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},i={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};function s(e,t){return e.start().update(t).digest().getBytes()}function c(e){var t;if(e){if(!(t=a.oids[r.derToOid(e)])){var o=new Error("Unsupported PRF OID.");throw o.oid=e,o.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],o}}else t="hmacWithSHA1";return u(t)}function u(t){var r=e.md;switch(t){case"hmacWithSHA224":r=e.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=t,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!r||!(t in r))throw new Error("Unknown hash algorithm: "+t);return r[t].create()}return a.encryptPrivateKeyInfo=function(t,n,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||"aes128",i.prfAlgorithm=i.prfAlgorithm||"sha1";var l,s,c,v=e.random.getBytesSync(i.saltSize),d=i.count,p=r.integerToDer(d);if(0===i.algorithm.indexOf("aes")||"des"===i.algorithm){var f,h,g;switch(i.algorithm){case"aes128":l=16,f=16,h=o["aes128-CBC"],g=e.aes.createEncryptionCipher;break;case"aes192":l=24,f=16,h=o["aes192-CBC"],g=e.aes.createEncryptionCipher;break;case"aes256":l=32,f=16,h=o["aes256-CBC"],g=e.aes.createEncryptionCipher;break;case"des":l=8,f=8,h=o.desCBC,g=e.des.createEncryptionCipher;break;default:throw(C=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,C}var m="hmacWith"+i.prfAlgorithm.toUpperCase(),b=u(m),y=e.pkcs5.pbkdf2(n,v,d,l,b),_=e.random.getBytesSync(f);(x=g(y)).start(_),x.update(r.toDer(t)),x.finish(),c=x.output.getBytes();var w=function(t,o,n,i){var l=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,t),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,o.getBytes())]);"hmacWithSHA1"!==i&&l.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,e.util.hexToBytes(n.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.oids[i]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));return l}(v,p,l,m);s=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(o.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(o.pkcs5PBKDF2).getBytes()),w]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(h).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,_)])])])}else{var C;if("3des"!==i.algorithm)throw(C=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,C;l=24;var x,E=new e.util.ByteBuffer(v);y=a.pbe.generatePkcs12Key(n,E,1,d,l),_=a.pbe.generatePkcs12Key(n,E,2,d,l);(x=e.des.createEncryptionCipher(y)).start(_),x.update(r.toDer(t)),x.finish(),c=x.output.getBytes(),s=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(o["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,v),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,p.getBytes())])])}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[s,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)])},a.decryptPrivateKeyInfo=function(t,o){var i=null,l={},s=[];if(!r.validate(t,n,l,s)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=s,c}var u=r.derToOid(l.encryptionOid),v=a.pbe.getCipher(u,l.encryptionParams,o),d=e.util.createBuffer(l.encryptedData);return v.update(d),v.finish()&&(i=r.fromDer(v.output)),i},a.encryptedPrivateKeyToPem=function(t,a){var o={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(t).getBytes()};return e.pem.encode(o,{maxline:a})},a.encryptedPrivateKeyFromPem=function(t){var a=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var o=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw o.headerType=a.type,o}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(a.body)},a.encryptRsaPrivateKey=function(t,o,n){if(!(n=n||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));return i=a.encryptPrivateKeyInfo(i,o,n),a.encryptedPrivateKeyToPem(i)}var l,s,c,u;switch(n.algorithm){case"aes128":l="AES-128-CBC",c=16,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"aes192":l="AES-192-CBC",c=24,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"aes256":l="AES-256-CBC",c=32,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"3des":l="DES-EDE3-CBC",c=24,s=e.random.getBytesSync(8),u=e.des.createEncryptionCipher;break;case"des":l="DES-CBC",c=8,s=e.random.getBytesSync(8),u=e.des.createEncryptionCipher;break;default:var v=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw v.algorithm=n.algorithm,v}var d=u(e.pbe.opensslDeriveBytes(o,s.substr(0,8),c));d.start(s),d.update(r.toDer(a.privateKeyToAsn1(t))),d.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:l,parameters:e.util.bytesToHex(s).toUpperCase()},body:d.output.getBytes()};return e.pem.encode(p)},a.decryptRsaPrivateKey=function(t,o){var n=null,i=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var l,s;switch(i.dekInfo.algorithm){case"DES-CBC":l=8,s=e.des.createDecryptionCipher;break;case"DES-EDE3-CBC":l=24,s=e.des.createDecryptionCipher;break;case"AES-128-CBC":l=16,s=e.aes.createDecryptionCipher;break;case"AES-192-CBC":l=24,s=e.aes.createDecryptionCipher;break;case"AES-256-CBC":l=32,s=e.aes.createDecryptionCipher;break;case"RC2-40-CBC":l=5,s=function(t){return e.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":l=8,s=function(t){return e.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":l=16,s=function(t){return e.rc2.createDecryptionCipher(t,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var u=e.util.hexToBytes(i.dekInfo.parameters),v=s(e.pbe.opensslDeriveBytes(o,u.substr(0,8),l));if(v.start(u),v.update(e.util.createBuffer(i.body)),!v.finish())return n;n=v.output.getBytes()}else n=i.body;return null!==(n="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(r.fromDer(n),o):r.fromDer(n))&&(n=a.privateKeyFromAsn1(n)),n},a.pbe.generatePkcs12Key=function(t,r,a,o,n,i){var l,s;if(null==i){if(!("sha1"in e.md))throw new Error('"sha1" hash algorithm unavailable.');i=e.md.sha1.create()}var c=i.digestLength,u=i.blockLength,v=new e.util.ByteBuffer,d=new e.util.ByteBuffer;if(null!=t){for(s=0;s<t.length;s++)d.putInt16(t.charCodeAt(s));d.putInt16(0)}var p=d.length(),f=r.length(),h=new e.util.ByteBuffer;h.fillWithByte(a,u);var g=u*Math.ceil(f/u),m=new e.util.ByteBuffer;for(s=0;s<g;s++)m.putByte(r.at(s%f));var b=u*Math.ceil(p/u),y=new e.util.ByteBuffer;for(s=0;s<b;s++)y.putByte(d.at(s%p));var _=m;_.putBuffer(y);for(var w=Math.ceil(n/c),C=1;C<=w;C++){var x=new e.util.ByteBuffer;x.putBytes(h.bytes()),x.putBytes(_.bytes());for(var E=0;E<o;E++)i.start(),i.update(x.getBytes()),x=i.digest();var S=new e.util.ByteBuffer;for(s=0;s<u;s++)S.putByte(x.at(s%c));var k=Math.ceil(f/u)+Math.ceil(p/u),A=new e.util.ByteBuffer;for(l=0;l<k;l++){var T=new e.util.ByteBuffer(_.getBytes(u)),I=511;for(s=S.length()-1;s>=0;s--)I>>=8,I+=S.at(s)+T.at(s),T.setAt(s,255&I);A.putBuffer(T)}_=A,v.putBuffer(x)}return v.truncate(v.length()-n),v},a.pbe.getCipher=function(e,t,r){switch(e){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(e,t,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(e,t,r);default:var o=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw o.oid=e,o.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],o}},a.pbe.getCipherForPBES2=function(t,o,n){var l,s={},u=[];if(!r.validate(o,i,s,u))throw(l=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,l;if((t=r.derToOid(s.kdfOid))!==a.oids.pkcs5PBKDF2)throw(l=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,l.supportedOids=["pkcs5PBKDF2"],l;if((t=r.derToOid(s.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(l=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,l.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],l;var v,d,p=s.kdfSalt,f=e.util.createBuffer(s.kdfIterationCount);switch(f=f.getInt(f.length()<<3),a.oids[t]){case"aes128-CBC":v=16,d=e.aes.createDecryptionCipher;break;case"aes192-CBC":v=24,d=e.aes.createDecryptionCipher;break;case"aes256-CBC":v=32,d=e.aes.createDecryptionCipher;break;case"des-EDE3-CBC":v=24,d=e.des.createDecryptionCipher;break;case"desCBC":v=8,d=e.des.createDecryptionCipher}var h=c(s.prfOid),g=e.pkcs5.pbkdf2(n,p,f,v,h),m=s.encIv,b=d(g);return b.start(m),b},a.pbe.getCipherForPKCS12PBE=function(t,o,n){var i={},s=[];if(!r.validate(o,l,i,s))throw(h=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,h;var u,v,d,p=e.util.createBuffer(i.salt),f=e.util.createBuffer(i.iterations);switch(f=f.getInt(f.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,v=8,d=e.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,v=8,d=function(t,r){var a=e.rc2.createDecryptionCipher(t,40);return a.start(r,null),a};break;default:var h;throw(h=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,h}var g=c(i.prfOid),m=a.pbe.generatePkcs12Key(n,p,1,f,u,g);return g.start(),d(m,a.pbe.generatePkcs12Key(n,p,2,f,v,g))},a.pbe.opensslDeriveBytes=function(t,r,a,o){if(null==o){if(!("md5"in e.md))throw new Error('"md5" hash algorithm unavailable.');o=e.md.md5.create()}null===r&&(r="");for(var n=[s(o,t+r)],i=16,l=1;i<a;++l,i+=16)n.push(s(o,n[l-1]+t+r));return n.join("").substr(0,a)},ei}var ii,li={exports:{}},si={exports:{}};function ci(){if(ii)return si.exports;ii=1;var e=jo();cn(),Wo();var t=e.asn1,r=si.exports=e.pkcs7asn1=e.pkcs7asn1||{};e.pkcs7=e.pkcs7||{},e.pkcs7.asn1=r;var a={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=a;var o={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var n={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[n]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},si.exports}var ui,vi,di,pi={exports:{}},fi={exports:{}};function hi(){if(ui)return fi.exports;ui=1;var e=jo();return Wo(),e.mgf=e.mgf||{},(fi.exports=e.mgf.mgf1=e.mgf1=e.mgf1||{}).create=function(t){return{generate:function(r,a){for(var o=new e.util.ByteBuffer,n=Math.ceil(a/t.digestLength),i=0;i<n;i++){var l=new e.util.ByteBuffer;l.putInt32(i),t.start(),t.update(r+l.getBytes()),o.putBuffer(t.digest())}return o.truncate(o.length()-a),o.getBytes()}}},fi.exports}var gi,mi,bi,yi,_i,wi,Ci,xi={exports:{}};function Ei(){if(gi)return xi.exports;gi=1;var e=jo();return qn(),Wo(),(xi.exports=e.pss=e.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var r,a=t.md,o=t.mgf,n=a.digestLength,i=t.salt||null;if("string"==typeof i&&(i=e.util.createBuffer(i)),"saltLength"in t)r=t.saltLength;else{if(null===i)throw new Error("Salt length not specified or specific salt not given.");r=i.length()}if(null!==i&&i.length()!==r)throw new Error("Given salt length does not match length of given salt.");var l=t.prng||e.random,s={encode:function(t,s){var c,u,v=s-1,d=Math.ceil(v/8),p=t.digest().getBytes();if(d<n+r+2)throw new Error("Message is too long to encrypt.");u=null===i?l.getBytesSync(r):i.bytes();var f=new e.util.ByteBuffer;f.fillWithByte(0,8),f.putBytes(p),f.putBytes(u),a.start(),a.update(f.getBytes());var h=a.digest().getBytes(),g=new e.util.ByteBuffer;g.fillWithByte(0,d-r-n-2),g.putByte(1),g.putBytes(u);var m=g.getBytes(),b=d-n-1,y=o.generate(h,b),_="";for(c=0;c<b;c++)_+=String.fromCharCode(m.charCodeAt(c)^y.charCodeAt(c));var w=65280>>8*d-v&255;return(_=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1))+h+String.fromCharCode(188)},verify:function(t,i,l){var s,c=l-1,u=Math.ceil(c/8);if(i=i.substr(-u),u<n+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==i.charCodeAt(u-1))throw new Error("Encoded message does not end in 0xBC.");var v=u-n-1,d=i.substr(0,v),p=i.substr(v,n),f=65280>>8*u-c&255;if(0!==(d.charCodeAt(0)&f))throw new Error("Bits beyond keysize not zero as expected.");var h=o.generate(p,v),g="";for(s=0;s<v;s++)g+=String.fromCharCode(d.charCodeAt(s)^h.charCodeAt(s));g=String.fromCharCode(g.charCodeAt(0)&~f)+g.substr(1);var m=u-n-r-2;for(s=0;s<m;s++)if(0!==g.charCodeAt(s))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var b=g.substr(-r),y=new e.util.ByteBuffer;return y.fillWithByte(0,8),y.putBytes(t),y.putBytes(b),a.start(),a.update(y.getBytes()),p===a.digest().getBytes()}};return s},xi.exports}function Si(){if(mi)return pi.exports;mi=1;var e=jo();tn(),cn(),Sn(),fn(),function(){if(di)return vi;di=1;var e=jo();hi(),vi=e.mgf=e.mgf||{},e.mgf.mgf1=e.mgf1}(),sn(),wn(),Ei(),oi(),Wo();var t=e.asn1,r=pi.exports=e.pki=e.pki||{},a=r.oids,o={};o.CN=a.commonName,o.commonName="CN",o.C=a.countryName,o.countryName="C",o.L=a.localityName,o.localityName="L",o.ST=a.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=a.organizationName,o.organizationName="O",o.OU=a.organizationalUnitName,o.organizationalUnitName="OU",o.E=a.emailAddress,o.emailAddress="E";var n=e.pki.rsa.publicKeyValidator,i={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},n,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},s={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},n,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},c={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[s,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function u(e,t){"string"==typeof t&&(t={shortName:t});for(var r,a=null,o=0;null===a&&o<e.attributes.length;++o)r=e.attributes[o],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}r.RDNAttributesAsArray=function(e,r){for(var n,i,l,s=[],c=0;c<e.value.length;++c){n=e.value[c];for(var u=0;u<n.value.length;++u)l={},i=n.value[u],l.type=t.derToOid(i.value[0].value),l.value=i.value[1].value,l.valueTagClass=i.value[1].type,l.type in a&&(l.name=a[l.type],l.name in o&&(l.shortName=o[l.name])),r&&(r.update(l.type),r.update(l.value)),s.push(l)}return s},r.CRIAttributesAsArray=function(e){for(var n=[],i=0;i<e.length;++i)for(var l=e[i],s=t.derToOid(l.value[0].value),c=l.value[1].value,u=0;u<c.length;++u){var v={};if(v.type=s,v.value=c[u].value,v.valueTagClass=c[u].type,v.type in a&&(v.name=a[v.type],v.name in o&&(v.shortName=o[v.name])),v.type===a.extensionRequest){v.extensions=[];for(var d=0;d<v.value.length;++d)v.extensions.push(r.certificateExtensionFromAsn1(v.value[d]))}n.push(v)}return n};var v=function(e,r,o){var n={};if(e!==a["RSASSA-PSS"])return n;o&&(n={hash:{algorithmOid:a.sha1},mgf:{algorithmOid:a.mgf1,hash:{algorithmOid:a.sha1}},saltLength:20});var i={},s=[];if(!t.validate(r,l,i,s)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=s,c}return void 0!==i.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=t.derToOid(i.hashOid)),void 0!==i.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=t.derToOid(i.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=t.derToOid(i.maskGenHashOid)),void 0!==i.saltLength&&(n.saltLength=i.saltLength.charCodeAt(0)),n},d=function(t){switch(a[t.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return e.md.sha1.create();case"md5WithRSAEncryption":return e.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return e.md.sha256.create();case"sha384WithRSAEncryption":return e.md.sha384.create();case"sha512WithRSAEncryption":return e.md.sha512.create();default:var r=new Error("Could not compute "+t.type+" digest. Unknown signature OID.");throw r.signatureOid=t.signatureOid,r}},p=function(t){var r,o=t.certificate;switch(o.signatureOid){case a.sha1WithRSAEncryption:case a.sha1WithRSASignature:break;case a["RSASSA-PSS"]:var n,i,l;if(void 0===(n=a[o.signatureParameters.mgf.hash.algorithmOid])||void 0===e.md[n])throw(l=new Error("Unsupported MGF hash function.")).oid=o.signatureParameters.mgf.hash.algorithmOid,l.name=n,l;if(void 0===(i=a[o.signatureParameters.mgf.algorithmOid])||void 0===e.mgf[i])throw(l=new Error("Unsupported MGF function.")).oid=o.signatureParameters.mgf.algorithmOid,l.name=i,l;if(i=e.mgf[i].create(e.md[n].create()),void 0===(n=a[o.signatureParameters.hash.algorithmOid])||void 0===e.md[n])throw(l=new Error("Unsupported RSASSA-PSS hash function.")).oid=o.signatureParameters.hash.algorithmOid,l.name=n,l;r=e.pss.create(e.md[n].create(),i,o.signatureParameters.saltLength)}return o.publicKey.verify(t.md.digest().getBytes(),t.signature,r)};function f(r){for(var a,o,n=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),i=r.attributes,l=0;l<i.length;++l){var s=(a=i[l]).value,c=t.Type.PRINTABLESTRING;"valueTagClass"in a&&(c=a.valueTagClass)===t.Type.UTF8&&(s=e.util.encodeUtf8(s)),o=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),t.create(t.Class.UNIVERSAL,c,!1,s)])]),n.value.push(o)}return n}function h(e){for(var n,i=0;i<e.length;++i){if(void 0===(n=e[i]).name&&(n.type&&n.type in r.oids?n.name=r.oids[n.type]:n.shortName&&n.shortName in o&&(n.name=r.oids[o[n.shortName]])),void 0===n.type){if(!n.name||!(n.name in r.oids))throw(s=new Error("Attribute type not specified.")).attribute=n,s;n.type=r.oids[n.name]}if(void 0===n.shortName&&n.name&&n.name in o&&(n.shortName=o[n.name]),n.type===a.extensionRequest&&(n.valueConstructed=!0,n.valueTagClass=t.Type.SEQUENCE,!n.value&&n.extensions)){n.value=[];for(var l=0;l<n.extensions.length;++l)n.value.push(r.certificateExtensionToAsn1(g(n.extensions[l])))}var s;if(void 0===n.value)throw(s=new Error("Attribute value not specified.")).attribute=n,s}}function g(o,n){if(n=n||{},void 0===o.name&&o.id&&o.id in r.oids&&(o.name=r.oids[o.id]),void 0===o.id){if(!o.name||!(o.name in r.oids))throw(w=new Error("Extension ID not specified.")).extension=o,w;o.id=r.oids[o.name]}if(void 0!==o.value)return o;if("keyUsage"===o.name){var i=0,l=0,s=0;o.digitalSignature&&(l|=128,i=7),o.nonRepudiation&&(l|=64,i=6),o.keyEncipherment&&(l|=32,i=5),o.dataEncipherment&&(l|=16,i=4),o.keyAgreement&&(l|=8,i=3),o.keyCertSign&&(l|=4,i=2),o.cRLSign&&(l|=2,i=1),o.encipherOnly&&(l|=1,i=0),o.decipherOnly&&(s|=128,i=7);var c=String.fromCharCode(i);0!==s?c+=String.fromCharCode(l)+String.fromCharCode(s):0!==l&&(c+=String.fromCharCode(l)),o.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("basicConstraints"===o.name)o.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),o.cA&&o.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in o&&o.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(o.pathLenConstraint).getBytes()));else if("extKeyUsage"===o.name){o.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var u=o.value.value;for(var v in o)!0===o[v]&&(v in a?u.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a[v]).getBytes())):-1!==v.indexOf(".")&&u.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(v).getBytes())))}else if("nsCertType"===o.name){i=0,l=0;o.client&&(l|=128,i=7),o.server&&(l|=64,i=6),o.email&&(l|=32,i=5),o.objsign&&(l|=16,i=4),o.reserved&&(l|=8,i=3),o.sslCA&&(l|=4,i=2),o.emailCA&&(l|=2,i=1),o.objCA&&(l|=1,i=0);c=String.fromCharCode(i);0!==l&&(c+=String.fromCharCode(l)),o.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("subjectAltName"===o.name||"issuerAltName"===o.name){o.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var d=0;d<o.altNames.length;++d){c=(b=o.altNames[d]).value;if(7===b.type&&b.ip){if(null===(c=e.util.bytesFromIP(b.ip)))throw(w=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=o,w}else 8===b.type&&(c=b.oid?t.oidToDer(t.oidToDer(b.oid)):t.oidToDer(c));o.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,b.type,!1,c))}}else if("nsComment"===o.name&&n.cert){if(!/^[\x00-\x7F]*$/.test(o.comment)||o.comment.length<1||o.comment.length>128)throw new Error('Invalid "nsComment" content.');o.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,o.comment)}else if("subjectKeyIdentifier"===o.name&&n.cert){var p=n.cert.generateSubjectKeyIdentifier();o.subjectKeyIdentifier=p.toHex(),o.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===o.name&&n.cert){o.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);u=o.value.value;if(o.keyIdentifier){var h=!0===o.keyIdentifier?n.cert.generateSubjectKeyIdentifier().getBytes():o.keyIdentifier;u.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,h))}if(o.authorityCertIssuer){var g=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[f(!0===o.authorityCertIssuer?n.cert.issuer:o.authorityCertIssuer)])];u.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,g))}if(o.serialNumber){var m=e.util.hexToBytes(!0===o.serialNumber?n.cert.serialNumber:o.serialNumber);u.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===o.name){o.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);u=o.value.value;var b,y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),_=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<o.altNames.length;++d){c=(b=o.altNames[d]).value;if(7===b.type&&b.ip){if(null===(c=e.util.bytesFromIP(b.ip)))throw(w=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=o,w}else 8===b.type&&(c=b.oid?t.oidToDer(t.oidToDer(b.oid)):t.oidToDer(c));_.value.push(t.create(t.Class.CONTEXT_SPECIFIC,b.type,!1,c))}y.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[_])),u.push(y)}var w;if(void 0===o.value)throw(w=new Error("Extension value not specified.")).extension=o,w;return o}function m(e,r){if(e===a["RSASSA-PSS"]){var o=[];return void 0!==r.hash.algorithmOid&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,o)}return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}function b(r){var a=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===r.attributes.length)return a;for(var o=r.attributes,n=0;n<o.length;++n){var i=o[n],l=i.value,s=t.Type.UTF8;"valueTagClass"in i&&(s=i.valueTagClass),s===t.Type.UTF8&&(l=e.util.encodeUtf8(l));var c=!1;"valueConstructed"in i&&(c=i.valueConstructed);var u=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,s,c,l)])]);a.value.push(u)}return a}r.certificateFromPem=function(a,o,n){var i=e.pem.decode(a)[0];if("CERTIFICATE"!==i.type&&"X509 CERTIFICATE"!==i.type&&"TRUSTED CERTIFICATE"!==i.type){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=i.type,l}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=t.fromDer(i.body,n);return r.certificateFromAsn1(s,o)},r.certificateToPem=function(a,o){var n={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(a)).getBytes()};return e.pem.encode(n,{maxline:o})},r.publicKeyFromPem=function(a){var o=e.pem.decode(a)[0];if("PUBLIC KEY"!==o.type&&"RSA PUBLIC KEY"!==o.type){var n=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw n.headerType=o.type,n}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var i=t.fromDer(o.body);return r.publicKeyFromAsn1(i)},r.publicKeyToPem=function(a,o){var n={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(a)).getBytes()};return e.pem.encode(n,{maxline:o})},r.publicKeyToRSAPublicKeyPem=function(a,o){var n={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(a)).getBytes()};return e.pem.encode(n,{maxline:o})},r.getPublicKeyFingerprint=function(a,o){var n,i=(o=o||{}).md||e.md.sha1.create();switch(o.type||"RSAPublicKey"){case"RSAPublicKey":n=t.toDer(r.publicKeyToRSAPublicKey(a)).getBytes();break;case"SubjectPublicKeyInfo":n=t.toDer(r.publicKeyToAsn1(a)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+o.type+'".')}i.start(),i.update(n);var l=i.digest();if("hex"===o.encoding){var s=l.toHex();return o.delimiter?s.match(/.{2}/g).join(o.delimiter):s}if("binary"===o.encoding)return l.getBytes();if(o.encoding)throw new Error('Unknown encoding "'+o.encoding+'".');return l},r.certificationRequestFromPem=function(a,o,n){var i=e.pem.decode(a)[0];if("CERTIFICATE REQUEST"!==i.type){var l=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw l.headerType=i.type,l}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=t.fromDer(i.body,n);return r.certificationRequestFromAsn1(s,o)},r.certificationRequestToPem=function(a,o){var n={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(a)).getBytes()};return e.pem.encode(n,{maxline:o})},r.createCertificate=function(){var o={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return o.siginfo.algorithmOid=null,o.validity={},o.validity.notBefore=new Date,o.validity.notAfter=new Date,o.issuer={},o.issuer.getField=function(e){return u(o.issuer,e)},o.issuer.addField=function(e){h([e]),o.issuer.attributes.push(e)},o.issuer.attributes=[],o.issuer.hash=null,o.subject={},o.subject.getField=function(e){return u(o.subject,e)},o.subject.addField=function(e){h([e]),o.subject.attributes.push(e)},o.subject.attributes=[],o.subject.hash=null,o.extensions=[],o.publicKey=null,o.md=null,o.setSubject=function(e,t){h(e),o.subject.attributes=e,delete o.subject.uniqueId,t&&(o.subject.uniqueId=t),o.subject.hash=null},o.setIssuer=function(e,t){h(e),o.issuer.attributes=e,delete o.issuer.uniqueId,t&&(o.issuer.uniqueId=t),o.issuer.hash=null},o.setExtensions=function(e){for(var t=0;t<e.length;++t)g(e[t],{cert:o});o.extensions=e},o.getExtension=function(e){"string"==typeof e&&(e={name:e});for(var t,r=null,a=0;null===r&&a<o.extensions.length;++a)t=o.extensions[a],(e.id&&t.id===e.id||e.name&&t.name===e.name)&&(r=t);return r},o.sign=function(n,i){o.md=i||e.md.sha1.create();var l=a[o.md.algorithm+"WithRSAEncryption"];if(!l){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=o.md.algorithm,s}o.signatureOid=o.siginfo.algorithmOid=l,o.tbsCertificate=r.getTBSCertificate(o);var c=t.toDer(o.tbsCertificate);o.md.update(c.getBytes()),o.signature=n.sign(o.md)},o.verify=function(e){var a=!1;if(!o.issued(e)){var n=e.issuer,i=o.subject,l=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw l.expectedIssuer=i.attributes,l.actualIssuer=n.attributes,l}var s=e.md;if(null===s){s=d({signatureOid:e.signatureOid,type:"certificate"});var c=e.tbsCertificate||r.getTBSCertificate(e),u=t.toDer(c);s.update(u.getBytes())}return null!==s&&(a=p({certificate:o,md:s,signature:e.signature})),a},o.isIssuer=function(e){var t=!1,r=o.issuer,a=e.subject;if(r.hash&&a.hash)t=r.hash===a.hash;else if(r.attributes.length===a.attributes.length){var n,i;t=!0;for(var l=0;t&&l<r.attributes.length;++l)n=r.attributes[l],i=a.attributes[l],n.type===i.type&&n.value===i.value||(t=!1)}return t},o.issued=function(e){return e.isIssuer(o)},o.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(o.publicKey,{type:"RSAPublicKey"})},o.verifySubjectKeyIdentifier=function(){for(var t=a.subjectKeyIdentifier,r=0;r<o.extensions.length;++r){var n=o.extensions[r];if(n.id===t){var i=o.generateSubjectKeyIdentifier().getBytes();return e.util.hexToBytes(n.subjectKeyIdentifier)===i}}return!1},o},r.certificateFromAsn1=function(a,o){var n={},l=[];if(!t.validate(a,i,n,l)){var s=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw s.errors=l,s}if(t.derToOid(n.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificate();c.version=n.certVersion?n.certVersion.charCodeAt(0):0;var p=e.util.createBuffer(n.certSerialNumber);c.serialNumber=p.toHex(),c.signatureOid=e.asn1.derToOid(n.certSignatureOid),c.signatureParameters=v(c.signatureOid,n.certSignatureParams,!0),c.siginfo.algorithmOid=e.asn1.derToOid(n.certinfoSignatureOid),c.siginfo.parameters=v(c.siginfo.algorithmOid,n.certinfoSignatureParams,!1),c.signature=n.certSignature;var f=[];if(void 0!==n.certValidity1UTCTime&&f.push(t.utcTimeToDate(n.certValidity1UTCTime)),void 0!==n.certValidity2GeneralizedTime&&f.push(t.generalizedTimeToDate(n.certValidity2GeneralizedTime)),void 0!==n.certValidity3UTCTime&&f.push(t.utcTimeToDate(n.certValidity3UTCTime)),void 0!==n.certValidity4GeneralizedTime&&f.push(t.generalizedTimeToDate(n.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=f[0],c.validity.notAfter=f[1],c.tbsCertificate=n.tbsCertificate,o){c.md=d({signatureOid:c.signatureOid,type:"certificate"});var g=t.toDer(c.tbsCertificate);c.md.update(g.getBytes())}var m=e.md.sha1.create(),b=t.toDer(n.certIssuer);m.update(b.getBytes()),c.issuer.getField=function(e){return u(c.issuer,e)},c.issuer.addField=function(e){h([e]),c.issuer.attributes.push(e)},c.issuer.attributes=r.RDNAttributesAsArray(n.certIssuer),n.certIssuerUniqueId&&(c.issuer.uniqueId=n.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var y=e.md.sha1.create(),_=t.toDer(n.certSubject);return y.update(_.getBytes()),c.subject.getField=function(e){return u(c.subject,e)},c.subject.addField=function(e){h([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(n.certSubject),n.certSubjectUniqueId&&(c.subject.uniqueId=n.certSubjectUniqueId),c.subject.hash=y.digest().toHex(),n.certExtensions?c.extensions=r.certificateExtensionsFromAsn1(n.certExtensions):c.extensions=[],c.publicKey=r.publicKeyFromAsn1(n.subjectPublicKeyInfo),c},r.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var o=e.value[a],n=0;n<o.value.length;++n)t.push(r.certificateExtensionFromAsn1(o.value[n]));return t},r.certificateExtensionFromAsn1=function(r){var o={};if(o.id=t.derToOid(r.value[0].value),o.critical=!1,r.value[1].type===t.Type.BOOLEAN?(o.critical=0!==r.value[1].value.charCodeAt(0),o.value=r.value[2].value):o.value=r.value[1].value,o.id in a)if(o.name=a[o.id],"keyUsage"===o.name){var n=0,i=0;(s=t.fromDer(o.value)).value.length>1&&(n=s.value.charCodeAt(1),i=s.value.length>2?s.value.charCodeAt(2):0),o.digitalSignature=!(128&~n),o.nonRepudiation=!(64&~n),o.keyEncipherment=!(32&~n),o.dataEncipherment=!(16&~n),o.keyAgreement=!(8&~n),o.keyCertSign=!(4&~n),o.cRLSign=!(2&~n),o.encipherOnly=!(1&~n),o.decipherOnly=!(128&~i)}else if("basicConstraints"===o.name){(s=t.fromDer(o.value)).value.length>0&&s.value[0].type===t.Type.BOOLEAN?o.cA=0!==s.value[0].value.charCodeAt(0):o.cA=!1;var l=null;s.value.length>0&&s.value[0].type===t.Type.INTEGER?l=s.value[0].value:s.value.length>1&&(l=s.value[1].value),null!==l&&(o.pathLenConstraint=t.derToInteger(l))}else if("extKeyUsage"===o.name)for(var s=t.fromDer(o.value),c=0;c<s.value.length;++c){var u=t.derToOid(s.value[c].value);u in a?o[a[u]]=!0:o[u]=!0}else if("nsCertType"===o.name){n=0;(s=t.fromDer(o.value)).value.length>1&&(n=s.value.charCodeAt(1)),o.client=!(128&~n),o.server=!(64&~n),o.email=!(32&~n),o.objsign=!(16&~n),o.reserved=!(8&~n),o.sslCA=!(4&~n),o.emailCA=!(2&~n),o.objCA=!(1&~n)}else if("subjectAltName"===o.name||"issuerAltName"===o.name){var v;o.altNames=[];s=t.fromDer(o.value);for(var d=0;d<s.value.length;++d){var p={type:(v=s.value[d]).type,value:v.value};switch(o.altNames.push(p),v.type){case 1:case 2:case 6:break;case 7:p.ip=e.util.bytesToIP(v.value);break;case 8:p.oid=t.derToOid(v.value)}}}else if("subjectKeyIdentifier"===o.name){s=t.fromDer(o.value);o.subjectKeyIdentifier=e.util.bytesToHex(s.value)}return o},r.certificationRequestFromAsn1=function(a,o){var n={},i=[];if(!t.validate(a,c,n,i)){var l=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw l.errors=i,l}if(t.derToOid(n.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=r.createCertificationRequest();if(s.version=n.csrVersion?n.csrVersion.charCodeAt(0):0,s.signatureOid=e.asn1.derToOid(n.csrSignatureOid),s.signatureParameters=v(s.signatureOid,n.csrSignatureParams,!0),s.siginfo.algorithmOid=e.asn1.derToOid(n.csrSignatureOid),s.siginfo.parameters=v(s.siginfo.algorithmOid,n.csrSignatureParams,!1),s.signature=n.csrSignature,s.certificationRequestInfo=n.certificationRequestInfo,o){s.md=d({signatureOid:s.signatureOid,type:"certification request"});var p=t.toDer(s.certificationRequestInfo);s.md.update(p.getBytes())}var f=e.md.sha1.create();return s.subject.getField=function(e){return u(s.subject,e)},s.subject.addField=function(e){h([e]),s.subject.attributes.push(e)},s.subject.attributes=r.RDNAttributesAsArray(n.certificationRequestInfoSubject,f),s.subject.hash=f.digest().toHex(),s.publicKey=r.publicKeyFromAsn1(n.subjectPublicKeyInfo),s.getAttribute=function(e){return u(s,e)},s.addAttribute=function(e){h([e]),s.attributes.push(e)},s.attributes=r.CRIAttributesAsArray(n.certificationRequestInfoAttributes||[]),s},r.createCertificationRequest=function(){var o={version:0,signatureOid:null,signature:null,siginfo:{}};return o.siginfo.algorithmOid=null,o.subject={},o.subject.getField=function(e){return u(o.subject,e)},o.subject.addField=function(e){h([e]),o.subject.attributes.push(e)},o.subject.attributes=[],o.subject.hash=null,o.publicKey=null,o.attributes=[],o.getAttribute=function(e){return u(o,e)},o.addAttribute=function(e){h([e]),o.attributes.push(e)},o.md=null,o.setSubject=function(e){h(e),o.subject.attributes=e,o.subject.hash=null},o.setAttributes=function(e){h(e),o.attributes=e},o.sign=function(n,i){o.md=i||e.md.sha1.create();var l=a[o.md.algorithm+"WithRSAEncryption"];if(!l){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=o.md.algorithm,s}o.signatureOid=o.siginfo.algorithmOid=l,o.certificationRequestInfo=r.getCertificationRequestInfo(o);var c=t.toDer(o.certificationRequestInfo);o.md.update(c.getBytes()),o.signature=n.sign(o.md)},o.verify=function(){var e=!1,a=o.md;if(null===a){a=d({signatureOid:o.signatureOid,type:"certification request"});var n=o.certificationRequestInfo||r.getCertificationRequestInfo(o),i=t.toDer(n);a.update(i.getBytes())}return null!==a&&(e=p({certificate:o,md:a,signature:o.signature})),e},o};var y=new Date("1950-01-01T00:00:00Z"),_=new Date("2050-01-01T00:00:00Z");function w(e){return e>=y&&e<_?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}return r.getTBSCertificate=function(a){var o=w(a.validity.notBefore),n=w(a.validity.notAfter),i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(a.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(a.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.siginfo.algorithmOid).getBytes()),m(a.siginfo.algorithmOid,a.siginfo.parameters)]),f(a.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[o,n]),f(a.subject),r.publicKeyToAsn1(a.publicKey)]);return a.issuer.uniqueId&&i.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+a.issuer.uniqueId)])),a.subject.uniqueId&&i.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+a.subject.uniqueId)])),a.extensions.length>0&&i.value.push(r.certificateExtensionsToAsn1(a.extensions)),i},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),f(e.subject),r.publicKeyToAsn1(e.publicKey),b(e)])},r.distinguishedNameToAsn1=function(e){return f(e)},r.certificateToAsn1=function(e){var a=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[a,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var a=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);a.value.push(o);for(var n=0;n<e.length;++n)o.value.push(r.certificateExtensionToAsn1(e[n]));return a},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var a=e.value;return"string"!=typeof e.value&&(a=t.toDer(a).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,a)),r},r.certificationRequestToAsn1=function(e){var a=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[a,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(a){var o={certs:{}};function n(e){return i(e),o.certs[e.hash]||null}function i(t){if(!t.hash){var a=e.md.sha1.create();t.attributes=r.RDNAttributesAsArray(f(t),a),t.hash=a.digest().toHex()}}if(o.getIssuer=function(e){return n(e.issuer)},o.addCertificate=function(t){if("string"==typeof t&&(t=e.pki.certificateFromPem(t)),i(t.subject),!o.hasCertificate(t))if(t.subject.hash in o.certs){var r=o.certs[t.subject.hash];e.util.isArray(r)||(r=[r]),r.push(t),o.certs[t.subject.hash]=r}else o.certs[t.subject.hash]=t},o.hasCertificate=function(a){"string"==typeof a&&(a=e.pki.certificateFromPem(a));var o=n(a.subject);if(!o)return!1;e.util.isArray(o)||(o=[o]);for(var i=t.toDer(r.certificateToAsn1(a)).getBytes(),l=0;l<o.length;++l){if(i===t.toDer(r.certificateToAsn1(o[l])).getBytes())return!0}return!1},o.listAllCertificates=function(){var t=[];for(var r in o.certs)if(o.certs.hasOwnProperty(r)){var a=o.certs[r];if(e.util.isArray(a))for(var n=0;n<a.length;++n)t.push(a[n]);else t.push(a)}return t},o.removeCertificate=function(a){var l;if("string"==typeof a&&(a=e.pki.certificateFromPem(a)),i(a.subject),!o.hasCertificate(a))return null;var s=n(a.subject);if(!e.util.isArray(s))return l=o.certs[a.subject.hash],delete o.certs[a.subject.hash],l;for(var c=t.toDer(r.certificateToAsn1(a)).getBytes(),u=0;u<s.length;++u){c===t.toDer(r.certificateToAsn1(s[u])).getBytes()&&(l=s[u],s.splice(u,1))}return 0===s.length&&delete o.certs[a.subject.hash],l},a)for(var l=0;l<a.length;++l){var s=a[l];o.addCertificate(s)}return o},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(t,a,o){"function"==typeof o&&(o={verify:o}),o=o||{};var n=(a=a.slice(0)).slice(0),i=o.validityCheckDate;void 0===i&&(i=new Date);var l=!0,s=null,c=0;do{var u=a.shift(),v=null,d=!1;if(i&&(i<u.validity.notBefore||i>u.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:i}),null===s){if(null===(v=a[0]||t.getIssuer(u))&&u.isIssuer(u)&&(d=!0,v=u),v){var p=v;e.util.isArray(p)||(p=[p]);for(var f=!1;!f&&p.length>0;){v=p.shift();try{f=v.verify(u)}catch(C){}}f||(s={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==s||v&&!d||t.hasCertificate(u)||(s={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===s&&v&&!u.isIssuer(v)&&(s={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===s)for(var h={keyUsage:!0,basicConstraints:!0},g=0;null===s&&g<u.extensions.length;++g){var m=u.extensions[g];m.critical&&!(m.name in h)&&(s={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===s&&(!l||0===a.length&&(!v||d))){var b=u.getExtension("basicConstraints"),y=u.getExtension("keyUsage");if(null!==y&&(y.keyCertSign&&null!==b||(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==s||null===b||b.cA||(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===s&&null!==y&&"pathLenConstraint"in b)c-1>b.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var _=null===s||s.error,w=o.verify?o.verify(_,c,n):_;if(!0!==w)throw!0===_&&(s={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(w||0===w)&&("object"!=typeof w||e.util.isArray(w)?"string"==typeof w&&(s.error=w):(w.message&&(s.message=w.message),w.error&&(s.error=w.error))),s;s=null,l=!1,++c}while(a.length>0);return!0},pi.exports}function ki(){if(bi)return li.exports;bi=1;var e=jo();cn(),hn(),sn(),ci(),ni(),qn(),oi(),Yn(),Wo(),Si();var t=e.asn1,r=e.pki,a=li.exports=e.pkcs12=e.pkcs12||{},o={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},n={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},o,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},i={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},l={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},s={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function c(e,t,r,a){for(var o=[],n=0;n<e.length;n++)for(var i=0;i<e[n].safeBags.length;i++){var l=e[n].safeBags[i];void 0!==a&&l.type!==a||(null!==t?void 0!==l.attributes[t]&&l.attributes[t].indexOf(r)>=0&&o.push(l):o.push(l))}return o}function u(t){if(t.composed||t.constructed){for(var r=e.util.createBuffer(),a=0;a<t.value.length;++a)r.putBytes(t.value[a].value);t.composed=t.constructed=!1,t.value=r.getBytes()}return t}function v(a,o){var n={},i=[];if(!t.validate(a,e.pkcs7.asn1.encryptedDataValidator,n,i))throw(l=new Error("Cannot read EncryptedContentInfo.")).errors=i,l;var l,s=t.derToOid(n.contentType);if(s!==r.oids.data)throw(l=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=s,l;s=t.derToOid(n.encAlgorithm);var c=r.pbe.getCipher(s,n.encParameter,o),v=u(n.encryptedContentAsn1),d=e.util.createBuffer(v.value);if(c.update(d),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function d(e,a,o){if(!a&&0===e.length)return[];if((e=t.fromDer(e,a)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],l=0;l<e.value.length;l++){var c=e.value[l],u={},v=[];if(!t.validate(c,i,u,v))throw(m=new Error("Cannot read SafeBag.")).errors=v,m;var d,f,h={type:t.derToOid(u.bagId),attributes:p(u.bagAttributes)};n.push(h);var g=u.bagValue.value[0];switch(h.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,o)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{h.key=r.privateKeyFromAsn1(g)}catch(b){h.key=null,h.asn1=g}continue;case r.oids.certBag:d=s,f=function(){if(t.derToOid(u.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(u.certId),e}var o=t.fromDer(u.cert,a);try{h.cert=r.certificateFromAsn1(o,!0)}catch(b){h.cert=null,h.asn1=o}};break;default:var m;throw(m=new Error("Unsupported PKCS#12 SafeBag type.")).oid=h.type,m}if(void 0!==d&&!t.validate(g,d,u,v))throw(m=new Error("Cannot read PKCS#12 "+d.name)).errors=v,m;f()}return n}function p(e){var a={};if(void 0!==e)for(var o=0;o<e.length;++o){var n={},i=[];if(!t.validate(e[o],l,n,i)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=i,s}var c=t.derToOid(n.oid);if(void 0!==r.oids[c]){a[r.oids[c]]=[];for(var u=0;u<n.values.length;++u)a[r.oids[c]].push(n.values[u].value)}}return a}return a.pkcs12FromAsn1=function(i,l,s){"string"==typeof l?(s=l,l=!0):void 0===l&&(l=!0);var p={};if(!t.validate(i,n,p,[]))throw(f=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=f,f;var f,h={version:p.version.charCodeAt(0),safeContents:[],getBags:function(t){var r,a={};return"localKeyId"in t?r=t.localKeyId:"localKeyIdHex"in t&&(r=e.util.hexToBytes(t.localKeyIdHex)),void 0===r&&!("friendlyName"in t)&&"bagType"in t&&(a[t.bagType]=c(h.safeContents,null,null,t.bagType)),void 0!==r&&(a.localKeyId=c(h.safeContents,"localKeyId",r,t.bagType)),"friendlyName"in t&&(a.friendlyName=c(h.safeContents,"friendlyName",t.friendlyName,t.bagType)),a},getBagsByFriendlyName:function(e,t){return c(h.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return c(h.safeContents,"localKeyId",e,t)}};if(3!==p.version.charCodeAt(0))throw(f=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=p.version.charCodeAt(0),f;if(t.derToOid(p.contentType)!==r.oids.data)throw(f=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(p.contentType),f;var g=p.content.value[0];if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(g=u(g),p.mac){var m=null,b=0,y=t.derToOid(p.macAlgorithm);switch(y){case r.oids.sha1:m=e.md.sha1.create(),b=20;break;case r.oids.sha256:m=e.md.sha256.create(),b=32;break;case r.oids.sha384:m=e.md.sha384.create(),b=48;break;case r.oids.sha512:m=e.md.sha512.create(),b=64;break;case r.oids.md5:m=e.md.md5.create(),b=16}if(null===m)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+y);var _=new e.util.ByteBuffer(p.macSalt),w="macIterations"in p?parseInt(e.util.bytesToHex(p.macIterations),16):1,C=a.generateKey(s,_,3,w,b,m),x=e.hmac.create();if(x.start(m,C),x.update(g.value),x.getMac().getBytes()!==p.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(e,a,n,i){if(a=t.fromDer(a,n),a.tagClass!==t.Class.UNIVERSAL||a.type!==t.Type.SEQUENCE||!0!==a.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var l=0;l<a.value.length;l++){var s=a.value[l],c={},p=[];if(!t.validate(s,o,c,p))throw(m=new Error("Cannot read ContentInfo.")).errors=p,m;var f={encrypted:!1},h=null,g=c.content.value[0];switch(t.derToOid(c.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");h=u(g).value;break;case r.oids.encryptedData:h=v(g,i),f.encrypted=!0;break;default:var m;throw(m=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(c.contentType),m}f.safeBags=d(h,n,i),e.safeContents.push(f)}}(h,g.value,l,s),h},a.toPkcs12Asn1=function(o,n,i,l){(l=l||{}).saltSize=l.saltSize||8,l.count=l.count||2048,l.algorithm=l.algorithm||l.encAlgorithm||"aes128","useMac"in l||(l.useMac=!0),"localKeyId"in l||(l.localKeyId=null),"generateLocalKeyId"in l||(l.generateLocalKeyId=!0);var s,c=l.localKeyId;if(null!==c)c=e.util.hexToBytes(c);else if(l.generateLocalKeyId)if(n){var u=e.util.isArray(n)?n[0]:n;"string"==typeof u&&(u=r.certificateFromPem(u)),(A=e.md.sha1.create()).update(t.toDer(r.certificateToAsn1(u)).getBytes()),c=A.digest().getBytes()}else c=e.random.getBytes(20);var v=[];null!==c&&v.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,c)])])),"friendlyName"in l&&v.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,l.friendlyName)])])),v.length>0&&(s=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,v));var d=[],p=[];null!==n&&(p=e.util.isArray(n)?n:[n]);for(var f=[],h=0;h<p.length;++h){"string"==typeof(n=p[h])&&(n=r.certificateFromPem(n));var g=0===h?s:void 0,m=r.certificateToAsn1(n),b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(m).getBytes())])])]),g]);f.push(b)}if(f.length>0){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,f),_=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(y).getBytes())])]);d.push(_)}var w=null;if(null!==o){var C=r.wrapRsaPrivateKey(r.privateKeyToAsn1(o));w=null===i?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[C]),s]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(C,i,l)]),s]);var x=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[w]),E=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(x).getBytes())])]);d.push(E)}var S,k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d);if(l.useMac){var A=e.md.sha1.create(),T=new e.util.ByteBuffer(e.random.getBytes(l.saltSize)),I=l.count,B=(o=a.generateKey(i,T,3,I,20),e.hmac.create());B.start(A,o),B.update(t.toDer(k).getBytes());var N=B.getMac();S=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,N.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,T.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(I).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(k).getBytes())])]),S])},a.generateKey=e.pbe.generatePkcs12Key,li.exports}function Ai(){if(yi)return En.exports;yi=1;var e=jo();cn(),sn(),ni(),wn(),In(),ki(),Ei(),oi(),Wo(),Si();var t=e.asn1,r=En.exports=e.pki=e.pki||{};return r.pemToDer=function(t){var r=e.pem.decode(t)[0];if(r.procType&&"ENCRYPTED"===r.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return e.util.createBuffer(r.body)},r.privateKeyFromPem=function(a){var o=e.pem.decode(a)[0];if("PRIVATE KEY"!==o.type&&"RSA PRIVATE KEY"!==o.type){var n=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw n.headerType=o.type,n}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var i=t.fromDer(o.body);return r.privateKeyFromAsn1(i)},r.privateKeyToPem=function(a,o){var n={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(a)).getBytes()};return e.pem.encode(n,{maxline:o})},r.privateKeyInfoToPem=function(r,a){var o={type:"PRIVATE KEY",body:t.toDer(r).getBytes()};return e.pem.encode(o,{maxline:a})},En.exports}function Ti(){if(wi)return _i;wi=1;var e=jo();cn(),hn(),bn(),wn(),Ai(),qn(),Yn(),Wo();var t=function(t,r,a,o){var n=e.util.createBuffer(),i=t.length>>1,l=i+(1&t.length),s=t.substr(0,l),c=t.substr(i,l),u=e.util.createBuffer(),v=e.hmac.create();a=r+a;var d=Math.ceil(o/16),p=Math.ceil(o/20);v.start("MD5",s);var f=e.util.createBuffer();u.putBytes(a);for(var h=0;h<d;++h)v.start(null,null),v.update(u.getBytes()),u.putBuffer(v.digest()),v.start(null,null),v.update(u.bytes()+a),f.putBuffer(v.digest());v.start("SHA1",c);var g=e.util.createBuffer();u.clear(),u.putBytes(a);for(h=0;h<p;++h)v.start(null,null),v.update(u.getBytes()),u.putBuffer(v.digest()),v.start(null,null),v.update(u.bytes()+a),g.putBuffer(v.digest());return n.putBytes(e.util.xorBytes(f.getBytes(),g.getBytes(),o)),n},r=function(t,r,a){var o=!1;try{var n=t.deflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(n),r.length=n.length,o=!0}catch(i){}return o},a=function(t,r,a){var o=!1;try{var n=t.inflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(n),r.length=n.length,o=!0}catch(i){}return o},o=function(t,r){var a=0;switch(r){case 1:a=t.getByte();break;case 2:a=t.getInt16();break;case 3:a=t.getInt24();break;case 4:a=t.getInt32()}return e.util.createBuffer(t.getBytes(a))},n=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},i={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};i.SupportedVersions=[i.Versions.TLS_1_1,i.Versions.TLS_1_0],i.Version=i.SupportedVersions[0],i.MaxFragment=15360,i.ConnectionEnd={server:0,client:1},i.PRFAlgorithm={tls_prf_sha256:0},i.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},i.CipherType={stream:0,block:1,aead:2},i.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},i.CompressionMethod={none:0,deflate:1},i.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},i.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},i.Alert={},i.Alert.Level={warning:1,fatal:2},i.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},i.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},i.CipherSuites={},i.getCipherSuite=function(e){var t=null;for(var r in i.CipherSuites){var a=i.CipherSuites[r];if(a.id[0]===e.charCodeAt(0)&&a.id[1]===e.charCodeAt(1)){t=a;break}}return t},i.handleUnexpected=function(e,t){!e.open&&e.entity===i.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}})},i.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(i.queue(e,i.createAlert(e,{level:i.Alert.Level.warning,description:i.Alert.Description.no_renegotiation})),i.flush(e)),e.process()},i.parseHelloMessage=function(t,r,a){var n=null,l=t.entity===i.ConnectionEnd.client;if(a<38)t.error(t,{message:l?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});else{var s=r.fragment,c=s.length();if(n={version:{major:s.getByte(),minor:s.getByte()},random:e.util.createBuffer(s.getBytes(32)),session_id:o(s,1),extensions:[]},l?(n.cipher_suite=s.getBytes(2),n.compression_method=s.getByte()):(n.cipher_suites=o(s,2),n.compression_methods=o(s,1)),(c=a-(c-s.length()))>0){for(var u=o(s,2);u.length()>0;)n.extensions.push({type:[u.getByte(),u.getByte()],data:o(u,2)});if(!l)for(var v=0;v<n.extensions.length;++v){var d=n.extensions[v];if(0===d.type[0]&&0===d.type[1])for(var p=o(d.data,2);p.length()>0;){if(0!==p.getByte())break;t.session.extensions.server_name.serverNameList.push(o(p,2).getBytes())}}}if(t.session.version&&(n.version.major!==t.session.version.major||n.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}});if(l)t.session.cipherSuite=i.getCipherSuite(n.cipher_suite);else for(var f=e.util.createBuffer(n.cipher_suites.bytes());f.length()>0&&(t.session.cipherSuite=i.getCipherSuite(f.getBytes(2)),null===t.session.cipherSuite););if(null===t.session.cipherSuite)return t.error(t,{message:"No cipher suites in common.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure},cipherSuite:e.util.bytesToHex(n.cipher_suite)});t.session.compressionMethod=l?n.compression_method:i.CompressionMethod.none}return n},i.createSecurityParameters=function(e,t){var r=e.entity===i.ConnectionEnd.client,a=t.random.bytes(),o=r?e.session.sp.client_random:a,n=r?a:i.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:i.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:n}},i.handleServerHello=function(e,t,r){var a=i.parseHelloMessage(e,t,r);if(!e.fail){if(!(a.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}});e.version.minor=a.version.minor,e.session.version=e.version;var o=a.session_id.bytes();o.length>0&&o===e.session.id?(e.expect=v,e.session.resuming=!0,e.session.sp.server_random=a.random.bytes()):(e.expect=l,e.session.resuming=!1,i.createSecurityParameters(e,a)),e.session.id=o,e.process()}},i.handleClientHello=function(t,r,a){var o=i.parseHelloMessage(t,r,a);if(!t.fail){var n=o.session_id.bytes(),l=null;if(t.sessionCache&&(null===(l=t.sessionCache.getSession(n))?n="":(l.version.major!==o.version.major||l.version.minor>o.version.minor)&&(l=null,n="")),0===n.length&&(n=e.random.getBytes(32)),t.session.id=n,t.session.clientHelloVersion=o.version,t.session.sp={},l)t.version=t.session.version=l.version,t.session.sp=l.sp;else{for(var s,c=1;c<i.SupportedVersions.length&&!((s=i.SupportedVersions[c]).minor<=o.version.minor);++c);t.version={major:s.major,minor:s.minor},t.session.version=t.version}null!==l?(t.expect=b,t.session.resuming=!0,t.session.sp.client_random=o.random.bytes()):(t.expect=!1!==t.verifyClient?h:g,t.session.resuming=!1,i.createSecurityParameters(t,o)),t.open=!0,i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerHello(t)})),t.session.resuming?(i.queue(t,i.createRecord(t,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),t.state.pending=i.createConnectionState(t),t.state.current.write=t.state.pending.write,i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createFinished(t)}))):(i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificate(t)})),t.fail||(i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerKeyExchange(t)})),!1!==t.verifyClient&&i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificateRequest(t)})),i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerHelloDone(t)})))),i.flush(t),t.process()}},i.handleCertificate=function(t,r,a){if(a<3)return t.error(t,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var n,l,c=r.fragment,u={certificate_list:o(c,3)},v=[];try{for(;u.certificate_list.length()>0;)n=o(u.certificate_list,3),l=e.asn1.fromDer(n),n=e.pki.certificateFromAsn1(l,!0),v.push(n)}catch(p){return t.error(t,{message:"Could not parse certificate list.",cause:p,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var d=t.entity===i.ConnectionEnd.client;!d&&!0!==t.verifyClient||0!==v.length?0===v.length?t.expect=d?s:g:(d?t.session.serverCertificate=v[0]:t.session.clientCertificate=v[0],i.verifyCertificateChain(t,v)&&(t.expect=d?s:g)):t.error(t,{message:d?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}}),t.process()},i.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});e.expect=c,e.process()},i.handleClientKeyExchange=function(t,r,a){if(a<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});var n=r.fragment,l={enc_pre_master_secret:o(n,2).getBytes()},s=null;if(t.getPrivateKey)try{s=t.getPrivateKey(t,t.session.serverCertificate),s=e.pki.privateKeyFromPem(s)}catch(v){t.error(t,{message:"Could not get private key.",cause:v,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}if(null===s)return t.error(t,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}});try{var c=t.session.sp;c.pre_master_secret=s.decrypt(l.enc_pre_master_secret);var u=t.session.clientHelloVersion;if(u.major!==c.pre_master_secret.charCodeAt(0)||u.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(v){c.pre_master_secret=e.random.getBytes(48)}t.expect=b,null!==t.session.clientCertificate&&(t.expect=m),t.process()},i.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var a=t.fragment,n={certificate_types:o(a,1),certificate_authorities:o(a,2)};e.session.certificateRequest=n,e.expect=u,e.process()},i.handleCertificateVerify=function(t,r,a){if(a<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var n=r.fragment;n.read-=4;var l=n.bytes();n.read+=4;var s={signature:o(n,2).getBytes()},c=e.util.createBuffer();c.putBuffer(t.session.md5.digest()),c.putBuffer(t.session.sha1.digest()),c=c.getBytes();try{if(!t.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(l),t.session.sha1.update(l)}catch(u){return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure}})}t.expect=b,t.process()},i.handleServerHelloDone=function(t,r,a){if(a>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.record_overflow}});if(null===t.serverCertificate){var o={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.insufficient_security}},n=t.verify(t,o.alert.description,0,[]);if(!0!==n)return(n||0===n)&&("object"!=typeof n||e.util.isArray(n)?"number"==typeof n&&(o.alert.description=n):(n.message&&(o.message=n.message),n.alert&&(o.alert.description=n.alert))),t.error(t,o)}null!==t.session.certificateRequest&&(r=i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificate(t)}),i.queue(t,r)),r=i.createRecord(t,{type:i.ContentType.handshake,data:i.createClientKeyExchange(t)}),i.queue(t,r),t.expect=f;var l=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&i.queue(e,i.createRecord(e,{type:i.ContentType.handshake,data:i.createCertificateVerify(e,t)})),i.queue(e,i.createRecord(e,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),e.state.pending=i.createConnectionState(e),e.state.current.write=e.state.pending.write,i.queue(e,i.createRecord(e,{type:i.ContentType.handshake,data:i.createFinished(e)})),e.expect=v,i.flush(e),e.process()};if(null===t.session.certificateRequest||null===t.session.clientCertificate)return l(t,null);i.getClientSignature(t,l)},i.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var r=e.entity===i.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=i.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?d:y,e.process()},i.handleFinished=function(r,a,o){var n=a.fragment;n.read-=4;var l=n.bytes();n.read+=4;var s=a.fragment.getBytes();(n=e.util.createBuffer()).putBuffer(r.session.md5.digest()),n.putBuffer(r.session.sha1.digest());var c=r.entity===i.ConnectionEnd.client,u=c?"server finished":"client finished",v=r.session.sp;if((n=t(v.master_secret,u,n.getBytes(),12)).getBytes()!==s)return r.error(r,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decrypt_error}});r.session.md5.update(l),r.session.sha1.update(l),(r.session.resuming&&c||!r.session.resuming&&!c)&&(i.queue(r,i.createRecord(r,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),r.state.current.write=r.state.pending.write,r.state.pending=null,i.queue(r,i.createRecord(r,{type:i.ContentType.handshake,data:i.createFinished(r)}))),r.expect=c?p:_,r.handshaking=!1,++r.handshakes,r.peerCertificate=c?r.session.serverCertificate:r.session.clientCertificate,i.flush(r),r.isConnected=!0,r.connected(r),r.process()},i.handleAlert=function(e,t){var r,a=t.fragment,o={level:a.getByte(),description:a.getByte()};switch(o.description){case i.Alert.Description.close_notify:r="Connection closed.";break;case i.Alert.Description.unexpected_message:r="Unexpected message.";break;case i.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case i.Alert.Description.decryption_failed:r="Decryption failed.";break;case i.Alert.Description.record_overflow:r="Record overflow.";break;case i.Alert.Description.decompression_failure:r="Decompression failed.";break;case i.Alert.Description.handshake_failure:r="Handshake failure.";break;case i.Alert.Description.bad_certificate:r="Bad certificate.";break;case i.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case i.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case i.Alert.Description.certificate_expired:r="Certificate expired.";break;case i.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case i.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case i.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case i.Alert.Description.access_denied:r="Access denied.";break;case i.Alert.Description.decode_error:r="Decode error.";break;case i.Alert.Description.decrypt_error:r="Decrypt error.";break;case i.Alert.Description.export_restriction:r="Export restriction.";break;case i.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case i.Alert.Description.insufficient_security:r="Insufficient security.";break;case i.Alert.Description.internal_error:r="Internal error.";break;case i.Alert.Description.user_canceled:r="User canceled.";break;case i.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(o.description===i.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===i.ConnectionEnd.client?"server":"client",alert:o}),e.process()},i.handleHandshake=function(t,r){var a=r.fragment,o=a.getByte(),n=a.getInt24();if(n>a.length())return t.fragmented=r,r.fragment=e.util.createBuffer(),a.read-=4,t.process();t.fragmented=null,a.read-=4;var l=a.bytes(n+4);a.read+=4,o in D[t.entity][t.expect]?(t.entity!==i.ConnectionEnd.server||t.open||t.fail||(t.handshaking=!0,t.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:e.md.md5.create(),sha1:e.md.sha1.create()}),o!==i.HandshakeType.hello_request&&o!==i.HandshakeType.certificate_verify&&o!==i.HandshakeType.finished&&(t.session.md5.update(l),t.session.sha1.update(l)),D[t.entity][t.expect][o](t,r,n)):i.handleUnexpected(t,r)},i.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},i.handleHeartbeat=function(t,r){var a=r.fragment,o=a.getByte(),n=a.getInt16(),l=a.getBytes(n);if(o===i.HeartbeatMessageType.heartbeat_request){if(t.handshaking||n>l.length)return t.process();i.queue(t,i.createRecord(t,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_response,l)})),i.flush(t)}else if(o===i.HeartbeatMessageType.heartbeat_response){if(l!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,e.util.createBuffer(l))}t.process()};var l=1,s=2,c=3,u=4,v=5,d=6,p=7,f=8,h=1,g=2,m=3,b=4,y=5,_=6,w=i.handleUnexpected,C=i.handleChangeCipherSpec,x=i.handleAlert,E=i.handleHandshake,S=i.handleApplicationData,k=i.handleHeartbeat,A=[];A[i.ConnectionEnd.client]=[[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[C,x,w,w,k],[w,x,E,w,k],[w,x,E,S,k],[w,x,E,w,k]],A[i.ConnectionEnd.server]=[[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[C,x,w,w,k],[w,x,E,w,k],[w,x,E,S,k],[w,x,E,w,k]];var T=i.handleHelloRequest,I=i.handleServerHello,B=i.handleCertificate,N=i.handleServerKeyExchange,R=i.handleCertificateRequest,z=i.handleServerHelloDone,L=i.handleFinished,D=[];D[i.ConnectionEnd.client]=[[w,w,I,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[T,w,w,w,w,w,w,w,w,w,w,B,N,R,z,w,w,w,w,w,w],[T,w,w,w,w,w,w,w,w,w,w,w,N,R,z,w,w,w,w,w,w],[T,w,w,w,w,w,w,w,w,w,w,w,w,R,z,w,w,w,w,w,w],[T,w,w,w,w,w,w,w,w,w,w,w,w,w,z,w,w,w,w,w,w],[T,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[T,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,L],[T,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[T,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]];var U=i.handleClientHello,P=i.handleClientKeyExchange,V=i.handleCertificateVerify;D[i.ConnectionEnd.server]=[[w,U,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,B,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,P,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,V,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,L],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]],i.generateKeys=function(e,r){var a=t,o=r.client_random+r.server_random;e.session.resuming||(r.master_secret=a(r.pre_master_secret,"master secret",o,48).bytes(),r.pre_master_secret=null),o=r.server_random+r.client_random;var n=2*r.mac_key_length+2*r.enc_key_length,l=e.version.major===i.Versions.TLS_1_0.major&&e.version.minor===i.Versions.TLS_1_0.minor;l&&(n+=2*r.fixed_iv_length);var s=a(r.master_secret,"key expansion",o,n),c={client_write_MAC_key:s.getBytes(r.mac_key_length),server_write_MAC_key:s.getBytes(r.mac_key_length),client_write_key:s.getBytes(r.enc_key_length),server_write_key:s.getBytes(r.enc_key_length)};return l&&(c.client_write_IV=s.getBytes(r.fixed_iv_length),c.server_write_IV=s.getBytes(r.fixed_iv_length)),c},i.createConnectionState=function(e){var t=e.entity===i.ConnectionEnd.client,o=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:o(),write:o()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}),!e.fail},e.session){var l=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(l),l.keys=i.generateKeys(e,l),n.read.macKey=t?l.keys.server_write_MAC_key:l.keys.client_write_MAC_key,n.write.macKey=t?l.keys.client_write_MAC_key:l.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,l),l.compression_algorithm){case i.CompressionMethod.none:break;case i.CompressionMethod.deflate:n.read.compressFunction=a,n.write.compressFunction=r;break;default:throw new Error("Unsupported compression algorithm.")}}return n},i.createRandom=function(){var t=new Date,r=+t+6e4*t.getTimezoneOffset(),a=e.util.createBuffer();return a.putInt32(r),a.putBytes(e.random.getBytes(28)),a},i.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},i.createAlert=function(t,r){var a=e.util.createBuffer();return a.putByte(r.level),a.putByte(r.description),i.createRecord(t,{type:i.ContentType.alert,data:a})},i.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var r=e.util.createBuffer(),a=0;a<t.cipherSuites.length;++a){var o=t.cipherSuites[a];r.putByte(o.id[0]),r.putByte(o.id[1])}var l=r.length(),s=e.util.createBuffer();s.putByte(i.CompressionMethod.none);var c=s.length(),u=e.util.createBuffer();if(t.virtualHost){var v=e.util.createBuffer();v.putByte(0),v.putByte(0);var d=e.util.createBuffer();d.putByte(0),n(d,2,e.util.createBuffer(t.virtualHost));var p=e.util.createBuffer();n(p,2,d),n(v,2,p),u.putBuffer(v)}var f=u.length();f>0&&(f+=2);var h=t.session.id,g=h.length+1+2+4+28+2+l+1+c+f,m=e.util.createBuffer();return m.putByte(i.HandshakeType.client_hello),m.putInt24(g),m.putByte(t.version.major),m.putByte(t.version.minor),m.putBytes(t.session.sp.client_random),n(m,1,e.util.createBuffer(h)),n(m,2,r),n(m,1,s),f>0&&n(m,2,u),m},i.createServerHello=function(t){var r=t.session.id,a=r.length+1+2+4+28+2+1,o=e.util.createBuffer();return o.putByte(i.HandshakeType.server_hello),o.putInt24(a),o.putByte(t.version.major),o.putByte(t.version.minor),o.putBytes(t.session.sp.server_random),n(o,1,e.util.createBuffer(r)),o.putByte(t.session.cipherSuite.id[0]),o.putByte(t.session.cipherSuite.id[1]),o.putByte(t.session.compressionMethod),o},i.createCertificate=function(t){var r,a=t.entity===i.ConnectionEnd.client,o=null;t.getCertificate&&(r=a?t.session.certificateRequest:t.session.extensions.server_name.serverNameList,o=t.getCertificate(t,r));var l=e.util.createBuffer();if(null!==o)try{e.util.isArray(o)||(o=[o]);for(var s=null,c=0;c<o.length;++c){var u=e.pem.decode(o[c])[0];if("CERTIFICATE"!==u.type&&"X509 CERTIFICATE"!==u.type&&"TRUSTED CERTIFICATE"!==u.type){var v=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw v.headerType=u.type,v}if(u.procType&&"ENCRYPTED"===u.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var d=e.util.createBuffer(u.body);null===s&&(s=e.asn1.fromDer(d.bytes(),!1));var p=e.util.createBuffer();n(p,3,d),l.putBuffer(p)}o=e.pki.certificateFromAsn1(s),a?t.session.clientCertificate=o:t.session.serverCertificate=o}catch(g){return t.error(t,{message:"Could not send certificate list.",cause:g,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var f=3+l.length(),h=e.util.createBuffer();return h.putByte(i.HandshakeType.certificate),h.putInt24(f),n(h,3,l),h},i.createClientKeyExchange=function(t){var r=e.util.createBuffer();r.putByte(t.session.clientHelloVersion.major),r.putByte(t.session.clientHelloVersion.minor),r.putBytes(e.random.getBytes(46));var a=t.session.sp;a.pre_master_secret=r.getBytes();var o=(r=t.session.serverCertificate.publicKey.encrypt(a.pre_master_secret)).length+2,n=e.util.createBuffer();return n.putByte(i.HandshakeType.client_key_exchange),n.putInt24(o),n.putInt16(r.length),n.putBytes(r),n},i.createServerKeyExchange=function(t){return e.util.createBuffer()},i.getClientSignature=function(t,r){var a=e.util.createBuffer();a.putBuffer(t.session.md5.digest()),a.putBuffer(t.session.sha1.digest()),a=a.getBytes(),t.getSignature=t.getSignature||function(t,r,a){var o=null;if(t.getPrivateKey)try{o=t.getPrivateKey(t,t.session.clientCertificate),o=e.pki.privateKeyFromPem(o)}catch(n){t.error(t,{message:"Could not get private key.",cause:n,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}null===o?t.error(t,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}):r=o.sign(r,null),a(t,r)},t.getSignature(t,a,r)},i.createCertificateVerify=function(t,r){var a=r.length+2,o=e.util.createBuffer();return o.putByte(i.HandshakeType.certificate_verify),o.putInt24(a),o.putInt16(r.length),o.putBytes(r),o},i.createCertificateRequest=function(t){var r=e.util.createBuffer();r.putByte(1);var a=e.util.createBuffer();for(var o in t.caStore.certs){var l=t.caStore.certs[o],s=e.pki.distinguishedNameToAsn1(l.subject),c=e.asn1.toDer(s);a.putInt16(c.length()),a.putBuffer(c)}var u=1+r.length()+2+a.length(),v=e.util.createBuffer();return v.putByte(i.HandshakeType.certificate_request),v.putInt24(u),n(v,1,r),n(v,2,a),v},i.createServerHelloDone=function(t){var r=e.util.createBuffer();return r.putByte(i.HandshakeType.server_hello_done),r.putInt24(0),r},i.createChangeCipherSpec=function(){var t=e.util.createBuffer();return t.putByte(1),t},i.createFinished=function(r){var a=e.util.createBuffer();a.putBuffer(r.session.md5.digest()),a.putBuffer(r.session.sha1.digest());var o=r.entity===i.ConnectionEnd.client,n=r.session.sp,l=o?"client finished":"server finished";a=t(n.master_secret,l,a.getBytes(),12);var s=e.util.createBuffer();return s.putByte(i.HandshakeType.finished),s.putInt24(a.length()),s.putBuffer(a),s},i.createHeartbeat=function(t,r,a){void 0===a&&(a=r.length);var o=e.util.createBuffer();o.putByte(t),o.putInt16(a),o.putBytes(r);var n=o.length(),i=Math.max(16,n-a-3);return o.putBytes(e.random.getBytes(i)),o},i.queue=function(t,r){if(r&&(0!==r.fragment.length()||r.type!==i.ContentType.handshake&&r.type!==i.ContentType.alert&&r.type!==i.ContentType.change_cipher_spec)){if(r.type===i.ContentType.handshake){var a=r.fragment.bytes();t.session.md5.update(a),t.session.sha1.update(a),a=null}var o;if(r.fragment.length()<=i.MaxFragment)o=[r];else{o=[];for(var n=r.fragment.bytes();n.length>i.MaxFragment;)o.push(i.createRecord(t,{type:r.type,data:e.util.createBuffer(n.slice(0,i.MaxFragment))})),n=n.slice(i.MaxFragment);n.length>0&&o.push(i.createRecord(t,{type:r.type,data:e.util.createBuffer(n)}))}for(var l=0;l<o.length&&!t.fail;++l){var s=o[l];t.state.current.write.update(t,s)&&t.records.push(s)}}},i.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var M=function(t){switch(t){case!0:return!0;case e.pki.certificateError.bad_certificate:return i.Alert.Description.bad_certificate;case e.pki.certificateError.unsupported_certificate:return i.Alert.Description.unsupported_certificate;case e.pki.certificateError.certificate_revoked:return i.Alert.Description.certificate_revoked;case e.pki.certificateError.certificate_expired:return i.Alert.Description.certificate_expired;case e.pki.certificateError.certificate_unknown:return i.Alert.Description.certificate_unknown;case e.pki.certificateError.unknown_ca:return i.Alert.Description.unknown_ca;default:return i.Alert.Description.bad_certificate}};for(var O in i.verifyCertificateChain=function(t,r){try{var a={};for(var o in t.verifyOptions)a[o]=t.verifyOptions[o];a.verify=function(r,a,o){M(r);var n=t.verify(t,r,a,o);if(!0!==n){if("object"==typeof n&&!e.util.isArray(n)){var l=new Error("The application rejected the certificate.");throw l.send=!0,l.alert={level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate},n.message&&(l.message=n.message),n.alert&&(l.alert.description=n.alert),l}n!==r&&(n=function(t){switch(t){case!0:return!0;case i.Alert.Description.bad_certificate:return e.pki.certificateError.bad_certificate;case i.Alert.Description.unsupported_certificate:return e.pki.certificateError.unsupported_certificate;case i.Alert.Description.certificate_revoked:return e.pki.certificateError.certificate_revoked;case i.Alert.Description.certificate_expired:return e.pki.certificateError.certificate_expired;case i.Alert.Description.certificate_unknown:return e.pki.certificateError.certificate_unknown;case i.Alert.Description.unknown_ca:return e.pki.certificateError.unknown_ca;default:return e.pki.certificateError.bad_certificate}}(n))}return n},e.pki.verifyCertificateChain(t.caStore,r,a)}catch(l){var n=l;("object"!=typeof n||e.util.isArray(n))&&(n={send:!0,alert:{level:i.Alert.Level.fatal,description:M(l)}}),"send"in n||(n.send=!0),"alert"in n||(n.alert={level:i.Alert.Level.fatal,description:M(n.error)}),t.error(t,n)}return!t.fail},i.createSessionCache=function(t,r){var a=null;if(t&&t.getSession&&t.setSession&&t.order)a=t;else{for(var o in(a={}).cache=t||{},a.capacity=Math.max(r||100,1),a.order=[],t)a.order.length<=r?a.order.push(o):delete t[o];a.getSession=function(t){var r=null,o=null;if(t?o=e.util.bytesToHex(t):a.order.length>0&&(o=a.order[0]),null!==o&&o in a.cache)for(var n in r=a.cache[o],delete a.cache[o],a.order)if(a.order[n]===o){a.order.splice(n,1);break}return r},a.setSession=function(t,r){if(a.order.length===a.capacity){var o=a.order.shift();delete a.cache[o]}o=e.util.bytesToHex(t);a.order.push(o),a.cache[o]=r}}return a},i.createConnection=function(t){var r=null;r=t.caStore?e.util.isArray(t.caStore)?e.pki.createCaStore(t.caStore):t.caStore:e.pki.createCaStore();var a=t.cipherSuites||null;if(null===a)for(var o in a=[],i.CipherSuites)a.push(i.CipherSuites[o]);var n=t.server?i.ConnectionEnd.server:i.ConnectionEnd.client,l=t.sessionCache?i.createSessionCache(t.sessionCache):null,s={version:{major:i.Version.major,minor:i.Version.minor},entity:n,sessionId:t.sessionId,caStore:r,sessionCache:l,cipherSuites:a,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(e,t,r,a){return t},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:e.util.createBuffer(),tlsData:e.util.createBuffer(),data:e.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(e,r){r.origin=r.origin||(e.entity===i.ConnectionEnd.client?"client":"server"),r.send&&(i.queue(e,i.createAlert(e,r.alert)),i.flush(e));var a=!1!==r.fatal;a&&(e.fail=!0),t.error(e,r),a&&e.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null,reset:function(e){s.version={major:i.Version.major,minor:i.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,i.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(e||void 0===e),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=i.createConnectionState(s)}};s.reset();return s.handshake=function(t){if(s.entity!==i.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0;var r=null;(t=t||"").length>0&&(s.sessionCache&&(r=s.sessionCache.getSession(t)),null===r&&(t="")),0===t.length&&s.sessionCache&&null!==(r=s.sessionCache.getSession())&&(t=r.id),s.session={id:t,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:e.md.md5.create(),sha1:e.md.sha1.create()},r&&(s.version=r.version,s.session.sp=r.sp),s.session.sp.client_random=i.createRandom().getBytes(),s.open=!0,i.queue(s,i.createRecord(s,{type:i.ContentType.handshake,data:i.createClientHello(s)})),i.flush(s)}},s.process=function(t){var r,a,o,n,l=0;return t&&s.input.putBytes(t),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(l=function(t){var r=0,a=t.input,o=a.length();if(o<5)r=5-o;else{t.record={type:a.getByte(),version:{major:a.getByte(),minor:a.getByte()},length:a.getInt16(),fragment:e.util.createBuffer(),ready:!1};var n=t.record.version.major===t.version.major;n&&t.session&&t.session.version&&(n=t.record.version.minor===t.version.minor),n||t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}})}return r}(s)),s.fail||null===s.record||s.record.ready||(l=function(e){var t=0,r=e.input,a=r.length();return a<e.record.length?t=e.record.length-a:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(s)),!s.fail&&null!==s.record&&s.record.ready&&(r=s,a=s.record,o=a.type-i.ContentType.change_cipher_spec,n=A[r.entity][r.expect],o in n?n[o](r,a):i.handleUnexpected(r,a))),l},s.prepare=function(t){return i.queue(s,i.createRecord(s,{type:i.ContentType.application_data,data:e.util.createBuffer(t)})),i.flush(s)},s.prepareHeartbeatRequest=function(t,r){return t instanceof e.util.ByteBuffer&&(t=t.bytes()),void 0===r&&(r=t.length),s.expectedHeartbeatPayload=t,i.queue(s,i.createRecord(s,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_request,t,r)})),i.flush(s)},s.close=function(e){if(!s.fail&&s.sessionCache&&s.session){var t={id:s.session.id,version:s.session.version,sp:s.session.sp};t.sp.keys=null,s.sessionCache.setSession(t.id,t)}s.open&&(s.open=!1,s.input.clear(),(s.isConnected||s.handshaking)&&(s.isConnected=s.handshaking=!1,i.queue(s,i.createAlert(s,{level:i.Alert.Level.warning,description:i.Alert.Description.close_notify})),i.flush(s)),s.closed(s)),s.reset(e)},s},_i=e.tls=e.tls||{},i)"function"!=typeof i[O]&&(e.tls[O]=i[O]);return e.tls.prf_tls1=t,e.tls.hmac_sha1=function(t,r,a){var o=e.hmac.create();o.start("SHA1",t);var n=e.util.createBuffer();return n.putInt32(r[0]),n.putInt32(r[1]),n.putByte(a.type),n.putByte(a.version.major),n.putByte(a.version.minor),n.putInt16(a.length),n.putBytes(a.fragment.bytes()),o.update(n.getBytes()),o.digest().getBytes()},e.tls.createSessionCache=i.createSessionCache,e.tls.createConnection=i.createConnection,_i}function Ii(){if(Ci)return on.exports;Ci=1;var e=jo();tn(),Ti();var t=on.exports=e.tls;function r(r,o,n){var l=o.entity===e.tls.ConnectionEnd.client;r.read.cipherState={init:!1,cipher:e.cipher.createDecipher("AES-CBC",l?n.keys.server_write_key:n.keys.client_write_key),iv:l?n.keys.server_write_IV:n.keys.client_write_IV},r.write.cipherState={init:!1,cipher:e.cipher.createCipher("AES-CBC",l?n.keys.client_write_key:n.keys.server_write_key),iv:l?n.keys.client_write_IV:n.keys.server_write_IV},r.read.cipherFunction=i,r.write.cipherFunction=a,r.read.macLength=r.write.macLength=n.mac_length,r.read.macFunction=r.write.macFunction=t.hmac_sha1}function a(r,a){var n,i=!1,l=a.macFunction(a.macKey,a.sequenceNumber,r);r.fragment.putBytes(l),a.updateSequenceNumber(),n=r.version.minor===t.Versions.TLS_1_0.minor?a.cipherState.init?null:a.cipherState.iv:e.random.getBytesSync(16),a.cipherState.init=!0;var s=a.cipherState.cipher;return s.start({iv:n}),r.version.minor>=t.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(r.fragment),s.finish(o)&&(r.fragment=s.output,r.length=r.fragment.length(),i=!0),i}function o(e,t,r){if(!r){var a=e-t.length()%e;t.fillWithByte(a-1,a)}return!0}function n(e,t,r){var a=!0;if(r){for(var o=t.length(),n=t.last(),i=o-1-n;i<o-1;++i)a=a&&t.at(i)==n;a&&t.truncate(n+1)}return a}function i(r,a){var o,i=!1;o=r.version.minor===t.Versions.TLS_1_0.minor?a.cipherState.init?null:a.cipherState.iv:r.fragment.getBytes(16),a.cipherState.init=!0;var l=a.cipherState.cipher;l.start({iv:o}),l.update(r.fragment),i=l.finish(n);var s=a.macLength,c=e.random.getBytesSync(s),u=l.output.length();u>=s?(r.fragment=l.output.getBytes(u-s),c=l.output.getBytes(s)):r.fragment=l.output.getBytes(),r.fragment=e.util.createBuffer(r.fragment),r.length=r.fragment.length();var v=a.macFunction(a.macKey,a.sequenceNumber,r);return a.updateSequenceNumber(),i=function(t,r,a){var o=e.hmac.create();return o.start("SHA1",t),o.update(r),r=o.digest().getBytes(),o.start(null,null),o.update(a),a=o.digest().getBytes(),r===a}(a.macKey,c,v)&&i,i}return t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},on.exports}var Bi,Ni={exports:{}};function Ri(){if(Bi)return Ni.exports;Bi=1;var e=jo();fn(),Wo();var t=Ni.exports=e.sha512=e.sha512||{};e.md.sha512=e.md.algorithms.sha512=t;var r=e.sha384=e.sha512.sha384=e.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},e.md.sha384=e.md.algorithms.sha384=r,e.sha512.sha256=e.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},e.md["sha512/256"]=e.md.algorithms["sha512/256"]=e.sha512.sha256,e.sha512.sha224=e.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},e.md["sha512/224"]=e.md.algorithms["sha512/224"]=e.sha512.sha224,t.create=function(t){if(o||(a=String.fromCharCode(128),a+=e.util.fillString(String.fromCharCode(0),128),n=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(i={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],i["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],i["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],i["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],o=!0),void 0===t&&(t="SHA-512"),!(t in i))throw new Error("Invalid SHA-512 algorithm: "+t);for(var r=i[t],s=null,c=e.util.createBuffer(),u=new Array(80),v=0;v<80;++v)u[v]=new Array(2);var d=64;switch(t){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var p={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){p.messageLength=0,p.fullMessageLength=p.messageLength128=[];for(var t=p.messageLengthSize/4,a=0;a<t;++a)p.fullMessageLength.push(0);c=e.util.createBuffer(),s=new Array(r.length);for(a=0;a<r.length;++a)s[a]=r[a].slice(0);return p}};return p.start(),p.update=function(t,r){"utf8"===r&&(t=e.util.encodeUtf8(t));var a=t.length;p.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var o=p.fullMessageLength.length-1;o>=0;--o)p.fullMessageLength[o]+=a[1],a[1]=a[0]+(p.fullMessageLength[o]/4294967296>>>0),p.fullMessageLength[o]=p.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return c.putBytes(t),l(s,u,c),(c.read>2048||0===c.length())&&c.compact(),p},p.digest=function(){var r=e.util.createBuffer();r.putBytes(c.bytes());var o,n=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1;r.putBytes(a.substr(0,p.blockLength-n));for(var i=8*p.fullMessageLength[0],v=0;v<p.fullMessageLength.length-1;++v)i+=(o=8*p.fullMessageLength[v+1])/4294967296>>>0,r.putInt32(i>>>0),i=o>>>0;r.putInt32(i);var d=new Array(s.length);for(v=0;v<s.length;++v)d[v]=s[v].slice(0);l(d,u,r);var f,h=e.util.createBuffer();f="SHA-512"===t?d.length:"SHA-384"===t?d.length-2:d.length-4;for(v=0;v<f;++v)h.putInt32(d[v][0]),v===f-1&&"SHA-512/224"===t||h.putInt32(d[v][1]);return h},p};var a=null,o=!1,n=null,i=null;function l(e,t,r){for(var a,o,i,l,s,c,u,v,d,p,f,h,g,m,b,y,_,w,C,x,E,S,k,A,T,I,B,N,R,z,L,D,U,P=r.length();P>=128;){for(B=0;B<16;++B)t[B][0]=r.getInt32()>>>0,t[B][1]=r.getInt32()>>>0;for(;B<80;++B)a=(((N=(z=t[B-2])[0])>>>19|(R=z[1])<<13)^(R>>>29|N<<3)^N>>>6)>>>0,o=((N<<13|R>>>19)^(R<<3|N>>>29)^(N<<26|R>>>6))>>>0,i=(((N=(D=t[B-15])[0])>>>1|(R=D[1])<<31)^(N>>>8|R<<24)^N>>>7)>>>0,l=((N<<31|R>>>1)^(N<<24|R>>>8)^(N<<25|R>>>7))>>>0,L=t[B-7],U=t[B-16],R=o+L[1]+l+U[1],t[B][0]=a+L[0]+i+U[0]+(R/4294967296>>>0)>>>0,t[B][1]=R>>>0;for(f=e[0][0],h=e[0][1],g=e[1][0],m=e[1][1],b=e[2][0],y=e[2][1],_=e[3][0],w=e[3][1],C=e[4][0],x=e[4][1],E=e[5][0],S=e[5][1],k=e[6][0],A=e[6][1],T=e[7][0],I=e[7][1],B=0;B<80;++B)u=((C>>>14|x<<18)^(C>>>18|x<<14)^(x>>>9|C<<23))>>>0,v=(k^C&(E^k))>>>0,s=((f>>>28|h<<4)^(h>>>2|f<<30)^(h>>>7|f<<25))>>>0,c=((f<<4|h>>>28)^(h<<30|f>>>2)^(h<<25|f>>>7))>>>0,d=(f&g|b&(f^g))>>>0,p=(h&m|y&(h^m))>>>0,R=I+(((C<<18|x>>>14)^(C<<14|x>>>18)^(x<<23|C>>>9))>>>0)+((A^x&(S^A))>>>0)+n[B][1]+t[B][1],a=T+u+v+n[B][0]+t[B][0]+(R/4294967296>>>0)>>>0,o=R>>>0,i=s+d+((R=c+p)/4294967296>>>0)>>>0,l=R>>>0,T=k,I=A,k=E,A=S,E=C,S=x,C=_+a+((R=w+o)/4294967296>>>0)>>>0,x=R>>>0,_=b,w=y,b=g,y=m,g=f,m=h,f=a+i+((R=o+l)/4294967296>>>0)>>>0,h=R>>>0;R=e[0][1]+h,e[0][0]=e[0][0]+f+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+m,e[1][0]=e[1][0]+g+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+y,e[2][0]=e[2][0]+b+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+w,e[3][0]=e[3][0]+_+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+x,e[4][0]=e[4][0]+C+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+S,e[5][0]=e[5][0]+E+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+A,e[6][0]=e[6][0]+k+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+I,e[7][0]=e[7][0]+T+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,P-=128}}return Ni.exports}var zi,Li,Di,Ui,Pi,Vi,Mi,Oi,ji={};function qi(){if(Di)return Li;Di=1;var e=jo();Kn(),qn(),Ri(),Wo();var t=function(){if(zi)return ji;zi=1;var e=jo();cn();var t=e.asn1;return ji.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},ji.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},ji}(),r=t.publicKeyValidator,a=t.privateKeyValidator;if(void 0===o)var o=e.jsbn.BigInteger;var n=e.util.ByteBuffer,i="undefined"==typeof Buffer?Uint8Array:Buffer;e.pki=e.pki||{},Li=e.pki.ed25519=e.ed25519=e.ed25519||{};var l=e.ed25519;function s(e){var t=e.message;if(t instanceof Uint8Array||t instanceof i)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new n(t,r)}else if(!(t instanceof n))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var a=new i(t.length()),o=0;o<a.length;++o)a[o]=t.at(o);return a}l.constants={},l.constants.PUBLIC_KEY_BYTE_LENGTH=32,l.constants.PRIVATE_KEY_BYTE_LENGTH=64,l.constants.SEED_BYTE_LENGTH=32,l.constants.SIGN_BYTE_LENGTH=64,l.constants.HASH_BYTE_LENGTH=64,l.generateKeyPair=function(t){var r=(t=t||{}).seed;if(void 0===r)r=e.random.getBytesSync(l.constants.SEED_BYTE_LENGTH);else if("string"==typeof r){if(r.length!==l.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+l.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(r instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');r=s({message:r,encoding:"binary"});for(var a=new i(l.constants.PUBLIC_KEY_BYTE_LENGTH),o=new i(l.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)o[n]=r[n];return function(e,t){var r,a=[R(),R(),R(),R()],o=m(t,32);for(o[0]&=248,o[31]&=127,o[31]|=64,T(a,o),C(e,a),r=0;r<32;++r)t[r+32]=e[r]}(a,o),{publicKey:a,privateKey:o}},l.privateKeyFromAsn1=function(t){var r={},o=[];if(!e.asn1.validate(t,a,r,o)){var n=new Error("Invalid Key.");throw n.errors=o,n}var i=e.asn1.derToOid(r.privateKeyOid),l=e.oids.EdDSA25519;if(i!==l)throw new Error('Invalid OID "'+i+'"; OID must be "'+l+'".');var c=r.privateKey;return{privateKeyBytes:s({message:e.asn1.fromDer(c).value,encoding:"binary"})}},l.publicKeyFromAsn1=function(t){var a={},o=[];if(!e.asn1.validate(t,r,a,o)){var n=new Error("Invalid Key.");throw n.errors=o,n}var i=e.asn1.derToOid(a.publicKeyOid),c=e.oids.EdDSA25519;if(i!==c)throw new Error('Invalid OID "'+i+'"; OID must be "'+c+'".');var u=a.ed25519PublicKey;if(u.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return s({message:u,encoding:"binary"})},l.publicKeyFromPrivateKey=function(e){var t=s({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new i(l.constants.PUBLIC_KEY_BYTE_LENGTH),a=0;a<r.length;++a)r[a]=t[32+a];return r},l.sign=function(e){var t=s(e=e||{}),r=s({message:e.privateKey,encoding:"binary"});if(r.length===l.constants.SEED_BYTE_LENGTH)r=l.generateKeyPair({seed:r}).privateKey;else if(r.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.SEED_BYTE_LENGTH+" or "+l.constants.PRIVATE_KEY_BYTE_LENGTH);var a=new i(l.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,a){var o,n,i=new Float64Array(64),l=[R(),R(),R(),R()],s=m(a,32);s[0]&=248,s[31]&=127,s[31]|=64;var c=r+64;for(o=0;o<r;++o)e[64+o]=t[o];for(o=0;o<32;++o)e[32+o]=s[32+o];var u=m(e.subarray(32),r+32);for(y(u),T(l,u),C(e,l),o=32;o<64;++o)e[o]=a[o];var v=m(e,r+64);for(y(v),o=32;o<64;++o)i[o]=0;for(o=0;o<32;++o)i[o]=u[o];for(o=0;o<32;++o)for(n=0;n<32;n++)i[o+n]+=v[o]*s[n];b(e.subarray(32),i)}(a,t,t.length,r);for(var o=new i(l.constants.SIGN_BYTE_LENGTH),n=0;n<o.length;++n)o[n]=a[n];return o},l.verify=function(e){var t=s(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=s({message:e.signature,encoding:"binary"});if(r.length!==l.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+l.constants.SIGN_BYTE_LENGTH);var a=s({message:e.publicKey,encoding:"binary"});if(a.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+l.constants.PUBLIC_KEY_BYTE_LENGTH);var o,n=new i(l.constants.SIGN_BYTE_LENGTH+t.length),d=new i(l.constants.SIGN_BYTE_LENGTH+t.length);for(o=0;o<l.constants.SIGN_BYTE_LENGTH;++o)n[o]=r[o];for(o=0;o<t.length;++o)n[o+l.constants.SIGN_BYTE_LENGTH]=t[o];return function(e,t,r,a){var o,n=new i(32),l=[R(),R(),R(),R()],s=[R(),R(),R(),R()];if(r<64)return-1;if(function(e,t){var r=R(),a=R(),o=R(),n=R(),i=R(),l=R(),s=R();I(e[2],u),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),D(o,e[1]),U(n,o,v),L(o,o,e[2]),z(n,e[2],n),D(i,n),D(l,i),U(s,l,i),U(r,s,o),U(r,r,n),function(e,t){var r,a=R();for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)D(a,a),1!==r&&U(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(r,r),U(r,r,o),U(r,r,n),U(r,r,n),U(e[0],r,n),D(a,e[0]),U(a,a,n),E(a,o)&&U(e[0],e[0],g);if(D(a,e[0]),U(a,a,n),E(a,o))return-1;k(e[0])===t[31]>>7&&L(e[0],c,e[0]);return U(e[3],e[0],e[1]),0}(s,a))return-1;for(o=0;o<r;++o)e[o]=t[o];for(o=0;o<32;++o)e[o+32]=a[o];var d=m(e,r);if(y(d),A(l,s,d),T(s,t.subarray(32)),_(l,s),C(n,l),r-=64,S(t,0,n,0)){for(o=0;o<r;++o)e[o]=0;return-1}for(o=0;o<r;++o)e[o]=t[o+64];return r}(d,n,n.length,a)>=0};var c=R(),u=R([1]),v=R([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=R([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),p=R([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=R([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),h=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),g=R([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(t,r){var a=e.md.sha512.create(),o=new n(t);a.update(o.getBytes(r),"binary");var s=a.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(s,"binary");for(var c=new i(l.constants.HASH_BYTE_LENGTH),u=0;u<64;++u)c[u]=s.charCodeAt(u);return c}function b(e,t){var r,a,o,n;for(a=63;a>=32;--a){for(r=0,o=a-32,n=a-12;o<n;++o)t[o]+=r-16*t[a]*h[o-(a-32)],r=t[o]+128>>8,t[o]-=256*r;t[o]+=r,t[a]=0}for(r=0,o=0;o<32;++o)t[o]+=r-(t[31]>>4)*h[o],r=t[o]>>8,t[o]&=255;for(o=0;o<32;++o)t[o]-=r*h[o];for(a=0;a<32;++a)t[a+1]+=t[a]>>8,e[a]=255&t[a]}function y(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;b(e,t)}function _(e,t){var r=R(),a=R(),o=R(),n=R(),i=R(),l=R(),s=R(),c=R(),u=R();L(r,e[1],e[0]),L(u,t[1],t[0]),U(r,r,u),z(a,e[0],e[1]),z(u,t[0],t[1]),U(a,a,u),U(o,e[3],t[3]),U(o,o,d),U(n,e[2],t[2]),z(n,n,n),L(i,a,r),L(l,n,o),z(s,n,o),z(c,a,r),U(e[0],i,l),U(e[1],c,s),U(e[2],s,l),U(e[3],i,c)}function w(e,t,r){for(var a=0;a<4;++a)N(e[a],t[a],r)}function C(e,t){var r=R(),a=R(),o=R();!function(e,t){var r,a=R();for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)D(a,a),2!==r&&4!==r&&U(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(o,t[2]),U(r,t[0],o),U(a,t[1],o),x(e,a),e[31]^=k(r)<<7}function x(e,t){var r,a,o,n=R(),i=R();for(r=0;r<16;++r)i[r]=t[r];for(B(i),B(i),B(i),a=0;a<2;++a){for(n[0]=i[0]-65517,r=1;r<15;++r)n[r]=i[r]-65535-(n[r-1]>>16&1),n[r-1]&=65535;n[15]=i[15]-32767-(n[14]>>16&1),o=n[15]>>16&1,n[14]&=65535,N(i,n,1-o)}for(r=0;r<16;r++)e[2*r]=255&i[r],e[2*r+1]=i[r]>>8}function E(e,t){var r=new i(32),a=new i(32);return x(r,e),x(a,t),S(r,0,a,0)}function S(e,t,r,a){return function(e,t,r,a,o){var n,i=0;for(n=0;n<o;++n)i|=e[t+n]^r[a+n];return(1&i-1>>>8)-1}(e,t,r,a,32)}function k(e){var t=new i(32);return x(t,e),1&t[0]}function A(e,t,r){var a,o;for(I(e[0],c),I(e[1],u),I(e[2],u),I(e[3],c),o=255;o>=0;--o)w(e,t,a=r[o/8|0]>>(7&o)&1),_(t,e),_(e,e),w(e,t,a)}function T(e,t){var r=[R(),R(),R(),R()];I(r[0],p),I(r[1],f),I(r[2],u),U(r[3],p,f),A(e,r,t)}function I(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function B(e){var t,r,a=1;for(t=0;t<16;++t)r=e[t]+a+65535,a=Math.floor(r/65536),e[t]=r-65536*a;e[0]+=a-1+37*(a-1)}function N(e,t,r){for(var a,o=~(r-1),n=0;n<16;++n)a=o&(e[n]^t[n]),e[n]^=a,t[n]^=a}function R(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function z(e,t,r){for(var a=0;a<16;++a)e[a]=t[a]+r[a]}function L(e,t,r){for(var a=0;a<16;++a)e[a]=t[a]-r[a]}function D(e,t){U(e,t,t)}function U(e,t,r){var a,o,n=0,i=0,l=0,s=0,c=0,u=0,v=0,d=0,p=0,f=0,h=0,g=0,m=0,b=0,y=0,_=0,w=0,C=0,x=0,E=0,S=0,k=0,A=0,T=0,I=0,B=0,N=0,R=0,z=0,L=0,D=0,U=r[0],P=r[1],V=r[2],M=r[3],O=r[4],j=r[5],q=r[6],F=r[7],K=r[8],$=r[9],H=r[10],G=r[11],W=r[12],Y=r[13],Q=r[14],J=r[15];n+=(a=t[0])*U,i+=a*P,l+=a*V,s+=a*M,c+=a*O,u+=a*j,v+=a*q,d+=a*F,p+=a*K,f+=a*$,h+=a*H,g+=a*G,m+=a*W,b+=a*Y,y+=a*Q,_+=a*J,i+=(a=t[1])*U,l+=a*P,s+=a*V,c+=a*M,u+=a*O,v+=a*j,d+=a*q,p+=a*F,f+=a*K,h+=a*$,g+=a*H,m+=a*G,b+=a*W,y+=a*Y,_+=a*Q,w+=a*J,l+=(a=t[2])*U,s+=a*P,c+=a*V,u+=a*M,v+=a*O,d+=a*j,p+=a*q,f+=a*F,h+=a*K,g+=a*$,m+=a*H,b+=a*G,y+=a*W,_+=a*Y,w+=a*Q,C+=a*J,s+=(a=t[3])*U,c+=a*P,u+=a*V,v+=a*M,d+=a*O,p+=a*j,f+=a*q,h+=a*F,g+=a*K,m+=a*$,b+=a*H,y+=a*G,_+=a*W,w+=a*Y,C+=a*Q,x+=a*J,c+=(a=t[4])*U,u+=a*P,v+=a*V,d+=a*M,p+=a*O,f+=a*j,h+=a*q,g+=a*F,m+=a*K,b+=a*$,y+=a*H,_+=a*G,w+=a*W,C+=a*Y,x+=a*Q,E+=a*J,u+=(a=t[5])*U,v+=a*P,d+=a*V,p+=a*M,f+=a*O,h+=a*j,g+=a*q,m+=a*F,b+=a*K,y+=a*$,_+=a*H,w+=a*G,C+=a*W,x+=a*Y,E+=a*Q,S+=a*J,v+=(a=t[6])*U,d+=a*P,p+=a*V,f+=a*M,h+=a*O,g+=a*j,m+=a*q,b+=a*F,y+=a*K,_+=a*$,w+=a*H,C+=a*G,x+=a*W,E+=a*Y,S+=a*Q,k+=a*J,d+=(a=t[7])*U,p+=a*P,f+=a*V,h+=a*M,g+=a*O,m+=a*j,b+=a*q,y+=a*F,_+=a*K,w+=a*$,C+=a*H,x+=a*G,E+=a*W,S+=a*Y,k+=a*Q,A+=a*J,p+=(a=t[8])*U,f+=a*P,h+=a*V,g+=a*M,m+=a*O,b+=a*j,y+=a*q,_+=a*F,w+=a*K,C+=a*$,x+=a*H,E+=a*G,S+=a*W,k+=a*Y,A+=a*Q,T+=a*J,f+=(a=t[9])*U,h+=a*P,g+=a*V,m+=a*M,b+=a*O,y+=a*j,_+=a*q,w+=a*F,C+=a*K,x+=a*$,E+=a*H,S+=a*G,k+=a*W,A+=a*Y,T+=a*Q,I+=a*J,h+=(a=t[10])*U,g+=a*P,m+=a*V,b+=a*M,y+=a*O,_+=a*j,w+=a*q,C+=a*F,x+=a*K,E+=a*$,S+=a*H,k+=a*G,A+=a*W,T+=a*Y,I+=a*Q,B+=a*J,g+=(a=t[11])*U,m+=a*P,b+=a*V,y+=a*M,_+=a*O,w+=a*j,C+=a*q,x+=a*F,E+=a*K,S+=a*$,k+=a*H,A+=a*G,T+=a*W,I+=a*Y,B+=a*Q,N+=a*J,m+=(a=t[12])*U,b+=a*P,y+=a*V,_+=a*M,w+=a*O,C+=a*j,x+=a*q,E+=a*F,S+=a*K,k+=a*$,A+=a*H,T+=a*G,I+=a*W,B+=a*Y,N+=a*Q,R+=a*J,b+=(a=t[13])*U,y+=a*P,_+=a*V,w+=a*M,C+=a*O,x+=a*j,E+=a*q,S+=a*F,k+=a*K,A+=a*$,T+=a*H,I+=a*G,B+=a*W,N+=a*Y,R+=a*Q,z+=a*J,y+=(a=t[14])*U,_+=a*P,w+=a*V,C+=a*M,x+=a*O,E+=a*j,S+=a*q,k+=a*F,A+=a*K,T+=a*$,I+=a*H,B+=a*G,N+=a*W,R+=a*Y,z+=a*Q,L+=a*J,_+=(a=t[15])*U,i+=38*(C+=a*V),l+=38*(x+=a*M),s+=38*(E+=a*O),c+=38*(S+=a*j),u+=38*(k+=a*q),v+=38*(A+=a*F),d+=38*(T+=a*K),p+=38*(I+=a*$),f+=38*(B+=a*H),h+=38*(N+=a*G),g+=38*(R+=a*W),m+=38*(z+=a*Y),b+=38*(L+=a*Q),y+=38*(D+=a*J),n=(a=(n+=38*(w+=a*P))+(o=1)+65535)-65536*(o=Math.floor(a/65536)),i=(a=i+o+65535)-65536*(o=Math.floor(a/65536)),l=(a=l+o+65535)-65536*(o=Math.floor(a/65536)),s=(a=s+o+65535)-65536*(o=Math.floor(a/65536)),c=(a=c+o+65535)-65536*(o=Math.floor(a/65536)),u=(a=u+o+65535)-65536*(o=Math.floor(a/65536)),v=(a=v+o+65535)-65536*(o=Math.floor(a/65536)),d=(a=d+o+65535)-65536*(o=Math.floor(a/65536)),p=(a=p+o+65535)-65536*(o=Math.floor(a/65536)),f=(a=f+o+65535)-65536*(o=Math.floor(a/65536)),h=(a=h+o+65535)-65536*(o=Math.floor(a/65536)),g=(a=g+o+65535)-65536*(o=Math.floor(a/65536)),m=(a=m+o+65535)-65536*(o=Math.floor(a/65536)),b=(a=b+o+65535)-65536*(o=Math.floor(a/65536)),y=(a=y+o+65535)-65536*(o=Math.floor(a/65536)),_=(a=_+o+65535)-65536*(o=Math.floor(a/65536)),n=(a=(n+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(a/65536)),i=(a=i+o+65535)-65536*(o=Math.floor(a/65536)),l=(a=l+o+65535)-65536*(o=Math.floor(a/65536)),s=(a=s+o+65535)-65536*(o=Math.floor(a/65536)),c=(a=c+o+65535)-65536*(o=Math.floor(a/65536)),u=(a=u+o+65535)-65536*(o=Math.floor(a/65536)),v=(a=v+o+65535)-65536*(o=Math.floor(a/65536)),d=(a=d+o+65535)-65536*(o=Math.floor(a/65536)),p=(a=p+o+65535)-65536*(o=Math.floor(a/65536)),f=(a=f+o+65535)-65536*(o=Math.floor(a/65536)),h=(a=h+o+65535)-65536*(o=Math.floor(a/65536)),g=(a=g+o+65535)-65536*(o=Math.floor(a/65536)),m=(a=m+o+65535)-65536*(o=Math.floor(a/65536)),b=(a=b+o+65535)-65536*(o=Math.floor(a/65536)),y=(a=y+o+65535)-65536*(o=Math.floor(a/65536)),_=(a=_+o+65535)-65536*(o=Math.floor(a/65536)),n+=o-1+37*(o-1),e[0]=n,e[1]=i,e[2]=l,e[3]=s,e[4]=c,e[5]=u,e[6]=v,e[7]=d,e[8]=p,e[9]=f,e[10]=h,e[11]=g,e[12]=m,e[13]=b,e[14]=y,e[15]=_}return Li}var Fi,Ki={exports:{}};function $i(){if(Fi)return Ki.exports;Fi=1;var e=jo();tn(),cn(),Sn(),sn(),wn(),ci(),qn(),Wo(),Si();var t=e.asn1,r=Ki.exports=e.pkcs7=e.pkcs7||{};function a(a){var o={},n=[];if(!t.validate(a,r.asn1.recipientInfoValidator,o,n)){var i=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw i.errors=n,i}return{version:o.version.charCodeAt(0),issuer:e.pki.RDNAttributesAsArray(o.issuer),serialNumber:e.util.createBuffer(o.serial).toHex(),encryptedContent:{algorithm:t.derToOid(o.encAlgorithm),parameter:o.encParameter?o.encParameter.value:void 0,content:o.encKey}}}function o(r){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.encryptedContent.content)])}function n(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}function i(r){var a=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(r.authenticatedAttributesAsn1&&a.value.push(r.authenticatedAttributesAsn1),a.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),a.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.signature)),r.unauthenticatedAttributes.length>0){for(var o=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n<r.unauthenticatedAttributes.length;++n){var i=r.unauthenticatedAttributes[n];o.values.push(l(i))}a.value.push(o)}return a}function l(r){var a;if(r.type===e.pki.oids.contentType)a=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.value).getBytes());else if(r.type===e.pki.oids.messageDigest)a=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.value.bytes());else if(r.type===e.pki.oids.signingTime){var o=new Date("1950-01-01T00:00:00Z"),n=new Date("2050-01-01T00:00:00Z"),i=r.value;if("string"==typeof i){var l=Date.parse(i);i=isNaN(l)?13===i.length?t.utcTimeToDate(i):t.generalizedTimeToDate(i):new Date(l)}a=i>=o&&i<n?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(i)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(i))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[a])])}function s(r,a,o){var n={};if(!t.validate(a,o,n,[])){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}if(t.derToOid(n.contentType)!==e.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(n.encryptedContent){var l="";if(e.util.isArray(n.encryptedContent))for(var s=0;s<n.encryptedContent.length;++s){if(n.encryptedContent[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");l+=n.encryptedContent[s].value}else l=n.encryptedContent;r.encryptedContent={algorithm:t.derToOid(n.encAlgorithm),parameter:e.util.createBuffer(n.encParameter.value),content:e.util.createBuffer(l)}}if(n.content){l="";if(e.util.isArray(n.content))for(s=0;s<n.content.length;++s){if(n.content[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");l+=n.content[s].value}else l=n.content;r.content=e.util.createBuffer(l)}return r.version=n.version.charCodeAt(0),r.rawCapture=n,n}function c(t){if(void 0===t.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===t.content){var r;switch(t.encryptedContent.algorithm){case e.pki.oids["aes128-CBC"]:case e.pki.oids["aes192-CBC"]:case e.pki.oids["aes256-CBC"]:r=e.aes.createDecryptionCipher(t.encryptedContent.key);break;case e.pki.oids.desCBC:case e.pki.oids["des-EDE3-CBC"]:r=e.des.createDecryptionCipher(t.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+t.encryptedContent.algorithm)}if(r.start(t.encryptedContent.parameter),r.update(t.encryptedContent.content),!r.finish())throw new Error("Symmetric decryption failed.");t.content=r.output}}return r.messageFromPem=function(a){var o=e.pem.decode(a)[0];if("PKCS7"!==o.type){var n=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw n.headerType=o.type,n}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var i=t.fromDer(o.body);return r.messageFromAsn1(i)},r.messageToPem=function(r,a){var o={type:"PKCS7",body:t.toDer(r.toAsn1()).getBytes()};return e.pem.encode(o,{maxline:a})},r.messageFromAsn1=function(a){var o={},n=[];if(!t.validate(a,r.asn1.contentInfoValidator,o,n)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw i.errors=n,i}var l,s=t.derToOid(o.contentType);switch(s){case e.pki.oids.envelopedData:l=r.createEnvelopedData();break;case e.pki.oids.encryptedData:l=r.createEncryptedData();break;case e.pki.oids.signedData:l=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return l.fromAsn1(o.content.value[0]),l},r.createSignedData=function(){var a=null;return a={type:e.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(s(a,t,r.asn1.signedDataValidator),a.certificates=[],a.crls=[],a.digestAlgorithmIdentifiers=[],a.contentInfo=null,a.signerInfos=[],a.rawCapture.certificates)for(var o=a.rawCapture.certificates.value,n=0;n<o.length;++n)a.certificates.push(e.pki.certificateFromAsn1(o[n]))},toAsn1:function(){a.contentInfo||a.sign();for(var r=[],o=0;o<a.certificates.length;++o)r.push(e.pki.certificateToAsn1(a.certificates[o]));var n=[],i=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(a.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,a.digestAlgorithmIdentifiers),a.contentInfo])]);return r.length>0&&i.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),n.length>0&&i.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,n)),i.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,a.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),i])},addSigner:function(t){var r=t.issuer,o=t.serialNumber;if(t.certificate){var n=t.certificate;"string"==typeof n&&(n=e.pki.certificateFromPem(n)),r=n.issuer.attributes,o=n.serialNumber}var i=t.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=e.pki.privateKeyFromPem(i));var l=t.digestAlgorithm||e.pki.oids.sha1;switch(l){case e.pki.oids.sha1:case e.pki.oids.sha256:case e.pki.oids.sha384:case e.pki.oids.sha512:case e.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+l)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var c=!1,u=!1,v=0;v<s.length;++v){var d=s[v];if(c||d.type!==e.pki.oids.contentType){if(u||d.type!==e.pki.oids.messageDigest);else if(u=!0,c)break}else if(c=!0,u)break}if(!c||!u)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}a.signers.push({key:i,version:1,issuer:r,serialNumber:o,digestAlgorithm:l,signatureAlgorithm:e.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(r){var o;(r=r||{},"object"!=typeof a.content||null===a.contentInfo)&&(a.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes())]),"content"in a&&(a.content instanceof e.util.ByteBuffer?o=a.content.bytes():"string"==typeof a.content&&(o=e.util.encodeUtf8(a.content)),r.detached?a.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,o):a.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,o)]))));0!==a.signers.length&&function(r){var o;o=a.detachedContent?a.detachedContent:(o=a.contentInfo.value[1]).value[0];if(!o)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var n=t.derToOid(a.contentInfo.value[0].value),s=t.toDer(o);for(var c in s.getByte(),t.getBerValueLength(s),s=s.getBytes(),r)r[c].start().update(s);for(var u=new Date,v=0;v<a.signers.length;++v){var d=a.signers[v];if(0===d.authenticatedAttributes.length){if(n!==e.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var p=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),f=0;f<d.authenticatedAttributes.length;++f){var h=d.authenticatedAttributes[f];h.type===e.pki.oids.messageDigest?h.value=r[d.digestAlgorithm].digest():h.type===e.pki.oids.signingTime&&(h.value||(h.value=u)),p.value.push(l(h)),d.authenticatedAttributesAsn1.value.push(l(h))}s=t.toDer(p).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}a.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(i(e[r]));return t}(a.signers)}(function(){for(var r={},o=0;o<a.signers.length;++o){var n=a.signers[o];(i=n.digestAlgorithm)in r||(r[i]=e.md[e.pki.oids[i]].create()),0===n.authenticatedAttributes.length?n.md=r[i]:n.md=e.md[e.pki.oids[i]].create()}for(var i in a.digestAlgorithmIdentifiers=[],r)a.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=e.pki.certificateFromPem(t)),a.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var t=null;return t={type:e.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){s(t,e,r.asn1.encryptedDataValidator)},decrypt:function(e){void 0!==e&&(t.encryptedContent.key=e),c(t)}}},r.createEnvelopedData=function(){var o=null;return o={type:e.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){var t=s(o,e,r.asn1.envelopedDataValidator);o.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}(t.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(o.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(o.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,n(o.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=o.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),r.parameter?t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes()):void 0]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(e){for(var t=e.issuer.attributes,r=0;r<o.recipients.length;++r){var a=o.recipients[r],n=a.issuer;if(a.serialNumber===e.serialNumber&&n.length===t.length){for(var i=!0,l=0;l<t.length;++l)if(n[l].type!==t[l].type||n[l].value!==t[l].value){i=!1;break}if(i)return a}}return null},decrypt:function(t,r){if(void 0===o.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case e.pki.oids.rsaEncryption:case e.pki.oids.desCBC:var a=r.decrypt(t.encryptedContent.content);o.encryptedContent.key=e.util.createBuffer(a);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(o)},addRecipient:function(t){o.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:e.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===o.encryptedContent.content){var a,n,i;switch(r=r||o.encryptedContent.algorithm,t=t||o.encryptedContent.key,r){case e.pki.oids["aes128-CBC"]:a=16,n=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["aes192-CBC"]:a=24,n=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["aes256-CBC"]:a=32,n=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["des-EDE3-CBC"]:a=24,n=8,i=e.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=e.util.createBuffer(e.random.getBytes(a));else if(t.length()!=a)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+a+".");o.encryptedContent.algorithm=r,o.encryptedContent.key=t,o.encryptedContent.parameter=e.util.createBuffer(e.random.getBytes(n));var l=i(t);if(l.start(o.encryptedContent.parameter.copy()),l.update(o.content),!l.finish())throw new Error("Symmetric encryption failed.");o.encryptedContent.content=l.output}for(var s=0;s<o.recipients.length;++s){var c=o.recipients[s];if(void 0===c.encryptedContent.content){if(c.encryptedContent.algorithm!==e.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);c.encryptedContent.content=c.encryptedContent.key.encrypt(o.encryptedContent.key.data)}}}}},Ki.exports}var Hi,Gi,Wi,Yi={exports:{}};var Qi=(Wi||(Wi=1,Gi=jo(),tn(),Ii(),cn(),Yo(),Sn(),qi(),hn(),function(){if(Pi)return Ui;Pi=1;var e=jo();Wo(),qn(),Kn(),Ui=e.kem=e.kem||{};var t=e.jsbn.BigInteger;function r(t,r,a,o){t.generate=function(t,n){for(var i=new e.util.ByteBuffer,l=Math.ceil(n/o)+a,s=new e.util.ByteBuffer,c=a;c<l;++c){s.putInt32(c),r.start(),r.update(t+s.getBytes());var u=r.digest();i.putBytes(u.getBytes(o))}return i.truncate(i.length()-n),i.getBytes()}}e.kem.rsa={},e.kem.rsa.create=function(r,a){var o=(a=a||{}).prng||e.random;return{encrypt:function(a,n){var i,l=Math.ceil(a.n.bitLength()/8);do{i=new t(e.util.bytesToHex(o.getBytesSync(l)),16).mod(a.n)}while(i.compareTo(t.ONE)<=0);var s=l-(i=e.util.hexToBytes(i.toString(16))).length;return s>0&&(i=e.util.fillString(String.fromCharCode(0),s)+i),{encapsulation:a.encrypt(i,"NONE"),key:r.generate(i,n)}},decrypt:function(e,t,a){var o=e.decrypt(t,"NONE");return r.generate(o,a)}}},e.kem.kdf1=function(e,t){r(this,e,0,t||e.digestLength)},e.kem.kdf2=function(e,t){r(this,e,1,t||e.digestLength)}}(),function(){if(Mi)return Vi;Mi=1;var e=jo();Wo(),Vi=e.log=e.log||{},e.log.levels=["none","error","warning","info","debug","verbose","max"];var t={},r=[],a=null;e.log.LEVEL_LOCKED=2,e.log.NO_LEVEL_CHECK=4,e.log.INTERPOLATE=8;for(var o=0;o<e.log.levels.length;++o){var n=e.log.levels[o];t[n]={index:o,name:n.toUpperCase()}}e.log.logMessage=function(a){for(var o=t[a.level].index,n=0;n<r.length;++n){var i=r[n];i.flags&e.log.NO_LEVEL_CHECK?i.f(a):o<=t[i.level].index&&i.f(i,a)}},e.log.prepareStandard=function(e){"standard"in e||(e.standard=t[e.level].name+" ["+e.category+"] "+e.message)},e.log.prepareFull=function(t){if(!("full"in t)){var r=[t.message];r=r.concat([]),t.full=e.util.format.apply(this,r)}},e.log.prepareStandardFull=function(t){"standardFull"in t||(e.log.prepareStandard(t),t.standardFull=t.standard)};var i=["error","warning","info","debug","verbose"];for(o=0;o<i.length;++o)(function(t){e.log[t]=function(r,a){var o=Array.prototype.slice.call(arguments).slice(2),n={timestamp:new Date,level:t,category:r,message:a,arguments:o};e.log.logMessage(n)}})(i[o]);if(e.log.makeLogger=function(t){var r={flags:0,f:t};return e.log.setLevel(r,"none"),r},e.log.setLevel=function(t,r){var a=!1;if(t&&!(t.flags&e.log.LEVEL_LOCKED))for(var o=0;o<e.log.levels.length;++o)if(r==e.log.levels[o]){t.level=r,a=!0;break}return a},e.log.lock=function(t,r){void 0===r||r?t.flags|=e.log.LEVEL_LOCKED:t.flags&=~e.log.LEVEL_LOCKED},e.log.addLogger=function(e){r.push(e)},"undefined"!=typeof console&&"log"in console){var l;if(console.error&&console.warn&&console.info&&console.debug){var s={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},c=function(t,r){e.log.prepareStandard(r);var a=s[r.level],o=[r.standard];o=o.concat(r.arguments.slice()),a.apply(console,o)};l=e.log.makeLogger(c)}else c=function(t,r){e.log.prepareStandardFull(r)},l=e.log.makeLogger(c);e.log.setLevel(l,"debug"),e.log.addLogger(l),a=l}else console={log:function(){}};if(null!==a&&"undefined"!=typeof window&&window.location){var u=new URL(window.location.href).searchParams;u.has("console.level")&&e.log.setLevel(a,u.get("console.level").slice(-1)[0]),u.has("console.lock")&&"true"==u.get("console.lock").slice(-1)[0]&&e.log.lock(a)}e.log.consoleLogger=a}(),Oi||(Oi=1,fn(),bn(),Yn(),zn(),Ri()),hi(),In(),wn(),Qn(),ki(),$i(),Ai(),ai(),jn(),Ei(),qn(),Fn(),function(){if(Hi)return Yi.exports;Hi=1;var e=jo();tn(),hn(),bn(),Yn(),Wo();var t=Yi.exports=e.ssh=e.ssh||{};function r(t,r){var a=r.toString(16);a[0]>="8"&&(a="00"+a);var o=e.util.hexToBytes(a);t.putInt32(o.length),t.putBytes(o)}function a(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var t=e.md.sha1.create(),r=arguments.length,a=0;a<r;++a)t.update(arguments[a]);return t.digest()}t.privateKeyToPutty=function(t,n,i){var l="ssh-rsa",s=""===(n=n||"")?"none":"aes256-cbc",c="PuTTY-User-Key-File-2: "+l+"\r\n";c+="Encryption: "+s+"\r\n",c+="Comment: "+(i=i||"")+"\r\n";var u=e.util.createBuffer();a(u,l),r(u,t.e),r(u,t.n);var v=e.util.encode64(u.bytes(),64),d=Math.floor(v.length/66)+1;c+="Public-Lines: "+d+"\r\n",c+=v;var p,f=e.util.createBuffer();if(r(f,t.d),r(f,t.p),r(f,t.q),r(f,t.qInv),n){var h=f.length()+16-1;h-=h%16;var g=o(f.bytes());g.truncate(g.length()-h+f.length()),f.putBuffer(g);var m=e.util.createBuffer();m.putBuffer(o("\0\0\0\0",n)),m.putBuffer(o("\0\0\0",n));var b=e.aes.createEncryptionCipher(m.truncate(8),"CBC");b.start(e.util.createBuffer().fillWithByte(0,16)),b.update(f.copy()),b.finish();var y=b.output;y.truncate(16),p=e.util.encode64(y.bytes(),64)}else p=e.util.encode64(f.bytes(),64);c+="\r\nPrivate-Lines: "+(d=Math.floor(p.length/66)+1)+"\r\n",c+=p;var _=o("putty-private-key-file-mac-key",n),w=e.util.createBuffer();a(w,l),a(w,s),a(w,i),w.putInt32(u.length()),w.putBuffer(u),w.putInt32(f.length()),w.putBuffer(f);var C=e.hmac.create();return C.start("sha1",_),C.update(w.bytes()),c+"\r\nPrivate-MAC: "+C.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(t,o){var n="ssh-rsa";o=o||"";var i=e.util.createBuffer();return a(i,n),r(i,t.e),r(i,t.n),n+" "+e.util.encode64(i.bytes())+" "+o},t.privateKeyToOpenSSH=function(t,r){return r?e.pki.encryptRsaPrivateKey(t,r,{legacy:!0,algorithm:"aes128"}):e.pki.privateKeyToPem(t)},t.getPublicKeyFingerprint=function(t,o){var n=(o=o||{}).md||e.md.md5.create(),i=e.util.createBuffer();a(i,"ssh-rsa"),r(i,t.e),r(i,t.n),n.start(),n.update(i.getBytes());var l=n.digest();if("hex"===o.encoding){var s=l.toHex();return o.delimiter?s.match(/.{2}/g).join(o.delimiter):s}if("binary"===o.encoding)return l.getBytes();if(o.encoding)throw new Error('Unknown encoding "'+o.encoding+'".');return l},Yi.exports}(),Ti(),Wo()),Gi);class Ji{constructor(e){this.logger="CORE_LOGGER",this.isDebug=e}debug(e){this.isDebug&&console.debug}warning(e){this.isDebug&&console.warn}warn(e){this.warning(e)}info(e){this.isDebug&&console.info}error(e){this.isDebug&&console.error}isDebugEnabled(){return this.isDebug}}let Xi={domain:"https://api.dev.alviere.com",access_token:"",certificate:{id:"",public_key:""}};function Zi(e){Xi={...Xi,...e}}function el(e){if("undefined"!=typeof window&&window.VITE_DEBUG){return window[`VITE_${e}`]}}function tl(){if(Xi.domain&&Xi.certificate)return;const e={},t=el("ALVIERE_DOMAIN"),r=el("CERTIFICATE");if(t&&(e.domain=t),r)try{const t=JSON.parse(r);t&&"string"==typeof t.id&&"string"==typeof t.public_key&&(e.certificate={id:t.id,public_key:t.public_key})}catch{}(e.domain||e.certificate)&&Zi(e)}const rl=()=>(Xi.domain||tl(),Xi.domain),al=()=>(Xi.certificate||tl(),Xi.certificate.public_key),ol=()=>(Xi.certificate||tl(),Xi.certificate.id);rl(),al(),ol();class nl{constructor(e){var t;this.logger=e,this.rsa_key=al(),this.key=this.generate_key(),this.nonce=this.generate_nonce(),null==(t=this.logger)||t.debug("🔐 Cryptor initialized")}async encrypt(e){var t,r;const a=(new TextEncoder).encode(JSON.stringify(e)),o={name:"AES-GCM",iv:this.nonce},n=await this.import_key(),i=await crypto.subtle.encrypt(o,n,a),l=this.bufferToStr(i),s=btoa(l),c=this.bufferToStr(this.key),u=btoa(c),v=this.bufferToStr(this.nonce),d=btoa(v);null==(t=this.logger)||t.debug(`🔐 RSA_KEY: ${this.rsa_key.substring(0,50)}...`);const p=Qi.pki.publicKeyFromPem(this.rsa_key).encrypt(u+"::"+d),f={p:s,k:btoa(p),i:ol()};return null==(r=this.logger)||r.debug(`🔐 ENCRYPTED_REQUEST: p=${f.p.substring(0,20)}..., i=${f.i}`),f}async decrypt(e){var t;const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:this.nonce},await this.import_key(),Uint8Array.from(atob(e.p),e=>e.charCodeAt(0))),a=(new TextDecoder).decode(r);return null==(t=this.logger)||t.debug(`🔐 DECRYPTED: ${a}`),JSON.parse(a)}generate_key(){return crypto.getRandomValues(new Uint8Array(32))}generate_nonce(){return crypto.getRandomValues(new Uint8Array(12))}async import_key(){return await crypto.subtle.importKey("raw",this.key,{name:"AES-GCM"},!0,["encrypt","decrypt"])}async rsa_encrypt(e){var t,r;null==(t=this.logger)||t.debug(`🔐 RSA_ENCRYPT: Data to encrypt: ${e.substring(0,50)}...`),null==(r=this.logger)||r.debug(`🔐 RSA_KEY: ${this.rsa_key.substring(0,50)}...`);const a=Qi.pki.publicKeyFromPem(this.rsa_key);return btoa(a.encrypt(e))}bufferToStr(e){return Array.from(new Uint8Array(e)).map(e=>String.fromCharCode(e)).join("")}}class il{constructor(e){this.logger=e}credit_card_name(e){return this.logger.debug(`🔐 CREDIT_CARD_NAME: ${e}`),e&&"string"==typeof e?0===e.trim().length?"Card holder name cannot be empty.":null:"Card holder name cannot be empty."}credit_card_number(e){if(!e||"string"!=typeof e)return"Please enter a valid card number.";return/^(?:4[0-9]{12}(?:[0-9]{3})?)$/.test(e.replace(/\s/g,""))||/^(?:5[1-5][0-9]{14})$/.test(e.replace(/\s/g,""))||/^(?:3[47][0-9]{13})$/.test(e.replace(/\s/g,""))||/^(?:6(?:011|5[0-9][0-9])[0-9]{12})$/.test(e.replace(/\s/g,""))?null:(this.logger.debug("🔐 card number is not a recognized brand"),"Please enter a valid card number.")}credit_card_expiry_date(e){if(!e||"string"!=typeof e)return"Expiry date cannot be empty.";if(0===e.trim().length)return"Expiry date cannot be empty.";return/^(0[1-9]|1[0-2])\/?([0-9]{4}|[0-9]{2})$/.test(e)?null:"Please enter a valid expiry date."}credit_card_sec_code(e){if(!e||"string"!=typeof e)return"Security code cannot be empty.";if(0===e.trim().length)return"Security code cannot be empty.";return/^[0-9]{3,4}$/.test(e)?null:"Please enter a valid security code."}credit_card_zip_code(e){return e&&"string"==typeof e?0===e.trim().length?"Zip code cannot be empty.":null:"Zip code cannot be empty."}credit_card_pin(e){if(!e||"string"!=typeof e)return"PIN cannot be empty.";if(0===e.trim().length)return"PIN cannot be empty.";return/^[0-9]{4}$/.test(e)?null:"Please enter a valid PIN."}is_valid_uuid(e){if(!e||"string"!=typeof e)return"UUID cannot be empty.";if(0===e.trim().length)return"UUID cannot be empty.";return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)?null:"Please enter a valid UUID."}required(e,t){return null==e||"string"==typeof e&&0===e.trim().length?t?`${t} is required.`:"This field is required.":null}email(e){if(!e||"string"!=typeof e)return"Please enter a valid email address.";const t=e.trim();if(t.includes(".."))return"Please enter a valid email address.";return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/.test(t)?null:"Please enter a valid email address."}phone(e){if(!e||"string"!=typeof e)return"Please enter a valid phone number.";if(!e.startsWith("+"))return"Phone number must start with country code (e.g., +1)";const t=e.substring(1),r=t.match(/^(\d{1,3})/);if(!r)return"Invalid country code format";const a=r[1],o=t.substring(a.length);if(o.length<7)return"Phone number too short";const n=a.length+o.length;return n<10||n>15?"Phone number must be between 10 and 15 digits total":null}date(e,t="YYYY-MM-DD"){if(!e||"string"!=typeof e)return"Please enter a valid date.";const r=/^([0-9]{4})-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/;if(!r.test(e))return"Please enter a valid date in YYYY-MM-DD format";const[,a,o,n]=e.match(r)||[],i=parseInt(a),l=parseInt(o),s=parseInt(n);if(!this.isValidCalendarDate(i,l,s))return"Invalid date - this date does not exist";const c=new Date(e);return c>new Date?"Date cannot be in the future":c<new Date("1900-01-01")?"Date cannot be before 1900":null}isValidCalendarDate(e,t,r){const a=new Date(e,t-1,r);return a.getFullYear()===e&&a.getMonth()===t-1&&a.getDate()===r}min_length(e,t,r){return e&&"string"==typeof e?e.length<t?r?`${r} must be at least ${t} characters long.`:`Must be at least ${t} characters long.`:null:r?`${r} is required.`:"This field is required."}max_length(e,t,r){return e&&"string"==typeof e&&e.length>t?r?`${r} must be no more than ${t} characters long.`:`Must be no more than ${t} characters long.`:null}pattern(e,t,r){return e&&"string"==typeof e&&t.test(e)?null:r||"Please enter a valid value."}numeric(e,t){return e&&"string"==typeof e?/^\d+$/.test(e.trim())?null:t?`${t} must contain only numbers.`:"Must contain only numbers.":t?`${t} is required.`:"This field is required."}alphabetic(e,t){return e&&"string"==typeof e?/^[a-zA-Z\s]+$/.test(e.trim())?null:t?`${t} must contain only letters and spaces.`:"Must contain only letters and spaces.":t?`${t} is required.`:"This field is required."}alphanumeric(e,t){return e&&"string"==typeof e?/^[a-zA-Z0-9\s]+$/.test(e.trim())?null:t?`${t} must contain only letters, numbers, and spaces.`:"Must contain only letters, numbers, and spaces.":t?`${t} is required.`:"This field is required."}url(e){if(!e||"string"!=typeof e)return"Please enter a valid URL.";const t=e.trim();try{const e=new URL(t);return""===e.hostname||e.hostname.startsWith(".")||e.hostname.endsWith(".")?"Please enter a valid URL.":null}catch{return"Please enter a valid URL."}}postal_code(e,t="US"){if(!e||"string"!=typeof e)return"Please enter a valid postal code.";const r=e.trim();switch(t.toUpperCase()){case"US":if(!/^\d{5}(-\d{4})?$/.test(r))return"Please enter a valid US ZIP code (e.g., 12345 or 12345-6789).";break;case"CA":if(!/^[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d$/.test(r))return"Please enter a valid Canadian postal code (e.g., A1A 1A1).";break;case"UK":case"GB":if(!/^[A-Za-z]{1,2}\d[A-Za-z\d]?\s\d[A-Za-z]{2}$/.test(r))return"Please enter a valid UK postal code (e.g., SW1A 1AA).";break;default:if(!/^[A-Za-z0-9\s-]{3,10}$/.test(r))return"Please enter a valid postal code."}return null}}class ll extends Error{constructor(e,t,r){super(`Alcore API Error ${e}: ${t}`),this.name="AlcoreApiError",this.errorCode=e,this.errorDescription=t,this.statusCode=r,Error.captureStackTrace&&Error.captureStackTrace(this,ll)}isErrorCode(e){return this.errorCode===e}isAnyErrorCode(e){return e.includes(this.errorCode)}}const sl="000000",cl="100011",ul="100012",vl="100013",dl="100014",pl="100015",fl="100016",hl="100017",gl="100300",ml="100301",bl="100302",yl="100303",_l="100304",wl="100305",Cl="100306",xl="110000",El="110001",Sl="110002",kl="110004",Al="115000",Tl="115001",Il="320129",Bl="320104",Nl={[wl]:"Invalid authentication token. Please log in again.",[Cl]:"Authentication failed. Please check your credentials and try again.",[xl]:"Session not found. Please log in again.",[El]:"Parent account not found.",[Sl]:"Resource not found.",[kl]:"Account type not supported.",[gl]:"Invalid request payload. Please check your request and try again.",[ml]:"Invalid request payload field. Please check your request and try again.",[bl]:"Invalid path parameter. Please check your request and try again.",[yl]:"Invalid header. Please check your request and try again.",[_l]:"Invalid query parameter. Please check your request and try again.",[cl]:"Unprocessable encrypted data. Please check your request and try again.",[ul]:"Wrong encrypted endpoint. Please check your request and try again.",[vl]:"Undecryptable data at endpoint. Please check your request and try again.",[dl]:"Decrypted data unusable at endpoint. Please check your request and try again.",[pl]:"Wrong decrypted endpoint. Please check your request and try again.",[fl]:"Wrong version or endpoint. Please check your request and try again.",[hl]:"Operation halted. Please check your request and try again.",[Al]:"Underlying API Error. ",[Tl]:"Account status not active. Please check your request and try again.",[Il]:"Used Account can't be used to create a child account.",[Bl]:"Parent account not allowed. Please check your request and try again."},Rl=[wl,Cl,xl,cl,ul,vl,hl,sl,Al,Tl,Il,Bl];class zl{constructor(e,t,r){this.endpoint="/alcore",this.jwt=e,this.cryptor=t,this.domain=rl(),this.logger=r,this.logger.debug(`🔐 AlcoreBase initialized with domain: ${this.domain}`)}async send(e,t,r){const a={method:e,endpoint:t,payload:JSON.stringify(r)};let o;this.logger.debug("🌐 AlcoreBase: Preparing to send request"),this.logger.debug("🌐 Method: "+e),this.logger.debug("🌐 Endpoint: "+t),this.logger.debug("🌐 Domain: "+(this.domain||"undefined")),this.logger.debug("🌐 JWT Token: "+(this.jwt?"✅ Present":"❌ Missing")),this.logger.debug("🌐 Payload size: "+JSON.stringify(r).length+" chars"),this.logger.debug(this.jwt),this.logger.debug("DATA TO SEND before encrypt"),this.logger.debug(r);try{o=await this.cryptor.encrypt(a),this.logger.debug("🔐 Encryption successful")}catch(i){throw this.logger.debug("❌ Encryption failed: "+(i instanceof Error?i.message:"Unknown error")),i}this.logger.debug("BASE GATEWAY: posting to "+this.endpoint),this.logger.debug(o);const n=this.domain+this.endpoint;this.logger.debug("🌐 Full URL: "+n);try{const e=await fetch(n,{method:"post",headers:{"Content-Type":"application/json",Authorization:"Bearer "+this.jwt,Version:"2021-11-18"},body:JSON.stringify(o)});if(this.logger.debug("🌐 Response received - Status: "+e.status+" "+e.statusText),this.logger.debug("🌐 Response OK: "+e.ok),!e.ok){let t=await e.json();throw t.p&&(t=await this.decrypt(t)),this.logger.debug("❌ API Error - Code: "+t.error_code+", Description: "+t.error_description),new ll(500===e.status?Al:t.error_code,Nl[t.error_code],e.status)}return e}catch(l){throw this.logger.debug("❌ Fetch failed: "+(l instanceof Error?l.message:"Unknown error")),l}}async decrypt(e){return this.cryptor.decrypt(e)}}function Ll(e){if(e&&"object"==typeof e&&("error_code"in e||"error_description"in e)){const t=e.error_description||"Unknown API error",r=e.error_code||"UNKNOWN";throw new Error(`${r}: ${t}`)}return e}function Dl(e){try{const t=e.split(".");if(3!==t.length)return null;const r=t[1],a=atob(r.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(a)}catch(t){return null}}function Ul(e){const t=Dl(e);return t?{domain:t.api_domain||"https://api.dev.alviere.com"}:{}}function Pl(e){const t=Dl(e);return t&&t.sub||null}class Vl extends zl{constructor(e,t,r){super(e,t,r)}async add_card(e,t){const r=`/accounts/${e}/payment-methods/cards`,a=await this.send("POST",r,t),o=await a.json();return Ll(await this.decrypt(o))}async add_bank_account(e,t){const r=`/accounts/${e}/payment-methods/bank-accounts`,a=await this.send("POST",r,t),o=await a.json();return Ll(await this.decrypt(o))}async get_bank_accounts(e){const t=`/accounts/${e}/payment-methods/bank-accounts`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async delete_bank_account(e,t){const r=`/accounts/${e}/payment-methods/bank-accounts/${t}`;return Ll(await this.send("DELETE",r,{}))}}class Ml extends zl{constructor(e,t,r){super(e,t,r)}async listWallets(e,t){const r=`/accounts/${e}/wallets${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),o=await a.json();return Ll(await this.decrypt(o))}async loadFunds(e,t){const r=`/wallets/${e}/load`,a=await this.send("POST",r,t),o=await a.json();return Ll(await this.decrypt(o))}}class Ol extends zl{constructor(e,t,r){super(e,t,r)}async createPaymentInstrument(e){const t=await this.send("POST","/payments/payment-instruments",e),r=await t.json();return Ll(await this.decrypt(r))}async getPaymentInstrument(e){const t=`/payments/payment-instruments/${e}`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async deletePaymentInstrument(e){const t=`/payments/payment-instruments/${e}`;await this.send("DELETE",t,{})}async debitFunds(e){const t=await this.send("POST","/payments/debit",e),r=await t.json();return Ll(await this.decrypt(r))}async listCards(e,t){const r=`/accounts/${e}/payment-methods/cards${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),o=await a.json();return Ll(await this.decrypt(o))}}class jl extends zl{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 AccountsGateway initialized")}async createAccount(e){const t=await this.send("POST","/accounts",e),r=await t.json();return Ll(await this.decrypt(r))}async getAccount(e){const t=`/accounts/${e}`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async updateAccount(e,t){const r=`/accounts/${e}`,a=await this.send("PUT",r,t),o=await a.json();return Ll(await this.decrypt(o))}async deleteAccount(e){const t=`/accounts/${e}`;await this.send("DELETE",t,{})}async listAccounts(e){const t=`/accounts${e?"?"+new URLSearchParams(Object.entries(e).filter(([e,t])=>void 0!==t)):""}`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async activateAccount(e){const t=`/accounts/${e}/activate`;await this.send("POST",t,{})}async deactivateAccount(e){const t=`/accounts/${e}/deactivate`;await this.send("POST",t,{})}async manageOnboarding(e,t){const r=`/accounts/${e}/onboarding`;await this.send("POST",r,{action:t})}async createAddress(e,t){const r=`/accounts/${e}/addresses`,a=await this.send("POST",r,t),o=await a.json();return Ll(await this.decrypt(o))}async getAddresses(e,t){const r=`/accounts/${e}/addresses${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),o=await a.json();return Ll(await this.decrypt(o))}async updateAddress(e,t,r){const a=`/accounts/${e}/addresses/${t}`,o=await this.send("PUT",a,r),n=await o.json();return Ll(await this.decrypt(n))}async deleteAddress(e,t){const r=`/accounts/${e}/addresses/${t}`;await this.send("DELETE",r,{})}async createDossier(e,t){const r=`/accounts/${e}/dossiers`,a=await this.send("POST",r,t),o=await a.json();return Ll(await this.decrypt(o))}async getDossiers(e,t){const r=`/accounts/${e}/dossiers${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),o=await a.json();return Ll(await this.decrypt(o))}async getDossier(e,t){const r=`/accounts/${e}/dossiers/${t}`,a=await this.send("GET",r,{}),o=await a.json();return Ll(await this.decrypt(o))}async updateDossier(e,t,r){const a=`/accounts/${e}/dossiers/${t}`,o=await this.send("PUT",a,r),n=await o.json();return Ll(await this.decrypt(n))}async replaceDossier(e,t,r){const a=`/accounts/${e}/dossiers/${t}`,o=await this.send("PATCH",a,r),n=await o.json();return Ll(await this.decrypt(n))}async deleteDossier(e,t){const r=`/accounts/${e}/dossiers/${t}`;await this.send("DELETE",r,{})}}class ql extends zl{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 AuthGateway initialized")}async generateScopedToken(e){this.logger.debug("🔐 AuthGateway: Generating scoped token"),this.logger.debug("🌐 Endpoint: /v3/auth"),this.logger.debug("🌐 Account UUID: "+e.account_uuid);const t=await this.send("POST","/v3/auth",e),r=await this.decrypt(await t.json());return this.logger.debug("✅ Scoped token generated successfully"),r}}class Fl{constructor(e){this.gateway=e}async listWallets(e,t){return this.gateway.listWallets(e,t)}async loadFunds(e,t){return this.gateway.loadFunds(e,t)}}class Kl{constructor(e){this.gateway=e}async createPaymentInstrument(e){return this.gateway.createPaymentInstrument(e)}async getPaymentInstrument(e){return this.gateway.getPaymentInstrument(e)}async deletePaymentInstrument(e){return this.gateway.deletePaymentInstrument(e)}async debitFunds(e){return this.gateway.debitFunds(e)}async listCards(e,t){return this.gateway.listCards(e,t)}}class $l{constructor(e){this.gateway=e}async createAccount(e){return this.gateway.createAccount(e)}async getAccount(e){return this.gateway.getAccount(e)}async updateAccount(e,t){return this.gateway.updateAccount(e,t)}async deleteAccount(e){return this.gateway.deleteAccount(e)}async listAccounts(e){return this.gateway.listAccounts(e)}async activateAccount(e){return this.gateway.activateAccount(e)}async deactivateAccount(e){return this.gateway.deactivateAccount(e)}async manageOnboarding(e,t){return this.gateway.manageOnboarding(e,t)}async createAddress(e,t){return this.gateway.createAddress(e,t)}async getAddresses(e,t){return this.gateway.getAddresses(e,t)}async updateAddress(e,t,r){return this.gateway.updateAddress(e,t,r)}async deleteAddress(e,t){return this.gateway.deleteAddress(e,t)}async createDossier(e,t){return this.gateway.createDossier(e,t)}async getDossiers(e,t){return this.gateway.getDossiers(e,t)}async getDossier(e,t){return this.gateway.getDossier(e,t)}async updateDossier(e,t,r){return this.gateway.updateDossier(e,t,r)}async replaceDossier(e,t,r){return this.gateway.replaceDossier(e,t,r)}async deleteDossier(e,t){return this.gateway.deleteDossier(e,t)}}class Hl{constructor(e,t){this.gateway=e,this.logger=t}async processAddCard(e,t){this.logger.debug("PaymentProcessor: Starting add card processing"),this.logger.debug("PaymentProcessor: Request data: "+JSON.stringify(t,null,2));try{const r=await this.gateway.add_card(e,t);return this.logger.debug("PaymentProcessor: Add card processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Add card processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}validateRequest(e){const t=["external_id","pan","exp_year","exp_month","postal_code","security_code"];for(const r of t)if(!e[r])throw new Error(`Missing required field: ${r}`);this.logger.debug("PaymentProcessor: Request validation passed")}async processAddCardWithValidation(e,t){return this.logger.debug("PaymentProcessor: Starting add card processing with validation"),this.validateRequest(t),await this.processAddCard(e,t)}async processAddBankAccount(e,t){this.logger.debug("PaymentProcessor: Starting add bank account processing"),this.logger.debug("PaymentProcessor: Request data: "+JSON.stringify(t,null,2));try{const r=await this.gateway.add_bank_account(e,t);return this.logger.debug("PaymentProcessor: Add bank account processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Add bank account processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}validateBankAccountRequest(e){const t=["external_id","country","currency","bank_account_details"];for(const r of t)if(!e[r])throw new Error(`Missing required field: ${r}`);this.logger.debug("PaymentProcessor: Bank account request validation passed")}async processAddBankAccountWithValidation(e,t){return this.logger.debug("PaymentProcessor: Starting add bank account processing with validation"),this.validateBankAccountRequest(t),await this.processAddBankAccount(e,t)}async processGetBankAccounts(e){this.logger.debug("PaymentProcessor: Starting get bank accounts processing");try{const t=await this.gateway.get_bank_accounts(e);return this.logger.debug("PaymentProcessor: Get bank accounts processing completed successfully"),t}catch(t){throw this.logger.debug("PaymentProcessor: Get bank accounts processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(t)),t}}async processDeleteBankAccount(e,t){this.logger.debug("PaymentProcessor: Starting delete bank account processing");try{const r=await this.gateway.delete_bank_account(e,t);return this.logger.debug("PaymentProcessor: Delete bank account processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Delete bank account processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}}class Gl{constructor(e={}){if(this.authToken="",this.business_uuid="",this.account_uuid="",this.cryptor=null,this.gateways=new Map,this.jwt=e.jwt||"",this.debug=e.debug||!1,this.publicCertificate=e.publicCertificate||"",this.publicCertificateId=e.publicCertificateId||"",this.business_uuid=e.business_uuid||"",this.logger=new Ji(this.debug),this.logger.debug(`🔐 AlviereCore constructor called with config: ${JSON.stringify(e)}`),this.jwt){const t=Ul(this.jwt);e.jwt&&Zi({...t,certificate:{id:this.publicCertificateId,public_key:this.publicCertificate}});const r=Pl(this.jwt);r?(this.account_uuid=r,this.logger.debug(`🔐 Extracted account_uuid from JWT sub field: ${this.account_uuid}`)):this.logger.debug("⚠️ No account_uuid found in JWT sub field"),this.authToken=this.jwt,this.logger.debug("🔐 Using JWT as auth token for API authentication")}e.alviere&&Zi(e.alviere)}configure(e){const t=e.jwt&&e.jwt!==this.jwt;if(e.jwt){this.jwt=e.jwt;const t=Ul(e.jwt);t.domain&&Zi(t);const r=Pl(e.jwt);this.logger.debug(`🔐 Extracted account_uuid from JWT sub field: ${r}`),r?(this.account_uuid=r,this.logger.debug(`🔐 Updated account_uuid from JWT sub field: ${this.account_uuid}`)):this.logger.debug("⚠️ No account_uuid found in new JWT sub field"),this.authToken=this.jwt,this.logger.debug("🔐 Updated JWT as auth token for API authentication")}return void 0!==e.business_uuid&&(this.business_uuid=e.business_uuid,this.logger.debug(`🔐 Updated business_uuid: ${this.business_uuid}`)),"boolean"==typeof e.debug&&e.debug!==this.debug&&(this.debug=e.debug,this.logger=new Ji(this.debug),this.logger.debug("🔐 Debug mode changed to: "+this.debug)),t&&(this.logger.debug("🔐 JWT changed - clearing gateway cache and cryptor"),this.gateways.clear(),this.cryptor=null),e.alviere&&Zi(e.alviere),this}getOrCreateCryptor(){if(!this.cryptor){const e=al();if(!e||""===e.trim())throw new Error('🔐 Cryptor initialization failed: RSA public key not available. Please ensure JWT is configured with a valid RSA key before attempting encryption operations. Call alviereCore.configure({ jwt: "your-jwt-with-rsa-key" }) first.');this.logger.debug("🔐 Creating Cryptor instance with RSA key"),this.cryptor=new nl(this.logger)}return this.cryptor}createPaymentsGateway(){return this.gateways.has("payments")||this.gateways.set("payments",new Vl(this.authToken,this.getOrCreateCryptor(),this.logger)),this.gateways.get("payments")}createPaymentsService(){const e=this.createPaymentsGateway();return new Hl(e,this.logger)}createWalletsService(){return this.gateways.has("wallets")||this.gateways.set("wallets",new Ml(this.authToken,this.getOrCreateCryptor(),this.logger)),new Fl(this.gateways.get("wallets"))}createPaymentInstrumentsService(){return this.gateways.has("paymentInstruments")||this.gateways.set("paymentInstruments",new Ol(this.authToken,this.getOrCreateCryptor(),this.logger)),new Kl(this.gateways.get("paymentInstruments"))}createAccountsService(){return this.gateways.has("accounts")||this.gateways.set("accounts",new jl(this.authToken,this.getOrCreateCryptor(),this.logger)),new $l(this.gateways.get("accounts"))}createAuthGateway(){if(!this.gateways.has("auth")){if(!this.cryptor)throw new Error("Cryptor not initialized. Cannot create AuthGateway.");this.gateways.set("auth",new ql(this.authToken,this.cryptor,this.logger))}return this.gateways.get("auth")}async generateScopedToken(e,t=!0){this.logger.debug(`🔐 Generating scoped token for account: ${e}`),this.logger.debug(`🔐 Auto-update: ${t}`);const r=this.createAuthGateway(),a=await r.generateScopedToken({account_uuid:e});return this.logger.debug("✅ Scoped token generated successfully"),t&&a.access_token&&(this.logger.debug("🔄 Auto-updating SDK with new scoped token"),this.configure({jwt:a.access_token})),a.access_token}getLogger(){return this.logger}getCryptor(){return this.getOrCreateCryptor()}clearCache(){this.gateways.clear()}getAccountUuid(){return this.account_uuid}getBusinessUuid(){return this.business_uuid}isFirstTimeUser(){if(!this.account_uuid||!this.business_uuid)return this.logger.debug("🔐 Cannot determine first-time user status: missing account_uuid or business_uuid"),!1;const e=this.account_uuid===this.business_uuid;return this.logger.debug(`🔐 First-time user check: ${e} (account: ${this.account_uuid}, business: ${this.business_uuid})`),e}isScopedToPayee(){return!(!this.account_uuid||!this.business_uuid)&&this.account_uuid!==this.business_uuid}static createValidator(e=!1){const t=new Ji(e);return new il(t)}static createLogger(e=!1){return new Ji(e)}static createCryptor(e){return new nl(e)}}const Wl=Gl.createValidator();function Yl(e){let t=Tt(null),r=Tt(!1),a=Tt(!1),o=Tt("neutral"),n=Tt("");const i=rt(()=>()=>e.validationState&&"neutral"!==e.validationState?e.validationState:qr(a)?qr(o):"neutral"),l=rt(()=>()=>e.errorMessage?e.errorMessage:qr(n)),s=rt(()=>()=>"valid"===qr(i)()),c=rt(()=>()=>"invalid"===qr(i)()),u=rt(()=>()=>qr(a)&&"neutral"!==qr(i)());function v(t){if(!e.required&&(""===t||null==t))return{isValid:!0,error:null};if(e.required){const r=Wl.required(t,e.label);if(r)return{isValid:!1,error:r}}return e.customValidator?e.customValidator(t):{isValid:!0,error:null}}return{state:{get inputElement(){return qr(t)},set inputElement(e){Bt(t,e,!0)},get isFocused(){return qr(r)},get hasInteracted(){return qr(a)},get validationState(){return qr(i)()},get errorMessage(){return qr(l)()},get isValid(){return qr(s)()},get hasError(){return qr(c)()},get shouldShowValidation(){return qr(u)()},get validationError(){return qr(l)()},get localValue(){return e.value},get isReady(){return null!==qr(t)}},handlers:{handleFocus:function(t){Bt(r,!0),e.onFocus&&e.onFocus(t)},handleBlur:function(t){if(Bt(r,!1),Bt(a,!0),qr(a)){const t=v(e.value);Bt(o,t.isValid?"valid":"invalid",!0),Bt(n,t.error||"",!0)}e.onBlur&&e.onBlur(t)},handleInput:function(t){if(Bt(a,!0),qr(a)){const t=v(e.value);Bt(o,t.isValid?"valid":"invalid",!0),Bt(n,t.error||"",!0)}e.onInput&&e.onInput(t)},handleChange:function(t){e.onChange&&e.onChange(t)}},actions:{markAsInteracted:function(){Bt(a,!0)},resetValidation:function(){Bt(a,!1),Bt(o,"neutral"),Bt(n,"")},forceValidation:function(){Bt(a,!0);const t=v(e.value);return Bt(o,t.isValid?"valid":"invalid",!0),Bt(n,t.error||"",!0),t},validateValue:v},computed:{get effectiveValidationState(){return qr(i)()},get effectiveErrorMessage(){return qr(l)()},get isValid(){return qr(s)()},get hasError(){return qr(c)()},get shouldShowValidation(){return qr(u)()}},metadata:{componentName:e.componentName||"UnknownComponent",componentType:e.componentType||"general",version:"2.0.0"}}}const Ql={email:(e,t)=>Wl.email(e,t),phone:(e,t)=>Wl.phone(e,t),url:(e,t)=>Wl.url(e,t),numeric:(e,t)=>Wl.numeric(e,t),alphabetic:(e,t)=>Wl.alphabetic(e,t),alphanumeric:(e,t)=>Wl.alphanumeric(e,t),pattern:(e,t,r)=>Wl.pattern(e,t,r),minLength:(e,t,r)=>Wl.min_length(e,t,r),maxLength:(e,t,r)=>Wl.max_length(e,t,r),postalCode:(e,t,r)=>Wl.postal_code(e,t,r),creditCardNumber:(e,t)=>Wl.credit_card_number(e,t),creditCardSecCode:(e,t)=>Wl.credit_card_sec_code(e,t),creditCardExpiryDate:(e,t)=>Wl.credit_card_expiry_date(e,t),date:(e,t)=>Wl.date(e,t)},Jl={bubbles:!0,composed:!0,cancelable:!1};class Xl{static dispatch(e,t,r,a=Jl){if(!e||"undefined"==typeof window||!window.customElements)return!1;const o=new CustomEvent(t,{detail:r,bubbles:a.bubbles??Jl.bubbles,composed:a.composed??Jl.composed,cancelable:a.cancelable??Jl.cancelable}),n=this.findWebComponentHost(e);return!!n&&(n.dispatchEvent(o),!0)}static findWebComponentHost(e){const t=e.getRootNode();if(t instanceof ShadowRoot&&t.host)return t.host;let r=e;for(;r&&r.parentElement;)if(r=r.parentElement,r.tagName.includes("-"))return r;return e}static createEventName(e,t){return`${e}-${t}`}}function Zl(e){return{dispatch:(t,r,a)=>Xl.dispatch(e,t,r,a),createEventName:(e,t)=>Xl.createEventName(e,t)}}const es="text-input",ts="text-change",rs="text-focus",as="text-blur",os="card-pan-input",ns="card-pan-change",is="card-pan-focus",ls="card-pan-blur",ss="card-cvv-input",cs="card-cvv-change",us="card-cvv-focus",vs="card-cvv-blur",ds="card-exp-input",ps="card-exp-change",fs="card-exp-focus",hs="card-exp-blur",gs="phone-input",ms="phone-change",bs="phone-focus",ys="phone-blur",_s="search-select-input",ws="search-select-change",Cs="search-select-open",xs="search-select-close",Es="form-success",Ss="form-error",ks="form-submit",As="form-reset",Ts="flow-step-complete",Is="flow-step-error",Bs="flow-complete",Ns="flow-reset",Rs="account",zs="payment-method";const Ls=new class{validate(e){const{value:t,schema:r,fieldName:a}=e,o=[];if(r.required){const e=Wl.required(t,a);if(e){const t="string"==typeof r.required?r.required:e;return o.push(t),{isValid:!1,errors:o,firstError:o[0]}}}if(!t||""===t.trim())return{isValid:!0,errors:[],firstError:void 0};if(r.email){const e=Wl.email(t);if(e){const t="string"==typeof r.email?r.email:e;o.push(t)}}if(r.phone){const e=Wl.phone(t);if(e){const t="string"==typeof r.phone?r.phone:e;o.push(t)}}if(r.url){const e=Wl.url(t);if(e){const t="string"==typeof r.url?r.url:e;o.push(t)}}if(r.numeric){const e=Wl.numeric(t,a);if(e){const t="string"==typeof r.numeric?r.numeric:e;o.push(t)}}if(r.alphabetic){const e=Wl.alphabetic(t,a);if(e){const t="string"==typeof r.alphabetic?r.alphabetic:e;o.push(t)}}if(r.alphanumeric){const e=Wl.alphanumeric(t,a);if(e){const t="string"==typeof r.alphanumeric?r.alphanumeric:e;o.push(t)}}if(r.uuid){const e=Wl.is_valid_uuid(t);if(e){const t="string"==typeof r.uuid?r.uuid:e;o.push(t)}}if(r.pattern){const e=this.validatePattern(t,r.pattern);e&&o.push(e)}if(void 0!==r.minLength){const e=this.validateMinLength(t,r.minLength,a);e&&o.push(e)}if(void 0!==r.maxLength){const e=this.validateMaxLength(t,r.maxLength,a);e&&o.push(e)}if(r.postalCode){const e=this.validatePostalCode(t,r.postalCode);e&&o.push(e)}if(r.date){const e=this.validateDate(t,r.date);e&&o.push(e)}return{isValid:0===o.length,errors:o,firstError:o.length>0?o[0]:void 0}}validatePattern(e,t){return Wl.pattern(e,t.regex,t.message)}validateMinLength(e,t,r){if("number"==typeof t)return Wl.min_length(e,t,r);const a=Wl.min_length(e,t.value,r);return a&&t.message?t.message:a}validateMaxLength(e,t,r){if("number"==typeof t)return Wl.max_length(e,t,r);const a=Wl.max_length(e,t.value,r);return a&&t.message?t.message:a}validatePostalCode(e,t){if("boolean"==typeof t)return Wl.postal_code(e);if("string"==typeof t)return Wl.postal_code(e,t);const r=Wl.postal_code(e,t.country);return r&&t.message?t.message:r}validateDate(e,t){if("boolean"==typeof t)return Wl.date(e);if("string"==typeof t)return t;const r=Wl.date(e,t.format);return r&&t.message?t.message:r}};function Ds(e,t,r){return Ls.validate({value:e,schema:t,fieldName:r})}var Us=ia('<span class="alviere-card-pan-input__required svelte-1k23f9f">*</span>'),Ps=ia('<label class="alviere-card-pan-input__label svelte-1k23f9f"> <!></label>'),Vs=ia('<div class="alviere-card-pan-input__card-icon svelte-1k23f9f"><!></div>'),Ms=ia('<div class="alviere-card-pan-input__error svelte-1k23f9f" role="alert"> </div>'),Os=ia('<div><!> <div><input type="text" inputmode="numeric" class="alviere-card-pan-input__input svelte-1k23f9f" spellcheck="false" maxlength="23"/> <!></div> <!></div>');const js={hash:"svelte-1k23f9f",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-card-pan-input.svelte-1k23f9f {position:relative;width:100%;}.alviere-card-pan-input__label.svelte-1k23f9f {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-card-pan-input__required.svelte-1k23f9f {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-card-pan-input__error.svelte-1k23f9f {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-card-pan-input__wrapper.svelte-1k23f9f {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-card-pan-input__wrapper--focused.svelte-1k23f9f {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-card-pan-input__wrapper--disabled.svelte-1k23f9f {background:#f4f4f5;cursor:not-allowed;}.alviere-card-pan-input__wrapper--readonly.svelte-1k23f9f {background:#f4f4f5;cursor:default;}.alviere-card-pan-input__wrapper--valid.svelte-1k23f9f {border-color:#436b1d;}.alviere-card-pan-input__wrapper--invalid.svelte-1k23f9f {border-color:#b3311f;}.alviere-card-pan-input__input.svelte-1k23f9f {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-card-pan-input__input.svelte-1k23f9f::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-card-pan-input__input.svelte-1k23f9f:disabled {cursor:not-allowed;color:#52525b;}.alviere-card-pan-input__input.svelte-1k23f9f:read-only {cursor:default;color:#3f3f46;}.alviere-card-pan-input__validation-messages.svelte-1k23f9f {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-card-pan-input--sm.svelte-1k23f9f .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f) {min-height:2.5rem;}.alviere-card-pan-input--sm.svelte-1k23f9f .alviere-card-pan-input__input:where(.svelte-1k23f9f) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-card-pan-input--sm.svelte-1k23f9f .alviere-card-pan-input__label:where(.svelte-1k23f9f) {font-size:1rem;}.alviere-card-pan-input--md.svelte-1k23f9f .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f) {min-height:3.25rem;}.alviere-card-pan-input--md.svelte-1k23f9f .alviere-card-pan-input__input:where(.svelte-1k23f9f) {font-size:1rem;}.alviere-card-pan-input--lg.svelte-1k23f9f .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f) {min-height:3.75rem;}.alviere-card-pan-input--lg.svelte-1k23f9f .alviere-card-pan-input__input:where(.svelte-1k23f9f) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-card-pan-input--lg.svelte-1k23f9f .alviere-card-pan-input__label:where(.svelte-1k23f9f) {font-size:1.25rem;}.alviere-card-pan-input.svelte-1k23f9f:focus-within .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-card-pan-input__input.svelte-1k23f9f::placeholder {font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-card-pan-input__card-icon.svelte-1k23f9f {display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin-right:2rem;opacity:0.8;}.alviere-card-pan-input__card-icon.svelte-1k23f9f svg {width:100%;height:100%;fill:currentColor;display:block;}'};function qs(e,t){je(t,!0),Oa(e,js);let r=zo(t,"value",15,""),a=zo(t,"label",15,"Card Number"),o=zo(t,"placeholder",15,"Card number"),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"autocomplete",15,"cc-number"),d=zo(t,"validationState",15,"neutral"),p=zo(t,"errorMessage",15,""),f=zo(t,"helpText",15,""),h=zo(t,"validationSchema",31,()=>Dt({}));const g=Yl({value:r(),required:i(),disabled:n(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardPanInput",componentType:"card",customValidator:e=>{const t=e.replace(/\s/g,""),r=Ql.creditCardNumber(t);if(r)return{isValid:!1,error:r};const o=Ds(t,h(),a());return{isValid:o.isValid,error:o.firstError}}}),m=[{name:"Visa",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Visa</title><path d="M9.112 8.262L5.97 15.758H3.92L2.374 9.775c-.094-.368-.175-.503-.461-.658C1.447 8.864.677 8.627 0 8.479l.046-.217h3.3a.904.904 0 01.894.764l.817 4.338 2.018-5.102zm8.033 5.049c.008-1.979-2.736-2.088-2.717-2.972.006-.269.262-.555.822-.628a3.66 3.66 0 011.913.336l.34-1.59a5.207 5.207 0 00-1.814-.333c-1.917 0-3.266 1.02-3.278 2.479-.012 1.079.963 1.68 1.698 2.04.756.367 1.01.603 1.006.931-.005.504-.602.725-1.16.734-.975.015-1.54-.263-1.992-.473l-.351 1.642c.453.208 1.289.39 2.156.398 2.037 0 3.37-1.006 3.377-2.564m5.061 2.447H24l-1.565-7.496h-1.656a.883.883 0 00-.826.55l-2.909 6.946h2.036l.405-1.12h2.488zm-2.163-2.656l1.02-2.815.588 2.815zm-8.16-4.84l-1.603 7.496H8.34l1.605-7.496z"/></svg>',pattern:/^4/,gaps:[4,8,12],lengths:[16,18,19],code:"visa"},{name:"Mastercard",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>MasterCard</title><path d="M11.343 18.031c.058.049.12.098.181.146-1.177.783-2.59 1.238-4.107 1.238C3.32 19.416 0 16.096 0 12c0-4.095 3.32-7.416 7.416-7.416 1.518 0 2.931.456 4.105 1.238-.06.051-.12.098-.165.15C9.6 7.489 8.595 9.688 8.595 12c0 2.311 1.001 4.51 2.748 6.031zm5.241-13.447c-1.52 0-2.931.456-4.105 1.238.06.051.12.098.165.15C14.4 7.489 15.405 9.688 15.405 12c0 2.31-1.001 4.507-2.748 6.031-.058.049-.12.098-.181.146 1.177.783 2.588 1.238 4.107 1.238C20.68 19.416 24 16.096 24 12c0-4.094-3.32-7.416-7.416-7.416zM12 6.174c-.096.075-.189.15-.28.231C10.156 7.764 9.169 9.765 9.169 12c0 2.236.987 4.236 2.551 5.595.09.08.185.158.28.232.096-.074.189-.152.28-.232 1.563-1.359 2.551-3.359 2.551-5.595 0-2.235-.987-4.236-2.551-5.595-.09-.08-.184-.156-.28-.231z"/></svg>',pattern:/^5[1-5]|^2[2-7]/,gaps:[4,8,12],lengths:[16],code:"mastercard"},{name:"American Express",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>American Express</title><path d="M16.015 14.378c0-.32-.135-.496-.344-.622-.21-.12-.464-.135-.81-.135h-1.543v2.82h.675v-1.027h.72c.24 0 .39.024.478.125.12.13.104.38.104.55v.35h.66v-.555c-.002-.25-.017-.376-.108-.516-.06-.08-.18-.18-.33-.234l.02-.008c.18-.072.48-.297.48-.747zm-.87.407l-.028-.002c-.09.053-.195.058-.33.058h-.81v-.63h.824c.12 0 .24 0 .33.05.098.048.156.147.15.255 0 .12-.045.215-.134.27zM20.297 15.837H19v.6h1.304c.676 0 1.05-.278 1.05-.884 0-.28-.066-.448-.187-.582-.153-.133-.392-.193-.73-.207l-.376-.015c-.104 0-.18 0-.255-.03-.09-.03-.15-.105-.15-.21 0-.09.017-.166.09-.21.083-.046.177-.066.272-.06h1.23v-.602h-1.35c-.704 0-.958.437-.958.84 0 .9.776.855 1.407.87.104 0 .18.015.225.06.046.03.082.106.082.18 0 .077-.035.15-.08.18-.06.053-.15.07-.277.07zM0 0v10.096L.81 8.22h1.75l.225.464V8.22h2.043l.45 1.02.437-1.013h6.502c.295 0 .56.057.756.236v-.23h1.787v.23c.307-.17.686-.23 1.12-.23h2.606l.24.466v-.466h1.918l.254.465v-.466h1.858v3.948H20.87l-.36-.6v.585h-2.353l-.256-.63h-.583l-.27.614h-1.213c-.48 0-.84-.104-1.08-.24v.24h-2.89v-.884c0-.12-.03-.12-.105-.135h-.105v1.036H6.067v-.48l-.21.48H4.69l-.202-.48v.465H2.235l-.256-.624H1.4l-.256.624H0V24h23.786v-7.108c-.27.135-.613.18-.973.18H21.09v-.255c-.21.165-.57.255-.914.255H14.71v-.9c0-.12-.018-.12-.12-.12h-.075v1.022h-1.8v-1.066c-.298.136-.643.15-.928.136h-.214v.915h-2.18l-.54-.617-.57.6H4.742v-3.93h3.61l.518.602.554-.6h2.412c.28 0 .74.03.942.225v-.24h2.177c.202 0 .644.045.903.225v-.24h3.265v.24c.163-.164.508-.24.803-.24h1.89v.24c.194-.15.464-.24.84-.24h1.176V0H0zM21.156 14.955c.004.005.006.012.01.016.01.01.024.01.032.02l-.042-.035zM23.828 13.082h.065v.555h-.065zM23.865 15.03v-.005c-.03-.025-.046-.048-.075-.07-.15-.153-.39-.215-.764-.225l-.36-.012c-.12 0-.194-.007-.27-.03-.09-.03-.15-.105-.15-.21 0-.09.03-.16.09-.204.076-.045.15-.05.27-.05h1.223v-.588h-1.283c-.69 0-.96.437-.96.84 0 .9.78.855 1.41.87.104 0 .18.015.224.06.046.03.076.106.076.18 0 .07-.034.138-.09.18-.045.056-.136.07-.27.07h-1.288v.605h1.287c.42 0 .734-.118.9-.36h.03c.09-.134.135-.3.135-.523 0-.24-.045-.39-.135-.526zM18.597 14.208v-.583h-2.235V16.458h2.235v-.585h-1.57v-.57h1.533v-.584h-1.532v-.51M13.51 8.787h.685V11.6h-.684zM13.126 9.543l-.007.006c0-.314-.13-.5-.34-.624-.217-.125-.47-.135-.81-.135H10.43v2.82h.674v-1.034h.72c.24 0 .39.03.487.12.122.136.107.378.107.548v.354h.677v-.553c0-.25-.016-.375-.11-.516-.09-.107-.202-.19-.33-.237.172-.07.472-.3.472-.75zm-.855.396h-.015c-.09.054-.195.056-.33.056H11.1v-.623h.825c.12 0 .24.004.33.05.09.04.15.128.15.25s-.047.22-.134.266zM15.92 9.373h.632v-.6h-.644c-.464 0-.804.105-1.02.33-.286.3-.362.69-.362 1.11 0 .512.123.833.36 1.074.232.238.645.31.97.31h.78l.255-.627h1.39l.262.627h1.36v-2.11l1.272 2.11h.95l.002.002V8.786h-.684v1.963l-1.18-1.96h-1.02V11.4L18.11 8.744h-1.004l-.943 2.22h-.3c-.177 0-.362-.03-.468-.134-.125-.15-.186-.36-.186-.662 0-.285.08-.51.194-.63.133-.135.272-.165.516-.165zm1.668-.108l.464 1.118v.002h-.93l.466-1.12zM2.38 10.97l.254.628H4V9.393l.972 2.205h.584l.973-2.202.015 2.202h.69v-2.81H6.118l-.807 1.904-.876-1.905H3.343v2.663L2.205 8.787h-.997L.01 11.597h.72l.26-.626h1.39zm-.688-1.705l.46 1.118-.003.002h-.915l.457-1.12zM11.856 13.62H9.714l-.85.923-.825-.922H5.346v2.82H8l.855-.932.824.93h1.302v-.94h.838c.6 0 1.17-.164 1.17-.945l-.006-.003c0-.78-.598-.93-1.128-.93zM7.67 15.853l-.014-.002H6.02v-.557h1.47v-.574H6.02v-.51H7.7l.733.82-.764.824zm2.642.33l-1.03-1.147 1.03-1.108v2.253zm1.553-1.258h-.885v-.717h.885c.24 0 .42.098.42.344 0 .243-.15.372-.42.372zM9.967 9.373v-.586H7.73V11.6h2.237v-.58H8.4v-.564h1.527V9.88H8.4v-.507"/></svg>',pattern:/^3[47]/,gaps:[4,10],lengths:[15],code:"amex"},{name:"Discover",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discover</title><path d="M14.58 12a2.023 2.023 0 1 1-2.025-2.023h.002c1.118 0 2.023.906 2.023 2.023zm-5.2-2.001c-1.124 0-2.025.884-2.025 1.99 0 1.118.878 1.984 2.007 1.984.319 0 .593-.063.93-.221v-.873c-.296.297-.559.416-.895.416-.747 0-1.277-.542-1.277-1.312 0-.73.547-1.306 1.243-1.306.354 0 .622.126.93.428v-.873a1.898 1.898 0 0 0-.913-.233zm-3.352 1.545c-.445-.165-.576-.273-.576-.479 0-.239.233-.422.553-.422.222 0 .405.091.598.308l.388-.508a1.665 1.665 0 0 0-1.117-.422c-.673 0-1.186.467-1.186 1.089 0 .524.239.792.936 1.043.291.103.438.171.513.217a.456.456 0 0 1 .222.394c0 .308-.245.536-.576.536-.354 0-.639-.177-.809-.507l-.479.461c.342.502.752.724 1.317.724.771 0 1.311-.513 1.311-1.249-.002-.603-.252-.876-1.095-1.185zM24 10.3a.29.29 0 0 1-.288.291.29.29 0 0 1-.291-.291v-.003A.29.29 0 1 1 24 10.3zm-.059.001a.235.235 0 0 0-.231-.239.234.234 0 0 0-.232.239c0 .132.104.239.232.239a.235.235 0 0 0 .231-.239zM3.472 13.887h.742v-3.803h-.742v3.803zm12.702-1.248l-1.014-2.554h-.81l1.614 3.9h.399l1.643-3.9h-.804l-1.028 2.554zm2.166 1.248h2.104v-.644h-1.362v-1.027h1.312v-.644h-1.312v-.844h1.362v-.644H18.34v3.803zm5.409-3.557l.11.138h-.097l-.094-.13v.13h-.08v-.334h.107c.081 0 .126.036.126.103.001.046-.025.08-.072.093zm-.006-.092c0-.029-.021-.043-.06-.043h-.014v.087h.014c.039 0 .06-.014.06-.044zm-1.228 2.047l1.197 1.602H22.8l-1.027-1.528h-.097v1.528h-.741v-3.803h1.1c.855 0 1.346.411 1.346 1.123 0 .583-.308.965-.866 1.078zm.103-1.038c0-.37-.251-.563-.713-.563h-.228v1.152h.217c.473-.001.724-.207.724-.589zm-19.487.742a1.91 1.91 0 0 1-.69 1.46c-.365.303-.781.439-1.357.439H.001v-3.803H1.09c1.202 0 2.041.781 2.041 1.904zm-.764-.006c0-.364-.154-.718-.411-.947-.245-.222-.536-.308-1.015-.308H.742v2.515h.199c.479 0 .782-.092 1.015-.302.256-.228.411-.593.411-.958z"/></svg>',pattern:/^6(?:011|5)/,gaps:[4,8,12],lengths:[16],code:"discover"},{name:"Diners Club",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Diners Club</title><path d="M16.506 11.982a6.026 6.026 0 0 0-3.866-5.618V17.6a6.025 6.025 0 0 0 3.866-5.618zM8.33 17.598V6.365a6.03 6.03 0 0 0-3.863 5.617 6.028 6.028 0 0 0 3.863 5.616zm2.156-15.113A9.497 9.497 0 0 0 .99 11.982a9.495 9.495 0 0 0 9.495 9.494c5.245 0 9.495-4.25 9.496-9.494a9.499 9.499 0 0 0-9.496-9.497Zm-.023 19.888C4.723 22.4 0 17.75 0 12.09 0 5.905 4.723 1.626 10.463 1.627h2.69C18.822 1.627 24 5.903 24 12.09c0 5.658-5.176 10.283-10.848 10.283"/></svg>',pattern:/^3[0689]/,gaps:[4,10],lengths:[14],code:"diners"},{name:"JCB",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>JCB</title><path d="M13.05 9.8643c.9723.0736 1.7257.3671 2.3545.6843v-1.31s-1.2577-.3162-2.4408-.368c-4.1256-.1849-5.295 1.4344-5.295 3.1292 0 1.6947 1.1694 3.3145 5.295 3.1296 1.1831-.0536 2.4408-.3694 2.4408-.3694v-1.3086c-.6193.3081-1.3826.6107-2.3545.683-1.6793.1272-2.6898-.6907-2.6898-2.1342 0-1.4448 1.0105-2.2613 2.6898-2.1354m7.685 4.1223c-.0513.0105-.1581.02-.215.02h-1.8005V12.376H20.52c.0568 0 .1636.01.2149.02a.8056.8056 0 01.6325.7951c0 .4162-.2872.721-.6325.796zm-2.0155-4.0374h1.6325c.059 0 .1454.0077.1772.0137.3376.0572.6256.3307.6256.7392 0 .409-.288.6815-.626.7392a1.571 1.571 0 01-.1773.0137h-1.6311V9.9506zm3.4994 1.9856v-.0364c.9133-.1331 1.4149-.726 1.4149-1.4199 0-.8828-.7343-1.3916-1.7293-1.4416-.0772-.0032-.203-.011-.3044-.011h-5.3323v5.9467h5.7548c1.13 0 1.9774-.6043 1.9774-1.5466 0-.8701-.7724-1.4222-1.781-1.4917zm-17.8644.6788c0 .8787-.5906 1.5311-1.6656 1.5311-.917 0-1.8174-.2726-2.6889-.6938V14.76s1.4021.383 3.191.383c2.9714 0 3.8374-1.125 3.8374-2.529V9.0266H4.3541v3.5876Z"/></svg>',pattern:/^35/,gaps:[4,8,12],lengths:[16],code:"jcb"}];let b=Tt(null),y=rt(()=>Zl(g.state.inputElement));function _(){return{value:qr(w),rawValue:qr(w),isValid:g.state.isValid,validationState:g.state.validationState,errorMessage:g.state.errorMessage,hasInteracted:g.state.hasInteracted,cardType:qr(b),formattedValue:qr(C)}}const w=rt(()=>r().replace(/\s/g,"")),C=rt(()=>function(e){const t=e.replace(/\D/g,""),r=x(t);if(!r)return t.replace(/(\d{4})/g,"$1 ").trim();let a="",o=0;for(const n of r.gaps)o<t.length&&(a+=t.slice(o,n)+" ",o=n);o<t.length&&(a+=t.slice(o));return a.trim()}(qr(w)));function x(e){for(const t of m)if(t.pattern.test(e))return t;return null}Zt(()=>{Bt(b,x(qr(w)),!0)});var E=Os(),S=Ht(E),k=e=>{var t=Ps(),r=Ht(t),o=Wt(r),n=e=>{va(e,Us())};Ba(o,e=>{i()&&e(n)}),Re(t),ar(()=>{lo(t,"for",c()),Ca(r,`${a()??""} `)}),va(e,t)};Ba(S,e=>{a()&&e(k)});var A=Wt(S,2);let T;var I=Ht(A);ao(I),I.__input=function(e){const t=e.target.value.replace(/\D/g,""),a=(null===qr(b)||void 0===qr(b)?void 0:qr(b).lengths[0])||19,o=t.slice(0,a);r(o),g.handlers.handleInput(e),qr(y).dispatch(os,_())},I.__change=function(e){g.handlers.handleChange(e),qr(y).dispatch(ns,_())},ko(I,e=>g.state.inputElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.inputElement});var B=Wt(I,2),N=e=>{var t=Vs();Pa(Ht(t),()=>qr(b).icon),Re(t),ar(()=>lo(t,"title",qr(b).name)),va(e,t)};Ba(B,e=>{qr(b)&&e(N)}),Re(A);var R=Wt(A,2),z=e=>{var t=Ms(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"id",`${c()??""}-error`),Ca(r,g.computed.effectiveErrorMessage)}),va(e,t)};return Ba(R,e=>{g.computed.hasError&&e(z)}),Re(E),ar(e=>{Ga(E,1,`alviere-card-pan-input alviere-card-pan-input--${s()??""}`,"svelte-1k23f9f"),T=Ga(A,1,"alviere-card-pan-input__wrapper svelte-1k23f9f",null,T,e),lo(I,"id",c()),lo(I,"name",u()),lo(I,"placeholder",o()),I.disabled=n(),I.required=i(),I.readOnly=l(),lo(I,"autocomplete",v()),oo(I,qr(C)),lo(I,"aria-describedby",g.computed.hasError?`${c()}-error`:void 0)},[()=>({"alviere-card-pan-input__wrapper--focused":g.state.isFocused,"alviere-card-pan-input__wrapper--disabled":n(),"alviere-card-pan-input__wrapper--valid":"valid"===g.computed.effectiveValidationState,"alviere-card-pan-input__wrapper--invalid":"invalid"===g.computed.effectiveValidationState})]),ta("focus",I,function(e){g.handlers.handleFocus(e),qr(y).dispatch(is,_())}),ta("blur",I,function(e){g.handlers.handleBlur(e),qr(y).dispatch(ls,_())}),va(e,E),qe({focus:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.blur()},isValid:function(){return g.state.isValid},getValidationError:function(){return g.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),g.state.inputElement&&(g.state.inputElement.value="")},select:function(){const e=g.state.inputElement;e&&"select"in e&&e.select()},setSelectionRange:function(e,t){const r=g.state.inputElement;r&&"setSelectionRange"in r&&r.setSelectionRange(e,t)},getCardType:function(){return qr(b)},getComponentMetadata:function(){return{name:"CardPanInput",type:"card",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getCardType"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Card Number"){a(e),wt()},get placeholder(){return o()},set placeholder(e="Card number"){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="cc-number"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()}})}function Fs(e,t,r){qr(t).dispatch(cs,r())}ra(["input","change"]),customElements.define("alviere-card-pan-input",Uo(qs,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getCardType","getComponentMetadata"],!0));var Ks=ia('<span class="alviere-cvv-input__required svelte-1tfzsip">*</span>'),$s=ia('<label class="alviere-cvv-input__label svelte-1tfzsip"> <!></label>'),Hs=ia('<div class="alviere-cvv-input__code-type svelte-1tfzsip"> </div>'),Gs=ia('<div class="alviere-cvv-input__error svelte-1tfzsip" role="alert"> </div>'),Ws=ia('<div><!> <div><input type="text" inputmode="numeric" class="alviere-cvv-input__input svelte-1tfzsip" spellcheck="false"/> <!></div> <!></div>');const Ys={hash:"svelte-1tfzsip",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-cvv-input.svelte-1tfzsip {position:relative;width:100%;}.alviere-cvv-input__label.svelte-1tfzsip {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-cvv-input__required.svelte-1tfzsip {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-cvv-input__error.svelte-1tfzsip {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-cvv-input__wrapper.svelte-1tfzsip {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-cvv-input__wrapper--focused.svelte-1tfzsip {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-cvv-input__wrapper--disabled.svelte-1tfzsip {background:#f4f4f5;cursor:not-allowed;}.alviere-cvv-input__wrapper--readonly.svelte-1tfzsip {background:#f4f4f5;cursor:default;}.alviere-cvv-input__wrapper--valid.svelte-1tfzsip {border-color:#436b1d;}.alviere-cvv-input__wrapper--invalid.svelte-1tfzsip {border-color:#b3311f;}.alviere-cvv-input__input.svelte-1tfzsip {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-cvv-input__input.svelte-1tfzsip::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-cvv-input__input.svelte-1tfzsip:disabled {cursor:not-allowed;color:#52525b;}.alviere-cvv-input__input.svelte-1tfzsip:read-only {cursor:default;color:#3f3f46;}.alviere-cvv-input__validation-messages.svelte-1tfzsip {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__wrapper:where(.svelte-1tfzsip) {min-height:2.5rem;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__label:where(.svelte-1tfzsip) {font-size:1rem;}.alviere-cvv-input--md.svelte-1tfzsip .alviere-cvv-input__wrapper:where(.svelte-1tfzsip) {min-height:3.25rem;}.alviere-cvv-input--md.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {font-size:1rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__wrapper:where(.svelte-1tfzsip) {min-height:3.75rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__label:where(.svelte-1tfzsip) {font-size:1.25rem;}.alviere-cvv-input.svelte-1tfzsip:focus-within .alviere-cvv-input__wrapper:where(.svelte-1tfzsip):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-cvv-input__input.svelte-1tfzsip {text-align:center;letter-spacing:0.125em;}.alviere-cvv-input__input.svelte-1tfzsip::placeholder {letter-spacing:0.125em;}.alviere-cvv-input__code-type.svelte-1tfzsip {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__code-type:where(.svelte-1tfzsip) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__code-type:where(.svelte-1tfzsip) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-cvv-input.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {user-select:none;}'};function Qs(e,t){je(t,!0),Oa(e,Ys);let r=zo(t,"value",15,""),a=zo(t,"label",15,"Security Code"),o=zo(t,"placeholder",15,"123"),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"autocomplete",15,"cc-csc"),d=zo(t,"validationState",15,"neutral"),p=zo(t,"errorMessage",15,""),f=zo(t,"helpText",15,""),h=zo(t,"validationSchema",31,()=>Dt({})),g=zo(t,"cardType",15,"");const m=Yl({value:r(),required:i(),disabled:n(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardCVVInput",componentType:"cvv",customValidator:e=>{const t=Ql.cvv(e,g());if(t)return{isValid:!1,error:t};const r=Ds(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let b=Tt(""),y=rt(()=>Zl(m.state.inputElement));function _(){return{value:qr(b),rawValue:qr(b),isValid:m.state.isValid,validationState:m.state.validationState,errorMessage:m.state.errorMessage,hasInteracted:m.state.hasInteracted,cardType:g()?{name:g(),icon:"",pattern:/.*/,gaps:[],lengths:[],code:g().toLowerCase()}:null,expectedLength:qr(C)().max}}let w=rt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":return 4;default:return 3}}),C=rt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":return{min:4,max:4};default:return{min:3,max:3}}}),x=rt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":case"discover":return"CID";case"mastercard":return"CVC";default:return"CVV"}});Zt(()=>{if(g()){const e=qr(C)();o("1".repeat(e.max)),qr(b)&&(isValidState=validateCvv(qr(b)))}});var E=Ws(),S=Ht(E),k=e=>{var t=$s(),r=Ht(t),o=Wt(r),n=e=>{va(e,Ks())};Ba(o,e=>{i()&&e(n)}),Re(t),ar(()=>{lo(t,"for",c()),Ca(r,`${a()??""} `)}),va(e,t)};Ba(S,e=>{a()&&e(k)});var A=Wt(S,2);let T;var I=Ht(A);ao(I),I.__input=function(e){const t=e.target,a=t.value;m.actions.markAsInteracted();const o=a.replace(/\D/g,"").slice(0,qr(w)());Bt(b,o,!0),r(o),t.value=o,isValidState=validateCvv(o),qr(y).dispatch(ss,_())},I.__change=[Fs,y,_],ko(I,e=>m.state.inputElement=e,()=>{var e;return null==(e=null==m?void 0:m.state)?void 0:e.inputElement});var B=Wt(I,2),N=e=>{var t=Hs(),r=Ht(t,!0);Re(t),ar((e,a)=>{lo(t,"title",`${e??""} for ${g()??""}`),Ca(r,a)},[()=>qr(x)(),()=>qr(x)()]),va(e,t)};Ba(B,e=>{"CVV"!==qr(x)()&&e(N)}),Re(A);var R=Wt(A,2),z=e=>{var t=Gs(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"id",`${c()??""}-error`),Ca(r,m.computed.effectiveErrorMessage)}),va(e,t)};return Ba(R,e=>{m.computed.hasError&&e(z)}),Re(E),ar((e,t,a)=>{Ga(E,1,`alviere-cvv-input alviere-cvv-input--${s()??""}`,"svelte-1tfzsip"),T=Ga(A,1,"alviere-cvv-input__wrapper svelte-1tfzsip",null,T,e),lo(I,"id",c()),lo(I,"name",u()),lo(I,"placeholder",o()),I.disabled=n(),I.required=i(),I.readOnly=l(),lo(I,"autocomplete",v()),oo(I,r()),lo(I,"maxlength",t),lo(I,"aria-describedby",m.computed.hasError?`${c()}-error`:void 0),lo(I,"aria-label",`${a??""} security code`)},[()=>({"alviere-cvv-input__wrapper--focused":m.state.isFocused,"alviere-cvv-input__wrapper--disabled":n(),"alviere-cvv-input__wrapper--valid":"valid"===m.computed.effectiveValidationState,"alviere-cvv-input__wrapper--invalid":"invalid"===m.computed.effectiveValidationState}),()=>qr(w)(),()=>qr(x)()]),ta("focus",I,function(){m.handlers.handleFocus(),qr(y).dispatch(us,_())}),ta("blur",I,function(){m.handlers.handleBlur(),qr(y).dispatch(vs,_())}),va(e,E),qe({focus:function(){var e;null===(e=m.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=m.state.inputElement)||void 0===e||e.blur()},isValid:function(){return m.state.isValid},getValidationError:function(){return m.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),Bt(b,""),isValidState=!1,m.state.inputElement&&(m.state.inputElement.value="")},select:function(){m.state.inputElement&&"select"in m.state.inputElement&&m.state.inputElement.select()},setSelectionRange:function(e,t){m.state.inputElement&&"setSelectionRange"in m.state.inputElement&&m.state.inputElement.setSelectionRange(e,t)},getExpectedLength:function(){return qr(C)()},isValidCvv:function(){return isValidState},getComponentMetadata:function(){return{name:"CardCVVInput",type:"cvv",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getExpectedLength","isValidCvv"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Security Code"){a(e),wt()},get placeholder(){return o()},set placeholder(e="123"){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="cc-csc"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get cardType(){return g()},set cardType(e=""){g(e),wt()}})}function Js(e,t,r){qr(t).dispatch(ps,r())}ra(["input","change"]),customElements.define("alviere-card-cvv-input",Uo(Qs,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},cardType:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getExpectedLength","isValidCvv","getComponentMetadata"],!0));var Xs=ia('<span class="alviere-exp-input__required svelte-1ffesfg">*</span>'),Zs=ia('<label class="alviere-exp-input__label svelte-1ffesfg"> <!></label>'),ec=ia('<div class="alviere-exp-input__error svelte-1ffesfg" role="alert"> </div>'),tc=ia('<div><!> <div><input type="text" inputmode="numeric" maxlength="5" class="alviere-exp-input__input svelte-1ffesfg" spellcheck="false" aria-label="Card expiry date (MM/YY format)"/> <div class="alviere-exp-input__format-hint svelte-1ffesfg" title="MM/YY format">MM/YY</div></div> <!></div>');const rc={hash:"svelte-1ffesfg",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-exp-input.svelte-1ffesfg {position:relative;width:100%;}.alviere-exp-input__label.svelte-1ffesfg {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-exp-input__required.svelte-1ffesfg {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-exp-input__error.svelte-1ffesfg {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-exp-input__wrapper.svelte-1ffesfg {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-exp-input__wrapper--focused.svelte-1ffesfg {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-exp-input__wrapper--disabled.svelte-1ffesfg {background:#f4f4f5;cursor:not-allowed;}.alviere-exp-input__wrapper--readonly.svelte-1ffesfg {background:#f4f4f5;cursor:default;}.alviere-exp-input__wrapper--valid.svelte-1ffesfg {border-color:#436b1d;}.alviere-exp-input__wrapper--invalid.svelte-1ffesfg {border-color:#b3311f;}.alviere-exp-input__input.svelte-1ffesfg {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-exp-input__input.svelte-1ffesfg::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-exp-input__input.svelte-1ffesfg:disabled {cursor:not-allowed;color:#52525b;}.alviere-exp-input__input.svelte-1ffesfg:read-only {cursor:default;color:#3f3f46;}.alviere-exp-input__validation-messages.svelte-1ffesfg {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__wrapper:where(.svelte-1ffesfg) {min-height:2.5rem;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__input:where(.svelte-1ffesfg) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__label:where(.svelte-1ffesfg) {font-size:1rem;}.alviere-exp-input--md.svelte-1ffesfg .alviere-exp-input__wrapper:where(.svelte-1ffesfg) {min-height:3.25rem;}.alviere-exp-input--md.svelte-1ffesfg .alviere-exp-input__input:where(.svelte-1ffesfg) {font-size:1rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__wrapper:where(.svelte-1ffesfg) {min-height:3.75rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__input:where(.svelte-1ffesfg) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__label:where(.svelte-1ffesfg) {font-size:1.25rem;}.alviere-exp-input.svelte-1ffesfg:focus-within .alviere-exp-input__wrapper:where(.svelte-1ffesfg):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-exp-input__input.svelte-1ffesfg {text-align:center;letter-spacing:0.1em;min-width:4rem;}.alviere-exp-input__input.svelte-1ffesfg::placeholder {letter-spacing:0.1em;opacity:0.7;}.alviere-exp-input__format-hint.svelte-1ffesfg {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;color:#52525b;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;letter-spacing:0.05em;opacity:0.8;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__format-hint:where(.svelte-1ffesfg) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__format-hint:where(.svelte-1ffesfg) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-exp-input__wrapper--focused.svelte-1ffesfg .alviere-exp-input__format-hint:where(.svelte-1ffesfg) {opacity:0.5;transform:scale(0.9);transition:opacity 150ms ease-in-out, transform 150ms ease-in-out;}.alviere-exp-input__validation-icon.svelte-1ffesfg {\n animation: svelte-1ffesfg-fadeIn 0.2s ease-in-out;}\n@keyframes svelte-1ffesfg-fadeIn {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}'};function ac(e,t){je(t,!0),Oa(e,rc);let r=zo(t,"value",15,""),a=zo(t,"label",15,"Expiry Date"),o=zo(t,"placeholder",15,"MM/YY"),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"autocomplete",15,"cc-exp"),d=zo(t,"validationState",15,"neutral"),p=zo(t,"errorMessage",15,""),f=zo(t,"helpText",15,""),h=zo(t,"validationSchema",31,()=>Dt({}));const g=Yl({value:r(),required:i(),disabled:n(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardExpInput",componentType:"expiry",customValidator:e=>{const t=Ql.creditCardExpiry(e);if(t)return{isValid:!1,error:t};const r=Ds(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let m=Tt(""),b=rt(()=>Zl(g.state.inputElement));function y(){return{value:r(),rawValue:qr(m),isValid:g.state.isValid,validationState:g.state.validationState,errorMessage:g.state.errorMessage,hasInteracted:g.state.hasInteracted,month:qr(_)(),year:qr(w)(),formattedValue:r()}}let _=rt(()=>()=>{const e=qr(m).replace(/\D/g,"");return e.length>=2?e.slice(0,2):""}),w=rt(()=>()=>{const e=qr(m).replace(/\D/g,"");return e.length>=3?e.slice(2,4):""});function C(e,t){setTimeout(()=>{e.setSelectionRange(t,t)},0)}var x=tc(),E=Ht(x),S=e=>{var t=Zs(),r=Ht(t),o=Wt(r),n=e=>{va(e,Xs())};Ba(o,e=>{i()&&e(n)}),Re(t),ar(()=>{lo(t,"for",c()),Ca(r,`${a()??""} `)}),va(e,t)};Ba(E,e=>{a()&&e(S)});var k=Wt(E,2);let A;var T=Ht(k);ao(T),T.__input=function(e){const t=e.target,a=t.value,o=t.selectionStart||0;g.actions.markAsInteracted();const n=function(e){const t=e.replace(/\D/g,"");return 0===t.length?"":t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}`}(a),i=a.replace(/\D/g,"");Bt(m,i,!0),r(n),t.value=n;let l=o;3===i.length&&4===n.length&&3===o&&(l=4),i.length>=3&&2===o&&n.includes("/")&&(l=4),C(t,Math.min(l,n.length)),isValidState=validateExpiry(n),qr(b).dispatch(ds,y())},T.__keydown=function(e){const t=e.target,a=t.selectionStart||0,o=t.value;if("Backspace"===e.key&&3===a&&"/"===o[2]){e.preventDefault();const a=o.slice(0,2);return t.value=a,r(a),Bt(m,a.replace(/\D/g,""),!0),C(t,2),void(isValidState=validateExpiry(a))}o.length>=5&&"Backspace"!==e.key&&"Delete"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"Tab"!==e.key&&e.preventDefault()},T.__change=[Js,b,y],ko(T,e=>g.state.inputElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.inputElement}),ze(2),Re(k);var I=Wt(k,2),B=e=>{var t=ec(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"id",`${c()??""}-error`),Ca(r,g.computed.effectiveErrorMessage)}),va(e,t)};return Ba(I,e=>{g.computed.hasError&&e(B)}),Re(x),ar(e=>{Ga(x,1,`alviere-exp-input alviere-exp-input--${s()??""}`,"svelte-1ffesfg"),A=Ga(k,1,"alviere-exp-input__wrapper svelte-1ffesfg",null,A,e),lo(T,"id",c()),lo(T,"name",u()),lo(T,"placeholder",o()),T.disabled=n(),T.required=i(),T.readOnly=l(),lo(T,"autocomplete",v()),oo(T,r()),lo(T,"aria-describedby",g.computed.hasError?`${c()}-error`:void 0)},[()=>({"alviere-exp-input__wrapper--focused":g.state.isFocused,"alviere-exp-input__wrapper--disabled":n(),"alviere-exp-input__wrapper--valid":"valid"===g.computed.effectiveValidationState,"alviere-exp-input__wrapper--invalid":"invalid"===g.computed.effectiveValidationState})]),ta("focus",T,function(){g.handlers.handleFocus(),qr(b).dispatch(fs,y())}),ta("blur",T,function(){g.handlers.handleBlur(),qr(b).dispatch(hs,y())}),va(e,x),qe({focus:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.blur()},isValid:function(){return g.state.isValid},getValidationError:function(){return g.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),Bt(m,""),isValidState=!1,g.state.inputElement&&(g.state.inputElement.value="")},select:function(){g.state.inputElement&&"select"in g.state.inputElement&&g.state.inputElement.select()},setSelectionRange:function(e,t){g.state.inputElement&&"setSelectionRange"in g.state.inputElement&&g.state.inputElement.setSelectionRange(e,t)},getMonth:function(){return qr(_)()},getYear:function(){return qr(w)()},getExpiryDate:function(){return{month:qr(_)(),year:qr(w)()}},isValidExpiry:function(){return isValidState},getComponentMetadata:function(){return{name:"CardExpInput",type:"expiry",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getMonth","getYear","getExpiryDate","isValidExpiry"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Expiry Date"){a(e),wt()},get placeholder(){return o()},set placeholder(e="MM/YY"){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="cc-exp"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()}})}function oc(e,t,r,a={}){const{buttonSelectors:o=[],delay:n=0}=a;return function(e,t,r={}){const{enabled:a=!0,excludeSelectors:o=[],excludeElements:n=[],delay:i=0}=r;Zt(()=>{if(a&&e&&"undefined"!=typeof window){const t=e.getRootNode(),a=[];return document.addEventListener("click",r),a.push({target:document,handler:r}),t&&t!==document&&(t.addEventListener("click",r),a.push({target:t,handler:r})),()=>{a.forEach(({target:e,handler:t})=>{e.removeEventListener("click",t)})}}function r(r){const a=r.target;a&&(a===e||e.contains(a)||o.some(e=>a.closest(e))||n.some(e=>e&&(a===e||e.contains(a)))||(i>0?setTimeout(t,i):t()))}})}(t,r,{enabled:e,excludeElements:[t],excludeSelectors:o,delay:n})}ra(["input","keydown","change"]),customElements.define("alviere-card-exp-input",Uo(ac,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getMonth","getYear","getExpiryDate","isValidExpiry","getComponentMetadata"],!0));const nc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},ic=([e,t,r])=>{const a=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(e=>{a.setAttribute(e,String(t[e]))}),(null==r?void 0:r.length)&&r.forEach(e=>{const t=ic(e);a.appendChild(t)}),a},lc=(e,t={})=>{const r={...nc,...t};return ic(["svg",r,e])},sc=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]],cc=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]],uc=[["path",{d:"M20 6 9 17l-5-5"}]],vc=[["path",{d:"m6 9 6 6 6-6"}]],dc=[["path",{d:"m9 18 6-6-6-6"}]],pc=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]],fc=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]],hc=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]],gc=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var mc=ia('<label class="alviere-text-input__label svelte-g5bopv"> </label>'),bc=ia('<textarea class="alviere-text-input__textarea svelte-g5bopv" spellcheck="true"></textarea>'),yc=ia('<input class="alviere-text-input__input svelte-g5bopv" spellcheck="true"/>'),_c=(e,t)=>{e.stopPropagation(),Bt(t,!qr(t))},wc=sa('<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="m2.707 1.293 7.17 7.17.002.002 1.504 1.504 7.21 7.21-.001-.001 4.115 4.115-1.414 1.414-4.297-4.296C15.485 19.434 13.82 20 12 20c-2.959 0-5.461-1.46-7.51-3.85a16.59 16.59 0 0 1-1.796-2.56 12.546 12.546 0 0 1-.613-1.197L1.91 12l.17-.395c.11-.252.315-.668.618-1.195.5-.872 1.1-1.743 1.803-2.56.3-.349.614-.68.94-.993l-4.15-4.149zM6.856 8.27l-.256.252c-.199.2-.393.411-.581.63a14.7 14.7 0 0 0-1.843 2.718l-.069.13.145.275.179.322c.439.768.966 1.538 1.578 2.252C7.711 16.835 9.71 18 12 18c1.222 0 2.358-.334 3.426-.962l.123-.076-1.517-1.516A4 4 0 0 1 8.553 9.97zM12 4c2.959 0 5.461 1.46 7.51 3.849a16.59 16.59 0 0 1 1.796 2.56l.208.375c.126.234.228.437.306.603l.1.219.169.395-.17.395a12.7 12.7 0 0 1-.548 1.073c-.37.655-.8 1.318-1.292 1.963l-.302.385-1.553-1.26a14.947 14.947 0 0 0 1.404-2.07l.16-.289.104-.201-.144-.273-.178-.322a14.613 14.613 0 0 0-1.58-2.252C16.289 7.165 14.291 6 12.001 6c-.478 0-.942.05-1.395.151l-.337.085-.537-1.927A8.409 8.409 0 0 1 12 4zm-1.933 7.482-.036.166a2 2 0 0 0 2.321 2.321l.164-.038z" fill="currentcolor" fill-rule="evenodd"></path></svg>'),Cc=sa('<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="M12 4c4.278 0 7.61 2.667 10 8-2.39 5.333-5.722 8-10 8s-7.61-2.667-10-8c2.39-5.333 5.722-8 10-8zm0 2c-4.41 0-6.707 4.479-7.699 5.999C5.295 13.518 7.604 18 12 18c4.41 0 6.707-4.479 7.699-5.999C18.705 10.482 16.396 6 12 6zm0 2c2.176 0 3.945 1.794 3.945 4s-1.77 4-3.945 4c-2.176 0-3.945-1.794-3.945-4S9.825 8 12 8zm0 2c-1.088 0-1.973.897-1.973 2s.885 2 1.973 2 1.973-.897 1.973-2-.885-2-1.973-2z" fill="currentcolor" fill-rule="evenodd"></path></svg>'),xc=ia('<button type="button" class="alviere-text-input__reveal-button svelte-g5bopv"><!></button>'),Ec=ia('<div class="alviere-text-input__character-count svelte-g5bopv"> </div>'),Sc=ia('<div class="alviere-text-input__required svelte-g5bopv">Required</div>'),kc=ia('<div class="alviere-text-input__help svelte-g5bopv"><!> </div>'),Ac=ia('<div class="alviere-text-input__error svelte-g5bopv" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Tc=ia('<div><div><!> <!> <!> <!> <!></div> <div class="alviere-text-input__validation-messages svelte-g5bopv"><!> <!></div></div>');const Ic={hash:"svelte-g5bopv",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-text-input.svelte-g5bopv {position:relative;width:100%;}.alviere-text-input__label.svelte-g5bopv {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-text-input__required.svelte-g5bopv {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-text-input__error.svelte-g5bopv {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-text-input__wrapper.svelte-g5bopv {position:relative;display:flex;align-items:flex-start;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-text-input__wrapper--focused.svelte-g5bopv {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-text-input__wrapper--focused.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-text-input__wrapper--focused.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv)::placeholder {opacity:1;}.alviere-text-input__wrapper--dirty.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-text-input__wrapper--disabled.svelte-g5bopv {background:#f4f4f5;cursor:not-allowed;}.alviere-text-input__wrapper--readonly.svelte-g5bopv {background:#f4f4f5;cursor:default;}.alviere-text-input__wrapper--valid.svelte-g5bopv {border-color:#436b1d;}.alviere-text-input__wrapper--invalid.svelte-g5bopv {border-color:#b3311f;}.alviere-text-input__input.svelte-g5bopv {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-text-input__input.svelte-g5bopv::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-text-input__input.svelte-g5bopv:disabled {cursor:not-allowed;color:#52525b;}.alviere-text-input__input.svelte-g5bopv:read-only {cursor:default;color:#3f3f46;}.alviere-text-input__validation-messages.svelte-g5bopv {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__wrapper:where(.svelte-g5bopv) {min-height:2.5rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {font-size:1rem;}.alviere-text-input--md.svelte-g5bopv .alviere-text-input__wrapper:where(.svelte-g5bopv) {min-height:3.25rem;}.alviere-text-input--md.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv) {font-size:1rem;}.alviere-text-input--md.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {font-size:1.25rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__wrapper:where(.svelte-g5bopv) {min-height:3.75rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {font-size:1.25rem;}.alviere-text-input.svelte-g5bopv:focus-within .alviere-text-input__wrapper:where(.svelte-g5bopv):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-text-input__wrapper--textarea.svelte-g5bopv {align-items:stretch;}.alviere-text-input__input.svelte-g5bopv, .alviere-text-input__textarea.svelte-g5bopv {resize:none;}.alviere-text-input__textarea.svelte-g5bopv {min-height:2.5rem;line-height:1.75rem;resize:vertical;}.alviere-text-input__character-count.svelte-g5bopv {position:absolute;bottom:0.25rem;right:0.25rem;font-size:1rem;color:#71717a;background:rgba(255, 255, 255, 0.9);padding:0.125rem 0.25rem;border-radius:0.125rem;pointer-events:none;}.alviere-text-input__help.svelte-g5bopv {margin-top:0.25rem;font-size:0.75rem;color:#71717a;line-height:1.25;display:flex;align-items:flex-start;gap:0.25rem;}.alviere-text-input__help.svelte-g5bopv svg {width:1rem;height:1rem;}.alviere-text-input__wrapper--textarea.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {min-height:3rem;padding-bottom:1.5rem;}.alviere-text-input__wrapper--textarea.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {min-height:2.5rem;}.alviere-text-input__wrapper--textarea.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {min-height:4rem;}.alviere-text-input__character-count.svelte-g5bopv {font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-weight:500;opacity:0.8;transition:opacity 150ms ease-in-out;}.alviere-text-input__wrapper--focused.svelte-g5bopv .alviere-text-input__character-count:where(.svelte-g5bopv) {opacity:1;}.alviere-text-input__wrapper--textarea--valid.svelte-g5bopv::after, .alviere-text-input__wrapper--textarea--invalid.svelte-g5bopv::after {top:0.5rem;transform:none;}.alviere-text-input__reveal-button.svelte-g5bopv {background:transparent;border:none;cursor:pointer;padding:0;margin:0;position:absolute;right:0.5rem;top:50%;transform:translateY(-50%);color:#71717a;}'};function Bc(e,t){je(t,!0),Oa(e,Ic);let r=zo(t,"value",15,""),a=zo(t,"label",15,""),o=zo(t,"placeholder",15,""),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"autocomplete",15,""),d=zo(t,"validationState",15,"neutral"),p=zo(t,"errorMessage",15,""),f=zo(t,"helpText",15,""),h=zo(t,"validationSchema",31,()=>Dt({})),g=zo(t,"sensitive",15,!1),m=zo(t,"maxlength",15,void 0),b=zo(t,"minlength",15,void 0),y=zo(t,"oninput",15),_=zo(t,"onchange",15),w=zo(t,"onfocus",15),C=zo(t,"onblur",15),x=zo(t,"type",15,"text"),E=zo(t,"rows",15,3),S=zo(t,"cols",15,void 0),k=zo(t,"resize",15,"vertical");const A=Yl({get value(){return r()},required:i(),disabled:n(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),get validationSchema(){return h()},componentName:"TextInput",componentType:"text",customValidator:e=>{const t=Ds(e,h(),a());return{isValid:t.isValid,error:t.firstError}}}),T=lc(pc);let I=rt(()=>()=>r().length),B=Tt(!1),R=rt(()=>Zl(A.state.inputElement));function z(){return{value:r(),rawValue:r(),isValid:A.state.isValid,validationState:A.state.validationState,errorMessage:A.state.errorMessage,characterCount:r().length,maxLength:m(),hasInteracted:A.state.hasInteracted}}function L(e){const t=e.target;r(t.value),A.handlers.handleInput(e),qr(R).dispatch(es,z()),y()&&(N.info("TextInput: oninput",e),y()(e))}function D(e){A.handlers.handleChange(e),qr(R).dispatch(ts,z()),_()&&_()(e)}function U(e){A.handlers.handleFocus(e),qr(R).dispatch(rs,z()),w()&&w()(e)}function P(e){A.handlers.handleBlur(e),qr(R).dispatch(as,z()),C()&&C()(e)}Zt(()=>{oc(g()&&qr(B),A.state.inputElement,()=>{Bt(B,!1)},{buttonSelectors:[".alviere-text-input__reveal-button"]})}),Zt(()=>{var e;if("undefined"!=typeof window&&window.customElements){const r=null===(e=A.state.inputElement)||void 0===e?void 0:e.getRootNode(),a=null==r?void 0:r.host;if(a){const e=a.getAttributeNames(),r=a.getAttribute("validation-schema");if(r)try{h(JSON.parse(r))}catch(t){}const o={};e.includes("validate-email")&&(o.email=!0),e.includes("validate-phone")&&(o.phone=!0),e.includes("validate-url")&&(o.url=!0),e.includes("validate-numeric")&&(o.numeric=!0),e.includes("validate-alphabetic")&&(o.alphabetic=!0),e.includes("validate-alphanumeric")&&(o.alphanumeric=!0);const n=a.getAttribute("validate-postal-code");n&&(o.postalCode={country:n});const i=a.getAttribute("validate-pattern");if(i)try{o.pattern={regex:new RegExp(i)}}catch(t){}const l=a.getAttribute("validate-min-length");l&&(o.minLength=parseInt(l,10));const s=a.getAttribute("validate-max-length");if(s&&(o.maxLength=parseInt(s,10)),Object.keys(o).length>0&&0===Object.keys(h()).length&&h(o),e.includes("help-text")&&f(a.getAttribute("help-text")||""),e.includes("error-message")&&p(a.getAttribute("error-message")||""),e.includes("max-length")){const e=a.getAttribute("max-length");e&&m(parseInt(e,10))}if(e.includes("min-length")){const e=a.getAttribute("min-length");e&&b(parseInt(e,10))}}}});var V=Tc(),M=Ht(V);let O;var j=Ht(M),q=e=>{var t=mc(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"for",c()),Ca(r,a())}),va(e,t)};Ba(j,e=>{a()&&e(q)});var F=Wt(j,2),K=e=>{var t,a=bc();t=a,Te&&null!==Kt(t)&&Yt(t),a.__input=L,a.__change=D,ko(a,e=>A.state.inputElement=e,()=>{var e;return null==(e=null==A?void 0:A.state)?void 0:e.inputElement}),ar(()=>{lo(a,"id",c()),lo(a,"name",u()),lo(a,"placeholder",o()),a.disabled=n(),a.readOnly=l(),a.required=i(),lo(a,"rows",E()),lo(a,"cols",S()),lo(a,"maxlength",m()),lo(a,"minlength",b()),lo(a,"autocomplete",v()||null),Ya(a,`resize: ${k()??""}`),lo(a,"aria-invalid","invalid"===A.computed.effectiveValidationState),lo(a,"aria-describedby",A.state.errorMessage?`${c()}-error`:f()?`${c()}-help`:void 0)}),ta("focus",a,U),ta("blur",a,P),Co(a,r),va(e,a)},$=e=>{var t=yc();ao(t),t.__input=L,t.__change=D,ko(t,e=>A.state.inputElement=e,()=>{var e;return null==(e=null==A?void 0:A.state)?void 0:e.inputElement}),ar(()=>{lo(t,"id",c()),lo(t,"name",u()),lo(t,"placeholder",A.state.isFocused?o():""),t.disabled=n(),t.readOnly=l(),t.required=i(),lo(t,"maxlength",m()),lo(t,"minlength",b()),lo(t,"autocomplete",v()||null),lo(t,"type",g()&&!qr(B)?"password":"text"),lo(t,"aria-invalid","invalid"===A.computed.effectiveValidationState),lo(t,"aria-describedby",A.state.errorMessage?`${c()}-error`:f()?`${c()}-help`:void 0)}),ta("focus",t,U),ta("blur",t,P),Co(t,r),va(e,t)};Ba(F,e=>{"textarea"===x()?e(K):e($,!1)});var H=Wt(F,2),G=e=>{var t=xc();t.__click=[_c,B];var r=Ht(t),a=e=>{va(e,wc())},o=e=>{va(e,Cc())};Ba(r,e=>{qr(B)?e(a):e(o,!1)}),Re(t),va(e,t)};Ba(H,e=>{g()&&e(G)});var W=Wt(H,2),Y=e=>{var t=Ec(),r=Ht(t);Re(t),ar(()=>Ca(r,`${qr(I)??""}/${m()??""}`)),va(e,t)};Ba(W,e=>{m()&&"textarea"===x()&&e(Y)});var Q=Wt(W,2),J=e=>{va(e,Sc())};Ba(Q,e=>{i()&&"neutral"===A.computed.effectiveValidationState&&e(J)}),Re(M);var X=Wt(M,2),Z=Ht(X),ee=e=>{var t=kc(),r=Ht(t);Pa(r,()=>T.outerHTML);var a=Wt(r);Re(t),ar(()=>{lo(t,"id",`${c()??""}-help`),Ca(a,` ${f()??""}`)}),va(e,t)};Ba(Z,e=>{f()&&!A.computed.hasError&&e(ee)});var te=Wt(Z,2),re=e=>{var t=Ac(),r=Wt(Ht(t));Re(t),ar(()=>{lo(t,"id",`${c()??""}-error`),Ca(r,` ${A.state.errorMessage??""}`)}),va(e,t)};return Ba(te,e=>{"invalid"===A.state.validationState&&e(re)}),Re(X),Re(V),ar(e=>{Ga(V,1,`alviere-text-input alviere-text-input--${s()??""}`,"svelte-g5bopv"),O=Ga(M,1,"alviere-text-input__wrapper svelte-g5bopv",null,O,e)},[()=>({"alviere-text-input__wrapper--focused":A.state.isFocused,"alviere-text-input__wrapper--disabled":n(),"alviere-text-input__wrapper--readonly":l(),"alviere-text-input__wrapper--valid":"valid"===A.computed.effectiveValidationState,"alviere-text-input__wrapper--invalid":"invalid"===A.computed.effectiveValidationState,"alviere-text-input__wrapper--textarea":"textarea"===x(),"alviere-text-input__wrapper--dirty":""!==r()})]),va(e,V),qe({focus:function(){var e;null===(e=A.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=A.state.inputElement)||void 0===e||e.blur()},isValid:function(){return A.state.isValid},getValidationError:function(){return A.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),A.state.inputElement&&(A.state.inputElement.value="")},select:function(){const e=A.state.inputElement;e&&"select"in e&&e.select()},setSelectionRange:function(e,t){const r=A.state.inputElement;r&&"setSelectionRange"in r&&r.setSelectionRange(e,t)},getComponentMetadata:function(){return{name:"TextInput",type:"text",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!1,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e=""){a(e),wt()},get placeholder(){return o()},set placeholder(e=""){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e=""){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get sensitive(){return g()},set sensitive(e=!1){g(e),wt()},get maxlength(){return m()},set maxlength(e=void 0){m(e),wt()},get minlength(){return b()},set minlength(e=void 0){b(e),wt()},get oninput(){return y()},set oninput(e){y(e),wt()},get onchange(){return _()},set onchange(e){_(e),wt()},get onfocus(){return w()},set onfocus(e){w(e),wt()},get onblur(){return C()},set onblur(e){C(e),wt()},get type(){return x()},set type(e="text"){x(e),wt()},get rows(){return E()},set rows(e=3){E(e),wt()},get cols(){return S()},set cols(e=void 0){S(e),wt()},get resize(){return k()},set resize(e="vertical"){k(e),wt()}})}function Nc(e){/[\d+]/.test(e.key)||["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)||e.preventDefault()}ra(["input","change","click"]),customElements.define("alviere-text-input",Uo(Bc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},sensitive:{},maxlength:{},minlength:{},oninput:{},onchange:{},onfocus:{},onblur:{},type:{},rows:{},cols:{},resize:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getComponentMetadata"],!0));var Rc=ia('<label class="alviere-phone-input__label svelte-1fmnaq1"> </label>'),zc=ia('<span class="alviere-phone-input__character-count svelte-1fmnaq1"> </span>'),Lc=ia('<div class="alviere-phone-input__required svelte-1fmnaq1">Required</div>'),Dc=ia('<div class="alviere-phone-input__error svelte-1fmnaq1" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Uc=ia('<div><div><!> <input type="tel"/> <!></div> <div class="alviere-phone-input__validation-messages svelte-1fmnaq1"><!> <!></div></div>');const Pc={hash:"svelte-1fmnaq1",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-phone-input.svelte-1fmnaq1 {position:relative;width:100%;}.alviere-phone-input__label.svelte-1fmnaq1 {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-phone-input__required.svelte-1fmnaq1 {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-phone-input__error.svelte-1fmnaq1 {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-phone-input__wrapper.svelte-1fmnaq1 {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-text-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-date-of-birth-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-search-select__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-currency-input__label:where(.svelte-1fmnaq1) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-text-input__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-date-of-birth-input__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-search-select__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-currency-input__input:where(.svelte-1fmnaq1)::placeholder {opacity:1;}.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-text-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-date-of-birth-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-search-select__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-currency-input__label:where(.svelte-1fmnaq1) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-phone-input__wrapper--disabled.svelte-1fmnaq1 {background:#f4f4f5;cursor:not-allowed;}.alviere-phone-input__wrapper--readonly.svelte-1fmnaq1 {background:#f4f4f5;cursor:default;}.alviere-phone-input__wrapper--valid.svelte-1fmnaq1 {border-color:#436b1d;}.alviere-phone-input__wrapper--invalid.svelte-1fmnaq1 {border-color:#b3311f;}.alviere-phone-input__input.svelte-1fmnaq1 {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-phone-input__input.svelte-1fmnaq1::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-phone-input__input.svelte-1fmnaq1:disabled {cursor:not-allowed;color:#52525b;}.alviere-phone-input__input.svelte-1fmnaq1:read-only {cursor:default;color:#3f3f46;}.alviere-phone-input__validation-messages.svelte-1fmnaq1 {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__wrapper:where(.svelte-1fmnaq1) {min-height:2.5rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__textarea:where(.svelte-1fmnaq1) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1) {font-size:1rem;}.alviere-phone-input--md.svelte-1fmnaq1 .alviere-phone-input__wrapper:where(.svelte-1fmnaq1) {min-height:3.25rem;}.alviere-phone-input--md.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1) {font-size:1rem;}.alviere-phone-input--md.svelte-1fmnaq1 .alviere-phone-input__textarea:where(.svelte-1fmnaq1) {font-size:1.25rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__wrapper:where(.svelte-1fmnaq1) {min-height:3.75rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__textarea:where(.svelte-1fmnaq1) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1) {font-size:1.25rem;}.alviere-phone-input.svelte-1fmnaq1:focus-within .alviere-phone-input__wrapper:where(.svelte-1fmnaq1):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-phone-input__character-count.svelte-1fmnaq1 {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;color:#52525b;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;letter-spacing:0.05em;opacity:0.8;}.alviere-exp-input--sm.svelte-1fmnaq1 .alviere-phone-input__character-count:where(.svelte-1fmnaq1) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-exp-input--lg.svelte-1fmnaq1 .alviere-phone-input__character-count:where(.svelte-1fmnaq1) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-phone-input__character-count:where(.svelte-1fmnaq1) {opacity:1;}.alviere-phone-input__success-message.svelte-1fmnaq1 {margin-top:0.25rem;font-size:1.125rem;color:#436b1d;line-height:1.25;}'};function Vc(e,t){je(t,!0),Oa(e,Pc);let r=zo(t,"value",15,""),a=zo(t,"label",15,"Phone Number"),o=zo(t,"placeholder",15,"Enter phone number"),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"autocomplete",15,"tel"),d=zo(t,"validationState",15,"neutral"),p=zo(t,"errorMessage",15,""),f=zo(t,"helpText",15,""),h=zo(t,"validationSchema",31,()=>Dt({})),g=zo(t,"oninput",15),m=zo(t,"onchange",15),b=zo(t,"onfocus",15),y=zo(t,"onblur",15);const _=Yl({get value(){return r()},required:i(),disabled:n(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"PhoneInput",componentType:"phone",customValidator:e=>{const t=Ql.phone(e);if(t)return{isValid:!1,error:t};const r=Ds(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let w=rt(()=>r().length),C=rt(()=>Zl(_.state.inputElement));function x(){return{value:r(),rawValue:r(),isValid:_.state.isValid,validationState:_.state.validationState,errorMessage:_.state.errorMessage,hasInteracted:_.state.hasInteracted,formattedValue:r(),countryCode:E(r())}}function E(e){if(!e||!e.startsWith("+"))return;const t=e.match(/^\+(\d{1,3})/);return t?t[1]:void 0}Ta(()=>{_.state.inputElement}),Zt(()=>{Bt(w,r().length)});const S=rt(()=>["alviere-phone-input__wrapper",""!==r()?"alviere-phone-input__wrapper--dirty":"",_.state.isFocused?"alviere-phone-input__wrapper--focused":"","invalid"===_.computed.effectiveValidationState?"alviere-phone-input__wrapper--invalid":"","valid"===_.computed.effectiveValidationState?"alviere-phone-input__wrapper--valid":"",n()?"alviere-phone-input__wrapper--disabled":""].filter(Boolean).join(" "));var k=Uc(),A=Ht(k),T=Ht(A),I=e=>{var t=Rc(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"for",c()||"phone-input"),Ca(r,a())}),va(e,t)};Ba(T,e=>{a()&&e(I)});var B=Wt(T,2);ao(B),B.__input=function(e){N.info("PhoneInput: handleInput",e);const t=e.target;let a=t.value;if(a&&!a.startsWith("+")&&(a="+"+a),a.startsWith("+")){const e=a.substring(1);a="+"+e.replace(/[^\d]/g,"")}a.length>20&&(a=a.substring(0,20)),r(a),t.value=a,_.handlers.handleInput(e),qr(C).dispatch(gs,x()),g()&&(N.info("PhoneInput: oninput",e),g()(e))},B.__change=function(e){_.handlers.handleChange(e),N.info("PhoneInput: handleChange",e),qr(C).dispatch(ms,x()),m()&&m()({detail:{value:r()}})},B.__keydown=[Nc],ko(B,e=>_.state.inputElement=e,()=>{var e;return null==(e=null==_?void 0:_.state)?void 0:e.inputElement});var R=Wt(B,2),z=e=>{var t=zc(),r=Ht(t);Re(t),ar(()=>Ca(r,`${qr(w)??""}/20`)),va(e,t)};Ba(R,e=>{qr(w)>0&&e(z)}),Re(A);var L=Wt(A,2),D=Ht(L),U=e=>{va(e,Lc())};Ba(D,e=>{i()&&"neutral"===_.computed.effectiveValidationState&&e(U)});var P=Wt(D,2),V=e=>{var t=Dc(),r=Wt(Ht(t));Re(t),ar(()=>{lo(t,"id",`${c()||"pohne-input"}-error`),Ca(r,` ${_.state.errorMessage??""}`)}),va(e,t)};return Ba(P,e=>{"invalid"===_.state.validationState&&e(V)}),Re(L),Re(k),ar(()=>{Ga(k,1,`alviere-phone-input alviere-phone-input--${s()??""}`,"svelte-1fmnaq1"),Ga(A,1,Fa(qr(S)),"svelte-1fmnaq1"),lo(B,"id",c()||"phone-input"),lo(B,"name",u()),lo(B,"placeholder",_.state.isFocused?o():""),oo(B,r()),B.required=i(),B.disabled=n(),B.readOnly=l(),lo(B,"autocomplete",v()),Ga(B,1,`alviere-phone-input__input alviere-phone-input__input--${s()??""}`,"svelte-1fmnaq1"),lo(B,"aria-describedby",_.state.errorMessage?`${c()||"phone-input"}-error`:void 0)}),ta("focus",B,function(){_.handlers.handleFocus(),qr(C).dispatch(bs,x()),b()&&b()(event)}),ta("blur",B,function(e){_.handlers.handleBlur(e),qr(C).dispatch(ys,x()),y()&&y()(e)}),va(e,k),qe({focus:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.blur()},isValid:function(){return _.state.isValid},getValidationError:function(){return _.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),_.state.inputElement&&(_.state.inputElement.value="")},select:function(){_.state.inputElement&&"select"in _.state.inputElement&&_.state.inputElement.select()},setSelectionRange:function(e,t){_.state.inputElement&&"setSelectionRange"in _.state.inputElement&&_.state.inputElement.setSelectionRange(e,t)},getFormattedValue:function(){return r()},getRawValue:function(){return r().replace(/\D/g,"")},getComponentMetadata:function(){return{name:"PhoneInput",type:"phone",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Phone Number"){a(e),wt()},get placeholder(){return o()},set placeholder(e="Enter phone number"){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="tel"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get oninput(){return g()},set oninput(e){g(e),wt()},get onchange(){return m()},set onchange(e){m(e),wt()},get onfocus(){return b()},set onfocus(e){b(e),wt()},get onblur(){return y()},set onblur(e){y(e),wt()}})}function Mc(e,t,r,a){N.info("DateOfBirthInput: handleChange",event),qr(t).dispatch(ts,r()),a()&&a()(event)}function Oc(e){/[\d-]/.test(e.key)||["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)||e.preventDefault()}ra(["input","change","keydown"]),customElements.define("alviere-phone-input",Uo(Vc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getComponentMetadata"],!0));var jc=ia('<label class="alviere-date-of-birth-input__label svelte-1ky42oj"> </label>'),qc=ia('<div class="alviere-date-of-birth-input__required svelte-1ky42oj">Required</div>'),Fc=ia('<div class="alviere-date-of-birth-input__error svelte-1ky42oj" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Kc=ia('<div><div><!> <input type="text" maxlength="10"/></div> <div class="alviere-date-of-birth-input__validation-messages svelte-1ky42oj"><!> <!></div></div>');const $c={hash:"svelte-1ky42oj",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-date-of-birth-input.svelte-1ky42oj {position:relative;width:100%;}.alviere-date-of-birth-input__label.svelte-1ky42oj {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-date-of-birth-input__required.svelte-1ky42oj {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-date-of-birth-input__error.svelte-1ky42oj {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-date-of-birth-input__wrapper.svelte-1ky42oj {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-text-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-phone-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-search-select__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-currency-input__label:where(.svelte-1ky42oj) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-text-input__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-phone-input__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-search-select__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-currency-input__input:where(.svelte-1ky42oj)::placeholder {opacity:1;}.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-text-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-phone-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-search-select__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-currency-input__label:where(.svelte-1ky42oj) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-date-of-birth-input__wrapper--disabled.svelte-1ky42oj {background:#f4f4f5;cursor:not-allowed;}.alviere-date-of-birth-input__wrapper--readonly.svelte-1ky42oj {background:#f4f4f5;cursor:default;}.alviere-date-of-birth-input__wrapper--valid.svelte-1ky42oj {border-color:#436b1d;}.alviere-date-of-birth-input__wrapper--invalid.svelte-1ky42oj {border-color:#b3311f;}.alviere-date-of-birth-input__input.svelte-1ky42oj {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-date-of-birth-input__input.svelte-1ky42oj::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-date-of-birth-input__input.svelte-1ky42oj:disabled {cursor:not-allowed;color:#52525b;}.alviere-date-of-birth-input__input.svelte-1ky42oj:read-only {cursor:default;color:#3f3f46;}.alviere-date-of-birth-input__validation-messages.svelte-1ky42oj {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj) {min-height:2.5rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__textarea:where(.svelte-1ky42oj) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj) {font-size:1rem;}.alviere-date-of-birth-input--md.svelte-1ky42oj .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj) {min-height:3.25rem;}.alviere-date-of-birth-input--md.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj) {font-size:1rem;}.alviere-date-of-birth-input--md.svelte-1ky42oj .alviere-date-of-birth-input__textarea:where(.svelte-1ky42oj) {font-size:1.25rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj) {min-height:3.75rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__textarea:where(.svelte-1ky42oj) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj) {font-size:1.25rem;}.alviere-date-of-birth-input.svelte-1ky42oj:focus-within .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-date-of-birth-input__success-message.svelte-1ky42oj {color:#436b1d;font-size:0.875rem;margin-top:0.25rem;font-weight:500;}'};function Hc(e,t){je(t,!0),Oa(e,$c);let r=zo(t,"value",15,""),a=zo(t,"label",15,"Date of Birth"),o=zo(t,"placeholder",15,"YYYY-MM-DD"),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"autocomplete",15,"bday"),d=zo(t,"validationState",15,"neutral"),p=zo(t,"errorMessage",15,""),f=zo(t,"helpText",15,""),h=zo(t,"validationSchema",31,()=>Dt({})),g=zo(t,"oninput",15),m=zo(t,"onchange",15),b=zo(t,"onfocus",15),y=zo(t,"onblur",15);const _=Yl({get value(){return r()},required:i(),disabled:n(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"DateOfBirthInput",componentType:"date",customValidator:e=>{if(e&&10===e.length){const[t,r,a]=e.split("-").map(Number),o=new Date(t,r-1,a),n=new Date,i=n.getFullYear()-o.getFullYear();if(isNaN(o.getTime()))return{isValid:!1,error:"Please enter a valid date"};if(o>n)return{isValid:!1,error:"Date of birth cannot be in the future"};if(i<0)return{isValid:!1,error:"Must be at least 13 years old"}}const t=Ds(e,h(),a());return{isValid:t.isValid,error:t.firstError}}});let w=rt(()=>Zl(_.state.inputElement));function C(){return{value:r(),rawValue:r(),isValid:_.state.isValid,validationState:_.state.validationState,errorMessage:_.state.errorMessage,hasInteracted:_.state.hasInteracted,characterCount:r().length,maxLength:10}}Ta(()=>{});const x=rt(()=>["alviere-date-of-birth-input__wrapper",_.state.isFocused?"alviere-date-of-birth-input__wrapper--focused":"",_.state.errorMessage?"alviere-date-of-birth-input__wrapper--invalid":"",!_.state.errorMessage&&r()&&10===r().length?"alviere-date-of-birth-input__wrapper--valid":"",n()?"alviere-date-of-birth-input__wrapper--disabled":"",""!==r()?"alviere-date-of-birth-input__wrapper--dirty":""].filter(Boolean).join(" "));function E(){return _.state.isValid}var S=Kc(),k=Ht(S),A=Ht(k),T=e=>{var t=jc(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"for",c()||"date-of-birth-input"),Ca(r,a())}),va(e,t)};Ba(A,e=>{a()&&e(T)});var I=Wt(A,2);ao(I),I.__input=function(e){const t=e.target;let a=t.value;a=a.replace(/[^\d-]/g,""),a.length>=4&&!a.includes("-")&&(a=a.substring(0,4)+"-"+a.substring(4)),a.length>=7&&2===a.split("-").length&&(a=a.substring(0,7)+"-"+a.substring(7)),a.length>10&&(a=a.substring(0,10)),r(a),t.value=a,_.handlers.handleInput(e),qr(w).dispatch(es,C()),g()&&g()(e)},I.__change=[Mc,w,C,m],I.__keydown=[Oc],ko(I,e=>_.state.inputElement=e,()=>{var e;return null==(e=null==_?void 0:_.state)?void 0:e.inputElement}),Re(k);var B=Wt(k,2),N=Ht(B),R=e=>{va(e,qc())};Ba(N,e=>{i()&&"neutral"===_.computed.effectiveValidationState&&e(R)});var z=Wt(N,2),L=e=>{var t=Fc(),r=Wt(Ht(t));Re(t),ar(()=>{lo(t,"id",`${c()||"date-of-birth-input"}-error`),Ca(r,` ${_.state.errorMessage??""}`)}),va(e,t)};return Ba(z,e=>{"invalid"===_.state.validationState&&e(L)}),Re(B),Re(S),ar(()=>{Ga(S,1,`alviere-date-of-birth-input alviere-date-of-birth-input--${s()??""}`,"svelte-1ky42oj"),Ga(k,1,Fa(qr(x)),"svelte-1ky42oj"),lo(I,"id",c()||"date-of-birth-input"),lo(I,"name",u()),lo(I,"placeholder",_.state.isFocused?o():""),oo(I,r()),I.required=i(),I.disabled=n(),I.readOnly=l(),lo(I,"autocomplete",v()),Ga(I,1,`alviere-date-of-birth-input__input alviere-date-of-birth-input__input--${s()??""}`,"svelte-1ky42oj"),lo(I,"aria-describedby",_.state.errorMessage?`${c()||"date-of-birth-input"}-error`:void 0)}),ta("focus",I,function(e){_.handlers.handleFocus(),qr(w).dispatch(rs,C()),b()&&b()(e)}),ta("blur",I,function(){_.handlers.handleBlur(),qr(w).dispatch(as,C()),y()&&y()(event)}),va(e,S),qe({focus:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.blur()},isValid:E,getValidationError:function(){return _.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),_.state.inputElement&&(_.state.inputElement.value="")},select:function(){_.state.inputElement&&"select"in _.state.inputElement&&_.state.inputElement.select()},setSelectionRange:function(e,t){_.state.inputElement&&"setSelectionRange"in _.state.inputElement&&_.state.inputElement.setSelectionRange(e,t)},getAge:function(){if(!r()||!E())return null;const e=new Date(r()),t=new Date;let a=t.getFullYear()-e.getFullYear();const o=t.getMonth()-e.getMonth();return(o<0||0===o&&t.getDate()<e.getDate())&&a--,a>=0?a:null},getDate:function(){return r()&&E()?new Date(r()):null},getComponentMetadata:function(){return{name:"DateOfBirthInput",type:"date",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getAge","getDate"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Date of Birth"){a(e),wt()},get placeholder(){return o()},set placeholder(e="YYYY-MM-DD"){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="bday"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get oninput(){return g()},set oninput(e){g(e),wt()},get onchange(){return m()},set onchange(e){m(e),wt()},get onfocus(){return b()},set onfocus(e){b(e),wt()},get onblur(){return y()},set onblur(e){y(e),wt()}})}function Gc(e,t,r,a){N.info("CurrencyInput: handleChange",e),qr(t).dispatch(ts,r()),a()&&a()(e)}ra(["input","change","keydown"]),customElements.define("alviere-date-of-birth-input",Uo(Hc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getAge","getDate","getComponentMetadata"],!0));var Wc=ia('<label class="alviere-currency-input__label svelte-arhdam"> </label>'),Yc=ia('<div class="alviere-currency-input__required svelte-arhdam">Required</div>'),Qc=ia('<div class="alviere-currency-input__error svelte-arhdam" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Jc=ia('<div class="alviere-currency-input__help-text"> </div>'),Xc=ia('<div><div><!> <input type="text" inputmode="numeric"/></div> <div class="alviere-currency-input__validation-messages svelte-arhdam"><!> <!> <!></div></div>');const Zc={hash:"svelte-arhdam",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-currency-input.svelte-arhdam {position:relative;width:100%;}.alviere-currency-input__label.svelte-arhdam {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-currency-input__required.svelte-arhdam {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-currency-input__error.svelte-arhdam {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-currency-input__wrapper.svelte-arhdam {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-currency-input__wrapper--focused.svelte-arhdam {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-text-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-phone-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-date-of-birth-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-search-select__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-text-input__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-phone-input__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-date-of-birth-input__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-search-select__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam)::placeholder {opacity:1;}.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-text-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-phone-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-date-of-birth-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-search-select__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-currency-input__wrapper--disabled.svelte-arhdam {background:#f4f4f5;cursor:not-allowed;}.alviere-currency-input__wrapper--readonly.svelte-arhdam {background:#f4f4f5;cursor:default;}.alviere-currency-input__wrapper--valid.svelte-arhdam {border-color:#436b1d;}.alviere-currency-input__wrapper--invalid.svelte-arhdam {border-color:#b3311f;}.alviere-currency-input__input.svelte-arhdam {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-currency-input__input.svelte-arhdam::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-currency-input__input.svelte-arhdam:disabled {cursor:not-allowed;color:#52525b;}.alviere-currency-input__input.svelte-arhdam:read-only {cursor:default;color:#3f3f46;}.alviere-currency-input__validation-messages.svelte-arhdam {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__wrapper:where(.svelte-arhdam) {min-height:2.5rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__textarea:where(.svelte-arhdam) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {font-size:1rem;}.alviere-currency-input--md.svelte-arhdam .alviere-currency-input__wrapper:where(.svelte-arhdam) {min-height:3.25rem;}.alviere-currency-input--md.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam) {font-size:1rem;}.alviere-currency-input--md.svelte-arhdam .alviere-currency-input__textarea:where(.svelte-arhdam) {font-size:1.25rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__wrapper:where(.svelte-arhdam) {min-height:3.75rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__textarea:where(.svelte-arhdam) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {font-size:1.25rem;}.alviere-currency-input.svelte-arhdam:focus-within .alviere-currency-input__wrapper:where(.svelte-arhdam):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-currency-input__input.svelte-arhdam {font-variant-numeric:tabular-nums;letter-spacing:0.02em;}'};function eu(e,t){je(t,!0),Oa(e,Zc);let r=zo(t,"value",15,""),a=zo(t,"label",15,"Amount"),o=zo(t,"placeholder",15,"0.00"),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"autocomplete",15,""),d=zo(t,"validationState",15,"neutral"),p=zo(t,"errorMessage",15,""),f=zo(t,"helpText",15,""),h=zo(t,"validationSchema",31,()=>Dt({})),g=zo(t,"oninput",15),m=zo(t,"onchange",15),b=zo(t,"onfocus",15),y=zo(t,"onblur",15),_=zo(t,"currency",15,"USD"),w=zo(t,"locale",15,"en-US"),C=Tt(0);function x(e){try{const t=e/100;return new Intl.NumberFormat(w(),{style:"currency",currency:_(),minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(t){return N.error("CurrencyInput: Error formatting currency",t),`${function(){try{return new Intl.NumberFormat(w(),{style:"currency",currency:_(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch(t){return N.error("CurrencyInput: Error getting currency symbol",t),"$"}}()}${(e/100).toFixed(2)}`}}function E(e){if(!e&&0!==e)return 0;const t=String(e).replace(/\D/g,"");return t?parseInt(t,10):0}if(r()){const e=E(r());Bt(C,e,!0),r(x(e))}const S=Yl({get value(){return r()},required:i(),disabled:n(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"CurrencyInput",componentType:"text",customValidator:e=>{if(e){const t=E(e);if(isNaN(t))return{isValid:!1,error:"Please enter a valid amount"};if(t<0)return{isValid:!1,error:"Amount must be positive"}}const t=Ds(e,h(),a());return{isValid:t.isValid,error:t.firstError}}});let k=rt(()=>Zl(S.state.inputElement));function A(){return{value:r(),rawValue:(qr(C)/100).toFixed(2).toString(),isValid:S.state.isValid,validationState:S.state.validationState,errorMessage:S.state.errorMessage,hasInteracted:S.state.hasInteracted,characterCount:r().length}}Zt(()=>{qr(C)>0&&r(x(qr(C)))});const T=rt(()=>["alviere-currency-input__wrapper",S.state.isFocused?"alviere-currency-input__wrapper--focused":"",S.state.errorMessage?"alviere-currency-input__wrapper--invalid":"",!S.state.errorMessage&&r()&&qr(C)>0?"alviere-currency-input__wrapper--valid":"",n()?"alviere-currency-input__wrapper--disabled":"",""!==r()?"alviere-currency-input__wrapper--dirty":""].filter(Boolean).join(" "));function I(e){Bt(C,e,!0),r(x(e))}var B=Xc(),R=Ht(B),z=Ht(R),L=e=>{var t=Wc(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"for",c()||"currency-input"),Ca(r,a())}),va(e,t)};Ba(z,e=>{a()&&e(L)});var D=Wt(z,2);ao(D),D.__input=function(e){const t=e.target,a=t.value.replace(/\D/g,""),o=r().replace(/\D/g,"");if(a===o&&0===a.length)Bt(C,0);else if(0===a.length)Bt(C,0);else if(a.length===o.length&&a===o);else{const e=parseInt(a,10)||0;if(o.length>0&&a.length===o.length+1){const e=a[a.length-1];Bt(C,10*qr(C)+parseInt(e,10))}else o.length>0&&a.length===o.length-1?Bt(C,Math.floor(qr(C)/10),!0):Bt(C,e,!0)}const n=x(qr(C));r(n),t.value=n,setTimeout(()=>{const e=n.length;t.setSelectionRange(e,e)},0),S.handlers.handleInput(e),qr(k).dispatch(es,A()),g()&&g()(e)},D.__change=[Gc,k,A,m],D.__keydown=function(e){const t=e.target;if("Backspace"===e.key){e.preventDefault(),Bt(C,Math.floor(qr(C)/10),!0);const a=x(qr(C));r(a),t.value=a,setTimeout(()=>{const e=a.length;t.setSelectionRange(e,e)},0);const o=new Event("input",{bubbles:!0});return void t.dispatchEvent(o)}if("Delete"===e.key){e.preventDefault(),Bt(C,Math.floor(qr(C)/10),!0);const a=x(qr(C));r(a),t.value=a,setTimeout(()=>{const e=a.length;t.setSelectionRange(e,e)},0);const o=new Event("input",{bubbles:!0});return void t.dispatchEvent(o)}/\d/.test(e.key)||["Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)||e.preventDefault()},ko(D,e=>S.state.inputElement=e,()=>{var e;return null==(e=null==S?void 0:S.state)?void 0:e.inputElement}),Re(R);var U=Wt(R,2),P=Ht(U),V=e=>{va(e,Yc())};Ba(P,e=>{i()&&"neutral"===S.computed.effectiveValidationState&&e(V)});var M=Wt(P,2),O=e=>{var t=Qc(),r=Wt(Ht(t));Re(t),ar(()=>{lo(t,"id",`${c()||"currency-input"}-error`),Ca(r,` ${S.state.errorMessage??""}`)}),va(e,t)};Ba(M,e=>{"invalid"===S.state.validationState&&e(O)});var j=Wt(M,2),q=e=>{var t=Jc(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,f())),va(e,t)};return Ba(j,e=>{f()&&!S.state.errorMessage&&e(q)}),Re(U),Re(B),ar(()=>{Ga(B,1,`alviere-currency-input alviere-currency-input--${s()??""}`,"svelte-arhdam"),Ga(R,1,Fa(qr(T)),"svelte-arhdam"),lo(D,"id",c()||"currency-input"),lo(D,"name",u()),lo(D,"placeholder",S.state.isFocused?o():""),oo(D,r()),D.required=i(),D.disabled=n(),D.readOnly=l(),lo(D,"autocomplete",v()),Ga(D,1,`alviere-currency-input__input alviere-currency-input__input--${s()??""}`,"svelte-arhdam"),lo(D,"aria-invalid","invalid"===S.state.validationState?"true":void 0),lo(D,"aria-describedby",S.state.errorMessage?`${c()||"currency-input"}-error`:void 0)}),ta("focus",D,function(e){S.handlers.handleFocus(),qr(k).dispatch(rs,A()),b()&&b()(e)}),ta("blur",D,function(e){S.handlers.handleBlur(e),qr(k).dispatch(as,A()),y()&&y()(e)}),va(e,B),qe({focus:function(){var e;null===(e=S.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=S.state.inputElement)||void 0===e||e.blur()},isValid:function(){return S.state.isValid},getValidationError:function(){return S.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),Bt(C,0),S.state.inputElement&&(S.state.inputElement.value="")},select:function(){S.state.inputElement&&"select"in S.state.inputElement&&S.state.inputElement.select()},setSelectionRange:function(e,t){S.state.inputElement&&"setSelectionRange"in S.state.inputElement&&S.state.inputElement.setSelectionRange(e,t)},getFormattedValue:function(){return r()},getRawValue:function(){return qr(C)},getValueInMajorUnits:function(){return qr(C)/100},getValueInMinorUnits:function(){return qr(C)},setValue:I,setValueInMajorUnits:function(e){I(Math.round(100*e))},getComponentMetadata:function(){return{name:"CurrencyInput",type:"currency",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getValueInMajorUnits","getValueInMinorUnits","setValue","setValueInMajorUnits"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Amount"){a(e),wt()},get placeholder(){return o()},set placeholder(e="0.00"){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e=""){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get oninput(){return g()},set oninput(e){g(e),wt()},get onchange(){return m()},set onchange(e){m(e),wt()},get onfocus(){return b()},set onfocus(e){b(e),wt()},get onblur(){return y()},set onblur(e){y(e),wt()},get currency(){return _()},set currency(e="USD"){_(e),wt()},get locale(){return w()},set locale(e="en-US"){w(e),wt()}})}function tu(e,t,r,a,o){Bt(t,e.target.value,!0),Bt(r,-1),qr(a).dispatch(_s,o())}ra(["input","change","keydown"]),customElements.define("alviere-currency-input",Uo(eu,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{},currency:{},locale:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getValueInMajorUnits","getValueInMinorUnits","setValue","setValueInMajorUnits","getComponentMetadata"],!0));var ru=ia('<label class="alviere-search-select__label svelte-1qkkc2b"> </label>'),au=ia('<div class="alviere-search-select__display-value svelte-1qkkc2b"> </div>'),ou=(e,t)=>{e.stopPropagation(),t()},nu=ia('<button type="button" class="alviere-search-select__clear-button svelte-1qkkc2b" aria-label="Clear selection"><!></button>'),iu=ia('<div class="alviere-search-select__loading-message svelte-1qkkc2b"> </div>'),lu=ia('<div class="alviere-search-select__no-options-message svelte-1qkkc2b"> </div>'),su=(e,t,r)=>t(qr(r)),cu=(e,t,r)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(qr(r)))},uu=ia('<div role="option" tabindex="0"> </div>'),vu=ia('<div id="search-select-dropdown" class="alviere-search-select__dropdown svelte-1qkkc2b" role="listbox"><div class="alviere-search-select__options-list svelte-1qkkc2b"><!></div></div>'),du=ia('<div class="alviere-search-select__required svelte-1qkkc2b">Required</div>'),pu=ia('<div class="alviere-search-select__help svelte-1qkkc2b"> </div>'),fu=ia('<div class="alviere-search-select__error svelte-1qkkc2b" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),hu=ia('<div><div class="alviere-search-select__container svelte-1qkkc2b"><div><!> <input type="text" class="alviere-search-select__input svelte-1qkkc2b" autocomplete="off" role="combobox" aria-haspopup="listbox" aria-controls="search-select-dropdown"/> <!> <div class="alviere-search-select__actions svelte-1qkkc2b"><!> <div><!></div></div></div> <!></div> <div class="alviere-search-select__validation-messages svelte-1qkkc2b"><!> <!> <!></div></div>');const gu={hash:"svelte-1qkkc2b",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-search-select.svelte-1qkkc2b {position:relative;width:100%;}.alviere-search-select__label.svelte-1qkkc2b {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-search-select__required.svelte-1qkkc2b {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-search-select__error.svelte-1qkkc2b {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-search-select__wrapper.svelte-1qkkc2b {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-search-select__wrapper--focused.svelte-1qkkc2b {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}\n.alviere-search-select__wrapper--focused.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}\n.alviere-search-select__wrapper--focused.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b)::placeholder {opacity:1;}\n.alviere-search-select__wrapper--dirty.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-search-select__wrapper--disabled.svelte-1qkkc2b {background:#f4f4f5;cursor:not-allowed;}.alviere-search-select__wrapper--readonly.svelte-1qkkc2b {background:#f4f4f5;cursor:default;}.alviere-search-select__wrapper--valid.svelte-1qkkc2b {border-color:#436b1d;}.alviere-search-select__wrapper--invalid.svelte-1qkkc2b {border-color:#b3311f;}.alviere-search-select__input.svelte-1qkkc2b {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-search-select__input.svelte-1qkkc2b::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__input.svelte-1qkkc2b:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__input.svelte-1qkkc2b:read-only {cursor:default;color:#3f3f46;}.alviere-search-select__validation-messages.svelte-1qkkc2b {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-search-select--sm.svelte-1qkkc2b .alviere-search-select__wrapper:where(.svelte-1qkkc2b) {min-height:2.5rem;}.alviere-search-select--sm.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-search-select--sm.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {font-size:1rem;}.alviere-search-select--md.svelte-1qkkc2b .alviere-search-select__wrapper:where(.svelte-1qkkc2b) {min-height:3.25rem;}.alviere-search-select--md.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b) {font-size:1rem;}.alviere-search-select--lg.svelte-1qkkc2b .alviere-search-select__wrapper:where(.svelte-1qkkc2b) {min-height:3.75rem;}.alviere-search-select--lg.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-search-select--lg.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {font-size:1.25rem;}.alviere-search-select.svelte-1qkkc2b:focus-within .alviere-search-select__wrapper:where(.svelte-1qkkc2b):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-search-select__container.svelte-1qkkc2b {position:relative;}.alviere-search-select__wrapper.svelte-1qkkc2b {position:relative;display:flex;align-items:center;}.alviere-search-select__wrapper.svelte-1qkkc2b:hover:not(.alviere-search-select__wrapper--disabled) {border-color:#3f3f46;}.alviere-search-select__wrapper--focused.svelte-1qkkc2b {border-color:#227e9e;box-shadow:0 0 0 2px rgba(34, 126, 158, 0.15);}.alviere-search-select__wrapper--disabled.svelte-1qkkc2b {cursor:not-allowed;opacity:0.7;}.alviere-search-select__wrapper--disabled.alviere-search-select__wrapper--valid.svelte-1qkkc2b {border-color:#52525b;}.alviere-search-select__input.svelte-1qkkc2b {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;flex:1;border:none;outline:none;background:transparent;margin:0;width:100%;height:100%;}.alviere-search-select__input.svelte-1qkkc2b::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__input.svelte-1qkkc2b:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__input.svelte-1qkkc2b:read-only {cursor:default;color:#3f3f46;}.alviere-search-select__input.svelte-1qkkc2b::placeholder {color:#71717a;opacity:0;transition:opacity 0.2s ease;}.alviere-search-select__input.svelte-1qkkc2b:focus::placeholder {opacity:1;}.alviere-search-select__input.svelte-1qkkc2b:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__display-value.svelte-1qkkc2b {position:absolute;left:0.75rem;right:3rem;padding-top:1rem;top:50%;transform:translateY(-50%);color:#18181b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;z-index:1;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__actions.svelte-1qkkc2b {position:absolute;right:0.75rem;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:0.25rem;z-index:2;}.alviere-search-select__clear-button.svelte-1qkkc2b {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#e4e4e7;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;padding-left:0.25rem;padding-right:0.25rem;border-radius:50%;cursor:pointer;transition:all 150ms ease-in-out;margin-right:0.5rem;appearance:none;border:none;}.alviere-search-select__clear-button.svelte-1qkkc2b svg {width:0.75rem;height:0.75rem;}.alviere-search-select__clear-button.svelte-1qkkc2b:hover {background-color:#d4d4d8;color:#27272a;}.alviere-search-select__clear-button.svelte-1qkkc2b:focus {outline:none;box-shadow:0 0 0 2px rgba(34, 126, 158, 0.25);}.alviere-search-select__dropdown-arrow.svelte-1qkkc2b {color:#71717a;font-size:1rem;transition:transform 150ms ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center;}.alviere-search-select__dropdown-arrow.open.svelte-1qkkc2b {transform:rotate(180deg);}.alviere-search-select__dropdown.svelte-1qkkc2b {position:absolute;top:100%;left:0;right:0;z-index:1000;background-color:#ffffff;border:1px solid #52525b;border-top:none;border-radius:0 0 0.25rem 0.25rem;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);overflow:hidden;\n animation: svelte-1qkkc2b-dropdownFadeIn 150ms ease-in-out ease;}.alviere-search-select__options-list.svelte-1qkkc2b {max-height:12.5rem;overflow-y:auto;}.alviere-search-select__option-item.svelte-1qkkc2b {padding:0.5rem 1rem;cursor:pointer;transition:background-color 150ms ease-in-out;border-bottom:1px solid #f4f4f5;}.alviere-search-select__option-item.svelte-1qkkc2b:hover {background-color:#fafafa;}.alviere-search-select__option-item.selected.svelte-1qkkc2b {background-color:rgba(34, 126, 158, 0.1);color:#227e9e;font-weight:500;}.alviere-search-select__option-item.highlighted.svelte-1qkkc2b {background-color:rgba(34, 126, 158, 0.1);}.alviere-search-select__option-item.svelte-1qkkc2b:last-child {border-bottom:none;}.alviere-search-select__loading-message.svelte-1qkkc2b, .alviere-search-select__no-options-message.svelte-1qkkc2b {padding:1.5rem 1rem;text-align:center;color:#71717a;font-style:italic;}.alviere-search-select__help.svelte-1qkkc2b {margin-top:0.25rem;font-size:0.75rem;color:#71717a;line-height:1.25;display:flex;align-items:flex-start;gap:0.25rem;}.alviere-search-select__help.svelte-1qkkc2b svg {width:1rem;height:1rem;}.alviere-search-select__error.svelte-1qkkc2b {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}\n\n@keyframes svelte-1qkkc2b-dropdownFadeIn {\n from {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n@media (max-width: 768px) {.alviere-search-select__dropdown.svelte-1qkkc2b {max-height:15.625rem;}.alviere-search-select__option-item.svelte-1qkkc2b {padding:1rem 0.5rem;}\n}'};function mu(e,t){je(t,!0),Oa(e,gu);let r=zo(t,"value",15,""),a=zo(t,"options",31,()=>Dt([])),o=zo(t,"placeholder",15,"Search..."),n=zo(t,"disabled",15,!1),i=zo(t,"required",15,!1),l=zo(t,"readonly",15,!1),s=zo(t,"size",15,"md"),c=zo(t,"id",15,""),u=zo(t,"name",15,""),v=zo(t,"validationState",15,"neutral"),d=zo(t,"errorMessage",15,""),p=zo(t,"helpText",15,""),f=zo(t,"label",15,""),h=zo(t,"searchPlaceholder",15,""),g=zo(t,"noOptionsMessage",15,"No options found"),m=zo(t,"loadingMessage",15,"Loading..."),b=zo(t,"isLoading",15,!1),y=zo(t,"maxHeight",15,"300px"),_=zo(t,"validationSchema",31,()=>Dt({})),w=zo(t,"onchange",15),C=zo(t,"onfocus",15),x=zo(t,"onblur",15);const E=Ia(),S=lc(vc),k=lc(gc),A=Yl({get value(){return r()},required:i(),disabled:n(),readonly:l(),get validationState(){return v()},get errorMessage(){return d()},helpText:p(),label:f(),validationSchema:_(),componentName:"SearchSelect",componentType:"select",customValidator:e=>{if(i()&&(!e||""===e))return{isValid:!1,error:"Please select an option"};if(e&&a().length>0){if(!a().some(t=>t.value===e))return{isValid:!1,error:"Selected value is not valid"}}const t=Ds(e,_(),f());return{isValid:t.isValid,error:t.firstError}}});let T=Tt(null),I=Tt(null),B=Tt(!1),R=Tt(""),z=Tt(-1),L=rt(()=>Zl(qr(T)));function D(){const e=a().find(e=>e.value===r());return{value:r()?String(r()):"",rawValue:r()?String(r()):"",isValid:A.state.isValid,validationState:A.state.validationState,errorMessage:A.state.errorMessage,hasInteracted:A.state.hasInteracted,selectedOption:e||null,options:a(),searchQuery:qr(R)}}let U=rt(()=>()=>qr(R)?a().filter(e=>e.label.toLowerCase().includes(qr(R).toLowerCase())):a()),P=rt(()=>()=>{if(!r())return"";const e=a().find(e=>e.value===r());return e?e.label:""});function V(){N.info("SearchSelect: openDropdown",n(),l()),n()||l()||(Bt(B,!0),Bt(z,-1),setTimeout(()=>{null===qr(I)||void 0===qr(I)||qr(I).focus()},0),qr(L).dispatch(Cs,D()))}function M(){N.info("SearchSelect: closeDropdown",n(),l()),Bt(B,!1),Bt(R,""),Bt(z,-1),qr(L).dispatch(xs,D())}function O(e){N.info("SearchSelect: selectOption called with:",{option:e,currentValue:r(),required:i()}),r(e.value),N.info("SearchSelect: After setting value:",{newValue:r(),type:typeof r()}),A.actions.markAsInteracted(),N.info("SearchSelect: After markAsInteracted, hasInteracted:",A.state.hasInteracted),M(),null===qr(I)||void 0===qr(I)||qr(I).blur(),E("change",{value:e.value,label:e.label}),qr(L).dispatch(ws,D()),w()&&w()({detail:{value:e.value,label:e.label}})}function j(){N.info("SearchSelect: clearSelection called, current value:",r()),r(""),Bt(R,""),Bt(z,-1),N.info("SearchSelect: After clearing value:",{value:r(),required:i()}),A.actions.markAsInteracted(),N.info("SearchSelect: After markAsInteracted in clear, hasInteracted:",A.state.hasInteracted),E("change",{value:"",label:""}),qr(L).dispatch(ws,D()),w()&&w()({detail:{value:"",label:""}})}function q(e){var t;if(!qr(B)||!qr(T))return;const r=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e))||[],a=qr(T).getRootNode(),o=null==a?void 0:a.host;r.includes(qr(T))||o&&r.includes(o)||M()}function F(){null===qr(I)||void 0===qr(I)||qr(I).focus()}Zt(()=>{if("undefined"!=typeof window)return document.addEventListener("click",q),()=>{document.removeEventListener("click",q)}}),Zt(()=>{A.state.hasInteracted&&A.actions.forceValidation()}),Zt(()=>{if("undefined"!=typeof window&&window.customElements){const e=null===qr(T)||void 0===qr(T)?void 0:qr(T).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();e.includes("required")&&i(t.hasAttribute("required")),e.includes("disabled")&&n(t.hasAttribute("disabled")),e.includes("readonly")&&l(t.hasAttribute("readonly"))}}});var K=hu(),$=Ht(K),H=Ht($);let G;var W=Ht(H),Y=e=>{var t=ru(),r=Ht(t,!0);Re(t),ar(()=>{lo(t,"for",c()||u()),Ca(r,f())}),va(e,t)};Ba(W,e=>{f()&&e(Y)});var Q=Wt(W,2);ao(Q),Q.__input=[tu,R,z,L,D],Q.__keydown=function(e){if(qr(B))switch(e.key){case"ArrowDown":e.preventDefault(),Bt(z,Math.min(qr(z)+1,qr(U)().length-1),!0);break;case"ArrowUp":e.preventDefault(),Bt(z,Math.max(qr(z)-1,-1),!0);break;case"Enter":e.preventDefault(),qr(z)>=0&&qr(z)<qr(U)().length&&O(qr(U)()[qr(z)]);break;case"Escape":e.preventDefault(),M()}},ko(Q,e=>Bt(I,e),()=>qr(I));var J=Wt(Q,2),X=e=>{var t=au(),r=Ht(t,!0);Re(t),ar(e=>Ca(r,e),[()=>qr(P)()]),va(e,t)};Ba(J,e=>{qr(B)||A.state.isFocused||!qr(P)()||e(X)});var Z=Wt(J,2),ee=Ht(Z),te=e=>{var t=nu();t.__click=[ou,j],Pa(Ht(t),()=>k.outerHTML),Re(t),va(e,t)};Ba(ee,e=>{!r()||n()||l()||e(te)});var re=Wt(ee,2);let ae;Pa(Ht(re),()=>S.outerHTML),Re(re),Re(Z),Re(H);var oe=Wt(H,2),ne=e=>{var t=vu(),a=Ht(t),o=Ht(a),n=e=>{var t=iu(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,m())),va(e,t)},i=e=>{var t=ua(),a=Gt(t),o=e=>{var t=lu(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,g())),va(e,t)},n=e=>{var t=ua();Ra(Gt(t),17,()=>qr(U)(),Na,(e,t,a)=>{var o=uu();let n;o.__click=[su,O,t],o.__keydown=[cu,O,t];var i=Ht(o,!0);Re(o),ar(e=>{n=Ga(o,1,"alviere-search-select__option-item svelte-1qkkc2b",null,n,e),lo(o,"aria-selected",qr(t).value===r()),lo(o,"aria-label",qr(t).label),Ca(i,qr(t).label)},[()=>({selected:qr(t).value===r(),highlighted:a===qr(z)})]),ta("mouseenter",o,()=>Bt(z,a,!0)),va(e,o)}),va(e,t)};Ba(a,e=>{0===qr(U)().length?e(o):e(n,!1)},!0),va(e,t)};Ba(o,e=>{b()?e(n):e(i,!1)}),Re(a),Re(t),ar(()=>Ya(t,`max-height: ${y()??""}`)),va(e,t)};Ba(oe,e=>{qr(B)&&e(ne)}),Re($);var ie=Wt($,2),le=Ht(ie),se=e=>{va(e,du())};Ba(le,e=>{i()&&"neutral"===A.state.validationState&&e(se)});var ce=Wt(le,2),ue=e=>{var t=pu(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,p())),va(e,t)};Ba(ce,e=>{p()&&"invalid"!==A.state.validationState&&e(ue)});var ve=Wt(ce,2),de=e=>{var t=fu(),r=Wt(Ht(t));Re(t),ar(()=>{lo(t,"id",`${c()??""}-error`),Ca(r,` ${A.state.errorMessage??""}`)}),va(e,t)};return Ba(ve,e=>{"invalid"===A.state.validationState&&e(de)}),Re(ie),Re(K),ko(K,e=>Bt(T,e),()=>qr(T)),ar((e,t)=>{Ga(K,1,`alviere-search-select alviere-search-select--${s()??""}`,"svelte-1qkkc2b"),G=Ga(H,1,"alviere-search-select__wrapper svelte-1qkkc2b",null,G,e),lo(Q,"placeholder",qr(B)||A.state.isFocused?h()||`Search ${f()||"options"}...`:""),lo(Q,"id",c()),lo(Q,"name",u()),Q.disabled=n(),Q.readOnly=l(),lo(Q,"aria-expanded",qr(B)),ae=Ga(re,1,"alviere-search-select__dropdown-arrow svelte-1qkkc2b",null,ae,t)},[()=>({"alviere-search-select__wrapper--focused":A.state.isFocused,"alviere-search-select__wrapper--valid":"valid"===A.state.validationState,"alviere-search-select__wrapper--invalid":"invalid"===A.state.validationState,"alviere-search-select__wrapper--disabled":n(),"alviere-search-select__wrapper--dirty":!!qr(P)()}),()=>({open:qr(B)})]),ta("focus",Q,function(e){A.handlers.handleFocus(e),V(),qr(P)()&&Bt(R,qr(P)(),!0),C()&&C()(e)}),ta("blur",Q,function(e){A.handlers.handleBlur(e),setTimeout(()=>{(null===qr(T)||void 0===qr(T)?void 0:qr(T).contains(document.activeElement))||(M(),Bt(R,""))},150),x()&&x()(e)}),Co(Q,()=>qr(R),e=>Bt(R,e)),va(e,K),qe({focus:F,blur:function(){null===qr(I)||void 0===qr(I)||qr(I).blur()},isValid:function(){return A.state.isValid},getValidationError:function(){return A.state.errorMessage||null},getValidationSchema:function(){return _()},setValidationSchema:function(e){_(e)},clear:function(){r(""),Bt(R,""),Bt(z,-1),Bt(B,!1)},select:function(){qr(I)?(qr(I).focus(),qr(I).select()):F()},setSelectionRange:function(e,t){qr(I)&&"setSelectionRange"in qr(I)&&qr(I).setSelectionRange(e,t)},openDropdown:V,closeDropdown:M,getSelectedOption:function(){return qr(U).find(e=>e.value===r())||null},getFilteredOptions:function(){return qr(U)},selectOptionByIndex:function(e){e>=0&&e<qr(U).length&&O(qr(U)[e])},getComponentMetadata:function(){return{name:"SearchSelect",type:"select",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","openDropdown","closeDropdown","getSelectedOption","getFilteredOptions","selectOptionByIndex"]}}},get value(){return r()},set value(e=""){r(e),wt()},get options(){return a()},set options(e=[]){a(e),wt()},get placeholder(){return o()},set placeholder(e="Search..."){o(e),wt()},get disabled(){return n()},set disabled(e=!1){n(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get validationState(){return v()},set validationState(e="neutral"){v(e),wt()},get errorMessage(){return d()},set errorMessage(e=""){d(e),wt()},get helpText(){return p()},set helpText(e=""){p(e),wt()},get label(){return f()},set label(e=""){f(e),wt()},get searchPlaceholder(){return h()},set searchPlaceholder(e=""){h(e),wt()},get noOptionsMessage(){return g()},set noOptionsMessage(e="No options found"){g(e),wt()},get loadingMessage(){return m()},set loadingMessage(e="Loading..."){m(e),wt()},get isLoading(){return b()},set isLoading(e=!1){b(e),wt()},get maxHeight(){return y()},set maxHeight(e="300px"){y(e),wt()},get validationSchema(){return _()},set validationSchema(e={}){_(e),wt()},get onchange(){return w()},set onchange(e){w(e),wt()},get onfocus(){return C()},set onfocus(e){C(e),wt()},get onblur(){return x()},set onblur(e){x(e),wt()}})}ra(["input","keydown","click"]),customElements.define("alviere-search-select",Uo(mu,{value:{},options:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},validationState:{},errorMessage:{},helpText:{},label:{},searchPlaceholder:{},noOptionsMessage:{},loadingMessage:{},isLoading:{},maxHeight:{},validationSchema:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","openDropdown","closeDropdown","getSelectedOption","getFilteredOptions","selectOptionByIndex","getComponentMetadata"],!0));class bu{constructor(){this.cache=new Map}static getInstance(){return this.managerInstance||(this.managerInstance=new bu),this.managerInstance}getCacheKey(e){return`${e.jwt||""}:${e.publicCertificate||""}:${e.publicCertificateId||""}:${e.business_uuid||""}:${e.debug||!1}`}getOrCreate(e){const t=this.getCacheKey(e),r=this.cache.get(t);if(r)return this.logger=R(r.instance),this.logger.info("🔍 Returning cached AlviereCore instance...",r.instance),r.instance;const a=new Gl(e);return this.logger=R(a),this.logger.info("🔍 Creating new AlviereCore instance...",a),this.cache.set(t,{instance:a,key:{jwt:e.jwt||"",publicCertificate:e.publicCertificate||"",publicCertificateId:e.publicCertificateId||"",business_uuid:e.business_uuid||"",debug:e.debug||!1},createdAt:Date.now()}),a}updateOrCreate(e){const t=this.getCacheKey(e),r=this.cache.get(t);if(r)return r.instance.configure(e),r.instance;const a=e.jwt||"",o=Array.from(this.cache.entries());for(const[n,i]of o)i.key.jwt!==a&&this.cache.delete(n);return this.getOrCreate(e)}clearAll(){this.cache.clear()}clearForJwt(e){const t=[];for(const[r,a]of this.cache.entries())a.key.jwt===e&&t.push(r);t.forEach(e=>this.cache.delete(e))}getStats(){return{totalInstances:this.cache.size,instances:Array.from(this.cache.entries()).map(([e,t])=>({key:e,hasJwt:!!t.key.jwt,debug:t.key.debug,createdAt:new Date(t.createdAt).toISOString()}))}}has(e){const t=this.getCacheKey(e);return this.cache.has(t)}}const yu=bu.getInstance();function _u(e){return yu.getOrCreate(e)}const wu=Object.freeze(Object.defineProperty({__proto__:null,AlviereCoreManager:bu,getAlviereCore:_u},Symbol.toStringTag,{value:"Module"}));var Cu=ia('<div class="success-message svelte-hrmrx0">✅ Payment instrument created successfully! <br/> <small class="svelte-hrmrx0"> </small></div>'),xu=ia('<div class="error-message svelte-hrmrx0"> </div>'),Eu=ia('<div class="alviere-payment-instrument-form svelte-hrmrx0"><h2 class="svelte-hrmrx0">Add Payment Instrument</h2> <!> <!> <form novalidate=""><fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Card Information</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-row svelte-hrmrx0"><div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div></div> <div class="form-group svelte-hrmrx0"><!></div></fieldset> <fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Contact Information</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div></fieldset> <fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Billing Address</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-row svelte-hrmrx0"><div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><label for="country" class="svelte-hrmrx0">Country *</label> <select id="country" required class="svelte-hrmrx0"><option>United States</option><option>Canada</option><option>Mexico</option></select></div></div></fieldset> <fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Additional Information</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div></fieldset> <div class="form-actions svelte-hrmrx0"><button type="submit" class="submit-button svelte-hrmrx0"> </button></div></form></div>');const Su={hash:"svelte-hrmrx0",code:'@charset "UTF-8";.alviere-payment-instrument-form.svelte-hrmrx0 {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;}.alviere-payment-instrument-form.svelte-hrmrx0 h2:where(.svelte-hrmrx0) {color:#27272a;margin-bottom:2rem;text-align:center;}.alviere-payment-instrument-form.svelte-hrmrx0 fieldset:where(.svelte-hrmrx0) {border:1px solid #d4d4d8;border-radius:0.25rem;padding:1.5rem;margin-bottom:2rem;background:#ffffff;}.alviere-payment-instrument-form.svelte-hrmrx0 legend:where(.svelte-hrmrx0) {font-weight:600;color:#3f3f46;padding:0 0.5rem;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-group:where(.svelte-hrmrx0) {margin-bottom:1rem;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-row:where(.svelte-hrmrx0) {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-actions:where(.svelte-hrmrx0) {margin-top:24px;text-align:center;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-actions:where(.svelte-hrmrx0) button:where(.svelte-hrmrx0):disabled {opacity:0.6;cursor:not-allowed;}.alviere-payment-instrument-form.svelte-hrmrx0 .success-message:where(.svelte-hrmrx0) {padding:1rem;border-radius:0.25rem;margin-bottom:2rem;text-align:center;background:#d4edda;border:1px solid #c3e6cb;color:#155724;}.alviere-payment-instrument-form.svelte-hrmrx0 .error-message:where(.svelte-hrmrx0) {padding:1rem;border-radius:0.25rem;margin-bottom:2rem;text-align:center;background:#f8d7da;border:1px solid #f5c6cb;color:#721c24;}.alviere-payment-instrument-form.svelte-hrmrx0 .submit-button:where(.svelte-hrmrx0) {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#27272a;color:#ffffff;}.alviere-payment-instrument-form.svelte-hrmrx0 .submit-button:where(.svelte-hrmrx0):hover:not(:disabled) {background:#3f3f46;}.alviere-payment-instrument-form.svelte-hrmrx0 .submit-button:where(.svelte-hrmrx0):disabled {background:#52525b;cursor:not-allowed;} .alviere-payment-instrument-form.svelte-hrmrx0 select:where(.svelte-hrmrx0) {width:100%;padding:0.75rem;border:1px solid #d4d4d8;border-radius:0.25rem;font-size:1.25rem;line-height:1.5rem;transition:border-color 150ms ease-in-out;} .alviere-payment-instrument-form.svelte-hrmrx0 select:where(.svelte-hrmrx0):focus {outline:none;border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;} .alviere-payment-instrument-form.svelte-hrmrx0 select:where(.svelte-hrmrx0):disabled {background:#f4f4f5;cursor:not-allowed;}.alviere-payment-instrument-form.svelte-hrmrx0 label:where(.svelte-hrmrx0) {display:block;margin-bottom:0.5rem;font-weight:500;color:#3f3f46;}.alviere-payment-instrument-form.svelte-hrmrx0 small:where(.svelte-hrmrx0) {display:block;margin-top:4px;color:#52525b;font-size:1rem;}'};function ku(e,t){je(t,!0),Oa(e,Su);let r,a,o,n,i=zo(t,"jwt",15,""),l=zo(t,"accountUuid",15,""),s=zo(t,"debug",15,!1),c=zo(t,"onsuccess",15),u=zo(t,"onerror",15),v=Tt(Dt({pan:"",expiry:"",securityCode:"",nameOnCard:"",phoneNumber:"",emailAddress:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US",externalId:"",metadata:""})),d=Tt(""),p=Tt(!1),f=Tt(null),h=Tt(null);Zt(()=>{n=_u({jwt:i(),debug:s()})});var g=Eu(),m=Wt(Ht(g),2),b=e=>{var t=Cu(),r=Wt(Ht(t),3),a=Ht(r);Re(r),Re(t),ar(()=>{var e;return Ca(a,`ID: ${(null==(e=qr(h).payment_instrument)?void 0:e.payment_instrument_uuid)||"N/A"}`)}),va(e,t)};Ba(m,e=>{qr(h)&&e(b)});var y=Wt(m,2),_=e=>{var t=xu(),r=Ht(t);Re(t),ar(()=>Ca(r,`❌ ${qr(f)??""}`)),va(e,t)};Ba(y,e=>{qr(f)&&e(_)});var w=Wt(y,2),C=Ht(w),x=Wt(Ht(C),2);ko(qs(Ht(x),{id:"pan",label:"Card Number",placeholder:"Enter your card number",required:!0,get disabled(){return qr(p)},oninput:function(e){var t;qr(v).pan=e.rawValue,Bt(d,(null===(t=e.cardType)||void 0===t?void 0:t.name.toLowerCase())||"",!0)},get value(){return qr(v).pan},set value(e){qr(v).pan=e}}),e=>r=e,()=>r),Re(x);var E=Wt(x,2),S=Ht(E);ko(ac(Ht(S),{id:"expiry",label:"Expiry Date",placeholder:"MM/YY",required:!0,get disabled(){return qr(p)},oninput:function(e){qr(v).expiry=e.value},get value(){return qr(v).expiry},set value(e){qr(v).expiry=e}}),e=>o=e,()=>o),Re(S);var k=Wt(S,2);ko(Qs(Ht(k),{id:"securityCode",label:"Security Code",get cardType(){return qr(d)},required:!0,get disabled(){return qr(p)},oninput:function(e){qr(v).securityCode=e.rawValue},get value(){return qr(v).securityCode},set value(e){qr(v).securityCode=e}}),e=>a=e,()=>a),Re(k),Re(E);var A=Wt(E,2);Bc(Ht(A),{type:"text",id:"nameOnCard",placeholder:"John Doe",label:"Name on Card",required:!0,get disabled(){return qr(p)},autocomplete:"cc-name",validateAlphabetic:!0,validateMinLength:2,get value(){return qr(v).nameOnCard},set value(e){qr(v).nameOnCard=e}}),Re(A),Re(C);var T=Wt(C,2),I=Wt(Ht(T),2);Bc(Ht(I),{type:"text",id:"phoneNumber",placeholder:"+1 (555) 123-4567",label:"Phone Number",get disabled(){return qr(p)},autocomplete:"tel",validatePhone:!0,get value(){return qr(v).phoneNumber},set value(e){qr(v).phoneNumber=e}}),Re(I);var B=Wt(I,2);Bc(Ht(B),{type:"text",id:"emailAddress",placeholder:"john.doe@example.com",label:"Email Address",get disabled(){return qr(p)},autocomplete:"email",validateEmail:!0,get value(){return qr(v).emailAddress},set value(e){qr(v).emailAddress=e}}),Re(B),Re(T);var N=Wt(T,2),R=Wt(Ht(N),2);Bc(Ht(R),{type:"text",id:"addressLine1",placeholder:"123 Main St",label:"Address Line 1",required:!0,get disabled(){return qr(p)},autocomplete:"address-line1",get value(){return qr(v).addressLine1},set value(e){qr(v).addressLine1=e}}),Re(R);var z=Wt(R,2);Bc(Ht(z),{type:"text",id:"addressLine2",placeholder:"Apt 4B",label:"Address Line 2",get disabled(){return qr(p)},autocomplete:"address-line2",get value(){return qr(v).addressLine2},set value(e){qr(v).addressLine2=e}}),Re(z);var L=Wt(z,2),D=Ht(L);Bc(Ht(D),{type:"text",id:"city",placeholder:"New York",label:"City",required:!0,get disabled(){return qr(p)},autocomplete:"address-level2",get value(){return qr(v).city},set value(e){qr(v).city=e}}),Re(D);var U=Wt(D,2);Bc(Ht(U),{type:"text",id:"state",placeholder:"NY",label:"State",required:!0,get disabled(){return qr(p)},autocomplete:"address-level1",get value(){return qr(v).state},set value(e){qr(v).state=e}}),Re(U);var P=Wt(U,2);Bc(Ht(P),{type:"text",id:"postalCode",placeholder:"10001",label:"Postal Code",required:!0,get disabled(){return qr(p)},autocomplete:"postal-code",validatePostalCode:"US",get value(){return qr(v).postalCode},set value(e){qr(v).postalCode=e}}),Re(P);var V=Wt(P,2),M=Wt(Ht(V),2),O=Ht(M);O.value=O.__value="US";var j=Wt(O);j.value=j.__value="CA";var q=Wt(j);q.value=q.__value="MX",Re(M),Re(V),Re(L),Re(N);var F=Wt(N,2),K=Wt(Ht(F),2);Bc(Ht(K),{type:"text",id:"externalId",placeholder:"Optional external reference",label:"External ID",get disabled(){return qr(p)},helpText:"Optional unique identifier for this payment instrument",get value(){return qr(v).externalId},set value(e){qr(v).externalId=e}}),Re(K);var $=Wt(K,2);Bc(Ht($),{type:"textarea",id:"metadata",placeholder:"Optional JSON metadata",label:"Metadata",get disabled(){return qr(p)},rows:3,helpText:"Optional JSON data for additional information",get value(){return qr(v).metadata},set value(e){qr(v).metadata=e}}),Re($),Re(F);var H=Wt(F,2),G=Ht(H),W=Ht(G,!0);return Re(G),Re(H),Re(w),Re(g),ar(()=>{M.disabled=qr(p),G.disabled=qr(p),Ca(W,qr(p)?"Creating...":"Create Payment Instrument")}),ta("submit",w,async function(e){e.preventDefault(),Bt(f,null),Bt(h,null);const t=function(){if(!l())return"Account UUID is required";if(!qr(v).pan)return"Card number is required";if(!(null==r?void 0:r.isValidCard()))return(null==r?void 0:r.getValidationError())||"Please enter a valid card number";if(!qr(v).expiry)return"Expiry date is required";if(!(null==o?void 0:o.isValidExpiry()))return(null==o?void 0:o.getValidationError())||"Please enter a valid expiry date";return qr(v).securityCode?qr(v).nameOnCard?qr(v).addressLine1?qr(v).city?qr(v).state?qr(v).postalCode?qr(v).country?null:"Country is required":"Postal code is required":"State is required":"City is required":"Address line 1 is required":"Name on card is required":"Security code is required"}();if(t)Bt(f,t,!0);else{Bt(p,!0);try{const e=n.createPaymentInstrumentsService(),t=(null==o?void 0:o.getMonth())||"",r=(null==o?void 0:o.getYear())||"",a={account_uuid:l(),external_id:qr(v).externalId||`pi_${Date.now()}`,payment_instrument_type:"CARD",payment_instrument_details:{card:{pan:qr(v).pan,exp_month:t,exp_year:r,security_code:qr(v).securityCode,name_on_card:qr(v).nameOnCard,phone_number:qr(v).phoneNumber||void 0,email_address:qr(v).emailAddress||void 0,billing_address:{line_1:qr(v).addressLine1,line_2:qr(v).addressLine2||void 0,city:qr(v).city,state:qr(v).state,postal_code:qr(v).postalCode,country:qr(v).country}}},metadata:qr(v).metadata||void 0},i=await e.createPaymentInstrument(a);Bt(h,i,!0),null===c()||void 0===c()||c()(i),Bt(v,{pan:"",expiry:"",securityCode:"",nameOnCard:"",phoneNumber:"",emailAddress:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US",externalId:"",metadata:""},!0)}catch(a){const e=a instanceof Error?a:new Error("Unknown error occurred");Bt(f,e.message,!0),null===u()||void 0===u()||u()(e)}finally{Bt(p,!1)}}}),function(e,t,r=t){var a=!0;Jr(e,"change",t=>{var a,o=t?"[selected]":":checked";if(e.multiple)a=[].map.call(e.querySelectorAll(o),Xa);else{var n=e.querySelector(o)??e.querySelector("option:not([disabled])");a=n&&Xa(n)}r(a)}),tr(()=>{var o=t();if(Qa(e,o,a),a&&void 0===o){var n=e.querySelector(":checked");null!==n&&(o=Xa(n),r(o))}e.__value=o,a=!1}),Ja(e)}(M,()=>qr(v).country,e=>qr(v).country=e),va(e,g),qe({get jwt(){return i()},set jwt(e=""){i(e),wt()},get accountUuid(){return l()},set accountUuid(e=""){l(e),wt()},get debug(){return s()},set debug(e=!1){s(e),wt()},get onsuccess(){return c()},set onsuccess(e){c(e),wt()},get onerror(){return u()},set onerror(e){u(e),wt()}})}customElements.define("alviere-add-payment-instrument",Uo(ku,{jwt:{},accountUuid:{},debug:{},onsuccess:{},onerror:{}},[],[],!0));const Au=e=>e;function Tu(e,{delay:t=0,duration:r=400,easing:a=Au}={}){const o=+getComputedStyle(e).opacity;return{delay:t,duration:r,easing:a,css:e=>"opacity: "+e*o}}const Iu=(()=>{const{subscribe:e,set:t,update:r}=function(e,t=re){let r=null;const a=new Set;function o(t){if(Pe(e,t)&&(e=t,r)){const t=!To.length;for(const r of a)r[1](),To.push(r,e);if(t){for(let e=0;e<To.length;e+=2)To[e][0](To[e+1]);To.length=0}}}function n(t){o(t(e))}return{set:o,update:n,subscribe:function(i,l=re){const s=[i,l];return a.add(s),1===a.size&&(r=t(o,n)||re),i(e),()=>{a.delete(s),0===a.size&&r&&(r(),r=null)}}}}({core:null,isInitialized:!1,config:null});return{subscribe:e,init:async e=>{const t=e.debug||!1;if(e.jwt)try{t&&N.info("🔐 Initializing shared AlviereCore instance in store...");const{getAlviereCore:a}=await Promise.resolve().then(()=>wu),o=a(e);r(t=>({...t,core:o,isInitialized:!0,config:e})),t&&N.info("✅ Shared AlviereCore instance created in store:",{accountUuid:o.getAccountUuid(),businessUuid:o.getBusinessUuid(),isFirstTimeUser:o.isFirstTimeUser()})}catch(a){N.error("❌ Failed to initialize AlviereCore in store:",a)}else t&&N.warn("⚠️ Cannot initialize AlviereCore - missing JWT")},updateJwt:e=>{r(t=>{var r;if(!t.core||!t.config)return(null==(r=t.config)?void 0:r.debug)&&N.warn("⚠️ Cannot update JWT - core not initialized"),t;const a=t.config.debug||!1;return a&&N.info("🔄 Updating JWT in shared AlviereCore instance (store)..."),t.core.configure({...t.config,jwt:e}),a&&N.info("✅ Shared AlviereCore updated with new JWT (store):",{accountUuid:t.core.getAccountUuid(),businessUuid:t.core.getBusinessUuid(),isFirstTimeUser:t.core.isFirstTimeUser()}),{...t,config:{...t.config,jwt:e}}})},reset:()=>{t({core:null,isInitialized:!1,config:null})},getCore:()=>{let t=null;return e(e=>{t=e.core})(),t}}})(),Bu=Iu.init;Iu.updateJwt;const Nu=Iu.reset;function Ru(e){const{jwt:t="",businessUuid:r="",publicCertificate:a="",publicCertificateId:o="",debug:n=!1,isInFlow:i=!1,disabled:l=!1,readonly:s=!1,initialData:c={},submitHandler:u,customValidator:v,fieldSchemas:d={},formName:p="UnknownForm",stepType:f="FORM_STEP",stepIndex:h,enableAlviereCore:g=!0,resultTransformer:m,onSuccessCallback:b}=e;let y=Tt(!1),_=Tt(!1),w=Tt(!1),C=Tt(!1),x=Tt(0),E=Tt(0),S=Tt(0),k=Tt(null),A=Tt(null),T=Tt(null),I=Tt(Dt({...c})),B=Tt(Dt({})),R=Tt(Dt({})),z=Tt(!1),L=Tt(!1),D=Tt(Dt(t));const U=Dt(a),P=Dt(o);let V=Tt(null);Zt(()=>{if(g&&qr(D)&&""!==qr(D).trim()){const e=Iu.getCore();e?(Bt(V,e,!0),n&&N.info(`[${p}] ✅ Using shared AlviereCore instance from flow store`)):(n&&N.info(`[${p}] 🔍 Creating standalone AlviereCore instance...`),Bt(V,_u({jwt:qr(D),debug:n,publicCertificate:U,publicCertificateId:P,business_uuid:r}),!0)),r&&qr(V)&&n&&N.info(`[${p}] 🔍 User state check:`,{accountUuid:qr(V).getAccountUuid(),businessUuid:qr(V).getBusinessUuid(),isFirstTimeUser:qr(V).isFirstTimeUser(),isScopedToPayee:qr(V).isScopedToPayee()})}});const M=rt(()=>()=>0===Object.keys(qr(R)).length),O=rt(()=>()=>Object.keys(qr(R)).length>0),j=rt(()=>()=>qr(M)()&&!qr(O)()),q=rt(()=>()=>!qr(y)&&!qr(_)&&!l&&!s&&qr(j)()),F=rt(()=>()=>0===qr(x)?0:qr(E)/qr(x)*100),K=rt(()=>()=>{const e=Object.keys(qr(B)).length;if(0===e)return 100;return Object.values(qr(B)).filter(e=>e.isValid).length/e*100});async function $(){if(qr(q))try{Bt(_,!0),Bt(y,!0),Bt(A,null);if(!J())throw new Error("Form validation failed");if(v){const e=v(qr(I));if(!e.isValid)throw new Error(e.firstError||"Custom validation failed")}qr(X).dispatch(ks,{stepType:f,stepIndex:i?h:void 0,formData:{...qr(I)}});const e=await u(qr(I));Bt(k,e,!0),Rt(E),Rt(x),Bt(C,!0),Bt(z,!1),Bt(L,!1);const t=m?m(e):e;qr(X).dispatch(Es,{...t,stepType:f,stepIndex:i?h:void 0,success:!0}),null==b||b(e,qr(X))}catch(e){const t=e instanceof Error?e:new Error(String(e));Bt(A,t,!0),Rt(S),Rt(x),qr(X).dispatch(Ss,{data:t,stepType:f,stepIndex:i?h:void 0,success:!1,error:t}),N.error(`[${p}] Form submission failed:`,t)}finally{Bt(_,!1),Bt(y,!1)}else N.warn(`[${p}] Cannot submit: form validation failed or is disabled`)}function H(){Bt(I,{...c},!0),Bt(R,{},!0),Bt(B,{},!0),Bt(z,!1),Bt(L,!1),Bt(A,null),qr(X).dispatch(As,{stepType:f,stepIndex:i?h:void 0})}function G(e,t){qr(I)[e]=t,Bt(z,!0),Bt(L,!0),qr(B)[e]?qr(B)[e].value=t:qr(B)[e]={name:e,value:t,isValid:!0,errorMessage:"",hasInteracted:!1,validationSchema:d[e]},Q(e)}function W(e,t){qr(R)[e]=t,qr(B)[e]&&(qr(B)[e].isValid=!1,qr(B)[e].errorMessage=t)}function Y(e){delete qr(R)[e],qr(B)[e]&&(qr(B)[e].isValid=!0,qr(B)[e].errorMessage="")}function Q(e){const t=qr(I)[e],r=d[e];if(!r)return!0;const a=Ds(t,r,e);return a.isValid?(Y(e),!0):(W(e,a.firstError||"Validation failed"),!1)}function J(){let e=!0;for(const t of Object.keys(d)){Q(t)||(e=!1)}return e}const X=rt(()=>Zl(qr(T)));return{state:{get isLoading(){return qr(y)},get isSubmitting(){return qr(_)},get isPolling(){return qr(w)},get hasSubmitted(){return qr(C)},get totalSubmissions(){return qr(x)},get successCount(){return qr(E)},get errorCount(){return qr(S)},get lastResponse(){return qr(k)},get lastError(){return qr(A)},get formElement(){return qr(T)},set formElement(e){Bt(T,e,!0)},get formData(){return qr(I)},get fields(){return qr(B)},get validationErrors(){return qr(R)},get isValid(){return qr(j)()},get isDirty(){return qr(z)},get hasUnsavedChanges(){return qr(L)},get alviereCore(){return qr(V)}},computed:{get allFieldsValid(){return qr(M)()},get hasErrors(){return qr(O)()},get canSubmit(){return qr(q)()},get submitProgress(){return qr(F)()},get validationProgress(){return qr(K)()}},actions:{submit:$,reset:H,setFieldValue:G,getFieldValue:function(e){return qr(I)[e]},setFieldError:W,clearFieldError:Y,validateField:Q,validateAllFields:J,clearAllErrors:function(){Bt(R,{},!0);for(const e of Object.values(qr(B)))e.isValid=!0,e.errorMessage=""},setFormData:function(e){Bt(I,{...e},!0),Bt(z,!0),Bt(L,!0);for(const[t,r]of Object.entries(e))qr(B)[t]&&(qr(B)[t].value=r);J()},getFormData:function(){return{...qr(I)}},mergeFormData:function(e){Bt(I,{...qr(I),...e},!0),Bt(z,!0),Bt(L,!0),J()},markAsDirty:function(){Bt(z,!0),Bt(L,!0)},markAsClean:function(){Bt(z,!1),Bt(L,!1)},setLoading:function(e){Bt(y,e,!0)},setPolling:function(e){Bt(w,e,!0)},setJwt:function(e){e&&""!==e.trim()&&e!==qr(D)&&Bt(D,e,!0)}},handlers:{handleSubmit:async function(e){e.preventDefault(),await $()},handleReset:function(e){e.preventDefault(),H()},handleFieldChange:function(e,t){N.info("handleFieldChange",e,t),G(e,t),Y(e),Q(e)},handleFieldBlur:function(e){qr(B)[e]&&(qr(B)[e].hasInteracted=!0),Q(e)}},get eventDispatcher(){return qr(X)}}}Iu.getCore;var zu=ia('<h2 class="svelte-hf49ea">Create Consumer Account</h2>'),Lu=ia('<div><alviere-spinner><span slot="message"><!></span></alviere-spinner></div>',2),Du=ia('<span class="validation-hint svelte-hf49ea">Please fill in all required fields to continue</span>'),Uu=ia('<span class="validation-error">Please fix the errors above</span>'),Pu=ia('<div class="alviere-create-consumer-account svelte-hf49ea"><!> <!> <form novalidate=""><div class="form-section svelte-hf49ea"><h3 class="svelte-hf49ea">Personal Information</h3> <div class="form-row svelte-hf49ea"><!> <!></div> <div class="form-row svelte-hf49ea"><!></div></div> <div class="form-actions svelte-hf49ea"><div class="form-status svelte-hf49ea"><!> <!></div> <alviere-button><!></alviere-button></div></form></div>',2);const Vu={hash:"svelte-hf49ea",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-create-consumer-account.svelte-hf49ea {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;position:relative;}.spinner-container.svelte-hf49ea {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}.spinner-standalone.svelte-hf49ea {position:relative !important;min-height:200px;display:flex;align-items:center;justify-content:center;}h2.svelte-hf49ea {color:#333;margin-bottom:20px;text-align:center;}h3.svelte-hf49ea {color:#555;margin-bottom:15px;border-bottom:2px solid #eee;padding-bottom:5px;}.form-section.svelte-hf49ea {margin-bottom:30px;padding:20px;background:#f9f9f9;border-radius:8px;}.form-row.svelte-hf49ea {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.form-status.svelte-hf49ea {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-hf49ea {color:#6b7280;font-size:0.875rem;font-style:italic;}.form-actions.svelte-hf49ea {margin-top:24px;text-align:center;}'};function Mu(e,t){je(t,!0),Oa(e,Vu);let r=zo(t,"jwt",7,""),a=zo(t,"businessUuid",15,""),o=zo(t,"isInFlow",15,!1),n=zo(t,"debug",15,!0),i=zo(t,"prefillData",31,()=>Dt({})),l=zo(t,"publicCertificate",15,""),s=zo(t,"publicCertificateId",15,""),c=Tt(!1);const u=Ru({jwt:r(),businessUuid:a(),publicCertificate:l(),publicCertificateId:s(),debug:n(),isInFlow:o(),initialData:{externalId:"",firstName:"",middleName:"",lastName:"",email:"",phone:"",dateOfBirth:"",ssn:"",employmentStatus:"FULL_TIME",profession:"",addressLabel:"Primary Address",addressLine1:"",addressLine2:"",addressCity:"",addressState:"",addressPostalCode:"",addressCountry:"USA"},fieldSchemas:{firstName:{required:"First Name is required",alphabetic:!0},lastName:{required:"Last Name is required",alphabetic:!0},email:{required:"Email Address is required",email:!0},phone:{phone:!0},dateOfBirth:{date:!0},ssn:{pattern:{regex:/^\d{3}-?\d{2}-?\d{4}$/,message:"Please enter a valid SSN"}},addressCity:{alphabetic:!0},addressPostalCode:{postalCode:!0}},formName:"CreateConsumerAccount",stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:o()?0:void 0,enableAlviereCore:!0,submitHandler:async e=>{var t,r;const o={first_name:e.firstName,last_name:e.lastName,email_address:e.email},n={external_id:e.externalId||`consumer-${Date.now()}`,information:{consumer_information:o},profile:i().profile||void 0,account_type:"CONSUMER",parent_account_uuid:a()};null===(r=null===(t=u.state.alviereCore)||void 0===t?void 0:t.getLogger())||void 0===r||r.info("🔍 Creating account using AlviereCore...");const l=u.state.alviereCore.createAccountsService();try{const e=await l.createAccount(n);if(e.account.account_uuid&&qr(f)){const t=new CustomEvent(Rs,{detail:{account_uuid:e.account.account_uuid,status:"CREATED"},bubbles:!0,composed:!0});qr(f).dispatchEvent(t),N.info("🚀 Dispatched account CREATED event:",t.detail)}if(e.account.account_uuid){u.actions.setPolling(!0);try{const t=await async function(e,t=5,r=6e3){if(!u.state.alviereCore)throw new Error("AlviereCore not initialized");const a=u.state.alviereCore.createAccountsService();for(let n=1;n<=t;n++)try{N.info(`🔍 Polling account status (attempt ${n}/${t})...`);const o=await a.getAccount(e);if("ACTIVE"===o.account.status)return N.info("✅ Account is now ACTIVE"),o;N.info(`⏳ Account status: ${o.account.status}, waiting...`),n<t&&await new Promise(e=>setTimeout(e,r))}catch(o){if(N.error(`❌ Error polling account status (attempt ${n}):`,o),n===t)throw new Error(`Failed to poll account status after ${t} attempts: ${o}`)}throw new ll("115001",`Account did not become active after ${t} polling attempts`)}(e.account.account_uuid);return t}finally{u.actions.setPolling(!1)}}return e}catch(s){if(s instanceof ll&&s.isErrorCode(wl))throw N.info("🔍 Error creating account:","Invalid JWT"),s;throw s}},resultTransformer:e=>({account_uuid:e.account.account_uuid}),onSuccessCallback:(e,t)=>{t.dispatch(Rs,{account_uuid:e.account.account_uuid,status:e.account.status})}});let v=Tt(!1),d=Tt(!1),p=Tt(!1),f=Tt(null);Ta(async()=>{var e,t;if(Bt(v,!0),null===(e=u.state.alviereCore)||void 0===e?void 0:e.isScopedToPayee()){const e=u.state.alviereCore.getAccountUuid();if(N.info("🔄 Returning user detected - JWT already scoped to consumer account:",e),e&&"862a2524-ce32-4fa7-b138-e7ac7e93c022"!==e)try{const t=await async function(e){if(N.info("🔍 Checking if account exists and is active...",e),N.warn("🔍 Debug:",n()),!u.state.alviereCore)throw new Error("AlviereCore not initialized");const t=u.state.alviereCore.createAccountsService(),r=await t.getAccount(e);if(N.info("🔍 Account result:",r.account),"ACTIVE"===r.account.status)return r;throw N.error(`❌ Account exists but is not active. Status: ${r.account.status}`,r.account),new ll(Tl,`Account exists but is not active. Current status: ${r.account.status}`)}(e);if(t)return N.info("✅ Consumer account already exists and is active - skipping creation:",t),Bt(p,!0),void setTimeout(()=>{if(qr(f)){const e=new CustomEvent(Rs,{detail:{account_uuid:t.account.account_uuid,status:t.account.status,skipped:!0},bubbles:!0,composed:!0});qr(f).dispatchEvent(e),N.info("🚀 Dispatched account event (skipped) from host element:",e);const r=new CustomEvent(Es,{detail:{account_uuid:t.account.account_uuid,stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:o()?0:void 0,success:!0,skipped:!0},bubbles:!0,composed:!0});qr(f).dispatchEvent(r),N.info("🚀 Dispatched form-success event (skipped) from host element:",r)}},100)}catch(r){if(r instanceof ll&&r.isErrorCode(Tl)){if(N.error("❌ Critical error: Account exists but is not active"),qr(f)){const e=new CustomEvent(Ss,{detail:{error:r,stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:o()?0:void 0},bubbles:!0,composed:!0});qr(f).dispatchEvent(e),N.info("🚀 Dispatched form-error event to MultiStepFlow:",e.detail)}return}N.warn("⚠️ Failed to fetch existing account, will show form:",r)}}else(null===(t=u.state.alviereCore)||void 0===t?void 0:t.isFirstTimeUser())&&N.info("👤 First-time user detected - showing account creation form");setTimeout(()=>{Bt(v,!1)},1e3)}),Zt(()=>{if("undefined"!=typeof window&&window.customElements&&qr(f)&&!qr(c)){n()&&N.info("Found web component element for attribute reflection for:",qr(f));const e=null===qr(f)||void 0===qr(f)?void 0:qr(f).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();if(e.includes("prefill-data")){const e=t.getAttribute("prefill-data");e&&(i(JSON.parse(e)),async function(){var e,t,r,a,o,n,l,s,c,v,f,h,g,m,b,y,_,w,C,x,E;const S=e=>null==e?"":String(e);u.state.formData.firstName=S(null===(t=null===(e=i().information)||void 0===e?void 0:e.consumer_information)||void 0===t?void 0:t.first_name),u.state.formData.middleName=S(null===(a=null===(r=i().information)||void 0===r?void 0:r.consumer_information)||void 0===a?void 0:a.middle_name),u.state.formData.lastName=S(null===(n=null===(o=i().information)||void 0===o?void 0:o.consumer_information)||void 0===n?void 0:n.last_name),u.state.formData.email=S(null===(s=null===(l=i().information)||void 0===l?void 0:l.consumer_information)||void 0===s?void 0:s.email_address),u.state.formData.phone=S(null===(v=null===(c=i().information)||void 0===c?void 0:c.consumer_information)||void 0===v?void 0:v.phone_number),u.state.formData.dateOfBirth=S(null===(h=null===(f=i().information)||void 0===f?void 0:f.consumer_information)||void 0===h?void 0:h.date_of_birth),u.state.formData.ssn=S(null===(m=null===(g=i().information)||void 0===g?void 0:g.consumer_information)||void 0===m?void 0:m.ssn),u.state.formData.addressLine1=S(null===(b=i().primary_address)||void 0===b?void 0:b.address_line_1),u.state.formData.addressLine2=S(null===(y=i().primary_address)||void 0===y?void 0:y.address_line_2),u.state.formData.addressCity=S(null===(_=i().primary_address)||void 0===_?void 0:_.city),u.state.formData.addressState=S(null===(w=i().primary_address)||void 0===w?void 0:w.state),u.state.formData.addressPostalCode=S(null===(C=i().primary_address)||void 0===C?void 0:C.postal_code),u.state.formData.addressCountry=S(null===(x=i().primary_address)||void 0===x?void 0:x.country)||"USA";const k=u.actions.validateAllFields();if(null===(E=u.state.alviereCore)||void 0===E?void 0:E.isScopedToPayee())return N.info("🔄 Skipping auto-submit - returning user detected, checking existing account..."),Bt(d,!1),void Bt(p,!0);k?(N.info("✅ Prefilled data is complete and valid, auto-submitting form..."),Bt(d,!0),setTimeout(async()=>{await u.actions.submit()},100)):(N.warn("⚠️ Prefilled data is incomplete or invalid, waiting for user input"),Bt(d,!1))}())}if(e.includes("public-certificate")){const e=t.getAttribute("public-certificate");e&&l(e)}if(e.includes("public-certificate-id")){const e=t.getAttribute("public-certificate-id");e&&s(e)}}}Bt(c,!0)});var h=Pu(),g=Ht(h),m=e=>{va(e,zu())};Ba(g,e=>{o()||qr(d)||qr(v)||qr(p)||e(m)});var b=Wt(g,2),y=e=>{var t=Lu();let r;var a=Ht(t);so(a,"size","lg"),so(a,"variant","circular");var o=Ht(a),n=Ht(o),i=e=>{va(e,ca("Account verified, proceeding..."))},l=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Checking account status..."))},o=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Your account is being validated..."))},o=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for account activation..."))},o=e=>{va(e,ca("Creating consumer account..."))};Ba(r,e=>{u.state.isPolling?e(a):e(o,!1)},!0),va(e,t)};Ba(r,e=>{qr(d)?e(a):e(o,!1)},!0),va(e,t)};Ba(r,e=>{qr(v)?e(a):e(o,!1)},!0),va(e,t)};Ba(n,e=>{qr(p)?e(i):e(l,!1)}),Re(o),Re(a),Re(t),ar(e=>r=Ga(t,1,"spinner-container svelte-hf49ea",null,r,e),[()=>({"spinner-standalone":qr(v)||qr(d)||qr(p)})]),_o(1,t,()=>Tu,()=>({duration:300})),_o(2,t,()=>Tu,()=>({duration:200})),va(e,t)};Ba(b,e=>{(u.state.isLoading||u.state.isPolling||qr(d)||qr(v)||qr(p))&&e(y)});var _=Wt(b,2);let w;var C=Ht(_),x=Wt(Ht(C),2),E=Ht(x);{let e=rt(()=>u.state.validationErrors.firstName?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.firstName||"");Bc(E,{label:"First Name",placeholder:"Enter first name",required:!0,oninput:e=>u.handlers.handleFieldChange("firstName",e.target.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return u.state.formData.firstName},set value(e){u.state.formData.firstName=e}})}var S=Wt(E,2);{let e=rt(()=>u.state.validationErrors.lastName?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.lastName||"");Bc(S,{label:"Last Name",placeholder:"Enter last name",required:!0,oninput:e=>u.handlers.handleFieldChange("lastName",e.target.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return u.state.formData.lastName},set value(e){u.state.formData.lastName=e}})}Re(x);var k=Wt(x,2),A=Ht(k);{let e=rt(()=>u.state.validationErrors.email?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.email||"");Bc(A,{label:"Email Address",placeholder:"Enter email address",type:"email",required:!0,oninput:e=>u.handlers.handleFieldChange("email",e.target.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return u.state.formData.email},set value(e){u.state.formData.email=e}})}Re(k),Re(C);var T=Wt(C,2),I=Ht(T),B=Ht(I),R=e=>{va(e,Du())};Ba(B,e=>{u.computed.canSubmit||e(R)});var z=Wt(B,2),L=e=>{va(e,Uu())};Ba(z,e=>{u.computed.hasErrors&&u.computed.canSubmit&&e(L)}),Re(I);var D=Wt(I,2);so(D,"type","submit"),ar(()=>so(D,"disabled",!u.computed.canSubmit)),so(D,"variant","primary"),so(D,"size","md"),ar(()=>so(D,"handler",u.handlers.handleSubmit));var U=Ht(D),P=e=>{va(e,ca("Creating Consumer Account..."))},V=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for Account Activation..."))},o=e=>{va(e,ca("Create Consumer Account"))};Ba(r,e=>{u.state.isPolling?e(a):e(o,!1)},!0),va(e,t)};return Ba(U,e=>{u.state.isLoading?e(P):e(V,!1)}),Re(D),Re(T),Re(_),ko(_,e=>u.state.formElement=e,()=>{var e;return null==(e=null==u?void 0:u.state)?void 0:e.formElement}),Re(h),ko(h,e=>Bt(f,e),()=>qr(f)),ar(e=>w=Ya(_,"",w,e),[()=>({display:qr(v)||qr(d)||qr(p)?"none":"block"})]),ta("submit",_,function(...e){var t;null==(t=u.handlers.handleSubmit)||t.apply(this,e)}),va(e,h),qe({get jwt(){return r()},set jwt(e=""){r(e),wt()},get businessUuid(){return a()},set businessUuid(e=""){a(e),wt()},get isInFlow(){return o()},set isInFlow(e=!1){o(e),wt()},get debug(){return n()},set debug(e=!0){n(e),wt()},get prefillData(){return i()},set prefillData(e={}){i(e),wt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),wt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),wt()}})}customElements.define("alviere-create-consumer-account",Uo(Mu,{jwt:{},businessUuid:{},isInFlow:{},debug:{},prefillData:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var Ou=ia('<h2 class="svelte-5gpp4o">Create Business Account</h2>'),ju=ia('<div><alviere-spinner><span slot="message"><!></span></alviere-spinner></div>',2),qu=ia('<span class="validation-hint svelte-5gpp4o">Please fill in all required fields to continue</span>'),Fu=ia('<span class="validation-error">Please fix the errors above</span>'),Ku=ia('<div class="alviere-create-business-account svelte-5gpp4o"><!> <!> <form novalidate=""><div class="form-section svelte-5gpp4o"><h3 class="svelte-5gpp4o">Business Information</h3> <div class="form-row svelte-5gpp4o"><!> <!></div> <div class="form-row svelte-5gpp4o"><!> <!></div> <div class="form-row svelte-5gpp4o"><!></div></div> <div class="form-actions svelte-5gpp4o"><div class="form-status svelte-5gpp4o"><!> <!></div> <alviere-button><!></alviere-button></div></form></div>',2);const $u={hash:"svelte-5gpp4o",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-create-business-account.svelte-5gpp4o {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;position:relative;}.spinner-container.svelte-5gpp4o {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}.spinner-standalone.svelte-5gpp4o {position:relative !important;min-height:200px;display:flex;align-items:center;justify-content:center;}h2.svelte-5gpp4o {color:#333;margin-bottom:20px;text-align:center;}h3.svelte-5gpp4o {color:#555;margin-bottom:15px;border-bottom:2px solid #eee;padding-bottom:5px;}.form-section.svelte-5gpp4o {margin-bottom:30px;padding:20px;background:#f9f9f9;border-radius:8px;}.form-row.svelte-5gpp4o {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.form-status.svelte-5gpp4o {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-5gpp4o {color:#6b7280;font-size:0.875rem;font-style:italic;}.form-actions.svelte-5gpp4o {margin-top:24px;text-align:center;}'};function Hu(e,t){var r,a;je(t,!0),Oa(e,$u);let o=zo(t,"jwt",7,""),n=zo(t,"businessUuid",15,""),i=zo(t,"isInFlow",15,!1),l=zo(t,"debug",15,!0),s=zo(t,"prefillData",31,()=>Dt({})),c=zo(t,"publicCertificate",15,""),u=zo(t,"publicCertificateId",15,""),v=Tt(!1);const d={externalId:"",businessType:(null===(a=null===(r=null===s()||void 0===s()?void 0:s().information)||void 0===r?void 0:r.business_information)||void 0===a?void 0:a.business_type)||"SOLE_PROPRIETORSHIP",businessName:"",doingBusinessAs:"",stateOfIncorporation:"",countryOfIncorporation:"",incorporationDate:"",ein:"",addressLabel:"Primary Address",addressLine1:"",addressLine2:"",addressCity:"",addressState:"",addressPostalCode:"",addressCountry:"USA"},p=[{value:"SOLE_PROPRIETORSHIP",label:"Sole Proprietorship"},{value:"LLC",label:"LLC"},{value:"LLP",label:"LLP"},{value:"CORPORATION_C",label:"Corporation C"},{value:"CORPORATION_S",label:"Corporation S"}],f=[{code:"AL",name:"Alabama"},{code:"AK",name:"Alaska"},{code:"AZ",name:"Arizona"},{code:"AR",name:"Arkansas"},{code:"CA",name:"California"},{code:"CO",name:"Colorado"},{code:"CT",name:"Connecticut"},{code:"DE",name:"Delaware"},{code:"FL",name:"Florida"},{code:"GA",name:"Georgia"},{code:"HI",name:"Hawaii"},{code:"ID",name:"Idaho"},{code:"IL",name:"Illinois"},{code:"IN",name:"Indiana"},{code:"IA",name:"Iowa"},{code:"KS",name:"Kansas"},{code:"KY",name:"Kentucky"},{code:"LA",name:"Louisiana"},{code:"ME",name:"Maine"},{code:"MD",name:"Maryland"},{code:"MA",name:"Massachusetts"},{code:"MI",name:"Michigan"},{code:"MN",name:"Minnesota"},{code:"MS",name:"Mississippi"},{code:"MO",name:"Missouri"},{code:"MT",name:"Montana"},{code:"NE",name:"Nebraska"},{code:"NV",name:"Nevada"},{code:"NH",name:"New Hampshire"},{code:"NJ",name:"New Jersey"},{code:"NM",name:"New Mexico"},{code:"NY",name:"New York"},{code:"NC",name:"North Carolina"},{code:"ND",name:"North Dakota"},{code:"OH",name:"Ohio"},{code:"OK",name:"Oklahoma"},{code:"OR",name:"Oregon"},{code:"PA",name:"Pennsylvania"},{code:"RI",name:"Rhode Island"},{code:"SC",name:"South Carolina"},{code:"SD",name:"South Dakota"},{code:"TN",name:"Tennessee"},{code:"TX",name:"Texas"},{code:"UT",name:"Utah"},{code:"VT",name:"Vermont"},{code:"VA",name:"Virginia"},{code:"WA",name:"Washington"},{code:"WV",name:"West Virginia"},{code:"WI",name:"Wisconsin"},{code:"WY",name:"Wyoming"},{code:"DC",name:"District of Columbia"},{code:"AS",name:"American Samoa"},{code:"GU",name:"Guam"},{code:"MP",name:"Northern Mariana Islands"},{code:"PR",name:"Puerto Rico"},{code:"VI",name:"U.S. Virgin Islands"}],h=[{value:"USA",label:"United States"},{value:"CAN",label:"Canada"},{value:"MEX",label:"Mexico"},{value:"GBR",label:"United Kingdom"}],g=Ru({jwt:o(),businessUuid:n(),publicCertificate:c(),publicCertificateId:u(),debug:l(),isInFlow:i(),initialData:d,fieldSchemas:{businessType:{required:"Business Type is required"},businessName:{required:"Business Name is required",alphabetic:!0},countryOfIncorporation:{required:"Country of Incorporation is required"},stateOfIncorporation:{required:"State of Incorporation is required"},ein:{required:"EIN is required",pattern:{regex:/^\d{2}-\d{7}$/,message:"Please enter a valid EIN"}}},formName:"CreateBusinessAccount",stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0,enableAlviereCore:!0,submitHandler:async e=>{var t,r;const a={business_type:e.businessType,business_name:e.businessName,state_of_incorporation:e.stateOfIncorporation,country_of_incorporation:e.countryOfIncorporation,ein:e.ein||void 0},o={external_id:e.externalId||`business-${Date.now()}`,information:{business_information:a},profile:s().profile||void 0,account_type:"BUSINESS",parent_account_uuid:n()};if(!g.state.alviereCore)throw new ll(sl,"AlviereCore not initialized");null===(r=null===(t=g.state.alviereCore)||void 0===t?void 0:t.getLogger())||void 0===r||r.info("🔍 Creating business account using AlviereCore...");const i=g.state.alviereCore.createAccountsService(),l=await i.createAccount(o);if(l.account.account_uuid&&qr(_)){const e=new CustomEvent(Rs,{detail:{account_uuid:l.account.account_uuid,status:"CREATED"},bubbles:!0,composed:!0});qr(_).dispatchEvent(e),N.info("🚀 Dispatched account CREATED event:",e.detail)}if(l.account.account_uuid){g.actions.setPolling(!0);try{const e=await async function(e,t=5,r=6e3){if(!g.state.alviereCore)throw new Error("AlviereCore not initialized");const a=g.state.alviereCore.createAccountsService();for(let n=1;n<=t;n++)try{N.info(`🔍 Polling account status (attempt ${n}/${t})...`);const o=await a.getAccount(e);if("ACTIVE"===o.account.status)return N.info("✅ Account is now ACTIVE"),o;N.info(`⏳ Account status: ${o.account.status}, waiting...`),n<t&&await new Promise(e=>setTimeout(e,r))}catch(o){if(N.error(`❌ Error polling account status (attempt ${n}):`,o),n===t)throw new Error(`Failed to poll account status after ${t} attempts: ${o}`)}throw new ll("115001",`Account did not become active after ${t} polling attempts`)}(l.account.account_uuid);return e}finally{g.actions.setPolling(!1)}}return l},resultTransformer:e=>({account_uuid:e.account.account_uuid}),onSuccessCallback:(e,t)=>{t.dispatch(Rs,{account_uuid:e.account.account_uuid,status:e.account.status})}});let m=Tt(!1),b=Tt(!1),y=Tt(!1),_=Tt(null);Ta(async()=>{var e,t;if(Bt(m,!0),null===(e=g.state.alviereCore)||void 0===e?void 0:e.isScopedToPayee()){const e=g.state.alviereCore.getAccountUuid();if(N.info("🔄 Returning user detected - JWT already scoped to payor account:",e),e&&"862a2524-ce32-4fa7-b138-e7ac7e93c022"!==e)try{const t=await async function(e){if(N.info("🔍 Checking if account exists and is active...",e),N.warn("🔍 Debug:",l()),!g.state.alviereCore)throw new Error("AlviereCore not initialized");const t=g.state.alviereCore.createAccountsService(),r=await t.getAccount(e);if(N.info("🔍 Account result:",r.account),"ACTIVE"===r.account.status)return r;throw N.error(`❌ Account exists but is not active. Status: ${r.account.status}`,r.account),new ll(Tl,`Account exists but is not active. Current status: ${r.account.status}`)}(e);if(t)return N.info("✅ Business account already exists and is active - skipping creation:",t),Bt(y,!0),void setTimeout(()=>{if(qr(_)){const e=new CustomEvent(Rs,{detail:{account_uuid:t.account.account_uuid,status:t.account.status,skipped:!0},bubbles:!0,composed:!0});qr(_).dispatchEvent(e),N.info("🚀 Dispatched account event (skipped) from host element:",e);const r=new CustomEvent(Es,{detail:{account_uuid:t.account.account_uuid,stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0,success:!0,skipped:!0},bubbles:!0,composed:!0});qr(_).dispatchEvent(r),N.info("🚀 Dispatched form-success event (skipped) from host element:",r)}},100)}catch(r){if(r instanceof ll&&r.isErrorCode(Tl)){if(N.error("❌ Critical error: Account exists but is not active"),qr(_)){const e=new CustomEvent(Ss,{detail:{error:r,stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0},bubbles:!0,composed:!0});qr(_).dispatchEvent(e),N.info("🚀 Dispatched form-error event to MultiStepFlow:",e.detail)}return}N.warn("⚠️ Failed to fetch existing account, will show form:",r)}}else(null===(t=g.state.alviereCore)||void 0===t?void 0:t.isFirstTimeUser())&&N.info("👤 First-time user detected - showing account creation form");setTimeout(()=>{Bt(m,!1)},1e3)}),Zt(()=>{if("undefined"!=typeof window&&window.customElements&&qr(_)&&!qr(v)){l()&&N.info("Found web component element for attribute reflection for:",qr(_));const e=null===qr(_)||void 0===qr(_)?void 0:qr(_).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();if(e.includes("prefill-data")){const e=t.getAttribute("prefill-data");e&&(s(JSON.parse(e)),async function(){var e,t,r,a,o,n,i,l,c,u,v,d,p,f,h,m,_,w,C,x,E;const S=e=>null==e?"":String(e);g.state.formData.businessType=S(null===(t=null===(e=s().information)||void 0===e?void 0:e.business_information)||void 0===t?void 0:t.business_type),g.state.formData.businessName=S(null===(a=null===(r=s().information)||void 0===r?void 0:r.business_information)||void 0===a?void 0:a.business_name),g.state.formData.doingBusinessAs=S(null===(n=null===(o=s().information)||void 0===o?void 0:o.business_information)||void 0===n?void 0:n.doing_business_as),g.state.formData.stateOfIncorporation=S(null===(l=null===(i=s().information)||void 0===i?void 0:i.business_information)||void 0===l?void 0:l.state_of_incorporation),g.state.formData.countryOfIncorporation=S(null===(u=null===(c=s().information)||void 0===c?void 0:c.business_information)||void 0===u?void 0:u.country_of_incorporation),g.state.formData.incorporationDate=S(null===(d=null===(v=s().information)||void 0===v?void 0:v.business_information)||void 0===d?void 0:d.incorporation_date),g.state.formData.ein=S(null===(f=null===(p=s().information)||void 0===p?void 0:p.business_information)||void 0===f?void 0:f.ein),g.state.formData.addressLine1=S(null===(h=s().primary_address)||void 0===h?void 0:h.address_line_1),g.state.formData.addressLine2=S(null===(m=s().primary_address)||void 0===m?void 0:m.address_line_2),g.state.formData.addressCity=S(null===(_=s().primary_address)||void 0===_?void 0:_.city),g.state.formData.addressState=S(null===(w=s().primary_address)||void 0===w?void 0:w.state),g.state.formData.addressPostalCode=S(null===(C=s().primary_address)||void 0===C?void 0:C.postal_code),g.state.formData.addressCountry=S(null===(x=s().primary_address)||void 0===x?void 0:x.country)||"USA";const k=g.actions.validateAllFields();if(null===(E=g.state.alviereCore)||void 0===E?void 0:E.isScopedToPayee())return N.info("🔄 Skipping auto-submit - returning user detected, checking existing account..."),Bt(b,!1),void Bt(y,!0);k?(N.info("✅ Prefilled data is complete and valid, auto-submitting form..."),Bt(b,!0),setTimeout(async()=>{await g.actions.submit()},100)):(N.warn("⚠️ Prefilled data is incomplete or invalid, waiting for user input"),Bt(b,!1))}())}if(e.includes("public-certificate")){const e=t.getAttribute("public-certificate");e&&c(e)}if(e.includes("public-certificate-id")){const e=t.getAttribute("public-certificate-id");e&&u(e)}}}Bt(v,!0)});var w=Ku(),C=Ht(w),x=e=>{va(e,Ou())};Ba(C,e=>{i()||qr(b)||qr(m)||qr(y)||e(x)});var E=Wt(C,2),S=e=>{var t=ju();let r;var a=Ht(t);so(a,"size","lg"),so(a,"variant","circular");var o=Ht(a),n=Ht(o),i=e=>{va(e,ca("Account verified, proceeding..."))},l=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Checking account status..."))},o=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Your account is being validated..."))},o=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for account activation..."))},o=e=>{va(e,ca("Creating business account..."))};Ba(r,e=>{g.state.isPolling?e(a):e(o,!1)},!0),va(e,t)};Ba(r,e=>{qr(b)?e(a):e(o,!1)},!0),va(e,t)};Ba(r,e=>{qr(m)?e(a):e(o,!1)},!0),va(e,t)};Ba(n,e=>{qr(y)?e(i):e(l,!1)}),Re(o),Re(a),Re(t),ar(e=>r=Ga(t,1,"spinner-container svelte-5gpp4o",null,r,e),[()=>({"spinner-standalone":qr(m)||qr(b)||qr(y)})]),_o(1,t,()=>Tu,()=>({duration:300})),_o(2,t,()=>Tu,()=>({duration:200})),va(e,t)};Ba(E,e=>{(g.state.isLoading||g.state.isPolling||qr(b)||qr(m)||qr(y))&&e(S)});var k=Wt(E,2);let A;var T=Ht(k),I=Wt(Ht(T),2),B=Ht(I);{let e=rt(()=>g.state.validationErrors.businessType?"invalid":"neutral"),t=rt(()=>g.state.validationErrors.businessType||"");mu(B,{label:"Business Type",get options(){return p},placeholder:"Select business type",required:!0,onchange:e=>g.handlers.handleFieldChange("businessType",e.detail.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return g.state.formData.businessType},set value(e){g.state.formData.businessType=e}})}Bc(Wt(B,2),{label:"Business Name",placeholder:"Enter business name",required:!0,oninput:e=>{var t;return g.handlers.handleFieldChange("businessName",(null==(t=e.target)?void 0:t.value)||"")},get value(){return g.state.formData.businessName},set value(e){g.state.formData.businessName=e}}),Re(I);var R=Wt(I,2),z=Ht(R);{let e=rt(()=>g.state.validationErrors.countryOfIncorporation?"invalid":"neutral"),t=rt(()=>g.state.validationErrors.countryOfIncorporation||"");mu(z,{label:"Country of Incorporation",get options(){return h},placeholder:"Select country of incorporation",required:!0,onchange:e=>g.handlers.handleFieldChange("countryOfIncorporation",e.detail.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return g.state.formData.countryOfIncorporation},set value(e){g.state.formData.countryOfIncorporation=e}})}var L=Wt(z,2);{let e=rt(()=>f.map(e=>({value:e.code,label:e.name}))),t=rt(()=>g.state.validationErrors.stateOfIncorporation?"invalid":"neutral"),r=rt(()=>g.state.validationErrors.stateOfIncorporation||"");mu(L,{label:"State of Incorporation",get options(){return qr(e)},placeholder:"Select state of incorporation",required:!0,onchange:e=>g.handlers.handleFieldChange("stateOfIncorporation",e.detail.value),get validationState(){return qr(t)},get errorMessage(){return qr(r)},get value(){return g.state.formData.stateOfIncorporation},set value(e){g.state.formData.stateOfIncorporation=e}})}Re(R);var D=Wt(R,2),U=Ht(D);{let e=rt(()=>g.state.validationErrors.ein?"invalid":"neutral"),t=rt(()=>g.state.validationErrors.ein||"");Bc(U,{label:"EIN",placeholder:"Enter EIN",required:!0,oninput:e=>{var t;return g.handlers.handleFieldChange("ein",(null==(t=e.target)?void 0:t.value)||"")},get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return g.state.formData.ein},set value(e){g.state.formData.ein=e}})}Re(D),Re(T);var P=Wt(T,2),V=Ht(P),M=Ht(V),O=e=>{va(e,qu())};Ba(M,e=>{g.computed.canSubmit||e(O)});var j=Wt(M,2),q=e=>{va(e,Fu())};Ba(j,e=>{g.computed.hasErrors&&e(q)}),Re(V);var F=Wt(V,2);so(F,"type","submit"),ar(()=>so(F,"disabled",!g.computed.canSubmit)),so(F,"variant","primary"),so(F,"size","md"),ar(()=>so(F,"handler",g.handlers.handleSubmit));var K=Ht(F),$=e=>{va(e,ca("Creating Business Account..."))},H=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for Account Activation..."))},o=e=>{va(e,ca("Create Business Account"))};Ba(r,e=>{g.state.isPolling?e(a):e(o,!1)},!0),va(e,t)};return Ba(K,e=>{g.state.isLoading?e($):e(H,!1)}),Re(F),Re(P),Re(k),ko(k,e=>g.state.formElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.formElement}),Re(w),ko(w,e=>Bt(_,e),()=>qr(_)),ar(e=>A=Ya(k,"",A,e),[()=>({display:qr(m)||qr(b)||qr(y)?"none":"block"})]),ta("submit",k,function(...e){var t;null==(t=g.handlers.handleSubmit)||t.apply(this,e)}),va(e,w),qe({get jwt(){return o()},set jwt(e=""){o(e),wt()},get businessUuid(){return n()},set businessUuid(e=""){n(e),wt()},get isInFlow(){return i()},set isInFlow(e=!1){i(e),wt()},get debug(){return l()},set debug(e=!0){l(e),wt()},get prefillData(){return s()},set prefillData(e={}){s(e),wt()},get publicCertificate(){return c()},set publicCertificate(e=""){c(e),wt()},get publicCertificateId(){return u()},set publicCertificateId(e=""){u(e),wt()}})}customElements.define("alviere-create-business-account",Uo(Hu,{jwt:{},businessUuid:{},isInFlow:{},debug:{},prefillData:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var Gu=ia("<alviere-create-business-account></alviere-create-business-account>",2),Wu=ia("<alviere-create-consumer-account></alviere-create-consumer-account>",2);function Yu(e,t){var r,a;je(t,!0);let o=zo(t,"config",31,()=>Dt({})),n=zo(t,"jwt",7,""),i=zo(t,"debug",7,!1),l=zo(t,"publicCertificate",7,""),s=zo(t,"publicCertificateId",7,""),c=zo(t,"businessUuid",7,"");N.info("config",o());let u=Tt(Dt(!!(null===(a=null===(r=o().formData)||void 0===r?void 0:r.information)||void 0===a?void 0:a.business_information))),v=Tt(Dt(o().formData));N.info("prefillData",qr(v));var d=ua(),p=Gt(d),f=e=>{var t=Gu();ar(()=>so(t,"prefill-data",JSON.stringify(o().formData))),ar(()=>so(t,"jwt",n())),ar(()=>so(t,"businessUuid",c())),ar(()=>so(t,"debug",i())),ar(()=>so(t,"publicCertificate",l())),ar(()=>so(t,"publicCertificateId",s())),va(e,t)},h=e=>{var t=Wu();ar(()=>so(t,"prefill-data",JSON.stringify(o().formData))),ar(()=>so(t,"jwt",n())),ar(()=>so(t,"businessUuid",c())),ar(()=>so(t,"publicCertificate",l())),ar(()=>so(t,"publicCertificateId",s())),va(e,t)};return Ba(p,e=>{qr(u)?e(f):e(h,!1)}),va(e,d),qe({get config(){return o()},set config(e={}){o(e),wt()},get jwt(){return n()},set jwt(e=""){n(e),wt()},get debug(){return i()},set debug(e=!1){i(e),wt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),wt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),wt()},get businessUuid(){return c()},set businessUuid(e=""){c(e),wt()}})}customElements.define("alviere-create-account",Uo(Yu,{config:{},jwt:{},debug:{},publicCertificate:{},publicCertificateId:{},businessUuid:{}},[],[],!0));const Qu={"011000015":{name:"Federal Reserve Bank",type:"Federal Reserve",region:"Atlanta",description:"Federal Reserve Bank of Atlanta"},"021001208":{name:"Federal Reserve Bank",type:"Federal Reserve",region:"East Rutherford",description:"Federal Reserve Bank of East Rutherford"},"021000322":{name:"Bank of America, N.A.",type:"Bank of America",region:"Richmond",description:"Bank of America Richmond"},"031000503":{name:"Wells Fargo Bank",type:"Wells Fargo",region:"Minneapolis",description:"Wells Fargo Bank, N.A."},"041000014":{name:"Federal Reserve Bank",type:"Federal Reserve",region:"Atlanta",description:"Federal Reserve Bank of Atlanta (ACH Department)"},"051000017":{name:"Bank of America, N.A.",type:"Bank of America",region:"Henrico",description:"Bank of America Henrico"},"061000104":{name:"Suntrust",type:"Suntrust",region:"Orlando",description:"Suntrust Bank Orlando"},"071000013":{name:"JPMorgan Chase",type:"JPMorgan Chase",region:"Belleville",description:"JPMorgan Chase Belleville"},"081000032":{name:"Bank of America, N.A.",type:"Bank of America",region:"Henrico",description:"Bank of America Henrico"},"091000019":{name:"Wells Fargo Bank",type:"Wells Fargo",region:"Minneapolis",description:"Wells Fargo Bank NA (Minnesota)"},111000025:{name:"Bank of America, N.A.",type:"Bank of America",region:"Henrico",description:"Bank of America Henrico"},121058313:{name:"Federal Reserve Bank SF- B, S & R",type:"Federal Reserve",region:"San Francisco",description:"Federal Reserve Bank of San Francisco"},"021000021":{name:"JPMorgan Chase Bank",type:"JPMorgan Chase",region:"Tampa",description:"JPMorgan Chase Tampa"},"026009593":{name:"Bank of America, N.A.",type:"Bank of America",region:"Richmond",description:"Bank of America, N.A."},121000248:{name:"Wells Fargo Bank",type:"Wells Fargo",region:"Minneapolis",description:"Wells Fargo Bank, National Association"},"021000089":{name:"Citibank",type:"Citibank",region:"New Castle",description:"Citibank, N.A."}},Ju={"01":"Boston","02":"New York","03":"Philadelphia","04":"Cleveland","05":"Richmond","06":"Atlanta","07":"Chicago","08":"St. Louis","09":"Minneapolis",10:"Kansas City",11:"Dallas",12:"San Francisco"};function Xu(e){const t=e.replace(/[-\s]/g,"");if(!/^\d{9}$/.test(t))return null;if(Qu[t])return Qu[t];const r=t.substring(0,2);if(Ju[r])return{name:"Federal Reserve Bank",type:"Federal Reserve",region:Ju[r],description:`Federal Reserve Bank of ${Ju[r]}`};const a=parseInt(t.charAt(0));return 0===a||1===a?{name:"Federal Reserve Bank",type:"Federal Reserve",description:"Federal Reserve Bank (based on routing pattern)"}:2===a||3===a?{name:"Commercial Bank",type:"Commercial Bank",description:"Commercial Bank (based on routing pattern)"}:4===a||5===a?{name:"Thrift Institution",type:"Thrift Institution",description:"Thrift Institution (based on routing pattern)"}:6===a||7===a?{name:"Credit Union",type:"Credit Union",description:"Credit Union (based on routing pattern)"}:8===a?{name:"Special Purpose",type:"Commercial Bank",description:"Special Purpose Bank (based on routing pattern)"}:{name:"Unknown Bank",type:"Commercial Bank",description:"Unable to determine bank type from routing number"}}function Zu(e){const t=e.replace(/[-\s]/g,"");return 9===t.length?`${t.slice(0,3)}-${t.slice(3,6)}-${t.slice(6)}`:e}var ev=ia('<div class="spinner-container svelte-hrbllu"><alviere-spinner></alviere-spinner></div>',2),tv=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Region:</span> <span class="value svelte-hrbllu"> </span></div>'),rv=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Description:</span> <span class="value description svelte-hrbllu"> </span></div>'),av=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Bank:</span> <span class="value svelte-hrbllu"> </span></div> <!> <!>',1),ov=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Account Type:</span> <span class="value svelte-hrbllu"> </span></div>'),nv=ia('<alviere-list-item><div slot="leading"><alviere-badge> </alviere-badge></div> <div slot="primary-text"><span> </span></div> <div slot="secondary-text"><span> </span></div> <div slot="tertiary-text"><span> </span></div> <div slot="actions"><alviere-button></alviere-button></div> <div slot="expanded-content"><div class="bank-accounts-section__card-content svelte-hrbllu"><div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Account Number:</span> <span class="value svelte-hrbllu"> </span></div> <div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Routing/SWIFT:</span> <span class="value svelte-hrbllu"> </span></div> <!> <!></div></div></alviere-list-item>',2),iv=ia('<div class="bank-accounts-section svelte-hrbllu"><div class="alviere-add-bank-account__header svelte-hrbllu"><h2 class="svelte-hrbllu"> </h2> <alviere-button>Add New Bank Account</alviere-button></div> <alviere-list></alviere-list> <div class="alviere-add-bank-account__footer svelte-hrbllu"><alviere-button>Continue to Payment</alviere-button></div></div>',2),lv=ia('<alviere-button><span class="alviere-add-bank-account__button__label">Back to Bank Accounts</span></alviere-button>',2),sv=ia('<span class="bank-region svelte-hrbllu"> </span>'),cv=ia('<div class="routing-info svelte-hrbllu"><div class="routing-info-header svelte-hrbllu"><span class="bank-name svelte-hrbllu"> </span> <!></div></div>'),uv=ia('<div class="alviere-add-bank-account__form__row alviere-add-bank-account__form__row--banking-info svelte-hrbllu"><alviere-badge>ACH</alviere-badge> <!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!></div>',3),vv=ia('<span class="validation-hint svelte-hrbllu">Please fill in all required fields to continue</span>'),dv=ia('<span class="validation-error svelte-hrbllu">Please fix the errors above</span>'),pv=ia('<span class="validation-error svelte-hrbllu" role="alert"> </span>'),fv=ia('<form novalidate="" class="alviere-add-bank-account__form svelte-hrbllu"><div class="alviere-add-bank-account__header svelte-hrbllu"><h2 class="svelte-hrbllu">Add Bank Account</h2> <!></div> <div class="alviere-add-bank-account__form__section"><!></div> <div class="form-actions svelte-hrbllu"><div class="form-status svelte-hrbllu"><!> <!> <!></div> <alviere-button> </alviere-button></div></form>',2),hv=ia('<div class="alviere-add-bank-account svelte-hrbllu"><!> <!> <!></div>');const gv={hash:"svelte-hrbllu",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-add-bank-account.svelte-hrbllu {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;position:relative;}.alviere-add-bank-account__header.svelte-hrbllu {display:flex;justify-content:space-between;align-items:center;margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid #eee;}.alviere-add-bank-account__header.svelte-hrbllu h2:where(.svelte-hrbllu) {font-size:1.25rem;color:var(--gray-700);margin:0;}\n@media (max-width: 768px) {.alviere-add-bank-account__header.svelte-hrbllu {justify-content:space-between;}\n}\n@media (max-width: 768px) {.alviere-add-bank-account__header.svelte-hrbllu .alviere-add-bank-account__button__label {display:none;}\n}.alviere-add-bank-account__footer.svelte-hrbllu {display:flex;justify-content:center;align-items:center;padding-top:2rem;}.alviere-add-bank-account__form.svelte-hrbllu {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;background:#ffffff;}.alviere-add-bank-account__form__row.svelte-hrbllu {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.alviere-add-bank-account__form__row--banking-info.svelte-hrbllu {display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:0.5rem;}.routing-info.svelte-hrbllu {border-radius:6px;padding:0.5rem;}.routing-info-header.svelte-hrbllu {display:flex;align-items:center;gap:0.5rem;}.routing-info.svelte-hrbllu .bank-name:where(.svelte-hrbllu) {font-weight:600;color:var(--gray-600);font-size:0.75rem;}.bank-region.svelte-hrbllu {color:var(--gray-600);font-size:0.75rem;}.bank-accounts-section.svelte-hrbllu {margin:0 auto;background:#fff;}.bank-accounts-section__card-content.svelte-hrbllu {display:flex;flex-direction:column;gap:0.75rem;padding:1rem;padding-top:0.5rem;}.bank-accounts-section__card-content__info-row.svelte-hrbllu {display:flex;justify-content:space-between;align-items:center;padding:0.5rem 0 0;}.bank-accounts-section__card-content__info-row.svelte-hrbllu .label:where(.svelte-hrbllu) {font-weight:500;color:#495057;font-size:0.9rem;}.bank-accounts-section__card-content__info-row.svelte-hrbllu .value:where(.svelte-hrbllu) {font-weight:600;color:#212529;font-size:0.9rem;}.form-actions.svelte-hrbllu {margin-top:24px;text-align:center;}.form-status.svelte-hrbllu {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-hrbllu {color:#6b7280;font-size:0.875rem;font-style:italic;}.validation-error.svelte-hrbllu {color:#b3311f;font-size:1.125rem;font-weight:500;margin-top:0.25rem;}.spinner-container.svelte-hrbllu {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}'};function mv(e,t){je(t,!0),Oa(e,gv);let r=zo(t,"jwt",7,""),a=zo(t,"accountUuid",7,""),o=zo(t,"debug",7,!0),n=zo(t,"onsuccess",15),i=zo(t,"publicCertificate",7,""),l=zo(t,"publicCertificateId",7,"");const s=Ru({jwt:r(),debug:o(),publicCertificate:i(),publicCertificateId:l(),initialData:{external_id:"",country:"USA",currency:"USD",bankAccountType:"ACH",ach_details:{routing_number:"",account_number:""},eft_details:{institution_number:"",transit_number:"",account_number:""},iban_details:{iban:""},swift_details:{swift_code:"",account_number:""},clabe_details:{swift_code:"",account_number:""},metadata:""},fieldSchemas:{external_id:{required:!0},country:{required:!0},currency:{required:!0},bankAccountType:{required:!0},ach_routing_number:{required:"Routing number is required",pattern:{regex:/^\d{9}$/,message:"Routing number must be exactly 9 digits"}},ach_account_number:{required:"Account number is required",numeric:"Account number must contain only digits",minLength:{value:3,message:"Account number must be at least 3 digits"}}},formName:"AddBankAccount",stepType:"ADD_BANK_ACCOUNT",submitHandler:async()=>{throw new Error("This should not be called - using custom handleAddBankAccount instead")}});let c=Tt(!1),u=Tt(!1),v=Tt(Dt({bank_accounts:[]})),d=Tt(!1),p=Tt(null),f=Tt(null),h=Tt(null);const g=rt(()=>r()&&a());async function m(){var e;if(!s.state.alviereCore)throw new Error("AlviereCore not initialized");const t=s.state.alviereCore.createPaymentsService(),r=await t.processGetBankAccounts(a());if(r.bank_accounts.length){const t=r.bank_accounts.map(e=>Object.assign(Object.assign({},e),{isExpanded:!1}));qr(v).bank_accounts=t.filter(e=>"ACTIVE"===e.status),Bt(p,(null===(e=qr(v).bank_accounts[0])||void 0===e?void 0:e.payment_method_uuid)||null,!0)}}async function b(e){var t,r;if(e.preventDefault(),s.computed.canSubmit)try{Bt(u,!0),Bt(f,null),s.actions.clearAllErrors();if(!s.actions.validateAllFields())return void N.error("Form validation failed");const e=s.state.formData,n={external_id:e.external_id||`bank-${Date.now()}`,country:e.country,currency:e.currency,bank_account_details:{}};if(e.metadata)try{n.metadata=JSON.parse(e.metadata)}catch(o){return void Bt(f,"Metadata must be valid JSON.")}switch(e.bankAccountType){case"ACH":n.bank_account_details.ach_details=e.ach_details;break;case"EFT":n.bank_account_details.eft_details=e.eft_details;break;case"IBAN":n.bank_account_details.iban_details=e.iban_details;break;case"SWIFT":n.bank_account_details.swift_details=e.swift_details;break;case"CLABE":n.bank_account_details.clabe_details=e.clabe_details}const i=s.state.alviereCore.createPaymentsService(),l=await i.processAddBankAccountWithValidation(a(),n);if(N.info("Bank account API response:",l),"FAILED"===(null===(t=l.bank_account)||void 0===t?void 0:t.status)){N.error("❌ Bank account creation failed with status FAILED"),Bt(f,"Bank account validation failed. Please check your routing and account numbers and try again.");const e=`bank-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;return s.state.formData.external_id=e,void N.info("🔄 Regenerated external_id after FAILED status:",e)}if(N.info("✅ Bank account added successfully:",l),(null===(r=l.bank_account)||void 0===r?void 0:r.payment_method_uuid)&&qr(h)){const e=new CustomEvent(zs,{detail:{payment_method_uuid:l.bank_account.payment_method_uuid,status:l.bank_account.status||"CREATED"},bubbles:!0,composed:!0});qr(h).dispatchEvent(e),N.info("🚀 Dispatched payment-method event after bank account addition:",e.detail)}await m(),s.actions.reset(),Bt(f,null),Bt(d,!1)}catch(o){N.error("❌ Error adding bank account:",o),Bt(f,o instanceof Error?o.message:String(o),!0)}finally{Bt(u,!1)}else N.debug("Cannot submit: form validation failed")}Zt(()=>{if(qr(d)||!qr(c)&&0===qr(v).bank_accounts.length){const e=`bank-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;s.state.formData.external_id=e,N.info("🔄 Generated new external_id for bank account:",e)}}),Ta(async()=>{if(Bt(c,!0),!qr(g))throw new Error("Missing required credentials");"862a2524-ce32-4fa7-b138-e7ac7e93c022"!==a()&&await m(),s.actions.setFieldValue("external_id",`bank_${Date.now()}_${Math.random().toString(36).substring(2,8)}`),setTimeout(()=>{Bt(c,!1)},1e3)});var y=hv(),_=Ht(y),w=e=>{var t=ev(),r=Ht(t);so(r,"size","lg"),so(r,"variant","circular"),Re(t),_o(1,t,()=>Tu,()=>({duration:300})),_o(2,t,()=>Tu,()=>({duration:200})),va(e,t)};Ba(_,e=>{(qr(c)||qr(u))&&e(w)});var C=Wt(_,2),x=e=>{var t=iv(),r=Ht(t),o=Ht(r),n=Ht(o);Re(o);var i=Wt(o,2);so(i,"variant","secondary"),so(i,"handler",()=>Bt(d,!0)),so(i,"iconName","Plus"),Re(r);var l=Wt(r,2);Ra(l,21,()=>qr(v).bank_accounts,Na,(e,t,r)=>{var o=nv();const n=rt(()=>function(e){var t;const r=e.bank_account_details;if(null==r?void 0:r.ach_details){const t=Xu(r.ach_details.routing_number||"");return{type:"ACH",accountNumber:e.last_4||"N/A",routingNumber:Zu(r.ach_details.routing_number||""),accountType:e.type||"N/A",bankInfo:t}}return(null==r?void 0:r.eft_details)?{type:"EFT",accountNumber:e.last_4||"N/A",routingNumber:`${r.eft_details.institution_number||""}-${r.eft_details.transit_number||""}`,accountType:"N/A",bankInfo:null}:(null==r?void 0:r.iban_details)?{type:"IBAN",accountNumber:e.last_4||"N/A",routingNumber:(null===(t=r.iban_details.iban)||void 0===t?void 0:t.slice(0,4))||"N/A",accountType:"N/A",bankInfo:null}:(null==r?void 0:r.swift_details)?{type:"SWIFT",accountNumber:e.last_4||"N/A",routingNumber:r.swift_details.swift_code||"N/A",accountType:"N/A",bankInfo:null}:(null==r?void 0:r.clabe_details)?{type:"CLABE",accountNumber:e.last_4||"N/A",routingNumber:r.clabe_details.swift_code||"N/A",accountType:"N/A",bankInfo:null}:{type:"Unknown",accountNumber:"N/A",routingNumber:"N/A",accountType:"N/A",bankInfo:null}}(qr(t)));ar(()=>so(o,"selectable",{group:qr(p),name:"bankAccount",value:qr(t).payment_method_uuid})),ar(()=>so(o,"selected",qr(p)===qr(t).payment_method_uuid)),so(o,"expandable",!0),ar(()=>so(o,"last",r===qr(v).bank_accounts.length-1));var i=Ht(o),l=Ht(i);so(l,"size","sm"),so(l,"variant","info");var c=Ht(l,!0);Re(l),Re(i);var d=Wt(i,2),f=Ht(d),h=Ht(f);Re(f),Re(d);var g=Wt(d,2),b=Ht(g),y=Ht(b,!0);Re(b),Re(g);var _=Wt(g,2),w=Ht(_),C=Ht(w,!0);Re(w),Re(_);var x=Wt(_,2),E=Ht(x);so(E,"variant","secondary"),so(E,"size","sm"),so(E,"handler",e=>{e.stopPropagation(),async function(e){Bt(u,!0);const t=s.state.alviereCore.createPaymentsService();await t.processDeleteBankAccount(a(),e),await m(),Bt(u,!1)}(qr(t).payment_method_uuid||"")}),so(E,"iconName","Trash"),Re(x);var S=Wt(x,2),k=Ht(S),A=Ht(k),T=Wt(Ht(A),2),I=Ht(T);Re(T),Re(A);var B=Wt(A,2),N=Wt(Ht(B),2),R=Ht(N,!0);Re(N),Re(B);var z=Wt(B,2),L=e=>{var t=av(),r=Gt(t),a=Wt(Ht(r),2),o=Ht(a,!0);Re(a),Re(r);var i=Wt(r,2),l=e=>{var t=tv(),r=Wt(Ht(t),2),a=Ht(r,!0);Re(r),Re(t),ar(()=>Ca(a,qr(n).bankInfo.region)),va(e,t)};Ba(i,e=>{qr(n).bankInfo.region&&e(l)});var s=Wt(i,2),c=e=>{var t=rv(),r=Wt(Ht(t),2),a=Ht(r,!0);Re(r),Re(t),ar(()=>Ca(a,qr(n).bankInfo.description)),va(e,t)};Ba(s,e=>{qr(n).bankInfo.description&&e(c)}),ar(()=>Ca(o,qr(n).bankInfo.name)),va(e,t)};Ba(z,e=>{qr(n).bankInfo&&e(L)});var D=Wt(z,2),U=e=>{var t=ov(),r=Wt(Ht(t),2),a=Ht(r,!0);Re(r),Re(t),ar(()=>Ca(a,qr(n).accountType)),va(e,t)};Ba(D,e=>{"N/A"!==qr(n).accountType&&e(U)}),Re(k),Re(S),Re(o),ar(()=>{var e;Ca(c,qr(n).type),Ca(h,`••••${qr(n).accountNumber??""}`),Ca(y,null==(e=qr(n).bankInfo)?void 0:e.name),Ca(C,qr(n).routingNumber),Ca(I,`••••${qr(n).accountNumber??""}`),Ca(R,qr(n).routingNumber)}),ta("select",o,()=>{return e=qr(t).payment_method_uuid||"",void Bt(p,e,!0);var e}),va(e,o)}),Re(l);var c=Wt(l,2),f=Ht(c);so(f,"variant","primary"),so(f,"size","md"),so(f,"handler",()=>{if(qr(h)){const e=new CustomEvent(zs,{detail:{payment_method_uuid:qr(p),status:"ACTIVE"},bubbles:!0,composed:!0});qr(h).dispatchEvent(e),N.info("🚀 Dispatched payment-method event from host element:",e);const t=new CustomEvent(Es,{detail:{stepType:"ADD_BANK_ACCOUNT",payment_method_uuid:qr(p),success:!0},bubbles:!0,composed:!0});qr(h).dispatchEvent(t),N.info("🚀 Dispatched form-success event from host element:",t)}else N.warn("⚠️ Host element not available for event dispatch")}),Re(c),Re(t),ar(()=>Ca(n,`Your Bank Accounts (${qr(v).bank_accounts.length??""})`)),va(e,t)};Ba(C,e=>{qr(c)||qr(d)||!qr(v).bank_accounts.length||e(x)});var E=Wt(C,2),S=e=>{var t=fv(),r=Ht(t),a=Wt(Ht(r),2),o=e=>{var t=lv();so(t,"type","button"),so(t,"variant","secondary"),so(t,"handler",()=>Bt(d,!1)),so(t,"iconName","X"),va(e,t)};Ba(a,e=>{qr(v).bank_accounts.length>0&&e(o)}),Re(r);var n=Wt(r,2),i=Ht(n),l=e=>{var t=uv(),r=Gt(t),a=Ht(r);so(a,"size","sm"),so(a,"variant","tertiary");var o=Wt(a,2),n=e=>{var t=ua();const r=rt(()=>Xu(s.state.formData.ach_details.routing_number));var a=Gt(t),o=e=>{var t=cv(),a=Ht(t),o=Ht(a),n=Ht(o,!0);Re(o);var i=Wt(o,2),l=e=>{var t=sv(),a=Ht(t);Re(t),ar(()=>Ca(a,`(${qr(r).region??""})`)),va(e,t)};Ba(i,e=>{qr(r).region&&e(l)}),Re(a),Re(t),ar(()=>Ca(n,qr(r).name)),va(e,t)};Ba(a,e=>{qr(r)&&e(o)}),va(e,t)};Ba(o,e=>{s.state.formData.ach_details.routing_number&&9===s.state.formData.ach_details.routing_number.length&&e(n)}),Re(r);var i=Wt(r,2),l=Ht(i);{let e=rt(()=>s.state.validationErrors.ach_routing_number?"invalid":"neutral"),t=rt(()=>s.state.validationErrors.ach_routing_number||"");Bc(l,{get value(){return s.state.formData.ach_details.routing_number},label:"Routing Number",placeholder:"Enter 9-digit routing number",helpText:"You can find your routing number on your check or bank statement.",required:!0,id:"ach_routing",get validationState(){return qr(e)},get errorMessage(){return qr(t)},oninput:e=>{const t=e.target.value;s.state.formData.ach_details.routing_number=t,s.handlers.handleFieldChange("ach_routing_number",t)}})}Re(i);var c=Wt(i,2),u=Ht(c);{let e=rt(()=>s.state.validationErrors.ach_account_number?"invalid":"neutral"),t=rt(()=>s.state.validationErrors.ach_account_number||"");Bc(u,{get value(){return s.state.formData.ach_details.account_number},label:"Account Number",placeholder:"Enter account number",required:!0,minlength:3,id:"ach_account",get validationState(){return qr(e)},get errorMessage(){return qr(t)},oninput:e=>{const t=e.target.value;s.state.formData.ach_details.account_number=t,s.handlers.handleFieldChange("ach_account_number",t)}})}Re(c),va(e,t)};Ba(i,e=>{"ACH"===s.state.formData.bankAccountType&&e(l)}),Re(n);var c=Wt(n,2),p=Ht(c),h=Ht(p),g=e=>{va(e,vv())};Ba(h,e=>{s.computed.canSubmit||e(g)});var m=Wt(h,2),y=e=>{va(e,dv())};Ba(m,e=>{s.computed.hasErrors&&s.computed.canSubmit&&e(y)});var _=Wt(m,2),w=e=>{var t=pv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,qr(f))),va(e,t)};Ba(_,e=>{qr(f)&&e(w)}),Re(p);var C=Wt(p,2);so(C,"type","submit"),so(C,"variant","tertiary"),so(C,"size","md"),ar(()=>so(C,"disabled",!s.computed.canSubmit||qr(u))),so(C,"handler",b);var x=Ht(C,!0);Re(C),Re(c),Re(t),ko(t,e=>s.state.formElement=e,()=>{var e;return null==(e=null==s?void 0:s.state)?void 0:e.formElement}),ar(()=>Ca(x,qr(u)?"Adding...":"Add Bank Account")),ta("submit",t,b),va(e,t)};return Ba(E,e=>{(qr(d)||!qr(c)&&!qr(v).bank_accounts.length)&&e(S)}),Re(y),ko(y,e=>Bt(h,e),()=>qr(h)),va(e,y),qe({get jwt(){return r()},set jwt(e=""){r(e),wt()},get accountUuid(){return a()},set accountUuid(e=""){a(e),wt()},get debug(){return o()},set debug(e=!0){o(e),wt()},get onsuccess(){return n()},set onsuccess(e){n(e),wt()},get publicCertificate(){return i()},set publicCertificate(e=""){i(e),wt()},get publicCertificateId(){return l()},set publicCertificateId(e=""){l(e),wt()}})}function bv(e,t){Bt(t,e.detail.checked,!0),N.info("Terms agreement changed:",qr(t))}customElements.define("alviere-add-bank-account",Uo(mv,{jwt:{},accountUuid:{},debug:{},onsuccess:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var yv=ia('<div class="spinner-container svelte-nz7vbr"><alviere-spinner></alviere-spinner></div>',2),_v=ia('<div class="alviere-checkout-confirm svelte-nz7vbr"><!> <div class="alviere-checkout-confirm__payment-info svelte-nz7vbr"><alviere-currency-input></alviere-currency-input> <div class="alviere-checkout-confirm__terms-and-conditions"><p>By clicking "Pay", you agree to the <a href="https://www.alviere.com/terms-and-conditions" target="_blank">terms and conditions</a> and <a href="https://www.alviere.com/privacy-policy" target="_blank">privacy policy</a>.</p> <alviere-checkbox></alviere-checkbox></div> <alviere-button>Pay</alviere-button></div></div>',2);const wv={hash:"svelte-nz7vbr",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-checkout-confirm.svelte-nz7vbr {display:flex;flex-direction:column;gap:1rem;position:relative;padding:1rem 0;}.alviere-checkout-confirm__payment-info.svelte-nz7vbr {display:flex;flex-direction:column;gap:2rem;}.alviere-checkout-confirm__payment-info.svelte-nz7vbr alviere-button:where(.svelte-nz7vbr) {align-self:center;}.alviere-checkout-confirm.svelte-nz7vbr .spinner-container:where(.svelte-nz7vbr) {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}'};function Cv(e,t){je(t,!0),Oa(e,wv);let r=zo(t,"jwt",15,""),a=zo(t,"accountUuid",15,""),o=zo(t,"paymentMethodUuid",15,""),n=zo(t,"amount",15,0),i=zo(t,"debug",15,!0),l=zo(t,"publicCertificate",15,""),s=zo(t,"publicCertificateId",15,""),c=Tt(null),u=Tt(!1),v=Tt(Dt(n())),d=Tt(!1);var p=_v(),f=Ht(p),h=e=>{var t=yv(),r=Ht(t);so(r,"size","lg"),so(r,"variant","circular"),Re(t),_o(1,t,()=>Tu,()=>({duration:300})),_o(2,t,()=>Tu,()=>({duration:200})),va(e,t)};Ba(f,e=>{qr(u)&&e(h)});var g=Wt(f,2),m=Ht(g);ar(()=>so(m,"value",qr(v)));var b=Wt(m,2),y=Wt(Ht(b),2);ar(()=>so(y,"checked",qr(d))),so(y,"label","I agree to the terms and conditions"),y.__change=[bv,d],Re(b);var _=Wt(b,2);return so(_,"variant","primary"),so(_,"size","md"),so(_,"handler",async function(){if(Bt(u,!0),await new Promise(e=>setTimeout(e,500)),Bt(u,!1),qr(c)){const e=new CustomEvent(Es,{detail:{stepType:"CHECKOUT_CONFIRM",success:!0,amount:qr(v)},bubbles:!0,composed:!0});qr(c).dispatchEvent(e),N.info("🚀 Dispatched form-success event from host element:",e)}else N.warn("⚠️ Host element not available for event dispatch")}),ar(()=>so(_,"disabled",!qr(d))),Ga(_,1,"svelte-nz7vbr"),Re(g),Re(p),ko(p,e=>Bt(c,e),()=>qr(c)),ta("text-input",m,function(e){Bt(v,e.detail.rawValue,!0),N.info("Amount changed:",qr(v))}),va(e,p),qe({get jwt(){return r()},set jwt(e=""){r(e),wt()},get accountUuid(){return a()},set accountUuid(e=""){a(e),wt()},get paymentMethodUuid(){return o()},set paymentMethodUuid(e=""){o(e),wt()},get amount(){return n()},set amount(e=0){n(e),wt()},get debug(){return i()},set debug(e=!0){i(e),wt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),wt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),wt()}})}ra(["change"]),customElements.define("alviere-checkout-confirm",Uo(Cv,{jwt:{},accountUuid:{},paymentMethodUuid:{},amount:{},debug:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var xv=ia('<h1 class="alviere-multi-step-flow__flow-title svelte-1hoappo"> </h1>'),Ev=ia('<p class="alviere-multi-step-flow__flow-description svelte-1hoappo"> </p>'),Sv=ia('<div class="alviere-multi-step-flow__flow-header svelte-1hoappo"><!> <!></div>'),kv=ia('<div class="alviere-multi-step-flow__flow-progress"><alviere-timeline></alviere-timeline></div>',2),Av=ia('<span class="alviere-multi-step-flow__step-navigation__status svelte-1hoappo">✓</span>'),Tv=ia('<span class="alviere-multi-step-flow__step-navigation__status svelte-1hoappo">✗</span>'),Iv=ia('<button><span class="alviere-multi-step-flow__step-navigation__number svelte-1hoappo"></span> <span class="alviere-multi-step-flow__step-navigation__label svelte-1hoappo"> </span> <!> <!></button>'),Bv=ia('<div class="alviere-multi-step-flow__step-navigation svelte-1hoappo"></div>'),Nv=ia('<div class="error-message svelte-1hoappo"> </div>'),Rv=ia('<div class="error-message svelte-1hoappo">No step type specified</div>'),zv=ia('<div class="alviere-multi-step-flow__step-content svelte-1hoappo"><div class="alviere-multi-step-flow__step-content__header svelte-1hoappo"><h3 class="svelte-1hoappo"> </h3></div> <div class="alviere-multi-step-flow__step-content__component"><!></div></div>'),Lv=ia('<div class="alviere-multi-step-flow__flow-complete svelte-1hoappo"><div class="alviere-multi-step-flow__flow-complete__header svelte-1hoappo"><div class="alviere-multi-step-flow__flow-complete__header__icon svelte-1hoappo"><!></div></div> <div class="alviere-multi-step-flow__flow-complete__content svelte-1hoappo"><p>Payment in process.</p></div></div>'),Dv=ia('<p class="flow-error-code svelte-1hoappo"> </p>'),Uv=ia('<p class="flow-error-description svelte-1hoappo"> </p>'),Pv=ia('<div class="alviere-multi-step-flow__flow-error svelte-1hoappo"><div class="alviere-multi-step-flow__flow-error__header svelte-1hoappo"><div class="alviere-multi-step-flow__flow-error__header__icon svelte-1hoappo"><!></div></div> <div class="alviere-multi-step-flow__flow-error__content svelte-1hoappo"><h3 class="svelte-1hoappo">Unable to Continue</h3> <p class="flow-error-message svelte-1hoappo"> </p> <!> <!></div></div>'),Vv=ia('<div class="alviere-multi-step-flow__flow-navigation svelte-1hoappo"><button class="alviere-multi-step-flow__flow-navigation__button alviere-multi-step-flow__flow-navigation__button--previous svelte-1hoappo">← Previous</button> <button class="nav-button nav-button--next">Next →</button> <button class="nav-button nav-button--reset">Reset Flow</button></div>'),Mv=ia('<div class="error-message svelte-1hoappo"> </div>'),Ov=ia('<div class="alviere-multi-step-flow svelte-1hoappo"><!> <!> <!> <!> <!> <!> <!> <!></div>');const jv={hash:"svelte-1hoappo",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-multi-step-flow.svelte-1hoappo {margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;--alviere-multi-step-end-size: 8rem;}.alviere-multi-step-flow__flow-complete.svelte-1hoappo {padding:3rem 0;}.alviere-multi-step-flow__flow-complete__header.svelte-1hoappo {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;}.alviere-multi-step-flow__flow-complete__header__icon.svelte-1hoappo {background-color:#436b1d;border-radius:50%;padding:1rem;width:var(--alviere-multi-step-end-size);height:var(--alviere-multi-step-end-size);display:flex;align-items:center;justify-content:center;color:#ffffff;\n animation: svelte-1hoappo-icon-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;}.alviere-multi-step-flow__flow-complete__header__icon.svelte-1hoappo svg {width:calc(var(--alviere-multi-step-end-size) * 0.75);height:calc(var(--alviere-multi-step-end-size) * 0.75);\n animation: svelte-1hoappo-svg-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;transform:scale(0);}.alviere-multi-step-flow__flow-complete__content.svelte-1hoappo {text-align:center;font-size:1.5rem;font-weight:700;}.alviere-multi-step-flow__flow-error.svelte-1hoappo {padding:3rem 0;}.alviere-multi-step-flow__flow-error__header.svelte-1hoappo {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;}.alviere-multi-step-flow__flow-error__header__icon.svelte-1hoappo {background-color:#b3311f;border-radius:50%;padding:1rem;width:var(--alviere-multi-step-end-size);height:var(--alviere-multi-step-end-size);display:flex;align-items:center;justify-content:center;color:#ffffff;\n animation: svelte-1hoappo-icon-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;}.alviere-multi-step-flow__flow-error__header__icon.svelte-1hoappo svg {width:calc(var(--alviere-multi-step-end-size) * 0.75);height:calc(var(--alviere-multi-step-end-size) * 0.75);\n animation: svelte-1hoappo-svg-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;transform:scale(0);}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo {text-align:center;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo h3:where(.svelte-1hoappo) {font-size:1.5rem;font-weight:700;color:#b3311f;margin-bottom:1rem;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo .flow-error-message:where(.svelte-1hoappo) {font-size:1.25rem;color:#333;margin-bottom:0.5rem;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo .flow-error-code:where(.svelte-1hoappo) {font-size:1.125rem;color:#666;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;margin-top:0.5rem;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo .flow-error-description:where(.svelte-1hoappo) {font-size:1.125rem;color:#666;margin-top:0.25rem;font-style:italic;}.alviere-multi-step-flow__flow-header.svelte-1hoappo {text-align:center;margin-bottom:2rem;}.alviere-multi-step-flow__flow-title.svelte-1hoappo {font-size:2rem;}.alviere-multi-step-flow__flow-description.svelte-1hoappo {color:#666;font-size:1.1rem;}.alviere-multi-step-flow__step-navigation.svelte-1hoappo {display:flex;gap:0.5rem;margin-bottom:2rem;flex-wrap:wrap;}.alviere-multi-step-flow__step-navigation__button.svelte-1hoappo {display:flex;align-items:center;gap:0.5rem;padding:0.75rem 1rem;border:1px solid #ddd;background:white;border-radius:6px;cursor:pointer;transition:all 0.2s ease;font-size:0.9rem;}.alviere-multi-step-flow__step-navigation__button.svelte-1hoappo:hover:not(:disabled) {background:#f8f9fa;border-color:#007bff;}.alviere-multi-step-flow__step-navigation__button.svelte-1hoappo:disabled {opacity:0.5;cursor:not-allowed;}.alviere-multi-step-flow__step-navigation__button--active.svelte-1hoappo {background:#227e9e;color:white;border-color:#227e9e;}.alviere-multi-step-flow__step-navigation__button--completed.svelte-1hoappo {background:#436b1d;color:white;border-color:#436b1d;}.alviere-multi-step-flow__step-navigation__button--error.svelte-1hoappo {background:#b3311f;color:white;border-color:#b3311f;}.alviere-multi-step-flow__step-navigation__number.svelte-1hoappo {font-weight:bold;min-width:1.5rem;text-align:center;}.alviere-multi-step-flow__step-navigation__label.svelte-1hoappo {flex:1;}.alviere-multi-step-flow__step-navigation__status.svelte-1hoappo {font-size:1.2rem;}.alviere-multi-step-flow__step-content.svelte-1hoappo {margin-bottom:2rem;}.alviere-multi-step-flow__step-content__header.svelte-1hoappo {display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;}.alviere-multi-step-flow__step-content__header.svelte-1hoappo h3:where(.svelte-1hoappo) {font-size:1.25rem;}.alviere-multi-step-flow__flow-navigation.svelte-1hoappo {display:flex;gap:1rem;justify-content:center;margin-top:2rem;}.alviere-multi-step-flow__flow-navigation__button.svelte-1hoappo {padding:0.75rem 1.5rem;border:none;border-radius:4px;cursor:pointer;font-size:1rem;font-weight:500;transition:background 0.2s ease;}.alviere-multi-step-flow__flow-navigation__button.svelte-1hoappo:disabled {opacity:0.5;cursor:not-allowed;}.alviere-multi-step-flow__flow-navigation__button-previous.svelte-1hoappo {background:#6c757d;color:white;}.alviere-multi-step-flow__flow-navigation__button-previous.svelte-1hoappo:hover:not(:disabled) {background:#545b62;}.alviere-multi-step-flow__flow-navigation__button--next.svelte-1hoappo {background:#007bff;color:white;}.alviere-multi-step-flow__flow-navigation__button--next.svelte-1hoappo:hover:not(:disabled) {background:#0056b3;}.flow-progress.svelte-1hoappo {margin-bottom:2rem;}.progress-bar.svelte-1hoappo {width:100%;height:8px;background:#e9ecef;border-radius:4px;overflow:hidden;margin-bottom:0.5rem;}.progress-fill.svelte-1hoappo {height:100%;background:#007bff;transition:width 0.3s ease;}.progress-text.svelte-1hoappo {text-align:center;font-size:0.9rem;color:#666;}.step-component.svelte-1hoappo {background:white;}.flow-complete.svelte-1hoappo {text-align:center;padding:2rem;background:#d4edda;border:1px solid #c3e6cb;border-radius:8px;margin-top:2rem;}.step-results.svelte-1hoappo {margin-top:1rem;text-align:left;}.result-item.svelte-1hoappo {margin-bottom:1rem;padding:1rem;background:white;border-radius:4px;border:1px solid #c3e6cb;}.error-message.svelte-1hoappo {background:#f8d7da;color:#721c24;border:1px solid #f5c6cb;border-radius:4px;padding:1rem;margin-top:1rem;text-align:center;}\n\n@keyframes svelte-1hoappo-icon-scale-up {\n from {\n transform: scale(0);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n}\n@keyframes svelte-1hoappo-svg-scale-up {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@media (max-width: 768px) {.step-navigation.svelte-1hoappo {flex-direction:column;}.step-button.svelte-1hoappo {justify-content:flex-start;}.flow-navigation.svelte-1hoappo {flex-direction:column;}.step-header.svelte-1hoappo {flex-direction:column;gap:1rem;align-items:flex-start;}\n}'};function qv(e,t){je(t,!0),Oa(e,jv);const[r,a]=function(){const e={};return[e,function(){Xt(()=>{for(var t in e)e[t].unsubscribe();Y(e,No,{enumerable:!1,value:!0})})}]}();var o,n;let i=zo(t,"config",31,()=>Dt({steps:[]})),l=zo(t,"jwt",15,""),s=zo(t,"businessUuid",15,""),c=zo(t,"debug",31,()=>Dt("false")),u=zo(t,"publicCertificate",15,""),v=zo(t,"publicCertificateId",15,""),d=zo(t,"amount",15,0),p=zo(t,"onflowcomplete",15),f=zo(t,"onstepcomplete",15),h=zo(t,"onsteperror",15),g=zo(t,"onreset",15);c("true"===c()),c()&&N.warn("MultiStepFlow initialized, debug:",c());let m=Tt(null),b=Tt(!1),y=Tt(null),_=Tt(null);const w=lc(uc),C=lc(gc),x=function(e){const{getJwt:t,getCore:r,getDebug:a,onJwtUpdate:o}=e;let n=Tt(Dt(t())),i=Tt(null),l=Tt(Dt(t()));return Zt(()=>{const e=t();e&&Bt(n,e,!0)}),Zt(()=>{var e;if(qr(i)){const t=qr(n);Bt(n,qr(i),!0),Bt(i,null),a()&&(N.info("✅ JWT downgrade successful - updated flow JWT"),N.info("🔐 Old JWT (first 50 chars):",null==t?void 0:t.substring(0,50)),N.info("🔐 New JWT (first 50 chars):",null==(e=qr(n))?void 0:e.substring(0,50)),N.info("🔐 New JWT will be used in all subsequent steps")),null==o||o(qr(n))}}),{getJwtForStep:()=>qr(l),getEffectiveJwt:()=>qr(n),updateJwt:e=>{Bt(n,e,!0)},downgradeJwt:async e=>{const t=r(),o=a();if(t)if(qr(n))try{if(o&&N.info("🔐 Performing JWT downgrade using shared AlviereCore instance..."),!t.isFirstTimeUser())return void(o&&N.info("🔄 User is not first-time - JWT already scoped"));o&&N.info("🔄 First-time user detected - performing JWT downgrade for account:",e);const r=await t.generateScopedToken(e,!1);Bt(i,r,!0),o&&N.info("🔐 Pending JWT set (first 50 chars):",null==r?void 0:r.substring(0,50)),await new Promise(e=>setTimeout(e,0))}catch(y){N.warn("⚠️ Failed to perform JWT downgrade:",y)}else o&&N.warn("⚠️ Cannot perform JWT downgrade - missing JWT");else o&&N.warn("⚠️ Cannot perform JWT downgrade - AlviereCore not initialized")},updateStepSnapshot:()=>{Bt(l,Kr(()=>qr(n)),!0)}}}({getJwt:()=>l(),getCore:()=>Ro(Iu,"$flowCoreStore",r).core,getDebug:()=>c(),onJwtUpdate:e=>{Iu.updateJwt(e),l(e)}}),E=function(e){let t=Tt(Dt({currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1})),r=Tt(Dt({})),a=Tt(!1);return Zt(()=>{var o;const n=e();if((null==(o=null==n?void 0:n.steps)?void 0:o.length)>0&&!qr(a)){const e={};n.steps.forEach((t,r)=>{e[r]=0===r?"IN_PROGRESS":"INCOMPLETE"}),Bt(r,e,!0),Bt(a,!0),0===qr(t).currentStepIndex&&0===qr(t).completedSteps.length&&Bt(t,{currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1},!0)}}),{get flowState(){return qr(t)},get stepStatuses(){return qr(r)},getCurrentStep:()=>{const r=e();return!(null==r?void 0:r.steps)||0===r.steps.length||qr(t).currentStepIndex>=r.steps.length?null:r.steps[qr(t).currentStepIndex]},getCurrentStepIndex:()=>qr(t).currentStepIndex,isComplete:()=>qr(t).isComplete,nextStep:()=>{var a;const o=e();qr(t).currentStepIndex<((null==(a=null==o?void 0:o.steps)?void 0:a.length)||0)-1&&(qr(t).currentStepIndex++,Bt(r,{...qr(r),[qr(t).currentStepIndex]:"IN_PROGRESS"},!0))},previousStep:()=>{qr(t).currentStepIndex>0&&qr(t).currentStepIndex--},goToStep:a=>{var o;const n=e();a>=0&&a<((null==(o=null==n?void 0:n.steps)?void 0:o.length)||0)&&(qr(t).currentStepIndex=a,"INCOMPLETE"===qr(r)[a]&&Bt(r,{...qr(r),[a]:"IN_PROGRESS"},!0))},canGoNext:()=>{var r;const a=e();return qr(t).currentStepIndex<((null==(r=null==a?void 0:a.steps)?void 0:r.length)||0)-1},canGoPrevious:()=>qr(t).currentStepIndex>0,markStepComplete:(a,o)=>{var n;const i=e();Bt(r,{...qr(r),[a]:"COMPLETE"},!0),qr(t).stepResults[a]=o,qr(t).completedSteps.includes(a)||(qr(t).completedSteps=[...qr(t).completedSteps,a]),a===((null==(n=null==i?void 0:i.steps)?void 0:n.length)||0)-1&&(qr(t).isComplete=!0)},markStepError:e=>{Bt(r,{...qr(r),[e]:"ERROR"},!0)},markStepInProgress:e=>{Bt(r,{...qr(r),[e]:"IN_PROGRESS"},!0)},storeStepResult:(e,r)=>{qr(t).stepResults[e]=r},getStepResult:e=>qr(t).stepResults[e]||null,getAccumulatedResults:()=>{const e={};for(let r=0;r<=qr(t).currentStepIndex;r++)if(qr(t).stepResults[r]){const a=qr(t).stepResults[r];Object.keys(a).forEach(t=>{["stepType","stepIndex","success","data"].includes(t)||(e[t]=a[t])})}return e},reset:()=>{Bt(t,{currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1},!0),Bt(a,!1),Bt(r,{},!0)}}}(()=>i()),S=function(e){const{getFlowElement:t,getConfig:r,flowState:a,onflowcomplete:o,onstepcomplete:n,onsteperror:i,onreset:l}=e,s=Ia();function c(e,r){const a=t();return!!a&&Zl(a).dispatch(e,r)}function u(){var e;const t=r();return{currentStep:a.currentStepIndex,totalSteps:(null==(e=null==t?void 0:t.steps)?void 0:e.length)||0,stepResults:{...a.stepResults},isComplete:a.isComplete}}function v(e,t,a){var o,n;const i=r();return{stepIndex:e,stepType:(null==(n=null==(o=null==i?void 0:i.steps)?void 0:o[e])?void 0:n.type)||"UNKNOWN",result:t,error:a}}return{dispatchStepComplete:(e,t)=>{var o,i;const l=v(e,t);null==n||n(l),c(Ts,l);const u=r();s("stepSuccess",{stepIndex:e,stepType:(null==(i=null==(o=null==u?void 0:u.steps)?void 0:o[e])?void 0:i.type)||"UNKNOWN",result:t,flowState:{...a}})},dispatchStepError:(e,t)=>{var o,n;const l=v(e,void 0,t);null==i||i(l),c(Is,l);const u=r();s("stepError",{stepIndex:e,stepType:(null==(n=null==(o=null==u?void 0:u.steps)?void 0:o[e])?void 0:n.type)||"UNKNOWN",error:t,flowState:{...a}})},dispatchFlowComplete:e=>{const t={...u(),result:e};null==o||o(t),c(Bs,t),s("complete",{stepResults:a.stepResults,flowState:{...a},result:e})},dispatchFlowReset:()=>{const e=u();null==l||l(),c(Ns,e),s("reset",{flowState:{...a}})}}}({getFlowElement:()=>qr(m),getConfig:()=>i(),flowState:E.flowState,onflowcomplete:p(),onstepcomplete:f(),onsteperror:h(),onreset:g()});let k=rt(()=>E.getCurrentStep());Zt(()=>{E.getCurrentStepIndex(),x.updateStepSnapshot()});let A=rt(()=>(null===qr(k)||void 0===qr(k)?void 0:qr(k).type)?function(e,t){const{jwt:r,businessUuid:a,publicCertificate:o,publicCertificateId:n,debug:i,amount:l,stepConfig:s,previousStepResult:c}=t,u={jwt:r,businessUuid:a,publicCertificate:o,publicCertificateId:n,isInFlow:!0,debug:i,amount:l,config:s};switch(e){case"ADD_BANK_ACCOUNT":case"ADD_PAYMENT_INSTRUMENT":{const e=(null==c?void 0:c.account_uuid)||"";return i&&(N.info("previousStepResult",c),N.info("accountUuidToUse",e)),{...u,accountUuid:e}}default:return u}}(qr(k).type,{jwt:x.getJwtForStep(),businessUuid:s(),publicCertificate:u(),publicCertificateId:v(),debug:c(),amount:d(),stepConfig:(null===(n=null===(o=i().steps)||void 0===o?void 0:o[E.getCurrentStepIndex()])||void 0===n?void 0:n.config)||{},previousStepResult:E.getStepResult(E.getCurrentStepIndex()-1)}):{}),T=rt(()=>{return e=i().steps||[],t=E.stepStatuses,r=E.getCurrentStepIndex(),e&&Array.isArray(e)?e.map((e,a)=>{let o="pending";return"COMPLETE"===t[a]?o="completed":"ERROR"===t[a]?o="error":a===r&&(o="active"),{label:e.label,description:e.description||"",status:o}}):[];var e,t,r}),I=rt(()=>E.canGoNext()),B=rt(()=>E.canGoPrevious());async function R(e){const t=E.getCurrentStepIndex(),r=e.detail;c()&&N.info(`✅ Step ${t} completed:`,r),await async function(e,t){var r,a;const o=null===(a=null===(r=null===i()||void 0===i()?void 0:i().steps)||void 0===r?void 0:r[e])||void 0===a?void 0:a.type;if("CREATE_CONSUMER_ACCOUNT"!==o&&"CREATE_BUSINESS_ACCOUNT"!==o&&"CREATE_ACCOUNT"!==o)return;if(!t.account_uuid||t.skipped)return void(c()&&N.info("🔄 Skipping JWT downgrade - account creation was skipped"));await x.downgradeJwt(t.account_uuid)}(t,r),E.markStepComplete(t,r);const a=E.getAccumulatedResults();E.canGoNext()?setTimeout(()=>{E.nextStep()},1e3):(E.flowState.isComplete=!0,S.dispatchFlowComplete(a)),S.dispatchStepComplete(t,a)}function z(e){const t=E.getCurrentStepIndex(),r=e.detail.error;if(c()&&N.error(`❌ Step ${t} failed:`,r),r instanceof ll&&(a=r.errorCode,Rl.includes(a)))return c()&&N.error(`🚨 Critical error - halting flow: ${r.errorCode}`),Bt(_,{message:"An error occurred. Please try again.",errorCode:r.errorCode,description:r.errorDescription},!0),void E.markStepError(t);var a;E.markStepError(t),S.dispatchStepError(t,r)}function L(){E.nextStep()}function D(){E.previousStep()}function U(){E.reset(),Bt(_,null),Bt(y,null),S.dispatchFlowReset()}Zt(()=>{if("undefined"!=typeof window){const e=new URLSearchParams(window.location.search),t=e.get("enhancedJwt")||e.get("jwt");t&&(l(t),x.updateJwt(t),c()&&N.info("🔐 Using enhanced JWT from URL"))}}),Zt(()=>{if("undefined"!=typeof window&&window.customElements&&qr(m)&&!qr(b)){const t=qr(m).getRootNode(),r=null==t?void 0:t.host;if(r){const t=r.getAttributeNames();if(t.includes("config")){const t=r.getAttribute("config");if(t)try{const e=JSON.parse(t);void 0!==e.amount&&d(Number(e.amount)),i(Object.assign(Object.assign(Object.assign({},i()),e),{steps:e.steps||i().steps||[]})),c()&&N.info("✅ Config loaded from attribute:",e)}catch(e){c()&&N.error("❌ Failed to parse config:",e)}}["jwt","business-uuid","public-certificate","public-certificate-id","amount"].forEach(e=>{if(t.includes(e)){const t=r.getAttribute(e);if(t)switch(e){case"jwt":l(t),x.updateJwt(t);break;case"business-uuid":s(t);break;case"public-certificate":u(t);break;case"public-certificate-id":v(t);break;case"amount":d(Number(t))}}})}Bt(b,!0)}}),Zt(()=>{(null===qr(k)||void 0===qr(k)?void 0:qr(k).type)&&setTimeout(()=>{!function(e,t,r,a=!1){if(!e)return;const o=`alviere-${e.toLowerCase().replace(/_/g,"-")}`;a&&N.info("Setting up event listeners for:",o);let n=document.querySelectorAll(o);if(0===n.length&&t){const e=t.getRootNode();n=null==e?void 0:e.querySelectorAll(o),a&&0===n.length&&N.info("No step elements found in shadow root")}if(n.length>0){const e=n[n.length-1];e.removeEventListener("success",r.onSuccess),e.removeEventListener("form-success",r.onSuccess),e.removeEventListener("error",r.onError),e.removeEventListener("form-error",r.onError),e.addEventListener("success",r.onSuccess),e.addEventListener("form-success",r.onSuccess),e.addEventListener("error",r.onError),e.addEventListener("form-error",r.onError),a&&N.info("✅ Event listeners set up successfully for:",e)}else a&&N.warn("⚠️ Step element not found for event listener setup:",o)}(qr(k).type,qr(m),{onSuccess:R,onError:z},c())},100)}),Zt(()=>{var e;c()&&N.info("🔍 Config changed:",{hasSteps:!!(null===i()||void 0===i()?void 0:i().steps),stepCount:(null===(e=null===i()||void 0===i()?void 0:i().steps)||void 0===e?void 0:e.length)||0,steps:null===i()||void 0===i()?void 0:i().steps})}),Zt(()=>{c()&&N.info("🔍 Current step:",{currentStep:qr(k),currentStepIndex:E.getCurrentStepIndex(),hasType:!!(null===qr(k)||void 0===qr(k)?void 0:qr(k).type)})}),Ta(()=>{var e;return l()&&s()&&(c()&&N.info("🔐 Initializing shared AlviereCore in store (mount)..."),Bu({jwt:l(),business_uuid:s(),publicCertificate:u(),publicCertificateId:v(),debug:c()})),(null===(e=null===i()||void 0===i()?void 0:i().steps)||void 0===e?void 0:e.length)>0?(c()&&N.info("🚀 MultiStepFlow mounted with",i().steps.length,"steps"),E.markStepInProgress(0)):c()&&N.warn("⚠️ MultiStepFlow mounted with NO steps in config!"),()=>{c()&&N.info("🧹 Cleaning up flow - resetting AlviereCore store"),Nu()}});var P=Ov(),V=Ht(P),M=e=>{var t=Sv(),r=Ht(t),a=e=>{var t=xv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,i().title)),va(e,t)};Ba(r,e=>{i().title&&e(a)});var o=Wt(r,2),n=e=>{var t=Ev(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,i().description)),va(e,t)};Ba(o,e=>{i().description&&e(n)}),Re(t),va(e,t)};Ba(V,e=>{(i().title||i().description)&&e(M)});var O=Wt(V,2),j=e=>{var t=kv(),r=Ht(t);ar(()=>so(r,"steps",qr(T))),so(r,"size","sm"),so(r,"showLabels",!0),so(r,"showDescriptions",!1),Re(t),va(e,t)};Ba(O,e=>{var t,r;!1!==(null==(t=i())?void 0:t.showProgress)&&(null==(r=i())?void 0:r.steps)&&e(j)});var q=Wt(O,2),F=e=>{var t=Bv();Ra(t,21,()=>i().steps,Na,(e,t,r)=>{var a=Iv();let o;a.__click=()=>function(e){E.goToStep(e)}(r);var n=Ht(a);n.textContent=r+1;var l=Wt(n,2),s=Ht(l,!0);Re(l);var c=Wt(l,2),u=e=>{va(e,Av())};Ba(c,e=>{"COMPLETE"===E.stepStatuses[r]&&e(u)});var v=Wt(c,2),d=e=>{va(e,Tv())};Ba(v,e=>{"ERROR"===E.stepStatuses[r]&&e(d)}),Re(a),ar((e,r)=>{o=Ga(a,1,"alviere-multi-step-flow__step-navigation__button svelte-1hoappo",null,o,e),a.disabled=r,Ca(s,qr(t).label)},[()=>({"alviere-multi-step-flow__step-navigation__button--active":r===E.getCurrentStepIndex(),"alviere-multi-step-flow__step-navigation__button--completed":"COMPLETE"===E.stepStatuses[r],"alviere-multi-step-flow__step-navigation__button--error":"ERROR"===E.stepStatuses[r]}),()=>r>E.getCurrentStepIndex()&&!i().allowSkip]),va(e,a)}),Re(t),va(e,t)};Ba(q,e=>{!1===i().showNavigation||qr(_)||e(F)});var K=Wt(q,2),$=e=>{var t=zv(),r=Ht(t),a=Ht(r),o=Ht(a,!0);Re(a),Re(r);var n=Wt(r,2),i=Ht(n),l=e=>{var t=ua();const r=rt(()=>({CREATE_CONSUMER_ACCOUNT:"alviere-create-consumer-account",CREATE_BUSINESS_ACCOUNT:"alviere-create-business-account",CREATE_ACCOUNT:"alviere-create-account",ADD_BANK_ACCOUNT:"alviere-add-bank-account",ADD_PAYMENT_INSTRUMENT:"alviere-add-payment-instrument",CHECKOUT_CONFIRM:"alviere-checkout-confirm"}[qr(k).type]||null));var a=Gt(t),o=e=>{var t=ua();Ma(Gt(t),()=>qr(r),0,(e,t)=>{co(e,()=>({...qr(A)}),void 0,void 0,"svelte-1hoappo")}),va(e,t)},n=e=>{var t=Nv(),r=Ht(t);Re(t),ar(()=>Ca(r,`Unknown step type: ${qr(k).type??""}`)),va(e,t)};Ba(a,e=>{qr(r)?e(o):e(n,!1)}),va(e,t)},s=e=>{va(e,Rv())};Ba(i,e=>{var t;(null==(t=qr(k))?void 0:t.type)?e(l):e(s,!1)}),Re(n),Re(t),ar(()=>Ca(o,qr(k).label)),_o(1,t,()=>Tu,()=>({duration:300})),_o(2,t,()=>Tu,()=>({duration:200})),va(e,t)};Ba(K,e=>{!qr(k)||E.isComplete()||qr(_)||e($)});var H=Wt(K,2),G=e=>{var t=Lv(),r=Ht(t),a=Ht(r);Pa(Ht(a),()=>w.outerHTML),Re(a),Re(r),ze(2),Re(t),_o(1,t,()=>Tu,()=>({duration:300,delay:300})),_o(2,t,()=>Tu,()=>({duration:200})),va(e,t)};Ba(H,e=>{E.isComplete()&&e(G)});var W=Wt(H,2),Q=e=>{var t=Pv(),r=Ht(t),a=Ht(r);Pa(Ht(a),()=>C.outerHTML),Re(a),Re(r);var o=Wt(r,2),n=Wt(Ht(o),2),i=Ht(n,!0);Re(n);var l=Wt(n,2),s=e=>{var t=Dv(),r=Ht(t);Re(t),ar(()=>Ca(r,`Error Code: ${qr(_).errorCode??""}`)),va(e,t)};Ba(l,e=>{c()&&qr(_).errorCode&&e(s)});var u=Wt(l,2),v=e=>{var t=Uv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,qr(_).description)),va(e,t)};Ba(u,e=>{c()&&qr(_).description&&e(v)}),Re(o),Re(t),ar(()=>Ca(i,qr(_).message)),_o(1,t,()=>Tu,()=>({duration:300,delay:100})),_o(2,t,()=>Tu,()=>({duration:200})),va(e,t)};Ba(W,e=>{qr(_)&&e(Q)});var J=Wt(W,2),X=e=>{var t=Vv(),r=Ht(t);r.__click=D;var a=Wt(r,2);a.__click=L,Wt(a,2).__click=U,Re(t),ar(e=>{r.disabled=!qr(B),a.disabled=e},[()=>!qr(I)||"COMPLETE"!==E.stepStatuses[E.getCurrentStepIndex()]]),va(e,t)};Ba(J,e=>{!1===i().showNavigation||qr(_)||E.isComplete()||e(X)});var Z=Wt(J,2),ee=e=>{var t=Mv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,qr(y))),va(e,t)};Ba(Z,e=>{qr(y)&&e(ee)}),Re(P),ko(P,e=>Bt(m,e),()=>qr(m)),va(e,P);var te=qe({get config(){return i()},set config(e={steps:[]}){i(e),wt()},get jwt(){return l()},set jwt(e=""){l(e),wt()},get businessUuid(){return s()},set businessUuid(e=""){s(e),wt()},get debug(){return c()},set debug(e="false"){c(e),wt()},get publicCertificate(){return u()},set publicCertificate(e=""){u(e),wt()},get publicCertificateId(){return v()},set publicCertificateId(e=""){v(e),wt()},get amount(){return d()},set amount(e=0){d(e),wt()},get onflowcomplete(){return p()},set onflowcomplete(e){p(e),wt()},get onstepcomplete(){return f()},set onstepcomplete(e){f(e),wt()},get onsteperror(){return h()},set onsteperror(e){h(e),wt()},get onreset(){return g()},set onreset(e){g(e),wt()}});return a(),te}ra(["click"]),customElements.define("alviere-multi-step-flow",Uo(qv,{config:{},jwt:{},businessUuid:{},debug:{},publicCertificate:{},publicCertificateId:{},amount:{},onflowcomplete:{},onstepcomplete:{},onsteperror:{},onreset:{}},[],[],!0));var Fv=sa('<svg class="alviere-spinner__circle svelte-18d6yb5" viewBox="0 0 50 50" part="circle"><circle class="alviere-spinner__circle-path svelte-18d6yb5" cx="25" cy="25" r="20" fill="none" stroke-width="4" part="circle-path"></circle></svg>'),Kv=ia('<div class="alviere-spinner__dots svelte-18d6yb5" part="dots"><div class="alviere-spinner__dot svelte-18d6yb5" part="dot"></div> <div class="alviere-spinner__dot svelte-18d6yb5" part="dot"></div> <div class="alviere-spinner__dot svelte-18d6yb5" part="dot"></div></div>'),$v=ia('<div role="status" aria-live="polite" part="root"><!> <div class="alviere-spinner__message svelte-18d6yb5"><!></div></div>');const Hv={hash:"svelte-18d6yb5",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-spinner.svelte-18d6yb5 {display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;--spinner-color: var(--alv-spinner-color, var(--alv-color-text-primary));}.alviere-spinner--sm.svelte-18d6yb5 {--spinner-size: var(--alv-spinner-size-sm, 1rem);--spinner-stroke-width: var(--alv-spinner-stroke-width, 2px);}.alviere-spinner--md.svelte-18d6yb5 {--spinner-size: var(--alv-spinner-size-md, 1.5rem);--spinner-stroke-width: var(--alv-spinner-stroke-width, 2px);}.alviere-spinner--lg.svelte-18d6yb5 {--spinner-size: var(--alv-spinner-size-lg, 4rem);--spinner-stroke-width: 5px;}.alviere-spinner__circle.svelte-18d6yb5 {width:var(--spinner-size);height:var(--spinner-size);\n animation: svelte-18d6yb5-alviere-spinner-rotate 2s linear infinite;}.alviere-spinner__circle-path.svelte-18d6yb5 {stroke:var(--spinner-color);stroke-linecap:square;transform-origin:center;\n animation: svelte-18d6yb5-alviere-spinner-dash 1.5s ease-in-out infinite;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dots:where(.svelte-18d6yb5) {display:flex;align-items:center;justify-content:center;gap:calc(var(--spinner-size) * 0.15);}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5) {width:calc(var(--spinner-size) * 0.25);height:calc(var(--spinner-size) * 0.25);background-color:var(--spinner-color);border-radius:50%;\n animation: svelte-18d6yb5-alviere-spinner-dot-pulse 1.4s ease-in-out infinite both;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5):nth-child(1) {animation-delay:-0.32s;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5):nth-child(2) {animation-delay:-0.16s;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5):nth-child(3) {animation-delay:0s;}.alviere-spinner__message.svelte-18d6yb5 {text-align:center;font-size:var(--alv-font-size-base, 1.25rem);color:var(--alv-color-text-secondary, #555);font-weight:500;margin:0;margin-top:1rem;}.alviere-spinner__message.svelte-18d6yb5:empty {display:none;}\n\n@keyframes svelte-18d6yb5-alviere-spinner-rotate {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes svelte-18d6yb5-alviere-spinner-dash {\n 0% {\n stroke-dasharray: 1, 125.6;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 94.2, 125.6;\n stroke-dashoffset: -31.4;\n }\n 100% {\n stroke-dasharray: 1, 125.6;\n stroke-dashoffset: -125.6;\n }\n}\n@keyframes svelte-18d6yb5-alviere-spinner-dot-pulse {\n 0%, 80%, 100% {\n transform: scale(0.8);\n opacity: 0.5;\n }\n 40% {\n transform: scale(1);\n opacity: 1;\n }\n}.alviere-spinner.svelte-18d6yb5:focus-visible {outline:2px solid var(--spinner-color);outline-offset:2px;border-radius:4px;}\n\n@media (prefers-reduced-motion: reduce) {.alviere-spinner__circle.svelte-18d6yb5 {\n animation: svelte-18d6yb5-alviere-spinner-rotate 3s linear infinite;}.alviere-spinner__circle-path.svelte-18d6yb5 {\n animation: none;stroke-dasharray:62.8, 125.6;stroke-dashoffset:0;}\n}'};function Gv(e,t){je(t,!0),Oa(e,Hv);let r=zo(t,"size",15,"md"),a=zo(t,"color",15,""),o=zo(t,"primaryColor",15,""),n=zo(t,"ariaLabel",15,"Loading..."),i=zo(t,"class",15,""),l=zo(t,"variant",15,"circular"),s=rt(()=>`alviere-spinner alviere-spinner--${r()} alviere-spinner--${l()} ${i()}`.trim()),c=rt(()=>a()||o());var u=$v();let v;var d=Ht(u),p=e=>{va(e,Fv())},f=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,Kv())};Ba(r,e=>{"dots"===l()&&e(a)},!0),va(e,t)};Ba(d,e=>{"circular"===l()?e(p):e(f,!1)});var h=Wt(d,2);return Va(Ht(h),t,"message",{}),Re(h),Re(u),ar(e=>{Ga(u,1,Fa(qr(s)),"svelte-18d6yb5"),lo(u,"aria-label",n()),v=Ya(u,"",v,e)},[()=>({"--spinner-color":qr(c)})]),va(e,u),qe({get size(){return r()},set size(e="md"){r(e),wt()},get color(){return a()},set color(e=""){a(e),wt()},get primaryColor(){return o()},set primaryColor(e=""){o(e),wt()},get ariaLabel(){return n()},set ariaLabel(e="Loading..."){n(e),wt()},get class(){return i()},set class(e=""){i(e),wt()},get variant(){return l()},set variant(e="circular"){l(e),wt()}})}customElements.define("alviere-spinner",Uo(Gv,{size:{},color:{},primaryColor:{},ariaLabel:{},class:{},variant:{}},["message"],[],!0));var Wv=ia('<div class="alviere-timeline__connector svelte-se2bjk" part="connector"></div>'),Yv=ia('<span class="alviere-timeline__step-description svelte-se2bjk" part="step-description"> </span>'),Qv=ia('<div class="alviere-timeline__step-label svelte-se2bjk" part="step-label"><span class="alviere-timeline__step-text svelte-se2bjk" part="step-text"> </span> <!></div>'),Jv=ia('<div class="alviere-timeline__step-wrapper svelte-se2bjk" part="step-wrapper"><!> <div part="step"><div class="alviere-timeline__step-indicator svelte-se2bjk" part="step-indicator"><span class="alviere-timeline__step-icon svelte-se2bjk" part="step-icon"><!></span> <div class="alviere-timeline__step-ripple svelte-se2bjk" part="step-ripple"></div></div> <!></div></div>'),Xv=ia('<div role="progressbar" aria-label="Progress timeline" part="root"><div class="alviere-timeline__container svelte-se2bjk" part="container"></div></div>');const Zv={hash:"svelte-se2bjk",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-timeline.svelte-se2bjk {display:flex;align-items:center;justify-content:center;width:100%;--timeline-color: var(--alv-timeline-color, var(--alv-color-gray-600));--timeline-completed-color: var(--alv-timeline-completed-color, var(--alv-color-success));--timeline-error-color: var(--alv-timeline-error-color, var(--alv-color-error));--timeline-pending-color: var(--alv-timeline-pending-color, var(--alv-color-gray-400));}.alviere-timeline--sm.svelte-se2bjk {--timeline-step-size: var(--alv-timeline-step-size-sm, 1.25rem);--timeline-connector-width: 2px;--timeline-font-size: var(--alv-font-size-sm);--timeline-connector-padding: 0.625rem;}.alviere-timeline--md.svelte-se2bjk {--timeline-step-size: var(--alv-timeline-step-size-md, 2rem);--timeline-connector-width: var(--alv-timeline-connector-width, 3px);--timeline-font-size: var(--alv-timeline-font-size, var(--alv-font-size-base));}.alviere-timeline--lg.svelte-se2bjk {--timeline-step-size: var(--alv-timeline-step-size-lg, 2.5rem);--timeline-connector-width: 4px;--timeline-font-size: var(--alv-font-size-lg);}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__container:where(.svelte-se2bjk) {flex-direction:row;align-items:center;justify-content:space-between;width:100%;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk) {position:relative;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):nth-child(1) .alviere-timeline__step:where(.svelte-se2bjk) {align-items:flex-start;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):nth-child(1) .alviere-timeline__connector:where(.svelte-se2bjk) {width:calc(100% - var(--timeline-connector-padding) * 2 + 50% - var(--timeline-connector-padding) - var(--timeline-step-size));left:calc(var(--timeline-step-size) + var(--timeline-connector-padding));}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):last-child .alviere-timeline__step:where(.svelte-se2bjk) {align-items:flex-end;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):last-child .alviere-timeline__connector:where(.svelte-se2bjk) {width:calc(100% - var(--timeline-connector-padding) * 2);}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__connector:where(.svelte-se2bjk) {height:var(--timeline-connector-width);align-self:center;position:relative;top:calc(var(--timeline-step-size) * 0.5 + var(--timeline-connector-width) * 0.5);left:calc(50% + var(--timeline-step-size) * 0.5 + var(--timeline-connector-padding));min-width:2rem;width:calc(100% - var(--timeline-connector-padding) * 2 + 50% - var(--timeline-connector-padding) - var(--timeline-step-size));}.alviere-timeline--vertical.svelte-se2bjk .alviere-timeline__container:where(.svelte-se2bjk) {flex-direction:column;align-items:flex-start;}.alviere-timeline--vertical.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk) {flex-direction:column;align-items:flex-start;}.alviere-timeline--vertical.svelte-se2bjk .alviere-timeline__connector:where(.svelte-se2bjk) {width:var(--timeline-connector-width);height:2rem;}.alviere-timeline__container.svelte-se2bjk {display:flex;align-items:center;width:100%;gap:0;}.alviere-timeline__step-wrapper.svelte-se2bjk {position:relative;flex:1;}.alviere-timeline__step.svelte-se2bjk {display:flex;flex-direction:column;align-items:center;gap:0.5rem;position:relative;}.alviere-timeline__step-indicator.svelte-se2bjk {position:relative;width:var(--timeline-step-size);height:var(--timeline-step-size);border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--alv-color-surface, #ffffff);border:1px solid var(--timeline-color);transition:all var(--alv-transition-normal, 0.3s ease-in-out);}.alviere-timeline__step-icon.svelte-se2bjk {font-size:calc(var(--timeline-step-size) * 0.5);font-weight:var(--alv-font-weight-bold, 700);color:var(--alv-color-on-primary, #ffffff);transition:all var(--alv-transition-normal, 0.3s ease-in-out);display:flex;flex-direction:column;align-items:center;justify-content:center;}.alviere-timeline__step-icon.svelte-se2bjk svg {width:calc(var(--timeline-step-size) * 0.75);height:calc(var(--timeline-step-size) * 0.75);}.alviere-timeline__step--pending.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-pending-color);background:var(--alv-color-surface, #ffffff);}.alviere-timeline__step--pending.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--timeline-pending-color);}.alviere-timeline__step--active.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-color);background:var(--timeline-color);}.alviere-timeline__step--active.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--alv-color-on-primary, #ffffff);}.alviere-timeline__step--active.svelte-se2bjk .alviere-timeline__step-text:where(.svelte-se2bjk) {font-weight:var(--alv-font-weight-bold, 700);}.alviere-timeline__step--completed.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-completed-color);background:var(--timeline-completed-color);}.alviere-timeline__step--completed.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--alv-color-on-success, #ffffff);}.alviere-timeline__step--error.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-error-color);background:var(--timeline-error-color);}.alviere-timeline__step--error.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--alv-color-on-error, #ffffff);}.alviere-timeline__step-label.svelte-se2bjk {display:none;flex-direction:column;align-items:center;text-align:center;gap:0.25rem;}.alviere-timeline__step-text.svelte-se2bjk {font-size:var(--timeline-font-size);font-weight:var(--alv-font-weight-medium, 500);color:var(--alv-color-text-primary);white-space:nowrap;}.alviere-timeline__step-description.svelte-se2bjk {font-size:calc(var(--timeline-font-size) * 0.875);color:var(--alv-color-text-secondary);white-space:nowrap;}.alviere-timeline__connector.svelte-se2bjk {background:var(--timeline-pending-color);transition:background-color var(--alv-transition-normal, 0.3s ease-in-out);}.alviere-timeline__step-ripple.svelte-se2bjk {position:absolute;top:50%;left:50%;width:var(--timeline-step-size);height:var(--timeline-step-size);border-radius:50%;background:rgba(var(--alv-color-success-rgb, 67, 107, 29), 0.3);transform:translate(-50%, -50%) scale(0);pointer-events:none;opacity:0;transition:all 0.6s ease-out;}.alviere-timeline__step-ripple--active.svelte-se2bjk {transform:translate(-50%, -50%) scale(2);opacity:1;}\n@media (max-width: 768px) {.alviere-timeline__step-text.svelte-se2bjk {font-size:var(--alv-font-size-sm);}.alviere-timeline__step-description.svelte-se2bjk {font-size:var(--alv-font-size-xs);}\n}.alviere-timeline__step-indicator.svelte-se2bjk:focus-visible {outline:2px solid var(--timeline-color);outline-offset:2px;}\n@media (prefers-reduced-motion: reduce) {.alviere-timeline__step-ripple.svelte-se2bjk {transition:none;}.alviere-timeline__step-indicator.svelte-se2bjk {transition:none;}.alviere-timeline__connector.svelte-se2bjk {transition:none;}\n}'};function ed(e,t){je(t,!0),Oa(e,Zv);let r=zo(t,"steps",31,()=>Dt([])),a=zo(t,"size",15,"md"),o=zo(t,"showLabels",15,!0),n=zo(t,"showDescriptions",15,!1),i=zo(t,"orientation",15,"horizontal"),l=zo(t,"class",15,""),s=Tt(Dt(new Set)),c=rt(()=>`alviere-timeline alviere-timeline--${a()} alviere-timeline--${i()} ${l()}`.trim());Zt(()=>{r().forEach(e=>{"completed"!==e.status||qr(s).has(e.id)||(qr(s).add(e.id),function(e){const t=document.querySelector(`[data-step-id="${e}"]`);t&&(t.classList.add("alviere-timeline__step-ripple--active"),setTimeout(()=>{t.classList.remove("alviere-timeline__step-ripple--active")},1e3))}(e.id))})});const u=lc(uc),v=lc(gc);var d=Xv(),p=Ht(d);return Ra(p,21,r,Na,(e,t,a)=>{var i=Jv(),l=Ht(i),s=e=>{va(e,Wv())};Ba(l,e=>{a<r().length-1&&e(s)});var c=Wt(l,2),d=Ht(c),p=Ht(d);Pa(Ht(p),()=>{var e;return null==(e=function(e){switch(e){case"completed":return u;case"error":return v;default:return null}}(qr(t).status))?void 0:e.outerHTML}),Re(p);var f=Wt(p,2);Re(d);var h=Wt(d,2),g=e=>{var r=Qv(),a=Ht(r),o=Ht(a,!0);Re(a);var i=Wt(a,2),l=e=>{var r=Yv(),a=Ht(r,!0);Re(r),ar(()=>Ca(a,qr(t).description)),va(e,r)};Ba(i,e=>{n()&&qr(t).description&&e(l)}),Re(r),ar(()=>Ca(o,qr(t).label)),va(e,r)};Ba(h,e=>{o()&&e(g)}),Re(c),Re(i),ar(e=>{Ga(c,1,e,"svelte-se2bjk"),lo(f,"data-step-id",qr(t).id)},[()=>Fa(`alviere-timeline__step alviere-timeline__step--${qr(t).status}`)]),va(e,i)}),Re(p),Re(d),ar(()=>Ga(d,1,Fa(qr(c)),"svelte-se2bjk")),va(e,d),qe({get steps(){return r()},set steps(e=[]){r(e),wt()},get size(){return a()},set size(e="md"){a(e),wt()},get showLabels(){return o()},set showLabels(e=!0){o(e),wt()},get showDescriptions(){return n()},set showDescriptions(e=!1){n(e),wt()},get orientation(){return i()},set orientation(e="horizontal"){i(e),wt()},get class(){return l()},set class(e=""){l(e),wt()}})}customElements.define("alviere-timeline",Uo(ed,{steps:{},size:{},showLabels:{},showDescriptions:{},orientation:{},class:{}},[],[],!0));var td=ia('<span class="alviere-button__icon svelte-1tj1ov8" part="icon"><!></span>'),rd=ia('<button part="root"><!> <span class="alviere-button__label svelte-1tj1ov8" part="label"><!></span></button>');const ad={hash:"svelte-1tj1ov8",code:'.alviere-button.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;}.alviere-button--sm.svelte-1tj1ov8 {padding:0 0.5rem;height:2.4375rem;}.alviere-button--md.svelte-1tj1ov8 {padding:0 1rem;height:3.25rem;}.alviere-button--lg.svelte-1tj1ov8 {padding:0 1.5rem;height:4.0625rem;}.alviere-button--primary.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#27272a;color:#ffffff;}.alviere-button--primary.svelte-1tj1ov8:hover:not(:disabled) {background:#3f3f46;}.alviere-button--primary.svelte-1tj1ov8:disabled {background:#52525b;cursor:not-allowed;}.alviere-button--secondary.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#e4e4e7;color:#27272a;}.alviere-button--secondary.svelte-1tj1ov8:hover:not(:disabled) {background:#d4d4d8;}.alviere-button--secondary.svelte-1tj1ov8:disabled {background:#f4f4f5;color:#71717a;cursor:not-allowed;}.alviere-button--tertiary.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#ffffff;border:1px solid #3f3f46;color:#27272a;}.alviere-button--tertiary.svelte-1tj1ov8:hover:not(:disabled) {background:#e4e4e7;}.alviere-button--tertiary.svelte-1tj1ov8:disabled {background:#f4f4f5;color:#71717a;cursor:not-allowed;}.alviere-button--icon.svelte-1tj1ov8 {display:flex;align-items:center;gap:0.5rem;}.alviere-button--icon.svelte-1tj1ov8 .alviere-button__icon:where(.svelte-1tj1ov8) {display:flex;align-items:center;}.alviere-button--icon.svelte-1tj1ov8 .alviere-button__label:where(.svelte-1tj1ov8):empty {display:none;}\n@media (max-width: 768px) {.alviere-button--icon.svelte-1tj1ov8 .alviere-button__label:where(.svelte-1tj1ov8) {display:none;}\n}'};function od(e,t){je(t,!0),Oa(e,ad);let r=zo(t,"size",15,"md"),a=zo(t,"color",15,""),o=zo(t,"primaryColor",15,""),n=zo(t,"backgroundColor",15,""),i=zo(t,"ariaLabel",15,""),l=zo(t,"class",15,""),s=zo(t,"variant",15,"primary"),c=zo(t,"handler",15),u=zo(t,"disabled",15,!1),v=zo(t,"type",15,"button"),d=zo(t,"iconName",15,null),p=rt(()=>`alviere-button alviere-button--${r()} alviere-button--${s()} ${l()} ${d()?"alviere-button--icon":""}`.trim()),f=rt(()=>{const e=[];return a()?e.push(`--alv-color-primary: ${a()}`):o()&&e.push(`--alv-color-primary: ${o()}`),n()&&e.push(`--alv-button-primary-bg: ${n()}`),e.join("; ")});const h={ArrowLeft:sc,ArrowRight:cc,Plus:fc,X:gc,Trash:hc},g=rt(()=>()=>{if(!d())return null;const e=h[d()];return e?lc(e):null}),m=rt(()=>()=>{var e;return(null===(e=qr(g)())||void 0===e?void 0:e.outerHTML)||""});var b=rd();b.__click=function(...e){var t;null==(t=c())||t.apply(this,e)};var y=Ht(b),_=e=>{var t=td();Pa(Ht(t),()=>qr(m)()),Re(t),va(e,t)};Ba(y,e=>{qr(m)()&&e(_)});var w=Wt(y,2);return Va(Ht(w),t,"default",{}),Re(w),Re(b),ar(()=>{Ga(b,1,Fa(qr(p)),"svelte-1tj1ov8"),b.disabled=u(),lo(b,"aria-label",i()),lo(b,"type",v()),Ya(b,qr(f))}),va(e,b),qe({get size(){return r()},set size(e="md"){r(e),wt()},get color(){return a()},set color(e=""){a(e),wt()},get primaryColor(){return o()},set primaryColor(e=""){o(e),wt()},get backgroundColor(){return n()},set backgroundColor(e=""){n(e),wt()},get ariaLabel(){return i()},set ariaLabel(e=""){i(e),wt()},get class(){return l()},set class(e=""){l(e),wt()},get variant(){return s()},set variant(e="primary"){s(e),wt()},get handler(){return c()},set handler(e){c(e),wt()},get disabled(){return u()},set disabled(e=!1){u(e),wt()},get type(){return v()},set type(e="button"){v(e),wt()},get iconName(){return d()},set iconName(e=null){d(e),wt()}})}ra(["click"]),customElements.define("alviere-button",Uo(od,{size:{},color:{},primaryColor:{},backgroundColor:{},ariaLabel:{},class:{},variant:{},handler:{},disabled:{},type:{},iconName:{}},["default"],[],!0));var nd=ia("<div><!></div>");const id={hash:"svelte-7elmuq",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-badge.svelte-7elmuq {display:inline-block;padding:0.25rem 0.5rem;border-radius:0.375rem;font-size:0.75rem;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-weight:500;color:#3f3f46;background:#f4f4f5;}.alviere-badge--sm.svelte-7elmuq {padding:0 0.5rem;line-height:1.875rem;border-radius:1.875rem;font-size:0.75rem;}.alviere-badge--md.svelte-7elmuq {padding:0 1rem;line-height:2.5rem;border-radius:2.5rem;font-size:1rem;}.alviere-badge--lg.svelte-7elmuq {padding:0 1rem;line-height:2.8125rem;border-radius:2.8125rem;font-size:1.125rem;}.alviere-badge--primary.svelte-7elmuq {background-color:#227e9e;color:#ffffff;}.alviere-badge--secondary.svelte-7elmuq {background-color:#a1a1aa;color:#ffffff;}.alviere-badge--error.svelte-7elmuq {background-color:#b3311f;color:#ffffff;}.alviere-badge--success.svelte-7elmuq {background-color:#436b1d;color:#ffffff;}.alviere-badge--warning.svelte-7elmuq {background-color:#ffc107;color:#000000;}.alviere-badge--info.svelte-7elmuq {background-color:#175db8;color:#ffffff;}'};function ld(e,t){je(t,!0),Oa(e,id);let r=zo(t,"variant",15,"primary"),a=zo(t,"size",15,"md");var o=nd();return Va(Ht(o),t,"default",{}),Re(o),ar(()=>Ga(o,1,`alviere-badge alviere-badge--${r()??""} alviere-badge--${a()??""}`,"svelte-7elmuq")),va(e,o),qe({get variant(){return r()},set variant(e="primary"){r(e),wt()},get size(){return a()},set size(e="md"){a(e),wt()}})}customElements.define("alviere-badge",Uo(ld,{variant:{},size:{}},["default"],[],!0));var sd=ia('<div class="alviere-list"><!></div>');function cd(e,t){let r;je(t,!0),Ta(()=>{const e=r.querySelector("slot");if(e){e.assignedElements().filter(e=>"alviere-list-item"!==e.tagName.toLowerCase()).length}});var a=sd();Va(Ht(a),t,"default",{}),Re(a),ko(a,e=>r=e,()=>r),va(e,a),qe()}customElements.define("alviere-list",Uo(cd,{},["default"],[],!0));var ud=(e,t,r)=>{var a;return(null==(a=t())?void 0:a.value)&&r()},vd=(e,t)=>{e.stopPropagation(),Bt(t,!qr(t))},dd=(e,t)=>{e.stopPropagation(),t(e)},pd=ia('<div role="button"><span class="alviere-list-item__expandable__icon svelte-crzbgj"><!></span></div>'),fd=ia("<div><!></div>"),hd=ia('<div><div class="alviere-list-item__header svelte-crzbgj"><div class="alviere-list-item__badge svelte-crzbgj"><!></div> <div class="alviere-list-item__leading svelte-crzbgj"><!></div> <div class="alviere-list-item__content svelte-crzbgj"><div class="alviere-list-item__text svelte-crzbgj"><div class="alviere-list-item__primary-text svelte-crzbgj"><!></div> <div class="alviere-list-item__secondary-text svelte-crzbgj"><!></div> <div class="alviere-list-item__tertiary-text svelte-crzbgj"><!></div></div></div> <div class="alviere-list-item__content__monetary svelte-crzbgj"><div class="alviere-list-item__content__monetary__payment-method"><!></div> <div class="alviere-list-item__content__monetary__amount"><!></div></div> <div class="alviere-list-item__actions svelte-crzbgj"><!></div> <!></div> <!></div>');const gd={hash:"svelte-crzbgj",code:".alviere-list-item.svelte-crzbgj {display:flex;flex-direction:column;border-top:1px solid transparent;border-bottom:1px solid #d4d4d8;}.alviere-list-item__header.svelte-crzbgj {display:flex;align-items:center;gap:var(--spacing-md, 1rem);padding:var(--spacing-md, 1rem);}.alviere-list-item--last.svelte-crzbgj {border-bottom:1px solid transparent;}.alviere-list-item--selectable.svelte-crzbgj {cursor:pointer;}.alviere-list-item--selectable.svelte-crzbgj:hover {background-color:#fafafa;}.alviere-list-item--selectable:hover.alviere-list-item--selected.svelte-crzbgj .alviere-list-item__header:where(.svelte-crzbgj) {background-color:#d1e8f0;}.alviere-list-item--selectable.alviere-list-item--selected.svelte-crzbgj {border-top:1px solid #227e9e;border-bottom:1px solid #227e9e;}.alviere-list-item--selectable.alviere-list-item--selected.svelte-crzbgj .alviere-list-item__header:where(.svelte-crzbgj) {background-color:#e8f4f8;}.alviere-list-item__leading.svelte-crzbgj {display:flex;align-items:center;flex-shrink:0;}.alviere-list-item__leading.svelte-crzbgj:empty {display:none;}.alviere-list-item__content.svelte-crzbgj {display:flex;align-items:center;gap:var(--spacing-sm, 8px);flex:1;min-width:0;}.alviere-list-item__content__monetary.svelte-crzbgj {display:flex;align-items:center;font-size:1.125rem;gap:var(--spacing-lg, 1.5rem);flex-shrink:0;}.alviere-list-item__badge.svelte-crzbgj {flex-shrink:0;}.alviere-list-item__badge.svelte-crzbgj:empty {display:none;}.alviere-list-item__text.svelte-crzbgj {flex:1;flex-direction:column;min-width:0;}.alviere-list-item__text.svelte-crzbgj:empty {display:none;}.alviere-list-item__primary-text.svelte-crzbgj {font-size:1.25rem;color:#3f3f46;padding-bottom:0.25rem;font-weight:500;}.alviere-list-item__primary-text.svelte-crzbgj:last-child {padding-bottom:0;}.alviere-list-item__secondary-text.svelte-crzbgj {font-size:1.125rem;color:#3f3f46;padding-bottom:0.25rem;}.alviere-list-item__secondary-text.svelte-crzbgj:last-child {padding-bottom:0;}.alviere-list-item__secondary-text.svelte-crzbgj:empty {display:none;}.alviere-list-item__tertiary-text.svelte-crzbgj {font-size:1rem;color:#71717a;}.alviere-list-item__tertiary-text.svelte-crzbgj:last-child {padding-bottom:0;}.alviere-list-item__tertiary-text.svelte-crzbgj:empty {display:none;}.alviere-list-item__actions.svelte-crzbgj {display:flex;align-items:center;gap:var(--spacing-sm, 8px);flex-shrink:0;}.alviere-list-item__actions.svelte-crzbgj:empty {display:none;}.alviere-list-item__expandable.svelte-crzbgj {display:flex;justify-content:center;padding:var(--spacing-xs, 0.25rem);border-radius:0.125rem;}.alviere-list-item__expandable__icon.svelte-crzbgj {display:flex;align-items:center;justify-content:center;width:100%;transition:transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);will-change:transform;}.alviere-list-item__expandable--active.svelte-crzbgj .alviere-list-item__expandable__icon:where(.svelte-crzbgj) {transform:rotate(90deg);}.alviere-list-item__expandable.svelte-crzbgj:hover {background-color:#d4d4d8;}.alviere-list-item__expanded-content.svelte-crzbgj {transition:opacity 0.3s cubic-bezier(0.19, 1, 0.22, 1);will-change:opacity;}.alviere-list-item__expanded-content--active.svelte-crzbgj {border-top:1px solid #227e9e;}"};function md(e,t){je(t,!0),Oa(e,gd);let r=zo(t,"selectable",15,null),a=zo(t,"expandable",15,!1),o=zo(t,"selected",15,!1),n=zo(t,"last",15,!1);const i=Ia(),l=lc(dc);let s=Tt(!1);function c(){N.info("ListItem: dispatching select event",null===r()||void 0===r()?void 0:r().value),i("select",{value:null===r()||void 0===r()?void 0:r().value})}function u(e){"Enter"!==e.key&&" "!==e.key||!(null===r()||void 0===r()?void 0:r().value)||(e.preventDefault(),c())}function v(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Bt(s,!qr(s)))}var d=hd();d.__click=[ud,r,c],d.__keydown=function(...e){var t;null==(t=r()?u:void 0)||t.apply(this,e)};var p=Ht(d),f=Ht(p);Va(Ht(f),t,"badge",{}),Re(f);var h=Wt(f,2);Va(Ht(h),t,"leading",{}),Re(h);var g=Wt(h,2),m=Ht(g),b=Ht(m);Va(Ht(b),t,"primary-text",{}),Re(b);var y=Wt(b,2);Va(Ht(y),t,"secondary-text",{}),Re(y);var _=Wt(y,2);Va(Ht(_),t,"tertiary-text",{}),Re(_),Re(m),Re(g);var w=Wt(g,2),C=Ht(w);Va(Ht(C),t,"monetary-text-method",{}),Re(C);var x=Wt(C,2);Va(Ht(x),t,"monetary-text-amount",{}),Re(x),Re(w);var E=Wt(w,2);Va(Ht(E),t,"actions",{}),Re(E);var S=Wt(E,2),k=e=>{var t=pd();let r;lo(t,"tabindex",0),t.__click=[vd,s],t.__keydown=[dd,v];var a=Ht(t);Pa(Ht(a),()=>l.outerHTML),Re(a),Re(t),ar(e=>{r=Ga(t,1,"alviere-list-item__expandable svelte-crzbgj",null,r,e),lo(t,"aria-expanded",qr(s))},[()=>({"alviere-list-item__expandable--active":qr(s)})]),va(e,t)};Ba(S,e=>{a()&&e(k)}),Re(p);var A=Wt(p,2),T=e=>{var r=ua(),a=Gt(r),o=e=>{var r=fd();let a;Va(Ht(r),t,"expanded-content",{}),Re(r),ar(e=>a=Ga(r,1,"alviere-list-item__expanded-content svelte-crzbgj",null,a,e),[()=>({"alviere-list-item__expanded-content--active":qr(s)})]),_o(1,r,()=>Tu,()=>({duration:200})),_o(2,r,()=>Tu,()=>({duration:150})),va(e,r)};Ba(a,e=>{qr(s)&&e(o)}),va(e,r)};return Ba(A,e=>{a()&&e(T)}),Re(d),ar(()=>{Ga(d,1,`alviere-list-item ${(n()&&"alviere-list-item--last")??""} ${(r()&&"alviere-list-item--selectable")??""} ${(o()&&"alviere-list-item--selected")??""}`,"svelte-crzbgj"),lo(d,"role",r()?"button":void 0),lo(d,"tabindex",r()?0:void 0)}),va(e,d),qe({get selectable(){return r()},set selectable(e=null){r(e),wt()},get expandable(){return a()},set expandable(e=!1){a(e),wt()},get selected(){return o()},set selected(e=!1){o(e),wt()},get last(){return n()},set last(e=!1){n(e),wt()}})}ra(["click","keydown"]),customElements.define("alviere-list-item",Uo(md,{selectable:{},expandable:{},selected:{},last:{}},["badge","leading","primary-text","secondary-text","tertiary-text","monetary-text-method","monetary-text-amount","actions","expanded-content"],[],!0));var bd=ia('<div class="alviere-radio"><div class="alviere-radio__input"><input type="radio"/> <div class="alviere-radio__input-inner"><div class="alviere-radio__input-inner-circle"></div></div></div> <div class="alviere-radio__label"><!></div></div>');const yd={hash:"svelte-45h",code:""};function _d(e,t){je(t,!0),Oa(e,yd);let r=zo(t,"name",15,""),a=zo(t,"value",15,""),o=zo(t,"checked",15,!1);var n=bd(),i=Ht(n),l=Ht(i);ao(l),ze(2),Re(i);var s=Wt(i,2);return Va(Ht(s),t,"default",{}),Re(s),Re(n),ar(()=>{no(l,o()),lo(l,"name",r()),oo(l,a())}),va(e,n),qe({get name(){return r()},set name(e=""){r(e),wt()},get value(){return a()},set value(e=""){a(e),wt()},get checked(){return o()},set checked(e=!1){o(e),wt()}})}function wd(e,t,r,a,o,n){const i=e.target;if(t(i.checked),qr(r)){const e=new CustomEvent("change",{detail:{checked:i.checked,value:a(),name:o()},bubbles:!0,composed:!0});qr(r).dispatchEvent(e)}n()&&n()(e)}customElements.define("alviere-radio",Uo(_d,{name:{},value:{},checked:{}},["default"],[],!0));var Cd=ia('<div class="alviere-checkbox__label"> </div>'),xd=ia('<div class="alviere-checkbox svelte-vz8w8t"><div><input type="checkbox" class="alviere-checkbox__input-checkbox svelte-vz8w8t"/> <div class="alviere-checkbox__input-inner svelte-vz8w8t"><div class="alviere-checkbox__input-inner-checkmark svelte-vz8w8t"><!></div></div></div> <!></div>');const Ed={hash:"svelte-vz8w8t",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-checkbox.svelte-vz8w8t {display:flex;align-items:center;gap:0.5rem;position:relative;}.alviere-checkbox__input.svelte-vz8w8t input:where(.svelte-vz8w8t) {opacity:0;position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer;z-index:2;}.alviere-checkbox__input-inner.svelte-vz8w8t {width:1rem;height:1rem;border-radius:0.25rem;border:1px solid #52525b;position:relative;z-index:1;transition:all 0.2s ease-in-out;}.alviere-checkbox__input-inner-checkmark.svelte-vz8w8t {position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.6);width:100%;height:100%;opacity:0;transition:all 0.2s ease-in-out;color:#ffffff;z-index:3;}.alviere-checkbox__input-inner-checkmark.svelte-vz8w8t svg {width:100%;height:100%;position:relative;}.alviere-checkbox__input--checked.svelte-vz8w8t .alviere-checkbox__input-inner:where(.svelte-vz8w8t) {background-color:#000000;}.alviere-checkbox__input--checked.svelte-vz8w8t .alviere-checkbox__input-inner-checkmark:where(.svelte-vz8w8t) {opacity:1;transform:translate(-50%, -50%) scale(1);}'};function Sd(e,t){je(t,!0),Oa(e,Ed);let r=zo(t,"name",15,""),a=zo(t,"value",15,!1),o=zo(t,"checked",15,!1),n=zo(t,"label",15,""),i=zo(t,"disabled",15,!1),l=zo(t,"onchange",15),s=Tt(null);const c=lc(uc),u=rt(()=>["alviere-checkbox__input",o()?"alviere-checkbox__input--checked":"",i()?"alviere-checkbox__input--disabled":""].filter(Boolean).join(" "));var v=xd(),d=Ht(v),p=Ht(d);ao(p),p.__change=[wd,o,s,a,r,l];var f=Wt(p,2),h=Ht(f);Pa(Ht(h),()=>c.outerHTML),Re(h),Re(f),Re(d);var g=Wt(d,2),m=e=>{var t=Cd(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,n())),va(e,t)};return Ba(g,e=>{n()&&e(m)}),Re(v),ko(v,e=>Bt(s,e),()=>qr(s)),ar(()=>{Ga(d,1,Fa(qr(u)),"svelte-vz8w8t"),no(p,o()),lo(p,"name",r()),oo(p,a()),p.disabled=i()}),va(e,v),qe({get name(){return r()},set name(e=""){r(e),wt()},get value(){return a()},set value(e=!1){a(e),wt()},get checked(){return o()},set checked(e=!1){o(e),wt()},get label(){return n()},set label(e=""){n(e),wt()},get disabled(){return i()},set disabled(e=!1){i(e),wt()},get onchange(){return l()},set onchange(e){l(e),wt()}})}ra(["change"]),customElements.define("alviere-checkbox",Uo(Sd,{name:{},value:{},checked:{},label:{},disabled:{},onchange:{}},[],[],!0));const kd=[{name:"alviere-card-pan-input",component:qs},{name:"alviere-card-cvv-input",component:Qs},{name:"alviere-card-exp-input",component:ac},{name:"alviere-text-input",component:Bc},{name:"alviere-phone-input",component:Vc},{name:"alviere-date-of-birth-input",component:Hc},{name:"alviere-currency-input",component:eu},{name:"alviere-search-select",component:mu},{name:"alviere-add-payment-instrument",component:ku},{name:"alviere-create-consumer-account",component:Mu},{name:"alviere-create-business-account",component:Hu},{name:"alviere-create-account",component:Yu},{name:"alviere-add-bank-account",component:mv},{name:"alviere-checkout-confirm",component:Cv},{name:"alviere-multi-step-flow",component:qv},{name:"alviere-spinner",component:Gv},{name:"alviere-timeline",component:ed},{name:"alviere-button",component:od},{name:"alviere-badge",component:ld},{name:"alviere-list",component:cd},{name:"alviere-list-item",component:md},{name:"alviere-radio",component:_d},{name:"alviere-checkbox",component:Sd}],Ad={inputs:{CardPanInput:qs,CardCVVInput:Qs,CardExpInput:ac,TextInput:Bc,PhoneInput:Vc,DateOfBirthInput:Hc,CurrencyInput:eu,SearchSelect:mu},forms:{AddPaymentInstrument:ku,CreateConsumerAccount:Mu,CreateBusinessAccount:Hu,CreateAccount:Yu,AddBankAccount:mv,CheckoutConfirm:Cv},flows:{MultiStepFlow:qv},elements:{Spinner:Gv,Timeline:ed,Button:od,Badge:ld,List:cd,ListItem:md,Radio:_d,Checkbox:Sd}},Td={AlviereCardPanInput:qs,AlviereCardCVVInput:Qs,AlviereCardExpInput:ac,AlviereTextInput:Bc,AlvierePhoneInput:Vc,AlviereDateOfBirthInput:Hc,AlviereCurrencyInput:eu,AlviereSearchSelect:mu,AlviereAddPaymentInstrument:ku,AlviereCreateConsumerAccount:Mu,AlviereCreateBusinessAccount:Hu,AlviereCreateAccount:Yu,AlviereAddBankAccount:mv,AlviereCheckoutConfirm:Cv,AlviereMultiStepFlow:qv,AlviereSpinner:Gv,AlviereTimeline:ed,AlviereButton:od,AlviereBadge:ld,AlviereList:cd,AlviereListItem:md,AlviereRadio:_d,AlviereCheckbox:Sd},Id={...Td,...Ad.inputs,...Ad.forms,...Ad.flows,...Ad.elements},Bd=Ad,Nd=Td;function Rd(){N.info("🔍 Initializing web components"),"undefined"!=typeof window&&window.customElements&&(O.registerAll(kd),N.info("✅ Alviere Web Components initialized successfully"))}return Rd(),N.info("🚀 Alviere UI Unified Entry Point v2.0.0 - Ready"),U(),N.info("Alviere UI Web Components v2.0.0 - Unified entry point ready with auto-injected tokens"),e.Alviere=Nd,e.Categories=Bd,e.Components=Id,e.adoptTokensInShadowRoot=P,e.ensureTokensInjected=U,e.getComponent=function(e){return Id[e]},e.getComponentNames=function(){return Object.keys(Id)},e.hasComponent=function(e){return e in Id},e.initializeWebComponents=Rd,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
1
+ var AlviereWebComponents=function(e){"use strict";var t,r,a,n,o,i,l,s,c,u,v,d,p,f,h,g,m,b,y,w,_,x,C,E,S,k,A,T,I,B,N,z,R,D,L,U,P,V,M,O,q,j,F,K,$,H,G=Object.defineProperty,W=e=>{throw TypeError(e)},Y=(e,t,r)=>((e,t,r)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Q=(e,t,r)=>t.has(e)||W("Cannot "+r),J=(e,t,r)=>(Q(e,t,"read from private field"),r?r.call(e):t.get(e)),X=(e,t,r)=>t.has(e)?W("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Z=(e,t,r,a)=>(Q(e,t,"write to private field"),a?a.call(e,r):t.set(e,r),r),ee=(e,t,r)=>(Q(e,t,"access private method"),r),te="undefined"!=typeof document?document.currentScript:null;const re={};function ae(){return!("undefined"==typeof window||!window.location.search.includes("debug=true"))||(void 0==={url:te&&"SCRIPT"===te.tagName.toUpperCase()&&te.src||new URL("web-components.js",document.baseURI).href}||!re)&&(!("undefined"==typeof process||!process.env)&&"true"===process.env.VITE_DEBUG)}const ne={logger:"UI_LOGGER",debug:(e,...t)=>{ae()},info:(e,...t)=>{ae()},warn:(e,...t)=>{ae()},error:(e,...t)=>{ae()}};function oe(e){return e&&"function"==typeof e.getLogger?e.getLogger():ne}let ie=null,le=!1,se={};function ce(){if(se.disableAutoInject||window.ALVIERE_DISABLE_AUTO_TOKENS)return void ne.debug("[Alviere] Auto-token injection disabled");if(le||document.querySelector("style[data-alviere-tokens]"))return;const e="@layer alviere-defaults {\n :root {\n --alv-color-primary: #227e9e;\n --alv-color-primary-hover: #1b6680;\n --alv-color-primary-active: #145164;\n --alv-color-primary-light: #e8f4f8;\n --alv-color-primary-light-hover: #d1e8f0;\n --alv-color-on-primary: #ffffff;\n --alv-color-success: #436b1d;\n --alv-color-success-light: #d4edda;\n --alv-color-success-border: #c3e6cb;\n --alv-color-success-text: #155724;\n --alv-color-on-success: #ffffff;\n --alv-color-success-rgb: 67, 107, 29;\n --alv-color-error: #b3311f;\n --alv-color-error-light: #f8d7da;\n --alv-color-error-border: #f5c6cb;\n --alv-color-error-text: #721c24;\n --alv-color-on-error: #ffffff;\n --alv-color-error-rgb: 179, 49, 31;\n --alv-color-warning: #ffc107;\n --alv-color-warning-light: #fff3cd;\n --alv-color-warning-border: #ffeaa7;\n --alv-color-warning-text: #856404;\n --alv-color-on-warning: #000000;\n --alv-color-info: #175db8;\n --alv-color-info-light: #d1ecf1;\n --alv-color-info-border: #bee5eb;\n --alv-color-info-text: #0c5460;\n --alv-color-on-info: #ffffff;\n --alv-color-gray-50: #fafafa;\n --alv-color-gray-100: #f4f4f5;\n --alv-color-gray-200: #e4e4e7;\n --alv-color-gray-300: #d4d4d8;\n --alv-color-gray-400: #a1a1aa;\n --alv-color-gray-500: #71717a;\n --alv-color-gray-600: #52525b;\n --alv-color-gray-700: #3f3f46;\n --alv-color-gray-800: #27272a;\n --alv-color-gray-900: #18181b;\n --alv-color-surface: #ffffff;\n --alv-color-surface-secondary: #f9fafb;\n --alv-color-surface-tertiary: #f4f4f5;\n --alv-color-surface-elevated: #ffffff;\n --alv-color-text-primary: #18181b;\n --alv-color-text-secondary: #52525b;\n --alv-color-text-tertiary: #71717a;\n --alv-color-text-disabled: #a1a1aa;\n --alv-color-text-on-primary: #ffffff;\n --alv-color-text-on-surface: #18181b;\n --alv-color-border: #e4e4e7;\n --alv-color-border-hover: #d4d4d8;\n --alv-color-border-focus: #227e9e;\n --alv-color-border-error: #b3311f;\n --alv-color-border-success: #436b1d;\n --alv-color-background: #ffffff;\n --alv-color-background-disabled: #f4f4f5;\n --alv-color-background-hover: #f9fafb;\n --alv-color-background-active: #f4f4f5;\n}\n\n:root {\n --alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n --alv-font-family-grotesque: 'Darker Grotesque', sans-serif;\n --alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n --alv-font-size-3xs: 0.625rem;\n --alv-font-size-2xs: 0.75rem;\n --alv-font-size-xs: 1rem;\n --alv-font-size-sm: 1.125rem;\n --alv-font-size-base: 1.25rem;\n --alv-font-size-lg: 1.5rem;\n --alv-font-size-xl: 1.75rem;\n --alv-font-weight-light: 300;\n --alv-font-weight-normal: 400;\n --alv-font-weight-medium: 500;\n --alv-font-weight-semibold: 600;\n --alv-font-weight-bold: 700;\n --alv-line-height-tight: 1.25;\n --alv-line-height-normal: 1.5;\n --alv-line-height-relaxed: 1.75;\n}\n\n:root {\n --alv-spacing-xs: 0.25rem;\n --alv-spacing-sm: 0.5rem;\n --alv-spacing-md: 1rem;\n --alv-spacing-lg: 1.5rem;\n --alv-spacing-xl: 2rem;\n --alv-spacing-2xl: 3rem;\n --alv-spacing-3xl: 4rem;\n}\n\n:root {\n --alv-border-radius-none: 0;\n --alv-border-radius-sm: 0.125rem;\n --alv-border-radius: 0.25rem;\n --alv-border-radius-md: 0.375rem;\n --alv-border-radius-lg: 0.5rem;\n --alv-border-radius-xl: 0.75rem;\n --alv-border-radius-2xl: 1rem;\n --alv-border-radius-full: 9999px;\n}\n\n:root {\n --alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n --alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n --alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n --alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n --alv-shadow-none: none;\n}\n\n:root {\n --alv-transition-fast: 150ms ease-in-out;\n --alv-transition-normal: 250ms ease-in-out;\n --alv-transition-slow: 350ms ease-in-out;\n --alv-transition-none: none;\n}\n\n:root {\n --alv-input-height-sm: 2.5rem;\n --alv-input-height: 3.25rem;\n --alv-input-height-lg: 3.75rem;\n --alv-input-padding-x: 0.75rem;\n --alv-input-padding-y: 0.5rem;\n --alv-input-border-color: var(--alv-color-border);\n --alv-input-border-hover: var(--alv-color-border-hover);\n --alv-input-border-focus: var(--alv-color-border-focus);\n --alv-input-bg: var(--alv-color-background);\n --alv-input-bg-disabled: var(--alv-color-background-disabled);\n}\n\n:root {\n --alv-z-dropdown: 1000;\n --alv-z-sticky: 1020;\n --alv-z-fixed: 1030;\n --alv-z-modal-backdrop: 1040;\n --alv-z-modal: 1050;\n --alv-z-popover: 1060;\n --alv-z-tooltip: 1070;\n}\n\n:root {\n --alv-button-primary-bg: var(--alv-color-primary);\n --alv-button-primary-bg-hover: var(--alv-color-primary-hover);\n --alv-button-primary-bg-active: var(--alv-color-primary-active);\n --alv-button-primary-text: var(--alv-color-on-primary);\n --alv-button-primary-border: var(--alv-color-primary);\n --alv-button-secondary-bg: transparent;\n --alv-button-secondary-bg-hover: var(--alv-color-primary-light);\n --alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);\n --alv-button-secondary-text: var(--alv-color-primary);\n --alv-button-secondary-border: var(--alv-color-primary);\n --alv-button-tertiary-bg: transparent;\n --alv-button-tertiary-bg-hover: var(--alv-color-gray-100);\n --alv-button-tertiary-bg-active: var(--alv-color-gray-200);\n --alv-button-tertiary-text: var(--alv-color-text-primary);\n --alv-button-tertiary-border: transparent;\n --alv-button-link-bg: transparent;\n --alv-button-link-bg-hover: transparent;\n --alv-button-link-bg-active: transparent;\n --alv-button-link-text: var(--alv-color-primary);\n --alv-button-link-text-hover: var(--alv-color-primary-hover);\n --alv-button-link-border: transparent;\n}\n\n:root {\n --alv-spinner-color: var(--alv-color-text-primary);\n --alv-spinner-size-sm: 1rem;\n --alv-spinner-size-md: 1.5rem;\n --alv-spinner-size-lg: 4rem;\n --alv-spinner-stroke-width: 2px;\n}\n\n:root {\n --alv-timeline-color: var(--alv-color-gray-600);\n --alv-timeline-completed-color: var(--alv-color-success);\n --alv-timeline-error-color: var(--alv-color-error);\n --alv-timeline-pending-color: var(--alv-color-gray-400);\n --alv-timeline-step-size-sm: 1.25rem;\n --alv-timeline-step-size-md: 2rem;\n --alv-timeline-step-size-lg: 2.5rem;\n --alv-timeline-connector-width: 3px;\n --alv-timeline-font-size: var(--alv-font-size-base);\n}\n\n:root {\n --alv-badge-primary-bg: var(--alv-color-primary);\n --alv-badge-primary-text: var(--alv-color-on-primary);\n --alv-badge-secondary-bg: var(--alv-color-gray-200);\n --alv-badge-secondary-text: var(--alv-color-text-primary);\n --alv-badge-success-bg: var(--alv-color-success);\n --alv-badge-success-text: var(--alv-color-on-success);\n --alv-badge-error-bg: var(--alv-color-error);\n --alv-badge-error-text: var(--alv-color-on-error);\n --alv-badge-warning-bg: var(--alv-color-warning);\n --alv-badge-warning-text: var(--alv-color-on-warning);\n --alv-badge-info-bg: var(--alv-color-info);\n --alv-badge-info-text: var(--alv-color-on-info);\n}\n\n:root {\n --alv-list-bg: var(--alv-color-surface);\n --alv-list-border: var(--alv-color-border);\n --alv-list-item-bg: transparent;\n --alv-list-item-bg-hover: var(--alv-color-background-hover);\n --alv-list-item-bg-active: var(--alv-color-background-active);\n --alv-list-item-text: var(--alv-color-text-primary);\n --alv-list-item-text-secondary: var(--alv-color-text-secondary);\n}\n\n:root {\n --alv-radio-border: var(--alv-color-border);\n --alv-radio-border-hover: var(--alv-color-border-hover);\n --alv-radio-border-focus: var(--alv-color-border-focus);\n --alv-radio-bg: var(--alv-color-background);\n --alv-radio-checked-bg: var(--alv-color-primary);\n --alv-radio-checked-border: var(--alv-color-primary);\n --alv-radio-text: var(--alv-color-text-primary);\n --alv-radio-text-disabled: var(--alv-color-text-disabled);\n}\n}";try{if(!("adoptedStyleSheets"in document))throw new Error("Constructable Stylesheets not supported");{ie=new CSSStyleSheet,ie.replaceSync(e);const t=document.adoptedStyleSheets||[];document.adoptedStyleSheets=[...t,ie],ne.debug("[Alviere] Design tokens injected via Constructable Stylesheets (layered)")}}catch(t){const r=document.createElement("style");r.setAttribute("data-alviere-tokens",""),r.textContent=e,document.head.appendChild(r),ne.debug("[Alviere] Design tokens injected via <style> tag (layered fallback)")}le=!0}function ue(e){if(ie&&"adoptedStyleSheets"in e)try{const t=e.adoptedStyleSheets||[];e.adoptedStyleSheets=[...t,ie]}catch(t){ne.warn("[Alviere] Failed to adopt tokens in Shadow DOM:",t)}}var ve;"undefined"!=typeof window&&(window.ALVIERE_TOKENS_CONFIG&&(ve=window.ALVIERE_TOKENS_CONFIG,se={...se,...ve},ve.customTokens&&"undefined"!=typeof document&&(Object.entries(ve.customTokens).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)}),ne.debug("[Alviere] Applied custom tokens:",Object.keys(ve.customTokens))),le&&(ve.customTokens||ve.theme)&&(ne.debug("[Alviere] Re-injecting tokens with new configuration"),function(){const e=document.querySelector("style[data-alviere-tokens]");if(e&&e.remove(),ie&&"adoptedStyleSheets"in document){const e=document.adoptedStyleSheets||[];document.adoptedStyleSheets=e.filter(e=>e!==ie)}ie=null,le=!1}(),ce())),ce());class de{constructor(){this.registered=new Set,this.components=new Map}static getInstance(){return this.instance||(this.instance=new de),this.instance}wrapWithTokenAdoption(e){return class extends e{constructor(){if(super(),this.shadowRoot)ue(this.shadowRoot);else{const e=new MutationObserver(()=>{this.shadowRoot&&(ue(this.shadowRoot),e.disconnect())});e.observe(this,{childList:!0,subtree:!0})}}}}register(e,t){if(ne.debug(`🔍 Registering web component ${e}`,this.registered),this.registered.has(e))return ne.warn(`Web Component ${e} is already registered by Alviere, skipping...`),!1;if(window.customElements.get(e))return ne.warn(`Web component '${e}' is already registered globally, skipping...`),!1;if("undefined"==typeof window||!window.customElements)return ne.warn("Web Components not supported in this environment"),!1;if(this.registered.has(e))return ne.warn(`Web component ${e} is already registered`),!1;if(!t.element)return ne.warn(`Component ${e} does not have an element property`),!1;try{const r=this.wrapWithTokenAdoption(t.element);return window.customElements.define(e,r),this.registered.add(e),this.components.set(e,t),ne.debug(`✅ Web component ${e} registered successfully with token adoption`),!0}catch(r){return ne.error(`❌ Failed to register web component ${e}:`,r),!1}}registerAll(e){e.forEach(({name:e,component:t})=>{this.register(e,t)})}isRegistered(e){return this.registered.has(e)}getRegisteredComponents(){return Array.from(this.registered)}getComponent(e){return this.components.get(e)}clear(){this.registered.clear(),this.components.clear()}}const pe=de.getInstance();"undefined"!=typeof window&&((t=window.__svelte??(window.__svelte={})).v??(t.v=new Set)).add("5");const fe="[!",he={},ge=Symbol(),me=!1;var be=Array.isArray,ye=Array.prototype.indexOf,we=Array.from,_e=Object.keys,xe=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,Ee=Object.getOwnPropertyDescriptors,Se=Object.prototype,ke=Array.prototype,Ae=Object.getPrototypeOf,Te=Object.isExtensible;const Ie=()=>{};function Be(){var e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}const Ne=1<<24,ze=16,Re=32,De=64,Le=128,Ue=512,Pe=1024,Ve=2048,Me=4096,Oe=8192,qe=16384,je=32768,Fe=65536,Ke=1<<17,$e=1<<18,He=1<<19,Ge=32768,We=1<<21,Ye=1<<23,Qe=Symbol("$state"),Je=Symbol("legacy props"),Xe=Symbol(""),Ze=new class extends Error{constructor(){super(...arguments),Y(this,"name","StaleReactionError"),Y(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function et(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let tt,rt=!1;function at(e){rt=e}function nt(e){if(null===e)throw he;return tt=e}function ot(){return nt(xr(tt))}function it(e){if(rt){if(null!==xr(tt))throw he;tt=e}}function lt(e=1){if(rt){for(var t=e,r=tt;t--;)r=xr(r);tt=r}}function st(e=!0){for(var t=0,r=tt;;){if(8===r.nodeType){var a=r.data;if("]"===a){if(0===t)return r;t-=1}else"["!==a&&a!==fe||(t+=1)}var n=xr(r);e&&r.remove(),r=n}}function ct(e){if(!e||8!==e.nodeType)throw he;return e.data}function ut(e){return e===this.v}function vt(e,t){return e!=e?t==t:e!==t||null!==e&&"object"==typeof e||"function"==typeof e}function dt(e){return!vt(e,this.v)}let pt=null;function ft(e){pt=e}function ht(e,t=!1,r){pt={p:pt,i:!1,c:null,e:null,s:e,x:null,l:null}}function gt(e){var t=pt,r=t.e;if(null!==r)for(var a of(t.e=null,r))Pr(a);return void 0!==e&&(t.x=e),t.i=!0,pt=t.p,e??{}}let mt=[];function bt(){var e=mt;mt=[],function(e){for(var t=0;t<e.length;t++)e[t]()}(e)}function yt(e){if(0===mt.length&&!Bt){var t=mt;queueMicrotask(()=>{t===mt&&bt()})}mt.push(e)}function wt(){for(;mt.length>0;)bt()}function _t(e){var t=sa;if(null===t)return oa.f|=Ye,e;if(0===(t.f&je)){if(0===(t.f&Le))throw e;t.b.error(e)}else xt(e,t)}function xt(e,t){for(;null!==t;){if(0!==(t.f&Le))try{return void t.b.error(e)}catch(r){e=r}t=t.parent}throw e}const Ct=new Set;let Et=null,St=null,kt=null,At=[],Tt=null,It=!1,Bt=!1;r=new WeakMap,a=new WeakMap,n=new WeakMap,o=new WeakMap,i=new WeakMap,l=new WeakMap,s=new WeakMap,c=new WeakSet,u=function(e,t){var r;e.f^=Pe;for(var a=e.first;null!==a;){var n=a.f,o=!!(96&n),i=o&&0!==(n&Pe)||0!==(n&Oe)||this.skipped_effects.has(a);if(0!==(a.f&Le)&&(null==(r=a.b)?void 0:r.is_pending())&&(t={parent:t,effect:a,effects:[],render_effects:[],block_effects:[]}),!i&&null!==a.fn){o?a.f^=Pe:4&n?t.effects.push(a):wa(a)&&(0!==(a.f&ze)&&t.block_effects.push(a),Sa(a));var l=a.first;if(null!==l){a=l;continue}}var s=a.parent;for(a=a.next;null===a&&null!==s;)s===t.effect&&(ee(this,c,v).call(this,t.effects),ee(this,c,v).call(this,t.render_effects),ee(this,c,v).call(this,t.block_effects),t=t.parent),a=s.next,s=s.parent}},v=function(e){for(const t of e){(0!==(t.f&Ve)?J(this,l):J(this,s)).push(t),ee(this,c,d).call(this,t.deps),Na(t,Pe)}},d=function(e){if(null!==e)for(const t of e)2&t.f&&0!==(t.f&Ge)&&(t.f^=Ge,ee(this,c,d).call(this,t.deps))},p=function(){if(0===J(this,o)){for(const e of J(this,r))e();J(this,r).clear()}0===J(this,n)&&ee(this,c,f).call(this)},f=function(){var e;if(Ct.size>1){this.previous.clear();var t=kt,r=!0,a={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const t of Ct){if(t===this){r=!1;continue}const o=[];for(const[e,a]of this.current){if(t.current.has(e)){if(!r||a===t.current.get(e))continue;t.current.set(e,a)}o.push(e)}if(0===o.length)continue;const i=[...t.current.keys()].filter(e=>!this.current.has(e));if(i.length>0){var n=At;At=[];const r=new Set,l=new Map;for(const e of o)Pt(e,i,r,l);if(At.length>0){Et=t,t.apply();for(const r of At)ee(e=t,c,u).call(e,r,a);t.deactivate()}At=n}}Et=null,kt=t}this.committed=!0,Ct.delete(this)};let Nt=class e{constructor(){X(this,c),Y(this,"committed",!1),Y(this,"current",new Map),Y(this,"previous",new Map),X(this,r,new Set),X(this,a,new Set),X(this,n,0),X(this,o,0),X(this,i,null),X(this,l,[]),X(this,s,[]),Y(this,"skipped_effects",new Set),Y(this,"is_fork",!1)}is_deferred(){return this.is_fork||J(this,o)>0}process(e){var t;At=[],St=null,this.apply();var r={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const a of e)ee(this,c,u).call(this,a,r);this.is_fork||ee(this,c,p).call(this),this.is_deferred()?(ee(this,c,v).call(this,r.effects),ee(this,c,v).call(this,r.render_effects),ee(this,c,v).call(this,r.block_effects)):(St=this,Et=null,Ut(r.render_effects),Ut(r.effects),St=null,null==(t=J(this,i))||t.resolve()),kt=null}capture(e,t){this.previous.has(e)||this.previous.set(e,t),0===(e.f&Ye)&&(this.current.set(e,e.v),null==kt||kt.set(e,e.v))}activate(){Et=this,this.apply()}deactivate(){Et===this&&(Et=null,kt=null)}flush(){if(this.activate(),At.length>0){if(Rt(),null!==Et&&Et!==this)return}else 0===J(this,n)&&this.process([]);this.deactivate()}discard(){for(const e of J(this,a))e(this);J(this,a).clear()}increment(e){Z(this,n,J(this,n)+1),e&&Z(this,o,J(this,o)+1)}decrement(e){Z(this,n,J(this,n)-1),e&&Z(this,o,J(this,o)-1),this.revive()}revive(){for(const e of J(this,l))Na(e,Ve),Mt(e);for(const e of J(this,s))Na(e,Me),Mt(e);Z(this,l,[]),Z(this,s,[]),this.flush()}oncommit(e){J(this,r).add(e)}ondiscard(e){J(this,a).add(e)}settled(){return(J(this,i)??Z(this,i,Be())).promise}static ensure(){if(null===Et){const t=Et=new e;Ct.add(Et),Bt||e.enqueue(()=>{Et===t&&t.flush()})}return Et}static enqueue(e){yt(e)}apply(){}};function zt(e){var t=Bt;Bt=!0;try{for(;;){if(wt(),0===At.length&&(null==Et||Et.flush(),0===At.length))return void(Tt=null);Rt()}}finally{Bt=t}}function Rt(){var e=ta;It=!0;try{var t=0;for(ra(!0);At.length>0;){var r=Nt.ensure();if(t++>1e3)me,Dt();r.process(At),rr.clear()}}finally{It=!1,ra(e),Tt=null}}function Dt(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(e){xt(e,Tt)}}let Lt=null;function Ut(e){var t=e.length;if(0!==t){for(var r=0;r<t;){var a=e[r++];if(!(24576&a.f)&&wa(a)&&(Lt=new Set,Sa(a),null===a.deps&&null===a.first&&null===a.nodes_start&&(null===a.teardown&&null===a.ac?Wr(a):a.fn=null),(null==Lt?void 0:Lt.size)>0)){rr.clear();for(const e of Lt){if(24576&e.f)continue;const t=[e];let r=e.parent;for(;null!==r;)Lt.has(r)&&(Lt.delete(r),t.push(r)),r=r.parent;for(let e=t.length-1;e>=0;e--){const r=t[e];24576&r.f||Sa(r)}}Lt.clear()}}Lt=null}}function Pt(e,t,r,a){if(!r.has(e)&&(r.add(e),null!==e.reactions))for(const n of e.reactions){const e=n.f;2&e?Pt(n,t,r,a):4194320&e&&0===(e&Ve)&&Vt(n,t,a)&&(Na(n,Ve),Mt(n))}}function Vt(e,t,r){const a=r.get(e);if(void 0!==a)return a;if(null!==e.deps)for(const n of e.deps){if(t.includes(n))return!0;if(2&n.f&&Vt(n,t,r))return r.set(n,!0),!0}return r.set(e,!1),!1}function Mt(e){for(var t=Tt=e;null!==t.parent;){var r=(t=t.parent).f;if(It&&t===sa&&0!==(r&ze)&&0===(r&$e))return;if(96&r){if(0===(r&Pe))return;t.f^=Pe}}At.push(t)}class Ot{constructor(e,t,r){X(this,N),Y(this,"parent"),X(this,h,!1),X(this,g),X(this,m,rt?tt:null),X(this,b),X(this,y),X(this,w),X(this,_,null),X(this,x,null),X(this,C,null),X(this,E,null),X(this,S,null),X(this,k,0),X(this,A,0),X(this,T,!1),X(this,I,null),X(this,B,function(e){let t,r=0,a=nr(0);return()=>{Dr()&&(ka(a),Mr(()=>(0===r&&(t=Ia(()=>e(()=>ur(a)))),r+=1,()=>{yt(()=>{r-=1,0===r&&(null==t||t(),t=void 0,ur(a))})})))}}(()=>(Z(this,I,nr(J(this,k))),()=>{Z(this,I,null)}))),Z(this,g,e),Z(this,b,t),Z(this,y,r),this.parent=sa.b,Z(this,h,!!J(this,b).pending),Z(this,w,qr(()=>{if(sa.b=this,rt){const e=J(this,m);ot();8===e.nodeType&&e.data===fe?ee(this,N,R).call(this):ee(this,N,z).call(this)}else{var e=ee(this,N,D).call(this);try{Z(this,_,Fr(()=>r(e)))}catch(t){this.error(t)}J(this,A)>0?ee(this,N,U).call(this):Z(this,h,!1)}return()=>{var e;null==(e=J(this,S))||e.remove()}},589952)),rt&&Z(this,g,tt)}is_pending(){return J(this,h)||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!J(this,b).pending}update_pending_count(e){ee(this,N,P).call(this,e),Z(this,k,J(this,k)+e),J(this,I)&&sr(J(this,I),J(this,k))}get_effect_pending(){return J(this,B).call(this),ka(J(this,I))}error(e){var t=J(this,b).onerror;let r=J(this,b).failed;if(J(this,T)||!t&&!r)throw e;J(this,_)&&(Hr(J(this,_)),Z(this,_,null)),J(this,x)&&(Hr(J(this,x)),Z(this,x,null)),J(this,C)&&(Hr(J(this,C)),Z(this,C,null)),rt&&(nt(J(this,m)),lt(),nt(st()));var a=!1,n=!1;const o=()=>{a||(a=!0,n&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),Nt.ensure(),Z(this,k,0),null!==J(this,C)&&Yr(J(this,C),()=>{Z(this,C,null)}),Z(this,h,this.has_pending_snippet()),Z(this,_,ee(this,N,L).call(this,()=>(Z(this,T,!1),Fr(()=>J(this,y).call(this,J(this,g)))))),J(this,A)>0?ee(this,N,U).call(this):Z(this,h,!1))};var i=oa;try{la(null),n=!0,null==t||t(e,o),n=!1}catch(l){xt(l,J(this,w)&&J(this,w).parent)}finally{la(i)}r&&yt(()=>{Z(this,C,ee(this,N,L).call(this,()=>{Nt.ensure(),Z(this,T,!0);try{return Fr(()=>{r(J(this,g),()=>e,()=>o)})}catch(l){return xt(l,J(this,w).parent),null}finally{Z(this,T,!1)}}))})}}function qt(e,t){return t}function jt(e,t,r,a,n,o=null){var i=e,l=new Map,s=null,c=!!(1&t),u=!!(2&t);if(!!(4&t)){var v=e;i=rt?nt(_r(v)):v.appendChild(wr())}rt&&ot();var d,p=null,f=Jt(()=>{var e=r();return be(e)?e:null==e?[]:we(e)}),h=!0;function g(){!function(e,t,r,a,n){var o,i,l,s,c,u,v,d,p,f=!!(8&a),h=t.length,g=e.items,m=e.first,b=null,y=[],w=[];if(f)for(p=0;p<h;p+=1)v=n(t[p],p),(d=g.get(v)).o&&(null==(o=d.a)||o.measure(),(u??(u=new Set)).add(d));for(p=0;p<h;p+=1)if(v=n(t[p],p),d=g.get(v),e.first??(e.first=d),d.o){if(0!==(d.e.f&Oe)&&(Xr(d.e),f&&(null==(i=d.a)||i.unfix(),(u??(u=new Set)).delete(d))),d!==m){if(void 0!==c&&c.has(d)){if(y.length<w.length){var _,x=w[0];b=x.prev;var C=y[0],E=y[y.length-1];for(_=0;_<y.length;_+=1)Kt(y[_],x,r);for(_=0;_<w.length;_+=1)c.delete(w[_]);$t(e,C.prev,E.next),$t(e,b,C),$t(e,E,x),m=x,b=E,p-=1,y=[],w=[]}else c.delete(d),Kt(d,m,r),$t(e,d.prev,d.next),$t(e,d,null===b?e.first:b.next),$t(e,b,d),b=d;continue}for(y=[],w=[];null!==m&&m.k!==v;)0===(m.e.f&Oe)&&(c??(c=new Set)).add(m),w.push(m),m=m.next;if(null===m)continue;d=m}y.push(d),b=d,m=d.next}else{d.o=!0;var S=b?b.next:m;$t(e,b,d),$t(e,d,S),Kt(d,S,r),y=[],w=[],m=(b=d).next}if(null!==m||void 0!==c){for(var k=void 0===c?[]:we(c);null!==m;)0===(m.e.f&Oe)&&k.push(m),m=m.next;var A=k.length;if(A>0){var T=4&a&&0===h?r:null;if(f){for(p=0;p<A;p+=1)null==(l=k[p].a)||l.measure();for(p=0;p<A;p+=1)null==(s=k[p].a)||s.fix()}!function(e,t,r){for(var a=[],n=t.length,o=0;o<n;o++)Jr(t[o].e,a,!0);Qr(a,()=>{var o=0===a.length&&null!==r;if(o){var i=r,l=i.parentNode;kr(l),l.append(i),e.items.clear(),$t(e,t[0].prev,t[n-1].next)}for(var s=0;s<n;s++){var c=t[s];o||(e.items.delete(c.k),$t(e,c.prev,c.next)),Hr(c.e,!o)}e.first===t[0]&&(e.first=t[0].prev)})}(e,k,T)}}f&&yt(()=>{var e;if(void 0!==u)for(d of u)null==(e=d.a)||e.apply()})}(b,d,i,t,a),null!==p&&(0===d.length?(p.fragment?(i.before(p.fragment),p.fragment=null):Xr(p.effect),m.first=p.effect):Yr(p.effect,()=>{p=null}))}var m=qr(()=>{var e=(d=ka(f)).length;let v=!1;rt&&(ct(i)===fe!==(0===e)&&(nt(i=st()),at(!1),v=!0));for(var m=new Set,b=null,y=0;y<e;y+=1){rt&&8===tt.nodeType&&"]"===tt.data&&(i=tt,v=!0,at(!1));var w=d[y],_=a(w,y),x=h?null:l.get(_);x?(c&&sr(x.v,w),u?sr(x.i,y):x.i=y):(x=Ft(h?i:null,b,w,_,y,n,t,r),h&&(x.o=!0,null===b?s=x:b.next=x,b=x),l.set(_,x)),m.add(_)}if(0===e&&o&&!p)if(h)p={fragment:null,effect:Fr(()=>o(i))};else{var C=document.createDocumentFragment(),E=wr();C.append(E),p={fragment:C,effect:Fr(()=>o(E))}}rt&&e>0&&nt(st()),h||g(),v&&at(!0),ka(f)}),b={effect:m,items:l,first:s};h=!1,rt&&(i=tt)}function Ft(e,t,r,a,n,o,i,l){var s=!!(1&i)?!(16&i)?ir(r,!1,!1):nr(r):r,c=2&i?nr(n):n,u={i:c,v:s,k:a,a:null,e:null,o:!1,prev:t,next:null};try{if(null===e)document.createDocumentFragment().append(e=wr());return u.e=Fr(()=>o(e,s,c,l)),null!==t&&(t.next=u),u}finally{}}function Kt(e,t,r){for(var a=e.next?e.next.e.nodes_start:r,n=t?t.e.nodes_start:r,o=e.e.nodes_start;null!==o&&o!==a;){var i=xr(o);n.before(o),o=i}}function $t(e,t,r){null===t?(e.first=r,e.effect.first=r&&r.e):(t.e===e.effect.last&&null!==r&&(e.effect.last=r.e),t.e.next&&(t.e.next.prev=null),t.next=r,t.e.next=r&&r.e),null===r?e.effect.last=t&&t.e:(r.e===e.effect.last&&null===t&&(e.effect.last=r.e.prev),r.e.prev&&(r.e.prev.next=null),r.prev=t,r.e.prev=t&&t.e)}function Ht(e,t,r,a){const n=Wt;if(0!==r.length||0!==e.length){var o,i,l,s,c=Et,u=sa,v=(o=sa,i=oa,l=pt,s=Et,function(e=!0){ca(o),la(i),ft(l),e&&(null==s||s.activate())});e.length>0?Promise.all(e).then(()=>{v();try{return d()}finally{null==c||c.deactivate(),Gt()}}):d()}else a(t.map(n));function d(){Promise.all(r.map(e=>Yt(e))).then(e=>{v();try{a([...t.map(n),...e])}catch(r){0===(u.f&qe)&&xt(r,u)}null==c||c.deactivate(),Gt()}).catch(e=>{xt(e,u)})}}function Gt(){ca(null),la(null),ft(null)}function Wt(e){var t=null!==oa&&2&oa.f?oa:null;null!==sa&&(sa.f|=He);return{ctx:pt,deps:null,effects:null,equals:ut,f:2050,fn:e,reactions:null,rv:0,v:ge,wv:0,parent:t??sa,ac:null}}function Yt(e,t){let r=sa;null===r&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var a=r.b,n=void 0,o=nr(ge),i=!oa,l=new Map;return function(e){Rr(4718592,e,!0)}(()=>{var t,r=Be();n=r.promise;try{Promise.resolve(e()).then(r.resolve,r.reject).then(()=>{s===Et&&s.committed&&s.deactivate(),Gt()})}catch(v){r.reject(v),Gt()}var s=Et;if(i){var c=!a.is_pending();a.update_pending_count(1),s.increment(c),null==(t=l.get(s))||t.reject(Ze),l.delete(s),l.set(s,r)}const u=(e,t=void 0)=>{if(s.activate(),t)t!==Ze&&(o.f|=Ye,sr(o,t));else{0!==(o.f&Ye)&&(o.f^=Ye),sr(o,e);for(const[e,t]of l){if(l.delete(e),e===s)break;t.reject(Ze)}}i&&(a.update_pending_count(-1),s.decrement(c))};r.promise.then(u,e=>u(null,e||"unknown"))}),Lr(()=>{for(const e of l.values())e.reject(Ze)}),new Promise(e=>{!function t(r){function a(){r===n?e(o):t(n)}r.then(a,a)}(n)})}function Qt(e){const t=Wt(e);return va(t),t}function Jt(e){const t=Wt(e);return t.equals=dt,t}function Xt(e){var t=e.effects;if(null!==t){e.effects=null;for(var r=0;r<t.length;r+=1)Hr(t[r])}}function Zt(e){var t,r=sa;ca(function(e){for(var t=e.parent;null!==t;){if(!(2&t.f))return 0===(t.f&qe)?t:null;t=t.parent}return null}(e));try{e.f&=-32769,Xt(e),t=xa(e)}finally{ca(r)}return t}function er(e){var t=Zt(e);(e.equals(t)||((null==Et?void 0:Et.is_fork)||(e.v=t),e.wv=ya()),aa)||(null!==kt?(Dr()||(null==Et?void 0:Et.is_fork))&&kt.set(e,t):Na(e,0===(e.f&Ue)?Me:Pe))}h=new WeakMap,g=new WeakMap,m=new WeakMap,b=new WeakMap,y=new WeakMap,w=new WeakMap,_=new WeakMap,x=new WeakMap,C=new WeakMap,E=new WeakMap,S=new WeakMap,k=new WeakMap,A=new WeakMap,T=new WeakMap,I=new WeakMap,B=new WeakMap,N=new WeakSet,z=function(){try{Z(this,_,Fr(()=>J(this,y).call(this,J(this,g))))}catch(e){this.error(e)}Z(this,h,!1)},R=function(){const e=J(this,b).pending;e&&(Z(this,x,Fr(()=>e(J(this,g)))),Nt.enqueue(()=>{var e=ee(this,N,D).call(this);Z(this,_,ee(this,N,L).call(this,()=>(Nt.ensure(),Fr(()=>J(this,y).call(this,e))))),J(this,A)>0?ee(this,N,U).call(this):(Yr(J(this,x),()=>{Z(this,x,null)}),Z(this,h,!1))}))},D=function(){var e=J(this,g);return J(this,h)&&(Z(this,S,wr()),J(this,g).before(J(this,S)),e=J(this,S)),e},L=function(e){var t=sa,r=oa,a=pt;ca(J(this,w)),la(J(this,w)),ft(J(this,w).ctx);try{return e()}catch(n){return _t(n),null}finally{ca(t),la(r),ft(a)}},U=function(){const e=J(this,b).pending;null!==J(this,_)&&(Z(this,E,document.createDocumentFragment()),J(this,E).append(J(this,S)),ea(J(this,_),J(this,E))),null===J(this,x)&&Z(this,x,Fr(()=>e(J(this,g))))},P=function(e){var t;this.has_pending_snippet()?(Z(this,A,J(this,A)+e),0===J(this,A)&&(Z(this,h,!1),J(this,x)&&Yr(J(this,x),()=>{Z(this,x,null)}),J(this,E)&&(J(this,g).before(J(this,E)),Z(this,E,null)))):this.parent&&ee(t=this.parent,N,P).call(t,e)};let tr=new Set;const rr=new Map;let ar=!1;function nr(e,t){return{f:0,v:e,reactions:null,equals:ut,rv:0,wv:0}}function or(e,t){const r=nr(e);return va(r),r}function ir(e,t=!1,r=!0){const a=nr(e);return t||(a.equals=dt),a}function lr(e,t,r=!1){return null===oa||ia&&0===(oa.f&Ke)||!(4325394&oa.f)||(null==ua?void 0:ua.includes(e))||function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),sr(e,r?dr(t):t)}function sr(e,t){if(!e.equals(t)){var r=e.v;aa?rr.set(e,t):rr.set(e,r),e.v=t;var a=Nt.ensure();a.capture(e,r),2&e.f&&(0!==(e.f&Ve)&&Zt(e),Na(e,0!==(e.f&Ue)?Pe:Me)),e.wv=ya(),vr(e,Ve),null===sa||0===(sa.f&Pe)||96&sa.f||(null===fa?function(e){fa=e}([e]):fa.push(e)),!a.is_fork&&tr.size>0&&!ar&&function(){ar=!1;var e=ta;ra(!0);const t=Array.from(tr);try{for(const e of t)0!==(e.f&Pe)&&Na(e,Me),wa(e)&&Sa(e)}finally{ra(e)}tr.clear()}()}return t}function cr(e,t=1){var r=ka(e),a=1===t?r++:r--;return lr(e,r),a}function ur(e){lr(e,e.v+1)}function vr(e,t){var r=e.reactions;if(null!==r)for(var a=r.length,n=0;n<a;n++){var o=r[n],i=o.f,l=0===(i&Ve);if(l&&Na(o,t),2&i){var s=o;null==kt||kt.delete(s),0===(i&Ge)&&(i&Ue&&(o.f|=Ge),vr(s,Me))}else l&&(0!==(i&ze)&&null!==Lt&&Lt.add(o),Mt(o))}}function dr(e){if("object"!=typeof e||null===e||Qe in e)return e;const t=Ae(e);if(t!==Se&&t!==ke)return e;var r=new Map,a=be(e),n=or(0),o=ma,i=e=>{if(ma===o)return e();var t=oa,r=ma;la(null),ba(o);var a=e();return la(t),ba(r),a};return a&&r.set("length",or(e.length)),new Proxy(e,{defineProperty(e,t,a){"value"in a&&!1!==a.configurable&&!1!==a.enumerable&&!1!==a.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var n=r.get(t);return void 0===n?n=i(()=>{var e=or(a.value);return r.set(t,e),e}):lr(n,a.value,!0),!0},deleteProperty(e,t){var a=r.get(t);if(void 0===a){if(t in e){const e=i(()=>or(ge));r.set(t,e),ur(n)}}else lr(a,ge),ur(n);return!0},get(t,a,n){var o;if(a===Qe)return e;var l=r.get(a),s=a in t;if(void 0!==l||s&&!(null==(o=Ce(t,a))?void 0:o.writable)||(l=i(()=>or(dr(s?t[a]:ge))),r.set(a,l)),void 0!==l){var c=ka(l);return c===ge?void 0:c}return Reflect.get(t,a,n)},getOwnPropertyDescriptor(e,t){var a=Reflect.getOwnPropertyDescriptor(e,t);if(a&&"value"in a){var n=r.get(t);n&&(a.value=ka(n))}else if(void 0===a){var o=r.get(t),i=null==o?void 0:o.v;if(void 0!==o&&i!==ge)return{enumerable:!0,configurable:!0,value:i,writable:!0}}return a},has(e,t){var a;if(t===Qe)return!0;var n=r.get(t),o=void 0!==n&&n.v!==ge||Reflect.has(e,t);if((void 0!==n||null!==sa&&(!o||(null==(a=Ce(e,t))?void 0:a.writable)))&&(void 0===n&&(n=i(()=>or(o?dr(e[t]):ge)),r.set(t,n)),ka(n)===ge))return!1;return o},set(e,t,o,l){var s,c=r.get(t),u=t in e;if(a&&"length"===t)for(var v=o;v<c.v;v+=1){var d=r.get(v+"");void 0!==d?lr(d,ge):v in e&&(d=i(()=>or(ge)),r.set(v+"",d))}void 0===c?u&&!(null==(s=Ce(e,t))?void 0:s.writable)||(lr(c=i(()=>or(void 0)),dr(o)),r.set(t,c)):(u=c.v!==ge,lr(c,i(()=>dr(o))));var p=Reflect.getOwnPropertyDescriptor(e,t);if((null==p?void 0:p.set)&&p.set.call(l,o),!u){if(a&&"string"==typeof t){var f=r.get("length"),h=Number(t);Number.isInteger(h)&&h>=f.v&&lr(f,h+1)}ur(n)}return!0},ownKeys(e){ka(n);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return void 0===t||t.v!==ge});for(var[a,o]of r)o.v===ge||a in e||t.push(a);return t},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function pr(e){try{if(null!==e&&"object"==typeof e&&Qe in e)return e[Qe]}catch{}return e}function fr(e,t){return Object.is(pr(e),pr(t))}var hr,gr,mr,br;function yr(){if(void 0===hr){hr=window,gr=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;mr=Ce(t,"firstChild").get,br=Ce(t,"nextSibling").get,Te(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Te(r)&&(r.__t=void 0)}}function wr(e=""){return document.createTextNode(e)}function _r(e){return mr.call(e)}function xr(e){return br.call(e)}function Cr(e,t){if(!rt)return _r(e);var r=_r(tt);if(null===r)r=tt.appendChild(wr());else if(t&&3!==r.nodeType){var a=wr();return null==r||r.before(a),nt(a),a}return nt(r),r}function Er(e,t=!1){if(!rt){var r=_r(e);return r instanceof Comment&&""===r.data?xr(r):r}if(t&&3!==(null==tt?void 0:tt.nodeType)){var a=wr();return null==tt||tt.before(a),nt(a),a}return tt}function Sr(e,t=1,r=!1){let a=rt?tt:e;for(var n;t--;)n=a,a=xr(a);if(!rt)return a;if(r&&3!==(null==a?void 0:a.nodeType)){var o=wr();return null===a?null==n||n.after(o):a.before(o),nt(o),o}return nt(a),a}function kr(e){e.textContent=""}function Ar(e,t){if(t){const t=document.body;e.autofocus=!0,yt(()=>{document.activeElement===t&&e.focus()})}}let Tr=!1;function Ir(){Tr||(Tr=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)null==(t=r.__on_r)||t.call(r)})},{capture:!0}))}function Br(e){var t=oa,r=sa;la(null),ca(null);try{return e()}finally{la(t),ca(r)}}function Nr(e,t,r,a=r){e.addEventListener(t,()=>Br(r));const n=e.__on_r;e.__on_r=n?()=>{n(),a(!0)}:()=>a(!0),Ir()}function zr(e){null===sa&&(null===oa&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),aa&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function Rr(e,t,r){var a=sa;null!==a&&0!==(a.f&Oe)&&(e|=Oe);var n={ctx:pt,deps:null,nodes_start:null,nodes_end:null,f:e|Ve|Ue,first:null,fn:t,last:null,next:null,parent:a,b:a&&a.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{Sa(n),n.f|=je}catch(l){throw Hr(n),l}else null!==t&&Mt(n);var o=n;if(r&&null===o.deps&&null===o.teardown&&null===o.nodes_start&&o.first===o.last&&0===(o.f&He)&&(o=o.first,0!==(e&ze)&&0!==(e&Fe)&&null!==o&&(o.f|=Fe)),null!==o&&(o.parent=a,null!==a&&function(e,t){var r=t.last;null===r?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}(o,a),null!==oa&&2&oa.f&&0===(e&De))){var i=oa;(i.effects??(i.effects=[])).push(o)}return n}function Dr(){return null!==oa&&!ia}function Lr(e){const t=Rr(8,null,!1);return Na(t,Pe),t.teardown=e,t}function Ur(e){zr();var t=sa.f;if(!(!oa&&0!==(t&Re)&&0===(t&je)))return Pr(e);var r=pt;(r.e??(r.e=[])).push(e)}function Pr(e){return Rr(1048580,e,!1)}function Vr(e){return Rr(4,e,!1)}function Mr(e,t=0){return Rr(8|t,e,!0)}function Or(e,t=[],r=[],a=[]){Ht(a,t,r,t=>{Rr(8,()=>e(...t.map(ka)),!0)})}function qr(e,t=0){return Rr(ze|t,e,!0)}function jr(e,t=0){return Rr(Ne|t,e,!0)}function Fr(e){return Rr(524320,e,!0)}function Kr(e){var t=e.teardown;if(null!==t){const e=aa,r=oa;na(!0),la(null);try{t.call(null)}finally{na(e),la(r)}}}function $r(e,t=!1){var r=e.first;for(e.first=e.last=null;null!==r;){const e=r.ac;null!==e&&Br(()=>{e.abort(Ze)});var a=r.next;0!==(r.f&De)?r.parent=null:Hr(r,t),r=a}}function Hr(e,t=!0){var r=!1;!t&&0===(e.f&$e)||null===e.nodes_start||null===e.nodes_end||(Gr(e.nodes_start,e.nodes_end),r=!0),$r(e,t&&!r),Ea(e,0),Na(e,qe);var a=e.transitions;if(null!==a)for(const o of a)o.stop();Kr(e);var n=e.parent;null!==n&&null!==n.first&&Wr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function Gr(e,t){for(;null!==e;){var r=e===t?null:xr(e);e.remove(),e=r}}function Wr(e){var t=e.parent,r=e.prev,a=e.next;null!==r&&(r.next=a),null!==a&&(a.prev=r),null!==t&&(t.first===e&&(t.first=a),t.last===e&&(t.last=r))}function Yr(e,t,r=!0){var a=[];Jr(e,a,!0),Qr(a,()=>{r&&Hr(e),t&&t()})}function Qr(e,t){var r=e.length;if(r>0){var a=()=>--r||t();for(var n of e)n.out(a)}else t()}function Jr(e,t,r){if(0===(e.f&Oe)){if(e.f^=Oe,null!==e.transitions)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var a=e.first;null!==a;){var n=a.next;Jr(a,t,!!(0!==(a.f&Fe)||0!==(a.f&Re)&&0!==(e.f&ze))&&r),a=n}}}function Xr(e){Zr(e,!0)}function Zr(e,t){if(0!==(e.f&Oe)){e.f^=Oe,0===(e.f&Pe)&&(Na(e,Ve),Mt(e));for(var r=e.first;null!==r;){var a=r.next;Zr(r,!!(0!==(r.f&Fe)||0!==(r.f&Re))&&t),r=a}if(null!==e.transitions)for(const r of e.transitions)(r.is_global||t)&&r.in()}}function ea(e,t){for(var r=e.nodes_start,a=e.nodes_end;null!==r;){var n=r===a?null:xr(r);t.append(r),r=n}}let ta=!1;function ra(e){ta=e}let aa=!1;function na(e){aa=e}let oa=null,ia=!1;function la(e){oa=e}let sa=null;function ca(e){sa=e}let ua=null;function va(e){null!==oa&&(null===ua?ua=[e]:ua.push(e))}let da=null,pa=0,fa=null;let ha=1,ga=0,ma=ga;function ba(e){ma=e}function ya(){return++ha}function wa(e){var t=e.f;if(0!==(t&Ve))return!0;if(2&t&&(e.f&=-32769),0!==(t&Me)){var r=e.deps;if(null!==r)for(var a=r.length,n=0;n<a;n++){var o=r[n];if(wa(o)&&er(o),o.wv>e.wv)return!0}0!==(t&Ue)&&null===kt&&Na(e,Pe)}return!1}function _a(e,t,r=!0){var a=e.reactions;if(null!==a&&!(null==ua?void 0:ua.includes(e)))for(var n=0;n<a.length;n++){var o=a[n];2&o.f?_a(o,t,!1):t===o&&(r?Na(o,Ve):0!==(o.f&Pe)&&Na(o,Me),Mt(o))}}function xa(e){var t,r=da,a=pa,n=fa,o=oa,i=ua,l=pt,s=ia,c=ma,u=e.f;da=null,pa=0,fa=null,oa=96&u?null:e,ua=null,ft(e.ctx),ia=!1,ma=++ga,null!==e.ac&&(Br(()=>{e.ac.abort(Ze)}),e.ac=null);try{e.f|=We;var v=(0,e.fn)(),d=e.deps;if(null!==da){var p;if(Ea(e,pa),null!==d&&pa>0)for(d.length=pa+da.length,p=0;p<da.length;p++)d[pa+p]=da[p];else e.deps=d=da;if(ta&&Dr()&&0!==(e.f&Ue))for(p=pa;p<d.length;p++)((t=d[p]).reactions??(t.reactions=[])).push(e)}else null!==d&&pa<d.length&&(Ea(e,pa),d.length=pa);if(!(null===fa||ia||null===d||6146&e.f))for(p=0;p<fa.length;p++)_a(fa[p],e);return null!==o&&o!==e&&(ga++,null!==fa&&(null===n?n=fa:n.push(...fa))),0!==(e.f&Ye)&&(e.f^=Ye),v}catch(f){return _t(f)}finally{e.f^=We,da=r,pa=a,fa=n,oa=o,ua=i,ft(l),ia=s,ma=c}}function Ca(e,t){let r=t.reactions;if(null!==r){var a=ye.call(r,e);if(-1!==a){var n=r.length-1;0===n?r=t.reactions=null:(r[a]=r[n],r.pop())}}null===r&&2&t.f&&(null===da||!da.includes(t))&&(Na(t,Me),0!==(t.f&Ue)&&(t.f^=Ue,t.f&=-32769),Xt(t),Ea(t,0))}function Ea(e,t){var r=e.deps;if(null!==r)for(var a=t;a<r.length;a++)Ca(e,r[a])}function Sa(e){var t=e.f;if(0===(t&qe)){Na(e,Pe);var r=sa,a=ta;sa=e,ta=!0;try{16777232&t?function(e){for(var t=e.first;null!==t;){var r=t.next;0===(t.f&Re)&&Hr(t),t=r}}(e):$r(e),Kr(e);var n=xa(e);e.teardown="function"==typeof n?n:null,e.wv=ha}finally{ta=a,sa=r}}}function ka(e){var t=!!(2&e.f);if(null!==oa&&!ia&&(!(null!==sa&&0!==(sa.f&qe))&&!(null==ua?void 0:ua.includes(e)))){var r=oa.deps;if(0!==(oa.f&We))e.rv<ga&&(e.rv=ga,null===da&&null!==r&&r[pa]===e?pa++:null===da?da=[e]:da.includes(e)||da.push(e));else{(oa.deps??(oa.deps=[])).push(e);var a=e.reactions;null===a?e.reactions=[oa]:a.includes(oa)||a.push(oa)}}if(aa){if(rr.has(e))return rr.get(e);if(t){var n=e,o=n.v;return(0===(n.f&Pe)&&null!==n.reactions||Ta(n))&&(o=Zt(n)),rr.set(n,o),o}}else t&&(!(null==kt?void 0:kt.has(e))||(null==Et?void 0:Et.is_fork)&&!Dr())&&(wa(n=e)&&er(n),ta&&Dr()&&0===(n.f&Ue)&&Aa(n));if(null==kt?void 0:kt.has(e))return kt.get(e);if(0!==(e.f&Ye))throw e.v;return e.v}function Aa(e){if(null!==e.deps){e.f^=Ue;for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),2&t.f&&0===(t.f&Ue)&&Aa(t)}}function Ta(e){if(e.v===ge)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(rr.has(t))return!0;if(2&t.f&&Ta(t))return!0}return!1}function Ia(e){var t=ia;try{return ia=!0,e()}finally{ia=t}}const Ba=-7169;function Na(e,t){e.f=e.f&Ba|t}const za=new Set,Ra=new Set;function Da(e,t,r,a={}){function n(e){if(a.capture||Va.call(t,e),!e.cancelBubble)return Br(()=>null==r?void 0:r.call(this,e))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?yt(()=>{t.addEventListener(e,n,a)}):t.addEventListener(e,n,a),n}function La(e,t,r,a,n){var o={capture:a,passive:n},i=Da(e,t,r,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Lr(()=>{t.removeEventListener(e,i,o)})}function Ua(e){for(var t=0;t<e.length;t++)za.add(e[t]);for(var r of Ra)r(e)}let Pa=null;function Va(e){var t,r=this,a=r.ownerDocument,n=e.type,o=(null==(t=e.composedPath)?void 0:t.call(e))||[],i=o[0]||e.target;Pa=e;var l=0,s=Pa===e&&e.__root;if(s){var c=o.indexOf(s);if(-1!==c&&(r===document||r===window))return void(e.__root=r);var u=o.indexOf(r);if(-1===u)return;c<=u&&(l=c)}if((i=o[l]||e.target)!==r){xe(e,"currentTarget",{configurable:!0,get:()=>i||a});var v=oa,d=sa;la(null),ca(null);try{for(var p,f=[];null!==i;){var h=i.assignedSlot||i.parentNode||i.host||null;try{var g=i["__"+n];null==g||i.disabled&&e.target!==i||g.call(i,e)}catch(m){p?f.push(m):p=m}if(e.cancelBubble||h===r||null===h)break;i=h}if(p){for(let e of f)queueMicrotask(()=>{throw e});throw p}}finally{e.__root=r,delete e.currentTarget,la(v),ca(d)}}}function Ma(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),t.content}function Oa(e,t){var r=sa;null===r.nodes_start&&(r.nodes_start=e,r.nodes_end=t)}function qa(e,t){var r,a=!!(1&t),n=!!(2&t),o=!e.startsWith("<!>");return()=>{if(rt)return Oa(tt,null),tt;void 0===r&&(r=Ma(o?e:"<!>"+e),a||(r=_r(r)));var t=n||gr?document.importNode(r,!0):r.cloneNode(!0);a?Oa(_r(t),t.lastChild):Oa(t,t);return t}}function ja(e,t,r="svg"){var a,n=`<${r}>${!e.startsWith("<!>")?e:"<!>"+e}</${r}>`;return()=>{if(rt)return Oa(tt,null),tt;if(!a){var e=Ma(n);a=_r(_r(e))}var t=a.cloneNode(!0);return Oa(t,t),t}}function Fa(e,t){return ja(e,0,"svg")}function Ka(e=""){if(!rt){var t=wr(e+"");return Oa(t,t),t}var r=tt;return 3!==r.nodeType&&(r.before(r=wr()),nt(r)),Oa(r,r),r}function $a(){if(rt)return Oa(tt,null),tt;var e=document.createDocumentFragment(),t=document.createComment(""),r=wr();return e.append(t,r),Oa(t,r),e}function Ha(e,t){if(rt){var r=sa;return 0!==(r.f&je)&&null!==r.nodes_end||(r.nodes_end=tt),void ot()}null!==e&&e.before(t)}function Ga(e){return e.endsWith("capture")&&"gotpointercapture"!==e&&"lostpointercapture"!==e}const Wa=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ya(e){return Wa.includes(e)}const Qa={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Ja(e){return e=e.toLowerCase(),Qa[e]??e}const Xa=["touchstart","touchmove"];function Za(e){return Xa.includes(e)}const en=["textarea","script","style","title"];let tn=!0;function rn(e){tn=e}function an(e,t){var r=null==t?"":"object"==typeof t?t+"":t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=r+"")}function nn(e,t){return sn(e,t)}function on(e,t){yr(),t.intro=t.intro??!1;const r=t.target,a=rt,n=tt;try{for(var o=_r(r);o&&(8!==o.nodeType||"["!==o.data);)o=xr(o);if(!o)throw he;at(!0),nt(o);const a=sn(e,{...t,anchor:o});return at(!1),a}catch(i){if(i instanceof Error&&i.message.split("\n").some(e=>e.startsWith("https://svelte.dev/e/")))throw i;return!1===t.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),yr(),kr(r),at(!1),nn(e,t)}finally{at(a),nt(n)}}const ln=new Map;function sn(e,{target:t,anchor:r,props:a={},events:n,context:o,intro:i=!0}){yr();var l=new Set,s=e=>{for(var r=0;r<e.length;r++){var a=e[r];if(!l.has(a)){l.add(a);var n=Za(a);t.addEventListener(a,Va,{passive:n});var o=ln.get(a);void 0===o?(document.addEventListener(a,Va,{passive:n}),ln.set(a,1)):ln.set(a,o+1)}}};s(we(za)),Ra.add(s);var c=void 0,u=function(e){Nt.ensure();const t=Rr(524352,e,!0);return(e={})=>new Promise(r=>{e.outro?Yr(t,()=>{Hr(t),r(void 0)}):(Hr(t),r(void 0))})}(()=>{var u=r??t.appendChild(wr());return function(e,t,r){new Ot(e,t,r)}(u,{pending:()=>{}},t=>{o&&(ht({}),pt.c=o);if(n&&(a.$$events=n),rt&&Oa(t,null),tn=i,c=e(t,a)||{},tn=!0,rt&&(sa.nodes_end=tt,null===tt||8!==tt.nodeType||"]"!==tt.data))throw he;o&&gt()}),()=>{var e;for(var a of l){t.removeEventListener(a,Va);var n=ln.get(a);0===--n?(document.removeEventListener(a,Va),ln.delete(a)):ln.set(a,n)}Ra.delete(s),u!==r&&(null==(e=u.parentNode)||e.removeChild(u))}});return cn.set(c,u),c}let cn=new WeakMap;class un{constructor(e,t=!0){Y(this,"anchor"),X(this,V,new Map),X(this,M,new Map),X(this,O,new Map),X(this,q,new Set),X(this,j,!0),X(this,F,()=>{var e=Et;if(J(this,V).has(e)){var t=J(this,V).get(e),r=J(this,M).get(t);if(r)Xr(r),J(this,q).delete(t);else{var a=J(this,O).get(t);a&&(J(this,M).set(t,a.effect),J(this,O).delete(t),a.fragment.lastChild.remove(),this.anchor.before(a.fragment),r=a.effect)}for(const[t,r]of J(this,V)){if(J(this,V).delete(t),t===e)break;const a=J(this,O).get(r);a&&(Hr(a.effect),J(this,O).delete(r))}for(const[e,a]of J(this,M)){if(e===t||J(this,q).has(e))continue;const n=()=>{if(Array.from(J(this,V).values()).includes(e)){var t=document.createDocumentFragment();ea(a,t),t.append(wr()),J(this,O).set(e,{effect:a,fragment:t})}else Hr(a);J(this,q).delete(e),J(this,M).delete(e)};J(this,j)||!r?(J(this,q).add(e),Yr(a,n,!1)):n()}}}),X(this,K,e=>{J(this,V).delete(e);const t=Array.from(J(this,V).values());for(const[r,a]of J(this,O))t.includes(r)||(Hr(a.effect),J(this,O).delete(r))}),this.anchor=e,Z(this,j,t)}ensure(e,t){var r=Et;!t||J(this,M).has(e)||J(this,O).has(e)||J(this,M).set(e,Fr(()=>t(this.anchor)));J(this,V).set(r,e),rt&&(this.anchor=tt),J(this,F).call(this)}}function vn(e){null===pt&&et(),Ur(()=>{const t=Ia(e);if("function"==typeof t)return t})}function dn(){const e=pt;return null===e&&et(),(t,r,a)=>{var n;const o=null==(n=e.s.$$events)?void 0:n[t];if(o){const n=be(o)?o.slice():[o],i=function(e,t,{bubbles:r=!1,cancelable:a=!1}={}){return new CustomEvent(e,{detail:t,bubbles:r,cancelable:a})}(t,r,a);for(const t of n)t.call(e.x,i);return!i.defaultPrevented}return!0}}function pn(e,t,r=!1){rt&&ot();var a=new un(e);function n(t,r){if(rt){if(t===(ct(e)===fe)){var n=st();return nt(n),a.anchor=n,at(!1),a.ensure(t,r),void at(!0)}}a.ensure(t,r)}qr(()=>{var e=!1;t((t,r=!0)=>{e=!0,n(r,t)}),e||n(!1,null)},r?Fe:0)}function fn(e,t,r=!1,a=!1,n=!1){var o=e,i="";Or(()=>{var e=sa;if(i!==(i=t()??"")){if(null!==e.nodes_start&&(Gr(e.nodes_start,e.nodes_end),e.nodes_start=e.nodes_end=null),""!==i){if(rt){tt.data;for(var n=ot(),l=n;null!==n&&(8!==n.nodeType||""!==n.data);)l=n,n=xr(n);if(null===n)throw he;return Oa(tt,l),void(o=nt(n))}var s=i+"";r?s=`<svg>${s}</svg>`:a&&(s=`<math>${s}</math>`);var c=Ma(s);if((r||a)&&(c=_r(c)),Oa(_r(c),c.lastChild),r||a)for(;_r(c);)o.before(_r(c));else o.before(c)}}else rt&&ot()})}function hn(e,t,r,a,n){var o;rt&&ot();var i=null==(o=t.$$slots)?void 0:o[r],l=!1;!0===i&&(i=t["default"===r?"children":r],l=!0),void 0===i||i(e,l?()=>a:a)}function gn(e,t,r,a,n,o){let i=rt;rt&&ot();var l=null;rt&&1===tt.nodeType&&(l=tt,ot());var s=rt?tt:e,c=new un(s,!1);qr(()=>{const e=t()||null;var r="svg"===e?"http://www.w3.org/2000/svg":null;return null===e?(c.ensure(null,null),void rn(!0)):(c.ensure(e,t=>{if(e){if(Oa(l=rt?l:r?document.createElementNS(r,e):document.createElement(e),l),a){rt&&(o=e,en.includes(o))&&l.append(document.createComment(""));var n=rt?_r(l):l.appendChild(wr());rt&&(null===n?at(!1):nt(n)),a(l,n)}sa.nodes_end=l,t.before(l)}var o;rt&&nt(t)}),rn(!0),()=>{e&&rn(!1)})},Fe),Lr(()=>{rn(!0)}),i&&(at(!0),nt(s))}function mn(e,t){Vr(()=>{var r=e.getRootNode(),a=r.host?r:r.head??r.ownerDocument.head;if(!a.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,a.appendChild(e)}})}function bn(e,t){var r,a=void 0;jr(()=>{a!==(a=t())&&(r&&(Hr(r),r=null),a&&(r=Fr(()=>{Vr(()=>a(e))})))})}function yn(e){var t,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=yn(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function wn(e){return"object"==typeof e?function(){for(var e,t,r=0,a="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=yn(e))&&(a&&(a+=" "),a+=t);return a}(e):e??""}V=new WeakMap,M=new WeakMap,O=new WeakMap,q=new WeakMap,j=new WeakMap,F=new WeakMap,K=new WeakMap;const _n=[..." \t\n\r\f \v\ufeff"];function xn(e,t=!1){var r=t?" !important;":";",a="";for(var n in e){var o=e[n];null!=o&&""!==o&&(a+=" "+n+": "+o+r)}return a}function Cn(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function En(e,t,r,a,n,o){var i=e.__className;if(rt||i!==r||void 0===i){var l=function(e,t,r){var a=null==e?"":""+e;if(t&&(a=a?a+" "+t:t),r)for(var n in r)if(r[n])a=a?a+" "+n:n;else if(a.length)for(var o=n.length,i=0;(i=a.indexOf(n,i))>=0;){var l=i+o;0!==i&&!_n.includes(a[i-1])||l!==a.length&&!_n.includes(a[l])?i=l:a=(0===i?"":a.substring(0,i))+a.substring(l+1)}return""===a?null:a}(r,a,o);rt&&l===e.getAttribute("class")||(null==l?e.removeAttribute("class"):t?e.className=l:e.setAttribute("class",l)),e.__className=r}else if(o&&n!==o)for(var s in o){var c=!!o[s];null!=n&&c===!!n[s]||e.classList.toggle(s,c)}return o}function Sn(e,t={},r,a){for(var n in r){var o=r[n];t[n]!==o&&(null==r[n]?e.style.removeProperty(n):e.style.setProperty(n,o,a))}}function kn(e,t,r,a){var n=e.__style;if(rt||n!==t){var o=function(e,t){if(t){var r,a,n="";if(Array.isArray(t)?(r=t[0],a=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,i=0,l=!1,s=[];r&&s.push(...Object.keys(r).map(Cn)),a&&s.push(...Object.keys(a).map(Cn));var c=0,u=-1;const t=e.length;for(var v=0;v<t;v++){var d=e[v];if(l?"/"===d&&"*"===e[v-1]&&(l=!1):o?o===d&&(o=!1):"/"===d&&"*"===e[v+1]?l=!0:'"'===d||"'"===d?o=d:"("===d?i++:")"===d&&i--,!l&&!1===o&&0===i)if(":"===d&&-1===u)u=v;else if(";"===d||v===t-1){if(-1!==u){var p=Cn(e.substring(c,u).trim());s.includes(p)||(";"!==d&&v++,n+=" "+e.substring(c,v).trim()+";")}c=v+1,u=-1}}}return r&&(n+=xn(r)),a&&(n+=xn(a,!0)),""===(n=n.trim())?null:n}return null==e?null:String(e)}(t,a);rt&&o===e.getAttribute("style")||(null==o?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else a&&(Array.isArray(a)?(Sn(e,null==r?void 0:r[0],a[0]),Sn(e,null==r?void 0:r[1],a[1],"important")):Sn(e,r,a));return a}function An(e,t,r=!1){if(e.multiple){if(null==t)return;if(!be(t))return;for(var a of e.options)a.selected=t.includes(In(a))}else{for(a of e.options){if(fr(In(a),t))return void(a.selected=!0)}r&&void 0===t||(e.selectedIndex=-1)}}function Tn(e){var t=new MutationObserver(()=>{An(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Lr(()=>{t.disconnect()})}function In(e){return"__value"in e?e.__value:e.value}const Bn=Symbol("class"),Nn=Symbol("style"),zn=Symbol("is custom element"),Rn=Symbol("is html");function Dn(e){if(rt){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var r=e.value;Vn(e,"value",null),e.value=r}if(e.hasAttribute("checked")){var a=e.checked;Vn(e,"checked",null),e.checked=a}}};e.__on_r=r,yt(r),Ir()}}function Ln(e,t){var r=qn(e);r.value!==(r.value=t??void 0)&&(e.value!==t||0===t&&"PROGRESS"===e.nodeName)&&(e.value=t??"")}function Un(e,t){var r=qn(e);r.checked!==(r.checked=t??void 0)&&(e.checked=t)}function Pn(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Vn(e,t,r,a){var n=qn(e);rt&&(n[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)||n[t]!==(n[t]=r)&&("loading"===t&&(e[Xe]=r),null==r?e.removeAttribute(t):"string"!=typeof r&&Fn(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function Mn(e,t,r){var a=oa,n=sa;let o=rt;rt&&at(!1),la(null),ca(null);try{"style"!==t&&(jn.has(e.getAttribute("is")||e.nodeName)||!customElements||customElements.get(e.getAttribute("is")||e.tagName.toLowerCase())?Fn(e).includes(t):r&&"object"==typeof r)?e[t]=r:Vn(e,t,null==r?r:String(r))}finally{la(a),ca(n),o&&at(!0)}}function On(e,t,r=[],a=[],n=[],o,i=!1,l=!1){Ht(n,r,a,r=>{var a=void 0,n={},s="SELECT"===e.nodeName,c=!1;if(jr(()=>{var u=t(...r.map(ka)),v=function(e,t,r,a,n=!1){if(rt&&n&&"INPUT"===e.tagName){var o=e;("checkbox"===o.type?"defaultChecked":"defaultValue")in r||Dn(o)}var i=qn(e),l=i[zn],s=!i[Rn];let c=rt&&l;c&&at(!1);var u=t||{},v="OPTION"===e.tagName;for(var d in t)d in r||(r[d]=null);r.class?r.class=wn(r.class):r.class=null,r[Nn]&&(r.style??(r.style=null));var p=Fn(e);for(const y in r){let n=r[y];if(v&&"value"===y&&null==n)e.value=e.__value="",u[y]=n;else if("class"!==y)if("style"!==y){var f=u[y];if(n!==f||void 0===n&&e.hasAttribute(y)){u[y]=n;var h=y[0]+y[1];if("$$"!==h)if("on"===h){const t={},r="$$"+y;let a=y.slice(2);var g=Ya(a);if(Ga(a)&&(a=a.slice(0,-7),t.capture=!0),!g&&f){if(null!=n)continue;e.removeEventListener(a,u[r],t),u[r]=null}if(null!=n)if(g)e[`__${a}`]=n,Ua([a]);else{let n=function(e){u[y].call(this,e)};u[r]=Da(a,e,n,t)}else g&&(e[`__${a}`]=void 0)}else if("style"===y)Vn(e,y,n);else if("autofocus"===y)Ar(e,Boolean(n));else if(l||"__value"!==y&&("value"!==y||null==n))if("selected"===y&&v)Pn(e,n);else{var m=y;s||(m=Ja(m));var b="defaultValue"===m||"defaultChecked"===m;if(null!=n||l||b)b||p.includes(m)&&(l||"string"!=typeof n)?(e[m]=n,m in i&&(i[m]=ge)):"function"!=typeof n&&Vn(e,m,n);else if(i[y]=null,"value"===m||"checked"===m){let r=e;const a=void 0===t;if("value"===m){let e=r.defaultValue;r.removeAttribute(m),r.defaultValue=e,r.value=r.__value=a?e:null}else{let e=r.defaultChecked;r.removeAttribute(m),r.defaultChecked=e,r.checked=!!a&&e}}else e.removeAttribute(y)}else e.value=e.__value=n}}else kn(e,n,null==t?void 0:t[Nn],r[Nn]),u[y]=n,u[Nn]=r[Nn];else En(e,"http://www.w3.org/1999/xhtml"===e.namespaceURI,n,a,null==t?void 0:t[Bn],r[Bn]),u[y]=n,u[Bn]=r[Bn]}return c&&at(!0),u}(e,a,u,o,i,l);c&&s&&"value"in u&&An(e,u.value);for(let e of Object.getOwnPropertySymbols(n))u[e]||Hr(n[e]);for(let t of Object.getOwnPropertySymbols(u)){var d=u[t];"@attach"!==t.description||a&&d===a[t]||(n[t]&&Hr(n[t]),n[t]=Fr(()=>bn(e,()=>d))),v[t]=d}a=v}),s){var u=e;Vr(()=>{An(u,a.value,!0),Tn(u)})}c=!0})}function qn(e){return e.__attributes??(e.__attributes={[zn]:e.nodeName.includes("-"),[Rn]:"http://www.w3.org/1999/xhtml"===e.namespaceURI})}var jn=new Map;function Fn(e){var t,r=e.getAttribute("is")||e.nodeName,a=jn.get(r);if(a)return a;jn.set(r,a=[]);for(var n=e,o=Element.prototype;o!==n;){for(var i in t=Ee(n))t[i].set&&a.push(i);n=Ae(n)}return a}const Kn={tick:e=>requestAnimationFrame(e),now:()=>performance.now(),tasks:new Set};function $n(){const e=Kn.now();Kn.tasks.forEach(t=>{t.c(e)||(Kn.tasks.delete(t),t.f())}),0!==Kn.tasks.size&&Kn.tick($n)}function Hn(e,t){Br(()=>{e.dispatchEvent(new CustomEvent(t))})}function Gn(e){if("float"===e)return"cssFloat";if("offset"===e)return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return 1===t.length?t[0]:t[0]+t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function Wn(e){const t={},r=e.split(";");for(const a of r){const[e,r]=a.split(":");if(!e||void 0===r)break;t[Gn(e.trim())]=r.trim()}return t}const Yn=e=>e;function Qn(e,t,r,a){var n,o,i,l=!!(1&e),s=!!(2&e),c=!!(4&e),u=l&&s?"both":l?"in":"out",v=t.inert,d=t.style.overflow;function p(){return Br(()=>n??(n=r()(t,(null==a?void 0:a())??{},{direction:u})))}var f={is_global:c,in(){var e;if(t.inert=v,!l)return null==i||i.abort(),void(null==(e=null==i?void 0:i.reset)||e.call(i));s||null==o||o.abort(),Hn(t,"introstart"),o=Jn(t,p(),i,1,()=>{Hn(t,"introend"),null==o||o.abort(),o=n=void 0,t.style.overflow=d})},out(e){if(!s)return null==e||e(),void(n=void 0);t.inert=!0,Hn(t,"outrostart"),i=Jn(t,p(),o,0,()=>{Hn(t,"outroend"),null==e||e()})},stop:()=>{null==o||o.abort(),null==i||i.abort()}},h=sa;if((h.transitions??(h.transitions=[])).push(f),l&&tn){var g=c;if(!g){for(var m=h.parent;m&&0!==(m.f&Fe);)for(;(m=m.parent)&&0===(m.f&ze););g=!m||0!==(m.f&je)}g&&Vr(()=>{Ia(()=>f.in())})}}function Jn(e,t,r,a,n){var o=1===a;if("function"==typeof t){var i,l=!1;return yt(()=>{if(!l){var s=t({direction:o?"in":"out"});i=Jn(e,s,r,a,n)}}),{abort:()=>{l=!0,null==i||i.abort()},deactivate:()=>i.deactivate(),reset:()=>i.reset(),t:()=>i.t()}}if(null==r||r.deactivate(),!(null==t?void 0:t.duration))return n(),{abort:Ie,deactivate:Ie,reset:Ie,t:()=>a};const{delay:s=0,css:c,tick:u,easing:v=Yn}=t;var d=[];if(o&&void 0===r&&(u&&u(0,1),c)){var p=Wn(c(0,1));d.push(p,p)}var f=()=>1-a,h=e.animate(d,{duration:s,fill:"forwards"});return h.onfinish=()=>{h.cancel();var o=(null==r?void 0:r.t())??1-a;null==r||r.abort();var i=a-o,l=t.duration*Math.abs(i),s=[];if(l>0){var d=!1;if(c)for(var p=Math.ceil(l/(1e3/60)),g=0;g<=p;g+=1){var m=o+i*v(g/p),b=Wn(c(m,1-m));s.push(b),d||(d="hidden"===b.overflow)}d&&(e.style.overflow="hidden"),f=()=>{var e=h.currentTime;return o+i*v(e/l)},u&&function(e){let t;0===Kn.tasks.size&&Kn.tick($n),new Promise(r=>{Kn.tasks.add(t={c:e,f:r})})}(()=>{if("running"!==h.playState)return!1;var e=f();return u(e,1-e),!0})}(h=e.animate(s,{duration:l,fill:"forwards"})).onfinish=()=>{f=()=>a,null==u||u(a,1-a),n()}},{abort:()=>{h&&(h.cancel(),h.effect=null,h.onfinish=Ie)},deactivate:()=>{n=Ie},reset:()=>{0===a&&(null==u||u(1,0))},t:()=>f()}}function Xn(e,t,r=t){var a=new WeakSet;Nr(e,"input",async n=>{var o=n?e.defaultValue:e.value;if(o=Zn(e)?eo(o):o,r(o),null!==Et&&a.add(Et),await async function(){await Promise.resolve(),zt()}(),o!==(o=t())){var i=e.selectionStart,l=e.selectionEnd,s=e.value.length;if(e.value=o??"",null!==l){var c=e.value.length;i===l&&l===s&&c>s?(e.selectionStart=c,e.selectionEnd=c):(e.selectionStart=i,e.selectionEnd=Math.min(l,c))}}}),(rt&&e.defaultValue!==e.value||null==Ia(t)&&e.value)&&(r(Zn(e)?eo(e.value):e.value),null!==Et&&a.add(Et)),Mr(()=>{var r=t();if(e===document.activeElement){var n=St??Et;if(a.has(n))return}Zn(e)&&r===eo(e.value)||("date"!==e.type||r||e.value)&&r!==e.value&&(e.value=r??"")})}function Zn(e){var t=e.type;return"number"===t||"range"===t}function eo(e){return""===e?null:+e}function to(e,t){return e===t||(null==e?void 0:e[Qe])===t}function ro(e={},t,r,a){return Vr(()=>{var a,n;return Mr(()=>{a=n,n=[],Ia(()=>{e!==r(...n)&&(t(e,...n),a&&to(r(...a),e)&&t(null,...a))})}),()=>{yt(()=>{n&&to(r(...n),e)&&t(null,...n)})}}),e}function ao(e,t,r){if(null==e)return t(void 0),Ie;const a=Ia(()=>e.subscribe(t,r));return a.unsubscribe?()=>a.unsubscribe():a}const no=[];let oo,io=!1,lo=Symbol();function so(e,t,r){const a=r[t]??(r[t]={store:null,source:ir(void 0),unsubscribe:Ie});if(a.store!==e&&!(lo in r))if(a.unsubscribe(),a.store=e??null,null==e)a.source.v=void 0,a.unsubscribe=Ie;else{var n=!0;a.unsubscribe=ao(e,e=>{n?a.source.v=e:lr(a.source,e)}),n=!1}return e&&lo in r?function(e){let t;return ao(e,e=>t=e)(),t}(e):ka(a.source)}function co(e,t,r,a){var n,o,i,l=!!(8&r),s=!!(16&r),c=a,u=!0,v=()=>(u&&(u=!1,c=s?Ia(a):a),c);if(l){var d=Qe in e||Je in e;o=(null==(n=Ce(e,t))?void 0:n.set)??(d&&t in e?r=>e[t]=r:void 0)}var p,f=!1;if(l?[i,f]=function(e){var t=io;try{return io=!1,[e(),io]}finally{io=t}}(()=>e[t]):i=e[t],void 0===i&&void 0!==a&&(i=v(),o&&(!function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),o(i))),p=()=>{var r=e[t];return void 0===r?v():(u=!0,r)},!(4&r))return p;if(o){var h=e.$$legacy;return function(e,t){return arguments.length>0?((!t||h||f)&&o(t?p():e),e):p()}}var g=!1,m=(1&r?Wt:Jt)(()=>(g=!1,p()));l&&ka(m);var b=sa;return function(e,t){if(arguments.length>0){const r=t?ka(m):l?dr(e):e;return lr(m,r),g=!0,void 0!==c&&(c=r),e}return aa&&g||0!==(b.f&qe)?m.v:ka(m)}}class uo{constructor(e){var t;X(this,$),X(this,H);var r=new Map,a=(e,t)=>{var a=ir(t,!1,!1);return r.set(e,a),a};const n=new Proxy({...e.props||{},$$events:{}},{get:(e,t)=>ka(r.get(t)??a(t,Reflect.get(e,t))),has:(e,t)=>t===Je||(ka(r.get(t)??a(t,Reflect.get(e,t))),Reflect.has(e,t)),set:(e,t,n)=>(lr(r.get(t)??a(t,n),n),Reflect.set(e,t,n))});Z(this,H,(e.hydrate?on:nn)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:e.intro??!1,recover:e.recover})),(null==(t=null==e?void 0:e.props)?void 0:t.$$host)&&!1!==e.sync||zt(),Z(this,$,n.$$events);for(const o of Object.keys(J(this,H)))"$set"!==o&&"$destroy"!==o&&"$on"!==o&&xe(this,o,{get(){return J(this,H)[o]},set(e){J(this,H)[o]=e},enumerable:!0});J(this,H).$set=e=>{Object.assign(n,e)},J(this,H).$destroy=()=>{!function(e,t){const r=cn.get(e);r?(cn.delete(e),r(t)):Promise.resolve()}(J(this,H))}}$set(e){J(this,H).$set(e)}$on(e,t){J(this,$)[e]=J(this,$)[e]||[];const r=(...e)=>t.call(this,...e);return J(this,$)[e].push(r),()=>{J(this,$)[e]=J(this,$)[e].filter(e=>e!==r)}}$destroy(){J(this,H).$destroy()}}function vo(e,t,r,a){var n;const o=null==(n=r[e])?void 0:n.type;if(t="Boolean"===o&&"boolean"!=typeof t?null!=t:t,!a||!r[e])return t;if("toAttribute"===a)switch(o){case"Object":case"Array":return null==t?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return null==t?null:t;default:return t}else switch(o){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":default:return t;case"Number":return null!=t?+t:t}}function po(e,t,r,a,n,o){let i=class extends oo{constructor(){super(e,r,n),this.$$p_d=t}static get observedAttributes(){return _e(t).map(e=>(t[e].attribute||e).toLowerCase())}};return _e(t).forEach(e=>{xe(i.prototype,e,{get(){return this.$$c&&e in this.$$c?this.$$c[e]:this.$$d[e]},set(r){var a;r=vo(e,r,t),this.$$d[e]=r;var n=this.$$c;n&&((null==(a=Ce(n,e))?void 0:a.get)?n[e]=r:n.$set({[e]:r}))}})}),a.forEach(e=>{xe(i.prototype,e,{get(){var t;return null==(t=this.$$c)?void 0:t[e]}})}),e.element=i,i}$=new WeakMap,H=new WeakMap,"function"==typeof HTMLElement&&(oo=class extends HTMLElement{constructor(e,t,r){super(),Y(this,"$$ctor"),Y(this,"$$s"),Y(this,"$$c"),Y(this,"$$cn",!1),Y(this,"$$d",{}),Y(this,"$$r",!1),Y(this,"$$p_d",{}),Y(this,"$$l",{}),Y(this,"$$l_u",new Map),Y(this,"$$me"),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const e=this.$$l_u.get(t);e&&(e(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(e){return t=>{const r=document.createElement("slot");"default"!==e&&(r.name=e),Ha(t,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},a=function(e){const t={};return e.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}(this);for(const e of this.$$s)e in a&&("default"!==e||this.$$d.children?r[e]=t(e):(this.$$d.children=t(e),r.default=!0));for(const e of this.attributes){const t=this.$$g_p(e.name);t in this.$$d||(this.$$d[t]=vo(t,e.value,this.$$p_d,"toProp"))}for(const e in this.$$p_d)e in this.$$d||void 0===this[e]||(this.$$d[e]=this[e],delete this[e]);this.$$c=(e={component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}},new uo(e)),this.$$me=function(e){Nt.ensure();const t=Rr(524352,e,!0);return()=>{Hr(t)}}(()=>{Mr(()=>{var e;this.$$r=!0;for(const t of _e(this.$$c)){if(!(null==(e=this.$$p_d[t])?void 0:e.reflect))continue;this.$$d[t]=this.$$c[t];const r=vo(t,this.$$d[t],this.$$p_d,"toAttribute");null==r?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,r)}this.$$r=!1})});for(const e in this.$$l)for(const t of this.$$l[e]){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}this.$$l={}}var e}attributeChangedCallback(e,t,r){var a;this.$$r||(e=this.$$g_p(e),this.$$d[e]=vo(e,r,this.$$p_d,"toProp"),null==(a=this.$$c)||a.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return _e(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});var fo,ho,go="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function mo(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}),r}function bo(){return ho?fo:(ho=1,fo={options:{usePureJavaScript:!1}})}var yo,wo,_o,xo,Co,Eo={exports:{}};function So(){if(_o)return Eo.exports;_o=1;var e=bo(),t=function(){if(wo)return yo;wo=1;var e={};yo=e;var t={};return e.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var n=0,o=t.length,i=t.charAt(0),l=[0];for(n=0;n<e.length;++n){for(var s=0,c=e[n];s<l.length;++s)c+=l[s]<<8,l[s]=c%o,c=c/o|0;for(;c>0;)l.push(c%o),c=c/o|0}for(n=0;0===e[n]&&n<e.length-1;++n)a+=i;for(n=l.length-1;n>=0;--n)a+=t[l[n]]}else a=function(e,t){var r=0,a=t.length,n=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var i=0,l=e.at(r);i<o.length;++i)l+=o[i]<<8,o[i]=l%a,l=l/a|0;for(;l>0;)o.push(l%a),l=l/a|0}var s="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)s+=n;for(r=o.length-1;r>=0;--r)s+=t[o[r]];return s}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");a=a.match(u).join("\r\n")}return a},e.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var a=t[r];if(!a){a=t[r]=[];for(var n=0;n<r.length;++n)a[r.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var o=r.length,i=r.charAt(0),l=[0];for(n=0;n<e.length;n++){var s=a[e.charCodeAt(n)];if(void 0===s)return;for(var c=0,u=s;c<l.length;++c)u+=l[c]*o,l[c]=255&u,u>>=8;for(;u>0;)l.push(255&u),u>>=8}for(var v=0;e[v]===i&&v<e.length-1;++v)l.push(0);return"undefined"!=typeof Buffer?Buffer.from(l.reverse()):new Uint8Array(l.reverse())},yo}(),r=Eo.exports=e.util=e.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function n(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(r.isArrayBuffer(e)||r.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(o){for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof n||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return r.nextTick=process.nextTick,void("function"==typeof setImmediate?r.setImmediate=setImmediate:r.setImmediate=r.nextTick);if("function"==typeof setImmediate)return r.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(r.nextTick=function(e){return setImmediate(e)});if(r.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){let a=function(r){if(r.source===window&&r.data===e){r.stopPropagation();var a=t.slice();t.length=0,a.forEach(function(e){e()})}};var e="forge.setImmediate",t=[];r.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",a,!0)}if("undefined"!=typeof MutationObserver){var a=Date.now(),n=!0,o=document.createElement("div");t=[];new MutationObserver(function(){var e=t.slice();t.length=0,e.forEach(function(e){e()})}).observe(o,{attributes:!0});var i=r.setImmediate;r.setImmediate=function(e){Date.now()-a>15?(a=Date.now(),i(e)):(t.push(e),1===t.length&&o.setAttribute("a",n=!n))}}r.nextTick=r.setImmediate}(),r.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,r.globalScope=r.isNodejs?go:"undefined"==typeof self?window:self,r.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},r.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},r.isArrayBufferView=function(e){return e&&r.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},r.ByteBuffer=n,r.ByteStringBuffer=n;r.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},r.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},r.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},r.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},r.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},r.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},r.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(r.encodeUtf8(e))},r.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},r.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},r.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},r.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},r.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},r.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},r.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},r.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},r.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},r.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},r.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},r.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},r.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},r.ByteStringBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},r.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},r.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},r.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},r.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},r.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},r.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},r.ByteStringBuffer.prototype.copy=function(){var e=r.createBuffer(this.data);return e.read=this.read,e},r.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},r.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},r.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},r.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},r.ByteStringBuffer.prototype.toString=function(){return r.decodeUtf8(this.bytes())},r.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=r.isArrayBuffer(e),n=r.isArrayBufferView(e);if(a||n)return this.data=a?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},r.DataBuffer.prototype.length=function(){return this.write-this.read},r.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},r.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),a=new Uint8Array(this.length()+t);return a.set(r),this.data=new DataView(a.buffer),this},r.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},r.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},r.DataBuffer.prototype.putBytes=function(e,t){if(r.isArrayBufferView(e)){var a=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(a),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=a,this}if(r.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof r.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&r.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof r.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var o;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.hex.decode(e,o,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),o=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.base64.decode(e,o,this.write),this;if("utf8"===t&&(e=r.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.raw.decode(o),this;if("utf16"===t)return this.accommodate(2*e.length),o=new Uint16Array(this.data.buffer,this.write),this.write+=r.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},r.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},r.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},r.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},r.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},r.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},r.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},r.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},r.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},r.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},r.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},r.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},r.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},r.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},r.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},r.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},r.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},r.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},r.DataBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},r.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},r.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},r.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},r.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},r.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},r.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},r.DataBuffer.prototype.copy=function(){return new r.DataBuffer(this)},r.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},r.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},r.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},r.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},r.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return r.binary.raw.encode(t);if("hex"===e)return r.binary.hex.encode(t);if("base64"===e)return r.binary.base64.encode(t);if("utf8"===e)return r.text.utf8.decode(t);if("utf16"===e)return r.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},r.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=r.encodeUtf8(e)),new r.ByteBuffer(e)},r.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},r.xorBytes=function(e,t,r){for(var a="",n="",o="",i=0,l=0;r>0;--r,++i)n=e.charCodeAt(i)^t.charCodeAt(i),l>=10&&(a+=o,o="",l=0),o+=String.fromCharCode(n),++l;return a+=o},r.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},r.bytesToHex=function(e){return r.createBuffer(e).toHex()},r.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";r.encode64=function(e,t){for(var r,a,n,i="",l="",s=0;s<e.length;)r=e.charCodeAt(s++),a=e.charCodeAt(s++),n=e.charCodeAt(s++),i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=o.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":o.charAt(63&n)),t&&i.length>t&&(l+=i.substr(0,t)+"\r\n",i=i.substr(t));return l+=i},r.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,a,n,o="",l=0;l<e.length;)t=i[e.charCodeAt(l++)-43],r=i[e.charCodeAt(l++)-43],a=i[e.charCodeAt(l++)-43],n=i[e.charCodeAt(l++)-43],o+=String.fromCharCode(t<<2|r>>4),64!==a&&(o+=String.fromCharCode((15&r)<<4|a>>2),64!==n&&(o+=String.fromCharCode((3&a)<<6|n)));return o},r.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},r.decodeUtf8=function(e){return decodeURIComponent(escape(e))},r.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:t.encode,decode:t.decode}},r.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},r.binary.raw.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(e.length));for(var n=r=r||0,o=0;o<e.length;++o)a[n++]=e.charCodeAt(o);return t?n-r:a},r.binary.hex.encode=r.bytesToHex,r.binary.hex.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(Math.ceil(e.length/2)));var n=0,o=r=r||0;for(1&e.length&&(n=1,a[o++]=parseInt(e[0],16));n<e.length;n+=2)a[o++]=parseInt(e.substr(n,2),16);return t?o-r:a},r.binary.base64.encode=function(e,t){for(var r,a,n,i="",l="",s=0;s<e.byteLength;)r=e[s++],a=e[s++],n=e[s++],i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=o.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":o.charAt(63&n)),t&&i.length>t&&(l+=i.substr(0,t)+"\r\n",i=i.substr(t));return l+=i},r.binary.base64.decode=function(e,t,r){var a,n,o,l,s=t;s||(s=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)a=i[e.charCodeAt(c++)-43],n=i[e.charCodeAt(c++)-43],o=i[e.charCodeAt(c++)-43],l=i[e.charCodeAt(c++)-43],s[u++]=a<<2|n>>4,64!==o&&(s[u++]=(15&n)<<4|o>>2,64!==l&&(s[u++]=(3&o)<<6|l));return t?u-r:s.subarray(0,u)},r.binary.base58.encode=function(e,t){return r.binary.baseN.encode(e,l,t)},r.binary.base58.decode=function(e,t){return r.binary.baseN.decode(e,l,t)},r.text={utf8:{},utf16:{}},r.text.utf8.encode=function(e,t,a){e=r.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var o=a=a||0,i=0;i<e.length;++i)n[o++]=e.charCodeAt(i);return t?o-a:n},r.text.utf8.decode=function(e){return r.decodeUtf8(String.fromCharCode.apply(null,e))},r.text.utf16.encode=function(e,t,r){var a=t;a||(a=new Uint8Array(2*e.length));for(var n=new Uint16Array(a.buffer),o=r=r||0,i=r,l=0;l<e.length;++l)n[i++]=e.charCodeAt(l),o+=2;return t?o-r:a},r.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},r.deflate=function(e,t,a){if(t=r.decode64(e.deflate(r.encode64(t)).rval),a){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},r.inflate=function(e,t,a){var n=e.inflate(r.encode64(t)).rval;return null===n?null:r.decode64(n)};var s=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var n;if(null===a?n=e.removeItem(t):(a=r.encode64(JSON.stringify(a)),n=e.setItem(t,a)),void 0!==n&&!0!==n.rval){var o=new Error(n.error.message);throw o.id=n.error.id,o.name=n.error.name,o}},c=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(null===a.rval){if(a.error){var n=new Error(a.error.message);throw n.id=a.error.id,n.name=a.error.name,n}a=null}else a=a.rval;return null!==a&&(a=JSON.parse(r.decode64(a))),a},u=function(e,t,r,a){var n=c(e,t);null===n&&(n={}),n[r]=a,s(e,t,n)},v=function(e,t,r){var a=c(e,t);return null!==a&&(a=r in a?a[r]:null),a},d=function(e,t,r){var a=c(e,t);if(null!==a&&r in a){delete a[r];var n=!0;for(var o in a){n=!1;break}n&&(a=null),s(e,t,a)}},p=function(e,t){s(e,t,null)},f=function(e,t,r){var a,n=null;void 0===r&&(r=["web","flash"]);var o=!1,i=null;for(var l in r){a=r[l];try{if("flash"===a||"both"===a){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),o="flash"===a}"web"!==a&&"both"!==a||(t[0]=localStorage,n=e.apply(this,t),o=!0)}catch(s){i=s}if(o)break}if(!o)throw i;return n};return r.setItem=function(e,t,r,a,n){f(u,arguments,n)},r.getItem=function(e,t,r,a){return f(v,arguments,a)},r.removeItem=function(e,t,r,a){f(d,arguments,a)},r.clearItems=function(e,t,r){f(p,arguments,r)},r.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},r.format=function(e){for(var t,r,a=/%./g,n=0,o=[],i=0;t=a.exec(e);){(r=e.substring(i,a.lastIndex-2)).length>0&&o.push(r),i=a.lastIndex;var l=t[0][1];switch(l){case"s":case"o":n<arguments.length?o.push(arguments[1+n++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+l+"?>")}}return o.push(e.substring(i)),o.join("")},r.formatNumber=function(e,t,r,a){var n=e,o=isNaN(t=Math.abs(t))?2:t,i=void 0===r?",":r,l=void 0===a?".":a,s=n<0?"-":"",c=parseInt(n=Math.abs(+n||0).toFixed(o),10)+"",u=c.length>3?c.length%3:0;return s+(u?c.substr(0,u)+l:"")+c.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+l)+(o?i+Math.abs(n-c).toFixed(o).slice(2):"")},r.formatSize=function(e){return e=e>=1073741824?r.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?r.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?r.formatNumber(e/1024,0)+" KiB":r.formatNumber(e,0)+" bytes"},r.bytesFromIP=function(e){return-1!==e.indexOf(".")?r.bytesFromIPv4(e):-1!==e.indexOf(":")?r.bytesFromIPv6(e):null},r.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=r.createBuffer(),a=0;a<e.length;++a){var n=parseInt(e[a],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},r.bytesFromIPv6=function(e){for(var t=0,a=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).length+t),n=r.createBuffer(),o=0;o<8;++o)if(e[o]&&0!==e[o].length){var i=r.hexToBytes(e[o]);i.length<2&&n.putByte(0),n.putBytes(i)}else n.fillWithByte(0,a),a=0;return n.getBytes()},r.bytesToIP=function(e){return 4===e.length?r.bytesToIPv4(e):16===e.length?r.bytesToIPv6(e):null},r.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},r.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],a=[],n=0,o=0;o<e.length;o+=2){for(var i=r.bytesToHex(e[o]+e[o+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var l=a[a.length-1],s=t.length;l&&s===l.end+1?(l.end=s,l.end-l.start>a[n].end-a[n].start&&(n=a.length-1)):a.push({start:s,end:s})}t.push(i)}if(a.length>0){var c=a[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},r.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in r&&!e.update)return t(null,r.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return r.cores=navigator.hardwareConcurrency,t(null,r.cores);if("undefined"==typeof Worker)return r.cores=1,t(null,r.cores);if("undefined"==typeof Blob)return r.cores=2,t(null,r.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})})}.toString(),")()"],{type:"application/javascript"}));!function e(n,o,i){if(0===o){var l=Math.floor(n.reduce(function(e,t){return e+t},0)/n.length);return r.cores=Math.max(1,l),URL.revokeObjectURL(a),t(null,r.cores)}!function(e,t){for(var r=[],n=[],o=0;o<e;++o){var i=new Worker(a);i.addEventListener("message",function(a){if(n.push(a.data),n.length===e){for(var o=0;o<e;++o)r[o].terminate();t(null,n)}}),r.push(i)}for(o=0;o<e;++o)r[o].postMessage(o)}(i,function(t,r){n.push(function(e,t){for(var r=[],a=0;a<e;++a)for(var n=t[a],o=r[a]=[],i=0;i<e;++i)if(a!==i){var l=t[i];(n.st>l.st&&n.st<l.et||l.st>n.st&&l.st<n.et)&&o.push(i)}return r.reduce(function(e,t){return Math.max(e,t.length)},0)}(i,r)),e(n,o-1,i)})}([],5,16)},Eo.exports}function ko(){if(Co)return xo;Co=1;var e=bo();So(),xo=e.cipher=e.cipher||{},e.cipher.algorithms=e.cipher.algorithms||{},e.cipher.createCipher=function(t,r){var a=t;if("string"==typeof a&&(a=e.cipher.getAlgorithm(a))&&(a=a()),!a)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:a,key:r,decrypt:!1})},e.cipher.createDecipher=function(t,r){var a=t;if("string"==typeof a&&(a=e.cipher.getAlgorithm(a))&&(a=a()),!a)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:a,key:r,decrypt:!0})},e.cipher.registerAlgorithm=function(t,r){t=t.toUpperCase(),e.cipher.algorithms[t]=r},e.cipher.getAlgorithm=function(t){return(t=t.toUpperCase())in e.cipher.algorithms?e.cipher.algorithms[t]:null};var t=e.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};return t.prototype.start=function(t){t=t||{};var r={};for(var a in t)r[a]=t[a];r.decrypt=this._decrypt,this._finish=!1,this._input=e.util.createBuffer(),this.output=t.output||e.util.createBuffer(),this.mode.start(r)},t.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},t.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},xo}var Ao,To,Io,Bo={exports:{}};function No(){if(Ao)return Bo.exports;Ao=1;var e=bo();So(),e.cipher=e.cipher||{};var t=Bo.exports=e.cipher.modes=e.cipher.modes||{};function r(t,r){if("string"==typeof t&&(t=e.util.createBuffer(t)),e.util.isArray(t)&&t.length>4){var a=t;t=e.util.createBuffer();for(var n=0;n<a.length;++n)t.putByte(a[n])}if(t.length()<r)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+r+" bytes.");if(!e.util.isArray(t)){var o=[],i=r/4;for(n=0;n<i;++n)o.push(t.getInt32());t=o}return t}function a(e){e[e.length-1]=e[e.length-1]+1&4294967295}function n(e){return[e/4294967296|0,4294967295&e]}return t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=this._prev[a]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._prev[a]^this._outBlock[a]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},t.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);else{var o=(this.blockSize-a)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(o>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);else{var o=(this.blockSize-a)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(o>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];else{var o=(this.blockSize-a)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(o>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(i>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var r,o=e.util.createBuffer(t.iv);if(this._cipherLength=0,r="additionalData"in t?e.util.createBuffer(t.additionalData):e.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=e.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=o.length();if(12===i)this._j0=[o.getInt32(),o.getInt32(),o.getInt32(),1];else{for(this._j0=[0,0,0,0];o.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[o.getInt32(),o.getInt32(),o.getInt32(),o.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(n(8*i)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=e.util.createBuffer(r),this._aDataLength=n(8*r.length());var l=r.length()%this.blockSize;for(l&&r.fillWithByte(0,this.blockSize-l),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^=e.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(i<=0||r){if(r){var l=n%this.blockSize;this._cipherLength+=l,this._partialOutput.truncate(this.blockSize-l)}else this._cipherLength+=this.blockSize;for(o=0;o<this._ints;++o)this._outBlock[o]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^this._hashBlock[o]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(t,r){var a=!0;r.decrypt&&r.overflow&&t.truncate(this.blockSize-r.overflow),this.tag=e.util.createBuffer();var o=this._aDataLength.concat(n(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,o);var i=[];this.cipher.encrypt(this._j0,i);for(var l=0;l<this._ints;++l)this.tag.putInt32(this._s[l]^i[l]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),r.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],a=t.slice(0),n=0;n<128;++n){e[n/32|0]&1<<31-n%32&&(r[0]^=a[0],r[1]^=a[1],r[2]^=a[2],r[3]^=a[3]),this.pow(a,a)}return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],a=3;a>0;--a)t[a]=e[a]>>>1|(1&e[a-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var a=e[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][a];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,a=4*r,n=16*r,o=new Array(n),i=0;i<n;++i){var l=[0,0,0,0],s=(a-1-i%a)*t;l[i/a|0]=1<<t-1<<s,o[i]=this.generateSubHashTable(this.multiply(l,e),t)}return o},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,a=r>>>1,n=new Array(r);n[a]=e.slice(0);for(var o=a>>>1;o>0;)this.pow(n[2*o],n[o]=[]),o>>=1;for(o=2;o<a;){for(var i=1;i<o;++i){var l=n[o],s=n[i];n[o+i]=[l[0]^s[0],l[1]^s[1],l[2]^s[2],l[3]^s[3]]}o*=2}for(n[0]=[0,0,0,0],o=a+1;o<r;++o){var c=n[o^a];n[o]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return n},Bo.exports}function zo(){if(Io)return To;Io=1;var e=bo();function t(t,r){e.cipher.registerAlgorithm(t,function(){return new e.aes.Algorithm(t,r)})}ko(),No(),So(),To=e.aes=e.aes||{},e.aes.startEncrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!1,mode:a});return n.start(t),n},e.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},e.aes.startDecrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!0,mode:a});return n.start(t),n},e.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},e.aes.Algorithm=function(e,t){l||c();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return v(r._w,e,t,!1)},decrypt:function(e,t){return v(r._w,e,t,!0)}}}),r._init=!1},e.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var r,a=t.key;if("string"!=typeof a||16!==a.length&&24!==a.length&&32!==a.length){if(e.util.isArray(a)&&(16===a.length||24===a.length||32===a.length)){r=a,a=e.util.createBuffer();for(var n=0;n<r.length;++n)a.putByte(r[n])}}else a=e.util.createBuffer(a);if(!e.util.isArray(a)){r=a,a=[];var o=r.length();if(16===o||24===o||32===o){o>>>=2;for(n=0;n<o;++n)a.push(r.getInt32())}}if(!e.util.isArray(a)||4!==a.length&&6!==a.length&&8!==a.length)throw new Error("Invalid key parameter.");var i=this.mode.name,l=-1!==["CFB","OFB","CTR","GCM"].indexOf(i);this._w=u(a,t.decrypt&&!l),this._init=!0}},e.aes._expandKey=function(e,t){return l||c(),u(e,t)},e.aes._updateBlock=v,t("AES-ECB",e.cipher.modes.ecb),t("AES-CBC",e.cipher.modes.cbc),t("AES-CFB",e.cipher.modes.cfb),t("AES-OFB",e.cipher.modes.ofb),t("AES-CTR",e.cipher.modes.ctr),t("AES-GCM",e.cipher.modes.gcm);var r,a,n,o,i,l=!1,s=4;function c(){l=!0,n=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;r=new Array(256),a=new Array(256),o=new Array(4),i=new Array(4);for(t=0;t<4;++t)o[t]=new Array(256),i[t]=new Array(256);var s,c,u,v,d,p,f,h=0,g=0;for(t=0;t<256;++t){v=(v=g^g<<1^g<<2^g<<3^g<<4)>>8^255&v^99,r[h]=v,a[v]=h,p=(d=e[v])<<24^v<<16^v<<8^v^d,f=((s=e[h])^(c=e[s])^(u=e[c]))<<24^(h^u)<<16^(h^c^u)<<8^h^s^u;for(var m=0;m<4;++m)o[m][h]=p,i[m][v]=f,p=p<<24|p>>>8,f=f<<24|f>>>8;0===h?h=g=1:(h=s^e[e[e[s^u]]],g^=e[e[g]])}}function u(e,t){for(var a,o=e.slice(0),l=1,c=o.length,u=s*(c+6+1),v=c;v<u;++v)a=o[v-1],v%c===0?(a=r[a>>>16&255]<<24^r[a>>>8&255]<<16^r[255&a]<<8^r[a>>>24]^n[l]<<24,l++):c>6&&v%c===4&&(a=r[a>>>24]<<24^r[a>>>16&255]<<16^r[a>>>8&255]<<8^r[255&a]),o[v]=o[v-c]^a;if(t){for(var d,p=i[0],f=i[1],h=i[2],g=i[3],m=o.slice(0),b=(v=0,(u=o.length)-s);v<u;v+=s,b-=s)if(0===v||v===u-s)m[v]=o[b],m[v+1]=o[b+3],m[v+2]=o[b+2],m[v+3]=o[b+1];else for(var y=0;y<s;++y)d=o[b+y],m[v+(3&-y)]=p[r[d>>>24]]^f[r[d>>>16&255]]^h[r[d>>>8&255]]^g[r[255&d]];o=m}return o}function v(e,t,n,l){var s,c,u,v,d,p,f,h,g,m,b,y,w=e.length/4-1;l?(s=i[0],c=i[1],u=i[2],v=i[3],d=a):(s=o[0],c=o[1],u=o[2],v=o[3],d=r),p=t[0]^e[0],f=t[l?3:1]^e[1],h=t[2]^e[2],g=t[l?1:3]^e[3];for(var _=3,x=1;x<w;++x)m=s[p>>>24]^c[f>>>16&255]^u[h>>>8&255]^v[255&g]^e[++_],b=s[f>>>24]^c[h>>>16&255]^u[g>>>8&255]^v[255&p]^e[++_],y=s[h>>>24]^c[g>>>16&255]^u[p>>>8&255]^v[255&f]^e[++_],g=s[g>>>24]^c[p>>>16&255]^u[f>>>8&255]^v[255&h]^e[++_],p=m,f=b,h=y;n[0]=d[p>>>24]<<24^d[f>>>16&255]<<16^d[h>>>8&255]<<8^d[255&g]^e[++_],n[l?3:1]=d[f>>>24]<<24^d[h>>>16&255]<<16^d[g>>>8&255]<<8^d[255&p]^e[++_],n[2]=d[h>>>24]<<24^d[g>>>16&255]<<16^d[p>>>8&255]<<8^d[255&f]^e[++_],n[l?1:3]=d[g>>>24]<<24^d[p>>>16&255]<<16^d[f>>>8&255]<<8^d[255&h]^e[++_]}function d(t){var r,a="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(r=t.decrypt?e.cipher.createDecipher(a,t.key):e.cipher.createCipher(a,t.key)).start;return r.start=function(t,a){var o=null;a instanceof e.util.ByteBuffer&&(o=a,a={}),(a=a||{}).output=o,a.iv=t,n.call(r,a)},r}return To}var Ro,Do,Lo={exports:{}},Uo={exports:{}},Po={exports:{}};function Vo(){if(Ro)return Po.exports;Ro=1;var e=bo();e.pki=e.pki||{};var t=Po.exports=e.pki.oids=e.oids=e.oids||{};function r(e,r){t[e]=r,t[r]=e}function a(e,r){t[e]=r}return r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("1.3.14.3.2.29","sha1WithRSASignature"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("2.16.840.1.101.3.4.2.4","sha224"),r("2.16.840.1.101.3.4.2.5","sha512-224"),r("2.16.840.1.101.3.4.2.6","sha512-256"),r("1.2.840.113549.2.2","md2"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.4","surname"),r("2.5.4.5","serialNumber"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.12","title"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("2.5.4.42","givenName"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),a("2.5.29.1","authorityKeyIdentifier"),a("2.5.29.2","keyAttributes"),a("2.5.29.3","certificatePolicies"),a("2.5.29.4","keyUsageRestriction"),a("2.5.29.5","policyMapping"),a("2.5.29.6","subtreesConstraint"),a("2.5.29.7","subjectAltName"),a("2.5.29.8","issuerAltName"),a("2.5.29.9","subjectDirectoryAttributes"),a("2.5.29.10","basicConstraints"),a("2.5.29.11","nameConstraints"),a("2.5.29.12","policyConstraints"),a("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),a("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),a("2.5.29.20","cRLNumber"),a("2.5.29.21","cRLReason"),a("2.5.29.22","expirationDate"),a("2.5.29.23","instructionCode"),a("2.5.29.24","invalidityDate"),a("2.5.29.25","cRLDistributionPoints"),a("2.5.29.26","issuingDistributionPoint"),a("2.5.29.27","deltaCRLIndicator"),a("2.5.29.28","issuingDistributionPoint"),a("2.5.29.29","certificateIssuer"),a("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),a("2.5.29.33","policyMappings"),a("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),a("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),a("2.5.29.46","freshestCRL"),a("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping"),Po.exports}function Mo(){if(Do)return Uo.exports;Do=1;var e=bo();So(),Vo();var t=Uo.exports=e.asn1=e.asn1||{};function r(e,t,r){if(r>t){var a=new Error("Too few bytes to parse DER.");throw a.available=e.length(),a.remaining=t,a.requested=r,a}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},t.maxDepth=256,t.create=function(r,a,n,o,i){if(e.util.isArray(o)){for(var l=[],s=0;s<o.length;++s)void 0!==o[s]&&l.push(o[s]);o=l}var c={tagClass:r,type:a,constructed:n,composed:n||e.util.isArray(o),value:o};return i&&"bitStringContents"in i&&(c.bitStringContents=i.bitStringContents,c.original=t.copy(c)),c},t.copy=function(r,a){var n;if(e.util.isArray(r)){n=[];for(var o=0;o<r.length;++o)n.push(t.copy(r[o],a));return n}return"string"==typeof r?r:(n={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:t.copy(r.value,a)},a&&!a.excludeBitStringContents&&(n.bitStringContents=r.bitStringContents),n)},t.equals=function(r,a,n){if(e.util.isArray(r)){if(!e.util.isArray(a))return!1;if(r.length!==a.length)return!1;for(var o=0;o<r.length;++o)if(!t.equals(r[o],a[o]))return!1;return!0}if(typeof r!=typeof a)return!1;if("string"==typeof r)return r===a;var i=r.tagClass===a.tagClass&&r.type===a.type&&r.constructed===a.constructed&&r.composed===a.composed&&t.equals(r.value,a.value);return n&&n.includeBitStringContents&&(i=i&&r.bitStringContents===a.bitStringContents),i},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function a(e,n,o,i){if(o>=i.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var l;r(e,n,2);var s=e.getByte();n--;var c=192&s,u=31&s;l=e.length();var v,d,p=function(e,t){var a=e.getByte();if(t--,128!==a){var n;if(128&a){var o=127&a;r(e,t,o),n=e.getInt(o<<3)}else n=a;if(n<0)throw new Error("Negative length: "+n);return n}}(e,n);if(n-=l-e.length(),void 0!==p&&p>n){if(i.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=e.length(),f.remaining=n,f.requested=p,f}p=n}var h=!(32&~s);if(h)if(v=[],void 0===p)for(;;){if(r(e,n,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),n-=2;break}l=e.length(),v.push(a(e,n,o+1,i)),n-=l-e.length()}else for(;p>0;)l=e.length(),v.push(a(e,p,o+1,i)),n-=l-e.length(),p-=l-e.length();if(void 0===v&&c===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&(d=e.bytes(p)),void 0===v&&i.decodeBitStrings&&c===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&p>1){var g=e.read,m=n,b=0;if(u===t.Type.BITSTRING&&(r(e,n,1),b=e.getByte(),n--),0===b)try{l=e.length();var y=a(e,n,o+1,{strict:!0,decodeBitStrings:!0}),w=l-e.length();n-=w,u==t.Type.BITSTRING&&w++;var _=y.tagClass;w!==p||_!==t.Class.UNIVERSAL&&_!==t.Class.CONTEXT_SPECIFIC||(v=[y])}catch(C){}void 0===v&&(e.read=g,n=m)}if(void 0===v){if(void 0===p){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=n}if(u===t.Type.BMPSTRING)for(v="";p>0;p-=2)r(e,n,2),v+=String.fromCharCode(e.getInt16()),n-=2;else v=e.getBytes(p),n-=p}var x=void 0===d?null:{bitStringContents:d};return t.create(c,u,h,v,x)}t.fromDer=function(r,n){void 0===n&&(n={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof n&&(n={strict:n,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in n||(n.strict=!0),"parseAllBytes"in n||(n.parseAllBytes=!0),"decodeBitStrings"in n||(n.decodeBitStrings=!0),"maxDepth"in n||(n.maxDepth=t.maxDepth),"string"==typeof r&&(r=e.util.createBuffer(r));var o=r.length(),i=a(r,r.length(),0,n);if(n.parseAllBytes&&0!==r.length()){var l=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw l.byteCount=o,l.remaining=r.length(),l}return i},t.toDer=function(r){var a=e.util.createBuffer(),n=r.tagClass|r.type,o=e.util.createBuffer(),i=!1;if("bitStringContents"in r&&(i=!0,r.original&&(i=t.equals(r,r.original))),i)o.putBytes(r.bitStringContents);else if(r.composed){r.constructed?n|=32:o.putByte(0);for(var l=0;l<r.value.length;++l)void 0!==r.value[l]&&o.putBuffer(t.toDer(r.value[l]))}else if(r.type===t.Type.BMPSTRING)for(l=0;l<r.value.length;++l)o.putInt16(r.value.charCodeAt(l));else!(r.type===t.Type.INTEGER&&r.value.length>1)||(0!==r.value.charCodeAt(0)||128&r.value.charCodeAt(1))&&(255!==r.value.charCodeAt(0)||128&~r.value.charCodeAt(1))?o.putBytes(r.value):o.putBytes(r.value.substr(1));if(a.putByte(n),o.length()<=127)a.putByte(127&o.length());else{var s=o.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);a.putByte(128|c.length);for(l=c.length-1;l>=0;--l)a.putByte(c.charCodeAt(l))}return a.putBuffer(o),a},t.oidToDer=function(t){var r,a,n,o,i=t.split("."),l=e.util.createBuffer();l.putByte(40*parseInt(i[0],10)+parseInt(i[1],10));for(var s=2;s<i.length;++s){if(r=!0,a=[],(n=parseInt(i[s],10))>4294967295)throw new Error("OID value too large; max is 32-bits.");do{o=127&n,n>>>=7,r||(o|=128),a.push(o),r=!1}while(n>0);for(var c=a.length-1;c>=0;--c)l.putByte(a[c])}return l},t.derToOid=function(t){var r;"string"==typeof t&&(t=e.util.createBuffer(t));var a=t.getByte();r=Math.floor(a/40)+"."+a%40;for(var n=0;t.length()>0;){if(n>70368744177663)throw new Error("OID value too large; max is 53-bits.");n*=128,128&(a=t.getByte())?n+=127&a:(r+="."+(n+a),n=0)}return r},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var a=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),l=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(l=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,a,n),t.setUTCHours(o,i,l,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var u=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10);u*=6e4,"+"===s?t.setTime(+t-u):t.setTime(+t+u)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),a=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),l=parseInt(e.substr(12,2),10),s=0,c=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var v=e.length-5,d=e.charAt(v);"+"!==d&&"-"!==d||(c=60*parseInt(e.substr(v+1,2),10)+parseInt(e.substr(v+4,2),10),c*=6e4,"+"===d&&(c*=-1),u=!0);return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,a,n),t.setUTCHours(o,i,l,s),t.setTime(+t+c)):(t.setFullYear(r,a,n),t.setHours(o,i,l,s)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z"},t.integerToDer=function(t){var r=e.util.createBuffer();if(t>=-128&&t<128)return r.putSignedInt(t,8);if(t>=-32768&&t<32768)return r.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return r.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return r.putSignedInt(t,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=t,a},t.derToInteger=function(t){"string"==typeof t&&(t=e.util.createBuffer(t));var r=8*t.length();if(r>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(r)},t.validate=function(r,a,n,o){var i=!1;if(r.tagClass!==a.tagClass&&void 0!==a.tagClass||r.type!==a.type&&void 0!==a.type)o&&(r.tagClass!==a.tagClass&&o.push("["+a.name+'] Expected tag class "'+a.tagClass+'", got "'+r.tagClass+'"'),r.type!==a.type&&o.push("["+a.name+'] Expected type "'+a.type+'", got "'+r.type+'"'));else if(r.constructed===a.constructed||void 0===a.constructed){if(i=!0,a.value&&e.util.isArray(a.value))for(var l=0,s=0;i&&s<a.value.length;++s){var c=a.value[s];i=!!c.optional;var u=r.value[l];if(u){if(void 0!==c.tagClass&&void 0!==c.type&&(u.tagClass!==c.tagClass||u.type!==c.type)){if(c.optional){i=!0;continue}i=!1,o&&o.push("["+a.name+"] Tag mismatch. Expected ("+c.tagClass+","+c.type+"), got ("+u.tagClass+","+u.type+")");break}if(t.validate(u,c,n,o))++l,i=!0;else{if(!c.optional){i=!1;break}i=!0}}else c.optional||(i=!1,o&&o.push("["+a.name+'] Missing required element. Expected tag class "'+c.tagClass+'", type "'+c.type+'"'))}if(i&&n&&(a.capture&&(n[a.capture]=r.value),a.captureAsn1&&(n[a.captureAsn1]=r),a.captureBitStringContents&&"bitStringContents"in r&&(n[a.captureBitStringContents]=r.bitStringContents),a.captureBitStringValue&&"bitStringContents"in r))if(r.bitStringContents.length<2)n[a.captureBitStringValue]="";else{if(0!==r.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");n[a.captureBitStringValue]=r.bitStringContents.slice(1)}}else o&&o.push("["+a.name+'] Expected constructed "'+a.constructed+'", got "'+r.constructed+'"');return i};var n=/[^\\u0000-\\u00ff]/;return t.prettyPrint=function(r,a,o){var i="";o=o||2,(a=a||0)>0&&(i+="\n");for(var l="",s=0;s<a*o;++s)l+=" ";switch(i+=l+"Tag: ",r.tagClass){case t.Class.UNIVERSAL:i+="Universal:";break;case t.Class.APPLICATION:i+="Application:";break;case t.Class.CONTEXT_SPECIFIC:i+="Context-Specific:";break;case t.Class.PRIVATE:i+="Private:"}if(r.tagClass===t.Class.UNIVERSAL)switch(i+=r.type,r.type){case t.Type.NONE:i+=" (None)";break;case t.Type.BOOLEAN:i+=" (Boolean)";break;case t.Type.INTEGER:i+=" (Integer)";break;case t.Type.BITSTRING:i+=" (Bit string)";break;case t.Type.OCTETSTRING:i+=" (Octet string)";break;case t.Type.NULL:i+=" (Null)";break;case t.Type.OID:i+=" (Object Identifier)";break;case t.Type.ODESC:i+=" (Object Descriptor)";break;case t.Type.EXTERNAL:i+=" (External or Instance of)";break;case t.Type.REAL:i+=" (Real)";break;case t.Type.ENUMERATED:i+=" (Enumerated)";break;case t.Type.EMBEDDED:i+=" (Embedded PDV)";break;case t.Type.UTF8:i+=" (UTF8)";break;case t.Type.ROID:i+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:i+=" (Sequence)";break;case t.Type.SET:i+=" (Set)";break;case t.Type.PRINTABLESTRING:i+=" (Printable String)";break;case t.Type.IA5String:i+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:i+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:i+=" (Generalized time)";break;case t.Type.BMPSTRING:i+=" (BMP String)"}else i+=r.type;if(i+="\n",i+=l+"Constructed: "+r.constructed+"\n",r.composed){var c=0,u="";for(s=0;s<r.value.length;++s)void 0!==r.value[s]&&(c+=1,u+=t.prettyPrint(r.value[s],a+1,o),s+1<r.value.length&&(u+=","));i+=l+"Sub values: "+c+u}else{if(i+=l+"Value: ",r.type===t.Type.OID){var v=t.derToOid(r.value);i+=v,e.pki&&e.pki.oids&&v in e.pki.oids&&(i+=" ("+e.pki.oids[v]+") ")}if(r.type===t.Type.INTEGER)try{i+=t.derToInteger(r.value)}catch(p){i+="0x"+e.util.bytesToHex(r.value)}else if(r.type===t.Type.BITSTRING){if(r.value.length>1?i+="0x"+e.util.bytesToHex(r.value.slice(1)):i+="(none)",r.value.length>0){var d=r.value.charCodeAt(0);1==d?i+=" (1 unused bit shown)":d>1&&(i+=" ("+d+" unused bits shown)")}}else if(r.type===t.Type.OCTETSTRING)n.test(r.value)||(i+="("+r.value+") "),i+="0x"+e.util.bytesToHex(r.value);else if(r.type===t.Type.UTF8)try{i+=e.util.decodeUtf8(r.value)}catch(f){if("URI malformed"!==f.message)throw f;i+="0x"+e.util.bytesToHex(r.value)+" (malformed UTF8)"}else r.type===t.Type.PRINTABLESTRING||r.type===t.Type.IA5String?i+=r.value:n.test(r.value)?i+="0x"+e.util.bytesToHex(r.value):0===r.value.length?i+="[null]":i+=r.value}return i},Uo.exports}var Oo,qo,jo,Fo={exports:{}};function Ko(){if(qo)return Oo;qo=1;var e=bo();return Oo=e.md=e.md||{},e.md.algorithms=e.md.algorithms||{},Oo}function $o(){if(jo)return Fo.exports;jo=1;var e=bo();return Ko(),So(),(Fo.exports=e.hmac=e.hmac||{}).create=function(){var t=null,r=null,a=null,n=null,o={start:function(o,i){if(null!==o)if("string"==typeof o){if(!((o=o.toLowerCase())in e.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');r=e.md.algorithms[o].create()}else r=o;if(null===i)i=t;else{if("string"==typeof i)i=e.util.createBuffer(i);else if(e.util.isArray(i)){var l=i;i=e.util.createBuffer();for(var s=0;s<l.length;++s)i.putByte(l[s])}var c=i.length();c>r.blockLength&&(r.start(),r.update(i.bytes()),i=r.digest()),a=e.util.createBuffer(),n=e.util.createBuffer(),c=i.length();for(s=0;s<c;++s){l=i.at(s);a.putByte(54^l),n.putByte(92^l)}if(c<r.blockLength)for(l=r.blockLength-c,s=0;s<l;++s)a.putByte(54),n.putByte(92);t=i,a=a.bytes(),n=n.bytes()}r.start(),r.update(a)},update:function(e){r.update(e)},getMac:function(){var e=r.digest().bytes();return r.start(),r.update(n),r.update(e),r.digest()}};return o.digest=o.getMac,o},Fo.exports}var Ho,Go={exports:{}};function Wo(){if(Ho)return Go.exports;Ho=1;var e=bo();Ko(),So();var t=Go.exports=e.md5=e.md5||{};e.md.md5=e.md.algorithms.md5=t,t.create=function(){i||function(){r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],n=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],o=new Array(64);for(var t=0;t<64;++t)o[t]=Math.floor(4294967296*Math.abs(Math.sin(t+1)));i=!0}();var t=null,s=e.util.createBuffer(),c=new Array(16),u={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){u.messageLength=0,u.fullMessageLength=u.messageLength64=[];for(var r=u.messageLengthSize/4,a=0;a<r;++a)u.fullMessageLength.push(0);return s=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},u}};return u.start(),u.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var n=r.length;u.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=u.fullMessageLength.length-1;o>=0;--o)u.fullMessageLength[o]+=n[1],n[1]=n[0]+(u.fullMessageLength[o]/4294967296>>>0),u.fullMessageLength[o]=u.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return s.putBytes(r),l(t,c,s),(s.read>2048||0===s.length())&&s.compact(),u},u.digest=function(){var a=e.util.createBuffer();a.putBytes(s.bytes());var n=u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize&u.blockLength-1;a.putBytes(r.substr(0,u.blockLength-n));for(var o,i=0,v=u.fullMessageLength.length-1;v>=0;--v)i=(o=8*u.fullMessageLength[v]+i)/4294967296>>>0,a.putInt32Le(o>>>0);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};l(d,c,a);var p=e.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},u};var r=null,a=null,n=null,o=null,i=!1;function l(e,t,r){for(var i,l,s,c,u,v,d,p=r.length();p>=64;){for(l=e.h0,s=e.h1,c=e.h2,u=e.h3,d=0;d<16;++d)t[d]=r.getInt32Le(),i=l+(u^s&(c^u))+o[d]+t[d],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;for(;d<32;++d)i=l+(c^u&(s^c))+o[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;for(;d<48;++d)i=l+(s^c^u)+o[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;for(;d<64;++d)i=l+(c^(s|~u))+o[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;e.h0=e.h0+l|0,e.h1=e.h1+s|0,e.h2=e.h2+c|0,e.h3=e.h3+u|0,p-=64}}return Go.exports}var Yo,Qo={exports:{}};function Jo(){if(Yo)return Qo.exports;Yo=1;var e=bo();So();var t=Qo.exports=e.pem=e.pem||{};function r(e){for(var t=e.name+": ",r=[],a=function(e,t){return" "+t},n=0;n<e.values.length;++n)r.push(e.values[n].replace(/^(\S+\r\n)/,a));t+=r.join(",")+"\r\n";var o=0,i=-1;for(n=0;n<t.length;++n,++o)if(o>65&&-1!==i){var l=t[i];","===l?(++i,t=t.substr(0,i)+"\r\n "+t.substr(i)):t=t.substr(0,i)+"\r\n"+l+t.substr(i+1),o=n-i-1,i=-1,++n}else" "!==t[n]&&"\t"!==t[n]&&","!==t[n]||(i=n);return t}function a(e){return e.replace(/^\s+/,"")}return t.encode=function(t,a){a=a||{};var n,o="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(o+=r(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(o+=r(n={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),o+=r(n)),t.headers)for(var i=0;i<t.headers.length;++i)o+=r(t.headers[i]);return t.procType&&(o+="\r\n"),o+=e.util.encode64(t.body,a.maxline||64)+"\r\n",o+="-----END "+t.type+"-----\r\n"},t.decode=function(t){for(var r,n=[],o=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,i=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,l=/\r?\n/;r=o.exec(t);){var s=r[1];"NEW CERTIFICATE REQUEST"===s&&(s="CERTIFICATE REQUEST");var c={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(r[3])};if(n.push(c),r[2]){for(var u=r[2].split(l),v=0;r&&v<u.length;){for(var d=u[v].replace(/\s+$/,""),p=v+1;p<u.length;++p){var f=u[p];if(!/\s/.test(f[0]))break;d+=f,v=p}if(r=d.match(i)){for(var h={name:r[1],values:[]},g=r[2].split(","),m=0;m<g.length;++m)h.values.push(a(g[m]));if(c.procType)if(c.contentDomain||"Content-Domain"!==h.name)if(c.dekInfo||"DEK-Info"!==h.name)c.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:g[0],parameters:g[1]||null}}else c.contentDomain=g[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:g[0],type:g[1]}}}++v}if("ENCRYPTED"===c.procType&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===n.length)throw new Error("Invalid PEM formatted message.");return n},Qo.exports}var Xo,Zo,ei={exports:{}};function ti(){if(Zo)return Xo;Zo=1;var e=bo();function t(t,r){e.cipher.registerAlgorithm(t,function(){return new e.des.Algorithm(t,r)})}ko(),No(),So(),Xo=e.des=e.des||{},e.des.startEncrypting=function(e,t,r,a){var n=v({key:e,output:r,decrypt:!1,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},e.des.createEncryptionCipher=function(e,t){return v({key:e,output:null,decrypt:!1,mode:t})},e.des.startDecrypting=function(e,t,r,a){var n=v({key:e,output:r,decrypt:!0,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},e.des.createDecryptionCipher=function(e,t){return v({key:e,output:null,decrypt:!0,mode:t})},e.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return u(r._keys,e,t,!1)},decrypt:function(e,t){return u(r._keys,e,t,!0)}}}),r._init=!1},e.des.Algorithm.prototype.initialize=function(t){if(!this._init){var r=e.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==r.length())throw new Error("Invalid Triple-DES key size: "+8*r.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],s=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],v=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],f=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],y=0,w=0;w<g;w++){var _=e.getInt32(),x=e.getInt32();_^=(t=252645135&(_>>>4^x))<<4,_^=t=65535&((x^=t)>>>-16^_),_^=(t=858993459&(_>>>2^(x^=t<<-16)))<<2,_^=t=65535&((x^=t)>>>-16^_),_^=(t=1431655765&(_>>>1^(x^=t<<-16)))<<1,_^=t=16711935&((x^=t)>>>8^_),t=(_^=(t=1431655765&(_>>>1^(x^=t<<8)))<<1)<<8|(x^=t)>>>20&240,_=x<<24|x<<8&16711680|x>>>8&65280|x>>>24&240,x=t;for(var C=0;C<b.length;++C){b[C]?(_=_<<2|_>>>26,x=x<<2|x>>>26):(_=_<<1|_>>>27,x=x<<1|x>>>27),x&=-15;var E=r[(_&=-15)>>>28]|a[_>>>24&15]|n[_>>>20&15]|o[_>>>16&15]|i[_>>>12&15]|l[_>>>8&15]|s[_>>>4&15],S=c[x>>>28]|u[x>>>24&15]|v[x>>>20&15]|d[x>>>16&15]|p[x>>>12&15]|f[x>>>8&15]|h[x>>>4&15];t=65535&(S>>>16^E),m[y++]=E^t,m[y++]=S^t<<16}}return m}(r),this._init=!0}},t("DES-ECB",e.cipher.modes.ecb),t("DES-CBC",e.cipher.modes.cbc),t("DES-CFB",e.cipher.modes.cfb),t("DES-OFB",e.cipher.modes.ofb),t("DES-CTR",e.cipher.modes.ctr),t("3DES-ECB",e.cipher.modes.ecb),t("3DES-CBC",e.cipher.modes.cbc),t("3DES-CFB",e.cipher.modes.cfb),t("3DES-OFB",e.cipher.modes.ofb),t("3DES-CTR",e.cipher.modes.ctr);var r=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],n=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],o=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],i=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],s=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],c=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function u(e,t,u,v){var d,p,f=32===e.length?3:9;d=3===f?v?[30,-2,-2]:[0,32,2]:v?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var h=t[0],g=t[1];h^=(p=252645135&(h>>>4^g))<<4,h^=(p=65535&(h>>>16^(g^=p)))<<16,h^=p=858993459&((g^=p)>>>2^h),h^=p=16711935&((g^=p<<2)>>>8^h),h=(h^=(p=1431655765&(h>>>1^(g^=p<<8)))<<1)<<1|h>>>31,g=(g^=p)<<1|g>>>31;for(var m=0;m<f;m+=3){for(var b=d[m+1],y=d[m+2],w=d[m];w!=b;w+=y){var _=g^e[w],x=(g>>>4|g<<28)^e[w+1];p=h,h=g,g=p^(a[_>>>24&63]|o[_>>>16&63]|l[_>>>8&63]|c[63&_]|r[x>>>24&63]|n[x>>>16&63]|i[x>>>8&63]|s[63&x])}p=h,h=g,g=p}g=g>>>1|g<<31,g^=p=1431655765&((h=h>>>1|h<<31)>>>1^g),g^=(p=16711935&(g>>>8^(h^=p<<1)))<<8,g^=(p=858993459&(g>>>2^(h^=p)))<<2,g^=p=65535&((h^=p)>>>16^g),g^=p=252645135&((h^=p<<16)>>>4^g),h^=p<<4,u[0]=h,u[1]=g}function v(t){var r,a="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(r=t.decrypt?e.cipher.createDecipher(a,t.key):e.cipher.createCipher(a,t.key)).start;return r.start=function(t,a){var o=null;a instanceof e.util.ByteBuffer&&(o=a,a={}),(a=a||{}).output=o,a.iv=t,n.call(r,a)},r}return Xo}const ri=mo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var ai,ni;function oi(){if(ni)return ai;ni=1;var e=bo();$o(),Ko(),So();var t,r=e.pkcs5=e.pkcs5||{};return e.util.isNodejs&&!e.options.usePureJavaScript&&(t=ri),ai=e.pbkdf2=r.pbkdf2=function(r,a,n,o,i,l){if("function"==typeof i&&(l=i,i=null),e.util.isNodejs&&!e.options.usePureJavaScript&&t.pbkdf2&&(null===i||"object"!=typeof i)&&(t.pbkdf2Sync.length>4||!i||"sha1"===i))return"string"!=typeof i&&(i="sha1"),r=Buffer.from(r,"binary"),a=Buffer.from(a,"binary"),l?4===t.pbkdf2Sync.length?t.pbkdf2(r,a,n,o,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):t.pbkdf2(r,a,n,o,i,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):4===t.pbkdf2Sync.length?t.pbkdf2Sync(r,a,n,o).toString("binary"):t.pbkdf2Sync(r,a,n,o,i).toString("binary");if(null==i&&(i="sha1"),"string"==typeof i){if(!(i in e.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=e.md[i].create()}var s=i.digestLength;if(o>4294967295*s){var c=new Error("Derived key is too long.");if(l)return l(c);throw c}var u=Math.ceil(o/s),v=o-(u-1)*s,d=e.hmac.create();d.start(i,r);var p,f,h,g="";if(!l){for(var m=1;m<=u;++m){d.start(null,null),d.update(a),d.update(e.util.int32ToBytes(m)),p=h=d.digest().getBytes();for(var b=2;b<=n;++b)d.start(null,null),d.update(h),f=d.digest().getBytes(),p=e.util.xorBytes(p,f,s),h=f;g+=m<u?p:p.substr(0,v)}return g}m=1;function y(){if(m>u)return l(null,g);d.start(null,null),d.update(a),d.update(e.util.int32ToBytes(m)),p=h=d.digest().getBytes(),b=2,w()}function w(){if(b<=n)return d.start(null,null),d.update(h),f=d.digest().getBytes(),p=e.util.xorBytes(p,f,s),h=f,++b,e.util.setImmediate(w);g+=m<u?p:p.substr(0,v),++m,y()}y()}}var ii,li={exports:{}},si={exports:{}};function ci(){if(ii)return si.exports;ii=1;var e=bo();Ko(),So();var t=si.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=t,t.create=function(){a||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=!0);var t=null,i=e.util.createBuffer(),l=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,a=0;a<r;++a)s.fullMessageLength.push(0);return i=e.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var n=r.length;s.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=n[1],n[1]=n[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,n[0]=n[1]/4294967296>>>0;return i.putBytes(r),o(t,l,i),(i.read>2048||0===i.length())&&i.compact(),s},s.digest=function(){var a=e.util.createBuffer();a.putBytes(i.bytes());var n,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;a.putBytes(r.substr(0,s.blockLength-c));for(var u=8*s.fullMessageLength[0],v=0;v<s.fullMessageLength.length-1;++v)u+=(n=8*s.fullMessageLength[v+1])/4294967296>>>0,a.putInt32(u>>>0),u=n>>>0;a.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};o(d,l,a);var p=e.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p.putInt32(d.h5),p.putInt32(d.h6),p.putInt32(d.h7),p},s};var r=null,a=!1,n=null;function o(e,t,r){for(var a,o,i,l,s,c,u,v,d,p,f,h,g,m=r.length();m>=64;){for(s=0;s<16;++s)t[s]=r.getInt32();for(;s<64;++s)a=((a=t[s-2])>>>17|a<<15)^(a>>>19|a<<13)^a>>>10,o=((o=t[s-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,t[s]=a+t[s-7]+o+t[s-16]|0;for(c=e.h0,u=e.h1,v=e.h2,d=e.h3,p=e.h4,f=e.h5,h=e.h6,g=e.h7,s=0;s<64;++s)i=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),l=c&u|v&(c^u),a=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(h^p&(f^h))+n[s]+t[s],g=h,h=f,f=p,p=d+a>>>0,d=v,v=u,u=c,c=a+(o=i+l)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+u|0,e.h2=e.h2+v|0,e.h3=e.h3+d|0,e.h4=e.h4+p|0,e.h5=e.h5+f|0,e.h6=e.h6+h|0,e.h7=e.h7+g|0,m-=64}}return si.exports}var ui,vi,di,pi,fi,hi,gi={exports:{}};function mi(){if(ui)return gi.exports;ui=1;var e=bo();So();var t=null;return!e.util.isNodejs||e.options.usePureJavaScript||process.versions["node-webkit"]||(t=ri),(gi.exports=e.prng=e.prng||{}).create=function(r){for(var a={plugin:r,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=r.md,o=new Array(32),i=0;i<32;++i)o[i]=n.create();function l(){if(a.pools[0].messageLength>=32)return s();var e=32-a.pools[0].messageLength<<5;a.collect(a.seedFileSync(e)),s()}function s(){a.reseeds=4294967295===a.reseeds?0:a.reseeds+1;var e=a.plugin.md.create();e.update(a.keyBytes);for(var t=1,r=0;r<32;++r)a.reseeds%t===0&&(e.update(a.pools[r].digest().getBytes()),a.pools[r].start()),t<<=1;a.keyBytes=e.digest().getBytes(),e.start(),e.update(a.keyBytes);var n=e.digest().getBytes();a.key=a.plugin.formatKey(a.keyBytes),a.seed=a.plugin.formatSeed(n),a.generated=0}function c(t){var r=null,a=e.util.globalScope,n=a.crypto||a.msCrypto;n&&n.getRandomValues&&(r=function(e){return n.getRandomValues(e)});var o=e.util.createBuffer();if(r)for(;o.length()<t;){var i=Math.max(1,Math.min(t-o.length(),65536)/4),l=new Uint32Array(Math.floor(i));try{r(l);for(var s=0;s<l.length;++s)o.putInt32(l[s])}catch(p){if(!("undefined"!=typeof QuotaExceededError&&p instanceof QuotaExceededError))throw p}}if(o.length()<t)for(var c,u,v,d=Math.floor(65536*Math.random());o.length()<t;){u=16807*(65535&d),u+=(32767&(c=16807*(d>>16)))<<16,d=4294967295&(u=(2147483647&(u+=c>>15))+(u>>31));for(s=0;s<3;++s)v=d>>>(s<<3),v^=Math.floor(256*Math.random()),o.putByte(255&v)}return o.getBytes(t)}return a.pools=o,a.pool=0,a.generate=function(t,r){if(!r)return a.generateSync(t);var n=a.plugin.cipher,o=a.plugin.increment,i=a.plugin.formatKey,l=a.plugin.formatSeed,c=e.util.createBuffer();a.key=null,function u(v){if(v)return r(v);if(c.length()>=t)return r(null,c.getBytes(t));a.generated>1048575&&(a.key=null);if(null===a.key)return e.util.nextTick(function(){!function(e){if(a.pools[0].messageLength>=32)return s(),e();var t=32-a.pools[0].messageLength<<5;a.seedFile(t,function(t,r){if(t)return e(t);a.collect(r),s(),e()})}(u)});var d=n(a.key,a.seed);a.generated+=d.length,c.putBytes(d),a.key=i(n(a.key,o(a.seed))),a.seed=l(n(a.key,a.seed)),e.util.setImmediate(u)}()},a.generateSync=function(t){var r=a.plugin.cipher,n=a.plugin.increment,o=a.plugin.formatKey,i=a.plugin.formatSeed;a.key=null;for(var s=e.util.createBuffer();s.length()<t;){a.generated>1048575&&(a.key=null),null===a.key&&l();var c=r(a.key,a.seed);a.generated+=c.length,s.putBytes(c),a.key=o(r(a.key,n(a.seed))),a.seed=i(r(a.key,a.seed))}return s.getBytes(t)},t?(a.seedFile=function(e,r){t.randomBytes(e,function(e,t){if(e)return r(e);r(null,t.toString())})},a.seedFileSync=function(e){return t.randomBytes(e).toString()}):(a.seedFile=function(e,t){try{t(null,c(e))}catch(r){t(r)}},a.seedFileSync=c),a.collect=function(e){for(var t=e.length,r=0;r<t;++r)a.pools[a.pool].update(e.substr(r,1)),a.pool=31===a.pool?0:a.pool+1},a.collectInt=function(e,t){for(var r="",n=0;n<t;n+=8)r+=String.fromCharCode(e>>n&255);a.collect(r)},a.registerWorker=function(e){if(e===self)a.seedFile=function(e,t){self.addEventListener("message",function e(r){var a=r.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",e),t(a.forge.prng.err,a.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",function(t){var r=t.data;r.forge&&r.forge.prng&&a.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})})}},a},gi.exports}function bi(){if(vi)return li.exports;vi=1;var e=bo();return zo(),ci(),mi(),So(),e.random&&e.random.getBytes?li.exports=e.random:function(t){var r={},a=new Array(4),n=e.util.createBuffer();function o(){var t=e.prng.create(r);return t.getBytes=function(e,r){return t.generate(e,r)},t.getBytesSync=function(e){return t.generate(e)},t}r.formatKey=function(t){var r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),e.aes._expandKey(t,!1)},r.formatSeed=function(t){var r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),t},r.cipher=function(t,r){return e.aes._updateBlock(t,r,a,!1),n.putInt32(a[0]),n.putInt32(a[1]),n.putInt32(a[2]),n.putInt32(a[3]),n.getBytes()},r.increment=function(e){return++e[3],e},r.md=e.md.sha256;var i=o(),l=null,s=e.util.globalScope,c=s.crypto||s.msCrypto;if(c&&c.getRandomValues&&(l=function(e){return c.getRandomValues(e)}),e.options.usePureJavaScript||!e.util.isNodejs&&!l){if(i.collectInt(+new Date,32),"undefined"!=typeof navigator){var u="";for(var v in navigator)try{"string"==typeof navigator[v]&&(u+=navigator[v])}catch(d){}i.collect(u),u=null}t&&(t().mousemove(function(e){i.collectInt(e.clientX,16),i.collectInt(e.clientY,16)}),t().keypress(function(e){i.collectInt(e.charCode,8)}))}if(e.random)for(var v in i)e.random[v]=i[v];else e.random=i;e.random.createInstance=o,li.exports=e.random}("undefined"!=typeof jQuery?jQuery:null),li.exports}function yi(){if(pi)return di;pi=1;var e=bo();So();var t=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],r=[1,2,3,5],a=function(e,t){return e<<t&65535|(65535&e)>>16-t},n=function(e,t){return(65535&e)>>t|e<<16-t&65535};di=e.rc2=e.rc2||{},e.rc2.expandKey=function(r,a){"string"==typeof r&&(r=e.util.createBuffer(r)),a=a||128;var n,o=r,i=r.length(),l=a,s=Math.ceil(l/8),c=255>>(7&l);for(n=i;n<128;n++)o.putByte(t[o.at(n-1)+o.at(n-i)&255]);for(o.setAt(128-s,t[o.at(128-s)&c]),n=127-s;n>=0;n--)o.setAt(n,t[o.at(n+1)^o.at(n+s)]);return o};var o=function(t,o,i){var l,s,c,u,v=!1,d=null,p=null,f=null,h=[];for(t=e.rc2.expandKey(t,o),c=0;c<64;c++)h.push(t.getInt16Le());i?(l=function(e){for(c=0;c<4;c++)e[c]+=h[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=a(e[c],r[c]),u++},s=function(e){for(c=0;c<4;c++)e[c]+=h[63&e[(c+3)%4]]}):(l=function(e){for(c=3;c>=0;c--)e[c]=n(e[c],r[c]),e[c]-=h[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),u--},s=function(e){for(c=3;c>=0;c--)e[c]-=h[63&e[(c+3)%4]]});var g=function(e){var t=[];for(c=0;c<4;c++){var r=d.getInt16Le();null!==f&&(i?r^=f.getInt16Le():f.putInt16Le(r)),t.push(65535&r)}u=i?0:63;for(var a=0;a<e.length;a++)for(var n=0;n<e[a][0];n++)e[a][1](t);for(c=0;c<4;c++)null!==f&&(i?f.putInt16Le(t[c]):t[c]^=f.getInt16Le()),p.putInt16Le(t[c])},m=null;return m={start:function(t,r){t&&"string"==typeof t&&(t=e.util.createBuffer(t)),v=!1,d=e.util.createBuffer(),p=r||new e.util.createBuffer,f=t,m.output=p},update:function(e){for(v||d.putBuffer(e);d.length()>=8;)g([[5,l],[1,s],[6,l],[1,s],[5,l]])},finish:function(e){var t=!0;if(i)if(e)t=e(8,d,!i);else{var r=8===d.length()?8:8-d.length();d.fillWithByte(r,r)}if(t&&(v=!0,m.update()),!i&&(t=0===d.length()))if(e)t=e(8,p,!i);else{var a=p.length(),n=p.at(a-1);n>a?t=!1:p.truncate(n)}return t}}};return e.rc2.startEncrypting=function(t,r,a){var n=e.rc2.createEncryptionCipher(t,128);return n.start(r,a),n},e.rc2.createEncryptionCipher=function(e,t){return o(e,t,!0)},e.rc2.startDecrypting=function(t,r,a){var n=e.rc2.createDecryptionCipher(t,128);return n.start(r,a),n},e.rc2.createDecryptionCipher=function(e,t){return o(e,t,!1)},di}function wi(){if(hi)return fi;hi=1;var e,t=bo();function r(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new r(null)}function n(e,t,r,a,n,o){for(var i=16383&t,l=t>>14;--o>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,u=l*s+c*i;n=((s=i*s+((16383&u)<<14)+r.data[a]+n)>>28)+(u>>14)+l*c,r.data[a++]=268435455&s}return n}fi=t.jsbn=t.jsbn||{},t.jsbn.BigInteger=r,"undefined"==typeof navigator?(r.prototype.am=n,e=28):"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,a,n,o){for(var i=32767&t,l=t>>15;--o>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,u=l*s+c*i;n=((s=i*s+((32767&u)<<15)+r.data[a]+(1073741823&n))>>>30)+(u>>>15)+l*c+(n>>>30),r.data[a++]=1073741823&s}return n},e=30):"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,a,n,o){for(;--o>=0;){var i=t*this.data[e++]+r.data[a]+n;n=Math.floor(i/67108864),r.data[a++]=67108863&i}return n},e=26):(r.prototype.am=n,e=28),r.prototype.DB=e,r.prototype.DM=(1<<e)-1,r.prototype.DV=1<<e;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-e,r.prototype.F2=2*e-52;var o,i,l=new Array;for(o="0".charCodeAt(0),i=0;i<=9;++i)l[o++]=i;for(o="a".charCodeAt(0),i=10;i<36;++i)l[o++]=i;for(o="A".charCodeAt(0),i=10;i<36;++i)l[o++]=i;function s(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function c(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function u(e){var t=a();return t.fromInt(e),t}function v(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function d(e){this.m=e}function p(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function f(e,t){return e&t}function h(e,t){return e|t}function g(e,t){return e^t}function m(e,t){return e&~t}function b(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function y(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function _(e){return e}function x(e){this.r2=a(),this.q3=a(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},p.prototype.convert=function(e){var t=a();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},p.prototype.revert=function(e){var t=a();return e.copyTo(t),this.reduce(t),t},p.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],a=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,a,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},p.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},p.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var a;if(16==t)a=4;else if(8==t)a=3;else if(256==t)a=8;else if(2==t)a=1;else if(32==t)a=5;else{if(4!=t)return void this.fromRadix(e,t);a=2}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var l=8==a?255&e[n]:c(e,n);l<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==i?this.data[this.t++]=l:i+a>this.DB?(this.data[this.t-1]|=(l&(1<<this.DB-i)-1)<<i,this.data[this.t++]=l>>this.DB-i):this.data[this.t-1]|=l<<i,(i+=a)>=this.DB&&(i-=this.DB))}8==a&&128&e[0]&&(this.s=-1,i>0&&(this.data[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,a=e%this.DB,n=this.DB-a,o=(1<<n)-1,i=Math.floor(e/this.DB),l=this.s<<a&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+i+1]=this.data[r]>>n|l,l=(this.data[r]&o)<<a;for(r=i-1;r>=0;--r)t.data[r]=0;t.data[i]=l,t.t=this.t+i+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var a=e%this.DB,n=this.DB-a,o=(1<<a)-1;t.data[0]=this.data[r]>>a;for(var i=r+1;i<this.t;++i)t.data[i-r-1]|=(this.data[i]&o)<<n,t.data[i-r]=this.data[i]>>a;a>0&&(t.data[this.t-r-1]|=(this.s&o)<<n),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,a=0,n=Math.min(e.t,this.t);r<n;)a+=this.data[r]-e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a-=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a-=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a-=e.s}t.s=a<0?-1:0,a<-1?t.data[r++]=this.DV+a:a>0&&(t.data[r++]=a),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var a=this.abs(),n=e.abs(),o=a.t;for(t.t=o+n.t;--o>=0;)t.data[o]=0;for(o=0;o<n.t;++o)t.data[o+a.t]=a.am(0,n.data[o],t,o,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var a=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,a,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,n){var o=e.abs();if(!(o.t<=0)){var i=this.abs();if(i.t<o.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=a());var l=a(),s=this.s,c=e.s,u=this.DB-v(o.data[o.t-1]);u>0?(o.lShiftTo(u,l),i.lShiftTo(u,n)):(o.copyTo(l),i.copyTo(n));var d=l.t,p=l.data[d-1];if(0!=p){var f=p*(1<<this.F1)+(d>1?l.data[d-2]>>this.F2:0),h=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,b=n.t,y=b-d,w=null==t?a():t;for(l.dlShiftTo(y,w),n.compareTo(w)>=0&&(n.data[n.t++]=1,n.subTo(w,n)),r.ONE.dlShiftTo(d,w),w.subTo(l,l);l.t<d;)l.data[l.t++]=0;for(;--y>=0;){var _=n.data[--b]==p?this.DM:Math.floor(n.data[b]*h+(n.data[b-1]+m)*g);if((n.data[b]+=l.am(0,_,n,y,0,d))<_)for(l.dlShiftTo(y,w),n.subTo(w,n);n.data[b]<--_;)n.subTo(w,n)}null!=t&&(n.drShiftTo(d,t),s!=c&&r.ZERO.subTo(t,t)),n.t=d,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var n=a(),o=a(),i=t.convert(this),l=v(e)-1;for(i.copyTo(n);--l>=0;)if(t.sqrTo(n,o),(e&1<<l)>0)t.mulTo(o,i,n);else{var s=n;n=o,o=s}return t.revert(n)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,a=(1<<t)-1,n=!1,o="",i=this.t,l=this.DB-i*this.DB%t;if(i-- >0)for(l<this.DB&&(r=this.data[i]>>l)>0&&(n=!0,o=s(r));i>=0;)l<t?(r=(this.data[i]&(1<<l)-1)<<t-l,r|=this.data[--i]>>(l+=this.DB-t)):(r=this.data[i]>>(l-=t)&a,l<=0&&(l+=this.DB,--i)),r>0&&(n=!0),n&&(o+=s(r));return n?o:"0"},r.prototype.negate=function(){var e=a();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+v(this.data[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new d(t):new p(t),this.exp(e,r)},r.ZERO=u(0),r.ONE=u(1),w.prototype.convert=_,w.prototype.revert=_,w.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},w.prototype.sqrTo=function(e,t){e.squareTo(t)},x.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t},x.prototype.revert=function(e){return e},x.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},x.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},x.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var C=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],E=(1<<26)/C[C.length-1];return r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=u(r),o=a(),i=a(),l="";for(this.divRemTo(n,o,i);o.signum()>0;)l=(r+i.intValue()).toString(e).substr(1)+l,o.divRemTo(n,o,i);return i.intValue().toString(e)+l},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var a=this.chunkSize(t),n=Math.pow(t,a),o=!1,i=0,l=0,s=0;s<e.length;++s){var u=c(e,s);u<0?"-"==e.charAt(s)&&0==this.signum()&&(o=!0):(l=t*l+u,++i>=a&&(this.dMultiply(n),this.dAddOffset(l,0),i=0,l=0))}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(l,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,a){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),h,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var n=new Array,o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},r.prototype.bitwiseTo=function(e,t,r){var a,n,o=Math.min(e.t,this.t);for(a=0;a<o;++a)r.data[a]=t(this.data[a],e.data[a]);if(e.t<this.t){for(n=e.s&this.DM,a=o;a<this.t;++a)r.data[a]=t(this.data[a],n);r.t=this.t}else{for(n=this.s&this.DM,a=o;a<e.t;++a)r.data[a]=t(n,e.data[a]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var a=r.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a},r.prototype.addTo=function(e,t){for(var r=0,a=0,n=Math.min(e.t,this.t);r<n;)a+=this.data[r]+e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a+=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a+=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=e.s}t.s=a<0?-1:0,a>0?t.data[r++]=a:a<-1&&(t.data[r++]=this.DV+a),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var a,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(a=r.t-this.t;n<a;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(a=Math.min(e.t,t);n<a;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var a=r.t=this.t+e.t-t;for(r.s=0;--a>=0;)r.data[a]=0;for(a=Math.max(t-this.t,0);a<e.t;++a)r.data[this.t+a-t]=this.am(t-a,e.data[a],r,0,0,this.t+a-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var a=this.t-1;a>=0;--a)r=(t*r+this.data[a])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var n,o=t.shiftRight(a),i={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},l=0;l<e;++l){do{n=new r(this.bitLength(),i)}while(n.compareTo(r.ONE)<=0||n.compareTo(t)>=0);var s=n.modPow(o,this);if(0!=s.compareTo(r.ONE)&&0!=s.compareTo(t)){for(var c=1;c++<a&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=a();return this.copyTo(e),e},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,a=this.DB-e*this.DB%8,n=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),128&r&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=a();return this.bitwiseTo(e,f,t),t},r.prototype.or=function(e){var t=a();return this.bitwiseTo(e,h,t),t},r.prototype.xor=function(e){var t=a();return this.bitwiseTo(e,g,t),t},r.prototype.andNot=function(e){var t=a();return this.bitwiseTo(e,m,t),t},r.prototype.not=function(){for(var e=a(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=a();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=a();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+b(this.data[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=y(this.data[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this.data[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,h)},r.prototype.clearBit=function(e){return this.changeBit(e,m)},r.prototype.flipBit=function(e){return this.changeBit(e,g)},r.prototype.add=function(e){var t=a();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=a();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=a();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=a();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=a();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,n,o=e.bitLength(),i=u(1);if(o<=0)return i;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new d(t):t.isEven()?new x(t):new p(t);var l=new Array,s=3,c=r-1,f=(1<<r)-1;if(l[1]=n.convert(this),r>1){var h=a();for(n.sqrTo(l[1],h);s<=f;)l[s]=a(),n.mulTo(h,l[s-2],l[s]),s+=2}var g,m,b=e.t-1,y=!0,w=a();for(o=v(e.data[b])-1;b>=0;){for(o>=c?g=e.data[b]>>o-c&f:(g=(e.data[b]&(1<<o+1)-1)<<c-o,b>0&&(g|=e.data[b-1]>>this.DB+o-c)),s=r;!(1&g);)g>>=1,--s;if((o-=s)<0&&(o+=this.DB,--b),y)l[g].copyTo(i),y=!1;else{for(;s>1;)n.sqrTo(i,w),n.sqrTo(w,i),s-=2;s>0?n.sqrTo(i,w):(m=i,i=w,w=m),n.mulTo(w,l[g],i)}for(;b>=0&&!(e.data[b]&1<<o);)n.sqrTo(i,w),m=i,i=w,w=m,--o<0&&(o=this.DB-1,--b)}return n.revert(i)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var a=e.clone(),n=this.clone(),o=u(1),i=u(0),l=u(0),s=u(1);0!=a.signum();){for(;a.isEven();)a.rShiftTo(1,a),t?(o.isEven()&&i.isEven()||(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?(l.isEven()&&s.isEven()||(l.addTo(this,l),s.subTo(e,s)),l.rShiftTo(1,l)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);a.compareTo(n)>=0?(a.subTo(n,a),t&&o.subTo(l,o),i.subTo(s,i)):(n.subTo(a,n),t&&l.subTo(o,l),s.subTo(i,s))}return 0!=n.compareTo(r.ONE)?r.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},r.prototype.pow=function(e){return this.exp(e,new w)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var a=t;t=r,r=a}var n=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(n<o&&(o=n),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=C[C.length-1]){for(t=0;t<C.length;++t)if(r.data[0]==C[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<C.length;){for(var a=C[t],n=t+1;n<C.length&&a<E;)a*=C[n++];for(a=r.modInt(a);t<n;)if(a%C[t++]==0)return!1}return r.millerRabin(e)},fi}var _i,xi,Ci={exports:{}},Ei={exports:{}};function Si(){if(_i)return Ei.exports;_i=1;var e=bo();Ko(),So();var t=Ei.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=t,t.create=function(){a||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),a=!0);var t=null,o=e.util.createBuffer(),i=new Array(80),l={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,a=0;a<r;++a)l.fullMessageLength.push(0);return o=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},l}};return l.start(),l.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var s=r.length;l.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=l.fullMessageLength.length-1;c>=0;--c)l.fullMessageLength[c]+=s[1],s[1]=s[0]+(l.fullMessageLength[c]/4294967296>>>0),l.fullMessageLength[c]=l.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return o.putBytes(r),n(t,i,o),(o.read>2048||0===o.length())&&o.compact(),l},l.digest=function(){var a=e.util.createBuffer();a.putBytes(o.bytes());var s,c=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;a.putBytes(r.substr(0,l.blockLength-c));for(var u=8*l.fullMessageLength[0],v=0;v<l.fullMessageLength.length-1;++v)u+=(s=8*l.fullMessageLength[v+1])/4294967296>>>0,a.putInt32(u>>>0),u=s>>>0;a.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};n(d,i,a);var p=e.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p},l};var r=null,a=!1;function n(e,t,r){for(var a,n,o,i,l,s,c,u=r.length();u>=64;){for(n=e.h0,o=e.h1,i=e.h2,l=e.h3,s=e.h4,c=0;c<16;++c)a=r.getInt32(),t[c]=a,a=(n<<5|n>>>27)+(l^o&(i^l))+s+1518500249+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<20;++c)a=(a=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|a>>>31,t[c]=a,a=(n<<5|n>>>27)+(l^o&(i^l))+s+1518500249+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<32;++c)a=(a=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|a>>>31,t[c]=a,a=(n<<5|n>>>27)+(o^i^l)+s+1859775393+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<40;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(n<<5|n>>>27)+(o^i^l)+s+1859775393+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<60;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(n<<5|n>>>27)+(o&i|l&(o^i))+s+2400959708+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<80;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(n<<5|n>>>27)+(o^i^l)+s+3395469782+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;e.h0=e.h0+n|0,e.h1=e.h1+o|0,e.h2=e.h2+i|0,e.h3=e.h3+l|0,e.h4=e.h4+s|0,u-=64}}return Ei.exports}function ki(){if(xi)return Ci.exports;xi=1;var e=bo();So(),bi(),Si();var t=Ci.exports=e.pkcs1=e.pkcs1||{};function r(t,r,a){a||(a=e.md.sha1.create());for(var n="",o=Math.ceil(r/a.digestLength),i=0;i<o;++i){var l=String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,255&i);a.start(),a.update(t+l),n+=a.digest().getBytes()}return n.substring(0,r)}return t.encode_rsa_oaep=function(t,a,n){var o,i,l,s;"string"==typeof n?(o=n,i=arguments[3]||void 0,l=arguments[4]||void 0):n&&(o=n.label||void 0,i=n.seed||void 0,l=n.md||void 0,n.mgf1&&n.mgf1.md&&(s=n.mgf1.md)),l?l.start():l=e.md.sha1.create(),s||(s=l);var c=Math.ceil(t.n.bitLength()/8),u=c-2*l.digestLength-2;if(a.length>u)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=a.length,g.maxLength=u,g;o||(o=""),l.update(o,"raw");for(var v=l.digest(),d="",p=u-a.length,f=0;f<p;f++)d+="\0";var h=v.getBytes()+d+""+a;if(i){if(i.length!==l.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=i.length,g.digestLength=l.digestLength,g}}else i=e.random.getBytes(l.digestLength);var m=r(i,c-l.digestLength-1,s),b=e.util.xorBytes(h,m,h.length),y=r(b,l.digestLength,s);return"\0"+e.util.xorBytes(i,y,i.length)+b},t.decode_rsa_oaep=function(t,a,n){var o,i,l;"string"==typeof n?(o=n,i=arguments[3]||void 0):n&&(o=n.label||void 0,i=n.md||void 0,n.mgf1&&n.mgf1.md&&(l=n.mgf1.md));var s=Math.ceil(t.n.bitLength()/8);if(a.length!==s)throw(m=new Error("RSAES-OAEP encoded message length is invalid.")).length=a.length,m.expectedLength=s,m;if(void 0===i?i=e.md.sha1.create():i.start(),l||(l=i),s<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");o||(o=""),i.update(o,"raw");for(var c=i.digest().getBytes(),u=a.charAt(0),v=a.substring(1,i.digestLength+1),d=a.substring(1+i.digestLength),p=r(d,i.digestLength,l),f=r(e.util.xorBytes(v,p,v.length),s-i.digestLength-1,l),h=e.util.xorBytes(d,f,d.length),g=h.substring(0,i.digestLength),m="\0"!==u,b=0;b<i.digestLength;++b)m|=c.charAt(b)!==g.charAt(b);for(var y=1,w=i.digestLength,_=i.digestLength;_<h.length;_++){var x=h.charCodeAt(_);m|=x&(y?65534:0),w+=y&=1&x^1}if(m||1!==h.charCodeAt(w))throw new Error("Invalid RSAES-OAEP padding.");return h.substring(w+1)},Ci.exports}var Ai,Ti,Ii,Bi,Ni,zi={exports:{}};function Ri(){if(Ai)return zi.exports;Ai=1;var e=bo();return So(),wi(),bi(),function(){if(e.prime)zi.exports=e.prime;else{var t=zi.exports=e.prime=e.prime||{},r=e.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],n=new r(null);n.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(t,a,n){"function"==typeof a&&(n=a,a={});var o=(a=a||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var l=a.prng||e.random,c={nextBytes:function(e){for(var t=l.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===o.name)return function(t,a,n,o){if("workers"in n)return function(t,a,n,o){if("undefined"==typeof Worker)return i(t,a,n,o);var l=s(t,a),c=n.workers,u=n.workLoad||100,v=30*u/8,d=n.workerScript||"forge/prime.worker.js";if(-1===c)return e.util.estimateCores(function(e,t){e&&(t=2),c=t-1,p()});function p(){c=Math.max(1,c);for(var e=[],n=0;n<c;++n)e[n]=new Worker(d);for(n=0;n<c;++n)e[n].addEventListener("message",p);var i=!1;function p(n){if(!i){var c=n.data;if(c.found){for(var d=0;d<e.length;++d)e[d].terminate();return i=!0,o(null,new r(c.prime,16))}l.bitLength()>t&&(l=s(t,a));var p=l.toString(16);n.target.postMessage({hex:p,workLoad:u}),l.dAddOffset(v,0)}}}p()}(t,a,n,o);return i(t,a,n,o)}(t,c,o.options,n);throw new Error("Invalid prime generation algorithm: "+o.name)}}function i(e,t,r,a){var n=s(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(n.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var i=10;"maxBlockTime"in r&&(i=r.maxBlockTime),l(n,e,t,0,o,i,a)}function l(t,r,n,o,i,c,u){var v=+new Date;do{if(t.bitLength()>r&&(t=s(r,n)),t.isProbablePrime(i))return u(null,t);t.dAddOffset(a[o++%8],0)}while(c<0||+new Date-v<c);e.util.setImmediate(function(){l(t,r,n,o,i,c,u)})}function s(e,t){var a=new r(e,t),i=e-1;return a.testBit(i)||a.bitwiseTo(r.ONE.shiftLeft(i),o,a),a.dAddOffset(31-a.mod(n).byteValue(),0),a}}(),zi.exports}function Di(){if(Ii)return Ti;Ii=1;var e=bo();if(Mo(),wi(),Vo(),ki(),Ri(),bi(),So(),void 0===t)var t=e.jsbn.BigInteger;var r=e.util.isNodejs?ri:null,a=e.asn1,n=e.util;e.pki=e.pki||{},Ti=e.pki.rsa=e.rsa=e.rsa||{};var o=e.pki,i=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},s={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},c={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},u=e.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},v={name:"DigestInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},d=function(e){var t;if(!(e.algorithm in o.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=o.oids[e.algorithm];var n=a.oidToDer(t).getBytes(),i=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),l=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);l.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),l.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var s=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(l),i.value.push(s),a.toDer(i).getBytes()},p=function(r,a,n){if(n)return r.modPow(a.e,a.n);if(!a.p||!a.q)return r.modPow(a.d,a.n);var o;a.dP||(a.dP=a.d.mod(a.p.subtract(t.ONE))),a.dQ||(a.dQ=a.d.mod(a.q.subtract(t.ONE))),a.qInv||(a.qInv=a.q.modInverse(a.p));do{o=new t(e.util.bytesToHex(e.random.getBytes(a.n.bitLength()/8)),16)}while(o.compareTo(a.n)>=0||!o.gcd(a.n).equals(t.ONE));for(var i=(r=r.multiply(o.modPow(a.e,a.n)).mod(a.n)).mod(a.p).modPow(a.dP,a.p),l=r.mod(a.q).modPow(a.dQ,a.q);i.compareTo(l)<0;)i=i.add(a.p);var s=i.subtract(l).multiply(a.qInv).mod(a.p).multiply(a.q).add(l);return s=s.multiply(o.modInverse(a.n)).mod(a.n)};function f(t,r,a){var n=e.util.createBuffer(),o=Math.ceil(r.n.bitLength()/8);if(t.length>o-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=t.length,i.max=o-11,i}n.putByte(0),n.putByte(a);var l,s=o-3-t.length;if(0===a||1===a){l=0===a?0:255;for(var c=0;c<s;++c)n.putByte(l)}else for(;s>0;){var u=0,v=e.random.getBytes(s);for(c=0;c<s;++c)0===(l=v.charCodeAt(c))?++u:n.putByte(l);s=u}return n.putByte(0),n.putBytes(t),n}function h(t,r,a,n){var o=Math.ceil(r.n.bitLength()/8),i=e.util.createBuffer(t),l=i.getByte(),s=i.getByte();if(0!==l||a&&0!==s&&1!==s||!a&&2!=s||a&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var c=0;if(0===s){c=o-3-n;for(var u=0;u<c;++u)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(c=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++c}else if(2===s)for(c=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++c}if(0!==i.getByte()||c!==o-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function g(t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var a=e.util.hexToBytes(r);return!(a.length>1)||(0!==a.charCodeAt(0)||128&a.charCodeAt(1))&&(255!==a.charCodeAt(0)||128&~a.charCodeAt(1))?a:a.substr(1)}function m(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function b(t){return e.util.isNodejs&&"function"==typeof r[t]}function y(e){return void 0!==n.globalScope&&"object"==typeof n.globalScope.crypto&&"object"==typeof n.globalScope.crypto.subtle&&"function"==typeof n.globalScope.crypto.subtle[e]}function w(e){return void 0!==n.globalScope&&"object"==typeof n.globalScope.msCrypto&&"object"==typeof n.globalScope.msCrypto.subtle&&"function"==typeof n.globalScope.msCrypto.subtle[e]}function _(t){for(var r=e.util.hexToBytes(t.toString(16)),a=new Uint8Array(r.length),n=0;n<r.length;++n)a[n]=r.charCodeAt(n);return a}return o.rsa.encrypt=function(r,a,n){var o,i=n,l=Math.ceil(a.n.bitLength()/8);!1!==n&&!0!==n?(i=2===n,o=f(r,a,n)):(o=e.util.createBuffer()).putBytes(r);for(var s=new t(o.toHex(),16),c=p(s,a,i).toString(16),u=e.util.createBuffer(),v=l-Math.ceil(c.length/2);v>0;)u.putByte(0),--v;return u.putBytes(e.util.hexToBytes(c)),u.getBytes()},o.rsa.decrypt=function(r,a,n,o){var i=Math.ceil(a.n.bitLength()/8);if(r.length!==i){var l=new Error("Encrypted message length is invalid.");throw l.length=r.length,l.expected=i,l}var s=new t(e.util.createBuffer(r).toHex(),16);if(s.compareTo(a.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=p(s,a,n).toString(16),u=e.util.createBuffer(),v=i-Math.ceil(c.length/2);v>0;)u.putByte(0),--v;return u.putBytes(e.util.hexToBytes(c)),!1!==o?h(u.getBytes(),a,n):u.getBytes()},o.rsa.createKeyPairGenerationState=function(r,a,n){"string"==typeof r&&(r=parseInt(r,10)),r=r||2048;var o,i=(n=n||{}).prng||e.random,l={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},s=n.algorithm||"PRIMEINC";if("PRIMEINC"!==s)throw new Error("Invalid key generation algorithm: "+s);return(o={algorithm:s,state:0,bits:r,rng:l,eInt:a||65537,e:new t(null),p:null,q:null,qBits:r>>1,pBits:r-(r>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},o.rsa.stepKeyPairGenerationState=function(e,r){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new t(null);a.fromInt(30);for(var n,l=0,s=function(e,t){return e|t},c=+new Date,u=0;null===e.keys&&(r<=0||u<r);){if(0===e.state){var v=null===e.p?e.pBits:e.qBits,d=v-1;0===e.pqState?(e.num=new t(v,e.rng),e.num.testBit(d)||e.num.bitwiseTo(t.ONE.shiftLeft(d),s,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),l=0,++e.pqState):1===e.pqState?e.num.bitLength()>v?e.pqState=0:e.num.isProbablePrime(m(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(i[l++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(t.ONE).gcd(e.e).compareTo(t.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(t.ONE),e.q1=e.q.subtract(t.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(t.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:o.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:o.rsa.setPublicKey(e.n,e.e)}}u+=(n=+new Date)-c,c=n}return null!==e.keys},o.rsa.generateKeyPair=function(i,l,s,c){if(1===arguments.length?"object"==typeof i?(s=i,i=void 0):"function"==typeof i&&(c=i,i=void 0):2===arguments.length?"number"==typeof i?"function"==typeof l?(c=l,l=void 0):"number"!=typeof l&&(s=l,l=void 0):(s=i,c=l,i=void 0,l=void 0):3===arguments.length&&("number"==typeof l?"function"==typeof s&&(c=s,s=void 0):(c=s,s=l,l=void 0)),s=s||{},void 0===i&&(i=s.bits||2048),void 0===l&&(l=s.e||65537),!e.options.usePureJavaScript&&!s.prng&&i>=256&&i<=16384&&(65537===l||3===l))if(c){if(b("generateKeyPair"))return r.generateKeyPair("rsa",{modulusLength:i,publicExponent:l,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return c(e);c(null,{privateKey:o.privateKeyFromPem(r),publicKey:o.publicKeyFromPem(t)})});if(y("generateKey")&&y("exportKey"))return n.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:_(l),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return n.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){c(e)}).then(function(t){if(t){var r=o.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(t)));c(null,{privateKey:r,publicKey:o.setRsaPublicKey(r.n,r.e)})}});if(w("generateKey")&&w("exportKey")){var u=n.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:_(l),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(t){var r=t.target.result,i=n.globalScope.msCrypto.subtle.exportKey("pkcs8",r.privateKey);i.oncomplete=function(t){var r=t.target.result,n=o.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(r)));c(null,{privateKey:n,publicKey:o.setRsaPublicKey(n.n,n.e)})},i.onerror=function(e){c(e)}},void(u.onerror=function(e){c(e)})}}else if(b("generateKeyPairSync")){var v=r.generateKeyPairSync("rsa",{modulusLength:i,publicExponent:l,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:o.privateKeyFromPem(v.privateKey),publicKey:o.publicKeyFromPem(v.publicKey)}}var d=o.rsa.createKeyPairGenerationState(i,l,s);if(!c)return o.rsa.stepKeyPairGenerationState(d,0),d.keys;!function(r,a,n){"function"==typeof a&&(n=a,a={});a=a||{};var i={algorithm:{name:a.algorithm||"PRIMEINC",options:{workers:a.workers||2,workLoad:a.workLoad||100,workerScript:a.workerScript}}};"prng"in a&&(i.prng=a.prng);function l(){s(r.pBits,function(e,t){return e?n(e):(r.p=t,null!==r.q?c(e,r.q):void s(r.qBits,c))})}function s(t,r){e.prime.generateProbablePrime(t,i,r)}function c(e,a){if(e)return n(e);if(r.q=a,r.p.compareTo(r.q)<0){var i=r.p;r.p=r.q,r.q=i}if(0!==r.p.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.p=null,void l();if(0!==r.q.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.q=null,void s(r.qBits,c);if(r.p1=r.p.subtract(t.ONE),r.q1=r.q.subtract(t.ONE),r.phi=r.p1.multiply(r.q1),0!==r.phi.gcd(r.e).compareTo(t.ONE))return r.p=r.q=null,void l();if(r.n=r.p.multiply(r.q),r.n.bitLength()!==r.bits)return r.q=null,void s(r.qBits,c);var u=r.e.modInverse(r.phi);r.keys={privateKey:o.rsa.setPrivateKey(r.n,r.e,u,r.p,r.q,u.mod(r.p1),u.mod(r.q1),r.q.modInverse(r.p)),publicKey:o.rsa.setPublicKey(r.n,r.e)},n(null,r.keys)}l()}(d,s,c)},o.setRsaPublicKey=o.rsa.setPublicKey=function(t,r){var n={n:t,e:r,encrypt:function(t,r,a){if("string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===r)r={encode:function(e,t,r){return f(e,t,2).getBytes()}};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={encode:function(t,r){return e.pkcs1.encode_rsa_oaep(r,t,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(r))r={encode:function(e){return e}};else if("string"==typeof r)throw new Error('Unsupported encryption scheme: "'+r+'".');var i=r.encode(t,n,!0);return o.rsa.encrypt(i,n,!0)},verify:function(t,r,i,l){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===l&&(l={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in l||(l._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(t,r){r=h(r,n,!0);var o=a.fromDer(r,{parseAllBytes:l._parseAllDigestBytes}),i={},s=[];if(!a.validate(o,v,i,s))throw(c=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=s,c;var c,u=a.derToOid(i.algorithmIdentifier);if(u!==e.oids.md2&&u!==e.oids.md5&&u!==e.oids.sha1&&u!==e.oids.sha224&&u!==e.oids.sha256&&u!==e.oids.sha384&&u!==e.oids.sha512&&u!==e.oids["sha512-224"]&&u!==e.oids["sha512-256"])throw(c=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,c;if((u===e.oids.md2||u===e.oids.md5)&&!("parameters"in i))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return t===i.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=h(t,n,!0))}});var s=o.rsa.decrypt(r,n,!0,!1);return i.verify(t,s,n.n.bitLength())}};return n},o.setRsaPrivateKey=o.rsa.setPrivateKey=function(t,r,a,n,i,l,s,c){var u={n:t,e:r,d:a,p:n,q:i,dP:l,dQ:s,qInv:c,decrypt:function(t,r,a){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5");var n=o.rsa.decrypt(t,u,!1,!1);if("RSAES-PKCS1-V1_5"===r)r={decode:h};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={decode:function(t,r){return e.pkcs1.decode_rsa_oaep(r,t,a)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(r))throw new Error('Unsupported encryption scheme: "'+r+'".');r={decode:function(e){return e}}}return r.decode(n,u,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var a=t.encode(e,u.n.bitLength());return o.rsa.encrypt(a,u,r)}};return u},o.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},o.privateKeyFromAsn1=function(r){var n,i,c,u,v,d,p,f,h={},g=[];if(a.validate(r,l,h,g)&&(r=a.fromDer(e.util.createBuffer(h.privateKey))),h={},g=[],!a.validate(r,s,h,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return n=e.util.createBuffer(h.privateKeyModulus).toHex(),i=e.util.createBuffer(h.privateKeyPublicExponent).toHex(),c=e.util.createBuffer(h.privateKeyPrivateExponent).toHex(),u=e.util.createBuffer(h.privateKeyPrime1).toHex(),v=e.util.createBuffer(h.privateKeyPrime2).toHex(),d=e.util.createBuffer(h.privateKeyExponent1).toHex(),p=e.util.createBuffer(h.privateKeyExponent2).toHex(),f=e.util.createBuffer(h.privateKeyCoefficient).toHex(),o.setRsaPrivateKey(new t(n,16),new t(i,16),new t(c,16),new t(u,16),new t(v,16),new t(d,16),new t(p,16),new t(f,16))},o.privateKeyToAsn1=o.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.qInv))])},o.publicKeyFromAsn1=function(r){var n={},i=[];if(a.validate(r,u,n,i)){var l,s=a.derToOid(n.publicKeyOid);if(s!==o.oids.rsaEncryption)throw(l=new Error("Cannot read public key. Unknown OID.")).oid=s,l;r=n.rsaPublicKey}if(i=[],!a.validate(r,c,n,i))throw(l=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=i,l;var v=e.util.createBuffer(n.publicKeyModulus).toHex(),d=e.util.createBuffer(n.publicKeyExponent).toHex();return o.setRsaPublicKey(new t(v,16),new t(d,16))},o.publicKeyToAsn1=o.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[o.publicKeyToRSAPublicKey(e)])])},o.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.e))])},Ti}function Li(){if(Ni)return Bi;Ni=1;var e=bo();if(zo(),Mo(),ti(),Ko(),Vo(),oi(),Jo(),bi(),yi(),Di(),So(),void 0===t)var t=e.jsbn.BigInteger;var r=e.asn1,a=e.pki=e.pki||{};Bi=a.pbe=e.pbe=e.pbe||{};var n=a.oids,o={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},i={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};function s(e,t){return e.start().update(t).digest().getBytes()}function c(e){var t;if(e){if(!(t=a.oids[r.derToOid(e)])){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return u(t)}function u(t){var r=e.md;switch(t){case"hmacWithSHA224":r=e.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=t,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!r||!(t in r))throw new Error("Unknown hash algorithm: "+t);return r[t].create()}return a.encryptPrivateKeyInfo=function(t,o,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||"aes128",i.prfAlgorithm=i.prfAlgorithm||"sha1";var l,s,c,v=e.random.getBytesSync(i.saltSize),d=i.count,p=r.integerToDer(d);if(0===i.algorithm.indexOf("aes")||"des"===i.algorithm){var f,h,g;switch(i.algorithm){case"aes128":l=16,f=16,h=n["aes128-CBC"],g=e.aes.createEncryptionCipher;break;case"aes192":l=24,f=16,h=n["aes192-CBC"],g=e.aes.createEncryptionCipher;break;case"aes256":l=32,f=16,h=n["aes256-CBC"],g=e.aes.createEncryptionCipher;break;case"des":l=8,f=8,h=n.desCBC,g=e.des.createEncryptionCipher;break;default:throw(x=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,x}var m="hmacWith"+i.prfAlgorithm.toUpperCase(),b=u(m),y=e.pkcs5.pbkdf2(o,v,d,l,b),w=e.random.getBytesSync(f);(C=g(y)).start(w),C.update(r.toDer(t)),C.finish(),c=C.output.getBytes();var _=function(t,n,o,i){var l=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,t),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,n.getBytes())]);"hmacWithSHA1"!==i&&l.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,e.util.hexToBytes(o.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.oids[i]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));return l}(v,p,l,m);s=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n.pkcs5PBKDF2).getBytes()),_]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(h).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,w)])])])}else{var x;if("3des"!==i.algorithm)throw(x=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,x;l=24;var C,E=new e.util.ByteBuffer(v);y=a.pbe.generatePkcs12Key(o,E,1,d,l),w=a.pbe.generatePkcs12Key(o,E,2,d,l);(C=e.des.createEncryptionCipher(y)).start(w),C.update(r.toDer(t)),C.finish(),c=C.output.getBytes(),s=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,v),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,p.getBytes())])])}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[s,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)])},a.decryptPrivateKeyInfo=function(t,n){var i=null,l={},s=[];if(!r.validate(t,o,l,s)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=s,c}var u=r.derToOid(l.encryptionOid),v=a.pbe.getCipher(u,l.encryptionParams,n),d=e.util.createBuffer(l.encryptedData);return v.update(d),v.finish()&&(i=r.fromDer(v.output)),i},a.encryptedPrivateKeyToPem=function(t,a){var n={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(t).getBytes()};return e.pem.encode(n,{maxline:a})},a.encryptedPrivateKeyFromPem=function(t){var a=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=a.type,n}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(a.body)},a.encryptRsaPrivateKey=function(t,n,o){if(!(o=o||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));return i=a.encryptPrivateKeyInfo(i,n,o),a.encryptedPrivateKeyToPem(i)}var l,s,c,u;switch(o.algorithm){case"aes128":l="AES-128-CBC",c=16,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"aes192":l="AES-192-CBC",c=24,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"aes256":l="AES-256-CBC",c=32,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"3des":l="DES-EDE3-CBC",c=24,s=e.random.getBytesSync(8),u=e.des.createEncryptionCipher;break;case"des":l="DES-CBC",c=8,s=e.random.getBytesSync(8),u=e.des.createEncryptionCipher;break;default:var v=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+o.algorithm+'".');throw v.algorithm=o.algorithm,v}var d=u(e.pbe.opensslDeriveBytes(n,s.substr(0,8),c));d.start(s),d.update(r.toDer(a.privateKeyToAsn1(t))),d.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:l,parameters:e.util.bytesToHex(s).toUpperCase()},body:d.output.getBytes()};return e.pem.encode(p)},a.decryptRsaPrivateKey=function(t,n){var o=null,i=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var l,s;switch(i.dekInfo.algorithm){case"DES-CBC":l=8,s=e.des.createDecryptionCipher;break;case"DES-EDE3-CBC":l=24,s=e.des.createDecryptionCipher;break;case"AES-128-CBC":l=16,s=e.aes.createDecryptionCipher;break;case"AES-192-CBC":l=24,s=e.aes.createDecryptionCipher;break;case"AES-256-CBC":l=32,s=e.aes.createDecryptionCipher;break;case"RC2-40-CBC":l=5,s=function(t){return e.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":l=8,s=function(t){return e.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":l=16,s=function(t){return e.rc2.createDecryptionCipher(t,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var u=e.util.hexToBytes(i.dekInfo.parameters),v=s(e.pbe.opensslDeriveBytes(n,u.substr(0,8),l));if(v.start(u),v.update(e.util.createBuffer(i.body)),!v.finish())return o;o=v.output.getBytes()}else o=i.body;return null!==(o="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(r.fromDer(o),n):r.fromDer(o))&&(o=a.privateKeyFromAsn1(o)),o},a.pbe.generatePkcs12Key=function(t,r,a,n,o,i){var l,s;if(null==i){if(!("sha1"in e.md))throw new Error('"sha1" hash algorithm unavailable.');i=e.md.sha1.create()}var c=i.digestLength,u=i.blockLength,v=new e.util.ByteBuffer,d=new e.util.ByteBuffer;if(null!=t){for(s=0;s<t.length;s++)d.putInt16(t.charCodeAt(s));d.putInt16(0)}var p=d.length(),f=r.length(),h=new e.util.ByteBuffer;h.fillWithByte(a,u);var g=u*Math.ceil(f/u),m=new e.util.ByteBuffer;for(s=0;s<g;s++)m.putByte(r.at(s%f));var b=u*Math.ceil(p/u),y=new e.util.ByteBuffer;for(s=0;s<b;s++)y.putByte(d.at(s%p));var w=m;w.putBuffer(y);for(var _=Math.ceil(o/c),x=1;x<=_;x++){var C=new e.util.ByteBuffer;C.putBytes(h.bytes()),C.putBytes(w.bytes());for(var E=0;E<n;E++)i.start(),i.update(C.getBytes()),C=i.digest();var S=new e.util.ByteBuffer;for(s=0;s<u;s++)S.putByte(C.at(s%c));var k=Math.ceil(f/u)+Math.ceil(p/u),A=new e.util.ByteBuffer;for(l=0;l<k;l++){var T=new e.util.ByteBuffer(w.getBytes(u)),I=511;for(s=S.length()-1;s>=0;s--)I>>=8,I+=S.at(s)+T.at(s),T.setAt(s,255&I);A.putBuffer(T)}w=A,v.putBuffer(C)}return v.truncate(v.length()-o),v},a.pbe.getCipher=function(e,t,r){switch(e){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(e,t,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},a.pbe.getCipherForPBES2=function(t,n,o){var l,s={},u=[];if(!r.validate(n,i,s,u))throw(l=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,l;if((t=r.derToOid(s.kdfOid))!==a.oids.pkcs5PBKDF2)throw(l=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,l.supportedOids=["pkcs5PBKDF2"],l;if((t=r.derToOid(s.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(l=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,l.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],l;var v,d,p=s.kdfSalt,f=e.util.createBuffer(s.kdfIterationCount);switch(f=f.getInt(f.length()<<3),a.oids[t]){case"aes128-CBC":v=16,d=e.aes.createDecryptionCipher;break;case"aes192-CBC":v=24,d=e.aes.createDecryptionCipher;break;case"aes256-CBC":v=32,d=e.aes.createDecryptionCipher;break;case"des-EDE3-CBC":v=24,d=e.des.createDecryptionCipher;break;case"desCBC":v=8,d=e.des.createDecryptionCipher}var h=c(s.prfOid),g=e.pkcs5.pbkdf2(o,p,f,v,h),m=s.encIv,b=d(g);return b.start(m),b},a.pbe.getCipherForPKCS12PBE=function(t,n,o){var i={},s=[];if(!r.validate(n,l,i,s))throw(h=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,h;var u,v,d,p=e.util.createBuffer(i.salt),f=e.util.createBuffer(i.iterations);switch(f=f.getInt(f.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,v=8,d=e.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,v=8,d=function(t,r){var a=e.rc2.createDecryptionCipher(t,40);return a.start(r,null),a};break;default:var h;throw(h=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,h}var g=c(i.prfOid),m=a.pbe.generatePkcs12Key(o,p,1,f,u,g);return g.start(),d(m,a.pbe.generatePkcs12Key(o,p,2,f,v,g))},a.pbe.opensslDeriveBytes=function(t,r,a,n){if(null==n){if(!("md5"in e.md))throw new Error('"md5" hash algorithm unavailable.');n=e.md.md5.create()}null===r&&(r="");for(var o=[s(n,t+r)],i=16,l=1;i<a;++l,i+=16)o.push(s(n,o[l-1]+t+r));return o.join("").substr(0,a)},Bi}var Ui,Pi={exports:{}},Vi={exports:{}};function Mi(){if(Ui)return Vi.exports;Ui=1;var e=bo();Mo(),So();var t=e.asn1,r=Vi.exports=e.pkcs7asn1=e.pkcs7asn1||{};e.pkcs7=e.pkcs7||{},e.pkcs7.asn1=r;var a={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=a;var n={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(n)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(n)};var o={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[o]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},Vi.exports}var Oi,qi,ji,Fi={exports:{}},Ki={exports:{}};function $i(){if(Oi)return Ki.exports;Oi=1;var e=bo();return So(),e.mgf=e.mgf||{},(Ki.exports=e.mgf.mgf1=e.mgf1=e.mgf1||{}).create=function(t){return{generate:function(r,a){for(var n=new e.util.ByteBuffer,o=Math.ceil(a/t.digestLength),i=0;i<o;i++){var l=new e.util.ByteBuffer;l.putInt32(i),t.start(),t.update(r+l.getBytes()),n.putBuffer(t.digest())}return n.truncate(n.length()-a),n.getBytes()}}},Ki.exports}var Hi,Gi,Wi,Yi,Qi,Ji,Xi,Zi={exports:{}};function el(){if(Hi)return Zi.exports;Hi=1;var e=bo();return bi(),So(),(Zi.exports=e.pss=e.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var r,a=t.md,n=t.mgf,o=a.digestLength,i=t.salt||null;if("string"==typeof i&&(i=e.util.createBuffer(i)),"saltLength"in t)r=t.saltLength;else{if(null===i)throw new Error("Salt length not specified or specific salt not given.");r=i.length()}if(null!==i&&i.length()!==r)throw new Error("Given salt length does not match length of given salt.");var l=t.prng||e.random,s={encode:function(t,s){var c,u,v=s-1,d=Math.ceil(v/8),p=t.digest().getBytes();if(d<o+r+2)throw new Error("Message is too long to encrypt.");u=null===i?l.getBytesSync(r):i.bytes();var f=new e.util.ByteBuffer;f.fillWithByte(0,8),f.putBytes(p),f.putBytes(u),a.start(),a.update(f.getBytes());var h=a.digest().getBytes(),g=new e.util.ByteBuffer;g.fillWithByte(0,d-r-o-2),g.putByte(1),g.putBytes(u);var m=g.getBytes(),b=d-o-1,y=n.generate(h,b),w="";for(c=0;c<b;c++)w+=String.fromCharCode(m.charCodeAt(c)^y.charCodeAt(c));var _=65280>>8*d-v&255;return(w=String.fromCharCode(w.charCodeAt(0)&~_)+w.substr(1))+h+String.fromCharCode(188)},verify:function(t,i,l){var s,c=l-1,u=Math.ceil(c/8);if(i=i.substr(-u),u<o+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==i.charCodeAt(u-1))throw new Error("Encoded message does not end in 0xBC.");var v=u-o-1,d=i.substr(0,v),p=i.substr(v,o),f=65280>>8*u-c&255;if(0!==(d.charCodeAt(0)&f))throw new Error("Bits beyond keysize not zero as expected.");var h=n.generate(p,v),g="";for(s=0;s<v;s++)g+=String.fromCharCode(d.charCodeAt(s)^h.charCodeAt(s));g=String.fromCharCode(g.charCodeAt(0)&~f)+g.substr(1);var m=u-o-r-2;for(s=0;s<m;s++)if(0!==g.charCodeAt(s))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var b=g.substr(-r),y=new e.util.ByteBuffer;return y.fillWithByte(0,8),y.putBytes(t),y.putBytes(b),a.start(),a.update(y.getBytes()),p===a.digest().getBytes()}};return s},Zi.exports}function tl(){if(Gi)return Fi.exports;Gi=1;var e=bo();zo(),Mo(),ti(),Ko(),function(){if(ji)return qi;ji=1;var e=bo();$i(),qi=e.mgf=e.mgf||{},e.mgf.mgf1=e.mgf1}(),Vo(),Jo(),el(),Di(),So();var t=e.asn1,r=Fi.exports=e.pki=e.pki||{},a=r.oids,n={};n.CN=a.commonName,n.commonName="CN",n.C=a.countryName,n.countryName="C",n.L=a.localityName,n.localityName="L",n.ST=a.stateOrProvinceName,n.stateOrProvinceName="ST",n.O=a.organizationName,n.organizationName="O",n.OU=a.organizationalUnitName,n.organizationalUnitName="OU",n.E=a.emailAddress,n.emailAddress="E";var o=e.pki.rsa.publicKeyValidator,i={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},o,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},s={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},o,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},c={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[s,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function u(e,t){"string"==typeof t&&(t={shortName:t});for(var r,a=null,n=0;null===a&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}r.RDNAttributesAsArray=function(e,r){for(var o,i,l,s=[],c=0;c<e.value.length;++c){o=e.value[c];for(var u=0;u<o.value.length;++u)l={},i=o.value[u],l.type=t.derToOid(i.value[0].value),l.value=i.value[1].value,l.valueTagClass=i.value[1].type,l.type in a&&(l.name=a[l.type],l.name in n&&(l.shortName=n[l.name])),r&&(r.update(l.type),r.update(l.value)),s.push(l)}return s},r.CRIAttributesAsArray=function(e){for(var o=[],i=0;i<e.length;++i)for(var l=e[i],s=t.derToOid(l.value[0].value),c=l.value[1].value,u=0;u<c.length;++u){var v={};if(v.type=s,v.value=c[u].value,v.valueTagClass=c[u].type,v.type in a&&(v.name=a[v.type],v.name in n&&(v.shortName=n[v.name])),v.type===a.extensionRequest){v.extensions=[];for(var d=0;d<v.value.length;++d)v.extensions.push(r.certificateExtensionFromAsn1(v.value[d]))}o.push(v)}return o};var v=function(e,r,n){var o={};if(e!==a["RSASSA-PSS"])return o;n&&(o={hash:{algorithmOid:a.sha1},mgf:{algorithmOid:a.mgf1,hash:{algorithmOid:a.sha1}},saltLength:20});var i={},s=[];if(!t.validate(r,l,i,s)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=s,c}return void 0!==i.hashOid&&(o.hash=o.hash||{},o.hash.algorithmOid=t.derToOid(i.hashOid)),void 0!==i.maskGenOid&&(o.mgf=o.mgf||{},o.mgf.algorithmOid=t.derToOid(i.maskGenOid),o.mgf.hash=o.mgf.hash||{},o.mgf.hash.algorithmOid=t.derToOid(i.maskGenHashOid)),void 0!==i.saltLength&&(o.saltLength=i.saltLength.charCodeAt(0)),o},d=function(t){switch(a[t.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return e.md.sha1.create();case"md5WithRSAEncryption":return e.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return e.md.sha256.create();case"sha384WithRSAEncryption":return e.md.sha384.create();case"sha512WithRSAEncryption":return e.md.sha512.create();default:var r=new Error("Could not compute "+t.type+" digest. Unknown signature OID.");throw r.signatureOid=t.signatureOid,r}},p=function(t){var r,n=t.certificate;switch(n.signatureOid){case a.sha1WithRSAEncryption:case a.sha1WithRSASignature:break;case a["RSASSA-PSS"]:var o,i,l;if(void 0===(o=a[n.signatureParameters.mgf.hash.algorithmOid])||void 0===e.md[o])throw(l=new Error("Unsupported MGF hash function.")).oid=n.signatureParameters.mgf.hash.algorithmOid,l.name=o,l;if(void 0===(i=a[n.signatureParameters.mgf.algorithmOid])||void 0===e.mgf[i])throw(l=new Error("Unsupported MGF function.")).oid=n.signatureParameters.mgf.algorithmOid,l.name=i,l;if(i=e.mgf[i].create(e.md[o].create()),void 0===(o=a[n.signatureParameters.hash.algorithmOid])||void 0===e.md[o])throw(l=new Error("Unsupported RSASSA-PSS hash function.")).oid=n.signatureParameters.hash.algorithmOid,l.name=o,l;r=e.pss.create(e.md[o].create(),i,n.signatureParameters.saltLength)}return n.publicKey.verify(t.md.digest().getBytes(),t.signature,r)};function f(r){for(var a,n,o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),i=r.attributes,l=0;l<i.length;++l){var s=(a=i[l]).value,c=t.Type.PRINTABLESTRING;"valueTagClass"in a&&(c=a.valueTagClass)===t.Type.UTF8&&(s=e.util.encodeUtf8(s)),n=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),t.create(t.Class.UNIVERSAL,c,!1,s)])]),o.value.push(n)}return o}function h(e){for(var o,i=0;i<e.length;++i){if(void 0===(o=e[i]).name&&(o.type&&o.type in r.oids?o.name=r.oids[o.type]:o.shortName&&o.shortName in n&&(o.name=r.oids[n[o.shortName]])),void 0===o.type){if(!o.name||!(o.name in r.oids))throw(s=new Error("Attribute type not specified.")).attribute=o,s;o.type=r.oids[o.name]}if(void 0===o.shortName&&o.name&&o.name in n&&(o.shortName=n[o.name]),o.type===a.extensionRequest&&(o.valueConstructed=!0,o.valueTagClass=t.Type.SEQUENCE,!o.value&&o.extensions)){o.value=[];for(var l=0;l<o.extensions.length;++l)o.value.push(r.certificateExtensionToAsn1(g(o.extensions[l])))}var s;if(void 0===o.value)throw(s=new Error("Attribute value not specified.")).attribute=o,s}}function g(n,o){if(o=o||{},void 0===n.name&&n.id&&n.id in r.oids&&(n.name=r.oids[n.id]),void 0===n.id){if(!n.name||!(n.name in r.oids))throw(_=new Error("Extension ID not specified.")).extension=n,_;n.id=r.oids[n.name]}if(void 0!==n.value)return n;if("keyUsage"===n.name){var i=0,l=0,s=0;n.digitalSignature&&(l|=128,i=7),n.nonRepudiation&&(l|=64,i=6),n.keyEncipherment&&(l|=32,i=5),n.dataEncipherment&&(l|=16,i=4),n.keyAgreement&&(l|=8,i=3),n.keyCertSign&&(l|=4,i=2),n.cRLSign&&(l|=2,i=1),n.encipherOnly&&(l|=1,i=0),n.decipherOnly&&(s|=128,i=7);var c=String.fromCharCode(i);0!==s?c+=String.fromCharCode(l)+String.fromCharCode(s):0!==l&&(c+=String.fromCharCode(l)),n.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("basicConstraints"===n.name)n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),n.cA&&n.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in n&&n.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(n.pathLenConstraint).getBytes()));else if("extKeyUsage"===n.name){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var u=n.value.value;for(var v in n)!0===n[v]&&(v in a?u.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a[v]).getBytes())):-1!==v.indexOf(".")&&u.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(v).getBytes())))}else if("nsCertType"===n.name){i=0,l=0;n.client&&(l|=128,i=7),n.server&&(l|=64,i=6),n.email&&(l|=32,i=5),n.objsign&&(l|=16,i=4),n.reserved&&(l|=8,i=3),n.sslCA&&(l|=4,i=2),n.emailCA&&(l|=2,i=1),n.objCA&&(l|=1,i=0);c=String.fromCharCode(i);0!==l&&(c+=String.fromCharCode(l)),n.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("subjectAltName"===n.name||"issuerAltName"===n.name){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var d=0;d<n.altNames.length;++d){c=(b=n.altNames[d]).value;if(7===b.type&&b.ip){if(null===(c=e.util.bytesFromIP(b.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=n,_}else 8===b.type&&(c=b.oid?t.oidToDer(t.oidToDer(b.oid)):t.oidToDer(c));n.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,b.type,!1,c))}}else if("nsComment"===n.name&&o.cert){if(!/^[\x00-\x7F]*$/.test(n.comment)||n.comment.length<1||n.comment.length>128)throw new Error('Invalid "nsComment" content.');n.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,n.comment)}else if("subjectKeyIdentifier"===n.name&&o.cert){var p=o.cert.generateSubjectKeyIdentifier();n.subjectKeyIdentifier=p.toHex(),n.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===n.name&&o.cert){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);u=n.value.value;if(n.keyIdentifier){var h=!0===n.keyIdentifier?o.cert.generateSubjectKeyIdentifier().getBytes():n.keyIdentifier;u.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,h))}if(n.authorityCertIssuer){var g=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[f(!0===n.authorityCertIssuer?o.cert.issuer:n.authorityCertIssuer)])];u.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,g))}if(n.serialNumber){var m=e.util.hexToBytes(!0===n.serialNumber?o.cert.serialNumber:n.serialNumber);u.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===n.name){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);u=n.value.value;var b,y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),w=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<n.altNames.length;++d){c=(b=n.altNames[d]).value;if(7===b.type&&b.ip){if(null===(c=e.util.bytesFromIP(b.ip)))throw(_=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=n,_}else 8===b.type&&(c=b.oid?t.oidToDer(t.oidToDer(b.oid)):t.oidToDer(c));w.value.push(t.create(t.Class.CONTEXT_SPECIFIC,b.type,!1,c))}y.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[w])),u.push(y)}var _;if(void 0===n.value)throw(_=new Error("Extension value not specified.")).extension=n,_;return n}function m(e,r){if(e===a["RSASSA-PSS"]){var n=[];return void 0!==r.hash.algorithmOid&&n.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&n.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&n.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,n)}return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}function b(r){var a=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===r.attributes.length)return a;for(var n=r.attributes,o=0;o<n.length;++o){var i=n[o],l=i.value,s=t.Type.UTF8;"valueTagClass"in i&&(s=i.valueTagClass),s===t.Type.UTF8&&(l=e.util.encodeUtf8(l));var c=!1;"valueConstructed"in i&&(c=i.valueConstructed);var u=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,s,c,l)])]);a.value.push(u)}return a}r.certificateFromPem=function(a,n,o){var i=e.pem.decode(a)[0];if("CERTIFICATE"!==i.type&&"X509 CERTIFICATE"!==i.type&&"TRUSTED CERTIFICATE"!==i.type){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=i.type,l}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=t.fromDer(i.body,o);return r.certificateFromAsn1(s,n)},r.certificateToPem=function(a,n){var o={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.publicKeyFromPem=function(a){var n=e.pem.decode(a)[0];if("PUBLIC KEY"!==n.type&&"RSA PUBLIC KEY"!==n.type){var o=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var i=t.fromDer(n.body);return r.publicKeyFromAsn1(i)},r.publicKeyToPem=function(a,n){var o={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.publicKeyToRSAPublicKeyPem=function(a,n){var o={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.getPublicKeyFingerprint=function(a,n){var o,i=(n=n||{}).md||e.md.sha1.create();switch(n.type||"RSAPublicKey"){case"RSAPublicKey":o=t.toDer(r.publicKeyToRSAPublicKey(a)).getBytes();break;case"SubjectPublicKeyInfo":o=t.toDer(r.publicKeyToAsn1(a)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}i.start(),i.update(o);var l=i.digest();if("hex"===n.encoding){var s=l.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return l.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return l},r.certificationRequestFromPem=function(a,n,o){var i=e.pem.decode(a)[0];if("CERTIFICATE REQUEST"!==i.type){var l=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw l.headerType=i.type,l}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=t.fromDer(i.body,o);return r.certificationRequestFromAsn1(s,n)},r.certificationRequestToPem=function(a,n){var o={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.createCertificate=function(){var n={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return n.siginfo.algorithmOid=null,n.validity={},n.validity.notBefore=new Date,n.validity.notAfter=new Date,n.issuer={},n.issuer.getField=function(e){return u(n.issuer,e)},n.issuer.addField=function(e){h([e]),n.issuer.attributes.push(e)},n.issuer.attributes=[],n.issuer.hash=null,n.subject={},n.subject.getField=function(e){return u(n.subject,e)},n.subject.addField=function(e){h([e]),n.subject.attributes.push(e)},n.subject.attributes=[],n.subject.hash=null,n.extensions=[],n.publicKey=null,n.md=null,n.setSubject=function(e,t){h(e),n.subject.attributes=e,delete n.subject.uniqueId,t&&(n.subject.uniqueId=t),n.subject.hash=null},n.setIssuer=function(e,t){h(e),n.issuer.attributes=e,delete n.issuer.uniqueId,t&&(n.issuer.uniqueId=t),n.issuer.hash=null},n.setExtensions=function(e){for(var t=0;t<e.length;++t)g(e[t],{cert:n});n.extensions=e},n.getExtension=function(e){"string"==typeof e&&(e={name:e});for(var t,r=null,a=0;null===r&&a<n.extensions.length;++a)t=n.extensions[a],(e.id&&t.id===e.id||e.name&&t.name===e.name)&&(r=t);return r},n.sign=function(o,i){n.md=i||e.md.sha1.create();var l=a[n.md.algorithm+"WithRSAEncryption"];if(!l){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=n.md.algorithm,s}n.signatureOid=n.siginfo.algorithmOid=l,n.tbsCertificate=r.getTBSCertificate(n);var c=t.toDer(n.tbsCertificate);n.md.update(c.getBytes()),n.signature=o.sign(n.md)},n.verify=function(e){var a=!1;if(!n.issued(e)){var o=e.issuer,i=n.subject,l=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw l.expectedIssuer=i.attributes,l.actualIssuer=o.attributes,l}var s=e.md;if(null===s){s=d({signatureOid:e.signatureOid,type:"certificate"});var c=e.tbsCertificate||r.getTBSCertificate(e),u=t.toDer(c);s.update(u.getBytes())}return null!==s&&(a=p({certificate:n,md:s,signature:e.signature})),a},n.isIssuer=function(e){var t=!1,r=n.issuer,a=e.subject;if(r.hash&&a.hash)t=r.hash===a.hash;else if(r.attributes.length===a.attributes.length){var o,i;t=!0;for(var l=0;t&&l<r.attributes.length;++l)o=r.attributes[l],i=a.attributes[l],o.type===i.type&&o.value===i.value||(t=!1)}return t},n.issued=function(e){return e.isIssuer(n)},n.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(n.publicKey,{type:"RSAPublicKey"})},n.verifySubjectKeyIdentifier=function(){for(var t=a.subjectKeyIdentifier,r=0;r<n.extensions.length;++r){var o=n.extensions[r];if(o.id===t){var i=n.generateSubjectKeyIdentifier().getBytes();return e.util.hexToBytes(o.subjectKeyIdentifier)===i}}return!1},n},r.certificateFromAsn1=function(a,n){var o={},l=[];if(!t.validate(a,i,o,l)){var s=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw s.errors=l,s}if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificate();c.version=o.certVersion?o.certVersion.charCodeAt(0):0;var p=e.util.createBuffer(o.certSerialNumber);c.serialNumber=p.toHex(),c.signatureOid=e.asn1.derToOid(o.certSignatureOid),c.signatureParameters=v(c.signatureOid,o.certSignatureParams,!0),c.siginfo.algorithmOid=e.asn1.derToOid(o.certinfoSignatureOid),c.siginfo.parameters=v(c.siginfo.algorithmOid,o.certinfoSignatureParams,!1),c.signature=o.certSignature;var f=[];if(void 0!==o.certValidity1UTCTime&&f.push(t.utcTimeToDate(o.certValidity1UTCTime)),void 0!==o.certValidity2GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity2GeneralizedTime)),void 0!==o.certValidity3UTCTime&&f.push(t.utcTimeToDate(o.certValidity3UTCTime)),void 0!==o.certValidity4GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=f[0],c.validity.notAfter=f[1],c.tbsCertificate=o.tbsCertificate,n){c.md=d({signatureOid:c.signatureOid,type:"certificate"});var g=t.toDer(c.tbsCertificate);c.md.update(g.getBytes())}var m=e.md.sha1.create(),b=t.toDer(o.certIssuer);m.update(b.getBytes()),c.issuer.getField=function(e){return u(c.issuer,e)},c.issuer.addField=function(e){h([e]),c.issuer.attributes.push(e)},c.issuer.attributes=r.RDNAttributesAsArray(o.certIssuer),o.certIssuerUniqueId&&(c.issuer.uniqueId=o.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var y=e.md.sha1.create(),w=t.toDer(o.certSubject);return y.update(w.getBytes()),c.subject.getField=function(e){return u(c.subject,e)},c.subject.addField=function(e){h([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(o.certSubject),o.certSubjectUniqueId&&(c.subject.uniqueId=o.certSubjectUniqueId),c.subject.hash=y.digest().toHex(),o.certExtensions?c.extensions=r.certificateExtensionsFromAsn1(o.certExtensions):c.extensions=[],c.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),c},r.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var n=e.value[a],o=0;o<n.value.length;++o)t.push(r.certificateExtensionFromAsn1(n.value[o]));return t},r.certificateExtensionFromAsn1=function(r){var n={};if(n.id=t.derToOid(r.value[0].value),n.critical=!1,r.value[1].type===t.Type.BOOLEAN?(n.critical=0!==r.value[1].value.charCodeAt(0),n.value=r.value[2].value):n.value=r.value[1].value,n.id in a)if(n.name=a[n.id],"keyUsage"===n.name){var o=0,i=0;(s=t.fromDer(n.value)).value.length>1&&(o=s.value.charCodeAt(1),i=s.value.length>2?s.value.charCodeAt(2):0),n.digitalSignature=!(128&~o),n.nonRepudiation=!(64&~o),n.keyEncipherment=!(32&~o),n.dataEncipherment=!(16&~o),n.keyAgreement=!(8&~o),n.keyCertSign=!(4&~o),n.cRLSign=!(2&~o),n.encipherOnly=!(1&~o),n.decipherOnly=!(128&~i)}else if("basicConstraints"===n.name){(s=t.fromDer(n.value)).value.length>0&&s.value[0].type===t.Type.BOOLEAN?n.cA=0!==s.value[0].value.charCodeAt(0):n.cA=!1;var l=null;s.value.length>0&&s.value[0].type===t.Type.INTEGER?l=s.value[0].value:s.value.length>1&&(l=s.value[1].value),null!==l&&(n.pathLenConstraint=t.derToInteger(l))}else if("extKeyUsage"===n.name)for(var s=t.fromDer(n.value),c=0;c<s.value.length;++c){var u=t.derToOid(s.value[c].value);u in a?n[a[u]]=!0:n[u]=!0}else if("nsCertType"===n.name){o=0;(s=t.fromDer(n.value)).value.length>1&&(o=s.value.charCodeAt(1)),n.client=!(128&~o),n.server=!(64&~o),n.email=!(32&~o),n.objsign=!(16&~o),n.reserved=!(8&~o),n.sslCA=!(4&~o),n.emailCA=!(2&~o),n.objCA=!(1&~o)}else if("subjectAltName"===n.name||"issuerAltName"===n.name){var v;n.altNames=[];s=t.fromDer(n.value);for(var d=0;d<s.value.length;++d){var p={type:(v=s.value[d]).type,value:v.value};switch(n.altNames.push(p),v.type){case 1:case 2:case 6:break;case 7:p.ip=e.util.bytesToIP(v.value);break;case 8:p.oid=t.derToOid(v.value)}}}else if("subjectKeyIdentifier"===n.name){s=t.fromDer(n.value);n.subjectKeyIdentifier=e.util.bytesToHex(s.value)}return n},r.certificationRequestFromAsn1=function(a,n){var o={},i=[];if(!t.validate(a,c,o,i)){var l=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw l.errors=i,l}if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=r.createCertificationRequest();if(s.version=o.csrVersion?o.csrVersion.charCodeAt(0):0,s.signatureOid=e.asn1.derToOid(o.csrSignatureOid),s.signatureParameters=v(s.signatureOid,o.csrSignatureParams,!0),s.siginfo.algorithmOid=e.asn1.derToOid(o.csrSignatureOid),s.siginfo.parameters=v(s.siginfo.algorithmOid,o.csrSignatureParams,!1),s.signature=o.csrSignature,s.certificationRequestInfo=o.certificationRequestInfo,n){s.md=d({signatureOid:s.signatureOid,type:"certification request"});var p=t.toDer(s.certificationRequestInfo);s.md.update(p.getBytes())}var f=e.md.sha1.create();return s.subject.getField=function(e){return u(s.subject,e)},s.subject.addField=function(e){h([e]),s.subject.attributes.push(e)},s.subject.attributes=r.RDNAttributesAsArray(o.certificationRequestInfoSubject,f),s.subject.hash=f.digest().toHex(),s.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),s.getAttribute=function(e){return u(s,e)},s.addAttribute=function(e){h([e]),s.attributes.push(e)},s.attributes=r.CRIAttributesAsArray(o.certificationRequestInfoAttributes||[]),s},r.createCertificationRequest=function(){var n={version:0,signatureOid:null,signature:null,siginfo:{}};return n.siginfo.algorithmOid=null,n.subject={},n.subject.getField=function(e){return u(n.subject,e)},n.subject.addField=function(e){h([e]),n.subject.attributes.push(e)},n.subject.attributes=[],n.subject.hash=null,n.publicKey=null,n.attributes=[],n.getAttribute=function(e){return u(n,e)},n.addAttribute=function(e){h([e]),n.attributes.push(e)},n.md=null,n.setSubject=function(e){h(e),n.subject.attributes=e,n.subject.hash=null},n.setAttributes=function(e){h(e),n.attributes=e},n.sign=function(o,i){n.md=i||e.md.sha1.create();var l=a[n.md.algorithm+"WithRSAEncryption"];if(!l){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=n.md.algorithm,s}n.signatureOid=n.siginfo.algorithmOid=l,n.certificationRequestInfo=r.getCertificationRequestInfo(n);var c=t.toDer(n.certificationRequestInfo);n.md.update(c.getBytes()),n.signature=o.sign(n.md)},n.verify=function(){var e=!1,a=n.md;if(null===a){a=d({signatureOid:n.signatureOid,type:"certification request"});var o=n.certificationRequestInfo||r.getCertificationRequestInfo(n),i=t.toDer(o);a.update(i.getBytes())}return null!==a&&(e=p({certificate:n,md:a,signature:n.signature})),e},n};var y=new Date("1950-01-01T00:00:00Z"),w=new Date("2050-01-01T00:00:00Z");function _(e){return e>=y&&e<w?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}return r.getTBSCertificate=function(a){var n=_(a.validity.notBefore),o=_(a.validity.notAfter),i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(a.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(a.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.siginfo.algorithmOid).getBytes()),m(a.siginfo.algorithmOid,a.siginfo.parameters)]),f(a.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,o]),f(a.subject),r.publicKeyToAsn1(a.publicKey)]);return a.issuer.uniqueId&&i.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+a.issuer.uniqueId)])),a.subject.uniqueId&&i.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+a.subject.uniqueId)])),a.extensions.length>0&&i.value.push(r.certificateExtensionsToAsn1(a.extensions)),i},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),f(e.subject),r.publicKeyToAsn1(e.publicKey),b(e)])},r.distinguishedNameToAsn1=function(e){return f(e)},r.certificateToAsn1=function(e){var a=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[a,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var a=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),n=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);a.value.push(n);for(var o=0;o<e.length;++o)n.value.push(r.certificateExtensionToAsn1(e[o]));return a},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var a=e.value;return"string"!=typeof e.value&&(a=t.toDer(a).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,a)),r},r.certificationRequestToAsn1=function(e){var a=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[a,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(a){var n={certs:{}};function o(e){return i(e),n.certs[e.hash]||null}function i(t){if(!t.hash){var a=e.md.sha1.create();t.attributes=r.RDNAttributesAsArray(f(t),a),t.hash=a.digest().toHex()}}if(n.getIssuer=function(e){return o(e.issuer)},n.addCertificate=function(t){if("string"==typeof t&&(t=e.pki.certificateFromPem(t)),i(t.subject),!n.hasCertificate(t))if(t.subject.hash in n.certs){var r=n.certs[t.subject.hash];e.util.isArray(r)||(r=[r]),r.push(t),n.certs[t.subject.hash]=r}else n.certs[t.subject.hash]=t},n.hasCertificate=function(a){"string"==typeof a&&(a=e.pki.certificateFromPem(a));var n=o(a.subject);if(!n)return!1;e.util.isArray(n)||(n=[n]);for(var i=t.toDer(r.certificateToAsn1(a)).getBytes(),l=0;l<n.length;++l){if(i===t.toDer(r.certificateToAsn1(n[l])).getBytes())return!0}return!1},n.listAllCertificates=function(){var t=[];for(var r in n.certs)if(n.certs.hasOwnProperty(r)){var a=n.certs[r];if(e.util.isArray(a))for(var o=0;o<a.length;++o)t.push(a[o]);else t.push(a)}return t},n.removeCertificate=function(a){var l;if("string"==typeof a&&(a=e.pki.certificateFromPem(a)),i(a.subject),!n.hasCertificate(a))return null;var s=o(a.subject);if(!e.util.isArray(s))return l=n.certs[a.subject.hash],delete n.certs[a.subject.hash],l;for(var c=t.toDer(r.certificateToAsn1(a)).getBytes(),u=0;u<s.length;++u){c===t.toDer(r.certificateToAsn1(s[u])).getBytes()&&(l=s[u],s.splice(u,1))}return 0===s.length&&delete n.certs[a.subject.hash],l},a)for(var l=0;l<a.length;++l){var s=a[l];n.addCertificate(s)}return n},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(t,a,n){"function"==typeof n&&(n={verify:n}),n=n||{};var o=(a=a.slice(0)).slice(0),i=n.validityCheckDate;void 0===i&&(i=new Date);var l=!0,s=null,c=0;do{var u=a.shift(),v=null,d=!1;if(i&&(i<u.validity.notBefore||i>u.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:i}),null===s){if(null===(v=a[0]||t.getIssuer(u))&&u.isIssuer(u)&&(d=!0,v=u),v){var p=v;e.util.isArray(p)||(p=[p]);for(var f=!1;!f&&p.length>0;){v=p.shift();try{f=v.verify(u)}catch(x){}}f||(s={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==s||v&&!d||t.hasCertificate(u)||(s={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===s&&v&&!u.isIssuer(v)&&(s={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===s)for(var h={keyUsage:!0,basicConstraints:!0},g=0;null===s&&g<u.extensions.length;++g){var m=u.extensions[g];m.critical&&!(m.name in h)&&(s={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===s&&(!l||0===a.length&&(!v||d))){var b=u.getExtension("basicConstraints"),y=u.getExtension("keyUsage");if(null!==y&&(y.keyCertSign&&null!==b||(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==s||null===b||b.cA||(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===s&&null!==y&&"pathLenConstraint"in b)c-1>b.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var w=null===s||s.error,_=n.verify?n.verify(w,c,o):w;if(!0!==_)throw!0===w&&(s={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(_||0===_)&&("object"!=typeof _||e.util.isArray(_)?"string"==typeof _&&(s.error=_):(_.message&&(s.message=_.message),_.error&&(s.error=_.error))),s;s=null,l=!1,++c}while(a.length>0);return!0},Fi.exports}function rl(){if(Wi)return Pi.exports;Wi=1;var e=bo();Mo(),$o(),Vo(),Mi(),Li(),bi(),Di(),Si(),So(),tl();var t=e.asn1,r=e.pki,a=Pi.exports=e.pkcs12=e.pkcs12||{},n={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},o={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},n,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},i={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},l={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},s={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function c(e,t,r,a){for(var n=[],o=0;o<e.length;o++)for(var i=0;i<e[o].safeBags.length;i++){var l=e[o].safeBags[i];void 0!==a&&l.type!==a||(null!==t?void 0!==l.attributes[t]&&l.attributes[t].indexOf(r)>=0&&n.push(l):n.push(l))}return n}function u(t){if(t.composed||t.constructed){for(var r=e.util.createBuffer(),a=0;a<t.value.length;++a)r.putBytes(t.value[a].value);t.composed=t.constructed=!1,t.value=r.getBytes()}return t}function v(a,n){var o={},i=[];if(!t.validate(a,e.pkcs7.asn1.encryptedDataValidator,o,i))throw(l=new Error("Cannot read EncryptedContentInfo.")).errors=i,l;var l,s=t.derToOid(o.contentType);if(s!==r.oids.data)throw(l=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=s,l;s=t.derToOid(o.encAlgorithm);var c=r.pbe.getCipher(s,o.encParameter,n),v=u(o.encryptedContentAsn1),d=e.util.createBuffer(v.value);if(c.update(d),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function d(e,a,n){if(!a&&0===e.length)return[];if((e=t.fromDer(e,a)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var o=[],l=0;l<e.value.length;l++){var c=e.value[l],u={},v=[];if(!t.validate(c,i,u,v))throw(m=new Error("Cannot read SafeBag.")).errors=v,m;var d,f,h={type:t.derToOid(u.bagId),attributes:p(u.bagAttributes)};o.push(h);var g=u.bagValue.value[0];switch(h.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,n)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{h.key=r.privateKeyFromAsn1(g)}catch(b){h.key=null,h.asn1=g}continue;case r.oids.certBag:d=s,f=function(){if(t.derToOid(u.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(u.certId),e}var n=t.fromDer(u.cert,a);try{h.cert=r.certificateFromAsn1(n,!0)}catch(b){h.cert=null,h.asn1=n}};break;default:var m;throw(m=new Error("Unsupported PKCS#12 SafeBag type.")).oid=h.type,m}if(void 0!==d&&!t.validate(g,d,u,v))throw(m=new Error("Cannot read PKCS#12 "+d.name)).errors=v,m;f()}return o}function p(e){var a={};if(void 0!==e)for(var n=0;n<e.length;++n){var o={},i=[];if(!t.validate(e[n],l,o,i)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=i,s}var c=t.derToOid(o.oid);if(void 0!==r.oids[c]){a[r.oids[c]]=[];for(var u=0;u<o.values.length;++u)a[r.oids[c]].push(o.values[u].value)}}return a}return a.pkcs12FromAsn1=function(i,l,s){"string"==typeof l?(s=l,l=!0):void 0===l&&(l=!0);var p={};if(!t.validate(i,o,p,[]))throw(f=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=f,f;var f,h={version:p.version.charCodeAt(0),safeContents:[],getBags:function(t){var r,a={};return"localKeyId"in t?r=t.localKeyId:"localKeyIdHex"in t&&(r=e.util.hexToBytes(t.localKeyIdHex)),void 0===r&&!("friendlyName"in t)&&"bagType"in t&&(a[t.bagType]=c(h.safeContents,null,null,t.bagType)),void 0!==r&&(a.localKeyId=c(h.safeContents,"localKeyId",r,t.bagType)),"friendlyName"in t&&(a.friendlyName=c(h.safeContents,"friendlyName",t.friendlyName,t.bagType)),a},getBagsByFriendlyName:function(e,t){return c(h.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return c(h.safeContents,"localKeyId",e,t)}};if(3!==p.version.charCodeAt(0))throw(f=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=p.version.charCodeAt(0),f;if(t.derToOid(p.contentType)!==r.oids.data)throw(f=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(p.contentType),f;var g=p.content.value[0];if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(g=u(g),p.mac){var m=null,b=0,y=t.derToOid(p.macAlgorithm);switch(y){case r.oids.sha1:m=e.md.sha1.create(),b=20;break;case r.oids.sha256:m=e.md.sha256.create(),b=32;break;case r.oids.sha384:m=e.md.sha384.create(),b=48;break;case r.oids.sha512:m=e.md.sha512.create(),b=64;break;case r.oids.md5:m=e.md.md5.create(),b=16}if(null===m)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+y);var w=new e.util.ByteBuffer(p.macSalt),_="macIterations"in p?parseInt(e.util.bytesToHex(p.macIterations),16):1,x=a.generateKey(s,w,3,_,b,m),C=e.hmac.create();if(C.start(m,x),C.update(g.value),C.getMac().getBytes()!==p.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(i.value)&&i.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return function(e,a,o,i){if(a=t.fromDer(a,o),a.tagClass!==t.Class.UNIVERSAL||a.type!==t.Type.SEQUENCE||!0!==a.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var l=0;l<a.value.length;l++){var s=a.value[l],c={},p=[];if(!t.validate(s,n,c,p))throw(m=new Error("Cannot read ContentInfo.")).errors=p,m;var f={encrypted:!1},h=null,g=c.content.value[0];switch(t.derToOid(c.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");h=u(g).value;break;case r.oids.encryptedData:h=v(g,i),f.encrypted=!0;break;default:var m;throw(m=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(c.contentType),m}f.safeBags=d(h,o,i),e.safeContents.push(f)}}(h,g.value,l,s),h},a.toPkcs12Asn1=function(n,o,i,l){(l=l||{}).saltSize=l.saltSize||8,l.count=l.count||2048,l.algorithm=l.algorithm||l.encAlgorithm||"aes128","useMac"in l||(l.useMac=!0),"localKeyId"in l||(l.localKeyId=null),"generateLocalKeyId"in l||(l.generateLocalKeyId=!0);var s,c=l.localKeyId;if(null!==c)c=e.util.hexToBytes(c);else if(l.generateLocalKeyId)if(o){var u=e.util.isArray(o)?o[0]:o;"string"==typeof u&&(u=r.certificateFromPem(u)),(A=e.md.sha1.create()).update(t.toDer(r.certificateToAsn1(u)).getBytes()),c=A.digest().getBytes()}else c=e.random.getBytes(20);var v=[];null!==c&&v.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,c)])])),"friendlyName"in l&&v.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,l.friendlyName)])])),v.length>0&&(s=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,v));var d=[],p=[];null!==o&&(p=e.util.isArray(o)?o:[o]);for(var f=[],h=0;h<p.length;++h){"string"==typeof(o=p[h])&&(o=r.certificateFromPem(o));var g=0===h?s:void 0,m=r.certificateToAsn1(o),b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(m).getBytes())])])]),g]);f.push(b)}if(f.length>0){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,f),w=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(y).getBytes())])]);d.push(w)}var _=null;if(null!==n){var x=r.wrapRsaPrivateKey(r.privateKeyToAsn1(n));_=null===i?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[x]),s]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(x,i,l)]),s]);var C=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[_]),E=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(C).getBytes())])]);d.push(E)}var S,k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d);if(l.useMac){var A=e.md.sha1.create(),T=new e.util.ByteBuffer(e.random.getBytes(l.saltSize)),I=l.count,B=(n=a.generateKey(i,T,3,I,20),e.hmac.create());B.start(A,n),B.update(t.toDer(k).getBytes());var N=B.getMac();S=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,N.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,T.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(I).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(k).getBytes())])]),S])},a.generateKey=e.pbe.generatePkcs12Key,Pi.exports}function al(){if(Yi)return ei.exports;Yi=1;var e=bo();Mo(),Vo(),Li(),Jo(),oi(),rl(),el(),Di(),So(),tl();var t=e.asn1,r=ei.exports=e.pki=e.pki||{};return r.pemToDer=function(t){var r=e.pem.decode(t)[0];if(r.procType&&"ENCRYPTED"===r.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return e.util.createBuffer(r.body)},r.privateKeyFromPem=function(a){var n=e.pem.decode(a)[0];if("PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var o=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var i=t.fromDer(n.body);return r.privateKeyFromAsn1(i)},r.privateKeyToPem=function(a,n){var o={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.privateKeyInfoToPem=function(r,a){var n={type:"PRIVATE KEY",body:t.toDer(r).getBytes()};return e.pem.encode(n,{maxline:a})},ei.exports}function nl(){if(Ji)return Qi;Ji=1;var e=bo();Mo(),$o(),Wo(),Jo(),al(),bi(),Si(),So();var t=function(t,r,a,n){var o=e.util.createBuffer(),i=t.length>>1,l=i+(1&t.length),s=t.substr(0,l),c=t.substr(i,l),u=e.util.createBuffer(),v=e.hmac.create();a=r+a;var d=Math.ceil(n/16),p=Math.ceil(n/20);v.start("MD5",s);var f=e.util.createBuffer();u.putBytes(a);for(var h=0;h<d;++h)v.start(null,null),v.update(u.getBytes()),u.putBuffer(v.digest()),v.start(null,null),v.update(u.bytes()+a),f.putBuffer(v.digest());v.start("SHA1",c);var g=e.util.createBuffer();u.clear(),u.putBytes(a);for(h=0;h<p;++h)v.start(null,null),v.update(u.getBytes()),u.putBuffer(v.digest()),v.start(null,null),v.update(u.bytes()+a),g.putBuffer(v.digest());return o.putBytes(e.util.xorBytes(f.getBytes(),g.getBytes(),n)),o},r=function(t,r,a){var n=!1;try{var o=t.deflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(o),r.length=o.length,n=!0}catch(i){}return n},a=function(t,r,a){var n=!1;try{var o=t.inflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(o),r.length=o.length,n=!0}catch(i){}return n},n=function(t,r){var a=0;switch(r){case 1:a=t.getByte();break;case 2:a=t.getInt16();break;case 3:a=t.getInt24();break;case 4:a=t.getInt32()}return e.util.createBuffer(t.getBytes(a))},o=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},i={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};i.SupportedVersions=[i.Versions.TLS_1_1,i.Versions.TLS_1_0],i.Version=i.SupportedVersions[0],i.MaxFragment=15360,i.ConnectionEnd={server:0,client:1},i.PRFAlgorithm={tls_prf_sha256:0},i.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},i.CipherType={stream:0,block:1,aead:2},i.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},i.CompressionMethod={none:0,deflate:1},i.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},i.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},i.Alert={},i.Alert.Level={warning:1,fatal:2},i.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},i.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},i.CipherSuites={},i.getCipherSuite=function(e){var t=null;for(var r in i.CipherSuites){var a=i.CipherSuites[r];if(a.id[0]===e.charCodeAt(0)&&a.id[1]===e.charCodeAt(1)){t=a;break}}return t},i.handleUnexpected=function(e,t){!e.open&&e.entity===i.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}})},i.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(i.queue(e,i.createAlert(e,{level:i.Alert.Level.warning,description:i.Alert.Description.no_renegotiation})),i.flush(e)),e.process()},i.parseHelloMessage=function(t,r,a){var o=null,l=t.entity===i.ConnectionEnd.client;if(a<38)t.error(t,{message:l?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});else{var s=r.fragment,c=s.length();if(o={version:{major:s.getByte(),minor:s.getByte()},random:e.util.createBuffer(s.getBytes(32)),session_id:n(s,1),extensions:[]},l?(o.cipher_suite=s.getBytes(2),o.compression_method=s.getByte()):(o.cipher_suites=n(s,2),o.compression_methods=n(s,1)),(c=a-(c-s.length()))>0){for(var u=n(s,2);u.length()>0;)o.extensions.push({type:[u.getByte(),u.getByte()],data:n(u,2)});if(!l)for(var v=0;v<o.extensions.length;++v){var d=o.extensions[v];if(0===d.type[0]&&0===d.type[1])for(var p=n(d.data,2);p.length()>0;){if(0!==p.getByte())break;t.session.extensions.server_name.serverNameList.push(n(p,2).getBytes())}}}if(t.session.version&&(o.version.major!==t.session.version.major||o.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}});if(l)t.session.cipherSuite=i.getCipherSuite(o.cipher_suite);else for(var f=e.util.createBuffer(o.cipher_suites.bytes());f.length()>0&&(t.session.cipherSuite=i.getCipherSuite(f.getBytes(2)),null===t.session.cipherSuite););if(null===t.session.cipherSuite)return t.error(t,{message:"No cipher suites in common.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure},cipherSuite:e.util.bytesToHex(o.cipher_suite)});t.session.compressionMethod=l?o.compression_method:i.CompressionMethod.none}return o},i.createSecurityParameters=function(e,t){var r=e.entity===i.ConnectionEnd.client,a=t.random.bytes(),n=r?e.session.sp.client_random:a,o=r?a:i.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:i.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:o}},i.handleServerHello=function(e,t,r){var a=i.parseHelloMessage(e,t,r);if(!e.fail){if(!(a.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}});e.version.minor=a.version.minor,e.session.version=e.version;var n=a.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=v,e.session.resuming=!0,e.session.sp.server_random=a.random.bytes()):(e.expect=l,e.session.resuming=!1,i.createSecurityParameters(e,a)),e.session.id=n,e.process()}},i.handleClientHello=function(t,r,a){var n=i.parseHelloMessage(t,r,a);if(!t.fail){var o=n.session_id.bytes(),l=null;if(t.sessionCache&&(null===(l=t.sessionCache.getSession(o))?o="":(l.version.major!==n.version.major||l.version.minor>n.version.minor)&&(l=null,o="")),0===o.length&&(o=e.random.getBytes(32)),t.session.id=o,t.session.clientHelloVersion=n.version,t.session.sp={},l)t.version=t.session.version=l.version,t.session.sp=l.sp;else{for(var s,c=1;c<i.SupportedVersions.length&&!((s=i.SupportedVersions[c]).minor<=n.version.minor);++c);t.version={major:s.major,minor:s.minor},t.session.version=t.version}null!==l?(t.expect=b,t.session.resuming=!0,t.session.sp.client_random=n.random.bytes()):(t.expect=!1!==t.verifyClient?h:g,t.session.resuming=!1,i.createSecurityParameters(t,n)),t.open=!0,i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerHello(t)})),t.session.resuming?(i.queue(t,i.createRecord(t,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),t.state.pending=i.createConnectionState(t),t.state.current.write=t.state.pending.write,i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createFinished(t)}))):(i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificate(t)})),t.fail||(i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerKeyExchange(t)})),!1!==t.verifyClient&&i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificateRequest(t)})),i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerHelloDone(t)})))),i.flush(t),t.process()}},i.handleCertificate=function(t,r,a){if(a<3)return t.error(t,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var o,l,c=r.fragment,u={certificate_list:n(c,3)},v=[];try{for(;u.certificate_list.length()>0;)o=n(u.certificate_list,3),l=e.asn1.fromDer(o),o=e.pki.certificateFromAsn1(l,!0),v.push(o)}catch(p){return t.error(t,{message:"Could not parse certificate list.",cause:p,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var d=t.entity===i.ConnectionEnd.client;!d&&!0!==t.verifyClient||0!==v.length?0===v.length?t.expect=d?s:g:(d?t.session.serverCertificate=v[0]:t.session.clientCertificate=v[0],i.verifyCertificateChain(t,v)&&(t.expect=d?s:g)):t.error(t,{message:d?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}}),t.process()},i.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});e.expect=c,e.process()},i.handleClientKeyExchange=function(t,r,a){if(a<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});var o=r.fragment,l={enc_pre_master_secret:n(o,2).getBytes()},s=null;if(t.getPrivateKey)try{s=t.getPrivateKey(t,t.session.serverCertificate),s=e.pki.privateKeyFromPem(s)}catch(v){t.error(t,{message:"Could not get private key.",cause:v,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}if(null===s)return t.error(t,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}});try{var c=t.session.sp;c.pre_master_secret=s.decrypt(l.enc_pre_master_secret);var u=t.session.clientHelloVersion;if(u.major!==c.pre_master_secret.charCodeAt(0)||u.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(v){c.pre_master_secret=e.random.getBytes(48)}t.expect=b,null!==t.session.clientCertificate&&(t.expect=m),t.process()},i.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var a=t.fragment,o={certificate_types:n(a,1),certificate_authorities:n(a,2)};e.session.certificateRequest=o,e.expect=u,e.process()},i.handleCertificateVerify=function(t,r,a){if(a<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var o=r.fragment;o.read-=4;var l=o.bytes();o.read+=4;var s={signature:n(o,2).getBytes()},c=e.util.createBuffer();c.putBuffer(t.session.md5.digest()),c.putBuffer(t.session.sha1.digest()),c=c.getBytes();try{if(!t.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(l),t.session.sha1.update(l)}catch(u){return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure}})}t.expect=b,t.process()},i.handleServerHelloDone=function(t,r,a){if(a>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.record_overflow}});if(null===t.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.insufficient_security}},o=t.verify(t,n.alert.description,0,[]);if(!0!==o)return(o||0===o)&&("object"!=typeof o||e.util.isArray(o)?"number"==typeof o&&(n.alert.description=o):(o.message&&(n.message=o.message),o.alert&&(n.alert.description=o.alert))),t.error(t,n)}null!==t.session.certificateRequest&&(r=i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificate(t)}),i.queue(t,r)),r=i.createRecord(t,{type:i.ContentType.handshake,data:i.createClientKeyExchange(t)}),i.queue(t,r),t.expect=f;var l=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&i.queue(e,i.createRecord(e,{type:i.ContentType.handshake,data:i.createCertificateVerify(e,t)})),i.queue(e,i.createRecord(e,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),e.state.pending=i.createConnectionState(e),e.state.current.write=e.state.pending.write,i.queue(e,i.createRecord(e,{type:i.ContentType.handshake,data:i.createFinished(e)})),e.expect=v,i.flush(e),e.process()};if(null===t.session.certificateRequest||null===t.session.clientCertificate)return l(t,null);i.getClientSignature(t,l)},i.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var r=e.entity===i.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=i.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?d:y,e.process()},i.handleFinished=function(r,a,n){var o=a.fragment;o.read-=4;var l=o.bytes();o.read+=4;var s=a.fragment.getBytes();(o=e.util.createBuffer()).putBuffer(r.session.md5.digest()),o.putBuffer(r.session.sha1.digest());var c=r.entity===i.ConnectionEnd.client,u=c?"server finished":"client finished",v=r.session.sp;if((o=t(v.master_secret,u,o.getBytes(),12)).getBytes()!==s)return r.error(r,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decrypt_error}});r.session.md5.update(l),r.session.sha1.update(l),(r.session.resuming&&c||!r.session.resuming&&!c)&&(i.queue(r,i.createRecord(r,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),r.state.current.write=r.state.pending.write,r.state.pending=null,i.queue(r,i.createRecord(r,{type:i.ContentType.handshake,data:i.createFinished(r)}))),r.expect=c?p:w,r.handshaking=!1,++r.handshakes,r.peerCertificate=c?r.session.serverCertificate:r.session.clientCertificate,i.flush(r),r.isConnected=!0,r.connected(r),r.process()},i.handleAlert=function(e,t){var r,a=t.fragment,n={level:a.getByte(),description:a.getByte()};switch(n.description){case i.Alert.Description.close_notify:r="Connection closed.";break;case i.Alert.Description.unexpected_message:r="Unexpected message.";break;case i.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case i.Alert.Description.decryption_failed:r="Decryption failed.";break;case i.Alert.Description.record_overflow:r="Record overflow.";break;case i.Alert.Description.decompression_failure:r="Decompression failed.";break;case i.Alert.Description.handshake_failure:r="Handshake failure.";break;case i.Alert.Description.bad_certificate:r="Bad certificate.";break;case i.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case i.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case i.Alert.Description.certificate_expired:r="Certificate expired.";break;case i.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case i.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case i.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case i.Alert.Description.access_denied:r="Access denied.";break;case i.Alert.Description.decode_error:r="Decode error.";break;case i.Alert.Description.decrypt_error:r="Decrypt error.";break;case i.Alert.Description.export_restriction:r="Export restriction.";break;case i.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case i.Alert.Description.insufficient_security:r="Insufficient security.";break;case i.Alert.Description.internal_error:r="Internal error.";break;case i.Alert.Description.user_canceled:r="User canceled.";break;case i.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(n.description===i.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===i.ConnectionEnd.client?"server":"client",alert:n}),e.process()},i.handleHandshake=function(t,r){var a=r.fragment,n=a.getByte(),o=a.getInt24();if(o>a.length())return t.fragmented=r,r.fragment=e.util.createBuffer(),a.read-=4,t.process();t.fragmented=null,a.read-=4;var l=a.bytes(o+4);a.read+=4,n in L[t.entity][t.expect]?(t.entity!==i.ConnectionEnd.server||t.open||t.fail||(t.handshaking=!0,t.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:e.md.md5.create(),sha1:e.md.sha1.create()}),n!==i.HandshakeType.hello_request&&n!==i.HandshakeType.certificate_verify&&n!==i.HandshakeType.finished&&(t.session.md5.update(l),t.session.sha1.update(l)),L[t.entity][t.expect][n](t,r,o)):i.handleUnexpected(t,r)},i.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},i.handleHeartbeat=function(t,r){var a=r.fragment,n=a.getByte(),o=a.getInt16(),l=a.getBytes(o);if(n===i.HeartbeatMessageType.heartbeat_request){if(t.handshaking||o>l.length)return t.process();i.queue(t,i.createRecord(t,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_response,l)})),i.flush(t)}else if(n===i.HeartbeatMessageType.heartbeat_response){if(l!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,e.util.createBuffer(l))}t.process()};var l=1,s=2,c=3,u=4,v=5,d=6,p=7,f=8,h=1,g=2,m=3,b=4,y=5,w=6,_=i.handleUnexpected,x=i.handleChangeCipherSpec,C=i.handleAlert,E=i.handleHandshake,S=i.handleApplicationData,k=i.handleHeartbeat,A=[];A[i.ConnectionEnd.client]=[[_,C,E,_,k],[_,C,E,_,k],[_,C,E,_,k],[_,C,E,_,k],[_,C,E,_,k],[x,C,_,_,k],[_,C,E,_,k],[_,C,E,S,k],[_,C,E,_,k]],A[i.ConnectionEnd.server]=[[_,C,E,_,k],[_,C,E,_,k],[_,C,E,_,k],[_,C,E,_,k],[x,C,_,_,k],[_,C,E,_,k],[_,C,E,S,k],[_,C,E,_,k]];var T=i.handleHelloRequest,I=i.handleServerHello,B=i.handleCertificate,N=i.handleServerKeyExchange,z=i.handleCertificateRequest,R=i.handleServerHelloDone,D=i.handleFinished,L=[];L[i.ConnectionEnd.client]=[[_,_,I,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[T,_,_,_,_,_,_,_,_,_,_,B,N,z,R,_,_,_,_,_,_],[T,_,_,_,_,_,_,_,_,_,_,_,N,z,R,_,_,_,_,_,_],[T,_,_,_,_,_,_,_,_,_,_,_,_,z,R,_,_,_,_,_,_],[T,_,_,_,_,_,_,_,_,_,_,_,_,_,R,_,_,_,_,_,_],[T,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[T,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,D],[T,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[T,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_]];var U=i.handleClientHello,P=i.handleClientKeyExchange,V=i.handleCertificateVerify;L[i.ConnectionEnd.server]=[[_,U,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,B,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,P,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,V,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,D],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_]],i.generateKeys=function(e,r){var a=t,n=r.client_random+r.server_random;e.session.resuming||(r.master_secret=a(r.pre_master_secret,"master secret",n,48).bytes(),r.pre_master_secret=null),n=r.server_random+r.client_random;var o=2*r.mac_key_length+2*r.enc_key_length,l=e.version.major===i.Versions.TLS_1_0.major&&e.version.minor===i.Versions.TLS_1_0.minor;l&&(o+=2*r.fixed_iv_length);var s=a(r.master_secret,"key expansion",n,o),c={client_write_MAC_key:s.getBytes(r.mac_key_length),server_write_MAC_key:s.getBytes(r.mac_key_length),client_write_key:s.getBytes(r.enc_key_length),server_write_key:s.getBytes(r.enc_key_length)};return l&&(c.client_write_IV=s.getBytes(r.fixed_iv_length),c.server_write_IV=s.getBytes(r.fixed_iv_length)),c},i.createConnectionState=function(e){var t=e.entity===i.ConnectionEnd.client,n=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},o={read:n(),write:n()};if(o.read.update=function(e,t){return o.read.cipherFunction(t,o.read)?o.read.compressFunction(e,t,o.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_record_mac}}),!e.fail},o.write.update=function(e,t){return o.write.compressFunction(e,t,o.write)?o.write.cipherFunction(t,o.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}),!e.fail},e.session){var l=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(l),l.keys=i.generateKeys(e,l),o.read.macKey=t?l.keys.server_write_MAC_key:l.keys.client_write_MAC_key,o.write.macKey=t?l.keys.client_write_MAC_key:l.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(o,e,l),l.compression_algorithm){case i.CompressionMethod.none:break;case i.CompressionMethod.deflate:o.read.compressFunction=a,o.write.compressFunction=r;break;default:throw new Error("Unsupported compression algorithm.")}}return o},i.createRandom=function(){var t=new Date,r=+t+6e4*t.getTimezoneOffset(),a=e.util.createBuffer();return a.putInt32(r),a.putBytes(e.random.getBytes(28)),a},i.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},i.createAlert=function(t,r){var a=e.util.createBuffer();return a.putByte(r.level),a.putByte(r.description),i.createRecord(t,{type:i.ContentType.alert,data:a})},i.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var r=e.util.createBuffer(),a=0;a<t.cipherSuites.length;++a){var n=t.cipherSuites[a];r.putByte(n.id[0]),r.putByte(n.id[1])}var l=r.length(),s=e.util.createBuffer();s.putByte(i.CompressionMethod.none);var c=s.length(),u=e.util.createBuffer();if(t.virtualHost){var v=e.util.createBuffer();v.putByte(0),v.putByte(0);var d=e.util.createBuffer();d.putByte(0),o(d,2,e.util.createBuffer(t.virtualHost));var p=e.util.createBuffer();o(p,2,d),o(v,2,p),u.putBuffer(v)}var f=u.length();f>0&&(f+=2);var h=t.session.id,g=h.length+1+2+4+28+2+l+1+c+f,m=e.util.createBuffer();return m.putByte(i.HandshakeType.client_hello),m.putInt24(g),m.putByte(t.version.major),m.putByte(t.version.minor),m.putBytes(t.session.sp.client_random),o(m,1,e.util.createBuffer(h)),o(m,2,r),o(m,1,s),f>0&&o(m,2,u),m},i.createServerHello=function(t){var r=t.session.id,a=r.length+1+2+4+28+2+1,n=e.util.createBuffer();return n.putByte(i.HandshakeType.server_hello),n.putInt24(a),n.putByte(t.version.major),n.putByte(t.version.minor),n.putBytes(t.session.sp.server_random),o(n,1,e.util.createBuffer(r)),n.putByte(t.session.cipherSuite.id[0]),n.putByte(t.session.cipherSuite.id[1]),n.putByte(t.session.compressionMethod),n},i.createCertificate=function(t){var r,a=t.entity===i.ConnectionEnd.client,n=null;t.getCertificate&&(r=a?t.session.certificateRequest:t.session.extensions.server_name.serverNameList,n=t.getCertificate(t,r));var l=e.util.createBuffer();if(null!==n)try{e.util.isArray(n)||(n=[n]);for(var s=null,c=0;c<n.length;++c){var u=e.pem.decode(n[c])[0];if("CERTIFICATE"!==u.type&&"X509 CERTIFICATE"!==u.type&&"TRUSTED CERTIFICATE"!==u.type){var v=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw v.headerType=u.type,v}if(u.procType&&"ENCRYPTED"===u.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var d=e.util.createBuffer(u.body);null===s&&(s=e.asn1.fromDer(d.bytes(),!1));var p=e.util.createBuffer();o(p,3,d),l.putBuffer(p)}n=e.pki.certificateFromAsn1(s),a?t.session.clientCertificate=n:t.session.serverCertificate=n}catch(g){return t.error(t,{message:"Could not send certificate list.",cause:g,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var f=3+l.length(),h=e.util.createBuffer();return h.putByte(i.HandshakeType.certificate),h.putInt24(f),o(h,3,l),h},i.createClientKeyExchange=function(t){var r=e.util.createBuffer();r.putByte(t.session.clientHelloVersion.major),r.putByte(t.session.clientHelloVersion.minor),r.putBytes(e.random.getBytes(46));var a=t.session.sp;a.pre_master_secret=r.getBytes();var n=(r=t.session.serverCertificate.publicKey.encrypt(a.pre_master_secret)).length+2,o=e.util.createBuffer();return o.putByte(i.HandshakeType.client_key_exchange),o.putInt24(n),o.putInt16(r.length),o.putBytes(r),o},i.createServerKeyExchange=function(t){return e.util.createBuffer()},i.getClientSignature=function(t,r){var a=e.util.createBuffer();a.putBuffer(t.session.md5.digest()),a.putBuffer(t.session.sha1.digest()),a=a.getBytes(),t.getSignature=t.getSignature||function(t,r,a){var n=null;if(t.getPrivateKey)try{n=t.getPrivateKey(t,t.session.clientCertificate),n=e.pki.privateKeyFromPem(n)}catch(o){t.error(t,{message:"Could not get private key.",cause:o,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}null===n?t.error(t,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}):r=n.sign(r,null),a(t,r)},t.getSignature(t,a,r)},i.createCertificateVerify=function(t,r){var a=r.length+2,n=e.util.createBuffer();return n.putByte(i.HandshakeType.certificate_verify),n.putInt24(a),n.putInt16(r.length),n.putBytes(r),n},i.createCertificateRequest=function(t){var r=e.util.createBuffer();r.putByte(1);var a=e.util.createBuffer();for(var n in t.caStore.certs){var l=t.caStore.certs[n],s=e.pki.distinguishedNameToAsn1(l.subject),c=e.asn1.toDer(s);a.putInt16(c.length()),a.putBuffer(c)}var u=1+r.length()+2+a.length(),v=e.util.createBuffer();return v.putByte(i.HandshakeType.certificate_request),v.putInt24(u),o(v,1,r),o(v,2,a),v},i.createServerHelloDone=function(t){var r=e.util.createBuffer();return r.putByte(i.HandshakeType.server_hello_done),r.putInt24(0),r},i.createChangeCipherSpec=function(){var t=e.util.createBuffer();return t.putByte(1),t},i.createFinished=function(r){var a=e.util.createBuffer();a.putBuffer(r.session.md5.digest()),a.putBuffer(r.session.sha1.digest());var n=r.entity===i.ConnectionEnd.client,o=r.session.sp,l=n?"client finished":"server finished";a=t(o.master_secret,l,a.getBytes(),12);var s=e.util.createBuffer();return s.putByte(i.HandshakeType.finished),s.putInt24(a.length()),s.putBuffer(a),s},i.createHeartbeat=function(t,r,a){void 0===a&&(a=r.length);var n=e.util.createBuffer();n.putByte(t),n.putInt16(a),n.putBytes(r);var o=n.length(),i=Math.max(16,o-a-3);return n.putBytes(e.random.getBytes(i)),n},i.queue=function(t,r){if(r&&(0!==r.fragment.length()||r.type!==i.ContentType.handshake&&r.type!==i.ContentType.alert&&r.type!==i.ContentType.change_cipher_spec)){if(r.type===i.ContentType.handshake){var a=r.fragment.bytes();t.session.md5.update(a),t.session.sha1.update(a),a=null}var n;if(r.fragment.length()<=i.MaxFragment)n=[r];else{n=[];for(var o=r.fragment.bytes();o.length>i.MaxFragment;)n.push(i.createRecord(t,{type:r.type,data:e.util.createBuffer(o.slice(0,i.MaxFragment))})),o=o.slice(i.MaxFragment);o.length>0&&n.push(i.createRecord(t,{type:r.type,data:e.util.createBuffer(o)}))}for(var l=0;l<n.length&&!t.fail;++l){var s=n[l];t.state.current.write.update(t,s)&&t.records.push(s)}}},i.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var M=function(t){switch(t){case!0:return!0;case e.pki.certificateError.bad_certificate:return i.Alert.Description.bad_certificate;case e.pki.certificateError.unsupported_certificate:return i.Alert.Description.unsupported_certificate;case e.pki.certificateError.certificate_revoked:return i.Alert.Description.certificate_revoked;case e.pki.certificateError.certificate_expired:return i.Alert.Description.certificate_expired;case e.pki.certificateError.certificate_unknown:return i.Alert.Description.certificate_unknown;case e.pki.certificateError.unknown_ca:return i.Alert.Description.unknown_ca;default:return i.Alert.Description.bad_certificate}};for(var O in i.verifyCertificateChain=function(t,r){try{var a={};for(var n in t.verifyOptions)a[n]=t.verifyOptions[n];a.verify=function(r,a,n){M(r);var o=t.verify(t,r,a,n);if(!0!==o){if("object"==typeof o&&!e.util.isArray(o)){var l=new Error("The application rejected the certificate.");throw l.send=!0,l.alert={level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate},o.message&&(l.message=o.message),o.alert&&(l.alert.description=o.alert),l}o!==r&&(o=function(t){switch(t){case!0:return!0;case i.Alert.Description.bad_certificate:return e.pki.certificateError.bad_certificate;case i.Alert.Description.unsupported_certificate:return e.pki.certificateError.unsupported_certificate;case i.Alert.Description.certificate_revoked:return e.pki.certificateError.certificate_revoked;case i.Alert.Description.certificate_expired:return e.pki.certificateError.certificate_expired;case i.Alert.Description.certificate_unknown:return e.pki.certificateError.certificate_unknown;case i.Alert.Description.unknown_ca:return e.pki.certificateError.unknown_ca;default:return e.pki.certificateError.bad_certificate}}(o))}return o},e.pki.verifyCertificateChain(t.caStore,r,a)}catch(l){var o=l;("object"!=typeof o||e.util.isArray(o))&&(o={send:!0,alert:{level:i.Alert.Level.fatal,description:M(l)}}),"send"in o||(o.send=!0),"alert"in o||(o.alert={level:i.Alert.Level.fatal,description:M(o.error)}),t.error(t,o)}return!t.fail},i.createSessionCache=function(t,r){var a=null;if(t&&t.getSession&&t.setSession&&t.order)a=t;else{for(var n in(a={}).cache=t||{},a.capacity=Math.max(r||100,1),a.order=[],t)a.order.length<=r?a.order.push(n):delete t[n];a.getSession=function(t){var r=null,n=null;if(t?n=e.util.bytesToHex(t):a.order.length>0&&(n=a.order[0]),null!==n&&n in a.cache)for(var o in r=a.cache[n],delete a.cache[n],a.order)if(a.order[o]===n){a.order.splice(o,1);break}return r},a.setSession=function(t,r){if(a.order.length===a.capacity){var n=a.order.shift();delete a.cache[n]}n=e.util.bytesToHex(t);a.order.push(n),a.cache[n]=r}}return a},i.createConnection=function(t){var r=null;r=t.caStore?e.util.isArray(t.caStore)?e.pki.createCaStore(t.caStore):t.caStore:e.pki.createCaStore();var a=t.cipherSuites||null;if(null===a)for(var n in a=[],i.CipherSuites)a.push(i.CipherSuites[n]);var o=t.server?i.ConnectionEnd.server:i.ConnectionEnd.client,l=t.sessionCache?i.createSessionCache(t.sessionCache):null,s={version:{major:i.Version.major,minor:i.Version.minor},entity:o,sessionId:t.sessionId,caStore:r,sessionCache:l,cipherSuites:a,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(e,t,r,a){return t},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:e.util.createBuffer(),tlsData:e.util.createBuffer(),data:e.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(e,r){r.origin=r.origin||(e.entity===i.ConnectionEnd.client?"client":"server"),r.send&&(i.queue(e,i.createAlert(e,r.alert)),i.flush(e));var a=!1!==r.fatal;a&&(e.fail=!0),t.error(e,r),a&&e.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null,reset:function(e){s.version={major:i.Version.major,minor:i.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,i.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(e||void 0===e),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=i.createConnectionState(s)}};s.reset();return s.handshake=function(t){if(s.entity!==i.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0;var r=null;(t=t||"").length>0&&(s.sessionCache&&(r=s.sessionCache.getSession(t)),null===r&&(t="")),0===t.length&&s.sessionCache&&null!==(r=s.sessionCache.getSession())&&(t=r.id),s.session={id:t,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:e.md.md5.create(),sha1:e.md.sha1.create()},r&&(s.version=r.version,s.session.sp=r.sp),s.session.sp.client_random=i.createRandom().getBytes(),s.open=!0,i.queue(s,i.createRecord(s,{type:i.ContentType.handshake,data:i.createClientHello(s)})),i.flush(s)}},s.process=function(t){var r,a,n,o,l=0;return t&&s.input.putBytes(t),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(l=function(t){var r=0,a=t.input,n=a.length();if(n<5)r=5-n;else{t.record={type:a.getByte(),version:{major:a.getByte(),minor:a.getByte()},length:a.getInt16(),fragment:e.util.createBuffer(),ready:!1};var o=t.record.version.major===t.version.major;o&&t.session&&t.session.version&&(o=t.record.version.minor===t.version.minor),o||t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}})}return r}(s)),s.fail||null===s.record||s.record.ready||(l=function(e){var t=0,r=e.input,a=r.length();return a<e.record.length?t=e.record.length-a:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(s)),!s.fail&&null!==s.record&&s.record.ready&&(r=s,a=s.record,n=a.type-i.ContentType.change_cipher_spec,o=A[r.entity][r.expect],n in o?o[n](r,a):i.handleUnexpected(r,a))),l},s.prepare=function(t){return i.queue(s,i.createRecord(s,{type:i.ContentType.application_data,data:e.util.createBuffer(t)})),i.flush(s)},s.prepareHeartbeatRequest=function(t,r){return t instanceof e.util.ByteBuffer&&(t=t.bytes()),void 0===r&&(r=t.length),s.expectedHeartbeatPayload=t,i.queue(s,i.createRecord(s,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_request,t,r)})),i.flush(s)},s.close=function(e){if(!s.fail&&s.sessionCache&&s.session){var t={id:s.session.id,version:s.session.version,sp:s.session.sp};t.sp.keys=null,s.sessionCache.setSession(t.id,t)}s.open&&(s.open=!1,s.input.clear(),(s.isConnected||s.handshaking)&&(s.isConnected=s.handshaking=!1,i.queue(s,i.createAlert(s,{level:i.Alert.Level.warning,description:i.Alert.Description.close_notify})),i.flush(s)),s.closed(s)),s.reset(e)},s},Qi=e.tls=e.tls||{},i)"function"!=typeof i[O]&&(e.tls[O]=i[O]);return e.tls.prf_tls1=t,e.tls.hmac_sha1=function(t,r,a){var n=e.hmac.create();n.start("SHA1",t);var o=e.util.createBuffer();return o.putInt32(r[0]),o.putInt32(r[1]),o.putByte(a.type),o.putByte(a.version.major),o.putByte(a.version.minor),o.putInt16(a.length),o.putBytes(a.fragment.bytes()),n.update(o.getBytes()),n.digest().getBytes()},e.tls.createSessionCache=i.createSessionCache,e.tls.createConnection=i.createConnection,Qi}function ol(){if(Xi)return Lo.exports;Xi=1;var e=bo();zo(),nl();var t=Lo.exports=e.tls;function r(r,n,o){var l=n.entity===e.tls.ConnectionEnd.client;r.read.cipherState={init:!1,cipher:e.cipher.createDecipher("AES-CBC",l?o.keys.server_write_key:o.keys.client_write_key),iv:l?o.keys.server_write_IV:o.keys.client_write_IV},r.write.cipherState={init:!1,cipher:e.cipher.createCipher("AES-CBC",l?o.keys.client_write_key:o.keys.server_write_key),iv:l?o.keys.client_write_IV:o.keys.server_write_IV},r.read.cipherFunction=i,r.write.cipherFunction=a,r.read.macLength=r.write.macLength=o.mac_length,r.read.macFunction=r.write.macFunction=t.hmac_sha1}function a(r,a){var o,i=!1,l=a.macFunction(a.macKey,a.sequenceNumber,r);r.fragment.putBytes(l),a.updateSequenceNumber(),o=r.version.minor===t.Versions.TLS_1_0.minor?a.cipherState.init?null:a.cipherState.iv:e.random.getBytesSync(16),a.cipherState.init=!0;var s=a.cipherState.cipher;return s.start({iv:o}),r.version.minor>=t.Versions.TLS_1_1.minor&&s.output.putBytes(o),s.update(r.fragment),s.finish(n)&&(r.fragment=s.output,r.length=r.fragment.length(),i=!0),i}function n(e,t,r){if(!r){var a=e-t.length()%e;t.fillWithByte(a-1,a)}return!0}function o(e,t,r){var a=!0;if(r){for(var n=t.length(),o=t.last(),i=n-1-o;i<n-1;++i)a=a&&t.at(i)==o;a&&t.truncate(o+1)}return a}function i(r,a){var n,i=!1;n=r.version.minor===t.Versions.TLS_1_0.minor?a.cipherState.init?null:a.cipherState.iv:r.fragment.getBytes(16),a.cipherState.init=!0;var l=a.cipherState.cipher;l.start({iv:n}),l.update(r.fragment),i=l.finish(o);var s=a.macLength,c=e.random.getBytesSync(s),u=l.output.length();u>=s?(r.fragment=l.output.getBytes(u-s),c=l.output.getBytes(s)):r.fragment=l.output.getBytes(),r.fragment=e.util.createBuffer(r.fragment),r.length=r.fragment.length();var v=a.macFunction(a.macKey,a.sequenceNumber,r);return a.updateSequenceNumber(),i=function(t,r,a){var n=e.hmac.create();return n.start("SHA1",t),n.update(r),r=n.digest().getBytes(),n.start(null,null),n.update(a),a=n.digest().getBytes(),r===a}(a.macKey,c,v)&&i,i}return t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},Lo.exports}var il,ll={exports:{}};function sl(){if(il)return ll.exports;il=1;var e=bo();Ko(),So();var t=ll.exports=e.sha512=e.sha512||{};e.md.sha512=e.md.algorithms.sha512=t;var r=e.sha384=e.sha512.sha384=e.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},e.md.sha384=e.md.algorithms.sha384=r,e.sha512.sha256=e.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},e.md["sha512/256"]=e.md.algorithms["sha512/256"]=e.sha512.sha256,e.sha512.sha224=e.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},e.md["sha512/224"]=e.md.algorithms["sha512/224"]=e.sha512.sha224,t.create=function(t){if(n||(a=String.fromCharCode(128),a+=e.util.fillString(String.fromCharCode(0),128),o=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(i={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],i["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],i["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],i["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],n=!0),void 0===t&&(t="SHA-512"),!(t in i))throw new Error("Invalid SHA-512 algorithm: "+t);for(var r=i[t],s=null,c=e.util.createBuffer(),u=new Array(80),v=0;v<80;++v)u[v]=new Array(2);var d=64;switch(t){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var p={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){p.messageLength=0,p.fullMessageLength=p.messageLength128=[];for(var t=p.messageLengthSize/4,a=0;a<t;++a)p.fullMessageLength.push(0);c=e.util.createBuffer(),s=new Array(r.length);for(a=0;a<r.length;++a)s[a]=r[a].slice(0);return p}};return p.start(),p.update=function(t,r){"utf8"===r&&(t=e.util.encodeUtf8(t));var a=t.length;p.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var n=p.fullMessageLength.length-1;n>=0;--n)p.fullMessageLength[n]+=a[1],a[1]=a[0]+(p.fullMessageLength[n]/4294967296>>>0),p.fullMessageLength[n]=p.fullMessageLength[n]>>>0,a[0]=a[1]/4294967296>>>0;return c.putBytes(t),l(s,u,c),(c.read>2048||0===c.length())&&c.compact(),p},p.digest=function(){var r=e.util.createBuffer();r.putBytes(c.bytes());var n,o=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1;r.putBytes(a.substr(0,p.blockLength-o));for(var i=8*p.fullMessageLength[0],v=0;v<p.fullMessageLength.length-1;++v)i+=(n=8*p.fullMessageLength[v+1])/4294967296>>>0,r.putInt32(i>>>0),i=n>>>0;r.putInt32(i);var d=new Array(s.length);for(v=0;v<s.length;++v)d[v]=s[v].slice(0);l(d,u,r);var f,h=e.util.createBuffer();f="SHA-512"===t?d.length:"SHA-384"===t?d.length-2:d.length-4;for(v=0;v<f;++v)h.putInt32(d[v][0]),v===f-1&&"SHA-512/224"===t||h.putInt32(d[v][1]);return h},p};var a=null,n=!1,o=null,i=null;function l(e,t,r){for(var a,n,i,l,s,c,u,v,d,p,f,h,g,m,b,y,w,_,x,C,E,S,k,A,T,I,B,N,z,R,D,L,U,P=r.length();P>=128;){for(B=0;B<16;++B)t[B][0]=r.getInt32()>>>0,t[B][1]=r.getInt32()>>>0;for(;B<80;++B)a=(((N=(R=t[B-2])[0])>>>19|(z=R[1])<<13)^(z>>>29|N<<3)^N>>>6)>>>0,n=((N<<13|z>>>19)^(z<<3|N>>>29)^(N<<26|z>>>6))>>>0,i=(((N=(L=t[B-15])[0])>>>1|(z=L[1])<<31)^(N>>>8|z<<24)^N>>>7)>>>0,l=((N<<31|z>>>1)^(N<<24|z>>>8)^(N<<25|z>>>7))>>>0,D=t[B-7],U=t[B-16],z=n+D[1]+l+U[1],t[B][0]=a+D[0]+i+U[0]+(z/4294967296>>>0)>>>0,t[B][1]=z>>>0;for(f=e[0][0],h=e[0][1],g=e[1][0],m=e[1][1],b=e[2][0],y=e[2][1],w=e[3][0],_=e[3][1],x=e[4][0],C=e[4][1],E=e[5][0],S=e[5][1],k=e[6][0],A=e[6][1],T=e[7][0],I=e[7][1],B=0;B<80;++B)u=((x>>>14|C<<18)^(x>>>18|C<<14)^(C>>>9|x<<23))>>>0,v=(k^x&(E^k))>>>0,s=((f>>>28|h<<4)^(h>>>2|f<<30)^(h>>>7|f<<25))>>>0,c=((f<<4|h>>>28)^(h<<30|f>>>2)^(h<<25|f>>>7))>>>0,d=(f&g|b&(f^g))>>>0,p=(h&m|y&(h^m))>>>0,z=I+(((x<<18|C>>>14)^(x<<14|C>>>18)^(C<<23|x>>>9))>>>0)+((A^C&(S^A))>>>0)+o[B][1]+t[B][1],a=T+u+v+o[B][0]+t[B][0]+(z/4294967296>>>0)>>>0,n=z>>>0,i=s+d+((z=c+p)/4294967296>>>0)>>>0,l=z>>>0,T=k,I=A,k=E,A=S,E=x,S=C,x=w+a+((z=_+n)/4294967296>>>0)>>>0,C=z>>>0,w=b,_=y,b=g,y=m,g=f,m=h,f=a+i+((z=n+l)/4294967296>>>0)>>>0,h=z>>>0;z=e[0][1]+h,e[0][0]=e[0][0]+f+(z/4294967296>>>0)>>>0,e[0][1]=z>>>0,z=e[1][1]+m,e[1][0]=e[1][0]+g+(z/4294967296>>>0)>>>0,e[1][1]=z>>>0,z=e[2][1]+y,e[2][0]=e[2][0]+b+(z/4294967296>>>0)>>>0,e[2][1]=z>>>0,z=e[3][1]+_,e[3][0]=e[3][0]+w+(z/4294967296>>>0)>>>0,e[3][1]=z>>>0,z=e[4][1]+C,e[4][0]=e[4][0]+x+(z/4294967296>>>0)>>>0,e[4][1]=z>>>0,z=e[5][1]+S,e[5][0]=e[5][0]+E+(z/4294967296>>>0)>>>0,e[5][1]=z>>>0,z=e[6][1]+A,e[6][0]=e[6][0]+k+(z/4294967296>>>0)>>>0,e[6][1]=z>>>0,z=e[7][1]+I,e[7][0]=e[7][0]+T+(z/4294967296>>>0)>>>0,e[7][1]=z>>>0,P-=128}}return ll.exports}var cl,ul,vl,dl,pl,fl,hl,gl,ml={};function bl(){if(vl)return ul;vl=1;var e=bo();wi(),bi(),sl(),So();var t=function(){if(cl)return ml;cl=1;var e=bo();Mo();var t=e.asn1;return ml.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},ml.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},ml}(),r=t.publicKeyValidator,a=t.privateKeyValidator;if(void 0===n)var n=e.jsbn.BigInteger;var o=e.util.ByteBuffer,i="undefined"==typeof Buffer?Uint8Array:Buffer;e.pki=e.pki||{},ul=e.pki.ed25519=e.ed25519=e.ed25519||{};var l=e.ed25519;function s(e){var t=e.message;if(t instanceof Uint8Array||t instanceof i)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new o(t,r)}else if(!(t instanceof o))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var a=new i(t.length()),n=0;n<a.length;++n)a[n]=t.at(n);return a}l.constants={},l.constants.PUBLIC_KEY_BYTE_LENGTH=32,l.constants.PRIVATE_KEY_BYTE_LENGTH=64,l.constants.SEED_BYTE_LENGTH=32,l.constants.SIGN_BYTE_LENGTH=64,l.constants.HASH_BYTE_LENGTH=64,l.generateKeyPair=function(t){var r=(t=t||{}).seed;if(void 0===r)r=e.random.getBytesSync(l.constants.SEED_BYTE_LENGTH);else if("string"==typeof r){if(r.length!==l.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+l.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(r instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');r=s({message:r,encoding:"binary"});for(var a=new i(l.constants.PUBLIC_KEY_BYTE_LENGTH),n=new i(l.constants.PRIVATE_KEY_BYTE_LENGTH),o=0;o<32;++o)n[o]=r[o];return function(e,t){var r,a=[z(),z(),z(),z()],n=m(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,T(a,n),x(e,a),r=0;r<32;++r)t[r+32]=e[r]}(a,n),{publicKey:a,privateKey:n}},l.privateKeyFromAsn1=function(t){var r={},n=[];if(!e.asn1.validate(t,a,r,n)){var o=new Error("Invalid Key.");throw o.errors=n,o}var i=e.asn1.derToOid(r.privateKeyOid),l=e.oids.EdDSA25519;if(i!==l)throw new Error('Invalid OID "'+i+'"; OID must be "'+l+'".');var c=r.privateKey;return{privateKeyBytes:s({message:e.asn1.fromDer(c).value,encoding:"binary"})}},l.publicKeyFromAsn1=function(t){var a={},n=[];if(!e.asn1.validate(t,r,a,n)){var o=new Error("Invalid Key.");throw o.errors=n,o}var i=e.asn1.derToOid(a.publicKeyOid),c=e.oids.EdDSA25519;if(i!==c)throw new Error('Invalid OID "'+i+'"; OID must be "'+c+'".');var u=a.ed25519PublicKey;if(u.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return s({message:u,encoding:"binary"})},l.publicKeyFromPrivateKey=function(e){var t=s({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new i(l.constants.PUBLIC_KEY_BYTE_LENGTH),a=0;a<r.length;++a)r[a]=t[32+a];return r},l.sign=function(e){var t=s(e=e||{}),r=s({message:e.privateKey,encoding:"binary"});if(r.length===l.constants.SEED_BYTE_LENGTH)r=l.generateKeyPair({seed:r}).privateKey;else if(r.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.SEED_BYTE_LENGTH+" or "+l.constants.PRIVATE_KEY_BYTE_LENGTH);var a=new i(l.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,a){var n,o,i=new Float64Array(64),l=[z(),z(),z(),z()],s=m(a,32);s[0]&=248,s[31]&=127,s[31]|=64;var c=r+64;for(n=0;n<r;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=s[32+n];var u=m(e.subarray(32),r+32);for(y(u),T(l,u),x(e,l),n=32;n<64;++n)e[n]=a[n];var v=m(e,r+64);for(y(v),n=32;n<64;++n)i[n]=0;for(n=0;n<32;++n)i[n]=u[n];for(n=0;n<32;++n)for(o=0;o<32;o++)i[n+o]+=v[n]*s[o];b(e.subarray(32),i)}(a,t,t.length,r);for(var n=new i(l.constants.SIGN_BYTE_LENGTH),o=0;o<n.length;++o)n[o]=a[o];return n},l.verify=function(e){var t=s(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=s({message:e.signature,encoding:"binary"});if(r.length!==l.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+l.constants.SIGN_BYTE_LENGTH);var a=s({message:e.publicKey,encoding:"binary"});if(a.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+l.constants.PUBLIC_KEY_BYTE_LENGTH);var n,o=new i(l.constants.SIGN_BYTE_LENGTH+t.length),d=new i(l.constants.SIGN_BYTE_LENGTH+t.length);for(n=0;n<l.constants.SIGN_BYTE_LENGTH;++n)o[n]=r[n];for(n=0;n<t.length;++n)o[n+l.constants.SIGN_BYTE_LENGTH]=t[n];return function(e,t,r,a){var n,o=new i(32),l=[z(),z(),z(),z()],s=[z(),z(),z(),z()];if(r<64)return-1;if(function(e,t){var r=z(),a=z(),n=z(),o=z(),i=z(),l=z(),s=z();I(e[2],u),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),L(n,e[1]),U(o,n,v),D(n,n,e[2]),R(o,e[2],o),L(i,o),L(l,i),U(s,l,i),U(r,s,n),U(r,r,o),function(e,t){var r,a=z();for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)L(a,a),1!==r&&U(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(r,r),U(r,r,n),U(r,r,o),U(r,r,o),U(e[0],r,o),L(a,e[0]),U(a,a,o),E(a,n)&&U(e[0],e[0],g);if(L(a,e[0]),U(a,a,o),E(a,n))return-1;k(e[0])===t[31]>>7&&D(e[0],c,e[0]);return U(e[3],e[0],e[1]),0}(s,a))return-1;for(n=0;n<r;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=a[n];var d=m(e,r);if(y(d),A(l,s,d),T(s,t.subarray(32)),w(l,s),x(o,l),r-=64,S(t,0,o,0)){for(n=0;n<r;++n)e[n]=0;return-1}for(n=0;n<r;++n)e[n]=t[n+64];return r}(d,o,o.length,a)>=0};var c=z(),u=z([1]),v=z([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=z([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),p=z([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=z([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),h=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),g=z([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(t,r){var a=e.md.sha512.create(),n=new o(t);a.update(n.getBytes(r),"binary");var s=a.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(s,"binary");for(var c=new i(l.constants.HASH_BYTE_LENGTH),u=0;u<64;++u)c[u]=s.charCodeAt(u);return c}function b(e,t){var r,a,n,o;for(a=63;a>=32;--a){for(r=0,n=a-32,o=a-12;n<o;++n)t[n]+=r-16*t[a]*h[n-(a-32)],r=t[n]+128>>8,t[n]-=256*r;t[n]+=r,t[a]=0}for(r=0,n=0;n<32;++n)t[n]+=r-(t[31]>>4)*h[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=r*h[n];for(a=0;a<32;++a)t[a+1]+=t[a]>>8,e[a]=255&t[a]}function y(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;b(e,t)}function w(e,t){var r=z(),a=z(),n=z(),o=z(),i=z(),l=z(),s=z(),c=z(),u=z();D(r,e[1],e[0]),D(u,t[1],t[0]),U(r,r,u),R(a,e[0],e[1]),R(u,t[0],t[1]),U(a,a,u),U(n,e[3],t[3]),U(n,n,d),U(o,e[2],t[2]),R(o,o,o),D(i,a,r),D(l,o,n),R(s,o,n),R(c,a,r),U(e[0],i,l),U(e[1],c,s),U(e[2],s,l),U(e[3],i,c)}function _(e,t,r){for(var a=0;a<4;++a)N(e[a],t[a],r)}function x(e,t){var r=z(),a=z(),n=z();!function(e,t){var r,a=z();for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)L(a,a),2!==r&&4!==r&&U(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(n,t[2]),U(r,t[0],n),U(a,t[1],n),C(e,a),e[31]^=k(r)<<7}function C(e,t){var r,a,n,o=z(),i=z();for(r=0;r<16;++r)i[r]=t[r];for(B(i),B(i),B(i),a=0;a<2;++a){for(o[0]=i[0]-65517,r=1;r<15;++r)o[r]=i[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=i[15]-32767-(o[14]>>16&1),n=o[15]>>16&1,o[14]&=65535,N(i,o,1-n)}for(r=0;r<16;r++)e[2*r]=255&i[r],e[2*r+1]=i[r]>>8}function E(e,t){var r=new i(32),a=new i(32);return C(r,e),C(a,t),S(r,0,a,0)}function S(e,t,r,a){return function(e,t,r,a,n){var o,i=0;for(o=0;o<n;++o)i|=e[t+o]^r[a+o];return(1&i-1>>>8)-1}(e,t,r,a,32)}function k(e){var t=new i(32);return C(t,e),1&t[0]}function A(e,t,r){var a,n;for(I(e[0],c),I(e[1],u),I(e[2],u),I(e[3],c),n=255;n>=0;--n)_(e,t,a=r[n/8|0]>>(7&n)&1),w(t,e),w(e,e),_(e,t,a)}function T(e,t){var r=[z(),z(),z(),z()];I(r[0],p),I(r[1],f),I(r[2],u),U(r[3],p,f),A(e,r,t)}function I(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function B(e){var t,r,a=1;for(t=0;t<16;++t)r=e[t]+a+65535,a=Math.floor(r/65536),e[t]=r-65536*a;e[0]+=a-1+37*(a-1)}function N(e,t,r){for(var a,n=~(r-1),o=0;o<16;++o)a=n&(e[o]^t[o]),e[o]^=a,t[o]^=a}function z(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function R(e,t,r){for(var a=0;a<16;++a)e[a]=t[a]+r[a]}function D(e,t,r){for(var a=0;a<16;++a)e[a]=t[a]-r[a]}function L(e,t){U(e,t,t)}function U(e,t,r){var a,n,o=0,i=0,l=0,s=0,c=0,u=0,v=0,d=0,p=0,f=0,h=0,g=0,m=0,b=0,y=0,w=0,_=0,x=0,C=0,E=0,S=0,k=0,A=0,T=0,I=0,B=0,N=0,z=0,R=0,D=0,L=0,U=r[0],P=r[1],V=r[2],M=r[3],O=r[4],q=r[5],j=r[6],F=r[7],K=r[8],$=r[9],H=r[10],G=r[11],W=r[12],Y=r[13],Q=r[14],J=r[15];o+=(a=t[0])*U,i+=a*P,l+=a*V,s+=a*M,c+=a*O,u+=a*q,v+=a*j,d+=a*F,p+=a*K,f+=a*$,h+=a*H,g+=a*G,m+=a*W,b+=a*Y,y+=a*Q,w+=a*J,i+=(a=t[1])*U,l+=a*P,s+=a*V,c+=a*M,u+=a*O,v+=a*q,d+=a*j,p+=a*F,f+=a*K,h+=a*$,g+=a*H,m+=a*G,b+=a*W,y+=a*Y,w+=a*Q,_+=a*J,l+=(a=t[2])*U,s+=a*P,c+=a*V,u+=a*M,v+=a*O,d+=a*q,p+=a*j,f+=a*F,h+=a*K,g+=a*$,m+=a*H,b+=a*G,y+=a*W,w+=a*Y,_+=a*Q,x+=a*J,s+=(a=t[3])*U,c+=a*P,u+=a*V,v+=a*M,d+=a*O,p+=a*q,f+=a*j,h+=a*F,g+=a*K,m+=a*$,b+=a*H,y+=a*G,w+=a*W,_+=a*Y,x+=a*Q,C+=a*J,c+=(a=t[4])*U,u+=a*P,v+=a*V,d+=a*M,p+=a*O,f+=a*q,h+=a*j,g+=a*F,m+=a*K,b+=a*$,y+=a*H,w+=a*G,_+=a*W,x+=a*Y,C+=a*Q,E+=a*J,u+=(a=t[5])*U,v+=a*P,d+=a*V,p+=a*M,f+=a*O,h+=a*q,g+=a*j,m+=a*F,b+=a*K,y+=a*$,w+=a*H,_+=a*G,x+=a*W,C+=a*Y,E+=a*Q,S+=a*J,v+=(a=t[6])*U,d+=a*P,p+=a*V,f+=a*M,h+=a*O,g+=a*q,m+=a*j,b+=a*F,y+=a*K,w+=a*$,_+=a*H,x+=a*G,C+=a*W,E+=a*Y,S+=a*Q,k+=a*J,d+=(a=t[7])*U,p+=a*P,f+=a*V,h+=a*M,g+=a*O,m+=a*q,b+=a*j,y+=a*F,w+=a*K,_+=a*$,x+=a*H,C+=a*G,E+=a*W,S+=a*Y,k+=a*Q,A+=a*J,p+=(a=t[8])*U,f+=a*P,h+=a*V,g+=a*M,m+=a*O,b+=a*q,y+=a*j,w+=a*F,_+=a*K,x+=a*$,C+=a*H,E+=a*G,S+=a*W,k+=a*Y,A+=a*Q,T+=a*J,f+=(a=t[9])*U,h+=a*P,g+=a*V,m+=a*M,b+=a*O,y+=a*q,w+=a*j,_+=a*F,x+=a*K,C+=a*$,E+=a*H,S+=a*G,k+=a*W,A+=a*Y,T+=a*Q,I+=a*J,h+=(a=t[10])*U,g+=a*P,m+=a*V,b+=a*M,y+=a*O,w+=a*q,_+=a*j,x+=a*F,C+=a*K,E+=a*$,S+=a*H,k+=a*G,A+=a*W,T+=a*Y,I+=a*Q,B+=a*J,g+=(a=t[11])*U,m+=a*P,b+=a*V,y+=a*M,w+=a*O,_+=a*q,x+=a*j,C+=a*F,E+=a*K,S+=a*$,k+=a*H,A+=a*G,T+=a*W,I+=a*Y,B+=a*Q,N+=a*J,m+=(a=t[12])*U,b+=a*P,y+=a*V,w+=a*M,_+=a*O,x+=a*q,C+=a*j,E+=a*F,S+=a*K,k+=a*$,A+=a*H,T+=a*G,I+=a*W,B+=a*Y,N+=a*Q,z+=a*J,b+=(a=t[13])*U,y+=a*P,w+=a*V,_+=a*M,x+=a*O,C+=a*q,E+=a*j,S+=a*F,k+=a*K,A+=a*$,T+=a*H,I+=a*G,B+=a*W,N+=a*Y,z+=a*Q,R+=a*J,y+=(a=t[14])*U,w+=a*P,_+=a*V,x+=a*M,C+=a*O,E+=a*q,S+=a*j,k+=a*F,A+=a*K,T+=a*$,I+=a*H,B+=a*G,N+=a*W,z+=a*Y,R+=a*Q,D+=a*J,w+=(a=t[15])*U,i+=38*(x+=a*V),l+=38*(C+=a*M),s+=38*(E+=a*O),c+=38*(S+=a*q),u+=38*(k+=a*j),v+=38*(A+=a*F),d+=38*(T+=a*K),p+=38*(I+=a*$),f+=38*(B+=a*H),h+=38*(N+=a*G),g+=38*(z+=a*W),m+=38*(R+=a*Y),b+=38*(D+=a*Q),y+=38*(L+=a*J),o=(a=(o+=38*(_+=a*P))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),i=(a=i+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),v=(a=v+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),f=(a=f+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),w=(a=w+n+65535)-65536*(n=Math.floor(a/65536)),o=(a=(o+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),i=(a=i+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),v=(a=v+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),f=(a=f+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),w=(a=w+n+65535)-65536*(n=Math.floor(a/65536)),o+=n-1+37*(n-1),e[0]=o,e[1]=i,e[2]=l,e[3]=s,e[4]=c,e[5]=u,e[6]=v,e[7]=d,e[8]=p,e[9]=f,e[10]=h,e[11]=g,e[12]=m,e[13]=b,e[14]=y,e[15]=w}return ul}var yl,wl={exports:{}};function _l(){if(yl)return wl.exports;yl=1;var e=bo();zo(),Mo(),ti(),Vo(),Jo(),Mi(),bi(),So(),tl();var t=e.asn1,r=wl.exports=e.pkcs7=e.pkcs7||{};function a(a){var n={},o=[];if(!t.validate(a,r.asn1.recipientInfoValidator,n,o)){var i=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw i.errors=o,i}return{version:n.version.charCodeAt(0),issuer:e.pki.RDNAttributesAsArray(n.issuer),serialNumber:e.util.createBuffer(n.serial).toHex(),encryptedContent:{algorithm:t.derToOid(n.encAlgorithm),parameter:n.encParameter?n.encParameter.value:void 0,content:n.encKey}}}function n(r){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.encryptedContent.content)])}function o(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}function i(r){var a=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(r.authenticatedAttributesAsn1&&a.value.push(r.authenticatedAttributesAsn1),a.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),a.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.signature)),r.unauthenticatedAttributes.length>0){for(var n=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o<r.unauthenticatedAttributes.length;++o){var i=r.unauthenticatedAttributes[o];n.values.push(l(i))}a.value.push(n)}return a}function l(r){var a;if(r.type===e.pki.oids.contentType)a=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.value).getBytes());else if(r.type===e.pki.oids.messageDigest)a=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.value.bytes());else if(r.type===e.pki.oids.signingTime){var n=new Date("1950-01-01T00:00:00Z"),o=new Date("2050-01-01T00:00:00Z"),i=r.value;if("string"==typeof i){var l=Date.parse(i);i=isNaN(l)?13===i.length?t.utcTimeToDate(i):t.generalizedTimeToDate(i):new Date(l)}a=i>=n&&i<o?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(i)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(i))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[a])])}function s(r,a,n){var o={};if(!t.validate(a,n,o,[])){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}if(t.derToOid(o.contentType)!==e.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var l="";if(e.util.isArray(o.encryptedContent))for(var s=0;s<o.encryptedContent.length;++s){if(o.encryptedContent[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");l+=o.encryptedContent[s].value}else l=o.encryptedContent;r.encryptedContent={algorithm:t.derToOid(o.encAlgorithm),parameter:e.util.createBuffer(o.encParameter.value),content:e.util.createBuffer(l)}}if(o.content){l="";if(e.util.isArray(o.content))for(s=0;s<o.content.length;++s){if(o.content[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");l+=o.content[s].value}else l=o.content;r.content=e.util.createBuffer(l)}return r.version=o.version.charCodeAt(0),r.rawCapture=o,o}function c(t){if(void 0===t.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===t.content){var r;switch(t.encryptedContent.algorithm){case e.pki.oids["aes128-CBC"]:case e.pki.oids["aes192-CBC"]:case e.pki.oids["aes256-CBC"]:r=e.aes.createDecryptionCipher(t.encryptedContent.key);break;case e.pki.oids.desCBC:case e.pki.oids["des-EDE3-CBC"]:r=e.des.createDecryptionCipher(t.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+t.encryptedContent.algorithm)}if(r.start(t.encryptedContent.parameter),r.update(t.encryptedContent.content),!r.finish())throw new Error("Symmetric decryption failed.");t.content=r.output}}return r.messageFromPem=function(a){var n=e.pem.decode(a)[0];if("PKCS7"!==n.type){var o=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var i=t.fromDer(n.body);return r.messageFromAsn1(i)},r.messageToPem=function(r,a){var n={type:"PKCS7",body:t.toDer(r.toAsn1()).getBytes()};return e.pem.encode(n,{maxline:a})},r.messageFromAsn1=function(a){var n={},o=[];if(!t.validate(a,r.asn1.contentInfoValidator,n,o)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw i.errors=o,i}var l,s=t.derToOid(n.contentType);switch(s){case e.pki.oids.envelopedData:l=r.createEnvelopedData();break;case e.pki.oids.encryptedData:l=r.createEncryptedData();break;case e.pki.oids.signedData:l=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return l.fromAsn1(n.content.value[0]),l},r.createSignedData=function(){var a=null;return a={type:e.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(s(a,t,r.asn1.signedDataValidator),a.certificates=[],a.crls=[],a.digestAlgorithmIdentifiers=[],a.contentInfo=null,a.signerInfos=[],a.rawCapture.certificates)for(var n=a.rawCapture.certificates.value,o=0;o<n.length;++o)a.certificates.push(e.pki.certificateFromAsn1(n[o]))},toAsn1:function(){a.contentInfo||a.sign();for(var r=[],n=0;n<a.certificates.length;++n)r.push(e.pki.certificateToAsn1(a.certificates[n]));var o=[],i=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(a.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,a.digestAlgorithmIdentifiers),a.contentInfo])]);return r.length>0&&i.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),o.length>0&&i.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,o)),i.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,a.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),i])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=e.pki.certificateFromPem(o)),r=o.issuer.attributes,n=o.serialNumber}var i=t.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=e.pki.privateKeyFromPem(i));var l=t.digestAlgorithm||e.pki.oids.sha1;switch(l){case e.pki.oids.sha1:case e.pki.oids.sha256:case e.pki.oids.sha384:case e.pki.oids.sha512:case e.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+l)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var c=!1,u=!1,v=0;v<s.length;++v){var d=s[v];if(c||d.type!==e.pki.oids.contentType){if(u||d.type!==e.pki.oids.messageDigest);else if(u=!0,c)break}else if(c=!0,u)break}if(!c||!u)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}a.signers.push({key:i,version:1,issuer:r,serialNumber:n,digestAlgorithm:l,signatureAlgorithm:e.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(r){var n;(r=r||{},"object"!=typeof a.content||null===a.contentInfo)&&(a.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes())]),"content"in a&&(a.content instanceof e.util.ByteBuffer?n=a.content.bytes():"string"==typeof a.content&&(n=e.util.encodeUtf8(a.content)),r.detached?a.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n):a.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)]))));0!==a.signers.length&&function(r){var n;n=a.detachedContent?a.detachedContent:(n=a.contentInfo.value[1]).value[0];if(!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var o=t.derToOid(a.contentInfo.value[0].value),s=t.toDer(n);for(var c in s.getByte(),t.getBerValueLength(s),s=s.getBytes(),r)r[c].start().update(s);for(var u=new Date,v=0;v<a.signers.length;++v){var d=a.signers[v];if(0===d.authenticatedAttributes.length){if(o!==e.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var p=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),f=0;f<d.authenticatedAttributes.length;++f){var h=d.authenticatedAttributes[f];h.type===e.pki.oids.messageDigest?h.value=r[d.digestAlgorithm].digest():h.type===e.pki.oids.signingTime&&(h.value||(h.value=u)),p.value.push(l(h)),d.authenticatedAttributesAsn1.value.push(l(h))}s=t.toDer(p).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}a.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(i(e[r]));return t}(a.signers)}(function(){for(var r={},n=0;n<a.signers.length;++n){var o=a.signers[n];(i=o.digestAlgorithm)in r||(r[i]=e.md[e.pki.oids[i]].create()),0===o.authenticatedAttributes.length?o.md=r[i]:o.md=e.md[e.pki.oids[i]].create()}for(var i in a.digestAlgorithmIdentifiers=[],r)a.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=e.pki.certificateFromPem(t)),a.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var t=null;return t={type:e.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){s(t,e,r.asn1.encryptedDataValidator)},decrypt:function(e){void 0!==e&&(t.encryptedContent.key=e),c(t)}}},r.createEnvelopedData=function(){var n=null;return n={type:e.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){var t=s(n,e,r.asn1.envelopedDataValidator);n.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}(t.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(n.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,o(n.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=n.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),r.parameter?t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes()):void 0]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(e){for(var t=e.issuer.attributes,r=0;r<n.recipients.length;++r){var a=n.recipients[r],o=a.issuer;if(a.serialNumber===e.serialNumber&&o.length===t.length){for(var i=!0,l=0;l<t.length;++l)if(o[l].type!==t[l].type||o[l].value!==t[l].value){i=!1;break}if(i)return a}}return null},decrypt:function(t,r){if(void 0===n.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case e.pki.oids.rsaEncryption:case e.pki.oids.desCBC:var a=r.decrypt(t.encryptedContent.content);n.encryptedContent.key=e.util.createBuffer(a);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(n)},addRecipient:function(t){n.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:e.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===n.encryptedContent.content){var a,o,i;switch(r=r||n.encryptedContent.algorithm,t=t||n.encryptedContent.key,r){case e.pki.oids["aes128-CBC"]:a=16,o=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["aes192-CBC"]:a=24,o=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["aes256-CBC"]:a=32,o=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["des-EDE3-CBC"]:a=24,o=8,i=e.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=e.util.createBuffer(e.random.getBytes(a));else if(t.length()!=a)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+a+".");n.encryptedContent.algorithm=r,n.encryptedContent.key=t,n.encryptedContent.parameter=e.util.createBuffer(e.random.getBytes(o));var l=i(t);if(l.start(n.encryptedContent.parameter.copy()),l.update(n.content),!l.finish())throw new Error("Symmetric encryption failed.");n.encryptedContent.content=l.output}for(var s=0;s<n.recipients.length;++s){var c=n.recipients[s];if(void 0===c.encryptedContent.content){if(c.encryptedContent.algorithm!==e.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);c.encryptedContent.content=c.encryptedContent.key.encrypt(n.encryptedContent.key.data)}}}}},wl.exports}var xl,Cl,El,Sl={exports:{}};var kl=(El||(El=1,Cl=bo(),zo(),ol(),Mo(),ko(),ti(),bl(),$o(),function(){if(pl)return dl;pl=1;var e=bo();So(),bi(),wi(),dl=e.kem=e.kem||{};var t=e.jsbn.BigInteger;function r(t,r,a,n){t.generate=function(t,o){for(var i=new e.util.ByteBuffer,l=Math.ceil(o/n)+a,s=new e.util.ByteBuffer,c=a;c<l;++c){s.putInt32(c),r.start(),r.update(t+s.getBytes());var u=r.digest();i.putBytes(u.getBytes(n))}return i.truncate(i.length()-o),i.getBytes()}}e.kem.rsa={},e.kem.rsa.create=function(r,a){var n=(a=a||{}).prng||e.random;return{encrypt:function(a,o){var i,l=Math.ceil(a.n.bitLength()/8);do{i=new t(e.util.bytesToHex(n.getBytesSync(l)),16).mod(a.n)}while(i.compareTo(t.ONE)<=0);var s=l-(i=e.util.hexToBytes(i.toString(16))).length;return s>0&&(i=e.util.fillString(String.fromCharCode(0),s)+i),{encapsulation:a.encrypt(i,"NONE"),key:r.generate(i,o)}},decrypt:function(e,t,a){var n=e.decrypt(t,"NONE");return r.generate(n,a)}}},e.kem.kdf1=function(e,t){r(this,e,0,t||e.digestLength)},e.kem.kdf2=function(e,t){r(this,e,1,t||e.digestLength)}}(),function(){if(hl)return fl;hl=1;var e=bo();So(),fl=e.log=e.log||{},e.log.levels=["none","error","warning","info","debug","verbose","max"];var t={},r=[],a=null;e.log.LEVEL_LOCKED=2,e.log.NO_LEVEL_CHECK=4,e.log.INTERPOLATE=8;for(var n=0;n<e.log.levels.length;++n){var o=e.log.levels[n];t[o]={index:n,name:o.toUpperCase()}}e.log.logMessage=function(a){for(var n=t[a.level].index,o=0;o<r.length;++o){var i=r[o];i.flags&e.log.NO_LEVEL_CHECK?i.f(a):n<=t[i.level].index&&i.f(i,a)}},e.log.prepareStandard=function(e){"standard"in e||(e.standard=t[e.level].name+" ["+e.category+"] "+e.message)},e.log.prepareFull=function(t){if(!("full"in t)){var r=[t.message];r=r.concat([]),t.full=e.util.format.apply(this,r)}},e.log.prepareStandardFull=function(t){"standardFull"in t||(e.log.prepareStandard(t),t.standardFull=t.standard)};var i=["error","warning","info","debug","verbose"];for(n=0;n<i.length;++n)(function(t){e.log[t]=function(r,a){var n=Array.prototype.slice.call(arguments).slice(2),o={timestamp:new Date,level:t,category:r,message:a,arguments:n};e.log.logMessage(o)}})(i[n]);if(e.log.makeLogger=function(t){var r={flags:0,f:t};return e.log.setLevel(r,"none"),r},e.log.setLevel=function(t,r){var a=!1;if(t&&!(t.flags&e.log.LEVEL_LOCKED))for(var n=0;n<e.log.levels.length;++n)if(r==e.log.levels[n]){t.level=r,a=!0;break}return a},e.log.lock=function(t,r){void 0===r||r?t.flags|=e.log.LEVEL_LOCKED:t.flags&=~e.log.LEVEL_LOCKED},e.log.addLogger=function(e){r.push(e)},"undefined"!=typeof console&&"log"in console){var l;if(console.error&&console.warn&&console.info&&console.debug){var s={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},c=function(t,r){e.log.prepareStandard(r);var a=s[r.level],n=[r.standard];n=n.concat(r.arguments.slice()),a.apply(console,n)};l=e.log.makeLogger(c)}else c=function(t,r){e.log.prepareStandardFull(r)},l=e.log.makeLogger(c);e.log.setLevel(l,"debug"),e.log.addLogger(l),a=l}else console={log:function(){}};if(null!==a&&"undefined"!=typeof window&&window.location){var u=new URL(window.location.href).searchParams;u.has("console.level")&&e.log.setLevel(a,u.get("console.level").slice(-1)[0]),u.has("console.lock")&&"true"==u.get("console.lock").slice(-1)[0]&&e.log.lock(a)}e.log.consoleLogger=a}(),gl||(gl=1,Ko(),Wo(),Si(),ci(),sl()),$i(),oi(),Jo(),ki(),rl(),_l(),al(),Ri(),mi(),el(),bi(),yi(),function(){if(xl)return Sl.exports;xl=1;var e=bo();zo(),$o(),Wo(),Si(),So();var t=Sl.exports=e.ssh=e.ssh||{};function r(t,r){var a=r.toString(16);a[0]>="8"&&(a="00"+a);var n=e.util.hexToBytes(a);t.putInt32(n.length),t.putBytes(n)}function a(e,t){e.putInt32(t.length),e.putString(t)}function n(){for(var t=e.md.sha1.create(),r=arguments.length,a=0;a<r;++a)t.update(arguments[a]);return t.digest()}t.privateKeyToPutty=function(t,o,i){var l="ssh-rsa",s=""===(o=o||"")?"none":"aes256-cbc",c="PuTTY-User-Key-File-2: "+l+"\r\n";c+="Encryption: "+s+"\r\n",c+="Comment: "+(i=i||"")+"\r\n";var u=e.util.createBuffer();a(u,l),r(u,t.e),r(u,t.n);var v=e.util.encode64(u.bytes(),64),d=Math.floor(v.length/66)+1;c+="Public-Lines: "+d+"\r\n",c+=v;var p,f=e.util.createBuffer();if(r(f,t.d),r(f,t.p),r(f,t.q),r(f,t.qInv),o){var h=f.length()+16-1;h-=h%16;var g=n(f.bytes());g.truncate(g.length()-h+f.length()),f.putBuffer(g);var m=e.util.createBuffer();m.putBuffer(n("\0\0\0\0",o)),m.putBuffer(n("\0\0\0",o));var b=e.aes.createEncryptionCipher(m.truncate(8),"CBC");b.start(e.util.createBuffer().fillWithByte(0,16)),b.update(f.copy()),b.finish();var y=b.output;y.truncate(16),p=e.util.encode64(y.bytes(),64)}else p=e.util.encode64(f.bytes(),64);c+="\r\nPrivate-Lines: "+(d=Math.floor(p.length/66)+1)+"\r\n",c+=p;var w=n("putty-private-key-file-mac-key",o),_=e.util.createBuffer();a(_,l),a(_,s),a(_,i),_.putInt32(u.length()),_.putBuffer(u),_.putInt32(f.length()),_.putBuffer(f);var x=e.hmac.create();return x.start("sha1",w),x.update(_.bytes()),c+"\r\nPrivate-MAC: "+x.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(t,n){var o="ssh-rsa";n=n||"";var i=e.util.createBuffer();return a(i,o),r(i,t.e),r(i,t.n),o+" "+e.util.encode64(i.bytes())+" "+n},t.privateKeyToOpenSSH=function(t,r){return r?e.pki.encryptRsaPrivateKey(t,r,{legacy:!0,algorithm:"aes128"}):e.pki.privateKeyToPem(t)},t.getPublicKeyFingerprint=function(t,n){var o=(n=n||{}).md||e.md.md5.create(),i=e.util.createBuffer();a(i,"ssh-rsa"),r(i,t.e),r(i,t.n),o.start(),o.update(i.getBytes());var l=o.digest();if("hex"===n.encoding){var s=l.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return l.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return l},Sl.exports}(),nl(),So()),Cl);class Al{constructor(e){this.logger="CORE_LOGGER",this.isDebug=e}debug(e){this.isDebug&&console.debug}warning(e){this.isDebug&&console.warn}warn(e){this.warning(e)}info(e){this.isDebug&&console.info}error(e){this.isDebug&&console.error}isDebugEnabled(){return this.isDebug}}let Tl={domain:"https://api.dev.alviere.com",access_token:"",certificate:{id:"",public_key:""}};function Il(e){Tl={...Tl,...e}}function Bl(e){if("undefined"!=typeof window&&window.VITE_DEBUG){return window[`VITE_${e}`]}}function Nl(){if(Tl.domain&&Tl.certificate)return;const e={},t=Bl("ALVIERE_DOMAIN"),r=Bl("CERTIFICATE");if(t&&(e.domain=t),r)try{const t=JSON.parse(r);t&&"string"==typeof t.id&&"string"==typeof t.public_key&&(e.certificate={id:t.id,public_key:t.public_key})}catch{}(e.domain||e.certificate)&&Il(e)}const zl=()=>(Tl.domain||Nl(),Tl.domain),Rl=()=>(Tl.certificate||Nl(),Tl.certificate.public_key.replace(/\\n/g,"").replace(/\r\n/g,"").replace(/\n/g,"").replace(/\r/g,"").trim()),Dl=()=>(Tl.certificate||Nl(),Tl.certificate.id);zl(),Rl(),Dl();class Ll{constructor(e){var t;this.logger=e,this.rsa_key=Rl(),this.key=this.generate_key(),this.nonce=this.generate_nonce(),null==(t=this.logger)||t.debug("🔐 Cryptor initialized")}async encrypt(e){var t,r;const a=(new TextEncoder).encode(JSON.stringify(e)),n={name:"AES-GCM",iv:this.nonce},o=await this.import_key(),i=await crypto.subtle.encrypt(n,o,a),l=this.bufferToStr(i),s=btoa(l),c=this.bufferToStr(this.key),u=btoa(c),v=this.bufferToStr(this.nonce),d=btoa(v);null==(t=this.logger)||t.debug(`🔐 RSA_KEY: ${this.rsa_key.substring(0,50)}...`);const p=kl.pki.publicKeyFromPem(this.rsa_key).encrypt(u+"::"+d),f={p:s,k:btoa(p),i:Dl()};return null==(r=this.logger)||r.debug(`🔐 ENCRYPTED_REQUEST: p=${f.p.substring(0,20)}..., i=${f.i}`),f}async decrypt(e){var t;const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:this.nonce},await this.import_key(),Uint8Array.from(atob(e.p),e=>e.charCodeAt(0))),a=(new TextDecoder).decode(r);return null==(t=this.logger)||t.debug(`🔐 DECRYPTED: ${a}`),JSON.parse(a)}generate_key(){return crypto.getRandomValues(new Uint8Array(32))}generate_nonce(){return crypto.getRandomValues(new Uint8Array(12))}async import_key(){return await crypto.subtle.importKey("raw",this.key,{name:"AES-GCM"},!0,["encrypt","decrypt"])}async rsa_encrypt(e){var t,r;null==(t=this.logger)||t.debug(`🔐 RSA_ENCRYPT: Data to encrypt: ${e.substring(0,50)}...`),null==(r=this.logger)||r.debug(`🔐 RSA_KEY: ${this.rsa_key.substring(0,50)}...`);const a=kl.pki.publicKeyFromPem(this.rsa_key);return btoa(a.encrypt(e))}bufferToStr(e){return Array.from(new Uint8Array(e)).map(e=>String.fromCharCode(e)).join("")}}class Ul{constructor(e){this.logger=e}credit_card_name(e){return this.logger.debug(`🔐 CREDIT_CARD_NAME: ${e}`),e&&"string"==typeof e?0===e.trim().length?"Card holder name cannot be empty.":null:"Card holder name cannot be empty."}credit_card_number(e){if(!e||"string"!=typeof e)return"Please enter a valid card number.";return/^(?:4[0-9]{12}(?:[0-9]{3})?)$/.test(e.replace(/\s/g,""))||/^(?:5[1-5][0-9]{14})$/.test(e.replace(/\s/g,""))||/^(?:3[47][0-9]{13})$/.test(e.replace(/\s/g,""))||/^(?:6(?:011|5[0-9][0-9])[0-9]{12})$/.test(e.replace(/\s/g,""))?null:(this.logger.debug("🔐 card number is not a recognized brand"),"Please enter a valid card number.")}credit_card_expiry_date(e){if(!e||"string"!=typeof e)return"Expiry date cannot be empty.";if(0===e.trim().length)return"Expiry date cannot be empty.";return/^(0[1-9]|1[0-2])\/?([0-9]{4}|[0-9]{2})$/.test(e)?null:"Please enter a valid expiry date."}credit_card_sec_code(e){if(!e||"string"!=typeof e)return"Security code cannot be empty.";if(0===e.trim().length)return"Security code cannot be empty.";return/^[0-9]{3,4}$/.test(e)?null:"Please enter a valid security code."}credit_card_zip_code(e){return e&&"string"==typeof e?0===e.trim().length?"Zip code cannot be empty.":null:"Zip code cannot be empty."}credit_card_pin(e){if(!e||"string"!=typeof e)return"PIN cannot be empty.";if(0===e.trim().length)return"PIN cannot be empty.";return/^[0-9]{4}$/.test(e)?null:"Please enter a valid PIN."}is_valid_uuid(e){if(!e||"string"!=typeof e)return"UUID cannot be empty.";if(0===e.trim().length)return"UUID cannot be empty.";return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)?null:"Please enter a valid UUID."}required(e,t){return null==e||"string"==typeof e&&0===e.trim().length?t?`${t} is required.`:"This field is required.":null}email(e){if(!e||"string"!=typeof e)return"Please enter a valid email address.";const t=e.trim();if(t.includes(".."))return"Please enter a valid email address.";return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/.test(t)?null:"Please enter a valid email address."}phone(e){if(!e||"string"!=typeof e)return"Please enter a valid phone number.";if(!e.startsWith("+"))return"Phone number must start with country code (e.g., +1)";const t=e.substring(1),r=t.match(/^(\d{1,3})/);if(!r)return"Invalid country code format";const a=r[1],n=t.substring(a.length);if(n.length<7)return"Phone number too short";const o=a.length+n.length;return o<10||o>15?"Phone number must be between 10 and 15 digits total":null}date(e,t="YYYY-MM-DD"){if(!e||"string"!=typeof e)return"Please enter a valid date.";const r=/^([0-9]{4})-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/;if(!r.test(e))return"Please enter a valid date in YYYY-MM-DD format";const[,a,n,o]=e.match(r)||[],i=parseInt(a),l=parseInt(n),s=parseInt(o);if(!this.isValidCalendarDate(i,l,s))return"Invalid date - this date does not exist";const c=new Date(e);return c>new Date?"Date cannot be in the future":c<new Date("1900-01-01")?"Date cannot be before 1900":null}isValidCalendarDate(e,t,r){const a=new Date(e,t-1,r);return a.getFullYear()===e&&a.getMonth()===t-1&&a.getDate()===r}min_length(e,t,r){return e&&"string"==typeof e?e.length<t?r?`${r} must be at least ${t} characters long.`:`Must be at least ${t} characters long.`:null:r?`${r} is required.`:"This field is required."}max_length(e,t,r){return e&&"string"==typeof e&&e.length>t?r?`${r} must be no more than ${t} characters long.`:`Must be no more than ${t} characters long.`:null}pattern(e,t,r){return e&&"string"==typeof e&&t.test(e)?null:r||"Please enter a valid value."}numeric(e,t){return e&&"string"==typeof e?/^\d+$/.test(e.trim())?null:t?`${t} must contain only numbers.`:"Must contain only numbers.":t?`${t} is required.`:"This field is required."}alphabetic(e,t){return e&&"string"==typeof e?/^[a-zA-Z\s]+$/.test(e.trim())?null:t?`${t} must contain only letters and spaces.`:"Must contain only letters and spaces.":t?`${t} is required.`:"This field is required."}alphanumeric(e,t){return e&&"string"==typeof e?/^[a-zA-Z0-9\s]+$/.test(e.trim())?null:t?`${t} must contain only letters, numbers, and spaces.`:"Must contain only letters, numbers, and spaces.":t?`${t} is required.`:"This field is required."}url(e){if(!e||"string"!=typeof e)return"Please enter a valid URL.";const t=e.trim();try{const e=new URL(t);return""===e.hostname||e.hostname.startsWith(".")||e.hostname.endsWith(".")?"Please enter a valid URL.":null}catch{return"Please enter a valid URL."}}postal_code(e,t="US"){if(!e||"string"!=typeof e)return"Please enter a valid postal code.";const r=e.trim();switch(t.toUpperCase()){case"US":if(!/^\d{5}(-\d{4})?$/.test(r))return"Please enter a valid US ZIP code (e.g., 12345 or 12345-6789).";break;case"CA":if(!/^[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d$/.test(r))return"Please enter a valid Canadian postal code (e.g., A1A 1A1).";break;case"UK":case"GB":if(!/^[A-Za-z]{1,2}\d[A-Za-z\d]?\s\d[A-Za-z]{2}$/.test(r))return"Please enter a valid UK postal code (e.g., SW1A 1AA).";break;default:if(!/^[A-Za-z0-9\s-]{3,10}$/.test(r))return"Please enter a valid postal code."}return null}}class Pl extends Error{constructor(e,t,r){super(`Alcore API Error ${e}: ${t}`),this.name="AlcoreApiError",this.errorCode=e,this.errorDescription=t,this.statusCode=r,Error.captureStackTrace&&Error.captureStackTrace(this,Pl)}isErrorCode(e){return this.errorCode===e}isAnyErrorCode(e){return e.includes(this.errorCode)}}const Vl="000000",Ml="100011",Ol="100012",ql="100013",jl="100014",Fl="100015",Kl="100016",$l="100017",Hl="100300",Gl="100301",Wl="100302",Yl="100303",Ql="100304",Jl="100305",Xl="100306",Zl="110000",es="110001",ts="110002",rs="110004",as="115000",ns="115001",os="320129",is="320104",ls={[Jl]:"Invalid authentication token. Please log in again.",[Xl]:"Authentication failed. Please check your credentials and try again.",[Zl]:"Session not found. Please log in again.",[es]:"Parent account not found.",[ts]:"Resource not found.",[rs]:"Account type not supported.",[Hl]:"Invalid request payload. Please check your request and try again.",[Gl]:"Invalid request payload field. Please check your request and try again.",[Wl]:"Invalid path parameter. Please check your request and try again.",[Yl]:"Invalid header. Please check your request and try again.",[Ql]:"Invalid query parameter. Please check your request and try again.",[Ml]:"Unprocessable encrypted data. Please check your request and try again.",[Ol]:"Wrong encrypted endpoint. Please check your request and try again.",[ql]:"Undecryptable data at endpoint. Please check your request and try again.",[jl]:"Decrypted data unusable at endpoint. Please check your request and try again.",[Fl]:"Wrong decrypted endpoint. Please check your request and try again.",[Kl]:"Wrong version or endpoint. Please check your request and try again.",[$l]:"Operation halted. Please check your request and try again.",[as]:"Underlying API Error. ",[ns]:"Account status not active. Please check your request and try again.",[os]:"Used Account can't be used to create a child account.",[is]:"Parent account not allowed. Please check your request and try again."},ss=[Jl,Xl,Zl,Ml,Ol,ql,$l,Vl,as,ns,os,is];class cs{constructor(e,t,r){this.endpoint="/alcore",this.jwt=e,this.cryptor=t,this.domain=zl(),this.logger=r,this.logger.debug(`🔐 AlcoreBase initialized with domain: ${this.domain}`)}async send(e,t,r){const a={method:e,endpoint:t,payload:JSON.stringify(r)};let n;this.logger.debug("🌐 AlcoreBase: Preparing to send request"),this.logger.debug("🌐 Method: "+e),this.logger.debug("🌐 Endpoint: "+t),this.logger.debug("🌐 Domain: "+(this.domain||"undefined")),this.logger.debug("🌐 JWT Token: "+(this.jwt?"✅ Present":"❌ Missing")),this.logger.debug("🌐 Payload size: "+JSON.stringify(r).length+" chars"),this.logger.debug(this.jwt),this.logger.debug("DATA TO SEND before encrypt"),this.logger.debug(r);try{n=await this.cryptor.encrypt(a),this.logger.debug("🔐 Encryption successful")}catch(i){throw this.logger.debug("❌ Encryption failed: "+(i instanceof Error?i.message:"Unknown error")),i}this.logger.debug("BASE GATEWAY: posting to "+this.endpoint),this.logger.debug(n);const o=this.domain+this.endpoint;this.logger.debug("🌐 Full URL: "+o);try{const e=await fetch(o,{method:"post",headers:{"Content-Type":"application/json",Authorization:"Bearer "+this.jwt,Version:"2021-11-18"},body:JSON.stringify(n)});if(this.logger.debug("🌐 Response received - Status: "+e.status+" "+e.statusText),this.logger.debug("🌐 Response OK: "+e.ok),!e.ok){let t=await e.json();throw t.p&&(t=await this.decrypt(t)),this.logger.debug("❌ API Error - Code: "+t.error_code+", Description: "+t.error_description),new Pl(500===e.status?as:t.error_code,ls[t.error_code],e.status)}return e}catch(l){throw this.logger.debug("❌ Fetch failed: "+(l instanceof Error?l.message:"Unknown error")),l}}async decrypt(e){return this.cryptor.decrypt(e)}}function us(e){if(e&&"object"==typeof e&&("error_code"in e||"error_description"in e)){const t=e.error_description||"Unknown API error",r=e.error_code||"UNKNOWN";throw new Error(`${r}: ${t}`)}return e}function vs(e){try{const t=e.split(".");if(3!==t.length)return null;const r=t[1],a=atob(r.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(a)}catch(t){return null}}function ds(e){const t=vs(e);return t?{domain:t.api_domain||"https://api.dev.alviere.com"}:{}}function ps(e){const t=vs(e);return t&&t.sub||null}class fs extends cs{constructor(e,t,r){super(e,t,r)}async add_card(e,t){const r=`/accounts/${e}/payment-methods/cards`,a=await this.send("POST",r,t),n=await a.json();return us(await this.decrypt(n))}async add_bank_account(e,t){const r=`/accounts/${e}/payment-methods/bank-accounts`,a=await this.send("POST",r,t),n=await a.json();return us(await this.decrypt(n))}async get_bank_accounts(e){const t=`/accounts/${e}/payment-methods/bank-accounts`,r=await this.send("GET",t,{}),a=await r.json();return us(await this.decrypt(a))}async delete_bank_account(e,t){const r=`/accounts/${e}/payment-methods/bank-accounts/${t}`;return us(await this.send("DELETE",r,{}))}}class hs extends cs{constructor(e,t,r){super(e,t,r)}async listWallets(e,t){const r=`/accounts/${e}/wallets${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return us(await this.decrypt(n))}async loadFunds(e,t){const r=`/wallets/${e}/load`,a=await this.send("POST",r,t),n=await a.json();return us(await this.decrypt(n))}}class gs extends cs{constructor(e,t,r){super(e,t,r)}async createPaymentInstrument(e){const t=await this.send("POST","/payments/payment-instruments",e),r=await t.json();return us(await this.decrypt(r))}async getPaymentInstrument(e){const t=`/payments/payment-instruments/${e}`,r=await this.send("GET",t,{}),a=await r.json();return us(await this.decrypt(a))}async deletePaymentInstrument(e){const t=`/payments/payment-instruments/${e}`;await this.send("DELETE",t,{})}async debitFunds(e){const t=await this.send("POST","/payments/debit",e),r=await t.json();return us(await this.decrypt(r))}async listCards(e,t){const r=`/accounts/${e}/payment-methods/cards${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return us(await this.decrypt(n))}}class ms extends cs{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 AccountsGateway initialized")}async createAccount(e){const t=await this.send("POST","/accounts",e),r=await t.json();return us(await this.decrypt(r))}async getAccount(e){const t=`/accounts/${e}`,r=await this.send("GET",t,{}),a=await r.json();return us(await this.decrypt(a))}async updateAccount(e,t){const r=`/accounts/${e}`,a=await this.send("PUT",r,t),n=await a.json();return us(await this.decrypt(n))}async deleteAccount(e){const t=`/accounts/${e}`;await this.send("DELETE",t,{})}async listAccounts(e){const t=`/accounts${e?"?"+new URLSearchParams(Object.entries(e).filter(([e,t])=>void 0!==t)):""}`,r=await this.send("GET",t,{}),a=await r.json();return us(await this.decrypt(a))}async activateAccount(e){const t=`/accounts/${e}/activate`;await this.send("POST",t,{})}async deactivateAccount(e){const t=`/accounts/${e}/deactivate`;await this.send("POST",t,{})}async manageOnboarding(e,t){const r=`/accounts/${e}/onboarding`;await this.send("POST",r,{action:t})}async createAddress(e,t){const r=`/accounts/${e}/addresses`,a=await this.send("POST",r,t),n=await a.json();return us(await this.decrypt(n))}async getAddresses(e,t){const r=`/accounts/${e}/addresses${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return us(await this.decrypt(n))}async updateAddress(e,t,r){const a=`/accounts/${e}/addresses/${t}`,n=await this.send("PUT",a,r),o=await n.json();return us(await this.decrypt(o))}async deleteAddress(e,t){const r=`/accounts/${e}/addresses/${t}`;await this.send("DELETE",r,{})}async createDossier(e,t){const r=`/accounts/${e}/dossiers`,a=await this.send("POST",r,t),n=await a.json();return us(await this.decrypt(n))}async getDossiers(e,t){const r=`/accounts/${e}/dossiers${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return us(await this.decrypt(n))}async getDossier(e,t){const r=`/accounts/${e}/dossiers/${t}`,a=await this.send("GET",r,{}),n=await a.json();return us(await this.decrypt(n))}async updateDossier(e,t,r){const a=`/accounts/${e}/dossiers/${t}`,n=await this.send("PUT",a,r),o=await n.json();return us(await this.decrypt(o))}async replaceDossier(e,t,r){const a=`/accounts/${e}/dossiers/${t}`,n=await this.send("PATCH",a,r),o=await n.json();return us(await this.decrypt(o))}async deleteDossier(e,t){const r=`/accounts/${e}/dossiers/${t}`;await this.send("DELETE",r,{})}}class bs extends cs{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 AuthGateway initialized")}async generateScopedToken(e){this.logger.debug("🔐 AuthGateway: Generating scoped token"),this.logger.debug("🌐 Endpoint: /v3/auth"),this.logger.debug("🌐 Account UUID: "+e.account_uuid);const t=await this.send("POST","/v3/auth",e),r=await this.decrypt(await t.json());return this.logger.debug("✅ Scoped token generated successfully"),r}}class ys{constructor(e){this.gateway=e}async listWallets(e,t){return this.gateway.listWallets(e,t)}async loadFunds(e,t){return this.gateway.loadFunds(e,t)}}class ws{constructor(e){this.gateway=e}async createPaymentInstrument(e){return this.gateway.createPaymentInstrument(e)}async getPaymentInstrument(e){return this.gateway.getPaymentInstrument(e)}async deletePaymentInstrument(e){return this.gateway.deletePaymentInstrument(e)}async debitFunds(e){return this.gateway.debitFunds(e)}async listCards(e,t){return this.gateway.listCards(e,t)}}class _s{constructor(e){this.gateway=e}async createAccount(e){return this.gateway.createAccount(e)}async getAccount(e){return this.gateway.getAccount(e)}async updateAccount(e,t){return this.gateway.updateAccount(e,t)}async deleteAccount(e){return this.gateway.deleteAccount(e)}async listAccounts(e){return this.gateway.listAccounts(e)}async activateAccount(e){return this.gateway.activateAccount(e)}async deactivateAccount(e){return this.gateway.deactivateAccount(e)}async manageOnboarding(e,t){return this.gateway.manageOnboarding(e,t)}async createAddress(e,t){return this.gateway.createAddress(e,t)}async getAddresses(e,t){return this.gateway.getAddresses(e,t)}async updateAddress(e,t,r){return this.gateway.updateAddress(e,t,r)}async deleteAddress(e,t){return this.gateway.deleteAddress(e,t)}async createDossier(e,t){return this.gateway.createDossier(e,t)}async getDossiers(e,t){return this.gateway.getDossiers(e,t)}async getDossier(e,t){return this.gateway.getDossier(e,t)}async updateDossier(e,t,r){return this.gateway.updateDossier(e,t,r)}async replaceDossier(e,t,r){return this.gateway.replaceDossier(e,t,r)}async deleteDossier(e,t){return this.gateway.deleteDossier(e,t)}}class xs{constructor(e,t){this.gateway=e,this.logger=t}async processAddCard(e,t){this.logger.debug("PaymentProcessor: Starting add card processing"),this.logger.debug("PaymentProcessor: Request data: "+JSON.stringify(t,null,2));try{const r=await this.gateway.add_card(e,t);return this.logger.debug("PaymentProcessor: Add card processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Add card processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}validateRequest(e){const t=["external_id","pan","exp_year","exp_month","postal_code","security_code"];for(const r of t)if(!e[r])throw new Error(`Missing required field: ${r}`);this.logger.debug("PaymentProcessor: Request validation passed")}async processAddCardWithValidation(e,t){return this.logger.debug("PaymentProcessor: Starting add card processing with validation"),this.validateRequest(t),await this.processAddCard(e,t)}async processAddBankAccount(e,t){this.logger.debug("PaymentProcessor: Starting add bank account processing"),this.logger.debug("PaymentProcessor: Request data: "+JSON.stringify(t,null,2));try{const r=await this.gateway.add_bank_account(e,t);return this.logger.debug("PaymentProcessor: Add bank account processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Add bank account processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}validateBankAccountRequest(e){const t=["external_id","country","currency","bank_account_details"];for(const r of t)if(!e[r])throw new Error(`Missing required field: ${r}`);this.logger.debug("PaymentProcessor: Bank account request validation passed")}async processAddBankAccountWithValidation(e,t){return this.logger.debug("PaymentProcessor: Starting add bank account processing with validation"),this.validateBankAccountRequest(t),await this.processAddBankAccount(e,t)}async processGetBankAccounts(e){this.logger.debug("PaymentProcessor: Starting get bank accounts processing");try{const t=await this.gateway.get_bank_accounts(e);return this.logger.debug("PaymentProcessor: Get bank accounts processing completed successfully"),t}catch(t){throw this.logger.debug("PaymentProcessor: Get bank accounts processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(t)),t}}async processDeleteBankAccount(e,t){this.logger.debug("PaymentProcessor: Starting delete bank account processing");try{const r=await this.gateway.delete_bank_account(e,t);return this.logger.debug("PaymentProcessor: Delete bank account processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Delete bank account processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}}class Cs{constructor(e){this.gateway=e}async getBankInfo(e){return this.gateway.getBankInfo(e)}}class Es extends cs{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 BankInfoGateway initialized")}async getBankInfo(e){const t=`/bank-info?routing_number=${e}`,r=await this.send("GET",t,{}),a=await r.json();return us(await this.decrypt(a))}}class Ss{constructor(e={}){if(this.authToken="",this.business_uuid="",this.account_uuid="",this.cryptor=null,this.gateways=new Map,this.jwt=e.jwt||"",this.debug=e.debug||!1,this.publicCertificate=e.publicCertificate||"",this.publicCertificateId=e.publicCertificateId||"",this.business_uuid=e.business_uuid||"",this.logger=new Al(this.debug),this.logger.debug(`🔐 AlviereCore constructor called with config: ${JSON.stringify(e)}`),this.jwt){const t=ds(this.jwt);e.jwt&&Il({...t,certificate:{id:this.publicCertificateId,public_key:this.publicCertificate}});const r=ps(this.jwt);r?(this.account_uuid=r,this.logger.debug(`🔐 Extracted account_uuid from JWT sub field: ${this.account_uuid}`)):this.logger.debug("⚠️ No account_uuid found in JWT sub field"),this.authToken=this.jwt,this.logger.debug("🔐 Using JWT as auth token for API authentication")}e.alviere&&Il(e.alviere)}configure(e){const t=e.jwt&&e.jwt!==this.jwt;if(e.jwt){this.jwt=e.jwt;const t=ds(e.jwt);t.domain&&Il(t);const r=ps(e.jwt);this.logger.debug(`🔐 Extracted account_uuid from JWT sub field: ${r}`),r?(this.account_uuid=r,this.logger.debug(`🔐 Updated account_uuid from JWT sub field: ${this.account_uuid}`)):this.logger.debug("⚠️ No account_uuid found in new JWT sub field"),this.authToken=this.jwt,this.logger.debug("🔐 Updated JWT as auth token for API authentication")}return void 0!==e.business_uuid&&(this.business_uuid=e.business_uuid,this.logger.debug(`🔐 Updated business_uuid: ${this.business_uuid}`)),"boolean"==typeof e.debug&&e.debug!==this.debug&&(this.debug=e.debug,this.logger=new Al(this.debug),this.logger.debug("🔐 Debug mode changed to: "+this.debug)),t&&(this.logger.debug("🔐 JWT changed - clearing gateway cache and cryptor"),this.gateways.clear(),this.cryptor=null),e.alviere&&Il(e.alviere),this}getOrCreateCryptor(){if(!this.cryptor){const e=Rl();if(!e||""===e.trim())throw new Error('🔐 Cryptor initialization failed: RSA public key not available. Please ensure JWT is configured with a valid RSA key before attempting encryption operations. Call alviereCore.configure({ jwt: "your-jwt-with-rsa-key" }) first.');this.logger.debug("🔐 Creating Cryptor instance with RSA key"),this.cryptor=new Ll(this.logger)}return this.cryptor}createPaymentsGateway(){return this.gateways.has("payments")||this.gateways.set("payments",new fs(this.authToken,this.getOrCreateCryptor(),this.logger)),this.gateways.get("payments")}createPaymentsService(){const e=this.createPaymentsGateway();return new xs(e,this.logger)}createWalletsService(){return this.gateways.has("wallets")||this.gateways.set("wallets",new hs(this.authToken,this.getOrCreateCryptor(),this.logger)),new ys(this.gateways.get("wallets"))}createPaymentInstrumentsService(){return this.gateways.has("paymentInstruments")||this.gateways.set("paymentInstruments",new gs(this.authToken,this.getOrCreateCryptor(),this.logger)),new ws(this.gateways.get("paymentInstruments"))}createAccountsService(){return this.gateways.has("accounts")||this.gateways.set("accounts",new ms(this.authToken,this.getOrCreateCryptor(),this.logger)),new _s(this.gateways.get("accounts"))}createAuthGateway(){if(!this.gateways.has("auth")){if(!this.cryptor)throw new Error("Cryptor not initialized. Cannot create AuthGateway.");this.gateways.set("auth",new bs(this.authToken,this.cryptor,this.logger))}return this.gateways.get("auth")}createBankInfoService(){return this.gateways.has("bankInfo")||this.gateways.set("bankInfo",new Es(this.authToken,this.getOrCreateCryptor(),this.logger)),new Cs(this.gateways.get("bankInfo"))}async generateScopedToken(e,t=!0){this.logger.debug(`🔐 Generating scoped token for account: ${e}`),this.logger.debug(`🔐 Auto-update: ${t}`);const r=this.createAuthGateway(),a=await r.generateScopedToken({account_uuid:e});return this.logger.debug("✅ Scoped token generated successfully"),t&&a.access_token&&(this.logger.debug("🔄 Auto-updating SDK with new scoped token"),this.configure({jwt:a.access_token})),a.access_token}getLogger(){return this.logger}getCryptor(){return this.getOrCreateCryptor()}clearCache(){this.gateways.clear()}getAccountUuid(){return this.account_uuid}getBusinessUuid(){return this.business_uuid}isFirstTimeUser(){if(!this.account_uuid||!this.business_uuid)return this.logger.debug("🔐 Cannot determine first-time user status: missing account_uuid or business_uuid"),!1;const e=this.account_uuid===this.business_uuid;return this.logger.debug(`🔐 First-time user check: ${e} (account: ${this.account_uuid}, business: ${this.business_uuid})`),e}isScopedToPayee(){return!(!this.account_uuid||!this.business_uuid)&&this.account_uuid!==this.business_uuid}static createValidator(e=!1){const t=new Al(e);return new Ul(t)}static createLogger(e=!1){return new Al(e)}static createCryptor(e){return new Ll(e)}}const ks=Ss.createValidator();function As(e){let t=or(null),r=or(!1),a=or(!1),n=or("neutral"),o=or("");const i=Qt(()=>()=>e.validationState&&"neutral"!==e.validationState?e.validationState:ka(a)?ka(n):"neutral"),l=Qt(()=>()=>e.errorMessage?e.errorMessage:ka(o)),s=Qt(()=>()=>"valid"===ka(i)()),c=Qt(()=>()=>"invalid"===ka(i)()),u=Qt(()=>()=>ka(a)&&"neutral"!==ka(i)());function v(t){if(!e.required&&(""===t||null==t))return{isValid:!0,error:null};if(e.required){const r=ks.required(t,e.label);if(r)return{isValid:!1,error:r}}return e.customValidator?e.customValidator(t):{isValid:!0,error:null}}return{state:{get inputElement(){return ka(t)},set inputElement(e){lr(t,e,!0)},get isFocused(){return ka(r)},get hasInteracted(){return ka(a)},get validationState(){return ka(i)()},get errorMessage(){return ka(l)()},get isValid(){return ka(s)()},get hasError(){return ka(c)()},get shouldShowValidation(){return ka(u)()},get validationError(){return ka(l)()},get localValue(){return e.value},get isReady(){return null!==ka(t)}},handlers:{handleFocus:function(t){lr(r,!0),e.onFocus&&e.onFocus(t)},handleBlur:function(t){if(lr(r,!1),lr(a,!0),ka(a)){const t=v(e.value);lr(n,t.isValid?"valid":"invalid",!0),lr(o,t.error||"",!0)}e.onBlur&&e.onBlur(t)},handleInput:function(t){if(lr(a,!0),ka(a)){const t=v(e.value);lr(n,t.isValid?"valid":"invalid",!0),lr(o,t.error||"",!0)}e.onInput&&e.onInput(t)},handleChange:function(t){e.onChange&&e.onChange(t)}},actions:{markAsInteracted:function(){lr(a,!0)},resetValidation:function(){lr(a,!1),lr(n,"neutral"),lr(o,"")},forceValidation:function(){lr(a,!0);const t=v(e.value);return lr(n,t.isValid?"valid":"invalid",!0),lr(o,t.error||"",!0),t},validateValue:v},computed:{get effectiveValidationState(){return ka(i)()},get effectiveErrorMessage(){return ka(l)()},get isValid(){return ka(s)()},get hasError(){return ka(c)()},get shouldShowValidation(){return ka(u)()}},metadata:{componentName:e.componentName||"UnknownComponent",componentType:e.componentType||"general",version:"2.0.0"}}}const Ts={email:(e,t)=>ks.email(e,t),phone:(e,t)=>ks.phone(e,t),url:(e,t)=>ks.url(e,t),numeric:(e,t)=>ks.numeric(e,t),alphabetic:(e,t)=>ks.alphabetic(e,t),alphanumeric:(e,t)=>ks.alphanumeric(e,t),pattern:(e,t,r)=>ks.pattern(e,t,r),minLength:(e,t,r)=>ks.min_length(e,t,r),maxLength:(e,t,r)=>ks.max_length(e,t,r),postalCode:(e,t,r)=>ks.postal_code(e,t,r),creditCardNumber:(e,t)=>ks.credit_card_number(e,t),creditCardSecCode:(e,t)=>ks.credit_card_sec_code(e,t),creditCardExpiryDate:(e,t)=>ks.credit_card_expiry_date(e,t),date:(e,t)=>ks.date(e,t)},Is={bubbles:!0,composed:!0,cancelable:!1};class Bs{static dispatch(e,t,r,a=Is){if(!e||"undefined"==typeof window||!window.customElements)return!1;const n=new CustomEvent(t,{detail:r,bubbles:a.bubbles??Is.bubbles,composed:a.composed??Is.composed,cancelable:a.cancelable??Is.cancelable}),o=this.findWebComponentHost(e);return!!o&&(o.dispatchEvent(n),!0)}static findWebComponentHost(e){const t=e.getRootNode();if(t instanceof ShadowRoot&&t.host)return t.host;let r=e;for(;r&&r.parentElement;)if(r=r.parentElement,r.tagName.includes("-"))return r;return e}static createEventName(e,t){return`${e}-${t}`}}function Ns(e){return{dispatch:(t,r,a)=>Bs.dispatch(e,t,r,a),createEventName:(e,t)=>Bs.createEventName(e,t)}}const zs="text-input",Rs="text-change",Ds="text-focus",Ls="text-blur",Us="card-pan-input",Ps="card-pan-change",Vs="card-pan-focus",Ms="card-pan-blur",Os="card-cvv-input",qs="card-cvv-change",js="card-cvv-focus",Fs="card-cvv-blur",Ks="card-exp-input",$s="card-exp-change",Hs="card-exp-focus",Gs="card-exp-blur",Ws="phone-input",Ys="phone-change",Qs="phone-focus",Js="phone-blur",Xs="search-select-input",Zs="search-select-change",ec="search-select-open",tc="search-select-close",rc="form-success",ac="form-error",nc="form-submit",oc="form-reset",ic="flow-step-complete",lc="flow-step-error",sc="flow-complete",cc="flow-reset",uc="account",vc="payment-method";const dc=new class{validate(e){const{value:t,schema:r,fieldName:a}=e,n=[];if(r.required){const e=ks.required(t,a);if(e){const t="string"==typeof r.required?r.required:e;return n.push(t),{isValid:!1,errors:n,firstError:n[0]}}}if(!t||""===t.trim())return{isValid:!0,errors:[],firstError:void 0};if(r.email){const e=ks.email(t);if(e){const t="string"==typeof r.email?r.email:e;n.push(t)}}if(r.phone){const e=ks.phone(t);if(e){const t="string"==typeof r.phone?r.phone:e;n.push(t)}}if(r.url){const e=ks.url(t);if(e){const t="string"==typeof r.url?r.url:e;n.push(t)}}if(r.numeric){const e=ks.numeric(t,a);if(e){const t="string"==typeof r.numeric?r.numeric:e;n.push(t)}}if(r.alphabetic){const e=ks.alphabetic(t,a);if(e){const t="string"==typeof r.alphabetic?r.alphabetic:e;n.push(t)}}if(r.alphanumeric){const e=ks.alphanumeric(t,a);if(e){const t="string"==typeof r.alphanumeric?r.alphanumeric:e;n.push(t)}}if(r.uuid){const e=ks.is_valid_uuid(t);if(e){const t="string"==typeof r.uuid?r.uuid:e;n.push(t)}}if(r.pattern){const e=this.validatePattern(t,r.pattern);e&&n.push(e)}if(void 0!==r.minLength){const e=this.validateMinLength(t,r.minLength,a);e&&n.push(e)}if(void 0!==r.maxLength){const e=this.validateMaxLength(t,r.maxLength,a);e&&n.push(e)}if(r.postalCode){const e=this.validatePostalCode(t,r.postalCode);e&&n.push(e)}if(r.date){const e=this.validateDate(t,r.date);e&&n.push(e)}if(r.match){const a=this.validateMatch(t,r.match,e);a&&n.push(a)}return{isValid:0===n.length,errors:n,firstError:n.length>0?n[0]:void 0}}validatePattern(e,t){return ks.pattern(e,t.regex,t.message)}validateMinLength(e,t,r){if("number"==typeof t)return ks.min_length(e,t,r);const a=ks.min_length(e,t.value,r);return a&&t.message?t.message:a}validateMaxLength(e,t,r){if("number"==typeof t)return ks.max_length(e,t,r);const a=ks.max_length(e,t.value,r);return a&&t.message?t.message:a}validatePostalCode(e,t){if("boolean"==typeof t)return ks.postal_code(e);if("string"==typeof t)return ks.postal_code(e,t);const r=ks.postal_code(e,t.country);return r&&t.message?t.message:r}validateDate(e,t){if("boolean"==typeof t)return ks.date(e);if("string"==typeof t)return t;const r=ks.date(e,t.format);return r&&t.message?t.message:r}validateMatch(e,t,r){let a;return t.fieldRef?"function"==typeof t.fieldRef?a=t.fieldRef():t.fieldRef&&"value"in t.fieldRef&&(a=t.fieldRef.value||""):t.fieldId&&r.getMatchFieldValue&&(a=r.getMatchFieldValue(t.fieldId)),void 0===a?null:e!==a?t.message||"Values do not match":null}};function pc(e,t,r,a){return dc.validate({value:e,schema:t,fieldName:r,getMatchFieldValue:a})}var fc=qa('<span class="alviere-card-pan-input__required svelte-36vkx7">*</span>'),hc=qa('<label class="alviere-card-pan-input__label svelte-36vkx7"> <!></label>'),gc=qa('<div class="alviere-card-pan-input__card-icon svelte-36vkx7"><!></div>'),mc=qa('<div class="alviere-card-pan-input__error svelte-36vkx7" role="alert"> </div>'),bc=qa('<div><!> <div><input type="text" inputmode="numeric" class="alviere-card-pan-input__input svelte-36vkx7" spellcheck="false" maxlength="23"/> <!></div> <!></div>');const yc={hash:"svelte-36vkx7",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, \'Helvetica Neue\', Arial, sans-serif;--alv-font-family-grotesque: \'Darker Grotesque\', sans-serif;--alv-font-family-mono: \'Monaco\', \'Menlo\', \'Ubuntu Mono\', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-card-pan-input.svelte-36vkx7 {position:relative;width:100%;}.alviere-card-pan-input__label.svelte-36vkx7 {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-card-pan-input__required.svelte-36vkx7 {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-card-pan-input__error.svelte-36vkx7 {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-card-pan-input__wrapper.svelte-36vkx7 {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-card-pan-input__wrapper--focused.svelte-36vkx7 {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-card-pan-input__wrapper--disabled.svelte-36vkx7 {background:#f4f4f5;cursor:not-allowed;}.alviere-card-pan-input__wrapper--readonly.svelte-36vkx7 {background:#f4f4f5;cursor:default;}.alviere-card-pan-input__wrapper--valid.svelte-36vkx7 {border-color:#436b1d;}.alviere-card-pan-input__wrapper--invalid.svelte-36vkx7 {border-color:#b3311f;}.alviere-card-pan-input__input.svelte-36vkx7 {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-card-pan-input__input.svelte-36vkx7::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-card-pan-input__input.svelte-36vkx7:disabled {cursor:not-allowed;color:#52525b;}.alviere-card-pan-input__input.svelte-36vkx7:read-only {cursor:default;color:#3f3f46;}.alviere-card-pan-input__validation-messages.svelte-36vkx7 {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-card-pan-input--sm.svelte-36vkx7 .alviere-card-pan-input__wrapper:where(.svelte-36vkx7) {min-height:2.5rem;}.alviere-card-pan-input--sm.svelte-36vkx7 .alviere-card-pan-input__input:where(.svelte-36vkx7) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-card-pan-input--sm.svelte-36vkx7 .alviere-card-pan-input__label:where(.svelte-36vkx7) {font-size:1rem;}.alviere-card-pan-input--md.svelte-36vkx7 .alviere-card-pan-input__wrapper:where(.svelte-36vkx7) {min-height:3.25rem;}.alviere-card-pan-input--md.svelte-36vkx7 .alviere-card-pan-input__input:where(.svelte-36vkx7) {font-size:1rem;}.alviere-card-pan-input--lg.svelte-36vkx7 .alviere-card-pan-input__wrapper:where(.svelte-36vkx7) {min-height:3.75rem;}.alviere-card-pan-input--lg.svelte-36vkx7 .alviere-card-pan-input__input:where(.svelte-36vkx7) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-card-pan-input--lg.svelte-36vkx7 .alviere-card-pan-input__label:where(.svelte-36vkx7) {font-size:1.25rem;}.alviere-card-pan-input.svelte-36vkx7:focus-within .alviere-card-pan-input__wrapper:where(.svelte-36vkx7):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-card-pan-input__input.svelte-36vkx7::placeholder {font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-card-pan-input__card-icon.svelte-36vkx7 {display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin-right:2rem;opacity:0.8;}.alviere-card-pan-input__card-icon.svelte-36vkx7 svg {width:100%;height:100%;fill:currentColor;display:block;}'};function wc(e,t){ht(t,!0),mn(e,yc);let r=co(t,"value",15,""),a=co(t,"label",15,"Card Number"),n=co(t,"placeholder",15,"Card number"),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"autocomplete",15,"cc-number"),d=co(t,"validationState",15,"neutral"),p=co(t,"errorMessage",15,""),f=co(t,"helpText",15,""),h=co(t,"validationSchema",31,()=>dr({}));const g=As({value:r(),required:i(),disabled:o(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardPanInput",componentType:"card",customValidator:e=>{const t=e.replace(/\s/g,""),r=Ts.creditCardNumber(t);if(r)return{isValid:!1,error:r};const n=pc(t,h(),a());return{isValid:n.isValid,error:n.firstError}}}),m=[{name:"Visa",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Visa</title><path d="M9.112 8.262L5.97 15.758H3.92L2.374 9.775c-.094-.368-.175-.503-.461-.658C1.447 8.864.677 8.627 0 8.479l.046-.217h3.3a.904.904 0 01.894.764l.817 4.338 2.018-5.102zm8.033 5.049c.008-1.979-2.736-2.088-2.717-2.972.006-.269.262-.555.822-.628a3.66 3.66 0 011.913.336l.34-1.59a5.207 5.207 0 00-1.814-.333c-1.917 0-3.266 1.02-3.278 2.479-.012 1.079.963 1.68 1.698 2.04.756.367 1.01.603 1.006.931-.005.504-.602.725-1.16.734-.975.015-1.54-.263-1.992-.473l-.351 1.642c.453.208 1.289.39 2.156.398 2.037 0 3.37-1.006 3.377-2.564m5.061 2.447H24l-1.565-7.496h-1.656a.883.883 0 00-.826.55l-2.909 6.946h2.036l.405-1.12h2.488zm-2.163-2.656l1.02-2.815.588 2.815zm-8.16-4.84l-1.603 7.496H8.34l1.605-7.496z"/></svg>',pattern:/^4/,gaps:[4,8,12],lengths:[16,18,19],code:"visa"},{name:"Mastercard",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>MasterCard</title><path d="M11.343 18.031c.058.049.12.098.181.146-1.177.783-2.59 1.238-4.107 1.238C3.32 19.416 0 16.096 0 12c0-4.095 3.32-7.416 7.416-7.416 1.518 0 2.931.456 4.105 1.238-.06.051-.12.098-.165.15C9.6 7.489 8.595 9.688 8.595 12c0 2.311 1.001 4.51 2.748 6.031zm5.241-13.447c-1.52 0-2.931.456-4.105 1.238.06.051.12.098.165.15C14.4 7.489 15.405 9.688 15.405 12c0 2.31-1.001 4.507-2.748 6.031-.058.049-.12.098-.181.146 1.177.783 2.588 1.238 4.107 1.238C20.68 19.416 24 16.096 24 12c0-4.094-3.32-7.416-7.416-7.416zM12 6.174c-.096.075-.189.15-.28.231C10.156 7.764 9.169 9.765 9.169 12c0 2.236.987 4.236 2.551 5.595.09.08.185.158.28.232.096-.074.189-.152.28-.232 1.563-1.359 2.551-3.359 2.551-5.595 0-2.235-.987-4.236-2.551-5.595-.09-.08-.184-.156-.28-.231z"/></svg>',pattern:/^5[1-5]|^2[2-7]/,gaps:[4,8,12],lengths:[16],code:"mastercard"},{name:"American Express",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>American Express</title><path d="M16.015 14.378c0-.32-.135-.496-.344-.622-.21-.12-.464-.135-.81-.135h-1.543v2.82h.675v-1.027h.72c.24 0 .39.024.478.125.12.13.104.38.104.55v.35h.66v-.555c-.002-.25-.017-.376-.108-.516-.06-.08-.18-.18-.33-.234l.02-.008c.18-.072.48-.297.48-.747zm-.87.407l-.028-.002c-.09.053-.195.058-.33.058h-.81v-.63h.824c.12 0 .24 0 .33.05.098.048.156.147.15.255 0 .12-.045.215-.134.27zM20.297 15.837H19v.6h1.304c.676 0 1.05-.278 1.05-.884 0-.28-.066-.448-.187-.582-.153-.133-.392-.193-.73-.207l-.376-.015c-.104 0-.18 0-.255-.03-.09-.03-.15-.105-.15-.21 0-.09.017-.166.09-.21.083-.046.177-.066.272-.06h1.23v-.602h-1.35c-.704 0-.958.437-.958.84 0 .9.776.855 1.407.87.104 0 .18.015.225.06.046.03.082.106.082.18 0 .077-.035.15-.08.18-.06.053-.15.07-.277.07zM0 0v10.096L.81 8.22h1.75l.225.464V8.22h2.043l.45 1.02.437-1.013h6.502c.295 0 .56.057.756.236v-.23h1.787v.23c.307-.17.686-.23 1.12-.23h2.606l.24.466v-.466h1.918l.254.465v-.466h1.858v3.948H20.87l-.36-.6v.585h-2.353l-.256-.63h-.583l-.27.614h-1.213c-.48 0-.84-.104-1.08-.24v.24h-2.89v-.884c0-.12-.03-.12-.105-.135h-.105v1.036H6.067v-.48l-.21.48H4.69l-.202-.48v.465H2.235l-.256-.624H1.4l-.256.624H0V24h23.786v-7.108c-.27.135-.613.18-.973.18H21.09v-.255c-.21.165-.57.255-.914.255H14.71v-.9c0-.12-.018-.12-.12-.12h-.075v1.022h-1.8v-1.066c-.298.136-.643.15-.928.136h-.214v.915h-2.18l-.54-.617-.57.6H4.742v-3.93h3.61l.518.602.554-.6h2.412c.28 0 .74.03.942.225v-.24h2.177c.202 0 .644.045.903.225v-.24h3.265v.24c.163-.164.508-.24.803-.24h1.89v.24c.194-.15.464-.24.84-.24h1.176V0H0zM21.156 14.955c.004.005.006.012.01.016.01.01.024.01.032.02l-.042-.035zM23.828 13.082h.065v.555h-.065zM23.865 15.03v-.005c-.03-.025-.046-.048-.075-.07-.15-.153-.39-.215-.764-.225l-.36-.012c-.12 0-.194-.007-.27-.03-.09-.03-.15-.105-.15-.21 0-.09.03-.16.09-.204.076-.045.15-.05.27-.05h1.223v-.588h-1.283c-.69 0-.96.437-.96.84 0 .9.78.855 1.41.87.104 0 .18.015.224.06.046.03.076.106.076.18 0 .07-.034.138-.09.18-.045.056-.136.07-.27.07h-1.288v.605h1.287c.42 0 .734-.118.9-.36h.03c.09-.134.135-.3.135-.523 0-.24-.045-.39-.135-.526zM18.597 14.208v-.583h-2.235V16.458h2.235v-.585h-1.57v-.57h1.533v-.584h-1.532v-.51M13.51 8.787h.685V11.6h-.684zM13.126 9.543l-.007.006c0-.314-.13-.5-.34-.624-.217-.125-.47-.135-.81-.135H10.43v2.82h.674v-1.034h.72c.24 0 .39.03.487.12.122.136.107.378.107.548v.354h.677v-.553c0-.25-.016-.375-.11-.516-.09-.107-.202-.19-.33-.237.172-.07.472-.3.472-.75zm-.855.396h-.015c-.09.054-.195.056-.33.056H11.1v-.623h.825c.12 0 .24.004.33.05.09.04.15.128.15.25s-.047.22-.134.266zM15.92 9.373h.632v-.6h-.644c-.464 0-.804.105-1.02.33-.286.3-.362.69-.362 1.11 0 .512.123.833.36 1.074.232.238.645.31.97.31h.78l.255-.627h1.39l.262.627h1.36v-2.11l1.272 2.11h.95l.002.002V8.786h-.684v1.963l-1.18-1.96h-1.02V11.4L18.11 8.744h-1.004l-.943 2.22h-.3c-.177 0-.362-.03-.468-.134-.125-.15-.186-.36-.186-.662 0-.285.08-.51.194-.63.133-.135.272-.165.516-.165zm1.668-.108l.464 1.118v.002h-.93l.466-1.12zM2.38 10.97l.254.628H4V9.393l.972 2.205h.584l.973-2.202.015 2.202h.69v-2.81H6.118l-.807 1.904-.876-1.905H3.343v2.663L2.205 8.787h-.997L.01 11.597h.72l.26-.626h1.39zm-.688-1.705l.46 1.118-.003.002h-.915l.457-1.12zM11.856 13.62H9.714l-.85.923-.825-.922H5.346v2.82H8l.855-.932.824.93h1.302v-.94h.838c.6 0 1.17-.164 1.17-.945l-.006-.003c0-.78-.598-.93-1.128-.93zM7.67 15.853l-.014-.002H6.02v-.557h1.47v-.574H6.02v-.51H7.7l.733.82-.764.824zm2.642.33l-1.03-1.147 1.03-1.108v2.253zm1.553-1.258h-.885v-.717h.885c.24 0 .42.098.42.344 0 .243-.15.372-.42.372zM9.967 9.373v-.586H7.73V11.6h2.237v-.58H8.4v-.564h1.527V9.88H8.4v-.507"/></svg>',pattern:/^3[47]/,gaps:[4,10],lengths:[15],code:"amex"},{name:"Discover",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discover</title><path d="M14.58 12a2.023 2.023 0 1 1-2.025-2.023h.002c1.118 0 2.023.906 2.023 2.023zm-5.2-2.001c-1.124 0-2.025.884-2.025 1.99 0 1.118.878 1.984 2.007 1.984.319 0 .593-.063.93-.221v-.873c-.296.297-.559.416-.895.416-.747 0-1.277-.542-1.277-1.312 0-.73.547-1.306 1.243-1.306.354 0 .622.126.93.428v-.873a1.898 1.898 0 0 0-.913-.233zm-3.352 1.545c-.445-.165-.576-.273-.576-.479 0-.239.233-.422.553-.422.222 0 .405.091.598.308l.388-.508a1.665 1.665 0 0 0-1.117-.422c-.673 0-1.186.467-1.186 1.089 0 .524.239.792.936 1.043.291.103.438.171.513.217a.456.456 0 0 1 .222.394c0 .308-.245.536-.576.536-.354 0-.639-.177-.809-.507l-.479.461c.342.502.752.724 1.317.724.771 0 1.311-.513 1.311-1.249-.002-.603-.252-.876-1.095-1.185zM24 10.3a.29.29 0 0 1-.288.291.29.29 0 0 1-.291-.291v-.003A.29.29 0 1 1 24 10.3zm-.059.001a.235.235 0 0 0-.231-.239.234.234 0 0 0-.232.239c0 .132.104.239.232.239a.235.235 0 0 0 .231-.239zM3.472 13.887h.742v-3.803h-.742v3.803zm12.702-1.248l-1.014-2.554h-.81l1.614 3.9h.399l1.643-3.9h-.804l-1.028 2.554zm2.166 1.248h2.104v-.644h-1.362v-1.027h1.312v-.644h-1.312v-.844h1.362v-.644H18.34v3.803zm5.409-3.557l.11.138h-.097l-.094-.13v.13h-.08v-.334h.107c.081 0 .126.036.126.103.001.046-.025.08-.072.093zm-.006-.092c0-.029-.021-.043-.06-.043h-.014v.087h.014c.039 0 .06-.014.06-.044zm-1.228 2.047l1.197 1.602H22.8l-1.027-1.528h-.097v1.528h-.741v-3.803h1.1c.855 0 1.346.411 1.346 1.123 0 .583-.308.965-.866 1.078zm.103-1.038c0-.37-.251-.563-.713-.563h-.228v1.152h.217c.473-.001.724-.207.724-.589zm-19.487.742a1.91 1.91 0 0 1-.69 1.46c-.365.303-.781.439-1.357.439H.001v-3.803H1.09c1.202 0 2.041.781 2.041 1.904zm-.764-.006c0-.364-.154-.718-.411-.947-.245-.222-.536-.308-1.015-.308H.742v2.515h.199c.479 0 .782-.092 1.015-.302.256-.228.411-.593.411-.958z"/></svg>',pattern:/^6(?:011|5)/,gaps:[4,8,12],lengths:[16],code:"discover"},{name:"Diners Club",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Diners Club</title><path d="M16.506 11.982a6.026 6.026 0 0 0-3.866-5.618V17.6a6.025 6.025 0 0 0 3.866-5.618zM8.33 17.598V6.365a6.03 6.03 0 0 0-3.863 5.617 6.028 6.028 0 0 0 3.863 5.616zm2.156-15.113A9.497 9.497 0 0 0 .99 11.982a9.495 9.495 0 0 0 9.495 9.494c5.245 0 9.495-4.25 9.496-9.494a9.499 9.499 0 0 0-9.496-9.497Zm-.023 19.888C4.723 22.4 0 17.75 0 12.09 0 5.905 4.723 1.626 10.463 1.627h2.69C18.822 1.627 24 5.903 24 12.09c0 5.658-5.176 10.283-10.848 10.283"/></svg>',pattern:/^3[0689]/,gaps:[4,10],lengths:[14],code:"diners"},{name:"JCB",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>JCB</title><path d="M13.05 9.8643c.9723.0736 1.7257.3671 2.3545.6843v-1.31s-1.2577-.3162-2.4408-.368c-4.1256-.1849-5.295 1.4344-5.295 3.1292 0 1.6947 1.1694 3.3145 5.295 3.1296 1.1831-.0536 2.4408-.3694 2.4408-.3694v-1.3086c-.6193.3081-1.3826.6107-2.3545.683-1.6793.1272-2.6898-.6907-2.6898-2.1342 0-1.4448 1.0105-2.2613 2.6898-2.1354m7.685 4.1223c-.0513.0105-.1581.02-.215.02h-1.8005V12.376H20.52c.0568 0 .1636.01.2149.02a.8056.8056 0 01.6325.7951c0 .4162-.2872.721-.6325.796zm-2.0155-4.0374h1.6325c.059 0 .1454.0077.1772.0137.3376.0572.6256.3307.6256.7392 0 .409-.288.6815-.626.7392a1.571 1.571 0 01-.1773.0137h-1.6311V9.9506zm3.4994 1.9856v-.0364c.9133-.1331 1.4149-.726 1.4149-1.4199 0-.8828-.7343-1.3916-1.7293-1.4416-.0772-.0032-.203-.011-.3044-.011h-5.3323v5.9467h5.7548c1.13 0 1.9774-.6043 1.9774-1.5466 0-.8701-.7724-1.4222-1.781-1.4917zm-17.8644.6788c0 .8787-.5906 1.5311-1.6656 1.5311-.917 0-1.8174-.2726-2.6889-.6938V14.76s1.4021.383 3.191.383c2.9714 0 3.8374-1.125 3.8374-2.529V9.0266H4.3541v3.5876Z"/></svg>',pattern:/^35/,gaps:[4,8,12],lengths:[16],code:"jcb"}];let b=or(null),y=Qt(()=>Ns(g.state.inputElement));function w(){return{value:ka(_),rawValue:ka(_),isValid:g.state.isValid,validationState:g.state.validationState,errorMessage:g.state.errorMessage,hasInteracted:g.state.hasInteracted,cardType:ka(b),formattedValue:ka(x)}}const _=Qt(()=>r().replace(/\s/g,"")),x=Qt(()=>function(e){const t=e.replace(/\D/g,""),r=C(t);if(!r)return t.replace(/(\d{4})/g,"$1 ").trim();let a="",n=0;for(const o of r.gaps)n<t.length&&(a+=t.slice(n,o)+" ",n=o);n<t.length&&(a+=t.slice(n));return a.trim()}(ka(_)));function C(e){for(const t of m)if(t.pattern.test(e))return t;return null}Ur(()=>{lr(b,C(ka(_)),!0)});var E={focus:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.blur()},isValid:function(){return g.state.isValid},getValidationError:function(){return g.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),g.state.inputElement&&(g.state.inputElement.value="")},select:function(){const e=g.state.inputElement;e&&"select"in e&&e.select()},setSelectionRange:function(e,t){const r=g.state.inputElement;r&&"setSelectionRange"in r&&r.setSelectionRange(e,t)},getCardType:function(){return ka(b)},getComponentMetadata:function(){return{name:"CardPanInput",type:"card",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getCardType"]}}},get value(){return r()},set value(e=""){r(e),zt()},get label(){return a()},set label(e="Card Number"){a(e),zt()},get placeholder(){return n()},set placeholder(e="Card number"){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get autocomplete(){return v()},set autocomplete(e="cc-number"){v(e),zt()},get validationState(){return d()},set validationState(e="neutral"){d(e),zt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),zt()},get helpText(){return f()},set helpText(e=""){f(e),zt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),zt()}},S=bc(),k=Cr(S),A=e=>{var t=hc(),r=Cr(t),n=Sr(r),o=e=>{Ha(e,fc())};pn(n,e=>{i()&&e(o)}),it(t),Or(()=>{Vn(t,"for",c()),an(r,`${a()??""} `)}),Ha(e,t)};pn(k,e=>{a()&&e(A)});var T=Sr(k,2);let I;var B=Cr(T);Dn(B),B.__input=function(e){const t=e.target.value.replace(/\D/g,""),a=(null===ka(b)||void 0===ka(b)?void 0:ka(b).lengths[0])||19,n=t.slice(0,a);r(n),g.handlers.handleInput(e),ka(y).dispatch(Us,w())},B.__change=function(e){g.handlers.handleChange(e),ka(y).dispatch(Ps,w())},ro(B,e=>g.state.inputElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.inputElement});var N=Sr(B,2),z=e=>{var t=gc();fn(Cr(t),()=>ka(b).icon),it(t),Or(()=>Vn(t,"title",ka(b).name)),Ha(e,t)};pn(N,e=>{ka(b)&&e(z)}),it(T);var R=Sr(T,2),D=e=>{var t=mc(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"id",`${c()??""}-error`),an(r,g.computed.effectiveErrorMessage)}),Ha(e,t)};return pn(R,e=>{g.computed.hasError&&e(D)}),it(S),Or(()=>{En(S,1,`alviere-card-pan-input alviere-card-pan-input--${s()??""}`,"svelte-36vkx7"),I=En(T,1,"alviere-card-pan-input__wrapper svelte-36vkx7",null,I,{"alviere-card-pan-input__wrapper--focused":g.state.isFocused,"alviere-card-pan-input__wrapper--disabled":o(),"alviere-card-pan-input__wrapper--valid":"valid"===g.computed.effectiveValidationState,"alviere-card-pan-input__wrapper--invalid":"invalid"===g.computed.effectiveValidationState}),Vn(B,"id",c()),Vn(B,"name",u()),Vn(B,"placeholder",n()),B.disabled=o(),B.required=i(),B.readOnly=l(),Vn(B,"autocomplete",v()),Ln(B,ka(x)),Vn(B,"aria-describedby",g.computed.hasError?`${c()}-error`:void 0)}),La("focus",B,function(e){g.handlers.handleFocus(e),ka(y).dispatch(Vs,w())}),La("blur",B,function(e){g.handlers.handleBlur(e),ka(y).dispatch(Ms,w())}),Ha(e,S),gt(E)}Ua(["input","change"]),customElements.define("alviere-card-pan-input",po(wc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getCardType","getComponentMetadata"],!0));var _c=qa('<span class="alviere-cvv-input__required svelte-15mfii7">*</span>'),xc=qa('<label class="alviere-cvv-input__label svelte-15mfii7"> <!></label>'),Cc=qa('<div class="alviere-cvv-input__code-type svelte-15mfii7"> </div>'),Ec=qa('<div class="alviere-cvv-input__error svelte-15mfii7" role="alert"> </div>'),Sc=qa('<div><!> <div><input type="text" inputmode="numeric" class="alviere-cvv-input__input svelte-15mfii7" spellcheck="false"/> <!></div> <!></div>');const kc={hash:"svelte-15mfii7",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-cvv-input.svelte-15mfii7 {position:relative;width:100%;}.alviere-cvv-input__label.svelte-15mfii7 {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-cvv-input__required.svelte-15mfii7 {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-cvv-input__error.svelte-15mfii7 {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-cvv-input__wrapper.svelte-15mfii7 {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-cvv-input__wrapper--focused.svelte-15mfii7 {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-cvv-input__wrapper--disabled.svelte-15mfii7 {background:#f4f4f5;cursor:not-allowed;}.alviere-cvv-input__wrapper--readonly.svelte-15mfii7 {background:#f4f4f5;cursor:default;}.alviere-cvv-input__wrapper--valid.svelte-15mfii7 {border-color:#436b1d;}.alviere-cvv-input__wrapper--invalid.svelte-15mfii7 {border-color:#b3311f;}.alviere-cvv-input__input.svelte-15mfii7 {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:\"Monaco\", \"Menlo\", \"Ubuntu Mono\", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-cvv-input__input.svelte-15mfii7::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:\"Monaco\", \"Menlo\", \"Ubuntu Mono\", monospace;}.alviere-cvv-input__input.svelte-15mfii7:disabled {cursor:not-allowed;color:#52525b;}.alviere-cvv-input__input.svelte-15mfii7:read-only {cursor:default;color:#3f3f46;}.alviere-cvv-input__validation-messages.svelte-15mfii7 {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-cvv-input--sm.svelte-15mfii7 .alviere-cvv-input__wrapper:where(.svelte-15mfii7) {min-height:2.5rem;}.alviere-cvv-input--sm.svelte-15mfii7 .alviere-cvv-input__input:where(.svelte-15mfii7) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-cvv-input--sm.svelte-15mfii7 .alviere-cvv-input__label:where(.svelte-15mfii7) {font-size:1rem;}.alviere-cvv-input--md.svelte-15mfii7 .alviere-cvv-input__wrapper:where(.svelte-15mfii7) {min-height:3.25rem;}.alviere-cvv-input--md.svelte-15mfii7 .alviere-cvv-input__input:where(.svelte-15mfii7) {font-size:1rem;}.alviere-cvv-input--lg.svelte-15mfii7 .alviere-cvv-input__wrapper:where(.svelte-15mfii7) {min-height:3.75rem;}.alviere-cvv-input--lg.svelte-15mfii7 .alviere-cvv-input__input:where(.svelte-15mfii7) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-cvv-input--lg.svelte-15mfii7 .alviere-cvv-input__label:where(.svelte-15mfii7) {font-size:1.25rem;}.alviere-cvv-input.svelte-15mfii7:focus-within .alviere-cvv-input__wrapper:where(.svelte-15mfii7):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-cvv-input__input.svelte-15mfii7 {text-align:center;letter-spacing:0.125em;}.alviere-cvv-input__input.svelte-15mfii7::placeholder {letter-spacing:0.125em;}.alviere-cvv-input__code-type.svelte-15mfii7 {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;}.alviere-cvv-input--sm.svelte-15mfii7 .alviere-cvv-input__code-type:where(.svelte-15mfii7) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-cvv-input--lg.svelte-15mfii7 .alviere-cvv-input__code-type:where(.svelte-15mfii7) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-cvv-input.svelte-15mfii7 .alviere-cvv-input__input:where(.svelte-15mfii7) {user-select:none;}"};function Ac(e,t){ht(t,!0),mn(e,kc);let r=co(t,"value",15,""),a=co(t,"label",15,"Security Code"),n=co(t,"placeholder",15,"123"),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"autocomplete",15,"cc-csc"),d=co(t,"validationState",15,"neutral"),p=co(t,"errorMessage",15,""),f=co(t,"helpText",15,""),h=co(t,"validationSchema",31,()=>dr({})),g=co(t,"cardType",15,"");const m=As({value:r(),required:i(),disabled:o(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardCVVInput",componentType:"cvv",customValidator:e=>{const t=Ts.cvv(e,g());if(t)return{isValid:!1,error:t};const r=pc(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let b=or(""),y=Qt(()=>Ns(m.state.inputElement));function w(){return{value:ka(b),rawValue:ka(b),isValid:m.state.isValid,validationState:m.state.validationState,errorMessage:m.state.errorMessage,hasInteracted:m.state.hasInteracted,cardType:g()?{name:g(),icon:"",pattern:/.*/,gaps:[],lengths:[],code:g().toLowerCase()}:null,expectedLength:ka(x)().max}}let _=Qt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":return 4;default:return 3}}),x=Qt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":return{min:4,max:4};default:return{min:3,max:3}}}),C=Qt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":case"discover":return"CID";case"mastercard":return"CVC";default:return"CVV"}});Ur(()=>{if(g()){const e=ka(x)();n("1".repeat(e.max)),ka(b)&&(isValidState=validateCvv(ka(b)))}});var E={focus:function(){var e;null===(e=m.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=m.state.inputElement)||void 0===e||e.blur()},isValid:function(){return m.state.isValid},getValidationError:function(){return m.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),lr(b,""),isValidState=!1,m.state.inputElement&&(m.state.inputElement.value="")},select:function(){m.state.inputElement&&"select"in m.state.inputElement&&m.state.inputElement.select()},setSelectionRange:function(e,t){m.state.inputElement&&"setSelectionRange"in m.state.inputElement&&m.state.inputElement.setSelectionRange(e,t)},getExpectedLength:function(){return ka(x)()},isValidCvv:function(){return isValidState},getComponentMetadata:function(){return{name:"CardCVVInput",type:"cvv",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getExpectedLength","isValidCvv"]}}},get value(){return r()},set value(e=""){r(e),zt()},get label(){return a()},set label(e="Security Code"){a(e),zt()},get placeholder(){return n()},set placeholder(e="123"){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get autocomplete(){return v()},set autocomplete(e="cc-csc"){v(e),zt()},get validationState(){return d()},set validationState(e="neutral"){d(e),zt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),zt()},get helpText(){return f()},set helpText(e=""){f(e),zt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),zt()},get cardType(){return g()},set cardType(e=""){g(e),zt()}},S=Sc(),k=Cr(S),A=e=>{var t=xc(),r=Cr(t),n=Sr(r),o=e=>{Ha(e,_c())};pn(n,e=>{i()&&e(o)}),it(t),Or(()=>{Vn(t,"for",c()),an(r,`${a()??""} `)}),Ha(e,t)};pn(k,e=>{a()&&e(A)});var T=Sr(k,2);let I;var B=Cr(T);Dn(B),B.__input=function(e){const t=e.target,a=t.value;m.actions.markAsInteracted();const n=a.replace(/\D/g,"").slice(0,ka(_)());lr(b,n,!0),r(n),t.value=n,isValidState=validateCvv(n),ka(y).dispatch(Os,w())},B.__change=function(){ka(y).dispatch(qs,w())},ro(B,e=>m.state.inputElement=e,()=>{var e;return null==(e=null==m?void 0:m.state)?void 0:e.inputElement});var N=Sr(B,2),z=e=>{var t=Cc(),r=Cr(t,!0);it(t),Or((e,a)=>{Vn(t,"title",`${e??""} for ${g()??""}`),an(r,a)},[()=>ka(C)(),()=>ka(C)()]),Ha(e,t)};pn(N,e=>{"CVV"!==ka(C)()&&e(z)}),it(T);var R=Sr(T,2),D=e=>{var t=Ec(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"id",`${c()??""}-error`),an(r,m.computed.effectiveErrorMessage)}),Ha(e,t)};return pn(R,e=>{m.computed.hasError&&e(D)}),it(S),Or((e,t)=>{En(S,1,`alviere-cvv-input alviere-cvv-input--${s()??""}`,"svelte-15mfii7"),I=En(T,1,"alviere-cvv-input__wrapper svelte-15mfii7",null,I,{"alviere-cvv-input__wrapper--focused":m.state.isFocused,"alviere-cvv-input__wrapper--disabled":o(),"alviere-cvv-input__wrapper--valid":"valid"===m.computed.effectiveValidationState,"alviere-cvv-input__wrapper--invalid":"invalid"===m.computed.effectiveValidationState}),Vn(B,"id",c()),Vn(B,"name",u()),Vn(B,"placeholder",n()),B.disabled=o(),B.required=i(),B.readOnly=l(),Vn(B,"autocomplete",v()),Ln(B,r()),Vn(B,"maxlength",e),Vn(B,"aria-describedby",m.computed.hasError?`${c()}-error`:void 0),Vn(B,"aria-label",`${t??""} security code`)},[()=>ka(_)(),()=>ka(C)()]),La("focus",B,function(){m.handlers.handleFocus(),ka(y).dispatch(js,w())}),La("blur",B,function(){m.handlers.handleBlur(),ka(y).dispatch(Fs,w())}),Ha(e,S),gt(E)}Ua(["input","change"]),customElements.define("alviere-card-cvv-input",po(Ac,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},cardType:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getExpectedLength","isValidCvv","getComponentMetadata"],!0));var Tc=qa('<span class="alviere-exp-input__required svelte-1i578bj">*</span>'),Ic=qa('<label class="alviere-exp-input__label svelte-1i578bj"> <!></label>'),Bc=qa('<div class="alviere-exp-input__error svelte-1i578bj" role="alert"> </div>'),Nc=qa('<div><!> <div><input type="text" inputmode="numeric" maxlength="5" class="alviere-exp-input__input svelte-1i578bj" spellcheck="false" aria-label="Card expiry date (MM/YY format)"/> <div class="alviere-exp-input__format-hint svelte-1i578bj" title="MM/YY format">MM/YY</div></div> <!></div>');const zc={hash:"svelte-1i578bj",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, \'Helvetica Neue\', Arial, sans-serif;--alv-font-family-grotesque: \'Darker Grotesque\', sans-serif;--alv-font-family-mono: \'Monaco\', \'Menlo\', \'Ubuntu Mono\', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-exp-input.svelte-1i578bj {position:relative;width:100%;}.alviere-exp-input__label.svelte-1i578bj {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-exp-input__required.svelte-1i578bj {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-exp-input__error.svelte-1i578bj {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-exp-input__wrapper.svelte-1i578bj {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-exp-input__wrapper--focused.svelte-1i578bj {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-exp-input__wrapper--disabled.svelte-1i578bj {background:#f4f4f5;cursor:not-allowed;}.alviere-exp-input__wrapper--readonly.svelte-1i578bj {background:#f4f4f5;cursor:default;}.alviere-exp-input__wrapper--valid.svelte-1i578bj {border-color:#436b1d;}.alviere-exp-input__wrapper--invalid.svelte-1i578bj {border-color:#b3311f;}.alviere-exp-input__input.svelte-1i578bj {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-exp-input__input.svelte-1i578bj::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-exp-input__input.svelte-1i578bj:disabled {cursor:not-allowed;color:#52525b;}.alviere-exp-input__input.svelte-1i578bj:read-only {cursor:default;color:#3f3f46;}.alviere-exp-input__validation-messages.svelte-1i578bj {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-exp-input--sm.svelte-1i578bj .alviere-exp-input__wrapper:where(.svelte-1i578bj) {min-height:2.5rem;}.alviere-exp-input--sm.svelte-1i578bj .alviere-exp-input__input:where(.svelte-1i578bj) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-exp-input--sm.svelte-1i578bj .alviere-exp-input__label:where(.svelte-1i578bj) {font-size:1rem;}.alviere-exp-input--md.svelte-1i578bj .alviere-exp-input__wrapper:where(.svelte-1i578bj) {min-height:3.25rem;}.alviere-exp-input--md.svelte-1i578bj .alviere-exp-input__input:where(.svelte-1i578bj) {font-size:1rem;}.alviere-exp-input--lg.svelte-1i578bj .alviere-exp-input__wrapper:where(.svelte-1i578bj) {min-height:3.75rem;}.alviere-exp-input--lg.svelte-1i578bj .alviere-exp-input__input:where(.svelte-1i578bj) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-exp-input--lg.svelte-1i578bj .alviere-exp-input__label:where(.svelte-1i578bj) {font-size:1.25rem;}.alviere-exp-input.svelte-1i578bj:focus-within .alviere-exp-input__wrapper:where(.svelte-1i578bj):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-exp-input__input.svelte-1i578bj {text-align:center;letter-spacing:0.1em;min-width:4rem;}.alviere-exp-input__input.svelte-1i578bj::placeholder {letter-spacing:0.1em;opacity:0.7;}.alviere-exp-input__format-hint.svelte-1i578bj {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;color:#52525b;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;letter-spacing:0.05em;opacity:0.8;}.alviere-exp-input--sm.svelte-1i578bj .alviere-exp-input__format-hint:where(.svelte-1i578bj) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-exp-input--lg.svelte-1i578bj .alviere-exp-input__format-hint:where(.svelte-1i578bj) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-exp-input__wrapper--focused.svelte-1i578bj .alviere-exp-input__format-hint:where(.svelte-1i578bj) {opacity:0.5;transform:scale(0.9);transition:opacity 150ms ease-in-out, transform 150ms ease-in-out;}.alviere-exp-input__validation-icon.svelte-1i578bj {\n animation: svelte-1i578bj-fadeIn 0.2s ease-in-out;}\n@keyframes svelte-1i578bj-fadeIn {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}'};function Rc(e,t){ht(t,!0),mn(e,zc);let r=co(t,"value",15,""),a=co(t,"label",15,"Expiry Date"),n=co(t,"placeholder",15,"MM/YY"),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"autocomplete",15,"cc-exp"),d=co(t,"validationState",15,"neutral"),p=co(t,"errorMessage",15,""),f=co(t,"helpText",15,""),h=co(t,"validationSchema",31,()=>dr({}));const g=As({value:r(),required:i(),disabled:o(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardExpInput",componentType:"expiry",customValidator:e=>{const t=Ts.creditCardExpiry(e);if(t)return{isValid:!1,error:t};const r=pc(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let m=or(""),b=Qt(()=>Ns(g.state.inputElement));function y(){return{value:r(),rawValue:ka(m),isValid:g.state.isValid,validationState:g.state.validationState,errorMessage:g.state.errorMessage,hasInteracted:g.state.hasInteracted,month:ka(w)(),year:ka(_)(),formattedValue:r()}}let w=Qt(()=>()=>{const e=ka(m).replace(/\D/g,"");return e.length>=2?e.slice(0,2):""}),_=Qt(()=>()=>{const e=ka(m).replace(/\D/g,"");return e.length>=3?e.slice(2,4):""});function x(e,t){setTimeout(()=>{e.setSelectionRange(t,t)},0)}var C={focus:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.blur()},isValid:function(){return g.state.isValid},getValidationError:function(){return g.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),lr(m,""),isValidState=!1,g.state.inputElement&&(g.state.inputElement.value="")},select:function(){g.state.inputElement&&"select"in g.state.inputElement&&g.state.inputElement.select()},setSelectionRange:function(e,t){g.state.inputElement&&"setSelectionRange"in g.state.inputElement&&g.state.inputElement.setSelectionRange(e,t)},getMonth:function(){return ka(w)()},getYear:function(){return ka(_)()},getExpiryDate:function(){return{month:ka(w)(),year:ka(_)()}},isValidExpiry:function(){return isValidState},getComponentMetadata:function(){return{name:"CardExpInput",type:"expiry",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getMonth","getYear","getExpiryDate","isValidExpiry"]}}},get value(){return r()},set value(e=""){r(e),zt()},get label(){return a()},set label(e="Expiry Date"){a(e),zt()},get placeholder(){return n()},set placeholder(e="MM/YY"){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get autocomplete(){return v()},set autocomplete(e="cc-exp"){v(e),zt()},get validationState(){return d()},set validationState(e="neutral"){d(e),zt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),zt()},get helpText(){return f()},set helpText(e=""){f(e),zt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),zt()}},E=Nc(),S=Cr(E),k=e=>{var t=Ic(),r=Cr(t),n=Sr(r),o=e=>{Ha(e,Tc())};pn(n,e=>{i()&&e(o)}),it(t),Or(()=>{Vn(t,"for",c()),an(r,`${a()??""} `)}),Ha(e,t)};pn(S,e=>{a()&&e(k)});var A=Sr(S,2);let T;var I=Cr(A);Dn(I),I.__input=function(e){const t=e.target,a=t.value,n=t.selectionStart||0;g.actions.markAsInteracted();const o=function(e){const t=e.replace(/\D/g,"");return 0===t.length?"":t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}`}(a),i=a.replace(/\D/g,"");lr(m,i,!0),r(o),t.value=o;let l=n;3===i.length&&4===o.length&&3===n&&(l=4),i.length>=3&&2===n&&o.includes("/")&&(l=4),x(t,Math.min(l,o.length)),isValidState=validateExpiry(o),ka(b).dispatch(Ks,y())},I.__keydown=function(e){const t=e.target,a=t.selectionStart||0,n=t.value;if("Backspace"===e.key&&3===a&&"/"===n[2]){e.preventDefault();const a=n.slice(0,2);return t.value=a,r(a),lr(m,a.replace(/\D/g,""),!0),x(t,2),void(isValidState=validateExpiry(a))}n.length>=5&&"Backspace"!==e.key&&"Delete"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"Tab"!==e.key&&e.preventDefault()},I.__change=function(){ka(b).dispatch($s,y())},ro(I,e=>g.state.inputElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.inputElement}),lt(2),it(A);var B=Sr(A,2),N=e=>{var t=Bc(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"id",`${c()??""}-error`),an(r,g.computed.effectiveErrorMessage)}),Ha(e,t)};return pn(B,e=>{g.computed.hasError&&e(N)}),it(E),Or(()=>{En(E,1,`alviere-exp-input alviere-exp-input--${s()??""}`,"svelte-1i578bj"),T=En(A,1,"alviere-exp-input__wrapper svelte-1i578bj",null,T,{"alviere-exp-input__wrapper--focused":g.state.isFocused,"alviere-exp-input__wrapper--disabled":o(),"alviere-exp-input__wrapper--valid":"valid"===g.computed.effectiveValidationState,"alviere-exp-input__wrapper--invalid":"invalid"===g.computed.effectiveValidationState}),Vn(I,"id",c()),Vn(I,"name",u()),Vn(I,"placeholder",n()),I.disabled=o(),I.required=i(),I.readOnly=l(),Vn(I,"autocomplete",v()),Ln(I,r()),Vn(I,"aria-describedby",g.computed.hasError?`${c()}-error`:void 0)}),La("focus",I,function(){g.handlers.handleFocus(),ka(b).dispatch(Hs,y())}),La("blur",I,function(){g.handlers.handleBlur(),ka(b).dispatch(Gs,y())}),Ha(e,E),gt(C)}function Dc(e,t,r,a={}){const{buttonSelectors:n=[],delay:o=0}=a;return function(e,t,r={}){const{enabled:a=!0,excludeSelectors:n=[],excludeElements:o=[],delay:i=0}=r;Ur(()=>{if(a&&e&&"undefined"!=typeof window){const t=e.getRootNode(),a=[];return document.addEventListener("click",r),a.push({target:document,handler:r}),t&&t!==document&&(t.addEventListener("click",r),a.push({target:t,handler:r})),()=>{a.forEach(({target:e,handler:t})=>{e.removeEventListener("click",t)})}}function r(r){const a=r.target;a&&(a===e||e.contains(a)||n.some(e=>a.closest(e))||o.some(e=>e&&(a===e||e.contains(a)))||(i>0?setTimeout(t,i):t()))}})}(t,r,{enabled:e,excludeElements:[t],excludeSelectors:n,delay:o})}Ua(["input","keydown","change"]),customElements.define("alviere-card-exp-input",po(Rc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getMonth","getYear","getExpiryDate","isValidExpiry","getComponentMetadata"],!0));const Lc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Uc=([e,t,r])=>{const a=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(e=>{a.setAttribute(e,String(t[e]))}),(null==r?void 0:r.length)&&r.forEach(e=>{const t=Uc(e);a.appendChild(t)}),a},Pc=(e,t={})=>{const r={...Lc,...t};return Uc(["svg",r,e])},Vc=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]],Mc=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]],Oc=[["path",{d:"M20 6 9 17l-5-5"}]],qc=[["path",{d:"m6 9 6 6 6-6"}]],jc=[["path",{d:"m9 18 6-6-6-6"}]],Fc=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]],Kc=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]],$c=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]],Hc=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var Gc=qa('<label class="alviere-text-input__label svelte-1auzwdn"> </label>'),Wc=qa('<textarea class="alviere-text-input__textarea svelte-1auzwdn" spellcheck="true"></textarea>'),Yc=qa('<input class="alviere-text-input__input svelte-1auzwdn" spellcheck="true"/>'),Qc=Fa('<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="m2.707 1.293 7.17 7.17.002.002 1.504 1.504 7.21 7.21-.001-.001 4.115 4.115-1.414 1.414-4.297-4.296C15.485 19.434 13.82 20 12 20c-2.959 0-5.461-1.46-7.51-3.85a16.59 16.59 0 0 1-1.796-2.56 12.546 12.546 0 0 1-.613-1.197L1.91 12l.17-.395c.11-.252.315-.668.618-1.195.5-.872 1.1-1.743 1.803-2.56.3-.349.614-.68.94-.993l-4.15-4.149zM6.856 8.27l-.256.252c-.199.2-.393.411-.581.63a14.7 14.7 0 0 0-1.843 2.718l-.069.13.145.275.179.322c.439.768.966 1.538 1.578 2.252C7.711 16.835 9.71 18 12 18c1.222 0 2.358-.334 3.426-.962l.123-.076-1.517-1.516A4 4 0 0 1 8.553 9.97zM12 4c2.959 0 5.461 1.46 7.51 3.849a16.59 16.59 0 0 1 1.796 2.56l.208.375c.126.234.228.437.306.603l.1.219.169.395-.17.395a12.7 12.7 0 0 1-.548 1.073c-.37.655-.8 1.318-1.292 1.963l-.302.385-1.553-1.26a14.947 14.947 0 0 0 1.404-2.07l.16-.289.104-.201-.144-.273-.178-.322a14.613 14.613 0 0 0-1.58-2.252C16.289 7.165 14.291 6 12.001 6c-.478 0-.942.05-1.395.151l-.337.085-.537-1.927A8.409 8.409 0 0 1 12 4zm-1.933 7.482-.036.166a2 2 0 0 0 2.321 2.321l.164-.038z" fill="currentcolor" fill-rule="evenodd"></path></svg>'),Jc=Fa('<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="M12 4c4.278 0 7.61 2.667 10 8-2.39 5.333-5.722 8-10 8s-7.61-2.667-10-8c2.39-5.333 5.722-8 10-8zm0 2c-4.41 0-6.707 4.479-7.699 5.999C5.295 13.518 7.604 18 12 18c4.41 0 6.707-4.479 7.699-5.999C18.705 10.482 16.396 6 12 6zm0 2c2.176 0 3.945 1.794 3.945 4s-1.77 4-3.945 4c-2.176 0-3.945-1.794-3.945-4S9.825 8 12 8zm0 2c-1.088 0-1.973.897-1.973 2s.885 2 1.973 2 1.973-.897 1.973-2-.885-2-1.973-2z" fill="currentcolor" fill-rule="evenodd"></path></svg>'),Xc=qa('<button type="button" class="alviere-text-input__reveal-button svelte-1auzwdn"><!></button>'),Zc=qa('<div class="alviere-text-input__character-count svelte-1auzwdn"> </div>'),eu=qa('<div class="alviere-text-input__required svelte-1auzwdn">Required</div>'),tu=qa('<div class="alviere-text-input__help svelte-1auzwdn"><!> </div>'),ru=qa('<div class="alviere-text-input__error svelte-1auzwdn" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),au=qa('<div><div><!> <!> <!> <!> <!></div> <div class="alviere-text-input__validation-messages svelte-1auzwdn"><!> <!></div></div>');const nu={hash:"svelte-1auzwdn",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, \'Helvetica Neue\', Arial, sans-serif;--alv-font-family-grotesque: \'Darker Grotesque\', sans-serif;--alv-font-family-mono: \'Monaco\', \'Menlo\', \'Ubuntu Mono\', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-text-input.svelte-1auzwdn {position:relative;width:100%;}.alviere-text-input__label.svelte-1auzwdn {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-text-input__required.svelte-1auzwdn {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-text-input__error.svelte-1auzwdn {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-text-input__wrapper.svelte-1auzwdn {position:relative;display:flex;align-items:flex-start;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-text-input__wrapper--focused.svelte-1auzwdn {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-text-input__wrapper--focused.svelte-1auzwdn .alviere-text-input__label:where(.svelte-1auzwdn) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-text-input__wrapper--focused.svelte-1auzwdn .alviere-text-input__input:where(.svelte-1auzwdn)::placeholder {opacity:1;}.alviere-text-input__wrapper--dirty.svelte-1auzwdn .alviere-text-input__label:where(.svelte-1auzwdn) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-text-input__wrapper--disabled.svelte-1auzwdn {background:#f4f4f5;cursor:not-allowed;}.alviere-text-input__wrapper--readonly.svelte-1auzwdn {background:#f4f4f5;cursor:default;}.alviere-text-input__wrapper--valid.svelte-1auzwdn {border-color:#436b1d;}.alviere-text-input__wrapper--invalid.svelte-1auzwdn {border-color:#b3311f;}.alviere-text-input__input.svelte-1auzwdn {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-text-input__input.svelte-1auzwdn::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-text-input__input.svelte-1auzwdn:disabled {cursor:not-allowed;color:#52525b;}.alviere-text-input__input.svelte-1auzwdn:read-only {cursor:default;color:#3f3f46;}.alviere-text-input__validation-messages.svelte-1auzwdn {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-text-input--sm.svelte-1auzwdn .alviere-text-input__wrapper:where(.svelte-1auzwdn) {min-height:2.5rem;}.alviere-text-input--sm.svelte-1auzwdn .alviere-text-input__input:where(.svelte-1auzwdn) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-text-input--sm.svelte-1auzwdn .alviere-text-input__textarea:where(.svelte-1auzwdn) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-text-input--sm.svelte-1auzwdn .alviere-text-input__label:where(.svelte-1auzwdn) {font-size:1rem;}.alviere-text-input--md.svelte-1auzwdn .alviere-text-input__wrapper:where(.svelte-1auzwdn) {min-height:3.25rem;}.alviere-text-input--md.svelte-1auzwdn .alviere-text-input__input:where(.svelte-1auzwdn) {font-size:1rem;}.alviere-text-input--md.svelte-1auzwdn .alviere-text-input__textarea:where(.svelte-1auzwdn) {font-size:1.25rem;}.alviere-text-input--lg.svelte-1auzwdn .alviere-text-input__wrapper:where(.svelte-1auzwdn) {min-height:3.75rem;}.alviere-text-input--lg.svelte-1auzwdn .alviere-text-input__input:where(.svelte-1auzwdn) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-text-input--lg.svelte-1auzwdn .alviere-text-input__textarea:where(.svelte-1auzwdn) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-text-input--lg.svelte-1auzwdn .alviere-text-input__label:where(.svelte-1auzwdn) {font-size:1.25rem;}.alviere-text-input.svelte-1auzwdn:focus-within .alviere-text-input__wrapper:where(.svelte-1auzwdn):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-text-input__wrapper--textarea.svelte-1auzwdn {align-items:stretch;}.alviere-text-input__input.svelte-1auzwdn, .alviere-text-input__textarea.svelte-1auzwdn {resize:none;}.alviere-text-input__textarea.svelte-1auzwdn {min-height:2.5rem;line-height:1.75rem;resize:vertical;}.alviere-text-input__character-count.svelte-1auzwdn {position:absolute;bottom:0.25rem;right:0.25rem;font-size:1rem;color:#71717a;background:rgba(255, 255, 255, 0.9);padding:0.125rem 0.25rem;border-radius:0.125rem;pointer-events:none;}.alviere-text-input__help.svelte-1auzwdn {margin-top:0.25rem;font-size:0.75rem;color:#71717a;line-height:1.25;display:flex;align-items:flex-start;gap:0.25rem;}.alviere-text-input__help.svelte-1auzwdn svg {width:1rem;height:1rem;}.alviere-text-input__wrapper--textarea.svelte-1auzwdn .alviere-text-input__textarea:where(.svelte-1auzwdn) {min-height:3rem;padding-bottom:1.5rem;}.alviere-text-input__wrapper--textarea.alviere-text-input--sm.svelte-1auzwdn .alviere-text-input__textarea:where(.svelte-1auzwdn) {min-height:2.5rem;}.alviere-text-input__wrapper--textarea.alviere-text-input--lg.svelte-1auzwdn .alviere-text-input__textarea:where(.svelte-1auzwdn) {min-height:4rem;}.alviere-text-input__character-count.svelte-1auzwdn {font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-weight:500;opacity:0.8;transition:opacity 150ms ease-in-out;}.alviere-text-input__wrapper--focused.svelte-1auzwdn .alviere-text-input__character-count:where(.svelte-1auzwdn) {opacity:1;}.alviere-text-input__wrapper--textarea--valid.svelte-1auzwdn::after, .alviere-text-input__wrapper--textarea--invalid.svelte-1auzwdn::after {top:0.5rem;transform:none;}.alviere-text-input__reveal-button.svelte-1auzwdn {background:transparent;border:none;cursor:pointer;padding:0;margin:0;position:absolute;right:0.5rem;top:50%;transform:translateY(-50%);color:#71717a;}'};function ou(e,t){ht(t,!0),mn(e,nu);let r=co(t,"value",15,""),a=co(t,"label",15,""),n=co(t,"placeholder",15,""),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"autocomplete",15,""),d=co(t,"validationState",15,"neutral"),p=co(t,"errorMessage",15,""),f=co(t,"helpText",15,""),h=co(t,"validationSchema",31,()=>dr({})),g=co(t,"sensitive",15,!1),m=co(t,"maxlength",15,void 0),b=co(t,"minlength",15,void 0),y=co(t,"oninput",15),w=co(t,"onchange",15),_=co(t,"onfocus",15),x=co(t,"onblur",15),C=co(t,"type",15,"text"),E=co(t,"rows",15,3),S=co(t,"cols",15,void 0),k=co(t,"resize",15,"vertical"),A=co(t,"blockPaste",15,!1);const T=As({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),get validationSchema(){return h()},componentName:"TextInput",componentType:"text",customValidator:e=>{const t=pc(e,h(),a(),e=>{var t;if(null===(t=h().match)||void 0===t?void 0:t.fieldRef){const e=h().match.fieldRef;if("function"==typeof e)return e();if(e&&"value"in e)return e.value||""}if(e&&"undefined"!=typeof document){const t=document.getElementById(e);if(t&&"value"in t)return t.value||""}return""});return{isValid:t.isValid,error:t.firstError}}}),I=Pc(Fc);let B=Qt(()=>()=>r().length),N=or(!1),z=Qt(()=>Ns(T.state.inputElement));function R(){return{value:r(),rawValue:r(),isValid:T.state.isValid,validationState:T.state.validationState,errorMessage:T.state.errorMessage,characterCount:r().length,maxLength:m(),hasInteracted:T.state.hasInteracted}}function D(e){var t;const a=e.target.value;if(r(a),T.handlers.handleInput(e),c()&&(null===(t=h().match)||void 0===t?void 0:t.fieldId)){const e=new CustomEvent("field-value-changed",{detail:{fieldId:c(),value:a},bubbles:!0,composed:!0});"undefined"!=typeof document&&document.dispatchEvent(e)}ka(z).dispatch(zs,R()),y()&&(ne.info("TextInput: oninput",e),y()(e))}function L(e){if(A())return e.preventDefault(),!1}function U(e){T.handlers.handleChange(e),ka(z).dispatch(Rs,R()),w()&&w()(e)}function P(e){T.handlers.handleFocus(e),ka(z).dispatch(Ds,R()),_()&&_()(e)}function V(e){T.handlers.handleBlur(e),ka(z).dispatch(Ls,R()),x()&&x()(e)}Ur(()=>{Dc(g()&&ka(N),T.state.inputElement,()=>{lr(N,!1)},{buttonSelectors:[".alviere-text-input__reveal-button"]})}),Ur(()=>{var e;if("undefined"!=typeof window&&window.customElements){const r=null===(e=T.state.inputElement)||void 0===e?void 0:e.getRootNode(),a=null==r?void 0:r.host;if(a){const e=a.getAttributeNames(),r=a.getAttribute("validation-schema");if(r)try{h(JSON.parse(r))}catch(t){}const n={};e.includes("validate-email")&&(n.email=!0),e.includes("validate-phone")&&(n.phone=!0),e.includes("validate-url")&&(n.url=!0),e.includes("validate-numeric")&&(n.numeric=!0),e.includes("validate-alphabetic")&&(n.alphabetic=!0),e.includes("validate-alphanumeric")&&(n.alphanumeric=!0);const o=a.getAttribute("validate-postal-code");o&&(n.postalCode={country:o});const i=a.getAttribute("validate-pattern");if(i)try{n.pattern={regex:new RegExp(i)}}catch(t){}const l=a.getAttribute("validate-min-length");l&&(n.minLength=parseInt(l,10));const s=a.getAttribute("validate-max-length");if(s&&(n.maxLength=parseInt(s,10)),Object.keys(n).length>0&&0===Object.keys(h()).length&&h(n),e.includes("help-text")&&f(a.getAttribute("help-text")||""),e.includes("error-message")&&p(a.getAttribute("error-message")||""),e.includes("max-length")){const e=a.getAttribute("max-length");e&&m(parseInt(e,10))}if(e.includes("min-length")){const e=a.getAttribute("min-length");e&&b(parseInt(e,10))}}}}),Ur(()=>{if(h().match&&T.state.hasInteracted&&(h().match.fieldRef,h().match.fieldId&&"undefined"!=typeof document)){const e=e=>{var t,r;if((null===(t=e.detail)||void 0===t?void 0:t.fieldId)===(null===(r=h().match)||void 0===r?void 0:r.fieldId)&&T.state.inputElement){const e=new Event("input",{bubbles:!0});T.handlers.handleInput(e)}};return document.addEventListener("field-value-changed",e),()=>{document.removeEventListener("field-value-changed",e)}}});var M={focus:function(){var e;null===(e=T.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=T.state.inputElement)||void 0===e||e.blur()},isValid:function(){return T.state.isValid},getValidationError:function(){return T.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),T.state.inputElement&&(T.state.inputElement.value="")},select:function(){const e=T.state.inputElement;e&&"select"in e&&e.select()},setSelectionRange:function(e,t){const r=T.state.inputElement;r&&"setSelectionRange"in r&&r.setSelectionRange(e,t)},getComponentMetadata:function(){return{name:"TextInput",type:"text",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!1,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange"]}}},get value(){return r()},set value(e=""){r(e),zt()},get label(){return a()},set label(e=""){a(e),zt()},get placeholder(){return n()},set placeholder(e=""){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get autocomplete(){return v()},set autocomplete(e=""){v(e),zt()},get validationState(){return d()},set validationState(e="neutral"){d(e),zt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),zt()},get helpText(){return f()},set helpText(e=""){f(e),zt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),zt()},get sensitive(){return g()},set sensitive(e=!1){g(e),zt()},get maxlength(){return m()},set maxlength(e=void 0){m(e),zt()},get minlength(){return b()},set minlength(e=void 0){b(e),zt()},get oninput(){return y()},set oninput(e){y(e),zt()},get onchange(){return w()},set onchange(e){w(e),zt()},get onfocus(){return _()},set onfocus(e){_(e),zt()},get onblur(){return x()},set onblur(e){x(e),zt()},get type(){return C()},set type(e="text"){C(e),zt()},get rows(){return E()},set rows(e=3){E(e),zt()},get cols(){return S()},set cols(e=void 0){S(e),zt()},get resize(){return k()},set resize(e="vertical"){k(e),zt()},get blockPaste(){return A()},set blockPaste(e=!1){A(e),zt()}},O=au(),q=Cr(O);let j;var F=Cr(q),K=e=>{var t=Gc(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"for",c()),an(r,a())}),Ha(e,t)};pn(F,e=>{a()&&e(K)});var $=Sr(F,2),H=e=>{var t,a=Wc();t=a,rt&&null!==_r(t)&&kr(t),a.__input=D,a.__change=U,ro(a,e=>T.state.inputElement=e,()=>{var e;return null==(e=null==T?void 0:T.state)?void 0:e.inputElement}),Or(()=>{Vn(a,"id",c()),Vn(a,"name",u()),Vn(a,"placeholder",n()),a.disabled=o(),a.readOnly=l(),a.required=i(),Vn(a,"rows",E()),Vn(a,"cols",S()),Vn(a,"maxlength",m()),Vn(a,"minlength",b()),Vn(a,"autocomplete",v()||null),kn(a,`resize: ${k()??""}`),Vn(a,"aria-invalid","invalid"===T.computed.effectiveValidationState),Vn(a,"aria-describedby",T.state.errorMessage?`${c()}-error`:f()?`${c()}-help`:void 0)}),La("focus",a,P),La("blur",a,V),La("paste",a,L),Xn(a,r),Ha(e,a)},G=e=>{var t=Yc();Dn(t),t.__input=D,t.__change=U,ro(t,e=>T.state.inputElement=e,()=>{var e;return null==(e=null==T?void 0:T.state)?void 0:e.inputElement}),Or(()=>{Vn(t,"id",c()),Vn(t,"name",u()),Vn(t,"placeholder",T.state.isFocused?n():""),t.disabled=o(),t.readOnly=l(),t.required=i(),Vn(t,"maxlength",m()),Vn(t,"minlength",b()),Vn(t,"autocomplete",v()||null),Vn(t,"type",g()&&!ka(N)?"password":"text"),Vn(t,"aria-invalid","invalid"===T.computed.effectiveValidationState),Vn(t,"aria-describedby",T.state.errorMessage?`${c()}-error`:f()?`${c()}-help`:void 0)}),La("focus",t,P),La("blur",t,V),La("paste",t,L),Xn(t,r),Ha(e,t)};pn($,e=>{"textarea"===C()?e(H):e(G,!1)});var W=Sr($,2),Y=e=>{var t=Xc();t.__click=e=>{e.stopPropagation(),lr(N,!ka(N))};var r=Cr(t),a=e=>{Ha(e,Qc())},n=e=>{Ha(e,Jc())};pn(r,e=>{ka(N)?e(a):e(n,!1)}),it(t),Ha(e,t)};pn(W,e=>{g()&&e(Y)});var Q=Sr(W,2),J=e=>{var t=Zc(),r=Cr(t);it(t),Or(()=>an(r,`${ka(B)??""}/${m()??""}`)),Ha(e,t)};pn(Q,e=>{m()&&"textarea"===C()&&e(J)});var X=Sr(Q,2),Z=e=>{Ha(e,eu())};pn(X,e=>{i()&&"neutral"===T.computed.effectiveValidationState&&e(Z)}),it(q);var ee=Sr(q,2),te=Cr(ee),re=e=>{var t=tu(),r=Cr(t);fn(r,()=>I.outerHTML);var a=Sr(r);it(t),Or(()=>{Vn(t,"id",`${c()??""}-help`),an(a,` ${f()??""}`)}),Ha(e,t)};pn(te,e=>{f()&&!T.computed.hasError&&e(re)});var ae=Sr(te,2),oe=e=>{var t=ru(),r=Sr(Cr(t));it(t),Or(()=>{Vn(t,"id",`${c()??""}-error`),an(r,` ${T.state.errorMessage??""}`)}),Ha(e,t)};return pn(ae,e=>{"invalid"===T.state.validationState&&e(oe)}),it(ee),it(O),Or(()=>{En(O,1,`alviere-text-input alviere-text-input--${s()??""}`,"svelte-1auzwdn"),j=En(q,1,"alviere-text-input__wrapper svelte-1auzwdn",null,j,{"alviere-text-input__wrapper--focused":T.state.isFocused,"alviere-text-input__wrapper--disabled":o(),"alviere-text-input__wrapper--readonly":l(),"alviere-text-input__wrapper--valid":"valid"===T.computed.effectiveValidationState,"alviere-text-input__wrapper--invalid":"invalid"===T.computed.effectiveValidationState,"alviere-text-input__wrapper--textarea":"textarea"===C(),"alviere-text-input__wrapper--dirty":""!==r()})}),Ha(e,O),gt(M)}Ua(["input","change","click"]),customElements.define("alviere-text-input",po(ou,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},sensitive:{},maxlength:{},minlength:{},oninput:{},onchange:{},onfocus:{},onblur:{},type:{},rows:{},cols:{},resize:{},blockPaste:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getComponentMetadata"],!0));var iu=qa('<label class="alviere-phone-input__label svelte-15yozux"> </label>'),lu=qa('<span class="alviere-phone-input__character-count svelte-15yozux"> </span>'),su=qa('<div class="alviere-phone-input__required svelte-15yozux">Required</div>'),cu=qa('<div class="alviere-phone-input__error svelte-15yozux" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),uu=qa('<div><div><!> <input type="tel"/> <!></div> <div class="alviere-phone-input__validation-messages svelte-15yozux"><!> <!></div></div>');const vu={hash:"svelte-15yozux",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, \'Helvetica Neue\', Arial, sans-serif;--alv-font-family-grotesque: \'Darker Grotesque\', sans-serif;--alv-font-family-mono: \'Monaco\', \'Menlo\', \'Ubuntu Mono\', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-phone-input.svelte-15yozux {position:relative;width:100%;}.alviere-phone-input__label.svelte-15yozux {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-phone-input__required.svelte-15yozux {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-phone-input__error.svelte-15yozux {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-phone-input__wrapper.svelte-15yozux {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-phone-input__wrapper--focused.svelte-15yozux {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-text-input__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-phone-input__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-date-of-birth-input__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-search-select__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-currency-input__label:where(.svelte-15yozux) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-text-input__input:where(.svelte-15yozux)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-phone-input__input:where(.svelte-15yozux)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-date-of-birth-input__input:where(.svelte-15yozux)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-search-select__input:where(.svelte-15yozux)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-currency-input__input:where(.svelte-15yozux)::placeholder {opacity:1;}.alviere-phone-input__wrapper--dirty.svelte-15yozux .alviere-text-input__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--dirty.svelte-15yozux .alviere-phone-input__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--dirty.svelte-15yozux .alviere-date-of-birth-input__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--dirty.svelte-15yozux .alviere-search-select__label:where(.svelte-15yozux),\n.alviere-phone-input__wrapper--dirty.svelte-15yozux .alviere-currency-input__label:where(.svelte-15yozux) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-phone-input__wrapper--disabled.svelte-15yozux {background:#f4f4f5;cursor:not-allowed;}.alviere-phone-input__wrapper--readonly.svelte-15yozux {background:#f4f4f5;cursor:default;}.alviere-phone-input__wrapper--valid.svelte-15yozux {border-color:#436b1d;}.alviere-phone-input__wrapper--invalid.svelte-15yozux {border-color:#b3311f;}.alviere-phone-input__input.svelte-15yozux {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-phone-input__input.svelte-15yozux::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-phone-input__input.svelte-15yozux:disabled {cursor:not-allowed;color:#52525b;}.alviere-phone-input__input.svelte-15yozux:read-only {cursor:default;color:#3f3f46;}.alviere-phone-input__validation-messages.svelte-15yozux {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-phone-input--sm.svelte-15yozux .alviere-phone-input__wrapper:where(.svelte-15yozux) {min-height:2.5rem;}.alviere-phone-input--sm.svelte-15yozux .alviere-phone-input__input:where(.svelte-15yozux) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-phone-input--sm.svelte-15yozux .alviere-phone-input__textarea:where(.svelte-15yozux) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-phone-input--sm.svelte-15yozux .alviere-phone-input__label:where(.svelte-15yozux) {font-size:1rem;}.alviere-phone-input--md.svelte-15yozux .alviere-phone-input__wrapper:where(.svelte-15yozux) {min-height:3.25rem;}.alviere-phone-input--md.svelte-15yozux .alviere-phone-input__input:where(.svelte-15yozux) {font-size:1rem;}.alviere-phone-input--md.svelte-15yozux .alviere-phone-input__textarea:where(.svelte-15yozux) {font-size:1.25rem;}.alviere-phone-input--lg.svelte-15yozux .alviere-phone-input__wrapper:where(.svelte-15yozux) {min-height:3.75rem;}.alviere-phone-input--lg.svelte-15yozux .alviere-phone-input__input:where(.svelte-15yozux) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-phone-input--lg.svelte-15yozux .alviere-phone-input__textarea:where(.svelte-15yozux) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-phone-input--lg.svelte-15yozux .alviere-phone-input__label:where(.svelte-15yozux) {font-size:1.25rem;}.alviere-phone-input.svelte-15yozux:focus-within .alviere-phone-input__wrapper:where(.svelte-15yozux):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-phone-input__character-count.svelte-15yozux {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;color:#52525b;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;letter-spacing:0.05em;opacity:0.8;}.alviere-exp-input--sm.svelte-15yozux .alviere-phone-input__character-count:where(.svelte-15yozux) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-exp-input--lg.svelte-15yozux .alviere-phone-input__character-count:where(.svelte-15yozux) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-phone-input__wrapper--focused.svelte-15yozux .alviere-phone-input__character-count:where(.svelte-15yozux) {opacity:1;}.alviere-phone-input__success-message.svelte-15yozux {margin-top:0.25rem;font-size:1.125rem;color:#436b1d;line-height:1.25;}'};function du(e,t){ht(t,!0),mn(e,vu);let r=co(t,"value",15,""),a=co(t,"label",15,"Phone Number"),n=co(t,"placeholder",15,"Enter phone number"),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"autocomplete",15,"tel"),d=co(t,"validationState",15,"neutral"),p=co(t,"errorMessage",15,""),f=co(t,"helpText",15,""),h=co(t,"validationSchema",31,()=>dr({})),g=co(t,"oninput",15),m=co(t,"onchange",15),b=co(t,"onfocus",15),y=co(t,"onblur",15);const w=As({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"PhoneInput",componentType:"phone",customValidator:e=>{const t=Ts.phone(e);if(t)return{isValid:!1,error:t};const r=pc(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let _=Qt(()=>r().length),x=Qt(()=>Ns(w.state.inputElement));function C(){return{value:r(),rawValue:r(),isValid:w.state.isValid,validationState:w.state.validationState,errorMessage:w.state.errorMessage,hasInteracted:w.state.hasInteracted,formattedValue:r(),countryCode:E(r())}}function E(e){if(!e||!e.startsWith("+"))return;const t=e.match(/^\+(\d{1,3})/);return t?t[1]:void 0}vn(()=>{w.state.inputElement}),Ur(()=>{lr(_,r().length)});const S=Qt(()=>["alviere-phone-input__wrapper",""!==r()?"alviere-phone-input__wrapper--dirty":"",w.state.isFocused?"alviere-phone-input__wrapper--focused":"","invalid"===w.computed.effectiveValidationState?"alviere-phone-input__wrapper--invalid":"","valid"===w.computed.effectiveValidationState?"alviere-phone-input__wrapper--valid":"",o()?"alviere-phone-input__wrapper--disabled":""].filter(Boolean).join(" "));var k={focus:function(){var e;null===(e=w.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=w.state.inputElement)||void 0===e||e.blur()},isValid:function(){return w.state.isValid},getValidationError:function(){return w.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),w.state.inputElement&&(w.state.inputElement.value="")},select:function(){w.state.inputElement&&"select"in w.state.inputElement&&w.state.inputElement.select()},setSelectionRange:function(e,t){w.state.inputElement&&"setSelectionRange"in w.state.inputElement&&w.state.inputElement.setSelectionRange(e,t)},getFormattedValue:function(){return r()},getRawValue:function(){return r().replace(/\D/g,"")},getComponentMetadata:function(){return{name:"PhoneInput",type:"phone",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue"]}}},get value(){return r()},set value(e=""){r(e),zt()},get label(){return a()},set label(e="Phone Number"){a(e),zt()},get placeholder(){return n()},set placeholder(e="Enter phone number"){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get autocomplete(){return v()},set autocomplete(e="tel"){v(e),zt()},get validationState(){return d()},set validationState(e="neutral"){d(e),zt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),zt()},get helpText(){return f()},set helpText(e=""){f(e),zt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),zt()},get oninput(){return g()},set oninput(e){g(e),zt()},get onchange(){return m()},set onchange(e){m(e),zt()},get onfocus(){return b()},set onfocus(e){b(e),zt()},get onblur(){return y()},set onblur(e){y(e),zt()}},A=uu(),T=Cr(A),I=Cr(T),B=e=>{var t=iu(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"for",c()||"phone-input"),an(r,a())}),Ha(e,t)};pn(I,e=>{a()&&e(B)});var N=Sr(I,2);Dn(N),N.__input=function(e){ne.info("PhoneInput: handleInput",e);const t=e.target;let a=t.value;if(a&&!a.startsWith("+")&&(a="+"+a),a.startsWith("+")){const e=a.substring(1);a="+"+e.replace(/[^\d]/g,"")}a.length>20&&(a=a.substring(0,20)),r(a),t.value=a,w.handlers.handleInput(e),ka(x).dispatch(Ws,C()),g()&&(ne.info("PhoneInput: oninput",e),g()(e))},N.__change=function(e){w.handlers.handleChange(e),ne.info("PhoneInput: handleChange",e),ka(x).dispatch(Ys,C()),m()&&m()({detail:{value:r()}})},N.__keydown=function(e){/[\d+]/.test(e.key)||["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)||e.preventDefault()},ro(N,e=>w.state.inputElement=e,()=>{var e;return null==(e=null==w?void 0:w.state)?void 0:e.inputElement});var z=Sr(N,2),R=e=>{var t=lu(),r=Cr(t);it(t),Or(()=>an(r,`${ka(_)??""}/20`)),Ha(e,t)};pn(z,e=>{ka(_)>0&&e(R)}),it(T);var D=Sr(T,2),L=Cr(D),U=e=>{Ha(e,su())};pn(L,e=>{i()&&"neutral"===w.computed.effectiveValidationState&&e(U)});var P=Sr(L,2),V=e=>{var t=cu(),r=Sr(Cr(t));it(t),Or(()=>{Vn(t,"id",`${(c()||"pohne-input")??""}-error`),an(r,` ${w.state.errorMessage??""}`)}),Ha(e,t)};return pn(P,e=>{"invalid"===w.state.validationState&&e(V)}),it(D),it(A),Or(()=>{En(A,1,`alviere-phone-input alviere-phone-input--${s()??""}`,"svelte-15yozux"),En(T,1,wn(ka(S)),"svelte-15yozux"),Vn(N,"id",c()||"phone-input"),Vn(N,"name",u()),Vn(N,"placeholder",w.state.isFocused?n():""),Ln(N,r()),N.required=i(),N.disabled=o(),N.readOnly=l(),Vn(N,"autocomplete",v()),En(N,1,`alviere-phone-input__input alviere-phone-input__input--${s()??""}`,"svelte-15yozux"),Vn(N,"aria-describedby",w.state.errorMessage?`${c()||"phone-input"}-error`:void 0)}),La("focus",N,function(){w.handlers.handleFocus(),ka(x).dispatch(Qs,C()),b()&&b()(event)}),La("blur",N,function(e){w.handlers.handleBlur(e),ka(x).dispatch(Js,C()),y()&&y()(e)}),Ha(e,A),gt(k)}Ua(["input","change","keydown"]),customElements.define("alviere-phone-input",po(du,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getComponentMetadata"],!0));var pu=qa('<label class="alviere-date-of-birth-input__label svelte-1ooun91"> </label>'),fu=qa('<div class="alviere-date-of-birth-input__required svelte-1ooun91">Required</div>'),hu=qa('<div class="alviere-date-of-birth-input__error svelte-1ooun91" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),gu=qa('<div><div><!> <input type="text" maxlength="10"/></div> <div class="alviere-date-of-birth-input__validation-messages svelte-1ooun91"><!> <!></div></div>');const mu={hash:"svelte-1ooun91",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-date-of-birth-input.svelte-1ooun91 {position:relative;width:100%;}.alviere-date-of-birth-input__label.svelte-1ooun91 {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-date-of-birth-input__required.svelte-1ooun91 {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-date-of-birth-input__error.svelte-1ooun91 {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-date-of-birth-input__wrapper.svelte-1ooun91 {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-text-input__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-phone-input__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-date-of-birth-input__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-search-select__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-currency-input__label:where(.svelte-1ooun91) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-text-input__input:where(.svelte-1ooun91)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-phone-input__input:where(.svelte-1ooun91)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-date-of-birth-input__input:where(.svelte-1ooun91)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-search-select__input:where(.svelte-1ooun91)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ooun91 .alviere-currency-input__input:where(.svelte-1ooun91)::placeholder {opacity:1;}.alviere-date-of-birth-input__wrapper--dirty.svelte-1ooun91 .alviere-text-input__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ooun91 .alviere-phone-input__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ooun91 .alviere-date-of-birth-input__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ooun91 .alviere-search-select__label:where(.svelte-1ooun91),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ooun91 .alviere-currency-input__label:where(.svelte-1ooun91) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-date-of-birth-input__wrapper--disabled.svelte-1ooun91 {background:#f4f4f5;cursor:not-allowed;}.alviere-date-of-birth-input__wrapper--readonly.svelte-1ooun91 {background:#f4f4f5;cursor:default;}.alviere-date-of-birth-input__wrapper--valid.svelte-1ooun91 {border-color:#436b1d;}.alviere-date-of-birth-input__wrapper--invalid.svelte-1ooun91 {border-color:#b3311f;}.alviere-date-of-birth-input__input.svelte-1ooun91 {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-date-of-birth-input__input.svelte-1ooun91::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;}.alviere-date-of-birth-input__input.svelte-1ooun91:disabled {cursor:not-allowed;color:#52525b;}.alviere-date-of-birth-input__input.svelte-1ooun91:read-only {cursor:default;color:#3f3f46;}.alviere-date-of-birth-input__validation-messages.svelte-1ooun91 {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-date-of-birth-input--sm.svelte-1ooun91 .alviere-date-of-birth-input__wrapper:where(.svelte-1ooun91) {min-height:2.5rem;}.alviere-date-of-birth-input--sm.svelte-1ooun91 .alviere-date-of-birth-input__input:where(.svelte-1ooun91) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-date-of-birth-input--sm.svelte-1ooun91 .alviere-date-of-birth-input__textarea:where(.svelte-1ooun91) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-date-of-birth-input--sm.svelte-1ooun91 .alviere-date-of-birth-input__label:where(.svelte-1ooun91) {font-size:1rem;}.alviere-date-of-birth-input--md.svelte-1ooun91 .alviere-date-of-birth-input__wrapper:where(.svelte-1ooun91) {min-height:3.25rem;}.alviere-date-of-birth-input--md.svelte-1ooun91 .alviere-date-of-birth-input__input:where(.svelte-1ooun91) {font-size:1rem;}.alviere-date-of-birth-input--md.svelte-1ooun91 .alviere-date-of-birth-input__textarea:where(.svelte-1ooun91) {font-size:1.25rem;}.alviere-date-of-birth-input--lg.svelte-1ooun91 .alviere-date-of-birth-input__wrapper:where(.svelte-1ooun91) {min-height:3.75rem;}.alviere-date-of-birth-input--lg.svelte-1ooun91 .alviere-date-of-birth-input__input:where(.svelte-1ooun91) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-date-of-birth-input--lg.svelte-1ooun91 .alviere-date-of-birth-input__textarea:where(.svelte-1ooun91) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-date-of-birth-input--lg.svelte-1ooun91 .alviere-date-of-birth-input__label:where(.svelte-1ooun91) {font-size:1.25rem;}.alviere-date-of-birth-input.svelte-1ooun91:focus-within .alviere-date-of-birth-input__wrapper:where(.svelte-1ooun91):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-date-of-birth-input__success-message.svelte-1ooun91 {color:#436b1d;font-size:0.875rem;margin-top:0.25rem;font-weight:500;}"};function bu(e,t){ht(t,!0),mn(e,mu);let r=co(t,"value",15,""),a=co(t,"label",15,"Date of Birth"),n=co(t,"placeholder",15,"YYYY-MM-DD"),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"autocomplete",15,"bday"),d=co(t,"validationState",15,"neutral"),p=co(t,"errorMessage",15,""),f=co(t,"helpText",15,""),h=co(t,"validationSchema",31,()=>dr({})),g=co(t,"oninput",15),m=co(t,"onchange",15),b=co(t,"onfocus",15),y=co(t,"onblur",15);const w=As({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"DateOfBirthInput",componentType:"date",customValidator:e=>{if(e&&10===e.length){const[t,r,a]=e.split("-").map(Number),n=new Date(t,r-1,a),o=new Date,i=o.getFullYear()-n.getFullYear();if(isNaN(n.getTime()))return{isValid:!1,error:"Please enter a valid date"};if(n>o)return{isValid:!1,error:"Date of birth cannot be in the future"};if(i<0)return{isValid:!1,error:"Must be at least 13 years old"}}const t=pc(e,h(),a());return{isValid:t.isValid,error:t.firstError}}});let _=Qt(()=>Ns(w.state.inputElement));function x(){return{value:r(),rawValue:r(),isValid:w.state.isValid,validationState:w.state.validationState,errorMessage:w.state.errorMessage,hasInteracted:w.state.hasInteracted,characterCount:r().length,maxLength:10}}vn(()=>{});const C=Qt(()=>["alviere-date-of-birth-input__wrapper",w.state.isFocused?"alviere-date-of-birth-input__wrapper--focused":"",w.state.errorMessage?"alviere-date-of-birth-input__wrapper--invalid":"",!w.state.errorMessage&&r()&&10===r().length?"alviere-date-of-birth-input__wrapper--valid":"",o()?"alviere-date-of-birth-input__wrapper--disabled":"",""!==r()?"alviere-date-of-birth-input__wrapper--dirty":""].filter(Boolean).join(" "));function E(){return w.state.isValid}var S={focus:function(){var e;null===(e=w.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=w.state.inputElement)||void 0===e||e.blur()},isValid:E,getValidationError:function(){return w.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),w.state.inputElement&&(w.state.inputElement.value="")},select:function(){w.state.inputElement&&"select"in w.state.inputElement&&w.state.inputElement.select()},setSelectionRange:function(e,t){w.state.inputElement&&"setSelectionRange"in w.state.inputElement&&w.state.inputElement.setSelectionRange(e,t)},getAge:function(){if(!r()||!E())return null;const e=new Date(r()),t=new Date;let a=t.getFullYear()-e.getFullYear();const n=t.getMonth()-e.getMonth();return(n<0||0===n&&t.getDate()<e.getDate())&&a--,a>=0?a:null},getDate:function(){return r()&&E()?new Date(r()):null},getComponentMetadata:function(){return{name:"DateOfBirthInput",type:"date",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getAge","getDate"]}}},get value(){return r()},set value(e=""){r(e),zt()},get label(){return a()},set label(e="Date of Birth"){a(e),zt()},get placeholder(){return n()},set placeholder(e="YYYY-MM-DD"){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get autocomplete(){return v()},set autocomplete(e="bday"){v(e),zt()},get validationState(){return d()},set validationState(e="neutral"){d(e),zt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),zt()},get helpText(){return f()},set helpText(e=""){f(e),zt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),zt()},get oninput(){return g()},set oninput(e){g(e),zt()},get onchange(){return m()},set onchange(e){m(e),zt()},get onfocus(){return b()},set onfocus(e){b(e),zt()},get onblur(){return y()},set onblur(e){y(e),zt()}},k=gu(),A=Cr(k),T=Cr(A),I=e=>{var t=pu(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"for",c()||"date-of-birth-input"),an(r,a())}),Ha(e,t)};pn(T,e=>{a()&&e(I)});var B=Sr(T,2);Dn(B),B.__input=function(e){const t=e.target;let a=t.value;a=a.replace(/[^\d-]/g,""),a.length>=4&&!a.includes("-")&&(a=a.substring(0,4)+"-"+a.substring(4)),a.length>=7&&2===a.split("-").length&&(a=a.substring(0,7)+"-"+a.substring(7)),a.length>10&&(a=a.substring(0,10)),r(a),t.value=a,w.handlers.handleInput(e),ka(_).dispatch(zs,x()),g()&&g()(e)},B.__change=function(){ne.info("DateOfBirthInput: handleChange",event),ka(_).dispatch(Rs,x()),m()&&m()(event)},B.__keydown=function(e){/[\d-]/.test(e.key)||["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)||e.preventDefault()},ro(B,e=>w.state.inputElement=e,()=>{var e;return null==(e=null==w?void 0:w.state)?void 0:e.inputElement}),it(A);var N=Sr(A,2),z=Cr(N),R=e=>{Ha(e,fu())};pn(z,e=>{i()&&"neutral"===w.computed.effectiveValidationState&&e(R)});var D=Sr(z,2),L=e=>{var t=hu(),r=Sr(Cr(t));it(t),Or(()=>{Vn(t,"id",`${(c()||"date-of-birth-input")??""}-error`),an(r,` ${w.state.errorMessage??""}`)}),Ha(e,t)};return pn(D,e=>{"invalid"===w.state.validationState&&e(L)}),it(N),it(k),Or(()=>{En(k,1,`alviere-date-of-birth-input alviere-date-of-birth-input--${s()??""}`,"svelte-1ooun91"),En(A,1,wn(ka(C)),"svelte-1ooun91"),Vn(B,"id",c()||"date-of-birth-input"),Vn(B,"name",u()),Vn(B,"placeholder",w.state.isFocused?n():""),Ln(B,r()),B.required=i(),B.disabled=o(),B.readOnly=l(),Vn(B,"autocomplete",v()),En(B,1,`alviere-date-of-birth-input__input alviere-date-of-birth-input__input--${s()??""}`,"svelte-1ooun91"),Vn(B,"aria-describedby",w.state.errorMessage?`${c()||"date-of-birth-input"}-error`:void 0)}),La("focus",B,function(e){w.handlers.handleFocus(),ka(_).dispatch(Ds,x()),b()&&b()(e)}),La("blur",B,function(){w.handlers.handleBlur(),ka(_).dispatch(Ls,x()),y()&&y()(event)}),Ha(e,k),gt(S)}Ua(["input","change","keydown"]),customElements.define("alviere-date-of-birth-input",po(bu,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getAge","getDate","getComponentMetadata"],!0));var yu=qa('<label class="alviere-currency-input__label svelte-qcuhgv"> </label>'),wu=qa('<div class="alviere-currency-input__required svelte-qcuhgv">Required</div>'),_u=qa('<div class="alviere-currency-input__error svelte-qcuhgv" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),xu=qa('<div class="alviere-currency-input__help-text"> </div>'),Cu=qa('<div><div><!> <input type="text" inputmode="numeric"/></div> <div class="alviere-currency-input__validation-messages svelte-qcuhgv"><!> <!> <!></div></div>');const Eu={hash:"svelte-qcuhgv",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-currency-input.svelte-qcuhgv {position:relative;width:100%;}.alviere-currency-input__label.svelte-qcuhgv {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-currency-input__required.svelte-qcuhgv {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-currency-input__error.svelte-qcuhgv {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-currency-input__wrapper.svelte-qcuhgv {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-currency-input__wrapper--focused.svelte-qcuhgv {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-text-input__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-phone-input__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-date-of-birth-input__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-search-select__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-currency-input__label:where(.svelte-qcuhgv) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-text-input__input:where(.svelte-qcuhgv)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-phone-input__input:where(.svelte-qcuhgv)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-date-of-birth-input__input:where(.svelte-qcuhgv)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-search-select__input:where(.svelte-qcuhgv)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-qcuhgv .alviere-currency-input__input:where(.svelte-qcuhgv)::placeholder {opacity:1;}.alviere-currency-input__wrapper--dirty.svelte-qcuhgv .alviere-text-input__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--dirty.svelte-qcuhgv .alviere-phone-input__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--dirty.svelte-qcuhgv .alviere-date-of-birth-input__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--dirty.svelte-qcuhgv .alviere-search-select__label:where(.svelte-qcuhgv),\n.alviere-currency-input__wrapper--dirty.svelte-qcuhgv .alviere-currency-input__label:where(.svelte-qcuhgv) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-currency-input__wrapper--disabled.svelte-qcuhgv {background:#f4f4f5;cursor:not-allowed;}.alviere-currency-input__wrapper--readonly.svelte-qcuhgv {background:#f4f4f5;cursor:default;}.alviere-currency-input__wrapper--valid.svelte-qcuhgv {border-color:#436b1d;}.alviere-currency-input__wrapper--invalid.svelte-qcuhgv {border-color:#b3311f;}.alviere-currency-input__input.svelte-qcuhgv {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-currency-input__input.svelte-qcuhgv::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;}.alviere-currency-input__input.svelte-qcuhgv:disabled {cursor:not-allowed;color:#52525b;}.alviere-currency-input__input.svelte-qcuhgv:read-only {cursor:default;color:#3f3f46;}.alviere-currency-input__validation-messages.svelte-qcuhgv {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-currency-input--sm.svelte-qcuhgv .alviere-currency-input__wrapper:where(.svelte-qcuhgv) {min-height:2.5rem;}.alviere-currency-input--sm.svelte-qcuhgv .alviere-currency-input__input:where(.svelte-qcuhgv) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-currency-input--sm.svelte-qcuhgv .alviere-currency-input__textarea:where(.svelte-qcuhgv) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-currency-input--sm.svelte-qcuhgv .alviere-currency-input__label:where(.svelte-qcuhgv) {font-size:1rem;}.alviere-currency-input--md.svelte-qcuhgv .alviere-currency-input__wrapper:where(.svelte-qcuhgv) {min-height:3.25rem;}.alviere-currency-input--md.svelte-qcuhgv .alviere-currency-input__input:where(.svelte-qcuhgv) {font-size:1rem;}.alviere-currency-input--md.svelte-qcuhgv .alviere-currency-input__textarea:where(.svelte-qcuhgv) {font-size:1.25rem;}.alviere-currency-input--lg.svelte-qcuhgv .alviere-currency-input__wrapper:where(.svelte-qcuhgv) {min-height:3.75rem;}.alviere-currency-input--lg.svelte-qcuhgv .alviere-currency-input__input:where(.svelte-qcuhgv) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-currency-input--lg.svelte-qcuhgv .alviere-currency-input__textarea:where(.svelte-qcuhgv) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-currency-input--lg.svelte-qcuhgv .alviere-currency-input__label:where(.svelte-qcuhgv) {font-size:1.25rem;}.alviere-currency-input.svelte-qcuhgv:focus-within .alviere-currency-input__wrapper:where(.svelte-qcuhgv):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-currency-input__input.svelte-qcuhgv {font-variant-numeric:tabular-nums;letter-spacing:0.02em;}"};function Su(e,t){ht(t,!0),mn(e,Eu);let r=co(t,"value",15,""),a=co(t,"label",15,"Amount"),n=co(t,"placeholder",15,"0.00"),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"autocomplete",15,""),d=co(t,"validationState",15,"neutral"),p=co(t,"errorMessage",15,""),f=co(t,"helpText",15,""),h=co(t,"validationSchema",31,()=>dr({})),g=co(t,"oninput",15),m=co(t,"onchange",15),b=co(t,"onfocus",15),y=co(t,"onblur",15),w=co(t,"currency",15,"USD"),_=co(t,"locale",15,"en-US"),x=or(0);function C(e){try{const t=e/100;return new Intl.NumberFormat(_(),{style:"currency",currency:w(),minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(t){return ne.error("CurrencyInput: Error formatting currency",t),`${function(){try{return new Intl.NumberFormat(_(),{style:"currency",currency:w(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch(t){return ne.error("CurrencyInput: Error getting currency symbol",t),"$"}}()}${(e/100).toFixed(2)}`}}function E(e){if(!e&&0!==e)return 0;const t=String(e).replace(/\D/g,"");return t?parseInt(t,10):0}if(r()){const e=E(r());lr(x,e,!0),r(C(e))}const S=As({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"CurrencyInput",componentType:"text",customValidator:e=>{if(e){const t=E(e);if(isNaN(t))return{isValid:!1,error:"Please enter a valid amount"};if(t<0)return{isValid:!1,error:"Amount must be positive"}}const t=pc(e,h(),a());return{isValid:t.isValid,error:t.firstError}}});let k=Qt(()=>Ns(S.state.inputElement));function A(){return{value:r(),rawValue:(ka(x)/100).toFixed(2).toString(),isValid:S.state.isValid,validationState:S.state.validationState,errorMessage:S.state.errorMessage,hasInteracted:S.state.hasInteracted,characterCount:r().length}}Ur(()=>{ka(x)>0&&r(C(ka(x)))});const T=Qt(()=>["alviere-currency-input__wrapper",S.state.isFocused?"alviere-currency-input__wrapper--focused":"",S.state.errorMessage?"alviere-currency-input__wrapper--invalid":"",!S.state.errorMessage&&r()&&ka(x)>0?"alviere-currency-input__wrapper--valid":"",o()?"alviere-currency-input__wrapper--disabled":"",""!==r()?"alviere-currency-input__wrapper--dirty":""].filter(Boolean).join(" "));function I(e){lr(x,e,!0),r(C(e))}var B={focus:function(){var e;null===(e=S.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=S.state.inputElement)||void 0===e||e.blur()},isValid:function(){return S.state.isValid},getValidationError:function(){return S.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),lr(x,0),S.state.inputElement&&(S.state.inputElement.value="")},select:function(){S.state.inputElement&&"select"in S.state.inputElement&&S.state.inputElement.select()},setSelectionRange:function(e,t){S.state.inputElement&&"setSelectionRange"in S.state.inputElement&&S.state.inputElement.setSelectionRange(e,t)},getFormattedValue:function(){return r()},getRawValue:function(){return ka(x)},getValueInMajorUnits:function(){return ka(x)/100},getValueInMinorUnits:function(){return ka(x)},setValue:I,setValueInMajorUnits:function(e){I(Math.round(100*e))},getComponentMetadata:function(){return{name:"CurrencyInput",type:"currency",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getValueInMajorUnits","getValueInMinorUnits","setValue","setValueInMajorUnits"]}}},get value(){return r()},set value(e=""){r(e),zt()},get label(){return a()},set label(e="Amount"){a(e),zt()},get placeholder(){return n()},set placeholder(e="0.00"){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get autocomplete(){return v()},set autocomplete(e=""){v(e),zt()},get validationState(){return d()},set validationState(e="neutral"){d(e),zt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),zt()},get helpText(){return f()},set helpText(e=""){f(e),zt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),zt()},get oninput(){return g()},set oninput(e){g(e),zt()},get onchange(){return m()},set onchange(e){m(e),zt()},get onfocus(){return b()},set onfocus(e){b(e),zt()},get onblur(){return y()},set onblur(e){y(e),zt()},get currency(){return w()},set currency(e="USD"){w(e),zt()},get locale(){return _()},set locale(e="en-US"){_(e),zt()}},N=Cu(),z=Cr(N),R=Cr(z),D=e=>{var t=yu(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"for",c()||"currency-input"),an(r,a())}),Ha(e,t)};pn(R,e=>{a()&&e(D)});var L=Sr(R,2);Dn(L),L.__input=function(e){const t=e.target,a=t.value.replace(/\D/g,""),n=r().replace(/\D/g,"");if(a===n&&0===a.length)lr(x,0);else if(0===a.length)lr(x,0);else if(a.length===n.length&&a===n);else{const e=parseInt(a,10)||0;if(n.length>0&&a.length===n.length+1){const e=a[a.length-1];lr(x,10*ka(x)+parseInt(e,10))}else n.length>0&&a.length===n.length-1?lr(x,Math.floor(ka(x)/10),!0):lr(x,e,!0)}const o=C(ka(x));r(o),t.value=o,setTimeout(()=>{const e=o.length;t.setSelectionRange(e,e)},0),S.handlers.handleInput(e),ka(k).dispatch(zs,A()),g()&&g()(e)},L.__change=function(e){ne.info("CurrencyInput: handleChange",e),ka(k).dispatch(Rs,A()),m()&&m()(e)},L.__keydown=function(e){const t=e.target;if("Backspace"===e.key){e.preventDefault(),lr(x,Math.floor(ka(x)/10),!0);const a=C(ka(x));r(a),t.value=a,setTimeout(()=>{const e=a.length;t.setSelectionRange(e,e)},0);const n=new Event("input",{bubbles:!0});return void t.dispatchEvent(n)}if("Delete"===e.key){e.preventDefault(),lr(x,Math.floor(ka(x)/10),!0);const a=C(ka(x));r(a),t.value=a,setTimeout(()=>{const e=a.length;t.setSelectionRange(e,e)},0);const n=new Event("input",{bubbles:!0});return void t.dispatchEvent(n)}/\d/.test(e.key)||["Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)||e.preventDefault()},ro(L,e=>S.state.inputElement=e,()=>{var e;return null==(e=null==S?void 0:S.state)?void 0:e.inputElement}),it(z);var U=Sr(z,2),P=Cr(U),V=e=>{Ha(e,wu())};pn(P,e=>{i()&&"neutral"===S.computed.effectiveValidationState&&e(V)});var M=Sr(P,2),O=e=>{var t=_u(),r=Sr(Cr(t));it(t),Or(()=>{Vn(t,"id",`${(c()||"currency-input")??""}-error`),an(r,` ${S.state.errorMessage??""}`)}),Ha(e,t)};pn(M,e=>{"invalid"===S.state.validationState&&e(O)});var q=Sr(M,2),j=e=>{var t=xu(),r=Cr(t,!0);it(t),Or(()=>an(r,f())),Ha(e,t)};return pn(q,e=>{f()&&!S.state.errorMessage&&e(j)}),it(U),it(N),Or(()=>{En(N,1,`alviere-currency-input alviere-currency-input--${s()??""}`,"svelte-qcuhgv"),En(z,1,wn(ka(T)),"svelte-qcuhgv"),Vn(L,"id",c()||"currency-input"),Vn(L,"name",u()),Vn(L,"placeholder",S.state.isFocused?n():""),Ln(L,r()),L.required=i(),L.disabled=o(),L.readOnly=l(),Vn(L,"autocomplete",v()),En(L,1,`alviere-currency-input__input alviere-currency-input__input--${s()??""}`,"svelte-qcuhgv"),Vn(L,"aria-invalid","invalid"===S.state.validationState?"true":void 0),Vn(L,"aria-describedby",S.state.errorMessage?`${c()||"currency-input"}-error`:void 0)}),La("focus",L,function(e){S.handlers.handleFocus(),ka(k).dispatch(Ds,A()),b()&&b()(e)}),La("blur",L,function(e){S.handlers.handleBlur(e),ka(k).dispatch(Ls,A()),y()&&y()(e)}),Ha(e,N),gt(B)}Ua(["input","change","keydown"]),customElements.define("alviere-currency-input",po(Su,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{},currency:{},locale:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getValueInMajorUnits","getValueInMinorUnits","setValue","setValueInMajorUnits","getComponentMetadata"],!0));var ku=qa('<label class="alviere-search-select__label svelte-roni7d"> </label>'),Au=qa('<div class="alviere-search-select__display-value svelte-roni7d"> </div>'),Tu=qa('<button type="button" class="alviere-search-select__clear-button svelte-roni7d" aria-label="Clear selection"><!></button>'),Iu=qa('<div class="alviere-search-select__loading-message svelte-roni7d"> </div>'),Bu=qa('<div class="alviere-search-select__no-options-message svelte-roni7d"> </div>'),Nu=qa('<div role="option" tabindex="0"> </div>'),zu=qa('<div id="search-select-dropdown" class="alviere-search-select__dropdown svelte-roni7d" role="listbox"><div class="alviere-search-select__options-list svelte-roni7d"><!></div></div>'),Ru=qa('<div class="alviere-search-select__required svelte-roni7d">Required</div>'),Du=qa('<div class="alviere-search-select__help svelte-roni7d"> </div>'),Lu=qa('<div class="alviere-search-select__error svelte-roni7d" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Uu=qa('<div><div class="alviere-search-select__container svelte-roni7d"><div><!> <input type="text" class="alviere-search-select__input svelte-roni7d" autocomplete="off" role="combobox" aria-haspopup="listbox" aria-controls="search-select-dropdown"/> <!> <div class="alviere-search-select__actions svelte-roni7d"><!> <div><!></div></div></div> <!></div> <div class="alviere-search-select__validation-messages svelte-roni7d"><!> <!> <!></div></div>');const Pu={hash:"svelte-roni7d",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, \'Helvetica Neue\', Arial, sans-serif;--alv-font-family-grotesque: \'Darker Grotesque\', sans-serif;--alv-font-family-mono: \'Monaco\', \'Menlo\', \'Ubuntu Mono\', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-search-select.svelte-roni7d {position:relative;width:100%;}.alviere-search-select__label.svelte-roni7d {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-search-select__required.svelte-roni7d {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-search-select__error.svelte-roni7d {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-search-select__wrapper.svelte-roni7d {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-search-select__wrapper--focused.svelte-roni7d {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}\n.alviere-search-select__wrapper--focused.svelte-roni7d .alviere-search-select__label:where(.svelte-roni7d) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}\n.alviere-search-select__wrapper--focused.svelte-roni7d .alviere-search-select__input:where(.svelte-roni7d)::placeholder {opacity:1;}\n.alviere-search-select__wrapper--dirty.svelte-roni7d .alviere-search-select__label:where(.svelte-roni7d) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-search-select__wrapper--disabled.svelte-roni7d {background:#f4f4f5;cursor:not-allowed;}.alviere-search-select__wrapper--readonly.svelte-roni7d {background:#f4f4f5;cursor:default;}.alviere-search-select__wrapper--valid.svelte-roni7d {border-color:#436b1d;}.alviere-search-select__wrapper--invalid.svelte-roni7d {border-color:#b3311f;}.alviere-search-select__input.svelte-roni7d {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-search-select__input.svelte-roni7d::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__input.svelte-roni7d:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__input.svelte-roni7d:read-only {cursor:default;color:#3f3f46;}.alviere-search-select__validation-messages.svelte-roni7d {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-search-select--sm.svelte-roni7d .alviere-search-select__wrapper:where(.svelte-roni7d) {min-height:2.5rem;}.alviere-search-select--sm.svelte-roni7d .alviere-search-select__input:where(.svelte-roni7d) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-search-select--sm.svelte-roni7d .alviere-search-select__label:where(.svelte-roni7d) {font-size:1rem;}.alviere-search-select--md.svelte-roni7d .alviere-search-select__wrapper:where(.svelte-roni7d) {min-height:3.25rem;}.alviere-search-select--md.svelte-roni7d .alviere-search-select__input:where(.svelte-roni7d) {font-size:1rem;}.alviere-search-select--lg.svelte-roni7d .alviere-search-select__wrapper:where(.svelte-roni7d) {min-height:3.75rem;}.alviere-search-select--lg.svelte-roni7d .alviere-search-select__input:where(.svelte-roni7d) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-search-select--lg.svelte-roni7d .alviere-search-select__label:where(.svelte-roni7d) {font-size:1.25rem;}.alviere-search-select.svelte-roni7d:focus-within .alviere-search-select__wrapper:where(.svelte-roni7d):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-search-select__container.svelte-roni7d {position:relative;}.alviere-search-select__wrapper.svelte-roni7d {position:relative;display:flex;align-items:center;}.alviere-search-select__wrapper.svelte-roni7d:hover:not(.alviere-search-select__wrapper--disabled) {border-color:#3f3f46;}.alviere-search-select__wrapper--focused.svelte-roni7d {border-color:#227e9e;box-shadow:0 0 0 2px rgba(34, 126, 158, 0.15);}.alviere-search-select__wrapper--disabled.svelte-roni7d {cursor:not-allowed;opacity:0.7;}.alviere-search-select__wrapper--disabled.alviere-search-select__wrapper--valid.svelte-roni7d {border-color:#52525b;}.alviere-search-select__input.svelte-roni7d {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-search-select__input.svelte-roni7d::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__input.svelte-roni7d:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__input.svelte-roni7d:read-only {cursor:default;color:#3f3f46;}.alviere-search-select__input.svelte-roni7d {flex:1;border:none;outline:none;background:transparent;margin:0;width:100%;height:100%;}.alviere-search-select__input.svelte-roni7d::placeholder {color:#71717a;opacity:0;transition:opacity 0.2s ease;}.alviere-search-select__input.svelte-roni7d:focus::placeholder {opacity:1;}.alviere-search-select__input.svelte-roni7d:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__display-value.svelte-roni7d {position:absolute;left:0.75rem;right:3rem;padding-top:1rem;top:50%;transform:translateY(-50%);color:#18181b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;z-index:1;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__actions.svelte-roni7d {position:absolute;right:0.75rem;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:0.25rem;z-index:2;}.alviere-search-select__clear-button.svelte-roni7d {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#e4e4e7;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;padding-left:0.25rem;padding-right:0.25rem;border-radius:50%;cursor:pointer;transition:all 150ms ease-in-out;margin-right:0.5rem;appearance:none;border:none;}.alviere-search-select__clear-button.svelte-roni7d svg {width:0.75rem;height:0.75rem;}.alviere-search-select__clear-button.svelte-roni7d:hover {background-color:#d4d4d8;color:#27272a;}.alviere-search-select__clear-button.svelte-roni7d:focus {outline:none;box-shadow:0 0 0 2px rgba(34, 126, 158, 0.25);}.alviere-search-select__dropdown-arrow.svelte-roni7d {color:#71717a;font-size:1rem;transition:transform 150ms ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center;}.alviere-search-select__dropdown-arrow.open.svelte-roni7d {transform:rotate(180deg);}.alviere-search-select__dropdown.svelte-roni7d {position:absolute;top:100%;left:0;right:0;z-index:1000;background-color:#ffffff;border:1px solid #52525b;border-top:none;border-radius:0 0 0.25rem 0.25rem;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);overflow:hidden;\n animation: svelte-roni7d-dropdownFadeIn 150ms ease-in-out ease;}.alviere-search-select__options-list.svelte-roni7d {max-height:12.5rem;overflow-y:auto;}.alviere-search-select__option-item.svelte-roni7d {padding:0.5rem 1rem;cursor:pointer;transition:background-color 150ms ease-in-out;border-bottom:1px solid #f4f4f5;}.alviere-search-select__option-item.svelte-roni7d:hover {background-color:#fafafa;}.alviere-search-select__option-item.selected.svelte-roni7d {background-color:rgba(34, 126, 158, 0.1);color:#227e9e;font-weight:500;}.alviere-search-select__option-item.highlighted.svelte-roni7d {background-color:rgba(34, 126, 158, 0.1);}.alviere-search-select__option-item.svelte-roni7d:last-child {border-bottom:none;}.alviere-search-select__loading-message.svelte-roni7d, .alviere-search-select__no-options-message.svelte-roni7d {padding:1.5rem 1rem;text-align:center;color:#71717a;font-style:italic;}.alviere-search-select__help.svelte-roni7d {margin-top:0.25rem;font-size:0.75rem;color:#71717a;line-height:1.25;display:flex;align-items:flex-start;gap:0.25rem;}.alviere-search-select__help.svelte-roni7d svg {width:1rem;height:1rem;}.alviere-search-select__error.svelte-roni7d {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}\n\n@keyframes svelte-roni7d-dropdownFadeIn {\n from {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n@media (max-width: 768px) {.alviere-search-select__dropdown.svelte-roni7d {max-height:15.625rem;}.alviere-search-select__option-item.svelte-roni7d {padding:1rem 0.5rem;}\n}'};function Vu(e,t){ht(t,!0),mn(e,Pu);let r=co(t,"value",15,""),a=co(t,"options",31,()=>dr([])),n=co(t,"placeholder",15,"Search..."),o=co(t,"disabled",15,!1),i=co(t,"required",15,!1),l=co(t,"readonly",15,!1),s=co(t,"size",15,"md"),c=co(t,"id",15,""),u=co(t,"name",15,""),v=co(t,"validationState",15,"neutral"),d=co(t,"errorMessage",15,""),p=co(t,"helpText",15,""),f=co(t,"label",15,""),h=co(t,"searchPlaceholder",15,""),g=co(t,"noOptionsMessage",15,"No options found"),m=co(t,"loadingMessage",15,"Loading..."),b=co(t,"isLoading",15,!1),y=co(t,"maxHeight",15,"300px"),w=co(t,"validationSchema",31,()=>dr({})),_=co(t,"onchange",15),x=co(t,"onfocus",15),C=co(t,"onblur",15);const E=dn(),S=Pc(qc),k=Pc(Hc),A=As({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return v()},get errorMessage(){return d()},helpText:p(),label:f(),validationSchema:w(),componentName:"SearchSelect",componentType:"select",customValidator:e=>{if(i()&&(!e||""===e))return{isValid:!1,error:"Please select an option"};if(e&&a().length>0){if(!a().some(t=>t.value===e))return{isValid:!1,error:"Selected value is not valid"}}const t=pc(e,w(),f());return{isValid:t.isValid,error:t.firstError}}});let T=or(null),I=or(null),B=or(!1),N=or(""),z=or(-1),R=Qt(()=>Ns(ka(T)));function D(){const e=a().find(e=>e.value===r());return{value:r()?String(r()):"",rawValue:r()?String(r()):"",isValid:A.state.isValid,validationState:A.state.validationState,errorMessage:A.state.errorMessage,hasInteracted:A.state.hasInteracted,selectedOption:e||null,options:a(),searchQuery:ka(N)}}let L=Qt(()=>()=>ka(N)?a().filter(e=>e.label.toLowerCase().includes(ka(N).toLowerCase())):a()),U=Qt(()=>()=>{if(!r())return"";const e=a().find(e=>e.value===r());return e?e.label:""});function P(){ne.info("SearchSelect: openDropdown",o(),l()),o()||l()||(lr(B,!0),lr(z,-1),setTimeout(()=>{null===ka(I)||void 0===ka(I)||ka(I).focus()},0),ka(R).dispatch(ec,D()))}function V(){ne.info("SearchSelect: closeDropdown",o(),l()),lr(B,!1),lr(N,""),lr(z,-1),ka(R).dispatch(tc,D())}function M(e){ne.info("SearchSelect: selectOption called with:",{option:e,currentValue:r(),required:i()}),r(e.value),ne.info("SearchSelect: After setting value:",{newValue:r(),type:typeof r()}),A.actions.markAsInteracted(),ne.info("SearchSelect: After markAsInteracted, hasInteracted:",A.state.hasInteracted),V(),null===ka(I)||void 0===ka(I)||ka(I).blur(),E("change",{value:e.value,label:e.label}),ka(R).dispatch(Zs,D()),_()&&_()({detail:{value:e.value,label:e.label}})}function O(e){var t;if(!ka(B)||!ka(T))return;const r=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e))||[],a=ka(T).getRootNode(),n=null==a?void 0:a.host;r.includes(ka(T))||n&&r.includes(n)||V()}function q(){null===ka(I)||void 0===ka(I)||ka(I).focus()}Ur(()=>{if("undefined"!=typeof window)return document.addEventListener("click",O),()=>{document.removeEventListener("click",O)}}),Ur(()=>{A.state.hasInteracted&&A.actions.forceValidation()}),Ur(()=>{if("undefined"!=typeof window&&window.customElements){const e=null===ka(T)||void 0===ka(T)?void 0:ka(T).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();e.includes("required")&&i(t.hasAttribute("required")),e.includes("disabled")&&o(t.hasAttribute("disabled")),e.includes("readonly")&&l(t.hasAttribute("readonly"))}}});var j={focus:q,blur:function(){null===ka(I)||void 0===ka(I)||ka(I).blur()},isValid:function(){return A.state.isValid},getValidationError:function(){return A.state.errorMessage||null},getValidationSchema:function(){return w()},setValidationSchema:function(e){w(e)},clear:function(){r(""),lr(N,""),lr(z,-1),lr(B,!1)},select:function(){ka(I)?(ka(I).focus(),ka(I).select()):q()},setSelectionRange:function(e,t){ka(I)&&"setSelectionRange"in ka(I)&&ka(I).setSelectionRange(e,t)},openDropdown:P,closeDropdown:V,getSelectedOption:function(){return ka(L).find(e=>e.value===r())||null},getFilteredOptions:function(){return ka(L)},selectOptionByIndex:function(e){e>=0&&e<ka(L).length&&M(ka(L)[e])},getComponentMetadata:function(){return{name:"SearchSelect",type:"select",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","openDropdown","closeDropdown","getSelectedOption","getFilteredOptions","selectOptionByIndex"]}}},get value(){return r()},set value(e=""){r(e),zt()},get options(){return a()},set options(e=[]){a(e),zt()},get placeholder(){return n()},set placeholder(e="Search..."){n(e),zt()},get disabled(){return o()},set disabled(e=!1){o(e),zt()},get required(){return i()},set required(e=!1){i(e),zt()},get readonly(){return l()},set readonly(e=!1){l(e),zt()},get size(){return s()},set size(e="md"){s(e),zt()},get id(){return c()},set id(e=""){c(e),zt()},get name(){return u()},set name(e=""){u(e),zt()},get validationState(){return v()},set validationState(e="neutral"){v(e),zt()},get errorMessage(){return d()},set errorMessage(e=""){d(e),zt()},get helpText(){return p()},set helpText(e=""){p(e),zt()},get label(){return f()},set label(e=""){f(e),zt()},get searchPlaceholder(){return h()},set searchPlaceholder(e=""){h(e),zt()},get noOptionsMessage(){return g()},set noOptionsMessage(e="No options found"){g(e),zt()},get loadingMessage(){return m()},set loadingMessage(e="Loading..."){m(e),zt()},get isLoading(){return b()},set isLoading(e=!1){b(e),zt()},get maxHeight(){return y()},set maxHeight(e="300px"){y(e),zt()},get validationSchema(){return w()},set validationSchema(e={}){w(e),zt()},get onchange(){return _()},set onchange(e){_(e),zt()},get onfocus(){return x()},set onfocus(e){x(e),zt()},get onblur(){return C()},set onblur(e){C(e),zt()}},F=Uu(),K=Cr(F),$=Cr(K);let H;var G=Cr($),W=e=>{var t=ku(),r=Cr(t,!0);it(t),Or(()=>{Vn(t,"for",c()||u()),an(r,f())}),Ha(e,t)};pn(G,e=>{f()&&e(W)});var Y=Sr(G,2);Dn(Y),Y.__input=function(e){const t=e.target;lr(N,t.value,!0),lr(z,-1),ka(R).dispatch(Xs,D())},Y.__keydown=function(e){if(ka(B))switch(e.key){case"ArrowDown":e.preventDefault(),lr(z,Math.min(ka(z)+1,ka(L)().length-1),!0);break;case"ArrowUp":e.preventDefault(),lr(z,Math.max(ka(z)-1,-1),!0);break;case"Enter":e.preventDefault(),ka(z)>=0&&ka(z)<ka(L)().length&&M(ka(L)()[ka(z)]);break;case"Escape":e.preventDefault(),V()}},ro(Y,e=>lr(I,e),()=>ka(I));var Q=Sr(Y,2),J=e=>{var t=Au(),r=Cr(t,!0);it(t),Or(e=>an(r,e),[()=>ka(U)()]),Ha(e,t)};pn(Q,e=>{ka(B)||A.state.isFocused||!ka(U)()||e(J)});var X=Sr(Q,2),Z=Cr(X),ee=e=>{var t=Tu();t.__click=e=>{e.stopPropagation(),ne.info("SearchSelect: clearSelection called, current value:",r()),r(""),lr(N,""),lr(z,-1),ne.info("SearchSelect: After clearing value:",{value:r(),required:i()}),A.actions.markAsInteracted(),ne.info("SearchSelect: After markAsInteracted in clear, hasInteracted:",A.state.hasInteracted),E("change",{value:"",label:""}),ka(R).dispatch(Zs,D()),_()&&_()({detail:{value:"",label:""}})},fn(Cr(t),()=>k.outerHTML),it(t),Ha(e,t)};pn(Z,e=>{!r()||o()||l()||e(ee)});var te=Sr(Z,2);let re;fn(Cr(te),()=>S.outerHTML),it(te),it(X),it($);var ae=Sr($,2),oe=e=>{var t=zu(),a=Cr(t),n=Cr(a),o=e=>{var t=Iu(),r=Cr(t,!0);it(t),Or(()=>an(r,m())),Ha(e,t)},i=e=>{var t=$a(),a=Er(t),n=e=>{var t=Bu(),r=Cr(t,!0);it(t),Or(()=>an(r,g())),Ha(e,t)},o=e=>{var t=$a();jt(Er(t),17,()=>ka(L)(),qt,(e,t,a)=>{var n=Nu();let o;n.__click=()=>M(ka(t)),n.__keydown=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),M(ka(t)))};var i=Cr(n,!0);it(n),Or(()=>{o=En(n,1,"alviere-search-select__option-item svelte-roni7d",null,o,{selected:ka(t).value===r(),highlighted:a===ka(z)}),Vn(n,"aria-selected",ka(t).value===r()),Vn(n,"aria-label",ka(t).label),an(i,ka(t).label)}),La("mouseenter",n,()=>lr(z,a,!0)),Ha(e,n)}),Ha(e,t)};pn(a,e=>{0===ka(L)().length?e(n):e(o,!1)},!0),Ha(e,t)};pn(n,e=>{b()?e(o):e(i,!1)}),it(a),it(t),Or(()=>kn(t,`max-height: ${y()??""}`)),Ha(e,t)};pn(ae,e=>{ka(B)&&e(oe)}),it(K);var ie=Sr(K,2),le=Cr(ie),se=e=>{Ha(e,Ru())};pn(le,e=>{i()&&"neutral"===A.state.validationState&&e(se)});var ce=Sr(le,2),ue=e=>{var t=Du(),r=Cr(t,!0);it(t),Or(()=>an(r,p())),Ha(e,t)};pn(ce,e=>{p()&&"invalid"!==A.state.validationState&&e(ue)});var ve=Sr(ce,2),de=e=>{var t=Lu(),r=Sr(Cr(t));it(t),Or(()=>{Vn(t,"id",`${c()??""}-error`),an(r,` ${A.state.errorMessage??""}`)}),Ha(e,t)};return pn(ve,e=>{"invalid"===A.state.validationState&&e(de)}),it(ie),it(F),ro(F,e=>lr(T,e),()=>ka(T)),Or(e=>{En(F,1,`alviere-search-select alviere-search-select--${s()??""}`,"svelte-roni7d"),H=En($,1,"alviere-search-select__wrapper svelte-roni7d",null,H,e),Vn(Y,"placeholder",ka(B)||A.state.isFocused?h()||`Search ${f()||"options"}...`:""),Vn(Y,"id",c()),Vn(Y,"name",u()),Y.disabled=o(),Y.readOnly=l(),Vn(Y,"aria-expanded",ka(B)),re=En(te,1,"alviere-search-select__dropdown-arrow svelte-roni7d",null,re,{open:ka(B)})},[()=>({"alviere-search-select__wrapper--focused":A.state.isFocused,"alviere-search-select__wrapper--valid":"valid"===A.state.validationState,"alviere-search-select__wrapper--invalid":"invalid"===A.state.validationState,"alviere-search-select__wrapper--disabled":o(),"alviere-search-select__wrapper--dirty":!!ka(U)()})]),La("focus",Y,function(e){A.handlers.handleFocus(e),P(),ka(U)()&&lr(N,ka(U)(),!0),x()&&x()(e)}),La("blur",Y,function(e){A.handlers.handleBlur(e),setTimeout(()=>{(null===ka(T)||void 0===ka(T)?void 0:ka(T).contains(document.activeElement))||(V(),lr(N,""))},150),C()&&C()(e)}),Xn(Y,()=>ka(N),e=>lr(N,e)),Ha(e,F),gt(j)}Ua(["input","keydown","click"]),customElements.define("alviere-search-select",po(Vu,{value:{},options:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},validationState:{},errorMessage:{},helpText:{},label:{},searchPlaceholder:{},noOptionsMessage:{},loadingMessage:{},isLoading:{},maxHeight:{},validationSchema:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","openDropdown","closeDropdown","getSelectedOption","getFilteredOptions","selectOptionByIndex","getComponentMetadata"],!0));class Mu{constructor(){this.cache=new Map}static getInstance(){return this.managerInstance||(this.managerInstance=new Mu),this.managerInstance}getCacheKey(e){return`${e.jwt||""}:${e.publicCertificate||""}:${e.publicCertificateId||""}:${e.business_uuid||""}:${e.debug||!1}`}getOrCreate(e){const t=this.getCacheKey(e),r=this.cache.get(t);if(r)return this.logger=oe(r.instance),this.logger.info("🔍 Returning cached AlviereCore instance...",r.instance),r.instance;const a=new Ss(e);return this.logger=oe(a),this.logger.info("🔍 Creating new AlviereCore instance...",a),this.cache.set(t,{instance:a,key:{jwt:e.jwt||"",publicCertificate:e.publicCertificate||"",publicCertificateId:e.publicCertificateId||"",business_uuid:e.business_uuid||"",debug:e.debug||!1},createdAt:Date.now()}),a}updateOrCreate(e){const t=this.getCacheKey(e),r=this.cache.get(t);if(r)return r.instance.configure(e),r.instance;const a=e.jwt||"",n=Array.from(this.cache.entries());for(const[o,i]of n)i.key.jwt!==a&&this.cache.delete(o);return this.getOrCreate(e)}clearAll(){this.cache.clear()}clearForJwt(e){const t=[];for(const[r,a]of this.cache.entries())a.key.jwt===e&&t.push(r);t.forEach(e=>this.cache.delete(e))}getStats(){return{totalInstances:this.cache.size,instances:Array.from(this.cache.entries()).map(([e,t])=>({key:e,hasJwt:!!t.key.jwt,debug:t.key.debug,createdAt:new Date(t.createdAt).toISOString()}))}}has(e){const t=this.getCacheKey(e);return this.cache.has(t)}}const Ou=Mu.getInstance();function qu(e){return Ou.getOrCreate(e)}const ju=Object.freeze(Object.defineProperty({__proto__:null,AlviereCoreManager:Mu,getAlviereCore:qu},Symbol.toStringTag,{value:"Module"}));var Fu=qa('<div class="success-message svelte-1aekat9">✅ Payment instrument created successfully! <br/> <small class="svelte-1aekat9"> </small></div>'),Ku=qa('<div class="error-message svelte-1aekat9"> </div>'),$u=qa('<div class="alviere-payment-instrument-form svelte-1aekat9"><h2 class="svelte-1aekat9">Add Payment Instrument</h2> <!> <!> <form novalidate=""><fieldset class="svelte-1aekat9"><legend class="svelte-1aekat9">Card Information</legend> <div class="form-group svelte-1aekat9"><!></div> <div class="form-row svelte-1aekat9"><div class="form-group svelte-1aekat9"><!></div> <div class="form-group svelte-1aekat9"><!></div></div> <div class="form-group svelte-1aekat9"><!></div></fieldset> <fieldset class="svelte-1aekat9"><legend class="svelte-1aekat9">Contact Information</legend> <div class="form-group svelte-1aekat9"><!></div> <div class="form-group svelte-1aekat9"><!></div></fieldset> <fieldset class="svelte-1aekat9"><legend class="svelte-1aekat9">Billing Address</legend> <div class="form-group svelte-1aekat9"><!></div> <div class="form-group svelte-1aekat9"><!></div> <div class="form-row svelte-1aekat9"><div class="form-group svelte-1aekat9"><!></div> <div class="form-group svelte-1aekat9"><!></div> <div class="form-group svelte-1aekat9"><!></div> <div class="form-group svelte-1aekat9"><label for="country" class="svelte-1aekat9">Country *</label> <select id="country" required class="svelte-1aekat9"><option>United States</option><option>Canada</option><option>Mexico</option></select></div></div></fieldset> <fieldset class="svelte-1aekat9"><legend class="svelte-1aekat9">Additional Information</legend> <div class="form-group svelte-1aekat9"><!></div> <div class="form-group svelte-1aekat9"><!></div></fieldset> <div class="form-actions svelte-1aekat9"><button type="submit" class="submit-button svelte-1aekat9"> </button></div></form></div>');const Hu={hash:"svelte-1aekat9",code:'@charset "UTF-8";.alviere-payment-instrument-form.svelte-1aekat9 {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;}.alviere-payment-instrument-form.svelte-1aekat9 h2:where(.svelte-1aekat9) {color:#27272a;margin-bottom:2rem;text-align:center;}.alviere-payment-instrument-form.svelte-1aekat9 fieldset:where(.svelte-1aekat9) {border:1px solid #d4d4d8;border-radius:0.25rem;padding:1.5rem;margin-bottom:2rem;background:#ffffff;}.alviere-payment-instrument-form.svelte-1aekat9 legend:where(.svelte-1aekat9) {font-weight:600;color:#3f3f46;padding:0 0.5rem;}.alviere-payment-instrument-form.svelte-1aekat9 .form-group:where(.svelte-1aekat9) {margin-bottom:1rem;}.alviere-payment-instrument-form.svelte-1aekat9 .form-row:where(.svelte-1aekat9) {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.alviere-payment-instrument-form.svelte-1aekat9 .form-actions:where(.svelte-1aekat9) {margin-top:24px;text-align:center;}.alviere-payment-instrument-form.svelte-1aekat9 .form-actions:where(.svelte-1aekat9) button:where(.svelte-1aekat9):disabled {opacity:0.6;cursor:not-allowed;}.alviere-payment-instrument-form.svelte-1aekat9 .success-message:where(.svelte-1aekat9) {padding:1rem;border-radius:0.25rem;margin-bottom:2rem;text-align:center;background:#d4edda;border:1px solid #c3e6cb;color:#155724;}.alviere-payment-instrument-form.svelte-1aekat9 .error-message:where(.svelte-1aekat9) {padding:1rem;border-radius:0.25rem;margin-bottom:2rem;text-align:center;background:#f8d7da;border:1px solid #f5c6cb;color:#721c24;}.alviere-payment-instrument-form.svelte-1aekat9 .submit-button:where(.svelte-1aekat9) {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#27272a;color:#ffffff;}.alviere-payment-instrument-form.svelte-1aekat9 .submit-button:where(.svelte-1aekat9):hover:not(:disabled) {background:#3f3f46;}.alviere-payment-instrument-form.svelte-1aekat9 .submit-button:where(.svelte-1aekat9):disabled {background:#52525b;cursor:not-allowed;} .alviere-payment-instrument-form.svelte-1aekat9 select:where(.svelte-1aekat9) {width:100%;padding:0.75rem;border:1px solid #d4d4d8;border-radius:0.25rem;font-size:1.25rem;line-height:1.5rem;transition:border-color 150ms ease-in-out;} .alviere-payment-instrument-form.svelte-1aekat9 select:where(.svelte-1aekat9):focus {outline:none;border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;} .alviere-payment-instrument-form.svelte-1aekat9 select:where(.svelte-1aekat9):disabled {background:#f4f4f5;cursor:not-allowed;}.alviere-payment-instrument-form.svelte-1aekat9 label:where(.svelte-1aekat9) {display:block;margin-bottom:0.5rem;font-weight:500;color:#3f3f46;}.alviere-payment-instrument-form.svelte-1aekat9 small:where(.svelte-1aekat9) {display:block;margin-top:4px;color:#52525b;font-size:1rem;}'};function Gu(e,t){ht(t,!0),mn(e,Hu);let r,a,n,o,i=co(t,"jwt",15,""),l=co(t,"accountUuid",15,""),s=co(t,"debug",15,!1),c=co(t,"onsuccess",15),u=co(t,"onerror",15),v=or(dr({pan:"",expiry:"",securityCode:"",nameOnCard:"",phoneNumber:"",emailAddress:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US",externalId:"",metadata:""})),d=or(""),p=or(!1),f=or(null),h=or(null);Ur(()=>{o=qu({jwt:i(),debug:s()})});var g={get jwt(){return i()},set jwt(e=""){i(e),zt()},get accountUuid(){return l()},set accountUuid(e=""){l(e),zt()},get debug(){return s()},set debug(e=!1){s(e),zt()},get onsuccess(){return c()},set onsuccess(e){c(e),zt()},get onerror(){return u()},set onerror(e){u(e),zt()}},m=$u(),b=Sr(Cr(m),2),y=e=>{var t=Fu(),r=Sr(Cr(t),3),a=Cr(r);it(r),it(t),Or(()=>{var e;return an(a,`ID: ${((null==(e=ka(h).payment_instrument)?void 0:e.payment_instrument_uuid)||"N/A")??""}`)}),Ha(e,t)};pn(b,e=>{ka(h)&&e(y)});var w=Sr(b,2),_=e=>{var t=Ku(),r=Cr(t);it(t),Or(()=>an(r,`❌ ${ka(f)??""}`)),Ha(e,t)};pn(w,e=>{ka(f)&&e(_)});var x=Sr(w,2),C=Cr(x),E=Sr(Cr(C),2);ro(wc(Cr(E),{id:"pan",label:"Card Number",placeholder:"Enter your card number",required:!0,get disabled(){return ka(p)},oninput:function(e){var t;ka(v).pan=e.rawValue,lr(d,(null===(t=e.cardType)||void 0===t?void 0:t.name.toLowerCase())||"",!0)},get value(){return ka(v).pan},set value(e){ka(v).pan=e}}),e=>r=e,()=>r),it(E);var S=Sr(E,2),k=Cr(S);ro(Rc(Cr(k),{id:"expiry",label:"Expiry Date",placeholder:"MM/YY",required:!0,get disabled(){return ka(p)},oninput:function(e){ka(v).expiry=e.value},get value(){return ka(v).expiry},set value(e){ka(v).expiry=e}}),e=>n=e,()=>n),it(k);var A=Sr(k,2);ro(Ac(Cr(A),{id:"securityCode",label:"Security Code",get cardType(){return ka(d)},required:!0,get disabled(){return ka(p)},oninput:function(e){ka(v).securityCode=e.rawValue},get value(){return ka(v).securityCode},set value(e){ka(v).securityCode=e}}),e=>a=e,()=>a),it(A),it(S);var T=Sr(S,2);ou(Cr(T),{type:"text",id:"nameOnCard",placeholder:"John Doe",label:"Name on Card",required:!0,get disabled(){return ka(p)},autocomplete:"cc-name",validateAlphabetic:!0,validateMinLength:2,get value(){return ka(v).nameOnCard},set value(e){ka(v).nameOnCard=e}}),it(T),it(C);var I=Sr(C,2),B=Sr(Cr(I),2);ou(Cr(B),{type:"text",id:"phoneNumber",placeholder:"+1 (555) 123-4567",label:"Phone Number",get disabled(){return ka(p)},autocomplete:"tel",validatePhone:!0,get value(){return ka(v).phoneNumber},set value(e){ka(v).phoneNumber=e}}),it(B);var N=Sr(B,2);ou(Cr(N),{type:"text",id:"emailAddress",placeholder:"john.doe@example.com",label:"Email Address",get disabled(){return ka(p)},autocomplete:"email",validateEmail:!0,get value(){return ka(v).emailAddress},set value(e){ka(v).emailAddress=e}}),it(N),it(I);var z=Sr(I,2),R=Sr(Cr(z),2);ou(Cr(R),{type:"text",id:"addressLine1",placeholder:"123 Main St",label:"Address Line 1",required:!0,get disabled(){return ka(p)},autocomplete:"address-line1",get value(){return ka(v).addressLine1},set value(e){ka(v).addressLine1=e}}),it(R);var D=Sr(R,2);ou(Cr(D),{type:"text",id:"addressLine2",placeholder:"Apt 4B",label:"Address Line 2",get disabled(){return ka(p)},autocomplete:"address-line2",get value(){return ka(v).addressLine2},set value(e){ka(v).addressLine2=e}}),it(D);var L=Sr(D,2),U=Cr(L);ou(Cr(U),{type:"text",id:"city",placeholder:"New York",label:"City",required:!0,get disabled(){return ka(p)},autocomplete:"address-level2",get value(){return ka(v).city},set value(e){ka(v).city=e}}),it(U);var P=Sr(U,2);ou(Cr(P),{type:"text",id:"state",placeholder:"NY",label:"State",required:!0,get disabled(){return ka(p)},autocomplete:"address-level1",get value(){return ka(v).state},set value(e){ka(v).state=e}}),it(P);var V=Sr(P,2);ou(Cr(V),{type:"text",id:"postalCode",placeholder:"10001",label:"Postal Code",required:!0,get disabled(){return ka(p)},autocomplete:"postal-code",validatePostalCode:"US",get value(){return ka(v).postalCode},set value(e){ka(v).postalCode=e}}),it(V);var M=Sr(V,2),O=Sr(Cr(M),2),q=Cr(O);q.value=q.__value="US";var j=Sr(q);j.value=j.__value="CA";var F=Sr(j);F.value=F.__value="MX",it(O),it(M),it(L),it(z);var K=Sr(z,2),$=Sr(Cr(K),2);ou(Cr($),{type:"text",id:"externalId",placeholder:"Optional external reference",label:"External ID",get disabled(){return ka(p)},helpText:"Optional unique identifier for this payment instrument",get value(){return ka(v).externalId},set value(e){ka(v).externalId=e}}),it($);var H=Sr($,2);ou(Cr(H),{type:"textarea",id:"metadata",placeholder:"Optional JSON metadata",label:"Metadata",get disabled(){return ka(p)},rows:3,helpText:"Optional JSON data for additional information",get value(){return ka(v).metadata},set value(e){ka(v).metadata=e}}),it(H),it(K);var G=Sr(K,2),W=Cr(G),Y=Cr(W,!0);return it(W),it(G),it(x),it(m),Or(()=>{O.disabled=ka(p),W.disabled=ka(p),an(Y,ka(p)?"Creating...":"Create Payment Instrument")}),La("submit",x,async function(e){e.preventDefault(),lr(f,null),lr(h,null);const t=function(){if(!l())return"Account UUID is required";if(!ka(v).pan)return"Card number is required";if(!(null==r?void 0:r.isValidCard()))return(null==r?void 0:r.getValidationError())||"Please enter a valid card number";if(!ka(v).expiry)return"Expiry date is required";if(!(null==n?void 0:n.isValidExpiry()))return(null==n?void 0:n.getValidationError())||"Please enter a valid expiry date";return ka(v).securityCode?ka(v).nameOnCard?ka(v).addressLine1?ka(v).city?ka(v).state?ka(v).postalCode?ka(v).country?null:"Country is required":"Postal code is required":"State is required":"City is required":"Address line 1 is required":"Name on card is required":"Security code is required"}();if(t)lr(f,t,!0);else{lr(p,!0);try{const e=o.createPaymentInstrumentsService(),t=(null==n?void 0:n.getMonth())||"",r=(null==n?void 0:n.getYear())||"",a={account_uuid:l(),external_id:ka(v).externalId||`pi_${Date.now()}`,payment_instrument_type:"CARD",payment_instrument_details:{card:{pan:ka(v).pan,exp_month:t,exp_year:r,security_code:ka(v).securityCode,name_on_card:ka(v).nameOnCard,phone_number:ka(v).phoneNumber||void 0,email_address:ka(v).emailAddress||void 0,billing_address:{line_1:ka(v).addressLine1,line_2:ka(v).addressLine2||void 0,city:ka(v).city,state:ka(v).state,postal_code:ka(v).postalCode,country:ka(v).country}}},metadata:ka(v).metadata||void 0},i=await e.createPaymentInstrument(a);lr(h,i,!0),null===c()||void 0===c()||c()(i),lr(v,{pan:"",expiry:"",securityCode:"",nameOnCard:"",phoneNumber:"",emailAddress:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US",externalId:"",metadata:""},!0)}catch(a){const e=a instanceof Error?a:new Error("Unknown error occurred");lr(f,e.message,!0),null===u()||void 0===u()||u()(e)}finally{lr(p,!1)}}}),function(e,t,r=t){var a=new WeakSet,n=!0;Nr(e,"change",t=>{var n,o=t?"[selected]":":checked";if(e.multiple)n=[].map.call(e.querySelectorAll(o),In);else{var i=e.querySelector(o)??e.querySelector("option:not([disabled])");n=i&&In(i)}r(n),null!==Et&&a.add(Et)}),Vr(()=>{var o=t();if(e===document.activeElement){var i=St??Et;if(a.has(i))return}if(An(e,o,n),n&&void 0===o){var l=e.querySelector(":checked");null!==l&&(o=In(l),r(o))}e.__value=o,n=!1}),Tn(e)}(O,()=>ka(v).country,e=>ka(v).country=e),Ha(e,m),gt(g)}customElements.define("alviere-add-payment-instrument",po(Gu,{jwt:{},accountUuid:{},debug:{},onsuccess:{},onerror:{}},[],[],!0));const Wu=e=>e;function Yu(e,{delay:t=0,duration:r=400,easing:a=Wu}={}){const n=+getComputedStyle(e).opacity;return{delay:t,duration:r,easing:a,css:e=>"opacity: "+e*n}}const Qu=(()=>{const{subscribe:e,set:t,update:r}=function(e,t=Ie){let r=null;const a=new Set;function n(t){if(vt(e,t)&&(e=t,r)){const t=!no.length;for(const r of a)r[1](),no.push(r,e);if(t){for(let e=0;e<no.length;e+=2)no[e][0](no[e+1]);no.length=0}}}function o(t){n(t(e))}return{set:n,update:o,subscribe:function(i,l=Ie){const s=[i,l];return a.add(s),1===a.size&&(r=t(n,o)||Ie),i(e),()=>{a.delete(s),0===a.size&&r&&(r(),r=null)}}}}({core:null,isInitialized:!1,config:null});return{subscribe:e,init:async e=>{const t=e.debug||!1;if(e.jwt)try{t&&ne.info("🔐 Initializing shared AlviereCore instance in store...");const{getAlviereCore:a}=await Promise.resolve().then(()=>ju),n=a(e);r(t=>({...t,core:n,isInitialized:!0,config:e})),t&&ne.info("✅ Shared AlviereCore instance created in store:",{accountUuid:n.getAccountUuid(),businessUuid:n.getBusinessUuid(),isFirstTimeUser:n.isFirstTimeUser()})}catch(a){ne.error("❌ Failed to initialize AlviereCore in store:",a)}else t&&ne.warn("⚠️ Cannot initialize AlviereCore - missing JWT")},updateJwt:e=>{r(t=>{var r;if(!t.core||!t.config)return(null==(r=t.config)?void 0:r.debug)&&ne.warn("⚠️ Cannot update JWT - core not initialized"),t;const a=t.config.debug||!1;return a&&ne.info("🔄 Updating JWT in shared AlviereCore instance (store)..."),t.core.configure({...t.config,jwt:e}),a&&ne.info("✅ Shared AlviereCore updated with new JWT (store):",{accountUuid:t.core.getAccountUuid(),businessUuid:t.core.getBusinessUuid(),isFirstTimeUser:t.core.isFirstTimeUser()}),{...t,config:{...t.config,jwt:e}}})},reset:()=>{t({core:null,isInitialized:!1,config:null})},getCore:()=>{let t=null;return e(e=>{t=e.core})(),t}}})(),Ju=Qu.init;Qu.updateJwt;const Xu=Qu.reset;function Zu(e){const{jwt:t="",businessUuid:r="",publicCertificate:a="",publicCertificateId:n="",debug:o=!1,isInFlow:i=!1,disabled:l=!1,readonly:s=!1,initialData:c={},submitHandler:u,customValidator:v,fieldSchemas:d={},formName:p="UnknownForm",stepType:f="FORM_STEP",stepIndex:h,enableAlviereCore:g=!0,resultTransformer:m,onSuccessCallback:b}=e;let y=or(!1),w=or(!1),_=or(!1),x=or(!1),C=or(0),E=or(0),S=or(0),k=or(null),A=or(null),T=or(null),I=or(dr({...c})),B=or(dr({})),N=or(dr({})),z=or(!1),R=or(!1),D=or(dr(t));const L=dr(a),U=dr(n);let P=or(null);Ur(()=>{if(g&&ka(D)&&""!==ka(D).trim()){const e=Qu.getCore();e?(lr(P,e,!0),o&&ne.info(`[${p}] ✅ Using shared AlviereCore instance from flow store`)):(o&&ne.info(`[${p}] 🔍 Creating standalone AlviereCore instance...`),lr(P,qu({jwt:ka(D),debug:o,publicCertificate:L,publicCertificateId:U,business_uuid:r}),!0)),r&&ka(P)&&o&&ne.info(`[${p}] 🔍 User state check:`,{accountUuid:ka(P).getAccountUuid(),businessUuid:ka(P).getBusinessUuid(),isFirstTimeUser:ka(P).isFirstTimeUser(),isScopedToPayee:ka(P).isScopedToPayee()})}});const V=Qt(()=>()=>0===Object.keys(ka(N)).length),M=Qt(()=>()=>Object.keys(ka(N)).length>0),O=Qt(()=>()=>ka(V)()&&!ka(M)()),q=Qt(()=>()=>!ka(y)&&!ka(w)&&!l&&!s&&ka(O)()),j=Qt(()=>()=>0===ka(C)?0:ka(E)/ka(C)*100),F=Qt(()=>()=>{const e=Object.keys(ka(B)).length;if(0===e)return 100;return Object.values(ka(B)).filter(e=>e.isValid).length/e*100});async function K(){if(ka(q))try{lr(w,!0),lr(y,!0),lr(A,null);if(!Q())throw new Error("Form validation failed");if(v){const e=v(ka(I));if(!e.isValid)throw new Error(e.firstError||"Custom validation failed")}ka(J).dispatch(nc,{stepType:f,stepIndex:i?h:void 0,formData:{...ka(I)}});const e=await u(ka(I));lr(k,e,!0),cr(E),cr(C),lr(x,!0),lr(z,!1),lr(R,!1);const t=m?m(e):e;ka(J).dispatch(rc,{...t,stepType:f,stepIndex:i?h:void 0,success:!0}),null==b||b(e,ka(J))}catch(e){const t=e instanceof Error?e:new Error(String(e));lr(A,t,!0),cr(S),cr(C),ka(J).dispatch(ac,{data:t,stepType:f,stepIndex:i?h:void 0,success:!1,error:t}),ne.error(`[${p}] Form submission failed:`,t)}finally{lr(w,!1),lr(y,!1)}else ne.warn(`[${p}] Cannot submit: form validation failed or is disabled`)}function $(){lr(I,{...c},!0),lr(N,{},!0),lr(B,{},!0),lr(z,!1),lr(R,!1),lr(A,null),ka(J).dispatch(oc,{stepType:f,stepIndex:i?h:void 0})}function H(e,t){ka(I)[e]=t,lr(z,!0),lr(R,!0),ka(B)[e]?ka(B)[e].value=t:ka(B)[e]={name:e,value:t,isValid:!0,errorMessage:"",hasInteracted:!1,validationSchema:d[e]},Y(e)}function G(e,t){ka(N)[e]=t,ka(B)[e]&&(ka(B)[e].isValid=!1,ka(B)[e].errorMessage=t)}function W(e){delete ka(N)[e],ka(B)[e]&&(ka(B)[e].isValid=!0,ka(B)[e].errorMessage="")}function Y(e){const t=ka(I)[e],r=d[e];if(!r)return!0;const a=pc(t,r,e);return a.isValid?(W(e),!0):(G(e,a.firstError||"Validation failed"),!1)}function Q(){let e=!0;for(const t of Object.keys(d)){Y(t)||(e=!1)}return e}const J=Qt(()=>Ns(ka(T)));return{state:{get isLoading(){return ka(y)},get isSubmitting(){return ka(w)},get isPolling(){return ka(_)},get hasSubmitted(){return ka(x)},get totalSubmissions(){return ka(C)},get successCount(){return ka(E)},get errorCount(){return ka(S)},get lastResponse(){return ka(k)},get lastError(){return ka(A)},get formElement(){return ka(T)},set formElement(e){lr(T,e,!0)},get formData(){return ka(I)},get fields(){return ka(B)},get validationErrors(){return ka(N)},get isValid(){return ka(O)()},get isDirty(){return ka(z)},get hasUnsavedChanges(){return ka(R)},get alviereCore(){return ka(P)}},computed:{get allFieldsValid(){return ka(V)()},get hasErrors(){return ka(M)()},get canSubmit(){return ka(q)()},get submitProgress(){return ka(j)()},get validationProgress(){return ka(F)()}},actions:{submit:K,reset:$,setFieldValue:H,getFieldValue:function(e){return ka(I)[e]},setFieldError:G,clearFieldError:W,validateField:Y,validateAllFields:Q,clearAllErrors:function(){lr(N,{},!0);for(const e of Object.values(ka(B)))e.isValid=!0,e.errorMessage=""},setFormData:function(e){lr(I,{...e},!0),lr(z,!0),lr(R,!0);for(const[t,r]of Object.entries(e))ka(B)[t]&&(ka(B)[t].value=r);Q()},getFormData:function(){return{...ka(I)}},mergeFormData:function(e){lr(I,{...ka(I),...e},!0),lr(z,!0),lr(R,!0),Q()},markAsDirty:function(){lr(z,!0),lr(R,!0)},markAsClean:function(){lr(z,!1),lr(R,!1)},setLoading:function(e){lr(y,e,!0)},setPolling:function(e){lr(_,e,!0)},setJwt:function(e){e&&""!==e.trim()&&e!==ka(D)&&lr(D,e,!0)}},handlers:{handleSubmit:async function(e){e.preventDefault(),await K()},handleReset:function(e){e.preventDefault(),$()},handleFieldChange:function(e,t){ne.info("handleFieldChange",e,t),H(e,t),W(e),Y(e)},handleFieldBlur:function(e){ka(B)[e]&&(ka(B)[e].hasInteracted=!0),Y(e)}},get eventDispatcher(){return ka(J)}}}Qu.getCore;var ev=qa('<h2 class="svelte-1tz2qyj">Create Consumer Account</h2>'),tv=qa('<div><alviere-spinner><span slot="message"><!></span></alviere-spinner></div>',2),rv=qa('<span class="validation-hint svelte-1tz2qyj">Please fill in all required fields to continue</span>'),av=qa('<span class="validation-error">Please fix the errors above</span>'),nv=qa('<div class="alviere-create-consumer-account svelte-1tz2qyj"><!> <!> <form novalidate=""><div class="form-section svelte-1tz2qyj"><h3 class="svelte-1tz2qyj">Personal Information</h3> <div class="form-row svelte-1tz2qyj"><!> <!></div> <div class="form-row svelte-1tz2qyj"><!></div></div> <div class="form-actions svelte-1tz2qyj"><div class="form-status svelte-1tz2qyj"><!> <!></div> <alviere-button><!></alviere-button></div></form></div>',2);const ov={hash:"svelte-1tz2qyj",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-create-consumer-account.svelte-1tz2qyj {max-width:100%;margin:0 auto;font-family:\"Darker Grotesque\", sans-serif;line-height:1;position:relative;}.spinner-container.svelte-1tz2qyj {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}.spinner-standalone.svelte-1tz2qyj {position:relative !important;min-height:200px;display:flex;align-items:center;justify-content:center;}h2.svelte-1tz2qyj {color:#333;margin-bottom:20px;text-align:center;}h3.svelte-1tz2qyj {color:#555;margin-bottom:15px;border-bottom:2px solid #eee;padding-bottom:5px;}.form-section.svelte-1tz2qyj {margin-bottom:30px;padding:20px;background:#f9f9f9;border-radius:8px;}.form-row.svelte-1tz2qyj {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.form-status.svelte-1tz2qyj {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-1tz2qyj {color:#6b7280;font-size:0.875rem;font-style:italic;}.form-actions.svelte-1tz2qyj {margin-top:24px;text-align:center;}"};function iv(e,t){ht(t,!0),mn(e,ov);let r=co(t,"jwt",7,""),a=co(t,"businessUuid",15,""),n=co(t,"isInFlow",15,!1),o=co(t,"debug",15,!0),i=co(t,"prefillData",31,()=>dr({})),l=co(t,"publicCertificate",15,""),s=co(t,"publicCertificateId",15,""),c=or(!1);const u=Zu({jwt:r(),businessUuid:a(),publicCertificate:l(),publicCertificateId:s(),debug:o(),isInFlow:n(),initialData:{externalId:"",firstName:"",middleName:"",lastName:"",email:"",phone:"",dateOfBirth:"",ssn:"",employmentStatus:"FULL_TIME",profession:"",addressLabel:"Primary Address",addressLine1:"",addressLine2:"",addressCity:"",addressState:"",addressPostalCode:"",addressCountry:"USA"},fieldSchemas:{firstName:{required:"First Name is required",alphabetic:!0},lastName:{required:"Last Name is required",alphabetic:!0},email:{required:"Email Address is required",email:!0},phone:{phone:!0},dateOfBirth:{date:!0},ssn:{pattern:{regex:/^\d{3}-?\d{2}-?\d{4}$/,message:"Please enter a valid SSN"}},addressCity:{alphabetic:!0},addressPostalCode:{postalCode:!0}},formName:"CreateConsumerAccount",stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:n()?0:void 0,enableAlviereCore:!0,submitHandler:async e=>{var t,r;const n={first_name:e.firstName,last_name:e.lastName,email_address:e.email},o={external_id:e.externalId||`consumer-${Date.now()}`,information:{consumer_information:n},profile:i().profile||void 0,account_type:"CONSUMER",parent_account_uuid:a()};null===(r=null===(t=u.state.alviereCore)||void 0===t?void 0:t.getLogger())||void 0===r||r.info("🔍 Creating account using AlviereCore...");const l=u.state.alviereCore.createAccountsService();try{const e=await l.createAccount(o);if(e.account.account_uuid&&ka(f)){const t=new CustomEvent(uc,{detail:{account_uuid:e.account.account_uuid,status:"CREATED"},bubbles:!0,composed:!0});ka(f).dispatchEvent(t),ne.info("🚀 Dispatched account CREATED event:",t.detail)}if(e.account.account_uuid){u.actions.setPolling(!0);try{const t=await async function(e,t=5,r=6e3){if(!u.state.alviereCore)throw new Error("AlviereCore not initialized");const a=u.state.alviereCore.createAccountsService();for(let o=1;o<=t;o++)try{ne.info(`🔍 Polling account status (attempt ${o}/${t})...`);const n=await a.getAccount(e);if("ACTIVE"===n.account.status)return ne.info("✅ Account is now ACTIVE"),n;ne.info(`⏳ Account status: ${n.account.status}, waiting...`),o<t&&await new Promise(e=>setTimeout(e,r))}catch(n){if(ne.error(`❌ Error polling account status (attempt ${o}):`,n),o===t)throw new Error(`Failed to poll account status after ${t} attempts: ${n}`)}throw new Pl("115001",`Account did not become active after ${t} polling attempts`)}(e.account.account_uuid);return t}finally{u.actions.setPolling(!1)}}return e}catch(s){if(s instanceof Pl&&s.isErrorCode(Jl))throw ne.info("🔍 Error creating account:","Invalid JWT"),s;throw s}},resultTransformer:e=>({account_uuid:e.account.account_uuid}),onSuccessCallback:(e,t)=>{t.dispatch(uc,{account_uuid:e.account.account_uuid,status:e.account.status})}});let v=or(!1),d=or(!1),p=or(!1),f=or(null);vn(async()=>{var e,t;if(lr(v,!0),null===(e=u.state.alviereCore)||void 0===e?void 0:e.isScopedToPayee()){const e=u.state.alviereCore.getAccountUuid();if(ne.info("🔄 Returning user detected - JWT already scoped to consumer account:",e),e&&"862a2524-ce32-4fa7-b138-e7ac7e93c022"!==e)try{const t=await async function(e){if(ne.info("🔍 Checking if account exists and is active...",e),ne.warn("🔍 Debug:",o()),!u.state.alviereCore)throw new Error("AlviereCore not initialized");const t=u.state.alviereCore.createAccountsService(),r=await t.getAccount(e);if(ne.info("🔍 Account result:",r.account),"ACTIVE"===r.account.status)return r;throw ne.error(`❌ Account exists but is not active. Status: ${r.account.status}`,r.account),new Pl(ns,`Account exists but is not active. Current status: ${r.account.status}`)}(e);if(t)return ne.info("✅ Consumer account already exists and is active - skipping creation:",t),lr(p,!0),void setTimeout(()=>{if(ka(f)){const e=new CustomEvent(uc,{detail:{account_uuid:t.account.account_uuid,status:t.account.status,skipped:!0},bubbles:!0,composed:!0});ka(f).dispatchEvent(e),ne.info("🚀 Dispatched account event (skipped) from host element:",e);const r=new CustomEvent(rc,{detail:{account_uuid:t.account.account_uuid,stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:n()?0:void 0,success:!0,skipped:!0},bubbles:!0,composed:!0});ka(f).dispatchEvent(r),ne.info("🚀 Dispatched form-success event (skipped) from host element:",r)}},100)}catch(r){if(r instanceof Pl&&r.isErrorCode(ns)){if(ne.error("❌ Critical error: Account exists but is not active"),ka(f)){const e=new CustomEvent(ac,{detail:{error:r,stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:n()?0:void 0},bubbles:!0,composed:!0});ka(f).dispatchEvent(e),ne.info("🚀 Dispatched form-error event to MultiStepFlow:",e.detail)}return}ne.warn("⚠️ Failed to fetch existing account, will show form:",r)}}else(null===(t=u.state.alviereCore)||void 0===t?void 0:t.isFirstTimeUser())&&ne.info("👤 First-time user detected - showing account creation form");setTimeout(()=>{lr(v,!1)},1e3)}),Ur(()=>{if("undefined"!=typeof window&&window.customElements&&ka(f)&&!ka(c)){o()&&ne.info("Found web component element for attribute reflection for:",ka(f));const e=null===ka(f)||void 0===ka(f)?void 0:ka(f).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();if(e.includes("prefill-data")){const e=t.getAttribute("prefill-data");e&&(i(JSON.parse(e)),async function(){var e,t,r,a,n,o,l,s,c,v,f,h,g,m,b,y,w,_,x,C,E;const S=e=>null==e?"":String(e);u.state.formData.firstName=S(null===(t=null===(e=i().information)||void 0===e?void 0:e.consumer_information)||void 0===t?void 0:t.first_name),u.state.formData.middleName=S(null===(a=null===(r=i().information)||void 0===r?void 0:r.consumer_information)||void 0===a?void 0:a.middle_name),u.state.formData.lastName=S(null===(o=null===(n=i().information)||void 0===n?void 0:n.consumer_information)||void 0===o?void 0:o.last_name),u.state.formData.email=S(null===(s=null===(l=i().information)||void 0===l?void 0:l.consumer_information)||void 0===s?void 0:s.email_address),u.state.formData.phone=S(null===(v=null===(c=i().information)||void 0===c?void 0:c.consumer_information)||void 0===v?void 0:v.phone_number),u.state.formData.dateOfBirth=S(null===(h=null===(f=i().information)||void 0===f?void 0:f.consumer_information)||void 0===h?void 0:h.date_of_birth),u.state.formData.ssn=S(null===(m=null===(g=i().information)||void 0===g?void 0:g.consumer_information)||void 0===m?void 0:m.ssn),u.state.formData.addressLine1=S(null===(b=i().primary_address)||void 0===b?void 0:b.address_line_1),u.state.formData.addressLine2=S(null===(y=i().primary_address)||void 0===y?void 0:y.address_line_2),u.state.formData.addressCity=S(null===(w=i().primary_address)||void 0===w?void 0:w.city),u.state.formData.addressState=S(null===(_=i().primary_address)||void 0===_?void 0:_.state),u.state.formData.addressPostalCode=S(null===(x=i().primary_address)||void 0===x?void 0:x.postal_code),u.state.formData.addressCountry=S(null===(C=i().primary_address)||void 0===C?void 0:C.country)||"USA";const k=u.actions.validateAllFields();if(null===(E=u.state.alviereCore)||void 0===E?void 0:E.isScopedToPayee())return ne.info("🔄 Skipping auto-submit - returning user detected, checking existing account..."),lr(d,!1),void lr(p,!0);k?(ne.info("✅ Prefilled data is complete and valid, auto-submitting form..."),lr(d,!0),setTimeout(async()=>{await u.actions.submit()},100)):(ne.warn("⚠️ Prefilled data is incomplete or invalid, waiting for user input"),lr(d,!1))}())}if(e.includes("public-certificate")){const e=t.getAttribute("public-certificate");e&&l(e)}if(e.includes("public-certificate-id")){const e=t.getAttribute("public-certificate-id");e&&s(e)}}}lr(c,!0)});var h={get jwt(){return r()},set jwt(e=""){r(e),zt()},get businessUuid(){return a()},set businessUuid(e=""){a(e),zt()},get isInFlow(){return n()},set isInFlow(e=!1){n(e),zt()},get debug(){return o()},set debug(e=!0){o(e),zt()},get prefillData(){return i()},set prefillData(e={}){i(e),zt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),zt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),zt()}},g=nv(),m=Cr(g),b=e=>{Ha(e,ev())};pn(m,e=>{n()||ka(d)||ka(v)||ka(p)||e(b)});var y=Sr(m,2),w=e=>{var t=tv();let r;var a=Cr(t);Mn(a,"size","lg"),Mn(a,"variant","circular");var n=Cr(a),o=Cr(n),i=e=>{Ha(e,Ka("Account verified, proceeding..."))},l=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Checking account status..."))},n=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Your account is being validated..."))},n=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Waiting for account activation..."))},n=e=>{Ha(e,Ka("Creating consumer account..."))};pn(r,e=>{u.state.isPolling?e(a):e(n,!1)},!0),Ha(e,t)};pn(r,e=>{ka(d)?e(a):e(n,!1)},!0),Ha(e,t)};pn(r,e=>{ka(v)?e(a):e(n,!1)},!0),Ha(e,t)};pn(o,e=>{ka(p)?e(i):e(l,!1)}),it(n),it(a),it(t),Or(()=>r=En(t,1,"spinner-container svelte-1tz2qyj",null,r,{"spinner-standalone":ka(v)||ka(d)||ka(p)})),Qn(1,t,()=>Yu,()=>({duration:300})),Qn(2,t,()=>Yu,()=>({duration:200})),Ha(e,t)};pn(y,e=>{(u.state.isLoading||u.state.isPolling||ka(d)||ka(v)||ka(p))&&e(w)});var _=Sr(y,2);let x;var C=Cr(_),E=Sr(Cr(C),2),S=Cr(E);{let e=Qt(()=>u.state.validationErrors.firstName?"invalid":"neutral"),t=Qt(()=>u.state.validationErrors.firstName||"");ou(S,{label:"First Name",placeholder:"Enter first name",required:!0,oninput:e=>u.handlers.handleFieldChange("firstName",e.target.value),get validationState(){return ka(e)},get errorMessage(){return ka(t)},get value(){return u.state.formData.firstName},set value(e){u.state.formData.firstName=e}})}var k=Sr(S,2);{let e=Qt(()=>u.state.validationErrors.lastName?"invalid":"neutral"),t=Qt(()=>u.state.validationErrors.lastName||"");ou(k,{label:"Last Name",placeholder:"Enter last name",required:!0,oninput:e=>u.handlers.handleFieldChange("lastName",e.target.value),get validationState(){return ka(e)},get errorMessage(){return ka(t)},get value(){return u.state.formData.lastName},set value(e){u.state.formData.lastName=e}})}it(E);var A=Sr(E,2),T=Cr(A);{let e=Qt(()=>u.state.validationErrors.email?"invalid":"neutral"),t=Qt(()=>u.state.validationErrors.email||"");ou(T,{label:"Email Address",placeholder:"Enter email address",type:"email",required:!0,oninput:e=>u.handlers.handleFieldChange("email",e.target.value),get validationState(){return ka(e)},get errorMessage(){return ka(t)},get value(){return u.state.formData.email},set value(e){u.state.formData.email=e}})}it(A),it(C);var I=Sr(C,2),B=Cr(I),N=Cr(B),z=e=>{Ha(e,rv())};pn(N,e=>{u.computed.canSubmit||e(z)});var R=Sr(N,2),D=e=>{Ha(e,av())};pn(R,e=>{u.computed.hasErrors&&u.computed.canSubmit&&e(D)}),it(B);var L=Sr(B,2);Mn(L,"type","submit"),Or(()=>Mn(L,"disabled",!u.computed.canSubmit)),Mn(L,"variant","primary"),Mn(L,"size","md"),Or(()=>Mn(L,"handler",u.handlers.handleSubmit));var U=Cr(L),P=e=>{Ha(e,Ka("Creating Consumer Account..."))},V=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Waiting for Account Activation..."))},n=e=>{Ha(e,Ka("Create Consumer Account"))};pn(r,e=>{u.state.isPolling?e(a):e(n,!1)},!0),Ha(e,t)};return pn(U,e=>{u.state.isLoading?e(P):e(V,!1)}),it(L),it(I),it(_),ro(_,e=>u.state.formElement=e,()=>{var e;return null==(e=null==u?void 0:u.state)?void 0:e.formElement}),it(g),ro(g,e=>lr(f,e),()=>ka(f)),Or(()=>x=kn(_,"",x,{display:ka(v)||ka(d)||ka(p)?"none":"block"})),La("submit",_,function(...e){var t;null==(t=u.handlers.handleSubmit)||t.apply(this,e)}),Ha(e,g),gt(h)}customElements.define("alviere-create-consumer-account",po(iv,{jwt:{},businessUuid:{},isInFlow:{},debug:{},prefillData:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var lv=qa('<h2 class="svelte-1rcnpnj">Create Business Account</h2>'),sv=qa('<div><alviere-spinner><span slot="message"><!></span></alviere-spinner></div>',2),cv=qa('<span class="validation-hint svelte-1rcnpnj">Please fill in all required fields to continue</span>'),uv=qa('<span class="validation-error">Please fix the errors above</span>'),vv=qa('<div class="alviere-create-business-account svelte-1rcnpnj"><!> <!> <form novalidate=""><div class="form-section svelte-1rcnpnj"><h3 class="svelte-1rcnpnj">Business Information</h3> <div class="form-row svelte-1rcnpnj"><!> <!></div> <div class="form-row svelte-1rcnpnj"><!> <!></div> <div class="form-row svelte-1rcnpnj"><!></div></div> <div class="form-actions svelte-1rcnpnj"><div class="form-status svelte-1rcnpnj"><!> <!></div> <alviere-button><!></alviere-button></div></form></div>',2);const dv={hash:"svelte-1rcnpnj",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-create-business-account.svelte-1rcnpnj {max-width:100%;margin:0 auto;font-family:\"Darker Grotesque\", sans-serif;line-height:1;position:relative;}.spinner-container.svelte-1rcnpnj {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}.spinner-standalone.svelte-1rcnpnj {position:relative !important;min-height:200px;display:flex;align-items:center;justify-content:center;}h2.svelte-1rcnpnj {color:#333;margin-bottom:20px;text-align:center;}h3.svelte-1rcnpnj {color:#555;margin-bottom:15px;border-bottom:2px solid #eee;padding-bottom:5px;}.form-section.svelte-1rcnpnj {margin-bottom:30px;padding:20px;background:#f9f9f9;border-radius:8px;}.form-row.svelte-1rcnpnj {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.form-status.svelte-1rcnpnj {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-1rcnpnj {color:#6b7280;font-size:0.875rem;font-style:italic;}.form-actions.svelte-1rcnpnj {margin-top:24px;text-align:center;}"};function pv(e,t){var r,a;ht(t,!0),mn(e,dv);let n=co(t,"jwt",7,""),o=co(t,"businessUuid",15,""),i=co(t,"isInFlow",15,!1),l=co(t,"debug",15,!0),s=co(t,"prefillData",31,()=>dr({})),c=co(t,"publicCertificate",15,""),u=co(t,"publicCertificateId",15,""),v=or(!1);const d={externalId:"",businessType:(null===(a=null===(r=null===s()||void 0===s()?void 0:s().information)||void 0===r?void 0:r.business_information)||void 0===a?void 0:a.business_type)||"SOLE_PROPRIETORSHIP",businessName:"",doingBusinessAs:"",stateOfIncorporation:"",countryOfIncorporation:"",incorporationDate:"",ein:"",addressLabel:"Primary Address",addressLine1:"",addressLine2:"",addressCity:"",addressState:"",addressPostalCode:"",addressCountry:"USA"},p=[{value:"SOLE_PROPRIETORSHIP",label:"Sole Proprietorship"},{value:"LLC",label:"LLC"},{value:"LLP",label:"LLP"},{value:"CORPORATION_C",label:"Corporation C"},{value:"CORPORATION_S",label:"Corporation S"}],f=[{code:"AL",name:"Alabama"},{code:"AK",name:"Alaska"},{code:"AZ",name:"Arizona"},{code:"AR",name:"Arkansas"},{code:"CA",name:"California"},{code:"CO",name:"Colorado"},{code:"CT",name:"Connecticut"},{code:"DE",name:"Delaware"},{code:"FL",name:"Florida"},{code:"GA",name:"Georgia"},{code:"HI",name:"Hawaii"},{code:"ID",name:"Idaho"},{code:"IL",name:"Illinois"},{code:"IN",name:"Indiana"},{code:"IA",name:"Iowa"},{code:"KS",name:"Kansas"},{code:"KY",name:"Kentucky"},{code:"LA",name:"Louisiana"},{code:"ME",name:"Maine"},{code:"MD",name:"Maryland"},{code:"MA",name:"Massachusetts"},{code:"MI",name:"Michigan"},{code:"MN",name:"Minnesota"},{code:"MS",name:"Mississippi"},{code:"MO",name:"Missouri"},{code:"MT",name:"Montana"},{code:"NE",name:"Nebraska"},{code:"NV",name:"Nevada"},{code:"NH",name:"New Hampshire"},{code:"NJ",name:"New Jersey"},{code:"NM",name:"New Mexico"},{code:"NY",name:"New York"},{code:"NC",name:"North Carolina"},{code:"ND",name:"North Dakota"},{code:"OH",name:"Ohio"},{code:"OK",name:"Oklahoma"},{code:"OR",name:"Oregon"},{code:"PA",name:"Pennsylvania"},{code:"RI",name:"Rhode Island"},{code:"SC",name:"South Carolina"},{code:"SD",name:"South Dakota"},{code:"TN",name:"Tennessee"},{code:"TX",name:"Texas"},{code:"UT",name:"Utah"},{code:"VT",name:"Vermont"},{code:"VA",name:"Virginia"},{code:"WA",name:"Washington"},{code:"WV",name:"West Virginia"},{code:"WI",name:"Wisconsin"},{code:"WY",name:"Wyoming"},{code:"DC",name:"District of Columbia"},{code:"AS",name:"American Samoa"},{code:"GU",name:"Guam"},{code:"MP",name:"Northern Mariana Islands"},{code:"PR",name:"Puerto Rico"},{code:"VI",name:"U.S. Virgin Islands"}],h=[{value:"USA",label:"United States"},{value:"CAN",label:"Canada"},{value:"MEX",label:"Mexico"},{value:"GBR",label:"United Kingdom"}],g=Zu({jwt:n(),businessUuid:o(),publicCertificate:c(),publicCertificateId:u(),debug:l(),isInFlow:i(),initialData:d,fieldSchemas:{businessType:{required:"Business Type is required"},businessName:{required:"Business Name is required",alphabetic:!0},countryOfIncorporation:{required:"Country of Incorporation is required"},stateOfIncorporation:{required:"State of Incorporation is required"},ein:{required:"EIN is required",pattern:{regex:/^\d{2}-\d{7}$/,message:"Please enter a valid EIN"}}},formName:"CreateBusinessAccount",stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0,enableAlviereCore:!0,submitHandler:async e=>{var t,r;const a={business_type:e.businessType,business_name:e.businessName,state_of_incorporation:e.stateOfIncorporation,country_of_incorporation:e.countryOfIncorporation,ein:e.ein||void 0},n={external_id:e.externalId||`business-${Date.now()}`,information:{business_information:a},profile:s().profile||void 0,account_type:"BUSINESS",parent_account_uuid:o()};if(!g.state.alviereCore)throw new Pl(Vl,"AlviereCore not initialized");null===(r=null===(t=g.state.alviereCore)||void 0===t?void 0:t.getLogger())||void 0===r||r.info("🔍 Creating business account using AlviereCore...");const i=g.state.alviereCore.createAccountsService(),l=await i.createAccount(n);if(l.account.account_uuid&&ka(w)){const e=new CustomEvent(uc,{detail:{account_uuid:l.account.account_uuid,status:"CREATED"},bubbles:!0,composed:!0});ka(w).dispatchEvent(e),ne.info("🚀 Dispatched account CREATED event:",e.detail)}if(l.account.account_uuid){g.actions.setPolling(!0);try{const e=await async function(e,t=5,r=6e3){if(!g.state.alviereCore)throw new Error("AlviereCore not initialized");const a=g.state.alviereCore.createAccountsService();for(let o=1;o<=t;o++)try{ne.info(`🔍 Polling account status (attempt ${o}/${t})...`);const n=await a.getAccount(e);if("ACTIVE"===n.account.status)return ne.info("✅ Account is now ACTIVE"),n;ne.info(`⏳ Account status: ${n.account.status}, waiting...`),o<t&&await new Promise(e=>setTimeout(e,r))}catch(n){if(ne.error(`❌ Error polling account status (attempt ${o}):`,n),o===t)throw new Error(`Failed to poll account status after ${t} attempts: ${n}`)}throw new Pl("115001",`Account did not become active after ${t} polling attempts`)}(l.account.account_uuid);return e}finally{g.actions.setPolling(!1)}}return l},resultTransformer:e=>({account_uuid:e.account.account_uuid}),onSuccessCallback:(e,t)=>{t.dispatch(uc,{account_uuid:e.account.account_uuid,status:e.account.status})}});let m=or(!1),b=or(!1),y=or(!1),w=or(null);vn(async()=>{var e,t;if(lr(m,!0),null===(e=g.state.alviereCore)||void 0===e?void 0:e.isScopedToPayee()){const e=g.state.alviereCore.getAccountUuid();if(ne.info("🔄 Returning user detected - JWT already scoped to payor account:",e),e&&"862a2524-ce32-4fa7-b138-e7ac7e93c022"!==e)try{const t=await async function(e){if(ne.info("🔍 Checking if account exists and is active...",e),ne.warn("🔍 Debug:",l()),!g.state.alviereCore)throw new Error("AlviereCore not initialized");const t=g.state.alviereCore.createAccountsService(),r=await t.getAccount(e);if(ne.info("🔍 Account result:",r.account),"ACTIVE"===r.account.status)return r;throw ne.error(`❌ Account exists but is not active. Status: ${r.account.status}`,r.account),new Pl(ns,`Account exists but is not active. Current status: ${r.account.status}`)}(e);if(t)return ne.info("✅ Business account already exists and is active - skipping creation:",t),lr(y,!0),void setTimeout(()=>{if(ka(w)){const e=new CustomEvent(uc,{detail:{account_uuid:t.account.account_uuid,status:t.account.status,skipped:!0},bubbles:!0,composed:!0});ka(w).dispatchEvent(e),ne.info("🚀 Dispatched account event (skipped) from host element:",e);const r=new CustomEvent(rc,{detail:{account_uuid:t.account.account_uuid,stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0,success:!0,skipped:!0},bubbles:!0,composed:!0});ka(w).dispatchEvent(r),ne.info("🚀 Dispatched form-success event (skipped) from host element:",r)}},100)}catch(r){if(r instanceof Pl&&r.isErrorCode(ns)){if(ne.error("❌ Critical error: Account exists but is not active"),ka(w)){const e=new CustomEvent(ac,{detail:{error:r,stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0},bubbles:!0,composed:!0});ka(w).dispatchEvent(e),ne.info("🚀 Dispatched form-error event to MultiStepFlow:",e.detail)}return}ne.warn("⚠️ Failed to fetch existing account, will show form:",r)}}else(null===(t=g.state.alviereCore)||void 0===t?void 0:t.isFirstTimeUser())&&ne.info("👤 First-time user detected - showing account creation form");setTimeout(()=>{lr(m,!1)},1e3)}),Ur(()=>{if("undefined"!=typeof window&&window.customElements&&ka(w)&&!ka(v)){l()&&ne.info("Found web component element for attribute reflection for:",ka(w));const e=null===ka(w)||void 0===ka(w)?void 0:ka(w).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();if(e.includes("prefill-data")){const e=t.getAttribute("prefill-data");e&&(s(JSON.parse(e)),async function(){var e,t,r,a,n,o,i,l,c,u,v,d,p,f,h,m,w,_,x,C,E;const S=e=>null==e?"":String(e);g.state.formData.businessType=S(null===(t=null===(e=s().information)||void 0===e?void 0:e.business_information)||void 0===t?void 0:t.business_type),g.state.formData.businessName=S(null===(a=null===(r=s().information)||void 0===r?void 0:r.business_information)||void 0===a?void 0:a.business_name),g.state.formData.doingBusinessAs=S(null===(o=null===(n=s().information)||void 0===n?void 0:n.business_information)||void 0===o?void 0:o.doing_business_as),g.state.formData.stateOfIncorporation=S(null===(l=null===(i=s().information)||void 0===i?void 0:i.business_information)||void 0===l?void 0:l.state_of_incorporation),g.state.formData.countryOfIncorporation=S(null===(u=null===(c=s().information)||void 0===c?void 0:c.business_information)||void 0===u?void 0:u.country_of_incorporation),g.state.formData.incorporationDate=S(null===(d=null===(v=s().information)||void 0===v?void 0:v.business_information)||void 0===d?void 0:d.incorporation_date),g.state.formData.ein=S(null===(f=null===(p=s().information)||void 0===p?void 0:p.business_information)||void 0===f?void 0:f.ein),g.state.formData.addressLine1=S(null===(h=s().primary_address)||void 0===h?void 0:h.address_line_1),g.state.formData.addressLine2=S(null===(m=s().primary_address)||void 0===m?void 0:m.address_line_2),g.state.formData.addressCity=S(null===(w=s().primary_address)||void 0===w?void 0:w.city),g.state.formData.addressState=S(null===(_=s().primary_address)||void 0===_?void 0:_.state),g.state.formData.addressPostalCode=S(null===(x=s().primary_address)||void 0===x?void 0:x.postal_code),g.state.formData.addressCountry=S(null===(C=s().primary_address)||void 0===C?void 0:C.country)||"USA";const k=g.actions.validateAllFields();if(null===(E=g.state.alviereCore)||void 0===E?void 0:E.isScopedToPayee())return ne.info("🔄 Skipping auto-submit - returning user detected, checking existing account..."),lr(b,!1),void lr(y,!0);k?(ne.info("✅ Prefilled data is complete and valid, auto-submitting form..."),lr(b,!0),setTimeout(async()=>{await g.actions.submit()},100)):(ne.warn("⚠️ Prefilled data is incomplete or invalid, waiting for user input"),lr(b,!1))}())}if(e.includes("public-certificate")){const e=t.getAttribute("public-certificate");e&&c(e)}if(e.includes("public-certificate-id")){const e=t.getAttribute("public-certificate-id");e&&u(e)}}}lr(v,!0)});var _={get jwt(){return n()},set jwt(e=""){n(e),zt()},get businessUuid(){return o()},set businessUuid(e=""){o(e),zt()},get isInFlow(){return i()},set isInFlow(e=!1){i(e),zt()},get debug(){return l()},set debug(e=!0){l(e),zt()},get prefillData(){return s()},set prefillData(e={}){s(e),zt()},get publicCertificate(){return c()},set publicCertificate(e=""){c(e),zt()},get publicCertificateId(){return u()},set publicCertificateId(e=""){u(e),zt()}},x=vv(),C=Cr(x),E=e=>{Ha(e,lv())};pn(C,e=>{i()||ka(b)||ka(m)||ka(y)||e(E)});var S=Sr(C,2),k=e=>{var t=sv();let r;var a=Cr(t);Mn(a,"size","lg"),Mn(a,"variant","circular");var n=Cr(a),o=Cr(n),i=e=>{Ha(e,Ka("Account verified, proceeding..."))},l=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Checking account status..."))},n=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Your account is being validated..."))},n=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Waiting for account activation..."))},n=e=>{Ha(e,Ka("Creating business account..."))};pn(r,e=>{g.state.isPolling?e(a):e(n,!1)},!0),Ha(e,t)};pn(r,e=>{ka(b)?e(a):e(n,!1)},!0),Ha(e,t)};pn(r,e=>{ka(m)?e(a):e(n,!1)},!0),Ha(e,t)};pn(o,e=>{ka(y)?e(i):e(l,!1)}),it(n),it(a),it(t),Or(()=>r=En(t,1,"spinner-container svelte-1rcnpnj",null,r,{"spinner-standalone":ka(m)||ka(b)||ka(y)})),Qn(1,t,()=>Yu,()=>({duration:300})),Qn(2,t,()=>Yu,()=>({duration:200})),Ha(e,t)};pn(S,e=>{(g.state.isLoading||g.state.isPolling||ka(b)||ka(m)||ka(y))&&e(k)});var A=Sr(S,2);let T;var I=Cr(A),B=Sr(Cr(I),2),N=Cr(B);{let e=Qt(()=>g.state.validationErrors.businessType?"invalid":"neutral"),t=Qt(()=>g.state.validationErrors.businessType||"");Vu(N,{label:"Business Type",get options(){return p},placeholder:"Select business type",required:!0,onchange:e=>g.handlers.handleFieldChange("businessType",e.detail.value),get validationState(){return ka(e)},get errorMessage(){return ka(t)},get value(){return g.state.formData.businessType},set value(e){g.state.formData.businessType=e}})}ou(Sr(N,2),{label:"Business Name",placeholder:"Enter business name",required:!0,oninput:e=>{var t;return g.handlers.handleFieldChange("businessName",(null==(t=e.target)?void 0:t.value)||"")},get value(){return g.state.formData.businessName},set value(e){g.state.formData.businessName=e}}),it(B);var z=Sr(B,2),R=Cr(z);{let e=Qt(()=>g.state.validationErrors.countryOfIncorporation?"invalid":"neutral"),t=Qt(()=>g.state.validationErrors.countryOfIncorporation||"");Vu(R,{label:"Country of Incorporation",get options(){return h},placeholder:"Select country of incorporation",required:!0,onchange:e=>g.handlers.handleFieldChange("countryOfIncorporation",e.detail.value),get validationState(){return ka(e)},get errorMessage(){return ka(t)},get value(){return g.state.formData.countryOfIncorporation},set value(e){g.state.formData.countryOfIncorporation=e}})}var D=Sr(R,2);{let e=Qt(()=>f.map(e=>({value:e.code,label:e.name}))),t=Qt(()=>g.state.validationErrors.stateOfIncorporation?"invalid":"neutral"),r=Qt(()=>g.state.validationErrors.stateOfIncorporation||"");Vu(D,{label:"State of Incorporation",get options(){return ka(e)},placeholder:"Select state of incorporation",required:!0,onchange:e=>g.handlers.handleFieldChange("stateOfIncorporation",e.detail.value),get validationState(){return ka(t)},get errorMessage(){return ka(r)},get value(){return g.state.formData.stateOfIncorporation},set value(e){g.state.formData.stateOfIncorporation=e}})}it(z);var L=Sr(z,2),U=Cr(L);{let e=Qt(()=>g.state.validationErrors.ein?"invalid":"neutral"),t=Qt(()=>g.state.validationErrors.ein||"");ou(U,{label:"EIN",placeholder:"Enter EIN",required:!0,oninput:e=>{var t;return g.handlers.handleFieldChange("ein",(null==(t=e.target)?void 0:t.value)||"")},get validationState(){return ka(e)},get errorMessage(){return ka(t)},get value(){return g.state.formData.ein},set value(e){g.state.formData.ein=e}})}it(L),it(I);var P=Sr(I,2),V=Cr(P),M=Cr(V),O=e=>{Ha(e,cv())};pn(M,e=>{g.computed.canSubmit||e(O)});var q=Sr(M,2),j=e=>{Ha(e,uv())};pn(q,e=>{g.computed.hasErrors&&e(j)}),it(V);var F=Sr(V,2);Mn(F,"type","submit"),Or(()=>Mn(F,"disabled",!g.computed.canSubmit)),Mn(F,"variant","primary"),Mn(F,"size","md"),Or(()=>Mn(F,"handler",g.handlers.handleSubmit));var K=Cr(F),$=e=>{Ha(e,Ka("Creating Business Account..."))},H=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,Ka("Waiting for Account Activation..."))},n=e=>{Ha(e,Ka("Create Business Account"))};pn(r,e=>{g.state.isPolling?e(a):e(n,!1)},!0),Ha(e,t)};return pn(K,e=>{g.state.isLoading?e($):e(H,!1)}),it(F),it(P),it(A),ro(A,e=>g.state.formElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.formElement}),it(x),ro(x,e=>lr(w,e),()=>ka(w)),Or(()=>T=kn(A,"",T,{display:ka(m)||ka(b)||ka(y)?"none":"block"})),La("submit",A,function(...e){var t;null==(t=g.handlers.handleSubmit)||t.apply(this,e)}),Ha(e,x),gt(_)}customElements.define("alviere-create-business-account",po(pv,{jwt:{},businessUuid:{},isInFlow:{},debug:{},prefillData:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var fv=qa("<alviere-create-business-account></alviere-create-business-account>",2),hv=qa("<alviere-create-consumer-account></alviere-create-consumer-account>",2);function gv(e,t){var r,a;ht(t,!0);let n=co(t,"config",31,()=>dr({})),o=co(t,"jwt",7,""),i=co(t,"debug",7,!1),l=co(t,"publicCertificate",7,""),s=co(t,"publicCertificateId",7,""),c=co(t,"businessUuid",7,"");ne.info("config",n());let u=or(dr(!!(null===(a=null===(r=n().formData)||void 0===r?void 0:r.information)||void 0===a?void 0:a.business_information))),v=or(dr(n().formData));ne.info("prefillData",ka(v));var d={get config(){return n()},set config(e={}){n(e),zt()},get jwt(){return o()},set jwt(e=""){o(e),zt()},get debug(){return i()},set debug(e=!1){i(e),zt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),zt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),zt()},get businessUuid(){return c()},set businessUuid(e=""){c(e),zt()}},p=$a(),f=Er(p),h=e=>{var t=fv();Or(()=>Mn(t,"prefill-data",JSON.stringify(n().formData))),Or(()=>Mn(t,"jwt",o())),Or(()=>Mn(t,"businessUuid",c())),Or(()=>Mn(t,"debug",i())),Or(()=>Mn(t,"publicCertificate",l())),Or(()=>Mn(t,"publicCertificateId",s())),Ha(e,t)},g=e=>{var t=hv();Or(()=>Mn(t,"prefill-data",JSON.stringify(n().formData))),Or(()=>Mn(t,"jwt",o())),Or(()=>Mn(t,"businessUuid",c())),Or(()=>Mn(t,"publicCertificate",l())),Or(()=>Mn(t,"publicCertificateId",s())),Ha(e,t)};return pn(f,e=>{ka(u)?e(h):e(g,!1)}),Ha(e,p),gt(d)}customElements.define("alviere-create-account",po(gv,{config:{},jwt:{},debug:{},publicCertificate:{},publicCertificateId:{},businessUuid:{}},[],[],!0));const mv=new Map,bv={"011000015":{routing_number:"011000015",name:"Federal Reserve Bank",city:"Atlanta"},"021001208":{routing_number:"021001208",name:"Federal Reserve Bank",city:"East Rutherford"},"021000322":{routing_number:"021000322",name:"Bank of America, N.A.",city:"Richmond"},"031000503":{routing_number:"031000503",name:"Wells Fargo Bank",city:"Minneapolis"},"041000014":{routing_number:"041000014",name:"Federal Reserve Bank",city:"Atlanta"},"051000017":{routing_number:"051000017",name:"Bank of A merica, N.A.",city:"Henrico"},"061000104":{routing_number:"061000104",name:"Suntrust",city:"Orlando"},"071000013":{routing_number:"071000013",name:"JPMorgan Chase",city:"Belleville"},"081000032":{routing_number:"081000032",name:"Bank of America, N.A.",city:"Henrico"},"091000019":{routing_number:"091000019",name:"Wells Fargo Bank",city:"Minneapolis"},111000025:{routing_number:"111000025",name:"Bank of America, N.A.",city:"Henrico"},121058313:{routing_number:"121058313",name:"Federal Reserve Bank SF- B, S & R",city:"San Francisco"},"021000021":{routing_number:"021000021",name:"JPMorgan Chase Bank",city:"Tampa"},"026009593":{routing_number:"026009593",name:"Bank of America, N.A.",city:"Richmond"},121000248:{routing_number:"121000248",name:"Wells Fargo Bank",city:"Minneapolis"},"021000089":{routing_number:"021000089",name:"Citibank",city:"New Castle"}},yv={"01":"Boston","02":"New York","03":"Philadelphia","04":"Cleveland","05":"Richmond","06":"Atlanta","07":"Chicago","08":"St. Louis","09":"Minneapolis",10:"Kansas City",11:"Dallas",12:"San Francisco"};async function wv(e,t){const r=e.replace(/[-\s]/g,"");if(!/^\d{9}$/.test(r))return null;if(mv.has(r))return mv.get(r);if(t)try{const e=t.createBankInfoService(),a=await e.getBankInfo(r);if(a&&a.bank_info)return a.bank_info}catch(a){return t.getLogger().info(`Bank info API call failed, using local lookup: ${a}`),t.getLogger().warn("⚠️ [DEPRECATED] Using local routing number lookup as fallback. This will be removed in a future version. Ensure API connectivity for accurate bank information."),_v(r)}return null==t||t.getLogger().warn("⚠️ [DEPRECATED] Using local routing number lookup. This will be removed in a future version. Pass AlviereCore instance to lookupRoutingNumber() for API-based lookup."),_v(r)}function _v(e){const t=e.replace(/[-\s]/g,"");if(!/^\d{9}$/.test(t))return null;if(bv[t])return bv[t];const r=t.substring(0,2);if(yv[r])return{routing_number:t,name:"Federal Reserve Bank",city:yv[r]};const a=parseInt(t.charAt(0));return 0===a||1===a?{routing_number:t,name:"Federal Reserve Bank",city:yv[r]}:2===a||3===a?{routing_number:t,name:"Commercial Bank",city:"Unknown"}:4===a||5===a?{routing_number:t,name:"Thrift Institution",city:"Unknown"}:6===a||7===a?{routing_number:t,name:"Credit Union",city:"Unknown"}:8===a?{routing_number:t,name:"Special Purpose",city:"Unknown"}:{routing_number:t,name:"Unknown Bank",city:"Unknown"}}function xv(e){const t=e.replace(/[-\s]/g,"");return 9===t.length?`${t.slice(0,3)}-${t.slice(3,6)}-${t.slice(6)}`:e}var Cv=qa('<div class="spinner-container svelte-t9z8bl"><alviere-spinner></alviere-spinner></div>',2),Ev=qa('<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl">Region:</span> <span class="value svelte-t9z8bl"> </span></div>'),Sv=qa('<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl">Description:</span> <span class="value description svelte-t9z8bl"> </span></div>'),kv=qa('<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl">Bank:</span> <span class="value svelte-t9z8bl"> </span></div> <!> <!>',1),Av=qa('<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl">Account Type:</span> <span class="value svelte-t9z8bl"> </span></div>'),Tv=qa('<alviere-list-item><div slot="leading"><alviere-badge> </alviere-badge></div> <div slot="primary-text"><span> </span></div> <div slot="secondary-text"><span> </span></div> <div slot="tertiary-text"><span> </span></div> <div slot="actions"><alviere-button></alviere-button></div> <div slot="expanded-content"><div class="bank-accounts-section__card-content svelte-t9z8bl"><div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl">Account Number:</span> <span class="value svelte-t9z8bl"> </span></div> <div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl">Routing/SWIFT:</span> <span class="value svelte-t9z8bl"> </span></div> <!> <!></div></div></alviere-list-item>',2),Iv=qa('<div class="bank-accounts-section svelte-t9z8bl"><div class="alviere-add-bank-account__header svelte-t9z8bl"><h2 class="svelte-t9z8bl"> </h2> <alviere-button>Add New Bank Account</alviere-button></div> <alviere-list></alviere-list> <div class="alviere-add-bank-account__footer svelte-t9z8bl"><alviere-button>Continue to Payment</alviere-button></div></div>',2),Bv=qa('<alviere-button><span class="alviere-add-bank-account__button__label">Back to Bank Accounts</span></alviere-button>',2),Nv=qa('<span class="bank-region svelte-t9z8bl"> </span>'),zv=qa('<div class="routing-info svelte-t9z8bl"><div class="routing-info-header svelte-t9z8bl"><span class="bank-name svelte-t9z8bl"> </span> <!></div></div>'),Rv=qa("<alviere-spinner></alviere-spinner>",2),Dv=qa("<!> <!>",1),Lv=qa('<div class="alviere-add-bank-account__form__row alviere-add-bank-account__form__row--banking-info svelte-t9z8bl"><alviere-badge>ACH</alviere-badge> <!></div> <div class="alviere-add-bank-account__form__row svelte-t9z8bl"><!> <!></div> <div class="alviere-add-bank-account__form__row svelte-t9z8bl"><!> <!></div>',3),Uv=qa('<span class="validation-hint svelte-t9z8bl">Please fill in all required fields to continue</span>'),Pv=qa('<span class="validation-error svelte-t9z8bl">Please fix the errors above</span>'),Vv=qa('<span class="validation-error svelte-t9z8bl" role="alert"> </span>'),Mv=qa('<form novalidate="" class="alviere-add-bank-account__form svelte-t9z8bl"><div class="alviere-add-bank-account__header svelte-t9z8bl"><h2 class="svelte-t9z8bl">Add Bank Account</h2> <!></div> <div class="alviere-add-bank-account__form__section"><!></div> <div class="form-actions svelte-t9z8bl"><div class="form-status svelte-t9z8bl"><!> <!> <!></div> <alviere-button> </alviere-button></div></form>',2),Ov=qa('<div class="alviere-add-bank-account svelte-t9z8bl"><!> <!> <!></div>');const qv={hash:"svelte-t9z8bl",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-add-bank-account.svelte-t9z8bl {max-width:100%;margin:0 auto;font-family:\"Darker Grotesque\", sans-serif;line-height:1;position:relative;}.alviere-add-bank-account__header.svelte-t9z8bl {display:flex;justify-content:space-between;align-items:center;margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid #eee;}.alviere-add-bank-account__header.svelte-t9z8bl h2:where(.svelte-t9z8bl) {font-size:1.25rem;color:var(--gray-700);margin:0;}\n@media (max-width: 768px) {.alviere-add-bank-account__header.svelte-t9z8bl {justify-content:space-between;}\n}\n@media (max-width: 768px) {.alviere-add-bank-account__header.svelte-t9z8bl .alviere-add-bank-account__button__label {display:none;}\n}.alviere-add-bank-account__footer.svelte-t9z8bl {display:flex;justify-content:center;align-items:center;padding-top:2rem;}.alviere-add-bank-account__form.svelte-t9z8bl {max-width:100%;margin:0 auto;font-family:\"Darker Grotesque\", sans-serif;line-height:1;background:#ffffff;}.alviere-add-bank-account__form__row.svelte-t9z8bl {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.alviere-add-bank-account__form__row--banking-info.svelte-t9z8bl {display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:0.5rem;}.routing-info.svelte-t9z8bl {border-radius:6px;padding:0.5rem;}.routing-info-header.svelte-t9z8bl {display:flex;align-items:center;gap:0.5rem;}.routing-info.svelte-t9z8bl .bank-name:where(.svelte-t9z8bl) {font-weight:600;color:var(--gray-600);font-size:0.75rem;}.bank-region.svelte-t9z8bl {color:var(--gray-600);font-size:0.75rem;}.bank-accounts-section.svelte-t9z8bl {margin:0 auto;background:#fff;}.bank-accounts-section__card-content.svelte-t9z8bl {display:flex;flex-direction:column;gap:0.75rem;padding:1rem;padding-top:0.5rem;}.bank-accounts-section__card-content__info-row.svelte-t9z8bl {display:flex;justify-content:space-between;align-items:center;padding:0.5rem 0 0;}.bank-accounts-section__card-content__info-row.svelte-t9z8bl .label:where(.svelte-t9z8bl) {font-weight:500;color:#495057;font-size:0.9rem;}.bank-accounts-section__card-content__info-row.svelte-t9z8bl .value:where(.svelte-t9z8bl) {font-weight:600;color:#212529;font-size:0.9rem;}.form-actions.svelte-t9z8bl {margin-top:24px;text-align:center;}.form-status.svelte-t9z8bl {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-t9z8bl {color:#6b7280;font-size:0.875rem;font-style:italic;}.validation-error.svelte-t9z8bl {color:#b3311f;font-size:1.125rem;font-weight:500;margin-top:0.25rem;}.spinner-container.svelte-t9z8bl {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}"};function jv(e,t){ht(t,!0),mn(e,qv);let r=co(t,"jwt",7,""),a=co(t,"accountUuid",7,""),n=co(t,"debug",7,!0),o=co(t,"onsuccess",15),i=co(t,"publicCertificate",7,""),l=co(t,"publicCertificateId",7,""),s=co(t,"requireRoutingAndAccountConfirmation",7,!1);const c=Object.assign({external_id:{required:!0},country:{required:!0},currency:{required:!0},bankAccountType:{required:!0},ach_routing_number:{required:"Routing number is required",pattern:{regex:/^\d{9}$/,message:"Routing number must be exactly 9 digits"}},ach_account_number:{required:"Account number is required",numeric:"Account number must contain only digits",minLength:{value:3,message:"Account number must be at least 3 digits"}}},s()&&{confirm_routing_number:{required:"Please confirm your routing number",pattern:{regex:/^\d{9}$/,message:"Routing number must be exactly 9 digits"},match:{fieldRef:()=>u.state.formData.ach_details.routing_number||"",message:"Routing number confirmation does not match"}},confirm_account_number:{required:"Please confirm your account number",numeric:"Account number must contain only digits",minLength:{value:3,message:"Account number must be at least 3 digits"},match:{fieldRef:()=>u.state.formData.ach_details.account_number||"",message:"Account number confirmation does not match"}}}),u=Zu({jwt:r(),debug:n(),publicCertificate:i(),publicCertificateId:l(),initialData:{external_id:"",country:"USA",currency:"USD",bankAccountType:"ACH",ach_details:{routing_number:"",account_number:""},eft_details:{institution_number:"",transit_number:"",account_number:""},iban_details:{iban:""},swift_details:{swift_code:"",account_number:""},clabe_details:{swift_code:"",account_number:""},metadata:"",confirm_routing_number:"",confirm_account_number:""},fieldSchemas:c,formName:"AddBankAccount",stepType:"ADD_BANK_ACCOUNT",submitHandler:async()=>{throw new Error("This should not be called - using custom handleAddBankAccount instead")}});let v=or(!1),d=or(!1),p=or(dr({bank_accounts:[]})),f=or(!1),h=or(null),g=or(null),m=or(null),b=or(!1),y=or(null);const w=Qt(()=>r()&&a());async function _(){var e;if(!u.state.alviereCore)throw new Error("AlviereCore not initialized");const t=u.state.alviereCore.createPaymentsService(),r=await t.processGetBankAccounts(a());if(r.bank_accounts.length){const t=r.bank_accounts.map(e=>Object.assign(Object.assign({},e),{isExpanded:!1}));ka(p).bank_accounts=t.filter(e=>"ACTIVE"===e.status),lr(h,(null===(e=ka(p).bank_accounts[0])||void 0===e?void 0:e.payment_method_uuid)||null,!0)}lr(v,!1)}async function x(e){var t,r;if(e.preventDefault(),u.computed.canSubmit)try{lr(d,!0),lr(g,null),u.actions.clearAllErrors();if(!u.actions.validateAllFields())return void ne.error("Form validation failed");const e=u.state.formData,o={external_id:e.external_id||`bank-${Date.now()}`,country:e.country,currency:e.currency,bank_account_details:{}};if(e.metadata)try{o.metadata=JSON.parse(e.metadata)}catch(n){return void lr(g,"Metadata must be valid JSON.")}if("ACH"===e.bankAccountType)o.bank_account_details.ach_details=e.ach_details;const i=u.state.alviereCore.createPaymentsService(),l=await i.processAddBankAccountWithValidation(a(),o);if(ne.info("Bank account API response:",l),"FAILED"===(null===(t=l.bank_account)||void 0===t?void 0:t.status)){ne.error("❌ Bank account creation failed with status FAILED"),lr(g,"Bank account validation failed. Please check your routing and account numbers and try again.");const e=`bank-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;return u.state.formData.external_id=e,void ne.info("🔄 Regenerated external_id after FAILED status:",e)}if(ne.info("✅ Bank account added successfully:",l),(null===(r=l.bank_account)||void 0===r?void 0:r.payment_method_uuid)&&ka(y)){const e=new CustomEvent(vc,{detail:{payment_method_uuid:l.bank_account.payment_method_uuid,status:l.bank_account.status||"CREATED"},bubbles:!0,composed:!0});ka(y).dispatchEvent(e),ne.info("🚀 Dispatched payment-method event after bank account addition:",e.detail)}await _(),u.actions.reset(),lr(g,null),lr(f,!1)}catch(n){ne.error("❌ Error adding bank account:",n),lr(g,n instanceof Error?n.message:String(n),!0)}finally{lr(d,!1)}else ne.debug("Cannot submit: form validation failed")}Ur(()=>{if(ka(f)||!ka(v)&&0===ka(p).bank_accounts.length){const e=`bank-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;u.state.formData.external_id=e,ne.info("🔄 Generated new external_id for bank account:",e)}}),Ur(()=>{const e=u.state.formData.ach_details.routing_number;e&&9===e.length&&u.state.alviereCore?(lr(b,!0),wv(e,u.state.alviereCore).then(e=>{lr(m,e,!0)}).catch(e=>{lr(m,null)}).finally(()=>{lr(b,!1)})):lr(m,null)}),vn(async()=>{if(lr(v,!0),!ka(w))throw new Error("Missing required credentials");u.actions.setFieldValue("external_id",`bank_${Date.now()}_${Math.random().toString(36).substring(2,8)}`),await _()});var C={get jwt(){return r()},set jwt(e=""){r(e),zt()},get accountUuid(){return a()},set accountUuid(e=""){a(e),zt()},get debug(){return n()},set debug(e=!0){n(e),zt()},get onsuccess(){return o()},set onsuccess(e){o(e),zt()},get publicCertificate(){return i()},set publicCertificate(e=""){i(e),zt()},get publicCertificateId(){return l()},set publicCertificateId(e=""){l(e),zt()},get requireRoutingAndAccountConfirmation(){return s()},set requireRoutingAndAccountConfirmation(e=!1){s(e),zt()}},E=Ov(),S=Cr(E),k=e=>{var t=Cv(),r=Cr(t);Mn(r,"size","lg"),Mn(r,"variant","circular"),it(t),Qn(1,t,()=>Yu,()=>({duration:300})),Qn(2,t,()=>Yu,()=>({duration:200})),Ha(e,t)};pn(S,e=>{(ka(v)||ka(d))&&e(k)});var A=Sr(S,2),T=e=>{var t=Iv(),r=Cr(t),n=Cr(r),o=Cr(n);it(n);var i=Sr(n,2);Mn(i,"variant","secondary"),Mn(i,"handler",()=>lr(f,!0)),Mn(i,"iconName","Plus"),it(r);var l=Sr(r,2);jt(l,21,()=>ka(p).bank_accounts,qt,(e,t,r)=>{const n=Qt(()=>function(e){const t=e.bank_account_details;if(null==t?void 0:t.ach_details){const r=wv(t.ach_details.routing_number||"");return{type:"ACH",accountNumber:e.last_4||"N/A",routingNumber:xv(t.ach_details.routing_number||""),accountType:e.type||"N/A",bankInfo:r}}return{type:"Unknown",accountNumber:"N/A",routingNumber:"N/A",accountType:"N/A",bankInfo:null}}(ka(t)));var o=Tv();Or(()=>Mn(o,"selectable",{group:ka(h),name:"bankAccount",value:ka(t).payment_method_uuid})),Or(()=>Mn(o,"selected",ka(h)===ka(t).payment_method_uuid)),Mn(o,"expandable",!0),Or(()=>Mn(o,"last",r===ka(p).bank_accounts.length-1));var i=Cr(o),l=Cr(i);Mn(l,"size","sm"),Mn(l,"variant","info");var s=Cr(l,!0);it(l),it(i);var c=Sr(i,2),v=Cr(c),f=Cr(v);it(v),it(c);var g=Sr(c,2),m=Cr(g),b=Cr(m,!0);it(m),it(g);var y=Sr(g,2),w=Cr(y),x=Cr(w,!0);it(w),it(y);var C=Sr(y,2),E=Cr(C);Mn(E,"variant","secondary"),Mn(E,"size","sm"),Mn(E,"handler",e=>{e.stopPropagation(),async function(e){lr(d,!0);const t=u.state.alviereCore.createPaymentsService();await t.processDeleteBankAccount(a(),e),await _(),lr(d,!1)}(ka(t).payment_method_uuid||"")}),Mn(E,"iconName","Trash"),it(C);var S=Sr(C,2),k=Cr(S),A=Cr(k),T=Sr(Cr(A),2),I=Cr(T);it(T),it(A);var B=Sr(A,2),N=Sr(Cr(B),2),z=Cr(N,!0);it(N),it(B);var R=Sr(B,2),D=e=>{var t=kv(),r=Er(t),a=Sr(Cr(r),2),o=Cr(a,!0);it(a),it(r);var i=Sr(r,2),l=e=>{var t=Ev(),r=Sr(Cr(t),2),a=Cr(r,!0);it(r),it(t),Or(()=>an(a,ka(n).bankInfo.region)),Ha(e,t)};pn(i,e=>{ka(n).bankInfo.region&&e(l)});var s=Sr(i,2),c=e=>{var t=Sv(),r=Sr(Cr(t),2),a=Cr(r,!0);it(r),it(t),Or(()=>an(a,ka(n).bankInfo.description)),Ha(e,t)};pn(s,e=>{ka(n).bankInfo.description&&e(c)}),Or(()=>an(o,ka(n).bankInfo.name)),Ha(e,t)};pn(R,e=>{ka(n).bankInfo&&e(D)});var L=Sr(R,2),U=e=>{var t=Av(),r=Sr(Cr(t),2),a=Cr(r,!0);it(r),it(t),Or(()=>an(a,ka(n).accountType)),Ha(e,t)};pn(L,e=>{"N/A"!==ka(n).accountType&&e(U)}),it(k),it(S),it(o),Or(()=>{var e;an(s,ka(n).type),an(f,`••••${ka(n).accountNumber??""}`),an(b,null==(e=ka(n).bankInfo)?void 0:e.name),an(x,ka(n).routingNumber),an(I,`••••${ka(n).accountNumber??""}`),an(z,ka(n).routingNumber)}),La("select",o,()=>{return e=ka(t).payment_method_uuid||"",void lr(h,e,!0);var e}),Ha(e,o)}),it(l);var s=Sr(l,2),c=Cr(s);Mn(c,"variant","primary"),Mn(c,"size","md"),Mn(c,"handler",()=>{if(ka(y)){const e=new CustomEvent(vc,{detail:{payment_method_uuid:ka(h),status:"ACTIVE"},bubbles:!0,composed:!0});ka(y).dispatchEvent(e),ne.info("🚀 Dispatched payment-method event from host element:",e);const t=new CustomEvent(rc,{detail:{stepType:"ADD_BANK_ACCOUNT",payment_method_uuid:ka(h),success:!0},bubbles:!0,composed:!0});ka(y).dispatchEvent(t),ne.info("🚀 Dispatched form-success event from host element:",t)}else ne.warn("⚠️ Host element not available for event dispatch")}),it(s),it(t),Or(()=>an(o,`Your Bank Accounts (${ka(p).bank_accounts.length??""})`)),Ha(e,t)};pn(A,e=>{ka(v)||ka(f)||!ka(p).bank_accounts.length||e(T)});var I=Sr(A,2),B=e=>{var t=Mv(),r=Cr(t),a=Sr(Cr(r),2),n=e=>{var t=Bv();Mn(t,"type","button"),Mn(t,"variant","secondary"),Mn(t,"handler",()=>lr(f,!1)),Mn(t,"iconName","X"),Ha(e,t)};pn(a,e=>{ka(p).bank_accounts.length>0&&e(n)}),it(r);var o=Sr(r,2),i=Cr(o),l=e=>{var t=Lv(),r=Er(t),a=Cr(r);Mn(a,"size","sm"),Mn(a,"variant","tertiary");var n=Sr(a,2),o=e=>{var t=Dv(),r=Er(t),a=e=>{var t=zv(),r=Cr(t),a=Cr(r),n=Cr(a,!0);it(a);var o=Sr(a,2),i=e=>{var t=Nv(),r=Cr(t);it(t),Or(()=>an(r,`(${ka(m).city??""})`)),Ha(e,t)};pn(o,e=>{var t;(null==(t=ka(m))?void 0:t.city)&&e(i)}),it(r),it(t),Or(()=>{var e;return an(n,null==(e=ka(m))?void 0:e.name)}),Ha(e,t)};pn(r,e=>{ka(m)&&e(a)});var n=Sr(r,2),o=e=>{var t=Rv();Mn(t,"size","sm"),Mn(t,"variant","circular"),Ha(e,t)};pn(n,e=>{ka(b)&&e(o)}),Ha(e,t)};pn(n,e=>{u.state.formData.ach_details.routing_number&&9===u.state.formData.ach_details.routing_number.length&&e(o)}),it(r);var i=Sr(r,2),l=Cr(i);{let e=Qt(()=>u.state.validationErrors.ach_routing_number?"invalid":"neutral"),t=Qt(()=>u.state.validationErrors.ach_routing_number||"");ou(l,{get value(){return u.state.formData.ach_details.routing_number},label:"Routing Number",placeholder:"Enter 9-digit routing number",helpText:"You can find your routing number on your check or bank statement.",required:!0,id:"ach_routing",get validationSchema(){return c.ach_routing_number},get validationState(){return ka(e)},get errorMessage(){return ka(t)},oninput:e=>{const t=e.target.value;u.state.formData.ach_details.routing_number=t,u.handlers.handleFieldChange("ach_routing_number",t)}})}var v=Sr(l,2),d=e=>{{let t=Qt(()=>u.state.validationErrors.confirm_routing_number?"invalid":"neutral"),r=Qt(()=>u.state.validationErrors.confirm_routing_number||"");ou(e,{get value(){return u.state.formData.confirm_routing_number},label:"Confirm Routing Number",placeholder:"Re-enter 9-digit routing number",helpText:"Please confirm your routing number to ensure accuracy.",required:!0,id:"confirm_ach_routing",get validationSchema(){return c.confirm_routing_number},get validationState(){return ka(t)},get errorMessage(){return ka(r)},oninput:e=>{const t=e.target.value;u.state.formData.confirm_routing_number=t,u.handlers.handleFieldChange("confirm_routing_number",t)},blockPaste:!0})}};pn(v,e=>{s()&&e(d)}),it(i);var p=Sr(i,2),f=Cr(p);{let e=Qt(()=>u.state.validationErrors.ach_account_number?"invalid":"neutral"),t=Qt(()=>u.state.validationErrors.ach_account_number||"");ou(f,{get value(){return u.state.formData.ach_details.account_number},label:"Account Number",placeholder:"Enter account number",required:!0,minlength:3,id:"ach_account",get validationSchema(){return c.ach_account_number},get validationState(){return ka(e)},get errorMessage(){return ka(t)},oninput:e=>{const t=e.target.value;u.state.formData.ach_details.account_number=t,u.handlers.handleFieldChange("ach_account_number",t)}})}var h=Sr(f,2),g=e=>{{let t=Qt(()=>u.state.validationErrors.confirm_account_number?"invalid":"neutral"),r=Qt(()=>u.state.validationErrors.confirm_account_number||"");ou(e,{get value(){return u.state.formData.confirm_account_number},label:"Confirm Account Number",placeholder:"Re-enter account number",helpText:"Please confirm your account number to ensure accuracy.",required:!0,minlength:3,id:"confirm_ach_account",get validationSchema(){return c.confirm_account_number},get validationState(){return ka(t)},get errorMessage(){return ka(r)},oninput:e=>{const t=e.target.value;u.state.formData.confirm_account_number=t,u.handlers.handleFieldChange("confirm_account_number",t)},blockPaste:!0})}};pn(h,e=>{s()&&e(g)}),it(p),Ha(e,t)};pn(i,e=>{"ACH"===u.state.formData.bankAccountType&&e(l)}),it(o);var v=Sr(o,2),h=Cr(v),y=Cr(h),w=e=>{Ha(e,Uv())};pn(y,e=>{u.computed.canSubmit||e(w)});var _=Sr(y,2),C=e=>{Ha(e,Pv())};pn(_,e=>{u.computed.hasErrors&&u.computed.canSubmit&&e(C)});var E=Sr(_,2),S=e=>{var t=Vv(),r=Cr(t,!0);it(t),Or(()=>an(r,ka(g))),Ha(e,t)};pn(E,e=>{ka(g)&&e(S)}),it(h);var k=Sr(h,2);Mn(k,"type","submit"),Mn(k,"variant","tertiary"),Mn(k,"size","md"),Or(()=>Mn(k,"disabled",!u.computed.canSubmit||ka(d))),Mn(k,"handler",x);var A=Cr(k,!0);it(k),it(v),it(t),ro(t,e=>u.state.formElement=e,()=>{var e;return null==(e=null==u?void 0:u.state)?void 0:e.formElement}),Or(()=>an(A,ka(d)?"Adding...":"Add Bank Account")),La("submit",t,x),Ha(e,t)};return pn(I,e=>{(ka(f)||!ka(v)&&!ka(p).bank_accounts.length)&&e(B)}),it(E),ro(E,e=>lr(y,e),()=>ka(y)),Ha(e,E),gt(C)}customElements.define("alviere-add-bank-account",po(jv,{jwt:{},accountUuid:{},debug:{},onsuccess:{},publicCertificate:{},publicCertificateId:{},requireRoutingAndAccountConfirmation:{}},[],[],!0));var Fv=qa('<div class="spinner-container svelte-1l48sab"><alviere-spinner></alviere-spinner></div>',2),Kv=qa('<div class="alviere-checkout-confirm svelte-1l48sab"><!> <div class="alviere-checkout-confirm__payment-info svelte-1l48sab"><alviere-currency-input></alviere-currency-input> <div class="alviere-checkout-confirm__terms-and-conditions"><p>By clicking "Pay", you agree to the <a href="https://www.alviere.com/terms-and-conditions" target="_blank">terms and conditions</a> and <a href="https://www.alviere.com/privacy-policy" target="_blank">privacy policy</a>.</p> <alviere-checkbox></alviere-checkbox></div> <alviere-button>Pay</alviere-button></div></div>',2);const $v={hash:"svelte-1l48sab",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-checkout-confirm.svelte-1l48sab {display:flex;flex-direction:column;gap:1rem;position:relative;padding:1rem 0;}.alviere-checkout-confirm__payment-info.svelte-1l48sab {display:flex;flex-direction:column;gap:2rem;}.alviere-checkout-confirm__payment-info.svelte-1l48sab alviere-button:where(.svelte-1l48sab) {align-self:center;}.alviere-checkout-confirm.svelte-1l48sab .spinner-container:where(.svelte-1l48sab) {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}"};function Hv(e,t){ht(t,!0),mn(e,$v);let r=co(t,"jwt",15,""),a=co(t,"accountUuid",15,""),n=co(t,"paymentMethodUuid",15,""),o=co(t,"amount",15,""),i=co(t,"debug",15,!0),l=co(t,"publicCertificate",15,""),s=co(t,"publicCertificateId",15,""),c=or(null),u=or(!1),v=or(dr(o())),d=or(!1);var p={get jwt(){return r()},set jwt(e=""){r(e),zt()},get accountUuid(){return a()},set accountUuid(e=""){a(e),zt()},get paymentMethodUuid(){return n()},set paymentMethodUuid(e=""){n(e),zt()},get amount(){return o()},set amount(e=""){o(e),zt()},get debug(){return i()},set debug(e=!0){i(e),zt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),zt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),zt()}},f=Kv(),h=Cr(f),g=e=>{var t=Fv(),r=Cr(t);Mn(r,"size","lg"),Mn(r,"variant","circular"),it(t),Qn(1,t,()=>Yu,()=>({duration:300})),Qn(2,t,()=>Yu,()=>({duration:200})),Ha(e,t)};pn(h,e=>{ka(u)&&e(g)});var m=Sr(h,2),b=Cr(m);Or(()=>Mn(b,"value",ka(v)));var y=Sr(b,2),w=Sr(Cr(y),2);Or(()=>Mn(w,"checked",ka(d))),Mn(w,"label","I agree to the terms and conditions"),w.__change=function(e){lr(d,e.detail.checked,!0),ne.info("Terms agreement changed:",ka(d))},it(y);var _=Sr(y,2);return Mn(_,"variant","primary"),Mn(_,"size","md"),Mn(_,"handler",async function(){if(lr(u,!0),await new Promise(e=>setTimeout(e,500)),lr(u,!1),ka(c)){const e=new CustomEvent(rc,{detail:{stepType:"CHECKOUT_CONFIRM",success:!0,amount:ka(v)},bubbles:!0,composed:!0});ka(c).dispatchEvent(e),ne.info("🚀 Dispatched form-success event from host element:",e)}else ne.warn("⚠️ Host element not available for event dispatch")}),Or(()=>Mn(_,"disabled",!ka(d))),En(_,1,"svelte-1l48sab"),it(m),it(f),ro(f,e=>lr(c,e),()=>ka(c)),La("text-input",b,function(e){lr(v,e.detail.rawValue,!0),ne.info("Amount changed:",ka(v))}),Ha(e,f),gt(p)}Ua(["change"]),customElements.define("alviere-checkout-confirm",po(Hv,{jwt:{},accountUuid:{},paymentMethodUuid:{},amount:{},debug:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var Gv=qa('<h1 class="alviere-multi-step-flow__flow-title svelte-qf1k5k"> </h1>'),Wv=qa('<p class="alviere-multi-step-flow__flow-description svelte-qf1k5k"> </p>'),Yv=qa('<div class="alviere-multi-step-flow__flow-header svelte-qf1k5k"><!> <!></div>'),Qv=qa('<div class="alviere-multi-step-flow__flow-progress"><alviere-timeline></alviere-timeline></div>',2),Jv=qa('<span class="alviere-multi-step-flow__step-navigation__status svelte-qf1k5k">✓</span>'),Xv=qa('<span class="alviere-multi-step-flow__step-navigation__status svelte-qf1k5k">✗</span>'),Zv=qa('<button><span class="alviere-multi-step-flow__step-navigation__number svelte-qf1k5k"></span> <span class="alviere-multi-step-flow__step-navigation__label svelte-qf1k5k"> </span> <!> <!></button>'),ed=qa('<div class="alviere-multi-step-flow__step-navigation svelte-qf1k5k"></div>'),td=qa('<div class="error-message svelte-qf1k5k"> </div>'),rd=qa('<div class="error-message svelte-qf1k5k">No step type specified</div>'),ad=qa('<div class="alviere-multi-step-flow__step-content svelte-qf1k5k"><div class="alviere-multi-step-flow__step-content__header svelte-qf1k5k"><h3 class="svelte-qf1k5k"> </h3></div> <div class="alviere-multi-step-flow__step-content__component"><!></div></div>'),nd=qa('<div class="alviere-multi-step-flow__flow-complete svelte-qf1k5k"><div class="alviere-multi-step-flow__flow-complete__header svelte-qf1k5k"><div class="alviere-multi-step-flow__flow-complete__header__icon svelte-qf1k5k"><!></div></div> <div class="alviere-multi-step-flow__flow-complete__content svelte-qf1k5k"><p>Payment in process.</p></div></div>'),od=qa('<p class="flow-error-code svelte-qf1k5k"> </p>'),id=qa('<p class="flow-error-description svelte-qf1k5k"> </p>'),ld=qa('<div class="alviere-multi-step-flow__flow-error svelte-qf1k5k"><div class="alviere-multi-step-flow__flow-error__header svelte-qf1k5k"><div class="alviere-multi-step-flow__flow-error__header__icon svelte-qf1k5k"><!></div></div> <div class="alviere-multi-step-flow__flow-error__content svelte-qf1k5k"><h3 class="svelte-qf1k5k">Unable to Continue</h3> <p class="flow-error-message svelte-qf1k5k"> </p> <!> <!></div></div>'),sd=qa('<div class="alviere-multi-step-flow__flow-navigation svelte-qf1k5k"><button class="alviere-multi-step-flow__flow-navigation__button alviere-multi-step-flow__flow-navigation__button--previous svelte-qf1k5k">← Previous</button> <button class="nav-button nav-button--next">Next →</button> <button class="nav-button nav-button--reset">Reset Flow</button></div>'),cd=qa('<div class="error-message svelte-qf1k5k"> </div>'),ud=qa('<div class="alviere-multi-step-flow svelte-qf1k5k"><!> <!> <!> <!> <!> <!> <!> <!></div>');const vd={hash:"svelte-qf1k5k",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-multi-step-flow.svelte-qf1k5k {margin:0 auto;font-family:\"Darker Grotesque\", sans-serif;line-height:1;--alviere-multi-step-end-size: 8rem;}.alviere-multi-step-flow__flow-complete.svelte-qf1k5k {padding:3rem 0;}.alviere-multi-step-flow__flow-complete__header.svelte-qf1k5k {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;}.alviere-multi-step-flow__flow-complete__header__icon.svelte-qf1k5k {background-color:#436b1d;border-radius:50%;padding:1rem;width:var(--alviere-multi-step-end-size);height:var(--alviere-multi-step-end-size);display:flex;align-items:center;justify-content:center;color:#ffffff;\n animation: svelte-qf1k5k-icon-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;}.alviere-multi-step-flow__flow-complete__header__icon.svelte-qf1k5k svg {width:calc(var(--alviere-multi-step-end-size) * 0.75);height:calc(var(--alviere-multi-step-end-size) * 0.75);\n animation: svelte-qf1k5k-svg-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;transform:scale(0);}.alviere-multi-step-flow__flow-complete__content.svelte-qf1k5k {text-align:center;font-size:1.5rem;font-weight:700;}.alviere-multi-step-flow__flow-error.svelte-qf1k5k {padding:3rem 0;}.alviere-multi-step-flow__flow-error__header.svelte-qf1k5k {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;}.alviere-multi-step-flow__flow-error__header__icon.svelte-qf1k5k {background-color:#b3311f;border-radius:50%;padding:1rem;width:var(--alviere-multi-step-end-size);height:var(--alviere-multi-step-end-size);display:flex;align-items:center;justify-content:center;color:#ffffff;\n animation: svelte-qf1k5k-icon-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;}.alviere-multi-step-flow__flow-error__header__icon.svelte-qf1k5k svg {width:calc(var(--alviere-multi-step-end-size) * 0.75);height:calc(var(--alviere-multi-step-end-size) * 0.75);\n animation: svelte-qf1k5k-svg-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;transform:scale(0);}.alviere-multi-step-flow__flow-error__content.svelte-qf1k5k {text-align:center;}.alviere-multi-step-flow__flow-error__content.svelte-qf1k5k h3:where(.svelte-qf1k5k) {font-size:1.5rem;font-weight:700;color:#b3311f;margin-bottom:1rem;}.alviere-multi-step-flow__flow-error__content.svelte-qf1k5k .flow-error-message:where(.svelte-qf1k5k) {font-size:1.25rem;color:#333;margin-bottom:0.5rem;}.alviere-multi-step-flow__flow-error__content.svelte-qf1k5k .flow-error-code:where(.svelte-qf1k5k) {font-size:1.125rem;color:#666;font-family:\"Monaco\", \"Menlo\", \"Ubuntu Mono\", monospace;margin-top:0.5rem;}.alviere-multi-step-flow__flow-error__content.svelte-qf1k5k .flow-error-description:where(.svelte-qf1k5k) {font-size:1.125rem;color:#666;margin-top:0.25rem;font-style:italic;}.alviere-multi-step-flow__flow-header.svelte-qf1k5k {text-align:center;margin-bottom:2rem;}.alviere-multi-step-flow__flow-title.svelte-qf1k5k {font-size:2rem;}.alviere-multi-step-flow__flow-description.svelte-qf1k5k {color:#666;font-size:1.1rem;}.alviere-multi-step-flow__step-navigation.svelte-qf1k5k {display:flex;gap:0.5rem;margin-bottom:2rem;flex-wrap:wrap;}.alviere-multi-step-flow__step-navigation__button.svelte-qf1k5k {display:flex;align-items:center;gap:0.5rem;padding:0.75rem 1rem;border:1px solid #ddd;background:white;border-radius:6px;cursor:pointer;transition:all 0.2s ease;font-size:0.9rem;}.alviere-multi-step-flow__step-navigation__button.svelte-qf1k5k:hover:not(:disabled) {background:#f8f9fa;border-color:#007bff;}.alviere-multi-step-flow__step-navigation__button.svelte-qf1k5k:disabled {opacity:0.5;cursor:not-allowed;}.alviere-multi-step-flow__step-navigation__button--active.svelte-qf1k5k {background:#227e9e;color:white;border-color:#227e9e;}.alviere-multi-step-flow__step-navigation__button--completed.svelte-qf1k5k {background:#436b1d;color:white;border-color:#436b1d;}.alviere-multi-step-flow__step-navigation__button--error.svelte-qf1k5k {background:#b3311f;color:white;border-color:#b3311f;}.alviere-multi-step-flow__step-navigation__number.svelte-qf1k5k {font-weight:bold;min-width:1.5rem;text-align:center;}.alviere-multi-step-flow__step-navigation__label.svelte-qf1k5k {flex:1;}.alviere-multi-step-flow__step-navigation__status.svelte-qf1k5k {font-size:1.2rem;}.alviere-multi-step-flow__step-content.svelte-qf1k5k {margin-bottom:2rem;}.alviere-multi-step-flow__step-content__header.svelte-qf1k5k {display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;}.alviere-multi-step-flow__step-content__header.svelte-qf1k5k h3:where(.svelte-qf1k5k) {font-size:1.25rem;}.alviere-multi-step-flow__flow-navigation.svelte-qf1k5k {display:flex;gap:1rem;justify-content:center;margin-top:2rem;}.alviere-multi-step-flow__flow-navigation__button.svelte-qf1k5k {padding:0.75rem 1.5rem;border:none;border-radius:4px;cursor:pointer;font-size:1rem;font-weight:500;transition:background 0.2s ease;}.alviere-multi-step-flow__flow-navigation__button.svelte-qf1k5k:disabled {opacity:0.5;cursor:not-allowed;}.alviere-multi-step-flow__flow-navigation__button-previous.svelte-qf1k5k {background:#6c757d;color:white;}.alviere-multi-step-flow__flow-navigation__button-previous.svelte-qf1k5k:hover:not(:disabled) {background:#545b62;}.alviere-multi-step-flow__flow-navigation__button--next.svelte-qf1k5k {background:#007bff;color:white;}.alviere-multi-step-flow__flow-navigation__button--next.svelte-qf1k5k:hover:not(:disabled) {background:#0056b3;}.flow-progress.svelte-qf1k5k {margin-bottom:2rem;}.progress-bar.svelte-qf1k5k {width:100%;height:8px;background:#e9ecef;border-radius:4px;overflow:hidden;margin-bottom:0.5rem;}.progress-fill.svelte-qf1k5k {height:100%;background:#007bff;transition:width 0.3s ease;}.progress-text.svelte-qf1k5k {text-align:center;font-size:0.9rem;color:#666;}.step-component.svelte-qf1k5k {background:white;}.flow-complete.svelte-qf1k5k {text-align:center;padding:2rem;background:#d4edda;border:1px solid #c3e6cb;border-radius:8px;margin-top:2rem;}.step-results.svelte-qf1k5k {margin-top:1rem;text-align:left;}.result-item.svelte-qf1k5k {margin-bottom:1rem;padding:1rem;background:white;border-radius:4px;border:1px solid #c3e6cb;}.error-message.svelte-qf1k5k {background:#f8d7da;color:#721c24;border:1px solid #f5c6cb;border-radius:4px;padding:1rem;margin-top:1rem;text-align:center;}\n\n@keyframes svelte-qf1k5k-icon-scale-up {\n from {\n transform: scale(0);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n}\n@keyframes svelte-qf1k5k-svg-scale-up {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@media (max-width: 768px) {.step-navigation.svelte-qf1k5k {flex-direction:column;}.step-button.svelte-qf1k5k {justify-content:flex-start;}.flow-navigation.svelte-qf1k5k {flex-direction:column;}.step-header.svelte-qf1k5k {flex-direction:column;gap:1rem;align-items:flex-start;}\n}"};function dd(e,t){ht(t,!0),mn(e,vd);const[r,a]=function(){const e={};return[e,function(){Lr(()=>{for(var t in e)e[t].unsubscribe();xe(e,lo,{enumerable:!1,value:!0})})}]}();var n,o;let i=co(t,"config",31,()=>dr({steps:[]})),l=co(t,"jwt",15,""),s=co(t,"businessUuid",15,""),c=co(t,"debug",31,()=>dr("false")),u=co(t,"publicCertificate",15,""),v=co(t,"publicCertificateId",15,""),d=co(t,"amount",15,""),p=co(t,"onflowcomplete",15),f=co(t,"onstepcomplete",15),h=co(t,"onsteperror",15),g=co(t,"onreset",15);c("true"===c()),c()&&ne.warn("MultiStepFlow initialized, debug:",c());let m=or(null),b=or(!1),y=or(null),w=or(null);const _=Pc(Oc),x=Pc(Hc),C=function(e){const{getJwt:t,getCore:r,getDebug:a,onJwtUpdate:n}=e;let o=or(dr(t())),i=or(null),l=or(dr(t()));return Ur(()=>{const e=t();e&&lr(o,e,!0)}),Ur(()=>{var e;if(ka(i)){const t=ka(o);lr(o,ka(i),!0),lr(i,null),a()&&(ne.info("✅ JWT downgrade successful - updated flow JWT"),ne.info("🔐 Old JWT (first 50 chars):",null==t?void 0:t.substring(0,50)),ne.info("🔐 New JWT (first 50 chars):",null==(e=ka(o))?void 0:e.substring(0,50)),ne.info("🔐 New JWT will be used in all subsequent steps")),null==n||n(ka(o))}}),{getJwtForStep:()=>ka(l),getEffectiveJwt:()=>ka(o),updateJwt:e=>{lr(o,e,!0)},downgradeJwt:async e=>{const t=r(),n=a();if(t)if(ka(o))try{if(n&&ne.info("🔐 Performing JWT downgrade using shared AlviereCore instance..."),!t.isFirstTimeUser())return void(n&&ne.info("🔄 User is not first-time - JWT already scoped"));n&&ne.info("🔄 First-time user detected - performing JWT downgrade for account:",e);const r=await t.generateScopedToken(e,!1);lr(i,r,!0),n&&ne.info("🔐 Pending JWT set (first 50 chars):",null==r?void 0:r.substring(0,50)),await new Promise(e=>setTimeout(e,0))}catch(y){ne.warn("⚠️ Failed to perform JWT downgrade:",y)}else n&&ne.warn("⚠️ Cannot perform JWT downgrade - missing JWT");else n&&ne.warn("⚠️ Cannot perform JWT downgrade - AlviereCore not initialized")},updateStepSnapshot:()=>{lr(l,Ia(()=>ka(o)),!0)}}}({getJwt:()=>l(),getCore:()=>so(Qu,"$flowCoreStore",r).core,getDebug:()=>c(),onJwtUpdate:e=>{Qu.updateJwt(e),l(e)}}),E=function(e){let t=or(dr({currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1})),r=or(dr({})),a=or(!1);return Ur(()=>{var n;const o=e();if((null==(n=null==o?void 0:o.steps)?void 0:n.length)>0&&!ka(a)){const e={};o.steps.forEach((t,r)=>{e[r]=0===r?"IN_PROGRESS":"INCOMPLETE"}),lr(r,e,!0),lr(a,!0),0===ka(t).currentStepIndex&&0===ka(t).completedSteps.length&&lr(t,{currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1},!0)}}),{get flowState(){return ka(t)},get stepStatuses(){return ka(r)},getCurrentStep:()=>{const r=e();return!(null==r?void 0:r.steps)||0===r.steps.length||ka(t).currentStepIndex>=r.steps.length?null:r.steps[ka(t).currentStepIndex]},getCurrentStepIndex:()=>ka(t).currentStepIndex,isComplete:()=>ka(t).isComplete,nextStep:()=>{var a;const n=e();ka(t).currentStepIndex<((null==(a=null==n?void 0:n.steps)?void 0:a.length)||0)-1&&(ka(t).currentStepIndex++,lr(r,{...ka(r),[ka(t).currentStepIndex]:"IN_PROGRESS"},!0))},previousStep:()=>{ka(t).currentStepIndex>0&&ka(t).currentStepIndex--},goToStep:a=>{var n;const o=e();a>=0&&a<((null==(n=null==o?void 0:o.steps)?void 0:n.length)||0)&&(ka(t).currentStepIndex=a,"INCOMPLETE"===ka(r)[a]&&lr(r,{...ka(r),[a]:"IN_PROGRESS"},!0))},canGoNext:()=>{var r;const a=e();return ka(t).currentStepIndex<((null==(r=null==a?void 0:a.steps)?void 0:r.length)||0)-1},canGoPrevious:()=>ka(t).currentStepIndex>0,markStepComplete:(a,n)=>{var o;const i=e();lr(r,{...ka(r),[a]:"COMPLETE"},!0),ka(t).stepResults[a]=n,ka(t).completedSteps.includes(a)||(ka(t).completedSteps=[...ka(t).completedSteps,a]),a===((null==(o=null==i?void 0:i.steps)?void 0:o.length)||0)-1&&(ka(t).isComplete=!0)},markStepError:e=>{lr(r,{...ka(r),[e]:"ERROR"},!0)},markStepInProgress:e=>{lr(r,{...ka(r),[e]:"IN_PROGRESS"},!0)},storeStepResult:(e,r)=>{ka(t).stepResults[e]=r},getStepResult:e=>ka(t).stepResults[e]||null,getAccumulatedResults:()=>{const e={};for(let r=0;r<=ka(t).currentStepIndex;r++)if(ka(t).stepResults[r]){const a=ka(t).stepResults[r];Object.keys(a).forEach(t=>{["stepType","stepIndex","success","data"].includes(t)||(e[t]=a[t])})}return e},reset:()=>{lr(t,{currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1},!0),lr(a,!1),lr(r,{},!0)}}}(()=>i()),S=function(e){const{getFlowElement:t,getConfig:r,flowState:a,onflowcomplete:n,onstepcomplete:o,onsteperror:i,onreset:l}=e,s=dn();function c(e,r){const a=t();return!!a&&Ns(a).dispatch(e,r)}function u(){var e;const t=r();return{currentStep:a.currentStepIndex,totalSteps:(null==(e=null==t?void 0:t.steps)?void 0:e.length)||0,stepResults:{...a.stepResults},isComplete:a.isComplete}}function v(e,t,a){var n,o;const i=r();return{stepIndex:e,stepType:(null==(o=null==(n=null==i?void 0:i.steps)?void 0:n[e])?void 0:o.type)||"UNKNOWN",result:t,error:a}}return{dispatchStepComplete:(e,t)=>{var n,i;const l=v(e,t);null==o||o(l),c(ic,l);const u=r();s("stepSuccess",{stepIndex:e,stepType:(null==(i=null==(n=null==u?void 0:u.steps)?void 0:n[e])?void 0:i.type)||"UNKNOWN",result:t,flowState:{...a}})},dispatchStepError:(e,t)=>{var n,o;const l=v(e,void 0,t);null==i||i(l),c(lc,l);const u=r();s("stepError",{stepIndex:e,stepType:(null==(o=null==(n=null==u?void 0:u.steps)?void 0:n[e])?void 0:o.type)||"UNKNOWN",error:t,flowState:{...a}})},dispatchFlowComplete:e=>{const t={...u(),result:e};null==n||n(t),c(sc,t),s("complete",{stepResults:a.stepResults,flowState:{...a},result:e})},dispatchFlowReset:()=>{const e=u();null==l||l(),c(cc,e),s("reset",{flowState:{...a}})}}}({getFlowElement:()=>ka(m),getConfig:()=>i(),flowState:E.flowState,onflowcomplete:p(),onstepcomplete:f(),onsteperror:h(),onreset:g()});let k=Qt(()=>E.getCurrentStep());Ur(()=>{E.getCurrentStepIndex(),C.updateStepSnapshot()});let A=Qt(()=>(null===ka(k)||void 0===ka(k)?void 0:ka(k).type)?function(e,t){const{jwt:r,businessUuid:a,publicCertificate:n,publicCertificateId:o,debug:i,amount:l,stepConfig:s,previousStepResult:c}=t,u={jwt:r,businessUuid:a,publicCertificate:n,publicCertificateId:o,isInFlow:!0,debug:i,amount:l,config:s};switch(e){case"ADD_BANK_ACCOUNT":case"ADD_PAYMENT_INSTRUMENT":{const e=(null==c?void 0:c.account_uuid)||"";return i&&(ne.info("previousStepResult",c),ne.info("accountUuidToUse",e)),{...u,accountUuid:e,requireRoutingAndAccountConfirmation:!0}}default:return u}}(ka(k).type,{jwt:C.getJwtForStep(),businessUuid:s(),publicCertificate:u(),publicCertificateId:v(),debug:c(),amount:d(),stepConfig:(null===(o=null===(n=i().steps)||void 0===n?void 0:n[E.getCurrentStepIndex()])||void 0===o?void 0:o.config)||{},previousStepResult:E.getStepResult(E.getCurrentStepIndex()-1)}):{}),T=Qt(()=>{return e=i().steps||[],t=E.stepStatuses,r=E.getCurrentStepIndex(),e&&Array.isArray(e)?e.map((e,a)=>{let n="pending";return"COMPLETE"===t[a]?n="completed":"ERROR"===t[a]?n="error":a===r&&(n="active"),{label:e.label,description:e.description||"",status:n}}):[];var e,t,r}),I=Qt(()=>E.canGoNext()),B=Qt(()=>E.canGoPrevious());async function N(e){const t=E.getCurrentStepIndex(),r=e.detail;c()&&ne.info(`✅ Step ${t} completed:`,r),await async function(e,t){var r,a;const n=null===(a=null===(r=null===i()||void 0===i()?void 0:i().steps)||void 0===r?void 0:r[e])||void 0===a?void 0:a.type;if("CREATE_CONSUMER_ACCOUNT"!==n&&"CREATE_BUSINESS_ACCOUNT"!==n&&"CREATE_ACCOUNT"!==n)return;if(!t.account_uuid||t.skipped)return void(c()&&ne.info("🔄 Skipping JWT downgrade - account creation was skipped"));await C.downgradeJwt(t.account_uuid)}(t,r),E.markStepComplete(t,r);const a=E.getAccumulatedResults();E.canGoNext()?setTimeout(()=>{E.nextStep()},1e3):(E.flowState.isComplete=!0,S.dispatchFlowComplete(a)),S.dispatchStepComplete(t,a)}function z(e){const t=E.getCurrentStepIndex(),r=e.detail.error;if(c()&&ne.error(`❌ Step ${t} failed:`,r),r instanceof Pl&&(a=r.errorCode,ss.includes(a)))return c()&&ne.error(`🚨 Critical error - halting flow: ${r.errorCode}`),lr(w,{message:"An error occurred. Please try again.",errorCode:r.errorCode,description:r.errorDescription},!0),void E.markStepError(t);var a;E.markStepError(t),S.dispatchStepError(t,r)}function R(){E.nextStep()}function D(){E.previousStep()}function L(){E.reset(),lr(w,null),lr(y,null),S.dispatchFlowReset()}Ur(()=>{if("undefined"!=typeof window){const e=new URLSearchParams(window.location.search),t=e.get("enhancedJwt")||e.get("jwt");t&&(l(t),C.updateJwt(t),c()&&ne.info("🔐 Using enhanced JWT from URL"))}}),Ur(()=>{if("undefined"!=typeof window&&window.customElements&&ka(m)&&!ka(b)){const t=ka(m).getRootNode(),r=null==t?void 0:t.host;if(r){const t=r.getAttributeNames();if(t.includes("config")){const t=r.getAttribute("config");if(t)try{const e=JSON.parse(t);void 0!==e.amount&&d(e.amount),i(Object.assign(Object.assign(Object.assign({},i()),e),{steps:e.steps||i().steps||[]})),c()&&ne.info("✅ Config loaded from attribute:",e)}catch(e){c()&&ne.error("❌ Failed to parse config:",e)}}["jwt","business-uuid","public-certificate","public-certificate-id","amount"].forEach(e=>{if(t.includes(e)){const t=r.getAttribute(e);if(t)switch(e){case"jwt":l(t),C.updateJwt(t);break;case"business-uuid":s(t);break;case"public-certificate":u(t);break;case"public-certificate-id":v(t);break;case"amount":d(t)}}})}lr(b,!0)}}),Ur(()=>{(null===ka(k)||void 0===ka(k)?void 0:ka(k).type)&&setTimeout(()=>{!function(e,t,r,a=!1){if(!e)return;const n=`alviere-${e.toLowerCase().replace(/_/g,"-")}`;a&&ne.info("Setting up event listeners for:",n);let o=document.querySelectorAll(n);if(0===o.length&&t){const e=t.getRootNode();o=null==e?void 0:e.querySelectorAll(n),a&&0===o.length&&ne.info("No step elements found in shadow root")}if(o.length>0){const e=o[o.length-1];e.removeEventListener("success",r.onSuccess),e.removeEventListener("form-success",r.onSuccess),e.removeEventListener("error",r.onError),e.removeEventListener("form-error",r.onError),e.addEventListener("success",r.onSuccess),e.addEventListener("form-success",r.onSuccess),e.addEventListener("error",r.onError),e.addEventListener("form-error",r.onError),a&&ne.info("✅ Event listeners set up successfully for:",e)}else a&&ne.warn("⚠️ Step element not found for event listener setup:",n)}(ka(k).type,ka(m),{onSuccess:N,onError:z},c())},100)}),Ur(()=>{var e;c()&&ne.info("🔍 Config changed:",{hasSteps:!!(null===i()||void 0===i()?void 0:i().steps),stepCount:(null===(e=null===i()||void 0===i()?void 0:i().steps)||void 0===e?void 0:e.length)||0,steps:null===i()||void 0===i()?void 0:i().steps})}),Ur(()=>{c()&&ne.info("🔍 Current step:",{currentStep:ka(k),currentStepIndex:E.getCurrentStepIndex(),hasType:!!(null===ka(k)||void 0===ka(k)?void 0:ka(k).type)})}),vn(()=>{var e;return l()&&s()&&(c()&&ne.info("🔐 Initializing shared AlviereCore in store (mount)..."),Ju({jwt:l(),business_uuid:s(),publicCertificate:u(),publicCertificateId:v(),debug:c()})),(null===(e=null===i()||void 0===i()?void 0:i().steps)||void 0===e?void 0:e.length)>0?(c()&&ne.info("🚀 MultiStepFlow mounted with",i().steps.length,"steps"),E.markStepInProgress(0)):c()&&ne.warn("⚠️ MultiStepFlow mounted with NO steps in config!"),()=>{c()&&ne.info("🧹 Cleaning up flow - resetting AlviereCore store"),Xu()}});var U={get config(){return i()},set config(e={steps:[]}){i(e),zt()},get jwt(){return l()},set jwt(e=""){l(e),zt()},get businessUuid(){return s()},set businessUuid(e=""){s(e),zt()},get debug(){return c()},set debug(e="false"){c(e),zt()},get publicCertificate(){return u()},set publicCertificate(e=""){u(e),zt()},get publicCertificateId(){return v()},set publicCertificateId(e=""){v(e),zt()},get amount(){return d()},set amount(e=""){d(e),zt()},get onflowcomplete(){return p()},set onflowcomplete(e){p(e),zt()},get onstepcomplete(){return f()},set onstepcomplete(e){f(e),zt()},get onsteperror(){return h()},set onsteperror(e){h(e),zt()},get onreset(){return g()},set onreset(e){g(e),zt()}},P=ud(),V=Cr(P),M=e=>{var t=Yv(),r=Cr(t),a=e=>{var t=Gv(),r=Cr(t,!0);it(t),Or(()=>an(r,i().title)),Ha(e,t)};pn(r,e=>{i().title&&e(a)});var n=Sr(r,2),o=e=>{var t=Wv(),r=Cr(t,!0);it(t),Or(()=>an(r,i().description)),Ha(e,t)};pn(n,e=>{i().description&&e(o)}),it(t),Ha(e,t)};pn(V,e=>{(i().title||i().description)&&e(M)});var O=Sr(V,2),q=e=>{var t=Qv(),r=Cr(t);Or(()=>Mn(r,"steps",ka(T))),Mn(r,"size","sm"),Mn(r,"showLabels",!0),Mn(r,"showDescriptions",!1),it(t),Ha(e,t)};pn(O,e=>{var t,r;!1!==(null==(t=i())?void 0:t.showProgress)&&(null==(r=i())?void 0:r.steps)&&e(q)});var j=Sr(O,2),F=e=>{var t=ed();jt(t,21,()=>i().steps,qt,(e,t,r)=>{var a=Zv();let n;a.__click=()=>function(e){E.goToStep(e)}(r);var o=Cr(a);o.textContent=r+1;var l=Sr(o,2),s=Cr(l,!0);it(l);var c=Sr(l,2),u=e=>{Ha(e,Jv())};pn(c,e=>{"COMPLETE"===E.stepStatuses[r]&&e(u)});var v=Sr(c,2),d=e=>{Ha(e,Xv())};pn(v,e=>{"ERROR"===E.stepStatuses[r]&&e(d)}),it(a),Or((e,r)=>{n=En(a,1,"alviere-multi-step-flow__step-navigation__button svelte-qf1k5k",null,n,e),a.disabled=r,an(s,ka(t).label)},[()=>({"alviere-multi-step-flow__step-navigation__button--active":r===E.getCurrentStepIndex(),"alviere-multi-step-flow__step-navigation__button--completed":"COMPLETE"===E.stepStatuses[r],"alviere-multi-step-flow__step-navigation__button--error":"ERROR"===E.stepStatuses[r]}),()=>r>E.getCurrentStepIndex()&&!i().allowSkip]),Ha(e,a)}),it(t),Ha(e,t)};pn(j,e=>{!1===i().showNavigation||ka(w)||e(F)});var K=Sr(j,2),$=e=>{var t=ad(),r=Cr(t),a=Cr(r),n=Cr(a,!0);it(a),it(r);var o=Sr(r,2),i=Cr(o),l=e=>{const t=Qt(()=>({CREATE_CONSUMER_ACCOUNT:"alviere-create-consumer-account",CREATE_BUSINESS_ACCOUNT:"alviere-create-business-account",CREATE_ACCOUNT:"alviere-create-account",ADD_BANK_ACCOUNT:"alviere-add-bank-account",ADD_PAYMENT_INSTRUMENT:"alviere-add-payment-instrument",CHECKOUT_CONFIRM:"alviere-checkout-confirm"}[ka(k).type]||null));var r=$a(),a=Er(r),n=e=>{var r=$a();gn(Er(r),()=>ka(t),0,(e,t)=>{On(e,()=>({...ka(A)}),void 0,void 0,void 0,"svelte-qf1k5k")}),Ha(e,r)},o=e=>{var t=td(),r=Cr(t);it(t),Or(()=>an(r,`Unknown step type: ${ka(k).type??""}`)),Ha(e,t)};pn(a,e=>{ka(t)?e(n):e(o,!1)}),Ha(e,r)},s=e=>{Ha(e,rd())};pn(i,e=>{var t;(null==(t=ka(k))?void 0:t.type)?e(l):e(s,!1)}),it(o),it(t),Or(()=>an(n,ka(k).label)),Qn(1,t,()=>Yu,()=>({duration:300})),Qn(2,t,()=>Yu,()=>({duration:200})),Ha(e,t)};pn(K,e=>{!ka(k)||E.isComplete()||ka(w)||e($)});var H=Sr(K,2),G=e=>{var t=nd(),r=Cr(t),a=Cr(r);fn(Cr(a),()=>_.outerHTML),it(a),it(r),lt(2),it(t),Qn(1,t,()=>Yu,()=>({duration:300,delay:300})),Qn(2,t,()=>Yu,()=>({duration:200})),Ha(e,t)};pn(H,e=>{E.isComplete()&&e(G)});var W=Sr(H,2),Y=e=>{var t=ld(),r=Cr(t),a=Cr(r);fn(Cr(a),()=>x.outerHTML),it(a),it(r);var n=Sr(r,2),o=Sr(Cr(n),2),i=Cr(o,!0);it(o);var l=Sr(o,2),s=e=>{var t=od(),r=Cr(t);it(t),Or(()=>an(r,`Error Code: ${ka(w).errorCode??""}`)),Ha(e,t)};pn(l,e=>{c()&&ka(w).errorCode&&e(s)});var u=Sr(l,2),v=e=>{var t=id(),r=Cr(t,!0);it(t),Or(()=>an(r,ka(w).description)),Ha(e,t)};pn(u,e=>{c()&&ka(w).description&&e(v)}),it(n),it(t),Or(()=>an(i,ka(w).message)),Qn(1,t,()=>Yu,()=>({duration:300,delay:100})),Qn(2,t,()=>Yu,()=>({duration:200})),Ha(e,t)};pn(W,e=>{ka(w)&&e(Y)});var Q=Sr(W,2),J=e=>{var t=sd(),r=Cr(t);r.__click=D;var a=Sr(r,2);a.__click=R,Sr(a,2).__click=L,it(t),Or(e=>{r.disabled=!ka(B),a.disabled=e},[()=>!ka(I)||"COMPLETE"!==E.stepStatuses[E.getCurrentStepIndex()]]),Ha(e,t)};pn(Q,e=>{!1===i().showNavigation||ka(w)||E.isComplete()||e(J)});var X=Sr(Q,2),Z=e=>{var t=cd(),r=Cr(t,!0);it(t),Or(()=>an(r,ka(y))),Ha(e,t)};pn(X,e=>{ka(y)&&e(Z)}),it(P),ro(P,e=>lr(m,e),()=>ka(m)),Ha(e,P);var ee=gt(U);return a(),ee}Ua(["click"]),customElements.define("alviere-multi-step-flow",po(dd,{config:{},jwt:{},businessUuid:{},debug:{},publicCertificate:{},publicCertificateId:{},amount:{},onflowcomplete:{},onstepcomplete:{},onsteperror:{},onreset:{}},[],[],!0));var pd=Fa('<svg class="alviere-spinner__circle svelte-545qvv" viewBox="0 0 50 50" part="circle"><circle class="alviere-spinner__circle-path svelte-545qvv" cx="25" cy="25" r="20" fill="none" stroke-width="4" part="circle-path"></circle></svg>'),fd=qa('<div class="alviere-spinner__dots svelte-545qvv" part="dots"><div class="alviere-spinner__dot svelte-545qvv" part="dot"></div> <div class="alviere-spinner__dot svelte-545qvv" part="dot"></div> <div class="alviere-spinner__dot svelte-545qvv" part="dot"></div></div>'),hd=qa('<div role="status" aria-live="polite" part="root"><!> <div class="alviere-spinner__message svelte-545qvv"><!></div></div>');const gd={hash:"svelte-545qvv",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-spinner.svelte-545qvv {display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;--spinner-color: var(--alv-spinner-color, var(--alv-color-text-primary));}.alviere-spinner--sm.svelte-545qvv {--spinner-size: var(--alv-spinner-size-sm, 1rem);--spinner-stroke-width: var(--alv-spinner-stroke-width, 2px);}.alviere-spinner--md.svelte-545qvv {--spinner-size: var(--alv-spinner-size-md, 1.5rem);--spinner-stroke-width: var(--alv-spinner-stroke-width, 2px);}.alviere-spinner--lg.svelte-545qvv {--spinner-size: var(--alv-spinner-size-lg, 4rem);--spinner-stroke-width: 5px;}.alviere-spinner__circle.svelte-545qvv {width:var(--spinner-size);height:var(--spinner-size);\n animation: svelte-545qvv-alviere-spinner-rotate 2s linear infinite;}.alviere-spinner__circle-path.svelte-545qvv {stroke:var(--spinner-color);stroke-linecap:square;transform-origin:center;\n animation: svelte-545qvv-alviere-spinner-dash 1.5s ease-in-out infinite;}.alviere-spinner--dots.svelte-545qvv .alviere-spinner__dots:where(.svelte-545qvv) {display:flex;align-items:center;justify-content:center;gap:calc(var(--spinner-size) * 0.15);}.alviere-spinner--dots.svelte-545qvv .alviere-spinner__dot:where(.svelte-545qvv) {width:calc(var(--spinner-size) * 0.25);height:calc(var(--spinner-size) * 0.25);background-color:var(--spinner-color);border-radius:50%;\n animation: svelte-545qvv-alviere-spinner-dot-pulse 1.4s ease-in-out infinite both;}.alviere-spinner--dots.svelte-545qvv .alviere-spinner__dot:where(.svelte-545qvv):nth-child(1) {animation-delay:-0.32s;}.alviere-spinner--dots.svelte-545qvv .alviere-spinner__dot:where(.svelte-545qvv):nth-child(2) {animation-delay:-0.16s;}.alviere-spinner--dots.svelte-545qvv .alviere-spinner__dot:where(.svelte-545qvv):nth-child(3) {animation-delay:0s;}.alviere-spinner__message.svelte-545qvv {text-align:center;font-size:var(--alv-font-size-base, 1.25rem);color:var(--alv-color-text-secondary, #555);font-weight:500;margin:0;margin-top:1rem;}.alviere-spinner__message.svelte-545qvv:empty {display:none;}\n\n@keyframes svelte-545qvv-alviere-spinner-rotate {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes svelte-545qvv-alviere-spinner-dash {\n 0% {\n stroke-dasharray: 1, 125.6;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 94.2, 125.6;\n stroke-dashoffset: -31.4;\n }\n 100% {\n stroke-dasharray: 1, 125.6;\n stroke-dashoffset: -125.6;\n }\n}\n@keyframes svelte-545qvv-alviere-spinner-dot-pulse {\n 0%, 80%, 100% {\n transform: scale(0.8);\n opacity: 0.5;\n }\n 40% {\n transform: scale(1);\n opacity: 1;\n }\n}.alviere-spinner.svelte-545qvv:focus-visible {outline:2px solid var(--spinner-color);outline-offset:2px;border-radius:4px;}\n\n@media (prefers-reduced-motion: reduce) {.alviere-spinner__circle.svelte-545qvv {\n animation: svelte-545qvv-alviere-spinner-rotate 3s linear infinite;}.alviere-spinner__circle-path.svelte-545qvv {\n animation: none;stroke-dasharray:62.8, 125.6;stroke-dashoffset:0;}\n}"};function md(e,t){ht(t,!0),mn(e,gd);let r=co(t,"size",15,"md"),a=co(t,"color",15,""),n=co(t,"primaryColor",15,""),o=co(t,"ariaLabel",15,"Loading..."),i=co(t,"class",15,""),l=co(t,"variant",15,"circular"),s=Qt(()=>`alviere-spinner alviere-spinner--${r()} alviere-spinner--${l()} ${i()}`.trim()),c=Qt(()=>a()||n());var u={get size(){return r()},set size(e="md"){r(e),zt()},get color(){return a()},set color(e=""){a(e),zt()},get primaryColor(){return n()},set primaryColor(e=""){n(e),zt()},get ariaLabel(){return o()},set ariaLabel(e="Loading..."){o(e),zt()},get class(){return i()},set class(e=""){i(e),zt()},get variant(){return l()},set variant(e="circular"){l(e),zt()}},v=hd();let d;var p=Cr(v),f=e=>{Ha(e,pd())},h=e=>{var t=$a(),r=Er(t),a=e=>{Ha(e,fd())};pn(r,e=>{"dots"===l()&&e(a)},!0),Ha(e,t)};pn(p,e=>{"circular"===l()?e(f):e(h,!1)});var g=Sr(p,2);return hn(Cr(g),t,"message",{}),it(g),it(v),Or(()=>{En(v,1,wn(ka(s)),"svelte-545qvv"),Vn(v,"aria-label",o()),d=kn(v,"",d,{"--spinner-color":ka(c)})}),Ha(e,v),gt(u)}customElements.define("alviere-spinner",po(md,{size:{},color:{},primaryColor:{},ariaLabel:{},class:{},variant:{}},["message"],[],!0));var bd=qa('<div class="alviere-timeline__connector svelte-1db5upf" part="connector"></div>'),yd=qa('<span class="alviere-timeline__step-description svelte-1db5upf" part="step-description"> </span>'),wd=qa('<div class="alviere-timeline__step-label svelte-1db5upf" part="step-label"><span class="alviere-timeline__step-text svelte-1db5upf" part="step-text"> </span> <!></div>'),_d=qa('<div class="alviere-timeline__step-wrapper svelte-1db5upf" part="step-wrapper"><!> <div part="step"><div class="alviere-timeline__step-indicator svelte-1db5upf" part="step-indicator"><span class="alviere-timeline__step-icon svelte-1db5upf" part="step-icon"><!></span> <div class="alviere-timeline__step-ripple svelte-1db5upf" part="step-ripple"></div></div> <!></div></div>'),xd=qa('<div role="progressbar" aria-label="Progress timeline" part="root"><div class="alviere-timeline__container svelte-1db5upf" part="container"></div></div>');const Cd={hash:"svelte-1db5upf",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-timeline.svelte-1db5upf {display:flex;align-items:center;justify-content:center;width:100%;--timeline-color: var(--alv-timeline-color, var(--alv-color-gray-600));--timeline-completed-color: var(--alv-timeline-completed-color, var(--alv-color-success));--timeline-error-color: var(--alv-timeline-error-color, var(--alv-color-error));--timeline-pending-color: var(--alv-timeline-pending-color, var(--alv-color-gray-400));}.alviere-timeline--sm.svelte-1db5upf {--timeline-step-size: var(--alv-timeline-step-size-sm, 1.25rem);--timeline-connector-width: 2px;--timeline-font-size: var(--alv-font-size-sm);--timeline-connector-padding: 0.625rem;}.alviere-timeline--md.svelte-1db5upf {--timeline-step-size: var(--alv-timeline-step-size-md, 2rem);--timeline-connector-width: var(--alv-timeline-connector-width, 3px);--timeline-font-size: var(--alv-timeline-font-size, var(--alv-font-size-base));}.alviere-timeline--lg.svelte-1db5upf {--timeline-step-size: var(--alv-timeline-step-size-lg, 2.5rem);--timeline-connector-width: 4px;--timeline-font-size: var(--alv-font-size-lg);}.alviere-timeline--horizontal.svelte-1db5upf .alviere-timeline__container:where(.svelte-1db5upf) {flex-direction:row;align-items:center;justify-content:space-between;width:100%;}.alviere-timeline--horizontal.svelte-1db5upf .alviere-timeline__step-wrapper:where(.svelte-1db5upf) {position:relative;}.alviere-timeline--horizontal.svelte-1db5upf .alviere-timeline__step-wrapper:where(.svelte-1db5upf):nth-child(1) .alviere-timeline__step:where(.svelte-1db5upf) {align-items:flex-start;}.alviere-timeline--horizontal.svelte-1db5upf .alviere-timeline__step-wrapper:where(.svelte-1db5upf):nth-child(1) .alviere-timeline__connector:where(.svelte-1db5upf) {width:calc(100% - var(--timeline-connector-padding) * 2 + 50% - var(--timeline-connector-padding) - var(--timeline-step-size));left:calc(var(--timeline-step-size) + var(--timeline-connector-padding));}.alviere-timeline--horizontal.svelte-1db5upf .alviere-timeline__step-wrapper:where(.svelte-1db5upf):last-child .alviere-timeline__step:where(.svelte-1db5upf) {align-items:flex-end;}.alviere-timeline--horizontal.svelte-1db5upf .alviere-timeline__step-wrapper:where(.svelte-1db5upf):last-child .alviere-timeline__connector:where(.svelte-1db5upf) {width:calc(100% - var(--timeline-connector-padding) * 2);}.alviere-timeline--horizontal.svelte-1db5upf .alviere-timeline__connector:where(.svelte-1db5upf) {height:var(--timeline-connector-width);align-self:center;position:relative;top:calc(var(--timeline-step-size) * 0.5 + var(--timeline-connector-width) * 0.5);left:calc(50% + var(--timeline-step-size) * 0.5 + var(--timeline-connector-padding));min-width:2rem;width:calc(100% - var(--timeline-connector-padding) * 2 + 50% - var(--timeline-connector-padding) - var(--timeline-step-size));}.alviere-timeline--vertical.svelte-1db5upf .alviere-timeline__container:where(.svelte-1db5upf) {flex-direction:column;align-items:flex-start;}.alviere-timeline--vertical.svelte-1db5upf .alviere-timeline__step-wrapper:where(.svelte-1db5upf) {flex-direction:column;align-items:flex-start;}.alviere-timeline--vertical.svelte-1db5upf .alviere-timeline__connector:where(.svelte-1db5upf) {width:var(--timeline-connector-width);height:2rem;}.alviere-timeline__container.svelte-1db5upf {display:flex;align-items:center;width:100%;gap:0;}.alviere-timeline__step-wrapper.svelte-1db5upf {position:relative;flex:1;}.alviere-timeline__step.svelte-1db5upf {display:flex;flex-direction:column;align-items:center;gap:0.5rem;position:relative;}.alviere-timeline__step-indicator.svelte-1db5upf {position:relative;width:var(--timeline-step-size);height:var(--timeline-step-size);border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--alv-color-surface, #ffffff);border:1px solid var(--timeline-color);transition:all var(--alv-transition-normal, 0.3s ease-in-out);}.alviere-timeline__step-icon.svelte-1db5upf {font-size:calc(var(--timeline-step-size) * 0.5);font-weight:var(--alv-font-weight-bold, 700);color:var(--alv-color-on-primary, #ffffff);transition:all var(--alv-transition-normal, 0.3s ease-in-out);display:flex;flex-direction:column;align-items:center;justify-content:center;}.alviere-timeline__step-icon.svelte-1db5upf svg {width:calc(var(--timeline-step-size) * 0.75);height:calc(var(--timeline-step-size) * 0.75);}.alviere-timeline__step--pending.svelte-1db5upf .alviere-timeline__step-indicator:where(.svelte-1db5upf) {border-color:var(--timeline-pending-color);background:var(--alv-color-surface, #ffffff);}.alviere-timeline__step--pending.svelte-1db5upf .alviere-timeline__step-icon:where(.svelte-1db5upf) {color:var(--timeline-pending-color);}.alviere-timeline__step--active.svelte-1db5upf .alviere-timeline__step-indicator:where(.svelte-1db5upf) {border-color:var(--timeline-color);background:var(--timeline-color);}.alviere-timeline__step--active.svelte-1db5upf .alviere-timeline__step-icon:where(.svelte-1db5upf) {color:var(--alv-color-on-primary, #ffffff);}.alviere-timeline__step--active.svelte-1db5upf .alviere-timeline__step-text:where(.svelte-1db5upf) {font-weight:var(--alv-font-weight-bold, 700);}.alviere-timeline__step--completed.svelte-1db5upf .alviere-timeline__step-indicator:where(.svelte-1db5upf) {border-color:var(--timeline-completed-color);background:var(--timeline-completed-color);}.alviere-timeline__step--completed.svelte-1db5upf .alviere-timeline__step-icon:where(.svelte-1db5upf) {color:var(--alv-color-on-success, #ffffff);}.alviere-timeline__step--error.svelte-1db5upf .alviere-timeline__step-indicator:where(.svelte-1db5upf) {border-color:var(--timeline-error-color);background:var(--timeline-error-color);}.alviere-timeline__step--error.svelte-1db5upf .alviere-timeline__step-icon:where(.svelte-1db5upf) {color:var(--alv-color-on-error, #ffffff);}.alviere-timeline__step-label.svelte-1db5upf {display:none;flex-direction:column;align-items:center;text-align:center;gap:0.25rem;}.alviere-timeline__step-text.svelte-1db5upf {font-size:var(--timeline-font-size);font-weight:var(--alv-font-weight-medium, 500);color:var(--alv-color-text-primary);white-space:nowrap;}.alviere-timeline__step-description.svelte-1db5upf {font-size:calc(var(--timeline-font-size) * 0.875);color:var(--alv-color-text-secondary);white-space:nowrap;}.alviere-timeline__connector.svelte-1db5upf {background:var(--timeline-pending-color);transition:background-color var(--alv-transition-normal, 0.3s ease-in-out);}.alviere-timeline__step-ripple.svelte-1db5upf {position:absolute;top:50%;left:50%;width:var(--timeline-step-size);height:var(--timeline-step-size);border-radius:50%;background:rgba(var(--alv-color-success-rgb, 67, 107, 29), 0.3);transform:translate(-50%, -50%) scale(0);pointer-events:none;opacity:0;transition:all 0.6s ease-out;}.alviere-timeline__step-ripple--active.svelte-1db5upf {transform:translate(-50%, -50%) scale(2);opacity:1;}\n@media (max-width: 768px) {.alviere-timeline__step-text.svelte-1db5upf {font-size:var(--alv-font-size-sm);}.alviere-timeline__step-description.svelte-1db5upf {font-size:var(--alv-font-size-xs);}\n}.alviere-timeline__step-indicator.svelte-1db5upf:focus-visible {outline:2px solid var(--timeline-color);outline-offset:2px;}\n@media (prefers-reduced-motion: reduce) {.alviere-timeline__step-ripple.svelte-1db5upf {transition:none;}.alviere-timeline__step-indicator.svelte-1db5upf {transition:none;}.alviere-timeline__connector.svelte-1db5upf {transition:none;}\n}"};function Ed(e,t){ht(t,!0),mn(e,Cd);let r=co(t,"steps",31,()=>dr([])),a=co(t,"size",15,"md"),n=co(t,"showLabels",15,!0),o=co(t,"showDescriptions",15,!1),i=co(t,"orientation",15,"horizontal"),l=co(t,"class",15,""),s=or(dr(new Set)),c=Qt(()=>`alviere-timeline alviere-timeline--${a()} alviere-timeline--${i()} ${l()}`.trim());Ur(()=>{r().forEach(e=>{"completed"!==e.status||ka(s).has(e.id)||(ka(s).add(e.id),function(e){const t=document.querySelector(`[data-step-id="${e}"]`);t&&(t.classList.add("alviere-timeline__step-ripple--active"),setTimeout(()=>{t.classList.remove("alviere-timeline__step-ripple--active")},1e3))}(e.id))})});const u=Pc(Oc),v=Pc(Hc);var d={get steps(){return r()},set steps(e=[]){r(e),zt()},get size(){return a()},set size(e="md"){a(e),zt()},get showLabels(){return n()},set showLabels(e=!0){n(e),zt()},get showDescriptions(){return o()},set showDescriptions(e=!1){o(e),zt()},get orientation(){return i()},set orientation(e="horizontal"){i(e),zt()},get class(){return l()},set class(e=""){l(e),zt()}},p=xd(),f=Cr(p);return jt(f,21,r,qt,(e,t,a)=>{var i=_d(),l=Cr(i),s=e=>{Ha(e,bd())};pn(l,e=>{a<r().length-1&&e(s)});var c=Sr(l,2),d=Cr(c),p=Cr(d);fn(Cr(p),()=>{var e;return null==(e=function(e){switch(e){case"completed":return u;case"error":return v;default:return null}}(ka(t).status))?void 0:e.outerHTML}),it(p);var f=Sr(p,2);it(d);var h=Sr(d,2),g=e=>{var r=wd(),a=Cr(r),n=Cr(a,!0);it(a);var i=Sr(a,2),l=e=>{var r=yd(),a=Cr(r,!0);it(r),Or(()=>an(a,ka(t).description)),Ha(e,r)};pn(i,e=>{o()&&ka(t).description&&e(l)}),it(r),Or(()=>an(n,ka(t).label)),Ha(e,r)};pn(h,e=>{n()&&e(g)}),it(c),it(i),Or(e=>{En(c,1,e,"svelte-1db5upf"),Vn(f,"data-step-id",ka(t).id)},[()=>wn(`alviere-timeline__step alviere-timeline__step--${ka(t).status}`)]),Ha(e,i)}),it(f),it(p),Or(()=>En(p,1,wn(ka(c)),"svelte-1db5upf")),Ha(e,p),gt(d)}customElements.define("alviere-timeline",po(Ed,{steps:{},size:{},showLabels:{},showDescriptions:{},orientation:{},class:{}},[],[],!0));var Sd=qa('<span class="alviere-button__icon svelte-krj1wt" part="icon"><!></span>'),kd=qa('<button part="root"><!> <span class="alviere-button__label svelte-krj1wt" part="label"><!></span></button>');const Ad={hash:"svelte-krj1wt",code:'.alviere-button.svelte-krj1wt {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;}.alviere-button--sm.svelte-krj1wt {padding:0 0.5rem;height:2.4375rem;}.alviere-button--md.svelte-krj1wt {padding:0 1rem;height:3.25rem;}.alviere-button--lg.svelte-krj1wt {padding:0 1.5rem;height:4.0625rem;}.alviere-button--primary.svelte-krj1wt {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#27272a;color:#ffffff;}.alviere-button--primary.svelte-krj1wt:hover:not(:disabled) {background:#3f3f46;}.alviere-button--primary.svelte-krj1wt:disabled {background:#52525b;cursor:not-allowed;}.alviere-button--secondary.svelte-krj1wt {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#e4e4e7;color:#27272a;}.alviere-button--secondary.svelte-krj1wt:hover:not(:disabled) {background:#d4d4d8;}.alviere-button--secondary.svelte-krj1wt:disabled {background:#f4f4f5;color:#71717a;cursor:not-allowed;}.alviere-button--tertiary.svelte-krj1wt {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#ffffff;border:1px solid #3f3f46;color:#27272a;}.alviere-button--tertiary.svelte-krj1wt:hover:not(:disabled) {background:#e4e4e7;}.alviere-button--tertiary.svelte-krj1wt:disabled {background:#f4f4f5;color:#71717a;cursor:not-allowed;}.alviere-button--icon.svelte-krj1wt {display:flex;align-items:center;gap:0.5rem;}.alviere-button--icon.svelte-krj1wt .alviere-button__icon:where(.svelte-krj1wt) {display:flex;align-items:center;}.alviere-button--icon.svelte-krj1wt .alviere-button__label:where(.svelte-krj1wt):empty {display:none;}\n@media (max-width: 768px) {.alviere-button--icon.svelte-krj1wt .alviere-button__label:where(.svelte-krj1wt) {display:none;}\n}'};function Td(e,t){ht(t,!0),mn(e,Ad);let r=co(t,"size",15,"md"),a=co(t,"color",15,""),n=co(t,"primaryColor",15,""),o=co(t,"backgroundColor",15,""),i=co(t,"ariaLabel",15,""),l=co(t,"class",15,""),s=co(t,"variant",15,"primary"),c=co(t,"handler",15),u=co(t,"disabled",15,!1),v=co(t,"type",15,"button"),d=co(t,"iconName",15,null),p=Qt(()=>`alviere-button alviere-button--${r()} alviere-button--${s()} ${l()} ${d()?"alviere-button--icon":""}`.trim()),f=Qt(()=>{const e=[];return a()?e.push(`--alv-color-primary: ${a()}`):n()&&e.push(`--alv-color-primary: ${n()}`),o()&&e.push(`--alv-button-primary-bg: ${o()}`),e.join("; ")});const h={ArrowLeft:Vc,ArrowRight:Mc,Plus:Kc,X:Hc,Trash:$c},g=Qt(()=>()=>{if(!d())return null;const e=h[d()];return e?Pc(e):null}),m=Qt(()=>()=>{var e;return(null===(e=ka(g)())||void 0===e?void 0:e.outerHTML)||""});var b={get size(){return r()},set size(e="md"){r(e),zt()},get color(){return a()},set color(e=""){a(e),zt()},get primaryColor(){return n()},set primaryColor(e=""){n(e),zt()},get backgroundColor(){return o()},set backgroundColor(e=""){o(e),zt()},get ariaLabel(){return i()},set ariaLabel(e=""){i(e),zt()},get class(){return l()},set class(e=""){l(e),zt()},get variant(){return s()},set variant(e="primary"){s(e),zt()},get handler(){return c()},set handler(e){c(e),zt()},get disabled(){return u()},set disabled(e=!1){u(e),zt()},get type(){return v()},set type(e="button"){v(e),zt()},get iconName(){return d()},set iconName(e=null){d(e),zt()}},y=kd();y.__click=function(...e){var t;null==(t=c())||t.apply(this,e)};var w=Cr(y),_=e=>{var t=Sd();fn(Cr(t),()=>ka(m)()),it(t),Ha(e,t)};pn(w,e=>{ka(m)()&&e(_)});var x=Sr(w,2);return hn(Cr(x),t,"default",{}),it(x),it(y),Or(()=>{En(y,1,wn(ka(p)),"svelte-krj1wt"),y.disabled=u(),Vn(y,"aria-label",i()),Vn(y,"type",v()),kn(y,ka(f))}),Ha(e,y),gt(b)}Ua(["click"]),customElements.define("alviere-button",po(Td,{size:{},color:{},primaryColor:{},backgroundColor:{},ariaLabel:{},class:{},variant:{},handler:{},disabled:{},type:{},iconName:{}},["default"],[],!0));var Id=qa("<div><!></div>");const Bd={hash:"svelte-141uw8j",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-badge.svelte-141uw8j {display:inline-block;padding:0.25rem 0.5rem;border-radius:0.375rem;font-size:0.75rem;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;font-weight:500;color:#3f3f46;background:#f4f4f5;}.alviere-badge--sm.svelte-141uw8j {padding:0 0.5rem;line-height:1.875rem;border-radius:1.875rem;font-size:0.75rem;}.alviere-badge--md.svelte-141uw8j {padding:0 1rem;line-height:2.5rem;border-radius:2.5rem;font-size:1rem;}.alviere-badge--lg.svelte-141uw8j {padding:0 1rem;line-height:2.8125rem;border-radius:2.8125rem;font-size:1.125rem;}.alviere-badge--primary.svelte-141uw8j {background-color:#227e9e;color:#ffffff;}.alviere-badge--secondary.svelte-141uw8j {background-color:#a1a1aa;color:#ffffff;}.alviere-badge--error.svelte-141uw8j {background-color:#b3311f;color:#ffffff;}.alviere-badge--success.svelte-141uw8j {background-color:#436b1d;color:#ffffff;}.alviere-badge--warning.svelte-141uw8j {background-color:#ffc107;color:#000000;}.alviere-badge--info.svelte-141uw8j {background-color:#175db8;color:#ffffff;}"};function Nd(e,t){ht(t,!0),mn(e,Bd);let r=co(t,"variant",15,"primary"),a=co(t,"size",15,"md");var n={get variant(){return r()},set variant(e="primary"){r(e),zt()},get size(){return a()},set size(e="md"){a(e),zt()}},o=Id();return hn(Cr(o),t,"default",{}),it(o),Or(()=>En(o,1,`alviere-badge alviere-badge--${r()??""} alviere-badge--${a()??""}`,"svelte-141uw8j")),Ha(e,o),gt(n)}customElements.define("alviere-badge",po(Nd,{variant:{},size:{}},["default"],[],!0));var zd=qa('<div class="alviere-list"><!></div>');function Rd(e,t){let r;ht(t,!0),vn(()=>{const e=r.querySelector("slot");if(e){e.assignedElements().filter(e=>"alviere-list-item"!==e.tagName.toLowerCase()).length}});var a=zd();hn(Cr(a),t,"default",{}),it(a),ro(a,e=>r=e,()=>r),Ha(e,a),gt()}customElements.define("alviere-list",po(Rd,{},["default"],[],!0));var Dd=qa('<div role="button"><span class="alviere-list-item__expandable__icon svelte-1vd38tq"><!></span></div>'),Ld=qa("<div><!></div>"),Ud=qa('<div><div class="alviere-list-item__header svelte-1vd38tq"><div class="alviere-list-item__badge svelte-1vd38tq"><!></div> <div class="alviere-list-item__leading svelte-1vd38tq"><!></div> <div class="alviere-list-item__content svelte-1vd38tq"><div class="alviere-list-item__text svelte-1vd38tq"><div class="alviere-list-item__primary-text svelte-1vd38tq"><!></div> <div class="alviere-list-item__secondary-text svelte-1vd38tq"><!></div> <div class="alviere-list-item__tertiary-text svelte-1vd38tq"><!></div></div></div> <div class="alviere-list-item__content__monetary svelte-1vd38tq"><div class="alviere-list-item__content__monetary__payment-method"><!></div> <div class="alviere-list-item__content__monetary__amount"><!></div></div> <div class="alviere-list-item__actions svelte-1vd38tq"><!></div> <!></div> <!></div>');const Pd={hash:"svelte-1vd38tq",code:".alviere-list-item.svelte-1vd38tq {display:flex;flex-direction:column;border-top:1px solid transparent;border-bottom:1px solid #d4d4d8;}.alviere-list-item__header.svelte-1vd38tq {display:flex;align-items:center;gap:var(--spacing-md, 1rem);padding:var(--spacing-md, 1rem);}.alviere-list-item--last.svelte-1vd38tq {border-bottom:1px solid transparent;}.alviere-list-item--selectable.svelte-1vd38tq {cursor:pointer;}.alviere-list-item--selectable.svelte-1vd38tq:hover {background-color:#fafafa;}.alviere-list-item--selectable:hover.alviere-list-item--selected.svelte-1vd38tq .alviere-list-item__header:where(.svelte-1vd38tq) {background-color:#d1e8f0;}.alviere-list-item--selectable.alviere-list-item--selected.svelte-1vd38tq .alviere-list-item__header:where(.svelte-1vd38tq) {background-color:#e8f4f8;}.alviere-list-item--selectable.alviere-list-item--selected.svelte-1vd38tq {border-top:1px solid #227e9e;border-bottom:1px solid #227e9e;}.alviere-list-item__leading.svelte-1vd38tq {display:flex;align-items:center;flex-shrink:0;}.alviere-list-item__leading.svelte-1vd38tq:empty {display:none;}.alviere-list-item__content.svelte-1vd38tq {display:flex;align-items:center;gap:var(--spacing-sm, 8px);flex:1;min-width:0;}.alviere-list-item__content__monetary.svelte-1vd38tq {display:flex;align-items:center;font-size:1.125rem;gap:var(--spacing-lg, 1.5rem);flex-shrink:0;}.alviere-list-item__badge.svelte-1vd38tq {flex-shrink:0;}.alviere-list-item__badge.svelte-1vd38tq:empty {display:none;}.alviere-list-item__text.svelte-1vd38tq {flex:1;flex-direction:column;min-width:0;}.alviere-list-item__text.svelte-1vd38tq:empty {display:none;}.alviere-list-item__primary-text.svelte-1vd38tq {font-size:1.25rem;color:#3f3f46;padding-bottom:0.25rem;font-weight:500;}.alviere-list-item__primary-text.svelte-1vd38tq:last-child {padding-bottom:0;}.alviere-list-item__secondary-text.svelte-1vd38tq {font-size:1.125rem;color:#3f3f46;padding-bottom:0.25rem;}.alviere-list-item__secondary-text.svelte-1vd38tq:last-child {padding-bottom:0;}.alviere-list-item__secondary-text.svelte-1vd38tq:empty {display:none;}.alviere-list-item__tertiary-text.svelte-1vd38tq {font-size:1rem;color:#71717a;}.alviere-list-item__tertiary-text.svelte-1vd38tq:last-child {padding-bottom:0;}.alviere-list-item__tertiary-text.svelte-1vd38tq:empty {display:none;}.alviere-list-item__actions.svelte-1vd38tq {display:flex;align-items:center;gap:var(--spacing-sm, 8px);flex-shrink:0;}.alviere-list-item__actions.svelte-1vd38tq:empty {display:none;}.alviere-list-item__expandable.svelte-1vd38tq {display:flex;justify-content:center;padding:var(--spacing-xs, 0.25rem);border-radius:0.125rem;}.alviere-list-item__expandable__icon.svelte-1vd38tq {display:flex;align-items:center;justify-content:center;width:100%;transition:transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);will-change:transform;}.alviere-list-item__expandable--active.svelte-1vd38tq .alviere-list-item__expandable__icon:where(.svelte-1vd38tq) {transform:rotate(90deg);}.alviere-list-item__expandable.svelte-1vd38tq:hover {background-color:#d4d4d8;}.alviere-list-item__expanded-content.svelte-1vd38tq {transition:opacity 0.3s cubic-bezier(0.19, 1, 0.22, 1);will-change:opacity;}.alviere-list-item__expanded-content--active.svelte-1vd38tq {border-top:1px solid #227e9e;}"};function Vd(e,t){ht(t,!0),mn(e,Pd);let r=co(t,"selectable",15,null),a=co(t,"expandable",15,!1),n=co(t,"selected",15,!1),o=co(t,"last",15,!1);const i=dn(),l=Pc(jc);let s=or(!1);function c(){ne.info("ListItem: dispatching select event",null===r()||void 0===r()?void 0:r().value),i("select",{value:null===r()||void 0===r()?void 0:r().value})}function u(e){"Enter"!==e.key&&" "!==e.key||!(null===r()||void 0===r()?void 0:r().value)||(e.preventDefault(),c())}var v={get selectable(){return r()},set selectable(e=null){r(e),zt()},get expandable(){return a()},set expandable(e=!1){a(e),zt()},get selected(){return n()},set selected(e=!1){n(e),zt()},get last(){return o()},set last(e=!1){o(e),zt()}},d=Ud();d.__click=()=>{var e;return(null==(e=r())?void 0:e.value)&&c()},d.__keydown=function(...e){var t;null==(t=r()?u:void 0)||t.apply(this,e)};var p=Cr(d),f=Cr(p);hn(Cr(f),t,"badge",{}),it(f);var h=Sr(f,2);hn(Cr(h),t,"leading",{}),it(h);var g=Sr(h,2),m=Cr(g),b=Cr(m);hn(Cr(b),t,"primary-text",{}),it(b);var y=Sr(b,2);hn(Cr(y),t,"secondary-text",{}),it(y);var w=Sr(y,2);hn(Cr(w),t,"tertiary-text",{}),it(w),it(m),it(g);var _=Sr(g,2),x=Cr(_);hn(Cr(x),t,"monetary-text-method",{}),it(x);var C=Sr(x,2);hn(Cr(C),t,"monetary-text-amount",{}),it(C),it(_);var E=Sr(_,2);hn(Cr(E),t,"actions",{}),it(E);var S=Sr(E,2),k=e=>{var t=Dd();let r;Vn(t,"tabindex",0),t.__click=e=>{e.stopPropagation(),lr(s,!ka(s))},t.__keydown=e=>{var t;e.stopPropagation(),"Enter"!==(t=e).key&&" "!==t.key||(t.preventDefault(),lr(s,!ka(s)))};var a=Cr(t);fn(Cr(a),()=>l.outerHTML),it(a),it(t),Or(()=>{r=En(t,1,"alviere-list-item__expandable svelte-1vd38tq",null,r,{"alviere-list-item__expandable--active":ka(s)}),Vn(t,"aria-expanded",ka(s))}),Ha(e,t)};pn(S,e=>{a()&&e(k)}),it(p);var A=Sr(p,2),T=e=>{var r=$a(),a=Er(r),n=e=>{var r=Ld();let a;hn(Cr(r),t,"expanded-content",{}),it(r),Or(()=>a=En(r,1,"alviere-list-item__expanded-content svelte-1vd38tq",null,a,{"alviere-list-item__expanded-content--active":ka(s)})),Qn(1,r,()=>Yu,()=>({duration:200})),Qn(2,r,()=>Yu,()=>({duration:150})),Ha(e,r)};pn(a,e=>{ka(s)&&e(n)}),Ha(e,r)};return pn(A,e=>{a()&&e(T)}),it(d),Or(()=>{En(d,1,`alviere-list-item ${(o()&&"alviere-list-item--last")??""} ${(r()&&"alviere-list-item--selectable")??""} ${(n()&&"alviere-list-item--selected")??""}`,"svelte-1vd38tq"),Vn(d,"role",r()?"button":void 0),Vn(d,"tabindex",r()?0:void 0)}),Ha(e,d),gt(v)}Ua(["click","keydown"]),customElements.define("alviere-list-item",po(Vd,{selectable:{},expandable:{},selected:{},last:{}},["badge","leading","primary-text","secondary-text","tertiary-text","monetary-text-method","monetary-text-amount","actions","expanded-content"],[],!0));var Md=qa('<div class="alviere-radio"><div class="alviere-radio__input"><input type="radio"/> <div class="alviere-radio__input-inner"><div class="alviere-radio__input-inner-circle"></div></div></div> <div class="alviere-radio__label"><!></div></div>');const Od={hash:"svelte-1k96vob",code:""};function qd(e,t){ht(t,!0),mn(e,Od);let r=co(t,"name",15,""),a=co(t,"value",15,""),n=co(t,"checked",15,!1);var o={get name(){return r()},set name(e=""){r(e),zt()},get value(){return a()},set value(e=""){a(e),zt()},get checked(){return n()},set checked(e=!1){n(e),zt()}},i=Md(),l=Cr(i),s=Cr(l);Dn(s),lt(2),it(l);var c=Sr(l,2);return hn(Cr(c),t,"default",{}),it(c),it(i),Or(()=>{Un(s,n()),Vn(s,"name",r()),Ln(s,a())}),Ha(e,i),gt(o)}customElements.define("alviere-radio",po(qd,{name:{},value:{},checked:{}},["default"],[],!0));var jd=qa('<div class="alviere-checkbox__label"> </div>'),Fd=qa('<div class="alviere-checkbox svelte-1u6cz3v"><div><input type="checkbox" class="alviere-checkbox__input-checkbox svelte-1u6cz3v"/> <div class="alviere-checkbox__input-inner svelte-1u6cz3v"><div class="alviere-checkbox__input-inner-checkmark svelte-1u6cz3v"><!></div></div></div> <!></div>');const Kd={hash:"svelte-1u6cz3v",code:":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-checkbox.svelte-1u6cz3v {display:flex;align-items:center;gap:0.5rem;position:relative;}.alviere-checkbox__input.svelte-1u6cz3v input:where(.svelte-1u6cz3v) {opacity:0;position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer;z-index:2;}.alviere-checkbox__input-inner.svelte-1u6cz3v {width:1rem;height:1rem;border-radius:0.25rem;border:1px solid #52525b;position:relative;z-index:1;transition:all 0.2s ease-in-out;}.alviere-checkbox__input-inner-checkmark.svelte-1u6cz3v {position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.6);width:100%;height:100%;opacity:0;transition:all 0.2s ease-in-out;color:#ffffff;z-index:3;}.alviere-checkbox__input-inner-checkmark.svelte-1u6cz3v svg {width:100%;height:100%;position:relative;}.alviere-checkbox__input--checked.svelte-1u6cz3v .alviere-checkbox__input-inner:where(.svelte-1u6cz3v) {background-color:#000000;}.alviere-checkbox__input--checked.svelte-1u6cz3v .alviere-checkbox__input-inner-checkmark:where(.svelte-1u6cz3v) {opacity:1;transform:translate(-50%, -50%) scale(1);}"};function $d(e,t){ht(t,!0),mn(e,Kd);let r=co(t,"name",15,""),a=co(t,"value",15,!1),n=co(t,"checked",15,!1),o=co(t,"label",15,""),i=co(t,"disabled",15,!1),l=co(t,"onchange",15),s=or(null);const c=Pc(Oc),u=Qt(()=>["alviere-checkbox__input",n()?"alviere-checkbox__input--checked":"",i()?"alviere-checkbox__input--disabled":""].filter(Boolean).join(" "));var v={get name(){return r()},set name(e=""){r(e),zt()},get value(){return a()},set value(e=!1){a(e),zt()},get checked(){return n()},set checked(e=!1){n(e),zt()},get label(){return o()},set label(e=""){o(e),zt()},get disabled(){return i()},set disabled(e=!1){i(e),zt()},get onchange(){return l()},set onchange(e){l(e),zt()}},d=Fd(),p=Cr(d),f=Cr(p);Dn(f),f.__change=function(e){const t=e.target;if(n(t.checked),ka(s)){const e=new CustomEvent("change",{detail:{checked:t.checked,value:a(),name:r()},bubbles:!0,composed:!0});ka(s).dispatchEvent(e)}l()&&l()(e)};var h=Sr(f,2),g=Cr(h);fn(Cr(g),()=>c.outerHTML),it(g),it(h),it(p);var m=Sr(p,2),b=e=>{var t=jd(),r=Cr(t,!0);it(t),Or(()=>an(r,o())),Ha(e,t)};return pn(m,e=>{o()&&e(b)}),it(d),ro(d,e=>lr(s,e),()=>ka(s)),Or(()=>{En(p,1,wn(ka(u)),"svelte-1u6cz3v"),Un(f,n()),Vn(f,"name",r()),Ln(f,a()),f.disabled=i()}),Ha(e,d),gt(v)}Ua(["change"]),customElements.define("alviere-checkbox",po($d,{name:{},value:{},checked:{},label:{},disabled:{},onchange:{}},[],[],!0));const Hd=[{name:"alviere-card-pan-input",component:wc},{name:"alviere-card-cvv-input",component:Ac},{name:"alviere-card-exp-input",component:Rc},{name:"alviere-text-input",component:ou},{name:"alviere-phone-input",component:du},{name:"alviere-date-of-birth-input",component:bu},{name:"alviere-currency-input",component:Su},{name:"alviere-search-select",component:Vu},{name:"alviere-add-payment-instrument",component:Gu},{name:"alviere-create-consumer-account",component:iv},{name:"alviere-create-business-account",component:pv},{name:"alviere-create-account",component:gv},{name:"alviere-add-bank-account",component:jv},{name:"alviere-checkout-confirm",component:Hv},{name:"alviere-multi-step-flow",component:dd},{name:"alviere-spinner",component:md},{name:"alviere-timeline",component:Ed},{name:"alviere-button",component:Td},{name:"alviere-badge",component:Nd},{name:"alviere-list",component:Rd},{name:"alviere-list-item",component:Vd},{name:"alviere-radio",component:qd},{name:"alviere-checkbox",component:$d}],Gd={inputs:{CardPanInput:wc,CardCVVInput:Ac,CardExpInput:Rc,TextInput:ou,PhoneInput:du,DateOfBirthInput:bu,CurrencyInput:Su,SearchSelect:Vu},forms:{AddPaymentInstrument:Gu,CreateConsumerAccount:iv,CreateBusinessAccount:pv,CreateAccount:gv,AddBankAccount:jv,CheckoutConfirm:Hv},flows:{MultiStepFlow:dd},elements:{Spinner:md,Timeline:Ed,Button:Td,Badge:Nd,List:Rd,ListItem:Vd,Radio:qd,Checkbox:$d}},Wd={AlviereCardPanInput:wc,AlviereCardCVVInput:Ac,AlviereCardExpInput:Rc,AlviereTextInput:ou,AlvierePhoneInput:du,AlviereDateOfBirthInput:bu,AlviereCurrencyInput:Su,AlviereSearchSelect:Vu,AlviereAddPaymentInstrument:Gu,AlviereCreateConsumerAccount:iv,AlviereCreateBusinessAccount:pv,AlviereCreateAccount:gv,AlviereAddBankAccount:jv,AlviereCheckoutConfirm:Hv,AlviereMultiStepFlow:dd,AlviereSpinner:md,AlviereTimeline:Ed,AlviereButton:Td,AlviereBadge:Nd,AlviereList:Rd,AlviereListItem:Vd,AlviereRadio:qd,AlviereCheckbox:$d},Yd={...Wd,...Gd.inputs,...Gd.forms,...Gd.flows,...Gd.elements},Qd=Gd,Jd=Wd;function Xd(){ne.info("🔍 Initializing web components"),"undefined"!=typeof window&&window.customElements&&(pe.registerAll(Hd),ne.info("✅ Alviere Web Components initialized successfully"))}return Xd(),ne.info("🚀 Alviere UI Unified Entry Point v2.0.0 - Ready"),ce(),ne.info("Alviere UI Web Components v2.0.0 - Unified entry point ready with auto-injected tokens"),e.Alviere=Jd,e.Categories=Qd,e.Components=Yd,e.adoptTokensInShadowRoot=ue,e.ensureTokensInjected=ce,e.getComponent=function(e){return Yd[e]},e.getComponentNames=function(){return Object.keys(Yd)},e.hasComponent=function(e){return e in Yd},e.initializeWebComponents=Xd,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
2
2
  //# sourceMappingURL=web-components.js.map