LavaPack.loadBundle([["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js",{"@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/logger":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"FirebaseError",{enumerable:!0,get:function(){return o.FirebaseError}}),n._DEFAULT_ENTRY_NAME=n.SDK_VERSION=void 0,n._addComponent=q,n._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},n._apps=void 0,n._clearComponents=function(){H.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.
 */,n._components=void 0,n._getProvider=$,n._isFirebaseApp=W,n._isFirebaseServerApp=function(e){return e.settings!==undefined},n._registerComponent=G,n._removeServiceInstance=function(e,t,n=B){$(e,t).clearInstance(n)},n._serverApps=void 0,n.deleteApp=J,n.getApp=function(e=B){const t=F.get(e);if(!t&&e===B&&(0,o.getDefaultAppConfig)())return z();if(!t)throw V.create("no-app",{appName:e});return t},n.getApps=function(){return Array.from(F.values())},n.initializeApp=z,n.initializeServerApp=function(e,t){if((0,o.isBrowser)()&&!(0,o.isWebWorker)())throw V.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let n;n=W(e)?e.options:e;const r=Object.assign(Object.assign({},t),n);r.releaseOnDeref!==undefined&&delete r.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw V.create("finalization-registry-not-supported",{});const a=""+(c=JSON.stringify(r),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),i=U.get(a);var c;if(i)return i.incRefCount(t.releaseOnDeref),i;const d=new s.ComponentContainer(a);for(const e of H.values())d.addComponent(e);const l=new Q(n,t,a,d);return U.set(a,l),l},n.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw V.create("invalid-log-argument");(0,r.setUserLogHandler)(e,t)},n.registerVersion=X,n.setLogLevel=function(e){(0,r.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 s=e("@firebase/component"),r=e("@firebase/logger"),o=e("@firebase/util"),a=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 i{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",d="0.10.18",l=new r.Logger("@firebase/app"),u="@firebase/app-compat",m="@firebase/analytics-compat",h="@firebase/analytics",p="@firebase/app-check-compat",f="@firebase/app-check",g="@firebase/auth",k="@firebase/auth-compat",w="@firebase/database",_="@firebase/data-connect",b="@firebase/database-compat",y="@firebase/functions",E="@firebase/functions-compat",S="@firebase/installations",A="@firebase/installations-compat",I="@firebase/messaging",T="@firebase/messaging-compat",v="@firebase/performance",C="@firebase/performance-compat",x="@firebase/remote-config",j="@firebase/remote-config-compat",N="@firebase/storage",O="@firebase/storage-compat",R="@firebase/firestore",D="@firebase/vertexai",P="@firebase/firestore-compat",M="firebase",B=n._DEFAULT_ENTRY_NAME="[DEFAULT]",L={[c]:"fire-core",[u]:"fire-core-compat",[h]:"fire-analytics",[m]:"fire-analytics-compat",[f]:"fire-app-check",[p]:"fire-app-check-compat",[g]:"fire-auth",[k]:"fire-auth-compat",[w]:"fire-rtdb",[_]:"fire-data-connect",[b]:"fire-rtdb-compat",[y]:"fire-fn",[E]:"fire-fn-compat",[S]:"fire-iid",[A]:"fire-iid-compat",[I]:"fire-fcm",[T]:"fire-fcm-compat",[v]:"fire-perf",[C]:"fire-perf-compat",[x]:"fire-rc",[j]:"fire-rc-compat",[N]:"fire-gcs",[O]:"fire-gcs-compat",[R]:"fire-fst",[P]:"fire-fst-compat",[D]:"fire-vertex","fire-js":"fire-js",[M]:"fire-js-all"},F=n._apps=new Map,U=n._serverApps=new Map,H=n._components=new Map;function q(e,t){try{e.container.addComponent(t)}catch(n){l.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function G(e){const t=e.name;if(H.has(t))return l.debug(`There were multiple attempts to register component ${t}.`),!1;H.set(t,e);for(const t of F.values())q(t,e);for(const t of U.values())q(t,e);return!0}function $(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function W(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."},V=new o.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 Y{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new s.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 V.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 Q extends Y{constructor(e,t,n,s){const r=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,o={name:n,automaticDataCollectionEnabled:r};if(e.apiKey!==undefined)super(e,o,s);else{super(e.options,o,s)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:r},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,X(c,d,"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(){J(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw V.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.
 */n.SDK_VERSION="11.2.0";function z(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:B,automaticDataCollectionEnabled:!1},t),a=r.name;if("string"!=typeof a||!a)throw V.create("bad-app-name",{appName:String(a)});if(n||(n=(0,o.getDefaultAppConfig)()),!n)throw V.create("no-options");const i=F.get(a);if(i){if((0,o.deepEqual)(n,i.options)&&(0,o.deepEqual)(r,i.config))return i;throw V.create("duplicate-app",{appName:a})}const c=new s.ComponentContainer(a);for(const e of H.values())c.addComponent(e);const d=new Y(n,r,c);return F.set(a,d),d}async function J(e){let t=!1;const n=e.name;if(F.has(n))t=!0,F.delete(n);else if(U.has(n)){e.decRefCount()<=0&&(U.delete(n),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function X(e,t,n){var r;let o=null!==(r=L[e])&&void 0!==r?r:e;n&&(o+=`-${n}`);const a=o.match(/\s|\//),i=t.match(/\s|\//);if(a||i){const e=[`Unable to register library "${o}" with version "${t}":`];return a&&e.push(`library name "${o}" contains illegal characters (whitespace or "/")`),a&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void l.warn(e.join(" "))}G(new s.Component(`${o}-version`,()=>({library:o,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,a.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw V.create("idb-open",{originalErrorMessage:e.message})})),ee}async function ne(e,t){try{const n=(await te()).transaction(Z,"readwrite"),s=n.objectStore(Z);await s.put(t,se(e)),await n.done}catch(e){if(e instanceof o.FirebaseError)l.warn(e.message);else{const t=V.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});l.warn(t.message)}}}function se(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 re{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ae(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=oe();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===s||this._heartbeatsCache.heartbeats.some(e=>e.date===s))return;return this._heartbeatsCache.heartbeats.push({date:s,agent:n}),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){l.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=oe(),{heartbeatsToSend:n,unsentEntries:s}=function(e,t=1024){const n=[];let s=e.slice();for(const r of e){const e=n.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),ie(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),ie(n)>t){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),r=(0,o.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return l.warn(e),""}}}function oe(){return(new Date).toISOString().substring(0,10)}class ae{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,o.isIndexedDBAvailable)()&&(0,o.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),n=await t.objectStore(Z).get(se(e));return await t.done,n}catch(e){if(e instanceof o.FirebaseError)l.warn(e.message);else{const t=V.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});l.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 n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function ie(e){return(0,o.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 ce;ce="",G(new s.Component("platform-logger",e=>new i(e),"PRIVATE")),G(new s.Component("heartbeat",e=>new re(e),"PRIVATE")),X(c,d,ce),X(c,d,"esm2017"),X("fire-js","")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app",file:"node_modules/@firebase/app/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js",{"@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Provider=n.ComponentContainer=n.Component=void 0;var s=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.
 */
n.Component=class{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,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 r="[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 o{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 s.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),s=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(s)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(s)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:r})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=r){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=r){return this.instances.has(e)}getOptions(e=r){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(s)}return s}onInit(e,t){var n;const s=this.normalizeInstanceIdentifier(t),r=null!==(n=this.onInitCallbacks.get(s))&&void 0!==n?n:new Set;r.add(e),this.onInitCallbacks.set(s,r);const o=this.instances.get(s);return o&&e(o,s),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const s of n)try{s(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=e,s===r?undefined:s),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var s;return n||null}normalizeInstanceIdentifier(e=r){return this.component?this.component.multipleInstances?e:r:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}n.Provider=o;n.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 o(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"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.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,n=await H(t,e=>e&&0===e.registrationStatus?undefined:e);if(n){if(1===n.registrationStatus)throw f.create("delete-pending-registration");if(2===n.registrationStatus){if(!navigator.onLine)throw f.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 n=function(e,{fid:t}){return`${k(e)}/${t}`}(e,t),s=y(e,t),r={method:"DELETE",headers:s},o=await E(()=>fetch(n,r));if(!o.ok)throw await _("Delete Installation",o)}(t,n),await U(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.
 */,n.getId=z,n.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,s.getApp)()){return(0,s._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.
 */,n.getToken=J,n.onIdChange=function(e,t){const{appConfig:n}=e;return function(e,t){O();const n=v(e);let s=C.get(n);s||(s=new Set,C.set(n,s));s.add(t)}(n,t),()=>{!function(e,t){const n=v(e),s=C.get(n);if(!s)return;s.delete(t),0===s.size&&C.delete(n);R()}(n,t)}};var s=e("@firebase/app"),r=e("@firebase/component"),o=e("@firebase/util"),a=e("idb");const i="@firebase/installations",c="0.6.12",d=1e4,l=`w:${c}`,u="FIS_v2",m="https://firebaseinstallations.googleapis.com/v1",h=36e5,p={"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."},f=new o.ErrorFactory("installations","Installations",p);function g(e){return e instanceof o.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 k({projectId:e}){return`${m}/projects/${e}/installations`}function w(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function _(e,t){const n=(await t.json()).error;return f.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function b({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function y(e,{refreshToken:t}){const n=b(e);return n.append("Authorization",function(e){return`${u} ${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)),n}async function E(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 S(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 A=/^[cdef][\w-]{21}$/,I="";function T(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;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 A.test(t)?t:I}catch(e){return I}}function v(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 C=new Map;function x(e,t){const n=v(e);j(n,t),function(e,t){const n=O();n&&n.postMessage({key:e,fid:t});R()}(n,t)}function j(e,t){const n=C.get(e);if(n)for(const e of n)e(t)}let N=null;function O(){return!N&&"BroadcastChannel"in self&&(N=new BroadcastChannel("[Firebase] FID Change"),N.onmessage=e=>{j(e.data.key,e.data.fid)}),N}function R(){0===C.size&&N&&(N.close(),N=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 D="firebase-installations-database",P=1,M="firebase-installations-store";let B=null;function L(){return B||(B=(0,a.openDB)(D,P,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(M)}})),B}async function F(e,t){const n=v(e),s=(await L()).transaction(M,"readwrite"),r=s.objectStore(M),o=await r.get(n);return await r.put(t,n),await s.done,o&&o.fid===t.fid||x(e,t.fid),t}async function U(e){const t=v(e),n=(await L()).transaction(M,"readwrite");await n.objectStore(M).delete(t),await n.done}async function H(e,t){const n=v(e),s=(await L()).transaction(M,"readwrite"),r=s.objectStore(M),o=await r.get(n),a=t(o);return a===undefined?await r.delete(n):await r.put(a,n),await s.done,!a||o&&o.fid===a.fid||x(e,a.fid),a}
/**
 * @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 q(e){let t;const n=await H(e.appConfig,n=>{const s=function(e){const t=e||{fid:T(),registrationStatus:0};return W(t)}(n),r=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(f.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const s=k(e),r=b(e),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const a={fid:n,authVersion:u,appId:e.appId,sdkVersion:l},i={method:"POST",headers:r,body:JSON.stringify(a)},c=await E(()=>fetch(s,i));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:w(e.authToken)}}throw await _("Create Installation",c)}(e,t);return F(e.appConfig,n)}catch(n){throw g(n)&&409===n.customData.serverCode?await U(e.appConfig):await F(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:s}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:G(e)}:{installationEntry:t}}(e,s);return t=r.registrationPromise,r.installationEntry});return n.fid===I?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function G(e){let t=await $(e.appConfig);for(;1===t.registrationStatus;)await S(100),t=await $(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await q(e);return n||t}return t}function $(e){return H(e,e=>{if(!e)throw f.create("installation-not-found");return W(e)})}function W(e){return 1===(t=e).registrationStatus&&t.registrationTime+d<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 K({appConfig:e,heartbeatServiceProvider:t},n){const s=function(e,{fid:t}){return`${k(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,n),r=y(e,n),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const a={installation:{sdkVersion:l,appId:e.appId}},i={method:"POST",headers:r,body:JSON.stringify(a)},c=await E(()=>fetch(s,i));if(c.ok){return w(await c.json())}throw await _("Generate Auth Token",c)}async function V(e,t=!1){let n;const s=await H(e.appConfig,s=>{if(!Q(s))throw f.create("not-registered");const r=s.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+h}(e)}(r))return s;if(1===r.requestStatus)return n=async function(e,t){let n=await Y(e.appConfig);for(;1===n.authToken.requestStatus;)await S(100),n=await Y(e.appConfig);const s=n.authToken;return 0===s.requestStatus?V(e,t):s}(e,t),s;{if(!navigator.onLine)throw f.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(s);return n=async function(e,t){try{const n=await K(e,t),s=Object.assign(Object.assign({},t),{authToken:n});return await F(e.appConfig,s),n}catch(n){if(!g(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await F(e.appConfig,n)}else await U(e.appConfig);throw n}}(e,t),t}});return n?await n:s.authToken}function Y(e){return H(e,e=>{if(!Q(e))throw f.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+d<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var 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 Q(e){return e!==undefined&&2===e.registrationStatus}async function z(e){const t=e,{installationEntry:n,registrationPromise:s}=await q(t);return s?s.catch(console.error):V(t).catch(console.error),n.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 n=e;await async function(e){const{registrationPromise:t}=await q(e);t&&await t}(n);return(await V(n,t)).token}function X(e){return f.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(),n=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw X(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:(0,s._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),n=(0,s._getProvider)(t,Z).getImmediate();return{getId:()=>z(n),getToken:e=>J(n,e)}};(0,s._registerComponent)(new r.Component(Z,ee,"PUBLIC")),(0,s._registerComponent)(new r.Component("installations-internal",te,"PRIVATE")),(0,s.registerVersion)(i,c),(0,s.registerVersion)(i,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__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 s=[];var r;n.LogLevel=void 0,(r=n.LogLevel||(n.LogLevel={}))[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";const o={debug:n.LogLevel.DEBUG,verbose:n.LogLevel.VERBOSE,info:n.LogLevel.INFO,warn:n.LogLevel.WARN,error:n.LogLevel.ERROR,silent:n.LogLevel.SILENT},a=n.LogLevel.INFO,i={[n.LogLevel.DEBUG]:"log",[n.LogLevel.VERBOSE]:"log",[n.LogLevel.INFO]:"info",[n.LogLevel.WARN]:"warn",[n.LogLevel.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const s=(new Date).toISOString(),r=i[t];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[r](`[${s}]  ${e.name}:`,...n)};n.Logger=class{constructor(e){this.name=e,this._logLevel=a,this._logHandler=c,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?o[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,n.LogLevel.DEBUG,...e),this._logHandler(this,n.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.VERBOSE,...e),this._logHandler(this,n.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.INFO,...e),this._logHandler(this,n.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.WARN,...e),this._logHandler(this,n.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.ERROR,...e),this._logHandler(this,n.LogLevel.ERROR,...e)}},n.setLogLevel=function(e){s.forEach(t=>{t.setLogLevel(e)})},n.setUserLogHandler=function(e,t){for(const r of s){let s=null;t&&t.level&&(s=o[t.level]),r.userLogHandler=null===e?null:(t,r,...o)=>{const a=o.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(" ");r>=(null!=s?s:t.logLevel)&&e({level:n.LogLevel[r].toLowerCase(),message:a,args:o,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.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 x.create("only-available-in-window");e.swRegistration||await U(e);return async function(e){const t=await I(e.firebaseDependencies);t&&(await j(e.firebaseDependencies,t.token),await async function(e){const t=v(e),n=(await A()).transaction(E,"readwrite");await n.objectStore(E).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();if(n)return n.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,o.getModularInstance)(e))},n.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,a.getApp)()){return Y().then(e=>{if(!e)throw x.create("unsupported-browser")},e=>{throw x.create("indexed-db-unsupported")}),(0,a._getProvider)((0,o.getModularInstance)(e),"messaging").getImmediate()},n.getToken=async function(e,t){return H(e=(0,o.getModularInstance)(e),t)},n.isSupported=Y,n.onMessage=function(e,t){return function(e,t){if(!navigator)throw x.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,o.getModularInstance)(e),t)},e("@firebase/installations");var s=e("@firebase/component"),r=e("idb"),o=e("@firebase/util"),a=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 i="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",d="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",l="https://fcmregistrations.googleapis.com/v1",u="google.c.a.c_id",m=1e4;var h,p;
/**
 * @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 f(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function g(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),s=new Uint8Array(n.length);for(let e=0;e<n.length;++e)s[e]=n.charCodeAt(e);return 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.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(h||(h={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(p||(p={}));const k="fcm_token_details_db",w=5,_="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 b="firebase-messaging-database",y=1,E="firebase-messaging-store";let S=null;function A(){return S||(S=(0,r.openDB)(b,y,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(E)}})),S}async function I(e){const t=v(e),n=await A(),s=await n.transaction(E).objectStore(E).get(t);if(s)return s;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(k))return null}let t=null;return(await(0,r.openDB)(k,w,{upgrade:async(n,s,r,o)=>{var a;if(s<2)return;if(!n.objectStoreNames.contains(_))return;const i=o.objectStore(_),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===s){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:f(e.vapidKey)}}}else if(3===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:f(e.auth),p256dh:f(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:f(e.vapidKey)}}}else if(4===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:f(e.auth),p256dh:f(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:f(e.vapidKey)}}}}})).close(),await(0,r.deleteDB)(k),await(0,r.deleteDB)("fcm_vapid_details_db"),await(0,r.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 T(e,t),t}}async function T(e,t){const n=v(e),s=(await A()).transaction(E,"readwrite");return await s.objectStore(E).put(t,n),await s.done,t}function v({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 C={"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."},x=new o.ErrorFactory("messaging","Messaging",C);async function j(e,t){const n={method:"DELETE",headers:await O(e)};try{const s=await fetch(`${N(e.appConfig)}/${t}`,n),r=await s.json();if(r.error){const e=r.error.message;throw x.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw x.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function N({projectId:e}){return`${l}/projects/${e}/registrations`}async function O({appConfig:e,installations:t}){const n=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 ${n}`})}function R({p256dh:e,auth:t,endpoint:n,vapidKey:s}){const r={web:{endpoint:n,auth:t,p256dh:e}};return s!==d&&(r.web.applicationPubKey=s),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.
 */const D=6048e5;async function P(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:g(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:f(t.getKey("auth")),p256dh:f(t.getKey("p256dh"))},s=await I(e.firebaseDependencies);if(s){if(function(e,t){const n=t.vapidKey===e.vapidKey,s=t.endpoint===e.endpoint,r=t.auth===e.auth,o=t.p256dh===e.p256dh;return n&&s&&r&&o}
/**
 * @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.
 */(s.subscriptionOptions,n))return Date.now()>=s.createTime+D?async function(e,t){try{const n=await async function(e,t){const n=await O(e),s=R(t.subscriptionOptions),r={method:"PATCH",headers:n,body:JSON.stringify(s)};let o;try{const n=await fetch(`${N(e.appConfig)}/${t.token}`,r);o=await n.json()}catch(e){throw x.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw x.create("token-update-failed",{errorInfo:e})}if(!o.token)throw x.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),s=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await T(e.firebaseDependencies,s),n}catch(e){throw e}}(e,{token:s.token,createTime:Date.now(),subscriptionOptions:n}):s.token;try{await j(e.firebaseDependencies,s.token)}catch(e){console.warn(e)}return M(e.firebaseDependencies,n)}return M(e.firebaseDependencies,n)}async function M(e,t){const 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.
 */await async function(e,t){const n=await O(e),s=R(t),r={method:"POST",headers:n,body:JSON.stringify(s)};let o;try{const t=await fetch(N(e.appConfig),r);o=await t.json()}catch(e){throw x.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw x.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw x.create("token-subscribe-no-token");return o.token}(e,t),s={token:n,createTime:Date.now(),subscriptionOptions:t};return await T(e,s),s.token}function B(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const s=t.notification.body;s&&(e.notification.body=s);const r=t.notification.image;r&&(e.notification.image=r);const o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,s,r,o,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const i=null!==(r=null===(s=t.fcmOptions)||void 0===s?void 0:s.link)&&void 0!==r?r:null===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.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 x.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 n=[];for(let s=0;s<e.length;s++)n.push(e.charAt(s)),s<t.length&&n.push(t.charAt(s));n.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 F{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=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:n}=e;for(const e of t)if(!n[e])throw L(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:n}}_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 U(e){try{e.swRegistration=await navigator.serviceWorker.register(i,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,n)=>{const s=setTimeout(()=>n(new Error(`Service worker not registered after ${m} ms`)),m),r=e.installing||e.waiting;e.active?(clearTimeout(s),t()):r?r.onstatechange=e=>{var n;"activated"===(null===(n=e.target)||void 0===n?void 0:n.state)&&(r.onstatechange=null,clearTimeout(s),t())}:(clearTimeout(s),n(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 x.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 H(e,t){if(!navigator)throw x.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw x.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=d)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await U(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw x.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),P(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 q(e,t,n){const s=function(e){switch(e){case p.NOTIFICATION_CLICKED:return"notification_open";case p.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(s,{message_id:n[u],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function G(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===p.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(B(n)):e.onMessageHandler.next(B(n)));const s=n.data;var r;"object"==typeof(r=s)&&r&&u in r&&"1"===s["google.c.a.e"]&&await q(e,n.messageType,s)}const $="@firebase/messaging",W="0.12.16",K=e=>{const t=new F(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>G(t,e)),t},V=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>H(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 Y(){try{await(0,o.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,o.isIndexedDBAvailable)()&&(0,o.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,a._registerComponent)(new s.Component("messaging",K,"PUBLIC")),(0,a._registerComponent)(new s.Component("messaging-internal",V,"PRIVATE")),(0,a.registerVersion)($,W),(0,a.registerVersion)($,W,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/index.sw.cjs",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),e("@firebase/installations");var s=e("@firebase/component"),r=e("idb"),o=e("@firebase/util"),a=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 i="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var d,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 u(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function m(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),s=new Uint8Array(n.length);for(let e=0;e<n.length;++e)s[e]=n.charCodeAt(e);return 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.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(d||(d={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(l||(l={}));const h="fcm_token_details_db",p="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 f="firebase-messaging-store";let g=null;function k(){return g||(g=r.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(f)}})),g}async function w(e){const t=b(e),n=await k(),s=await n.transaction(f).objectStore(f).get(t);if(s)return s;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(h))return null}let t=null;return(await r.openDB(h,5,{upgrade:async(n,s,r,o)=>{var a;if(s<2)return;if(!n.objectStoreNames.contains(p))return;const i=o.objectStore(p),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===s){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:u(e.vapidKey)}}}else if(3===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:u(e.auth),p256dh:u(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:u(e.vapidKey)}}}else if(4===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:u(e.auth),p256dh:u(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:u(e.vapidKey)}}}}})).close(),await r.deleteDB(h),await r.deleteDB("fcm_vapid_details_db"),await r.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,t),t}}async function _(e,t){const n=b(e),s=(await k()).transaction(f,"readwrite");return await s.objectStore(f).put(t,n),await s.done,t}function b({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 y={"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."},E=new o.ErrorFactory("messaging","Messaging",y);async function S(e,t){const n={method:"DELETE",headers:await I(e)};try{const s=await fetch(`${A(e.appConfig)}/${t}`,n),r=await s.json();if(r.error){const e=r.error.message;throw E.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw E.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function A({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function I({appConfig:e,installations:t}){const n=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 ${n}`})}function T({p256dh:e,auth:t,endpoint:n,vapidKey:s}){const r={web:{endpoint:n,auth:t,p256dh:e}};return s!==i&&(r.web.applicationPubKey=s),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.
 */async function v(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:m(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:u(t.getKey("auth")),p256dh:u(t.getKey("p256dh"))},s=await w(e.firebaseDependencies);if(s){if(function(e,t){const n=t.vapidKey===e.vapidKey,s=t.endpoint===e.endpoint,r=t.auth===e.auth,o=t.p256dh===e.p256dh;return n&&s&&r&&o}
/**
 * @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.
 */(s.subscriptionOptions,n))return Date.now()>=s.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await I(e),s=T(t.subscriptionOptions),r={method:"PATCH",headers:n,body:JSON.stringify(s)};let o;try{const n=await fetch(`${A(e.appConfig)}/${t.token}`,r);o=await n.json()}catch(e){throw E.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw E.create("token-update-failed",{errorInfo:e})}if(!o.token)throw E.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),s=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await _(e.firebaseDependencies,s),n}catch(e){throw e}}(e,{token:s.token,createTime:Date.now(),subscriptionOptions:n}):s.token;try{await S(e.firebaseDependencies,s.token)}catch(e){console.warn(e)}return x(e.firebaseDependencies,n)}return x(e.firebaseDependencies,n)}async function C(e){const t=await w(e.firebaseDependencies);t&&(await S(e.firebaseDependencies,t.token),await async function(e){const t=b(e),n=(await k()).transaction(f,"readwrite");await n.objectStore(f).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function x(e,t){const 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.
 */await async function(e,t){const n=await I(e),s=T(t),r={method:"POST",headers:n,body:JSON.stringify(s)};let o;try{const t=await fetch(A(e.appConfig),r);o=await t.json()}catch(e){throw E.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw E.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw E.create("token-subscribe-no-token");return o.token}(e,t),s={token:n,createTime:Date.now(),subscriptionOptions:t};return await _(e,s),s.token}async function j(e,t){const n=function(e,t){var n,s;const r={};e.from&&(r.project_number=e.from);e.fcmMessageId&&(r.message_id=e.fcmMessageId);r.instance_id=t,e.notification?r.message_type=d.DISPLAY_NOTIFICATION.toString():r.message_type=d.DATA_MESSAGE.toString();r.sdk_platform=3..toString(),r.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(r.collapse_key=e.collapse_key);r.event=1..toString(),!(null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label)||(r.analytics_label=null===(s=e.fcmOptions)||void 0===s?void 0:s.analytics_label);return r}(t,await e.firebaseDependencies.installations.getId());!function(e,t,n){const s={};s.event_time_ms=Math.floor(Date.now()).toString(),s.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!n||(s.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(n));e.logEvents.push(s)}(e,n,t.productId)}async function N(e,t){const n=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!n)return;t.deliveryMetricsExportedToBigQueryEnabled&&await j(t,n);const s=await R();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(s))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=l.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(s,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:s}=Notification;n&&s&&n.length>s&&console.warn(`This browser only supports ${s} 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={[c]:e},t}(n)),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 n=t.notification.title;n&&(e.notification.title=n);const s=t.notification.body;s&&(e.notification.body=s);const r=t.notification.image;r&&(e.notification.image=r);const o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,s,r,o,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const i=null!==(r=null===(s=t.fcmOptions)||void 0===s?void 0:s.link)&&void 0!==r?r:null===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.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}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function O(e){var t,n;const s=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n[c];if(!s)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const r=function(e){var t,n,s;const r=null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(s=e.notification)||void 0===s?void 0:s.click_action;if(r)return r;return o=e.data,"object"==typeof o&&o&&"google.c.a.c_id"in o?self.location.origin:null;var 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.
 */}
/**
 * @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.
 */(s);if(!r)return;const o=new URL(r,self.location.href),a=new URL(self.location.origin);if(o.host!==a.host)return;let i=await async function(e){const t=await R();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(o);var d;
/**
 * @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 i?i=await i.focus():(i=await self.clients.openWindow(r),await(d=3e3,new Promise(e=>{setTimeout(e,d)}))),i?(s.messageType=l.NOTIFICATION_CLICKED,s.isFirebaseMessaging=!0,i.postMessage(s)):void 0}function R(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function D(e){return E.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 n=[];for(let s=0;s<e.length;s++)n.push(e.charAt(s)),s<t.length&&n.push(t.charAt(s));n.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 P{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=function(e){if(!e||!e.options)throw D("App Configuration Object");if(!e.name)throw D("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw D(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:n}}_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 M=e=>{const t=new P(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 n,s;const{newSubscription:r}=e;if(!r)return void await C(t);const o=await w(t.firebaseDependencies);await C(t),t.vapidKey=null!==(s=null===(n=null==o?void 0:o.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==s?s:i,await v(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(O(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 B(){return o.isIndexedDBAvailable()&&await o.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.
 */a._registerComponent(new s.Component("messaging-sw",M,"PUBLIC")),n.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=o.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.
 */,n.getMessaging=function(e=a.getApp()){return B().then(e=>{if(!e)throw E.create("unsupported-browser")},e=>{throw E.create("indexed-db-unsupported")}),a._getProvider(o.getModularInstance(e),"messaging-sw").getImmediate()},n.isSupported=B,n.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw E.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=o.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",{_process:"/home/runner/work/metamask-extension/metamask-extension/node_modules/process/browser.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.Sha1=n.RANDOM_FACTOR=n.MAX_VALUE_MILLIS=n.FirebaseError=n.ErrorFactory=n.Deferred=n.DecodeBase64StringError=n.CONSTANTS=void 0,n.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.
 */,n.assertionError=n.assert=void 0,n.async=function(e,t){return(...n)=>{Promise.resolve(!0).then(()=>{e(...n)}).catch(e=>{t&&t(e)})}},n.base64urlEncodeWithoutPadding=n.base64Encode=n.base64Decode=n.base64=void 0,n.calculateBackoffMillis=function(e,t=x,n=j){const s=t*Math.pow(n,e),r=Math.round(O*s*(Math.random()-.5)*2);return Math.min(N,s+r)}
/**
 * @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.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.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 n=t||"demo-project",s=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[d(JSON.stringify({alg:"none",type:"JWT"})),d(JSON.stringify(o)),""].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.
 */,n.createSubscribe=function(e,t){const n=new T(e,t);return n.subscribe.bind(n)},n.decode=void 0,n.deepCopy=function(e){return u(undefined,e)},n.deepEqual=function e(t,n){if(t===n)return!0;const s=Object.keys(t),r=Object.keys(n);for(const o of s){if(!r.includes(o))return!1;const s=t[o],a=n[o];if(I(s)&&I(a)){if(!e(s,a))return!1}else if(s!==a)return!1}for(const e of r)if(!s.includes(e))return!1;return!0},n.deepExtend=u,n.errorPrefix=C,n.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n: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.
 */,n.getExperimentalSetting=n.getDefaults=n.getDefaultEmulatorHostnameAndPort=n.getDefaultEmulatorHost=n.getDefaultAppConfig=void 0,n.getGlobal=h,n.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},n.getUA=k,n.isAdmin=void 0,n.isBrowser=function(){return"undefined"!=typeof window||_()},n.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},n.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},n.isElectron=function(){return k().indexOf("Electron/")>=0},n.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},n.isIE=function(){const e=k();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},n.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},n.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(k())},n.isNode=w,n.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},n.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},n.isSafari=function(){return!w()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},n.isUWP=function(){return k().indexOf("MSAppHost/")>=0},n.isValidTimestamp=n.isValidFormat=void 0,n.isWebWorker=_,n.issuedAtTime=void 0,n.jsonEval=S,n.map=function(e,t,n){const s={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=t.call(n,e[r],r,e));return s},n.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 n=e%10;if(1===n)return"st";if(2===n)return"nd";if(3===n)return"rd";return"th"}(e)},n.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 n=new g;return setTimeout(()=>n.reject("timeout!"),t),e.then(n.resolve,n.reject),n.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.
 */,n.querystring=function(e){const t=[];for(const[n,s]of Object.entries(e))Array.isArray(s)?s.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return t.length?"&"+t.join("&"):""},n.querystringDecode=function(e){const t={},n=e.replace(/^\?/,"").split("&");return n.forEach(e=>{if(e){const[n,s]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(s)}}),t},n.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},n.stringToByteArray=n.stringLength=void 0,n.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.
 */,n.validateArgCount=void 0,n.validateCallback=function(e,t,n,s){if(s&&!n)return;if("function"!=typeof n)throw new Error(C(e,t)+"must be a valid function.")},n.validateContextObject=function(e,t,n,s){if(s&&!n)return;if("object"!=typeof n||null===n)throw new Error(C(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.
 */,n.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var e;t((null===(e=r.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},n.validateNamespace=function(e,t,n){if(n&&!t)return;if("string"!=typeof t)throw new Error(C(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=n.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},s=function(e,t){if(!e)throw r(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.
 */n.assert=s;const r=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.
 */n.assertionError=r;const o=function(e){const t=[];let n=0;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++s)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},a=n.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 n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let t=0;t<e.length;t+=3){const r=e[t],o=t+1<e.length,a=o?e[t+1]:0,i=t+2<e.length,c=i?e[t+2]:0,d=r>>2,l=(3&r)<<4|a>>4;let u=(15&a)<<2|c>>6,m=63&c;i||(m=64,o||(u=64)),s.push(n[d],n[l],n[u],n[m])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(o(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,s=0;for(;n<e.length;){const r=e[n++];if(r<128)t[s++]=String.fromCharCode(r);else if(r>191&&r<224){const o=e[n++];t[s++]=String.fromCharCode((31&r)<<6|63&o)}else if(r>239&&r<365){const o=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[s++]=String.fromCharCode(55296+(o>>10)),t[s++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],a=e[n++];t[s++]=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let t=0;t<e.length;){const r=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==o||null==a||null==c)throw new i;const d=r<<2|o>>4;if(s.push(d),64!==a){const e=o<<4&240|a>>2;if(s.push(e),64!==c){const e=a<<6&192|c;s.push(e)}}}return s},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 i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}n.DecodeBase64StringError=i;const c=function(e){const t=o(e);return a.encodeByteArray(t,!0)};n.base64Encode=c;const d=function(e){return c(e).replace(/\./g,"")};n.base64urlEncodeWithoutPadding=d;const l=function(e){try{return a.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 u(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 n in t)t.hasOwnProperty(n)&&m(n)&&(e[n]=u(e[n],t[n]));return e}function m(e){return"__proto__"!==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 h(){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.
 */n.base64Decode=l;const p=()=>{try{return h().__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&&l(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};n.getDefaults=p;const f=e=>{var t,n;return null===(n=null===(t=p())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]};n.getDefaultEmulatorHost=f;n.getDefaultEmulatorHostnameAndPort=e=>{const t=f(e);if(!t)return undefined;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const s=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),s]:[t.substring(0,n),s]};n.getDefaultAppConfig=()=>{var e;return null===(e=p())||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.
 */
n.getExperimentalSetting=e=>{var t;return null===(t=p())||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,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}
/**
 * @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 k(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function w(){var e;const t=null===(e=p())||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 _(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}n.Deferred=g;class b extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,b.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,y.prototype.create)}}n.FirebaseError=b;class y{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},s=`${this.service}/${e}`,r=this.errors[e],o=r?function(e,t){return e.replace(E,(e,n)=>{const s=t[n];return null!=s?String(s):`<${n}?>`})}(r,n):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new b(s,a,n)}}n.ErrorFactory=y;const E=/\{\$([^}]+)}/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 S(e){return JSON.parse(e)}const A=function(e){let t={},n={},s={},r="";try{const o=e.split(".");t=S(l(o[0])||""),n=S(l(o[1])||""),r=o[2],s=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:s,signature:r}};n.decode=A;n.isValidTimestamp=function(e){const t=A(e).claims,n=Math.floor((new Date).getTime()/1e3);let s=0,r=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?s=t.nbf:t.hasOwnProperty("iat")&&(s=t.iat),r=t.hasOwnProperty("exp")?t.exp:s+86400),!!n&&!!s&&!!r&&n>=s&&n<=r};n.issuedAtTime=function(e){const t=A(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};n.isValidFormat=function(e){const t=A(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function I(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.
 */
n.isAdmin=function(e){const t=A(e).claims;return"object"==typeof t&&!0===t.admin};n.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 n=this.W_;if("string"==typeof e)for(let s=0;s<16;s++)n[s]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let s=0;s<16;s++)n[s]=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=n[e-3]^n[e-8]^n[e-14]^n[e-16];n[e]=4294967295&(t<<1|t>>>31)}let s,r,o=this.chain_[0],a=this.chain_[1],i=this.chain_[2],c=this.chain_[3],d=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(s=c^a&(i^c),r=1518500249):(s=a^i^c,r=1859775393):e<60?(s=a&i|c&(a|i),r=2400959708):(s=a^i^c,r=3395469782);const t=(o<<5|o>>>27)+s+d+r+n[e]&4294967295;d=c,c=i,i=4294967295&(a<<30|a>>>2),a=o,o=t}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+i&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+d&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const n=t-this.blockSize;let s=0;const r=this.buf_;let o=this.inbuf_;for(;s<t;){if(0===o)for(;s<=n;)this.compress_(e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(r[o]=e.charCodeAt(s),++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}else for(;s<t;)if(r[o]=e[s],++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}this.inbuf_=o,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 n=0;for(let t=0;t<5;t++)for(let s=24;s>=0;s-=8)e[n]=this.chain_[t]>>s&255,++n;return e}};class T{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,n){let s;if(e===undefined&&t===undefined&&n===undefined)throw new Error("Missing Observer.");s=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},s.next===undefined&&(s.next=v),s.error===undefined&&(s.error=v),s.complete===undefined&&(s.complete=v);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(e){}}),this.observers.push(s),r}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 v(){}
/**
 * @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 C(e,t){return`${e} failed: ${t} argument `}n.validateArgCount=function(e,t,n,s){let r;if(s<t?r="at least "+t:s>n&&(r=0===n?"none":"no more than "+n),r){throw new Error(e+" failed: Was called with "+s+(1===s?" argument.":" arguments.")+" Expects "+r+".")}};n.stringToByteArray=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o>=55296&&o<=56319){const t=o-55296;r++,s(r<e.length,"Surrogate pair missing trail surrogate.");o=65536+(t<<10)+(e.charCodeAt(r)-56320)}o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):o<65536?(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|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.
 */
n.stringLength=function(e){let t=0;for(let n=0;n<e.length;n++){const s=e.charCodeAt(n);s<128?t++:s<2048?t+=2:s>=55296&&s<=56319?(t+=4,n++):t+=3}return t};const x=1e3,j=2,N=n.MAX_VALUE_MILLIS=144e5,O=n.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"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});class s{static parse(e){if(""===e)return new s([]);if(!e.startsWith("/"))throw new r(e);const[,...t]=e.split("/");return new s(t.map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~")))}constructor(e){this.tokens=e}toString(){if(0===this.tokens.length)return"";return`/${this.tokens.map(e=>e.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`}shmeval(e){for(const t of this.tokens){if(!e.hasOwnProperty(t))throw new o(e,t);e=e[t]}return e}}n.default=s;class r extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}n.InvalidPtrError=r;class o extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}n.EvalError=o}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver>@json-schema-spec/json-pointer",file:"node_modules/@json-schema-spec/json-pointer/lib/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js",{"@json-schema-tools/reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js","@json-schema-tools/traverse":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js","fast-safe-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-safe-stringify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},r=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var i=a(e("@json-schema-tools/traverse")),c=a(e("@json-schema-tools/reference-resolver")),d=a(e("fast-safe-stringify")),l=function(e){this.name="NonStringRefError",this.message=["NonStringRefError","Found an improperly formatted $ref in schema. $ref must be a string","schema in question: ".concat((0,d.default)(e))].join("\n")};n.NonStringRefError=l;var u=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var n=s(s({},t),e);return delete n.$ref,n}return t},m=function(){function e(e,t){var n;if(void 0===t&&(t={}),this.options=t,this.refCache={},n=!0===this.options.mutate||!0===e||!1===e?e:s({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=n),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=n),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var r=0,o=Object.keys(this.options.protocolHandlerMap);r<o.length;r++){var a=o[r];c.default.protocolHandlerMap[a]=this.options.protocolHandlerMap[a]}this.schema=n,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this._resolve()];case 1:return e.sent(),delete this.schema.definitions,delete this.schema.components,[2,this.schema]}})})},e.prototype._resolve=function(){return r(this,void 0,void 0,function(){var t,n,r,a,d,l,m,h,p,f,g,k=this;return o(this,function(o){switch(o.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return k.refCache[e]===undefined}),n=[],r=0,a=t,o.label=1;case 1:return r<a.length?(d=a[r],l=void 0,this.refCache[d]===undefined?[3,2]:(l=this.refCache[d],[3,5])):[3,11];case 2:if("#"!==d)return[3,3];if(this.options.rootSchema===undefined)throw new Error("options.rootSchema was not provided, but one of the schemas references '#'");return l=this.options.rootSchema,[3,5];case 3:return m=c.default.resolve(d,this.options.rootSchema),n.push(m),[4,m];case 4:l=o.sent(),o.label=5;case 5:return!0!==this.options.recursive||!0===l||!1===l||"#"===d?[3,9]:(h=s(s({},this.options),{refCache:this.refCache}),0===(p=new e(l,h)).refs.length?[3,7]:(f=p._resolve(),n.push(f),[4,f]));case 6:return g=o.sent(),this.refCache[d]=u(l,g),[3,8];case 7:this.refCache[d]=l,o.label=8;case 8:return[3,10];case 9:this.refCache[d]=l,o.label=10;case 10:return r++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=u(this.schema,this.refCache[this.schema.$ref]):(0,i.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=k.refCache[e.$ref];return u(e,t)}return e},{mutable:!0}),[4,Promise.all(n)];case 12:return o.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,i.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new l(t);e.push(t.$ref)}return t}),e},e}();n.default=m}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/index.js",{"./dereferencer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var r=s(e("./dereferencer")),o=e("./dereferencer");Object.defineProperty(n,"NonStringRefError",{enumerable:!0,get:function(){return o.NonStringRefError}}),n.default=r.default}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/meta-schema/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.jsonSchema=void 0,n.jsonSchema={$schema:"https://meta.json-schema.tools/",$id:"https://meta.json-schema.tools/",title:"JSONSchema",default:{},oneOf:[{$ref:"#/definitions/JSONSchemaObject"},{$ref:"#/definitions/JSONSchemaBoolean"}],definitions:{JSONSchemaBoolean:{title:"JSONSchemaBoolean",description:"Always valid if true. Never valid if false. Is constant.",type:"boolean"},JSONSchemaObject:{title:"JSONSchemaObject",type:"object",properties:{$id:{title:"$id",type:"string",format:"uri-reference"},$schema:{title:"$schema",type:"string",format:"uri"},$ref:{title:"$ref",type:"string",format:"uri-reference"},$comment:{title:"$comment",type:"string"},title:{title:"title",type:"string"},description:{title:"description",type:"string"},default:!0,readOnly:{title:"readOnly",type:"boolean",default:!1},examples:{title:"examples",type:"array",items:!0},multipleOf:{title:"multipleOf",type:"number",exclusiveMinimum:0},maximum:{title:"maximum",type:"number"},exclusiveMaximum:{title:"exclusiveMaximum",type:"number"},minimum:{title:"minimum",type:"number"},exclusiveMinimum:{title:"exclusiveMinimum",type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{title:"pattern",type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{title:"items",anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{title:"uniqueItems",type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{title:"definitions",type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{title:"properties",type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{title:"patternProperties",type:"object",additionalProperties:{$ref:"#"},propertyNames:{title:"propertyNames",format:"regex"},default:{}},dependencies:{title:"dependencies",type:"object",additionalProperties:{title:"dependenciesSet",anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{title:"enum",type:"array",items:!0,minItems:1,uniqueItems:!0},type:{title:"type",anyOf:[{$ref:"#/definitions/simpleTypes"},{title:"arrayOfSimpleTypes",type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{title:"format",type:"string"},contentMediaType:{title:"contentMediaType",type:"string"},contentEncoding:{title:"contentEncoding",type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}}},schemaArray:{title:"schemaArray",type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{title:"nonNegativeInteger",type:"integer",minimum:0},nonNegativeIntegerDefault0:{title:"nonNegativeIntegerDefaultZero",type:"integer",minimum:0,default:0},simpleTypes:{title:"simpleTypes",type:"string",enum:["array","boolean","integer","null","number","object","string"]},stringArray:{title:"stringArray",type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}},n.default=n.jsonSchema}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/meta-schema",file:"node_modules/@json-schema-tools/meta-schema/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js",{"./errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js","isomorphic-fetch":"/home/runner/work/metamask-extension/metamask-extension/node_modules/isomorphic-fetch/fetch-npm-browserify.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var a=e("./errors"),i=o(e("isomorphic-fetch")),c=function(e){return s(void 0,void 0,void 0,function(){var t,n;return r(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,(0,i.default)(e)];case 1:return t=s.sent(),[3,3];case 2:throw s.sent(),new a.InvalidRemoteURLError(e);case 3:return s.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,s.sent()];case 5:throw n=s.sent(),new a.NonJsonRefError({$ref:e},n.message);case 6:return[2]}})})};n.default={https:c,http:c}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidFileSystemPathError=n.InvalidRemoteURLError=n.NotResolvableError=n.NonJsonRefError=void 0;var s=function(e,t){this.name="NonJsonRefError",this.message=["NonJsonRefError","The resolved value at the reference: ".concat(e.$ref," was not JSON.parse 'able"),"The non-json content in question: ".concat(t)].join("\n")};n.NonJsonRefError=s;var r=function(e){this.name="NotResolvableError",this.message=["NotResolvableError","Could not resolve the reference: ".concat(e),"No protocol handler was found, and it was not found to be an internal reference"].join("\n")};n.NotResolvableError=r;var o=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};n.InvalidRemoteURLError=o;var a=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};n.InvalidFileSystemPathError=a}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/errors.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js",{"./default-protocol-handler-map":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js","./reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},r=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var i=a(e("./default-protocol-handler-map")),c=a(e("./reference-resolver")),d=s(s({},i.default),{file:function(){return r(void 0,void 0,void 0,function(){return o(this,function(e){return[2,undefined]})})}});n.default=new c.default(d)}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/index-web.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js",{"./errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js","./resolve-pointer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var a=e("./errors"),i=o(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return s(this,arguments,void 0,function(e,t){var n,s,o,c,d,l,u,m,h,p;return void 0===t&&(t={}),r(this,function(r){switch(r.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,i.default)(e,t))];(n=e.split("#")).length>1&&(s=n[n.length-1]),o=n[0],r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(o,t)];case 2:return c=r.sent(),[3,4];case 3:throw d=r.sent(),new a.NonJsonRefError({$ref:e},d.message);case 4:if(c!==undefined)return p=c,s&&(p=(0,i.default)(s,p)),[2,p];if(!1===e.includes("://"))throw new a.InvalidFileSystemPathError(e);l=0,u=Object.keys(this.protocolHandlerMap),r.label=5;case 5:return l<u.length?(m=u[l],o.startsWith(m)?[4,this.protocolHandlerMap[m](o,t)]:[3,7]):[3,8];case 6:if((h=r.sent())!==undefined)return p=h,s&&(p=(0,i.default)(s,p)),[2,p];r.label=7;case 7:return l++,[3,5];case 8:throw new a.NotResolvableError(e)}})})},e}();n.default=c}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js",{"@json-schema-spec/json-pointer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidJsonPointerRefError=void 0;var r=s(e("@json-schema-spec/json-pointer")),o=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};n.InvalidJsonPointerRefError=o,n.default=function(e,t){try{var n=e.replace("#","");return r.default.parse(n).shmeval(t)}catch(t){throw new o(e,t.message)}}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var s,r=0,o=t.length;r<o;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(n,"__esModule",{value:!0}),n.defaultOptions=void 0,n.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var o=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},a=function(e,t){var n=t.find(function(t){return t===e});return n||!1},i=function(e,t){return void 0===t&&(t=1),e[e.length-t]};n.default=function e(t,c,d,l,u,m,h,p,f){void 0===d&&(d=n.defaultOptions),void 0===l&&(l=0),void 0===u&&(u=[]),void 0===m&&(m=[]),void 0===h&&(h=[]),void 0===p&&(p=[]),void 0===f&&(f=[]);var g=s(s({},n.defaultOptions),d);if(0===l&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===l?t:c(t,!1,o(h),i(m));var k=t;!1===g.mutable&&(k=s({},t)),m.push(k),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===l||(k=c(k,!1,o(h),i(m,2)))),u.push(t),p.push([t,k]);var w=function(t,n){var s=a(t,u);return s?(f.push(s),!0===g.skipFirstMutation&&s===u[0]?c(t,!0,o(n),i(m)):p.find(function(e){var t=e[0];return s===t})[1]):e(t,c,d,l+1,u,m,n,p,f)};if(t.anyOf)k.anyOf=t.anyOf.map(function(e,t){return w(e,r(r([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)k.allOf=t.allOf.map(function(e,t){return w(e,r(r([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)k.oneOf=t.oneOf.map(function(e,t){return w(e,r(r([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)k.items=t.items.map(function(e,t){return w(e,r(r([],h,!0),["items[".concat(t,"]")],!1))});else{var _=a(t.items,u);if(_)if(f.push(_),!0===g.skipFirstMutation&&_===u[0])k.items=c(t.items,!0,o(h),i(m));else{var b=p.find(function(e){var t=e[0];return _===t})[1];k.items=b}else k.items=e(t.items,c,d,l+1,u,m,r(r([],h,!0),["items"],!1),p,f)}if(t.additionalItems!==undefined&&(k.additionalItems=w(t.additionalItems,r(r([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var y=t.properties,E={};Object.keys(t.properties).forEach(function(e){E[e]=w(y[e],r(r([],h,!0),["properties",e.toString()],!1))}),k.properties=E}if(t.patternProperties!==undefined){var S=t.patternProperties,A={};Object.keys(t.patternProperties).forEach(function(e){A[e]=w(S[e],r(r([],h,!0),["patternProperties",e.toString()],!1))}),k.patternProperties=A}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(k.additionalProperties=w(t.additionalProperties,r(r([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===l)return k;if(!0===g.bfs)return m.pop(),k;var I=-1!==f.indexOf(t);return m.pop(),c(k,I,o(h),i(m))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/AccountsController.cjs",{"./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/eth-snap-keyring":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/keyring-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m,h,p,f,g,k,w=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AccountsController=n.EMPTY_ACCOUNT=void 0;const _=e("@metamask/base-controller"),b=e("@metamask/eth-snap-keyring"),y=e("@metamask/keyring-api"),E=e("@metamask/keyring-controller"),S=e("@metamask/keyring-utils"),A=e("@metamask/utils"),I=e("lodash"),T=e("./utils.cjs"),v="AccountsController",C={internalAccounts:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},x={internalAccounts:{accounts:{},selectedAccount:""}};n.EMPTY_ACCOUNT={id:"",address:"",options:{},methods:[],type:y.EthAccountType.Eoa,scopes:[y.EthScope.Eoa],metadata:{name:"",keyring:{type:""},importTime:0}};class j extends _.BaseController{constructor({messenger:e,state:t}){super({messenger:e,name:v,metadata:C,state:{...x,...t}}),s.add(this),w(this,s,"m",g).call(this),w(this,s,"m",k).call(this)}getAccount(e){return this.state.internalAccounts.accounts[e]}getAccounts(e){return e.map(e=>this.getAccount(e))}listAccounts(){return Object.values(this.state.internalAccounts.accounts).filter(e=>(0,y.isEvmAccountType)(e.type))}listMultichainAccounts(e){const t=Object.values(this.state.internalAccounts.accounts);if(!e)return t;if(!(0,A.isCaipChainId)(e))throw new Error(`Invalid CAIP-2 chain ID: ${String(e)}`);return t.filter(t=>(0,S.isScopeEqualToAny)(e,t.scopes))}getAccountExpect(e){const t=this.getAccount(e);if(t===undefined)throw new Error(`Account Id "${e}" not found`);return t}getSelectedAccount(){const{internalAccounts:{selectedAccount:e}}=this.state;if(""===e)return n.EMPTY_ACCOUNT;const t=this.getAccountExpect(e);if((0,y.isEvmAccountType)(t.type))return t;const r=this.listAccounts();if(!r.length)throw new Error("No EVM accounts");return w(this,s,"m",m).call(this,r)}getSelectedMultichainAccount(e){const{internalAccounts:{selectedAccount:t}}=this.state;if(""===t)return n.EMPTY_ACCOUNT;if(!e)return this.getAccountExpect(t);const r=this.listMultichainAccounts(e);return w(this,s,"m",m).call(this,r)}getAccountByAddress(e){return this.listMultichainAccounts().find(t=>t.address.toLowerCase()===e.toLowerCase())}setSelectedAccount(e){const t=this.getAccountExpect(e);this.state.internalAccounts.selectedAccount!==t.id&&w(this,s,"m",d).call(this,e=>{const{internalAccounts:n}=e;n.accounts[t.id].metadata.lastSelected=Date.now(),n.selectedAccount=t.id})}setAccountName(e,t){this.updateAccountMetadata(e,{name:t,nameLastUpdatedAt:Date.now()})}setAccountNameAndSelectAccount(e,t){const n=this.getAccountExpect(e);w(this,s,"m",r).call(this,n,t);const o={...n,metadata:{...n.metadata,name:t,nameLastUpdatedAt:Date.now(),lastSelected:w(this,s,"m",h).call(this)}};w(this,s,"m",d).call(this,e=>{e.internalAccounts.accounts[n.id]=o,e.internalAccounts.selectedAccount=n.id}),this.messenger.publish("AccountsController:accountRenamed",o)}updateAccountMetadata(e,t){const n=this.getAccountExpect(e);t.name&&w(this,s,"m",r).call(this,n,t.name);const o={...n,metadata:{...n.metadata,...t}};w(this,s,"m",d).call(this,t=>{t.internalAccounts.accounts[e]=o}),t.name&&this.messenger.publish("AccountsController:accountRenamed",o)}async updateAccounts(){const e=new Map,t=this.state.internalAccounts.accounts,n={},{keyrings:r}=this.messenger.call("KeyringController:getState");for(const o of r){const r=(0,T.keyringTypeToName)(o.type);for(const a of o.accounts){const i=w(this,s,"m",p).call(this,a,o);if(!i)continue;const c=e.get(r)??1,d=t[i.id];n[i.id]={...i,metadata:{...i.metadata,name:d?.metadata.name??`${r} ${c}`,importTime:d?.metadata.importTime??Date.now(),lastSelected:d?.metadata.lastSelected??0}},e.set(r,c+1)}}w(this,s,"m",d).call(this,e=>{e.internalAccounts.accounts=n})}loadBackup(e){e.internalAccounts&&this.update(t=>{t.internalAccounts=e.internalAccounts})}getNextAvailableAccountName(e=E.KeyringTypes.hd,t){const n=(0,T.keyringTypeToName)(e),r=w(this,s,"m",u).call(this,e,t),o=r.reduce((e,t)=>{const s=new RegExp(`${n} ([0-9]+)$`,"u").exec(t.metadata.name);if(s){const t=parseInt(s[1],10);return Math.max(e,t)}return e},0),a=Math.max(r.length+1,o+1);return`${n} ${a}`}}n.AccountsController=j,s=new WeakSet,r=function(e,t){if(this.listMultichainAccounts().find(n=>n.metadata.name===t&&n.id!==e.id))throw new Error("Account name already exists")},o=function(e,t){const n=(0,T.getUUIDFromAddressOfNormalAccount)(e),s=this.getAccount(n),r={name:s?.metadata.name??"",...s?.metadata.nameLastUpdatedAt?{nameLastUpdatedAt:s?.metadata.nameLastUpdatedAt}:{},importTime:s?.metadata.importTime??Date.now(),lastSelected:s?.metadata.lastSelected??0,keyring:{type:t.type}};let o={};if((0,T.isHdKeyringType)(t.type)){const n=(0,T.getEvmGroupIndexFromAddressIndex)(t,e);if(n!==undefined){const e=(0,T.getEvmDerivationPathForIndex)(n);o={...{entropySource:t.metadata.id,derivationPath:e,groupIndex:n},...{entropy:{type:y.KeyringAccountEntropyTypeOption.Mnemonic,id:t.metadata.id,derivationPath:e,groupIndex:n}}}}}return{id:n,address:e,options:o,methods:[y.EthMethod.PersonalSign,y.EthMethod.Sign,y.EthMethod.SignTransaction,y.EthMethod.SignTypedDataV1,y.EthMethod.SignTypedDataV3,y.EthMethod.SignTypedDataV4],scopes:[y.EthScope.Eoa],type:y.EthAccountType.Eoa,metadata:r}},a=function(){const[e]=this.messenger.call("KeyringController:getKeyringsByType",b.SnapKeyring.type);return e},i=function(e,...t){this.messenger.publish(e,...t)},c=function({isUnlocked:e,keyrings:t}){if(!e||0===t.length)return;const n={snap:{previous:{},added:[],updated:[],removed:[]},normal:{previous:{},added:[],updated:[],removed:[]}},r=e=>(0,T.isSnapKeyringType)(e)?n.snap:n.normal;for(const e of this.listMultichainAccounts()){const t=e.address.toLowerCase();r(e.metadata.keyring.type).previous[t]=e}const o=new Set;for(const e of t){const t=r(e.type);for(const n of e.accounts){const s=n.toLowerCase(),r=t.previous[s];r?t.updated.push(r):t.added.push({address:s,keyring:e}),o.add(s)}}for(const e of[n.snap,n.normal])for(const[t,n]of Object.entries(e.previous))o.has(t)||e.removed.push(n);const a={removed:[],added:[]};w(this,s,"m",d).call(this,e=>{const{internalAccounts:t}=e;for(const e of[n.snap,n.normal]){for(const n of e.removed)delete t.accounts[n.id],a.removed.push(n.id);for(const n of e.added){const e=w(this,s,"m",p).call(this,n.address,n.keyring);if(e){const n=Object.values(t.accounts),r=this.getNextAvailableAccountName(e.metadata.keyring.type,n),o=0===n.length?w(this,s,"m",h).call(this):0;t.accounts[e.id]={...e,metadata:{...e.metadata,name:r,importTime:Date.now(),lastSelected:o}},a.added.push(t.accounts[e.id])}}}},()=>{for(const e of a.removed)this.messenger.publish("AccountsController:accountRemoved",e);for(const e of a.added)this.messenger.publish("AccountsController:accountAdded",e)})},d=function(e,t){const n=this.state.internalAccounts.selectedAccount;this.update(t=>{e(t);const{internalAccounts:r}=t;if(!r.accounts[n]){const e=Object.values(r.accounts),t=w(this,s,"m",m).call(this,e);t?(r.selectedAccount=t.id,r.accounts[t.id].metadata.lastSelected=w(this,s,"m",h).call(this)):r.selectedAccount=""}}),t?.();const{selectedAccount:r}=this.state.internalAccounts;if(r&&r!==n){const e=this.getSelectedMultichainAccount();e&&((0,y.isEvmAccountType)(e.type)&&this.messenger.publish("AccountsController:selectedEvmAccountChange",e),this.messenger.publish("AccountsController:selectedAccountChange",e))}},l=function(e){const{snaps:t}=e,n=[];for(const e of this.listMultichainAccounts())if(e.metadata.snap){const s=t[e.metadata.snap.id];if(s){const t=s.enabled&&!s.blocked;e.metadata.snap.enabled!==t&&n.push({id:e.id,enabled:t})}else n.push({id:e.id,enabled:!1})}n.length>0&&this.update(e=>{for(const{id:t,enabled:s}of n){const n=e.internalAccounts.accounts[t];n.metadata.snap&&(n.metadata.snap.enabled=s)}})},u=function(e,t){return(t??this.listMultichainAccounts()).filter(t=>(0,T.isHdKeyringType)(e)||(0,T.isSimpleKeyringType)(e)?(0,T.isHdKeyringType)(t.metadata.keyring.type)||(0,T.isSimpleKeyringType)(t.metadata.keyring.type):t.metadata.keyring.type===e)},m=function(e){const[t]=e.sort((e,t)=>(t.metadata.lastSelected??0)-(e.metadata.lastSelected??0));return t},h=function(){return Date.now()},p=function(e,t){if((0,T.isSnapKeyringType)(t.type)){const t=w(this,s,"m",a).call(this);if(!t)return undefined;let n=t.getAccountByAddress(e);if(n&&(n=(0,I.cloneDeep)(n),(0,T.isHdSnapKeyringAccount)(n))){const e={...n.options,entropy:{type:y.KeyringAccountEntropyTypeOption.Mnemonic,id:n.options.entropySource,groupIndex:n.options.index,derivationPath:n.options.derivationPath}};n.options=e}return n}return w(this,s,"m",o).call(this,e,t)},f=function(e){let t;if((0,A.isCaipChainId)(e)){const n=this.getSelectedMultichainAccount(e);t=n.id}else{const e=this.getSelectedAccount();t=e.id}this.state.internalAccounts.selectedAccount!==t&&this.update(e=>{e.internalAccounts.accounts[t].metadata.lastSelected=Date.now(),e.internalAccounts.selectedAccount=t})},g=function(){this.messenger.subscribe("SnapController:stateChange",e=>w(this,s,"m",l).call(this,e)),this.messenger.subscribe("KeyringController:stateChange",e=>w(this,s,"m",c).call(this,e)),this.messenger.subscribe("SnapKeyring:accountAssetListUpdated",e=>w(this,s,"m",i).call(this,"AccountsController:accountAssetListUpdated",e)),this.messenger.subscribe("SnapKeyring:accountBalancesUpdated",e=>w(this,s,"m",i).call(this,"AccountsController:accountBalancesUpdated",e)),this.messenger.subscribe("SnapKeyring:accountTransactionsUpdated",e=>w(this,s,"m",i).call(this,"AccountsController:accountTransactionsUpdated",e)),this.messenger.subscribe("MultichainNetworkController:networkDidChange",e=>w(this,s,"m",f).call(this,e))},k=function(){this.messenger.registerActionHandler(`${v}:setSelectedAccount`,this.setSelectedAccount.bind(this)),this.messenger.registerActionHandler(`${v}:listAccounts`,this.listAccounts.bind(this)),this.messenger.registerActionHandler(`${v}:listMultichainAccounts`,this.listMultichainAccounts.bind(this)),this.messenger.registerActionHandler(`${v}:setAccountName`,this.setAccountName.bind(this)),this.messenger.registerActionHandler(`${v}:setAccountNameAndSelectAccount`,this.setAccountNameAndSelectAccount.bind(this)),this.messenger.registerActionHandler(`${v}:updateAccounts`,this.updateAccounts.bind(this)),this.messenger.registerActionHandler(`${v}:getSelectedAccount`,this.getSelectedAccount.bind(this)),this.messenger.registerActionHandler(`${v}:getSelectedMultichainAccount`,this.getSelectedMultichainAccount.bind(this)),this.messenger.registerActionHandler(`${v}:getAccountByAddress`,this.getAccountByAddress.bind(this)),this.messenger.registerActionHandler(`${v}:getNextAvailableAccountName`,this.getNextAvailableAccountName.bind(this)),this.messenger.registerActionHandler("AccountsController:getAccount",this.getAccount.bind(this)),this.messenger.registerActionHandler("AccountsController:getAccounts",this.getAccounts.bind(this)),this.messenger.registerActionHandler("AccountsController:updateAccountMetadata",this.updateAccountMetadata.bind(this))}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/AccountsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/index.cjs",{"./AccountsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/AccountsController.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNormalKeyringType=n.getUUIDFromAddressOfNormalAccount=n.getUUIDOptionsFromAddressOfNormalAccount=n.keyringTypeToName=n.AccountsController=n.EMPTY_ACCOUNT=void 0;var s=e("./AccountsController.cjs");Object.defineProperty(n,"EMPTY_ACCOUNT",{enumerable:!0,get:function(){return s.EMPTY_ACCOUNT}}),Object.defineProperty(n,"AccountsController",{enumerable:!0,get:function(){return s.AccountsController}});var r=e("./utils.cjs");Object.defineProperty(n,"keyringTypeToName",{enumerable:!0,get:function(){return r.keyringTypeToName}}),Object.defineProperty(n,"getUUIDOptionsFromAddressOfNormalAccount",{enumerable:!0,get:function(){return r.getUUIDOptionsFromAddressOfNormalAccount}}),Object.defineProperty(n,"getUUIDFromAddressOfNormalAccount",{enumerable:!0,get:function(){return r.getUUIDFromAddressOfNormalAccount}}),Object.defineProperty(n,"isNormalKeyringType",{enumerable:!0,get:function(){return r.isNormalKeyringType}})}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/dist/utils.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","ethereum-cryptography/sha256":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isHdSnapKeyringAccount=n.HdSnapKeyringAccountOptionsStruct=n.getEvmGroupIndexFromAddressIndex=n.getEvmDerivationPathForIndex=n.isHdKeyringType=n.isSimpleKeyringType=n.isSnapKeyringType=n.isNormalKeyringType=n.getUUIDFromAddressOfNormalAccount=n.getUUIDOptionsFromAddressOfNormalAccount=n.keyringTypeToName=void 0;const s=e("@metamask/keyring-controller"),r=e("@metamask/superstruct"),o=e("@metamask/utils"),a=e("ethereum-cryptography/sha256"),i=e("uuid");function c(e){return{random:(0,a.sha256)((0,o.hexToBytes)(e)).slice(0,16)}}function d(e){return e===s.KeyringTypes.hd}n.keyringTypeToName=function(e){switch(e){case s.KeyringTypes.simple:case s.KeyringTypes.hd:return"Account";case s.KeyringTypes.trezor:return"Trezor";case s.KeyringTypes.oneKey:return"OneKey";case s.KeyringTypes.ledger:return"Ledger";case s.KeyringTypes.lattice:return"Lattice";case s.KeyringTypes.qr:return"QR";case s.KeyringTypes.snap:return"Snap Account";default:throw new Error(`Unknown keyring ${e}`)}},n.getUUIDOptionsFromAddressOfNormalAccount=c,n.getUUIDFromAddressOfNormalAccount=function(e){return(0,i.v4)(c(e))},n.isNormalKeyringType=function(e){return e!==s.KeyringTypes.snap},n.isSnapKeyringType=function(e){return e===s.KeyringTypes.snap},n.isSimpleKeyringType=function(e){return e===s.KeyringTypes.simple},n.isHdKeyringType=d,n.getEvmDerivationPathForIndex=function(e){return`m/44'/60'/0'/0/${e}`},n.getEvmGroupIndexFromAddressIndex=function(e,t){if(!d(e.type))return undefined;const n=e.accounts.findIndex(e=>e.toLowerCase()===t.toLowerCase());return-1===n?(console.warn(`! Unable to get group index for HD account: "${t}"`),undefined):n},n.HdSnapKeyringAccountOptionsStruct=(0,r.type)({entropySource:(0,r.string)(),index:(0,r.number)(),derivationPath:(0,r.string)()}),n.isHdSnapKeyringAccount=function(e){return(0,r.is)(e.options,n.HdSnapKeyringAccountOptionsStruct)}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function s(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function r(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function o(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function a(e,...t){if(!o(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");s(e.outputLen),s(e.blockLen)}function c(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function d(e,t){a(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(n,"__esModule",{value:!0}),n.output=n.exists=n.hash=n.bytes=n.bool=n.number=n.isBytes=void 0,n.number=s,n.bool=r,n.isBytes=o,n.bytes=a,n.hash=i,n.exists=c,n.output=d;const l={number:s,bool:r,bytes:a,hash:i,exists:c,output:d};n.default=l}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js",{"./_assert.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.HashMD=n.Maj=n.Chi=void 0;const s=e("./_assert.js"),r=e("./utils.js");n.Chi=(e,t,n)=>e&t^~e&n;n.Maj=(e,t,n)=>e&t^e&n^t&n;class o extends r.Hash{constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,r.createView)(this.buffer)}update(e){(0,s.exists)(this);const{view:t,buffer:n,blockLen:o}=this,a=(e=(0,r.toBytes)(e)).length;for(let s=0;s<a;){const i=Math.min(o-this.pos,a-s);if(i===o){const t=(0,r.createView)(e);for(;o<=a-s;s+=o)this.process(t,s);continue}n.set(e.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,s.exists)(this),(0,s.output)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:o,isLE:a}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let e=i;e<o;e++)t[e]=0;!function(e,t,n,s){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,s);const r=BigInt(32),o=BigInt(4294967295),a=Number(n>>r&o),i=Number(n&o),c=s?4:0,d=s?0:4;e.setUint32(t+c,a,s),e.setUint32(t+d,i,s)}(n,o-8,BigInt(8*this.length),a),this.process(n,0);const c=(0,r.createView)(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=d/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)c.setUint32(4*e,u[e],a)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:s,finished:r,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=r,e.destroyed=o,s%t&&e.buffer.set(n),e}}n.HashMD=o}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.crypto=void 0,n.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:undefined}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js",{"./_md.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_md.js","./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sha224=n.sha256=void 0;const s=e("./_md.js"),r=e("./utils.js"),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint32Array(64);class c extends s.HashMD{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:n,D:s,E:r,F:o,G:a,H:i}=this;return[e,t,n,s,r,o,a,i]}set(e,t,n,s,r,o,a,i){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|s,this.E=0|r,this.F=0|o,this.G=0|a,this.H=0|i}process(e,t){for(let n=0;n<16;n++,t+=4)i[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=i[e-15],n=i[e-2],s=(0,r.rotr)(t,7)^(0,r.rotr)(t,18)^t>>>3,o=(0,r.rotr)(n,17)^(0,r.rotr)(n,19)^n>>>10;i[e]=o+i[e-7]+s+i[e-16]|0}let{A:n,B:a,C:c,D:d,E:l,F:u,G:m,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,r.rotr)(l,6)^(0,r.rotr)(l,11)^(0,r.rotr)(l,25))+(0,s.Chi)(l,u,m)+o[e]+i[e]|0,p=((0,r.rotr)(n,2)^(0,r.rotr)(n,13)^(0,r.rotr)(n,22))+(0,s.Maj)(n,a,c)|0;h=m,m=u,u=l,l=d+t|0,d=c,c=a,a=n,n=t+p|0}n=n+this.A|0,a=a+this.B|0,c=c+this.C|0,d=d+this.D|0,l=l+this.E|0,u=u+this.F|0,m=m+this.G|0,h=h+this.H|0,this.set(n,a,c,d,l,u,m,h)}roundClean(){i.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class d extends c{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}n.sha256=(0,r.wrapConstructor)(()=>new c),n.sha224=(0,r.wrapConstructor)(()=>new d)}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js",{"./_assert.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","@noble/hashes/crypto":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/crypto.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
Object.defineProperty(n,"__esModule",{value:!0}),n.randomBytes=n.wrapXOFConstructorWithOpts=n.wrapConstructorWithOpts=n.wrapConstructor=n.checkOpts=n.Hash=n.concatBytes=n.toBytes=n.utf8ToBytes=n.asyncLoop=n.nextTick=n.hexToBytes=n.bytesToHex=n.byteSwap32=n.byteSwapIfBE=n.byteSwap=n.isLE=n.rotl=n.rotr=n.createView=n.u32=n.u8=n.isBytes=void 0;const s=e("@noble/hashes/crypto"),r=e("./_assert.js");n.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name};n.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);n.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));n.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);n.rotr=(e,t)=>e<<32-t|e>>>t;n.rotl=(e,t)=>e<<t|e>>>32-t>>>0,n.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];n.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,n.byteSwapIfBE=n.isLE?e=>e:e=>(0,n.byteSwap)(e),n.byteSwap32=function(e){for(let t=0;t<e.length;t++)e[t]=(0,n.byteSwap)(e[t])};const o=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));n.bytesToHex=function(e){(0,r.bytes)(e);let t="";for(let n=0;n<e.length;n++)t+=o[e[n]];return t};const a=48,i=57,c=65,d=70,l=97,u=102;function m(e){return e>=a&&e<=i?e-a:e>=c&&e<=d?e-(c-10):e>=l&&e<=u?e-(l-10):void 0}n.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const s=new Uint8Array(n);for(let t=0,r=0;t<n;t++,r+=2){const n=m(e.charCodeAt(r)),o=m(e.charCodeAt(r+1));if(n===undefined||o===undefined){const t=e[r]+e[r+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+r)}s[t]=16*n+o}return s};function h(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function p(e){return"string"==typeof e&&(e=h(e)),(0,r.bytes)(e),e}n.nextTick=async()=>{},n.asyncLoop=async function(e,t,s){let r=Date.now();for(let o=0;o<e;o++){s(o);const e=Date.now()-r;e>=0&&e<t||(await(0,n.nextTick)(),r+=e)}},n.utf8ToBytes=h,n.toBytes=p,n.concatBytes=function(...e){let t=0;for(let n=0;n<e.length;n++){const s=e[n];(0,r.bytes)(s),t+=s.length}const n=new Uint8Array(t);for(let t=0,s=0;t<e.length;t++){const r=e[t];n.set(r,s),s+=r.length}return n};n.Hash=class{clone(){return this._cloneInto()}};const f={}.toString;n.checkOpts=function(e,t){if(t!==undefined&&"[object Object]"!==f.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},n.wrapConstructor=function(e){const t=t=>e().update(p(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},n.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(p(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},n.wrapXOFConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(p(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},n.randomBytes=function(e=32){if(s.crypto&&"function"==typeof s.crypto.getRandomValues)return s.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}}},{package:"@metamask/accounts-controller>ethereum-cryptography>@noble/hashes",file:"node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js",{"./utils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js","@noble/hashes/sha256":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/sha256.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sha256=void 0;const s=e("@noble/hashes/sha256"),r=e("./utils.js");n.sha256=(0,r.wrapHash)(s.sha256)}}},{package:"@metamask/accounts-controller>ethereum-cryptography",file:"node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/sha256.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js",{"@noble/hashes/_assert":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/_assert.js","@noble/hashes/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/accounts-controller/node_modules/@noble/hashes/utils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.crypto=n.utf8ToBytes=n.createView=n.concatBytes=n.toHex=n.bytesToHex=n.assertBytes=n.assertBool=void 0,n.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},n.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,o.hexToBytes)(t)},n.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},n.wrapHash=function(e){return t=>(r.default.bytes(t),e(t))};const r=s(e("@noble/hashes/_assert")),o=e("@noble/hashes/utils"),a=r.default.bool;n.assertBool=a;const i=r.default.bytes;n.assertBytes=i;var c=e("@noble/hashes/utils");Object.defineProperty(n,"bytesToHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(n,"toHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(n,"concatBytes",{enumerable:!0,get:function(){return c.concatBytes}}),Object.defineProperty(n,"createView",{enumerable:!0,get:function(){return c.createView}}),Object.defineProperty(n,"utf8ToBytes",{enumerable:!0,get:function(){return c.utf8ToBytes}}),n.crypto=(()=>{const e="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:undefined,n=void 0!==t&&"function"==typeof t.require&&t.require.bind(t);return{node:n&&!e?n("crypto"):undefined,web:e}})()}}},{package:"@metamask/accounts-controller>ethereum-cryptography",file:"node_modules/@metamask/accounts-controller/node_modules/ethereum-cryptography/utils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=n.controllerName=n.AddressType=void 0;const a=e("@metamask/base-controller"),i=e("@metamask/controller-utils");var c;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(c||(n.AddressType=c={})),n.controllerName="AddressBookController";const d={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};n.getDefaultAddressBookControllerState=()=>({addressBook:{}});class l extends a.BaseController{constructor({messenger:e,state:t}){const a={...(0,n.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:d,name:n.controllerName,state:a}),s.add(this),o(this,s,"m",r).call(this)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,n)=>{const s=n;return[...t,...Object.values(e[s])]},[])}clear(){this.update(e=>{e.addressBook={}})}delete(e,t){if(t=(0,i.toChecksumHexAddress)(t),!([e,t].every(e=>(0,i.isSafeDynamicKey)(e))&&(0,i.isValidHexAddress)(t)&&this.state.addressBook[e]&&this.state.addressBook[e][t]))return!1;const n={...this.state.addressBook[e][t]};return this.update(n=>{const s=n.addressBook[e];s?.[t]&&(delete s[t],0===Object.keys(s).length&&delete n.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",n),!0}set(e,t,n=(0,i.toHex)(1),s="",r){if(e=(0,i.toChecksumHexAddress)(e),!(0,i.isValidHexAddress)(e))return!1;const o={address:e,chainId:n,isEns:!1,memo:s,name:t,addressType:r,lastUpdatedAt:Date.now()},a=(0,i.normalizeEnsName)(t);return a&&(o.name=a,o.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[n]:{...this.state.addressBook[n],[e]:o}}}),"*"!==String(n)&&this.messenger.publish("AddressBookController:contactUpdated",o),!0}}n.AddressBookController=l,s=new WeakSet,r=function(){this.messenger.registerActionHandler(`${n.controllerName}:list`,this.list.bind(this)),this.messenger.registerActionHandler(`${n.controllerName}:set`,this.set.bind(this)),this.messenger.registerActionHandler(`${n.controllerName}:delete`,this.delete.bind(this))},n.default=l}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/index.cjs",{"./AddressBookController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=void 0;var s=e("./AddressBookController.cjs");Object.defineProperty(n,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return s.getDefaultAddressBookControllerState}}),Object.defineProperty(n,"AddressBookController",{enumerable:!0,get:function(){return s.AddressBookController}})}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;const a=e("@metamask/base-controller"),i={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class d extends a.BaseController{constructor({messenger:e,state:t,allAnnouncements:n}){const a={...i,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:a}),s.add(this),o(this,s,"m",r).call(this,n)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const n of Object.keys(e).map(Number))t[n].isShown=e[n]})}}n.AnnouncementController=d,s=new WeakSet,r=function(e){this.update(t=>{Object.values(e).forEach(e=>{t.announcements[e.id]=t.announcements[e.id]??{...e,isShown:!1}})})}}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/index.cjs",{"./AnnouncementController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;var s=e("./AnnouncementController.cjs");Object.defineProperty(n,"AnnouncementController",{enumerable:!0,get:function(){return s.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/bridge-status.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs","./utils/gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./utils/metrics.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m,h,p,f,g,k,w,_,b,y,E,S,A,I,T,v,C,x,j,N=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},O=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusController=void 0;const R=e("@metamask/bridge-controller"),D=e("@metamask/controller-utils"),P=e("@metamask/polling-controller"),M=e("@metamask/transaction-controller"),B=e("@metamask/utils"),L=e("./constants.cjs"),F=e("./types.cjs"),U=e("./utils/bridge-status.cjs"),H=e("./utils/gas.cjs"),q=e("./utils/metrics.cjs"),G=e("./utils/transaction.cjs"),$={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class W extends((0,P.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:n,fetchFn:P,addTransactionFn:W,addTransactionBatchFn:K,updateTransactionFn:V,estimateGasFeeFn:Y,config:Q,traceFn:z}){super({name:L.BRIDGE_STATUS_CONTROLLER_NAME,metadata:$,messenger:e,state:{...L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),s.add(this),r.set(this,{}),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,void 0),m.set(this,void 0),h.set(this,({id:e})=>{const t=this.state.txHistory[e]?e:Object.keys(this.state.txHistory).find(t=>this.state.txHistory[t].approvalTxId===e);t&&this.update(e=>{e.txHistory[t].status.status=R.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),n=this.messenger.call("NetworkController:getNetworkClientById",t).configuration.chainId;O(this,E,"f").call(this,e,n)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:n}=e;if(!t&&!n)throw new Error("Either txMetaId or txHash must be provided");let s;if(t?this.state.txHistory[t]&&(s=t):n&&(s=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===n)),!s)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${n}`));const o=this.state.txHistory[s];this.update(e=>{s&&(e.txHistory[s].attempts=undefined)});if((0,R.isCrossChain)(o.quote.srcChainId,o.quote.destChainId)){O(this,r,"f")[s]||O(this,g,"f").call(this,s)}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],p.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===R.StatusTypes.PENDING||e.status.status===R.StatusTypes.UNKNOWN).filter(e=>!O(this,r,"f")[e.txMetaId]).filter(e=>(0,R.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)).forEach(e=>{const t=e.txMetaId;(0,U.shouldSkipFetchDueToFetchFailures)(e.attempts)||O(this,g,"f").call(this,t)})}),f.set(this,e=>{const{bridgeTxMeta:t,statusRequest:n,quoteResponse:s,startTime:r,slippagePercentage:o,initialDestAssetBalance:a,targetContractAddress:i,approvalTxId:c,isStxEnabled:d,accountAddress:l}=e,u={txMetaId:t.id,batchId:t.batchId,quote:s.quote,startTime:r,estimatedProcessingTimeInSeconds:s.estimatedProcessingTimeInSeconds,slippagePercentage:o,pricingData:{amountSent:s.sentAmount?.amount??"0",amountSentInUsd:s.sentAmount?.usd??undefined,quotedGasInUsd:s.gasFee?.effective?.usd??undefined,quotedReturnInUsd:s.toTokenAmount?.usd??undefined,quotedGasAmount:s.gasFee?.effective?.amount??undefined},initialDestAssetBalance:a,targetContractAddress:i,account:l,status:{status:R.StatusTypes.PENDING,srcChain:{chainId:n.srcChainId,txHash:n.srcTxHash}},hasApprovalTx:Boolean(s.approval),approvalTxId:c,isStxEnabled:d??!1,featureId:s.featureId};this.update(e=>{e.txHistory[t.id]=u})}),g.set(this,e=>{const t=O(this,r,"f")[e];t&&this.stopPollingByPollingToken(t);const n=this.state.txHistory[e];if(!n)return;const{quote:s}=n;(0,R.isCrossChain)(s.srcChainId,s.destChainId)&&(O(this,r,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;O(this,f,"f").call(this,e),O(this,g,"f").call(this,t.id)},this._executePoll=async e=>{await O(this,_,"f").call(this,e)},w.set(this,e=>{const{attempts:t}=this.state.txHistory[e],n=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},s=O(this,r,"f")[e];n.counter>=L.MAX_ATTEMPTS&&s&&(this.stopPollingByPollingToken(s),delete O(this,r,"f")[e]),this.update(t=>{t.txHistory[e].attempts=n})}),_.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state;if(!(0,U.shouldSkipFetchDueToFetchFailures)(t[e]?.attempts))try{const n=t[e],s=O(this,b,"f").call(this,e);if(!s)return;O(this,y,"f").call(this,e,s);const c=(0,U.getStatusRequestWithSrcTxHash)(n.quote,s),{status:d,validationFailures:l}=await(0,U.fetchBridgeTxStatus)(c,O(this,o,"f"),O(this,a,"f"),O(this,i,"f").customBridgeApiBaseUrl);if(l.length>0)throw O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:l}),new Error(`Bridge status validation failed: ${l.join(", ")}`);const u={...n,status:d,completionTime:d.status===R.StatusTypes.COMPLETE||d.status===R.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=u});const m=O(this,r,"f")[e];if((d.status===R.StatusTypes.COMPLETE||d.status===R.StatusTypes.FAILED)&&m){if(this.stopPollingByPollingToken(m),delete O(this,r,"f")[e],n.featureId)return;d.status===R.StatusTypes.COMPLETE&&(O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",n.quote.destAsset.assetId)),d.status===R.StatusTypes.FAILED&&O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),O(this,w,"f").call(this,e)}}),b.set(this,e=>{const{txHistory:t}=this.state,n=t[e].status.srcChain.txHash;if(n)return n;const s=this.messenger.call("TransactionController:getState").transactions.find(t=>t.id===e);return s?.hash}),y.set(this,(e,t)=>{const{txHistory:n}=this.state;n[e].status.srcChain.txHash||this.update(n=>{n.txHistory[e].status.srcChain.txHash=t})}),E.set(this,(e,t)=>{const n=Object.keys(this.state.txHistory).filter(n=>{const s=this.state.txHistory[n],r=(0,B.numberToHex)(s.quote.srcChainId);return s.account===e&&r===t});n.forEach(e=>{O(this,r,"f")[e]&&this.stopPollingByPollingToken(O(this,r,"f")[e])}),this.update(e=>{e.txHistory=n.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),S.set(this,async(e,t,n)=>{if(!n.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const s=(0,G.getClientRequest)(e,t.quote.srcChainId,n),r=await this.messenger.call("SnapController:handleRequest",s),o={...t,trade:e};return(0,G.handleNonEvmTxResponse)(r,o,n)}),A.set(this,async e=>{const t=await e,n=this.messenger.call("TransactionController:getState").transactions.find(e=>e.hash===t);if(!n)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return n}),I.set(this,async(e,t,n,s,r)=>{if(n){const o=async()=>{await O(this,v,"f").call(this,s);const o=await O(this,T,"f").call(this,{transactionType:e?M.TransactionType.bridgeApproval:M.TransactionType.swapApproval,trade:n,requireApproval:r});return await(0,G.handleApprovalDelay)(t),o};return await O(this,m,"f").call(this,{name:e?L.TraceName.BridgeTransactionApprovalCompleted:L.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,R.formatChainIdToCaip)(t),stxEnabled:!1}},o)}return undefined}),T.set(this,async({transactionType:e,trade:t,requireApproval:n=!1,txFee:s})=>{const r=(0,G.generateActionId)().toString();if(!this.messenger.call("AccountsController:getAccountByAddress",t.from))throw new Error("Failed to submit cross-chain swap transaction: unknown account in trade data");const o=(0,R.formatChainIdToHex)(t.chainId),a=this.messenger.call("NetworkController:findNetworkClientIdByChainId",o),i={actionId:r,networkClientId:a,requireApproval:n,type:e,origin:"metamask"},d={...t,chainId:o,gasLimit:t.gasLimit?.toString(),gas:t.gasLimit?.toString()},l={...d,...await O(this,C,"f").call(this,d,a,o,s)},{result:u}=await O(this,c,"f").call(this,l,i);return await O(this,A,"f").call(this,u)}),v.set(this,async e=>{e&&await O(this,T,"f").call(this,{transactionType:M.TransactionType.bridgeApproval,trade:e})}),C.set(this,async(e,t,n,s)=>{const r=(0,D.toHex)(e.gas??0);if(s)return{maxFeePerGas:(0,D.toHex)(s.maxFeePerGas??0),maxPriorityFeePerGas:(0,D.toHex)(s.maxPriorityFeePerGas??0),gas:r};const{gasFeeEstimates:o}=this.messenger.call("GasFeeController:getState"),{estimates:a}=await O(this,u,"f").call(this,{transactionParams:e,chainId:n,networkClientId:t}),{maxFeePerGas:i,maxPriorityFeePerGas:c}=(0,H.getTxGasEstimates)({networkGasFeeEstimates:o,txGasFeeEstimates:a});return{maxFeePerGas:i,maxPriorityFeePerGas:c,gas:r}}),x.set(this,async e=>{const t=await(0,G.getAddTransactionBatchParams)({messenger:this.messenger,estimateGasFeeFn:O(this,u,"f"),...e}),n={[M.TransactionType.bridgeApproval]:t.transactions.find(({type:e})=>e===M.TransactionType.bridgeApproval)?.params.data,[M.TransactionType.swapApproval]:t.transactions.find(({type:e})=>e===M.TransactionType.swapApproval)?.params.data,[M.TransactionType.bridge]:t.transactions.find(({type:e})=>e===M.TransactionType.bridge)?.params.data,[M.TransactionType.swap]:t.transactions.find(({type:e})=>e===M.TransactionType.swap)?.params.data},{batchId:s}=await O(this,d,"f").call(this,t),{approvalMeta:r,tradeMeta:o}=(0,G.findAndUpdateTransactionsInBatch)({messenger:this.messenger,updateTransactionFn:O(this,l,"f"),batchId:s,txDataByType:n});if(!o)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:r,tradeMeta:o}}),this.submitTx=async(e,t,n,r)=>{this.messenger.call("BridgeController:stopPollingForQuotes",R.AbortReason.TransactionSubmitted,t.featureId?undefined:r);const a=O(this,s,"m",k).call(this,e);if(!a)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const i=(0,R.isHardwareWallet)(a),c=(0,q.getPreConfirmationPropertiesFromQuote)(t,n,i);let d,l;!t.featureId&&O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Submitted,undefined,c);const u=Date.now(),h=(0,R.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);if((0,R.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,R.isTronTrade)(t.approval)){const e=await O(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionApprovalCompleted:L.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,R.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{return t.approval&&(0,R.isTronTrade)(t.approval)?await O(this,S,"f").call(this,t.approval,t,a):undefined}catch(e){throw!t.featureId&&O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...c}),e}});l=e?.id,await(0,G.handleApprovalDelay)(t.quote.srcChainId)}d=await O(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionCompleted:L.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,R.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{if(!(0,R.isTronTrade)(t.trade)&&!(0,R.isBitcoinTrade)(t.trade)&&"string"!=typeof t.trade)throw new Error("Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction");return await O(this,S,"f").call(this,t.trade,t,a)}catch(e){throw!t.featureId&&O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Failed,d?.id,{error_message:e?.message,...c}),e}})}else{const e=O(this,o,"f")===F.BridgeClientId.MOBILE&&i;d=await O(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionCompleted:L.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,R.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:n}},async()=>{if(!(0,R.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");if(n||t.quote.gasIncluded7702){const{tradeMeta:n,approvalMeta:s}=await O(this,x,"f").call(this,{isBridgeTx:h,resetApproval:t.resetApproval,approval:t.approval&&(0,R.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e});return l=s?.id,n}const s=await O(this,I,"f").call(this,h,t.quote.srcChainId,t.approval&&(0,R.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);return l=s?.id,await(0,G.handleMobileHardwareWalletDelay)(e),await O(this,T,"f").call(this,{transactionType:h?M.TransactionType.bridge:M.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined})})}try{O(this,f,"f").call(this,{accountAddress:a.address,bridgeTxMeta:d,statusRequest:{...(0,G.getStatusRequestParams)(t),srcTxHash:d.hash},quoteResponse:t,slippagePercentage:0,isStxEnabled:n,startTime:u,approvalTxId:l}),(0,R.isNonEvmChainId)(t.quote.srcChainId)&&(O(this,g,"f").call(this,d.id),h||O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Completed,d.id))}catch{}return d},j.set(this,(e,t,n)=>{const s={action_type:R.MetricsActionType.SWAPBRIDGE_V1,...n??{}};if(!t)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,s);const r=this.state.txHistory[t];if(!r)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,n??{});const o=(0,q.getRequestParamFromHistory)(r);if(e===R.UnifiedSwapBridgeEventName.StatusValidationFailed){const{chain_id_source:t,chain_id_destination:n,token_address_source:a,token_address_destination:i}=o;return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,{...s,chain_id_source:t,chain_id_destination:n,token_address_source:a,token_address_destination:i,refresh_count:r.attempts?.counter??0})}if(r.featureId)return;const a=this.messenger.call("AccountsController:getAccountByAddress",r.account),{transactions:i}=this.messenger.call("TransactionController:getState"),c=i?.find(({id:e})=>e===t),d=i?.find(({id:e})=>e===r.approvalTxId),l={...s,...o,...(0,q.getRequestMetadataFromHistory)(r,a),...(0,q.getTradeDataFromHistory)(r),...(0,q.getTxStatusesFromHistory)(r),...(0,q.getFinalizedTxProperties)(r,c,d),...(0,q.getPriceImpactFromQuote)(r.quote)};this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,l)}),N(this,o,n,"f"),N(this,a,P,"f"),N(this,c,W,"f"),N(this,d,K,"f"),N(this,l,V,"f"),N(this,u,Y,"f"),N(this,i,{customBridgeApiBaseUrl:Q?.customBridgeApiBaseUrl??L.BRIDGE_PROD_API_BASE_URL},"f"),N(this,m,z??((e,t)=>t?.()),"f"),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength(L.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:n,id:s}=e;t&&[M.TransactionType.bridge,M.TransactionType.swap,M.TransactionType.bridgeApproval,M.TransactionType.swapApproval].includes(t)&&[M.TransactionStatus.failed,M.TransactionStatus.dropped,M.TransactionStatus.rejected].includes(n)&&(O(this,h,"f").call(this,e),n!==M.TransactionStatus.rejected&&O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Failed,s,(0,q.getEVMTxPropertiesFromTransactionMeta)(e)))}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:n,chainId:s}=e;t===M.TransactionType.swap&&O(this,j,"f").call(this,R.UnifiedSwapBridgeEventName.Completed,n),t!==M.TransactionType.bridge||(0,R.isNonEvmChainId)(s)||O(this,g,"f").call(this,n)}),O(this,p,"f").call(this)}}n.BridgeStatusController=W,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,w=new WeakMap,_=new WeakMap,b=new WeakMap,y=new WeakMap,E=new WeakMap,S=new WeakMap,A=new WeakMap,I=new WeakMap,T=new WeakMap,v=new WeakMap,C=new WeakMap,x=new WeakMap,j=new WeakMap,s=new WeakSet,k=function(e){return this.messenger.call("AccountsController:getAccountByAddress",e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.TraceName=n.APPROVAL_DELAY_MS=n.BRIDGE_PROD_API_BASE_URL=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.BRIDGE_STATUS_CONTROLLER_NAME=n.MAX_ATTEMPTS=n.REFRESH_INTERVAL_MS=void 0,n.REFRESH_INTERVAL_MS=1e4,n.MAX_ATTEMPTS=7,n.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{}},n.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",n.APPROVAL_DELAY_MS=5e3,function(e){e.BridgeTransactionApprovalCompleted="Bridge Transaction Approval Completed",e.BridgeTransactionCompleted="Bridge Transaction Completed",e.SwapTransactionApprovalCompleted="Swap Transaction Approval Completed",e.SwapTransactionCompleted="Swap Transaction Completed"}(s||(n.TraceName=s={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/index.cjs",{"./bridge-status-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getTxMetaFields=n.BridgeStatusController=n.BridgeStatusAction=n.BridgeId=n.MAX_ATTEMPTS=n.BRIDGE_STATUS_CONTROLLER_NAME=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.REFRESH_INTERVAL_MS=void 0;var s=e("./constants.cjs");Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return s.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(n,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return s.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(n,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return s.MAX_ATTEMPTS}});var r=e("./types.cjs");Object.defineProperty(n,"BridgeId",{enumerable:!0,get:function(){return r.BridgeId}}),Object.defineProperty(n,"BridgeStatusAction",{enumerable:!0,get:function(){return r.BridgeStatusAction}});var o=e("./bridge-status-controller.cjs");Object.defineProperty(n,"BridgeStatusController",{enumerable:!0,get:function(){return o.BridgeStatusController}});var a=e("./utils/transaction.cjs");Object.defineProperty(n,"getTxMetaFields",{enumerable:!0,get:function(){return a.getTxMetaFields}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusAction=n.BridgeId=n.BridgeClientId=void 0,function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(s||(n.BridgeClientId=s={})),function(e){e.HOP="hop",e.CELER="celer",e.CELERCIRCLE="celercircle",e.CONNEXT="connext",e.POLYGON="polygon",e.AVALANCHE="avalanche",e.MULTICHAIN="multichain",e.AXELAR="axelar",e.ACROSS="across",e.STARGATE="stargate",e.RELAY="relay",e.MAYAN="mayan"}(r||(n.BridgeId=r={})),function(e){e.START_POLLING_FOR_BRIDGE_TX_STATUS="startPollingForBridgeTxStatus",e.WIPE_BRIDGE_STATUS="wipeBridgeStatus",e.GET_STATE="getState",e.RESET_STATE="resetState",e.SUBMIT_TX="submitTx",e.RESTART_POLLING_FOR_FAILED_ATTEMPTS="restartPollingForFailedAttempts",e.GET_BRIDGE_HISTORY_ITEM_BY_TX_META_ID="getBridgeHistoryItemByTxMetaId"}(o||(n.BridgeStatusAction=o={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.shouldSkipFetchDueToFetchFailures=n.getStatusRequestWithSrcTxHash=n.fetchBridgeTxStatus=n.getStatusRequestDto=n.getBridgeStatusUrl=n.getClientIdHeader=void 0;const s=e("@metamask/superstruct"),r=e("./validators.cjs"),o=e("../constants.cjs");n.getClientIdHeader=e=>({"X-Client-Id":e});n.getBridgeStatusUrl=e=>`${e}/getTxStatus`;n.getStatusRequestDto=e=>{const{quote:t,...n}=e;return{...Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};n.fetchBridgeTxStatus=async(e,t,o,a)=>{const i=(0,n.getStatusRequestDto)(e),c=new URLSearchParams(i),d=`${(0,n.getBridgeStatusUrl)(a)}?${c.toString()}`,l=await o(d,{headers:(0,n.getClientIdHeader)(t)}),u=[];try{(0,r.validateBridgeStatusResponse)(l)}catch(t){t instanceof s.StructError&&t.failures().forEach(({branch:t,path:n})=>{const s=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||l?.bridge||e.bridge||e.bridgeId||"unknown",r=n?.join(".")||"unknown";u.push([s,r].join("|"))})}return{status:l,validationFailures:u}};n.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:n,bridges:s,srcChainId:r,destChainId:o,refuel:a}=e;return{bridgeId:n,srcTxHash:t,bridge:s[0],srcChainId:r,destChainId:o,quote:e,refuel:Boolean(a)}};n.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=o.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calcActualGasUsed=n.calculateGasFees=n.getTxGasEstimates=void 0;const s=e("@metamask/controller-utils"),r=e("bignumber.js");n.getTxGasEstimates=({txGasFeeEstimates:e,networkGasFeeEstimates:t})=>{const{estimatedBaseFee:n="0"}=t;return((e,t)=>{const{maxFeePerGas:n,maxPriorityFeePerGas:s}=e?.high??{};return{baseAndPriorityFeePerGas:s?new r.BigNumber(t,10).times(10**9).plus(s,16):undefined,maxFeePerGas:n,maxPriorityFeePerGas:s}})(e,n)};n.calculateGasFees=async(e,t,r,{chainId:o,gasLimit:a,...i},c,d,l)=>{if(!e)return{};if(l)return{...l,gas:a?.toString()};const u={...i,gas:a?.toString(),data:i.data,to:i.to,value:i.value},{gasFeeEstimates:m}=t.call("GasFeeController:getState"),{estimates:h}=await r({transactionParams:u,chainId:d,networkClientId:c}),{maxFeePerGas:p,maxPriorityFeePerGas:f}=(0,n.getTxGasEstimates)({networkGasFeeEstimates:m,txGasFeeEstimates:h});return{maxFeePerGas:p,maxPriorityFeePerGas:f,gas:(0,s.toHex)(u.gas??0)}};const o=(e,t)=>e&&t?new r.BigNumber(e,16).times(new r.BigNumber(t,16)):null;n.calcActualGasUsed=({pricingData:e},t,n)=>{const s=e?.quotedGasInUsd&&e?.quotedGasAmount?new r.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,a=o(t?.gasUsed,t?.effectiveGasPrice)?.plus(o(n?.gasUsed,n?.effectiveGasPrice)??0),i=a?.div(new r.BigNumber(10).pow(18)).toString(10);return a&&i?{amount:a.toString(10),usd:s?.multipliedBy(i).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs",{"./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./swap-received-amount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getEVMTxPropertiesFromTransactionMeta=n.getRequestMetadataFromHistory=n.getTradeDataFromHistory=n.getPreConfirmationPropertiesFromQuote=n.getPriceImpactFromQuote=n.getTradeDataFromQuote=n.getRequestParamFromHistory=n.getFinalizedTxProperties=n.getTxStatusesFromHistory=void 0;const s=e("@metamask/bridge-controller"),r=e("@metamask/transaction-controller"),o=e("bignumber.js"),a=e("./gas.cjs"),i=e("./swap-received-amount.cjs");n.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:n,quote:r})=>{const o=e.srcChain.txHash?s.StatusTypes.COMPLETE:s.StatusTypes.PENDING,a=e.destChain?.txHash?e.status:s.StatusTypes.PENDING,i=(0,s.formatChainIdToHex)(r.srcChainId),c=(0,s.isEthUsdt)(i,r.srcAsset.address),d=e.srcChain.txHash?s.StatusTypes.COMPLETE:undefined,l=e.srcChain.txHash?s.StatusTypes.COMPLETE:s.StatusTypes.PENDING;return{allowance_reset_transaction:c?d:undefined,approval_transaction:t||n?l:undefined,source_transaction:o,destination_transaction:e.status===s.StatusTypes.FAILED?s.StatusTypes.FAILED:a}};n.getFinalizedTxProperties=(e,t,n)=>{const s=n?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===r.TransactionType.swap?t?.time:e.completionTime,d=(0,a.calcActualGasUsed)(e,t?.txReceipt,n?.txReceipt),l=t?.type===r.TransactionType.swap?(0,i.getActualSwapReceivedAmount)(e,d,t):(0,i.getActualBridgeReceivedAmount)(e),u=e.pricingData?.quotedGasAmount&&d?.amount?new o.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new o.BigNumber(10).pow(18)).div(d.amount).toNumber():0,m=e.pricingData?.quotedReturnInUsd&&l?.usd?new o.BigNumber(e.pricingData.quotedReturnInUsd).div(l.usd).toNumber():0;return{actual_time_minutes:c&&s?(c-s)/6e4:0,usd_actual_return:Number(l?.usd??0),usd_actual_gas:d?.usd??0,quote_vs_execution_ratio:m,quoted_vs_used_gas_ratio:u}};n.getRequestParamFromHistory=e=>({chain_id_source:(0,s.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,s.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId});n.getTradeDataFromQuote=e=>({usd_quoted_gas:Number(e.gasFee?.effective?.usd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,s.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});n.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});n.getPreConfirmationPropertiesFromQuote=(e,t,r)=>{const{quote:o}=e;return{...(0,n.getPriceImpactFromQuote)(o),...(0,n.getTradeDataFromQuote)(e),chain_id_source:(0,s.formatChainIdToCaip)(o.srcChainId),token_symbol_source:o.srcAsset.symbol,chain_id_destination:(0,s.formatChainIdToCaip)(o.destChainId),token_symbol_destination:o.destAsset.symbol,is_hardware_wallet:r,swap_type:(0,s.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:s.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1}};n.getTradeDataFromHistory=e=>({usd_quoted_gas:Number(e.pricingData?.quotedGasInUsd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,s.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});n.getRequestMetadataFromHistory=(e,t)=>{const{quote:n,slippagePercentage:r,isStxEnabled:o}=e;return{slippage_limit:r,custom_slippage:(0,s.isCustomSlippage)(r),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,s.getSwapType)(n.srcChainId,n.destChainId),is_hardware_wallet:(0,s.isHardwareWallet)(t),stx_enabled:o??!1,security_warnings:[]}};n.getEVMTxPropertiesFromTransactionMeta=e=>({source_transaction:[r.TransactionStatus.failed,r.TransactionStatus.dropped,r.TransactionStatus.rejected].includes(e.status)?s.StatusTypes.FAILED:s.StatusTypes.COMPLETE,error_message:e.error?.message??"",chain_id_source:(0,s.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,s.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:100,stx_enabled:!1,token_address_source:(0,s.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,s.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",custom_slippage:!1,is_hardware_wallet:!1,swap_type:e.type&&[r.TransactionType.swap,r.TransactionType.swapApproval].includes(e.type)?s.MetricsSwapType.SINGLE:s.MetricsSwapType.CROSSCHAIN,security_warnings:[],price_impact:0,usd_quoted_gas:0,gas_included:!1,gas_included_7702:!1,quoted_time_minutes:0,usd_quoted_return:0,provider:"",actual_time_minutes:0,quote_vs_execution_ratio:0,quoted_vs_used_gas_ratio:0,usd_actual_return:0,usd_actual_gas:0,action_type:s.MetricsActionType.SWAPBRIDGE_V1})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs",{uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createClientTransactionRequest=void 0;const s=e("uuid");n.createClientTransactionRequest=(e,t,n,r,o)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,s.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:n,accountId:r,...o&&{options:o}}}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getActualBridgeReceivedAmount=n.getActualSwapReceivedAmount=void 0;const s=e("@metamask/bridge-controller"),r=e("bignumber.js");n.getActualSwapReceivedAmount=(e,t,n)=>{const{pricingData:o}=e,a=e.quote.destTokenAmount;if(!n?.txReceipt)return null;const i=(0,s.isNativeAddress)(e.quote.destAsset.address)?((e,t,n)=>{const{preTxBalance:s,postTxBalance:o}=n;return s&&o&&s!==o?t&&o&&s?new r.BigNumber(o,16).minus(s,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new r.BigNumber(e.quote.destTokenAmount).div(new r.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,n):((e,t)=>{const{txReceipt:n}=t;if(!n?.logs||"0x0"===n.status)return null;const{account:s,quote:o}=e,a=n.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),n=e.address?.toLowerCase()===o.destAsset.address?.toLowerCase(),r=e.topics?.[2]&&(e.topics[2]===s||e.topics[2].match(s?.slice(2)));return t&&n&&r});return a?.data?new r.BigNumber(a.data,16).div(new r.BigNumber(10).pow(o.destAsset.decimals)):null})(e,n),c=o?.quotedReturnInUsd&&a?new r.BigNumber(o.quotedReturnInUsd).div(a).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:i,usd:i&&c?c.multipliedBy(i):null}};n.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:n,status:s}=e,o=n?.quotedReturnInUsd?new r.BigNumber(n.quotedReturnInUsd).div(t.destTokenAmount):null,a=s.destChain?.amount;return a&&o?{amount:a,usd:o.multipliedBy(a).toString(10)}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.findAndUpdateTransactionsInBatch=n.getAddTransactionBatchParams=n.toBatchTxParams=n.getClientRequest=n.handleMobileHardwareWalletDelay=n.handleApprovalDelay=n.handleNonEvmTxResponse=n.getTxMetaFields=n.getStatusRequestParams=n.generateActionId=void 0;const s=e("@metamask/bridge-controller"),r=e("@metamask/controller-utils"),o=e("@metamask/transaction-controller"),a=e("@metamask/utils"),i=e("uuid"),c=e("./gas.cjs"),d=e("./snaps.cjs"),l=e("../constants.cjs");n.generateActionId=()=>(Date.now()+Math.random()).toString();n.getStatusRequestParams=e=>({bridgeId:e.quote.bridgeId,bridge:e.quote.bridges[0],srcChainId:e.quote.srcChainId,destChainId:e.quote.destChainId,quote:e.quote,refuel:Boolean(e.quote.refuel)});n.getTxMetaFields=(e,t)=>{let n;try{n=(0,s.formatChainIdToHex)(e.quote.destChainId)}catch{n="0x1"}return{destinationChainId:n,sourceTokenAmount:e.quote.srcTokenAmount,sourceTokenSymbol:e.quote.srcAsset.symbol,sourceTokenDecimals:e.quote.srcAsset.decimals,sourceTokenAddress:e.quote.srcAsset.address,destinationTokenAmount:e.quote.destTokenAmount,destinationTokenSymbol:e.quote.destAsset.symbol,destinationTokenDecimals:e.quote.destAsset.decimals,destinationTokenAddress:e.quote.destAsset.address,approvalTxId:t,swapTokenValue:e.sentAmount.amount}};n.handleNonEvmTxResponse=(e,t,r)=>{const a=r.address,c=r.metadata.snap?.id;let d;"string"==typeof e?d=e:e&&"object"==typeof e&&("transactionId"in e&&e.transactionId?d=e.transactionId:"result"in e&&e.result&&"object"==typeof e.result?d=e.result.signature||e.result.txid||e.result.hash||e.result.txHash:"signature"in e&&e.signature&&"string"==typeof e.signature&&(d=e.signature));const l=(0,s.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);let u;try{u=(0,s.formatChainIdToHex)(t.quote.srcChainId)}catch{u="0x1"}const m=(0,s.extractTradeData)(t.trade);return{...(0,n.getTxMetaFields)(t),time:Date.now(),id:d??(0,i.v4)(),chainId:u,networkClientId:c??u,txParams:{from:a,data:m},type:l?o.TransactionType.bridge:o.TransactionType.swap,status:o.TransactionStatus.submitted,hash:d,origin:c,isSolana:!0,isBridgeTx:l}};n.handleApprovalDelay=async e=>{if([s.ChainId.LINEA,s.ChainId.BASE].includes(e)){(0,a.createProjectLogger)("bridge")("Delaying submitting bridge tx to make Linea and Base confirmation more likely");const e=new Promise(e=>setTimeout(e,l.APPROVAL_DELAY_MS));await e}};n.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};n.getClientRequest=(e,t,n)=>{const r=(0,s.formatChainIdToCaip)(t),o=(0,s.extractTradeData)(e),a=(0,s.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,d.createClientTransactionRequest)(n.metadata.snap?.id,o,r,n.id,a)};n.toBatchTxParams=(e,{chainId:t,gasLimit:n,...s},{maxFeePerGas:o,maxPriorityFeePerGas:a,gas:i})=>{const c={...s,data:s.data,to:s.to,value:s.value};return e?{...c,gas:(0,r.toHex)(i??0),maxFeePerGas:(0,r.toHex)(o??0),maxPriorityFeePerGas:(0,r.toHex)(a??0)}:c};n.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:r,resetApproval:a,trade:i,quoteResponse:{quote:{feeData:{txFee:d},gasIncluded:l,gasIncluded7702:u,gasSponsored:m},sentAmount:h,toTokenAmount:p},requireApproval:f=!1,estimateGasFeeFn:g})=>{const k=l||u;if(!e.call("AccountsController:getAccountByAddress",i.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const w=(0,s.formatChainIdToHex)(i.chainId),_=e.call("NetworkController:findNetworkClientIdByChainId",w),b=!0!==u,y=[];if(a){const s=await(0,c.calculateGasFees)(b,e,g,a,_,w,k?d:undefined);y.push({type:t?o.TransactionType.bridgeApproval:o.TransactionType.swapApproval,params:(0,n.toBatchTxParams)(b,a,s)})}if(r){const s=await(0,c.calculateGasFees)(b,e,g,r,_,w,k?d:undefined);y.push({type:t?o.TransactionType.bridgeApproval:o.TransactionType.swapApproval,params:(0,n.toBatchTxParams)(b,r,s)})}const E=await(0,c.calculateGasFees)(b,e,g,i,_,w,k?d:undefined);y.push({type:t?o.TransactionType.bridge:o.TransactionType.swap,params:(0,n.toBatchTxParams)(b,i,E),assetsFiatValues:{sending:h?.valueInCurrency?.toString(),receiving:p?.valueInCurrency?.toString()}});return{disable7702:b,isGasFeeIncluded:Boolean(u),isGasFeeSponsored:Boolean(m),networkClientId:_,requireApproval:f,origin:"metamask",from:i.from,transactions:y}};n.findAndUpdateTransactionsInBatch=({messenger:e,updateTransactionFn:t,batchId:n,txDataByType:s})=>{const r=e.call("TransactionController:getState").transactions,a={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(s).forEach(([e,s])=>{const i=r.find(t=>{if(t.batchId!==n)return!1;if(Array.isArray(t.txParams.authorizationList)&&t.txParams.authorizationList.length>0||Boolean(t.delegationAddress)){if(e===o.TransactionType.swap&&t.type===o.TransactionType.batch)return!0;if(e===o.TransactionType.swapApproval&&t.txParams.data===s)return!0}return t.txParams.data===s});if(i){const n={...i,type:e};t(n,`Update tx type to ${e}`),a[[o.TransactionType.bridgeApproval,o.TransactionType.swapApproval].includes(e)?"approvalMeta":"tradeMeta"]=n}}),a}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateBridgeStatusResponse=n.StatusResponseSchema=void 0;const s=e("@metamask/bridge-controller"),r=e("@metamask/superstruct"),o=(0,r.number)(),a=(0,r.type)({}),i=(0,r.type)({chainId:o,txHash:(0,r.optional)((0,r.string)()),amount:(0,r.optional)((0,r.string)()),token:(0,r.optional)((0,r.union)([a,s.BridgeAssetSchema]))}),c=(0,r.type)({chainId:o,txHash:(0,r.optional)((0,r.string)()),amount:(0,r.optional)((0,r.string)()),token:(0,r.optional)((0,r.union)([a,s.BridgeAssetSchema]))}),d=(0,r.type)({});n.StatusResponseSchema=(0,r.type)({status:(0,r.enums)(Object.values(s.StatusTypes)),srcChain:i,destChain:(0,r.optional)(c),bridge:(0,r.optional)((0,r.string)()),isExpectedToken:(0,r.optional)((0,r.boolean)()),isUnrecognizedRouterAddress:(0,r.optional)((0,r.boolean)()),refuel:(0,r.optional)(d)});n.validateBridgeStatusResponse=e=>((0,r.assert)(e,n.StatusResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/assets.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","@ethersproject/bignumber":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/bignumber/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m,h,p,f,g,k,w,_,b,y,E,S,A,I,T,v,C=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},x=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeController=void 0;const j=e("@ethersproject/bignumber"),N=e("@ethersproject/contracts"),O=e("@ethersproject/providers"),R=e("@metamask/metamask-eth-abis"),D=e("@metamask/polling-controller"),P=e("./constants/bridge.cjs"),M=e("./constants/chains.cjs"),B=e("./constants/swaps.cjs"),L=e("./constants/traces.cjs"),F=e("./selectors.cjs"),U=e("./types.cjs"),H=e("./utils/assets.cjs"),q=e("./utils/balance.cjs"),G=e("./utils/bridge.cjs"),$=e("./utils/caip-formatters.cjs"),W=e("./utils/feature-flags.cjs"),K=e("./utils/fetch.cjs"),V=e("./utils/metrics/constants.cjs"),Y=e("./utils/metrics/properties.cjs"),Q=e("./utils/quote.cjs"),z=e("./utils/quote-fees.cjs"),J=e("./utils/snaps.cjs"),X={quoteRequest:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotes:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesInitialLoadTime:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLastFetched:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLoadingStatus:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quoteFetchError:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesRefreshCount:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetExchangeRates:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},minimumBalanceForRentExemptionInLamports:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0}};class Z extends((0,D.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:n,clientVersion:D,getLayer1GasFee:Z,fetchFn:ee,config:te,trackMetaMetricsFn:ne,traceFn:se}){super({name:P.BRIDGE_CONTROLLER_NAME,metadata:X,messenger:e,state:{...(0,G.getDefaultBridgeControllerState)(),...t}}),s.add(this),r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,void 0),m.set(this,void 0),this._executePoll=async e=>{await x(this,w,"f").call(this,e)},this.updateBridgeQuoteRequestParams=async(e,t)=>{x(this,T,"f").call(this,e),this.resetState(V.AbortReason.QuoteRequestUpdated);const n={...P.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,...e};if(this.update(e=>{e.quoteRequest=n}),await x(this,f,"f").call(this,n).catch(e=>console.warn("Failed to fetch asset exchange rates",e)),(0,Q.isValidQuoteRequest)(n)){C(this,o,Date.now(),"f");const r=(0,G.isNonEvmChainId)(n.srcChainId),a=r?undefined:x(this,s,"m",E).call(this,(0,$.formatChainIdToHex)(n.srcChainId))?.configuration;let i,c=Boolean(e.resetApproval);r?i=e.insufficientBal:a?.rpcUrl?.includes("tenderly")?i=!0:(this.update(e=>{e.quotesLoadingStatus=U.RequestStatus.LOADING}),c=await x(this,k,"f").call(this,n),i=e.insufficientBal??await x(this,g,"f").call(this,n)),this.setChainIntervalLength(),this.startPolling({updatedQuoteRequest:{...n,insufficientBal:i,resetApproval:c},context:t})}},this.fetchQuotes=async(e,t=null,n=null)=>{const r=(0,W.getBridgeFeatureFlags)(this.messenger),o=n?r.quoteRequestOverrides?.[n]:undefined,l=await x(this,k,"f").call(this,e),{quotes:u,validationFailures:p}=await(0,K.fetchBridgeQuotes)(o?{...e,...o,resetApproval:l}:{...e,resetApproval:l},t,x(this,a,"f"),x(this,d,"f"),x(this,m,"f").customBridgeApiBaseUrl??P.BRIDGE_PROD_API_BASE_URL,n,x(this,i,"f"));x(this,h,"f").call(this,p);const f=await(0,z.appendFeesToQuotes)(u,this.messenger,x(this,c,"f"),x(this,s,"m",y).call(this,e.walletAddress));return(0,Q.sortQuotes)(f,n)},h.set(this,e=>{0!==e.length&&this.trackUnifiedSwapBridgeEvent(V.UnifiedSwapBridgeEventName.QuotesValidationFailed,{failures:e})}),p.set(this,()=>({...this.messenger.call("MultichainAssetsRatesController:getState"),...this.messenger.call("CurrencyRateController:getState"),...this.messenger.call("TokenRatesController:getState"),...this.state})),f.set(this,async({srcChainId:e,srcTokenAddress:t,destChainId:n,destTokenAddress:s})=>{const o=new Set([]),c=x(this,p,"f").call(this);t&&e&&!(0,F.selectIsAssetExchangeRateInState)(c,e,t)&&(0,H.getAssetIdsForToken)(t,e).forEach(e=>o.add(e)),s&&n&&!(0,F.selectIsAssetExchangeRateInState)(c,n,s)&&(0,H.getAssetIdsForToken)(s,n).forEach(e=>o.add(e));const l=this.messenger.call("CurrencyRateController:getState").currentCurrency;if(0===o.size)return;const u=await(0,K.fetchAssetPrices)({assetIds:o,currencies:new Set([l]),clientId:x(this,a,"f"),clientVersion:x(this,i,"f"),fetchFn:x(this,d,"f"),signal:x(this,r,"f")?.signal}),m=(0,H.toExchangeRates)(l,u);this.update(e=>{e.assetExchangeRates={...e.assetExchangeRates,...m}})}),g.set(this,async e=>{try{const t=(0,$.formatChainIdToHex)(e.srcChainId),n=x(this,s,"m",E).call(this,t)?.provider,r=(0,$.formatAddressToCaipReference)(e.srcTokenAddress);return!(n&&r&&e.srcTokenAmount&&t&&await(0,q.hasSufficientBalance)(n,e.walletAddress,r,e.srcTokenAmount,t))}catch(e){return console.warn("Failed to set insufficientBal",e),!0}}),k.set(this,async e=>{if((0,G.isNonEvmChainId)(e.srcChainId))return!1;try{const t=(0,$.formatAddressToCaipReference)(e.srcTokenAddress);if((0,G.isEthUsdt)(e.srcChainId,t)){const n=j.BigNumber.from(await x(this,v,"f").call(this,e.walletAddress,t,e.destChainId));return n.lt(e.srcTokenAmount)&&n.gt(0)}return!1}catch(e){return console.warn("Failed to set resetApproval",e),!0}}),this.stopPollingForQuotes=(e,t)=>{this.stopAllPolling(),this.state.quotesLoadingStatus===U.RequestStatus.LOADING&&t&&this.trackUnifiedSwapBridgeEvent(V.UnifiedSwapBridgeEventName.QuotesReceived,t),x(this,r,"f")?.abort(e)},this.resetState=(e=V.AbortReason.ResetState)=>{this.stopPollingForQuotes(e),this.update(e=>{e.quoteRequest=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,e.quotesInitialLoadTime=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesInitialLoadTime,e.quotes=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,e.quotesLastFetched=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLastFetched,e.quotesLoadingStatus=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLoadingStatus,e.quoteFetchError=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,e.quotesRefreshCount=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount,e.assetExchangeRates=P.DEFAULT_BRIDGE_CONTROLLER_STATE.assetExchangeRates,e.minimumBalanceForRentExemptionInLamports=P.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports})},this.setChainIntervalLength=()=>{const{state:e}=this,{srcChainId:t}=e.quoteRequest,n=(0,W.getBridgeFeatureFlags)(this.messenger),s=t?n.chains[(0,$.formatChainIdToCaip)(t)]?.refreshRate:undefined,r=n.refreshRate;this.setIntervalLength(s??r)},w.set(this,async({updatedQuoteRequest:e,context:t})=>{x(this,r,"f")?.abort("New quote request"),C(this,r,new AbortController,"f"),this.trackUnifiedSwapBridgeEvent(V.UnifiedSwapBridgeEventName.QuotesRequested,t);const{sse:n,maxRefreshCount:a}=(0,W.getBridgeFeatureFlags)(this.messenger),c=n?.enabled&&(0,W.hasMinimumRequiredVersion)(x(this,i,"f"),n.minimumVersion);this.update(t=>{t.quoteRequest=e,t.quoteFetchError=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,t.quotesLastFetched=Date.now(),t.quotesLoadingStatus=U.RequestStatus.LOADING});try{await x(this,u,"f").call(this,{name:(0,G.isCrossChain)(e.srcChainId,e.destChainId)?L.TraceName.BridgeQuotesFetched:L.TraceName.SwapQuotesFetched,data:{srcChainId:(0,$.formatChainIdToCaip)(e.srcChainId),destChainId:(0,$.formatChainIdToCaip)(e.destChainId)}},async()=>{const t=x(this,s,"m",y).call(this,e.walletAddress);if(x(this,b,"f").call(this,e.srcChainId,t?.metadata?.snap?.id),c)return void await x(this,_,"f").call(this,e,t);const n=await this.fetchQuotes(e,x(this,r,"f")?.signal);this.update(e=>{e.quotesRefreshCount===P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount&&x(this,o,"f")&&(e.quotesInitialLoadTime=Date.now()-x(this,o,"f")),e.quotes=n,e.quotesLoadingStatus=U.RequestStatus.FETCHED})})}catch(e){if(this.update(e=>{e.quotes=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes}),e.toString().includes("AbortError")||e.toString().includes("FetchRequestCanceledException")||[V.AbortReason.ResetState,V.AbortReason.NewQuoteRequest,V.AbortReason.QuoteRequestUpdated,V.AbortReason.TransactionSubmitted].includes(e))return;this.update(t=>{let n;try{n=e?.message??e.toString()}catch{}finally{t.quoteFetchError=n??"Unknown error"}t.quotesLoadingStatus=U.RequestStatus.ERROR}),this.trackUnifiedSwapBridgeEvent(V.UnifiedSwapBridgeEventName.QuotesError,t),console.log(`Failed to ${c?"stream":"fetch"} bridge quotes`,e)}this.update(e=>{e.quotesRefreshCount+=1}),(e.insufficientBal||!e.insufficientBal&&this.state.quotesRefreshCount>=a)&&this.stopAllPolling()}),_.set(this,async(e,t)=>{let n=0;const s=new Set;await(0,K.fetchBridgeQuoteStream)(x(this,d,"f"),e,x(this,r,"f")?.signal,x(this,a,"f"),x(this,m,"f").customBridgeApiBaseUrl??P.BRIDGE_PROD_API_BASE_URL,{onValidationFailure:x(this,h,"f"),onValidQuoteReceived:async e=>{const r=(async()=>{const s=await(0,z.appendFeesToQuotes)([e],this.messenger,x(this,c,"f"),t);s.length>0&&(n+=1),this.update(e=>{1===n&&(e.quotes=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,!e.quotesInitialLoadTime&&x(this,o,"f")&&(e.quotesInitialLoadTime=Date.now()-x(this,o,"f"))),e.quotes=[...e.quotes,...s]})})();s.add(r),r.catch(e=>{console.error("Error appending fees to quote",e)}).finally(()=>{s.delete(r)}),await r},onClose:async()=>{await Promise.allSettled(Array.from(s)),this.update(e=>{0===n&&(e.quotes=P.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes),e.quotesLoadingStatus=U.RequestStatus.FETCHED})}},x(this,i,"f"))}),b.set(this,async(e,t)=>{if(!(0,G.isSolanaChainId)(e)||!t)return;const n=await(0,J.getMinimumBalanceForRentExemptionInLamports)(t,this.messenger);this.update(e=>{e.minimumBalanceForRentExemptionInLamports=n})}),S.set(this,()=>({slippage_limit:this.state.quoteRequest.slippage,swap_type:(0,Y.getSwapTypeFromQuote)(this.state.quoteRequest),custom_slippage:(0,Y.isCustomSlippage)(this.state.quoteRequest.slippage)})),A.set(this,()=>({quotes_count:this.state.quotes.length,quotes_list:this.state.quotes.map(({quote:e})=>(0,Y.formatProviderLabel)(e)),initial_load_time_all_quotes:this.state.quotesInitialLoadTime??0})),I.set(this,(e,t)=>{const n={...t,action_type:V.MetricsActionType.SWAPBRIDGE_V1};switch(e){case V.UnifiedSwapBridgeEventName.ButtonClicked:case V.UnifiedSwapBridgeEventName.PageViewed:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...n};case V.UnifiedSwapBridgeEventName.QuotesValidationFailed:return{...(0,Y.getRequestParams)(this.state.quoteRequest),refresh_count:this.state.quotesRefreshCount,...n};case V.UnifiedSwapBridgeEventName.QuotesReceived:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),...x(this,A,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",y).call(this)),refresh_count:this.state.quotesRefreshCount,...n};case V.UnifiedSwapBridgeEventName.QuotesRequested:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",y).call(this)),has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...n};case V.UnifiedSwapBridgeEventName.QuotesError:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",y).call(this)),error_message:this.state.quoteFetchError,has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...n};case V.UnifiedSwapBridgeEventName.AllQuotesOpened:case V.UnifiedSwapBridgeEventName.AllQuotesSorted:case V.UnifiedSwapBridgeEventName.QuoteSelected:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),...x(this,A,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",y).call(this)),...n};case V.UnifiedSwapBridgeEventName.Failed:return{...n,...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),...x(this,A,"f").call(this),...t};case V.UnifiedSwapBridgeEventName.AssetDetailTooltipClicked:return n;case V.UnifiedSwapBridgeEventName.Submitted:case V.UnifiedSwapBridgeEventName.Completed:return t;case V.UnifiedSwapBridgeEventName.InputChanged:default:return n}}),T.set(this,e=>{Object.entries(e).forEach(([t,n])=>{const s=Y.toInputChangedPropertyKey[t],r=Y.toInputChangedPropertyValue[t]?.(e);s&&r!==undefined&&n!==this.state.quoteRequest[t]&&this.trackUnifiedSwapBridgeEvent(V.UnifiedSwapBridgeEventName.InputChanged,{input:s,input_value:r})})}),this.trackUnifiedSwapBridgeEvent=(e,t)=>{try{const n=x(this,I,"f").call(this,e,t);x(this,l,"f").call(this,e,n)}catch(t){console.error(`Error tracking cross-chain swaps MetaMetrics event ${e}`,t)}},v.set(this,async(e,t,n)=>{const r=x(this,s,"m",E).call(this,M.CHAIN_IDS.MAINNET),o=r?.provider;if(!o)throw new Error("No provider found");const a=new O.Web3Provider(o),i=new N.Contract(t,R.abiERC20,a),c=(0,G.isCrossChain)(M.CHAIN_IDS.MAINNET,n)?P.METABRIDGE_ETHEREUM_ADDRESS:B.SWAPS_CONTRACT_ADDRESSES[M.CHAIN_IDS.MAINNET];return(await i.allowance(e,c)).toString()}),this.setIntervalLength(P.REFRESH_INTERVAL_MS),C(this,r,new AbortController,"f"),C(this,c,Z,"f"),C(this,a,n,"f"),C(this,i,D,"f"),C(this,d,ee,"f"),C(this,l,ne,"f"),C(this,m,te??{},"f"),C(this,u,se??((e,t)=>t?.()),"f"),this.messenger.registerActionHandler(`${P.BRIDGE_CONTROLLER_NAME}:setChainIntervalLength`,this.setChainIntervalLength.bind(this)),this.messenger.registerActionHandler(`${P.BRIDGE_CONTROLLER_NAME}:updateBridgeQuoteRequestParams`,this.updateBridgeQuoteRequestParams.bind(this)),this.messenger.registerActionHandler(`${P.BRIDGE_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${P.BRIDGE_CONTROLLER_NAME}:trackUnifiedSwapBridgeEvent`,this.trackUnifiedSwapBridgeEvent.bind(this)),this.messenger.registerActionHandler(`${P.BRIDGE_CONTROLLER_NAME}:stopPollingForQuotes`,this.stopPollingForQuotes.bind(this)),this.messenger.registerActionHandler(`${P.BRIDGE_CONTROLLER_NAME}:fetchQuotes`,this.fetchQuotes.bind(this))}}n.BridgeController=Z,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,k=new WeakMap,w=new WeakMap,_=new WeakMap,b=new WeakMap,S=new WeakMap,A=new WeakMap,I=new WeakMap,T=new WeakMap,v=new WeakMap,s=new WeakSet,y=function(e){const t=e??this.state.quoteRequest.walletAddress;if(!t)throw new Error("Account address is required");return this.messenger.call("AccountsController:getAccountByAddress",t)},E=function(e){const t=this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);if(!t)throw new Error(`No network client found for chainId: ${e}`);return this.messenger.call("NetworkController:getNetworkClientById",t)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.METABRIDGE_CHAIN_TO_ADDRESS_MAP=n.DEFAULT_BRIDGE_CONTROLLER_STATE=n.DEFAULT_FEATURE_FLAG_CONFIG=n.BRIDGE_CONTROLLER_NAME=n.DEFAULT_MAX_REFRESH_COUNT=n.REFRESH_INTERVAL_MS=n.BRIDGE_MM_FEE_RATE=n.BRIDGE_PREFERRED_GAS_ESTIMATE=n.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=n.BRIDGE_QUOTE_MAX_ETA_SECONDS=n.METABRIDGE_ETHEREUM_ADDRESS=n.ETH_USDT_ADDRESS=n.BridgeClientId=n.BRIDGE_PROD_API_BASE_URL=n.BRIDGE_DEV_API_BASE_URL=n.ALLOWED_BRIDGE_CHAIN_IDS=void 0;const s=e("@ethersproject/constants"),r=e("@metamask/keyring-api"),o=e("./chains.cjs");var a;n.ALLOWED_BRIDGE_CHAIN_IDS=[o.CHAIN_IDS.MAINNET,o.CHAIN_IDS.BSC,o.CHAIN_IDS.POLYGON,o.CHAIN_IDS.ZKSYNC_ERA,o.CHAIN_IDS.AVALANCHE,o.CHAIN_IDS.OPTIMISM,o.CHAIN_IDS.ARBITRUM,o.CHAIN_IDS.LINEA_MAINNET,o.CHAIN_IDS.BASE,o.CHAIN_IDS.SEI,o.CHAIN_IDS.MONAD,r.SolScope.Mainnet,r.BtcScope.Mainnet,r.TrxScope.Mainnet],n.BRIDGE_DEV_API_BASE_URL="https://bridge.dev-api.cx.metamask.io",n.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(a||(n.BridgeClientId=a={})),n.ETH_USDT_ADDRESS="0xdac17f958d2ee523a2206206994597c13d831ec7",n.METABRIDGE_ETHEREUM_ADDRESS="0x0439e60F02a8900a951603950d8D4527f400C3f1",n.BRIDGE_QUOTE_MAX_ETA_SECONDS=3600,n.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=.5,n.BRIDGE_PREFERRED_GAS_ESTIMATE="medium",n.BRIDGE_MM_FEE_RATE=.875,n.REFRESH_INTERVAL_MS=3e4,n.DEFAULT_MAX_REFRESH_COUNT=5,n.BRIDGE_CONTROLLER_NAME="BridgeController",n.DEFAULT_FEATURE_FLAG_CONFIG={minimumVersion:"0.0.0",refreshRate:n.REFRESH_INTERVAL_MS,maxRefreshCount:n.DEFAULT_MAX_REFRESH_COUNT,support:!1,chains:{}},n.DEFAULT_BRIDGE_CONTROLLER_STATE={quoteRequest:{srcTokenAddress:s.AddressZero},quotesInitialLoadTime:null,quotes:[],quotesLastFetched:null,quotesLoadingStatus:null,quoteFetchError:null,quotesRefreshCount:0,assetExchangeRates:{},minimumBalanceForRentExemptionInLamports:"0"},n.METABRIDGE_CHAIN_TO_ADDRESS_MAP={[o.CHAIN_IDS.MAINNET]:n.METABRIDGE_ETHEREUM_ADDRESS}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.NETWORK_TO_NAME_MAP=n.MONAD_DISPLAY_NAME=n.SEI_DISPLAY_NAME=n.MODE_DISPLAY_NAME=n.MODE_SEPOLIA_DISPLAY_NAME=n.SONEIUM_DISPLAY_NAME=n.INK_DISPLAY_NAME=n.INK_SEPOLIA_DISPLAY_NAME=n.LISK_SEPOLIA_DISPLAY_NAME=n.LISK_DISPLAY_NAME=n.METACHAIN_ONE_DISPLAY_NAME=n.BERACHAIN_DISPLAY_NAME=n.OP_BNB_DISPLAY_NAME=n.SCROLL_SEPOLIA_DISPLAY_NAME=n.SCROLL_DISPLAY_NAME=n.MOONRIVER_DISPLAY_NAME=n.MOONBEAM_DISPLAY_NAME=n.POLYGON_ZKEVM_DISPLAY_NAME=n.CRONOS_DISPLAY_NAME=n.AURORA_DISPLAY_NAME=n.BASE_DISPLAY_NAME=n.ZK_SYNC_ERA_DISPLAY_NAME=n.GNOSIS_DISPLAY_NAME=n.CELO_DISPLAY_NAME=n.PALM_DISPLAY_NAME=n.HARMONY_DISPLAY_NAME=n.FANTOM_DISPLAY_NAME=n.OPTIMISM_DISPLAY_NAME=n.BNB_DISPLAY_NAME=n.ARBITRUM_DISPLAY_NAME=n.AVALANCHE_DISPLAY_NAME=n.POLYGON_DISPLAY_NAME=n.BSC_DISPLAY_NAME=n.LOCALHOST_DISPLAY_NAME=n.LINEA_MAINNET_DISPLAY_NAME=n.LINEA_SEPOLIA_DISPLAY_NAME=n.LINEA_GOERLI_DISPLAY_NAME=n.SEPOLIA_DISPLAY_NAME=n.GOERLI_DISPLAY_NAME=n.MAINNET_DISPLAY_NAME=n.NETWORK_TYPES=n.CHAIN_IDS=void 0,n.CHAIN_IDS={MAINNET:"0x1",GOERLI:"0x5",LOCALHOST:"0x539",BSC:"0x38",BSC_TESTNET:"0x61",OPTIMISM:"0xa",OPTIMISM_TESTNET:"0xaa37dc",OPTIMISM_GOERLI:"0x1a4",BASE:"0x2105",BASE_TESTNET:"0x14a33",OPBNB:"0xcc",OPBNB_TESTNET:"0x15eb",POLYGON:"0x89",POLYGON_TESTNET:"0x13881",AVALANCHE:"0xa86a",AVALANCHE_TESTNET:"0xa869",FANTOM:"0xfa",FANTOM_TESTNET:"0xfa2",CELO:"0xa4ec",ARBITRUM:"0xa4b1",HARMONY:"0x63564c40",PALM:"0x2a15c308d",SEPOLIA:"0xaa36a7",HOLESKY:"0x4268",LINEA_GOERLI:"0xe704",LINEA_SEPOLIA:"0xe705",AMOY:"0x13882",BASE_SEPOLIA:"0x14a34",BLAST_SEPOLIA:"0xa0c71fd",OPTIMISM_SEPOLIA:"0xaa37dc",PALM_TESTNET:"0x2a15c3083",CELO_TESTNET:"0xaef3",ZK_SYNC_ERA_TESTNET:"0x12c",MANTA_SEPOLIA:"0x138b",UNICHAIN_SEPOLIA:"0x515",LINEA_MAINNET:"0xe708",AURORA:"0x4e454152",MOONBEAM:"0x504",MOONBEAM_TESTNET:"0x507",MOONRIVER:"0x505",CRONOS:"0x19",GNOSIS:"0x64",ZKSYNC_ERA:"0x144",TEST_ETH:"0x539",ARBITRUM_GOERLI:"0x66eed",BLAST:"0x13e31",FILECOIN:"0x13a",POLYGON_ZKEVM:"0x44d",SCROLL:"0x82750",SCROLL_SEPOLIA:"0x8274f",WETHIO:"0x4e",CHZ:"0x15b38",NUMBERS:"0x290b",SEI:"0x531",APE_TESTNET:"0x8157",APE_MAINNET:"0x8173",BERACHAIN:"0x138d5",METACHAIN_ONE:"0x1b6e6",ARBITRUM_SEPOLIA:"0x66eee",NEAR:"0x18d",NEAR_TESTNET:"0x18e",B3:"0x208d",B3_TESTNET:"0x7c9",GRAVITY_ALPHA_MAINNET:"0x659",GRAVITY_ALPHA_TESTNET_SEPOLIA:"0x34c1",LISK:"0x46f",LISK_SEPOLIA:"0x106a",INK_SEPOLIA:"0xba5eD",INK:"0xdef1",MODE_SEPOLIA:"0x397",MODE:"0x868b",MONAD:"0x8f"},n.NETWORK_TYPES={GOERLI:"goerli",LOCALHOST:"localhost",MAINNET:"mainnet",SEPOLIA:"sepolia",LINEA_GOERLI:"linea-goerli",LINEA_SEPOLIA:"linea-sepolia",LINEA_MAINNET:"linea-mainnet"},n.MAINNET_DISPLAY_NAME="Ethereum Mainnet",n.GOERLI_DISPLAY_NAME="Goerli",n.SEPOLIA_DISPLAY_NAME="Sepolia",n.LINEA_GOERLI_DISPLAY_NAME="Linea Goerli",n.LINEA_SEPOLIA_DISPLAY_NAME="Linea Sepolia",n.LINEA_MAINNET_DISPLAY_NAME="Linea Mainnet",n.LOCALHOST_DISPLAY_NAME="Localhost 8545",n.BSC_DISPLAY_NAME="Binance Smart Chain",n.POLYGON_DISPLAY_NAME="Polygon",n.AVALANCHE_DISPLAY_NAME="Avalanche Network C-Chain",n.ARBITRUM_DISPLAY_NAME="Arbitrum One",n.BNB_DISPLAY_NAME="BNB Chain",n.OPTIMISM_DISPLAY_NAME="OP Mainnet",n.FANTOM_DISPLAY_NAME="Fantom Opera",n.HARMONY_DISPLAY_NAME="Harmony Mainnet Shard 0",n.PALM_DISPLAY_NAME="Palm",n.CELO_DISPLAY_NAME="Celo Mainnet",n.GNOSIS_DISPLAY_NAME="Gnosis",n.ZK_SYNC_ERA_DISPLAY_NAME="zkSync Era Mainnet",n.BASE_DISPLAY_NAME="Base Mainnet",n.AURORA_DISPLAY_NAME="Aurora Mainnet",n.CRONOS_DISPLAY_NAME="Cronos",n.POLYGON_ZKEVM_DISPLAY_NAME="Polygon zkEVM",n.MOONBEAM_DISPLAY_NAME="Moonbeam",n.MOONRIVER_DISPLAY_NAME="Moonriver",n.SCROLL_DISPLAY_NAME="Scroll",n.SCROLL_SEPOLIA_DISPLAY_NAME="Scroll Sepolia",n.OP_BNB_DISPLAY_NAME="opBNB",n.BERACHAIN_DISPLAY_NAME="Berachain Artio",n.METACHAIN_ONE_DISPLAY_NAME="Metachain One Mainnet",n.LISK_DISPLAY_NAME="Lisk",n.LISK_SEPOLIA_DISPLAY_NAME="Lisk Sepolia",n.INK_SEPOLIA_DISPLAY_NAME="Ink Sepolia",n.INK_DISPLAY_NAME="Ink Mainnet",n.SONEIUM_DISPLAY_NAME="Soneium Mainnet",n.MODE_SEPOLIA_DISPLAY_NAME="Mode Sepolia",n.MODE_DISPLAY_NAME="Mode Mainnet",n.SEI_DISPLAY_NAME="Sei Network",n.MONAD_DISPLAY_NAME="Monad",n.NETWORK_TO_NAME_MAP={[n.NETWORK_TYPES.GOERLI]:n.GOERLI_DISPLAY_NAME,[n.NETWORK_TYPES.MAINNET]:n.MAINNET_DISPLAY_NAME,[n.NETWORK_TYPES.LINEA_GOERLI]:n.LINEA_GOERLI_DISPLAY_NAME,[n.NETWORK_TYPES.LINEA_SEPOLIA]:n.LINEA_SEPOLIA_DISPLAY_NAME,[n.NETWORK_TYPES.LINEA_MAINNET]:n.LINEA_MAINNET_DISPLAY_NAME,[n.NETWORK_TYPES.LOCALHOST]:n.LOCALHOST_DISPLAY_NAME,[n.NETWORK_TYPES.SEPOLIA]:n.SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.ARBITRUM]:n.ARBITRUM_DISPLAY_NAME,[n.CHAIN_IDS.AVALANCHE]:n.AVALANCHE_DISPLAY_NAME,[n.CHAIN_IDS.BSC]:n.BSC_DISPLAY_NAME,[n.CHAIN_IDS.BASE]:n.BASE_DISPLAY_NAME,[n.CHAIN_IDS.GOERLI]:n.GOERLI_DISPLAY_NAME,[n.CHAIN_IDS.MAINNET]:n.MAINNET_DISPLAY_NAME,[n.CHAIN_IDS.LINEA_GOERLI]:n.LINEA_GOERLI_DISPLAY_NAME,[n.CHAIN_IDS.LINEA_MAINNET]:n.LINEA_MAINNET_DISPLAY_NAME,[n.CHAIN_IDS.LINEA_SEPOLIA]:n.LINEA_SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.LOCALHOST]:n.LOCALHOST_DISPLAY_NAME,[n.CHAIN_IDS.OPTIMISM]:n.OPTIMISM_DISPLAY_NAME,[n.CHAIN_IDS.POLYGON]:n.POLYGON_DISPLAY_NAME,[n.CHAIN_IDS.SCROLL]:n.SCROLL_DISPLAY_NAME,[n.CHAIN_IDS.SCROLL_SEPOLIA]:n.SCROLL_SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.SEPOLIA]:n.SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.OPBNB]:n.OP_BNB_DISPLAY_NAME,[n.CHAIN_IDS.ZKSYNC_ERA]:n.ZK_SYNC_ERA_DISPLAY_NAME,[n.CHAIN_IDS.BERACHAIN]:n.BERACHAIN_DISPLAY_NAME,[n.CHAIN_IDS.METACHAIN_ONE]:n.METACHAIN_ONE_DISPLAY_NAME,[n.CHAIN_IDS.LISK]:n.LISK_DISPLAY_NAME,[n.CHAIN_IDS.LISK_SEPOLIA]:n.LISK_SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.SEI]:n.SEI_DISPLAY_NAME,[n.CHAIN_IDS.MONAD]:n.MONAD_DISPLAY_NAME}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ALLOWED_CONTRACT_ADDRESSES=n.SWAPS_WRAPPED_TOKENS_ADDRESSES=n.SWAPS_CONTRACT_ADDRESSES=n.SWAPS_API_V2_BASE_URL=void 0;const s=e("./chains.cjs");n.SWAPS_API_V2_BASE_URL="https://swap.api.cx.metamask.io";const r="0x881d40237659c251811cec9c364ef91dc08d300c";n.SWAPS_CONTRACT_ADDRESSES={[s.CHAIN_IDS.MAINNET]:r,[s.CHAIN_IDS.LOCALHOST]:r,[s.CHAIN_IDS.BSC]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[s.CHAIN_IDS.POLYGON]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[s.CHAIN_IDS.AVALANCHE]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[s.CHAIN_IDS.ARBITRUM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.OPTIMISM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.ZKSYNC_ERA]:"0xf504c1fe13d14df615e66dcd0abf39e60c697f34",[s.CHAIN_IDS.LINEA_MAINNET]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.BASE]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.SEI]:"0x962287c9d5B8a682389E61edAE90ec882325d08b"};const o="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";n.SWAPS_WRAPPED_TOKENS_ADDRESSES={[s.CHAIN_IDS.MAINNET]:o,[s.CHAIN_IDS.LOCALHOST]:o,[s.CHAIN_IDS.BSC]:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",[s.CHAIN_IDS.POLYGON]:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",[s.CHAIN_IDS.AVALANCHE]:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",[s.CHAIN_IDS.ARBITRUM]:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",[s.CHAIN_IDS.OPTIMISM]:"0x4200000000000000000000000000000000000006",[s.CHAIN_IDS.ZKSYNC_ERA]:"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",[s.CHAIN_IDS.LINEA_MAINNET]:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",[s.CHAIN_IDS.BASE]:"0x4200000000000000000000000000000000000006",[s.CHAIN_IDS.SEI]:"0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7"},n.ALLOWED_CONTRACT_ADDRESSES={[s.CHAIN_IDS.MAINNET]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.MAINNET],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.MAINNET]],[s.CHAIN_IDS.LOCALHOST]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.LOCALHOST],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.LOCALHOST]],[s.CHAIN_IDS.BSC]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.BSC],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.BSC]],[s.CHAIN_IDS.POLYGON]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.POLYGON],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.POLYGON]],[s.CHAIN_IDS.AVALANCHE]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.AVALANCHE],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.AVALANCHE]],[s.CHAIN_IDS.ARBITRUM]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.ARBITRUM],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.ARBITRUM]],[s.CHAIN_IDS.OPTIMISM]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.OPTIMISM],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.OPTIMISM]],[s.CHAIN_IDS.ZKSYNC_ERA]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.ZKSYNC_ERA],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.ZKSYNC_ERA]],[s.CHAIN_IDS.LINEA_MAINNET]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.LINEA_MAINNET],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.LINEA_MAINNET]],[s.CHAIN_IDS.BASE]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.BASE],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.BASE]],[s.CHAIN_IDS.SEI]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.SEI],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.SEI]]}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SYMBOL_TO_SLIP44_MAP=n.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=n.DEFAULT_TOKEN_ADDRESS=void 0;const s=e("@metamask/keyring-api"),r=e("./chains.cjs");n.DEFAULT_TOKEN_ADDRESS="0x0000000000000000000000000000000000000000";const o="AVAX",a="BNB",i="ETH",c="POL",d="TESTETH",l="SOL",u="SEI",m="BTC",h="TRX",p="MON",f={symbol:i,name:"Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},g={symbol:a,name:"Binance Coin",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},k={symbol:c,name:"Polygon",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},w={symbol:o,name:"Avalanche",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},_={symbol:d,name:"Test Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},b={symbol:i,name:"Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},y={symbol:i,name:"Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},E={...f},S={...f},A={...f},I={...f},T={...f},v={symbol:l,name:"Solana",address:n.DEFAULT_TOKEN_ADDRESS,decimals:9,iconUrl:""},C={symbol:m,name:"Bitcoin",address:n.DEFAULT_TOKEN_ADDRESS,decimals:8,iconUrl:""},x={symbol:u,name:"Sei",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},j={symbol:h,name:"Tron",address:n.DEFAULT_TOKEN_ADDRESS,decimals:6,iconUrl:""},N={symbol:p,name:"Mon",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""};n.SWAPS_CHAINID_DEFAULT_TOKEN_MAP={[r.CHAIN_IDS.MAINNET]:f,[r.CHAIN_IDS.LOCALHOST]:_,[r.CHAIN_IDS.BSC]:g,[r.CHAIN_IDS.POLYGON]:k,[r.CHAIN_IDS.GOERLI]:b,[r.CHAIN_IDS.SEPOLIA]:y,[r.CHAIN_IDS.AVALANCHE]:w,[r.CHAIN_IDS.OPTIMISM]:S,[r.CHAIN_IDS.ARBITRUM]:E,[r.CHAIN_IDS.ZKSYNC_ERA]:A,[r.CHAIN_IDS.LINEA_MAINNET]:I,[r.CHAIN_IDS.BASE]:T,[r.CHAIN_IDS.SEI]:x,[r.CHAIN_IDS.MONAD]:N,[s.SolScope.Mainnet]:v,[s.SolScope.Devnet]:v,[s.BtcScope.Mainnet]:C,[s.TrxScope.Mainnet]:j},n.SYMBOL_TO_SLIP44_MAP={SOL:"slip44:501",BTC:"slip44:0",ETH:"slip44:60",POL:"slip44:966",BNB:"slip44:714",AVAX:"slip44:9000",TESTETH:"slip44:60",SEI:"slip44:19000118",TRX:"slip44:195",MON:"slip44:268435779"}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.TraceName=void 0,function(e){e.BridgeQuotesFetched="Bridge Quotes Fetched",e.SwapQuotesFetched="Swap Quotes Fetched"}(s||(n.TraceName=s={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs",{"./bridge-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs","./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","./utils/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs","./utils/trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./utils/validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isValidQuoteRequest=n.isCrossChain=n.getDefaultBridgeControllerState=n.getNativeAssetForChainId=n.isNonEvmChainId=n.isBitcoinChainId=n.isSolanaChainId=n.isNativeAddress=n.isEthUsdt=n.MetricsSwapType=n.MetricsActionType=n.ALLOWED_CONTRACT_ADDRESSES=n.SWAPS_WRAPPED_TOKENS_ADDRESSES=n.SWAPS_CONTRACT_ADDRESSES=n.SWAPS_API_V2_BASE_URL=n.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=n.BRIDGE_PROD_API_BASE_URL=n.BRIDGE_DEV_API_BASE_URL=n.METABRIDGE_CHAIN_TO_ADDRESS_MAP=n.DEFAULT_BRIDGE_CONTROLLER_STATE=n.DEFAULT_MAX_REFRESH_COUNT=n.REFRESH_INTERVAL_MS=n.BRIDGE_MM_FEE_RATE=n.BRIDGE_PREFERRED_GAS_ESTIMATE=n.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=n.BRIDGE_QUOTE_MAX_ETA_SECONDS=n.BRIDGE_CONTROLLER_NAME=n.BridgeClientId=n.ALLOWED_BRIDGE_CHAIN_IDS=n.FeatureId=n.BridgeAssetSchema=n.ActionTypes=n.FeeType=n.BridgeBackgroundAction=n.BridgeUserAction=n.RequestStatus=n.ChainId=n.SortOrder=n.AssetType=n.StatusTypes=n.AbortReason=n.getQuotesReceivedProperties=n.isCustomSlippage=n.isHardwareWallet=n.getSwapType=n.getRequestParams=n.formatProviderLabel=n.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=n.UnifiedSwapBridgeEventName=n.BridgeController=void 0,n.fetchTokens=n.getSwapsContractAddress=n.isValidSwapsContractAddress=n.BRIDGE_DEFAULT_SLIPPAGE=n.getBridgeFeatureFlags=n.DEFAULT_FEATURE_FLAG_CONFIG=n.selectMinimumBalanceForRentExemptionInSOL=n.selectBridgeFeatureFlags=n.selectIsQuoteExpired=n.selectExchangeRateByChainIdAndAddress=n.selectDefaultSlippagePercentage=n.selectBridgeQuotes=n.isEvmTxData=n.isTronTrade=n.isBitcoinTrade=n.extractTradeData=n.formatAddressToAssetId=n.formatAddressToCaipReference=n.formatChainIdToHex=n.formatChainIdToCaip=n.getClientHeaders=n.fetchBridgeTokens=n.calcLatestSrcBalance=n.calcSlippagePercentage=n.formatEtaInMinutes=void 0;var s=e("./bridge-controller.cjs");Object.defineProperty(n,"BridgeController",{enumerable:!0,get:function(){return s.BridgeController}});var r=e("./utils/metrics/constants.cjs");Object.defineProperty(n,"UnifiedSwapBridgeEventName",{enumerable:!0,get:function(){return r.UnifiedSwapBridgeEventName}}),Object.defineProperty(n,"UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY",{enumerable:!0,get:function(){return r.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY}});var o=e("./utils/metrics/properties.cjs");Object.defineProperty(n,"formatProviderLabel",{enumerable:!0,get:function(){return o.formatProviderLabel}}),Object.defineProperty(n,"getRequestParams",{enumerable:!0,get:function(){return o.getRequestParams}}),Object.defineProperty(n,"getSwapType",{enumerable:!0,get:function(){return o.getSwapType}}),Object.defineProperty(n,"isHardwareWallet",{enumerable:!0,get:function(){return o.isHardwareWallet}}),Object.defineProperty(n,"isCustomSlippage",{enumerable:!0,get:function(){return o.isCustomSlippage}}),Object.defineProperty(n,"getQuotesReceivedProperties",{enumerable:!0,get:function(){return o.getQuotesReceivedProperties}});var a=e("./utils/metrics/constants.cjs");Object.defineProperty(n,"AbortReason",{enumerable:!0,get:function(){return a.AbortReason}});var i=e("./types.cjs");Object.defineProperty(n,"StatusTypes",{enumerable:!0,get:function(){return i.StatusTypes}});var c=e("./types.cjs");Object.defineProperty(n,"AssetType",{enumerable:!0,get:function(){return c.AssetType}}),Object.defineProperty(n,"SortOrder",{enumerable:!0,get:function(){return c.SortOrder}}),Object.defineProperty(n,"ChainId",{enumerable:!0,get:function(){return c.ChainId}}),Object.defineProperty(n,"RequestStatus",{enumerable:!0,get:function(){return c.RequestStatus}}),Object.defineProperty(n,"BridgeUserAction",{enumerable:!0,get:function(){return c.BridgeUserAction}}),Object.defineProperty(n,"BridgeBackgroundAction",{enumerable:!0,get:function(){return c.BridgeBackgroundAction}});var d=e("./utils/validators.cjs");Object.defineProperty(n,"FeeType",{enumerable:!0,get:function(){return d.FeeType}}),Object.defineProperty(n,"ActionTypes",{enumerable:!0,get:function(){return d.ActionTypes}}),Object.defineProperty(n,"BridgeAssetSchema",{enumerable:!0,get:function(){return d.BridgeAssetSchema}}),Object.defineProperty(n,"FeatureId",{enumerable:!0,get:function(){return d.FeatureId}});var l=e("./constants/bridge.cjs");Object.defineProperty(n,"ALLOWED_BRIDGE_CHAIN_IDS",{enumerable:!0,get:function(){return l.ALLOWED_BRIDGE_CHAIN_IDS}}),Object.defineProperty(n,"BridgeClientId",{enumerable:!0,get:function(){return l.BridgeClientId}}),Object.defineProperty(n,"BRIDGE_CONTROLLER_NAME",{enumerable:!0,get:function(){return l.BRIDGE_CONTROLLER_NAME}}),Object.defineProperty(n,"BRIDGE_QUOTE_MAX_ETA_SECONDS",{enumerable:!0,get:function(){return l.BRIDGE_QUOTE_MAX_ETA_SECONDS}}),Object.defineProperty(n,"BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE",{enumerable:!0,get:function(){return l.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE}}),Object.defineProperty(n,"BRIDGE_PREFERRED_GAS_ESTIMATE",{enumerable:!0,get:function(){return l.BRIDGE_PREFERRED_GAS_ESTIMATE}}),Object.defineProperty(n,"BRIDGE_MM_FEE_RATE",{enumerable:!0,get:function(){return l.BRIDGE_MM_FEE_RATE}}),Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return l.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_MAX_REFRESH_COUNT",{enumerable:!0,get:function(){return l.DEFAULT_MAX_REFRESH_COUNT}}),Object.defineProperty(n,"DEFAULT_BRIDGE_CONTROLLER_STATE",{enumerable:!0,get:function(){return l.DEFAULT_BRIDGE_CONTROLLER_STATE}}),Object.defineProperty(n,"METABRIDGE_CHAIN_TO_ADDRESS_MAP",{enumerable:!0,get:function(){return l.METABRIDGE_CHAIN_TO_ADDRESS_MAP}}),Object.defineProperty(n,"BRIDGE_DEV_API_BASE_URL",{enumerable:!0,get:function(){return l.BRIDGE_DEV_API_BASE_URL}}),Object.defineProperty(n,"BRIDGE_PROD_API_BASE_URL",{enumerable:!0,get:function(){return l.BRIDGE_PROD_API_BASE_URL}});var u=e("./constants/tokens.cjs");Object.defineProperty(n,"SWAPS_CHAINID_DEFAULT_TOKEN_MAP",{enumerable:!0,get:function(){return u.SWAPS_CHAINID_DEFAULT_TOKEN_MAP}});var m=e("./constants/swaps.cjs");Object.defineProperty(n,"SWAPS_API_V2_BASE_URL",{enumerable:!0,get:function(){return m.SWAPS_API_V2_BASE_URL}}),Object.defineProperty(n,"SWAPS_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return m.SWAPS_CONTRACT_ADDRESSES}}),Object.defineProperty(n,"SWAPS_WRAPPED_TOKENS_ADDRESSES",{enumerable:!0,get:function(){return m.SWAPS_WRAPPED_TOKENS_ADDRESSES}}),Object.defineProperty(n,"ALLOWED_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return m.ALLOWED_CONTRACT_ADDRESSES}});var h=e("./utils/metrics/constants.cjs");Object.defineProperty(n,"MetricsActionType",{enumerable:!0,get:function(){return h.MetricsActionType}}),Object.defineProperty(n,"MetricsSwapType",{enumerable:!0,get:function(){return h.MetricsSwapType}});var p=e("./utils/bridge.cjs");Object.defineProperty(n,"isEthUsdt",{enumerable:!0,get:function(){return p.isEthUsdt}}),Object.defineProperty(n,"isNativeAddress",{enumerable:!0,get:function(){return p.isNativeAddress}}),Object.defineProperty(n,"isSolanaChainId",{enumerable:!0,get:function(){return p.isSolanaChainId}}),Object.defineProperty(n,"isBitcoinChainId",{enumerable:!0,get:function(){return p.isBitcoinChainId}}),Object.defineProperty(n,"isNonEvmChainId",{enumerable:!0,get:function(){return p.isNonEvmChainId}}),Object.defineProperty(n,"getNativeAssetForChainId",{enumerable:!0,get:function(){return p.getNativeAssetForChainId}}),Object.defineProperty(n,"getDefaultBridgeControllerState",{enumerable:!0,get:function(){return p.getDefaultBridgeControllerState}}),Object.defineProperty(n,"isCrossChain",{enumerable:!0,get:function(){return p.isCrossChain}});var f=e("./utils/quote.cjs");Object.defineProperty(n,"isValidQuoteRequest",{enumerable:!0,get:function(){return f.isValidQuoteRequest}}),Object.defineProperty(n,"formatEtaInMinutes",{enumerable:!0,get:function(){return f.formatEtaInMinutes}}),Object.defineProperty(n,"calcSlippagePercentage",{enumerable:!0,get:function(){return f.calcSlippagePercentage}});var g=e("./utils/balance.cjs");Object.defineProperty(n,"calcLatestSrcBalance",{enumerable:!0,get:function(){return g.calcLatestSrcBalance}});var k=e("./utils/fetch.cjs");Object.defineProperty(n,"fetchBridgeTokens",{enumerable:!0,get:function(){return k.fetchBridgeTokens}}),Object.defineProperty(n,"getClientHeaders",{enumerable:!0,get:function(){return k.getClientHeaders}});var w=e("./utils/caip-formatters.cjs");Object.defineProperty(n,"formatChainIdToCaip",{enumerable:!0,get:function(){return w.formatChainIdToCaip}}),Object.defineProperty(n,"formatChainIdToHex",{enumerable:!0,get:function(){return w.formatChainIdToHex}}),Object.defineProperty(n,"formatAddressToCaipReference",{enumerable:!0,get:function(){return w.formatAddressToCaipReference}}),Object.defineProperty(n,"formatAddressToAssetId",{enumerable:!0,get:function(){return w.formatAddressToAssetId}});var _=e("./utils/trade-utils.cjs");Object.defineProperty(n,"extractTradeData",{enumerable:!0,get:function(){return _.extractTradeData}}),Object.defineProperty(n,"isBitcoinTrade",{enumerable:!0,get:function(){return _.isBitcoinTrade}}),Object.defineProperty(n,"isTronTrade",{enumerable:!0,get:function(){return _.isTronTrade}}),Object.defineProperty(n,"isEvmTxData",{enumerable:!0,get:function(){return _.isEvmTxData}});var b=e("./selectors.cjs");Object.defineProperty(n,"selectBridgeQuotes",{enumerable:!0,get:function(){return b.selectBridgeQuotes}}),Object.defineProperty(n,"selectDefaultSlippagePercentage",{enumerable:!0,get:function(){return b.selectDefaultSlippagePercentage}}),Object.defineProperty(n,"selectExchangeRateByChainIdAndAddress",{enumerable:!0,get:function(){return b.selectExchangeRateByChainIdAndAddress}}),Object.defineProperty(n,"selectIsQuoteExpired",{enumerable:!0,get:function(){return b.selectIsQuoteExpired}}),Object.defineProperty(n,"selectBridgeFeatureFlags",{enumerable:!0,get:function(){return b.selectBridgeFeatureFlags}}),Object.defineProperty(n,"selectMinimumBalanceForRentExemptionInSOL",{enumerable:!0,get:function(){return b.selectMinimumBalanceForRentExemptionInSOL}});var y=e("./constants/bridge.cjs");Object.defineProperty(n,"DEFAULT_FEATURE_FLAG_CONFIG",{enumerable:!0,get:function(){return y.DEFAULT_FEATURE_FLAG_CONFIG}});var E=e("./utils/feature-flags.cjs");Object.defineProperty(n,"getBridgeFeatureFlags",{enumerable:!0,get:function(){return E.getBridgeFeatureFlags}});var S=e("./utils/slippage.cjs");Object.defineProperty(n,"BRIDGE_DEFAULT_SLIPPAGE",{enumerable:!0,get:function(){return S.BRIDGE_DEFAULT_SLIPPAGE}});var A=e("./utils/swaps.cjs");Object.defineProperty(n,"isValidSwapsContractAddress",{enumerable:!0,get:function(){return A.isValidSwapsContractAddress}}),Object.defineProperty(n,"getSwapsContractAddress",{enumerable:!0,get:function(){return A.getSwapsContractAddress}}),Object.defineProperty(n,"fetchTokens",{enumerable:!0,get:function(){return A.fetchTokens}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",reselect:"/home/runner/work/metamask-extension/metamask-extension/node_modules/reselect/dist/cjs/reselect.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.selectDefaultSlippagePercentage=n.selectMinimumBalanceForRentExemptionInSOL=n.selectBridgeQuotes=n.selectIsQuoteExpired=n.selectIsAssetExchangeRateInState=n.selectExchangeRateByChainIdAndAddress=n.selectBridgeFeatureFlags=void 0;const s=e("@ethersproject/constants"),r=e("@metamask/utils"),o=e("bignumber.js"),a=e("lodash"),i=e("reselect"),c=e("./constants/bridge.cjs"),d=e("./types.cjs"),l=e("./utils/bridge.cjs"),u=e("./utils/caip-formatters.cjs"),m=e("./utils/feature-flags.cjs"),h=e("./utils/quote.cjs"),p=e("./utils/slippage.cjs"),f=i.createStructuredSelector.withTypes(),g=i.createSelector.withTypes(),k=i.createSelector.withTypes();n.selectBridgeFeatureFlags=k([e=>e.remoteFeatureFlags.bridgeConfig],e=>(0,m.processFeatureFlags)(e));const w=(e,t,n)=>{if(!t||!n)return{};const s=(0,u.formatAddressToAssetId)(n,t);if(!s)return{};const{assetExchangeRates:a,currencyRates:i,marketData:c,conversionRates:d}=e,m=a?.[s]??a?.[s.toLowerCase()];if(m?.exchangeRate)return m;if((0,l.isNonEvmChainId)(t)){const e=d?.[s];return e?{exchangeRate:e.rate,usdExchangeRate:undefined}:{}}if((0,l.isNativeAddress)(n)){const{symbol:e}=(0,l.getNativeAssetForChainId)(t),n=i?.[e];return n?{exchangeRate:n?.conversionRate?.toString(),usdExchangeRate:n?.usdConversionRate?.toString()}:{}}if(!(0,l.isNonEvmChainId)(t)){const e=c?.[(0,u.formatChainIdToHex)(t)],s=(0,r.isStrictHexString)(n)?e?.[n]:null,a=s?i[s?.currency]:undefined;if(s&&a)return{exchangeRate:new o.BigNumber(s.price).multipliedBy(a.conversionRate??0).toString(),usdExchangeRate:new o.BigNumber(s.price).multipliedBy(a.usdConversionRate??0).toString()}}return{}};n.selectExchangeRateByChainIdAndAddress=(e,t,n)=>w(e,t,n);n.selectIsAssetExchangeRateInState=(...e)=>Boolean(w(...e)?.exchangeRate)&&Boolean(w(...e)?.usdExchangeRate);const _=g([({quotes:e})=>e,f({estimatedBaseFeeInDecGwei:({gasFeeEstimates:e})=>e?.estimatedBaseFee,feePerGasInDecGwei:({gasFeeEstimates:e})=>e?.[c.BRIDGE_PREFERRED_GAS_ESTIMATE]?.suggestedMaxFeePerGas,maxFeePerGasInDecGwei:({gasFeeEstimates:e})=>e?.high?.suggestedMaxFeePerGas}),g([e=>e,({quoteRequest:{srcChainId:e}})=>e,({quoteRequest:{srcTokenAddress:e}})=>e],n.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{destChainId:e}})=>e,({quoteRequest:{destTokenAddress:e}})=>e],n.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{srcChainId:e}})=>e],(e,t)=>(0,n.selectExchangeRateByChainIdAndAddress)(e,t,s.AddressZero))],(e,t,n,s,r)=>e.map(e=>{const o=(0,h.calcSentAmount)(e.quote,n),a=(0,h.calcToAmount)(e.quote.destTokenAmount,e.quote.destAsset,s),i=(0,h.calcToAmount)(e.quote.minDestTokenAmount,e.quote.destAsset,s),c=(0,h.calcIncludedTxFees)(e.quote,n,s);let d,u,m,p;(0,l.isEvmQuoteResponse)(e)?(m=(0,h.calcRelayerFee)(e,r),p=(0,h.calcEstimatedAndMaxTotalGasFee)({bridgeQuote:e,...t,...r}),d=(0,h.calcTotalEstimatedNetworkFee)(p,m),u=(0,h.calcTotalMaxNetworkFee)(p,m)):(d=(0,h.calcNonEvmTotalNetworkFee)(e,r),p={effective:d,total:d,max:d},u=d);const f=(0,h.calcAdjustedReturn)(a,d,e.quote),g=(0,h.calcCost)(f,o);return{...e,sentAmount:o,toTokenAmount:a,minToTokenAmount:i,swapRate:(0,h.calcSwapRate)(o.amount,a.amount),totalNetworkFee:d,totalMaxNetworkFee:u,gasFee:p,adjustedReturn:f,cost:g,includedTxFees:c}})),b=g([_,(e,{sortOrder:t})=>t],(e,t)=>t===d.SortOrder.ETA_ASC?(0,a.orderBy)(e,e=>e.estimatedProcessingTimeInSeconds,"asc"):(0,a.orderBy)(e,({cost:e})=>e.valueInCurrency?Number(e.valueInCurrency):0,"asc")),y=g([b],e=>e.length>0?e[0]:null),E=g([y,(e,{selectedQuote:t})=>t],(e,t)=>t??e),S=g([n.selectBridgeFeatureFlags,e=>e.quoteRequest.insufficientBal,e=>e.quotesRefreshCount],(e,t,n)=>!t&&e.maxRefreshCount>n),A=g([n.selectBridgeFeatureFlags,e=>e.quoteRequest.srcChainId],(e,t)=>(t?e.chains[(0,u.formatChainIdToCaip)(t)]?.refreshRate:e.refreshRate)??e.refreshRate);n.selectIsQuoteExpired=g([S,({quotesLastFetched:e})=>e,A,(e,t,n)=>n],(e,t,n,s)=>Boolean(!e&&t&&s-t>n)),n.selectBridgeQuotes=f({sortedQuotes:b,recommendedQuote:y,activeQuote:E,quotesLastFetchedMs:e=>e.quotesLastFetched,isLoading:e=>e.quotesLoadingStatus===d.RequestStatus.LOADING,quoteFetchError:e=>e.quoteFetchError,quotesRefreshCount:e=>e.quotesRefreshCount,quotesInitialLoadTimeMs:e=>e.quotesInitialLoadTime,isQuoteGoingToRefresh:S});n.selectMinimumBalanceForRentExemptionInSOL=e=>new o.BigNumber(e.minimumBalanceForRentExemptionInLamports??0).div(10**9).toString(),n.selectDefaultSlippagePercentage=g([e=>(0,n.selectBridgeFeatureFlags)(e).chains,(e,t)=>t.srcTokenAddress,(e,t)=>t.destTokenAddress,(e,t)=>t.srcChainId?(0,u.formatChainIdToCaip)(t.srcChainId):undefined,(e,t)=>t.destChainId?(0,u.formatChainIdToCaip)(t.destChainId):undefined],(e,t,n,s,r)=>(0,p.getDefaultSlippagePercentage)({srcTokenAddress:t,destTokenAddress:n,srcChainId:s,destChainId:r},s?e[s]?.stablecoins:undefined,r?e[r]?.stablecoins:undefined))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d;Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeBackgroundAction=n.BridgeUserAction=n.RequestStatus=n.ChainId=n.StatusTypes=n.SortOrder=n.AssetType=void 0,function(e){e.native="NATIVE",e.token="TOKEN",e.NFT="NFT",e.unknown="UNKNOWN"}(s||(n.AssetType=s={})),function(e){e.COST_ASC="cost_ascending",e.ETA_ASC="time_descending"}(r||(n.SortOrder=r={})),function(e){e.UNKNOWN="UNKNOWN",e.FAILED="FAILED",e.PENDING="PENDING",e.COMPLETE="COMPLETE"}(o||(n.StatusTypes=o={})),function(e){e[e.ETH=1]="ETH",e[e.OPTIMISM=10]="OPTIMISM",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ZKSYNC=324]="ZKSYNC",e[e.BASE=8453]="BASE",e[e.ARBITRUM=42161]="ARBITRUM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.LINEA=59144]="LINEA",e[e.SOLANA=0x416edef1601be]="SOLANA",e[e.BTC=20000000000001]="BTC",e[e.TRON=728126428]="TRON",e[e.SEI=1329]="SEI",e[e.MONAD=143]="MONAD"}(a||(n.ChainId=a={})),function(e){e[e.LOADING=0]="LOADING",e[e.FETCHED=1]="FETCHED",e[e.ERROR=2]="ERROR"}(i||(n.RequestStatus=i={})),function(e){e.SELECT_DEST_NETWORK="selectDestNetwork",e.UPDATE_QUOTE_PARAMS="updateBridgeQuoteRequestParams"}(c||(n.BridgeUserAction=c={})),function(e){e.SET_CHAIN_INTERVAL_LENGTH="setChainIntervalLength",e.RESET_STATE="resetState",e.TRACK_METAMETRICS_EVENT="trackUnifiedSwapBridgeEvent",e.STOP_POLLING_FOR_QUOTES="stopPollingForQuotes",e.FETCH_QUOTES="fetchQuotes"}(d||(n.BridgeBackgroundAction=d={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.toExchangeRates=n.getAssetIdsForToken=void 0;const s=e("./bridge.cjs"),r=e("./caip-formatters.cjs");n.getAssetIdsForToken=(e,t)=>{const n=[],o=(0,r.formatAddressToAssetId)(e,t);return o&&(n.push(o),(0,s.getNativeAssetForChainId)(t)?.assetId&&n.push((0,s.getNativeAssetForChainId)(t).assetId)),n};n.toExchangeRates=(e,t)=>Object.entries(t).reduce((t,[n,s])=>(s&&(t[n]={exchangeRate:s[e],usdExchangeRate:s.usd}),t),{})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hasSufficientBalance=n.calcLatestSrcBalance=n.fetchTokenBalance=void 0;const s=e("@ethersproject/address"),r=e("@ethersproject/contracts"),o=e("@ethersproject/providers"),a=e("@metamask/metamask-eth-abis"),i=e("./bridge.cjs");n.fetchTokenBalance=async(e,t,n)=>{const s=new o.Web3Provider(n),i=new r.Contract(e,a.abiERC20,s),c="function"==typeof i?.balanceOf?i.balanceOf(t):Promise.resolve(undefined);return await c};n.calcLatestSrcBalance=async(e,t,r,a)=>{if(r&&a){if((0,i.isNativeAddress)(r)){const n=new o.Web3Provider(e);return await n.getBalance((0,s.getAddress)(t))}return await(0,n.fetchTokenBalance)(r,t,e)}return undefined};n.hasSufficientBalance=async(e,t,s,r,o)=>{const a=await(0,n.calcLatestSrcBalance)(e,t,s,o);return!!a&&a.gte(r)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isEvmQuoteResponse=n.isNonEvmChainId=n.isTronChainId=n.isBitcoinChainId=n.isSolanaChainId=n.isNativeAddress=n.isSwapsDefaultTokenSymbol=n.isSwapsDefaultTokenAddress=n.sumHexes=n.isEthUsdt=n.getEthUsdtResetData=n.getNativeAssetForChainId=n.getDefaultBridgeControllerState=n.isCrossChain=void 0;const s=e("@ethersproject/constants"),r=e("@ethersproject/contracts"),o=e("@metamask/keyring-api"),a=e("@metamask/metamask-eth-abis"),i=e("@metamask/utils"),c=e("./caip-formatters.cjs"),d=e("../constants/bridge.cjs"),l=e("../constants/chains.cjs"),u=e("../constants/swaps.cjs"),m=e("../constants/tokens.cjs"),h=e("../types.cjs");n.isCrossChain=(e,t)=>{try{return!!t&&(0,c.formatChainIdToCaip)(e)!==(0,c.formatChainIdToCaip)(t)}catch{return!1}};n.getDefaultBridgeControllerState=()=>d.DEFAULT_BRIDGE_CONTROLLER_STATE;const p=(e,t)=>`${(0,c.formatChainIdToCaip)(e)}/${m.SYMBOL_TO_SLIP44_MAP[t]}`;n.getNativeAssetForChainId=e=>{const t=(0,c.formatChainIdToCaip)(e),n=m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToCaip)(e)]??m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToHex)(e)];if(!n)throw new Error(`No XChain Swaps native asset found for chainId: ${e}`);return{...n,chainId:(0,c.formatChainIdToDec)(e),assetId:p(t,n.symbol)}};n.getEthUsdtResetData=e=>{const t=(0,n.isCrossChain)(l.CHAIN_IDS.MAINNET,e)?d.METABRIDGE_ETHEREUM_ADDRESS:u.SWAPS_CONTRACT_ADDRESSES[l.CHAIN_IDS.MAINNET];return new r.Contract(d.ETH_USDT_ADDRESS,a.abiERC20).interface.encodeFunctionData("approve",[t,"0"])};n.isEthUsdt=(e,t)=>(0,c.formatChainIdToDec)(e)===h.ChainId.ETH&&t.toLowerCase()===d.ETH_USDT_ADDRESS.toLowerCase();n.sumHexes=(...e)=>{if(0===e.length)return"0x0";return`0x${e.reduce((e,t)=>e+BigInt(t),BigInt(0)).toString(16)}`};n.isSwapsDefaultTokenAddress=(e,t)=>!(!e||!t)&&e===(0,n.getNativeAssetForChainId)(t)?.address;n.isSwapsDefaultTokenSymbol=(e,t)=>!(!e||!t)&&e===(0,n.getNativeAssetForChainId)(t)?.symbol;n.isNativeAddress=e=>e===s.AddressZero||""===e||!e||!(0,i.isStrictHexString)(e)&&Object.values(m.SYMBOL_TO_SLIP44_MAP).some(t=>e.includes(t)||t.endsWith(e));n.isSolanaChainId=e=>(0,i.isCaipChainId)(e)?e===o.SolScope.Mainnet.toString():e.toString()===h.ChainId.SOLANA.toString();n.isBitcoinChainId=e=>(0,i.isCaipChainId)(e)?e===o.BtcScope.Mainnet.toString():e.toString()===h.ChainId.BTC.toString();n.isTronChainId=e=>(0,i.isCaipChainId)(e)?e===o.TrxScope.Mainnet.toString():e.toString()===h.ChainId.TRON.toString();n.isNonEvmChainId=e=>(0,n.isSolanaChainId)(e)||(0,n.isBitcoinChainId)(e)||(0,n.isTronChainId)(e);n.isEvmQuoteResponse=e=>!(0,n.isNonEvmChainId)(e.quote.srcChainId)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/multichain-network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.formatAddressToAssetId=n.formatAddressToCaipReference=n.formatChainIdToHex=n.formatChainIdToDec=n.formatChainIdToCaip=void 0;const s=e("@ethersproject/address"),r=e("@ethersproject/constants"),o=e("@metamask/controller-utils"),a=e("@metamask/keyring-api"),i=e("@metamask/multichain-network-controller"),c=e("@metamask/utils"),d=e("./bridge.cjs"),l=e("../types.cjs");n.formatChainIdToCaip=e=>(0,c.isCaipChainId)(e)?e:(0,c.isStrictHexString)(e)?(0,i.toEvmCaipChainId)(e):(0,d.isSolanaChainId)(e)?a.SolScope.Mainnet:(0,d.isBitcoinChainId)(e)?a.BtcScope.Mainnet:(0,d.isTronChainId)(e)?a.TrxScope.Mainnet:(0,i.toEvmCaipChainId)((0,c.numberToHex)(Number(e)));n.formatChainIdToDec=e=>(0,c.isStrictHexString)(e)?(0,o.convertHexToDecimal)(e):e===a.SolScope.Mainnet?l.ChainId.SOLANA:e===a.BtcScope.Mainnet?l.ChainId.BTC:e===a.TrxScope.Mainnet?l.ChainId.TRON:(0,c.isCaipChainId)(e)?Number(e.split(":").at(-1)):"string"==typeof e?parseInt(e,10):e;n.formatChainIdToHex=e=>{if((0,c.isStrictHexString)(e))return e;if("number"==typeof e||parseInt(e,10))return(0,c.numberToHex)(Number(e));if((0,c.isCaipChainId)(e)){const{reference:t}=(0,c.parseCaipChainId)(e);if((0,c.isCaipReference)(t)&&!isNaN(Number(t)))return(0,c.numberToHex)(Number(t))}throw new Error(`Invalid cross-chain swaps chainId: ${e}`)};n.formatAddressToCaipReference=e=>{if((0,c.isStrictHexString)(e))return(0,s.getAddress)(e);if((0,d.isNativeAddress)(e))return r.AddressZero;const t=e.split(":").at(-1);if(!t)throw new Error("Invalid address");return t};n.formatAddressToAssetId=(e,t)=>(0,c.isCaipAssetType)(e)?e:(0,d.isNativeAddress)(e)?(0,d.getNativeAssetForChainId)(t).assetId:t===a.SolScope.Mainnet?c.CaipAssetTypeStruct.create(`${t}/token:${e}`):(0,c.isStrictHexString)(e)?c.CaipAssetTypeStruct.create(`${(0,n.formatChainIdToCaip)(t)}/erc20:${e}`):undefined}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hasMinimumRequiredVersion=n.getBridgeFeatureFlags=n.processFeatureFlags=n.formatFeatureFlags=void 0;const s=e("./caip-formatters.cjs"),r=e("./validators.cjs"),o=e("../constants/bridge.cjs");n.formatFeatureFlags=e=>{return{...e,chains:(t=e.chains,Object.entries(t).reduce((e,[t,n])=>({...e,[(0,s.formatChainIdToCaip)(t)]:n}),{}))};var t};n.processFeatureFlags=e=>(0,r.validateFeatureFlagsResponse)(e)?(0,n.formatFeatureFlags)(e):o.DEFAULT_FEATURE_FLAG_CONFIG,n.getBridgeFeatureFlags=function(e){const t=e.call("RemoteFeatureFlagController:getState"),s=t?.remoteFeatureFlags?.bridgeConfigV2,r=t?.remoteFeatureFlags?.bridgeConfig;return(0,n.processFeatureFlags)(s||r)};n.hasMinimumRequiredVersion=(e,t)=>{const[n,s,r]=e.split(".").map(Number),[o,a,i]=t.split(".").map(Number);return n>o||(n===o&&s>a||n===o&&s===a&&r>=i)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.fetchServerEvents=void 0;n.fetchServerEvents=async(e,{onMessage:t,onError:n,onClose:s,fetchFn:r,...o})=>{let a;try{const n=await r(e,o);if(!n.ok||!n.body)throw new Error(`${n.status}`);a=n.body.getReader();const i=new TextDecoder("utf-8");let c="";for(;;){const{done:e,value:n}=await a.read();if(e)break;c+=i.decode(n,{stream:!0});const s=c.split("\n\n");c=s.pop()||"";for(const e of s){const n=e.split("\n");let s;const r=[];for(const e of n)e.startsWith("event:")?s=e.slice(6).trim():e.startsWith("data:")&&r.push(e.slice(5).trim());if("error"===s)throw new Error(`Bridge-api error: ${r.join("\n")}`);if(r.length>0){const e=JSON.parse(r.join("\n"));await t(e,s)}}}await(s?.())}catch(e){n?.(e)}finally{try{await(a?.cancel())}catch(e){console.error("Error cleaning up stream reader",e)}}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./fetch-server-events.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.fetchBridgeQuoteStream=n.fetchAssetPrices=n.fetchBridgeQuotes=n.fetchBridgeTokens=n.getClientHeaders=void 0;const s=e("@metamask/superstruct"),r=e("./bridge.cjs"),o=e("./caip-formatters.cjs"),a=e("./fetch-server-events.cjs"),i=e("./trade-utils.cjs"),c=e("./validators.cjs");n.getClientHeaders=(e,t)=>({"X-Client-Id":e,...t?{"Client-Version":t}:{}}),n.fetchBridgeTokens=async function(e,t,s,r,a){const i=`${r}/getTokens?chainId=${(0,o.formatChainIdToDec)(e)}`,d=await s(i,{headers:(0,n.getClientHeaders)(t,a)}),l={};return d.forEach(e=>{(0,c.validateSwapsTokenObject)(e)&&(l[e.address]=e)}),l};const d=e=>{const t=e.destWalletAddress??e.walletAddress,n={walletAddress:(0,o.formatAddressToCaipReference)(e.walletAddress),destWalletAddress:(0,o.formatAddressToCaipReference)(t),srcChainId:(0,o.formatChainIdToDec)(e.srcChainId),destChainId:(0,o.formatChainIdToDec)(e.destChainId),srcTokenAddress:(0,o.formatAddressToCaipReference)(e.srcTokenAddress),destTokenAddress:(0,o.formatAddressToCaipReference)(e.destTokenAddress),srcTokenAmount:e.srcTokenAmount,insufficientBal:Boolean(e.insufficientBal),resetApproval:Boolean(e.resetApproval),gasIncluded:Boolean(e.gasIncluded),gasIncluded7702:Boolean(e.gasIncluded7702)};e.slippage!==undefined&&(n.slippage=e.slippage),e.fee!==undefined&&(n.fee=e.fee),e.aggIds&&e.aggIds.length>0&&(n.aggIds=e.aggIds),e.bridgeIds&&e.bridgeIds.length>0&&(n.bridgeIds=e.bridgeIds);const s=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{s.append(e,t.toString())}),s};n.fetchBridgeQuotes=async function(e,t,o,a,l,u,m){const h=`${l}/getQuote?${d(e)}`,p=await a(h,{headers:(0,n.getClientHeaders)(o,m),signal:t}),f=new Set([]),g=p.filter(e=>{try{return(0,c.validateQuoteResponse)(e)}catch(t){return t instanceof s.StructError&&t.failures().forEach(({branch:t,path:n})=>{const s=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||e?.quote?.bridgeId||e?.quote?.bridges?.[0]||"unknown",r=n?.join(".")||"unknown";f.add([s,r].join("|"))}),!1}}).map(t=>({...t,featureId:u??undefined,resetApproval:e.resetApproval&&t.approval&&(0,i.isEvmTxData)(t.approval)?{...t.approval,data:(0,r.getEthUsdtResetData)(e.destChainId)}:undefined})),k=Array.from(f);return f.size>0&&console.warn("Quote validation failed",k),{quotes:g,validationFailures:k}};n.fetchAssetPrices=async e=>{const{currencies:t,...s}=e,r=await Promise.allSettled(Array.from(t).map(async e=>await(async e=>{const{currency:t,assetIds:s,clientId:r,clientVersion:o,fetchFn:a,signal:i}=e,c=Array.from(s).filter(Boolean);if(0===c.length)return{};const d=`https://price.api.cx.metamask.io/v3/spot-prices?${new URLSearchParams({assetIds:c.filter(Boolean).join(","),vsCurrency:t})}`,l=await a(d,{headers:(0,n.getClientHeaders)(r,o),signal:i});return l&&"object"==typeof l?Object.entries(l).reduce((e,[n,s])=>s?(e[n]||(e[n]={}),s[t]&&(e[n][t]=s[t].toString()),e):e,{}):{}})({...s,currency:e}))).then(e=>e.reduce((e,t)=>("fulfilled"===t.status&&Object.entries(t.value).forEach(([t,n])=>{e[t]||(e[t]={}),Object.entries(n).forEach(([n,s])=>{e[t][n]=s})}),e),{}));return r},n.fetchBridgeQuoteStream=async function(e,t,o,l,u,m,h){const p=`${u}/getQuoteStream?${d(t)}`;await(0,a.fetchServerEvents)(p,{headers:{...(0,n.getClientHeaders)(l,h),"Content-Type":"text/event-stream"},signal:o,onMessage:async e=>{const n=new Set([]);try{if((0,c.validateQuoteResponse)(e))return await m.onValidQuoteReceived({...e,resetApproval:t.resetApproval&&e.approval&&(0,i.isEvmTxData)(e.approval)?{...e.approval,data:(0,r.getEthUsdtResetData)(t.destChainId)}:undefined})}catch(t){t instanceof s.StructError&&t.failures().forEach(({branch:t,path:s})=>{const r=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||e?.quote?.bridgeId||e?.quote?.bridges?.[0]||"unknown",o=s?.join(".")||"unknown";n.add([r,o].join("|"))});const r=Array.from(n);if(n.size>0)return console.warn("Quote validation failed",r),m.onValidationFailure(r);throw t}return undefined},onError:e=>{throw e},onClose:async()=>{await m.onClose()},fetchFn:e})}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i;Object.defineProperty(n,"__esModule",{value:!0}),n.MetricsSwapType=n.MetricsActionType=n.MetaMetricsSwapsEventSource=n.AbortReason=n.UnifiedSwapBridgeEventName=n.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=void 0,n.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY="Unified SwapBridge",function(e){e.ButtonClicked="Unified SwapBridge Button Clicked",e.PageViewed="Unified SwapBridge Page Viewed",e.InputChanged="Unified SwapBridge Input Changed",e.InputSourceDestinationSwitched="Unified SwapBridge Source Destination Switched",e.QuotesRequested="Unified SwapBridge Quotes Requested",e.QuotesReceived="Unified SwapBridge Quotes Received",e.QuotesError="Unified SwapBridge Quotes Error",e.Submitted="Unified SwapBridge Submitted",e.Completed="Unified SwapBridge Completed",e.Failed="Unified SwapBridge Failed",e.AllQuotesOpened="Unified SwapBridge All Quotes Opened",e.AllQuotesSorted="Unified SwapBridge All Quotes Sorted",e.QuoteSelected="Unified SwapBridge Quote Selected",e.AssetDetailTooltipClicked="Unified SwapBridge Asset Detail Tooltip Clicked",e.QuotesValidationFailed="Unified SwapBridge Quotes Failed Validation",e.StatusValidationFailed="Unified SwapBridge Status Failed Validation"}(s||(n.UnifiedSwapBridgeEventName=s={})),function(e){e.NewQuoteRequest="New Quote Request",e.QuoteRequestUpdated="Quote Request Updated",e.ResetState="Reset controller state",e.TransactionSubmitted="Transaction submitted"}(r||(n.AbortReason=r={})),function(e){e.MainView="Main View",e.TokenView="Token View"}(o||(n.MetaMetricsSwapsEventSource=o={})),function(e){e.CROSSCHAIN_V1="crosschain-v1",e.SWAPBRIDGE_V1="swapbridge-v1"}(a||(n.MetricsActionType=a={})),function(e){e.SINGLE="single_chain",e.CROSSCHAIN="crosschain"}(i||(n.MetricsSwapType=i={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs",{"../../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","../bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","../caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getQuotesReceivedProperties=n.isCustomSlippage=n.isHardwareWallet=n.getRequestParams=n.formatProviderLabel=n.getSwapTypeFromQuote=n.getSwapType=n.toInputChangedPropertyValue=n.toInputChangedPropertyKey=void 0;const s=e("./constants.cjs"),r=e("../../constants/bridge.cjs"),o=e("../../types.cjs"),a=e("../bridge.cjs"),i=e("../caip-formatters.cjs");n.toInputChangedPropertyKey={srcTokenAddress:"token_source",destTokenAddress:"token_destination",srcChainId:"chain_source",destChainId:"chain_destination",slippage:"slippage"},n.toInputChangedPropertyValue={srcTokenAddress:({srcTokenAddress:e,srcChainId:t})=>t?(0,i.formatAddressToAssetId)(e??"",t):undefined,destTokenAddress:({destTokenAddress:e,destChainId:t})=>t?(0,i.formatAddressToAssetId)(e??"",t):undefined,srcChainId:({srcChainId:e})=>e?(0,i.formatChainIdToCaip)(e):undefined,destChainId:({destChainId:e})=>e?(0,i.formatChainIdToCaip)(e):undefined,slippage:({slippage:e})=>e?Number(e):e};n.getSwapType=(e,t)=>e&&!(0,a.isCrossChain)(e,t??e)?s.MetricsSwapType.SINGLE:s.MetricsSwapType.CROSSCHAIN;n.getSwapTypeFromQuote=e=>(0,n.getSwapType)(e.srcChainId,e.destChainId);n.formatProviderLabel=({bridgeId:e,bridges:t})=>`${e}_${t[0]}`;n.getRequestParams=({srcChainId:e,destChainId:t,srcTokenAddress:n,destTokenAddress:s})=>{const r=(0,i.formatChainIdToCaip)(e??o.ChainId.ETH);return{chain_id_source:r,chain_id_destination:t?(0,i.formatChainIdToCaip)(t):null,token_address_source:n?(0,i.formatAddressToAssetId)(n,r)??(0,a.getNativeAssetForChainId)(r)?.assetId??null:(0,a.getNativeAssetForChainId)(r)?.assetId??null,token_address_destination:s?(0,i.formatAddressToAssetId)(s,t??r)??null:null}};n.isHardwareWallet=e=>e?.metadata?.keyring.type?.includes("Hardware")??!1;n.isCustomSlippage=e=>e!==r.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;n.getQuotesReceivedProperties=(e,t=[],s=!0,r)=>{const o=e?(0,n.formatProviderLabel)(e.quote):"_";return{can_submit:s,gas_included:Boolean(e?.quote?.gasIncluded),gas_included_7702:Boolean(e?.quote?.gasIncluded7702),quoted_time_minutes:e?.estimatedProcessingTimeInSeconds?e.estimatedProcessingTimeInSeconds/60:0,usd_quoted_gas:Number(e?.gasFee?.effective?.usd??0),usd_quoted_return:Number(e?.toTokenAmount?.usd??0),best_quote_provider:r?(0,n.formatProviderLabel)(r.quote):o,provider:o,warnings:t,price_impact:Number(e?.quote.priceData?.priceImpact??0)}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.appendFeesToQuotes=void 0;const s=e("@metamask/utils"),r=e("./bridge.cjs"),o=e("./caip-formatters.cjs"),a=e("./snaps.cjs"),i=e("./trade-utils.cjs"),c=e("../constants/chains.cjs");n.appendFeesToQuotes=async(e,t,n,d)=>{const l=await(async(e,t)=>{if(e.some(({quote:e})=>{const t=(0,o.formatChainIdToCaip)(e.srcChainId);return![c.CHAIN_IDS.OPTIMISM,c.CHAIN_IDS.BASE].map(o.formatChainIdToCaip).includes(t)}))return undefined;const n=Promise.allSettled(e.map(async e=>{const{quote:n,trade:o,approval:a}=e,i=(0,s.numberToHex)(n.srcChainId),c=e=>({from:e.from,to:e.to,value:e.value,data:e.data,gasLimit:e.gasLimit?.toString()}),d=a?await t({transactionParams:c(a),chainId:i}):"0x0",l=await t({transactionParams:c(o),chainId:i});return d===undefined||l===undefined?undefined:{...e,l1GasFeesInHexWei:(0,r.sumHexes)(d,l)}}));return(await n).reduce((e,t)=>("fulfilled"===t.status&&t.value?e.push(t.value):"rejected"===t.status&&console.error("Error calculating L1 gas fees for quote",t.reason),e),[])})(e,n),u=await(async(e,t,n)=>{if(e.some(({quote:{srcChainId:e}})=>!(0,r.isNonEvmChainId)(e)))return undefined;const s=Promise.allSettled(e.map(async e=>{const{trade:s,quote:r}=e;if(!n?.metadata?.snap?.id||!s)return e;try{const c=(0,o.formatChainIdToCaip)(r.srcChainId),d=(0,i.extractTradeData)(s),l=(0,i.isTronTrade)(s)?{visible:s.visible,type:s.raw_data?.contract?.[0]?.type,feeLimit:s.raw_data?.fee_limit}:undefined,u=await t.call("SnapController:handleRequest",(0,a.computeFeeRequest)(n?.metadata?.snap?.id,d,n?.id,c,l)),m=u?.find(e=>"base"===e.type)||u?.find(e=>"priority"===e.type)||u?.[0],h=m?.asset?.amount||"0";return{...e,nonEvmFeesInNative:h}}catch(t){return console.error(`Failed to compute non-EVM fees for quote ${r.requestId}:`,t),{...e,nonEvmFeesInNative:undefined}}}));return(await s).reduce((e,t)=>("fulfilled"===t.status&&t.value&&e.push(t.value),e),[])})(e,t,d);return l??u??e}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sortQuotes=n.formatEtaInMinutes=n.calcSlippagePercentage=n.calcCost=n.calcSwapRate=n.calcAdjustedReturn=n.calcIncludedTxFees=n.calcTotalMaxNetworkFee=n.calcTotalEstimatedNetworkFee=n.calcEstimatedAndMaxTotalGasFee=n.calcRelayerFee=n.calcSentAmount=n.calcToAmount=n.calcNonEvmTotalNetworkFee=n.getQuoteIdentifier=n.isValidQuoteRequest=void 0;const s=e("@metamask/controller-utils"),r=e("bignumber.js"),o=e("./bridge.cjs"),a=e("./validators.cjs");n.isValidQuoteRequest=(e,t=!0)=>{const n=["srcTokenAddress","destTokenAddress","srcChainId","destChainId","walletAddress"];if(t&&n.push("srcTokenAmount"),e.destChainId&&e.srcChainId&&e.destChainId!==e.srcChainId&&((0,o.isNonEvmChainId)(e.destChainId)||(0,o.isNonEvmChainId)(e.srcChainId))&&(n.push("destWalletAddress"),!e.destWalletAddress))return!1;const s=[];return e.slippage!==undefined&&s.push("slippage"),n.every(t=>t in e&&"string"==typeof e[t]&&e[t]!==undefined&&""!==e[t]&&null!==e[t])&&s.every(t=>t in e&&"number"==typeof e[t]&&e[t]!==undefined&&!isNaN(Number(e[t]))&&null!==e[t])&&(!t||Boolean((e.srcTokenAmount??"").match(/^[1-9]\d*$/u)))};n.getQuoteIdentifier=e=>`${e.bridgeId}-${e.bridges[0]}-${e.steps.length}`;const i=(e,t)=>{const n=new r.BigNumber(10).pow(t??0);return new r.BigNumber(e).div(n)};n.calcNonEvmTotalNetworkFee=(e,{exchangeRate:t,usdExchangeRate:n})=>{const{nonEvmFeesInNative:s}=e,o=new r.BigNumber(s??"0");return{amount:o.toString(),valueInCurrency:t?o.times(t).toString():null,usd:n?o.times(n).toString():null}};n.calcToAmount=(e,t,{exchangeRate:n,usdExchangeRate:s})=>{const r=i(e,t.decimals);return{amount:r.toString(),valueInCurrency:n?r.times(n).toString():null,usd:s?r.times(s).toString():null}};n.calcSentAmount=({srcTokenAmount:e,srcAsset:t,feeData:n},{exchangeRate:s,usdExchangeRate:o})=>{const a=Object.values(n).filter(e=>e&&e.amount&&e.asset?.assetId===t.assetId).reduce((e,{amount:t})=>e.plus(t),new r.BigNumber(e)),c=i(a,t.decimals);return{amount:c.toString(),valueInCurrency:s?c.times(s).toString():null,usd:o?c.times(o).toString():null}};n.calcRelayerFee=(e,{exchangeRate:t,usdExchangeRate:a})=>{const{quote:c,trade:d}=e,l=new r.BigNumber((0,s.convertHexToDecimal)(d.value||"0x0"));let u=i(l,18);if((0,o.isNativeAddress)(c.srcAsset.address)){const e=(0,n.calcSentAmount)(c,{exchangeRate:t,usdExchangeRate:a}).amount;u=u.minus(e)}return{amount:u,valueInCurrency:t?u.times(t):null,usd:a?u.times(a):null}};const c=({approvalGasLimit:e,resetApprovalGasLimit:t,tradeGasLimit:n,l1GasFeesInHexWei:o,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:c})=>{const d=new r.BigNumber(n?.toString()??"0").plus(e?.toString()??"0").plus(t?.toString()??"0"),l=(0,s.weiHexToGweiDec)((0,s.toHex)(o??"0")),u=d.times(a).plus(l).times(new r.BigNumber(10).pow(-9)),m=i?u.times(i.toString()):null,h=c?u.times(c.toString()):null;return{amount:u.toString(),valueInCurrency:m?.toString()??null,usd:h?.toString()??null}};n.calcEstimatedAndMaxTotalGasFee=({bridgeQuote:{approval:e,trade:t,l1GasFeesInHexWei:n,resetApproval:s},estimatedBaseFeeInDecGwei:r,maxFeePerGasInDecGwei:o,feePerGasInDecGwei:a,exchangeRate:i,usdExchangeRate:d})=>{const{amount:l,valueInCurrency:u,usd:m}=c({approvalGasLimit:e?.effectiveGas??e?.gasLimit,resetApprovalGasLimit:s?.effectiveGas??s?.gasLimit,tradeGasLimit:t?.effectiveGas??t?.gasLimit,l1GasFeesInHexWei:n,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:d}),{amount:h,valueInCurrency:p,usd:f}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:s?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:n,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:d}),{amount:g,valueInCurrency:k,usd:w}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:s?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:n,feePerGasInDecGwei:o,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:d});return{effective:{amount:l,valueInCurrency:u,usd:m},total:{amount:h,valueInCurrency:p,usd:f},max:{amount:g,valueInCurrency:k,usd:w}}};n.calcTotalEstimatedNetworkFee=({total:e},t)=>({amount:new r.BigNumber(e?.amount??"0").plus(t.amount).toString(),valueInCurrency:e?.valueInCurrency?new r.BigNumber(e.valueInCurrency).plus(t.valueInCurrency||"0").toString():null,usd:e?.usd?new r.BigNumber(e.usd).plus(t.usd||"0").toString():null});n.calcTotalMaxNetworkFee=(e,t)=>({amount:new r.BigNumber(e.max.amount).plus(t.amount).toString(),valueInCurrency:e.max.valueInCurrency?new r.BigNumber(e.max.valueInCurrency).plus(t.valueInCurrency||"0").toString():null,usd:e.max.usd?new r.BigNumber(e.max.usd).plus(t.usd||"0").toString():null});n.calcIncludedTxFees=({gasIncluded:e,gasIncluded7702:t,srcAsset:n,feeData:{txFee:s}},r,o)=>{if(!s||!e&&!t)return null;const{exchangeRate:a,usdExchangeRate:c}=s.asset.assetId===n.assetId?r:o,d=i(s.amount,s.asset.decimals);return{amount:d.toString(),valueInCurrency:a?d.times(a).toString():null,usd:c?d.times(c).toString():null}};n.calcAdjustedReturn=(e,t,{feeData:{txFee:n},destAsset:{assetId:s}})=>n?.asset?.assetId===s?{valueInCurrency:e.valueInCurrency,usd:e.usd}:{valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new r.BigNumber(e.valueInCurrency).minus(t.valueInCurrency).toString():null,usd:e.usd&&t.usd?new r.BigNumber(e.usd).minus(t.usd).toString():null};n.calcSwapRate=(e,t)=>new r.BigNumber(t).div(e).toString();n.calcCost=(e,t)=>({valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new r.BigNumber(t.valueInCurrency).minus(e.valueInCurrency).toString():null,usd:e.usd&&t.usd?new r.BigNumber(t.usd).minus(e.usd).toString():null});n.calcSlippagePercentage=(e,t)=>{const s=(0,n.calcCost)(e,t);return s.valueInCurrency&&t.valueInCurrency?new r.BigNumber(s.valueInCurrency).div(t.valueInCurrency).times(100).abs().toString():s.usd&&t.usd?new r.BigNumber(s.usd).div(t.usd).times(100).abs().toString():null};n.formatEtaInMinutes=e=>e<60?"< 1":(e/60).toFixed();n.sortQuotes=(e,t)=>t===a.FeatureId.PERPS?e.sort((e,t)=>e.estimatedProcessingTimeInSeconds-t.estimatedProcessingTimeInSeconds):e}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getDefaultSlippagePercentage=n.BRIDGE_DEFAULT_SLIPPAGE=void 0;const s=e("./bridge.cjs");n.BRIDGE_DEFAULT_SLIPPAGE=.5;const r=undefined;n.getDefaultSlippagePercentage=({srcTokenAddress:e,destTokenAddress:t,srcChainId:o,destChainId:a},i,c)=>!o||(0,s.isCrossChain)(o,a)?n.BRIDGE_DEFAULT_SLIPPAGE:(0,s.isSolanaChainId)(o)?r:e&&t&&i?.map(e=>e.toLowerCase()).includes(e.toLowerCase())&&(c??i)?.map(e=>e.toLowerCase()).includes(t.toLowerCase())?.5:2}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.computeFeeRequest=n.getMinimumBalanceForRentExemptionInLamports=n.getMinimumBalanceForRentExemptionRequest=void 0;const s=e("@metamask/keyring-api"),r=e("uuid"),o=e("../constants/bridge.cjs");n.getMinimumBalanceForRentExemptionRequest=e=>({snapId:e,origin:"metamask",handler:"onProtocolRequest",request:{method:" ",jsonrpc:"2.0",params:{scope:s.SolScope.Mainnet,request:{id:(0,r.v4)(),jsonrpc:"2.0",method:"getMinimumBalanceForRentExemption",params:[0,{commitment:"confirmed"}]}}}});n.getMinimumBalanceForRentExemptionInLamports=async(e,t)=>String(await t.call("SnapController:handleRequest",(0,n.getMinimumBalanceForRentExemptionRequest)(e)).catch(e=>(console.error("Error setting minimum balance for rent exemption",e),o.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports)));n.computeFeeRequest=(e,t,n,s,o)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,r.v4)(),jsonrpc:"2.0",method:"computeFee",params:{transaction:t,accountId:n,scope:s,...o&&{options:o}}}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.fetchTokens=n.DEV_BASE_URL=n.API_BASE_URL=n.getSwapsContractAddress=n.isValidSwapsContractAddress=void 0;const s=e("./caip-formatters.cjs"),r=e("../constants/chains.cjs"),o=e("../constants/swaps.cjs"),a=e("../constants/tokens.cjs");function i(e){return e?{"X-Client-Id":e}:undefined}n.isValidSwapsContractAddress=function(e,t){return!(!t||!o.ALLOWED_CONTRACT_ADDRESSES[e])&&o.ALLOWED_CONTRACT_ADDRESSES[e].some(e=>t.toLowerCase()===e.toLowerCase())},n.getSwapsContractAddress=function(e){return o.SWAPS_CONTRACT_ADDRESSES[e]},n.API_BASE_URL="https://swap.api.cx.metamask.io",n.DEV_BASE_URL="https://swap.dev-api.cx.metamask.io",n.fetchTokens=async function(e,t,o){const[c,d]=e===r.CHAIN_IDS.LOCALHOST?[r.CHAIN_IDS.MAINNET,n.DEV_BASE_URL]:[e,n.API_BASE_URL],l=`${d}/networks/${(0,s.formatChainIdToDec)(c)}/tokens`,u=(await t(l,{headers:i(o)})).filter(e=>e.address!==a.DEFAULT_TOKEN_ADDRESS),m=a.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[e];return u.push(m),u}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs",{buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.extractTradeData=n.isTronTrade=n.isBitcoinTrade=n.isEvmTxData=void 0;n.isEvmTxData=e=>"object"==typeof e&&null!==e&&"data"in e&&"chainId"in e&&"to"in e;n.isBitcoinTrade=e=>"object"==typeof e&&null!==e&&"unsignedPsbtBase64"in e;n.isTronTrade=e=>"object"==typeof e&&null!==e&&"raw_data_hex"in e;n.extractTradeData=t=>(0,n.isBitcoinTrade)(t)?t.unsignedPsbtBase64:(0,n.isTronTrade)(t)?e.from(t.raw_data_hex,"hex").toString("base64"):"string"==typeof t?t:(0,n.isEvmTxData)(t)?t.data:""}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateQuoteResponse=n.QuoteResponseSchema=n.TronTradeDataSchema=n.BitcoinTradeDataSchema=n.TxDataSchema=n.QuoteSchema=n.StepSchema=n.ProtocolSchema=n.FeeDataSchema=n.validateSwapsTokenObject=n.validateFeatureFlagsResponse=n.PlatformConfigSchema=n.PriceImpactThresholdSchema=n.ChainConfigurationSchema=n.BridgeAssetSchema=n.truthyString=n.ActionTypes=n.FeatureId=n.FeeType=void 0;const s=e("@metamask/controller-utils"),r=e("@metamask/superstruct"),o=e("@metamask/utils");var a,i,c;!function(e){e.METABRIDGE="metabridge",e.REFUEL="refuel",e.TX_FEE="txFee"}(a||(n.FeeType=a={})),function(e){e.PERPS="perps"}(i||(n.FeatureId=i={})),function(e){e.BRIDGE="bridge",e.SWAP="swap",e.REFUEL="refuel"}(c||(n.ActionTypes=c={}));const d=(0,r.define)("HexAddress",e=>(0,s.isValidHexAddress)(e,{allowNonPrefixed:!1})),l=(0,r.define)("HexString",e=>(0,o.isStrictHexString)(e)),u=(0,r.define)("VersionString",e=>"string"==typeof e&&/^(\d+\.*){2}\d+$/u.test(e)&&3===e.split(".").length);n.truthyString=e=>Boolean(e?.length);const m=(0,r.pattern)((0,r.string)(),/^\d+$/u),h=(0,r.number)();n.BridgeAssetSchema=(0,r.type)({chainId:h,address:(0,r.string)(),assetId:o.CaipAssetTypeStruct,symbol:(0,r.string)(),name:(0,r.string)(),decimals:(0,r.number)(),icon:(0,r.optional)((0,r.nullable)((0,r.string)())),iconUrl:(0,r.optional)((0,r.nullable)((0,r.string)()))});const p=(0,r.type)({standard:(0,r.record)((0,r.string)(),(0,r.string)()),other:(0,r.record)((0,r.string)(),(0,r.string)())});n.ChainConfigurationSchema=(0,r.type)({isActiveSrc:(0,r.boolean)(),isActiveDest:(0,r.boolean)(),refreshRate:(0,r.optional)((0,r.number)()),topAssets:(0,r.optional)((0,r.array)((0,r.string)())),stablecoins:(0,r.optional)((0,r.array)((0,r.string)())),isUnifiedUIEnabled:(0,r.optional)((0,r.boolean)()),isSingleSwapBridgeButtonEnabled:(0,r.optional)((0,r.boolean)()),isGaslessSwapEnabled:(0,r.optional)((0,r.boolean)()),noFeeAssets:(0,r.optional)((0,r.array)((0,r.string)())),defaultPairs:(0,r.optional)(p)}),n.PriceImpactThresholdSchema=(0,r.type)({gasless:(0,r.number)(),normal:(0,r.number)()});const f=(0,r.type)({aggIds:(0,r.optional)((0,r.array)((0,r.string)())),bridgeIds:(0,r.optional)((0,r.array)((0,r.string)())),fee:(0,r.optional)((0,r.number)())}),g=(0,r.enums)(Object.values(i));n.PlatformConfigSchema=(0,r.type)({priceImpactThreshold:(0,r.optional)(n.PriceImpactThresholdSchema),quoteRequestOverrides:(0,r.optional)((0,r.record)(g,(0,r.optional)(f))),minimumVersion:(0,r.string)(),refreshRate:(0,r.number)(),maxRefreshCount:(0,r.number)(),support:(0,r.boolean)(),chains:(0,r.record)((0,r.string)(),n.ChainConfigurationSchema),bip44DefaultPairs:(0,r.optional)((0,r.record)((0,r.string)(),(0,r.optional)(p))),sse:(0,r.optional)((0,r.type)({enabled:(0,r.boolean)(),minimumVersion:u}))});n.validateFeatureFlagsResponse=e=>(0,r.is)(e,n.PlatformConfigSchema);n.validateSwapsTokenObject=e=>(0,r.is)(e,n.BridgeAssetSchema),n.FeeDataSchema=(0,r.type)({amount:m,asset:n.BridgeAssetSchema}),n.ProtocolSchema=(0,r.type)({name:(0,r.string)(),displayName:(0,r.optional)((0,r.string)()),icon:(0,r.optional)((0,r.string)())}),n.StepSchema=(0,r.type)({action:(0,r.enums)(Object.values(c)),srcChainId:h,destChainId:(0,r.optional)(h),srcAsset:n.BridgeAssetSchema,destAsset:n.BridgeAssetSchema,srcAmount:(0,r.string)(),destAmount:(0,r.string)(),protocol:n.ProtocolSchema});const k=n.StepSchema;n.QuoteSchema=(0,r.type)({requestId:(0,r.string)(),srcChainId:h,srcAsset:n.BridgeAssetSchema,srcTokenAmount:(0,r.string)(),destChainId:h,destAsset:n.BridgeAssetSchema,destTokenAmount:(0,r.string)(),minDestTokenAmount:(0,r.string)(),feeData:(0,r.type)({[a.METABRIDGE]:n.FeeDataSchema,[a.TX_FEE]:(0,r.optional)((0,r.intersection)([n.FeeDataSchema,(0,r.type)({maxFeePerGas:(0,r.string)(),maxPriorityFeePerGas:(0,r.string)()})]))}),gasIncluded:(0,r.optional)((0,r.boolean)()),gasIncluded7702:(0,r.optional)((0,r.boolean)()),bridgeId:(0,r.string)(),bridges:(0,r.array)((0,r.string)()),steps:(0,r.array)(n.StepSchema),refuel:(0,r.optional)(k),priceData:(0,r.optional)((0,r.type)({totalFromAmountUsd:(0,r.optional)((0,r.string)()),totalToAmountUsd:(0,r.optional)((0,r.string)()),priceImpact:(0,r.optional)((0,r.string)()),totalFeeAmountUsd:(0,r.optional)((0,r.string)())})),gasSponsored:(0,r.optional)((0,r.boolean)())}),n.TxDataSchema=(0,r.type)({chainId:(0,r.number)(),to:d,from:d,value:l,data:l,gasLimit:(0,r.nullable)((0,r.number)()),effectiveGas:(0,r.optional)((0,r.number)())}),n.BitcoinTradeDataSchema=(0,r.type)({unsignedPsbtBase64:(0,r.string)(),inputsToSign:(0,r.nullable)((0,r.array)((0,r.type)({})))}),n.TronTradeDataSchema=(0,r.type)({raw_data_hex:(0,r.string)(),visible:(0,r.optional)((0,r.boolean)()),raw_data:(0,r.optional)((0,r.nullable)((0,r.type)({contract:(0,r.optional)((0,r.array)((0,r.type)({type:(0,r.optional)((0,r.string)())})))})))}),n.QuoteResponseSchema=(0,r.type)({quote:n.QuoteSchema,estimatedProcessingTimeInSeconds:(0,r.number)(),approval:(0,r.optional)((0,r.union)([n.TxDataSchema,n.TronTradeDataSchema])),trade:(0,r.union)([n.TxDataSchema,n.BitcoinTradeDataSchema,n.TronTradeDataSchema,(0,r.string)()])});n.validateQuoteResponse=e=>((0,r.assert)(e,n.QuoteResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkController/MultichainNetworkController.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},h=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.MultichainNetworkController=void 0;const p=e("@metamask/base-controller"),f=e("@metamask/keyring-api"),g=e("@metamask/utils"),k=e("../api/accounts-api.cjs"),w=e("../constants.cjs"),_=e("../types.cjs"),b=e("../utils.cjs");class y extends p.BaseController{constructor({messenger:e,state:t,networkService:n}){super({messenger:e,name:_.MULTICHAIN_NETWORK_CONTROLLER_NAME,metadata:w.MULTICHAIN_NETWORK_CONTROLLER_METADATA,state:{...(0,w.getDefaultMultichainNetworkControllerState)(),...t,multichainNetworkConfigurationsByChainId:w.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS}}),s.add(this),r.set(this,void 0),m(this,r,n,"f"),h(this,s,"m",l).call(this),h(this,s,"m",u).call(this)}async setActiveNetwork(e){if((0,g.isCaipChainId)(e)){if(!(0,b.checkIfSupportedCaipChainId)(e))throw new Error(`Unsupported Caip chain ID: ${String(e)}`);return h(this,s,"m",a).call(this,e)}return await h(this,s,"m",o).call(this,e)}async getNetworksWithTransactionActivityByAccounts(){const e=this.messenger.call("AccountsController:listMultichainAccounts").filter(e=>(0,f.isEvmAccountType)(e.type));if(!e||0===e.length)return this.state.networksWithTransactionActivity;const t=e.map(e=>(0,k.toAllowedCaipAccountIds)(e)).flat(),n=await h(this,r,"f").fetchNetworkActivity(t),s=(0,k.toActiveNetworksByAddress)(n);return this.update(e=>{e.networksWithTransactionActivity=s}),this.state.networksWithTransactionActivity}async removeNetwork(e){return(0,b.isEvmCaipChainId)(e)?await h(this,s,"m",i).call(this,e):h(this,s,"m",c).call(this,e)}}n.MultichainNetworkController=y,r=new WeakMap,s=new WeakSet,o=async function(e){const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),n=!this.state.isEvmSelected,s=e!==t;(n||s)&&(n&&this.update(e=>{e.isEvmSelected=!0}),s&&await this.messenger.call("NetworkController:setActiveNetwork",e),(n||s)&&this.messenger.publish("MultichainNetworkController:networkDidChange",e))},a=function(e){(e!==this.state.selectedMultichainNetworkChainId||this.state.isEvmSelected)&&(this.update(t=>{t.selectedMultichainNetworkChainId=e,t.isEvmSelected=!1}),this.messenger.publish("MultichainNetworkController:networkDidChange",e))},i=async function(e){const t=(0,b.convertEvmCaipToHexChainId)(e);if(this.messenger.call("NetworkController:getSelectedChainId")===t){if(this.state.isEvmSelected)throw new Error("Cannot remove the currently selected network");const e="0x1",t=this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);await this.messenger.call("NetworkController:setActiveNetwork",t)}this.messenger.call("NetworkController:removeNetwork",t)},c=function(e){throw new Error("Removal of non-EVM networks is not supported")},d=function(e){const{type:t,scopes:n}=e;if((0,f.isEvmAccountType)(t)){if(this.state.isEvmSelected)return;return void this.update(e=>{e.isEvmSelected=!0})}if(n.includes(this.state.selectedMultichainNetworkChainId))return void this.update(e=>{e.isEvmSelected=!1});const s=(0,b.getChainIdForNonEvm)(n);this.update(e=>{e.selectedMultichainNetworkChainId=s,e.isEvmSelected=!1})},l=function(){this.messenger.subscribe("AccountsController:selectedAccountChange",e=>h(this,s,"m",d).call(this,e))},u=function(){this.messenger.registerActionHandler("MultichainNetworkController:setActiveNetwork",this.setActiveNetwork.bind(this)),this.messenger.registerActionHandler("MultichainNetworkController:getNetworksWithTransactionActivityByAccounts",this.getNetworksWithTransactionActivityByAccounts.bind(this))}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkController/MultichainNetworkController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkService/MultichainNetworkService.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.MultichainNetworkService=void 0;const d=e("@metamask/superstruct"),l=e("lodash"),u=e("../api/accounts-api.cjs");n.MultichainNetworkService=class{constructor({fetch:e,batchSize:t}){s.add(this),r.set(this,void 0),o.set(this,void 0),i(this,r,e,"f"),i(this,o,t??20,"f")}async fetchNetworkActivity(e){if(0===e.length)return{activeNetworks:[]};if(e.length<=c(this,o,"f"))return c(this,s,"m",a).call(this,e);const t=(0,l.chunk)(e,c(this,o,"f"));return{activeNetworks:(await Promise.all(t.map(e=>c(this,s,"m",a).call(this,e)))).flatMap(e=>e.activeNetworks)}}},r=new WeakMap,o=new WeakMap,s=new WeakSet,a=async function(e){try{const t=(0,u.buildActiveNetworksUrl)(e),n=await c(this,r,"f").call(this,t.toString(),{method:"GET",headers:{[u.MULTICHAIN_ACCOUNTS_CLIENT_HEADER]:u.MULTICHAIN_ACCOUNTS_CLIENT_ID,Accept:"application/json"}});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const s=await n.json();return(0,d.assert)(s,u.ActiveNetworksResponseStruct),s}catch(e){if(e instanceof Error){if("AbortError"===e.name)throw new Error("Request timeout: Failed to fetch active networks");throw e}throw new Error(`Failed to fetch active networks: ${String(e)}`)}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkService/MultichainNetworkService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs",{"@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.buildActiveNetworksUrl=n.toActiveNetworksByAddress=n.toAllowedCaipAccountIds=n.MULTICHAIN_ALLOWED_ACTIVE_NETWORK_SCOPES=n.MULTICHAIN_ACCOUNTS_CLIENT_ID=n.MULTICHAIN_ACCOUNTS_CLIENT_HEADER=n.MULTICHAIN_ACCOUNTS_BASE_URL=n.ActiveNetworksResponseStruct=void 0;const s=e("@metamask/keyring-api"),r=e("@metamask/superstruct"),o=e("@metamask/utils");n.ActiveNetworksResponseStruct=(0,r.object)({activeNetworks:(0,r.array)(o.CaipAccountIdStruct)}),n.MULTICHAIN_ACCOUNTS_BASE_URL="https://accounts.api.cx.metamask.io",n.MULTICHAIN_ACCOUNTS_CLIENT_HEADER="x-metamask-clientproduct",n.MULTICHAIN_ACCOUNTS_CLIENT_ID="metamask-multichain-network-controller",n.MULTICHAIN_ALLOWED_ACTIVE_NETWORK_SCOPES=[String(s.BtcScope.Mainnet),String(s.BtcScope.Testnet),String(s.BtcScope.Testnet4),String(s.BtcScope.Signet),String(s.BtcScope.Regtest),String(s.SolScope.Mainnet),String(s.SolScope.Devnet),String(s.EthScope.Mainnet),String(s.EthScope.Testnet),String(s.EthScope.Eoa),String(s.TrxScope.Mainnet),String(s.TrxScope.Nile),String(s.TrxScope.Shasta)],n.toAllowedCaipAccountIds=function(e){const t=[];for(const s of e.scopes)n.MULTICHAIN_ALLOWED_ACTIVE_NETWORK_SCOPES.includes(s)&&t.push(`${s}:${e.address}`);return t},n.toActiveNetworksByAddress=function(e){const t={};return e.activeNetworks.forEach(e=>{const{address:n,chain:{namespace:s,reference:r}}=(0,o.parseCaipAccountId)(e);t[n]||(t[n]={namespace:s,activeChains:[]}),t[n].activeChains.push(r)}),t},n.buildActiveNetworksUrl=function(e){const t=new URL(`${n.MULTICHAIN_ACCOUNTS_BASE_URL}/v2/activeNetworks`);return t.searchParams.append("accountIds",e.join(",")),t}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs",{"@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MULTICHAIN_NETWORK_DECIMAL_PLACES=n.MULTICHAIN_NETWORK_TICKER=n.MULTICHAIN_NETWORK_CONTROLLER_METADATA=n.getDefaultMultichainNetworkControllerState=n.NETWORKS_METADATA=n.NON_EVM_TESTNET_IDS=n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS=n.TRX_SHASTA_NATIVE_ASSET=n.TRX_NILE_NATIVE_ASSET=n.TRX_NATIVE_ASSET=n.SOL_DEVNET_NATIVE_ASSET=n.SOL_TESTNET_NATIVE_ASSET=n.SOL_NATIVE_ASSET=n.BTC_REGTEST_NATIVE_ASSET=n.BTC_SIGNET_NATIVE_ASSET=n.BTC_TESTNET4_NATIVE_ASSET=n.BTC_TESTNET_NATIVE_ASSET=n.BTC_NATIVE_ASSET=void 0;const s=e("@metamask/keyring-api"),r=e("@metamask/network-controller");n.BTC_NATIVE_ASSET=`${s.BtcScope.Mainnet}/slip44:0`,n.BTC_TESTNET_NATIVE_ASSET=`${s.BtcScope.Testnet}/slip44:0`,n.BTC_TESTNET4_NATIVE_ASSET=`${s.BtcScope.Testnet4}/slip44:0`,n.BTC_SIGNET_NATIVE_ASSET=`${s.BtcScope.Signet}/slip44:0`,n.BTC_REGTEST_NATIVE_ASSET=`${s.BtcScope.Regtest}/slip44:0`,n.SOL_NATIVE_ASSET=`${s.SolScope.Mainnet}/slip44:501`,n.SOL_TESTNET_NATIVE_ASSET=`${s.SolScope.Testnet}/slip44:501`,n.SOL_DEVNET_NATIVE_ASSET=`${s.SolScope.Devnet}/slip44:501`,n.TRX_NATIVE_ASSET=`${s.TrxScope.Mainnet}/slip44:195`,n.TRX_NILE_NATIVE_ASSET=`${s.TrxScope.Nile}/slip44:195`,n.TRX_SHASTA_NATIVE_ASSET=`${s.TrxScope.Shasta}/slip44:195`,n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS={[s.BtcScope.Mainnet]:{chainId:s.BtcScope.Mainnet,name:"Bitcoin",nativeCurrency:n.BTC_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Testnet]:{chainId:s.BtcScope.Testnet,name:"Bitcoin Testnet",nativeCurrency:n.BTC_TESTNET_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Testnet4]:{chainId:s.BtcScope.Testnet4,name:"Bitcoin Testnet4",nativeCurrency:n.BTC_TESTNET4_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Signet]:{chainId:s.BtcScope.Signet,name:"Bitcoin Mutinynet",nativeCurrency:n.BTC_SIGNET_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Regtest]:{chainId:s.BtcScope.Regtest,name:"Bitcoin Regtest",nativeCurrency:n.BTC_REGTEST_NATIVE_ASSET,isEvm:!1},[s.SolScope.Mainnet]:{chainId:s.SolScope.Mainnet,name:"Solana",nativeCurrency:n.SOL_NATIVE_ASSET,isEvm:!1},[s.SolScope.Testnet]:{chainId:s.SolScope.Testnet,name:"Solana Testnet",nativeCurrency:n.SOL_TESTNET_NATIVE_ASSET,isEvm:!1},[s.SolScope.Devnet]:{chainId:s.SolScope.Devnet,name:"Solana Devnet",nativeCurrency:n.SOL_DEVNET_NATIVE_ASSET,isEvm:!1},[s.TrxScope.Mainnet]:{chainId:s.TrxScope.Mainnet,name:"Tron",nativeCurrency:n.TRX_NATIVE_ASSET,isEvm:!1},[s.TrxScope.Nile]:{chainId:s.TrxScope.Nile,name:"Tron Nile",nativeCurrency:n.TRX_NILE_NATIVE_ASSET,isEvm:!1},[s.TrxScope.Shasta]:{chainId:s.TrxScope.Shasta,name:"Tron Shasta",nativeCurrency:n.TRX_SHASTA_NATIVE_ASSET,isEvm:!1}},n.NON_EVM_TESTNET_IDS=[s.BtcScope.Testnet,s.BtcScope.Testnet4,s.BtcScope.Signet,s.BtcScope.Regtest,s.SolScope.Testnet,s.SolScope.Devnet,s.TrxScope.Nile,s.TrxScope.Shasta],n.NETWORKS_METADATA={[s.BtcScope.Mainnet]:{features:[],status:r.NetworkStatus.Available},[s.SolScope.Mainnet]:{features:[],status:r.NetworkStatus.Available},[s.TrxScope.Mainnet]:{features:[],status:r.NetworkStatus.Available}};n.getDefaultMultichainNetworkControllerState=()=>({multichainNetworkConfigurationsByChainId:n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS,selectedMultichainNetworkChainId:s.SolScope.Mainnet,isEvmSelected:!0,networksWithTransactionActivity:{}}),n.MULTICHAIN_NETWORK_CONTROLLER_METADATA={multichainNetworkConfigurationsByChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},selectedMultichainNetworkChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},isEvmSelected:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},networksWithTransactionActivity:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}},n.MULTICHAIN_NETWORK_TICKER={[s.BtcScope.Mainnet]:"BTC",[s.BtcScope.Testnet]:"tBTC",[s.BtcScope.Testnet4]:"tBTC",[s.BtcScope.Signet]:"sBTC",[s.BtcScope.Regtest]:"rBTC",[s.SolScope.Mainnet]:"SOL",[s.SolScope.Testnet]:"tSOL",[s.SolScope.Devnet]:"dSOL",[s.TrxScope.Mainnet]:"TRX",[s.TrxScope.Nile]:"tTRX",[s.TrxScope.Shasta]:"sTRX"},n.MULTICHAIN_NETWORK_DECIMAL_PLACES={[s.BtcScope.Mainnet]:8,[s.BtcScope.Testnet]:8,[s.BtcScope.Testnet4]:8,[s.BtcScope.Signet]:8,[s.BtcScope.Regtest]:8,[s.SolScope.Mainnet]:5,[s.SolScope.Testnet]:5,[s.SolScope.Devnet]:5,[s.TrxScope.Mainnet]:6,[s.TrxScope.Nile]:6,[s.TrxScope.Shasta]:6}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/index.cjs",{"./MultichainNetworkController/MultichainNetworkController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkController/MultichainNetworkController.cjs","./MultichainNetworkService/MultichainNetworkService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkService/MultichainNetworkService.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.toEvmCaipChainId=n.toMultichainNetworkConfigurationsByChainId=n.toMultichainNetworkConfiguration=n.checkIfSupportedCaipChainId=n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS=n.MULTICHAIN_NETWORK_DECIMAL_PLACES=n.MULTICHAIN_NETWORK_TICKER=n.NON_EVM_TESTNET_IDS=n.getDefaultMultichainNetworkControllerState=n.MultichainNetworkService=n.MultichainNetworkController=void 0;var s=e("./MultichainNetworkController/MultichainNetworkController.cjs");Object.defineProperty(n,"MultichainNetworkController",{enumerable:!0,get:function(){return s.MultichainNetworkController}});var r=e("./MultichainNetworkService/MultichainNetworkService.cjs");Object.defineProperty(n,"MultichainNetworkService",{enumerable:!0,get:function(){return r.MultichainNetworkService}});var o=e("./constants.cjs");Object.defineProperty(n,"getDefaultMultichainNetworkControllerState",{enumerable:!0,get:function(){return o.getDefaultMultichainNetworkControllerState}}),Object.defineProperty(n,"NON_EVM_TESTNET_IDS",{enumerable:!0,get:function(){return o.NON_EVM_TESTNET_IDS}}),Object.defineProperty(n,"MULTICHAIN_NETWORK_TICKER",{enumerable:!0,get:function(){return o.MULTICHAIN_NETWORK_TICKER}}),Object.defineProperty(n,"MULTICHAIN_NETWORK_DECIMAL_PLACES",{enumerable:!0,get:function(){return o.MULTICHAIN_NETWORK_DECIMAL_PLACES}}),Object.defineProperty(n,"AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS",{enumerable:!0,get:function(){return o.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS}});var a=e("./utils.cjs");Object.defineProperty(n,"checkIfSupportedCaipChainId",{enumerable:!0,get:function(){return a.checkIfSupportedCaipChainId}}),Object.defineProperty(n,"toMultichainNetworkConfiguration",{enumerable:!0,get:function(){return a.toMultichainNetworkConfiguration}}),Object.defineProperty(n,"toMultichainNetworkConfigurationsByChainId",{enumerable:!0,get:function(){return a.toMultichainNetworkConfigurationsByChainId}}),Object.defineProperty(n,"toEvmCaipChainId",{enumerable:!0,get:function(){return a.toEvmCaipChainId}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MULTICHAIN_NETWORK_CONTROLLER_NAME=void 0,n.MULTICHAIN_NETWORK_CONTROLLER_NAME="MultichainNetworkController"}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isKnownCaipNamespace=n.toMultichainNetworkConfigurationsByChainId=n.toMultichainNetworkConfiguration=n.convertEvmCaipToHexChainId=n.toEvmCaipChainId=n.checkIfSupportedCaipChainId=n.getChainIdForNonEvm=n.isEvmCaipChainId=void 0;const s=e("@metamask/utils"),r=e("./constants.cjs");n.isEvmCaipChainId=function(e){const{namespace:t}=(0,s.parseCaipChainId)(e);return t===s.KnownCaipNamespace.Eip155},n.getChainIdForNonEvm=function(e){const t=e.find(e=>Object.keys(r.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS).includes(e));if(t)return t;throw new Error(`Unsupported scope: ${e.join(", ")}.`)},n.checkIfSupportedCaipChainId=function(e){return Object.keys(r.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS).includes(e)};n.toEvmCaipChainId=e=>(0,s.toCaipChainId)(s.KnownCaipNamespace.Eip155,(0,s.hexToNumber)(e).toString()),n.convertEvmCaipToHexChainId=function(e){const{namespace:t,reference:n}=(0,s.parseCaipChainId)(e);if(t===s.KnownCaipNamespace.Eip155)return(0,s.add0x)(parseInt(n,10).toString(16));throw new Error(`Unsupported CAIP chain ID namespace: ${t}. Only eip155 is supported.`)};n.toMultichainNetworkConfiguration=e=>{const{chainId:t,name:s,rpcEndpoints:r,defaultRpcEndpointIndex:o,nativeCurrency:a,blockExplorerUrls:i,defaultBlockExplorerUrlIndex:c=0}=e;return{chainId:(0,n.toEvmCaipChainId)(t),isEvm:!0,name:s||r[o].url,nativeCurrency:a,blockExplorerUrls:i,defaultBlockExplorerUrlIndex:c}};n.toMultichainNetworkConfigurationsByChainId=e=>Object.entries(e).reduce((e,[,t])=>({...e,[(0,n.toEvmCaipChainId)(t.chainId)]:(0,n.toMultichainNetworkConfiguration)(t)}),{}),n.isKnownCaipNamespace=function(e){return Object.values(s.KnownCaipNamespace).includes(e)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/NetworkController.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs","./create-auto-managed-network-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-auto-managed-network-client.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/swappable-obj-proxy":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/swappable-obj-proxy/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","fast-deep-equal":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-deep-equal/index.js",immer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/immer/dist/index.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",reselect:"/home/runner/work/metamask-extension/metamask-extension/node_modules/reselect/dist/cjs/reselect.cjs","uri-js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/uri-js/dist/es5/uri.all.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m,h,p,f,g,k,w,_,b,y,E,S,A,I,T,v,C,x,j,N,O=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),R=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),D=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&O(t,e,n);return R(t,e),t},P=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},M=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},B=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NetworkController=n.selectAvailableNetworkClientIds=n.getAvailableNetworkClientIds=n.selectNetworkConfigurations=n.getNetworkConfigurations=n.getDefaultNetworkControllerState=n.knownKeysOf=n.RpcEndpointType=void 0;const L=e("@metamask/base-controller"),F=e("@metamask/controller-utils"),U=B(e("@metamask/eth-query")),H=e("@metamask/rpc-errors"),q=e("@metamask/swappable-obj-proxy"),G=e("@metamask/utils"),$=B(e("fast-deep-equal")),W=e("immer"),K=e("lodash"),V=e("reselect"),Y=D(e("uri-js")),Q=e("uuid"),z=e("./constants.cjs"),J=e("./create-auto-managed-network-client.cjs"),X=e("./logger.cjs"),Z=e("./types.cjs"),ee=(0,X.createModuleLogger)(X.projectLogger,"NetworkController"),te=/^https:\/\/(?<networkName>[^.]+)\.infura\.io\/v\d+\/(?<apiKey>.+)$/u;var ne;function se(e){return Object.keys(e)}!function(e){e.Custom="custom",e.Infura="infura"}(ne||(n.RpcEndpointType=ne={})),n.knownKeysOf=se;const re="NetworkController";function oe(e=[]){const t=Object.values(F.InfuraNetworkType).reduce((e,t)=>{const n=F.ChainId[t];if(z.DEPRECATED_NETWORKS.has(n))return e;const s=`https://${t}.infura.io/v3/{infuraProjectId}`,r={blockExplorerUrls:[],chainId:n,defaultRpcEndpointIndex:0,name:F.NetworkNickname[t],nativeCurrency:F.NetworksTicker[t],rpcEndpoints:[{failoverUrls:[],networkClientId:t,type:ne.Infura,url:s}]};return{...e,[n]:r}},{}),n={[F.ChainId["megaeth-testnet"]]:ae(F.CustomNetworkType["megaeth-testnet"]),[F.ChainId["megaeth-testnet-v2"]]:ae(F.CustomNetworkType["megaeth-testnet-v2"]),[F.ChainId["monad-testnet"]]:ae(F.CustomNetworkType["monad-testnet"])};return e.reduce((e,t)=>((0,G.hasProperty)(n,t)&&(e[t]=n[t]),e),t)}function ae(e){const{ticker:t,rpcPrefs:n}=F.BUILT_IN_NETWORKS[e],s=F.BUILT_IN_CUSTOM_NETWORKS_RPC[e];return{blockExplorerUrls:[n.blockExplorerUrl],chainId:F.ChainId[e],defaultRpcEndpointIndex:0,defaultBlockExplorerUrlIndex:0,name:F.NetworkNickname[e],nativeCurrency:t,rpcEndpoints:[{failoverUrls:[],networkClientId:e,type:ne.Custom,url:s}]}}function ie(e){const t=oe(e);return{selectedNetworkClientId:F.InfuraNetworkType.mainnet,networksMetadata:{},networkConfigurationsByChainId:t}}n.getDefaultNetworkControllerState=ie;function ce(e){return Object.values(e.networkConfigurationsByChainId)}function de(e){return e.flatMap(e=>e.rpcEndpoints.map(e=>e.networkClientId))}function le(e){const t=Y.parse(e);return t.error===undefined&&("http"===t.scheme||"https"===t.scheme)}function ue(e){const t=te.exec(e);if(t?.groups){if((0,F.isInfuraNetworkType)(t.groups.networkName))return t.groups.networkName;throw new Error(`Unknown Infura network '${t.groups.networkName}'`)}throw new Error("Could not derive Infura network from RPC endpoint URL")}function me(e){return new Map(Object.values(e).flatMap(e=>e.rpcEndpoints.map(t=>[t.networkClientId,e])))}n.getNetworkConfigurations=ce,n.selectNetworkConfigurations=(0,V.createSelector)(e=>e.networkConfigurationsByChainId,e=>Object.values(e)),n.getAvailableNetworkClientIds=de,n.selectAvailableNetworkClientIds=(0,V.createSelector)(n.selectNetworkConfigurations,de);class he extends L.BaseController{constructor(e){const{messenger:t,state:n,infuraProjectId:g,log:k,getRpcServiceOptions:w,getBlockTrackerOptions:_,additionalDefaultNetworks:b,isRpcFailoverEnabled:E=!1}=e,S={...ie(b),...n};!function(e){const t=Object.entries(e.networkConfigurationsByChainId),n=de(ce(e));if(0===t.length)throw new Error("NetworkController state is invalid: `networkConfigurationsByChainId` cannot be empty");for(const[e,n]of t){if(e!==n.chainId)throw new Error(`NetworkController state has invalid \`networkConfigurationsByChainId\`: Network configuration '${n.name}' is filed under '${e}' which does not match its \`chainId\` of '${n.chainId}'`);if(n.blockExplorerUrls.length>0?n.defaultBlockExplorerUrlIndex===undefined||n.blockExplorerUrls[n.defaultBlockExplorerUrlIndex]===undefined:n.defaultBlockExplorerUrlIndex!==undefined)throw new Error(`NetworkController state has invalid \`networkConfigurationsByChainId\`: Network configuration '${n.name}' has a \`defaultBlockExplorerUrlIndex\` that does not refer to an entry in \`blockExplorerUrls\``);if(n.rpcEndpoints[n.defaultRpcEndpointIndex]===undefined)throw new Error(`NetworkController state has invalid \`networkConfigurationsByChainId\`: Network configuration '${n.name}' has a \`defaultRpcEndpointIndex\` that does not refer to an entry in \`rpcEndpoints\``)}if([...new Set(n)].length<n.length)throw new Error("NetworkController state has invalid `networkConfigurationsByChainId`: Every RPC endpoint across all network configurations must have a unique `networkClientId`")}(S);const A=function(e,t){const n=ce(e).sort((e,t)=>e.chainId.localeCompare(t.chainId)),s=de(n),r=Object.keys(e.networksMetadata).filter(e=>!s.includes(e));return(0,W.produce)(e,o=>{if(!s.includes(e.selectedNetworkClientId)){const s=n[0],r=s.rpcEndpoints[s.defaultRpcEndpointIndex].networkClientId;t.captureException?.(new Error(`\`selectedNetworkClientId\` '${e.selectedNetworkClientId}' does not refer to an RPC endpoint within a network configuration; correcting to '${r}'`)),o.selectedNetworkClientId=r}if(r.length>0){for(const e of r)delete o.networksMetadata[e];t.captureException?.(new Error("`networksMetadata` had invalid network client IDs, which have been removed"))}})}(S,t);if(!g||"string"!=typeof g)throw new Error("Invalid Infura project ID");super({name:re,metadata:{selectedNetworkClientId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},networksMetadata:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},networkConfigurationsByChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},messenger:t,state:A}),s.add(this),r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,void 0),m.set(this,void 0),h.set(this,void 0),p.set(this,void 0),f.set(this,void 0),P(this,o,g,"f"),P(this,u,k,"f"),P(this,m,w,"f"),P(this,h,_,"f"),P(this,f,E,"f"),P(this,a,this.state.selectedNetworkClientId,"f"),P(this,p,me(this.state.networkConfigurationsByChainId),"f"),this.messenger.registerActionHandler(`${this.name}:getEthQuery`,()=>M(this,r,"f")),this.messenger.registerActionHandler(`${this.name}:getNetworkClientById`,this.getNetworkClientById.bind(this)),this.messenger.registerActionHandler(`${this.name}:getEIP1559Compatibility`,this.getEIP1559Compatibility.bind(this)),this.messenger.registerActionHandler(`${this.name}:setActiveNetwork`,this.setActiveNetwork.bind(this)),this.messenger.registerActionHandler(`${this.name}:setProviderType`,this.setProviderType.bind(this)),this.messenger.registerActionHandler(`${this.name}:findNetworkClientIdByChainId`,this.findNetworkClientIdByChainId.bind(this)),this.messenger.registerActionHandler(`${this.name}:getNetworkConfigurationByChainId`,this.getNetworkConfigurationByChainId.bind(this)),this.messenger.registerActionHandler(`${this.name}:getNetworkConfigurationByNetworkClientId`,this.getNetworkConfigurationByNetworkClientId.bind(this)),this.messenger.registerActionHandler(`${this.name}:getSelectedNetworkClient`,this.getSelectedNetworkClient.bind(this)),this.messenger.registerActionHandler(`${this.name}:getSelectedChainId`,this.getSelectedChainId.bind(this)),this.messenger.registerActionHandler(`${this.name}:addNetwork`,this.addNetwork.bind(this)),this.messenger.registerActionHandler(`${this.name}:removeNetwork`,this.removeNetwork.bind(this)),this.messenger.registerActionHandler(`${this.name}:updateNetwork`,this.updateNetwork.bind(this)),this.messenger.subscribe(`${this.name}:rpcEndpointChainUnavailable`,({networkClientId:e})=>{M(this,s,"m",y).call(this,e,{networkStatus:z.NetworkStatus.Unavailable})}),this.messenger.subscribe(`${this.name}:rpcEndpointChainDegraded`,({networkClientId:e})=>{M(this,s,"m",y).call(this,e,{networkStatus:z.NetworkStatus.Degraded})}),this.messenger.subscribe(`${this.name}:rpcEndpointChainAvailable`,({networkClientId:e})=>{M(this,s,"m",y).call(this,e,{networkStatus:z.NetworkStatus.Available})})}enableRpcFailover(){M(this,s,"m",g).call(this,!0)}disableRpcFailover(){M(this,s,"m",g).call(this,!1)}getProviderAndBlockTracker(){return{provider:M(this,i,"f"),blockTracker:M(this,c,"f")}}getSelectedNetworkClient(){return M(this,i,"f")&&M(this,c,"f")?{provider:M(this,i,"f"),blockTracker:M(this,c,"f")}:undefined}getSelectedChainId(){const e=this.getNetworkConfigurationByNetworkClientId(this.state.selectedNetworkClientId);return e?.chainId}getNetworkClientRegistry(){const e=M(this,s,"m",x).call(this);return Object.assign({},e[Z.NetworkClientType.Infura],e[Z.NetworkClientType.Custom])}getNetworkClientById(e){if(!e)throw new Error("No network client ID was provided.");const t=M(this,s,"m",x).call(this);if((0,F.isInfuraNetworkType)(e)){const n=t[Z.NetworkClientType.Infura][e];if(!n)throw new Error(`No Infura network client was found with the ID "${e}".`);return n}const n=t[Z.NetworkClientType.Custom][e];if(!n)throw new Error(`No custom network client was found with the ID "${e}".`);return n}initializeProvider({lookupNetwork:e=!0}={}){return M(this,s,"m",N).call(this,this.state.selectedNetworkClientId),e?this.lookupNetwork():undefined}async lookupNetwork(e){e?await M(this,s,"m",_).call(this,e):await M(this,s,"m",b).call(this)}async lookupNetworkByClientId(e){await M(this,s,"m",_).call(this,e)}async setProviderType(e){if(e===F.NetworkType.rpc)throw new Error(`NetworkController - cannot call "setProviderType" with type "${F.NetworkType.rpc}". Use "setActiveNetwork"`);if(!(0,F.isInfuraNetworkType)(e))throw new Error(`Unknown Infura provider type "${String(e)}".`);await this.setActiveNetwork(e)}async setActiveNetwork(e,t={}){P(this,a,this.state.selectedNetworkClientId,"f"),await M(this,s,"m",k).call(this,e,t)}async getEIP1559Compatibility(e){if(e)return this.get1559CompatibilityWithNetworkClientId(e);if(!M(this,r,"f"))return!1;const{EIPS:t}=this.state.networksMetadata[this.state.selectedNetworkClientId];if(t[1559]!==undefined)return t[1559];const n=await M(this,s,"m",S).call(this,this.state.selectedNetworkClientId);return this.update(e=>{n!==undefined&&(e.networksMetadata[e.selectedNetworkClientId].EIPS[1559]=n)}),n}async get1559CompatibilityWithNetworkClientId(e){let t=this.state.networksMetadata[e];t?.EIPS[1559]===undefined&&(await this.lookupNetwork(e),t=this.state.networksMetadata[e]);const{EIPS:n}=t;return n[1559]}async resetConnection(){await M(this,s,"m",k).call(this,this.state.selectedNetworkClientId)}getNetworkConfigurationByChainId(e){return this.state.networkConfigurationsByChainId[e]}getNetworkConfigurationByNetworkClientId(e){return M(this,p,"f").get(e)}addNetwork(e){const{rpcEndpoints:t}=e,n=M(this,s,"m",x).call(this);M(this,s,"m",A).call(this,{mode:"add",networkFields:e,autoManagedNetworkClientRegistry:n});const r=t.map(e=>({type:"add",rpcEndpoint:e.type===ne.Custom?{...e,networkClientId:(0,Q.v4)()}:e})),o=M(this,s,"m",I).call(this,{networkFields:e,networkClientOperations:r});return M(this,s,"m",T).call(this,{networkFields:e,networkClientOperations:r,autoManagedNetworkClientRegistry:n}),this.update(t=>{M(this,s,"m",C).call(this,{state:t,mode:"add",networkFields:e,networkConfigurationToPersist:o})}),this.messenger.publish(`${re}:networkAdded`,o),o}async updateNetwork(e,t,{replacementSelectedRpcEndpointIndex:n}={}){const r=this.state.networkConfigurationsByChainId[e];if(r===undefined)throw new Error(`Could not update network: Cannot find network configuration for chain '${e}'`);const o=e,{chainId:a,rpcEndpoints:i}=t,c=M(this,s,"m",x).call(this);M(this,s,"m",A).call(this,{mode:"update",networkFields:t,existingNetworkConfiguration:r,autoManagedNetworkClientRegistry:c});const d=[];for(const e of i){const t=r.rpcEndpoints.find(t=>t.type===e.type&&t.url===e.url&&(t.networkClientId===e.networkClientId||e.networkClientId===undefined)),n=r.rpcEndpoints.find(t=>t.type===ne.Infura&&e.type===ne.Infura||t.type===e.type&&t.networkClientId===e.networkClientId&&t.url===e.url),s=r.rpcEndpoints.find(t=>t.type===e.type&&(t.url===e.url||t.networkClientId===e.networkClientId));if(a!==o&&n!==undefined){const t=e.type===ne.Infura?e:{...e,networkClientId:(0,Q.v4)()};d.push({type:"replace",oldRpcEndpoint:n,newRpcEndpoint:t})}else if(t!==undefined){let n;n=t.type===ne.Infura?t:Object.assign({},e,{networkClientId:t.networkClientId}),d.push({type:"noop",rpcEndpoint:n})}else if(s===undefined){const t={type:"add",rpcEndpoint:e.type===ne.Infura?e:{...e,networkClientId:(0,Q.v4)()}};d.push(t)}else{let t;t=e.type===ne.Infura?e:{...e,networkClientId:(0,Q.v4)()},d.push({type:"replace",oldRpcEndpoint:s,newRpcEndpoint:t})}}for(const e of r.rpcEndpoints)if(!d.some(t=>{const n="replace"===t.type?t.oldRpcEndpoint:t.rpcEndpoint;return n.type===e.type&&n.networkClientId===e.networkClientId&&n.url===e.url})){const t={type:"remove",rpcEndpoint:e};d.push(t)}const l=M(this,s,"m",I).call(this,{networkFields:t,networkClientOperations:d});if(n===undefined&&d.some(e=>"remove"===e.type&&e.rpcEndpoint.networkClientId===this.state.selectedNetworkClientId)&&!d.some(e=>"replace"===e.type&&e.oldRpcEndpoint.networkClientId===this.state.selectedNetworkClientId))throw new Error(`Could not update network: Cannot update RPC endpoints in such a way that the selected network '${this.state.selectedNetworkClientId}' would be removed without a replacement. Choose a different RPC endpoint as the selected network via the \`replacementSelectedRpcEndpointIndex\` option.`);M(this,s,"m",T).call(this,{networkFields:t,networkClientOperations:d,autoManagedNetworkClientRegistry:c});const u=d.map((e,t)=>[e,t]).find(([e,t])=>"replace"===e.type&&e.oldRpcEndpoint.networkClientId===this.state.selectedNetworkClientId),m=n??u?.[1];let h;if(m!==undefined&&(h=l.rpcEndpoints[m],h===undefined))throw new Error(`Could not update network: \`replacementSelectedRpcEndpointIndex\` ${m} does not refer to an entry in \`rpcEndpoints\``);return h&&h.networkClientId!==this.state.selectedNetworkClientId?await this.setActiveNetwork(h.networkClientId,{updateState:e=>{M(this,s,"m",C).call(this,{state:e,mode:"update",networkFields:t,networkConfigurationToPersist:l,existingNetworkConfiguration:r})}}):this.update(e=>{M(this,s,"m",C).call(this,{state:e,mode:"update",networkFields:t,networkConfigurationToPersist:l,existingNetworkConfiguration:r})}),M(this,s,"m",v).call(this,{networkClientOperations:d,autoManagedNetworkClientRegistry:c}),l}removeNetwork(e){const t=this.state.networkConfigurationsByChainId[e];if(t===undefined)throw new Error(`Cannot find network configuration for chain '${e}'`);if(t.rpcEndpoints.some(e=>e.networkClientId===this.state.selectedNetworkClientId))throw new Error("Cannot remove the currently selected network");const n=M(this,s,"m",x).call(this),r=t.rpcEndpoints.map(e=>({type:"remove",rpcEndpoint:e}));M(this,s,"m",v).call(this,{networkClientOperations:r,autoManagedNetworkClientRegistry:n}),this.update(e=>{M(this,s,"m",C).call(this,{state:e,mode:"remove",existingNetworkConfiguration:t});for(const n of t.rpcEndpoints)delete e.networksMetadata[n.networkClientId]}),this.messenger.publish("NetworkController:networkRemoved",t)}async rollbackToPreviousProvider(){await M(this,s,"m",k).call(this,M(this,a,"f"))}async destroy(){await(M(this,c,"f")?.destroy())}loadBackup({networkConfigurationsByChainId:e}){this.update(t=>{t.networkConfigurationsByChainId={...t.networkConfigurationsByChainId,...e}})}findNetworkClientIdByChainId(e){const t=this.state.networkConfigurationsByChainId[e];if(!t)throw new Error(`Invalid chain ID "${e}"`);const{networkClientId:n}=t.rpcEndpoints[t.defaultRpcEndpointIndex];return n}}n.NetworkController=he,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,s=new WeakSet,g=function(e){if(M(this,f,"f")===e)return;const t=M(this,s,"m",x).call(this);for(const n of Object.values(t))for(const t of Object.keys(n)){const s=n[t];s.configuration.failoverRpcUrls&&s.configuration.failoverRpcUrls.length>0&&(e?s.enableRpcFailover():s.disableRpcFailover())}P(this,f,e,"f")},k=async function(e,t={}){this.messenger.publish("NetworkController:networkWillChange",this.state),M(this,s,"m",N).call(this,e,t),this.messenger.publish("NetworkController:networkDidChange",this.state),await this.lookupNetwork()},w=async function(e){const t=((0,F.isInfuraNetworkType)(e),this.getNetworkClientById(e)).configuration.type===Z.NetworkClientType.Infura;let n,r;try{r=await M(this,s,"m",S).call(this,e),n=z.NetworkStatus.Available}catch(e){if(ee("NetworkController: lookupNetwork: ",e),function(e){return"object"==typeof e&&null!==e&&"code"in e}(e)){let s;if(t&&(0,G.hasProperty)(e,"message")&&"string"==typeof e.message)try{s=JSON.parse(e.message)}catch{M(this,u,"f")?.warn("NetworkController: lookupNetwork: json parse error: ",e)}(0,G.isPlainObject)(s)&&s.error===z.INFURA_BLOCKED_KEY?n=z.NetworkStatus.Blocked:e.code===H.errorCodes.rpc.internal?(n=z.NetworkStatus.Unknown,M(this,u,"f")?.warn("NetworkController: lookupNetwork: rpc internal error: ",e)):(n=z.NetworkStatus.Unavailable,M(this,u,"f")?.warn("NetworkController: lookupNetwork: ",e))}else ee("NetworkController - could not determine network status",e),n=z.NetworkStatus.Unknown,M(this,u,"f")?.warn("NetworkController: lookupNetwork: ",e)}return{isInfura:t,networkStatus:n,isEIP1559Compatible:r}},_=async function(e){const{networkStatus:t,isEIP1559Compatible:n}=await M(this,s,"m",w).call(this,e);M(this,s,"m",y).call(this,e,{networkStatus:t,isEIP1559Compatible:n})},b=async function(){if(!M(this,r,"f"))return;let e=!1;const t=()=>{e=!0;try{this.messenger.unsubscribe("NetworkController:networkDidChange",t)}catch(e){if(!(e instanceof Error)||"Subscription not found for event: NetworkController:networkDidChange"!==e.message)throw e}};this.messenger.subscribe("NetworkController:networkDidChange",t);const{isInfura:n,networkStatus:o,isEIP1559Compatible:a}=await M(this,s,"m",w).call(this,this.state.selectedNetworkClientId);if(!e){try{this.messenger.unsubscribe("NetworkController:networkDidChange",t)}catch(e){if(!(e instanceof Error)||"Subscription not found for event: NetworkController:networkDidChange"!==e.message)throw e}M(this,s,"m",y).call(this,this.state.selectedNetworkClientId,{networkStatus:o,isEIP1559Compatible:a}),n?o===z.NetworkStatus.Available?this.messenger.publish("NetworkController:infuraIsUnblocked"):o===z.NetworkStatus.Blocked&&this.messenger.publish("NetworkController:infuraIsBlocked"):this.messenger.publish("NetworkController:infuraIsUnblocked")}},y=function(e,t){this.update(n=>{var s;(s=n.networksMetadata)[e]??(s[e]={status:z.NetworkStatus.Unknown,EIPS:{}});const r=n.networksMetadata[e];r.status=t.networkStatus,"isEIP1559Compatible"in t&&(t.isEIP1559Compatible===undefined?delete r.EIPS[1559]:r.EIPS[1559]=t.isEIP1559Compatible)})},E=function(e=this.state.selectedNetworkClientId){const t=this.getNetworkClientById(e),n=new U.default(t.provider);return new Promise((e,t)=>{n.sendAsync({method:"eth_getBlockByNumber",params:["latest",!1]},(n,s)=>{n?t(n):e(s)})})},S=async function(e){const t=await M(this,s,"m",E).call(this,e);return t?t.baseFeePerGas!==undefined:undefined},A=function(e){const{mode:t,networkFields:n,autoManagedNetworkClientRegistry:s}=e,r="existingNetworkConfiguration"in e?e.existingNetworkConfiguration:null,o="update"===t?"Could not update network":"Could not add network";if(!(0,G.isStrictHexString)(n.chainId)||!(0,F.isSafeChainId)(n.chainId))throw new Error(`${o}: Invalid \`chainId\` '${n.chainId}' (must start with "0x" and not exceed the maximum)`);if(n.chainId!==r?.chainId){const t=this.state.networkConfigurationsByChainId[n.chainId];if(t!==undefined)throw null===r?new Error(`Could not add network for chain ${e.networkFields.chainId} as another network for that chain already exists ('${t.name}')`):new Error(`Cannot move network from chain ${r.chainId} to ${n.chainId} as another network for that chain already exists ('${t.name}')`)}if(n.blockExplorerUrls.length>0?n.defaultBlockExplorerUrlIndex===undefined||n.blockExplorerUrls[n.defaultBlockExplorerUrlIndex]===undefined:n.defaultBlockExplorerUrlIndex!==undefined)throw new Error(`${o}: \`defaultBlockExplorerUrlIndex\` must refer to an entry in \`blockExplorerUrls\``);if(0===n.rpcEndpoints.length)throw new Error(`${o}: \`rpcEndpoints\` must be a non-empty array`);for(const e of n.rpcEndpoints){if(!le(e.url))throw new Error(`${o}: An entry in \`rpcEndpoints\` has invalid URL '${e.url}'`);const a="networkClientId"in e?e.networkClientId:undefined;if(e.type===ne.Custom&&a!==undefined&&(0,F.isInfuraNetworkType)(a))throw new Error(`${o}: Custom RPC endpoint '${e.url}' has invalid network client ID '${a}'`);if("update"===t&&a!==undefined&&e.type===ne.Custom&&!Object.values(s).some(e=>a in e))throw new Error(`${o}: RPC endpoint '${e.url}' refers to network client '${a}' that does not exist`);if(n.rpcEndpoints.some(t=>t!==e&&Y.equal(t.url,e.url)))throw new Error(`${o}: Each entry in rpcEndpoints must have a unique URL`);const i=Object.values(this.state.networkConfigurationsByChainId).filter(e=>!r||e.chainId!==r.chainId);for(const n of i){if(n.rpcEndpoints.find(t=>Y.equal(e.url,t.url)))throw"update"===t?new Error(`Could not update network to point to same RPC endpoint as existing network for chain ${n.chainId} ('${n.name}')`):new Error(`Could not add network that points to same RPC endpoint as existing network for chain ${n.chainId} ('${n.name}')`)}}if([...new Set(n.rpcEndpoints)].length<n.rpcEndpoints.length)throw new Error(`${o}: Each entry in rpcEndpoints must be unique`);const a=n.rpcEndpoints.map(e=>"networkClientId"in e?e.networkClientId:undefined).filter(e=>e!==undefined);if([...new Set(a)].length<a.length)throw new Error(`${o}: Each entry in rpcEndpoints must have a unique networkClientId`);const i=n.rpcEndpoints.filter(e=>e.type===ne.Infura);if(i.length>1)throw new Error(`${o}: There cannot be more than one Infura RPC endpoint`);const c=i[0];if(c){const e=ue(c.url),s=F.NetworkNickname[e],r=F.ChainId[e];if(n.chainId!==r)throw new Error("add"===t?`Could not add network with chain ID ${n.chainId} and Infura RPC endpoint for '${s}' which represents ${r}, as the two conflict`:`Could not update network with chain ID ${n.chainId} and Infura RPC endpoint for '${s}' which represents ${r}, as the two conflict`)}if(n.rpcEndpoints[n.defaultRpcEndpointIndex]===undefined)throw new Error(`${o}: \`defaultRpcEndpointIndex\` must refer to an entry in \`rpcEndpoints\``)},I=function({networkFields:e,networkClientOperations:t}){return{...e,rpcEndpoints:t.filter(e=>"add"===e.type||"noop"===e.type).map(e=>e.rpcEndpoint).concat(t.filter(e=>"replace"===e.type).map(e=>e.newRpcEndpoint))}},T=function({networkFields:e,networkClientOperations:t,autoManagedNetworkClientRegistry:n}){const s=t.filter(e=>"add"===e.type).map(e=>e.rpcEndpoint).concat(t.filter(e=>"replace"===e.type).map(e=>e.newRpcEndpoint));for(const t of s)t.type===ne.Infura?n[Z.NetworkClientType.Infura][t.networkClientId]=(0,J.createAutoManagedNetworkClient)({networkClientId:t.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Infura,chainId:e.chainId,network:t.networkClientId,failoverRpcUrls:t.failoverUrls,infuraProjectId:M(this,o,"f"),ticker:e.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")}):n[Z.NetworkClientType.Custom][t.networkClientId]=(0,J.createAutoManagedNetworkClient)({networkClientId:t.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Custom,chainId:e.chainId,failoverRpcUrls:t.failoverUrls,rpcUrl:t.url,ticker:e.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")})},v=function({networkClientOperations:e,autoManagedNetworkClientRegistry:t}){const n=e.filter(e=>"remove"===e.type).map(e=>e.rpcEndpoint).concat(e.filter(e=>"replace"===e.type).map(e=>e.oldRpcEndpoint));for(const e of n){const n=this.getNetworkClientById(e.networkClientId);n.destroy(),delete t[n.configuration.type][e.networkClientId]}},C=function(e){const{state:t,mode:n}=e;("remove"===n||"update"===n&&e.networkFields.chainId!==e.existingNetworkConfiguration.chainId)&&delete t.networkConfigurationsByChainId[e.existingNetworkConfiguration.chainId],"add"!==n&&"update"!==n||((0,$.default)(t.networkConfigurationsByChainId[e.networkFields.chainId],e.networkConfigurationToPersist)||(e.networkConfigurationToPersist.lastUpdatedAt=Date.now()),t.networkConfigurationsByChainId[e.networkFields.chainId]=e.networkConfigurationToPersist),P(this,p,me((0,K.cloneDeep)(t.networkConfigurationsByChainId)),"f")},x=function(){return P(this,d,M(this,d,"f")??M(this,s,"m",j).call(this),"f")},j=function(){return se(this.state.networkConfigurationsByChainId).flatMap(e=>{const t=this.state.networkConfigurationsByChainId[e];return t.rpcEndpoints.map(e=>{if(e.type===ne.Infura){const n=ue(e.url);return[e.networkClientId,(0,J.createAutoManagedNetworkClient)({networkClientId:e.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Infura,network:n,failoverRpcUrls:e.failoverUrls,infuraProjectId:M(this,o,"f"),chainId:t.chainId,ticker:t.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")})]}return[e.networkClientId,(0,J.createAutoManagedNetworkClient)({networkClientId:e.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Custom,chainId:t.chainId,failoverRpcUrls:e.failoverUrls,rpcUrl:e.url,ticker:t.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")})]})}).reduce((e,[t,n])=>({...e,[n.configuration.type]:{...e[n.configuration.type],[t]:n}}),{[Z.NetworkClientType.Custom]:{},[Z.NetworkClientType.Infura]:{}})},N=function(e,{updateState:t}={}){const n=M(this,s,"m",x).call(this);let o;if((0,F.isInfuraNetworkType)(e)){const t=n[Z.NetworkClientType.Infura][e];if(!t)throw new Error(`No Infura network client found with ID '${e}'`);o=t}else{const t=n[Z.NetworkClientType.Custom][e];if(!t)throw new Error(`No network client found with ID '${e}'`);o=t}P(this,l,o,"f"),this.update(n=>{var s;n.selectedNetworkClientId=e,(s=n.networksMetadata)[e]??(s[e]={status:z.NetworkStatus.Unknown,EIPS:{}}),t?.(n)}),M(this,i,"f")?M(this,i,"f").setTarget(M(this,l,"f").provider):P(this,i,(0,q.createSwappableProxy)(M(this,l,"f").provider),"f"),M(this,c,"f")?M(this,c,"f").setTarget(M(this,l,"f").blockTracker):P(this,c,(0,q.createEventEmitterProxy)(M(this,l,"f").blockTracker,{eventFilter:"skipInternal"}),"f"),P(this,r,new U.default(M(this,i,"f")),"f")}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/NetworkController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.DEPRECATED_NETWORKS=n.INFURA_BLOCKED_KEY=n.NetworkStatus=void 0,function(e){e.Unknown="unknown",e.Available="available",e.Degraded="degraded",e.Unavailable="unavailable",e.Blocked="blocked"}(s||(n.NetworkStatus=s={})),n.INFURA_BLOCKED_KEY="countryBlocked",n.DEPRECATED_NETWORKS=new Set(["0xe704","0x5"])}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-auto-managed-network-client.cjs",{"./create-network-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-network-client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createAutoManagedNetworkClient=void 0;const s=e("./create-network-client.cjs"),r="__target__",o={__UNINITIALIZED__:!0};n.createAutoManagedNetworkClient=function({networkClientId:e,networkClientConfiguration:t,getRpcServiceOptions:n,getBlockTrackerOptions:a=()=>({}),messenger:i,isRpcFailoverEnabled:c,logger:d}){let l,u=c;const m=()=>{if(l??(l=(0,s.createNetworkClient)({id:e,configuration:t,getRpcServiceOptions:n,getBlockTrackerOptions:a,messenger:i,isRpcFailoverEnabled:u,logger:d})),l===undefined)throw new Error("It looks like `createNetworkClient` didn't return anything. Perhaps it's being mocked?");return l},h=new Proxy(o,{get(e,t,n){if(t===r)return l?.provider;const{provider:s}=m();if(t in s){const e=s[t];return"function"==typeof e?function(...t){return e.apply(this===n?s:this,t)}:e}return undefined},has(e,t){if(t===r)return!0;const{provider:n}=m();return t in n}}),p=new Proxy(o,{get(e,t,n){if(t===r)return l?.blockTracker;const{blockTracker:s}=m();if(t in s){const e=s[t];return"function"==typeof e?function(...t){return e.apply(this===n?s:this,t)}:e}return undefined},has(e,t){if(t===r)return!0;const{blockTracker:n}=m();return t in n}}),f=()=>{l?.destroy()};return{configuration:t,provider:h,blockTracker:p,destroy:f,enableRpcFailover:()=>{u=!0,f(),l=undefined},disableRpcFailover:()=>{u=!1,f(),l=undefined}}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-auto-managed-network-client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-network-client.cjs",{"./rpc-service/rpc-service-chain.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service-chain.cjs","./rpc-service/rpc-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs","@metamask/connectivity-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/connectivity-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/eth-block-tracker":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-block-tracker/dist/index.cjs","@metamask/eth-json-rpc-infura":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-infura/dist/index.js","@metamask/eth-json-rpc-middleware":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-middleware/dist/index.cjs","@metamask/eth-json-rpc-provider":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-provider/dist/index.cjs","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","@metamask/json-rpc-engine/v2":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/v2.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createNetworkClient=n.classifyRetryReason=void 0;const s=e("@metamask/connectivity-controller"),r=e("@metamask/controller-utils"),o=e("@metamask/eth-block-tracker"),a=e("@metamask/eth-json-rpc-infura"),i=e("@metamask/eth-json-rpc-middleware"),c=e("@metamask/eth-json-rpc-provider"),d=e("@metamask/eth-json-rpc-provider"),l=e("@metamask/json-rpc-engine"),u=e("@metamask/json-rpc-engine/v2"),m=e("./rpc-service/rpc-service.cjs"),h=e("./rpc-service/rpc-service-chain.cjs"),p=e("./types.cjs"),f=1e3;function g(e){return e instanceof Error?(0,m.isConnectionError)(e)?"connection_failed":(0,m.isJsonParseError)(e)?"response_not_json":(0,m.isHttpServerError)(e)?"non_successful_http_status":(0,m.isTimeoutError)(e)?"timed_out":(0,m.isConnectionResetError)(e)?"connection_reset":"unknown":"unknown"}function k({network:e}){return(0,u.createScaffoldMiddleware)({eth_chainId:r.ChainId[e]})}n.classifyRetryReason=g,n.createNetworkClient=function({id:e,configuration:t,getRpcServiceOptions:n,getBlockTrackerOptions:r,messenger:m,isRpcFailoverEnabled:b,logger:y}){const E=t.type===p.NetworkClientType.Infura?`https://${t.network}.infura.io/v3/${t.infuraProjectId}`:t.rpcUrl,S=function({id:e,primaryEndpointUrl:t,configuration:n,getRpcServiceOptions:r,messenger:o,isRpcFailoverEnabled:a,logger:i}){const c=a?[t,...n.failoverRpcUrls??[]]:[t],d=()=>o.call("ConnectivityController:getState").connectivityStatus===s.CONNECTIVITY_STATUSES.Offline,l=c.map(e=>({...r(e),endpointUrl:e,logger:i,isOffline:d})),u=e=>"error"in e?e.error:"value"in e?e.value:undefined,m=new h.RpcServiceChain([l[0],...l.slice(1)]);return m.onBreak(t=>{const s=u(t);if(s===undefined)throw new Error("Could not make request to endpoint.");o.publish("NetworkController:rpcEndpointChainUnavailable",{chainId:n.chainId,networkClientId:e,error:s})}),m.onServiceBreak(({endpointUrl:t,primaryEndpointUrl:s,...r})=>{const a=u(r);if(a===undefined)throw new Error("Could not make request to endpoint.");o.publish("NetworkController:rpcEndpointUnavailable",{chainId:n.chainId,networkClientId:e,primaryEndpointUrl:s,endpointUrl:t,error:a})}),m.onDegraded(({rpcMethodName:t,...s})=>{const r=u(s),a=r===undefined?"slow_success":"retries_exhausted";o.publish("NetworkController:rpcEndpointChainDegraded",{chainId:n.chainId,networkClientId:e,error:r,rpcMethodName:t,type:a,retryReason:r===undefined?undefined:g(r)})}),m.onServiceDegraded(({endpointUrl:t,primaryEndpointUrl:s,rpcMethodName:r,...a})=>{const i=u(a),c=i===undefined?"slow_success":"retries_exhausted";o.publish("NetworkController:rpcEndpointDegraded",{chainId:n.chainId,networkClientId:e,primaryEndpointUrl:s,endpointUrl:t,error:i,rpcMethodName:r,type:c,retryReason:i===undefined?undefined:g(i)})}),m.onAvailable(()=>{o.publish("NetworkController:rpcEndpointChainAvailable",{chainId:n.chainId,networkClientId:e})}),m.onServiceRetry(({attempt:t,endpointUrl:s,primaryEndpointUrl:r})=>{o.publish("NetworkController:rpcEndpointRetried",{chainId:n.chainId,networkClientId:e,primaryEndpointUrl:r,endpointUrl:s,attempt:t})}),m}({id:e,primaryEndpointUrl:E,configuration:t,getRpcServiceOptions:n,messenger:m,isRpcFailoverEnabled:b,logger:y});let A;A=t.type===p.NetworkClientType.Infura?(0,l.asV2Middleware)((0,a.createInfuraMiddleware)({rpcService:S,options:{source:"metamask"}})):(0,i.createFetchMiddleware)({rpcService:S});const I=(0,d.providerFromMiddlewareV2)(A),T=function({networkClientType:e,endpointUrl:t,getOptions:n,provider:s}){const r=e===p.NetworkClientType.Custom?{pollingInterval:f}:{};return new o.PollingBlockTracker({...r,...n(t),provider:s})}({networkClientType:t.type,endpointUrl:E,getOptions:r,provider:I}),v=t.type===p.NetworkClientType.Infura?function({blockTracker:e,network:t,rpcProvider:n,rpcApiMiddleware:s}){return u.JsonRpcEngineV2.create({middleware:[k({network:t}),(0,i.createBlockCacheMiddleware)({blockTracker:e}),(0,i.createInflightCacheMiddleware)(),(0,i.createBlockRefMiddleware)({blockTracker:e,provider:n}),(0,i.createRetryOnEmptyMiddleware)({blockTracker:e,provider:n}),(0,i.createBlockTrackerInspectorMiddleware)({blockTracker:e}),s]}).asMiddleware()}({blockTracker:T,network:t.network,rpcProvider:I,rpcApiMiddleware:A}):function({blockTracker:e,chainId:t,rpcApiMiddleware:n}){const s=[_()];return u.JsonRpcEngineV2.create({middleware:[...s,w(t),(0,i.createBlockRefRewriteMiddleware)({blockTracker:e}),(0,i.createBlockCacheMiddleware)({blockTracker:e}),(0,i.createInflightCacheMiddleware)(),(0,i.createBlockTrackerInspectorMiddleware)({blockTracker:e}),n]}).asMiddleware()}({blockTracker:T,chainId:t.chainId,rpcApiMiddleware:A});return{configuration:t,provider:new c.InternalProvider({engine:u.JsonRpcEngineV2.create({middleware:[v]})}),blockTracker:T,destroy:()=>{T.destroy()}}};const w=e=>({request:t,next:n})=>"eth_chainId"===t.method?e:n();function _(){return async({request:e,next:t})=>("eth_estimateGas"===e.method&&await new Promise(e=>setTimeout(e,2e3)),t())}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-network-client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/index.cjs",{"./NetworkController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/NetworkController.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs","./create-network-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-network-client.cjs","./rpc-service/rpc-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.isConnectionError=n.classifyRetryReason=n.NetworkClientType=n.RpcEndpointType=n.NetworkController=n.knownKeysOf=n.selectAvailableNetworkClientIds=n.getDefaultNetworkControllerState=void 0;var o=e("./NetworkController.cjs");Object.defineProperty(n,"getDefaultNetworkControllerState",{enumerable:!0,get:function(){return o.getDefaultNetworkControllerState}}),Object.defineProperty(n,"selectAvailableNetworkClientIds",{enumerable:!0,get:function(){return o.selectAvailableNetworkClientIds}}),Object.defineProperty(n,"knownKeysOf",{enumerable:!0,get:function(){return o.knownKeysOf}}),Object.defineProperty(n,"NetworkController",{enumerable:!0,get:function(){return o.NetworkController}}),Object.defineProperty(n,"RpcEndpointType",{enumerable:!0,get:function(){return o.RpcEndpointType}}),r(e("./constants.cjs"),n);var a=e("./types.cjs");Object.defineProperty(n,"NetworkClientType",{enumerable:!0,get:function(){return a.NetworkClientType}});var i=e("./create-network-client.cjs");Object.defineProperty(n,"classifyRetryReason",{enumerable:!0,get:function(){return i.classifyRetryReason}});var c=e("./rpc-service/rpc-service.cjs");Object.defineProperty(n,"isConnectionError",{enumerable:!0,get:function(){return c.isConnectionError}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const s=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return s.createModuleLogger}}),n.projectLogger=(0,s.createProjectLogger)("network-controller")}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service-chain.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs","./rpc-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.RpcServiceChain=void 0;const u=e("@metamask/controller-utils"),m=e("./rpc-service.cjs"),h=e("../logger.cjs"),p=(0,h.createModuleLogger)(h.projectLogger,"RpcServiceChain"),f="available",g="degraded",k="unknown",w="unavailable";n.RpcServiceChain=class{constructor(e){s.set(this,void 0),r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),d(this,i,e.map(e=>new m.RpcService(e)),"f"),d(this,a,l(this,i,"f")[0],"f"),d(this,c,k,"f"),d(this,r,new u.CockatielEventEmitter,"f"),d(this,o,new u.CockatielEventEmitter,"f");for(const e of l(this,i,"f"))e.onDegraded(e=>{if(l(this,c,"f")!==g){p('Updating status to "degraded"',e),d(this,c,g,"f");const{endpointUrl:t,...n}=e;l(this,o,"f").emit(n)}});d(this,s,new u.CockatielEventEmitter,"f");for(const e of l(this,i,"f"))e.onAvailable(e=>{if(l(this,c,"f")!==f){p('Updating status to "available"',e),d(this,c,f,"f");const{endpointUrl:t,...n}=e;l(this,s,"f").emit(n)}})}onServiceRetry(e){const t=l(this,i,"f").map(t=>t.onRetry(t=>{e({...t,primaryEndpointUrl:l(this,a,"f").endpointUrl.toString()})}));return{dispose(){t.forEach(e=>e.dispose())}}}onBreak(e){return l(this,r,"f").addListener(e)}onServiceBreak(e){const t=l(this,i,"f").map(t=>t.onBreak(t=>{e({...t,primaryEndpointUrl:l(this,a,"f").endpointUrl.toString()})}));return{dispose(){t.forEach(e=>e.dispose())}}}onDegraded(e){return l(this,o,"f").addListener(e)}onServiceDegraded(e){const t=l(this,i,"f").map(t=>t.onDegraded(t=>{e({...t,primaryEndpointUrl:l(this,a,"f").endpointUrl.toString()})}));return{dispose(){t.forEach(e=>e.dispose())}}}onAvailable(e){return l(this,s,"f").addListener(e)}async request(e,t={}){let n,s;for(const[o,a]of l(this,i,"f").entries()){p(`Trying service #${o+1}...`);const m=a.getCircuitState();try{s=await a.request(e,t),p("Service successfully received request."),n=o;break}catch(e){const{lastError:t}=a,n=a.getCircuitState()===u.CircuitState.Open;if(p("Service failed! error =",e,"lastError = ",t),n){if(o<l(this,i,"f").length-1){p("This service's circuit is open. Proceeding to next service...");continue}m!==u.CircuitState.Open&&l(this,c,"f")!==w&&t!==undefined&&(p('This service\'s circuit just opened and it is the last service. Updating status to "unavailable" and triggering onBreak.'),d(this,c,w,"f"),l(this,r,"f").emit({error:t}))}throw p((n?"":"This service's circuit is closed. ")+"Re-throwing error."),e}}if(s){if(n!==undefined)for(const[e,t]of[...l(this,i,"f").entries()].slice(n+1))p(`Resetting policy for service #${e+1}.`),t.resetPolicy();return s}throw new Error("Nothing to return")}},s=new WeakMap,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service-chain.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",cockatiel:"/home/runner/work/metamask-extension/metamask-extension/node_modules/cockatiel/dist/index.js",deepmerge:"/home/runner/work/metamask-extension/metamask-extension/node_modules/deepmerge/dist/cjs.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},h=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},p=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.RpcService=n.isConnectionResetError=n.isTimeoutError=n.isHttpServerError=n.isJsonParseError=n.isConnectionError=n.CUSTOM_RPC_ERRORS=n.CONNECTION_ERRORS=n.DEFAULT_MAX_CONSECUTIVE_FAILURES=n.DEFAULT_MAX_RETRIES=void 0;const f=e("@metamask/controller-utils"),g=e("@metamask/rpc-errors"),k=e("@metamask/utils"),w=(e("cockatiel"),p(e("deepmerge"))),_=e("../logger.cjs"),b=(0,_.createModuleLogger)(_.projectLogger,"RpcService");function y(e){if("object"!=typeof e||null===e||!("message"in e))return!1;const{message:t}=e;return"string"==typeof t&&!function(e){return e.includes("Nock:")}(t)&&n.CONNECTION_ERRORS.some(({constructorName:n,pattern:s})=>e.constructor.name===n&&s.test(t))}function E(e){return e instanceof SyntaxError||/invalid json/iu.test((0,k.getErrorMessage)(e))}function S(e){return"httpStatus"in e&&(502===e.httpStatus||503===e.httpStatus||504===e.httpStatus)}function A(e){return(0,k.hasProperty)(e,"code")&&"ETIMEDOUT"===e.code}function I(e){return(0,k.hasProperty)(e,"code")&&"ECONNRESET"===e.code}n.DEFAULT_MAX_RETRIES=4,n.DEFAULT_MAX_CONSECUTIVE_FAILURES=3*(1+n.DEFAULT_MAX_RETRIES),n.CONNECTION_ERRORS=[{constructorName:"TypeError",pattern:/network error/u},{constructorName:"TypeError",pattern:/Failed to fetch/u},{constructorName:"TypeError",pattern:/NetworkError when attempting to fetch resource\./u},{constructorName:"TypeError",pattern:/The Internet connection appears to be offline\./u},{constructorName:"TypeError",pattern:/Load failed/u},{constructorName:"TypeError",pattern:/Network request failed/u},{constructorName:"FetchError",pattern:/request to (.+) failed/u},{constructorName:"TypeError",pattern:/fetch failed/u},{constructorName:"TypeError",pattern:/terminated/u}],n.CUSTOM_RPC_ERRORS={unauthorized:-32006,httpClientError:-32080},n.isConnectionError=y,n.isJsonParseError=E,n.isHttpServerError=S,n.isTimeoutError=A,n.isConnectionResetError=I;n.RpcService=class{constructor(e){s.add(this),r.set(this,""),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0);const{btoa:t,endpointUrl:l,fetch:u,logger:p,fetchOptions:g={},policyOptions:k={},isOffline:w}=e;m(this,o,u,"f");const _=(b=l)instanceof URL?b:new URL(b);var b;m(this,a,h(this,s,"m",d).call(this,_,g,t),"f"),this.endpointUrl=function(e){const t=new URL(e.toString());return t.username="",t.password="",t}(_),m(this,i,p,"f"),m(this,c,(0,f.createServicePolicy)({maxRetries:n.DEFAULT_MAX_RETRIES,maxConsecutiveFailures:n.DEFAULT_MAX_CONSECUTIVE_FAILURES,...k,retryFilterPolicy:(0,f.handleWhen)(e=>!w()&&(y(e)||E(e)||S(e)||A(e)||I(e)))}),"f")}resetPolicy(){h(this,c,"f").reset()}getCircuitState(){return h(this,c,"f").getCircuitState()}onRetry(e){return h(this,c,"f").onRetry(t=>{e({...t,endpointUrl:this.endpointUrl.toString()})})}onBreak(e){return h(this,c,"f").onBreak(t=>{"isolated"in t||e({...t,endpointUrl:this.endpointUrl.toString()})})}onDegraded(e){return h(this,c,"f").onDegraded(t=>{t===undefined?e({endpointUrl:this.endpointUrl.toString(),rpcMethodName:h(this,r,"f")}):e({...t,endpointUrl:this.endpointUrl.toString(),rpcMethodName:h(this,r,"f")})})}onAvailable(e){return h(this,c,"f").onAvailable(()=>{e({endpointUrl:this.endpointUrl.toString()})})}async request(e,t={}){const n=h(this,s,"m",l).call(this,e,t);return await h(this,s,"m",u).call(this,n,e.method)}},r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,s=new WeakSet,d=function(e,t,n){if(e.username&&e.password){const s=n(`${e.username}:${e.password}`);return(0,w.default)(t,{headers:{Authorization:`Basic ${s}`}})}return t},l=function(e,t){const n=(0,w.default)({method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"}},(0,w.default)(h(this,a,"f"),t)),{id:s,jsonrpc:r,method:o,params:i}=e;return{...n,body:JSON.stringify({id:s,jsonrpc:r,method:o,params:i})}},u=async function(e,t){let s;try{b(`[${this.endpointUrl}] Circuit state`,h(this,c,"f").getCircuitState());const n=await h(this,c,"f").execute(async n=>{try{if(b("REQUEST INITIATED:",this.endpointUrl.toString(),"::",e,`(attempt ${n.attempt+1})`),s=await h(this,o,"f").call(this,this.endpointUrl,e),!s.ok)throw new f.HttpError(s.status);return b("REQUEST SUCCESSFUL:",this.endpointUrl.toString(),s.status),await s.json()}finally{m(this,r,t,"f")}});return this.lastError=undefined,n}catch(e){if(b("REQUEST ERROR:",this.endpointUrl.toString(),e),this.lastError=e instanceof Error?e:new Error((0,k.getErrorMessage)(e)),e instanceof f.HttpError){const t=e.httpStatus;if(401===t)throw new g.JsonRpcError(n.CUSTOM_RPC_ERRORS.unauthorized,"Unauthorized.",{httpStatus:t});if(429===t)throw g.rpcErrors.limitExceeded({message:"Request is being rate limited.",data:{httpStatus:t}});if(t>=500||402===t||404===t)throw g.rpcErrors.resourceUnavailable({message:"RPC endpoint not found or unavailable.",data:{httpStatus:t}});throw new g.JsonRpcError(n.CUSTOM_RPC_ERRORS.httpClientError,"RPC endpoint returned HTTP client error.",{httpStatus:t})}if(E(e))throw g.rpcErrors.parse({message:"RPC endpoint did not return JSON."});if(e instanceof f.BrokenCircuitError){h(this,i,"f")?.warn(e);const t=h(this,c,"f").getRemainingCircuitOpenDuration(),n=Intl.NumberFormat(undefined,{maximumFractionDigits:2}).format((t??h(this,c,"f").circuitBreakDuration)/k.Duration.Minute);throw g.rpcErrors.resourceUnavailable({message:`RPC endpoint returned too many errors, retrying in ${n} minutes. Consider using a different RPC endpoint.`})}throw e}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.NetworkClientType=void 0,function(e){e.Custom="custom",e.Infura="infura"}(s||(n.NetworkClientType=s={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){!function(e){var n,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,r=Math.ceil,o=Math.floor,a="[BigNumber Error] ",i=a+"Number primitive has more than 15 significant digits: ",c=1e14,d=14,l=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function f(e){for(var t,n,s=1,r=e.length,o=e[0]+"";s<r;){for(t=e[s++]+"",n=d-t.length;n--;t="0"+t);o+=t}for(r=o.length;48===o.charCodeAt(--r););return o.slice(0,r+1||1)}function g(e,t){var n,s,r=e.c,o=t.c,a=e.s,i=t.s,c=e.e,d=t.e;if(!a||!i)return null;if(n=r&&!r[0],s=o&&!o[0],n||s)return n?s?0:-i:a;if(a!=i)return a;if(n=a<0,s=c==d,!r||!o)return s?0:!r^n?1:-1;if(!s)return c>d^n?1:-1;for(i=(c=r.length)<(d=o.length)?c:d,a=0;a<i;a++)if(r[a]!=o[a])return r[a]>o[a]^n?1:-1;return c==d?0:c>d^n?1:-1}function k(e,t,n,s){if(e<t||e>n||e!==o(e))throw Error(a+(s||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return p(e.e/d)==t&&e.c[t]%2!=0}function _(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function b(e,t,n){var s,r;if(t<0){for(r=n+".";++t;r+=n);e=r+e}else if(++t>(s=e.length)){for(r=n,t-=s;--t;r+=n);e+=r}else t<s&&(e=e.slice(0,t)+"."+e.slice(t));return e}n=function e(t){var n,y,E,S,A,I,T,v,C,x,j=$.prototype={constructor:$,toString:null,valueOf:null},N=new $(1),O=20,R=4,D=-7,P=21,M=-1e7,B=1e7,L=!1,F=1,U=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz",G=!0;function $(e,t){var n,r,a,c,u,m,h,p,f=this;if(!(f instanceof $))return new $(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>B?f.c=f.e=null:e.e<M?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((m="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,u=e;u>=10;u/=10,c++);return void(c>B?f.c=f.e=null:(f.e=c,f.c=[e]))}p=String(e)}else{if(!s.test(p=String(e)))return E(f,p,m);f.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(u=p.search(/e/i))>0?(c<0&&(c=u),c+=+p.slice(u+1),p=p.substring(0,u)):c<0&&(c=p.length)}else{if(k(t,2,q.length,"Base"),10==t&&G)return Y(f=new $(e),O+f.e+1,R);if(p=String(e),m="number"==typeof e){if(0*e!=0)return E(f,p,m,t);if(f.s=1/e<0?(p=p.slice(1),-1):1,$.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(i+e)}else f.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(n=q.slice(0,t),c=u=0,h=p.length;u<h;u++)if(n.indexOf(r=p.charAt(u))<0){if("."==r){if(u>c){c=h;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,u=-1,c=0;continue}return E(f,String(e),m,t)}m=!1,(c=(p=y(p,t,10,f.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(u=0;48===p.charCodeAt(u);u++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(u,++h)){if(h-=u,m&&$.DEBUG&&h>15&&(e>l||e!==o(e)))throw Error(i+f.s*e);if((c=c-u-1)>B)f.c=f.e=null;else if(c<M)f.c=[f.e=0];else{if(f.e=c,f.c=[],u=(c+1)%d,c<0&&(u+=d),u<h){for(u&&f.c.push(+p.slice(0,u)),h-=d;u<h;)f.c.push(+p.slice(u,u+=d));u=d-(p=p.slice(u)).length}else u-=h;for(;u--;p+="0");f.c.push(+p)}}else f.c=[f.e=0]}function W(e,t,n,s){var r,o,a,i,c;if(null==n?n=R:k(n,0,8),!e.c)return e.toString();if(r=e.c[0],a=e.e,null==t)c=f(e.c),c=1==s||2==s&&(a<=D||a>=P)?_(c,a):b(c,a,"0");else if(o=(e=Y(new $(e),t,n)).e,i=(c=f(e.c)).length,1==s||2==s&&(t<=o||o<=D)){for(;i<t;c+="0",i++);c=_(c,o)}else if(t-=a,c=b(c,o,"0"),o+1>i){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-i)>0)for(o+1==i&&(c+=".");t--;c+="0");return e.s<0&&r?"-"+c:c}function K(e,t){for(var n,s,r=1,o=new $(e[0]);r<e.length;r++)(!(s=new $(e[r])).s||(n=g(o,s))===t||0===n&&o.s===t)&&(o=s);return o}function V(e,t,n){for(var s=1,r=t.length;!t[--r];t.pop());for(r=t[0];r>=10;r/=10,s++);return(n=s+n*d-1)>B?e.c=e.e=null:n<M?e.c=[e.e=0]:(e.e=n,e.c=t),e}function Y(e,t,n,s){var a,i,l,m,h,p,f,g=e.c,k=u;if(g){e:{for(a=1,m=g[0];m>=10;m/=10,a++);if((i=t-a)<0)i+=d,l=t,h=g[p=0],f=o(h/k[a-l-1]%10);else if((p=r((i+1)/d))>=g.length){if(!s)break e;for(;g.length<=p;g.push(0));h=f=0,a=1,l=(i%=d)-d+1}else{for(h=m=g[p],a=1;m>=10;m/=10,a++);f=(l=(i%=d)-d+a)<0?0:o(h/k[a-l-1]%10)}if(s=s||t<0||null!=g[p+1]||(l<0?h:h%k[a-l-1]),s=n<4?(f||s)&&(0==n||n==(e.s<0?3:2)):f>5||5==f&&(4==n||s||6==n&&(i>0?l>0?h/k[a-l]:0:g[p-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,s?(t-=e.e+1,g[0]=k[(d-t%d)%d],e.e=-t||0):g[0]=e.e=0,e;if(0==i?(g.length=p,m=1,p--):(g.length=p+1,m=k[d-i],g[p]=l>0?o(h/k[a-l]%k[l])*m:0),s)for(;;){if(0==p){for(i=1,l=g[0];l>=10;l/=10,i++);for(l=g[0]+=m,m=1;l>=10;l/=10,m++);i!=m&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[p]+=m,g[p]!=c)break;g[p--]=0,m=1}for(i=g.length;0===g[--i];g.pop());}e.e>B?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function Q(e){var t,n=e.e;return null===n?e.toString():(t=f(e.c),t=n<=D||n>=P?_(t,n):b(t,n,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(a+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(k(n=e[t],0,h,t),O=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(k(n=e[t],0,8,t),R=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(k(n[0],-h,0,t),k(n[1],0,h,t),D=n[0],P=n[1]):(k(n,-h,h,t),D=-(P=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)k(n[0],-h,-1,t),k(n[1],1,h,t),M=n[0],B=n[1];else{if(k(n,-h,h,t),!n)throw Error(a+t+" cannot be zero: "+n);M=-(B=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(a+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!n,Error(a+"crypto unavailable");L=n}else L=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(k(n=e[t],0,9,t),F=n),e.hasOwnProperty(t="POW_PRECISION")&&(k(n=e[t],0,h,t),U=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(a+t+" not an object: "+n);H=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(a+t+" invalid: "+n);G="0123456789"==n.slice(0,10),q=n}}return{DECIMAL_PLACES:O,ROUNDING_MODE:R,EXPONENTIAL_AT:[D,P],RANGE:[M,B],CRYPTO:L,MODULO_MODE:F,POW_PRECISION:U,FORMAT:H,ALPHABET:q}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,n,s=e.c,r=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(s)){if((1===i||-1===i)&&r>=-h&&r<=h&&r===o(r)){if(0===s[0]){if(0===r&&1===s.length)return!0;break e}if((t=(r+1)%d)<1&&(t+=d),String(s[0]).length==t){for(t=0;t<s.length;t++)if((n=s[t])<0||n>=c||n!==o(n))break e;if(0!==n)return!0}}}else if(null===s&&null===r&&(null===i||1===i||-1===i))return!0;throw Error(a+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return K(arguments,-1)},$.minimum=$.min=function(){return K(arguments,1)},$.random=(S=9007199254740992,A=Math.random()*S&2097151?function(){return o(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,s,i,c,l=0,m=[],p=new $(N);if(null==e?e=O:k(e,0,h),i=r(e/d),L)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));l<i;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[l]=n[0],t[l+1]=n[1]):(m.push(c%1e14),l+=2);l=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(a+"crypto unavailable");for(t=crypto.randomBytes(i*=7);l<i;)(c=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(m.push(c%1e14),l+=7);l=i/7}if(!L)for(;l<i;)(c=A())<9e15&&(m[l++]=c%1e14);for(i=m[--l],e%=d,i&&e&&(c=u[d-e],m[l]=o(i/c)*c);0===m[l];m.pop(),l--);if(l<0)m=[s=0];else{for(s=-1;0===m[0];m.splice(0,1),s-=d);for(l=1,c=m[0];c>=10;c/=10,l++);l<d&&(s-=d-l)}return p.e=s,p.c=m,p}),$.sum=function(){for(var e=1,t=arguments,n=new $(t[0]);e<t.length;)n=n.plus(t[e++]);return n},y=function(){var e="0123456789";function t(e,t,n,s){for(var r,o,a=[0],i=0,c=e.length;i<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=s.indexOf(e.charAt(i++)),r=0;r<a.length;r++)a[r]>n-1&&(null==a[r+1]&&(a[r+1]=0),a[r+1]+=a[r]/n|0,a[r]%=n)}return a.reverse()}return function(s,r,o,a,i){var c,d,l,u,m,h,p,g,k=s.indexOf("."),w=O,_=R;for(k>=0&&(u=U,U=0,s=s.replace(".",""),h=(g=new $(r)).pow(s.length-k),U=u,g.c=t(b(f(h.c),h.e,"0"),10,o,e),g.e=g.c.length),l=u=(p=t(s,r,o,i?(c=q,e):(c=e,q))).length;0==p[--u];p.pop());if(!p[0])return c.charAt(0);if(k<0?--l:(h.c=p,h.e=l,h.s=a,p=(h=n(h,g,w,_,o)).c,m=h.r,l=h.e),k=p[d=l+w+1],u=o/2,m=m||d<0||null!=p[d+1],m=_<4?(null!=k||m)&&(0==_||_==(h.s<0?3:2)):k>u||k==u&&(4==_||m||6==_&&1&p[d-1]||_==(h.s<0?8:7)),d<1||!p[0])s=m?b(c.charAt(1),-w,c.charAt(0)):c.charAt(0);else{if(p.length=d,m)for(--o;++p[--d]>o;)p[d]=0,d||(++l,p=[1].concat(p));for(u=p.length;!p[--u];);for(k=0,s="";k<=u;s+=c.charAt(p[k++]));s=b(s,l,c.charAt(0))}return s}}(),n=function(){function e(e,t,n){var s,r,o,a,i=0,c=e.length,d=t%m,l=t/m|0;for(e=e.slice();c--;)i=((r=d*(o=e[c]%m)+(s=l*o+(a=e[c]/m|0)*d)%m*m+i)/n|0)+(s/m|0)+l*a,e[c]=r%n;return i&&(e=[i].concat(e)),e}function t(e,t,n,s){var r,o;if(n!=s)o=n>s?1:-1;else for(r=o=0;r<n;r++)if(e[r]!=t[r]){o=e[r]>t[r]?1:-1;break}return o}function n(e,t,n,s){for(var r=0;n--;)e[n]-=r,r=e[n]<t[n]?1:0,e[n]=r*s+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(s,r,a,i,l){var u,m,h,f,g,k,w,_,b,y,E,S,A,I,T,v,C,x=s.s==r.s?1:-1,j=s.c,N=r.c;if(!(j&&j[0]&&N&&N[0]))return new $(s.s&&r.s&&(j?!N||j[0]!=N[0]:N)?j&&0==j[0]||!N?0*x:x/0:NaN);for(b=(_=new $(x)).c=[],x=a+(m=s.e-r.e)+1,l||(l=c,m=p(s.e/d)-p(r.e/d),x=x/d|0),h=0;N[h]==(j[h]||0);h++);if(N[h]>(j[h]||0)&&m--,x<0)b.push(1),f=!0;else{for(I=j.length,v=N.length,h=0,x+=2,(g=o(l/(N[0]+1)))>1&&(N=e(N,g,l),j=e(j,g,l),v=N.length,I=j.length),A=v,E=(y=j.slice(0,v)).length;E<v;y[E++]=0);C=N.slice(),C=[0].concat(C),T=N[0],N[1]>=l/2&&T++;do{if(g=0,(u=t(N,y,v,E))<0){if(S=y[0],v!=E&&(S=S*l+(y[1]||0)),(g=o(S/T))>1)for(g>=l&&(g=l-1),w=(k=e(N,g,l)).length,E=y.length;1==t(k,y,w,E);)g--,n(k,v<w?C:N,w,l),w=k.length,u=1;else 0==g&&(u=g=1),w=(k=N.slice()).length;if(w<E&&(k=[0].concat(k)),n(y,k,E,l),E=y.length,-1==u)for(;t(N,y,v,E)<1;)g++,n(y,v<E?C:N,E,l),E=y.length}else 0===u&&(g++,y=[0]);b[h++]=g,y[0]?y[E++]=j[A]||0:(y=[j[A]],E=1)}while((A++<I||null!=y[0])&&x--);f=null!=y[0],b[0]||b.splice(0,1)}if(l==c){for(h=1,x=b[0];x>=10;x/=10,h++);Y(_,a+(_.e=h+m*d-1)+1,i,f)}else _.e=m,_.r=+f;return _}}(),I=/^(-?)0([xbo])(?=\w[\w.]*$)/i,T=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,n,s){var r,o=n?t:t.replace(x,"");if(C.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(I,function(e,t,n){return r="x"==(n=n.toLowerCase())?16:"b"==n?2:8,s&&s!=r?e:t}),s&&(r=s,o=o.replace(T,"$1").replace(v,"0.$1")),t!=o))return new $(o,r);if($.DEBUG)throw Error(a+"Not a"+(s?" base "+s:"")+" number: "+t);e.s=null}e.c=e.e=null},j.absoluteValue=j.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},j.comparedTo=function(e,t){return g(this,new $(e,t))},j.decimalPlaces=j.dp=function(e,t){var n,s,r,o=this;if(null!=e)return k(e,0,h),null==t?t=R:k(t,0,8),Y(new $(o),e+o.e+1,t);if(!(n=o.c))return null;if(s=((r=n.length-1)-p(this.e/d))*d,r=n[r])for(;r%10==0;r/=10,s--);return s<0&&(s=0),s},j.dividedBy=j.div=function(e,t){return n(this,new $(e,t),O,R)},j.dividedToIntegerBy=j.idiv=function(e,t){return n(this,new $(e,t),0,1)},j.exponentiatedBy=j.pow=function(e,t){var n,s,i,c,l,u,m,h,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(a+"Exponent not an integer: "+Q(e));if(null!=t&&(t=new $(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Q(p),l?e.s*(2-w(e)):+Q(e))),t?h.mod(t):h;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(s=!u&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return c=p.s<0&&w(e)?-0:0,p.e>-1&&(c=1/c),new $(u?1/c:c);U&&(c=r(U/d+2))}for(l?(n=new $(.5),u&&(e.s=1),m=w(e)):m=(i=Math.abs(+Q(e)))%2,h=new $(N);;){if(m){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):s&&(h=h.mod(t))}if(i){if(0===(i=o(i/2)))break;m=i%2}else if(Y(e=e.times(n),e.e+1,1),e.e>14)m=w(e);else{if(0===(i=+Q(e)))break;m=i%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):s&&(p=p.mod(t))}return s?h:(u&&(h=N.div(h)),t?h.mod(t):c?Y(h,U,R,undefined):h)},j.integerValue=function(e){var t=new $(this);return null==e?e=R:k(e,0,8),Y(t,t.e+1,e)},j.isEqualTo=j.eq=function(e,t){return 0===g(this,new $(e,t))},j.isFinite=function(){return!!this.c},j.isGreaterThan=j.gt=function(e,t){return g(this,new $(e,t))>0},j.isGreaterThanOrEqualTo=j.gte=function(e,t){return 1===(t=g(this,new $(e,t)))||0===t},j.isInteger=function(){return!!this.c&&p(this.e/d)>this.c.length-2},j.isLessThan=j.lt=function(e,t){return g(this,new $(e,t))<0},j.isLessThanOrEqualTo=j.lte=function(e,t){return-1===(t=g(this,new $(e,t)))||0===t},j.isNaN=function(){return!this.s},j.isNegative=function(){return this.s<0},j.isPositive=function(){return this.s>0},j.isZero=function(){return!!this.c&&0==this.c[0]},j.minus=function(e,t){var n,s,r,o,a=this,i=a.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,a.plus(e);var l=a.e/d,u=e.e/d,m=a.c,h=e.c;if(!l||!u){if(!m||!h)return m?(e.s=-t,e):new $(h?a:NaN);if(!m[0]||!h[0])return h[0]?(e.s=-t,e):new $(m[0]?a:3==R?-0:0)}if(l=p(l),u=p(u),m=m.slice(),i=l-u){for((o=i<0)?(i=-i,r=m):(u=l,r=h),r.reverse(),t=i;t--;r.push(0));r.reverse()}else for(s=(o=(i=m.length)<(t=h.length))?i:t,i=t=0;t<s;t++)if(m[t]!=h[t]){o=m[t]<h[t];break}if(o&&(r=m,m=h,h=r,e.s=-e.s),(t=(s=h.length)-(n=m.length))>0)for(;t--;m[n++]=0);for(t=c-1;s>i;){if(m[--s]<h[s]){for(n=s;n&&!m[--n];m[n]=t);--m[n],m[s]+=c}m[s]-=h[s]}for(;0==m[0];m.splice(0,1),--u);return m[0]?V(e,m,u):(e.s=3==R?-1:1,e.c=[e.e=0],e)},j.modulo=j.mod=function(e,t){var s,r,o=this;return e=new $(e,t),!o.c||!e.s||e.c&&!e.c[0]?new $(NaN):!e.c||o.c&&!o.c[0]?new $(o):(9==F?(r=e.s,e.s=1,s=n(o,e,0,3),e.s=r,s.s*=r):s=n(o,e,0,F),(e=o.minus(s.times(e))).c[0]||1!=F||(e.s=o.s),e)},j.multipliedBy=j.times=function(e,t){var n,s,r,o,a,i,l,u,h,f,g,k,w,_,b,y=this,E=y.c,S=(e=new $(e,t)).c;if(!(E&&S&&E[0]&&S[0]))return!y.s||!e.s||E&&!E[0]&&!S||S&&!S[0]&&!E?e.c=e.e=e.s=null:(e.s*=y.s,E&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(s=p(y.e/d)+p(e.e/d),e.s*=y.s,(l=E.length)<(f=S.length)&&(w=E,E=S,S=w,r=l,l=f,f=r),r=l+f,w=[];r--;w.push(0));for(_=c,b=m,r=f;--r>=0;){for(n=0,g=S[r]%b,k=S[r]/b|0,o=r+(a=l);o>r;)n=((u=g*(u=E[--a]%b)+(i=k*u+(h=E[a]/b|0)*g)%b*b+w[o]+n)/_|0)+(i/b|0)+k*h,w[o--]=u%_;w[o]=n}return n?++s:w.splice(0,1),V(e,w,s)},j.negated=function(){var e=new $(this);return e.s=-e.s||null,e},j.plus=function(e,t){var n,s=this,r=s.s;if(t=(e=new $(e,t)).s,!r||!t)return new $(NaN);if(r!=t)return e.s=-t,s.minus(e);var o=s.e/d,a=e.e/d,i=s.c,l=e.c;if(!o||!a){if(!i||!l)return new $(r/0);if(!i[0]||!l[0])return l[0]?e:new $(i[0]?s:0*r)}if(o=p(o),a=p(a),i=i.slice(),r=o-a){for(r>0?(a=o,n=l):(r=-r,n=i),n.reverse();r--;n.push(0));n.reverse()}for((r=i.length)-(t=l.length)<0&&(n=l,l=i,i=n,t=r),r=0;t;)r=(i[--t]=i[t]+l[t]+r)/c|0,i[t]=c===i[t]?0:i[t]%c;return r&&(i=[r].concat(i),++a),V(e,i,a)},j.precision=j.sd=function(e,t){var n,s,r,o=this;if(null!=e&&e!==!!e)return k(e,1,h),null==t?t=R:k(t,0,8),Y(new $(o),e,t);if(!(n=o.c))return null;if(s=(r=n.length-1)*d+1,r=n[r]){for(;r%10==0;r/=10,s--);for(r=n[0];r>=10;r/=10,s++);}return e&&o.e+1>s&&(s=o.e+1),s},j.shiftedBy=function(e){return k(e,-9007199254740991,l),this.times("1e"+e)},j.squareRoot=j.sqrt=function(){var e,t,s,r,o,a=this,i=a.c,c=a.s,d=a.e,l=O+4,u=new $("0.5");if(1!==c||!i||!i[0])return new $(!c||c<0&&(!i||i[0])?NaN:i?a:1/0);if(0==(c=Math.sqrt(+Q(a)))||c==1/0?(((t=f(i)).length+d)%2==0&&(t+="0"),c=Math.sqrt(+t),d=p((d+1)/2)-(d<0||d%2),s=new $(t=c==1/0?"5e"+d:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+d)):s=new $(c+""),s.c[0])for((c=(d=s.e)+l)<3&&(c=0);;)if(o=s,s=u.times(o.plus(n(a,o,l,1))),f(o.c).slice(0,c)===(t=f(s.c)).slice(0,c)){if(s.e<d&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(r||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Y(s,s.e+O+2,1),e=!s.times(s).eq(a));break}if(!r&&(Y(o,o.e+O+2,0),o.times(o).eq(a))){s=o;break}l+=4,c+=4,r=1}return Y(s,s.e+O+1,R,e)},j.toExponential=function(e,t){return null!=e&&(k(e,0,h),e++),W(this,e,t,1)},j.toFixed=function(e,t){return null!=e&&(k(e,0,h),e=e+this.e+1),W(this,e,t)},j.toFormat=function(e,t,n){var s,r=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=H;else if("object"!=typeof n)throw Error(a+"Argument not an object: "+n);if(s=r.toFixed(e,t),r.c){var o,i=s.split("."),c=+n.groupSize,d=+n.secondaryGroupSize,l=n.groupSeparator||"",u=i[0],m=i[1],h=r.s<0,p=h?u.slice(1):u,f=p.length;if(d&&(o=c,c=d,d=o,f-=o),c>0&&f>0){for(o=f%c||c,u=p.substr(0,o);o<f;o+=c)u+=l+p.substr(o,c);d>0&&(u+=l+p.slice(o)),h&&(u="-"+u)}s=m?u+(n.decimalSeparator||"")+((d=+n.fractionGroupSize)?m.replace(new RegExp("\\d{"+d+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):m):u}return(n.prefix||"")+s+(n.suffix||"")},j.toFraction=function(e){var t,s,r,o,i,c,l,m,h,p,g,k,w=this,_=w.c;if(null!=e&&(!(l=new $(e)).isInteger()&&(l.c||1!==l.s)||l.lt(N)))throw Error(a+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Q(l));if(!_)return new $(w);for(t=new $(N),h=s=new $(N),r=m=new $(N),k=f(_),i=t.e=k.length-w.e-1,t.c[0]=u[(c=i%d)<0?d+c:c],e=!e||l.comparedTo(t)>0?i>0?t:h:l,c=B,B=1/0,l=new $(k),m.c[0]=0;p=n(l,t,0,1),1!=(o=s.plus(p.times(r))).comparedTo(e);)s=r,r=o,h=m.plus(p.times(o=h)),m=o,t=l.minus(p.times(o=t)),l=o;return o=n(e.minus(s),r,0,1),m=m.plus(o.times(h)),s=s.plus(o.times(r)),m.s=h.s=w.s,g=n(h,r,i*=2,R).minus(w).abs().comparedTo(n(m,s,i,R).minus(w).abs())<1?[h,r]:[m,s],B=c,g},j.toNumber=function(){return+Q(this)},j.toPrecision=function(e,t){return null!=e&&k(e,1,h),W(this,e,t,2)},j.toString=function(e){var t,n=this,s=n.s,r=n.e;return null===r?s?(t="Infinity",s<0&&(t="-"+t)):t="NaN":(null==e?t=r<=D||r>=P?_(f(n.c),r):b(f(n.c),r,"0"):10===e&&G?t=b(f((n=Y(new $(n),O+r+1,R)).c),n.e,"0"):(k(e,2,q.length,"Base"),t=y(b(f(n.c),r,"0"),10,e,s,!0)),s<0&&n.c[0]&&(t="-"+t)),t},j.valueOf=j.toJSON=function(){return Q(this)},j._isBigNumber=!0,null!=t&&$.set(t),$}(),n.default=n.BigNumber=n,"function"==typeof define&&define.amd?define(function(){return n}):void 0!==t&&t.exports?t.exports=n:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=n)}(this)}}},{package:"@metamask/bridge-status-controller>bignumber.js",file:"node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/browser-passworder/dist/index.js",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.isVaultUpdated=n.updateVaultWithDetail=n.updateVault=n.generateSalt=n.serializeBufferForStorage=n.serializeBufferFromStorage=n.keyFromPassword=n.exportKey=n.importKey=n.decryptWithKey=n.decryptWithDetail=n.decrypt=n.encryptWithKey=n.encryptWithDetail=n.encrypt=void 0;const s=e("@metamask/utils"),r="jwk",o="AES-GCM",a="utf-8",i={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function d(e,t,n,s=g(),r=c){const o=n||await f(e,s,!1,r),a=await u(o,t);return a.salt=s,JSON.stringify(a)}async function l(e,t,n=g(),s=c){const r=await f(e,n,!0,s),o=await p(r);return{vault:await d(e,t,r,n),exportedKeyString:o}}async function u(e,n){const s=JSON.stringify(n),r=t.from(s,a),i=globalThis.crypto.getRandomValues(new Uint8Array(16)),c=_(e),d=await globalThis.crypto.subtle.encrypt({name:o,iv:i},c,r),l=new Uint8Array(d),u=t.from(i).toString("base64"),m={data:t.from(l).toString("base64"),iv:u};return k(e)&&(m.keyMetadata=e.derivationOptions),m}async function m(e,t,n){const s=JSON.parse(t),{salt:r,keyMetadata:o}=s,a=_(n||await f(e,r,!1,o));return await h(a,s)}async function h(e,n){const s=t.from(n.data,"base64"),r=t.from(n.iv,"base64"),i=_(e);let c;try{const e=await crypto.subtle.decrypt({name:o,iv:r},i,s),n=new Uint8Array(e),d=t.from(n).toString(a);c=JSON.parse(d)}catch(e){throw new Error("Incorrect password")}return c}async function p(e){return k(e)?JSON.stringify({key:await globalThis.crypto.subtle.exportKey(r,e.key),derivationOptions:e.derivationOptions}):JSON.stringify(await globalThis.crypto.subtle.exportKey(r,e))}async function f(e,n,s=!1,r=i){const c=t.from(e,a),d=t.from(n,"base64"),l=await globalThis.crypto.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),u=await globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:d,iterations:r.params.iterations,hash:"SHA-256"},l,{name:o,length:256},s,["encrypt","decrypt"]);return r?{key:u,derivationOptions:r}:u}function g(e=32){const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);return btoa(String.fromCharCode.apply(null,t))}function k(e){return(0,s.isPlainObject)(e)&&(0,s.hasProperty)(e,"key")&&(0,s.hasProperty)(e,"derivationOptions")&&e.key instanceof CryptoKey&&w(e.derivationOptions)}function w(e){return(0,s.isPlainObject)(e)&&(0,s.hasProperty)(e,"algorithm")&&(0,s.hasProperty)(e,"params")}function _(e){return k(e)?e.key:e}function b(e,t=c){const{keyMetadata:n}=JSON.parse(e);return w(n)&&n.algorithm===t.algorithm&&n.params.iterations===t.params.iterations}n.encrypt=d,n.encryptWithDetail=l,n.encryptWithKey=u,n.decrypt=m,n.decryptWithDetail=async function(e,t){const n=JSON.parse(t),{salt:s,keyMetadata:r}=n,o=await f(e,s,!0,r);return{exportedKeyString:await p(o),vault:await m(e,t,o),salt:s}},n.decryptWithKey=h,n.importKey=async function(e){const t=JSON.parse(e);return n=t,(0,s.isPlainObject)(n)&&(0,s.hasProperty)(n,"key")&&(0,s.hasProperty)(n,"derivationOptions")&&w(n.derivationOptions)?{key:await globalThis.crypto.subtle.importKey(r,t.key,o,!0,["encrypt","decrypt"]),derivationOptions:t.derivationOptions}:await globalThis.crypto.subtle.importKey(r,t,o,!0,["encrypt","decrypt"]);var n},n.exportKey=p,n.keyFromPassword=f,n.serializeBufferFromStorage=function(e){const t="0x"===e.slice(0,2)?e.slice(2):e,n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const s=t.substr(e,2);n[e/2]=parseInt(s,16)}return n},n.serializeBufferForStorage=function(e){let t="0x";return e.forEach(e=>{t+=function(e){let t=e.toString(16);for(;t.length<2;)t=`0${t}`;return t}(e)}),t},n.generateSalt=g,n.updateVault=async function(e,t,n=c){return b(e,n)?e:d(t,await m(t,e),undefined,undefined,n)},n.updateVaultWithDetail=async function(e,t,n=c){return b(e.vault,n)?e:l(t,await m(t,e.vault),undefined,n)},n.isVaultUpdated=b}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/browser-passworder",file:"node_modules/@metamask/browser-passworder/dist/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},a=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=n.controllerName=void 0;const i=e("@metamask/base-controller"),c=e("@metamask/keyring-controller"),d=e("@metamask/utils"),l=e("./constants.cjs"),u=e("./utils.cjs");n.controllerName="DelegationController";const m={delegations:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};class h extends i.BaseController{constructor({messenger:e,state:t,hashDelegation:a,getDelegationEnvironment:i}){super({messenger:e,metadata:m,name:n.controllerName,state:{delegations:{},...t}}),s.set(this,void 0),r.set(this,void 0),o(this,s,a,"f"),o(this,r,i,"f")}async signDelegation(e){const{delegation:t,chainId:n}=e,{DelegationManager:s}=a(this,r,"f").call(this,n),o=(0,u.createTypedMessageParams)({chainId:(0,d.hexToNumber)(n),from:t.delegator,delegation:{...t,signature:"0x"},verifyingContract:s});return await this.messenger.call("KeyringController:signTypedMessage",o,c.SignTypedDataVersion.V4)}store(e){const{entry:t}=e,n=a(this,s,"f").call(this,t.delegation);if(!(0,u.isHexEqual)(t.delegation.authority,l.ROOT_AUTHORITY)&&!this.state.delegations[t.delegation.authority])throw new Error("Invalid authority");this.update(e=>{e.delegations[n]=t})}list(e){const t=this.messenger.call("AccountsController:getSelectedAccount").address;let n=Object.values(this.state.delegations);e?.from&&(n=n.filter(t=>(0,u.isHexEqual)(t.delegation.delegator,e.from))),(!e?.from||e?.from&&!(0,u.isHexEqual)(e.from,t))&&(n=n.filter(e=>(0,u.isHexEqual)(e.delegation.delegate,t)));const s=e?.chainId;s&&(n=n.filter(e=>(0,u.isHexEqual)(e.chainId,s)));const r=e?.tags;return r&&r.length>0&&(n=n.filter(e=>r.every(t=>e.tags.includes(t)))),n}retrieve(e){return this.state.delegations[e]??null}chain(e){const t=[],n=this.retrieve(e);if(!n)return null;t.push(n);for(let e=n.delegation.authority;e!==l.ROOT_AUTHORITY;){const n=this.retrieve(e);if(!n)throw new Error("Invalid delegation chain");t.push(n),e=n.delegation.authority}return t}delete(e){if(!this.retrieve(e))return 0;const t=Object.entries(this.state.delegations),n=[e],s=[];for(;n.length>0;){const e=n.pop();t.filter(([t,n])=>n.delegation.authority===e).forEach(([e])=>{n.push(e)}),s.push(e)}return this.update(e=>{s.forEach(t=>{delete e.delegations[t]})}),s.length}}n.DelegationController=h,s=new WeakMap,r=new WeakMap}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SIGNABLE_DELEGATION_TYPED_DATA=n.ROOT_AUTHORITY=void 0,n.ROOT_AUTHORITY="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";n.SIGNABLE_DELEGATION_TYPED_DATA={EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Caveat:[{name:"enforcer",type:"address"},{name:"terms",type:"bytes"}],Delegation:[{name:"delegate",type:"address"},{name:"delegator",type:"address"},{name:"authority",type:"bytes32"},{name:"caveats",type:"Caveat[]"},{name:"salt",type:"uint256"}]}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/index.cjs",{"./DelegationController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=void 0;var s=e("./DelegationController.cjs");Object.defineProperty(n,"DelegationController",{enumerable:!0,get:function(){return s.DelegationController}})}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createTypedMessageParams=n.toDelegationStruct=n.isHexEqual=void 0;const s=e("@metamask/utils"),r=e("./constants.cjs");n.isHexEqual=function(e,t){return e.toLowerCase()===t.toLowerCase()};n.toDelegationStruct=e=>{const t=e.caveats.map(e=>({enforcer:(0,s.getChecksumAddress)(e.enforcer),terms:e.terms,args:e.args})),n="0x"===e.salt?0n:BigInt(e.salt);return{delegate:(0,s.getChecksumAddress)(e.delegate),delegator:(0,s.getChecksumAddress)(e.delegator),authority:e.authority,caveats:t,salt:n,signature:e.signature}},n.createTypedMessageParams=function(e){const{chainId:t,from:s,delegation:o,verifyingContract:a}=e;return{data:{types:r.SIGNABLE_DELEGATION_TYPED_DATA,primaryType:"Delegation",domain:{chainId:t,name:"DelegationManager",version:"1",verifyingContract:a},message:(0,n.toDelegationStruct)(o)},from:s}}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-deployments/dist/index.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var s={DelegationManager:"0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c",MultiSigDeleGatorImpl:"0x56a9EdB16a0105eb5a4C54f4C062e2868844f3A7",HybridDeleGatorImpl:"0x48dBe696A4D990079e039489bA2053B36E8FFEC4",EIP7702StatelessDeleGatorImpl:"0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B",AllowedCalldataEnforcer:"0xc2b0d624c1c4319760C96503BA27C347F3260f55",AllowedMethodsEnforcer:"0x2c21fD0Cb9DC8445CB3fb0DC5E7Bb0Aca01842B5",AllowedTargetsEnforcer:"0x7F20f61b1f09b08D970938F6fa563634d65c4EeB",BlockNumberEnforcer:"0x5d9818dF0AE3f66e9c3D0c5029DAF99d1823ca6c",DeployedEnforcer:"0x24ff2AA430D53a8CD6788018E902E098083dcCd2",ERC20BalanceChangeEnforcer:"0xcdF6aB796408598Cea671d79506d7D48E97a5437",ERC20TransferAmountEnforcer:"0xf100b0819427117EcF76Ed94B358B1A5b5C6D2Fc",ERC20PeriodTransferEnforcer:"0x474e3Ae7E169e940607cC624Da8A15Eb120139aB",ERC20StreamingEnforcer:"0x56c97aE02f233B29fa03502Ecc0457266d9be00e",ERC721BalanceChangeEnforcer:"0x8aFdf96eDBbe7e1eD3f5Cd89C7E084841e12A09e",ERC721TransferEnforcer:"0x3790e6B7233f779b09DA74C72b6e94813925b9aF",ERC1155BalanceChangeEnforcer:"0x63c322732695cAFbbD488Fc6937A0A7B66fC001A",ExactCalldataBatchEnforcer:"0x982FD5C86BBF425d7d1451f974192d4525113DfD",ExactCalldataEnforcer:"0x99F2e9bF15ce5eC84685604836F71aB835DBBdED",ExactExecutionBatchEnforcer:"0x1e141e455d08721Dd5BCDA1BaA6Ea5633Afd5017",ExactExecutionEnforcer:"0x146713078D39eCC1F5338309c28405ccf85Abfbb",IdEnforcer:"0xC8B5D93463c893401094cc70e66A206fb5987997",LimitedCallsEnforcer:"0x04658B29F6b82ed55274221a06Fc97D318E25416",NativeBalanceChangeEnforcer:"0xbD7B277507723490Cd50b12EaaFe87C616be6880",ArgsEqualityCheckEnforcer:"0x44B8C6ae3C304213c3e298495e12497Ed3E56E41",NativeTokenPaymentEnforcer:"0x4803a326ddED6dDBc60e659e5ed12d85c7582811",NativeTokenTransferAmountEnforcer:"0xF71af580b9c3078fbc2BBF16FbB8EEd82b330320",NativeTokenStreamingEnforcer:"0xD10b97905a320b13a0608f7E9cC506b56747df19",NativeTokenPeriodTransferEnforcer:"0x9BC0FAf4Aca5AE429F4c06aEEaC517520CB16BD9",NonceEnforcer:"0xDE4f2FAC4B3D87A1d9953Ca5FC09FCa7F366254f",OwnershipTransferEnforcer:"0x7EEf9734E7092032B5C56310Eb9BbD1f4A524681",RedeemerEnforcer:"0xE144b0b2618071B4E56f746313528a669c7E65c5",SpecificActionERC20TransferBatchEnforcer:"0x6649b61c873F6F9686A1E1ae9ee98aC380c7bA13",TimestampEnforcer:"0x1046bb45C8d673d4ea75321280DB34899413c069",ValueLteEnforcer:"0x92Bf12322527cAA612fd31a0e810472BBB106A8F",MultiTokenPeriodEnforcer:"0xFB2f1a9BD76d3701B730E5d69C3219D42D80eBb7"},r={DelegationManager:"0x56D56e07e3d6Ee5a24e30203A37a0a460f42D7A3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x6ff518884f21168c30c58CB21184D6AdBC18Ad90",MultiSigDeleGatorImpl:"0xd1f421EDbA5e3FA9efe3874827114b20C5BEC40C",HybridDeleGatorImpl:"0x941f3a016F8726d5643Ce62452d0D78492D42b42",AllowedCalldataEnforcer:"0xff71d60f3208469cBCE0859717B5198042DCB3F3",AllowedMethodsEnforcer:"0xe32C2561792e8446Abe73B9f557B881C13906186",AllowedTargetsEnforcer:"0x06aaE4c67EEA95277c46Bf79b1583d4a01772D22",BlockNumberEnforcer:"0x8E470D2Ae278457b42d2405E0B8Cd4BE21Ed9045",DeployedEnforcer:"0xf9088f013dBD9ebb7Cebd66fEB48253c6Ac5a820",ERC20BalanceGteEnforcer:"0xB7B6f32ec6343261D814e55Ed8C5925d91Cab861",ERC20TransferAmountEnforcer:"0x9A069b18032B31429A363AeCFb1B6A0564b44471",IdEnforcer:"0x91015c3b9D9523966eD2399885e5Df7A567f916c",LimitedCallsEnforcer:"0xe694bFfffEA3E85923b1210b37e6a0175e910863",NonceEnforcer:"0xE83BCFD8bBE672A96747e831050a91cf44F4F87A",TimestampEnforcer:"0x550FdD13eEBC1f22ea2a2480024BacBF0Ad7e5CE",ValueLteEnforcer:"0xBE32a6DB7471F63BB168C088c57Db01AfAe87967",NativeTokenTransferAmountEnforcer:"0x5eD3833d7B957A8DB8A461c3AF2d668Ec25382E0",NativeBalanceGteEnforcer:"0x376a98860E210DdEda3689fb39565592c563cB0A",ArgsEqualityCheckEnforcer:"0x7378dE585998d3E18Ce147867C335C25B3dB8Ee5",NativeTokenPaymentEnforcer:"0x87Fe18EbF99e42fcE8A03a25F1d20E119407f8e7",RedeemerEnforcer:"0x926672b130D1EF60A9d6b11D2048d121b30f40C1"},o={DelegationManager:"0xbe4138886cb096bdc1b930f2f0ca7892aa234d78",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x6ff518884f21168c30c58CB21184D6AdBC18Ad90",MultiSigDeleGatorImpl:"0x11f555af5844d85bfcf5d61d2a22866527eb585a",HybridDeleGatorImpl:"0xd6edd1256deccb2b06bdecef92dc16bcf26e531b",AllowedCalldataEnforcer:"0x48db3835a873d64a4af2c09f014052407c003bd7",AllowedMethodsEnforcer:"0xfd731951bf1c52afccee3e6f14ab656475b76dd4",AllowedTargetsEnforcer:"0xbc8673c0afa52d86d991c06881e55b2966920564",BlockNumberEnforcer:"0xc15faffa0d879b9263c15a46ce31eacfa2e0e8ae",DeployedEnforcer:"0x5accb9559b56a6c1e3f90e342c85c42d93720d43",ERC20BalanceGteEnforcer:"0xb5d6b1ec6d868a3bae5b7f48178eaa2686a7a087",ERC20TransferAmountEnforcer:"0x92ac423b9c111962179a6242e1adb58d02c103be",IdEnforcer:"0x34152d9f3f8f74338d50703e780389e829b4abac",LimitedCallsEnforcer:"0x4b3adad4a328bee8ba17b86074d92fe7372180cd",NonceEnforcer:"0x2f32ff3fc3086d7f63f16fe8d0065390d460b40d",TimestampEnforcer:"0x78e05f779490c24bf3bfa135b4112e7003b321cd",ValueLteEnforcer:"0xfc20ede0a1132e839fbda9d7ed3904ff3c89540f"},a={arbitrum:42161,arbitrumNova:42170,base:8453,berachain:80094,bsc:56,gnosis:100,ink:57073,linea:59144,mainnet:1,monad:143,optimism:10,polygon:137,sei:1329,sonic:146,unichain:130,bscTestnet:97,arbitrumSepolia:421614,baseSepolia:84532,berachainBepolia:80069,chiado:10200,citreaTestnet:5115,hoodiTestnet:560048,inkSepolia:763373,lineaSepolia:59141,megaEthTestnet:6342,monadTestnet:10143,optimismSepolia:11155420,polygonAmoy:80002,seiTestnet:1328,sepolia:11155111,sonicTestnet:14601,unichainSepolia:1301,lineaGoerli:59140},i={"1.0.0":{[a.optimism]:o,[a.polygon]:o,[a.base]:o,[a.arbitrum]:o,[a.linea]:o,[a.sepolia]:{...o,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"},[a.lineaSepolia]:{...o,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"}},"1.1.0":{[a.arbitrum]:r,[a.base]:r,[a.linea]:r,[a.optimism]:r,[a.polygon]:r,[a.sepolia]:r,[a.lineaSepolia]:r,[a.baseSepolia]:{...r,SimpleFactory:"0xE8eA1DE8D6AfE400B7C8C1A81B7C29B7876b4d02"}},"1.3.0":{[a.mainnet]:s,[a.polygon]:s,[a.bsc]:s,[a.optimism]:s,[a.arbitrum]:s,[a.ink]:s,[a.linea]:s,[a.base]:s,[a.gnosis]:s,[a.berachain]:s,[a.unichain]:s,[a.arbitrumNova]:s,[a.sei]:s,[a.sonic]:s,[a.monad]:s,[a.bscTestnet]:s,[a.citreaTestnet]:s,[a.megaEthTestnet]:s,[a.chiado]:s,[a.lineaSepolia]:s,[a.berachainBepolia]:s,[a.baseSepolia]:s,[a.arbitrumSepolia]:s,[a.sepolia]:s,[a.optimismSepolia]:s,[a.unichainSepolia]:s,[a.polygonAmoy]:s,[a.inkSepolia]:s,[a.monadTestnet]:s,[a.seiTestnet]:s,[a.sonicTestnet]:s,[a.hoodiTestnet]:s}};n.CHAIN_ID=a,n.DELEGATOR_CONTRACTS=i}}},{package:"@metamask/delegation-deployments",file:"node_modules/@metamask/delegation-deployments/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.GetCallsStatusCode=n.EIP7682ErrorCode=n.EIP5792ErrorCode=n.SupportedCapabilities=n.MessageType=n.KEYRING_TYPES_SUPPORTING_7702=n.VERSION=void 0;const s=e("@metamask/keyring-controller");var r,o,a,i,c;n.VERSION="2.0.0",n.KEYRING_TYPES_SUPPORTING_7702=[s.KeyringTypes.hd,s.KeyringTypes.simple],function(e){e.SendTransaction="eth_sendTransaction"}(r||(n.MessageType=r={})),function(e){e.AuxiliaryFunds="auxiliaryFunds"}(o||(n.SupportedCapabilities=o={})),function(e){e[e.UnsupportedNonOptionalCapability=5700]="UnsupportedNonOptionalCapability",e[e.UnsupportedChainId=5710]="UnsupportedChainId",e[e.UnknownBundleId=5730]="UnknownBundleId",e[e.RejectedUpgrade=5750]="RejectedUpgrade"}(a||(n.EIP5792ErrorCode=a={})),function(e){e[e.UnsupportedAsset=5771]="UnsupportedAsset",e[e.UnsupportedChain=5772]="UnsupportedChain",e[e.MalformedRequiredAssets=5773]="MalformedRequiredAssets"}(i||(n.EIP7682ErrorCode=i={})),function(e){e[e.PENDING=100]="PENDING",e[e.CONFIRMED=200]="CONFIRMED",e[e.FAILED_OFFCHAIN=400]="FAILED_OFFCHAIN",e[e.REVERTED=500]="REVERTED",e[e.REVERTED_PARTIAL=600]="REVERTED_PARTIAL"}(c||(n.GetCallsStatusCode=c={}))}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCallsStatus=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/transaction-controller"),o=e("../constants.cjs");n.getCallsStatus=function(e,t){const n=e.call("TransactionController:getState").transactions.filter(e=>e.batchId===t);if(!n?.length)throw new s.JsonRpcError(o.EIP5792ErrorCode.UnknownBundleId,"No matching bundle found");const a=n[0],{chainId:i,txReceipt:c}=a,d=function(e){const{hash:t,status:n}=e;if(n===r.TransactionStatus.confirmed)return o.GetCallsStatusCode.CONFIRMED;if(n===r.TransactionStatus.failed)return t?o.GetCallsStatusCode.REVERTED:o.GetCallsStatusCode.FAILED_OFFCHAIN;if(n===r.TransactionStatus.dropped)return o.GetCallsStatusCode.REVERTED;return o.GetCallsStatusCode.PENDING}(a),l=c,u=l?.logs??[],m=l&&[{blockHash:l.blockHash,blockNumber:l.blockNumber,gasUsed:l.gasUsed,logs:u.map(e=>({address:e.address,data:e.data,topics:e.topics})),status:l.status,transactionHash:l.transactionHash}];return{version:o.VERSION,id:t,chainId:i,atomic:!0,status:d,receipts:m}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCapabilities=void 0;const s=e("../constants.cjs"),r=e("../utils.cjs");n.getCapabilities=async function(e,t,n,o){const{getDismissSmartAccountSuggestionEnabled:a,getIsSmartTransaction:i,isAtomicBatchSupported:c,isRelaySupported:d,getSendBundleSupportedChains:l,isAuxiliaryFundsSupported:u}=e;let m=o?.map(e=>e.toLowerCase());if(!m?.length){const e=t.call("NetworkController:getState").networkConfigurationsByChainId;m=Object.keys(e)}const h=await c({address:n,chainIds:m}),p=await async function(e,t,n,s,r,o){const a=o.call("PreferencesController:getState").useTransactionSimulations,i=await Promise.all(t.map(({chainId:e})=>e).map(e=>s(e))),c=await r(e),d=t.map((e,t)=>({...e,relaySupportedForChain:i[t]}));return e.reduce((e,t)=>{const s=d.find(({chainId:e})=>e===t)??{},{isSupported:r=!1,relaySupportedForChain:o}=s,i=n(t),l=c[t]??!1;return a&&(i&&l||r&&o)&&(e[t]={alternateGasFees:{supported:!0}}),e},{})}(m,h,i,d,l,t);return m.reduce((e,o)=>{const i=h.find(({chainId:e})=>e===o)??{},{delegationAddress:c,isSupported:d,upgradeContractAddress:l}=i,m=a();let p=!1;try{const e=(0,r.getAccountKeyringType)(n,t);p=s.KEYRING_TYPES_SUPPORTING_7702.includes(e)}catch{}if(!d&&!(!m&&l&&!c&&p))return e;const f=d?"supported":"ready",g=o;return e[g]===undefined&&(e[g]={}),e[g].atomic={status:f},p&&u(o)&&(e[g].auxiliaryFunds={supported:!0}),e},p)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.processSendCalls=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/transaction-controller"),o=e("@metamask/utils"),a=e("lodash"),i=e("uuid"),c=e("../constants.cjs"),d=e("../utils.cjs");function l(e){const{version:t}=e;if(t!==c.VERSION)throw s.rpcErrors.invalidInput(`Version not supported: Got ${t}, expected ${c.VERSION}`)}function u(e,t){const{chainId:n}=e;if(n&&n.toLowerCase()!==t.toLowerCase())throw s.rpcErrors.invalidParams(`Chain ID must match the dApp selected network: Got ${n}, expected ${t}`)}function m(e,t,n){const{calls:r,capabilities:o,chainId:a}=e,i=[...Object.keys(o??{}).filter(e=>e!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==o?.[e].optional),...r.flatMap(e=>Object.keys(e.capabilities??{}).filter(t=>t!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==e.capabilities?.[t].optional))];if(i?.length)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capabilities: ${i.join(", ")}`);o?.auxiliaryFunds&&function({auxiliaryFunds:e,chainId:t,keyringType:n,isAuxiliaryFundsSupported:r}){if(e.optional)return;const o=c.KEYRING_TYPES_SUPPORTING_7702.includes(n);if(!o)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capability: ${c.SupportedCapabilities.AuxiliaryFunds}`);if(!r(t))throw new s.JsonRpcError(c.EIP7682ErrorCode.UnsupportedChain,`The wallet no longer supports auxiliary funds on the requested chain: ${t}`);if(!e?.requiredAssets)return;for(const t of e.requiredAssets)if("erc20"!==t.standard)throw new s.JsonRpcError(c.EIP7682ErrorCode.UnsupportedAsset,`The requested asset ${t.address} is not available through the wallet’s auxiliary fund system: unsupported token standard ${t.standard}`)}({auxiliaryFunds:o.auxiliaryFunds,chainId:a,keyringType:t,isAuxiliaryFundsSupported:n})}function h(e){if(e.capabilities?.auxiliaryFunds?.requiredAssets){const{requiredAssets:t}=e.capabilities.auxiliaryFunds,n=(0,a.groupBy)(t,e=>`${e.address.toLowerCase()}-${e.standard}`),s=Object.values(n).map(e=>{if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+BigInt(t.amount),0n);return{...e[0],amount:(0,o.add0x)(t.toString(16))}});e.capabilities.auxiliaryFunds.requiredAssets=s}}n.processSendCalls=async function(e,t,n,a){const{addTransactionBatch:p,addTransaction:f,getDismissSmartAccountSuggestionEnabled:g,isAtomicBatchSupported:k,validateSecurity:w,isAuxiliaryFundsSupported:_}=e,{calls:b,from:y}=n,{networkClientId:E,origin:S}=a,A=b.map(e=>({params:e})),{chainId:I}=t.call("NetworkController:getNetworkClientById",E).configuration,T=y??t.call("AccountsController:getSelectedAccount").address,v=(0,i.v4)(),C=w.bind(null,v),x=a.id?String(a.id):"";let j;return j=1===Object.keys(A).length?await async function({addTransaction:e,chainId:t,from:n,messenger:s,networkClientId:a,origin:p,requestId:f,securityAlertId:g,sendCalls:k,transactions:w,validateSecurity:_,isAuxiliaryFundsSupported:b}){const y=(0,d.getAccountKeyringType)(n,s);!function(e,t,n,s){l(e),m(e,n,s),u(e,t)}(k,t,y,b);const E={from:n,...w[0].params,type:r.TransactionEnvelopeType.feeMarket},S={method:c.MessageType.SendTransaction,params:[E],origin:p};_(S,t),h(k);const A=function(){const e=(0,i.v4)(),t=new Uint8Array((0,i.parse)(e));return(0,o.bytesToHex)(t)}();return await e(E,{requestId:f,networkClientId:a,origin:p,securityAlertResponse:{securityAlertId:g},batchId:A}),A}({addTransaction:f,chainId:I,from:T,messenger:t,networkClientId:E,origin:S,requestId:x,securityAlertId:v,sendCalls:n,transactions:A,validateSecurity:C,isAuxiliaryFundsSupported:_}):await async function({addTransactionBatch:e,isAtomicBatchSupported:t,chainId:n,from:r,getDismissSmartAccountSuggestionEnabled:o,networkClientId:a,messenger:i,origin:p,requestId:f,sendCalls:g,securityAlertId:k,transactions:w,validateSecurity:_,isAuxiliaryFundsSupported:b}){const y=await t({address:r,chainIds:[n]}),E=y?.[0],S=(0,d.getAccountKeyringType)(r,i),A=o();(function(e,t,n,r,o,a){l(e),function(e,t,n){if(u(e,t),!n)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedChainId,`EIP-7702 not supported on chain: ${t}`)}(e,t,r),m(e,o,a),function(e,t,n){if(t?.delegationAddress)return;if(e)throw new s.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade disabled by the user");if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(n))throw new s.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported on account")}(n,r,o)})(g,n,A,E,S,b),h(g);const I=await e({from:r,networkClientId:a,origin:p,requestId:f,securityAlertId:k,transactions:w,validateSecurity:_});return I.batchId}({addTransactionBatch:p,isAtomicBatchSupported:k,chainId:I,from:T,getDismissSmartAccountSuggestionEnabled:g,messenger:t,networkClientId:E,origin:S,requestId:x,sendCalls:n,securityAlertId:v,transactions:A,validateSecurity:C,isAuxiliaryFundsSupported:_}),{id:j}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/index.cjs",{"./hooks/getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs","./hooks/getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs","./hooks/processSendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs","./methods/wallet_getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs","./methods/wallet_getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs","./methods/wallet_sendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCapabilities=n.walletGetCallsStatus=n.walletSendCalls=n.getCapabilities=n.getCallsStatus=n.processSendCalls=void 0;var s=e("./hooks/processSendCalls.cjs");Object.defineProperty(n,"processSendCalls",{enumerable:!0,get:function(){return s.processSendCalls}});var r=e("./hooks/getCallsStatus.cjs");Object.defineProperty(n,"getCallsStatus",{enumerable:!0,get:function(){return r.getCallsStatus}});var o=e("./hooks/getCapabilities.cjs");Object.defineProperty(n,"getCapabilities",{enumerable:!0,get:function(){return o.getCapabilities}});var a=e("./methods/wallet_sendCalls.cjs");Object.defineProperty(n,"walletSendCalls",{enumerable:!0,get:function(){return a.walletSendCalls}});var i=e("./methods/wallet_getCallsStatus.cjs");Object.defineProperty(n,"walletGetCallsStatus",{enumerable:!0,get:function(){return i.walletGetCallsStatus}});var c=e("./methods/wallet_getCapabilities.cjs");Object.defineProperty(n,"walletGetCapabilities",{enumerable:!0,get:function(){return c.walletGetCapabilities}})}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCallsStatus=void 0;const s=e("@metamask/rpc-errors"),r=e("../types.cjs"),o=e("../utils.cjs");n.walletGetCallsStatus=async function(e,t,{getCallsStatus:n}){if(!n)throw s.rpcErrors.methodNotSupported();(0,o.validateParams)(e.params,r.GetCallsStatusStruct);const a=e.params[0];t.result=await n(a,e)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCapabilities=void 0;const s=e("@metamask/rpc-errors"),r=e("../types.cjs"),o=e("../utils.cjs");n.walletGetCapabilities=async function(e,t,{getAccounts:n,getCapabilities:a}){if(!a)throw s.rpcErrors.methodNotSupported();(0,o.validateParams)(e.params,r.GetCapabilitiesStruct);const i=e.params[0],c=e.params[1];await(0,o.validateAndNormalizeKeyholder)(i,e,{getAccounts:n});const d=await a(i,c,e);t.result=d}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletSendCalls=void 0;const s=e("@metamask/rpc-errors"),r=e("../types.cjs"),o=e("../utils.cjs");n.walletSendCalls=async function(e,t,{getAccounts:n,processSendCalls:a}){if(!a)throw s.rpcErrors.methodNotSupported();(0,o.validateParams)(e.params,r.SendCallsStruct);const i=e.params[0],c=i.from?await(0,o.validateAndNormalizeKeyholder)(i.from,e,{getAccounts:n}):undefined,d={...i,from:c};t.result=await a(d,e)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SendCallsStruct=n.CapabilitiesStruct=n.GetCapabilitiesStruct=n.GetCallsStatusStruct=void 0;const s=e("@metamask/superstruct"),r=e("@metamask/utils");n.GetCallsStatusStruct=(0,s.tuple)([r.StrictHexStruct]),n.GetCapabilitiesStruct=(0,s.tuple)([r.HexChecksumAddressStruct,(0,s.optional)((0,s.array)(r.StrictHexStruct))]);const o=(0,s.type)({address:(0,s.nonempty)(r.HexChecksumAddressStruct),amount:(0,s.nonempty)(r.StrictHexStruct),standard:(0,s.nonempty)((0,s.string)())});n.CapabilitiesStruct=(0,s.record)((0,s.string)(),(0,s.type)({optional:(0,s.optional)((0,s.boolean)()),requiredAssets:(0,s.optional)((0,s.array)(o))})),n.SendCallsStruct=(0,s.tuple)([(0,s.object)({version:(0,s.nonempty)((0,s.string)()),id:(0,s.optional)(r.StrictHexStruct),from:(0,s.optional)(r.HexChecksumAddressStruct),chainId:r.StrictHexStruct,atomicRequired:(0,s.boolean)(),calls:(0,s.array)((0,s.object)({to:(0,s.optional)(r.HexChecksumAddressStruct),data:(0,s.optional)(r.StrictHexStruct),value:(0,s.optional)(r.StrictHexStruct),capabilities:(0,s.optional)(n.CapabilitiesStruct)})),capabilities:(0,s.optional)(n.CapabilitiesStruct)})])}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.resemblesAddress=n.validateParams=n.validateAndNormalizeKeyholder=n.getAccountKeyringType=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/superstruct"),o=e("./constants.cjs");function a(e){return 42===e.length}n.getAccountKeyringType=function(e,t){const{accounts:n}=t.call("AccountsController:getState").internalAccounts,r=Object.values(n).find(t=>t.address.toLowerCase()===e.toLowerCase()),a=r?.metadata?.keyring?.type;if(!a)throw new s.JsonRpcError(o.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported as account type is unknown");return a},n.validateAndNormalizeKeyholder=async function(e,t,{getAccounts:n}){if("string"==typeof e&&e.length>0&&a(e)){const r=(await n(t)).map(e=>e.toLowerCase()),o=e.toLowerCase();if(r.includes(o))return o;throw s.providerErrors.unauthorized()}throw s.rpcErrors.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})},n.validateParams=function(e,t){const[n]=(0,r.validate)(e,t);if(n)throw s.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(n,"Invalid params"))},n.resemblesAddress=a}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.DELEGATION_INDICATOR_PREFIX=n.METHOD_NAMES=void 0,n.METHOD_NAMES={UPGRADE_ACCOUNT:"wallet_upgradeAccount",GET_ACCOUNT_UPGRADE_STATUS:"wallet_getAccountUpgradeStatus"},n.DELEGATION_INDICATOR_PREFIX="0xef0100"}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","./wallet_getAccountUpgradeStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs","./wallet_upgradeAccount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.METHOD_NAMES=n.validateAndNormalizeAddress=n.validateParams=n.walletGetAccountUpgradeStatus=n.walletUpgradeAccount=void 0;var s=e("./wallet_upgradeAccount.cjs");Object.defineProperty(n,"walletUpgradeAccount",{enumerable:!0,get:function(){return s.walletUpgradeAccount}});var r=e("./wallet_getAccountUpgradeStatus.cjs");Object.defineProperty(n,"walletGetAccountUpgradeStatus",{enumerable:!0,get:function(){return r.walletGetAccountUpgradeStatus}});var o=e("./utils.cjs");Object.defineProperty(n,"validateParams",{enumerable:!0,get:function(){return o.validateParams}}),Object.defineProperty(n,"validateAndNormalizeAddress",{enumerable:!0,get:function(){return o.validateAndNormalizeAddress}});var a=e("./constants.cjs");Object.defineProperty(n,"METHOD_NAMES",{enumerable:!0,get:function(){return a.METHOD_NAMES}})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.GetAccountUpgradeStatusParamsStruct=n.UpgradeAccountParamsStruct=void 0;const s=e("@metamask/superstruct"),r=e("@metamask/utils");n.UpgradeAccountParamsStruct=(0,s.object)({account:r.HexChecksumAddressStruct,chainId:(0,s.optional)(r.StrictHexStruct)}),n.GetAccountUpgradeStatusParamsStruct=(0,s.object)({account:r.HexChecksumAddressStruct,chainId:(0,s.optional)(r.StrictHexStruct)})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs",{"@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateParams=n.validateAndNormalizeAddress=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/superstruct"),o=e("@metamask/utils");n.validateAndNormalizeAddress=async function(e,t,n){if("string"!=typeof e||0===e.length||!(0,o.isHexAddress)(e))throw s.rpcErrors.invalidParams({message:"Invalid parameters: must provide an EVM address."});if(!(await n(t)).map(e=>e.toLowerCase()).includes(e.toLowerCase()))throw s.providerErrors.unauthorized();return e},n.validateParams=function(e,t){const[n]=(0,r.validate)(e,t);if(n)throw s.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(n,"Invalid parameters"))}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetAccountUpgradeStatus=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/utils"),o=e("./constants.cjs"),a=e("./types.cjs"),i=e("./utils.cjs");n.walletGetAccountUpgradeStatus=async function(e,t,n){const{params:c,origin:d}=e;(0,i.validateParams)(c,a.GetAccountUpgradeStatusParamsStruct);const{account:l,chainId:u}=c,m=await(0,i.validateAndNormalizeAddress)(l,d,n.getPermittedAccountsForOrigin);let h;if(u!==undefined)h=u;else{const e=n.getCurrentChainIdForDomain(d);if(!e)throw s.rpcErrors.invalidParams({message:`Could not determine current chain ID for origin: ${d}`});h=e}const{isSupported:p}=await n.isEip7702Supported({address:m,chainId:h});if(p)try{const e=h,r=n.getSelectedNetworkClientIdForChain(e);if(!r)throw s.rpcErrors.invalidParams({message:`Network client ID not found for chain ID ${h}`});const{isUpgraded:a,upgradedAddress:i}=await(async(e,t,n)=>{const s=await n(e,t);if(!s||"0x"===s||s.length<=2)return{isUpgraded:!1,upgradedAddress:null};if(!s.startsWith(o.DELEGATION_INDICATOR_PREFIX))return{isUpgraded:!1,upgradedAddress:null};const r=o.DELEGATION_INDICATOR_PREFIX.length+40;return s.length!==r?{isUpgraded:!1,upgradedAddress:null}:{isUpgraded:!0,upgradedAddress:`0x${s.slice(8,48)}`}})(m,r,n.getCode);t.result={isSupported:p,account:m,isUpgraded:a,upgradedAddress:i,chainId:h}}catch(e){if(e instanceof s.JsonRpcError)throw e;throw s.rpcErrors.internal({message:`Failed to get account upgrade status: ${(0,r.getErrorMessage)(e)}`})}else t.result={isSupported:p,account:m,isUpgraded:!1,upgradedAddress:null,chainId:h}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletUpgradeAccount=void 0;const s=e("@metamask/rpc-errors"),r=e("./types.cjs"),o=e("./utils.cjs");n.walletUpgradeAccount=async function(e,t,n){const{params:a,origin:i}=e;(0,o.validateParams)(a,r.UpgradeAccountParamsStruct);const{account:c,chainId:d}=a,l=await(0,o.validateAndNormalizeAddress)(c,i,n.getPermittedAccountsForOrigin);let u;if(d!==undefined)u=d;else{const e=n.getCurrentChainIdForDomain(i);if(!e)throw s.rpcErrors.invalidParams({message:`No network configuration found for origin: ${i}`});u=e}try{const e=u,{isSupported:r,upgradeContractAddress:o}=await n.isEip7702Supported({address:l,chainId:e});if(!r)throw s.rpcErrors.invalidParams({message:`Account upgrade not supported on chain ID ${u}`});if(!o)throw s.rpcErrors.invalidParams({message:`No upgrade contract address available for chain ID ${u}`});const a=await n.upgradeAccount(l,o,u);t.result={transactionHash:a.transactionHash,upgradedAccount:l,delegatedTo:a.delegatedTo}}catch(e){if(e instanceof s.JsonRpcError)throw e;throw s.rpcErrors.internal({message:`Failed to upgrade account: ${e instanceof Error?e.message:String(e)}`})}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs",{"@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","punycode/punycode.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/punycode/punycode.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},d=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n};Object.defineProperty(n,"__esModule",{value:!0}),n.EnsController=n.DEFAULT_ENS_NETWORK_MAP=void 0;const l=e("@ethersproject/providers"),u=e("@metamask/base-controller"),m=e("@metamask/controller-utils"),h=e("@metamask/utils"),p=e("punycode/punycode.js"),f=(0,h.createProjectLogger)("ens-controller");n.DEFAULT_ENS_NETWORK_MAP={1:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",4:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",5:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",17e3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",11155111:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"};const g={ensEntries:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},ensResolutionsByAddress:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},k={ensEntries:{},ensResolutionsByAddress:{}};class w extends u.BaseController{constructor({registriesByChainId:e=n.DEFAULT_ENS_NETWORK_MAP,messenger:t,state:i={},onNetworkDidChange:d}){super({name:"EnsController",metadata:g,messenger:t,state:{...k,ensEntries:Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,m.toHex)(e),{".":{address:t,chainId:(0,m.toHex)(e),ensName:"."}}])),...i}}),s.add(this),r.set(this,null),c(this,s,"m",o).call(this,e),d&&d(({selectedNetworkClientId:t})=>{this.resetState(),c(this,s,"m",a).call(this,t,e)})}resetState(){this.update(e=>{e.ensResolutionsByAddress={}})}clear(){this.update(e=>{e.ensEntries={}})}delete(e,t){const n=(0,m.normalizeEnsName)(t);return!!((0,m.isSafeDynamicKey)(e)&&n&&this.state.ensEntries[e]&&this.state.ensEntries[e][n])&&(this.update(t=>{delete t.ensEntries[e][n],0===Object.keys(t.ensEntries[e]).length&&delete t.ensEntries[e]}),!0)}get(e,t){const n=(0,m.normalizeEnsName)(t);return n&&this.state.ensEntries[e]&&this.state.ensEntries[e][n]||null}set(e,t,n){if(!Number.isInteger(Number.parseInt(e,10))||!t||"string"!=typeof t||n&&!(0,m.isValidHexAddress)(n))throw new Error(`Invalid ENS entry: { chainId:${e}, ensName:${t}, address:${n}}`);const s=(0,m.normalizeEnsName)(t);if(!s)throw new Error(`Invalid ENS name: ${t}`);const r=n?(0,m.toChecksumHexAddress)(n):null,o=this.state.ensEntries[e];return(!o?.[s]||o[s].address!==r)&&(this.update(t=>{t.ensEntries={...this.state.ensEntries,[e]:{...this.state.ensEntries[e],[s]:{address:r,chainId:e,ensName:s}}}}),!0)}async reverseResolveAddress(e){if(!c(this,r,"f"))return undefined;const t=(0,m.toChecksumHexAddress)(e);if(this.state.ensResolutionsByAddress[t])return this.state.ensResolutionsByAddress[t];let n,s;try{n=await c(this,r,"f").lookupAddress(t)}catch(e){return f(e),undefined}if(!n)return undefined;try{s=await c(this,r,"f").resolveName(n)}catch(e){return f(e),undefined}return s?"0x0000000000000000000000000000000000000000"===s||"0x"===s||(0,m.toChecksumHexAddress)(s)!==t?undefined:(this.update(e=>{e.ensResolutionsByAddress[t]=(0,p.toASCII)(n)}),n):undefined}}n.EnsController=w,r=new WeakMap,s=new WeakSet,o=function(e){const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState");c(this,s,"m",a).call(this,t,e)},a=function(e,t){const{configuration:{chainId:n},provider:o}=this.messenger.call("NetworkController:getNetworkClientById",e);t&&t[parseInt(n,16)]&&c(this,s,"m",i).call(this,n)?d(this,r,new l.Web3Provider(o,{chainId:(0,m.convertHexToDecimal)(n),name:m.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP[n],ensAddress:t[parseInt(n,16)]}),"f"):d(this,r,null,"f")},i=function(e){return Boolean(this.state.ensEntries[e])},n.default=w}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/EnsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/index.cjs",{"./EnsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./EnsController.cjs"),n)}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},a=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorReportingService=void 0;n.ErrorReportingService=class{constructor({messenger:e,captureException:t}){this.name="ErrorReportingService",this.state=null,s.set(this,void 0),r.set(this,void 0),o(this,r,e,"f"),o(this,s,t,"f"),a(this,r,"f").registerActionHandler("ErrorReportingService:captureException",a(this,s,"f").bind(this))}captureException(e){a(this,s,"f").call(this,e)}},s=new WeakMap,r=new WeakMap}}},{package:"@metamask/error-reporting-service",file:"node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/index.cjs",{"./error-reporting-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorReportingService=void 0;var s=e("./error-reporting-service.cjs");Object.defineProperty(n,"ErrorReportingService",{enumerable:!0,get:function(){return s.ErrorReportingService}})}}},{package:"@metamask/error-reporting-service",file:"node_modules/@metamask/error-reporting-service/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("./base-filter");t.exports=class extends s{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js",{"@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("@metamask/safe-event-emitter").default;t.exports=class extends s{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach(e=>this.emit("update",e))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("./base-filter"),r=e("./getBlocksForRange"),{incrementHexInt:o}=e("./hexUtils");t.exports=class extends s{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const n=t,s=o(e),a=(await r({provider:this.provider,fromBlock:s,toBlock:n})).map(e=>e.hash);this.addResults(a)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/block-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function s(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function r(e){if(e===undefined||null===e)return e;return"0x"+e.toString(16)}t.exports=async function({provider:e,fromBlock:t,toBlock:n}){t||(t=n);const o=s(t),a=s(n),i=Array(a-o+1).fill().map((e,t)=>o+t).map(r);let c=await Promise.all(i.map(t=>async function(e,t,n){for(let s=0;s<3;s++)try{return e.request({id:1,jsonrpc:"2.0",method:t,params:n})}catch(e){console.error(`provider.request failed: ${e.stack||e.message||e}`)}return null}(e,"eth_getBlockByNumber",[t,!1])));return c=c.filter(e=>null!==e),c}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function s(e){return e.sort((e,t)=>"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:r(e)-r(t))}function r(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function o(e){if(e===undefined||null===e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function a(){return Math.floor(16*Math.random()).toString(16)}t.exports={minBlockRef:function(...e){return s(e)[0]},maxBlockRef:function(...e){const t=s(e);return t[t.length-1]},sortBlockRefs:s,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:r,incrementHexInt:function(e){if(e===undefined||null===e)return e;return o(r(e)+1)},intToHex:o,unsafeRandomBytes:function(e){let t="0x";for(let n=0;n<e;n++)t+=a(),t+=a();return t}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js",{"./block-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./log-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js","./tx-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("async-mutex").Mutex,{createAsyncMiddleware:r,createScaffoldMiddleware:o}=e("@metamask/json-rpc-engine"),a=e("./log-filter.js"),i=e("./block-filter.js"),c=e("./tx-filter.js"),{intToHex:d,hexToInt:l}=e("./hexUtils");function u(e){return m(async(...t)=>{const n=await e(...t);return d(n.id)})}function m(e){return r(async(t,n)=>{const s=await e.apply(null,t.params);n.result=s})}function h(e,t){const n=[];for(let t in e)n.push(e[t]);return n}t.exports=function({blockTracker:e,provider:t}){let n=0,r={};const p=new s,f=function({mutex:e}){return t=>async(n,s,r,o)=>{(await e.acquire())(),t(n,s,r,o)}}({mutex:p}),g=o({eth_newFilter:f(u(w)),eth_newBlockFilter:f(u(_)),eth_newPendingTransactionFilter:f(u(b)),eth_uninstallFilter:f(m(S)),eth_getFilterChanges:f(m(y)),eth_getFilterLogs:f(m(E))}),k=async({oldBlock:e,newBlock:t})=>{if(0===r.length)return;const n=await p.acquire();try{await Promise.all(h(r).map(async n=>{try{await n.update({oldBlock:e,newBlock:t})}catch(e){console.error(e)}}))}catch(e){console.error(e)}n()};return g.newLogFilter=w,g.newBlockFilter=_,g.newPendingTransactionFilter=b,g.uninstallFilter=S,g.getFilterChanges=y,g.getFilterLogs=E,g.destroy=()=>{!async function(){const e=h(r).length;r={},I({prevFilterCount:e,newFilterCount:0})}()},g;async function w(e){const n=new a({provider:t,params:e});await A(n);return n}async function _(){const e=new i({provider:t});await A(e);return e}async function b(){const e=new c({provider:t});await A(e);return e}async function y(e){const t=l(e),n=r[t];if(!n)throw new Error(`No filter for index "${t}"`);return n.getChangesAndClear()}async function E(e){const t=l(e),n=r[t];if(!n)throw new Error(`No filter for index "${t}"`);let s=[];return"log"===n.type&&(s=n.getAllResults()),s}async function S(e){const t=l(e),n=r[t],s=Boolean(n);return s&&await async function(e){const t=h(r).length;delete r[e];const n=h(r).length;I({prevFilterCount:t,newFilterCount:n})}(t),s}async function A(t){const s=h(r).length,o=await e.getLatestBlock();await t.initialize({currentBlock:o}),n++,r[n]=t,t.id=n,t.idHex=d(n);return I({prevFilterCount:s,newFilterCount:h(r).length}),n}function I({prevFilterCount:t,newFilterCount:n}){0===t&&n>0?e.on("sync",k):t>0&&0===n&&e.removeListener("sync",k)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js",{"./base-filter-history":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js",pify:"/home/runner/work/metamask-extension/metamask-extension/node_modules/pify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("@metamask/eth-query"),r=e("pify"),o=e("./base-filter-history"),{bnToHex:a,hexToInt:i,incrementHexInt:c,minBlockRef:d,blockRefIsNumber:l}=e("./hexUtils");t.exports=class extends o{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new s(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:undefined,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(e=>e.toLowerCase()))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const n=d(this.params.toBlock,e),s=Object.assign({},this.params,{toBlock:n}),r=await this._fetchLogs(s);this.addInitialResults(r)}async update({oldBlock:e,newBlock:t}){const n=t;let s;s=e?c(e):t;const r=Object.assign({},this.params,{fromBlock:s,toBlock:n}),o=(await this._fetchLogs(r)).filter(e=>this.matchLog(e));this.addResults(o)}async _fetchLogs(e){return await r(t=>this.ethQuery.getLogs(e,t))()}matchLog(e){if(i(this.params.fromBlock)>=i(e.blockNumber))return!1;if(l(this.params.toBlock)&&i(this.params.toBlock)<=i(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every((t,n)=>{let s=e.topics[n];if(!s)return!1;s=s.toLowerCase();let r=Array.isArray(t)?t:[t];if(r.includes(null))return!0;r=r.map(e=>e.toLowerCase());return r.includes(s)})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/log-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js",{"./getBlocksForRange.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./index.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("@metamask/safe-event-emitter").default,{createAsyncMiddleware:r,createScaffoldMiddleware:o}=e("@metamask/json-rpc-engine"),a=e("./index.js"),{unsafeRandomBytes:i,incrementHexInt:c}=e("./hexUtils.js"),d=e("./getBlocksForRange.js");function l(e){return null===e||e===undefined?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}t.exports=function({blockTracker:e,provider:t}){const n={},u=a({blockTracker:e,provider:t});let m=!1;const h=new s,p=o({eth_subscribe:r(async function(s,r){if(m)throw new Error("SubscriptionManager - attempting to use after destroying");const o=s.params[0],a=i(16);let h;switch(o){case"newHeads":h=p({subId:a});break;case"logs":const e=s.params[1];h=g({subId:a,filter:await u.newLogFilter(e)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${o}"`)}return n[a]=h,void(r.result=a);function p({subId:n}){const s={type:o,destroy:async()=>{e.removeListener("sync",s.update)},update:async({oldBlock:e,newBlock:s})=>{const r=s,o=c(e);(await d({provider:t,fromBlock:o,toBlock:r})).map(l).filter(e=>null!==e).forEach(e=>{f(n,e)})}};return e.on("sync",s.update),s}function g({subId:e,filter:t}){t.on("update",t=>f(e,t));return{type:o,destroy:async()=>await u.uninstallFilter(t.idHex)}}}),eth_unsubscribe:r(async function(e,t){if(m)throw new Error("SubscriptionManager - attempting to use after destroying");const s=e.params[0],r=n[s];if(!r)return void(t.result=!1);delete n[s],await r.destroy(),t.result=!0})});return p.destroy=function(){h.removeAllListeners();for(const e in n)n[e].destroy(),delete n[e];m=!0},{events:h,middleware:p};function f(e,t){h.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("./base-filter"),r=e("./getBlocksForRange"),{incrementHexInt:o}=e("./hexUtils");t.exports=class extends s{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,n=o(e),s=await r({provider:this.provider,fromBlock:n,toBlock:t}),a=[];for(const e of s)a.push(...e.transactions);this.addResults(a)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/tx-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs",{"@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createLedgerError=function(e,t){const n=r(e);if(n){const e=t?`${n.message} (${t})`:n.message;return new s.HardwareWalletError(e,{code:n.code,severity:n.severity,category:n.category,userMessage:n.userMessage??e})}const o=t?`Unknown Ledger error: ${e} (${t})`:`Unknown Ledger error: ${e}`;return new s.HardwareWalletError(o,{code:s.ErrorCode.Unknown,severity:s.Severity.Err,category:s.Category.Unknown,userMessage:o})},n.isKnownLedgerError=function(e){return e in s.LEDGER_ERROR_MAPPINGS},n.getLedgerErrorMapping=r;const s=e("@metamask/hw-wallet-sdk");function r(e){return s.LEDGER_ERROR_MAPPINGS[e]}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","./ledger-error-handler.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs","./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs","./ledger-iframe-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs","./ledger-keyring-v2.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs","./ledger-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs","./ledger-mobile-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs","./ledger-transport-middleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./ledger-keyring.cjs"),n),r(e("./ledger-keyring-v2.cjs"),n),r(e("./ledger-iframe-bridge.cjs"),n),r(e("./ledger-mobile-bridge.cjs"),n),r(e("./ledger-transport-middleware.cjs"),n),r(e("./ledger-hw-app.cjs"),n),r(e("./errors.cjs"),n),r(e("./ledger-error-handler.cjs"),n)}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","@ledgerhq/hw-transport":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-transport/lib/Transport.js","@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handleLedgerTransportError=function(e,t){if(e instanceof s.TransportStatusError){const t=`0x${e.statusCode.toString(16)}`;if((0,o.isKnownLedgerError)(t)){const e=(0,o.createLedgerError)(t);throw i.has(t)&&(e.message=(n=e.message).startsWith(a)?n:`${a}${n}`),e}throw new r.HardwareWalletError(e.message,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:e.message,cause:e})}var n;if(e instanceof r.HardwareWalletError)throw e;if(e instanceof Error)throw new r.HardwareWalletError(e.message,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:e.message,cause:e});throw new r.HardwareWalletError(t,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:t})};const s=e("@ledgerhq/hw-transport"),r=e("@metamask/hw-wallet-sdk"),o=e("./errors.cjs"),a="Ledger: ",i=new Set(["0x6985","0x6a80","0x5515","0x650f"])}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs",{"@ledgerhq/hw-app-eth":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.MetaMaskLedgerHwAppEth=void 0;const r=s(e("@ledgerhq/hw-app-eth")),o=e("buffer");class a extends r.default{constructor(){super(...arguments),this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii"}async openEthApp(){await this.transport.send(224,216,0,0,o.Buffer.from(this.ethAppName,this.transportEncoding))}async closeApps(){await this.transport.send(176,167,0,0)}async getAppNameAndVersion(){const e=await this.transport.send(176,1,0,0);if(1!==e[0])throw new Error("Incorrect format return from getAppNameAndVersion.");let t=1;const n=e[t]??0;t+=1;const s=e.slice(t,t+=n).toString(this.transportEncoding),r=e[t]??0;t+=1;return{appName:s,version:e.slice(t,t+=r).toString(this.transportEncoding)}}}n.MetaMaskLedgerHwAppEth=a}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},h=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerIframeBridge=n.IFrameMessageAction=void 0;const p=e("@metamask/utils");var f;!function(e){e.LedgerIsIframeReady="ledger-is-iframe-ready",e.LedgerConnectionChange="ledger-connection-change",e.LedgerUnlock="ledger-unlock",e.LedgerMakeApp="ledger-make-app",e.LedgerUpdateTransport="ledger-update-transport",e.LedgerSignTransaction="ledger-sign-transaction",e.LedgerSignPersonalMessage="ledger-sign-personal-message",e.LedgerSignTypedData="ledger-sign-typed-data",e.LedgerGetAppNameAndVersion="ledger-get-app-name-and-version",e.LedgerGetAppConfiguration="ledger-get-app-configuration"}(f||(n.IFrameMessageAction=f={}));n.LedgerIframeBridge=class{constructor(e={bridgeUrl:"https://metamask.github.io/eth-ledger-bridge-keyring"}){s.add(this),this.iframeLoaded=!1,r.set(this,void 0),this.isDeviceConnected=!1,this.currentMessageId=0,o.set(this,new Map),m(this,s,"m",u).call(this,e),h(this,r,{bridgeUrl:e?.bridgeUrl},"f")}async init(){await m(this,s,"m",i).call(this,m(this,r,"f").bridgeUrl),this.eventListener=m(this,s,"m",d).bind(this,m(this,r,"f").bridgeUrl),window.addEventListener("message",this.eventListener)}async destroy(){this.eventListener&&window.removeEventListener("message",this.eventListener)}async getOptions(){return m(this,r,"f")}async setOptions(e){m(this,s,"m",u).call(this,e),m(this,r,"f")?.bridgeUrl!==e.bridgeUrl&&(m(this,r,"f").bridgeUrl=e.bridgeUrl,await this.destroy(),await this.init())}async attemptMakeApp(){const e=await m(this,s,"m",l).call(this,{action:f.LedgerMakeApp},{timeout:8e3});if("success"in e&&e.success)return!0;throw"error"in e?e.error:new Error("Unknown error occurred")}async updateTransportMethod(e){if(!this.iframeLoaded)throw new Error("The iframe is not loaded yet");const t=await m(this,s,"m",l).call(this,{action:f.LedgerUpdateTransport,params:{transportType:e}},{timeout:8e3});if("success"in t&&t.success)return!0;throw new Error("Ledger transport could not be updated")}async getPublicKey(e){return m(this,s,"m",a).call(this,f.LedgerUnlock,e)}async deviceSignTransaction(e){return m(this,s,"m",a).call(this,f.LedgerSignTransaction,e)}async deviceSignMessage(e){return m(this,s,"m",a).call(this,f.LedgerSignPersonalMessage,e)}async deviceSignTypedData(e){return m(this,s,"m",a).call(this,f.LedgerSignTypedData,e)}async getAppNameAndVersion(){return m(this,s,"m",a).call(this,f.LedgerGetAppNameAndVersion,{})}async getAppConfiguration(){return m(this,s,"m",a).call(this,f.LedgerGetAppConfiguration,{})}},r=new WeakMap,o=new WeakMap,s=new WeakSet,a=async function(...[e,t]){const n=await m(this,s,"m",l).call(this,{action:e,params:t});if("payload"in n&&n.payload){if("success"in n&&n.success)return n.payload;if("error"in n.payload)throw n.payload.error}throw new Error("Unknown error occurred")},i=async function(e){return new Promise(t=>{this.iframe=document.createElement("iframe"),this.iframe.src=e,this.iframe.allow="hid 'src'",this.iframe.onload=async()=>{this.iframeLoaded=!0,t()},document.head.appendChild(this.iframe)})},c=function(e){const t=e.split("/");return t.splice(-1,1),t.join("/")},d=function(e,t){const{origin:n,data:r}=t;if(n===m(this,s,"m",c).call(this,e)&&r){const e=m(this,o,"f").get(r.messageId);e?(e.resolve(r),m(this,o,"f").delete(r.messageId)):r.action===f.LedgerConnectionChange&&(this.isDeviceConnected=r.payload.connected)}},l=async function(e,{timeout:t}={}){this.currentMessageId+=1;const n={...e,messageId:this.currentMessageId,target:"LEDGER-IFRAME"},s=(0,p.createDeferredPromise)();if(m(this,o,"f").set(this.currentMessageId,s),!this.iframeLoaded||!this.iframe?.contentWindow)throw new Error("The iframe is not loaded yet");return t&&setTimeout(()=>{m(this,o,"f").has(n.messageId)&&(m(this,o,"f").delete(n.messageId),s.reject(new Error("Ledger iframe message timeout")))},t),this.iframe.contentWindow.postMessage(n,"*"),s.promise},u=function(e){if("string"!=typeof e.bridgeUrl||0===e.bridgeUrl.length)throw new Error("bridgeURL is not a valid URL")}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs",{"@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerKeyringV2=void 0;const d=e("@metamask/keyring-api"),l=e("@metamask/utils"),u=[d.EthMethod.SignTransaction,d.EthMethod.PersonalSign,d.EthMethod.SignTypedDataV4],m={scopes:[d.EthScope.Eoa],bip44:{deriveIndex:!0,derivePath:!0}},h=/^m\/44'\/60'\/(\d+)'\/0\/0$/u,p=/^(m\/44'\/60'(?:\/\d+'?)*)\/(\d+)$/u;class f extends d.EthKeyringWrapper{constructor(e){super({type:d.KeyringType.Ledger,inner:e.legacyKeyring,capabilities:m}),s.add(this),this.entropySource=e.entropySource}async getAccounts(){const e=await this.inner.getAccounts();return 0===e.length?[]:e.map(e=>{const t=this.registry.getAccountId(e);if(t){const e=this.registry.get(t);if(e)return e}const n=c(this,s,"m",a).call(this,e);return c(this,s,"m",i).call(this,e,n)})}async createAccounts(e){return this.withLock(async()=>{if("bip44:derive-path"!==e.type&&"bip44:derive-index"!==e.type)throw new Error(`Unsupported account creation type for LedgerKeyring: ${String(e.type)}`);if(e.entropySource!==this.entropySource)throw new Error(`Entropy source mismatch: expected '${this.entropySource}', got '${e.entropySource}'`);const t=await this.getAccounts();let n,r,a;if("bip44:derive-path"===e.type){const t=c(this,s,"m",o).call(this,e.derivationPath);n=t.index,r=t.basePath,a=e.derivationPath}else n=e.groupIndex,r="m/44'/60'/0'/0",a=`${r}/${n}`;const d=t.find(e=>e.options.entropy.groupIndex===n&&e.options.entropy.derivationPath===a);if(d)return[d];this.inner.setHdPath(r),this.inner.setAccountToUnlock(n);const[l]=await this.inner.addAccounts(1);if(!l)throw new Error("Failed to create new account");return[c(this,s,"m",i).call(this,l,n)]})}async deleteAccount(e){await this.withLock(async()=>{const{address:t}=await this.getAccount(e),n=this.toHexAddress(t);this.inner.removeAccount(n),this.registry.delete(e)})}}n.LedgerKeyringV2=f,s=new WeakSet,r=function(e){return(0,l.getChecksumAddress)((0,l.add0x)(e))},o=function(e){const t=e.match(h);if(t?.[1])return{basePath:"m/44'/60'/0'/0/0",index:parseInt(t[1],10)};const n=e.match(p);if(n)return{basePath:n[1],index:parseInt(n[2],10)};throw new Error(`Invalid derivation path format: ${e}. Expected Ledger Live (m/44'/60'/{index}'/0/0) or index-at-end (m/44'/60'/.../{index}) format.`)},a=function(e){const t=c(this,s,"m",r).call(this,e),n=this.inner.accountDetails[t];if(!n)throw new Error(`Address ${t} not found in account details`);const{hdPath:o}=n;if(!o)throw new Error(`No HD path found for address ${t}`);if(n.bip44){const e=o.match(h);if(e?.[1])return parseInt(e[1],10)}else{const e=o.match(p);if(e?.[2])return parseInt(e[2],10)}throw new Error(`Could not extract index from HD path: ${o}`)},i=function(e,t){const n=this.registry.register(e),o=c(this,s,"m",r).call(this,e),a=this.inner.accountDetails[o];if(!a?.hdPath)throw new Error(`No HD path found for address ${o}. Cannot create account.`);const i={id:n,type:d.EthAccountType.Eoa,address:e,scopes:[...this.capabilities.scopes],methods:[...u],options:{entropy:{type:d.KeyringAccountEntropyTypeOption.Mnemonic,id:this.entropySource,groupIndex:t,derivationPath:a.hdPath}}};return this.registry.set(i),i}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs",{"./ledger-error-handler.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs","@ethereumjs/rlp":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/rlp/dist/cjs/index.js","@ethereumjs/tx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/tx/dist/cjs/index.js","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/index.js","@metamask/eth-sig-util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-sig-util/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js",hdkey:"/home/runner/work/metamask-extension/metamask-extension/node_modules/hdkey/lib/hdkey.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m,h,p,f,g,k,w=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},_=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerKeyring=void 0;const b=e("@ethereumjs/rlp"),y=e("@ethereumjs/tx"),E=e("@ethereumjs/util"),S=e("@metamask/eth-sig-util"),A=e("@metamask/utils"),I=e("buffer"),T=_(e("hdkey")),v=e("./ledger-error-handler.cjs"),C="m",x=`${C}/44'/60'/0'`,j="Ledger Hardware";var N;!function(e){e.Ropsten="https://api-ropsten.etherscan.io",e.Kovan="https://api-kovan.etherscan.io",e.Rinkeby="https://api-rinkeby.etherscan.io",e.Mainnet="https://api.etherscan.io"}(N||(N={}));class O{constructor({bridge:e}){if(s.add(this),this.deviceId="",this.type=j,this.page=0,this.perPage=5,this.unlockedAccount=0,this.accounts=[],this.accountDetails={},this.hdk=new T.default,this.hdPath=x,this.paths={},this.network=N.Mainnet,this.implementFullBIP44=!1,!e)throw new Error("Bridge is a required dependency for the keyring");this.bridge=e}async init(){return this.bridge.init()}async destroy(){return this.bridge.destroy()}async serialize(){return{hdPath:this.hdPath,accounts:this.accounts.slice(),deviceId:this.deviceId,accountDetails:this.accountDetails,implementFullBIP44:!1}}async deserialize(e){this.hdPath=e.hdPath??x,this.accounts=e.accounts??[],this.deviceId=e.deviceId??"",this.accountDetails=e.accountDetails??{},e.accountDetails||w(this,s,"m",r).call(this,e),this.implementFullBIP44=e.implementFullBIP44??!1;const t=new Set(Object.keys(this.accountDetails));return this.accounts=this.accounts.filter(e=>t.has(w(this,s,"m",g).call(this,e))),Promise.resolve()}setDeviceId(e){this.deviceId=e}getDeviceId(){return this.deviceId}isUnlocked(){return Boolean(this.hdk.publicKey)}isConnected(){return this.bridge.isDeviceConnected}setAccountToUnlock(e){this.unlockedAccount=e}setHdPath(e){this.hdPath!==e&&(this.hdk=new T.default),this.hdPath=e}async unlock(e,t=!0){if(this.isUnlocked()&&!e)return w(this,s,"m",g).call(this,(0,A.bytesToHex)((0,E.publicToAddress)(this.hdk.publicKey,!0)));const n=e?w(this,s,"m",h).call(this,e):this.hdPath;let r;try{r=await this.bridge.getPublicKey({hdPath:n})}catch(e){(0,v.handleLedgerTransportError)(e,"Ledger: Unknown error while unlocking account")}return t&&r.chainCode&&(this.hdk.publicKey=I.Buffer.from(r.publicKey,"hex"),this.hdk.chainCode=I.Buffer.from(r.chainCode,"hex")),(0,A.add0x)(r.address)}async addAccounts(e){return new Promise((t,n)=>{this.unlock().then(async n=>{const r=this.unlockedAccount,o=r+e,a=[];for(let e=r;e<o;e++){const t=w(this,s,"m",u).call(this,e);let n;n=w(this,s,"m",m).call(this)?await this.unlock(t):w(this,s,"m",d).call(this,C,e),this.accountDetails[w(this,s,"m",g).call(this,n)]={bip44:w(this,s,"m",m).call(this),hdPath:t},this.accounts.includes(n)||(this.accounts=[...this.accounts,n],a.push(n)),this.page=0}t(a)}).catch(n)})}getName(){return j}async getFirstPage(){return this.page=0,w(this,s,"m",a).call(this,1)}async getNextPage(){return w(this,s,"m",a).call(this,1)}async getPreviousPage(){return w(this,s,"m",a).call(this,-1)}async getAccounts(){return Promise.resolve(this.accounts.slice())}removeAccount(e){const t=this.accounts.filter(t=>t.toLowerCase()!==e.toLowerCase());if(t.length===this.accounts.length)throw new Error(`Address ${e} not found in this keyring`);this.accounts=t,delete this.accountDetails[w(this,s,"m",g).call(this,e)]}async attemptMakeApp(){return this.bridge.attemptMakeApp()}async updateTransportMethod(e){return this.bridge.updateTransportMethod(e)}async getAppNameAndVersion(){try{return await this.bridge.getAppNameAndVersion()}catch(e){return(0,v.handleLedgerTransportError)(e,"Ledger: Unknown error while getting app name and version")}}async getAppConfiguration(){try{return await this.bridge.getAppConfiguration()}catch(e){return(0,v.handleLedgerTransportError)(e,"Ledger: Unknown error while getting app configuration")}}async signTransaction(e,t){let n;if(function(e){return"getChainId"in e&&"function"==typeof e.getChainId}(t))return t.v=t.getChainId(),t.r="0x00",t.s="0x00",n=t.serialize().toString("hex"),w(this,s,"m",o).call(this,e,n,e=>(t.v=I.Buffer.from(e.v,"hex"),t.r=I.Buffer.from(e.r,"hex"),t.s=I.Buffer.from(e.s,"hex"),t));const r=t.getMessageToSign();return n=Array.isArray(r)?I.Buffer.from(b.RLP.encode(r)).toString("hex"):(0,A.bytesToHex)(r),w(this,s,"m",o).call(this,e,n,e=>{const n=t.toJSON();return n.type=t.type,n.v=(0,A.add0x)(e.v),n.r=(0,A.add0x)(e.r),n.s=(0,A.add0x)(e.s),y.TransactionFactory.fromTxData(n,{common:t.common,freeze:Object.isFrozen(t)})})}async signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,t){const n=await this.unlockAccountByAddress(e);if(!n)throw new Error("Ledger: Unknown error while signing message");let r;try{r=await this.bridge.deviceSignMessage({hdPath:n,message:(0,A.remove0x)(t)})}catch(e){(0,v.handleLedgerTransportError)(e,"Ledger: Unknown error while signing message")}const o=w(this,s,"m",k).call(this,parseInt(String(r.v),10)),a=`0x${r.r}${r.s}${o}`,i=(0,S.recoverPersonalSignature)({data:t,signature:a});if(w(this,s,"m",g).call(this,i)!==w(this,s,"m",g).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return a}async unlockAccountByAddress(e){const t=w(this,s,"m",g).call(this,e),n=this.accountDetails[t];if(!n)throw new Error(`Ledger: Account for address '${t}' not found`);const{hdPath:r}=n;if((await this.unlock(r,!1)).toLowerCase()!==e.toLowerCase())throw new Error(`Ledger: Account ${e} does not belong to the connected device`);return r}async signTypedData(e,t,n){const{version:r}=n??{};if(!("V4"===r))throw new Error("Ledger: Only version 4 of typed data signing is supported");const{domain:o,types:a,primaryType:i,message:c}=S.TypedDataUtils.sanitizeData(t),d=await this.unlockAccountByAddress(e);if(!d)throw new Error("Ledger: Unknown error while signing message");let l;try{l=await this.bridge.deviceSignTypedData({hdPath:d,message:{domain:{name:o.name,chainId:o.chainId,version:o.version,verifyingContract:o.verifyingContract,salt:o.salt instanceof ArrayBuffer?I.Buffer.from(o.salt).toString("hex"):o.salt},types:a,primaryType:i.toString(),message:c}})}catch(e){(0,v.handleLedgerTransportError)(e,"Ledger: Unknown error while signing message")}const u=w(this,s,"m",k).call(this,parseInt(String(l.v),10)),m=`0x${l.r}${l.s}${u}`,h=(0,S.recoverTypedSignature)({data:t,signature:m,version:S.SignTypedDataVersion.V4});if(w(this,s,"m",g).call(this,h)!==w(this,s,"m",g).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return m}forgetDevice(){this.deviceId="",this.accounts=[],this.page=0,this.unlockedAccount=0,this.paths={},this.accountDetails={},this.hdk=new T.default}}n.LedgerKeyring=O,s=new WeakSet,r=function(e){if(w(this,s,"m",m).call(this)&&e.accountIndexes)for(const[t,n]of Object.entries(e.accountIndexes))this.accountDetails[t]={bip44:!0,hdPath:w(this,s,"m",u).call(this,n)};const t=new Set(Object.keys(this.accountDetails));w(this,s,"m",m).call(this)||this.accounts.forEach(e=>{const n=w(this,s,"m",g).call(this,e);t.has(n)||(this.accountDetails[n]={bip44:!1,hdPath:w(this,s,"m",l).call(this,e)})})},o=async function(e,t,n){const s=await this.unlockAccountByAddress(e);if(!s)throw new Error("Ledger: hdPath is empty while signing transaction");let r;try{r=await this.bridge.deviceSignTransaction({tx:(0,A.remove0x)(t),hdPath:s})}catch(e){(0,v.handleLedgerTransportError)(e,"Ledger: Unknown error while signing transaction")}const o=n(r);if(o.verifySignature())return o;throw new Error("Ledger: The transaction signature is not valid")},a=async function(e){this.page+=e,this.page<=0&&(this.page=1);const t=(this.page-1)*this.perPage,n=t+this.perPage;let r;return await this.unlock(),r=w(this,s,"m",m).call(this)?await w(this,s,"m",i).call(this,t,n):w(this,s,"m",c).call(this,t,n),r},i=async function(e,t){const n=[];for(let r=e;r<t;r++){const e=w(this,s,"m",u).call(this,r),t=await this.unlock(e),o=!this.implementFullBIP44||await w(this,s,"m",p).call(this,t);if(n.push({address:t,balance:null,index:r}),!o)break}return n},c=function(e,t){const n=[];for(let r=e;r<t;r++){const e=w(this,s,"m",d).call(this,C,r);n.push({address:e,balance:null,index:r}),this.paths[w(this,s,"m",g).call(this,e)]=r}return n},d=function(e,t){const n=this.hdk.derive(`${e}/${t}`),r=(0,A.bytesToHex)((0,E.publicToAddress)(n.publicKey,!0));return w(this,s,"m",g).call(this,r)},l=function(e){const t=w(this,s,"m",g).call(this,e);let n=this.paths[t];if(void 0===n)for(let e=0;e<1e3;e++)if(t===w(this,s,"m",d).call(this,C,e)){n=e;break}if(void 0===n)throw new Error("Unknown address");return w(this,s,"m",u).call(this,n)},u=function(e){return w(this,s,"m",m).call(this)?`m/44'/60'/${e}'/0/0`:`${this.hdPath}/${e}`},m=function(){return"m/44'/60'/0'/0/0"===this.hdPath},h=function(e){return e.toString().replace("m/","")},p=async function(e){const t=w(this,s,"m",f).call(this),n=await window.fetch(`${t}/api?module=account&action=txlist&address=${e}&tag=latest&page=1&offset=1`),r=await n.json();return"0"!==r.status&&r.result.length>0},f=function(){return this.network},g=function(e){return(0,A.getChecksumAddress)((0,A.add0x)(e))},k=function(e){return 0===e||1===e?(e+27).toString(16):e.toString(16)},O.type=j}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs",{"./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},d=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerMobileBridge=void 0;e("./ledger-hw-app.cjs");n.LedgerMobileBridge=class{constructor(e,t={}){s.add(this),r.set(this,void 0),o.set(this,void 0),this.isDeviceConnected=!1,c(this,o,t,"f"),c(this,r,e,"f")}async init(){return Promise.resolve()}async destroy(){try{await d(this,s,"m",a).call(this).dispose()}catch(e){console.error(e)}this.isDeviceConnected=!1}async deviceSignMessage({hdPath:e,message:t}){return d(this,s,"m",i).call(this).signPersonalMessage(e,t)}async deviceSignTypedData({hdPath:e,message:t}){return d(this,s,"m",i).call(this).signEIP712Message(e,t)}async deviceSignTransaction({tx:e,hdPath:t}){return d(this,s,"m",i).call(this).clearSignTransaction(t,e,{externalPlugins:!0,erc20:!0,nft:!0})}async getPublicKey({hdPath:e}){return await d(this,s,"m",i).call(this).getAddress(e,!1,!0)}async getOptions(){return d(this,o,"f")}async setOptions(e){c(this,o,e,"f")}async updateTransportMethod(e){if(!e.deviceModel)throw new Error("Property `deviceModel` is not defined in `transport`.");if(!e.deviceModel.id)throw new Error("Property `deviceModel.id` is not defined in `transport`.");return d(this,s,"m",a).call(this).setTransport(e),this.isDeviceConnected=!0,Promise.resolve(!0)}async attemptMakeApp(){throw new Error("Method not supported.")}async openEthApp(){await d(this,s,"m",i).call(this).openEthApp()}async closeApps(){await d(this,s,"m",i).call(this).closeApps()}async getAppNameAndVersion(){return d(this,s,"m",i).call(this).getAppNameAndVersion()}async getAppConfiguration(){return d(this,s,"m",i).call(this).getAppConfiguration()}},r=new WeakMap,o=new WeakMap,s=new WeakSet,a=function(){if(d(this,r,"f"))return d(this,r,"f");throw new Error("Instance `transportMiddleware` is not initialized.")},i=function(){return d(this,s,"m",a).call(this).getEthApp()}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs",{"./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerTransportMiddleware=void 0;const a=e("./ledger-hw-app.cjs");n.LedgerTransportMiddleware=class{constructor(){this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii",s.set(this,void 0)}async dispose(){const e=this.getTransport();await e.close()}setTransport(e){r(this,s,e,"f")}getTransport(){if(!o(this,s,"f"))throw new Error("Instance `transport` is not initialized.");return o(this,s,"f")}getEthApp(){return new a.MetaMaskLedgerHwAppEth(this.getTransport())}},s=new WeakMap}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs",{"./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MOBILE_ERROR_MAPPINGS=n.BLE_ERROR_MAPPINGS=n.LEDGER_ERROR_MAPPINGS=void 0;const s=e("./hardware-errors-enums.cjs");n.LEDGER_ERROR_MAPPINGS={"0x9000":{code:s.ErrorCode.Success,message:"Operation successful",severity:s.Severity.Info,category:s.Category.Success},"0x6300":{code:s.ErrorCode.AuthenticationFailed,message:"Authentication failed",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Authentication failed. Please verify your credentials."},"0x63c0":{code:s.ErrorCode.AuthenticationPinAttemptsRemaining,message:"PIN attempts remaining",severity:s.Severity.Warning,category:s.Category.Authentication,userMessage:"Incorrect PIN. Please try again."},"0x6982":{code:s.ErrorCode.AuthenticationSecurityCondition,message:"Security conditions not satisfied",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Device is locked or access rights are insufficient. Please unlock your device."},"0x6985":{code:s.ErrorCode.UserRejected,message:"User rejected action on device",severity:s.Severity.Warning,category:s.Category.UserAction,userMessage:"Transaction was rejected. Please approve on your device to continue."},"0x9804":{code:s.ErrorCode.AuthenticationSecurityCondition,message:"App update required",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Please update your Ledger app to continue."},"0x9808":{code:s.ErrorCode.AuthenticationFailed,message:"Contradiction in secret code status",severity:s.Severity.Err,category:s.Category.Authentication},"0x9840":{code:s.ErrorCode.AuthenticationDeviceBlocked,message:"Code blocked",severity:s.Severity.Critical,category:s.Category.Authentication,userMessage:"Your device is blocked due to too many failed attempts. Please follow device recovery procedures."},"0x650f":{code:s.ErrorCode.ConnectionClosed,message:"App closed or connection issue",severity:s.Severity.Err,category:s.Category.Connection,userMessage:"Connection lost or app closed. Please open the corresponding app on your Ledger device."},"0x5515":{code:s.ErrorCode.AuthenticationDeviceLocked,message:"Device is locked",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Please unlock your Ledger device to continue."},"0x5501":{code:s.ErrorCode.UserRejected,message:"User refused on device",severity:s.Severity.Warning,category:s.Category.UserAction,userMessage:"Operation was rejected. Please approve on your device to continue."},"0x6a80":{code:s.ErrorCode.DeviceStateBlindSignNotSupported,message:"Blind signing not supported",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Blind signing is not supported on this device."},"0x6d00":{code:s.ErrorCode.DeviceStateOnlyV4Supported,message:"Ledger Only V4 supported",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Only V4 is supported on this device."},"0x6e00":{code:s.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."},"0x6501":{code:s.ErrorCode.DeviceStateEthAppOutOfDate,message:"Ethereum app out of date",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is out of date. Please update it to continue."},"0x6f00":{code:s.ErrorCode.DeviceUnresponsive,message:"Device unresponsive",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Your device is not responding. Please disconnect and reconnect your device."},"0x6b0c":{code:s.ErrorCode.AuthenticationDeviceLocked,message:"Device locked",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Please unlock your Ledger device to continue."},"0x6a15":{code:s.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."},"0x6511":{code:s.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."}},n.BLE_ERROR_MAPPINGS={BLUETOOTH_PERMISSION_DENIED:{code:s.ErrorCode.PermissionBluetoothDenied,message:"Bluetooth permission denied",severity:s.Severity.Err,category:s.Category.Configuration,userMessage:"Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings."},LOCATION_PERMISSION_DENIED:{code:s.ErrorCode.PermissionLocationDenied,message:"Location permission denied",severity:s.Severity.Err,category:s.Category.Configuration,userMessage:"Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings."},NEARBY_DEVICES_PERMISSION_DENIED:{code:s.ErrorCode.PermissionNearbyDevicesDenied,message:"Nearby devices permission denied",severity:s.Severity.Err,category:s.Category.Configuration,userMessage:"Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings."},BLUETOOTH_DISABLED:{code:s.ErrorCode.BluetoothDisabled,message:"Bluetooth is turned off",severity:s.Severity.Warning,category:s.Category.Connection,userMessage:"Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet."},BLUETOOTH_SCAN_FAILED:{code:s.ErrorCode.BluetoothScanFailed,message:"Bluetooth scanning failed",severity:s.Severity.Err,category:s.Category.Connection,userMessage:"Unable to scan for Bluetooth devices. Please try again."},BLUETOOTH_CONNECTION_FAILED:{code:s.ErrorCode.BluetoothConnectionFailed,message:"Bluetooth connection failed",severity:s.Severity.Err,category:s.Category.Connection,userMessage:"Failed to connect via Bluetooth. Please make sure your device is nearby and try again."}},n.MOBILE_ERROR_MAPPINGS={NOT_SUPPORTED:{code:s.ErrorCode.MobileNotSupported,message:"Operation not supported on mobile",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"This operation is not supported on mobile devices."}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs",{"./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.HardwareWalletError=void 0;const a=e("./hardware-errors-enums.cjs");class i extends Error{constructor(e,t){super(e),s.add(this),this.name="HardwareWalletError",this.id=`err_${Date.now().toString(36)}_${Math.random().toString(36).substring(2,9)}`,this.code=t.code,this.severity=t.severity,this.category=t.category,this.userMessage=t.userMessage,this.timestamp=new Date,this.metadata=t.metadata,this.cause=t.cause}isCritical(){return this.severity===a.Severity.Critical}isWarning(){return this.severity===a.Severity.Warning}withMetadata(e){const t={code:this.code,severity:this.severity,category:this.category,userMessage:this.userMessage,metadata:{...this.metadata??{},...e}};return this.cause!==undefined&&(t.cause=this.cause),new i(this.message,t)}toJSON(){const e={id:this.id,name:this.name,message:this.message,code:this.code,severity:this.severity,category:this.category,userMessage:this.userMessage,timestamp:this.timestamp.toISOString(),metadata:this.metadata};return this.cause!==undefined&&(e.cause={name:this.cause.name,message:this.cause.message}),e}toString(){return`${o(this,s,"m",r).call(this)}: ${this.message}`}toDetailedString(){const e=[this.toString(),`User Message: ${this.userMessage}`,`Severity: ${this.severity}`,`Category: ${this.category}`,`Timestamp: ${this.timestamp.toISOString()}`];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`Metadata: ${JSON.stringify(this.metadata,null,2)}`),this.cause!==undefined&&e.push(`Caused by: ${this.cause.message}`),e.join("\n")}static isHardwareWalletError(e){return e instanceof i}}n.HardwareWalletError=i,s=new WeakSet,r=function(){const e=(t=this.code,a.ErrorCode[t]??a.ErrorCode[a.ErrorCode.Unknown]);var t;return`${this.name} [${e}:${this.code}]`}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.Category=n.Severity=n.ErrorCode=void 0,function(e){e[e.Success=0]="Success",e[e.AuthenticationFailed=1e3]="AuthenticationFailed",e[e.AuthenticationIncorrectPin=1001]="AuthenticationIncorrectPin",e[e.AuthenticationPinAttemptsRemaining=1002]="AuthenticationPinAttemptsRemaining",e[e.AuthenticationPinCancelled=1003]="AuthenticationPinCancelled",e[e.AuthenticationDeviceLocked=1100]="AuthenticationDeviceLocked",e[e.AuthenticationDeviceBlocked=1101]="AuthenticationDeviceBlocked",e[e.AuthenticationSecurityCondition=1200]="AuthenticationSecurityCondition",e[e.AuthenticationWipeCodeMismatch=1300]="AuthenticationWipeCodeMismatch",e[e.UserRejected=2e3]="UserRejected",e[e.UserCancelled=2001]="UserCancelled",e[e.UserConfirmationRequired=2002]="UserConfirmationRequired",e[e.UserInputRequired=2003]="UserInputRequired",e[e.DeviceNotReady=3e3]="DeviceNotReady",e[e.DeviceInvalidSession=3001]="DeviceInvalidSession",e[e.DeviceDisconnected=3003]="DeviceDisconnected",e[e.DeviceUsedElsewhere=3004]="DeviceUsedElsewhere",e[e.DeviceCallInProgress=3005]="DeviceCallInProgress",e[e.DeviceUnresponsive=3006]="DeviceUnresponsive",e[e.DeviceNotFound=3010]="DeviceNotFound",e[e.DeviceMultipleConnected=3011]="DeviceMultipleConnected",e[e.DeviceMissingCapability=3020]="DeviceMissingCapability",e[e.DeviceBtcOnlyFirmware=3021]="DeviceBtcOnlyFirmware",e[e.DeviceIncompatibleMode=3030]="DeviceIncompatibleMode",e[e.ConnectionTransportMissing=4e3]="ConnectionTransportMissing",e[e.ConnectionClosed=4001]="ConnectionClosed",e[e.ConnectionTimeout=4002]="ConnectionTimeout",e[e.ConnectionBlocked=4003]="ConnectionBlocked",e[e.ProtocolUnexpectedMessage=5e3]="ProtocolUnexpectedMessage",e[e.ProtocolCommandError=5001]="ProtocolCommandError",e[e.ProtocolMessageError=5002]="ProtocolMessageError",e[e.DeviceStateBlindSignNotSupported=6001]="DeviceStateBlindSignNotSupported",e[e.DeviceStateOnlyV4Supported=6002]="DeviceStateOnlyV4Supported",e[e.DeviceStateEthAppClosed=6003]="DeviceStateEthAppClosed",e[e.DeviceStateEthAppOutOfDate=6004]="DeviceStateEthAppOutOfDate",e[e.PermissionBluetoothDenied=7e3]="PermissionBluetoothDenied",e[e.PermissionLocationDenied=7001]="PermissionLocationDenied",e[e.PermissionNearbyDevicesDenied=7002]="PermissionNearbyDevicesDenied",e[e.BluetoothDisabled=7100]="BluetoothDisabled",e[e.BluetoothScanFailed=7101]="BluetoothScanFailed",e[e.BluetoothConnectionFailed=7102]="BluetoothConnectionFailed",e[e.MobileNotSupported=7300]="MobileNotSupported",e[e.TxInsufficientFunds=1e4]="TxInsufficientFunds",e[e.Unknown=99999]="Unknown"}(s||(n.ErrorCode=s={})),function(e){e.Info="Info",e.Err="Error",e.Warning="Warning",e.Critical="Critical"}(r||(n.Severity=r={})),function(e){e.Success="Success",e.Authentication="Authentication",e.Protocol="Protocol",e.Connection="Connection",e.UserAction="UserAction",e.DeviceState="DeviceState",e.Unknown="Unknown",e.Configuration="Configuration"}(o||(n.Category=o={}))}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs",{"./hardware-error-mappings.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs","./hardware-error.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs","./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./hardware-errors-enums.cjs"),n),r(e("./hardware-error-mappings.cjs"),n),r(e("./hardware-error.cjs"),n),r(e("./types.cjs"),n)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.DeviceEvent=n.ConnectionStatus=n.HardwareWalletType=void 0,function(e){e.Ledger="ledger",e.Trezor="trezor",e.OneKey="onekey",e.Lattice="lattice",e.Qr="qr",e.Unknown="unknown"}(s||(n.HardwareWalletType=s={})),function(e){e.Disconnected="disconnected",e.Scanning="scanning",e.Connecting="connecting",e.Connected="connected",e.Ready="ready",e.AwaitingApp="awaiting_app",e.AwaitingConfirmation="awaiting_confirmation",e.ErrorState="error"}(r||(n.ConnectionStatus=r={})),function(e){e.Connected="connected",e.Disconnected="disconnected",e.ConnectionFailed="connection_failed",e.DeviceLocked="device_locked",e.AppOpened="app_opened",e.AppNotOpen="app_not_open",e.AppChanged="app_changed",e.ConfirmationRequired="confirmation_required",e.ConfirmationReceived="confirmation_received",e.ConfirmationRejected="confirmation_rejected",e.OperationTimeout="operation_timeout",e.PermissionChanged="permission_changed"}(o||(n.DeviceEvent=o={}))}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/CaseInsensitiveMap.cjs",{"./util.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/util.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.CaseInsensitiveMap=void 0;const s=e("./util.cjs");class r extends Map{static fromObject(e){return new r(Object.entries(e))}toObject(){return Object.fromEntries(this.entries())}get(e){return super.get(e.toLowerCase())}getOrThrow(e,t="Key"){return this.get(e)??(0,s.throwError)(`${t} '${e}' not found`)}has(e){return super.has(e.toLowerCase())}set(e,t){return super.set(e.toLowerCase(),t)}delete(e){return super.delete(e.toLowerCase())}}n.CaseInsensitiveMap=r}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/CaseInsensitiveMap.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/DeferredPromise.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.DeferredPromise=void 0;n.DeferredPromise=class{constructor(){if(this.resolve=undefined,this.reject=undefined,this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t}),!this.resolve||!this.reject)throw new Error("Promise constructor failed")}}}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/DeferredPromise.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/SnapIdMap.cjs",{"./CaseInsensitiveMap.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/CaseInsensitiveMap.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.SnapIdMap=n.InvalidSnapIdError=void 0;const a=e("./CaseInsensitiveMap.cjs");class i extends Error{constructor(e,t){super(`Snap "${e}" is not allowed to set "${t}"`),this.name="InvalidSnapIdError",this.snapId=e,this.key=t}}n.InvalidSnapIdError=i;class c{constructor(e){s.set(this,void 0),r(this,s,new a.CaseInsensitiveMap(e),"f")}toObject(){return o(this,s,"f").toObject()}static fromObject(e){return new c(Object.entries(e))}get(e,t){const n=o(this,s,"f").get(t);return n?.snapId===e?n:undefined}getSnapId(e){return o(this,s,"f").get(e)?.snapId}pop(e,t){const n=this.get(e,t);return this.delete(e,t),n}has(e,t){return this.get(e,t)!==undefined}hasSnapId(e){return[...o(this,s,"f").values()].some(t=>t.snapId===e)}delete(e,t){return this.has(e,t)&&o(this,s,"f").delete(t)}set(e,t){if(o(this,s,"f").has(e)&&!this.has(t.snapId,e))throw new i(t.snapId,e);return o(this,s,"f").set(e,t),this}values(){return o(this,s,"f").values()}get size(){return o(this,s,"f").size}}n.SnapIdMap=c,s=new WeakMap}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/SnapIdMap.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/SnapKeyring.cjs",{"./DeferredPromise.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/DeferredPromise.cjs","./SnapIdMap.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/SnapIdMap.cjs","./SnapKeyringMessenger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/SnapKeyringMessenger.cjs","./account.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/account.cjs","./events.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/events.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/logger.cjs","./migrations/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/migrations/index.cjs","./options.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/options.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/types.cjs","./util.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/util.cjs","./versions.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/versions.cjs","@ethereumjs/tx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/tx/dist/cjs/index.js","@metamask/eth-sig-util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-sig-util/dist/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/keyring-internal-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-internal-api/dist/index.cjs","@metamask/keyring-internal-snap-client":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-internal-snap-client/dist/index.cjs","@metamask/keyring-snap-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-snap-sdk/dist/index.cjs","@metamask/keyring-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,d,l,u,m,h,p,f,g,k,w,_,b,y,E,S,A,I,T,v,C,x,j,N,O,R,D,P,M,B,L,F,U,H,q=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},G=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.SnapKeyring=n.SNAP_KEYRING_TYPE=void 0;const $=e("@ethereumjs/tx"),W=e("@metamask/eth-sig-util"),K=e("@metamask/keyring-api"),V=e("@metamask/keyring-internal-api"),Y=e("@metamask/keyring-internal-snap-client"),Q=e("@metamask/keyring-snap-sdk"),z=e("@metamask/keyring-utils"),J=e("@metamask/superstruct"),X=e("@metamask/utils"),Z=e("uuid"),ee=e("./account.cjs"),te=e("./DeferredPromise.cjs"),ne=e("./events.cjs"),se=e("./logger.cjs"),re=e("./migrations/index.cjs"),oe=e("./options.cjs"),ae=e("./SnapIdMap.cjs"),ie=e("./SnapKeyringMessenger.cjs"),ce=e("./types.cjs"),de=e("./util.cjs"),le=e("./versions.cjs");function ue(e){return(0,K.isEvmAccountType)(e.type)?e.address.toLowerCase():e.address}n.SNAP_KEYRING_TYPE="Snap Keyring";class me{constructor({messenger:e,callbacks:t,isAnyAccountTypeAllowed:n=!1}){s.add(this),this.name=ie.SNAP_KEYRING_NAME,this.state=null,r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),u.set(this,void 0),this.type=me.type,q(this,r,e,"f"),q(this,o,new Y.KeyringInternalSnapClient({messenger:e}),"f"),q(this,c,new ae.SnapIdMap,"f"),q(this,a,new ae.SnapIdMap,"f"),q(this,d,new ae.SnapIdMap,"f"),q(this,l,t,"f"),q(this,u,n,"f"),q(this,i,new Map,"f")}async handleKeyringSnapMessage(e,t){switch((0,J.assert)(t,ce.SnapMessageStruct),t.method){case`${K.KeyringEvent.AccountCreated}`:return G(this,s,"m",p).call(this,e,t);case`${K.KeyringEvent.AccountUpdated}`:return G(this,s,"m",f).call(this,e,t);case`${K.KeyringEvent.AccountDeleted}`:return G(this,s,"m",g).call(this,e,t);case`${K.KeyringEvent.RequestApproved}`:return G(this,s,"m",w).call(this,e,t);case`${K.KeyringEvent.RequestRejected}`:return G(this,s,"m",_).call(this,e,t);case`${K.KeyringEvent.AccountBalancesUpdated}`:return G(this,s,"m",y).call(this,e,t);case`${K.KeyringEvent.AccountAssetListUpdated}`:return G(this,s,"m",E).call(this,e,t);case`${K.KeyringEvent.AccountTransactionsUpdated}`:return G(this,s,"m",S).call(this,e,t);case`${Q.SnapManageAccountsMethod.GetSelectedAccounts}`:return G(this,s,"m",k).call(this,e,t);default:throw new Error(`Method not supported: ${t.method}`)}}async serialize(){return{accounts:G(this,a,"f").toObject()}}async deserialize(e){if(e===undefined)return;const t={};for(const[n,s]of Object.entries(e.accounts))(0,re.isAccountV1)(s.account)?(console.info(`SnapKeyring - Found a KeyringAccountV1, migrating to V2: ${s.account.id}`),t[n]={...s,account:(0,re.migrateAccountV1)(s.account)}):t[n]=s;q(this,a,ae.SnapIdMap.fromObject(t),"f")}async getAccounts(){return(0,de.unique)([...G(this,a,"f").values()].map(({account:e})=>ue(e)))}async getAccountsBySnapId(e){return(0,de.unique)([...G(this,a,"f").values()].filter(({snapId:t})=>t===e).map(({account:e})=>ue(e)))}async createAccount(e,t,n){const s=new Y.KeyringInternalSnapClient({messenger:G(this,r,"f"),snapId:e}),o="metamask";if((0,X.hasProperty)(t,o))throw new Error(`The '${o}' property is reserved for internal use`);if(!n)return await s.createAccount(t);const a=(0,Z.v4)();return G(this,d,"f").set(a,{snapId:e,options:n}),await s.createAccount({...t,metamask:{correlationId:a}})}hasSnapId(e){return G(this,a,"f").hasSnapId(e)}async resolveAccountAddress(e,t,n){if(!this.hasSnapId(e))throw new Error(`Unable to resolve account address: unknown Snap ID: ${e}`);return await G(this,o,"f").withSnapId(e).resolveAccountAddress(t,n)}async submitRequest({origin:e,account:t,method:n,params:r,scope:o}){const{account:a,snapId:i}=G(this,s,"m",A).call(this,t);return await G(this,s,"m",v).call(this,{origin:e,snapId:i,account:a,method:n,params:r,scope:o,noPending:!0})}async signTransaction(e,t,n={}){const r=t.common.chainId(),o=(0,de.toJson)({...t.toJSON(),from:e,type:`0x${t.type.toString(16)}`,chainId:(0,X.bigIntToHex)(r)}),a=await G(this,s,"m",I).call(this,{origin:"metamask",address:e,method:K.EthMethod.SignTransaction,params:[o],scope:(0,X.toCaipChainId)(X.KnownCaipNamespace.Eip155,`${r}`)}),i=(0,J.mask)(a,(0,J.object)({r:(0,J.string)(),s:(0,J.string)(),v:(0,J.string)()}));return $.TransactionFactory.fromTxData({...o,r:i.r,s:i.s,v:i.v})}async signTypedData(e,t,n={version:W.SignTypedDataVersion.V1}){const r={[W.SignTypedDataVersion.V1]:K.EthMethod.SignTypedDataV1,[W.SignTypedDataVersion.V3]:K.EthMethod.SignTypedDataV3,[W.SignTypedDataVersion.V4]:K.EthMethod.SignTypedDataV4}[n.version]||K.EthMethod.SignTypedDataV1,o=t.domain?.chainId;return(0,z.strictMask)(await G(this,s,"m",I).call(this,{origin:"metamask",address:e,method:r,params:(0,de.toJson)([e,t]),...o===undefined?{}:{scope:(0,X.toCaipChainId)(X.KnownCaipNamespace.Eip155,`${o}`)}}),K.EthBytesStruct)}async signMessage(e,t){return(0,z.strictMask)(await G(this,s,"m",I).call(this,{origin:"metamask",address:e,method:K.EthMethod.Sign,params:(0,de.toJson)([e,t])}),K.EthBytesStruct)}async signPersonalMessage(e,t){return(0,z.strictMask)(await G(this,s,"m",I).call(this,{origin:"metamask",address:e,method:K.EthMethod.PersonalSign,params:(0,de.toJson)([t,e])}),K.EthBytesStruct)}async prepareUserOperation(e,t,n){return(0,z.strictMask)(await G(this,s,"m",I).call(this,{origin:"metamask",address:e,method:K.EthMethod.PrepareUserOperation,params:(0,de.toJson)(t),noPending:!0,scope:(0,X.toCaipChainId)(X.KnownCaipNamespace.Eip155,n.chainId)}),K.EthBaseUserOperationStruct)}async patchUserOperation(e,t,n){return(0,z.strictMask)(await G(this,s,"m",I).call(this,{origin:"metamask",address:e,method:K.EthMethod.PatchUserOperation,params:(0,de.toJson)([t]),noPending:!0,scope:(0,X.toCaipChainId)(X.KnownCaipNamespace.Eip155,n.chainId)}),K.EthUserOperationPatchStruct)}async signUserOperation(e,t,n){return(0,z.strictMask)(await G(this,s,"m",I).call(this,{origin:"metamask",address:e,method:K.EthMethod.SignUserOperation,params:(0,de.toJson)([t]),scope:(0,X.toCaipChainId)(X.KnownCaipNamespace.Eip155,n.chainId)}),K.EthBytesStruct)}exportAccount(e){throw new Error("Exporting accounts from snaps is not supported.")}async removeAccount(e){const{account:t,snapId:n}=G(this,s,"m",M).call(this,e);await G(this,s,"m",P).call(this,n,t)}async setSelectedAccounts(e){G(this,s,"m",B).call(this,e);const t=[...G(this,i,"f").entries()];await Promise.all(t.map(async([e,t])=>{try{await G(this,o,"f").withSnapId(e).setSelectedAccounts(t)}catch(t){console.error(`Failed to set selected accounts for ${e} snap: '${t.message}'`)}}))}getAccountByAddress(e){const t=[...G(this,a,"f").values()].find(({account:{address:t}})=>(0,de.equalsIgnoreCase)(t,e));return t?G(this,s,"m",H).call(this,t.account,t.snapId):undefined}listAccounts(){return[...G(this,a,"f").values()].map(({account:e,snapId:t})=>G(this,s,"m",H).call(this,e,t))}}n.SnapKeyring=me,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,s=new WeakSet,m=function(e){return(0,le.getKeyringVersionFromPlatform)(t=>G(this,r,"f").call("SnapController:isMinimumPlatformVersion",e,t))},h=function(e,t){if(t){const n=G(this,d,"f").pop(e,t);if(n)return n.options;console.warn(`SnapKeyring - Received unmapped correlation ID: "${t}"`)}return undefined},p=async function(e,t){(0,J.assert)(t,ne.AccountCreatedEventStruct);const{metamask:n,account:r,accountNameSuggestion:o,displayAccountNameSuggestion:i,displayConfirmation:c}=t.params,d=(0,ee.transformAccount)(r),m=ue(d);if(!G(this,u,"f")&&d.type===K.AnyAccountType.Account)throw new Error(`Cannot create generic account '${d.id}'`);const p=G(this,a,"f").get(e,d.id);if(p&&ue(p.account)===m)return null;if(await G(this,l,"f").addressExists(m))throw new Error(`Account address '${m}' already exists`);if(G(this,a,"f").has(e,d.id))throw new Error(`Account '${d.id}' already exists`);const f=new te.DeferredPromise;return await G(this,l,"f").addAccount(m,e,async t=>{t&&(G(this,a,"f").set(d.id,{account:d,snapId:e}),G(this,l,"f").saveState().then(()=>{f.resolve(d.id)}).catch(async t=>{await G(this,s,"m",P).call(this,e,d),f.reject(t)}))},f.promise,o,(0,oe.getInternalOptionsOf)([G(this,s,"m",h).call(this,e,n?.correlationId)??{},{displayConfirmation:c,displayAccountNameSuggestion:i}])),null},f=async function(e,t){(0,J.assert)(t,ne.AccountUpdatedEventStruct);const{account:n}=t.params,{account:s}=G(this,a,"f").get(e,n.id)??(0,de.throwError)(`Account '${n.id}' not found`),r=(0,ee.transformAccount)(n),o=r.type===K.AnyAccountType.Account||s.type===K.AnyAccountType.Account;if(!G(this,u,"f")&&o)throw new Error(`Cannot update generic account '${r.id}'`);if(!(0,de.equalsIgnoreCase)(s.address,r.address))throw new Error(`Cannot change address of account '${r.id}'`);return G(this,a,"f").set(r.id,{account:r,snapId:e}),await G(this,l,"f").saveState(),null},g=async function(e,t){(0,J.assert)(t,ne.AccountDeletedEventStruct);const{id:n}=t.params,s=G(this,a,"f").get(e,n);if(s===undefined)return null;const{account:r}=s;return await G(this,l,"f").removeAccount(ue(r),e,async e=>{e&&await G(this,l,"f").saveState()}),null},k=async function(e,t){return(0,J.assert)(t,Q.GetSelectedAccountsRequestStruct),G(this,i,"f").get(e)??[]},w=async function(e,t){(0,J.assert)(t,ne.RequestApprovedEventStruct);const{id:n,result:s}=t.params,{promise:r}=G(this,c,"f").get(e,n)??(0,de.throwError)(`Request '${n}' not found`);return G(this,c,"f").delete(e,n),r.resolve(s),null},_=async function(e,t){(0,J.assert)(t,ne.RequestRejectedEventStruct);const{id:n}=t.params,{promise:s}=G(this,c,"f").get(e,n)??(0,de.throwError)(`Request '${n}' not found`);return G(this,c,"f").delete(e,n),s.reject(new Error("Request rejected by user or snap.")),null},b=async function(e,t,n){return G(this,r,"f").publish(t,...n(n=>Object.entries(n).reduce((n,[s,r])=>(G(this,a,"f").has(e,s)?n[s]=r:console.warn(`SnapKeyring - ${t} - Found an unknown account ID "${s}" for Snap ID "${e}". Skipping.`),n),{}))),null},y=async function(e,t){(0,J.assert)(t,K.AccountBalancesUpdatedEventStruct);const n=t.params;return G(this,s,"m",b).call(this,e,"SnapKeyring:accountBalancesUpdated",e=>(n.balances=e(n.balances),[n]))},E=async function(e,t){(0,J.assert)(t,K.AccountAssetListUpdatedEventStruct);const n=t.params;return G(this,s,"m",b).call(this,e,"SnapKeyring:accountAssetListUpdated",e=>(n.assets=e(n.assets),[n]))},S=async function(e,t){(0,J.assert)(t,K.AccountTransactionsUpdatedEventStruct);const n=t.params;return G(this,s,"m",b).call(this,e,"SnapKeyring:accountTransactionsUpdated",e=>(n.transactions=e(n.transactions),[n]))},A=function(e){const t=[...G(this,a,"f").values()].find(t=>t.account.id===e);if(!t)throw new Error(`Unable to get account: unknown account ID: '${e}'`);return t},I=async function({origin:e,address:t,method:n,params:r,scope:o="",noPending:a=!1}){const{account:i,snapId:c}=G(this,s,"m",M).call(this,t);return await G(this,s,"m",v).call(this,{origin:e,snapId:c,account:i,method:n,params:r,scope:o,noPending:a})},T=async function({snapId:e,version:t,request:n}){const s=G(this,o,"f").withSnapId(e);return t===V.KeyringVersion.V1?await s.submitRequestV1((0,V.toKeyringRequestV1)(n)):await s.submitRequest(n)},v=async function({origin:e,snapId:t,account:n,method:r,params:o,scope:a,noPending:i}){if(!G(this,s,"m",C).call(this,n,r))throw new Error(`Method '${r}' not supported for account ${n.address}`);if(!e?.trim())throw new Error("An `origin` is required");const c=(0,Z.v4)(),d=G(this,s,"m",x).call(this,c,t);try{const l=G(this,s,"m",m).call(this,t),u={id:c,origin:e,scope:a,account:n.id,request:{method:r,...o!==undefined&&{params:o}}};(0,se.projectLogger)("Submit Snap request: ",u);const h=await G(this,s,"m",T).call(this,{version:l,snapId:t,request:u});if(i&&h.pending)throw new Error(`Request '${c}' to Snap '${t}' is pending and noPending is true.`);return h.pending?((h.redirect?.message||h.redirect?.url)&&await G(this,s,"m",O).call(this,h.redirect,t),d.promise):G(this,s,"m",N).call(this,h,c,t)}catch(e){throw(0,se.projectLogger)("Snap Request failed: ",{requestId:c}),G(this,s,"m",j).call(this,c,t),e}},C=function(e,t){return e.methods.includes(t)},x=function(e,t){const n=new te.DeferredPromise;return G(this,c,"f").set(e,{promise:n,snapId:t}),n},j=function(e,t){G(this,c,"f").delete(t,e)},N=function(e,t,n){return G(this,c,"f").delete(n,t),e.result},O=async function(e,t){const{message:n="",url:r=""}=e,o=G(this,s,"m",R).call(this,r);o&&G(this,s,"m",D).call(this,o,t),await G(this,l,"f").redirectUser(t,o,n)},R=function(e){return e?(0,de.sanitizeUrl)(e):e},D=function(e,t){const{origin:n}=new URL(e),r=G(this,s,"m",L).call(this,t);if(!r)throw new Error(`Snap '${t}' not found.`);if(!G(this,s,"m",U).call(this,r).includes(n))throw new Error(`Redirect URL domain '${n}' is not an allowed origin by snap '${t}'`)},P=async function(e,t){G(this,a,"f").delete(e,t.id);try{await G(this,o,"f").withSnapId(e).deleteAccount(t.id)}catch(n){console.error(`Account '${t.address}' may not have been removed from snap '${e}':`,n)}},M=function(e){return[...G(this,a,"f").values()].find(({account:t})=>(0,de.equalsIgnoreCase)(t.address,e))??(0,de.throwError)(`Account '${e}' not found`)},B=function(e){const t=G(this,i,"f");t.clear();for(const n of e){const e=G(this,a,"f").getSnapId(n);if(!e)continue;const s=t.get(e)??[];s.push(n),t.set(e,s)}},L=function(e){return G(this,r,"f").call("SnapController:get",e)},F=function(e){const t=G(this,s,"m",L).call(this,e);return t?{id:e,name:t.manifest.proposedName,enabled:t.enabled}:undefined},U=function(e){return e.manifest.initialPermissions["endowment:keyring"]?.allowedOrigins??[]},H=function(e,t){const n=G(this,s,"m",F).call(this,t);return{...e,address:ue(e),metadata:{name:"",importTime:0,keyring:{type:this.type},...n!==undefined&&{snap:n}}}},me.type=n.SNAP_KEYRING_TYPE}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/SnapKeyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/SnapKeyringMessenger.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SNAP_KEYRING_NAME=void 0,n.SNAP_KEYRING_NAME="SnapKeyring"}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/SnapKeyringMessenger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/account.cjs",{"./migrations/index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/migrations/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.KeyringAccountV1Struct=void 0,n.assertKeyringAccount=a,n.transformAccount=function(e){return a((0,o.isAccountV1)(e)?(0,o.transformAccountV1)(e):e)};const s=e("@metamask/keyring-api"),r=e("@metamask/superstruct"),o=e("./migrations/index.cjs");function a(e){switch(e.type){case s.BtcAccountType.P2pkh:return(0,r.assert)(e,s.BtcP2pkhAccountStruct),e;case s.BtcAccountType.P2sh:return(0,r.assert)(e,s.BtcP2shAccountStruct),e;case s.BtcAccountType.P2wpkh:return(0,r.assert)(e,s.BtcP2wpkhAccountStruct),e;case s.BtcAccountType.P2tr:return(0,r.assert)(e,s.BtcP2trAccountStruct),e;case s.SolAccountType.DataAccount:return(0,r.assert)(e,s.SolDataAccountStruct),e;case s.EthAccountType.Erc4337:return(0,r.assert)(e,s.EthErc4337AccountStruct),e;case s.EthAccountType.Eoa:return(0,r.assert)(e,s.EthEoaAccountStruct),e;case s.TrxAccountType.Eoa:return(0,r.assert)(e,s.TrxEoaAccountStruct),e;case s.AnyAccountType.Account:return(0,r.assert)(e,s.KeyringAccountStruct),e;default:throw new Error(`Unknown account type: '${e.type}'`)}}n.KeyringAccountV1Struct=(0,r.omit)(s.KeyringAccountStruct,["scopes"])}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/account.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/events.cjs",{"./account.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/account.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/keyring-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.RequestRejectedEventStruct=n.RequestApprovedEventStruct=n.AccountDeletedEventStruct=n.AccountUpdatedEventStruct=n.AccountCreatedEventStruct=void 0;const s=e("@metamask/keyring-api");Object.defineProperty(n,"AccountDeletedEventStruct",{enumerable:!0,get:function(){return s.AccountDeletedEventStruct}}),Object.defineProperty(n,"RequestApprovedEventStruct",{enumerable:!0,get:function(){return s.RequestApprovedEventStruct}}),Object.defineProperty(n,"RequestRejectedEventStruct",{enumerable:!0,get:function(){return s.RequestRejectedEventStruct}});const r=e("@metamask/keyring-utils"),o=e("@metamask/superstruct"),a=e("./account.cjs");n.AccountCreatedEventStruct=(0,r.object)({...s.AccountCreatedEventStruct.schema,params:(0,r.object)({...s.AccountCreatedEventStruct.schema.params.schema,account:(0,o.union)([a.KeyringAccountV1Struct,s.KeyringAccountStruct])})}),n.AccountUpdatedEventStruct=(0,r.object)({...s.AccountUpdatedEventStruct.schema,params:(0,r.object)({...s.AccountUpdatedEventStruct.schema.params.schema,account:(0,o.union)([a.KeyringAccountV1Struct,s.KeyringAccountStruct])})})}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/events.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/index.cjs",{"./SnapKeyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/SnapKeyring.cjs","./options.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/options.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./options.cjs"),n),r(e("./types.cjs"),n),r(e("./SnapKeyring.cjs"),n)}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/logger.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const s=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return s.createModuleLogger}}),n.projectLogger=(0,s.createProjectLogger)("eth-snap-keyring")}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/migrations/index.cjs",{"./v1.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/migrations/v1.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./v1.cjs"),n)}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/migrations/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/migrations/v1.cjs",{"../account.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/account.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/keyring-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isAccountV1=i,n.getScopesForAccountV1=c,n.transformAccountV1=function(e){const{type:t}=e;if(t===s.EthAccountType.Eoa)return{...e,scopes:c(e)};return(0,a.assertKeyringAccount)(e)},n.migrateAccountV1=function(e){if(!i(e))return e;return{...e,scopes:c(e)}};const s=e("@metamask/keyring-api"),r=e("@metamask/keyring-utils"),o=e("@metamask/superstruct"),a=e("../account.cjs");function i(e){return(0,o.is)(e,a.KeyringAccountV1Struct)}function c(e){switch(e.type){case s.EthAccountType.Eoa:return[s.EthScope.Eoa];case s.EthAccountType.Erc4337:return[s.EthScope.Testnet];case s.BtcAccountType.P2pkh:case s.BtcAccountType.P2sh:case s.BtcAccountType.P2wpkh:case s.BtcAccountType.P2tr:return[(0,r.isBtcMainnetAddress)(e.address)?s.BtcScope.Mainnet:s.BtcScope.Testnet];case s.SolAccountType.DataAccount:return[s.SolScope.Mainnet,s.SolScope.Testnet,s.SolScope.Devnet];case s.TrxAccountType.Eoa:return[s.TrxScope.Mainnet,s.TrxScope.Nile,s.TrxScope.Shasta];default:return[s.EthScope.Eoa]}}}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/migrations/v1.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/options.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function s(){return{displayAccountNameSuggestion:!0,displayConfirmation:!0,setSelectedAccount:!0}}Object.defineProperty(n,"__esModule",{value:!0}),n.getDefaultInternalOptions=s,n.getInternalOptionsOf=function(e){const t={},n={displayAccountNameSuggestion:!0,displayConfirmation:!0,setSelectedAccount:!0},s=Object.keys(n);for(const r of s){t[r]=undefined;for(const s of[...e,n])s[r]!==undefined&&t[r]===undefined&&(t[r]=s[r])}return t}}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/options.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SnapMessageStruct=void 0;const s=e("@metamask/superstruct"),r=e("@metamask/utils");n.SnapMessageStruct=(0,s.object)({method:(0,s.string)(),params:(0,s.optional)((0,s.union)([(0,s.array)(r.JsonStruct),(0,s.record)((0,s.string)(),r.JsonStruct)]))})}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/util.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.unique=function(e){return[...new Set(e)]},n.toJson=function(e){return JSON.parse(JSON.stringify(e))},n.ensureDefined=function(e){if(e===undefined)throw new Error("Argument is undefined")},n.throwError=function(e){throw new Error(e)},n.equalsIgnoreCase=function(e,t){return e.toLowerCase()===t.toLowerCase()},n.sanitizeUrl=function(e){return new URL(e).toString()}}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/util.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/dist/versions.cjs",{"@metamask/keyring-internal-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-internal-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.PLATFORM_VERSION_TO_KEYRING_VERSION=void 0,n.getKeyringVersionFromPlatform=function(e){for(const[t,s]of n.PLATFORM_VERSION_TO_KEYRING_VERSION)if(e(t))return s;return s.KeyringVersion.V1};const s=e("@metamask/keyring-internal-api");n.PLATFORM_VERSION_TO_KEYRING_VERSION=[["7.0.0",s.KeyringVersion.V2]]}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/versions.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/index.js",{"./nil.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/nil.js","./parse.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/parse.js","./stringify.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/stringify.js","./v1.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/v1.js","./v3.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/v3.js","./v4.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/v4.js","./v5.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/v5.js","./validate.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/validate.js","./version.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/version.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"NIL",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(n,"parse",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(n,"v1",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(n,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(n,"v4",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(n,"v5",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(n,"validate",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(n,"version",{enumerable:!0,get:function(){return c.default}});var s=m(e("./v1.js")),r=m(e("./v3.js")),o=m(e("./v4.js")),a=m(e("./v5.js")),i=m(e("./nil.js")),c=m(e("./version.js")),d=m(e("./validate.js")),l=m(e("./stringify.js")),u=m(e("./parse.js"));function m(e){return e&&e.__esModule?e:{default:e}}}}},{package:"@metamask/eth-snap-keyring>uuid",file:"node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/md5-browser.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function s(e){return 14+(e+64>>>9<<4)+1}function r(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,s,o,a){return r((i=r(r(t,e),r(s,a)))<<(c=o)|i>>>32-c,n);var i,c}function a(e,t,n,s,r,a,i){return o(t&n|~t&s,e,t,r,a,i)}function i(e,t,n,s,r,a,i){return o(t&s|n&~s,e,t,r,a,i)}function c(e,t,n,s,r,a,i){return o(t^n^s,e,t,r,a,i)}function d(e,t,n,s,r,a,i){return o(n^(t|~s),e,t,r,a,i)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var l=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length,s="0123456789abcdef";for(let r=0;r<n;r+=8){const n=e[r>>5]>>>r%32&255,o=parseInt(s.charAt(n>>>4&15)+s.charAt(15&n),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[s(t)-1]=t;let n=1732584193,o=-271733879,l=-1732584194,u=271733878;for(let t=0;t<e.length;t+=16){const s=n,m=o,h=l,p=u;n=a(n,o,l,u,e[t],7,-680876936),u=a(u,n,o,l,e[t+1],12,-389564586),l=a(l,u,n,o,e[t+2],17,606105819),o=a(o,l,u,n,e[t+3],22,-1044525330),n=a(n,o,l,u,e[t+4],7,-176418897),u=a(u,n,o,l,e[t+5],12,1200080426),l=a(l,u,n,o,e[t+6],17,-1473231341),o=a(o,l,u,n,e[t+7],22,-45705983),n=a(n,o,l,u,e[t+8],7,1770035416),u=a(u,n,o,l,e[t+9],12,-1958414417),l=a(l,u,n,o,e[t+10],17,-42063),o=a(o,l,u,n,e[t+11],22,-1990404162),n=a(n,o,l,u,e[t+12],7,1804603682),u=a(u,n,o,l,e[t+13],12,-40341101),l=a(l,u,n,o,e[t+14],17,-1502002290),o=a(o,l,u,n,e[t+15],22,1236535329),n=i(n,o,l,u,e[t+1],5,-165796510),u=i(u,n,o,l,e[t+6],9,-1069501632),l=i(l,u,n,o,e[t+11],14,643717713),o=i(o,l,u,n,e[t],20,-373897302),n=i(n,o,l,u,e[t+5],5,-701558691),u=i(u,n,o,l,e[t+10],9,38016083),l=i(l,u,n,o,e[t+15],14,-660478335),o=i(o,l,u,n,e[t+4],20,-405537848),n=i(n,o,l,u,e[t+9],5,568446438),u=i(u,n,o,l,e[t+14],9,-1019803690),l=i(l,u,n,o,e[t+3],14,-187363961),o=i(o,l,u,n,e[t+8],20,1163531501),n=i(n,o,l,u,e[t+13],5,-1444681467),u=i(u,n,o,l,e[t+2],9,-51403784),l=i(l,u,n,o,e[t+7],14,1735328473),o=i(o,l,u,n,e[t+12],20,-1926607734),n=c(n,o,l,u,e[t+5],4,-378558),u=c(u,n,o,l,e[t+8],11,-2022574463),l=c(l,u,n,o,e[t+11],16,1839030562),o=c(o,l,u,n,e[t+14],23,-35309556),n=c(n,o,l,u,e[t+1],4,-1530992060),u=c(u,n,o,l,e[t+4],11,1272893353),l=c(l,u,n,o,e[t+7],16,-155497632),o=c(o,l,u,n,e[t+10],23,-1094730640),n=c(n,o,l,u,e[t+13],4,681279174),u=c(u,n,o,l,e[t],11,-358537222),l=c(l,u,n,o,e[t+3],16,-722521979),o=c(o,l,u,n,e[t+6],23,76029189),n=c(n,o,l,u,e[t+9],4,-640364487),u=c(u,n,o,l,e[t+12],11,-421815835),l=c(l,u,n,o,e[t+15],16,530742520),o=c(o,l,u,n,e[t+2],23,-995338651),n=d(n,o,l,u,e[t],6,-198630844),u=d(u,n,o,l,e[t+7],10,1126891415),l=d(l,u,n,o,e[t+14],15,-1416354905),o=d(o,l,u,n,e[t+5],21,-57434055),n=d(n,o,l,u,e[t+12],6,1700485571),u=d(u,n,o,l,e[t+3],10,-1894986606),l=d(l,u,n,o,e[t+10],15,-1051523),o=d(o,l,u,n,e[t+1],21,-2054922799),n=d(n,o,l,u,e[t+8],6,1873313359),u=d(u,n,o,l,e[t+15],10,-30611744),l=d(l,u,n,o,e[t+6],15,-1560198380),o=d(o,l,u,n,e[t+13],21,1309151649),n=d(n,o,l,u,e[t+4],6,-145523070),u=d(u,n,o,l,e[t+11],10,-1120210379),l=d(l,u,n,o,e[t+2],15,718787259),o=d(o,l,u,n,e[t+9],21,-343485551),n=r(n,s),o=r(o,m),l=r(l,h),u=r(u,p)}return[n,o,l,u]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(s(t));for(let s=0;s<t;s+=8)n[s>>5]|=(255&e[s/8])<<s%32;return n}(e),8*e.length))};n.default=l}}},{package:"@metamask/eth-snap-keyring>uuid",file:"node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/md5-browser.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/native-browser.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var s={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};n.default=s}}},{package:"@metamask/eth-snap-keyring>uuid",file:"node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/native-browser.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/nil.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default="00000000-0000-0000-0000-000000000000"}}},{package:"@metamask/eth-snap-keyring>uuid",file:"node_modules/@metamask/eth-snap-keyring/node_modules/uuid/dist/nil.js"}]],[],{});