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,s){Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"FirebaseError",{enumerable:!0,get:function(){return r.FirebaseError}}),s._DEFAULT_ENTRY_NAME=s.SDK_VERSION=void 0,s._addComponent=U,s._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},s._apps=void 0,s._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.
 */,s._components=void 0,s._getProvider=W,s._isFirebaseApp=$,s._isFirebaseServerApp=function(e){return e.settings!==undefined},s._registerComponent=q,s._removeServiceInstance=function(e,t,s=L){W(e,t).clearInstance(s)},s._serverApps=void 0,s.deleteApp=J,s.getApp=function(e=L){const t=B.get(e);if(!t&&e===L&&(0,r.getDefaultAppConfig)())return z();if(!t)throw K.create("no-app",{appName:e});return t},s.getApps=function(){return Array.from(B.values())},s.initializeApp=z,s.initializeServerApp=function(e,t){if((0,r.isBrowser)()&&!(0,r.isWebWorker)())throw K.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let s;s=$(e)?e.options:e;const a=Object.assign(Object.assign({},t),s);a.releaseOnDeref!==undefined&&delete a.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw K.create("finalization-registry-not-supported",{});const i=""+(c=JSON.stringify(a),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),o=G.get(i);var c;if(o)return o.incRefCount(t.releaseOnDeref),o;const d=new n.ComponentContainer(i);for(const e of H.values())d.addComponent(e);const l=new Q(s,t,i,d);return G.set(i,l),l},s.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw K.create("invalid-log-argument");(0,a.setUserLogHandler)(e,t)},s.registerVersion=X,s.setLogLevel=function(e){(0,a.setLogLevel)(e)}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */;var n=e("@firebase/component"),a=e("@firebase/logger"),r=e("@firebase/util"),i=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 o{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 a.Logger("@firebase/app"),m="@firebase/app-compat",u="@firebase/analytics-compat",h="@firebase/analytics",f="@firebase/app-check-compat",p="@firebase/app-check",g="@firebase/auth",k="@firebase/auth-compat",b="@firebase/database",w="@firebase/data-connect",_="@firebase/database-compat",T="@firebase/functions",E="@firebase/functions-compat",S="@firebase/installations",I="@firebase/installations-compat",A="@firebase/messaging",y="@firebase/messaging-compat",x="@firebase/performance",v="@firebase/performance-compat",C="@firebase/remote-config",j="@firebase/remote-config-compat",P="@firebase/storage",D="@firebase/storage-compat",N="@firebase/firestore",R="@firebase/vertexai",O="@firebase/firestore-compat",M="firebase",L=s._DEFAULT_ENTRY_NAME="[DEFAULT]",F={[c]:"fire-core",[m]:"fire-core-compat",[h]:"fire-analytics",[u]:"fire-analytics-compat",[p]:"fire-app-check",[f]:"fire-app-check-compat",[g]:"fire-auth",[k]:"fire-auth-compat",[b]:"fire-rtdb",[w]:"fire-data-connect",[_]:"fire-rtdb-compat",[T]:"fire-fn",[E]:"fire-fn-compat",[S]:"fire-iid",[I]:"fire-iid-compat",[A]:"fire-fcm",[y]:"fire-fcm-compat",[x]:"fire-perf",[v]:"fire-perf-compat",[C]:"fire-rc",[j]:"fire-rc-compat",[P]:"fire-gcs",[D]:"fire-gcs-compat",[N]:"fire-fst",[O]:"fire-fst-compat",[R]:"fire-vertex","fire-js":"fire-js",[M]:"fire-js-all"},B=s._apps=new Map,G=s._serverApps=new Map,H=s._components=new Map;function U(e,t){try{e.container.addComponent(t)}catch(s){l.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function q(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 B.values())U(t,e);for(const t of G.values())U(t,e);return!0}function W(e,t){const s=e.container.getProvider("heartbeat").getImmediate({optional:!0});return s&&s.triggerHeartbeat(),e.container.getProvider(t)}function $(e){return e.options!==undefined}const V={"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."},K=new r.ErrorFactory("app","Firebase",V);
/**
 * @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,s){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=s,this.container.addComponent(new n.Component("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw K.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,s,n){const a=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,r={name:s,automaticDataCollectionEnabled:a};if(e.apiKey!==undefined)super(e,r,n);else{super(e.options,r,n)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:a},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 K.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.
 */s.SDK_VERSION="11.2.0";function z(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:L,automaticDataCollectionEnabled:!1},t),i=a.name;if("string"!=typeof i||!i)throw K.create("bad-app-name",{appName:String(i)});if(s||(s=(0,r.getDefaultAppConfig)()),!s)throw K.create("no-options");const o=B.get(i);if(o){if((0,r.deepEqual)(s,o.options)&&(0,r.deepEqual)(a,o.config))return o;throw K.create("duplicate-app",{appName:i})}const c=new n.ComponentContainer(i);for(const e of H.values())c.addComponent(e);const d=new Y(s,a,c);return B.set(i,d),d}async function J(e){let t=!1;const s=e.name;if(B.has(s))t=!0,B.delete(s);else if(G.has(s)){e.decRefCount()<=0&&(G.delete(s),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function X(e,t,s){var a;let r=null!==(a=F[e])&&void 0!==a?a:e;s&&(r+=`-${s}`);const i=r.match(/\s|\//),o=t.match(/\s|\//);if(i||o){const e=[`Unable to register library "${r}" with version "${t}":`];return i&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void l.warn(e.join(" "))}q(new n.Component(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,i.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw K.create("idb-open",{originalErrorMessage:e.message})})),ee}async function se(e,t){try{const s=(await te()).transaction(Z,"readwrite"),n=s.objectStore(Z);await n.put(t,ne(e)),await s.done}catch(e){if(e instanceof r.FirebaseError)l.warn(e.message);else{const t=K.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});l.warn(t.message)}}}function ne(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 ae{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ie(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=re();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some(e=>e.date===n))return;return this._heartbeatsCache.heartbeats.push({date:n,agent:s}),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=re(),{heartbeatsToSend:s,unsentEntries:n}=function(e,t=1024){const s=[];let n=e.slice();for(const a of e){const e=s.find(e=>e.agent===a.agent);if(e){if(e.dates.push(a.date),oe(s)>t){e.dates.pop();break}}else if(s.push({agent:a.agent,dates:[a.date]}),oe(s)>t){s.pop();break}n=n.slice(1)}return{heartbeatsToSend:s,unsentEntries:n}}(this._heartbeatsCache.heartbeats),a=(0,r.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:s}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(e){return l.warn(e),""}}}function re(){return(new Date).toISOString().substring(0,10)}class ie{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,r.isIndexedDBAvailable)()&&(0,r.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),s=await t.objectStore(Z).get(ne(e));return await t.done,s}catch(e){if(e instanceof r.FirebaseError)l.warn(e.message);else{const t=K.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 s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return se(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}}}function oe(e){return(0,r.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="",q(new n.Component("platform-logger",e=>new o(e),"PRIVATE")),q(new n.Component("heartbeat",e=>new ae(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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.Provider=s.ComponentContainer=s.Component=void 0;var n=e("@firebase/util");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
s.Component=class{constructor(e,t,s){this.name=e,this.instanceFactory=t,this.type=s,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 a="[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 r{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new n.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&e.resolve(s)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const s=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(s)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:s})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e))try{this.getOrInitializeService({instanceIdentifier:a})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:s});t.resolve(e)}catch(e){}}}}clearInstance(e=a){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=a){return this.instances.has(e)}getOptions(e=a){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,s=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(s))throw Error(`${this.name}(${s}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:s,options:t});for(const[e,t]of this.instancesDeferred.entries()){s===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var s;const n=this.normalizeInstanceIdentifier(t),a=null!==(s=this.onInitCallbacks.get(n))&&void 0!==s?s:new Set;a.add(e),this.onInitCallbacks.set(n,a);const r=this.instances.get(n);return r&&e(r,n),()=>{a.delete(e)}}invokeOnInitCallbacks(e,t){const s=this.onInitCallbacks.get(t);if(s)for(const n of s)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let s=this.instances.get(e);if(!s&&this.component&&(s=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===a?undefined:n),options:t}),this.instances.set(e,s),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(s,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,s)}catch(e){}var n;return s||null}normalizeInstanceIdentifier(e=a){return this.component?this.component.multipleInstances?e:a:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}s.Provider=r;s.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 r(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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.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,s=await H(t,e=>e&&0===e.registrationStatus?undefined:e);if(s){if(1===s.registrationStatus)throw p.create("delete-pending-registration");if(2===s.registrationStatus){if(!navigator.onLine)throw p.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 s=function(e,{fid:t}){return`${k(e)}/${t}`}(e,t),n=T(e,t),a={method:"DELETE",headers:n},r=await E(()=>fetch(s,a));if(!r.ok)throw await w("Delete Installation",r)}(t,s),await G(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.
 */,s.getId=z,s.getInstallations=
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,n.getApp)()){return(0,n._getProvider)(e,"installations").getImmediate()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.getToken=J,s.onIdChange=function(e,t){const{appConfig:s}=e;return function(e,t){D();const s=x(e);let n=v.get(s);n||(n=new Set,v.set(s,n));n.add(t)}(s,t),()=>{!function(e,t){const s=x(e),n=v.get(s);if(!n)return;n.delete(t),0===n.size&&v.delete(s);N()}(s,t)}};var n=e("@firebase/app"),a=e("@firebase/component"),r=e("@firebase/util"),i=e("idb");const o="@firebase/installations",c="0.6.12",d=1e4,l=`w:${c}`,m="FIS_v2",u="https://firebaseinstallations.googleapis.com/v1",h=36e5,f={"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."},p=new r.ErrorFactory("installations","Installations",f);function g(e){return e instanceof r.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`${u}/projects/${e}/installations`}function b(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function w(e,t){const s=(await t.json()).error;return p.create("request-failed",{requestName:e,serverCode:s.code,serverMessage:s.message,serverStatus:s.status})}function _({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function T(e,{refreshToken:t}){const s=_(e);return s.append("Authorization",function(e){return`${m} ${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)),s}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 I=/^[cdef][\w-]{21}$/,A="";function y(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(s=e,btoa(String.fromCharCode(...s)).replace(/\+/g,"-").replace(/\//g,"_"));var s;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 I.test(t)?t:A}catch(e){return A}}function x(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 v=new Map;function C(e,t){const s=x(e);j(s,t),function(e,t){const s=D();s&&s.postMessage({key:e,fid:t});N()}(s,t)}function j(e,t){const s=v.get(e);if(s)for(const e of s)e(t)}let P=null;function D(){return!P&&"BroadcastChannel"in self&&(P=new BroadcastChannel("[Firebase] FID Change"),P.onmessage=e=>{j(e.data.key,e.data.fid)}),P}function N(){0===v.size&&P&&(P.close(),P=null)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R="firebase-installations-database",O=1,M="firebase-installations-store";let L=null;function F(){return L||(L=(0,i.openDB)(R,O,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(M)}})),L}async function B(e,t){const s=x(e),n=(await F()).transaction(M,"readwrite"),a=n.objectStore(M),r=await a.get(s);return await a.put(t,s),await n.done,r&&r.fid===t.fid||C(e,t.fid),t}async function G(e){const t=x(e),s=(await F()).transaction(M,"readwrite");await s.objectStore(M).delete(t),await s.done}async function H(e,t){const s=x(e),n=(await F()).transaction(M,"readwrite"),a=n.objectStore(M),r=await a.get(s),i=t(r);return i===undefined?await a.delete(s):await a.put(i,s),await n.done,!i||r&&r.fid===i.fid||C(e,i.fid),i}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e){let t;const s=await H(e.appConfig,s=>{const n=function(e){const t=e||{fid:y(),registrationStatus:0};return $(t)}(s),a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(p.create("app-offline"))}}const s={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(e,t){try{const s=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:s}){const n=k(e),a=_(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const i={fid:s,authVersion:m,appId:e.appId,sdkVersion:l},o={method:"POST",headers:a,body:JSON.stringify(i)},c=await E(()=>fetch(n,o));if(c.ok){const e=await c.json();return{fid:e.fid||s,registrationStatus:2,refreshToken:e.refreshToken,authToken:b(e.authToken)}}throw await w("Create Installation",c)}(e,t);return B(e.appConfig,s)}catch(s){throw g(s)&&409===s.customData.serverCode?await G(e.appConfig):await B(e.appConfig,{fid:t.fid,registrationStatus:0}),s}}(e,s);return{installationEntry:s,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:q(e)}:{installationEntry:t}}(e,n);return t=a.registrationPromise,a.installationEntry});return s.fid===A?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function q(e){let t=await W(e.appConfig);for(;1===t.registrationStatus;)await S(100),t=await W(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:s}=await U(e);return s||t}return t}function W(e){return H(e,e=>{if(!e)throw p.create("installation-not-found");return $(e)})}function $(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 V({appConfig:e,heartbeatServiceProvider:t},s){const n=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,s),a=T(e,s),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const i={installation:{sdkVersion:l,appId:e.appId}},o={method:"POST",headers:a,body:JSON.stringify(i)},c=await E(()=>fetch(n,o));if(c.ok){return b(await c.json())}throw await w("Generate Auth Token",c)}async function K(e,t=!1){let s;const n=await H(e.appConfig,n=>{if(!Q(n))throw p.create("not-registered");const a=n.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+h}(e)}(a))return n;if(1===a.requestStatus)return s=async function(e,t){let s=await Y(e.appConfig);for(;1===s.authToken.requestStatus;)await S(100),s=await Y(e.appConfig);const n=s.authToken;return 0===n.requestStatus?K(e,t):n}(e,t),n;{if(!navigator.onLine)throw p.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(n);return s=async function(e,t){try{const s=await V(e,t),n=Object.assign(Object.assign({},t),{authToken:s});return await B(e.appConfig,n),s}catch(s){if(!g(s)||401!==s.customData.serverCode&&404!==s.customData.serverCode){const s=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await B(e.appConfig,s)}else await G(e.appConfig);throw s}}(e,t),t}});return s?await s:n.authToken}function Y(e){return H(e,e=>{if(!Q(e))throw p.create("not-registered");const t=e.authToken;return 1===(s=t).requestStatus&&s.requestTime+d<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var s;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */})}function Q(e){return e!==undefined&&2===e.registrationStatus}async function z(e){const t=e,{installationEntry:s,registrationPromise:n}=await U(t);return n?n.catch(console.error):K(t).catch(console.error),s.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 s=e;await async function(e){const{registrationPromise:t}=await U(e);t&&await t}(s);return(await K(s,t)).token}function X(e){return p.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Z="installations",ee=e=>{const t=e.getProvider("app").getImmediate(),s=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const s of t)if(!e.options[s])throw X(s);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:s,heartbeatServiceProvider:(0,n._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),s=(0,n._getProvider)(t,Z).getImmediate();return{getId:()=>z(s),getToken:e=>J(s,e)}};(0,n._registerComponent)(new a.Component(Z,ee,"PUBLIC")),(0,n._registerComponent)(new a.Component("installations-internal",te,"PRIVATE")),(0,n.registerVersion)(o,c),(0,n.registerVersion)(o,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,s){Object.defineProperty(s,"__esModule",{value:!0});
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const n=[];var a;s.LogLevel=void 0,(a=s.LogLevel||(s.LogLevel={}))[a.DEBUG=0]="DEBUG",a[a.VERBOSE=1]="VERBOSE",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.SILENT=5]="SILENT";const r={debug:s.LogLevel.DEBUG,verbose:s.LogLevel.VERBOSE,info:s.LogLevel.INFO,warn:s.LogLevel.WARN,error:s.LogLevel.ERROR,silent:s.LogLevel.SILENT},i=s.LogLevel.INFO,o={[s.LogLevel.DEBUG]:"log",[s.LogLevel.VERBOSE]:"log",[s.LogLevel.INFO]:"info",[s.LogLevel.WARN]:"warn",[s.LogLevel.ERROR]:"error"},c=(e,t,...s)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),a=o[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${n}]  ${e.name}:`,...s)};s.Logger=class{constructor(e){this.name=e,this._logLevel=i,this._logHandler=c,this._userLogHandler=null,n.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in s.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?r[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,s.LogLevel.DEBUG,...e),this._logHandler(this,s.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.VERBOSE,...e),this._logHandler(this,s.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.INFO,...e),this._logHandler(this,s.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.WARN,...e),this._logHandler(this,s.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,s.LogLevel.ERROR,...e),this._logHandler(this,s.LogLevel.ERROR,...e)}},s.setLogLevel=function(e){n.forEach(t=>{t.setLogLevel(e)})},s.setUserLogHandler=function(e,t){for(const a of n){let n=null;t&&t.level&&(n=r[t.level]),a.userLogHandler=null===e?null:(t,a,...r)=>{const i=r.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(" ");a>=(null!=n?n:t.logLevel)&&e({level:s.LogLevel[a].toLowerCase(),message:i,args:r,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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.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 C.create("only-available-in-window");e.swRegistration||await G(e);return async function(e){const t=await A(e.firebaseDependencies);t&&(await j(e.firebaseDependencies,t.token),await async function(e){const t=x(e),s=(await I()).transaction(E,"readwrite");await s.objectStore(E).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();if(s)return s.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,r.getModularInstance)(e))},s.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,i.getApp)()){return Y().then(e=>{if(!e)throw C.create("unsupported-browser")},e=>{throw C.create("indexed-db-unsupported")}),(0,i._getProvider)((0,r.getModularInstance)(e),"messaging").getImmediate()},s.getToken=async function(e,t){return H(e=(0,r.getModularInstance)(e),t)},s.isSupported=Y,s.onMessage=function(e,t){return function(e,t){if(!navigator)throw C.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,r.getModularInstance)(e),t)},e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),r=e("@firebase/util"),i=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 o="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",d="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",l="https://fcmregistrations.googleapis.com/v1",m="google.c.a.c_id",u=1e4;var h,f;
/**
 * @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 p(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,"/"),s=atob(t),n=new Uint8Array(s.length);for(let e=0;e<s.length;++e)n[e]=s.charCodeAt(e);return n}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(h||(h={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(f||(f={}));const k="fcm_token_details_db",b=5,w="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 _="firebase-messaging-database",T=1,E="firebase-messaging-store";let S=null;function I(){return S||(S=(0,a.openDB)(_,T,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(E)}})),S}async function A(e){const t=x(e),s=await I(),n=await s.transaction(E).objectStore(E).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(k))return null}let t=null;return(await(0,a.openDB)(k,b,{upgrade:async(s,n,a,r)=>{var i;if(n<2)return;if(!s.objectStoreNames.contains(w))return;const o=r.objectStore(w),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(i=e.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:p(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:p(e.auth),p256dh:p(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:p(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:p(e.auth),p256dh:p(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:p(e.vapidKey)}}}}})).close(),await(0,a.deleteDB)(k),await(0,a.deleteDB)("fcm_vapid_details_db"),await(0,a.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 y(e,t),t}}async function y(e,t){const s=x(e),n=(await I()).transaction(E,"readwrite");return await n.objectStore(E).put(t,s),await n.done,t}function x({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 v={"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."},C=new r.ErrorFactory("messaging","Messaging",v);async function j(e,t){const s={method:"DELETE",headers:await D(e)};try{const n=await fetch(`${P(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.error.message;throw C.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw C.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function P({projectId:e}){return`${l}/projects/${e}/registrations`}async function D({appConfig:e,installations:t}){const s=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 ${s}`})}function N({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==d&&(a.web.applicationPubKey=n),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.
 */const R=6048e5;async function O(e){const t=await async function(e,t){const s=await e.pushManager.getSubscription();if(s)return s;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:g(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:p(t.getKey("auth")),p256dh:p(t.getKey("p256dh"))},n=await A(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,r=t.p256dh===e.p256dh;return s&&n&&a&&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.subscriptionOptions,s))return Date.now()>=n.createTime+R?async function(e,t){try{const s=await async function(e,t){const s=await D(e),n=N(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let r;try{const s=await fetch(`${P(e.appConfig)}/${t.token}`,a);r=await s.json()}catch(e){throw C.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw C.create("token-update-failed",{errorInfo:e})}if(!r.token)throw C.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await y(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await j(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return M(e.firebaseDependencies,s)}return M(e.firebaseDependencies,s)}async function M(e,t){const 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.
 */await async function(e,t){const s=await D(e),n=N(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let r;try{const t=await fetch(P(e.appConfig),a);r=await t.json()}catch(e){throw C.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw C.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw C.create("token-subscribe-no-token");return r.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await y(e,n),n.token}function L(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const s=t.notification.title;s&&(e.notification.title=s);const n=t.notification.body;n&&(e.notification.body=n);const a=t.notification.image;a&&(e.notification.image=a);const r=t.notification.icon;r&&(e.notification.icon=r)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var s,n,a,r,i;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const o=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(r=t.notification)||void 0===r?void 0:r.click_action;o&&(e.fcmOptions.link=o);const c=null===(i=t.fcmOptions)||void 0===i?void 0:i.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 F(e){return C.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 s=[];for(let n=0;n<e.length;n++)s.push(e.charAt(n)),n<t.length&&s.push(t.charAt(n));s.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 B{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw F("App Configuration Object");if(!e.name)throw F("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw F(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:s}}_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 G(e){try{e.swRegistration=await navigator.serviceWorker.register(o,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,s)=>{const n=setTimeout(()=>s(new Error(`Service worker not registered after ${u} ms`)),u),a=e.installing||e.waiting;e.active?(clearTimeout(n),t()):a?a.onstatechange=e=>{var s;"activated"===(null===(s=e.target)||void 0===s?void 0:s.state)&&(a.onstatechange=null,clearTimeout(n),t())}:(clearTimeout(n),s(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 C.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 C.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw C.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 G(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw C.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),O(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 U(e,t,s){const n=function(e){switch(e){case f.NOTIFICATION_CLICKED:return"notification_open";case f.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(n,{message_id:s[m],message_name:s["google.c.a.c_l"],message_time:s["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function q(e,t){const s=t.data;if(!s.isFirebaseMessaging)return;e.onMessageHandler&&s.messageType===f.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(L(s)):e.onMessageHandler.next(L(s)));const n=s.data;var a;"object"==typeof(a=n)&&a&&m in a&&"1"===n["google.c.a.e"]&&await U(e,s.messageType,n)}const W="@firebase/messaging",$="0.12.16",V=e=>{const t=new B(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>q(t,e)),t},K=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,r.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,r.isIndexedDBAvailable)()&&(0,r.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,i._registerComponent)(new n.Component("messaging",V,"PUBLIC")),(0,i._registerComponent)(new n.Component("messaging-internal",K,"PRIVATE")),(0,i.registerVersion)(W,$),(0,i.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,s){Object.defineProperty(s,"__esModule",{value:!0}),e("@firebase/installations");var n=e("@firebase/component"),a=e("idb"),r=e("@firebase/util"),i=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 o="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 m(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function u(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),s=atob(t),n=new Uint8Array(s.length);for(let e=0;e<s.length;++e)n[e]=s.charCodeAt(e);return n}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(d||(d={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(l||(l={}));const h="fcm_token_details_db",f="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 p="firebase-messaging-store";let g=null;function k(){return g||(g=a.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(p)}})),g}async function b(e){const t=_(e),s=await k(),n=await s.transaction(p).objectStore(p).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(h))return null}let t=null;return(await a.openDB(h,5,{upgrade:async(s,n,a,r)=>{var i;if(n<2)return;if(!s.objectStoreNames.contains(f))return;const o=r.objectStore(f),c=await o.index("fcmSenderId").get(e);if(await o.clear(),c)if(2===n){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(i=e.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:m(e.vapidKey)}}}else if(3===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}else if(4===n){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:m(e.auth),p256dh:m(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:m(e.vapidKey)}}}}})).close(),await a.deleteDB(h),await a.deleteDB("fcm_vapid_details_db"),await a.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 w(e,t),t}}async function w(e,t){const s=_(e),n=(await k()).transaction(p,"readwrite");return await n.objectStore(p).put(t,s),await n.done,t}function _({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 T={"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 r.ErrorFactory("messaging","Messaging",T);async function S(e,t){const s={method:"DELETE",headers:await A(e)};try{const n=await fetch(`${I(e.appConfig)}/${t}`,s),a=await n.json();if(a.error){const e=a.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 I({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function A({appConfig:e,installations:t}){const s=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 ${s}`})}function y({p256dh:e,auth:t,endpoint:s,vapidKey:n}){const a={web:{endpoint:s,auth:t,p256dh:e}};return n!==o&&(a.web.applicationPubKey=n),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 x(e){const t=await async function(e,t){const s=await e.pushManager.getSubscription();if(s)return s;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:u(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:m(t.getKey("auth")),p256dh:m(t.getKey("p256dh"))},n=await b(e.firebaseDependencies);if(n){if(function(e,t){const s=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,a=t.auth===e.auth,r=t.p256dh===e.p256dh;return s&&n&&a&&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.subscriptionOptions,s))return Date.now()>=n.createTime+6048e5?async function(e,t){try{const s=await async function(e,t){const s=await A(e),n=y(t.subscriptionOptions),a={method:"PATCH",headers:s,body:JSON.stringify(n)};let r;try{const s=await fetch(`${I(e.appConfig)}/${t.token}`,a);r=await s.json()}catch(e){throw E.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw E.create("token-update-failed",{errorInfo:e})}if(!r.token)throw E.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await w(e.firebaseDependencies,n),s}catch(e){throw e}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:s}):n.token;try{await S(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return C(e.firebaseDependencies,s)}return C(e.firebaseDependencies,s)}async function v(e){const t=await b(e.firebaseDependencies);t&&(await S(e.firebaseDependencies,t.token),await async function(e){const t=_(e),s=(await k()).transaction(p,"readwrite");await s.objectStore(p).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();return!s||s.unsubscribe()}async function C(e,t){const 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.
 */await async function(e,t){const s=await A(e),n=y(t),a={method:"POST",headers:s,body:JSON.stringify(n)};let r;try{const t=await fetch(I(e.appConfig),a);r=await t.json()}catch(e){throw E.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw E.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw E.create("token-subscribe-no-token");return r.token}(e,t),n={token:s,createTime:Date.now(),subscriptionOptions:t};return await w(e,n),n.token}async function j(e,t){const s=function(e,t){var s,n;const a={};e.from&&(a.project_number=e.from);e.fcmMessageId&&(a.message_id=e.fcmMessageId);a.instance_id=t,e.notification?a.message_type=d.DISPLAY_NOTIFICATION.toString():a.message_type=d.DATA_MESSAGE.toString();a.sdk_platform=3..toString(),a.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(a.collapse_key=e.collapse_key);a.event=1..toString(),!(null===(s=e.fcmOptions)||void 0===s?void 0:s.analytics_label)||(a.analytics_label=null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label);return a}(t,await e.firebaseDependencies.installations.getId());!function(e,t,s){const n={};n.event_time_ms=Math.floor(Date.now()).toString(),n.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!s||(n.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(s));e.logEvents.push(n)}(e,s,t.productId)}async function P(e,t){const s=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!s)return;t.deliveryMetricsExportedToBigQueryEnabled&&await j(t,s);const n=await N();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(n))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=l.PUSH_RECEIVED;for(const s of e)s.postMessage(t)}(n,s);if(s.notification&&await function(e){var t;const{actions:s}=e,{maxActions:n}=Notification;s&&n&&s.length>n&&console.warn(`This browser only supports ${n} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={[c]:e},t}(s)),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 s=t.notification.title;s&&(e.notification.title=s);const n=t.notification.body;n&&(e.notification.body=n);const a=t.notification.image;a&&(e.notification.image=a);const r=t.notification.icon;r&&(e.notification.icon=r)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var s,n,a,r,i;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const o=null!==(a=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==a?a:null===(r=t.notification)||void 0===r?void 0:r.click_action;o&&(e.fcmOptions.link=o);const c=null===(i=t.fcmOptions)||void 0===i?void 0:i.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}(s);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function D(e){var t,s;const n=null===(s=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===s?void 0:s[c];if(!n)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const a=function(e){var t,s,n;const a=null!==(s=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==s?s:null===(n=e.notification)||void 0===n?void 0:n.click_action;if(a)return a;return r=e.data,"object"==typeof r&&r&&"google.c.a.c_id"in r?self.location.origin:null;var r;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(n);if(!a)return;const r=new URL(a,self.location.href),i=new URL(self.location.origin);if(r.host!==i.host)return;let o=await async function(e){const t=await N();for(const s of t){const t=new URL(s.url,self.location.href);if(e.host===t.host)return s}return null}(r);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 o?o=await o.focus():(o=await self.clients.openWindow(a),await(d=3e3,new Promise(e=>{setTimeout(e,d)}))),o?(n.messageType=l.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,o.postMessage(n)):void 0}function N(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function R(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 s=[];for(let n=0;n<e.length;n++)s.push(e.charAt(n)),n<t.length&&s.push(t.charAt(n));s.join("")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class O{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw R("App Configuration Object");if(!e.name)throw R("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw R(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:s}}_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 O(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(P(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var s,n;const{newSubscription:a}=e;if(!a)return void await v(t);const r=await b(t.firebaseDependencies);await v(t),t.vapidKey=null!==(n=null===(s=null==r?void 0:r.subscriptionOptions)||void 0===s?void 0:s.vapidKey)&&void 0!==n?n:o,await x(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(D(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 L(){return r.isIndexedDBAvailable()&&await r.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.
 */i._registerComponent(new n.Component("messaging-sw",M,"PUBLIC")),s.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=r.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.
 */,s.getMessaging=function(e=i.getApp()){return L().then(e=>{if(!e)throw E.create("unsupported-browser")},e=>{throw E.create("indexed-db-unsupported")}),i._getProvider(r.getModularInstance(e),"messaging-sw").getImmediate()},s.isSupported=L,s.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=r.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,s){(function(e){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.Sha1=s.RANDOM_FACTOR=s.MAX_VALUE_MILLIS=s.FirebaseError=s.ErrorFactory=s.Deferred=s.DecodeBase64StringError=s.CONSTANTS=void 0,s.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.
 */,s.assertionError=s.assert=void 0,s.async=function(e,t){return(...s)=>{Promise.resolve(!0).then(()=>{e(...s)}).catch(e=>{t&&t(e)})}},s.base64urlEncodeWithoutPadding=s.base64Encode=s.base64Decode=s.base64=void 0,s.calculateBackoffMillis=function(e,t=C,s=j){const n=t*Math.pow(s,e),a=Math.round(D*n*(Math.random()-.5)*2);return Math.min(P,n+a)}
/**
 * @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.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.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 s=t||"demo-project",n=e.iat||0,a=e.sub||e.user_id;if(!a)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const r=Object.assign({iss:`https://securetoken.google.com/${s}`,aud:s,iat:n,exp:n+3600,auth_time:n,sub:a,user_id:a,firebase:{sign_in_provider:"custom",identities:{}}},e);return[d(JSON.stringify({alg:"none",type:"JWT"})),d(JSON.stringify(r)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,s.createSubscribe=function(e,t){const s=new y(e,t);return s.subscribe.bind(s)},s.decode=void 0,s.deepCopy=function(e){return m(undefined,e)},s.deepEqual=function e(t,s){if(t===s)return!0;const n=Object.keys(t),a=Object.keys(s);for(const r of n){if(!a.includes(r))return!1;const n=t[r],i=s[r];if(A(n)&&A(i)){if(!e(n,i))return!1}else if(n!==i)return!1}for(const e of a)if(!n.includes(e))return!1;return!0},s.deepExtend=m,s.errorPrefix=v,s.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const s=e.indexOf("#",t);return e.substring(t,s>0?s: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.
 */,s.getExperimentalSetting=s.getDefaults=s.getDefaultEmulatorHostnameAndPort=s.getDefaultEmulatorHost=s.getDefaultAppConfig=void 0,s.getGlobal=h,s.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},s.getUA=k,s.isAdmin=void 0,s.isBrowser=function(){return"undefined"!=typeof window||w()},s.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},s.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},s.isElectron=function(){return k().indexOf("Electron/")>=0},s.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},s.isIE=function(){const e=k();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},s.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},s.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(k())},s.isNode=b,s.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},s.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},s.isSafari=function(){return!b()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},s.isUWP=function(){return k().indexOf("MSAppHost/")>=0},s.isValidTimestamp=s.isValidFormat=void 0,s.isWebWorker=w,s.issuedAtTime=void 0,s.jsonEval=S,s.map=function(e,t,s){const n={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=t.call(s,e[a],a,e));return n},s.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 s=e%10;if(1===s)return"st";if(2===s)return"nd";if(3===s)return"rd";return"th"}(e)},s.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 s=new g;return setTimeout(()=>s.reject("timeout!"),t),e.then(s.resolve,s.reject),s.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.
 */,s.querystring=function(e){const t=[];for(const[s,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(s)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(s)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""},s.querystringDecode=function(e){const t={},s=e.replace(/^\?/,"").split("&");return s.forEach(e=>{if(e){const[s,n]=e.split("=");t[decodeURIComponent(s)]=decodeURIComponent(n)}}),t},s.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},s.stringToByteArray=s.stringLength=void 0,s.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.
 */,s.validateArgCount=void 0,s.validateCallback=function(e,t,s,n){if(n&&!s)return;if("function"!=typeof s)throw new Error(v(e,t)+"must be a valid function.")},s.validateContextObject=function(e,t,s,n){if(n&&!s)return;if("object"!=typeof s||null===s)throw new Error(v(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.
 */,s.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let s=!0;const n="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(n);a.onsuccess=()=>{a.result.close(),s||self.indexedDB.deleteDatabase(n),e(!0)},a.onupgradeneeded=()=>{s=!1},a.onerror=()=>{var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},s.validateNamespace=function(e,t,s){if(s&&!t)return;if("string"!=typeof t)throw new Error(v(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=s.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},n=function(e,t){if(!e)throw a(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.
 */s.assert=n;const a=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.
 */s.assertionError=a;const r=function(e){const t=[];let s=0;for(let n=0;n<e.length;n++){let a=e.charCodeAt(n);a<128?t[s++]=a:a<2048?(t[s++]=a>>6|192,t[s++]=63&a|128):55296==(64512&a)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),t[s++]=a>>18|240,t[s++]=a>>12&63|128,t[s++]=a>>6&63|128,t[s++]=63&a|128):(t[s++]=a>>12|224,t[s++]=a>>6&63|128,t[s++]=63&a|128)}return t},i=s.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 s=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const a=e[t],r=t+1<e.length,i=r?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0,d=a>>2,l=(3&a)<<4|i>>4;let m=(15&i)<<2|c>>6,u=63&c;o||(u=64,r||(m=64)),n.push(s[d],s[l],s[m],s[u])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let s=0,n=0;for(;s<e.length;){const a=e[s++];if(a<128)t[n++]=String.fromCharCode(a);else if(a>191&&a<224){const r=e[s++];t[n++]=String.fromCharCode((31&a)<<6|63&r)}else if(a>239&&a<365){const r=((7&a)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536;t[n++]=String.fromCharCode(55296+(r>>10)),t[n++]=String.fromCharCode(56320+(1023&r))}else{const r=e[s++],i=e[s++];t[n++]=String.fromCharCode((15&a)<<12|(63&r)<<6|63&i)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const s=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const a=s[e.charAt(t++)],r=t<e.length?s[e.charAt(t)]:0;++t;const i=t<e.length?s[e.charAt(t)]:64;++t;const c=t<e.length?s[e.charAt(t)]:64;if(++t,null==a||null==r||null==i||null==c)throw new o;const d=a<<2|r>>4;if(n.push(d),64!==i){const e=r<<4&240|i>>2;if(n.push(e),64!==c){const e=i<<6&192|c;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class o extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}s.DecodeBase64StringError=o;const c=function(e){const t=r(e);return i.encodeByteArray(t,!0)};s.base64Encode=c;const d=function(e){return c(e).replace(/\./g,"")};s.base64urlEncodeWithoutPadding=d;const l=function(e){try{return i.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 m(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 s in t)t.hasOwnProperty(s)&&u(s)&&(e[s]=m(e[s],t[s]));return e}function u(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.
 */s.base64Decode=l;const f=()=>{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}`)}};s.getDefaults=f;const p=e=>{var t,s;return null===(s=null===(t=f())||void 0===t?void 0:t.emulatorHosts)||void 0===s?void 0:s[e]};s.getDefaultEmulatorHost=p;s.getDefaultEmulatorHostnameAndPort=e=>{const t=p(e);if(!t)return undefined;const s=t.lastIndexOf(":");if(s<=0||s+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(s+1),10);return"["===t[0]?[t.substring(1,s-1),n]:[t.substring(0,s),n]};s.getDefaultAppConfig=()=>{var e;return null===(e=f())||void 0===e?void 0:e.config};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
s.getExperimentalSetting=e=>{var t;return null===(t=f())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,s)=>{t?this.reject(t):this.resolve(s),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,s))}}}
/**
 * @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 b(){var e;const t=null===(e=f())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function w(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}s.Deferred=g;class _ extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,_.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,T.prototype.create)}}s.FirebaseError=_;class T{constructor(e,t,s){this.service=e,this.serviceName=t,this.errors=s}create(e,...t){const s=t[0]||{},n=`${this.service}/${e}`,a=this.errors[e],r=a?function(e,t){return e.replace(E,(e,s)=>{const n=t[s];return null!=n?String(n):`<${s}?>`})}(a,s):"Error",i=`${this.serviceName}: ${r} (${n}).`;return new _(n,i,s)}}s.ErrorFactory=T;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 I=function(e){let t={},s={},n={},a="";try{const r=e.split(".");t=S(l(r[0])||""),s=S(l(r[1])||""),a=r[2],n=s.d||{},delete s.d}catch(e){}return{header:t,claims:s,data:n,signature:a}};s.decode=I;s.isValidTimestamp=function(e){const t=I(e).claims,s=Math.floor((new Date).getTime()/1e3);let n=0,a=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?n=t.nbf:t.hasOwnProperty("iat")&&(n=t.iat),a=t.hasOwnProperty("exp")?t.exp:n+86400),!!s&&!!n&&!!a&&s>=n&&s<=a};s.issuedAtTime=function(e){const t=I(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};s.isValidFormat=function(e){const t=I(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function A(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.
 */
s.isAdmin=function(e){const t=I(e).claims;return"object"==typeof t&&!0===t.admin};s.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 s=this.W_;if("string"==typeof e)for(let n=0;n<16;n++)s[n]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let n=0;n<16;n++)s[n]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=s[e-3]^s[e-8]^s[e-14]^s[e-16];s[e]=4294967295&(t<<1|t>>>31)}let n,a,r=this.chain_[0],i=this.chain_[1],o=this.chain_[2],c=this.chain_[3],d=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=c^i&(o^c),a=1518500249):(n=i^o^c,a=1859775393):e<60?(n=i&o|c&(i|o),a=2400959708):(n=i^o^c,a=3395469782);const t=(r<<5|r>>>27)+n+d+a+s[e]&4294967295;d=c,c=o,o=4294967295&(i<<30|i>>>2),i=r,r=t}this.chain_[0]=this.chain_[0]+r&4294967295,this.chain_[1]=this.chain_[1]+i&4294967295,this.chain_[2]=this.chain_[2]+o&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 s=t-this.blockSize;let n=0;const a=this.buf_;let r=this.inbuf_;for(;n<t;){if(0===r)for(;n<=s;)this.compress_(e,n),n+=this.blockSize;if("string"==typeof e){for(;n<t;)if(a[r]=e.charCodeAt(n),++r,++n,r===this.blockSize){this.compress_(a),r=0;break}}else for(;n<t;)if(a[r]=e[n],++r,++n,r===this.blockSize){this.compress_(a),r=0;break}}this.inbuf_=r,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 s=0;for(let t=0;t<5;t++)for(let n=24;n>=0;n-=8)e[s]=this.chain_[t]>>n&255,++s;return e}};class y{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,s){let n;if(e===undefined&&t===undefined&&s===undefined)throw new Error("Missing Observer.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const s of t)if(s in e&&"function"==typeof e[s])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:s},n.next===undefined&&(n.next=x),n.error===undefined&&(n.error=x),n.complete===undefined&&(n.complete=x);const a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),a}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 x(){}
/**
 * @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 v(e,t){return`${e} failed: ${t} argument `}s.validateArgCount=function(e,t,s,n){let a;if(n<t?a="at least "+t:n>s&&(a=0===s?"none":"no more than "+s),a){throw new Error(e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+a+".")}};s.stringToByteArray=function(e){const t=[];let s=0;for(let a=0;a<e.length;a++){let r=e.charCodeAt(a);if(r>=55296&&r<=56319){const t=r-55296;a++,n(a<e.length,"Surrogate pair missing trail surrogate.");r=65536+(t<<10)+(e.charCodeAt(a)-56320)}r<128?t[s++]=r:r<2048?(t[s++]=r>>6|192,t[s++]=63&r|128):r<65536?(t[s++]=r>>12|224,t[s++]=r>>6&63|128,t[s++]=63&r|128):(t[s++]=r>>18|240,t[s++]=r>>12&63|128,t[s++]=r>>6&63|128,t[s++]=63&r|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.
 */
s.stringLength=function(e){let t=0;for(let s=0;s<e.length;s++){const n=e.charCodeAt(s);n<128?t++:n<2048?t+=2:n>=55296&&n<=56319?(t+=4,s++):t+=3}return t};const C=1e3,j=2,P=s.MAX_VALUE_MILLIS=144e5,D=s.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,s){Object.defineProperty(s,"__esModule",{value:!0});class n{static parse(e){if(""===e)return new n([]);if(!e.startsWith("/"))throw new a(e);const[,...t]=e.split("/");return new n(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 r(e,t);e=e[t]}return e}}s.default=n;class a extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}s.InvalidPtrError=a;class r extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}s.EvalError=r}}},{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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function i(e){try{c(n.next(e))}catch(e){r(e)}}function o(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,a,r,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var o=i(e("@json-schema-tools/traverse")),c=i(e("@json-schema-tools/reference-resolver")),d=i(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")};s.NonStringRefError=l;var m=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var s=n(n({},t),e);return delete s.$ref,s}return t},u=function(){function e(e,t){var s;if(void 0===t&&(t={}),this.options=t,this.refCache={},s=!0===this.options.mutate||!0===e||!1===e?e:n({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=s),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=s),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var a=0,r=Object.keys(this.options.protocolHandlerMap);a<r.length;a++){var i=r[a];c.default.protocolHandlerMap[i]=this.options.protocolHandlerMap[i]}this.schema=s,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return a(this,void 0,void 0,function(){return r(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 a(this,void 0,void 0,function(){var t,s,a,i,d,l,u,h,f,p,g,k=this;return r(this,function(r){switch(r.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}),s=[],a=0,i=t,r.label=1;case 1:return a<i.length?(d=i[a],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 u=c.default.resolve(d,this.options.rootSchema),s.push(u),[4,u];case 4:l=r.sent(),r.label=5;case 5:return!0!==this.options.recursive||!0===l||!1===l||"#"===d?[3,9]:(h=n(n({},this.options),{refCache:this.refCache}),0===(f=new e(l,h)).refs.length?[3,7]:(p=f._resolve(),s.push(p),[4,p]));case 6:return g=r.sent(),this.refCache[d]=m(l,g),[3,8];case 7:this.refCache[d]=l,r.label=8;case 8:return[3,10];case 9:this.refCache[d]=l,r.label=10;case 10:return a++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=m(this.schema,this.refCache[this.schema.$ref]):(0,o.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=k.refCache[e.$ref];return m(e,t)}return e},{mutable:!0}),[4,Promise.all(s)];case 12:return r.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,o.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}();s.default=u}}},{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,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.NonStringRefError=void 0;var a=n(e("./dereferencer")),r=e("./dereferencer");Object.defineProperty(s,"NonStringRefError",{enumerable:!0,get:function(){return r.NonStringRefError}}),s.default=a.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.jsonSchema=void 0,s.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:[]}}},s.default=s.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,s){var n=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function i(e){try{c(n.next(e))}catch(e){r(e)}}function o(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,r,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var i=e("./errors"),o=r(e("isomorphic-fetch")),c=function(e){return n(void 0,void 0,void 0,function(){var t,s;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,(0,o.default)(e)];case 1:return t=n.sent(),[3,3];case 2:throw n.sent(),new i.InvalidRemoteURLError(e);case 3:return n.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,n.sent()];case 5:throw s=n.sent(),new i.NonJsonRefError({$ref:e},s.message);case 6:return[2]}})})};s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.InvalidFileSystemPathError=s.InvalidRemoteURLError=s.NotResolvableError=s.NonJsonRefError=void 0;var n=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")};s.NonJsonRefError=n;var a=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")};s.NotResolvableError=a;var r=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};s.InvalidRemoteURLError=r;var i=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};s.InvalidFileSystemPathError=i}}},{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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function i(e){try{c(n.next(e))}catch(e){r(e)}}function o(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var s,n,a,r,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=i(e("./default-protocol-handler-map")),c=i(e("./reference-resolver")),d=n(n({},o.default),{file:function(){return a(void 0,void 0,void 0,function(){return r(this,function(e){return[2,undefined]})})}});s.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,s){var n=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(a,r){function i(e){try{c(n.next(e))}catch(e){r(e)}}function o(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof s?t:new s(function(e){e(t)})).then(i,o)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var s,n,a,r,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(o){return function(c){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,o[0]&&(i=0)),i;)try{if(s=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{s=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var i=e("./errors"),o=r(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return n(this,arguments,void 0,function(e,t){var s,n,r,c,d,l,m,u,h,f;return void 0===t&&(t={}),a(this,function(a){switch(a.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,o.default)(e,t))];(s=e.split("#")).length>1&&(n=s[s.length-1]),r=s[0],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(r,t)];case 2:return c=a.sent(),[3,4];case 3:throw d=a.sent(),new i.NonJsonRefError({$ref:e},d.message);case 4:if(c!==undefined)return f=c,n&&(f=(0,o.default)(n,f)),[2,f];if(!1===e.includes("://"))throw new i.InvalidFileSystemPathError(e);l=0,m=Object.keys(this.protocolHandlerMap),a.label=5;case 5:return l<m.length?(u=m[l],r.startsWith(u)?[4,this.protocolHandlerMap[u](r,t)]:[3,7]):[3,8];case 6:if((h=a.sent())!==undefined)return f=h,n&&(f=(0,o.default)(n,f)),[2,f];a.label=7;case 7:return l++,[3,5];case 8:throw new i.NotResolvableError(e)}})})},e}();s.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,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.InvalidJsonPointerRefError=void 0;var a=n(e("@json-schema-spec/json-pointer")),r=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};s.InvalidJsonPointerRefError=r,s.default=function(e,t){try{var s=e.replace("#","");return a.default.parse(s).shmeval(t)}catch(t){throw new r(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,s){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},n.apply(this,arguments)},a=this&&this.__spreadArray||function(e,t,s){if(s||2===arguments.length)for(var n,a=0,r=t.length;a<r;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(s,"__esModule",{value:!0}),s.defaultOptions=void 0,s.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var r=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},i=function(e,t){var s=t.find(function(t){return t===e});return s||!1},o=function(e,t){return void 0===t&&(t=1),e[e.length-t]};s.default=function e(t,c,d,l,m,u,h,f,p){void 0===d&&(d=s.defaultOptions),void 0===l&&(l=0),void 0===m&&(m=[]),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===f&&(f=[]),void 0===p&&(p=[]);var g=n(n({},s.defaultOptions),d);if(0===l&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===l?t:c(t,!1,r(h),o(u));var k=t;!1===g.mutable&&(k=n({},t)),u.push(k),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===l||(k=c(k,!1,r(h),o(u,2)))),m.push(t),f.push([t,k]);var b=function(t,s){var n=i(t,m);return n?(p.push(n),!0===g.skipFirstMutation&&n===m[0]?c(t,!0,r(s),o(u)):f.find(function(e){var t=e[0];return n===t})[1]):e(t,c,d,l+1,m,u,s,f,p)};if(t.anyOf)k.anyOf=t.anyOf.map(function(e,t){return b(e,a(a([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)k.allOf=t.allOf.map(function(e,t){return b(e,a(a([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)k.oneOf=t.oneOf.map(function(e,t){return b(e,a(a([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)k.items=t.items.map(function(e,t){return b(e,a(a([],h,!0),["items[".concat(t,"]")],!1))});else{var w=i(t.items,m);if(w)if(p.push(w),!0===g.skipFirstMutation&&w===m[0])k.items=c(t.items,!0,r(h),o(u));else{var _=f.find(function(e){var t=e[0];return w===t})[1];k.items=_}else k.items=e(t.items,c,d,l+1,m,u,a(a([],h,!0),["items"],!1),f,p)}if(t.additionalItems!==undefined&&(k.additionalItems=b(t.additionalItems,a(a([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var T=t.properties,E={};Object.keys(t.properties).forEach(function(e){E[e]=b(T[e],a(a([],h,!0),["properties",e.toString()],!1))}),k.properties=E}if(t.patternProperties!==undefined){var S=t.patternProperties,I={};Object.keys(t.patternProperties).forEach(function(e){I[e]=b(S[e],a(a([],h,!0),["patternProperties",e.toString()],!1))}),k.patternProperties=I}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(k.additionalProperties=b(t.additionalProperties,a(a([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===l)return k;if(!0===g.bfs)return u.pop(),k;var A=-1!==p.indexOf(t);return u.pop(),c(k,A,r(h),o(u))}}}},{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/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AddressBookController=s.getDefaultAddressBookControllerState=s.controllerName=s.AddressType=void 0;const n=e("@metamask/base-controller"),a=e("@metamask/controller-utils");var r;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(r||(s.AddressType=r={})),s.controllerName="AddressBookController";const i=["list","set","delete","clear"],o={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};s.getDefaultAddressBookControllerState=()=>({addressBook:{}});class c extends n.BaseController{constructor({messenger:e,state:t}){const n={...(0,s.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:o,name:s.controllerName,state:n}),this.messenger.registerMethodActionHandlers(this,i)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,s)=>{const n=s;return[...t,...Object.values(e[n])]},[])}clear(){this.update(e=>{e.addressBook={}})}delete(e,t){if(t=(0,a.toChecksumHexAddress)(t),![e,t].every(e=>(0,a.isSafeDynamicKey)(e))||!(0,a.isValidHexAddress)(t)||!this.state.addressBook[e]?.[t])return!1;const s={...this.state.addressBook[e][t]};return this.update(s=>{const n=s.addressBook[e];n?.[t]&&(delete n[t],0===Object.keys(n).length&&delete s.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",s),!0}set(e,t,s=(0,a.toHex)(1),n="",r){if(e=(0,a.toChecksumHexAddress)(e),!(0,a.isValidHexAddress)(e))return!1;const i={address:e,chainId:s,isEns:!1,memo:n,name:t,addressType:r,lastUpdatedAt:Date.now()},o=(0,a.normalizeEnsName)(t);return o&&(i.name=o,i.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[s]:{...this.state.addressBook[s],[e]:i}}}),"*"!==String(s)&&this.messenger.publish("AddressBookController:contactUpdated",i),!0}}s.AddressBookController=c,s.default=c}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AddressBookController=s.getDefaultAddressBookControllerState=void 0;var n=e("./AddressBookController.cjs");Object.defineProperty(s,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return n.getDefaultAddressBookControllerState}}),Object.defineProperty(s,"AddressBookController",{enumerable:!0,get:function(){return n.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,s){var n,a,r=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.AnnouncementController=void 0;const i=e("@metamask/base-controller"),o={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class d extends i.BaseController{constructor({messenger:e,state:t,allAnnouncements:s}){const i={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:i}),n.add(this),r(this,n,"m",a).call(this,s)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const s of Object.keys(e).map(Number))t[s].isShown=e[s]})}}s.AnnouncementController=d,n=new WeakSet,a=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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.AnnouncementController=void 0;var n=e("./AnnouncementController.cjs");Object.defineProperty(s,"AnnouncementController",{enumerable:!0,get:function(){return n.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",{"./bridge-status-controller.intent.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.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/intent-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.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/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/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,s){var n,a,r,i,o,c,d,l,m,u,h,f,p,g,k,b,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R,O,M=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},L=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusController=void 0;const F=e("@metamask/bridge-controller"),B=e("@metamask/controller-utils"),G=e("@metamask/keyring-controller"),H=e("@metamask/polling-controller"),U=e("@metamask/transaction-controller"),q=e("@metamask/utils"),W=e("./bridge-status-controller.intent.cjs"),$=e("./constants.cjs"),V=e("./types.cjs"),K=e("./utils/bridge-status.cjs"),Y=e("./utils/gas.cjs"),Q=e("./utils/intent-api.cjs"),z=e("./utils/metrics.cjs"),J=e("./utils/transaction.cjs"),X={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class Z extends((0,H.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,fetchFn:H,addTransactionFn:Z,addTransactionBatchFn:ee,updateTransactionFn:te,estimateGasFeeFn:se,config:ne,traceFn:ae}){super({name:$.BRIDGE_STATUS_CONTROLLER_NAME,metadata:X,messenger:e,state:{...$.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),n.add(this),a.set(this,{}),r.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),m.set(this,void 0),u.set(this,void 0),h.set(this,void 0),f.set(this,({id:e,actionId:t})=>{let s=this.state.txHistory[e]?e:undefined;if(!s&&t&&this.state.txHistory[t]&&(s=t),s??(s=Object.keys(this.state.txHistory).find(t=>this.state.txHistory[t].approvalTxId===e)),!s)return;const n=s;this.update(e=>{e.txHistory[n].status.status=F.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=$.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=$.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),s=this.messenger.call("NetworkController:getNetworkClientById",t).configuration.chainId;L(this,y,"f").call(this,e,s)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:s}=e;if(!t&&!s)throw new Error("Either txMetaId or txHash must be provided");let n;if(t?this.state.txHistory[t]&&(n=t):s&&(n=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===s)),!n)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${s}`));const r=this.state.txHistory[n],i=r.attempts?.counter??0;if(this.update(e=>{n&&(e.txHistory[n].attempts=undefined)}),L(this,w,"f").call(this,r)){if(!L(this,a,"f")[n]&&(L(this,b,"f").call(this,n),!r.featureId)){const e=this.messenger.call("AccountsController:getAccountByAddress",r.account),t=(0,z.getRequestParamFromHistory)(r),s=(0,z.getRequestMetadataFromHistory)(r,e),{security_warnings:a,...o}=s;L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.PollingStatusUpdated,n,{...(0,z.getTradeDataFromHistory)(r),...(0,z.getPriceImpactFromQuote)(r.quote),...o,chain_id_source:t.chain_id_source,chain_id_destination:t.chain_id_destination,token_symbol_source:t.token_symbol_source,token_symbol_destination:t.token_symbol_destination,action_type:F.MetricsActionType.SWAPBRIDGE_V1,polling_status:F.PollingStatus.ManuallyRestarted,retry_attempts:i})}}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],p.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===F.StatusTypes.PENDING||e.status.status===F.StatusTypes.UNKNOWN).filter(e=>Boolean(e.txMetaId)).filter(e=>!L(this,a,"f")[e.txMetaId]).filter(e=>L(this,w,"f").call(this,e)).forEach(e=>{const t=e.txMetaId;(0,K.shouldSkipFetchDueToFetchFailures)(e.attempts)||L(this,b,"f").call(this,t)})}),g.set(this,(e,t)=>{const{bridgeTxMeta:s,statusRequest:n,quoteResponse:a,startTime:r,slippagePercentage:i,initialDestAssetBalance:o,targetContractAddress:c,approvalTxId:d,isStxEnabled:l,location:m,abTests:u,activeAbTests:h,accountAddress:f}=e,p=(0,J.getHistoryKey)(t,s?.id),g={txMetaId:s?.id,actionId:t,originalTransactionId:s?.originalTransactionId||s?.id,batchId:s?.batchId,quote:a.quote,startTime:r,estimatedProcessingTimeInSeconds:a.estimatedProcessingTimeInSeconds,slippagePercentage:i,pricingData:{amountSent:a.sentAmount?.amount??"0",amountSentInUsd:a.sentAmount?.usd??undefined,quotedGasInUsd:a.gasFee?.effective?.usd??undefined,quotedReturnInUsd:a.toTokenAmount?.usd??undefined,quotedGasAmount:a.gasFee?.effective?.amount??undefined},initialDestAssetBalance:o,targetContractAddress:c,account:f,status:{status:F.StatusTypes.PENDING,srcChain:{chainId:n.srcChainId,txHash:n.srcTxHash}},hasApprovalTx:Boolean(a.approval),approvalTxId:d,isStxEnabled:Boolean(l),featureId:a.featureId,location:m,...u&&{abTests:u},...h&&{activeAbTests:h}};this.update(e=>{e.txHistory[p]=g})}),k.set(this,(e,t)=>{this.update(s=>{(0,J.rekeyHistoryItemInState)(s,e,t)})}),b.set(this,e=>{const t=L(this,a,"f")[e];t&&this.stopPollingByPollingToken(t);const s=this.state.txHistory[e];s&&L(this,w,"f").call(this,s)&&(L(this,a,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),w.set(this,e=>{const t=Boolean(e?.quote?.intent);return[(0,F.isCrossChain)(e.quote.srcChainId,e.quote.destChainId),t,(0,F.isTronChainId)(e.quote.srcChainId)].some(Boolean)}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;if(!t?.id)throw new Error("Cannot start polling: bridgeTxMeta.id is required for polling");L(this,g,"f").call(this,e),L(this,b,"f").call(this,t.id)},this._executePoll=async e=>{await L(this,E,"f").call(this,e)},T.set(this,e=>{const{attempts:t}=this.state.txHistory[e],s=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},n=L(this,a,"f")[e];if(s.counter>=$.MAX_ATTEMPTS&&n){this.stopPollingByPollingToken(n),delete L(this,a,"f")[e];const t=this.state.txHistory[e];if(t&&!t.featureId){const n=this.messenger.call("AccountsController:getAccountByAddress",t.account),a=(0,z.getRequestParamFromHistory)(t),r=(0,z.getRequestMetadataFromHistory)(t,n),{security_warnings:i,...o}=r;L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.PollingStatusUpdated,e,{...(0,z.getTradeDataFromHistory)(t),...(0,z.getPriceImpactFromQuote)(t.quote),...o,chain_id_source:a.chain_id_source,chain_id_destination:a.chain_id_destination,token_symbol_source:a.token_symbol_source,token_symbol_destination:a.token_symbol_destination,action_type:F.MetricsActionType.SWAPBRIDGE_V1,polling_status:F.PollingStatus.MaxPollingReached,retry_attempts:s.counter})}}this.update(t=>{t.txHistory[e].attempts=s})}),E.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state,s=t[e];if(s&&!(0,K.shouldSkipFetchDueToFetchFailures)(s.attempts))try{let t,n=[];if(s.quote.intent){const n=await L(this,r,"f").getIntentTransactionStatus(e,s.quote.srcChainId,s.quote.intent.protocol,L(this,i,"f"),s.status.srcChain.txHash);if(null===n?.bridgeStatus||n?.bridgeStatus===undefined)return;t=n.bridgeStatus.status}else{const a=L(this,I,"f").call(this,e);if(!a)return;L(this,A,"f").call(this,e,a);const r=(0,K.getStatusRequestWithSrcTxHash)(s.quote,a),d=await(0,K.fetchBridgeTxStatus)(r,L(this,i,"f"),await L(this,S,"f").call(this),L(this,o,"f"),L(this,c,"f").customBridgeApiBaseUrl);t=d.status,n=d.validationFailures}if(n.length>0)throw L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:n,refresh_count:s.attempts?.counter??0}),new Error(`Bridge status validation failed: ${n.join(", ")}`);const d={...s,status:t,completionTime:t.status===F.StatusTypes.COMPLETE||t.status===F.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=d}),s.quote.intent&&L(this,r,"f").syncTransactionFromIntentStatus(e,s);const l=L(this,a,"f")[e];if((t.status===F.StatusTypes.COMPLETE||t.status===F.StatusTypes.FAILED)&&l){if(this.stopPollingByPollingToken(l),delete L(this,a,"f")[e],s.featureId)return;t.status===F.StatusTypes.COMPLETE&&(L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",s.quote.destAsset.assetId)),t.status===F.StatusTypes.FAILED&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),L(this,T,"f").call(this,e)}}),S.set(this,async()=>{try{return await this.messenger.call("AuthenticationController:getBearerToken")}catch(e){return console.error("Error getting JWT token for bridge-api request",e),undefined}}),I.set(this,e=>{const{txHistory:t}=this.state,s=t[e].status.srcChain.txHash;if(s)return s;const n=this.messenger.call("TransactionController:getState").transactions.find(t=>t.id===e);return n?.hash}),A.set(this,(e,t)=>{const{txHistory:s}=this.state;s[e].status.srcChain.txHash||this.update(s=>{s.txHistory[e].status.srcChain.txHash=t})}),y.set(this,(e,t)=>{const s=Object.keys(this.state.txHistory).filter(s=>{const n=this.state.txHistory[s],a=(0,q.numberToHex)(n.quote.srcChainId);return n.account===e&&a===t});s.forEach(e=>{L(this,a,"f")[e]&&this.stopPollingByPollingToken(L(this,a,"f")[e])}),this.update(e=>{e.txHistory=s.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),x.set(this,async(e,t,s)=>{if(!s.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const n=(0,J.getClientRequest)(e,t.quote.srcChainId,s),a=await this.messenger.call("SnapController:handleRequest",n),r={...t,trade:e};return(0,J.handleNonEvmTxResponse)(a,r,s)}),v.set(this,async e=>{const t=await e,s=this.messenger.call("TransactionController:getState").transactions.find(e=>e.hash===t);if(!s)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return s}),C.set(this,async(e,{timeoutMs:t=3e5,pollMs:s=3e3}={})=>await(0,J.waitForTxConfirmation)(this.messenger,e,{timeoutMs:t,pollMs:s})),j.set(this,async(e,t,s,n,a)=>{if(s&&(0,F.isEvmTxData)(s)){const r=async()=>{await L(this,D,"f").call(this,n);const r=await L(this,P,"f").call(this,{transactionType:e?U.TransactionType.bridgeApproval:U.TransactionType.swapApproval,trade:s,requireApproval:a});return await(0,J.handleApprovalDelay)(t),r};return await L(this,h,"f").call(this,{name:e?$.TraceName.BridgeTransactionApprovalCompleted:$.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t),stxEnabled:!1}},r)}return undefined}),P.set(this,async({transactionType:e,trade:t,requireApproval:s=!1,txFee:n,actionId:a})=>{const r=a??(0,J.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 i=(0,F.formatChainIdToHex)(t.chainId),o=this.messenger.call("NetworkController:findNetworkClientIdByChainId",i),c={actionId:r,networkClientId:o,requireApproval:s,type:e,origin:"metamask"},{gasLimit:l,...m}=t,u={...m,chainId:i,...l&&0!==l&&{gasLimit:l.toString(),gas:l.toString()}},h={...u,...await L(this,N,"f").call(this,u,o,i,n)},{result:f}=await L(this,d,"f").call(this,h,c);return await L(this,v,"f").call(this,f)}),D.set(this,async e=>{e&&await L(this,P,"f").call(this,{transactionType:U.TransactionType.bridgeApproval,trade:e})}),N.set(this,async(e,t,s,n)=>{const{gas:a}=e;if(n)return{maxFeePerGas:(0,B.toHex)(n.maxFeePerGas),maxPriorityFeePerGas:(0,B.toHex)(n.maxPriorityFeePerGas),gas:a?(0,B.toHex)(a):undefined};const{gasFeeEstimates:r}=this.messenger.call("GasFeeController:getState"),{estimates:i}=await L(this,u,"f").call(this,{transactionParams:e,chainId:s,networkClientId:t}),{maxFeePerGas:o,maxPriorityFeePerGas:c}=(0,Y.getTxGasEstimates)({networkGasFeeEstimates:r,txGasFeeEstimates:i});return{maxFeePerGas:o,maxPriorityFeePerGas:c,gas:a?(0,B.toHex)(a):undefined}}),R.set(this,async e=>{const t=await(0,J.getAddTransactionBatchParams)({messenger:this.messenger,estimateGasFeeFn:L(this,u,"f"),...e}),s={[U.TransactionType.bridgeApproval]:t.transactions.find(({type:e})=>e===U.TransactionType.bridgeApproval)?.params.data,[U.TransactionType.swapApproval]:t.transactions.find(({type:e})=>e===U.TransactionType.swapApproval)?.params.data,[U.TransactionType.bridge]:t.transactions.find(({type:e})=>e===U.TransactionType.bridge)?.params.data,[U.TransactionType.swap]:t.transactions.find(({type:e})=>e===U.TransactionType.swap)?.params.data},{batchId:n}=await L(this,l,"f").call(this,t),{approvalMeta:a,tradeMeta:r}=(0,J.findAndUpdateTransactionsInBatch)({messenger:this.messenger,updateTransactionFn:L(this,m,"f"),batchId:n,txDataByType:s});if(!r)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:a,tradeMeta:r}}),this.submitTx=async(e,t,s,a,r=F.MetaMetricsSwapsEventSource.MainView,o,c)=>{this.messenger.call("BridgeController:stopPollingForQuotes",F.AbortReason.TransactionSubmitted,t.featureId?undefined:a);const d=L(this,n,"m",_).call(this,e);if(!d)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const l=(0,F.isHardwareWallet)(d),m=(0,z.getPreConfirmationPropertiesFromQuote)(t,s,l,r,o,c);let u,f;!t.featureId&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Submitted,undefined,m);let p=!1;const w=Date.now(),T=(0,F.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),E=(0,F.isTronChainId)(t.quote.srcChainId);if((0,F.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,F.isTronTrade)(t.approval)){const e=await L(this,h,"f").call(this,{name:T?$.TraceName.BridgeTransactionApprovalCompleted:$.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{return t.approval&&(0,F.isTronTrade)(t.approval)?await L(this,x,"f").call(this,t.approval,t,d):undefined}catch(e){throw!t.featureId&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...m}),e}});f=e?.id,await(0,J.handleApprovalDelay)(t.quote.srcChainId)}u=await L(this,h,"f").call(this,{name:T?$.TraceName.BridgeTransactionCompleted:$.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{if(!(0,F.isTronTrade)(t.trade)&&!(0,F.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 L(this,x,"f").call(this,t.trade,t,d)}catch(e){throw!t.featureId&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...m}),e}})}else{const e=L(this,i,"f")===V.BridgeClientId.MOBILE&&l;u=await L(this,h,"f").call(this,{name:T?$.TraceName.BridgeTransactionCompleted:$.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,F.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:s}},async()=>{if(!(0,F.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");const n=(0,F.formatChainIdToHex)(t.quote.srcChainId);if(p=await(async()=>{try{return(await this.messenger.call("TransactionController:isAtomicBatchSupported",{address:t.trade.from,chainIds:[n]})).some(e=>e.isSupported&&e.delegationAddress)}catch{return!1}})(),s||t.quote.gasIncluded7702||p){const{tradeMeta:s,approvalMeta:n}=await L(this,R,"f").call(this,{isBridgeTx:T,resetApproval:t.resetApproval,approval:t.approval&&(0,F.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e,isDelegatedAccount:p});return f=n?.id,s}const a=await L(this,j,"f").call(this,T,t.quote.srcChainId,t.approval&&(0,F.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);f=a?.id,await(0,J.handleMobileHardwareWalletDelay)(e);const i=(0,J.generateActionId)().toString();L(this,g,"f").call(this,{accountAddress:d.address,statusRequest:{...(0,J.getStatusRequestParams)(t),srcTxHash:""},quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:w,approvalTxId:f,location:r,abTests:o,activeAbTests:c},i);const l=await L(this,P,"f").call(this,{transactionType:T?U.TransactionType.bridge:U.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined,actionId:i});return L(this,k,"f").call(this,i,l),l})}try{!((0,F.isNonEvmChainId)(t.quote.srcChainId)||s||t.quote.gasIncluded7702||p)||L(this,g,"f").call(this,{accountAddress:d.address,bridgeTxMeta:u,statusRequest:{...(0,J.getStatusRequestParams)(t),srcTxHash:u.hash},quoteResponse:t,slippagePercentage:0,isStxEnabled:s,startTime:w,approvalTxId:f,location:r,abTests:o,activeAbTests:c}),(0,F.isNonEvmChainId)(t.quote.srcChainId)&&(L(this,b,"f").call(this,u.id),T||E||L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Completed,u.id))}catch{}return u},this.submitIntent=async e=>{const{quoteResponse:t,accountAddress:s,location:a,abTests:o,activeAbTests:c}=e;this.messenger.call("BridgeController:stopPollingForQuotes",F.AbortReason.TransactionSubmitted);const l=L(this,n,"m",_).call(this,s),m=Boolean(l)&&(0,F.isHardwareWallet)(l),u=(0,z.getPreConfirmationPropertiesFromQuote)(t,!1,m,a,o,c);try{const e=(0,J.getIntentFromQuote)(t),n=(0,F.isCrossChain)(t.quote.srcChainId,t.quote.destChainId),l=m&&L(this,i,"f")===V.BridgeClientId.MOBILE,u=await L(this,j,"f").call(this,n,t.quote.srcChainId,t.approval,t.resetApproval,l),h=u?.id;h&&await L(this,C,"f").call(this,h);const{srcChainId:f,requestId:p}=t.quote,k={srcChainId:f,quoteId:p,signature:await this.messenger.call("KeyringController:signTypedMessage",{from:s,data:e.typedData},G.SignTypedDataVersion.V4),order:e.order,userAddress:s,aggregatorId:e.protocol},w=await L(this,r,"f").submitIntent(k,L(this,i,"f")),_=w.id,T=n?U.TransactionType.bridge:U.TransactionType.swap,E=this.messenger.call("NetworkController:findNetworkClientIdByChainId",(0,F.formatChainIdToHex)(f)),S={chainId:(0,F.formatChainIdToHex)(f),from:s,to:e.settlementContract??"0x9008D19f58AAbd9eD0D60971565AA8510560ab41",data:`0x${_.slice(-8)}`,value:"0x0",gas:"0x5208",gasPrice:"0x3b9aca00"},{transactionMeta:I}=await L(this,d,"f").call(this,S,{origin:"metamask",actionId:(0,J.generateActionId)(),requireApproval:!1,isStateOnly:!0,networkClientId:E,type:T}),A=I,y=(0,Q.mapIntentOrderStatusToTransactionStatus)(w.status),x={...{...A,status:y},isIntentTx:!0,orderUid:_};try{const e=_,n={...x,id:e,originalTransactionId:x.id},r=Date.now();L(this,g,"f").call(this,{accountAddress:s,bridgeTxMeta:n,statusRequest:{...(0,J.getStatusRequestParams)(t),srcTxHash:x.hash??""},quoteResponse:t,slippagePercentage:0,isStxEnabled:!1,approvalTxId:h,startTime:r,location:a,abTests:o,activeAbTests:c}),L(this,b,"f").call(this,e)}catch(e){console.error("📝 [submitIntent] Failed to add to bridge history",e)}return x}catch(e){throw L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...u}),e}},O.set(this,(e,t,s)=>{const n=t?this.state.txHistory?.[t]?.abTests:undefined,a=t?this.state.txHistory?.[t]?.activeAbTests:undefined,r=s?.ab_tests??n,i=s?.active_ab_tests??a,o={action_type:F.MetricsActionType.SWAPBRIDGE_V1,location:s?.location??(t?this.state.txHistory?.[t]?.location:undefined)??F.MetaMetricsSwapsEventSource.MainView,...s??{},...r&&Object.keys(r).length>0&&{ab_tests:r},...i&&i.length>0&&{active_ab_tests:i}};if(!t)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,o);const c=this.state.txHistory[t];if(!c)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,o);const d=(0,z.getRequestParamFromHistory)(c);if(e===F.UnifiedSwapBridgeEventName.StatusValidationFailed)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,{...o,chain_id_source:d.chain_id_source,chain_id_destination:d.chain_id_destination,token_address_source:d.token_address_source,token_address_destination:d.token_address_destination,refresh_count:c.attempts?.counter??0});if(c.featureId)return;const l=this.messenger.call("AccountsController:getAccountByAddress",c.account),{transactions:m}=this.messenger.call("TransactionController:getState"),u=m?.find(e=>e.id===t),h=m?.find(e=>e.id===c.approvalTxId),f={...o,...d,...(0,z.getRequestMetadataFromHistory)(c,l),...(0,z.getTradeDataFromHistory)(c),...(0,z.getTxStatusesFromHistory)(c),...(0,z.getFinalizedTxProperties)(c,u,h),...(0,z.getPriceImpactFromQuote)(c.quote)};this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,f)}),M(this,i,s,"f"),M(this,o,H,"f"),M(this,d,Z,"f"),M(this,l,ee,"f"),M(this,m,te,"f"),M(this,u,se,"f"),M(this,c,{customBridgeApiBaseUrl:ne?.customBridgeApiBaseUrl??$.BRIDGE_PROD_API_BASE_URL},"f"),M(this,h,ae??((e,t)=>t?.()),"f"),M(this,r,new W.IntentManager({messenger:this.messenger,updateTransactionFn:L(this,m,"f"),customBridgeApiBaseUrl:L(this,c,"f").customBridgeApiBaseUrl,fetchFn:L(this,o,"f"),getJwt:L(this,S,"f")}),"f"),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:submitIntent`,this.submitIntent.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${$.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength($.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:s,id:n,actionId:a}=e;if(t&&[U.TransactionType.bridge,U.TransactionType.swap,U.TransactionType.bridgeApproval,U.TransactionType.swapApproval].includes(t)&&[U.TransactionStatus.failed,U.TransactionStatus.dropped,U.TransactionStatus.rejected].includes(s)&&(L(this,f,"f").call(this,e),s!==U.TransactionStatus.rejected)){let t;this.state.txHistory[n]?t=n:a&&this.state.txHistory[a]&&(t=a),L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Failed,t??n,(0,z.getEVMTxPropertiesFromTransactionMeta)(e))}}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:s,chainId:n}=e;t===U.TransactionType.swap&&L(this,O,"f").call(this,F.UnifiedSwapBridgeEventName.Completed,s),t!==U.TransactionType.bridge||(0,F.isNonEvmChainId)(n)||L(this,b,"f").call(this,s)}),L(this,p,"f").call(this)}}s.BridgeStatusController=Z,a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,k=new WeakMap,b=new WeakMap,w=new WeakMap,T=new WeakMap,E=new WeakMap,S=new WeakMap,I=new WeakMap,A=new WeakMap,y=new WeakMap,x=new WeakMap,v=new WeakMap,C=new WeakMap,j=new WeakMap,P=new WeakMap,D=new WeakMap,N=new WeakMap,R=new WeakMap,O=new WeakMap,n=new WeakSet,_=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/bridge-status-controller.intent.cjs",{"./utils/intent-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.cjs","./utils/validators.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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,i,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.IntentManager=void 0;const l=e("@metamask/bridge-controller"),m=e("./utils/intent-api.cjs");e("./utils/validators.cjs");s.IntentManager=class{constructor({messenger:e,updateTransactionFn:t,customBridgeApiBaseUrl:s,fetchFn:u,getJwt:h}){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,new Map),this.getIntentTransactionStatus=async(e,t,s,a,r="")=>{try{const i=await this.intentApi.getOrderStatus(e,s,t,a);return d(this,n,"m",o).call(this,e,i,t,r.toString())}catch(e){if(e instanceof Error)throw new Error(`[Intent polling] Failed to get intent order status from API: ${e.message}`);return undefined}},this.syncTransactionFromIntentStatus=(e,t)=>{const s=t.originalTransactionId??t.txMetaId;if(!s)return;const n=d(this,i,"f").get(e);if(n)try{const{transactions:t}=d(this,a,"f").call("TransactionController:getState"),o=t.find(e=>e.id===s);if(!o)return void console.warn("[Intent polling] Skipping update, transaction not found",{originalTxId:s,bridgeHistoryKey:e});const{bridgeStatus:c,orderStatus:m}=n,u=c?.txHash,h=c?.status.status===l.StatusTypes.COMPLETE,f=c?.status.status===l.StatusTypes.COMPLETE||c?.status.status===l.StatusTypes.FAILED,p=o.txReceipt,g=u?{txReceipt:{...p,transactionHash:u,status:h?"0x1":"0x0"}}:{},k={...o,status:c?.transactionStatus,...u?{hash:u}:{},...g};d(this,r,"f").call(this,k,`BridgeStatusController - Intent order status updated: ${m}`),f&&d(this,i,"f").delete(e)}catch(t){console.error("[Intent polling] Failed to update transaction status",{originalTxId:s,bridgeHistoryKey:e,error:t})}},this.submitIntent=async(e,t)=>this.intentApi.submitIntent(e,t),c(this,a,e,"f"),c(this,r,t,"f"),this.intentApi=new m.IntentApiImpl(s,u,h)}},a=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,o=function(e,t,s,n){const a=(0,m.translateIntentOrderToBridgeStatus)(t,s,n),r={orderStatus:t.status,bridgeStatus:a};return d(this,i,"f").set(e,r),r}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.intent.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,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=s.APPROVAL_DELAY_MS=s.BRIDGE_PROD_API_BASE_URL=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.BRIDGE_STATUS_CONTROLLER_NAME=s.MAX_ATTEMPTS=s.REFRESH_INTERVAL_MS=void 0,s.REFRESH_INTERVAL_MS=1e4,s.MAX_ATTEMPTS=7,s.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{}},s.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",s.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"}(n||(s.TraceName=n={}))}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getTxMetaFields=s.BridgeStatusController=s.BridgeStatusAction=s.BridgeId=s.MAX_ATTEMPTS=s.BRIDGE_STATUS_CONTROLLER_NAME=s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=s.REFRESH_INTERVAL_MS=void 0;var n=e("./constants.cjs");Object.defineProperty(s,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return n.REFRESH_INTERVAL_MS}}),Object.defineProperty(s,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(s,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return n.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(s,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return n.MAX_ATTEMPTS}});var a=e("./types.cjs");Object.defineProperty(s,"BridgeId",{enumerable:!0,get:function(){return a.BridgeId}}),Object.defineProperty(s,"BridgeStatusAction",{enumerable:!0,get:function(){return a.BridgeStatusAction}});var r=e("./bridge-status-controller.cjs");Object.defineProperty(s,"BridgeStatusController",{enumerable:!0,get:function(){return r.BridgeStatusController}});var i=e("./utils/transaction.cjs");Object.defineProperty(s,"getTxMetaFields",{enumerable:!0,get:function(){return i.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",{"./constants.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeStatusAction=s.BridgeId=s.BridgeClientId=void 0;e("./constants.cjs");var n,a,r;!function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(n||(s.BridgeClientId=n={})),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"}(a||(s.BridgeId=a={})),function(e){e.StartPollingForBridgeTxStatus="StartPollingForBridgeTxStatus",e.WipeBridgeStatus="WipeBridgeStatus",e.GetState="GetState",e.ResetState="ResetState",e.SubmitTx="SubmitTx",e.SubmitIntent="SubmitIntent",e.RestartPollingForFailedAttempts="RestartPollingForFailedAttempts",e.GetBridgeHistoryItemByTxMetaId="GetBridgeHistoryItemByTxMetaId"}(r||(s.BridgeStatusAction=r={}))}}},{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/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.shouldSkipFetchDueToFetchFailures=s.getStatusRequestWithSrcTxHash=s.fetchBridgeTxStatus=s.getStatusRequestDto=s.getBridgeStatusUrl=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/superstruct"),r=e("./validators.cjs"),i=e("../constants.cjs");s.getBridgeStatusUrl=e=>`${e}/getTxStatus`;s.getStatusRequestDto=e=>{const{quote:t,...s}=e;return{...Object.fromEntries(Object.entries(s).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};s.fetchBridgeTxStatus=async(e,t,i,o,c)=>{const d=(0,s.getStatusRequestDto)(e),l=new URLSearchParams(d),m=`${(0,s.getBridgeStatusUrl)(c)}?${l.toString()}`,u=await o(m,{headers:(0,n.getClientHeaders)({clientId:t,jwt:i})}),h=[];try{(0,r.validateBridgeStatusResponse)(u)}catch(t){t instanceof a.StructError&&t.failures().forEach(({path:t})=>{const s=u?.bridge??(e.bridge||e.bridgeId)??"unknown",n=t?.join(".")||"unknown";h.push([s,n].join("|"))})}return{status:u,validationFailures:h}};s.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:s,bridges:n,srcChainId:a,destChainId:r,refuel:i}=e;return{bridgeId:s,srcTxHash:t,bridge:n[0],srcChainId:a,destChainId:r,quote:e,refuel:Boolean(i)}};s.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=i.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/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","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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.calcActualGasUsed=s.calculateGasFees=s.getTxGasEstimates=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/controller-utils"),r=e("bignumber.js");s.getTxGasEstimates=({txGasFeeEstimates:e,networkGasFeeEstimates:t})=>{const{estimatedBaseFee:s="0"}=t;return((e,t)=>{const{maxFeePerGas:s,maxPriorityFeePerGas:a}=e?.[n.BRIDGE_PREFERRED_GAS_ESTIMATE]??{};return{baseAndPriorityFeePerGas:a?new r.BigNumber(t,10).times(10**9).plus(a,16):undefined,maxFeePerGas:s,maxPriorityFeePerGas:a}})(e,s)};s.calculateGasFees=async(e,t,n,{chainId:r,gasLimit:i,...o},c,d,l)=>{if(e)return{};if(l)return{...l,gas:i?.toString()};const m={...o,gas:i?.toString(),data:o.data,to:o.to,value:o.value},{gasFeeEstimates:u}=t.call("GasFeeController:getState"),{estimates:h}=await n({transactionParams:m,chainId:d,networkClientId:c}),{maxFeePerGas:f,maxPriorityFeePerGas:p}=(0,s.getTxGasEstimates)({networkGasFeeEstimates:u,txGasFeeEstimates:h});return{maxFeePerGas:f,maxPriorityFeePerGas:p,gas:(0,a.toHex)(m.gas??0)}};const i=(e,t)=>e&&t?new r.BigNumber(e,16).times(new r.BigNumber(t,16)):null;s.calcActualGasUsed=({pricingData:e},t,s)=>{const n=e?.quotedGasInUsd&&e?.quotedGasAmount?new r.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,a=i(t?.gasUsed,t?.effectiveGasPrice)?.plus(i(s?.gasUsed,s?.effectiveGasPrice)??0),o=a?.div(new r.BigNumber(10).pow(18)).toString(10);return a&&o?{amount:a.toString(10),usd:n?.multipliedBy(o).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/intent-api.cjs",{"./validators.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/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,s){var n,a,r,i=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},o=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.mapIntentOrderStatusToTransactionStatus=s.translateIntentOrderToBridgeStatus=s.IntentApiImpl=void 0;const c=e("@metamask/bridge-controller"),d=e("@metamask/transaction-controller"),l=e("./validators.cjs");s.IntentApiImpl=class{constructor(e,t,s){n.set(this,void 0),a.set(this,void 0),r.set(this,void 0),i(this,n,e,"f"),i(this,a,t,"f"),i(this,r,s,"f")}async submitIntent(e,t){const s=`${o(this,n,"f")}/submitOrder`;try{const n=await o(this,r,"f").call(this),i=await o(this,a,"f").call(this,s,{method:"POST",headers:{"Content-Type":"application/json",...(0,c.getClientHeaders)({clientId:t,jwt:n})},body:JSON.stringify(e)});if(!(0,l.validateIntentStatusResponse)(i))throw new Error("Invalid submitOrder response");return i}catch(e){if(e instanceof Error)throw new Error(`Failed to submit intent: ${e.message}`);throw new Error("Failed to submit intent")}}async getOrderStatus(e,t,s,i){const d=`${o(this,n,"f")}/getOrderStatus?orderId=${e}&aggregatorId=${encodeURIComponent(t)}&srcChainId=${s}`;try{const e=await o(this,r,"f").call(this),t=await o(this,a,"f").call(this,d,{method:"GET",headers:(0,c.getClientHeaders)({clientId:i,jwt:e})});if(!(0,l.validateIntentStatusResponse)(t))throw new Error("Invalid getOrderStatus response");return t}catch(e){if(e instanceof Error)throw new Error(`Failed to get order status: ${e.message}`);throw new Error("Failed to get order status")}}},n=new WeakMap,a=new WeakMap,r=new WeakMap;function m(e){switch(e){case l.IntentOrderStatus.PENDING:case l.IntentOrderStatus.SUBMITTED:return d.TransactionStatus.submitted;case l.IntentOrderStatus.CONFIRMED:case l.IntentOrderStatus.COMPLETED:return d.TransactionStatus.confirmed;case l.IntentOrderStatus.FAILED:case l.IntentOrderStatus.EXPIRED:case l.IntentOrderStatus.CANCELLED:return d.TransactionStatus.failed;default:return d.TransactionStatus.submitted}}s.translateIntentOrderToBridgeStatus=(e,t,s)=>{let n;switch(e.status){case l.IntentOrderStatus.CONFIRMED:case l.IntentOrderStatus.COMPLETED:n=c.StatusTypes.COMPLETE;break;case l.IntentOrderStatus.FAILED:case l.IntentOrderStatus.EXPIRED:case l.IntentOrderStatus.CANCELLED:n=c.StatusTypes.FAILED;break;case l.IntentOrderStatus.PENDING:n=c.StatusTypes.PENDING;break;case l.IntentOrderStatus.SUBMITTED:n=c.StatusTypes.SUBMITTED;break;default:n=c.StatusTypes.UNKNOWN}const a=e.txHash??s??"";return{status:{status:n,srcChain:{chainId:t,txHash:a}},txHash:a,transactionStatus:m(e.status)}},s.mapIntentOrderStatusToTransactionStatus=m}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/intent-api.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getEVMTxPropertiesFromTransactionMeta=s.getRequestMetadataFromHistory=s.getTradeDataFromHistory=s.getPreConfirmationPropertiesFromQuote=s.getPriceImpactFromQuote=s.getTradeDataFromQuote=s.getRequestParamFromHistory=s.getFinalizedTxProperties=s.getTxStatusesFromHistory=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/transaction-controller"),r=e("bignumber.js"),i=e("./gas.cjs"),o=e("./swap-received-amount.cjs");s.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:s,quote:a})=>{const r=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING,i=e.destChain?.txHash?e.status:n.StatusTypes.PENDING,o=(0,n.formatChainIdToHex)(a.srcChainId),c=(0,n.isEthUsdt)(o,a.srcAsset.address),d=e.srcChain.txHash?n.StatusTypes.COMPLETE:undefined,l=e.srcChain.txHash?n.StatusTypes.COMPLETE:n.StatusTypes.PENDING;return{allowance_reset_transaction:c?d:undefined,approval_transaction:t||s?l:undefined,source_transaction:r,destination_transaction:e.status===n.StatusTypes.FAILED?n.StatusTypes.FAILED:i}};s.getFinalizedTxProperties=(e,t,s)=>{const n=s?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===a.TransactionType.swap?t?.time:e.completionTime,d=(0,i.calcActualGasUsed)(e,t?.txReceipt,s?.txReceipt),l=t?.type===a.TransactionType.swap?(0,o.getActualSwapReceivedAmount)(e,d,t):(0,o.getActualBridgeReceivedAmount)(e),m=e.pricingData?.quotedGasAmount&&d?.amount?new r.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new r.BigNumber(10).pow(18)).div(d.amount).toNumber():0,u=e.pricingData?.quotedReturnInUsd&&l?.usd?new r.BigNumber(e.pricingData.quotedReturnInUsd).div(l.usd).toNumber():0;return{actual_time_minutes:c&&n?(c-n)/6e4:0,usd_actual_return:Number(l?.usd??0),usd_actual_gas:d?.usd??0,quote_vs_execution_ratio:u,quoted_vs_used_gas_ratio:m}};s.getRequestParamFromHistory=e=>({chain_id_source:(0,n.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,n.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId});s.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,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});s.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});s.getPreConfirmationPropertiesFromQuote=(e,t,a,r=n.MetaMetricsSwapsEventSource.MainView,i,o)=>{const{quote:c}=e;return{...(0,s.getPriceImpactFromQuote)(c),...(0,s.getTradeDataFromQuote)(e),chain_id_source:(0,n.formatChainIdToCaip)(c.srcChainId),token_symbol_source:c.srcAsset.symbol,chain_id_destination:(0,n.formatChainIdToCaip)(c.destChainId),token_symbol_destination:c.destAsset.symbol,is_hardware_wallet:a,swap_type:(0,n.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:n.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1,location:r,...i&&Object.keys(i).length>0&&{ab_tests:i},...o&&o.length>0&&{active_ab_tests:o}}};s.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,n.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});s.getRequestMetadataFromHistory=(e,t)=>{const{quote:s,slippagePercentage:a,isStxEnabled:r}=e;return{slippage_limit:a,custom_slippage:(0,n.isCustomSlippage)(a),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,n.getSwapType)(s.srcChainId,s.destChainId),is_hardware_wallet:(0,n.isHardwareWallet)(t),stx_enabled:r??!1,security_warnings:[]}};s.getEVMTxPropertiesFromTransactionMeta=e=>({source_transaction:[a.TransactionStatus.failed,a.TransactionStatus.dropped,a.TransactionStatus.rejected].includes(e.status)?n.StatusTypes.FAILED:n.StatusTypes.COMPLETE,error_message:e.error?.message??"",chain_id_source:(0,n.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,n.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:0,stx_enabled:!1,token_address_source:(0,n.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,n.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",custom_slippage:!1,is_hardware_wallet:!1,swap_type:e.type&&[a.TransactionType.swap,a.TransactionType.swapApproval].includes(e.type)?n.MetricsSwapType.SINGLE:n.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:n.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createClientTransactionRequest=void 0;const n=e("uuid");s.createClientTransactionRequest=(e,t,s,a,r)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,n.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:s,accountId:a,...r&&{options:r}}}})}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getActualBridgeReceivedAmount=s.getActualSwapReceivedAmount=void 0;const n=e("@metamask/bridge-controller"),a=e("bignumber.js");s.getActualSwapReceivedAmount=(e,t,s)=>{const{pricingData:r}=e,i=e.quote.destTokenAmount;if(!s?.txReceipt)return null;const o=(0,n.isNativeAddress)(e.quote.destAsset.address)?((e,t,s)=>{const{preTxBalance:n,postTxBalance:r}=s;return n&&r&&n!==r?t&&r&&n?new a.BigNumber(r,16).minus(n,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new a.BigNumber(e.quote.destTokenAmount).div(new a.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,s):((e,t)=>{const{txReceipt:s}=t;if(!s?.logs||"0x0"===s.status)return null;const{account:n,quote:r}=e,i=s.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),s=e.address?.toLowerCase()===r.destAsset.address?.toLowerCase(),a=e.topics?.[2]&&(e.topics[2]===n||e.topics[2].match(n?.slice(2)));return t&&s&&a});return i?.data?new a.BigNumber(i.data,16).div(new a.BigNumber(10).pow(r.destAsset.decimals)):null})(e,s),c=r?.quotedReturnInUsd&&i?new a.BigNumber(r.quotedReturnInUsd).div(i).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:o,usd:o&&c?c.multipliedBy(o):null}};s.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:s,status:n}=e,r=s?.quotedReturnInUsd?new a.BigNumber(s.quotedReturnInUsd).div(t.destTokenAmount):null,i=n.destChain?.amount;return i&&r?{amount:i,usd:r.multipliedBy(i).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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getIntentFromQuote=s.getHistoryKey=s.findAndUpdateTransactionsInBatch=s.getAddTransactionBatchParams=s.toBatchTxParams=s.rekeyHistoryItemInState=s.waitForTxConfirmation=s.getClientRequest=s.handleMobileHardwareWalletDelay=s.handleApprovalDelay=s.handleNonEvmTxResponse=s.getTxMetaFields=s.getStatusRequestParams=s.generateActionId=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/controller-utils"),r=e("@metamask/transaction-controller"),i=e("@metamask/utils"),o=e("uuid"),c=e("./gas.cjs"),d=e("./snaps.cjs"),l=e("../constants.cjs");s.generateActionId=()=>(Date.now()+Math.random()).toString();s.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)});s.getTxMetaFields=(e,t)=>{let s;try{s=(0,n.formatChainIdToHex)(e.quote.destChainId)}catch{s="0x1"}return{destinationChainId:s,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}};s.handleNonEvmTxResponse=(e,t,a)=>{const i=a.address,c=a.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,n.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);let m;try{m=(0,n.formatChainIdToHex)(t.quote.srcChainId)}catch{m="0x1"}const u=(0,n.extractTradeData)(t.trade);return{...(0,s.getTxMetaFields)(t),time:Date.now(),id:d??(0,o.v4)(),chainId:m,networkClientId:c??m,txParams:{from:i,data:u},type:l?r.TransactionType.bridge:r.TransactionType.swap,status:r.TransactionStatus.submitted,hash:d,origin:c,isSolana:!0,isBridgeTx:l}};s.handleApprovalDelay=async e=>{if([n.ChainId.LINEA,n.ChainId.BASE].includes(e)){(0,i.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}};s.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};s.getClientRequest=(e,t,s)=>{const a=(0,n.formatChainIdToCaip)(t),r=(0,n.extractTradeData)(e),i=(0,n.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,d.createClientTransactionRequest)(s.metadata.snap?.id,r,a,s.id,i)};s.waitForTxConfirmation=async(e,t,{timeoutMs:s=3e5,pollMs:n=3e3}={})=>{const a=Date.now();for(;;){const{transactions:i}=e.call("TransactionController:getState"),o=i.find(e=>e.id===t);if(o){if(o.status===r.TransactionStatus.confirmed)return o;if(o.status===r.TransactionStatus.failed||o.status===r.TransactionStatus.dropped||o.status===r.TransactionStatus.rejected)throw new Error("Approval transaction did not confirm")}if(Date.now()-a>s)throw new Error("Timed out waiting for approval confirmation");await new Promise(e=>setTimeout(e,n))}};s.rekeyHistoryItemInState=(e,t,s)=>{const n=e.txHistory[t];return!!n&&(e.txHistory[s.id]={...n,txMetaId:s.id,originalTransactionId:n.originalTransactionId??s.id,status:{...n.status,srcChain:{...n.status.srcChain,txHash:s.hash??n.status.srcChain?.txHash}}},delete e.txHistory[t],!0)};s.toBatchTxParams=(e,{chainId:t,gasLimit:s,...n},{maxFeePerGas:r,maxPriorityFeePerGas:i,gas:o})=>{const c={...n,data:n.data,to:n.to,value:n.value};return e?c:{...c,gas:(0,a.toHex)(o??0),maxFeePerGas:(0,a.toHex)(r??0),maxPriorityFeePerGas:(0,a.toHex)(i??0)}};s.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:a,resetApproval:i,trade:o,quoteResponse:{quote:{feeData:{txFee:d},gasIncluded:l,gasIncluded7702:m,gasSponsored:u},sentAmount:h,toTokenAmount:f},requireApproval:p=!1,isDelegatedAccount:g=!1,estimateGasFeeFn:k})=>{const b=l||m;if(!e.call("AccountsController:getAccountByAddress",o.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const w=(0,n.formatChainIdToHex)(o.chainId),_=e.call("NetworkController:findNetworkClientIdByChainId",w),T=!0===m;let E=!T&&!g;l&&!m&&(E=!0);const S=[];if(i){const n=await(0,c.calculateGasFees)(T,e,k,i,_,w,b?d:undefined);S.push({type:t?r.TransactionType.bridgeApproval:r.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(T,i,n)})}if(a){const n=await(0,c.calculateGasFees)(T,e,k,a,_,w,b?d:undefined);S.push({type:t?r.TransactionType.bridgeApproval:r.TransactionType.swapApproval,params:(0,s.toBatchTxParams)(T,a,n)})}const I=await(0,c.calculateGasFees)(T,e,k,o,_,w,b?d:undefined);S.push({type:t?r.TransactionType.bridge:r.TransactionType.swap,params:(0,s.toBatchTxParams)(T,o,I),assetsFiatValues:{sending:h?.valueInCurrency?.toString(),receiving:f?.valueInCurrency?.toString()}});return{disable7702:E,isGasFeeIncluded:Boolean(m),isGasFeeSponsored:Boolean(u),networkClientId:_,requireApproval:p,origin:"metamask",from:o.from,transactions:S}};s.findAndUpdateTransactionsInBatch=({messenger:e,updateTransactionFn:t,batchId:s,txDataByType:n})=>{const a=e.call("TransactionController:getState").transactions,i={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(n).forEach(([e,n])=>{if(n===undefined)return;const o=a.find(t=>{if(t.batchId!==s)return!1;if(Array.isArray(t.txParams.authorizationList)&&t.txParams.authorizationList.length>0||Boolean(t.delegationAddress)){if((e===r.TransactionType.swap||e===r.TransactionType.bridge)&&t.type===r.TransactionType.batch)return!0;if((e===r.TransactionType.swapApproval||e===r.TransactionType.bridgeApproval)&&t.txParams.data===n)return!0}return t.txParams.data===n});if(o){const s={...o,type:e};t(s,`Update tx type to ${e}`),i[[r.TransactionType.bridgeApproval,r.TransactionType.swapApproval].includes(e)?"approvalMeta":"tradeMeta"]=s}}),i},s.getHistoryKey=function(e,t){const s=e??t;if(!s)throw new Error("Cannot add tx to history: either actionId or bridgeTxMeta.id must be provided");return s},s.getIntentFromQuote=function(e){const{intent:t}=e.quote;if(!t)throw new Error("submitIntent: missing intent data");return t}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateIntentStatusResponse=s.IntentOrderStatus=s.validateBridgeStatusResponse=s.StatusResponseSchema=void 0;const n=e("@metamask/bridge-controller"),a=e("@metamask/superstruct"),r=(0,a.number)(),i=(0,a.type)({}),o=(0,a.type)({chainId:r,txHash:(0,a.optional)((0,a.string)()),amount:(0,a.optional)((0,a.string)()),token:(0,a.optional)((0,a.union)([i,n.BridgeAssetSchema]))}),c=(0,a.type)({chainId:r,txHash:(0,a.optional)((0,a.string)()),amount:(0,a.optional)((0,a.string)()),token:(0,a.optional)((0,a.union)([i,n.BridgeAssetSchema]))}),d=(0,a.type)({});s.StatusResponseSchema=(0,a.type)({status:(0,a.enums)(Object.values(n.StatusTypes)),srcChain:o,destChain:(0,a.optional)(c),bridge:(0,a.optional)((0,a.string)()),isExpectedToken:(0,a.optional)((0,a.boolean)()),isUnrecognizedRouterAddress:(0,a.optional)((0,a.boolean)()),refuel:(0,a.optional)(d)});var l;s.validateBridgeStatusResponse=e=>((0,a.assert)(e,s.StatusResponseSchema),!0),function(e){e.PENDING="pending",e.SUBMITTED="submitted",e.CONFIRMED="confirmed",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.EXPIRED="expired"}(l||(s.IntentOrderStatus=l={}));const m=(0,a.type)({id:(0,a.string)(),status:(0,a.enums)(Object.values(l)),txHash:(0,a.optional)((0,a.string)()),metadata:(0,a.type)({txHashes:(0,a.optional)((0,a.union)([(0,a.array)((0,a.string)()),(0,a.string)()]))})});s.validateIntentStatusResponse=e=>(0,a.is)(e,m)}}},{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,s){var n,a,r,i,o,c,d,l,m,u,h,f,p,g,k,b,w,_,T,E,S,I,A,y,x,v,C,j,P=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},D=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeController=void 0;const N=e("@ethersproject/bignumber"),R=e("@ethersproject/contracts"),O=e("@ethersproject/providers"),M=e("@metamask/metamask-eth-abis"),L=e("@metamask/polling-controller"),F=e("./constants/bridge.cjs"),B=e("./constants/chains.cjs"),G=e("./constants/swaps.cjs"),H=e("./constants/traces.cjs"),U=e("./selectors.cjs"),q=e("./types.cjs"),W=e("./utils/assets.cjs"),$=e("./utils/balance.cjs"),V=e("./utils/bridge.cjs"),K=e("./utils/caip-formatters.cjs"),Y=e("./utils/feature-flags.cjs"),Q=e("./utils/fetch.cjs"),z=e("./utils/metrics/constants.cjs"),J=e("./utils/metrics/properties.cjs"),X=e("./utils/quote.cjs"),Z=e("./utils/quote-fees.cjs"),ee=e("./utils/snaps.cjs"),te={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 se extends((0,L.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:s,clientVersion:L,getLayer1GasFee:se,fetchFn:ne,config:ae,trackMetaMetricsFn:re,traceFn:ie,getUseAssetsControllerForRates:oe}){super({name:F.BRIDGE_CONTROLLER_NAME,metadata:te,messenger:e,state:{...(0,V.getDefaultBridgeControllerState)(),...t}}),n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,z.MetaMetricsSwapsEventSource.MainView),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),m.set(this,void 0),u.set(this,void 0),h.set(this,void 0),f.set(this,void 0),this._executePoll=async e=>{await D(this,_,"f").call(this,e)},this.updateBridgeQuoteRequestParams=async(e,t)=>{D(this,C,"f").call(this,e),this.resetState(z.AbortReason.QuoteRequestUpdated);const s={...F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,...e};if(this.update(e=>{e.quoteRequest=s}),(0,X.isValidQuoteRequest)(s)){P(this,r,Date.now(),"f");const a=(0,V.isNonEvmChainId)(s.srcChainId),i=a?undefined:D(this,n,"m",I).call(this,(0,K.formatChainIdToHex)(s.srcChainId))?.configuration;let o,c=Boolean(e.resetApproval);a?o=e.insufficientBal:i?.rpcUrl?.includes("tenderly")?o=!0:(this.update(e=>{e.quotesLoadingStatus=q.RequestStatus.LOADING}),c=await D(this,w,"f").call(this,s),o=e.insufficientBal??await D(this,b,"f").call(this,s)),this.setChainIntervalLength(),this.startPolling({updatedQuoteRequest:{...s,insufficientBal:o,resetApproval:c},context:t})}},this.fetchQuotes=async(e,t=null,s=null)=>{const a=(0,Y.getBridgeFeatureFlags)(this.messenger),r=await D(this,A,"f").call(this),i=s?a.quoteRequestOverrides?.[s]:undefined,m=await D(this,w,"f").call(this,e),{quotes:u,validationFailures:f}=await(0,Q.fetchBridgeQuotes)(i?{...e,...i,resetApproval:m}:{...e,resetApproval:m},t,D(this,o,"f"),r,D(this,l,"f"),D(this,h,"f").customBridgeApiBaseUrl??F.BRIDGE_PROD_API_BASE_URL,s,D(this,c,"f"));D(this,p,"f").call(this,f);const g=await(0,Z.appendFeesToQuotes)(u,this.messenger,D(this,d,"f"),D(this,n,"m",S).call(this,e.walletAddress));return(0,X.sortQuotes)(g,s)},p.set(this,e=>{0!==e.length&&this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesValidationFailed,{failures:e,location:D(this,i,"f")})}),g.set(this,()=>D(this,f,"f").call(this)?{...this.messenger.call("AssetsController:getExchangeRatesForBridge"),historicalPrices:{},...this.state}:{...this.messenger.call("MultichainAssetsRatesController:getState"),...this.messenger.call("CurrencyRateController:getState"),...this.messenger.call("TokenRatesController:getState"),...this.state}),k.set(this,async({srcChainId:e,srcTokenAddress:t,destChainId:s,destTokenAddress:n})=>{const r=new Set([]),i=D(this,g,"f").call(this);t&&e&&!(0,U.selectIsAssetExchangeRateInState)(i,e,t)&&(0,W.getAssetIdsForToken)(t,e).forEach(e=>r.add(e)),n&&s&&!(0,U.selectIsAssetExchangeRateInState)(i,s,n)&&(0,W.getAssetIdsForToken)(n,s).forEach(e=>r.add(e));const d=D(this,f,"f").call(this)?this.messenger.call("AssetsController:getExchangeRatesForBridge").currentCurrency:this.messenger.call("CurrencyRateController:getState").currentCurrency;if(0===r.size)return;const m=await(0,Q.fetchAssetPrices)({assetIds:r,currencies:new Set([d]),clientId:D(this,o,"f"),clientVersion:D(this,c,"f"),fetchFn:D(this,l,"f"),signal:D(this,a,"f")?.signal}),u=(0,W.toExchangeRates)(d,m);this.update(e=>{e.assetExchangeRates={...e.assetExchangeRates,...u}})}),b.set(this,async e=>{try{const t=(0,K.formatChainIdToHex)(e.srcChainId),s=D(this,n,"m",I).call(this,t)?.provider,a=(0,K.formatAddressToCaipReference)(e.srcTokenAddress);return!(s&&a&&e.srcTokenAmount&&t&&await(0,$.hasSufficientBalance)(s,e.walletAddress,a,e.srcTokenAmount,t))}catch(e){return console.warn("Failed to set insufficientBal",e),!0}}),w.set(this,async e=>{if((0,V.isNonEvmChainId)(e.srcChainId))return!1;try{const t=(0,K.formatAddressToCaipReference)(e.srcTokenAddress);if((0,V.isEthUsdt)(e.srcChainId,t)){const s=N.BigNumber.from(await D(this,j,"f").call(this,e.walletAddress,t,e.destChainId));return s.lt(e.srcTokenAmount)&&s.gt(0)}return!1}catch(e){return console.warn("Failed to set resetApproval",e),!0}}),this.stopPollingForQuotes=(e,t)=>{this.stopAllPolling(),this.state.quotesLoadingStatus===q.RequestStatus.LOADING&&t&&this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesReceived,t),D(this,a,"f")?.abort(e)},this.setLocation=e=>{P(this,i,e,"f")},this.resetState=(e=z.AbortReason.ResetState)=>{this.stopPollingForQuotes(e),this.update(e=>{e.quoteRequest=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,e.quotesInitialLoadTime=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesInitialLoadTime,e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,e.quotesLastFetched=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLastFetched,e.quotesLoadingStatus=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLoadingStatus,e.quoteFetchError=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,e.quotesRefreshCount=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount,e.assetExchangeRates=F.DEFAULT_BRIDGE_CONTROLLER_STATE.assetExchangeRates,e.minimumBalanceForRentExemptionInLamports=F.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports})},this.setChainIntervalLength=()=>{const{state:e}=this,{srcChainId:t}=e.quoteRequest,s=(0,Y.getBridgeFeatureFlags)(this.messenger),n=t?s.chains[(0,K.formatChainIdToCaip)(t)]?.refreshRate:undefined,a=s.refreshRate;this.setIntervalLength(n??a)},_.set(this,async({updatedQuoteRequest:e,context:t})=>{D(this,a,"f")?.abort(z.AbortReason.NewQuoteRequest),P(this,a,new AbortController,"f"),D(this,k,"f").call(this,e).catch(e=>console.warn("Failed to fetch asset exchange rates",e)),this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesRequested,t);const{sse:s,maxRefreshCount:i}=(0,Y.getBridgeFeatureFlags)(this.messenger),o=s?.enabled&&(0,Y.hasMinimumRequiredVersion)(D(this,c,"f"),s.minimumVersion);this.update(t=>{t.quoteRequest=e,t.quoteFetchError=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,t.quotesLastFetched=Date.now(),t.quotesLoadingStatus=q.RequestStatus.LOADING});const d=await D(this,A,"f").call(this);try{await D(this,u,"f").call(this,{name:(0,V.isCrossChain)(e.srcChainId,e.destChainId)?H.TraceName.BridgeQuotesFetched:H.TraceName.SwapQuotesFetched,data:{srcChainId:(0,K.formatChainIdToCaip)(e.srcChainId),destChainId:(0,K.formatChainIdToCaip)(e.destChainId)}},async()=>{const t=D(this,n,"m",S).call(this,e.walletAddress);if(D(this,E,"f").call(this,e.srcChainId,t?.metadata?.snap?.id),o)return void await D(this,T,"f").call(this,e,d,t);const s=await this.fetchQuotes(e,D(this,a,"f")?.signal);this.update(e=>{e.quotesRefreshCount===F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount&&D(this,r,"f")&&(e.quotesInitialLoadTime=Date.now()-D(this,r,"f")),e.quotes=s,e.quotesLoadingStatus=q.RequestStatus.FETCHED})})}catch(e){if(this.update(e=>{e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes}),e.toString().includes("AbortError")||e.toString().includes("FetchRequestCanceledException")||[z.AbortReason.ResetState,z.AbortReason.NewQuoteRequest,z.AbortReason.QuoteRequestUpdated,z.AbortReason.TransactionSubmitted].includes(e))return;this.update(t=>{let s;try{s=e?.message??e.toString()}catch{}finally{t.quoteFetchError=s??"Unknown error"}t.quotesLoadingStatus=q.RequestStatus.ERROR}),this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.QuotesError,t),console.log(`Failed to ${o?"stream":"fetch"} bridge quotes`,e)}this.update(e=>{e.quotesRefreshCount+=1}),(e.insufficientBal||!e.insufficientBal&&this.state.quotesRefreshCount>=i)&&this.stopAllPolling()}),T.set(this,async(e,t,s)=>{let n=0;const i=new Set;await(0,Q.fetchBridgeQuoteStream)(D(this,l,"f"),e,D(this,a,"f")?.signal,D(this,o,"f"),t,D(this,h,"f").customBridgeApiBaseUrl??F.BRIDGE_PROD_API_BASE_URL,{onValidationFailure:D(this,p,"f"),onValidQuoteReceived:async e=>{const t=(async()=>{const t=await(0,Z.appendFeesToQuotes)([e],this.messenger,D(this,d,"f"),s);t.length>0&&(n+=1),this.update(e=>{1===n&&(e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,!e.quotesInitialLoadTime&&D(this,r,"f")&&(e.quotesInitialLoadTime=Date.now()-D(this,r,"f"))),e.quotes=[...e.quotes,...t]})})();i.add(t),t.catch(e=>{console.error("Error appending fees to quote",e)}).finally(()=>{i.delete(t)}),await t},onClose:async()=>{await Promise.allSettled(Array.from(i)),this.update(e=>{0===n&&(e.quotes=F.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes),e.quotesLoadingStatus=q.RequestStatus.FETCHED})}},D(this,c,"f"))}),E.set(this,async(e,t)=>{if(!(0,V.isSolanaChainId)(e)||!t)return;const s=await(0,ee.getMinimumBalanceForRentExemptionInLamports)(t,this.messenger);this.update(e=>{e.minimumBalanceForRentExemptionInLamports=s})}),A.set(this,async()=>{try{return await this.messenger.call("AuthenticationController:getBearerToken")}catch(e){return console.error("Error getting JWT token for bridge-api request",e),undefined}}),y.set(this,()=>({slippage_limit:this.state.quoteRequest.slippage,swap_type:(0,J.getSwapTypeFromQuote)(this.state.quoteRequest),custom_slippage:(0,J.isCustomSlippage)(this.state.quoteRequest.slippage)})),x.set(this,()=>({quotes_count:this.state.quotes.length,quotes_list:this.state.quotes.map(({quote:e})=>(0,J.formatProviderLabel)(e)),initial_load_time_all_quotes:this.state.quotesInitialLoadTime??0,has_gas_included_quote:this.state.quotes.some(({quote:e})=>e.gasIncluded)})),v.set(this,(e,t)=>{const s=t,a={...t,location:s?.location??D(this,i,"f"),action_type:z.MetricsActionType.SWAPBRIDGE_V1};switch(e){case z.UnifiedSwapBridgeEventName.ButtonClicked:case z.UnifiedSwapBridgeEventName.PageViewed:return{...(0,J.getRequestParams)(this.state.quoteRequest),...a};case z.UnifiedSwapBridgeEventName.QuotesValidationFailed:return{...(0,J.getRequestParams)(this.state.quoteRequest),refresh_count:this.state.quotesRefreshCount,...a};case z.UnifiedSwapBridgeEventName.QuotesReceived:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),...D(this,x,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),refresh_count:this.state.quotesRefreshCount,...a};case z.UnifiedSwapBridgeEventName.QuotesRequested:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...a};case z.UnifiedSwapBridgeEventName.QuotesError:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),error_message:this.state.quoteFetchError,has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...a};case z.UnifiedSwapBridgeEventName.AllQuotesOpened:case z.UnifiedSwapBridgeEventName.AllQuotesSorted:case z.UnifiedSwapBridgeEventName.QuoteSelected:return{...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),...D(this,x,"f").call(this),is_hardware_wallet:(0,J.isHardwareWallet)(D(this,n,"m",S).call(this)),...a};case z.UnifiedSwapBridgeEventName.Failed:return{...a,...(0,J.getRequestParams)(this.state.quoteRequest),...D(this,y,"f").call(this),...D(this,x,"f").call(this),...t};case z.UnifiedSwapBridgeEventName.AssetDetailTooltipClicked:case z.UnifiedSwapBridgeEventName.AssetPickerOpened:return a;case z.UnifiedSwapBridgeEventName.Submitted:case z.UnifiedSwapBridgeEventName.Completed:return t;case z.UnifiedSwapBridgeEventName.InputChanged:default:return a}}),C.set(this,e=>{Object.entries(e).forEach(([t,s])=>{const n=J.toInputChangedPropertyKey[t],a=J.toInputChangedPropertyValue[t]?.(e);n&&a!==undefined&&s!==this.state.quoteRequest[t]&&this.trackUnifiedSwapBridgeEvent(z.UnifiedSwapBridgeEventName.InputChanged,{input:n,input_value:a,location:D(this,i,"f")})})}),this.trackUnifiedSwapBridgeEvent=(e,t)=>{try{const s=D(this,v,"f").call(this,e,t);D(this,m,"f").call(this,e,s)}catch(t){console.error(`Error tracking cross-chain swaps MetaMetrics event ${e}`,t)}},j.set(this,async(e,t,s)=>{const a=D(this,n,"m",I).call(this,B.CHAIN_IDS.MAINNET),r=a?.provider;if(!r)throw new Error("No provider found");const i=new O.Web3Provider(r),o=new R.Contract(t,M.abiERC20,i),c=(0,V.isCrossChain)(B.CHAIN_IDS.MAINNET,s)?F.METABRIDGE_ETHEREUM_ADDRESS:G.SWAPS_CONTRACT_ADDRESSES[B.CHAIN_IDS.MAINNET];return(await o.allowance(e,c)).toString()}),this.setIntervalLength(F.REFRESH_INTERVAL_MS),P(this,a,new AbortController,"f"),P(this,d,se,"f"),P(this,o,s,"f"),P(this,c,L,"f"),P(this,l,ne,"f"),P(this,m,re,"f"),P(this,h,ae??{},"f"),P(this,u,ie??((e,t)=>t?.()),"f"),P(this,f,oe??(()=>!1),"f"),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:setChainIntervalLength`,this.setChainIntervalLength.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:updateBridgeQuoteRequestParams`,this.updateBridgeQuoteRequestParams.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:trackUnifiedSwapBridgeEvent`,this.trackUnifiedSwapBridgeEvent.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:stopPollingForQuotes`,this.stopPollingForQuotes.bind(this)),this.messenger.registerActionHandler(`${F.BRIDGE_CONTROLLER_NAME}:fetchQuotes`,this.fetchQuotes.bind(this))}}s.BridgeController=se,a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,k=new WeakMap,b=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,E=new WeakMap,A=new WeakMap,y=new WeakMap,x=new WeakMap,v=new WeakMap,C=new WeakMap,j=new WeakMap,n=new WeakSet,S=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)},I=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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.METABRIDGE_CHAIN_TO_ADDRESS_MAP=s.DEFAULT_BRIDGE_CONTROLLER_STATE=s.DEFAULT_FEATURE_FLAG_CONFIG=s.DEFAULT_CHAIN_RANKING=s.BRIDGE_CONTROLLER_NAME=s.DEFAULT_MAX_REFRESH_COUNT=s.REFRESH_INTERVAL_MS=s.BRIDGE_MM_FEE_RATE=s.BRIDGE_PREFERRED_GAS_ESTIMATE=s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=s.BRIDGE_QUOTE_MAX_ETA_SECONDS=s.METABRIDGE_ETHEREUM_ADDRESS=s.ETH_USDT_ADDRESS=s.BridgeClientId=s.BRIDGE_PROD_API_BASE_URL=s.BRIDGE_DEV_API_BASE_URL=s.ALLOWED_BRIDGE_CHAIN_IDS=void 0;const n=e("@ethersproject/constants"),a=e("@metamask/keyring-api"),r=e("./chains.cjs");var i;s.ALLOWED_BRIDGE_CHAIN_IDS=[r.CHAIN_IDS.MAINNET,r.CHAIN_IDS.BSC,r.CHAIN_IDS.POLYGON,r.CHAIN_IDS.ZKSYNC_ERA,r.CHAIN_IDS.AVALANCHE,r.CHAIN_IDS.OPTIMISM,r.CHAIN_IDS.ARBITRUM,r.CHAIN_IDS.LINEA_MAINNET,r.CHAIN_IDS.BASE,r.CHAIN_IDS.SEI,r.CHAIN_IDS.MONAD,r.CHAIN_IDS.HYPEREVM,r.CHAIN_IDS.MEGAETH,a.SolScope.Mainnet,a.BtcScope.Mainnet,a.TrxScope.Mainnet],s.BRIDGE_DEV_API_BASE_URL="https://bridge.dev-api.cx.metamask.io",s.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(i||(s.BridgeClientId=i={})),s.ETH_USDT_ADDRESS="0xdac17f958d2ee523a2206206994597c13d831ec7",s.METABRIDGE_ETHEREUM_ADDRESS="0x0439e60F02a8900a951603950d8D4527f400C3f1",s.BRIDGE_QUOTE_MAX_ETA_SECONDS=3600,s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=.5,s.BRIDGE_PREFERRED_GAS_ESTIMATE="medium",s.BRIDGE_MM_FEE_RATE=.875,s.REFRESH_INTERVAL_MS=3e4,s.DEFAULT_MAX_REFRESH_COUNT=5,s.BRIDGE_CONTROLLER_NAME="BridgeController",s.DEFAULT_CHAIN_RANKING=[{chainId:"eip155:1",name:"Ethereum"},{chainId:"eip155:56",name:"BNB"},{chainId:"bip122:000000000019d6689c085ae165831e93",name:"BTC"},{chainId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana"},{chainId:"tron:728126428",name:"Tron"},{chainId:"eip155:8453",name:"Base"},{chainId:"eip155:42161",name:"Arbitrum"},{chainId:"eip155:59144",name:"Linea"},{chainId:"eip155:137",name:"Polygon"},{chainId:"eip155:43114",name:"Avalanche"},{chainId:"eip155:10",name:"Optimism"},{chainId:"eip155:143",name:"Monad"},{chainId:"eip155:1329",name:"Sei"},{chainId:"eip155:999",name:"HyperEVM"},{chainId:"eip155:4326",name:"MegaETH"},{chainId:"eip155:324",name:"zkSync"}],s.DEFAULT_FEATURE_FLAG_CONFIG={minimumVersion:"0.0.0",refreshRate:s.REFRESH_INTERVAL_MS,maxRefreshCount:s.DEFAULT_MAX_REFRESH_COUNT,support:!1,chains:{},chainRanking:[...s.DEFAULT_CHAIN_RANKING]},s.DEFAULT_BRIDGE_CONTROLLER_STATE={quoteRequest:{srcTokenAddress:n.AddressZero},quotesInitialLoadTime:null,quotes:[],quotesLastFetched:null,quotesLoadingStatus:null,quoteFetchError:null,quotesRefreshCount:0,assetExchangeRates:{},minimumBalanceForRentExemptionInLamports:"0"},s.METABRIDGE_CHAIN_TO_ADDRESS_MAP={[r.CHAIN_IDS.MAINNET]:s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.NETWORK_TO_NAME_MAP=s.MEGAETH_DISPLAY_NAME=s.HYPEREVM_DISPLAY_NAME=s.MONAD_DISPLAY_NAME=s.SEI_DISPLAY_NAME=s.MODE_DISPLAY_NAME=s.MODE_SEPOLIA_DISPLAY_NAME=s.SONEIUM_DISPLAY_NAME=s.INK_DISPLAY_NAME=s.INK_SEPOLIA_DISPLAY_NAME=s.LISK_SEPOLIA_DISPLAY_NAME=s.LISK_DISPLAY_NAME=s.METACHAIN_ONE_DISPLAY_NAME=s.BERACHAIN_DISPLAY_NAME=s.OP_BNB_DISPLAY_NAME=s.SCROLL_SEPOLIA_DISPLAY_NAME=s.SCROLL_DISPLAY_NAME=s.MOONRIVER_DISPLAY_NAME=s.MOONBEAM_DISPLAY_NAME=s.POLYGON_ZKEVM_DISPLAY_NAME=s.CRONOS_DISPLAY_NAME=s.AURORA_DISPLAY_NAME=s.BASE_DISPLAY_NAME=s.ZK_SYNC_ERA_DISPLAY_NAME=s.GNOSIS_DISPLAY_NAME=s.CELO_DISPLAY_NAME=s.PALM_DISPLAY_NAME=s.HARMONY_DISPLAY_NAME=s.FANTOM_DISPLAY_NAME=s.OPTIMISM_DISPLAY_NAME=s.BNB_DISPLAY_NAME=s.ARBITRUM_DISPLAY_NAME=s.AVALANCHE_DISPLAY_NAME=s.POLYGON_DISPLAY_NAME=s.BSC_DISPLAY_NAME=s.LOCALHOST_DISPLAY_NAME=s.LINEA_MAINNET_DISPLAY_NAME=s.LINEA_SEPOLIA_DISPLAY_NAME=s.LINEA_GOERLI_DISPLAY_NAME=s.SEPOLIA_DISPLAY_NAME=s.GOERLI_DISPLAY_NAME=s.MAINNET_DISPLAY_NAME=s.NETWORK_TYPES=s.CHAIN_IDS=void 0,s.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",HYPEREVM:"0x3e7",MEGAETH:"0x10e6"},s.NETWORK_TYPES={GOERLI:"goerli",LOCALHOST:"localhost",MAINNET:"mainnet",SEPOLIA:"sepolia",LINEA_GOERLI:"linea-goerli",LINEA_SEPOLIA:"linea-sepolia",LINEA_MAINNET:"linea-mainnet"},s.MAINNET_DISPLAY_NAME="Ethereum Mainnet",s.GOERLI_DISPLAY_NAME="Goerli",s.SEPOLIA_DISPLAY_NAME="Sepolia",s.LINEA_GOERLI_DISPLAY_NAME="Linea Goerli",s.LINEA_SEPOLIA_DISPLAY_NAME="Linea Sepolia",s.LINEA_MAINNET_DISPLAY_NAME="Linea Mainnet",s.LOCALHOST_DISPLAY_NAME="Localhost 8545",s.BSC_DISPLAY_NAME="Binance Smart Chain",s.POLYGON_DISPLAY_NAME="Polygon",s.AVALANCHE_DISPLAY_NAME="Avalanche Network C-Chain",s.ARBITRUM_DISPLAY_NAME="Arbitrum One",s.BNB_DISPLAY_NAME="BNB Chain",s.OPTIMISM_DISPLAY_NAME="OP Mainnet",s.FANTOM_DISPLAY_NAME="Fantom Opera",s.HARMONY_DISPLAY_NAME="Harmony Mainnet Shard 0",s.PALM_DISPLAY_NAME="Palm",s.CELO_DISPLAY_NAME="Celo Mainnet",s.GNOSIS_DISPLAY_NAME="Gnosis",s.ZK_SYNC_ERA_DISPLAY_NAME="zkSync Era Mainnet",s.BASE_DISPLAY_NAME="Base Mainnet",s.AURORA_DISPLAY_NAME="Aurora Mainnet",s.CRONOS_DISPLAY_NAME="Cronos",s.POLYGON_ZKEVM_DISPLAY_NAME="Polygon zkEVM",s.MOONBEAM_DISPLAY_NAME="Moonbeam",s.MOONRIVER_DISPLAY_NAME="Moonriver",s.SCROLL_DISPLAY_NAME="Scroll",s.SCROLL_SEPOLIA_DISPLAY_NAME="Scroll Sepolia",s.OP_BNB_DISPLAY_NAME="opBNB",s.BERACHAIN_DISPLAY_NAME="Berachain Artio",s.METACHAIN_ONE_DISPLAY_NAME="Metachain One Mainnet",s.LISK_DISPLAY_NAME="Lisk",s.LISK_SEPOLIA_DISPLAY_NAME="Lisk Sepolia",s.INK_SEPOLIA_DISPLAY_NAME="Ink Sepolia",s.INK_DISPLAY_NAME="Ink Mainnet",s.SONEIUM_DISPLAY_NAME="Soneium Mainnet",s.MODE_SEPOLIA_DISPLAY_NAME="Mode Sepolia",s.MODE_DISPLAY_NAME="Mode Mainnet",s.SEI_DISPLAY_NAME="Sei Network",s.MONAD_DISPLAY_NAME="Monad",s.HYPEREVM_DISPLAY_NAME="HyperEVM",s.MEGAETH_DISPLAY_NAME="MegaETH",s.NETWORK_TO_NAME_MAP={[s.NETWORK_TYPES.GOERLI]:s.GOERLI_DISPLAY_NAME,[s.NETWORK_TYPES.MAINNET]:s.MAINNET_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_GOERLI]:s.LINEA_GOERLI_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_SEPOLIA]:s.LINEA_SEPOLIA_DISPLAY_NAME,[s.NETWORK_TYPES.LINEA_MAINNET]:s.LINEA_MAINNET_DISPLAY_NAME,[s.NETWORK_TYPES.LOCALHOST]:s.LOCALHOST_DISPLAY_NAME,[s.NETWORK_TYPES.SEPOLIA]:s.SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.ARBITRUM]:s.ARBITRUM_DISPLAY_NAME,[s.CHAIN_IDS.AVALANCHE]:s.AVALANCHE_DISPLAY_NAME,[s.CHAIN_IDS.BSC]:s.BSC_DISPLAY_NAME,[s.CHAIN_IDS.BASE]:s.BASE_DISPLAY_NAME,[s.CHAIN_IDS.GOERLI]:s.GOERLI_DISPLAY_NAME,[s.CHAIN_IDS.MAINNET]:s.MAINNET_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_GOERLI]:s.LINEA_GOERLI_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_MAINNET]:s.LINEA_MAINNET_DISPLAY_NAME,[s.CHAIN_IDS.LINEA_SEPOLIA]:s.LINEA_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.LOCALHOST]:s.LOCALHOST_DISPLAY_NAME,[s.CHAIN_IDS.OPTIMISM]:s.OPTIMISM_DISPLAY_NAME,[s.CHAIN_IDS.POLYGON]:s.POLYGON_DISPLAY_NAME,[s.CHAIN_IDS.SCROLL]:s.SCROLL_DISPLAY_NAME,[s.CHAIN_IDS.SCROLL_SEPOLIA]:s.SCROLL_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.SEPOLIA]:s.SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.OPBNB]:s.OP_BNB_DISPLAY_NAME,[s.CHAIN_IDS.ZKSYNC_ERA]:s.ZK_SYNC_ERA_DISPLAY_NAME,[s.CHAIN_IDS.BERACHAIN]:s.BERACHAIN_DISPLAY_NAME,[s.CHAIN_IDS.METACHAIN_ONE]:s.METACHAIN_ONE_DISPLAY_NAME,[s.CHAIN_IDS.LISK]:s.LISK_DISPLAY_NAME,[s.CHAIN_IDS.LISK_SEPOLIA]:s.LISK_SEPOLIA_DISPLAY_NAME,[s.CHAIN_IDS.SEI]:s.SEI_DISPLAY_NAME,[s.CHAIN_IDS.MONAD]:s.MONAD_DISPLAY_NAME,[s.CHAIN_IDS.HYPEREVM]:s.HYPEREVM_DISPLAY_NAME,[s.CHAIN_IDS.MEGAETH]:s.MEGAETH_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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ALLOWED_CONTRACT_ADDRESSES=s.SWAPS_WRAPPED_TOKENS_ADDRESSES=s.SWAPS_CONTRACT_ADDRESSES=s.SWAPS_API_V2_BASE_URL=void 0;const n=e("./chains.cjs");s.SWAPS_API_V2_BASE_URL="https://swap.api.cx.metamask.io";const a="0x881d40237659c251811cec9c364ef91dc08d300c";s.SWAPS_CONTRACT_ADDRESSES={[n.CHAIN_IDS.MAINNET]:a,[n.CHAIN_IDS.LOCALHOST]:a,[n.CHAIN_IDS.BSC]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.POLYGON]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.AVALANCHE]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[n.CHAIN_IDS.ARBITRUM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.OPTIMISM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.ZKSYNC_ERA]:"0xf504c1fe13d14df615e66dcd0abf39e60c697f34",[n.CHAIN_IDS.LINEA_MAINNET]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.BASE]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[n.CHAIN_IDS.SEI]:"0x962287c9d5B8a682389E61edAE90ec882325d08b"};const r="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";s.SWAPS_WRAPPED_TOKENS_ADDRESSES={[n.CHAIN_IDS.MAINNET]:r,[n.CHAIN_IDS.LOCALHOST]:r,[n.CHAIN_IDS.BSC]:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",[n.CHAIN_IDS.POLYGON]:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",[n.CHAIN_IDS.AVALANCHE]:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",[n.CHAIN_IDS.ARBITRUM]:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",[n.CHAIN_IDS.OPTIMISM]:"0x4200000000000000000000000000000000000006",[n.CHAIN_IDS.ZKSYNC_ERA]:"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",[n.CHAIN_IDS.LINEA_MAINNET]:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",[n.CHAIN_IDS.BASE]:"0x4200000000000000000000000000000000000006",[n.CHAIN_IDS.SEI]:"0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7"},s.ALLOWED_CONTRACT_ADDRESSES={[n.CHAIN_IDS.MAINNET]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.MAINNET],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.MAINNET]],[n.CHAIN_IDS.LOCALHOST]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.LOCALHOST],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.LOCALHOST]],[n.CHAIN_IDS.BSC]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.BSC],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.BSC]],[n.CHAIN_IDS.POLYGON]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.POLYGON],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.POLYGON]],[n.CHAIN_IDS.AVALANCHE]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.AVALANCHE],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.AVALANCHE]],[n.CHAIN_IDS.ARBITRUM]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.ARBITRUM],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.ARBITRUM]],[n.CHAIN_IDS.OPTIMISM]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.OPTIMISM],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.OPTIMISM]],[n.CHAIN_IDS.ZKSYNC_ERA]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.ZKSYNC_ERA],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.ZKSYNC_ERA]],[n.CHAIN_IDS.LINEA_MAINNET]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.LINEA_MAINNET],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.LINEA_MAINNET]],[n.CHAIN_IDS.BASE]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.BASE],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.CHAIN_IDS.BASE]],[n.CHAIN_IDS.SEI]:[s.SWAPS_CONTRACT_ADDRESSES[n.CHAIN_IDS.SEI],s.SWAPS_WRAPPED_TOKENS_ADDRESSES[n.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SYMBOL_TO_SLIP44_MAP=s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=s.DEFAULT_TOKEN_ADDRESS=void 0;const n=e("@metamask/keyring-api"),a=e("./chains.cjs");s.DEFAULT_TOKEN_ADDRESS="0x0000000000000000000000000000000000000000";const r="AVAX",i="BNB",o="ETH",c="POL",d="TESTETH",l="SOL",m="SEI",u="BTC",h="TRX",f="MON",p="HYPE",g={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},k={symbol:i,name:"Binance Coin",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},b={symbol:c,name:"Polygon",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},w={symbol:r,name:"Avalanche",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},_={symbol:d,name:"Test Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},T={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},E={symbol:o,name:"Ether",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},S={...g},I={...g},A={...g},y={...g},x={...g},v={symbol:l,name:"Solana",address:s.DEFAULT_TOKEN_ADDRESS,decimals:9,iconUrl:""},C={symbol:u,name:"Bitcoin",address:s.DEFAULT_TOKEN_ADDRESS,decimals:8,iconUrl:""},j={symbol:m,name:"Sei",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},P={symbol:h,name:"Tron",address:s.DEFAULT_TOKEN_ADDRESS,decimals:6,iconUrl:""},D={symbol:f,name:"Mon",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},N={symbol:p,name:"Hyperliquid",address:s.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},R={...g};s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP={[a.CHAIN_IDS.MAINNET]:g,[a.CHAIN_IDS.LOCALHOST]:_,[a.CHAIN_IDS.BSC]:k,[a.CHAIN_IDS.POLYGON]:b,[a.CHAIN_IDS.GOERLI]:T,[a.CHAIN_IDS.SEPOLIA]:E,[a.CHAIN_IDS.AVALANCHE]:w,[a.CHAIN_IDS.OPTIMISM]:I,[a.CHAIN_IDS.ARBITRUM]:S,[a.CHAIN_IDS.ZKSYNC_ERA]:A,[a.CHAIN_IDS.LINEA_MAINNET]:y,[a.CHAIN_IDS.BASE]:x,[a.CHAIN_IDS.SEI]:j,[a.CHAIN_IDS.MONAD]:D,[a.CHAIN_IDS.HYPEREVM]:N,[a.CHAIN_IDS.MEGAETH]:R,[n.SolScope.Mainnet]:v,[n.SolScope.Devnet]:v,[n.BtcScope.Mainnet]:C,[n.TrxScope.Mainnet]:P},s.SYMBOL_TO_SLIP44_MAP={SOL:"slip44:501",BTC:"slip44:0",ETH:"slip44:60",POL:"slip44:966",BNB:"slip44:714",AVAX:"slip44:9005",TESTETH:"slip44:60",SEI:"slip44:19000118",TRX:"slip44:195",MON:"slip44:268435779",HYPE:"slip44:2457"}}}},{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,s){var n;Object.defineProperty(s,"__esModule",{value:!0}),s.TraceName=void 0,function(e){e.BridgeQuotesFetched="Bridge Quotes Fetched",e.SwapQuotesFetched="Swap Quotes Fetched"}(n||(s.TraceName=n={}))}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isNonEvmChainId=s.isTronChainId=s.isBitcoinChainId=s.isSolanaChainId=s.isNativeAddress=s.isEthUsdt=s.MetricsSwapType=s.MetricsActionType=s.ALLOWED_CONTRACT_ADDRESSES=s.SWAPS_WRAPPED_TOKENS_ADDRESSES=s.SWAPS_CONTRACT_ADDRESSES=s.SWAPS_API_V2_BASE_URL=s.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=s.BRIDGE_PROD_API_BASE_URL=s.BRIDGE_DEV_API_BASE_URL=s.METABRIDGE_CHAIN_TO_ADDRESS_MAP=s.DEFAULT_BRIDGE_CONTROLLER_STATE=s.DEFAULT_MAX_REFRESH_COUNT=s.REFRESH_INTERVAL_MS=s.BRIDGE_MM_FEE_RATE=s.BRIDGE_PREFERRED_GAS_ESTIMATE=s.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=s.BRIDGE_QUOTE_MAX_ETA_SECONDS=s.BRIDGE_CONTROLLER_NAME=s.BridgeClientId=s.ALLOWED_BRIDGE_CHAIN_IDS=s.FeatureId=s.BridgeAssetSchema=s.ActionTypes=s.FeeType=s.BridgeBackgroundAction=s.BridgeUserAction=s.RequestStatus=s.ChainId=s.SortOrder=s.AssetType=s.StatusTypes=s.AbortReason=s.getQuotesReceivedProperties=s.isCustomSlippage=s.isHardwareWallet=s.getSwapType=s.getRequestParams=s.formatProviderLabel=s.PollingStatus=s.MetaMetricsSwapsEventSource=s.InputAmountPreset=s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=s.UnifiedSwapBridgeEventName=s.BridgeController=void 0,s.fetchTokens=s.getSwapsContractAddress=s.isValidSwapsContractAddress=s.BRIDGE_DEFAULT_SLIPPAGE=s.getBridgeFeatureFlags=s.DEFAULT_FEATURE_FLAG_CONFIG=s.selectMinimumBalanceForRentExemptionInSOL=s.selectBridgeFeatureFlags=s.selectIsQuoteExpired=s.selectExchangeRateByChainIdAndAddress=s.selectDefaultSlippagePercentage=s.selectBridgeQuotes=s.isEvmTxData=s.isTronTrade=s.isBitcoinTrade=s.extractTradeData=s.formatAddressToAssetId=s.formatAddressToCaipReference=s.formatChainIdToHex=s.formatChainIdToCaip=s.getClientHeaders=s.fetchBridgeTokens=s.calcLatestSrcBalance=s.calcSlippagePercentage=s.formatEtaInMinutes=s.isValidQuoteRequest=s.isCrossChain=s.getDefaultBridgeControllerState=s.getNativeAssetForChainId=void 0;var n=e("./bridge-controller.cjs");Object.defineProperty(s,"BridgeController",{enumerable:!0,get:function(){return n.BridgeController}});var a=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"UnifiedSwapBridgeEventName",{enumerable:!0,get:function(){return a.UnifiedSwapBridgeEventName}}),Object.defineProperty(s,"UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY",{enumerable:!0,get:function(){return a.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY}}),Object.defineProperty(s,"InputAmountPreset",{enumerable:!0,get:function(){return a.InputAmountPreset}}),Object.defineProperty(s,"MetaMetricsSwapsEventSource",{enumerable:!0,get:function(){return a.MetaMetricsSwapsEventSource}}),Object.defineProperty(s,"PollingStatus",{enumerable:!0,get:function(){return a.PollingStatus}});var r=e("./utils/metrics/properties.cjs");Object.defineProperty(s,"formatProviderLabel",{enumerable:!0,get:function(){return r.formatProviderLabel}}),Object.defineProperty(s,"getRequestParams",{enumerable:!0,get:function(){return r.getRequestParams}}),Object.defineProperty(s,"getSwapType",{enumerable:!0,get:function(){return r.getSwapType}}),Object.defineProperty(s,"isHardwareWallet",{enumerable:!0,get:function(){return r.isHardwareWallet}}),Object.defineProperty(s,"isCustomSlippage",{enumerable:!0,get:function(){return r.isCustomSlippage}}),Object.defineProperty(s,"getQuotesReceivedProperties",{enumerable:!0,get:function(){return r.getQuotesReceivedProperties}});var i=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"AbortReason",{enumerable:!0,get:function(){return i.AbortReason}});var o=e("./types.cjs");Object.defineProperty(s,"StatusTypes",{enumerable:!0,get:function(){return o.StatusTypes}});var c=e("./types.cjs");Object.defineProperty(s,"AssetType",{enumerable:!0,get:function(){return c.AssetType}}),Object.defineProperty(s,"SortOrder",{enumerable:!0,get:function(){return c.SortOrder}}),Object.defineProperty(s,"ChainId",{enumerable:!0,get:function(){return c.ChainId}}),Object.defineProperty(s,"RequestStatus",{enumerable:!0,get:function(){return c.RequestStatus}}),Object.defineProperty(s,"BridgeUserAction",{enumerable:!0,get:function(){return c.BridgeUserAction}}),Object.defineProperty(s,"BridgeBackgroundAction",{enumerable:!0,get:function(){return c.BridgeBackgroundAction}});var d=e("./utils/validators.cjs");Object.defineProperty(s,"FeeType",{enumerable:!0,get:function(){return d.FeeType}}),Object.defineProperty(s,"ActionTypes",{enumerable:!0,get:function(){return d.ActionTypes}}),Object.defineProperty(s,"BridgeAssetSchema",{enumerable:!0,get:function(){return d.BridgeAssetSchema}}),Object.defineProperty(s,"FeatureId",{enumerable:!0,get:function(){return d.FeatureId}});var l=e("./constants/bridge.cjs");Object.defineProperty(s,"ALLOWED_BRIDGE_CHAIN_IDS",{enumerable:!0,get:function(){return l.ALLOWED_BRIDGE_CHAIN_IDS}}),Object.defineProperty(s,"BridgeClientId",{enumerable:!0,get:function(){return l.BridgeClientId}}),Object.defineProperty(s,"BRIDGE_CONTROLLER_NAME",{enumerable:!0,get:function(){return l.BRIDGE_CONTROLLER_NAME}}),Object.defineProperty(s,"BRIDGE_QUOTE_MAX_ETA_SECONDS",{enumerable:!0,get:function(){return l.BRIDGE_QUOTE_MAX_ETA_SECONDS}}),Object.defineProperty(s,"BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE",{enumerable:!0,get:function(){return l.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE}}),Object.defineProperty(s,"BRIDGE_PREFERRED_GAS_ESTIMATE",{enumerable:!0,get:function(){return l.BRIDGE_PREFERRED_GAS_ESTIMATE}}),Object.defineProperty(s,"BRIDGE_MM_FEE_RATE",{enumerable:!0,get:function(){return l.BRIDGE_MM_FEE_RATE}}),Object.defineProperty(s,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return l.REFRESH_INTERVAL_MS}}),Object.defineProperty(s,"DEFAULT_MAX_REFRESH_COUNT",{enumerable:!0,get:function(){return l.DEFAULT_MAX_REFRESH_COUNT}}),Object.defineProperty(s,"DEFAULT_BRIDGE_CONTROLLER_STATE",{enumerable:!0,get:function(){return l.DEFAULT_BRIDGE_CONTROLLER_STATE}}),Object.defineProperty(s,"METABRIDGE_CHAIN_TO_ADDRESS_MAP",{enumerable:!0,get:function(){return l.METABRIDGE_CHAIN_TO_ADDRESS_MAP}}),Object.defineProperty(s,"BRIDGE_DEV_API_BASE_URL",{enumerable:!0,get:function(){return l.BRIDGE_DEV_API_BASE_URL}}),Object.defineProperty(s,"BRIDGE_PROD_API_BASE_URL",{enumerable:!0,get:function(){return l.BRIDGE_PROD_API_BASE_URL}});var m=e("./constants/tokens.cjs");Object.defineProperty(s,"SWAPS_CHAINID_DEFAULT_TOKEN_MAP",{enumerable:!0,get:function(){return m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP}});var u=e("./constants/swaps.cjs");Object.defineProperty(s,"SWAPS_API_V2_BASE_URL",{enumerable:!0,get:function(){return u.SWAPS_API_V2_BASE_URL}}),Object.defineProperty(s,"SWAPS_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return u.SWAPS_CONTRACT_ADDRESSES}}),Object.defineProperty(s,"SWAPS_WRAPPED_TOKENS_ADDRESSES",{enumerable:!0,get:function(){return u.SWAPS_WRAPPED_TOKENS_ADDRESSES}}),Object.defineProperty(s,"ALLOWED_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return u.ALLOWED_CONTRACT_ADDRESSES}});var h=e("./utils/metrics/constants.cjs");Object.defineProperty(s,"MetricsActionType",{enumerable:!0,get:function(){return h.MetricsActionType}}),Object.defineProperty(s,"MetricsSwapType",{enumerable:!0,get:function(){return h.MetricsSwapType}});var f=e("./utils/bridge.cjs");Object.defineProperty(s,"isEthUsdt",{enumerable:!0,get:function(){return f.isEthUsdt}}),Object.defineProperty(s,"isNativeAddress",{enumerable:!0,get:function(){return f.isNativeAddress}}),Object.defineProperty(s,"isSolanaChainId",{enumerable:!0,get:function(){return f.isSolanaChainId}}),Object.defineProperty(s,"isBitcoinChainId",{enumerable:!0,get:function(){return f.isBitcoinChainId}}),Object.defineProperty(s,"isTronChainId",{enumerable:!0,get:function(){return f.isTronChainId}}),Object.defineProperty(s,"isNonEvmChainId",{enumerable:!0,get:function(){return f.isNonEvmChainId}}),Object.defineProperty(s,"getNativeAssetForChainId",{enumerable:!0,get:function(){return f.getNativeAssetForChainId}}),Object.defineProperty(s,"getDefaultBridgeControllerState",{enumerable:!0,get:function(){return f.getDefaultBridgeControllerState}}),Object.defineProperty(s,"isCrossChain",{enumerable:!0,get:function(){return f.isCrossChain}});var p=e("./utils/quote.cjs");Object.defineProperty(s,"isValidQuoteRequest",{enumerable:!0,get:function(){return p.isValidQuoteRequest}}),Object.defineProperty(s,"formatEtaInMinutes",{enumerable:!0,get:function(){return p.formatEtaInMinutes}}),Object.defineProperty(s,"calcSlippagePercentage",{enumerable:!0,get:function(){return p.calcSlippagePercentage}});var g=e("./utils/balance.cjs");Object.defineProperty(s,"calcLatestSrcBalance",{enumerable:!0,get:function(){return g.calcLatestSrcBalance}});var k=e("./utils/fetch.cjs");Object.defineProperty(s,"fetchBridgeTokens",{enumerable:!0,get:function(){return k.fetchBridgeTokens}}),Object.defineProperty(s,"getClientHeaders",{enumerable:!0,get:function(){return k.getClientHeaders}});var b=e("./utils/caip-formatters.cjs");Object.defineProperty(s,"formatChainIdToCaip",{enumerable:!0,get:function(){return b.formatChainIdToCaip}}),Object.defineProperty(s,"formatChainIdToHex",{enumerable:!0,get:function(){return b.formatChainIdToHex}}),Object.defineProperty(s,"formatAddressToCaipReference",{enumerable:!0,get:function(){return b.formatAddressToCaipReference}}),Object.defineProperty(s,"formatAddressToAssetId",{enumerable:!0,get:function(){return b.formatAddressToAssetId}});var w=e("./utils/trade-utils.cjs");Object.defineProperty(s,"extractTradeData",{enumerable:!0,get:function(){return w.extractTradeData}}),Object.defineProperty(s,"isBitcoinTrade",{enumerable:!0,get:function(){return w.isBitcoinTrade}}),Object.defineProperty(s,"isTronTrade",{enumerable:!0,get:function(){return w.isTronTrade}}),Object.defineProperty(s,"isEvmTxData",{enumerable:!0,get:function(){return w.isEvmTxData}});var _=e("./selectors.cjs");Object.defineProperty(s,"selectBridgeQuotes",{enumerable:!0,get:function(){return _.selectBridgeQuotes}}),Object.defineProperty(s,"selectDefaultSlippagePercentage",{enumerable:!0,get:function(){return _.selectDefaultSlippagePercentage}}),Object.defineProperty(s,"selectExchangeRateByChainIdAndAddress",{enumerable:!0,get:function(){return _.selectExchangeRateByChainIdAndAddress}}),Object.defineProperty(s,"selectIsQuoteExpired",{enumerable:!0,get:function(){return _.selectIsQuoteExpired}}),Object.defineProperty(s,"selectBridgeFeatureFlags",{enumerable:!0,get:function(){return _.selectBridgeFeatureFlags}}),Object.defineProperty(s,"selectMinimumBalanceForRentExemptionInSOL",{enumerable:!0,get:function(){return _.selectMinimumBalanceForRentExemptionInSOL}});var T=e("./constants/bridge.cjs");Object.defineProperty(s,"DEFAULT_FEATURE_FLAG_CONFIG",{enumerable:!0,get:function(){return T.DEFAULT_FEATURE_FLAG_CONFIG}});var E=e("./utils/feature-flags.cjs");Object.defineProperty(s,"getBridgeFeatureFlags",{enumerable:!0,get:function(){return E.getBridgeFeatureFlags}});var S=e("./utils/slippage.cjs");Object.defineProperty(s,"BRIDGE_DEFAULT_SLIPPAGE",{enumerable:!0,get:function(){return S.BRIDGE_DEFAULT_SLIPPAGE}});var I=e("./utils/swaps.cjs");Object.defineProperty(s,"isValidSwapsContractAddress",{enumerable:!0,get:function(){return I.isValidSwapsContractAddress}}),Object.defineProperty(s,"getSwapsContractAddress",{enumerable:!0,get:function(){return I.getSwapsContractAddress}}),Object.defineProperty(s,"fetchTokens",{enumerable:!0,get:function(){return I.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.selectDefaultSlippagePercentage=s.selectMinimumBalanceForRentExemptionInSOL=s.selectBridgeQuotes=s.selectIsQuoteExpired=s.selectIsAssetExchangeRateInState=s.selectExchangeRateByChainIdAndAddress=s.selectBridgeFeatureFlags=void 0;const n=e("@ethersproject/constants"),a=e("@metamask/utils"),r=e("bignumber.js"),i=e("lodash"),o=e("reselect"),c=e("./constants/bridge.cjs"),d=e("./types.cjs"),l=e("./utils/bridge.cjs"),m=e("./utils/caip-formatters.cjs"),u=e("./utils/feature-flags.cjs"),h=e("./utils/quote.cjs"),f=e("./utils/slippage.cjs"),p=o.createStructuredSelector.withTypes(),g=o.createSelector.withTypes(),k=o.createSelector.withTypes();s.selectBridgeFeatureFlags=k([e=>e.remoteFeatureFlags.bridgeConfig],e=>(0,u.processFeatureFlags)(e));const b=(e,t,s)=>{if(!t)return{};const n=(0,m.formatAddressToCaipReference)(s??""),i=(0,m.formatAddressToAssetId)(n,t);if(!i)return{};const{assetExchangeRates:o,currencyRates:c,marketData:d,conversionRates:u}=e,h=o?.[i.toLowerCase()]??o?.[i];if(h?.exchangeRate&&h?.usdExchangeRate)return h;if((0,l.isNonEvmChainId)(t)){const e=u,t=e?.[i],s=t?.rate;if(s){const e=Object.values(c??{}).find(e=>e?.conversionRate!==undefined&&null!==e?.conversionRate&&e?.usdConversionRate!==undefined&&null!==e?.usdConversionRate),t=e?.conversionRate!==undefined&&null!==e?.conversionRate&&e?.usdConversionRate!==undefined&&null!==e?.usdConversionRate?new r.BigNumber(e.usdConversionRate).div(e.conversionRate):undefined;return{exchangeRate:s,usdExchangeRate:t?new r.BigNumber(s).times(t).toString():undefined}}return{}}if((0,l.isNativeAddress)(n)){const{symbol:e}=(0,l.getNativeAssetForChainId)(t),s=c?.[e];return s?{exchangeRate:s.conversionRate?.toString(),usdExchangeRate:s.usdConversionRate?.toString()}:{}}if(!(0,l.isNonEvmChainId)(t)){const e=(d??{})[(0,m.formatChainIdToHex)(t)],s=(0,a.isStrictHexString)(n)?e?.[n]:null,i=s?.currency,o=i!==undefined&&null!==i?c?.[i]:undefined,l=s?.price??0;if(s&&o)return{exchangeRate:new r.BigNumber(l).multipliedBy(o.conversionRate??0).toString(),usdExchangeRate:new r.BigNumber(l).multipliedBy(o.usdConversionRate??0).toString()}}return{}};s.selectExchangeRateByChainIdAndAddress=(e,t,s)=>b(e,t,s);s.selectIsAssetExchangeRateInState=(...e)=>Boolean(b(...e)?.exchangeRate)&&Boolean(b(...e)?.usdExchangeRate);const w=g([e=>e.gasFeeEstimatesByChainId,e=>e.quotes?.[0]?.quote.srcChainId],(e,t)=>{if(!t)return null;if((0,l.isNonEvmChainId)(t))return null;const s=e?.[(0,m.formatChainIdToHex)(t)]?.gasFeeEstimates;return s?{estimatedBaseFeeInDecGwei:s.estimatedBaseFee,feePerGasInDecGwei:s[c.BRIDGE_PREFERRED_GAS_ESTIMATE]?.suggestedMaxFeePerGas,maxFeePerGasInDecGwei:s.high?.suggestedMaxFeePerGas}:null}),_=g([({quotes:e})=>e,w,g([e=>e,({quoteRequest:{srcChainId:e}})=>e,({quoteRequest:{srcTokenAddress:e}})=>e],s.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{destChainId:e}})=>e,({quoteRequest:{destTokenAddress:e}})=>e],s.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{srcChainId:e}})=>e],(e,t)=>(0,s.selectExchangeRateByChainIdAndAddress)(e,t,n.AddressZero))],(e,t,s,n,a)=>e.map(e=>{const r=(0,h.calcSentAmount)(e.quote,s),i=(0,h.calcToAmount)(e.quote.destTokenAmount,e.quote.destAsset,n),o=(0,h.calcToAmount)(e.quote.minDestTokenAmount,e.quote.destAsset,n),c=(0,h.calcIncludedTxFees)(e.quote,s,n);let d,m,u,f;(0,l.isEvmQuoteResponse)(e)?(u=(0,h.calcRelayerFee)(e,a),f=(0,h.calcEstimatedAndMaxTotalGasFee)({bridgeQuote:e,...t,...a}),d=(0,h.calcTotalEstimatedNetworkFee)(f,u),m=(0,h.calcTotalMaxNetworkFee)(f,u)):(d=(0,h.calcNonEvmTotalNetworkFee)(e,a),f={effective:d,total:d,max:d},m=d);const p=(0,h.calcAdjustedReturn)(i,d,e.quote),g=(0,h.calcCost)(p,r);return{...e,sentAmount:r,toTokenAmount:i,minToTokenAmount:o,swapRate:(0,h.calcSwapRate)(r.amount,i.amount),totalNetworkFee:d,totalMaxNetworkFee:m,gasFee:f,adjustedReturn:p,cost:g,includedTxFees:c}})),T=g([_,(e,{sortOrder:t})=>t],(e,t)=>t===d.SortOrder.ETA_ASC?(0,i.orderBy)(e,e=>e.estimatedProcessingTimeInSeconds,"asc"):e.every(e=>e.cost.valueInCurrency)?(0,i.orderBy)(e,({cost:e})=>Number(e.valueInCurrency),"asc"):e.every(e=>e.quote.priceData?.priceImpact)?(0,i.orderBy)(e,({quote:e})=>Number(e.priceData?.priceImpact),"asc"):(0,i.orderBy)(e,({quote:e})=>Number(e.destTokenAmount),"desc")),E=g([T],e=>e.length>0?e[0]:null),S=g([E,T,(e,{selectedQuote:t})=>t],(e,t,s)=>t.find(e=>e.quote.requestId===s?.quote.requestId)??e),I=g([s.selectBridgeFeatureFlags,e=>e.quoteRequest.insufficientBal,e=>e.quotesRefreshCount],(e,t,s)=>!t&&e.maxRefreshCount>s),A=g([s.selectBridgeFeatureFlags,e=>e.quoteRequest.srcChainId],(e,t)=>(t?e.chains[(0,m.formatChainIdToCaip)(t)]?.refreshRate:e.refreshRate)??e.refreshRate);s.selectIsQuoteExpired=g([I,({quotesLastFetched:e})=>e,A,(e,t,s)=>s],(e,t,s,n)=>Boolean(!e&&t&&n-t>s)),s.selectBridgeQuotes=p({sortedQuotes:T,recommendedQuote:E,activeQuote:S,quotesLastFetchedMs:e=>e.quotesLastFetched,isLoading:e=>e.quotesLoadingStatus===d.RequestStatus.LOADING,quoteFetchError:e=>e.quoteFetchError,quotesRefreshCount:e=>e.quotesRefreshCount,quotesInitialLoadTimeMs:e=>e.quotesInitialLoadTime,isQuoteGoingToRefresh:I});s.selectMinimumBalanceForRentExemptionInSOL=e=>new r.BigNumber(e.minimumBalanceForRentExemptionInLamports??0).div(10**9).toString(),s.selectDefaultSlippagePercentage=g([e=>(0,s.selectBridgeFeatureFlags)(e).chains,(e,t)=>t.srcTokenAddress,(e,t)=>t.destTokenAddress,(e,t)=>t.srcChainId?(0,m.formatChainIdToCaip)(t.srcChainId):undefined,(e,t)=>t.destChainId?(0,m.formatChainIdToCaip)(t.destChainId):undefined],(e,t,s,n,a)=>(0,f.getDefaultSlippagePercentage)({srcTokenAddress:t,destTokenAddress:s,srcChainId:n,destChainId:a},n?e[n]?.stablecoins:undefined,a?e[a]?.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,s){var n,a,r,i,o,c,d;Object.defineProperty(s,"__esModule",{value:!0}),s.BridgeBackgroundAction=s.BridgeUserAction=s.RequestStatus=s.ChainId=s.StatusTypes=s.SortOrder=s.AssetType=void 0,function(e){e.native="NATIVE",e.token="TOKEN",e.NFT="NFT",e.unknown="UNKNOWN"}(n||(s.AssetType=n={})),function(e){e.COST_ASC="cost_ascending",e.ETA_ASC="time_descending"}(a||(s.SortOrder=a={})),function(e){e.SUBMITTED="SUBMITTED",e.UNKNOWN="UNKNOWN",e.FAILED="FAILED",e.PENDING="PENDING",e.COMPLETE="COMPLETE"}(r||(s.StatusTypes=r={})),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",e[e.HYPEREVM=999]="HYPEREVM",e[e.MEGAETH=4326]="MEGAETH"}(i||(s.ChainId=i={})),function(e){e[e.LOADING=0]="LOADING",e[e.FETCHED=1]="FETCHED",e[e.ERROR=2]="ERROR"}(o||(s.RequestStatus=o={})),function(e){e.SELECT_DEST_NETWORK="selectDestNetwork",e.UPDATE_QUOTE_PARAMS="updateBridgeQuoteRequestParams"}(c||(s.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||(s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.toExchangeRates=s.getAssetIdsForToken=void 0;const n=e("./bridge.cjs"),a=e("./caip-formatters.cjs");s.getAssetIdsForToken=(e,t)=>{const s=[],r=(0,a.formatAddressToAssetId)(e,t);return r&&(s.push(r),(0,n.getNativeAssetForChainId)(t)?.assetId&&s.push((0,n.getNativeAssetForChainId)(t).assetId)),s};s.toExchangeRates=(e,t)=>Object.entries(t).reduce((t,[s,n])=>(n&&(t[s]={exchangeRate:n[e],usdExchangeRate:n.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hasSufficientBalance=s.calcLatestSrcBalance=s.fetchTokenBalance=void 0;const n=e("@ethersproject/address"),a=e("@ethersproject/contracts"),r=e("@ethersproject/providers"),i=e("@metamask/metamask-eth-abis"),o=e("./bridge.cjs");s.fetchTokenBalance=async(e,t,s)=>{const n=new r.Web3Provider(s),o=new a.Contract(e,i.abiERC20,n),c="function"==typeof o?.balanceOf?o.balanceOf(t):Promise.resolve(undefined);return await c};s.calcLatestSrcBalance=async(e,t,a,i)=>{if(a&&i){if((0,o.isNativeAddress)(a)){const s=new r.Web3Provider(e);return await s.getBalance((0,n.getAddress)(t))}return await(0,s.fetchTokenBalance)(a,t,e)}return undefined};s.hasSufficientBalance=async(e,t,n,a,r)=>{const i=await(0,s.calcLatestSrcBalance)(e,t,n,r);return!!i&&i.gte(a)}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isEvmQuoteResponse=s.isNonEvmChainId=s.isTronChainId=s.isBitcoinChainId=s.isSolanaChainId=s.isNativeAddress=s.isSwapsDefaultTokenSymbol=s.isSwapsDefaultTokenAddress=s.sumHexes=s.isEthUsdt=s.getEthUsdtResetData=s.getNativeAssetForChainId=s.getDefaultBridgeControllerState=s.isCrossChain=void 0;const n=e("@ethersproject/constants"),a=e("@ethersproject/contracts"),r=e("@metamask/keyring-api"),i=e("@metamask/metamask-eth-abis"),o=e("@metamask/utils"),c=e("./caip-formatters.cjs"),d=e("../constants/bridge.cjs"),l=e("../constants/chains.cjs"),m=e("../constants/swaps.cjs"),u=e("../constants/tokens.cjs"),h=e("../types.cjs");s.isCrossChain=(e,t)=>{try{return!!t&&(0,c.formatChainIdToCaip)(e)!==(0,c.formatChainIdToCaip)(t)}catch{return!1}};s.getDefaultBridgeControllerState=()=>d.DEFAULT_BRIDGE_CONTROLLER_STATE;const f=(e,t)=>`${(0,c.formatChainIdToCaip)(e)}/${u.SYMBOL_TO_SLIP44_MAP[t]}`;s.getNativeAssetForChainId=e=>{const t=(0,c.formatChainIdToCaip)(e),s=u.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToCaip)(e)]??u.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToHex)(e)];if(!s)throw new Error(`No XChain Swaps native asset found for chainId: ${e}`);return{...s,chainId:(0,c.formatChainIdToDec)(e),assetId:f(t,s.symbol)}};s.getEthUsdtResetData=e=>{const t=(0,s.isCrossChain)(l.CHAIN_IDS.MAINNET,e)?d.METABRIDGE_ETHEREUM_ADDRESS:m.SWAPS_CONTRACT_ADDRESSES[l.CHAIN_IDS.MAINNET];return new a.Contract(d.ETH_USDT_ADDRESS,i.abiERC20).interface.encodeFunctionData("approve",[t,"0"])};s.isEthUsdt=(e,t)=>(0,c.formatChainIdToDec)(e)===h.ChainId.ETH&&t.toLowerCase()===d.ETH_USDT_ADDRESS.toLowerCase();s.sumHexes=(...e)=>{if(0===e.length)return"0x0";return`0x${e.reduce((e,t)=>e+BigInt(t),BigInt(0)).toString(16)}`};s.isSwapsDefaultTokenAddress=(e,t)=>!(!e||!t)&&e===(0,s.getNativeAssetForChainId)(t)?.address;s.isSwapsDefaultTokenSymbol=(e,t)=>!(!e||!t)&&e===(0,s.getNativeAssetForChainId)(t)?.symbol;s.isNativeAddress=e=>e===n.AddressZero||""===e||!e||!(0,o.isStrictHexString)(e)&&Object.values(u.SYMBOL_TO_SLIP44_MAP).some(t=>e.includes(t)||t.endsWith(e));s.isSolanaChainId=e=>(0,o.isCaipChainId)(e)?e===r.SolScope.Mainnet.toString():e.toString()===h.ChainId.SOLANA.toString();s.isBitcoinChainId=e=>(0,o.isCaipChainId)(e)?e===r.BtcScope.Mainnet.toString():e.toString()===h.ChainId.BTC.toString();s.isTronChainId=e=>(0,o.isCaipChainId)(e)?e===r.TrxScope.Mainnet.toString():e.toString()===h.ChainId.TRON.toString();s.isNonEvmChainId=e=>(0,s.isSolanaChainId)(e)||(0,s.isBitcoinChainId)(e)||(0,s.isTronChainId)(e);s.isEvmQuoteResponse=e=>!(0,s.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/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.formatAddressToAssetId=s.formatAddressToCaipReference=s.formatChainIdToHex=s.formatChainIdToDec=s.formatChainIdToCaip=void 0;const n=e("@ethersproject/address"),a=e("@ethersproject/constants"),r=e("@metamask/controller-utils"),i=e("@metamask/keyring-api"),o=e("@metamask/multichain-network-controller"),c=e("@metamask/utils"),d=e("./bridge.cjs"),l=e("../types.cjs");s.formatChainIdToCaip=e=>(0,c.isCaipChainId)(e)?e:(0,c.isStrictHexString)(e)?(0,o.toEvmCaipChainId)(e):(0,d.isSolanaChainId)(e)?i.SolScope.Mainnet:(0,d.isBitcoinChainId)(e)?i.BtcScope.Mainnet:(0,d.isTronChainId)(e)?i.TrxScope.Mainnet:(0,o.toEvmCaipChainId)((0,c.numberToHex)(Number(e)));s.formatChainIdToDec=e=>(0,c.isStrictHexString)(e)?(0,r.convertHexToDecimal)(e):e===i.SolScope.Mainnet?l.ChainId.SOLANA:e===i.BtcScope.Mainnet?l.ChainId.BTC:e===i.TrxScope.Mainnet?l.ChainId.TRON:(0,c.isCaipChainId)(e)?Number(e.split(":").at(-1)):"string"==typeof e?parseInt(e,10):e;s.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}`)};s.formatAddressToCaipReference=e=>{if((0,c.isStrictHexString)(e))return(0,n.getAddress)(e);if((0,d.isNativeAddress)(e))return a.AddressZero;const t=e.split(":").at(-1);if(!t)throw new Error("Invalid address");return t};s.formatAddressToAssetId=(e,t)=>{if((0,c.isCaipAssetType)(e))return e;if(!t)return undefined;const n=(0,s.formatChainIdToCaip)(t);if((0,d.isNativeAddress)(e))return(0,d.getNativeAssetForChainId)(n).assetId;if(n===i.SolScope.Mainnet)return c.CaipAssetTypeStruct.create(`${n}/token:${e}`);if(n===i.TrxScope.Mainnet)return c.CaipAssetTypeStruct.create(`${n}/trc20:${e}`);if(!(0,c.isStrictHexString)(e))return undefined;const a=(0,r.toChecksumHexAddress)(e);return c.CaipAssetTypeStruct.create(`${n}/erc20:${a}`)}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hasMinimumRequiredVersion=s.getBridgeFeatureFlags=s.processFeatureFlags=s.formatFeatureFlags=void 0;const n=e("./caip-formatters.cjs"),a=e("./validators.cjs"),r=e("../constants/bridge.cjs");s.formatFeatureFlags=e=>{return{...e,chains:(t=e.chains,Object.entries(t).reduce((e,[t,s])=>({...e,[(0,n.formatChainIdToCaip)(t)]:s}),{}))};var t};s.processFeatureFlags=e=>{if((0,a.validateFeatureFlagsResponse)(e)){const t=(0,s.formatFeatureFlags)(e);return t.chainRanking&&0!==t.chainRanking.length?t:{...t,chainRanking:[...r.DEFAULT_CHAIN_RANKING]}}return r.DEFAULT_FEATURE_FLAG_CONFIG},s.getBridgeFeatureFlags=function(e){const t=e.call("RemoteFeatureFlagController:getState"),n=t?.remoteFeatureFlags?.bridgeConfigV2,a=t?.remoteFeatureFlags?.bridgeConfig;return(0,s.processFeatureFlags)(n||a)};s.hasMinimumRequiredVersion=(e,t)=>{const[s,n,a]=e.split(".").map(Number),[r,i,o]=t.split(".").map(Number);return s>r||(s===r&&n>i||s===r&&n===i&&a>=o)}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchServerEvents=void 0;s.fetchServerEvents=async(e,{onMessage:t,onError:s,onClose:n,fetchFn:a,...r})=>{let i;try{const s=await a(e,r);if(!s.ok||!s.body)throw new Error(`${s.status}`);i=s.body.getReader();const o=new TextDecoder("utf-8");let c="";for(;;){const{done:e,value:s}=await i.read();if(e)break;c+=o.decode(s,{stream:!0});const n=c.split("\n\n");c=n.pop()||"";for(const e of n){const s=e.split("\n");let n;const a=[];for(const e of s)e.startsWith("event:")?n=e.slice(6).trim():e.startsWith("data:")&&a.push(e.slice(5).trim());if("error"===n)throw new Error(`Bridge-api error: ${a.join("\n")}`);if(a.length>0){const e=JSON.parse(a.join("\n"));await t(e,n)}}}await(n?.())}catch(e){s?.(e)}finally{try{await(i?.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchBridgeQuoteStream=s.fetchAssetPrices=s.fetchBridgeQuotes=s.fetchBridgeTokens=s.getClientHeaders=void 0;const n=e("@metamask/superstruct"),a=e("./bridge.cjs"),r=e("./caip-formatters.cjs"),i=e("./fetch-server-events.cjs"),o=e("./trade-utils.cjs"),c=e("./validators.cjs");s.getClientHeaders=({clientId:e,clientVersion:t,jwt:s})=>({"X-Client-Id":e,...s?{Authorization:`Bearer ${s}`}:{},...t?{"Client-Version":t}:{}}),s.fetchBridgeTokens=async function(e,t,n,a,i,o){const d=`${i}/getTokens?chainId=${(0,r.formatChainIdToDec)(e)}`,l=await a(d,{headers:(0,s.getClientHeaders)({clientId:t,clientVersion:o,jwt:n})}),m={};return l.forEach(e=>{(0,c.validateSwapsTokenObject)(e)&&(m[e.address]=e)}),m};const d=e=>{const t=e.destWalletAddress??e.walletAddress,s={walletAddress:(0,r.formatAddressToCaipReference)(e.walletAddress),destWalletAddress:(0,r.formatAddressToCaipReference)(t),srcChainId:(0,r.formatChainIdToDec)(e.srcChainId),destChainId:(0,r.formatChainIdToDec)(e.destChainId),srcTokenAddress:(0,r.formatAddressToCaipReference)(e.srcTokenAddress),destTokenAddress:(0,r.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&&(s.slippage=e.slippage),e.fee!==undefined&&(s.fee=e.fee),e.aggIds&&e.aggIds.length>0&&(s.aggIds=e.aggIds),e.bridgeIds&&e.bridgeIds.length>0&&(s.bridgeIds=e.bridgeIds);const n=new URLSearchParams;return Object.entries(s).forEach(([e,t])=>{n.append(e,t.toString())}),n};s.fetchBridgeQuotes=async function(e,t,r,i,l,m,u,h){const f=`${m}/getQuote?${d(e)}`,p=await l(f,{headers:(0,s.getClientHeaders)({clientId:r,clientVersion:h,jwt:i}),signal:t}),g=new Set([]),k=p.filter(e=>{try{return(0,c.validateQuoteResponse)(e)}catch(t){return t instanceof n.StructError&&t.failures().forEach(({branch:t,path:s})=>{const n=t?.[0]?.quote?.bridgeId??t?.[0]?.quote?.bridges?.[0]??e?.quote?.bridgeId??e?.quote?.bridges?.[0]??"unknown",a=s?.join(".")||"unknown";g.add([n,a].join("|"))}),!1}}).map(t=>({...t,featureId:u??undefined,resetApproval:e.resetApproval&&t.approval&&(0,o.isEvmTxData)(t.approval)?{...t.approval,data:(0,a.getEthUsdtResetData)(e.destChainId)}:undefined})),b=Array.from(g);return g.size>0&&console.warn("Quote validation failed",b),{quotes:k,validationFailures:b}};s.fetchAssetPrices=async e=>{const{currencies:t,...n}=e,a=await Promise.allSettled(Array.from(t).map(async e=>await(async e=>{const{currency:t,assetIds:n,clientId:a,clientVersion:r,fetchFn:i,signal:o}=e,c=Array.from(n).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 i(d,{headers:(0,s.getClientHeaders)({clientId:a,clientVersion:r}),signal:o});return l&&"object"==typeof l?Object.entries(l).reduce((e,[s,n])=>n?(e[s]||(e[s]={}),n[t]&&(e[s][t]=n[t].toString()),e):e,{}):{}})({...n,currency:e}))).then(e=>e.reduce((e,t)=>("fulfilled"===t.status&&Object.entries(t.value).forEach(([t,s])=>{e[t]||(e[t]={}),Object.entries(s).forEach(([s,n])=>{e[t][s]=n})}),e),{}));return a},s.fetchBridgeQuoteStream=async function(e,t,r,l,m,u,h,f){const p=`${u}/getQuoteStream?${d(t)}`;await(0,i.fetchServerEvents)(p,{headers:{...(0,s.getClientHeaders)({clientId:l,clientVersion:f,jwt:m}),"Content-Type":"text/event-stream"},signal:r,onMessage:async e=>{const s=new Set([]);try{if((0,c.validateQuoteResponse)(e))return await h.onValidQuoteReceived({...e,resetApproval:t.resetApproval&&e.approval&&(0,o.isEvmTxData)(e.approval)?{...e.approval,data:(0,a.getEthUsdtResetData)(t.destChainId)}:undefined})}catch(t){t instanceof n.StructError&&t.failures().forEach(({branch:t,path:n})=>{const a=t?.[0]?.quote?.bridgeId??t?.[0]?.quote?.bridges?.[0]??e?.quote?.bridgeId??(e?.quote?.bridges?.[0]||"unknown"),r=n?.join(".")||"unknown";s.add([a,r].join("|"))});const a=Array.from(s);if(s.size>0)return console.warn("Quote validation failed",a),h.onValidationFailure(a);throw t}return undefined},onError:e=>{throw e},onClose:async()=>{await h.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,s){var n,a,r,i,o,c,d;Object.defineProperty(s,"__esModule",{value:!0}),s.MetricsSwapType=s.MetricsActionType=s.InputAmountPreset=s.MetaMetricsSwapsEventSource=s.AbortReason=s.PollingStatus=s.UnifiedSwapBridgeEventName=s.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=void 0,s.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",e.AssetPickerOpened="Unified SwapBridge Asset Picker Opened",e.PollingStatusUpdated="Unified SwapBridge Polling Status Updated"}(n||(s.UnifiedSwapBridgeEventName=n={})),function(e){e.MaxPollingReached="max_polling_reached",e.ManuallyRestarted="manually_restarted"}(a||(s.PollingStatus=a={})),function(e){e.NewQuoteRequest="New Quote Request",e.QuoteRequestUpdated="Quote Request Updated",e.ResetState="Reset controller state",e.TransactionSubmitted="Transaction submitted"}(r||(s.AbortReason=r={})),function(e){e.MainView="Main View",e.TokenView="Token View",e.TrendingExplore="Trending Explore",e.Rewards="Rewards"}(i||(s.MetaMetricsSwapsEventSource=i={})),function(e){e.PERCENT_25="25%",e.PERCENT_50="50%",e.PERCENT_75="75%",e.PERCENT_90="90%",e.MAX="MAX"}(o||(s.InputAmountPreset=o={})),function(e){e.CROSSCHAIN_V1="crosschain-v1",e.SWAPBRIDGE_V1="swapbridge-v1"}(c||(s.MetricsActionType=c={})),function(e){e.SINGLE="single_chain",e.CROSSCHAIN="crosschain"}(d||(s.MetricsSwapType=d={}))}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getQuotesReceivedProperties=s.isCustomSlippage=s.isHardwareWallet=s.getRequestParams=s.formatProviderLabel=s.getSwapTypeFromQuote=s.getSwapType=s.toInputChangedPropertyValue=s.toInputChangedPropertyKey=void 0;const n=e("./constants.cjs"),a=e("../../constants/bridge.cjs"),r=e("../../types.cjs"),i=e("../bridge.cjs"),o=e("../caip-formatters.cjs");s.toInputChangedPropertyKey={srcTokenAddress:"token_source",destTokenAddress:"token_destination",srcChainId:"chain_source",destChainId:"chain_destination",slippage:"slippage"},s.toInputChangedPropertyValue={srcTokenAddress:({srcTokenAddress:e,srcChainId:t})=>t?(0,o.formatAddressToAssetId)(e??"",t):undefined,destTokenAddress:({destTokenAddress:e,destChainId:t})=>t?(0,o.formatAddressToAssetId)(e??"",t):undefined,srcChainId:({srcChainId:e})=>e?(0,o.formatChainIdToCaip)(e):undefined,destChainId:({destChainId:e})=>e?(0,o.formatChainIdToCaip)(e):undefined,slippage:({slippage:e})=>e?Number(e):e};s.getSwapType=(e,t)=>e&&!(0,i.isCrossChain)(e,t??e)?n.MetricsSwapType.SINGLE:n.MetricsSwapType.CROSSCHAIN;s.getSwapTypeFromQuote=e=>(0,s.getSwapType)(e.srcChainId,e.destChainId);s.formatProviderLabel=({bridgeId:e,bridges:t})=>`${e}_${t[0]}`;s.getRequestParams=({srcChainId:e,destChainId:t,srcTokenAddress:s,destTokenAddress:n})=>{const a=(0,o.formatChainIdToCaip)(e??r.ChainId.ETH);return{chain_id_source:a,chain_id_destination:t?(0,o.formatChainIdToCaip)(t):null,token_address_source:s?(0,o.formatAddressToAssetId)(s,a)??(0,i.getNativeAssetForChainId)(a)?.assetId??null:(0,i.getNativeAssetForChainId)(a)?.assetId??null,token_address_destination:n?(0,o.formatAddressToAssetId)(n,t??a)??null:null}};s.isHardwareWallet=e=>e?.metadata?.keyring.type?.includes("Hardware")??!1;s.isCustomSlippage=e=>e!==a.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;s.getQuotesReceivedProperties=(e,t=[],n=!0,a,r)=>{const i=e?(0,s.formatProviderLabel)(e.quote):"_";return{can_submit:n,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),usd_balance_source:r??0,best_quote_provider:a?(0,s.formatProviderLabel)(a.quote):i,provider:i,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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.appendFeesToQuotes=void 0;const n=e("@metamask/utils"),a=e("./bridge.cjs"),r=e("./caip-formatters.cjs"),i=e("./snaps.cjs"),o=e("./trade-utils.cjs"),c=e("../constants/chains.cjs");s.appendFeesToQuotes=async(e,t,s,d)=>{const l=await(async(e,t)=>{if(e.some(({quote:e})=>{const t=(0,r.formatChainIdToCaip)(e.srcChainId);return![c.CHAIN_IDS.OPTIMISM,c.CHAIN_IDS.BASE].map(r.formatChainIdToCaip).includes(t)}))return undefined;const s=Promise.allSettled(e.map(async e=>{const{quote:s,trade:r,approval:i}=e,o=(0,n.numberToHex)(s.srcChainId),c=e=>({from:e.from,to:e.to,value:e.value,data:e.data,gasLimit:e.gasLimit?.toString()}),d=i?await t({transactionParams:c(i),chainId:o}):"0x0",l=await t({transactionParams:c(r),chainId:o});return d===undefined||l===undefined?undefined:{...e,l1GasFeesInHexWei:(0,a.sumHexes)(d,l)}}));return(await s).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,s),m=await(async(e,t,s)=>{if(e.some(({quote:{srcChainId:e}})=>!(0,a.isNonEvmChainId)(e)))return undefined;const n=Promise.allSettled(e.map(async e=>{const{trade:n,quote:a}=e;if(!s?.metadata?.snap?.id||!n)return e;try{const c=(0,r.formatChainIdToCaip)(a.srcChainId),d=(0,o.extractTradeData)(n),l=(0,o.isTronTrade)(n)?{visible:n.visible,type:n.raw_data?.contract?.[0]?.type,feeLimit:n.raw_data?.fee_limit}:undefined,m=await t.call("SnapController:handleRequest",(0,i.computeFeeRequest)(s?.metadata?.snap?.id,d,s?.id,c,l)),u=m?.find(e=>"base"===e.type)||m?.find(e=>"priority"===e.type)||m?.[0],h=u?.asset?.amount||"0";return{...e,nonEvmFeesInNative:h}}catch(t){return console.error(`Failed to compute non-EVM fees for quote ${a.requestId}:`,t),{...e,nonEvmFeesInNative:undefined}}}));return(await n).reduce((e,t)=>("fulfilled"===t.status&&t.value&&e.push(t.value),e),[])})(e,t,d);return l??m??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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sortQuotes=s.formatEtaInMinutes=s.calcSlippagePercentage=s.calcCost=s.calcSwapRate=s.calcAdjustedReturn=s.calcIncludedTxFees=s.calcTotalMaxNetworkFee=s.calcTotalEstimatedNetworkFee=s.calcEstimatedAndMaxTotalGasFee=s.calcRelayerFee=s.calcSentAmount=s.calcToAmount=s.calcNonEvmTotalNetworkFee=s.getQuoteIdentifier=s.isValidQuoteRequest=void 0;const n=e("@metamask/controller-utils"),a=e("bignumber.js"),r=e("./bridge.cjs"),i=e("./validators.cjs");s.isValidQuoteRequest=(e,t=!0)=>{const s=["srcTokenAddress","destTokenAddress","srcChainId","destChainId","walletAddress"];if(t&&s.push("srcTokenAmount"),e.destChainId&&e.srcChainId&&e.destChainId!==e.srcChainId&&((0,r.isNonEvmChainId)(e.destChainId)||(0,r.isNonEvmChainId)(e.srcChainId))&&(s.push("destWalletAddress"),!e.destWalletAddress))return!1;const n=[];return e.slippage!==undefined&&n.push("slippage"),s.every(t=>t in e&&"string"==typeof e[t]&&e[t]!==undefined&&""!==e[t]&&null!==e[t])&&n.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)))};s.getQuoteIdentifier=e=>`${e.bridgeId}-${e.bridges[0]}-${e.steps.length}`;const o=(e,t)=>{const s=new a.BigNumber(10).pow(t??0);return new a.BigNumber(e).div(s)};s.calcNonEvmTotalNetworkFee=(e,{exchangeRate:t,usdExchangeRate:s})=>{const{nonEvmFeesInNative:n}=e,r=new a.BigNumber(n??"0");return{amount:r.toString(),valueInCurrency:t?r.times(t).toString():null,usd:s?r.times(s).toString():null}};s.calcToAmount=(e,t,{exchangeRate:s,usdExchangeRate:n})=>{const a=o(e,t.decimals);return{amount:a.toString(),valueInCurrency:s?a.times(s).toString():null,usd:n?a.times(n).toString():null}};s.calcSentAmount=({srcTokenAmount:e,srcAsset:t,feeData:s},{exchangeRate:n,usdExchangeRate:r})=>{const i=Object.values(s).filter(e=>e&&e.amount&&e.asset?.assetId===t.assetId).reduce((e,{amount:t})=>e.plus(t),new a.BigNumber(e)),c=o(i,t.decimals);return{amount:c.toString(),valueInCurrency:n?c.times(n).toString():null,usd:r?c.times(r).toString():null}};s.calcRelayerFee=(e,{exchangeRate:t,usdExchangeRate:i})=>{const{quote:c,trade:d}=e,l=new a.BigNumber((0,n.convertHexToDecimal)(d.value||"0x0"));let m=o(l,18);if((0,r.isNativeAddress)(c.srcAsset.address)){const e=(0,s.calcSentAmount)(c,{exchangeRate:t,usdExchangeRate:i}).amount;m=m.minus(e)}return{amount:m,valueInCurrency:t?m.times(t):null,usd:i?m.times(i):null}};const c=({approvalGasLimit:e,resetApprovalGasLimit:t,tradeGasLimit:s,l1GasFeesInHexWei:r,feePerGasInDecGwei:i,nativeToDisplayCurrencyExchangeRate:o,nativeToUsdExchangeRate:c})=>{const d=new a.BigNumber(s?.toString()??"0").plus(e?.toString()??"0").plus(t?.toString()??"0"),l=(0,n.weiHexToGweiDec)((0,n.toHex)(r??"0")),m=d.times(i??"0").plus(l).times(new a.BigNumber(10).pow(-9)),u=o?m.times(o.toString()):null,h=c?m.times(c.toString()):null;return{amount:m.toString(),valueInCurrency:u?.toString()??null,usd:h?.toString()??null}};s.calcEstimatedAndMaxTotalGasFee=({bridgeQuote:{approval:e,trade:t,l1GasFeesInHexWei:s,resetApproval:n},feePerGasInDecGwei:a,maxFeePerGasInDecGwei:r,exchangeRate:i,usdExchangeRate:o})=>{const{amount:d,valueInCurrency:l,usd:m}=c({approvalGasLimit:e?.effectiveGas??e?.gasLimit,resetApprovalGasLimit:n?.effectiveGas??n?.gasLimit,tradeGasLimit:t?.effectiveGas??t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:o}),{amount:u,valueInCurrency:h,usd:f}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:n?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:o}),{amount:p,valueInCurrency:g,usd:k}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:n?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:s,feePerGasInDecGwei:r,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:o});return{effective:{amount:d,valueInCurrency:l,usd:m},total:{amount:u,valueInCurrency:h,usd:f},max:{amount:p,valueInCurrency:g,usd:k}}};s.calcTotalEstimatedNetworkFee=({total:e},t)=>({amount:new a.BigNumber(e?.amount??"0").plus(t.amount).toString(),valueInCurrency:e?.valueInCurrency?new a.BigNumber(e.valueInCurrency).plus(t.valueInCurrency??"0").toString():null,usd:e?.usd?new a.BigNumber(e.usd).plus(t.usd??"0").toString():null});s.calcTotalMaxNetworkFee=(e,t)=>({amount:new a.BigNumber(e.max.amount).plus(t.amount).toString(),valueInCurrency:e.max.valueInCurrency?new a.BigNumber(e.max.valueInCurrency).plus(t.valueInCurrency??"0").toString():null,usd:e.max.usd?new a.BigNumber(e.max.usd).plus(t.usd??"0").toString():null});s.calcIncludedTxFees=({gasIncluded:e,gasIncluded7702:t,srcAsset:s,feeData:{txFee:n}},a,r)=>{if(!n||!e&&!t)return null;const{exchangeRate:i,usdExchangeRate:c}=n.asset.assetId===s.assetId?a:r,d=o(n.amount,n.asset.decimals);return{amount:d.toString(),valueInCurrency:i?d.times(i).toString():null,usd:c?d.times(c).toString():null}};s.calcAdjustedReturn=(e,t,{feeData:{txFee:s},destAsset:{assetId:n}})=>s?.asset?.assetId===n?{valueInCurrency:e.valueInCurrency,usd:e.usd}:{valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new a.BigNumber(e.valueInCurrency).minus(t.valueInCurrency).toString():null,usd:e.usd&&t.usd?new a.BigNumber(e.usd).minus(t.usd).toString():null};s.calcSwapRate=(e,t)=>new a.BigNumber(t).div(e).toString();s.calcCost=(e,t)=>({valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new a.BigNumber(t.valueInCurrency).minus(e.valueInCurrency).toString():null,usd:e.usd&&t.usd?new a.BigNumber(t.usd).minus(e.usd).toString():null});s.calcSlippagePercentage=(e,t)=>{const n=(0,s.calcCost)(e,t);return n.valueInCurrency&&t.valueInCurrency?new a.BigNumber(n.valueInCurrency).div(t.valueInCurrency).times(100).abs().toString():n.usd&&t.usd?new a.BigNumber(n.usd).div(t.usd).times(100).abs().toString():null};s.formatEtaInMinutes=e=>e<60?"< 1":(e/60).toFixed();s.sortQuotes=(e,t)=>t===i.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getDefaultSlippagePercentage=s.BRIDGE_DEFAULT_SLIPPAGE=void 0;const n=e("./bridge.cjs");s.BRIDGE_DEFAULT_SLIPPAGE=.5;const a=undefined;s.getDefaultSlippagePercentage=({srcTokenAddress:e,destTokenAddress:t,srcChainId:r,destChainId:i},o,c)=>!r||(0,n.isCrossChain)(r,i)?s.BRIDGE_DEFAULT_SLIPPAGE:(0,n.isSolanaChainId)(r)?a:e&&t&&o?.map(e=>e.toLowerCase()).includes(e.toLowerCase())&&(c??o)?.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.computeFeeRequest=s.getMinimumBalanceForRentExemptionInLamports=s.getMinimumBalanceForRentExemptionRequest=void 0;const n=e("@metamask/keyring-api"),a=e("uuid"),r=e("../constants/bridge.cjs");s.getMinimumBalanceForRentExemptionRequest=e=>({snapId:e,origin:"metamask",handler:"onProtocolRequest",request:{method:" ",jsonrpc:"2.0",params:{scope:n.SolScope.Mainnet,request:{id:(0,a.v4)(),jsonrpc:"2.0",method:"getMinimumBalanceForRentExemption",params:[0,{commitment:"confirmed"}]}}}});s.getMinimumBalanceForRentExemptionInLamports=async(e,t)=>String(await t.call("SnapController:handleRequest",(0,s.getMinimumBalanceForRentExemptionRequest)(e)).catch(e=>(console.error("Error setting minimum balance for rent exemption",e),r.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports)));s.computeFeeRequest=(e,t,s,n,r)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,a.v4)(),jsonrpc:"2.0",method:"computeFee",params:{transaction:t,accountId:s,scope:n,...r&&{options:r}}}})}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fetchTokens=s.DEV_BASE_URL=s.API_BASE_URL=s.getSwapsContractAddress=s.isValidSwapsContractAddress=void 0;const n=e("./caip-formatters.cjs"),a=e("../constants/chains.cjs"),r=e("../constants/swaps.cjs"),i=e("../constants/tokens.cjs");function o(e){return e?{"X-Client-Id":e}:undefined}s.isValidSwapsContractAddress=function(e,t){return!(!t||!r.ALLOWED_CONTRACT_ADDRESSES[e])&&r.ALLOWED_CONTRACT_ADDRESSES[e].some(e=>t.toLowerCase()===e.toLowerCase())},s.getSwapsContractAddress=function(e){return r.SWAPS_CONTRACT_ADDRESSES[e]},s.API_BASE_URL="https://swap.api.cx.metamask.io",s.DEV_BASE_URL="https://swap.dev-api.cx.metamask.io",s.fetchTokens=async function(e,t,r){const[c,d]=e===a.CHAIN_IDS.LOCALHOST?[a.CHAIN_IDS.MAINNET,s.DEV_BASE_URL]:[e,s.API_BASE_URL],l=`${d}/networks/${(0,n.formatChainIdToDec)(c)}/tokens`,m=(await t(l,{headers:o(r)})).filter(e=>e.address!==i.DEFAULT_TOKEN_ADDRESS),u=i.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[e];return m.push(u),m}}}},{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,s){(function(e){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.extractTradeData=s.isTronTrade=s.isBitcoinTrade=s.isEvmTxData=void 0;s.isEvmTxData=e=>"object"==typeof e&&null!==e&&"data"in e&&"chainId"in e&&"to"in e;s.isBitcoinTrade=e=>"object"==typeof e&&null!==e&&"unsignedPsbtBase64"in e;s.isTronTrade=e=>"object"==typeof e&&null!==e&&"raw_data_hex"in e;s.extractTradeData=t=>(0,s.isBitcoinTrade)(t)?t.unsignedPsbtBase64:(0,s.isTronTrade)(t)?e.from(t.raw_data_hex,"hex").toString("base64"):"string"==typeof t?t:(0,s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.validateQuoteResponse=s.QuoteResponseSchema=s.TronTradeDataSchema=s.BitcoinTradeDataSchema=s.TxDataSchema=s.QuoteSchema=s.IntentSchema=s.IntentOrderSchema=s.StepSchema=s.ProtocolSchema=s.FeeDataSchema=s.validateSwapsTokenObject=s.validateFeatureFlagsResponse=s.PlatformConfigSchema=s.PriceImpactThresholdSchema=s.ChainConfigurationSchema=s.ChainRankingSchema=s.ChainRankingItemSchema=s.BridgeAssetSchema=s.truthyString=s.ActionTypes=s.FeatureId=s.FeeType=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/superstruct"),r=e("@metamask/utils");var i,o,c;!function(e){e.METABRIDGE="metabridge",e.REFUEL="refuel",e.TX_FEE="txFee"}(i||(s.FeeType=i={})),function(e){e.PERPS="perps"}(o||(s.FeatureId=o={})),function(e){e.BRIDGE="bridge",e.SWAP="swap",e.REFUEL="refuel"}(c||(s.ActionTypes=c={}));const d=(0,a.define)("HexAddress",e=>(0,n.isValidHexAddress)(e,{allowNonPrefixed:!1})),l=(0,a.define)("HexString",e=>(0,r.isStrictHexString)(e)),m=(0,a.define)("VersionString",e=>"string"==typeof e&&/^(\d+\.*){2}\d+$/u.test(e)&&3===e.split(".").length);s.truthyString=e=>Boolean(e?.length);const u=(0,a.pattern)((0,a.string)(),/^\d+$/u),h=(0,a.number)();s.BridgeAssetSchema=(0,a.type)({chainId:h,address:(0,a.string)(),assetId:r.CaipAssetTypeStruct,symbol:(0,a.string)(),name:(0,a.string)(),decimals:(0,a.number)(),icon:(0,a.optional)((0,a.nullable)((0,a.string)())),iconUrl:(0,a.optional)((0,a.nullable)((0,a.string)()))});const f=(0,a.type)({standard:(0,a.record)((0,a.string)(),(0,a.string)()),other:(0,a.record)((0,a.string)(),(0,a.string)())});s.ChainRankingItemSchema=(0,a.type)({chainId:r.CaipChainIdStruct,name:(0,a.string)()}),s.ChainRankingSchema=(0,a.optional)((0,a.array)(s.ChainRankingItemSchema)),s.ChainConfigurationSchema=(0,a.type)({isActiveSrc:(0,a.boolean)(),isActiveDest:(0,a.boolean)(),refreshRate:(0,a.optional)((0,a.number)()),topAssets:(0,a.optional)((0,a.array)((0,a.string)())),stablecoins:(0,a.optional)((0,a.array)((0,a.string)())),isUnifiedUIEnabled:(0,a.optional)((0,a.boolean)()),isSingleSwapBridgeButtonEnabled:(0,a.optional)((0,a.boolean)()),isGaslessSwapEnabled:(0,a.optional)((0,a.boolean)()),noFeeAssets:(0,a.optional)((0,a.array)((0,a.string)())),defaultPairs:(0,a.optional)(f)}),s.PriceImpactThresholdSchema=(0,a.type)({gasless:(0,a.number)(),normal:(0,a.number)(),warning:(0,a.optional)((0,a.number)()),error:(0,a.optional)((0,a.number)())});const p=(0,a.type)({aggIds:(0,a.optional)((0,a.array)((0,a.string)())),bridgeIds:(0,a.optional)((0,a.array)((0,a.string)())),fee:(0,a.optional)((0,a.number)())}),g=(0,a.enums)(Object.values(o));s.PlatformConfigSchema=(0,a.type)({priceImpactThreshold:(0,a.optional)(s.PriceImpactThresholdSchema),quoteRequestOverrides:(0,a.optional)((0,a.record)(g,(0,a.optional)(p))),minimumVersion:(0,a.string)(),refreshRate:(0,a.number)(),maxRefreshCount:(0,a.number)(),support:(0,a.boolean)(),chains:(0,a.record)((0,a.string)(),s.ChainConfigurationSchema),bip44DefaultPairs:(0,a.optional)((0,a.record)((0,a.string)(),(0,a.optional)(f))),sse:(0,a.optional)((0,a.type)({enabled:(0,a.boolean)(),minimumVersion:m})),chainRanking:s.ChainRankingSchema});s.validateFeatureFlagsResponse=e=>(0,a.is)(e,s.PlatformConfigSchema);s.validateSwapsTokenObject=e=>(0,a.is)(e,s.BridgeAssetSchema),s.FeeDataSchema=(0,a.type)({amount:u,asset:s.BridgeAssetSchema}),s.ProtocolSchema=(0,a.type)({name:(0,a.string)(),displayName:(0,a.optional)((0,a.string)()),icon:(0,a.optional)((0,a.string)())}),s.StepSchema=(0,a.type)({action:(0,a.enums)(Object.values(c)),srcChainId:h,destChainId:(0,a.optional)(h),srcAsset:s.BridgeAssetSchema,destAsset:s.BridgeAssetSchema,srcAmount:(0,a.string)(),destAmount:(0,a.string)(),protocol:s.ProtocolSchema});const k=s.StepSchema,b=(0,a.union)([u,(0,a.number)()]),w=(0,a.string)();s.IntentOrderSchema=(0,a.type)({sellToken:d,buyToken:d,receiver:(0,a.optional)(d),validTo:b,appData:(0,a.string)(),appDataHash:l,feeAmount:u,kind:(0,a.enums)(["sell","buy"]),partiallyFillable:(0,a.boolean)(),sellAmount:(0,a.optional)(u),buyAmount:(0,a.optional)(u),from:(0,a.optional)(d)}),s.IntentSchema=(0,a.type)({protocol:w,order:s.IntentOrderSchema,settlementContract:(0,a.optional)(d),typedData:(0,a.type)({types:(0,a.record)((0,a.string)(),(0,a.array)((0,a.type)({name:(0,a.string)(),type:(0,a.string)()}))),primaryType:(0,a.string)(),domain:(0,a.record)((0,a.string)(),(0,a.any)()),message:(0,a.record)((0,a.string)(),(0,a.any)())})}),s.QuoteSchema=(0,a.type)({requestId:(0,a.string)(),srcChainId:h,srcAsset:s.BridgeAssetSchema,srcTokenAmount:(0,a.string)(),destChainId:h,destAsset:s.BridgeAssetSchema,destTokenAmount:(0,a.string)(),minDestTokenAmount:(0,a.string)(),feeData:(0,a.type)({[i.METABRIDGE]:s.FeeDataSchema,[i.TX_FEE]:(0,a.optional)((0,a.intersection)([s.FeeDataSchema,(0,a.type)({maxFeePerGas:(0,a.string)(),maxPriorityFeePerGas:(0,a.string)()})]))}),gasIncluded:(0,a.optional)((0,a.boolean)()),gasIncluded7702:(0,a.optional)((0,a.boolean)()),bridgeId:(0,a.string)(),bridges:(0,a.array)((0,a.string)()),steps:(0,a.array)(s.StepSchema),refuel:(0,a.optional)(k),priceData:(0,a.optional)((0,a.type)({totalFromAmountUsd:(0,a.optional)((0,a.string)()),totalToAmountUsd:(0,a.optional)((0,a.string)()),priceImpact:(0,a.optional)((0,a.string)()),totalFeeAmountUsd:(0,a.optional)((0,a.string)())})),intent:(0,a.optional)(s.IntentSchema),gasSponsored:(0,a.optional)((0,a.boolean)())}),s.TxDataSchema=(0,a.type)({chainId:(0,a.number)(),to:d,from:d,value:l,data:l,gasLimit:(0,a.nullable)((0,a.number)()),effectiveGas:(0,a.optional)((0,a.number)())}),s.BitcoinTradeDataSchema=(0,a.type)({unsignedPsbtBase64:(0,a.string)(),inputsToSign:(0,a.nullable)((0,a.array)((0,a.type)({})))}),s.TronTradeDataSchema=(0,a.type)({raw_data_hex:(0,a.string)(),visible:(0,a.optional)((0,a.boolean)()),raw_data:(0,a.optional)((0,a.nullable)((0,a.type)({contract:(0,a.optional)((0,a.array)((0,a.type)({type:(0,a.optional)((0,a.string)())}))),fee_limit:(0,a.optional)((0,a.number)())})))}),s.QuoteResponseSchema=(0,a.type)({quote:s.QuoteSchema,estimatedProcessingTimeInSeconds:(0,a.number)(),approval:(0,a.optional)((0,a.union)([s.TxDataSchema,s.TronTradeDataSchema])),trade:(0,a.union)([s.TxDataSchema,s.BitcoinTradeDataSchema,s.TronTradeDataSchema,(0,a.string)()])});s.validateQuoteResponse=e=>((0,a.assert)(e,s.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/bignumber.js/bignumber.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){!function(e){var s,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,r=Math.floor,i="[BigNumber Error] ",o=i+"Number primitive has more than 15 significant digits: ",c=1e14,d=14,l=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],u=1e7,h=1e9;function f(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,s,n=1,a=e.length,r=e[0]+"";n<a;){for(t=e[n++]+"",s=d-t.length;s--;t="0"+t);r+=t}for(a=r.length;48===r.charCodeAt(--a););return r.slice(0,a+1||1)}function g(e,t){var s,n,a=e.c,r=t.c,i=e.s,o=t.s,c=e.e,d=t.e;if(!i||!o)return null;if(s=a&&!a[0],n=r&&!r[0],s||n)return s?n?0:-o:i;if(i!=o)return i;if(s=i<0,n=c==d,!a||!r)return n?0:!a^s?1:-1;if(!n)return c>d^s?1:-1;for(o=(c=a.length)<(d=r.length)?c:d,i=0;i<o;i++)if(a[i]!=r[i])return a[i]>r[i]^s?1:-1;return c==d?0:c>d^s?1:-1}function k(e,t,s,n){if(e<t||e>s||e!==r(e))throw Error(i+(n||"Argument")+("number"==typeof e?e<t||e>s?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return f(e.e/d)==t&&e.c[t]%2!=0}function w(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(e,t,s){var n,a;if(t<0){for(a=s+".";++t;a+=s);e=a+e}else if(++t>(n=e.length)){for(a=s,t-=n;--t;a+=s);e+=a}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var s,T,E,S,I,A,y,x,v,C,j=W.prototype={constructor:W,toString:null,valueOf:null},P=new W(1),D=20,N=4,R=-7,O=21,M=-1e7,L=1e7,F=!1,B=1,G=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},U="0123456789abcdefghijklmnopqrstuvwxyz",q=!0;function W(e,t){var s,a,i,c,m,u,h,f,p=this;if(!(p instanceof W))return new W(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>L?p.c=p.e=null:e.e<M?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,m=e;m>=10;m/=10,c++);return void(c>L?p.c=p.e=null:(p.e=c,p.c=[e]))}f=String(e)}else{if(!n.test(f=String(e)))return E(p,f,u);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(c=f.indexOf("."))>-1&&(f=f.replace(".","")),(m=f.search(/e/i))>0?(c<0&&(c=m),c+=+f.slice(m+1),f=f.substring(0,m)):c<0&&(c=f.length)}else{if(k(t,2,U.length,"Base"),10==t&&q)return Y(p=new W(e),D+p.e+1,N);if(f=String(e),u="number"==typeof e){if(0*e!=0)return E(p,f,u,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,W.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(s=U.slice(0,t),c=m=0,h=f.length;m<h;m++)if(s.indexOf(a=f.charAt(m))<0){if("."==a){if(m>c){c=h;continue}}else if(!i&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){i=!0,m=-1,c=0;continue}return E(p,String(e),u,t)}u=!1,(c=(f=T(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):c=f.length}for(m=0;48===f.charCodeAt(m);m++);for(h=f.length;48===f.charCodeAt(--h););if(f=f.slice(m,++h)){if(h-=m,u&&W.DEBUG&&h>15&&(e>l||e!==r(e)))throw Error(o+p.s*e);if((c=c-m-1)>L)p.c=p.e=null;else if(c<M)p.c=[p.e=0];else{if(p.e=c,p.c=[],m=(c+1)%d,c<0&&(m+=d),m<h){for(m&&p.c.push(+f.slice(0,m)),h-=d;m<h;)p.c.push(+f.slice(m,m+=d));m=d-(f=f.slice(m)).length}else m-=h;for(;m--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function $(e,t,s,n){var a,r,i,o,c;if(null==s?s=N:k(s,0,8),!e.c)return e.toString();if(a=e.c[0],i=e.e,null==t)c=p(e.c),c=1==n||2==n&&(i<=R||i>=O)?w(c,i):_(c,i,"0");else if(r=(e=Y(new W(e),t,s)).e,o=(c=p(e.c)).length,1==n||2==n&&(t<=r||r<=R)){for(;o<t;c+="0",o++);c=w(c,r)}else if(t-=i+(2===n&&r>i),c=_(c,r,"0"),r+1>o){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=r-o)>0)for(r+1==o&&(c+=".");t--;c+="0");return e.s<0&&a?"-"+c:c}function V(e,t){for(var s,n,a=1,r=new W(e[0]);a<e.length;a++)(!(n=new W(e[a])).s||(s=g(r,n))===t||0===s&&r.s===t)&&(r=n);return r}function K(e,t,s){for(var n=1,a=t.length;!t[--a];t.pop());for(a=t[0];a>=10;a/=10,n++);return(s=n+s*d-1)>L?e.c=e.e=null:s<M?e.c=[e.e=0]:(e.e=s,e.c=t),e}function Y(e,t,s,n){var i,o,l,u,h,f,p,g=e.c,k=m;if(g){e:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=t-i)<0)o+=d,l=t,h=g[f=0],p=r(h/k[i-l-1]%10);else if((f=a((o+1)/d))>=g.length){if(!n)break e;for(;g.length<=f;g.push(0));h=p=0,i=1,l=(o%=d)-d+1}else{for(h=u=g[f],i=1;u>=10;u/=10,i++);p=(l=(o%=d)-d+i)<0?0:r(h/k[i-l-1]%10)}if(n=n||t<0||null!=g[f+1]||(l<0?h:h%k[i-l-1]),n=s<4?(p||n)&&(0==s||s==(e.s<0?3:2)):p>5||5==p&&(4==s||n||6==s&&(o>0?l>0?h/k[i-l]:0:g[f-1])%10&1||s==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=k[(d-t%d)%d],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,u=1,f--):(g.length=f+1,u=k[d-o],g[f]=l>0?r(h/k[i-l]%k[l])*u:0),n)for(;;){if(0==f){for(o=1,l=g[0];l>=10;l/=10,o++);for(l=g[0]+=u,u=1;l>=10;l/=10,u++);o!=u&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[f]+=u,g[f]!=c)break;g[f--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}e.e>L?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function Q(e){var t,s=e.e;return null===s?e.toString():(t=p(e.c),t=s<=R||s>=O?w(t,s):_(t,s,"0"),e.s<0?"-"+t:t)}return W.clone=e,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(e){var t,s;if(null!=e){if("object"!=typeof e)throw Error(i+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(k(s=e[t],0,h,t),D=s),e.hasOwnProperty(t="ROUNDING_MODE")&&(k(s=e[t],0,8,t),N=s),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((s=e[t])&&s.pop?(k(s[0],-h,0,t),k(s[1],0,h,t),R=s[0],O=s[1]):(k(s,-h,h,t),R=-(O=s<0?-s:s))),e.hasOwnProperty(t="RANGE"))if((s=e[t])&&s.pop)k(s[0],-h,-1,t),k(s[1],1,h,t),M=s[0],L=s[1];else{if(k(s,-h,h,t),!s)throw Error(i+t+" cannot be zero: "+s);M=-(L=s<0?-s:s)}if(e.hasOwnProperty(t="CRYPTO")){if((s=e[t])!==!!s)throw Error(i+t+" not true or false: "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!s,Error(i+"crypto unavailable");F=s}else F=s}if(e.hasOwnProperty(t="MODULO_MODE")&&(k(s=e[t],0,9,t),B=s),e.hasOwnProperty(t="POW_PRECISION")&&(k(s=e[t],0,h,t),G=s),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(s=e[t]))throw Error(i+t+" not an object: "+s);H=s}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(s=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(s))throw Error(i+t+" invalid: "+s);q="0123456789"==s.slice(0,10),U=s}}return{DECIMAL_PLACES:D,ROUNDING_MODE:N,EXPONENTIAL_AT:[R,O],RANGE:[M,L],CRYPTO:F,MODULO_MODE:B,POW_PRECISION:G,FORMAT:H,ALPHABET:U}},W.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!W.DEBUG)return!0;var t,s,n=e.c,a=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&a>=-h&&a<=h&&a===r(a)){if(0===n[0]){if(0===a&&1===n.length)return!0;break e}if((t=(a+1)%d)<1&&(t+=d),String(n[0]).length==t){for(t=0;t<n.length;t++)if((s=n[t])<0||s>=c||s!==r(s))break e;if(0!==s)return!0}}}else if(null===n&&null===a&&(null===o||1===o||-1===o))return!0;throw Error(i+"Invalid BigNumber: "+e)},W.maximum=W.max=function(){return V(arguments,-1)},W.minimum=W.min=function(){return V(arguments,1)},W.random=(S=9007199254740992,I=Math.random()*S&2097151?function(){return r(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,s,n,o,c,l=0,u=[],f=new W(P);if(null==e?e=D:k(e,0,h),o=a(e/d),F)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));l<o;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(s=crypto.getRandomValues(new Uint32Array(2)),t[l]=s[0],t[l+1]=s[1]):(u.push(c%1e14),l+=2);l=o/2}else{if(!crypto.randomBytes)throw F=!1,Error(i+"crypto unavailable");for(t=crypto.randomBytes(o*=7);l<o;)(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):(u.push(c%1e14),l+=7);l=o/7}if(!F)for(;l<o;)(c=I())<9e15&&(u[l++]=c%1e14);for(o=u[--l],e%=d,o&&e&&(c=m[d-e],u[l]=r(o/c)*c);0===u[l];u.pop(),l--);if(l<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=d);for(l=1,c=u[0];c>=10;c/=10,l++);l<d&&(n-=d-l)}return f.e=n,f.c=u,f}),W.sum=function(){for(var e=1,t=arguments,s=new W(t[0]);e<t.length;)s=s.plus(t[e++]);return s},T=function(){var e="0123456789";function t(e,t,s,n){for(var a,r,i=[0],o=0,c=e.length;o<c;){for(r=i.length;r--;i[r]*=t);for(i[0]+=n.indexOf(e.charAt(o++)),a=0;a<i.length;a++)i[a]>s-1&&(null==i[a+1]&&(i[a+1]=0),i[a+1]+=i[a]/s|0,i[a]%=s)}return i.reverse()}return function(n,a,r,i,o){var c,d,l,m,u,h,f,g,k=n.indexOf("."),b=D,w=N;for(k>=0&&(m=G,G=0,n=n.replace(".",""),h=(g=new W(a)).pow(n.length-k),G=m,g.c=t(_(p(h.c),h.e,"0"),10,r,e),g.e=g.c.length),l=m=(f=t(n,a,r,o?(c=U,e):(c=e,U))).length;0==f[--m];f.pop());if(!f[0])return c.charAt(0);if(k<0?--l:(h.c=f,h.e=l,h.s=i,f=(h=s(h,g,b,w,r)).c,u=h.r,l=h.e),k=f[d=l+b+1],m=r/2,u=u||d<0||null!=f[d+1],u=w<4?(null!=k||u)&&(0==w||w==(h.s<0?3:2)):k>m||k==m&&(4==w||u||6==w&&1&f[d-1]||w==(h.s<0?8:7)),d<1||!f[0])n=u?_(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(f.length=d,u)for(--r;++f[--d]>r;)f[d]=0,d||(++l,f=[1].concat(f));for(m=f.length;!f[--m];);for(k=0,n="";k<=m;n+=c.charAt(f[k++]));n=_(n,l,c.charAt(0))}return n}}(),s=function(){function e(e,t,s){var n,a,r,i,o=0,c=e.length,d=t%u,l=t/u|0;for(e=e.slice();c--;)o=((a=d*(r=e[c]%u)+(n=l*r+(i=e[c]/u|0)*d)%u*u+o)/s|0)+(n/u|0)+l*i,e[c]=a%s;return o&&(e=[o].concat(e)),e}function t(e,t,s,n){var a,r;if(s!=n)r=s>n?1:-1;else for(a=r=0;a<s;a++)if(e[a]!=t[a]){r=e[a]>t[a]?1:-1;break}return r}function s(e,t,s,n){for(var a=0;s--;)e[s]-=a,a=e[s]<t[s]?1:0,e[s]=a*n+e[s]-t[s];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,a,i,o,l){var m,u,h,p,g,k,b,w,_,T,E,S,I,A,y,x,v,C=n.s==a.s?1:-1,j=n.c,P=a.c;if(!(j&&j[0]&&P&&P[0]))return new W(n.s&&a.s&&(j?!P||j[0]!=P[0]:P)?j&&0==j[0]||!P?0*C:C/0:NaN);for(_=(w=new W(C)).c=[],C=i+(u=n.e-a.e)+1,l||(l=c,u=f(n.e/d)-f(a.e/d),C=C/d|0),h=0;P[h]==(j[h]||0);h++);if(P[h]>(j[h]||0)&&u--,C<0)_.push(1),p=!0;else{for(A=j.length,x=P.length,h=0,C+=2,(g=r(l/(P[0]+1)))>1&&(P=e(P,g,l),j=e(j,g,l),x=P.length,A=j.length),I=x,E=(T=j.slice(0,x)).length;E<x;T[E++]=0);v=P.slice(),v=[0].concat(v),y=P[0],P[1]>=l/2&&y++;do{if(g=0,(m=t(P,T,x,E))<0){if(S=T[0],x!=E&&(S=S*l+(T[1]||0)),(g=r(S/y))>1)for(g>=l&&(g=l-1),b=(k=e(P,g,l)).length,E=T.length;1==t(k,T,b,E);)g--,s(k,x<b?v:P,b,l),b=k.length,m=1;else 0==g&&(m=g=1),b=(k=P.slice()).length;if(b<E&&(k=[0].concat(k)),s(T,k,E,l),E=T.length,-1==m)for(;t(P,T,x,E)<1;)g++,s(T,x<E?v:P,E,l),E=T.length}else 0===m&&(g++,T=[0]);_[h++]=g,T[0]?T[E++]=j[I]||0:(T=[j[I]],E=1)}while((I++<A||null!=T[0])&&C--);p=null!=T[0],_[0]||_.splice(0,1)}if(l==c){for(h=1,C=_[0];C>=10;C/=10,h++);Y(w,i+(w.e=h+u*d-1)+1,o,p)}else w.e=u,w.r=+p;return w}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,x=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,s,n){var a,r=s?t:t.replace(C,"");if(v.test(r))e.s=isNaN(r)?null:r<0?-1:1;else{if(!s&&(r=r.replace(A,function(e,t,s){return a="x"==(s=s.toLowerCase())?16:"b"==s?2:8,n&&n!=a?e:t}),n&&(a=n,r=r.replace(y,"$1").replace(x,"0.$1")),t!=r))return new W(r,a);if(W.DEBUG)throw Error(i+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},j.absoluteValue=j.abs=function(){var e=new W(this);return e.s<0&&(e.s=1),e},j.comparedTo=function(e,t){return g(this,new W(e,t))},j.decimalPlaces=j.dp=function(e,t){var s,n,a,r=this;if(null!=e)return k(e,0,h),null==t?t=N:k(t,0,8),Y(new W(r),e+r.e+1,t);if(!(s=r.c))return null;if(n=((a=s.length-1)-f(this.e/d))*d,a=s[a])for(;a%10==0;a/=10,n--);return n<0&&(n=0),n},j.dividedBy=j.div=function(e,t){return s(this,new W(e,t),D,N)},j.dividedToIntegerBy=j.idiv=function(e,t){return s(this,new W(e,t),0,1)},j.exponentiatedBy=j.pow=function(e,t){var s,n,o,c,l,m,u,h,f=this;if((e=new W(e)).c&&!e.isInteger())throw Error(i+"Exponent not an integer: "+Q(e));if(null!=t&&(t=new W(t)),l=e.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!e.c||!e.c[0])return h=new W(Math.pow(+Q(f),l?e.s*(2-b(e)):+Q(e))),t?h.mod(t):h;if(m=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new W(NaN);(n=!m&&f.isInteger()&&t.isInteger())&&(f=f.mod(t))}else{if(e.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||l&&f.c[1]>=24e7:f.c[0]<8e13||l&&f.c[0]<=9999975e7)))return c=f.s<0&&b(e)?-0:0,f.e>-1&&(c=1/c),new W(m?1/c:c);G&&(c=a(G/d+2))}for(l?(s=new W(.5),m&&(e.s=1),u=b(e)):u=(o=Math.abs(+Q(e)))%2,h=new W(P);;){if(u){if(!(h=h.times(f)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(o){if(0===(o=r(o/2)))break;u=o%2}else if(Y(e=e.times(s),e.e+1,1),e.e>14)u=b(e);else{if(0===(o=+Q(e)))break;u=o%2}f=f.times(f),c?f.c&&f.c.length>c&&(f.c.length=c):n&&(f=f.mod(t))}return n?h:(m&&(h=P.div(h)),t?h.mod(t):c?Y(h,G,N,undefined):h)},j.integerValue=function(e){var t=new W(this);return null==e?e=N:k(e,0,8),Y(t,t.e+1,e)},j.isEqualTo=j.eq=function(e,t){return 0===g(this,new W(e,t))},j.isFinite=function(){return!!this.c},j.isGreaterThan=j.gt=function(e,t){return g(this,new W(e,t))>0},j.isGreaterThanOrEqualTo=j.gte=function(e,t){return 1===(t=g(this,new W(e,t)))||0===t},j.isInteger=function(){return!!this.c&&f(this.e/d)>this.c.length-2},j.isLessThan=j.lt=function(e,t){return g(this,new W(e,t))<0},j.isLessThanOrEqualTo=j.lte=function(e,t){return-1===(t=g(this,new W(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 s,n,a,r,i=this,o=i.s;if(t=(e=new W(e,t)).s,!o||!t)return new W(NaN);if(o!=t)return e.s=-t,i.plus(e);var l=i.e/d,m=e.e/d,u=i.c,h=e.c;if(!l||!m){if(!u||!h)return u?(e.s=-t,e):new W(h?i:NaN);if(!u[0]||!h[0])return h[0]?(e.s=-t,e):new W(u[0]?i:3==N?-0:0)}if(l=f(l),m=f(m),u=u.slice(),o=l-m){for((r=o<0)?(o=-o,a=u):(m=l,a=h),a.reverse(),t=o;t--;a.push(0));a.reverse()}else for(n=(r=(o=u.length)<(t=h.length))?o:t,o=t=0;t<n;t++)if(u[t]!=h[t]){r=u[t]<h[t];break}if(r&&(a=u,u=h,h=a,e.s=-e.s),(t=(n=h.length)-(s=u.length))>0)for(;t--;u[s++]=0);for(t=c-1;n>o;){if(u[--n]<h[n]){for(s=n;s&&!u[--s];u[s]=t);--u[s],u[n]+=c}u[n]-=h[n]}for(;0==u[0];u.splice(0,1),--m);return u[0]?K(e,u,m):(e.s=3==N?-1:1,e.c=[e.e=0],e)},j.modulo=j.mod=function(e,t){var n,a,r=this;return e=new W(e,t),!r.c||!e.s||e.c&&!e.c[0]?new W(NaN):!e.c||r.c&&!r.c[0]?new W(r):(9==B?(a=e.s,e.s=1,n=s(r,e,0,3),e.s=a,n.s*=a):n=s(r,e,0,B),(e=r.minus(n.times(e))).c[0]||1!=B||(e.s=r.s),e)},j.multipliedBy=j.times=function(e,t){var s,n,a,r,i,o,l,m,h,p,g,k,b,w,_,T=this,E=T.c,S=(e=new W(e,t)).c;if(!(E&&S&&E[0]&&S[0]))return!T.s||!e.s||E&&!E[0]&&!S||S&&!S[0]&&!E?e.c=e.e=e.s=null:(e.s*=T.s,E&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=f(T.e/d)+f(e.e/d),e.s*=T.s,(l=E.length)<(p=S.length)&&(b=E,E=S,S=b,a=l,l=p,p=a),a=l+p,b=[];a--;b.push(0));for(w=c,_=u,a=p;--a>=0;){for(s=0,g=S[a]%_,k=S[a]/_|0,r=a+(i=l);r>a;)s=((m=g*(m=E[--i]%_)+(o=k*m+(h=E[i]/_|0)*g)%_*_+b[r]+s)/w|0)+(o/_|0)+k*h,b[r--]=m%w;b[r]=s}return s?++n:b.splice(0,1),K(e,b,n)},j.negated=function(){var e=new W(this);return e.s=-e.s||null,e},j.plus=function(e,t){var s,n=this,a=n.s;if(t=(e=new W(e,t)).s,!a||!t)return new W(NaN);if(a!=t)return e.s=-t,n.minus(e);var r=n.e/d,i=e.e/d,o=n.c,l=e.c;if(!r||!i){if(!o||!l)return new W(a/0);if(!o[0]||!l[0])return l[0]?e:new W(o[0]?n:0*a)}if(r=f(r),i=f(i),o=o.slice(),a=r-i){for(a>0?(i=r,s=l):(a=-a,s=o),s.reverse();a--;s.push(0));s.reverse()}for((a=o.length)-(t=l.length)<0&&(s=l,l=o,o=s,t=a),a=0;t;)a=(o[--t]=o[t]+l[t]+a)/c|0,o[t]=c===o[t]?0:o[t]%c;return a&&(o=[a].concat(o),++i),K(e,o,i)},j.precision=j.sd=function(e,t){var s,n,a,r=this;if(null!=e&&e!==!!e)return k(e,1,h),null==t?t=N:k(t,0,8),Y(new W(r),e,t);if(!(s=r.c))return null;if(n=(a=s.length-1)*d+1,a=s[a]){for(;a%10==0;a/=10,n--);for(a=s[0];a>=10;a/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},j.shiftedBy=function(e){return k(e,-9007199254740991,l),this.times("1e"+e)},j.squareRoot=j.sqrt=function(){var e,t,n,a,r,i=this,o=i.c,c=i.s,d=i.e,l=D+4,m=new W("0.5");if(1!==c||!o||!o[0])return new W(!c||c<0&&(!o||o[0])?NaN:o?i:1/0);if(0==(c=Math.sqrt(+Q(i)))||c==1/0?(((t=p(o)).length+d)%2==0&&(t+="0"),c=Math.sqrt(+t),d=f((d+1)/2)-(d<0||d%2),n=new W(t=c==1/0?"5e"+d:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+d)):n=new W(c+""),n.c[0])for((c=(d=n.e)+l)<3&&(c=0);;)if(r=n,n=m.times(r.plus(s(i,r,l,1))),p(r.c).slice(0,c)===(t=p(n.c)).slice(0,c)){if(n.e<d&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(a||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Y(n,n.e+D+2,1),e=!n.times(n).eq(i));break}if(!a&&(Y(r,r.e+D+2,0),r.times(r).eq(i))){n=r;break}l+=4,c+=4,a=1}return Y(n,n.e+D+1,N,e)},j.toExponential=function(e,t){return null!=e&&(k(e,0,h),e++),$(this,e,t,1)},j.toFixed=function(e,t){return null!=e&&(k(e,0,h),e=e+this.e+1),$(this,e,t)},j.toFormat=function(e,t,s){var n,a=this;if(null==s)null!=e&&t&&"object"==typeof t?(s=t,t=null):e&&"object"==typeof e?(s=e,e=t=null):s=H;else if("object"!=typeof s)throw Error(i+"Argument not an object: "+s);if(n=a.toFixed(e,t),a.c){var r,o=n.split("."),c=+s.groupSize,d=+s.secondaryGroupSize,l=s.groupSeparator||"",m=o[0],u=o[1],h=a.s<0,f=h?m.slice(1):m,p=f.length;if(d&&(r=c,c=d,d=r,p-=r),c>0&&p>0){for(r=p%c||c,m=f.substr(0,r);r<p;r+=c)m+=l+f.substr(r,c);d>0&&(m+=l+f.slice(r)),h&&(m="-"+m)}n=u?m+(s.decimalSeparator||"")+((d=+s.fractionGroupSize)?u.replace(new RegExp("\\d{"+d+"}\\B","g"),"$&"+(s.fractionGroupSeparator||"")):u):m}return(s.prefix||"")+n+(s.suffix||"")},j.toFraction=function(e){var t,n,a,r,o,c,l,u,h,f,g,k,b=this,w=b.c;if(null!=e&&(!(l=new W(e)).isInteger()&&(l.c||1!==l.s)||l.lt(P)))throw Error(i+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Q(l));if(!w)return new W(b);for(t=new W(P),h=n=new W(P),a=u=new W(P),k=p(w),o=t.e=k.length-b.e-1,t.c[0]=m[(c=o%d)<0?d+c:c],e=!e||l.comparedTo(t)>0?o>0?t:h:l,c=L,L=1/0,l=new W(k),u.c[0]=0;f=s(l,t,0,1),1!=(r=n.plus(f.times(a))).comparedTo(e);)n=a,a=r,h=u.plus(f.times(r=h)),u=r,t=l.minus(f.times(r=t)),l=r;return r=s(e.minus(n),a,0,1),u=u.plus(r.times(h)),n=n.plus(r.times(a)),u.s=h.s=b.s,g=s(h,a,o*=2,N).minus(b).abs().comparedTo(s(u,n,o,N).minus(b).abs())<1?[h,a]:[u,n],L=c,g},j.toNumber=function(){return+Q(this)},j.toPrecision=function(e,t){return null!=e&&k(e,1,h),$(this,e,t,2)},j.toString=function(e){var t,s=this,n=s.s,a=s.e;return null===a?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=a<=R||a>=O?w(p(s.c),a):_(p(s.c),a,"0"):10===e&&q?t=_(p((s=Y(new W(s),D+a+1,N)).c),s.e,"0"):(k(e,2,U.length,"Base"),t=T(_(p(s.c),a,"0"),10,e,n,!0)),n<0&&s.c[0]&&(t="-"+t)),t},j.valueOf=j.toJSON=function(){return Q(this)},j._isBigNumber=!0,null!=t&&W.set(t),W}(),s.default=s.BigNumber=s,"function"==typeof define&&define.amd?define(function(){return s}):void 0!==t&&t.exports?t.exports=s:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=s)}(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,s){(function(t){(function(){Object.defineProperty(s,"__esModule",{value:!0}),s.isVaultUpdated=s.updateVaultWithDetail=s.updateVault=s.generateSalt=s.serializeBufferForStorage=s.serializeBufferFromStorage=s.keyFromPassword=s.exportKey=s.importKey=s.decryptWithKey=s.decryptWithDetail=s.decrypt=s.encryptWithKey=s.encryptWithDetail=s.encrypt=void 0;const n=e("@metamask/utils"),a="jwk",r="AES-GCM",i="utf-8",o={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function d(e,t,s,n=g(),a=c){const r=s||await p(e,n,!1,a),i=await m(r,t);return i.salt=n,JSON.stringify(i)}async function l(e,t,s=g(),n=c){const a=await p(e,s,!0,n),r=await f(a);return{vault:await d(e,t,a,s),exportedKeyString:r}}async function m(e,s){const n=JSON.stringify(s),a=t.from(n,i),o=globalThis.crypto.getRandomValues(new Uint8Array(16)),c=w(e),d=await globalThis.crypto.subtle.encrypt({name:r,iv:o},c,a),l=new Uint8Array(d),m=t.from(o).toString("base64"),u={data:t.from(l).toString("base64"),iv:m};return k(e)&&(u.keyMetadata=e.derivationOptions),u}async function u(e,t,s){const n=JSON.parse(t),{salt:a,keyMetadata:r}=n,i=w(s||await p(e,a,!1,r));return await h(i,n)}async function h(e,s){const n=t.from(s.data,"base64"),a=t.from(s.iv,"base64"),o=w(e);let c;try{const e=await crypto.subtle.decrypt({name:r,iv:a},o,n),s=new Uint8Array(e),d=t.from(s).toString(i);c=JSON.parse(d)}catch(e){throw new Error("Incorrect password")}return c}async function f(e){return k(e)?JSON.stringify({key:await globalThis.crypto.subtle.exportKey(a,e.key),derivationOptions:e.derivationOptions}):JSON.stringify(await globalThis.crypto.subtle.exportKey(a,e))}async function p(e,s,n=!1,a=o){const c=t.from(e,i),d=t.from(s,"base64"),l=await globalThis.crypto.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),m=await globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:d,iterations:a.params.iterations,hash:"SHA-256"},l,{name:r,length:256},n,["encrypt","decrypt"]);return a?{key:m,derivationOptions:a}:m}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,n.isPlainObject)(e)&&(0,n.hasProperty)(e,"key")&&(0,n.hasProperty)(e,"derivationOptions")&&e.key instanceof CryptoKey&&b(e.derivationOptions)}function b(e){return(0,n.isPlainObject)(e)&&(0,n.hasProperty)(e,"algorithm")&&(0,n.hasProperty)(e,"params")}function w(e){return k(e)?e.key:e}function _(e,t=c){const{keyMetadata:s}=JSON.parse(e);return b(s)&&s.algorithm===t.algorithm&&s.params.iterations===t.params.iterations}s.encrypt=d,s.encryptWithDetail=l,s.encryptWithKey=m,s.decrypt=u,s.decryptWithDetail=async function(e,t){const s=JSON.parse(t),{salt:n,keyMetadata:a}=s,r=await p(e,n,!0,a);return{exportedKeyString:await f(r),vault:await u(e,t,r),salt:n}},s.decryptWithKey=h,s.importKey=async function(e){const t=JSON.parse(e);return s=t,(0,n.isPlainObject)(s)&&(0,n.hasProperty)(s,"key")&&(0,n.hasProperty)(s,"derivationOptions")&&b(s.derivationOptions)?{key:await globalThis.crypto.subtle.importKey(a,t.key,r,!0,["encrypt","decrypt"]),derivationOptions:t.derivationOptions}:await globalThis.crypto.subtle.importKey(a,t,r,!0,["encrypt","decrypt"]);var s},s.exportKey=f,s.keyFromPassword=p,s.serializeBufferFromStorage=function(e){const t="0x"===e.slice(0,2)?e.slice(2):e,s=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const n=t.substr(e,2);s[e/2]=parseInt(n,16)}return s},s.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},s.generateSalt=g,s.updateVault=async function(e,t,s=c){return _(e,s)?e:d(t,await u(t,e),undefined,undefined,s)},s.updateVaultWithDetail=async function(e,t,s=c){return _(e.vault,s)?e:l(t,await u(t,e.vault),undefined,s)},s.isVaultUpdated=_}).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,s){var n,a,r=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},i=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.DelegationController=s.controllerName=void 0;const o=e("@metamask/base-controller"),c=e("@metamask/keyring-controller"),d=e("@metamask/utils"),l=e("./constants.cjs"),m=e("./utils.cjs");s.controllerName="DelegationController";const u={delegations:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};class h extends o.BaseController{constructor({messenger:e,state:t,hashDelegation:i,getDelegationEnvironment:o}){super({messenger:e,metadata:u,name:s.controllerName,state:{delegations:{},...t}}),n.set(this,void 0),a.set(this,void 0),r(this,n,i,"f"),r(this,a,o,"f")}async signDelegation(e){const{delegation:t,chainId:s}=e,{DelegationManager:n}=i(this,a,"f").call(this,s),r=(0,m.createTypedMessageParams)({chainId:(0,d.hexToNumber)(s),from:t.delegator,delegation:{...t,signature:"0x"},verifyingContract:n});return await this.messenger.call("KeyringController:signTypedMessage",r,c.SignTypedDataVersion.V4)}store(e){const{entry:t}=e,s=i(this,n,"f").call(this,t.delegation);if(!(0,m.isHexEqual)(t.delegation.authority,l.ROOT_AUTHORITY)&&!this.state.delegations[t.delegation.authority])throw new Error("Invalid authority");this.update(e=>{e.delegations[s]=t})}list(e){const t=this.messenger.call("AccountsController:getSelectedAccount").address;let s=Object.values(this.state.delegations);e?.from&&(s=s.filter(t=>(0,m.isHexEqual)(t.delegation.delegator,e.from))),(!e?.from||e?.from&&!(0,m.isHexEqual)(e.from,t))&&(s=s.filter(e=>(0,m.isHexEqual)(e.delegation.delegate,t)));const n=e?.chainId;n&&(s=s.filter(e=>(0,m.isHexEqual)(e.chainId,n)));const a=e?.tags;return a&&a.length>0&&(s=s.filter(e=>a.every(t=>e.tags.includes(t)))),s}retrieve(e){return this.state.delegations[e]??null}chain(e){const t=[],s=this.retrieve(e);if(!s)return null;t.push(s);for(let e=s.delegation.authority;e!==l.ROOT_AUTHORITY;){const s=this.retrieve(e);if(!s)throw new Error("Invalid delegation chain");t.push(s),e=s.delegation.authority}return t}delete(e){if(!this.retrieve(e))return 0;const t=Object.entries(this.state.delegations),s=[e],n=[];for(;s.length>0;){const e=s.pop();t.filter(([t,s])=>s.delegation.authority===e).forEach(([e])=>{s.push(e)}),n.push(e)}return this.update(e=>{n.forEach(t=>{delete e.delegations[t]})}),n.length}}s.DelegationController=h,n=new WeakMap,a=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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SIGNABLE_DELEGATION_TYPED_DATA=s.ROOT_AUTHORITY=void 0,s.ROOT_AUTHORITY="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.DelegationController=void 0;var n=e("./DelegationController.cjs");Object.defineProperty(s,"DelegationController",{enumerable:!0,get:function(){return n.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createTypedMessageParams=s.toDelegationStruct=s.isHexEqual=void 0;const n=e("@metamask/utils"),a=e("./constants.cjs");s.isHexEqual=function(e,t){return e.toLowerCase()===t.toLowerCase()};s.toDelegationStruct=e=>{const t=e.caveats.map(e=>({enforcer:(0,n.getChecksumAddress)(e.enforcer),terms:e.terms,args:e.args})),s="0x"===e.salt?0n:BigInt(e.salt);return{delegate:(0,n.getChecksumAddress)(e.delegate),delegator:(0,n.getChecksumAddress)(e.delegator),authority:e.authority,caveats:t,salt:s,signature:e.signature}},s.createTypedMessageParams=function(e){const{chainId:t,from:n,delegation:r,verifyingContract:i}=e;return{data:{types:a.SIGNABLE_DELEGATION_TYPED_DATA,primaryType:"Delegation",domain:{chainId:t,name:"DelegationManager",version:"1",verifyingContract:i},message:(0,s.toDelegationStruct)(r)},from:n}}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0});var n={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"},a={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"},r={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"},i={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},o={"1.0.0":{[i.optimism]:r,[i.polygon]:r,[i.base]:r,[i.arbitrum]:r,[i.linea]:r,[i.sepolia]:{...r,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"},[i.lineaSepolia]:{...r,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"}},"1.1.0":{[i.arbitrum]:a,[i.base]:a,[i.linea]:a,[i.optimism]:a,[i.polygon]:a,[i.sepolia]:a,[i.lineaSepolia]:a,[i.baseSepolia]:{...a,SimpleFactory:"0xE8eA1DE8D6AfE400B7C8C1A81B7C29B7876b4d02"}},"1.3.0":{[i.mainnet]:n,[i.polygon]:n,[i.bsc]:n,[i.optimism]:n,[i.arbitrum]:n,[i.ink]:n,[i.linea]:n,[i.base]:n,[i.gnosis]:n,[i.berachain]:n,[i.unichain]:n,[i.arbitrumNova]:n,[i.sei]:n,[i.sonic]:n,[i.monad]:n,[i.bscTestnet]:n,[i.citreaTestnet]:n,[i.megaEthTestnet]:n,[i.chiado]:n,[i.lineaSepolia]:n,[i.berachainBepolia]:n,[i.baseSepolia]:n,[i.arbitrumSepolia]:n,[i.sepolia]:n,[i.optimismSepolia]:n,[i.unichainSepolia]:n,[i.polygonAmoy]:n,[i.inkSepolia]:n,[i.monadTestnet]:n,[i.seiTestnet]:n,[i.sonicTestnet]:n,[i.hoodiTestnet]:n}};s.CHAIN_ID=i,s.DELEGATOR_CONTRACTS=o}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.GetCallsStatusCode=s.EIP7682ErrorCode=s.EIP5792ErrorCode=s.SupportedCapabilities=s.MessageType=s.KEYRING_TYPES_SUPPORTING_7702=s.VERSION=void 0;const n=e("@metamask/keyring-controller");var a,r,i,o,c;s.VERSION="2.0.0",s.KEYRING_TYPES_SUPPORTING_7702=[n.KeyringTypes.hd,n.KeyringTypes.simple],function(e){e.SendTransaction="eth_sendTransaction"}(a||(s.MessageType=a={})),function(e){e.AuxiliaryFunds="auxiliaryFunds"}(r||(s.SupportedCapabilities=r={})),function(e){e[e.UnsupportedNonOptionalCapability=5700]="UnsupportedNonOptionalCapability",e[e.UnsupportedChainId=5710]="UnsupportedChainId",e[e.UnknownBundleId=5730]="UnknownBundleId",e[e.RejectedUpgrade=5750]="RejectedUpgrade"}(i||(s.EIP5792ErrorCode=i={})),function(e){e[e.UnsupportedAsset=5771]="UnsupportedAsset",e[e.UnsupportedChain=5772]="UnsupportedChain",e[e.MalformedRequiredAssets=5773]="MalformedRequiredAssets"}(o||(s.EIP7682ErrorCode=o={})),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||(s.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/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getCallsStatus=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/transaction-controller"),r=e("../constants.cjs");s.getCallsStatus=function(e,t){const s=e.call("TransactionController:getState").transactions.filter(e=>e.batchId===t);if(!s?.length)throw new n.JsonRpcError(r.EIP5792ErrorCode.UnknownBundleId,"No matching bundle found");const i=s[0],{chainId:o,txReceipt:c}=i,d=function(e){const{hash:t,status:s}=e;if(s===a.TransactionStatus.confirmed)return r.GetCallsStatusCode.CONFIRMED;if(s===a.TransactionStatus.failed)return t?r.GetCallsStatusCode.REVERTED:r.GetCallsStatusCode.FAILED_OFFCHAIN;if(s===a.TransactionStatus.dropped)return r.GetCallsStatusCode.REVERTED;return r.GetCallsStatusCode.PENDING}(i),l=c,m=l?.logs??[],u=l&&[{blockHash:l.blockHash,blockNumber:l.blockNumber,gasUsed:l.gasUsed,logs:m.map(e=>({address:e.address,data:e.data,topics:e.topics})),status:l.status,transactionHash:l.transactionHash}];return{version:r.VERSION,id:t,chainId:o,atomic:!0,status:d,receipts:u}}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getCapabilities=void 0;const n=e("../constants.cjs"),a=e("../utils.cjs");s.getCapabilities=async function(e,t,s,r){const{getDismissSmartAccountSuggestionEnabled:i,getIsSmartTransaction:o,isAtomicBatchSupported:c,isRelaySupported:d,getSendBundleSupportedChains:l,isAuxiliaryFundsSupported:m}=e;let u=r?.map(e=>e.toLowerCase());if(!u?.length){const e=t.call("NetworkController:getState").networkConfigurationsByChainId;u=Object.keys(e)}const h=await c({address:s,chainIds:u}),f=await async function(e,t,s,n,a,r){const i=r.call("PreferencesController:getState").useTransactionSimulations,o=await Promise.all(t.map(({chainId:e})=>e).map(e=>n(e))),c=await a(e),d=t.map((e,t)=>({...e,relaySupportedForChain:o[t]}));return e.reduce((e,t)=>{const n=d.find(({chainId:e})=>e===t)??{},{isSupported:a=!1,relaySupportedForChain:r}=n,o=s(t),l=c[t]??!1;return i&&(o&&l||a&&r)&&(e[t]={alternateGasFees:{supported:!0}}),e},{})}(u,h,o,d,l,t);return u.reduce((e,r)=>{const o=h.find(({chainId:e})=>e===r)??{},{delegationAddress:c,isSupported:d,upgradeContractAddress:l}=o,u=i();let f=!1;try{const e=(0,a.getAccountKeyringType)(s,t);f=n.KEYRING_TYPES_SUPPORTING_7702.includes(e)}catch{}if(!d&&!(!u&&l&&!c&&f))return e;const p=d?"supported":"ready",g=r;return e[g]===undefined&&(e[g]={}),e[g].atomic={status:p},f&&m(r)&&(e[g].auxiliaryFunds={supported:!0}),e},f)}}}},{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/eip-5792-middleware/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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.processSendCalls=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/transaction-controller"),r=e("@metamask/utils"),i=e("lodash"),o=e("uuid"),c=e("../constants.cjs"),d=e("../utils.cjs");function l(e){const{version:t}=e;if(t!==c.VERSION)throw n.rpcErrors.invalidInput(`Version not supported: Got ${t}, expected ${c.VERSION}`)}function m(e,t){const{chainId:s}=e;if(s&&s.toLowerCase()!==t.toLowerCase())throw n.rpcErrors.invalidParams(`Chain ID must match the dApp selected network: Got ${s}, expected ${t}`)}function u(e,t,s){const{calls:a,capabilities:r,chainId:i}=e,o=[...Object.keys(r??{}).filter(e=>e!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==r?.[e].optional),...a.flatMap(e=>Object.keys(e.capabilities??{}).filter(t=>t!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==e.capabilities?.[t].optional))];if(o?.length)throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capabilities: ${o.join(", ")}`);r?.auxiliaryFunds&&h({auxiliaryFunds:r.auxiliaryFunds,chainId:i,keyringType:t,isAuxiliaryFundsSupported:s});for(const e of a)e.capabilities?.auxiliaryFunds&&h({auxiliaryFunds:e.capabilities.auxiliaryFunds,chainId:i,keyringType:t,isAuxiliaryFundsSupported:s})}function h({auxiliaryFunds:e,chainId:t,keyringType:s,isAuxiliaryFundsSupported:a}){if(e.optional)return;if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(s))throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capability: ${c.SupportedCapabilities.AuxiliaryFunds}`);if(!a(t))throw new n.JsonRpcError(c.EIP7682ErrorCode.UnsupportedChain,`The wallet no longer supports auxiliary funds on the requested chain: ${t}`);if(e?.requiredAssets)for(const t of e.requiredAssets)if("erc20"!==t.standard)throw new n.JsonRpcError(c.EIP7682ErrorCode.UnsupportedAsset,`The requested asset ${t.address} is not available through the wallet’s auxiliary fund system: unsupported token standard ${t.standard}`)}function f(e){const t=[...e.capabilities?.auxiliaryFunds?.requiredAssets??[],...e.calls.flatMap(e=>e.capabilities?.auxiliaryFunds?.requiredAssets??[])];if(0===t.length)return undefined;const s=(0,i.groupBy)(t,e=>`${e.address.toLowerCase()}-${e.standard}`);return Object.values(s).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,r.add0x)(t.toString(16))}})}s.processSendCalls=async function(e,t,s,i){const{addTransactionBatch:h,addTransaction:p,getDismissSmartAccountSuggestionEnabled:g,isAtomicBatchSupported:k,validateSecurity:b,getPermittedAccountsForOrigin:w,isAuxiliaryFundsSupported:_}=e,{calls:T,from:E}=s,{networkClientId:S,origin:I}=i,A=T.map(e=>({params:e})),{chainId:y}=t.call("NetworkController:getNetworkClientById",S).configuration,[x]=await w(),v=E??x;if(!v)throw n.providerErrors.unauthorized();const C=(0,o.v4)(),j=b.bind(null,C),P=i.id?String(i.id):"";let D;return D=1===Object.keys(A).length?await async function({addTransaction:e,chainId:t,from:s,messenger:n,networkClientId:i,origin:h,requestId:p,securityAlertId:g,sendCalls:k,transactions:b,validateSecurity:w,isAuxiliaryFundsSupported:_}){const T=(0,d.getAccountKeyringType)(s,n);!function(e,t,s,n){l(e),u(e,s,n),m(e,t)}(k,t,T,_);const E={from:s,...b[0].params,type:a.TransactionEnvelopeType.feeMarket},S={method:c.MessageType.SendTransaction,params:[E],origin:h};w(S,t);const I=f(k),A=function(){const e=(0,o.v4)(),t=new Uint8Array((0,o.parse)(e));return(0,r.bytesToHex)(t)}();return await e(E,{batchId:A,networkClientId:i,origin:h,requestId:p,requiredAssets:I,securityAlertResponse:{securityAlertId:g}}),A}({addTransaction:p,chainId:y,from:v,messenger:t,networkClientId:S,origin:I,requestId:P,securityAlertId:C,sendCalls:s,transactions:A,validateSecurity:j,isAuxiliaryFundsSupported:_}):await async function({addTransactionBatch:e,isAtomicBatchSupported:t,chainId:s,from:a,getDismissSmartAccountSuggestionEnabled:r,networkClientId:i,messenger:o,origin:h,requestId:p,sendCalls:g,securityAlertId:k,transactions:b,validateSecurity:w,isAuxiliaryFundsSupported:_}){const T=await t({address:a,chainIds:[s]}),E=T?.[0],S=(0,d.getAccountKeyringType)(a,o),I=r();!function(e,t,s,a,r,i){l(e),function(e,t,s){if(m(e,t),!s)throw new n.JsonRpcError(c.EIP5792ErrorCode.UnsupportedChainId,`EIP-7702 not supported on chain: ${t}`)}(e,t,a),u(e,r,i),function(e,t,s){if(t?.delegationAddress)return;if(e)throw new n.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade disabled by the user");if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(s))throw new n.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported on account")}(s,a,r)}(g,s,I,E,S,_);const A=f(g),y=await e({from:a,networkClientId:i,origin:h,requestId:p,requiredAssets:A,securityAlertId:k,transactions:b,validateSecurity:w});return y.batchId}({addTransactionBatch:h,isAtomicBatchSupported:k,chainId:y,from:v,getDismissSmartAccountSuggestionEnabled:g,messenger:t,networkClientId:S,origin:I,requestId:P,sendCalls:s,securityAlertId:C,transactions:A,validateSecurity:j,isAuxiliaryFundsSupported:_}),{id:D}}}}},{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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCapabilities=s.walletGetCallsStatus=s.walletSendCalls=s.getCapabilities=s.getCallsStatus=s.processSendCalls=void 0;var n=e("./hooks/processSendCalls.cjs");Object.defineProperty(s,"processSendCalls",{enumerable:!0,get:function(){return n.processSendCalls}});var a=e("./hooks/getCallsStatus.cjs");Object.defineProperty(s,"getCallsStatus",{enumerable:!0,get:function(){return a.getCallsStatus}});var r=e("./hooks/getCapabilities.cjs");Object.defineProperty(s,"getCapabilities",{enumerable:!0,get:function(){return r.getCapabilities}});var i=e("./methods/wallet_sendCalls.cjs");Object.defineProperty(s,"walletSendCalls",{enumerable:!0,get:function(){return i.walletSendCalls}});var o=e("./methods/wallet_getCallsStatus.cjs");Object.defineProperty(s,"walletGetCallsStatus",{enumerable:!0,get:function(){return o.walletGetCallsStatus}});var c=e("./methods/wallet_getCapabilities.cjs");Object.defineProperty(s,"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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCallsStatus=void 0;const n=e("@metamask/rpc-errors"),a=e("../types.cjs"),r=e("../utils.cjs");s.walletGetCallsStatus=async function(e,t,{getCallsStatus:s}){if(!s)throw n.rpcErrors.methodNotSupported();(0,r.validateParams)(e.params,a.GetCallsStatusStruct);const i=e.params[0];t.result=await s(i,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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletGetCapabilities=void 0;const n=e("@metamask/rpc-errors"),a=e("../types.cjs"),r=e("../utils.cjs");s.walletGetCapabilities=async function(e,t,{getPermittedAccountsForOrigin:s,getCapabilities:i}){if(!i)throw n.rpcErrors.methodNotSupported();(0,r.validateParams)(e.params,a.GetCapabilitiesStruct);const o=e.params[0],c=e.params[1];await(0,r.validateAndNormalizeKeyholder)(o,{getPermittedAccountsForOrigin:s});const d=await i(o,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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.walletSendCalls=void 0;const n=e("@metamask/rpc-errors"),a=e("../types.cjs"),r=e("../utils.cjs");s.walletSendCalls=async function(e,t,{getPermittedAccountsForOrigin:s,processSendCalls:i}){if(!i)throw n.rpcErrors.methodNotSupported();(0,r.validateParams)(e.params,a.SendCallsStruct);const o=e.params[0],c=o.from?await(0,r.validateAndNormalizeKeyholder)(o.from,{getPermittedAccountsForOrigin:s}):undefined,d={...o,from:c};t.result=await i(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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SendCallsStruct=s.CapabilitiesStruct=s.GetCapabilitiesStruct=s.GetCallsStatusStruct=void 0;const n=e("@metamask/superstruct"),a=e("@metamask/utils");s.GetCallsStatusStruct=(0,n.tuple)([a.StrictHexStruct]),s.GetCapabilitiesStruct=(0,n.tuple)([a.HexChecksumAddressStruct,(0,n.optional)((0,n.array)(a.StrictHexStruct))]);const r=(0,n.type)({address:(0,n.nonempty)(a.HexChecksumAddressStruct),amount:(0,n.nonempty)(a.StrictHexStruct),standard:(0,n.nonempty)((0,n.string)())});s.CapabilitiesStruct=(0,n.record)((0,n.string)(),(0,n.type)({optional:(0,n.optional)((0,n.boolean)()),requiredAssets:(0,n.optional)((0,n.array)(r))})),s.SendCallsStruct=(0,n.tuple)([(0,n.object)({version:(0,n.nonempty)((0,n.string)()),id:(0,n.optional)(a.StrictHexStruct),from:(0,n.optional)(a.HexChecksumAddressStruct),chainId:a.StrictHexStruct,atomicRequired:(0,n.boolean)(),calls:(0,n.array)((0,n.object)({to:(0,n.optional)(a.HexChecksumAddressStruct),data:(0,n.optional)(a.StrictHexStruct),value:(0,n.optional)(a.StrictHexStruct),capabilities:(0,n.optional)(s.CapabilitiesStruct)})),capabilities:(0,n.optional)(s.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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.resemblesAddress=s.validateParams=s.validateAndNormalizeKeyholder=s.getAccountKeyringType=void 0;const n=e("@metamask/rpc-errors"),a=e("@metamask/superstruct"),r=e("./constants.cjs");function i(e){return 42===e.length}s.getAccountKeyringType=function(e,t){const{accounts:s}=t.call("AccountsController:getState").internalAccounts,a=Object.values(s).find(t=>t.address.toLowerCase()===e.toLowerCase()),i=a?.metadata?.keyring?.type;if(!i)throw new n.JsonRpcError(r.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported as account type is unknown");return i},s.validateAndNormalizeKeyholder=async function(e,{getPermittedAccountsForOrigin:t}){if("string"==typeof e&&e.length>0&&i(e)){const s=(await t()).map(e=>e.toLowerCase()),a=e.toLowerCase();if(s.includes(a))return a;throw n.providerErrors.unauthorized()}throw n.rpcErrors.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})},s.validateParams=function(e,t){const[s]=(0,a.validate)(e,t);if(s)throw n.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(s,"Invalid params"))},s.resemblesAddress=i}}},{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-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs",{"./gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","./gas-flows/LineaGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs","./gas-flows/OptimismLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs","./gas-flows/RandomisedEstimationsGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs","./gas-flows/ScrollLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs","./gas-flows/TestGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs","./helpers/AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs","./helpers/GasFeePoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs","./helpers/IncomingTransactionHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs","./helpers/MethodDataHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs","./helpers/MultichainTrackingHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs","./helpers/PendingTransactionTracker.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs","./helpers/ResimulateHelper.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs","./hooks/ExtraTransactionsPublishHook.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils/balance-changes.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs","./utils/batch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/batch.cjs","./utils/eip7702.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/eip7702.cjs","./utils/external-transactions.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/external-transactions.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","./utils/first-time-interaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/first-time-interaction.cjs","./utils/gas-fee-tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fee-tokens.cjs","./utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","./utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./utils/gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas.cjs","./utils/layer1-gas-fee-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/layer1-gas-fee-flow.cjs","./utils/nonce.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/nonce.cjs","./utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","./utils/retry.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/retry.cjs","./utils/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/swaps.cjs","./utils/transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","./utils/validation.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/validation.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/network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/network-controller/dist/index.cjs","@metamask/nonce-tracker":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/nonce-tracker/dist/index.js","@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",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js",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,s){var n,a,r,i,o,c,d,l,m,u,h,f,p,g,k,b,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R,O,M,L,F,B,G,H,U,q,W,$,V,K,Y,Q,z,J,X,Z,ee,te,se,ne,ae,re,ie,oe,ce,de,le,me,ue,he,fe,pe,ge,ke,be,we,_e,Te,Ee,Se,Ie,Ae,ye,xe,ve,Ce,je,Pe,De,Ne,Re,Oe,Me,Le,Fe,Be,Ge,He,Ue,qe,We,$e,Ve,Ke,Ye,Qe,ze,Je,Xe,Ze,et,tt=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},st=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},nt=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.TransactionController=s.ApprovalState=s.SPEED_UP_RATE=s.CANCEL_RATE=void 0;const at=e("@metamask/base-controller"),rt=e("@metamask/controller-utils"),it=nt(e("@metamask/eth-query")),ot=e("@metamask/network-controller"),ct=e("@metamask/nonce-tracker"),dt=e("@metamask/rpc-errors"),lt=e("@metamask/utils"),mt=e("events"),ut=e("lodash"),ht=e("uuid"),ft=e("./gas-flows/DefaultGasFeeFlow.cjs"),pt=e("./gas-flows/LineaGasFeeFlow.cjs"),gt=e("./gas-flows/OptimismLayer1GasFeeFlow.cjs"),kt=e("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs"),bt=e("./gas-flows/ScrollLayer1GasFeeFlow.cjs"),wt=e("./gas-flows/TestGasFeeFlow.cjs"),_t=e("./helpers/AccountsApiRemoteTransactionSource.cjs"),Tt=e("./helpers/GasFeePoller.cjs"),Et=e("./helpers/IncomingTransactionHelper.cjs"),St=e("./helpers/MethodDataHelper.cjs"),It=e("./helpers/MultichainTrackingHelper.cjs"),At=e("./helpers/PendingTransactionTracker.cjs"),yt=e("./helpers/ResimulateHelper.cjs"),xt=e("./hooks/ExtraTransactionsPublishHook.cjs"),vt=e("./logger.cjs"),Ct=e("./types.cjs"),jt=e("./utils/balance-changes.cjs"),Pt=e("./utils/batch.cjs"),Dt=e("./utils/eip7702.cjs"),Nt=e("./utils/external-transactions.cjs"),Rt=e("./utils/feature-flags.cjs"),Ot=e("./utils/first-time-interaction.cjs"),Mt=e("./utils/gas.cjs"),Lt=e("./utils/gas-fee-tokens.cjs"),Ft=e("./utils/gas-fees.cjs"),Bt=e("./utils/gas-flow.cjs"),Gt=e("./utils/layer1-gas-fee-flow.cjs"),Ht=e("./utils/nonce.cjs"),Ut=e("./utils/prepare.cjs"),qt=e("./utils/retry.cjs"),Wt=e("./utils/swaps.cjs"),$t=e("./utils/transaction-type.cjs"),Vt=e("./utils/utils.cjs"),Kt=e("./utils/validation.cjs"),Yt={transactions:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},transactionBatches:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},methodData:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},lastFetchedBlockNumbers:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1},submitHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};s.CANCEL_RATE=1.1,s.SPEED_UP_RATE=1.1;const Qt="TransactionController";var zt;!function(e){e.Approved="approved",e.NotApproved="not-approved",e.SkippedViaBeforePublishHook="skipped-via-before-publish-hook"}(zt||(s.ApprovalState=zt={}));class Jt extends at.BaseController{constructor(e){const{disableSwaps:t,getCurrentAccountEIP1559Compatibility:s,getCurrentNetworkEIP1559Compatibility:q,getExternalPendingTransactions:W,getGasFeeEstimates:$,getNetworkClientRegistry:V,getNetworkState:Y,getPermittedAccounts:Q,getSavedGasFees:z,getSimulationConfig:J,hooks:X,incomingTransactions:ee={},isAutomaticGasFeeUpdateEnabled:te,isEIP7702GasFeeTokensEnabled:se,isFirstTimeInteractionEnabled:ne,isSimulationEnabled:ae,messenger:re,pendingTransactions:ie={},publicKeyEIP7702:oe,securityProviderRequest:ce,sign:de,state:me,testGasFeeFlows:ue,trace:he}=e;super({name:Qt,metadata:Yt,messenger:re,state:{methodData:{},transactions:[],transactionBatches:[],lastFetchedBlockNumbers:{},submitHistory:[],...me}}),n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),o.set(this,new Set),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),m.set(this,void 0),u.set(this,void 0),h.set(this,void 0),f.set(this,void 0),p.set(this,void 0),g.set(this,void 0),k.set(this,void 0),b.set(this,void 0),w.set(this,void 0),_.set(this,void 0),T.set(this,void 0),E.set(this,void 0),S.set(this,new mt.EventEmitter),I.set(this,void 0),A.set(this,void 0),y.set(this,void 0),x.set(this,void 0),v.set(this,void 0),C.set(this,void 0),j.set(this,void 0),P.set(this,void 0),D.set(this,void 0),N.set(this,void 0),R.set(this,void 0),O.set(this,void 0),M.set(this,void 0),L.set(this,void 0),F.set(this,void 0),B.set(this,new Map),G.set(this,new Set),H.set(this,void 0),U.set(this,void 0),xe.set(this,()=>{st(this,D,"f").checkForPendingTransactionAndStartPolling()}),this.messenger=re,tt(this,a,X?.afterAdd??(()=>Promise.resolve({})),"f"),tt(this,r,X?.afterSign??(()=>!0),"f"),tt(this,i,X?.afterSimulate??(()=>Promise.resolve({})),"f"),tt(this,c,X?.beforeCheckPendingTransaction??(()=>Promise.resolve(!0)),"f"),tt(this,d,X?.beforePublish??(()=>Promise.resolve(!0)),"f"),tt(this,l,X?.beforeSign??(()=>Promise.resolve({})),"f"),tt(this,u,X?.getAdditionalSignArguments??(()=>[]),"f"),tt(this,h,s??(()=>Promise.resolve(!0)),"f"),tt(this,f,q,"f"),tt(this,p,W??(()=>[]),"f"),tt(this,g,$??(()=>Promise.resolve({})),"f"),tt(this,k,Y,"f"),tt(this,b,Q,"f"),tt(this,w,z??(e=>undefined),"f"),tt(this,_,J??(()=>Promise.resolve({})),"f"),tt(this,E,ee,"f"),tt(this,I,te??(e=>!1),"f"),tt(this,A,se??(()=>Promise.resolve(!1)),"f"),tt(this,y,ne??(()=>!0),"f"),tt(this,x,ae??(()=>!0),"f"),tt(this,v,t??!1,"f"),tt(this,C,X?.isTimeoutEnabled??(()=>!0),"f"),tt(this,N,ie,"f"),tt(this,R,oe,"f"),tt(this,O,X?.publish??(()=>Promise.resolve({transactionHash:undefined})),"f"),tt(this,M,X?.publishBatch,"f"),tt(this,L,ce,"f"),tt(this,F,de,"f"),tt(this,H,!0===ue,"f"),tt(this,U,he??((e,t)=>t?.()),"f");const fe=e=>this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);tt(this,D,new It.MultichainTrackingHelper({findNetworkClientIdByChainId:fe,getNetworkClientById:e=>this.messenger.call("NetworkController:getNetworkClientById",e),getNetworkClientRegistry:V,removePendingTransactionTrackerListeners:st(this,n,"m",je).bind(this),createNonceTracker:st(this,n,"m",Ae).bind(this),createPendingTransactionTracker:st(this,n,"m",ye).bind(this),onNetworkStateChange:e=>{this.messenger.subscribe("NetworkController:stateChange",e)}}),"f"),st(this,D,"f").initialize(),tt(this,m,st(this,n,"m",Oe).call(this),"f"),tt(this,j,st(this,n,"m",Me).call(this),"f");const pe=new Tt.GasFeePoller({findNetworkClientIdByChainId:fe,gasFeeFlows:st(this,m,"f"),getGasFeeControllerEstimates:st(this,g,"f"),getProvider:e=>st(this,n,"m",le).call(this,{networkClientId:e}),getTransactions:()=>this.state.transactions,getTransactionBatches:()=>this.state.transactionBatches,layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,onStateChange:e=>{this.messenger.subscribe("TransactionController:stateChange",e)}});pe.hub.on("transaction-updated",st(this,n,"m",Be).bind(this)),pe.hub.on("transaction-batch-updated",st(this,n,"m",Ge).bind(this)),tt(this,P,new St.MethodDataHelper({getProvider:e=>st(this,n,"m",le).call(this,{networkClientId:e}),getState:()=>this.state.methodData}),"f"),st(this,P,"f").hub.on("update",({fourBytePrefix:e,methodData:t})=>{this.update(s=>{s.methodData[e]=t})}),tt(this,T,new Et.IncomingTransactionHelper({client:st(this,E,"f").client,getCurrentAccount:()=>st(this,n,"m",Ue).call(this),getLocalTransactions:()=>this.state.transactions,includeTokenTransfers:st(this,E,"f").includeTokenTransfers,isEnabled:st(this,E,"f").isEnabled,messenger:this.messenger,remoteTransactionSource:new _t.AccountsApiRemoteTransactionSource,trimTransactions:st(this,n,"m",Z).bind(this),updateTransactions:st(this,E,"f").updateTransactions}),"f"),st(this,n,"m",Ce).call(this,st(this,T,"f")),this.messenger.subscribe("TransactionController:stateChange",st(this,xe,"f")),new yt.ResimulateHelper({simulateTransaction:st(this,n,"m",Fe).bind(this),onTransactionsUpdate:e=>{this.messenger.subscribe("TransactionController:stateChange",e,e=>e.transactions)},getTransactions:()=>this.state.transactions}),st(this,n,"m",K).call(this),st(this,xe,"f").call(this),st(this,n,"m",Ve).call(this)}destroy(){st(this,n,"m",ve).call(this)}async handleMethodData(e,t){return st(this,P,"f").lookup(e,t)}async addTransactionBatch(e){const{blockTracker:t}=this.messenger.call("NetworkController:getNetworkClientById",e.networkClientId);return await(0,Pt.addTransactionBatch)({addTransaction:this.addTransaction.bind(this),estimateGas:this.estimateGas.bind(this),getChainId:st(this,n,"m",oe).bind(this),getEthQuery:e=>st(this,n,"m",de).call(this,{networkClientId:e}),getGasFeeEstimates:st(this,g,"f"),getInternalAccounts:st(this,n,"m",qe).bind(this),getSimulationConfig:st(this,_,"f").bind(this),getPendingTransactionTracker:e=>st(this,n,"m",ye).call(this,{provider:st(this,n,"m",le).call(this,{networkClientId:e}),blockTracker:t,chainId:st(this,n,"m",oe).call(this,e),networkClientId:e}),getTransaction:e=>st(this,n,"m",ae).call(this,e),isSimulationEnabled:st(this,x,"f"),messenger:this.messenger,publishBatchHook:st(this,M,"f"),publicKeyEIP7702:st(this,R,"f"),publishTransaction:(e,t)=>st(this,n,"m",J).call(this,e,t),request:e,signTransaction:st(this,n,"m",_e).bind(this),update:this.update.bind(this),updateTransaction:st(this,n,"m",Le).bind(this)})}async isAtomicBatchSupported(e){return(0,Pt.isAtomicBatchSupported)({...e,getEthQuery:e=>st(this,n,"m",de).call(this,{chainId:e}),messenger:this.messenger,publicKeyEIP7702:st(this,R,"f")})}async addTransaction(e,t){(0,vt.projectLogger)("Adding transaction",e,t);const{actionId:s,assetsFiatValues:r,batchId:i,deviceConfirmedOn:o,disableGasBuffer:c,gasFeeToken:d,isGasFeeIncluded:l,isGasFeeSponsored:m,isStateOnly:u,method:h,nestedTransactions:f,networkClientId:p,origin:g,publishHook:k,requestId:w,requiredAssets:_,requireApproval:T,securityAlertResponse:E,skipInitialGasEstimate:S,swaps:I={},traceContext:A,type:x}=t;if(e=(0,Vt.normalizeTransactionParams)(e),!st(this,D,"f").has(p))throw new Error(`Network client not found - ${p}`);const C=st(this,n,"m",oe).call(this,p),j=st(this,n,"m",de).call(this,{networkClientId:p}),P=g===undefined?undefined:await(st(this,b,"f")?.call(this,g)),N=st(this,n,"m",qe).call(this);await(0,Kt.validateTransactionOrigin)({data:e.data,from:e.from,internalAccounts:N,origin:g,permittedAddresses:P,txParams:e,type:x});const R=(0,Dt.getDelegationAddress)(e.from,j).catch(()=>undefined),O=await st(this,n,"m",we).call(this,p);(0,Kt.validateTxParams)(e,O,C),e.type||(0,Vt.setEnvelopeType)(e,O);if(i?.length&&this.state.transactions.some(e=>e.batchId?.toLowerCase()===i?.toLowerCase())&&g&&g!==rt.ORIGIN_METAMASK)throw new dt.JsonRpcError(Kt.ErrorCode.DuplicateBundleId,"Batch ID already exists");const M=st(this,n,"m",ue).call(this,e,g),F=x??(await(0,$t.determineTransactionType)(e,j)).type,B=st(this,n,"m",ge).call(this,s);let G=B?(0,ut.cloneDeep)(B):{actionId:s,assetsFiatValues:r,batchId:i,chainId:C,dappSuggestedGasFees:M,deviceConfirmedOn:o,disableGasBuffer:c,id:(0,ht.v1)(),isGasFeeTokenIgnoredIfBalance:Boolean(d),isGasFeeIncluded:l,isGasFeeSponsored:m,isFirstTimeInteraction:undefined,isStateOnly:u,nestedTransactions:f,networkClientId:p,origin:g,requestId:w,requiredAssets:_,securityAlertResponse:E,selectedGasFeeToken:d,status:Ct.TransactionStatus.unapproved,time:Date.now(),txParams:e,type:F,userEditedGasLimit:!1,verifiedOnBlockchain:!1};const{updateTransaction:H}=await st(this,a,"f").call(this,{transactionMeta:G});if(H&&((0,vt.projectLogger)("Updating transaction using afterAdd hook"),G.txParamsOriginal=(0,ut.cloneDeep)(G.txParams),H(G)),S){const e=(0,ut.cloneDeep)(G);st(this,n,"m",V).call(this,e).then(()=>(st(this,n,"m",Le).call(this,{transactionId:e.id,skipResimulateCheck:!0,skipValidation:!0},t=>{t.txParams.gas=e.txParams.gas,t.txParams.gasPrice=e.txParams.gasPrice,t.txParams.maxFeePerGas=e.txParams.maxFeePerGas,t.txParams.maxPriorityFeePerGas=e.txParams.maxPriorityFeePerGas}),undefined)).catch(ut.noop)}else await st(this,U,"f").call(this,{name:"Estimate Gas Properties",parentContext:A},e=>st(this,n,"m",V).call(this,G,{traceContext:e}));if(!B){if(h&&st(this,L,"f")){const e=await st(this,L,"f").call(this,G,h);G.securityProviderResponse=e}G=(0,Wt.updateSwapsTransaction)(G,F,I,{isSwapsDisabled:st(this,v,"f"),cancelTransaction:st(this,n,"m",X).bind(this),messenger:this.messenger}),st(this,n,"m",$).call(this,G),R.then(e=>(st(this,n,"m",Le).call(this,{transactionId:G.id,skipResimulateCheck:!0,skipValidation:!0},t=>{t.delegationAddress=e}),undefined)).catch(ut.noop),!1===T||u?(0,vt.projectLogger)("Skipping simulation & first interaction update as approval not required"):(st(this,n,"m",Fe).call(this,G,{traceContext:A}).catch(e=>{throw(0,vt.projectLogger)("Error while updating simulation data",e),e}),(0,Ot.updateFirstTimeInteraction)({existingTransactions:this.state.transactions,getTransaction:e=>st(this,n,"m",ne).call(this,e),isFirstTimeInteractionEnabled:st(this,y,"f"),trace:st(this,U,"f"),traceContext:A,transactionMeta:G,updateTransaction:st(this,n,"m",Le).bind(this)}).catch(e=>{(0,vt.projectLogger)("Error while updating first interaction properties",e)})),this.messenger.publish(`${Qt}:unapprovedTransactionAdded`,G)}return{result:st(this,n,"m",Q).call(this,G,{actionId:s,isExisting:Boolean(B),publishHook:k,requireApproval:T,traceContext:A}),transactionMeta:G}}startIncomingTransactionPolling(){st(this,T,"f").start()}stopIncomingTransactionPolling(){st(this,T,"f").stop()}async updateIncomingTransactions({tags:e}={}){await st(this,T,"f").update({tags:e})}async stopTransaction(e,t,{estimatedBaseFee:a,actionId:r}={}){await st(this,n,"m",q).call(this,{actionId:r,estimatedBaseFee:a,gasValues:t,label:"cancel",rate:s.CANCEL_RATE,transactionId:e,transactionType:Ct.TransactionType.cancel,prepareTransactionParams:e=>{delete e.data,e.to=e.from,e.value="0x0"},afterSubmit:e=>{this.messenger.publish(`${Qt}:transactionFinished`,e),st(this,S,"f").emit(`${e.id}:finished`,e)}})}async speedUpTransaction(e,t,{actionId:a,estimatedBaseFee:r}={}){await st(this,n,"m",q).call(this,{actionId:a,estimatedBaseFee:r,gasValues:t,label:"speed up",rate:s.SPEED_UP_RATE,transactionId:e,transactionType:Ct.TransactionType.retry,afterSubmit:e=>{this.messenger.publish(`${Qt}:speedupTransactionAdded`,e)}})}async estimateGas(e,t,{ignoreDelegationSignatures:s}={}){const a=st(this,n,"m",de).call(this,{networkClientId:t}),{estimatedGas:r,simulationFails:i}=await(0,Mt.estimateGas)({chainId:st(this,n,"m",oe).call(this,t),ethQuery:a,ignoreDelegationSignatures:s,isSimulationEnabled:st(this,x,"f").call(this),getSimulationConfig:st(this,_,"f"),messenger:this.messenger,txParams:e});return{gas:r,simulationFails:i}}async estimateGasBatch({chainId:e,from:t,transactions:s}){const a=st(this,n,"m",de).call(this,{chainId:e});return(0,Mt.estimateGasBatch)({chainId:e,ethQuery:a,from:t,getSimulationConfig:st(this,_,"f"),isAtomicBatchSupported:this.isAtomicBatchSupported.bind(this),messenger:this.messenger,transactions:s})}async estimateGasBuffered(e,t,s){const a=st(this,n,"m",de).call(this,{networkClientId:s}),{blockGasLimit:r,estimatedGas:i,simulationFails:o}=await(0,Mt.estimateGas)({chainId:st(this,n,"m",oe).call(this,s),ethQuery:a,isSimulationEnabled:st(this,x,"f").call(this),getSimulationConfig:st(this,_,"f"),messenger:this.messenger,txParams:e});return{gas:(0,Mt.addGasBuffer)(i,r,t),simulationFails:o}}updateTransaction(e,t){const{id:s}=e;st(this,n,"m",Le).call(this,{transactionId:s},()=>({...e})),(0,vt.projectLogger)("Transaction updated",{transactionId:s,note:t})}updateSecurityAlertResponse(e,t){if(!t)throw new Error("updateSecurityAlertResponse: securityAlertResponse should not be null");const s=st(this,n,"m",ne).call(this,e);if(!s)throw new Error("Cannot update security alert response as no transaction metadata found");const a={...s,securityAlertResponse:t};this.updateTransaction(a,`${Qt}:updatesecurityAlertResponse - securityAlertResponse updated`)}wipeTransactions({address:e,chainId:t}={}){if(!t&&!e)return void this.update(e=>{e.transactions=[]});const s=this.state.transactions.filter(({chainId:s,txParams:n,type:a})=>{if(!(!t||t===s))return!0;return!(!e||n.from?.toLowerCase()===e.toLowerCase()||a===Ct.TransactionType.incoming&&n.to?.toLowerCase()===e.toLowerCase())});this.update(e=>{e.transactions=st(this,n,"m",Z).call(this,s)})}updateTransactionSendFlowHistory(e,t,s){return st(this,n,"m",ae).call(this,e)}async confirmExternalTransaction(e,t,s){const a=st(this,n,"m",he).call(this,e);try{const e=a.id,r={...a,status:Ct.TransactionStatus.confirmed,txReceipt:t};s&&(r.baseFeePerGas=s),st(this,n,"m",fe).call(this,e),this.updateTransaction(r,`${Qt}:confirmExternalTransaction - Add external transaction`),st(this,n,"m",Te).call(this,r),st(this,n,"m",Ie).call(this,r).catch(e=>{throw(0,vt.projectLogger)("Error while updating post balance",e),e}),this.messenger.publish(`${Qt}:transactionConfirmed`,r)}catch(e){console.error("Failed to confirm external transaction",e)}}updateTransactionGasFees(e,{defaultGasEstimates:t,estimateUsed:s,estimateSuggested:a,gas:r,gasLimit:i,gasPrice:o,maxPriorityFeePerGas:c,maxFeePerGas:d,originalGasEstimate:l,userEditedGasLimit:m,userFeeLevel:u}){const h=st(this,n,"m",ne).call(this,e);if(!h)throw new Error("Cannot update transaction as no transaction metadata found");(0,Vt.validateIfTransactionUnapprovedOrSubmitted)(h,"updateTransactionGasFees");const f=(0,ut.cloneDeep)(h),p=h.gasFeeEstimates,g=st(this,I,"f").call(this,h),k=u,b=Object.values(Ct.GasFeeEstimateLevel).includes(k),w=p&&g&&b;w&&(0,Tt.updateTransactionGasEstimates)({txMeta:f,userFeeLevel:k});const _={gas:r,gasLimit:i};w?Object.assign(_,{gasPrice:f.txParams.gasPrice,maxPriorityFeePerGas:f.txParams.maxPriorityFeePerGas,maxFeePerGas:f.txParams.maxFeePerGas}):Object.assign(_,{gasPrice:o,maxPriorityFeePerGas:c,maxFeePerGas:d});const T={txParams:(0,ut.pickBy)(_),defaultGasEstimates:t,estimateUsed:s,estimateSuggested:a,originalGasEstimate:l,userEditedGasLimit:m,userFeeLevel:k},E=(0,ut.pickBy)(T);return st(this,n,"m",Le).call(this,{transactionId:e,skipResimulateCheck:!0},e=>{const{txParams:t,...s}=E;Object.assign(e,s),t&&Object.assign(e.txParams,t)}),st(this,n,"m",ne).call(this,e)}updatePreviousGasParams(e,{gasLimit:t,maxFeePerGas:s,maxPriorityFeePerGas:a}){const r=st(this,n,"m",ne).call(this,e);if(!r)throw new Error("Cannot update transaction as no transaction metadata found");(0,Vt.validateIfTransactionUnapprovedOrSubmitted)(r,"updatePreviousGasParams");const i={previousGas:{gasLimit:t,maxFeePerGas:s,maxPriorityFeePerGas:a}};i.previousGas=(0,ut.pickBy)(i.previousGas);const o=(0,ut.merge)({},r,i);return this.updateTransaction(o,`${Qt}:updatePreviousGasParams - Previous gas values updated`),st(this,n,"m",ne).call(this,e)}async getNonceLock(e,t){return st(this,D,"f").getNonceLock(e,t)}async updateEditableParams(e,{containerTypes:t,data:s,from:a,gas:r,gasPrice:i,maxFeePerGas:o,maxPriorityFeePerGas:c,to:d,updateType:l,value:m}){const u=st(this,n,"m",ne).call(this,e);if(!u)throw new Error("Cannot update editable params as no transaction metadata found");(0,Vt.validateIfTransactionUnapproved)(u,"updateEditableParams");const h={txParams:{data:s,from:a,to:d,value:m,gas:r,gasPrice:i,maxFeePerGas:o,maxPriorityFeePerGas:c}};h.txParams=(0,ut.pickBy)(h.txParams);const f=(0,ut.merge)({},u,h),{networkClientId:p}=u,g=st(this,n,"m",le).call(this,{networkClientId:p}),k=new it.default(g);if(!1!==l){const{type:e}=await(0,$t.determineTransactionType)(f.txParams,k);f.type=e}return t&&(f.containerTypes=t),await(0,Gt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,provider:g,transactionMeta:f}),this.updateTransaction(f,`Update Editable Params for ${e}`),st(this,n,"m",ne).call(this,e)}setTransactionActive(e,t){if(!st(this,n,"m",ne).call(this,e))throw new Error(`Transaction with id ${e} not found`);st(this,n,"m",Le).call(this,{transactionId:e,skipValidation:!0,skipResimulateCheck:!0},e=>{e.isActive=t})}async approveTransactionsWithSameNonce(e=[],{hasNonce:t}={}){if((0,vt.projectLogger)("Approving transactions with same nonce",{transactions:e}),0===e.length)return"";const s=e[0],{chainId:a}=s,r=st(this,n,"m",ce).call(this,{chainId:a}),i=(0,Ut.prepareTransaction)(a,s),c=(0,Ut.serializeTransaction)(i);if(st(this,o,"f").has(c))return"";let d,l;st(this,o,"f").add(c);try{const a=s.from;l=!0!==t?await this.getNonceLock(a,r):undefined;const i=l?(0,lt.add0x)(l.nextNonce.toString(16)):s.nonce;l&&(0,vt.projectLogger)("Using nonce from nonce tracker",i,l.nonceDetails),d=await Promise.all(e.map(e=>(e.nonce=i,st(this,n,"m",W).call(this,e.chainId,e))))}catch(e){throw(0,vt.projectLogger)("Error while signing transactions with same nonce",e),e}finally{l?.releaseLock(),st(this,o,"f").delete(c)}return d}updateCustodialTransaction(e){const{transactionId:t,errorMessage:s,hash:a,status:r,gasLimit:i,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:l,type:m}=e,u=st(this,n,"m",ne).call(this,t);if(!u)throw new Error("Cannot update custodial transaction as no transaction metadata found");if(r&&![Ct.TransactionStatus.submitted,Ct.TransactionStatus.signed,Ct.TransactionStatus.failed].includes(r))throw new Error(`Cannot update custodial transaction with status: ${r}`);const h=(0,ut.merge)({},u,(0,ut.pickBy)({hash:a,status:r}));return h.status===Ct.TransactionStatus.submitted&&(h.submittedTime=(new Date).getTime()),h.status===Ct.TransactionStatus.failed&&(h.error=(0,Vt.normalizeTxError)(new Error(s))),h.txParams=(0,ut.merge)({},h.txParams,(0,ut.pickBy)({gasLimit:i,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:l,type:m})),m===Ct.TransactionEnvelopeType.legacy&&(delete h.txParams.maxFeePerGas,delete h.txParams.maxPriorityFeePerGas),this.updateTransaction(h,`${Qt}:updateCustodialTransaction - Custodial transaction updated`),r&&[Ct.TransactionStatus.submitted,Ct.TransactionStatus.failed].includes(r)&&(this.messenger.publish(`${Qt}:transactionFinished`,h),st(this,S,"f").emit(`${h.id}:finished`,h)),h}getTransactions({initialList:e,limit:t,searchCriteria:s={}}={}){const n=(0,ut.mapValues)(s,e=>"function"==typeof e?e:t=>t===e),a=e??this.state.transactions,r=(0,ut.sortBy)((0,ut.pickBy)(a,e=>{for(const[t,s]of Object.entries(n))if(t in e.txParams){if(!1===s(e.txParams[t]))return!1}else if(!1===s(e[t]))return!1;return!0}),"time");if(t!==undefined){const e=new Set,s=[];for(let n=r.length-1;n>-1;n--){const a=r[n],{nonce:i}=a.txParams;if(!e.has(i)){if(!(e.size<t))continue;e.add(i)}s.unshift(a)}return s}return r}async estimateGasFee({transactionParams:e,chainId:t,networkClientId:s}){const{id:n,provider:a}=st(this,D,"f").getNetworkClient({chainId:t,networkClientId:s}),r={txParams:e,chainId:t,networkClientId:n},i=(0,Bt.getGasFeeFlow)(r,st(this,m,"f"),this.messenger),o=new it.default(a),c=await st(this,g,"f").call(this,{networkClientId:n});return i.getGasFees({ethQuery:o,gasFeeControllerData:c,messenger:this.messenger,transactionMeta:r})}async getLayer1GasFee({transactionParams:e,chainId:t,networkClientId:s}){const a=st(this,n,"m",le).call(this,{chainId:t,networkClientId:s});return await(0,Gt.getTransactionLayer1GasFee)({layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,provider:a,transactionMeta:{txParams:e,chainId:t}})}clearUnapprovedTransactions(){const e=this.state.transactions.filter(({status:e})=>e!==Ct.TransactionStatus.unapproved);this.update(t=>{t.transactions=st(this,n,"m",Z).call(this,e)})}abortTransactionSigning(e){if(!st(this,n,"m",ne).call(this,e))throw new Error("Cannot abort signing as no transaction metadata found");const t=st(this,B,"f").get(e);if(!t)throw new Error("Cannot abort signing as transaction is not waiting for signing");t(),st(this,B,"f").delete(e)}async updateAtomicBatchData({transactionId:e,transactionIndex:t,transactionData:s}){(0,vt.projectLogger)("Updating atomic batch data",{transactionId:e,transactionIndex:t,transactionData:s});const a=st(this,n,"m",Le).call(this,{transactionId:e},e=>{const{nestedTransactions:n,txParams:a}=e,r=a.from,i=n?.[t];if(!i)throw new Error(`Nested transaction not found with index - ${t}`);i.data=s;const o=(0,Dt.generateEIP7702BatchTransaction)(r,n);e.txParams.data=o.data}),r=(0,ut.cloneDeep)({...a,txParams:{...a.txParams,gas:undefined}});return await st(this,n,"m",$e).call(this,r),st(this,n,"m",Le).call(this,{transactionId:e},e=>{e.txParams.gas=r.txParams.gas,e.simulationFails=r.simulationFails,e.gasLimitNoBuffer=r.gasLimitNoBuffer}),a.txParams.data}updateBatchTransactions({transactionId:e,batchTransactions:t}){(0,vt.projectLogger)("Updating batch transactions",{transactionId:e,batchTransactions:t}),st(this,n,"m",Le).call(this,{transactionId:e},e=>{e.batchTransactions=t})}updateSelectedGasFeeToken(e,t){st(this,n,"m",Le).call(this,{transactionId:e},e=>{const s=e.gasFeeTokens?.some(e=>e.tokenAddress.toLowerCase()===t?.toLowerCase());if(t&&!s)throw new Error(`No matching gas fee token found with address - ${t}`);e.selectedGasFeeToken=t})}updateRequiredTransactionIds({transactionId:e,requiredTransactionIds:t,append:s}){st(this,n,"m",Le).call(this,{transactionId:e},e=>{const{requiredTransactionIds:n}=e;e.requiredTransactionIds=[...n&&!1!==s?n:[],...t]})}emulateNewTransaction(e){const t=this.state.transactions.find(t=>t.id===e);t&&(t.type===Ct.TransactionType.swap?this.messenger.publish("TransactionController:transactionNewSwap",{transactionMeta:t}):t.type===Ct.TransactionType.swapApproval&&this.messenger.publish("TransactionController:transactionNewSwapApproval",{transactionMeta:t}))}emulateTransactionUpdate(e){const t={...e,txParams:{...e.txParams,from:this.messenger.call("AccountsController:getSelectedAccount").address}};this.state.transactions.some(e=>e.id===t.id)||this.update(e=>{e.transactions.push(t)}),this.updateTransaction(t,"Generated from user operation"),this.messenger.publish("TransactionController:transactionStatusUpdated",{transactionMeta:t})}}s.TransactionController=Jt,a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,k=new WeakMap,b=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,E=new WeakMap,S=new WeakMap,I=new WeakMap,A=new WeakMap,y=new WeakMap,x=new WeakMap,v=new WeakMap,C=new WeakMap,j=new WeakMap,P=new WeakMap,D=new WeakMap,N=new WeakMap,R=new WeakMap,O=new WeakMap,M=new WeakMap,L=new WeakMap,F=new WeakMap,B=new WeakMap,G=new WeakMap,H=new WeakMap,U=new WeakMap,xe=new WeakMap,n=new WeakSet,q=async function({actionId:e,afterSubmit:t,estimatedBaseFee:s,gasValues:a,label:r,prepareTransactionParams:i,rate:o,transactionId:c,transactionType:d}){if(st(this,n,"m",ge).call(this,e))return;a&&(a=(0,Vt.normalizeGasFeeValues)(a),(0,Vt.validateGasValues)(a)),(0,vt.projectLogger)(`Creating ${r} transaction`,c,a);const l=st(this,n,"m",ne).call(this,c);if(!l)return;if(!st(this,F,"f"))throw new Error("No sign method defined.");const m=(0,qt.getTransactionParamsWithIncreasedGasFee)(l.txParams,o,a);i?.(m);const u=(0,Ut.prepareTransaction)(l.chainId,m),h=await st(this,F,"f").call(this,u,l.txParams.from),f=st(this,n,"m",be).call(this,l,h),p=(0,Ut.serializeTransaction)(h),g=m.maxFeePerGas??m.gasPrice,k=m.maxFeePerGas?f.txParams.maxFeePerGas:f.txParams.gasPrice;(0,vt.projectLogger)(`Submitting ${r} transaction`,{oldFee:k,newFee:g,txParams:m});const{networkClientId:b}=l,w=st(this,n,"m",de).call(this,{networkClientId:b}),_={...f,actionId:e,estimatedBaseFee:s,id:(0,ht.v1)(),originalGasEstimate:l.txParams.gas,originalType:l.type,rawTx:p,time:Date.now(),txParams:m,type:d},T=await st(this,n,"m",Ne).call(this,w,{..._,origin:r});_.hash=T,st(this,n,"m",$).call(this,_),this.messenger.publish(`${Qt}:transactionApproved`,{transactionMeta:_,actionId:e}),this.messenger.publish(`${Qt}:transactionSubmitted`,{transactionMeta:_,actionId:e}),t?.(_)},W=async function(e,t){if(!st(this,F,"f"))throw new Error("No sign method defined.");const s=(0,Vt.normalizeTransactionParams)(t),n=(0,Vt.isEIP1559Transaction)(s)?Ct.TransactionEnvelopeType.feeMarket:Ct.TransactionEnvelopeType.legacy,a={...s,type:n,gasLimit:s.gas,chainId:e},{from:r}=a,i=(0,Ut.prepareTransaction)(e,a),o=await st(this,F,"f").call(this,i,r);return(0,Ut.serializeTransaction)(o)},$=function(e){(0,Kt.validateTxParams)(e.txParams),this.update(t=>{t.transactions=st(this,n,"m",Z).call(this,[...t.transactions,e])})},V=async function(e,{traceContext:t}={}){const s=e.txParams.type!==Ct.TransactionEnvelopeType.legacy&&await st(this,n,"m",we).call(this,e.networkClientId),{networkClientId:a}=e,r=st(this,n,"m",de).call(this,{networkClientId:a}),i=st(this,n,"m",le).call(this,{networkClientId:a});await st(this,U,"f").call(this,{name:"Update Gas",parentContext:t},async()=>{await st(this,n,"m",$e).call(this,e)}),await st(this,U,"f").call(this,{name:"Update Gas Fees",parentContext:t},async()=>await(0,Ft.updateGasFees)({eip1559:s,ethQuery:r,gasFeeFlows:st(this,m,"f"),getGasFeeEstimates:st(this,g,"f"),getSavedGasFees:st(this,w,"f").bind(this),messenger:this.messenger,txMeta:e})),await st(this,U,"f").call(this,{name:"Update Layer 1 Gas Fees",parentContext:t},async()=>await(0,Gt.updateTransactionLayer1GasFee)({layer1GasFeeFlows:st(this,j,"f"),messenger:this.messenger,provider:i,transactionMeta:e}))},K=function(){this.clearUnapprovedTransactions(),st(this,n,"m",Y).call(this)},Y=function(){const e=this.state.transactions.filter(e=>[Ct.TransactionStatus.approved,Ct.TransactionStatus.signed].includes(e.status));for(const t of e){const e=t.requiredTransactionIds??[],s=e.length>0&&e.every(e=>{const t=st(this,n,"m",ne).call(this,e);return t?.status===Ct.TransactionStatus.confirmed})?"Transaction incomplete at startup with all required transactions confirmed":"Transaction incomplete at startup";st(this,n,"m",ze).call(this,t,new Error(s));for(const t of e){const e=st(this,n,"m",ne).call(this,t);e&&!st(this,n,"m",ee).call(this,e.status)&&st(this,n,"m",ze).call(this,e,new Error("Parent transaction incomplete at startup"))}}},Q=async function(e,{actionId:t,isExisting:s=!1,publishHook:a,requireApproval:r,shouldShowRequest:i=!0,traceContext:o}){const{id:c,isStateOnly:d}=e;if(d)return st(this,n,"m",Le).call(this,{transactionId:c,skipValidation:!0},e=>{e.status=Ct.TransactionStatus.submitted,e.submittedTime=(new Date).getTime()}),"";let l;const{meta:m,isCompleted:u}=st(this,n,"m",ie).call(this,c),h=u?Promise.resolve(m):st(this,n,"m",ke).call(this,c);if(m&&!s&&!u)try{if(!1!==r){const t=await st(this,U,"f").call(this,{name:"Await Approval",parentContext:o},t=>st(this,n,"m",se).call(this,e,{shouldShowRequest:i,traceContext:t}));l=t.resultCallbacks;const s=t.value,a=s?.txMeta;a&&((0,vt.projectLogger)("Updating transaction with approval data",{customNonce:a.customNonceValue,params:a.txParams}),this.updateTransaction(a,"TransactionController#processApproval - Updated with approval data"))}const{isCompleted:s}=st(this,n,"m",ie).call(this,c);if(!s){const e=await st(this,n,"m",z).call(this,c,o,a);e===zt.SkippedViaBeforePublishHook&&l&&l.success();const s=st(this,n,"m",ne).call(this,c);e===zt.Approved&&this.messenger.publish(`${Qt}:transactionApproved`,{transactionMeta:s,actionId:t})}}catch(e){const s=e,{isCompleted:a}=st(this,n,"m",ie).call(this,c);a||(st(this,n,"m",Ye).call(this,s)?st(this,n,"m",Qe).call(this,c,t,s):st(this,n,"m",ze).call(this,m,s,t))}finally{st(this,G,"f").delete(c)}const f=await h;switch(f?.status){case Ct.TransactionStatus.failed:{const e=f.error;throw l?.error(e),dt.rpcErrors.internal(e.message)}case Ct.TransactionStatus.submitted:return l?.success(),f.hash;default:{const e=dt.rpcErrors.internal(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(f??c)}`);throw l?.error(e),e}}},z=async function(e,t,s){let a,r,i=st(this,n,"m",ae).call(this,e);(0,vt.projectLogger)("Approving transaction",i);try{if(!st(this,F,"f"))return st(this,n,"m",ze).call(this,i,new Error("No sign method defined.")),zt.NotApproved;if(!i.chainId)return st(this,n,"m",ze).call(this,i,new Error("No chainId defined.")),zt.NotApproved;if(st(this,o,"f").has(e))return(0,vt.projectLogger)("Skipping approval as signing in progress",e),zt.NotApproved;st(this,o,"f").add(e),a=()=>st(this,o,"f").delete(e);const{networkClientId:c}=i,l=st(this,n,"m",de).call(this,{networkClientId:c}),[m,u]=await(0,Ht.getNextNonce)(i,e=>st(this,D,"f").getNonceLock(e,i.networkClientId));r=u,i=st(this,n,"m",Le).call(this,{transactionId:e},e=>{const{chainId:t,txParams:s}=e,{gas:n,type:a}=s;e.status=Ct.TransactionStatus.approved,e.txParams.chainId=t,e.txParams.gasLimit=n,e.txParams.nonce=m,!a&&(0,Vt.isEIP1559Transaction)(s)&&(e.txParams.type=Ct.TransactionEnvelopeType.feeMarket)}),st(this,n,"m",Te).call(this,i);const h=await st(this,U,"f").call(this,{name:"Sign",parentContext:t},()=>st(this,n,"m",_e).call(this,i));if(i=st(this,n,"m",ae).call(this,e),!await st(this,d,"f").call(this,i))return(0,vt.projectLogger)("Skipping publishing transaction based on hook"),this.messenger.publish(`${Qt}:transactionPublishingSkipped`,i),zt.SkippedViaBeforePublishHook;if(!h&&!i.isExternalSign)return zt.NotApproved;let f;const p=i.type===Ct.TransactionType.swap;p&&((0,vt.projectLogger)("Determining pre-transaction balance"),f=await(0,rt.query)(l,"getBalance",[i.txParams.from])),(0,vt.projectLogger)("Publishing transaction",i.txParams),r?.(),r=undefined;let g=st(this,n,"m",Xe).bind(this,{ethQuery:l,publishHookOverride:s,traceContext:t});if(i.batchTransactions?.length){(0,vt.projectLogger)("Found batch transactions",i.batchTransactions);g=new xt.ExtraTransactionsPublishHook({addTransactionBatch:this.addTransactionBatch.bind(this),getTransaction:st(this,n,"m",ae).bind(this),originalPublishHook:g}).getHook()}const{transactionHash:k}=await g(i,h??"0x");return i=st(this,n,"m",Le).call(this,{transactionId:e},e=>{e.hash=k,e.status=Ct.TransactionStatus.submitted,e.submittedTime=(new Date).getTime(),p&&(e.preTxBalance=f,(0,vt.projectLogger)("Updated pre-transaction balance",f))}),this.messenger.publish(`${Qt}:transactionSubmitted`,{transactionMeta:i}),this.messenger.publish(`${Qt}:transactionFinished`,i),st(this,S,"f").emit(`${e}:finished`,i),st(this,n,"m",Te).call(this,i),zt.Approved}catch(e){return st(this,n,"m",ze).call(this,i,e),zt.NotApproved}finally{a?.(),r?.()}},J=async function(e,t,{skipSubmitHistory:s}={}){try{const a=await(0,rt.query)(e,"sendRawTransaction",[t.rawTx]);return!0!==s&&st(this,n,"m",We).call(this,t,a),a}catch(e){const t=e,s=t?.data?.message??t?.message??String(e);throw new Error(s)}},X=function(e,t,s){const a=st(this,n,"m",ne).call(this,e);if(!a)return;st(this,n,"m",Ke).call(this,e);const r={...a,status:Ct.TransactionStatus.rejected,error:(0,Vt.normalizeTxError)(s??dt.providerErrors.userRejectedRequest())};this.messenger.publish(`${Qt}:transactionFinished`,r),st(this,S,"f").emit(`${a.id}:finished`,r),this.messenger.publish(`${Qt}:transactionRejected`,{transactionMeta:r,actionId:t}),st(this,n,"m",Te).call(this,r)},Z=function(e){const t=new Set,s=(0,Rt.getTransactionHistoryLimit)(this.messenger),a=[...e].sort((e,t)=>e.time>t.time?-1:1).filter(e=>{const{chainId:a,status:r,txParams:i,time:o}=e;if(i){const e=`${String(i.nonce)}-${(0,rt.convertHexToDecimal)(a)}-${new Date(o).toDateString()}`;if(t.has(e))return!0;if(t.size<s||!st(this,n,"m",ee).call(this,r))return t.add(e),!0}return!1});return a.reverse(),a},ee=function(e){return e===Ct.TransactionStatus.rejected||e===Ct.TransactionStatus.confirmed||e===Ct.TransactionStatus.failed||e===Ct.TransactionStatus.dropped},te=function(e){return[Ct.TransactionStatus.confirmed,Ct.TransactionStatus.failed,Ct.TransactionStatus.rejected,Ct.TransactionStatus.submitted].includes(e)},se=async function(e,{shouldShowRequest:t,traceContext:s}){const a=st(this,n,"m",re).call(this,e),{origin:r}=e,i=rt.ApprovalType.Transaction,o={txId:e.id};return await st(this,U,"f").call(this,{name:"Notification Display",id:a,parentContext:s}),await this.messenger.call("ApprovalController:addRequest",{id:a,origin:r??rt.ORIGIN_METAMASK,type:i,requestData:o,expectsResult:!0},t)},ne=function(e){const{transactions:t}=this.state;return t.find(({id:t})=>t===e)},ae=function(e,t="TransactionController"){const s=st(this,n,"m",ne).call(this,e);if(!s)throw new Error(`${t}: No transaction found with id ${e}`);return s},re=function(e){return String(e.id)},ie=function(e){const t=st(this,n,"m",ne).call(this,e);if(!t)return{meta:undefined,isCompleted:!1};return{meta:t,isCompleted:st(this,n,"m",te).call(this,t.status)}},oe=function(e){return st(this,D,"f").getNetworkClient({networkClientId:e}).configuration.chainId},ce=function({chainId:e,networkClientId:t}){return t||st(this,D,"f").getNetworkClient({chainId:e}).id},de=function({chainId:e,networkClientId:t}){return new it.default(st(this,n,"m",le).call(this,{chainId:e,networkClientId:t}))},le=function({chainId:e,networkClientId:t}){return st(this,D,"f").getNetworkClient({chainId:e,networkClientId:t}).provider},me=function(e){if(!e.length)return;const t=[];for(const s of e){const{chainId:e}=s;try{const a=st(this,n,"m",ce).call(this,{chainId:e});t.push({...s,networkClientId:a})}catch(t){(0,vt.projectLogger)("Failed to get network client ID for incoming transaction",{chainId:e,error:t})}}this.update(e=>{const{transactions:s}=e;e.transactions=st(this,n,"m",Z).call(this,[...t,...s]),(0,vt.projectLogger)("Added incoming transactions to state",t.length,t)}),this.messenger.publish(`${Qt}:incomingTransactionsReceived`,t)},ue=function(e,t){if(!t||t===rt.ORIGIN_METAMASK)return undefined;const{gasPrice:s,maxFeePerGas:n,maxPriorityFeePerGas:a,gas:r}=e;if(s===undefined&&n===undefined&&a===undefined&&r===undefined)return undefined;const i={};return s!==undefined?i.gasPrice=s:n===undefined&&a===undefined||(i.maxFeePerGas=n,i.maxPriorityFeePerGas=a),r!==undefined&&(i.gas=r),i},he=function(e){const{chainId:t}=e,{transactions:s}=this.state,a=e?.txParams?.from,r=s.filter(e=>e.txParams.from===a&&e.chainId===t),i=r.filter(e=>e.status===Ct.TransactionStatus.confirmed),o=r.filter(e=>e.status===Ct.TransactionStatus.submitted);return(0,Nt.validateConfirmedExternalTransaction)(e,i,o),this.update(t=>{t.transactions=st(this,n,"m",Z).call(this,[...t.transactions,e])}),e},fe=function(e){const t=st(this,n,"m",ne).call(this,e);if(!t)return;const s=t.txParams?.nonce,a=t.txParams?.from,{chainId:r}=t,i=this.state.transactions.filter(t=>t.id!==e&&t.txParams.from===a&&s&&t.txParams.nonce===s&&t.chainId===r&&t.type!==Ct.TransactionType.incoming&&t.isTransfer===undefined),o=i.map(e=>e.id);if(0!==i.length){this.update(e=>{for(const s of e.transactions)o.includes(s.id)&&(s.replacedBy=t?.hash,s.replacedById=t?.id)});for(const e of this.state.transactions)o.includes(e.id)&&e.status!==Ct.TransactionStatus.failed&&st(this,n,"m",pe).call(this,e)}},pe=function(e){const t={...e,status:Ct.TransactionStatus.dropped};this.messenger.publish(`${Qt}:transactionDropped`,{transactionMeta:t}),this.updateTransaction(t,"TransactionController#setTransactionStatusDropped - Transaction dropped"),st(this,n,"m",Te).call(this,t)},ge=function(e){return this.state.transactions.find(t=>e&&t.actionId===e)},ke=async function(e){return new Promise(t=>{st(this,S,"f").once(`${e}:finished`,e=>{t(e)})})},be=function(e,t){const s=(0,ut.cloneDeep)(e);for(const e of["r","s","v"]){const n=t[e];n!==undefined&&null!==n&&(s[e]=(0,lt.add0x)(n.toString(16)))}return s},we=async function(e){const t=await st(this,f,"f").call(this,e),s=await st(this,h,"f").call(this);return t&&s},_e=async function(e){let t=e;const{id:s}=t;(0,vt.projectLogger)("Calling before sign hook",t);const{updateTransaction:a}=await st(this,l,"f").call(this,{transactionMeta:t})??{};a&&(st(this,n,"m",Le).call(this,{transactionId:s,skipResimulateCheck:!0},a),(0,vt.projectLogger)("Updated transaction after before sign hook")),t=st(this,n,"m",ae).call(this,s);const{networkClientId:i}=t,c=st(this,n,"m",de).call(this,{networkClientId:i});await(0,Lt.checkGasFeeTokenBeforePublish)({ethQuery:c,fetchGasFeeTokens:async e=>(await st(this,n,"m",Ze).call(this,e)).gasFeeTokens,transaction:t,updateTransaction:(e,t)=>st(this,n,"m",Le).call(this,{transactionId:e},t)}),t=st(this,n,"m",ae).call(this,s);const{chainId:d,isExternalSign:m,txParams:h}=t;if(m)return(0,vt.projectLogger)("Skipping sign as signed externally"),undefined;const{authorizationList:f,from:p}=h,g=await(0,Dt.signAuthorizationList)({authorizationList:f,messenger:this.messenger,transactionMeta:t});g&&st(this,n,"m",Le).call(this,{transactionId:s},e=>{e.txParams.authorizationList=g}),t=st(this,n,"m",ae).call(this,s);const k=st(this,n,"m",ae).call(this,s),{txParams:b}=k,w=(0,Ut.prepareTransaction)(d,b);st(this,o,"f").add(s),(0,vt.projectLogger)("Signing transaction",b);const _=await new Promise((e,t)=>{st(this,F,"f")?.call(this,w,p,...st(this,u,"f").call(this,k)).then(e,t),st(this,B,"f").set(s,()=>t(new Error("Signing aborted by user")))});if(st(this,B,"f").delete(s),!_)return(0,vt.projectLogger)("Skipping signed status as no signed transaction"),undefined;const T=(0,ut.cloneDeep)(k);if(!st(this,r,"f").call(this,T,_))return this.updateTransaction(T,"TransactionController#signTransaction - Update after sign"),(0,vt.projectLogger)("Skipping signed status based on hook"),undefined;const E={...st(this,n,"m",be).call(this,T,_),status:Ct.TransactionStatus.signed,txParams:b};this.updateTransaction(E,"TransactionController#approveTransaction - Transaction signed"),st(this,n,"m",Te).call(this,E);const S=(0,Ut.serializeTransaction)(_),I=(0,ut.merge)({},E,{rawTx:S});return this.updateTransaction(I,"TransactionController#approveTransaction - RawTransaction added"),S},Te=function(e){this.messenger.publish(`${Qt}:transactionStatusUpdated`,{transactionMeta:e})},Ee=function(e,t,s){return(0,Ht.getAndFormatTransactionsForNonceTracker)(s,t,e,this.state.transactions)},Se=function(e){(0,vt.projectLogger)("Processing confirmed transaction",e.id),st(this,n,"m",fe).call(this,e.id),this.messenger.publish(`${Qt}:transactionConfirmed`,e),st(this,n,"m",Te).call(this,e),st(this,n,"m",Ie).call(this,e).catch(e=>{throw(0,vt.projectLogger)("Error while updating post balance",e),e})},Ie=async function(e){try{const{networkClientId:t,type:s}=e;if(s!==Ct.TransactionType.swap)return;const a=st(this,n,"m",de).call(this,{networkClientId:t}),{updatedTransactionMeta:r,approvalTransactionMeta:i}=await(0,Wt.updatePostTransactionBalance)(e,{ethQuery:a,getTransaction:st(this,n,"m",ne).bind(this),updateTransaction:this.updateTransaction.bind(this)});this.messenger.publish(`${Qt}:postTransactionBalanceUpdated`,{transactionMeta:r,approvalTransactionMeta:i})}catch(e){(0,vt.projectLogger)("Error while updating post transaction balance",e)}},Ae=function({provider:e,blockTracker:t,chainId:s}){return new ct.NonceTracker({provider:e,blockTracker:t,getPendingTransactions:st(this,n,"m",De).bind(this,s),getConfirmedTransactions:st(this,n,"m",Ee).bind(this,[Ct.TransactionStatus.confirmed],s)})},ye=function({provider:e,blockTracker:t,chainId:s,networkClientId:a}){const r=new it.default(e),i=new At.PendingTransactionTracker({blockTracker:t,getChainId:()=>s,getEthQuery:()=>r,getGlobalLock:()=>st(this,D,"f").acquireNonceLockForChainIdKey({chainId:s}),getNetworkClientId:()=>a,getTransactions:()=>this.state.transactions,hooks:{beforeCheckPendingTransaction:st(this,c,"f").bind(this)},isResubmitEnabled:st(this,N,"f").isResubmitEnabled,isTimeoutEnabled:st(this,C,"f"),messenger:this.messenger,publishTransaction:(e,t)=>st(this,n,"m",J).call(this,e,t,{skipSubmitHistory:!0})});return st(this,n,"m",Pe).call(this,i),i},ve=function(){st(this,D,"f").stopAllTracking()},Ce=function(e){e.hub.on("transactions",st(this,n,"m",me).bind(this))},je=function(e){e.hub.removeAllListeners("transaction-confirmed"),e.hub.removeAllListeners("transaction-dropped"),e.hub.removeAllListeners("transaction-failed"),e.hub.removeAllListeners("transaction-updated")},Pe=function(e){e.hub.on("transaction-confirmed",st(this,n,"m",Se).bind(this)),e.hub.on("transaction-dropped",st(this,n,"m",pe).bind(this)),e.hub.on("transaction-failed",st(this,n,"m",ze).bind(this)),e.hub.on("transaction-updated",this.updateTransaction.bind(this))},De=function(e,t){return[...st(this,n,"m",Ee).call(this,[Ct.TransactionStatus.approved,Ct.TransactionStatus.signed,Ct.TransactionStatus.submitted],t,e),...st(this,p,"f").call(this,t,e)]},Ne=async function(e,t){try{return await st(this,n,"m",J).call(this,e,t)}catch(e){if(st(this,n,"m",Re).call(this,e))throw new Error("Previous transaction is already confirmed");throw e}},Re=function(e){return Boolean(e?.message?.includes("nonce too low"))||Boolean(e?.data?.message?.includes("nonce too low"))},Oe=function(){return st(this,H,"f")?[new wt.TestGasFeeFlow]:[new kt.RandomisedEstimationsGasFeeFlow,new pt.LineaGasFeeFlow,new ft.DefaultGasFeeFlow]},Me=function(){return[new gt.OptimismLayer1GasFeeFlow,new bt.ScrollLayer1GasFeeFlow]},Le=function({transactionId:e,skipValidation:t,skipResimulateCheck:s},a){let r;this.update(n=>{const i=n.transactions.findIndex(({id:t})=>t===e);if(-1===i)throw new Error(`Cannot update transaction as ID not found - ${e}`);let o=n.transactions[i];const c=(0,ut.cloneDeep)(o);o=a(o)??o,!0!==t&&(o.txParams=(0,Vt.normalizeTransactionParams)(o.txParams),(0,Kt.validateTxParams)(o.txParams)),!s&&st(this,x,"f").call(this)&&(r=(0,yt.shouldResimulate)(c,o)),n.transactions[i]=o});const i=st(this,n,"m",ne).call(this,e);return r?.resimulate&&st(this,n,"m",Fe).call(this,i,{blockTime:r.blockTime}).catch(e=>{throw(0,vt.projectLogger)("Error during re-simulation",e),e}),i},Fe=async function(e,{blockTime:t,traceContext:s}={}){const{chainId:a,id:r,nestedTransactions:i,networkClientId:o,simulationData:c,txParams:d}=e;let l,m={error:{code:Ct.SimulationErrorCode.Disabled,message:"Simulation disabled"},tokenBalanceChanges:[]},u=[],h=!1;const f=st(this,G,"f").has(r);if(st(this,x,"f").call(this)&&!f){const r=await st(this,U,"f").call(this,{name:"Simulate",parentContext:s},()=>(0,jt.getBalanceChanges)({blockTime:t,chainId:a,ethQuery:st(this,n,"m",de).call(this,{networkClientId:o}),getSimulationConfig:(t,s)=>st(this,_,"f").call(this,t,{txMeta:e,...s}),nestedTransactions:i,txParams:d}));m=r.simulationData,l=r.gasUsed,t&&c&&(0,yt.hasSimulationDataChanged)(c,m)&&(m={...m,isUpdatedAfterSecurityCheck:!0});const f=await st(this,n,"m",Ze).call(this,e);u=f?.gasFeeTokens??[],h=f?.isGasFeeSponsored??!1}if(!st(this,n,"m",ne).call(this,r))return void(0,vt.projectLogger)("Cannot update simulation data as transaction not found",r,m);const p=st(this,n,"m",Le).call(this,{transactionId:r,skipResimulateCheck:Boolean(t)},e=>{e.gasFeeTokens=u,e.isGasFeeSponsored=h,e.gasUsed=l,f||(e.simulationData=m)});(0,vt.projectLogger)("Updated simulation data",r,p),await st(this,n,"m",Je).call(this,p)},Be=function({transactionId:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:s,layer1GasFee:a}){st(this,n,"m",Le).call(this,{transactionId:e},e=>{(0,Tt.updateTransactionGasProperties)({txMeta:e,gasFeeEstimates:t,gasFeeEstimatesLoaded:s,isTxParamsGasFeeUpdatesEnabled:st(this,I,"f"),layer1GasFee:a})})},Ge=function({transactionBatchId:e,gasFeeEstimates:t}){st(this,n,"m",He).call(this,e,e=>({...e,gasFeeEstimates:t}))},He=function(e,t){this.update(s=>{const n=s.transactionBatches.findIndex(t=>t.id===e);if(-1===n)throw new Error(`Cannot update batch, ID not found - ${e}`);const a=s.transactionBatches[n],r=t(a);s.transactionBatches[n]=r??a})},Ue=function(){return this.messenger.call("AccountsController:getSelectedAccount")},qe=function(){const e=this.messenger.call("AccountsController:getState");return Object.values(e.internalAccounts?.accounts??{}).filter(e=>"eip155:eoa"===e.type).map(e=>e.address)},We=function(e,t){const{chainId:s,networkClientId:n,origin:a,rawTx:r,txParams:i}=e,{networkConfigurationsByChainId:o}=st(this,k,"f").call(this),c=o[s],d=c?.rpcEndpoints.find(e=>e.networkClientId===n),l=d?.url,m={chainId:s,hash:t,networkType:d?.name??n,networkUrl:l,origin:a,rawTransaction:r,time:Date.now(),transaction:i};(0,vt.projectLogger)("Updating submit history",m);const u=(0,Rt.getSubmitHistoryLimit)(this.messenger);this.update(e=>{const{submitHistory:t}=e;t.length>=u&&t.pop(),t.unshift(m)})},$e=async function(e){const{chainId:t,networkClientId:s}=e,a=st(this,D,"f").getNetworkClient({networkClientId:s}).configuration.type===ot.NetworkClientType.Custom,r=st(this,n,"m",de).call(this,{networkClientId:s});await(0,Mt.updateGas)({chainId:t,ethQuery:r,isCustomNetwork:a,isSimulationEnabled:st(this,x,"f").call(this),getSimulationConfig:st(this,_,"f"),messenger:this.messenger,txMeta:e})},Ve=function(){this.messenger.registerActionHandler(`${Qt}:addTransaction`,this.addTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:addTransactionBatch`,this.addTransactionBatch.bind(this)),this.messenger.registerActionHandler(`${Qt}:confirmExternalTransaction`,this.confirmExternalTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:emulateNewTransaction`,this.emulateNewTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:emulateTransactionUpdate`,this.emulateTransactionUpdate.bind(this)),this.messenger.registerActionHandler(`${Qt}:estimateGas`,this.estimateGas.bind(this)),this.messenger.registerActionHandler(`${Qt}:estimateGasBatch`,this.estimateGasBatch.bind(this)),this.messenger.registerActionHandler(`${Qt}:getGasFeeTokens`,st(this,n,"m",et).bind(this)),this.messenger.registerActionHandler(`${Qt}:getNonceLock`,this.getNonceLock.bind(this)),this.messenger.registerActionHandler(`${Qt}:getTransactions`,this.getTransactions.bind(this)),this.messenger.registerActionHandler(`${Qt}:updateCustodialTransaction`,this.updateCustodialTransaction.bind(this)),this.messenger.registerActionHandler(`${Qt}:updateTransaction`,this.updateTransaction.bind(this))},Ke=function(e){this.update(t=>{const s=t.transactions.filter(({id:t})=>t!==e);t.transactions=st(this,n,"m",Z).call(this,s)})},Ye=function(e){return[dt.errorCodes.provider.userRejectedRequest,Kt.ErrorCode.RejectedUpgrade].includes(e.code)},Qe=function(e,t,s){if(st(this,n,"m",X).call(this,e,t,s),s.code===dt.errorCodes.provider.userRejectedRequest)throw dt.providerErrors.userRejectedRequest({message:"MetaMask Tx Signature: User denied transaction signature.",data:s?.data});throw s},ze=function(e,t,s){let a;try{a=st(this,n,"m",Le).call(this,{transactionId:e.id,skipValidation:!0},e=>{e.status=Ct.TransactionStatus.failed,e.error=(0,Vt.normalizeTxError)(t)})}catch(s){(0,vt.projectLogger)("Failed to mark transaction as failed",s),a={...e,status:Ct.TransactionStatus.failed,error:(0,Vt.normalizeTxError)(t)}}this.messenger.publish(`${Qt}:transactionFailed`,{actionId:s,error:t.message,transactionMeta:a}),st(this,n,"m",Te).call(this,a),this.messenger.publish(`${Qt}:transactionFinished`,a),st(this,S,"f").emit(`${e.id}:finished`,a)},Je=async function(e){(0,vt.projectLogger)("Calling afterSimulate hook",e);const{id:t}=e,s=await st(this,i,"f").call(this,{transactionMeta:e}),{skipSimulation:a,updateTransaction:r}=s??{};if(a?st(this,G,"f").add(t):!1===a&&st(this,G,"f").delete(t),!r)return;const o=st(this,n,"m",Le).call(this,{transactionId:t,skipResimulateCheck:!0},e=>{e.txParamsOriginal=(0,ut.cloneDeep)(e.txParams),r(e)});(0,vt.projectLogger)("Updated transaction with afterSimulate data",o)},Xe=async function({ethQuery:e,publishHookOverride:t,traceContext:s},a,r){let i;return await st(this,U,"f").call(this,{name:"Publish",parentContext:s},async()=>{const s=t??st(this,O,"f");({transactionHash:i}=await s(a,r)),i??(i=await st(this,n,"m",J).call(this,e,{...a,rawTx:r}))}),(0,vt.projectLogger)("Publish successful",i),{transactionHash:i}},Ze=async function(e){const{chainId:t}=e;return await(0,Lt.getGasFeeTokens)({chainId:t,getSimulationConfig:st(this,_,"f"),isEIP7702GasFeeTokensEnabled:st(this,A,"f"),messenger:this.messenger,publicKeyEIP7702:st(this,R,"f"),transactionMeta:e})},et=async function(e){const{chainId:t,data:s,from:a,to:r,value:i}=e,o=st(this,n,"m",de).call(this,{chainId:t}),c={chainId:t,delegationAddress:await(0,Dt.getDelegationAddress)(a,o),isExternalSign:!0,txParams:{data:s,from:a,to:r,value:i}};return(await st(this,n,"m",Ze).call(this,c)).gasFeeTokens}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs",{"../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.getAccountTransactions=s.getAccountAddressRelationship=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils"),r=e("../errors.cjs"),i=e("../logger.cjs"),o="https://accounts.api.cx.metamask.io",c=`${o}/v1/accounts/`,d="x-metamask-clientproduct",l="metamask-transaction-controller",m=[1,10,56,137,8453,42161,59144,534352,1329,143,999],u=(0,a.createModuleLogger)(i.projectLogger,"accounts-api");s.getAccountAddressRelationship=async function(e){const{chainId:t,from:s,to:a}=e;if(!m.includes(t))throw u("Unsupported chain ID for account relationship API",t),new r.FirstTimeInteractionError("Unsupported chain ID");const i=`${o}/v1/networks/${t}/accounts/${s}/relationships/${a}`;u("Getting account address relationship",{request:e,url:i});const c={[d]:l},h=await(0,n.successfulFetch)(i,{headers:c});if(204===h.status)return{count:0};const f=await h.json();if(u("Retrieved account address relationship",f),f.error){const{code:e,message:t}=f.error;throw new r.FirstTimeInteractionError(t,e)}return f},s.getAccountTransactions=async function(e){const{address:t,chainIds:s,cursor:a,endTimestamp:r,sortDirection:i,startTimestamp:o,tags:m}=e;let h=`${c}${t}/transactions`;const f=[];if(s){const e=s.join(",");f.push(`networks=${e}`)}o&&f.push(`startTimestamp=${o}`),r&&f.push(`endTimestamp=${r}`),a&&f.push(`cursor=${a}`),i&&f.push(`sortDirection=${i}`),f.length&&(h+=`?${f.join("&")}`),u("Getting account transactions",{request:e,url:h});const p=[l,...m??[]].join("__"),g={[d]:p},k=await(0,n.successfulFetch)(h,{headers:g}),b=await k.json();return u("Retrieved account transactions",b),b}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.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",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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.simulateTransactions=void 0;const n=e("@metamask/controller-utils"),a=e("@metamask/utils"),r=e("lodash"),i=e("../constants.cjs"),o=e("../errors.cjs"),c=e("../logger.cjs"),d=(0,a.createModuleLogger)(c.projectLogger,"simulation-api"),l="networks";let m=0;function u(e){return"https://tx-sentinel-{0}.api.cx.metamask.io/".replace("{0}",e)}s.simulateTransactions=async function(e,t){let s=await async function(e){const t=await async function(){const e=`${u("ethereum-mainnet")}${l}`,t=await fetch(e);return t.json()}(),s=(0,n.convertHexToDecimal)(e),a=t[s];if(!a?.confirmations)throw d("Chain is not supported",e),new o.SimulationChainNotSupportedError(e);return u(a.network)}(e);const{newUrl:a,authorization:c}=await t.getSimulationConfig(s)||{};a&&(s=a);const h=m;m+=1;const f=function(e){const t=(0,r.cloneDeep)(e);for(const e of t.transactions){const s=e.to?.toLowerCase();i.DELEGATION_MANAGER_ADDRESSES.includes(s)&&(t.overrides=t.overrides??{},t.overrides[s]={code:i.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS})}return t}(t);d("Sending request",s,t);const p={"Content-Type":"application/json"};c&&(p.Authorization=c);const g=await fetch(s,{method:"POST",headers:p,body:JSON.stringify({id:String(h),jsonrpc:"2.0",method:"infura_simulateTransactions",params:[f]})}),k=await g.json();if(d("Received response",k),k.error){const{code:e,message:t}=k.error;throw new o.SimulationError(t,e)}return k?.result}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS=s.DELEGATION_MANAGER_ADDRESSES=s.ABI_IERC7821=s.ABI_SIMULATION_ERC721_LEGACY=s.ABI_SIMULATION_ERC20_WRAPPED=s.CHAIN_IDS=void 0,s.CHAIN_IDS={MAINNET:"0x1",GOERLI:"0x5",BASE:"0x2105",BASE_TESTNET:"0x14a33",BSC:"0x38",BSC_TESTNET:"0x61",HYPEREVM:"0x3e7",OPTIMISM:"0xa",OPTIMISM_TESTNET:"0x1a4",OPBNB:"0xcc",OPBNB_TESTNET:"0x15eb",OPTIMISM_SEPOLIA:"0xaa37dc",POLYGON:"0x89",POLYGON_TESTNET:"0x13881",AVALANCHE:"0xa86a",AVALANCHE_TESTNET:"0xa869",FANTOM:"0xfa",FANTOM_TESTNET:"0xfa2",SEPOLIA:"0xaa36a7",LINEA_GOERLI:"0xe704",LINEA_SEPOLIA:"0xe705",LINEA_MAINNET:"0xe708",MOONBEAM:"0x504",MOONBEAM_TESTNET:"0x507",MOONRIVER:"0x505",MONAD:"0x8f",GNOSIS:"0x64",ARBITRUM:"0xa4b1",ZKSYNC_ERA:"0x144",ZORA:"0x76adf1",SCROLL:"0x82750",SCROLL_SEPOLIA:"0x8274f",MEGAETH_TESTNET:"0x18c6",SEI:"0x531"},s.ABI_SIMULATION_ERC20_WRAPPED=[{anonymous:!1,inputs:[{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"}],s.ABI_SIMULATION_ERC721_LEGACY=[{anonymous:!1,inputs:[{indexed:!1,name:"_from",type:"address"},{indexed:!1,name:"_to",type:"address"},{indexed:!1,name:"_tokenId",type:"uint256"}],name:"Transfer",type:"event"}],s.ABI_IERC7821=[{type:"function",name:"execute",inputs:[{name:"mode",type:"bytes32",internalType:"ModeCode"},{name:"executionData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"supportsExecutionMode",inputs:[{name:"mode",type:"bytes32",internalType:"ModeCode"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"}],s.DELEGATION_MANAGER_ADDRESSES=["0xdb9b1e94b5b69df7e401ddbede43491141047db3"],s.CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS=" "}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.SimulationRevertedError=s.SimulationInvalidResponseError=s.SimulationChainNotSupportedError=s.FirstTimeInteractionError=s.SimulationError=void 0;const n=e("./types.cjs");class a extends Error{constructor(e,t){super(e??"Simulation failed"),this.code=t}}s.SimulationError=a;class r extends Error{constructor(e,t){super(e??"Error checking first time interaction"),this.code=t}}s.FirstTimeInteractionError=r;s.SimulationChainNotSupportedError=class extends a{constructor(e){super(`Chain is not supported: ${e}`,n.SimulationErrorCode.ChainNotSupported)}};s.SimulationInvalidResponseError=class extends a{constructor(){super("Invalid response from simulation API",n.SimulationErrorCode.InvalidResponse)}};s.SimulationRevertedError=class extends a{constructor(){super("Transaction was reverted",n.SimulationErrorCode.Reverted)}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","@metamask/gas-fee-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-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,s){var n,a,r,i,o,c,d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.DefaultGasFeeFlow=void 0;const l=e("@metamask/gas-fee-controller"),m=e("@metamask/utils"),u=e("../logger.cjs"),h=e("../types.cjs"),f=e("../utils/gas-fees.cjs"),p=(0,m.createModuleLogger)(u.projectLogger,"default-gas-fee-flow");s.DefaultGasFeeFlow=class{constructor(){n.add(this)}matchesTransaction(){return!0}async getGasFees(e){const{gasFeeControllerData:t}=e,{gasEstimateType:s,gasFeeEstimates:o}=t;let c;switch(s){case l.GAS_ESTIMATE_TYPES.FEE_MARKET:p("Using fee market estimates",o),c=d(this,n,"m",a).call(this,o);break;case l.GAS_ESTIMATE_TYPES.LEGACY:p("Using legacy estimates",o),c=d(this,n,"m",r).call(this,o);break;case l.GAS_ESTIMATE_TYPES.ETH_GASPRICE:p("Using eth_gasPrice estimates",o),c=d(this,n,"m",i).call(this,o);break;default:throw new Error(`Unsupported gas estimate type: ${s}`)}return{estimates:c}}},n=new WeakSet,a=function(e){const t=Object.values(h.GasFeeEstimateLevel).reduce((t,s)=>({...t,[s]:d(this,n,"m",o).call(this,e,s)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...t}},r=function(e){const t=Object.values(h.GasFeeEstimateLevel).reduce((t,s)=>({...t,[s]:d(this,n,"m",c).call(this,e,s)}),{});return{type:h.GasFeeEstimateType.Legacy,...t}},i=function(e){return{type:h.GasFeeEstimateType.GasPrice,gasPrice:(0,f.gweiDecimalToWeiHex)(e.gasPrice)}},o=function(e,t){return{maxFeePerGas:(0,f.gweiDecimalToWeiHex)(e[t].suggestedMaxFeePerGas),maxPriorityFeePerGas:(0,f.gweiDecimalToWeiHex)(e[t].suggestedMaxPriorityFeePerGas)}},c=function(e,t){return(0,f.gweiDecimalToWeiHex)(e[t])}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,i,o,c,d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.LineaGasFeeFlow=void 0;const l=e("@metamask/controller-utils"),m=e("@metamask/utils"),u=e("./DefaultGasFeeFlow.cjs"),h=e("../logger.cjs"),f=e("../types.cjs"),p=(0,m.createModuleLogger)(h.projectLogger,"linea-gas-fee-flow"),g=[l.ChainId["linea-mainnet"],l.ChainId["linea-goerli"],l.ChainId["linea-sepolia"]],k={low:1,medium:1.35,high:1.7},b={low:1,medium:1.05,high:1.1};s.LineaGasFeeFlow=class{constructor(){n.add(this)}matchesTransaction({transactionMeta:e}){return g.includes(e.chainId)}async getGasFees(e){try{return await d(this,n,"m",a).call(this,e)}catch(t){return p("Using default flow as fallback due to error",t),(new u.DefaultGasFeeFlow).getGasFees(e)}}},n=new WeakSet,a=async function(e){const{ethQuery:t,transactionMeta:s}=e,a=await d(this,n,"m",r).call(this,s,t);p("Received Linea response",a);const m=d(this,n,"m",i).call(this,a.baseFeePerGas,k);p("Generated base fees",d(this,n,"m",c).call(this,m));const u=d(this,n,"m",i).call(this,a.priorityFeePerGas,b);p("Generated priority fees",d(this,n,"m",c).call(this,u));const h=d(this,n,"m",o).call(this,m,u);p("Generated max fees",d(this,n,"m",c).call(this,h));return{estimates:Object.values(f.GasFeeEstimateLevel).reduce((e,t)=>({...e,[t]:{maxFeePerGas:(0,l.toHex)(h[t]),maxPriorityFeePerGas:(0,l.toHex)(u[t])}}),{type:f.GasFeeEstimateType.FeeMarket})}},r=function(e,t){return(0,l.query)(t,"linea_estimateGas",[{from:e.txParams.from,to:e.txParams.to,value:e.txParams.value,input:e.txParams.data}])},i=function(e,t){const s=(0,l.hexToBN)(e);return{low:s.muln(t.low),medium:s.muln(t.medium),high:s.muln(t.high)}},o=function(e,t){return{low:e.low.add(t.low),medium:e.medium.add(t.medium),high:e.high.add(t.high)}},c=function(e){return Object.values(f.GasFeeEstimateLevel).map(t=>e[t].toString(10))}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/LineaGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.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"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.OptimismLayer1GasFeeFlow=void 0;const i=e("@metamask/controller-utils"),o=e("@metamask/utils"),c=e("./OracleLayer1GasFeeFlow.cjs"),d=e("../constants.cjs"),l=[d.CHAIN_IDS.OPTIMISM,d.CHAIN_IDS.OPTIMISM_TESTNET,d.CHAIN_IDS.BASE,d.CHAIN_IDS.BASE_TESTNET,d.CHAIN_IDS.OPBNB,d.CHAIN_IDS.OPBNB_TESTNET,d.CHAIN_IDS.ZORA];class m extends c.OracleLayer1GasFeeFlow{constructor(){super(...arguments),n.add(this)}async matchesTransaction({transactionMeta:e}){const t=(0,o.hexToNumber)(e.chainId),s=await r(this,n,"m",a).call(this);return!!s?.has(t)||l.includes(e.chainId)}}s.OptimismLayer1GasFeeFlow=m,n=new WeakSet,a=async function(){try{const e=await(0,i.handleFetch)("https://gas.api.cx.metamask.io/v1/supportedNetworks");return new Set(e?.partialSupport?.optimism??[])}catch{return null}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","@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/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.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,s){(function(t){(function(){var n,a,r,i,o,c,d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.OracleLayer1GasFeeFlow=void 0;const m=e("@ethersproject/contracts"),u=e("@ethersproject/providers"),h=e("@metamask/utils"),f=l(e("bn.js")),p=e("../logger.cjs"),g=e("../utils/prepare.cjs"),k=e("../utils/utils.cjs"),b=(0,h.createModuleLogger)(p.projectLogger,"oracle-layer1-gas-fee-flow"),w=new f.default(0),_=[{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_gasUsed",type:"uint256"}],name:"getOperatorFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}];s.OracleLayer1GasFeeFlow=class{constructor(){n.add(this)}getOracleAddressForChain(e){return"0x420000000000000000000000000000000000000F"}shouldSignTransaction(){return!1}async getLayer1Fee(e){try{const{provider:t,transactionMeta:s}=e,i=d(this,n,"m",c).call(this,t,s.chainId),o=await d(this,n,"m",a).call(this,i,s),l=await d(this,n,"m",r).call(this,i,s);return{layer1Fee:(0,h.add0x)((0,k.padHexToEvenLength)(o.add(l).toString(16)))}}catch(e){throw b("Failed to get oracle layer 1 gas fee",e),new Error("Failed to get oracle layer 1 gas fee")}}},n=new WeakSet,a=async function(e,t){const s=d(this,n,"m",i).call(this,t,this.shouldSignTransaction()).serialize(),a=await e.getL1Fee(s);if(a===undefined)throw new Error("No value returned from oracle contract");return(0,k.toBN)(a)},r=async function(e,t){const{gasUsed:s}=t;if(!s)return w;try{const t=await e.getOperatorFee(s);return t===undefined?w:(0,k.toBN)(t)}catch(e){return b("Failed to get operator layer 1 gas fee",e),w}},i=function(e,s){const a=d(this,n,"m",o).call(this,e),{chainId:r}=e;let i=(0,g.prepareTransaction)(r,a);if(s){const e=t.from("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789","hex"),s=Uint8Array.from(e);i=i.sign(s)}return i},o=function(e){return{...e.txParams,gasLimit:e.txParams.gas}},c=function(e,t){return new m.Contract(this.getOracleAddressForChain(t),_,new u.Web3Provider(e))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/gas-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-fees.cjs","./DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","@metamask/gas-fee-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-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,s){var n,a,r,i,o,c=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.randomiseDecimalGWEIAndConvertToHex=s.RandomisedEstimationsGasFeeFlow=void 0;const d=e("@metamask/gas-fee-controller"),l=e("@metamask/utils"),m=e("./DefaultGasFeeFlow.cjs"),u=e("../logger.cjs"),h=e("../types.cjs"),f=e("../utils/feature-flags.cjs"),p=e("../utils/gas-fees.cjs"),g=(0,l.createModuleLogger)(u.projectLogger,"randomised-estimation-gas-fee-flow");function k(e,t,s){const n=(0,p.gweiDecimalToWeiDecimal)(e),a=n.length,r=Math.min(t,a-s);if(0===Number(n)||r<=0)return`0x${Number(n).toString(16)}`;const i=a-r,o=n.slice(0,i),c=n.slice(-r),d=function(e,t){const s=10**e;return t+Math.floor(Math.random()*(s-t))}(r,Number(c)),m=`0x${(BigInt(o+"0".repeat(r))+BigInt(d)).toString(16)}`;return(0,l.add0x)(m)}s.RandomisedEstimationsGasFeeFlow=class{constructor(){n.add(this)}matchesTransaction({transactionMeta:e,messenger:t}){const{chainId:s}=e;return(0,f.getGasFeeRandomisation)(t).randomisedGasFeeDigits[s]!==undefined}async getGasFees(e){try{return await c(this,n,"m",r).call(this,e)}catch(t){return g("Using default flow as fallback due to error",t),await c(this,n,"m",a).call(this,e)}}},n=new WeakSet,a=async function(e){return(new m.DefaultGasFeeFlow).getGasFees(e)},r=async function(e){const{messenger:t,gasFeeControllerData:s,transactionMeta:r}=e,{gasEstimateType:o,gasFeeEstimates:l}=s,m=(0,f.getGasFeeRandomisation)(t),u=m.randomisedGasFeeDigits[r.chainId],h=m.preservedNumberOfDigits??2;if(o===d.GAS_ESTIMATE_TYPES.FEE_MARKET){g("Randomising fee market estimates",l);const e=c(this,n,"m",i).call(this,l,u,h);return g("Added randomised fee market estimates",e),{estimates:e}}return await c(this,n,"m",a).call(this,e)},i=function(e,t,s){const a=Object.values(h.GasFeeEstimateLevel).reduce((a,r)=>({...a,[r]:c(this,n,"m",o).call(this,e,r,t,s)}),{});return{type:h.GasFeeEstimateType.FeeMarket,...a}},o=function(e,t,s,n){return{maxFeePerGas:(0,p.gweiDecimalToWeiHex)(e[t].suggestedMaxFeePerGas),maxPriorityFeePerGas:k(e[t].suggestedMaxPriorityFeePerGas,s,n)}},s.randomiseDecimalGWEIAndConvertToHex=k}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./OracleLayer1GasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/OracleLayer1GasFeeFlow.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ScrollLayer1GasFeeFlow=void 0;const n=e("./OracleLayer1GasFeeFlow.cjs"),a=e("../constants.cjs"),r=[a.CHAIN_IDS.SCROLL,a.CHAIN_IDS.SCROLL_SEPOLIA];class i extends n.OracleLayer1GasFeeFlow{getOracleAddressForChain(e){return"0x5300000000000000000000000000000000000002"}shouldSignTransaction(){return!0}async matchesTransaction({transactionMeta:e}){return r.includes(e.chainId)}}s.ScrollLayer1GasFeeFlow=i}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.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,s){var n,a,r,i=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},o=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s};Object.defineProperty(s,"__esModule",{value:!0}),s.TestGasFeeFlow=void 0;const c=e("@metamask/controller-utils"),d=e("../types.cjs"),l=1e15;s.TestGasFeeFlow=class{constructor(){n.add(this),a.set(this,1)}matchesTransaction(){return!0}async getGasFees(e){const{transactionMeta:t}=e,{txParams:s}=t,{gas:c}=s;if(!c)throw new Error("Cannot estimate fee without gas value");const m=parseInt(c,16),u=.5*l,h=(i(this,a,"f")+1)*l,f=i(this,a,"f")*l,p=h-u,g=f-u,k=h+u,b=f+u;return o(this,a,i(this,a,"f")+1,"f"),{estimates:{type:d.GasFeeEstimateType.FeeMarket,low:{maxFeePerGas:i(this,n,"m",r).call(this,p,m),maxPriorityFeePerGas:i(this,n,"m",r).call(this,g,m)},medium:{maxFeePerGas:i(this,n,"m",r).call(this,h,m),maxPriorityFeePerGas:i(this,n,"m",r).call(this,f,m)},high:{maxFeePerGas:i(this,n,"m",r).call(this,k,m),maxPriorityFeePerGas:i(this,n,"m",r).call(this,b,m)}}}}},a=new WeakMap,n=new WeakSet,r=function(e,t){const s=Math.ceil(e/t);return(0,c.toHex)(s)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/TestGasFeeFlow.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/accounts-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../index.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.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,s){var n,a,r,i,o=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccountsApiRemoteTransactionSource=s.SUPPORTED_CHAIN_IDS=void 0;const d=e("@metamask/controller-utils"),l=c(e("bn.js")),m=e("uuid"),u=e("../index.cjs"),h=e("../api/accounts-api.cjs"),f=e("../constants.cjs"),p=e("../logger.cjs"),g=e("../types.cjs");s.SUPPORTED_CHAIN_IDS=[f.CHAIN_IDS.MAINNET,f.CHAIN_IDS.POLYGON,f.CHAIN_IDS.BSC,f.CHAIN_IDS.LINEA_MAINNET,f.CHAIN_IDS.BASE,f.CHAIN_IDS.OPTIMISM,f.CHAIN_IDS.ARBITRUM,f.CHAIN_IDS.SCROLL,f.CHAIN_IDS.SEI,f.CHAIN_IDS.MONAD,f.CHAIN_IDS.HYPEREVM];const k=(0,p.createModuleLogger)(p.incomingTransactionsLogger,"accounts-api-source");s.AccountsApiRemoteTransactionSource=class{constructor(){n.add(this)}getSupportedChains(){return s.SUPPORTED_CHAIN_IDS}async fetchTransactions(e){const{address:t,chainIds:c}=e,d=await o(this,n,"m",a).call(this,e,c??s.SUPPORTED_CHAIN_IDS);k("Fetched transactions",d.length,d);const l=await Promise.all(d.map(e=>o(this,n,"m",i).call(this,t,e)));k("Normalized transactions",l);const m=o(this,n,"m",r).call(this,e,l);return k("Filtered transactions",m.length,m),m}},n=new WeakSet,a=async function(e,t){const{address:s,tags:n}=e,a=[];try{const e=await(0,h.getAccountTransactions)({address:s,chainIds:t,sortDirection:"DESC",tags:n});e?.data&&a.push(...e.data)}catch(e){k("Error while fetching transactions",e)}return a},r=function(e,t){const{address:s,includeTokenTransfers:n,updateTransactions:a}=e;let r=t;return a||(r=r.filter(e=>e.txParams.to===s)),n||(r=r.filter(e=>!e.isTransfer)),r},i=async function(e,t){const s=String(t.blockNumber),n=`0x${t.chainId.toString(16)}`,{hash:a}=t,r=new Date(t.timestamp).getTime(),i=(0,m.v1)({msecs:r}),{from:o}=t,c=(0,d.BNToHex)(new l.default(t.gas)),h=(0,d.BNToHex)(new l.default(t.gasPrice)),f=(0,d.BNToHex)(new l.default(t.gasUsed)),p=(0,d.BNToHex)(new l.default(t.nonce)),k=t.methodId,b=g.TransactionType.incoming,w=t.isError?g.TransactionStatus.failed:g.TransactionStatus.confirmed,_=t.valueTransfers.find(t=>(t.to.toLowerCase()===e.toLowerCase()||t.from.toLowerCase()===e.toLowerCase())&&t.contractAddress),T=_?.to.toLowerCase()===e.toLowerCase()&&o.toLowerCase()!==e.toLowerCase(),E=o.toLowerCase()===e.toLowerCase(),S=_?.amount,I=_?.contractAddress,A=_?.decimal,y=_?.symbol,x=(0,d.BNToHex)(new l.default(T?_?.amount??t.value:t.value)),v=T?e:t.to,C={blockNumber:s,chainId:n,error:w===g.TransactionStatus.failed?new Error("Transaction failed"):undefined,hash:a,id:i,isTransfer:T,networkClientId:"",status:w,time:r,toSmartContract:!1,transferInformation:_?{amount:S,contractAddress:I,decimals:A,symbol:y}:undefined,txParams:{chainId:n,data:k,from:o,gas:c,gasPrice:h,gasUsed:f,nonce:p,to:v,value:x},type:b,verifiedOnBlockchain:!1};return E&&(C.type=(await(0,u.determineTransactionType)(C.txParams)).type),C}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs",{"../gas-flows/DefaultGasFeeFlow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/gas-flows/DefaultGasFeeFlow.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","../utils/layer1-gas-fee-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/layer1-gas-fee-flow.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,i,o,c,d,l,m,u,h,f,p,g,k,b,w,_,T,E,S,I,A,y=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},x=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},v=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.updateTransactionGasEstimates=s.updateTransactionGasProperties=s.GasFeePoller=void 0;const C=v(e("@metamask/eth-query")),j=e("@metamask/utils"),P=v(e("events")),D=e("../gas-flows/DefaultGasFeeFlow.cjs"),N=e("../logger.cjs"),R=e("../types.cjs"),O=e("../utils/gas-flow.cjs"),M=e("../utils/layer1-gas-fee-flow.cjs"),L=(0,j.createModuleLogger)(N.projectLogger,"gas-fee-poller");function F(e,t,s,n){const{type:a}=t;if(n){if(a===R.GasFeeEstimateType.FeeMarket){const n=t;e.maxFeePerGas=n[s]?.maxFeePerGas,e.maxPriorityFeePerGas=n[s]?.maxPriorityFeePerGas}if(a===R.GasFeeEstimateType.GasPrice){const s=t;e.maxFeePerGas=s.gasPrice,e.maxPriorityFeePerGas=s.gasPrice}if(a===R.GasFeeEstimateType.Legacy){const n=t[s];e.maxFeePerGas=n,e.maxPriorityFeePerGas=n}delete e.gasPrice}else{if(a===R.GasFeeEstimateType.FeeMarket){const n=t;e.gasPrice=n[s]?.maxFeePerGas}if(a===R.GasFeeEstimateType.GasPrice){const s=t;e.gasPrice=s.gasPrice}if(a===R.GasFeeEstimateType.Legacy){const n=t;e.gasPrice=n[s]}delete e.maxFeePerGas,delete e.maxPriorityFeePerGas}}s.GasFeePoller=class{constructor({findNetworkClientIdByChainId:e,gasFeeFlows:t,getGasFeeControllerEstimates:s,getProvider:g,getTransactions:k,getTransactionBatches:b,layer1GasFeeFlows:w,messenger:_,onStateChange:T}){n.add(this),this.hub=new P.default,a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),m.set(this,void 0),u.set(this,void 0),h.set(this,!1),y(this,a,e,"f"),y(this,r,t,"f"),y(this,l,w,"f"),y(this,i,s,"f"),y(this,o,g,"f"),y(this,c,k,"f"),y(this,d,b,"f"),y(this,m,_,"f"),T(()=>{const e=x(this,n,"m",S).call(this),t=x(this,n,"m",I).call(this);e.length||t.length?x(this,n,"m",f).call(this):x(this,n,"m",p).call(this)})}},a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,n=new WeakSet,f=function(){x(this,h,"f")||(x(this,n,"m",g).call(this),y(this,h,!0,"f"),L("Started polling"))},p=function(){x(this,h,"f")&&(clearTimeout(x(this,u,"f")),y(this,u,undefined,"f"),y(this,h,!1,"f"),L("Stopped polling"))},g=async function e(){await x(this,n,"m",k).call(this),await x(this,n,"m",b).call(this),y(this,u,setTimeout(()=>x(this,n,"m",e).call(this),1e4),"f")},k=async function(){const e=x(this,n,"m",S).call(this);if(!e.length)return;L("Found unapproved transactions",e.length);const t=await x(this,n,"m",A).call(this,e);L("Retrieved gas fee controller data",t),await Promise.all(e.flatMap(e=>{const{chainId:s}=e,a=t.get(s);return x(this,n,"m",w).call(this,e,a)}))},b=async function(){const e=x(this,n,"m",I).call(this);if(!e.length)return;L("Found unapproved transaction batches",e.length);const t=await x(this,n,"m",A).call(this,e);L("Retrieved gas fee controller data",t),await Promise.all(e.flatMap(e=>{const{chainId:s}=e,a=t.get(s);return x(this,n,"m",_).call(this,e,a)}))},w=async function(e,t){const{id:s}=e,[a,r]=await Promise.all([x(this,n,"m",T).call(this,e,t),x(this,n,"m",E).call(this,e)]);(a||r)&&this.hub.emit("transaction-updated",{transactionId:s,gasFeeEstimates:a?.gasFeeEstimates,gasFeeEstimatesLoaded:a?.gasFeeEstimatesLoaded,layer1GasFee:r})},_=async function(e,t){const{id:s}=e,n=new C.default(x(this,o,"f").call(this,e.networkClientId)),a=new D.DefaultGasFeeFlow,r={ethQuery:n,gasFeeControllerData:t,messenger:x(this,m,"f"),transactionMeta:{...e,txParams:{...e.transactions?.[0],from:e.from,gas:e.gas},time:Date.now()}};let i;try{i=(await a.getGasFees(r)).estimates}catch(t){L("Failed to get gas fees for batch",e.id,t)}i&&this.hub.emit("transaction-batch-updated",{transactionBatchId:s,gasFeeEstimates:i,gasFeeEstimatesLoaded:!0})},T=async function(e,t){const{networkClientId:s}=e,n=new C.default(x(this,o,"f").call(this,s)),a=(0,O.getGasFeeFlow)(e,x(this,r,"f"),x(this,m,"f"));a&&L("Found gas fee flow",a.constructor.name,e.id);const i={ethQuery:n,gasFeeControllerData:t,messenger:x(this,m,"f"),transactionMeta:e};let c;if(a)try{c=(await a.getGasFees(i)).estimates}catch(t){L("Failed to get suggested gas fees",e.id,t)}return!c&&e.gasFeeEstimatesLoaded?undefined:(L("Updated gas fee estimates",{gasFeeEstimates:c,transaction:e.id}),{gasFeeEstimates:c,gasFeeEstimatesLoaded:!0})},E=async function(e){const{networkClientId:t}=e,s=x(this,o,"f").call(this,t),n=await(0,M.getTransactionLayer1GasFee)({layer1GasFeeFlows:x(this,l,"f"),messenger:x(this,m,"f"),provider:s,transactionMeta:e});return n&&L("Updated layer 1 gas fee",n,e.id),n},S=function(){return x(this,c,"f").call(this).filter(e=>e.status===R.TransactionStatus.unapproved)},I=function(){return x(this,d,"f").call(this).filter(e=>e.status===R.TransactionStatus.unapproved)},A=async function(e){const t=new Map;for(const s of e){const{chainId:e,networkClientId:n}=s;if(t.has(e))continue;const r=n??x(this,a,"f").call(this,e);t.set(e,r)}L("Extracted network client IDs by chain ID",t);const s=Array.from(t.entries()).map(async([e,t])=>[e,await x(this,i,"f").call(this,{networkClientId:t})]);return new Map(await Promise.all(s))},s.updateTransactionGasProperties=function({gasFeeEstimates:e,gasFeeEstimatesLoaded:t,isTxParamsGasFeeUpdatesEnabled:s,layer1GasFee:n,txMeta:a}){const r=a.userFeeLevel,i=Object.values(R.GasFeeEstimateLevel).includes(r);if(s(a)&&i&&e){const t=a.txParams.type!==R.TransactionEnvelopeType.legacy;F(a.txParams,e,r,t)}e&&(a.gasFeeEstimates=e),t!==undefined&&(a.gasFeeEstimatesLoaded=t),n&&(a.layer1GasFee=n)},s.updateTransactionGasEstimates=function({txMeta:e,userFeeLevel:t}){const{txParams:s,gasFeeEstimates:n}=e;if(!n)return;F(s,n,t,e.txParams.type!==R.TransactionEnvelopeType.legacy)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/GasFeePoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","./AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,i,o,c,d,l,m,u,h,f,p,g,k,b,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},O=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},M=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.IncomingTransactionHelper=s.WebSocketState=void 0;const L=M(e("events")),F=e("./AccountsApiRemoteTransactionSource.cjs"),B=e("../logger.cjs"),G=e("../utils/feature-flags.cjs"),H=e("../utils/utils.cjs");var U;!function(e){e.CONNECTED="connected",e.DISCONNECTED="disconnected"}(U||(s.WebSocketState=U={}));s.IncomingTransactionHelper=class{constructor({client:e,getCurrentAccount:t,getLocalTransactions:s,includeTokenTransfers:E,isEnabled:I,messenger:A,remoteTransactionSource:v,trimTransactions:C,updateTransactions:j}){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),m.set(this,void 0),u.set(this,void 0),h.set(this,void 0),f.set(this,void 0),p.set(this,void 0),g.set(this,void 0),k.set(this,[...F.SUPPORTED_CHAIN_IDS]),b.set(this,e=>{O(this,n,"m",S).call(this,e)}),w.set(this,e=>{O(this,n,"m",y).call(this,e)}),_.set(this,()=>{O(this,n,"m",x).call(this)}),T.set(this,({chainIds:e,status:t})=>{O(this,n,"m",N).call(this,e,t)}),this.hub=new L.default,R(this,a,e,"f"),R(this,r,t,"f"),R(this,i,s,"f"),R(this,o,E,"f"),R(this,c,I??(()=>!0),"f"),R(this,d,!1,"f"),R(this,l,!1,"f"),R(this,m,A,"f"),R(this,u,v,"f"),R(this,f,C,"f"),R(this,p,j,"f"),R(this,g,(0,G.isIncomingTransactionsUseBackendWebSocketServiceEnabled)(A),"f"),O(this,g,"f")&&(O(this,m,"f").subscribe("BackendWebSocketService:connectionStateChanged",O(this,b,"f")),O(this,m,"f").subscribe("AccountActivityService:statusChanged",O(this,T,"f")))}start(){O(this,g,"f")||O(this,n,"m",E).call(this,!0)}stop(){O(this,h,"f")&&clearTimeout(O(this,h,"f")),O(this,d,"f")&&(R(this,d,!1,"f"),(0,B.incomingTransactionsLogger)("Stopped polling"))}async update({chainIds:e,isInterval:t,tags:s}={}){const a=O(this,n,"m",D).call(this,s,t);if((0,B.incomingTransactionsLogger)("Checking for incoming transactions",{isInterval:Boolean(t),tags:a}),!O(this,n,"m",j).call(this))return;const c=O(this,r,"f").call(this),d=O(this,o,"f")??!0,l=O(this,p,"f")??!1;let m=[];try{m=await O(this,u,"f").fetchTransactions({address:c.address,chainIds:e,includeTokenTransfers:d,tags:a,updateTransactions:l})}catch(e){return void(0,B.incomingTransactionsLogger)("Error while fetching remote transactions",e)}if(!m.length)return;O(this,n,"m",C).call(this,m),(0,B.incomingTransactionsLogger)("Found potential transactions",m.length,m);const h=O(this,i,"f").call(this),g=m.filter(e=>!h.some(t=>t.hash?.toLowerCase()===e.hash?.toLowerCase()&&t.txParams.from?.toLowerCase()===e.txParams.from?.toLowerCase()&&t.type===e.type));if(!g.length)return void(0,B.incomingTransactionsLogger)("All transactions are already known");(0,B.incomingTransactionsLogger)("Found unique transactions",g.length,g);const k=O(this,f,"f").call(this,[...g,...h]),b=g.map(e=>e.id),w=k.filter(e=>b.includes(e.id));w.length?((0,B.incomingTransactionsLogger)("Adding new transactions",w.length,w),this.hub.emit("transactions",w)):(0,B.incomingTransactionsLogger)("All unique transactions truncated due to limit")}},a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,k=new WeakMap,b=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,n=new WeakSet,E=function(e=!1){if(O(this,d,"f"))return;if(!O(this,n,"m",j).call(this))return;const t=O(this,n,"m",P).call(this);(0,B.incomingTransactionsLogger)("Started polling",{interval:t}),R(this,d,!0,"f"),O(this,l,"f")||O(this,n,"m",v).call(this).catch(t=>{(0,B.incomingTransactionsLogger)(e?"Initial polling failed":"Polling failed",t)})},S=function(e){e.state===U.CONNECTED?((0,B.incomingTransactionsLogger)("WebSocket connected, starting enhanced mode"),O(this,n,"m",I).call(this)):e.state===U.DISCONNECTED&&((0,B.incomingTransactionsLogger)("WebSocket disconnected, stopping enhanced mode"),O(this,n,"m",A).call(this))},I=function(){O(this,n,"m",j).call(this)&&((0,B.incomingTransactionsLogger)("Started transaction history retrieval (event-driven)"),this.update().catch(e=>{(0,B.incomingTransactionsLogger)("Initial update in transaction history retrieval failed",e)}),O(this,m,"f").subscribe("AccountActivityService:transactionUpdated",O(this,w,"f")),O(this,m,"f").subscribe("AccountsController:selectedAccountChange",O(this,_,"f")))},A=function(){(0,B.incomingTransactionsLogger)("Stopped transaction history retrieval"),O(this,m,"f").unsubscribe("AccountActivityService:transactionUpdated",O(this,w,"f")),O(this,m,"f").unsubscribe("AccountsController:selectedAccountChange",O(this,_,"f"))},y=function(e){(0,B.incomingTransactionsLogger)("Received relevant transaction update, triggering update",{txId:e.id,chain:e.chain}),this.update().catch(e=>{(0,B.incomingTransactionsLogger)("Update after transaction event failed",e)})},x=function(){(0,B.incomingTransactionsLogger)("Selected account changed, triggering update"),this.update().catch(e=>{(0,B.incomingTransactionsLogger)("Update after account change failed",e)})},v=async function e(){R(this,l,!0,"f");try{const e=O(this,g,"f")?O(this,k,"f"):undefined;await this.update({chainIds:e,isInterval:!0})}catch(e){console.error("Error while checking incoming transactions",e)}R(this,l,!1,"f"),O(this,d,"f")&&(O(this,h,"f")&&clearTimeout(O(this,h,"f")),R(this,h,setTimeout(()=>O(this,n,"m",e).call(this),O(this,n,"m",P).call(this)),"f"))},C=function(e){e.sort((e,t)=>e.time<t.time?-1:1)},j=function(){return O(this,c,"f").call(this)},P=function(){return(0,G.getIncomingTransactionsPollingInterval)(O(this,m,"f"))},D=function(e,t){const s=[];return O(this,a,"f")&&s.push(O(this,a,"f")),e?.length?s.push(...e):t&&s.push("automatic-polling"),s?.length?s:undefined},N=function(e,t){if(!O(this,g,"f"))return;let s=!1;for(const n of e){const e=(0,H.caip2ToHex)(n);if(e&&F.SUPPORTED_CHAIN_IDS.includes(e))if("up"===t){const t=O(this,k,"f").indexOf(e);-1!==t&&(O(this,k,"f").splice(t,1),s=!0,(0,B.incomingTransactionsLogger)("Supported network came up, removed from polling list",{chainId:e}))}else"down"!==t||O(this,k,"f").includes(e)||(O(this,k,"f").push(e),s=!0,(0,B.incomingTransactionsLogger)("Supported network went down, added to polling list",{chainId:e}));else(0,B.incomingTransactionsLogger)("Chain ID not recognized or not supported",{caip2ChainId:n,hexChainId:e})}s?0===O(this,k,"f").length?((0,B.incomingTransactionsLogger)("Stopping fallback polling - all networks up"),this.stop()):((0,B.incomingTransactionsLogger)("Starting fallback polling - some networks need polling",{chainsToPoll:O(this,k,"f")}),O(this,n,"m",E).call(this)):(0,B.incomingTransactionsLogger)("No changes to polling list",{chainsToPoll:O(this,k,"f")})}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/IncomingTransactionHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js","eth-method-registry":"/home/runner/work/metamask-extension/metamask-extension/node_modules/eth-method-registry/dist/index.js",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,i,o,c,d=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},m=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.MethodDataHelper=void 0;const u=e("@metamask/utils"),h=e("async-mutex"),f=e("eth-method-registry"),p=m(e("events")),g=e("../logger.cjs"),k=(0,u.createModuleLogger)(g.projectLogger,"method-data");s.MethodDataHelper=class{constructor({getProvider:e,getState:t}){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),o.set(this,new h.Mutex),this.hub=new p.default,d(this,a,e,"f"),d(this,r,t,"f"),d(this,i,new Map,"f")}async lookup(e,t){k("lookup",e,t);const s=await l(this,o,"f").acquire();try{const s=l(this,r,"f").call(this)[e];if(s)return k("Cached",s),s;let o=l(this,i,"f").get(t);if(!o){const e=l(this,a,"f").call(this,t);o=new f.MethodRegistry({provider:e}),l(this,i,"f").set(t,o),k("Created registry",t)}const d=await l(this,n,"m",c).call(this,e,o);return k("Result",d),this.hub.emit("update",{fourBytePrefix:e,methodData:d}),d}finally{s()}}},a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakSet,c=async function(e,t){const s=await t.lookup(e);if(!s)return k("No method found",e),{registryMethod:"",parsedRegistryMethod:{name:undefined,args:undefined}};k("Parsing",s);return{registryMethod:s,parsedRegistryMethod:t.parse(s)}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MethodDataHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.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,s){var n,a,r,i,o,c,d,l,m,u,h,f,p=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},g=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.MultichainTrackingHelper=void 0;const k=e("async-mutex"),b=e("../logger.cjs"),w=(0,b.createModuleLogger)(b.projectLogger,"multichain-tracking");s.MultichainTrackingHelper=class{constructor({findNetworkClientIdByChainId:e,getNetworkClientById:t,getNetworkClientRegistry:s,removePendingTransactionTrackerListeners:k,createNonceTracker:b,createPendingTransactionTracker:_,onNetworkStateChange:T}){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,new Map),m.set(this,new Map),this.checkForPendingTransactionAndStartPolling=()=>{for(const[,e]of g(this,m,"f"))e.pendingTransactionTracker.startIfPendingTransactions()},u.set(this,e=>{const t=Object.keys(e),s=Array.from(g(this,m,"f").keys()),a=s.filter(e=>!t.includes(e));a.forEach(e=>{g(this,n,"m",h).call(this,e)});const r=t.filter(e=>!s.includes(e));r.forEach(e=>{g(this,n,"m",f).call(this,e)}),r.length&&w("Added trackers",r),a.length&&w("Removed trackers",a)}),p(this,a,e,"f"),p(this,r,t,"f"),p(this,i,s,"f"),p(this,o,k,"f"),p(this,c,b,"f"),p(this,d,_,"f"),T((e,t)=>{const s=g(this,i,"f").call(this);t.forEach(({op:e,path:t})=>{if("remove"===e&&"networkConfigurations"===t[0]){const e=t[1];delete s[e]}}),g(this,u,"f").call(this,s)})}initialize(){const e=g(this,i,"f").call(this);g(this,u,"f").call(this,e),w("Initialized")}has(e){return g(this,m,"f").has(e)}async acquireNonceLockForChainIdKey({chainId:e,key:t="global"}){let s=g(this,l,"f").get(e);s||(s=new Map,g(this,l,"f").set(e,s));let n=s.get(t);return n||(n=new k.Mutex,s.set(t,n)),await n.acquire()}async getNonceLock(e,t){const s=g(this,r,"f").call(this,t),n=await this.acquireNonceLockForChainIdKey({chainId:s.configuration.chainId,key:e}),a=g(this,m,"f").get(t)?.nonceTracker;if(!a)throw new Error(`Missing nonce tracker for network client ID - ${t}`);try{const t=await a.getNonceLock(e),s=()=>{t.releaseLock(),n?.()};return{...t,releaseLock:s}}catch(e){throw n?.(),e}}stopAllTracking(){for(const[e]of g(this,m,"f"))g(this,n,"m",h).call(this,e)}getNetworkClient({chainId:e,networkClientId:t}){if(!t&&!e)throw new Error("Cannot locate network client without networkClientId or chainId");let s,n=t;try{t&&(s=g(this,r,"f").call(this,t))}catch(s){if(w("No network client found with ID",t),!e)throw s}return!s&&e&&(n=g(this,a,"f").call(this,e),s=g(this,r,"f").call(this,n)),{...s,id:n}}},a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,n=new WeakSet,h=function(e){const t=g(this,m,"f").get(e);t&&(t.pendingTransactionTracker.stop(),g(this,o,"f").call(this,t.pendingTransactionTracker),g(this,m,"f").delete(e))},f=function(e){if(g(this,m,"f").get(e))return;const{provider:t,blockTracker:s,configuration:{chainId:n}}=g(this,r,"f").call(this,e),a=g(this,c,"f").call(this,{provider:t,blockTracker:s,chainId:n}),i=g(this,d,"f").call(this,{provider:t,blockTracker:s,chainId:n,networkClientId:e});g(this,m,"f").set(e,{nonceTracker:a,pendingTransactionTracker:i})}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/MultichainTrackingHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.cjs","./TransactionPoller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs",events:"/home/runner/work/metamask-extension/metamask-extension/node_modules/events/events.js",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,s){var n,a,r,i,o,c,d,l,m,u,h,f,p,g,k,b,w,_,T,E,S,I,A,y,x,v,C,j,P,D,N,R,O,M,L,F,B,G,H,U,q,W,$=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},V=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)},K=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.PendingTransactionTracker=void 0;const Y=e("@metamask/controller-utils"),Q=K(e("events")),z=e("lodash"),J=e("./TransactionPoller.cjs"),X=e("../logger.cjs"),Z=e("../types.cjs"),ee=e("../utils/feature-flags.cjs"),te=["replacement transaction underpriced","known transaction","gas price too low to replace","transaction with the same hash was already imported","gateway timeout","nonce too low"],se=(0,X.createModuleLogger)(X.projectLogger,"pending-transactions");s.PendingTransactionTracker=class{constructor({blockTracker:e,getChainId:t,getEthQuery:s,getGlobalLock:S,getNetworkClientId:I,getTransactions:A,isTimeoutEnabled:y,hooks:x,isResubmitEnabled:v,messenger:C,publishTransaction:j}){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),m.set(this,void 0),u.set(this,void 0),h.set(this,void 0),f.set(this,void 0),p.set(this,void 0),g.set(this,void 0),k.set(this,void 0),b.set(this,void 0),w.set(this,void 0),_.set(this,void 0),this.startIfPendingTransactions=()=>{const e=V(this,n,"m",R).call(this);e.length?V(this,n,"m",T).call(this,e):this.stop()},this.hub=new Q.default,$(this,r,new Map,"f"),$(this,o,t,"f"),$(this,c,s,"f"),$(this,d,S,"f"),$(this,l,I,"f"),$(this,m,A,"f"),$(this,u,v??(()=>!0),"f"),$(this,h,new Map,"f"),$(this,f,V(this,n,"m",E).bind(this),"f"),$(this,g,C,"f"),$(this,k,j,"f"),$(this,b,!1,"f"),$(this,_,undefined,"f"),$(this,w,new J.TransactionPoller({blockTracker:e,chainId:t(),messenger:C}),"f"),$(this,a,x?.beforeCheckPendingTransaction??(()=>Promise.resolve(!0)),"f"),$(this,i,y,"f"),$(this,p,(0,X.createModuleLogger)(se,`${t()}:${I()}`),"f")}addTransactionToPoll(e){V(this,n,"m",T).call(this,[e]),$(this,_,e,"f")}async forceCheckTransaction(e){const t=await V(this,d,"f").call(this);try{await V(this,n,"m",C).call(this,e)}catch(e){V(this,p,"f").call(this,"Failed to check transaction",e)}finally{t()}}stop(){V(this,b,"f")&&(V(this,w,"f").stop(),$(this,b,!1,"f"),V(this,p,"f").call(this,"Stopped polling"))}},a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,k=new WeakMap,b=new WeakMap,w=new WeakMap,_=new WeakMap,n=new WeakSet,T=function(e){V(this,w,"f").setPendingTransactions(e),V(this,b,"f")||(V(this,w,"f").start(V(this,f,"f")),$(this,b,!0,"f"),V(this,p,"f").call(this,"Started polling"))},E=async function(e){const t=await V(this,d,"f").call(this);try{await V(this,n,"m",S).call(this)}catch(e){V(this,p,"f").call(this,"Failed to check transactions",e)}finally{t()}try{await V(this,n,"m",I).call(this,e)}catch(e){V(this,p,"f").call(this,"Failed to resubmit transactions",e)}},S=async function(){V(this,p,"f").call(this,"Checking transactions");const e=[...V(this,n,"m",R).call(this),...V(this,_,"f")?[V(this,_,"f")]:[]];e.length?(V(this,p,"f").call(this,"Found pending transactions to check",{count:e.length,ids:e.map(e=>e.id)}),await Promise.all(e.map(e=>V(this,n,"m",C).call(this,e)))):V(this,p,"f").call(this,"No pending transactions to check")},I=async function(e){if(!V(this,u,"f").call(this)||!V(this,b,"f"))return;V(this,p,"f").call(this,"Resubmitting transactions");const t=V(this,n,"m",R).call(this);if(t.length){V(this,p,"f").call(this,"Found pending transactions to resubmit",{count:t.length,ids:t.map(e=>e.id)});for(const s of t)try{await V(this,n,"m",y).call(this,s,e)}catch(e){const t=e.value?.message?.toLowerCase()??e.message?.toLowerCase()??String(e);if(V(this,n,"m",A).call(this,t)){V(this,p,"f").call(this,"Ignoring known transaction error",t);continue}V(this,n,"m",O).call(this,s,e.message,"There was an error when resubmitting this transaction.")}}else V(this,p,"f").call(this,"No pending transactions to resubmit")},A=function(e){return te.some(t=>e.includes(t))},y=async function(e,t){if(!V(this,n,"m",x).call(this,e,t))return;if(!await V(this,a,"f").call(this,e))return;const s=V(this,c,"f").call(this,e.networkClientId);await V(this,k,"f").call(this,s,e);const r=(e.retryCount??0)+1;V(this,n,"m",F).call(this,(0,z.merge)({},e,{retryCount:r}),"PendingTransactionTracker:transaction-retry - Retry count increased")},x=function(e,t){const s=(0,z.cloneDeep)(e);s.firstRetryBlockNumber||(s.firstRetryBlockNumber=t,V(this,n,"m",F).call(this,s,"PendingTransactionTracker:#isResubmitDue - First retry block number set"));const{firstRetryBlockNumber:a}=s,r=Number.parseInt(t,16)-Number.parseInt(a,16),i=e.retryCount??0;return r>=Math.min(50,Math.pow(2,i))},v=function(e){const{hash:t,id:s}=e;V(this,_,"f")?.id===s&&$(this,_,undefined,"f"),t&&V(this,h,"f").delete(t)},C=async function(e){const{hash:t,id:s,isIntentComplete:r,txParams:{from:i}}=e;if(r)await V(this,n,"m",j).call(this,e);else{if(!t&&await V(this,a,"f").call(this,e)){const t=new Error("We had an error while submitting this transaction, please try again.");return t.name="NoTxHashError",void V(this,n,"m",M).call(this,e,t)}if(V(this,n,"m",N).call(this,e))return V(this,p,"f").call(this,"Nonce already taken",s),void V(this,n,"m",L).call(this,e);try{const s=await V(this,n,"m",B).call(this,t),a="0x1"===s?.status;if("0x0"===s?.status)return V(this,p,"f").call(this,"Transaction receipt has failed status"),void V(this,n,"m",M).call(this,e,new Error("Transaction failed on-chain"));const{blockNumber:r,blockHash:o}=s??{};if(a&&r&&o)return void await V(this,n,"m",j).call(this,e,{...s,blockNumber:r,blockHash:o});V(this,p,"f").call(this,"No receipt status",{hash:t,receipt:s});const c=await V(this,n,"m",U).call(this,i),d=parseInt(c,16);if(!s&&await V(this,n,"m",P).call(this,e,d))return;await V(this,n,"m",D).call(this,e,d)&&V(this,n,"m",L).call(this,e)}catch(t){V(this,p,"f").call(this,"Failed to check transaction",s,t),V(this,n,"m",O).call(this,e,t.message,"There was a problem loading this transaction.")}}},j=async function(e,t){const{id:s}=e,{blockHash:a}=t??{};V(this,p,"f").call(this,"Transaction confirmed",s);const r=V(this,_,"f")?.id===s;if(V(this,n,"m",v).call(this,e),r)return void this.hub.emit("transaction-confirmed",e);const i=(0,z.cloneDeep)(e);if(t&&a){const{baseFeePerGas:e,timestamp:s}=await V(this,n,"m",H).call(this,a,!1);i.baseFeePerGas=e,i.blockTimestamp=s,i.txParams={...i.txParams,gasUsed:t.gasUsed},i.txReceipt=t,i.verifiedOnBlockchain=!0}i.status=Z.TransactionStatus.confirmed,V(this,n,"m",F).call(this,i,"PendingTransactionTracker:#onTransactionConfirmed - Transaction confirmed"),this.hub.emit("transaction-confirmed",i)},P=async function(e,t){const{chainId:s,hash:a,id:r,submittedTime:o,txParams:{nonce:c}}=e;if(!a||!c)return!1;if(!V(this,i,"f").call(this,e))return V(this,p,"f").call(this,"Timeout disabled for transaction",e),!1;const d=(0,ee.getTimeoutAttempts)(s,V(this,g,"f"));if(d===undefined||0===d)return V(this,p,"f").call(this,"Timeout disabled due to threshold",{chainId:s,threshold:d}),!1;const l=parseInt(c,16);if(l>t)return V(this,p,"f").call(this,"Skipping timeout as queued transaction",{transactionNonce:l,nextNonce:t}),!1;try{if(null!==await V(this,n,"m",G).call(this,a)){const e=Date.now();return V(this,p,"f").call(this,"Transaction found on network, recording timestamp",r),V(this,h,"f").set(a,e),!1}const t=V(this,h,"f").get(a)??o;if(t===undefined)return V(this,p,"f").call(this,"Transaction not yet seen on network and has no submitted time, skipping timeout check",r),!1;const{blockTime:i}=(0,ee.getAcceleratedPollingParams)(s,V(this,g,"f")),c=Date.now()-t,l=i*d;return V(this,p,"f").call(this,"Checking timeout duration",{transactionId:r,durationSinceLastSeen:c,timeoutDuration:l,threshold:d,blockTime:i}),c<l?!1:(V(this,p,"f").call(this,"Hit timeout duration threshold",r),V(this,h,"f").delete(a),V(this,n,"m",M).call(this,e,new Error("Transaction not found on network after timeout")),!0)}catch(e){return V(this,p,"f").call(this,"Failed to check transaction by hash",r,e),!1}},D=async function(e,t){const{hash:s,id:n,txParams:{nonce:a}}=e;if(!a||!s)return!1;if(parseInt(a,16)>=t)return!1;let i=V(this,r,"f").get(s);return i===undefined&&(i=0,V(this,r,"f").set(s,i)),i<3?(V(this,p,"f").call(this,"Incrementing dropped block count",{id:n,droppedBlockCount:i}),V(this,r,"f").set(s,i+1),!1):(V(this,p,"f").call(this,"Hit dropped block count",n),V(this,r,"f").delete(s),!0)},N=function(e){const{id:t,txParams:s}=e;return V(this,n,"m",q).call(this).some(e=>e.id!==t&&e.txParams.from===s.from&&e.status===Z.TransactionStatus.confirmed&&e.txParams.nonce&&e.txParams.nonce===s.nonce&&e.type!==Z.TransactionType.incoming&&e.isTransfer===undefined)},R=function(){return V(this,n,"m",W).call(this).filter(e=>e.status===Z.TransactionStatus.submitted&&!e.verifiedOnBlockchain&&!e.isUserOperation&&!e.isStateOnly)},O=function(e,t,s){V(this,n,"m",F).call(this,{...e,warning:{error:t,message:s}},"PendingTransactionTracker:#warnTransaction - Warning added")},M=function(e,t){V(this,p,"f").call(this,"Transaction failed",e.id,t),V(this,n,"m",v).call(this,e),this.hub.emit("transaction-failed",e,t)},L=function(e){V(this,p,"f").call(this,"Transaction dropped",e.id),V(this,n,"m",v).call(this,e),this.hub.emit("transaction-dropped",e)},F=function(e,t){this.hub.emit("transaction-updated",e,t)},B=async function(e){return await(0,Y.query)(V(this,c,"f").call(this),"getTransactionReceipt",[e])},G=async function(e){return await(0,Y.query)(V(this,c,"f").call(this),"getTransactionByHash",[e])},H=async function(e,t){return await(0,Y.query)(V(this,c,"f").call(this),"getBlockByHash",[e,t])},U=async function(e){return await(0,Y.query)(V(this,c,"f").call(this),"getTransactionCount",[e])},q=function(){const e=V(this,o,"f").call(this);return V(this,m,"f").call(this).filter(t=>t.chainId===e)},W=function(){const e=V(this,l,"f").call(this);return V(this,m,"f").call(this).filter(t=>t.networkClientId===e)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/PendingTransactionTracker.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","../utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js",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,s){var n,a,r,i,o,c,d,l,m,u=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},h=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.hasSimulationDataChanged=s.shouldResimulate=s.ResimulateHelper=s.RESIMULATE_INTERVAL_MS=s.BLOCK_TIME_ADDITIONAL_SECONDS=s.VALUE_COMPARISON_PERCENT_THRESHOLD=s.BLOCKAID_RESULT_TYPE_MALICIOUS=s.RESIMULATE_PARAMS=void 0;const f=e("@metamask/utils"),p=e("bn.js"),g=e("lodash"),k=e("../logger.cjs"),b=e("../types.cjs"),w=e("../utils/utils.cjs"),_=(0,k.createModuleLogger)(k.projectLogger,"resimulate-helper");s.RESIMULATE_PARAMS=["to","value","data"],s.BLOCKAID_RESULT_TYPE_MALICIOUS="Malicious",s.VALUE_COMPARISON_PERCENT_THRESHOLD=5,s.BLOCK_TIME_ADDITIONAL_SECONDS=60,s.RESIMULATE_INTERVAL_MS=3e3;function T(e,t){return!E(e?.difference??"0x0",t?.difference??"0x0",!1===e?.isDecrease,!1===t?.isDecrease)}function E(e,t,n,a){let r=new p.BN((0,f.remove0x)(e),"hex"),i=new p.BN((0,f.remove0x)(t),"hex");return n&&(r=r.neg()),a&&(i=i.neg()),(0,w.getPercentageChange)(r,i)<=s.VALUE_COMPARISON_PERCENT_THRESHOLD}s.ResimulateHelper=class{constructor({getTransactions:e,simulateTransaction:t,onTransactionsUpdate:s}){n.add(this),a.set(this,new Map),r.set(this,void 0),i.set(this,void 0),u(this,r,e,"f"),u(this,i,t,"f"),s(h(this,n,"m",o).bind(this))}},a=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,o=function(){const e=h(this,r,"f").call(this).filter(e=>e.status===b.TransactionStatus.unapproved),t=new Set(e.map(e=>e.id));new Set([...t,...h(this,a,"f").keys()]).forEach(t=>{const s=e.find(e=>e.id===t);s?.isActive?h(this,n,"m",c).call(this,s):h(this,n,"m",l).call(this,t)})},c=function(e){const{id:t}=e;if(h(this,a,"f").has(t))return;const r=()=>{h(this,i,"f").call(this,e).catch(e=>{_("Error during transaction resimulation",e)}).finally(()=>{h(this,a,"f").has(t)&&h(this,n,"m",d).call(this,t,r)})};h(this,n,"m",d).call(this,t,r),_(`Started resimulating transaction ${t} every ${s.RESIMULATE_INTERVAL_MS} milliseconds`)},d=function(e,t){const n=setTimeout(t,s.RESIMULATE_INTERVAL_MS);h(this,a,"f").set(e,n)},l=function(e){h(this,a,"f").has(e)&&(h(this,n,"m",m).call(this,e),_(`Stopped resimulating transaction ${e} every ${s.RESIMULATE_INTERVAL_MS} milliseconds`))},m=function(e){const t=h(this,a,"f").get(e);t&&(clearTimeout(t),h(this,a,"f").delete(e))},s.shouldResimulate=function(e,t){const{id:n}=t,a=function(e,t){const{id:n,txParams:a}=t,{txParams:r}=e;if(!r||(0,g.isEqual)(r,a))return!1;const i=Object.keys(a).filter(e=>a[e]!==r[e]);return _("Transaction parameters updated",{transactionId:n,updatedProperties:i,originalParams:r,newParams:a}),s.RESIMULATE_PARAMS.some(e=>i.includes(e))}(e,t),r=function(e,t){const{securityAlertResponse:n}=e,{id:a,securityAlertResponse:r}=t;if((0,g.isEqual)(n,r))return!1;return _("Security alert updated",{transactionId:a,originalSecurityAlertResponse:n,newSecurityAlertResponse:r}),r?.result_type===s.BLOCKAID_RESULT_TYPE_MALICIOUS}(e,t),i=function(e,t){const{simulationData:s}=e,{simulationData:n,txParams:a}=t;if(!n||(0,g.isEqual)(s,n))return!1;return!E(a?.value??"0x0",n?.nativeBalanceChange?.difference??"0x0",!1,!1===n?.nativeBalanceChange?.isDecrease)}(e,t),o=a||r||i;let c;if(r||i){c=Math.floor(Date.now()/1e3)+s.BLOCK_TIME_ADDITIONAL_SECONDS}return o&&_("Transaction should be resimulated",{transactionId:n,blockTime:c,parametersUpdated:a,securityAlert:r,valueAndNativeBalanceMismatch:i}),{blockTime:c,resimulate:o}},s.hasSimulationDataChanged=function(e,t){if((0,g.isEqual)(e,t))return!1;if(T(e?.nativeBalanceChange,t?.nativeBalanceChange))return _("Simulation data native balance changed"),!0;if(e.tokenBalanceChanges.length!==t.tokenBalanceChanges.length)return!0;for(const s of e.tokenBalanceChanges){const e=t.tokenBalanceChanges.find(({address:e,id:t})=>e===s.address&&t===s.id);if(!e)return _("Missing new token balance",{address:s.address,id:s.id}),!0;if(T(s,e))return _("Simulation data token balance changed",{originalTokenBalanceChange:s,newTokenBalanceChange:e}),!0}return!1}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/ResimulateHelper.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/feature-flags.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,s){var n,a,r,i,o,c,d,l,m,u,h,f,p,g,k,b,w,_=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},T=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.TransactionPoller=void 0;const E=e("@metamask/utils"),S=e("lodash"),I=e("../logger.cjs"),A=e("../utils/feature-flags.cjs"),y=(0,E.createModuleLogger)(I.projectLogger,"transaction-poller");var x;!function(e){e.Accelerated="Accelerated",e.BlockTracker="BlockTracker",e.Websocket="Websocket"}(x||(x={}));s.TransactionPoller=class{constructor({blockTracker:e,chainId:t,messenger:s}){n.add(this),a.set(this,0),r.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l.set(this,void 0),m.set(this,!1),u.set(this,void 0),k.set(this,e=>{if(!T(this,m,"f"))return;if("confirmed"!==e.status&&"dropped"!==e.status&&"failed"!==e.status)return;const t=T(this,l,"f")?.some(t=>t.hash?.toLowerCase()===e.id.toLowerCase());t&&T(this,n,"m",f).call(this,x.Websocket).catch(()=>{})}),_(this,r,e,"f"),_(this,i,t,"f"),_(this,o,s,"f")}start(e){T(this,m,"f")||(_(this,d,e,"f"),_(this,m,!0,"f"),T(this,n,"m",b).call(this),T(this,n,"m",h).call(this),y("Started"))}stop(){T(this,m,"f")&&(_(this,m,!1,"f"),_(this,d,undefined,"f"),_(this,a,0,"f"),_(this,l,undefined,"f"),T(this,n,"m",p).call(this),T(this,n,"m",g).call(this),T(this,n,"m",w).call(this),y("Stopped"))}setPendingTransactions(e){const t=(T(this,l,"f")??[]).map(e=>e.id);_(this,l,e,"f");const s=e.map(e=>e.id),r=!(0,S.isEqual)(t,s);T(this,m,"f")&&r&&(y("Detected new pending transactions",s),_(this,a,0,"f"),T(this,c,"f")&&(T(this,n,"m",g).call(this),T(this,n,"m",h).call(this)))}},a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,u=new WeakMap,k=new WeakMap,n=new WeakSet,h=function e(){if(!T(this,m,"f"))return;const{countMax:t,intervalMs:s}=(0,A.getAcceleratedPollingParams)(T(this,i,"f"),T(this,o,"f"));if(T(this,a,"f")>=t)return _(this,c,e=>T(this,n,"m",f).call(this,x.BlockTracker,e),"f"),T(this,r,"f").on("latest",T(this,c,"f")),void y("Added block tracker listener");T(this,n,"m",p).call(this),_(this,u,setTimeout(async()=>{await T(this,n,"m",f).call(this,x.Accelerated),T(this,n,"m",e).call(this)},s),"f")},f=async function(e,t){switch(e){case x.Websocket:y("AccountActivityService:transactionUpdated received");break;case x.Accelerated:y("Accelerated interval",T(this,a,"f")+1);break;case x.BlockTracker:y("Block tracker interval",t)}const s=t??await T(this,r,"f").getLatestBlock();await(T(this,d,"f")?.call(this,s)),e===x.Accelerated&&T(this,m,"f")&&_(this,a,T(this,a,"f")+1,"f")},p=function(){T(this,u,"f")&&(clearTimeout(T(this,u,"f")),_(this,u,undefined,"f"))},g=function(){T(this,c,"f")&&(T(this,r,"f").removeListener("latest",T(this,c,"f")),_(this,c,undefined,"f"))},b=function(){T(this,o,"f").subscribe("AccountActivityService:transactionUpdated",T(this,k,"f"))},w=function(){T(this,o,"f").unsubscribe("AccountActivityService:transactionUpdated",T(this,k,"f"))}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/TransactionPoller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.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,s){var n,a,r,i,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.CollectPublishHook=void 0;const l=e("@metamask/utils"),m=e("lodash"),u=e("../logger.cjs"),h=(0,l.createModuleLogger)(u.projectLogger,"collect-publish-hook");s.CollectPublishHook=class{constructor(e){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c(this,i,(0,l.createDeferredPromise)(),"f"),c(this,a,[],"f"),c(this,r,e,"f")}getHook(){return d(this,n,"m",o).bind(this)}ready(){return d(this,i,"f").promise}success(e){if(h("Success",{transactionHashes:e}),e.length!==d(this,r,"f"))throw new Error("Transaction hash count mismatch");for(let t=0;t<d(this,a,"f").length;t++){const s=d(this,a,"f")[t],n=e[t];s.promise.resolve({transactionHash:n})}}error(e){h("Error",{error:e});for(const t of d(this,a,"f"))t.promise.reject(e)}},a=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,o=function(e,t){const s=e.txParams.nonce??"0x0",n=parseInt(s,16);h("Processing transaction",{nonce:n,signedTx:t,transactionMeta:e});const o=(0,l.createDeferredPromise)();if(d(this,a,"f").push({nonce:n,promise:o,signedTransaction:t}),c(this,a,(0,m.sortBy)(d(this,a,"f"),e=>e.nonce),"f"),d(this,a,"f").length===d(this,r,"f")){h("All transactions signed");const e=d(this,a,"f").map(e=>e.signedTransaction);d(this,i,"f").resolve({signedTransactions:e})}return o.promise}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/CollectPublishHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-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,s){var n,a,r,i,o,c=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},d=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.ExtraTransactionsPublishHook=void 0;const l=e("@metamask/utils"),m=e("../logger.cjs"),u=(0,l.createModuleLogger)(m.projectLogger,"extra-transactions-publish-hook");s.ExtraTransactionsPublishHook=class{constructor({addTransactionBatch:e,getTransaction:t,originalPublishHook:s}){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),c(this,a,e,"f"),c(this,r,t,"f"),c(this,i,s,"f")}getHook(){return d(this,n,"m",o).bind(this)}},a=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,o=async function(e,t){u("Publishing transaction as batch",{transactionMeta:e,signedTx:t});const{batchTransactions:s,batchTransactionsOptions:n,id:o,networkClientId:c,txParams:m}=e,h=m.from,f=m.to,p=m.data,g=m.value,k=m.gas,b=m.maxFeePerGas,w=m.maxPriorityFeePerGas,_=t,T=(0,l.createDeferredPromise)(),E={existingTransaction:{id:o,onPublish:({newSignature:e,transactionHash:t})=>{if(e){const t=d(this,r,"f").call(this,o);return u("Calling original publish hook with new signature",{latestTransactionMeta:t,newSignature:e}),void d(this,i,"f").call(this,t,e).then(T.resolve).catch(T.reject)}T.resolve({transactionHash:t})},signedTransaction:_},params:{data:p,gas:k,maxFeePerGas:b,maxPriorityFeePerGas:w,to:f,value:g}},S=(s??[]).map(e=>{const{isAfter:t,type:s,...n}=e;return{isAfter:t,params:n,type:s}}),I=[...S.filter(e=>!1===e.isAfter).map(({isAfter:e,...t})=>({...t})),E,...S.filter(e=>e.isAfter===undefined||e.isAfter).map(({isAfter:e,...t})=>({...t}))];u("Adding transaction batch",{from:h,networkClientId:c,transactions:I});const A=n??{disable7702:!0,disableHook:!1,disableSequential:!0};return await d(this,a,"f").call(this,{from:h,networkClientId:c,requireApproval:!1,transactions:I,...A}),T.promise}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/ExtraTransactionsPublishHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.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,s){var n,a,r,i,o,c,d,l,m,u,h,f=this&&this.__classPrivateFieldSet||function(e,t,s,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,s):a?a.value=s:t.set(e,s),s},p=this&&this.__classPrivateFieldGet||function(e,t,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)};Object.defineProperty(s,"__esModule",{value:!0}),s.SequentialPublishBatchHook=void 0;const g=e("@metamask/rpc-errors"),k=e("@metamask/utils"),b=e("../logger.cjs"),w=(0,k.createModuleLogger)(b.projectLogger,"sequential-publish-batch-hook");s.SequentialPublishBatchHook=class{constructor({publishTransaction:e,getTransaction:t,getPendingTransactionTracker:s,getEthQuery:d}){n.add(this),a.set(this,void 0),r.set(this,void 0),i.set(this,void 0),o.set(this,void 0),c.set(this,{}),f(this,a,e,"f"),f(this,r,t,"f"),f(this,i,d,"f"),f(this,o,s,"f")}getHook(){return p(this,n,"m",d).bind(this)}},a=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,c=new WeakMap,n=new WeakSet,d=async function({from:e,networkClientId:t,transactions:s}){w("Starting sequential publish batch hook",{from:e,networkClientId:t});const c=p(this,o,"f").call(this,t),d=[];for(const e of s)try{const s=p(this,r,"f").call(this,String(e.id)),o=await p(this,a,"f").call(this,p(this,i,"f").call(this,t),s);w("Transaction published",{transactionHash:o});const m={...s,hash:o},u=p(this,n,"m",l).call(this,c,m.id,m.hash);c.addTransactionToPoll(m),await u,d.push({transactionHash:o})}catch(t){throw w("Batch transaction failed",{transaction:e,error:t}),c.stop(),g.rpcErrors.internal("Failed to publish batch transaction")}return w("Sequential publish batch hook completed",{results:d}),c.stop(),{results:d}},l=async function(e,t,s){return new Promise((a,r)=>{const i=p(this,n,"m",m).bind(this,t,s,a,e),o=p(this,n,"m",u).bind(this,t,s,r,e);p(this,c,"f")[t]={onConfirmed:i,onFailedOrDropped:o},e.hub.on("transaction-confirmed",i),e.hub.on("transaction-failed",o),e.hub.on("transaction-dropped",o)})},m=function(e,t,s,a,r){r.id===e&&(w("Transaction confirmed",{transactionHash:t}),p(this,n,"m",h).call(this,a,e),s(r))},u=function(e,t,s,a,r,i){r.id===e&&(w("Transaction failed or dropped",{transactionHash:t,error:i}),p(this,n,"m",h).call(this,a,e),s(new Error(`Transaction ${t} failed or dropped.`)))},h=function(e,t){const s=p(this,c,"f")[t];e.hub.off("transaction-confirmed",s.onConfirmed),e.hub.off("transaction-failed",s.onFailedOrDropped),e.hub.off("transaction-dropped",s.onFailedOrDropped),delete p(this,c,"f")[t]}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/hooks/SequentialPublishBatchHook.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs",{"./TransactionController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/TransactionController.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","./helpers/AccountsApiRemoteTransactionSource.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/helpers/AccountsApiRemoteTransactionSource.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./utils/gas-flow.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/gas-flow.cjs","./utils/prepare.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/prepare.cjs","./utils/transaction-type.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/transaction-type.cjs","./utils/utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.HARDFORK=s.INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS=s.CHAIN_IDS=s.normalizeTransactionParams=s.isEIP1559Transaction=s.mergeGasFeeEstimates=s.determineTransactionType=s.WalletDevice=s.UserFeeLevel=s.TransactionType=s.TransactionStatus=s.TransactionEnvelopeType=s.TransactionContainerType=s.SimulationTokenStandard=s.SimulationErrorCode=s.GasFeeEstimateType=s.GasFeeEstimateLevel=s.TransactionController=s.SPEED_UP_RATE=s.CANCEL_RATE=void 0;var n=e("./TransactionController.cjs");Object.defineProperty(s,"CANCEL_RATE",{enumerable:!0,get:function(){return n.CANCEL_RATE}}),Object.defineProperty(s,"SPEED_UP_RATE",{enumerable:!0,get:function(){return n.SPEED_UP_RATE}}),Object.defineProperty(s,"TransactionController",{enumerable:!0,get:function(){return n.TransactionController}});var a=e("./types.cjs");Object.defineProperty(s,"GasFeeEstimateLevel",{enumerable:!0,get:function(){return a.GasFeeEstimateLevel}}),Object.defineProperty(s,"GasFeeEstimateType",{enumerable:!0,get:function(){return a.GasFeeEstimateType}}),Object.defineProperty(s,"SimulationErrorCode",{enumerable:!0,get:function(){return a.SimulationErrorCode}}),Object.defineProperty(s,"SimulationTokenStandard",{enumerable:!0,get:function(){return a.SimulationTokenStandard}}),Object.defineProperty(s,"TransactionContainerType",{enumerable:!0,get:function(){return a.TransactionContainerType}}),Object.defineProperty(s,"TransactionEnvelopeType",{enumerable:!0,get:function(){return a.TransactionEnvelopeType}}),Object.defineProperty(s,"TransactionStatus",{enumerable:!0,get:function(){return a.TransactionStatus}}),Object.defineProperty(s,"TransactionType",{enumerable:!0,get:function(){return a.TransactionType}}),Object.defineProperty(s,"UserFeeLevel",{enumerable:!0,get:function(){return a.UserFeeLevel}}),Object.defineProperty(s,"WalletDevice",{enumerable:!0,get:function(){return a.WalletDevice}});var r=e("./utils/transaction-type.cjs");Object.defineProperty(s,"determineTransactionType",{enumerable:!0,get:function(){return r.determineTransactionType}});var i=e("./utils/gas-flow.cjs");Object.defineProperty(s,"mergeGasFeeEstimates",{enumerable:!0,get:function(){return i.mergeGasFeeEstimates}});var o=e("./utils/utils.cjs");Object.defineProperty(s,"isEIP1559Transaction",{enumerable:!0,get:function(){return o.isEIP1559Transaction}}),Object.defineProperty(s,"normalizeTransactionParams",{enumerable:!0,get:function(){return o.normalizeTransactionParams}});var c=e("./constants.cjs");Object.defineProperty(s,"CHAIN_IDS",{enumerable:!0,get:function(){return c.CHAIN_IDS}});var d=e("./helpers/AccountsApiRemoteTransactionSource.cjs");Object.defineProperty(s,"INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS",{enumerable:!0,get:function(){return d.SUPPORTED_CHAIN_IDS}});var l=e("./utils/prepare.cjs");Object.defineProperty(s,"HARDFORK",{enumerable:!0,get:function(){return l.HARDFORK}})}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-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,s){Object.defineProperty(s,"__esModule",{value:!0}),s.createModuleLogger=s.incomingTransactionsLogger=s.projectLogger=void 0;const n=e("@metamask/utils");Object.defineProperty(s,"createModuleLogger",{enumerable:!0,get:function(){return n.createModuleLogger}}),s.projectLogger=(0,n.createProjectLogger)("transaction-controller"),s.incomingTransactionsLogger=(0,n.createModuleLogger)(s.projectLogger,"incoming-transactions")}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n,a,r,i,o,c,d,l,m,u;Object.defineProperty(s,"__esModule",{value:!0}),s.SimulationErrorCode=s.SimulationTokenStandard=s.GasFeeEstimateType=s.GasFeeEstimateLevel=s.UserFeeLevel=s.TransactionEnvelopeType=s.TransactionContainerType=s.TransactionType=s.WalletDevice=s.TransactionStatus=void 0,function(e){e.unapproved="unapproved",e.approved="approved",e.signed="signed",e.submitted="submitted",e.confirmed="confirmed",e.failed="failed",e.dropped="dropped",e.rejected="rejected",e.cancelled="cancelled"}(n||(s.TransactionStatus=n={})),function(e){e.MM_MOBILE="metamask_mobile",e.MM_EXTENSION="metamask_extension",e.OTHER="other_device"}(a||(s.WalletDevice=a={})),function(e){e.batch="batch",e.bridge="bridge",e.bridgeApproval="bridgeApproval",e.cancel="cancel",e.contractInteraction="contractInteraction",e.deployContract="contractDeployment",e.ethDecrypt="eth_decrypt",e.ethGetEncryptionPublicKey="eth_getEncryptionPublicKey",e.gasPayment="gas_payment",e.incoming="incoming",e.lendingDeposit="lendingDeposit",e.lendingWithdraw="lendingWithdraw",e.musdClaim="musdClaim",e.musdConversion="musdConversion",e.perpsAcrossDeposit="perpsAcrossDeposit",e.perpsDeposit="perpsDeposit",e.perpsDepositAndOrder="perpsDepositAndOrder",e.perpsRelayDeposit="perpsRelayDeposit",e.personalSign="personal_sign",e.predictAcrossDeposit="predictAcrossDeposit",e.predictBuy="predictBuy",e.predictClaim="predictClaim",e.predictDeposit="predictDeposit",e.predictDepositAndOrder="predictDepositAndOrder",e.predictSell="predictSell",e.predictWithdraw="predictWithdraw",e.predictRelayDeposit="predictRelayDeposit",e.relayDeposit="relayDeposit",e.retry="retry",e.revokeDelegation="revokeDelegation",e.simpleSend="simpleSend",e.signTypedData="eth_signTypedData",e.smart="smart",e.stakingClaim="stakingClaim",e.stakingDeposit="stakingDeposit",e.stakingUnstake="stakingUnstake",e.swap="swap",e.swapAndSend="swapAndSend",e.swapApproval="swapApproval",e.tokenMethodApprove="approve",e.tokenMethodSafeTransferFrom="safetransferfrom",e.tokenMethodTransfer="transfer",e.tokenMethodTransferFrom="transferfrom",e.tokenMethodSetApprovalForAll="setapprovalforall",e.tokenMethodIncreaseAllowance="increaseAllowance",e.shieldSubscriptionApprove="shieldSubscriptionApprove"}(r||(s.TransactionType=r={})),function(e){e.EnforcedSimulations="enforcedSimulations"}(i||(s.TransactionContainerType=i={})),function(e){e.legacy="0x0",e.accessList="0x1",e.feeMarket="0x2",e.setCode="0x4"}(o||(s.TransactionEnvelopeType=o={})),function(e){e.CUSTOM="custom",e.DAPP_SUGGESTED="dappSuggested",e.MEDIUM="medium"}(c||(s.UserFeeLevel=c={})),function(e){e.Low="low",e.Medium="medium",e.High="high"}(d||(s.GasFeeEstimateLevel=d={})),function(e){e.FeeMarket="fee-market",e.Legacy="legacy",e.GasPrice="eth_gasPrice"}(l||(s.GasFeeEstimateType=l={})),function(e){e.erc20="erc20",e.erc721="erc721",e.erc1155="erc1155"}(m||(s.SimulationTokenStandard=m={})),function(e){e.ChainNotSupported="chain-not-supported",e.Disabled="disabled",e.InvalidResponse="invalid-response",e.Reverted="reverted"}(u||(s.SimulationErrorCode=u={}))}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs",{"../api/simulation-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/api/simulation-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/constants.cjs","../errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/errors.cjs","../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/logger.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/types.cjs","./balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance.cjs","@ethersproject/abi":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/abi/lib/index.js","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/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","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.getBalanceChanges=s.SupportedToken=void 0;const a=e("@ethersproject/abi"),r=e("@metamask/controller-utils"),i=e("@metamask/metamask-eth-abis"),o=e("@metamask/utils"),c=n(e("bn.js")),d=e("./balance.cjs"),l=e("../api/simulation-api.cjs"),m=e("../constants.cjs"),u=e("../errors.cjs"),h=e("../logger.cjs"),f=e("../types.cjs");var p;!function(e){e.ERC20="erc20",e.ERC721="erc721",e.ERC1155="erc1155",e.ERC20_WRAPPED="erc20Wrapped",e.ERC721_LEGACY="erc721Legacy"}(p||(s.SupportedToken=p={}));const g=(0,o.createModuleLogger)(h.projectLogger,"balance-changes"),k=["Transfer","TransferSingle","TransferBatch","Deposit","Withdrawal"],b={[p.ERC20]:{abi:i.abiERC20,standard:f.SimulationTokenStandard.erc20},[p.ERC721]:{abi:i.abiERC721,standard:f.SimulationTokenStandard.erc721},[p.ERC1155]:{abi:i.abiERC1155,standard:f.SimulationTokenStandard.erc1155},[p.ERC20_WRAPPED]:{abi:m.ABI_SIMULATION_ERC20_WRAPPED,standard:f.SimulationTokenStandard.erc20},[p.ERC721_LEGACY]:{abi:m.ABI_SIMULATION_ERC721_LEGACY,standard:f.SimulationTokenStandard.erc721}},w=["execution reverted","insufficient funds for gas"];function _(e){if(Array.isArray(e))return e.map(_);let t=e;return t=t.toHexString?.()??t,t=t.toLowerCase?.()??t,t}function T(e){return"Transfer"===e.name&&e.tokenStandard===f.SimulationTokenStandard.erc721&&0===parseInt(e.args.from,16)}function E(e){return e.tokenStandard===f.SimulationTokenStandard.erc721?[e.args.tokenId]:e.tokenStandard===f.SimulationTokenStandard.erc1155&&"TransferSingle"===e.name?[e.args.id]:e.tokenStandard===f.SimulationTokenStandard.erc1155&&"TransferBatch"===e.name?e.args.ids:[undefined]}function S(e){switch(e){case f.SimulationTokenStandard.erc721:return new a.Interface(i.abiERC721);case f.SimulationTokenStandard.erc1155:return new a.Interface(i.abiERC1155);default:return new a.Interface(i.abiERC20)}}function I(e,t,s){const n=S(t.standard);try{if(t.standard===f.SimulationTokenStandard.erc721){const t=n.decodeFunctionResult("ownerOf",s.return);return t[0].toLowerCase()===e.toLowerCase()?"0x1":"0x0"}const a=n.decodeFunctionResult("balanceOf",s.return);return(0,r.toHex)(a[0])}catch(e){throw g("Failed to decode balance transaction",e,{token:t,response:s}),new u.SimulationError(`Failed to decode balance transaction for token ${t.address}: ${String(e)}`)}}function A(e,t,s){const n=S(e);switch(e){case f.SimulationTokenStandard.erc721:return n.encodeFunctionData("ownerOf",[s]);case f.SimulationTokenStandard.erc1155:return n.encodeFunctionData("balanceOf",[t,s]);default:return n.encodeFunctionData("balanceOf",[t])}}function y(e){return[...e.logs??[],...(e.calls??[]).map(e=>y(e)).flat()]}function x(e){if(!e)return[];return[...e.error?[e.error]:[],...(e.calls??[]).flatMap(e=>x(e))]}function v(e,t,s=0){const n=(0,r.hexToBN)(t).add(new c.default(s)),a=(0,r.hexToBN)(e),i=n.sub(a),o=i.isNeg(),d=(0,r.toHex)(i.abs());return i.isZero()?(g("Balance change is zero"),undefined):{previousBalance:e,newBalance:(0,r.toHex)(n),difference:d,isDecrease:o}}async function C({request:e,params:t,before:s=[],after:n=[]}){const{blockTime:a,chainId:i,ethQuery:o,getSimulationConfig:m,txParams:u}=e,{authorizationList:h}=u,f=u.from,p=h?.map(e=>({address:e.address,from:f})),k=[...s,{authorizationList:p,data:u.data,from:u.from,gas:u.gas,maxFeePerGas:u.maxFeePerGas??u.gasPrice,maxPriorityFeePerGas:u.maxPriorityFeePerGas??u.gasPrice,to:u.to,value:u.value},...n],b=function(e){const{txParams:t}=e,s=(0,r.hexToBN)(t.gas??"0x0"),n=(0,r.hexToBN)(t.maxFeePerGas??t.gasPrice??"0x0"),a=(0,r.hexToBN)(t.value??"0x0"),i=(e.nestedTransactions??[]).map(e=>(0,r.hexToBN)(e.value??"0x0")).reduce((e,t)=>e.add(t),new c.default(0));return s.mul(n).add(a).add(i)}(e),w=(0,r.toHex)(b);g("Required balance",w);const{balanceRaw:_}=await(0,d.getNativeBalance)(f,o),T=(0,r.toHex)(_),E=(0,r.hexToBN)(T);g("Current balance",T);const S=E.lt(b);return await(0,l.simulateTransactions)(i,{...t,getSimulationConfig:m,transactions:k,withGas:!0,withDefaultBlockOverrides:!0,...a&&{blockOverrides:{...t?.blockOverrides,time:(0,r.toHex)(a)}},...S&&{overrides:{...t?.overrides,[f]:{...t?.overrides?.[f],balance:w}}}})}s.getBalanceChanges=async function(e){let t;g("Request",e);try{const s=await C({request:e,params:{withCallTrace:!0,withLogs:!0}}),n=s.transactions?.[0];t=x(n?.callTrace);const r=n?.error;if(r)throw new u.SimulationError(r);const i=function(e,t){const s=t.transactions[0];if(!s)return undefined;const{txParams:n}=e,a=n.from,{stateDiff:r}=s,i=r?.pre?.[a]?.balance,o=r?.post?.[a]?.balance;if(!i||!o)return undefined;return v(i,o,s.gasCost)}(e,s),o=function(e){const t=y(e.transactions[0]?.callTrace??{});g("Extracted logs",t);const s=function(){const e=Object.values(p);return new Map(e.map(e=>{const{abi:t}=b[e];return[e,new a.Interface(t)]}))}();return t.map(e=>{const t=function(e,t){const s=Object.values(p);for(const n of s)try{const s=t.get(n),{abi:a,standard:r}=b[n];return{...s.parseLog(e),abi:a,standard:r}}catch{continue}return undefined}(e,s);if(!t)return g("Failed to parse log",e),undefined;const n=t.abi.find(e=>e.name===t.name)?.inputs;if(!n)return g("Failed to find inputs for event",t),undefined;if(!k.includes(t.name))return g("Ignoring unsupported event",t.name,t),undefined;g("Normalizing event args",t.name,t);const a=function(e,t){return e.reduce((e,s,n)=>{const a=t[n].name.replace("_",""),r=_(s);return e[a]=r,e},{})}(t.args,n);return{contractAddress:e.address,tokenStandard:t.standard,name:t.name,args:a,abi:t.abi}}).filter(e=>e!==undefined)}(s);g("Parsed events",o);const c=await async function(e,t){const{txParams:s}=e,n=s.from,a=function(e,t){const s=new Set,n=new Map,a=new Map,r=e.txParams.from,i=t.filter(e=>[e.args.from,e.args.to].includes(r));g("Filtered user events",i);for(const e of i){const t=E(e);g("Extracted token IDs",t);for(const i of t){const t={address:e.contractAddress,standard:e.tokenStandard,id:i},o=JSON.stringify(t);if(s.has(o)){g("Ignoring additional event with same contract and token ID",t);continue}s.add(o);const c=A(e.tokenStandard,r,i),d={from:r,to:e.contractAddress,data:c};T(e)||n.set(t,d),a.set(t,d)}}return{before:n,after:a}}(e,t);g("Generated balance transactions",[...a.after.values()]);const r=a.before.size+a.after.size+1;if(1===r)return[];const i=await C({request:e,before:[...a.before.values()],after:[...a.after.values()]});if(g("Balance simulation response",i),i.transactions.length!==r)throw new u.SimulationInvalidResponseError;let o=0;return[...a.after.keys()].map((e,t)=>{const s=v(!a.before.get(e)?"0x0":I(n,e,i.transactions[o++]),I(n,e,i.transactions[t+a.before.size+1]));return s?{...e,...s}:undefined}).filter(e=>e!==undefined)}(e,o),d=n?.gasUsed;return{simulationData:{callTraceErrors:t,nativeBalanceChange:i,tokenBalanceChanges:c},gasUsed:d}}catch(s){g("Failed to get balance changes",s,e);let n=s;w.some(e=>n.message?.includes(e))&&(n=new u.SimulationRevertedError);const{code:a,message:r}=n;return{simulationData:{callTraceErrors:t,tokenBalanceChanges:[],error:{code:a,message:r}},gasUsed:undefined}}}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance-changes.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance.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/eip-5792-middleware/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.isNativeBalanceSufficientForGas=s.getNativeBalance=void 0;const n=e("@metamask/controller-utils"),a=e("bignumber.js");async function r(e,t){const s=await(0,n.query)(t,"getBalance",[e,"latest"]),r=new a.BigNumber(s).toString(10);return{balanceHuman:new a.BigNumber(r).shiftedBy(-18).toString(10),balanceRaw:r}}s.getNativeBalance=r,s.isNativeBalanceSufficientForGas=async function(e,t){const s=e.txParams.from,n=new a.BigNumber(e.txParams.gas??"0x0").multipliedBy(e.txParams.maxFeePerGas??e.txParams.gasPrice??"0x0"),{balanceRaw:i}=await r(s,t);return n.isLessThanOrEqualTo(i)}}}},{package:"@metamask/eip-5792-middleware>@metamask/transaction-controller",file:"node_modules/@metamask/eip-5792-middleware/node_modules/@metamask/transaction-controller/dist/utils/balance.cjs"}]],[],{});