(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.ui={}))})(this,function(exports){"use strict";function noop(){}function run(t){return t()}function blank_object(){return Object.create(null)}function run_all(t){t.forEach(run)}function is_function(t){return typeof t=="function"}function safe_not_equal(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let src_url_equal_anchor;function src_url_equal(t,e){return src_url_equal_anchor||(src_url_equal_anchor=document.createElement("a")),src_url_equal_anchor.href=e,t===src_url_equal_anchor.href}function is_empty(t){return Object.keys(t).length===0}function null_to_empty(t){return t==null?"":t}function append(t,e){t.appendChild(e)}function append_styles(t,e,r){const n=get_root_for_style(t);if(!n.getElementById(e)){const o=element("style");o.id=e,o.textContent=r,append_stylesheet(n,o)}}function get_root_for_style(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function append_stylesheet(t,e){append(t.head||t,e)}function insert(t,e,r){t.insertBefore(e,r||null)}function detach(t){t.parentNode.removeChild(t)}function destroy_each(t,e){for(let r=0;rt.removeEventListener(e,r,n)}function attr(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function children(t){return Array.from(t.childNodes)}function set_data(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}let current_component;function set_current_component(t){current_component=t}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(t){get_current_component().$$.on_mount.push(t)}const dirty_components=[],binding_callbacks=[],render_callbacks=[],flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function add_render_callback(t){render_callbacks.push(t)}const seen_callbacks=new Set;let flushidx=0;function flush(){const t=current_component;do{for(;flushidx{const c=i.map(run).filter(is_function);s?s.push(...c):run_all(c),t.$$.on_mount=[]}),a.forEach(add_render_callback)}function destroy_component(t,e){const r=t.$$;r.fragment!==null&&(run_all(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function make_dirty(t,e){t.$$.dirty[0]===-1&&(dirty_components.push(t),schedule_update(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const h=p.length?p[0]:m;return l.ctx&&o(l.ctx[d],l.ctx[d]=h)&&(!l.skip_bound&&l.bound[d]&&l.bound[d](h),u&&make_dirty(t,d)),m}):[],l.update(),u=!0,run_all(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){const d=children(e.target);l.fragment&&l.fragment.l(d),d.forEach(detach)}else l.fragment&&l.fragment.c();e.intro&&transition_in(t.$$.fragment),mount_component(t,e.target,e.anchor,e.customElement),flush()}set_current_component(c)}class SvelteComponent{$destroy(){destroy_component(this,1),this.$destroy=noop}$on(e,r){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const o=n.indexOf(r);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!is_empty(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function add_css(t){append_styles(t,"svelte-1mtuslq",`.sr-only.svelte-1mtuslq.svelte-1mtuslq{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.fixed.svelte-1mtuslq.svelte-1mtuslq{position:fixed}.inset-0.svelte-1mtuslq.svelte-1mtuslq{top:0px;right:0px;bottom:0px;left:0px}.z-40.svelte-1mtuslq.svelte-1mtuslq{z-index:40}.z-50.svelte-1mtuslq.svelte-1mtuslq{z-index:50}.mx-6.svelte-1mtuslq.svelte-1mtuslq{margin-left:1.5rem;margin-right:1.5rem}.mb-4.svelte-1mtuslq.svelte-1mtuslq{margin-bottom:1rem}.flex.svelte-1mtuslq.svelte-1mtuslq{display:flex}.h-8.svelte-1mtuslq.svelte-1mtuslq{height:2rem}.w-full.svelte-1mtuslq.svelte-1mtuslq{width:100%}.w-8.svelte-1mtuslq.svelte-1mtuslq{width:2rem}.max-w-\\[500px\\].svelte-1mtuslq.svelte-1mtuslq{max-width:500px}@keyframes svelte-1mtuslq-spin{to{transform:rotate(360deg)}}.animate-spin.svelte-1mtuslq.svelte-1mtuslq{animation:svelte-1mtuslq-spin 1s linear infinite}.cursor-pointer.svelte-1mtuslq.svelte-1mtuslq{cursor:pointer}.flex-col.svelte-1mtuslq.svelte-1mtuslq{flex-direction:column}.items-center.svelte-1mtuslq.svelte-1mtuslq{align-items:center}.justify-center.svelte-1mtuslq.svelte-1mtuslq{justify-content:center}.justify-between.svelte-1mtuslq.svelte-1mtuslq{justify-content:space-between}.gap-3.svelte-1mtuslq.svelte-1mtuslq{gap:0.75rem}.rounded-md.svelte-1mtuslq.svelte-1mtuslq{border-radius:0.375rem}.rounded-full.svelte-1mtuslq.svelte-1mtuslq{border-radius:9999px}.bg-black\\/25.svelte-1mtuslq.svelte-1mtuslq{background-color:rgb(0 0 0 / 0.25)}.bg-slate-50.svelte-1mtuslq.svelte-1mtuslq{--tw-bg-opacity:1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.bg-slate-100.svelte-1mtuslq.svelte-1mtuslq{--tw-bg-opacity:1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.fill-neutral-600.svelte-1mtuslq.svelte-1mtuslq{fill:#525252}.p-4.svelte-1mtuslq.svelte-1mtuslq{padding:1rem}.p-3.svelte-1mtuslq.svelte-1mtuslq{padding:0.75rem}.text-center.svelte-1mtuslq.svelte-1mtuslq{text-align:center}.text-xl.svelte-1mtuslq.svelte-1mtuslq{font-size:1.25rem;line-height:1.75rem}.text-neutral-300.svelte-1mtuslq.svelte-1mtuslq{--tw-text-opacity:1;color:rgb(212 212 212 / var(--tw-text-opacity))}.antialiased.svelte-1mtuslq.svelte-1mtuslq{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.shadow.svelte-1mtuslq.svelte-1mtuslq{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.shadow-sm.svelte-1mtuslq.svelte-1mtuslq{--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.filter.svelte-1mtuslq.svelte-1mtuslq{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm.svelte-1mtuslq.svelte-1mtuslq{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-colors.svelte-1mtuslq.svelte-1mtuslq{transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.svelte-1mtuslq.svelte-1mtuslq,.svelte-1mtuslq.svelte-1mtuslq::before,.svelte-1mtuslq.svelte-1mtuslq::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-1mtuslq.svelte-1mtuslq::before,.svelte-1mtuslq.svelte-1mtuslq::after{--tw-content:''}h1.svelte-1mtuslq.svelte-1mtuslq{font-size:inherit;font-weight:inherit}a.svelte-1mtuslq.svelte-1mtuslq{color:inherit;text-decoration:inherit}.svelte-1mtuslq.svelte-1mtuslq:-moz-focusring{outline:auto}.svelte-1mtuslq.svelte-1mtuslq:-moz-ui-invalid{box-shadow:none}.svelte-1mtuslq.svelte-1mtuslq::-webkit-inner-spin-button,.svelte-1mtuslq.svelte-1mtuslq::-webkit-outer-spin-button{height:auto}.svelte-1mtuslq.svelte-1mtuslq::-webkit-search-decoration{-webkit-appearance:none}.svelte-1mtuslq.svelte-1mtuslq::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}h1.svelte-1mtuslq.svelte-1mtuslq{margin:0}ul.svelte-1mtuslq.svelte-1mtuslq{list-style:none;margin:0;padding:0}[role="button"].svelte-1mtuslq.svelte-1mtuslq{cursor:pointer}.svelte-1mtuslq.svelte-1mtuslq:disabled{cursor:default}img.svelte-1mtuslq.svelte-1mtuslq,svg.svelte-1mtuslq.svelte-1mtuslq{display:block;vertical-align:middle}img.svelte-1mtuslq.svelte-1mtuslq{max-width:100%;height:auto}.svelte-1mtuslq.svelte-1mtuslq,.svelte-1mtuslq.svelte-1mtuslq::before,.svelte-1mtuslq.svelte-1mtuslq::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.svelte-1mtuslq.svelte-1mtuslq::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.svelte-1mtuslq.svelte-1mtuslq{font-family:Nunito, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;-webkit-font-smoothing:antialiased}.hover\\:bg-slate-200.svelte-1mtuslq.svelte-1mtuslq:hover{--tw-bg-opacity:1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.dark.svelte-1mtuslq .dark\\:border-neutral-600.svelte-1mtuslq{--tw-border-opacity:1;border-color:rgb(82 82 82 / var(--tw-border-opacity))}.dark.svelte-1mtuslq .dark\\:bg-neutral-900.svelte-1mtuslq{--tw-bg-opacity:1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.dark.svelte-1mtuslq .dark\\:bg-neutral-800.svelte-1mtuslq{--tw-bg-opacity:1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark.svelte-1mtuslq .dark\\:fill-neutral-300.svelte-1mtuslq{fill:#d4d4d4}.dark.svelte-1mtuslq .dark\\:text-white.svelte-1mtuslq{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark.svelte-1mtuslq .dark\\:text-neutral-600.svelte-1mtuslq{--tw-text-opacity:1;color:rgb(82 82 82 / var(--tw-text-opacity))}.dark.svelte-1mtuslq .dark\\:hover\\:bg-neutral-700.svelte-1mtuslq:hover{--tw-bg-opacity:1;background-color:rgb(64 64 64 / var(--tw-bg-opacity))}`)}function get_each_context(t,e,r){const n=t.slice();return n[20]=e[r],n}function get_each_context_1(t,e,r){const n=t.slice();return n[23]=e[r],n}function create_else_block(t){let e,r;return{c(){e=element("img"),attr(e,"alt",t[23].name),src_url_equal(e.src,r=t[23].icon)||attr(e,"src",r),attr(e,"class","w-8 h-8 rounded-full svelte-1mtuslq")},m(n,o){insert(n,e,o)},p:noop,d(n){n&&detach(e)}}}function create_if_block(t){let e;return{c(){e=element("div"),e.innerHTML=` Loading...`,attr(e,"role","status"),attr(e,"class","svelte-1mtuslq")},m(r,n){insert(r,e,n)},p:noop,d(r){r&&detach(e)}}}function create_each_block_1(t){let e,r=t[23].name+"",n,o,i,s;function a(m,p){return m[1]===m[23].id?create_if_block:create_else_block}let c=a(t),l=c(t);function u(){return t[12](t[23])}function d(...m){return t[13](t[23],...m)}return{c(){e=element("li"),n=text(r),o=space(),l.c(),attr(e,"class","flex justify-between items-center p-3 bg-slate-100 rounded-md cursor-pointer shadow-sm hover:bg-slate-200 transition-colors dark:bg-neutral-800 dark:hover:bg-neutral-700 dark:border-neutral-600 dark:text-white svelte-1mtuslq")},m(m,p){insert(m,e,p),append(e,n),append(e,o),l.m(e,null),i||(s=[listen(e,"click",u),listen(e,"keyup",d)],i=!0)},p(m,p){t=m,c===(c=a(t))&&l?l.p(t,p):(l.d(1),l=c(t),l&&(l.c(),l.m(e,null)))},d(m){m&&detach(e),l.d(),i=!1,run_all(s)}}}function create_each_block(t){let e,r,n=t[20].name+"",o,i,s,a,c,l,u,d,m,p;return{c(){e=element("a"),r=element("li"),o=text(n),i=space(),s=element("img"),l=space(),attr(s,"alt",a=t[20].name),src_url_equal(s.src,c=t[20].icon)||attr(s,"src",c),attr(s,"class","w-8 h-8 rounded-full svelte-1mtuslq"),attr(r,"class","flex justify-between items-center p-3 bg-slate-100 rounded-md shadow-sm cursor-pointer hover:bg-slate-200 transition-colors dark:bg-neutral-800 dark:hover:bg-neutral-700 dark:border-neutral-600 dark:text-white svelte-1mtuslq"),attr(e,"alt",u=t[20].name+" download link"),attr(e,"href",d=t[20].download),attr(e,"target","_blank"),attr(e,"rel","noopener noreferrer"),attr(e,"class","svelte-1mtuslq")},m(h,y){insert(h,e,y),append(e,r),append(r,o),append(r,i),append(r,s),append(e,l),m||(p=[listen(r,"click",t[14]),listen(r,"keyup",t[15])],m=!0)},p(h,y){y&1&&n!==(n=h[20].name+"")&&set_data(o,n),y&1&&a!==(a=h[20].name)&&attr(s,"alt",a),y&1&&!src_url_equal(s.src,c=h[20].icon)&&attr(s,"src",c),y&1&&u!==(u=h[20].name+" download link")&&attr(e,"alt",u),y&1&&d!==(d=h[20].download)&&attr(e,"href",d)},d(h){h&&detach(e),m=!1,run_all(p)}}}function create_fragment(t){let e,r,n,o,i,s,a,c,l,u,d,m,p=t[4],h=[];for(let g=0;g',a=space(),c=element("ul");for(let g=0;gt.stopPropagation(),keyup_handler_3=t=>t.stopPropagation();function instance(t,e,r){const n=typeof window<"u"?window:null;let{lastWallet:o=null}=e,{installedWallets:i=[]}=e,{preAuthorizedWallets:s=[]}=e,{discoveryWallets:a=[]}=e,{callback:c=async()=>{}}=e,{theme:l=null}=e,u=!1,d=async b=>{var I;r(1,u=(I=b==null?void 0:b.id)!=null?I:!1),await c(b).catch(()=>{}),r(1,u=!1)},m="";l==="dark"||l===null&&(n==null?void 0:n.matchMedia("(prefers-color-scheme: dark)").matches)?m="dark":m="";const p=b=>{r(2,m=b.matches?"dark":"")};onMount(()=>{if(l===null)return n==null||n.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",p),()=>{n==null||n.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",p)}});const h=[o,...s,...i].filter(Boolean),y=()=>d(null),w=b=>{b.key==="Enter"&&d(null)},g=b=>d(b),_=(b,I)=>{I.key==="Enter"&&d(b)},M=()=>d(null),S=b=>{b.key==="Enter"&&d(null)},E=()=>d(null),D=b=>{b.key==="Escape"&&d(null)};return t.$$set=b=>{"lastWallet"in b&&r(5,o=b.lastWallet),"installedWallets"in b&&r(6,i=b.installedWallets),"preAuthorizedWallets"in b&&r(7,s=b.preAuthorizedWallets),"discoveryWallets"in b&&r(0,a=b.discoveryWallets),"callback"in b&&r(8,c=b.callback),"theme"in b&&r(9,l=b.theme)},[a,u,m,d,h,o,i,s,c,l,y,w,g,_,M,S,E,D]}class Modal extends SvelteComponent{constructor(e){super(),init$1(this,e,instance,create_fragment,safe_not_equal,{lastWallet:5,installedWallets:6,preAuthorizedWallets:7,discoveryWallets:0,callback:8,theme:9},add_css)}}function excludeWallets(t,e){return t.filter(r=>!e.some(n=>n.id===r.id))}async function show({discoveryWallets:t,installedWallets:e,lastWallet:r,preAuthorizedWallets:n,enable:o,modalOptions:i}){return new Promise(s=>{var l;const a=[r].filter(Boolean);n=excludeWallets(n,a),e=excludeWallets(e,[...a,...n]),t=excludeWallets(t,[...a,...e,...n]);const c=new Modal({target:document.body,props:{callback:async u=>{var m;const d=(m=await(o==null?void 0:o(u)))!=null?m:u;c.$destroy(),s(d)},lastWallet:r,installedWallets:e,preAuthorizedWallets:n,discoveryWallets:t,theme:(i==null?void 0:i.theme)==="system"?null:(l=i==null?void 0:i.theme)!=null?l:null}})})}const BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(e,r){const n=r.match(e);return n&&n.length>0&&n[1]||""}static getSecondMatch(e,r){const n=r.match(e);return n&&n.length>1&&n[2]||""}static matchAndReturnConst(e,r,n){if(e.test(r))return n}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const r=e.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),r[0]===10)switch(r[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const r=e.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),!(r[0]===1&&r[1]<5)){if(r[0]===1&&r[1]<6)return"Cupcake";if(r[0]===1&&r[1]>=6)return"Donut";if(r[0]===2&&r[1]<2)return"Eclair";if(r[0]===2&&r[1]===2)return"Froyo";if(r[0]===2&&r[1]>2)return"Gingerbread";if(r[0]===3)return"Honeycomb";if(r[0]===4&&r[1]<1)return"Ice Cream Sandwich";if(r[0]===4&&r[1]<4)return"Jelly Bean";if(r[0]===4&&r[1]>=4)return"KitKat";if(r[0]===5)return"Lollipop";if(r[0]===6)return"Marshmallow";if(r[0]===7)return"Nougat";if(r[0]===8)return"Oreo";if(r[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,r,n=!1){const o=Utils.getVersionPrecision(e),i=Utils.getVersionPrecision(r);let s=Math.max(o,i),a=0;const c=Utils.map([e,r],l=>{const u=s-Utils.getVersionPrecision(l),d=l+new Array(u+1).join(".0");return Utils.map(d.split("."),m=>new Array(20-m.length).join("0")+m).reverse()});for(n&&(a=s-Math.min(o,i)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]{n[c]=s[c]})}return e}static getBrowserAlias(e){return BROWSER_ALIASES_MAP[e]}static getBrowserTypeByAlias(e){return BROWSER_MAP[e]||""}}const commonVersionIdentifier=/version\/(\d+(\.?_?\d+)+)/i,browsersList=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},r=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},r=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},r=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},r=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},r=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},r=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},r=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},r=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},r=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},r=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},r=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},r=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},r=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},r=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},r=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},r=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},r=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},r=Utils.getFirstMatch(commonVersionIdentifier,t)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},r=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},r=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},r=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},r=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},r=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},r=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},r=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},r=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},r=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e={name:"Android Browser"},r=Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},r=Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},r=Utils.getFirstMatch(commonVersionIdentifier,t);return r&&(e.version=r),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,r=/^(.*)\/(.*)[ \t]\((.*)/,o=t.search("\\(")!==-1?r:e;return{name:Utils.getFirstMatch(o,t),version:Utils.getSecondMatch(o,t)}}}],osParsersList=[{test:[/Roku\/DVP/],describe(t){const e=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:OS_MAP.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=Utils.getWindowsVersionName(e);return{name:OS_MAP.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:OS_MAP.iOS},r=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe(t){const e=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=Utils.getMacOSVersionName(e),n={name:OS_MAP.MacOS,version:e};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:OS_MAP.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=Utils.getAndroidVersionName(e),n={name:OS_MAP.Android,version:e};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:OS_MAP.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||Utils.getFirstMatch(/\bbb(\d+)/i,t);return{name:OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:OS_MAP.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:OS_MAP.Linux}}},{test:[/CrOS/],describe(){return{name:OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:OS_MAP.PlayStation4,version:e}}}],platformParsersList=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(t){const e=Utils.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:PLATFORMS_MAP.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe(t){const e=Utils.getFirstMatch(/(ipod|iphone)/i,t);return{type:PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:PLATFORMS_MAP.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:PLATFORMS_MAP.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:PLATFORMS_MAP.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:PLATFORMS_MAP.tv}}}],enginesParsersList=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:ENGINE_MAP.Blink};const r=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:ENGINE_MAP.EdgeHTML,version:r}}},{test:[/trident/i],describe(t){const e={name:ENGINE_MAP.Trident},r=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:ENGINE_MAP.Presto},r=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe(t){const e={name:ENGINE_MAP.Gecko},r=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:ENGINE_MAP.WebKit},r=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];class Parser{constructor(e,r=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},r!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=Utils.find(browsersList,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=Utils.find(osParsersList,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:r}=this.getOS();return e?String(r).toLowerCase()||"":r||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:r}=this.getPlatform();return e?String(r).toLowerCase()||"":r||""}parsePlatform(){this.parsedResult.platform={};const e=Utils.find(platformParsersList,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=Utils.find(enginesParsersList,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(e){const r={};let n=0;const o={};let i=0;if(Object.keys(e).forEach(a=>{const c=e[a];typeof c=="string"?(o[a]=c,i+=1):typeof c=="object"&&(r[a]=c,n+=1)}),n>0){const a=Object.keys(r),c=Utils.find(a,u=>this.isOS(u));if(c){const u=this.satisfies(r[c]);if(u!==void 0)return u}const l=Utils.find(a,u=>this.isPlatform(u));if(l){const u=this.satisfies(r[l]);if(u!==void 0)return u}}if(i>0){const a=Object.keys(o),c=Utils.find(a,l=>this.isBrowser(l,!0));if(c!==void 0)return this.compareVersion(o[c])}}isBrowser(e,r=!1){const n=this.getBrowserName().toLowerCase();let o=e.toLowerCase();const i=Utils.getBrowserTypeByAlias(o);return r&&i&&(o=i.toLowerCase()),o===n}compareVersion(e){let r=[0],n=e,o=!1;const i=this.getBrowserVersion();if(typeof i=="string")return e[0]===">"||e[0]==="<"?(n=e.substr(1),e[1]==="="?(o=!0,n=e.substr(2)):r=[],e[0]===">"?r.push(1):r.push(-1)):e[0]==="="?n=e.substr(1):e[0]==="~"&&(o=!0,n=e.substr(1)),r.indexOf(Utils.compareVersions(i,n,o))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,r=!1){return this.isBrowser(e,r)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(r=>this.is(r))}}/*! * Bowser - a browser detector * https://github.com/lancedikson/bowser * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2019 */class Bowser{static getParser(e,r=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Parser(e,r)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return BROWSER_MAP}static get ENGINE_MAP(){return ENGINE_MAP}static get OS_MAP(){return OS_MAP}static get PLATFORMS_MAP(){return PLATFORMS_MAP}}var Z=Object.defineProperty,X=(t,e,r)=>e in t?Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F=(t,e,r)=>(X(t,typeof e!="symbol"?e+"":e,r),r),B=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},N=(t,e,r)=>(B(t,e,"read from private field"),r?r.call(t):e.get(t)),L=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},$=(t,e,r,n)=>(B(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),P=(t,e,r)=>(B(t,e,"access private method"),r);const generateUID=()=>`${Date.now()}-${Math.floor(Math.random()*8999999999999)+1e12}`,shuffle=t=>{for(let e=t.length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}return t};function pipe$1(...t){return e=>t.reduce((r,n)=>r.then(n),Promise.resolve(e))}const ssrSafeWindow=typeof window<"u"?window:null;var Y,V;const wallets=[{id:"argentX",name:"Argent X",icon:"data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjQwIiBoZWlnaHQ9IjM2IiB2aWV3Qm94PSIwIDAgNDAgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0yNC43NTgyIC0zLjk3MzY0ZS0wN0gxNC42MjM4QzE0LjI4NTEgLTMuOTczNjRlLTA3IDE0LjAxMzggMC4yODExNzggMTQuMDA2NCAwLjYzMDY4M0MxMy44MDE3IDEwLjQ1NDkgOC44MjIzNCAxOS43NzkyIDAuMjUxODkzIDI2LjM4MzdDLTAuMDIwMjA0NiAyNi41OTMzIC0wLjA4MjE5NDYgMjYuOTg3MiAwLjExNjczNCAyNy4yNzA5TDYuMDQ2MjMgMzUuNzM0QzYuMjQ3OTYgMzYuMDIyIDYuNjQwOTkgMzYuMDg3IDYuOTE3NjYgMzUuODc1NEMxMi4yNzY1IDMxLjc3MjggMTYuNTg2OSAyNi44MjM2IDE5LjY5MSAyMS4zMzhDMjIuNzk1MSAyNi44MjM2IDI3LjEwNTcgMzEuNzcyOCAzMi40NjQ2IDM1Ljg3NTRDMzIuNzQxIDM2LjA4NyAzMy4xMzQxIDM2LjAyMiAzMy4zMzYxIDM1LjczNEwzOS4yNjU2IDI3LjI3MDlDMzkuNDY0MiAyNi45ODcyIDM5LjQwMjIgMjYuNTkzMyAzOS4xMzA0IDI2LjM4MzdDMzAuNTU5NyAxOS43NzkyIDI1LjU4MDQgMTAuNDU0OSAyNS4zNzU5IDAuNjMwNjgzQzI1LjM2ODUgMC4yODExNzggMjUuMDk2OSAtMy45NzM2NGUtMDcgMjQuNzU4MiAtMy45NzM2NGUtMDdaIiBmaWxsPSIjRkY4NzVCIi8+Cjwvc3ZnPgo=",downloads:{chrome:"https://chrome.google.com/webstore/detail/argent-x-starknet-wallet/dlcobpjiigpikoobohmabehhmhfoodbb",firefox:"https://addons.mozilla.org/en-US/firefox/addon/argent-x",edge:"https://microsoftedge.microsoft.com/addons/detail/argent-x/ajcicjlkibolbeaaagejfhnofogocgcj"}},{id:"braavos",name:"Braavos",icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMC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0NUUiIC8+CiAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI0ZGOTYwMCIgLz4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQyX2xpbmVhcl8zNzJfNDAyNTkiIHgxPSI0OS4zMDU3IiB5MT0iMi4wNzkiIHgyPSI4MC4zNjI3IiB5Mj0iOTMuNjU5NyIKICAgICAgICAgICAgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRjVENDVFIiAvPgogICAgICAgICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiIC8+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KPC9zdmc+",downloads:{chrome:"https://chrome.google.com/webstore/detail/braavos-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma",firefox:"https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet",edge:"https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc",ios:`https://link.braavos.app/dapp/${(Y=ssrSafeWindow==null?void 0:ssrSafeWindow.location)==null?void 0:Y.host}`,android:`https://link.braavos.app/dapp/${(V=ssrSafeWindow==null?void 0:ssrSafeWindow.location)==null?void 0:V.host}`}},{id:"okxwallet",name:"OKX Wallet",icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII=",downloads:{chrome:"https://chrome.google.com/webstore/detail/mcohilncbfahbmgdjkbpemcciiolgcge",firefox:"https://addons.mozilla.org/en-US/firefox/addon/okexwallet",edge:"https://microsoftedge.microsoft.com/addons/detail/%E6%AC%A7%E6%98%93-web3-%E9%92%B1%E5%8C%85/pbpjkcldjiffchgbbndmhojiacbgflha",safari:"https://apps.apple.com/us/app/okx-wallet/id6463797825"}},{id:"metamask",name:"MetaMask",icon:"data:image/svg+xml;utf8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMTIiIGhlaWdodD0iMTg5IiB2aWV3Qm94PSIwIDAgMjEyIDE4OSI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxl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ODhGMzUiIHBvaW50cz0iMTIuMzc1IC41NjMgODguODc1IDU4LjUgNzUuOTM4IDI3Ii8+PHBhdGggZmlsbD0iIzhFNUEzMCIgZD0iTTEyLjM3NTAwMDIsMC41NjI1MDAwMDggTDIuMjUwMDAwMDMsMzEuNTAwMDAwNSBMNy44NzUwMDAxMiw2NS4yNTAwMDEgTDMuOTM3NTAwMDYsNjcuNTAwMDAxIEw5LjU2MjUwMDE0LDcyLjU2MjUgTDUuMDYyNTAwMDgsNzYuNTAwMDAxMSBMMTEuMjUsODIuMTI1MDAxMiBMNy4zMTI1MDAxMSw4NS41MDAwMDEzIEwxNi4zMTI1MDAyLDk2Ljc1MDAwMTQgTDU4LjUwMDAwMDksODMuODEyNTAxMiBDNzkuMTI1MDAxMiw2Ny4zMTI1MDA0IDg5LjI1MDAwMTMsNTguODc1MDAwMyA4OC44NzUwMDEzLDU4LjUwMDAwMDkgQzg4LjUwMDAwMTMsNTguMTI1MDAwOSA2My4wMDAwMDA5LDM4LjgxMjUwMDYgMTIuMzc1MDAwMiwwLjU2MjUwMDAwOCBaIi8+PC9nPjwvZz48L3N2Zz4=",downloads:{chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",firefox:"https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm?hl=en-US"}}];var T,j,x,H,Q,C,G;class LocalStorageWrapper{constructor(e){L(this,H),L(this,C),L(this,T,!1),L(this,j,void 0),L(this,x,void 0),F(this,"value"),$(this,x,e),P(this,C,G).call(this)}set(e){return!N(this,T)&&!P(this,C,G).call(this)?!1:(this.delete(),this.value=e,e&&($(this,j,`${N(this,x)}-${generateUID()}`),localStorage.setItem(N(this,j),e)),!0)}get(){return P(this,H,Q).call(this),this.value}delete(){return!N(this,T)&&!P(this,C,G).call(this)?!1:(this.value=null,N(this,j)&&localStorage.removeItem(N(this,j)),!0)}}T=new WeakMap,j=new WeakMap,x=new WeakMap,H=new WeakSet,Q=function(){this.value&&this.set(this.value)},C=new WeakSet,G=function(){try{!N(this,T)&&typeof window<"u"&&($(this,j,Object.keys(localStorage).find(t=>t.startsWith(N(this,x)))),$(this,T,!0),N(this,j)&&this.set(localStorage.getItem(N(this,j))))}catch(t){console.warn(t)}return N(this,T)};function filterBy(t,e){var r,n;if((r=e==null?void 0:e.include)!=null&&r.length){const o=new Set(e.include);return t.filter(i=>o.has(i.id))}if((n=e==null?void 0:e.exclude)!=null&&n.length){const o=new Set(e.exclude);return t.filter(i=>!o.has(i.id))}return t}const filterByPreAuthorized=async t=>{const e=await Promise.all(t.map(r=>r.isPreauthorized().catch(()=>!1)));return t.filter((r,n)=>e[n])},isWalletObj=t=>{try{return t&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(e=>e in t)}catch{}return!1};function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function isDebugMode$1(){return Boolean("")}function isBrowserEnv$1(){return typeof window<"u"}const LOG_CATEGORY$1="[ Federation Runtime ]";function assert(t,e){t||error(e)}function error(t){throw t instanceof Error?(t.message=`${LOG_CATEGORY$1}: ${t.message}`,t):new Error(`${LOG_CATEGORY$1}: ${t}`)}function warn$1(t){t instanceof Error?(t.message=`${LOG_CATEGORY$1}: ${t.message}`,console.warn(t)):console.warn(`${LOG_CATEGORY$1}: ${t}`)}function addUniqueItem(t,e){return t.findIndex(r=>r===e)===-1&&t.push(e),t}function getFMId(t){return"version"in t&&t.version?`${t.name}:${t.version}`:"entry"in t&&t.entry?`${t.name}:${t.entry}`:`${t.name}`}function isRemoteInfoWithEntry(t){return typeof t.entry<"u"}function isPureRemoteEntry(t){return!t.entry.includes(".json")&&t.entry.includes(".js")}function safeToString$1(t){try{return JSON.stringify(t,null,2)}catch{return""}}function isObject(t){return t&&typeof t=="object"}const objectToString=Object.prototype.toString;function isPlainObject(t){return objectToString.call(t)==="[object Object]"}function _extends$1$1(){return _extends$1$1=Object.assign||function(t){for(var e=1;e=0)&&(r[o]=t[o]);return r}const nativeGlobal=(()=>{try{return new Function("return this")()}catch{return globalThis}})(),Global=nativeGlobal;function definePropertyGlobalVal(t,e,r){Object.defineProperty(t,e,{value:r,configurable:!1,writable:!0})}function includeOwnProperty(t,e){return Object.hasOwnProperty.call(t,e)}includeOwnProperty(globalThis,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(globalThis,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(t){var e,r,n,o,i,s;includeOwnProperty(t,"__VMOK__")&&!includeOwnProperty(t,"__FEDERATION__")&&definePropertyGlobalVal(t,"__FEDERATION__",t.__VMOK__),includeOwnProperty(t,"__FEDERATION__")||(definePropertyGlobalVal(t,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(t,"__VMOK__",t.__FEDERATION__)),(e=t.__FEDERATION__).__GLOBAL_PLUGIN__!=null||(e.__GLOBAL_PLUGIN__=[]),(r=t.__FEDERATION__).__INSTANCES__!=null||(r.__INSTANCES__=[]),(n=t.__FEDERATION__).moduleInfo!=null||(n.moduleInfo={}),(o=t.__FEDERATION__).__SHARE__!=null||(o.__SHARE__={}),(i=t.__FEDERATION__).__MANIFEST_LOADING__!=null||(i.__MANIFEST_LOADING__={}),(s=t.__FEDERATION__).__PRELOADED_MAP__!=null||(s.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(globalThis),setGlobalDefaultVal(nativeGlobal);function getGlobalFederationInstance(t,e){const r=getBuilderId();return globalThis.__FEDERATION__.__INSTANCES__.find(n=>!!(r&&n.options.id===getBuilderId()||n.options.name===t&&!n.options.version&&!e||n.options.name===t&&e&&n.options.version===e))}function setGlobalFederationInstance(t){globalThis.__FEDERATION__.__INSTANCES__.push(t)}function getGlobalFederationConstructor(){return globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function setGlobalFederationConstructor(t,e=isDebugMode$1()){e&&(globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__=t,globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.1.2")}function getInfoWithoutType(t,e){if(typeof e=="string"){if(t[e])return{value:t[e],key:e};{const r=Object.keys(t);for(const n of r){const[o,i]=n.split(":"),s=`${o}:${e}`,a=t[s];if(a)return{value:a,key:s}}return{value:void 0,key:e}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(t,e)=>{const r=getFMId(t),n=getInfoWithoutType(e,r).value;if(n&&!n.version&&"version"in t&&t.version&&(n.version=t.version),n)return n;if("version"in t&&t.version){const{version:o}=t,i=_object_without_properties_loose$1(t,["version"]),s=getFMId(i),a=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,s).value;if((a==null?void 0:a.version)===o)return a}},getGlobalSnapshotInfoByModuleInfo=t=>getTargetSnapshotInfoByModuleInfo(t,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(t,e)=>{const r=getFMId(t);return nativeGlobal.__FEDERATION__.moduleInfo[r]=e,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=t=>(nativeGlobal.__FEDERATION__.moduleInfo=_extends$1$1({},nativeGlobal.__FEDERATION__.moduleInfo,t),()=>{const e=Object.keys(t);for(const r of e)delete nativeGlobal.__FEDERATION__.moduleInfo[r]}),getRemoteEntryExports=(t,e)=>{const r=e||`__FEDERATION_${t}:custom__`,n=globalThis[r];return{remoteEntryKey:r,entryExports:n}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=t=>globalThis.__FEDERATION__.__PRELOADED_MAP__.get(t),setPreloaded=t=>globalThis.__FEDERATION__.__PRELOADED_MAP__.set(t,!0),DEFAULT_SCOPE="default",DEFAULT_REMOTE_TYPE="global",buildIdentifier="[0-9A-Za-z-]+",build=`(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`,numericIdentifier="0|[1-9]\\d*",numericIdentifierLoose="[0-9]+",nonNumericIdentifier="\\d*[a-zA-Z-][a-zA-Z0-9-]*",preReleaseIdentifierLoose=`(?:${numericIdentifierLoose}|${nonNumericIdentifier})`,preReleaseLoose=`(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`,preReleaseIdentifier=`(?:${numericIdentifier}|${nonNumericIdentifier})`,preRelease=`(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`,xRangeIdentifier=`${numericIdentifier}|x|X|\\*`,xRangePlain=`[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`,hyphenRange=`^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`,mainVersionLoose=`(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`,loosePlain=`[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`,gtlt="((?:<|>)?=?)",comparatorTrim=`(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`,loneTilde="(?:~>?)",tildeTrim=`(\\s*)${loneTilde}\\s+`,loneCaret="(?:\\^)",caretTrim=`(\\s*)${loneCaret}\\s+`,star="(<|>)?=?\\s*\\*",caret=`^${loneCaret}${xRangePlain}$`,mainVersion=`(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`,fullPlain=`v?${mainVersion}${preRelease}?${build}?`,tilde=`^${loneTilde}${xRangePlain}$`,xRange=`^${gtlt}\\s*${xRangePlain}$`,comparator=`^${gtlt}\\s*(${fullPlain})$|^$`,gte0="^\\s*>=\\s*0.0.0\\s*$";function parseRegex(t){return new RegExp(t)}function isXVersion(t){return!t||t.toLowerCase()==="x"||t==="*"}function pipe(...t){return e=>t.reduce((r,n)=>n(r),e)}function extractComparator(t){return t.match(parseRegex(comparator))}function combineVersion(t,e,r,n){const o=`${t}.${e}.${r}`;return n?`${o}-${n}`:o}function parseHyphen(t){return t.replace(parseRegex(hyphenRange),(e,r,n,o,i,s,a,c,l,u,d,m)=>(isXVersion(n)?r="":isXVersion(o)?r=`>=${n}.0.0`:isXVersion(i)?r=`>=${n}.${o}.0`:r=`>=${r}`,isXVersion(l)?c="":isXVersion(u)?c=`<${Number(l)+1}.0.0-0`:isXVersion(d)?c=`<${l}.${Number(u)+1}.0-0`:m?c=`<=${l}.${u}.${d}-${m}`:c=`<=${c}`,`${r} ${c}`.trim()))}function parseComparatorTrim(t){return t.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(t){return t.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(t){return t.replace(parseRegex(caretTrim),"$1^")}function parseCarets(t){return t.trim().split(/\s+/).map(e=>e.replace(parseRegex(caret),(r,n,o,i,s)=>isXVersion(n)?"":isXVersion(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(i)?n==="0"?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.0 <${Number(n)+1}.0.0-0`:s?n==="0"?o==="0"?`>=${n}.${o}.${i}-${s} <${n}.${o}.${Number(i)+1}-0`:`>=${n}.${o}.${i}-${s} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${i}-${s} <${Number(n)+1}.0.0-0`:n==="0"?o==="0"?`>=${n}.${o}.${i} <${n}.${o}.${Number(i)+1}-0`:`>=${n}.${o}.${i} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${i} <${Number(n)+1}.0.0-0`)).join(" ")}function parseTildes(t){return t.trim().split(/\s+/).map(e=>e.replace(parseRegex(tilde),(r,n,o,i,s)=>isXVersion(n)?"":isXVersion(o)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(i)?`>=${n}.${o}.0 <${n}.${Number(o)+1}.0-0`:s?`>=${n}.${o}.${i}-${s} <${n}.${Number(o)+1}.0-0`:`>=${n}.${o}.${i} <${n}.${Number(o)+1}.0-0`)).join(" ")}function parseXRanges(t){return t.split(/\s+/).map(e=>e.trim().replace(parseRegex(xRange),(r,n,o,i,s,a)=>{const c=isXVersion(o),l=c||isXVersion(i),u=l||isXVersion(s);return n==="="&&u&&(n=""),a="",c?n===">"||n==="<"?"<0.0.0-0":"*":n&&u?(l&&(i=0),s=0,n===">"?(n=">=",l?(o=Number(o)+1,i=0,s=0):(i=Number(i)+1,s=0)):n==="<="&&(n="<",l?o=Number(o)+1:i=Number(i)+1),n==="<"&&(a="-0"),`${n+o}.${i}.${s}${a}`):l?`>=${o}.0.0${a} <${Number(o)+1}.0.0-0`:u?`>=${o}.${i}.0${a} <${o}.${Number(i)+1}.0-0`:r})).join(" ")}function parseStar(t){return t.trim().replace(parseRegex(star),"")}function parseGTE0(t){return t.trim().replace(parseRegex(gte0),"")}function compareAtom(t,e){return t=Number(t)||t,e=Number(e)||e,t>e?1:t===e?0:-1}function comparePreRelease(t,e){const{preRelease:r}=t,{preRelease:n}=e;if(r===void 0&&Boolean(n))return 1;if(Boolean(r)&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let o=0,i=r.length;o<=i;o++){const s=r[o],a=n[o];if(s!==a)return s===void 0&&a===void 0?0:s?a?compareAtom(s,a):-1:1}return 0}function compareVersion(t,e){return compareAtom(t.major,e.major)||compareAtom(t.minor,e.minor)||compareAtom(t.patch,e.patch)||comparePreRelease(t,e)}function eq(t,e){return t.version===e.version}function compare(t,e){switch(t.operator){case"":case"=":return eq(t,e);case">":return compareVersion(t,e)<0;case">=":return eq(t,e)||compareVersion(t,e)<0;case"<":return compareVersion(t,e)>0;case"<=":return eq(t,e)||compareVersion(t,e)>0;case void 0:return!0;default:return!1}}function parseComparatorString(t){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(t)}function parseRange(t){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(t.trim()).split(/\s+/).join(" ")}function satisfy(t,e){if(!t)return!1;const r=parseRange(e).split(" ").map(u=>parseComparatorString(u)).join(" ").split(/\s+/).map(u=>parseGTE0(u)),n=extractComparator(t);if(!n)return!1;const[,o,,i,s,a,c]=n,l={operator:o,version:combineVersion(i,s,a,c),major:i,minor:s,patch:a,preRelease:c==null?void 0:c.split(".")};for(const u of r){const d=extractComparator(u);if(!d)return!1;const[,m,,p,h,y,w]=d,g={operator:m,version:combineVersion(p,h,y,w),major:p,minor:h,patch:y,preRelease:w==null?void 0:w.split(".")};if(!compare(g,l))return!1}return!0}function _extends$6(){return _extends$6=Object.assign||function(t){for(var e=1;ePromise.resolve(t.lib),_extends$6({deps:[],useIn:[],from:e,loading:null},t,{shareConfig:_extends$6({requiredVersion:`^${t.version}`,singleton:!1,eager:!1,strictVersion:!1},t.shareConfig),get:r,loaded:"lib"in t?!0:void 0,scope:Array.isArray(t.scope)?t.scope:["default"],strategy:t.strategy||"version-first"})}function formatShareConfigs(t,e){return t?Object.keys(t).reduce((r,n)=>(r[n]=formatShare(t[n],e),r),{}):{}}function versionLt(t,e){const r=n=>{if(!Number.isNaN(Number(n))){const o=n.split(".");let i=n;for(let s=0;s<3-o.length;s++)i+=".0";return i}return n};return!!satisfy(r(t),`<=${r(e)}`)}const findVersion=(t,e,r,n)=>{const o=t[e][r],i=n||function(s,a){return versionLt(s,a)};return Object.keys(o).reduce((s,a)=>!s||i(s,a)||s==="0"?a:s,0)},isLoaded=t=>Boolean(t.loaded)||typeof t.lib=="function";function findSingletonVersionOrderByVersion(t,e,r){const n=t[e][r];return findVersion(t,e,r,function(o,i){return!isLoaded(n[o])&&versionLt(o,i)})}function findSingletonVersionOrderByLoaded(t,e,r){const n=t[e][r];return findVersion(t,e,r,function(o,i){return isLoaded(n[i])?isLoaded(n[o])?Boolean(versionLt(o,i)):!0:isLoaded(n[o])?!1:versionLt(o,i)})}function getFindShareFunction(t){return t==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(t,e,r,n){if(!t)return;const{shareConfig:o,scope:i=DEFAULT_SCOPE,strategy:s}=r,a=Array.isArray(i)?i:[i];for(const c of a)if(o&&t[c]&&t[c][e]){const{requiredVersion:l}=o,u=getFindShareFunction(s)(t,c,e),d=()=>{if(o.singleton){if(typeof l=="string"&&!satisfy(u,l)){const p=`Version ${u} from ${u&&t[c][e][u].from} of shared singleton module ${e} does not satisfy the requirement of ${r.from} which needs ${l})`;o.strictVersion?error(p):warn$1(p)}return t[c][e][u]}else{if(l===!1||l==="*"||satisfy(u,l))return t[c][e][u];for(const[p,h]of Object.entries(t[c][e]))if(satisfy(p,l))return h}},m={shareScopeMap:t,scope:c,pkgName:e,version:u,GlobalFederation:Global.__FEDERATION__,resolver:d};return(n.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function _define_property$3(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var MANIFEST_EXT=".json",BROWSER_LOG_KEY="FEDERATION_DEBUG",BROWSER_LOG_VALUE="1",NameTransformSymbol={AT:"@",HYPHEN:"-",SLASH:"/"},_obj,NameTransformMap=(_obj={},_define_property$3(_obj,NameTransformSymbol.AT,"scope_"),_define_property$3(_obj,NameTransformSymbol.HYPHEN,"_"),_define_property$3(_obj,NameTransformSymbol.SLASH,"__"),_obj),_obj1;_obj1={},_define_property$3(_obj1,NameTransformMap[NameTransformSymbol.AT],NameTransformSymbol.AT),_define_property$3(_obj1,NameTransformMap[NameTransformSymbol.HYPHEN],NameTransformSymbol.HYPHEN),_define_property$3(_obj1,NameTransformMap[NameTransformSymbol.SLASH],NameTransformSymbol.SLASH);var SEPARATOR=":";function isBrowserEnv(){return typeof window<"u"}function isDebugMode(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?Boolean(process.env.FEDERATION_DEBUG):typeof FEDERATION_DEBUG<"u"&&Boolean(FEDERATION_DEBUG)}function _array_like_to_array$2(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&arguments[1]!==void 0?arguments[1]:{},r,n,o=e.remotes,i=o===void 0?{}:o,s=e.overrides,a=s===void 0?{}:s,c=e.version,l,u=function(){return"publicPath"in t.metaData?t.metaData.publicPath:t.metaData.getPublicPath},d=Object.keys(a),m={};if(!Object.keys(i).length){var p;m=((p=t.remotes)===null||p===void 0?void 0:p.reduce(function(A,O){var z,R=O.federationContainerName;return d.includes(R)?z=a[R]:"version"in O?z=O.version:z=O.entry,A[R]={matchedVersion:z},A},{}))||{}}Object.keys(i).forEach(function(A){return m[A]={matchedVersion:d.includes(A)?a[A]:i[A]}});var h=t.metaData,y=h.remoteEntry,w=y.path,g=y.name,_=y.type,M=h.types,S=h.buildInfo.buildVersion,E=h.globalName,D=t.exposes,b={version:c||"",buildVersion:S,globalName:E,remoteEntry:simpleJoinRemoteEntry(w,g),remoteEntryType:_,remoteTypes:simpleJoinRemoteEntry(M.path,M.name),remoteTypesZip:M.zip||"",remoteTypesAPI:M.api||"",remotesInfo:m,shared:t==null?void 0:t.shared.map(function(A){return{assets:A.assets,sharedName:A.name}}),modules:D==null?void 0:D.map(function(A){return{moduleName:A.name,modulePath:A.path,assets:A.assets}})};if(!((r=t.metaData)===null||r===void 0)&&r.prefetchInterface){var I=t.metaData.prefetchInterface;b=_object_spread_props(_object_spread$1({},b),{prefetchInterface:I})}if(!((n=t.metaData)===null||n===void 0)&&n.prefetchEntry){var v=t.metaData.prefetchEntry,k=v.path,U=v.name,q=v.type;b=_object_spread_props(_object_spread$1({},b),{prefetchEntry:simpleJoinRemoteEntry(k,U),prefetchEntryType:q})}return"publicPath"in t.metaData?l=_object_spread_props(_object_spread$1({},b),{publicPath:u()}):l=_object_spread_props(_object_spread$1({},b),{getPublicPath:u()}),l}function isManifestProvider(t){return!!("remoteEntry"in t&&t.remoteEntry.includes(MANIFEST_EXT))}function asyncGeneratorStep$1(t,e,r,n,o,i,s){try{var a=t[i](s),c=a.value}catch(l){r(l);return}a.done?e(c):Promise.resolve(c).then(n,o)}function _async_to_generator$1(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function s(c){asyncGeneratorStep$1(i,n,o,s,a,"next",c)}function a(c){asyncGeneratorStep$1(i,n,o,s,a,"throw",c)}s(void 0)})}}function _instanceof(t,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function _ts_generator$1(t,e){var r,n,o,i,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=l[0]&2?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return s.label++,{value:l[1],done:!1};case 5:s.label++,n=l[1],l=[0];continue;case 7:l=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){s=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,o=null,i=!0,s=document.getElementsByTagName("link"),a=0;at.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&o[o.length-1])&&(l[0]===6||l[0]===2)){s=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]"u"?[4,importNodeModule("node-fetch")]:[3,2];case 1:return e=r.sent(),[2,(e==null?void 0:e.default)||e];case 2:return[2,fetch];case 3:return[2]}})});return function(){return t.apply(this,arguments)}}();console.log("fetching",urlObj.href),getFetch().then(function(f){f(urlObj.href).then(function(t){return t.text()}).then(function(){var _ref=_async_to_generator(function(data){var _ref,path,vm,scriptContext,urlDirname,filename,script,exportedInterface,container;return _ts_generator(this,function(_state){switch(_state.label){case 0:return[4,Promise.all([importNodeModule("path"),importNodeModule("vm")])];case 1:_ref=_sliced_to_array.apply(void 0,[_state.sent(),2]),path=_ref[0],vm=_ref[1],scriptContext={exports:{},module:{exports:{}}},urlDirname=urlObj.pathname.split("/").slice(0,-1).join("/"),filename=path.basename(urlObj.pathname);try{if(script=new vm.Script("(function(exports, module, require, __dirname, __filename) {".concat(data,` })`),filename),script.runInThisContext()(scriptContext.exports,scriptContext.module,eval("require"),urlDirname,filename),exportedInterface=scriptContext.module.exports||scriptContext.exports,attrs&&exportedInterface&&attrs.globalName)return container=exportedInterface[attrs.globalName]||exportedInterface,cb(void 0,container),[2];cb(void 0,exportedInterface)}catch(t){cb(new Error("Script execution error: ".concat(t)))}return[2]}})});return function(t){return _ref.apply(this,arguments)}}()).catch(function(t){cb(t)})})}function loadScriptNode(t,e){return new Promise(function(r,n){createScriptNode(t,function(o,i){if(o)n(o);else{var s,a,c=(e==null||(s=e.attrs)===null||s===void 0?void 0:s.globalName)||"__FEDERATION_".concat(e==null||(a=e.attrs)===null||a===void 0?void 0:a.name,":custom__"),l=globalThis[c]=i;r(l)}},e.attrs,e.createScriptHook)})}function matchRemoteWithNameAndExpose(t,e){for(const r of t){const n=e.startsWith(r.name);let o=e.replace(r.name,"");if(n){if(o.startsWith("/")){const a=r.name;return o=`.${o}`,{pkgNameOrAlias:a,expose:o,remote:r}}else if(o==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const i=r.alias&&e.startsWith(r.alias);let s=r.alias&&e.replace(r.alias,"");if(r.alias&&i){if(s&&s.startsWith("/")){const a=r.alias;return s=`.${s}`,{pkgNameOrAlias:a,expose:s,remote:r}}else if(s==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function matchRemote(t,e){for(const r of t)if(e===r.name||r.alias&&e===r.alias)return r}function registerPlugins(t,e){const r=getGlobalHostPlugins();r.length>0&&r.forEach(n=>{t!=null&&t.find(o=>o.name!==n.name)&&t.push(n)}),t&&t.length>0&&t.forEach(n=>{e.forEach(o=>{o.applyPlugin(n)})})}function _extends$5(){return _extends$5=Object.assign||function(t){for(var e=1;e{try{e?r(e):new Function("callbacks",`import("${t}").then(callbacks[0]).catch(callbacks[1])`)([r,n])}catch(o){n(o)}})}async function loadEntryScript({name:t,globalName:e,entry:r,createScriptHook:n}){const{entryExports:o}=getRemoteEntryExports(t,e);return o||(typeof document>"u"?loadScriptNode(r,{attrs:{name:t,globalName:e},createScriptHook:n}).then(()=>{const{remoteEntryKey:i,entryExports:s}=getRemoteEntryExports(t,e);return assert(s,` Unable to use the ${t}'s '${r}' URL with ${i}'s globalName to get remoteEntry exports. Possible reasons could be: 1. '${r}' is not the correct URL, or the remoteEntry resource or name is incorrect. 2. ${i} cannot be used to get remoteEntry exports in the window object. `),s}).catch(i=>i):loadScript(r,{attrs:{},createScriptHook:n}).then(()=>{const{remoteEntryKey:i,entryExports:s}=getRemoteEntryExports(t,e);return assert(s,` Unable to use the ${t}'s '${r}' URL with ${i}'s globalName to get remoteEntry exports. Possible reasons could be: 1. '${r}' is not the correct URL, or the remoteEntry resource or name is incorrect. 2. ${i} cannot be used to get remoteEntry exports in the window object. `),s}).catch(i=>i))}function getRemoteEntryUniqueKey(t){const{entry:e,name:r}=t;return composeKeyWithSeparator(r,e)}async function getRemoteEntry({remoteEntryExports:t,remoteInfo:e,createScriptHook:r}){const{entry:n,name:o,type:i,entryGlobalName:s}=e,a=getRemoteEntryUniqueKey(e);return t||(globalLoading[a]||(i==="esm"?globalLoading[a]=loadEsmEntry({entry:n,remoteEntryExports:t}):globalLoading[a]=loadEntryScript({name:o,globalName:s,entry:n,createScriptHook:r})),globalLoading[a])}function getRemoteInfo(t){return _extends$5({},t,{entry:"entry"in t?t.entry:"",type:t.type||DEFAULT_REMOTE_TYPE,entryGlobalName:t.entryGlobalName||t.name,shareScope:t.shareScope||DEFAULT_SCOPE})}function _extends$4(){return _extends$4=Object.assign||function(t){for(var e=1;e{const r=this.host.loaderHook.lifecycle.createScript.emit({url:e});if(typeof document>"u"||r instanceof HTMLScriptElement)return r}});return assert(t,`remoteEntryExports is undefined ${safeToString$1(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,e){const{loadFactory:r=!0}=e||{loadFactory:!0},n=await this.getEntry();if(!this.inited){const i=this.host.shareScopeMap,s=this.remoteInfo.shareScope||"default";i[s]||(i[s]={});const a=i[s],c=[],l={version:this.remoteInfo.version||""};Object.defineProperty(l,"hostId",{value:this.host.options.id||this.host.name,enumerable:!1});const u=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:a,remoteEntryInitOptions:l,initScope:c,remoteInfo:this.remoteInfo,origin:this.host});await n.init(u.shareScope,u.initScope,u.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$4({},u,{remoteEntryExports:n}))}this.lib=n,this.inited=!0;const o=await n.get(t);return assert(o,`${getFMId(this.remoteInfo)} remote don't export ${t}.`),r?await o():o}constructor({remoteInfo:t,host:e}){this.inited=!1,this.lib=void 0,this.remoteInfo=t,this.host=e}};class SyncHook{on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const r=this;this.on(function n(...o){return r.remove(n),e.apply(null,o)})}emit(...e){let r;return this.listeners.size>0&&this.listeners.forEach(n=>{r=n(...e)}),r}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}}class AsyncHook extends SyncHook{emit(...e){let r;const n=Array.from(this.listeners);if(n.length>0){let o=0;const i=s=>s===!1?!1:o0){let n=0;const o=s=>(warn$1(s),this.onerror(s),e),i=s=>{if(checkReturnData(e,s)){if(e=s,n{const o=e[n];o&&this.lifecycle[n].on(o)}))}removePlugin(e){assert(e,"A name is required.");const r=this.registerPlugins[e];assert(r,`The plugin "${e}" is not registered.`),Object.keys(r).forEach(n=>{n!=="name"&&this.lifecycle[n].remove(r[n])})}inherit({lifecycle:e,registerPlugins:r}){Object.keys(e).forEach(n=>{assert(!this.lifecycle[n],`The hook "${n}" has a conflict and cannot be inherited.`),this.lifecycle[n]=e[n]}),Object.keys(r).forEach(n=>{assert(!this.registerPlugins[n],`The plugin "${n}" has a conflict and cannot be inherited.`),this.applyPlugin(r[n])})}constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}}function _extends$3(){return _extends$3=Object.assign||function(t){for(var e=1;e{const n=matchRemote(t,r.nameOrAlias);return assert(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&safeToString$1({remoteInfo:n,remotes:t})}`),{remote:n,preloadConfig:defaultPreloadArgs(r)}})}function normalizePreloadExposes(t){return t?t.map(e=>e==="."?e:e.startsWith("./")?e.replace("./",""):e):[]}function preloadAssets(t,e,r){const{cssAssets:n,jsAssetsWithoutEntry:o,entryAssets:i}=r;if(e.options.inBrowser){i.forEach(a=>{const{moduleInfo:c}=a,l=e.moduleCache.get(t.name);getRemoteEntry(l?{remoteInfo:c,remoteEntryExports:l.remoteEntryExports,createScriptHook:u=>{const d=e.loaderHook.lifecycle.createScript.emit({url:u});if(d instanceof HTMLScriptElement)return d}}:{remoteInfo:c,remoteEntryExports:void 0,createScriptHook:u=>{const d=e.loaderHook.lifecycle.createScript.emit({url:u});if(d instanceof HTMLScriptElement)return d}})});const s=document.createDocumentFragment();n.forEach(a=>{const{link:c,needAttach:l}=createLink(a,()=>{},{rel:"preload",as:"style"},u=>{const d=e.loaderHook.lifecycle.createLink.emit({url:u});if(d instanceof HTMLLinkElement)return d});l&&s.appendChild(c)}),o.forEach(a=>{const{link:c,needAttach:l}=createLink(a,()=>{},{rel:"preload",as:"script"},u=>{const d=e.loaderHook.lifecycle.createLink.emit({url:u});if(d instanceof HTMLLinkElement)return d});l&&document.head.appendChild(c)}),document.head.appendChild(s)}}function _extends$2(){return _extends$2=Object.assign||function(t){for(var e=1;e{let g;if(w)g=d;else if(Array.isArray(m)){const b=m.find(I=>I.nameOrAlias===y.name||I.nameOrAlias===y.alias);if(!b)return;g=defaultPreloadArgs(b)}else if(m===!0)g=d;else return;const _=getResourceUrl(h,"remoteEntry"in h?h.remoteEntry:"");_&&a.push({name:y.name,moduleInfo:{name:y.name,entry:_,type:"remoteEntryType"in h?h.remoteEntryType:"global",entryGlobalName:"globalName"in h?h.globalName:y.name,shareScope:"",version:"version"in h?h.version:void 0},url:_});let M="modules"in h?h.modules:[];const S=normalizePreloadExposes(g.exposes);if(S.length&&"modules"in h){var E;M=h==null||(E=h.modules)==null?void 0:E.reduce((b,I)=>((S==null?void 0:S.indexOf(I.moduleName))!==-1&&b.push(I),b),[])}function D(b){const I=b.map(v=>getResourceUrl(h,v));return g.filter?I.filter(g.filter):I}if(M){const b=M.length;for(let I=0;I{var y;const w=(y=u.shared)==null?void 0:y[h.sharedName];if(!w)return;const g=getRegisteredShare(t.shareScopeMap,h.sharedName,w,t.hooks.lifecycle.resolveShare);g&&typeof g.lib=="function"&&(h.assets.js.sync.forEach(_=>{c.add(_)}),h.assets.css.sync.forEach(_=>{l.add(_)}))});const p=s.filter(h=>!c.has(h));return{cssAssets:i.filter(h=>!l.has(h)),jsAssetsWithoutEntry:p,entryAssets:a}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(t){const{origin:e,preloadOptions:r,remoteInfo:n,remote:o,globalSnapshot:i,remoteSnapshot:s}=t;return isRemoteInfoWithEntry(o)&&isPureRemoteEntry(o)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:o.name,url:o.entry,moduleInfo:{name:n.name,entry:o.entry,type:"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(n,s),generatePreloadAssets(e,r,n,i,s))}}};function _extends$1(){return _extends$1=Object.assign||function(t){for(var e=1;e{let s=this.manifestCache.get(e);if(s)return s;try{let a=await this.loaderHook.lifecycle.fetch.emit(e,{});return(!a||!(a instanceof Response))&&(a=await fetch(e,{})),s=await a.json(),assert(s.metaData&&s.exposes&&s.shared,`${e} is not a federation manifest`),this.manifestCache.set(e,s),s}catch(a){error(`Failed to get manifestJson for ${r.name}. The manifest URL is ${e}. Please ensure that the manifestUrl is accessible. Error message: ${a}`)}},i=async()=>{const s=await o(),a=generateSnapshotFromManifest(s,{version:e}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:r,manifestJson:s,remoteSnapshot:a,manifestUrl:e,from:"manifest"});return c};return this.manifestLoading[e]||(this.manifestLoading[e]=i().then(s=>s)),this.manifestLoading[e]}constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new PluginSystem({beforeLoadRemoteSnapshot:new AsyncHook("beforeLoadRemoteSnapshot"),loadSnapshot:new AsyncWaterfallHook("loadGlobalSnapshot"),loadRemoteSnapshot:new AsyncWaterfallHook("loadRemoteSnapshot")}),this.manifestLoading=Global.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}}function _extends(){return _extends=Object.assign||function(t){for(var e=1;e=0)&&(r[o]=t[o]);return r}class FederationHost{_setGlobalShareScopeMap(){const e=getGlobalShareScope(),r=this.options.id||this.options.name;r&&!e[r]&&(e[r]=this.shareScopeMap)}initOptions(e){this.registerPlugins(e.plugins);const r=this.formatOptions(this.options,e);return this.options=r,r}async loadShare(e,r){var n;const o=Object.assign({},(n=this.options.shared)==null?void 0:n[e],r);o!=null&&o.scope&&await Promise.all(o.scope.map(async l=>{await Promise.all(this.initializeSharing(l,o.strategy))}));const i=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:o,shared:this.options.shared,origin:this}),{shareInfo:s}=i;assert(s,`Cannot find ${e} Share in the ${this.options.name}. Please ensure that the ${e} Share parameters have been injected`);const a=getRegisteredShare(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare),c=l=>{l.useIn||(l.useIn=[]),addUniqueItem(l.useIn,this.options.name)};if(a&&a.lib)return c(a),a.lib;if(a&&a.loading&&!a.loaded){const l=await a.loading;return a.loaded=!0,a.lib||(a.lib=l),c(a),l}else if(a){const l=(async()=>{const u=await a.get();s.lib=u,s.loaded=!0,c(s);const d=getRegisteredShare(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare);return d&&(d.lib=u,d.loaded=!0),u})();return this.setShared({pkgName:e,loaded:!1,shared:a,from:this.options.name,lib:null,loading:l}),l}else{if(r)return!1;const l=(async()=>{const u=await s.get();s.lib=u,s.loaded=!0,c(s);const d=getRegisteredShare(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare);return d&&(d.lib=u,d.loaded=!0),u})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:this.options.name,lib:null,loading:l}),l}}loadShareSync(e,r){var n;const o=Object.assign({},(n=this.options.shared)==null?void 0:n[e],r);o!=null&&o.scope&&o.scope.forEach(a=>{this.initializeSharing(a,o.strategy)});const i=getRegisteredShare(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare),s=a=>{a.useIn||(a.useIn=[]),addUniqueItem(a.useIn,this.options.name)};if(i){if(typeof i.lib=="function")return s(i),i.loaded||(i.loaded=!0,i.from===this.options.name&&(o.loaded=!0)),i.lib;if(typeof i.get=="function"){const a=i.get();if(!(a instanceof Promise))return s(i),this.setShared({pkgName:e,loaded:!0,from:this.options.name,lib:a,shared:i}),a}}if(o.lib)return o.loaded||(o.loaded=!0),o.lib;if(o.get){const a=o.get();if(a instanceof Promise)throw new Error(` The loadShareSync function was unable to load ${e}. The ${e} could not be found in ${this.options.name}. Possible reasons for failure: 1. The ${e} share was registered with the 'get' attribute, but loadShare was not used beforehand. 2. The ${e} share was not registered with the 'lib' attribute. `);return o.lib=a,this.setShared({pkgName:e,loaded:!0,from:this.options.name,lib:o.lib,shared:o}),o.lib}throw new Error(` The loadShareSync function was unable to load ${e}. The ${e} could not be found in ${this.options.name}. Possible reasons for failure: 1. The ${e} share was registered with the 'get' attribute, but loadShare was not used beforehand. 2. The ${e} share was not registered with the 'lib' attribute. `)}initRawContainer(e,r,n){const o=getRemoteInfo({name:e,entry:r}),i=new Module({host:this,remoteInfo:o});return i.remoteEntryExports=n,this.moduleCache.set(e,i),i}async _getRemoteModuleAndOptions(e){const r=await this.hooks.lifecycle.beforeRequest.emit({id:e,options:this.options,origin:this}),{id:n}=r,o=matchRemoteWithNameAndExpose(this.options.remotes,n);assert(o,` Unable to locate ${n} in ${this.options.name}. Potential reasons for failure include: 1. ${n} was not included in the 'remotes' parameter of ${this.options.name||"the host"}. 2. ${n} could not be found in the 'remotes' of ${this.options.name} with either 'name' or 'alias' attributes. 3. ${n} is not online, injected, or loaded. 4. ${n} cannot be accessed on the expected. 5. The 'beforeRequest' hook was provided but did not return the correct 'remoteInfo' when attempting to load ${n}. `);const{remote:i}=o,s=getRemoteInfo(i),a=await this.hooks.lifecycle.afterResolve.emit(_extends({id:n},o,{options:this.options,origin:this,remoteInfo:s})),{remote:c,expose:l}=a;assert(c&&l,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let u=this.moduleCache.get(c.name);const d={host:this,remoteInfo:s};return u||(u=new Module(d),this.moduleCache.set(c.name,u)),{module:u,moduleOptions:d,remoteMatchInfo:a}}async loadRemote(e,r){try{const{loadFactory:n=!0}=r||{loadFactory:!0},{module:o,moduleOptions:i,remoteMatchInfo:s}=await this._getRemoteModuleAndOptions(e),{pkgNameOrAlias:a,remote:c,expose:l,id:u}=s,d=await o.get(l,r),m=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:a,expose:l,exposeModule:n?d:void 0,exposeModuleFactory:n?void 0:d,remote:c,options:i,moduleInstance:o,origin:this});return typeof m=="function"?m:d}catch(n){const{from:o="runtime"}=r||{from:"runtime"},i=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:o,origin:this});if(!i)throw n;return i}}async preloadRemote(e){await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOptions:e,options:this.options,origin:this});const r=formatPreloadArgs(this.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:o}=n,i=getRemoteInfo(o),{globalSnapshot:s,remoteSnapshot:a}=await this.snapshotHandler.loadRemoteSnapshotInfo(o),c=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:this,preloadOptions:n,remote:o,remoteInfo:i,globalSnapshot:s,remoteSnapshot:a});!c||preloadAssets(i,this,c)}))}initializeSharing(e=DEFAULT_SCOPE,r){const n=this.shareScopeMap,o=this.options.name;n[e]||(n[e]={});const i=n[e],s=(u,d)=>{var m;const{version:p,eager:h}=d;i[u]=i[u]||{};const y=i[u],w=y[p],g=Boolean(w&&(w.eager||((m=w.shareConfig)==null?void 0:m.eager)));(!w||w.strategy!=="loaded-first"&&!w.loaded&&(Boolean(!h)!==!g?h:o>w.from))&&(y[p]=d)},a=[],c=u=>u&&u.init&&u.init(n[e]),l=async u=>{const{module:d}=await this._getRemoteModuleAndOptions(u);if(d.getEntry){const m=await d.getEntry();d.inited||(c(m),d.inited=!0)}};return Object.keys(this.options.shared).forEach(u=>{const d=this.options.shared[u];d.scope.includes(e)&&s(u,d)}),r==="version-first"&&this.options.remotes.forEach(u=>{u.shareScope===e&&a.push(l(u.name))}),a}initShareScopeMap(e,r){this.shareScopeMap[e]=r,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:r,options:this.options,origin:this})}formatOptions(e,r){const n=formatShareConfigs(r.shared||{},r.name),o=_extends({},e.shared,n),{userOptions:i,options:s}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:r,options:e,shareInfo:o}),a=(i.remotes||[]).reduce((u,d)=>(this.registerRemote(d,u,{force:!1}),u),s.remotes);Object.keys(n).forEach(u=>{const d=n[u];!getRegisteredShare(this.shareScopeMap,u,d,this.hooks.lifecycle.resolveShare)&&d&&d.lib&&this.setShared({pkgName:u,lib:d.lib,get:d.get,loaded:!0,shared:d,from:r.name})});const c=[...s.plugins];i.plugins&&i.plugins.forEach(u=>{c.includes(u)||c.push(u)});const l=_extends({},e,r,{plugins:c,remotes:a,shared:o});return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){registerPlugins(e,[this.hooks,this.snapshotHandler.hooks,this.loaderHook])}setShared({pkgName:e,shared:r,from:n,lib:o,loading:i,loaded:s,get:a}){const{version:c,scope:l="default"}=r,u=_object_without_properties_loose(r,["version","scope"]);(Array.isArray(l)?l:[l]).forEach(d=>{this.shareScopeMap[d]||(this.shareScopeMap[d]={}),this.shareScopeMap[d][e]||(this.shareScopeMap[d][e]={}),!this.shareScopeMap[d][e][c]&&(this.shareScopeMap[d][e][c]=_extends({version:c,scope:["default"]},u,{lib:o,loaded:s,loading:i}),a&&(this.shareScopeMap[d][e][c].get=a))})}removeRemote(e){const{name:r}=e,n=this.options.remotes.findIndex(i=>i.name===r);n!==-1&&this.options.remotes.splice(n,1);const o=this.moduleCache.get(e.name);if(o){const i=o.remoteInfo.entryGlobalName;globalThis[i]&&delete globalThis[i];const s=getRemoteEntryUniqueKey(o.remoteInfo);globalLoading[s]&&delete globalLoading[s],this.moduleCache.delete(e.name)}}registerRemote(e,r,n){const o=()=>{if(e.alias){const s=r.find(a=>{var c;return e.alias&&(a.name.startsWith(e.alias)||((c=a.alias)==null?void 0:c.startsWith(e.alias)))});assert(!s,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${s&&s.name} name or alias`)}"entry"in e&&isBrowserEnv$1()&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=DEFAULT_SCOPE),e.type||(e.type=DEFAULT_REMOTE_TYPE)},i=r.find(s=>s.name===e.name);if(!i)o(),r.push(e);else{const s=[`The remote "${e.name}" is already registered.`,n!=null&&n.force?"Hope you have known that OVERRIDE it may have some unexpected errors":'If you want to merge the remote, you can set "force: true".'];n!=null&&n.force&&(this.removeRemote(i),o(),r.push(e)),warn$1(s.join(" "))}}registerRemotes(e,r){e.forEach(n=>{this.registerRemote(n,this.options.remotes,{force:r==null?void 0:r.force})})}constructor(e){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeRequest:new AsyncWaterfallHook("beforeRequest"),afterResolve:new AsyncWaterfallHook("afterResolve"),beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainerShareScopeMap:new AsyncWaterfallHook("initContainer"),initContainer:new AsyncWaterfallHook("initContainer"),onLoad:new AsyncHook("onLoad"),handlePreloadModule:new SyncHook("handlePreloadModule"),errorLoadRemote:new AsyncHook("errorLoadRemote"),beforeLoadShare:new AsyncWaterfallHook("beforeLoadShare"),loadShare:new AsyncHook,resolveShare:new SyncWaterfallHook("resolveShare"),beforePreloadRemote:new AsyncHook,generatePreloadAssets:new AsyncHook("generatePreloadAssets"),afterPreloadRemote:new AsyncHook}),this.version="0.1.2",this.moduleCache=new Map,this.loaderHook=new PluginSystem({getModuleInfo:new SyncHook,createScript:new SyncHook,createLink:new SyncHook,fetch:new AsyncHook("fetch")});const r={id:getBuilderId(),name:e.name,plugins:[snapshotPlugin(),generatePreloadAssetsPlugin()],remotes:[],shared:{},inBrowser:isBrowserEnv$1()};this.name=e.name,this.options=r,this.shareScopeMap={},this._setGlobalShareScopeMap(),this.snapshotHandler=new SnapshotHandler(this),this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}}let FederationInstance=null;function init(t){const e=getGlobalFederationInstance(t.name,t.version);if(e)return e.initOptions(t),FederationInstance||(FederationInstance=e),e;{const r=getGlobalFederationConstructor()||FederationHost;return FederationInstance=new r(t),setGlobalFederationInstance(FederationInstance),FederationInstance}}function loadRemote(...t){return assert(FederationInstance,"Please call init first"),FederationInstance.loadRemote.apply(FederationInstance,t)}setGlobalFederationConstructor(FederationHost);function isMetaMaskProvider(t){return t!==null&&typeof t=="object"&&t.hasOwnProperty("isMetaMask")&&t.hasOwnProperty("request")}function detectMetaMaskProvider(t,{timeout:e=3e3}={}){let r=!1;return new Promise(n=>{const o=i=>{const{info:s,provider:a}=i.detail;["io.metamask","io.metamask.flask"].includes(s.rdns)&&isMetaMaskProvider(a)&&(n(a),r=!0)};typeof t.addEventListener=="function"&&t.addEventListener("eip6963:announceProvider",o),setTimeout(()=>{r||n(null)},e),typeof t.dispatchEvent=="function"&&t.dispatchEvent(new Event("eip6963:requestProvider"))})}async function waitForMetaMaskProvider(t,{timeout:e=3e3,retries:r=0}={}){return detectMetaMaskProvider(t,{timeout:e}).catch(function(){return null}).then(function(n){return n||r===0?n:waitForMetaMaskProvider(t,{timeout:e,retries:r-1})})}async function detectMetamaskSupport(t){return await waitForMetaMaskProvider(t,{retries:3})}async function fetchMetaMaskSnapWallet(t){await init({name:"MetaMaskStarknetSnapWallet",remotes:[{name:"MetaMaskStarknetSnapWallet",alias:"MetaMaskStarknetSnapWallet",entry:"https://snaps.consensys.io/starknet/get-starknet/v1/remoteEntry.js"}]});const e=await loadRemote("MetaMaskStarknetSnapWallet/index"),{MetaMaskSnapWallet:r}=e;return new r(t,"*")}function createMetaMaskProviderWrapper(t,e){let r,n;return{id:t.id,name:t.name,icon:t.icon,get version(){var o;return(o=r==null?void 0:r.version)!=null?o:"0.0.0"},get isConnected(){var o;return(o=r==null?void 0:r.isConnected)!=null?o:!1},get provider(){return r==null?void 0:r.provider},get account(){return r==null?void 0:r.account},get selectedAddress(){return r==null?void 0:r.selectedAddress},get chainId(){return r==null?void 0:r.chainId},request(o){if(!r)throw new Error("Wallet not enabled");return r.request(o)},async enable(){return r||(n=n||fetchMetaMaskSnapWallet(e),r=await n),await r.enable()},isPreauthorized(){var o;return(o=r==null?void 0:r.isPreauthorized())!=null?o:Promise.resolve(!1)},on(o,i){if(!r)throw new Error("Wallet not enabled");return r.on(o,i)},off(o,i){if(!r)throw new Error("Wallet not enabled");return r.off(o,i)}}}async function injectMetamaskBridge(t){if(t.hasOwnProperty("starknet_metamask"))return;const e=wallets.find(n=>n.id==="metamask");if(!e)return;const r=await detectMetamaskSupport(t);!r||(t.starknet_metamask=createMetaMaskProviderWrapper(e,r))}function scanObjectForWallets(t,e){return Object.values(Object.getOwnPropertyNames(t).reduce((r,n)=>{if(n.startsWith("starknet")){const o=t[n];e(o)&&!r[o.id]&&(r[o.id]=o)}return r},{}))}const sortBy=(t,e)=>{if(e&&Array.isArray(e)){t.sort((n,o)=>e.indexOf(n.id)-e.indexOf(o.id));const r=t.length-e.length;return[...t.slice(r),...shuffle(t.slice(0,r))]}else return shuffle(t)},defaultOptions={windowObject:ssrSafeWindow!=null?ssrSafeWindow:{},isWalletObject:isWalletObj,storageFactoryImplementation:t=>new LocalStorageWrapper(t)};function getStarknet(t={}){const{storageFactoryImplementation:e,windowObject:r,isWalletObject:n}={...defaultOptions,...t},o=e("gsw-last");return injectMetamaskBridge(r),{getAvailableWallets:async(i={})=>{const s=scanObjectForWallets(r,n);return pipe$1(a=>filterBy(a,i),a=>sortBy(a,i.sort))(s)},getPreAuthorizedWallets:async(i={})=>{const s=scanObjectForWallets(r,n);return pipe$1(a=>filterByPreAuthorized(a),a=>filterBy(a,i),a=>sortBy(a,i.sort))(s)},getDiscoveryWallets:async(i={})=>pipe$1(s=>filterBy(s,i),s=>sortBy(s,i.sort))(wallets),getLastConnectedWallet:async()=>{const i=o.get(),s=scanObjectForWallets(r,n).find(c=>c.id===i),[a]=await filterByPreAuthorized(s?[s]:[]);return a||(o.delete(),null)},enable:async(i,s)=>{if(await i.enable(s!=null?s:{starknetVersion:"v5"}),!i.isConnected)throw new Error("Failed to connect to wallet");return o.set(i.id),i},disconnect:async({clearLastWallet:i}={})=>{i&&o.delete()}}}const main=getStarknet();function getBrowserStoreVersionFromBrowser(){var e;switch((e=Bowser.getParser(ssrSafeWindow==null?void 0:ssrSafeWindow.navigator.userAgent).getBrowserName())==null?void 0:e.toLowerCase()){case"firefox":return"firefox";case"microsoft edge":return"edge";case"android browser":case"chrome":case"chromium":case"electron":case"opera":case"vivaldi":return"chrome";case"safari":return"safari";default:return null}}function getOperatingSystemStoreVersionFromBrowser(){var e,r,n;const t=(n=(r=(e=Bowser.getParser(ssrSafeWindow==null?void 0:ssrSafeWindow.navigator.userAgent).getOS())==null?void 0:e.name)==null?void 0:r.toLowerCase())!=null?n:null;switch(t){case"ios":case"android":return t;default:return null}}const enableWithVersion=async t=>t?main.enable(t,{starknetVersion:"v5"}).catch(()=>null):null,connect=async({modalMode:t="canAsk",storeVersion:e=getBrowserStoreVersionFromBrowser(),osVersion:r=getOperatingSystemStoreVersionFromBrowser(),modalTheme:n,...o}={})=>{var u,d;const i=await main.getPreAuthorizedWallets({...o}),s=await main.getLastConnectedWallet();if(t==="neverAsk"){const m=(u=i.find(p=>p.id===(s==null?void 0:s.id)))!=null?u:i[0];return enableWithVersion(m)}const a=await main.getAvailableWallets(o);if(t==="canAsk"&&s){const m=(d=i.find(p=>p.id===(s==null?void 0:s.id)))!=null?d:a.length===1?a[0]:void 0;if(m)return enableWithVersion(m)}const l=(await main.getDiscoveryWallets(o)).reduce((m,p)=>{const h=p.downloads[r]||p.downloads[e];if(h){const y=Object.keys(p.downloads).find(_=>p.downloads[_]===h),g=y==="android"||y==="ios"?`${p.name} Mobile`:`Install ${p.name}`;m.push({...p,name:g,download:h})}return m},[]);return show({lastWallet:s,preAuthorizedWallets:i,installedWallets:a,discoveryWallets:l,enable:enableWithVersion,modalOptions:{theme:n}})};function disconnect(t={}){return main.disconnect(t)}exports.connect=connect,exports.disconnect=disconnect,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});