Files
to_session/web_process/MetaMask 12.16.1/background-6.js
Administrator a0720d80dc fefdwef
2025-11-12 12:54:37 +08:00

1535 lines
361 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

LavaPack.loadBundle([[596,{"@firebase/component":597,"@firebase/logger":599,"@firebase/util":602,idb:4642},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"FirebaseError",{enumerable:!0,get:function(){return s.FirebaseError}}),r._DEFAULT_ENTRY_NAME=r.SDK_VERSION=void 0,r._addComponent=y,r._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},r._apps=void 0,r._clearComponents=function(){g.clear()}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r._components=void 0,r._getProvider=b,r._isFirebaseApp=v,r._isFirebaseServerApp=function(e){return e.settings!==undefined},r._registerComponent=m,r._removeServiceInstance=function(e,t,r=h){b(e,t).clearInstance(r)},r._serverApps=void 0,r.deleteApp=C,r.getApp=function(e=h){const t=f.get(e);if(!t&&e===h&&(0,s.getDefaultAppConfig)())return _();if(!t)throw T.create("no-app",{appName:e});return t},r.getApps=function(){return Array.from(f.values())},r.initializeApp=_,r.initializeServerApp=function(e,t){if((0,s.isBrowser)()&&!(0,s.isWebWorker)())throw T.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let r;r=v(e)?e.options:e;const i=Object.assign(Object.assign({},t),r);i.releaseOnDeref!==undefined&&delete i.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw T.create("finalization-registry-not-supported",{});const o=""+(c=JSON.stringify(i),[...c].reduce(((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0),0)),a=l.get(o);var c;if(a)return a.incRefCount(t.releaseOnDeref),a;const u=new n.ComponentContainer(o);for(const e of g.values())u.addComponent(e);const d=new I(r,t,o,u);return l.set(o,d),d},r.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw T.create("invalid-log-argument");(0,i.setUserLogHandler)(e,t)},r.registerVersion=E,r.setLogLevel=function(e){(0,i.setLogLevel)(e)}
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/;var n=e("@firebase/component"),i=e("@firebase/logger"),s=e("@firebase/util"),o=e("idb");
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class a{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const c="@firebase/app",u="0.10.18",d=new i.Logger("@firebase/app"),h=r._DEFAULT_ENTRY_NAME="[DEFAULT]",p={[c]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/vertexai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},f=r._apps=new Map,l=r._serverApps=new Map,g=r._components=new Map;function y(e,t){try{e.container.addComponent(t)}catch(r){d.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function m(e){const t=e.name;if(g.has(t))return d.debug(`There were multiple attempts to register component ${t}.`),!1;g.set(t,e);for(const t of f.values())y(t,e);for(const t of l.values())y(t,e);return!0}function b(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function v(e){return e.options!==undefined}const k={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},T=new s.ErrorFactory("app","Firebase",k);
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class w{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new n.Component("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw T.create("app-deleted",{appName:this._name})}}
/**
* @license
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class I extends w{constructor(e,t,r,n){const i=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,s={name:r,automaticDataCollectionEnabled:i};if(e.apiKey!==undefined)super(e,s,n);else{super(e.options,s,n)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:i},t),this._finalizationRegistry=null,"undefined"!=typeof FinalizationRegistry&&(this._finalizationRegistry=new FinalizationRegistry((()=>{this.automaticCleanup()}))),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=undefined,t.releaseOnDeref=undefined,E(c,u,"serverapp")}toJSON(){return undefined}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==undefined&&null!==this._finalizationRegistry&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){C(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw T.create("server-app-deleted")}}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/r.SDK_VERSION="11.2.0";function _(e,t={}){let r=e;if("object"!=typeof t){t={name:t}}const i=Object.assign({name:h,automaticDataCollectionEnabled:!1},t),o=i.name;if("string"!=typeof o||!o)throw T.create("bad-app-name",{appName:String(o)});if(r||(r=(0,s.getDefaultAppConfig)()),!r)throw T.create("no-options");const a=f.get(o);if(a){if((0,s.deepEqual)(r,a.options)&&(0,s.deepEqual)(i,a.config))return a;throw T.create("duplicate-app",{appName:o})}const c=new n.ComponentContainer(o);for(const e of g.values())c.addComponent(e);const u=new w(r,i,c);return f.set(o,u),u}async function C(e){let t=!1;const r=e.name;if(f.has(r))t=!0,f.delete(r);else if(l.has(r)){e.decRefCount()<=0&&(l.delete(r),t=!0)}t&&(await Promise.all(e.container.getProviders().map((e=>e.delete()))),e.isDeleted=!0)}function E(e,t,r){var i;let s=null!==(i=p[e])&&void 0!==i?i:e;r&&(s+=`-${r}`);const o=s.match(/\s|\//),a=t.match(/\s|\//);if(o||a){const e=[`Unable to register library "${s}" with version "${t}":`];return o&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),o&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void d.warn(e.join(" "))}m(new n.Component(`${s}-version`,(()=>({library:s,version:t})),"VERSION"))}const D="firebase-heartbeat-database",S=1,A="firebase-heartbeat-store";let R=null;function P(){return R||(R=(0,o.openDB)(D,S,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(A)}catch(e){console.warn(e)}}}).catch((e=>{throw T.create("idb-open",{originalErrorMessage:e.message})}))),R}async function x(e,t){try{const r=(await P()).transaction(A,"readwrite"),n=r.objectStore(A);await n.put(t,O(e)),await r.done}catch(e){if(e instanceof s.FirebaseError)d.warn(e.message);else{const t=T.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}function O(e){return`${e.name}!${e.options.appId}`}
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class M{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new K(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=B();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some((e=>e.date===n)))return;return this._heartbeatsCache.heartbeats.push({date:n,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(e){d.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=B(),{heartbeatsToSend:r,unsentEntries:n}=function(e,t=1024){const r=[];let n=e.slice();for(const i of e){const e=r.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),q(r)>t){e.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),q(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),i=(0,s.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return d.warn(e),""}}}function B(){return(new Date).toISOString().substring(0,10)}class K{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,s.isIndexedDBAvailable)()&&(0,s.validateIndexedDBOpenable)().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await P()).transaction(A),r=await t.objectStore(A).get(O(e));return await t.done,r}catch(e){if(e instanceof s.FirebaseError)d.warn(e.message);else{const t=T.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return x(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return x(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function q(e){return(0,s.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:e})).length}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var j;j="",m(new n.Component("platform-logger",(e=>new a(e)),"PRIVATE")),m(new n.Component("heartbeat",(e=>new M(e)),"PRIVATE")),E(c,u,j),E(c,u,"esm2017"),E("fire-js","")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app",file:"node_modules/@firebase/app/dist/esm/index.esm2017.js"}],[597,{"@firebase/util":602},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Provider=r.ComponentContainer=r.Component=void 0;var n=e("@firebase/util");
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
r.Component=class{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};const i="[DEFAULT]";
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class s{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new n.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(r)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:r})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(e))try{this.getOrInitializeService({instanceIdentifier:i})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e=i){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e=i){return this.instances.has(e)}getOptions(e=i){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[e,t]of this.instancesDeferred.entries()){r===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var r;const n=this.normalizeInstanceIdentifier(t),i=null!==(r=this.onInitCallbacks.get(n))&&void 0!==r?r:new Set;i.add(e),this.onInitCallbacks.set(n,i);const s=this.instances.get(n);return s&&e(s,n),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const n of r)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===i?undefined:n),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}var n;return r||null}normalizeInstanceIdentifier(e=i){return this.component?this.component.multipleInstances?e:i:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}r.Provider=s;r.ComponentContainer=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new s(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/component",file:"node_modules/@firebase/component/dist/esm/index.esm2017.js"}],[598,{"@firebase/app":596,"@firebase/component":597,"@firebase/util":602,idb:4642},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.deleteInstallations=
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
async function(e){const{appConfig:t}=e,r=await U(t,(e=>e&&0===e.registrationStatus?undefined:e));if(r){if(1===r.registrationStatus)throw g.create("delete-pending-registration");if(2===r.registrationStatus){if(!navigator.onLine)throw g.create("app-offline");
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
await async function(e,t){const r=function(e,{fid:t}){return`${m(e)}/${t}`}(e,t),n=T(e,t),i={method:"DELETE",headers:n},s=await w((()=>fetch(r,i)));if(!s.ok)throw await v("Delete Installation",s)}(t,r),await L(t)}}}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.getId=Q,r.getInstallations=
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function(e=(0,n.getApp)()){return(0,n._getProvider)(e,"installations").getImmediate()}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.getToken=J,r.onIdChange=function(e,t){const{appConfig:r}=e;return function(e,t){x();const r=D(e);let n=S.get(r);n||(n=new Set,S.set(r,n));n.add(t)}(r,t),()=>{!function(e,t){const r=D(e),n=S.get(r);if(!n)return;n.delete(t),0===n.size&&S.delete(r);O()}(r,t)}};var n=e("@firebase/app"),i=e("@firebase/component"),s=e("@firebase/util"),o=e("idb");const a="@firebase/installations",c="0.6.12",u=1e4,d=`w:${c}`,h="FIS_v2",p="https://firebaseinstallations.googleapis.com/v1",f=36e5,l={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},g=new s.ErrorFactory("installations","Installations",l);function y(e){return e instanceof s.FirebaseError&&e.code.includes("request-failed")}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function m({projectId:e}){return`${p}/projects/${e}/installations`}function b(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function v(e,t){const r=(await t.json()).error;return g.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function k({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function T(e,{refreshToken:t}){const r=k(e);return r.append("Authorization",function(e){return`${h} ${e}`}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(t)),r}async function w(e){const t=await e();return t.status>=500&&t.status<600?e():t}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function I(e){return new Promise((t=>{setTimeout(t,e)}))}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const _=/^[cdef][\w-]{21}$/,C="";function E(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(r=e,btoa(String.fromCharCode(...r)).replace(/\+/g,"-").replace(/\//g,"_"));var r;return t.substr(0,22)}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(e);return _.test(t)?t:C}catch(e){return C}}function D(e){return`${e.appName}!${e.appId}`}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const S=new Map;function A(e,t){const r=D(e);R(r,t),function(e,t){const r=x();r&&r.postMessage({key:e,fid:t});O()}(r,t)}function R(e,t){const r=S.get(e);if(r)for(const e of r)e(t)}let P=null;function x(){return!P&&"BroadcastChannel"in self&&(P=new BroadcastChannel("[Firebase] FID Change"),P.onmessage=e=>{R(e.data.key,e.data.fid)}),P}function O(){0===S.size&&P&&(P.close(),P=null)}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const M="firebase-installations-database",B=1,K="firebase-installations-store";let q=null;function j(){return q||(q=(0,o.openDB)(M,B,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(K)}})),q}async function N(e,t){const r=D(e),n=(await j()).transaction(K,"readwrite"),i=n.objectStore(K),s=await i.get(r);return await i.put(t,r),await n.done,s&&s.fid===t.fid||A(e,t.fid),t}async function L(e){const t=D(e),r=(await j()).transaction(K,"readwrite");await r.objectStore(K).delete(t),await r.done}async function U(e,t){const r=D(e),n=(await j()).transaction(K,"readwrite"),i=n.objectStore(K),s=await i.get(r),o=t(s);return o===undefined?await i.delete(r):await i.put(o,r),await n.done,!o||s&&s.fid===o.fid||A(e,o.fid),o}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function H(e){let t;const r=await U(e.appConfig,(r=>{const n=function(e){const t=e||{fid:E(),registrationStatus:0};return W(t)}(r),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(g.create("app-offline"))}}const r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(e,t){try{const r=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:r}){const n=m(e),i=k(e),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={fid:r,authVersion:h,appId:e.appId,sdkVersion:d},a={method:"POST",headers:i,body:JSON.stringify(o)},c=await w((()=>fetch(n,a)));if(c.ok){const e=await c.json();return{fid:e.fid||r,registrationStatus:2,refreshToken:e.refreshToken,authToken:b(e.authToken)}}throw await v("Create Installation",c)}(e,t);return N(e.appConfig,r)}catch(r){throw y(r)&&409===r.customData.serverCode?await L(e.appConfig):await N(e.appConfig,{fid:t.fid,registrationStatus:0}),r}}(e,r);return{installationEntry:r,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:F(e)}:{installationEntry:t}}(e,n);return t=i.registrationPromise,i.installationEntry}));return r.fid===C?{installationEntry:await t}:{installationEntry:r,registrationPromise:t}}async function F(e){let t=await $(e.appConfig);for(;1===t.registrationStatus;)await I(100),t=await $(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:r}=await H(e);return r||t}return t}function $(e){return U(e,(e=>{if(!e)throw g.create("installation-not-found");return W(e)}))}function W(e){return 1===(t=e).registrationStatus&&t.registrationTime+u<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t;
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/}async function z({appConfig:e,heartbeatServiceProvider:t},r){const n=function(e,{fid:t}){return`${m(e)}/${t}/authTokens:generate`}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(e,r),i=T(e,r),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={installation:{sdkVersion:d,appId:e.appId}},a={method:"POST",headers:i,body:JSON.stringify(o)},c=await w((()=>fetch(n,a)));if(c.ok){return b(await c.json())}throw await v("Generate Auth Token",c)}async function Y(e,t=!1){let r;const n=await U(e.appConfig,(n=>{if(!G(n))throw g.create("not-registered");const i=n.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+f}(e)}(i))return n;if(1===i.requestStatus)return r=async function(e,t){let r=await V(e.appConfig);for(;1===r.authToken.requestStatus;)await I(100),r=await V(e.appConfig);const n=r.authToken;return 0===n.requestStatus?Y(e,t):n}(e,t),n;{if(!navigator.onLine)throw g.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(n);return r=async function(e,t){try{const r=await z(e,t),n=Object.assign(Object.assign({},t),{authToken:r});return await N(e.appConfig,n),r}catch(r){if(!y(r)||401!==r.customData.serverCode&&404!==r.customData.serverCode){const r=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await N(e.appConfig,r)}else await L(e.appConfig);throw r}}(e,t),t}}));return r?await r:n.authToken}function V(e){return U(e,(e=>{if(!G(e))throw g.create("not-registered");const t=e.authToken;return 1===(r=t).requestStatus&&r.requestTime+u<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var r;
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/}))}function G(e){return e!==undefined&&2===e.registrationStatus}async function Q(e){const t=e,{installationEntry:r,registrationPromise:n}=await H(t);return n?n.catch(console.error):Y(t).catch(console.error),r.fid}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function J(e,t=!1){const r=e;await async function(e){const{registrationPromise:t}=await H(e);t&&await t}(r);return(await Y(r,t)).token}function X(e){return g.create("missing-app-config-values",{valueName:e})}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Z="installations",ee=e=>{const t=e.getProvider("app").getImmediate(),r=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const r of t)if(!e.options[r])throw X(r);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:r,heartbeatServiceProvider:(0,n._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),r=(0,n._getProvider)(t,Z).getImmediate();return{getId:()=>Q(r),getToken:e=>J(r,e)}};(0,n._registerComponent)(new i.Component(Z,ee,"PUBLIC")),(0,n._registerComponent)(new i.Component("installations-internal",te,"PRIVATE")),(0,n.registerVersion)(a,c),(0,n.registerVersion)(a,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],[599,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const n=[];var i;r.LogLevel=void 0,(i=r.LogLevel||(r.LogLevel={}))[i.DEBUG=0]="DEBUG",i[i.VERBOSE=1]="VERBOSE",i[i.INFO=2]="INFO",i[i.WARN=3]="WARN",i[i.ERROR=4]="ERROR",i[i.SILENT=5]="SILENT";const s={debug:r.LogLevel.DEBUG,verbose:r.LogLevel.VERBOSE,info:r.LogLevel.INFO,warn:r.LogLevel.WARN,error:r.LogLevel.ERROR,silent:r.LogLevel.SILENT},o=r.LogLevel.INFO,a={[r.LogLevel.DEBUG]:"log",[r.LogLevel.VERBOSE]:"log",[r.LogLevel.INFO]:"info",[r.LogLevel.WARN]:"warn",[r.LogLevel.ERROR]:"error"},c=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),i=a[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)};r.Logger=class{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null,n.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in r.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?s[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,r.LogLevel.DEBUG,...e),this._logHandler(this,r.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,r.LogLevel.VERBOSE,...e),this._logHandler(this,r.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,r.LogLevel.INFO,...e),this._logHandler(this,r.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,r.LogLevel.WARN,...e),this._logHandler(this,r.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,r.LogLevel.ERROR,...e),this._logHandler(this,r.LogLevel.ERROR,...e)}},r.setLogLevel=function(e){n.forEach((t=>{t.setLogLevel(e)}))},r.setUserLogHandler=function(e,t){for(const i of n){let n=null;t&&t.level&&(n=s[t.level]),i.userLogHandler=null===e?null:(t,i,...s)=>{const o=s.map((e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}})).filter((e=>e)).join(" ");i>=(null!=n?n:t.logLevel)&&e({level:r.LogLevel[i].toLowerCase(),message:o,args:s,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],[6,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.COOKIE_ID_MARKETING_WHITELIST_ORIGINS=r.COOKIE_ID_MARKETING_WHITELIST=void 0;const n=r.COOKIE_ID_MARKETING_WHITELIST=["https://metamask.io","https://learn.metamask.io","https://mmi-support.zendesk.com","https://community.metamask.io","https://support.metamask.io"];r.COOKIE_ID_MARKETING_WHITELIST_ORIGINS=n.map((e=>new URL(e).origin))}}},{package:"$root$",file:"app/scripts/constants/marketing-site-whitelist.ts"}],[60,{"../../../../shared/constants/bridge":5720},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.REFRESH_INTERVAL_MS=r.DEFAULT_BRIDGE_STATUS_STATE=r.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=r.BRIDGE_STATUS_CONTROLLER_NAME=r.BRIDGE_STATUS_BASE_URL=void 0;var n=e("../../../../shared/constants/bridge");r.REFRESH_INTERVAL_MS=1e4,r.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController";const i=r.DEFAULT_BRIDGE_STATUS_STATE={txHistory:{}};r.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={bridgeStatusState:{...i}},r.BRIDGE_STATUS_BASE_URL=`${n.BRIDGE_API_BASE_URL}/getTxStatus`}}},{package:"$root$",file:"app/scripts/controllers/bridge-status/constants.ts"}],[600,{"@firebase/app":596,"@firebase/component":597,"@firebase/installations":598,"@firebase/util":602,idb:4642},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.deleteToken=function(e){
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
return async function(e){if(!navigator)throw P.create("only-available-in-window");e.swRegistration||await H(e);return async function(e){const t=await D(e.firebaseDependencies);t&&(await x(e.firebaseDependencies,t.token),await async function(e){const t=A(e),r=(await E()).transaction(_,"readwrite");await r.objectStore(_).delete(t),await r.done}(e.firebaseDependencies));const r=await e.swRegistration.pushManager.getSubscription();if(r)return r.unsubscribe();return!0}(e)}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(e=(0,s.getModularInstance)(e))},r.getMessaging=
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function(e=(0,o.getApp)()){return Q().then((e=>{if(!e)throw P.create("unsupported-browser")}),(e=>{throw P.create("indexed-db-unsupported")})),(0,o._getProvider)((0,s.getModularInstance)(e),"messaging").getImmediate()},r.getToken=async function(e,t){return F(e=(0,s.getModularInstance)(e),t)},r.isSupported=Q,r.onMessage=function(e,t){return function(e,t){if(!navigator)throw P.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,s.getModularInstance)(e),t)},e("@firebase/installations");var n=e("@firebase/component"),i=e("idb"),s=e("@firebase/util"),o=e("@firebase/app");
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const a="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",u="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",d="https://fcmregistrations.googleapis.com/v1",h="google.c.a.c_id",p="google.c.a.c_l",f="google.c.a.ts",l=1e4;var g,y;
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function m(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function b(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;++e)n[e]=r.charCodeAt(e);return n}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(g||(g={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(y||(y={}));const v="fcm_token_details_db",k=5,T="fcm_token_object_Store";
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const w="firebase-messaging-database",I=1,_="firebase-messaging-store";let C=null;function E(){return C||(C=(0,i.openDB)(w,I,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(_)}})),C}async function D(e){const t=A(e),r=await E(),n=await r.transaction(_).objectStore(_).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes(v))return null}let t=null;return(await(0,i.openDB)(v,k,{upgrade:async(r,n,i,s)=>{var o;if(n<2)return;if(!r.objectStoreNames.contains(T))return;const a=s.objectStore(T),c=await a.index("fcmSenderId").get(e);if(await a.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:m(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}}})).close(),await(0,i.deleteDB)(v),await(0,i.deleteDB)("fcm_vapid_details_db"),await(0,i.deleteDB)("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await S(e,t),t}}async function S(e,t){const r=A(e),n=(await E()).transaction(_,"readwrite");return await n.objectStore(_).put(t,r),await n.done,t}function A({appConfig:e}){return e.appId}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const R={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},P=new s.ErrorFactory("messaging","Messaging",R);async function x(e,t){const r={method:"DELETE",headers:await M(e)};try{const n=await fetch(`${O(e.appConfig)}/${t}`,r),i=await n.json();if(i.error){const e=i.error.message;throw P.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw P.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function O({projectId:e}){return`${d}/projects/${e}/registrations`}async function M({appConfig:e,installations:t}){const r=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${r}`})}function B({p256dh:e,auth:t,endpoint:r,vapidKey:n}){const i={web:{endpoint:r,auth:t,p256dh:e}};return n!==u&&(i.web.applicationPubKey=n),i}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const K=6048e5;async function q(e){const t=await async function(e,t){const r=await e.pushManager.getSubscription();if(r)return r;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:b(t)})}(e.swRegistration,e.vapidKey),r={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:m(t.getKey("auth")),p256dh:m(t.getKey("p256dh"))},n=await D(e.firebaseDependencies);if(n){if(function(e,t){const r=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,i=t.auth===e.auth,s=t.p256dh===e.p256dh;return r&&n&&i&&s}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(n.subscriptionOptions,r))return Date.now()>=n.createTime+K?async function(e,t){try{const r=await async function(e,t){const r=await M(e),n=B(t.subscriptionOptions),i={method:"PATCH",headers:r,body:JSON.stringify(n)};let s;try{const r=await fetch(`${O(e.appConfig)}/${t.token}`,i);s=await r.json()}catch(e){throw P.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(s.error){const e=s.error.message;throw P.create("token-update-failed",{errorInfo:e})}if(!s.token)throw P.create("token-update-no-token");return s.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:r,createTime:Date.now()});return await S(e.firebaseDependencies,n),r}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:r}):n.token;try{await x(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return j(e.firebaseDependencies,r)}return j(e.firebaseDependencies,r)}async function j(e,t){const r=
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/await async function(e,t){const r=await M(e),n=B(t),i={method:"POST",headers:r,body:JSON.stringify(n)};let s;try{const t=await fetch(O(e.appConfig),i);s=await t.json()}catch(e){throw P.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(s.error){const e=s.error.message;throw P.create("token-subscribe-failed",{errorInfo:e})}if(!s.token)throw P.create("token-subscribe-no-token");return s.token}(e,t),n={token:r,createTime:Date.now(),subscriptionOptions:t};return await S(e,n),n.token}function N(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const r=t.notification.title;r&&(e.notification.title=r);const n=t.notification.body;n&&(e.notification.body=n);const i=t.notification.image;i&&(e.notification.image=i);const s=t.notification.icon;s&&(e.notification.icon=s)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var r,n,i,s,o;if(!t.fcmOptions&&!(null===(r=t.notification)||void 0===r?void 0:r.click_action))return;e.fcmOptions={};const a=null!==(i=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==i?i:null===(s=t.notification)||void 0===s?void 0:s.click_action;a&&(e.fcmOptions.link=a);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(t,e),t}function L(e){return P.create("missing-app-config-values",{valueName:e})}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(e,t){const r=[];for(let n=0;n<e.length;n++)r.push(e.charAt(n)),n<t.length&&r.push(t.charAt(n));r.join("")}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class U{constructor(e,t,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw L("App Configuration Object");if(!e.name)throw L("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:r}=e;for(const e of t)if(!r[e])throw L(e);return{appName:e.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:r}}_delete(){return Promise.resolve()}}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function H(e){try{e.swRegistration=await navigator.serviceWorker.register(a,{scope:c}),e.swRegistration.update().catch((()=>{})),await async function(e){return new Promise(((t,r)=>{const n=setTimeout((()=>r(new Error(`Service worker not registered after ${l} ms`))),l),i=e.installing||e.waiting;e.active?(clearTimeout(n),t()):i?i.onstatechange=e=>{var r;"activated"===(null===(r=e.target)||void 0===r?void 0:r.state)&&(i.onstatechange=null,clearTimeout(n),t())}:(clearTimeout(n),r(new Error("No incoming service worker found.")))}))}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(e.swRegistration)}catch(e){throw P.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
async function F(e,t){if(!navigator)throw P.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw P.create("permission-blocked");
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=u)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await H(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw P.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),q(e)}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function $(e,t,r){const n=function(e){switch(e){case y.NOTIFICATION_CLICKED:return"notification_open";case y.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(n,{message_id:r[h],message_name:r[p],message_time:r[f],message_device_time:Math.floor(Date.now()/1e3)})}async function W(e,t){const r=t.data;if(!r.isFirebaseMessaging)return;e.onMessageHandler&&r.messageType===y.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(N(r)):e.onMessageHandler.next(N(r)));const n=r.data;var i;"object"==typeof(i=n)&&i&&h in i&&"1"===n["google.c.a.e"]&&await $(e,r.messageType,n)}const z="@firebase/messaging",Y="0.12.16",V=e=>{const t=new U(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",(e=>W(t,e))),t},G=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>F(t,e)}};
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
async function Q(){try{await(0,s.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,s.isIndexedDBAvailable)()&&(0,s.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,o._registerComponent)(new n.Component("messaging",V,"PUBLIC")),(0,o._registerComponent)(new n.Component("messaging-internal",G,"PRIVATE")),(0,o.registerVersion)(z,Y),(0,o.registerVersion)(z,Y,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],[601,{"@firebase/app":596,"@firebase/component":597,"@firebase/installations":598,"@firebase/util":602,idb:4642},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),e("@firebase/installations");var n=e("@firebase/component"),i=e("idb"),s=e("@firebase/util"),o=e("@firebase/app");
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const a="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="https://fcmregistrations.googleapis.com/v1",u="FCM_MSG",d="google.c.a.c_id",h=3,p=1;var f,l;
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function g(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function y(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;++e)n[e]=r.charCodeAt(e);return n}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(f||(f={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(l||(l={}));const m="fcm_token_details_db",b=5,v="fcm_token_object_Store";
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const k="firebase-messaging-database",T=1,w="firebase-messaging-store";let I=null;function _(){return I||(I=i.openDB(k,T,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(w)}})),I}async function C(e){const t=D(e),r=await _(),n=await r.transaction(w).objectStore(w).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes(m))return null}let t=null;return(await i.openDB(m,b,{upgrade:async(r,n,i,s)=>{var o;if(n<2)return;if(!r.objectStoreNames.contains(v))return;const a=s.objectStore(v),c=await a.index("fcmSenderId").get(e);if(await a.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:g(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:g(e.auth),p256dh:g(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:g(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:g(e.auth),p256dh:g(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:g(e.vapidKey)}}}}})).close(),await i.deleteDB(m),await i.deleteDB("fcm_vapid_details_db"),await i.deleteDB("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await E(e,t),t}}async function E(e,t){const r=D(e),n=(await _()).transaction(w,"readwrite");return await n.objectStore(w).put(t,r),await n.done,t}function D({appConfig:e}){return e.appId}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const S={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},A=new s.ErrorFactory("messaging","Messaging",S);async function R(e,t){const r={method:"DELETE",headers:await x(e)};try{const n=await fetch(`${P(e.appConfig)}/${t}`,r),i=await n.json();if(i.error){const e=i.error.message;throw A.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw A.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function P({projectId:e}){return`${c}/projects/${e}/registrations`}async function x({appConfig:e,installations:t}){const r=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${r}`})}function O({p256dh:e,auth:t,endpoint:r,vapidKey:n}){const i={web:{endpoint:r,auth:t,p256dh:e}};return n!==a&&(i.web.applicationPubKey=n),i}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const M=6048e5;async function B(e){const t=await async function(e,t){const r=await e.pushManager.getSubscription();if(r)return r;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:y(t)})}(e.swRegistration,e.vapidKey),r={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:g(t.getKey("auth")),p256dh:g(t.getKey("p256dh"))},n=await C(e.firebaseDependencies);if(n){if(function(e,t){const r=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,i=t.auth===e.auth,s=t.p256dh===e.p256dh;return r&&n&&i&&s}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(n.subscriptionOptions,r))return Date.now()>=n.createTime+M?async function(e,t){try{const r=await async function(e,t){const r=await x(e),n=O(t.subscriptionOptions),i={method:"PATCH",headers:r,body:JSON.stringify(n)};let s;try{const r=await fetch(`${P(e.appConfig)}/${t.token}`,i);s=await r.json()}catch(e){throw A.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(s.error){const e=s.error.message;throw A.create("token-update-failed",{errorInfo:e})}if(!s.token)throw A.create("token-update-no-token");return s.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:r,createTime:Date.now()});return await E(e.firebaseDependencies,n),r}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:r}):n.token;try{await R(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return q(e.firebaseDependencies,r)}return q(e.firebaseDependencies,r)}async function K(e){const t=await C(e.firebaseDependencies);t&&(await R(e.firebaseDependencies,t.token),await async function(e){const t=D(e),r=(await _()).transaction(w,"readwrite");await r.objectStore(w).delete(t),await r.done}(e.firebaseDependencies));const r=await e.swRegistration.pushManager.getSubscription();return!r||r.unsubscribe()}async function q(e,t){const r=
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/await async function(e,t){const r=await x(e),n=O(t),i={method:"POST",headers:r,body:JSON.stringify(n)};let s;try{const t=await fetch(P(e.appConfig),i);s=await t.json()}catch(e){throw A.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(s.error){const e=s.error.message;throw A.create("token-subscribe-failed",{errorInfo:e})}if(!s.token)throw A.create("token-subscribe-no-token");return s.token}(e,t),n={token:r,createTime:Date.now(),subscriptionOptions:t};return await E(e,n),n.token}async function j(e,t){const r=function(e,t){var r,n;const i={};e.from&&(i.project_number=e.from);e.fcmMessageId&&(i.message_id=e.fcmMessageId);i.instance_id=t,e.notification?i.message_type=f.DISPLAY_NOTIFICATION.toString():i.message_type=f.DATA_MESSAGE.toString();i.sdk_platform=h.toString(),i.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(i.collapse_key=e.collapse_key);i.event=p.toString(),!(null===(r=e.fcmOptions)||void 0===r?void 0:r.analytics_label)||(i.analytics_label=null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label);return i}(t,await e.firebaseDependencies.installations.getId());!function(e,t,r){const n={};n.event_time_ms=Math.floor(Date.now()).toString(),n.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!r||(n.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(r));e.logEvents.push(n)}(e,r,t.productId)}async function N(e,t){const r=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!r)return;t.deliveryMetricsExportedToBigQueryEnabled&&await j(t,r);const n=await U();if(function(e){return e.some((e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://")))}(n))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=l.PUSH_RECEIVED;for(const r of e)r.postMessage(t)}(n,r);if(r.notification&&await function(e){var t;const{actions:r}=e,{maxActions:n}=Notification;r&&n&&r.length>n&&console.warn(`This browser only supports ${n} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={[u]:e},t}(r)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const r=t.notification.title;r&&(e.notification.title=r);const n=t.notification.body;n&&(e.notification.body=n);const i=t.notification.image;i&&(e.notification.image=i);const s=t.notification.icon;s&&(e.notification.icon=s)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var r,n,i,s,o;if(!t.fcmOptions&&!(null===(r=t.notification)||void 0===r?void 0:r.click_action))return;e.fcmOptions={};const a=null!==(i=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==i?i:null===(s=t.notification)||void 0===s?void 0:s.click_action;a&&(e.fcmOptions.link=a);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(t,e),t}(r);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function L(e){var t,r;const n=null===(r=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===r?void 0:r[u];if(!n)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const i=function(e){var t,r,n;const i=null!==(r=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==r?r:null===(n=e.notification)||void 0===n?void 0:n.click_action;if(i)return i;return s=e.data,"object"==typeof s&&s&&d in s?self.location.origin:null;var s;
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(n);if(!i)return;const s=new URL(i,self.location.href),o=new URL(self.location.origin);if(s.host!==o.host)return;let a=await async function(e){const t=await U();for(const r of t){const t=new URL(r.url,self.location.href);if(e.host===t.host)return r}return null}(s);var c;
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/return a?a=await a.focus():(a=await self.clients.openWindow(i),await(c=3e3,new Promise((e=>{setTimeout(e,c)})))),a?(n.messageType=l.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,a.postMessage(n)):void 0}function U(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function H(e){return A.create("missing-app-config-values",{valueName:e})}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/!function(e,t){const r=[];for(let n=0;n<e.length;n++)r.push(e.charAt(n)),n<t.length&&r.push(t.charAt(n));r.join("")}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class F{constructor(e,t,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw H("App Configuration Object");if(!e.name)throw H("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:r}=e;for(const e of t)if(!r[e])throw H(e);return{appName:e.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:r}}_delete(){return Promise.resolve()}}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const $=e=>{const t=new F(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",(e=>{e.waitUntil(N(e,t))})),self.addEventListener("pushsubscriptionchange",(e=>{e.waitUntil(async function(e,t){var r,n;const{newSubscription:i}=e;if(!i)return void await K(t);const s=await C(t.firebaseDependencies);await K(t),t.vapidKey=null!==(n=null===(r=null==s?void 0:s.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==n?n:a,await B(t)}(e,t))})),self.addEventListener("notificationclick",(e=>{e.waitUntil(L(e))})),t};
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
async function W(){return s.isIndexedDBAvailable()&&await s.validateIndexedDBOpenable()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/o._registerComponent(new n.Component("messaging-sw",$,"PUBLIC")),r.experimentalSetDeliveryMetricsExportedToBigQueryEnabled=function(e,t){
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(e=s.getModularInstance(e),t)}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.getMessaging=function(e=o.getApp()){return W().then((e=>{if(!e)throw A.create("unsupported-browser")}),(e=>{throw A.create("indexed-db-unsupported")})),o._getProvider(s.getModularInstance(e),"messaging-sw").getImmediate()},r.isSupported=W,r.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw A.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=s.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],[602,{_process:5008},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(e){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Sha1=r.RANDOM_FACTOR=r.MAX_VALUE_MILLIS=r.FirebaseError=r.ErrorFactory=r.Deferred=r.DecodeBase64StringError=r.CONSTANTS=void 0,r.areCookiesEnabled=function(){if("undefined"==typeof navigator||!navigator.cookieEnabled)return!1;return!0}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.assertionError=r.assert=void 0,r.async=function(e,t){return(...r)=>{Promise.resolve(!0).then((()=>{e(...r)})).catch((e=>{t&&t(e)}))}},r.base64urlEncodeWithoutPadding=r.base64Encode=r.base64Decode=r.base64=void 0,r.calculateBackoffMillis=function(e,t=S,r=A){const n=t*Math.pow(r,e),i=Math.round(P*n*(Math.random()-.5)*2);return Math.min(R,n+i)}
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.createMockUserToken=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const r=t||"demo-project",n=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:n,exp:n+3600,auth_time:n,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[u(JSON.stringify({alg:"none",type:"JWT"})),u(JSON.stringify(s)),""].join(".")}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.createSubscribe=function(e,t){const r=new C(e,t);return r.subscribe.bind(r)},r.decode=void 0,r.deepCopy=function(e){return h(undefined,e)},r.deepEqual=function e(t,r){if(t===r)return!0;const n=Object.keys(t),i=Object.keys(r);for(const s of n){if(!i.includes(s))return!1;const n=t[s],o=r[s];if(_(n)&&_(o)){if(!e(n,o))return!1}else if(n!==o)return!1}for(const e of i)if(!n.includes(e))return!1;return!0},r.deepExtend=h,r.errorPrefix=D,r.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const r=e.indexOf("#",t);return e.substring(t,r>0?r:undefined)}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.getExperimentalSetting=r.getDefaults=r.getDefaultEmulatorHostnameAndPort=r.getDefaultEmulatorHost=r.getDefaultAppConfig=void 0,r.getGlobal=p,r.getModularInstance=
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function(e){return e&&e._delegate?e._delegate:e},r.getUA=y,r.isAdmin=void 0,r.isBrowser=function(){return"undefined"!=typeof window||b()},r.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},r.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},r.isElectron=function(){return y().indexOf("Electron/")>=0},r.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},r.isIE=function(){const e=y();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},r.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},r.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(y())},r.isNode=m,r.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},r.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},r.isSafari=function(){return!m()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},r.isUWP=function(){return y().indexOf("MSAppHost/")>=0},r.isValidTimestamp=r.isValidFormat=void 0,r.isWebWorker=b,r.issuedAtTime=void 0,r.jsonEval=w,r.map=function(e,t,r){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=t.call(r,e[i],i,e));return n},r.ordinal=function(e){if(!Number.isFinite(e))return`${e}`;return e+function(e){e=Math.abs(e);const t=e%100;if(t>=10&&t<=20)return"th";const r=e%10;if(1===r)return"st";if(2===r)return"nd";if(3===r)return"rd";return"th"}(e)},r.promiseWithTimeout=
/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function(e,t=2e3){const r=new g;return setTimeout((()=>r.reject("timeout!")),t),e.then(r.resolve,r.reject),r.promise}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.querystring=function(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach((e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""},r.querystringDecode=function(e){const t={},r=e.replace(/^\?/,"").split("&");return r.forEach((e=>{if(e){const[r,n]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(n)}})),t},r.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},r.stringToByteArray=r.stringLength=void 0,r.stringify=function(e){return JSON.stringify(e)}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.validateArgCount=void 0,r.validateCallback=function(e,t,r,n){if(n&&!r)return;if("function"!=typeof r)throw new Error(D(e,t)+"must be a valid function.")},r.validateContextObject=function(e,t,r,n){if(n&&!r)return;if("object"!=typeof r||null===r)throw new Error(D(e,t)+"must be a valid context object.")}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,r.validateIndexedDBOpenable=function(){return new Promise(((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))},r.validateNamespace=function(e,t,r){if(r&&!t)return;if("string"!=typeof t)throw new Error(D(e,"namespace")+"must be a valid firebase namespace.")};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const t=r.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},n=function(e,t){if(!e)throw i(t)};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/r.assert=n;const i=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/r.assertionError=i;const s=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t},o=r.base64={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const i=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=i>>2,d=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,p=63&c;a||(p=64,s||(h=64)),n.push(r[u],r[d],r[h],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(s(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{const s=e[r++],o=e[r++];t[n++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const i=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0;++t;const o=t<e.length?r[e.charAt(t)]:64;++t;const c=t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==c)throw new a;const u=i<<2|s>>4;if(n.push(u),64!==o){const e=s<<4&240|o>>2;if(n.push(e),64!==c){const e=o<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class a extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}r.DecodeBase64StringError=a;const c=function(e){const t=s(e);return o.encodeByteArray(t,!0)};r.base64Encode=c;const u=function(e){return c(e).replace(/\./g,"")};r.base64urlEncodeWithoutPadding=u;const d=function(e){try{return o.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function h(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===undefined&&(e={});break;case Array:e=[];break;default:return t}for(const r in t)t.hasOwnProperty(r)&&"__proto__"!==r&&(e[r]=h(e[r],t[r]));return e}
/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function p(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}
/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/r.base64Decode=d;const f=()=>{try{return p().__FIREBASE_DEFAULTS__||(()=>{if(void 0===e||void 0===e.env)return})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&d(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};r.getDefaults=f;const l=e=>{var t,r;return null===(r=null===(t=f())||void 0===t?void 0:t.emulatorHosts)||void 0===r?void 0:r[e]};r.getDefaultEmulatorHost=l;r.getDefaultEmulatorHostnameAndPort=e=>{const t=l(e);if(!t)return undefined;const r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(r+1),10);return"["===t[0]?[t.substring(1,r-1),n]:[t.substring(0,r),n]};r.getDefaultAppConfig=()=>{var e;return null===(e=f())||void 0===e?void 0:e.config};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
r.getExperimentalSetting=e=>{var t;return null===(t=f())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,r))}}}
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function y(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function m(){var e;const t=null===(e=f())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function b(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}r.Deferred=g;class v extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,v.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,k.prototype.create)}}r.FirebaseError=v;class k{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],s=i?function(e,t){return e.replace(T,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(i,r):"Error",o=`${this.serviceName}: ${s} (${n}).`;return new v(n,o,r)}}r.ErrorFactory=k;const T=/\{\$([^}]+)}/g;
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function w(e){return JSON.parse(e)}const I=function(e){let t={},r={},n={},i="";try{const s=e.split(".");t=w(d(s[0])||""),r=w(d(s[1])||""),i=s[2],n=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:n,signature:i}};r.decode=I;r.isValidTimestamp=function(e){const t=I(e).claims,r=Math.floor((new Date).getTime()/1e3);let n=0,i=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?n=t.nbf:t.hasOwnProperty("iat")&&(n=t.iat),i=t.hasOwnProperty("exp")?t.exp:n+86400),!!r&&!!n&&!!i&&r>=n&&r<=i};r.issuedAtTime=function(e){const t=I(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};r.isValidFormat=function(e){const t=I(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function _(e){return null!==e&&"object"==typeof e}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
r.isAdmin=function(e){const t=I(e).claims;return"object"==typeof t&&!0===t.admin};r.Sha1=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const r=this.W_;if("string"==typeof e)for(let n=0;n<16;n++)r[n]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let n=0;n<16;n++)r[n]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=r[e-3]^r[e-8]^r[e-14]^r[e-16];r[e]=4294967295&(t<<1|t>>>31)}let n,i,s=this.chain_[0],o=this.chain_[1],a=this.chain_[2],c=this.chain_[3],u=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=c^o&(a^c),i=1518500249):(n=o^a^c,i=1859775393):e<60?(n=o&a|c&(o|a),i=2400959708):(n=o^a^c,i=3395469782);const t=(s<<5|s>>>27)+n+u+i+r[e]&4294967295;u=c,c=a,a=4294967295&(o<<30|o>>>2),o=s,s=t}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+u&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const r=t-this.blockSize;let n=0;const i=this.buf_;let s=this.inbuf_;for(;n<t;){if(0===s)for(;n<=r;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(i[s]=e.charCodeAt(n),++s,++n,s===this.blockSize){this.compress_(i),s=0;break}}else for(;n<t;)if(i[s]=e[n],++s,++n,s===this.blockSize){this.compress_(i),s=0;break}}this.inbuf_=s,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let r=0;for(let t=0;t<5;t++)for(let n=24;n>=0;n-=8)e[r]=this.chain_[t]>>n&255,++r;return e}};class C{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,r){let n;if(e===undefined&&t===undefined&&r===undefined)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r},n.next===undefined&&(n.next=E),n.error===undefined&&(n.error=E),n.complete===undefined&&(n.complete=E);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}})),this.observers.push(n),i}unsubscribeOne(e){this.observers!==undefined&&this.observers[e]!==undefined&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&this.onNoObservers!==undefined&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then((()=>{if(this.observers!==undefined&&this.observers[e]!==undefined)try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}}))}close(e){this.finalized||(this.finalized=!0,e!==undefined&&(this.finalError=e),this.task.then((()=>{this.observers=undefined,this.onNoObservers=undefined})))}}function E(){}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function D(e,t){return`${e} failed: ${t} argument `}r.validateArgCount=function(e,t,r,n){let i;if(n<t?i="at least "+t:n>r&&(i=0===r?"none":"no more than "+r),i){throw new Error(e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+i+".")}};r.stringToByteArray=function(e){const t=[];let r=0;for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(s>=55296&&s<=56319){const t=s-55296;i++,n(i<e.length,"Surrogate pair missing trail surrogate.");s=65536+(t<<10)+(e.charCodeAt(i)-56320)}s<128?t[r++]=s:s<2048?(t[r++]=s>>6|192,t[r++]=63&s|128):s<65536?(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=63&s|128):(t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=63&s|128)}return t};
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
r.stringLength=function(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);n<128?t++:n<2048?t+=2:n>=55296&&n<=56319?(t+=4,r++):t+=3}return t};const S=1e3,A=2,R=r.MAX_VALUE_MILLIS=144e5,P=r.RANDOM_FACTOR=.5}).call(this)}).call(this,e("_process"))}}},{package:"@metamask/notification-services-controller>firebase>@firebase/util",file:"node_modules/@firebase/util/dist/index.esm2017.js"}],[61,{"../../../../shared/lib/fetch-with-cache":5763,"./constants":60,"./validators":62,"@metamask/bridge-controller":1390},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getStatusRequestWithSrcTxHash=r.getStatusRequestDto=r.fetchBridgeTxStatus=void 0;var n,i=e("@metamask/bridge-controller"),s=(n=e("../../../../shared/lib/fetch-with-cache"))&&n.__esModule?n:{default:n},o=e("./validators"),a=e("./constants");const c={"X-Client-Id":i.BridgeClientId.EXTENSION},u=e=>{const{quote:t,...r}=e;return{...Object.fromEntries(Object.entries(r).map((([e,t])=>[e,null==t?void 0:t.toString()]))),...null!=t&&t.requestId?{requestId:t.requestId}:{}}};r.getStatusRequestDto=u;r.fetchBridgeTxStatus=async e=>{const t=u(e),r=new URLSearchParams(t),n=`${a.BRIDGE_STATUS_BASE_URL}?${r.toString()}`,i=await(0,s.default)({url:n,fetchOptions:{method:"GET",headers:c},cacheOptions:{cacheRefreshTime:0},functionName:"fetchBridgeTxStatus"});if(!(0,o.validateResponse)(o.validators,i,a.BRIDGE_STATUS_BASE_URL))throw new Error("Invalid response from bridge");return i};r.getStatusRequestWithSrcTxHash=(e,t)=>({bridgeId:e.bridgeId,srcTxHash:t,bridge:e.bridges[0],srcChainId:e.srcChainId,destChainId:e.destChainId,quote:e,refuel:Boolean(e.refuel)})}}},{package:"$root$",file:"app/scripts/controllers/bridge-status/utils.ts"}],[611,{"@ethereumjs/rlp":429,"@ethereumjs/tx":442,"@ethereumjs/util":621,"@keystonehq/bc-ur-registry-eth":631,buffer:4074,hdkey:4632,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n,i=(n=e("hdkey"))&&"object"==typeof n&&"default"in n?n.default:n,s=e("@ethereumjs/util"),o=e("@ethereumjs/rlp"),a=e("@ethereumjs/tx"),c=e("@keystonehq/bc-ur-registry-eth"),u=e("uuid");const d="QR Hardware Wallet Device",h="m",p="0/*";var f,l;!function(e){e.hd="hd",e.pubkey="pubkey"}(f||(f={})),function(e){e.standard="account.standard",e.ledger_live="account.ledger_live",e.ledger_legacy="account.ledger_legacy"}(l||(l={}));class g{constructor(e){this.version=1,this.getInteraction=()=>{throw new Error("KeystoneError#invalid_extends: method getInteraction not implemented, please extend BaseKeyring by overwriting this method.")},this.type=d,this.requestSignature=async(e,t,r,n)=>{const i=await this.getInteraction().requestSignature(t,r,n),s=i.getRequestId(),o=i.getSignature();if(s){if(u.stringify(s)!==e)throw new Error("KeystoneError#invalid_data: read signature error: mismatched requestId")}return{r:o.slice(0,32),s:o.slice(32,64),v:o.slice(64)}},this.__readCryptoHDKey=e=>{var t,r;const n=`m/${e.getOrigin().getPath()}`,i=null===(t=e.getOrigin().getSourceFingerprint())||void 0===t?void 0:t.toString("hex"),s=(null===(r=e.getChildren())||void 0===r?void 0:r.getPath())||p,o=e.getName();if(e.getNote()===l.standard?this.keyringAccount=l.standard:e.getNote()===l.ledger_legacy&&(this.keyringAccount=l.ledger_legacy),!i)throw new Error("KeystoneError#invalid_data: invalid crypto-hdkey, cannot get source fingerprint");const a=e.getBip32Key();this.xfp=i,this.xpub=a,this.hdPath=n,this.childrenPath=s,o!==undefined&&""!==o&&(this.name=o),this.initialized=!0},this.__readCryptoAccount=e=>{var t,r;const n=null===(t=e.getMasterFingerprint())||void 0===t?void 0:t.toString("hex");if(!n)throw new Error("KeystoneError#invalid_data: invalid crypto-account, cannot get master fingerprint");this.xfp=n,this.initialized=!0;let i=!1;const o=e.getOutputDescriptors();if(!o||0===o.length)throw new Error("KeystoneError#invalid_data: invalid crypto-account, no crypto output found");if(o.length%5!=0)throw new Error("KeystoneError#invalid_data: only support 5x pubkey accounts for now");return null===(r=e.getOutputDescriptors())||void 0===r||r.forEach((e=>{try{const t=e.getHDKey();if(t){const e=t.getKey(),r=`M/${t.getOrigin().getPath()}`,n="0x"+s.publicToAddress(e,!0).toString("hex");this.name=t.getName(),t.getNote()===l.ledger_live&&(this.keyringAccount=l.ledger_live),this.paths[s.toChecksumAddress(n)]===undefined&&(i=!0),this.paths[s.toChecksumAddress(n)]=r}}catch(e){throw new Error(`KeystoneError#invalid_data: ${e}`)}})),i},this.getName=()=>this.name,this.setAccountToUnlock=e=>{this.unlockedAccount=parseInt(e,10)},this.__getNormalPage=async e=>{this.page+=e,this.page<=0&&(this.page=1);const t=(this.page-1)*this.perPage,r=t+this.perPage,n=[];for(let e=t;e<r;e++){const t=await this.__addressFromIndex(h,e);n.push({address:t,balance:null,index:e}),this.indexes[s.toChecksumAddress(t)]=e}return n},this.__getLedgerLivePage=async e=>{const t=(this.page+e-1)*this.perPage,r=t+this.perPage,n=[];for(let e=t;e<r;e++){const t=await this.__addressFromIndex(h,e);n.push({address:t,balance:null,index:e})}return this.page+=e,n},this.__addressFromIndex=async(e,t)=>{if(this.keyringMode===f.hd){this.checkKeyring(),this.hdk||(this.hdk=i.fromExtendedKey(this.xpub));const r=this.childrenPath.replace("*",String(t)).replace(/\*/g,"0"),n=this.hdk.derive(`${e}/${r}`),o="0x"+s.publicToAddress(n.publicKey,!0).toString("hex");return s.toChecksumAddress(o)}{const e=Object.keys(this.paths)[t];if(e)return s.toChecksumAddress(e);throw new Error("KeystoneError#pubkey_account.no_expected_account")}},this.page=0,this.perPage=5,this.accounts=[],this.currentAccount=0,this.unlockedAccount=0,this.name="QR Hardware",this.keyringMode=f.hd,this.keyringAccount=l.standard,this.initialized=!1,this.xfp="",this.xpub="",this.hdPath="",this.childrenPath=p,this.indexes={},this.paths={},this.deserialize(e)}async readKeyring(){const e=await this.getInteraction().readCryptoHDKeyOrCryptoAccount();this.syncKeyring(e)}syncKeyring(e){e.getRegistryType().getType()===c.extend.RegistryTypes.CRYPTO_HDKEY.getType()?(this.keyringMode=f.hd,this.__readCryptoHDKey(e)):(this.keyringMode=f.pubkey,this.__readCryptoAccount(e))}checkKeyring(){if(!this.xfp||!this.xpub||!this.hdPath)throw new Error("KeystoneError#invalid_keyring: keyring not fulfilled, please call function `readKeyring` firstly")}serialize(){return Promise.resolve({initialized:this.initialized,accounts:this.accounts,currentAccount:this.currentAccount,page:this.page,perPage:this.perPage,keyringAccount:this.keyringAccount,keyringMode:this.keyringMode,name:this.name,version:this.version,xfp:this.xfp,xpub:this.xpub,hdPath:this.hdPath,childrenPath:this.childrenPath,indexes:this.indexes,paths:this.paths})}deserialize(e){e&&(this.accounts=e.accounts,this.currentAccount=e.currentAccount,this.page=e.page,this.perPage=e.perPage,this.name=e.name,this.initialized=e.initialized,this.keyringMode=e.keyringMode||f.hd,this.keyringAccount=e.keyringAccount||l.standard,this.xfp=e.xfp,this.xpub=e.xpub,this.hdPath=e.hdPath,this.indexes=e.indexes,this.paths=e.paths,this.childrenPath=e.childrenPath||p)}setCurrentAccount(e){this.currentAccount=e}getCurrentAccount(){return this.currentAccount}getCurrentAddress(){return this.accounts[this.currentAccount]}async addAccounts(e=1){const t=this.unlockedAccount,r=t+e,n=[];for(let e=t;e<r;e++){const t=await this.__addressFromIndex(h,e);n.push(t),this.page=0,this.unlockedAccount++}return this.accounts=this.accounts.concat(n),this.accounts}getFirstPage(){return this.page=0,this.__getPage(1)}getNextPage(){return this.__getPage(1)}getPreviousPage(){return this.__getPage(-1)}async __getPage(e){return this.initialized||await this.readKeyring(),this.keyringMode===f.hd?this.__getNormalPage(e):this.__getLedgerLivePage(e)}getAccounts(){return Promise.resolve(this.accounts)}removeAccount(e){if(!this.accounts.map((e=>e.toLowerCase())).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter((t=>t.toLowerCase()!==e.toLowerCase()))}async signTransaction(e,r){const n=0===r.type?c.DataType.transaction:c.DataType.typedTransaction;let i;i=0===r.type?t.from(o.RLP.encode(r.getMessageToSign())):t.from(r.getMessageToSign());const s=await this._pathFromAddress(e),d=Number(r.common.chainId()),h=u.v4(),p=c.EthSignRequest.constructETHRequest(i,n,s,this.xfp,h,d),{r:f,s:l,v:g}=await this.requestSignature(h,p,"Scan with your Keystone",'After your Keystone has signed the transaction, click on "Scan Keystone" to receive the signature');return a.TransactionFactory.fromTxData({...r.toJSON(),type:r.type,r:f,s:l,v:g},{common:r.common})}signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,r){const n=s.stripHexPrefix(r),i=await this._pathFromAddress(e),o=u.v4(),a=c.EthSignRequest.constructETHRequest(t.from(n,"hex"),c.DataType.personalMessage,i,this.xfp,o,undefined,e),{r:d,s:h,v:p}=await this.requestSignature(o,a,"Scan with your Keystone",'After your Keystone has signed this message, click on "Scan Keystone" to receive the signature');return"0x"+t.concat([Uint8Array.from(d),Uint8Array.from(h),Uint8Array.from(p)]).toString("hex")}async signTypedData(e,r){const n=await this._pathFromAddress(e),i=u.v4(),s=c.EthSignRequest.constructETHRequest(t.from(JSON.stringify(r),"utf-8"),c.DataType.typedData,n,this.xfp,i,undefined,e),{r:o,s:a,v:d}=await this.requestSignature(i,s,"Scan with your Keystone",'After your Keystone has signed this data, click on "Scan Keystone" to receive the signature');return"0x"+t.concat([Uint8Array.from(o),Uint8Array.from(a),Uint8Array.from(d)]).toString("hex")}async _pathFromAddress(e){if(this.keyringMode===f.hd){const t=s.toChecksumAddress(e);let r=this.indexes[t];if(void 0===r)for(let e=0;e<1e3;e++)if(t===await this.__addressFromIndex(h,e)){r=e;break}if(void 0===r)throw new Error("Unknown address");return`${this.hdPath}/${this.childrenPath.replace("*",r.toString()).replace(/\*/g,"0")}`}{const t=s.toChecksumAddress(e),r=this.paths[t];if(void 0===r)throw new Error("Unknown address");return r}}}g.type=d,r.BaseKeyring=g}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring",file:"node_modules/@keystonehq/base-eth-keyring/dist/base-eth-keyring.cjs.development.js"}],[612,{"@ethereumjs/rlp":429,"@ethereumjs/tx":442,"@ethereumjs/util":621,"@keystonehq/bc-ur-registry-eth":631,buffer:4074,hdkey:4632,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n,i,s,o=(n=e("hdkey"))&&"object"==typeof n&&"default"in n?n.default:n,a=e("@ethereumjs/util"),c=e("@ethereumjs/rlp"),u=e("@ethereumjs/tx"),d=e("@keystonehq/bc-ur-registry-eth"),h=e("uuid");!function(e){e.hd="hd",e.pubkey="pubkey"}(i||(i={})),function(e){e.standard="account.standard",e.ledger_live="account.ledger_live",e.ledger_legacy="account.ledger_legacy"}(s||(s={}));class p{constructor(e){this.version=1,this.getInteraction=()=>{throw new Error("KeystoneError#invalid_extends: method getInteraction not implemented, please extend BaseKeyring by overwriting this method.")},this.type="QR Hardware Wallet Device",this.requestSignature=async(e,t,r,n)=>{const i=await this.getInteraction().requestSignature(t,r,n),s=i.getRequestId(),o=i.getSignature();if(s&&h.stringify(s)!==e)throw new Error("KeystoneError#invalid_data: read signature error: mismatched requestId");return{r:o.slice(0,32),s:o.slice(32,64),v:o.slice(64)}},this.__readCryptoHDKey=e=>{var t,r;const n="m/"+e.getOrigin().getPath(),i=null===(t=e.getOrigin().getSourceFingerprint())||void 0===t?void 0:t.toString("hex"),o=(null===(r=e.getChildren())||void 0===r?void 0:r.getPath())||"0/*",a=e.getName();if(e.getNote()===s.standard?this.keyringAccount=s.standard:e.getNote()===s.ledger_legacy&&(this.keyringAccount=s.ledger_legacy),!i)throw new Error("KeystoneError#invalid_data: invalid crypto-hdkey, cannot get source fingerprint");const c=e.getBip32Key();this.xfp=i,this.xpub=c,this.hdPath=n,this.childrenPath=o,void 0!==a&&""!==a&&(this.name=a),this.initialized=!0},this.__readCryptoAccount=e=>{var t,r;const n=null===(t=e.getMasterFingerprint())||void 0===t?void 0:t.toString("hex");if(!n)throw new Error("KeystoneError#invalid_data: invalid crypto-account, cannot get master fingerprint");this.xfp=n,this.initialized=!0;let i=!1;const o=e.getOutputDescriptors();if(!o||0===o.length)throw new Error("KeystoneError#invalid_data: invalid crypto-account, no crypto output found");if(o.length%5!=0)throw new Error("KeystoneError#invalid_data: only support 5x pubkey accounts for now");return null===(r=e.getOutputDescriptors())||void 0===r||r.forEach((e=>{try{const t=e.getHDKey();if(t){const e=t.getKey(),r="M/"+t.getOrigin().getPath(),n="0x"+a.publicToAddress(e,!0).toString("hex");this.name=t.getName(),t.getNote()===s.ledger_live&&(this.keyringAccount=s.ledger_live),void 0===this.paths[a.toChecksumAddress(n)]&&(i=!0),this.paths[a.toChecksumAddress(n)]=r}}catch(e){throw new Error("KeystoneError#invalid_data: "+e)}})),i},this.getName=()=>this.name,this.setAccountToUnlock=e=>{this.unlockedAccount=parseInt(e,10)},this.__getNormalPage=async e=>{this.page+=e,this.page<=0&&(this.page=1);const t=(this.page-1)*this.perPage,r=t+this.perPage,n=[];for(let e=t;e<r;e++){const t=await this.__addressFromIndex("m",e);n.push({address:t,balance:null,index:e}),this.indexes[a.toChecksumAddress(t)]=e}return n},this.__getLedgerLivePage=async e=>{const t=(this.page+e-1)*this.perPage,r=t+this.perPage,n=[];for(let e=t;e<r;e++){const t=await this.__addressFromIndex("m",e);n.push({address:t,balance:null,index:e})}return this.page+=e,n},this.__addressFromIndex=async(e,t)=>{if(this.keyringMode===i.hd){this.checkKeyring(),this.hdk||(this.hdk=o.fromExtendedKey(this.xpub));const r=this.childrenPath.replace("*",String(t)).replace(/\*/g,"0"),n=this.hdk.derive(`${e}/${r}`),i="0x"+a.publicToAddress(n.publicKey,!0).toString("hex");return a.toChecksumAddress(i)}{const e=Object.keys(this.paths)[t];if(e)return a.toChecksumAddress(e);throw new Error("KeystoneError#pubkey_account.no_expected_account")}},this.page=0,this.perPage=5,this.accounts=[],this.currentAccount=0,this.unlockedAccount=0,this.name="QR Hardware",this.keyringMode=i.hd,this.keyringAccount=s.standard,this.initialized=!1,this.xfp="",this.xpub="",this.hdPath="",this.childrenPath="0/*",this.indexes={},this.paths={},this.deserialize(e)}async readKeyring(){const e=await this.getInteraction().readCryptoHDKeyOrCryptoAccount();this.syncKeyring(e)}syncKeyring(e){e.getRegistryType().getType()===d.extend.RegistryTypes.CRYPTO_HDKEY.getType()?(this.keyringMode=i.hd,this.__readCryptoHDKey(e)):(this.keyringMode=i.pubkey,this.__readCryptoAccount(e))}checkKeyring(){if(!this.xfp||!this.xpub||!this.hdPath)throw new Error("KeystoneError#invalid_keyring: keyring not fulfilled, please call function `readKeyring` firstly")}serialize(){return Promise.resolve({initialized:this.initialized,accounts:this.accounts,currentAccount:this.currentAccount,page:this.page,perPage:this.perPage,keyringAccount:this.keyringAccount,keyringMode:this.keyringMode,name:this.name,version:this.version,xfp:this.xfp,xpub:this.xpub,hdPath:this.hdPath,childrenPath:this.childrenPath,indexes:this.indexes,paths:this.paths})}deserialize(e){e&&(this.accounts=e.accounts,this.currentAccount=e.currentAccount,this.page=e.page,this.perPage=e.perPage,this.name=e.name,this.initialized=e.initialized,this.keyringMode=e.keyringMode||i.hd,this.keyringAccount=e.keyringAccount||s.standard,this.xfp=e.xfp,this.xpub=e.xpub,this.hdPath=e.hdPath,this.indexes=e.indexes,this.paths=e.paths,this.childrenPath=e.childrenPath||"0/*")}setCurrentAccount(e){this.currentAccount=e}getCurrentAccount(){return this.currentAccount}getCurrentAddress(){return this.accounts[this.currentAccount]}async addAccounts(e=1){const t=this.unlockedAccount,r=t+e,n=[];for(let e=t;e<r;e++){const t=await this.__addressFromIndex("m",e);n.push(t),this.page=0,this.unlockedAccount++}return this.accounts=this.accounts.concat(n),this.accounts}getFirstPage(){return this.page=0,this.__getPage(1)}getNextPage(){return this.__getPage(1)}getPreviousPage(){return this.__getPage(-1)}async __getPage(e){return this.initialized||await this.readKeyring(),this.keyringMode===i.hd?this.__getNormalPage(e):this.__getLedgerLivePage(e)}getAccounts(){return Promise.resolve(this.accounts)}removeAccount(e){if(!this.accounts.map((e=>e.toLowerCase())).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter((t=>t.toLowerCase()!==e.toLowerCase()))}async signTransaction(e,r){const n=0===r.type?d.DataType.transaction:d.DataType.typedTransaction;let i;i=0===r.type?t.from(c.RLP.encode(r.getMessageToSign())):t.from(r.getMessageToSign());const s=await this._pathFromAddress(e),o=Number(r.common.chainId()),a=h.v4(),p=d.EthSignRequest.constructETHRequest(i,n,s,this.xfp,a,o),{r:f,s:l,v:g}=await this.requestSignature(a,p,"Scan with your Keystone",'After your Keystone has signed the transaction, click on "Scan Keystone" to receive the signature');return u.TransactionFactory.fromTxData({...r.toJSON(),type:r.type,r:f,s:l,v:g},{common:r.common})}signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,r){const n=a.stripHexPrefix(r),i=await this._pathFromAddress(e),s=h.v4(),o=d.EthSignRequest.constructETHRequest(t.from(n,"hex"),d.DataType.personalMessage,i,this.xfp,s,void 0,e),{r:c,s:u,v:p}=await this.requestSignature(s,o,"Scan with your Keystone",'After your Keystone has signed this message, click on "Scan Keystone" to receive the signature');return"0x"+t.concat([Uint8Array.from(c),Uint8Array.from(u),Uint8Array.from(p)]).toString("hex")}async signTypedData(e,r){const n=await this._pathFromAddress(e),i=h.v4(),s=d.EthSignRequest.constructETHRequest(t.from(JSON.stringify(r),"utf-8"),d.DataType.typedData,n,this.xfp,i,void 0,e),{r:o,s:a,v:c}=await this.requestSignature(i,s,"Scan with your Keystone",'After your Keystone has signed this data, click on "Scan Keystone" to receive the signature');return"0x"+t.concat([Uint8Array.from(o),Uint8Array.from(a),Uint8Array.from(c)]).toString("hex")}async _pathFromAddress(e){if(this.keyringMode===i.hd){const t=a.toChecksumAddress(e);let r=this.indexes[t];if(void 0===r)for(let e=0;e<1e3;e++)if(t===await this.__addressFromIndex("m",e)){r=e;break}if(void 0===r)throw new Error("Unknown address");return`${this.hdPath}/${this.childrenPath.replace("*",r.toString()).replace(/\*/g,"0")}`}{const t=a.toChecksumAddress(e),r=this.paths[t];if(void 0===r)throw new Error("Unknown address");return r}}}p.type="QR Hardware Wallet Device",r.BaseKeyring=p}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring",file:"node_modules/@keystonehq/base-eth-keyring/dist/base-eth-keyring.cjs.production.min.js"}],[613,{"./base-eth-keyring.cjs.development.js":611,"./base-eth-keyring.cjs.production.min.js":612},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){t.exports=e("./base-eth-keyring.cjs.production.min.js")}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring",file:"node_modules/@keystonehq/base-eth-keyring/dist/index.js"}],[614,{"./bytes":617,"./constants":618,"./helpers":620,"./internal":622,"@ethereumjs/rlp":429,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317,"ethereum-cryptography/utils":4319},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.accountBodyToRLP=r.accountBodyToSlim=r.accountBodyFromSlim=r.isZeroAddress=r.zeroAddress=r.importPublic=r.privateToAddress=r.privateToPublic=r.publicToAddress=r.pubToAddress=r.isValidPublic=r.isValidPrivate=r.generateAddress2=r.generateAddress=r.isValidChecksumAddress=r.toChecksumAddress=r.isValidAddress=r.Account=void 0;const n=e("@ethereumjs/rlp"),i=e("ethereum-cryptography/keccak"),s=e("ethereum-cryptography/secp256k1"),o=e("ethereum-cryptography/utils"),a=e("./bytes"),c=e("./constants"),u=e("./helpers"),d=e("./internal"),h=BigInt(0);class p{constructor(e=h,t=h,r=c.KECCAK256_RLP,n=c.KECCAK256_NULL){this.nonce=e,this.balance=t,this.storageRoot=r,this.codeHash=n,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,storageRoot:n,codeHash:i}=e;return new p(t!==undefined?(0,a.bufferToBigInt)((0,a.toBuffer)(t)):undefined,r!==undefined?(0,a.bufferToBigInt)((0,a.toBuffer)(r)):undefined,n!==undefined?(0,a.toBuffer)(n):undefined,i!==undefined?(0,a.toBuffer)(i):undefined)}static fromRlpSerializedAccount(e){const t=(0,a.arrToBufArr)(n.RLP.decode(Uint8Array.from(e)));if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,n,i]=e;return new p((0,a.bufferToBigInt)(t),(0,a.bufferToBigInt)(r),n,i)}_validate(){if(this.nonce<h)throw new Error("nonce must be greater than zero");if(this.balance<h)throw new Error("balance must be greater than zero");if(32!==this.storageRoot.length)throw new Error("storageRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[(0,a.bigIntToUnpaddedBuffer)(this.nonce),(0,a.bigIntToUnpaddedBuffer)(this.balance),this.storageRoot,this.codeHash]}serialize(){return t.from(n.RLP.encode((0,a.bufArrToArr)(this.raw())))}isContract(){return!this.codeHash.equals(c.KECCAK256_NULL)}isEmpty(){return this.balance===h&&this.nonce===h&&this.codeHash.equals(c.KECCAK256_NULL)}}r.Account=p;r.isValidAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};r.toChecksumAddress=function(e,r){(0,u.assertIsHexString)(e);const n=(0,d.stripHexPrefix)(e).toLowerCase();let s="";if(r!==undefined){s=(0,a.bufferToBigInt)((0,a.toBuffer)(r)).toString()+"0x"}const c=t.from(s+n,"utf8"),h=(0,o.bytesToHex)((0,i.keccak256)(c));let p="0x";for(let e=0;e<n.length;e++)parseInt(h[e],16)>=8?p+=n[e].toUpperCase():p+=n[e];return p};r.isValidChecksumAddress=function(e,t){return(0,r.isValidAddress)(e)&&(0,r.toChecksumAddress)(e,t)===e};r.generateAddress=function(e,r){return(0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,a.bufferToBigInt)(r)===BigInt(0)?t.from((0,i.keccak256)(n.RLP.encode((0,a.bufArrToArr)([e,null])))).slice(-20):t.from((0,i.keccak256)(n.RLP.encode((0,a.bufArrToArr)([e,r])))).slice(-20)};r.generateAddress2=function(e,r,n){if((0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,u.assertIsBuffer)(n),20!==e.length)throw new Error("Expected from to be of length 20");if(32!==r.length)throw new Error("Expected salt to be of length 32");const s=(0,i.keccak256)(t.concat([t.from("ff","hex"),e,r,(0,i.keccak256)(n)]));return(0,a.toBuffer)(s).slice(-20)};r.isValidPrivate=function(e){return s.secp256k1.utils.isValidPrivateKey(e)};r.isValidPublic=function(e,r=!1){if((0,u.assertIsBuffer)(e),64===e.length)try{return s.secp256k1.ProjectivePoint.fromHex(t.concat([t.from([4]),e])),!0}catch(e){return!1}if(!r)return!1;try{return s.secp256k1.ProjectivePoint.fromHex(e),!0}catch(e){return!1}};r.pubToAddress=function(e,r=!1){if((0,u.assertIsBuffer)(e),r&&64!==e.length&&(e=t.from(s.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),64!==e.length)throw new Error("Expected pubKey to be of length 64");return t.from((0,i.keccak256)(e)).slice(-20)},r.publicToAddress=r.pubToAddress;r.privateToPublic=function(e){return(0,u.assertIsBuffer)(e),t.from(s.secp256k1.ProjectivePoint.fromPrivateKey(e).toRawBytes(!1).slice(1))};r.privateToAddress=function(e){return(0,r.publicToAddress)((0,r.privateToPublic)(e))};r.importPublic=function(e){return(0,u.assertIsBuffer)(e),64!==e.length&&(e=t.from(s.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),e};r.zeroAddress=function(){const e=(0,a.zeros)(20);return(0,a.bufferToHex)(e)};function f(e){const[t,r,n,i]=e;return[t,r,0===(0,a.arrToBufArr)(n).length?c.KECCAK256_RLP:n,0===(0,a.arrToBufArr)(i).length?c.KECCAK256_NULL:i]}r.isZeroAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return(0,r.zeroAddress)()===e},r.accountBodyFromSlim=f;const l=new Uint8Array(0);r.accountBodyToSlim=function(e){const[t,r,n,i]=e;return[t,r,(0,a.arrToBufArr)(n).equals(c.KECCAK256_RLP)?l:n,(0,a.arrToBufArr)(i).equals(c.KECCAK256_NULL)?l:i]},r.accountBodyToRLP=function(e,t=!0){const r=t?f(e):e;return(0,a.arrToBufArr)(n.RLP.encode(r))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/account.js"}],[615,{"./account":614,"./bytes":617,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Address=void 0;const n=e("./account"),i=e("./bytes");class s{constructor(e){if(20!==e.length)throw new Error("Invalid address length");this.buf=e}static zero(){return new s((0,i.zeros)(20))}static fromString(e){if(!(0,n.isValidAddress)(e))throw new Error("Invalid address");return new s((0,i.toBuffer)(e))}static fromPublicKey(e){if(!t.isBuffer(e))throw new Error("Public key should be Buffer");const r=(0,n.pubToAddress)(e);return new s(r)}static fromPrivateKey(e){if(!t.isBuffer(e))throw new Error("Private key should be Buffer");const r=(0,n.privateToAddress)(e);return new s(r)}static generate(e,t){if("bigint"!=typeof t)throw new Error("Expected nonce to be a bigint");return new s((0,n.generateAddress)(e.buf,(0,i.bigIntToBuffer)(t)))}static generate2(e,r,i){if(!t.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!t.isBuffer(i))throw new Error("Expected initCode to be a Buffer");return new s((0,n.generateAddress2)(e.buf,r,i))}equals(e){return this.buf.equals(e.buf)}isZero(){return this.equals(s.zero())}isPrecompileOrSystemAddress(){const e=(0,i.bufferToBigInt)(this.buf),t=BigInt(0),r=BigInt("0xffff");return e>=t&&e<=r}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return t.from(this.buf)}}r.Address=s}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/address.js"}],[616,{events:4399},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AsyncEventEmitter=void 0;const n=e("events");class i extends n.EventEmitter{emit(e,...t){let[r,n]=t;const i=this;let s=i._events[e]??[];return n===undefined&&"function"==typeof r&&(n=r,r=undefined),"newListener"!==e&&"removeListener"!==e||(r={event:r,fn:n},n=undefined),s=Array.isArray(s)?s:[s],async function(e,t,r){let n;for await(const i of t)try{i.length<2?i.call(e,r):await new Promise(((t,n)=>{i.call(e,r,(e=>{e?n(e):t()}))}))}catch(e){n=e}if(n)throw n}(i,s.slice(),r).then(n).catch(n),i.listenerCount(e)>0}once(e,t){const r=this;let n;if("function"!=typeof t)throw new TypeError("listener must be a function");return n=t.length>=2?function(i,s){r.removeListener(e,n),t(i,s)}:function(i){r.removeListener(e,n),t(i,n)},r.on(e,n),r}first(e,t){let r=this._events[e]??[];if("function"!=typeof t)throw new TypeError("listener must be a function");return Array.isArray(r)||(this._events[e]=r=[r]),r.unshift(t),this}before(e,t,r){return this.beforeOrAfter(e,t,r)}after(e,t,r){return this.beforeOrAfter(e,t,r,"after")}beforeOrAfter(e,t,r,n){let i,s,o=this._events[e]??[];const a="after"===n?1:0;if("function"!=typeof r)throw new TypeError("listener must be a function");if("function"!=typeof t)throw new TypeError("target must be a function");for(Array.isArray(o)||(this._events[e]=o=[o]),s=o.length,i=o.length;i--;)if(o[i]===t){s=i+a;break}return o.splice(s,0,r),this}on(e,t){return super.on(e,t)}addListener(e,t){return super.addListener(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}removeListener(e,t){return super.removeListener(e,t)}eventNames(){return super.eventNames()}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(e){return super.setMaxListeners(e)}}r.AsyncEventEmitter=i}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/asyncEventEmitter.js"}],[617,{"./helpers":620,"./internal":622,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.intToUnpaddedBuffer=r.bigIntToUnpaddedBuffer=r.bigIntToHex=r.bufArrToArr=r.arrToBufArr=r.validateNoLeadingZeroes=r.baToJSON=r.toUtf8=r.short=r.addHexPrefix=r.toUnsigned=r.fromSigned=r.bufferToInt=r.bigIntToBuffer=r.bufferToBigInt=r.bufferToHex=r.toBuffer=r.unpadHexString=r.unpadArray=r.unpadBuffer=r.setLengthRight=r.setLengthLeft=r.zeros=r.intToBuffer=r.intToHex=void 0;const n=e("./helpers"),i=e("./internal");r.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`};r.intToBuffer=function(e){const n=(0,r.intToHex)(e);return t.from((0,i.padToEven)(n.slice(2)),"hex")};r.zeros=function(e){return t.allocUnsafe(e).fill(0)};const s=function(e,t,n){const i=(0,r.zeros)(t);return n?e.length<t?(e.copy(i),i):e.slice(0,t):e.length<t?(e.copy(i,t-e.length),i):e.slice(-t)};r.setLengthLeft=function(e,t){return(0,n.assertIsBuffer)(e),s(e,t,!1)};r.setLengthRight=function(e,t){return(0,n.assertIsBuffer)(e),s(e,t,!0)};const o=function(e){let t=e[0];for(;e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};r.unpadBuffer=function(e){return(0,n.assertIsBuffer)(e),o(e)};r.unpadArray=function(e){return(0,n.assertIsArray)(e),o(e)};r.unpadHexString=function(e){return(0,n.assertIsHexString)(e),e=(0,i.stripHexPrefix)(e),"0x"+o(e)};r.toBuffer=function(e){if(null===e||e===undefined)return t.allocUnsafe(0);if(t.isBuffer(e))return t.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return t.from(e);if("string"==typeof e){if(!(0,i.isHexString)(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return t.from((0,i.padToEven)((0,i.stripHexPrefix)(e)),"hex")}if("number"==typeof e)return(0,r.intToBuffer)(e);if("bigint"==typeof e){if(e<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${e}`);let r=e.toString(16);return r.length%2&&(r="0"+r),t.from(r,"hex")}if(e.toArray)return t.from(e.toArray());if(e.toBuffer)return t.from(e.toBuffer());throw new Error("invalid type")};function a(e){const t=(0,r.bufferToHex)(e);return"0x"===t?BigInt(0):BigInt(t)}function c(e){return(0,r.toBuffer)("0x"+e.toString(16))}r.bufferToHex=function(e){return"0x"+(e=(0,r.toBuffer)(e)).toString("hex")},r.bufferToBigInt=a,r.bigIntToBuffer=c;r.bufferToInt=function(e){const t=Number(a(e));if(!Number.isSafeInteger(t))throw new Error("Number exceeds 53 bits");return t};r.fromSigned=function(e){return BigInt.asIntN(256,a(e))};r.toUnsigned=function(e){return c(BigInt.asUintN(256,e))};r.addHexPrefix=function(e){return"string"!=typeof e||(0,i.isHexPrefixed)(e)?e:"0x"+e},r.short=function(e,r=50){const n=t.isBuffer(e)?e.toString("hex"):e;return n.length<=r?n:n.slice(0,r)+"…"};r.toUtf8=function(e){if((e=(0,i.stripHexPrefix)(e)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return t.from(e.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};r.baToJSON=function(e){if(t.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const t=[];for(let n=0;n<e.length;n++)t.push((0,r.baToJSON)(e[n]));return t}};r.validateNoLeadingZeroes=function(e){for(const[t,r]of Object.entries(e))if(r!==undefined&&r.length>0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${r.toString("hex")}`)},r.arrToBufArr=function e(r){return Array.isArray(r)?r.map((t=>e(t))):t.from(r)},r.bufArrToArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):Uint8Array.from(t??[])};r.bigIntToHex=e=>"0x"+e.toString(16),r.bigIntToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)(c(e))},r.intToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)((0,r.intToBuffer)(e))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/bytes.js"}],[618,{buffer:4074,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.MAX_WITHDRAWALS_PER_PAYLOAD=r.RLP_EMPTY_STRING=r.KECCAK256_RLP=r.KECCAK256_RLP_S=r.KECCAK256_RLP_ARRAY=r.KECCAK256_RLP_ARRAY_S=r.KECCAK256_NULL=r.KECCAK256_NULL_S=r.TWO_POW256=r.SECP256K1_ORDER_DIV_2=r.SECP256K1_ORDER=r.MAX_INTEGER_BIGINT=r.MAX_INTEGER=r.MAX_UINT64=void 0;const n=e("buffer"),i=e("ethereum-cryptography/secp256k1");r.MAX_UINT64=BigInt("0xffffffffffffffff"),r.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),r.SECP256K1_ORDER=i.secp256k1.CURVE.n,r.SECP256K1_ORDER_DIV_2=i.secp256k1.CURVE.n/BigInt(2),r.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.KECCAK256_NULL=n.Buffer.from(r.KECCAK256_NULL_S,"hex"),r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.KECCAK256_RLP_ARRAY=n.Buffer.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.KECCAK256_RLP=n.Buffer.from(r.KECCAK256_RLP_S,"hex"),r.RLP_EMPTY_STRING=n.Buffer.from([128]),r.MAX_WITHDRAWALS_PER_PAYLOAD=16}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/constants.js"}],[619,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.compactBytesToNibbles=r.bytesToNibbles=r.nibblesToCompactBytes=r.nibblesToBytes=r.hasTerminator=void 0;r.hasTerminator=e=>e.length>0&&16===e[e.length-1];r.nibblesToBytes=(e,t)=>{for(let r=0,n=0;n<e.length;r+=1,n+=2)t[r]=e[n]<<4|e[n+1]};r.nibblesToCompactBytes=e=>{let t=0;(0,r.hasTerminator)(e)&&(t=1,e=e.subarray(0,e.length-1));const n=new Uint8Array(e.length/2+1);return n[0]=t<<5,1&~e.length||(n[0]|=16,n[0]|=e[0],e=e.subarray(1)),(0,r.nibblesToBytes)(e,n.subarray(1)),n};r.bytesToNibbles=e=>{const t=2*e.length+1,r=new Uint8Array(t);for(let t=0;t<e.length;t++){const n=e[t];r[2*t]=n/16,r[2*t+1]=n%16}return r[t-1]=16,r};r.compactBytesToNibbles=e=>{if(0===e.length)return e;let t=(0,r.bytesToNibbles)(e);t[0]<2&&(t=t.subarray(0,t.length-1));const n=2-(1&t[0]);return t.subarray(n)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/encoding.js"}],[62,{"../../../../shared/lib/swaps-utils":5770,"../../../../shared/types/bridge-status":5807,"./constants":60},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.validators=r.validateResponse=void 0;var n=e("../../../../shared/lib/swaps-utils"),i=e("../../../../shared/types/bridge-status"),s=e("./constants");const o=(e,t,r)=>null!==t&&t!==undefined&&(0,n.validateData)(e,t,r);r.validateResponse=o;const a=[{property:"chainId",type:"number",validator:e=>"number"==typeof e},{property:"address",type:"string",validator:e=>(0,n.truthyString)(e)},{property:"symbol",type:"string",validator:e=>"string"==typeof e},{property:"name",type:"string",validator:e=>"string"==typeof e},{property:"decimals",type:"number",validator:e=>"number"==typeof e},{property:"icon",type:"string|undefined|object",validator:e=>e===undefined||null===e||"string"==typeof e}],c=e=>o(a,e,s.BRIDGE_STATUS_BASE_URL),u=[{property:"chainId",type:"number|string",validator:e=>"number"==typeof e||"string"==typeof e},{property:"txHash",type:"string",validator:n.truthyString},{property:"amount",type:"string|undefined",validator:e=>e===undefined||"string"==typeof e},{property:"token",type:"object|undefined",validator:e=>e===undefined||e&&"object"==typeof e&&0===Object.keys(e).length||c(e)}],d=[{property:"chainId",type:"number|string",validator:e=>"number"==typeof e||"string"==typeof e},{property:"amount",type:"string|undefined",validator:e=>e===undefined||"string"==typeof e},{property:"txHash",type:"string|undefined",validator:e=>e===undefined||"string"==typeof e},{property:"token",type:"object|undefined",validator:e=>e===undefined||e&&"object"==typeof e&&0===Object.keys(e).length||c(e)}];r.validators=[{property:"status",type:"string",validator:e=>Object.values(i.StatusTypes).includes(e)},{property:"srcChain",type:"object",validator:e=>o(u,e,s.BRIDGE_STATUS_BASE_URL)},{property:"destChain",type:"object|undefined",validator:e=>e===undefined||(e=>o(d,e,s.BRIDGE_STATUS_BASE_URL))(e)},{property:"bridge",type:"string|undefined",validator:e=>e===undefined||"string"==typeof e},{property:"isExpectedToken",type:"boolean|undefined",validator:e=>e===undefined||"boolean"==typeof e},{property:"isUnrecognizedRouterAddress",type:"boolean|undefined",validator:e=>e===undefined||"boolean"==typeof e}]}}},{package:"$root$",file:"app/scripts/controllers/bridge-status/validators.ts"}],[620,{"../../../../../../is-buffer/index.js":4657,"./internal":622},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.assertIsString=r.assertIsArray=r.assertIsBuffer=r.assertIsHexString=void 0;const n=e("./internal");r.assertIsHexString=function(e){if(!(0,n.isHexString)(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}};r.assertIsBuffer=function(e){if(!t.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}};r.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}};r.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}}).call(this)}).call(this,{isBuffer:e("../../../../../../is-buffer/index.js")})}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/helpers.js"}],[621,{"./account":614,"./address":615,"./asyncEventEmitter":616,"./bytes":617,"./constants":618,"./encoding":619,"./internal":622,"./lock":623,"./provider":624,"./signature":625,"./types":626,"./units":627,"./withdrawal":628},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.toAscii=r.stripHexPrefix=r.padToEven=r.isHexString=r.isHexPrefixed=r.getKeys=r.getBinarySize=r.fromUtf8=r.fromAscii=r.arrayContainsArray=void 0,i(e("./constants"),r),i(e("./units"),r),i(e("./account"),r),i(e("./address"),r),i(e("./withdrawal"),r),i(e("./signature"),r),i(e("./bytes"),r),i(e("./types"),r),i(e("./encoding"),r),i(e("./asyncEventEmitter"),r);var s=e("./internal");Object.defineProperty(r,"arrayContainsArray",{enumerable:!0,get:function(){return s.arrayContainsArray}}),Object.defineProperty(r,"fromAscii",{enumerable:!0,get:function(){return s.fromAscii}}),Object.defineProperty(r,"fromUtf8",{enumerable:!0,get:function(){return s.fromUtf8}}),Object.defineProperty(r,"getBinarySize",{enumerable:!0,get:function(){return s.getBinarySize}}),Object.defineProperty(r,"getKeys",{enumerable:!0,get:function(){return s.getKeys}}),Object.defineProperty(r,"isHexPrefixed",{enumerable:!0,get:function(){return s.isHexPrefixed}}),Object.defineProperty(r,"isHexString",{enumerable:!0,get:function(){return s.isHexString}}),Object.defineProperty(r,"padToEven",{enumerable:!0,get:function(){return s.padToEven}}),Object.defineProperty(r,"stripHexPrefix",{enumerable:!0,get:function(){return s.stripHexPrefix}}),Object.defineProperty(r,"toAscii",{enumerable:!0,get:function(){return s.toAscii}}),i(e("./lock"),r),i(e("./provider"),r)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/index.js"}],[622,{buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(e){(function(){function t(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,r.isHexPrefixed=t;function n(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}r.stripHexPrefix=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return t(e)?e.slice(2):e},r.padToEven=n,r.getBinarySize=function(t){if("string"!=typeof t)throw new Error("[getBinarySize] method requires input type 'string', received "+typeof t);return e.byteLength(t,"utf8")},r.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(!0!==Array.isArray(t))throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[!0===r?"some":"every"]((t=>e.indexOf(t)>=0))},r.toAscii=function(e){let t="",r=0;const n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){const n=parseInt(e.substr(r,2),16);t+=String.fromCharCode(n)}return t},r.fromUtf8=function(t){return`0x${n(e.from(t,"utf8").toString("hex")).replace(/^0+|0+$/g,"")}`},r.fromAscii=function(e){let t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r).toString(16);t+=n.length<2?`0${n}`:n}return`0x${t}`},r.getKeys=function(e,t,r){if(!Array.isArray(e))throw new Error("[getKeys] method expects input 'params' to be an array, got "+typeof e);if("string"!=typeof t)throw new Error("[getKeys] method expects input 'key' to be type 'string', got "+typeof e);const n=[];for(let i=0;i<e.length;i++){let s=e[i][t];if(!0!==r||s){if("string"!=typeof s)throw new Error("invalid abi - expected type 'string', received "+typeof s)}else s="";n.push(s)}return n},r.isHexString=function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&!(void 0!==t&&t>0&&e.length!==2+2*t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/internal.js"}],[623,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Lock=void 0;r.Lock=class{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise((e=>this.promiseResolverQueue.push(e)))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;const e=this.promiseResolverQueue.shift();e&&e(!0)}}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/lock.js"}],[624,{"micro-ftch":4910},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getProvider=r.fetchFromProvider=void 0;const n=e("micro-ftch");r.fetchFromProvider=async(e,t)=>(await(0,n.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;r.getProvider=e=>{if("string"==typeof e)return e;if(e?.connection?.url!==undefined)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/provider.js"}],[625,{"./bytes":617,"./constants":618,"./helpers":620,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.hashPersonalMessage=r.isValidSignature=r.fromRpcSig=r.toCompactSig=r.toRpcSig=r.ecrecover=r.ecsign=void 0;const n=e("ethereum-cryptography/keccak"),i=e("ethereum-cryptography/secp256k1"),s=e("./bytes"),o=e("./constants"),a=e("./helpers");function c(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===undefined?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function u(e){return e===BigInt(0)||e===BigInt(1)}r.ecsign=function(e,r,n){const s=i.secp256k1.sign(e,r),o=s.toCompactRawBytes();return{r:t.from(o.slice(0,32)),s:t.from(o.slice(32,64)),v:n===undefined?BigInt(s.recovery+27):BigInt(s.recovery+35)+BigInt(n)*BigInt(2)}};r.ecrecover=function(e,r,n,o,a){const d=t.concat([(0,s.setLengthLeft)(n,32),(0,s.setLengthLeft)(o,32)],64),h=c(r,a);if(!u(h))throw new Error("Invalid signature v value");const p=i.secp256k1.Signature.fromCompact(d).addRecoveryBit(Number(h)).recoverPublicKey(e);return t.from(p.toRawBytes(!1).slice(1))};r.toRpcSig=function(e,r,n,i){if(!u(c(e,i)))throw new Error("Invalid signature v value");return(0,s.bufferToHex)(t.concat([(0,s.setLengthLeft)(r,32),(0,s.setLengthLeft)(n,32),(0,s.toBuffer)(e)]))};r.toCompactSig=function(e,r,n,i){if(!u(c(e,i)))throw new Error("Invalid signature v value");let o=n;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(o=t.from(n),o[0]|=128),(0,s.bufferToHex)(t.concat([(0,s.setLengthLeft)(r,32),(0,s.setLengthLeft)(o,32)]))};r.fromRpcSig=function(e){const t=(0,s.toBuffer)(e);let r,n,i;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),i=(0,s.bufferToBigInt)(t.slice(64));else{if(64!==t.length)throw new Error("Invalid signature length");r=t.slice(0,32),n=t.slice(32,64),i=BigInt((0,s.bufferToInt)(t.slice(32,33))>>7),n[0]&=127}return i<27&&(i+=BigInt(27)),{v:i,r:r,s:n}};r.isValidSignature=function(e,t,r,n=!0,i){if(32!==t.length||32!==r.length)return!1;if(!u(c(e,i)))return!1;const a=(0,s.bufferToBigInt)(t),d=(0,s.bufferToBigInt)(r);return!(a===BigInt(0)||a>=o.SECP256K1_ORDER||d===BigInt(0)||d>=o.SECP256K1_ORDER)&&!(n&&d>=o.SECP256K1_ORDER_DIV_2)};r.hashPersonalMessage=function(e){(0,a.assertIsBuffer)(e);const r=t.from(`Ethereum Signed Message:\n${e.length}`,"utf-8");return t.from((0,n.keccak256)(t.concat([r,e])))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/signature.js"}],[626,{"./bytes":617,"./internal":622},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.toType=r.TypeOutput=void 0;const n=e("./bytes"),i=e("./internal");var s;!function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(s=r.TypeOutput||(r.TypeOutput={})),r.toType=function(e,t){if(null===e)return null;if(e===undefined)return undefined;if("string"==typeof e&&!(0,i.isHexString)(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const r=(0,n.toBuffer)(e);switch(t){case s.Buffer:return r;case s.BigInt:return(0,n.bufferToBigInt)(r);case s.Number:{const e=(0,n.bufferToBigInt)(r);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case s.PrefixedHexString:return(0,n.bufferToHex)(r);default:throw new Error("unknown outputType")}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/types.js"}],[627,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.GWEI_TO_WEI=void 0,r.GWEI_TO_WEI=BigInt(1e9)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/units.js"}],[628,{"./address":615,"./bytes":617,"./types":626,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Withdrawal=void 0;const n=e("./address"),i=e("./bytes"),s=e("./types");class o{constructor(e,t,r,n){this.index=e,this.validatorIndex=t,this.address=r,this.amount=n}static fromWithdrawalData(e){const{index:t,validatorIndex:r,address:i,amount:a}=e,c=(0,s.toType)(t,s.TypeOutput.BigInt),u=(0,s.toType)(r,s.TypeOutput.BigInt),d=new n.Address((0,s.toType)(i,s.TypeOutput.Buffer)),h=(0,s.toType)(a,s.TypeOutput.BigInt);return new o(c,u,d,h)}static fromValuesArray(e){if(4!==e.length)throw Error(`Invalid withdrawalArray length expected=4 actual=${e.length}`);const[t,r,n,i]=e;return o.fromWithdrawalData({index:t,validatorIndex:r,address:n,amount:i})}static toBufferArray(e){const{index:r,validatorIndex:i,address:o,amount:a}=e,c=(0,s.toType)(r,s.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,s.toType)(r,s.TypeOutput.Buffer),u=(0,s.toType)(i,s.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,s.toType)(i,s.TypeOutput.Buffer);let d;d=o instanceof n.Address?o.buf:(0,s.toType)(o,s.TypeOutput.Buffer);return[c,u,d,(0,s.toType)(a,s.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,s.toType)(a,s.TypeOutput.Buffer)]}raw(){return o.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,i.bigIntToHex)(this.index),validatorIndex:(0,i.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,i.bigIntToHex)(this.amount)}}}r.Withdrawal=o}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@ethereumjs/util",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@ethereumjs/util/dist/withdrawal.js"}],[629,{"@ethereumjs/util":621,"@keystonehq/bc-ur-registry":651,buffer:4074,hdkey:4632,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("@keystonehq/bc-ur-registry"),s=e("uuid"),o=(n=e("hdkey"))&&"object"==typeof n&&"default"in n?n.default:n,a=e("@ethereumjs/util");const c={ETH_SIGN_REQUEST:new i.RegistryType("eth-sign-request",401),ETH_SIGNATURE:new i.RegistryType("eth-signature",402),ETH_NFT_ITEM:new i.RegistryType("eth-nft-item",403)},{decodeToDataItem:u,RegistryTypes:d}=i.extend;var h,p;!function(e){e[e.requestId=1]="requestId",e[e.signData=2]="signData",e[e.dataType=3]="dataType",e[e.chainId=4]="chainId",e[e.derivationPath=5]="derivationPath",e[e.address=6]="address",e[e.origin=7]="origin"}(h||(h={})),(p=r.DataType||(r.DataType={}))[p.transaction=1]="transaction",p[p.typedData=2]="typedData",p[p.personalMessage=3]="personalMessage",p[p.typedTransaction=4]="typedTransaction";class f extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_SIGN_REQUEST,this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSourceFingerprint=()=>this.derivationPath.getSourceFingerprint(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};this.requestId&&(e[h.requestId]=new i.DataItem(this.requestId,d.UUID.getTag())),this.address&&(e[h.address]=this.address),this.chainId&&(e[h.chainId]=Number(this.chainId)),this.origin&&(e[h.origin]=this.origin),e[h.signData]=this.signData,e[h.dataType]=this.dataType;const t=this.derivationPath.toDataItem();return t.setTag(this.derivationPath.getRegistryType().getTag()),e[h.derivationPath]=t,new i.DataItem(e)},this.requestId=e.requestId,this.signData=e.signData,this.dataType=e.dataType,this.chainId=e.chainId,this.derivationPath=e.derivationPath,this.address=e.address,this.origin=e.origin}static constructETHRequest(e,r,n,o,a,c,u,d){const h=n.replace(/[m|M]\//,"").split("/"),p=new i.CryptoKeypath(h.map((e=>{const t=parseInt(e.replace("'",""));let r=!1;return e.endsWith("'")&&(r=!0),new i.PathComponent({index:t,hardened:r})})),t.from(o,"hex"));return new f({requestId:a?t.from(s.parse(a)):undefined,signData:e,dataType:r,derivationPath:p,chainId:c,address:u?t.from(u.replace("0x",""),"hex"):undefined,origin:d||undefined})}}f.fromDataItem=e=>{const t=e.getData(),r=t[h.signData],n=t[h.dataType],s=i.CryptoKeypath.fromDataItem(t[h.derivationPath]),o=t[h.chainId]?t[h.chainId]:undefined,a=t[h.address]?t[h.address]:undefined,c=t[h.requestId]?t[h.requestId].getData():undefined,u=t[h.origin]?t[h.origin]:undefined;return new f({requestId:c,signData:r,dataType:n,chainId:o,derivationPath:s,address:a,origin:u})},f.fromCBOR=e=>{const t=u(e);return f.fromDataItem(t)};const{RegistryTypes:l,decodeToDataItem:g}=i.extend;var y;!function(e){e[e.requestId=1]="requestId",e[e.signature=2]="signature",e[e.origin=3]="origin"}(y||(y={}));class m extends i.RegistryItem{constructor(e,t,r){super(),this.getRegistryType=()=>c.ETH_SIGNATURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};return this.requestId&&(e[y.requestId]=new i.DataItem(this.requestId,l.UUID.getTag())),this.origin&&(e[y.origin]=this.origin),e[y.signature]=this.signature,new i.DataItem(e)},this.signature=e,this.requestId=t,this.origin=r}}m.fromDataItem=e=>{const t=e.getData(),r=t[y.signature],n=t[y.requestId]?t[y.requestId].getData():undefined;return new m(r,n,t[y.origin])},m.fromCBOR=e=>{const t=g(e);return m.fromDataItem(t)};const{decodeToDataItem:b}=i.extend;var v;!function(e){e[e.chainId=1]="chainId",e[e.contractAddress=2]="contractAddress",e[e.contractName=3]="contractName",e[e.name=4]="name",e[e.mediaData=5]="mediaData"}(v||(v={}));class k extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_NFT_ITEM,this.getChainId=()=>this.chainId,this.getName=()=>this.name,this.getmediaData=()=>this.mediaData,this.getContractAddress=()=>this.contractAddress,this.getContractName=()=>this.contractName,this.toDataItem=()=>{const e={};return e[v.chainId]=this.chainId,e[v.name]=this.name,e[v.contractAddress]=this.contractAddress,e[v.contractName]=this.contractName,e[v.mediaData]=this.mediaData,new i.DataItem(e)},this.chainId=e.chainId,this.name=e.name,this.contractAddress=e.contractAddress,this.contractName=e.contractName,this.mediaData=e.mediaData}static constructETHNFTItem(e,t,r,n,i){return new k({chainId:e,contractAddress:t,contractName:r,mediaData:i,name:n})}}k.fromDataItem=e=>{const t=e.getData(),r=t[v.chainId],n=t[v.name],i=t[v.mediaData],s=t[v.contractAddress],o=t[v.contractName];return new k({chainId:r,name:n,contractAddress:s,contractName:o,mediaData:i})},k.fromCBOR=e=>{const t=b(e);return k.fromDataItem(t)};const T=(e,t)=>{const r=o.fromExtendedKey(e).derive(t),n="0x"+a.publicToAddress(r.publicKey,!0).toString("hex");return a.toChecksumAddress(n)};i.patchTags(Object.values(c).filter((e=>!!e.getTag())).map((e=>e.getTag()))),Object.keys(i).forEach((function(e){"default"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})})),r.ETHNFTItem=k,r.ETHSignature=m,r.EthSignRequest=f,r.findHDPathFromAddress=(e,t,r,n)=>{for(let i=0;i<r;i++){const r=T(t,`M/0/${i}`);if(e.toLowerCase()==r.toLowerCase())return`${n}/0/${i}`}return null},r.generateAddressFromXpub=T}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry-eth/dist/bc-ur-registry-eth.cjs.development.js"}],[63,{"../../../shared/constants/metametrics":5730,"../../../shared/modules/hexstring-utils":5788,"@metamask/base-controller":1383,"@metamask/controller-utils":1474,"@metamask/message-manager":2081,"@metamask/utils":2950,buffer:4074,loglevel:4863},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.managerName=r.isEIP1024EncryptedMessage=r.getDefaultState=r.default=void 0;var n,i=(n=e("loglevel"))&&n.__esModule?n:{default:n},s=e("@metamask/message-manager"),o=e("@metamask/base-controller"),a=e("@metamask/controller-utils"),c=e("@metamask/utils"),u=e("../../../shared/constants/metametrics"),d=e("../../../shared/modules/hexstring-utils");function h(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const p={unapprovedDecryptMsgs:{persist:!1,anonymous:!1},unapprovedDecryptMsgCount:{persist:!1,anonymous:!1}},f=r.managerName="DecryptMessageManager",l=e=>!!((0,c.isObject)(e.data)&&(0,c.hasProperty)(e.data,"version")&&(0,c.hasProperty)(e.data,"nonce")&&(0,c.hasProperty)(e.data,"ephemPublicKey")&&(0,c.hasProperty)(e.data,"ciphertext"));r.isEIP1024EncryptedMessage=l;const g=()=>({unapprovedDecryptMsgs:{},unapprovedDecryptMsgCount:0});r.getDefaultState=g;class y extends o.BaseController{constructor({getState:e,metricsEvent:t,messenger:r,managerMessenger:n}){super({metadata:p,messenger:r,name:"DecryptMessageController",state:{unapprovedDecryptMsgs:{},unapprovedDecryptMsgCount:0}}),h(this,"_getState",void 0),h(this,"_metricsEvent",void 0),h(this,"_decryptMessageManager",void 0),this._getState=e,this._metricsEvent=t,this._decryptMessageManager=new s.DecryptMessageManager({additionalFinishStatuses:["decrypted"],messenger:n}),r.subscribe(`${f}:unapprovedMessage`,this._requestApproval.bind(this)),this._subscribeToMessageState(r,((e,t,r)=>{e.unapprovedDecryptMsgs=t,e.unapprovedDecryptMsgCount=r}))}get unapprovedDecryptMsgCount(){return this._decryptMessageManager.getUnapprovedMessagesCount()}resetState(){this.update((()=>({unapprovedDecryptMsgs:{},unapprovedDecryptMsgCount:0})))}clearUnapproved(){this._decryptMessageManager.clearUnapprovedMessages()}async newRequestDecryptMessage(e,t){return this._decryptMessageManager.addUnapprovedMessageAsync(e,t)}async decryptMessage(e){const t=e.metamaskId;try{const r=await this._decryptMessageManager.approveMessage(e);if(r.data=this._parseMessageData(r.data),!l(r))throw new Error("Invalid encrypted data.");const n=await this.messagingSystem.call("KeyringController:decryptMessage",r);this._decryptMessageManager.setMessageStatusAndResult(t,n,"decrypted"),this._acceptApproval(t)}catch(e){throw i.default.info("MetaMaskController - eth_decrypt failed.",e),this._cancelAbstractMessage(this._decryptMessageManager,t),e}return this._getState()}async decryptMessageInline(e){const t=e.metamaskId;if(e.data=this._parseMessageData(e.data),!l(e))throw new Error("Invalid encrypted data.");const r=await this.messagingSystem.call("KeyringController:decryptMessage",e);return this._decryptMessageManager.setResult(t,r),this._getState()}cancelDecryptMessage(e){return this._decryptMessageManager.rejectMessage(e),this._rejectApproval(e),this._getState()}rejectUnapproved(e){Object.keys(this._decryptMessageManager.getUnapprovedMessages()).forEach((t=>{this._cancelAbstractMessage(this._decryptMessageManager,t,e)}))}_acceptApproval(e){this.messagingSystem.call("ApprovalController:acceptRequest",e)}_cancelAbstractMessage(e,t,r){return r&&this._metricsEvent({event:r,category:u.MetaMetricsEventCategory.Messages,properties:{action:"Decrypt Message Request"}}),e.rejectMessage(t),this._rejectApproval(t),this._getState()}_subscribeToMessageState(e,t){e.subscribe(`${f}:stateChange`,(e=>{const r=this._migrateMessages(e.unapprovedMessages);this.update((n=>{t(n,r,e.unapprovedMessagesCount)}))}))}_migrateMessages(e){const t={};for(const r of Object.keys(e)){const n=e[r],i=this._migrateMessage(n);t[r]=i}return t}_migrateMessage(e){const{messageParams:t,...r}=e;return{...r,rawSig:e.rawSig,msgParams:t,origin:t.origin}}_requestApproval(e){const t=e.metamaskId,r=e.origin||a.ORIGIN_METAMASK;try{this.messagingSystem.call("ApprovalController:addRequest",{id:t,origin:r,type:a.ApprovalType.EthDecrypt},!0)}catch(e){i.default.info("Error adding request to approval controller",e)}}_parseMessageData(e){const r=(0,d.stripHexPrefix)(e),n=t.from(r,"hex");return JSON.parse(n.toString("utf8"))}_rejectApproval(e){try{this.messagingSystem.call("ApprovalController:rejectRequest",e,"Cancel")}catch(e){i.default.info("Error rejecting request to approval controller",e)}}}r.default=y}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"$root$",file:"app/scripts/controllers/decrypt-message.ts"}],[630,{"@ethereumjs/util":621,"@keystonehq/bc-ur-registry":651,buffer:4074,hdkey:4632,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("@keystonehq/bc-ur-registry"),s=e("uuid"),o=(n=e("hdkey"))&&"object"==typeof n&&"default"in n?n.default:n,a=e("@ethereumjs/util");const c={ETH_SIGN_REQUEST:new i.RegistryType("eth-sign-request",401),ETH_SIGNATURE:new i.RegistryType("eth-signature",402),ETH_NFT_ITEM:new i.RegistryType("eth-nft-item",403)},{decodeToDataItem:u,RegistryTypes:d}=i.extend;var h,p;!function(e){e[e.requestId=1]="requestId",e[e.signData=2]="signData",e[e.dataType=3]="dataType",e[e.chainId=4]="chainId",e[e.derivationPath=5]="derivationPath",e[e.address=6]="address",e[e.origin=7]="origin"}(h||(h={})),(p=r.DataType||(r.DataType={}))[p.transaction=1]="transaction",p[p.typedData=2]="typedData",p[p.personalMessage=3]="personalMessage",p[p.typedTransaction=4]="typedTransaction";class f extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_SIGN_REQUEST,this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSourceFingerprint=()=>this.derivationPath.getSourceFingerprint(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};this.requestId&&(e[h.requestId]=new i.DataItem(this.requestId,d.UUID.getTag())),this.address&&(e[h.address]=this.address),this.chainId&&(e[h.chainId]=Number(this.chainId)),this.origin&&(e[h.origin]=this.origin),e[h.signData]=this.signData,e[h.dataType]=this.dataType;const t=this.derivationPath.toDataItem();return t.setTag(this.derivationPath.getRegistryType().getTag()),e[h.derivationPath]=t,new i.DataItem(e)},this.requestId=e.requestId,this.signData=e.signData,this.dataType=e.dataType,this.chainId=e.chainId,this.derivationPath=e.derivationPath,this.address=e.address,this.origin=e.origin}static constructETHRequest(e,r,n,o,a,c,u,d){const h=n.replace(/[m|M]\//,"").split("/"),p=new i.CryptoKeypath(h.map((e=>{const t=parseInt(e.replace("'",""));let r=!1;return e.endsWith("'")&&(r=!0),new i.PathComponent({index:t,hardened:r})})),t.from(o,"hex"));return new f({requestId:a?t.from(s.parse(a)):void 0,signData:e,dataType:r,derivationPath:p,chainId:c,address:u?t.from(u.replace("0x",""),"hex"):void 0,origin:d||void 0})}}f.fromDataItem=e=>{const t=e.getData(),r=t[h.signData],n=t[h.dataType],s=i.CryptoKeypath.fromDataItem(t[h.derivationPath]),o=t[h.chainId]?t[h.chainId]:void 0,a=t[h.address]?t[h.address]:void 0,c=t[h.requestId]?t[h.requestId].getData():void 0;return new f({requestId:c,signData:r,dataType:n,chainId:o,derivationPath:s,address:a,origin:t[h.origin]?t[h.origin]:void 0})},f.fromCBOR=e=>{const t=u(e);return f.fromDataItem(t)};const{RegistryTypes:l,decodeToDataItem:g}=i.extend;var y;!function(e){e[e.requestId=1]="requestId",e[e.signature=2]="signature",e[e.origin=3]="origin"}(y||(y={}));class m extends i.RegistryItem{constructor(e,t,r){super(),this.getRegistryType=()=>c.ETH_SIGNATURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};return this.requestId&&(e[y.requestId]=new i.DataItem(this.requestId,l.UUID.getTag())),this.origin&&(e[y.origin]=this.origin),e[y.signature]=this.signature,new i.DataItem(e)},this.signature=e,this.requestId=t,this.origin=r}}m.fromDataItem=e=>{const t=e.getData(),r=t[y.signature],n=t[y.requestId]?t[y.requestId].getData():void 0;return new m(r,n,t[y.origin])},m.fromCBOR=e=>{const t=g(e);return m.fromDataItem(t)};const{decodeToDataItem:b}=i.extend;var v;!function(e){e[e.chainId=1]="chainId",e[e.contractAddress=2]="contractAddress",e[e.contractName=3]="contractName",e[e.name=4]="name",e[e.mediaData=5]="mediaData"}(v||(v={}));class k extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_NFT_ITEM,this.getChainId=()=>this.chainId,this.getName=()=>this.name,this.getmediaData=()=>this.mediaData,this.getContractAddress=()=>this.contractAddress,this.getContractName=()=>this.contractName,this.toDataItem=()=>{const e={};return e[v.chainId]=this.chainId,e[v.name]=this.name,e[v.contractAddress]=this.contractAddress,e[v.contractName]=this.contractName,e[v.mediaData]=this.mediaData,new i.DataItem(e)},this.chainId=e.chainId,this.name=e.name,this.contractAddress=e.contractAddress,this.contractName=e.contractName,this.mediaData=e.mediaData}static constructETHNFTItem(e,t,r,n,i){return new k({chainId:e,contractAddress:t,contractName:r,mediaData:i,name:n})}}k.fromDataItem=e=>{const t=e.getData();return new k({chainId:t[v.chainId],name:t[v.name],contractAddress:t[v.contractAddress],contractName:t[v.contractName],mediaData:t[v.mediaData]})},k.fromCBOR=e=>{const t=b(e);return k.fromDataItem(t)};const T=(e,t)=>{const r=o.fromExtendedKey(e).derive(t),n="0x"+a.publicToAddress(r.publicKey,!0).toString("hex");return a.toChecksumAddress(n)};i.patchTags(Object.values(c).filter((e=>!!e.getTag())).map((e=>e.getTag()))),Object.keys(i).forEach((function(e){"default"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})})),r.ETHNFTItem=k,r.ETHSignature=m,r.EthSignRequest=f,r.findHDPathFromAddress=(e,t,r,n)=>{for(let i=0;i<r;i++){const r=T(t,"M/0/"+i);if(e.toLowerCase()==r.toLowerCase())return`${n}/0/${i}`}return null},r.generateAddressFromXpub=T}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry-eth/dist/bc-ur-registry-eth.cjs.production.min.js"}],[631,{"./bc-ur-registry-eth.cjs.development.js":629,"./bc-ur-registry-eth.cjs.production.min.js":630},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){t.exports=e("./bc-ur-registry-eth.cjs.production.min.js")}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry-eth/dist/index.js"}],[632,{"./RegistryItem":643,"./RegistryType":644,"./lib":654},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Bytes=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");class o extends i.RegistryItem{constructor(e){super(),this.bytes=e,this.getRegistryType=()=>s.RegistryTypes.BYTES,this.getData=()=>this.bytes,this.toDataItem=()=>new n.DataItem(this.bytes)}}r.Bytes=o,o.fromDataItem=e=>{const t=e.getData();if(!t)throw new Error(`#[ur-registry][Bytes][fn.fromDataItem]: decoded [dataItem][#data] is undefined: ${e}`);return new o(t)},o.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return o.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/Bytes.js"}],[633,{".":651,"./RegistryItem":643,"./RegistryType":644,"./lib":654,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoAccount=void 0;const n=e("."),i=e("./lib"),s=e("./RegistryItem"),o=e("./RegistryType");var a;!function(e){e[e.masterFingerprint=1]="masterFingerprint",e[e.outputDescriptors=2]="outputDescriptors"}(a||(a={}));class c extends s.RegistryItem{constructor(e,t){super(),this.masterFingerprint=e,this.outputDescriptors=t,this.getRegistryType=()=>o.RegistryTypes.CRYPTO_ACCOUNT,this.getMasterFingerprint=()=>this.masterFingerprint,this.getOutputDescriptors=()=>this.outputDescriptors,this.toDataItem=()=>{const e={};return this.masterFingerprint&&(e[a.masterFingerprint]=this.masterFingerprint.readUInt32BE(0)),this.outputDescriptors&&(e[a.outputDescriptors]=this.outputDescriptors.map((e=>e.toDataItem()))),new i.DataItem(e)}}}r.CryptoAccount=c,c.fromDataItem=e=>{const r=e.getData(),i=t.alloc(4),s=r[a.masterFingerprint];s&&i.writeUInt32BE(s,0);const o=r[a.outputDescriptors].map((e=>n.CryptoOutput.fromDataItem(e)));return new c(i,o)},c.fromCBOR=e=>{const t=(0,i.decodeToDataItem)(e);return c.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoAccount.js"}],[634,{"./RegistryItem":643,"./RegistryType":644,"./lib":654},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoCoinInfo=r.Network=r.Type=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");var o,a,c;!function(e){e.type="1",e.network="2"}(o||(o={})),function(e){e[e.bitcoin=0]="bitcoin"}(a=r.Type||(r.Type={})),function(e){e[e.mainnet=0]="mainnet",e[e.testnet=1]="testnet"}(c=r.Network||(r.Network={}));class u extends i.RegistryItem{constructor(e,t){super(),this.type=e,this.network=t,this.getRegistryType=()=>s.RegistryTypes.CRYPTO_COIN_INFO,this.getType=()=>this.type||a.bitcoin,this.getNetwork=()=>this.network||c.mainnet,this.toDataItem=()=>{const e={};return this.type&&(e[o.type]=this.type),this.network&&(e[o.network]=this.network),new n.DataItem(e)}}}r.CryptoCoinInfo=u,u.fromDataItem=e=>{const t=e.getData(),r=t[o.type],n=t[o.network];return new u(r,n)},u.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return u.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoCoinInfo.js"}],[635,{"./RegistryItem":643,"./RegistryType":644,"./lib":654},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoECKey=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");var o;!function(e){e[e.curve=1]="curve",e[e.private=2]="private",e[e.data=3]="data"}(o||(o={}));class a extends i.RegistryItem{constructor(e){super(),this.isECKey=()=>!0,this.getCurve=()=>this.curve||0,this.isPrivateKey=()=>this.privateKey||!1,this.getData=()=>this.data,this.getRegistryType=()=>s.RegistryTypes.CRYPTO_ECKEY,this.toDataItem=()=>{const e={};return this.curve&&(e[o.curve]=this.curve),this.privateKey!==undefined&&(e[o.private]=this.privateKey),e[o.data]=this.data,new n.DataItem(e)},this.getOutputDescriptorContent=()=>this.data.toString("hex"),this.data=e.data,this.curve=e.curve,this.privateKey=e.privateKey||undefined}}r.CryptoECKey=a,a.fromDataItem=e=>{const t=e.getData(),r=t[o.curve],n=t[o.private],i=t[o.data];if(!i)throw new Error(`#[ur-registry][CryptoECKey][fn.fromDataItem]: decoded [dataItem][#data.data] is undefined: ${e}`);return new a({data:i,curve:r,privateKey:n})},a.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return a.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoECKey.js"}],[636,{"./CryptoCoinInfo":634,"./CryptoKeypath":637,"./RegistryItem":643,"./RegistryType":644,"./lib":654,bs58check:4077,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoHDKey=void 0;const n=e("bs58check"),i=e("./CryptoCoinInfo"),s=e("./CryptoKeypath"),o=e("./lib"),a=e("./RegistryItem"),c=e("./RegistryType");var u;!function(e){e[e.is_master=1]="is_master",e[e.is_private=2]="is_private",e[e.key_data=3]="key_data",e[e.chain_code=4]="chain_code",e[e.use_info=5]="use_info",e[e.origin=6]="origin",e[e.children=7]="children",e[e.parent_fingerprint=8]="parent_fingerprint",e[e.name=9]="name",e[e.note=10]="note"}(u||(u={}));class d extends a.RegistryItem{constructor(e){super(),this.isECKey=()=>!1,this.getKey=()=>this.key,this.getChainCode=()=>this.chainCode,this.isMaster=()=>this.master,this.isPrivateKey=()=>!!this.privateKey,this.getUseInfo=()=>this.useInfo,this.getOrigin=()=>this.origin,this.getChildren=()=>this.children,this.getParentFingerprint=()=>this.parentFingerprint,this.getName=()=>this.name,this.getNote=()=>this.note,this.getBip32Key=()=>{var e,r,i;let s,o,a=0,c=t.alloc(4).fill(0);if(this.isMaster())s=t.from("0488ADE4","hex"),o=0,a=0;else{o=(null===(e=this.getOrigin())||void 0===e?void 0:e.getComponents().length)||(null===(r=this.getOrigin())||void 0===r?void 0:r.getDepth());const n=null===(i=this.getOrigin())||void 0===i?void 0:i.getComponents(),u=n[n.length-1];u&&(a=u.isHardened()?u.getIndex()+2147483648:u.getIndex(),this.getParentFingerprint()&&(c=this.getParentFingerprint())),s=this.isPrivateKey()?t.from("0488ADE4","hex"):t.from("0488B21E","hex")}const u=t.alloc(1);u.writeUInt8(o,0);const d=t.alloc(4);d.writeUInt32BE(a,0);const h=this.getChainCode(),p=this.getKey();return(0,n.encode)(t.concat([s,u,c,d,h,p]))},this.getRegistryType=()=>c.RegistryTypes.CRYPTO_HDKEY,this.getOutputDescriptorContent=()=>{var e,t,r,n,i,s,o;let a="";return this.getOrigin()&&(null===(e=this.getOrigin())||void 0===e?void 0:e.getSourceFingerprint())&&(null===(t=this.getOrigin())||void 0===t?void 0:t.getPath())&&(a+=`${null===(n=null===(r=this.getOrigin())||void 0===r?void 0:r.getSourceFingerprint())||void 0===n?void 0:n.toString("hex")}/${null===(i=this.getOrigin())||void 0===i?void 0:i.getPath()}`),a+=this.getBip32Key(),this.getChildren()&&(null===(s=this.getChildren())||void 0===s?void 0:s.getPath())&&(a+=`/${null===(o=this.getChildren())||void 0===o?void 0:o.getPath()}`),a},this.setupMasterKey=e=>{this.master=!0,this.key=e.key,this.chainCode=e.chainCode},this.setupDeriveKey=e=>{this.master=!1,this.privateKey=e.isPrivateKey,this.key=e.key,this.chainCode=e.chainCode,this.useInfo=e.useInfo,this.origin=e.origin,this.children=e.children,this.parentFingerprint=e.parentFingerprint,this.name=e.name,this.note=e.note},this.toDataItem=()=>{const e={};if(this.master)e[u.is_master]=!0,e[u.key_data]=this.key,e[u.chain_code]=this.chainCode;else{if(this.privateKey!==undefined&&(e[u.is_private]=this.privateKey),e[u.key_data]=this.key,this.chainCode&&(e[u.chain_code]=this.chainCode),this.useInfo){const t=this.useInfo.toDataItem();t.setTag(this.useInfo.getRegistryType().getTag()),e[u.use_info]=t}if(this.origin){const t=this.origin.toDataItem();t.setTag(this.origin.getRegistryType().getTag()),e[u.origin]=t}if(this.children){const t=this.children.toDataItem();t.setTag(this.children.getRegistryType().getTag()),e[u.children]=t}this.parentFingerprint&&(e[u.parent_fingerprint]=this.parentFingerprint.readUInt32BE(0)),this.name!==undefined&&(e[u.name]=this.name),this.note!==undefined&&(e[u.note]=this.note)}return new o.DataItem(e)},e.isMaster?this.setupMasterKey(e):this.setupDeriveKey(e)}}r.CryptoHDKey=d,d.fromDataItem=e=>{const r=e.getData(),n=!!r[u.is_master],o=r[u.is_private],a=r[u.key_data],c=r[u.chain_code],h=r[u.use_info]?i.CryptoCoinInfo.fromDataItem(r[u.use_info]):undefined,p=r[u.origin]?s.CryptoKeypath.fromDataItem(r[u.origin]):undefined,f=r[u.children]?s.CryptoKeypath.fromDataItem(r[u.children]):undefined,l=r[u.parent_fingerprint];let g=undefined;l&&(g=t.alloc(4),g.writeUInt32BE(l,0));const y=r[u.name],m=r[u.note];return new d({isMaster:n,isPrivateKey:o,key:a,chainCode:c,useInfo:h,origin:p,children:f,parentFingerprint:g,name:y,note:m})},d.fromCBOR=e=>{const t=(0,o.decodeToDataItem)(e);return d.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoHDKey.js"}],[637,{"./PathComponent":642,"./RegistryItem":643,"./RegistryType":644,"./lib":654,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoKeypath=void 0;const n=e("./lib"),i=e("./PathComponent"),s=e("./RegistryItem"),o=e("./RegistryType");var a;!function(e){e[e.components=1]="components",e[e.source_fingerprint=2]="source_fingerprint",e[e.depth=3]="depth"}(a||(a={}));class c extends s.RegistryItem{constructor(e=[],t,r){super(),this.components=e,this.sourceFingerprint=t,this.depth=r,this.getRegistryType=()=>o.RegistryTypes.CRYPTO_KEYPATH,this.getPath=()=>{if(0===this.components.length)return undefined;return this.components.map((e=>`${e.isWildcard()?"*":e.getIndex()}${e.isHardened()?"'":""}`)).join("/")},this.getComponents=()=>this.components,this.getSourceFingerprint=()=>this.sourceFingerprint,this.getDepth=()=>this.depth,this.toDataItem=()=>{const e={},t=[];return this.components&&this.components.forEach((e=>{e.isWildcard()?t.push([]):t.push(e.getIndex()),t.push(e.isHardened())})),e[a.components]=t,this.sourceFingerprint&&(e[a.source_fingerprint]=this.sourceFingerprint.readUInt32BE(0)),this.depth!==undefined&&(e[a.depth]=this.depth),new n.DataItem(e)}}}r.CryptoKeypath=c,c.fromDataItem=e=>{const r=e.getData(),n=[],s=r[a.components];if(s)for(let e=0;e<s.length;e+=2){const t=s[e+1],r=s[e];"number"==typeof r?n.push(new i.PathComponent({index:r,hardened:t})):n.push(new i.PathComponent({hardened:t}))}const o=r[a.source_fingerprint];let u;o&&(u=t.alloc(4),u.writeUInt32BE(o,0));const d=r[a.depth];return new c(n,u,d)},c.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return c.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoKeypath.js"}],[638,{"./CryptoECKey":635,"./CryptoHDKey":636,"./MultiKey":641,"./RegistryItem":643,"./RegistryType":644,"./ScriptExpression":645,"./lib":654},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoOutput=void 0;const n=e("./CryptoECKey"),i=e("./CryptoHDKey"),s=e("./lib"),o=e("./MultiKey"),a=e("./RegistryItem"),c=e("./RegistryType"),u=e("./ScriptExpression");class d extends a.RegistryItem{constructor(e,t){super(),this.scriptExpressions=e,this.cryptoKey=t,this.getRegistryType=()=>c.RegistryTypes.CRYPTO_OUTPUT,this.getCryptoKey=()=>this.cryptoKey,this.getHDKey=()=>this.cryptoKey instanceof i.CryptoHDKey?this.cryptoKey:undefined,this.getECKey=()=>this.cryptoKey instanceof n.CryptoECKey?this.cryptoKey:undefined,this.getMultiKey=()=>this.cryptoKey instanceof o.MultiKey?this.cryptoKey:undefined,this.getScriptExpressions=()=>this.scriptExpressions,this._toOutputDescriptor=e=>e>=this.scriptExpressions.length?this.cryptoKey.getOutputDescriptorContent():`${this.scriptExpressions[e].getExpression()}(${this._toOutputDescriptor(e+1)})`,this.toString=()=>this._toOutputDescriptor(0),this.toDataItem=()=>{let e=this.cryptoKey.toDataItem();(this.cryptoKey instanceof n.CryptoECKey||this.cryptoKey instanceof i.CryptoHDKey)&&e.setTag(this.cryptoKey.getRegistryType().getTag());return[...this.scriptExpressions].reverse().forEach((t=>{const r=t.getTag();e.getTag()===undefined?e.setTag(r):e=new s.DataItem(e,r)})),e}}}r.CryptoOutput=d,d.fromDataItem=e=>{const t=[];let r=e;for(;;){let e=r.getTag();const n=u.ScriptExpression.fromTag(e);if(!n)break;if(t.push(n),!(r.getData()instanceof s.DataItem))break;r=r.getData(),e=r.getTag()}const a=t.length;if(a>0&&(t[a-1].getExpression()===u.ScriptExpressions.MULTISIG.getExpression()||t[a-1].getExpression()===u.ScriptExpressions.SORTED_MULTISIG.getExpression())){const e=o.MultiKey.fromDataItem(r);return new d(t,e)}if(r.getTag()===c.RegistryTypes.CRYPTO_HDKEY.getTag()){const e=i.CryptoHDKey.fromDataItem(r);return new d(t,e)}{const e=n.CryptoECKey.fromDataItem(r);return new d(t,e)}},d.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return d.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoOutput.js"}],[639,{"./RegistryItem":643,"./RegistryType":644,"./lib":654},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoPSBT=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");class o extends i.RegistryItem{constructor(e){super(),this.psbt=e,this.getRegistryType=()=>s.RegistryTypes.CRYPTO_PSBT,this.getPSBT=()=>this.psbt,this.toDataItem=()=>new n.DataItem(this.psbt)}}r.CryptoPSBT=o,o.fromDataItem=e=>{const t=e.getData();if(!t)throw new Error(`#[ur-registry][CryptoPSBT][fn.fromDataItem]: decoded [dataItem][#data] is undefined: ${e}`);return new o(t)},o.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return o.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoPSBT.js"}],[64,{"../../../shared/constants/app":5719,"../../../shared/constants/keyring":5727,"../../../shared/constants/metametrics":5730,"@metamask/base-controller":1383,"@metamask/message-manager":2081,loglevel:4863},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,i=(n=e("loglevel"))&&n.__esModule?n:{default:n},s=e("@metamask/message-manager"),o=e("@metamask/base-controller"),a=e("../../../shared/constants/metametrics"),c=e("../../../shared/constants/keyring"),u=e("../../../shared/constants/app");function d(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const h="EncryptionPublicKeyManager",p={unapprovedEncryptionPublicKeyMsgs:{persist:!1,anonymous:!1},unapprovedEncryptionPublicKeyMsgCount:{persist:!1,anonymous:!1}};class f extends o.BaseController{constructor({messenger:e,managerMessenger:t,getEncryptionPublicKey:r,getAccountKeyringType:n,getState:i,metricsEvent:o}){super({name:"EncryptionPublicKeyController",metadata:p,messenger:e,state:{unapprovedEncryptionPublicKeyMsgs:{},unapprovedEncryptionPublicKeyMsgCount:0}}),d(this,"_getEncryptionPublicKey",void 0),d(this,"_getAccountKeyringType",void 0),d(this,"_getState",void 0),d(this,"_encryptionPublicKeyManager",void 0),d(this,"_metricsEvent",void 0),this._getEncryptionPublicKey=r,this._getAccountKeyringType=n,this._getState=i,this._metricsEvent=o,this._encryptionPublicKeyManager=new s.EncryptionPublicKeyManager({additionalFinishStatuses:["received"],messenger:t}),this.messagingSystem.subscribe(`${h}:unapprovedMessage`,this._requestApproval.bind(this)),this._subscribeToMessageState(e,((e,t,r)=>{e.unapprovedEncryptionPublicKeyMsgs=t,e.unapprovedEncryptionPublicKeyMsgCount=r}))}get unapprovedMsgCount(){return this._encryptionPublicKeyManager.getUnapprovedMessagesCount()}resetState(){this.update((()=>({unapprovedEncryptionPublicKeyMsgs:{},unapprovedEncryptionPublicKeyMsgCount:0})))}async newRequestEncryptionPublicKey(e,t){switch(await this._getAccountKeyringType(e)){case c.KeyringType.ledger:return new Promise(((e,t)=>{t(new Error("Ledger does not support eth_getEncryptionPublicKey."))}));case c.KeyringType.trezor:return new Promise(((e,t)=>{t(new Error("Trezor does not support eth_getEncryptionPublicKey."))}));case c.KeyringType.lattice:return new Promise(((e,t)=>{t(new Error("Lattice does not support eth_getEncryptionPublicKey."))}));case c.KeyringType.qr:return Promise.reject(new Error("QR hardware does not support eth_getEncryptionPublicKey."));default:return this._encryptionPublicKeyManager.addUnapprovedMessageAsync({from:e},t)}}async encryptionPublicKey(e){i.default.info("MetaMaskController - encryptionPublicKey");const t=e.metamaskId;try{const r=await this._encryptionPublicKeyManager.approveMessage(e),n=await this._getEncryptionPublicKey(r.from);return this._encryptionPublicKeyManager.setMessageStatusAndResult(t,n,"received"),this._acceptApproval(t),this._getState()}catch(e){throw i.default.info("MetaMaskController - eth_getEncryptionPublicKey failed.",e),this._cancelAbstractMessage(this._encryptionPublicKeyManager,t),e}}cancelEncryptionPublicKey(e){return this._cancelAbstractMessage(this._encryptionPublicKeyManager,e)}rejectUnapproved(e){Object.keys(this._encryptionPublicKeyManager.getUnapprovedMessages()).forEach((t=>{this._cancelAbstractMessage(this._encryptionPublicKeyManager,t,e)}))}clearUnapproved(){this._encryptionPublicKeyManager.clearUnapprovedMessages()}_cancelAbstractMessage(e,t,r){return r&&this._metricsEvent({event:r,category:a.MetaMetricsEventCategory.Messages,properties:{action:"Encryption public key Request"}}),e.rejectMessage(t),this._rejectApproval(t),this._getState()}_subscribeToMessageState(e,t){e.subscribe(`${h}:stateChange`,(e=>{const r=this._migrateMessages(e.unapprovedMessages);this.update((n=>{t(n,r,e.unapprovedMessagesCount)}))}))}_migrateMessages(e){const t={};for(const r of Object.keys(e)){const n=e[r],i=this._migrateMessage(n);t[r]=i}return t}_migrateMessage(e){const{messageParams:t,...r}=e;return{...r,rawSig:e.rawSig,msgParams:t.from,origin:t.origin}}_requestApproval(e){const t=e.metamaskId,r=e.origin||u.ORIGIN_METAMASK;this.messagingSystem.call("ApprovalController:addRequest",{id:t,origin:r,type:"eth_getEncryptionPublicKey"},!0).catch((()=>{}))}_acceptApproval(e){this.messagingSystem.call("ApprovalController:acceptRequest",e)}_rejectApproval(e){this.messagingSystem.call("ApprovalController:rejectRequest",e,"Cancel")}}r.default=f}}},{package:"$root$",file:"app/scripts/controllers/encryption-public-key.ts"}],[640,{"..":651,"../RegistryType":644,"../errors":646,"@ngraveio/bc-ur":2969},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.URRegistryDecoder=void 0;const n=e("@ngraveio/bc-ur"),i=e(".."),s=e("../RegistryType"),o=e("../errors");class a extends n.URDecoder{constructor(){super(...arguments),this.resultRegistryType=()=>{const e=this.resultUR();switch(e.type){case s.RegistryTypes.BYTES.getType():return i.Bytes.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_HDKEY.getType():return i.CryptoHDKey.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_KEYPATH.getType():return i.CryptoKeypath.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_COIN_INFO.getType():return i.CryptoCoinInfo.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_ECKEY.getType():return i.CryptoECKey.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_OUTPUT.getType():return i.CryptoOutput.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_PSBT.getType():return i.CryptoPSBT.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_ACCOUNT.getType():return i.CryptoAccount.fromCBOR(e.cbor);default:throw new o.UnknownURTypeError(`#[ur-registry][Decoder][fn.resultRegistryType]: registry type ${e.type} is not supported now`)}}}}r.URRegistryDecoder=a}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/Decoder/index.js"}],[641,{"./CryptoECKey":635,"./CryptoHDKey":636,"./RegistryItem":643,"./RegistryType":644,"./lib/DataItem":652},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.MultiKey=void 0;const n=e("./CryptoECKey"),i=e("./CryptoHDKey"),s=e("./lib/DataItem"),o=e("./RegistryItem"),a=e("./RegistryType");var c;!function(e){e[e.threshold=1]="threshold",e[e.keys=2]="keys"}(c||(c={}));class u extends o.RegistryItem{constructor(e,t){super(),this.threshold=e,this.keys=t,this.getThreshold=()=>this.threshold,this.getKeys=()=>this.keys,this.toDataItem=()=>{const e={};e[c.threshold]=this.threshold;const t=this.keys.map((e=>{const t=e.toDataItem();return t.setTag(e.getRegistryType().getTag()),t}));return e[c.keys]=t,new s.DataItem(e)},this.getOutputDescriptorContent=()=>[this.getThreshold(),this.keys.map((e=>e.getOutputDescriptorContent())).join(",")].join(",")}}r.MultiKey=u,u.fromDataItem=e=>{const t=e.getData(),r=t[c.threshold],s=t[c.keys],o=[];return s.forEach((e=>{e.getTag()===a.RegistryTypes.CRYPTO_HDKEY.getTag()?o.push(i.CryptoHDKey.fromDataItem(e)):e.getTag()===a.RegistryTypes.CRYPTO_ECKEY.getTag()&&o.push(n.CryptoECKey.fromDataItem(e))})),new u(r,o)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/MultiKey.js"}],[642,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.PathComponent=void 0;class n{constructor(e){if(this.getIndex=()=>this.index,this.isWildcard=()=>this.wildcard,this.isHardened=()=>this.hardened,this.index=e.index,this.hardened=e.hardened,this.index!==undefined?this.wildcard=!1:this.wildcard=!0,this.index&&this.index&n.HARDENED_BIT)throw new Error(`#[ur-registry][PathComponent][fn.constructor]: Invalid index ${this.index} - most significant bit cannot be set`)}}r.PathComponent=n,n.HARDENED_BIT=2147483648}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/PathComponent.js"}],[643,{"./lib":654,"@ngraveio/bc-ur":2969},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.RegistryItem=void 0;const n=e("@ngraveio/bc-ur"),i=e("./lib");r.RegistryItem=class{constructor(){this.toCBOR=()=>{if(this.toDataItem()===undefined)throw new Error(`#[ur-registry][RegistryItem][fn.toCBOR]: registry ${this.getRegistryType()}'s method toDataItem returns undefined`);return(0,i.encodeDataItem)(this.toDataItem())},this.toUR=()=>new n.UR(this.toCBOR(),this.getRegistryType().getType()),this.toUREncoder=(e,t,r)=>{const i=this.toUR();return new n.UREncoder(i,e,t,r)}}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/RegistryItem.js"}],[644,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.RegistryTypes=r.RegistryType=void 0;class n{constructor(e,t){this.type=e,this.tag=t,this.getTag=()=>this.tag,this.getType=()=>this.type}}r.RegistryType=n,r.RegistryTypes={UUID:new n("uuid",37),BYTES:new n("bytes",undefined),CRYPTO_HDKEY:new n("crypto-hdkey",303),CRYPTO_KEYPATH:new n("crypto-keypath",304),CRYPTO_COIN_INFO:new n("crypto-coin-info",305),CRYPTO_ECKEY:new n("crypto-eckey",306),CRYPTO_OUTPUT:new n("crypto-output",308),CRYPTO_PSBT:new n("crypto-psbt",310),CRYPTO_ACCOUNT:new n("crypto-account",311),CRYPTO_MULTI_ACCOUNTS:new n("crypto-multi-accounts",1103),QR_HARDWARE_CALL:new n("qr-hardware-call",1201),KEY_DERIVATION_CALL:new n("key-derivation-call",1301),KEY_DERIVATION_SCHEMA:new n("key-derivation-schema",1302)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/RegistryType.js"}],[645,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.ScriptExpressions=r.ScriptExpression=void 0;class n{constructor(e,t){this.tag=e,this.expression=t,this.getTag=()=>this.tag,this.getExpression=()=>this.expression}}r.ScriptExpression=n,n.fromTag=e=>Object.values(r.ScriptExpressions).find((t=>t.getTag()===e)),r.ScriptExpressions={SCRIPT_HASH:new n(400,"sh"),WITNESS_SCRIPT_HASH:new n(401,"wsh"),PUBLIC_KEY:new n(402,"pk"),PUBLIC_KEY_HASH:new n(403,"pkh"),WITNESS_PUBLIC_KEY_HASH:new n(404,"wpkh"),COMBO:new n(405,"combo"),MULTISIG:new n(406,"multi"),SORTED_MULTISIG:new n(407,"sortedmulti"),ADDRESS:new n(307,"addr"),RAW_SCRIPT:new n(408,"raw")}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/ScriptExpression.js"}],[646,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.UnknownURTypeError=void 0;class n extends Error{constructor(e){super(e)}}r.UnknownURTypeError=n}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/errors/index.js"}],[647,{"../CryptoHDKey":636,"../RegistryItem":643,"../RegistryType":644,"../lib":654,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoMultiAccounts=void 0;const n=e("../RegistryType"),i=e("../CryptoHDKey"),s=e("../RegistryItem"),o=e("../lib");var a;!function(e){e[e.masterFingerprint=1]="masterFingerprint",e[e.keys=2]="keys",e[e.device=3]="device",e[e.deviceId=4]="deviceId",e[e.version=5]="version"}(a||(a={}));class c extends s.RegistryItem{constructor(e,t,r,i,s){super(),this.masterFingerprint=e,this.keys=t,this.device=r,this.deviceId=i,this.version=s,this.getRegistryType=()=>n.RegistryTypes.CRYPTO_MULTI_ACCOUNTS,this.getMasterFingerprint=()=>this.masterFingerprint,this.getKeys=()=>this.keys,this.getDevice=()=>this.device,this.getDeviceId=()=>this.deviceId,this.getVersion=()=>this.version,this.toDataItem=()=>{const e={};return this.masterFingerprint&&(e[a.masterFingerprint]=this.masterFingerprint.readUInt32BE(0)),this.keys&&(e[a.keys]=this.keys.map((e=>{const t=e.toDataItem();return t.setTag(e.getRegistryType().getTag()),t}))),this.device&&(e[a.device]=this.device),this.deviceId&&(e[a.deviceId]=this.deviceId),this.version&&(e[a.version]=this.version),new o.DataItem(e)}}}r.CryptoMultiAccounts=c,c.fromDataItem=e=>{const r=e.getData(),n=t.alloc(4),s=r[a.masterFingerprint];s&&n.writeUInt32BE(s,0);const o=r[a.keys].map((e=>i.CryptoHDKey.fromDataItem(e))),u=r[a.device],d=r[a.deviceId],h=r[a.version];return new c(n,o,u,d,h)},c.fromCBOR=e=>{const t=(0,o.decodeToDataItem)(e);return c.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/CryptoMultiAccounts.js"}],[648,{"../CryptoKeypath":637,"../RegistryItem":643,"../RegistryType":644,"../lib":654},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.KeyDerivationSchema=r.DerivationAlgorithm=r.Curve=void 0;const n=e("../RegistryType"),i=e("../RegistryItem"),s=e("../lib"),o=e("../CryptoKeypath");var a,c,u;!function(e){e[e.keyPath=1]="keyPath",e[e.curve=2]="curve",e[e.algo=3]="algo"}(a||(a={})),function(e){e[e.secp256k1=0]="secp256k1",e[e.ed25519=1]="ed25519"}(c=r.Curve||(r.Curve={})),function(e){e[e.slip10=0]="slip10",e[e.bip32ed25519=1]="bip32ed25519"}(u=r.DerivationAlgorithm||(r.DerivationAlgorithm={}));class d extends i.RegistryItem{constructor(e,t=c.secp256k1,r=u.slip10){super(),this.keypath=e,this.curve=t,this.algo=r,this.getRegistryType=()=>n.RegistryTypes.KEY_DERIVATION_SCHEMA,this.getKeypath=()=>this.keypath,this.getCurve=()=>this.curve,this.getAlgo=()=>this.algo,this.toDataItem=()=>{const e={},t=this.getKeypath().toDataItem();return t.setTag(this.getKeypath().getRegistryType().getTag()),e[a.keyPath]=t,e[a.curve]=this.curve,e[a.algo]=this.algo,new s.DataItem(e)}}}r.KeyDerivationSchema=d,d.fromDataItem=e=>{const t=e.getData(),r=o.CryptoKeypath.fromDataItem(t[a.keyPath]),n=t[a.curve],i=t[a.algo];return new d(r,n,i)},d.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return d.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/DerivationSchema.js"}],[649,{"../RegistryItem":643,"../RegistryType":644,"../lib":654,"./DerivationSchema":648},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.KeyDerivation=void 0;const n=e("../RegistryType"),i=e("../RegistryItem"),s=e("../lib"),o=e("./DerivationSchema");var a;!function(e){e[e.schemas=1]="schemas"}(a||(a={}));class c extends i.RegistryItem{constructor(e){super(),this.schemas=e,this.getRegistryType=()=>n.RegistryTypes.KEY_DERIVATION_CALL,this.getSchemas=()=>this.schemas,this.toDataItem=()=>{const e={};return e[a.schemas]=this.schemas.map((e=>{const t=e.toDataItem();return t.setTag(e.getRegistryType().getTag()),t})),new s.DataItem(e)}}}r.KeyDerivation=c,c.fromDataItem=e=>{const t=e.getData()[a.schemas].map((e=>o.KeyDerivationSchema.fromDataItem(e)));return new c(t)},c.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return c.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/KeyDerivation.js"}],[65,{"../../../development/build/constants":369,"../../../shared/constants/alarms":5716,"../../../shared/constants/app":5719,"../../../shared/constants/keyring":5727,"../../../shared/constants/metametrics":5730,"../../../shared/constants/time":5747,"../../../shared/constants/transaction":5749,"../../../shared/modules/mv3.utils":5791,"../lib/util":187,"@metamask/base-controller":1383,"@metamask/name-controller":2164,"@metamask/utils":2950,buffer:4074,"ethereumjs-util":4327,lodash:4855,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.overrideAnonymousEventNames=r.getDefaultMetaMetricsControllerState=r.default=void 0;var n=e("lodash"),i=e("ethereumjs-util"),s=e("uuid"),o=e("@metamask/name-controller"),a=e("@metamask/utils"),c=e("@metamask/base-controller"),u=e("../../../shared/constants/app"),d=e("../../../shared/constants/metametrics"),h=e("../../../shared/constants/time"),p=e("../../../shared/modules/mv3.utils"),f=e("../../../shared/constants/alarms"),l=e("../lib/util"),g=e("../../../shared/constants/transaction"),y=e("../../../development/build/constants"),m=e("../../../shared/constants/keyring");function b(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e,t,r){k(e,t),t.set(e,r)}function k(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function T(e,t){return e.get(I(e,t))}function w(e,t,r){return e.set(I(e,t),r),r}function I(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const _=r.overrideAnonymousEventNames={[g.TransactionMetaMetricsEvent.added]:g.AnonymousTransactionMetaMetricsEvent.added,[g.TransactionMetaMetricsEvent.approved]:g.AnonymousTransactionMetaMetricsEvent.approved,[g.TransactionMetaMetricsEvent.finalized]:g.AnonymousTransactionMetaMetricsEvent.finalized,[g.TransactionMetaMetricsEvent.rejected]:g.AnonymousTransactionMetaMetricsEvent.rejected,[g.TransactionMetaMetricsEvent.submitted]:g.AnonymousTransactionMetaMetricsEvent.submitted,[d.MetaMetricsEventName.SignatureRequested]:d.MetaMetricsEventName.SignatureRequestedAnon,[d.MetaMetricsEventName.SignatureApproved]:d.MetaMetricsEventName.SignatureApprovedAnon,[d.MetaMetricsEventName.SignatureRejected]:d.MetaMetricsEventName.SignatureRejectedAnon},C=e=>{setTimeout((()=>{throw e}))},E=e=>{const t=[];return e.uniqueIdentifier&&t.push(e.uniqueIdentifier),e.actionId&&t.push(e.actionId),t.length&&e.isDuplicateAnonymizedEvent&&t.push("0x000"),t.length?t.join("-"):(0,l.generateRandomId)()},D={'You must pass either an "anonymousId" or a "userId".':!0},S={metaMetricsId:{persist:!0,anonymous:!0},participateInMetaMetrics:{persist:!0,anonymous:!0},latestNonAnonymousEventTimestamp:{persist:!0,anonymous:!0},fragments:{persist:!0,anonymous:!1},eventsBeforeMetricsOptIn:{persist:!0,anonymous:!1},traits:{persist:!0,anonymous:!1},dataCollectionForMarketing:{persist:!0,anonymous:!1},marketingCampaignCookieId:{persist:!0,anonymous:!0},segmentApiCalls:{persist:!0,anonymous:!1}},A=()=>({participateInMetaMetrics:null,metaMetricsId:null,dataCollectionForMarketing:null,marketingCampaignCookieId:null,latestNonAnonymousEventTimestamp:0,eventsBeforeMetricsOptIn:[],traits:{},fragments:{},segmentApiCalls:{}});r.getDefaultMetaMetricsControllerState=A;var R=new WeakMap,P=new WeakMap,x=new WeakMap,O=new WeakMap,M=new WeakSet,B=new WeakMap;class K extends c.BaseController{constructor({state:e={},messenger:t,segment:r,version:i,environment:s,extension:o,captureException:c=C}){var u,d;super({name:"MetaMetricsController",metadata:S,state:{participateInMetaMetrics:null,metaMetricsId:null,dataCollectionForMarketing:null,marketingCampaignCookieId:null,latestNonAnonymousEventTimestamp:0,eventsBeforeMetricsOptIn:[],traits:{},fragments:{},segmentApiCalls:{},...e},messenger:t}),k(u=this,d=M),d.add(u),v(this,R,void 0),b(this,"chainId",void 0),b(this,"locale",void 0),b(this,"previousUserTraits",void 0),b(this,"version",void 0),v(this,P,void 0),v(this,x,void 0),v(this,O,void 0),v(this,B,(0,n.memoize)(((e={})=>Object.values(e).reduce(((e,t)=>e.concat(...Object.values(t))),[])))),w(R,this,(e=>{const t=(0,a.getErrorMessage)(e);D[t]||c(e)})),this.chainId=I(M,this,q).call(this);const g=this.messagingSystem.call("PreferencesController:getState");this.locale=g.currentLocale.replace("_","-"),this.version="production"===s?i:`${i}-${s}`,w(P,this,o),w(x,this,s);const y=(0,n.omitBy)(e.fragments,"persist");this.messagingSystem.subscribe("PreferencesController:stateChange",(({currentLocale:e})=>{this.locale=null==e?void 0:e.replace("_","-")})),this.messagingSystem.subscribe("NetworkController:networkDidChange",(({selectedNetworkClientId:e})=>{this.chainId=I(M,this,q).call(this,e)})),w(O,this,r),Object.values(y).forEach((e=>{this.processAbandonedFragment(e)})),p.isManifestV3&&Object.values(e.segmentApiCalls||{}).forEach((({eventType:e,payload:t})=>{try{I(M,this,J).call(this,e,t)}catch(e){T(R,this).call(this,e)}})),p.isManifestV3?(T(P,this).alarms.getAll().then((e=>{(0,l.checkAlarmExists)(e,f.METAMETRICS_FINALIZE_EVENT_FRAGMENT_ALARM)||T(P,this).alarms.create(f.METAMETRICS_FINALIZE_EVENT_FRAGMENT_ALARM,{delayInMinutes:1,periodInMinutes:1})})),T(P,this).alarms.onAlarm.addListener((e=>{e.name===f.METAMETRICS_FINALIZE_EVENT_FRAGMENT_ALARM&&this.finalizeAbandonedFragments()}))):setInterval((()=>{this.finalizeAbandonedFragments()}),30*h.SECOND)}finalizeAbandonedFragments(){Object.values(this.state.fragments).forEach((e=>{e.timeout&&e.lastUpdated&&Date.now()-e.lastUpdated/1e3>e.timeout&&this.processAbandonedFragment(e)}))}generateMetaMetricsId(){return(0,i.bufferToHex)((0,i.keccak)(t.from(String(Date.now())+String(Math.round(Math.random()*Number.MAX_SAFE_INTEGER)))))}createEventFragment(e){if(!e.successEvent||!e.category)throw new Error(`Must specify success event and category. Success event was: ${e.event}. Category was: ${e.category}. Payload keys were: ${Object.keys(e)}. ${"object"==typeof e.properties?`Payload property keys were: ${Object.keys(e.properties)}`:""}`);const{fragments:t}=this.state,r=e.uniqueIdentifier??(0,s.v4)(),i={id:r,...e,lastUpdated:Date.now()},o=e.initialEvent===g.TransactionMetaMetricsEvent.submitted&&t[r]?{...t[r],canDeleteIfAbandoned:!1}:{};return this.update((e=>{e.fragments[r]=(0,n.merge)({},o,i)})),i.initialEvent&&this.trackEvent({event:i.initialEvent,category:i.category,properties:i.properties,sensitiveProperties:i.sensitiveProperties,page:i.page,referrer:i.referrer,revenue:i.revenue,value:i.value,currency:i.currency,environmentType:i.environmentType,actionId:e.actionId,uniqueIdentifier:e.uniqueIdentifier}),i}getEventFragmentById(e){return this.state.fragments[e]}processAbandonedFragment(e){e.canDeleteIfAbandoned?this.deleteEventFragment(e.id):this.finalizeEventFragment(e.id,{abandoned:!0})}updateEventFragment(e,t){const{fragments:r}=this.state,i=r[e];if(!i&&e.includes("transaction-submitted-"))this.update((r=>{r.fragments[e]={canDeleteIfAbandoned:!0,category:d.MetaMetricsEventCategory.Transactions,successEvent:g.TransactionMetaMetricsEvent.finalized,id:e,...t,lastUpdated:Date.now()}}));else{if(!i)throw new Error(`Event fragment with id ${e} does not exist.`);this.update((r=>{r.fragments[e]=(0,n.merge)(r.fragments[e],{...t,lastUpdated:Date.now()})}))}}deleteEventFragment(e){this.state.fragments[e]&&this.update((t=>{delete t.fragments[e]}))}finalizeEventFragment(e,{abandoned:t=!1,page:r,referrer:n}={}){const i=this.state.fragments[e];if(!i)throw new Error(`Funnel with id ${e} does not exist.`);const s=t?i.failureEvent:i.successEvent;this.trackEvent({event:s??"",category:i.category,properties:i.properties,sensitiveProperties:i.sensitiveProperties,page:r??i.page,referrer:i.referrer??n,revenue:i.revenue,value:i.value,currency:i.currency,environmentType:i.environmentType,actionId:i.actionId,uniqueIdentifier:i.uniqueIdentifier?`${i.uniqueIdentifier}-${t?"failure":"success"}`:undefined}),this.update((t=>{delete t.fragments[e]}))}identify(e){const{metaMetricsId:t,participateInMetaMetrics:r}=this.state;if(!r||!t||!e)return;if("object"!=typeof e)return void console.warn("MetaMetricsController#identify: userTraits parameter must be an object. Received type: "+typeof e);const n=I(M,this,H).call(this,e);I(M,this,z).call(this,n)}updateExtensionUninstallUrl(e,r){const n={av:this.version};e&&(n.mmi=t.from(r).toString("base64"),n.env=T(x,this));const i=new URLSearchParams(n);T(P,this)&&T(P,this).runtime&&T(P,this).runtime.setUninstallURL(`https://metamask.io/uninstalled?${i}`)}async setParticipateInMetaMetrics(e){const{metaMetricsId:t}=this.state,r=e&&!t?this.generateMetaMetricsId():t;return this.update((t=>{t.participateInMetaMetrics=e,t.metaMetricsId=r})),e?(this.trackEventsAfterMetricsOptIn(),this.clearEventsAfterMetricsOptIn()):this.state.marketingCampaignCookieId&&this.setMarketingCampaignCookieId(null),T(x,this)!==y.ENVIRONMENT.DEVELOPMENT&&null!==r&&this.updateExtensionUninstallUrl(e,r),r}setDataCollectionForMarketing(e){const{metaMetricsId:t}=this.state;return this.update((t=>{t.dataCollectionForMarketing=e})),!e&&this.state.marketingCampaignCookieId&&this.setMarketingCampaignCookieId(null),t}setMarketingCampaignCookieId(e){this.update((t=>{t.marketingCampaignCookieId=e}))}trackPage(e,t){try{if(!1===this.state.participateInMetaMetrics)return;if(null===this.state.participateInMetaMetrics&&(null==t||!t.isOptInPath))return;const{name:r,params:n,environmentType:i,page:s,referrer:o,actionId:a}=e,{metaMetricsId:c}=this.state,u=c?"userId":"anonymousId",h=c??d.METAMETRICS_ANONYMOUS_ID;I(M,this,J).call(this,"page",{messageId:E({actionId:a}),[u]:h,name:r,properties:{params:n,locale:this.locale,chain_id:this.chainId,environment_type:i},context:I(M,this,L).call(this,o,s)})}catch(e){T(R,this).call(this,e)}}trackEvent(e,t){I(M,this,N).call(this,e),I(M,this,j).call(this,e,t).catch((e=>{T(R,this).call(this,e)}))}handleMetaMaskStateUpdate(e){const t=this._buildUserTraitsObject(e);t&&this.identify(t)}trackEventsAfterMetricsOptIn(){const{eventsBeforeMetricsOptIn:e}=this.state;e.forEach((e=>{this.trackEvent(e)}))}clearEventsAfterMetricsOptIn(){this.update((e=>{e.eventsBeforeMetricsOptIn=[]}))}addEventBeforeMetricsOptIn(e){this.update((t=>{t.eventsBeforeMetricsOptIn.push(e)}))}updateTraits(e){this.update((t=>{t.traits={...t.traits,...e}}))}getMetaMetricsId(){let{metaMetricsId:e}=this.state;return e||(e=this.generateMetaMetricsId(),this.update((t=>{t.metaMetricsId=e}))),e}_buildUserTraitsObject(e){var t,r,i;const{traits:s}=this.state,o={[d.MetaMetricsUserTrait.AddressBookEntries]:(0,n.sum)(Object.values(e.addressBook).map(n.size)),[d.MetaMetricsUserTrait.InstallDateExt]:s[d.MetaMetricsUserTrait.InstallDateExt]||"",[d.MetaMetricsUserTrait.LedgerConnectionType]:e.ledgerTransportType,[d.MetaMetricsUserTrait.NetworksAdded]:Object.values(e.networkConfigurationsByChainId).map((e=>e.chainId)),[d.MetaMetricsUserTrait.NetworksWithoutTicker]:Object.values(e.networkConfigurationsByChainId).filter((({nativeCurrency:e})=>!e)).map((({chainId:e})=>e)),[d.MetaMetricsUserTrait.NftAutodetectionEnabled]:e.useNftDetection,[d.MetaMetricsUserTrait.NumberOfAccounts]:Object.values(e.internalAccounts.accounts).length,[d.MetaMetricsUserTrait.NumberOfNftCollections]:I(M,this,F).call(this,e.allNfts),[d.MetaMetricsUserTrait.NumberOfNfts]:T(B,this).call(this,e.allNfts).length,[d.MetaMetricsUserTrait.NumberOfTokens]:I(M,this,$).call(this,e.allTokens),[d.MetaMetricsUserTrait.NumberOfHDEntropies]:I(M,this,W).call(this,e)??(null===(t=this.previousUserTraits)||void 0===t?void 0:t.number_of_hd_entropies),[d.MetaMetricsUserTrait.OpenSeaApiEnabled]:e.openSeaEnabled,[d.MetaMetricsUserTrait.ThreeBoxEnabled]:!1,[d.MetaMetricsUserTrait.Theme]:e.theme||"default",[d.MetaMetricsUserTrait.TokenDetectionEnabled]:e.useTokenDetection,[d.MetaMetricsUserTrait.ShowNativeTokenAsMainBalance]:e.ShowNativeTokenAsMainBalance,[d.MetaMetricsUserTrait.CurrentCurrency]:e.currentCurrency,[d.MetaMetricsUserTrait.SecurityProviders]:e.securityAlertsEnabled?["blockaid"]:[],[d.MetaMetricsUserTrait.PetnameAddressCount]:I(M,this,X).call(this,e),[d.MetaMetricsUserTrait.IsMetricsOptedIn]:e.participateInMetaMetrics,[d.MetaMetricsUserTrait.HasMarketingConsent]:e.dataCollectionForMarketing,[d.MetaMetricsUserTrait.TokenSortPreference]:(null===(r=e.tokenSortConfig)||void 0===r?void 0:r.key)||"",[d.MetaMetricsUserTrait.PrivacyModeEnabled]:e.preferences.privacyMode,[d.MetaMetricsUserTrait.NetworkFilterPreference]:Object.keys(e.preferences.tokenNetworkFilter||{}),[d.MetaMetricsUserTrait.ProfileId]:null===(i=e.sessionData)||void 0===i||null===(i=i.profile)||void 0===i?void 0:i.profileId};if(!this.previousUserTraits&&e.participateInMetaMetrics)return this.previousUserTraits=o,o;if(this.previousUserTraits&&!(0,n.isEqual)(this.previousUserTraits,o)){const t=(0,n.pickBy)(o,((e,t)=>{const r=this.previousUserTraits[t];return!(0,n.isEqual)(r,e)}));return e.participateInMetaMetrics&&(this.previousUserTraits=o),t}return null}}function q(e){const t=e||this.messagingSystem.call("NetworkController:getState").selectedNetworkClientId,{configuration:{chainId:r}}=this.messagingSystem.call("NetworkController:getNetworkClientById",t);return r}async function j(e,t){if(!(this.state.participateInMetaMetrics||null!=t&&t.isOptIn))return;const r=[];if(e.sensitiveProperties){if(!0===(null==t?void 0:t.excludeMetaMetricsId))throw new Error("sensitiveProperties was specified in an event payload that also set the excludeMetaMetricsId flag");const i=_[`${e.event}`],s={...e,event:i??e.event},o=(0,n.merge)({...s.sensitiveProperties},{...s.properties});r.push(I(M,this,Q).call(this,I(M,this,U).call(this,{...s,properties:o,isDuplicateAnonymizedEvent:!0}),{...t,excludeMetaMetricsId:!0}))}r.push(I(M,this,Q).call(this,I(M,this,U).call(this,e),t)),await Promise.all(r)}function N(e){if(!e.event||!e.category)throw new Error(`Must specify event and category. Event was: ${e.event}. Category was: ${e.category}. Payload keys were: ${Object.keys(e)}. ${"object"==typeof e.properties?`Payload property keys were: ${Object.keys(e.properties)}`:""}`)}function L(e,t=d.METAMETRICS_BACKGROUND_PAGE_OBJECT){return{app:{name:"MetaMask Extension",version:this.version},userAgent:window.navigator.userAgent,page:t,referrer:e,marketingCampaignCookieId:this.state.marketingCampaignCookieId}}function U(e){const{event:t,properties:r,revenue:i,value:s,currency:o,category:a,page:c,referrer:d,environmentType:h=u.ENVIRONMENT_TYPE_BACKGROUND}=e;return{event:t,messageId:E(e),properties:{...(0,n.omit)(r,["revenue","locale","currency","value"]),revenue:i,value:s,currency:o,category:a,locale:this.locale,chain_id:r&&"chain_id"in r&&"string"==typeof r.chain_id?r.chain_id:this.chainId,environment_type:h},context:I(M,this,L).call(this,d,c)}}function H(e){return Object.entries(e).reduce(((e,[t,r])=>I(M,this,G).call(this,r)?{...e,[t]:r.toISOString()}:I(M,this,Y).call(this,r)?{...e,[t]:r}:(console.warn(`MetaMetricsController: "${t}" value is not a valid trait type`),e)),{})}function F(e={}){const t=T(B,this).call(this,e).map((e=>e.address));return new Set(t).size}function $(e){return Object.values(e).reduce(((e,t)=>e+(0,n.sum)(Object.values(t).map(n.size))),0)}function W(e){var t;return(null===(t=e.keyrings)||void 0===t?void 0:t.filter((e=>e.type===m.KeyringType.hdKeyTree)).length)??0}function z(e){const{metaMetricsId:t}=this.state;if(e&&0!==Object.keys(e).length)try{I(M,this,J).call(this,"identify",{userId:t??undefined,traits:e})}catch(e){T(R,this).call(this,e)}else console.warn("MetaMetricsController#_identify: No userTraits found")}function Y(e){const t=typeof e;return"string"===t||"boolean"===t||"number"===t||I(M,this,V).call(this,e)||I(M,this,G).call(this,e)}function V(e){return Array.isArray(e)&&(e.every((e=>"string"==typeof e))||e.every((e=>"boolean"==typeof e))||e.every((e=>"number"==typeof e)))}function G(e){return"[object Date]"===Object.prototype.toString.call(e)}function Q(e,t){const{isOptIn:r,metaMetricsId:n,matomoEvent:i,flushImmediately:s}=t||{};let o="userId",c=this.state.metaMetricsId,u=(null==t?void 0:t.excludeMetaMetricsId)??!1;const h=Boolean(e.event.match(/^send|^confirm/iu));return!1!==(null==t?void 0:t.excludeMetaMetricsId)&&h&&(u=!0),u||r&&!n?(o="anonymousId",c=d.METAMETRICS_ANONYMOUS_ID):r&&n&&(c=n),e[o]=c??undefined,!0===i&&(e.properties.legacy_event=!0),new Promise(((t,r)=>{I(M,this,J).call(this,"track",e,(e=>{if(e){const t=(0,a.isErrorWithMessage)(e)?e.message:"",n=(0,a.isErrorWithStack)(e)?e.stack:undefined,i=new Error(t);return n&&(i.stack=n),r(i)}return t()})),s&&T(O,this).flush()}))}function J(e,t,r){const{metaMetricsId:n,participateInMetaMetrics:i,latestNonAnonymousEventTimestamp:s}=this.state;if(!i||!n)return;const o=t.messageId||(0,l.generateRandomId)();let a=new Date;if(t.timestamp){const e=new Date(t.timestamp);(0,l.isValidDate)(e)&&(a=e)}const c={...t,messageId:o,timestamp:a};this.update((t=>{t.latestNonAnonymousEventTimestamp=c.anonymousId===d.METAMETRICS_ANONYMOUS_ID?s:a.valueOf(),t.segmentApiCalls[o]={eventType:e,payload:{...c,timestamp:c.timestamp.toString()}}}));T(O,this)[e](c,(e=>(this.update((e=>{delete e.segmentApiCalls[o]})),null==r?void 0:r(e))))}function X(e){var t;const r=(null===(t=e.names)||void 0===t?void 0:t[o.NameType.ETHEREUM_ADDRESS])??{};return Object.keys(r).reduce(((e,t)=>{const n=r[t];return e+Object.keys(n).reduce(((e,t)=>{var r;return e+(Boolean(null===(r=n[t].name)||void 0===r?void 0:r.length)?1:0)}),0)}),0)}r.default=K}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"$root$",file:"app/scripts/controllers/metametrics-controller.ts"}],[650,{"../RegistryItem":643,"../RegistryType":644,"../lib":654,"./KeyDerivation":649},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.QRHardwareCall=r.QRHardwareCallType=void 0;const n=e("../RegistryType"),i=e("../RegistryItem"),s=e("../lib"),o=e("./KeyDerivation");var a,c;!function(e){e[e.type=1]="type",e[e.params=2]="params",e[e.origin=3]="origin"}(a||(a={})),function(e){e[e.KeyDerivation=0]="KeyDerivation"}(c=r.QRHardwareCallType||(r.QRHardwareCallType={}));class u extends i.RegistryItem{constructor(e,t,r){super(),this.type=e,this.params=t,this.origin=r,this.getRegistryType=()=>n.RegistryTypes.QR_HARDWARE_CALL,this.getType=()=>this.type,this.getParams=()=>this.params,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};e[a.type]=this.type;const t=this.params.toDataItem();return t.setTag(this.params.getRegistryType().getTag()),e[a.params]=t,this.origin&&(e[a.origin]=this.origin),new s.DataItem(e)}}}r.QRHardwareCall=u,u.fromDataItem=e=>{const t=e.getData(),r=t[a.type]||c.KeyDerivation;let n;if(r===c.KeyDerivation)n=o.KeyDerivation.fromDataItem(t[a.params]);const i=t[a.origin];return new u(r,n,i)},u.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return u.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/QRHardwareCall.js"}],[651,{"./Bytes":632,"./CryptoAccount":633,"./CryptoCoinInfo":634,"./CryptoECKey":635,"./CryptoHDKey":636,"./CryptoKeypath":637,"./CryptoOutput":638,"./CryptoPSBT":639,"./Decoder":640,"./MultiKey":641,"./PathComponent":642,"./RegistryItem":643,"./RegistryType":644,"./ScriptExpression":645,"./errors":646,"./extended/CryptoMultiAccounts":647,"./extended/DerivationSchema":648,"./extended/KeyDerivation":649,"./extended/QRHardwareCall":650,"./lib":654,"./patchCBOR":655,"./types":656,"./utils":657,"buffer/":4081,tslib:5615},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.extend=r.PathComponent=r.ScriptExpressions=r.MultiKey=r.CryptoPSBT=r.CryptoOutput=r.CryptoECKey=r.CryptoCoinInfoNetwork=r.CryptoCoinInfoType=r.CryptoCoinInfo=r.CryptoKeypath=r.CryptoMultiAccounts=r.CryptoHDKey=r.CryptoAccount=r.Bytes=r.URRegistryDecoder=r.DataItem=void 0;const n=e("tslib");e("./patchCBOR");const i=e("buffer/");Object.defineProperty(r,"Buffer",{enumerable:!0,get:function(){return i.Buffer}});const s=e("./CryptoHDKey");Object.defineProperty(r,"CryptoHDKey",{enumerable:!0,get:function(){return s.CryptoHDKey}});const o=e("./CryptoKeypath");Object.defineProperty(r,"CryptoKeypath",{enumerable:!0,get:function(){return o.CryptoKeypath}});const a=e("./CryptoCoinInfo");Object.defineProperty(r,"CryptoCoinInfo",{enumerable:!0,get:function(){return a.CryptoCoinInfo}}),Object.defineProperty(r,"CryptoCoinInfoType",{enumerable:!0,get:function(){return a.Type}}),Object.defineProperty(r,"CryptoCoinInfoNetwork",{enumerable:!0,get:function(){return a.Network}});const c=e("./CryptoECKey");Object.defineProperty(r,"CryptoECKey",{enumerable:!0,get:function(){return c.CryptoECKey}});const u=e("./Bytes");Object.defineProperty(r,"Bytes",{enumerable:!0,get:function(){return u.Bytes}});const d=e("./CryptoOutput");Object.defineProperty(r,"CryptoOutput",{enumerable:!0,get:function(){return d.CryptoOutput}});const h=e("./CryptoPSBT");Object.defineProperty(r,"CryptoPSBT",{enumerable:!0,get:function(){return h.CryptoPSBT}});const p=e("./CryptoAccount");Object.defineProperty(r,"CryptoAccount",{enumerable:!0,get:function(){return p.CryptoAccount}});const f=e("./Decoder");Object.defineProperty(r,"URRegistryDecoder",{enumerable:!0,get:function(){return f.URRegistryDecoder}});const l=e("./MultiKey");Object.defineProperty(r,"MultiKey",{enumerable:!0,get:function(){return l.MultiKey}});const g=e("./ScriptExpression");Object.defineProperty(r,"ScriptExpressions",{enumerable:!0,get:function(){return g.ScriptExpressions}});const y=e("./PathComponent");Object.defineProperty(r,"PathComponent",{enumerable:!0,get:function(){return y.PathComponent}});const m=e("./RegistryItem"),b=e("./RegistryType"),v=e("./lib");var k=e("./lib");Object.defineProperty(r,"DataItem",{enumerable:!0,get:function(){return k.DataItem}});const T=e("./utils"),w=e("./extended/CryptoMultiAccounts");Object.defineProperty(r,"CryptoMultiAccounts",{enumerable:!0,get:function(){return w.CryptoMultiAccounts}});const I={URRegistryDecoder:f.URRegistryDecoder,Bytes:u.Bytes,CryptoAccount:p.CryptoAccount,CryptoHDKey:s.CryptoHDKey,CryptoMultiAccounts:w.CryptoMultiAccounts,CryptoKeypath:o.CryptoKeypath,CryptoCoinInfo:a.CryptoCoinInfo,CryptoCoinInfoType:a.Type,CryptoCoinInfoNetwork:a.Network,CryptoECKey:c.CryptoECKey,CryptoOutput:d.CryptoOutput,CryptoPSBT:h.CryptoPSBT,MultiKey:l.MultiKey,ScriptExpressions:g.ScriptExpressions,PathComponent:y.PathComponent},_={addReader:v.addReader,addSemanticDecode:v.addSemanticDecode,addSemanticEncode:v.addSemanticEncode,addWriter:v.addWriter,patchTags:T.patchTags},C={RegistryTypes:b.RegistryTypes,RegistryItem:m.RegistryItem,RegistryType:b.RegistryType,decodeToDataItem:v.decodeToDataItem,encodeDataItem:v.encodeDataItem,cbor:_};r.extend=C,(0,n.__exportStar)(e("./errors"),r),(0,n.__exportStar)(e("./Decoder"),r),(0,n.__exportStar)(e("./lib"),r),(0,n.__exportStar)(e("./CryptoAccount"),r),(0,n.__exportStar)(e("./CryptoPSBT"),r),(0,n.__exportStar)(e("./CryptoHDKey"),r),(0,n.__exportStar)(e("./extended/CryptoMultiAccounts"),r),(0,n.__exportStar)(e("./extended/QRHardwareCall"),r),(0,n.__exportStar)(e("./extended/KeyDerivation"),r),(0,n.__exportStar)(e("./extended/DerivationSchema"),r),(0,n.__exportStar)(e("./CryptoOutput"),r),(0,n.__exportStar)(e("./CryptoCoinInfo"),r),(0,n.__exportStar)(e("./CryptoECKey"),r),(0,n.__exportStar)(e("./MultiKey"),r),(0,n.__exportStar)(e("./CryptoKeypath"),r),(0,n.__exportStar)(e("./patchCBOR"),r),(0,n.__exportStar)(e("./PathComponent"),r),(0,n.__exportStar)(e("./RegistryItem"),r),(0,n.__exportStar)(e("./RegistryType"),r),(0,n.__exportStar)(e("./types"),r),(0,n.__exportStar)(e("./utils"),r),r.default=I}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/index.js"}],[652,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.DataItem=void 0;r.DataItem=class{constructor(e,t){this.setTag=e=>{this.tag=e},this.clearTag=()=>{this.tag=undefined},this.getTag=()=>this.tag,this.getData=()=>this.data,this.data=e,this.tag=t}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/lib/DataItem.js"}],[653,{"./DataItem":652,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(r){(function(){!function(e,r){"function"==typeof define&&define.amd?define([],r):void 0!==t&&t.exports?t.exports=r():e.CBOR=r()}(this,(function(){const{DataItem:t}=e("./DataItem");var n=function(){function e(e){this.$hex=e}e.prototype={length:function(){return this.$hex.length/2},toString:function(e){if(!e||"hex"===e||16===e)return this.$hex;if("utf-8"===e){for(var t="",r=0;r<this.$hex.length;r+=2)t+="%"+this.$hex.substring(r,r+2);return decodeURIComponent(t)}if("latin"===e){for(t=[],r=0;r<this.$hex.length;r+=2)t.push(parseInt(this.$hex.substring(r,r+2),16));return String.fromCharCode.apply(String,t)}throw new Error("Unrecognised format: "+e)}},e.fromLatinString=function(t){for(var r="",n=0;n<t.length;n++){var i=t.charCodeAt(n).toString(16);1===i.length&&(i="0"+i),r+=i}return new e(r)},e.fromUtf8String=function(t){for(var r=encodeURIComponent(t),n="",i=0;i<r.length;i++)if("%"===r.charAt(i))n+=r.substring(i+1,i+3),i+=2;else{var s=r.charCodeAt(i).toString(16);s.length<2&&(s="0"+s),n+=s}return new e(n)};var n=[],i={},s=function(e){return function(){throw new Error(e+" not implemented")}};function o(){}function a(){}function c(e,t){var r=e.value;return r<24?r:24==r?t.readByte():25==r?t.readUint16():26==r?t.readUint32():27==r?t.readUint64():31==r?null:void s("Additional info: "+r)()}function u(e,t,r){var n=e<<5;t<24?r.writeByte(n|t):t<256?(r.writeByte(24|n),r.writeByte(t)):t<65536?(r.writeByte(25|n),r.writeUint16(t)):t<4294967296?(r.writeByte(26|n),r.writeUint32(t)):(r.writeByte(27|n),r.writeUint64(t))}o.prototype={peekByte:s("peekByte"),readByte:s("readByte"),readChunk:s("readChunk"),readFloat16:function(){var e=this.readUint16(),t=(32767&e)>>10,r=1023&e,n=32768&e;if(31===t)return 0===r?n?-Infinity:Infinity:NaN;var i=t?Math.pow(2,t-25)*(1024+r):Math.pow(2,-24)*r;return n?-i:i},readFloat32:function(){var e=this.readUint32(),t=(2147483647&e)>>23,r=8388607&e,n=2147483648&e;if(255===t)return 0===r?n?-Infinity:Infinity:NaN;var i=t?Math.pow(2,t-23-127)*(8388608+r):Math.pow(2,-149)*r;return n?-i:i},readFloat64:function(){var e=this.readUint32(),t=e>>20&2047,r=4294967296*(1048575&e)+this.readUint32(),n=2147483648&e;if(2047===t)return 0===r?n?-Infinity:Infinity:NaN;var i=t?Math.pow(2,t-52-1023)*(4503599627370496+r):Math.pow(2,-1074)*r;return n?-i:i},readUint16:function(){return 256*this.readByte()+this.readByte()},readUint32:function(){return 65536*this.readUint16()+this.readUint16()},readUint64:function(){return 4294967296*this.readUint32()+this.readUint32()}},a.prototype={writeByte:s("writeByte"),result:s("result"),writeFloat16:s("writeFloat16"),writeFloat32:s("writeFloat32"),writeFloat64:s("writeFloat64"),writeUint16:function(e){this.writeByte(e>>8&255),this.writeByte(255&e)},writeUint32:function(e){this.writeUint16(e>>16&65535),this.writeUint16(65535&e)},writeUint64:function(e){if(e>=9007199254740992||e<=-9007199254740992)throw new Error("Cannot encode Uint64 of: "+e+" magnitude to big (floating point errors)");this.writeUint32(Math.floor(e/4294967296)),this.writeUint32(e%4294967296)},writeString:s("writeString"),canWriteBinary:function(e){return!1},writeBinary:s("writeChunk")};var d=new Error;function h(e){var t=function(e){var t=e.readByte();return{type:t>>5,value:31&t}}(e);switch(t.type){case 0:return c(t,e);case 1:return-1-c(t,e);case 2:return e.readChunk(c(t,e));case 3:return e.readChunk(c(t,e)).toString("utf-8");case 4:case 5:var r=c(t,e),n=[];if(null!==r){5===t.type&&(r*=2);for(var s=0;s<r;s++)n[s]=h(e)}else for(var o;(o=h(e))!==d;)n.push(o);if(5===t.type){var a={};for(s=0;s<n.length;s+=2)a[n[s]]=n[s+1];return a}return n;case 6:var u=c(t,e),p=i[u];n=h(e);return p?p(n):n;case 7:if(25===t.value)return e.readFloat16();if(26===t.value)return e.readFloat32();if(27===t.value)return e.readFloat64();switch(c(t,e)){case 20:return!1;case 21:return!0;case 22:return null;case 23:return undefined;case null:return d;default:throw new Error("Unknown fixed value: "+t.value)}default:throw new Error("Unsupported header: "+JSON.stringify(t))}throw new Error("not implemented yet")}function p(e,t){for(var r=0;r<n.length;r++){var i=n[r].fn(e);if(i!==undefined)return u(6,n[r].tag,t),p(i,t)}if(e&&"function"==typeof e.toCBOR&&(e=e.toCBOR()),!1===e)u(7,20,t);else if(!0===e)u(7,21,t);else if(null===e)u(7,22,t);else if(e===undefined)u(7,23,t);else if("number"==typeof e)Math.floor(e)===e&&e<9007199254740992&&e>-9007199254740992?e<0?u(1,-1-e,t):u(0,e,t):(!function(e,t,r){r.writeByte(e<<5|t)}(7,27,t),t.writeFloat64(e));else if("string"==typeof e)t.writeString(e,(function(e){u(3,e,t)}));else if(t.canWriteBinary(e))t.writeBinary(e,(function(e){u(2,e,t)}));else{if("object"!=typeof e)throw new Error("CBOR encoding not supported: "+e);if(g.config.useToJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),Array.isArray(e)){u(4,e.length,t);for(r=0;r<e.length;r++)p(e[r],t)}else{var s=Object.keys(e);u(5,s.length,t);for(r=0;r<s.length;r++){const n=parseInt(s[r]);isNaN(n)?(p(s[r],t),p(e[s[r]],t)):(p(n,t),p(e[s[r]],t))}}}}var f=[],l=[],g={config:{useToJSON:!0},addWriter:function(e,t){"string"==typeof e?l.push((function(r){if(e===r)return t(r)})):l.push(e)},addReader:function(e,t){"string"==typeof e?f.push((function(r,n){if(e===n)return t(r,n)})):f.push(e)},encode:function(e,t){for(var r=0;r<l.length;r++){var n=(0,l[r])(t);if(n)return p(e,n),n.result()}throw new Error("Unsupported output format: "+t)},encodeDataItem:function(e,t){for(var r=0;r<l.length;r++){var n=(0,l[r])(t);if(n)return e.getTag()!==undefined?(p(e,n),n.result()):(p(e.getData(),n),n.result())}throw new Error("Unsupported output format: "+t)},decode:function(e,t){for(var r=0;r<f.length;r++){var n=(0,f[r])(e,t);if(n)return h(n)}throw new Error("Unsupported input format: "+t)},decodeToDataItem:function(e,r){for(var n=0;n<f.length;n++){var i=(0,f[n])(e,r);if(i){const e=h(i);return e instanceof t?e:new t(e)}}throw new Error("Unsupported input format: "+r)},addSemanticEncode:function(e,t){if("number"!=typeof e||e%1!=0||e<0)throw new Error("Tag must be a positive integer");return n.push({tag:e,fn:t}),this},addSemanticDecode:function(e,t){if("number"!=typeof e||e%1!=0||e<0)throw new Error("Tag must be a positive integer");return i[e]=t,this}};function y(e){this.buffer=e,this.pos=0}function m(e){this.byteLength=0,this.defaultBufferLength=16384,this.latestBuffer=r.alloc(this.defaultBufferLength),this.latestBufferOffset=0,this.completeBuffers=[],this.stringFormat=e}function b(e){this.hex=e,this.pos=0}function v(e){this.$hex="",this.finalFormat=e||"hex"}return y.prototype=Object.create(o.prototype),y.prototype.peekByte=function(){return this.buffer[this.pos]},y.prototype.readByte=function(){return this.buffer[this.pos++]},y.prototype.readUint16=function(){var e=this.buffer.readUInt16BE(this.pos);return this.pos+=2,e},y.prototype.readUint32=function(){var e=this.buffer.readUInt32BE(this.pos);return this.pos+=4,e},y.prototype.readFloat32=function(){var e=this.buffer.readFloatBE(this.pos);return this.pos+=4,e},y.prototype.readFloat64=function(){var e=this.buffer.readDoubleBE(this.pos);return this.pos+=8,e},y.prototype.readChunk=function(e){var t=r.alloc(e);return this.buffer.copy(t,0,this.pos,this.pos+=e),t},m.prototype=Object.create(a.prototype),m.prototype.writeByte=function(e){this.latestBuffer[this.latestBufferOffset++]=e,this.latestBufferOffset>=this.latestBuffer.length&&(this.completeBuffers.push(this.latestBuffer),this.latestBuffer=r.alloc(this.defaultBufferLength),this.latestBufferOffset=0),this.byteLength++},m.prototype.writeFloat32=function(e){var t=r.alloc(4);t.writeFloatBE(e,0),this.writeBuffer(t)},m.prototype.writeFloat64=function(e){var t=r.alloc(8);t.writeDoubleBE(e,0),this.writeBuffer(t)},m.prototype.writeString=function(e,t){var n=r.from(e,"utf-8");t(n.length),this.writeBuffer(n)},m.prototype.canWriteBinary=function(e){return e instanceof r},m.prototype.writeBinary=function(e,t){t(e.length),this.writeBuffer(e)},m.prototype.writeBuffer=function(e){if(!(e instanceof r))throw new TypeError("BufferWriter only accepts Buffers");this.latestBufferOffset?this.latestBuffer.length-this.latestBufferOffset>=e.length?(e.copy(this.latestBuffer,this.latestBufferOffset),this.latestBufferOffset+=e.length,this.latestBufferOffset>=this.latestBuffer.length&&(this.completeBuffers.push(this.latestBuffer),this.latestBuffer=r.alloc(this.defaultBufferLength),this.latestBufferOffset=0)):(this.completeBuffers.push(this.latestBuffer.slice(0,this.latestBufferOffset)),this.completeBuffers.push(e),this.latestBuffer=r.alloc(this.defaultBufferLength),this.latestBufferOffset=0):this.completeBuffers.push(e),this.byteLength+=e.length},m.prototype.result=function(){for(var e=r.alloc(this.byteLength),t=0,n=0;n<this.completeBuffers.length;n++){var i=this.completeBuffers[n];i.copy(e,t,0,i.length),t+=i.length}return this.latestBufferOffset&&this.latestBuffer.copy(e,t,0,this.latestBufferOffset),this.stringFormat?e.toString(this.stringFormat):e},"function"==typeof r&&(g.addReader((function(e,t){return r.isBuffer(e)?new y(e):"hex"===t||"base64"===t?new y(r.from(e,t)):void 0})),g.addWriter((function(e){return e&&"buffer"!==e?"hex"===e||"base64"===e?new m(e):void 0:new m}))),b.prototype=Object.create(o.prototype),b.prototype.peekByte=function(){var e=this.hex.substring(this.pos,2);return parseInt(e,16)},b.prototype.readByte=function(){var e=this.hex.substring(this.pos,this.pos+2);return this.pos+=2,parseInt(e,16)},b.prototype.readChunk=function(t){var n=this.hex.substring(this.pos,this.pos+2*t);return this.pos+=2*t,"function"==typeof r?r.from(n,"hex"):new e(n)},v.prototype=Object.create(a.prototype),v.prototype.writeByte=function(e){if(e<0||e>255)throw new Error("Byte value out of range: "+e);var t=e.toString(16);1==t.length&&(t="0"+t),this.$hex+=t},v.prototype.canWriteBinary=function(t){return t instanceof e||"function"==typeof r&&t instanceof r},v.prototype.writeBinary=function(t,n){if(t instanceof e)n(t.length()),this.$hex+=t.$hex;else{if(!("function"==typeof r&&t instanceof r))throw new TypeError("HexWriter only accepts BinaryHex or Buffers");n(t.length),this.$hex+=t.toString("hex")}},v.prototype.result=function(){return"buffer"===this.finalFormat&&"function"==typeof r?r.from(this.$hex,"hex"):new e(this.$hex).toString(this.finalFormat)},v.prototype.writeString=function(t,r){var n=e.fromUtf8String(t);r(n.length()),this.$hex+=n.$hex},g.addReader((function(t,r){return t instanceof e||t.$hex?new b(t.$hex):"hex"===r?new b(t):void 0})),g.addWriter((function(e){if("hex"===e)return new v})),g}();return n.addSemanticEncode(0,(function(e){if(e instanceof Date)return e.toISOString()})).addSemanticDecode(0,(function(e){return new Date(e)})).addSemanticDecode(1,(function(e){return new Date(e)})),n}))}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/lib/cbor-sync.js"}],[654,{"./DataItem":652,"./cbor-sync":653},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.DataItem=r.addWriter=r.addReader=r.addSemanticEncode=r.addSemanticDecode=r.decodeToDataItem=r.encodeDataItem=void 0;var n=e("./cbor-sync");Object.defineProperty(r,"encodeDataItem",{enumerable:!0,get:function(){return n.encodeDataItem}}),Object.defineProperty(r,"decodeToDataItem",{enumerable:!0,get:function(){return n.decodeToDataItem}}),Object.defineProperty(r,"addSemanticDecode",{enumerable:!0,get:function(){return n.addSemanticDecode}}),Object.defineProperty(r,"addSemanticEncode",{enumerable:!0,get:function(){return n.addSemanticEncode}}),Object.defineProperty(r,"addReader",{enumerable:!0,get:function(){return n.addReader}}),Object.defineProperty(r,"addWriter",{enumerable:!0,get:function(){return n.addWriter}});var i=e("./DataItem");Object.defineProperty(r,"DataItem",{enumerable:!0,get:function(){return i.DataItem}})}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/lib/index.js"}],[655,{"./RegistryType":644,"./ScriptExpression":645,"./utils":657},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});const n=e("./utils"),i=e("./RegistryType"),s=e("./ScriptExpression"),o=Object.values(i.RegistryTypes).filter((e=>!!e.getTag())).map((e=>e.getTag())),a=Object.values(s.ScriptExpressions).map((e=>e.getTag()));(0,n.patchTags)(o.concat(a))}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/patchCBOR.js"}],[656,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0})}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/types.js"}],[657,{"./lib":654},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.patchTags=void 0;const n=e("./lib"),i=[];r.patchTags=e=>{e.forEach((e=>{i.find((t=>t===e))||((0,n.addSemanticEncode)(e,(t=>{if(t instanceof n.DataItem&&t.getTag()===e)return t.getData()})),(0,n.addSemanticDecode)(e,(t=>new n.DataItem(t,e))),i.push(e))}))}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/base-eth-keyring/node_modules/@keystonehq/bc-ur-registry/dist/utils.js"}],[66,{"@metamask/base-controller":1383},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.MetaMetricsDataDeletionController=void 0;var n=e("@metamask/base-controller");function i(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function s(e,t){return e.get(o(e,t))}function o(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const a="MetaMetricsDataDeletionController",c={metaMetricsDataDeletionId:{persist:!0,anonymous:!0},metaMetricsDataDeletionTimestamp:{persist:!0,anonymous:!0},metaMetricsDataDeletionStatus:{persist:!0,anonymous:!0}};var u=new WeakMap,d=new WeakSet;class h extends n.BaseController{constructor({dataDeletionService:e,messenger:t,state:r}){var n,s;super({messenger:t,metadata:c,name:a,state:{metaMetricsDataDeletionId:null,metaMetricsDataDeletionTimestamp:0,...r}}),i(n=this,s=d),s.add(n),function(e,t,r){i(e,t),t.set(e,r)}(this,u,void 0),function(e,t,r){e.set(o(e,t),r)}(u,this,e),o(d,this,p).call(this)}async createMetaMetricsDataDeletionTask(){const{metaMetricsId:e}=this.messagingSystem.call("MetaMetricsController:getState");if(!e)throw new Error("MetaMetrics ID not found");const t=await s(u,this).createDataDeletionRegulationTask(e);this.update((e=>{e.metaMetricsDataDeletionId=t??null,e.metaMetricsDataDeletionTimestamp=Date.now()})),await this.updateDataDeletionTaskStatus()}async updateDataDeletionTaskStatus(){const e=this.state.metaMetricsDataDeletionId;if(!e)throw new Error("Delete Regulation id not found");const t=await s(u,this).fetchDeletionRegulationStatus(e);this.update((e=>{e.metaMetricsDataDeletionStatus=t??undefined}))}}function p(){this.messagingSystem.registerActionHandler(`${a}:createMetaMetricsDataDeletionTask`,this.createMetaMetricsDataDeletionTask.bind(this)),this.messagingSystem.registerActionHandler(`${a}:updateDataDeletionTaskStatus`,this.updateDataDeletionTaskStatus.bind(this))}r.MetaMetricsDataDeletionController=h}}},{package:"$root$",file:"app/scripts/controllers/metametrics-data-deletion/metametrics-data-deletion.ts"}],[67,{"../../../shared/constants/network":5734,"@metamask/base-controller":1383,"@metamask/keyring-api":1983,"@metamask/multichain-network-controller":2092},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.NetworkOrderController=void 0;var n=e("@metamask/keyring-api"),i=e("@metamask/base-controller"),s=e("@metamask/multichain-network-controller"),o=e("../../../shared/constants/network");const a={orderedNetworkList:[]},c={orderedNetworkList:{persist:!0,anonymous:!0}};class u extends i.BaseController{constructor({messenger:e,state:t}){super({messenger:e,metadata:c,name:"NetworkOrderController",state:{...a,...t}}),this.messagingSystem.subscribe("NetworkController:stateChange",(e=>{this.onNetworkControllerStateChange(e)}))}onNetworkControllerStateChange({networkConfigurationsByChainId:e}){this.update((t=>{const r=Object.keys(e).filter((e=>!o.TEST_CHAINS.includes(e))).map(s.toEvmCaipChainId),i=[n.BtcScope.Mainnet,n.SolScope.Mainnet],a=r.filter((e=>!t.orderedNetworkList.some((({networkId:t})=>t===e)))).map((e=>({networkId:e})));t.orderedNetworkList=t.orderedNetworkList.filter((({networkId:e})=>r.includes(e)||i.includes(e))).concat(a)}))}updateNetworksList(e){this.update((t=>{t.orderedNetworkList=e.map((e=>({networkId:e})))}))}}r.NetworkOrderController=u}}},{package:"$root$",file:"app/scripts/controllers/network-order.ts"}],[68,{"@metamask/base-controller":1383,loglevel:4863},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getDefaultOnboardingControllerState=r.default=void 0;var n,i=e("@metamask/base-controller"),s=(n=e("loglevel"))&&n.__esModule?n:{default:n};function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const a=()=>({seedPhraseBackedUp:null,firstTimeFlowType:null,completedOnboarding:!1});r.getDefaultOnboardingControllerState=a;const c={onboardingTabs:{}},u={seedPhraseBackedUp:{persist:!0,anonymous:!0},firstTimeFlowType:{persist:!0,anonymous:!0},completedOnboarding:{persist:!0,anonymous:!0},onboardingTabs:{persist:!1,anonymous:!1}};class d extends i.BaseController{constructor({messenger:e,state:t}){super({messenger:e,metadata:u,name:"OnboardingController",state:{seedPhraseBackedUp:null,firstTimeFlowType:null,completedOnboarding:!1,...t,...c}}),o(this,"registerOnboarding",(async(e,t)=>{if(this.state.completedOnboarding)return void s.default.debug("Ignoring registerOnboarding; user already onboarded");const{onboardingTabs:r}={...this.state??{}};r&&(r[e]&&r[e]===t||(s.default.debug(`Registering onboarding tab at location '${e}' with tabId '${t}'`),this.update((n=>{n.onboardingTabs={...r,[e]:t}}))))}))}setSeedPhraseBackedUp(e){this.update((t=>{t.seedPhraseBackedUp=e}))}completeOnboarding(){return this.update((e=>{e.completedOnboarding=!0})),!0}setFirstTimeFlowType(e){this.update((t=>{t.firstTimeFlowType=e}))}}r.default=d}}},{package:"$root$",file:"app/scripts/controllers/onboarding.ts"}],[687,{"./metamask-airgapped-keyring.cjs.development.js":688,"./metamask-airgapped-keyring.cjs.production.min.js":689},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){t.exports=e("./metamask-airgapped-keyring.cjs.production.min.js")}}},{package:"@keystonehq/metamask-airgapped-keyring",file:"node_modules/@keystonehq/metamask-airgapped-keyring/dist/index.js"}],[688,{"@ethereumjs/rlp":429,"@ethereumjs/tx":442,"@keystonehq/base-eth-keyring":613,"@keystonehq/bc-ur-registry-eth":692,"@metamask/obs-store":2386,buffer:4074,events:4399,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n=e("@keystonehq/base-eth-keyring"),i=e("events"),s=e("@metamask/obs-store"),o=e("@keystonehq/bc-ur-registry-eth"),a=e("uuid"),c=e("@ethereumjs/tx"),u=e("@ethereumjs/rlp");class d extends i.EventEmitter{constructor(){if(super(),this.cleanSyncListeners=()=>{this.removeAllListeners("keystone-sync_success-hdkey"),this.removeAllListeners("keystone-sync_success-account"),this.removeAllListeners("keystone-sync_cancel")},this.cleanSignListeners=e=>{this.removeAllListeners(`${e}-signed`),this.removeAllListeners(`${e}-canceled`)},this.readCryptoHDKeyOrCryptoAccount=()=>new Promise(((e,r)=>{this.memStore.updateState({sync:{reading:!0}}),this.on("keystone-sync_success-hdkey",(r=>{const n=o.CryptoHDKey.fromCBOR(t.from(r,"hex"));this.resetState(),e(n)})),this.on("keystone-sync_success-account",(r=>{const n=o.CryptoAccount.fromCBOR(t.from(r,"hex"));this.resetState(),e(n)})),this.on("keystone-sync_cancel",(()=>{this.resetState(),r(new Error("KeystoneError#sync_cancel. Sync process canceled, please retry"))}))})),this.submitCryptoHDKey=e=>{this.emit("keystone-sync_success-hdkey",e)},this.submitCryptoAccount=e=>{this.emit("keystone-sync_success-account",e)},this.cancelSync=()=>{this.emit("keystone-sync_cancel")},this.requestSignature=(e,r,n)=>new Promise(((i,s)=>{const c=e.toUR(),u=e.getRequestId(),d=a.stringify(u),h={requestId:d,payload:{type:c.type,cbor:c.cbor.toString("hex")},title:r,description:n};this.memStore.updateState({sign:{request:h}}),this.once(`${d}-signed`,(e=>{const r=o.ETHSignature.fromCBOR(t.from(e,"hex"));this.resetState(),i(r)})),this.once(`${d}-canceled`,(()=>{this.resetState(),s(new Error("KeystoneError#Tx_canceled. Signing canceled, please retry"))}))})),this.submitSignature=(e,t)=>{this.emit(`${e}-signed`,t)},this.cancelRequestSignature=()=>{const e=this.memStore.getState().sign.request;if(e){const{requestId:t}=e;this.memStore.updateState({sign:{}}),this.emit(`${t}-canceled`)}},this.reset=()=>{this.cleanSyncListeners();const e=this.memStore.getState().sign.request;if(e){const{requestId:t}=e;this.cleanSignListeners(t)}this.resetState()},this.resetState=()=>{this.memStore.updateState({sync:{reading:!1},sign:{}})},d.instance)return d.instance;this.memStore=new s.ObservableStore({sync:{reading:!1},sign:{},_version:1}),d.instance=this}}class h extends n.BaseKeyring{constructor(e){if(super(e),this.getInteraction=()=>new d,this.resetStore=()=>{this.getInteraction().reset()},this.getMemStore=()=>this.getInteraction().memStore,this.removeAccount=e=>{if(!this.accounts.map((e=>e.toLowerCase())).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter((t=>t.toLowerCase()!==e.toLowerCase()))},this.forgetDevice=()=>{this.page=0,this.perPage=5,this.accounts=[],this.currentAccount=0,this.name="QR Hardware",this.initialized=!1,this.xfp="",this.xpub="",this.hdPath="",this.indexes={},this.hdk=undefined,this.paths={}},this.submitCryptoHDKey=this.getInteraction().submitCryptoHDKey,this.submitCryptoAccount=this.getInteraction().submitCryptoAccount,this.submitSignature=this.getInteraction().submitSignature,this.cancelSync=this.getInteraction().cancelSync,this.cancelSignRequest=this.getInteraction().cancelRequestSignature,h.instance)return h.instance.deserialize(e),h.instance;h.instance=this}async addAccounts(e=1){return(await super.addAccounts(e)).slice(-1*e)}async signTransaction(e,r){const n=0===r.type?o.DataType.transaction:o.DataType.typedTransaction;let i;i=0===r.type?t.from(u.RLP.encode(r.getMessageToSign())):t.from(r.getMessageToSign());const s=await this._pathFromAddress(e),d=r.common.chainId(),h=a.v4(),p=o.EthSignRequest.constructETHRequest(i,n,s,this.xfp,h,d,e),{r:f,s:l,v:g}=await this.requestSignature(h,p,"Scan with your Keystone",'After your Keystone has signed the transaction, click on "Scan Keystone" to receive the signature'),y=r.toJSON();y.v=g,y.s=l,y.r=f,y.type=r.type;return c.TransactionFactory.fromTxData(y,{common:r.common})}}h.type=n.BaseKeyring.type,r.MetaMaskKeyring=h}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring",file:"node_modules/@keystonehq/metamask-airgapped-keyring/dist/metamask-airgapped-keyring.cjs.development.js"}],[689,{"@ethereumjs/rlp":429,"@ethereumjs/tx":442,"@keystonehq/base-eth-keyring":613,"@keystonehq/bc-ur-registry-eth":692,"@metamask/obs-store":2386,buffer:4074,events:4399,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n=e("@keystonehq/base-eth-keyring"),i=e("events"),s=e("@metamask/obs-store"),o=e("@keystonehq/bc-ur-registry-eth"),a=e("uuid"),c=e("@ethereumjs/tx"),u=e("@ethereumjs/rlp");class d extends i.EventEmitter{constructor(){if(super(),this.cleanSyncListeners=()=>{this.removeAllListeners("keystone-sync_success-hdkey"),this.removeAllListeners("keystone-sync_success-account"),this.removeAllListeners("keystone-sync_cancel")},this.cleanSignListeners=e=>{this.removeAllListeners(e+"-signed"),this.removeAllListeners(e+"-canceled")},this.readCryptoHDKeyOrCryptoAccount=()=>new Promise(((e,r)=>{this.memStore.updateState({sync:{reading:!0}}),this.on("keystone-sync_success-hdkey",(r=>{const n=o.CryptoHDKey.fromCBOR(t.from(r,"hex"));this.resetState(),e(n)})),this.on("keystone-sync_success-account",(r=>{const n=o.CryptoAccount.fromCBOR(t.from(r,"hex"));this.resetState(),e(n)})),this.on("keystone-sync_cancel",(()=>{this.resetState(),r(new Error("KeystoneError#sync_cancel. Sync process canceled, please retry"))}))})),this.submitCryptoHDKey=e=>{this.emit("keystone-sync_success-hdkey",e)},this.submitCryptoAccount=e=>{this.emit("keystone-sync_success-account",e)},this.cancelSync=()=>{this.emit("keystone-sync_cancel")},this.requestSignature=(e,r,n)=>new Promise(((i,s)=>{const c=e.toUR(),u=e.getRequestId(),d=a.stringify(u),h={requestId:d,payload:{type:c.type,cbor:c.cbor.toString("hex")},title:r,description:n};this.memStore.updateState({sign:{request:h}}),this.once(d+"-signed",(e=>{const r=o.ETHSignature.fromCBOR(t.from(e,"hex"));this.resetState(),i(r)})),this.once(d+"-canceled",(()=>{this.resetState(),s(new Error("KeystoneError#Tx_canceled. Signing canceled, please retry"))}))})),this.submitSignature=(e,t)=>{this.emit(e+"-signed",t)},this.cancelRequestSignature=()=>{const e=this.memStore.getState().sign.request;if(e){const{requestId:t}=e;this.memStore.updateState({sign:{}}),this.emit(t+"-canceled")}},this.reset=()=>{this.cleanSyncListeners();const e=this.memStore.getState().sign.request;if(e){const{requestId:t}=e;this.cleanSignListeners(t)}this.resetState()},this.resetState=()=>{this.memStore.updateState({sync:{reading:!1},sign:{}})},d.instance)return d.instance;this.memStore=new s.ObservableStore({sync:{reading:!1},sign:{},_version:1}),d.instance=this}}class h extends n.BaseKeyring{constructor(e){if(super(e),this.getInteraction=()=>new d,this.resetStore=()=>{this.getInteraction().reset()},this.getMemStore=()=>this.getInteraction().memStore,this.removeAccount=e=>{if(!this.accounts.map((e=>e.toLowerCase())).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter((t=>t.toLowerCase()!==e.toLowerCase()))},this.forgetDevice=()=>{this.page=0,this.perPage=5,this.accounts=[],this.currentAccount=0,this.name="QR Hardware",this.initialized=!1,this.xfp="",this.xpub="",this.hdPath="",this.indexes={},this.hdk=void 0,this.paths={}},this.submitCryptoHDKey=this.getInteraction().submitCryptoHDKey,this.submitCryptoAccount=this.getInteraction().submitCryptoAccount,this.submitSignature=this.getInteraction().submitSignature,this.cancelSync=this.getInteraction().cancelSync,this.cancelSignRequest=this.getInteraction().cancelRequestSignature,h.instance)return h.instance.deserialize(e),h.instance;h.instance=this}async addAccounts(e=1){return(await super.addAccounts(e)).slice(-1*e)}async signTransaction(e,r){const n=0===r.type?o.DataType.transaction:o.DataType.typedTransaction;let i;i=0===r.type?t.from(u.RLP.encode(r.getMessageToSign())):t.from(r.getMessageToSign());const s=await this._pathFromAddress(e),d=r.common.chainId(),h=a.v4(),p=o.EthSignRequest.constructETHRequest(i,n,s,this.xfp,h,d,e),{r:f,s:l,v:g}=await this.requestSignature(h,p,"Scan with your Keystone",'After your Keystone has signed the transaction, click on "Scan Keystone" to receive the signature'),y=r.toJSON();return y.v=g,y.s=l,y.r=f,y.type=r.type,c.TransactionFactory.fromTxData(y,{common:r.common})}}h.type=n.BaseKeyring.type,r.MetaMaskKeyring=h}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring",file:"node_modules/@keystonehq/metamask-airgapped-keyring/dist/metamask-airgapped-keyring.cjs.production.min.js"}],[690,{"@ethereumjs/util":700,"@keystonehq/bc-ur-registry":727,buffer:4074,hdkey:4632,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("@keystonehq/bc-ur-registry"),s=e("uuid"),o=(n=e("hdkey"))&&"object"==typeof n&&"default"in n?n.default:n,a=e("@ethereumjs/util");const c={ETH_SIGN_REQUEST:new i.RegistryType("eth-sign-request",401),ETH_SIGNATURE:new i.RegistryType("eth-signature",402),ETH_NFT_ITEM:new i.RegistryType("eth-nft-item",403)},{decodeToDataItem:u,RegistryTypes:d}=i.extend;var h,p;!function(e){e[e.requestId=1]="requestId",e[e.signData=2]="signData",e[e.dataType=3]="dataType",e[e.chainId=4]="chainId",e[e.derivationPath=5]="derivationPath",e[e.address=6]="address",e[e.origin=7]="origin"}(h||(h={})),(p=r.DataType||(r.DataType={}))[p.transaction=1]="transaction",p[p.typedData=2]="typedData",p[p.personalMessage=3]="personalMessage",p[p.typedTransaction=4]="typedTransaction";class f extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_SIGN_REQUEST,this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSourceFingerprint=()=>this.derivationPath.getSourceFingerprint(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};this.requestId&&(e[h.requestId]=new i.DataItem(this.requestId,d.UUID.getTag())),this.address&&(e[h.address]=this.address),this.chainId&&(e[h.chainId]=Number(this.chainId)),this.origin&&(e[h.origin]=this.origin),e[h.signData]=this.signData,e[h.dataType]=this.dataType;const t=this.derivationPath.toDataItem();return t.setTag(this.derivationPath.getRegistryType().getTag()),e[h.derivationPath]=t,new i.DataItem(e)},this.requestId=e.requestId,this.signData=e.signData,this.dataType=e.dataType,this.chainId=e.chainId,this.derivationPath=e.derivationPath,this.address=e.address,this.origin=e.origin}static constructETHRequest(e,r,n,o,a,c,u,d){const h=n.replace(/[m|M]\//,"").split("/"),p=new i.CryptoKeypath(h.map((e=>{const t=parseInt(e.replace("'",""));let r=!1;return e.endsWith("'")&&(r=!0),new i.PathComponent({index:t,hardened:r})})),t.from(o,"hex"));return new f({requestId:a?t.from(s.parse(a)):undefined,signData:e,dataType:r,derivationPath:p,chainId:c,address:u?t.from(u.replace("0x",""),"hex"):undefined,origin:d||undefined})}}f.fromDataItem=e=>{const t=e.getData(),r=t[h.signData],n=t[h.dataType],s=i.CryptoKeypath.fromDataItem(t[h.derivationPath]),o=t[h.chainId]?t[h.chainId]:undefined,a=t[h.address]?t[h.address]:undefined,c=t[h.requestId]?t[h.requestId].getData():undefined,u=t[h.origin]?t[h.origin]:undefined;return new f({requestId:c,signData:r,dataType:n,chainId:o,derivationPath:s,address:a,origin:u})},f.fromCBOR=e=>{const t=u(e);return f.fromDataItem(t)};const{RegistryTypes:l,decodeToDataItem:g}=i.extend;var y;!function(e){e[e.requestId=1]="requestId",e[e.signature=2]="signature",e[e.origin=3]="origin"}(y||(y={}));class m extends i.RegistryItem{constructor(e,t,r){super(),this.getRegistryType=()=>c.ETH_SIGNATURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};return this.requestId&&(e[y.requestId]=new i.DataItem(this.requestId,l.UUID.getTag())),this.origin&&(e[y.origin]=this.origin),e[y.signature]=this.signature,new i.DataItem(e)},this.signature=e,this.requestId=t,this.origin=r}}m.fromDataItem=e=>{const t=e.getData(),r=t[y.signature],n=t[y.requestId]?t[y.requestId].getData():undefined;return new m(r,n,t[y.origin])},m.fromCBOR=e=>{const t=g(e);return m.fromDataItem(t)};const{decodeToDataItem:b}=i.extend;var v;!function(e){e[e.chainId=1]="chainId",e[e.contractAddress=2]="contractAddress",e[e.contractName=3]="contractName",e[e.name=4]="name",e[e.mediaData=5]="mediaData"}(v||(v={}));class k extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_NFT_ITEM,this.getChainId=()=>this.chainId,this.getName=()=>this.name,this.getmediaData=()=>this.mediaData,this.getContractAddress=()=>this.contractAddress,this.getContractName=()=>this.contractName,this.toDataItem=()=>{const e={};return e[v.chainId]=this.chainId,e[v.name]=this.name,e[v.contractAddress]=this.contractAddress,e[v.contractName]=this.contractName,e[v.mediaData]=this.mediaData,new i.DataItem(e)},this.chainId=e.chainId,this.name=e.name,this.contractAddress=e.contractAddress,this.contractName=e.contractName,this.mediaData=e.mediaData}static constructETHNFTItem(e,t,r,n,i){return new k({chainId:e,contractAddress:t,contractName:r,mediaData:i,name:n})}}k.fromDataItem=e=>{const t=e.getData(),r=t[v.chainId],n=t[v.name],i=t[v.mediaData],s=t[v.contractAddress],o=t[v.contractName];return new k({chainId:r,name:n,contractAddress:s,contractName:o,mediaData:i})},k.fromCBOR=e=>{const t=b(e);return k.fromDataItem(t)};const T=(e,t)=>{const r=o.fromExtendedKey(e).derive(t),n="0x"+a.publicToAddress(r.publicKey,!0).toString("hex");return a.toChecksumAddress(n)};i.patchTags(Object.values(c).filter((e=>!!e.getTag())).map((e=>e.getTag()))),Object.keys(i).forEach((function(e){"default"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})})),r.ETHNFTItem=k,r.ETHSignature=m,r.EthSignRequest=f,r.findHDPathFromAddress=(e,t,r,n)=>{for(let i=0;i<r;i++){const r=T(t,`M/0/${i}`);if(e.toLowerCase()==r.toLowerCase())return`${n}/0/${i}`}return null},r.generateAddressFromXpub=T}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/dist/bc-ur-registry-eth.cjs.development.js"}],[691,{"@ethereumjs/util":700,"@keystonehq/bc-ur-registry":727,buffer:4074,hdkey:4632,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("@keystonehq/bc-ur-registry"),s=e("uuid"),o=(n=e("hdkey"))&&"object"==typeof n&&"default"in n?n.default:n,a=e("@ethereumjs/util");const c={ETH_SIGN_REQUEST:new i.RegistryType("eth-sign-request",401),ETH_SIGNATURE:new i.RegistryType("eth-signature",402),ETH_NFT_ITEM:new i.RegistryType("eth-nft-item",403)},{decodeToDataItem:u,RegistryTypes:d}=i.extend;var h,p;!function(e){e[e.requestId=1]="requestId",e[e.signData=2]="signData",e[e.dataType=3]="dataType",e[e.chainId=4]="chainId",e[e.derivationPath=5]="derivationPath",e[e.address=6]="address",e[e.origin=7]="origin"}(h||(h={})),(p=r.DataType||(r.DataType={}))[p.transaction=1]="transaction",p[p.typedData=2]="typedData",p[p.personalMessage=3]="personalMessage",p[p.typedTransaction=4]="typedTransaction";class f extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_SIGN_REQUEST,this.getRequestId=()=>this.requestId,this.getSignData=()=>this.signData,this.getDataType=()=>this.dataType,this.getChainId=()=>this.chainId,this.getDerivationPath=()=>this.derivationPath.getPath(),this.getSourceFingerprint=()=>this.derivationPath.getSourceFingerprint(),this.getSignRequestAddress=()=>this.address,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};this.requestId&&(e[h.requestId]=new i.DataItem(this.requestId,d.UUID.getTag())),this.address&&(e[h.address]=this.address),this.chainId&&(e[h.chainId]=Number(this.chainId)),this.origin&&(e[h.origin]=this.origin),e[h.signData]=this.signData,e[h.dataType]=this.dataType;const t=this.derivationPath.toDataItem();return t.setTag(this.derivationPath.getRegistryType().getTag()),e[h.derivationPath]=t,new i.DataItem(e)},this.requestId=e.requestId,this.signData=e.signData,this.dataType=e.dataType,this.chainId=e.chainId,this.derivationPath=e.derivationPath,this.address=e.address,this.origin=e.origin}static constructETHRequest(e,r,n,o,a,c,u,d){const h=n.replace(/[m|M]\//,"").split("/"),p=new i.CryptoKeypath(h.map((e=>{const t=parseInt(e.replace("'",""));let r=!1;return e.endsWith("'")&&(r=!0),new i.PathComponent({index:t,hardened:r})})),t.from(o,"hex"));return new f({requestId:a?t.from(s.parse(a)):void 0,signData:e,dataType:r,derivationPath:p,chainId:c,address:u?t.from(u.replace("0x",""),"hex"):void 0,origin:d||void 0})}}f.fromDataItem=e=>{const t=e.getData(),r=t[h.signData],n=t[h.dataType],s=i.CryptoKeypath.fromDataItem(t[h.derivationPath]),o=t[h.chainId]?t[h.chainId]:void 0,a=t[h.address]?t[h.address]:void 0,c=t[h.requestId]?t[h.requestId].getData():void 0;return new f({requestId:c,signData:r,dataType:n,chainId:o,derivationPath:s,address:a,origin:t[h.origin]?t[h.origin]:void 0})},f.fromCBOR=e=>{const t=u(e);return f.fromDataItem(t)};const{RegistryTypes:l,decodeToDataItem:g}=i.extend;var y;!function(e){e[e.requestId=1]="requestId",e[e.signature=2]="signature",e[e.origin=3]="origin"}(y||(y={}));class m extends i.RegistryItem{constructor(e,t,r){super(),this.getRegistryType=()=>c.ETH_SIGNATURE,this.getRequestId=()=>this.requestId,this.getSignature=()=>this.signature,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};return this.requestId&&(e[y.requestId]=new i.DataItem(this.requestId,l.UUID.getTag())),this.origin&&(e[y.origin]=this.origin),e[y.signature]=this.signature,new i.DataItem(e)},this.signature=e,this.requestId=t,this.origin=r}}m.fromDataItem=e=>{const t=e.getData(),r=t[y.signature],n=t[y.requestId]?t[y.requestId].getData():void 0;return new m(r,n,t[y.origin])},m.fromCBOR=e=>{const t=g(e);return m.fromDataItem(t)};const{decodeToDataItem:b}=i.extend;var v;!function(e){e[e.chainId=1]="chainId",e[e.contractAddress=2]="contractAddress",e[e.contractName=3]="contractName",e[e.name=4]="name",e[e.mediaData=5]="mediaData"}(v||(v={}));class k extends i.RegistryItem{constructor(e){super(),this.getRegistryType=()=>c.ETH_NFT_ITEM,this.getChainId=()=>this.chainId,this.getName=()=>this.name,this.getmediaData=()=>this.mediaData,this.getContractAddress=()=>this.contractAddress,this.getContractName=()=>this.contractName,this.toDataItem=()=>{const e={};return e[v.chainId]=this.chainId,e[v.name]=this.name,e[v.contractAddress]=this.contractAddress,e[v.contractName]=this.contractName,e[v.mediaData]=this.mediaData,new i.DataItem(e)},this.chainId=e.chainId,this.name=e.name,this.contractAddress=e.contractAddress,this.contractName=e.contractName,this.mediaData=e.mediaData}static constructETHNFTItem(e,t,r,n,i){return new k({chainId:e,contractAddress:t,contractName:r,mediaData:i,name:n})}}k.fromDataItem=e=>{const t=e.getData();return new k({chainId:t[v.chainId],name:t[v.name],contractAddress:t[v.contractAddress],contractName:t[v.contractName],mediaData:t[v.mediaData]})},k.fromCBOR=e=>{const t=b(e);return k.fromDataItem(t)};const T=(e,t)=>{const r=o.fromExtendedKey(e).derive(t),n="0x"+a.publicToAddress(r.publicKey,!0).toString("hex");return a.toChecksumAddress(n)};i.patchTags(Object.values(c).filter((e=>!!e.getTag())).map((e=>e.getTag()))),Object.keys(i).forEach((function(e){"default"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})})),r.ETHNFTItem=k,r.ETHSignature=m,r.EthSignRequest=f,r.findHDPathFromAddress=(e,t,r,n)=>{for(let i=0;i<r;i++){const r=T(t,"M/0/"+i);if(e.toLowerCase()==r.toLowerCase())return`${n}/0/${i}`}return null},r.generateAddressFromXpub=T}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/dist/bc-ur-registry-eth.cjs.production.min.js"}],[692,{"./bc-ur-registry-eth.cjs.development.js":690,"./bc-ur-registry-eth.cjs.production.min.js":691},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){t.exports=e("./bc-ur-registry-eth.cjs.production.min.js")}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/dist/index.js"}],[693,{"./bytes":696,"./constants":697,"./helpers":699,"./internal":701,"@ethereumjs/rlp":429,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317,"ethereum-cryptography/utils":4319},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.accountBodyToRLP=r.accountBodyToSlim=r.accountBodyFromSlim=r.isZeroAddress=r.zeroAddress=r.importPublic=r.privateToAddress=r.privateToPublic=r.publicToAddress=r.pubToAddress=r.isValidPublic=r.isValidPrivate=r.generateAddress2=r.generateAddress=r.isValidChecksumAddress=r.toChecksumAddress=r.isValidAddress=r.Account=void 0;const n=e("@ethereumjs/rlp"),i=e("ethereum-cryptography/keccak"),s=e("ethereum-cryptography/secp256k1"),o=e("ethereum-cryptography/utils"),a=e("./bytes"),c=e("./constants"),u=e("./helpers"),d=e("./internal"),h=BigInt(0);class p{constructor(e=h,t=h,r=c.KECCAK256_RLP,n=c.KECCAK256_NULL){this.nonce=e,this.balance=t,this.storageRoot=r,this.codeHash=n,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,storageRoot:n,codeHash:i}=e;return new p(t!==undefined?(0,a.bufferToBigInt)((0,a.toBuffer)(t)):undefined,r!==undefined?(0,a.bufferToBigInt)((0,a.toBuffer)(r)):undefined,n!==undefined?(0,a.toBuffer)(n):undefined,i!==undefined?(0,a.toBuffer)(i):undefined)}static fromRlpSerializedAccount(e){const t=(0,a.arrToBufArr)(n.RLP.decode(Uint8Array.from(e)));if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,n,i]=e;return new p((0,a.bufferToBigInt)(t),(0,a.bufferToBigInt)(r),n,i)}_validate(){if(this.nonce<h)throw new Error("nonce must be greater than zero");if(this.balance<h)throw new Error("balance must be greater than zero");if(32!==this.storageRoot.length)throw new Error("storageRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[(0,a.bigIntToUnpaddedBuffer)(this.nonce),(0,a.bigIntToUnpaddedBuffer)(this.balance),this.storageRoot,this.codeHash]}serialize(){return t.from(n.RLP.encode((0,a.bufArrToArr)(this.raw())))}isContract(){return!this.codeHash.equals(c.KECCAK256_NULL)}isEmpty(){return this.balance===h&&this.nonce===h&&this.codeHash.equals(c.KECCAK256_NULL)}}r.Account=p;r.isValidAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};r.toChecksumAddress=function(e,r){(0,u.assertIsHexString)(e);const n=(0,d.stripHexPrefix)(e).toLowerCase();let s="";if(r!==undefined){s=(0,a.bufferToBigInt)((0,a.toBuffer)(r)).toString()+"0x"}const c=t.from(s+n,"utf8"),h=(0,o.bytesToHex)((0,i.keccak256)(c));let p="0x";for(let e=0;e<n.length;e++)parseInt(h[e],16)>=8?p+=n[e].toUpperCase():p+=n[e];return p};r.isValidChecksumAddress=function(e,t){return(0,r.isValidAddress)(e)&&(0,r.toChecksumAddress)(e,t)===e};r.generateAddress=function(e,r){return(0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,a.bufferToBigInt)(r)===BigInt(0)?t.from((0,i.keccak256)(n.RLP.encode((0,a.bufArrToArr)([e,null])))).slice(-20):t.from((0,i.keccak256)(n.RLP.encode((0,a.bufArrToArr)([e,r])))).slice(-20)};r.generateAddress2=function(e,r,n){if((0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,u.assertIsBuffer)(n),20!==e.length)throw new Error("Expected from to be of length 20");if(32!==r.length)throw new Error("Expected salt to be of length 32");const s=(0,i.keccak256)(t.concat([t.from("ff","hex"),e,r,(0,i.keccak256)(n)]));return(0,a.toBuffer)(s).slice(-20)};r.isValidPrivate=function(e){return s.secp256k1.utils.isValidPrivateKey(e)};r.isValidPublic=function(e,r=!1){if((0,u.assertIsBuffer)(e),64===e.length)try{return s.secp256k1.ProjectivePoint.fromHex(t.concat([t.from([4]),e])),!0}catch(e){return!1}if(!r)return!1;try{return s.secp256k1.ProjectivePoint.fromHex(e),!0}catch(e){return!1}};r.pubToAddress=function(e,r=!1){if((0,u.assertIsBuffer)(e),r&&64!==e.length&&(e=t.from(s.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),64!==e.length)throw new Error("Expected pubKey to be of length 64");return t.from((0,i.keccak256)(e)).slice(-20)},r.publicToAddress=r.pubToAddress;r.privateToPublic=function(e){return(0,u.assertIsBuffer)(e),t.from(s.secp256k1.ProjectivePoint.fromPrivateKey(e).toRawBytes(!1).slice(1))};r.privateToAddress=function(e){return(0,r.publicToAddress)((0,r.privateToPublic)(e))};r.importPublic=function(e){return(0,u.assertIsBuffer)(e),64!==e.length&&(e=t.from(s.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),e};r.zeroAddress=function(){const e=(0,a.zeros)(20);return(0,a.bufferToHex)(e)};function f(e){const[t,r,n,i]=e;return[t,r,0===(0,a.arrToBufArr)(n).length?c.KECCAK256_RLP:n,0===(0,a.arrToBufArr)(i).length?c.KECCAK256_NULL:i]}r.isZeroAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return(0,r.zeroAddress)()===e},r.accountBodyFromSlim=f;const l=new Uint8Array(0);r.accountBodyToSlim=function(e){const[t,r,n,i]=e;return[t,r,(0,a.arrToBufArr)(n).equals(c.KECCAK256_RLP)?l:n,(0,a.arrToBufArr)(i).equals(c.KECCAK256_NULL)?l:i]},r.accountBodyToRLP=function(e,t=!0){const r=t?f(e):e;return(0,a.arrToBufArr)(n.RLP.encode(r))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/account.js"}],[694,{"./account":693,"./bytes":696,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Address=void 0;const n=e("./account"),i=e("./bytes");class s{constructor(e){if(20!==e.length)throw new Error("Invalid address length");this.buf=e}static zero(){return new s((0,i.zeros)(20))}static fromString(e){if(!(0,n.isValidAddress)(e))throw new Error("Invalid address");return new s((0,i.toBuffer)(e))}static fromPublicKey(e){if(!t.isBuffer(e))throw new Error("Public key should be Buffer");const r=(0,n.pubToAddress)(e);return new s(r)}static fromPrivateKey(e){if(!t.isBuffer(e))throw new Error("Private key should be Buffer");const r=(0,n.privateToAddress)(e);return new s(r)}static generate(e,t){if("bigint"!=typeof t)throw new Error("Expected nonce to be a bigint");return new s((0,n.generateAddress)(e.buf,(0,i.bigIntToBuffer)(t)))}static generate2(e,r,i){if(!t.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!t.isBuffer(i))throw new Error("Expected initCode to be a Buffer");return new s((0,n.generateAddress2)(e.buf,r,i))}equals(e){return this.buf.equals(e.buf)}isZero(){return this.equals(s.zero())}isPrecompileOrSystemAddress(){const e=(0,i.bufferToBigInt)(this.buf),t=BigInt(0),r=BigInt("0xffff");return e>=t&&e<=r}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return t.from(this.buf)}}r.Address=s}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/address.js"}],[695,{events:4399},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AsyncEventEmitter=void 0;const n=e("events");class i extends n.EventEmitter{emit(e,...t){let[r,n]=t;const i=this;let s=i._events[e]??[];return n===undefined&&"function"==typeof r&&(n=r,r=undefined),"newListener"!==e&&"removeListener"!==e||(r={event:r,fn:n},n=undefined),s=Array.isArray(s)?s:[s],async function(e,t,r){let n;for await(const i of t)try{i.length<2?i.call(e,r):await new Promise(((t,n)=>{i.call(e,r,(e=>{e?n(e):t()}))}))}catch(e){n=e}if(n)throw n}(i,s.slice(),r).then(n).catch(n),i.listenerCount(e)>0}once(e,t){const r=this;let n;if("function"!=typeof t)throw new TypeError("listener must be a function");return n=t.length>=2?function(i,s){r.removeListener(e,n),t(i,s)}:function(i){r.removeListener(e,n),t(i,n)},r.on(e,n),r}first(e,t){let r=this._events[e]??[];if("function"!=typeof t)throw new TypeError("listener must be a function");return Array.isArray(r)||(this._events[e]=r=[r]),r.unshift(t),this}before(e,t,r){return this.beforeOrAfter(e,t,r)}after(e,t,r){return this.beforeOrAfter(e,t,r,"after")}beforeOrAfter(e,t,r,n){let i,s,o=this._events[e]??[];const a="after"===n?1:0;if("function"!=typeof r)throw new TypeError("listener must be a function");if("function"!=typeof t)throw new TypeError("target must be a function");for(Array.isArray(o)||(this._events[e]=o=[o]),s=o.length,i=o.length;i--;)if(o[i]===t){s=i+a;break}return o.splice(s,0,r),this}on(e,t){return super.on(e,t)}addListener(e,t){return super.addListener(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}removeListener(e,t){return super.removeListener(e,t)}eventNames(){return super.eventNames()}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(e){return super.setMaxListeners(e)}}r.AsyncEventEmitter=i}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/asyncEventEmitter.js"}],[696,{"./helpers":699,"./internal":701,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.intToUnpaddedBuffer=r.bigIntToUnpaddedBuffer=r.bigIntToHex=r.bufArrToArr=r.arrToBufArr=r.validateNoLeadingZeroes=r.baToJSON=r.toUtf8=r.short=r.addHexPrefix=r.toUnsigned=r.fromSigned=r.bufferToInt=r.bigIntToBuffer=r.bufferToBigInt=r.bufferToHex=r.toBuffer=r.unpadHexString=r.unpadArray=r.unpadBuffer=r.setLengthRight=r.setLengthLeft=r.zeros=r.intToBuffer=r.intToHex=void 0;const n=e("./helpers"),i=e("./internal");r.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`};r.intToBuffer=function(e){const n=(0,r.intToHex)(e);return t.from((0,i.padToEven)(n.slice(2)),"hex")};r.zeros=function(e){return t.allocUnsafe(e).fill(0)};const s=function(e,t,n){const i=(0,r.zeros)(t);return n?e.length<t?(e.copy(i),i):e.slice(0,t):e.length<t?(e.copy(i,t-e.length),i):e.slice(-t)};r.setLengthLeft=function(e,t){return(0,n.assertIsBuffer)(e),s(e,t,!1)};r.setLengthRight=function(e,t){return(0,n.assertIsBuffer)(e),s(e,t,!0)};const o=function(e){let t=e[0];for(;e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};r.unpadBuffer=function(e){return(0,n.assertIsBuffer)(e),o(e)};r.unpadArray=function(e){return(0,n.assertIsArray)(e),o(e)};r.unpadHexString=function(e){return(0,n.assertIsHexString)(e),e=(0,i.stripHexPrefix)(e),"0x"+o(e)};r.toBuffer=function(e){if(null===e||e===undefined)return t.allocUnsafe(0);if(t.isBuffer(e))return t.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return t.from(e);if("string"==typeof e){if(!(0,i.isHexString)(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return t.from((0,i.padToEven)((0,i.stripHexPrefix)(e)),"hex")}if("number"==typeof e)return(0,r.intToBuffer)(e);if("bigint"==typeof e){if(e<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${e}`);let r=e.toString(16);return r.length%2&&(r="0"+r),t.from(r,"hex")}if(e.toArray)return t.from(e.toArray());if(e.toBuffer)return t.from(e.toBuffer());throw new Error("invalid type")};function a(e){const t=(0,r.bufferToHex)(e);return"0x"===t?BigInt(0):BigInt(t)}function c(e){return(0,r.toBuffer)("0x"+e.toString(16))}r.bufferToHex=function(e){return"0x"+(e=(0,r.toBuffer)(e)).toString("hex")},r.bufferToBigInt=a,r.bigIntToBuffer=c;r.bufferToInt=function(e){const t=Number(a(e));if(!Number.isSafeInteger(t))throw new Error("Number exceeds 53 bits");return t};r.fromSigned=function(e){return BigInt.asIntN(256,a(e))};r.toUnsigned=function(e){return c(BigInt.asUintN(256,e))};r.addHexPrefix=function(e){return"string"!=typeof e||(0,i.isHexPrefixed)(e)?e:"0x"+e},r.short=function(e,r=50){const n=t.isBuffer(e)?e.toString("hex"):e;return n.length<=r?n:n.slice(0,r)+"…"};r.toUtf8=function(e){if((e=(0,i.stripHexPrefix)(e)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return t.from(e.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};r.baToJSON=function(e){if(t.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const t=[];for(let n=0;n<e.length;n++)t.push((0,r.baToJSON)(e[n]));return t}};r.validateNoLeadingZeroes=function(e){for(const[t,r]of Object.entries(e))if(r!==undefined&&r.length>0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${r.toString("hex")}`)},r.arrToBufArr=function e(r){return Array.isArray(r)?r.map((t=>e(t))):t.from(r)},r.bufArrToArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):Uint8Array.from(t??[])};r.bigIntToHex=e=>"0x"+e.toString(16),r.bigIntToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)(c(e))},r.intToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)((0,r.intToBuffer)(e))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/bytes.js"}],[697,{buffer:4074,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.MAX_WITHDRAWALS_PER_PAYLOAD=r.RLP_EMPTY_STRING=r.KECCAK256_RLP=r.KECCAK256_RLP_S=r.KECCAK256_RLP_ARRAY=r.KECCAK256_RLP_ARRAY_S=r.KECCAK256_NULL=r.KECCAK256_NULL_S=r.TWO_POW256=r.SECP256K1_ORDER_DIV_2=r.SECP256K1_ORDER=r.MAX_INTEGER_BIGINT=r.MAX_INTEGER=r.MAX_UINT64=void 0;const n=e("buffer"),i=e("ethereum-cryptography/secp256k1");r.MAX_UINT64=BigInt("0xffffffffffffffff"),r.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),r.SECP256K1_ORDER=i.secp256k1.CURVE.n,r.SECP256K1_ORDER_DIV_2=i.secp256k1.CURVE.n/BigInt(2),r.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.KECCAK256_NULL=n.Buffer.from(r.KECCAK256_NULL_S,"hex"),r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.KECCAK256_RLP_ARRAY=n.Buffer.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.KECCAK256_RLP=n.Buffer.from(r.KECCAK256_RLP_S,"hex"),r.RLP_EMPTY_STRING=n.Buffer.from([128]),r.MAX_WITHDRAWALS_PER_PAYLOAD=16}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/constants.js"}],[698,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.compactBytesToNibbles=r.bytesToNibbles=r.nibblesToCompactBytes=r.nibblesToBytes=r.hasTerminator=void 0;r.hasTerminator=e=>e.length>0&&16===e[e.length-1];r.nibblesToBytes=(e,t)=>{for(let r=0,n=0;n<e.length;r+=1,n+=2)t[r]=e[n]<<4|e[n+1]};r.nibblesToCompactBytes=e=>{let t=0;(0,r.hasTerminator)(e)&&(t=1,e=e.subarray(0,e.length-1));const n=new Uint8Array(e.length/2+1);return n[0]=t<<5,1&~e.length||(n[0]|=16,n[0]|=e[0],e=e.subarray(1)),(0,r.nibblesToBytes)(e,n.subarray(1)),n};r.bytesToNibbles=e=>{const t=2*e.length+1,r=new Uint8Array(t);for(let t=0;t<e.length;t++){const n=e[t];r[2*t]=n/16,r[2*t+1]=n%16}return r[t-1]=16,r};r.compactBytesToNibbles=e=>{if(0===e.length)return e;let t=(0,r.bytesToNibbles)(e);t[0]<2&&(t=t.subarray(0,t.length-1));const n=2-(1&t[0]);return t.subarray(n)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/encoding.js"}],[699,{"../../../../../../../../../is-buffer/index.js":4657,"./internal":701},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.assertIsString=r.assertIsArray=r.assertIsBuffer=r.assertIsHexString=void 0;const n=e("./internal");r.assertIsHexString=function(e){if(!(0,n.isHexString)(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}};r.assertIsBuffer=function(e){if(!t.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}};r.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}};r.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}}).call(this)}).call(this,{isBuffer:e("../../../../../../../../../is-buffer/index.js")})}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/helpers.js"}],[700,{"./account":693,"./address":694,"./asyncEventEmitter":695,"./bytes":696,"./constants":697,"./encoding":698,"./internal":701,"./lock":702,"./provider":703,"./signature":704,"./types":705,"./units":706,"./withdrawal":707},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.toAscii=r.stripHexPrefix=r.padToEven=r.isHexString=r.isHexPrefixed=r.getKeys=r.getBinarySize=r.fromUtf8=r.fromAscii=r.arrayContainsArray=void 0,i(e("./constants"),r),i(e("./units"),r),i(e("./account"),r),i(e("./address"),r),i(e("./withdrawal"),r),i(e("./signature"),r),i(e("./bytes"),r),i(e("./types"),r),i(e("./encoding"),r),i(e("./asyncEventEmitter"),r);var s=e("./internal");Object.defineProperty(r,"arrayContainsArray",{enumerable:!0,get:function(){return s.arrayContainsArray}}),Object.defineProperty(r,"fromAscii",{enumerable:!0,get:function(){return s.fromAscii}}),Object.defineProperty(r,"fromUtf8",{enumerable:!0,get:function(){return s.fromUtf8}}),Object.defineProperty(r,"getBinarySize",{enumerable:!0,get:function(){return s.getBinarySize}}),Object.defineProperty(r,"getKeys",{enumerable:!0,get:function(){return s.getKeys}}),Object.defineProperty(r,"isHexPrefixed",{enumerable:!0,get:function(){return s.isHexPrefixed}}),Object.defineProperty(r,"isHexString",{enumerable:!0,get:function(){return s.isHexString}}),Object.defineProperty(r,"padToEven",{enumerable:!0,get:function(){return s.padToEven}}),Object.defineProperty(r,"stripHexPrefix",{enumerable:!0,get:function(){return s.stripHexPrefix}}),Object.defineProperty(r,"toAscii",{enumerable:!0,get:function(){return s.toAscii}}),i(e("./lock"),r),i(e("./provider"),r)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/index.js"}],[701,{buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(e){(function(){function t(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,r.isHexPrefixed=t;function n(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}r.stripHexPrefix=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return t(e)?e.slice(2):e},r.padToEven=n,r.getBinarySize=function(t){if("string"!=typeof t)throw new Error("[getBinarySize] method requires input type 'string', received "+typeof t);return e.byteLength(t,"utf8")},r.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(!0!==Array.isArray(t))throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[!0===r?"some":"every"]((t=>e.indexOf(t)>=0))},r.toAscii=function(e){let t="",r=0;const n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){const n=parseInt(e.substr(r,2),16);t+=String.fromCharCode(n)}return t},r.fromUtf8=function(t){return`0x${n(e.from(t,"utf8").toString("hex")).replace(/^0+|0+$/g,"")}`},r.fromAscii=function(e){let t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r).toString(16);t+=n.length<2?`0${n}`:n}return`0x${t}`},r.getKeys=function(e,t,r){if(!Array.isArray(e))throw new Error("[getKeys] method expects input 'params' to be an array, got "+typeof e);if("string"!=typeof t)throw new Error("[getKeys] method expects input 'key' to be type 'string', got "+typeof e);const n=[];for(let i=0;i<e.length;i++){let s=e[i][t];if(!0!==r||s){if("string"!=typeof s)throw new Error("invalid abi - expected type 'string', received "+typeof s)}else s="";n.push(s)}return n},r.isHexString=function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&!(void 0!==t&&t>0&&e.length!==2+2*t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/internal.js"}],[702,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Lock=void 0;r.Lock=class{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise((e=>this.promiseResolverQueue.push(e)))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;const e=this.promiseResolverQueue.shift();e&&e(!0)}}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/lock.js"}],[703,{"micro-ftch":4910},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getProvider=r.fetchFromProvider=void 0;const n=e("micro-ftch");r.fetchFromProvider=async(e,t)=>(await(0,n.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;r.getProvider=e=>{if("string"==typeof e)return e;if(e?.connection?.url!==undefined)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/provider.js"}],[704,{"./bytes":696,"./constants":697,"./helpers":699,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.hashPersonalMessage=r.isValidSignature=r.fromRpcSig=r.toCompactSig=r.toRpcSig=r.ecrecover=r.ecsign=void 0;const n=e("ethereum-cryptography/keccak"),i=e("ethereum-cryptography/secp256k1"),s=e("./bytes"),o=e("./constants"),a=e("./helpers");function c(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===undefined?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function u(e){return e===BigInt(0)||e===BigInt(1)}r.ecsign=function(e,r,n){const s=i.secp256k1.sign(e,r),o=s.toCompactRawBytes();return{r:t.from(o.slice(0,32)),s:t.from(o.slice(32,64)),v:n===undefined?BigInt(s.recovery+27):BigInt(s.recovery+35)+BigInt(n)*BigInt(2)}};r.ecrecover=function(e,r,n,o,a){const d=t.concat([(0,s.setLengthLeft)(n,32),(0,s.setLengthLeft)(o,32)],64),h=c(r,a);if(!u(h))throw new Error("Invalid signature v value");const p=i.secp256k1.Signature.fromCompact(d).addRecoveryBit(Number(h)).recoverPublicKey(e);return t.from(p.toRawBytes(!1).slice(1))};r.toRpcSig=function(e,r,n,i){if(!u(c(e,i)))throw new Error("Invalid signature v value");return(0,s.bufferToHex)(t.concat([(0,s.setLengthLeft)(r,32),(0,s.setLengthLeft)(n,32),(0,s.toBuffer)(e)]))};r.toCompactSig=function(e,r,n,i){if(!u(c(e,i)))throw new Error("Invalid signature v value");let o=n;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(o=t.from(n),o[0]|=128),(0,s.bufferToHex)(t.concat([(0,s.setLengthLeft)(r,32),(0,s.setLengthLeft)(o,32)]))};r.fromRpcSig=function(e){const t=(0,s.toBuffer)(e);let r,n,i;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),i=(0,s.bufferToBigInt)(t.slice(64));else{if(64!==t.length)throw new Error("Invalid signature length");r=t.slice(0,32),n=t.slice(32,64),i=BigInt((0,s.bufferToInt)(t.slice(32,33))>>7),n[0]&=127}return i<27&&(i+=BigInt(27)),{v:i,r:r,s:n}};r.isValidSignature=function(e,t,r,n=!0,i){if(32!==t.length||32!==r.length)return!1;if(!u(c(e,i)))return!1;const a=(0,s.bufferToBigInt)(t),d=(0,s.bufferToBigInt)(r);return!(a===BigInt(0)||a>=o.SECP256K1_ORDER||d===BigInt(0)||d>=o.SECP256K1_ORDER)&&!(n&&d>=o.SECP256K1_ORDER_DIV_2)};r.hashPersonalMessage=function(e){(0,a.assertIsBuffer)(e);const r=t.from(`Ethereum Signed Message:\n${e.length}`,"utf-8");return t.from((0,n.keccak256)(t.concat([r,e])))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/signature.js"}],[705,{"./bytes":696,"./internal":701},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.toType=r.TypeOutput=void 0;const n=e("./bytes"),i=e("./internal");var s;!function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(s=r.TypeOutput||(r.TypeOutput={})),r.toType=function(e,t){if(null===e)return null;if(e===undefined)return undefined;if("string"==typeof e&&!(0,i.isHexString)(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const r=(0,n.toBuffer)(e);switch(t){case s.Buffer:return r;case s.BigInt:return(0,n.bufferToBigInt)(r);case s.Number:{const e=(0,n.bufferToBigInt)(r);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case s.PrefixedHexString:return(0,n.bufferToHex)(r);default:throw new Error("unknown outputType")}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/types.js"}],[706,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.GWEI_TO_WEI=void 0,r.GWEI_TO_WEI=BigInt(1e9)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/units.js"}],[707,{"./address":694,"./bytes":696,"./types":705,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Withdrawal=void 0;const n=e("./address"),i=e("./bytes"),s=e("./types");class o{constructor(e,t,r,n){this.index=e,this.validatorIndex=t,this.address=r,this.amount=n}static fromWithdrawalData(e){const{index:t,validatorIndex:r,address:i,amount:a}=e,c=(0,s.toType)(t,s.TypeOutput.BigInt),u=(0,s.toType)(r,s.TypeOutput.BigInt),d=new n.Address((0,s.toType)(i,s.TypeOutput.Buffer)),h=(0,s.toType)(a,s.TypeOutput.BigInt);return new o(c,u,d,h)}static fromValuesArray(e){if(4!==e.length)throw Error(`Invalid withdrawalArray length expected=4 actual=${e.length}`);const[t,r,n,i]=e;return o.fromWithdrawalData({index:t,validatorIndex:r,address:n,amount:i})}static toBufferArray(e){const{index:r,validatorIndex:i,address:o,amount:a}=e,c=(0,s.toType)(r,s.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,s.toType)(r,s.TypeOutput.Buffer),u=(0,s.toType)(i,s.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,s.toType)(i,s.TypeOutput.Buffer);let d;d=o instanceof n.Address?o.buf:(0,s.toType)(o,s.TypeOutput.Buffer);return[c,u,d,(0,s.toType)(a,s.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,s.toType)(a,s.TypeOutput.Buffer)]}raw(){return o.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,i.bigIntToHex)(this.index),validatorIndex:(0,i.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,i.bigIntToHex)(this.amount)}}}r.Withdrawal=o}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@ethereumjs/util",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry-eth/node_modules/@ethereumjs/util/dist/withdrawal.js"}],[708,{"./RegistryItem":719,"./RegistryType":720,"./lib":730},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Bytes=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");class o extends i.RegistryItem{constructor(e){super(),this.bytes=e,this.getRegistryType=()=>s.RegistryTypes.BYTES,this.getData=()=>this.bytes,this.toDataItem=()=>new n.DataItem(this.bytes)}}r.Bytes=o,o.fromDataItem=e=>{const t=e.getData();if(!t)throw new Error(`#[ur-registry][Bytes][fn.fromDataItem]: decoded [dataItem][#data] is undefined: ${e}`);return new o(t)},o.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return o.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/Bytes.js"}],[709,{".":727,"./RegistryItem":719,"./RegistryType":720,"./lib":730,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoAccount=void 0;const n=e("."),i=e("./lib"),s=e("./RegistryItem"),o=e("./RegistryType");var a;!function(e){e[e.masterFingerprint=1]="masterFingerprint",e[e.outputDescriptors=2]="outputDescriptors"}(a||(a={}));class c extends s.RegistryItem{constructor(e,t){super(),this.masterFingerprint=e,this.outputDescriptors=t,this.getRegistryType=()=>o.RegistryTypes.CRYPTO_ACCOUNT,this.getMasterFingerprint=()=>this.masterFingerprint,this.getOutputDescriptors=()=>this.outputDescriptors,this.toDataItem=()=>{const e={};return this.masterFingerprint&&(e[a.masterFingerprint]=this.masterFingerprint.readUInt32BE(0)),this.outputDescriptors&&(e[a.outputDescriptors]=this.outputDescriptors.map((e=>e.toDataItem()))),new i.DataItem(e)}}}r.CryptoAccount=c,c.fromDataItem=e=>{const r=e.getData(),i=t.alloc(4),s=r[a.masterFingerprint];s&&i.writeUInt32BE(s,0);const o=r[a.outputDescriptors].map((e=>n.CryptoOutput.fromDataItem(e)));return new c(i,o)},c.fromCBOR=e=>{const t=(0,i.decodeToDataItem)(e);return c.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoAccount.js"}],[710,{"./RegistryItem":719,"./RegistryType":720,"./lib":730},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoCoinInfo=r.Network=r.Type=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");var o,a,c;!function(e){e.type="1",e.network="2"}(o||(o={})),function(e){e[e.bitcoin=0]="bitcoin"}(a=r.Type||(r.Type={})),function(e){e[e.mainnet=0]="mainnet",e[e.testnet=1]="testnet"}(c=r.Network||(r.Network={}));class u extends i.RegistryItem{constructor(e,t){super(),this.type=e,this.network=t,this.getRegistryType=()=>s.RegistryTypes.CRYPTO_COIN_INFO,this.getType=()=>this.type||a.bitcoin,this.getNetwork=()=>this.network||c.mainnet,this.toDataItem=()=>{const e={};return this.type&&(e[o.type]=this.type),this.network&&(e[o.network]=this.network),new n.DataItem(e)}}}r.CryptoCoinInfo=u,u.fromDataItem=e=>{const t=e.getData(),r=t[o.type],n=t[o.network];return new u(r,n)},u.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return u.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoCoinInfo.js"}],[711,{"./RegistryItem":719,"./RegistryType":720,"./lib":730},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoECKey=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");var o;!function(e){e[e.curve=1]="curve",e[e.private=2]="private",e[e.data=3]="data"}(o||(o={}));class a extends i.RegistryItem{constructor(e){super(),this.isECKey=()=>!0,this.getCurve=()=>this.curve||0,this.isPrivateKey=()=>this.privateKey||!1,this.getData=()=>this.data,this.getRegistryType=()=>s.RegistryTypes.CRYPTO_ECKEY,this.toDataItem=()=>{const e={};return this.curve&&(e[o.curve]=this.curve),this.privateKey!==undefined&&(e[o.private]=this.privateKey),e[o.data]=this.data,new n.DataItem(e)},this.getOutputDescriptorContent=()=>this.data.toString("hex"),this.data=e.data,this.curve=e.curve,this.privateKey=e.privateKey||undefined}}r.CryptoECKey=a,a.fromDataItem=e=>{const t=e.getData(),r=t[o.curve],n=t[o.private],i=t[o.data];if(!i)throw new Error(`#[ur-registry][CryptoECKey][fn.fromDataItem]: decoded [dataItem][#data.data] is undefined: ${e}`);return new a({data:i,curve:r,privateKey:n})},a.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return a.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoECKey.js"}],[712,{"./CryptoCoinInfo":710,"./CryptoKeypath":713,"./RegistryItem":719,"./RegistryType":720,"./lib":730,bs58check:4077,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoHDKey=void 0;const n=e("bs58check"),i=e("./CryptoCoinInfo"),s=e("./CryptoKeypath"),o=e("./lib"),a=e("./RegistryItem"),c=e("./RegistryType");var u;!function(e){e[e.is_master=1]="is_master",e[e.is_private=2]="is_private",e[e.key_data=3]="key_data",e[e.chain_code=4]="chain_code",e[e.use_info=5]="use_info",e[e.origin=6]="origin",e[e.children=7]="children",e[e.parent_fingerprint=8]="parent_fingerprint",e[e.name=9]="name",e[e.note=10]="note"}(u||(u={}));class d extends a.RegistryItem{constructor(e){super(),this.isECKey=()=>!1,this.getKey=()=>this.key,this.getChainCode=()=>this.chainCode,this.isMaster=()=>this.master,this.isPrivateKey=()=>!!this.privateKey,this.getUseInfo=()=>this.useInfo,this.getOrigin=()=>this.origin,this.getChildren=()=>this.children,this.getParentFingerprint=()=>this.parentFingerprint,this.getName=()=>this.name,this.getNote=()=>this.note,this.getBip32Key=()=>{var e,r,i;let s,o,a=0,c=t.alloc(4).fill(0);if(this.isMaster())s=t.from("0488ADE4","hex"),o=0,a=0;else{o=(null===(e=this.getOrigin())||void 0===e?void 0:e.getComponents().length)||(null===(r=this.getOrigin())||void 0===r?void 0:r.getDepth());const n=null===(i=this.getOrigin())||void 0===i?void 0:i.getComponents(),u=n[n.length-1];u&&(a=u.isHardened()?u.getIndex()+2147483648:u.getIndex(),this.getParentFingerprint()&&(c=this.getParentFingerprint())),s=this.isPrivateKey()?t.from("0488ADE4","hex"):t.from("0488B21E","hex")}const u=t.alloc(1);u.writeUInt8(o,0);const d=t.alloc(4);d.writeUInt32BE(a,0);const h=this.getChainCode(),p=this.getKey();return(0,n.encode)(t.concat([s,u,c,d,h,p]))},this.getRegistryType=()=>c.RegistryTypes.CRYPTO_HDKEY,this.getOutputDescriptorContent=()=>{var e,t,r,n,i,s,o;let a="";return this.getOrigin()&&(null===(e=this.getOrigin())||void 0===e?void 0:e.getSourceFingerprint())&&(null===(t=this.getOrigin())||void 0===t?void 0:t.getPath())&&(a+=`${null===(n=null===(r=this.getOrigin())||void 0===r?void 0:r.getSourceFingerprint())||void 0===n?void 0:n.toString("hex")}/${null===(i=this.getOrigin())||void 0===i?void 0:i.getPath()}`),a+=this.getBip32Key(),this.getChildren()&&(null===(s=this.getChildren())||void 0===s?void 0:s.getPath())&&(a+=`/${null===(o=this.getChildren())||void 0===o?void 0:o.getPath()}`),a},this.setupMasterKey=e=>{this.master=!0,this.key=e.key,this.chainCode=e.chainCode},this.setupDeriveKey=e=>{this.master=!1,this.privateKey=e.isPrivateKey,this.key=e.key,this.chainCode=e.chainCode,this.useInfo=e.useInfo,this.origin=e.origin,this.children=e.children,this.parentFingerprint=e.parentFingerprint,this.name=e.name,this.note=e.note},this.toDataItem=()=>{const e={};if(this.master)e[u.is_master]=!0,e[u.key_data]=this.key,e[u.chain_code]=this.chainCode;else{if(this.privateKey!==undefined&&(e[u.is_private]=this.privateKey),e[u.key_data]=this.key,this.chainCode&&(e[u.chain_code]=this.chainCode),this.useInfo){const t=this.useInfo.toDataItem();t.setTag(this.useInfo.getRegistryType().getTag()),e[u.use_info]=t}if(this.origin){const t=this.origin.toDataItem();t.setTag(this.origin.getRegistryType().getTag()),e[u.origin]=t}if(this.children){const t=this.children.toDataItem();t.setTag(this.children.getRegistryType().getTag()),e[u.children]=t}this.parentFingerprint&&(e[u.parent_fingerprint]=this.parentFingerprint.readUInt32BE(0)),this.name!==undefined&&(e[u.name]=this.name),this.note!==undefined&&(e[u.note]=this.note)}return new o.DataItem(e)},e.isMaster?this.setupMasterKey(e):this.setupDeriveKey(e)}}r.CryptoHDKey=d,d.fromDataItem=e=>{const r=e.getData(),n=!!r[u.is_master],o=r[u.is_private],a=r[u.key_data],c=r[u.chain_code],h=r[u.use_info]?i.CryptoCoinInfo.fromDataItem(r[u.use_info]):undefined,p=r[u.origin]?s.CryptoKeypath.fromDataItem(r[u.origin]):undefined,f=r[u.children]?s.CryptoKeypath.fromDataItem(r[u.children]):undefined,l=r[u.parent_fingerprint];let g=undefined;l&&(g=t.alloc(4),g.writeUInt32BE(l,0));const y=r[u.name],m=r[u.note];return new d({isMaster:n,isPrivateKey:o,key:a,chainCode:c,useInfo:h,origin:p,children:f,parentFingerprint:g,name:y,note:m})},d.fromCBOR=e=>{const t=(0,o.decodeToDataItem)(e);return d.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoHDKey.js"}],[713,{"./PathComponent":718,"./RegistryItem":719,"./RegistryType":720,"./lib":730,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoKeypath=void 0;const n=e("./lib"),i=e("./PathComponent"),s=e("./RegistryItem"),o=e("./RegistryType");var a;!function(e){e[e.components=1]="components",e[e.source_fingerprint=2]="source_fingerprint",e[e.depth=3]="depth"}(a||(a={}));class c extends s.RegistryItem{constructor(e=[],t,r){super(),this.components=e,this.sourceFingerprint=t,this.depth=r,this.getRegistryType=()=>o.RegistryTypes.CRYPTO_KEYPATH,this.getPath=()=>{if(0===this.components.length)return undefined;return this.components.map((e=>`${e.isWildcard()?"*":e.getIndex()}${e.isHardened()?"'":""}`)).join("/")},this.getComponents=()=>this.components,this.getSourceFingerprint=()=>this.sourceFingerprint,this.getDepth=()=>this.depth,this.toDataItem=()=>{const e={},t=[];return this.components&&this.components.forEach((e=>{e.isWildcard()?t.push([]):t.push(e.getIndex()),t.push(e.isHardened())})),e[a.components]=t,this.sourceFingerprint&&(e[a.source_fingerprint]=this.sourceFingerprint.readUInt32BE(0)),this.depth!==undefined&&(e[a.depth]=this.depth),new n.DataItem(e)}}}r.CryptoKeypath=c,c.fromDataItem=e=>{const r=e.getData(),n=[],s=r[a.components];if(s)for(let e=0;e<s.length;e+=2){const t=s[e+1],r=s[e];"number"==typeof r?n.push(new i.PathComponent({index:r,hardened:t})):n.push(new i.PathComponent({hardened:t}))}const o=r[a.source_fingerprint];let u;o&&(u=t.alloc(4),u.writeUInt32BE(o,0));const d=r[a.depth];return new c(n,u,d)},c.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return c.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoKeypath.js"}],[714,{"./CryptoECKey":711,"./CryptoHDKey":712,"./MultiKey":717,"./RegistryItem":719,"./RegistryType":720,"./ScriptExpression":721,"./lib":730},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoOutput=void 0;const n=e("./CryptoECKey"),i=e("./CryptoHDKey"),s=e("./lib"),o=e("./MultiKey"),a=e("./RegistryItem"),c=e("./RegistryType"),u=e("./ScriptExpression");class d extends a.RegistryItem{constructor(e,t){super(),this.scriptExpressions=e,this.cryptoKey=t,this.getRegistryType=()=>c.RegistryTypes.CRYPTO_OUTPUT,this.getCryptoKey=()=>this.cryptoKey,this.getHDKey=()=>this.cryptoKey instanceof i.CryptoHDKey?this.cryptoKey:undefined,this.getECKey=()=>this.cryptoKey instanceof n.CryptoECKey?this.cryptoKey:undefined,this.getMultiKey=()=>this.cryptoKey instanceof o.MultiKey?this.cryptoKey:undefined,this.getScriptExpressions=()=>this.scriptExpressions,this._toOutputDescriptor=e=>e>=this.scriptExpressions.length?this.cryptoKey.getOutputDescriptorContent():`${this.scriptExpressions[e].getExpression()}(${this._toOutputDescriptor(e+1)})`,this.toString=()=>this._toOutputDescriptor(0),this.toDataItem=()=>{let e=this.cryptoKey.toDataItem();(this.cryptoKey instanceof n.CryptoECKey||this.cryptoKey instanceof i.CryptoHDKey)&&e.setTag(this.cryptoKey.getRegistryType().getTag());return[...this.scriptExpressions].reverse().forEach((t=>{const r=t.getTag();e.getTag()===undefined?e.setTag(r):e=new s.DataItem(e,r)})),e}}}r.CryptoOutput=d,d.fromDataItem=e=>{const t=[];let r=e;for(;;){let e=r.getTag();const n=u.ScriptExpression.fromTag(e);if(!n)break;if(t.push(n),!(r.getData()instanceof s.DataItem))break;r=r.getData(),e=r.getTag()}const a=t.length;if(a>0&&(t[a-1].getExpression()===u.ScriptExpressions.MULTISIG.getExpression()||t[a-1].getExpression()===u.ScriptExpressions.SORTED_MULTISIG.getExpression())){const e=o.MultiKey.fromDataItem(r);return new d(t,e)}if(r.getTag()===c.RegistryTypes.CRYPTO_HDKEY.getTag()){const e=i.CryptoHDKey.fromDataItem(r);return new d(t,e)}{const e=n.CryptoECKey.fromDataItem(r);return new d(t,e)}},d.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return d.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoOutput.js"}],[715,{"./RegistryItem":719,"./RegistryType":720,"./lib":730},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoPSBT=void 0;const n=e("./lib"),i=e("./RegistryItem"),s=e("./RegistryType");class o extends i.RegistryItem{constructor(e){super(),this.psbt=e,this.getRegistryType=()=>s.RegistryTypes.CRYPTO_PSBT,this.getPSBT=()=>this.psbt,this.toDataItem=()=>new n.DataItem(this.psbt)}}r.CryptoPSBT=o,o.fromDataItem=e=>{const t=e.getData();if(!t)throw new Error(`#[ur-registry][CryptoPSBT][fn.fromDataItem]: decoded [dataItem][#data] is undefined: ${e}`);return new o(t)},o.fromCBOR=e=>{const t=(0,n.decodeToDataItem)(e);return o.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/CryptoPSBT.js"}],[716,{"..":727,"../RegistryType":720,"../errors":722,"@ngraveio/bc-ur":2969},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.URRegistryDecoder=void 0;const n=e("@ngraveio/bc-ur"),i=e(".."),s=e("../RegistryType"),o=e("../errors");class a extends n.URDecoder{constructor(){super(...arguments),this.resultRegistryType=()=>{const e=this.resultUR();switch(e.type){case s.RegistryTypes.BYTES.getType():return i.Bytes.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_HDKEY.getType():return i.CryptoHDKey.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_KEYPATH.getType():return i.CryptoKeypath.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_COIN_INFO.getType():return i.CryptoCoinInfo.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_ECKEY.getType():return i.CryptoECKey.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_OUTPUT.getType():return i.CryptoOutput.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_PSBT.getType():return i.CryptoPSBT.fromCBOR(e.cbor);case s.RegistryTypes.CRYPTO_ACCOUNT.getType():return i.CryptoAccount.fromCBOR(e.cbor);default:throw new o.UnknownURTypeError(`#[ur-registry][Decoder][fn.resultRegistryType]: registry type ${e.type} is not supported now`)}}}}r.URRegistryDecoder=a}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/Decoder/index.js"}],[717,{"./CryptoECKey":711,"./CryptoHDKey":712,"./RegistryItem":719,"./RegistryType":720,"./lib/DataItem":728},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.MultiKey=void 0;const n=e("./CryptoECKey"),i=e("./CryptoHDKey"),s=e("./lib/DataItem"),o=e("./RegistryItem"),a=e("./RegistryType");var c;!function(e){e[e.threshold=1]="threshold",e[e.keys=2]="keys"}(c||(c={}));class u extends o.RegistryItem{constructor(e,t){super(),this.threshold=e,this.keys=t,this.getThreshold=()=>this.threshold,this.getKeys=()=>this.keys,this.toDataItem=()=>{const e={};e[c.threshold]=this.threshold;const t=this.keys.map((e=>{const t=e.toDataItem();return t.setTag(e.getRegistryType().getTag()),t}));return e[c.keys]=t,new s.DataItem(e)},this.getOutputDescriptorContent=()=>[this.getThreshold(),this.keys.map((e=>e.getOutputDescriptorContent())).join(",")].join(",")}}r.MultiKey=u,u.fromDataItem=e=>{const t=e.getData(),r=t[c.threshold],s=t[c.keys],o=[];return s.forEach((e=>{e.getTag()===a.RegistryTypes.CRYPTO_HDKEY.getTag()?o.push(i.CryptoHDKey.fromDataItem(e)):e.getTag()===a.RegistryTypes.CRYPTO_ECKEY.getTag()&&o.push(n.CryptoECKey.fromDataItem(e))})),new u(r,o)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/MultiKey.js"}],[718,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.PathComponent=void 0;class n{constructor(e){if(this.getIndex=()=>this.index,this.isWildcard=()=>this.wildcard,this.isHardened=()=>this.hardened,this.index=e.index,this.hardened=e.hardened,this.index!==undefined?this.wildcard=!1:this.wildcard=!0,this.index&&this.index&n.HARDENED_BIT)throw new Error(`#[ur-registry][PathComponent][fn.constructor]: Invalid index ${this.index} - most significant bit cannot be set`)}}r.PathComponent=n,n.HARDENED_BIT=2147483648}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/PathComponent.js"}],[719,{"./lib":730,"@ngraveio/bc-ur":2969},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.RegistryItem=void 0;const n=e("@ngraveio/bc-ur"),i=e("./lib");r.RegistryItem=class{constructor(){this.toCBOR=()=>{if(this.toDataItem()===undefined)throw new Error(`#[ur-registry][RegistryItem][fn.toCBOR]: registry ${this.getRegistryType()}'s method toDataItem returns undefined`);return(0,i.encodeDataItem)(this.toDataItem())},this.toUR=()=>new n.UR(this.toCBOR(),this.getRegistryType().getType()),this.toUREncoder=(e,t,r)=>{const i=this.toUR();return new n.UREncoder(i,e,t,r)}}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/RegistryItem.js"}],[720,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.RegistryTypes=r.RegistryType=void 0;class n{constructor(e,t){this.type=e,this.tag=t,this.getTag=()=>this.tag,this.getType=()=>this.type}}r.RegistryType=n,r.RegistryTypes={UUID:new n("uuid",37),BYTES:new n("bytes",undefined),CRYPTO_HDKEY:new n("crypto-hdkey",303),CRYPTO_KEYPATH:new n("crypto-keypath",304),CRYPTO_COIN_INFO:new n("crypto-coin-info",305),CRYPTO_ECKEY:new n("crypto-eckey",306),CRYPTO_OUTPUT:new n("crypto-output",308),CRYPTO_PSBT:new n("crypto-psbt",310),CRYPTO_ACCOUNT:new n("crypto-account",311),CRYPTO_MULTI_ACCOUNTS:new n("crypto-multi-accounts",1103),QR_HARDWARE_CALL:new n("qr-hardware-call",1201),KEY_DERIVATION_CALL:new n("key-derivation-call",1301),KEY_DERIVATION_SCHEMA:new n("key-derivation-schema",1302)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/RegistryType.js"}],[721,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.ScriptExpressions=r.ScriptExpression=void 0;class n{constructor(e,t){this.tag=e,this.expression=t,this.getTag=()=>this.tag,this.getExpression=()=>this.expression}}r.ScriptExpression=n,n.fromTag=e=>Object.values(r.ScriptExpressions).find((t=>t.getTag()===e)),r.ScriptExpressions={SCRIPT_HASH:new n(400,"sh"),WITNESS_SCRIPT_HASH:new n(401,"wsh"),PUBLIC_KEY:new n(402,"pk"),PUBLIC_KEY_HASH:new n(403,"pkh"),WITNESS_PUBLIC_KEY_HASH:new n(404,"wpkh"),COMBO:new n(405,"combo"),MULTISIG:new n(406,"multi"),SORTED_MULTISIG:new n(407,"sortedmulti"),ADDRESS:new n(307,"addr"),RAW_SCRIPT:new n(408,"raw")}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/ScriptExpression.js"}],[722,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.UnknownURTypeError=void 0;class n extends Error{constructor(e){super(e)}}r.UnknownURTypeError=n}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/errors/index.js"}],[723,{"../CryptoHDKey":712,"../RegistryItem":719,"../RegistryType":720,"../lib":730,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.CryptoMultiAccounts=void 0;const n=e("../RegistryType"),i=e("../CryptoHDKey"),s=e("../RegistryItem"),o=e("../lib");var a;!function(e){e[e.masterFingerprint=1]="masterFingerprint",e[e.keys=2]="keys",e[e.device=3]="device",e[e.deviceId=4]="deviceId",e[e.version=5]="version"}(a||(a={}));class c extends s.RegistryItem{constructor(e,t,r,i,s){super(),this.masterFingerprint=e,this.keys=t,this.device=r,this.deviceId=i,this.version=s,this.getRegistryType=()=>n.RegistryTypes.CRYPTO_MULTI_ACCOUNTS,this.getMasterFingerprint=()=>this.masterFingerprint,this.getKeys=()=>this.keys,this.getDevice=()=>this.device,this.getDeviceId=()=>this.deviceId,this.getVersion=()=>this.version,this.toDataItem=()=>{const e={};return this.masterFingerprint&&(e[a.masterFingerprint]=this.masterFingerprint.readUInt32BE(0)),this.keys&&(e[a.keys]=this.keys.map((e=>{const t=e.toDataItem();return t.setTag(e.getRegistryType().getTag()),t}))),this.device&&(e[a.device]=this.device),this.deviceId&&(e[a.deviceId]=this.deviceId),this.version&&(e[a.version]=this.version),new o.DataItem(e)}}}r.CryptoMultiAccounts=c,c.fromDataItem=e=>{const r=e.getData(),n=t.alloc(4),s=r[a.masterFingerprint];s&&n.writeUInt32BE(s,0);const o=r[a.keys].map((e=>i.CryptoHDKey.fromDataItem(e))),u=r[a.device],d=r[a.deviceId],h=r[a.version];return new c(n,o,u,d,h)},c.fromCBOR=e=>{const t=(0,o.decodeToDataItem)(e);return c.fromDataItem(t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/CryptoMultiAccounts.js"}],[724,{"../CryptoKeypath":713,"../RegistryItem":719,"../RegistryType":720,"../lib":730},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.KeyDerivationSchema=r.DerivationAlgorithm=r.Curve=void 0;const n=e("../RegistryType"),i=e("../RegistryItem"),s=e("../lib"),o=e("../CryptoKeypath");var a,c,u;!function(e){e[e.keyPath=1]="keyPath",e[e.curve=2]="curve",e[e.algo=3]="algo"}(a||(a={})),function(e){e[e.secp256k1=0]="secp256k1",e[e.ed25519=1]="ed25519"}(c=r.Curve||(r.Curve={})),function(e){e[e.slip10=0]="slip10",e[e.bip32ed25519=1]="bip32ed25519"}(u=r.DerivationAlgorithm||(r.DerivationAlgorithm={}));class d extends i.RegistryItem{constructor(e,t=c.secp256k1,r=u.slip10){super(),this.keypath=e,this.curve=t,this.algo=r,this.getRegistryType=()=>n.RegistryTypes.KEY_DERIVATION_SCHEMA,this.getKeypath=()=>this.keypath,this.getCurve=()=>this.curve,this.getAlgo=()=>this.algo,this.toDataItem=()=>{const e={},t=this.getKeypath().toDataItem();return t.setTag(this.getKeypath().getRegistryType().getTag()),e[a.keyPath]=t,e[a.curve]=this.curve,e[a.algo]=this.algo,new s.DataItem(e)}}}r.KeyDerivationSchema=d,d.fromDataItem=e=>{const t=e.getData(),r=o.CryptoKeypath.fromDataItem(t[a.keyPath]),n=t[a.curve],i=t[a.algo];return new d(r,n,i)},d.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return d.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/DerivationSchema.js"}],[725,{"../RegistryItem":719,"../RegistryType":720,"../lib":730,"./DerivationSchema":724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.KeyDerivation=void 0;const n=e("../RegistryType"),i=e("../RegistryItem"),s=e("../lib"),o=e("./DerivationSchema");var a;!function(e){e[e.schemas=1]="schemas"}(a||(a={}));class c extends i.RegistryItem{constructor(e){super(),this.schemas=e,this.getRegistryType=()=>n.RegistryTypes.KEY_DERIVATION_CALL,this.getSchemas=()=>this.schemas,this.toDataItem=()=>{const e={};return e[a.schemas]=this.schemas.map((e=>{const t=e.toDataItem();return t.setTag(e.getRegistryType().getTag()),t})),new s.DataItem(e)}}}r.KeyDerivation=c,c.fromDataItem=e=>{const t=e.getData()[a.schemas].map((e=>o.KeyDerivationSchema.fromDataItem(e)));return new c(t)},c.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return c.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/KeyDerivation.js"}],[726,{"../RegistryItem":719,"../RegistryType":720,"../lib":730,"./KeyDerivation":725},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.QRHardwareCall=r.QRHardwareCallType=void 0;const n=e("../RegistryType"),i=e("../RegistryItem"),s=e("../lib"),o=e("./KeyDerivation");var a,c;!function(e){e[e.type=1]="type",e[e.params=2]="params",e[e.origin=3]="origin"}(a||(a={})),function(e){e[e.KeyDerivation=0]="KeyDerivation"}(c=r.QRHardwareCallType||(r.QRHardwareCallType={}));class u extends i.RegistryItem{constructor(e,t,r){super(),this.type=e,this.params=t,this.origin=r,this.getRegistryType=()=>n.RegistryTypes.QR_HARDWARE_CALL,this.getType=()=>this.type,this.getParams=()=>this.params,this.getOrigin=()=>this.origin,this.toDataItem=()=>{const e={};e[a.type]=this.type;const t=this.params.toDataItem();return t.setTag(this.params.getRegistryType().getTag()),e[a.params]=t,this.origin&&(e[a.origin]=this.origin),new s.DataItem(e)}}}r.QRHardwareCall=u,u.fromDataItem=e=>{const t=e.getData(),r=t[a.type]||c.KeyDerivation;let n;if(r===c.KeyDerivation)n=o.KeyDerivation.fromDataItem(t[a.params]);const i=t[a.origin];return new u(r,n,i)},u.fromCBOR=e=>{const t=(0,s.decodeToDataItem)(e);return u.fromDataItem(t)}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/extended/QRHardwareCall.js"}],[727,{"./Bytes":708,"./CryptoAccount":709,"./CryptoCoinInfo":710,"./CryptoECKey":711,"./CryptoHDKey":712,"./CryptoKeypath":713,"./CryptoOutput":714,"./CryptoPSBT":715,"./Decoder":716,"./MultiKey":717,"./PathComponent":718,"./RegistryItem":719,"./RegistryType":720,"./ScriptExpression":721,"./errors":722,"./extended/CryptoMultiAccounts":723,"./extended/DerivationSchema":724,"./extended/KeyDerivation":725,"./extended/QRHardwareCall":726,"./lib":730,"./patchCBOR":731,"./types":732,"./utils":733,"buffer/":4081,tslib:5615},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.extend=r.PathComponent=r.ScriptExpressions=r.MultiKey=r.CryptoPSBT=r.CryptoOutput=r.CryptoECKey=r.CryptoCoinInfoNetwork=r.CryptoCoinInfoType=r.CryptoCoinInfo=r.CryptoKeypath=r.CryptoMultiAccounts=r.CryptoHDKey=r.CryptoAccount=r.Bytes=r.URRegistryDecoder=r.DataItem=void 0;const n=e("tslib");e("./patchCBOR");const i=e("buffer/");Object.defineProperty(r,"Buffer",{enumerable:!0,get:function(){return i.Buffer}});const s=e("./CryptoHDKey");Object.defineProperty(r,"CryptoHDKey",{enumerable:!0,get:function(){return s.CryptoHDKey}});const o=e("./CryptoKeypath");Object.defineProperty(r,"CryptoKeypath",{enumerable:!0,get:function(){return o.CryptoKeypath}});const a=e("./CryptoCoinInfo");Object.defineProperty(r,"CryptoCoinInfo",{enumerable:!0,get:function(){return a.CryptoCoinInfo}}),Object.defineProperty(r,"CryptoCoinInfoType",{enumerable:!0,get:function(){return a.Type}}),Object.defineProperty(r,"CryptoCoinInfoNetwork",{enumerable:!0,get:function(){return a.Network}});const c=e("./CryptoECKey");Object.defineProperty(r,"CryptoECKey",{enumerable:!0,get:function(){return c.CryptoECKey}});const u=e("./Bytes");Object.defineProperty(r,"Bytes",{enumerable:!0,get:function(){return u.Bytes}});const d=e("./CryptoOutput");Object.defineProperty(r,"CryptoOutput",{enumerable:!0,get:function(){return d.CryptoOutput}});const h=e("./CryptoPSBT");Object.defineProperty(r,"CryptoPSBT",{enumerable:!0,get:function(){return h.CryptoPSBT}});const p=e("./CryptoAccount");Object.defineProperty(r,"CryptoAccount",{enumerable:!0,get:function(){return p.CryptoAccount}});const f=e("./Decoder");Object.defineProperty(r,"URRegistryDecoder",{enumerable:!0,get:function(){return f.URRegistryDecoder}});const l=e("./MultiKey");Object.defineProperty(r,"MultiKey",{enumerable:!0,get:function(){return l.MultiKey}});const g=e("./ScriptExpression");Object.defineProperty(r,"ScriptExpressions",{enumerable:!0,get:function(){return g.ScriptExpressions}});const y=e("./PathComponent");Object.defineProperty(r,"PathComponent",{enumerable:!0,get:function(){return y.PathComponent}});const m=e("./RegistryItem"),b=e("./RegistryType"),v=e("./lib");var k=e("./lib");Object.defineProperty(r,"DataItem",{enumerable:!0,get:function(){return k.DataItem}});const T=e("./utils"),w=e("./extended/CryptoMultiAccounts");Object.defineProperty(r,"CryptoMultiAccounts",{enumerable:!0,get:function(){return w.CryptoMultiAccounts}});const I={URRegistryDecoder:f.URRegistryDecoder,Bytes:u.Bytes,CryptoAccount:p.CryptoAccount,CryptoHDKey:s.CryptoHDKey,CryptoMultiAccounts:w.CryptoMultiAccounts,CryptoKeypath:o.CryptoKeypath,CryptoCoinInfo:a.CryptoCoinInfo,CryptoCoinInfoType:a.Type,CryptoCoinInfoNetwork:a.Network,CryptoECKey:c.CryptoECKey,CryptoOutput:d.CryptoOutput,CryptoPSBT:h.CryptoPSBT,MultiKey:l.MultiKey,ScriptExpressions:g.ScriptExpressions,PathComponent:y.PathComponent},_={addReader:v.addReader,addSemanticDecode:v.addSemanticDecode,addSemanticEncode:v.addSemanticEncode,addWriter:v.addWriter,patchTags:T.patchTags},C={RegistryTypes:b.RegistryTypes,RegistryItem:m.RegistryItem,RegistryType:b.RegistryType,decodeToDataItem:v.decodeToDataItem,encodeDataItem:v.encodeDataItem,cbor:_};r.extend=C,(0,n.__exportStar)(e("./errors"),r),(0,n.__exportStar)(e("./Decoder"),r),(0,n.__exportStar)(e("./lib"),r),(0,n.__exportStar)(e("./CryptoAccount"),r),(0,n.__exportStar)(e("./CryptoPSBT"),r),(0,n.__exportStar)(e("./CryptoHDKey"),r),(0,n.__exportStar)(e("./extended/CryptoMultiAccounts"),r),(0,n.__exportStar)(e("./extended/QRHardwareCall"),r),(0,n.__exportStar)(e("./extended/KeyDerivation"),r),(0,n.__exportStar)(e("./extended/DerivationSchema"),r),(0,n.__exportStar)(e("./CryptoOutput"),r),(0,n.__exportStar)(e("./CryptoCoinInfo"),r),(0,n.__exportStar)(e("./CryptoECKey"),r),(0,n.__exportStar)(e("./MultiKey"),r),(0,n.__exportStar)(e("./CryptoKeypath"),r),(0,n.__exportStar)(e("./patchCBOR"),r),(0,n.__exportStar)(e("./PathComponent"),r),(0,n.__exportStar)(e("./RegistryItem"),r),(0,n.__exportStar)(e("./RegistryType"),r),(0,n.__exportStar)(e("./types"),r),(0,n.__exportStar)(e("./utils"),r),r.default=I}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/index.js"}],[728,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.DataItem=void 0;r.DataItem=class{constructor(e,t){this.setTag=e=>{this.tag=e},this.clearTag=()=>{this.tag=undefined},this.getTag=()=>this.tag,this.getData=()=>this.data,this.data=e,this.tag=t}}}}},{package:"@keystonehq/metamask-airgapped-keyring>@keystonehq/bc-ur-registry-eth>@keystonehq/bc-ur-registry",file:"node_modules/@keystonehq/metamask-airgapped-keyring/node_modules/@keystonehq/bc-ur-registry/dist/lib/DataItem.js"}]],[],{});